From e902349fefd0176e40e46c47c1239fd7e7c997dc Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 31 Oct 2023 11:56:24 +0000 Subject: [PATCH 0001/2300] [nrf fromlist] cmake: Add support for sysbuild-set signing script Allows a sysbuild project to specify a signing script file to use instead of the default zephyr one Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/63912 Signed-off-by: Jamie McCrae (cherry picked from commit f8e27684ca11e884c1e8ae6e1903c815277137a6) --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 164d82fde0e..97bcd98d0d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1806,8 +1806,15 @@ endif() # Generate and use MCUboot related artifacts as needed. if(CONFIG_BOOTLOADER_MCUBOOT) get_target_property(signing_script zephyr_property_target SIGNING_SCRIPT) + if(NOT signing_script) - set_target_properties(zephyr_property_target PROPERTIES SIGNING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/cmake/mcuboot.cmake) + zephyr_get(signing_script VAR SIGNING_SCRIPT SYSBUILD) + + if(signing_script) + set_target_properties(zephyr_property_target PROPERTIES SIGNING_SCRIPT ${signing_script}) + else() + set_target_properties(zephyr_property_target PROPERTIES SIGNING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/cmake/mcuboot.cmake) + endif() endif() endif() From c187d31c1d999fa091b4da55b7a7696cb0d8cbbe Mon Sep 17 00:00:00 2001 From: Kyra Lengfeld Date: Fri, 24 Nov 2023 15:44:38 +0100 Subject: [PATCH 0002/2300] [nrf fromtree] Bluetooth: Controller: Add Kconfig for LE Power Control Request Feature Add the controller Kconfig to use in Zephyr. Signed-off-by: Kyra Lengfeld (cherry picked from commit 56a59019559f6bb7237b50644e765306a8b3d527) Signed-off-by: Kyra Lengfeld (cherry picked from commit 6af59667d730b009cec654671b0a1f3eee0f06fd) --- subsys/bluetooth/controller/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 742534beff3..7d430ded1e1 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -101,6 +101,9 @@ config BT_CTLR_READ_ISO_LINK_QUALITY_SUPPORT BT_CTLR_PERIPHERAL_ISO_SUPPORT bool +config BT_CTLR_LE_POWER_CONTROL_SUPPORT + bool + config BT_CTLR bool "Bluetooth Controller" help @@ -484,6 +487,14 @@ config BT_CTLR_CONN_RSSI help Enable connection RSSI measurement. +config BT_CTLR_LE_POWER_CONTROL + bool "LE Power Control Request Feature" + depends on BT_CTLR_LE_POWER_CONTROL_SUPPORT + default y if BT_TRANSMIT_POWER_CONTROL + help + Enable support for LE Power Control Request feature that is defined in the + Bluetooth Core specification, Version 5.4 | Vol 6, Part B, Section 4.6.31. + endif # BT_CONN config BT_CTLR_FILTER_ACCEPT_LIST From 69d1ee3676de575f7d8356185bdff0204a53ec46 Mon Sep 17 00:00:00 2001 From: Kyra Lengfeld Date: Thu, 16 Nov 2023 09:09:26 +0100 Subject: [PATCH 0003/2300] [nrf fromtree] Bluetooth: Host: Add LE Power Control Request Procedure APIs This commits adds the LE API's for the LE Power Control Request Feature in Zephyr. The support of feature is provided with the controller-based feature selection with BT_CTLR_LE_POWER_CONTROL_SUPPORT and is selectable via BT_TRANSMIT_POWER_CONTROL. With the new APIs, the applications will: get improved reading of local and remote tx power be aware of changes in remote or local tx power Defined HCI commands in Core Spec v5.4: 7.8.117 LE Enhanced Read Transmit Power Level command: improvement to existing local tx power reading. 7.8.118 LE Read Remote Transmit Power Level command: Remote tx power is read through an event (LE Transmit Power Reporting) 7.8.121 LE Set Transmit Power Reporting Enable command: Enables local or remote tx power reporting to monitor changes in tx power 7.7.65.33 LE Transmit Power Reporting event Note: to utilize the Feature fully Nordic-LL-only vendor-specific commands are needed. These will not be added in RTOS zephyr but instead implemented in a maintainable way in sdk. Signed-off-by: Kyra Lengfeld (cherry picked from commit 93e5cf6e6183ea87eefe3a028a0c39e683446677) Signed-off-by: Kyra Lengfeld (cherry picked from commit 90bd9418d718975f0cba8d2a1c3c27fddb10cbcf) --- include/zephyr/bluetooth/conn.h | 87 +++++++++++++++++++++ include/zephyr/bluetooth/hci_types.h | 49 ++++++++++++ subsys/bluetooth/Kconfig | 8 ++ subsys/bluetooth/host/conn.c | 108 +++++++++++++++++++++++++- subsys/bluetooth/host/conn_internal.h | 3 + subsys/bluetooth/host/hci_core.c | 34 ++++++++ 6 files changed, 285 insertions(+), 4 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 09b8321d685..bdc644d82e9 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -479,6 +479,42 @@ struct bt_conn_le_tx_power { int8_t max_level; }; + +/** LE Transmit Power Reporting Structure */ +struct bt_conn_le_tx_power_report { + + /** Reason for Transmit power reporting, + * as documented in Core Spec. Version 5.4 Vol. 4, Part E, 7.7.65.33. + */ + uint8_t reason; + + /** Phy of Transmit power reporting. */ + enum bt_conn_le_tx_power_phy phy; + + /** Transmit power level + * - 0xXX - Transmit power level + * + Range: -127 to 20 + * + Units: dBm + * + * - 0x7E - Remote device is not managing power levels on this PHY. + * - 0x7F - Transmit power level is not available + */ + int8_t tx_power_level; + + /** Bit 0: Transmit power level is at minimum level. + * Bit 1: Transmit power level is at maximum level. + */ + uint8_t tx_power_level_flag; + + /** Change in transmit power level + * - 0xXX - Change in transmit power level (positive indicates increased + * power, negative indicates decreased power, zero indicates unchanged) + * Units: dB + * - 0x7F - Change is not available or is out of range. + */ + int8_t delta; +}; + /** @brief Passkey Keypress Notification type * * The numeric values are the same as in the Core specification for Pairing @@ -530,6 +566,41 @@ int bt_conn_get_remote_info(struct bt_conn *conn, int bt_conn_le_get_tx_power_level(struct bt_conn *conn, struct bt_conn_le_tx_power *tx_power_level); +/** @brief Get local enhanced connection transmit power level. + * + * @param conn Connection object. + * @param tx_power Transmit power level descriptor. + * + * @return Zero on success or (negative) error code on failure. + * @retval -ENOBUFS HCI command buffer is not available. + */ +int bt_conn_le_enhanced_get_tx_power_level(struct bt_conn *conn, + struct bt_conn_le_tx_power *tx_power); + +/** @brief Get remote (peer) transmit power level. + * + * @param conn Connection object. + * @param phy PHY information. + * + * @return Zero on success or (negative) error code on failure. + * @retval -ENOBUFS HCI command buffer is not available. + */ +int bt_conn_le_get_remote_tx_power_level(struct bt_conn *conn, + enum bt_conn_le_tx_power_phy phy); + +/** @brief Enable transmit power reporting. + * + * @param conn Connection object. + * @param local_enable Enable/disable reporting for local. + * @param remote_enable Enable/disable reporting for remote. + * + * @return Zero on success or (negative) error code on failure. + * @retval -ENOBUFS HCI command buffer is not available. + */ +int bt_conn_le_set_tx_power_report_enable(struct bt_conn *conn, + bool local_enable, + bool remote_enable); + /** @brief Update the connection parameters. * * If the local device is in the peripheral role then updating the connection @@ -1052,6 +1123,22 @@ struct bt_conn_cb { const struct bt_df_conn_iq_samples_report *iq_report); #endif /* CONFIG_BT_DF_CONNECTION_CTE_RX */ +#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) + /** @brief LE Read Remote Transmit Power Level procedure has completed or LE + * Transmit Power Reporting event. + * + * This callback notifies the application that either the remote transmit power level + * has been read from the peer or transmit power level has changed for the local or + * remote controller when transmit power reporting is enabled for the respective side + * using @ref bt_conn_le_set_tx_power_report_enable. + * + * @param conn Connection object. + * @param report Transmit power report. + */ + void (*tx_power_report)(struct bt_conn *conn, + const struct bt_conn_le_tx_power_report *report); +#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ + struct bt_conn_cb *_next; }; diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index 4d637bbe4e2..f1cb92f372c 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -571,6 +571,35 @@ struct bt_hci_rp_read_tx_power_level { int8_t tx_power_level; } __packed; +#define BT_HCI_LE_TX_POWER_PHY_1M 0x01 +#define BT_HCI_LE_TX_POWER_PHY_2M 0x02 +#define BT_HCI_LE_TX_POWER_PHY_CODED_S8 0x03 +#define BT_HCI_LE_TX_POWER_PHY_CODED_S2 0x04 +#define BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL BT_OP(BT_OGF_LE, 0x0076) +struct bt_hci_cp_le_read_tx_power_level { + uint16_t handle; + uint8_t phy; +} __packed; + +struct bt_hci_rp_le_read_tx_power_level { + uint8_t status; + uint16_t handle; + uint8_t phy; + int8_t current_tx_power_level; + int8_t max_tx_power_level; +} __packed; + +#define BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL BT_OP(BT_OGF_LE, 0x0077) + +#define BT_HCI_LE_TX_POWER_REPORT_DISABLE 0x00 +#define BT_HCI_LE_TX_POWER_REPORT_ENABLE 0x01 +#define BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE BT_OP(BT_OGF_LE, 0x007A) +struct bt_hci_cp_le_set_tx_power_report_enable { + uint16_t handle; + uint8_t local_enable; + uint8_t remote_enable; +} __packed; + #define BT_HCI_CTL_TO_HOST_FLOW_DISABLE 0x00 #define BT_HCI_CTL_TO_HOST_FLOW_ENABLE 0x01 #define BT_HCI_OP_SET_CTL_TO_HOST_FLOW BT_OP(BT_OGF_BASEBAND, 0x0031) @@ -2905,6 +2934,26 @@ struct bt_hci_evt_le_req_peer_sca_complete { uint8_t sca; } __packed; +/** Reason for Transmit power reporting. + */ +/* Local Transmit power changed. */ +#define BT_HCI_LE_TX_POWER_REPORT_REASON_LOCAL_CHANGED 0x00 +/* Remote Transmit power changed. */ +#define BT_HCI_LE_TX_POWER_REPORT_REASON_REMOTE_CHANGED 0x01 +/* HCI_LE_Read_Remote_Transmit_Power_Level command completed. */ +#define BT_HCI_LE_TX_POWER_REPORT_REASON_READ_REMOTE_COMPLETED 0x02 + +#define BT_HCI_EVT_LE_TRANSMIT_POWER_REPORT 0x21 +struct bt_hci_evt_le_transmit_power_report { + uint8_t status; + uint16_t handle; + uint8_t reason; + uint8_t phy; + int8_t tx_power_level; + uint8_t tx_power_level_flag; + int8_t delta; +} __packed; + #define BT_HCI_EVT_LE_BIGINFO_ADV_REPORT 0x22 struct bt_hci_evt_le_biginfo_adv_report { uint16_t sync_handle; diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index e02901cd906..912846e4cda 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -175,6 +175,14 @@ config BT_SCA_UPDATE depends on !BT_CTLR || BT_CTLR_SCA_UPDATE_SUPPORT help Enable support for Bluetooth 5.1 Sleep Clock Accuracy Update Procedure + +config BT_TRANSMIT_POWER_CONTROL + bool "LE Power Control" + depends on !BT_CTLR || BT_CTLR_LE_POWER_CONTROL_SUPPORT + help + Enable support for LE Power Control Request feature that is defined in the + Bluetooth Core specification, Version 5.4 | Vol 6, Part B, Section 4.6.31. + endif # BT_CONN rsource "Kconfig.iso" diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 1fd2f5fbc49..06a3e7553a2 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -2619,16 +2619,116 @@ static int bt_conn_get_tx_power_level(struct bt_conn *conn, uint8_t type, return 0; } +#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) +void notify_tx_power_report(struct bt_conn *conn, + struct bt_conn_le_tx_power_report report) +{ + for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) { + if (cb->tx_power_report) { + cb->tx_power_report(conn, &report); + } + } + + STRUCT_SECTION_FOREACH(bt_conn_cb, cb) + { + if (cb->tx_power_report) { + cb->tx_power_report(conn, &report); + } + } +} + +int bt_conn_le_enhanced_get_tx_power_level(struct bt_conn *conn, + struct bt_conn_le_tx_power *tx_power) +{ + int err; + struct bt_hci_rp_le_read_tx_power_level *rp; + struct net_buf *rsp; + struct bt_hci_cp_le_read_tx_power_level *cp; + struct net_buf *buf; + + if (!tx_power->phy) { + return -EINVAL; + } + + buf = bt_hci_cmd_create(BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL, sizeof(*cp)); + if (!buf) { + return -ENOBUFS; + } + + cp = net_buf_add(buf, sizeof(*cp)); + cp->handle = sys_cpu_to_le16(conn->handle); + cp->phy = tx_power->phy; + + err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL, buf, &rsp); + if (err) { + return err; + } + + rp = (void *) rsp->data; + tx_power->phy = rp->phy; + tx_power->current_level = rp->current_tx_power_level; + tx_power->max_level = rp->max_tx_power_level; + net_buf_unref(rsp); + + return 0; +} + +int bt_conn_le_get_remote_tx_power_level(struct bt_conn *conn, + enum bt_conn_le_tx_power_phy phy) +{ + struct bt_hci_cp_le_read_tx_power_level *cp; + struct net_buf *buf; + + if (!phy) { + return -EINVAL; + } + + buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL, sizeof(*cp)); + if (!buf) { + return -ENOBUFS; + } + + cp = net_buf_add(buf, sizeof(*cp)); + cp->handle = sys_cpu_to_le16(conn->handle); + cp->phy = phy; + + return bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL, buf, NULL); +} + +int bt_conn_le_set_tx_power_report_enable(struct bt_conn *conn, + bool local_enable, + bool remote_enable) +{ + struct bt_hci_cp_le_set_tx_power_report_enable *cp; + struct net_buf *buf; + + buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE, sizeof(*cp)); + if (!buf) { + return -ENOBUFS; + } + + cp = net_buf_add(buf, sizeof(*cp)); + cp->handle = sys_cpu_to_le16(conn->handle); + cp->local_enable = local_enable ? BT_HCI_LE_TX_POWER_REPORT_ENABLE : + BT_HCI_LE_TX_POWER_REPORT_DISABLE; + cp->remote_enable = remote_enable ? BT_HCI_LE_TX_POWER_REPORT_ENABLE : + BT_HCI_LE_TX_POWER_REPORT_DISABLE; + + return bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE, buf, NULL); +} +#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ + int bt_conn_le_get_tx_power_level(struct bt_conn *conn, struct bt_conn_le_tx_power *tx_power_level) { int err; if (tx_power_level->phy != 0) { - /* Extend the implementation when LE Enhanced Read Transmit - * Power Level HCI command is available for use. - */ - return -ENOTSUP; + if (IS_ENABLED(CONFIG_BT_TRANSMIT_POWER_CONTROL)) { + return bt_conn_le_enhanced_get_tx_power_level(conn, tx_power_level); + } else { + return -ENOTSUP; + } } err = bt_conn_get_tx_power_level(conn, BT_TX_POWER_LEVEL_CURRENT, diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 7741e259a61..a13adff704a 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -364,6 +364,9 @@ void notify_le_phy_updated(struct bt_conn *conn); bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param); +void notify_tx_power_report(struct bt_conn *conn, + struct bt_conn_le_tx_power_report report); + #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/hci_core.c b/subsys/bluetooth/host/hci_core.c index de4fb637b49..b37cd45e1ae 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -2399,6 +2399,33 @@ int bt_hci_register_vnd_evt_cb(bt_hci_vnd_evt_cb_t cb) } #endif /* CONFIG_BT_HCI_VS_EVT_USER */ +#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) +void bt_hci_le_transmit_power_report(struct net_buf *buf) +{ + struct bt_hci_evt_le_transmit_power_report *evt; + struct bt_conn_le_tx_power_report report; + struct bt_conn *conn; + + evt = net_buf_pull_mem(buf, sizeof(*evt)); + conn = bt_conn_lookup_handle(sys_le16_to_cpu(evt->handle), BT_CONN_TYPE_LE); + if (!conn) { + LOG_ERR("Unknown conn handle 0x%04X for transmit power report", + sys_le16_to_cpu(evt->handle)); + return; + } + + report.reason = evt->reason; + report.phy = evt->phy; + report.tx_power_level = evt->tx_power_level; + report.tx_power_level_flag = evt->tx_power_level_flag; + report.delta = evt->delta; + + notify_tx_power_report(conn, report); + + bt_conn_unref(conn); +} +#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ + static const struct event_handler vs_events[] = { #if defined(CONFIG_BT_DF_VS_CL_IQ_REPORT_16_BITS_IQ_SAMPLES) EVENT_HANDLER(BT_HCI_EVT_VS_LE_CONNECTIONLESS_IQ_REPORT, @@ -2544,6 +2571,10 @@ static const struct event_handler meta_events[] = { EVENT_HANDLER(BT_HCI_EVT_LE_CTE_REQUEST_FAILED, bt_hci_le_df_cte_req_failed, sizeof(struct bt_hci_evt_le_cte_req_failed)), #endif /* CONFIG_BT_DF_CONNECTION_CTE_REQ */ +#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) + EVENT_HANDLER(BT_HCI_EVT_LE_TRANSMIT_POWER_REPORT, bt_hci_le_transmit_power_report, + sizeof(struct bt_hci_evt_le_transmit_power_report)), +#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ #if defined(CONFIG_BT_PER_ADV_SYNC_RSP) EVENT_HANDLER(BT_HCI_EVT_LE_PER_ADVERTISING_REPORT_V2, bt_hci_le_per_adv_report_v2, sizeof(struct bt_hci_evt_le_per_advertising_report_v2)), @@ -3089,6 +3120,9 @@ static int le_set_event_mask(void) BT_FEAT_LE_PHY_CODED(bt_dev.le.features))) { mask |= BT_EVT_MASK_LE_PHY_UPDATE_COMPLETE; } + if (IS_ENABLED(CONFIG_BT_TRANSMIT_POWER_CONTROL)) { + mask |= BT_EVT_MASK_LE_TRANSMIT_POWER_REPORTING; + } } if (IS_ENABLED(CONFIG_BT_SMP) && From 282414d21a515bb25d5eec909a71707d41810e8c Mon Sep 17 00:00:00 2001 From: Kyra Lengfeld Date: Fri, 24 Nov 2023 15:39:01 +0100 Subject: [PATCH 0004/2300] [nrf fromtree] Bluetooth: Host: Add bt shell functions LE Power Control Request Feature To use LE commands of Le Power Control Request Feature one must utilize the BT_TRANSMIT_POWER_CONTROL config. Signed-off-by: Kyra Lengfeld (cherry picked from commit 2c9af855bc6ef00160712cf0b71c953c4d13f196) Signed-off-by: Kyra Lengfeld (cherry picked from commit 9d18c0aa9ac4139965935775aa58925f78c85a06) --- subsys/bluetooth/shell/bt.c | 178 ++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index 3f1af44de6f..f9bdd8f8094 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -123,6 +123,67 @@ static void print_le_addr(const char *desc, const bt_addr_le_t *addr) } #endif /* CONFIG_BT_CONN || (CONFIG_BT_BROADCASTER && CONFIG_BT_EXT_ADV) */ +#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) +static const char *tx_power_flag2str(int8_t flag) +{ + switch (flag) { + case 0: + return "Neither Max nor Min Tx Power"; + case 1: + return "Tx Power Level is at minimum"; + case 2: + return "Tx Power Level is at maximum"; + /* Current Tx Power Level is the only available one*/ + case 3: + return "Tx Power Level is at minimum & maximum."; + default: + return "Unknown"; + } +} + +static const char *tx_power_report_reason2str(uint8_t reason) +{ + switch (reason) { + case BT_HCI_LE_TX_POWER_REPORT_REASON_LOCAL_CHANGED: + return "Local Tx Power changed"; + case BT_HCI_LE_TX_POWER_REPORT_REASON_REMOTE_CHANGED: + return "Remote Tx Power changed"; + case BT_HCI_LE_TX_POWER_REPORT_REASON_READ_REMOTE_COMPLETED: + return "Completed to read remote Tx Power"; + default: + return "Unknown"; + } +} + +static const char *tx_pwr_ctrl_phy2str(enum bt_conn_le_tx_power_phy phy) +{ + switch (phy) { + case BT_CONN_LE_TX_POWER_PHY_NONE: + return "None"; + case BT_CONN_LE_TX_POWER_PHY_1M: + return "LE 1M"; + case BT_CONN_LE_TX_POWER_PHY_2M: + return "LE 2M"; + case BT_CONN_LE_TX_POWER_PHY_CODED_S8: + return "LE Coded S8"; + case BT_CONN_LE_TX_POWER_PHY_CODED_S2: + return "LE Coded S2"; + default: + return "Unknown"; + } +} + +static const char *enabled2str(bool enabled) +{ + if (enabled) { + return "Enabled"; + } else { + return "Disabled"; + } +} + +#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ + #if defined(CONFIG_BT_CENTRAL) static int cmd_scan_off(const struct shell *sh); static int cmd_connect_le(const struct shell *sh, size_t argc, char *argv[]); @@ -809,6 +870,19 @@ void le_phy_updated(struct bt_conn *conn, } #endif +#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) +void tx_power_report(struct bt_conn *conn, + const struct bt_conn_le_tx_power_report *report) +{ + shell_print(ctx_shell, "Tx Power Report: Reason: %s, PHY: %s, Tx Power Level: %d", + tx_power_report_reason2str(report->reason), tx_pwr_ctrl_phy2str(report->phy), + report->tx_power_level); + shell_print(ctx_shell, "Tx Power Level Flag Info: %s, Delta: %d", + tx_power_flag2str(report->tx_power_level_flag), report->delta); +} +#endif + + static struct bt_conn_cb conn_callbacks = { .connected = connected, .disconnected = disconnected, @@ -829,6 +903,9 @@ static struct bt_conn_cb conn_callbacks = { #if defined(CONFIG_BT_USER_PHY_UPDATE) .le_phy_updated = le_phy_updated, #endif +#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) + .tx_power_report = tx_power_report, +#endif }; #endif /* CONFIG_BT_CONN */ @@ -2608,6 +2685,102 @@ static int cmd_per_adv_set_info_transfer(const struct shell *sh, size_t argc, } #endif /* CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER && CONFIG_BT_PER_ADV */ +#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) +static int cmd_read_remote_tx_power(const struct shell *sh, size_t argc, char *argv[]) +{ + if (argc < 3) { + int err = 0; + enum bt_conn_le_tx_power_phy phy = strtoul(argv[1], NULL, 16); + + err = bt_conn_le_get_remote_tx_power_level(default_conn, phy); + + if (!err) { + shell_print(sh, "Read Remote TX Power for PHY %s", + tx_pwr_ctrl_phy2str(phy)); + } else { + shell_print(sh, "error %d", err); + } + } else { + shell_help(sh); + return SHELL_CMD_HELP_PRINTED; + } + return 0; +} + +static int cmd_read_local_tx_power(const struct shell *sh, size_t argc, char *argv[]) +{ + int err = 0; + + if (argc < 3) { + struct bt_conn_le_tx_power tx_power_level; + + tx_power_level.phy = strtoul(argv[1], NULL, 16); + + int8_t unachievable_current_level = -100; + /* Arbitrary, these are output parameters.*/ + tx_power_level.current_level = unachievable_current_level; + tx_power_level.max_level = 6; + + if (default_conn == NULL) { + shell_error(sh, "Conn handle error, at least one connection is required."); + return -ENOEXEC; + } + err = bt_conn_le_get_tx_power_level(default_conn, &tx_power_level); + if (err) { + shell_print(sh, "Commad returned error error %d", err); + return err; + } + if (tx_power_level.current_level == unachievable_current_level) { + shell_print(sh, "We received no current tx power level."); + return -EIO; + } + shell_print(sh, "Read local TX Power: current level: %d, PHY: %s, Max Level: %d", + tx_power_level.current_level, + tx_pwr_ctrl_phy2str((enum bt_conn_le_tx_power_phy)tx_power_level.phy), + tx_power_level.max_level); + } else { + shell_help(sh); + return SHELL_CMD_HELP_PRINTED; + } + + return err; +} + +static int cmd_set_power_report_enable(const struct shell *sh, size_t argc, char *argv[]) +{ + if (argc < 4) { + int err = 0; + bool local_enable = 0; + bool remote_enable = 0; + + if (*argv[1] == '1') { + local_enable = 1; + } + if (*argv[2] == '1') { + remote_enable = 1; + } + if (default_conn == NULL) { + shell_error(sh, "Conn handle error, at least one connection is required."); + return -ENOEXEC; + } + err = bt_conn_le_set_tx_power_report_enable(default_conn, local_enable, + remote_enable); + if (!err) { + shell_print(sh, "Tx Power Report: local: %s, remote: %s", + enabled2str(local_enable), enabled2str(remote_enable)); + } else { + shell_print(sh, "error %d", err); + } + } else { + shell_help(sh); + return SHELL_CMD_HELP_PRINTED; + } + return 0; +} + +#endif + + #if defined(CONFIG_BT_CONN) #if defined(CONFIG_BT_CENTRAL) static int cmd_connect_le(const struct shell *sh, size_t argc, char *argv[]) @@ -4015,6 +4188,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, cmd_default_handler), SHELL_CMD_ARG(scan-verbose-output, NULL, "", cmd_scan_verbose_output, 2, 0), #endif /* CONFIG_BT_OBSERVER */ +#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) + SHELL_CMD_ARG(read-remote-tx-power, NULL, HELP_NONE, cmd_read_remote_tx_power, 2, 0), + SHELL_CMD_ARG(read-local-tx-power, NULL, HELP_NONE, cmd_read_local_tx_power, 2, 0), + SHELL_CMD_ARG(set-power-report-enable, NULL, HELP_NONE, cmd_set_power_report_enable, 3, 0), +#endif #if defined(CONFIG_BT_BROADCASTER) SHELL_CMD_ARG(advertise, NULL, " [mode: discov, non_discov] " From cff33499e662011aefac5a77cf5ec93486fb6c1e Mon Sep 17 00:00:00 2001 From: Kyra Lengfeld Date: Mon, 27 Nov 2023 12:32:01 +0100 Subject: [PATCH 0005/2300] [nrf fromtree] Bluetooth: Host: Align return lines of bt shell helper function phy2str As other helper functions were introduced for the LE Power Control Request Feature (see CONFIG_BT_TRANSMIT_POWER_CONTROL), it was noticed that the return statements of switch cases should be on the next line generally. This will align phy2str with the rest in bt.c. Signed-off-by: Kyra Lengfeld (cherry picked from commit 77ab683dc6253e2b3bf5107ca7bb43d569150332) Signed-off-by: Kyra Lengfeld (cherry picked from commit 74b0d020e749332b39d9a1140d49a2afa538c2ec) --- subsys/bluetooth/shell/bt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index f9bdd8f8094..4e0111fa757 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -99,10 +99,14 @@ 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"; + 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"; } } #endif From 721a8da0e44e7d44b0e10eb1bfd7ce0e008e45dd Mon Sep 17 00:00:00 2001 From: Kyra Lengfeld Date: Tue, 28 Nov 2023 17:29:44 +0100 Subject: [PATCH 0006/2300] [nrf fromtree] Bluetooth: Host: build shell power_control_request (Not to mistake it for the dynamic power control nor the zephyr LL vendor-specific commands controlling local tx power) this yaml addition will build the shell code for the LE Power Control Feature API's, acting as verification. Signed-off-by: Kyra Lengfeld (cherry picked from commit 07d04b0f40b1569eafbfe8cf15184686f2faccc2) Signed-off-by: Kyra Lengfeld (cherry picked from commit f8dc8ac55203667f5137e4d4e245de4277db4980) --- 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 4b46c8d6781..ef4eed67eb3 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -13,6 +13,13 @@ tests: tags: bluetooth harness: keyboard min_flash: 145 + bluetooth.shell.power_control_request: + extra_configs: + - CONFIG_BT_TRANSMIT_POWER_CONTROL=y + - CONFIG_BT_CTLR=n + platform_allow: + - native_posix + build_only: true bluetooth.shell.cdc_acm: extra_args: - OVERLAY_CONFIG=cdc_acm.conf From bfe1858e369a3247254f4c08205a4e2f729a9901 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 29 Nov 2023 21:18:46 +0530 Subject: [PATCH 0007/2300] [nrf fromlist] wifi: Check WPA-PSK passphrase length When WPA-PSK was introduced the passphrase length check was missed. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/65933 Signed-off-by: Chaitanya Tata (cherry picked from commit 8721401fed0cd5df940610005b411821c6c16648) --- subsys/net/l2/wifi/wifi_mgmt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 6eb8a6682c2..1a866d4c47c 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -274,6 +274,7 @@ static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, (params->ssid_length > WIFI_SSID_MAX_LEN) || (params->ssid_length == 0U) || ((params->security == WIFI_SECURITY_TYPE_PSK || + params->security == WIFI_SECURITY_TYPE_WPA_PSK || params->security == WIFI_SECURITY_TYPE_PSK_SHA256) && ((params->psk_length < 8) || (params->psk_length > 64) || (params->psk_length == 0U) || !params->psk)) || From 6be1b72ed9c0d1d3f27120f760e8f32b49cbd2df Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Fri, 1 Dec 2023 13:36:39 +0530 Subject: [PATCH 0008/2300] [nrf fromtree] net: l2: wifi: Fix Print of SSID in WIFI status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While printing SSID in wifi status command, If the length is maximum(32 character). It leads to buffer overflow. It required one character for null terminator ‘\0’. Changing the Format Specifiers to print proper SSID. Signed-off-by: Kapil Bhatt (cherry picked from commit cb7b650b923f160540943f0724b79b79fd8e51f4) (cherry picked from commit 2364b332d085341d78e9618125256ae3a5cc71b0) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index ed85b015971..5f7eb5ba0ee 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -647,7 +647,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) wifi_mode_txt(status.iface_mode)); shell_fprintf(sh, SHELL_NORMAL, "Link Mode: %s\n", wifi_link_mode_txt(status.link_mode)); - shell_fprintf(sh, SHELL_NORMAL, "SSID: %-32s\n", status.ssid); + shell_fprintf(sh, SHELL_NORMAL, "SSID: %.32s\n", status.ssid); shell_fprintf(sh, SHELL_NORMAL, "BSSID: %s\n", net_sprint_ll_addr_buf(status.bssid, WIFI_MAC_ADDR_LEN, mac_string_buf, From 378bdeb3c8bc4c55c21b5693336a6887e8a1bb90 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 7 Dec 2023 20:50:55 +0530 Subject: [PATCH 0009/2300] [nrf fromlist] wifi: Add an enum for connect result status This can be used to interpret the "status" in the connect result event. To start with a few common reasons are enumerated but can be extended in the future. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66285 Signed-off-by: Chaitanya Tata (cherry picked from commit 3e94ff1efea007b75e8d9bf6b8e86076cb31525a) --- include/zephyr/net/wifi_mgmt.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index faf83b42b84..91c9ad088a8 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -321,6 +321,22 @@ struct wifi_connect_req_params { int timeout; }; +/** Wi-Fi connect result codes. To be overlaid on top of \ref wifi_status + * in the connect result event for detailed status. + */ +enum wifi_conn_status { + /** Connection successful */ + WIFI_STATUS_CONN_SUCCESS = 0, + /** Connection failed - generic failure */ + WIFI_STATUS_CONN_FAIL, + /** Connection failed - wrong password */ + WIFI_STATUS_CONN_WRONG_PASSWORD, + /** Connection timed out */ + WIFI_STATUS_CONN_TIMEOUT, + /** Connection failed - AP not found */ + WIFI_STATUS_CONN_AP_NOT_FOUND, +}; + /** Generic Wi-Fi status for commands and events */ struct wifi_status { int status; From bf644c7b687acea27aa9bfd74ee8f64b3a5deeea Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 7 Dec 2023 20:57:14 +0530 Subject: [PATCH 0010/2300] [nrf fromlist] wifi: Add an enum for disconnect reasons This can be used to interpret the "status" in the disconnect result event. To start with a few common reasons are enumerated but can be extended in the future. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66285 Signed-off-by: Chaitanya Tata (cherry picked from commit 4c6c7fa95617e53d2b9d5347d0a066a2fbe559a0) --- include/zephyr/net/wifi_mgmt.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 91c9ad088a8..e52cefd2d68 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -337,6 +337,20 @@ enum wifi_conn_status { WIFI_STATUS_CONN_AP_NOT_FOUND, }; +/** Wi-Fi disconnect reason codes. To be overlaid on top of \ref wifi_status + * in the disconnect result event for detailed reason. + */ +enum wifi_disconn_reason { + /** Unspecified reason */ + WIFI_REASON_DISCONN_UNSPECIFIED = 0, + /** Disconnected due to user request */ + WIFI_REASON_DISCONN_USER_REQUEST, + /** Disconnected due to AP leaving */ + WIFI_REASON_DISCONN_AP_LEAVING, + /** Disconnected due to inactivity */ + WIFI_REASON_DISCONN_INACTIVITY, +}; + /** Generic Wi-Fi status for commands and events */ struct wifi_status { int status; From 0a6ec5c96dbe9fa668db07d8bf1c6a2258a1b7fb Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 8 Dec 2023 12:15:05 +0530 Subject: [PATCH 0011/2300] [nrf fromlist] wifi: Add the enums to the status This helps to demonstrate that the enumerations have to be used to interpret the status. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66285 Signed-off-by: Chaitanya Tata (cherry picked from commit 1a6d964dd2e6aa19ae755b5e2404e63b015e060c) (cherry picked from commit b3979ec709df026fc655286f1a58be30b0f688e0) --- include/zephyr/net/wifi_mgmt.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index e52cefd2d68..babf67722c1 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -353,7 +353,11 @@ enum wifi_disconn_reason { /** Generic Wi-Fi status for commands and events */ struct wifi_status { - int status; + union { + int status; + enum wifi_conn_status conn_status; + enum wifi_disconn_reason disconn_reason; + }; }; /** Wi-Fi interface status */ From cd6ab6cdc5fc662bfd25f24cc2c5f969d2236f9c Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Mon, 4 Dec 2023 13:23:41 +0100 Subject: [PATCH 0012/2300] [nrf fromtree] modules: hal_nordic: nRF 802.15.4 customizable asserts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent nRF 802.15.4 Radio Driver provides assert abstraction layer. The assert abstraction layer is implemented in Zephyr in following ways depending on the `NRF_802154_ASSERT_CHOICE` Kconfig choice. `NRF_802154_ASSERT_ZEPHYR_MINIMAL` (default) gives ability to still perform run-time checking of the nRF 802.15.4 Radio Driver operation with minimum memory overhead and configurable behavior on fault detection regardless of the `CONFIG_ASSERT` Kconfig option value. `NRF_802154_ASSERT_ZEPHYR` gives ability to use asserts provided and configurable by Zephyr including the ability to turn off the run-time checking of the nRF 802.15.4 Radio Driver operation. Signed-off-by: Andrzej Kuroś (cherry picked from commit f5337fc7a3c809e9cde6662dffd517e81a4e296b) (cherry picked from commit e4511cfcb7a672ca1bb0d6296dc257df6af0b12f) --- modules/hal_nordic/Kconfig | 28 +++++++++++++++++- modules/hal_nordic/nrf_802154/CMakeLists.txt | 5 ++++ .../include/nrf_802154_assert_zephyr.h | 29 +++++++++++++++++++ .../nrf_802154/nrf_802154_assert_handler.c | 26 +++++++++++++++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 modules/hal_nordic/nrf_802154/include/nrf_802154_assert_zephyr.h create mode 100644 modules/hal_nordic/nrf_802154/nrf_802154_assert_handler.c diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index f842d2cb646..44c12e88685 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -205,13 +205,39 @@ endif endmenu # NRF_802154_SER_HOST || NRF_802154_SER_RADIO +if NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION + config NRF_802154_CARRIER_FUNCTIONS bool "nRF 802.15.4 carrier functions" - depends on NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION help This option enables functions such as modulated carrier and continuous carrier. If this option is modified on a multicore SoC, its remote counterpart must be set to the exact same value. +choice NRF_802154_ASSERT_CHOICE + prompt "nRF 802.15.4 assert implementation" + default NRF_802154_ASSERT_ZEPHYR_MINIMAL + +config NRF_802154_ASSERT_ZEPHYR_MINIMAL + bool "nRF 802.15.4 minimal assertions" + help + This option provides minimal run-time checking of the nRF 802.15.4 Radio Driver's operation, + even if kernel-wide CONFIG_ASSERT is disabled. In case of an abnormal condition the function + `nrf_802154_assert_handler()` is called. File and line debug information are not provided + to save memory of the image file. Default implementation of the `nrf_802154_assert_handler` + involves a call to `k_panic`/`k_oops` and allows further tweaking of the behavior. + You can also provide your own implementation of `nrf_802154_assert_handler`. + +config NRF_802154_ASSERT_ZEPHYR + bool "nRF 802.15.4 Radio Driver assertions as Zephyr's standard __ASERT_NO_MSG" + help + The run-time checking of the nRF 802.15.4 Radio Driver depends fully on the configuration + of the `__ASSERT_NO_MSG` macro, including the ability to completely turn off the run-time + checking. + +endchoice # NRF_802154_ASSERT_CHOICE + +endif # NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION + endmenu # HAS_NORDIC_DRIVERS rsource "nrfx/Kconfig" diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index c338981b651..cd5ace0b278 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -95,6 +95,11 @@ endif() if (CONFIG_NRF_802154_RADIO_DRIVER OR CONFIG_NRF_802154_SERIALIZATION) target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENERGY_DETECTED_VERSION=1) + if (CONFIG_NRF_802154_ASSERT_ZEPHYR OR CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) + target_include_directories(zephyr-802154-interface INTERFACE include) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_PLATFORM_ASSERT_INCLUDE=\"nrf_802154_assert_zephyr.h\") + target_sources(nrf-802154-platform PRIVATE nrf_802154_assert_handler.c) + endif() endif() set(NRF52_SERIES ${CONFIG_SOC_SERIES_NRF52X}) diff --git a/modules/hal_nordic/nrf_802154/include/nrf_802154_assert_zephyr.h b/modules/hal_nordic/nrf_802154/include/nrf_802154_assert_zephyr.h new file mode 100644 index 00000000000..ecd09de609a --- /dev/null +++ b/modules/hal_nordic/nrf_802154/include/nrf_802154_assert_zephyr.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRF_802154_ASSERT_ZEPHYR_H__ +#define NRF_802154_ASSERT_ZEPHYR_H__ + +#if defined(CONFIG_NRF_802154_ASSERT_ZEPHYR) + +#include + +#define NRF_802154_ASSERT(condition) __ASSERT_NO_MSG(condition) + +#elif defined(CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) + +extern void nrf_802154_assert_handler(void); + +#define NRF_802154_ASSERT(condition) \ + do { \ + if (!(condition)) { \ + nrf_802154_assert_handler(); \ + } \ + } while (0) + +#endif /* CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL */ + +#endif /* NRF_802154_ASSERT_ZEPHYR_H__*/ diff --git a/modules/hal_nordic/nrf_802154/nrf_802154_assert_handler.c b/modules/hal_nordic/nrf_802154/nrf_802154_assert_handler.c new file mode 100644 index 00000000000..14d964724c6 --- /dev/null +++ b/modules/hal_nordic/nrf_802154/nrf_802154_assert_handler.c @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include "nrf_802154_assert_zephyr.h" + +#if defined(CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) + +__weak void nrf_802154_assert_handler(void) +{ +#ifdef CONFIG_USERSPACE + /* User threads aren't allowed to induce kernel panics; generate + * an oops instead. + */ + if (k_is_user_context()) { + k_oops(); + } +#endif + + k_panic(); +} + +#endif /* CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL */ From 77065228342dea9bf36be58454a2617db32aebac Mon Sep 17 00:00:00 2001 From: Przemyslaw Bida Date: Tue, 5 Dec 2023 16:13:06 +0100 Subject: [PATCH 0013/2300] [nrf fromtree] net: openthread: Add openthread TCAT implementation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds bbtc implementation. New file in modules/openthread/platform/ble.c New corresponding kconfig option `OPENTHREAD_BLE_TCAT`. Co-authored-by: Piotr Jasiński Signed-off-by: Przemyslaw Bida Signed-off-by: Piotr Jasiński (cherry picked from commit 304b98391cc2c41f24b591f72da29c13a1786766) (cherry picked from commit 145754e56829d73776aa285ea9de275d5e0d026d) --- modules/openthread/CMakeLists.txt | 6 + modules/openthread/Kconfig.features | 4 + modules/openthread/Kconfig.thread | 12 + modules/openthread/platform/CMakeLists.txt | 1 + modules/openthread/platform/ble.c | 458 +++++++++++++++++++++ 5 files changed, 481 insertions(+) create mode 100644 modules/openthread/platform/ble.c diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 2b2b593f82f..8afa1aec440 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -58,6 +58,12 @@ else() set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OFF CACHE BOOL "Enable BBR MR support" FORCE) endif() +if(CONFIG_OPENTHREAD_BLE_TCAT) + set(OT_BLE_TCAT ON CACHE BOOL "Enable BLE TCAT support" FORCE) +else() + set(OT_BLE_TCAT OFF CACHE BOOL "Enable BLE TCAT support" FORCE) +endif() + if(CONFIG_OPENTHREAD_BORDER_AGENT) set(OT_BORDER_AGENT ON CACHE BOOL "Enable Border Agent" FORCE) else() diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index a75c9e8fd48..bd8a05ed9b9 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -39,6 +39,10 @@ config OPENTHREAD_BACKBONE_ROUTER_DUA_NDPROXYING config OPENTHREAD_BACKBONE_ROUTER_MULTICAST_ROUTING bool "BBR MR support" +config OPENTHREAD_BLE_TCAT + bool "BLE TCAT support" + select EXPERIMENTAL + config OPENTHREAD_BORDER_AGENT bool "Border Agent support" diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index 891365b4672..66e039b7300 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -181,3 +181,15 @@ config OPENTHREAD_DEFAULT_TX_POWER default 0 help Set the default TX output power [dBm] in radio driver for OpenThread purpose. + +config OPENTHREAD_BLE_TCAT_THREAD_STACK_SIZE + int "Openthread default TCAT stack size" + default 4200 + help + 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. diff --git a/modules/openthread/platform/CMakeLists.txt b/modules/openthread/platform/CMakeLists.txt index d363bcda7df..542aa5186ea 100644 --- a/modules/openthread/platform/CMakeLists.txt +++ b/modules/openthread/platform/CMakeLists.txt @@ -10,6 +10,7 @@ zephyr_library_sources( spi.c ) +zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_BLE_TCAT ble.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_DIAG diag.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_COPROCESSOR uart.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_CRYPTO_PSA crypto_psa.c) diff --git a/modules/openthread/platform/ble.c b/modules/openthread/platform/ble.c new file mode 100644 index 00000000000..7b41556b617 --- /dev/null +++ b/modules/openthread/platform/ble.c @@ -0,0 +1,458 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* Zephyr OpenThread integration Library */ +#include + +/* OpenThread BLE driver API */ +#include + +/* Zephyr Logging */ + +#define LOG_MODULE_NAME net_openthread_tcat +#define LOG_LEVEL CONFIG_OPENTHREAD_LOG_LEVEL + +LOG_MODULE_REGISTER(LOG_MODULE_NAME); + +#define DEVICE_NAME CONFIG_BT_DEVICE_NAME +#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) + +/* BLE connection constants as defined in thread specification. */ +#define TOBLE_SERVICE_UUID 0xfffb +#define RX_CHARACTERISTIC_UUID \ + BT_UUID_128_ENCODE(0x6bd10d8b, 0x85a7, 0x4e5a, 0xba2d, 0xc83558a5f220) +#define TX_CHARACTERISTIC_UUID \ + BT_UUID_128_ENCODE(0x7fddf61f, 0x280a, 0x4773, 0xb448, 0xba1b8fe0dd69) + +#define BT_UUID_TCAT_SERVICE BT_UUID_DECLARE_16(TOBLE_SERVICE_UUID) +#define BT_UUID_TCAT_SERVICE_RX BT_UUID_DECLARE_128(RX_CHARACTERISTIC_UUID) +#define BT_UUID_TCAT_SERVICE_TX BT_UUID_DECLARE_128(TX_CHARACTERISTIC_UUID) + +#define PLAT_BLE_THREAD_DEALY 500 +#define PLAT_BLE_MSG_DATA_MAX CONFIG_BT_L2CAP_TX_MTU /* must match the maximum MTU size used */ + +#define PLAT_BLE_MSG_CONNECT (PLAT_BLE_MSG_DATA_MAX + 1U) +#define PLAT_BLE_MSG_DISCONNECT (PLAT_BLE_MSG_CONNECT + 1U) + +/* Zephyr Kernel Objects */ + +static void ot_plat_ble_thread(void *, void *, void *); +static uint8_t ot_plat_ble_msg_buf[PLAT_BLE_MSG_DATA_MAX]; + +static K_SEM_DEFINE(ot_plat_ble_init_semaphore, 0, 1); +static K_SEM_DEFINE(ot_plat_ble_event_semaphore, 0, K_SEM_MAX_LIMIT); +RING_BUF_DECLARE(ot_plat_ble_ring_buf, CONFIG_OPENTHREAD_BLE_TCAT_RING_BUF_SIZE); +static K_THREAD_DEFINE(ot_plat_ble_tid, CONFIG_OPENTHREAD_BLE_TCAT_THREAD_STACK_SIZE, + ot_plat_ble_thread, NULL, NULL, NULL, 5, 0, PLAT_BLE_THREAD_DEALY); + +/* OpenThread Objects */ + +static otInstance *ble_openthread_instance; + +/* BLE service Objects */ + +/* forward declaration for callback functions */ +static ssize_t on_receive(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, + uint16_t len, uint16_t offset, uint8_t flags); +static void on_cccd_changed(const struct bt_gatt_attr *attr, uint16_t value); + +/* Service Declaration and Registration */ +BT_GATT_SERVICE_DEFINE(my_service, BT_GATT_PRIMARY_SERVICE(BT_UUID_TCAT_SERVICE), + BT_GATT_CHARACTERISTIC(BT_UUID_TCAT_SERVICE_RX, + BT_GATT_CHRC_WRITE | BT_GATT_CHRC_WRITE_WITHOUT_RESP, + BT_GATT_PERM_READ | BT_GATT_PERM_WRITE, NULL, + on_receive, NULL), + BT_GATT_CHARACTERISTIC(BT_UUID_TCAT_SERVICE_TX, BT_GATT_CHRC_NOTIFY, + BT_GATT_PERM_READ, NULL, NULL, NULL), + BT_GATT_CCC(on_cccd_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),); + +/* Zephyr BLE Objects */ + +/* forward declaration for callback functions */ +static void connected(struct bt_conn *conn, uint8_t err); +static void disconnected(struct bt_conn *conn, uint8_t reason); +static bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param); +static void le_param_updated(struct bt_conn *conn, uint16_t interval, uint16_t latency, + uint16_t timeout); + +static struct bt_conn *ot_plat_ble_connection; + +static struct bt_conn_cb conn_callbacks = {.connected = connected, + .disconnected = disconnected, + .le_param_req = le_param_req, + .le_param_updated = le_param_updated}; + +static const struct bt_data ad[] = { + BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), + BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN), +}; + +static const struct bt_data sd[] = { + BT_DATA_BYTES(BT_DATA_UUID16_ALL, BT_UUID_16_ENCODE(TOBLE_SERVICE_UUID)), +}; + +/* Zephyr BLE Message Queue and Thread */ + +static bool ot_plat_ble_queue_msg(const uint8_t *aData, uint16_t aLen, int8_t aRssi) +{ + otError error = OT_ERROR_NONE; + uint16_t len = 0; + + if (aLen <= PLAT_BLE_MSG_DATA_MAX && aData == NULL) { + return OT_ERROR_INVALID_ARGS; + } + + k_sched_lock(); + + len = sizeof(aLen) + sizeof(aRssi) + ((aLen <= PLAT_BLE_MSG_DATA_MAX) ? aLen : 0); + + if (ring_buf_space_get(&ot_plat_ble_ring_buf) >= len) { + ring_buf_put(&ot_plat_ble_ring_buf, (uint8_t *)&aLen, sizeof(aLen)); + ring_buf_put(&ot_plat_ble_ring_buf, &aRssi, sizeof(aRssi)); + if (aLen <= PLAT_BLE_MSG_DATA_MAX) { + ring_buf_put(&ot_plat_ble_ring_buf, aData, aLen); + } + k_sem_give(&ot_plat_ble_event_semaphore); + } else { + error = OT_ERROR_NO_BUFS; + } + + k_sched_unlock(); + + return error; +} + +static void ot_plat_ble_thread(void *unused1, void *unused2, void *unused3) +{ + ARG_UNUSED(unused1); + ARG_UNUSED(unused2); + ARG_UNUSED(unused3); + + uint16_t len; + int8_t rssi; + otBleRadioPacket my_packet; + + LOG_INF("%s started", __func__); + + while (1) { + k_sem_take(&ot_plat_ble_event_semaphore, K_FOREVER); + ring_buf_get(&ot_plat_ble_ring_buf, (uint8_t *)&len, sizeof(len)); + ring_buf_get(&ot_plat_ble_ring_buf, &rssi, sizeof(rssi)); + if (len <= PLAT_BLE_MSG_DATA_MAX) { + ring_buf_get(&ot_plat_ble_ring_buf, ot_plat_ble_msg_buf, len); + } + + openthread_api_mutex_lock(openthread_get_default_context()); + + if (len <= PLAT_BLE_MSG_DATA_MAX) { + /* The packet parameter in otPlatBleGattServerOnWriteRequest is not const. + * Re-write all members. + */ + my_packet.mValue = ot_plat_ble_msg_buf; + my_packet.mPower = rssi; + my_packet.mLength = len; + otPlatBleGattServerOnWriteRequest(ble_openthread_instance, 0, &my_packet); + } else if (len == PLAT_BLE_MSG_CONNECT) { + otPlatBleGapOnConnected(ble_openthread_instance, 0); + } else if (len == PLAT_BLE_MSG_DISCONNECT) { + otPlatBleGapOnDisconnected(ble_openthread_instance, 0); + } + openthread_api_mutex_unlock(openthread_get_default_context()); + } +} + +/* Zephyr BLE service callbacks */ + +/* This function is called whenever the RX Characteristic has been written to by a Client */ +static ssize_t on_receive(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, + uint16_t len, uint16_t offset, uint8_t flags) +{ + LOG_DBG("Received data, handle %" PRIu16 ", len %" PRIu16, attr->handle, len); + + otError error = ot_plat_ble_queue_msg(buf, len, 0); + + if (error != OT_ERROR_NONE) { + LOG_WRN("Error queuing message: %s", otThreadErrorToString(error)); + } + + return len; +} + +/* This function is called whenever a Notification has been sent by the TX Characteristic */ +static void on_sent(struct bt_conn *conn, void *user_data) +{ + ARG_UNUSED(conn); + ARG_UNUSED(user_data); + + LOG_DBG("Data sent"); +} + +/* This function is called whenever the CCCD register has been changed by the client */ +void on_cccd_changed(const struct bt_gatt_attr *attr, uint16_t value) +{ + uint16_t mtu; + otError error = OT_ERROR_NONE; + + ARG_UNUSED(attr); + + switch (value) { + case BT_GATT_CCC_NOTIFY: + + error = ot_plat_ble_queue_msg(NULL, PLAT_BLE_MSG_CONNECT, 0); + if (error != OT_ERROR_NONE) { + LOG_WRN("Error queuing message: %s", otThreadErrorToString(error)); + } + + error = otPlatBleGattMtuGet(ble_openthread_instance, &mtu); + if (error != OT_ERROR_NONE) { + LOG_WRN("Error retrieving mtu: %s", otThreadErrorToString(error)); + } + + LOG_INF("CCCD update (mtu=%" PRIu16 ")!", mtu); + + break; + + default: + break; + } +} + +otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, + const otBleRadioPacket *aPacket) +{ + ARG_UNUSED(aInstance); + + /* TO DO change to indications. */ + const struct bt_gatt_attr *attr = &my_service.attrs[3]; + + struct bt_gatt_notify_params params = {.uuid = BT_UUID_TCAT_SERVICE_TX, + .attr = attr, + .data = aPacket->mValue, + .len = aPacket->mLength, + .func = on_sent}; + + LOG_DBG("Send data, handle %d, len %d", attr->handle, aPacket->mLength); + + /* Only one connection supported */ + if (aHandle != 0) { + return OT_ERROR_INVALID_ARGS; + } + + if (ot_plat_ble_connection == NULL) { + return OT_ERROR_INVALID_STATE; + } + + /* Check whether notifications are enabled or not */ + if (bt_gatt_is_subscribed(ot_plat_ble_connection, attr, BT_GATT_CCC_NOTIFY)) { + if (bt_gatt_notify_cb(ot_plat_ble_connection, ¶ms)) { + LOG_WRN("Error, unable to send notification"); + return OT_ERROR_INVALID_ARGS; + } + } else { + LOG_WRN("Warning, notification not enabled on the selected attribute"); + return OT_ERROR_INVALID_STATE; + } + + return OT_ERROR_NONE; +} + +otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu) +{ + ARG_UNUSED(aInstance); + + if (ot_plat_ble_connection == NULL) { + return OT_ERROR_FAILED; + } + + if (aMtu != NULL) { + *aMtu = bt_gatt_get_mtu(ot_plat_ble_connection); + } + + return OT_ERROR_NONE; +} + +otError otPlatBleGapDisconnect(otInstance *aInstance) +{ + ARG_UNUSED(aInstance); + + if (ot_plat_ble_connection == NULL) { + return OT_ERROR_INVALID_STATE; + } + + if (bt_conn_disconnect(ot_plat_ble_connection, BT_HCI_ERR_REMOTE_USER_TERM_CONN)) { + return OT_ERROR_INVALID_STATE; + } + + return OT_ERROR_NONE; +} + +/* Zephyr BLE callbacks */ + +static void connected(struct bt_conn *conn, uint8_t err) +{ + struct bt_conn_info info; + char addr[BT_ADDR_LE_STR_LEN]; + uint16_t mtu; + otError error = OT_ERROR_NONE; + + ot_plat_ble_connection = bt_conn_ref(conn); + + if (err) { + LOG_WRN("Connection failed (err %u)", err); + return; + } else if (bt_conn_get_info(conn, &info)) { + LOG_WRN("Could not parse connection info"); + } else { + bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + + error = otPlatBleGattMtuGet(ble_openthread_instance, &mtu); + if (error != OT_ERROR_NONE) { + LOG_WRN("Error retrieving mtu: %s", otThreadErrorToString(error)); + } + + LOG_INF("Connection established (mtu=%" PRIu16 ")!", mtu); + } +} + +static void disconnected(struct bt_conn *conn, uint8_t reason) +{ + otError error = OT_ERROR_NONE; + + LOG_INF("Disconnected (reason %" PRIu8 ")", reason); + + if (ot_plat_ble_connection) { + bt_conn_unref(ot_plat_ble_connection); + ot_plat_ble_connection = NULL; + + error = ot_plat_ble_queue_msg(NULL, PLAT_BLE_MSG_DISCONNECT, 0); + if (error != OT_ERROR_NONE) { + LOG_WRN("Error queuing message: %s", otThreadErrorToString(error)); + } + } +} + +static bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param) +{ + return true; +} + +static void le_param_updated(struct bt_conn *conn, uint16_t interval, uint16_t latency, + uint16_t timeout) +{ + struct bt_conn_info info; + char addr[BT_ADDR_LE_STR_LEN]; + uint16_t mtu; + otError error = OT_ERROR_NONE; + + if (bt_conn_get_info(conn, &info)) { + LOG_INF("Could not parse connection info"); + } else { + bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + + error = otPlatBleGattMtuGet(ble_openthread_instance, &mtu); + + if (error != OT_ERROR_NONE) { + LOG_WRN("Error retrieving mtu: %s", otThreadErrorToString(error)); + } + + LOG_INF("Connection parameters updated (mtu=%" PRIu16 ")!", mtu); + } +} + +static void bt_ready(int err) +{ + if (err) { + LOG_WRN("BLE init failed with error code %d", err); + return; + } + + bt_conn_cb_register(&conn_callbacks); + k_sem_give(&ot_plat_ble_init_semaphore); /* BLE stack up an running */ +} + +otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval) +{ + ARG_UNUSED(aInstance); + ARG_UNUSED(aInterval); + + /* TO DO advertisement format change */ + int err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + + if (err != 0 && err != -EALREADY) { + LOG_WRN("Advertising failed to start (err %d)", err); + return OT_ERROR_INVALID_STATE; + } + + LOG_INF("Advertising successfully started"); + + return OT_ERROR_NONE; +} + +otError otPlatBleGapAdvStop(otInstance *aInstance) +{ + ARG_UNUSED(aInstance); + + int err = bt_le_adv_stop(); + + if (err != 0 && err != -EALREADY) { + LOG_WRN("Advertisement failed to stop (err %d)", err); + return OT_ERROR_FAILED; + } + return OT_ERROR_NONE; +} + +/* Zephyr BLE initialization */ + +otError otPlatBleEnable(otInstance *aInstance) +{ + int err; + + ble_openthread_instance = aInstance; + err = bt_enable(bt_ready); + + if (err != 0 && err != -EALREADY) { + LOG_WRN("BLE enable failed with error code %d", err); + return OT_ERROR_FAILED; + } else if (err == -EALREADY) { + err = k_sem_take(&ot_plat_ble_init_semaphore, K_MSEC(500)); + return OT_ERROR_NONE; + } + + err = k_sem_take(&ot_plat_ble_init_semaphore, K_MSEC(500)); + + if (!err) { + LOG_INF("Bluetooth initialized"); + } else { + LOG_INF("BLE initialization did not complete in time"); + return OT_ERROR_FAILED; + } + + return OT_ERROR_NONE; +} + +otError otPlatBleDisable(otInstance *aInstance) +{ + ARG_UNUSED(aInstance); + /* This function intentionally does nothing since disabling advertisement disables BLE + * stack. + */ + return OT_ERROR_NONE; +} From eead8ff00f130eb969bc4f6c21673d3fee3f3ca6 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 7 Dec 2023 19:13:35 +0100 Subject: [PATCH 0014/2300] [nrf fromlist] samples: soc_flash_nrf: Stop erasing outside of test partition Stop erasing outside of the test partition. We shouldn't really on this being accesible memory. This region may be consider as secure when application is non-secure. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66279 Signed-off-by: Joakim Andersson (cherry picked from commit 349b71d443761d191fa7f0af9df0ee77229b3597) --- samples/drivers/soc_flash_nrf/README.rst | 2 +- samples/drivers/soc_flash_nrf/src/main.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/drivers/soc_flash_nrf/README.rst b/samples/drivers/soc_flash_nrf/README.rst index 496688e8b65..de49eb6db28 100644 --- a/samples/drivers/soc_flash_nrf/README.rst +++ b/samples/drivers/soc_flash_nrf/README.rst @@ -62,7 +62,7 @@ Sample Output Data read: 1234 Data read matches data written. Good! - Test 3: Flash erase (4 pages at 0x80000) + Test 3: Flash erase (2 pages at 0x80000) Flash erase succeeded! Test 4: Flash write (word array 2) diff --git a/samples/drivers/soc_flash_nrf/src/main.c b/samples/drivers/soc_flash_nrf/src/main.c index a438a67cf2f..91a763c781d 100644 --- a/samples/drivers/soc_flash_nrf/src/main.c +++ b/samples/drivers/soc_flash_nrf/src/main.c @@ -84,9 +84,9 @@ int main(void) } } - offset = TEST_PARTITION_OFFSET - FLASH_PAGE_SIZE * 2; - printf("\nTest 3: Flash erase (4 pages at 0x%x)\n", offset); - if (flash_erase(flash_dev, offset, FLASH_PAGE_SIZE * 4) != 0) { + offset = TEST_PARTITION_OFFSET; + printf("\nTest 3: Flash erase (2 pages at 0x%x)\n", offset); + if (flash_erase(flash_dev, offset, FLASH_PAGE_SIZE * 2) != 0) { printf(" Flash erase failed!\n"); } else { printf(" Flash erase succeeded!\n"); From d04645929217d687974f82d5d85a775afdb99c1d Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 7 Dec 2023 19:16:57 +0100 Subject: [PATCH 0015/2300] [nrf fromlist] samples: soc_flash_nrf: Print finished message Print a finished message, so that it is clear that this in the end of the sample. This makes it certain that we didn't crash without output on the last test. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66279 Signed-off-by: Joakim Andersson (cherry picked from commit 4819e656ade0727dca44e2a8d5cde16c1ebd4dc1) --- samples/drivers/soc_flash_nrf/README.rst | 2 ++ samples/drivers/soc_flash_nrf/sample.yaml | 1 + samples/drivers/soc_flash_nrf/src/main.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/samples/drivers/soc_flash_nrf/README.rst b/samples/drivers/soc_flash_nrf/README.rst index de49eb6db28..2ee87739aad 100644 --- a/samples/drivers/soc_flash_nrf/README.rst +++ b/samples/drivers/soc_flash_nrf/README.rst @@ -131,3 +131,5 @@ Sample Output Test 8: Write block size API write-block-size = 1 + + Finished! diff --git a/samples/drivers/soc_flash_nrf/sample.yaml b/samples/drivers/soc_flash_nrf/sample.yaml index b8a59328be4..d1f635ca93f 100644 --- a/samples/drivers/soc_flash_nrf/sample.yaml +++ b/samples/drivers/soc_flash_nrf/sample.yaml @@ -29,3 +29,4 @@ tests: - "Data read matches data written. Good!" - "SoC flash consists of \\d+ pages." - "write-block-size = 1" + - "Finished!" diff --git a/samples/drivers/soc_flash_nrf/src/main.c b/samples/drivers/soc_flash_nrf/src/main.c index 91a763c781d..33ab9b28e1d 100644 --- a/samples/drivers/soc_flash_nrf/src/main.c +++ b/samples/drivers/soc_flash_nrf/src/main.c @@ -191,5 +191,7 @@ int main(void) printf("\nTest 8: Write block size API\n"); printf(" write-block-size = %u\n", flash_get_write_block_size(flash_dev)); + + printf("\nFinished!\n"); return 0; } From 75676023d89063e3da0b7cfae17b7a0f41741b40 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 7 Dec 2023 19:21:06 +0100 Subject: [PATCH 0016/2300] [nrf fromlist] samples: soc_flash_nrf: Make sure that the flash partition is valid Make sure that the flash partition is valid. With TF-M enabled the storage_partition can be used as memory that is known to be configured as non-secure flash region. The slot1_ns_partition partition is only correct when TF-M is built with BL2 enabled. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66279 Signed-off-by: Joakim Andersson (cherry picked from commit 4b2ae638e61279338ce40b65a6bbed0a1f73fae2) --- samples/drivers/soc_flash_nrf/prj.conf | 4 ++++ samples/drivers/soc_flash_nrf/src/main.c | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/drivers/soc_flash_nrf/prj.conf b/samples/drivers/soc_flash_nrf/prj.conf index 9909ef3b29f..48e64121b6a 100644 --- a/samples/drivers/soc_flash_nrf/prj.conf +++ b/samples/drivers/soc_flash_nrf/prj.conf @@ -3,3 +3,7 @@ CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_MPU_ALLOW_FLASH_WRITE=y CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y +CONFIG_FCB=y +CONFIG_FLASH_MAP=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_FCB=y diff --git a/samples/drivers/soc_flash_nrf/src/main.c b/samples/drivers/soc_flash_nrf/src/main.c index 33ab9b28e1d..29606a9ca5d 100644 --- a/samples/drivers/soc_flash_nrf/src/main.c +++ b/samples/drivers/soc_flash_nrf/src/main.c @@ -13,11 +13,7 @@ #include -#ifdef CONFIG_TRUSTED_EXECUTION_NONSECURE -#define TEST_PARTITION slot1_ns_partition -#else -#define TEST_PARTITION slot1_partition -#endif +#define TEST_PARTITION storage_partition #define TEST_PARTITION_OFFSET FIXED_PARTITION_OFFSET(TEST_PARTITION) #define TEST_PARTITION_DEVICE FIXED_PARTITION_DEVICE(TEST_PARTITION) From 6fa31b7fd36fbbf744739614e8e877d13937b2ad Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 7 Dec 2023 19:35:48 +0100 Subject: [PATCH 0017/2300] [nrf fromlist] tests: flash: Use a flash partition that is known to be nonsecure With TF-M enabled the storage_partition can be used as memory that is known to be configured as non-secure flash region. The slot1_ns_partition partition is only correct when TF-M is built with BL2 enabled. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66279 Signed-off-by: Joakim Andersson (cherry picked from commit 1c92e08276186aaa7bff4935c5b4ec03b5294b05) --- .../flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf | 4 ++++ tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf | 4 ++++ tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf | 4 ++++ tests/drivers/flash/common/src/main.c | 3 --- tests/drivers/flash/common/testcase.yaml | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tests/drivers/flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf create mode 100644 tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf create mode 100644 tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf diff --git a/tests/drivers/flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf b/tests/drivers/flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf new file mode 100644 index 00000000000..821a5e77e5b --- /dev/null +++ b/tests/drivers/flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf @@ -0,0 +1,4 @@ +CONFIG_FCB=y +CONFIG_FLASH_MAP=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf b/tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf new file mode 100644 index 00000000000..821a5e77e5b --- /dev/null +++ b/tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf @@ -0,0 +1,4 @@ +CONFIG_FCB=y +CONFIG_FLASH_MAP=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf b/tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf new file mode 100644 index 00000000000..821a5e77e5b --- /dev/null +++ b/tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf @@ -0,0 +1,4 @@ +CONFIG_FCB=y +CONFIG_FLASH_MAP=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index 4e73617ba41..79d75ca9b13 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -14,9 +14,6 @@ #define TEST_AREA_DEV_NODE DT_INST(0, nordic_qspi_nor) #elif defined(CONFIG_SPI_NOR) #define TEST_AREA_DEV_NODE DT_INST(0, jedec_spi_nor) -#elif defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) -/* SoC embedded NVM */ -#define TEST_AREA slot1_ns_partition #else #define TEST_AREA storage_partition #endif diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index f7ee0b7fc6d..9aa13bb40d5 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -38,7 +38,7 @@ tests: drivers.flash.common.tfm_ns: build_only: true filter: (CONFIG_FLASH_HAS_DRIVER_ENABLED and CONFIG_TRUSTED_EXECUTION_NONSECURE - and dt_label_with_parent_compat_enabled("slot1_ns_partition", "fixed-partitions")) + and dt_label_with_parent_compat_enabled("storage_partition", "fixed-partitions")) integration_platforms: - nrf9161dk_nrf9161_ns drivers.flash.common.stm32: From 3675ef9dcc4f62dd702e1fda9356fe8be6b73c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Wed, 22 Nov 2023 09:56:03 +0100 Subject: [PATCH 0018/2300] [nrf fromtree] drivers: ieee802154: nrf5: support raw mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When CONFIG_IEEE802154_RAW_MODE is set there is no network interface that could provide pointer to the device the interface is running on top of. The current implementation of nRF5 ieee802154 driver implicitly assumes that such an interface is always present, which leads to crashes when raw mode is enabled. This commit adds support for IEEE802154_RAW_MODE in nRF5 ieee802154 driver by latching pointer to the ieee802154 device on initialization if needed so that it doesn't have to be retrieved using the network interface in run-time. Signed-off-by: Jędrzej Ciupis (cherry picked from commit 0bad09c7faec98ccfb01326896fc3032f466147c) (cherry picked from commit ae5914c83154f90d3ab115e81c067e5275ff2917) --- drivers/ieee802154/ieee802154_nrf5.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 9a02aef7e4c..94924e06dba 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -57,6 +57,9 @@ struct nrf5_802154_config { }; static struct nrf5_802154_data nrf5_data; +#if defined(CONFIG_IEEE802154_RAW_MODE) +static const struct device *nrf5_dev; +#endif #define DRX_SLOT_RX 0 /* Delayed reception window ID */ @@ -95,6 +98,15 @@ static struct nrf5_802154_data nrf5_data; #define IEEE802154_NRF5_VENDOR_OUI (uint32_t)0xF4CE36 #endif +static inline const struct device *nrf5_get_device(void) +{ +#if defined(CONFIG_IEEE802154_RAW_MODE) + return nrf5_dev; +#else + return net_if_get_device(nrf5_data.iface); +#endif +} + static void nrf5_get_eui64(uint8_t *mac) { uint64_t factoryAddress; @@ -726,6 +738,9 @@ static int nrf5_init(const struct device *dev) { const struct nrf5_802154_config *nrf5_radio_cfg = NRF5_802154_CFG(dev); struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev); +#if defined(CONFIG_IEEE802154_RAW_MODE) + nrf5_dev = dev; +#endif k_fifo_init(&nrf5_radio->rx_fifo); k_sem_init(&nrf5_radio->tx_wait, 0, 1); @@ -1046,7 +1061,7 @@ void nrf_802154_received_timestamp_raw(uint8_t *data, int8_t power, uint8_t lqi, void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id) { - const struct device *dev = net_if_get_device(nrf5_data.iface); + const struct device *dev = nrf5_get_device(); #if defined(CONFIG_IEEE802154_CSL_ENDPOINT) if (id == DRX_SLOT_RX) { @@ -1165,7 +1180,7 @@ void nrf_802154_energy_detected(const nrf_802154_energy_detected_t *result) energy_scan_done_cb_t callback = nrf5_data.energy_scan_done; nrf5_data.energy_scan_done = NULL; - callback(net_if_get_device(nrf5_data.iface), result->ed_dbm); + callback(nrf5_get_device(), result->ed_dbm); } } @@ -1175,7 +1190,7 @@ void nrf_802154_energy_detection_failed(nrf_802154_ed_error_t error) energy_scan_done_cb_t callback = nrf5_data.energy_scan_done; nrf5_data.energy_scan_done = NULL; - callback(net_if_get_device(nrf5_data.iface), SHRT_MAX); + callback(nrf5_get_device(), SHRT_MAX); } } From 7b3c2b789dc053d49faab6b4ca13d698013c499a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Mon, 27 Nov 2023 09:21:29 +0100 Subject: [PATCH 0019/2300] [nrf fromtree] modules: hal_nordic: nrf_802154: lengthen serialization ring buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit increases the length of ring buffer that holds serialized nRF 802.15.4 API calls so that it can simultaneously store all notifications the driver is capable of issuing. Currently that's not the case, which creates a possibility of the serialization buffers running out while the driver is issuing notifications. Signed-off-by: Jędrzej Ciupis (cherry picked from commit 29d027a47b8cb8bccfbed32f1f98e3d4d1ebe114) (cherry picked from commit 6e296fb2733fb373b5059bf642e8eec2b8635277) --- .../serialization/platform/nrf_802154_spinel_backend_ipc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c index 06ad1f003e6..8a9cd8739b2 100644 --- a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c +++ b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c @@ -71,9 +71,11 @@ nrf_802154_ser_err_t nrf_802154_backend_init(void) } /* Send packet thread details */ -#define RING_BUFFER_LEN 16 #define SEND_THREAD_STACK_SIZE 1024 +/* Make the ring buffer long enough to hold all notifications that the driver can produce */ +#define RING_BUFFER_LEN (CONFIG_NRF_802154_RX_BUFFERS + 10) + static K_SEM_DEFINE(send_sem, 0, RING_BUFFER_LEN); K_THREAD_STACK_DEFINE(send_thread_stack, SEND_THREAD_STACK_SIZE); struct k_thread send_thread_data; From 05594b89487c8a61385e4e67e8f0e83469006307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Tue, 21 Nov 2023 14:49:42 +0100 Subject: [PATCH 0020/2300] [nrf fromtree] drivers: ieee802154: support Key Identifier Mode > 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IEEE 802.15.4-2020 defines four possible values for Key Identifier Mode field of the Auxiliary Security Header. The current ieee802154 driver API only supports two of them: b00 and b01. This commit adds support for the two remaining Key Identifier Mode values. It's done by replacing a field that can only hold Key Index into a field that can holds a pointer to the entire Key Identifier field. See IEEE 802.15.4-2020, sections 9.4.2.3 and 9.4.4 for further reference. Signed-off-by: Jędrzej Ciupis (cherry picked from commit 7afeb62e209258ddf6d0765bf387a757c3b087c8) (cherry picked from commit 14a3d4d979bee0ecae346e24b112bb61732f0915) --- drivers/ieee802154/ieee802154_nrf5.c | 26 +++++++------------------- include/zephyr/net/ieee802154_radio.h | 7 ++++++- modules/openthread/platform/radio.c | 27 ++++++++++++++++++--------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 94924e06dba..defbc90cd07 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -781,25 +781,17 @@ static void nrf5_iface_init(struct net_if *iface) #if defined(CONFIG_NRF_802154_ENCRYPTION) static void nrf5_config_mac_keys(struct ieee802154_key *mac_keys) { - static nrf_802154_key_id_t stored_key_ids[NRF_802154_SECURITY_KEY_STORAGE_SIZE]; - static uint8_t stored_ids[NRF_802154_SECURITY_KEY_STORAGE_SIZE]; - uint8_t i; + nrf_802154_security_key_remove_all(); - for (i = 0; i < NRF_802154_SECURITY_KEY_STORAGE_SIZE && stored_key_ids[i].p_key_id; i++) { - nrf_802154_security_key_remove(&stored_key_ids[i]); - stored_key_ids[i].p_key_id = NULL; - } - - i = 0; - for (struct ieee802154_key *keys = mac_keys; keys->key_value - && i < NRF_802154_SECURITY_KEY_STORAGE_SIZE; keys++, i++) { + for (uint8_t i = 0; mac_keys->key_value + && i < NRF_802154_SECURITY_KEY_STORAGE_SIZE; mac_keys++, i++) { nrf_802154_key_t key = { - .value.p_cleartext_key = keys->key_value, - .id.mode = keys->key_id_mode, - .id.p_key_id = &(keys->key_index), + .value.p_cleartext_key = mac_keys->key_value, + .id.mode = mac_keys->key_id_mode, + .id.p_key_id = mac_keys->key_id, .type = NRF_802154_KEY_CLEARTEXT, .frame_counter = 0, - .use_global_frame_counter = !(keys->frame_counter_per_key), + .use_global_frame_counter = !(mac_keys->frame_counter_per_key), }; __ASSERT_EVAL((void)nrf_802154_security_key_store(&key), @@ -807,10 +799,6 @@ static void nrf5_config_mac_keys(struct ieee802154_key *mac_keys) err == NRF_802154_SECURITY_ERROR_NONE || err == NRF_802154_SECURITY_ERROR_ALREADY_PRESENT, "Storing key failed, err: %d", err); - - stored_ids[i] = *key.id.p_key_id; - stored_key_ids[i].mode = key.id.mode; - stored_key_ids[i].p_key_id = &stored_ids[i]; }; } #endif /* CONFIG_NRF_802154_ENCRYPTION */ diff --git a/include/zephyr/net/ieee802154_radio.h b/include/zephyr/net/ieee802154_radio.h index 59608fac391..de0cf89da4c 100644 --- a/include/zephyr/net/ieee802154_radio.h +++ b/include/zephyr/net/ieee802154_radio.h @@ -592,11 +592,16 @@ struct ieee802154_filter { * IEEE802154_CONFIG_MAC_KEYS. */ struct ieee802154_key { + /** Key material */ uint8_t *key_value; + /** Initial value of frame counter associated with the key, see section 9.4.3 */ uint32_t key_frame_counter; + /** Indicates if per-key frame counter should be used, see section 9.4.3 */ bool frame_counter_per_key; + /** Key Identifier Mode, see section 9.4.2.3, Table 9-7 */ uint8_t key_id_mode; - uint8_t key_index; + /** Key Identifier, see section 9.4.4 */ + uint8_t *key_id; }; /** IEEE 802.15.4 Transmission mode. */ diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index 98eab182aad..a09b7dd3b67 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1188,20 +1188,14 @@ void otPlatRadioSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKe struct ieee802154_key keys[] = { { .key_id_mode = key_id_mode, - .key_index = aKeyId == 1 ? 0x80 : aKeyId - 1, - .key_value = (uint8_t *)aPrevKey->mKeyMaterial.mKey.m8, .frame_counter_per_key = false, }, { .key_id_mode = key_id_mode, - .key_index = aKeyId, - .key_value = (uint8_t *)aCurrKey->mKeyMaterial.mKey.m8, .frame_counter_per_key = false, }, { .key_id_mode = key_id_mode, - .key_index = aKeyId == 0x80 ? 1 : aKeyId + 1, - .key_value = (uint8_t *)aNextKey->mKeyMaterial.mKey.m8, .frame_counter_per_key = false, }, { @@ -1215,9 +1209,24 @@ void otPlatRadioSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKe }, }; - /* aKeyId in range: (1, 0x80) means valid keys - * aKeyId == 0 is used only to clear keys for stack reset in RCP - */ + if (key_id_mode == 1) { + /* aKeyId in range: (1, 0x80) means valid keys */ + uint8_t prev_key_id = aKeyId == 1 ? 0x80 : aKeyId - 1; + uint8_t next_key_id = aKeyId == 0x80 ? 1 : aKeyId + 1; + + keys[0].key_id = &prev_key_id; + keys[0].key_value = (uint8_t *)aPrevKey->mKeyMaterial.mKey.m8; + + keys[1].key_id = &aKeyId; + keys[1].key_value = (uint8_t *)aCurrKey->mKeyMaterial.mKey.m8; + + keys[2].key_id = &next_key_id; + keys[2].key_value = (uint8_t *)aNextKey->mKeyMaterial.mKey.m8; + } else { + /* aKeyId == 0 is used only to clear keys for stack reset in RCP */ + __ASSERT_NO_MSG((key_id_mode == 0) && (aKeyId == 0)); + } + struct ieee802154_config config = { .mac_keys = aKeyId == 0 ? clear_keys : keys, }; From f9a5ede4697ea3ac12766a78825489f489365ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Mon, 4 Dec 2023 10:19:11 +0100 Subject: [PATCH 0021/2300] [nrf fromtree] modules: hal_nordic: nrf_802154: remove magic number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit replaces a magic number in the definition of serialization ring buffer length with a macro provided by the 802.15.4 driver. Signed-off-by: Jędrzej Ciupis (cherry picked from commit 00f7c0e445d43b3e460aea6b7894f833dd469e2e) (cherry picked from commit cac385035be59178826590a46db63f5d3d800e66) --- .../serialization/platform/nrf_802154_spinel_backend_ipc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c index 8a9cd8739b2..b2629eef67b 100644 --- a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c +++ b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c @@ -9,6 +9,7 @@ #include #include +#include "nrf_802154.h" #include "nrf_802154_spinel_backend_callouts.h" #include "nrf_802154_serialization_error.h" #include "../../spinel_base/spinel.h" @@ -74,7 +75,7 @@ nrf_802154_ser_err_t nrf_802154_backend_init(void) #define SEND_THREAD_STACK_SIZE 1024 /* Make the ring buffer long enough to hold all notifications that the driver can produce */ -#define RING_BUFFER_LEN (CONFIG_NRF_802154_RX_BUFFERS + 10) +#define RING_BUFFER_LEN (NRF_802154_MAX_PENDING_NOTIFICATIONS + 1) static K_SEM_DEFINE(send_sem, 0, RING_BUFFER_LEN); K_THREAD_STACK_DEFINE(send_thread_stack, SEND_THREAD_STACK_SIZE); From 89ee8499c5a9d7c6f0d93b9979604ddeb097bc45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Mon, 18 Dec 2023 12:15:56 +0100 Subject: [PATCH 0022/2300] [nrf fromtree] modules: hal_nordic: reorganize nrf_802154 Kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are multiple Kconfig symbols that are only available when the radio hardware is present. As a result, the nRF 802.15.4 radio driver is more difficult to configure on multicore architectures. Also, such solution goes against the principle of hiding the details of the platform behind the driver's interface. This commit moves all the Kconfig options that correspond to settings present in common nRF 802.15.4 configuration header so that they're available no matter if the API is serialized. Signed-off-by: Jędrzej Ciupis (cherry picked from commit 054353a75daac5522a765251201e93b4a722882f) (cherry picked from commit 6fe770053b0f7beac3cccddca856b90b58285d1d) --- modules/hal_nordic/Kconfig | 119 +++++++++---------- modules/hal_nordic/nrf_802154/CMakeLists.txt | 46 ++++--- 2 files changed, 75 insertions(+), 90 deletions(-) diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index 44c12e88685..b461c094ef4 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -43,30 +43,6 @@ config NRF_802154_MULTIPROTOCOL_SUPPORT in the driver, this option must be enabled. Otherwise, the driver assumes that access to the radio peripheral is granted indefinitely. -config NRF_802154_ENCRYPTION - bool "nRF 802.15.4 AES-CCM* authentication & encryption" - depends on !CRYPTO_NRF_ECB - -choice NRF_802154_CCA_MODE - prompt "nRF IEEE 802.15.4 CCA mode" - default NRF_802154_CCA_MODE_ED - help - CCA mode - -config NRF_802154_CCA_MODE_ED - bool "Energy Above Threshold" - -config NRF_802154_CCA_MODE_CARRIER - bool "Carrier Seen" - -config NRF_802154_CCA_MODE_CARRIER_AND_ED - bool "Energy Above Threshold AND Carrier Seen" - -config NRF_802154_CCA_MODE_CARRIER_OR_ED - bool "Energy Above Threshold OR Carrier Seen" - -endchoice - choice NRF_802154_SL_TYPE prompt "nRF IEEE 802.15.4 Service Layer Type" @@ -77,43 +53,6 @@ config NRF_802154_SL_OPENSOURCE endchoice -config NRF_802154_CCA_ED_THRESHOLD - int "nRF IEEE 802.15.4 CCA Energy Detection threshold" - default 45 - help - If energy detected in a given channel is above the value then the - channel is deemed busy. The unit is defined as per 802.15.4-2006 spec. - -config NRF_802154_CCA_CORR_THRESHOLD - int "nRF IEEE 802.15.4 CCA Correlator threshold" - default 45 - -config NRF_802154_CCA_CORR_LIMIT - int "nRF IEEE 802.15.4 CCA Correlator limit" - default 2 - help - Limit for occurrences above correlator threshold. When not equal to - zero the correlator based signal detect is enabled. - -config NRF_802154_PENDING_SHORT_ADDRESSES - int "nRF 802.15.4 pending short addresses" - default 16 - help - Number of slots containing short addresses of nodes for which pending data is stored - -config NRF_802154_PENDING_EXTENDED_ADDRESSES - int "nRF 802.15.4 pending extended addresses" - default 16 - help - Number of slots containing extended addresses of nodes for which pending data is stored - -config NRF_802154_RX_BUFFERS - int "nRF 802.15.4 receive buffers" - default 16 - help - Number of buffers in nRF 802.15.4 driver receive queue. If this value is modified, - its serialization host counterpart must be set to the exact same value. - config NRF_802154_TEMPERATURE_UPDATE bool "nRF 802.15.4 temperature update" default y @@ -192,7 +131,47 @@ config NRF_802154_SER_DEFAULT_RESPONSE_TIMEOUT This option specifies default timeout of spinel status response in milliseconds. -if NRF_802154_SER_HOST +endmenu # NRF_802154_SER_HOST || NRF_802154_SER_RADIO + +if NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION + +choice NRF_802154_CCA_MODE + prompt "nRF IEEE 802.15.4 CCA mode" + default NRF_802154_CCA_MODE_ED + help + CCA mode + +config NRF_802154_CCA_MODE_ED + bool "Energy Above Threshold" + +config NRF_802154_CCA_MODE_CARRIER + bool "Carrier Seen" + +config NRF_802154_CCA_MODE_CARRIER_AND_ED + bool "Energy Above Threshold AND Carrier Seen" + +config NRF_802154_CCA_MODE_CARRIER_OR_ED + bool "Energy Above Threshold OR Carrier Seen" + +endchoice + +config NRF_802154_CCA_ED_THRESHOLD + int "nRF IEEE 802.15.4 CCA Energy Detection threshold" + default 45 + help + If energy detected in a given channel is above the value then the + channel is deemed busy. The unit is defined as per 802.15.4-2006 spec. + +config NRF_802154_CCA_CORR_THRESHOLD + int "nRF IEEE 802.15.4 CCA Correlator threshold" + default 45 + +config NRF_802154_CCA_CORR_LIMIT + int "nRF IEEE 802.15.4 CCA Correlator limit" + default 2 + help + Limit for occurrences above correlator threshold. When not equal to + zero the correlator based signal detect is enabled. config NRF_802154_RX_BUFFERS int "nRF 802.15.4 receive buffers" @@ -201,11 +180,21 @@ config NRF_802154_RX_BUFFERS Number of buffers in nRF 802.15.4 driver serialization host's receive queue. If this value is modified, its remote counterpart must be set to the exact same value. -endif +config NRF_802154_PENDING_SHORT_ADDRESSES + int "nRF 802.15.4 pending short addresses" + default 16 + help + Number of slots containing short addresses of nodes for which pending data is stored -endmenu # NRF_802154_SER_HOST || NRF_802154_SER_RADIO +config NRF_802154_PENDING_EXTENDED_ADDRESSES + int "nRF 802.15.4 pending extended addresses" + default 16 + help + Number of slots containing extended addresses of nodes for which pending data is stored -if NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION +config NRF_802154_ENCRYPTION + bool "nRF 802.15.4 AES-CCM* authentication & encryption" + depends on !CRYPTO_NRF_ECB config NRF_802154_CARRIER_FUNCTIONS bool "nRF 802.15.4 carrier functions" diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index cd5ace0b278..a274a019e25 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -12,24 +12,6 @@ if (CONFIG_NRF_802154_RADIO_DRIVER) sl_opensource/platform/nrf_802154_irq_zephyr.c sl_opensource/platform/nrf_802154_temperature_zephyr.c ) - - target_compile_definitions(zephyr-802154-interface - INTERFACE - # CCA mode options - NRF_802154_CCA_CORR_LIMIT_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_LIMIT} - NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_THRESHOLD} - NRF_802154_CCA_ED_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD} - ) - - if (CONFIG_NRF_802154_CCA_MODE_ED) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED) - elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER) - elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_AND_ED) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_AND_ED) - elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_OR_ED) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_OR_ED) - endif() endif () if (CONFIG_NRF_802154_SERIALIZATION) @@ -69,8 +51,23 @@ target_compile_definitions(zephyr-802154-interface # ACK timeout NRF_802154_ACK_TIMEOUT_ENABLED=1 + + # CCA mode options + NRF_802154_CCA_CORR_LIMIT_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_LIMIT} + NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_THRESHOLD} + NRF_802154_CCA_ED_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD} ) +if (CONFIG_NRF_802154_CCA_MODE_ED) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED) +elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER) +elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_AND_ED) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_AND_ED) +elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_OR_ED) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_OR_ED) +endif() + if (CONFIG_NRF_802154_ENCRYPTION) target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENCRYPTION_ENABLED=1) target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_SECURITY_WRITER_ENABLED=1) @@ -93,13 +90,12 @@ else() target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CARRIER_FUNCTIONS_ENABLED=0) endif() -if (CONFIG_NRF_802154_RADIO_DRIVER OR CONFIG_NRF_802154_SERIALIZATION) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENERGY_DETECTED_VERSION=1) - if (CONFIG_NRF_802154_ASSERT_ZEPHYR OR CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) - target_include_directories(zephyr-802154-interface INTERFACE include) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_PLATFORM_ASSERT_INCLUDE=\"nrf_802154_assert_zephyr.h\") - target_sources(nrf-802154-platform PRIVATE nrf_802154_assert_handler.c) - endif() +target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENERGY_DETECTED_VERSION=1) + +if (CONFIG_NRF_802154_ASSERT_ZEPHYR OR CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) + target_include_directories(zephyr-802154-interface INTERFACE include) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_PLATFORM_ASSERT_INCLUDE=\"nrf_802154_assert_zephyr.h\") + target_sources(nrf-802154-platform PRIVATE nrf_802154_assert_handler.c) endif() set(NRF52_SERIES ${CONFIG_SOC_SERIES_NRF52X}) From fb5c7141c2a960f6d8680bfe93e1f758b94fb4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Mon, 18 Dec 2023 12:20:26 +0100 Subject: [PATCH 0023/2300] [nrf fromtree] modules: hal_nordic: new nrf_802154 configuration option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a new Kconfig for the nRF 802.15.4 radio driver that allows the user to specify the number of encryption keys the driver can simultaneously store. Signed-off-by: Jędrzej Ciupis (cherry picked from commit 57ee911891049e5e7845fad1506dca5ab56fb014) (cherry picked from commit f59385bdd3af03f3d825e60089a6ec3fcf8c40a2) --- modules/hal_nordic/Kconfig | 6 ++++++ modules/hal_nordic/nrf_802154/CMakeLists.txt | 3 +++ 2 files changed, 9 insertions(+) diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index b461c094ef4..6f77bbea427 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -196,6 +196,12 @@ config NRF_802154_ENCRYPTION bool "nRF 802.15.4 AES-CCM* authentication & encryption" depends on !CRYPTO_NRF_ECB +config NRF_802154_SECURITY_KEY_STORAGE_SIZE + int "nRF 802.15.4 security key storage size" + default 3 + help + Number of encryption keys that the nRF 802.15.4 Radio Driver can store simultaneously. + config NRF_802154_CARRIER_FUNCTIONS bool "nRF 802.15.4 carrier functions" help diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index a274a019e25..763f9625be8 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -56,6 +56,9 @@ target_compile_definitions(zephyr-802154-interface NRF_802154_CCA_CORR_LIMIT_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_LIMIT} NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_THRESHOLD} NRF_802154_CCA_ED_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD} + + # Key storage size + NRF_802154_SECURITY_KEY_STORAGE_SIZE=${CONFIG_NRF_802154_SECURITY_KEY_STORAGE_SIZE} ) if (CONFIG_NRF_802154_CCA_MODE_ED) From b3bd06e6cd70623d42ae024e4cad0515a7c59921 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Tue, 21 Nov 2023 19:02:47 +0100 Subject: [PATCH 0024/2300] [nrf fromlist] tfm: Remove limitation of enabling FP when build TF-M NS application Remove limitation of enabling FP when building TF-M NS application. FP support have been fixed in the tf-m-tests repository for NS application. Board support for NS executable may still be lacking for some boards. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/65537 Signed-off-by: Joakim Andersson (cherry picked from commit 90a72daae2c8715d760d974a7d294aa2eb6b38c4) Signed-off-by: Dominik Ermel (cherry picked from commit 26cebfca894cccafb2237dfdc0eaf7fde354f457) --- arch/arm/core/Kconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/arm/core/Kconfig b/arch/arm/core/Kconfig index 75a64ea90eb..4afe6c06ab5 100644 --- a/arch/arm/core/Kconfig +++ b/arch/arm/core/Kconfig @@ -268,9 +268,6 @@ choice config FP_HARDABI bool "Floating point Hard ABI" - # TF-M build system does not build the NS app and libraries correctly with Hard ABI. - # This limitation should be removed in the next TF-M synchronization. - depends on !TFM_BUILD_NS help This option selects the Floating point ABI in which hardware floating point instructions are generated and uses FPU-specific calling From 8c115b97779f71bf2a583f7383d514b22841316c Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 1 Dec 2023 10:29:53 +0530 Subject: [PATCH 0025/2300] [nrf fromlist] wifi: shell: Fix unbalanced braces Fix the typo in braces for help. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66005 Signed-off-by: Chaitanya Tata (cherry picked from commit e3429fadeece82ab46940a23edf4dc0954d9a718) Signed-off-by: Dominik Ermel (cherry picked from commit 03b90ac09da07502981123dc46a63a8cb283b7ab) --- subsys/net/l2/wifi/wifi_shell.c | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 5f7eb5ba0ee..c50175e086f 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1673,15 +1673,15 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(mode, NULL, "mode operational setting\n" "This command may be used to set the Wi-Fi device into a specific mode of operation\n" "parameters:" - "[-i : Interface index - optional argument\n" - "[-s : Station mode.\n" - "[-m : Monitor mode.\n" - "[-p : Promiscuous mode.\n" - "[-t : TX-Injection mode.\n" - "[-a : AP mode.\n" - "[-k : Softap mode.\n" - "[-h : Help.\n" - "[-g : Get current mode for a specific interface index.\n" + "[-i] : Interface index - optional argument\n" + "[-s] : Station mode.\n" + "[-m] : Monitor mode.\n" + "[-p] : Promiscuous mode.\n" + "[-t] : TX-Injection mode.\n" + "[-a] : AP mode.\n" + "[-k] : Softap mode.\n" + "[-h] : Help.\n" + "[-g] : 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" @@ -1692,14 +1692,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "monitor, TX-Injection and promiscuous mode is enabled.\n" "The different packet filter modes are control, management, data and enable all filters\n" "parameters:" - "[-i : Interface index - optional argument.\n" - "[-a : Enable all packet filter modes\n" - "[-m : Enable management packets to allowed up the stack.\n" - "[-c : Enable control packets to be allowed up the stack.\n" - "[-d : Enable Data packets to be allowed up the stack.\n" - "[-g : Get current filter settings for a specific interface index.\n" - "<-b : Capture length buffer size for each packet to be captured - optional argument.\n" - "<-h : Help.\n" + "[-i] : Interface index - optional argument.\n" + "[-a] : Enable all packet filter modes\n" + "[-m] : Enable management packets to allowed up the stack.\n" + "[-c] : Enable control packets to be allowed up the stack.\n" + "[-d] : Enable Data packets to be allowed up the stack.\n" + "[-g] : Get current filter settings for a specific interface index.\n" + "<-b> : Capture length buffer size for each packet to be captured - optional argument.\n" + "<-h> : 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" @@ -1710,10 +1710,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "monitor or TX-Injection mode is enabled.\n" "Currently 20 MHz is only supported and no BW parameter is provided\n" "parameters:" - "[-i : Interface index - optional argument.\n" - "[-c : Set a specific channel number to the lower layer.\n" - "[-g : Get current set channel number from the lower layer.\n" - "[-h : Help.\n" + "[-i] : Interface index - optional argument.\n" + "[-c] : Set a specific channel number to the lower layer.\n" + "[-g] : Get current set channel number from the lower layer.\n" + "[-h] : 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" From e46ff46820db4c68624b2ef10d2b4e9e5dd7e4a7 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 1 Dec 2023 10:36:06 +0530 Subject: [PATCH 0026/2300] [nrf fromlist] wifi: shell: Fix brackets type for optional params General notation for Optional params is to use square brackets. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66005 Signed-off-by: Chaitanya Tata (cherry picked from commit ad503caacd6004efb4f386ce526f8f1f8e1952a0) Signed-off-by: Dominik Ermel (cherry picked from commit ea492ab1190b2fd08cba1119b40ee525bd0455ed) --- subsys/net/l2/wifi/wifi_shell.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c50175e086f..64f125dea01 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1631,11 +1631,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(connect, NULL, "Connect to a Wi-Fi AP\n" "\"\"\n" - "\n" - "\n" - "\n" + "[channel number: 0 means all]\n" + "[PSK: valid only for secure SSIDs]\n" + "[Security type: valid only for secure SSIDs]\n" "0:None, 1:PSK, 2:PSK-256, 3:SAE\n" - "\n" + "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required", cmd_wifi_connect), SHELL_CMD(disconnect, NULL, "Disconnect from the Wi-Fi AP", @@ -1667,7 +1667,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(reg_domain, NULL, "Set or Get Wi-Fi regulatory domain\n" "Usage: wifi reg_domain [ISO/IEC 3166-1 alpha2] [-f]\n" - "-f: Force to use this regulatory hint over any other regulatory hints\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.", cmd_wifi_reg_domain), SHELL_CMD(mode, NULL, "mode operational setting\n" From 4679230967e6e7127bf39df984f4dc700acbcd93 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 1 Dec 2023 10:37:21 +0530 Subject: [PATCH 0027/2300] [nrf fromlist] wifi: shell: Fix PS mode help There is only a single parameter called "mode" that takes two possible values. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66005 Signed-off-by: Chaitanya Tata (cherry picked from commit 9c2c52a44a28f974fa1280b35f06875b067c69ea) Signed-off-by: Dominik Ermel (cherry picked from commit b16198a61fb3225013e1b2a0791ed2289ff978c0) --- subsys/net/l2/wifi/wifi_shell.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 64f125dea01..cd3390828d1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1644,8 +1644,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, cmd_wifi_ps), SHELL_CMD_ARG(ps_mode, NULL, - "\n" - "", + "\n", cmd_wifi_ps_mode, 2, 0), @@ -1733,8 +1732,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, 0), SHELL_CMD_ARG(ps_wakeup_mode, NULL, - " : Set PS wake up mode to DTIM interval\n" - " : Set PS wake up mode to listen interval", + "\n", cmd_wifi_ps_wakeup_mode, 2, 0), From 753d06483941443b43742a331d72aaf12e10aa0e Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 1 Dec 2023 10:40:25 +0530 Subject: [PATCH 0028/2300] [nrf fromlist] wifi: shell: Add missing security options Newly added security types are missing from the help. Also, now that we have two variants of PSK, use the prefix to disambiguate. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66005 Signed-off-by: Chaitanya Tata (cherry picked from commit 7c23186c1282125353cacca44899f030706b2b68) Signed-off-by: Dominik Ermel (cherry picked from commit d20bbab16aec2aaca8ce716723c3fc641b9cedf8) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index cd3390828d1..767ac3eaf05 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1634,7 +1634,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[channel number: 0 means all]\n" "[PSK: valid only for secure SSIDs]\n" "[Security type: valid only for secure SSIDs]\n" - "0:None, 1:PSK, 2:PSK-256, 3:SAE\n" + "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required", cmd_wifi_connect), From 98bee806c321971f10a6487b1e10756616177e96 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 1 Dec 2023 10:57:40 +0530 Subject: [PATCH 0029/2300] [nrf fromlist] wifi: shell: Enforce argument count checks Use the proper API to enforce argument count checks as per mandatory or optional params. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66005 Signed-off-by: Chaitanya Tata (cherry picked from commit bebc385d82e4fd230ac7afd0d580a8045624e921) Signed-off-by: Dominik Ermel (cherry picked from commit 4ffdc9cb53bf752a13a6ee1ef6ad3f08b96159d1) --- subsys/net/l2/wifi/wifi_shell.c | 74 ++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 767ac3eaf05..d0cd0551897 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1598,37 +1598,43 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg } SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, - SHELL_CMD(disable, NULL, + SHELL_CMD_ARG(disable, NULL, "Disable Access Point mode", - cmd_wifi_ap_disable), - SHELL_CMD(enable, NULL, " [channel] [PSK]", - cmd_wifi_ap_enable), + cmd_wifi_ap_disable, + 1, 0), + SHELL_CMD_ARG(enable, NULL, " [channel] [PSK]", + cmd_wifi_ap_enable, + 2, 1), SHELL_SUBCMD_SET_END ); SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, - SHELL_CMD(quick_setup, NULL, " Start a TWT flow with defaults:\n" + SHELL_CMD_ARG(quick_setup, NULL, " Start a TWT flow with defaults:\n" " \n", - cmd_wifi_twt_setup_quick), - SHELL_CMD(setup, NULL, " Start a TWT flow:\n" + cmd_wifi_twt_setup_quick, + 3, 0), + SHELL_CMD_ARG(setup, NULL, " Start a TWT flow:\n" "\n" "\n" " " " \n", - cmd_wifi_twt_setup), - SHELL_CMD(teardown, NULL, " Teardown a TWT flow:\n" + cmd_wifi_twt_setup, + 11, 0), + SHELL_CMD_ARG(teardown, NULL, " Teardown a TWT flow:\n" "\n" "\n" " \n", - cmd_wifi_twt_teardown), - SHELL_CMD(teardown_all, NULL, " Teardown all TWT flows\n", - cmd_wifi_twt_teardown_all), + cmd_wifi_twt_teardown, + 5, 0), + SHELL_CMD_ARG(teardown_all, NULL, " Teardown all TWT flows\n", + cmd_wifi_twt_teardown_all, + 1, 0), SHELL_SUBCMD_SET_END ); SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(ap, &wifi_cmd_ap, "Access Point mode commands", NULL), - SHELL_CMD(connect, NULL, + SHELL_CMD_ARG(connect, NULL, "Connect to a Wi-Fi AP\n" "\"\"\n" "[channel number: 0 means all]\n" @@ -1637,18 +1643,21 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required", - cmd_wifi_connect), - SHELL_CMD(disconnect, NULL, "Disconnect from the Wi-Fi AP", - cmd_wifi_disconnect), - SHELL_CMD(ps, NULL, "Configure Wi-F PS on/off, no arguments will dump config", - cmd_wifi_ps), + cmd_wifi_connect, + 2, 5), + SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP", + cmd_wifi_disconnect, + 1, 0), + SHELL_CMD_ARG(ps, NULL, "Configure Wi-F PS on/off, no arguments will dump config", + cmd_wifi_ps, + 1, 1), SHELL_CMD_ARG(ps_mode, NULL, "\n", cmd_wifi_ps_mode, 2, 0), - SHELL_CMD(scan, NULL, + SHELL_CMD_ARG(scan, NULL, "Scan for Wi-Fi APs\n" "OPTIONAL PARAMETERS:\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" @@ -1659,17 +1668,19 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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-11,14_5:36,149-165,44\n" "[-h, --help] : Print out the help for the scan command.", - cmd_wifi_scan), - SHELL_CMD(statistics, NULL, "Wi-Fi interface statistics", cmd_wifi_stats), - SHELL_CMD(status, NULL, "Status of the Wi-Fi interface", cmd_wifi_status), + cmd_wifi_scan, + 1, 8), + SHELL_CMD_ARG(statistics, NULL, "Wi-Fi interface statistics", cmd_wifi_stats, 1, 0), + SHELL_CMD_ARG(status, NULL, "Status of the Wi-Fi interface", cmd_wifi_status, 1, 0), SHELL_CMD(twt, &wifi_twt_ops, "Manage TWT flows", NULL), - SHELL_CMD(reg_domain, NULL, + SHELL_CMD_ARG(reg_domain, NULL, "Set or Get Wi-Fi regulatory domain\n" "Usage: wifi reg_domain [ISO/IEC 3166-1 alpha2] [-f]\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.", - cmd_wifi_reg_domain), - SHELL_CMD(mode, NULL, "mode operational setting\n" + cmd_wifi_reg_domain, + 2, 1), + 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" "parameters:" "[-i] : Interface index - optional argument\n" @@ -1685,8 +1696,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "wifi mode -g -i1\n" "Set operation example for interface index 1 - set station+promiscuous\n" "wifi mode -i1 -sp\n", - cmd_wifi_mode), - SHELL_CMD(packet_filter, NULL, "mode filter setting\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" @@ -1703,8 +1715,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "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), - SHELL_CMD(channel, NULL, "wifi channel setting\n" + cmd_wifi_packet_filter, + 1, 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" @@ -1717,7 +1730,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "wifi channel -g -i1\n" "Set operation example for interface index 1 (setting channel 5)\n" "wifi -i1 -c5\n", - cmd_wifi_channel), + cmd_wifi_channel, + 1, 4), SHELL_CMD_ARG(ps_timeout, NULL, " - PS inactivity timer(in ms)", From 5418963fc0a506fa6a5884d46248166bfce07acf Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 1 Dec 2023 11:06:51 +0530 Subject: [PATCH 0030/2300] [nrf fromlist] wifi: shell: Add long arguments to help Long arguments are handy for new users. Also use hyphen's rather than underscore to follow the convention. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66005 Signed-off-by: Chaitanya Tata (cherry picked from commit f721e835805a6e6bae6e7c491f3d4369d64412e4) Signed-off-by: Dominik Ermel (cherry picked from commit 893e58ca65abc6f5da237733ef7a4ebdecb0bc29) --- subsys/net/l2/wifi/wifi_shell.c | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d0cd0551897..c5b8f60d933 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1275,10 +1275,10 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, int opt; int option_index = 0; - static struct option long_options[] = {{"if_index", optional_argument, 0, 'i'}, + static struct option long_options[] = {{"if-index", optional_argument, 0, 'i'}, {"sta", no_argument, 0, 's'}, {"monitor", no_argument, 0, 'm'}, - {"TX-injection", no_argument, 0, 't'}, + {"tx-injection", no_argument, 0, 't'}, {"promiscuous", no_argument, 0, 'p'}, {"ap", no_argument, 0, 'a'}, {"softap", no_argument, 0, 'k'}, @@ -1385,7 +1385,7 @@ void parse_channel_args_to_params(const struct shell *sh, int argc, int opt; int option_index = 0; - static struct option long_options[] = {{"if_index", optional_argument, 0, 'i'}, + static struct option long_options[] = {{"if-index", optional_argument, 0, 'i'}, {"channel", required_argument, 0, 'c'}, {"get", no_argument, 0, 'g'}, {"help", no_argument, 0, 'h'}, @@ -1491,8 +1491,8 @@ void parse_filter_args_to_params(const struct shell *sh, int argc, int opt; int option_index = 0; - static struct option long_options[] = {{"if_index", optional_argument, 0, 'i'}, - {"capture_len", optional_argument, 0, 'b'}, + static struct option long_options[] = {{"if-index", optional_argument, 0, 'i'}, + {"capture-len", optional_argument, 0, 'b'}, {"all", no_argument, 0, 'a'}, {"mgmt", no_argument, 0, 'm'}, {"ctrl", no_argument, 0, 'c'}, @@ -1683,15 +1683,15 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, 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" "parameters:" - "[-i] : Interface index - optional argument\n" - "[-s] : Station mode.\n" - "[-m] : Monitor mode.\n" - "[-p] : Promiscuous mode.\n" - "[-t] : TX-Injection mode.\n" - "[-a] : AP mode.\n" - "[-k] : Softap mode.\n" - "[-h] : Help.\n" - "[-g] : Get current mode for a specific interface index.\n" + "[-i, --if-index ] : Interface index.\n" + "[-s, --sta] : Station mode.\n" + "[-m, --monitor] : Monitor mode.\n" + "[-p, --promiscuous] : Promiscuous mode.\n" + "[-t, --tx-injection] : TX-Injection 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" @@ -1703,14 +1703,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "monitor, TX-Injection and promiscuous mode is enabled.\n" "The different packet filter modes are control, management, data and enable all filters\n" "parameters:" - "[-i] : Interface index - optional argument.\n" - "[-a] : Enable all packet filter modes\n" - "[-m] : Enable management packets to allowed up the stack.\n" - "[-c] : Enable control packets to be allowed up the stack.\n" - "[-d] : Enable Data packets to be allowed up the stack.\n" - "[-g] : Get current filter settings for a specific interface index.\n" - "<-b> : Capture length buffer size for each packet to be captured - optional argument.\n" - "<-h> : Help.\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" @@ -1722,10 +1722,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "monitor or TX-Injection mode is enabled.\n" "Currently 20 MHz is only supported and no BW parameter is provided\n" "parameters:" - "[-i] : Interface index - optional argument.\n" - "[-c] : Set a specific channel number to the lower layer.\n" - "[-g] : Get current set channel number from the lower layer.\n" - "[-h] : Help.\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" From 5d089633e9eddeb6cf49b9b497f18e7c0480320b Mon Sep 17 00:00:00 2001 From: Grzegorz Chwierut Date: Tue, 21 Nov 2023 11:01:17 +0100 Subject: [PATCH 0031/2300] [nrf fromtree] twister: pytest: Add --pytest-args to Twister command line Extend Twister command line with --pytest-args. This parameter is passed to pytest subprocess. It allows to select a specific testcase from a test suite. Signed-off-by: Grzegorz Chwierut (cherry picked from commit a1698b691d9bfd25dfd70fc1ed42e819cdec61a3) (cherry picked from commit 9566a94fc5175eae833af9ec264f68bcf16bc3f6) Signed-off-by: Dominik Ermel (cherry picked from commit 130824afa4d94bf56a6c3ea9e83384744eb7d9c4) --- doc/develop/test/pytest.rst | 10 +++ .../pylib/twister/twisterlib/environment.py | 5 ++ scripts/pylib/twister/twisterlib/harness.py | 19 ++++-- .../pytest_integration/test_harness_pytest.py | 66 +++++++++++++++++++ 4 files changed, 96 insertions(+), 4 deletions(-) diff --git a/doc/develop/test/pytest.rst b/doc/develop/test/pytest.rst index e644882191e..f3db6fcee89 100644 --- a/doc/develop/test/pytest.rst +++ b/doc/develop/test/pytest.rst @@ -56,6 +56,16 @@ Pytest scans the given locations looking for tests, following its default `discovery rules `_ One can also pass some extra arguments to the pytest from yaml file using ``pytest_args`` keyword under ``harness_config``, e.g.: ``pytest_args: [‘-k=test_method’, ‘--log-level=DEBUG’]``. +There is also an option to pass ``--pytest-args`` through Twister command line parameters. +This can be particularly useful when one wants to select a specific testcase from a test suite. +For instance, one can use a command: + +.. code-block:: console + + $ ./scripts/twister --platform native_sim -T samples/subsys/testsuite/pytest/shell \ + -s samples/subsys/testsuite/pytest/shell/sample.pytest.shell \ + --pytest-args='-k test_shell_print_version' + Helpers & fixtures ================== diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index 86965f1f9cf..b7e11406cd4 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -216,6 +216,11 @@ def add_parse_arguments(parser = None): and 'fifo_loop' is a name of a function found in main.c without test prefix. """) + parser.add_argument("--pytest-args", + help="""Pass additional arguments to the pytest subprocess. This parameter + will override the pytest_args from the harness_config in YAML file. + """) + valgrind_asan_group.add_argument( "--enable-valgrind", action="store_true", help="""Run binary through valgrind and check for several memory access diff --git a/scripts/pylib/twister/twisterlib/harness.py b/scripts/pylib/twister/twisterlib/harness.py index 052def7162a..dece1673c7a 100644 --- a/scripts/pylib/twister/twisterlib/harness.py +++ b/scripts/pylib/twister/twisterlib/harness.py @@ -309,8 +309,9 @@ def pytest_run(self, timeout): def generate_command(self): config = self.instance.testsuite.harness_config + handler: Handler = self.instance.handler pytest_root = config.get('pytest_root', ['pytest']) if config else ['pytest'] - pytest_args = config.get('pytest_args', []) if config else [] + pytest_args_yaml = config.get('pytest_args', []) if config else [] pytest_dut_scope = config.get('pytest_dut_scope', None) if config else None command = [ 'pytest', @@ -324,12 +325,19 @@ def generate_command(self): ] command.extend([os.path.normpath(os.path.join( self.source_dir, os.path.expanduser(os.path.expandvars(src)))) for src in pytest_root]) - command.extend(pytest_args) + + if handler.options.pytest_args: + command.append(handler.options.pytest_args) + if pytest_args_yaml: + logger.warning(f'The pytest_args ({handler.options.pytest_args}) specified ' + 'in the command line will override the pytest_args defined ' + f'in the YAML file {pytest_args_yaml}') + else: + command.extend(pytest_args_yaml) + if pytest_dut_scope: command.append(f'--dut-scope={pytest_dut_scope}') - handler: Handler = self.instance.handler - if handler.options.verbose > 1: command.extend([ '--log-cli-level=DEBUG', @@ -489,6 +497,9 @@ def _parse_report_file(self, report): tc.status = 'error' tc.reason = elem.get('message') tc.output = elem.text + else: + self.state = 'skipped' + self.instance.reason = 'No tests collected' class Gtest(Harness): diff --git a/scripts/tests/twister/pytest_integration/test_harness_pytest.py b/scripts/tests/twister/pytest_integration/test_harness_pytest.py index 150980059b3..fc60b99e0d1 100644 --- a/scripts/tests/twister/pytest_integration/test_harness_pytest.py +++ b/scripts/tests/twister/pytest_integration/test_harness_pytest.py @@ -25,6 +25,7 @@ def testinstance() -> TestInstance: testinstance.handler = mock.Mock() testinstance.handler.options = mock.Mock() testinstance.handler.options.verbose = 1 + testinstance.handler.options.pytest_args = None testinstance.handler.type_str = 'native' return testinstance @@ -67,6 +68,18 @@ def test_pytest_command_extra_args(testinstance: TestInstance): assert c in command +def test_pytest_command_extra_args_in_options(testinstance: TestInstance): + pytest_harness = Pytest() + pytest_args_from_yaml = '-k test_from_yaml' + pytest_args_from_cmd = '-k test_from_cmd' + testinstance.testsuite.harness_config['pytest_args'] = [pytest_args_from_yaml] + testinstance.handler.options.pytest_args = pytest_args_from_cmd + pytest_harness.configure(testinstance) + command = pytest_harness.generate_command() + assert pytest_args_from_cmd in command + assert pytest_args_from_yaml not in command + + @pytest.mark.parametrize( ('pytest_root', 'expected'), [ @@ -222,3 +235,56 @@ def test_skip_2(): assert len(testinstance.testcases) == 2 for tc in testinstance.testcases: assert tc.status == "skipped" + + +def test_if_report_with_filter(pytester, testinstance: TestInstance): + test_file_content = textwrap.dedent(""" + import pytest + def test_A(): + pass + def test_B(): + pass + """) + test_file = pytester.path / 'test_filter.py' + test_file.write_text(test_file_content) + report_file = pytester.path / 'report.xml' + result = pytester.runpytest( + str(test_file), + '-k', 'test_B', + f'--junit-xml={str(report_file)}' + ) + result.assert_outcomes(passed=1) + assert report_file.is_file() + + pytest_harness = Pytest() + pytest_harness.configure(testinstance) + pytest_harness.report_file = report_file + pytest_harness._update_test_status() + assert pytest_harness.state == "passed" + assert testinstance.status == "passed" + assert len(testinstance.testcases) == 1 + + +def test_if_report_with_no_collected(pytester, testinstance: TestInstance): + test_file_content = textwrap.dedent(""" + import pytest + def test_A(): + pass + """) + test_file = pytester.path / 'test_filter.py' + test_file.write_text(test_file_content) + report_file = pytester.path / 'report.xml' + result = pytester.runpytest( + str(test_file), + '-k', 'test_B', + f'--junit-xml={str(report_file)}' + ) + result.assert_outcomes(passed=0) + assert report_file.is_file() + + pytest_harness = Pytest() + pytest_harness.configure(testinstance) + pytest_harness.report_file = report_file + pytest_harness._update_test_status() + assert pytest_harness.state == "skipped" + assert testinstance.status == "skipped" From d5e85fecd38817d7cd0bf5cee1bcad58277b4e8a Mon Sep 17 00:00:00 2001 From: Ederson de Souza Date: Mon, 27 Nov 2023 17:09:07 -0800 Subject: [PATCH 0032/2300] [nrf fromtree] scripts/pylib/twister/twisterlib: Support multiple `--pytest-args` One can not even replace sucessfully pytest basic sample `pytest-args` with command line "--pytest-args", as all it does is to append a single string to current list of commands, making it impossible to send several arguments. This patch fixes that by allowing several instances of `--pytest-args` to compose the whole list of arguments to be passed to pytest. Signed-off-by: Ederson de Souza (cherry picked from commit 10ec2b129c9102a867d1ce26eb8cb986f95b6d98) (cherry picked from commit ad95bc81b8b9d44431c092a3cee4e7204dfceba4) Signed-off-by: Dominik Ermel (cherry picked from commit 2837a3c6bd07e5920bfd0dcbab9392086f1769f3) --- doc/develop/test/pytest.rst | 2 ++ .../pylib/twister/twisterlib/environment.py | 3 ++- scripts/pylib/twister/twisterlib/harness.py | 19 ++++++++++--------- .../pytest_integration/test_harness_pytest.py | 5 +++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/doc/develop/test/pytest.rst b/doc/develop/test/pytest.rst index f3db6fcee89..f6ba54fa52e 100644 --- a/doc/develop/test/pytest.rst +++ b/doc/develop/test/pytest.rst @@ -67,6 +67,8 @@ For instance, one can use a command: --pytest-args='-k test_shell_print_version' +Note that ``--pytest-args`` can be passed multiple times to pass several arguments to the pytest. + Helpers & fixtures ================== diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index b7e11406cd4..16e19c85fec 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -216,7 +216,8 @@ def add_parse_arguments(parser = None): and 'fifo_loop' is a name of a function found in main.c without test prefix. """) - parser.add_argument("--pytest-args", + parser.add_argument( + "--pytest-args", action="append", help="""Pass additional arguments to the pytest subprocess. This parameter will override the pytest_args from the harness_config in YAML file. """) diff --git a/scripts/pylib/twister/twisterlib/harness.py b/scripts/pylib/twister/twisterlib/harness.py index dece1673c7a..8b8ad92fc51 100644 --- a/scripts/pylib/twister/twisterlib/harness.py +++ b/scripts/pylib/twister/twisterlib/harness.py @@ -326,15 +326,6 @@ def generate_command(self): command.extend([os.path.normpath(os.path.join( self.source_dir, os.path.expanduser(os.path.expandvars(src)))) for src in pytest_root]) - if handler.options.pytest_args: - command.append(handler.options.pytest_args) - if pytest_args_yaml: - logger.warning(f'The pytest_args ({handler.options.pytest_args}) specified ' - 'in the command line will override the pytest_args defined ' - f'in the YAML file {pytest_args_yaml}') - else: - command.extend(pytest_args_yaml) - if pytest_dut_scope: command.append(f'--dut-scope={pytest_dut_scope}') @@ -354,6 +345,16 @@ def generate_command(self): command.append('--device-type=custom') else: raise PytestHarnessException(f'Handling of handler {handler.type_str} not implemented yet') + + if handler.options.pytest_args: + command.extend(handler.options.pytest_args) + if pytest_args_yaml: + logger.warning(f'The pytest_args ({handler.options.pytest_args}) specified ' + 'in the command line will override the pytest_args defined ' + f'in the YAML file {pytest_args_yaml}') + else: + command.extend(pytest_args_yaml) + return command def _generate_parameters_for_hardware(self, handler: Handler): diff --git a/scripts/tests/twister/pytest_integration/test_harness_pytest.py b/scripts/tests/twister/pytest_integration/test_harness_pytest.py index fc60b99e0d1..befd384be37 100644 --- a/scripts/tests/twister/pytest_integration/test_harness_pytest.py +++ b/scripts/tests/twister/pytest_integration/test_harness_pytest.py @@ -71,12 +71,13 @@ def test_pytest_command_extra_args(testinstance: TestInstance): def test_pytest_command_extra_args_in_options(testinstance: TestInstance): pytest_harness = Pytest() pytest_args_from_yaml = '-k test_from_yaml' - pytest_args_from_cmd = '-k test_from_cmd' + pytest_args_from_cmd = ['-k', 'test_from_cmd'] testinstance.testsuite.harness_config['pytest_args'] = [pytest_args_from_yaml] testinstance.handler.options.pytest_args = pytest_args_from_cmd pytest_harness.configure(testinstance) command = pytest_harness.generate_command() - assert pytest_args_from_cmd in command + assert pytest_args_from_cmd[0] in command + assert pytest_args_from_cmd[1] in command assert pytest_args_from_yaml not in command From a8a54e5a7efd4b426fb199112a6447cc00bb4319 Mon Sep 17 00:00:00 2001 From: Adam Wojasinski Date: Fri, 1 Dec 2023 14:53:27 +0100 Subject: [PATCH 0033/2300] [nrf fromlist] manifest: hal_nordic: Update revision with fixed workaround in nrfx_qspi Pulls update in nrfx_qspi driver with fixed order of applying workaround for anomaly 215 on nRF52840 and anomaly 43 on nRF5340. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66034 Signed-off-by: Adam Wojasinski (cherry picked from commit e0dc936a4af5550f15d9e37ab9b44db5de452ee0) Signed-off-by: Dominik Ermel (cherry picked from commit 85997eb5ce6d0dcebdc02488e347b0dc59aa2303) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 14847109194..ed84e713620 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 56e0b052dff311c2f8eb08c6804e60fc79feb56f + revision: b9633ecea67bf52925d4c61455046223b46402b1 path: modules/hal/nordic groups: - hal From 8a275bc4f1f4375136f0821ae32fdcd027298d5c Mon Sep 17 00:00:00 2001 From: Przemyslaw Bida Date: Tue, 5 Dec 2023 13:48:37 +0100 Subject: [PATCH 0034/2300] [nrf fromtree] net: openthread: Openthread upmerge to `4ed44bc` This commit bumps openthread commit to `4ed44bc` and implements `CONFIG_OPENTHREAD_MULTIPAN_RCP` option. Signed-off-by: Przemyslaw Bida (cherry picked from commit 8f2b7a121bbf7b64fdf46c5c19231a12f96c4166) (cherry picked from commit 919457f5c1d9d491033b23efcf77197d687422a6) Signed-off-by: Dominik Ermel (cherry picked from commit 414a63955a3e0e60301b1970266b7c659553eff3) --- modules/openthread/CMakeLists.txt | 6 ++++++ modules/openthread/Kconfig.features | 3 +++ west.yml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 8afa1aec440..646b086ef1e 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -340,6 +340,12 @@ else() set(OT_MLR OFF CACHE BOOL "Enable Multicast Listener Registration feature for Thread 1.2" FORCE) endif() +if(CONFIG_OPENTHREAD_MULTIPAN_RCP) + set(OT_MULTIPAN_RCP ON CACHE BOOL "Enable Multi-PAN RCP" FORCE) +else() + set(OT_MULTIPAN_RCP OFF CACHE BOOL "Enable Multi-PAN RCP" FORCE) +endif() + if(CONFIG_OPENTHREAD_MULTIPLE_INSTANCE) set(OT_MULTIPLE_INSTANCE ON CACHE BOOL "Enable multiple instances" FORCE) else() diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index bd8a05ed9b9..2be5332cde3 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -218,6 +218,9 @@ config OPENTHREAD_MLR help Enable Multicast Listener Registration support for Thread 1.2 +config OPENTHREAD_MULTIPAN_RCP + bool "OpenThread multipan rcp" + config OPENTHREAD_MULTIPLE_INSTANCE bool "OpenThread multiple instances" diff --git a/west.yml b/west.yml index ed84e713620..c99118074eb 100644 --- a/west.yml +++ b/west.yml @@ -301,7 +301,7 @@ manifest: revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 path: modules/lib/open-amp - name: openthread - revision: 193e77e40ec2387d458eaebd1e03902d86f484a5 + revision: 4ed44bc7d58d9a98c6cca13a50d38129045ab3df path: modules/lib/openthread - name: percepio path: modules/debug/percepio From 9e4151fc21c0d9a64934b1b2aef84d4094cb9109 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 7 Dec 2023 15:05:13 +0100 Subject: [PATCH 0035/2300] [nrf fromlist] soc: nordic_nrf: Enable the TF-M NS storage partition for nordic boards Enable the TF-M NS storage partition for nordic boards. This partition is otherwise not used, and configured as secure. Fixes: #59376 Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66279 Signed-off-by: Joakim Andersson (cherry picked from commit 462ad3659295cc639b3c159573136731141a06cc) Signed-off-by: Dominik Ermel (cherry picked from commit 8e3a9faff9e21e2f92bc3f7a01bd77311c58087c) --- soc/arm/nordic_nrf/CMakeLists.txt | 4 ++++ soc/arm/nordic_nrf/Kconfig | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/soc/arm/nordic_nrf/CMakeLists.txt b/soc/arm/nordic_nrf/CMakeLists.txt index 47364b35ffb..3b097d73569 100644 --- a/soc/arm/nordic_nrf/CMakeLists.txt +++ b/soc/arm/nordic_nrf/CMakeLists.txt @@ -25,4 +25,8 @@ if(CONFIG_BUILD_WITH_TFM) set_property(TARGET zephyr_property_target APPEND PROPERTY TFM_CMAKE_OPTIONS -DZEPHYR_BASE=${ZEPHYR_BASE} ) + + set_property(TARGET zephyr_property_target + APPEND PROPERTY TFM_CMAKE_OPTIONS -DNRF_NS_STORAGE=${CONFIG_TFM_NRF_NS_STORAGE} + ) endif() diff --git a/soc/arm/nordic_nrf/Kconfig b/soc/arm/nordic_nrf/Kconfig index 19e49c05454..0372492cd7d 100644 --- a/soc/arm/nordic_nrf/Kconfig +++ b/soc/arm/nordic_nrf/Kconfig @@ -45,6 +45,10 @@ config TFM_LOG_LEVEL_SILENCE Disable TF-M secure output if the uart1 node has not assigned GPIO pins using pinctrl. +config TFM_NRF_NS_STORAGE + bool "TF-M non-secure storage partition" + default y + endif # BUILD_WITH_TFM From bac40f69443a66e29d33239a85491ee637460850 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 25 Aug 2023 13:44:29 +0200 Subject: [PATCH 0036/2300] [nrf fromtree] tfm: Harded build against TF-M built with unsecure keys Introduce Kconfig option in zephyr build system that reflects the TF-M cmake config variable with the same default value for dummy provisioning and have it satisfy the IAK present requirement. This configuration is not suitable for production, and by having this in zephyr configuration we can have this as part of the hardened configuration check. Signed-off-by: Joakim Andersson (cherry picked from commit 25787e2df66aef6979503d613c292043ac5f6291) (cherry picked from commit ec48dcb2ee4973bee58fbe610750fe62635a0e3f) Signed-off-by: Dominik Ermel (cherry picked from commit 80251a66e6ddacbd9fc2855f2ae5fd25c0e1a143) --- boards/arm/b_u585i_iot02a/Kconfig.defconfig | 7 +++++++ modules/trusted-firmware-m/CMakeLists.txt | 17 ++++++++++++++++- modules/trusted-firmware-m/Kconfig.tfm | 11 +++++++++++ scripts/kconfig/hardened.csv | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/boards/arm/b_u585i_iot02a/Kconfig.defconfig b/boards/arm/b_u585i_iot02a/Kconfig.defconfig index ae1e57aba8e..e8224106dae 100644 --- a/boards/arm/b_u585i_iot02a/Kconfig.defconfig +++ b/boards/arm/b_u585i_iot02a/Kconfig.defconfig @@ -16,4 +16,11 @@ config SPI_STM32_INTERRUPT config USE_DT_CODE_PARTITION default y if TRUSTED_EXECUTION_NONSECURE +if BUILD_WITH_TFM + +config TFM_DUMMY_PROVISIONING + default n + +endif # BUILD_WITH_TFM + endif # BOARD_B_U585I_IOT02A diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 177a47e28d6..ad1109d849b 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -95,6 +95,12 @@ if (CONFIG_BUILD_WITH_TFM) list(APPEND TFM_CMAKE_ARGS -DMCUBOOT_IMAGE_NUMBER=${CONFIG_TFM_MCUBOOT_IMAGE_NUMBER}) endif() + if (CONFIG_TFM_DUMMY_PROVISIONING) + list(APPEND TFM_CMAKE_ARGS -DTFM_DUMMY_PROVISIONING=ON) + else() + list(APPEND TFM_CMAKE_ARGS -DTFM_DUMMY_PROVISIONING=OFF) + endif() + if (CONFIG_TFM_EXCEPTION_INFO_DUMP) list(APPEND TFM_CMAKE_ARGS -DTFM_EXCEPTION_INFO_DUMP=ON) else() @@ -579,4 +585,13 @@ if (CONFIG_BUILD_WITH_TFM) ${MERGED_FILE} ) endif() -endif() + + if(CONFIG_TFM_DUMMY_PROVISIONING) + message(WARNING + "TFM_DUMMY_PROVISIONING is enabled: + The device will be provisioned using dummy keys and is NOT secure! + This is not suitable for production" + ) + endif() + +endif() # CONFIG_BUILD_WITH_TFM diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index b635347b6e1..fed6ae4f485 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -177,6 +177,17 @@ config TFM_PARTITION_PLATFORM_CUSTOM_REBOOT Instead the application will have to override the weak ARM implementation of sys_arch_reset(). +config TFM_DUMMY_PROVISIONING + bool "Provision with dummy values. NOT to be used in production" + default y + help + If this option is enabled (as it is by default), a set of dummy + keys / data will be provisioned. The dummy IAK matches the IAK tested + by the TF-M tests, and the dummy bl2 ROTPKs match the dummy bl2 keys + used by default. + This option MUST not be used in production hardware, as the keys are + insecure. + config TFM_BL2_NOT_SUPPORTED bool help diff --git a/scripts/kconfig/hardened.csv b/scripts/kconfig/hardened.csv index ee95b54b3a7..6cc978f7e56 100644 --- a/scripts/kconfig/hardened.csv +++ b/scripts/kconfig/hardened.csv @@ -39,6 +39,7 @@ TEST_RANDOM_GENERATOR,n TEST_SHELL,n TEST_USERSPACE,n TFM_CMAKE_BUILD_TYPE_DEBUG,n +TFM_DUMMY_PROVISIONING,n THREAD_MONITOR,n THREAD_NAME,n TIMER_RANDOM_GENERATOR,n From 085d33a7ec044a50afe7da4b1524c0fadb905ae4 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 25 Aug 2023 13:55:49 +0200 Subject: [PATCH 0037/2300] [nrf fromtree] tfm: Enforce initial attestation with required key provisioned Enforce that the initial attestation partition has the required initial attestation key provisioned. If the initial attestation key (IAK) is not present during boot of TF-M the system will panic during initialization. Signed-off-by: Joakim Andersson (cherry picked from commit 2687376effac881c550e2c568c3d4ad10a67385b) (cherry picked from commit 2ac74ca47b0ae06ff19755985e01b07b150f53b5) Signed-off-by: Dominik Ermel (cherry picked from commit cf3cec5e97911a6a1e4b4d1b93b48f2508a46d34) --- boards/arm/b_u585i_iot02a/Kconfig.defconfig | 4 ++++ modules/trusted-firmware-m/Kconfig.tfm | 8 ++++++++ modules/trusted-firmware-m/Kconfig.tfm.partitions | 1 + 3 files changed, 13 insertions(+) diff --git a/boards/arm/b_u585i_iot02a/Kconfig.defconfig b/boards/arm/b_u585i_iot02a/Kconfig.defconfig index e8224106dae..6b3b72554ff 100644 --- a/boards/arm/b_u585i_iot02a/Kconfig.defconfig +++ b/boards/arm/b_u585i_iot02a/Kconfig.defconfig @@ -18,6 +18,10 @@ config USE_DT_CODE_PARTITION if BUILD_WITH_TFM +# Initial Attestation key provisioned by the BL1 bootloader +config TFM_INITIAL_ATTESTATION_KEY + default y + config TFM_DUMMY_PROVISIONING default n diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index fed6ae4f485..a0d71328540 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -179,6 +179,7 @@ config TFM_PARTITION_PLATFORM_CUSTOM_REBOOT config TFM_DUMMY_PROVISIONING bool "Provision with dummy values. NOT to be used in production" + select TFM_INITIAL_ATTESTATION_KEY default y help If this option is enabled (as it is by default), a set of dummy @@ -188,6 +189,13 @@ config TFM_DUMMY_PROVISIONING This option MUST not be used in production hardware, as the keys are insecure. +config TFM_INITIAL_ATTESTATION_KEY + bool + help + Hidden option to mark that the TF-M platform has an initial + attestation key, which is a requirement for the Initial Attestation + partition. + config TFM_BL2_NOT_SUPPORTED bool help diff --git a/modules/trusted-firmware-m/Kconfig.tfm.partitions b/modules/trusted-firmware-m/Kconfig.tfm.partitions index cd9aaadb1ec..67b46f5328b 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.partitions +++ b/modules/trusted-firmware-m/Kconfig.tfm.partitions @@ -44,6 +44,7 @@ config TFM_PARTITION_CRYPTO config TFM_PARTITION_INITIAL_ATTESTATION bool "Secure partition 'Initial Attestation'" depends on TFM_PARTITION_CRYPTO + depends on TFM_INITIAL_ATTESTATION_KEY default n help Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION' From b0c15fbb61e4b5e6a1ef5eecde0bdf3a90827159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 3 Nov 2023 12:08:09 +0100 Subject: [PATCH 0038/2300] [nrf fromtree] drivers: nrf_qspi_nor: Prevent reading status before sending RDPD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After entering the Deep Power-down mode, some flash chips ignore all commands except from the one that releases the chip from the DP mode and it is not possible to successfully read their Status Register then. Since the QSPI peripheral tries to read this register when it is being activated, it consequently fails to send the actual command that would release the flash chip from the DP mode if that is to be done right after QSPI initialization. Prevent this problem by performing the QSPI activation with all pins disconnected. This causes that the Status Register value is read as all zeros and allows the activation to always finish successfully, and the RDPD command to be properly sent. Signed-off-by: Andrzej Głąbek (cherry picked from commit 1727bbcc7046eb5870df7409310d58e0c9483233) (cherry picked from commit 93e398cd1fdd7abb0a6ec347ebaa09f1ff5172ab) Signed-off-by: Dominik Ermel (cherry picked from commit de501648fc3071d44bb0b6169c09ad9ed3d71b19) --- drivers/flash/nrf_qspi_nor.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 28c705f6707..467d0643d48 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -1339,15 +1339,34 @@ static int enter_dpd(const struct device *const dev) static int exit_dpd(const struct device *const dev) { if (IS_ENABLED(DT_INST_PROP(0, has_dpd))) { + nrf_qspi_pins_t pins; + nrf_qspi_pins_t disconnected_pins = { + .sck_pin = NRF_QSPI_PIN_NOT_CONNECTED, + .csn_pin = NRF_QSPI_PIN_NOT_CONNECTED, + .io0_pin = NRF_QSPI_PIN_NOT_CONNECTED, + .io1_pin = NRF_QSPI_PIN_NOT_CONNECTED, + .io2_pin = NRF_QSPI_PIN_NOT_CONNECTED, + .io3_pin = NRF_QSPI_PIN_NOT_CONNECTED, + }; struct qspi_cmd cmd = { .op_code = SPI_NOR_CMD_RDPD, }; uint32_t t_exit_dpd = DT_INST_PROP_OR(0, t_exit_dpd, 0); - int ret; + nrfx_err_t res; + int rc; - ret = qspi_send_cmd(dev, &cmd, false); - if (ret < 0) { - return ret; + nrf_qspi_pins_get(NRF_QSPI, &pins); + nrf_qspi_pins_set(NRF_QSPI, &disconnected_pins); + res = nrfx_qspi_activate(true); + nrf_qspi_pins_set(NRF_QSPI, &pins); + + if (res != NRFX_SUCCESS) { + return -EIO; + } + + rc = qspi_send_cmd(dev, &cmd, false); + if (rc < 0) { + return rc; } if (t_exit_dpd) { From 39e6897979daa7eeab2e977ce03712a06c72a1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 6 Nov 2023 14:31:56 +0100 Subject: [PATCH 0039/2300] [nrf fromtree] drivers: nrf_qspi_nor: Clean up handling of return values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consistently use `res` for results of calls to nrfx functions and `rc` for Zephyr return codes, to avoid mixing up those two and for example calling `qspi_get_zephyr_ret_code()` for a value that is already a Zephyr return code. Correct also such call in `qspi_nor_write()`. Signed-off-by: Andrzej Głąbek (cherry picked from commit 4a4558128848b3cc01a153ab128fb6aa09316a99) (cherry picked from commit 72a0fceed9941275c0c5b666363360a99f293d1e) Signed-off-by: Dominik Ermel (cherry picked from commit 3ae035a26abc2d5fe064e12c18c2496f4f51ff00) --- drivers/flash/nrf_qspi_nor.c | 248 ++++++++++++++++++----------------- 1 file changed, 125 insertions(+), 123 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 467d0643d48..ca4673e8aa2 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -371,7 +371,7 @@ static int qspi_device_init(const struct device *dev) return pm_device_runtime_get(dev); #else nrfx_err_t res; - int ret = 0; + int rc = 0; qspi_lock(dev); @@ -389,13 +389,13 @@ static int qspi_device_init(const struct device *dev) res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); - ret = qspi_get_zephyr_ret_code(res); - qspi_initialized = (ret == 0); + rc = qspi_get_zephyr_ret_code(res); + qspi_initialized = (rc == 0); } qspi_unlock(dev); - return ret; + return rc; #endif } @@ -408,10 +408,10 @@ static void qspi_device_uninit(const struct device *dev) } #ifdef CONFIG_PM_DEVICE_RUNTIME - int ret = pm_device_runtime_put(dev); + int rc = pm_device_runtime_put(dev); - if (ret < 0) { - LOG_ERR("Failed to schedule device sleep: %d", ret); + if (rc < 0) { + LOG_ERR("Failed to schedule device sleep: %d", rc); } #else bool last = true; @@ -526,27 +526,27 @@ static int qspi_rdsr(const struct device *dev, uint8_t sr_num) .op_code = opcode, .rx_buf = &sr_buf, }; - int ret = qspi_send_cmd(dev, &cmd, false); + int rc = qspi_send_cmd(dev, &cmd, false); - return (ret < 0) ? ret : sr; + return (rc < 0) ? rc : sr; } /* Wait until RDSR confirms write is not in progress. */ static int qspi_wait_while_writing(const struct device *dev) { - int ret; + int rc; do { - ret = qspi_rdsr(dev, 1); - } while ((ret >= 0) - && ((ret & SPI_NOR_WIP_BIT) != 0U)); + rc = qspi_rdsr(dev, 1); + } while ((rc >= 0) + && ((rc & SPI_NOR_WIP_BIT) != 0U)); - return (ret < 0) ? ret : 0; + return (rc < 0) ? rc : 0; } static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) { - int ret = 0; + int rc = 0; uint8_t opcode = SPI_NOR_CMD_WRSR; uint8_t length = 1; uint8_t sr_array[2] = {0}; @@ -559,12 +559,12 @@ static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) sr_array[0] = sr_val; #if SR1_WRITE_CLEARS_SR2 /* Writing sr1 clears sr2. need to read/modify/write both. */ - ret = qspi_rdsr(dev, 2); - if (ret < 0) { - LOG_ERR("RDSR for WRSR failed: %d", ret); - return ret; + rc = qspi_rdsr(dev, 2); + if (rc < 0) { + LOG_ERR("RDSR for WRSR failed: %d", rc); + return rc; } - sr_array[1] = ret; + sr_array[1] = rc; length = 2; #endif } else { /* sr_num == 2 */ @@ -574,12 +574,12 @@ static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) * Uses standard WRSR opcode */ sr_array[1] = sr_val; - ret = qspi_rdsr(dev, 1); - if (ret < 0) { - LOG_ERR("RDSR for WRSR failed: %d", ret); - return ret; + rc = qspi_rdsr(dev, 1); + if (rc < 0) { + LOG_ERR("RDSR for WRSR failed: %d", rc); + return rc; } - sr_array[0] = ret; + sr_array[0] = rc; length = 2; #elif IS_EQUAL(INST_0_QER, JESD216_DW15_QER_VAL_S2B1v6) /* Writing sr2 uses a dedicated WRSR2 command */ @@ -600,17 +600,17 @@ static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) .tx_buf = &sr_buf, }; - ret = qspi_send_cmd(dev, &cmd, true); + rc = qspi_send_cmd(dev, &cmd, true); /* Writing SR can take some time, and further * commands sent while it's happening can be * corrupted. Wait. */ - if (ret == 0) { - ret = qspi_wait_while_writing(dev); + if (rc == 0) { + rc = qspi_wait_while_writing(dev); } - return ret; + return rc; } #endif /* !IS_EQUAL(INST_0_QER, JESD216_DW15_QER_VAL_NONE) */ @@ -627,16 +627,16 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) return -EINVAL; } - int rv = 0; const struct qspi_nor_config *params = dev->config; + int rc, rc2; - rv = qspi_device_init(dev); - if (rv != 0) { + rc = qspi_device_init(dev); + if (rc != 0) { goto out; } qspi_trans_lock(dev); - rv = qspi_nor_write_protection_set(dev, false); - if (rv != 0) { + rc = qspi_nor_write_protection_set(dev, false); + if (rc != 0) { goto out_trans_unlock; } qspi_lock(dev); @@ -670,16 +670,16 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) size -= adj; } else { LOG_ERR("erase error at 0x%lx size %zu", (long)addr, size); - rv = qspi_get_zephyr_ret_code(res); + rc = qspi_get_zephyr_ret_code(res); break; } } qspi_unlock(dev); - int rv2 = qspi_nor_write_protection_set(dev, true); + rc2 = qspi_nor_write_protection_set(dev, true); - if (!rv) { - rv = rv2; + if (!rc) { + rc = rc2; } out_trans_unlock: @@ -687,7 +687,7 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) out: qspi_device_uninit(dev); - return rv; + return rc; } /* Configures QSPI memory for the transfer */ @@ -695,6 +695,8 @@ static int qspi_nrfx_configure(const struct device *dev) { struct qspi_nor_data *dev_data = dev->data; const struct qspi_nor_config *dev_config = dev->config; + nrfx_err_t res; + int rc; #if defined(CONFIG_SOC_SERIES_NRF53X) /* When the QSPI peripheral is activated, during the nrfx_qspi driver @@ -705,18 +707,16 @@ static int qspi_nrfx_configure(const struct device *dev) nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); #endif - nrfx_err_t res = nrfx_qspi_init(&dev_config->nrfx_cfg, - qspi_handler, - dev_data); + res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); #if defined(CONFIG_SOC_SERIES_NRF53X) /* Restore the default /4 divider after the QSPI initialization. */ nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); #endif - int ret = qspi_get_zephyr_ret_code(res); - if (ret < 0) { - return ret; + rc = qspi_get_zephyr_ret_code(res); + if (rc < 0) { + return rc; } #if DT_INST_NODE_HAS_PROP(0, rx_delay) @@ -736,9 +736,9 @@ static int qspi_nrfx_configure(const struct device *dev) * bootloader) might have set DPD mode before reboot. As a result, * attempt to exit DPD mode regardless of whether CONFIG_PM_DEVICE is set. */ - ret = exit_dpd(dev); - if (ret < 0) { - return ret; + rc = exit_dpd(dev); + if (rc < 0) { + return rc; } /* Set QE to match transfer mode. If not using quad @@ -769,28 +769,28 @@ static int qspi_nrfx_configure(const struct device *dev) return -EINVAL; #endif - ret = qspi_rdsr(dev, sr_num); - if (ret < 0) { - LOG_ERR("RDSR failed: %d", ret); - return ret; + rc = qspi_rdsr(dev, sr_num); + if (rc < 0) { + LOG_ERR("RDSR failed: %d", rc); + return rc; } - uint8_t sr = (uint8_t)ret; + uint8_t sr = (uint8_t)rc; bool qe_state = ((sr & qe_mask) != 0U); LOG_DBG("RDSR %02x QE %d need %d: %s", sr, qe_state, qe_value, (qe_state != qe_value) ? "updating" : "no-change"); - ret = 0; + rc = 0; if (qe_state != qe_value) { sr ^= qe_mask; - ret = qspi_wrsr(dev, sr, sr_num); + rc = qspi_wrsr(dev, sr, sr_num); } - if (ret < 0) { + if (rc < 0) { LOG_ERR("QE %s failed: %d", qe_value ? "set" : "clear", - ret); - return ret; + rc); + return rc; } #endif @@ -802,16 +802,16 @@ static int qspi_nrfx_configure(const struct device *dev) /* Call will send write enable before instruction if that * requirement is encoded in INST_0_4BA. */ - ret = qspi_send_cmd(dev, &cmd, (INST_0_4BA & 0x02)); + rc = qspi_send_cmd(dev, &cmd, (INST_0_4BA & 0x02)); - if (ret < 0) { - LOG_ERR("E4BA cmd issue failed: %d.", ret); + if (rc < 0) { + LOG_ERR("E4BA cmd issue failed: %d.", rc); } else { LOG_DBG("E4BA cmd issued."); } } - return ret; + return rc; } static int qspi_read_jedec_id(const struct device *dev, @@ -826,14 +826,14 @@ static int qspi_read_jedec_id(const struct device *dev, .rx_buf = &rx_buf, }; - int ret = qspi_device_init(dev); + int rc = qspi_device_init(dev); - if (ret == 0) { - ret = qspi_send_cmd(dev, &cmd, false); + if (rc == 0) { + rc = qspi_send_cmd(dev, &cmd, false); } qspi_device_uninit(dev); - return ret; + return rc; } #if defined(CONFIG_FLASH_JESD216_API) @@ -856,13 +856,13 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, .io3_level = true, }; - int ret = qspi_device_init(dev); + int rc = qspi_device_init(dev); nrfx_err_t res = NRFX_SUCCESS; - if (ret != 0) { - LOG_DBG("qspi_device_init: %d", ret); + if (rc != 0) { + LOG_DBG("qspi_device_init: %d", rc); qspi_device_uninit(dev); - return ret; + return rc; } qspi_lock(dev); @@ -901,9 +901,9 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, static inline int qspi_nor_read_id(const struct device *dev) { uint8_t id[SPI_NOR_MAX_ID_LEN]; - int ret = qspi_read_jedec_id(dev, id); + int rc = qspi_read_jedec_id(dev, id); - if (ret != 0) { + if (rc != 0) { return -EIO; } @@ -1109,6 +1109,7 @@ static int qspi_nor_write(const struct device *dev, off_t addr, } const struct qspi_nor_config *params = dev->config; + int rc, rc2; /* affected region should be within device */ if (addr < 0 || @@ -1119,18 +1120,18 @@ static int qspi_nor_write(const struct device *dev, off_t addr, return -EINVAL; } - nrfx_err_t res = NRFX_SUCCESS; - - int rc = qspi_device_init(dev); + rc = qspi_device_init(dev); if (rc != 0) { goto out; } qspi_trans_lock(dev); - res = qspi_nor_write_protection_set(dev, false); + rc = qspi_nor_write_protection_set(dev, false); qspi_lock(dev); - if (!res) { + if (rc == 0) { + nrfx_err_t res; + if (size < 4U) { res = write_sub_word(dev, addr, src, size); } else if (!nrfx_is_in_ram(src) || @@ -1140,17 +1141,18 @@ static int qspi_nor_write(const struct device *dev, off_t addr, res = nrfx_qspi_write(src, size, addr); qspi_wait_for_completion(dev, res); } + + rc = qspi_get_zephyr_ret_code(res); } qspi_unlock(dev); - int res2 = qspi_nor_write_protection_set(dev, true); + rc2 = qspi_nor_write_protection_set(dev, true); qspi_trans_unlock(dev); - if (!res) { - res = res2; + if (rc == 0) { + rc = rc2; } - rc = qspi_get_zephyr_ret_code(res); out: qspi_device_uninit(dev); return rc; @@ -1169,24 +1171,24 @@ static int qspi_nor_erase(const struct device *dev, off_t addr, size_t size) return -EINVAL; } - int ret = qspi_erase(dev, addr, size); + int rc = qspi_erase(dev, addr, size); - return ret; + return rc; } static int qspi_nor_write_protection_set(const struct device *dev, bool write_protect) { - int ret = 0; + int rc = 0; struct qspi_cmd cmd = { .op_code = ((write_protect) ? SPI_NOR_CMD_WRDI : SPI_NOR_CMD_WREN), }; if (qspi_send_cmd(dev, &cmd, false) != 0) { - ret = -EIO; + rc = -EIO; } - return ret; + return rc; } /** @@ -1198,16 +1200,16 @@ static int qspi_nor_write_protection_set(const struct device *dev, */ static int qspi_nor_configure(const struct device *dev) { - int ret = qspi_nrfx_configure(dev); + int rc = qspi_nrfx_configure(dev); - if (ret != 0) { - return ret; + if (rc != 0) { + return rc; } #ifdef CONFIG_PM_DEVICE_RUNTIME - ret = pm_device_runtime_enable(dev); - if (ret < 0) { - LOG_ERR("Failed to enable runtime power management: %d", ret); + rc = pm_device_runtime_enable(dev); + if (rc < 0) { + LOG_ERR("Failed to enable runtime power management: %d", rc); } else { LOG_DBG("Runtime power management enabled"); } @@ -1231,12 +1233,12 @@ static int qspi_nor_configure(const struct device *dev) */ static int qspi_nor_init(const struct device *dev) { - int rc; const struct qspi_nor_config *dev_config = dev->config; - int ret = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); + int rc; - if (ret < 0) { - return ret; + rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); + if (rc < 0) { + return rc; } IRQ_CONNECT(DT_IRQN(QSPI_NODE), DT_IRQ(QSPI_NODE, priority), @@ -1317,11 +1319,11 @@ static int enter_dpd(const struct device *const dev) .op_code = SPI_NOR_CMD_DPD, }; uint32_t t_enter_dpd = DT_INST_PROP_OR(0, t_enter_dpd, 0); - int ret; + int rc; - ret = qspi_send_cmd(dev, &cmd, false); - if (ret < 0) { - return ret; + rc = qspi_send_cmd(dev, &cmd, false); + if (rc < 0) { + return rc; } if (t_enter_dpd) { @@ -1386,8 +1388,8 @@ static int qspi_nor_pm_action(const struct device *dev, { struct qspi_nor_data *dev_data = dev->data; const struct qspi_nor_config *dev_config = dev->config; - int ret; - nrfx_err_t err; + int rc; + nrfx_err_t res; if (pm_device_is_busy(dev)) { return -EBUSY; @@ -1397,9 +1399,9 @@ static int qspi_nor_pm_action(const struct device *dev, case PM_DEVICE_ACTION_SUSPEND: #ifndef CONFIG_PM_DEVICE_RUNTIME /* If PM_DEVICE_RUNTIME, we don't uninit after RESUME */ - ret = qspi_device_init(dev); - if (ret < 0) { - return ret; + rc = qspi_device_init(dev); + if (rc < 0) { + return rc; } #endif @@ -1411,35 +1413,35 @@ static int qspi_nor_pm_action(const struct device *dev, return -EBUSY; } - ret = enter_dpd(dev); - if (ret < 0) { - return ret; + rc = enter_dpd(dev); + if (rc < 0) { + return rc; } nrfx_qspi_uninit(); - ret = pinctrl_apply_state(dev_config->pcfg, + rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); - if (ret < 0) { - return ret; + if (rc < 0) { + return rc; } break; case PM_DEVICE_ACTION_RESUME: - ret = pinctrl_apply_state(dev_config->pcfg, + rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); - if (ret < 0) { - return ret; + if (rc < 0) { + return rc; } - err = nrfx_qspi_init(&dev_config->nrfx_cfg, + res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); - if (err != NRFX_SUCCESS) { + if (res != NRFX_SUCCESS) { return -EIO; } - ret = exit_dpd(dev); - if (ret < 0) { - return ret; + rc = exit_dpd(dev); + if (rc < 0) { + return rc; } #ifndef CONFIG_PM_DEVICE_RUNTIME @@ -1459,16 +1461,16 @@ static int qspi_nor_pm_action(const struct device *dev, void z_impl_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable) { struct qspi_nor_data *dev_data = dev->data; - int ret; + int rc; if (dev_data->xip_enabled == enable) { return; } - ret = qspi_device_init(dev); + rc = qspi_device_init(dev); - if (ret != 0) { - LOG_ERR("NRF QSPI NOR XIP %s failed with %d\n", enable ? "enable" : "disable", ret); + if (rc != 0) { + LOG_ERR("NRF QSPI NOR XIP %s failed with %d\n", enable ? "enable" : "disable", rc); return; } From 90958c687bfd6723e8b902ae6e11263ecc00c3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 6 Nov 2023 14:10:19 +0100 Subject: [PATCH 0040/2300] [nrf fromtree] drivers: nrf_qspi_nor: Refactor deactivation and locking access to QSPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After integration of nrfx 3.2.0, it is no longer needed to deinitialize the nrfx_qspi driver to avoid increased power consumption when the QSPI peripheral is idle. Now it is enough to call `nrfx_qspi_dectivate()` when a given operation is done. The driver will automatically activate the QSPI peripheral again when a next operation is requested. This commit applies the following changes: - `qspi_device_init` and `qspi_device_uninit` functions are replaced by `qspi_acquire` and `qspi_release`, respectively; those handle exclusive access to the QSPI peripheral and deactivation of it or runtime device power management - locking is removed from `qspi_send_cmd` as it is the resposibility of the caller of that function - `trans_lock` and `trans_unlock` functions are removed together with the related semaphore as they are no longer needed - checking of input parameters is moved from `qspi_erase` to its caller, `qspi_nor_erase` - `qspi_nor_pm_action` is refactored to properly handle locking of the QSPI peripheral; checking of the `xip_enabled` flag is removed from that function as now the call to `pm_device_is_busy()` covers that (when XIP is enabled, the device is kept indicated as busy) Signed-off-by: Andrzej Głąbek (cherry picked from commit 8c3df0aa9e9a8e7fe864b07ece840610009b3069) (cherry picked from commit 9a0aca0df38a10f19296c26fe6df9bc5b5b52c29) Signed-off-by: Dominik Ermel (cherry picked from commit 24e7218a2b0831b0f2d162d858d2556ff661d012) --- drivers/flash/nrf_qspi_nor.c | 507 +++++++++++++---------------------- 1 file changed, 193 insertions(+), 314 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index ca4673e8aa2..aa6449763be 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -26,15 +26,15 @@ LOG_MODULE_REGISTER(qspi_nor, CONFIG_FLASH_LOG_LEVEL); #include struct qspi_nor_data { +#if !defined(CONFIG_PM_DEVICE_RUNTIME) && defined(CONFIG_MULTITHREADING) + /* A semaphore to control QSPI deactivation. */ + struct k_sem count; +#endif #ifdef CONFIG_MULTITHREADING - /* The semaphore to control exclusive access on write/erase. */ - struct k_sem trans; /* The semaphore to control exclusive access to the device. */ struct k_sem sem; /* The semaphore to indicate that transfer has completed. */ struct k_sem sync; - /* The semaphore to control driver init/uninit. */ - struct k_sem count; #else /* CONFIG_MULTITHREADING */ /* A flag that signals completed transfer when threads are * not enabled. @@ -173,12 +173,6 @@ BUILD_ASSERT(DT_INST_PROP(0, address_size_32), "After entering 4 byte addressing mode, 4 byte addressing is expected"); #endif -#ifndef CONFIG_PM_DEVICE_RUNTIME -static bool qspi_initialized; -#endif - -static int qspi_device_init(const struct device *dev); -static void qspi_device_uninit(const struct device *dev); void z_impl_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable); void z_vrfy_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable); @@ -245,72 +239,99 @@ static inline int qspi_get_zephyr_ret_code(nrfx_err_t res) static inline void qspi_lock(const struct device *dev) { +#ifdef CONFIG_MULTITHREADING struct qspi_nor_data *dev_data = dev->data; - pm_device_busy_set(dev); - -#ifdef CONFIG_MULTITHREADING k_sem_take(&dev_data->sem, K_FOREVER); -#else /* CONFIG_MULTITHREADING */ - ARG_UNUSED(dev_data); -#endif /* CONFIG_MULTITHREADING */ - - /* - * Change the base clock divider only for the time the driver is locked - * to perform a QSPI operation, otherwise the power consumption would be - * increased also when the QSPI peripheral is idle. - * When XIP is enabled, there is nothing to do here as the changed - * divider is kept all the time. - */ -#if defined(CONFIG_SOC_SERIES_NRF53X) - if (!dev_data->xip_enabled) { - nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); - } #endif } static inline void qspi_unlock(const struct device *dev) { +#ifdef CONFIG_MULTITHREADING struct qspi_nor_data *dev_data = dev->data; -#if defined(CONFIG_SOC_SERIES_NRF53X) - /* Restore the default base clock divider to reduce power consumption. - * Unless XIP is enabled, then the changed divider needs to be kept. - */ - if (!dev_data->xip_enabled) { - nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); - } + k_sem_give(&dev_data->sem); #endif +} -#ifdef CONFIG_MULTITHREADING - k_sem_give(&dev_data->sem); -#else - ARG_UNUSED(dev_data); +static inline void qspi_clock_div_change(void) +{ +#ifdef CONFIG_SOC_SERIES_NRF53X + /* Make sure the base clock divider is changed accordingly + * before a QSPI transfer is performed. + */ + nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); #endif +} - pm_device_busy_clear(dev); +static inline void qspi_clock_div_restore(void) +{ +#ifdef CONFIG_SOC_SERIES_NRF53X + /* Restore the default base clock divider to reduce power + * consumption when the QSPI peripheral is idle. + */ + nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); +#endif } -static inline void qspi_trans_lock(const struct device *dev) +static void qspi_acquire(const struct device *dev) { -#ifdef CONFIG_MULTITHREADING struct qspi_nor_data *dev_data = dev->data; - k_sem_take(&dev_data->trans, K_FOREVER); -#else /* CONFIG_MULTITHREADING */ - ARG_UNUSED(dev); -#endif /* CONFIG_MULTITHREADING */ +#if defined(CONFIG_PM_DEVICE_RUNTIME) + int rc = pm_device_runtime_get(dev); + + if (rc < 0) { + LOG_ERR("pm_device_runtime_get failed: %d", rc); + } +#elif defined(CONFIG_MULTITHREADING) + /* In multithreading, the driver can call qspi_acquire more than once + * before calling qspi_release. Keeping count, so QSPI is deactivated + * only at the last call (count == 0). + */ + k_sem_give(&dev_data->count); +#endif + + qspi_lock(dev); + + if (!dev_data->xip_enabled) { + qspi_clock_div_change(); + + pm_device_busy_set(dev); + } } -static inline void qspi_trans_unlock(const struct device *dev) +static void qspi_release(const struct device *dev) { -#ifdef CONFIG_MULTITHREADING struct qspi_nor_data *dev_data = dev->data; + bool deactivate = true; - k_sem_give(&dev_data->trans); -#else /* CONFIG_MULTITHREADING */ - ARG_UNUSED(dev); -#endif /* CONFIG_MULTITHREADING */ +#if !defined(CONFIG_PM_DEVICE_RUNTIME) && defined(CONFIG_MULTITHREADING) + /* The last thread to finish using the driver deactivates the QSPI */ + (void) k_sem_take(&dev_data->count, K_NO_WAIT); + deactivate = (k_sem_count_get(&dev_data->count) == 0); +#endif + + if (!dev_data->xip_enabled) { + qspi_clock_div_restore(); + + if (deactivate && !IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + (void) nrfx_qspi_deactivate(); + } + + pm_device_busy_clear(dev); + } + + qspi_unlock(dev); + +#if defined(CONFIG_PM_DEVICE_RUNTIME) + int rc = pm_device_runtime_put(dev); + + if (rc < 0) { + LOG_ERR("pm_device_runtime_put failed: %d", rc); + } +#endif } static inline void qspi_wait_for_completion(const struct device *dev, @@ -359,89 +380,6 @@ static void qspi_handler(nrfx_qspi_evt_t event, void *p_context) } } -static int qspi_device_init(const struct device *dev) -{ - struct qspi_nor_data *dev_data = dev->data; - - if (dev_data->xip_enabled) { - return 0; - } - -#ifdef CONFIG_PM_DEVICE_RUNTIME - return pm_device_runtime_get(dev); -#else - nrfx_err_t res; - int rc = 0; - - qspi_lock(dev); - - /* In multithreading, driver can call qspi_device_init more than once - * before calling qspi_device_uninit. Keepping count, so QSPI is - * uninitialized only at the last call (count == 0). - */ -#ifdef CONFIG_MULTITHREADING - k_sem_give(&dev_data->count); -#endif - - if (!qspi_initialized) { - const struct qspi_nor_config *dev_config = dev->config; - - res = nrfx_qspi_init(&dev_config->nrfx_cfg, - qspi_handler, - dev_data); - rc = qspi_get_zephyr_ret_code(res); - qspi_initialized = (rc == 0); - } - - qspi_unlock(dev); - - return rc; -#endif -} - -static void qspi_device_uninit(const struct device *dev) -{ - struct qspi_nor_data *dev_data = dev->data; - - if (dev_data->xip_enabled) { - return; - } - -#ifdef CONFIG_PM_DEVICE_RUNTIME - int rc = pm_device_runtime_put(dev); - - if (rc < 0) { - LOG_ERR("Failed to schedule device sleep: %d", rc); - } -#else - bool last = true; - - qspi_lock(dev); - -#ifdef CONFIG_MULTITHREADING - /* The last thread to finish using the driver uninit the QSPI */ - (void) k_sem_take(&dev_data->count, K_NO_WAIT); - last = (k_sem_count_get(&dev_data->count) == 0); -#endif - - if (last) { - while (nrfx_qspi_mem_busy_check() != NRFX_SUCCESS) { - if (IS_ENABLED(CONFIG_MULTITHREADING)) { - k_msleep(50); - } else { - k_busy_wait(50000); - } - } - - nrfx_qspi_uninit(); - - qspi_initialized = false; - } - - qspi_unlock(dev); -#endif -} - /* QSPI send custom command. * * If this is used for both send and receive the buffer sizes must be @@ -497,11 +435,8 @@ static int qspi_send_cmd(const struct device *dev, const struct qspi_cmd *cmd, .wren = wren, }; - qspi_lock(dev); - int res = nrfx_qspi_cinstr_xfer(&cinstr_cfg, tx_buf, rx_buf); - qspi_unlock(dev); return qspi_get_zephyr_ret_code(res); } @@ -617,29 +552,13 @@ static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) /* QSPI erase */ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) { - /* address must be sector-aligned */ - if ((addr % QSPI_SECTOR_SIZE) != 0) { - return -EINVAL; - } - - /* size must be a non-zero multiple of sectors */ - if ((size == 0) || (size % QSPI_SECTOR_SIZE) != 0) { - return -EINVAL; - } - const struct qspi_nor_config *params = dev->config; int rc, rc2; - rc = qspi_device_init(dev); - if (rc != 0) { - goto out; - } - qspi_trans_lock(dev); rc = qspi_nor_write_protection_set(dev, false); if (rc != 0) { - goto out_trans_unlock; + return rc; } - qspi_lock(dev); while (size > 0) { nrfx_err_t res = !NRFX_SUCCESS; uint32_t adj = 0; @@ -674,20 +593,10 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) break; } } - qspi_unlock(dev); rc2 = qspi_nor_write_protection_set(dev, true); - if (!rc) { - rc = rc2; - } - -out_trans_unlock: - qspi_trans_unlock(dev); - -out: - qspi_device_uninit(dev); - return rc; + return rc != 0 ? rc : rc2; } /* Configures QSPI memory for the transfer */ @@ -698,22 +607,7 @@ static int qspi_nrfx_configure(const struct device *dev) nrfx_err_t res; int rc; -#if defined(CONFIG_SOC_SERIES_NRF53X) - /* When the QSPI peripheral is activated, during the nrfx_qspi driver - * initialization, it reads the status of the connected flash chip. - * Make sure this transaction is performed with a valid base clock - * divider. - */ - nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); -#endif - res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); - -#if defined(CONFIG_SOC_SERIES_NRF53X) - /* Restore the default /4 divider after the QSPI initialization. */ - nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); -#endif - rc = qspi_get_zephyr_ret_code(res); if (rc < 0) { return rc; @@ -814,8 +708,7 @@ static int qspi_nrfx_configure(const struct device *dev) return rc; } -static int qspi_read_jedec_id(const struct device *dev, - uint8_t *id) +static int qspi_rdid(const struct device *dev, uint8_t *id) { const struct qspi_buf rx_buf = { .buf = id, @@ -826,18 +719,24 @@ static int qspi_read_jedec_id(const struct device *dev, .rx_buf = &rx_buf, }; - int rc = qspi_device_init(dev); + return qspi_send_cmd(dev, &cmd, false); +} - if (rc == 0) { - rc = qspi_send_cmd(dev, &cmd, false); - } - qspi_device_uninit(dev); +#if defined(CONFIG_FLASH_JESD216_API) + +static int qspi_read_jedec_id(const struct device *dev, uint8_t *id) +{ + int rc; + + qspi_acquire(dev); + + rc = qspi_rdid(dev, id); + + qspi_release(dev); return rc; } -#if defined(CONFIG_FLASH_JESD216_API) - static int qspi_sfdp_read(const struct device *dev, off_t offset, void *data, size_t len) { @@ -855,17 +754,10 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, .io2_level = true, .io3_level = true, }; + nrfx_err_t res; - int rc = qspi_device_init(dev); - nrfx_err_t res = NRFX_SUCCESS; - - if (rc != 0) { - LOG_DBG("qspi_device_init: %d", rc); - qspi_device_uninit(dev); - return rc; - } + qspi_acquire(dev); - qspi_lock(dev); res = nrfx_qspi_lfm_start(&cinstr_cfg); if (res != NRFX_SUCCESS) { LOG_DBG("lfm_start: %x", res); @@ -885,8 +777,8 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, } out: - qspi_unlock(dev); - qspi_device_uninit(dev); + qspi_release(dev); + return qspi_get_zephyr_ret_code(res); } @@ -901,7 +793,7 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, static inline int qspi_nor_read_id(const struct device *dev) { uint8_t id[SPI_NOR_MAX_ID_LEN]; - int rc = qspi_read_jedec_id(dev, id); + int rc = qspi_rdid(dev, id); if (rc != 0) { return -EIO; @@ -993,6 +885,9 @@ static inline nrfx_err_t read_non_aligned(const struct device *dev, static int qspi_nor_read(const struct device *dev, off_t addr, void *dest, size_t size) { + const struct qspi_nor_config *params = dev->config; + nrfx_err_t res; + if (!dest) { return -EINVAL; } @@ -1002,8 +897,6 @@ static int qspi_nor_read(const struct device *dev, off_t addr, void *dest, return 0; } - const struct qspi_nor_config *params = dev->config; - /* affected region should be within device */ if (addr < 0 || (addr + size) > params->size) { @@ -1013,23 +906,13 @@ static int qspi_nor_read(const struct device *dev, off_t addr, void *dest, return -EINVAL; } - int rc = qspi_device_init(dev); - - if (rc != 0) { - goto out; - } - - qspi_lock(dev); - - nrfx_err_t res = read_non_aligned(dev, addr, dest, size); + qspi_acquire(dev); - qspi_unlock(dev); + res = read_non_aligned(dev, addr, dest, size); - rc = qspi_get_zephyr_ret_code(res); + qspi_release(dev); -out: - qspi_device_uninit(dev); - return rc; + return qspi_get_zephyr_ret_code(res); } /* addr aligned, sptr not null, slen less than 4 */ @@ -1094,6 +977,9 @@ static int qspi_nor_write(const struct device *dev, off_t addr, const void *src, size_t size) { + const struct qspi_nor_config *params = dev->config; + int rc, rc2; + if (!src) { return -EINVAL; } @@ -1108,9 +994,6 @@ static int qspi_nor_write(const struct device *dev, off_t addr, return -EINVAL; } - const struct qspi_nor_config *params = dev->config; - int rc, rc2; - /* affected region should be within device */ if (addr < 0 || (addr + size) > params->size) { @@ -1120,15 +1003,9 @@ static int qspi_nor_write(const struct device *dev, off_t addr, return -EINVAL; } + qspi_acquire(dev); - rc = qspi_device_init(dev); - if (rc != 0) { - goto out; - } - - qspi_trans_lock(dev); rc = qspi_nor_write_protection_set(dev, false); - qspi_lock(dev); if (rc == 0) { nrfx_err_t res; @@ -1144,23 +1021,28 @@ static int qspi_nor_write(const struct device *dev, off_t addr, rc = qspi_get_zephyr_ret_code(res); } - qspi_unlock(dev); rc2 = qspi_nor_write_protection_set(dev, true); - qspi_trans_unlock(dev); - if (rc == 0) { - rc = rc2; - } + qspi_release(dev); -out: - qspi_device_uninit(dev); - return rc; + return rc != 0 ? rc : rc2; } static int qspi_nor_erase(const struct device *dev, off_t addr, size_t size) { const struct qspi_nor_config *params = dev->config; + int rc; + + /* address must be sector-aligned */ + if ((addr % QSPI_SECTOR_SIZE) != 0) { + return -EINVAL; + } + + /* size must be a non-zero multiple of sectors */ + if ((size == 0) || (size % QSPI_SECTOR_SIZE) != 0) { + return -EINVAL; + } /* affected region should be within device */ if (addr < 0 || @@ -1171,7 +1053,11 @@ static int qspi_nor_erase(const struct device *dev, off_t addr, size_t size) return -EINVAL; } - int rc = qspi_erase(dev, addr, size); + qspi_acquire(dev); + + rc = qspi_erase(dev, addr, size); + + qspi_release(dev); return rc; } @@ -1206,17 +1092,6 @@ static int qspi_nor_configure(const struct device *dev) return rc; } -#ifdef CONFIG_PM_DEVICE_RUNTIME - rc = pm_device_runtime_enable(dev); - if (rc < 0) { - LOG_ERR("Failed to enable runtime power management: %d", rc); - } else { - LOG_DBG("Runtime power management enabled"); - } -#else - qspi_device_uninit(dev); -#endif - /* now the spi bus is configured, we can verify the flash id */ if (qspi_nor_read_id(dev) != 0) { return -ENODEV; @@ -1244,10 +1119,24 @@ static int qspi_nor_init(const struct device *dev) IRQ_CONNECT(DT_IRQN(QSPI_NODE), DT_IRQ(QSPI_NODE, priority), nrfx_isr, nrfx_qspi_irq_handler, 0); + qspi_clock_div_change(); + rc = qspi_nor_configure(dev); + qspi_clock_div_restore(); + +#ifdef CONFIG_PM_DEVICE_RUNTIME + int rc2 = pm_device_runtime_enable(dev); + + if (rc2 < 0) { + LOG_ERR("Failed to enable runtime power management: %d", rc2); + } else { + LOG_DBG("Runtime power management enabled"); + } +#endif + #ifdef CONFIG_NORDIC_QSPI_NOR_XIP - if (!rc) { + if (rc == 0) { /* Enable XIP mode for QSPI NOR flash, this will prevent the * flash from being powered down */ @@ -1383,108 +1272,97 @@ static int exit_dpd(const struct device *const dev) } #ifdef CONFIG_PM_DEVICE -static int qspi_nor_pm_action(const struct device *dev, - enum pm_device_action action) +static int qspi_suspend(const struct device *dev) { - struct qspi_nor_data *dev_data = dev->data; const struct qspi_nor_config *dev_config = dev->config; - int rc; nrfx_err_t res; + int rc; - if (pm_device_is_busy(dev)) { + res = nrfx_qspi_mem_busy_check(); + if (res != NRFX_SUCCESS) { return -EBUSY; } - switch (action) { - case PM_DEVICE_ACTION_SUSPEND: -#ifndef CONFIG_PM_DEVICE_RUNTIME - /* If PM_DEVICE_RUNTIME, we don't uninit after RESUME */ - rc = qspi_device_init(dev); - if (rc < 0) { - return rc; - } -#endif + rc = enter_dpd(dev); + if (rc < 0) { + return rc; + } - if (dev_data->xip_enabled) { - return -EBUSY; - } + nrfx_qspi_uninit(); - if (nrfx_qspi_mem_busy_check() != NRFX_SUCCESS) { - return -EBUSY; - } + return pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); +} - rc = enter_dpd(dev); - if (rc < 0) { - return rc; - } +static int qspi_resume(const struct device *dev) +{ + const struct qspi_nor_config *dev_config = dev->config; + nrfx_err_t res; + int rc; - nrfx_qspi_uninit(); - rc = pinctrl_apply_state(dev_config->pcfg, - PINCTRL_STATE_SLEEP); - if (rc < 0) { - return rc; - } - break; + rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); + if (rc < 0) { + return rc; + } - case PM_DEVICE_ACTION_RESUME: - rc = pinctrl_apply_state(dev_config->pcfg, - PINCTRL_STATE_DEFAULT); - if (rc < 0) { - return rc; - } - res = nrfx_qspi_init(&dev_config->nrfx_cfg, - qspi_handler, - dev_data); - if (res != NRFX_SUCCESS) { - return -EIO; - } + res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev->data); + if (res != NRFX_SUCCESS) { + return -EIO; + } - rc = exit_dpd(dev); - if (rc < 0) { - return rc; - } + return exit_dpd(dev); +} -#ifndef CONFIG_PM_DEVICE_RUNTIME - /* If PM_DEVICE_RUNTIME, we're immediately going to use the device */ - qspi_device_uninit(dev); -#endif +static int qspi_nor_pm_action(const struct device *dev, + enum pm_device_action action) +{ + int rc; + + if (pm_device_is_busy(dev)) { + return -EBUSY; + } + + qspi_lock(dev); + qspi_clock_div_change(); + + switch (action) { + case PM_DEVICE_ACTION_SUSPEND: + rc = qspi_suspend(dev); + break; + + case PM_DEVICE_ACTION_RESUME: + rc = qspi_resume(dev); break; default: - return -ENOTSUP; + rc = -ENOTSUP; } - return 0; + qspi_clock_div_restore(); + qspi_unlock(dev); + + return rc; } #endif /* CONFIG_PM_DEVICE */ void z_impl_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable) { struct qspi_nor_data *dev_data = dev->data; - int rc; if (dev_data->xip_enabled == enable) { return; } - rc = qspi_device_init(dev); - - if (rc != 0) { - LOG_ERR("NRF QSPI NOR XIP %s failed with %d\n", enable ? "enable" : "disable", rc); - return; - } + qspi_acquire(dev); #if NRF_QSPI_HAS_XIPEN nrf_qspi_xip_set(NRF_QSPI, enable); #endif - qspi_lock(dev); if (enable) { (void)nrfx_qspi_activate(false); } dev_data->xip_enabled = enable; - qspi_unlock(dev); - qspi_device_uninit(dev); + qspi_release(dev); } #ifdef CONFIG_USERSPACE @@ -1502,11 +1380,12 @@ void z_vrfy_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable) #endif /* CONFIG_USERSPACE */ static struct qspi_nor_data qspi_nor_dev_data = { +#if !defined(CONFIG_PM_DEVICE_RUNTIME) && defined(CONFIG_MULTITHREADING) + .count = Z_SEM_INITIALIZER(qspi_nor_dev_data.count, 0, K_SEM_MAX_LIMIT), +#endif #ifdef CONFIG_MULTITHREADING - .trans = Z_SEM_INITIALIZER(qspi_nor_dev_data.trans, 1, 1), .sem = Z_SEM_INITIALIZER(qspi_nor_dev_data.sem, 1, 1), .sync = Z_SEM_INITIALIZER(qspi_nor_dev_data.sync, 0, 1), - .count = Z_SEM_INITIALIZER(qspi_nor_dev_data.count, 0, K_SEM_MAX_LIMIT), #endif /* CONFIG_MULTITHREADING */ }; From eeeb0aa138b32372ec79c1e3d7bf72bd497ff231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 10 Nov 2023 16:52:12 +0100 Subject: [PATCH 0041/2300] [nrf fromtree] drivers: nrf_qspi_nor: Fix and refactor driver initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far the driver first changed the configuration of the flash chip and after that checked the signature of that chip. This could lead to improper change of the chip configuration if the actually found one was different than that specified in devicetree. This commit reverses the order of these two initialization steps and also restructures a bit the initialization code. Signed-off-by: Andrzej Głąbek (cherry picked from commit ea1be7f242b9348863a27adb17215014f15b318a) (cherry picked from commit 86146714949810fd451dace302bd42ea4ecb3927) Signed-off-by: Dominik Ermel (cherry picked from commit 05688141d94c0cb28ab1cb48a653d733a4133001) --- drivers/flash/nrf_qspi_nor.c | 125 +++++++++++++---------------------- 1 file changed, 45 insertions(+), 80 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index aa6449763be..d6695989857 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -599,41 +599,10 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) return rc != 0 ? rc : rc2; } -/* Configures QSPI memory for the transfer */ -static int qspi_nrfx_configure(const struct device *dev) +static int configure_chip(const struct device *dev) { - struct qspi_nor_data *dev_data = dev->data; const struct qspi_nor_config *dev_config = dev->config; - nrfx_err_t res; - int rc; - - res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); - rc = qspi_get_zephyr_ret_code(res); - if (rc < 0) { - return rc; - } - -#if DT_INST_NODE_HAS_PROP(0, rx_delay) - if (!nrf53_errata_121()) { - nrf_qspi_iftiming_set(NRF_QSPI, DT_INST_PROP(0, rx_delay)); - } -#endif - - /* It may happen that after the flash chip was previously put into - * the DPD mode, the system was reset but the flash chip was not. - * Consequently, the flash chip can be in the DPD mode at this point. - * Some flash chips will just exit the DPD mode on the first CS pulse, - * but some need to receive the dedicated command to do it, so send it. - * This can be the case even if the current image does not have - * CONFIG_PM_DEVICE set to enter DPD mode, as a previously executing image - * (for example the main image if the currently executing image is the - * bootloader) might have set DPD mode before reboot. As a result, - * attempt to exit DPD mode regardless of whether CONFIG_PM_DEVICE is set. - */ - rc = exit_dpd(dev); - if (rc < 0) { - return rc; - } + int rc = 0; /* Set QE to match transfer mode. If not using quad * it's OK to leave QE set, but doing so prevents use @@ -784,33 +753,6 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, #endif /* CONFIG_FLASH_JESD216_API */ -/** - * @brief Retrieve the Flash JEDEC ID and compare it with the one expected - * - * @param dev The device structure - * @return 0 on success, negative errno code otherwise - */ -static inline int qspi_nor_read_id(const struct device *dev) -{ - uint8_t id[SPI_NOR_MAX_ID_LEN]; - int rc = qspi_rdid(dev, id); - - if (rc != 0) { - return -EIO; - } - - const struct qspi_nor_config *qnc = dev->config; - - if (memcmp(qnc->id, id, SPI_NOR_MAX_ID_LEN) != 0) { - LOG_ERR("JEDEC id [%02x %02x %02x] expect [%02x %02x %02x]", - id[0], id[1], id[2], - qnc->id[0], qnc->id[1], qnc->id[2]); - return -ENODEV; - } - - return 0; -} - static inline nrfx_err_t read_non_aligned(const struct device *dev, off_t addr, void *dest, size_t size) @@ -1077,35 +1019,58 @@ static int qspi_nor_write_protection_set(const struct device *dev, return rc; } -/** - * @brief Configure the flash - * - * @param dev The flash device structure - * @param info The flash info structure - * @return 0 on success, negative errno code otherwise - */ -static int qspi_nor_configure(const struct device *dev) +static int qspi_init(const struct device *dev) { - int rc = qspi_nrfx_configure(dev); + const struct qspi_nor_config *dev_config = dev->config; + uint8_t id[SPI_NOR_MAX_ID_LEN]; + nrfx_err_t res; + int rc; - if (rc != 0) { + res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev->data); + rc = qspi_get_zephyr_ret_code(res); + if (rc < 0) { + return rc; + } + +#if DT_INST_NODE_HAS_PROP(0, rx_delay) + if (!nrf53_errata_121()) { + nrf_qspi_iftiming_set(NRF_QSPI, DT_INST_PROP(0, rx_delay)); + } +#endif + + /* It may happen that after the flash chip was previously put into + * the DPD mode, the system was reset but the flash chip was not. + * Consequently, the flash chip can be in the DPD mode at this point. + * Some flash chips will just exit the DPD mode on the first CS pulse, + * but some need to receive the dedicated command to do it, so send it. + * This can be the case even if the current image does not have + * CONFIG_PM_DEVICE set to enter DPD mode, as a previously executing image + * (for example the main image if the currently executing image is the + * bootloader) might have set DPD mode before reboot. As a result, + * attempt to exit DPD mode regardless of whether CONFIG_PM_DEVICE is set. + */ + rc = exit_dpd(dev); + if (rc < 0) { + return rc; + } + + /* Retrieve the Flash JEDEC ID and compare it with the one expected. */ + rc = qspi_rdid(dev, id); + if (rc < 0) { return rc; } - /* now the spi bus is configured, we can verify the flash id */ - if (qspi_nor_read_id(dev) != 0) { + if (memcmp(dev_config->id, id, SPI_NOR_MAX_ID_LEN) != 0) { + LOG_ERR("JEDEC id [%02x %02x %02x] expect [%02x %02x %02x]", + id[0], id[1], id[2], dev_config->id[0], + dev_config->id[1], dev_config->id[2]); return -ENODEV; } - return 0; + /* The chip is correct, it can be configured now. */ + return configure_chip(dev); } -/** - * @brief Initialize and configure the flash - * - * @param name The flash name - * @return 0 on success, negative errno code otherwise - */ static int qspi_nor_init(const struct device *dev) { const struct qspi_nor_config *dev_config = dev->config; @@ -1121,7 +1086,7 @@ static int qspi_nor_init(const struct device *dev) qspi_clock_div_change(); - rc = qspi_nor_configure(dev); + rc = qspi_init(dev); qspi_clock_div_restore(); From 2270d5f523f83ec3c69f192e64af48c6f1b71acc Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 14 Dec 2023 21:13:44 +0530 Subject: [PATCH 0042/2300] [nrf fromtree] wifi: shell: Fix AP argument checks and help AP enable takes the same parameters as connect, so, update the help and also fix the optional parameter count when security is involved. Signed-off-by: Chaitanya Tata (cherry picked from commit 9736cc7f29668542a85b5c775b368a6a30c7f8c0) (cherry picked from commit 85a25485d25f7da05e0d6c707b326a487b3a9e6b) Signed-off-by: Dominik Ermel (cherry picked from commit 915ea12b7c706f7c9667aa85b2fb90b406d36e19) --- subsys/net/l2/wifi/wifi_shell.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c5b8f60d933..e243a9de4e4 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1602,9 +1602,16 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, "Disable Access Point mode", cmd_wifi_ap_disable, 1, 0), - SHELL_CMD_ARG(enable, NULL, " [channel] [PSK]", + SHELL_CMD_ARG(enable, NULL, + "\"\"\n" + "[channel number: 0 means all]\n" + "[PSK: valid only for secure SSIDs]\n" + "[Security type: valid only for secure SSIDs]\n" + "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" + "[MFP (optional: needs security type to be specified)]\n" + ": 0:Disable, 1:Optional, 2:Required", cmd_wifi_ap_enable, - 2, 1), + 2, 4), SHELL_SUBCMD_SET_END ); From 048e524fd969fc0fb0229f869fc523424948d28b Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 14 Dec 2023 21:17:07 +0530 Subject: [PATCH 0043/2300] [nrf fromtree] wifi: shell: Display RSSI only for station mode RSSI makes sense only for modes that have a single peer, so, add a station mode check. Signed-off-by: Chaitanya Tata (cherry picked from commit eaba47445a4e9cd1bee7d6adb9b9c62f159f3088) (cherry picked from commit b65e77cdb79c3deb22395874d3079f850a6dffd0) Signed-off-by: Dominik Ermel (cherry picked from commit 620bad8edd3f13a77595747002554fec3ff60ed2) --- subsys/net/l2/wifi/wifi_shell.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index e243a9de4e4..f1a98105204 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -660,7 +660,9 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) wifi_security_txt(status.security)); shell_fprintf(sh, SHELL_NORMAL, "MFP: %s\n", wifi_mfp_txt(status.mfp)); - shell_fprintf(sh, SHELL_NORMAL, "RSSI: %d\n", status.rssi); + if (status.iface_mode == WIFI_MODE_INFRA) { + shell_fprintf(sh, SHELL_NORMAL, "RSSI: %d\n", status.rssi); + } shell_fprintf(sh, SHELL_NORMAL, "Beacon Interval: %d\n", status.beacon_interval); shell_fprintf(sh, SHELL_NORMAL, "DTIM: %d\n", status.dtim_period); shell_fprintf(sh, SHELL_NORMAL, "TWT: %s\n", From 1b56e7b4b8c7411ca21e87e326088a91e4d96218 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 18 Dec 2023 17:42:43 +0530 Subject: [PATCH 0044/2300] [nrf fromlist] wifi: shell: Fix arg count for regulatory domain Regulatory domain supports both get and set, so, fix the argument counts. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66616 Signed-off-by: Chaitanya Tata (cherry picked from commit 426213023e08965311421143ca3abe2ec25b39a4) Signed-off-by: Dominik Ermel (cherry picked from commit 9fb63a841e1dc54b7ed3a28bff90aa8ce41ceb8c) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index f1a98105204..3aa674e73b7 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1688,7 +1688,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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.", cmd_wifi_reg_domain, - 2, 1), + 1, 1), 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" "parameters:" From 422e1af4f1127626f944452e907073f0f3592077 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 22 Dec 2023 13:55:12 +0530 Subject: [PATCH 0045/2300] [nrf fromlist] wifi: shell: Fix the arg count for reg domain Missed accounting for "-f" option. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66876 Signed-off-by: Chaitanya Tata (cherry picked from commit bf821e930748f94977af135540235b76dad32ee9) Signed-off-by: Dominik Ermel (cherry picked from commit 277b6e66bc52f5bdf22a140c8db748054e93a38c) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 3aa674e73b7..c3100c9ad2c 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1688,7 +1688,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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.", cmd_wifi_reg_domain, - 1, 1), + 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" "parameters:" From 285ad75652402f16e03417f19e74d4e10e33fa83 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 22 Dec 2023 13:57:20 +0530 Subject: [PATCH 0046/2300] [nrf fromlist] wifi: shell: Fix optional arg count for connect Fix an extra optional arg. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66876 Signed-off-by: Chaitanya Tata (cherry picked from commit 16d86216eb95cbc5e173db576ebee9c7d72d0569) Signed-off-by: Dominik Ermel (cherry picked from commit ee07a2d47bae600063b0e048355a9d8a44243a3a) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c3100c9ad2c..dbec138fea0 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1653,7 +1653,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required", cmd_wifi_connect, - 2, 5), + 2, 4), SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP", cmd_wifi_disconnect, 1, 0), From e3d7c1fd5946fbde994e5e4df947b412cd545d5b Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 22 Dec 2023 13:59:52 +0530 Subject: [PATCH 0047/2300] [nrf fromlist] wifi: shell: Fix help for PS command Clearly mark the args as optional. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66876 Signed-off-by: Chaitanya Tata (cherry picked from commit 0fc24a59c702c89f6fa04feb552d5bb1eee5e6df) Signed-off-by: Dominik Ermel (cherry picked from commit f076140f55d70269c733b633a9ca2dc5612500c5) --- subsys/net/l2/wifi/wifi_shell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index dbec138fea0..6ef745670ab 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1657,7 +1657,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP", cmd_wifi_disconnect, 1, 0), - SHELL_CMD_ARG(ps, NULL, "Configure Wi-F PS on/off, no arguments will dump config", + 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, From 60706e2ec827338ef8f7334b07f282b4f2e94640 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 22 Dec 2023 14:00:50 +0530 Subject: [PATCH 0048/2300] [nrf fromlist] wifi: shell: Remove the unnecessary text in scan We are using standard notation to differentiate optional and mandatory, so, no need for a heading. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66876 Signed-off-by: Chaitanya Tata (cherry picked from commit e8a952b68db6cd8d097e169a56284bf0ff42c2a0) Signed-off-by: Dominik Ermel (cherry picked from commit 6f6774acf02d236c1a67dd4783ad2d7c5fed3919) --- 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 6ef745670ab..d6d14c86bf1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1669,7 +1669,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, 0), SHELL_CMD_ARG(scan, NULL, "Scan for Wi-Fi APs\n" - "OPTIONAL PARAMETERS:\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" From 28e13ec6f32b0fc21c9a60b7e7f0c45fed79bb4a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 22 Dec 2023 14:02:42 +0530 Subject: [PATCH 0049/2300] [nrf fromlist] wifi: shell: Fix the help for reg domain Separate the two optional parameters and add help. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66876 Signed-off-by: Chaitanya Tata (cherry picked from commit 6be67b3199e68acff52e8d09d231d0f4d5afec4d) Signed-off-by: Dominik Ermel (cherry picked from commit b86194298032cf0ffc53d990b8d71e0a08aa6012) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d6d14c86bf1..890bb8f121e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1684,7 +1684,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(twt, &wifi_twt_ops, "Manage TWT flows", NULL), SHELL_CMD_ARG(reg_domain, NULL, "Set or Get Wi-Fi regulatory domain\n" - "Usage: wifi reg_domain [ISO/IEC 3166-1 alpha2] [-f]\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.", cmd_wifi_reg_domain, From 3b9ee8bc4cd125c4b9746210dc868c953064a704 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 22 Dec 2023 14:07:36 +0530 Subject: [PATCH 0050/2300] [nrf fromlist] wifi: shell: Remove the unnecessary text The parameters heading is implied and doesn't have the newline, so, just remove it. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66876 Signed-off-by: Chaitanya Tata (cherry picked from commit f9f9f83293267465b05927bc3756e1d22accab05) Signed-off-by: Dominik Ermel (cherry picked from commit fd36c75dc0124f043c8875aef3163e8b40a99ec9) --- subsys/net/l2/wifi/wifi_shell.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 890bb8f121e..a983e5c18f5 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1691,7 +1691,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, 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" - "parameters:" "[-i, --if-index ] : Interface index.\n" "[-s, --sta] : Station mode.\n" "[-m, --monitor] : Monitor mode.\n" @@ -1711,7 +1710,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "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" - "parameters:" "[-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" @@ -1730,7 +1728,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "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" - "parameters:" "[-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" From 8a95bf43a03a4082f60af65c83363e964117cb15 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 22 Dec 2023 14:15:11 +0530 Subject: [PATCH 0051/2300] [nrf fromlist] wifi: shell: Fix the inconsistency in commands separation For better readability, below rules will help: * Each command should be separated by a newline * Each command should end with a full stop (intermediate statements shouldn't have full stops) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66876 Signed-off-by: Chaitanya Tata (cherry picked from commit 1353dd144af6aaaa71649c82db287525a72da343) Signed-off-by: Dominik Ermel (cherry picked from commit 260afe3c20a494877fb38bc691c401c721870da2) --- subsys/net/l2/wifi/wifi_shell.c | 98 ++++++++++++++++----------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index a983e5c18f5..9bf33e827ec 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1601,7 +1601,7 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, SHELL_CMD_ARG(disable, NULL, - "Disable Access Point mode", + "Disable Access Point mode.\n", cmd_wifi_ap_disable, 1, 0), SHELL_CMD_ARG(enable, NULL, @@ -1611,7 +1611,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[MFP (optional: needs security type to be specified)]\n" - ": 0:Disable, 1:Optional, 2:Required", + ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_ap_enable, 2, 4), SHELL_SUBCMD_SET_END @@ -1619,30 +1619,30 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, SHELL_CMD_ARG(quick_setup, NULL, " Start a TWT flow with defaults:\n" - " \n", + " .\n", cmd_wifi_twt_setup_quick, 3, 0), SHELL_CMD_ARG(setup, NULL, " Start a TWT flow:\n" "\n" "\n" " " - " \n", + " .\n", cmd_wifi_twt_setup, 11, 0), SHELL_CMD_ARG(teardown, NULL, " Teardown a TWT flow:\n" "\n" "\n" - " \n", + " .\n", cmd_wifi_twt_teardown, 5, 0), - SHELL_CMD_ARG(teardown_all, NULL, " Teardown all TWT flows\n", + SHELL_CMD_ARG(teardown_all, NULL, " Teardown all TWT flows.\n", cmd_wifi_twt_teardown_all, 1, 0), SHELL_SUBCMD_SET_END ); SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, - SHELL_CMD(ap, &wifi_cmd_ap, "Access Point mode commands", NULL), + SHELL_CMD(ap, &wifi_cmd_ap, "Access Point mode commands.\n", NULL), SHELL_CMD_ARG(connect, NULL, "Connect to a Wi-Fi AP\n" "\"\"\n" @@ -1651,108 +1651,108 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[MFP (optional: needs security type to be specified)]\n" - ": 0:Disable, 1:Optional, 2:Required", + ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_connect, 2, 4), - SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP", + 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", + "[on/off].\n", cmd_wifi_ps, 1, 1), SHELL_CMD_ARG(ps_mode, NULL, - "\n", + ".\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" + "[-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-11,14_5:36,149-165,44\n" - "[-h, --help] : Print out the help for the scan command.", + "[-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", cmd_wifi_stats, 1, 0), - SHELL_CMD_ARG(status, NULL, "Status of the Wi-Fi interface", cmd_wifi_status, 1, 0), - SHELL_CMD(twt, &wifi_twt_ops, "Manage TWT flows", NULL), + SHELL_CMD_ARG(statistics, NULL, "Wi-Fi interface statistics.\n", cmd_wifi_stats, 1, 0), + 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.", + "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" - "[-p, --promiscuous] : Promiscuous mode.\n" - "[-t, --tx-injection] : TX-Injection 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" + "[-i, --if-index ] : Interface index\n" + "[-s, --sta] : Station mode\n" + "[-m, --monitor] : Monitor mode\n" + "[-p, --promiscuous] : Promiscuous mode\n" + "[-t, --tx-injection] : TX-Injection 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", + "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" + "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" + "[-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" + "[-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" + "[-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", + "wifi packet_filter -i1 -md.\n", cmd_wifi_packet_filter, 1, 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" + "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" + "[-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", + "wifi -i1 -c5.\n", cmd_wifi_channel, 1, 4), SHELL_CMD_ARG(ps_timeout, NULL, - " - PS inactivity timer(in ms)", + " - 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>", + " - Listen interval in the range of <0-65535>.\n", cmd_wifi_listen_interval, 2, 0), SHELL_CMD_ARG(ps_wakeup_mode, NULL, - "\n", + ".\n", cmd_wifi_ps_wakeup_mode, 2, 0), From b8a072b24cf4445756b8265ad5ae6300702e9bde Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 22 Dec 2023 14:20:22 +0530 Subject: [PATCH 0052/2300] [nrf fromlist] shell: Add a space after colon Just a cosmetic change, but IMHO the help looks much better now :). Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66876 Signed-off-by: Chaitanya Tata (cherry picked from commit 72453d6a4d48e08ec07e86d2fb5cf38a3fe628df) Signed-off-by: Dominik Ermel (cherry picked from commit 89aa0c510361acbbf4704d97b2db33f39671a491) --- subsys/shell/shell_help.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/shell/shell_help.c b/subsys/shell/shell_help.c index 53bf00953c1..235e2111032 100644 --- a/subsys/shell/shell_help.c +++ b/subsys/shell/shell_help.c @@ -139,7 +139,7 @@ static void help_item_print(const struct shell *sh, const char *item_name, z_cursor_next_line_move(sh); return; } else { - z_shell_fprintf(sh, SHELL_NORMAL, "%s:", tabulator); + z_shell_fprintf(sh, SHELL_NORMAL, "%s: ", tabulator); } /* print option help */ formatted_text_print(sh, item_help, offset, false); From 9ceed40d25789ac60f90d9c3496b65295ab840ea Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 26 Dec 2023 21:27:32 +0530 Subject: [PATCH 0053/2300] [nrf fromlist] wifi: Fix duplication Use a common set of events and then add specific ones as per the configuration. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67015 Signed-off-by: Chaitanya Tata (cherry picked from commit 0646c56102d167a6ef533095d5603e7d411b1f54) Signed-off-by: Dominik Ermel (cherry picked from commit c0ea30dbc132c23d11c863fda9592ad7bfde6843) --- subsys/net/l2/wifi/wifi_shell.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 9bf33e827ec..236e5cd05b8 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -29,19 +29,17 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #define WIFI_SHELL_MODULE "wifi" +#define WIFI_SHELL_MGMT_EVENTS_COMMON (NET_EVENT_WIFI_SCAN_DONE |\ + NET_EVENT_WIFI_CONNECT_RESULT |\ + NET_EVENT_WIFI_DISCONNECT_RESULT | \ + NET_EVENT_WIFI_TWT |\ + NET_EVENT_WIFI_RAW_SCAN_RESULT) + #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY -#define WIFI_SHELL_MGMT_EVENTS (NET_EVENT_WIFI_RAW_SCAN_RESULT | \ - NET_EVENT_WIFI_SCAN_DONE | \ - NET_EVENT_WIFI_CONNECT_RESULT | \ - NET_EVENT_WIFI_DISCONNECT_RESULT | \ - NET_EVENT_WIFI_TWT) +#define WIFI_SHELL_MGMT_EVENTS (WIFI_SHELL_MGMT_EVENTS_COMMON) #else -#define WIFI_SHELL_MGMT_EVENTS (NET_EVENT_WIFI_SCAN_RESULT | \ - NET_EVENT_WIFI_SCAN_DONE | \ - NET_EVENT_WIFI_CONNECT_RESULT | \ - NET_EVENT_WIFI_DISCONNECT_RESULT | \ - NET_EVENT_WIFI_TWT | \ - NET_EVENT_WIFI_RAW_SCAN_RESULT) +#define WIFI_SHELL_MGMT_EVENTS (WIFI_SHELL_MGMT_EVENTS_COMMON |\ + NET_EVENT_WIFI_SCAN_RESULT) #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY */ static struct { From c7c88b07661d5ff0d2af754a93f76410d6e1ef7a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 25 Dec 2023 20:09:45 +0530 Subject: [PATCH 0054/2300] [nrf fromlist] wifi: ap: Add status events These events communicate the status of AP mode operations (enable or disable) with few pre-defined enumerations. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67015 Signed-off-by: Chaitanya Tata (cherry picked from commit af9dc97de19890aa30dc04c1dbd889ef43453747) Signed-off-by: Dominik Ermel (cherry picked from commit 15fe6c5d4ecfdf5d2e6ab9ebc5d6d41bcf74648a) --- include/zephyr/net/wifi_mgmt.h | 47 +++++++++++++++++++++++++++++++++ subsys/net/l2/wifi/wifi_mgmt.c | 24 +++++++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 41 +++++++++++++++++++++++++--- 3 files changed, 108 insertions(+), 4 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index babf67722c1..0897bdd5715 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -180,6 +180,10 @@ enum net_event_wifi_cmd { NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT, /** Disconnect complete */ NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE, + /** AP mode enable result */ + NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT, + /** AP mode disable result */ + NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT, }; #define NET_EVENT_WIFI_SCAN_RESULT \ @@ -209,6 +213,12 @@ enum net_event_wifi_cmd { #define NET_EVENT_WIFI_DISCONNECT_COMPLETE \ (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE) +#define NET_EVENT_WIFI_AP_ENABLE_RESULT \ + (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT) + +#define NET_EVENT_WIFI_AP_DISABLE_RESULT \ + (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT) + /** * @brief Wi-Fi structure to uniquely identify a band-channel pair */ @@ -351,12 +361,35 @@ enum wifi_disconn_reason { WIFI_REASON_DISCONN_INACTIVITY, }; +/** Wi-Fi AP mode result codes. To be overlaid on top of \ref wifi_status + * in the AP mode enable or disable result event for detailed status. + */ +enum wifi_ap_status { + /** AP mode enable or disable successful */ + WIFI_STATUS_AP_SUCCESS = 0, + /** AP mode enable or disable failed - generic failure */ + WIFI_STATUS_AP_FAIL, + /** AP mode enable failed - channel not supported */ + WIFI_STATUS_AP_CHANNEL_NOT_SUPPORTED, + /** AP mode enable failed - channel not allowed */ + WIFI_STATUS_AP_CHANNEL_NOT_ALLOWED, + /** AP mode enable failed - SSID not allowed */ + WIFI_STATUS_AP_SSID_NOT_ALLOWED, + /** AP mode enable failed - authentication type not supported */ + WIFI_STATUS_AP_AUTH_TYPE_NOT_SUPPORTED, + /** AP mode enable failed - operation not supported */ + WIFI_STATUS_AP_OP_NOT_SUPPORTED, + /** AP mode enable failed - operation not permitted */ + WIFI_STATUS_AP_OP_NOT_PERMITTED, +}; + /** Generic Wi-Fi status for commands and events */ struct wifi_status { union { int status; enum wifi_conn_status conn_status; enum wifi_disconn_reason disconn_reason; + enum wifi_ap_status ap_status; }; }; @@ -802,6 +835,20 @@ 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); +/** Wi-Fi management AP mode enable result event + * + * @param iface Network interface + * @param status AP mode enable result status + */ +void wifi_mgmt_raise_ap_enable_result_event(struct net_if *iface, enum wifi_ap_status status); + +/** Wi-Fi management AP mode disable result event + * + * @param iface Network interface + * @param status AP mode disable result status + */ +void wifi_mgmt_raise_ap_disable_result_event(struct net_if *iface, enum wifi_ap_status status); + /** * @} */ diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 1a866d4c47c..21a426d794d 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -707,3 +707,27 @@ void wifi_mgmt_raise_disconnect_complete_event(struct net_if *iface, iface, &cnx_status, sizeof(struct wifi_status)); } + +void wifi_mgmt_raise_ap_enable_result_event(struct net_if *iface, + enum wifi_ap_status status) +{ + struct wifi_status cnx_status = { + .status = status, + }; + + net_mgmt_event_notify_with_info(NET_EVENT_WIFI_AP_ENABLE_RESULT, + iface, &cnx_status, + sizeof(enum wifi_ap_status)); +} + +void wifi_mgmt_raise_ap_disable_result_event(struct net_if *iface, + enum wifi_ap_status status) +{ + struct wifi_status cnx_status = { + .status = status, + }; + + net_mgmt_event_notify_with_info(NET_EVENT_WIFI_AP_DISABLE_RESULT, + iface, &cnx_status, + sizeof(enum wifi_ap_status)); +} diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 236e5cd05b8..217e4c703c0 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -33,7 +33,9 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); NET_EVENT_WIFI_CONNECT_RESULT |\ NET_EVENT_WIFI_DISCONNECT_RESULT | \ NET_EVENT_WIFI_TWT |\ - NET_EVENT_WIFI_RAW_SCAN_RESULT) + NET_EVENT_WIFI_RAW_SCAN_RESULT |\ + NET_EVENT_WIFI_AP_ENABLE_RESULT |\ + NET_EVENT_WIFI_AP_DISABLE_RESULT) #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY #define WIFI_SHELL_MGMT_EVENTS (WIFI_SHELL_MGMT_EVENTS_COMMON) @@ -300,6 +302,32 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) } } +static void handle_wifi_ap_enable_result(struct net_mgmt_event_callback *cb) +{ + const struct wifi_status *status = + (const struct wifi_status *)cb->info; + + if (status->status) { + print(context.sh, SHELL_WARNING, + "AP enable request failed (%d)\n", status->status); + } else { + print(context.sh, SHELL_NORMAL, "AP enabled\n"); + } +} + +static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) +{ + const struct wifi_status *status = + (const struct wifi_status *)cb->info; + + if (status->status) { + print(context.sh, SHELL_WARNING, + "AP disable request failed (%d)\n", status->status); + } else { + print(context.sh, SHELL_NORMAL, "AP disabled\n"); + } +} + static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { @@ -324,6 +352,12 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, handle_wifi_raw_scan_result(cb); break; #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ + case NET_EVENT_WIFI_AP_ENABLE_RESULT: + handle_wifi_ap_enable_result(cb); + break; + case NET_EVENT_WIFI_AP_DISABLE_RESULT: + handle_wifi_ap_disable_result(cb); + break; default: break; } @@ -1112,7 +1146,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "AP mode enabled\n"); + shell_fprintf(sh, SHELL_NORMAL, "AP mode enable requested\n"); return 0; } @@ -1129,8 +1163,7 @@ static int cmd_wifi_ap_disable(const struct shell *sh, size_t argc, return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "AP mode disabled\n"); - + shell_fprintf(sh, SHELL_NORMAL, "AP mode disable requested\n"); return 0; } From ad65b863a10809780df85856cf571b746ceab227 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 26 Dec 2023 21:17:51 +0530 Subject: [PATCH 0055/2300] [nrf fromlist] wifi: ap: Add client side events These are helpful to track clients being added and deleted. Applications can actions based on these events. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67015 Signed-off-by: Chaitanya Tata (cherry picked from commit 81038eb0200a36600381bfd7120c9105111b9cb0) Signed-off-by: Dominik Ermel (cherry picked from commit 9a5a739cde1ed10fab5a0c989b991390d0412236) --- include/zephyr/net/wifi_mgmt.h | 38 +++++++++++++++++++++++++++++++++ subsys/net/l2/wifi/wifi_mgmt.c | 16 ++++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 32 ++++++++++++++++++++++++++- 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 0897bdd5715..78800f451e7 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -184,6 +184,10 @@ enum net_event_wifi_cmd { NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT, /** AP mode disable result */ NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT, + /** STA connected to AP */ + NET_EVENT_WIFI_CMD_AP_STA_CONNECTED, + /** STA disconnected from AP */ + NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED, }; #define NET_EVENT_WIFI_SCAN_RESULT \ @@ -219,6 +223,12 @@ enum net_event_wifi_cmd { #define NET_EVENT_WIFI_AP_DISABLE_RESULT \ (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT) +#define NET_EVENT_WIFI_AP_STA_CONNECTED \ + (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) + +#define NET_EVENT_WIFI_AP_STA_DISCONNECTED \ + (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED) + /** * @brief Wi-Fi structure to uniquely identify a band-channel pair */ @@ -568,6 +578,18 @@ struct wifi_raw_scan_result { }; #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ +/** AP mode - connected STA details */ +struct wifi_ap_sta_info { + /** Link mode, see enum wifi_link_mode */ + enum wifi_link_mode link_mode; + /** MAC address */ + uint8_t mac[WIFI_MAC_ADDR_LEN]; + /** MAC address length */ + uint8_t mac_length; + /** is TWT capable ? */ + bool twt_capable; +}; + /* for use in max info size calculations */ union wifi_mgmt_events { struct wifi_scan_result scan_result; @@ -577,6 +599,7 @@ union wifi_mgmt_events { struct wifi_raw_scan_result raw_scan_result; #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ struct wifi_twt_params twt_params; + struct wifi_ap_sta_info ap_sta_info; }; /** Wi-Fi mode setup */ @@ -849,6 +872,21 @@ void wifi_mgmt_raise_ap_enable_result_event(struct net_if *iface, enum wifi_ap_s */ void wifi_mgmt_raise_ap_disable_result_event(struct net_if *iface, enum wifi_ap_status status); +/** Wi-Fi management AP mode STA connected event + * + * @param iface Network interface + * @param sta_info STA information + */ +void wifi_mgmt_raise_ap_sta_connected_event(struct net_if *iface, + struct wifi_ap_sta_info *sta_info); + +/** Wi-Fi management AP mode STA disconnected event + * @param iface Network interface + * @param sta_info STA information + */ +void wifi_mgmt_raise_ap_sta_disconnected_event(struct net_if *iface, + struct wifi_ap_sta_info *sta_info); + /** * @} */ diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 21a426d794d..6e0cb761dbf 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -731,3 +731,19 @@ void wifi_mgmt_raise_ap_disable_result_event(struct net_if *iface, iface, &cnx_status, sizeof(enum wifi_ap_status)); } + +void wifi_mgmt_raise_ap_sta_connected_event(struct net_if *iface, + struct wifi_ap_sta_info *sta_info) +{ + net_mgmt_event_notify_with_info(NET_EVENT_WIFI_AP_STA_CONNECTED, + iface, sta_info, + sizeof(struct wifi_ap_sta_info)); +} + +void wifi_mgmt_raise_ap_sta_disconnected_event(struct net_if *iface, + struct wifi_ap_sta_info *sta_info) +{ + net_mgmt_event_notify_with_info(NET_EVENT_WIFI_AP_STA_DISCONNECTED, + iface, sta_info, + sizeof(struct wifi_ap_sta_info)); +} diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 217e4c703c0..045fbed197e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -35,7 +35,9 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); NET_EVENT_WIFI_TWT |\ NET_EVENT_WIFI_RAW_SCAN_RESULT |\ NET_EVENT_WIFI_AP_ENABLE_RESULT |\ - NET_EVENT_WIFI_AP_DISABLE_RESULT) + NET_EVENT_WIFI_AP_DISABLE_RESULT |\ + NET_EVENT_WIFI_AP_STA_CONNECTED |\ + NET_EVENT_WIFI_AP_STA_DISCONNECTED) #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY #define WIFI_SHELL_MGMT_EVENTS (WIFI_SHELL_MGMT_EVENTS_COMMON) @@ -328,6 +330,28 @@ static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) } } +static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) +{ + const struct wifi_ap_sta_info *sta_info = + (const struct wifi_ap_sta_info *)cb->info; + uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; + + print(context.sh, SHELL_NORMAL, "Station connected: %s\n", + net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, + mac_string_buf, sizeof(mac_string_buf))); +} + +static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) +{ + const struct wifi_ap_sta_info *sta_info = + (const struct wifi_ap_sta_info *)cb->info; + uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; + + print(context.sh, SHELL_NORMAL, "Station disconnected: %s\n", + net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, + mac_string_buf, sizeof(mac_string_buf))); +} + static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { @@ -358,6 +382,12 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, case NET_EVENT_WIFI_AP_DISABLE_RESULT: handle_wifi_ap_disable_result(cb); break; + case NET_EVENT_WIFI_AP_STA_CONNECTED: + handle_wifi_ap_sta_connected(cb); + break; + case NET_EVENT_WIFI_AP_STA_DISCONNECTED: + handle_wifi_ap_sta_disconnected(cb); + break; default: break; } From 2fd793f4135114c03ce7c4525e25b6793204d4b1 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 27 Dec 2023 00:06:45 +0530 Subject: [PATCH 0056/2300] [nrf fromlist] wifi: shell: Add a shell command to list stations In AP mode maintain the database of connected stations based on the Wi-Fi management events and dump the list. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67015 Signed-off-by: Chaitanya Tata (cherry picked from commit 3dab922e5d0561d37823058b0fa5fad18376cb33) Signed-off-by: Dominik Ermel (cherry picked from commit b5c01369df121c4a9ee23f4c9c51ccdf4edb16d1) --- subsys/net/l2/wifi/Kconfig | 8 +++ subsys/net/l2/wifi/wifi_shell.c | 90 +++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 134448aa57f..2816be56d74 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -64,6 +64,14 @@ config WIFI_MGMT_SCAN_CHAN_MAX_MANUAL There are approximately 100 channels allocated across the three supported bands. The default of 3 allows the 3 most common channels (2.4GHz: 1, 6, 11) to be specified. +config WIFI_SHELL_MAX_AP_STA + int "Maximum number of APs and STAs that can be managed in Wi-Fi shell" + range 1 5 + default 1 + help + This option defines the maximum number of APs and STAs that can be managed + in Wi-Fi shell. + config WIFI_NM bool "Wi-Fi Network manager support" help diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 045fbed197e..1ee94304781 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -24,6 +24,7 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #include #include #include +#include #include "net_private.h" @@ -64,6 +65,13 @@ static uint32_t scan_result; static struct net_mgmt_event_callback wifi_shell_mgmt_cb; +static K_MUTEX_DEFINE(wifi_ap_sta_list_lock); +struct wifi_ap_sta_node { + bool valid; + struct wifi_ap_sta_info sta_info; +}; +static struct wifi_ap_sta_node sta_list[CONFIG_WIFI_SHELL_MAX_AP_STA]; + #define print(sh, level, fmt, ...) \ do { \ if (sh) { \ @@ -328,6 +336,10 @@ static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) } else { print(context.sh, SHELL_NORMAL, "AP disabled\n"); } + + k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); + memset(&sta_list, 0, sizeof(sta_list)); + k_mutex_unlock(&wifi_ap_sta_list_lock); } static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) @@ -335,10 +347,25 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) const struct wifi_ap_sta_info *sta_info = (const struct wifi_ap_sta_info *)cb->info; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; + int i; print(context.sh, SHELL_NORMAL, "Station connected: %s\n", net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, mac_string_buf, sizeof(mac_string_buf))); + + k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); + for (i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { + if (!sta_list[i].valid) { + sta_list[i].sta_info = *sta_info; + sta_list[i].valid = true; + break; + } + } + if (i == CONFIG_WIFI_SHELL_MAX_AP_STA) { + print(context.sh, SHELL_WARNING, "No space to store station info: " + "Increase CONFIG_WIFI_SHELL_MAX_AP_STA\n"); + } + k_mutex_unlock(&wifi_ap_sta_list_lock); } static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) @@ -350,6 +377,20 @@ static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) print(context.sh, SHELL_NORMAL, "Station disconnected: %s\n", net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, mac_string_buf, sizeof(mac_string_buf))); + + k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); + for (int i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { + if (!sta_list[i].valid) { + continue; + } + + if (!memcmp(sta_list[i].sta_info.mac, sta_info->mac, + WIFI_MAC_ADDR_LEN)) { + sta_list[i].valid = false; + break; + } + } + k_mutex_unlock(&wifi_ap_sta_list_lock); } static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, @@ -1169,6 +1210,8 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, context.sh = sh; + k_mutex_init(&wifi_ap_sta_list_lock); + ret = net_mgmt(NET_REQUEST_WIFI_AP_ENABLE, iface, &cnx_params, sizeof(struct wifi_connect_req_params)); if (ret) { @@ -1197,6 +1240,49 @@ static int cmd_wifi_ap_disable(const struct shell *sh, size_t argc, return 0; } +static int cmd_wifi_ap_stations(const struct shell *sh, size_t argc, + char *argv[]) +{ + size_t id = 1; + + ARG_UNUSED(argv); + ARG_UNUSED(argc); + + shell_fprintf(sh, SHELL_NORMAL, "AP stations:\n"); + shell_fprintf(sh, SHELL_NORMAL, "============\n"); + + k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); + for (int i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { + struct wifi_ap_sta_info *sta; + uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; + + if (!sta_list[i].valid) { + continue; + } + + sta = &sta_list[i].sta_info; + + shell_fprintf(sh, SHELL_NORMAL, "Station %zu:\n", id++); + shell_fprintf(sh, SHELL_NORMAL, "==========\n"); + shell_fprintf(sh, SHELL_NORMAL, "MAC: %s\n", + net_sprint_ll_addr_buf(sta->mac, + WIFI_MAC_ADDR_LEN, + mac_string_buf, + sizeof(mac_string_buf))); + shell_fprintf(sh, SHELL_NORMAL, "Link mode: %s\n", + wifi_link_mode_txt(sta->link_mode)); + shell_fprintf(sh, SHELL_NORMAL, "TWT: %s\n", + sta->twt_capable ? "Supported" : "Not supported"); + } + + if (id == 1) { + shell_fprintf(sh, SHELL_NORMAL, "No stations connected\n"); + } + k_mutex_unlock(&wifi_ap_sta_list_lock); + + return 0; +} + static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, char *argv[]) @@ -1675,6 +1761,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_ap_enable, 2, 4), + SHELL_CMD_ARG(stations, NULL, + "List stations connected to the AP", + cmd_wifi_ap_stations, + 1, 0), SHELL_SUBCMD_SET_END ); From a719561b6ed470fd0faf0ac147ecc24e686a3bdb Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 20 Nov 2023 15:00:59 +0000 Subject: [PATCH 0057/2300] [nrf fromlist] drivers: ieee802154: nrf5: Fix missed variable rename Fixes and issue with a variable that has been renamed but whose reference in the source file has not Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/65480 Signed-off-by: Jamie McCrae Signed-off-by: Dominik Ermel (cherry picked from commit 7300a52ddc328f6ba9b8d081a2224143f74c869d) --- drivers/ieee802154/ieee802154_nrf5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index defbc90cd07..df01f530abf 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -933,9 +933,9 @@ static int nrf5_configure(const struct device *dev, #if defined(CONFIG_NRF_802154_SER_HOST) net_time_t period_ns = nrf5_data.csl_period * NSEC_PER_TEN_SYMBOLS; - bool changed = (config->csl_rx_time - nrf5_data.csl_rx_time) % period_ns; + bool changed = (config->expected_rx_time - nrf5_data.csl_rx_time) % period_ns; - nrf5_data.csl_rx_time = config->csl_rx_time; + nrf5_data.csl_rx_time = config->expected_rx_time; if (changed) #endif /* CONFIG_NRF_802154_SER_HOST */ From 41fa254d61c499f7cc708ccf39e68cf7fbc28d51 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 23 Nov 2023 12:54:12 +0100 Subject: [PATCH 0058/2300] [nrf fromtree] sysbuild: introduce Kconfig setting for controlling HCI IPC inclusion Follow-up: #64704 Introducing NET_CORE_IMAGE_HCI_IPC Kconfig setting to control inclusion of HCI IPC image when building through sysbuild. This allows users with custom netcore applications to avoid inclusion of the default HCI IPC image. Signed-off-by: Torsten Rasmussen (cherry picked from commit 13f3c6d0bda59855b8928fb510cb1cd3687c4dce) Signed-off-by: Dominik Ermel (cherry picked from commit 7513bd8b9de3664eea8dc02121fa083dbae9e188) --- samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild | 5 +++++ samples/bluetooth/broadcast_audio_sink/sysbuild.cmake | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild b/samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild index 37a6b66c7f4..f434010f81d 100644 --- a/samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild +++ b/samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild @@ -8,3 +8,8 @@ config NET_CORE_BOARD default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340_audio_dk_nrf5340_cpunet" if $(BOARD) = "nrf5340_audio_dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" + +config NET_CORE_IMAGE_HCI_IPC + bool "HCI IPC image on network core" + default y + depends on NET_CORE_BOARD != "" diff --git a/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake b/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake index c150913cc55..ed30d7f31f3 100644 --- a/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake +++ b/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) +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) From c3cf78aaf2eb65240fbb853112854c6b59975c01 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Mon, 27 Nov 2023 19:31:30 +0100 Subject: [PATCH 0059/2300] [nrf fromtree] soc: arm: nrf52: Configurable EGU instance for anomaly 109 workaround Change makes EGU instance used for anomaly 109 workaround configurable. The default EGU instance (5) may be used for other purpose. Signed-off-by: Marek Pieta (cherry picked from commit 00d8263a935dbfed3088f0fdc911aab7eb801587) Signed-off-by: Dominik Ermel (cherry picked from commit 7086c624dbd5fd627891e1a7ee683a182370657f) --- modules/hal_nordic/nrfx/nrfx_config.h | 2 ++ soc/arm/nordic_nrf/nrf52/Kconfig.soc | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index aaf31751004..b5b09b96078 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -586,6 +586,8 @@ #define NRFX_SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 #define NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 #define NRFX_PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 +#define NRFX_PWM_NRF52_ANOMALY_109_EGU_INSTANCE \ + CONFIG_NRF52_ANOMALY_109_WORKAROUND_EGU_INSTANCE #endif #if defined(CONFIG_SOC_SERIES_BSIM_NRFXX) diff --git a/soc/arm/nordic_nrf/nrf52/Kconfig.soc b/soc/arm/nordic_nrf/nrf52/Kconfig.soc index 517b4ce2baa..de6a16129d3 100644 --- a/soc/arm/nordic_nrf/nrf52/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf52/Kconfig.soc @@ -147,4 +147,12 @@ config NRF52_ANOMALY_109_WORKAROUND 64MHz clock at the same time as the peripheral that is using DMA is started. This anomaly applies to IC revisions up to "3", the most recent one. +config NRF52_ANOMALY_109_WORKAROUND_EGU_INSTANCE + int "Anomaly 109 workaround EGU instance" + depends on NRF52_ANOMALY_109_WORKAROUND + range 0 5 + default 5 + help + EGU instance used by the nRF52 Anomaly 109 workaround for PWM. + endif # SOC_SERIES_NRF52X From 7d6c142381231c6f14b33b0864cf1e0ce363ecc9 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Tue, 28 Nov 2023 13:31:01 +0100 Subject: [PATCH 0060/2300] [nrf fromlist] drivers: usb: nrf_usbd_common: Remove unneeded assertion Code uses local RAM buffer to properly handle the case where provided USB transfer TX data is not in RAM. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/65865 Signed-off-by: Marek Pieta Signed-off-by: Dominik Ermel (cherry picked from commit 23f410daa5232429398b95350a82c5368b4d32eb) --- drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c b/drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c index 9045e1ded70..3db193ee2f0 100644 --- a/drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c +++ b/drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c @@ -376,8 +376,6 @@ static bool nrf_usbd_common_feeder(nrf_usbd_common_ep_transfer_t *p_next, nrf_usbd_common_transfer_t *p_transfer, size_t ep_size) { - __ASSERT_NO_MSG(nrfx_is_in_ram(p_transfer->p_data.tx)); - size_t tx_size = p_transfer->size; if (tx_size > ep_size) { From 30f6ef68ec596d94f6f432781c17d8b519c6b9fa Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Tue, 5 Dec 2023 13:30:39 +0100 Subject: [PATCH 0061/2300] [nrf fromlist] logging: Fix using simplified message creation mode Change fixes marcos used to determine if argument types allow simplified message creation mode. Both arguments types must be proper. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66156 Signed-off-by: Marek Pieta Signed-off-by: Dominik Ermel (cherry picked from commit 6f609a096e5ecc3ac2a993de4b2bbc33c4fe3a98) --- include/zephyr/logging/log_msg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/logging/log_msg.h b/include/zephyr/logging/log_msg.h index fabc7a16b0c..39cbf1cedbc 100644 --- a/include/zephyr/logging/log_msg.h +++ b/include/zephyr/logging/log_msg.h @@ -241,7 +241,7 @@ enum z_log_msg_mode { #define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_0(fmt) 1 #define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_1(fmt, arg) Z_CBPRINTF_IS_WORD_NUM(arg) #define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_2(fmt, arg0, arg1) \ - Z_CBPRINTF_IS_WORD_NUM(arg0) || Z_CBPRINTF_IS_WORD_NUM(arg1) + Z_CBPRINTF_IS_WORD_NUM(arg0) && Z_CBPRINTF_IS_WORD_NUM(arg1) /** brief Determine if string arguments types allow to use simplified message creation mode. * From b0a05b3a4577637e8bb052abf828373f6b71ac90 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 24 Nov 2023 12:45:11 +0100 Subject: [PATCH 0062/2300] [nrf fromtree] samples/bluetooth: sysbuild: Add Kconfig setting for HCI IPC inclusion Introduce NET_CORE_IMAGE_HCI_IPC Kconfig setting to control inclusion of HCI IPC image when building through sysbuild. This allows users with custom netcore applications to avoid inclusion of the default HCI IPC image. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 8f78b7148ce5234aa877b2653ae99ddcab3a5c75) Signed-off-by: Dominik Ermel (cherry picked from commit 6da4c914b11a8a5c0441ee2c50e9450908ca9a51) --- samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild | 5 +++++ samples/bluetooth/broadcast_audio_source/sysbuild.cmake | 2 +- samples/bluetooth/unicast_audio_client/Kconfig.sysbuild | 5 +++++ samples/bluetooth/unicast_audio_client/sysbuild.cmake | 2 +- samples/bluetooth/unicast_audio_server/Kconfig.sysbuild | 5 +++++ samples/bluetooth/unicast_audio_server/sysbuild.cmake | 2 +- 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild b/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild index 37a6b66c7f4..f434010f81d 100644 --- a/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild +++ b/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild @@ -8,3 +8,8 @@ config NET_CORE_BOARD default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340_audio_dk_nrf5340_cpunet" if $(BOARD) = "nrf5340_audio_dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" + +config NET_CORE_IMAGE_HCI_IPC + bool "HCI IPC image on network core" + default y + depends on NET_CORE_BOARD != "" diff --git a/samples/bluetooth/broadcast_audio_source/sysbuild.cmake b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake index c150913cc55..ed30d7f31f3 100644 --- a/samples/bluetooth/broadcast_audio_source/sysbuild.cmake +++ b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) +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) diff --git a/samples/bluetooth/unicast_audio_client/Kconfig.sysbuild b/samples/bluetooth/unicast_audio_client/Kconfig.sysbuild index 37a6b66c7f4..f434010f81d 100644 --- a/samples/bluetooth/unicast_audio_client/Kconfig.sysbuild +++ b/samples/bluetooth/unicast_audio_client/Kconfig.sysbuild @@ -8,3 +8,8 @@ config NET_CORE_BOARD default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340_audio_dk_nrf5340_cpunet" if $(BOARD) = "nrf5340_audio_dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" + +config NET_CORE_IMAGE_HCI_IPC + bool "HCI IPC image on network core" + default y + depends on NET_CORE_BOARD != "" diff --git a/samples/bluetooth/unicast_audio_client/sysbuild.cmake b/samples/bluetooth/unicast_audio_client/sysbuild.cmake index c150913cc55..ed30d7f31f3 100644 --- a/samples/bluetooth/unicast_audio_client/sysbuild.cmake +++ b/samples/bluetooth/unicast_audio_client/sysbuild.cmake @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) +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) diff --git a/samples/bluetooth/unicast_audio_server/Kconfig.sysbuild b/samples/bluetooth/unicast_audio_server/Kconfig.sysbuild index 37a6b66c7f4..f434010f81d 100644 --- a/samples/bluetooth/unicast_audio_server/Kconfig.sysbuild +++ b/samples/bluetooth/unicast_audio_server/Kconfig.sysbuild @@ -8,3 +8,8 @@ config NET_CORE_BOARD default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340_audio_dk_nrf5340_cpunet" if $(BOARD) = "nrf5340_audio_dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" + +config NET_CORE_IMAGE_HCI_IPC + bool "HCI IPC image on network core" + default y + depends on NET_CORE_BOARD != "" diff --git a/samples/bluetooth/unicast_audio_server/sysbuild.cmake b/samples/bluetooth/unicast_audio_server/sysbuild.cmake index c150913cc55..ed30d7f31f3 100644 --- a/samples/bluetooth/unicast_audio_server/sysbuild.cmake +++ b/samples/bluetooth/unicast_audio_server/sysbuild.cmake @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) +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) From eca6fba06e402143c247a5bbd8353fa99621400c Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 24 Nov 2023 12:02:14 +0100 Subject: [PATCH 0063/2300] [nrf fromtree] tests: bsim: Bluetooth: Enable nrf5340bsim CIS ACL group test Enable testing CIS ACL group test on nrf5340bsim. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 411731f778b771f0130b2d7d39e7dfd326305f61) Signed-off-by: Dominik Ermel (cherry picked from commit cebd9529012a78d5d15738b91b2556bfddc1c0ed) --- .../compile.nrf5340bsim_nrf5340_cpuapp.sh | 1 + tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild | 14 ++ tests/bsim/bluetooth/ll/cis/sysbuild.cmake | 47 +++++++ ...0_cpunet_iso_acl_group-bt_ll_sw_split.conf | 122 ++++++++++++++++++ 4 files changed, 184 insertions(+) create mode 100644 tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild create mode 100644 tests/bsim/bluetooth/ll/cis/sysbuild.cmake create mode 100644 tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf diff --git a/tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh b/tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh index 4f175540347..65769185867 100755 --- a/tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh +++ b/tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh @@ -21,6 +21,7 @@ source ${ZEPHYR_BASE}/tests/bsim/compile.source app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_privacy.conf sysbuild=1 compile app=tests/bsim/bluetooth/ll/bis sysbuild=1 compile +app=tests/bsim/bluetooth/ll/cis conf_overlay=overlay-acl_group.conf sysbuild=1 compile run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/audio_samples/compile.sh diff --git a/tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild b/tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild new file mode 100644 index 00000000000..6c89fddc9f3 --- /dev/null +++ b/tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild @@ -0,0 +1,14 @@ +# Copyright 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "share/sysbuild/Kconfig" + +config NET_CORE_BOARD + string + default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" + +config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX + int + # Let's pass the test arguments to the application MCU test + # otherwise by default they would have gone to the net core. + default 0 if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" diff --git a/tests/bsim/bluetooth/ll/cis/sysbuild.cmake b/tests/bsim/bluetooth/ll/cis/sysbuild.cmake new file mode 100644 index 00000000000..495c3f4a20d --- /dev/null +++ b/tests/bsim/bluetooth/ll/cis/sysbuild.cmake @@ -0,0 +1,47 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) + 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 + ${APP_DIR}/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf + CACHE INTERNAL "" + ) + + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) + + if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) + set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + endif() + + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) +endif() + +# Let's meet the expectation of finding the final executable in zephyr/zephyr.exe +add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} +) 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 new file mode 100644 index 00000000000..a3c8f43c71f --- /dev/null +++ b/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf @@ -0,0 +1,122 @@ +CONFIG_IPC_SERVICE=y +CONFIG_MBOX=y + +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 + +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_HCI_RAW_RESERVE=1 +CONFIG_BT_MAX_CONN=4 + +# Workaround: Unable to allocate command buffer when using K_NO_WAIT since +# Host number of completed commands does not follow normal flow control. +CONFIG_BT_BUF_CMD_TX_COUNT=10 + +CONFIG_BT_BUF_EVT_RX_COUNT=16 + +CONFIG_BT_BUF_EVT_RX_SIZE=255 +CONFIG_BT_BUF_ACL_RX_SIZE=255 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_BUF_CMD_TX_SIZE=255 + +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + +# Host features +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV=y +CONFIG_BT_PER_ADV_SYNC=y +CONFIG_BT_PER_ADV_SYNC_MAX=2 + +# Broadcast and Connected ISO +CONFIG_BT_ISO_BROADCASTER=y +CONFIG_BT_ISO_SYNC_RECEIVER=y +CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_ISO_PERIPHERAL=y + +# ISO Streams +CONFIG_BT_ISO_MAX_CHAN=4 + +# Controller +CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_CTLR_DTM_HCI=y + +# Rx ACL and Adv Reports +CONFIG_BT_CTLR_RX_BUFFERS=9 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +# Coded PHY support +CONFIG_BT_CTLR_PHY_CODED=n + +# Advertising Sets and Extended Scanning +CONFIG_BT_CTLR_ADV_EXT=y +CONFIG_BT_CTLR_ADV_SET=3 +CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 +CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=1650 + +CONFIG_BT_CTLR_ADVANCED_FEATURES=y +CONFIG_BT_CTLR_ADV_AUX_SET=3 +CONFIG_BT_CTLR_ADV_AUX_PDU_BACK2BACK=y +CONFIG_BT_CTLR_ADV_SYNC_SET=3 +CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK=y +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_ADV_RESERVE_MAX=n +CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n +# CONFIG_BT_CTLR_CENTRAL_SPACING=10000 +CONFIG_BT_CTLR_CENTRAL_SPACING=0 +CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE=n +CONFIG_BT_CTLR_SCAN_UNRESERVED=n +CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH=y +CONFIG_BT_TICKER_EXT=y +CONFIG_BT_TICKER_EXT_SLOT_WINDOW_YIELD=y + +# Control Procedure +CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=9 + +# ISO Broadcaster Controller +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_STREAM_MAX=2 + +# ISO Receive Controller +CONFIG_BT_CTLR_ADV_EXT=y +CONFIG_BT_CTLR_SYNC_PERIODIC=y +CONFIG_BT_CTLR_SYNC_ISO=y +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +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_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_STREAMS=4 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=4 + +# ISO Transmissions +CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 + +# ISO Receptions +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 +CONFIG_BT_CTLR_ISOAL_SINKS=4 + +# Tx Power Dynamic Control +CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y From 3d73a3a45f9a7ab67d377514041219920b13abd3 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 29 Nov 2023 16:50:37 +0100 Subject: [PATCH 0064/2300] [nrf fromtree] sysbuild: Add extensions for native_simulator based targets Add 3 new functions to perform functions typically needed for native_simulator based targes and reduce the amount of boilerplate. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 94cdfa60dc17cd4fea77f73b9654e0c0f3263175) Signed-off-by: Dominik Ermel (cherry picked from commit 2076afcd51b67a313fd5813bb74efe7ebe313c7e) --- share/sysbuild/CMakeLists.txt | 7 ++- .../native_simulator_sb_extensions.cmake | 62 +++++++++++++++++++ 2 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 share/sysbuild/cmake/modules/native_simulator_sb_extensions.cmake diff --git a/share/sysbuild/CMakeLists.txt b/share/sysbuild/CMakeLists.txt index 7bbfe138760..8a15da9cef5 100644 --- a/share/sysbuild/CMakeLists.txt +++ b/share/sysbuild/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Nordic Semiconductor +# Copyright (c) 2023 Nordic Semiconductor # # SPDX-License-Identifier: Apache-2.0 @@ -18,7 +18,10 @@ set(APP_DIR ${APP_DIR} CACHE PATH "Main Application Source Directory") list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/modules) # List of Zephyr and sysbuild CMake modules we need for sysbuild. # Note: sysbuild_kconfig will internally load kconfig CMake module. -set(zephyr_modules extensions sysbuild_extensions python west root zephyr_module boards shields sysbuild_kconfig) +set(zephyr_modules extensions + sysbuild_extensions python west root zephyr_module boards shields + sysbuild_kconfig native_simulator_sb_extensions + ) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS ${zephyr_modules}) diff --git a/share/sysbuild/cmake/modules/native_simulator_sb_extensions.cmake b/share/sysbuild/cmake/modules/native_simulator_sb_extensions.cmake new file mode 100644 index 00000000000..3d888d1775e --- /dev/null +++ b/share/sysbuild/cmake/modules/native_simulator_sb_extensions.cmake @@ -0,0 +1,62 @@ +# Copyright (c) 2023 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 + +# Usage: +# native_simulator_set_final_executable() +# +# When building for a native_simulator based target (including bsim targets), +# this function adds an extra build target which will copy the executable produced by +# `` to the top level, as zephyr/zephyr.exe +# +# This final image is expected to have been set to assemble other dependent images into +# itself if necessary, by calling native_simulator_set_child_images() +# This will allow other tools, like twister, or the bsim test scripts, as well as users to find +# this final executable in the same place as for non-sysbuild builds. +# +function(native_simulator_set_final_executable final_image) + if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) + add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${final_image}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${final_image} + ) + endif() +endfunction() + +# Usage: +# native_simulator_set_child_images( ) +# +# When building for a native_simulator based target (including bsim targets), +# this function sets a `` as dependencies of `` +# and configures the final image to assemble the child images into its final executable. +# +function(native_simulator_set_child_images final_image child_image) + if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) + add_dependencies(${final_image} ${child_image}) + + set(CHILD_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${child_image}/zephyr/zephyr.elf) + set_property(TARGET ${final_image} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${CHILD_LIBRARY_PATH}\"\n" + ) + endif() +endfunction() + +# Usage: +# native_simulator_set_primary_mcu_index( [ ...]) +# +# Propagate the SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX setting, +# if it is set, to each given image CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX +# +function(native_simulator_set_primary_mcu_index) + if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) + foreach(arg IN LISTS ARGV) + set_property(TARGET ${arg} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + endforeach() + endif() +endfunction() From 5006f1942b7bd90ce8222283a699e580ce5e335a Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 29 Nov 2023 18:44:30 +0100 Subject: [PATCH 0065/2300] [nrf fromtree] samples/bluetooth: Reduce sysbuild boilerplate Reduce the sysbuild boilerplate required for the nrf5340bsim targets. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 8b70d98dcb1eb4f24ea5971cf81204f942c2804e) Signed-off-by: Dominik Ermel (cherry picked from commit c4fefa79ee03bf2c4b9c8d49012c50888ae43e09) --- .../broadcast_audio_sink/sysbuild.cmake | 24 ++----------------- .../broadcast_audio_source/sysbuild.cmake | 24 ++----------------- .../unicast_audio_client/sysbuild.cmake | 24 ++----------------- .../unicast_audio_server/sysbuild.cmake | 24 ++----------------- 4 files changed, 8 insertions(+), 88 deletions(-) diff --git a/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake b/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake index ed30d7f31f3..2523aac8ea7 100644 --- a/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake +++ b/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake @@ -18,27 +18,7 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) - - if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) - endif() + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() -if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) - # Let's meet the expectation of finding the final executable in zephyr/zephyr.exe - add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} - ) -endif() +native_simulator_set_final_executable(${DEFAULT_IMAGE}) diff --git a/samples/bluetooth/broadcast_audio_source/sysbuild.cmake b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake index ed30d7f31f3..2523aac8ea7 100644 --- a/samples/bluetooth/broadcast_audio_source/sysbuild.cmake +++ b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake @@ -18,27 +18,7 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) - - if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) - endif() + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() -if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) - # Let's meet the expectation of finding the final executable in zephyr/zephyr.exe - add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} - ) -endif() +native_simulator_set_final_executable(${DEFAULT_IMAGE}) diff --git a/samples/bluetooth/unicast_audio_client/sysbuild.cmake b/samples/bluetooth/unicast_audio_client/sysbuild.cmake index ed30d7f31f3..2523aac8ea7 100644 --- a/samples/bluetooth/unicast_audio_client/sysbuild.cmake +++ b/samples/bluetooth/unicast_audio_client/sysbuild.cmake @@ -18,27 +18,7 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) - - if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) - endif() + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() -if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) - # Let's meet the expectation of finding the final executable in zephyr/zephyr.exe - add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} - ) -endif() +native_simulator_set_final_executable(${DEFAULT_IMAGE}) diff --git a/samples/bluetooth/unicast_audio_server/sysbuild.cmake b/samples/bluetooth/unicast_audio_server/sysbuild.cmake index ed30d7f31f3..2523aac8ea7 100644 --- a/samples/bluetooth/unicast_audio_server/sysbuild.cmake +++ b/samples/bluetooth/unicast_audio_server/sysbuild.cmake @@ -18,27 +18,7 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) - - if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) - endif() + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() -if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) - # Let's meet the expectation of finding the final executable in zephyr/zephyr.exe - add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} - ) -endif() +native_simulator_set_final_executable(${DEFAULT_IMAGE}) From 1f1f41788b6647e75a94c50127c9744dd309a213 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 29 Nov 2023 18:46:21 +0100 Subject: [PATCH 0066/2300] [nrf fromtree] tests/bsim/bluetooth: Reduce sysbuild boilerplate Reduce the sysbuild boilerplate required for the nrf5340bsim targets. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 41f4826f272ae38dd1043bfda0c38cc8b6e7128f) Signed-off-by: Dominik Ermel (cherry picked from commit 273508cf01151f3ab8d13e4df580f0b941fdcdeb) --- .../broadcast_audio_sink/sysbuild.cmake | 9 +----- .../unicast_audio_client/sysbuild.cmake | 9 +----- tests/bsim/bluetooth/ll/bis/sysbuild.cmake | 29 ++----------------- tests/bsim/bluetooth/ll/cis/sysbuild.cmake | 29 ++----------------- tests/bsim/bluetooth/ll/conn/sysbuild.cmake | 29 ++----------------- 5 files changed, 11 insertions(+), 94 deletions(-) diff --git a/tests/bsim/bluetooth/audio_samples/broadcast_audio_sink/sysbuild.cmake b/tests/bsim/bluetooth/audio_samples/broadcast_audio_sink/sysbuild.cmake index a922830546d..2bf2920a476 100644 --- a/tests/bsim/bluetooth/audio_samples/broadcast_audio_sink/sysbuild.cmake +++ b/tests/bsim/bluetooth/audio_samples/broadcast_audio_sink/sysbuild.cmake @@ -3,11 +3,4 @@ include(${ZEPHYR_BASE}/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake) -if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) - set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) -endif() +native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) diff --git a/tests/bsim/bluetooth/audio_samples/unicast_audio_client/sysbuild.cmake b/tests/bsim/bluetooth/audio_samples/unicast_audio_client/sysbuild.cmake index 9686cde1bce..85b85b7cb63 100644 --- a/tests/bsim/bluetooth/audio_samples/unicast_audio_client/sysbuild.cmake +++ b/tests/bsim/bluetooth/audio_samples/unicast_audio_client/sysbuild.cmake @@ -3,11 +3,4 @@ include(${ZEPHYR_BASE}/samples/bluetooth/unicast_audio_client/sysbuild.cmake) -if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) - set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) -endif() +native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) diff --git a/tests/bsim/bluetooth/ll/bis/sysbuild.cmake b/tests/bsim/bluetooth/ll/bis/sysbuild.cmake index eb75debccd3..69397264edf 100644 --- a/tests/bsim/bluetooth/ll/bis/sysbuild.cmake +++ b/tests/bsim/bluetooth/ll/bis/sysbuild.cmake @@ -16,32 +16,9 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) CACHE INTERNAL "" ) - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) - - if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) - set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - endif() + native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() -# Let's meet the expectation of finding the final executable in zephyr/zephyr.exe -add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} -) +native_simulator_set_final_executable(${DEFAULT_IMAGE}) diff --git a/tests/bsim/bluetooth/ll/cis/sysbuild.cmake b/tests/bsim/bluetooth/ll/cis/sysbuild.cmake index 495c3f4a20d..a1258ecf1f2 100644 --- a/tests/bsim/bluetooth/ll/cis/sysbuild.cmake +++ b/tests/bsim/bluetooth/ll/cis/sysbuild.cmake @@ -16,32 +16,9 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) CACHE INTERNAL "" ) - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) - - if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) - set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - endif() + native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() -# Let's meet the expectation of finding the final executable in zephyr/zephyr.exe -add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} -) +native_simulator_set_final_executable(${DEFAULT_IMAGE}) diff --git a/tests/bsim/bluetooth/ll/conn/sysbuild.cmake b/tests/bsim/bluetooth/ll/conn/sysbuild.cmake index 2294fd5bb5e..4dfa34ef519 100644 --- a/tests/bsim/bluetooth/ll/conn/sysbuild.cmake +++ b/tests/bsim/bluetooth/ll/conn/sysbuild.cmake @@ -11,32 +11,9 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) BOARD ${SB_CONFIG_NET_CORE_BOARD} ) - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) - - if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) - set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - endif() + native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() -# Let's meet the expectation of finding the final executable in zephyr/zephyr.exe -add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} -) +native_simulator_set_final_executable(${DEFAULT_IMAGE}) From 6820ab212bffbd4f2ef258a9aa6e837161feb6a3 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 29 Nov 2023 18:46:52 +0100 Subject: [PATCH 0067/2300] [nrf fromtree] samples/subsys/logging/multidomain: Reduce sysbuild boilerplate Reduce the sysbuild boilerplate required for the nrf5340bsim targets Signed-off-by: Alberto Escolar Piedras (cherry picked from commit b02fc27464c46076a62e2401e51ce7ae0302de95) Signed-off-by: Dominik Ermel (cherry picked from commit bbbf671ef88cdf8c3b064fc79a38eec317a780c6) --- .../subsys/logging/multidomain/sysbuild.cmake | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/samples/subsys/logging/multidomain/sysbuild.cmake b/samples/subsys/logging/multidomain/sysbuild.cmake index e50f47b6db1..496a7a03f9d 100644 --- a/samples/subsys/logging/multidomain/sysbuild.cmake +++ b/samples/subsys/logging/multidomain/sysbuild.cmake @@ -15,24 +15,6 @@ ExternalZephyrProject_Add( BOARD ${SB_CONFIG_NET_CORE_BOARD} ) -if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) +native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) - - # Let's meet users expectations of finding the final executable in zephyr/zephyr.exe - add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} - ) -endif() +native_simulator_set_final_executable(${DEFAULT_IMAGE}) From a75e56410a5666cce3f587e1b38e88ffc877161a Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 29 Nov 2023 18:47:45 +0100 Subject: [PATCH 0068/2300] [nrf fromtree] samples/boards/nrf/nrf53_sync_rtc: Reduce sysbuild boilerplate Reduce the sysbuild boilerplate required for the nrf5340bsim targets Signed-off-by: Alberto Escolar Piedras (cherry picked from commit cbce3383d1e7cbdb23c6caac6d1bf9a5d8236091) Signed-off-by: Dominik Ermel (cherry picked from commit e4b78eddab9555b80726f00dfae9139f7f85cc35) --- .../boards/nrf/nrf53_sync_rtc/sysbuild.cmake | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/samples/boards/nrf/nrf53_sync_rtc/sysbuild.cmake b/samples/boards/nrf/nrf53_sync_rtc/sysbuild.cmake index a5d1eb9874f..0c97244fd7b 100644 --- a/samples/boards/nrf/nrf53_sync_rtc/sysbuild.cmake +++ b/samples/boards/nrf/nrf53_sync_rtc/sysbuild.cmake @@ -15,24 +15,6 @@ ExternalZephyrProject_Add( BOARD ${SB_CONFIG_NET_CORE_BOARD} ) -if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${REMOTE_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) +native_simulator_set_child_images(${DEFAULT_IMAGE} ${REMOTE_APP}) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) - - # Let's meet users expectations of finding the final executable in zephyr/zephyr.exe - add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} - ) -endif() +native_simulator_set_final_executable(${DEFAULT_IMAGE}) From 3014aa720f16319a710179d9da3bcf4fd842ac4c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 29 Nov 2023 18:48:02 +0100 Subject: [PATCH 0069/2300] [nrf fromtree] samples/drivers/mbox: Reduce sysbuild boilerplate Reduce the sysbuild boilerplate required for the nrf5340bsim targets Signed-off-by: Alberto Escolar Piedras (cherry picked from commit d2151aa114cbf389fdec972119b218f7b39f3c9b) Signed-off-by: Dominik Ermel (cherry picked from commit ab3ed158d57b033b08ed76952e3112b9802c7d67) --- samples/drivers/mbox/sysbuild.cmake | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/samples/drivers/mbox/sysbuild.cmake b/samples/drivers/mbox/sysbuild.cmake index 1bd6a00ae9e..a8dfb8ebdf4 100644 --- a/samples/drivers/mbox/sysbuild.cmake +++ b/samples/drivers/mbox/sysbuild.cmake @@ -15,24 +15,6 @@ ExternalZephyrProject_Add( BOARD ${SB_CONFIG_REMOTE_BOARD} ) -if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${REMOTE_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) +native_simulator_set_child_images(${DEFAULT_IMAGE} ${REMOTE_APP}) - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) - - # Let's meet users expectations of finding the final executable in zephyr/zephyr.exe - add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} - ) -endif() +native_simulator_set_final_executable(${DEFAULT_IMAGE}) From b1574c3b51c110c5494f5bf2d24bfe07df488595 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 13 Dec 2023 15:46:45 +0200 Subject: [PATCH 0070/2300] [nrf fromtree] net: shell: Rename the common.h to be more unique As the common.h is only meant to be used by the network shell files, rename it to be more descriptive in order to avoid possible conflicts with any other common.h file. Signed-off-by: Jukka Rissanen (cherry picked from commit 477a4a5d34042f49830fc8aff94ffc16a98cce10) (cherry picked from commit 4a03d8a097843a324fe7746fb5383476b341671a) --- subsys/net/lib/shell/allocs.c | 2 +- subsys/net/lib/shell/arp.c | 2 +- subsys/net/lib/shell/capture.c | 2 +- subsys/net/lib/shell/conn.c | 2 +- subsys/net/lib/shell/dns.c | 2 +- subsys/net/lib/shell/events.c | 2 +- subsys/net/lib/shell/gptp.c | 2 +- subsys/net/lib/shell/iface.c | 2 +- subsys/net/lib/shell/ipv4.c | 2 +- subsys/net/lib/shell/ipv6.c | 2 +- subsys/net/lib/shell/mem.c | 2 +- subsys/net/lib/shell/nbr.c | 2 +- subsys/net/lib/shell/net_shell.c | 2 +- subsys/net/lib/shell/{common.h => net_shell_private.h} | 0 subsys/net/lib/shell/ping.c | 2 +- subsys/net/lib/shell/pkt.c | 2 +- subsys/net/lib/shell/ppp.c | 2 +- subsys/net/lib/shell/resume.c | 2 +- subsys/net/lib/shell/route.c | 2 +- subsys/net/lib/shell/sockets.c | 2 +- subsys/net/lib/shell/stats.c | 2 +- subsys/net/lib/shell/suspend.c | 2 +- subsys/net/lib/shell/tcp.c | 2 +- subsys/net/lib/shell/udp.c | 2 +- subsys/net/lib/shell/virtual.c | 2 +- subsys/net/lib/shell/vlan.c | 2 +- subsys/net/lib/shell/websocket.c | 2 +- 27 files changed, 26 insertions(+), 26 deletions(-) rename subsys/net/lib/shell/{common.h => net_shell_private.h} (100%) diff --git a/subsys/net/lib/shell/allocs.c b/subsys/net/lib/shell/allocs.c index 1c6e7288003..a2669590520 100644 --- a/subsys/net/lib/shell/allocs.c +++ b/subsys/net/lib/shell/allocs.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_DEBUG_NET_PKT_ALLOC) static void allocs_cb(struct net_pkt *pkt, diff --git a/subsys/net/lib/shell/arp.c b/subsys/net/lib/shell/arp.c index fb1582411e9..58889f27d5c 100644 --- a/subsys/net/lib/shell/arp.c +++ b/subsys/net/lib/shell/arp.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_ARP) #include "ethernet/arp.h" diff --git a/subsys/net/lib/shell/capture.c b/subsys/net/lib/shell/capture.c index f05531562ae..0c7347f8774 100644 --- a/subsys/net/lib/shell/capture.c +++ b/subsys/net/lib/shell/capture.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "common.h" +#include "net_shell_private.h" #include diff --git a/subsys/net/lib/shell/conn.c b/subsys/net/lib/shell/conn.c index 36831809eb8..24b528537bd 100644 --- a/subsys/net/lib/shell/conn.c +++ b/subsys/net/lib/shell/conn.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_TCP) #include "tcp_internal.h" diff --git a/subsys/net/lib/shell/dns.c b/subsys/net/lib/shell/dns.c index 24a52f5e8a2..54c768cecd1 100644 --- a/subsys/net/lib/shell/dns.c +++ b/subsys/net/lib/shell/dns.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_DNS_RESOLVER) static void dns_result_cb(enum dns_resolve_status status, diff --git a/subsys/net/lib/shell/events.c b/subsys/net/lib/shell/events.c index 047fd1e2186..5a5d0f38f7d 100644 --- a/subsys/net/lib/shell/events.c +++ b/subsys/net/lib/shell/events.c @@ -13,7 +13,7 @@ LOG_MODULE_DECLARE(net_shell); #include #include -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_MGMT_EVENT_MONITOR) #define EVENT_MON_STACK_SIZE 1024 diff --git a/subsys/net/lib/shell/gptp.c b/subsys/net/lib/shell/gptp.c index a156637e3af..0de653e26cd 100644 --- a/subsys/net/lib/shell/gptp.c +++ b/subsys/net/lib/shell/gptp.c @@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(net_shell); #include "ethernet/gptp/gptp_private.h" #endif -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_GPTP) static const char *selected_role_str(int port); diff --git a/subsys/net/lib/shell/iface.c b/subsys/net/lib/shell/iface.c index 89983bd4839..53d4e99bd21 100644 --- a/subsys/net/lib/shell/iface.c +++ b/subsys/net/lib/shell/iface.c @@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(net_shell); #include #endif -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_L2_ETHERNET) && defined(CONFIG_NET_NATIVE) struct ethernet_capabilities { diff --git a/subsys/net/lib/shell/ipv4.c b/subsys/net/lib/shell/ipv4.c index 8fc88168c9a..e8584b205fb 100644 --- a/subsys/net/lib/shell/ipv4.c +++ b/subsys/net/lib/shell/ipv4.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "common.h" +#include "net_shell_private.h" #include "../ip/ipv4.h" #if defined(CONFIG_NET_NATIVE_IPV4) diff --git a/subsys/net/lib/shell/ipv6.c b/subsys/net/lib/shell/ipv6.c index f81b8dcae23..04efda65d0f 100644 --- a/subsys/net/lib/shell/ipv6.c +++ b/subsys/net/lib/shell/ipv6.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" #include "../ip/ipv6.h" #if defined(CONFIG_NET_IPV6_FRAGMENT) diff --git a/subsys/net/lib/shell/mem.c b/subsys/net/lib/shell/mem.c index cf58cda6bd6..47058f92767 100644 --- a/subsys/net/lib/shell/mem.c +++ b/subsys/net/lib/shell/mem.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" struct ctx_info { int pos; diff --git a/subsys/net/lib/shell/nbr.c b/subsys/net/lib/shell/nbr.c index fd420b818ae..63b62406702 100644 --- a/subsys/net/lib/shell/nbr.c +++ b/subsys/net/lib/shell/nbr.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" static int cmd_net_nbr_rm(const struct shell *sh, size_t argc, char *argv[]) { diff --git a/subsys/net/lib/shell/net_shell.c b/subsys/net/lib/shell/net_shell.c index 19bab12e029..9f932cb1bc4 100644 --- a/subsys/net/lib/shell/net_shell.c +++ b/subsys/net/lib/shell/net_shell.c @@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(net_shell, LOG_LEVEL_DBG); #include -#include "common.h" +#include "net_shell_private.h" #include "net_shell.h" int get_iface_idx(const struct shell *sh, char *index_str) diff --git a/subsys/net/lib/shell/common.h b/subsys/net/lib/shell/net_shell_private.h similarity index 100% rename from subsys/net/lib/shell/common.h rename to subsys/net/lib/shell/net_shell_private.h diff --git a/subsys/net/lib/shell/ping.c b/subsys/net/lib/shell/ping.c index 8b52df110be..833c6eb8d54 100644 --- a/subsys/net/lib/shell/ping.c +++ b/subsys/net/lib/shell/ping.c @@ -13,7 +13,7 @@ LOG_MODULE_DECLARE(net_shell); #include #include -#include "common.h" +#include "net_shell_private.h" #include "../ip/icmpv6.h" #include "../ip/icmpv4.h" diff --git a/subsys/net/lib/shell/pkt.c b/subsys/net/lib/shell/pkt.c index 09d7ae6738a..3306b05d1a7 100644 --- a/subsys/net/lib/shell/pkt.c +++ b/subsys/net/lib/shell/pkt.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" static bool is_pkt_part_of_slab(const struct k_mem_slab *slab, const char *ptr) { diff --git a/subsys/net/lib/shell/ppp.c b/subsys/net/lib/shell/ppp.c index 9b5f8355d47..f63c6ca3324 100644 --- a/subsys/net/lib/shell/ppp.c +++ b/subsys/net/lib/shell/ppp.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_L2_PPP) #include diff --git a/subsys/net/lib/shell/resume.c b/subsys/net/lib/shell/resume.c index 585d421efab..dcd3fbf309d 100644 --- a/subsys/net/lib/shell/resume.c +++ b/subsys/net/lib/shell/resume.c @@ -9,7 +9,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" static int cmd_net_resume(const struct shell *sh, size_t argc, char *argv[]) { diff --git a/subsys/net/lib/shell/route.c b/subsys/net/lib/shell/route.c index d48c442ed41..035b56f6dfc 100644 --- a/subsys/net/lib/shell/route.c +++ b/subsys/net/lib/shell/route.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" #include "../ip/route.h" diff --git a/subsys/net/lib/shell/sockets.c b/subsys/net/lib/shell/sockets.c index 792e34efc21..8be67fc5faf 100644 --- a/subsys/net/lib/shell/sockets.c +++ b/subsys/net/lib/shell/sockets.c @@ -7,7 +7,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" #include #if defined(CONFIG_NET_SOCKETS_OBJ_CORE) diff --git a/subsys/net/lib/shell/stats.c b/subsys/net/lib/shell/stats.c index 455f5d7decd..666a98e35d7 100644 --- a/subsys/net/lib/shell/stats.c +++ b/subsys/net/lib/shell/stats.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "common.h" +#include "net_shell_private.h" #include "../ip/net_stats.h" diff --git a/subsys/net/lib/shell/suspend.c b/subsys/net/lib/shell/suspend.c index 326eb602077..cfa01375cac 100644 --- a/subsys/net/lib/shell/suspend.c +++ b/subsys/net/lib/shell/suspend.c @@ -9,7 +9,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "common.h" +#include "net_shell_private.h" static int cmd_net_suspend(const struct shell *sh, size_t argc, char *argv[]) { diff --git a/subsys/net/lib/shell/tcp.c b/subsys/net/lib/shell/tcp.c index f90e16b3b66..e2839af36ba 100644 --- a/subsys/net/lib/shell/tcp.c +++ b/subsys/net/lib/shell/tcp.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_TCP) && defined(CONFIG_NET_NATIVE_TCP) static struct net_context *tcp_ctx; diff --git a/subsys/net/lib/shell/udp.c b/subsys/net/lib/shell/udp.c index 9eaf3254514..7bccbf93ba3 100644 --- a/subsys/net/lib/shell/udp.c +++ b/subsys/net/lib/shell/udp.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_UDP) && defined(CONFIG_NET_NATIVE_UDP) static struct net_context *udp_ctx; diff --git a/subsys/net/lib/shell/virtual.c b/subsys/net/lib/shell/virtual.c index 19c9b1c1b0e..4eaabaa9916 100644 --- a/subsys/net/lib/shell/virtual.c +++ b/subsys/net/lib/shell/virtual.c @@ -12,7 +12,7 @@ LOG_MODULE_DECLARE(net_shell); #include #endif -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_L2_VIRTUAL) static void virtual_iface_cb(struct net_if *iface, void *user_data) diff --git a/subsys/net/lib/shell/vlan.c b/subsys/net/lib/shell/vlan.c index 0a980caa11f..ea7103ef1c9 100644 --- a/subsys/net/lib/shell/vlan.c +++ b/subsys/net/lib/shell/vlan.c @@ -15,7 +15,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "common.h" +#include "net_shell_private.h" #if defined(CONFIG_NET_VLAN) static void iface_vlan_del_cb(struct net_if *iface, void *user_data) diff --git a/subsys/net/lib/shell/websocket.c b/subsys/net/lib/shell/websocket.c index f3e77187627..56e705199e3 100644 --- a/subsys/net/lib/shell/websocket.c +++ b/subsys/net/lib/shell/websocket.c @@ -12,7 +12,7 @@ LOG_MODULE_DECLARE(net_shell); #include #endif -#include "common.h" +#include "net_shell_private.h" #include "websocket/websocket_internal.h" From c5a6594390ea7ac4ba7d2a7f7dd55c884fc55bf0 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 7 Sep 2023 17:53:19 +0200 Subject: [PATCH 0071/2300] [nrf fromtree] llext: add support for shared objects Add support for linking PIC shared object, which only require linking, using their PLT and GOT lists and don't need any relocation otherwise. Signed-off-by: Guennadi Liakhovetski (cherry picked from commit d6a5a6e04c0a6f64b93d341af4b8f04bd698401c) (cherry picked from commit e3c172a8be333da55dc7802cb83eff23e786c81c) --- subsys/llext/llext.c | 112 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 109 insertions(+), 3 deletions(-) diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index 3d99c8af4fa..7b8099a9190 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -446,6 +446,105 @@ static int llext_copy_symbols(struct llext_loader *ldr, struct llext *ext) return 0; } +/* + * Find the section, containing the supplied offset and return file offset for + * that value + */ +static size_t llext_file_offset(struct llext_loader *ldr, size_t offset) +{ + unsigned int i; + + for (i = 0; i < LLEXT_SECT_COUNT; i++) + if (ldr->sects[i].sh_addr <= offset && + ldr->sects[i].sh_addr + ldr->sects[i].sh_size > offset) + return offset - ldr->sects[i].sh_addr + ldr->sects[i].sh_offset; + + return offset; +} + +static void llext_link_plt(struct llext_loader *ldr, struct llext *ext, elf_shdr_t *shdr) +{ + unsigned int sh_cnt = shdr->sh_size / shdr->sh_entsize; + /* + * CPU address where the .text section is stored, we use .text just as a + * reference point + */ + uint8_t *text = ext->mem[LLEXT_MEM_TEXT]; + + LOG_DBG("Found %p in PLT %u size %u cnt %u text %p", + (void *)llext_string(ldr, ext, LLEXT_MEM_SHSTRTAB, shdr->sh_name), + shdr->sh_type, shdr->sh_entsize, sh_cnt, (void *)text); + + const elf_shdr_t *sym_shdr = ldr->sects + LLEXT_SECT_SYMTAB; + unsigned int sym_cnt = sym_shdr->sh_size / sym_shdr->sh_entsize; + + for (unsigned int i = 0; i < sh_cnt; i++) { + elf_rela_t rela; + + int ret = llext_seek(ldr, shdr->sh_offset + i * shdr->sh_entsize); + + if (!ret) { + ret = llext_read(ldr, &rela, sizeof(rela)); + } + + if (ret < 0) { + LOG_ERR("PLT: failed to read RELA #%u, trying to continue", i); + continue; + } + + /* Index in the symbol table */ + unsigned int j = ELF32_R_SYM(rela.r_info); + + if (j >= sym_cnt) { + LOG_WRN("PLT: idx %u >= %u", j, sym_cnt); + continue; + } + + elf_sym_t sym_tbl; + + ret = llext_seek(ldr, sym_shdr->sh_offset + j * sizeof(elf_sym_t)); + if (!ret) { + ret = llext_read(ldr, &sym_tbl, sizeof(sym_tbl)); + } + + if (ret < 0) { + LOG_ERR("PLT: failed to read symbol table #%u RELA #%u, trying to continue", + j, i); + continue; + } + + uint32_t stt = ELF_ST_TYPE(sym_tbl.st_info); + const char *name = llext_string(ldr, ext, LLEXT_MEM_STRTAB, sym_tbl.st_name); + /* + * Both r_offset and sh_addr are addresses for which the extension + * has been built. + */ + size_t got_offset = llext_file_offset(ldr, rela.r_offset) - + ldr->sects[LLEXT_SECT_TEXT].sh_offset; + + if (stt == STT_NOTYPE && sym_tbl.st_shndx == SHN_UNDEF && name[0] != '\0') { + const void *link_addr = llext_find_sym(NULL, name); + + if (!link_addr) { + LOG_WRN("PLT: cannot find idx %u name %s", j, name); + continue; + } + + if (!rela.r_offset) { + LOG_WRN("PLT: zero offset idx %u name %s", j, name); + continue; + } + + LOG_DBG("symbol %s offset %#x r-offset %#x .text offset %#x", + name, got_offset, + rela.r_offset, ldr->sects[LLEXT_SECT_TEXT].sh_offset); + + /* Resolve the symbol */ + *(const void **)(text + got_offset) = link_addr; + } + } +} + __weak void arch_elf_relocate(elf_rela_t *rel, uintptr_t opaddr, uintptr_t opval) { } @@ -486,12 +585,19 @@ static int llext_link(struct llext_loader *ldr, struct llext *ext) if (strcmp(name, ".rel.text") == 0 || strcmp(name, ".rela.text") == 0) { loc = (uintptr_t)ext->mem[LLEXT_MEM_TEXT]; - } else if (strcmp(name, ".rel.bss") == 0) { + } else if (strcmp(name, ".rel.bss") == 0 || + strcmp(name, ".rela.bss") == 0) { loc = (uintptr_t)ext->mem[LLEXT_MEM_BSS]; - } else if (strcmp(name, ".rel.rodata") == 0) { + } else if (strcmp(name, ".rel.rodata") == 0 || + strcmp(name, ".rela.rodata") == 0) { loc = (uintptr_t)ext->mem[LLEXT_MEM_RODATA]; - } else if (strcmp(name, ".rel.data") == 0) { + } else if (strcmp(name, ".rel.data") == 0 || + strcmp(name, ".rela.data") == 0) { loc = (uintptr_t)ext->mem[LLEXT_MEM_DATA]; + } else if (strcmp(name, ".rela.plt") == 0 || + strcmp(name, ".rela.dyn") == 0) { + llext_link_plt(ldr, ext, &shdr); + continue; } LOG_DBG("relocation section %s (%d) linked to section %d has %d relocations", From b1efb734dfd7b261ca53d83ffcd1b6a7500e99af Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 6 Sep 2023 15:52:46 +0200 Subject: [PATCH 0072/2300] [nrf fromtree] llext: export some symbols Export some symbols for loadable modules. Also add an EXPORT_SYSCALL() helper macro for exporting system calls by their official names. Signed-off-by: Guennadi Liakhovetski (cherry picked from commit 69cdc3289279f476a495e6920a954fc194eec043) (cherry picked from commit 3ffae176371cc9aaf673e1ae05c3498e08f9fec9) --- include/zephyr/llext/symbol.h | 10 ++++++++++ kernel/mutex.c | 3 +++ kernel/thread.c | 2 ++ lib/os/assert.c | 4 +++- subsys/llext/CMakeLists.txt | 3 +-- subsys/llext/llext_export.c | 17 +++++++++++++++++ subsys/logging/log_msg.c | 2 ++ 7 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 subsys/llext/llext_export.c diff --git a/include/zephyr/llext/symbol.h b/include/zephyr/llext/symbol.h index b1aef67413e..84e43d22b5b 100644 --- a/include/zephyr/llext/symbol.h +++ b/include/zephyr/llext/symbol.h @@ -78,6 +78,16 @@ struct llext_symtable { .name = STRINGIFY(x), .addr = &x, \ } +/** + * @brief Export a system call to a table of symbols + * + * Takes a system call name and uses @a EXPORT_SYMBOL() to export the respective + * function. + * + * @param x System call to export + */ +#define EXPORT_SYSCALL(x) EXPORT_SYMBOL(z_impl_ ## x) + /** * @} */ diff --git a/kernel/mutex.c b/kernel/mutex.c index 6d22ce83f22..622422aef7b 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -37,6 +37,7 @@ #include #include #include +#include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); /* We use a global spinlock here because some of the synchronization @@ -195,6 +196,7 @@ int z_impl_k_mutex_lock(struct k_mutex *mutex, k_timeout_t timeout) return -EAGAIN; } +EXPORT_SYSCALL(k_mutex_lock); #ifdef CONFIG_USERSPACE static inline int z_vrfy_k_mutex_lock(struct k_mutex *mutex, @@ -280,6 +282,7 @@ int z_impl_k_mutex_unlock(struct k_mutex *mutex) return 0; } +EXPORT_SYSCALL(k_mutex_unlock); #ifdef CONFIG_USERSPACE static inline int z_vrfy_k_mutex_unlock(struct k_mutex *mutex) diff --git a/kernel/thread.c b/kernel/thread.c index 8f60054e798..fc31f4b36d8 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -29,6 +29,7 @@ #include #include #include +#include #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); @@ -141,6 +142,7 @@ bool k_is_in_isr(void) { return arch_is_in_isr(); } +EXPORT_SYMBOL(k_is_in_isr); /* * This function tags the current thread as essential to system operation. diff --git a/lib/os/assert.c b/lib/os/assert.c index b6a33ae7320..1fee487bff6 100644 --- a/lib/os/assert.c +++ b/lib/os/assert.c @@ -7,7 +7,7 @@ #include #include #include - +#include /** * @brief Assert Action Handler @@ -42,6 +42,7 @@ __weak void assert_post_action(const char *file, unsigned int line) k_panic(); } +EXPORT_SYMBOL(assert_post_action); void assert_print(const char *fmt, ...) { @@ -53,3 +54,4 @@ void assert_print(const char *fmt, ...) va_end(ap); } +EXPORT_SYMBOL(assert_print); diff --git a/subsys/llext/CMakeLists.txt b/subsys/llext/CMakeLists.txt index ac54f3172c3..b129dc7f943 100644 --- a/subsys/llext/CMakeLists.txt +++ b/subsys/llext/CMakeLists.txt @@ -1,6 +1,5 @@ if(CONFIG_LLEXT) zephyr_library() - zephyr_library_sources(llext.c) - zephyr_library_sources(buf_loader.c) + zephyr_library_sources(llext.c llext_export.c buf_loader.c) zephyr_library_sources_ifdef(CONFIG_LLEXT_SHELL shell.c) endif() diff --git a/subsys/llext/llext_export.c b/subsys/llext/llext_export.c new file mode 100644 index 00000000000..0ec7fe4ac0a --- /dev/null +++ b/subsys/llext/llext_export.c @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2023 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +EXPORT_SYMBOL(strcpy); +EXPORT_SYMBOL(strncpy); +EXPORT_SYMBOL(strlen); +EXPORT_SYMBOL(strcmp); +EXPORT_SYMBOL(strncmp); +EXPORT_SYMBOL(memcmp); +EXPORT_SYMBOL(memcpy); +EXPORT_SYMBOL(memset); diff --git a/subsys/logging/log_msg.c b/subsys/logging/log_msg.c index 8023cefbf8c..da9dffdc62e 100644 --- a/subsys/logging/log_msg.c +++ b/subsys/logging/log_msg.c @@ -10,6 +10,7 @@ #include #include #include +#include LOG_MODULE_DECLARE(log); BUILD_ASSERT(sizeof(struct log_msg_desc) == sizeof(uint32_t), @@ -270,6 +271,7 @@ void z_impl_z_log_msg_static_create(const void *source, z_log_msg_finalize(msg, source, out_desc, data); } +EXPORT_SYSCALL(z_log_msg_static_create); #ifdef CONFIG_USERSPACE static inline void z_vrfy_z_log_msg_static_create(const void *source, From 3cc2c7454f8b7a4e9448e3a7dc3f323eac1cdf33 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 28 Sep 2023 16:45:34 +0200 Subject: [PATCH 0073/2300] [nrf fromtree] llext: make buffer access functions accessible externally llext_seek(), llext_read() and llext_peek() are needed outside of the extension code too, move them to a header. Signed-off-by: Guennadi Liakhovetski (cherry picked from commit a2a62b46a32bb6f4dcf8a21ee229e8eeea2c594d) (cherry picked from commit 710df4fbe059934005a8c7399658b9e6ac6fd346) --- include/zephyr/llext/loader.h | 19 +++++++++++++++++++ subsys/llext/llext.c | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/zephyr/llext/loader.h b/include/zephyr/llext/loader.h index 3cc53da7d88..3102f17cf1a 100644 --- a/include/zephyr/llext/loader.h +++ b/include/zephyr/llext/loader.h @@ -97,6 +97,25 @@ struct llext_loader { /** @endcond */ }; +static inline int llext_read(struct llext_loader *l, void *buf, size_t len) +{ + return l->read(l, buf, len); +} + +static inline int llext_seek(struct llext_loader *l, size_t pos) +{ + return l->seek(l, pos); +} + +static inline void *llext_peek(struct llext_loader *l, size_t pos) +{ + if (l->peek) { + return l->peek(l, pos); + } + + return NULL; +} + /** * @} */ diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index 7b8099a9190..6c47ddf29c6 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -21,25 +21,6 @@ K_HEAP_DEFINE(llext_heap, CONFIG_LLEXT_HEAP_SIZE * 1024); static const char ELF_MAGIC[] = {0x7f, 'E', 'L', 'F'}; -static inline int llext_read(struct llext_loader *l, void *buf, size_t len) -{ - return l->read(l, buf, len); -} - -static inline int llext_seek(struct llext_loader *l, size_t pos) -{ - return l->seek(l, pos); -} - -static inline void *llext_peek(struct llext_loader *l, size_t pos) -{ - if (l->peek) { - return l->peek(l, pos); - } - - return NULL; -} - static sys_slist_t _llext_list = SYS_SLIST_STATIC_INIT(&_llext_list); sys_slist_t *llext_list(void) From 3a1532896ece9b32e3558c79a2338cf8204cc259 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 29 Sep 2023 09:56:47 +0200 Subject: [PATCH 0074/2300] [nrf fromtree] llext: add Xtensa test support Add support for running a modular "Hello world" example on Xtensa. Signed-off-by: Guennadi Liakhovetski (cherry picked from commit e5c8d181d46f948e35851dd826637e32e48b77f6) (cherry picked from commit 94e99e2116f5370aee0d56bc4e52fcd5c0415bc9) --- tests/subsys/llext/hello_world/CMakeLists.txt | 23 +++++++++++++++---- tests/subsys/llext/src/test_llext_simple.c | 4 ++-- tests/subsys/llext/testcase.yaml | 5 ++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/tests/subsys/llext/hello_world/CMakeLists.txt b/tests/subsys/llext/hello_world/CMakeLists.txt index 1a16d4be26b..6519075e2f4 100644 --- a/tests/subsys/llext/hello_world/CMakeLists.txt +++ b/tests/subsys/llext/hello_world/CMakeLists.txt @@ -6,11 +6,26 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(hello_world) # TODO check which architecture is being used -set(CMAKE_C_FLAGS "-mlong-calls" "-mthumb") +if(CONFIG_ARM) + set(CMAKE_C_FLAGS "-mlong-calls" "-mthumb") -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/hello_world.llext - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -c -o ${PROJECT_BINARY_DIR}/hello_world.llext ${PROJECT_SOURCE_DIR}/hello_world.c -) + add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/hello_world.llext + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -c + -o ${PROJECT_BINARY_DIR}/hello_world.llext + ${PROJECT_SOURCE_DIR}/hello_world.c + ) +elseif(CONFIG_XTENSA) + set(CMAKE_C_FLAGS "-shared" "-fPIC" "-nostdlib" "-nodefaultlibs") + + add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/hello_world.llext + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} + -o ${PROJECT_BINARY_DIR}/hello_world.pre.llext + ${PROJECT_SOURCE_DIR}/hello_world.c + COMMAND ${CROSS_COMPILE}strip -R .xt.* + -o ${PROJECT_BINARY_DIR}/hello_world.llext + ${PROJECT_BINARY_DIR}/hello_world.pre.llext + ) +endif() set(HELLO_WORLD_LLEXT ${PROJECT_BINARY_DIR}/hello_world.llext PARENT_SCOPE) diff --git a/tests/subsys/llext/src/test_llext_simple.c b/tests/subsys/llext/src/test_llext_simple.c index ef0e62b93b5..d96191c1d72 100644 --- a/tests/subsys/llext/src/test_llext_simple.c +++ b/tests/subsys/llext/src/test_llext_simple.c @@ -9,7 +9,7 @@ #include #include -#ifdef CONFIG_ARM /* ARMV7 */ +#if defined(CONFIG_ARM) /* ARMV7 */ || defined(CONFIG_XTENSA) const static uint8_t hello_world_elf[] __aligned(4) = { #include "hello_world.inc" }; @@ -24,7 +24,7 @@ const static uint8_t hello_world_elf[] __aligned(4) = { */ ZTEST(llext, test_llext_simple) { - const char name[16] = {'h', 'e', 'l', 'l', 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + const char name[16] = "hello"; struct llext_buf_loader buf_loader = LLEXT_BUF_LOADER(hello_world_elf, ARRAY_SIZE(hello_world_elf)); struct llext_loader *loader = &buf_loader.loader; diff --git a/tests/subsys/llext/testcase.yaml b/tests/subsys/llext/testcase.yaml index 79d8f5a1fd9..0bbccd5e1ca 100644 --- a/tests/subsys/llext/testcase.yaml +++ b/tests/subsys/llext/testcase.yaml @@ -9,3 +9,8 @@ tests: # Broken platforms platform_exclude: - nuvoton_pfm_m487 # See #63167 + llext.simple.xtensa: + arch_allow: xtensa + # Broken platforms + platform_exclude: + - qemu_xtensa_mmu # ELF sections are read-only, and without peek() .text copy isn't executable From 02da11f2f67bf408e86788ea44f259efb7fc67ee Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 15 Nov 2023 17:19:57 +0100 Subject: [PATCH 0075/2300] [nrf fromtree] llext: clarify section map allocation size Use an element size explicitly when calculating the array size and use the calculated size for memset(). Signed-off-by: Guennadi Liakhovetski (cherry picked from commit b5ce5012e29d5c1c2e2d5c1dac7fa15766db79e5) (cherry picked from commit 7459728d37f039ded52d174b9597112676d7a5b5) --- subsys/llext/llext.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index 6c47ddf29c6..4f43dc17a1d 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -670,7 +670,7 @@ static int do_llext_load(struct llext_loader *ldr, struct llext *ext) memset(ldr->sects, 0, sizeof(ldr->sects)); ldr->sect_cnt = 0; - size_t sect_map_sz = ldr->hdr.e_shnum * sizeof(uint32_t); + size_t sect_map_sz = ldr->hdr.e_shnum * sizeof(ldr->sect_map[0]); ldr->sect_map = k_heap_alloc(&llext_heap, sect_map_sz, K_NO_WAIT); if (!ldr->sect_map) { @@ -678,7 +678,8 @@ static int do_llext_load(struct llext_loader *ldr, struct llext *ext) ret = -ENOMEM; goto out; } - memset(ldr->sect_map, 0, ldr->hdr.e_shnum*sizeof(uint32_t)); + memset(ldr->sect_map, 0, sect_map_sz); + ldr->sect_cnt = ldr->hdr.e_shnum; ext->mem_size += sect_map_sz; From d9934c10584943018586bd8dc19d2f408e473e0f Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Mon, 20 Nov 2023 15:21:46 +0100 Subject: [PATCH 0076/2300] [nrf fromtree] llext: remove redundant initialisation a new llext object is completely initialised with zeros after allocation, no need to additionally set members of an embedded into it array to NULL. Signed-off-by: Guennadi Liakhovetski (cherry picked from commit b5506feed5a6fc3c1b9a44343deb62ce4445b240) (cherry picked from commit 1f1048a9e98c1b11a9caa0628ab63c2af4200e93) --- subsys/llext/llext.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index 4f43dc17a1d..a24d2b0833f 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -792,10 +792,6 @@ int llext_load(struct llext_loader *ldr, const char *name, struct llext **ext) } memset(*ext, 0, sizeof(struct llext)); - for (int i = 0; i < LLEXT_MEM_COUNT; i++) { - (*ext)->mem[i] = NULL; - } - ldr->hdr = ehdr; ret = do_llext_load(ldr, *ext); break; From d5fef229fe222e17c05b678b92d2e51b2a9ab4cd Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 23 Nov 2023 16:50:20 +0100 Subject: [PATCH 0077/2300] [nrf fromtree] llext: fix read-only extension image When using the LLEXT buffer loader we now avoid copying extensions from storage to allocated memory by pointing directly into the stored image. We then also perform linking and relocation in that memory, which modifies its contents. However, this is impossible if that storage is read-only. Add a Kconfig flag to distinguish between writable and read-only storage types. Also use that flag to decide, whether the extension image in test_llext_simple.c should be defined as const or not. Signed-off-by: Guennadi Liakhovetski (cherry picked from commit dbea13a1c7b10afdb6293b643e3cede34dfa3345) (cherry picked from commit fa777ddca7d6c7a37f512d324c7c8ce69221ddfb) --- subsys/llext/Kconfig | 6 ++++++ subsys/llext/llext.c | 3 ++- tests/subsys/llext/src/test_llext_simple.c | 5 ++++- tests/subsys/llext/testcase.yaml | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/subsys/llext/Kconfig b/subsys/llext/Kconfig index 9fec16cb230..b1210b8f2e8 100644 --- a/subsys/llext/Kconfig +++ b/subsys/llext/Kconfig @@ -27,6 +27,12 @@ config LLEXT_SHELL_MAX_SIZE help When loading llext with shell it is stored in a temporary buffer of this size +config LLEXT_STORAGE_WRITABLE + bool "llext storage is writable" + help + Select if LLEXT storage is writable, i.e. if extensions are stored in + RAM and can be modified in place + module = LLEXT module-str = llext source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index a24d2b0833f..8dd5801bc95 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -242,7 +242,8 @@ static int llext_copy_section(struct llext_loader *ldr, struct llext *ext, return 0; } - if (ldr->sects[sect_idx].sh_type != SHT_NOBITS) { + if (ldr->sects[sect_idx].sh_type != SHT_NOBITS && + IS_ENABLED(CONFIG_LLEXT_STORAGE_WRITABLE)) { ext->mem[mem_idx] = llext_peek(ldr, ldr->sects[sect_idx].sh_offset); if (ext->mem[mem_idx]) { ext->mem_on_heap[mem_idx] = false; diff --git a/tests/subsys/llext/src/test_llext_simple.c b/tests/subsys/llext/src/test_llext_simple.c index d96191c1d72..557697f576c 100644 --- a/tests/subsys/llext/src/test_llext_simple.c +++ b/tests/subsys/llext/src/test_llext_simple.c @@ -10,7 +10,10 @@ #include #if defined(CONFIG_ARM) /* ARMV7 */ || defined(CONFIG_XTENSA) -const static uint8_t hello_world_elf[] __aligned(4) = { +#ifndef CONFIG_LLEXT_STORAGE_WRITABLE +const +#endif +static uint8_t hello_world_elf[] __aligned(4) = { #include "hello_world.inc" }; #endif diff --git a/tests/subsys/llext/testcase.yaml b/tests/subsys/llext/testcase.yaml index 0bbccd5e1ca..2747edf8d0c 100644 --- a/tests/subsys/llext/testcase.yaml +++ b/tests/subsys/llext/testcase.yaml @@ -11,6 +11,8 @@ tests: - nuvoton_pfm_m487 # See #63167 llext.simple.xtensa: arch_allow: xtensa + extra_configs: + - CONFIG_LLEXT_STORAGE_WRITABLE=y # Broken platforms platform_exclude: - qemu_xtensa_mmu # ELF sections are read-only, and without peek() .text copy isn't executable From 1e402ef7906bdda6acdd45aa81220db1a19776d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 21 Nov 2023 08:27:07 +0100 Subject: [PATCH 0078/2300] [nrf fromtree] boards: nrf52840dk_nrf52840: Fix reserved GPIO lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit 7a83724e0f18d7f2400517407150f9e9a1ecd6e6. There is no reason to mark that many GPIO lines as reserved on this board. And doing so causes several existing tests to fail as they are configured to use some of those now unavailable GPIO lines. Limit reservation to the lines that actually cannot be used as GPIOs without changes in the default configuration of the board or its physical modification (via solder bridges), i.e.: - XL1 and XL2 (connections for the 32.768 kHz crystal) - NFC1 and NFC2 (NFC antenna connections) - RESET - TXD and RXD (lines used by the console UART) - QSPI lines: CS, CLK, and DIO0-3 Provide names for all the GPIO lines that are described on the board. Even for the reserved ones, so that it is clear why they are reserved. Signed-off-by: Andrzej Głąbek (cherry picked from commit b172e5133b09ec0c32dbbe74dafa9ef8f2d9da33) (cherry picked from commit de1f9a6bec791ecf6c6d3002bd143a719b3ad069) --- .../nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts b/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts index dcee7b0db5f..60c3ecf55a1 100644 --- a/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts +++ b/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts @@ -149,18 +149,18 @@ &gpio0 { status = "okay"; - gpio-reserved-ranges = <0 11>, <17 7>, <26 6>; - gpio-line-names = "", "", "", "", "", "", "", "", - "", "", "", "BUTTON1", "BUTTON2", "LED1", "LED2", "LED3", - "LED4", "", "", "", "", "", "", "", - "BUTTON3", "BUTTON4", "", "", "", "", "", ""; + gpio-reserved-ranges = <0 2>, <6 1>, <8 3>, <17 7>; + gpio-line-names = "XL1", "XL2", "AREF", "A0", "A1", "RTS", "TXD", + "CTS", "RXD", "NFC1", "NFC2", "BUTTON1", "BUTTON2", "LED1", + "LED2", "LED3", "LED4", "QSPI CS", "RESET", "QSPI CLK", + "QSPI DIO0", "QSPI DIO1", "QSPI DIO2", "QSPI DIO3","BUTTON3", + "BUTTON4", "SDA", "SCL", "A2", "A3", "A4", "A5"; }; &gpio1 { status = "okay"; - gpio-reserved-ranges = <0 1>, <9 1>, <12 4>; gpio-line-names = "", "D0", "D1", "D2", "D3", "D4", "D5", "D6", - "D7", "", "D8", "D9", "", "", "", ""; + "D7", "", "D8", "D9", "D10", "D11", "D12", "D13"; }; &uart0 { From 12ce4cabaf23ec84a5e823c1f1d374fce486cadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 21 Nov 2023 17:36:52 +0100 Subject: [PATCH 0079/2300] [nrf fromtree] tests: drivers: flash: Update nrf52840dk_mx25r_high_perf.overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit 7a83724e0f18d7f2400517407150f9e9a1ecd6e6. This overlay uses an alternative connection (via spi2) for the external flash present on the nRF52840 DK and it needs to use one of the QSPI pins as GPIO, to get CS line control in the SPI communication. To make it possible, that GPIO must be removed from those marked as reserved. Signed-off-by: Andrzej Głąbek (cherry picked from commit 4a262c3947e745fff542a2d78dbedfe460cc2541) (cherry picked from commit 1a7010954b184b1e29c9ad1a9a19600f213e4c03) --- .../flash/common/boards/nrf52840dk_mx25r_high_perf.overlay | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/drivers/flash/common/boards/nrf52840dk_mx25r_high_perf.overlay b/tests/drivers/flash/common/boards/nrf52840dk_mx25r_high_perf.overlay index eabb26ebda6..a67f25e46c0 100644 --- a/tests/drivers/flash/common/boards/nrf52840dk_mx25r_high_perf.overlay +++ b/tests/drivers/flash/common/boards/nrf52840dk_mx25r_high_perf.overlay @@ -1,5 +1,9 @@ /delete-node/ &qspi; +&gpio0 { + gpio-reserved-ranges = <0 2>, <6 1>, <8 3>, <18 6>; +}; + &spi2 { compatible = "nordic,nrf-spim"; status = "okay"; From 639f4f456638271fbf930786221eab429217204e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 21 Nov 2023 17:43:35 +0100 Subject: [PATCH 0080/2300] [nrf fromtree] tests: drivers: flash: Use fixtures for tests requiring external chips MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several scenarios in this test require specific external flash chips to be connected to the nRF52840 DK. Specify proper fixture for them so that they are not performed on the board without those required external components connected. Signed-off-by: Andrzej Głąbek (cherry picked from commit c949018d36bd6a2b0453a52062adcc108060cce4) (cherry picked from commit bea8d6bcc98289cf500718f87b303a3127bcca54) --- tests/drivers/flash/common/testcase.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 9aa13bb40d5..88ce0a40e07 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -21,7 +21,7 @@ tests: - OVERLAY_CONFIG=boards/nrf52840_flash_qspi.conf - DTC_OVERLAY_FILE=boards/nrf52840dk_mx25l51245g.overlay harness_config: - fixture: external_flash + fixture: external_flash_mx25l51245g integration_platforms: - nrf52840dk_nrf52840 drivers.flash.common.soc_flash_nrf: @@ -78,11 +78,15 @@ tests: extra_args: - OVERLAY_CONFIG=boards/nrf52840dk_flash_spi.conf - DTC_OVERLAY_FILE=boards/nrf52840dk_spi_nor.overlay + harness_config: + fixture: external_flash_mx25v1635f drivers.flash.common.spi_nor_wp_hold: platform_allow: nrf52840dk_nrf52840 extra_args: - OVERLAY_CONFIG=boards/nrf52840dk_flash_spi.conf - DTC_OVERLAY_FILE=boards/nrf52840dk_spi_nor_wp_hold.overlay + harness_config: + fixture: external_flash_mx25v1635f drivers.flash.common.sam0: platform_allow: - atsamd20_xpro From 9dd2208c6362a29634c14f6c75ec9cef60ceba04 Mon Sep 17 00:00:00 2001 From: Marcin Jelinski Date: Thu, 4 Jan 2024 14:23:54 +0100 Subject: [PATCH 0081/2300] [nrf fromtree] samples: ipc: multi_endpoint: Fix synchronisation of data receiving The incorrect semaphore was used for the ipc1 instance to synchronise the data receiving. This commit fixes it. Signed-off-by: Marcin Jelinski (cherry picked from commit 7815e52fd15d49c47b4201470b0fe52dab3e3c9c) Signed-off-by: Dominik Ermel (cherry picked from commit a5fa2ffb399f2d98727848c2d37a4d3cfc9af53b) --- samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c | 2 +- samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c b/samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c index 9b288f8a6a1..f285f4b6d23 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c @@ -193,7 +193,7 @@ static void ipc1_ept_recv(const void *data, size_t len, void *priv) { ipc1_received_data = *((uint8_t *) data); - k_sem_give(&ipc0B_data_sem); + k_sem_give(&ipc1_data_sem); } static struct ipc_ept_cfg ipc1_ept_cfg = { diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c b/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c index 78d7af05288..4ad5659df38 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c @@ -190,7 +190,7 @@ static void ipc1_ept_recv(const void *data, size_t len, void *priv) { ipc1_received_data = *((uint8_t *) data); - k_sem_give(&ipc0B_data_sem); + k_sem_give(&ipc1_data_sem); } static struct ipc_ept_cfg ipc1_ept_cfg = { From 22bbd51b60ab3a921e577d2009d7d2d8f395089d Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 4 Dec 2023 14:26:17 -0800 Subject: [PATCH 0082/2300] [nrf fromtree] doc: ext/gh_utils: pass MAINTAINERS.yml to Maintainers This changes to pass full path of MAINTAINERS.yml to get_maintainer.Maintainers(). Without this, Maintainers would use git to find the top level of Zephyr tree. This restricts building of doc only when the build directory is under Zephyr root. Since we have ZEPHYR_BASE in gh_utils, we can pass full path of MAINTAINERS.yml to Maintainers() so that doc build directory no longer has to be under Zephyr root. Fixes #65037 Signed-off-by: Daniel Leung (cherry picked from commit ede9b0337c72ca5312d35961c2bdd4ad9334f42c) (cherry picked from commit 6946f4c6748eebe6c048074c2f1fa0cda9f25cb9) --- doc/_extensions/zephyr/gh_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_extensions/zephyr/gh_utils.py b/doc/_extensions/zephyr/gh_utils.py index 6ba75ce5ab7..2c992436c87 100644 --- a/doc/_extensions/zephyr/gh_utils.py +++ b/doc/_extensions/zephyr/gh_utils.py @@ -53,7 +53,7 @@ from get_maintainer import Maintainers -MAINTAINERS : Final[Maintainers] = Maintainers() +MAINTAINERS : Final[Maintainers] = Maintainers(filename=f"{ZEPHYR_BASE}/MAINTAINERS.yml") __version__ = "0.1.0" From 9dc2f2424ea3693567b624926280d45726fb1879 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 9 Jan 2024 15:23:54 +0100 Subject: [PATCH 0083/2300] [nrf fromlist] doc: extensions: zephyr-domain: fix object descriptions Zephyr's domain code-sample object description was incorrectly yielded, making Sphinx inventory (objects.inv) unusable on other projects that need to use the domain via Intersphinx. Ref. https://www.sphinx-doc.org/en/master/extdev/domainapi.html Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67384 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 139f7c8bb14f14a772ee0d9343bd06d727d9cca3) (cherry picked from commit ed20dd66fdd81408bc26a693c299f829fb05214f) --- doc/_extensions/zephyr/domain.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/_extensions/zephyr/domain.py b/doc/_extensions/zephyr/domain.py index 8c395142818..beb94eb4d2f 100644 --- a/doc/_extensions/zephyr/domain.py +++ b/doc/_extensions/zephyr/domain.py @@ -249,7 +249,7 @@ class ZephyrDomain(Domain): directives = {"code-sample": CodeSampleDirective} object_types: Dict[str, ObjType] = { - "code-sample": ObjType("code sample", "code-sample"), + "code-sample": ObjType("code-sample", "code-sample"), } initial_data: Dict[str, Any] = {"code-samples": {}} @@ -267,9 +267,9 @@ def merge_domaindata(self, docnames: List[str], otherdata: Dict) -> None: def get_objects(self): for _, code_sample in self.data["code-samples"].items(): yield ( + code_sample["id"], code_sample["name"], - code_sample["name"], - "code sample", + "code-sample", code_sample["docname"], code_sample["id"], 1, From 7419d9432bafc8cebb952856f714a32ec58fdba5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 9 Jan 2024 15:34:14 +0100 Subject: [PATCH 0084/2300] [nrf fromlist] doc: extensions: zephyr-domain: make transforms optional So that external users of the domain only interested in e.g. referencing roles, can skip such unneeded transformations. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67384 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit bc7baa515ac10f07592777b76ca4dd8b3139dccc) (cherry picked from commit 774a528ecbc8aae382cc969d8b944b59e4bb9dde) --- doc/_extensions/zephyr/domain.py | 14 +++++++++++++- doc/conf.py | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/_extensions/zephyr/domain.py b/doc/_extensions/zephyr/domain.py index beb94eb4d2f..053965e26e3 100644 --- a/doc/_extensions/zephyr/domain.py +++ b/doc/_extensions/zephyr/domain.py @@ -80,6 +80,9 @@ class ConvertCodeSampleNode(SphinxTransform): default_priority = 100 def apply(self): + if not self.config.zephyr_domain_apply_transforms: + return + matcher = NodeMatcher(CodeSampleNode) for node in self.document.traverse(matcher): self.convert_node(node) @@ -140,6 +143,9 @@ class ProcessRelatedCodeSamplesNode(SphinxPostTransform): default_priority = 5 # before ReferencesResolver def run(self, **kwargs: Any) -> None: + if not self.config.zephyr_domain_apply_transforms: + return + matcher = NodeMatcher(RelatedCodeSamplesNode) for node in self.document.traverse(matcher): id = node["id"] # the ID of the node is the name of the doxygen group for which we @@ -308,10 +314,16 @@ class CustomDoxygenGroupDirective(DoxygenGroupDirective): def run(self) -> List[Node]: nodes = super().run() - return [RelatedCodeSamplesNode(id=self.arguments[0]), *nodes] + + if self.config.zephyr_domain_apply_transforms: + return [RelatedCodeSamplesNode(id=self.arguments[0]), *nodes] + else: + return nodes def setup(app): + app.add_config_value("zephyr_domain_apply_transforms", False, "env") + app.add_domain(ZephyrDomain) app.add_transform(ConvertCodeSampleNode) diff --git a/doc/conf.py b/doc/conf.py index 85488318a0a..4bab42dcc90 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -302,6 +302,10 @@ "build/dts/api/compatibles/**/*", ] +# -- Options for zephyr.domain -------------------------------------------- + +zephyr_domain_apply_transforms = True + # -- Options for sphinx.ext.graphviz -------------------------------------- graphviz_dot = os.environ.get("DOT_EXECUTABLE", "dot") From f6a60ffcdc92f3c972d55aeac56882a0c896897c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 21 Nov 2023 15:59:33 +0100 Subject: [PATCH 0085/2300] [nrf fromtree] tests: logging: log_backend_uart: Disable backends other than UART MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test expects that there are no other backends enabled and some may be enabled by default. Signed-off-by: Krzysztof Chruściński (cherry picked from commit c143daf98dbdc88f2154f86c05c4256d01cb79f2) Signed-off-by: Dominik Ermel (cherry picked from commit ead6b4d1db7209abda3c81a7bd8312eb42ef7a36) --- tests/subsys/logging/log_backend_uart/prj.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/subsys/logging/log_backend_uart/prj.conf b/tests/subsys/logging/log_backend_uart/prj.conf index ef6894f355e..c8615a65adb 100644 --- a/tests/subsys/logging/log_backend_uart/prj.conf +++ b/tests/subsys/logging/log_backend_uart/prj.conf @@ -9,3 +9,8 @@ CONFIG_LOG=y CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_LOG_PRINTK=n +# +# Disable all potential other default backends +CONFIG_LOG_BACKEND_NATIVE_POSIX=n +CONFIG_LOG_BACKEND_RTT=n +CONFIG_LOG_BACKEND_XTENSA_SIM=n From a5bedc35f07c8b3fc617f1571aeb46e79535ea98 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 23 Nov 2023 12:18:17 +0100 Subject: [PATCH 0086/2300] [nrf fromtree] tests: modem: backend: uart: Add fixture to test suite Add fixture to test suite to allow for and signal that the test must be run on real hardware. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit bec7789862ea5449a63626de9c943678c95a13e8) Signed-off-by: Dominik Ermel (cherry picked from commit 883c3709f9c8fd845a8dfa39d2583d5c665a915b) --- .../uart/boards/b_u585i_iot02a.overlay | 35 +++------------- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 42 ++++++++----------- tests/subsys/modem/backends/uart/src/main.c | 2 +- .../subsys/modem/backends/uart/testcase.yaml | 18 ++++---- 4 files changed, 33 insertions(+), 64 deletions(-) diff --git a/tests/subsys/modem/backends/uart/boards/b_u585i_iot02a.overlay b/tests/subsys/modem/backends/uart/boards/b_u585i_iot02a.overlay index 394facef7bb..30402e6e9d2 100644 --- a/tests/subsys/modem/backends/uart/boards/b_u585i_iot02a.overlay +++ b/tests/subsys/modem/backends/uart/boards/b_u585i_iot02a.overlay @@ -1,34 +1,11 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + /* - * Pins 2 and 3 must be connected to each other on the STMOD+1 connector to - * loopback RX/TX. + * The Arduino D0 and D1 must be connected to each other to loopback RX/TX. */ -/ { - aliases { - test-uart = &usart2; - }; -}; - -&gpioh { - misc_fixed_usart2 { - gpio-hog; - gpios = <13 GPIO_ACTIVE_HIGH>; - output-high; - }; -}; - -&gpdma1 { - status = "okay"; -}; - -&usart2 { - pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3 &usart2_rts_pa1 &usart2_cts_pa0>; - pinctrl-names = "default"; - current-speed = <115200>; - - dmas = <&gpdma1 0 27 STM32_DMA_PERIPH_TX - &gpdma1 1 26 STM32_DMA_PERIPH_RX>; +dut: &usart3 { + dmas = <&gpdma1 0 29 STM32_DMA_PERIPH_TX + &gpdma1 1 28 STM32_DMA_PERIPH_RX>; dma-names = "tx", "rx"; - - status = "okay"; }; diff --git a/tests/subsys/modem/backends/uart/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/subsys/modem/backends/uart/boards/nrf5340dk_nrf5340_cpuapp.overlay index 2d47b0f0744..777aebd8d3b 100644 --- a/tests/subsys/modem/backends/uart/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/subsys/modem/backends/uart/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -1,37 +1,31 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + /* - * Pins P1.10 and P1.11 must be connected to each other to loopback RX/TX. + * Pins P0.4 and P0.5 must be connected to each other to loopback RX/TX. */ -/ { - aliases { - test-uart = &uart1; - }; -}; - -&uart1 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart1_default>; - pinctrl-1 = <&uart1_sleep>; - hw-flow-control; - pinctrl-names = "default", "sleep"; -}; - &pinctrl { - uart1_default: uart1_default { + uart1_default_alt: uart1_default_alt { group1 { - psels = ; - }; - group2 { - psels = ; + psels = , + ; }; }; - uart1_sleep: uart1_sleep { + uart1_sleep_alt: uart1_sleep_alt { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; }; + +dut: &uart1 { + compatible = "nordic,nrf-uarte"; + current-speed = <115200>; + status = "okay"; + pinctrl-0 = <&uart1_default_alt>; + pinctrl-1 = <&uart1_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/subsys/modem/backends/uart/src/main.c b/tests/subsys/modem/backends/uart/src/main.c index 8a6c4c2813a..dffc203bb21 100644 --- a/tests/subsys/modem/backends/uart/src/main.c +++ b/tests/subsys/modem/backends/uart/src/main.c @@ -28,7 +28,7 @@ /*************************************************************************************************/ /* Mock pipe */ /*************************************************************************************************/ -static const struct device *uart = DEVICE_DT_GET(DT_ALIAS(test_uart)); +static const struct device *uart = DEVICE_DT_GET(DT_NODELABEL(dut)); static struct modem_backend_uart uart_backend; static struct modem_pipe *pipe; K_SEM_DEFINE(receive_ready_sem, 0, 1); diff --git a/tests/subsys/modem/backends/uart/testcase.yaml b/tests/subsys/modem/backends/uart/testcase.yaml index 626ca639f75..54d8a6b9470 100644 --- a/tests/subsys/modem/backends/uart/testcase.yaml +++ b/tests/subsys/modem/backends/uart/testcase.yaml @@ -1,21 +1,19 @@ # Copyright (c) 2023 Trackunit Corporation # SPDX-License-Identifier: Apache-2.0 +common: + harness: ztest + harness_config: + fixture: gpio_loopback + platform_allow: + - b_u585i_iot02a + - nrf5340dk_nrf5340_cpuapp + tests: modem.backends.uart.async: - tags: modem_backend - harness: ztest - platform_allow: - - b_u585i_iot02a - - nrf5340dk_nrf5340_cpuapp extra_configs: - CONFIG_UART_ASYNC_API=y modem.backends.uart.isr: - tags: modem_backend - harness: ztest - platform_allow: - - b_u585i_iot02a - - nrf5340dk_nrf5340_cpuapp extra_configs: - CONFIG_UART_INTERRUPT_DRIVEN=y From 9d3acb7a7d46e96bb2f93c0faa251deedc3f31c4 Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Tue, 7 Feb 2023 12:39:12 +0100 Subject: [PATCH 0087/2300] [nrf noup] Bluetooth: Mesh: zero randomization for friend's adv Friend's replies on LPN's polls do not assume randomization in advertiser. Zero randomization will help to optimize time when LPN keeps receiving window open and save power. Signed-off-by: Aleksandr Khromykh (cherry picked from commit 468009977970899f2d250231847e160671f74d18) --- subsys/bluetooth/mesh/Kconfig | 2 +- subsys/bluetooth/mesh/adv_ext.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index de409e9c53c..04366828bbe 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -958,7 +958,7 @@ config BT_MESH_LPN_INIT_POLL_TIMEOUT config BT_MESH_LPN_SCAN_LATENCY int "Latency for enabling scanning" range 0 50 - default 15 + default 2 help Latency in milliseconds that it takes to enable scanning. This is in practice how much time in advance before the Receive Window diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 0bfc2041c7d..0c11fc0053a 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -13,6 +13,9 @@ #include #include #include +#if defined(CONFIG_BT_LL_SOFTDEVICE) +#include +#endif #include "common/bt_str.h" @@ -136,6 +139,28 @@ static inline struct bt_mesh_ext_adv *gatt_adv_get(void) } } +static int set_adv_randomness(uint8_t handle, int rand_us) +{ +#if defined(CONFIG_BT_LL_SOFTDEVICE) + struct net_buf *buf; + sdc_hci_cmd_vs_set_adv_randomness_t *cmd_params; + + buf = bt_hci_cmd_create(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, sizeof(*cmd_params)); + if (!buf) { + LOG_ERR("Could not allocate command buffer"); + return -ENOMEM; + } + + cmd_params = net_buf_add(buf, sizeof(*cmd_params)); + cmd_params->adv_handle = handle; + cmd_params->rand_us = rand_us; + + return bt_hci_cmd_send_sync(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, buf, NULL); +#else + return 0; +#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ +} + static int adv_start(struct bt_mesh_ext_adv *adv, const struct bt_le_adv_param *param, struct bt_le_ext_adv_start_param *start, @@ -501,6 +526,13 @@ int bt_mesh_adv_enable(void) if (err) { return err; } + + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { + err = set_adv_randomness(adv->instance->handle, 0); + if (err) { + LOG_ERR("Failed to set zero randomness: %d", err); + } + } } return 0; From e1fe018383adce3b5082ccd5d1de23d099cede59 Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Wed, 22 Nov 2023 16:24:48 +0100 Subject: [PATCH 0088/2300] [nrf fromtree] Bluetooth: Mesh: allocate mesh max required buffer number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since sending of public key was moved into system work (https://github.com/zephyrproject-rtos/zephyr/pull/62331) it uses the same context as a Host Tx buffer allocator for gatt sending. Host cannot wait for free buffer anymore. Mesh requires 4 buffers to send max size frame(public key) during provisioning. Signed-off-by: Aleksandr Khromykh (cherry picked from commit 3d37549bac90f2008c5e7cfc41ec79c553dbe99a) Signed-off-by: Håvard Reierstad (cherry picked from commit accb038d8c6a7c7fc9afa522e781c5d87bd68b56) --- subsys/bluetooth/common/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index bf4aee75e48..7b6bc839b89 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -33,6 +33,7 @@ config BT_BUF_ACL_TX_SIZE config BT_BUF_ACL_TX_COUNT int "Number of outgoing ACL data buffers" default 7 if BT_HCI_RAW + default 4 if BT_MESH_GATT default 3 range 1 255 help From 584d436c9fdf75979fdf3c06f1ae69619ce65f3c Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0089/2300] [nrf fromtree] Bluetooth: Mesh: Use ATOMIC_DEFINE instead of atomic_t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit atomic_*_bit functions work with atomic_t arg as with array, therefore the atomic variable should be declared using ATOMIC_DEFINE. Coverity-CID: 333358 Fixes #65588 Signed-off-by: Pavel Vasilyev (cherry picked from commit 362924a6939814fe527987c4a6d27a728bb2e1eb) Signed-off-by: Håvard Reierstad (cherry picked from commit 64e37c9348350f47639cfaa6e2ff7d63e58ba025) --- subsys/bluetooth/mesh/rpl.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/mesh/rpl.c b/subsys/bluetooth/mesh/rpl.c index b3113530854..e19df33908f 100644 --- a/subsys/bluetooth/mesh/rpl.c +++ b/subsys/bluetooth/mesh/rpl.c @@ -41,8 +41,9 @@ static ATOMIC_DEFINE(store, CONFIG_BT_MESH_CRPL); enum { PENDING_CLEAR, PENDING_RESET, + RPL_FLAGS_COUNT, }; -static atomic_t rpl_flags; +static ATOMIC_DEFINE(rpl_flags, RPL_FLAGS_COUNT); static inline int rpl_idx(const struct bt_mesh_rpl *rpl) { @@ -133,7 +134,7 @@ bool bt_mesh_rpl_check(struct bt_mesh_net_rx *rx, /* Existing slot for given address */ if (rpl->src == rx->ctx.addr) { if (!rpl->old_iv && - atomic_test_bit(&rpl_flags, PENDING_RESET) && + atomic_test_bit(rpl_flags, PENDING_RESET) && !atomic_test_bit(store, i)) { /* Until rpl reset is finished, entry with old_iv == false and * without "store" bit set will be removed, therefore it can be @@ -178,7 +179,7 @@ void bt_mesh_rpl_clear(void) return; } - atomic_set_bit(&rpl_flags, PENDING_CLEAR); + atomic_set_bit(rpl_flags, PENDING_CLEAR); bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_RPL_PENDING); } @@ -233,7 +234,7 @@ void bt_mesh_rpl_reset(void) } if (i != 0) { - atomic_set_bit(&rpl_flags, PENDING_RESET); + atomic_set_bit(rpl_flags, PENDING_RESET); bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_RPL_PENDING); } } else { @@ -358,8 +359,8 @@ void bt_mesh_rpl_pending_store(uint16_t addr) bt_mesh_settings_store_cancel(BT_MESH_SETTINGS_RPL_PENDING); } - clr = atomic_test_and_clear_bit(&rpl_flags, PENDING_CLEAR); - rst = atomic_test_bit(&rpl_flags, PENDING_RESET); + clr = atomic_test_and_clear_bit(rpl_flags, PENDING_CLEAR); + rst = atomic_test_bit(rpl_flags, PENDING_RESET); for (int i = 0; i < ARRAY_SIZE(replay_list); i++) { struct bt_mesh_rpl *rpl = &replay_list[i]; @@ -398,7 +399,7 @@ void bt_mesh_rpl_pending_store(uint16_t addr) } } - atomic_clear_bit(&rpl_flags, PENDING_RESET); + atomic_clear_bit(rpl_flags, PENDING_RESET); if (addr == BT_MESH_ADDR_ALL_NODES) { (void)memset(&replay_list[last - shift + 1], 0, sizeof(struct bt_mesh_rpl) * shift); From a4a44a56bd231df42845597e3b8a46a4ddfd019e Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0090/2300] [nrf fromtree] Bluetooth: Mesh: Return immediately if labels not supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoid unnecessary triggering of settings work. Signed-off-by: Pavel Vasilyev (cherry picked from commit 161aadd5909e610fa5e25a5912c882403718e21e) Signed-off-by: Håvard Reierstad (cherry picked from commit 17fa0a84c7f6fbe2286a8b415b939160516bbae2) --- subsys/bluetooth/mesh/va.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/bluetooth/mesh/va.c b/subsys/bluetooth/mesh/va.c index 6db9194da47..b69c22f40e9 100644 --- a/subsys/bluetooth/mesh/va.c +++ b/subsys/bluetooth/mesh/va.c @@ -306,6 +306,10 @@ void bt_mesh_va_clear(void) { int i; + if (CONFIG_BT_MESH_LABEL_COUNT == 0) { + return; + } + for (i = 0; i < ARRAY_SIZE(virtual_addrs); i++) { if (virtual_addrs[i].ref) { virtual_addrs[i].ref = 0U; From 77a5867648e81c2f75cf3853c06da02b0965604c Mon Sep 17 00:00:00 2001 From: Mia Koen Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0091/2300] [nrf fromtree] bluetooth: mesh: Doc fix Bluetooth mesh to Mesh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SIG has changed Bluetooth mesh to Bluetooth Mesh Updating zephyr docs accordingly Leaving out old release notes Signed-off-by: Mia Koen (cherry picked from commit 0bcad093927267f5dc3b4f7d08409265baf82f23) Signed-off-by: Håvard Reierstad (cherry picked from commit e9382bacb83cffda685d77a5d94702f577d41303) --- boards/arm/nrf52840_mdk/doc/index.rst | 2 +- boards/riscv/esp32c3_devkitm/doc/index.rst | 2 +- .../riscv/esp32c3_luatos_core/doc/index.rst | 2 +- doc/connectivity/bluetooth/api/mesh.rst | 4 +-- .../bluetooth/api/mesh/access.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/blob.rst | 6 ++-- .../bluetooth/api/mesh/blob_cli.rst | 2 +- .../bluetooth/api/mesh/blob_srv.rst | 2 +- doc/connectivity/bluetooth/api/mesh/cfg.rst | 2 +- .../bluetooth/api/mesh/cfg_cli.rst | 2 +- .../bluetooth/api/mesh/cfg_srv.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/core.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/dfu.rst | 24 ++++++------- .../bluetooth/api/mesh/dfu_srv.rst | 8 ++--- .../bluetooth/api/mesh/health_srv.rst | 4 +-- .../bluetooth/api/mesh/heartbeat.rst | 2 +- .../bluetooth/api/mesh/lcd_cli.rst | 2 +- .../bluetooth/api/mesh/lcd_srv.rst | 2 +- .../bluetooth/api/mesh/models.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/msg.rst | 2 +- .../bluetooth/api/mesh/od_cli.rst | 2 +- .../bluetooth/api/mesh/od_srv.rst | 2 +- .../bluetooth/api/mesh/op_agg_cli.rst | 2 +- .../bluetooth/api/mesh/priv_beacon_cli.rst | 2 +- .../bluetooth/api/mesh/priv_beacon_srv.rst | 2 +- .../bluetooth/api/mesh/provisioning.rst | 8 ++--- doc/connectivity/bluetooth/api/mesh/proxy.rst | 2 +- .../bluetooth/api/mesh/sar_cfg.rst | 4 +-- .../bluetooth/api/mesh/sar_cfg_cli.rst | 2 +- .../bluetooth/api/mesh/sar_cfg_srv.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/shell.rst | 34 +++++++++---------- doc/connectivity/bluetooth/bluetooth-arch.rst | 2 +- doc/connectivity/bluetooth/overview.rst | 2 +- doc/introduction/index.rst | 2 +- doc/kernel/timeutil.rst | 2 +- doc/security/vulnerabilities.rst | 4 +-- include/zephyr/bluetooth/mesh.h | 2 +- include/zephyr/bluetooth/mesh/blob_srv.h | 2 +- include/zephyr/bluetooth/mesh/cfg.h | 2 +- include/zephyr/bluetooth/mesh/dfu_cli.h | 2 +- include/zephyr/bluetooth/mesh/dfu_metadata.h | 4 +-- include/zephyr/bluetooth/mesh/dfu_srv.h | 4 +-- include/zephyr/bluetooth/mesh/main.h | 6 ++-- samples/bluetooth/mesh/README.rst | 2 +- samples/bluetooth/mesh_demo/README.rst | 2 +- samples/bluetooth/mesh_provisioner/README.rst | 2 +- samples/boards/nrf/mesh/onoff-app/README.rst | 2 +- .../onoff_level_lighting_vnd_app/README.rst | 2 +- .../boards/reel_board/mesh_badge/README.rst | 4 +-- subsys/bluetooth/Kconfig.logging | 26 +++++++------- subsys/bluetooth/common/Kconfig | 2 +- subsys/bluetooth/mesh/Kconfig | 20 +++++------ subsys/bluetooth/mesh/access.h | 2 +- subsys/bluetooth/mesh/settings.c | 2 +- subsys/bluetooth/mesh/shell/Kconfig | 10 +++--- subsys/bluetooth/mesh/shell/shell.c | 2 +- tests/bsim/bluetooth/mesh/README.rst | 14 ++++---- tests/bsim/bluetooth/mesh/prj.conf | 2 +- tests/bsim/bluetooth/mesh/prj_mesh1d1.conf | 2 +- tests/bsim/bluetooth/mesh/src/mesh_test.h | 2 +- 60 files changed, 140 insertions(+), 140 deletions(-) diff --git a/boards/arm/nrf52840_mdk/doc/index.rst b/boards/arm/nrf52840_mdk/doc/index.rst index fce05bee593..6e0b24b65f2 100644 --- a/boards/arm/nrf52840_mdk/doc/index.rst +++ b/boards/arm/nrf52840_mdk/doc/index.rst @@ -7,7 +7,7 @@ Overview ******** The nRF52840-MDK is a versatile, easy-to-use IoT hardware platform for -Bluetooth 5, Bluetooth mesh, Thread, IEEE 802.15.4, ANT and 2.4GHz proprietary +Bluetooth 5, Bluetooth Mesh, Thread, IEEE 802.15.4, ANT and 2.4GHz proprietary applications using the nRF52840 SoC. The development kit comes with a fully integrated debugger (also known as diff --git a/boards/riscv/esp32c3_devkitm/doc/index.rst b/boards/riscv/esp32c3_devkitm/doc/index.rst index 6d21b2918c3..26f1521e087 100644 --- a/boards/riscv/esp32c3_devkitm/doc/index.rst +++ b/boards/riscv/esp32c3_devkitm/doc/index.rst @@ -18,7 +18,7 @@ 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 +- A Bluetooth LE subsystem that supports features of Bluetooth 5 and Bluetooth Mesh - Various peripherals: - 12-bit ADC with up to 6 channels diff --git a/boards/riscv/esp32c3_luatos_core/doc/index.rst b/boards/riscv/esp32c3_luatos_core/doc/index.rst index c943931a9e6..fae8e2eb178 100644 --- a/boards/riscv/esp32c3_luatos_core/doc/index.rst +++ b/boards/riscv/esp32c3_luatos_core/doc/index.rst @@ -18,7 +18,7 @@ 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 +- A Bluetooth LE subsystem that supports features of Bluetooth 5 and Bluetooth Mesh - Various peripherals: - 12-bit ADC with up to 6 channels diff --git a/doc/connectivity/bluetooth/api/mesh.rst b/doc/connectivity/bluetooth/api/mesh.rst index 457aa5b6895..f234ff7cedc 100644 --- a/doc/connectivity/bluetooth/api/mesh.rst +++ b/doc/connectivity/bluetooth/api/mesh.rst @@ -3,14 +3,14 @@ Bluetooth Mesh Profile ###################### -The Bluetooth mesh profile adds secure wireless multi-hop communication for +The Bluetooth Mesh profile adds secure wireless multi-hop communication for Bluetooth Low Energy. This module implements the `Bluetooth Mesh Profile Specification v1.0.1 `_. Implementation of the `Bluetooth Mesh Protocol Specification v1.1 `_ is in experimental state. -Read more about Bluetooth mesh on the +Read more about Bluetooth Mesh on the `Bluetooth SIG Website `_. .. toctree:: diff --git a/doc/connectivity/bluetooth/api/mesh/access.rst b/doc/connectivity/bluetooth/api/mesh/access.rst index 2af8e6a03b8..e4a94440556 100644 --- a/doc/connectivity/bluetooth/api/mesh/access.rst +++ b/doc/connectivity/bluetooth/api/mesh/access.rst @@ -3,7 +3,7 @@ Access layer ############ -The access layer is the application's interface to the Bluetooth mesh network. +The access layer is the application's interface to the Bluetooth Mesh network. The access layer provides mechanisms for compartmentalizing the node behavior into elements and models, which are implemented by the application. @@ -113,7 +113,7 @@ number within one publication interval. Extended models =============== -The Bluetooth mesh specification allows the mesh models to extend each other. +The Bluetooth Mesh specification allows the mesh models to extend each other. When a model extends another, it inherits that model's functionality, and extension can be used to construct complex models out of simple ones, leveraging the existing model functionality to avoid defining new opcodes. diff --git a/doc/connectivity/bluetooth/api/mesh/blob.rst b/doc/connectivity/bluetooth/api/mesh/blob.rst index 31f45289560..8395026afe4 100644 --- a/doc/connectivity/bluetooth/api/mesh/blob.rst +++ b/doc/connectivity/bluetooth/api/mesh/blob.rst @@ -5,7 +5,7 @@ BLOB Transfer models The Binary Large Object (BLOB) Transfer models implement the Bluetooth Mesh Binary Large Object Transfer Model specification version 1.0 and provide functionality for sending large binary objects -from a single source to many Target nodes over the Bluetooth mesh network. It is the underlying +from a single source to many Target nodes over the Bluetooth Mesh network. It is the underlying transport method for the :ref:`bluetooth_mesh_dfu`, but may be used for other object transfer purposes. The implementation is in experimental state. @@ -50,7 +50,7 @@ structure of the BLOB, and applications are free to define any encoding or compr on the data itself. The BLOB transfer protocol does not provide any built-in integrity checks, encryption or -authentication of the BLOB data. However, the underlying encryption of the Bluetooth mesh protocol +authentication of the BLOB data. However, the underlying encryption of the Bluetooth Mesh protocol provides data integrity checks and protects the contents of the BLOB from third parties using network and application level encryption. @@ -68,7 +68,7 @@ Chunks ------ Each block is divided into chunks. A chunk is the smallest data unit in the BLOB transfer, and must -fit inside a single Bluetooth mesh access message excluding the opcode (379 bytes or less). The +fit inside a single Bluetooth Mesh access message excluding the opcode (379 bytes or less). The mechanism for transferring chunks depends on the transfer mode. When operating in Push BLOB Transfer Mode, the chunks are sent as unacknowledged packets from the diff --git a/doc/connectivity/bluetooth/api/mesh/blob_cli.rst b/doc/connectivity/bluetooth/api/mesh/blob_cli.rst index 25b90c281c4..b4193d50334 100644 --- a/doc/connectivity/bluetooth/api/mesh/blob_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/blob_cli.rst @@ -67,7 +67,7 @@ Target nodes having the BLOB Transfer Server model subscribe to this group addre Using group addresses for transferring the BLOBs can generally increase the transfer speed, as the BLOB Transfer Client sends each message to all Target nodes at the same time. However, sending -large, segmented messages to group addresses in Bluetooth mesh is generally less reliable than +large, segmented messages to group addresses in Bluetooth Mesh is generally less reliable than sending them to unicast addresses, as there is no transport layer acknowledgment mechanism for groups. This can lead to longer recovery periods at the end of each block, and increases the risk of losing Target nodes. Using group addresses for BLOB transfers will generally only pay off if the diff --git a/doc/connectivity/bluetooth/api/mesh/blob_srv.rst b/doc/connectivity/bluetooth/api/mesh/blob_srv.rst index 918b9493ff9..0d13e92148e 100644 --- a/doc/connectivity/bluetooth/api/mesh/blob_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/blob_srv.rst @@ -77,7 +77,7 @@ Transfer recovery ***************** The state of the BLOB transfer is stored persistently. If a reboot occurs, the BLOB Transfer Server -will attempt to recover the transfer. When the Bluetooth mesh subsystem is started (for instance by +will attempt to recover the transfer. When the Bluetooth Mesh subsystem is started (for instance by calling :c:func:`bt_mesh_init`), the BLOB Transfer Server will check for aborted transfers, and call the :c:member:`recover ` callback if there is any. In the recover callback, the user must provide a BLOB stream to use for the rest of the transfer. If the recover diff --git a/doc/connectivity/bluetooth/api/mesh/cfg.rst b/doc/connectivity/bluetooth/api/mesh/cfg.rst index 01d3c9ca2e5..e178984210d 100644 --- a/doc/connectivity/bluetooth/api/mesh/cfg.rst +++ b/doc/connectivity/bluetooth/api/mesh/cfg.rst @@ -6,7 +6,7 @@ Runtime Configuration The runtime configuration API allows applications to change their runtime configuration directly, without going through the Configuration models. -Bluetooth mesh nodes should generally be configured by a central network +Bluetooth Mesh nodes should generally be configured by a central network configurator device with a :ref:`bluetooth_mesh_models_cfg_cli` model. Each mesh node instantiates a :ref:`bluetooth_mesh_models_cfg_srv` model that the Configuration Client can communicate with to change the node configuration. In some diff --git a/doc/connectivity/bluetooth/api/mesh/cfg_cli.rst b/doc/connectivity/bluetooth/api/mesh/cfg_cli.rst index bf84edc6b86..300c8ee3bc1 100644 --- a/doc/connectivity/bluetooth/api/mesh/cfg_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/cfg_cli.rst @@ -3,7 +3,7 @@ Configuration Client #################### -The Configuration Client model is a foundation model defined by the Bluetooth mesh +The Configuration Client model is a foundation model defined by the Bluetooth Mesh specification. It provides functionality for configuring most parameters of a mesh node, including encryption keys, model configuration and feature enabling. diff --git a/doc/connectivity/bluetooth/api/mesh/cfg_srv.rst b/doc/connectivity/bluetooth/api/mesh/cfg_srv.rst index 84f174df88b..8f595bf9b11 100644 --- a/doc/connectivity/bluetooth/api/mesh/cfg_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/cfg_srv.rst @@ -3,7 +3,7 @@ Configuration Server #################### -The Configuration Server model is a foundation model defined by the Bluetooth mesh +The Configuration Server model is a foundation model defined by the Bluetooth Mesh specification. The Configuration Server model controls most parameters of the mesh node. It does not have an API of its own, but relies on a :ref:`bluetooth_mesh_models_cfg_cli` to control it. @@ -14,7 +14,7 @@ mesh node. It does not have an API of its own, but relies on a should be set through Kconfig, and the Heartbeat feature should be controlled through the :ref:`bluetooth_mesh_heartbeat` API. -The Configuration Server model is mandatory on all Bluetooth mesh nodes, and +The Configuration Server model is mandatory on all Bluetooth Mesh nodes, and must only be instantiated on the primary element. API reference diff --git a/doc/connectivity/bluetooth/api/mesh/core.rst b/doc/connectivity/bluetooth/api/mesh/core.rst index b9fdd164257..94e2b8a6e5e 100644 --- a/doc/connectivity/bluetooth/api/mesh/core.rst +++ b/doc/connectivity/bluetooth/api/mesh/core.rst @@ -3,7 +3,7 @@ Core #### -The core provides functionality for managing the general Bluetooth mesh +The core provides functionality for managing the general Bluetooth Mesh state. .. _bluetooth_mesh_lpn: @@ -117,7 +117,7 @@ Advertisement identity All mesh stack bearers advertise data with the :c:macro:`BT_ID_DEFAULT` local identity. The value is preset in the mesh stack implementation. When Bluetooth® Low Energy (LE) -and Bluetooth mesh coexist on the same device, the application should allocate and +and Bluetooth Mesh coexist on the same device, the application should allocate and configure another local identity for Bluetooth LE purposes before starting the communication. API reference diff --git a/doc/connectivity/bluetooth/api/mesh/dfu.rst b/doc/connectivity/bluetooth/api/mesh/dfu.rst index 9cf55e244d6..6718b3ea0ce 100644 --- a/doc/connectivity/bluetooth/api/mesh/dfu.rst +++ b/doc/connectivity/bluetooth/api/mesh/dfu.rst @@ -3,16 +3,16 @@ Device Firmware Update (DFU) ############################ -Bluetooth mesh supports the distribution of firmware images across a mesh network. The Bluetooth +Bluetooth Mesh supports the distribution of firmware images across a mesh network. The Bluetooth mesh DFU subsystem implements the Bluetooth Mesh Device Firmware Update Model specification version 1.0. The implementation is in experimental state. -Bluetooth mesh DFU implements a distribution mechanism for firmware images, and does not put any +Bluetooth Mesh DFU implements a distribution mechanism for firmware images, and does not put any restrictions on the size, format or usage of the images. The primary design goal of the subsystem is -to provide the qualifiable parts of the Bluetooth mesh DFU specification, and leave the usage, +to provide the qualifiable parts of the Bluetooth Mesh DFU specification, and leave the usage, firmware validation and deployment to the application. -The DFU specification is implemented in the Zephyr Bluetooth mesh DFU subsystem as three separate +The DFU specification is implemented in the Zephyr Bluetooth Mesh DFU subsystem as three separate models: .. toctree:: @@ -28,7 +28,7 @@ Overview DFU roles ========= -The Bluetooth mesh DFU subsystem defines three different roles the mesh nodes have to assume in the +The Bluetooth Mesh DFU subsystem defines three different roles the mesh nodes have to assume in the distribution of firmware images: Target node @@ -47,20 +47,20 @@ Distributor image to the Target nodes. Initiator - The Initiator role is typically implemented by the same device that implements the Bluetooth mesh + The Initiator role is typically implemented by the same device that implements the Bluetooth Mesh :ref:`Provisioner ` and :ref:`Configurator ` roles. The Initiator needs a full overview of the potential Target nodes and their firmware, and will control (and initiate) all firmware updates. The - Initiator role is not implemented in the Zephyr Bluetooth mesh DFU subsystem. + Initiator role is not implemented in the Zephyr Bluetooth Mesh DFU subsystem. .. figure:: images/dfu_roles_mesh.svg :align: center :alt: Graphic overview of the DFU roles mesh nodes can have during the process of image distribution - DFU roles and the associated Bluetooth mesh models + DFU roles and the associated Bluetooth Mesh models -Bluetooth mesh applications may combine the DFU roles in any way they'd like, and even take on +Bluetooth Mesh applications may combine the DFU roles in any way they'd like, and even take on multiple instances of the same role by instantiating the models on separate elements. For instance, the Distributor and Initiator role can be combined by instantiating the :ref:`bluetooth_mesh_dfu_cli` on the Initiator node and calling its API directly. @@ -76,7 +76,7 @@ Firmware Update Client model directly, e.g. over a serial protocol. Stages ====== -The Bluetooth mesh DFU process is designed to act in three stages: +The Bluetooth Mesh DFU process is designed to act in three stages: Upload stage First, the image is uploaded to a Distributor in a mesh network by an external entity, such as a @@ -131,7 +131,7 @@ Firmware metadata Target node. The firmware metadata is optional, and its maximum length is determined by :kconfig:option:`CONFIG_BT_MESH_DFU_METADATA_MAXLEN`. - The Bluetooth mesh DFU subsystem in Zephyr provides its own metadata format + The Bluetooth Mesh DFU subsystem in Zephyr provides its own metadata format (:c:struct:`bt_mesh_dfu_metadata`) together with a set of related functions that can be used by an end product. The support for it is enabled using the :kconfig:option:`CONFIG_BT_MESH_DFU_METADATA` option. The format of the metadata is presented in @@ -299,7 +299,7 @@ following steps: node firmware image index and the firmware image metadata. Each Target node performs a metadata check and prepares their BLOB Transfer Server model for the transfer, before sending a status response to the Firmware Update Client, indicating if the firmware update will have any effect on - the Bluetooth mesh state of the node. + the Bluetooth Mesh state of the node. #. The Distributor's BLOB Transfer Client model transfers the firmware image to all Target nodes. #. Once the BLOB transfer has been received, the Target nodes' applications verify that the firmware is valid by performing checks such as signature verification or image checksums against the image diff --git a/doc/connectivity/bluetooth/api/mesh/dfu_srv.rst b/doc/connectivity/bluetooth/api/mesh/dfu_srv.rst index 2642dec8cc9..105bdecb86c 100644 --- a/doc/connectivity/bluetooth/api/mesh/dfu_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/dfu_srv.rst @@ -16,7 +16,7 @@ Firmware images The Firmware Update Server holds a list of all the updatable firmware images on the device. The full list shall be passed to the server through the ``_imgs`` parameter in -:c:macro:`BT_MESH_DFU_SRV_INIT`, and must be populated before the Bluetooth mesh subsystem is +:c:macro:`BT_MESH_DFU_SRV_INIT`, and must be populated before the Bluetooth Mesh subsystem is started. Each firmware image in the image list must be independently updatable, and should have its own firmware ID. @@ -33,9 +33,9 @@ application is described below: .. figure:: images/dfu_srv.svg :align: center - :alt: Bluetooth mesh Firmware Update Server transfer + :alt: Bluetooth Mesh Firmware Update Server transfer - Bluetooth mesh Firmware Update Server transfer + Bluetooth Mesh Firmware Update Server transfer Transfer check ============== @@ -118,7 +118,7 @@ updated image. When the transfer applies to the mesh application itself, the device might have to reboot as part of the swap. This restart can be performed from inside the apply callback, or done asynchronously. After booting up with the new firmware, the firmware image table should be updated before the -Bluetooth mesh subsystem is started. +Bluetooth Mesh subsystem is started. The Distributor will read out the firmware image table to confirm that the transfer was successfully applied. If the metadata check indicated that the device would become unprovisioned, the Target node diff --git a/doc/connectivity/bluetooth/api/mesh/health_srv.rst b/doc/connectivity/bluetooth/api/mesh/health_srv.rst index 84c543b4766..6f7b1fc3f33 100644 --- a/doc/connectivity/bluetooth/api/mesh/health_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/health_srv.rst @@ -21,7 +21,7 @@ necessarily damaging to the device. Errors indicate conditions that are outside of the node's design limits, and may have caused invalid behavior or permanent damage to the device. -Fault values ``0x01`` to ``0x7f`` are reserved for the Bluetooth mesh +Fault values ``0x01`` to ``0x7f`` are reserved for the Bluetooth Mesh specification, and the full list of specification defined faults are available in :ref:`bluetooth_mesh_health_faults`. Fault values ``0x80`` to ``0xff`` are vendor specific. The list of faults are always reported with a company ID to @@ -57,6 +57,6 @@ API reference Health faults ============= -Fault values defined by the Bluetooth mesh specification. +Fault values defined by the Bluetooth Mesh specification. .. doxygengroup:: bt_mesh_health_faults diff --git a/doc/connectivity/bluetooth/api/mesh/heartbeat.rst b/doc/connectivity/bluetooth/api/mesh/heartbeat.rst index 16c2bfa7840..706625849c1 100644 --- a/doc/connectivity/bluetooth/api/mesh/heartbeat.rst +++ b/doc/connectivity/bluetooth/api/mesh/heartbeat.rst @@ -3,7 +3,7 @@ Heartbeat ######### -The Heartbeat feature provides functionality for monitoring Bluetooth mesh nodes +The Heartbeat feature provides functionality for monitoring Bluetooth Mesh nodes and determining the distance between nodes. The Heartbeat feature is configured through the :ref:`bluetooth_mesh_models_cfg_srv` model. diff --git a/doc/connectivity/bluetooth/api/mesh/lcd_cli.rst b/doc/connectivity/bluetooth/api/mesh/lcd_cli.rst index 0eca28f1b2a..96189e21dd3 100644 --- a/doc/connectivity/bluetooth/api/mesh/lcd_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/lcd_cli.rst @@ -3,7 +3,7 @@ Large Composition Data Client ############################# -The Large Composition Data Client model is a foundation model defined by the Bluetooth mesh +The Large Composition Data Client model is a foundation model defined by the Bluetooth Mesh specification. The model is optional, and is enabled through the :kconfig:option:`CONFIG_BT_MESH_LARGE_COMP_DATA_CLI` option. diff --git a/doc/connectivity/bluetooth/api/mesh/lcd_srv.rst b/doc/connectivity/bluetooth/api/mesh/lcd_srv.rst index f96436138b7..f67b31c27f8 100644 --- a/doc/connectivity/bluetooth/api/mesh/lcd_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/lcd_srv.rst @@ -3,7 +3,7 @@ Large Composition Data Server ############################# -The Large Composition Data Server model is a foundation model defined by the Bluetooth mesh +The Large Composition Data Server model is a foundation model defined by the Bluetooth Mesh specification. The model is optional, and is enabled through the :kconfig:option:`CONFIG_BT_MESH_LARGE_COMP_DATA_SRV` option. diff --git a/doc/connectivity/bluetooth/api/mesh/models.rst b/doc/connectivity/bluetooth/api/mesh/models.rst index 3f5f94152ce..94c3914ca53 100644 --- a/doc/connectivity/bluetooth/api/mesh/models.rst +++ b/doc/connectivity/bluetooth/api/mesh/models.rst @@ -6,7 +6,7 @@ Mesh models Foundation models ***************** -The Bluetooth mesh specification defines foundation models that can be +The Bluetooth Mesh specification defines foundation models that can be used by network administrators to configure and diagnose mesh nodes. .. toctree:: @@ -34,7 +34,7 @@ used by network administrators to configure and diagnose mesh nodes. Model specification models ************************** -In addition to the foundation models defined in the Bluetooth mesh specification, the Bluetooth Mesh +In addition to the foundation models defined in the Bluetooth Mesh specification, the Bluetooth Mesh Model Specification defines several models, some of which are implemented in Zephyr: .. toctree:: diff --git a/doc/connectivity/bluetooth/api/mesh/msg.rst b/doc/connectivity/bluetooth/api/mesh/msg.rst index ae8b968198a..614d2604d90 100644 --- a/doc/connectivity/bluetooth/api/mesh/msg.rst +++ b/doc/connectivity/bluetooth/api/mesh/msg.rst @@ -3,7 +3,7 @@ Message ####### -The Bluetooth mesh message provides set of structures, macros and functions used +The Bluetooth Mesh message provides set of structures, macros and functions used for preparing message buffers, managing message and acknowledged message contexts. diff --git a/doc/connectivity/bluetooth/api/mesh/od_cli.rst b/doc/connectivity/bluetooth/api/mesh/od_cli.rst index 5fc841716ce..e419acb7572 100644 --- a/doc/connectivity/bluetooth/api/mesh/od_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/od_cli.rst @@ -3,7 +3,7 @@ On-Demand Private Proxy Client ############################## -The On-Demand Private Proxy Client model is a foundation model defined by the Bluetooth mesh +The On-Demand Private Proxy Client model is a foundation model defined by the Bluetooth Mesh specification. The model is optional, and is enabled with the :kconfig:option:`CONFIG_BT_MESH_OD_PRIV_PROXY_CLI` option. diff --git a/doc/connectivity/bluetooth/api/mesh/od_srv.rst b/doc/connectivity/bluetooth/api/mesh/od_srv.rst index 700517e4283..3c2f993bb30 100644 --- a/doc/connectivity/bluetooth/api/mesh/od_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/od_srv.rst @@ -3,7 +3,7 @@ On-Demand Private Proxy Server ############################## -The On-Demand Private Proxy Server model is a foundation model defined by the Bluetooth mesh +The On-Demand Private Proxy Server model is a foundation model defined by the Bluetooth Mesh specification. It is enabled with the :kconfig:option:`CONFIG_BT_MESH_OD_PRIV_PROXY_SRV` option. The On-Demand Private Proxy Server model was introduced in the Bluetooth Mesh Protocol Specification diff --git a/doc/connectivity/bluetooth/api/mesh/op_agg_cli.rst b/doc/connectivity/bluetooth/api/mesh/op_agg_cli.rst index 148557a4e81..4648b4495cd 100644 --- a/doc/connectivity/bluetooth/api/mesh/op_agg_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/op_agg_cli.rst @@ -3,7 +3,7 @@ Opcodes Aggregator Client ######################### -The Opcodes Aggregator Client model is a foundation model defined by the Bluetooth mesh +The Opcodes Aggregator Client model is a foundation model defined by the Bluetooth Mesh specification. It is an optional model, enabled with the :kconfig:option:`CONFIG_BT_MESH_OP_AGG_CLI` option. diff --git a/doc/connectivity/bluetooth/api/mesh/priv_beacon_cli.rst b/doc/connectivity/bluetooth/api/mesh/priv_beacon_cli.rst index cb531a4c3c8..c9bcc8e5eb1 100644 --- a/doc/connectivity/bluetooth/api/mesh/priv_beacon_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/priv_beacon_cli.rst @@ -11,7 +11,7 @@ The Private Beacon Client model is introduced in the Bluetooth Mesh Protocol Specification version 1.1, and provides functionality for configuring the :ref:`bluetooth_mesh_models_priv_beacon_srv` models. -The Private Beacons feature adds privacy to the different Bluetooth mesh +The Private Beacons feature adds privacy to the different Bluetooth Mesh beacons by periodically randomizing the beacon input data. This protects the mesh node from being tracked by devices outside the mesh network, and hides the network's IV index, IV update and the Key Refresh state. diff --git a/doc/connectivity/bluetooth/api/mesh/priv_beacon_srv.rst b/doc/connectivity/bluetooth/api/mesh/priv_beacon_srv.rst index 3c17cc44675..62450634a31 100644 --- a/doc/connectivity/bluetooth/api/mesh/priv_beacon_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/priv_beacon_srv.rst @@ -11,7 +11,7 @@ The Private Beacon Server model is introduced in the Bluetooth Mesh Protocol Specification version 1.1, and controls the mesh node's Private Beacon state, Private GATT Proxy state and Private Node Identity state. -The Private Beacons feature adds privacy to the different Bluetooth mesh +The Private Beacons feature adds privacy to the different Bluetooth Mesh beacons by periodically randomizing the beacon input data. This protects the mesh node from being tracked by devices outside the mesh network, and hides the network's IV index, IV update and the Key Refresh state. The Private Beacon Server diff --git a/doc/connectivity/bluetooth/api/mesh/provisioning.rst b/doc/connectivity/bluetooth/api/mesh/provisioning.rst index 36fa38927a3..685c9dda455 100644 --- a/doc/connectivity/bluetooth/api/mesh/provisioning.rst +++ b/doc/connectivity/bluetooth/api/mesh/provisioning.rst @@ -12,15 +12,15 @@ two devices operating in the following roles: Provisioning process. Before the provisioning process starts, the provisionee is an *unprovisioned device*. -The Provisioning module in the Zephyr Bluetooth mesh stack supports both the +The Provisioning module in the Zephyr Bluetooth Mesh stack supports both the Advertising and GATT Provisioning bearers for the provisionee role, as well as the Advertising Provisioning bearer for the provisioner role. The Provisioning process ************************ -All Bluetooth mesh nodes must be provisioned before they can participate in a -Bluetooth mesh network. The Provisioning API provides all the functionality +All Bluetooth Mesh nodes must be provisioned before they can participate in a +Bluetooth Mesh network. The Provisioning API provides all the functionality necessary for a device to become a provisioned mesh node. Provisioning is a five-step process, involving the following steps: @@ -176,7 +176,7 @@ Depending on the choice of public key exchange mechanism and authentication meth the provisioning process can be secure or insecure. On May 24th 2021, ANSSI `disclosed `_ -a set of vulnerabilities in the Bluetooth mesh provisioning protocol that showcased +a set of vulnerabilities in the Bluetooth Mesh provisioning protocol that showcased how the low entropy provided by the Blink, Vibrate, Push, Twist and Input/Output numeric OOB methods could be exploited in impersonation and MITM attacks. In response, the Bluetooth SIG has reclassified these OOB methods as diff --git a/doc/connectivity/bluetooth/api/mesh/proxy.rst b/doc/connectivity/bluetooth/api/mesh/proxy.rst index 823401c9571..5e905f2c9ef 100644 --- a/doc/connectivity/bluetooth/api/mesh/proxy.rst +++ b/doc/connectivity/bluetooth/api/mesh/proxy.rst @@ -3,7 +3,7 @@ Proxy ##### -The Proxy feature allows legacy devices like phones to access the Bluetooth mesh network through +The Proxy feature allows legacy devices like phones to access the Bluetooth Mesh network through GATT. The Proxy feature is only compiled in if the :kconfig:option:`CONFIG_BT_MESH_GATT_PROXY` option is set. The Proxy feature state is controlled by the :ref:`bluetooth_mesh_models_cfg_srv`, and the initial value can be set with :c:member:`bt_mesh_cfg_srv.gatt_proxy`. diff --git a/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst b/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst index a0aa2b46a3e..4f3354945c9 100644 --- a/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst +++ b/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst @@ -4,7 +4,7 @@ Segmentation and reassembly (SAR) ################################# Segmentation and reassembly (SAR) provides a way of handling larger upper transport layer messages -in a mesh network, with a purpose of enhancing the Bluetooth mesh throughput. The segmentation and +in a mesh network, with a purpose of enhancing the Bluetooth Mesh throughput. The segmentation and reassembly mechanism is used by the lower transport layer. The lower transport layer defines how the upper transport layer PDUs are segmented and reassembled @@ -23,7 +23,7 @@ required. Set the ``send rel`` flag (see :c:struct:`bt_mesh_msg_ctx`) to use the transmission and acknowledge single-segment segmented messages. The transport layer is able to transport up to 32 segments with its SAR mechanism, with a maximum -message (PDU) size of 384 octets. To configure message size for the Bluetooth mesh stack, use the +message (PDU) size of 384 octets. To configure message size for the Bluetooth Mesh stack, use the following Kconfig options: * :kconfig:option:`CONFIG_BT_MESH_RX_SEG_MAX` to set the maximum number of segments in an incoming message. diff --git a/doc/connectivity/bluetooth/api/mesh/sar_cfg_cli.rst b/doc/connectivity/bluetooth/api/mesh/sar_cfg_cli.rst index b017b53a01a..1e2ab6c47a1 100644 --- a/doc/connectivity/bluetooth/api/mesh/sar_cfg_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/sar_cfg_cli.rst @@ -3,7 +3,7 @@ SAR Configuration Client ######################## -The SAR Configuration Client model is a foundation model defined by the Bluetooth mesh +The SAR Configuration Client model is a foundation model defined by the Bluetooth Mesh specification. It is an optional model, enabled with the :kconfig:option:`CONFIG_BT_MESH_SAR_CFG_CLI` configuration option. diff --git a/doc/connectivity/bluetooth/api/mesh/sar_cfg_srv.rst b/doc/connectivity/bluetooth/api/mesh/sar_cfg_srv.rst index 2ea1446c9ea..4280fae1350 100644 --- a/doc/connectivity/bluetooth/api/mesh/sar_cfg_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/sar_cfg_srv.rst @@ -3,13 +3,13 @@ SAR Configuration Server ######################## -The SAR Configuration Server model is a foundation model defined by the Bluetooth mesh +The SAR Configuration Server model is a foundation model defined by the Bluetooth Mesh specification. It is an optional model, enabled with the :kconfig:option:`CONFIG_BT_MESH_SAR_CFG_SRV` configuration option. The SAR Configuration Server model is introduced in the Bluetooth Mesh Protocol Specification version 1.1, and it supports the configuration of the -:ref:`segmentation and reassembly (SAR) ` behavior of a Bluetooth mesh node. +:ref:`segmentation and reassembly (SAR) ` behavior of a Bluetooth Mesh node. The model defines a set of states and messages for the SAR configuration. The SAR Configuration Server model defines two states, SAR Transmitter state and SAR Receiver state. diff --git a/doc/connectivity/bluetooth/api/mesh/shell.rst b/doc/connectivity/bluetooth/api/mesh/shell.rst index 66bfcdf6168..9d5829fe380 100644 --- a/doc/connectivity/bluetooth/api/mesh/shell.rst +++ b/doc/connectivity/bluetooth/api/mesh/shell.rst @@ -3,32 +3,32 @@ Bluetooth Mesh Shell #################### -The Bluetooth mesh shell subsystem provides a set of Bluetooth mesh shell commands for the -:ref:`shell_api` module. It allows for testing and exploring the Bluetooth mesh API through an +The Bluetooth Mesh shell subsystem provides a set of Bluetooth Mesh shell commands for the +:ref:`shell_api` module. It allows for testing and exploring the Bluetooth Mesh API through an interactive interface, without having to write an application. -The Bluetooth mesh shell interface provides access to most Bluetooth mesh features, including +The Bluetooth Mesh shell interface provides access to most Bluetooth Mesh features, including provisioning, configuration, and message sending. Prerequisites ************* -The Bluetooth mesh shell subsystem depends on the application to create the composition data and do +The Bluetooth Mesh shell subsystem depends on the application to create the composition data and do the mesh initialization. Application *********** -The Bluetooth mesh shell subsystem is most easily used through the Bluetooth mesh shell application +The Bluetooth Mesh shell subsystem is most easily used through the Bluetooth Mesh shell application under ``tests/bluetooth/mesh_shell``. See :ref:`shell_api` for information on how to connect and -interact with the Bluetooth mesh shell application. +interact with the Bluetooth Mesh shell application. Basic usage *********** -The Bluetooth mesh shell subsystem adds a single ``mesh`` command, which holds a set of +The Bluetooth Mesh shell subsystem adds a single ``mesh`` command, which holds a set of sub-commands. Every time the device boots up, make sure to call ``mesh init`` before any of the -other Bluetooth mesh shell commands can be called:: +other Bluetooth Mesh shell commands can be called:: uart:~$ mesh init @@ -82,7 +82,7 @@ Message sending =============== With an application key added (see above), the mesh node's transition parameters are all valid, and -the Bluetooth mesh shell can send raw mesh messages through the network. +the Bluetooth Mesh shell can send raw mesh messages through the network. For example, to send a Generic OnOff Set message, call:: @@ -107,7 +107,7 @@ configured network and application keys will receive and process the messages we Sending raw mesh packets is a good way to test model message handler implementations during development, as it can be done without having to implement the sending model. By default, only the -reception of the model messages can be tested this way, as the Bluetooth mesh shell only includes +reception of the model messages can be tested this way, as the Bluetooth Mesh shell only includes the foundation models. To receive a packet in the mesh node, you have to add a model with a valid opcode handler list to the composition data in ``subsys/bluetooth/mesh/shell.c``, and print the incoming message to the shell in the handler callback. @@ -115,7 +115,7 @@ incoming message to the shell in the handler callback. Parameter formats ***************** -The Bluetooth mesh shell commands are parsed with a variety of formats: +The Bluetooth Mesh shell commands are parsed with a variety of formats: .. list-table:: Parameter formats :widths: 1 4 2 @@ -139,12 +139,12 @@ The Bluetooth mesh shell commands are parsed with a variety of formats: Commands ******** -The Bluetooth mesh shell implements a large set of commands. Some of the commands accept parameters, +The Bluetooth Mesh shell implements a large set of commands. Some of the commands accept parameters, which are mentioned in brackets after the command name. For example, ``mesh lpn set ``. Mandatory parameters are marked with angle brackets (e.g. ````), and optional parameters are marked with square brackets (e.g. ``[DstAddr]``). -The Bluetooth mesh shell commands are divided into the following groups: +The Bluetooth Mesh shell commands are divided into the following groups: .. contents:: :depth: 1 @@ -500,10 +500,10 @@ application. This shell module can be used for configuring itself and other node network. The Configuration Client uses general message parameters set by ``mesh target dst`` and ``mesh -target net`` to target specific nodes. When the Bluetooth mesh shell node is provisioned, given that +target net`` to target specific nodes. When the Bluetooth Mesh shell node is provisioned, given that the :kconfig:option:`CONFIG_BT_MESH_SHELL_PROV_CTX_INSTANCE` option is enabled with the shell provisioning context initialized, the Configuration Client model targets itself by default. -Similarly, when another node has been provisioned by the Bluetooth mesh shell, the Configuration +Similarly, when another node has been provisioned by the Bluetooth Mesh shell, the Configuration Client model targets the new node. In most common use-cases, the Configuration Client is depending on the provisioning features and the Configuration database to be fully functional. The Configuration Client always sends messages using the Device key bound to the destination address, so @@ -1645,7 +1645,7 @@ The Private Beacon Client model is an optional mesh subsystem that can be enable Opcodes Aggregator Client ------------------------- -The Opcodes Aggregator client is an optional Bluetooth mesh model that can be enabled through the +The Opcodes Aggregator client is an optional Bluetooth Mesh model that can be enabled through the :kconfig:option:`CONFIG_BT_MESH_OP_AGG_CLI` configuration option. The Opcodes Aggregator Client model is used to support the functionality of dispatching a sequence of access layer messages to nodes supporting the Opcodes Aggregator Server model. @@ -1675,7 +1675,7 @@ nodes supporting the Opcodes Aggregator Server model. Remote Provisioning Client -------------------------- -The Remote Provisioning Client is an optional Bluetooth mesh model enabled through the +The Remote Provisioning Client is an optional Bluetooth Mesh model enabled through the :kconfig:option:`CONFIG_BT_MESH_RPR_CLI` configuration option. The Remote Provisioning Client model provides support for remote provisioning of devices into a mesh network by using the Remote Provisioning Server model. diff --git a/doc/connectivity/bluetooth/bluetooth-arch.rst b/doc/connectivity/bluetooth/bluetooth-arch.rst index 9b455e680d0..ed0cf1ea9f6 100644 --- a/doc/connectivity/bluetooth/bluetooth-arch.rst +++ b/doc/connectivity/bluetooth/bluetooth-arch.rst @@ -248,7 +248,7 @@ Each role comes with its own build-time configuration option: connection-oriented roles central implicitly enables observer role, and peripheral implicitly enables broadcaster role. Usually the first step when creating an application is to decide which roles are needed and go -from there. Bluetooth mesh is a slightly special case, requiring at +from there. Bluetooth Mesh is a slightly special case, requiring at least the observer and broadcaster roles, and possibly also the Peripheral role. This will be described in more detail in a later section. diff --git a/doc/connectivity/bluetooth/overview.rst b/doc/connectivity/bluetooth/overview.rst index fece4ade496..1f727736b2d 100644 --- a/doc/connectivity/bluetooth/overview.rst +++ b/doc/connectivity/bluetooth/overview.rst @@ -76,7 +76,7 @@ Bluetooth stack. * Non-volatile storage support for permanent storage of Bluetooth-specific settings and data - * Bluetooth mesh support + * Bluetooth Mesh support * Relay, Friend Node, Low-Power Node (LPN) and GATT Proxy features * Both Provisioning roles and bearers supported (PB-ADV & PB-GATT) diff --git a/doc/introduction/index.rst b/doc/introduction/index.rst index 85968ca456a..13204e6bb7d 100644 --- a/doc/introduction/index.rst +++ b/doc/introduction/index.rst @@ -123,7 +123,7 @@ Zephyr offers a large and ever growing number of features including: **Bluetooth Low Energy 5.0 support** Bluetooth 5.0 compliant (ESR10) and Bluetooth Low Energy Controller support - (LE Link Layer). Includes Bluetooth mesh and a Bluetooth qualification-ready + (LE Link Layer). Includes Bluetooth Mesh and a Bluetooth qualification-ready Bluetooth controller. * Generic Access Profile (GAP) with all possible LE roles diff --git a/doc/kernel/timeutil.rst b/doc/kernel/timeutil.rst index d41c5b48b89..203d52ea9af 100644 --- a/doc/kernel/timeutil.rst +++ b/doc/kernel/timeutil.rst @@ -223,7 +223,7 @@ include: - GPS time: epoch of 1980-01-06T00:00:00Z, continuous following TAI with an offset of TAI-GPS=19 s. -- Bluetooth mesh time: epoch of 2000-01-01T00:00:00Z, continuous following TAI +- Bluetooth Mesh time: epoch of 2000-01-01T00:00:00Z, continuous following TAI with an offset of -32. - UNIX Leap Time: epoch of 1970-01-01T00:00:00Z, continuous following TAI with an offset of -8. diff --git a/doc/security/vulnerabilities.rst b/doc/security/vulnerabilities.rst index 61d0d25f618..fde156983d3 100644 --- a/doc/security/vulnerabilities.rst +++ b/doc/security/vulnerabilities.rst @@ -1176,7 +1176,7 @@ This has been fixed in main for v3.0.0 CVE-2022-1041 -------------- -Out-of-bound write vulnerability in the Bluetooth mesh core stack can be triggered during provisioning +Out-of-bound write vulnerability in the Bluetooth Mesh core stack can be triggered during provisioning This has been fixed in main for v3.1.0 @@ -1195,7 +1195,7 @@ This has been fixed in main for v3.1.0 CVE-2022-1042 -------------- -Out-of-bound write vulnerability in the Bluetooth mesh core stack can be triggered during provisioning +Out-of-bound write vulnerability in the Bluetooth Mesh core stack can be triggered during provisioning This has been fixed in main for v3.1.0 diff --git a/include/zephyr/bluetooth/mesh.h b/include/zephyr/bluetooth/mesh.h index a4ef70dc6de..fc84814fa44 100644 --- a/include/zephyr/bluetooth/mesh.h +++ b/include/zephyr/bluetooth/mesh.h @@ -1,5 +1,5 @@ /** @file - * @brief Bluetooth mesh Profile APIs. + * @brief Bluetooth Mesh Profile APIs. */ /* diff --git a/include/zephyr/bluetooth/mesh/blob_srv.h b/include/zephyr/bluetooth/mesh/blob_srv.h index bf807bad92f..92c809bd6b5 100644 --- a/include/zephyr/bluetooth/mesh/blob_srv.h +++ b/include/zephyr/bluetooth/mesh/blob_srv.h @@ -108,7 +108,7 @@ struct bt_mesh_blob_srv_cb { /** @brief Transfer recovery callback. * - * Called when the Bluetooth mesh subsystem is started if the device is rebooted + * Called when the Bluetooth Mesh subsystem is started if the device is rebooted * in the middle of a transfer. * * Transfers will not be resumed after a reboot if this callback is not diff --git a/include/zephyr/bluetooth/mesh/cfg.h b/include/zephyr/bluetooth/mesh/cfg.h index 7d1ca4e868f..9bfd067da9b 100644 --- a/include/zephyr/bluetooth/mesh/cfg.h +++ b/include/zephyr/bluetooth/mesh/cfg.h @@ -26,7 +26,7 @@ extern "C" { #endif -/** Bluetooth mesh feature states */ +/** Bluetooth Mesh feature states */ enum bt_mesh_feat_state { /** Feature is supported, but disabled. */ BT_MESH_FEATURE_DISABLED, diff --git a/include/zephyr/bluetooth/mesh/dfu_cli.h b/include/zephyr/bluetooth/mesh/dfu_cli.h index 3cbc220d825..ad8881ebc26 100644 --- a/include/zephyr/bluetooth/mesh/dfu_cli.h +++ b/include/zephyr/bluetooth/mesh/dfu_cli.h @@ -9,7 +9,7 @@ * @defgroup bt_mesh_dfu_cli Firmware Uppdate Client model * @ingroup bt_mesh_dfu * @{ - * @brief API for the Bluetooth mesh Firmware Update Client model + * @brief API for the Bluetooth Mesh Firmware Update Client model */ #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_CLI_H__ diff --git a/include/zephyr/bluetooth/mesh/dfu_metadata.h b/include/zephyr/bluetooth/mesh/dfu_metadata.h index bec65897ac7..21d032236a7 100644 --- a/include/zephyr/bluetooth/mesh/dfu_metadata.h +++ b/include/zephyr/bluetooth/mesh/dfu_metadata.h @@ -6,10 +6,10 @@ /** * @file - * @defgroup bt_mesh_dfu_metadata Bluetooth mesh Device Firmware Update (DFU) metadata + * @defgroup bt_mesh_dfu_metadata Bluetooth Mesh Device Firmware Update (DFU) metadata * @ingroup bt_mesh_dfu * @{ - * @brief Common types and functions for the Bluetooth mesh DFU metadata. + * @brief Common types and functions for the Bluetooth Mesh DFU metadata. */ #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_METADATA_H__ diff --git a/include/zephyr/bluetooth/mesh/dfu_srv.h b/include/zephyr/bluetooth/mesh/dfu_srv.h index e136701e664..2beaf2d9772 100644 --- a/include/zephyr/bluetooth/mesh/dfu_srv.h +++ b/include/zephyr/bluetooth/mesh/dfu_srv.h @@ -9,7 +9,7 @@ * @defgroup bt_mesh_dfu_srv Firmware Update Server model * @ingroup bt_mesh_dfu * @{ - * @brief API for the Bluetooth mesh Firmware Update Server model + * @brief API for the Bluetooth Mesh Firmware Update Server model */ #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_SRV_H__ @@ -136,7 +136,7 @@ struct bt_mesh_dfu_srv_cb { /** @brief Transfer recovery callback. * * If the device reboots in the middle of a transfer, the Firmware Update Server - * calls this function when the Bluetooth mesh subsystem is started. + * calls this function when the Bluetooth Mesh subsystem is started. * * This callback is optional, but transfers will not be recovered after * a reboot without it. diff --git a/include/zephyr/bluetooth/mesh/main.h b/include/zephyr/bluetooth/mesh/main.h index a4e98b97f8c..8e7445fae6f 100644 --- a/include/zephyr/bluetooth/mesh/main.h +++ b/include/zephyr/bluetooth/mesh/main.h @@ -1,5 +1,5 @@ /** @file - * @brief Bluetooth mesh Protocol APIs. + * @brief Bluetooth Mesh Protocol APIs. */ /* @@ -550,8 +550,8 @@ bool bt_mesh_is_provisioned(void); */ /** - * @brief Bluetooth mesh - * @defgroup bt_mesh Bluetooth mesh + * @brief Bluetooth Mesh + * @defgroup bt_mesh Bluetooth Mesh * @ingroup bluetooth * @{ */ diff --git a/samples/bluetooth/mesh/README.rst b/samples/bluetooth/mesh/README.rst index e6ee78ba3a7..58532a0600b 100644 --- a/samples/bluetooth/mesh/README.rst +++ b/samples/bluetooth/mesh/README.rst @@ -6,7 +6,7 @@ Bluetooth: Mesh Overview ******** -This sample demonstrates Bluetooth mesh functionality. It has several +This sample demonstrates Bluetooth Mesh functionality. It has several standard mesh models, and supports provisioning over both the Advertising and the GATT Provisioning Bearers (i.e. PB-ADV and PB-GATT). The application also needs a functioning serial console, since that's diff --git a/samples/bluetooth/mesh_demo/README.rst b/samples/bluetooth/mesh_demo/README.rst index 7fe7f0908ce..2edb690ab19 100644 --- a/samples/bluetooth/mesh_demo/README.rst +++ b/samples/bluetooth/mesh_demo/README.rst @@ -6,7 +6,7 @@ Bluetooth: Mesh Demo Overview ******** -This sample is a Bluetooth mesh application intended for demonstration +This sample is a Bluetooth Mesh application intended for demonstration purposes only. The application provisions and configures itself (i.e. no external provisioner needed) with hard-coded network and application key values. The local unicast address can be set using a NODE_ADDR build diff --git a/samples/bluetooth/mesh_provisioner/README.rst b/samples/bluetooth/mesh_provisioner/README.rst index 6da113afc1b..1b37a04a4a8 100644 --- a/samples/bluetooth/mesh_provisioner/README.rst +++ b/samples/bluetooth/mesh_provisioner/README.rst @@ -6,7 +6,7 @@ Bluetooth: Mesh Provisioner Overview ******** -This sample demonstrates how to use the Bluetooth mesh APIs related to +This sample demonstrates how to use the Bluetooth Mesh APIs related to provisioning and using the Configuration Database (CDB). It is intended to be tested together with a device capable of being provisioned. For example, one could use the sample in diff --git a/samples/boards/nrf/mesh/onoff-app/README.rst b/samples/boards/nrf/mesh/onoff-app/README.rst index e8cadccd53c..35e37d6a599 100644 --- a/samples/boards/nrf/mesh/onoff-app/README.rst +++ b/samples/boards/nrf/mesh/onoff-app/README.rst @@ -6,7 +6,7 @@ Bluetooth: Mesh OnOff Model Overview ******** -This is a simple application demonstrating a Bluetooth mesh multi-element node. +This is a simple application demonstrating a Bluetooth Mesh multi-element node. Each element has a mesh onoff client and server model which controls one of the 4 sets of buttons and LEDs . diff --git a/samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/README.rst b/samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/README.rst index 05b8d896e77..f33bf1e7761 100644 --- a/samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/README.rst +++ b/samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/README.rst @@ -4,7 +4,7 @@ Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models ###################################################################### Overview ******** -This is a application demonstrating a Bluetooth mesh node in +This is a application demonstrating a Bluetooth Mesh node in which Root element has following models - Generic OnOff Server diff --git a/samples/boards/reel_board/mesh_badge/README.rst b/samples/boards/reel_board/mesh_badge/README.rst index d5973ab8e9c..ccfc7e771ae 100644 --- a/samples/boards/reel_board/mesh_badge/README.rst +++ b/samples/boards/reel_board/mesh_badge/README.rst @@ -6,7 +6,7 @@ Mesh Badge Overview ******** -This sample app for the reel board showcases Bluetooth mesh +This sample app for the reel board showcases Bluetooth Mesh The app starts off as a regular Bluetooth GATT peripheral application. Install the "nRF Connect" app on your phone (available both for @@ -34,7 +34,7 @@ Steps to set up you're not happy with it you can try writing something else. #. When you're happy with the text, disconnect from the board (exit the app or go back to the device scan page) -#. Once disconnected the board switches over to Bluetooth mesh mode, and you +#. Once disconnected the board switches over to Bluetooth Mesh mode, and you can't connect to it anymore over GATT. If you configure multiple boards like this they can communicate with diff --git a/subsys/bluetooth/Kconfig.logging b/subsys/bluetooth/Kconfig.logging index ec95ddad10e..6d8b999e03c 100644 --- a/subsys/bluetooth/Kconfig.logging +++ b/subsys/bluetooth/Kconfig.logging @@ -469,56 +469,56 @@ config BT_MESH_DEBUG_NET select DEPRECATED help Use this option to enable Network layer debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. config BT_MESH_DEBUG_RPL bool "[DEPRECATED] Replay protection list debug" select DEPRECATED help Use this option to enable Replay protection list debug logs - for the Bluetooth mesh functionality. + for the Bluetooth Mesh functionality. config BT_MESH_DEBUG_TRANS bool "[DEPRECATED] Transport layer debug" select DEPRECATED help Use this option to enable Transport layer debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. config BT_MESH_DEBUG_BEACON bool "[DEPRECATED] Beacon debug" select DEPRECATED help Use this option to enable Beacon-related debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. config BT_MESH_DEBUG_CRYPTO bool "[DEPRECATED] Crypto debug" select DEPRECATED help Use this option to enable cryptographic debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. config BT_MESH_DEBUG_KEYS bool "[DEPRECATED] Key management debug" select DEPRECATED help Use this option to enable key management debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. config BT_MESH_DEBUG_PROV bool "[DEPRECATED] Provisioning debug" select DEPRECATED help Use this option to enable Provisioning debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. config BT_MESH_DEBUG_PROVISIONER bool "[DEPRECATED] Provisioner debug" select DEPRECATED help Use this option to enable Provisioner debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. config BT_MESH_DEBUG_PROV_DEVICE bool "[DEPRECATED] Provisioning device debug" @@ -532,7 +532,7 @@ config BT_MESH_DEBUG_ACCESS select DEPRECATED help Use this option to enable Access layer and device composition - related debug logs for Bluetooth mesh. + related debug logs for Bluetooth Mesh. config BT_MESH_DEBUG_MODEL bool "[DEPRECATED] Foundation model debug" @@ -546,21 +546,21 @@ config BT_MESH_DEBUG_ADV select DEPRECATED help Use this option to enable advertising debug logs for - the Bluetooth mesh functionality. + the Bluetooth Mesh functionality. config BT_MESH_DEBUG_LOW_POWER bool "[DEPRECATED] Low Power debug" select DEPRECATED help Use this option to enable Low Power debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. config BT_MESH_DEBUG_FRIEND bool "[DEPRECATED] Friend debug" select DEPRECATED help Use this option to enable Friend debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. config BT_MESH_DEBUG_PROXY bool "[DEPRECATED] Proxy debug" @@ -588,7 +588,7 @@ config BT_MESH_DEBUG_CFG select DEPRECATED help Use this option to enable node configuration debug logs for the - Bluetooth mesh functionality. + Bluetooth Mesh functionality. endmenu # [DEPRECATED] Mesh diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index 7b6bc839b89..2fdc98694b1 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -243,7 +243,7 @@ config BT_HCI_MESH_EXT bool "Mesh HCI Command support" depends on BT_BROADCASTER && BT_OBSERVER && !BT_LL_SW_SPLIT help - Enable support for the Bluetooth mesh HCI Commands. + Enable support for the Bluetooth Mesh HCI Commands. config BT_WAIT_NOP bool "Wait for \"NOP\" Command Complete event during init" diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 04366828bbe..0c654e18064 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1,13 +1,13 @@ -# Bluetooth mesh configuration options +# Bluetooth Mesh configuration options # Copyright (c) 2017 Intel Corporation # SPDX-License-Identifier: Apache-2.0 menuconfig BT_MESH - bool "Bluetooth mesh support" + bool "Bluetooth Mesh support" depends on BT_OBSERVER && BT_BROADCASTER help - This option enables Bluetooth mesh support. The specific + This option enables Bluetooth Mesh support. The specific features that are available may depend on other features that have been enabled in the stack, such as GATT support. @@ -598,7 +598,7 @@ config BT_MESH_ACCESS_LAYER_MSG help This option allows the application to directly access Bluetooth access layer messages without the need to - instantiate Bluetooth mesh models. + instantiate Bluetooth Mesh models. config BT_MESH_MODEL_VND_MSG_CID_FORCE bool "Force vendor model to use the corresponding CID field message" @@ -1049,9 +1049,9 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND menuconfig BT_MESH_V1d1 - bool "Bluetooth mesh v1.1 support" + bool "Bluetooth Mesh v1.1 support" help - This option enables Bluetooth mesh v1.1 support. Bluetooth mesh v1.1 + This option enables Bluetooth Mesh v1.1 support. Bluetooth Mesh v1.1 is backward compatible with v1.0.1. config BT_MESH_ECDH_P256_CMAC_AES128_AES_CCM @@ -1201,7 +1201,7 @@ config BT_MESH_DFU_METADATA bool "Support for the default metadata format" help This option adds a set of functions that can be used to encode and decode a firmware - metadata using the format defined in the Bluetooth mesh DFU subsystem. + metadata using the format defined in the Bluetooth Mesh DFU subsystem. config BT_MESH_DFU_URI_MAXLEN int "DFU URI max length" @@ -1734,16 +1734,16 @@ config BT_MESH_RPL_STORE_TIMEOUT endif # BT_MESH_RPL_STORAGE_MODE_SETTINGS && BT_SETTINGS config BT_MESH_SETTINGS_WORKQ - bool "Store the Bluetooth mesh settings in a separate work queue" + bool "Store the Bluetooth Mesh settings in a separate work queue" default y help This option enables a separate cooperative thread which is used to - store Bluetooth mesh configuration. When this option is disabled, + store Bluetooth Mesh configuration. When this option is disabled, the stack's configuration is stored in the system workqueue. This means that the system workqueue will be blocked for the time needed to store the pending data. This time may significantly increase if the flash driver does the erase operation. Enabling this option - allows Bluetooth mesh not to block the system workqueue, and thus + allows Bluetooth Mesh not to block the system workqueue, and thus process the incoming and outgoing messages while the flash driver waits for the controller to allocate the time needed to write the data and/or erase the required flash pages. diff --git a/subsys/bluetooth/mesh/access.h b/subsys/bluetooth/mesh/access.h index b7ce1abd0ea..48e0eadec10 100644 --- a/subsys/bluetooth/mesh/access.h +++ b/subsys/bluetooth/mesh/access.h @@ -94,7 +94,7 @@ void bt_mesh_msg_cb_set(void (*cb)(uint32_t opcode, struct bt_mesh_msg_ctx *ctx, * Send a mesh model layer message out into the mesh network without having instantiated * the relevant mesh models. * - * @param ctx The Bluetooth mesh message context. + * @param ctx The Bluetooth Mesh message context. * @param buf The message payload. * * @return 0 on success or negative error code on failure. diff --git a/subsys/bluetooth/mesh/settings.c b/subsys/bluetooth/mesh/settings.c index 771aad9b946..9cfcb3f5c2c 100644 --- a/subsys/bluetooth/mesh/settings.c +++ b/subsys/bluetooth/mesh/settings.c @@ -88,7 +88,7 @@ static int mesh_commit(void) } if (!atomic_test_bit(bt_dev.flags, BT_DEV_ENABLE)) { - /* The Bluetooth mesh settings loader calls bt_mesh_start() immediately + /* The Bluetooth Mesh settings loader calls bt_mesh_start() immediately * after loading the settings. This is not intended to work before * bt_enable(). The doc on @ref bt_enable requires the "bt/" settings * tree to be loaded after @ref bt_enable is completed, so this handler diff --git a/subsys/bluetooth/mesh/shell/Kconfig b/subsys/bluetooth/mesh/shell/Kconfig index 5e1e43f0057..46671c3bfaa 100644 --- a/subsys/bluetooth/mesh/shell/Kconfig +++ b/subsys/bluetooth/mesh/shell/Kconfig @@ -1,13 +1,13 @@ -# Bluetooth mesh shell configuration options +# Bluetooth Mesh shell configuration options # Copyright (c) 2022 Nordic Semiconductor # SPDX-License-Identifier: Apache-2.0 menuconfig BT_MESH_SHELL - bool "Bluetooth mesh shell" + bool "Bluetooth Mesh shell" select SHELL help - Activate shell module that provides Bluetooth mesh commands to + Activate shell module that provides Bluetooth Mesh commands to the console. if BT_MESH_SHELL @@ -24,7 +24,7 @@ config BT_MESH_SHELL_PROV_CTX_INSTANCE depends on BT_MESH_SHELL_PROV help This option enables the provisioning context instance in the - Bluetooth mesh shell module together with several provisioning + Bluetooth Mesh shell module together with several provisioning commands and target utility features. To use the provisioning context instance, use bt_mesh_shell_prov in the initialization of mesh. @@ -54,7 +54,7 @@ config BT_MESH_SHELL_HEALTH_SRV_INSTANCE depends on BT_MESH_SHELL_TEST help This option enables Health Server model instance in the - Bluetooth mesh shell module together with fault controlling + Bluetooth Mesh shell module together with fault controlling shell commands. To use the model instance, add bt_mesh_shell_health_srv to the device composition data. Use BT_MESH_SHELL_HEALTH_PUB_DEFINE to instantiate publication context. diff --git a/subsys/bluetooth/mesh/shell/shell.c b/subsys/bluetooth/mesh/shell/shell.c index a169bb16422..bb9892eb355 100644 --- a/subsys/bluetooth/mesh/shell/shell.c +++ b/subsys/bluetooth/mesh/shell/shell.c @@ -1814,5 +1814,5 @@ SHELL_STATIC_SUBCMD_SET_CREATE(mesh_cmds, SHELL_SUBCMD_SET_END ); -SHELL_CMD_ARG_REGISTER(mesh, &mesh_cmds, "Bluetooth mesh shell commands", +SHELL_CMD_ARG_REGISTER(mesh, &mesh_cmds, "Bluetooth Mesh shell commands", bt_mesh_shell_mdl_cmds_help, 1, 1); diff --git a/tests/bsim/bluetooth/mesh/README.rst b/tests/bsim/bluetooth/mesh/README.rst index 787b0084f0b..1ae78887b71 100644 --- a/tests/bsim/bluetooth/mesh/README.rst +++ b/tests/bsim/bluetooth/mesh/README.rst @@ -1,7 +1,7 @@ -Bluetooth mesh BabbleSim tests +Bluetooth Mesh BabbleSim tests ############################## -This directory contains a set of high level system tests for the Bluetooth mesh +This directory contains a set of high level system tests for the Bluetooth Mesh subsystem. The tests run on the BabbleSim simulator, using the BabbleSim test framework. @@ -10,7 +10,7 @@ subfolder of test_scripts contains tests for a specific module in the Bluetooth mesh subsystem, and each folder has a corresponding test_.c under the src/ directory containing the necessary test harnesses to execute the tests. -There's only a single test application for all the Bluetooth mesh BabbleSim +There's only a single test application for all the Bluetooth Mesh BabbleSim tests. The test application is built from this directory, and includes all test harnesses in every build. The overlying bsim test framework selects the harness to use at runtime, using the test identifiers passed in the test scripts. @@ -18,7 +18,7 @@ to use at runtime, using the test identifiers passed in the test scripts. Running the tests ***************** -The Bluetooth mesh tests have no extra requirements, and can be run using the +The Bluetooth Mesh tests have no extra requirements, and can be run using the procedure described in the parent folder. To only run the mesh tests, set ``SEARCH_PATH`` to point to this folder before @@ -57,13 +57,13 @@ Then separately, call Framework ********* -The Bluetooth mesh BabbleSim tests mainly operate on the test framework for the +The Bluetooth Mesh BabbleSim tests mainly operate on the test framework for the BabbleSim platform, but with some mesh specific additions: mesh_test.sh ============= -All test scripts in the Bluetooth mesh BabbleSim test suite follow a common +All test scripts in the Bluetooth Mesh BabbleSim test suite follow a common pattern for running a single test across N devices with different test harnesses. ``mesh_test.sh`` is sourced in each test script, and its ``RunTest`` function is called once in each script with the following parameters: @@ -113,6 +113,6 @@ has been called - otherwise, it will fail. The Bluetooth stack must be initialized in the ``test_main_f`` function of the harness, as the previous callbacks are all executed in hardware threads. -The Bluetooth mesh tests include the entire Bluetooth host and controller +The Bluetooth Mesh tests include the entire Bluetooth host and controller subsystems, so timing requirements should generally be kept fairly liberal to avoid regressions on changes in the underlying layers. diff --git a/tests/bsim/bluetooth/mesh/prj.conf b/tests/bsim/bluetooth/mesh/prj.conf index b0738c4fa05..a45bef89775 100644 --- a/tests/bsim/bluetooth/mesh/prj.conf +++ b/tests/bsim/bluetooth/mesh/prj.conf @@ -15,7 +15,7 @@ CONFIG_BT_BROADCASTER=y CONFIG_BT_CTLR_DUP_FILTER_LEN=0 CONFIG_BT_CTLR_PRIVACY=n -# Bluetooth mesh configuration +# Bluetooth Mesh configuration CONFIG_BT_MESH=y CONFIG_BT_MESH_LOG_LEVEL_DBG=y CONFIG_BT_MESH_RELAY=y diff --git a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf index ab6066e01bf..11059c03da4 100644 --- a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf +++ b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf @@ -15,7 +15,7 @@ CONFIG_BT_BROADCASTER=y CONFIG_BT_CTLR_DUP_FILTER_LEN=0 CONFIG_BT_CTLR_PRIVACY=n -# Bluetooth mesh configuration +# Bluetooth Mesh configuration CONFIG_BT_MESH=y CONFIG_BT_MESH_V1d1=y CONFIG_BT_MESH_LOG_LEVEL_DBG=y diff --git a/tests/bsim/bluetooth/mesh/src/mesh_test.h b/tests/bsim/bluetooth/mesh/src/mesh_test.h index a5c8694947b..3dcaa5f784a 100644 --- a/tests/bsim/bluetooth/mesh/src/mesh_test.h +++ b/tests/bsim/bluetooth/mesh/src/mesh_test.h @@ -1,5 +1,5 @@ /** @file - * @brief Common functionality for Bluetooth mesh BabbleSim tests. + * @brief Common functionality for Bluetooth Mesh BabbleSim tests. */ /* From 44714f3e1960913deba6bfc0f2e62e5383f623ac Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0092/2300] [nrf fromtree] Bluetooth: Mesh: Align some code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align tab 8. Signed-off-by: Lingao Meng (cherry picked from commit 3e6f751891150649d878d912f95b5cbc28a1d801) Signed-off-by: Håvard Reierstad (cherry picked from commit 8ce58a5c1e34394175903babacd17cb953bda4a2) --- include/zephyr/bluetooth/mesh/access.h | 4 ++-- include/zephyr/bluetooth/mesh/blob_cli.h | 8 ++++---- include/zephyr/bluetooth/mesh/cdb.h | 2 +- include/zephyr/bluetooth/mesh/cfg_cli.h | 20 ++++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/zephyr/bluetooth/mesh/access.h b/include/zephyr/bluetooth/mesh/access.h index 817fba918ef..d57f30f8f05 100644 --- a/include/zephyr/bluetooth/mesh/access.h +++ b/include/zephyr/bluetooth/mesh/access.h @@ -1011,7 +1011,7 @@ const struct bt_mesh_elem *bt_mesh_model_elem(const struct bt_mesh_model *mod); * if no SIG model with the given ID exists in the given element. */ const struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem, - uint16_t id); + uint16_t id); /** @brief Find a vendor model. * @@ -1023,7 +1023,7 @@ const struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem, * if no vendor model with the given ID exists in the given element. */ const struct bt_mesh_model *bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem, - uint16_t company, uint16_t id); + uint16_t company, uint16_t id); /** @brief Get whether the model is in the primary element of the device. * diff --git a/include/zephyr/bluetooth/mesh/blob_cli.h b/include/zephyr/bluetooth/mesh/blob_cli.h index 8e239b31457..9b591cfdd35 100644 --- a/include/zephyr/bluetooth/mesh/blob_cli.h +++ b/include/zephyr/bluetooth/mesh/blob_cli.h @@ -265,10 +265,10 @@ struct blob_cli_broadcast_ctx { void (*send)(struct bt_mesh_blob_cli *cli, uint16_t dst); /** Called after every @ref blob_cli_broadcast_ctx::send callback. */ void (*send_complete)(struct bt_mesh_blob_cli *cli, uint16_t dst); - /** If @ref blob_cli_broadcast_ctx::acked is true, called after all Target nodes - * have confirmed reception by @ref blob_cli_broadcast_rsp. Otherwise, called - * after transmission has been completed. - */ + /** If @ref blob_cli_broadcast_ctx::acked is true, called after all Target nodes + * have confirmed reception by @ref blob_cli_broadcast_rsp. Otherwise, called + * after transmission has been completed. + */ void (*next)(struct bt_mesh_blob_cli *cli); /** If true, every transmission needs to be confirmed by @ref blob_cli_broadcast_rsp before * @ref blob_cli_broadcast_ctx::next is called. diff --git a/include/zephyr/bluetooth/mesh/cdb.h b/include/zephyr/bluetooth/mesh/cdb.h index 800ae07edc4..8ea35ec2e55 100644 --- a/include/zephyr/bluetooth/mesh/cdb.h +++ b/include/zephyr/bluetooth/mesh/cdb.h @@ -231,7 +231,7 @@ enum { * or BT_MESH_CDB_ITER_STOP to stop. */ typedef uint8_t (*bt_mesh_cdb_node_func_t)(struct bt_mesh_cdb_node *node, - void *user_data); + void *user_data); /** @brief Node iterator. * diff --git a/include/zephyr/bluetooth/mesh/cfg_cli.h b/include/zephyr/bluetooth/mesh/cfg_cli.h index 0e8c26131ff..4aca0c17451 100644 --- a/include/zephyr/bluetooth/mesh/cfg_cli.h +++ b/include/zephyr/bluetooth/mesh/cfg_cli.h @@ -96,8 +96,8 @@ struct bt_mesh_cfg_cli_cb { * @param buf Message buffer containing subscription addresses. */ void (*mod_sub_list)(struct bt_mesh_cfg_cli *cli, uint16_t addr, uint8_t status, - uint16_t elem_addr, uint16_t mod_id, uint16_t cid, - struct net_buf_simple *buf); + uint16_t elem_addr, uint16_t mod_id, uint16_t cid, + struct net_buf_simple *buf); /** @brief Optional callback for Node Reset Status messages. * @@ -128,7 +128,7 @@ struct bt_mesh_cfg_cli_cb { * @param status Status Code for requesting message. */ void (*ttl_status)(struct bt_mesh_cfg_cli *cli, uint16_t addr, - uint8_t status); + uint8_t status); /** @brief Optional callback for Friend Status messages. * @@ -139,7 +139,7 @@ struct bt_mesh_cfg_cli_cb { * @param status Status Code for requesting message. */ void (*friend_status)(struct bt_mesh_cfg_cli *cli, uint16_t addr, - uint8_t status); + uint8_t status); /** @brief Optional callback for GATT Proxy Status messages. * @@ -150,7 +150,7 @@ struct bt_mesh_cfg_cli_cb { * @param status Status Code for requesting message. */ void (*gatt_proxy_status)(struct bt_mesh_cfg_cli *cli, uint16_t addr, - uint8_t status); + uint8_t status); /** @brief Optional callback for Network Transmit Status messages. * @@ -199,7 +199,7 @@ struct bt_mesh_cfg_cli_cb { * @param buf Message buffer containing key indexes. */ void (*net_key_list)(struct bt_mesh_cfg_cli *cli, uint16_t addr, - struct net_buf_simple *buf); + struct net_buf_simple *buf); /** @brief Optional callback for AppKey Status messages. * @@ -229,7 +229,7 @@ struct bt_mesh_cfg_cli_cb { * @param buf Message buffer containing key indexes. */ void (*app_key_list)(struct bt_mesh_cfg_cli *cli, uint16_t addr, uint8_t status, - uint16_t net_idx, struct net_buf_simple *buf); + uint16_t net_idx, struct net_buf_simple *buf); /** @brief Optional callback for Model App Status messages. * @@ -262,8 +262,8 @@ struct bt_mesh_cfg_cli_cb { * @param buf Message buffer containing key indexes. */ void (*mod_app_list)(struct bt_mesh_cfg_cli *cli, uint16_t addr, uint8_t status, - uint16_t elem_addr, uint16_t mod_id, uint16_t cid, - struct net_buf_simple *buf); + uint16_t elem_addr, uint16_t mod_id, uint16_t cid, + struct net_buf_simple *buf); /** @brief Optional callback for Node Identity Status messages. * @@ -326,7 +326,7 @@ struct bt_mesh_cfg_cli_cb { * @param sub HB subscription configuration parameters. */ void (*hb_sub_status)(struct bt_mesh_cfg_cli *cli, uint16_t addr, uint8_t status, - struct bt_mesh_cfg_cli_hb_sub *sub); + struct bt_mesh_cfg_cli_hb_sub *sub); }; /** Mesh Configuration Client Model Context */ From 624e83f15f6761fbb4b50413a7eea34475fcbbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0093/2300] [nrf fromtree] Bluetooth: Mesh: advertiser: add disable function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a disable function for the extended advertising which stops and deletes the advertising instances, allowing them to be properly reinitialized when calling `bt_mesh_adv_enable()` after bluetooth has been disabled and re-enabled. For the legacy advertising, the function terminates the advertising thread. If legacy advertising is used, `bt_mesh_adv_init()` must be called before `bt_mesh_adv_enable()` to properly resume advertising after suspension. Signed-off-by: Håvard Reierstad (cherry picked from commit 3be26c4cb9f02ad0799ea6cc20df401d5c1fa7d2) Signed-off-by: Håvard Reierstad (cherry picked from commit ac4f2cdb0c616b46fa0775bd001cc68951e62074) --- include/zephyr/bluetooth/mesh/main.h | 4 ++++ subsys/bluetooth/mesh/adv.h | 3 +++ subsys/bluetooth/mesh/adv_ext.c | 30 ++++++++++++++++++++++++++++ subsys/bluetooth/mesh/adv_legacy.c | 21 ++++++++++++++++--- 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/include/zephyr/bluetooth/mesh/main.h b/include/zephyr/bluetooth/mesh/main.h index 8e7445fae6f..a213e8ce22c 100644 --- a/include/zephyr/bluetooth/mesh/main.h +++ b/include/zephyr/bluetooth/mesh/main.h @@ -607,6 +607,10 @@ void bt_mesh_reset(void); * If at all possible, the Friendship feature should be used instead, to * make the node into a Low Power Node. * + * @note Should not be called from work queue due to undefined behavior. + * This is due to k_work_flush_delayable() being used in disabling of the + * extended advertising. + * * @return 0 on success, or (negative) error code on failure. */ int bt_mesh_suspend(void); diff --git a/subsys/bluetooth/mesh/adv.h b/subsys/bluetooth/mesh/adv.h index a80ff7e8d4b..42b07601ad5 100644 --- a/subsys/bluetooth/mesh/adv.h +++ b/subsys/bluetooth/mesh/adv.h @@ -80,6 +80,9 @@ int bt_mesh_scan_disable(void); int bt_mesh_adv_enable(void); +/* Should not be called from work queue due to undefined behavior */ +int bt_mesh_adv_disable(void); + void bt_mesh_adv_buf_local_ready(void); void bt_mesh_adv_buf_relay_ready(void); diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 0c11fc0053a..9f0caa582ed 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -538,6 +538,36 @@ int bt_mesh_adv_enable(void) return 0; } +int bt_mesh_adv_disable(void) +{ + int err; + struct k_work_sync sync; + + for (int i = 0; i < ARRAY_SIZE(advs); i++) { + k_work_flush_delayable(&advs[i].work, &sync); + + err = bt_le_ext_adv_stop(advs[i].instance); + if (err) { + LOG_ERR("Failed to stop adv %d", err); + return err; + } + + /* `adv_sent` is called to finish transmission of an adv buffer that was pushed to + * the host before the advertiser was stopped, but did not finish. + */ + adv_sent(advs[i].instance, NULL); + + err = bt_le_ext_adv_delete(advs[i].instance); + if (err) { + LOG_ERR("Failed to delete adv %d", err); + return err; + } + advs[i].instance = NULL; + } + + return 0; +} + int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, int32_t duration, const struct bt_data *ad, size_t ad_len, diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index a7d7dd1a320..aef13864131 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -39,6 +39,7 @@ 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 int bt_data_send(uint8_t num_events, uint16_t adv_int, const struct bt_data *ad, size_t ad_len, @@ -144,10 +145,9 @@ static inline void buf_send(struct net_buf *buf) static void adv_thread(void *p1, void *p2, void *p3) { LOG_DBG("started"); + struct net_buf *buf; - while (1) { - struct net_buf *buf; - + while (enabled) { if (IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER)) { buf = bt_mesh_adv_buf_get(K_NO_WAIT); if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !buf) { @@ -188,6 +188,12 @@ static void adv_thread(void *p1, void *p2, void *p3) /* Give other threads a chance to run */ k_yield(); } + + /* Empty the advertising pool when advertising is disabled */ + while ((buf = bt_mesh_adv_buf_get(K_NO_WAIT))) { + bt_mesh_adv_send_start(0, -ENODEV, BT_MESH_ADV(buf)); + net_buf_unref(buf); + } } void bt_mesh_adv_buf_local_ready(void) @@ -221,10 +227,19 @@ void bt_mesh_adv_init(void) int bt_mesh_adv_enable(void) { + enabled = true; k_thread_start(&adv_thread_data); return 0; } +int bt_mesh_adv_disable(void) +{ + enabled = false; + k_thread_join(&adv_thread_data, K_FOREVER); + LOG_DBG("Advertising disabled"); + return 0; +} + int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, int32_t duration, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len) From 5abc83dee7b26d73994d90e2647e4a347730ebaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0094/2300] [nrf fromtree] Bluetooth: Mesh: suspend/resume advertising MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disables Mesh advertising when suspending, and enables advertising when resuming Mesh. Signed-off-by: Håvard Reierstad (cherry picked from commit 897a1d0d1cec1ba8bc811a335fc414f8fe1960f0) Signed-off-by: Håvard Reierstad (cherry picked from commit 00539bcdf7cd4f15f7e786d13d98c2eac828fd42) --- subsys/bluetooth/mesh/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 2c78ea227de..24bbd7c7e94 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -460,6 +460,13 @@ int bt_mesh_suspend(void) bt_mesh_model_foreach(model_suspend, NULL); + err = bt_mesh_adv_disable(); + if (err) { + atomic_clear_bit(bt_mesh.flags, BT_MESH_SUSPENDED); + LOG_WRN("Disabling advertisers failed (err %d)", err); + return err; + } + return 0; } @@ -488,6 +495,17 @@ int bt_mesh_resume(void) return -EALREADY; } + if (!IS_ENABLED(CONFIG_BT_EXT_ADV)) { + bt_mesh_adv_init(); + } + + err = bt_mesh_adv_enable(); + if (err) { + atomic_set_bit(bt_mesh.flags, BT_MESH_SUSPENDED); + LOG_WRN("Re-enabling advertisers failed (err %d)", err); + return err; + } + err = bt_mesh_scan_enable(); if (err) { LOG_WRN("Re-enabling scanning failed (err %d)", err); From 3a7a2d0e40710427c7bd8cd922b576c775d02f1f Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0095/2300] [nrf fromtree] Bluetooth: Mesh: Allow custom RPL use mesh settings work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change allows a custom RPL use pending mechanism and the mesh settings work to store pending RPL entries. `bt_mesh_rpl_pending_store` is a public API and should be implemented anyway. The custom RPL implementation has to trigger settings with the `BT_MESH_SETTINGS_RPL_PENDING` flag to ask the mesh settings work to call `bt_mesh_rpl_pending_store`. Signed-off-by: Pavel Vasilyev (cherry picked from commit bcd2aba4d755a73f06add63ea62df7b142f76ecc) Signed-off-by: Håvard Reierstad (cherry picked from commit 88122bae6f022d60b9a306908d31e2832372335c) --- subsys/bluetooth/mesh/settings.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/settings.c b/subsys/bluetooth/mesh/settings.c index 9cfcb3f5c2c..8ec9c66481a 100644 --- a/subsys/bluetooth/mesh/settings.c +++ b/subsys/bluetooth/mesh/settings.c @@ -186,8 +186,7 @@ static void store_pending(struct k_work *work) { LOG_DBG(""); - if (IS_ENABLED(CONFIG_BT_MESH_RPL_STORAGE_MODE_SETTINGS) && - atomic_test_and_clear_bit(pending_flags, BT_MESH_SETTINGS_RPL_PENDING)) { + if (atomic_test_and_clear_bit(pending_flags, BT_MESH_SETTINGS_RPL_PENDING)) { bt_mesh_rpl_pending_store(BT_MESH_ADDR_ALL_NODES); } From 37fcdbafb6e73d1c56d7add8e377a9471751ee0d Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0096/2300] [nrf fromtree] Bluetooth: Mesh: Convert no opcode error to debug log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This error message may confuse when `CONFIG_BT_MESH_ACCESS_LAYER_MSG` is enabled and all messages are processed by the callback anyway. This error message also confuses when a node is subscribed to the same address as it publishes to, which makes it generating the error message every time it publishes a message. Signed-off-by: Pavel Vasilyev (cherry picked from commit ef1f2d133674255580395b6af6ed3446f4ba3412) Signed-off-by: Håvard Reierstad (cherry picked from commit 353bc561d85af3e637b299aaee1b36fb75070321) --- subsys/bluetooth/mesh/access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index dcf7f0f783b..81e2902afd1 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -1424,7 +1424,7 @@ static int element_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple op = find_op(elem, opcode, &model); if (!op) { - LOG_ERR("No OpCode 0x%08x for elem 0x%02x", opcode, elem->rt->addr); + LOG_DBG("No OpCode 0x%08x for elem 0x%02x", opcode, elem->rt->addr); return ACCESS_STATUS_WRONG_OPCODE; } From fba4d322a8ec2d4d38af138f8caf8f762eb33413 Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0097/2300] [nrf fromtree] Bluetooth: Mesh: Use memslab replace with net_buf_pool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use memslab more efficiency than net_buf_pool and consume less ram with flash resource. Signed-off-by: Lingao Meng (cherry picked from commit 683098728ab548a8fdb34c575e30e6b9b7a3ed40) Signed-off-by: Håvard Reierstad (cherry picked from commit e12a81c47a25da93925863046dd79808643f1f8d) --- subsys/bluetooth/mesh/access.c | 1 - subsys/bluetooth/mesh/adv.c | 195 ++++++++++-------- subsys/bluetooth/mesh/adv.h | 51 +++-- subsys/bluetooth/mesh/adv_ext.c | 193 +++++++++-------- subsys/bluetooth/mesh/adv_legacy.c | 65 +++--- subsys/bluetooth/mesh/app_keys.c | 1 - subsys/bluetooth/mesh/beacon.c | 49 +++-- subsys/bluetooth/mesh/cfg.c | 1 - subsys/bluetooth/mesh/cfg_srv.c | 1 - subsys/bluetooth/mesh/friend.c | 15 +- subsys/bluetooth/mesh/gatt_cli.c | 1 - subsys/bluetooth/mesh/health_srv.c | 1 - subsys/bluetooth/mesh/lpn.c | 1 - subsys/bluetooth/mesh/main.c | 1 - subsys/bluetooth/mesh/net.c | 49 +++-- subsys/bluetooth/mesh/net.h | 3 +- subsys/bluetooth/mesh/pb_adv.c | 143 +++++++------ subsys/bluetooth/mesh/pb_gatt.c | 1 - subsys/bluetooth/mesh/pb_gatt_cli.c | 1 - subsys/bluetooth/mesh/pb_gatt_srv.c | 1 - subsys/bluetooth/mesh/priv_beacon_srv.c | 1 - subsys/bluetooth/mesh/prov_device.c | 1 - subsys/bluetooth/mesh/provisioner.c | 1 - subsys/bluetooth/mesh/proxy.h | 2 +- subsys/bluetooth/mesh/proxy_cli.c | 5 +- subsys/bluetooth/mesh/proxy_cli.h | 2 +- subsys/bluetooth/mesh/proxy_msg.c | 15 +- subsys/bluetooth/mesh/proxy_msg.h | 2 +- subsys/bluetooth/mesh/proxy_srv.c | 7 +- subsys/bluetooth/mesh/rpl.c | 1 - subsys/bluetooth/mesh/rpr_srv.c | 1 - subsys/bluetooth/mesh/solicitation.c | 1 - subsys/bluetooth/mesh/statistic.c | 17 +- subsys/bluetooth/mesh/statistic.h | 4 +- subsys/bluetooth/mesh/subnet.c | 1 - subsys/bluetooth/mesh/transport.c | 31 ++- subsys/bluetooth/mesh/transport_legacy.c | 31 ++- .../bsim/bluetooth/mesh/src/test_advertiser.c | 142 +++++++------ tests/bsim/bluetooth/mesh/src/test_beacon.c | 1 - tests/bsim/bluetooth/mesh/src/test_blob.c | 2 +- tests/bsim/bluetooth/mesh/src/test_dfu.c | 1 - .../bsim/bluetooth/mesh/src/test_provision.c | 1 - tests/bsim/bluetooth/mesh/src/test_scanner.c | 1 - 43 files changed, 521 insertions(+), 524 deletions(-) diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 81e2902afd1..f7de46fe167 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -19,7 +19,6 @@ #include "host/testing.h" #include "mesh.h" -#include "adv.h" #include "net.h" #include "lpn.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index 548e7f3fe15..00e2a4aa7bb 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -17,7 +17,6 @@ #include "common/bt_str.h" -#include "adv.h" #include "net.h" #include "foundation.h" #include "beacon.h" @@ -47,124 +46,144 @@ static K_FIFO_DEFINE(bt_mesh_adv_queue); static K_FIFO_DEFINE(bt_mesh_relay_queue); static K_FIFO_DEFINE(bt_mesh_friend_queue); -void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv *adv) +K_MEM_SLAB_DEFINE_STATIC(local_adv_pool, sizeof(struct bt_mesh_adv), + CONFIG_BT_MESH_ADV_BUF_COUNT, __alignof__(struct bt_mesh_adv)); + +#if defined(CONFIG_BT_MESH_RELAY_BUF_COUNT) +K_MEM_SLAB_DEFINE_STATIC(relay_adv_pool, sizeof(struct bt_mesh_adv), + CONFIG_BT_MESH_RELAY_BUF_COUNT, __alignof__(struct bt_mesh_adv)); +#endif + +#if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) +K_MEM_SLAB_DEFINE_STATIC(friend_adv_pool, sizeof(struct bt_mesh_adv), + CONFIG_BT_MESH_FRIEND_LPN_COUNT, __alignof__(struct bt_mesh_adv)); +#endif + +void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv_ctx *ctx) { - if (!adv->started) { - adv->started = 1; + if (!ctx->started) { + ctx->started = 1; - if (adv->cb && adv->cb->start) { - adv->cb->start(duration, err, adv->cb_data); + if (ctx->cb && ctx->cb->start) { + ctx->cb->start(duration, err, ctx->cb_data); } if (err) { - adv->cb = NULL; + ctx->cb = NULL; } else if (IS_ENABLED(CONFIG_BT_MESH_STATISTIC)) { - bt_mesh_stat_succeeded_count(adv); + bt_mesh_stat_succeeded_count(ctx); } } } -static void bt_mesh_adv_send_end(int err, struct bt_mesh_adv const *adv) +static void bt_mesh_adv_send_end(int err, struct bt_mesh_adv_ctx const *ctx) { - if (adv->started && adv->cb && adv->cb->end) { - adv->cb->end(err, adv->cb_data); + if (ctx->started && ctx->cb && ctx->cb->end) { + ctx->cb->end(err, ctx->cb_data); } } -static void adv_buf_destroy(struct net_buf *buf) +static struct bt_mesh_adv *adv_create_from_pool(struct k_mem_slab *buf_pool, + enum bt_mesh_adv_type type, + enum bt_mesh_adv_tag tag, + uint8_t xmit, k_timeout_t timeout) { - struct bt_mesh_adv adv = *BT_MESH_ADV(buf); + struct bt_mesh_adv_ctx *ctx; + struct bt_mesh_adv *adv; + int err; - net_buf_destroy(buf); + if (atomic_test_bit(bt_mesh.flags, BT_MESH_SUSPENDED)) { + LOG_WRN("Refusing to allocate buffer while suspended"); + return NULL; + } - bt_mesh_adv_send_end(0, &adv); -} + err = k_mem_slab_alloc(buf_pool, (void **)&adv, timeout); + if (err) { + return NULL; + } -NET_BUF_POOL_DEFINE(adv_buf_pool, CONFIG_BT_MESH_ADV_BUF_COUNT, - BT_MESH_ADV_DATA_SIZE, BT_MESH_ADV_USER_DATA_SIZE, - adv_buf_destroy); + adv->__ref = 1; -static struct bt_mesh_adv adv_local_pool[CONFIG_BT_MESH_ADV_BUF_COUNT]; + net_buf_simple_init_with_data(&adv->b, adv->__bufs, BT_MESH_ADV_DATA_SIZE); + net_buf_simple_reset(&adv->b); -#if defined(CONFIG_BT_MESH_RELAY) -NET_BUF_POOL_DEFINE(relay_buf_pool, CONFIG_BT_MESH_RELAY_BUF_COUNT, - BT_MESH_ADV_DATA_SIZE, BT_MESH_ADV_USER_DATA_SIZE, - adv_buf_destroy); + ctx = &adv->ctx; -static struct bt_mesh_adv adv_relay_pool[CONFIG_BT_MESH_RELAY_BUF_COUNT]; -#endif + (void)memset(ctx, 0, sizeof(*ctx)); -#if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) -NET_BUF_POOL_DEFINE(friend_buf_pool, CONFIG_BT_MESH_FRIEND_LPN_COUNT, - BT_MESH_ADV_DATA_SIZE, BT_MESH_ADV_USER_DATA_SIZE, - adv_buf_destroy); + ctx->type = type; + ctx->tag = tag; + ctx->xmit = xmit; -static struct bt_mesh_adv adv_friend_pool[CONFIG_BT_MESH_FRIEND_LPN_COUNT]; -#endif + return adv; +} -static struct net_buf *bt_mesh_adv_create_from_pool(struct net_buf_pool *buf_pool, - struct bt_mesh_adv *adv_pool, - enum bt_mesh_adv_type type, - enum bt_mesh_adv_tag tag, - uint8_t xmit, k_timeout_t timeout) +struct bt_mesh_adv *bt_mesh_adv_ref(struct bt_mesh_adv *adv) { - struct bt_mesh_adv *adv; - struct net_buf *buf; + __ASSERT_NO_MSG(adv->__ref < UINT8_MAX); - if (atomic_test_bit(bt_mesh.flags, BT_MESH_SUSPENDED)) { - LOG_WRN("Refusing to allocate buffer while suspended"); - return NULL; - } + adv->__ref++; - buf = net_buf_alloc(buf_pool, timeout); - if (!buf) { - return NULL; + return adv; +} + +void bt_mesh_adv_unref(struct bt_mesh_adv *adv) +{ + __ASSERT_NO_MSG(adv->__ref > 0); + + if (--adv->__ref > 0) { + return; } - adv = &adv_pool[net_buf_id(buf)]; - BT_MESH_ADV(buf) = adv; + struct k_mem_slab *slab = &local_adv_pool; + struct bt_mesh_adv_ctx ctx = adv->ctx; - (void)memset(adv, 0, sizeof(*adv)); +#if defined(CONFIG_BT_MESH_RELAY) + if (adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) { + slab = &relay_adv_pool; + } +#endif - adv->type = type; - adv->tag = tag; - adv->xmit = xmit; +#if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) + if (adv->ctx.tag == BT_MESH_ADV_TAG_FRIEND) { + slab = &friend_adv_pool; + } +#endif - return buf; + k_mem_slab_free(slab, (void *)adv); + bt_mesh_adv_send_end(0, &ctx); } -struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type, - enum bt_mesh_adv_tag tag, - uint8_t xmit, k_timeout_t timeout) +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 (tag == BT_MESH_ADV_TAG_RELAY) { - return bt_mesh_adv_create_from_pool(&relay_buf_pool, - adv_relay_pool, type, - tag, xmit, timeout); + return adv_create_from_pool(&relay_adv_pool, + type, tag, xmit, timeout); } #endif #if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) if (tag == BT_MESH_ADV_TAG_FRIEND) { - return bt_mesh_adv_create_from_pool(&friend_buf_pool, - adv_friend_pool, type, - tag, xmit, timeout); + return adv_create_from_pool(&friend_adv_pool, + type, tag, xmit, timeout); } #endif - return bt_mesh_adv_create_from_pool(&adv_buf_pool, adv_local_pool, type, - tag, xmit, timeout); + return adv_create_from_pool(&local_adv_pool, type, + tag, xmit, timeout); } -static struct net_buf *process_events(struct k_poll_event *ev, int count) +static struct bt_mesh_adv *process_events(struct k_poll_event *ev, int count) { for (; count; ev++, count--) { LOG_DBG("ev->state %u", ev->state); switch (ev->state) { case K_POLL_STATE_FIFO_DATA_AVAILABLE: - return net_buf_get(ev->fifo, K_NO_WAIT); + return k_fifo_get(ev->fifo, K_NO_WAIT); case K_POLL_STATE_NOT_READY: case K_POLL_STATE_CANCELLED: break; @@ -177,7 +196,7 @@ static struct net_buf *process_events(struct k_poll_event *ev, int count) return NULL; } -struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout) +struct bt_mesh_adv *bt_mesh_adv_get(k_timeout_t timeout) { int err; struct k_poll_event events[] = { @@ -204,22 +223,22 @@ struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout) return process_events(events, ARRAY_SIZE(events)); } -struct net_buf *bt_mesh_adv_buf_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout) +struct bt_mesh_adv *bt_mesh_adv_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout) { if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && tags & BT_MESH_ADV_TAG_BIT_FRIEND) { - return net_buf_get(&bt_mesh_friend_queue, timeout); + return k_fifo_get(&bt_mesh_friend_queue, timeout); } if (IS_ENABLED(CONFIG_BT_MESH_RELAY) && !(tags & BT_MESH_ADV_TAG_BIT_LOCAL)) { - return net_buf_get(&bt_mesh_relay_queue, timeout); + return k_fifo_get(&bt_mesh_relay_queue, timeout); } - return bt_mesh_adv_buf_get(timeout); + return bt_mesh_adv_get(timeout); } -void bt_mesh_adv_buf_get_cancel(void) +void bt_mesh_adv_get_cancel(void) { LOG_DBG(""); @@ -234,38 +253,38 @@ void bt_mesh_adv_buf_get_cancel(void) } } -void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb, +void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, void *cb_data) { - LOG_DBG("type 0x%02x len %u: %s", BT_MESH_ADV(buf)->type, buf->len, - bt_hex(buf->data, buf->len)); + LOG_DBG("type 0x%02x len %u: %s", adv->ctx.type, adv->b.len, + bt_hex(adv->b.data, adv->b.len)); - BT_MESH_ADV(buf)->cb = cb; - BT_MESH_ADV(buf)->cb_data = cb_data; - BT_MESH_ADV(buf)->busy = 1U; + adv->ctx.cb = cb; + adv->ctx.cb_data = cb_data; + adv->ctx.busy = 1U; if (IS_ENABLED(CONFIG_BT_MESH_STATISTIC)) { - bt_mesh_stat_planned_count(BT_MESH_ADV(buf)); + bt_mesh_stat_planned_count(&adv->ctx); } if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && - BT_MESH_ADV(buf)->tag == BT_MESH_ADV_TAG_FRIEND) { - net_buf_put(&bt_mesh_friend_queue, net_buf_ref(buf)); - bt_mesh_adv_buf_friend_ready(); + adv->ctx.tag == BT_MESH_ADV_TAG_FRIEND) { + k_fifo_put(&bt_mesh_friend_queue, bt_mesh_adv_ref(adv)); + bt_mesh_adv_friend_ready(); return; } if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) && - BT_MESH_ADV(buf)->tag == BT_MESH_ADV_TAG_RELAY) || + adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) || (IS_ENABLED(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS) && - BT_MESH_ADV(buf)->tag == BT_MESH_ADV_TAG_PROV)) { - net_buf_put(&bt_mesh_relay_queue, net_buf_ref(buf)); - bt_mesh_adv_buf_relay_ready(); + adv->ctx.tag == BT_MESH_ADV_TAG_PROV)) { + k_fifo_put(&bt_mesh_relay_queue, bt_mesh_adv_ref(adv)); + bt_mesh_adv_relay_ready(); return; } - net_buf_put(&bt_mesh_adv_queue, net_buf_ref(buf)); - bt_mesh_adv_buf_local_ready(); + k_fifo_put(&bt_mesh_adv_queue, bt_mesh_adv_ref(adv)); + bt_mesh_adv_local_ready(); } int bt_mesh_adv_gatt_send(void) diff --git a/subsys/bluetooth/mesh/adv.h b/subsys/bluetooth/mesh/adv.h index 42b07601ad5..0c936a1aa52 100644 --- a/subsys/bluetooth/mesh/adv.h +++ b/subsys/bluetooth/mesh/adv.h @@ -4,14 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +#ifndef ZEPHYR_SUBSYS_BLUETOOTH_MESH_ADV_H_ +#define ZEPHYR_SUBSYS_BLUETOOTH_MESH_ADV_H_ + /* Maximum advertising data payload for a single data type */ #define BT_MESH_ADV_DATA_SIZE 29 -/* The user data is a pointer (4 bytes) to struct bt_mesh_adv */ -#define BT_MESH_ADV_USER_DATA_SIZE 4 - -#define BT_MESH_ADV(buf) (*(struct bt_mesh_adv **)net_buf_user_data(buf)) - #define BT_MESH_ADV_SCAN_UNIT(_ms) ((_ms) * 8 / 5) #define BT_MESH_SCAN_INTERVAL_MS 30 #define BT_MESH_SCAN_WINDOW_MS 30 @@ -41,7 +39,7 @@ enum bt_mesh_adv_tag_bit { BT_MESH_ADV_TAG_BIT_PROV = BIT(BT_MESH_ADV_TAG_PROV), }; -struct bt_mesh_adv { +struct bt_mesh_adv_ctx { const struct bt_mesh_send_cb *cb; void *cb_data; @@ -53,24 +51,39 @@ struct bt_mesh_adv { uint8_t xmit; }; +struct bt_mesh_adv { + sys_snode_t node; + + struct bt_mesh_adv_ctx ctx; + + struct net_buf_simple b; + + uint8_t __ref; + + uint8_t __bufs[BT_MESH_ADV_DATA_SIZE]; +}; + /* Lookup table for Advertising data types for bt_mesh_adv_type: */ extern const uint8_t bt_mesh_adv_type[BT_MESH_ADV_TYPES]; +struct bt_mesh_adv *bt_mesh_adv_ref(struct bt_mesh_adv *adv); +void bt_mesh_adv_unref(struct bt_mesh_adv *adv); + /* xmit_count: Number of retransmissions, i.e. 0 == 1 transmission */ -struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type, - enum bt_mesh_adv_tag tag, - uint8_t xmit, k_timeout_t timeout); +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); -void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb, +void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, void *cb_data); -struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout); +struct bt_mesh_adv *bt_mesh_adv_get(k_timeout_t timeout); -struct net_buf *bt_mesh_adv_buf_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout); +struct bt_mesh_adv *bt_mesh_adv_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout); void bt_mesh_adv_gatt_update(void); -void bt_mesh_adv_buf_get_cancel(void); +void bt_mesh_adv_get_cancel(void); void bt_mesh_adv_init(void); @@ -83,13 +96,13 @@ int bt_mesh_adv_enable(void); /* Should not be called from work queue due to undefined behavior */ int bt_mesh_adv_disable(void); -void bt_mesh_adv_buf_local_ready(void); +void bt_mesh_adv_local_ready(void); -void bt_mesh_adv_buf_relay_ready(void); +void bt_mesh_adv_relay_ready(void); -void bt_mesh_adv_buf_terminate(const struct net_buf *buf); +void bt_mesh_adv_terminate(struct bt_mesh_adv *adv); -void bt_mesh_adv_buf_friend_ready(void); +void bt_mesh_adv_friend_ready(void); int bt_mesh_adv_gatt_send(void); @@ -97,9 +110,11 @@ int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, int32_t duration const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len); -void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv *adv); +void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv_ctx *ctx); 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); + +#endif /* ZEPHYR_SUBSYS_BLUETOOTH_MESH_ADV_H_ */ diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 9f0caa582ed..856c6c39f1d 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -21,7 +21,6 @@ #include "host/hci_core.h" -#include "adv.h" #include "net.h" #include "proxy.h" #include "solicitation.h" @@ -63,14 +62,14 @@ struct bt_mesh_ext_adv { const enum bt_mesh_adv_tag_bit tags; ATOMIC_DEFINE(flags, ADV_FLAGS_NUM); struct bt_le_ext_adv *instance; - struct net_buf *buf; + struct bt_mesh_adv *adv; uint64_t timestamp; struct k_work_delayable work; struct bt_le_adv_param adv_param; }; static void send_pending_adv(struct k_work *work); -static bool schedule_send(struct bt_mesh_ext_adv *adv); +static bool schedule_send(struct bt_mesh_ext_adv *ext_adv); static struct bt_mesh_ext_adv advs[] = { [0] = { @@ -161,7 +160,7 @@ static int set_adv_randomness(uint8_t handle, int rand_us) #endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ } -static int adv_start(struct bt_mesh_ext_adv *adv, +static int adv_start(struct bt_mesh_ext_adv *ext_adv, const struct bt_le_adv_param *param, struct bt_le_ext_adv_start_param *start, const struct bt_data *ad, size_t ad_len, @@ -169,47 +168,47 @@ static int adv_start(struct bt_mesh_ext_adv *adv, { int err; - if (!adv->instance) { + if (!ext_adv->instance) { LOG_ERR("Mesh advertiser not enabled"); return -ENODEV; } - if (atomic_test_and_set_bit(adv->flags, ADV_FLAG_ACTIVE)) { + if (atomic_test_and_set_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { LOG_ERR("Advertiser is busy"); return -EBUSY; } - if (atomic_test_bit(adv->flags, ADV_FLAG_UPDATE_PARAMS)) { - err = bt_le_ext_adv_update_param(adv->instance, param); + if (atomic_test_bit(ext_adv->flags, ADV_FLAG_UPDATE_PARAMS)) { + err = bt_le_ext_adv_update_param(ext_adv->instance, param); if (err) { LOG_ERR("Failed updating adv params: %d", err); - atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); return err; } - atomic_set_bit_to(adv->flags, ADV_FLAG_UPDATE_PARAMS, - param != &adv->adv_param); + atomic_set_bit_to(ext_adv->flags, ADV_FLAG_UPDATE_PARAMS, + param != &ext_adv->adv_param); } - err = bt_le_ext_adv_set_data(adv->instance, ad, ad_len, sd, sd_len); + err = bt_le_ext_adv_set_data(ext_adv->instance, ad, ad_len, sd, sd_len); if (err) { LOG_ERR("Failed setting adv data: %d", err); - atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); return err; } - adv->timestamp = k_uptime_get(); + ext_adv->timestamp = k_uptime_get(); - err = bt_le_ext_adv_start(adv->instance, start); + err = bt_le_ext_adv_start(ext_adv->instance, start); if (err) { LOG_ERR("Advertising failed: err %d", err); - atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); } return err; } -static int bt_data_send(struct bt_mesh_ext_adv *adv, uint8_t num_events, uint16_t adv_interval, +static int bt_data_send(struct bt_mesh_ext_adv *ext_adv, uint8_t num_events, uint16_t adv_interval, const struct bt_data *ad, size_t ad_len) { struct bt_le_ext_adv_start_param start = { @@ -219,41 +218,41 @@ static int bt_data_send(struct bt_mesh_ext_adv *adv, uint8_t num_events, uint16_ adv_interval = MAX(ADV_INT_FAST_MS, adv_interval); /* Only update advertising parameters if they're different */ - if (adv->adv_param.interval_min != BT_MESH_ADV_SCAN_UNIT(adv_interval)) { - adv->adv_param.interval_min = BT_MESH_ADV_SCAN_UNIT(adv_interval); - adv->adv_param.interval_max = adv->adv_param.interval_min; - atomic_set_bit(adv->flags, ADV_FLAG_UPDATE_PARAMS); + if (ext_adv->adv_param.interval_min != BT_MESH_ADV_SCAN_UNIT(adv_interval)) { + ext_adv->adv_param.interval_min = BT_MESH_ADV_SCAN_UNIT(adv_interval); + ext_adv->adv_param.interval_max = ext_adv->adv_param.interval_min; + atomic_set_bit(ext_adv->flags, ADV_FLAG_UPDATE_PARAMS); } - return adv_start(adv, &adv->adv_param, &start, ad, ad_len, NULL, 0); + return adv_start(ext_adv, &ext_adv->adv_param, &start, ad, ad_len, NULL, 0); } -static int buf_send(struct bt_mesh_ext_adv *adv, struct net_buf *buf) +static int adv_send(struct bt_mesh_ext_adv *ext_adv, struct bt_mesh_adv *adv) { - uint8_t num_events = BT_MESH_TRANSMIT_COUNT(BT_MESH_ADV(buf)->xmit) + 1; + uint8_t num_events = BT_MESH_TRANSMIT_COUNT(adv->ctx.xmit) + 1; uint16_t duration, adv_int; struct bt_data ad; int err; - adv_int = BT_MESH_TRANSMIT_INT(BT_MESH_ADV(buf)->xmit); + adv_int = BT_MESH_TRANSMIT_INT(adv->ctx.xmit); /* Upper boundary estimate: */ duration = num_events * (adv_int + 10); - LOG_DBG("type %u len %u: %s", BT_MESH_ADV(buf)->type, - buf->len, bt_hex(buf->data, buf->len)); + LOG_DBG("type %u len %u: %s", adv->ctx.type, + adv->b.len, bt_hex(adv->b.data, adv->b.len)); LOG_DBG("count %u interval %ums duration %ums", num_events, adv_int, duration); - ad.type = bt_mesh_adv_type[BT_MESH_ADV(buf)->type]; - ad.data_len = buf->len; - ad.data = buf->data; + ad.type = bt_mesh_adv_type[adv->ctx.type]; + ad.data_len = adv->b.len; + ad.data = adv->b.data; - err = bt_data_send(adv, num_events, adv_int, &ad, 1); + err = bt_data_send(ext_adv, num_events, adv_int, &ad, 1); if (!err) { - adv->buf = net_buf_ref(buf); + ext_adv->adv = bt_mesh_adv_ref(adv); } - bt_mesh_adv_send_start(duration, err, BT_MESH_ADV(buf)); + bt_mesh_adv_send_start(duration, err, &adv->ctx); return err; } @@ -268,50 +267,50 @@ static const char * const adv_tag_to_str[] = { static void send_pending_adv(struct k_work *work) { - struct bt_mesh_ext_adv *adv; - struct net_buf *buf; + struct bt_mesh_ext_adv *ext_adv; + struct bt_mesh_adv *adv; int err; - adv = CONTAINER_OF(work, struct bt_mesh_ext_adv, work.work); + ext_adv = CONTAINER_OF(work, struct bt_mesh_ext_adv, work.work); - if (atomic_test_and_clear_bit(adv->flags, ADV_FLAG_SENT)) { + if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_SENT)) { /* Calling k_uptime_delta on a timestamp moves it to the current time. * This is essential here, as schedule_send() uses the end of the event * as a reference to avoid sending the next advertisement too soon. */ - int64_t duration = k_uptime_delta(&adv->timestamp); + int64_t duration = k_uptime_delta(&ext_adv->timestamp); LOG_DBG("Advertising stopped after %u ms for %s", (uint32_t)duration, - adv->buf ? adv_tag_to_str[BT_MESH_ADV(adv->buf)->tag] : + ext_adv->adv ? adv_tag_to_str[ext_adv->adv->ctx.tag] : adv_tag_to_str[BT_MESH_ADV_TAG_PROXY]); - atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); - atomic_clear_bit(adv->flags, ADV_FLAG_PROXY); - atomic_clear_bit(adv->flags, ADV_FLAG_PROXY_START); + atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY); + atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); - if (adv->buf) { - net_buf_unref(adv->buf); - adv->buf = NULL; + if (ext_adv->adv) { + bt_mesh_adv_unref(ext_adv->adv); + ext_adv->adv = NULL; } - (void)schedule_send(adv); + (void)schedule_send(ext_adv); return; } - atomic_clear_bit(adv->flags, ADV_FLAG_SCHEDULED); + atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULED); - while ((buf = bt_mesh_adv_buf_get_by_tag(adv->tags, K_NO_WAIT))) { + while ((adv = bt_mesh_adv_get_by_tag(ext_adv->tags, K_NO_WAIT))) { /* busy == 0 means this was canceled */ - if (!BT_MESH_ADV(buf)->busy) { - net_buf_unref(buf); + if (!adv->ctx.busy) { + bt_mesh_adv_unref(adv); continue; } - BT_MESH_ADV(buf)->busy = 0U; - err = buf_send(adv, buf); + adv->ctx.busy = 0U; + err = adv_send(ext_adv, adv); - net_buf_unref(buf); + bt_mesh_adv_unref(adv); if (!err) { return; /* Wait for advertising to finish */ @@ -319,7 +318,7 @@ static void send_pending_adv(struct k_work *work) } if (!IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER) || - !(adv->tags & BT_MESH_ADV_TAG_BIT_PROXY)) { + !(ext_adv->tags & BT_MESH_ADV_TAG_BIT_PROXY)) { return; } @@ -328,51 +327,51 @@ static void send_pending_adv(struct k_work *work) return; } - atomic_set_bit(adv->flags, ADV_FLAG_PROXY_START); + atomic_set_bit(ext_adv->flags, ADV_FLAG_PROXY_START); if (!bt_mesh_adv_gatt_send()) { - atomic_set_bit(adv->flags, ADV_FLAG_PROXY); + atomic_set_bit(ext_adv->flags, ADV_FLAG_PROXY); } - if (atomic_test_and_clear_bit(adv->flags, ADV_FLAG_SCHEDULE_PENDING)) { - schedule_send(adv); + if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING)) { + schedule_send(ext_adv); } } -static bool schedule_send(struct bt_mesh_ext_adv *adv) +static bool schedule_send(struct bt_mesh_ext_adv *ext_adv) { uint64_t timestamp; int64_t delta; - timestamp = adv->timestamp; + timestamp = ext_adv->timestamp; - if (atomic_test_and_clear_bit(adv->flags, ADV_FLAG_PROXY)) { - atomic_clear_bit(adv->flags, ADV_FLAG_PROXY_START); - (void)bt_le_ext_adv_stop(adv->instance); + if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_PROXY)) { + atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); + (void)bt_le_ext_adv_stop(ext_adv->instance); - atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); } - if (atomic_test_bit(adv->flags, ADV_FLAG_ACTIVE)) { - atomic_set_bit(adv->flags, ADV_FLAG_SCHEDULE_PENDING); + if (atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { + atomic_set_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); return false; - } else if (atomic_test_and_set_bit(adv->flags, ADV_FLAG_SCHEDULED)) { + } else if (atomic_test_and_set_bit(ext_adv->flags, ADV_FLAG_SCHEDULED)) { return false; } - atomic_clear_bit(adv->flags, ADV_FLAG_SCHEDULE_PENDING); + atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); if ((IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && - adv->tags & BT_MESH_ADV_TAG_BIT_FRIEND) || - (CONFIG_BT_MESH_RELAY_ADV_SETS > 0 && adv->tags & BT_MESH_ADV_TAG_BIT_RELAY)) { - k_work_reschedule(&adv->work, K_NO_WAIT); + ext_adv->tags & BT_MESH_ADV_TAG_BIT_FRIEND) || + (CONFIG_BT_MESH_RELAY_ADV_SETS > 0 && ext_adv->tags & BT_MESH_ADV_TAG_BIT_RELAY)) { + k_work_reschedule(&ext_adv->work, K_NO_WAIT); } else { /* The controller will send the next advertisement immediately. * Introduce a delay here to avoid sending the next mesh packet closer * to the previous packet than what's permitted by the specification. */ delta = k_uptime_delta(×tamp); - k_work_reschedule(&adv->work, K_MSEC(ADV_INT_FAST_MS - delta)); + k_work_reschedule(&ext_adv->work, K_MSEC(ADV_INT_FAST_MS - delta)); } return true; @@ -383,17 +382,17 @@ void bt_mesh_adv_gatt_update(void) (void)schedule_send(gatt_adv_get()); } -void bt_mesh_adv_buf_local_ready(void) +void bt_mesh_adv_local_ready(void) { (void)schedule_send(advs); } -void bt_mesh_adv_buf_relay_ready(void) +void bt_mesh_adv_relay_ready(void) { - struct bt_mesh_ext_adv *adv = relay_adv_get(); + struct bt_mesh_ext_adv *ext_adv = relay_adv_get(); for (int i = 0; i < CONFIG_BT_MESH_RELAY_ADV_SETS; i++) { - if (schedule_send(&adv[i])) { + if (schedule_send(&ext_adv[i])) { return; } } @@ -404,7 +403,7 @@ void bt_mesh_adv_buf_relay_ready(void) } } -void bt_mesh_adv_buf_friend_ready(void) +void bt_mesh_adv_friend_ready(void) { if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE)) { schedule_send(&advs[1 + CONFIG_BT_MESH_RELAY_ADV_SETS]); @@ -413,33 +412,33 @@ void bt_mesh_adv_buf_friend_ready(void) } } -void bt_mesh_adv_buf_terminate(const struct net_buf *buf) +void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) { int err; for (int i = 0; i < ARRAY_SIZE(advs); i++) { - struct bt_mesh_ext_adv *adv = &advs[i]; + struct bt_mesh_ext_adv *ext_adv = &advs[i]; - if (adv->buf != buf) { + if (ext_adv->adv != adv) { continue; } - if (!atomic_test_bit(adv->flags, ADV_FLAG_ACTIVE)) { + if (!atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { return; } - err = bt_le_ext_adv_stop(adv->instance); + err = bt_le_ext_adv_stop(ext_adv->instance); if (err) { LOG_ERR("Failed to stop adv %d", err); return; } /* Do not call `cb:end`, since this user action */ - BT_MESH_ADV(adv->buf)->cb = NULL; + adv->ctx.cb = NULL; - atomic_set_bit(adv->flags, ADV_FLAG_SENT); + atomic_set_bit(ext_adv->flags, ADV_FLAG_SENT); - k_work_submit(&adv->work.work); + k_work_submit(&ext_adv->work.work); return; } @@ -475,31 +474,31 @@ static struct bt_mesh_ext_adv *adv_instance_find(struct bt_le_ext_adv *instance) static void adv_sent(struct bt_le_ext_adv *instance, struct bt_le_ext_adv_sent_info *info) { - struct bt_mesh_ext_adv *adv = adv_instance_find(instance); + struct bt_mesh_ext_adv *ext_adv = adv_instance_find(instance); - if (!adv) { + if (!ext_adv) { LOG_WRN("Unexpected adv instance"); return; } - if (!atomic_test_bit(adv->flags, ADV_FLAG_ACTIVE)) { + if (!atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { return; } - atomic_set_bit(adv->flags, ADV_FLAG_SENT); + atomic_set_bit(ext_adv->flags, ADV_FLAG_SENT); - k_work_submit(&adv->work.work); + k_work_submit(&ext_adv->work.work); } #if defined(CONFIG_BT_MESH_GATT_SERVER) static void connected(struct bt_le_ext_adv *instance, struct bt_le_ext_adv_connected_info *info) { - struct bt_mesh_ext_adv *adv = gatt_adv_get(); + struct bt_mesh_ext_adv *ext_adv = gatt_adv_get(); - if (atomic_test_and_clear_bit(adv->flags, ADV_FLAG_PROXY_START)) { - atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); - (void)schedule_send(adv); + if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START)) { + atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); + (void)schedule_send(ext_adv); } } #endif /* CONFIG_BT_MESH_GATT_SERVER */ @@ -573,7 +572,7 @@ int bt_mesh_adv_gatt_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_mesh_ext_adv *adv = gatt_adv_get(); + struct bt_mesh_ext_adv *ext_adv = gatt_adv_get(); struct bt_le_ext_adv_start_param start = { /* Timeout is set in 10 ms steps, with 0 indicating "forever" */ .timeout = (duration == SYS_FOREVER_MS) ? 0 : MAX(1, duration / 10), @@ -581,9 +580,9 @@ int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, LOG_DBG("Start advertising %d ms", duration); - atomic_set_bit(adv->flags, ADV_FLAG_UPDATE_PARAMS); + atomic_set_bit(ext_adv->flags, ADV_FLAG_UPDATE_PARAMS); - return adv_start(adv, param, &start, ad, ad_len, sd, sd_len); + return adv_start(ext_adv, param, &start, ad, ad_len, sd, sd_len); } int bt_mesh_adv_bt_data_send(uint8_t num_events, uint16_t adv_interval, diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index aef13864131..d4003e497bb 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -19,7 +19,6 @@ #include "host/hci_core.h" -#include "adv.h" #include "net.h" #include "foundation.h" #include "beacon.h" @@ -43,7 +42,7 @@ static bool enabled; static int bt_data_send(uint8_t num_events, uint16_t adv_int, const struct bt_data *ad, size_t ad_len, - struct bt_mesh_adv *adv) + struct bt_mesh_adv_ctx *ctx) { struct bt_le_adv_param param = {}; uint64_t uptime = k_uptime_get(); @@ -101,8 +100,8 @@ static int bt_data_send(uint8_t num_events, uint16_t adv_int, LOG_DBG("Advertising started. Sleeping %u ms", duration); - if (adv) { - bt_mesh_adv_send_start(duration, err, adv); + if (ctx) { + bt_mesh_adv_send_start(duration, err, ctx); } k_sleep(K_MSEC(duration)); @@ -124,37 +123,37 @@ int bt_mesh_adv_bt_data_send(uint8_t num_events, uint16_t adv_int, return bt_data_send(num_events, adv_int, ad, ad_len, NULL); } -static inline void buf_send(struct net_buf *buf) +static inline void adv_send(struct bt_mesh_adv *adv) { - uint16_t num_events = BT_MESH_TRANSMIT_COUNT(BT_MESH_ADV(buf)->xmit) + 1; + uint16_t num_events = BT_MESH_TRANSMIT_COUNT(adv->ctx.xmit) + 1; uint16_t adv_int; struct bt_data ad; - adv_int = BT_MESH_TRANSMIT_INT(BT_MESH_ADV(buf)->xmit); + adv_int = BT_MESH_TRANSMIT_INT(adv->ctx.xmit); - LOG_DBG("type %u len %u: %s", BT_MESH_ADV(buf)->type, - buf->len, bt_hex(buf->data, buf->len)); + LOG_DBG("type %u len %u: %s", adv->ctx.type, + adv->b.len, bt_hex(adv->b.data, adv->b.len)); - ad.type = bt_mesh_adv_type[BT_MESH_ADV(buf)->type]; - ad.data_len = buf->len; - ad.data = buf->data; + ad.type = bt_mesh_adv_type[adv->ctx.type]; + ad.data_len = adv->b.len; + ad.data = adv->b.data; - bt_data_send(num_events, adv_int, &ad, 1, BT_MESH_ADV(buf)); + bt_data_send(num_events, adv_int, &ad, 1, &adv->ctx); } static void adv_thread(void *p1, void *p2, void *p3) { LOG_DBG("started"); - struct net_buf *buf; + struct bt_mesh_adv *adv; while (enabled) { if (IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER)) { - buf = bt_mesh_adv_buf_get(K_NO_WAIT); - if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !buf) { + adv = bt_mesh_adv_get(K_NO_WAIT); + if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !adv) { (void)bt_mesh_sol_send(); } - while (!buf) { + while (!adv) { /* Adv timeout may be set by a call from proxy * to bt_mesh_adv_gatt_start: @@ -162,58 +161,58 @@ static void adv_thread(void *p1, void *p2, void *p3) adv_timeout = SYS_FOREVER_MS; (void)bt_mesh_adv_gatt_send(); - buf = bt_mesh_adv_buf_get(SYS_TIMEOUT_MS(adv_timeout)); + adv = bt_mesh_adv_get(SYS_TIMEOUT_MS(adv_timeout)); bt_le_adv_stop(); - if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !buf) { + if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !adv) { (void)bt_mesh_sol_send(); } } } else { - buf = bt_mesh_adv_buf_get(K_FOREVER); + adv = bt_mesh_adv_get(K_FOREVER); } - if (!buf) { + if (!adv) { continue; } /* busy == 0 means this was canceled */ - if (BT_MESH_ADV(buf)->busy) { - BT_MESH_ADV(buf)->busy = 0U; - buf_send(buf); + if (adv->ctx.busy) { + adv->ctx.busy = 0U; + adv_send(adv); } - net_buf_unref(buf); + bt_mesh_adv_unref(adv); /* Give other threads a chance to run */ k_yield(); } /* Empty the advertising pool when advertising is disabled */ - while ((buf = bt_mesh_adv_buf_get(K_NO_WAIT))) { - bt_mesh_adv_send_start(0, -ENODEV, BT_MESH_ADV(buf)); - net_buf_unref(buf); + while ((adv = bt_mesh_adv_get(K_NO_WAIT))) { + bt_mesh_adv_send_start(0, -ENODEV, &adv->ctx); + bt_mesh_adv_unref(adv); } } -void bt_mesh_adv_buf_local_ready(void) +void bt_mesh_adv_local_ready(void) { /* Will be handled automatically */ } -void bt_mesh_adv_buf_relay_ready(void) +void bt_mesh_adv_relay_ready(void) { /* Will be handled automatically */ } void bt_mesh_adv_gatt_update(void) { - bt_mesh_adv_buf_get_cancel(); + bt_mesh_adv_get_cancel(); } -void bt_mesh_adv_buf_terminate(const struct net_buf *buf) +void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) { - ARG_UNUSED(buf); + ARG_UNUSED(adv); } void bt_mesh_adv_init(void) diff --git a/subsys/bluetooth/mesh/app_keys.c b/subsys/bluetooth/mesh/app_keys.c index a47d31447c5..5afd887a8e8 100644 --- a/subsys/bluetooth/mesh/app_keys.c +++ b/subsys/bluetooth/mesh/app_keys.c @@ -17,7 +17,6 @@ #include "rpl.h" #include "settings.h" #include "crypto.h" -#include "adv.h" #include "proxy.h" #include "friend.h" #include "foundation.h" diff --git a/subsys/bluetooth/mesh/beacon.c b/subsys/bluetooth/mesh/beacon.c index afdea5b4c6a..ef337f9f510 100644 --- a/subsys/bluetooth/mesh/beacon.c +++ b/subsys/bluetooth/mesh/beacon.c @@ -16,7 +16,6 @@ #include "common/bt_str.h" -#include "adv.h" #include "mesh.h" #include "net.h" #include "prov.h" @@ -256,7 +255,7 @@ static bool net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *b .end = beacon_complete, }; uint32_t now = k_uptime_get_32(); - struct net_buf *buf; + struct bt_mesh_adv *adv; uint32_t time_diff; uint32_t time_since_last_recv; int err; @@ -271,19 +270,19 @@ static bool net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *b return false; } - buf = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, + adv = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, PROV_XMIT, K_NO_WAIT); - if (!buf) { - LOG_ERR("Unable to allocate beacon buffer"); + if (!adv) { + LOG_ERR("Unable to allocate beacon adv"); return true; /* Bail out */ } - err = beacon_create(sub, &buf->b); + err = beacon_create(sub, &adv->b); if (!err) { - bt_mesh_adv_send(buf, &send_cb, beacon); + bt_mesh_adv_send(adv, &send_cb, beacon); } - net_buf_unref(buf); + bt_mesh_adv_unref(adv); return err != 0; } @@ -330,22 +329,22 @@ static int unprovisioned_beacon_send(void) { const struct bt_mesh_prov *prov; uint8_t uri_hash[16] = { 0 }; - struct net_buf *buf; + struct bt_mesh_adv *adv; uint16_t oob_info; LOG_DBG(""); - buf = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, + adv = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, UNPROV_XMIT, K_NO_WAIT); - if (!buf) { - LOG_ERR("Unable to allocate beacon buffer"); + if (!adv) { + LOG_ERR("Unable to allocate beacon adv"); return -ENOBUFS; } prov = bt_mesh_prov_get(); - net_buf_add_u8(buf, BEACON_TYPE_UNPROVISIONED); - net_buf_add_mem(buf, prov->uuid, 16); + net_buf_simple_add_u8(&adv->b, BEACON_TYPE_UNPROVISIONED); + net_buf_simple_add_mem(&adv->b, prov->uuid, 16); if (prov->uri && bt_mesh_s1_str(prov->uri, uri_hash) == 0) { oob_info = prov->oob_info | BT_MESH_PROV_OOB_URI; @@ -353,31 +352,31 @@ static int unprovisioned_beacon_send(void) oob_info = prov->oob_info; } - net_buf_add_be16(buf, oob_info); - net_buf_add_mem(buf, uri_hash, 4); + net_buf_simple_add_be16(&adv->b, oob_info); + net_buf_simple_add_mem(&adv->b, uri_hash, 4); - bt_mesh_adv_send(buf, NULL, NULL); - net_buf_unref(buf); + bt_mesh_adv_send(adv, NULL, NULL); + bt_mesh_adv_unref(adv); if (prov->uri) { size_t len; - buf = bt_mesh_adv_create(BT_MESH_ADV_URI, BT_MESH_ADV_TAG_LOCAL, + adv = bt_mesh_adv_create(BT_MESH_ADV_URI, BT_MESH_ADV_TAG_LOCAL, UNPROV_XMIT, K_NO_WAIT); - if (!buf) { - LOG_ERR("Unable to allocate URI buffer"); + if (!adv) { + LOG_ERR("Unable to allocate URI adv"); return -ENOBUFS; } len = strlen(prov->uri); - if (net_buf_tailroom(buf) < len) { + if (net_buf_simple_tailroom(&adv->b) < len) { LOG_WRN("Too long URI to fit advertising data"); } else { - net_buf_add_mem(buf, prov->uri, len); - bt_mesh_adv_send(buf, NULL, NULL); + net_buf_simple_add_mem(&adv->b, prov->uri, len); + bt_mesh_adv_send(adv, NULL, NULL); } - net_buf_unref(buf); + bt_mesh_adv_unref(adv); } return 0; diff --git a/subsys/bluetooth/mesh/cfg.c b/subsys/bluetooth/mesh/cfg.c index c7bea0d29b0..4fef60d5c8d 100644 --- a/subsys/bluetooth/mesh/cfg.c +++ b/subsys/bluetooth/mesh/cfg.c @@ -14,7 +14,6 @@ #include "settings.h" #include "heartbeat.h" #include "friend.h" -#include "adv.h" #include "cfg.h" #include "od_priv_proxy.h" #include "priv_beacon.h" diff --git a/subsys/bluetooth/mesh/cfg_srv.c b/subsys/bluetooth/mesh/cfg_srv.c index fa6bb48703a..268f883d8b8 100644 --- a/subsys/bluetooth/mesh/cfg_srv.c +++ b/subsys/bluetooth/mesh/cfg_srv.c @@ -21,7 +21,6 @@ #include "host/testing.h" #include "mesh.h" -#include "adv.h" #include "net.h" #include "rpl.h" #include "lpn.h" diff --git a/subsys/bluetooth/mesh/friend.c b/subsys/bluetooth/mesh/friend.c index 73b75eadf4f..6fbd9f81a68 100644 --- a/subsys/bluetooth/mesh/friend.c +++ b/subsys/bluetooth/mesh/friend.c @@ -13,7 +13,6 @@ #include #include "crypto.h" -#include "adv.h" #include "mesh.h" #include "net.h" #include "app_keys.h" @@ -1239,7 +1238,7 @@ static void friend_timeout(struct k_work *work) .start = buf_send_start, .end = buf_send_end, }; - struct net_buf *buf; + struct bt_mesh_adv *adv; uint8_t md; if (!friend_is_allocated(frnd)) { @@ -1281,19 +1280,19 @@ static void friend_timeout(struct k_work *work) frnd->queue_size--; send_last: - buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_FRIEND, + adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_FRIEND, FRIEND_XMIT, K_NO_WAIT); - if (!buf) { - LOG_ERR("Unable to allocate friend adv buffer"); + if (!adv) { + LOG_ERR("Unable to allocate friend adv"); return; } - net_buf_add_mem(buf, frnd->last->data, frnd->last->len); + net_buf_simple_add_mem(&adv->b, frnd->last->data, frnd->last->len); frnd->pending_req = 0U; frnd->pending_buf = 1U; - bt_mesh_adv_send(buf, &buf_sent_cb, frnd); - net_buf_unref(buf); + bt_mesh_adv_send(adv, &buf_sent_cb, frnd); + bt_mesh_adv_unref(adv); } static void subnet_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt) diff --git a/subsys/bluetooth/mesh/gatt_cli.c b/subsys/bluetooth/mesh/gatt_cli.c index bff9b567011..7814f32f27f 100644 --- a/subsys/bluetooth/mesh/gatt_cli.c +++ b/subsys/bluetooth/mesh/gatt_cli.c @@ -18,7 +18,6 @@ #include "common/bt_str.h" #include "mesh.h" -#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/health_srv.c b/subsys/bluetooth/mesh/health_srv.c index 8611e1004f6..3db3410aa34 100644 --- a/subsys/bluetooth/mesh/health_srv.c +++ b/subsys/bluetooth/mesh/health_srv.c @@ -16,7 +16,6 @@ #include #include "mesh.h" -#include "adv.h" #include "net.h" #include "transport.h" #include "access.h" diff --git a/subsys/bluetooth/mesh/lpn.c b/subsys/bluetooth/mesh/lpn.c index 2b655f729f3..f6f906b12fe 100644 --- a/subsys/bluetooth/mesh/lpn.c +++ b/subsys/bluetooth/mesh/lpn.c @@ -13,7 +13,6 @@ #include #include "crypto.h" -#include "adv.h" #include "mesh.h" #include "net.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 24bbd7c7e94..89115ebe3e8 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -18,7 +18,6 @@ #include #include "test.h" -#include "adv.h" #include "prov.h" #include "provisioner.h" #include "net.h" diff --git a/subsys/bluetooth/mesh/net.c b/subsys/bluetooth/mesh/net.c index 6a9f29b4064..943a5e83c23 100644 --- a/subsys/bluetooth/mesh/net.c +++ b/subsys/bluetooth/mesh/net.c @@ -20,7 +20,6 @@ #include "common/bt_str.h" #include "crypto.h" -#include "adv.h" #include "mesh.h" #include "net.h" #include "rpl.h" @@ -526,19 +525,19 @@ static int net_loopback(const struct bt_mesh_net_tx *tx, const uint8_t *data, return 0; } -int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf, +int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, void *cb_data) { const struct bt_mesh_net_cred *cred; int err; LOG_DBG("src 0x%04x dst 0x%04x len %u headroom %zu tailroom %zu", tx->src, tx->ctx->addr, - buf->len, net_buf_headroom(buf), net_buf_tailroom(buf)); - LOG_DBG("Payload len %u: %s", buf->len, bt_hex(buf->data, buf->len)); + adv->b.len, net_buf_simple_headroom(&adv->b), net_buf_simple_tailroom(&adv->b)); + LOG_DBG("Payload len %u: %s", adv->b.len, bt_hex(adv->b.data, adv->b.len)); LOG_DBG("Seq 0x%06x", bt_mesh.seq); cred = net_tx_cred_get(tx); - err = net_header_encode(tx, cred->nid, &buf->b); + err = net_header_encode(tx, cred->nid, &adv->b); if (err) { goto done; } @@ -546,7 +545,7 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf, /* Deliver to local network interface if necessary */ if (bt_mesh_fixed_group_match(tx->ctx->addr) || bt_mesh_has_addr(tx->ctx->addr)) { - err = net_loopback(tx, buf->data, buf->len); + err = net_loopback(tx, adv->b.data, adv->b.len); /* Local unicast messages should not go out to network */ if (BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr) || @@ -569,28 +568,28 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf, goto done; } - err = net_encrypt(&buf->b, cred, BT_MESH_NET_IVI_TX, BT_MESH_NONCE_NETWORK); + err = net_encrypt(&adv->b, cred, BT_MESH_NET_IVI_TX, BT_MESH_NONCE_NETWORK); if (err) { goto done; } - BT_MESH_ADV(buf)->cb = cb; - BT_MESH_ADV(buf)->cb_data = cb_data; + adv->ctx.cb = cb; + adv->ctx.cb_data = cb_data; /* Deliver to GATT Proxy Clients if necessary. */ if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) { - (void)bt_mesh_proxy_relay(buf, tx->ctx->addr); + (void)bt_mesh_proxy_relay(adv, tx->ctx->addr); } /* Deliver to GATT Proxy Servers if necessary. */ if (IS_ENABLED(CONFIG_BT_MESH_PROXY_CLIENT)) { - (void)bt_mesh_proxy_cli_relay(buf); + (void)bt_mesh_proxy_cli_relay(adv); } - bt_mesh_adv_send(buf, cb, cb_data); + bt_mesh_adv_send(adv, cb, cb_data); done: - net_buf_unref(buf); + bt_mesh_adv_unref(adv); return err; } @@ -684,7 +683,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, struct bt_mesh_net_rx *rx) { const struct bt_mesh_net_cred *cred; - struct net_buf *buf; + struct bt_mesh_adv *adv; uint8_t transmit; if (rx->ctx.recv_ttl <= 1U) { @@ -711,10 +710,10 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, transmit = bt_mesh_net_transmit_get(); } - buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_RELAY, + adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_RELAY, transmit, K_NO_WAIT); - if (!buf) { - LOG_DBG("Out of relay buffers"); + if (!adv) { + LOG_DBG("Out of relay advs"); return; } @@ -722,23 +721,23 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, sbuf->data[1] &= 0x80; sbuf->data[1] |= rx->ctx.recv_ttl - 1U; - net_buf_add_mem(buf, sbuf->data, sbuf->len); + net_buf_simple_add_mem(&adv->b, sbuf->data, sbuf->len); cred = &rx->sub->keys[SUBNET_KEY_TX_IDX(rx->sub)].msg; - LOG_DBG("Relaying packet. TTL is now %u", TTL(buf->data)); + LOG_DBG("Relaying packet. TTL is now %u", TTL(adv->b.data)); /* Update NID if RX or RX was with friend credentials */ if (rx->friend_cred) { - buf->data[0] &= 0x80; /* Clear everything except IVI */ - buf->data[0] |= cred->nid; + adv->b.data[0] &= 0x80; /* Clear everything except IVI */ + adv->b.data[0] |= cred->nid; } /* We re-encrypt and obfuscate using the received IVI rather than * the normal TX IVI (which may be different) since the transport * layer nonce includes the IVI. */ - if (net_encrypt(&buf->b, cred, BT_MESH_NET_IVI_RX(rx), BT_MESH_NONCE_NETWORK)) { + if (net_encrypt(&adv->b, cred, BT_MESH_NET_IVI_RX(rx), BT_MESH_NONCE_NETWORK)) { LOG_ERR("Re-encrypting failed"); goto done; } @@ -751,15 +750,15 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, (rx->friend_cred || bt_mesh_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED || bt_mesh_priv_gatt_proxy_get() == BT_MESH_PRIV_GATT_PROXY_ENABLED)) { - bt_mesh_proxy_relay(buf, rx->ctx.recv_dst); + bt_mesh_proxy_relay(adv, rx->ctx.recv_dst); } if (relay_to_adv(rx->net_if) || rx->friend_cred) { - bt_mesh_adv_send(buf, NULL, NULL); + bt_mesh_adv_send(adv, NULL, NULL); } done: - net_buf_unref(buf); + bt_mesh_adv_unref(adv); } void bt_mesh_net_header_parse(struct net_buf_simple *buf, diff --git a/subsys/bluetooth/mesh/net.h b/subsys/bluetooth/mesh/net.h index 04179a4dd49..28c21da3eaf 100644 --- a/subsys/bluetooth/mesh/net.h +++ b/subsys/bluetooth/mesh/net.h @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "adv.h" #include "subnet.h" #include @@ -291,7 +292,7 @@ bool bt_mesh_net_iv_update(uint32_t iv_index, bool iv_update); int bt_mesh_net_encode(struct bt_mesh_net_tx *tx, struct net_buf_simple *buf, enum bt_mesh_nonce_type type); -int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf, +int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, void *cb_data); int bt_mesh_net_decode(struct net_buf_simple *in, enum bt_mesh_net_if net_if, diff --git a/subsys/bluetooth/mesh/pb_adv.c b/subsys/bluetooth/mesh/pb_adv.c index e273739ed72..f723ff48c14 100644 --- a/subsys/bluetooth/mesh/pb_adv.c +++ b/subsys/bluetooth/mesh/pb_adv.c @@ -11,7 +11,6 @@ #include #include "host/testing.h" #include "net.h" -#include "adv.h" #include "crypto.h" #include "beacon.h" #include "prov.h" @@ -101,8 +100,8 @@ struct pb_adv { /* Transaction timeout in seconds */ uint8_t timeout; - /* Pending outgoing buffer(s) */ - struct net_buf *buf[3]; + /* Pending outgoing adv(s) */ + struct bt_mesh_adv *adv[3]; prov_bearer_send_complete_t cb; @@ -170,24 +169,24 @@ static void free_segments(void) { int i; - for (i = 0; i < ARRAY_SIZE(link.tx.buf); i++) { - struct net_buf *buf = link.tx.buf[i]; + for (i = 0; i < ARRAY_SIZE(link.tx.adv); i++) { + struct bt_mesh_adv *adv = link.tx.adv[i]; - if (!buf) { + if (!adv) { break; } - link.tx.buf[i] = NULL; + link.tx.adv[i] = NULL; /* Terminate active adv */ - if (BT_MESH_ADV(buf)->busy == 0U) { - bt_mesh_adv_buf_terminate(buf); + if (adv->ctx.busy == 0U) { + bt_mesh_adv_terminate(adv); } else { /* Mark as canceled */ - BT_MESH_ADV(buf)->busy = 0U; + adv->ctx.busy = 0U; } - net_buf_unref(buf); + bt_mesh_adv_unref(adv); } } @@ -200,7 +199,7 @@ static void prov_clear_tx(void) { LOG_DBG(""); - /* If this fails, the work handler will not find any buffers to send, + /* If this fails, the work handler will not find any advs to send, * and return without rescheduling. The work handler also checks the * LINK_ACTIVE flag, so if this call is part of reset_adv_link, it'll * exit early. @@ -254,19 +253,19 @@ static void close_link(enum prov_bearer_link_status reason) cb->link_closed(&bt_mesh_pb_adv, cb_data, reason); } -static struct net_buf *adv_buf_create(uint8_t retransmits) +static struct bt_mesh_adv *adv_create(uint8_t retransmits) { - struct net_buf *buf; + struct bt_mesh_adv *adv; - buf = bt_mesh_adv_create(BT_MESH_ADV_PROV, BT_MESH_ADV_TAG_PROV, + adv = bt_mesh_adv_create(BT_MESH_ADV_PROV, BT_MESH_ADV_TAG_PROV, BT_MESH_TRANSMIT(retransmits, 20), BUF_TIMEOUT); - if (!buf) { - LOG_ERR("Out of provisioning buffers"); + if (!adv) { + LOG_ERR("Out of provisioning advs"); return NULL; } - return buf; + return adv; } static void ack_complete(uint16_t duration, int err, void *user_data) @@ -328,7 +327,7 @@ static void gen_prov_ack_send(uint8_t xact_id) .start = ack_complete, }; const struct bt_mesh_send_cb *complete; - struct net_buf *buf; + struct bt_mesh_adv *adv; bool pending = atomic_test_and_set_bit(link.flags, ADV_ACK_PENDING); LOG_DBG("xact_id 0x%x", xact_id); @@ -338,8 +337,8 @@ static void gen_prov_ack_send(uint8_t xact_id) return; } - buf = adv_buf_create(RETRANSMITS_ACK); - if (!buf) { + adv = adv_create(RETRANSMITS_ACK); + if (!adv) { atomic_clear_bit(link.flags, ADV_ACK_PENDING); return; } @@ -351,12 +350,12 @@ static void gen_prov_ack_send(uint8_t xact_id) complete = &cb; } - net_buf_add_be32(buf, link.id); - net_buf_add_u8(buf, xact_id); - net_buf_add_u8(buf, GPC_ACK); + net_buf_simple_add_be32(&adv->b, link.id); + net_buf_simple_add_u8(&adv->b, xact_id); + net_buf_simple_add_u8(&adv->b, GPC_ACK); - bt_mesh_adv_send(buf, complete, NULL); - net_buf_unref(buf); + bt_mesh_adv_send(adv, complete, NULL); + bt_mesh_adv_unref(adv); } static void gen_prov_cont(struct prov_rx *rx, struct net_buf_simple *buf) @@ -431,7 +430,7 @@ static void gen_prov_ack(struct prov_rx *rx, struct net_buf_simple *buf) { LOG_DBG("len %u", buf->len); - if (!link.tx.buf[0]) { + if (!link.tx.adv[0]) { return; } @@ -596,20 +595,20 @@ static void send_reliable(void) { int i; - for (i = 0; i < ARRAY_SIZE(link.tx.buf); i++) { - struct net_buf *buf = link.tx.buf[i]; + for (i = 0; i < ARRAY_SIZE(link.tx.adv); i++) { + struct bt_mesh_adv *adv = link.tx.adv[i]; - if (!buf) { + if (!adv) { break; } - if (BT_MESH_ADV(buf)->busy) { + if (adv->ctx.busy) { continue; } - LOG_DBG("%u bytes: %s", buf->len, bt_hex(buf->data, buf->len)); + LOG_DBG("%u bytes: %s", adv->b.len, bt_hex(adv->b.data, adv->b.len)); - bt_mesh_adv_send(buf, NULL, NULL); + bt_mesh_adv_send(adv, NULL, NULL); } k_work_reschedule(&link.tx.retransmit, RETRANSMIT_TIMEOUT); @@ -633,30 +632,30 @@ static void prov_retransmit(struct k_work *work) send_reliable(); } -static struct net_buf *ctl_buf_create(uint8_t op, const void *data, uint8_t data_len, - uint8_t retransmits) +static struct bt_mesh_adv *ctl_adv_create(uint8_t op, const void *data, uint8_t data_len, + uint8_t retransmits) { - struct net_buf *buf; + struct bt_mesh_adv *adv; LOG_DBG("op 0x%02x data_len %u", op, data_len); - buf = adv_buf_create(retransmits); - if (!buf) { + adv = adv_create(retransmits); + if (!adv) { return NULL; } - net_buf_add_be32(buf, link.id); + net_buf_simple_add_be32(&adv->b, link.id); /* Transaction ID, always 0 for Bearer messages */ - net_buf_add_u8(buf, 0x00); - net_buf_add_u8(buf, GPC_CTL(op)); - net_buf_add_mem(buf, data, data_len); + net_buf_simple_add_u8(&adv->b, 0x00); + net_buf_simple_add_u8(&adv->b, GPC_CTL(op)); + net_buf_simple_add_mem(&adv->b, data, data_len); - return buf; + return adv; } -static int bearer_ctl_send(struct net_buf *buf) +static int bearer_ctl_send(struct bt_mesh_adv *adv) { - if (!buf) { + if (!adv) { return -ENOMEM; } @@ -664,23 +663,23 @@ static int bearer_ctl_send(struct net_buf *buf) k_work_reschedule(&link.prot_timer, bt_mesh_prov_protocol_timeout_get()); link.tx.start = k_uptime_get(); - link.tx.buf[0] = buf; + link.tx.adv[0] = adv; send_reliable(); return 0; } -static int bearer_ctl_send_unacked(struct net_buf *buf, void *user_data) +static int bearer_ctl_send_unacked(struct bt_mesh_adv *adv, void *user_data) { - if (!buf) { + if (!adv) { return -ENOMEM; } prov_clear_tx(); k_work_reschedule(&link.prot_timer, bt_mesh_prov_protocol_timeout_get()); - bt_mesh_adv_send(buf, &buf_sent_cb, user_data); - net_buf_unref(buf); + bt_mesh_adv_send(adv, &buf_sent_cb, user_data); + bt_mesh_adv_unref(adv); return 0; } @@ -688,26 +687,26 @@ static int bearer_ctl_send_unacked(struct net_buf *buf, void *user_data) static int prov_send_adv(struct net_buf_simple *msg, prov_bearer_send_complete_t cb, void *cb_data) { - struct net_buf *start, *buf; + struct bt_mesh_adv *start, *adv; uint8_t seg_len, seg_id; prov_clear_tx(); k_work_reschedule(&link.prot_timer, bt_mesh_prov_protocol_timeout_get()); - start = adv_buf_create(RETRANSMITS_RELIABLE); + start = adv_create(RETRANSMITS_RELIABLE); if (!start) { return -ENOBUFS; } link.tx.id = next_transaction_id(link.tx.id); - net_buf_add_be32(start, link.id); - net_buf_add_u8(start, link.tx.id); + net_buf_simple_add_be32(&start->b, link.id); + net_buf_simple_add_u8(&start->b, link.tx.id); - net_buf_add_u8(start, GPC_START(last_seg(msg->len))); - net_buf_add_be16(start, msg->len); - net_buf_add_u8(start, bt_mesh_fcs_calc(msg->data, msg->len)); + net_buf_simple_add_u8(&start->b, GPC_START(last_seg(msg->len))); + net_buf_simple_add_be16(&start->b, msg->len); + net_buf_simple_add_u8(&start->b, bt_mesh_fcs_calc(msg->data, msg->len)); - link.tx.buf[0] = start; + link.tx.adv[0] = start; link.tx.cb = cb; link.tx.cb_data = cb_data; link.tx.start = k_uptime_get(); @@ -716,33 +715,33 @@ static int prov_send_adv(struct net_buf_simple *msg, seg_len = MIN(msg->len, START_PAYLOAD_MAX); LOG_DBG("seg 0 len %u: %s", seg_len, bt_hex(msg->data, seg_len)); - net_buf_add_mem(start, msg->data, seg_len); + net_buf_simple_add_mem(&start->b, msg->data, seg_len); net_buf_simple_pull(msg, seg_len); - buf = start; + adv = start; for (seg_id = 1U; msg->len > 0; seg_id++) { - if (seg_id >= ARRAY_SIZE(link.tx.buf)) { + if (seg_id >= ARRAY_SIZE(link.tx.adv)) { LOG_ERR("Too big message"); free_segments(); return -E2BIG; } - buf = adv_buf_create(RETRANSMITS_RELIABLE); - if (!buf) { + adv = adv_create(RETRANSMITS_RELIABLE); + if (!adv) { free_segments(); return -ENOBUFS; } - link.tx.buf[seg_id] = buf; + link.tx.adv[seg_id] = adv; seg_len = MIN(msg->len, CONT_PAYLOAD_MAX); LOG_DBG("seg %u len %u: %s", seg_id, seg_len, bt_hex(msg->data, seg_len)); - net_buf_add_be32(buf, link.id); - net_buf_add_u8(buf, link.tx.id); - net_buf_add_u8(buf, GPC_CONT(seg_id)); - net_buf_add_mem(buf, msg->data, seg_len); + net_buf_simple_add_be32(&adv->b, link.id); + net_buf_simple_add_u8(&adv->b, link.tx.id); + net_buf_simple_add_u8(&adv->b, GPC_CONT(seg_id)); + net_buf_simple_add_mem(&adv->b, msg->data, seg_len); net_buf_simple_pull(msg, seg_len); } @@ -776,7 +775,7 @@ static void link_open(struct prov_rx *rx, struct net_buf_simple *buf) LOG_DBG("Resending link ack"); /* Ignore errors, message will be attempted again if we keep receiving link open: */ (void)bearer_ctl_send_unacked( - ctl_buf_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), + ctl_adv_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), (void *)PROV_BEARER_LINK_STATUS_SUCCESS); return; } @@ -791,7 +790,7 @@ static void link_open(struct prov_rx *rx, struct net_buf_simple *buf) net_buf_simple_reset(link.rx.buf); err = bearer_ctl_send_unacked( - ctl_buf_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), + ctl_adv_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), (void *)PROV_BEARER_LINK_STATUS_SUCCESS); if (err) { reset_adv_link(); @@ -891,7 +890,7 @@ static int prov_link_open(const uint8_t uuid[16], uint8_t timeout, net_buf_simple_reset(link.rx.buf); - return bearer_ctl_send(ctl_buf_create(LINK_OPEN, uuid, 16, RETRANSMITS_RELIABLE)); + return bearer_ctl_send(ctl_adv_create(LINK_OPEN, uuid, 16, RETRANSMITS_RELIABLE)); } static int prov_link_accept(const struct prov_bearer_cb *cb, void *cb_data) @@ -936,7 +935,7 @@ static void prov_link_close(enum prov_bearer_link_status status) link.tx.timeout = CLOSING_TIMEOUT; /* Ignore errors, the link will time out eventually if this doesn't get sent */ bearer_ctl_send_unacked( - ctl_buf_create(LINK_CLOSE, &status, 1, RETRANSMITS_LINK_CLOSE), + ctl_adv_create(LINK_CLOSE, &status, 1, RETRANSMITS_LINK_CLOSE), (void *)status); } diff --git a/subsys/bluetooth/mesh/pb_gatt.c b/subsys/bluetooth/mesh/pb_gatt.c index f8acc8f6c5a..849914f4b5f 100644 --- a/subsys/bluetooth/mesh/pb_gatt.c +++ b/subsys/bluetooth/mesh/pb_gatt.c @@ -8,7 +8,6 @@ #include #include "net.h" #include "proxy.h" -#include "adv.h" #include "prov.h" #include "pb_gatt.h" #include "proxy_msg.h" diff --git a/subsys/bluetooth/mesh/pb_gatt_cli.c b/subsys/bluetooth/mesh/pb_gatt_cli.c index 9231cc0f0b1..bf7dc14029a 100644 --- a/subsys/bluetooth/mesh/pb_gatt_cli.c +++ b/subsys/bluetooth/mesh/pb_gatt_cli.c @@ -16,7 +16,6 @@ #include #include "mesh.h" -#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/pb_gatt_srv.c b/subsys/bluetooth/mesh/pb_gatt_srv.c index f6d9298fc78..f4fdac53570 100644 --- a/subsys/bluetooth/mesh/pb_gatt_srv.c +++ b/subsys/bluetooth/mesh/pb_gatt_srv.c @@ -17,7 +17,6 @@ #include "common/bt_str.h" #include "mesh.h" -#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/priv_beacon_srv.c b/subsys/bluetooth/mesh/priv_beacon_srv.c index 5b5e62f1736..98be589fc22 100644 --- a/subsys/bluetooth/mesh/priv_beacon_srv.c +++ b/subsys/bluetooth/mesh/priv_beacon_srv.c @@ -5,7 +5,6 @@ */ #include #include "net.h" -#include "adv.h" #include #include "proxy.h" #include "foundation.h" diff --git a/subsys/bluetooth/mesh/prov_device.c b/subsys/bluetooth/mesh/prov_device.c index af890396ac7..6ca65c2ec63 100644 --- a/subsys/bluetooth/mesh/prov_device.c +++ b/subsys/bluetooth/mesh/prov_device.c @@ -20,7 +20,6 @@ #include "common/bt_str.h" #include "crypto.h" -#include "adv.h" #include "mesh.h" #include "net.h" #include "rpl.h" diff --git a/subsys/bluetooth/mesh/provisioner.c b/subsys/bluetooth/mesh/provisioner.c index aba2449892f..ba02723e830 100644 --- a/subsys/bluetooth/mesh/provisioner.c +++ b/subsys/bluetooth/mesh/provisioner.c @@ -21,7 +21,6 @@ #include "common/bt_str.h" #include "crypto.h" -#include "adv.h" #include "mesh.h" #include "net.h" #include "rpl.h" diff --git a/subsys/bluetooth/mesh/proxy.h b/subsys/bluetooth/mesh/proxy.h index a2f6bb45ff6..34a119c3df6 100644 --- a/subsys/bluetooth/mesh/proxy.h +++ b/subsys/bluetooth/mesh/proxy.h @@ -34,6 +34,6 @@ int bt_mesh_proxy_adv_start(void); void bt_mesh_proxy_identity_start(struct bt_mesh_subnet *sub, bool private); void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub); -bool bt_mesh_proxy_relay(struct net_buf *buf, uint16_t dst); +bool bt_mesh_proxy_relay(struct bt_mesh_adv *adv, uint16_t dst); void bt_mesh_proxy_addr_add(struct net_buf_simple *buf, uint16_t addr); uint8_t bt_mesh_proxy_srv_connected_cnt(void); diff --git a/subsys/bluetooth/mesh/proxy_cli.c b/subsys/bluetooth/mesh/proxy_cli.c index a0a25751b41..5dd6b02361f 100644 --- a/subsys/bluetooth/mesh/proxy_cli.c +++ b/subsys/bluetooth/mesh/proxy_cli.c @@ -16,7 +16,6 @@ #include #include "mesh.h" -#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" @@ -79,7 +78,7 @@ static struct bt_mesh_proxy_server *find_proxy_srv_by_conn(struct bt_conn *conn) return NULL; } -bool bt_mesh_proxy_cli_relay(struct net_buf *buf) +bool bt_mesh_proxy_cli_relay(struct bt_mesh_adv *adv) { bool relayed = false; int i; @@ -91,7 +90,7 @@ bool bt_mesh_proxy_cli_relay(struct net_buf *buf) continue; } - if (bt_mesh_proxy_relay_send(server->role->conn, buf)) { + if (bt_mesh_proxy_relay_send(server->role->conn, adv)) { continue; } diff --git a/subsys/bluetooth/mesh/proxy_cli.h b/subsys/bluetooth/mesh/proxy_cli.h index 8c1fae10e84..c0b69f4aaf6 100644 --- a/subsys/bluetooth/mesh/proxy_cli.h +++ b/subsys/bluetooth/mesh/proxy_cli.h @@ -8,6 +8,6 @@ void bt_mesh_proxy_cli_adv_recv(const struct bt_le_scan_recv_info *info, struct net_buf_simple *buf); -bool bt_mesh_proxy_cli_relay(struct net_buf *buf); +bool bt_mesh_proxy_cli_relay(struct bt_mesh_adv *adv); bool bt_mesh_proxy_cli_is_connected(uint16_t net_idx); diff --git a/subsys/bluetooth/mesh/proxy_msg.c b/subsys/bluetooth/mesh/proxy_msg.c index 025909e0503..b2fa113d456 100644 --- a/subsys/bluetooth/mesh/proxy_msg.c +++ b/subsys/bluetooth/mesh/proxy_msg.c @@ -21,7 +21,6 @@ #include "common/bt_str.h" #include "mesh.h" -#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" @@ -196,12 +195,12 @@ int bt_mesh_proxy_msg_send(struct bt_conn *conn, uint8_t type, static void buf_send_end(struct bt_conn *conn, void *user_data) { - struct net_buf *buf = user_data; + struct bt_mesh_adv *adv = user_data; - net_buf_unref(buf); + bt_mesh_adv_unref(adv); } -int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct net_buf *buf) +int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv) { int err; @@ -211,12 +210,12 @@ int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct net_buf *buf) * so we need to make a copy. */ net_buf_simple_reserve(&msg, 1); - net_buf_simple_add_mem(&msg, buf->data, buf->len); + net_buf_simple_add_mem(&msg, adv->b.data, adv->b.len); err = bt_mesh_proxy_msg_send(conn, BT_MESH_PROXY_NET_PDU, - &msg, buf_send_end, net_buf_ref(buf)); + &msg, buf_send_end, bt_mesh_adv_ref(adv)); - bt_mesh_adv_send_start(0, err, BT_MESH_ADV(buf)); + bt_mesh_adv_send_start(0, err, &adv->ctx); if (err) { LOG_ERR("Failed to send proxy message (err %d)", err); @@ -225,7 +224,7 @@ int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct net_buf *buf) * which is just opaque data to segment_and send) reference given * to segment_and_send() here. */ - net_buf_unref(buf); + bt_mesh_adv_unref(adv); } return err; diff --git a/subsys/bluetooth/mesh/proxy_msg.h b/subsys/bluetooth/mesh/proxy_msg.h index 7d4bd51ae4f..7ad4be7ae5d 100644 --- a/subsys/bluetooth/mesh/proxy_msg.h +++ b/subsys/bluetooth/mesh/proxy_msg.h @@ -51,7 +51,7 @@ ssize_t bt_mesh_proxy_msg_recv(struct bt_conn *conn, int bt_mesh_proxy_msg_send(struct bt_conn *conn, uint8_t type, struct net_buf_simple *msg, bt_gatt_complete_func_t end, void *user_data); -int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct net_buf *buf); +int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv); struct bt_mesh_proxy_role *bt_mesh_proxy_role_setup(struct bt_conn *conn, 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 571144ceaed..45e29915325 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -20,7 +20,6 @@ #include "common/bt_str.h" #include "mesh.h" -#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" @@ -1022,12 +1021,12 @@ static bool client_filter_match(struct bt_mesh_proxy_client *client, return false; } -bool bt_mesh_proxy_relay(struct net_buf *buf, uint16_t dst) +bool bt_mesh_proxy_relay(struct bt_mesh_adv *adv, uint16_t dst) { bool relayed = false; int i; - LOG_DBG("%u bytes to dst 0x%04x", buf->len, dst); + LOG_DBG("%u bytes to dst 0x%04x", adv->b.len, dst); for (i = 0; i < ARRAY_SIZE(clients); i++) { struct bt_mesh_proxy_client *client = &clients[i]; @@ -1040,7 +1039,7 @@ bool bt_mesh_proxy_relay(struct net_buf *buf, uint16_t dst) continue; } - if (bt_mesh_proxy_relay_send(client->cli->conn, buf)) { + if (bt_mesh_proxy_relay_send(client->cli->conn, adv)) { continue; } diff --git a/subsys/bluetooth/mesh/rpl.c b/subsys/bluetooth/mesh/rpl.c index e19df33908f..df67ddf9d2e 100644 --- a/subsys/bluetooth/mesh/rpl.c +++ b/subsys/bluetooth/mesh/rpl.c @@ -20,7 +20,6 @@ #include #include "mesh.h" -#include "adv.h" #include "net.h" #include "rpl.h" #include "settings.h" diff --git a/subsys/bluetooth/mesh/rpr_srv.c b/subsys/bluetooth/mesh/rpr_srv.c index 9813842a367..e97df35f28f 100644 --- a/subsys/bluetooth/mesh/rpr_srv.c +++ b/subsys/bluetooth/mesh/rpr_srv.c @@ -14,7 +14,6 @@ #include #include #include "access.h" -#include "adv.h" #include "prov.h" #include "crypto.h" #include "rpr.h" diff --git a/subsys/bluetooth/mesh/solicitation.c b/subsys/bluetooth/mesh/solicitation.c index e2100fa42db..642abfd87f1 100644 --- a/subsys/bluetooth/mesh/solicitation.c +++ b/subsys/bluetooth/mesh/solicitation.c @@ -12,7 +12,6 @@ #include #include #include "access.h" -#include "adv.h" #include "cfg.h" #include "crypto.h" #include "mesh.h" diff --git a/subsys/bluetooth/mesh/statistic.c b/subsys/bluetooth/mesh/statistic.c index 21c451bee73..b9f542a5923 100644 --- a/subsys/bluetooth/mesh/statistic.c +++ b/subsys/bluetooth/mesh/statistic.c @@ -6,7 +6,6 @@ #include -#include "adv.h" #include "net.h" #include "statistic.h" @@ -22,24 +21,24 @@ void bt_mesh_stat_reset(void) memset(&stat, 0, sizeof(struct bt_mesh_statistic)); } -void bt_mesh_stat_planned_count(struct bt_mesh_adv *adv) +void bt_mesh_stat_planned_count(struct bt_mesh_adv_ctx *ctx) { - if (adv->tag == BT_MESH_ADV_TAG_LOCAL) { + if (ctx->tag == BT_MESH_ADV_TAG_LOCAL) { stat.tx_local_planned++; - } else if (adv->tag == BT_MESH_ADV_TAG_RELAY) { + } else if (ctx->tag == BT_MESH_ADV_TAG_RELAY) { stat.tx_adv_relay_planned++; - } else if (adv->tag == BT_MESH_ADV_TAG_FRIEND) { + } else if (ctx->tag == BT_MESH_ADV_TAG_FRIEND) { stat.tx_friend_planned++; } } -void bt_mesh_stat_succeeded_count(struct bt_mesh_adv *adv) +void bt_mesh_stat_succeeded_count(struct bt_mesh_adv_ctx *ctx) { - if (adv->tag == BT_MESH_ADV_TAG_LOCAL) { + if (ctx->tag == BT_MESH_ADV_TAG_LOCAL) { stat.tx_local_succeeded++; - } else if (adv->tag == BT_MESH_ADV_TAG_RELAY) { + } else if (ctx->tag == BT_MESH_ADV_TAG_RELAY) { stat.tx_adv_relay_succeeded++; - } else if (adv->tag == BT_MESH_ADV_TAG_FRIEND) { + } else if (ctx->tag == BT_MESH_ADV_TAG_FRIEND) { stat.tx_friend_succeeded++; } } diff --git a/subsys/bluetooth/mesh/statistic.h b/subsys/bluetooth/mesh/statistic.h index fdb488f0d81..4cd9187f45a 100644 --- a/subsys/bluetooth/mesh/statistic.h +++ b/subsys/bluetooth/mesh/statistic.h @@ -7,8 +7,8 @@ #ifndef ZEPHYR_SUBSYS_BLUETOOTH_MESH_STATISTIC_H_ #define ZEPHYR_SUBSYS_BLUETOOTH_MESH_STATISTIC_H_ -void bt_mesh_stat_planned_count(struct bt_mesh_adv *adv); -void bt_mesh_stat_succeeded_count(struct bt_mesh_adv *adv); +void bt_mesh_stat_planned_count(struct bt_mesh_adv_ctx *ctx); +void bt_mesh_stat_succeeded_count(struct bt_mesh_adv_ctx *ctx); void bt_mesh_stat_rx(enum bt_mesh_net_if net_if); #endif /* ZEPHYR_SUBSYS_BLUETOOTH_MESH_STATISTIC_H_ */ diff --git a/subsys/bluetooth/mesh/subnet.c b/subsys/bluetooth/mesh/subnet.c index ef90ff8f725..695dd321b49 100644 --- a/subsys/bluetooth/mesh/subnet.c +++ b/subsys/bluetooth/mesh/subnet.c @@ -22,7 +22,6 @@ #include "common/bt_str.h" #include "crypto.h" -#include "adv.h" #include "mesh.h" #include "net.h" #include "lpn.h" diff --git a/subsys/bluetooth/mesh/transport.c b/subsys/bluetooth/mesh/transport.c index 94c1f698e91..47e8492a901 100644 --- a/subsys/bluetooth/mesh/transport.c +++ b/subsys/bluetooth/mesh/transport.c @@ -22,7 +22,6 @@ #include "host/testing.h" #include "crypto.h" -#include "adv.h" #include "mesh.h" #include "net.h" #include "app_keys.h" @@ -122,26 +121,26 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, const struct bt_mesh_send_cb *cb, void *cb_data, const uint8_t *ctl_op) { - struct net_buf *buf; + struct bt_mesh_adv *adv; - buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, tx->xmit, BUF_TIMEOUT); - if (!buf) { - LOG_ERR("Out of network buffers"); + if (!adv) { + LOG_ERR("Out of network advs"); return -ENOBUFS; } - net_buf_reserve(buf, BT_MESH_NET_HDR_LEN); + net_buf_simple_reserve(&adv->b, BT_MESH_NET_HDR_LEN); if (ctl_op) { - net_buf_add_u8(buf, TRANS_CTL_HDR(*ctl_op, 0)); + net_buf_simple_add_u8(&adv->b, TRANS_CTL_HDR(*ctl_op, 0)); } else if (BT_MESH_IS_DEV_KEY(tx->ctx->app_idx)) { - net_buf_add_u8(buf, UNSEG_HDR(0, 0)); + net_buf_simple_add_u8(&adv->b, UNSEG_HDR(0, 0)); } else { - net_buf_add_u8(buf, UNSEG_HDR(1, tx->aid)); + net_buf_simple_add_u8(&adv->b, UNSEG_HDR(1, tx->aid)); } - net_buf_add_mem(buf, sdu->data, sdu->len); + net_buf_simple_add_mem(&adv->b, sdu->data, sdu->len); if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { if (!bt_mesh_friend_queue_has_space(tx->sub->net_idx, @@ -149,7 +148,7 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, NULL, 1)) { if (BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { LOG_ERR("Not enough space in Friend Queue"); - net_buf_unref(buf); + bt_mesh_adv_unref(adv); return -ENOBUFS; } else { LOG_WRN("No space in Friend Queue"); @@ -158,19 +157,19 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, } if (bt_mesh_friend_enqueue_tx(tx, BT_MESH_FRIEND_PDU_SINGLE, - NULL, 1, &buf->b) && + NULL, 1, &adv->b) && BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { /* PDUs for a specific Friend should only go * out through the Friend Queue. */ - net_buf_unref(buf); + bt_mesh_adv_unref(adv); send_cb_finalize(cb, cb_data); return 0; } } send: - return bt_mesh_net_send(tx, buf, cb, cb_data); + return bt_mesh_net_send(tx, adv, cb, cb_data); } static inline uint8_t seg_len(bool ctl) @@ -405,7 +404,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx) (uint16_t)(tx->seq_auth & TRANS_SEQ_ZERO_MASK), tx->attempts_left); while (tx->seg_o <= tx->seg_n) { - struct net_buf *seg; + struct bt_mesh_adv *seg; int err; if (!tx->seg[tx->seg_o]) { @@ -421,7 +420,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx) goto end; } - net_buf_reserve(seg, BT_MESH_NET_HDR_LEN); + net_buf_simple_reserve(&seg->b, BT_MESH_NET_HDR_LEN); seg_tx_buf_build(tx, tx->seg_o, &seg->b); LOG_DBG("Sending %u/%u", tx->seg_o, tx->seg_n); diff --git a/subsys/bluetooth/mesh/transport_legacy.c b/subsys/bluetooth/mesh/transport_legacy.c index da0c1830f73..1a826db4ac4 100644 --- a/subsys/bluetooth/mesh/transport_legacy.c +++ b/subsys/bluetooth/mesh/transport_legacy.c @@ -22,7 +22,6 @@ #include "host/testing.h" #include "crypto.h" -#include "adv.h" #include "mesh.h" #include "net.h" #include "app_keys.h" @@ -129,26 +128,26 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, const struct bt_mesh_send_cb *cb, void *cb_data, const uint8_t *ctl_op) { - struct net_buf *buf; + struct bt_mesh_adv *adv; - buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, tx->xmit, BUF_TIMEOUT); - if (!buf) { - LOG_ERR("Out of network buffers"); + if (!adv) { + LOG_ERR("Out of network advs"); return -ENOBUFS; } - net_buf_reserve(buf, BT_MESH_NET_HDR_LEN); + net_buf_simple_reserve(&adv->b, BT_MESH_NET_HDR_LEN); if (ctl_op) { - net_buf_add_u8(buf, TRANS_CTL_HDR(*ctl_op, 0)); + net_buf_simple_add_u8(&adv->b, TRANS_CTL_HDR(*ctl_op, 0)); } else if (BT_MESH_IS_DEV_KEY(tx->ctx->app_idx)) { - net_buf_add_u8(buf, UNSEG_HDR(0, 0)); + net_buf_simple_add_u8(&adv->b, UNSEG_HDR(0, 0)); } else { - net_buf_add_u8(buf, UNSEG_HDR(1, tx->aid)); + net_buf_simple_add_u8(&adv->b, UNSEG_HDR(1, tx->aid)); } - net_buf_add_mem(buf, sdu->data, sdu->len); + net_buf_simple_add_mem(&adv->b, sdu->data, sdu->len); if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { if (!bt_mesh_friend_queue_has_space(tx->sub->net_idx, @@ -156,7 +155,7 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, NULL, 1)) { if (BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { LOG_ERR("Not enough space in Friend Queue"); - net_buf_unref(buf); + bt_mesh_adv_unref(adv); return -ENOBUFS; } @@ -165,19 +164,19 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, } if (bt_mesh_friend_enqueue_tx(tx, BT_MESH_FRIEND_PDU_SINGLE, - NULL, 1, &buf->b) && + NULL, 1, &adv->b) && BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { /* PDUs for a specific Friend should only go * out through the Friend Queue. */ - net_buf_unref(buf); + bt_mesh_adv_unref(adv); send_cb_finalize(cb, cb_data); return 0; } } send: - return bt_mesh_net_send(tx, buf, cb, cb_data); + return bt_mesh_net_send(tx, adv, cb, cb_data); } static inline uint8_t seg_len(bool ctl) @@ -392,7 +391,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx) tx->attempts); while (tx->seg_o <= tx->seg_n) { - struct net_buf *seg; + struct bt_mesh_adv *seg; int err; if (!tx->seg[tx->seg_o]) { @@ -408,7 +407,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx) goto end; } - net_buf_reserve(seg, BT_MESH_NET_HDR_LEN); + net_buf_simple_reserve(&seg->b, BT_MESH_NET_HDR_LEN); seg_tx_buf_build(tx, tx->seg_o, &seg->b); LOG_DBG("Sending %u/%u", tx->seg_o, tx->seg_n); diff --git a/tests/bsim/bluetooth/mesh/src/test_advertiser.c b/tests/bsim/bluetooth/mesh/src/test_advertiser.c index 073651ae843..47851fc72f4 100644 --- a/tests/bsim/bluetooth/mesh/src/test_advertiser.c +++ b/tests/bsim/bluetooth/mesh/src/test_advertiser.c @@ -7,7 +7,6 @@ #include #include #include "mesh_test.h" -#include "mesh/adv.h" #include "mesh/net.h" #include "mesh/mesh.h" #include "mesh/foundation.h" @@ -78,25 +77,25 @@ static void adv_init(void) ASSERT_OK_MSG(bt_mesh_adv_enable(), "Mesh adv init failed"); } -static void allocate_all_array(struct net_buf **buf, size_t num_buf, uint8_t xmit) +static void allocate_all_array(struct bt_mesh_adv **adv, size_t num_adv, uint8_t xmit) { - for (int i = 0; i < num_buf; i++) { - *buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + for (int i = 0; i < num_adv; i++) { + *adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, xmit, K_NO_WAIT); - ASSERT_FALSE_MSG(!*buf, "Out of buffers\n"); - buf++; + ASSERT_FALSE_MSG(!*adv, "Out of advs\n"); + adv++; } } static void verify_adv_queue_overflow(void) { - struct net_buf *dummy_buf; + struct bt_mesh_adv *dummy_adv; /* Verity Queue overflow */ - dummy_buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + dummy_adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, BT_MESH_TRANSMIT(2, 20), K_NO_WAIT); - ASSERT_TRUE_MSG(!dummy_buf, "Unexpected extra buffer\n"); + ASSERT_TRUE_MSG(!dummy_adv, "Unexpected extra adv\n"); } static bool check_delta_time(uint8_t transmit, uint64_t interval) @@ -157,12 +156,12 @@ static void single_end_cb(int err, void *cb_data) static void realloc_end_cb(int err, void *cb_data) { - struct net_buf *buf = (struct net_buf *)cb_data; + struct bt_mesh_adv *adv = (struct bt_mesh_adv *)cb_data; ASSERT_EQUAL(0, err); - buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, BT_MESH_TRANSMIT(2, 20), K_NO_WAIT); - ASSERT_FALSE_MSG(!buf, "Out of buffers\n"); + ASSERT_FALSE_MSG(!adv, "Out of advs\n"); k_sem_give(&observer_sem); } @@ -305,13 +304,13 @@ static void rx_xmit_adv(void) static void send_order_start_cb(uint16_t duration, int err, void *user_data) { - struct net_buf *buf = (struct net_buf *)user_data; + struct bt_mesh_adv *adv = (struct bt_mesh_adv *)user_data; ASSERT_OK_MSG(err, "Failed adv start cb err (%d)", err); - ASSERT_EQUAL(2, buf->len); + ASSERT_EQUAL(2, adv->b.len); - uint8_t current = buf->data[0]; - uint8_t previous = buf->data[1]; + uint8_t current = adv->b.data[0]; + uint8_t previous = adv->b.data[1]; LOG_INF("tx start: current(%d) previous(%d)", current, previous); @@ -321,10 +320,7 @@ static void send_order_start_cb(uint16_t duration, int err, void *user_data) static void send_order_end_cb(int err, void *user_data) { - struct net_buf *buf = (struct net_buf *)user_data; - ASSERT_OK_MSG(err, "Failed adv start cb err (%d)", err); - ASSERT_TRUE_MSG(!buf->data, "Data not cleared!\n"); seq_checker++; LOG_INF("tx end: seq(%d)", seq_checker); @@ -380,19 +376,19 @@ static void receive_order(int expect_adv) ASSERT_FALSE_MSG(err && err != -EALREADY, "Stopping scan failed (err %d)\n", err); } -static void send_adv_buf(struct net_buf *buf, uint8_t curr, uint8_t prev) +static void send_adv_buf(struct bt_mesh_adv *adv, uint8_t curr, uint8_t prev) { send_cb.start = send_order_start_cb; send_cb.end = send_order_end_cb; - (void)net_buf_add_u8(buf, curr); - (void)net_buf_add_u8(buf, prev); + (void)net_buf_simple_add_u8(&adv->b, curr); + (void)net_buf_simple_add_u8(&adv->b, prev); - bt_mesh_adv_send(buf, &send_cb, buf); - net_buf_unref(buf); + bt_mesh_adv_send(adv, &send_cb, adv); + bt_mesh_adv_unref(adv); } -static void send_adv_array(struct net_buf **buf, size_t num_buf, bool reverse) +static void send_adv_array(struct bt_mesh_adv **adv, size_t num_buf, bool reverse) { uint8_t previous; int i; @@ -405,13 +401,13 @@ static void send_adv_array(struct net_buf **buf, size_t num_buf, bool reverse) i = num_buf - 1; } while ((!reverse && i < num_buf) || (reverse && i >= 0)) { - send_adv_buf(*buf, (uint8_t)i, previous); + send_adv_buf(*adv, (uint8_t)i, previous); previous = (uint8_t)i; if (!reverse) { - buf++; + adv++; i++; } else { - buf--; + adv--; i--; } } @@ -419,24 +415,24 @@ static void send_adv_array(struct net_buf **buf, size_t num_buf, bool reverse) static void test_tx_cb_single(void) { - struct net_buf *buf; + struct bt_mesh_adv *adv; int err; bt_init(); adv_init(); - buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, BT_MESH_TRANSMIT(2, 20), K_NO_WAIT); - ASSERT_FALSE_MSG(!buf, "Out of buffers\n"); + ASSERT_FALSE_MSG(!adv, "Out of advs\n"); send_cb.start = single_start_cb; send_cb.end = single_end_cb; - net_buf_add_mem(buf, txt_msg, sizeof(txt_msg)); + net_buf_simple_add_mem(&adv->b, txt_msg, sizeof(txt_msg)); seq_checker = 0; tx_timestamp = k_uptime_get(); - bt_mesh_adv_send(buf, &send_cb, (void *)cb_msg); - net_buf_unref(buf); + bt_mesh_adv_send(adv, &send_cb, (void *)cb_msg); + bt_mesh_adv_unref(adv); err = k_sem_take(&observer_sem, K_SECONDS(1)); ASSERT_OK_MSG(err, "Didn't call end tx cb."); @@ -457,37 +453,37 @@ static void test_rx_xmit(void) static void test_tx_cb_multi(void) { - struct net_buf *buf[CONFIG_BT_MESH_ADV_BUF_COUNT]; + struct bt_mesh_adv *adv[CONFIG_BT_MESH_ADV_BUF_COUNT]; int err; bt_init(); adv_init(); - /* Allocate all network buffers. */ - allocate_all_array(buf, ARRAY_SIZE(buf), BT_MESH_TRANSMIT(2, 20)); + /* Allocate all network advs. */ + allocate_all_array(adv, ARRAY_SIZE(adv), BT_MESH_TRANSMIT(2, 20)); - /* Start single adv to reallocate one network buffer in callback. - * Check that the buffer is freed before cb is triggered. + /* Start single adv to reallocate one network adv in callback. + * Check that the adv is freed before cb is triggered. */ send_cb.start = NULL; send_cb.end = realloc_end_cb; - net_buf_add_mem(buf[0], txt_msg, sizeof(txt_msg)); + net_buf_simple_add_mem(&(adv[0]->b), txt_msg, sizeof(txt_msg)); - bt_mesh_adv_send(buf[0], &send_cb, buf[0]); - net_buf_unref(buf[0]); + bt_mesh_adv_send(adv[0], &send_cb, adv[0]); + bt_mesh_adv_unref(adv[0]); err = k_sem_take(&observer_sem, K_SECONDS(1)); - ASSERT_OK_MSG(err, "Didn't call the end tx cb that reallocates buffer one more time."); + ASSERT_OK_MSG(err, "Didn't call the end tx cb that reallocates adv one more time."); - /* Start multi advs to check that all buffers are sent and cbs are triggered. */ + /* Start multi advs to check that all advs are sent and cbs are triggered. */ send_cb.start = seq_start_cb; send_cb.end = seq_end_cb; seq_checker = 0; for (int i = 0; i < CONFIG_BT_MESH_ADV_BUF_COUNT; i++) { - net_buf_add_le32(buf[i], i); - bt_mesh_adv_send(buf[i], &send_cb, (void *)(intptr_t)i); - net_buf_unref(buf[i]); + net_buf_simple_add_le32(&(adv[i]->b), i); + bt_mesh_adv_send(adv[i], &send_cb, (void *)(intptr_t)i); + bt_mesh_adv_unref(adv[i]); } err = k_sem_take(&observer_sem, K_SECONDS(10)); @@ -530,10 +526,10 @@ static void test_tx_proxy_mixin(void) * Advertising the proxy service should be resumed after * finishing advertising the message. */ - struct net_buf *buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + struct bt_mesh_adv *adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, BT_MESH_TRANSMIT(5, 20), K_NO_WAIT); - net_buf_add_mem(buf, txt_msg, sizeof(txt_msg)); - bt_mesh_adv_send(buf, NULL, NULL); + net_buf_simple_add_mem(&adv->b, txt_msg, sizeof(txt_msg)); + bt_mesh_adv_send(adv, NULL, NULL); k_sleep(K_MSEC(150)); /* Let the tester to measure an interval between advertisements again. */ @@ -577,46 +573,46 @@ static void test_rx_proxy_mixin(void) static void test_tx_send_order(void) { - struct net_buf *buf[CONFIG_BT_MESH_ADV_BUF_COUNT]; + struct bt_mesh_adv *adv[CONFIG_BT_MESH_ADV_BUF_COUNT]; uint8_t xmit = BT_MESH_TRANSMIT(2, 20); bt_init(); adv_init(); /* Verify sending order */ - allocate_all_array(buf, ARRAY_SIZE(buf), xmit); + allocate_all_array(adv, ARRAY_SIZE(adv), xmit); verify_adv_queue_overflow(); - send_adv_array(&buf[0], ARRAY_SIZE(buf), false); + send_adv_array(&adv[0], ARRAY_SIZE(adv), false); /* Wait for no message receive window to end. */ ASSERT_OK_MSG(k_sem_take(&observer_sem, K_SECONDS(10)), "Didn't call the last end tx cb."); - /* Verify buffer allocation/deallocation after sending */ - allocate_all_array(buf, ARRAY_SIZE(buf), xmit); + /* Verify adv allocation/deallocation after sending */ + allocate_all_array(adv, ARRAY_SIZE(adv), xmit); verify_adv_queue_overflow(); for (int i = 0; i < CONFIG_BT_MESH_ADV_BUF_COUNT; i++) { - net_buf_unref(buf[i]); - buf[i] = NULL; + bt_mesh_adv_unref(adv[i]); + adv[i] = NULL; } - /* Check that it possible to add just one net buf. */ - allocate_all_array(buf, 1, xmit); + /* Check that it possible to add just one net adv. */ + allocate_all_array(adv, 1, xmit); PASS(); } static void test_tx_reverse_order(void) { - struct net_buf *buf[CONFIG_BT_MESH_ADV_BUF_COUNT]; + struct bt_mesh_adv *adv[CONFIG_BT_MESH_ADV_BUF_COUNT]; uint8_t xmit = BT_MESH_TRANSMIT(2, 20); bt_init(); adv_init(); /* Verify reversed sending order */ - allocate_all_array(buf, ARRAY_SIZE(buf), xmit); + allocate_all_array(adv, ARRAY_SIZE(adv), xmit); - send_adv_array(&buf[CONFIG_BT_MESH_ADV_BUF_COUNT - 1], ARRAY_SIZE(buf), true); + send_adv_array(&adv[CONFIG_BT_MESH_ADV_BUF_COUNT - 1], ARRAY_SIZE(adv), true); /* Wait for no message receive window to end. */ ASSERT_OK_MSG(k_sem_take(&observer_sem, K_SECONDS(10)), @@ -627,31 +623,31 @@ static void test_tx_reverse_order(void) static void test_tx_random_order(void) { - struct net_buf *buf[3]; + struct bt_mesh_adv *adv[3]; uint8_t xmit = BT_MESH_TRANSMIT(0, 20); bt_init(); adv_init(); /* Verify random order calls */ - num_adv_sent = ARRAY_SIZE(buf); + num_adv_sent = ARRAY_SIZE(adv); previous_checker = 0xff; - buf[0] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + adv[0] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, xmit, K_NO_WAIT); - ASSERT_FALSE_MSG(!buf[0], "Out of buffers\n"); - buf[1] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + ASSERT_FALSE_MSG(!adv[0], "Out of advs\n"); + adv[1] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, xmit, K_NO_WAIT); - ASSERT_FALSE_MSG(!buf[1], "Out of buffers\n"); + ASSERT_FALSE_MSG(!adv[1], "Out of advs\n"); - send_adv_buf(buf[0], 0, 0xff); + send_adv_buf(adv[0], 0, 0xff); - buf[2] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + adv[2] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, xmit, K_NO_WAIT); - ASSERT_FALSE_MSG(!buf[2], "Out of buffers\n"); + ASSERT_FALSE_MSG(!adv[2], "Out of advs\n"); - send_adv_buf(buf[2], 2, 0); + send_adv_buf(adv[2], 2, 0); - send_adv_buf(buf[1], 1, 2); + send_adv_buf(adv[1], 1, 2); /* Wait for no message receive window to end. */ ASSERT_OK_MSG(k_sem_take(&observer_sem, K_SECONDS(10)), diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index e93c2301e46..038c705f2cb 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -6,7 +6,6 @@ #include #include #include "mesh_test.h" -#include "mesh/adv.h" #include "mesh/net.h" #include "mesh/beacon.h" #include "mesh/mesh.h" diff --git a/tests/bsim/bluetooth/mesh/src/test_blob.c b/tests/bsim/bluetooth/mesh/src/test_blob.c index 4258ff77c62..0d3a69da2fc 100644 --- a/tests/bsim/bluetooth/mesh/src/test_blob.c +++ b/tests/bsim/bluetooth/mesh/src/test_blob.c @@ -6,9 +6,9 @@ #include "mesh_test.h" #include "dfu_blob_common.h" #include "friendship_common.h" +#include "mesh/adv.h" #include "mesh/blob.h" #include "argparse.h" -#include "mesh/adv.h" #define LOG_MODULE_NAME test_blob diff --git a/tests/bsim/bluetooth/mesh/src/test_dfu.c b/tests/bsim/bluetooth/mesh/src/test_dfu.c index 06f7248a6ad..1b54e873cc5 100644 --- a/tests/bsim/bluetooth/mesh/src/test_dfu.c +++ b/tests/bsim/bluetooth/mesh/src/test_dfu.c @@ -6,7 +6,6 @@ #include "mesh_test.h" #include "mesh/dfd_srv_internal.h" #include "mesh/dfu_slot.h" -#include "mesh/adv.h" #include "mesh/dfu.h" #include "mesh/blob.h" #include "argparse.h" diff --git a/tests/bsim/bluetooth/mesh/src/test_provision.c b/tests/bsim/bluetooth/mesh/src/test_provision.c index f2c98778a3b..3d0e8010c75 100644 --- a/tests/bsim/bluetooth/mesh/src/test_provision.c +++ b/tests/bsim/bluetooth/mesh/src/test_provision.c @@ -28,7 +28,6 @@ #define LOG_MODULE_NAME mesh_prov #include -#include "mesh/adv.h" #include "mesh/rpr.h" LOG_MODULE_REGISTER(LOG_MODULE_NAME); diff --git a/tests/bsim/bluetooth/mesh/src/test_scanner.c b/tests/bsim/bluetooth/mesh/src/test_scanner.c index 12557b7e1b2..a63284701df 100644 --- a/tests/bsim/bluetooth/mesh/src/test_scanner.c +++ b/tests/bsim/bluetooth/mesh/src/test_scanner.c @@ -6,7 +6,6 @@ #include #include "mesh_test.h" #include "mesh/net.h" -#include "mesh/adv.h" #include "mesh/mesh.h" #include "mesh/foundation.h" From d0431c986016730d9343a5273ed421acfb2273ac Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0098/2300] [nrf fromtree] Bluetooth: Mesh: access tx msg randomizer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit adds implementation of the specification recommendations regarding randomization of responses on the access layer. 3.7.3.1 Transmitting an Access messages Signed-off-by: Aleksandr Khromykh (cherry picked from commit d175ac0572c454eec99b11f9f6d0350efa5a5f8b) Signed-off-by: Håvard Reierstad (cherry picked from commit 113bf618d85999f6c705ab4bb8b5304873b4e46c) --- .../bluetooth/api/mesh/access.rst | 33 ++ doc/releases/release-notes-3.6.rst | 5 + include/zephyr/bluetooth/mesh/msg.h | 3 + .../bluetooth/mesh/boards/bbc_microbit.conf | 1 + .../mesh_demo/boards/bbc_microbit.conf | 1 + subsys/bluetooth/mesh/CMakeLists.txt | 2 + subsys/bluetooth/mesh/Kconfig | 35 ++ subsys/bluetooth/mesh/access.c | 29 ++ subsys/bluetooth/mesh/access.h | 17 + subsys/bluetooth/mesh/delayable_msg.c | 314 ++++++++++++++++++ subsys/bluetooth/mesh/delayable_msg.h | 16 + subsys/bluetooth/mesh/main.c | 4 + 12 files changed, 460 insertions(+) create mode 100644 subsys/bluetooth/mesh/delayable_msg.c create mode 100644 subsys/bluetooth/mesh/delayable_msg.h diff --git a/doc/connectivity/bluetooth/api/mesh/access.rst b/doc/connectivity/bluetooth/api/mesh/access.rst index e4a94440556..7030a3c14b2 100644 --- a/doc/connectivity/bluetooth/api/mesh/access.rst +++ b/doc/connectivity/bluetooth/api/mesh/access.rst @@ -222,6 +222,39 @@ They are used to represent the new content of the mirrored pages when the Compos change after a firmware update. See :ref:`bluetooth_mesh_dfu_srv_comp_data_and_models_metadata` for details. +Delayable messages +================== + +The delayable message functionality is enabled with Kconfig option +:kconfig:option:`CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG`. +This is an optional functionality that implements specification recommendations for +messages that are transmitted by a model in a response to a received message, also called +response messages. + +Response messages should be sent with the following random delays: + +* Between 20 and 50 milliseconds if the received message was sent + to a unicast address +* Between 20 and 500 milliseconds if the received message was sent + to a group or virtual address + +The delayable message functionality is triggered if the :c:member:`bt_mesh_msg_ctx.rnd_delay` +flag is set. +The delayable message functionality stores messages in the local memory while they are +waiting for the random delay expiration. + +If the transport layer doesn't have sufficient memory to send a message at the moment +the random delay expires, the message is postponed for another 10 milliseconds. +If the transport layer cannot send a message for any other reason, the delayable message +functionality raises the :c:member:`bt_mesh_send_cb.start` callback with a transport layer +error code. + +If the delayable message functionality cannot find enough free memory to store an incoming +message, it will send messages with delay close to expiration to free memory. + +When the mesh stack is suspended or reset, messages not yet sent are removed and +the :c:member:`bt_mesh_send_cb.start` callback is raised with an error code. + API reference ************* diff --git a/doc/releases/release-notes-3.6.rst b/doc/releases/release-notes-3.6.rst index 676e16fa77c..8edd3280382 100644 --- a/doc/releases/release-notes-3.6.rst +++ b/doc/releases/release-notes-3.6.rst @@ -52,6 +52,11 @@ Bluetooth * Mesh + * Added the delayable messages functionality to apply random delays for + the transmitted responses on the Access layer. + The functionality is enabled by the :kconfig:option:`CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG` + Kconfig option. + * Controller Boards & SoC Support diff --git a/include/zephyr/bluetooth/mesh/msg.h b/include/zephyr/bluetooth/mesh/msg.h index e52ca85e3a4..8a7ce1a7128 100644 --- a/include/zephyr/bluetooth/mesh/msg.h +++ b/include/zephyr/bluetooth/mesh/msg.h @@ -98,6 +98,9 @@ struct bt_mesh_msg_ctx { /** Force sending reliably by using segment acknowledgment */ bool send_rel; + /** Send message with a random delay according to the Access layer transmitting rules. */ + bool rnd_delay; + /** TTL, or BT_MESH_TTL_DEFAULT for default TTL. */ uint8_t send_ttl; }; diff --git a/samples/bluetooth/mesh/boards/bbc_microbit.conf b/samples/bluetooth/mesh/boards/bbc_microbit.conf index 26fb05301c1..1655768864b 100644 --- a/samples/bluetooth/mesh/boards/bbc_microbit.conf +++ b/samples/bluetooth/mesh/boards/bbc_microbit.conf @@ -32,3 +32,4 @@ CONFIG_BT_MESH_SUBNET_COUNT=1 CONFIG_BT_MESH_APP_KEY_COUNT=1 CONFIG_BT_MESH_MODEL_GROUP_COUNT=1 CONFIG_BT_MESH_LABEL_COUNT=0 +CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG=n diff --git a/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf b/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf index 5eb087c4ced..64adc465794 100644 --- a/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf +++ b/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf @@ -22,3 +22,4 @@ CONFIG_BT_MESH_BEACON_ENABLED=n CONFIG_BT_MESH_LABEL_COUNT=1 CONFIG_BT_MESH_SETTINGS_WORKQ=n +CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG=n diff --git a/subsys/bluetooth/mesh/CMakeLists.txt b/subsys/bluetooth/mesh/CMakeLists.txt index 10b142e87f5..3fd2e7c3bfc 100644 --- a/subsys/bluetooth/mesh/CMakeLists.txt +++ b/subsys/bluetooth/mesh/CMakeLists.txt @@ -122,6 +122,8 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH_SOLICITATION solicitation.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_STATISTIC statistic.c) +zephyr_library_sources_ifdef(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG delayable_msg.c) + if (CONFIG_BT_MESH_USES_TINYCRYPT) zephyr_library_sources(crypto_tc.c) else() diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 0c654e18064..3bc7dd2940f 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -628,6 +628,41 @@ config BT_MESH_LABEL_NO_RECOVER unprovisioned before upgrading to the version with this option). The option is marked as deprecated to remove the recovery code eventually. +menuconfig BT_MESH_ACCESS_DELAYABLE_MSG + bool "Access layer tx delayable message" + help + Enable following of the message transmitting recommendations, the Access layer + specification. The recommendations are optional. + However, they are strictly recommended if the device participates in the network with + intensive communication where the device receives a lot of requests that require responses. + +if BT_MESH_ACCESS_DELAYABLE_MSG + +config BT_MESH_ACCESS_DELAYABLE_MSG_COUNT + int "Number of simultaneously delayed messages" + default 4 + help + The maximum number of messages the Access layer can manage to delay + at the same time. The number of messages can be handled only if the Access layer + has a sufficient amount of memory to store the model payload for them. + +config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE + int "Maximum delayable message storage chunk" + default 20 + help + Size of memory that Access layer uses to split model message to. It allocates + a sufficient number of these chunks from the pool to store the full model payload. + +config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT + int "Maximum number of available chunks" + default 20 + help + The maximum number of available chunks the Access layer allocates to store model payload. + It is recommended to keep chunk size equal to the reasonable small value to prevent + unnecessary memory wasting. + +endif # BT_MESH_ACCESS_DELAYABLE_MSG + endmenu # Access layer menu "Models" diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index f7de46fe167..4cffe064329 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -27,6 +27,7 @@ #include "op_agg.h" #include "settings.h" #include "va.h" +#include "delayable_msg.h" #define LOG_LEVEL CONFIG_BT_MESH_ACCESS_LOG_LEVEL #include @@ -1518,6 +1519,13 @@ int bt_mesh_model_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx return -EINVAL; } +#if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG + if (ctx->rnd_delay) { + return bt_mesh_delayable_msg_manage(ctx, msg, bt_mesh_model_elem(model)->rt->addr, + cb, cb_data); + } +#endif + return bt_mesh_access_send(ctx, msg, bt_mesh_model_elem(model)->rt->addr, cb, cb_data); } @@ -2613,3 +2621,24 @@ uint8_t bt_mesh_comp_parse_page(struct net_buf_simple *buf) return page; } + +void bt_mesh_access_init(void) +{ +#if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG + bt_mesh_delayable_msg_init(); +#endif +} + +void bt_mesh_access_suspend(void) +{ +#if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG + bt_mesh_delayable_msg_stop(); +#endif +} + +void bt_mesh_access_reset(void) +{ +#if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG + bt_mesh_delayable_msg_stop(); +#endif +} diff --git a/subsys/bluetooth/mesh/access.h b/subsys/bluetooth/mesh/access.h index 48e0eadec10..210fceee319 100644 --- a/subsys/bluetooth/mesh/access.h +++ b/subsys/bluetooth/mesh/access.h @@ -96,8 +96,25 @@ void bt_mesh_msg_cb_set(void (*cb)(uint32_t opcode, struct bt_mesh_msg_ctx *ctx, * * @param ctx The Bluetooth Mesh message context. * @param buf The message payload. + * @param src_addr The source address of model + * @param cb Callback function. + * @param cb_data Callback data. * * @return 0 on success or negative error code on failure. */ int bt_mesh_access_send(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf, uint16_t src_addr, const struct bt_mesh_send_cb *cb, void *cb_data); + +/** @brief Initialize the Access layer. + * + * Initialize the delayable message mechanism if it has been enabled. + */ +void bt_mesh_access_init(void); + +/** @brief Suspend the Access layer. + */ +void bt_mesh_access_suspend(void); + +/** @brief Reset the Access layer. + */ +void bt_mesh_access_reset(void); diff --git a/subsys/bluetooth/mesh/delayable_msg.c b/subsys/bluetooth/mesh/delayable_msg.c new file mode 100644 index 00000000000..5fa43205d63 --- /dev/null +++ b/subsys/bluetooth/mesh/delayable_msg.c @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#include +#include + +#include "msg.h" +#include "access.h" +#include "net.h" + +#define LOG_LEVEL CONFIG_BT_MESH_ACCESS_LOG_LEVEL +#include +LOG_MODULE_REGISTER(bt_mesh_delayable_msg); + +static void delayable_msg_handler(struct k_work *w); +static bool push_msg_from_delayable_msgs(void); + +static struct delayable_msg_chunk { + sys_snode_t node; + uint8_t data[CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE]; +} delayable_msg_chunks[CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT]; + +static struct delayable_msg_ctx { + sys_snode_t node; + sys_slist_t chunks; + struct bt_mesh_msg_ctx ctx; + uint16_t src_addr; + const struct bt_mesh_send_cb *cb; + void *cb_data; + uint32_t fired_time; + uint16_t len; +} delayable_msgs_ctx[CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_COUNT]; + +static struct { + sys_slist_t busy_ctx; + sys_slist_t free_ctx; + sys_slist_t free_chunks; + struct k_work_delayable random_delay; +} access_delayable_msg = {.random_delay = Z_WORK_DELAYABLE_INITIALIZER(delayable_msg_handler)}; + +static void put_ctx_to_busy_list(struct delayable_msg_ctx *ctx) +{ + struct delayable_msg_ctx *curr_ctx; + sys_slist_t *list = &access_delayable_msg.busy_ctx; + sys_snode_t *head = sys_slist_peek_head(list); + sys_snode_t *curr = head; + sys_snode_t *prev = curr; + + if (!head) { + sys_slist_append(list, &ctx->node); + return; + } + + do { + curr_ctx = CONTAINER_OF(curr, struct delayable_msg_ctx, node); + if (ctx->fired_time < curr_ctx->fired_time) { + if (curr == head) { + sys_slist_prepend(list, &ctx->node); + } else { + sys_slist_insert(list, prev, &ctx->node); + } + return; + } + prev = curr; + } while ((curr = sys_slist_peek_next(curr))); + + sys_slist_append(list, &ctx->node); +} + +static struct delayable_msg_ctx *peek_pending_msg(void) +{ + struct delayable_msg_ctx *pending_msg = NULL; + sys_snode_t *node = sys_slist_peek_head(&access_delayable_msg.busy_ctx); + + if (node) { + pending_msg = CONTAINER_OF(node, struct delayable_msg_ctx, node); + } + + return pending_msg; +} + +static void reschedule_delayable_msg(struct delayable_msg_ctx *msg) +{ + uint32_t curr_time; + k_timeout_t delay = K_NO_WAIT; + struct delayable_msg_ctx *pending_msg; + + if (msg) { + put_ctx_to_busy_list(msg); + } + + pending_msg = peek_pending_msg(); + + if (!pending_msg) { + return; + } + + curr_time = k_uptime_get_32(); + if (curr_time < pending_msg->fired_time) { + delay = K_MSEC(pending_msg->fired_time - curr_time); + } + + k_work_reschedule(&access_delayable_msg.random_delay, delay); +} + +static int allocate_delayable_msg_chunks(struct delayable_msg_ctx *msg, int number) +{ + sys_snode_t *node; + + for (int i = 0; i < number; i++) { + node = sys_slist_get(&access_delayable_msg.free_chunks); + if (!node) { + LOG_WRN("Unable allocate %u chunks, allocated %u", number, i); + return i; + } + sys_slist_append(&msg->chunks, node); + } + + return number; +} + +static void release_delayable_msg_chunks(struct delayable_msg_ctx *msg) +{ + sys_snode_t *node; + + while ((node = sys_slist_get(&msg->chunks))) { + sys_slist_append(&access_delayable_msg.free_chunks, node); + } +} + +static struct delayable_msg_ctx *allocate_delayable_msg_ctx(void) +{ + struct delayable_msg_ctx *msg; + sys_snode_t *node; + + if (sys_slist_is_empty(&access_delayable_msg.free_ctx)) { + LOG_WRN("Purge pending delayable message."); + if (!push_msg_from_delayable_msgs()) { + return NULL; + } + } + + node = sys_slist_get(&access_delayable_msg.free_ctx); + msg = CONTAINER_OF(node, struct delayable_msg_ctx, node); + sys_slist_init(&msg->chunks); + + return msg; +} + +static void release_delayable_msg_ctx(struct delayable_msg_ctx *ctx) +{ + if (sys_slist_find_and_remove(&access_delayable_msg.busy_ctx, &ctx->node)) { + sys_slist_append(&access_delayable_msg.free_ctx, &ctx->node); + } +} + +static bool push_msg_from_delayable_msgs(void) +{ + sys_snode_t *node; + struct delayable_msg_chunk *chunk; + struct delayable_msg_ctx *msg = peek_pending_msg(); + uint16_t len = msg->len; + int err; + + if (!msg) { + return false; + } + + NET_BUF_SIMPLE_DEFINE(buf, BT_MESH_TX_SDU_MAX); + + SYS_SLIST_FOR_EACH_NODE(&msg->chunks, node) { + uint16_t tmp = MIN(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE, len); + + chunk = CONTAINER_OF(node, struct delayable_msg_chunk, node); + memcpy(net_buf_simple_add(&buf, tmp), chunk->data, tmp); + len -= tmp; + } + + msg->ctx.rnd_delay = false; + err = bt_mesh_access_send(&msg->ctx, &buf, msg->src_addr, msg->cb, msg->cb_data); + msg->ctx.rnd_delay = true; + + if (err == -EBUSY || err == -ENOBUFS) { + return false; + } + + release_delayable_msg_chunks(msg); + release_delayable_msg_ctx(msg); + + if (err && msg->cb && msg->cb->start) { + msg->cb->start(0, err, msg->cb_data); + } + + return true; +} + +static void delayable_msg_handler(struct k_work *w) +{ + if (!push_msg_from_delayable_msgs()) { + sys_snode_t *node = sys_slist_get(&access_delayable_msg.busy_ctx); + struct delayable_msg_ctx *pending_msg = + CONTAINER_OF(node, struct delayable_msg_ctx, node); + + pending_msg->fired_time += 10; + reschedule_delayable_msg(pending_msg); + } else { + reschedule_delayable_msg(NULL); + } +} + +int bt_mesh_delayable_msg_manage(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf, + uint16_t src_addr, const struct bt_mesh_send_cb *cb, void *cb_data) +{ + sys_snode_t *node; + struct delayable_msg_ctx *msg; + uint16_t random_delay; + int total_number = DIV_ROUND_UP(buf->size, CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE); + int allocated_number = 0; + uint16_t len = buf->len; + + if (atomic_test_bit(bt_mesh.flags, BT_MESH_SUSPENDED)) { + LOG_WRN("Refusing to allocate message context while suspended"); + return -ENODEV; + } + + if (total_number > CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT) { + return -EINVAL; + } + + msg = allocate_delayable_msg_ctx(); + if (!msg) { + LOG_WRN("No available free delayable message context."); + return -ENOMEM; + } + + do { + allocated_number += + allocate_delayable_msg_chunks(msg, total_number - allocated_number); + + if (total_number > allocated_number) { + LOG_DBG("Unable allocate %u chunks, allocated %u", total_number, + allocated_number); + if (!push_msg_from_delayable_msgs()) { + LOG_WRN("No available chunk memory."); + release_delayable_msg_chunks(msg); + release_delayable_msg_ctx(msg); + return -ENOMEM; + } + } + } while (total_number > allocated_number); + + SYS_SLIST_FOR_EACH_NODE(&msg->chunks, node) { + uint16_t tmp = MIN(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE, buf->len); + + struct delayable_msg_chunk *chunk = + CONTAINER_OF(node, struct delayable_msg_chunk, node); + + memcpy(chunk->data, net_buf_simple_pull_mem(buf, tmp), tmp); + } + + bt_rand(&random_delay, sizeof(uint16_t)); + random_delay = 20 + random_delay % (BT_MESH_ADDR_IS_UNICAST(ctx->recv_dst) ? 30 : 480); + msg->fired_time = k_uptime_get_32() + random_delay; + msg->ctx = *ctx; + msg->src_addr = src_addr; + msg->cb = cb; + msg->cb_data = cb_data; + msg->len = len; + + reschedule_delayable_msg(msg); + + return 0; +} + +void bt_mesh_delayable_msg_init(void) +{ + sys_slist_init(&access_delayable_msg.busy_ctx); + sys_slist_init(&access_delayable_msg.free_ctx); + sys_slist_init(&access_delayable_msg.free_chunks); + + for (int i = 0; i < CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_COUNT; i++) { + sys_slist_append(&access_delayable_msg.free_ctx, &delayable_msgs_ctx[i].node); + } + + for (int i = 0; i < CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT; i++) { + sys_slist_append(&access_delayable_msg.free_chunks, &delayable_msg_chunks[i].node); + } +} + +void bt_mesh_delayable_msg_stop(void) +{ + sys_snode_t *node; + struct delayable_msg_ctx *ctx; + + k_work_cancel_delayable(&access_delayable_msg.random_delay); + + while ((node = sys_slist_peek_head(&access_delayable_msg.busy_ctx))) { + ctx = CONTAINER_OF(node, struct delayable_msg_ctx, node); + release_delayable_msg_chunks(ctx); + release_delayable_msg_ctx(ctx); + + if (ctx->cb && ctx->cb->start) { + ctx->cb->start(0, -ENODEV, ctx->cb_data); + } + } +} diff --git a/subsys/bluetooth/mesh/delayable_msg.h b/subsys/bluetooth/mesh/delayable_msg.h new file mode 100644 index 00000000000..1ab5dde2e76 --- /dev/null +++ b/subsys/bluetooth/mesh/delayable_msg.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_DELAYABLE_MSG_H__ +#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_DELAYABLE_MSG_H__ + +int bt_mesh_delayable_msg_manage(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf, + uint16_t src_addr, const struct bt_mesh_send_cb *cb, + void *cb_data); +void bt_mesh_delayable_msg_init(void); +void bt_mesh_delayable_msg_stop(void); + +#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_DELAYABLE_MSG_H__ */ diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 89115ebe3e8..2689a3355c1 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -359,6 +359,7 @@ void bt_mesh_reset(void) */ (void)k_work_cancel_delayable(&bt_mesh.ivu_timer); + bt_mesh_access_reset(); bt_mesh_model_reset(); bt_mesh_cfg_default_set(); bt_mesh_trans_reset(); @@ -459,6 +460,8 @@ int bt_mesh_suspend(void) bt_mesh_model_foreach(model_suspend, NULL); + bt_mesh_access_suspend(); + err = bt_mesh_adv_disable(); if (err) { atomic_clear_bit(bt_mesh.flags, BT_MESH_SUSPENDED); @@ -558,6 +561,7 @@ int bt_mesh_init(const struct bt_mesh_prov *prov, bt_mesh_cfg_default_set(); bt_mesh_net_init(); bt_mesh_trans_init(); + bt_mesh_access_init(); bt_mesh_hb_init(); bt_mesh_beacon_init(); bt_mesh_adv_init(); From d7cbe1794778949c4163bdb328db13b409d55173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0099/2300] [nrf fromtree] Bluetooth: Mesh: Rename prov_dev->provisionee MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renames "prov device" references and options to "provisionee" to align implementation with Mesh Protocol specification v1.1, section 5.4. Signed-off-by: Anders Storrø (cherry picked from commit 25d44a828d404422099dfa4d8875438dacf1f38c) Signed-off-by: Håvard Reierstad (cherry picked from commit 7184e98ff549316a48c49f19b24d8e07472bfd1f) --- doc/connectivity/bluetooth/api/mesh/shell.rst | 4 +- doc/releases/migration-guide-3.6.rst | 25 +++++-- samples/bluetooth/mesh_provisioner/prj.conf | 2 +- subsys/bluetooth/Kconfig.logging | 2 +- subsys/bluetooth/mesh/CMakeLists.txt | 2 +- subsys/bluetooth/mesh/Kconfig | 15 +++- .../mesh/{prov_device.c => provisionee.c} | 8 +-- subsys/bluetooth/mesh/provisioner.c | 72 +++++++++---------- subsys/bluetooth/mesh/shell/shell.c | 8 +-- tests/bsim/bluetooth/mesh/prj.conf | 2 +- tests/bsim/bluetooth/mesh/prj_mesh1d1.conf | 2 +- 11 files changed, 81 insertions(+), 61 deletions(-) rename subsys/bluetooth/mesh/{prov_device.c => provisionee.c} (99%) diff --git a/doc/connectivity/bluetooth/api/mesh/shell.rst b/doc/connectivity/bluetooth/api/mesh/shell.rst index 9d5829fe380..3d925f29a3e 100644 --- a/doc/connectivity/bluetooth/api/mesh/shell.rst +++ b/doc/connectivity/bluetooth/api/mesh/shell.rst @@ -282,7 +282,7 @@ Provisioning ============ To allow a device to broadcast connectable unprovisioned beacons, the -:kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE` configuration option must be enabled, along with the +:kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` configuration option must be enabled, along with the :kconfig:option:`CONFIG_BT_MESH_PB_GATT` option. ``mesh prov pb-gatt `` @@ -295,7 +295,7 @@ To allow a device to broadcast connectable unprovisioned beacons, the * ``Val``: Enable or disable provisioning with GATT To allow a device to broadcast unprovisioned beacons, the -:kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE` configuration option must be enabled, along with the +:kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` configuration option must be enabled, along with the :kconfig:option:`CONFIG_BT_MESH_PB_ADV` option. ``mesh prov pb-adv `` diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index c4b93e5f150..c1739adf74d 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -113,13 +113,24 @@ Bluetooth cleared on :c:func:`bt_enable`. Callbacks can now be registered before the initial call to :c:func:`bt_enable`, and should no longer be re-registered after a :c:func:`bt_disable` :c:func:`bt_enable` cycle. (:github:`63693`) -* The Bluetooth Mesh ``model`` declaration has been changed to add prefix ``const``. - The ``model->user_data``, ``model->elem_idx`` and ``model->mod_idx`` field has been changed to - the new runtime structure, replaced by ``model->rt->user_data``, ``model->rt->elem_idx`` and - ``model->rt->mod_idx`` separately. (:github:`65152`) -* The Bluetooth Mesh ``element`` declaration has been changed to add prefix ``const``. - The ``elem->addr`` field has been changed to the new runtime structure, replaced by - ``elem->rt->addr``. (:github:`65388`) +* The Bluetooth UUID has been modified to rodata in ``BT_UUID_DECLARE_16``, ``BT_UUID_DECLARE_32` + and ``BT_UUID_DECLARE_128`` as the return value has been changed to `const`. + Any pointer to a UUID must be prefixed with `const`, otherwise there will be a compilation warning. + For example change ``struct bt_uuid *uuid = BT_UUID_DECLARE_16(xx)`` to + ``const struct bt_uuid *uuid = BT_UUID_DECLARE_16(xx)``. (:github:`66136`) + +* Mesh + + * The Bluetooth Mesh ``model`` declaration has been changed to add prefix ``const``. + The ``model->user_data``, ``model->elem_idx`` and ``model->mod_idx`` field has been changed to + the new runtime structure, replaced by ``model->rt->user_data``, ``model->rt->elem_idx`` and + ``model->rt->mod_idx`` separately. (:github:`65152`) + * The Bluetooth Mesh ``element`` declaration has been changed to add prefix ``const``. + The ``elem->addr`` field has been changed to the new runtime structure, replaced by + ``elem->rt->addr``. (:github:`65388`) + * Deprecated :kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE`. This option is + replaced by new option :kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` to + be aligned with Mesh Protocol Specification v1.1, section 5.4. (:github:`64252`) LoRaWAN ======= diff --git a/samples/bluetooth/mesh_provisioner/prj.conf b/samples/bluetooth/mesh_provisioner/prj.conf index bfc6d5a1241..341dd49ed2e 100644 --- a/samples/bluetooth/mesh_provisioner/prj.conf +++ b/samples/bluetooth/mesh_provisioner/prj.conf @@ -33,7 +33,7 @@ CONFIG_BT_MESH_RELAY=y CONFIG_BT_MESH_RELAY_RETRANSMIT_COUNT=3 CONFIG_BT_MESH_PROVISIONER=y -CONFIG_BT_MESH_PROV_DEVICE=n +CONFIG_BT_MESH_PROVISIONEE=n CONFIG_BT_MESH_CDB=y CONFIG_BT_MESH_CDB_NODE_COUNT=16 CONFIG_BT_MESH_CDB_SUBNET_COUNT=3 diff --git a/subsys/bluetooth/Kconfig.logging b/subsys/bluetooth/Kconfig.logging index 6d8b999e03c..b6505f6e53a 100644 --- a/subsys/bluetooth/Kconfig.logging +++ b/subsys/bluetooth/Kconfig.logging @@ -1002,7 +1002,7 @@ legacy-debug-sym = BT_MESH_DEBUG_PROVISIONER module-str = "Provisioner" source "subsys/bluetooth/common/Kconfig.template.log_config_bt" -module = BT_MESH_PROV_DEVICE +module = BT_MESH_PROVISIONEE legacy-debug-sym = BT_MESH_DEBUG_PROV_DEVICE module-str = "Provisioning device" source "subsys/bluetooth/common/Kconfig.template.log_config_bt" diff --git a/subsys/bluetooth/mesh/CMakeLists.txt b/subsys/bluetooth/mesh/CMakeLists.txt index 3fd2e7c3bfc..fe4444b28ab 100644 --- a/subsys/bluetooth/mesh/CMakeLists.txt +++ b/subsys/bluetooth/mesh/CMakeLists.txt @@ -40,7 +40,7 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH_FRIEND friend.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROV prov.c) -zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROV_DEVICE prov_device.c) +zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROVISIONEE provisionee.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROVISIONER provisioner.c) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 3bc7dd2940f..bffbac3e8e7 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -240,7 +240,7 @@ config BT_MESH_PB_GATT select BT_MESH_GATT_SERVER select BT_MESH_PROV select BT_MESH_PB_GATT_COMMON - select BT_MESH_PROV_DEVICE + select BT_MESH_PROVISIONEE help Enable this option to allow the device to be provisioned over GATT. @@ -268,7 +268,16 @@ config BT_MESH_PB_GATT_CLIENT endif # BT_CONN config BT_MESH_PROV_DEVICE - bool "Provisioning device role support" + 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 default y help @@ -276,7 +285,7 @@ config BT_MESH_PROV_DEVICE config BT_MESH_PROV_OOB_PUBLIC_KEY bool "OOB Public key support" - depends on BT_MESH_PROV_DEVICE + depends on BT_MESH_PROVISIONEE help Enable this option if public key is to be exchanged via Out of Band (OOB) technology. diff --git a/subsys/bluetooth/mesh/prov_device.c b/subsys/bluetooth/mesh/provisionee.c similarity index 99% rename from subsys/bluetooth/mesh/prov_device.c rename to subsys/bluetooth/mesh/provisionee.c index 6ca65c2ec63..dcecb5838f0 100644 --- a/subsys/bluetooth/mesh/prov_device.c +++ b/subsys/bluetooth/mesh/provisionee.c @@ -32,9 +32,9 @@ #include "settings.h" #include "rpr.h" -#define LOG_LEVEL CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL +#define LOG_LEVEL CONFIG_BT_MESH_PROVISIONEE_LOG_LEVEL #include -LOG_MODULE_REGISTER(bt_mesh_prov_device); +LOG_MODULE_REGISTER(bt_mesh_provisionee); static void reprovision_fail(void); @@ -696,8 +696,8 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers) return -EALREADY; } -#if defined(CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL) - if (CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL > 2) { +#if defined(CONFIG_BT_MESH_PROVISIONEE_LOG_LEVEL) + if (CONFIG_BT_MESH_PROVISIONEE_LOG_LEVEL > 2) { struct bt_uuid_128 uuid = { .uuid = { BT_UUID_TYPE_128 } }; sys_memcpy_swap(uuid.val, bt_mesh_prov->uuid, 16); diff --git a/subsys/bluetooth/mesh/provisioner.c b/subsys/bluetooth/mesh/provisioner.c index ba02723e830..08b3f8bb8f1 100644 --- a/subsys/bluetooth/mesh/provisioner.c +++ b/subsys/bluetooth/mesh/provisioner.c @@ -46,7 +46,7 @@ static struct { uint8_t attention_duration; uint8_t uuid[16]; uint8_t new_dev_key[16]; -} prov_device; +} provisionee; static void send_pub_key(void); static void prov_dh_key_gen(void); @@ -54,8 +54,8 @@ static void prov_dh_key_gen(void); static int reset_state(void) { if (!atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION) && - prov_device.node != NULL) { - bt_mesh_cdb_node_del(prov_device.node, false); + provisionee.node != NULL) { + bt_mesh_cdb_node_del(provisionee.node, false); } return bt_mesh_prov_reset_state(); @@ -86,9 +86,9 @@ static void send_invite(void) LOG_DBG(""); bt_mesh_prov_buf_init(&inv, PROV_INVITE); - net_buf_simple_add_u8(&inv, prov_device.attention_duration); + net_buf_simple_add_u8(&inv, provisionee.attention_duration); - memcpy(bt_mesh_prov_link.conf_inputs.invite, &prov_device.attention_duration, + memcpy(bt_mesh_prov_link.conf_inputs.invite, &provisionee.attention_duration, PDU_LEN_INVITE); if (bt_mesh_prov_send(&inv, NULL)) { @@ -246,8 +246,8 @@ static void prov_capabilities(const uint8_t *data) LOG_DBG("Input OOB Size: %u", caps.input_size); LOG_DBG("Input OOB Action: 0x%04x", caps.input_actions); - prov_device.elem_count = caps.elem_count; - if (prov_device.elem_count == 0) { + provisionee.elem_count = caps.elem_count; + if (provisionee.elem_count == 0) { LOG_ERR("Invalid number of elements"); prov_fail(PROV_ERR_NVAL_FMT); return; @@ -271,7 +271,7 @@ static void prov_capabilities(const uint8_t *data) if (atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) { if (!bt_mesh_prov_link.addr) { bt_mesh_prov_link.addr = bt_mesh_cdb_free_addr_get( - prov_device.elem_count); + provisionee.elem_count); if (!bt_mesh_prov_link.addr) { LOG_ERR("Failed allocating address for node"); prov_fail(PROV_ERR_ADDR); @@ -279,19 +279,19 @@ static void prov_capabilities(const uint8_t *data) } } } else { - prov_device.node = - bt_mesh_cdb_node_alloc(prov_device.uuid, + provisionee.node = + bt_mesh_cdb_node_alloc(provisionee.uuid, bt_mesh_prov_link.addr, - prov_device.elem_count, - prov_device.net_idx); - if (prov_device.node == NULL) { + provisionee.elem_count, + provisionee.net_idx); + if (provisionee.node == NULL) { LOG_ERR("Failed allocating node 0x%04x", bt_mesh_prov_link.addr); prov_fail(PROV_ERR_RESOURCES); return; } /* Address might change in the alloc call */ - bt_mesh_prov_link.addr = prov_device.node->addr; + bt_mesh_prov_link.addr = provisionee.node->addr; } memcpy(bt_mesh_prov_link.conf_inputs.capabilities, data, PDU_LEN_CAPABILITIES); @@ -517,16 +517,16 @@ static void send_prov_data(void) LOG_DBG("Nonce: %s", bt_hex(nonce, 13)); err = bt_mesh_dev_key(bt_mesh_prov_link.dhkey, - bt_mesh_prov_link.prov_salt, prov_device.new_dev_key); + bt_mesh_prov_link.prov_salt, provisionee.new_dev_key); if (err) { LOG_ERR("Unable to generate device key"); prov_fail(PROV_ERR_UNEXP_ERR); goto session_key_destructor; } - sub = bt_mesh_cdb_subnet_get(prov_device.node->net_idx); + sub = bt_mesh_cdb_subnet_get(provisionee.node->net_idx); if (sub == NULL) { - LOG_ERR("No subnet with net_idx %u", prov_device.node->net_idx); + LOG_ERR("No subnet with net_idx %u", provisionee.node->net_idx); prov_fail(PROV_ERR_UNEXP_ERR); goto session_key_destructor; } @@ -540,14 +540,14 @@ static void send_prov_data(void) bt_mesh_prov_buf_init(&pdu, PROV_DATA); net_buf_simple_add_mem(&pdu, net_key, sizeof(net_key)); - net_buf_simple_add_be16(&pdu, prov_device.node->net_idx); + net_buf_simple_add_be16(&pdu, provisionee.node->net_idx); net_buf_simple_add_u8(&pdu, bt_mesh_cdb_subnet_flags(sub)); net_buf_simple_add_be32(&pdu, bt_mesh_cdb.iv_index); net_buf_simple_add_be16(&pdu, bt_mesh_prov_link.addr); net_buf_simple_add(&pdu, 8); /* For MIC */ LOG_DBG("net_idx %u, iv_index 0x%08x, addr 0x%04x", - prov_device.node->net_idx, bt_mesh.iv_index, + provisionee.node->net_idx, bt_mesh.iv_index, bt_mesh_prov_link.addr); err = bt_mesh_prov_encrypt(&session_key, nonce, &pdu.data[1], @@ -571,10 +571,10 @@ static void send_prov_data(void) static void prov_complete(const uint8_t *data) { - struct bt_mesh_cdb_node *node = prov_device.node; + struct bt_mesh_cdb_node *node = provisionee.node; LOG_DBG("key %s, net_idx %u, num_elem %u, addr 0x%04x", - bt_hex(&prov_device.new_dev_key, 16), node->net_idx, + bt_hex(&provisionee.new_dev_key, 16), node->net_idx, node->num_elem, node->addr); bt_mesh_prov_link.expect = PROV_NO_PDU; @@ -586,15 +586,15 @@ static void prov_complete(const uint8_t *data) static void prov_node_add(void) { LOG_DBG(""); - struct bt_mesh_cdb_node *node = prov_device.node; + struct bt_mesh_cdb_node *node = provisionee.node; int err; if (atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) { bt_mesh_cdb_node_update(node, bt_mesh_prov_link.addr, - prov_device.elem_count); + provisionee.elem_count); } - err = bt_mesh_cdb_node_key_import(node, prov_device.new_dev_key); + err = bt_mesh_cdb_node_key_import(node, provisionee.new_dev_key); if (err) { LOG_ERR("Failed to import node device key"); return; @@ -604,7 +604,7 @@ static void prov_node_add(void) bt_mesh_cdb_node_store(node); } - prov_device.node = NULL; + provisionee.node = NULL; if (bt_mesh_prov->node_added) { bt_mesh_prov->node_added(node->net_idx, node->uuid, node->addr, @@ -807,7 +807,7 @@ static int link_open(const uint8_t *uuid, const struct prov_bearer *bearer, } if (uuid) { - memcpy(prov_device.uuid, uuid, 16); + memcpy(provisionee.uuid, uuid, 16); struct bt_uuid_128 uuid_repr = { .uuid = { BT_UUID_TYPE_128 } }; @@ -823,8 +823,8 @@ static int link_open(const uint8_t *uuid, const struct prov_bearer *bearer, bt_mesh_prov_link.addr = addr; bt_mesh_prov_link.bearer = bearer; bt_mesh_prov_link.role = &role_provisioner; - prov_device.net_idx = net_idx; - prov_device.attention_duration = attention_duration; + provisionee.net_idx = net_idx; + provisionee.attention_duration = attention_duration; err = bt_mesh_prov_link.bearer->link_open( uuid, timeout, bt_mesh_prov_bearer_cb_get(), bearer_cb_data); @@ -877,15 +877,15 @@ static int reprovision_local_client_server(uint16_t addr) } LOG_DBG("net_idx %u iv_index 0x%08x, addr 0x%04x", - prov_device.node->net_idx, bt_mesh_cdb.iv_index, addr); + provisionee.node->net_idx, bt_mesh_cdb.iv_index, addr); atomic_set_bit(bt_mesh_prov_link.flags, REPROVISION); atomic_set_bit(bt_mesh_prov_link.flags, PROVISIONER); bt_mesh_prov_link.addr = addr; bt_mesh_prov_link.bearer = &pb_remote_cli; bt_mesh_prov_link.role = &role_provisioner; - prov_device.net_idx = prov_device.node->net_idx; - prov_device.attention_duration = 0; + provisionee.net_idx = provisionee.node->net_idx; + provisionee.attention_duration = 0; if (IS_ENABLED(CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY) && bt_mesh_prov->public_key_be && bt_mesh_prov->private_key_be) { @@ -908,13 +908,13 @@ static int reprovision_local_client_server(uint16_t addr) LOG_DBG("DHkey: %s", bt_hex(bt_mesh_prov_link.dhkey, DH_KEY_SIZE)); err = bt_mesh_dev_key(bt_mesh_prov_link.dhkey, - bt_mesh_prov_link.prov_salt, prov_device.new_dev_key); + bt_mesh_prov_link.prov_salt, provisionee.new_dev_key); if (err) { LOG_ERR("Unable to generate device key"); return err; } - bt_mesh_dev_key_cand(prov_device.new_dev_key); + bt_mesh_dev_key_cand(provisionee.new_dev_key); /* Mark the link that was never opened as closed. */ atomic_set_bit(bt_mesh_prov_link.flags, COMPLETE); bt_mesh_reprovision(addr); @@ -943,8 +943,8 @@ int bt_mesh_pb_remote_open_node(struct bt_mesh_rpr_cli *cli, ctx.refresh = BT_MESH_RPR_NODE_REFRESH_DEVKEY; } - prov_device.node = bt_mesh_cdb_node_get(srv->addr); - if (!prov_device.node) { + provisionee.node = bt_mesh_cdb_node_get(srv->addr); + if (!provisionee.node) { LOG_ERR("No CDB node for 0x%04x", srv->addr); return -ENOENT; } @@ -954,7 +954,7 @@ int bt_mesh_pb_remote_open_node(struct bt_mesh_rpr_cli *cli, return reprovision_local_client_server(addr); } - return link_open(NULL, &pb_remote_cli, prov_device.node->net_idx, addr, + return link_open(NULL, &pb_remote_cli, provisionee.node->net_idx, addr, 0, &ctx, 0); } #endif diff --git a/subsys/bluetooth/mesh/shell/shell.c b/subsys/bluetooth/mesh/shell/shell.c index bb9892eb355..9a0e5ece5e3 100644 --- a/subsys/bluetooth/mesh/shell/shell.c +++ b/subsys/bluetooth/mesh/shell/shell.c @@ -771,7 +771,7 @@ static int cmd_provision_gatt(const struct shell *sh, size_t argc, } #endif /* CONFIG_BT_MESH_PB_GATT_CLIENT */ -#if defined(CONFIG_BT_MESH_PROV_DEVICE) +#if defined(CONFIG_BT_MESH_PROVISIONEE) static int cmd_pb(bt_mesh_prov_bearer_t bearer, const struct shell *sh, size_t argc, char *argv[]) { @@ -822,7 +822,7 @@ static int cmd_pb_gatt(const struct shell *sh, size_t argc, char *argv[]) return cmd_pb(BT_MESH_PROV_GATT, sh, argc, argv); } #endif /* CONFIG_BT_MESH_PB_GATT */ -#endif /* CONFIG_BT_MESH_PROV_DEVICE */ +#endif /* CONFIG_BT_MESH_PROVISIONEE */ #if defined(CONFIG_BT_MESH_PROVISIONER) static int cmd_remote_pub_key_set(const struct shell *sh, size_t argc, char *argv[]) @@ -1681,14 +1681,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE( SHELL_CMD_ARG(comp-change, NULL, NULL, cmd_comp_change, 1, 0), /* Provisioning operations */ -#if defined(CONFIG_BT_MESH_PROV_DEVICE) +#if defined(CONFIG_BT_MESH_PROVISIONEE) #if defined(CONFIG_BT_MESH_PB_GATT) SHELL_CMD_ARG(pb-gatt, NULL, "", cmd_pb_gatt, 2, 0), #endif #if defined(CONFIG_BT_MESH_PB_ADV) SHELL_CMD_ARG(pb-adv, NULL, "", cmd_pb_adv, 2, 0), #endif -#endif /* CONFIG_BT_MESH_PROV_DEVICE */ +#endif /* CONFIG_BT_MESH_PROVISIONEE */ #if defined(CONFIG_BT_MESH_PROVISIONER) SHELL_CMD(auth-method, &auth_cmds, "Authentication methods", bt_mesh_shell_mdl_cmds_help), diff --git a/tests/bsim/bluetooth/mesh/prj.conf b/tests/bsim/bluetooth/mesh/prj.conf index a45bef89775..e9c719de6d7 100644 --- a/tests/bsim/bluetooth/mesh/prj.conf +++ b/tests/bsim/bluetooth/mesh/prj.conf @@ -37,7 +37,7 @@ CONFIG_BT_MESH_LABEL_COUNT=3 CONFIG_BT_MESH_IV_UPDATE_TEST=y CONFIG_BT_MESH_PB_ADV=y CONFIG_BT_MESH_PROVISIONER=y -CONFIG_BT_MESH_PROV_DEVICE=y +CONFIG_BT_MESH_PROVISIONEE=y CONFIG_BT_MESH_CDB=y CONFIG_BT_MESH_CDB_NODE_COUNT=4 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y diff --git a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf index 11059c03da4..fd0c953226b 100644 --- a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf +++ b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf @@ -39,7 +39,7 @@ CONFIG_BT_MESH_LABEL_COUNT=3 CONFIG_BT_MESH_IV_UPDATE_TEST=y CONFIG_BT_MESH_PB_ADV=y CONFIG_BT_MESH_PROVISIONER=y -CONFIG_BT_MESH_PROV_DEVICE=y +CONFIG_BT_MESH_PROVISIONEE=y CONFIG_BT_MESH_CDB=y CONFIG_BT_MESH_CDB_NODE_COUNT=4 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y From a02aeef00872c7306224d3f4030ec282e655f9bb Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0100/2300] [nrf fromtree] Bluetooth: Mesh: Added support for randomly delaying publications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The section 3.7.3.1 of the mesh specification recommends to delay a message publication in certain cases: - at power-up or upon state change for a time between 20 to 500 ms - for periodic publications for a time between 20 to 50 ms This change implements this recommendation by adding the `CONFIG_BT_MESH_DELAYABLE_PUBLICATION` Kconfig option which enables the randomization code and by adding the `bt_mesh_model_pub.delayable` bit field which allows each model decide whether the publications should be delayed for this model or not. Signed-off-by: Pavel Vasilyev (cherry picked from commit fe70e50d412cd470b301ccfda9ff07835f17219b) Signed-off-by: Håvard Reierstad (cherry picked from commit 9fe0ab63064c48af7e7a52080d7804c8811748fa) --- .../bluetooth/api/mesh/access.rst | 15 ++ include/zephyr/bluetooth/mesh/access.h | 2 + subsys/bluetooth/mesh/Kconfig | 9 + subsys/bluetooth/mesh/access.c | 91 ++++++++- tests/bsim/bluetooth/mesh/src/test_access.c | 176 ++++++++++++++++-- .../access/access_period_delayable.sh | 17 ++ .../access/access_transmit_delayable.sh | 17 ++ 7 files changed, 311 insertions(+), 16 deletions(-) create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh diff --git a/doc/connectivity/bluetooth/api/mesh/access.rst b/doc/connectivity/bluetooth/api/mesh/access.rst index 7030a3c14b2..cb02028b697 100644 --- a/doc/connectivity/bluetooth/api/mesh/access.rst +++ b/doc/connectivity/bluetooth/api/mesh/access.rst @@ -255,6 +255,21 @@ message, it will send messages with delay close to expiration to free memory. When the mesh stack is suspended or reset, messages not yet sent are removed and the :c:member:`bt_mesh_send_cb.start` callback is raised with an error code. +Delayable publications +====================== + +The delayable publication functionality implements the specification recommendations for message +publication delays in the following cases: + +* Between 20 to 500 milliseconds when the Bluetooth Mesh stack starts or when the publication is + triggered by the :c:func:`bt_mesh_model_publish` function +* Between 20 to 50 milliseconds for periodically published messages + +This feature is optional and enabled with the :kconfig:option:`CONFIG_BT_MESH_DELAYABLE_PUBLICATION` +Kconfig option. When enabled, each model can enable or disable the delayable publication by setting +the :c:member:`bt_mesh_model_pub.delayable` bit field to ``1`` or ``0`` correspondingly. This bit +field can be changed at any time. + API reference ************* diff --git a/include/zephyr/bluetooth/mesh/access.h b/include/zephyr/bluetooth/mesh/access.h index d57f30f8f05..a236ede525d 100644 --- a/include/zephyr/bluetooth/mesh/access.h +++ b/include/zephyr/bluetooth/mesh/access.h @@ -713,6 +713,8 @@ struct bt_mesh_model_pub { uint8_t period_div:4, /**< Divisor for the Period. */ count:4; /**< Transmissions left. */ + uint8_t delayable:1; /**< Use random delay for publishing. */ + uint32_t period_start; /**< Start of the current period. */ /** @brief Publication buffer, containing the publication message. diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index bffbac3e8e7..af6af8c44dc 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -672,6 +672,15 @@ config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT endif # BT_MESH_ACCESS_DELAYABLE_MSG +config BT_MESH_DELAYABLE_PUBLICATION + bool "Delayable publication" + default y + help + When enabled, the periodic publications are randomly delayed by 20 to 50ms. Publications + triggered at the start of the stack or by the bt_mesh_model_publish() call are delayed by + 20 to 500ms. This option reduces the probability of collisions when multiple nodes publish + at the same time. + endmenu # Access layer menu "Models" diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 4cffe064329..c3ef6a40554 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -33,6 +33,11 @@ #include LOG_MODULE_REGISTER(bt_mesh_access); +/* 20 - 50ms */ +#define RANDOM_DELAY_SHORT 30 +/* 20 - 500ms */ +#define RANDOM_DELAY_LONG 480 + /* Model publication information for persistent storage. */ struct mod_pub_val { struct { @@ -761,8 +766,16 @@ static int32_t next_period(const struct bt_mesh_model *mod) if (period && elapsed >= period) { LOG_WRN("Retransmission interval is too short"); - /* Return smallest positive number since 0 means disabled */ - return 1; + + if (!!pub->delayable) { + LOG_WRN("Publication period is too short for" + " retransmissions"); + } + + /* Keep retransmitting the message with the interval sacrificing the + * next publication period start. + */ + return BT_MESH_PUB_TRANSMIT_INT(mod->pub->retransmit); } } @@ -775,6 +788,11 @@ static int32_t next_period(const struct bt_mesh_model *mod) if (elapsed >= period) { LOG_WRN("Publication sending took longer than the period"); + + if (!!pub->delayable) { + LOG_WRN("Publication period is too short to be delayable"); + } + /* Return smallest positive number since 0 means disabled */ return 1; } @@ -855,6 +873,39 @@ static int pub_period_start(struct bt_mesh_model_pub *pub) return 0; } +static uint16_t pub_delay_get(int random_delay_window) +{ + if (!IS_ENABLED(CONFIG_BT_MESH_DELAYABLE_PUBLICATION)) { + return 0; + } + + uint16_t num = 0; + + (void)bt_rand(&num, sizeof(num)); + + return 20 + (num % random_delay_window); +} + +static int pub_delay_schedule(struct bt_mesh_model_pub *pub, int delay) +{ + uint16_t random; + int err; + + if (!IS_ENABLED(CONFIG_BT_MESH_DELAYABLE_PUBLICATION)) { + return -ENOTSUP; + } + + random = pub_delay_get(delay); + err = k_work_reschedule(&pub->timer, K_MSEC(random)); + if (err < 0) { + LOG_ERR("Unable to delay publication (err %d)", err); + return err; + } + + LOG_DBG("Publication delayed by %dms", random); + return 0; +} + static void mod_publish(struct k_work *work) { struct k_work_delayable *dwork = k_work_delayable_from_work(work); @@ -890,6 +941,13 @@ static void mod_publish(struct k_work *work) if (err) { return; } + + /* Delay the first publication in a period. */ + if (!!pub->delayable && !pub_delay_schedule(pub, RANDOM_DELAY_SHORT)) { + /* Increment count as it would do BT_MESH_PUB_MSG_TOTAL */ + pub->count++; + return; + } } err = publish_transmit(pub->mod); @@ -1564,6 +1622,18 @@ int bt_mesh_model_publish(const struct bt_mesh_model *model) LOG_DBG("Publish Retransmit Count %u Interval %ums", pub->count, BT_MESH_PUB_TRANSMIT_INT(pub->retransmit)); + /* Delay the publication for longer time when the publication is triggered manually (section + * 3.7.3.1): + * + * When the publication of a message is the result of a power-up, a state transition + * progress update, or completion of a state transition, multiple nodes may be reporting the + * state change at the same time. To reduce the probability of a message collision, these + * messages should be sent with a random delay between 20 and 500 milliseconds. + */ + if (!!pub->delayable && !pub_delay_schedule(pub, RANDOM_DELAY_LONG)) { + return 0; + } + k_work_reschedule(&pub->timer, K_NO_WAIT); return 0; @@ -2568,8 +2638,21 @@ static void commit_mod(const struct bt_mesh_model *mod, const struct bt_mesh_ele int32_t ms = bt_mesh_model_pub_period_get(mod); if (ms > 0) { - LOG_DBG("Starting publish timer (period %u ms)", ms); - k_work_schedule(&mod->pub->timer, K_MSEC(ms)); + /* Delay the first publication after power-up for longer time (section + * 3.7.3.1): + * + * When the publication of a message is the result of a power-up, a state + * transition progress update, or completion of a state transition, multiple + * nodes may be reporting the state change at the same time. To reduce the + * probability of a message collision, these messages should be sent with a + * random delay between 20 and 500 milliseconds. + */ + uint16_t random; + + random = !!mod->pub->delayable ? pub_delay_get(RANDOM_DELAY_LONG) : 0; + + LOG_DBG("Starting publish timer (period %u ms, delay %u ms)", ms, random); + k_work_schedule(&mod->pub->timer, K_MSEC(ms + random)); } } diff --git a/tests/bsim/bluetooth/mesh/src/test_access.c b/tests/bsim/bluetooth/mesh/src/test_access.c index b8b10fd7634..5cb7d2e28e1 100644 --- a/tests/bsim/bluetooth/mesh/src/test_access.c +++ b/tests/bsim/bluetooth/mesh/src/test_access.c @@ -60,6 +60,7 @@ static const struct { uint8_t div; int32_t period_ms; } test_period[] = { + { BT_MESH_PUB_PERIOD_100MS(1), 0, 100 }, { BT_MESH_PUB_PERIOD_100MS(5), 0, 500 }, { BT_MESH_PUB_PERIOD_SEC(2), 0, 2000 }, { BT_MESH_PUB_PERIOD_10SEC(1), 0, 10000 }, @@ -522,6 +523,91 @@ static void msgf_publish(void) bt_mesh_model_publish(model); } +static void pub_delayable_check(int32_t interval, uint8_t count) +{ + int64_t timestamp = k_uptime_get(); + int err; + + for (size_t j = 0; j < count; j++) { + /* Every new publication will release semaphore in the update handler and the time + * between two consecutive publications will be measured. + */ + err = k_sem_take(&publish_sem, K_SECONDS(20)); + if (err) { + FAIL("Send timed out"); + } + + int32_t time_delta = k_uptime_delta(×tamp); + int32_t pub_delta = time_delta - interval; + + LOG_DBG("Send time: %d delta: %d pub_delta: %d", (int32_t)timestamp, time_delta, + pub_delta); + + if (j == 0) { + /* The first delta will be between the messages published manually and next + * publication (or retransmission). So the time difference should not be + * longer than 500 - 20 + 10 (margin): + * + * |---|-------|--------|-------|----> + * M1 20ms tx(M1) 500ms + * update() + */ + ASSERT_IN_RANGE(pub_delta, 0, 510); + } else { + /* Time difference between the consequtive update callback calls should be + * within a small margin like without random delay as the callbacks should + * be called at the regular interval or immediately (if it passed the next + * period time). + */ + ASSERT_IN_RANGE(pub_delta, 0, 10); + } + } +} + +static void recv_delayable_check(int32_t interval, uint8_t count) +{ + int64_t timestamp; + int err; + + /* The measurement starts by the first received message. */ + err = k_sem_take(&publish_sem, K_SECONDS(20)); + if (err) { + FAIL("Recv timed out"); + } + + timestamp = k_uptime_get(); + + for (size_t j = 0; j < count; j++) { + /* Every new received message will release semaphore in the message handler and + * the time between two consecutive publications will be measured. + */ + err = k_sem_take(&publish_sem, K_SECONDS(20)); + if (err) { + FAIL("Recv timed out"); + } + + int32_t time_delta = k_uptime_delta(×tamp); + /* First message can be delayed up to 500ms, others for up to 50ms. */ + int32_t upper_delay = j == 0 ? 500 : 50; + + /* + * Lower boundary: tx2 - tx1 + interval + * |---|-------|---------------|-------|-----> + * M1 tx1(50ms/500ms) M2 tx2(20ms) + * + * Upper boundary: tx2 - tx1 + interval + * |---|-------|--------|-----------|-----> + * M1 tx1(20ms) M2 tx2(50ms/500ms) + */ + int32_t lower_boundary = 20 - upper_delay + interval; + int32_t upper_boundary = upper_delay - 20 + interval; + + LOG_DBG("Recv time: %d delta: %d boundaries: %d/%d", (int32_t)timestamp, time_delta, + lower_boundary, upper_boundary); + ASSERT_IN_RANGE(time_delta, lower_boundary, upper_boundary + RX_JITTER_MAX); + } +} + static void pub_jitter_check(int32_t interval, uint8_t count) { int64_t timestamp = k_uptime_get(); @@ -578,8 +664,8 @@ static void recv_jitter_check(int32_t interval, uint8_t count) jitter = MAX(pub_delta, jitter); - LOG_DBG("Recv time: %d delta: %d jitter: %d", (int32_t)timestamp, time_delta, - jitter); + LOG_DBG("Recv time: %d delta: %d jitter: %d, j: %d", (int32_t)timestamp, time_delta, + jitter, j); } LOG_INF("Recv jitter: %d", jitter); @@ -589,17 +675,19 @@ static void recv_jitter_check(int32_t interval, uint8_t count) /* Test publish period states by publishing a message and checking interval between update handler * calls. */ -static void test_tx_period(void) +static void tx_period(bool delayable) { const struct bt_mesh_model *model = &models[2]; - bt_mesh_test_cfg_set(NULL, 60); + bt_mesh_test_cfg_set(NULL, 70); bt_mesh_device_setup(&prov, &local_comp); provision(UNICAST_ADDR1); common_configure(UNICAST_ADDR1); k_sem_init(&publish_sem, 0, 1); + model->pub->delayable = delayable; + for (size_t i = 0; i < ARRAY_SIZE(test_period); i++) { pub_param_set(test_period[i].period, 0); @@ -611,7 +699,11 @@ static void test_tx_period(void) /* Start publishing messages and measure jitter. */ msgf_publish(); publish_allow = true; - pub_jitter_check(test_period[i].period_ms, PUB_PERIOD_COUNT); + if (delayable) { + pub_delayable_check(test_period[i].period_ms, PUB_PERIOD_COUNT); + } else { + pub_jitter_check(test_period[i].period_ms, PUB_PERIOD_COUNT); + } /* Disable periodic publication before the next test iteration. */ publish_allow = false; @@ -626,9 +718,9 @@ static void test_tx_period(void) /* Receive a periodically published message and check publication period by measuring interval * between message handler calls. */ -static void test_rx_period(void) +static void rx_period(bool delayable) { - bt_mesh_test_cfg_set(NULL, 60); + bt_mesh_test_cfg_set(NULL, 70); bt_mesh_device_setup(&prov, &local_comp); provision(UNICAST_ADDR2); common_configure(UNICAST_ADDR2); @@ -636,16 +728,40 @@ static void test_rx_period(void) k_sem_init(&publish_sem, 0, 1); for (size_t i = 0; i < ARRAY_SIZE(test_period); i++) { - recv_jitter_check(test_period[i].period_ms, PUB_PERIOD_COUNT); + if (delayable) { + recv_delayable_check(test_period[i].period_ms, PUB_PERIOD_COUNT); + } else { + recv_jitter_check(test_period[i].period_ms, PUB_PERIOD_COUNT); + } } PASS(); } +static void test_tx_period(void) +{ + tx_period(false); +} + +static void test_rx_period(void) +{ + rx_period(false); +} + +static void test_tx_period_delayable(void) +{ + tx_period(true); +} + +static void test_rx_period_delayable(void) +{ + rx_period(true); +} + /* Test publish retransmit interval and count states by publishing a message and checking interval * between update handler calls. */ -static void test_tx_transmit(void) +static void tx_transmit(bool delayable) { const struct bt_mesh_model *model = &models[2]; uint8_t status; @@ -672,6 +788,7 @@ static void test_tx_transmit(void) publish_allow = true; model->pub->retr_update = true; + model->pub->delayable = delayable; for (size_t i = 0; i < ARRAY_SIZE(test_transmit); i++) { pub_param_set(0, test_transmit[i]); @@ -683,7 +800,11 @@ static void test_tx_transmit(void) /* Start publishing messages and measure jitter. */ msgf_publish(); - pub_jitter_check(interval, count); + if (delayable) { + pub_delayable_check(interval, count); + } else { + pub_jitter_check(interval, count); + } /* Let the receiver hit the first semaphore. */ k_sleep(K_SECONDS(1)); @@ -695,7 +816,7 @@ static void test_tx_transmit(void) /* Receive a published message and check retransmission interval by measuring interval between * message handler calls. */ -static void test_rx_transmit(void) +static void rx_transmit(bool delayable) { bt_mesh_test_cfg_set(NULL, 60); bt_mesh_device_setup(&prov, &local_comp); @@ -708,12 +829,36 @@ static void test_rx_transmit(void) int32_t interval = BT_MESH_PUB_TRANSMIT_INT(test_transmit[i]); int count = BT_MESH_PUB_TRANSMIT_COUNT(test_transmit[i]); - recv_jitter_check(interval, count); + if (delayable) { + recv_delayable_check(interval, count); + } else { + recv_jitter_check(interval, count); + } } PASS(); } +static void test_tx_transmit(void) +{ + tx_transmit(false); +} + +static void test_rx_transmit(void) +{ + rx_transmit(false); +} + +static void test_tx_transmit_delayable(void) +{ + tx_transmit(true); +} + +static void test_rx_transmit_delayable(void) +{ + rx_transmit(true); +} + /* Cancel one of messages to be published and check that the next one is published when next period * starts. */ @@ -841,6 +986,13 @@ static const struct bst_test_instance test_access[] = { TEST_CASE(tx, cancel, "Access: Cancel a message during publication"), TEST_CASE(rx, cancel, "Access: Receive published messages except cancelled"), + TEST_CASE(tx, period_delayable, "Access: Test delayable periodic publication"), + TEST_CASE(rx, period_delayable, "Access: Receive delayable periodic publication"), + + TEST_CASE(tx, transmit_delayable, "Access: Test delayable publication with retransmission"), + TEST_CASE(rx, transmit_delayable, "Access: Receive delayable publication with" + " retransmissions"), + BSTEST_END_MARKER }; diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh new file mode 100755 index 00000000000..5ecd4a061de --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +RunTest mesh_access_pub_period_delayable_retr \ + access_tx_period_delayable access_rx_period_delayable + +conf=prj_mesh1d1_conf +RunTest mesh_access_pub_period_delayable_retr_1d1 \ + access_tx_period_delayable access_rx_period_delayable + +conf=prj_mesh1d1_conf +overlay=overlay_psa_conf +RunTest mesh_access_pub_period_delayable_retr_psa \ + access_tx_period_delayable access_rx_period_delayable diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh new file mode 100755 index 00000000000..1622ac49f06 --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +RunTest mesh_access_pub_transmit_delayable_retr \ + access_tx_transmit_delayable access_rx_transmit_delayable + +conf=prj_mesh1d1_conf +RunTest mesh_access_pub_transmit_delayable_retr_1d1 \ + access_tx_transmit_delayable access_rx_transmit_delayable + +conf=prj_mesh1d1_conf +overlay=overlay_psa_conf +RunTest mesh_access_pub_transmit_delayable_retr_psa \ + access_tx_period_delayable access_rx_period_delayable From 0a6a7acb7ccfe8e0fae7233e9563d866a806775b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Thu, 11 Jan 2024 14:02:44 +0100 Subject: [PATCH 0101/2300] [nrf fromtree] Bluetooth: Mesh: Refactor proxy adv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactors proxy advertising implementation to allow fair sharing of advertising resources between all subnets. In the new implementation, each subnet is agnostic to any other subnet that might have active proxy advertisement work. When proxy advertisement is triggered, the implementation will first check how many subnets that has active work. If there are more than one active subnet, a maximum timeslot will be calculated to ensure that all active subnets get access to the medium. The implementation will then poll the next eligible subnet for a proxy advertising request. If the duration of this request exceeds the maximum timeslot, the duration for the next advertisement will be set to the maximum value. If a proxy advertisement for a subnet is interrupted by other advertising activity, the implementation will now ensure that the interrupted proxy adv continues from the point where it was interrupted so that the subnet gets to utilize the entire allocated timeslot. This PR also alters the priv_proxy_net_id_multi Bsim test to align with the refactored proxy advertising scheme. Signed-off-by: Anders Storrø (cherry picked from commit 6c67ab3a637ea44bf815faffbe6fe083d5508aa3) Signed-off-by: Håvard Reierstad (cherry picked from commit 0408887166fe5c6d5636569437881bd21147250c) --- subsys/bluetooth/mesh/proxy_srv.c | 332 +++++++++++--------- tests/bsim/bluetooth/mesh/src/test_beacon.c | 10 +- 2 files changed, 190 insertions(+), 152 deletions(-) diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index 45e29915325..9cad9e2fe04 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -625,7 +625,7 @@ static int net_id_adv(struct bt_mesh_subnet *sub, int32_t duration) return 0; } -static bool advertise_subnet(struct bt_mesh_subnet *sub) +static bool is_sub_proxy_active(struct bt_mesh_subnet *sub) { if (sub->net_idx == BT_MESH_KEY_UNUSED) { return false; @@ -633,44 +633,18 @@ static bool advertise_subnet(struct bt_mesh_subnet *sub) return (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING || #if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) - sub->solicited || + (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited) || #endif bt_mesh_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED || bt_mesh_priv_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED); } -static struct bt_mesh_subnet *next_sub(void) +static bool active_proxy_sub_cnt_cb(struct bt_mesh_subnet *sub, void *cb_data) { - struct bt_mesh_subnet *sub = NULL; + int *cnt = cb_data; - if (!beacon_sub) { - beacon_sub = bt_mesh_subnet_next(NULL); - if (!beacon_sub) { - /* No valid subnets */ - return NULL; - } - } - - sub = beacon_sub; - do { - if (advertise_subnet(sub)) { - beacon_sub = sub; - return sub; - } - - sub = bt_mesh_subnet_next(sub); - } while (sub != beacon_sub); - - /* No subnets to advertise on */ - return NULL; -} - -static bool sub_count_cb(struct bt_mesh_subnet *sub, void *cb_data) -{ - int *count = cb_data; - - if (advertise_subnet(sub)) { - (*count)++; + if (is_sub_proxy_active(sub)) { + (*cnt)++; } /* Don't stop until we've visited all subnets. @@ -679,155 +653,225 @@ static bool sub_count_cb(struct bt_mesh_subnet *sub, void *cb_data) return false; } -static int sub_count(void) +static int active_proxy_sub_cnt_get(void) { - int count = 0; + int cnt = 0; - (void)bt_mesh_subnet_find(sub_count_cb, &count); + (void)bt_mesh_subnet_find(active_proxy_sub_cnt_cb, &cnt); - return count; + return cnt; } -#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) -static void gatt_proxy_solicited(struct bt_mesh_subnet *sub) +static void proxy_adv_timeout_eval(struct bt_mesh_subnet *sub) { - int64_t now = k_uptime_get(); - int64_t timeout = 0; - int32_t remaining; - - if (sub->priv_net_id_sent > 0) { - timeout = sub->priv_net_id_sent + - MSEC_PER_SEC * (int64_t) bt_mesh_od_priv_proxy_get(); - remaining = MIN(timeout - now, INT32_MAX); - } else { - remaining = MSEC_PER_SEC * bt_mesh_od_priv_proxy_get(); + int32_t time_passed; + + if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) { + time_passed = k_uptime_get_32() - sub->node_id_start; + if (time_passed > (NODE_ID_TIMEOUT - MSEC_PER_SEC)) { + bt_mesh_proxy_identity_stop(sub); + LOG_DBG("Node ID stopped for subnet %d after %dms", sub->net_idx, + time_passed); + } } - if ((timeout > 0 && now > timeout) || (remaining / MSEC_PER_SEC < 1)) { - LOG_DBG("Advertising Private Network ID timed out " - "after solicitation"); - sub->priv_net_id_sent = 0; - sub->solicited = false; - } else { - LOG_DBG("Advertising Private Network ID for %ds" - "(%d remaining)", - bt_mesh_od_priv_proxy_get(), - remaining / MSEC_PER_SEC); - priv_net_id_adv(sub, remaining); - - if (!sub->priv_net_id_sent) { - sub->priv_net_id_sent = now; +#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) + if (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited && sub->priv_net_id_sent) { + time_passed = k_uptime_get_32() - sub->priv_net_id_sent; + if (time_passed > ((MSEC_PER_SEC * bt_mesh_od_priv_proxy_get()) - MSEC_PER_SEC)) { + sub->priv_net_id_sent = 0; + sub->solicited = false; + LOG_DBG("Private Network ID stopped for subnet %d after %dms on " + "solicitation", + sub->net_idx, time_passed); } } +#endif } + +enum proxy_adv_evt { + NET_ID, + PRIV_NET_ID, + NODE_ID, + PRIV_NODE_ID, + OD_PRIV_NET_ID, +}; + +struct proxy_adv_request { + int32_t duration; + enum proxy_adv_evt evt; +}; + +static bool proxy_adv_request_get(struct bt_mesh_subnet *sub, struct proxy_adv_request *request) +{ + if (!sub) { + return false; + } + + if (sub->net_idx == BT_MESH_KEY_UNUSED) { + return false; + } + +#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) + if (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited) { + int32_t timeout = MSEC_PER_SEC * (int32_t)bt_mesh_od_priv_proxy_get(); + + request->evt = OD_PRIV_NET_ID; + request->duration = !sub->priv_net_id_sent + ? timeout + : timeout - (k_uptime_get_32() - sub->priv_net_id_sent); + return true; + } #endif -static int gatt_proxy_advertise(struct bt_mesh_subnet *sub) + if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) { + request->duration = NODE_ID_TIMEOUT - (k_uptime_get_32() - sub->node_id_start); + request->evt = +#if defined(CONFIG_BT_MESH_PRIV_BEACONS) + sub->priv_beacon_ctx.node_id ? PRIV_NODE_ID : +#endif + NODE_ID; + + return true; + } + + if (bt_mesh_priv_gatt_proxy_get() == BT_MESH_FEATURE_ENABLED) { + request->evt = PRIV_NET_ID; + request->duration = PROXY_RANDOM_UPDATE_INTERVAL; + return true; + } + + if (bt_mesh_gatt_proxy_get() == BT_MESH_FEATURE_ENABLED) { + request->evt = NET_ID; + request->duration = SYS_FOREVER_MS; + return true; + } + + return false; +} + +static struct bt_mesh_subnet *adv_sub_get_next(struct bt_mesh_subnet *sub_start, + struct proxy_adv_request *request) { - int32_t remaining = SYS_FOREVER_MS; - int subnet_count; - int err = -EBUSY; - bool planned = false; + struct bt_mesh_subnet *sub_temp = sub_start; + + do { + if (proxy_adv_request_get(sub_temp, request)) { + return sub_temp; + } + + sub_temp = bt_mesh_subnet_next(sub_temp); + } while (sub_temp != sub_start); + + return NULL; +} + +static struct { + int32_t start; + struct bt_mesh_subnet *sub; + struct proxy_adv_request request; +} sub_adv; + +static int gatt_proxy_advertise(void) +{ + int err; + + int32_t max_adv_duration; + int cnt; + struct bt_mesh_subnet *sub; + struct proxy_adv_request request; LOG_DBG(""); + /* Close proxy activity that has timed out on all subnets */ + bt_mesh_subnet_foreach(proxy_adv_timeout_eval); + if (!bt_mesh_proxy_has_avail_conn()) { LOG_DBG("Connectable advertising deferred (max connections)"); return -ENOMEM; } - sub = beacon_sub ? beacon_sub : bt_mesh_subnet_next(beacon_sub); - if (!sub) { - LOG_WRN("No subnets to advertise on"); + cnt = active_proxy_sub_cnt_get(); + if (!cnt) { + LOG_DBG("No subnets to advertise proxy on"); return -ENOENT; - } - - subnet_count = sub_count(); - LOG_DBG("sub_count %u", subnet_count); - if (subnet_count > 1) { - int32_t max_timeout; + } else if (cnt > 1) { + /** There is more than one subnet that requires proxy adv, + * and the adv resources must be shared. + */ /* We use NODE_ID_TIMEOUT as a starting point since it may * be less than 60 seconds. Divide this period into at least - * 6 slices, but make sure that a slice is at least one + * 6 slices, but make sure that a slice is more than one * second long (to avoid excessive rotation). */ - max_timeout = NODE_ID_TIMEOUT / MAX(subnet_count, 6); - max_timeout = MAX(max_timeout, 1 * MSEC_PER_SEC); - - if (remaining > max_timeout || remaining == SYS_FOREVER_MS) { - remaining = max_timeout; + max_adv_duration = NODE_ID_TIMEOUT / MAX(cnt, 6); + max_adv_duration = MAX(max_adv_duration, MSEC_PER_SEC + 20); + + /* Check if the previous subnet finished its allocated timeslot */ + if ((sub_adv.request.duration != SYS_FOREVER_MS) && + proxy_adv_request_get(sub_adv.sub, &request) && + (sub_adv.request.evt == request.evt)) { + int32_t time_passed = k_uptime_get_32() - sub_adv.start; + + if (time_passed < sub_adv.request.duration && + ((sub_adv.request.duration - time_passed) >= MSEC_PER_SEC)) { + sub = sub_adv.sub; + request.duration = sub_adv.request.duration - time_passed; + goto end; + } } } - for (int i = 0; i < subnet_count; i++) { - - if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) { - uint32_t active = k_uptime_get_32() - sub->node_id_start; - bool priv_node_id = false; - - if (active < NODE_ID_TIMEOUT) { - remaining = MIN(remaining, NODE_ID_TIMEOUT - active); - LOG_DBG("Node ID active for %u ms, %d ms remaining", - active, remaining); -#if defined(CONFIG_BT_MESH_PRIV_BEACONS) - priv_node_id = sub->priv_beacon_ctx.node_id; -#endif - if (priv_node_id) { - err = priv_node_id_adv(sub, remaining); - } else { - err = node_id_adv(sub, remaining); - } - planned = true; - } else { - bt_mesh_proxy_identity_stop(sub); - LOG_DBG("Node ID stopped"); - } - } + sub = adv_sub_get_next(bt_mesh_subnet_next(sub_adv.sub), &request); + if (!sub) { + LOG_ERR("Could not find subnet to advertise"); + return -ENOENT; + } +end: + if (cnt > 1) { + request.duration = (request.duration == SYS_FOREVER_MS) + ? max_adv_duration + : MIN(request.duration, max_adv_duration); + } - /* MshPRTv1.1: section 7.2.2.2.1: - * "A node that does not support the Proxy feature or - * has the GATT Proxy state disabled shall not advertise with Network ID." - */ - if (sub->node_id == BT_MESH_NODE_IDENTITY_STOPPED) { - if (IS_ENABLED(CONFIG_BT_MESH_PRIV_BEACONS) && - (bt_mesh_priv_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED)) { - /* MshPRTv1.1: 7.2.2.2.4: The Random - * field should be updated every 10 minutes. Limit advertising to - * 10 minutes to ensure regeneration of a new random value at least - * that often. - */ - if (remaining == SYS_FOREVER_MS || - remaining > PROXY_RANDOM_UPDATE_INTERVAL) { - remaining = PROXY_RANDOM_UPDATE_INTERVAL; - } - - err = priv_net_id_adv(sub, remaining); - planned = true; - } else if (bt_mesh_gatt_proxy_get() == BT_MESH_FEATURE_ENABLED) { - err = net_id_adv(sub, remaining); - planned = true; - } + /* Save current state for next iteration */ + sub_adv.start = k_uptime_get_32(); + sub_adv.sub = sub; + sub_adv.request = request; + switch (request.evt) { + case NET_ID: + err = net_id_adv(sub, request.duration); + break; #if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) - else if (bt_mesh_od_priv_proxy_get() > 0 && - sub->solicited) { - gatt_proxy_solicited(sub); - } -#endif - } - - beacon_sub = bt_mesh_subnet_next(sub); - - if (planned) { - LOG_DBG("Advertising %d ms for net_idx 0x%04x", remaining, sub->net_idx); - return err; + case OD_PRIV_NET_ID: + if (!sub->priv_net_id_sent) { + sub->priv_net_id_sent = k_uptime_get(); } + /* Fall through */ +#endif + case PRIV_NET_ID: + err = priv_net_id_adv(sub, request.duration); + break; + case NODE_ID: + err = node_id_adv(sub, request.duration); + break; + case PRIV_NODE_ID: + err = priv_node_id_adv(sub, request.duration); + break; + default: + LOG_ERR("Unexpected proxy adv evt: %d", request.evt); + return -ENODEV; + } - sub = beacon_sub; + if (err) { + LOG_ERR("Advertising proxy failed (err: %d)", err); + return err; } - return 0; + LOG_DBG("Advertising %d ms for net_idx 0x%04x", request.duration, sub->net_idx); + return err; } static void subnet_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt) @@ -1152,7 +1196,7 @@ int bt_mesh_proxy_adv_start(void) return -ENOTSUP; } - return gatt_proxy_advertise(next_sub()); + return gatt_proxy_advertise(); } BT_CONN_CB_DEFINE(conn_callbacks) = { diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index 038c705f2cb..f9230a397a9 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -1763,12 +1763,6 @@ static void test_tx_priv_multi_net_id(void) { tx_priv_common_init(PP_MULT_NET_ID_WAIT_TIME); - /* TODO: This should be removed as soon as - * SNB/proxy service advertising issue has - * been resolved. - */ - bt_mesh_beacon_set(false); - /* Add second network */ ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_secondary), "Failed to add second subnet"); @@ -1819,8 +1813,8 @@ static void test_rx_priv_multi_net_id(void) /* Verify last Net ID adv result */ ASSERT_IN_RANGE(k_uptime_get() - net_ctx[old_idx].start, - MAX_TIMEOUT - 1000, MAX_TIMEOUT); - ASSERT_IN_RANGE(net_ctx[old_idx].recv_cnt, 9, 10); + MAX_TIMEOUT - 1000, MAX_TIMEOUT + 1000); + ASSERT_IN_RANGE(net_ctx[old_idx].recv_cnt, 9, 12); net_ctx[old_idx].recv_cnt = 0; old_idx = i; From 660b52ee5d2edff02a1d068fc1fac9b9175469a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Thu, 11 Jan 2024 14:02:45 +0100 Subject: [PATCH 0102/2300] [nrf fromtree] tests: Bluetooth: Mesh: Add proxy adv coex test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds test that verifies correct Proxy advertisement behavior for a device where the Proxy adv requirements changes over time, both for single and multiple subnets. Signed-off-by: Anders Storrø (cherry picked from commit f70929a8f12214de7dc7e1fe52a8d696bfc7f55f) Signed-off-by: Håvard Reierstad (cherry picked from commit f6350f1e94fa82e3f9b982014f32f046f2eb5379) --- subsys/bluetooth/mesh/proxy_srv.c | 11 +- tests/bsim/bluetooth/mesh/overlay_gatt.conf | 1 + tests/bsim/bluetooth/mesh/src/test_beacon.c | 366 ++++++++++++++++-- .../proxy_adv_multi_subnet_coex.sh | 54 +++ 4 files changed, 397 insertions(+), 35 deletions(-) create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index 9cad9e2fe04..25a44abfded 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -712,6 +712,13 @@ static bool proxy_adv_request_get(struct bt_mesh_subnet *sub, struct proxy_adv_r return false; } + /** The priority for proxy adv is first solicitation, then Node Identity, + * and lastly Network ID. Network ID is prioritized last since, in many + * cases, another device can fulfill the same demand. Solicitation is + * prioritized first since legacy devices are dependent on this to + * connect to the network. + */ + #if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) if (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited) { int32_t timeout = MSEC_PER_SEC * (int32_t)bt_mesh_od_priv_proxy_get(); @@ -753,7 +760,7 @@ static bool proxy_adv_request_get(struct bt_mesh_subnet *sub, struct proxy_adv_r static struct bt_mesh_subnet *adv_sub_get_next(struct bt_mesh_subnet *sub_start, struct proxy_adv_request *request) { - struct bt_mesh_subnet *sub_temp = sub_start; + struct bt_mesh_subnet *sub_temp = bt_mesh_subnet_next(sub_start); do { if (proxy_adv_request_get(sub_temp, request)) { @@ -823,7 +830,7 @@ static int gatt_proxy_advertise(void) } } - sub = adv_sub_get_next(bt_mesh_subnet_next(sub_adv.sub), &request); + sub = adv_sub_get_next(sub_adv.sub, &request); if (!sub) { LOG_ERR("Could not find subnet to advertise"); return -ENOENT; diff --git a/tests/bsim/bluetooth/mesh/overlay_gatt.conf b/tests/bsim/bluetooth/mesh/overlay_gatt.conf index f94a26d623f..7660313b700 100644 --- a/tests/bsim/bluetooth/mesh/overlay_gatt.conf +++ b/tests/bsim/bluetooth/mesh/overlay_gatt.conf @@ -6,3 +6,4 @@ CONFIG_BT_MESH_LOW_POWER=n CONFIG_BT_MESH_FRIEND=n CONFIG_BT_CENTRAL=y CONFIG_BT_MESH_PROXY_CLIENT=y +CONFIG_BT_MESH_PROXY_SOLICITATION=y diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index f9230a397a9..e5f7d515da7 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -31,7 +31,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL_INF); #define BEACON_TYPE_PRIVATE 0x02 #endif -static uint8_t test_net_key_secondary[16] = { 0xca, 0x11, 0xab, 0x1e }; +static uint8_t test_net_key_2[16] = { 0xca, 0x11, 0xab, 0x1e }; static struct { uint8_t primary[16]; uint8_t secondary[16]; @@ -334,6 +334,7 @@ static struct { uint8_t random[13]; uint64_t pp_hash; uint64_t pp_random; + uint64_t net_id; bt_addr_le_t adv_addr; #endif bool (*process_cb)(const uint8_t *net_id, void *ctx); @@ -625,7 +626,7 @@ static void test_tx_kr_old_key(void) * the new Net Key. The node shall set Key Refresh phase to 2. The beacon interval shall * be increased. */ - beacon_create(&buf, test_net_key_secondary, 0x03, 0x0001); + beacon_create(&buf, test_net_key_2, 0x03, 0x0001); send_beacon(&buf); ASSERT_FALSE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); ASSERT_TRUE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); @@ -645,7 +646,7 @@ static void test_tx_kr_old_key(void) /* Try the same with the new Net Key. Now the node shall change Key Refresh phase to 0. The * beacon interval shall be increased. */ - beacon_create(&buf, test_net_key_secondary, 0x02, 0x0001); + beacon_create(&buf, test_net_key_2, 0x02, 0x0001); send_beacon(&buf); ASSERT_FALSE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); ASSERT_TRUE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); @@ -665,7 +666,7 @@ static void test_tx_kr_old_key(void) /* Do the same, but secure beacon with the new Net Key. Now the node shall change IV Update * flag to 0. The beacon interval shall be increased. */ - beacon_create(&buf, test_net_key_secondary, 0x00, 0x0001); + beacon_create(&buf, test_net_key_2, 0x00, 0x0001); send_beacon(&buf); ASSERT_FALSE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); ASSERT_TRUE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); @@ -686,7 +687,7 @@ static void test_rx_kr_old_key(void) bt_mesh_test_setup(); bt_mesh_iv_update_test(true); - err = bt_mesh_cfg_cli_net_key_update(0, cfg->addr, 0, test_net_key_secondary, &status); + err = bt_mesh_cfg_cli_net_key_update(0, cfg->addr, 0, test_net_key_2, &status); if (err || status) { FAIL("Net Key update failed (err %d, status %u)", err, status); } @@ -1541,60 +1542,73 @@ static void test_tx_priv_beacon_cache(void) #if IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY) +static uint8_t test_net_key_3[16] = {0x12, 0x54, 0xab, 0x1e}; + +#define UNTIL_UPTIME(time) (k_uptime_get() > (time) ? K_NO_WAIT : K_MSEC((time) - k_uptime_get())) +#define BEACON_TYPE_NET_ID 0 +#define BEACON_TYPE_NODE_ID 1 #define BEACON_TYPE_PRIVATE_NET_ID 2 #define BEACON_TYPE_PRIVATE_NODE_ID 3 #define BEACON_TYPE_PRIVATE_LEN 28 #define TEST_NET_IDX1 0 #define TEST_NET_IDX2 1 +#define TEST_NET_IDX3 2 #define MAX_TIMEOUT ((CONFIG_BT_MESH_NODE_ID_TIMEOUT * 1000) / 6) #define PP_NET_ID_WAIT_TIME 610 /*seconds*/ #define PP_NODE_ID_WAIT_TIME 80 /*seconds*/ #define PP_MULT_NET_ID_WAIT_TIME 50 /*seconds*/ +#define PROXY_ADV_MULTI_SUBNET_COEX_WAIT_TIME 151 /*seconds*/ -struct pp_netkey_ctx { +struct netkey_ctx { uint8_t *net_key; uint8_t net_id[8]; + uint8_t net_idx; struct bt_mesh_key id_key; }; -static struct pp_netkey_ctx pp_net0 = {.net_key = (uint8_t *)test_net_key}; -static struct pp_netkey_ctx pp_net1 = {.net_key = (uint8_t *)test_net_key_secondary}; +static struct netkey_ctx pp_net0 = {.net_key = (uint8_t *)test_net_key, .net_idx = 0}; +static struct netkey_ctx pp_net1 = {.net_key = (uint8_t *)test_net_key_2, .net_idx = 1}; +static struct netkey_ctx pp_net2 = {.net_key = (uint8_t *)test_net_key_3, .net_idx = 2}; struct priv_test_ctx { uint8_t beacon_type; uint16_t *node_id_addr; }; -static void pp_netkey_ctx_init(struct pp_netkey_ctx *net) +static void pp_netkey_ctx_init(struct netkey_ctx *net) { ASSERT_OK_MSG(bt_mesh_identity_key(net->net_key, &net->id_key), "Failed to generate ID key"); ASSERT_OK_MSG(bt_mesh_k3(net->net_key, net->net_id), "Failed to generate Net ID"); } -static bool pp_type_check(uint16_t expected_beacon, uint8_t adv_type, struct net_buf_simple *buf) +static uint8_t proxy_adv_type_get(uint8_t adv_type, struct net_buf_simple *buf) { - if (adv_type != BT_GAP_ADV_TYPE_ADV_IND || buf->len != BEACON_TYPE_PRIVATE_LEN) { - return false; + uint8_t type; + uint8_t len = buf->len; + + if (adv_type != BT_GAP_ADV_TYPE_ADV_IND || len < 12) { + return 0xFF; } - /* Remove Header */ (void)net_buf_simple_pull_mem(buf, 11); - - uint8_t beacon_type = net_buf_simple_pull_u8(buf); - - if (beacon_type != expected_beacon) { - return false; + type = net_buf_simple_pull_u8(buf); + /* BEACON_TYPE_NET_ID is 20 bytes long, while the three other accepted types are 28 bytes*/ + if (len != ((type == BEACON_TYPE_NET_ID) ? 20 : 28)) { + return 0xFF; } - return true; + return type; } -static uint64_t pp_hash_calc(struct pp_netkey_ctx *net, uint64_t random, uint16_t *addr) +static uint64_t proxy_adv_hash_calc(struct netkey_ctx *net, uint64_t random, uint16_t *addr, + bool is_priv) { uint64_t hash; - uint8_t tmp[16] = {0, 0, 0, 0, 0, 3}; + uint8_t tmp[16] = {0}; + + tmp[5] = is_priv ? 3 : 0; if (addr) { memcpy(&tmp[6], &random, 8); @@ -1616,7 +1630,7 @@ static bool pp_beacon_check(const uint8_t *net_id, void *ctx) struct priv_test_ctx *test_ctx = (struct priv_test_ctx *)ctx; ASSERT_EQUAL(beacon.pp_hash, - pp_hash_calc(&pp_net0, beacon.pp_random, test_ctx->node_id_addr)); + proxy_adv_hash_calc(&pp_net0, beacon.pp_random, test_ctx->node_id_addr, true)); if (memcmp(beacon.adv_addr.a.val, last_beacon_adv_addr.a.val, BT_ADDR_SIZE) == 0) { return false; @@ -1632,15 +1646,58 @@ static void priv_scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type { struct priv_test_ctx *ctx = (struct priv_test_ctx *)beacon.user_ctx; - if (!pp_type_check(ctx->beacon_type, adv_type, buf)) { + if (proxy_adv_type_get(adv_type, buf) != ctx->beacon_type) { /* Wrong message type */ return; } bt_addr_le_copy(&beacon.adv_addr, addr); - beacon.pp_hash = net_buf_simple_pull_le64(buf); - beacon.pp_random = net_buf_simple_pull_le64(buf); + if (ctx->beacon_type == BEACON_TYPE_NET_ID) { + beacon.net_id = net_buf_simple_pull_le64(buf); + } else { + beacon.pp_hash = net_buf_simple_pull_le64(buf); + beacon.pp_random = net_buf_simple_pull_le64(buf); + } + + if (!beacon.process_cb || beacon.process_cb(NULL, beacon.user_ctx)) { + k_sem_give(&observer_sem); + } +} + +struct proxy_adv_beacon { + uint8_t evt_type; + uint8_t net_idx; + int64_t rx_timestamp; + union { + uint64_t net_id; + struct { + uint64_t hash; + uint64_t random; + } enc; + } ctx; +}; + +static void proxy_adv_scan_all_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type, + struct net_buf_simple *buf) +{ + struct proxy_adv_beacon *beac = (struct proxy_adv_beacon *)beacon.user_ctx; + + beac->evt_type = proxy_adv_type_get(adv_type, buf); + if (beac->evt_type == 0xFF) { + /* Not a related beacon type */ + return; + } + + bt_addr_le_copy(&beacon.adv_addr, addr); + beac->rx_timestamp = k_uptime_get(); + + if (beac->evt_type == BEACON_TYPE_NET_ID) { + beac->ctx.net_id = net_buf_simple_pull_le64(buf); + } else { + beac->ctx.enc.hash = net_buf_simple_pull_le64(buf); + beac->ctx.enc.random = net_buf_simple_pull_le64(buf); + } if (!beacon.process_cb || beacon.process_cb(NULL, beacon.user_ctx)) { k_sem_give(&observer_sem); @@ -1656,11 +1713,11 @@ static void rx_priv_common_init(uint16_t wait) ASSERT_OK_MSG(bt_enable(NULL), "Bluetooth init failed"); } -static void tx_priv_common_init(uint16_t wait) +static void tx_proxy_adv_common_init(uint16_t wait, const struct bt_mesh_test_cfg *cfg) { bt_mesh_test_cfg_set(NULL, wait); bt_mesh_device_setup(&prov, &prb_comp); - provision(&tx_cfg); + provision(cfg); /* Disable GATT proxy */ ASSERT_OK_MSG(bt_mesh_gatt_proxy_set(BT_MESH_GATT_PROXY_DISABLED), @@ -1669,7 +1726,7 @@ static void tx_priv_common_init(uint16_t wait) static void test_tx_priv_net_id(void) { - tx_priv_common_init(PP_NET_ID_WAIT_TIME); + tx_proxy_adv_common_init(PP_NET_ID_WAIT_TIME, &tx_cfg); /* Enable private GATT proxy */ ASSERT_OK_MSG(bt_mesh_priv_gatt_proxy_set(BT_MESH_GATT_PROXY_ENABLED), @@ -1708,7 +1765,7 @@ static void test_tx_priv_node_id(void) { enum bt_mesh_feat_state state; - tx_priv_common_init(PP_NODE_ID_WAIT_TIME); + tx_proxy_adv_common_init(PP_NODE_ID_WAIT_TIME, &tx_cfg); /* Start first node advertisement */ ASSERT_OK_MSG(bt_mesh_subnet_priv_node_id_set(TEST_NET_IDX1, BT_MESH_NODE_IDENTITY_RUNNING), @@ -1761,10 +1818,10 @@ static void test_rx_priv_node_id(void) static void test_tx_priv_multi_net_id(void) { - tx_priv_common_init(PP_MULT_NET_ID_WAIT_TIME); + tx_proxy_adv_common_init(PP_MULT_NET_ID_WAIT_TIME, &tx_cfg); /* Add second network */ - ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_secondary), + ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_2), "Failed to add second subnet"); /* Enable private GATT proxy */ @@ -1774,6 +1831,246 @@ static void test_tx_priv_multi_net_id(void) PASS(); } +static void proxy_adv_subnet_find(struct proxy_adv_beacon *beac, struct netkey_ctx **nets, + uint8_t net_cnt) +{ + for (size_t i = 0; i < net_cnt; i++) { + + switch (beac->evt_type) { + case BEACON_TYPE_NET_ID: + if (!memcmp(nets[i]->net_id, &beac->ctx.net_id, 8)) { + beac->net_idx = nets[i]->net_idx; + return; + } + break; + case BEACON_TYPE_NODE_ID: + if (beac->ctx.enc.hash == + proxy_adv_hash_calc(nets[i], beac->ctx.enc.random, + (uint16_t *)&tx_cfg.addr, false)) { + beac->net_idx = nets[i]->net_idx; + return; + } + break; + case BEACON_TYPE_PRIVATE_NET_ID: + if (beac->ctx.enc.hash == + proxy_adv_hash_calc(nets[i], beac->ctx.enc.random, + NULL, true)) { + beac->net_idx = nets[i]->net_idx; + return; + } + break; + case BEACON_TYPE_PRIVATE_NODE_ID: + if (beac->ctx.enc.hash == + proxy_adv_hash_calc(nets[i], beac->ctx.enc.random, + (uint16_t *)&tx_cfg.addr, true)) { + beac->net_idx = nets[i]->net_idx; + return; + } + break; + + default: + FAIL("Unexpected beacon type"); + break; + } + } + + FAIL("Could not find matching subnet for incoming proxy adv beacon"); +} + +static const char *const proxy_adv_str[] = {"Net_ID", "Node_ID", "Priv_Net_ID", "Priv_Node_ID"}; +struct expected_proxy_adv_evt { + uint8_t evt_type; + uint8_t net_idx; + uint16_t evt_cnt; + struct { + int64_t after; + int64_t before; + } time; +}; + +static void proxy_adv_register_evt(struct proxy_adv_beacon *beac, + struct expected_proxy_adv_evt *exp_evts, uint8_t cnt) +{ + for (int i = 0; i < cnt; i++) { + if ((exp_evts[i].evt_cnt) && (beac->evt_type == exp_evts[i].evt_type) && + (beac->net_idx == exp_evts[i].net_idx) && + (beac->rx_timestamp >= exp_evts[i].time.after) && + (beac->rx_timestamp <= exp_evts[i].time.before)) { + exp_evts[i].evt_cnt--; + } + } +} + +static void proxy_adv_confirm_evt(struct expected_proxy_adv_evt *exp_evts, uint8_t cnt) +{ + bool missing_evts = false; + + for (int i = 0; i < cnt; i++) { + if (exp_evts[i].evt_cnt) { + LOG_ERR("Missing %d expected %s events in period %llums-%llums", + exp_evts[i].evt_cnt, proxy_adv_str[exp_evts[i].evt_type], + exp_evts[i].time.after, exp_evts[i].time.before); + missing_evts = true; + } + } + + if (missing_evts) { + FAIL("Test failed due to missing events"); + } +} + +static void proxy_adv_scan_all(struct netkey_ctx **nets, uint16_t net_cnt, + struct expected_proxy_adv_evt *exp_evt, uint16_t exp_evt_cnt, + int64_t timeout) +{ + struct proxy_adv_beacon beac; + + while (k_uptime_get() < timeout) { + + ASSERT_TRUE(wait_for_beacon(proxy_adv_scan_all_cb, 2, NULL, &beac)); + proxy_adv_subnet_find(&beac, nets, net_cnt); + proxy_adv_register_evt(&beac, exp_evt, exp_evt_cnt); + + /** We want to monitor an even distribution of adv events. + * To ensure this, we wait a little less than the minimum + * proxy adv period (1 second) before scanning for the next + * evt. + */ + k_sleep(K_MSEC(990)); + } + + proxy_adv_confirm_evt(exp_evt, exp_evt_cnt); +} + +#define PROXY_ADV_MULTI_CHECKPOINT_1 20000 +#define PROXY_ADV_MULTI_CHECKPOINT_2 50000 +#define PROXY_ADV_MULTI_CHECKPOINT_3 110000 +#define PROXY_ADV_MULTI_CHECKPOINT_4 130000 +#define PROXY_ADV_MULTI_CHECKPOINT_END 150000 + +static void test_tx_proxy_adv_multi_subnet_coex(void) +{ + tx_proxy_adv_common_init(PROXY_ADV_MULTI_SUBNET_COEX_WAIT_TIME, &tx_cfg); + + /* Enable GATT proxy */ + ASSERT_OK_MSG(bt_mesh_gatt_proxy_set(BT_MESH_GATT_PROXY_ENABLED), + "Failed to Enable gatt proxy"); + + k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_1)); + /* Add second and third network */ + ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_2), + "Failed to add second subnet"); + ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX3, test_net_key_3), + "Failed to add third subnet"); + + k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_2)); + /* Start Node Identity on second network */ + bt_mesh_proxy_identity_start(bt_mesh_subnet_get(TEST_NET_IDX2), false); + + k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_3)); + /* Prepare for solicitation */ + ASSERT_OK_MSG(bt_mesh_gatt_proxy_set(BT_MESH_GATT_PROXY_DISABLED), + "Failed to Enable gatt proxy"); + ASSERT_OK_MSG(bt_mesh_od_priv_proxy_set(20), "Failed to set OD priv proxy state"); + + k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_4)); + /* Re-enable GATT proxy and remove second and third network */ + ASSERT_OK_MSG(bt_mesh_gatt_proxy_set(BT_MESH_GATT_PROXY_ENABLED), + "Failed to Enable gatt proxy"); + ASSERT_OK_MSG(bt_mesh_subnet_del(TEST_NET_IDX2), "Failed to delete subnet"); + ASSERT_OK_MSG(bt_mesh_subnet_del(TEST_NET_IDX3), "Failed to delete subnet"); + + PASS(); +} + +static const struct bt_mesh_test_cfg solicit_trigger_cfg = { + .addr = 0x0003, + .dev_key = { 0x03 }, +}; + +static void test_tx_proxy_adv_solicit_trigger(void) +{ + tx_proxy_adv_common_init(PROXY_ADV_MULTI_SUBNET_COEX_WAIT_TIME, &solicit_trigger_cfg); + ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_2), + "Failed to add second subnet"); + + k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_3)); + + /* Solicit first and second network */ + ASSERT_OK_MSG(bt_mesh_proxy_solicit(TEST_NET_IDX1), + "Failed to start solicitation"); + ASSERT_OK_MSG(bt_mesh_proxy_solicit(TEST_NET_IDX2), + "Failed to start solicitation"); + + PASS(); +} + +static void test_rx_proxy_adv_multi_subnet_coex(void) +{ + rx_priv_common_init(PROXY_ADV_MULTI_SUBNET_COEX_WAIT_TIME); + pp_netkey_ctx_init(&pp_net1); + pp_netkey_ctx_init(&pp_net2); + + struct netkey_ctx *nets[] = {&pp_net0, &pp_net1, &pp_net2}; + struct expected_proxy_adv_evt exp_evt[] = { + /** A single subnet is active on the device with GATT Proxy + * enabled. Verify that the single subnet has exclusive + * access to the adv medium. + */ + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 19, + .time = {.after = 0, .before = PROXY_ADV_MULTI_CHECKPOINT_1}}, + + /** Two additional subnets are added to the device. + * Check that the subnets are sharing the adv medium, + * advertising NET_ID beacons. + */ + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 8, + .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_1, + .before = PROXY_ADV_MULTI_CHECKPOINT_2}}, + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 1, .evt_cnt = 8, + .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_1, + .before = PROXY_ADV_MULTI_CHECKPOINT_2}}, + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 8, + .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_1, + .before = PROXY_ADV_MULTI_CHECKPOINT_2}}, + + /** The second subnet enables Node Identity. Check that NODE_ID + * is advertised by this subnet, and that the two others + * continues to advertise NET_ID. + */ + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 17, + .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, + .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, + {.evt_type = BEACON_TYPE_NODE_ID, .net_idx = 1, .evt_cnt = 17, + .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, + .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 17, + .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, + .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, + + /** The first and second subnet gets solicited. Check that + * PRIVATE_NET_ID is advertised by these subnet, + */ + {.evt_type = BEACON_TYPE_PRIVATE_NET_ID, .net_idx = 0, .evt_cnt = 9, + .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_3, + .before = PROXY_ADV_MULTI_CHECKPOINT_4}}, + {.evt_type = BEACON_TYPE_PRIVATE_NET_ID, .net_idx = 1, .evt_cnt = 9, + .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_3, + .before = PROXY_ADV_MULTI_CHECKPOINT_4}}, + + /** Second and third subnet are disabled. Verify that the single + * subnet has exclusive access to the adv medium. + */ + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 19, + .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_4, + .before = PROXY_ADV_MULTI_CHECKPOINT_END}}, + }; + + proxy_adv_scan_all(nets, ARRAY_SIZE(nets), exp_evt, ARRAY_SIZE(exp_evt), + PROXY_ADV_MULTI_CHECKPOINT_END); + PASS(); +} + static void test_rx_priv_multi_net_id(void) { rx_priv_common_init(PP_MULT_NET_ID_WAIT_TIME); @@ -1787,7 +2084,7 @@ static void test_rx_priv_multi_net_id(void) uint16_t itr = 4; static uint8_t old_idx = 0xff; static struct { - struct pp_netkey_ctx *net; + struct netkey_ctx *net; uint16_t recv_cnt; int64_t start; } net_ctx[2] = { @@ -1802,7 +2099,7 @@ static void test_rx_priv_multi_net_id(void) for (size_t i = 0; i < ARRAY_SIZE(net_ctx); i++) { if (beacon.pp_hash == - pp_hash_calc(net_ctx[i].net, beacon.pp_random, NULL)) { + proxy_adv_hash_calc(net_ctx[i].net, beacon.pp_random, NULL, true)) { if (old_idx == 0xff) { /* Received first Net ID advertisment */ old_idx = i; @@ -1931,6 +2228,8 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(tx, priv_node_id, "Private Proxy: advertise Node ID"), TEST_CASE(tx, priv_multi_net_id, "Private Proxy: advertise multiple Net ID"), TEST_CASE(tx, priv_gatt_proxy, "Private Proxy: Send Private Beacons over GATT"), + TEST_CASE(tx, proxy_adv_multi_subnet_coex, "Proxy Adv: Multi subnet coex proxy adv"), + TEST_CASE(tx, proxy_adv_solicit_trigger, "Proxy Adv: Trigger Solicitation"), #endif #endif @@ -1951,6 +2250,7 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(rx, priv_node_id, "Private Proxy: scan for Node ID"), TEST_CASE(rx, priv_multi_net_id, "Private Proxy: scan for multiple Net ID"), TEST_CASE(rx, priv_gatt_proxy, "Private Proxy: Receive Private Beacons over GATT"), + TEST_CASE(rx, proxy_adv_multi_subnet_coex, "Proxy Adv: Multi subnet coex proxy adv"), #endif #endif BSTEST_END_MARKER diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh new file mode 100755 index 00000000000..aa96ee325d8 --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +# Test Proxy advertisement Coex + +# This test verifies correct Proxy advertisement behavior for a device +# where the Proxy adv requirements changes over time, both for single +# and multiple subnets. The TX device is the DUT in this instance, while +# the RX device scans and verifies that the correct proxy adv messages of +# the different subnets is sent within the expected time delta. + +# Note 1: The maximum allowed timeslot for a subnet to advertise proxy +# in this scenario is 10 seconds when there is more than one subnet that +# has active proxy adv work. This is reflected in the scanning criteria +# on the RX device. + +# Note 2: The expected message received count for each event is based on +# what would be a reasonable/acceptable to receive within a given time +# window. The Mesh Protocol specification does not specify exactly the +# timing for Proxy ADV messages. + +# Test procedure: +# 1. (0-20 seconds) A single subnet is active on the TX device with GATT +# Proxy enabled. RX device verifies that the single subnet has exclusive +# access to the adv medium. +# 2. (20-50 seconds) Two additional subnets are added to the TX device. RX +# device checks that the subnets are sharing the adv medium, advertising +# NET_ID beacons. +# 3. (50-110 seconds) The second subnet enables Node Identity. RX device +# checks that NODE_ID is advertised by this subnet, and that the two +# others continues to advertise NET_ID. +# 4. (110-130 seconds) The first and second subnet gets solicited. RX device +# checks that PRIVATE_NET_ID is advertised by these subnets. +# 5. (130-150 seconds) The second and third subnet are disabled on the TX +# device. RX device verifies that the single subnet has exclusive access +# to the adv medium again. + + +conf=prj_mesh1d1_conf +overlay=overlay_gatt_conf +RunTest proxy_adv_multi_subnet_coex \ + beacon_tx_proxy_adv_multi_subnet_coex \ + beacon_rx_proxy_adv_multi_subnet_coex \ + beacon_tx_proxy_adv_solicit_trigger + +conf=prj_mesh1d1_conf +overlay=overlay_gatt_conf_overlay_psa_conf +RunTest proxy_adv_multi_subnet_coex \ + beacon_tx_proxy_adv_multi_subnet_coex \ + beacon_rx_proxy_adv_multi_subnet_coex \ + beacon_tx_proxy_adv_solicit_trigger From e3a41ded255f8465eb59902386785ada04b1401f Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Thu, 11 Jan 2024 14:02:45 +0100 Subject: [PATCH 0103/2300] [nrf fromtree] Bluetooth: Mesh: remove 20ms tx delay in adv bearer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recommendation to have 20ms is fair for two consecutive messages over a single bearer. When mesh sends two messages it can be interpreted as two bearers working in parallel. No need to keep an artificial 20ms delay for that. Delay was removed and all related bsim tests were fixed. Signed-off-by: Aleksandr Khromykh (cherry picked from commit ac4cfe9880f45e871a98e2a62c3b1bd804b3860f) Signed-off-by: Håvard Reierstad (cherry picked from commit f4b0993d4966c82f9a18c6ac7d55dc9960ef5be3) --- subsys/bluetooth/mesh/adv_ext.c | 54 ++++++------------- tests/bsim/bluetooth/mesh/overlay_pst.conf | 2 + .../bluetooth/mesh/src/test_persistence.c | 6 +++ .../bsim/bluetooth/mesh/src/test_provision.c | 10 ++++ 4 files changed, 34 insertions(+), 38 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 856c6c39f1d..8f4f05a34cf 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -63,8 +63,8 @@ struct bt_mesh_ext_adv { ATOMIC_DEFINE(flags, ADV_FLAGS_NUM); struct bt_le_ext_adv *instance; struct bt_mesh_adv *adv; - uint64_t timestamp; - struct k_work_delayable work; + uint32_t timestamp; + struct k_work work; struct bt_le_adv_param adv_param; }; @@ -88,7 +88,7 @@ static struct bt_mesh_ext_adv advs[] = { #endif /* CONFIG_BT_MESH_PB_ADV */ BT_MESH_ADV_TAG_BIT_LOCAL ), - .work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv), + .work = Z_WORK_INITIALIZER(send_pending_adv), }, #if CONFIG_BT_MESH_RELAY_ADV_SETS [1 ... CONFIG_BT_MESH_RELAY_ADV_SETS] = { @@ -100,19 +100,19 @@ static struct bt_mesh_ext_adv advs[] = { BT_MESH_ADV_TAG_BIT_PROV | #endif /* CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS */ 0), - .work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv), + .work = Z_WORK_INITIALIZER(send_pending_adv), }, #endif /* CONFIG_BT_MESH_RELAY_ADV_SETS */ #if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) { .tags = BT_MESH_ADV_TAG_BIT_FRIEND, - .work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv), + .work = Z_WORK_INITIALIZER(send_pending_adv), }, #endif /* CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE */ #if defined(CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE) { .tags = BT_MESH_ADV_TAG_BIT_PROXY, - .work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv), + .work = Z_WORK_INITIALIZER(send_pending_adv), }, #endif /* CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE */ }; @@ -197,7 +197,7 @@ static int adv_start(struct bt_mesh_ext_adv *ext_adv, return err; } - ext_adv->timestamp = k_uptime_get(); + ext_adv->timestamp = k_uptime_get_32(); err = bt_le_ext_adv_start(ext_adv->instance, start); if (err) { @@ -271,18 +271,13 @@ static void send_pending_adv(struct k_work *work) struct bt_mesh_adv *adv; int err; - ext_adv = CONTAINER_OF(work, struct bt_mesh_ext_adv, work.work); + ext_adv = CONTAINER_OF(work, struct bt_mesh_ext_adv, work); if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_SENT)) { - /* Calling k_uptime_delta on a timestamp moves it to the current time. - * This is essential here, as schedule_send() uses the end of the event - * as a reference to avoid sending the next advertisement too soon. - */ - int64_t duration = k_uptime_delta(&ext_adv->timestamp); - - LOG_DBG("Advertising stopped after %u ms for %s", (uint32_t)duration, - ext_adv->adv ? adv_tag_to_str[ext_adv->adv->ctx.tag] : - adv_tag_to_str[BT_MESH_ADV_TAG_PROXY]); + LOG_DBG("Advertising stopped after %u ms for %s", + k_uptime_get_32() - ext_adv->timestamp, + ext_adv->adv ? adv_tag_to_str[ext_adv->adv->ctx.tag] + : adv_tag_to_str[BT_MESH_ADV_TAG_PROXY]); atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY); @@ -340,11 +335,6 @@ static void send_pending_adv(struct k_work *work) static bool schedule_send(struct bt_mesh_ext_adv *ext_adv) { - uint64_t timestamp; - int64_t delta; - - timestamp = ext_adv->timestamp; - if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_PROXY)) { atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); (void)bt_le_ext_adv_stop(ext_adv->instance); @@ -360,19 +350,7 @@ static bool schedule_send(struct bt_mesh_ext_adv *ext_adv) } atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); - - if ((IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && - ext_adv->tags & BT_MESH_ADV_TAG_BIT_FRIEND) || - (CONFIG_BT_MESH_RELAY_ADV_SETS > 0 && ext_adv->tags & BT_MESH_ADV_TAG_BIT_RELAY)) { - k_work_reschedule(&ext_adv->work, K_NO_WAIT); - } else { - /* The controller will send the next advertisement immediately. - * Introduce a delay here to avoid sending the next mesh packet closer - * to the previous packet than what's permitted by the specification. - */ - delta = k_uptime_delta(×tamp); - k_work_reschedule(&ext_adv->work, K_MSEC(ADV_INT_FAST_MS - delta)); - } + k_work_submit(&ext_adv->work); return true; } @@ -438,7 +416,7 @@ void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) atomic_set_bit(ext_adv->flags, ADV_FLAG_SENT); - k_work_submit(&ext_adv->work.work); + k_work_submit(&ext_adv->work); return; } @@ -487,7 +465,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.work); + k_work_submit(&ext_adv->work); } #if defined(CONFIG_BT_MESH_GATT_SERVER) @@ -543,7 +521,7 @@ int bt_mesh_adv_disable(void) struct k_work_sync sync; for (int i = 0; i < ARRAY_SIZE(advs); i++) { - k_work_flush_delayable(&advs[i].work, &sync); + k_work_flush(&advs[i].work, &sync); err = bt_le_ext_adv_stop(advs[i].instance); if (err) { diff --git a/tests/bsim/bluetooth/mesh/overlay_pst.conf b/tests/bsim/bluetooth/mesh/overlay_pst.conf index 6a56ec8065b..6730b9ee233 100644 --- a/tests/bsim/bluetooth/mesh/overlay_pst.conf +++ b/tests/bsim/bluetooth/mesh/overlay_pst.conf @@ -19,4 +19,6 @@ CONFIG_BT_MESH_SEQ_STORE_RATE=1 CONFIG_BT_MESH_RPL_STORE_TIMEOUT=1 CONFIG_BT_MESH_STORE_TIMEOUT=1 CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT=1 +CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST=200 +CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT=400 CONFIG_BT_MESH_COMP_PST_BUF_SIZE=600 diff --git a/tests/bsim/bluetooth/mesh/src/test_persistence.c b/tests/bsim/bluetooth/mesh/src/test_persistence.c index 4bf1f9faa93..ec7d838d26a 100644 --- a/tests/bsim/bluetooth/mesh/src/test_persistence.c +++ b/tests/bsim/bluetooth/mesh/src/test_persistence.c @@ -455,6 +455,12 @@ static void provisioner_setup(void) FAIL("Failed to add test_netkey (err: %d, status: %d)", err, status); } + err = bt_mesh_cfg_cli_net_transmit_set(test_netkey_idx, TEST_PROV_ADDR, + BT_MESH_TRANSMIT(3, 50), &status); + if (err || status != BT_MESH_TRANSMIT(3, 50)) { + FAIL("Net transmit set failed (err %d, transmit %x)", err, status); + } + provisioner_ready = true; } diff --git a/tests/bsim/bluetooth/mesh/src/test_provision.c b/tests/bsim/bluetooth/mesh/src/test_provision.c index 3d0e8010c75..2bff871b187 100644 --- a/tests/bsim/bluetooth/mesh/src/test_provision.c +++ b/tests/bsim/bluetooth/mesh/src/test_provision.c @@ -1205,6 +1205,7 @@ static void test_provisioner_pb_remote_client_nppi_robustness(void) uint16_t pb_remote_server_addr; uint8_t status; struct bt_mesh_cdb_node *node; + int err; provisioner_pb_remote_client_setup(); @@ -1218,6 +1219,15 @@ static void test_provisioner_pb_remote_client_nppi_robustness(void) .ttl = 3, }; + /* Set Network Transmit Count state on the remote client greater than on the remote server + * to increase probability of reception responses. + */ + err = bt_mesh_cfg_cli_net_transmit_set(0, current_dev_addr, BT_MESH_TRANSMIT(3, 50), + &status); + if (err || status != BT_MESH_TRANSMIT(3, 50)) { + FAIL("Net transmit set failed (err %d, transmit %x)", err, status); + } + ASSERT_OK(provision_remote(&srv, 2, &srv.addr)); /* Check device key by adding appkey. */ From e01bbbc63b82af02fe793bcb86b2a106bf49b622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Thu, 11 Jan 2024 14:02:45 +0100 Subject: [PATCH 0104/2300] [nrf fromtree] Bluetooth: Mesh: fix proxy srv return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, `bt_mesh_proxy_gatt_enable` returned the return value from `k_work_schedule`, which could be a positive (non-error) message. Now, it only returns negative error codes (else 0). Signed-off-by: Håvard Reierstad (cherry picked from commit 9285ea3238e468e1294e92bcad56a2b9b34d0d63) Signed-off-by: Håvard Reierstad (cherry picked from commit 609321cdd817d0e6201a0ed19b8a17011b567ced) --- subsys/bluetooth/mesh/proxy_srv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index 25a44abfded..a903d94ffa9 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -975,6 +975,8 @@ static void svc_reg_work_handler(struct k_work *work) int bt_mesh_proxy_gatt_enable(void) { + int err; + LOG_DBG(""); if (!bt_mesh_is_provisioned()) { @@ -986,7 +988,13 @@ int bt_mesh_proxy_gatt_enable(void) } svc_reg_attempts = PROXY_SVC_REG_ATTEMPTS; - return k_work_schedule(&svc_reg_work, PROXY_SVC_INIT_TIMEOUT); + err = k_work_schedule(&svc_reg_work, PROXY_SVC_INIT_TIMEOUT); + if (err < 0) { + LOG_ERR("Enabling GATT proxy failed (err %d)", err); + return err; + } + + return 0; } void bt_mesh_proxy_gatt_disconnect(void) From d9e6ed4b1d08dbee5c4957d78db3df9a26290986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Thu, 11 Jan 2024 14:02:45 +0100 Subject: [PATCH 0105/2300] [nrf fromtree] Bluetooth: Mesh: suspend/resume gatt advs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disables pb gatt- and gatt proxy advs when suspending Mesh, and enables them again when resuming Mesh. Adds `bt_mesh_adv_gatt_send` to `bt_mesh_resume` to make sure that GATT advs start after resumption. Signed-off-by: Håvard Reierstad (cherry picked from commit 6c5fc658efc713b04b6c495be3170c46bf4ef832) Signed-off-by: Håvard Reierstad (cherry picked from commit 9aa5cc1391f01d02c72e2d44cc636e5edd7899d6) --- subsys/bluetooth/mesh/main.c | 40 +++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 2689a3355c1..1b80233cec1 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -462,6 +462,22 @@ int bt_mesh_suspend(void) bt_mesh_access_suspend(); + if (IS_ENABLED(CONFIG_BT_MESH_PB_GATT)) { + err = bt_mesh_pb_gatt_srv_disable(); + if (err && err != -EALREADY) { + LOG_WRN("Disabling PB-GATT failed (err %d)", err); + return err; + } + } + + if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) { + err = bt_mesh_proxy_gatt_disable(); + if (err && err != -EALREADY) { + LOG_WRN("Disabling GATT proxy failed (err %d)", err); + return err; + } + } + err = bt_mesh_adv_disable(); if (err) { atomic_clear_bit(bt_mesh.flags, BT_MESH_SUSPENDED); @@ -508,6 +524,22 @@ int bt_mesh_resume(void) return err; } + if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY) && bt_mesh_is_provisioned()) { + err = bt_mesh_proxy_gatt_enable(); + if (err) { + LOG_WRN("Re-enabling GATT proxy failed (err %d)", err); + return err; + } + } + + if (IS_ENABLED(CONFIG_BT_MESH_PB_GATT) && !bt_mesh_is_provisioned()) { + err = bt_mesh_pb_gatt_srv_enable(); + if (err) { + LOG_WRN("Re-enabling PB-GATT failed (err %d)", err); + return err; + } + } + err = bt_mesh_scan_enable(); if (err) { LOG_WRN("Re-enabling scanning failed (err %d)", err); @@ -524,7 +556,13 @@ int bt_mesh_resume(void) bt_mesh_model_foreach(model_resume, NULL); - return err; + err = bt_mesh_adv_gatt_send(); + if (err && (err != -ENOTSUP)) { + LOG_WRN("GATT send failed (err %d)", err); + return err; + } + + return 0; } int bt_mesh_init(const struct bt_mesh_prov *prov, From 798bf40bea1c0f7cfc0a6570c0b354bd927bb413 Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Mon, 15 Jan 2024 11:35:28 +0100 Subject: [PATCH 0106/2300] [nrf fromtree] dts: nrf5340: add missing `easydma-maxcnt-bits` for nrf5340_cpunet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The required property `easydma-maxcnt-bits` was missing for nrf5340_cpunet. Signed-off-by: Andrzej Kuroś (cherry picked from commit 728f0ec7bed5f8f210b88132bfa2fc0c4f28204c) (cherry picked from commit f6e704ceefa7330d061eb9a5579e670d26524708) --- dts/arm/nordic/nrf5340_cpunet.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index 63c7e920f81..c1e8371d410 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -192,6 +192,7 @@ reg = <0x41013000 0x1000>; clock-frequency = ; interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; status = "disabled"; }; From a2cd875ded9dfbca45b4b1af7ac4ae0e48ebd3d2 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Mon, 8 Jan 2024 16:57:32 +0530 Subject: [PATCH 0107/2300] [nrf fromtree] net: mgmt: Provide Regulatory channel info Updated to provide regulatory channel information along with country code. Signed-off-by: Ajay Parida (cherry picked from commit 56de0a347e6965b0c5612cfd31725d75535532b4) (cherry picked from commit 65d32263c87639e9c199b31f6d770ab579796072) --- include/zephyr/net/wifi_mgmt.h | 20 ++++++++++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 19 +++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 78800f451e7..f6ae631a830 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -546,6 +546,22 @@ enum wifi_mgmt_op { WIFI_MGMT_SET = 1, }; +#define MAX_REG_CHAN_NUM 42 + +/** Per-channel regulatory attributes */ +struct wifi_reg_chan_info { + /** Center frequency in MHz */ + unsigned short center_frequency; + /** Maximum transmission power (in dBm) */ + unsigned short max_power:8; + /** Is channel supported or not */ + unsigned short supported:1; + /** Passive transmissions only */ + unsigned short passive_only:1; + /** Is a DFS channel */ + unsigned short dfs:1; +} __packed; + /** Regulatory domain information or configuration */ struct wifi_reg_domain { /* Regulatory domain operation */ @@ -554,6 +570,10 @@ struct wifi_reg_domain { bool force; /** Country code: ISO/IEC 3166-1 alpha-2 */ uint8_t country_code[WIFI_COUNTRY_CODE_LEN]; + /** Number of channels supported */ + unsigned int num_channels; + /** Channels information */ + struct wifi_reg_chan_info *chan_info; }; /** Wi-Fi TWT sleep states */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1ee94304781..e1446cceca0 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -64,6 +64,7 @@ static struct { static uint32_t scan_result; static struct net_mgmt_event_callback wifi_shell_mgmt_cb; +static struct wifi_reg_chan_info chan_info[MAX_REG_CHAN_NUM]; static K_MUTEX_DEFINE(wifi_ap_sta_list_lock); struct wifi_ap_sta_node { @@ -134,7 +135,6 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) wifi_mfp_txt(entry->mfp)); } -#ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS static int wifi_freq_to_channel(int frequency) { int channel = 0; @@ -156,6 +156,7 @@ static int wifi_freq_to_channel(int frequency) return channel; } +#ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS static enum wifi_frequency_bands wifi_freq_to_band(int frequency) { enum wifi_frequency_bands band = WIFI_FREQ_BAND_2_4_GHZ; @@ -1289,9 +1290,10 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, { struct net_if *iface = net_if_get_first_wifi(); struct wifi_reg_domain regd = {0}; - int ret; + int ret, chan_idx = 0; if (argc == 1) { + (®d)->chan_info = &chan_info[0]; regd.oper = WIFI_MGMT_GET; } else if (argc >= 2 && argc <= 3) { regd.oper = WIFI_MGMT_SET; @@ -1336,6 +1338,19 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, if (regd.oper == WIFI_MGMT_GET) { shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Regulatory domain is: %c%c\n", regd.country_code[0], regd.country_code[1]); + shell_fprintf(sh, SHELL_NORMAL, + "\t
\t\t" + "\t\t\n"); + for (chan_idx = 0; chan_idx < regd.num_channels; chan_idx++) { + shell_fprintf(sh, SHELL_NORMAL, + " %d\t\t\t\%d\t\t\t\%s\t\t\t%d\t\t\t%s\t\t\t\t%s\n", + wifi_freq_to_channel(chan_info[chan_idx].center_frequency), + chan_info[chan_idx].center_frequency, + chan_info[chan_idx].supported ? "y" : "n", + chan_info[chan_idx].max_power, + chan_info[chan_idx].passive_only ? "y" : "n", + chan_info[chan_idx].dfs ? "y" : "n"); + } } else { shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Regulatory domain set to: %c%c\n", regd.country_code[0], regd.country_code[1]); From 500fb9bedb7a21a6142a35dc81533bf148acb643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Wed, 3 Jan 2024 08:46:08 +0100 Subject: [PATCH 0108/2300] [nrf fromtree] manifest: update hal_nordic revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates revision of hal_nordic to bring the latest changes in the nRF IEEE 802.15.4 driver. Signed-off-by: Jędrzej Ciupis (cherry picked from commit 1bbaaeffb0c24b4252ffd6f72e2c6781bb1ef853) (cherry picked from commit 5ff2ec1ac15ad91cd16229a698b3b3ecbc2aa468) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c99118074eb..a141e94edd6 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: b9633ecea67bf52925d4c61455046223b46402b1 + revision: 3786c55424d4d64c62dd25219de31618cef26fdf path: modules/hal/nordic groups: - hal From 9aca277f295eb85e37a57902d37c30984fefba6e Mon Sep 17 00:00:00 2001 From: Eduardo Montoya Date: Tue, 31 Oct 2023 09:42:36 +0100 Subject: [PATCH 0109/2300] [nrf fromtree] drivers: ieee802154: nrf: make selective tx power the default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove `IEEE802154_SELECTIVE_TXPOWER` option. Cache the tx power value in nRF5 driver and make use of it on each operation. Signed-off-by: Eduardo Montoya Signed-off-by: Jędrzej Ciupis (cherry picked from commit 5767998d4f7f9ef89a6983e4c540215676051e7a) (cherry picked from commit c2f6fa7a7b1b6ec8d7b3901f8cf008328b773ae0) --- doc/releases/release-notes-3.6.rst | 2 ++ drivers/ieee802154/Kconfig | 5 ----- drivers/ieee802154/ieee802154_nrf5.c | 24 +++++++++++------------- drivers/ieee802154/ieee802154_nrf5.h | 3 +++ include/zephyr/net/ieee802154_pkt.h | 18 ------------------ modules/openthread/platform/radio.c | 7 +------ 6 files changed, 17 insertions(+), 42 deletions(-) diff --git a/doc/releases/release-notes-3.6.rst b/doc/releases/release-notes-3.6.rst index 8edd3280382..a253434a085 100644 --- a/doc/releases/release-notes-3.6.rst +++ b/doc/releases/release-notes-3.6.rst @@ -154,6 +154,8 @@ Drivers and Sensors * IEEE 802.15.4 + * Removed :kconfig:option:`CONFIG_IEEE802154_SELECTIVE_TXPOWER` Kconfig option. + * Interrupt Controller * Input diff --git a/drivers/ieee802154/Kconfig b/drivers/ieee802154/Kconfig index feccd4a6001..d692024b096 100644 --- a/drivers/ieee802154/Kconfig +++ b/drivers/ieee802154/Kconfig @@ -98,11 +98,6 @@ config IEEE802154_CSL_DEBUG help Enable support for CSL debugging by avoiding sleep state in favor of receive state. -config IEEE802154_SELECTIVE_TXPOWER - bool "Support selective TX power setting" - help - Enable support for selectively setting TX power for every transmission request. - module = IEEE802154_DRIVER module-str = IEEE 802.15.4 driver module-help = Sets log level for IEEE 802.15.4 Device Drivers. diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index df01f530abf..8401cac961a 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -375,7 +375,7 @@ static int nrf5_set_txpower(const struct device *dev, int16_t dbm) LOG_DBG("%d", dbm); - nrf_802154_tx_power_set(dbm); + nrf5_data.txpwr = dbm; return 0; } @@ -454,10 +454,8 @@ static bool nrf5_tx_immediate(struct net_pkt *pkt, uint8_t *payload, bool cca) }, .cca = cca, .tx_power = { - .use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER), -#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) - .power = net_pkt_ieee802154_txpwr(pkt), -#endif + .use_metadata_value = true, + .power = nrf5_data.txpwr, }, }; @@ -473,10 +471,8 @@ static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload) .dynamic_data_is_set = net_pkt_ieee802154_mac_hdr_rdy(pkt), }, .tx_power = { - .use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER), -#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) - .power = net_pkt_ieee802154_txpwr(pkt), -#endif + .use_metadata_value = true, + .power = nrf5_data.txpwr, }, }; @@ -519,10 +515,8 @@ static bool nrf5_tx_at(struct nrf5_802154_data *nrf5_radio, struct net_pkt *pkt, .cca = cca, .channel = nrf_802154_channel_get(), .tx_power = { - .use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER), -#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) - .power = net_pkt_ieee802154_txpwr(pkt), -#endif + .use_metadata_value = true, + .power = nrf5_data.txpwr, }, #if defined(CONFIG_IEEE802154_NRF5_MULTIPLE_CCA) .extra_cca_attempts = max_extra_cca_attempts, @@ -660,6 +654,8 @@ static int nrf5_start(const struct device *dev) { ARG_UNUSED(dev); + nrf_802154_tx_power_set(nrf5_data.txpwr); + if (!nrf_802154_receive()) { LOG_ERR("Failed to enter receive state"); return -EIO; @@ -702,6 +698,8 @@ static int nrf5_continuous_carrier(const struct device *dev) { ARG_UNUSED(dev); + nrf_802154_tx_power_set(nrf5_data.txpwr); + if (!nrf_802154_continuous_carrier()) { LOG_ERR("Failed to enter continuous carrier state"); return -EIO; diff --git a/drivers/ieee802154/ieee802154_nrf5.h b/drivers/ieee802154/ieee802154_nrf5.h index 9115fe0bdae..79b47827d72 100644 --- a/drivers/ieee802154/ieee802154_nrf5.h +++ b/drivers/ieee802154/ieee802154_nrf5.h @@ -97,6 +97,9 @@ struct nrf5_802154_data { uint8_t max_extra_cca_attempts; #endif + /* The TX power in dBm. */ + int8_t txpwr; + #if defined(CONFIG_NRF_802154_SER_HOST) && defined(CONFIG_IEEE802154_CSL_ENDPOINT) /* The last configured value of CSL period in units of 10 symbols. */ uint32_t csl_period; diff --git a/include/zephyr/net/ieee802154_pkt.h b/include/zephyr/net/ieee802154_pkt.h index d5fdc712b49..3270f994248 100644 --- a/include/zephyr/net/ieee802154_pkt.h +++ b/include/zephyr/net/ieee802154_pkt.h @@ -59,12 +59,6 @@ struct net_pkt_cb_ieee802154 { */ uint8_t rssi; }; -#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) - /* TX packets */ - struct { - int8_t txpwr; /* TX power in dBm. */ - }; -#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */ }; /* Flags */ @@ -185,18 +179,6 @@ static inline void net_pkt_set_ieee802154_rssi_dbm(struct net_pkt *pkt, int16_t CODE_UNREACHABLE; } -#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) -static inline int8_t net_pkt_ieee802154_txpwr(struct net_pkt *pkt) -{ - return net_pkt_cb_ieee802154(pkt)->txpwr; -} - -static inline void net_pkt_set_ieee802154_txpwr(struct net_pkt *pkt, int8_t txpwr) -{ - net_pkt_cb_ieee802154(pkt)->txpwr = txpwr; -} -#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */ - static inline bool net_pkt_ieee802154_ack_fpb(struct net_pkt *pkt) { return net_pkt_cb_ieee802154(pkt)->ack_fpb; diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index a09b7dd3b67..cec73e3ef6f 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -380,13 +380,8 @@ void transmit_message(struct k_work *tx_job) channel = sTransmitFrame.mChannel; - radio_api->set_channel(radio_dev, sTransmitFrame.mChannel); - -#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) - net_pkt_set_ieee802154_txpwr(tx_pkt, get_transmit_power_for_channel(channel)); -#else + radio_api->set_channel(radio_dev, channel); radio_api->set_txpower(radio_dev, get_transmit_power_for_channel(channel)); -#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */ net_pkt_set_ieee802154_frame_secured(tx_pkt, sTransmitFrame.mInfo.mTxInfo.mIsSecurityProcessed); From 5bbaec17bc6636bb0dca266ba92a2d6a621876d4 Mon Sep 17 00:00:00 2001 From: Eduardo Montoya Date: Tue, 31 Oct 2023 10:23:51 +0100 Subject: [PATCH 0110/2300] [nrf fromtree] drivers: ieee802154: nrf5: add `IEEE802154_RX_ON_WHEN_IDLE` capability Add `IEEE802154_RX_ON_WHEN_IDLE` capability. Signed-off-by: Eduardo Montoya (cherry picked from commit 586eca8ad27951727440c61e7fcaf4e67eb4502c) (cherry picked from commit 440b2b6a935365f1a0a4790d69ee1dc40b59306b) --- drivers/ieee802154/ieee802154_nrf5.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 8401cac961a..a116c20f118 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -236,6 +236,7 @@ static void nrf5_get_capabilities_at_boot(void) ((caps & NRF_802154_CAPABILITY_DELAYED_TX) ? IEEE802154_HW_TXTIME : 0UL) | ((caps & NRF_802154_CAPABILITY_DELAYED_RX) ? IEEE802154_HW_RXTIME : 0UL) | IEEE802154_HW_SLEEP_TO_TX | + IEEE802154_RX_ON_WHEN_IDLE | ((caps & NRF_802154_CAPABILITY_SECURITY) ? IEEE802154_HW_TX_SEC : 0UL) #if defined(CONFIG_IEEE802154_NRF5_MULTIPLE_CCA) | IEEE802154_OPENTHREAD_HW_MULTIPLE_CCA @@ -973,6 +974,10 @@ static int nrf5_configure(const struct device *dev, break; #endif /* CONFIG_IEEE802154_NRF5_MULTIPLE_CCA */ + case IEEE802154_CONFIG_RX_ON_WHEN_IDLE: + nrf_802154_rx_on_when_idle_set(config->rx_on_when_idle); + break; + default: return -EINVAL; } @@ -1050,20 +1055,8 @@ void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id) const struct device *dev = nrf5_get_device(); #if defined(CONFIG_IEEE802154_CSL_ENDPOINT) - if (id == DRX_SLOT_RX) { - __ASSERT_NO_MSG(nrf5_data.event_handler); -#if !defined(CONFIG_IEEE802154_CSL_DEBUG) - /* When CSL debug option is used we intentionally avoid notifying the higher layer - * about the finalization of a DRX slot, so that the radio stays in receive state - * for receiving "out of slot" frames. - * As a side effect, regular failure notifications would be reported with the - * incorrect ID. - */ - nrf5_data.event_handler(dev, IEEE802154_EVENT_RX_OFF, NULL); -#endif - if (error == NRF_802154_RX_ERROR_DELAYED_TIMEOUT) { - return; - } + if (id == DRX_SLOT_RX && error == NRF_802154_RX_ERROR_DELAYED_TIMEOUT) { + return; } #else ARG_UNUSED(id); From 230c66aea40330402bb285c6558c1911047676de Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Fri, 12 Jan 2024 17:21:22 +0100 Subject: [PATCH 0111/2300] [nrf fromtree] net: sockets: prevent null pointer dereference According to the POSIX specification, null pointer is a valid value for the `address` argument of the `accept` function. This commit adds a check to prevent a null pointer dereference inside `z_impl_zsock_accept`. Signed-off-by: Mirko Covizzi (cherry picked from commit f3b2c04661370ac595faf32d2cafb43506704671) (cherry picked from commit c2784307ce7f6016105eddf47f786b913ec1cfb3) --- subsys/net/lib/sockets/sockets.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index d35317352c9..060c7fff8f7 100644 --- a/subsys/net/lib/sockets/sockets.c +++ b/subsys/net/lib/sockets/sockets.c @@ -681,7 +681,9 @@ int z_impl_zsock_accept(int sock, struct sockaddr *addr, socklen_t *addrlen) new_sock = VTABLE_CALL(accept, sock, addr, addrlen); - (void)sock_obj_core_alloc_find(sock, new_sock, addr->sa_family, SOCK_STREAM); + if (addr) { + (void)sock_obj_core_alloc_find(sock, new_sock, addr->sa_family, SOCK_STREAM); + } return new_sock; } From 5f6e44a5b303afc22a6f1fe3781687202f570557 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 13 Nov 2023 13:33:58 +0200 Subject: [PATCH 0112/2300] [nrf fromtree] test: lwm2m: Mark some tests as slow This allows quick filtering with pytest_args: ['-k not slow'] Signed-off-by: Seppo Takalo (cherry picked from commit eb127538b10e792179d60ca7124e9f41571e487c) (cherry picked from commit 195291f95f6ba354b0d8e33cd370c27f3991dd19) --- tests/net/lib/lwm2m/interop/pytest/pytest.ini | 3 +++ tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/net/lib/lwm2m/interop/pytest/pytest.ini diff --git a/tests/net/lib/lwm2m/interop/pytest/pytest.ini b/tests/net/lib/lwm2m/interop/pytest/pytest.ini new file mode 100644 index 00000000000..761785364d8 --- /dev/null +++ b/tests/net/lib/lwm2m/interop/pytest/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +markers = + slow: marks tests as slow (deselect with '-m "not slow"') diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index 8f3acd69c7e..c37a3900aa6 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -51,6 +51,7 @@ def test_LightweightM2M_1_1_int_104(shell: Shell, dut: DeviceAdapter, leshan: Le leshan.execute(endpoint, '1/0/8') dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0) +@pytest.mark.slow def test_LightweightM2M_1_1_int_107(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-107 - Extending the lifetime of a registration""" leshan.write(endpoint, '1/0/1', 120) @@ -66,6 +67,7 @@ def test_LightweightM2M_1_1_int_108(leshan, endpoint): """LightweightM2M-1.1-int-108 - Turn on Queue Mode""" assert leshan.get(f'/clients/{endpoint}')["queuemode"] +@pytest.mark.slow def test_LightweightM2M_1_1_int_109(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-109 - Behavior in Queue Mode""" logger.debug('Wait for Queue RX OFF') @@ -500,6 +502,7 @@ def test_LightweightM2M_1_1_int_281(shell: Shell, leshan: Leshan, endpoint: str) # Information Reporting Interface [300-399] # +@pytest.mark.slow def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-301 - Observation and Notification of parameter values""" pwr_src = leshan.read(endpoint, '3/0/6') @@ -527,6 +530,7 @@ def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str) assert (start + 15) <= time.time() + 1 # Allow 1 second slack. (pMinx + pMax=15) leshan.cancel_observe(endpoint, '3/0/7') +@pytest.mark.slow def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-302 - Cancel Observations using Reset Operation""" leshan.observe(endpoint, '3/0/7') @@ -546,6 +550,7 @@ def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Le shell.exec_command('lwm2m write /3/0/8/0 -u32 50') dut.readlines_until(regex=r'.*Observer removed for 3/0/8') +@pytest.mark.slow def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-304 - Observe-Composite Operation""" assert leshan.put_raw(f'/clients/{endpoint}/1/0/1/attributes?pmin=30')['status'] == 'CHANGED(204)' @@ -590,6 +595,8 @@ def test_LightweightM2M_1_1_int_307(shell: Shell, dut: DeviceAdapter, leshan: Le shell.exec_command('lwm2m send /3/0') dut.readlines_until(regex=r'.*SEND status: 0', timeout=5.0) + +@pytest.mark.slow def test_LightweightM2M_1_1_int_308(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-308 - Observe-Composite and Creating Object Instance""" shell.exec_command('lwm2m delete /16/0') @@ -631,6 +638,7 @@ def test_LightweightM2M_1_1_int_308(shell: Shell, dut: DeviceAdapter, leshan: Le shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') +@pytest.mark.slow def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-309 - Observe-Composite and Deleting Object Instance""" shell.exec_command('lwm2m delete /16/0') @@ -673,6 +681,7 @@ def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Le shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') +@pytest.mark.slow def test_LightweightM2M_1_1_int_310(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-310 - Observe-Composite and modification of parameter values""" # Need to use Configuration C.1 From 9e42510c28dbd156863c2a0eb59bc36f28dbd582 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 13 Nov 2023 16:02:07 +0200 Subject: [PATCH 0113/2300] [nrf fromtree] test: lwm2m: Implement write_attributes() Implement write and remove attributes command for Leshan. Remove all written attributes at the end of test, so it won't affect the next test case. Remove skip marks from testcase that is fixed on Leshan side. Signed-off-by: Seppo Takalo (cherry picked from commit 92ceaab491a0a579a585b55c85d66673bceb7ea6) (cherry picked from commit 1f4da8e3d3d31db845cf7df983e031b5211fa7aa) --- tests/net/lib/lwm2m/interop/README.md | 2 +- tests/net/lib/lwm2m/interop/pytest/leshan.py | 19 ++++++- .../lib/lwm2m/interop/pytest/test_lwm2m.py | 56 ++++++++++--------- 3 files changed, 48 insertions(+), 29 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index bda38924d26..3654ca94b01 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -167,7 +167,7 @@ Tests are written from test spec; |LightweightM2M-1.1-int-256 - Write Operation Failure|:white_check_mark:| | |LightweightM2M-1.1-int-257 - Write-Composite Operation|:white_check_mark:| | |LightweightM2M-1.1-int-260 - Discover Command|:white_check_mark:| | -|LightweightM2M-1.1-int-261 - Write-Attribute Operation on a multiple resource|:large_orange_diamond:|Leshan don't allow writing attributes to resource instance| +|LightweightM2M-1.1-int-261 - Write-Attribute Operation on a multiple resource|:white_check_mark:| | |LightweightM2M-1.1-int-280 - Successful Read-Composite Operation|:white_check_mark:| | |LightweightM2M-1.1-int-281 - Partially Successful Read-Composite Operation|:white_check_mark:| | |LightweightM2M-1.1-int-301 - Observation and Notification of parameter values|:white_check_mark:| | diff --git a/tests/net/lib/lwm2m/interop/pytest/leshan.py b/tests/net/lib/lwm2m/interop/pytest/leshan.py index 7240aae2baf..4add988ea77 100644 --- a/tests/net/lib/lwm2m/interop/pytest/leshan.py +++ b/tests/net/lib/lwm2m/interop/pytest/leshan.py @@ -62,9 +62,9 @@ def get(self, path: str): resp = self._s.get(f'{self.api_url}{path}', params=params, timeout=self.timeout) return Leshan.handle_response(resp) - def put_raw(self, path: str, data: str | dict | None = None, headers: dict | None = None): + def put_raw(self, path: str, data: str | dict | None = None, headers: dict | None = None, params: dict | None = None): """Send HTTP PUT query without any default parameters""" - resp = self._s.put(f'{self.api_url}{path}', data=data, headers=headers, timeout=self.timeout) + resp = self._s.put(f'{self.api_url}{path}', data=data, headers=headers, params=params, timeout=self.timeout) return Leshan.handle_response(resp) def put(self, path: str, data: str | dict, uri_options: str = ''): @@ -108,6 +108,21 @@ def write(self, endpoint: str, path: str, value: bool | int | str): rid = path.split('/')[-1] return self.put(f'/clients/{endpoint}/{path}', self._define_resource(rid, value, kind)) + def write_attributes(self, endpoint: str, path: str, attributes: dict): + """Send LwM2M Write-Attributes to given path + example: + leshan.write_attributes(endpoint, '1/2/3, {'pmin': 10, 'pmax': 40}) + """ + return self.put_raw(f'/clients/{endpoint}/{path}/attributes', params=attributes) + + def remove_attributes(self, endpoint: str, path: str, attributes: list): + """Send LwM2M Write-Attributes to given path + example: + leshan.remove_attributes(endpoint, '1/2/3, ['pmin', 'pmax']) + """ + attrs = '&'.join(attributes) + return self.put_raw(f'/clients/{endpoint}/{path}/attributes?'+ attrs) + def update_obj_instance(self, endpoint: str, path: str, resources: dict): """Update object instance""" data = self._define_obj_inst(path, resources) diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index c37a3900aa6..f596f74d30a 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -202,7 +202,7 @@ def test_LightweightM2M_1_1_int_221(shell: Shell, leshan: Leshan, endpoint: str) """LightweightM2M-1.1-int-221 - Attempt to perform operations on Security""" assert leshan.read(endpoint, '0/0')['status'] == 'UNAUTHORIZED(401)' assert leshan.write(endpoint, '0/0/0', 'coap://localhost')['status'] == 'UNAUTHORIZED(401)' - assert leshan.put_raw(f'/clients/{endpoint}/0/attributes?pmin=10')['status'] == 'UNAUTHORIZED(401)' + assert leshan.write_attributes(endpoint, '0', {'pmin':10})['status'] == 'UNAUTHORIZED(401)' def test_LightweightM2M_1_1_int_222(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-222 - Read on Object""" @@ -429,15 +429,12 @@ def test_LightweightM2M_1_1_int_260(shell: Shell, leshan: Leshan, endpoint: str) expected_keys = ['/3', '/3/0', '/3/0/1', '/3/0/2', '/3/0/3', '/3/0/4', '/3/0/6', '/3/0/7', '/3/0/8', '/3/0/9', '/3/0/11', '/3/0/16'] missing_keys = [key for key in expected_keys if key not in resp.keys()] assert len(missing_keys) == 0 - assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmin=10')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmax=200')['status'] == 'CHANGED(204)' + assert leshan.write_attributes(endpoint, '3', {'pmin': 10, 'pmax': 200})['status'] == 'CHANGED(204)' resp = leshan.discover(endpoint, '3/0') assert int(resp['/3/0/6']['dim']) == 2 assert int(resp['/3/0/7']['dim']) == 2 assert int(resp['/3/0/8']['dim']) == 2 - assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?lt=1')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?gt=6')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?st=1')['status'] == 'CHANGED(204)' + assert leshan.write_attributes(endpoint, '3/0/7', {'lt': 1, 'gt': 6, 'st': 1})['status'] == 'CHANGED(204)' resp = leshan.discover(endpoint, '3/0') expected_keys = ['/3/0', '/3/0/1', '/3/0/2', '/3/0/3', '/3/0/4', '/3/0/6', '/3/0/7', '/3/0/8', '/3/0/9', '/3/0/11', '/3/0/16'] missing_keys = [key for key in expected_keys if key not in resp.keys()] @@ -451,8 +448,9 @@ def test_LightweightM2M_1_1_int_260(shell: Shell, leshan: Leshan, endpoint: str) missing_keys = [key for key in expected_keys if key not in resp.keys()] assert len(missing_keys) == 0 assert len(resp) == len(expected_keys) + # restore + leshan.remove_attributes(endpoint, '3', ['pmin', 'pmax']) -@pytest.mark.skip(reason="Leshan don't allow writing attributes to resource instance") def test_LightweightM2M_1_1_int_261(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-261 - Write-Attribute Operation on a multiple resource""" resp = leshan.discover(endpoint, '3/0/11') @@ -462,19 +460,20 @@ def test_LightweightM2M_1_1_int_261(shell: Shell, leshan: Leshan, endpoint: str) assert len(missing_keys) == 0 assert len(resp) == len(expected_keys) assert int(resp['/3/0/11']['dim']) == 1 - assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmin=10')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmax=200')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/3/0/attributes?pmax=320')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/3/0/11/0/attributes?pmax=100')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/3/0/11/0/attributes?epmin=1')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/3/0/11/0/attributes?epmax=20')['status'] == 'CHANGED(204)' + assert leshan.write_attributes(endpoint, '3', {'pmin':10, 'pmax':200})['status'] == 'CHANGED(204)' + assert leshan.write_attributes(endpoint, '3/0', {'pmax':320})['status'] == 'CHANGED(204)' + assert leshan.write_attributes(endpoint, '3/0/11/0', {'pmax':100, 'epmin':1, 'epmax':20})['status'] == 'CHANGED(204)' resp = leshan.discover(endpoint, '3/0/11') logger.debug(resp) assert int(resp['/3/0/11']['pmin']) == 10 assert int(resp['/3/0/11']['pmax']) == 320 assert int(resp['/3/0/11/0']['pmax']) == 100 - assert int(resp['/3/0/11/0']['epmin']) == 1 - assert int(resp['/3/0/11/0']['epmax']) == 20 + # Note: Zephyr does not support epmin&epmax. + # Restore + leshan.remove_attributes(endpoint, '3', ['pmin', 'pmax']) + leshan.remove_attributes(endpoint, '3/0', ['pmax']) + leshan.remove_attributes(endpoint, '3/0/11/0', ['pmax']) + def test_LightweightM2M_1_1_int_280(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-280 - Successful Read-Composite Operation""" @@ -509,8 +508,7 @@ def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str) logger.debug(pwr_src) assert pwr_src[6][0] == 1 assert pwr_src[6][1] == 5 - assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?pmin=5')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?pmax=10')['status'] == 'CHANGED(204)' + assert leshan.write_attributes(endpoint, '3/0/7', {'pmin': 5, 'pmax': 10})['status'] == 'CHANGED(204)' leshan.observe(endpoint, '3/0/7') with leshan.get_event_stream(endpoint, timeout=30) as events: shell.exec_command('lwm2m write /3/0/7/0 -u32 3000') @@ -529,6 +527,7 @@ def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str) assert data[3][0][7][0] == 3500 assert (start + 15) <= time.time() + 1 # Allow 1 second slack. (pMinx + pMax=15) leshan.cancel_observe(endpoint, '3/0/7') + leshan.remove_attributes(endpoint, '3/0/7', ['pmin', 'pmax']) @pytest.mark.slow def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): @@ -553,8 +552,10 @@ def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Le @pytest.mark.slow def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-304 - Observe-Composite Operation""" - assert leshan.put_raw(f'/clients/{endpoint}/1/0/1/attributes?pmin=30')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/1/0/1/attributes?pmax=45')['status'] == 'CHANGED(204)' + # Need to use Configuration C.1 + shell.exec_command('lwm2m write 1/0/2 -u32 0') + shell.exec_command('lwm2m write 1/0/3 -u32 0') + assert leshan.write_attributes(endpoint, '1/0/1', {'pmin': 30, 'pmax': 45})['status'] == 'CHANGED(204)' data = leshan.composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16']) assert data[1][0][1] is not None assert data[3][0][11][0] is not None @@ -575,6 +576,10 @@ def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str) assert (start + 30) < time.time() assert (start + 45) > time.time() - 1 leshan.cancel_composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16']) + # Restore configuration C.3 + shell.exec_command('lwm2m write 1/0/2 -u32 1') + shell.exec_command('lwm2m write 1/0/3 -u32 10') + leshan.remove_attributes(endpoint, '1/0/1', ['pmin', 'pmax']) def test_LightweightM2M_1_1_int_306(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-306 - Send Operation""" @@ -620,8 +625,7 @@ def test_LightweightM2M_1_1_int_308(shell: Shell, dut: DeviceAdapter, leshan: Le content_both = {16: {0: resources_a, 1: resources_b}} assert leshan.create_obj_instance(endpoint, '16/0', resources_a)['status'] == 'CREATED(201)' dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0) - assert leshan.put_raw(f'/clients/{endpoint}/16/0/attributes?pmin=30')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/16/0/attributes?pmax=45')['status'] == 'CHANGED(204)' + assert leshan.write_attributes(endpoint, '16/0', {'pmin': 30, 'pmax': 45})['status'] == 'CHANGED(204)' data = leshan.composite_observe(endpoint, ['/16/0', '/16/1']) assert data == content_one with leshan.get_event_stream(endpoint, timeout=50) as events: @@ -637,6 +641,7 @@ def test_LightweightM2M_1_1_int_308(shell: Shell, dut: DeviceAdapter, leshan: Le # Restore configuration C.3 shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') + leshan.remove_attributes(endpoint, '16/0', ['pmin','pmax']) @pytest.mark.slow def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): @@ -663,8 +668,7 @@ def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Le assert leshan.create_obj_instance(endpoint, '16/0', resources_a)['status'] == 'CREATED(201)' assert leshan.create_obj_instance(endpoint, '16/1', resources_b)['status'] == 'CREATED(201)' dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0) - assert leshan.put_raw(f'/clients/{endpoint}/16/0/attributes?pmin=30')['status'] == 'CHANGED(204)' - assert leshan.put_raw(f'/clients/{endpoint}/16/0/attributes?pmax=45')['status'] == 'CHANGED(204)' + assert leshan.write_attributes(endpoint, '16/0', {'pmin': 30, 'pmax': 45})['status'] == 'CHANGED(204)' data = leshan.composite_observe(endpoint, ['/16/0', '/16/1']) assert data == content_both with leshan.get_event_stream(endpoint, timeout=50) as events: @@ -680,6 +684,7 @@ def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Le # Restore configuration C.3 shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') + leshan.remove_attributes(endpoint, '16/0', ['pmin', 'pmax']) @pytest.mark.slow def test_LightweightM2M_1_1_int_310(shell: Shell, leshan: Leshan, endpoint: str): @@ -687,11 +692,9 @@ def test_LightweightM2M_1_1_int_310(shell: Shell, leshan: Leshan, endpoint: str) # Need to use Configuration C.1 shell.exec_command('lwm2m write 1/0/2 -u32 0') shell.exec_command('lwm2m write 1/0/3 -u32 0') - # Ensure that our previous attributes are not conflicting - assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmin=0')['status'] == 'CHANGED(204)' leshan.composite_observe(endpoint, ['/1/0/1', '/3/0']) with leshan.get_event_stream(endpoint, timeout=50) as events: - assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmax=5')['status'] == 'CHANGED(204)' + assert leshan.write_attributes(endpoint, '3', {'pmax': 5})['status'] == 'CHANGED(204)' start = time.time() data = events.next_event('NOTIFICATION') assert data[3][0][0] == 'Zephyr' @@ -704,6 +707,7 @@ def test_LightweightM2M_1_1_int_310(shell: Shell, leshan: Leshan, endpoint: str) # Restore configuration C.3 shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') + leshan.remove_attributes(endpoint, '3', ['pmax']) def test_LightweightM2M_1_1_int_311(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-311 - Send command""" From fe952014ab5b8dabfda93820fef30cb2a94997df Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 13 Nov 2023 16:36:03 +0200 Subject: [PATCH 0114/2300] [nrf fromtree] test: lwm2m: Implement Read-Composite Operation on root path Test case: LightweightM2M-1.1-int-235 - Read-Composite Operation on root path is now working as Leshan added a support for reading the root path. Signed-off-by: Seppo Takalo (cherry picked from commit 2135e009e4d9dbc77a9083313705236708868dad) (cherry picked from commit 913d9a36ff76cc8c01e7d68228ff13519ac27a12) --- tests/net/lib/lwm2m/interop/README.md | 2 +- tests/net/lib/lwm2m/interop/pytest/leshan.py | 4 ++++ tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index 3654ca94b01..204aff636ac 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -160,7 +160,7 @@ Tests are written from test spec; |LightweightM2M-1.1-int-232 - Querying basic information in SenML CBOR format|:white_check_mark:| | |LightweightM2M-1.1-int-233 - Setting basic information in SenML CBOR format|:white_check_mark:| | |LightweightM2M-1.1-int-234 - Setting basic information in SenML JSON format|:white_check_mark:| | -|LightweightM2M-1.1-int-235 - Read-Composite Operation on root path|:large_orange_diamond:|Root Path is not yet supported by Leshan.| +|LightweightM2M-1.1-int-235 - Read-Composite Operation on root path|:white_check_mark:| | |LightweightM2M-1.1-int-236 - Read-Composite - Partial Presence|:white_check_mark:| | |LightweightM2M-1.1-int-237 - Read on Object without specifying Content-Type|:white_check_mark:| | |LightweightM2M-1.1-int-241 - Executable Resource: Rebooting the device|:white_check_mark:| | diff --git a/tests/net/lib/lwm2m/interop/pytest/leshan.py b/tests/net/lib/lwm2m/interop/pytest/leshan.py index 4add988ea77..65295e652bc 100644 --- a/tests/net/lib/lwm2m/interop/pytest/leshan.py +++ b/tests/net/lib/lwm2m/interop/pytest/leshan.py @@ -271,6 +271,10 @@ def parse_composite(cls, payload: dict): raise RuntimeError(f'No content received') payload = payload['content'] for path, content in payload.items(): + if path == "/": + for obj in content['objects']: + data.update(cls._decode_obj(obj)) + continue keys = [int(key) for key in path.lstrip("/").split('/')] if len(keys) == 1: data.update(cls._decode_obj(content)) diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index f596f74d30a..eabc4bbc614 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -367,9 +367,12 @@ def test_LightweightM2M_1_1_int_234(shell: Shell, leshan: Leshan, endpoint: str) """LightweightM2M-1.1-int-234 - Setting basic information in SenML JSON format""" setting_basic_senml(shell, leshan, endpoint, 'SENML_JSON') -@pytest.mark.skip("Leshan does not allow reading root path") -def test_LightweightM2M_1_1_int_235(): +def test_LightweightM2M_1_1_int_235(leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-235 - Read-Composite Operation on root path""" + resp = leshan.composite_read(endpoint, ['/']) + expected_keys = [16, 1, 3, 5] + missing_keys = [key for key in expected_keys if key not in resp.keys()] + assert len(missing_keys) == 0 def test_LightweightM2M_1_1_int_236(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-236 - Read-Composite - Partial Presence""" From 77b242914525edb1ab0a07ff0c9d71d1d85730c4 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 20 Nov 2023 16:14:07 +0200 Subject: [PATCH 0115/2300] [nrf fromtree] test: lwm2m: Test cancellation using observe parameter Implement test cases: LightweightM2M-1.1-int-303 - Cancel observations using Observe with Cancel parameter LightweightM2M-1.1-int-305 - Cancel Observation-Composite Operation Modify existing Leshan API to passive_cancel(). Signed-off-by: Seppo Takalo (cherry picked from commit 31e9a5674267dbc3efc717f15bf601a2e064d1ec) (cherry picked from commit b120890dddda2eb725ed66d78fa815126d972d65) --- tests/net/lib/lwm2m/interop/README.md | 4 +-- tests/net/lib/lwm2m/interop/pytest/leshan.py | 7 +++++ .../lib/lwm2m/interop/pytest/test_lwm2m.py | 30 +++++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index 204aff636ac..3acbfcc71f8 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -172,9 +172,9 @@ Tests are written from test spec; |LightweightM2M-1.1-int-281 - Partially Successful Read-Composite Operation|:white_check_mark:| | |LightweightM2M-1.1-int-301 - Observation and Notification of parameter values|:white_check_mark:| | |LightweightM2M-1.1-int-302 - Cancel Observations using Reset Operation|:white_check_mark:| | -|LightweightM2M-1.1-int-303 - Cancel observations using Observe with Cancel parameter|:large_orange_diamond:|Leshan only supports passive cancelling| +|LightweightM2M-1.1-int-303 - Cancel observations using Observe with Cancel parameter|:white_check_mark:|| |LightweightM2M-1.1-int-304 - Observe-Composite Operation|:white_check_mark:| | -|LightweightM2M-1.1-int-305 - Cancel Observation-Composite Operation|:large_orange_diamond:|Leshan only supports passive cancelling| +|LightweightM2M-1.1-int-305 - Cancel Observation-Composite Operation|:white_check_mark:| | |LightweightM2M-1.1-int-306 – Send Operation|:white_check_mark:|[~~#64290~~](https://github.com/zephyrproject-rtos/zephyr/issues/64290)| |LightweightM2M-1.1-int-307 – Muting Send|:white_check_mark:| | |LightweightM2M-1.1-int-308 - Observe-Composite and Creating Object Instance|:white_check_mark:|[~~#64634~~](https://github.com/zephyrproject-rtos/zephyr/issues/64634)| diff --git a/tests/net/lib/lwm2m/interop/pytest/leshan.py b/tests/net/lib/lwm2m/interop/pytest/leshan.py index 65295e652bc..181f15ebf61 100644 --- a/tests/net/lib/lwm2m/interop/pytest/leshan.py +++ b/tests/net/lib/lwm2m/interop/pytest/leshan.py @@ -389,6 +389,9 @@ def observe(self, endpoint: str, path: str): return self.post(f'/clients/{endpoint}/{path}/observe', data="") def cancel_observe(self, endpoint: str, path: str): + return self.delete_raw(f'/clients/{endpoint}/{path}/observe?active') + + def passive_cancel_observe(self, endpoint: str, path: str): return self.delete_raw(f'/clients/{endpoint}/{path}/observe') def composite_observe(self, endpoint: str, paths: list[str]): @@ -398,6 +401,10 @@ def composite_observe(self, endpoint: str, paths: list[str]): return self.parse_composite(payload) def cancel_composite_observe(self, endpoint: str, paths: list[str]): + paths = [path if path.startswith('/') else '/' + path for path in paths] + return self.delete_raw(f'/clients/{endpoint}/composite/observe?paths=' + ','.join(paths) + '&active') + + def passive_cancel_composite_observe(self, endpoint: str, paths: list[str]): paths = [path if path.startswith('/') else '/' + path for path in paths] return self.delete_raw(f'/clients/{endpoint}/composite/observe?paths=' + ','.join(paths)) diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index eabc4bbc614..131acb68e14 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -532,7 +532,6 @@ def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str) leshan.cancel_observe(endpoint, '3/0/7') leshan.remove_attributes(endpoint, '3/0/7', ['pmin', 'pmax']) -@pytest.mark.slow def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-302 - Cancel Observations using Reset Operation""" leshan.observe(endpoint, '3/0/7') @@ -541,17 +540,34 @@ def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Le shell.exec_command('lwm2m write /3/0/7/0 -u32 4000') data = events.next_event('NOTIFICATION') assert data[3][0][7][0] == 4000 - leshan.cancel_observe(endpoint, '3/0/7') + leshan.passive_cancel_observe(endpoint, '3/0/7') shell.exec_command('lwm2m write /3/0/7/0 -u32 3000') dut.readlines_until(regex=r'.*Observer removed for 3/0/7') with leshan.get_event_stream(endpoint) as events: shell.exec_command('lwm2m write /3/0/8/0 -u32 100') data = events.next_event('NOTIFICATION') assert data[3][0][8][0] == 100 - leshan.cancel_observe(endpoint, '3/0/8') + leshan.passive_cancel_observe(endpoint, '3/0/8') shell.exec_command('lwm2m write /3/0/8/0 -u32 50') dut.readlines_until(regex=r'.*Observer removed for 3/0/8') +def test_LightweightM2M_1_1_int_303(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): + """LightweightM2M-1.1-int-303 - Cancel observations using Observe with Cancel parameter""" + leshan.observe(endpoint, '3/0/7') + leshan.observe(endpoint, '3/0/8') + with leshan.get_event_stream(endpoint) as events: + shell.exec_command('lwm2m write /3/0/7/0 -u32 4000') + data = events.next_event('NOTIFICATION') + assert data[3][0][7][0] == 4000 + leshan.cancel_observe(endpoint, '3/0/7') + dut.readlines_until(regex=r'.*Observer removed for 3/0/7') + with leshan.get_event_stream(endpoint) as events: + shell.exec_command('lwm2m write /3/0/8/0 -u32 100') + data = events.next_event('NOTIFICATION') + assert data[3][0][8][0] == 100 + leshan.cancel_observe(endpoint, '3/0/8') + dut.readlines_until(regex=r'.*Observer removed for 3/0/8') + @pytest.mark.slow def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-304 - Observe-Composite Operation""" @@ -584,6 +600,14 @@ def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str) shell.exec_command('lwm2m write 1/0/3 -u32 10') leshan.remove_attributes(endpoint, '1/0/1', ['pmin', 'pmax']) +def test_LightweightM2M_1_1_int_305(dut: DeviceAdapter, leshan: Leshan, endpoint: str): + """LightweightM2M-1.1-int-305 - Cancel Observation-Composite Operation""" + leshan.composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16']) + leshan.cancel_composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16']) + dut.readlines_until(regex=r'.*Observer removed for 1/0/1') + dut.readlines_until(regex=r'.*Observer removed for 3/0/11/0') + dut.readlines_until(regex=r'.*Observer removed for 3/0/16') + def test_LightweightM2M_1_1_int_306(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-306 - Send Operation""" with leshan.get_event_stream(endpoint) as events: From eb5990c3d252ff4fefde1d0b6e913a7cb5854363 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Mon, 20 Nov 2023 13:40:55 +0200 Subject: [PATCH 0116/2300] [nrf fromtree] samples: lwm2m: Add support for Connection Manager Using Connection Manager, it's easy to run lwm2m sample on devices supporting different connectivity technologies (for example, Wi-Fi and LTE). Signed-off-by: Juha Ylinen (cherry picked from commit 637b4b62ee233cb4e3733b0bf65e4b415e41daa1) (cherry picked from commit 03aacf0cfc5d2235d5812b0ccd4103c99bc23e5c) --- samples/net/lwm2m_client/src/lwm2m-client.c | 78 +++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index 748f654d9ee..a120506639d 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -16,6 +16,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include #include +#include +#include #include "modules.h" #define APP_BANNER "Run LWM2M client" @@ -29,6 +31,10 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define CLIENT_FIRMWARE_VER "1.0" #define CLIENT_HW_VER "1.0.1" +/* Macros used to subscribe to specific Zephyr NET management events. */ +#define L4_EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED) +#define CONN_LAYER_EVENT_MASK (NET_EVENT_CONN_IF_FATAL_ERROR) + static uint8_t bat_idx = LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT; static int bat_mv = 3800; static int bat_ma = 125; @@ -52,6 +58,12 @@ BUILD_ASSERT(sizeof(endpoint) <= CONFIG_LWM2M_SECURITY_KEY_SIZE, static struct k_sem quit_lock; +/* Zephyr NET management event callback structures. */ +static struct net_mgmt_event_callback l4_cb; +static struct net_mgmt_event_callback conn_cb; + +static K_SEM_DEFINE(network_connected_sem, 0, 1); + static int device_reboot_cb(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len) { @@ -265,6 +277,47 @@ static void observe_cb(enum lwm2m_observe_event event, } } +static void on_net_event_l4_disconnected(void) +{ + LOG_INF("Disconnected from network"); + lwm2m_engine_pause(); +} + +static void on_net_event_l4_connected(void) +{ + LOG_INF("Connected to network"); + k_sem_give(&network_connected_sem); + lwm2m_engine_resume(); +} + +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("IP Up"); + on_net_event_l4_connected(); + break; + case NET_EVENT_L4_DISCONNECTED: + LOG_INF("IP down"); + on_net_event_l4_disconnected(); + break; + default: + break; + } +} + +static void connectivity_event_handler(struct net_mgmt_event_callback *cb, + uint32_t event, + struct net_if *iface) +{ + if (event == NET_EVENT_CONN_IF_FATAL_ERROR) { + LOG_ERR("Fatal error received from the connectivity layer"); + return; + } +} + int main(void) { uint32_t flags = IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) ? @@ -275,6 +328,31 @@ int main(void) k_sem_init(&quit_lock, 0, K_SEM_MAX_LIMIT); + if (IS_ENABLED(CONFIG_NET_CONNECTION_MANAGER)) { + /* Setup handler for Zephyr NET Connection Manager events. */ + net_mgmt_init_event_callback(&l4_cb, l4_event_handler, L4_EVENT_MASK); + net_mgmt_add_event_callback(&l4_cb); + + /* Setup handler for Zephyr NET Connection Manager Connectivity layer. */ + net_mgmt_init_event_callback(&conn_cb, connectivity_event_handler, + CONN_LAYER_EVENT_MASK); + net_mgmt_add_event_callback(&conn_cb); + + ret = net_if_up(net_if_get_default()); + + if (ret < 0 && ret != -EALREADY) { + LOG_ERR("net_if_up, error: %d", ret); + 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); + } + } + ret = lwm2m_setup(); if (ret < 0) { LOG_ERR("Cannot setup LWM2M fields (%d)", ret); From a7ef49523e503b264c8af591c69bbd40f6c4ed6b Mon Sep 17 00:00:00 2001 From: Andreas Chmielewski Date: Thu, 26 Jan 2023 14:25:46 +0100 Subject: [PATCH 0117/2300] [nrf fromtree] tests: lwm2m_rd_client: Added more fff tests If the rdclient is suspended or deregistered any network errors caused by lwm2m_engine and forwarded by socket_fault handler should not change the rd client state. Signed-off-by: Andreas Chmielewski Signed-off-by: Seppo Takalo (cherry picked from commit 72f7a05a8b51524960a3ea5b7114249b10e715ba) (cherry picked from commit f5555ac8164d085e79bf37ec1e537e47f7c7ea17) --- .../net/lib/lwm2m/lwm2m_rd_client/src/main.c | 70 +++++++++++++++++++ .../net/lib/lwm2m/lwm2m_rd_client/src/stubs.c | 14 ++++ .../net/lib/lwm2m/lwm2m_rd_client/src/stubs.h | 3 + 3 files changed, 87 insertions(+) diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c b/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c index 931f6f15904..208298512d4 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c @@ -698,3 +698,73 @@ ZTEST(lwm2m_rd_client, test_bootstrap_no_srv_fallback_to_register) zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); } + +ZTEST(lwm2m_rd_client, test_start_stop_ignore_engine_fault) +{ + struct lwm2m_ctx ctx; + + (void)memset(&ctx, 0x0, sizeof(ctx)); + + test_prepare_pending_message_cb(&message_reply_cb_default); + + lwm2m_rd_client_init(); + test_lwm2m_engine_start_service(); + wait_for_service(1); + + lwm2m_engine_context_init_fake.custom_fake = lwm2m_engine_context_init_fake1; + lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_default; + lwm2m_sprint_ip_addr_fake.custom_fake = lwm2m_sprint_ip_addr_fake_default; + lwm2m_init_message_fake.custom_fake = lwm2m_init_message_fake_default; + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; + coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; + zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, + NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), + NULL); + + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; + zassert_true(lwm2m_rd_client_stop(&ctx, lwm2m_event_cb, true) == 0, NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_DISCONNECT), NULL); + + int c = show_lwm2m_event_fake.call_count; + + test_throw_network_error_from_engine(EIO); + wait_for_service(10); + zassert_equal(show_lwm2m_event_fake.call_count, c, + "Should not enter any other state and throw an event"); +} + +ZTEST(lwm2m_rd_client, test_start_suspend_ignore_engine_fault) +{ + struct lwm2m_ctx ctx; + + (void)memset(&ctx, 0x0, sizeof(ctx)); + + test_prepare_pending_message_cb(&message_reply_cb_default); + + lwm2m_rd_client_init(); + test_lwm2m_engine_start_service(); + wait_for_service(1); + + lwm2m_engine_context_init_fake.custom_fake = lwm2m_engine_context_init_fake1; + lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_default; + lwm2m_sprint_ip_addr_fake.custom_fake = lwm2m_sprint_ip_addr_fake_default; + lwm2m_init_message_fake.custom_fake = lwm2m_init_message_fake_default; + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; + coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; + zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, + NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), + NULL); + + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; + zassert_true(lwm2m_rd_client_pause() == 0, NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED), NULL); + + int c = show_lwm2m_event_fake.call_count; + + test_throw_network_error_from_engine(EIO); + wait_for_service(10); + zassert_equal(show_lwm2m_event_fake.call_count, c, + "Should not enter any other state and throw an event"); +} diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c index 41789e20340..3cbde9060ce 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c @@ -86,6 +86,10 @@ int lwm2m_get_u32_val(const struct lwm2m_obj_path *path, uint32_t *val) /* subsys/net/lib/lwm2m/lwm2m_engine.h */ DEFINE_FAKE_VALUE_FUNC(int, lwm2m_socket_start, struct lwm2m_ctx *); +int lwm2m_socket_start_fake_fail(struct lwm2m_ctx *client_ctx) +{ + return -1; +} DEFINE_FAKE_VALUE_FUNC(int, lwm2m_socket_close, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_close_socket, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_socket_suspend, struct lwm2m_ctx *); @@ -93,6 +97,16 @@ DEFINE_FAKE_VALUE_FUNC(int, lwm2m_security_inst_id_to_index, uint16_t); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_engine_connection_resume, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_push_queued_buffers, struct lwm2m_ctx *); DEFINE_FAKE_VOID_FUNC(lwm2m_engine_context_init, struct lwm2m_ctx *); +struct lwm2m_ctx *client_ctx_fake; +void lwm2m_engine_context_init_fake1(struct lwm2m_ctx *client_ctx) +{ + client_ctx_fake = client_ctx; +} +void test_throw_network_error_from_engine(int err) +{ + client_ctx_fake->fault_cb(err); +} + DEFINE_FAKE_VOID_FUNC(lwm2m_engine_context_close, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(char *, lwm2m_sprint_ip_addr, const struct sockaddr *); char *lwm2m_sprint_ip_addr_fake_default(const struct sockaddr *addr) diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h index 620e4d8fc12..1276dd5c109 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h @@ -54,6 +54,7 @@ int lwm2m_get_u32_val(const struct lwm2m_obj_path *path, uint32_t *val); /* subsys/net/lib/lwm2m/lwm2m_engine.h */ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_start, struct lwm2m_ctx *); +int lwm2m_socket_start_fake_fail(struct lwm2m_ctx *client_ctx); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_close, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_close_socket, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_suspend, struct lwm2m_ctx *); @@ -61,6 +62,8 @@ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_inst_id_to_index, uint16_t); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_engine_connection_resume, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_push_queued_buffers, struct lwm2m_ctx *); DECLARE_FAKE_VOID_FUNC(lwm2m_engine_context_init, struct lwm2m_ctx *); +void lwm2m_engine_context_init_fake1(struct lwm2m_ctx *client_ctx); +void test_throw_network_error_from_engine(int err); DECLARE_FAKE_VOID_FUNC(lwm2m_engine_context_close, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(char *, lwm2m_sprint_ip_addr, const struct sockaddr *); char *lwm2m_sprint_ip_addr_fake_default(const struct sockaddr *addr); From 6682521923d8038fbae1ad3215f1510337c1efcd Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 29 Nov 2023 10:02:10 +0100 Subject: [PATCH 0118/2300] [nrf fromtree] net: lib: coap: Translate handler errors to CoAP response codes The CoAP request handler returns errno codes in the following cases: * ENOENT if no handler found; respond with 4.04 * ENOTSUP if an unknown request code received; respond with 4.00 * EPERM no handler found for the method; respond with 4.05 Signed-off-by: Pieter De Gendt (cherry picked from commit 8252ec7570b7b7182880d2982d70858860156e98) (cherry picked from commit 601069bfb239219ed109c06472dce9b45ec57c6c) --- subsys/net/lib/coap/coap_server.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 4b4f1719f46..ac179f5545e 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -220,6 +220,19 @@ static int coap_server_process(int sock_fd) COAP_SERVICE_RESOURCE_COUNT(service), options, opt_num, &client_addr, client_addr_len); + /* Translate errors to response codes */ + switch (ret) { + case -ENOENT: + ret = COAP_RESPONSE_CODE_NOT_FOUND; + break; + case -ENOTSUP: + ret = COAP_RESPONSE_CODE_BAD_REQUEST; + break; + case -EPERM: + ret = COAP_RESPONSE_CODE_NOT_ALLOWED; + break; + } + /* Shortcut for replying a code without a body */ if (ret > 0 && type == COAP_TYPE_CON) { /* Minimal sized ack buffer */ From 297b4797cfdf0620ec628ecb1b2a46de42ddc786 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 29 Nov 2023 15:33:19 +0100 Subject: [PATCH 0119/2300] [nrf fromtree] tests: net: lib: coap_server: Do not autostart service B with port 0 A race condition for the test occurs as the service might have started when booting. Do not autostart the service to verify the port stays 0. Signed-off-by: Pieter De Gendt (cherry picked from commit b500f7216e976a6237ff307246d00cf4a1879d20) (cherry picked from commit 56595ecd433cfacc8746bd47ac30735abdb68751) --- tests/net/lib/coap_server/common/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/net/lib/coap_server/common/src/main.c b/tests/net/lib/coap_server/common/src/main.c index 7af940c5360..20c4b7c0317 100644 --- a/tests/net/lib/coap_server/common/src/main.c +++ b/tests/net/lib/coap_server/common/src/main.c @@ -48,7 +48,7 @@ COAP_RESOURCE_DEFINE(resource_1, service_A, { }); static uint16_t service_B_port; -COAP_SERVICE_DEFINE(service_B, "b.service.com", &service_B_port, COAP_SERVICE_AUTOSTART); +COAP_SERVICE_DEFINE(service_B, "b.service.com", &service_B_port, 0); static const char * const resource_2_path[] = { "res2", "sub", NULL }; COAP_RESOURCE_DEFINE(resource_2, service_B, { @@ -132,7 +132,7 @@ ZTEST(coap_service, test_COAP_SERVICE_FOREACH) zassert_equal(svc->flags & COAP_SERVICE_AUTOSTART, COAP_SERVICE_AUTOSTART); } else if (svc == &service_B) { have_service_B = 1; - zassert_equal(svc->flags & COAP_SERVICE_AUTOSTART, COAP_SERVICE_AUTOSTART); + zassert_equal(svc->flags & COAP_SERVICE_AUTOSTART, 0); } else if (svc == &service_C) { have_service_C = 1; zassert_equal(svc->flags & COAP_SERVICE_AUTOSTART, 0); From 81a63f5d95eff9e3b6d2bf9e572ee77f9a19aa69 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 29 Nov 2023 14:45:53 +0100 Subject: [PATCH 0120/2300] [nrf fromtree] net: lib: coap: Init CoAP service socket fd to -1 Set the static initialiser socket file descriptor to -1 to make sure it is invalid before using coap_service_send. Signed-off-by: Pieter De Gendt (cherry picked from commit 4ff8080b65494eac5525de43dd67e3509de1a697) (cherry picked from commit 9dcf2ec3e25f0c7853541c039bd246a0f660e333) --- include/zephyr/net/coap_service.h | 4 +++- subsys/net/lib/coap/coap_server.c | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/zephyr/net/coap_service.h b/include/zephyr/net/coap_service.h index 3e3201308b9..377c89a7bef 100644 --- a/include/zephyr/net/coap_service.h +++ b/include/zephyr/net/coap_service.h @@ -57,7 +57,9 @@ 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 coap_service_data_##_name = { \ + .sock_fd = -1, \ + }; \ const STRUCT_SECTION_ITERABLE(coap_service, _name) = { \ .name = STRINGIFY(_name), \ .host = _host, \ diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index ac179f5545e..009a0fe0274 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -707,9 +707,6 @@ static void coap_server_thread(void *p1, void *p2, void *p3) } COAP_SERVICE_FOREACH(svc) { - /* Init all file descriptors to -1 */ - svc->data->sock_fd = -1; - if (svc->flags & COAP_SERVICE_AUTOSTART) { ret = coap_service_start(svc); if (ret < 0) { From eef1361e16e17373d341deb470cb5fad0efa8a30 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 29 Nov 2023 14:57:06 +0100 Subject: [PATCH 0121/2300] [nrf fromtree] net: lib: coap: Fix return value documentation coap_service_start Corrected a return value in the doxygen description for coap_service_start. Signed-off-by: Pieter De Gendt (cherry picked from commit f2a256a4c9db9767cf50dc570e88fe5354047c81) (cherry picked from commit da039ffccc0d0fbb15a702391d0bf2f10a36c427) --- include/zephyr/net/coap_service.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/net/coap_service.h b/include/zephyr/net/coap_service.h index 377c89a7bef..92a276d0d48 100644 --- a/include/zephyr/net/coap_service.h +++ b/include/zephyr/net/coap_service.h @@ -199,7 +199,7 @@ struct coap_service { * @param service Pointer to CoAP service * @retval 0 in case of success. * @retval -EALREADY in case of an already running service. - * @retval -ENOMEM in case the server has no available context. + * @retval -ENOTSUP in case the server has no valid host and port configuration. */ int coap_service_start(const struct coap_service *service); From 2d0aeab9021fa95a66d9f4c537caacff1a49538d Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 29 Nov 2023 14:58:12 +0100 Subject: [PATCH 0122/2300] [nrf fromtree] net: lib: coap: Add coap_service_is_running Add a CoAP service API function to query the running state of the provided service. Signed-off-by: Pieter De Gendt (cherry picked from commit 266181b0825c63adb48acafbb15e42191c4fc3ff) (cherry picked from commit 717fb2bcdf37a5eb83dd4d6e1d9fa59ce0120e54) --- include/zephyr/net/coap_service.h | 12 ++++++++++++ subsys/net/lib/coap/coap_server.c | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/zephyr/net/coap_service.h b/include/zephyr/net/coap_service.h index 92a276d0d48..6f038ce61e1 100644 --- a/include/zephyr/net/coap_service.h +++ b/include/zephyr/net/coap_service.h @@ -214,6 +214,18 @@ int coap_service_start(const struct coap_service *service); */ int coap_service_stop(const struct coap_service *service); +/** + * @brief Query the provided @p service running state. + * + * @note This function is suitable for a @p service defined with @ref COAP_SERVICE_DEFINE. + * + * @param service Pointer to CoAP service + * @retval 1 if the service is running + * @retval 0 if the service is stopped + * @retval negative in case of an error. + */ +int coap_service_is_running(const struct coap_service *service); + /** * @brief Send a CoAP message from the provided @p service . * diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 009a0fe0274..386bc2081bb 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -483,6 +483,24 @@ int coap_service_stop(const struct coap_service *service) return ret; } +int coap_service_is_running(const struct coap_service *service) +{ + int ret; + + if (!coap_service_in_section(service)) { + __ASSERT_NO_MSG(false); + return -EINVAL; + } + + k_mutex_lock(&lock, K_FOREVER); + + ret = (service->data->sock_fd < 0) ? 0 : 1; + + k_mutex_unlock(&lock); + + return ret; +} + int coap_service_send(const struct coap_service *service, const struct coap_packet *cpkt, const struct sockaddr *addr, socklen_t addr_len) { From 129f5c6df5f0df40caaf659bcb25926ff4c5e387 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 24 Nov 2023 13:40:19 +0200 Subject: [PATCH 0123/2300] [nrf fromtree] net: lwm2m: Allow finding security instance by short ID. Add API to find a security instance ID with given Short Server ID. Signed-off-by: Seppo Takalo (cherry picked from commit 304d920ef1a18fe514eb4ede22b5b0df569dbd0d) (cherry picked from commit 00b8ca550f27fcef408ec238fb576354e7ec1906) --- subsys/net/lib/lwm2m/lwm2m_engine.h | 8 ++++++++ subsys/net/lib/lwm2m/lwm2m_obj_security.c | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.h b/subsys/net/lib/lwm2m/lwm2m_engine.h index 2306fced197..2ea3e583242 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.h +++ b/subsys/net/lib/lwm2m/lwm2m_engine.h @@ -133,6 +133,14 @@ int lwm2m_engine_call_now(k_work_handler_t service); */ int lwm2m_security_inst_id_to_index(uint16_t obj_inst_id); +/** + * @brief Returns the object instance id of the security having ssid given by @p short_id. + * + * @param[in] short_id ssid of the security object + * @return Object instance id or negative in case not found + */ +int lwm2m_security_short_id_to_inst(uint16_t short_id); + /** * @brief Returns the object instance id of the security object instance at @p index * in the security object list. diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_security.c b/subsys/net/lib/lwm2m/lwm2m_obj_security.c index 874925c39d8..00796648634 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_security.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_security.c @@ -212,6 +212,16 @@ int lwm2m_security_index_to_inst_id(int index) return inst[index].obj_inst_id; } +int lwm2m_security_short_id_to_inst(uint16_t short_id) +{ + for (int i = 0; i < MAX_INSTANCE_COUNT; i++) { + if (short_server_id[i] == short_id) { + return inst[i].obj_inst_id; + } + } + return -ENOENT; +} + int lwm2m_security_mode(struct lwm2m_ctx *ctx) { int ret; From f6562da1b89821d350ea61458d1700b502c0563c Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 24 Nov 2023 15:07:10 +0200 Subject: [PATCH 0124/2300] [nrf fromtree] net: lwm2m: Allow disabling server for a period of time React to disable executable, as well as add callback that allows disabling server for a period of time. Also add API that would find a next server candidate based on the priority and server being not-disabled. Move all server related functions into its own header. Signed-off-by: Seppo Takalo (cherry picked from commit ec962246e9eaf38746e2e895b1e7601896b67de5) (cherry picked from commit 7a29fd1a6439a6db0b4981b68a8c7850317079fc) --- subsys/net/lib/lwm2m/lwm2m_engine.h | 40 +--- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 1 + subsys/net/lib/lwm2m/lwm2m_obj_server.c | 224 ++++++++++++------ subsys/net/lib/lwm2m/lwm2m_obj_server.h | 144 +++++++++++ subsys/net/lib/lwm2m/lwm2m_observation.c | 1 + subsys/net/lib/lwm2m/lwm2m_rd_client.c | 1 + 6 files changed, 302 insertions(+), 109 deletions(-) create mode 100644 subsys/net/lib/lwm2m/lwm2m_obj_server.h diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.h b/subsys/net/lib/lwm2m/lwm2m_engine.h index 2ea3e583242..81b28395662 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.h +++ b/subsys/net/lib/lwm2m/lwm2m_engine.h @@ -30,6 +30,7 @@ /* length of time in milliseconds to wait for buffer allocations */ #define BUF_ALLOC_TIMEOUT K_SECONDS(1) + /** * @brief Validates that writing is a legal operation on the field given by the object in * @p obj_inst and the resource id in @p msg. Returns the field to obj_field (if it exists). @@ -150,45 +151,6 @@ int lwm2m_security_short_id_to_inst(uint16_t short_id); */ int lwm2m_security_index_to_inst_id(int index); -/** - * @brief Returns the default minimum period for an observation set for the server - * with object instance id given by @p obj_inst_id. - * - * @param[in] obj_inst_id Object instance id of the server object instance - * @return int32_t pmin value - */ -int32_t lwm2m_server_get_pmin(uint16_t obj_inst_id); - -/** - * @brief Returns the default maximum period for an observation set for the server - * with object instance id given by @p obj_inst_id. - * - * @param[in] obj_inst_id Object instance id of the server object instance - * @return int32_t pmax value - */ -int32_t lwm2m_server_get_pmax(uint16_t obj_inst_id); - -/** - * @brief Returns the Short Server ID of the server object instance with - * object instance id given by @p obj_inst_id. - * - * @param[in] obj_inst_id Object instance id of the server object - * @return SSID or negative in case not found - */ -int lwm2m_server_get_ssid(uint16_t obj_inst_id); - -/** - * @brief Returns the object instance id of the server having ssid given by @p short_id. - * - * @param[in] short_id ssid of the server object - * @return Object instance id or negative in case not found - */ -int lwm2m_server_short_id_to_inst(uint16_t short_id); - -#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) -bool lwm2m_server_get_mute_send(uint16_t obj_inst_id); -#endif - #if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_OBJ_SUPPORT) /** * @brief Sets the update state (as specified in LWM2M SPEC E.6 regarding the firmware update) diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 6d006b4603e..02c62cee67c 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -45,6 +45,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include "lwm2m_engine.h" #include "lwm2m_object.h" #include "lwm2m_obj_access_control.h" +#include "lwm2m_obj_server.h" #include "lwm2m_rw_link_format.h" #include "lwm2m_rw_oma_tlv.h" #include "lwm2m_rw_plain_text.h" diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_server.c b/subsys/net/lib/lwm2m/lwm2m_obj_server.c index a1b2185ef1d..10c7a1a1ea0 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_server.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_server.c @@ -15,8 +15,9 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include "lwm2m_object.h" -#include "lwm2m_engine.h" +#include "lwm2m_obj_server.h" #include "lwm2m_rd_client.h" +#include "lwm2m_registry.h" #define SERVER_VERSION_MAJOR 1 #if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) @@ -27,37 +28,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define SERVER_MAX_ID 9 #endif /* defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) */ -/* Server resource IDs */ -#define SERVER_SHORT_SERVER_ID 0 -#define SERVER_LIFETIME_ID 1 -#define SERVER_DEFAULT_MIN_PERIOD_ID 2 -#define SERVER_DEFAULT_MAX_PERIOD_ID 3 -#define SERVER_DISABLE_ID 4 -#define SERVER_DISABLE_TIMEOUT_ID 5 -#define SERVER_STORE_NOTIFY_ID 6 -#define SERVER_TRANSPORT_BINDING_ID 7 -#define SERVER_REG_UPDATE_TRIGGER_ID 8 -#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) -#define SERVER_BOOTSTRAP_UPDATE_TRIGGER_ID 9 -#define SERVER_APN_LINK_ID 10 -#define SERVER_TLS_DTLS_ALERT_CODE_ID 11 -#define SERVER_LAST_BOOTSTRAPPED_ID 12 -#define SERVER_REGISTRATION_PRIORITY_ORDER_ID 13 -#define SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID 14 -#define SERVER_REGISTRATION_FAILURE_BLOCK_ID 15 -#define SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID 16 -#define SERVER_COMMUNICATION_RETRY_COUNT_ID 17 -#define SERVER_COMMUNICATION_RETRY_TIMER_ID 18 -#define SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID 19 -#define SERVER_COMMUNICATION_SEQUENCE_RETRY_TIMER_ID 20 -#define SERVER_SMS_TRIGGER_ID 21 -#define SERVER_PREFERRED_TRANSPORT_ID 22 -#define SERVER_MUTE_SEND_ID 23 -#endif /* defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) */ - - /* Server flags */ -#define SERVER_FLAG_DISABLED 1 #define SERVER_FLAG_STORE_NOTIFY 2 #define MAX_INSTANCE_COUNT CONFIG_LWM2M_SERVER_INSTANCE_COUNT @@ -76,13 +47,14 @@ static uint16_t server_id[MAX_INSTANCE_COUNT]; static uint32_t lifetime[MAX_INSTANCE_COUNT]; static uint32_t default_min_period[MAX_INSTANCE_COUNT]; static uint32_t default_max_period[MAX_INSTANCE_COUNT]; -static uint8_t server_flag_disabled[MAX_INSTANCE_COUNT]; +static k_timepoint_t disabled_until[MAX_INSTANCE_COUNT]; static uint32_t disabled_timeout[MAX_INSTANCE_COUNT]; static uint8_t server_flag_store_notify[MAX_INSTANCE_COUNT]; static char transport_binding[MAX_INSTANCE_COUNT][TRANSPORT_BINDING_LEN]; -#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) +/* Server object version 1.1 */ +static uint8_t priority[MAX_INSTANCE_COUNT]; static bool mute_send[MAX_INSTANCE_COUNT]; -#endif +static bool boostrap_on_fail[MAX_INSTANCE_COUNT]; static struct lwm2m_engine_obj server; static struct lwm2m_engine_obj_field fields[] = { @@ -101,10 +73,10 @@ static struct lwm2m_engine_obj_field fields[] = { OBJ_FIELD_DATA(SERVER_APN_LINK_ID, RW_OPT, OBJLNK), OBJ_FIELD_DATA(SERVER_TLS_DTLS_ALERT_CODE_ID, R_OPT, U8), OBJ_FIELD_DATA(SERVER_LAST_BOOTSTRAPPED_ID, R_OPT, TIME), - OBJ_FIELD_DATA(SERVER_REGISTRATION_PRIORITY_ORDER_ID, W_OPT, U16), + OBJ_FIELD_DATA(SERVER_REGISTRATION_PRIORITY_ORDER_ID, RW_OPT, U8), OBJ_FIELD_DATA(SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID, W_OPT, U16), OBJ_FIELD_DATA(SERVER_REGISTRATION_FAILURE_BLOCK_ID, W_OPT, BOOL), - OBJ_FIELD_DATA(SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID, W_OPT, BOOL), + OBJ_FIELD_DATA(SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID, RW_OPT, BOOL), OBJ_FIELD_DATA(SERVER_COMMUNICATION_RETRY_COUNT_ID, W_OPT, U16), OBJ_FIELD_DATA(SERVER_COMMUNICATION_RETRY_TIMER_ID, W_OPT, U16), OBJ_FIELD_DATA(SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID, W_OPT, U16), @@ -128,7 +100,7 @@ static int disable_cb(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len) LOG_DBG("DISABLE %d", obj_inst_id); for (i = 0; i < MAX_INSTANCE_COUNT; i++) { if (inst[i].obj && inst[i].obj_inst_id == obj_inst_id) { - server_flag_disabled[i] = 1U; + disabled_until[i] = sys_timepoint_calc(K_SECONDS(disabled_timeout[i])); return 0; } } @@ -143,7 +115,6 @@ static int update_trigger_cb(uint16_t obj_inst_id, return 0; } -#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) static int bootstrap_trigger_cb(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len) { @@ -161,7 +132,6 @@ bool lwm2m_server_get_mute_send(uint16_t obj_inst_id) } return false; } -#endif /* defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) */ static int lifetime_write_cb(uint16_t obj_inst_id, uint16_t res_id, @@ -233,6 +203,116 @@ int lwm2m_server_short_id_to_inst(uint16_t short_id) return -ENOENT; } +static int lwm2m_server_inst_id_to_index(uint16_t obj_inst_id) +{ + for (int i = 0; i < ARRAY_SIZE(inst); i++) { + if (inst[i].obj && inst[i].obj_inst_id == obj_inst_id) { + return i; + } + } + return -1; +} + +bool lwm2m_server_is_enabled(uint16_t obj_inst_id) +{ + int idx = lwm2m_server_inst_id_to_index(obj_inst_id); + + if (idx < 0) { + return false; + } + return sys_timepoint_expired(disabled_until[idx]); +} + +int lwm2m_server_disable(uint16_t obj_inst_id, k_timeout_t timeout) +{ + int idx = lwm2m_server_inst_id_to_index(obj_inst_id); + + if (idx < 0) { + return -ENOENT; + } + disabled_until[idx] = sys_timepoint_calc(timeout); + return 0; +} + +k_timepoint_t lwm2m_server_get_disabled_time(uint16_t obj_inst_id) +{ + int idx = lwm2m_server_inst_id_to_index(obj_inst_id); + + if (idx < 0) { + return sys_timepoint_calc(K_FOREVER); + } + return disabled_until[idx]; +} + +void lwm2m_server_reset_timestamps(void) +{ + for (int i = 0; i < ARRAY_SIZE(inst); i++) { + disabled_until[i] = sys_timepoint_calc(K_NO_WAIT); + } +} + +bool lwm2m_server_select(uint16_t *obj_inst_id) +{ + uint8_t min = UINT8_MAX; + uint8_t max = 0; + + /* Find priority boundaries */ + if (IS_ENABLED(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1)) { + for (int i = 0; i < ARRAY_SIZE(inst); i++) { + if (min > priority[i]) { + min = priority[i]; + } + if (max < priority[i]) { + max = priority[i]; + } + } + } else { + min = max = 0; + } + + for (uint8_t prio = min; prio <= max; prio++) { + for (int i = 0; i < ARRAY_SIZE(inst); i++) { + /* Disabled for a period */ + if (!lwm2m_server_is_enabled(inst[i].obj_inst_id)) { + continue; + } + + /* Invalid short IDs */ + if (server_id[i] == 0 || server_id[i] == UINT16_MAX) { + continue; + } + + /* Check priority */ + if (IS_ENABLED(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1)) { + if (priority[i] > prio) { + continue; + } + } + if (obj_inst_id) { + *obj_inst_id = inst[i].obj_inst_id; + } + return true; + } + } + + LOG_ERR("No server candidate found"); + return false; +} + +uint8_t lwm2m_server_get_prio(uint16_t obj_inst_id) +{ + if (IS_ENABLED(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1)) { + int idx = lwm2m_server_inst_id_to_index(obj_inst_id); + + if (idx < 0) { + return UINT8_MAX; + } + return priority[idx]; + } + + return (uint8_t)obj_inst_id % UINT8_MAX; +} + static struct lwm2m_engine_obj_inst *server_create(uint16_t obj_inst_id) { int index, i = 0, j = 0; @@ -259,16 +339,14 @@ static struct lwm2m_engine_obj_inst *server_create(uint16_t obj_inst_id) } /* Set default values */ - server_flag_disabled[index] = 0U; + disabled_until[i] = sys_timepoint_calc(K_NO_WAIT); server_flag_store_notify[index] = 0U; server_id[index] = index + 1; lifetime[index] = CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIME; default_min_period[index] = CONFIG_LWM2M_SERVER_DEFAULT_PMIN; default_max_period[index] = CONFIG_LWM2M_SERVER_DEFAULT_PMAX; disabled_timeout[index] = 86400U; -#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) - mute_send[index] = false; -#endif + boostrap_on_fail[index] = true; lwm2m_engine_get_binding(transport_binding[index]); @@ -305,33 +383,39 @@ static struct lwm2m_engine_obj_inst *server_create(uint16_t obj_inst_id) transport_binding[index], TRANSPORT_BINDING_LEN, strlen(transport_binding[index]) + 1); INIT_OBJ_RES_EXECUTE(SERVER_REG_UPDATE_TRIGGER_ID, res[index], i, update_trigger_cb); -#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) - INIT_OBJ_RES_EXECUTE(SERVER_BOOTSTRAP_UPDATE_TRIGGER_ID, res[index], i, - bootstrap_trigger_cb); - INIT_OBJ_RES_OPTDATA(SERVER_APN_LINK_ID, res[index], i, res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_TLS_DTLS_ALERT_CODE_ID, res[index], i, res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_LAST_BOOTSTRAPPED_ID, res[index], i, res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_REGISTRATION_PRIORITY_ORDER_ID, res[index], i, res_inst[index], - j); - INIT_OBJ_RES_OPTDATA(SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_REGISTRATION_FAILURE_BLOCK_ID, res[index], i, res_inst[index], - j); - INIT_OBJ_RES_OPTDATA(SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_RETRY_COUNT_ID, res[index], i, res_inst[index], - j); - INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_RETRY_TIMER_ID, res[index], i, res_inst[index], - j); - INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_SEQUENCE_RETRY_TIMER_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_SMS_TRIGGER_ID, res[index], i, res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_PREFERRED_TRANSPORT_ID, res[index], i, res_inst[index], j); - INIT_OBJ_RES_DATA(SERVER_MUTE_SEND_ID, res[index], i, res_inst[index], j, &mute_send[index], - sizeof(bool)); -#endif /* defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) */ + + if (IS_ENABLED(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1)) { + mute_send[index] = false; + priority[index] = 0; + INIT_OBJ_RES_EXECUTE(SERVER_BOOTSTRAP_UPDATE_TRIGGER_ID, res[index], i, + bootstrap_trigger_cb); + INIT_OBJ_RES_OPTDATA(SERVER_APN_LINK_ID, res[index], i, res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_TLS_DTLS_ALERT_CODE_ID, res[index], i, res_inst[index], + j); + INIT_OBJ_RES_OPTDATA(SERVER_LAST_BOOTSTRAPPED_ID, res[index], i, res_inst[index], + j); + INIT_OBJ_RES_DATA(SERVER_REGISTRATION_PRIORITY_ORDER_ID, res[index], i, + res_inst[index], j, &priority[index], sizeof(uint8_t)); + INIT_OBJ_RES_OPTDATA(SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_REGISTRATION_FAILURE_BLOCK_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_DATA(SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID, res[index], i, + res_inst[index], j, &boostrap_on_fail[index], sizeof(bool)); + INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_RETRY_COUNT_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_RETRY_TIMER_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_SEQUENCE_RETRY_TIMER_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_SMS_TRIGGER_ID, res[index], i, res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_PREFERRED_TRANSPORT_ID, res[index], i, res_inst[index], + j); + INIT_OBJ_RES_DATA(SERVER_MUTE_SEND_ID, res[index], i, res_inst[index], j, + &mute_send[index], sizeof(bool)); + } inst[index].resources = res[index]; inst[index].resource_count = i; diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_server.h b/subsys/net/lib/lwm2m/lwm2m_obj_server.h new file mode 100644 index 00000000000..56d7a674071 --- /dev/null +++ b/subsys/net/lib/lwm2m/lwm2m_obj_server.h @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef LWM2M_OBJ_SERVER_H_ +#define LWM2M_OBJ_SERVER_H_ + +#include +#include +#include + +/* Server resource IDs */ +#define SERVER_SHORT_SERVER_ID 0 +#define SERVER_LIFETIME_ID 1 +#define SERVER_DEFAULT_MIN_PERIOD_ID 2 +#define SERVER_DEFAULT_MAX_PERIOD_ID 3 +#define SERVER_DISABLE_ID 4 +#define SERVER_DISABLE_TIMEOUT_ID 5 +#define SERVER_STORE_NOTIFY_ID 6 +#define SERVER_TRANSPORT_BINDING_ID 7 +#define SERVER_REG_UPDATE_TRIGGER_ID 8 +/* Server object version 1.1 resource IDs */ +#define SERVER_BOOTSTRAP_UPDATE_TRIGGER_ID 9 +#define SERVER_APN_LINK_ID 10 +#define SERVER_TLS_DTLS_ALERT_CODE_ID 11 +#define SERVER_LAST_BOOTSTRAPPED_ID 12 +#define SERVER_REGISTRATION_PRIORITY_ORDER_ID 13 +#define SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID 14 +#define SERVER_REGISTRATION_FAILURE_BLOCK_ID 15 +#define SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID 16 +#define SERVER_COMMUNICATION_RETRY_COUNT_ID 17 +#define SERVER_COMMUNICATION_RETRY_TIMER_ID 18 +#define SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID 19 +#define SERVER_COMMUNICATION_SEQUENCE_RETRY_TIMER_ID 20 +#define SERVER_SMS_TRIGGER_ID 21 +#define SERVER_PREFERRED_TRANSPORT_ID 22 +#define SERVER_MUTE_SEND_ID 23 + +/** + * @brief Returns the default minimum period for an observation set for the server + * with object instance id given by @p obj_inst_id. + * + * @param[in] obj_inst_id Object instance id of the server object instance + * @return int32_t pmin value + */ +int32_t lwm2m_server_get_pmin(uint16_t obj_inst_id); + +/** + * @brief Returns the default maximum period for an observation set for the server + * with object instance id given by @p obj_inst_id. + * + * @param[in] obj_inst_id Object instance id of the server object instance + * @return int32_t pmax value + */ +int32_t lwm2m_server_get_pmax(uint16_t obj_inst_id); + +/** + * @brief Returns the Short Server ID of the server object instance with + * object instance id given by @p obj_inst_id. + * + * @param[in] obj_inst_id Object instance id of the server object + * @return SSID or negative in case not found + */ +int lwm2m_server_get_ssid(uint16_t obj_inst_id); + +/** + * @brief Returns the object instance id of the server having ssid given by @p short_id. + * + * @param[in] short_id ssid of the server object + * @return Object instance id or negative in case not found + */ +int lwm2m_server_short_id_to_inst(uint16_t short_id); + +/** + * @brief Check if given server instance is not disabled + * + * @param[in] obj_inst_id server instance + * @return true if not disabled, false otherwise. + */ +bool lwm2m_server_is_enabled(uint16_t obj_inst_id); + +/** + * @brief Select server instance. + * + * Find possible server instance considering values on server data. + * Server candidates cannot be in disabled state and if priority values are set, + * those are compared and lowest values are considered first. + * + * If @ref obj_inst_id is NULL, this can be used to check if there are any server available. + * + * @param[out] obj_inst_id where selected server instance ID is written. Can be NULL. + * @return true if server instance was found, false otherwise. + */ +bool lwm2m_server_select(uint16_t *obj_inst_id); + +/** + * @brief Disable server instance for a period of time. + * + * Timeout values can be calculated using kernel macros like K_SECONDS(). + * Values like K_FOREVER or K_NO_WAIT are also accepted. + * + * @param timeout Timeout value. + * @return zero on success, negative error code otherwise. + */ +int lwm2m_server_disable(uint16_t obj_inst_id, k_timeout_t timeout); + +/** + * @brief Get timepoint how long server instance is disabled. + * + * If server instance is not disabled, this still returns a valid timepoint + * that have already expired. + * If the instance id is not valid, the timepoint is set to K_FOREVER. + * + * @param obj_inst_id Server instance ID. + * @return timepoint + */ +k_timepoint_t lwm2m_server_get_disabled_time(uint16_t obj_inst_id); + +/** + * @brief Get priority of given server instance. + * + * Lower values mean higher priority. + * If LwM2M server object version 1.1 is not enabled, + * this returns obj_inst_id as priority. + * + * @param obj_inst_id instance ID + * @return priority or UINT8_MAX if instance not found + */ +uint8_t lwm2m_server_get_prio(uint16_t obj_inst_id); + +/** + * @brief Reset all disable-timers for all server instances. + * + */ +void lwm2m_server_reset_timestamps(void); + +#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) +bool lwm2m_server_get_mute_send(uint16_t obj_inst_id); +#endif + + +#endif /* LWM2M_OBJ_SERVER_H_ */ diff --git a/subsys/net/lib/lwm2m/lwm2m_observation.c b/subsys/net/lib/lwm2m/lwm2m_observation.c index 9ee1fa6eda1..1c8034e6535 100644 --- a/subsys/net/lib/lwm2m/lwm2m_observation.c +++ b/subsys/net/lib/lwm2m/lwm2m_observation.c @@ -37,6 +37,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include #include +#include "lwm2m_obj_server.h" #if defined(CONFIG_LWM2M_RW_SENML_JSON_SUPPORT) #include "lwm2m_rw_senml_json.h" diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.c b/subsys/net/lib/lwm2m/lwm2m_rd_client.c index d9f2e229edd..6eacba0ee0d 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.c +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.c @@ -62,6 +62,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include "lwm2m_rd_client.h" #include "lwm2m_rw_link_format.h" #include "lwm2m_util.h" +#include "lwm2m_obj_server.h" #define LWM2M_RD_CLIENT_URI "rd" #define CLIENT_EP_LEN CONFIG_LWM2M_RD_CLIENT_ENDPOINT_NAME_MAX_LENGTH From 73c0f6bf3b44dd9fab27af3fd2cf75b1127fa27f Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 30 Nov 2023 17:38:14 +0200 Subject: [PATCH 0125/2300] [nrf fromtree] net: lwm2m: Implement fallback mechanism and support for diable If server registration fails, allow fallback to secondary server, or fallback to bootstrap. Also allow fallback to different bootstrap server. Add API to tell RD client when server have been disabled by executable command. Changes to RD state machine: * All retry logic should be handled in NETWORK_ERROR state. * New state SERVER_DISABLED. * Internally disable servers that reject registration * Temporary disable server on network error. * Clean up all "disable timers" on start. * Select server first, then find security object for it. * State functions return void, error handling is done using states. * DISCONNECT event will only come when client is requested to stop. * NETWORK_ERROR will stop engine. This is generic error for all kinds of registration or network failures. * BOOTSTRAP_REG_FAILURE also stops engine. This is fatal, and we cannot recover. Refactoring: * Server selection logic is inside server object. * sm_handle_timeout_state() does not require msg parameter. Unused. * When bootstrap fail, we should NOT back off to registration. This is a fatal error, and it stops the engine and informs application. Signed-off-by: Seppo Takalo (cherry picked from commit dc8f6da53c856c56f9d31fec58b9bea208609c95) (cherry picked from commit c673375d64d8df0b2777168cba4ebfdabfbd7c87) --- include/zephyr/net/lwm2m.h | 1 + samples/net/lwm2m_client/src/lwm2m-client.c | 4 + subsys/net/lib/lwm2m/lwm2m_obj_server.c | 18 +- subsys/net/lib/lwm2m/lwm2m_rd_client.c | 421 +++++++++++------- subsys/net/lib/lwm2m/lwm2m_rd_client.h | 10 + .../net/lib/lwm2m/interop/src/lwm2m-client.c | 4 + .../net/lib/lwm2m/lwm2m_rd_client/src/main.c | 201 +++++++-- .../net/lib/lwm2m/lwm2m_rd_client/src/stubs.c | 22 + .../net/lib/lwm2m/lwm2m_rd_client/src/stubs.h | 9 +- 9 files changed, 495 insertions(+), 195 deletions(-) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index a57b5542f88..6ac0458af87 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -2075,6 +2075,7 @@ enum lwm2m_rd_client_event { LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR, LWM2M_RD_CLIENT_EVENT_REG_UPDATE, LWM2M_RD_CLIENT_EVENT_DEREGISTER, + LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED, }; /** diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index a120506639d..c610f1ad8dd 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -191,6 +191,10 @@ static void rd_client_event(struct lwm2m_ctx *client, /* do nothing */ break; + case LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED: + LOG_DBG("LwM2M server disabled"); + break; + case LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE: LOG_DBG("Bootstrap registration failure!"); break; diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_server.c b/subsys/net/lib/lwm2m/lwm2m_obj_server.c index 10c7a1a1ea0..a9432340038 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_server.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_server.c @@ -95,13 +95,21 @@ static struct lwm2m_engine_res_inst static int disable_cb(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len) { - int i; + ARG_UNUSED(args); + ARG_UNUSED(args_len); + + int ret; - LOG_DBG("DISABLE %d", obj_inst_id); - for (i = 0; i < MAX_INSTANCE_COUNT; i++) { + for (int i = 0; i < MAX_INSTANCE_COUNT; i++) { if (inst[i].obj && inst[i].obj_inst_id == obj_inst_id) { - disabled_until[i] = sys_timepoint_calc(K_SECONDS(disabled_timeout[i])); - return 0; + LOG_DBG("DISABLE %d", obj_inst_id); + ret = lwm2m_rd_client_server_disabled(obj_inst_id); + if (ret == 0) { + disabled_until[i] = + sys_timepoint_calc(K_SECONDS(disabled_timeout[i])); + return 0; + } + return ret; } } diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.c b/subsys/net/lib/lwm2m/lwm2m_rd_client.c index 6eacba0ee0d..6b3fbcccc68 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.c +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.c @@ -72,6 +72,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define DELAY_FOR_ACK 100U #define EXCHANGE_LIFETIME 247U #define MINIMUM_PERIOD 15 +#define DISABLE_TIMEOUT (K_SECONDS(CONFIG_LWM2M_RD_CLIENT_MAX_RETRIES * EXCHANGE_LIFETIME)) static void sm_handle_registration_update_failure(void); static int sm_send_registration_msg(void); @@ -80,6 +81,8 @@ static void lwm2m_rd_client_service(struct k_work *work); static int64_t calc_next_event(void); static void set_sm_state_delayed(uint8_t sm_state, int64_t delay_ms); static void set_sm_state(uint8_t sm_state); +/** Try to fallback to bootstrap. Return true if we did. */ +static bool fallback_to_bootstrap(void); /* The states for the RD client state machine */ /* @@ -101,6 +104,7 @@ enum sm_engine_state { ENGINE_REGISTRATION_DONE_RX_OFF, ENGINE_UPDATE_REGISTRATION, ENGINE_UPDATE_SENT, + ENGINE_SERVER_DISABLED, ENGINE_SUSPENDED, ENGINE_DEREGISTER, ENGINE_DEREGISTER_SENT, @@ -125,11 +129,11 @@ struct lwm2m_rd_client_info { char ep_name[CLIENT_EP_LEN]; char server_ep[CLIENT_EP_LEN]; - bool use_bootstrap : 1; - + bool use_bootstrap : 1; bool trigger_update : 1; bool update_objects : 1; - bool close_socket : 1; + bool close_socket : 1; + bool server_disabled: 1; } client; /* Allocate some data for queries and updates. Make sure it's large enough to @@ -201,23 +205,18 @@ static void set_sm_state_delayed(uint8_t sm_state, int64_t delay_ms) event = LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE; } else if (sm_state == ENGINE_REGISTRATION_DONE_RX_OFF) { event = LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF; - } else if ((sm_state == ENGINE_INIT || - sm_state == ENGINE_DEREGISTERED) && + } else if (sm_state == ENGINE_DEREGISTERED && (client.engine_state >= ENGINE_DO_REGISTRATION && - client.engine_state <= ENGINE_DEREGISTER_SENT)) { + client.engine_state <= ENGINE_DEREGISTER_SENT) && !client.server_disabled) { event = LWM2M_RD_CLIENT_EVENT_DISCONNECT; - } else if (sm_state == ENGINE_NETWORK_ERROR) { - lwm2m_socket_close(client.ctx); - client.retry_delay = 1 << client.retries; - client.retries++; - if (client.retries > CONFIG_LWM2M_RD_CLIENT_MAX_RETRIES) { - client.retries = 0; - event = LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR; - } } else if (sm_state == ENGINE_UPDATE_REGISTRATION) { event = LWM2M_RD_CLIENT_EVENT_REG_UPDATE; } else if (sm_state == ENGINE_DEREGISTER) { - event = LWM2M_RD_CLIENT_EVENT_DEREGISTER; + if (client.server_disabled) { + event = LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED; + } else { + event = LWM2M_RD_CLIENT_EVENT_DEREGISTER; + } } if (sm_is_suspended()) { @@ -292,27 +291,22 @@ static uint8_t get_sm_state(void) return state; } -static void sm_handle_timeout_state(struct lwm2m_message *msg, - enum sm_engine_state sm_state) +static void sm_handle_timeout_state(enum sm_engine_state sm_state) { k_mutex_lock(&client.mutex, K_FOREVER); enum lwm2m_rd_client_event event = LWM2M_RD_CLIENT_EVENT_NONE; -#if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) - if (client.engine_state == ENGINE_BOOTSTRAP_REG_SENT) { - event = LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE; - } else -#endif - { - if (client.engine_state == ENGINE_REGISTRATION_SENT) { - event = LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT; - } else if (client.engine_state == ENGINE_UPDATE_SENT) { - event = LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT; - } else if (client.engine_state == ENGINE_DEREGISTER_SENT) { - event = LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE; - } else { - /* TODO: unknown timeout state */ - } + /* Don't send BOOTSTRAP_REG_FAILURE event, that is only emitted from + * do_network_error() once we are out of retries. + */ + if (client.engine_state == ENGINE_REGISTRATION_SENT) { + event = LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT; + } else if (client.engine_state == ENGINE_UPDATE_SENT) { + event = LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT; + } else if (client.engine_state == ENGINE_DEREGISTER_SENT) { + event = LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE; + } else { + /* TODO: unknown timeout state */ } set_sm_state(sm_state); @@ -374,11 +368,14 @@ static void socket_fault_cb(int error) /* Network error state causes engine to re-register, * so only trigger that state if we are not stopping the * engine. + * Also when engine is going to be disabled, for a while, we might get spurious + * socket errors when closing, so ignore them. */ if (client.engine_state > ENGINE_IDLE && - client.engine_state < ENGINE_SUSPENDED) { - set_sm_state(ENGINE_NETWORK_ERROR); - } else if (client.engine_state != ENGINE_SUSPENDED) { + client.engine_state < ENGINE_SERVER_DISABLED) { + sm_handle_timeout_state(ENGINE_NETWORK_ERROR); + } else if (client.engine_state != ENGINE_SUSPENDED && + !client.server_disabled) { sm_handle_failure_state(ENGINE_IDLE); } } @@ -453,13 +450,7 @@ static int do_bootstrap_reply_cb(const struct coap_packet *response, static void do_bootstrap_reg_timeout_cb(struct lwm2m_message *msg) { LOG_WRN("Bootstrap Timeout"); - - /* TODO: - * Look for the "next" BOOTSTRAP server entry in our security info - */ - - /* Restart from scratch */ - sm_handle_timeout_state(msg, ENGINE_INIT); + sm_handle_timeout_state(ENGINE_NETWORK_ERROR); } #endif @@ -522,6 +513,8 @@ static int do_registration_reply_cb(const struct coap_packet *response, /* remember the last reg time */ client.last_update = k_uptime_get(); + client.server_disabled = false; + client.retries = 0; memcpy(client.server_ep, options[1].value, options[1].len); @@ -533,11 +526,12 @@ static int do_registration_reply_cb(const struct coap_packet *response, return 0; } - LOG_ERR("Failed with code %u.%u (%s). Not Retrying.", + LOG_ERR("Failed with code %u.%u (%s).", COAP_RESPONSE_CODE_CLASS(code), COAP_RESPONSE_CODE_DETAIL(code), code2str(code)); fail: - sm_handle_failure_state(ENGINE_IDLE); + lwm2m_server_disable(client.ctx->srv_obj_inst, DISABLE_TIMEOUT); + sm_handle_failure_state(ENGINE_NETWORK_ERROR); return ret; } @@ -546,8 +540,7 @@ static void do_registration_timeout_cb(struct lwm2m_message *msg) { LOG_WRN("Registration Timeout"); - /* Restart from scratch */ - sm_handle_timeout_state(msg, ENGINE_INIT); + sm_handle_timeout_state(ENGINE_NETWORK_ERROR); } static int do_update_reply_cb(const struct coap_packet *response, @@ -588,7 +581,7 @@ static void do_update_timeout_cb(struct lwm2m_message *msg) client.close_socket = true; } /* Re-do registration */ - sm_handle_timeout_state(msg, ENGINE_DO_REGISTRATION); + sm_handle_timeout_state(ENGINE_DO_REGISTRATION); } static int do_deregister_reply_cb(const struct coap_packet *response, @@ -612,7 +605,7 @@ static int do_deregister_reply_cb(const struct coap_packet *response, COAP_RESPONSE_CODE_CLASS(code), COAP_RESPONSE_CODE_DETAIL(code), code2str(code)); - sm_handle_failure_state(ENGINE_IDLE); + sm_handle_failure_state(ENGINE_DEREGISTERED); return 0; } @@ -621,10 +614,10 @@ static void do_deregister_timeout_cb(struct lwm2m_message *msg) { LOG_WRN("De-Registration Timeout"); - sm_handle_timeout_state(msg, ENGINE_IDLE); + sm_handle_timeout_state(ENGINE_DEREGISTERED); } -static bool sm_bootstrap_verify(bool bootstrap_server, int sec_obj_inst) +static bool is_bootsrap_server(int sec_obj_inst) { bool bootstrap; int ret; @@ -634,12 +627,7 @@ static bool sm_bootstrap_verify(bool bootstrap_server, int sec_obj_inst) LOG_WRN("Failed to check bootstrap, err %d", ret); return false; } - - if (bootstrap == bootstrap_server) { - return true; - } else { - return false; - } + return bootstrap; } static bool sm_update_lifetime(int srv_obj_inst, uint32_t *lifetime) @@ -665,58 +653,40 @@ static bool sm_update_lifetime(int srv_obj_inst, uint32_t *lifetime) return false; } -static int sm_select_server_inst(int sec_obj_inst, int *srv_obj_inst, - uint32_t *lifetime) -{ - uint16_t server_id; - int ret, obj_inst_id; - - ret = lwm2m_get_u16(&LWM2M_OBJ(0, sec_obj_inst, 10), &server_id); - if (ret < 0) { - LOG_WRN("Failed to obtain Short Server ID, err %d", ret); - return -EINVAL; - } - - obj_inst_id = lwm2m_server_short_id_to_inst(server_id); - if (obj_inst_id < 0) { - LOG_WRN("Failed to obtain Server Object instance, err %d", - obj_inst_id); - return -EINVAL; - } - - sm_update_lifetime(obj_inst_id, lifetime); - *srv_obj_inst = obj_inst_id; - - return 0; -} - -static int sm_select_security_inst(bool bootstrap_server, int *sec_obj_inst) +/** + * @brief Find the next security instance for bootstrapping. + * + * Search for the next security instance that has the bootstrap flag set and + * is not the same as current security instance. + * + * @param sec_obj_inst current security instance or -1. + * @return zero on success, negative on error. + */ +static int sm_next_bootstrap_inst(int *sec_obj_inst) { int i, obj_inst_id = -1; - /* lookup existing index */ - i = lwm2m_security_inst_id_to_index(*sec_obj_inst); - if (i >= 0 && sm_bootstrap_verify(bootstrap_server, *sec_obj_inst)) { - return 0; + if (*sec_obj_inst >= 0 && !is_bootsrap_server(*sec_obj_inst)) { + *sec_obj_inst = -1; } - *sec_obj_inst = -1; - /* Iterate over all instances to find the correct one. */ for (i = 0; i < CONFIG_LWM2M_SECURITY_INSTANCE_COUNT; i++) { obj_inst_id = lwm2m_security_index_to_inst_id(i); if (obj_inst_id < 0) { - LOG_WRN("Failed to get inst id for %d", i); + continue; + } + if (obj_inst_id == *sec_obj_inst) { continue; } - if (sm_bootstrap_verify(bootstrap_server, obj_inst_id)) { + if (is_bootsrap_server(obj_inst_id)) { *sec_obj_inst = obj_inst_id; return 0; } } - LOG_WRN("sec_obj_inst: No matching servers found."); + LOG_WRN("No Bootstrap servers found."); return -ENOENT; } @@ -726,24 +696,17 @@ static int sm_select_security_inst(bool bootstrap_server, int *sec_obj_inst) static int sm_do_init(void) { lwm2m_engine_stop(client.ctx); - client.ctx->sec_obj_inst = -1; - client.ctx->srv_obj_inst = -1; client.trigger_update = false; client.lifetime = 0U; - client.retries = 0U; client.last_update = 0U; client.close_socket = false; /* Do bootstrap or registration */ -#if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) - if (client.use_bootstrap) { + if (client.use_bootstrap && IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)) { set_sm_state(ENGINE_DO_BOOTSTRAP_REG); } else { set_sm_state(ENGINE_DO_REGISTRATION); } -#else - set_sm_state(ENGINE_DO_REGISTRATION); -#endif return 0; } @@ -814,7 +777,7 @@ static int sm_send_bootstrap_registration(void) return ret; } -static int sm_do_bootstrap_reg(void) +static void sm_do_bootstrap_reg(void) { int ret; @@ -824,23 +787,20 @@ static int sm_do_bootstrap_reg(void) } client.ctx->bootstrap_mode = true; - ret = sm_select_security_inst(client.ctx->bootstrap_mode, - &client.ctx->sec_obj_inst); + ret = sm_next_bootstrap_inst(&client.ctx->sec_obj_inst); if (ret < 0) { - /* no bootstrap server found, let's move to registration */ - LOG_WRN("Bootstrap server not found! Try normal registration."); - set_sm_state(ENGINE_DO_REGISTRATION); - return ret; + set_sm_state(ENGINE_NETWORK_ERROR); + return; } - LOG_INF("Bootstrap started with endpoint '%s' with client lifetime %d", - client.ep_name, client.lifetime); + LOG_INF("Bootstrap started with endpoint '%s' using security object %d", + client.ep_name, client.ctx->sec_obj_inst); ret = lwm2m_engine_start(client.ctx); if (ret < 0) { LOG_ERR("Cannot init LWM2M engine (%d)", ret); set_sm_state(ENGINE_NETWORK_ERROR); - return ret; + return; } ret = sm_send_bootstrap_registration(); @@ -851,7 +811,7 @@ static int sm_do_bootstrap_reg(void) set_sm_state(ENGINE_NETWORK_ERROR); } - return ret; + return; } void engine_bootstrap_finish(void) @@ -1047,8 +1007,9 @@ static int sm_send_registration_msg(void) return ret; } -static int sm_do_registration(void) +static void sm_do_registration(void) { + uint16_t ssid; int ret = 0; if (client.ctx->connection_suspended) { @@ -1056,10 +1017,16 @@ static int sm_do_registration(void) lwm2m_engine_context_close(client.ctx); /* perform full registration */ set_sm_state(ENGINE_DO_REGISTRATION); - return 0; + return; } } else { + bool select_srv = true; + uint16_t srv = (uint16_t) client.ctx->srv_obj_inst; + + client.last_update = 0; + client.ctx->bootstrap_mode = false; + /* clear out existing connection data */ if (client.ctx->sock_fd > -1) { if (client.close_socket) { @@ -1068,43 +1035,58 @@ static int sm_do_registration(void) lwm2m_engine_stop(client.ctx); } else { lwm2m_engine_context_close(client.ctx); + /* Keep current connection, retry registration with same server */ + select_srv = false; } } - client.last_update = 0; + if (select_srv) { + /* Select next one from the list, or fail */ + if (!lwm2m_server_select(&srv)) { + LOG_ERR("Unable to find a valid server instance."); + goto bootstrap_or_retry; + } - client.ctx->bootstrap_mode = false; - ret = sm_select_security_inst(client.ctx->bootstrap_mode, - &client.ctx->sec_obj_inst); - if (ret < 0) { - LOG_ERR("Unable to find a valid security instance."); - set_sm_state(ENGINE_INIT); - return -EINVAL; - } + client.ctx->srv_obj_inst = srv; + sm_update_lifetime(srv, &client.lifetime); - ret = sm_select_server_inst(client.ctx->sec_obj_inst, - &client.ctx->srv_obj_inst, - &client.lifetime); - if (ret < 0) { - LOG_ERR("Unable to find a valid server instance."); - set_sm_state(ENGINE_INIT); - return -EINVAL; + ret = lwm2m_get_u16(&LWM2M_OBJ(1, client.ctx->srv_obj_inst, 0), &ssid); + if (ret < 0) { + LOG_ERR("Failed to read SSID"); + lwm2m_server_disable(srv, K_FOREVER); + goto bootstrap_or_retry; + } + + ret = lwm2m_security_short_id_to_inst(ssid); + if (ret < 0) { + LOG_ERR("Unable to find a valid security instance."); + lwm2m_server_disable(srv, K_FOREVER); + goto bootstrap_or_retry; + } + client.ctx->sec_obj_inst = (uint16_t) ret; } - LOG_INF("RD Client started with endpoint '%s' with client lifetime %d", - client.ep_name, client.lifetime); + LOG_INF("RD Client started with endpoint '%s' with client lifetime %d using server " + "object %d", + client.ep_name, client.lifetime, client.ctx->srv_obj_inst); ret = lwm2m_engine_start(client.ctx); if (ret < 0) { LOG_ERR("Cannot init LWM2M engine (%d)", ret); - set_sm_state(ENGINE_NETWORK_ERROR); - return ret; + goto bootstrap_or_retry; } } - ret = sm_send_registration_msg(); + sm_send_registration_msg(); + return; - return ret; +bootstrap_or_retry: + lwm2m_engine_stop(client.ctx); + if (!client.server_disabled && fallback_to_bootstrap()) { + return; + } + + set_sm_state(ENGINE_NETWORK_ERROR); } static int64_t next_update(void) @@ -1269,32 +1251,116 @@ static int sm_do_deregister(void) return ret; } +static bool fallback_to_bootstrap(void) +{ + if (IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)) { + bool fallback = true; + + (void)lwm2m_get_bool(&LWM2M_OBJ(LWM2M_OBJECT_SERVER_ID, client.ctx->srv_obj_inst, + SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID), + &fallback); + if (fallback) { + client.use_bootstrap = true; + set_sm_state(ENGINE_INIT); + return true; + } + } + return false; +} + static void sm_do_network_error(void) { int err; + LOG_ERR("sm_do_network_error, retries %d", client.retries); + + lwm2m_socket_close(client.ctx); + if (client.retry_delay) { - client.retry_delay = 0; next_event_at(k_uptime_get() + client.retry_delay * MSEC_PER_SEC); + client.retry_delay = 0; return; } + client.retry_delay = 1 << client.retries; + client.retries++; -#if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) - if (client.ctx->bootstrap_mode) { - lwm2m_engine_context_close(client.ctx); - set_sm_state(ENGINE_DO_BOOTSTRAP_REG); - return; + /* Stop retrying and try fallback */ + if (client.retries > CONFIG_LWM2M_RD_CLIENT_MAX_RETRIES) { + LOG_ERR("Network error, max retries reached (%d)", client.retries); + + /* Disable current server for a period so lwm2m_server_select() does not pick it */ + if (client.ctx->srv_obj_inst > -1) { + lwm2m_server_disable(client.ctx->srv_obj_inst, DISABLE_TIMEOUT); + } + + /* Are we in bootstrap? Try if we can fallback to some other BS server */ + if (client.ctx->bootstrap_mode && + IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)) { + LOG_DBG("In bootstrap, try fallback srv"); + /* Do we have any other bootstrap server to back off to? */ + if (sm_next_bootstrap_inst(&client.ctx->sec_obj_inst) < 0) { + /* No, we are out of options, stop engine */ + goto stop_engine; + } + set_sm_state(ENGINE_INIT); + return; + } + + /* Try if there are other server to fall back to, + * Only allow fallback to higher priority server (lower value, or lower id) + * if we have successfully registered before. + * This should block us from looping the same list again. + * Instead we should fallback to bootstrap. + */ + uint16_t srv; + + if (lwm2m_server_select(&srv)) { + uint8_t p1, p2; + + p1 = lwm2m_server_get_prio(client.ctx->srv_obj_inst); + p2 = lwm2m_server_get_prio(srv); + if (p1 < p2 || client.last_update != 0) { + set_sm_state(ENGINE_INIT); + return; + } + } + + /* If we have been disabled by some server, don't fall back to bootstrap */ + if (client.server_disabled) { + set_sm_state(ENGINE_SERVER_DISABLED); + return; + } + + if (fallback_to_bootstrap()) { + return; + } + goto stop_engine; + } + + /* Retry bootstrap */ + if (IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)) { + if (client.ctx->bootstrap_mode) { + lwm2m_engine_context_close(client.ctx); + /* If we don't have fallback BS server, retry with current one */ + if (sm_next_bootstrap_inst(&client.ctx->sec_obj_inst) < 0) { + client.ctx->sec_obj_inst = -1; + } + set_sm_state(ENGINE_DO_BOOTSTRAP_REG); + return; + } } -#endif if (!client.last_update || (k_uptime_get() - client.last_update) / MSEC_PER_SEC > client.lifetime) { /* do full registration as there is no active registration or lifetime exceeded */ - lwm2m_engine_context_close(client.ctx); + /* Keep the same server until out of retry */ set_sm_state(ENGINE_DO_REGISTRATION); return; } + /* Try if we can recover the DTLS session and try Update. + * This might fallback into full registration on sm_handle_registration_update_failure(). + */ err = lwm2m_socket_start(client.ctx); if (err) { LOG_ERR("Failed to start socket %d", err); @@ -1305,8 +1371,21 @@ static void sm_do_network_error(void) set_sm_state(ENGINE_NETWORK_ERROR); return; } - set_sm_state(ENGINE_UPDATE_REGISTRATION); + return; + +stop_engine: + + /* We are out of options, stop engine */ + if (client.ctx->event_cb) { + if (client.ctx->bootstrap_mode) { + client.ctx->event_cb(client.ctx, + LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE); + } else { + client.ctx->event_cb(client.ctx, LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR); + } + } + set_sm_state(ENGINE_IDLE); } static void lwm2m_rd_client_service(struct k_work *work) @@ -1380,6 +1459,19 @@ static void lwm2m_rd_client_service(struct k_work *work) timeout = EXCHANGE_LIFETIME; break; + case ENGINE_SERVER_DISABLED: + if (lwm2m_server_select(NULL)) { + set_sm_state(ENGINE_INIT); + } else { + /* wait for server to be enabled. */ + /* + * TODO: Once engine is converted to use timepoint_t + * this should calculate the next event from the previous server. + */ + next_event_at(k_uptime_get() + SEC_PER_MIN * MSEC_PER_SEC); + } + break; + case ENGINE_DEREGISTER: sm_do_deregister(); break; @@ -1391,7 +1483,11 @@ static void lwm2m_rd_client_service(struct k_work *work) case ENGINE_DEREGISTERED: lwm2m_engine_stop(client.ctx); - set_sm_state(ENGINE_IDLE); + if (client.server_disabled) { + set_sm_state(ENGINE_SERVER_DISABLED); + } else { + set_sm_state(ENGINE_IDLE); + } break; case ENGINE_NETWORK_ERROR: @@ -1408,7 +1504,7 @@ static void lwm2m_rd_client_service(struct k_work *work) if (end < k_uptime_get()) { LOG_DBG("State machine have timed out"); - sm_handle_timeout_state(NULL, ENGINE_INIT); + sm_handle_timeout_state(ENGINE_INIT); } else if (client.next_event > end) { next_event_at(end); } @@ -1442,6 +1538,7 @@ int lwm2m_rd_client_start(struct lwm2m_ctx *client_ctx, const char *ep_name, } /* Init Context */ + lwm2m_server_reset_timestamps(); lwm2m_engine_context_init(client_ctx); client.ctx = client_ctx; @@ -1450,13 +1547,15 @@ int lwm2m_rd_client_start(struct lwm2m_ctx *client_ctx, const char *ep_name, client.ctx->observe_cb = observe_cb; client.ctx->event_cb = event_cb; client.use_bootstrap = flags & LWM2M_RD_CLIENT_FLAG_BOOTSTRAP; + client.ctx->srv_obj_inst = -1; + client.ctx->sec_obj_inst = -1; + client.retries = 0; - set_sm_state(ENGINE_INIT); strncpy(client.ep_name, ep_name, CLIENT_EP_LEN - 1); client.ep_name[CLIENT_EP_LEN - 1] = '\0'; LOG_INF("Start LWM2M Client: %s", client.ep_name); - next_event_at(0); + set_sm_state(ENGINE_INIT); k_mutex_unlock(&client.mutex); @@ -1477,9 +1576,10 @@ int lwm2m_rd_client_stop(struct lwm2m_ctx *client_ctx, client.ctx->event_cb = event_cb; rd_client_message_free(); - if (sm_is_registered() && deregister) { + if (sm_is_registered() && deregister && !client.server_disabled) { set_sm_state(ENGINE_DEREGISTER); } else { + client.server_disabled = false; set_sm_state(ENGINE_DEREGISTERED); } @@ -1557,7 +1657,7 @@ int lwm2m_rd_client_resume(void) #endif /* Or do we resume into registration state */ if (client.engine_state >= ENGINE_DO_REGISTRATION && - client.engine_state <= ENGINE_SUSPENDED) { + client.engine_state <= ENGINE_SERVER_DISABLED) { if (!client.last_update || (client.lifetime <= (k_uptime_get() - client.last_update) / MSEC_PER_SEC)) { /* No lifetime left, register again */ @@ -1575,6 +1675,29 @@ int lwm2m_rd_client_resume(void) return 0; } +int lwm2m_rd_client_server_disabled(uint16_t inst_id) +{ + if (client.ctx->srv_obj_inst != inst_id) { + return -EPERM; + } + + k_mutex_lock(&client.mutex, K_FOREVER); + + client.server_disabled = true; + + if (sm_is_registered()) { + LOG_INF("Server disabled, deregister"); + set_sm_state_delayed(ENGINE_DEREGISTER, DELAY_BEFORE_CLOSING); + } else { + LOG_INF("Server disabled"); + set_sm_state(ENGINE_DEREGISTERED); + } + + k_mutex_unlock(&client.mutex); + + return 0; +} + void lwm2m_rd_client_update(void) { engine_trigger_update(false); diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.h b/subsys/net/lib/lwm2m/lwm2m_rd_client.h index 66a3aac20f3..5d71ccb30f6 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.h +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.h @@ -56,4 +56,14 @@ int lwm2m_rd_client_connection_resume(struct lwm2m_ctx *client_ctx); void engine_update_tx_time(void); struct lwm2m_message *lwm2m_get_ongoing_rd_msg(void); +/** + * @brief Notify RD client that this server is disabled. + * + * This may return error -EPERM, if RD client is not registered on that server. + * + * @param inst_id server instance id + * @return int 0 on success, negative errno on failure. + */ +int lwm2m_rd_client_server_disabled(uint16_t inst_id); + #endif /* LWM2M_RD_CLIENT_H */ diff --git a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c index 706091659a5..b6634069fbd 100644 --- a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c +++ b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c @@ -119,6 +119,10 @@ static void rd_client_event(struct lwm2m_ctx *client, /* do nothing */ break; + case LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED: + LOG_DBG("LwM2M server disabled"); + break; + case LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE: LOG_DBG("Bootstrap registration failure!"); break; diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c b/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c index 208298512d4..1d6a4e584fa 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c @@ -21,7 +21,7 @@ DEFINE_FFF_GLOBALS; /* Maximum number of iterations within the state machine of RD Client * service that is waited for until a possible event occurs */ -static const uint8_t RD_CLIENT_MAX_LOOKUP_ITERATIONS = 100; +#define RD_CLIENT_MAX_LOOKUP_ITERATIONS 500 FAKE_VOID_FUNC(show_lwm2m_event, enum lwm2m_rd_client_event); FAKE_VOID_FUNC(show_lwm2m_observe, enum lwm2m_observe_event); @@ -97,6 +97,9 @@ static void lwm2m_event_cb(struct lwm2m_ctx *client, enum lwm2m_rd_client_event case LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF: LOG_INF("*** LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF"); break; + case LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED: + LOG_INF("*** LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED"); + break; case LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED: LOG_INF("*** LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED"); break; @@ -165,6 +168,7 @@ static void my_suite_before(void *data) lwm2m_init_message_fake.custom_fake = lwm2m_init_message_fake_default; coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; coap_packet_append_option_fake.custom_fake = NULL; + stub_lwm2m_server_disable(false); } static void my_suite_after(void *data) @@ -198,8 +202,6 @@ ZTEST(lwm2m_rd_client, test_start_registration_ok) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -207,6 +209,7 @@ ZTEST(lwm2m_rd_client, test_start_registration_ok) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert(lwm2m_rd_client_ctx() == &ctx, ""); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -228,8 +231,6 @@ ZTEST(lwm2m_rd_client, test_register_update_too_small_lifetime_to_default) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -237,6 +238,7 @@ ZTEST(lwm2m_rd_client, test_register_update_too_small_lifetime_to_default) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert(lwm2m_rd_client_ctx() == &ctx, ""); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -249,14 +251,13 @@ ZTEST(lwm2m_rd_client, test_timeout_resume_registration) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert(lwm2m_rd_client_ctx() == &ctx, ""); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -273,16 +274,17 @@ ZTEST(lwm2m_rd_client, test_start_registration_timeout) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_timeout_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_DISCONNECT), NULL); + test_prepare_pending_message_cb(&message_reply_timeout_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR), NULL); } ZTEST(lwm2m_rd_client, test_start_registration_fail) @@ -291,8 +293,6 @@ ZTEST(lwm2m_rd_client, test_start_registration_fail) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -302,8 +302,15 @@ ZTEST(lwm2m_rd_client, test_start_registration_fail) lwm2m_init_message_fake.custom_fake = lwm2m_init_message_fake_default; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE), + NULL); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE), NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE), + NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR), + NULL); } ZTEST(lwm2m_rd_client, test_start_registration_update) @@ -312,8 +319,6 @@ ZTEST(lwm2m_rd_client, test_start_registration_update) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -321,6 +326,7 @@ ZTEST(lwm2m_rd_client, test_start_registration_update) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -335,8 +341,6 @@ ZTEST(lwm2m_rd_client, test_rx_off) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -344,6 +348,7 @@ ZTEST(lwm2m_rd_client, test_rx_off) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -359,8 +364,6 @@ ZTEST(lwm2m_rd_client, test_start_registration_update_fail) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -368,6 +371,7 @@ ZTEST(lwm2m_rd_client, test_start_registration_update_fail) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -384,8 +388,6 @@ ZTEST(lwm2m_rd_client, test_registration_update_timeout) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -393,6 +395,7 @@ ZTEST(lwm2m_rd_client, test_registration_update_timeout) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); test_prepare_pending_message_cb(&message_reply_timeout_cb_default); @@ -415,8 +418,6 @@ ZTEST(lwm2m_rd_client, test_deregistration_timeout) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -424,6 +425,7 @@ ZTEST(lwm2m_rd_client, test_deregistration_timeout) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -439,8 +441,6 @@ ZTEST(lwm2m_rd_client, test_error_on_registration_update) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -449,6 +449,8 @@ ZTEST(lwm2m_rd_client, test_error_on_registration_update) coap_packet_append_option_fake.custom_fake = NULL; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -482,8 +484,6 @@ ZTEST(lwm2m_rd_client, test_suspend_resume_registration) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -491,6 +491,7 @@ ZTEST(lwm2m_rd_client, test_suspend_resume_registration) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); zassert_true(!lwm2m_rd_client_is_suspended(&ctx), NULL); @@ -517,8 +518,6 @@ ZTEST(lwm2m_rd_client, test_suspend_stop_resume) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -527,6 +526,7 @@ ZTEST(lwm2m_rd_client, test_suspend_stop_resume) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); zassert_true(lwm2m_rd_client_pause() == 0, NULL); @@ -544,8 +544,6 @@ ZTEST(lwm2m_rd_client, test_socket_error) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -554,6 +552,7 @@ ZTEST(lwm2m_rd_client, test_socket_error) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -569,8 +568,6 @@ ZTEST(lwm2m_rd_client, test_socket_error_on_stop) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -579,6 +576,7 @@ ZTEST(lwm2m_rd_client, test_socket_error_on_stop) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -608,8 +606,6 @@ ZTEST(lwm2m_rd_client, test_engine_trigger_bootstrap) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -617,6 +613,7 @@ ZTEST(lwm2m_rd_client, test_engine_trigger_bootstrap) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_true; @@ -638,8 +635,6 @@ ZTEST(lwm2m_rd_client, test_bootstrap_timeout) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_timeout_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -651,6 +646,7 @@ ZTEST(lwm2m_rd_client, test_bootstrap_timeout) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 1, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_timeout_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE), NULL); } @@ -661,8 +657,6 @@ ZTEST(lwm2m_rd_client, test_bootstrap_fail) (void)memset(&ctx, 0x0, sizeof(ctx)); - test_prepare_pending_message_cb(&message_reply_cb_default); - lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -674,27 +668,154 @@ ZTEST(lwm2m_rd_client, test_bootstrap_fail) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 1, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE), NULL); } -ZTEST(lwm2m_rd_client, test_bootstrap_no_srv_fallback_to_register) +ZTEST(lwm2m_rd_client, test_bootstrap_no_srv) { struct lwm2m_ctx ctx; (void)memset(&ctx, 0x0, sizeof(ctx)); + lwm2m_rd_client_init(); + test_lwm2m_engine_start_service(); + wait_for_service(1); + + coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; + zassert_true(lwm2m_rd_client_start(&ctx, "Test", 1, lwm2m_event_cb, lwm2m_observe_cb) == 0, + NULL); test_prepare_pending_message_cb(&message_reply_cb_default); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE), + NULL); +} + +ZTEST(lwm2m_rd_client, test_disable_server) +{ + struct lwm2m_ctx ctx; + + (void)memset(&ctx, 0x0, sizeof(ctx)); lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; - zassert_true(lwm2m_rd_client_start(&ctx, "Test", 1, lwm2m_event_cb, lwm2m_observe_cb) == 0, + zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), + NULL); + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; + stub_lwm2m_server_disable(true); + lwm2m_rd_client_server_disabled(0); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED), + NULL); +} + +ZTEST(lwm2m_rd_client, test_disable_server_stop) +{ + struct lwm2m_ctx ctx; + + (void)memset(&ctx, 0x0, sizeof(ctx)); + + lwm2m_rd_client_init(); + test_lwm2m_engine_start_service(); + wait_for_service(1); + + coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; + zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, + NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), + NULL); + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; + stub_lwm2m_server_disable(true); + lwm2m_rd_client_server_disabled(0); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED), + NULL); + wait_for_service(1); + zassert_true(lwm2m_rd_client_stop(&ctx, lwm2m_event_cb, true) == 0, NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_DISCONNECT), NULL); +} + +ZTEST(lwm2m_rd_client, test_disable_server_connect) +{ + struct lwm2m_ctx ctx; + + (void)memset(&ctx, 0x0, sizeof(ctx)); + + lwm2m_rd_client_init(); + test_lwm2m_engine_start_service(); + wait_for_service(1); + + coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; + zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, + NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), + NULL); + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; + stub_lwm2m_server_disable(true); + lwm2m_rd_client_server_disabled(0); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED), + NULL); + + wait_for_service(500); + + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; + stub_lwm2m_server_disable(false); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), + NULL); +} + +ZTEST(lwm2m_rd_client, test_fallback_to_bootstrap) +{ + struct lwm2m_ctx ctx; + + (void)memset(&ctx, 0x0, sizeof(ctx)); + + lwm2m_rd_client_init(); + test_lwm2m_engine_start_service(); + wait_for_service(1); + + lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_true; + zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, + NULL); + test_prepare_pending_message_cb(&message_reply_timeout_cb_default); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); + + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE), + NULL); +} + +ZTEST(lwm2m_rd_client, test_no_srv_fallback_to_bootstrap) +{ + struct lwm2m_ctx ctx; + + (void)memset(&ctx, 0x0, sizeof(ctx)); + + lwm2m_rd_client_init(); + test_lwm2m_engine_start_service(); + wait_for_service(1); + + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_changed; + lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_true; + stub_lwm2m_server_disable(true); + zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, + NULL); + test_prepare_pending_message_cb(&message_reply_cb_default); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_COMPLETE), + NULL); + coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; + coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; + stub_lwm2m_server_disable(false); + engine_bootstrap_finish(); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); } diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c index 3cbde9060ce..621057f8496 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c @@ -116,6 +116,24 @@ char *lwm2m_sprint_ip_addr_fake_default(const struct sockaddr *addr) DEFINE_FAKE_VALUE_FUNC(int, lwm2m_server_short_id_to_inst, uint16_t); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_security_index_to_inst_id, int); +DEFINE_FAKE_VALUE_FUNC(int, lwm2m_security_short_id_to_inst, uint16_t); +DEFINE_FAKE_VALUE_FUNC(int, lwm2m_server_disable, uint16_t, k_timeout_t); +DEFINE_FAKE_VALUE_FUNC(uint8_t, lwm2m_server_get_prio, uint16_t); +DEFINE_FAKE_VOID_FUNC(lwm2m_server_reset_timestamps); + +static bool srv_disabled; +bool lwm2m_server_select(uint16_t *obj_inst_id) +{ + if (obj_inst_id) { + *obj_inst_id = 0; + } + return !srv_disabled; +} + +void stub_lwm2m_server_disable(bool disable) +{ + srv_disabled = disable; +} k_work_handler_t service; int64_t next; @@ -177,9 +195,13 @@ void test_lwm2m_engine_start_service(void) void test_lwm2m_engine_stop_service(void) { + struct k_work_sync sync; + pending_message_cb = NULL; + pending_message = NULL; running = false; k_work_cancel(&service_work); + k_work_flush(&service_work, &sync); } /* subsys/net/lib/lwm2m/lwm2m_message_handling.h */ diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h index 1276dd5c109..0a3ce31d9e8 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h @@ -59,6 +59,8 @@ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_close, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_close_socket, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_suspend, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_inst_id_to_index, uint16_t); +DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_short_id_to_inst, uint16_t); +DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_index_to_inst_id, int); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_engine_connection_resume, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_push_queued_buffers, struct lwm2m_ctx *); DECLARE_FAKE_VOID_FUNC(lwm2m_engine_context_init, struct lwm2m_ctx *); @@ -68,10 +70,15 @@ DECLARE_FAKE_VOID_FUNC(lwm2m_engine_context_close, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(char *, lwm2m_sprint_ip_addr, const struct sockaddr *); char *lwm2m_sprint_ip_addr_fake_default(const struct sockaddr *addr); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_server_short_id_to_inst, uint16_t); -DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_index_to_inst_id, int); +DECLARE_FAKE_VALUE_FUNC(int, lwm2m_server_disable, uint16_t, k_timeout_t); +DECLARE_FAKE_VALUE_FUNC(uint8_t, lwm2m_server_get_prio, uint16_t); +DECLARE_FAKE_VOID_FUNC(lwm2m_server_reset_timestamps); + + void wait_for_service(uint16_t cycles); void test_lwm2m_engine_start_service(void); void test_lwm2m_engine_stop_service(void); +void stub_lwm2m_server_disable(bool disable); /* subsys/net/lib/lwm2m/lwm2m_message_handling.h */ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_init_message, struct lwm2m_message *); From 56dc01d77ebb4fb5c6c59142854aa5423219c287 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 1 Dec 2023 16:15:13 +0200 Subject: [PATCH 0126/2300] [nrf fromtree] test: lwm2m: Refactor tests to work with fallback changes In fallback refactoring to the LwM2M engine, some changes to the server object are visible in hard-coded test values. Also, add Endpoint wrapper class that ensures the registration state of the returned endpoint. Signed-off-by: Seppo Takalo (cherry picked from commit 30dcf1b30979c11f7fbd4b2edfa6d43ea8356667) (cherry picked from commit 1b26dba2528d3ba817bce40d0d5d95e312fdb977) --- .../net/lib/lwm2m/interop/pytest/conftest.py | 34 +++++++++++++++---- .../lib/lwm2m/interop/pytest/test_lwm2m.py | 9 ++--- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/pytest/conftest.py b/tests/net/lib/lwm2m/interop/pytest/conftest.py index 9ca971b85c7..7d3ea4e7f80 100644 --- a/tests/net/lib/lwm2m/interop/pytest/conftest.py +++ b/tests/net/lib/lwm2m/interop/pytest/conftest.py @@ -27,6 +27,25 @@ logger = logging.getLogger(__name__) +class Endpoint: + def __init__(self, name: str, shell: Shell, registered: bool = False, bootstrap: bool = False): + self.name = name + self.registered = registered + self.bootstrap = bootstrap + self.shell = shell + self.last_update = 0.0 + + def check_update(self): + if not self.registered: + return + if self.last_update < time.time() - 5: + self.shell.exec_command('lwm2m update') + self.last_update = time.time() + + def __str__(self): + return self.name + + @pytest.fixture(scope='session') def leshan() -> Leshan: """ @@ -89,9 +108,8 @@ def endpoint_nosec(shell: Shell, dut: DeviceAdapter, leshan: Leshan) -> str: shell.exec_command('lwm2m write 1/0/0 -u16 1') shell.exec_command('lwm2m write 1/0/1 -u32 86400') shell.exec_command(f'lwm2m start {ep} -b 0') - dut.readlines_until(regex=f"RD Client started with endpoint '{ep}'", timeout=10.0) - yield ep + yield Endpoint(ep, shell) # All done shell.exec_command('lwm2m stop') @@ -125,7 +143,7 @@ def endpoint_bootstrap(shell: Shell, dut: DeviceAdapter, leshan: Leshan, leshan_ shell.exec_command(f'lwm2m write 0/0/5 -s {bs_passwd}') shell.exec_command(f'lwm2m start {ep} -b 1') - yield ep + yield Endpoint(ep, shell) shell.exec_command('lwm2m stop') dut.readlines_until(regex=r'.*Deregistration success', timeout=10.0) @@ -137,12 +155,16 @@ def endpoint_bootstrap(shell: Shell, dut: DeviceAdapter, leshan: Leshan, leshan_ leshan_bootstrap.delete_bs_device(ep) @pytest.fixture(scope='module') -def endpoint_registered(endpoint_bootstrap, shell: Shell, dut: DeviceAdapter) -> str: +def endpoint_registered(endpoint_bootstrap, dut: DeviceAdapter) -> str: """Fixture that returns an endpoint that is registered.""" - dut.readlines_until(regex='.*Registration Done', timeout=5.0) + if not endpoint_bootstrap.registered: + dut.readlines_until(regex='.*Registration Done', timeout=5.0) + endpoint_bootstrap.bootstrap = True + endpoint_bootstrap.registered = True return endpoint_bootstrap -@pytest.fixture(scope='module') +@pytest.fixture(scope='function') def endpoint(endpoint_registered) -> str: """Fixture that returns an endpoint that is registered.""" + endpoint_registered.check_update() return endpoint_registered diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index 131acb68e14..ed7aaceac20 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -171,6 +171,7 @@ def verify_setting_basic_in_format(shell, leshan, endpoint, format): verify_server_object(server_obj) # Remove Read-Only resources, so we don't end up writing those del server_obj[0][0] + del server_obj[0][13] data = { 2: 101, 3: 1010, @@ -208,7 +209,7 @@ def test_LightweightM2M_1_1_int_222(shell: Shell, leshan: Leshan, endpoint: str) """LightweightM2M-1.1-int-222 - Read on Object""" resp = leshan.read(endpoint, '1') assert len(resp) == 1 - assert len(resp[1][0]) == 9 + assert len(resp[1][0]) == 11 resp = leshan.read(endpoint, '3') assert len(resp) == 1 assert len(resp[3]) == 1 @@ -218,7 +219,7 @@ def test_LightweightM2M_1_1_int_222(shell: Shell, leshan: Leshan, endpoint: str) def test_LightweightM2M_1_1_int_223(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-223 - Read on Object Instance""" resp = leshan.read(endpoint, '1/0') - assert len(resp[0]) == 9 + assert len(resp[0]) == 11 resp = leshan.read(endpoint, '3/0') assert len(resp[0]) == 15 assert resp[0][0] == 'Zephyr' @@ -282,7 +283,7 @@ def test_LightweightM2M_1_1_int_229(shell: Shell, leshan: Leshan, endpoint: str) assert resp[3] is not None assert resp[1][0] is not None assert len(resp[3][0]) == 15 - assert len(resp[1][0]) == 9 + assert len(resp[1][0]) == 11 resp = leshan.composite_read(endpoint, ['1/0/1', '/3/0/11/0']) logger.debug(resp) @@ -370,7 +371,7 @@ def test_LightweightM2M_1_1_int_234(shell: Shell, leshan: Leshan, endpoint: str) def test_LightweightM2M_1_1_int_235(leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-235 - Read-Composite Operation on root path""" resp = leshan.composite_read(endpoint, ['/']) - expected_keys = [16, 1, 3, 5] + expected_keys = [1, 3, 5] missing_keys = [key for key in expected_keys if key not in resp.keys()] assert len(missing_keys) == 0 From d41479647f22e5a2cf21aa804d28681b23c73b8b Mon Sep 17 00:00:00 2001 From: Nick Ward Date: Tue, 5 Dec 2023 07:59:37 +1100 Subject: [PATCH 0127/2300] [nrf fromtree] net: lwm2m: device object: use LWM2M_DEVICE_ERROR_NONE Use LWM2M_DEVICE_ERROR_NONE macro. Signed-off-by: Nick Ward (cherry picked from commit b75a3f691d0130059e7943cb6aafebc21722b55a) (cherry picked from commit 789fd359bd995a28bcfbeca023b98393b23655a5) --- subsys/net/lib/lwm2m/lwm2m_obj_device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_device.c b/subsys/net/lib/lwm2m/lwm2m_obj_device.c index c17815795c2..7df9df03a93 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_device.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_device.c @@ -89,7 +89,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); DEVICE_EXT_DEV_INFO_MAX) /* resource state variables */ -static uint8_t error_code_list[DEVICE_ERROR_CODE_MAX]; +static uint8_t error_code_list[DEVICE_ERROR_CODE_MAX] = { LWM2M_DEVICE_ERROR_NONE }; static time_t time_temp; static time_t time_offset; static uint8_t binding_mode[DEVICE_STRING_SHORT]; @@ -138,7 +138,7 @@ static int reset_error_list_cb(uint16_t obj_inst_id, /* "delete" error codes */ for (i = 0; i < DEVICE_ERROR_CODE_MAX; i++) { - error_code_list[i] = 0; + error_code_list[i] = LWM2M_DEVICE_ERROR_NONE; error_code_ri[i].res_inst_id = RES_INSTANCE_NOT_CREATED; } @@ -188,7 +188,7 @@ int lwm2m_device_add_err(uint8_t error_code) int i; for (i = 0; i < DEVICE_ERROR_CODE_MAX; i++) { - if (error_code_list[i] == 0) { + if (error_code_list[i] == LWM2M_DEVICE_ERROR_NONE) { break; } From 28275ad931e08ae74ac7a196c54032812a1a6c33 Mon Sep 17 00:00:00 2001 From: Nick Ward Date: Tue, 5 Dec 2023 08:11:36 +1100 Subject: [PATCH 0128/2300] [nrf fromtree] net: lwm2m: device object: optionally store error list in settings A device can be reset before the error code list is communicated to a LwM2M server so optionally store error list in settings so it can restored after reset. Signed-off-by: Nick Ward (cherry picked from commit b1d24e425c3a30cdf1aed3c54c25a2518061accc) (cherry picked from commit ac786725181640eaabd87a07b8b81064a4410101) --- subsys/net/lib/lwm2m/Kconfig | 7 ++ subsys/net/lib/lwm2m/lwm2m_obj_device.c | 106 ++++++++++++++++++++++-- 2 files changed, 105 insertions(+), 8 deletions(-) diff --git a/subsys/net/lib/lwm2m/Kconfig b/subsys/net/lib/lwm2m/Kconfig index dd3c0c45618..1e5a7ac8f6a 100644 --- a/subsys/net/lib/lwm2m/Kconfig +++ b/subsys/net/lib/lwm2m/Kconfig @@ -392,6 +392,13 @@ config LWM2M_COMPOSITE_PATH_LIST_SIZE help Define path list size for Composite Read and send operation. +config LWM2M_DEVICE_ERROR_CODE_SETTINGS + bool "Use settings to store error codes across device resets" + depends on SETTINGS + help + Store the device error code list in settings. Ensures error list can + be transferred to LwM2M server even if the device is reset. + config LWM2M_DEVICE_PWRSRC_MAX int "Maximum # of device power source records" default 5 diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_device.c b/subsys/net/lib/lwm2m/lwm2m_obj_device.c index 7df9df03a93..9416b3cf92c 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_device.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_device.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2017 Linaro Limited * Copyright (c) 2018-2019 Foundries.io + * Copyright (c) 2023 FTP Technologies * * SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +20,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include #include +#include #include "lwm2m_object.h" #include "lwm2m_engine.h" @@ -129,10 +131,12 @@ static struct lwm2m_engine_res_inst res_inst[RESOURCE_INSTANCE_COUNT]; /* save error code resource instance point so we can easily clear later */ static struct lwm2m_engine_res_inst *error_code_ri; +#define SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE "lwm2m_obj_dev" +#define ERROR_LIST_KEY "err" + /* callbacks */ -static int reset_error_list_cb(uint16_t obj_inst_id, - uint8_t *args, uint16_t args_len) +static void reset_error_list(void) { int i; @@ -144,8 +148,29 @@ static int reset_error_list_cb(uint16_t obj_inst_id, /* Default error code indicating no error */ error_code_ri[0].res_inst_id = 0; +} + +static int reset_error_list_cb(uint16_t obj_inst_id, + uint8_t *args, uint16_t args_len) +{ + int ret = 0; + + ARG_UNUSED(obj_inst_id); + ARG_UNUSED(args); + ARG_UNUSED(args_len); + + reset_error_list(); - return 0; + lwm2m_notify_observer(LWM2M_OBJECT_DEVICE_ID, 0, DEVICE_ERROR_CODE_ID); + + if (IS_ENABLED(CONFIG_LWM2M_DEVICE_ERROR_CODE_SETTINGS)) { + ret = settings_delete(SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE "/" ERROR_LIST_KEY); + if (ret != 0) { + LOG_ERR("Couldn't save error list: %d", ret); + } + } + + return ret; } static void *current_time_read_cb(uint16_t obj_inst_id, uint16_t res_id, @@ -182,9 +207,9 @@ static int current_time_post_write_cb(uint16_t obj_inst_id, uint16_t res_id, } /* error code function */ - int lwm2m_device_add_err(uint8_t error_code) { + int ret = 0; int i; for (i = 0; i < DEVICE_ERROR_CODE_MAX; i++) { @@ -206,7 +231,15 @@ int lwm2m_device_add_err(uint8_t error_code) error_code_ri[i].res_inst_id = i; lwm2m_notify_observer(LWM2M_OBJECT_DEVICE_ID, 0, DEVICE_ERROR_CODE_ID); - return 0; + if (IS_ENABLED(CONFIG_LWM2M_DEVICE_ERROR_CODE_SETTINGS)) { + ret = settings_save_one(SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE "/" ERROR_LIST_KEY, + error_code_list, i + 1); + if (ret != 0) { + LOG_ERR("Couldn't save error list: %d", ret); + } + } + + return ret; } static void device_periodic_service(struct k_work *work) @@ -219,6 +252,49 @@ int lwm2m_update_device_service_period(uint32_t period_ms) return lwm2m_engine_update_service_period(device_periodic_service, period_ms); } +static int lwm2m_obj_device_settings_set(const char *name, size_t len, + settings_read_cb read_cb, void *cb_arg) +{ + const char *next; + int rc; + int i; + + if (settings_name_steq(name, ERROR_LIST_KEY, &next) && !next) { + if (len > sizeof(error_code_list)) { + LOG_ERR("Error code list too large: %u", len); + return -EINVAL; + } + + rc = read_cb(cb_arg, error_code_list, sizeof(error_code_list)); + if (rc == 0) { + reset_error_list(); + return 0; + } else if (rc > 0) { + for (i = 0; i < ARRAY_SIZE(error_code_list); i++) { + if (i < rc) { + error_code_ri[i].res_inst_id = i; + } else { + /* Reset remaining error code instances */ + error_code_list[i] = LWM2M_DEVICE_ERROR_NONE; + error_code_ri[i].res_inst_id = RES_INSTANCE_NOT_CREATED; + } + } + return 0; + } + + LOG_ERR("Error code list read failure: %d", rc); + + return rc; + } + + return -ENOENT; +} + +static struct settings_handler lwm2m_obj_device_settings_handler = { + .name = SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE, + .h_set = lwm2m_obj_device_settings_set, +}; + static struct lwm2m_engine_obj_inst *device_create(uint16_t obj_inst_id) { int i = 0, j = 0; @@ -271,7 +347,7 @@ static struct lwm2m_engine_obj_inst *device_create(uint16_t obj_inst_id) static int lwm2m_device_init(void) { struct lwm2m_engine_obj_inst *obj_inst = NULL; - int ret = 0; + int ret; /* Set default values */ time_offset = 0U; @@ -294,12 +370,26 @@ static int lwm2m_device_init(void) LOG_DBG("Create LWM2M instance 0 error: %d", ret); } - /* Create the default error code resource instance */ - lwm2m_device_add_err(0); + /* Ensure error list is reset if not loaded from settings */ + reset_error_list(); + + /* Load error code resource instances */ + if (IS_ENABLED(CONFIG_LWM2M_DEVICE_ERROR_CODE_SETTINGS)) { + ret = settings_register(&lwm2m_obj_device_settings_handler); + if (ret == 0) { + ret = settings_load_subtree(SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE); + if (ret != 0) { + LOG_ERR("Settings load failed: %d", ret); + } + } else { + LOG_ERR("Settings register failed: %d", ret); + } + } /* call device_periodic_service() every 10 seconds */ ret = lwm2m_engine_add_service(device_periodic_service, DEVICE_SERVICE_INTERVAL_MS); + return ret; } From 6b3b6df9fe2c0ef6200c6f7e1fc908e6ac176a84 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 1 Dec 2023 09:32:14 +0100 Subject: [PATCH 0129/2300] [nrf fromtree] samples: net: sockets: coap_server: Remove observer events In preparation of migrating to net_mgmt events, we need to remove the observer event callback handler. Signed-off-by: Pieter De Gendt (cherry picked from commit 527640b72675b1030c047c023645d06988d4268a) (cherry picked from commit 20f9d5c5a19f5129fd5308b4fe69edd5428938f6) --- samples/net/sockets/coap_server/prj.conf | 1 - samples/net/sockets/coap_server/src/observer.c | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/samples/net/sockets/coap_server/prj.conf b/samples/net/sockets/coap_server/prj.conf index 1a26e614786..e9ff24577b7 100644 --- a/samples/net/sockets/coap_server/prj.conf +++ b/samples/net/sockets/coap_server/prj.conf @@ -13,7 +13,6 @@ CONFIG_COAP=y CONFIG_COAP_SERVER=y CONFIG_COAP_SERVER_WELL_KNOWN_CORE=y CONFIG_COAP_WELL_KNOWN_BLOCK_WISE=n -CONFIG_COAP_OBSERVER_EVENTS=y # Kernel options CONFIG_ENTROPY_GENERATOR=y diff --git a/samples/net/sockets/coap_server/src/observer.c b/samples/net/sockets/coap_server/src/observer.c index 29b7b4ed472..6d39536e232 100644 --- a/samples/net/sockets/coap_server/src/observer.c +++ b/samples/net/sockets/coap_server/src/observer.c @@ -17,16 +17,6 @@ static int obs_counter; static void update_counter(struct k_work *work); K_WORK_DELAYABLE_DEFINE(obs_work, update_counter); -#ifdef CONFIG_COAP_OBSERVER_EVENTS - -static void observer_event(struct coap_resource *resource, struct coap_observer *observer, - enum coap_observer_event event) -{ - LOG_INF("Observer %s", event == COAP_OBSERVER_ADDED ? "added" : "removed"); -} - -#endif - static int send_notification_packet(struct coap_resource *resource, const struct sockaddr *addr, socklen_t addr_len, @@ -138,9 +128,6 @@ COAP_RESOURCE_DEFINE(obs, coap_server, .get = obs_get, .path = obs_path, .notify = obs_notify, -#ifdef CONFIG_COAP_OBSERVER_EVENTS - .observer_event_handler = observer_event, -#endif }); static void update_counter(struct k_work *work) From ae0c47277db55ee81bcbb9eb7babf6fcca3d0cea Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 1 Dec 2023 09:00:47 +0100 Subject: [PATCH 0130/2300] [nrf fromtree] Revert "net: lib: coap: Add support for observer event callbacks" This reverts commit 5227f248153f67e05b0ede9f859deb6f63ed4456. The coap observer events will be replaced with net_mgmt events. Signed-off-by: Pieter De Gendt (cherry picked from commit f712441840463e796fd4f3089ab2d128af1407da) (cherry picked from commit 9af0dc0c004d20a23b174d0d5a3ba8996a22a403) --- include/zephyr/net/coap.h | 30 ------------------------------ subsys/net/lib/coap/Kconfig | 6 ------ subsys/net/lib/coap/coap.c | 17 +---------------- 3 files changed, 1 insertion(+), 52 deletions(-) diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index a907d1311e1..dceed869b43 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -238,29 +238,6 @@ typedef int (*coap_method_t)(struct coap_resource *resource, typedef void (*coap_notify_t)(struct coap_resource *resource, struct coap_observer *observer); -/** - * @brief Event types for observer event callbacks. - */ -enum coap_observer_event { - /** An observer was added. */ - COAP_OBSERVER_ADDED = 0, - /** An observer was removed. */ - COAP_OBSERVER_REMOVED, -}; - -/** - * @typedef coap_observer_event_handler_t - * @brief Type of the handler being called when a resource's observers has been modified. - * Either an observer was added or removed. - * - * @param resource A pointer to a CoAP resource for which the event occurred - * @param observer The observer being added/removed - * @param event The event type - */ -typedef void (*coap_observer_event_handler_t)(struct coap_resource *resource, - struct coap_observer *observer, - enum coap_observer_event event); - /** * @brief Description of CoAP resource. * @@ -275,13 +252,6 @@ struct coap_resource { void *user_data; sys_slist_t observers; int age; -#if defined(CONFIG_COAP_OBSERVER_EVENTS) || defined(DOXYGEN) - /** - * Optional observer event callback function - * Only available when @kconfig{CONFIG_COAP_OBSERVER_EVENTS} is enabled. - */ - coap_observer_event_handler_t observer_event_handler; -#endif }; /** diff --git a/subsys/net/lib/coap/Kconfig b/subsys/net/lib/coap/Kconfig index 8e62983ea72..cc6bee04f53 100644 --- a/subsys/net/lib/coap/Kconfig +++ b/subsys/net/lib/coap/Kconfig @@ -89,12 +89,6 @@ config COAP_URI_WILDCARD This option enables MQTT-style wildcards in path. Disable it if resource path may contain plus or hash symbol. -config COAP_OBSERVER_EVENTS - bool "CoAP resource observer events" - help - This option enables to register a callback function to CoAP resources - that will be called when adding/removing observers. - config COAP_KEEP_USER_DATA bool "Keeping user data in the CoAP packet" help diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index 9fe62730b47..e2ff715aec6 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1856,28 +1856,13 @@ bool coap_register_observer(struct coap_resource *resource, resource->age = 2; } -#ifdef CONFIG_COAP_OBSERVER_EVENTS - if (resource->observer_event_handler) { - resource->observer_event_handler(resource, observer, COAP_OBSERVER_ADDED); - } -#endif - return first; } bool coap_remove_observer(struct coap_resource *resource, struct coap_observer *observer) { - if (!sys_slist_find_and_remove(&resource->observers, &observer->list)) { - return false; - } - -#ifdef CONFIG_COAP_OBSERVER_EVENTS - if (resource->observer_event_handler) { - resource->observer_event_handler(resource, observer, COAP_OBSERVER_REMOVED); - } -#endif - return true; + return sys_slist_find_and_remove(&resource->observers, &observer->list); } static bool sockaddr_equal(const struct sockaddr *a, From db5c9caafa0d4789d3db3ecda3391b6547668b13 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 29 Nov 2023 16:53:09 +0100 Subject: [PATCH 0131/2300] [nrf fromtree] net: lib: coap: Introduce net mgmt events for CoAP Allow users to register net mgmt events callbacks for CoAP events. Signed-off-by: Pieter De Gendt (cherry picked from commit 5182dd24c60ceeb15c7cadd119003b3328af23f7) (cherry picked from commit 7b7d001bb68ed4cd5450127fa93c1e99a1047762) --- include/zephyr/net/coap_mgmt.h | 102 ++++++++++++++++++++++++++++++ subsys/net/lib/coap/coap.c | 30 ++++++++- subsys/net/lib/coap/coap_server.c | 25 +++++++- 3 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 include/zephyr/net/coap_mgmt.h diff --git a/include/zephyr/net/coap_mgmt.h b/include/zephyr/net/coap_mgmt.h new file mode 100644 index 00000000000..f19eec6eb4b --- /dev/null +++ b/include/zephyr/net/coap_mgmt.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2023 Basalte bv + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief CoAP Events code public header + */ + +#ifndef ZEPHYR_INCLUDE_NET_COAP_MGMT_H_ +#define ZEPHYR_INCLUDE_NET_COAP_MGMT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief CoAP Manager Events + * @defgroup coap_mgmt CoAP Manager Events + * @ingroup networking + * @{ + */ + +/** @cond INTERNAL_HIDDEN */ + +/* CoAP events */ +#define _NET_COAP_LAYER NET_MGMT_LAYER_L4 +#define _NET_COAP_CODE 0x1c0 +#define _NET_COAP_IF_BASE (NET_MGMT_EVENT_BIT | \ + NET_MGMT_LAYER(_NET_COAP_LAYER) | \ + NET_MGMT_LAYER_CODE(_NET_COAP_CODE)) + +struct coap_service; +struct coap_resource; +struct coap_observer; + +/** @endcond */ + +enum net_event_coap_cmd { + /* Service events */ + NET_EVENT_COAP_CMD_SERVICE_STARTED = 1, + NET_EVENT_COAP_CMD_SERVICE_STOPPED, + /* Observer events */ + NET_EVENT_COAP_CMD_OBSERVER_ADDED, + NET_EVENT_COAP_CMD_OBSERVER_REMOVED, +}; + +/** + * @brief coap_mgmt event raised when a service has started + */ +#define NET_EVENT_COAP_SERVICE_STARTED \ + (_NET_COAP_IF_BASE | NET_EVENT_COAP_CMD_SERVICE_STARTED) + +/** + * @brief coap_mgmt event raised when a service has stopped + */ +#define NET_EVENT_COAP_SERVICE_STOPPED \ + (_NET_COAP_IF_BASE | NET_EVENT_COAP_CMD_SERVICE_STOPPED) + +/** + * @brief coap_mgmt event raised when an observer has been added to a resource + */ +#define NET_EVENT_COAP_OBSERVER_ADDED \ + (_NET_COAP_IF_BASE | NET_EVENT_COAP_CMD_OBSERVER_ADDED) + +/** + * @brief coap_mgmt event raised when an observer has been removed from a resource + */ +#define NET_EVENT_COAP_OBSERVER_REMOVED \ + (_NET_COAP_IF_BASE | NET_EVENT_COAP_CMD_OBSERVER_REMOVED) + +/** + * @brief CoAP Service event structure. + */ +struct net_event_coap_service { + /* The CoAP service for which the event is emitted */ + const struct coap_service *service; +}; + +/** + * @brief CoAP Observer event structure. + */ +struct net_event_coap_observer { + /* The CoAP resource for which the event is emitted */ + struct coap_resource *resource; + /* The observer that is added/removed */ + struct coap_observer *observer; +}; + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_NET_COAP_MGMT_H_ */ diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index e2ff715aec6..c49264e6776 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -23,6 +23,7 @@ LOG_MODULE_REGISTER(net_coap, CONFIG_COAP_LOG_LEVEL); #include #include #include +#include #define COAP_PATH_ELEM_DELIM '/' #define COAP_PATH_ELEM_QUERY '?' @@ -1844,6 +1845,25 @@ void coap_observer_init(struct coap_observer *observer, net_ipaddr_copy(&observer->addr, addr); } +static inline void coap_observer_raise_event(struct coap_resource *resource, + struct coap_observer *observer, + uint32_t mgmt_event) +{ +#ifdef CONFIG_NET_MGMT_EVENT_INFO + const struct net_event_coap_observer net_event = { + .resource = resource, + .observer = observer, + }; + + net_mgmt_event_notify_with_info(mgmt_event, NULL, (void *)&net_event, sizeof(net_event)); +#else + ARG_UNUSED(resource); + ARG_UNUSED(observer); + + net_mgmt_event_notify(mgmt_event, NULL); +#endif +} + bool coap_register_observer(struct coap_resource *resource, struct coap_observer *observer) { @@ -1856,13 +1876,21 @@ bool coap_register_observer(struct coap_resource *resource, resource->age = 2; } + coap_observer_raise_event(resource, observer, NET_EVENT_COAP_OBSERVER_ADDED); + return first; } bool coap_remove_observer(struct coap_resource *resource, struct coap_observer *observer) { - return sys_slist_find_and_remove(&resource->observers, &observer->list); + if (!sys_slist_find_and_remove(&resource->observers, &observer->list)) { + return false; + } + + coap_observer_raise_event(resource, observer, NET_EVENT_COAP_OBSERVER_REMOVED); + + return true; } static bool sockaddr_equal(const struct sockaddr *a, diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 386bc2081bb..ce312968ea7 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -14,6 +14,7 @@ LOG_MODULE_DECLARE(net_coap, CONFIG_COAP_LOG_LEVEL); #include #include #include +#include #include #ifdef CONFIG_ARCH_POSIX #include @@ -345,6 +346,21 @@ static inline bool coap_service_in_section(const struct coap_service *service) STRUCT_SECTION_END(coap_service) > service; } +static inline void coap_service_raise_event(const struct coap_service *service, uint32_t mgmt_event) +{ +#if defined(CONFIG_NET_MGMT_EVENT_INFO) + const struct net_event_coap_service net_event = { + .service = service, + }; + + net_mgmt_event_notify_with_info(mgmt_event, NULL, (void *)&net_event, sizeof(net_event)); +#else + ARG_UNUSED(service); + + net_mgmt_event_notify(mgmt_event, NULL); +#endif +} + int coap_service_start(const struct coap_service *service) { int ret; @@ -446,6 +462,8 @@ int coap_service_start(const struct coap_service *service) coap_server_update_services(); + coap_service_raise_event(service, NET_EVENT_COAP_SERVICE_STARTED); + return ret; close: @@ -469,17 +487,18 @@ int coap_service_stop(const struct coap_service *service) k_mutex_lock(&lock, K_FOREVER); if (service->data->sock_fd < 0) { - ret = -EALREADY; - goto end; + k_mutex_unlock(&lock); + return -EALREADY; } /* Closing a socket will trigger a poll event */ ret = zsock_close(service->data->sock_fd); service->data->sock_fd = -1; -end: k_mutex_unlock(&lock); + coap_service_raise_event(service, NET_EVENT_COAP_SERVICE_STOPPED); + return ret; } From 5857c08502121b0beaefc5de13c3a90db748446c Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 1 Dec 2023 10:12:19 +0100 Subject: [PATCH 0132/2300] [nrf fromtree] samples: net: sockets: coap_server: Add CoAP events example Add an example handler for CoAP events triggered by net_mgmt. Signed-off-by: Pieter De Gendt (cherry picked from commit 8b22c769a76f4618648f5d1e0ff7d9656f17665a) (cherry picked from commit 8461ad27e602773abf402d044b167a84d8037081) --- samples/net/sockets/coap_server/prj.conf | 5 ++ samples/net/sockets/coap_server/src/events.c | 50 ++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 samples/net/sockets/coap_server/src/events.c diff --git a/samples/net/sockets/coap_server/prj.conf b/samples/net/sockets/coap_server/prj.conf index e9ff24577b7..59d444db456 100644 --- a/samples/net/sockets/coap_server/prj.conf +++ b/samples/net/sockets/coap_server/prj.conf @@ -29,6 +29,11 @@ CONFIG_COAP_SERVER_SHELL=y # Configuration CONFIG_NET_CONFIG_SETTINGS=y +# Events +CONFIG_NET_MGMT=y +CONFIG_NET_MGMT_EVENT=y +CONFIG_NET_MGMT_EVENT_INFO=y + # Enable only one protocol, if you enable both sources # won't compile. # IPv6 Support diff --git a/samples/net/sockets/coap_server/src/events.c b/samples/net/sockets/coap_server/src/events.c new file mode 100644 index 00000000000..3f843fba017 --- /dev/null +++ b/samples/net/sockets/coap_server/src/events.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023 Basalte bv + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_DECLARE(net_coap_service_sample); + +#include +#include + +#define COAP_EVENTS_SET (NET_EVENT_COAP_OBSERVER_ADDED | NET_EVENT_COAP_OBSERVER_REMOVED | \ + NET_EVENT_COAP_SERVICE_STARTED | NET_EVENT_COAP_SERVICE_STOPPED) + +void coap_event_handler(uint32_t mgmt_event, struct net_if *iface, + void *info, size_t info_length, void *user_data) +{ + ARG_UNUSED(iface); + ARG_UNUSED(user_data); + + switch (mgmt_event) { + case NET_EVENT_COAP_OBSERVER_ADDED: + LOG_INF("CoAP observer added"); + break; + case NET_EVENT_COAP_OBSERVER_REMOVED: + LOG_INF("CoAP observer removed"); + break; + case NET_EVENT_COAP_SERVICE_STARTED: + if (info != NULL && info_length == sizeof(struct net_event_coap_service)) { + struct net_event_coap_service *net_event = info; + + LOG_INF("CoAP service %s started", net_event->service->name); + } else { + LOG_INF("CoAP service started"); + } + break; + case NET_EVENT_COAP_SERVICE_STOPPED: + if (info != NULL && info_length == sizeof(struct net_event_coap_service)) { + struct net_event_coap_service *net_event = info; + + LOG_INF("CoAP service %s stopped", net_event->service->name); + } else { + LOG_INF("CoAP service stopped"); + } + break; + } +} + +NET_MGMT_REGISTER_EVENT_HANDLER(coap_events, COAP_EVENTS_SET, coap_event_handler, NULL); From 66c0ad07f4adedc88f78cc82a68808990802e6b7 Mon Sep 17 00:00:00 2001 From: Marc Lasch Date: Tue, 5 Dec 2023 16:06:11 +0100 Subject: [PATCH 0133/2300] [nrf fromtree] net: lwm2m: Reduce dependency on firmware update pull Kconfig There are functions whose headers are only visible when CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT is selected. However these functions are used outside the scope of the firmware update pull functionality. This change allows to disable CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT while still being able to use the firmware update object. Signed-off-by: Marc Lasch (cherry picked from commit 8358cdd6975799c45dcfb3706851d6644bbbbbf6) (cherry picked from commit 09a0826979591e4bd0ce562b24d0c81c3a120d45) --- include/zephyr/net/lwm2m.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index 6ac0458af87..51324f63153 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -551,7 +551,6 @@ void lwm2m_firmware_set_cancel_cb_inst(uint16_t obj_inst_id, lwm2m_engine_user_c */ lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb_inst(uint16_t obj_inst_id); -#if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT) || defined(__DOXYGEN__) /** * @brief Set data callback to handle firmware update execute events. * @@ -588,8 +587,6 @@ void lwm2m_firmware_set_update_cb_inst(uint16_t obj_inst_id, lwm2m_engine_execut */ lwm2m_engine_execute_cb_t lwm2m_firmware_get_update_cb_inst(uint16_t obj_inst_id); #endif -#endif - #if defined(CONFIG_LWM2M_SWMGMT_OBJ_SUPPORT) || defined(__DOXYGEN__) From 372433c99338379d1db5f8d0450ac72ad72ef14a Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 23 Nov 2023 16:57:41 +0200 Subject: [PATCH 0134/2300] [nrf fromtree] test: lwm2m: Implement bootstrap tests 4 - 7 * LightweightM2M-1.1-int-4 - Bootstrap Delete * LightweightM2M-1.1-int-5 - Server Initiated Bootstrap * LightweightM2M-1.1-int-6 - Bootstrap Sequence * LightweightM2M-1.1-int-7 - Fallback to bootstrap Signed-off-by: Seppo Takalo (cherry picked from commit 51869b3e459f3872ee137ed66d25ccd1fd6ac3aa) (cherry picked from commit 191896cdb8935ad3c71bf4b3452f2ea4d9db2f82) --- tests/net/lib/lwm2m/interop/README.md | 8 +++ tests/net/lib/lwm2m/interop/prj.conf | 5 ++ .../lwm2m/interop/pytest/test_bootstrap.py | 63 ++++++++++++++++--- .../net/lib/lwm2m/interop/src/lwm2m-client.c | 11 ++++ 4 files changed, 79 insertions(+), 8 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index 3acbfcc71f8..28d8e12ccca 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -125,6 +125,14 @@ Tests are written from test spec; |---------|------|-----| |LightweightM2M-1.1-int-0 - Client Initiated Bootstrap |:white_check_mark:| | |LightweightM2M-1.1-int-1 - Client Initiated Bootstrap Full (PSK) |:white_check_mark:| | +|LightweightM2M-1.1-int-2 - Client Initiated Bootstrap Full (Cert) | |testcase not implemented | +|LightweightM2M-1.1-int-3 – Simple Bootstrap from Smartcard |:large_orange_diamond:|We don't have any smartcard support.| +|LightweightM2M-1.1-int-4 - Bootstrap Delete |:white_check_mark:| | +|LightweightM2M-1.1-int-5 - Server Initiated Bootstrap |:white_check_mark:| | +|LightweightM2M-1.1-int-6 - Bootstrap Sequence |:white_check_mark:| | +|LightweightM2M-1.1-int-7 - Fallback to bootstrap |:white_check_mark:| | +|LightweightM2M-1.1-int-8 - Bootstrap Read | |Test cannot be implemented from client side.| +|LightweightM2M-1.1-int-9 - Bootstrap and Configuration Consistency | |testcase not implemented | |LightweightM2M-1.1-int-101 - Initial Registration |:white_check_mark:| | |LightweightM2M-1.1-int-102 - Registration Update |:white_check_mark:| | |LightweightM2M-1.1-int-103 - Deregistration |:large_orange_diamond:|We don't have "disabled" functionality in server object| diff --git a/tests/net/lib/lwm2m/interop/prj.conf b/tests/net/lib/lwm2m/interop/prj.conf index 07bd9a0535d..43d4e73f081 100644 --- a/tests/net/lib/lwm2m/interop/prj.conf +++ b/tests/net/lib/lwm2m/interop/prj.conf @@ -44,6 +44,11 @@ CONFIG_LWM2M_RW_OMA_TLV_SUPPORT=y CONFIG_COAP_EXTENDED_OPTIONS_LEN=y CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=40 +# Speed up testing, we are running in non-lossy network +CONFIG_COAP_INIT_ACK_TIMEOUT_MS=1000 +CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT=n +CONFIG_LWM2M_RD_CLIENT_MAX_RETRIES=2 + # Use QUEUE mode by default CONFIG_LWM2M_QUEUE_MODE_ENABLED=y CONFIG_LWM2M_QUEUE_MODE_UPTIME=20 diff --git a/tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py b/tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py index 65561db0676..2a45669d912 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py @@ -15,9 +15,11 @@ """ import logging +import pytest from leshan import Leshan from twister_harness import Shell from twister_harness import DeviceAdapter +from conftest import Endpoint logger = logging.getLogger(__name__) @@ -29,24 +31,69 @@ # Bootstrap Interface: [0-99] # -def verify_LightweightM2M_1_1_int_0(shell: Shell, dut: DeviceAdapter): +def verify_LightweightM2M_1_1_int_0(dut: DeviceAdapter, endpoint_bootstrap: Endpoint): """LightweightM2M-1.1-int-0 - Client Initiated Bootstrap""" - dut.readlines_until(regex='.*Bootstrap started with endpoint', timeout=5.0) - dut.readlines_until(regex='.*Bootstrap registration done', timeout=5.0) - dut.readlines_until(regex='.*Bootstrap data transfer done', timeout=5.0) + dut.readlines_until(regex='.*Bootstrap transfer complete', timeout=5.0) + endpoint_bootstrap.bootstrap = True -def test_LightweightM2M_1_1_int_1(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint_bootstrap: str): +def test_LightweightM2M_1_1_int_1(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint_bootstrap: Endpoint): """LightweightM2M-1.1-int-1 - Client Initiated Bootstrap Full (PSK)""" - verify_LightweightM2M_1_1_int_0(shell, dut) + verify_LightweightM2M_1_1_int_0(dut, endpoint_bootstrap) verify_LightweightM2M_1_1_int_101(shell, dut, leshan, endpoint_bootstrap) verify_LightweightM2M_1_1_int_401(shell, leshan, endpoint_bootstrap) -def verify_LightweightM2M_1_1_int_101(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): +def test_LightweightM2M_1_1_int_4(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: Endpoint): + """LightweightM2M-1.1-int-4 - Bootstrap Delete""" + shell.exec_command('lwm2m create 1/2') + shell.exec_command('lwm2m read 1/2/0') + retval = int(shell.get_filtered_output(shell.exec_command('retval'))[0]) + assert retval == 0 + leshan.execute(endpoint, '1/0/9') + dut.readlines_until(regex='.*Registration Done', timeout=5.0) + shell.exec_command('lwm2m read 1/2/0') + retval = int(shell.get_filtered_output(shell.exec_command('retval'))[0]) + assert retval < 0 + logger.info('retval: %s', retval) + +def test_LightweightM2M_1_1_int_5(dut: DeviceAdapter, leshan: Leshan, endpoint: Endpoint): + """LightweightM2M-1.1-int-5 - Server Initiated Bootstrap""" + leshan.execute(endpoint, '1/0/9') + dut.readlines_until(regex='.*Server Initiated Bootstrap', timeout=1) + dut.readlines_until(regex='.*Bootstrap transfer complete', timeout=5.0) + dut.readlines_until(regex='.*Registration Done', timeout=5.0) + +def test_LightweightM2M_1_1_int_6(shell: Shell, dut: DeviceAdapter, endpoint: Endpoint): + """LightweightM2M-1.1-int-6 - Bootstrap Sequence""" + shell.exec_command('lwm2m stop') + dut.readlines_until(regex=r'.*Deregistration success', timeout=5) + shell.exec_command(f'lwm2m start {endpoint}') + lines = dut.readlines_until(regex='.*Registration Done', timeout=5.0) + assert not any("Bootstrap" in line for line in lines) + shell.exec_command('lwm2m stop') + dut.readlines_until(regex=r'.*Deregistration success', timeout=5) + shell.exec_command("lwm2m delete 1/0") + shell.exec_command("lwm2m delete 0/1") + shell.exec_command(f'lwm2m start {endpoint}') + lines = dut.readlines_until(regex='.*Registration Done', timeout=5.0) + assert any("Bootstrap" in line for line in lines) + +@pytest.mark.slow +def test_LightweightM2M_1_1_int_7(shell: Shell, dut: DeviceAdapter, endpoint: Endpoint): + """LightweightM2M-1.1-int-7 - Fallback to bootstrap""" + shell.exec_command('lwm2m stop') + dut.readlines_until(regex=r'.*Deregistration success', timeout=5) + shell.exec_command('lwm2m write 0/1/0 -s coaps://10.10.10.10:5684') + shell.exec_command(f'lwm2m start {endpoint}') + lines = dut.readlines_until(regex='.*Registration Done', timeout=600.0) + assert any("Bootstrap" in line for line in lines) + +def verify_LightweightM2M_1_1_int_101(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: Endpoint): """LightweightM2M-1.1-int-101 - Initial Registration""" dut.readlines_until(regex='.*Registration Done', timeout=5.0) assert leshan.get(f'/clients/{endpoint}') + endpoint.registered = True -def verify_LightweightM2M_1_1_int_401(shell: Shell, leshan: Leshan, endpoint: str): +def verify_LightweightM2M_1_1_int_401(shell: Shell, leshan: Leshan, endpoint: Endpoint): """LightweightM2M-1.1-int-401 - UDP Channel Security - Pre-shared Key Mode""" lines = shell.get_filtered_output(shell.exec_command('lwm2m read 0/0/0 -s')) host = lines[0] diff --git a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c index b6634069fbd..a150f1b41cb 100644 --- a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c +++ b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c @@ -73,6 +73,17 @@ int set_socketoptions(struct lwm2m_ctx *ctx) ret = -errno; LOG_ERR("Failed to enable TLS_DTLS_CID: %d", ret); } + + /* Allow DTLS handshake to timeout much faster. + * these tests run on TUN/TAP network, so there should be no network latency. + */ + uint32_t min = 100; + uint32_t max = 500; + + zsock_setsockopt(ctx->sock_fd, SOL_TLS, TLS_DTLS_HANDSHAKE_TIMEOUT_MIN, &min, + sizeof(min)); + zsock_setsockopt(ctx->sock_fd, SOL_TLS, TLS_DTLS_HANDSHAKE_TIMEOUT_MAX, &max, + sizeof(max)); } return lwm2m_set_default_sockopt(ctx); } From a958fd37b75eddaa2d7dd1f4fb0fee8447f9e315 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 4 Dec 2023 13:14:53 +0200 Subject: [PATCH 0135/2300] [nrf fromtree] test: lwm2m: Implement missing test case 103 Testcase 103 required "Disabled" functionality. Signed-off-by: Seppo Takalo (cherry picked from commit 725ceb72b70a836459b483a3f6634827493866f1) (cherry picked from commit 67e3744033592ac13037e4fb89ccafb569659133) --- tests/net/lib/lwm2m/interop/README.md | 2 +- tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index 28d8e12ccca..7df931203aa 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -135,7 +135,7 @@ Tests are written from test spec; |LightweightM2M-1.1-int-9 - Bootstrap and Configuration Consistency | |testcase not implemented | |LightweightM2M-1.1-int-101 - Initial Registration |:white_check_mark:| | |LightweightM2M-1.1-int-102 - Registration Update |:white_check_mark:| | -|LightweightM2M-1.1-int-103 - Deregistration |:large_orange_diamond:|We don't have "disabled" functionality in server object| +|LightweightM2M-1.1-int-103 - Deregistration |:white_check_mark:| | |LightweightM2M-1.1-int-104 - Registration Update Trigge |:white_check_mark:| | |LightweightM2M-1.1-int-105 - Discarded Register Update |:white_check_mark:| | |LightweightM2M-1.1-int-107 - Extending the lifetime of a registration |:white_check_mark:| | diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index ed7aaceac20..4e0ae207e8d 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -44,6 +44,17 @@ def test_LightweightM2M_1_1_int_102(shell: Shell, dut: DeviceAdapter, leshan: Le assert latest["lifetime"] == lifetime shell.exec_command('lwm2m write 1/0/1 -u32 86400') +def test_LightweightM2M_1_1_int_103(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): + """LightweightM2M-1.1-int-103 - Deregistration""" + leshan.execute(endpoint, '1/0/4') + dut.readlines_until(regex='LwM2M server disabled', timeout=5.0) + dut.readlines_until(regex='Deregistration success', timeout=5.0) + # Reset timers by restarting the client + shell.exec_command('lwm2m stop') + time.sleep(1) + shell.exec_command(f'lwm2m start {endpoint}') + dut.readlines_until(regex='.*Registration Done', timeout=5.0) + def test_LightweightM2M_1_1_int_104(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-104 - Registration Update Trigger""" shell.exec_command('lwm2m update') From 0b4beb59cd1b25d18a881179ca22f5e2fa9c1bb9 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 7 Dec 2023 17:17:30 +0200 Subject: [PATCH 0136/2300] [nrf fromtree] net: lwm2m: Fix pmin handling on tickless If observed resource was written during the pMin period, it did not schedule any wake-up event into the future. Notify message would then only be generated as a result of any other (like Update) event. Refactor check_notifications() to follow same pattern as retransmit_req(). Return the next event timestamp, which could be now. Signed-off-by: Seppo Takalo (cherry picked from commit 005dc60d24bc378dffdc7c4ce12f4cd0cee1744a) (cherry picked from commit c8e65c71cb7e43e07f41303d31b3ed45e1df03ac) --- subsys/net/lib/lwm2m/lwm2m_engine.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 45d3822bdbb..959d07419d3 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -581,14 +581,24 @@ void lwm2m_socket_del(struct lwm2m_ctx *ctx) lwm2m_engine_wake_up(); } -static void check_notifications(struct lwm2m_ctx *ctx, const int64_t timestamp) +/* Generate notify messages. Return timestamp of next Notify event */ +static int64_t check_notifications(struct lwm2m_ctx *ctx, const int64_t timestamp) { struct observe_node *obs; int rc; + int64_t next = INT64_MAX; lwm2m_registry_lock(); SYS_SLIST_FOR_EACH_CONTAINER(&ctx->observer, obs, node) { - if (!obs->event_timestamp || timestamp < obs->event_timestamp) { + if (!obs->event_timestamp) { + continue; + } + + if (obs->event_timestamp < next) { + next = obs->event_timestamp; + } + + if (timestamp < obs->event_timestamp) { continue; } /* Check That There is not pending process*/ @@ -604,6 +614,7 @@ static void check_notifications(struct lwm2m_ctx *ctx, const int64_t timestamp) obs->event_timestamp = engine_observe_shedule_next_event(obs, ctx->srv_obj_inst, timestamp); obs->last_timestamp = timestamp; + if (!rc) { /* create at most one notification */ goto cleanup; @@ -611,6 +622,7 @@ static void check_notifications(struct lwm2m_ctx *ctx, const int64_t timestamp) } cleanup: lwm2m_registry_unlock(); + return next; } static int socket_recv_message(struct lwm2m_ctx *client_ctx) @@ -704,7 +716,7 @@ static void socket_loop(void *p1, void *p2, void *p3) int i, rc; int64_t now, next; - int64_t timeout, next_retransmit; + int64_t timeout, next_tx; bool rd_client_paused; while (1) { @@ -741,12 +753,15 @@ static void socket_loop(void *p1, void *p2, void *p3) if (!sys_slist_is_empty(&sock_ctx[i]->pending_sends)) { continue; } - next_retransmit = retransmit_request(sock_ctx[i], now); - if (next_retransmit < next) { - next = next_retransmit; + next_tx = retransmit_request(sock_ctx[i], now); + if (next_tx < next) { + next = next_tx; } if (lwm2m_rd_client_is_registred(sock_ctx[i])) { - check_notifications(sock_ctx[i], now); + next_tx = check_notifications(sock_ctx[i], now); + if (next_tx < next) { + next = next_tx; + } } } From dec7ead8c28dc452408d6e80707a1d837fb5ae13 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 7 Dec 2023 17:18:50 +0200 Subject: [PATCH 0137/2300] [nrf fromtree] test: lwm2m: Run interop tests in tickless mode Tickless mode is important to be tested against real server. Signed-off-by: Seppo Takalo (cherry picked from commit b4bdbfd76bca5f7b8dc321d0bea53e40d1a71d20) (cherry picked from commit 162f4739d13bc2fb1d2cb84da2e2e820257cb6dc) --- tests/net/lib/lwm2m/interop/prj.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/net/lib/lwm2m/interop/prj.conf b/tests/net/lib/lwm2m/interop/prj.conf index 43d4e73f081..6115e6f40e3 100644 --- a/tests/net/lib/lwm2m/interop/prj.conf +++ b/tests/net/lib/lwm2m/interop/prj.conf @@ -18,6 +18,9 @@ CONFIG_LWM2M=y CONFIG_LWM2M_IPSO_SUPPORT=y CONFIG_LWM2M_SHELL=y +CONFIG_LWM2M_TICKLESS=y +CONFIG_NET_SOCKETPAIR=y + #Enable Portfolio object CONFIG_LWM2M_PORTFOLIO_OBJ_SUPPORT=y From 0212686f70e777a7d772372fb0b73b7c74a608a8 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Mon, 11 Dec 2023 08:44:26 +0100 Subject: [PATCH 0138/2300] [nrf fromtree] doc: connectivity: networking: api: Add doxygengroup for coap_mgmt Make sure the CoAP event doxygen is added to the documentation. Signed-off-by: Pieter De Gendt (cherry picked from commit 157b22e5ec92ed20ae654a3f2e5193fa79cb23f8) (cherry picked from commit 613a359e5d0f6c2a96590b6fe2d211f6b6cef016) --- doc/connectivity/networking/api/coap_server.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/connectivity/networking/api/coap_server.rst b/doc/connectivity/networking/api/coap_server.rst index 9a91081f449..eb816665f41 100644 --- a/doc/connectivity/networking/api/coap_server.rst +++ b/doc/connectivity/networking/api/coap_server.rst @@ -245,3 +245,4 @@ API Reference ************* .. doxygengroup:: coap_service +.. doxygengroup:: coap_mgmt From 6691357f9cb3236c036f8bf773ec0b29b17e06b6 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Fri, 1 Dec 2023 10:22:23 +0200 Subject: [PATCH 0139/2300] [nrf fromtree] net: lib: coap: Add new API to configure retransmission settings Add new functions to the public CoAP API to configure CoAP packet retransmission settings. Application may need to re-configure the settings for example when cellular modem changes connection from LTE-M to NB-IoT or vice versa. Signed-off-by: Juha Ylinen (cherry picked from commit 69e28939dde528e10ccbd13b46520c2f3d32fd5b) (cherry picked from commit 4bd6aac3a8765d2588baff084e543a800fc4487e) --- include/zephyr/net/coap.h | 26 ++++++++++++++++++++++++ subsys/net/lib/coap/Kconfig | 7 +++++++ subsys/net/lib/coap/coap.c | 24 ++++++++++++++++++---- tests/net/lib/coap_client/CMakeLists.txt | 2 ++ 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index dceed869b43..e4374f41e34 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -1134,6 +1134,32 @@ int coap_resource_notify(struct coap_resource *resource); */ bool coap_request_is_observe(const struct coap_packet *request); +/** + * @brief CoAP transmission parameters. + */ +struct coap_transmission_parameters { + /** Initial AKC timeout. Value is used as a base value to retry pending CoAP packets. */ + uint32_t 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. */ + uint8_t max_retransmission; +}; + +/** + * @brief Get currently active CoAP transmission parameters. + * + * @return CoAP transmission parameters structure. + */ +struct coap_transmission_parameters coap_get_transmission_parameters(void); + +/** + * @brief Set CoAP transmission parameters. + * + * @param params Pointer to the transmission parameters structure. + */ +void coap_set_transmission_parameters(const struct coap_transmission_parameters *params); + #ifdef __cplusplus } #endif diff --git a/subsys/net/lib/coap/Kconfig b/subsys/net/lib/coap/Kconfig index cc6bee04f53..f4d002d0c5d 100644 --- a/subsys/net/lib/coap/Kconfig +++ b/subsys/net/lib/coap/Kconfig @@ -82,6 +82,13 @@ config COAP_MAX_RETRANSMIT default 4 range 1 10 +config COAP_BACKOFF_PERCENT + int "Retransmission backoff factor for ACK timeout described as percentage" + default 200 + help + Factor described as percentage to extend CoAP ACK timeout for retransmissions. + A value of 200 means a factor of 2.0. + config COAP_URI_WILDCARD bool "Wildcards in CoAP resource path" default y diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index c49264e6776..c21e14e5ded 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -54,6 +54,12 @@ LOG_MODULE_REGISTER(net_coap, CONFIG_COAP_LOG_LEVEL); /* The CoAP message ID that is incremented each time coap_next_id() is called. */ 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, + .coap_backoff_percent = CONFIG_COAP_BACKOFF_PERCENT +}; + static int insert_option(struct coap_packet *cpkt, uint16_t code, const uint8_t *value, uint16_t len); @@ -1673,9 +1679,9 @@ struct coap_pending *coap_pending_next_to_expire( static uint32_t init_ack_timeout(void) { #if defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) - const uint32_t max_ack = CONFIG_COAP_INIT_ACK_TIMEOUT_MS * + const uint32_t max_ack = coap_transmission_params.ack_timeout * CONFIG_COAP_ACK_RANDOM_PERCENT / 100; - const uint32_t min_ack = CONFIG_COAP_INIT_ACK_TIMEOUT_MS; + const uint32_t min_ack = coap_transmission_params.ack_timeout; /* Randomly generated initial ACK timeout * ACK_TIMEOUT < INIT_ACK_TIMEOUT < ACK_TIMEOUT * ACK_RANDOM_FACTOR @@ -1683,7 +1689,7 @@ static uint32_t init_ack_timeout(void) */ return min_ack + (sys_rand32_get() % (max_ack - min_ack)); #else - return CONFIG_COAP_INIT_ACK_TIMEOUT_MS; + return coap_transmission_params.ack_timeout; #endif /* defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) */ } @@ -1701,7 +1707,7 @@ bool coap_pending_cycle(struct coap_pending *pending) } pending->t0 += pending->timeout; - pending->timeout = pending->timeout << 1; + pending->timeout = pending->timeout * coap_transmission_params.coap_backoff_percent / 100; pending->retries--; return true; @@ -2006,3 +2012,13 @@ uint16_t coap_next_id(void) { return message_id++; } + +struct coap_transmission_parameters coap_get_transmission_parameters(void) +{ + return coap_transmission_params; +} + +void coap_set_transmission_parameters(const struct coap_transmission_parameters *params) +{ + coap_transmission_params = *params; +} diff --git a/tests/net/lib/coap_client/CMakeLists.txt b/tests/net/lib/coap_client/CMakeLists.txt index 2e94112f0b0..cb86d78f611 100644 --- a/tests/net/lib/coap_client/CMakeLists.txt +++ b/tests/net/lib/coap_client/CMakeLists.txt @@ -27,3 +27,5 @@ add_compile_definitions(CONFIG_COAP_LOG_LEVEL=4) add_compile_definitions(CONFIG_COAP_INIT_ACK_TIMEOUT_MS=200) 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) From 44f5c1689319dac5d4ffa6567152ae76c70b7672 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 12 Dec 2023 10:28:26 -0600 Subject: [PATCH 0140/2300] [nrf fromtree] net: lib: lwm2m: use correct format specifier for LOG_ERR Use correct format specifier for LOG_ERR in lwm2m_obj_device.c. The previously used format specifier of %u was correct for 32 bit systems but would produce a build warning for 64 bit systems. Fixes #66441 Signed-off-by: Daniel DeGrasse (cherry picked from commit 3091ddc4fee7ead733cffc2e1565f45e680b74ff) (cherry picked from commit 1a65a63f833d09179133249c2133139d918845f0) --- subsys/net/lib/lwm2m/lwm2m_obj_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_device.c b/subsys/net/lib/lwm2m/lwm2m_obj_device.c index 9416b3cf92c..f5399fefc1e 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_device.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_device.c @@ -261,7 +261,7 @@ static int lwm2m_obj_device_settings_set(const char *name, size_t len, if (settings_name_steq(name, ERROR_LIST_KEY, &next) && !next) { if (len > sizeof(error_code_list)) { - LOG_ERR("Error code list too large: %u", len); + LOG_ERR("Error code list too large: %zu", len); return -EINVAL; } From af6a8f95267720f08e2711d93bbf792b66753882 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Tue, 12 Dec 2023 15:27:29 +0200 Subject: [PATCH 0141/2300] [nrf fromtree] net: lib: coap: Change coap_pending_init() Replace function parameter 'retries' with pointer to structure holding coap transmission parameters. This allows setting the retransmission parameters individually for each pending request. Add coap transmission parameters to coap_pending structure. Update migration guide and release notes. Signed-off-by: Juha Ylinen (cherry picked from commit d09d3d82ef0a6861b7632dac7cb0519da17919a1) (cherry picked from commit 737dfd9d5bb4abe5abdef0661d3a5443c1611373) --- doc/releases/migration-guide-3.6.rst | 22 ++++++++++++ doc/releases/release-notes-3.6.rst | 5 +++ include/zephyr/net/coap.h | 30 ++++++++-------- include/zephyr/net/coap_client.h | 5 ++- subsys/net/lib/coap/coap.c | 23 +++++++----- subsys/net/lib/coap/coap_client.c | 19 ++++------ subsys/net/lib/coap/coap_server.c | 7 ++-- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 6 ++-- tests/net/lib/coap/src/main.c | 2 +- tests/net/lib/coap_client/src/main.c | 35 ++++++++++++------- 10 files changed, 97 insertions(+), 57 deletions(-) diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index c1739adf74d..27567c3c052 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -150,6 +150,28 @@ Networking ``request`` argument for :c:func:`coap_well_known_core_get` is made ``const``. (:github:`64265`) +* CoAP observer events have moved from a callback function in a CoAP resource to the Network Events + subsystem. The ``CONFIG_COAP_OBSERVER_EVENTS`` configuration option has been removed. + (:github:`65936`) + +* The CoAP public API function :c:func:`coap_pending_init` has changed. The parameter + ``retries`` is replaced with a pointer to :c:struct:`coap_transmission_parameters`. This allows to + specify retransmission parameters of the confirmable message. It is safe to pass a NULL pointer to + use default values. + (:github:`66482`) + +* The IGMP multicast library now supports IGMPv3. This results in a minor change to the existing + api. The :c:func:`net_ipv4_igmp_join` now takes an additional argument of the type + ``const struct igmp_param *param``. This allows IGMPv3 to exclude/include certain groups of + addresses. If this functionality is not used or available (when using IGMPv2), you can safely pass + a NULL pointer. IGMPv3 can be enabled using the Kconfig ``CONFIG_NET_IPV4_IGMPV3``. + (:github:`65293`) + +* The network stack now uses a separate IPv4 TTL (time-to-live) value for multicast packets. + Before, the same TTL value was used for unicast and multicast packets. + The IPv6 hop limit value is also changed so that unicast and multicast packets can have a + different one. (:github:`65886`) + Other Subsystems ================ diff --git a/doc/releases/release-notes-3.6.rst b/doc/releases/release-notes-3.6.rst index a253434a085..f4d813432b1 100644 --- a/doc/releases/release-notes-3.6.rst +++ b/doc/releases/release-notes-3.6.rst @@ -195,6 +195,11 @@ Networking * CoAP: + * Added new API functions: + + * :c:func:`coap_get_transmission_parameters` + * :c:func:`coap_set_transmission_parameters` + * Connection Manager: * DHCP: diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index e4374f41e34..e303d5c8ad3 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -309,6 +309,18 @@ typedef int (*coap_reply_t)(const struct coap_packet *response, struct coap_reply *reply, const struct sockaddr *from); +/** + * @brief CoAP transmission parameters. + */ +struct coap_transmission_parameters { + /** Initial ACK timeout. Value is used as a base value to retry pending CoAP packets. */ + uint32_t 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. */ + uint8_t max_retransmission; +}; + /** * @brief Represents a request awaiting for an acknowledgment (ACK). */ @@ -320,6 +332,7 @@ struct coap_pending { uint8_t *data; /**< User allocated buffer */ uint16_t len; /**< Length of the CoAP packet */ uint8_t retries; /**< Number of times the request has been sent */ + struct coap_transmission_parameters params; /**< Transmission parameters */ }; /** @@ -989,14 +1002,15 @@ void coap_reply_init(struct coap_reply *reply, * confirmation message, initialized with data from @a request * @param request Message waiting for confirmation * @param addr Address to send the retransmission - * @param retries Maximum number of retransmissions of the message. + * @param params Pointer to the CoAP transmission parameters struct, + * or NULL to use default values * * @return 0 in case of success or negative in case of error. */ int coap_pending_init(struct coap_pending *pending, const struct coap_packet *request, const struct sockaddr *addr, - uint8_t retries); + const struct coap_transmission_parameters *params); /** * @brief Returns the next available pending struct, that can be used @@ -1134,18 +1148,6 @@ int coap_resource_notify(struct coap_resource *resource); */ bool coap_request_is_observe(const struct coap_packet *request); -/** - * @brief CoAP transmission parameters. - */ -struct coap_transmission_parameters { - /** Initial AKC timeout. Value is used as a base value to retry pending CoAP packets. */ - uint32_t 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. */ - uint8_t max_retransmission; -}; - /** * @brief Get currently active CoAP transmission parameters. * diff --git a/include/zephyr/net/coap_client.h b/include/zephyr/net/coap_client.h index c3de1abee27..e48048d5c26 100644 --- a/include/zephyr/net/coap_client.h +++ b/include/zephyr/net/coap_client.h @@ -83,7 +83,6 @@ struct coap_client_internal_request { uint32_t offset; uint32_t last_id; uint8_t request_tkl; - uint8_t retry_count; bool request_ongoing; struct coap_block_context recv_blk_ctx; struct coap_block_context send_blk_ctx; @@ -131,12 +130,12 @@ int coap_client_init(struct coap_client *client, const char *info); * @param sock Open socket file descriptor. * @param addr the destination address of the request, NULL if socket is already connected. * @param req CoAP request structure - * @param retries How many times to retry or -1 to use default. + * @param params Pointer to transmission parameters structure or NULL to use default values. * @return zero when operation started successfully or negative error code otherwise. */ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr *addr, - struct coap_client_request *req, int retries); + struct coap_client_request *req, struct coap_transmission_parameters *params); /** * @} diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index c21e14e5ded..bfb643a8e8c 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1553,7 +1553,7 @@ size_t coap_next_block(const struct coap_packet *cpkt, int coap_pending_init(struct coap_pending *pending, const struct coap_packet *request, const struct sockaddr *addr, - uint8_t retries) + const struct coap_transmission_parameters *params) { memset(pending, 0, sizeof(*pending)); @@ -1561,10 +1561,16 @@ int coap_pending_init(struct coap_pending *pending, memcpy(&pending->addr, addr, sizeof(*addr)); + if (params) { + pending->params = *params; + } else { + pending->params = coap_transmission_params; + } + pending->data = request->data; pending->len = request->offset; pending->t0 = k_uptime_get(); - pending->retries = retries; + pending->retries = pending->params.max_retransmission; return 0; } @@ -1676,12 +1682,12 @@ struct coap_pending *coap_pending_next_to_expire( return found; } -static uint32_t init_ack_timeout(void) +static uint32_t init_ack_timeout(const struct coap_transmission_parameters *params) { #if defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) - const uint32_t max_ack = coap_transmission_params.ack_timeout * + const uint32_t max_ack = params->ack_timeout * CONFIG_COAP_ACK_RANDOM_PERCENT / 100; - const uint32_t min_ack = coap_transmission_params.ack_timeout; + const uint32_t min_ack = params->ack_timeout; /* Randomly generated initial ACK timeout * ACK_TIMEOUT < INIT_ACK_TIMEOUT < ACK_TIMEOUT * ACK_RANDOM_FACTOR @@ -1689,7 +1695,7 @@ static uint32_t init_ack_timeout(void) */ return min_ack + (sys_rand32_get() % (max_ack - min_ack)); #else - return coap_transmission_params.ack_timeout; + return params->ack_timeout; #endif /* defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) */ } @@ -1697,8 +1703,7 @@ bool coap_pending_cycle(struct coap_pending *pending) { if (pending->timeout == 0) { /* Initial transmission. */ - pending->timeout = init_ack_timeout(); - + pending->timeout = init_ack_timeout(&pending->params); return true; } @@ -1707,7 +1712,7 @@ bool coap_pending_cycle(struct coap_pending *pending) } pending->t0 += pending->timeout; - pending->timeout = pending->timeout * coap_transmission_params.coap_backoff_percent / 100; + pending->timeout = pending->timeout * pending->params.coap_backoff_percent / 100; pending->retries--; return true; diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index a947b15ae8e..4bdf387a242 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -16,7 +16,6 @@ LOG_MODULE_DECLARE(net_coap, CONFIG_COAP_LOG_LEVEL); #define COAP_VERSION 1 #define COAP_SEPARATE_TIMEOUT 6000 #define COAP_PERIODIC_TIMEOUT 500 -#define DEFAULT_RETRY_AMOUNT 5 #define BLOCK1_OPTION_SIZE 4 #define PAYLOAD_MARKER_SIZE 1 @@ -60,7 +59,6 @@ static void reset_internal_request(struct coap_client_internal_request *request) { request->offset = 0; request->last_id = 0; - request->retry_count = 0; reset_block_contexts(request); } @@ -277,7 +275,7 @@ static int coap_client_init_request(struct coap_client *client, } int coap_client_req(struct coap_client *client, int sock, const struct sockaddr *addr, - struct coap_client_request *req, int retries) + struct coap_client_request *req, struct coap_transmission_parameters *params) { int ret; @@ -352,14 +350,8 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr /* only TYPE_CON messages need pending tracking */ if (coap_header_get_type(&internal_req->request) == COAP_TYPE_CON) { - if (retries == -1) { - internal_req->retry_count = DEFAULT_RETRY_AMOUNT; - } else { - internal_req->retry_count = retries; - } - ret = coap_pending_init(&internal_req->pending, &internal_req->request, - &client->address, internal_req->retry_count); + &client->address, params); if (ret < 0) { LOG_ERR("Failed to initialize pending struct"); @@ -692,9 +684,11 @@ static int handle_response(struct coap_client *client, const struct coap_packet } if (coap_header_get_type(&internal_req->request) == COAP_TYPE_CON) { + struct coap_transmission_parameters params = + internal_req->pending.params; ret = coap_pending_init(&internal_req->pending, &internal_req->request, &client->address, - internal_req->retry_count); + ¶ms); if (ret < 0) { LOG_ERR("Error creating pending"); k_mutex_unlock(&client->send_mutex); @@ -793,8 +787,9 @@ static int handle_response(struct coap_client *client, const struct coap_packet goto fail; } + struct coap_transmission_parameters params = internal_req->pending.params; ret = coap_pending_init(&internal_req->pending, &internal_req->request, - &client->address, internal_req->retry_count); + &client->address, ¶ms); if (ret < 0) { LOG_ERR("Error creating pending"); k_mutex_unlock(&client->send_mutex); diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index ce312968ea7..66e5dcbc32c 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -542,6 +542,8 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack * try to send. */ if (coap_header_get_type(cpkt) == COAP_TYPE_CON) { + struct coap_transmission_parameters params; + struct coap_pending *pending = coap_pending_next_unused(service->data->pending, MAX_PENDINGS); @@ -550,8 +552,9 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack goto send; } - ret = coap_pending_init(pending, cpkt, addr, - CONFIG_COAP_SERVICE_PENDING_RETRANSMITS); + params = coap_get_transmission_parameters(); + params.max_retransmission = CONFIG_COAP_SERVICE_PENDING_RETRANSMITS; + ret = coap_pending_init(pending, cpkt, addr, ¶ms); if (ret < 0) { LOG_WRN("Failed to init pending message for %s (%d)", service->name, ret); goto send; diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 02c62cee67c..677879304f8 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -654,8 +654,7 @@ int lwm2m_init_message(struct lwm2m_message *msg) goto cleanup; } - r = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr, - CONFIG_COAP_MAX_RETRANSMIT); + r = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr, NULL); if (r < 0) { LOG_ERR("Unable to initialize a pending " "retransmission (err:%d).", @@ -2594,8 +2593,7 @@ static int lwm2m_response_promote_to_con(struct lwm2m_message *msg) return -ENOMEM; } - ret = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr, - CONFIG_COAP_MAX_RETRANSMIT); + ret = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr, NULL); if (ret < 0) { LOG_ERR("Unable to initialize a pending " "retransmission (err:%d).", diff --git a/tests/net/lib/coap/src/main.c b/tests/net/lib/coap/src/main.c index c9d0456d332..52b6cf0fd2a 100644 --- a/tests/net/lib/coap/src/main.c +++ b/tests/net/lib/coap/src/main.c @@ -779,7 +779,7 @@ ZTEST(coap, test_retransmit_second_round) zassert_not_null(pending, "No free pending"); r = coap_pending_init(pending, &cpkt, (struct sockaddr *) &dummy_addr, - CONFIG_COAP_MAX_RETRANSMIT); + NULL); zassert_equal(r, 0, "Could not initialize packet"); /* We "send" the packet the first time here */ diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index e1240c5e2ed..7d99c738950 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -378,7 +378,7 @@ ZTEST(coap_client, test_get_request) k_sleep(K_MSEC(1)); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -409,7 +409,7 @@ ZTEST(coap_client, test_resend_request) k_sleep(K_MSEC(1)); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); k_sleep(K_MSEC(300)); set_socket_events(ZSOCK_POLLIN); @@ -441,7 +441,7 @@ ZTEST(coap_client, test_echo_option) k_sleep(K_MSEC(1)); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -472,7 +472,7 @@ ZTEST(coap_client, test_echo_option_next_req) k_sleep(K_MSEC(1)); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -487,7 +487,7 @@ ZTEST(coap_client, test_echo_option_next_req) client_request.len = strlen(payload); LOG_INF("Send next request"); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -516,7 +516,7 @@ ZTEST(coap_client, test_get_no_path) k_sleep(K_MSEC(1)); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_equal(ret, -EINVAL, "Get request without path"); } @@ -541,7 +541,7 @@ ZTEST(coap_client, test_send_large_data) k_sleep(K_MSEC(1)); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -563,6 +563,11 @@ ZTEST(coap_client, test_no_response) .payload = NULL, .len = 0 }; + struct coap_transmission_parameters params = { + .ack_timeout = 200, + .coap_backoff_percent = 200, + .max_retransmission = 0 + }; client_request.payload = short_payload; client_request.len = strlen(short_payload); @@ -571,7 +576,7 @@ ZTEST(coap_client, test_no_response) LOG_INF("Send request"); clear_socket_events(); - ret = coap_client_req(&client, 0, &address, &client_request, 0); + ret = coap_client_req(&client, 0, &address, &client_request, ¶ms); zassert_true(ret >= 0, "Sending request failed, %d", ret); k_sleep(K_MSEC(300)); @@ -601,7 +606,7 @@ ZTEST(coap_client, test_separate_response) k_sleep(K_MSEC(1)); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -632,10 +637,10 @@ ZTEST(coap_client, test_multiple_requests) set_socket_events(ZSOCK_POLLIN); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - ret = coap_client_req(&client, 0, &address, &client_request, -1); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); k_sleep(K_MSEC(5)); @@ -660,6 +665,11 @@ ZTEST(coap_client, test_unmatching_tokens) .payload = NULL, .len = 0 }; + struct coap_transmission_parameters params = { + .ack_timeout = 200, + .coap_backoff_percent = 200, + .max_retransmission = 0 + }; client_request.payload = short_payload; client_request.len = strlen(short_payload); @@ -667,7 +677,7 @@ ZTEST(coap_client, test_unmatching_tokens) z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_unmatching; LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, 0); + ret = coap_client_req(&client, 0, &address, &client_request, ¶ms); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -675,4 +685,5 @@ ZTEST(coap_client, test_unmatching_tokens) k_sleep(K_MSEC(1)); clear_socket_events(); k_sleep(K_MSEC(500)); + zassert_equal(last_response_code, -ETIMEDOUT, "Unexpected response"); } From ea66a88e403833bdbf301df2aaa42ac87e4fd713 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Wed, 13 Dec 2023 15:13:18 +0200 Subject: [PATCH 0142/2300] [nrf fromtree] tests: net: coap: Add test case for transmission parameters Add new test case. Signed-off-by: Juha Ylinen (cherry picked from commit f9fa2ae77ccf71c5443e756338d2234ea89ecbc2) (cherry picked from commit b953247879b2a9ef5acb901e561996c984e5cd3e) --- tests/net/lib/coap/src/main.c | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/net/lib/coap/src/main.c b/tests/net/lib/coap/src/main.c index 52b6cf0fd2a..d1903dea10c 100644 --- a/tests/net/lib/coap/src/main.c +++ b/tests/net/lib/coap/src/main.c @@ -1718,4 +1718,57 @@ ZTEST(coap, test_coap_packet_set_path) COAP_OPTION_URI_PATH); } +ZTEST(coap, test_transmission_parameters) +{ + struct coap_packet cpkt; + struct coap_pending *pending; + struct coap_transmission_parameters params; + uint8_t *data = data_buf[0]; + int r; + uint16_t id; + + params = coap_get_transmission_parameters(); + zassert_equal(params.ack_timeout, CONFIG_COAP_INIT_ACK_TIMEOUT_MS, "Wrong ACK timeout"); + 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.coap_backoff_percent = 150; + params.max_retransmission = 2; + + coap_set_transmission_parameters(¶ms); + + id = coap_next_id(); + + r = coap_packet_init(&cpkt, data, COAP_BUF_SIZE, COAP_VERSION_1, + COAP_TYPE_CON, 0, coap_next_token(), + COAP_METHOD_GET, id); + zassert_equal(r, 0, "Could not initialize packet"); + + pending = coap_pending_next_unused(pendings, NUM_PENDINGS); + zassert_not_null(pending, "No free pending"); + + params.ack_timeout = 3000; + params.coap_backoff_percent = 250; + params.max_retransmission = 3; + + r = coap_pending_init(pending, &cpkt, (struct sockaddr *) &dummy_addr, + ¶ms); + zassert_equal(r, 0, "Could not initialize packet"); + + zassert_equal(pending->params.ack_timeout, 3000, "Wrong ACK timeout"); + zassert_equal(pending->params.coap_backoff_percent, 250, "Wrong backoff percent"); + zassert_equal(pending->params.max_retransmission, 3, "Wrong max retransmission value"); + + r = coap_pending_init(pending, &cpkt, (struct sockaddr *) &dummy_addr, + NULL); + zassert_equal(r, 0, "Could not initialize packet"); + + zassert_equal(pending->params.ack_timeout, 1000, "Wrong ACK timeout"); + zassert_equal(pending->params.coap_backoff_percent, 150, "Wrong backoff percent"); + zassert_equal(pending->params.max_retransmission, 2, "Wrong max retransmission value"); +} + ZTEST_SUITE(coap, NULL, NULL, NULL, NULL, NULL); From 27d0080fa2425fa53fa360ebbf8cd91aeeb7918b Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 14 Dec 2023 15:53:28 +0100 Subject: [PATCH 0143/2300] [nrf fromtree] net: lib: coap: Use coap_transmission_parameters in coap_server Update coap_service_send and coap_resource_send to take an optional pointer argument to the newly introduced coap_transmission_parameters. Signed-off-by: Pieter De Gendt (cherry picked from commit 4807ada01ee98d52ad7aa5b36166529b683fc09b) (cherry picked from commit ab3e1338b6df45aae5bb77faff8aaeab2e26950b) --- .../networking/api/coap_server.rst | 4 ++-- include/zephyr/net/coap_service.h | 8 ++++++-- samples/net/sockets/coap_server/src/core.c | 2 +- samples/net/sockets/coap_server/src/large.c | 6 +++--- .../sockets/coap_server/src/location_query.c | 2 +- samples/net/sockets/coap_server/src/observer.c | 2 +- samples/net/sockets/coap_server/src/query.c | 2 +- samples/net/sockets/coap_server/src/separate.c | 4 ++-- samples/net/sockets/coap_server/src/test.c | 8 ++++---- subsys/net/lib/coap/Kconfig | 6 ------ subsys/net/lib/coap/coap_server.c | 18 ++++++++---------- 11 files changed, 29 insertions(+), 33 deletions(-) diff --git a/doc/connectivity/networking/api/coap_server.rst b/doc/connectivity/networking/api/coap_server.rst index eb816665f41..bd53630ad6c 100644 --- a/doc/connectivity/networking/api/coap_server.rst +++ b/doc/connectivity/networking/api/coap_server.rst @@ -97,7 +97,7 @@ The following is an example of a CoAP resource registered with our service: coap_packet_append_payload(&response, (uint8_t *)msg, sizeof(msg)); /* Send to response back to the client */ - return coap_resource_send(resource, &response, addr, addr_len); + return coap_resource_send(resource, &response, addr, addr_len, NULL); } static int my_put(struct coap_resource *resource, struct coap_packet *request, @@ -189,7 +189,7 @@ and send state updates. An example using a temperature sensor can look like: coap_packet_append_payload_marker(&response); coap_packet_append_payload(&response, (uint8_t *)payload, strlen(payload)); - return coap_resource_send(resource, &response, addr, addr_len); + return coap_resource_send(resource, &response, addr, addr_len, NULL); } static int temp_get(struct coap_resource *resource, struct coap_packet *request, diff --git a/include/zephyr/net/coap_service.h b/include/zephyr/net/coap_service.h index 6f038ce61e1..b894fecf519 100644 --- a/include/zephyr/net/coap_service.h +++ b/include/zephyr/net/coap_service.h @@ -235,10 +235,12 @@ int coap_service_is_running(const struct coap_service *service); * @param cpkt CoAP Packet to send * @param addr Peer address * @param addr_len Peer address length + * @param params Pointer to transmission parameters structure or NULL to use default values. * @return 0 in case of success or negative in case of error. */ int coap_service_send(const struct coap_service *service, const struct coap_packet *cpkt, - const struct sockaddr *addr, socklen_t addr_len); + const struct sockaddr *addr, socklen_t addr_len, + const struct coap_transmission_parameters *params); /** * @brief Send a CoAP message from the provided @p resource . @@ -249,10 +251,12 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack * @param cpkt CoAP Packet to send * @param addr Peer address * @param addr_len Peer address length + * @param params Pointer to transmission parameters structure or NULL to use default values. * @return 0 in case of success or negative in case of error. */ int coap_resource_send(const struct coap_resource *resource, const struct coap_packet *cpkt, - const struct sockaddr *addr, socklen_t addr_len); + const struct sockaddr *addr, socklen_t addr_len, + const struct coap_transmission_parameters *params); /** * @brief Parse a CoAP observe request for the provided @p resource . diff --git a/samples/net/sockets/coap_server/src/core.c b/samples/net/sockets/coap_server/src/core.c index 276ab0d5de1..00f4adb4d34 100644 --- a/samples/net/sockets/coap_server/src/core.c +++ b/samples/net/sockets/coap_server/src/core.c @@ -45,7 +45,7 @@ static int core_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } diff --git a/samples/net/sockets/coap_server/src/large.c b/samples/net/sockets/coap_server/src/large.c index 28a3eebe099..8656a5b53b1 100644 --- a/samples/net/sockets/coap_server/src/large.c +++ b/samples/net/sockets/coap_server/src/large.c @@ -87,7 +87,7 @@ static int large_get(struct coap_resource *resource, memset(&ctx, 0, sizeof(ctx)); } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } @@ -167,7 +167,7 @@ static int large_update_put(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } @@ -239,7 +239,7 @@ static int large_create_post(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } diff --git a/samples/net/sockets/coap_server/src/location_query.c b/samples/net/sockets/coap_server/src/location_query.c index b13079bc456..bce4eb67b86 100644 --- a/samples/net/sockets/coap_server/src/location_query.c +++ b/samples/net/sockets/coap_server/src/location_query.c @@ -59,7 +59,7 @@ static int location_query_post(struct coap_resource *resource, } } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } diff --git a/samples/net/sockets/coap_server/src/observer.c b/samples/net/sockets/coap_server/src/observer.c index 6d39536e232..8a14d316c61 100644 --- a/samples/net/sockets/coap_server/src/observer.c +++ b/samples/net/sockets/coap_server/src/observer.c @@ -80,7 +80,7 @@ static int send_notification_packet(struct coap_resource *resource, k_work_reschedule(&obs_work, K_SECONDS(5)); - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } diff --git a/samples/net/sockets/coap_server/src/query.c b/samples/net/sockets/coap_server/src/query.c index 10479b1e6f1..95272189d9c 100644 --- a/samples/net/sockets/coap_server/src/query.c +++ b/samples/net/sockets/coap_server/src/query.c @@ -89,7 +89,7 @@ static int query_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } diff --git a/samples/net/sockets/coap_server/src/separate.c b/samples/net/sockets/coap_server/src/separate.c index c3f6f6c256e..68bba0bb473 100644 --- a/samples/net/sockets/coap_server/src/separate.c +++ b/samples/net/sockets/coap_server/src/separate.c @@ -43,7 +43,7 @@ static int separate_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); if (r < 0) { return r; } @@ -86,7 +86,7 @@ static int separate_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } diff --git a/samples/net/sockets/coap_server/src/test.c b/samples/net/sockets/coap_server/src/test.c index aa496a125b1..52885b31a5d 100644 --- a/samples/net/sockets/coap_server/src/test.c +++ b/samples/net/sockets/coap_server/src/test.c @@ -73,7 +73,7 @@ static int piggyback_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } @@ -113,7 +113,7 @@ static int test_del(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } @@ -160,7 +160,7 @@ static int test_put(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } @@ -221,7 +221,7 @@ static int test_post(struct coap_resource *resource, } } - r = coap_resource_send(resource, &response, addr, addr_len); + r = coap_resource_send(resource, &response, addr, addr_len, NULL); return r; } diff --git a/subsys/net/lib/coap/Kconfig b/subsys/net/lib/coap/Kconfig index f4d002d0c5d..63396bb0518 100644 --- a/subsys/net/lib/coap/Kconfig +++ b/subsys/net/lib/coap/Kconfig @@ -202,12 +202,6 @@ config COAP_SERVICE_PENDING_MESSAGES help Maximum number of pending CoAP messages to retransmit per active service. -config COAP_SERVICE_PENDING_RETRANSMITS - int "CoAP retransmit count" - default 2 - help - Maximum number of retries to send a pending message. - config COAP_SERVICE_OBSERVERS int "CoAP service observers" default 3 diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 66e5dcbc32c..28d5b8de47f 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -215,7 +215,7 @@ static int coap_server_process(int sock_fd) goto unlock; } - ret = coap_service_send(service, &response, &client_addr, client_addr_len); + ret = coap_service_send(service, &response, &client_addr, client_addr_len, NULL); } else { ret = coap_handle_request_len(&request, service->res_begin, COAP_SERVICE_RESOURCE_COUNT(service), @@ -246,7 +246,7 @@ static int coap_server_process(int sock_fd) goto unlock; } - ret = coap_service_send(service, &ack, &client_addr, client_addr_len); + ret = coap_service_send(service, &ack, &client_addr, client_addr_len, NULL); } } @@ -521,7 +521,8 @@ int coap_service_is_running(const struct coap_service *service) } int coap_service_send(const struct coap_service *service, const struct coap_packet *cpkt, - const struct sockaddr *addr, socklen_t addr_len) + const struct sockaddr *addr, socklen_t addr_len, + const struct coap_transmission_parameters *params) { int ret; @@ -542,8 +543,6 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack * try to send. */ if (coap_header_get_type(cpkt) == COAP_TYPE_CON) { - struct coap_transmission_parameters params; - struct coap_pending *pending = coap_pending_next_unused(service->data->pending, MAX_PENDINGS); @@ -552,9 +551,7 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack goto send; } - params = coap_get_transmission_parameters(); - params.max_retransmission = CONFIG_COAP_SERVICE_PENDING_RETRANSMITS; - ret = coap_pending_init(pending, cpkt, addr, ¶ms); + ret = coap_pending_init(pending, cpkt, addr, params); if (ret < 0) { LOG_WRN("Failed to init pending message for %s (%d)", service->name, ret); goto send; @@ -589,12 +586,13 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack } int coap_resource_send(const struct coap_resource *resource, const struct coap_packet *cpkt, - const struct sockaddr *addr, socklen_t addr_len) + const struct sockaddr *addr, socklen_t addr_len, + const struct coap_transmission_parameters *params) { /* Find owning service */ COAP_SERVICE_FOREACH(svc) { if (COAP_SERVICE_HAS_RESOURCE(svc, resource)) { - return coap_service_send(svc, cpkt, addr, addr_len); + return coap_service_send(svc, cpkt, addr, addr_len, params); } } From 1db2beecb042d6763b404da9b28d81d4c1afe909 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 14 Dec 2023 16:06:55 +0100 Subject: [PATCH 0144/2300] [nrf fromtree] doc: migration-guide: 3.6: Add CoAP service send functions update. Add an entry to indicate the changes to the coap_service_send and coap_resource_send API functions. Signed-off-by: Pieter De Gendt (cherry picked from commit dee2fe27f658e715427215d477f298558f6b1381) (cherry picked from commit a3324c83c81941b2a8ddea05ffbb002ac5085583) --- doc/releases/migration-guide-3.6.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index 27567c3c052..eeac0a89b75 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -160,6 +160,10 @@ Networking use default values. (:github:`66482`) +* The CoAP public API functions :c:func:`coap_service_send` and :c:func:`coap_resource_send` have + changed. An additional parameter pointer to :c:struct:`coap_transmission_parameters` has been + added. It is safe to pass a NULL pointer to use default values. (:github:`66540`) + * The IGMP multicast library now supports IGMPv3. This results in a minor change to the existing api. The :c:func:`net_ipv4_igmp_join` now takes an additional argument of the type ``const struct igmp_param *param``. This allows IGMPv3 to exclude/include certain groups of From 44fb7468ff22f2a5b76a748aba73ac422446a6f2 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 18 Dec 2023 13:37:33 +0200 Subject: [PATCH 0145/2300] [nrf fromtree] net: coap: Add API to count number of pending requests Add coap_pendings_count() that return number of waiting requests on the pendings array. Signed-off-by: Seppo Takalo (cherry picked from commit 01568b573a93bf55ecd7da62ce1cab08746c9392) (cherry picked from commit b03f75da925a56c6b939328dcc1130ed7f9046f5) --- include/zephyr/net/coap.h | 9 +++++++++ subsys/net/lib/coap/coap.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index e303d5c8ad3..cd57c560bee 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -1112,6 +1112,15 @@ void coap_pending_clear(struct coap_pending *pending); */ void coap_pendings_clear(struct coap_pending *pendings, size_t len); +/** + * @brief Count number of pending requests. + * + * @param len Number of elements in array. + * @param pendings Array of pending requests. + * @return count of elements where timeout is not zero. + */ +size_t coap_pendings_count(struct coap_pending *pendings, size_t len); + /** * @brief Cancels awaiting for this reply, so it becomes available * again. User responsibility to free the memory associated with data. diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index bfb643a8e8c..d22ee29bea7 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1734,6 +1734,19 @@ void coap_pendings_clear(struct coap_pending *pendings, size_t len) } } +size_t coap_pendings_count(struct coap_pending *pendings, size_t len) +{ + struct coap_pending *p = pendings; + size_t c = 0; + + for (size_t i = 0; i < len && p; i++, p++) { + if (p->timeout) { + c++; + } + } + return c; +} + /* Reordering according to RFC7641 section 3.4 but without timestamp comparison */ static inline bool is_newer(int v1, int v2) { From b9a2d31d14e2e54d41fe16a165255767b5caf788 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 18 Dec 2023 13:43:03 +0200 Subject: [PATCH 0146/2300] [nrf fromtree] net: lwm2m: Update TX timestamp on zsock_send() In slow networks, like Nb-IOT, when using queue mode, there might be significant delay between the time we put the packet into a transmission queue and the time we actually start transmitting. This might cause QUEUE_RX_OFF state to be triggered earlier than expected. Remedy the issue by updating the timestamp on the moment where packet is accepted by zsock_send(). Signed-off-by: Seppo Takalo (cherry picked from commit 0d650ffd2626e522a64d08525f62fdac75298c2c) (cherry picked from commit c431117e0aeb2ae0e62bbe38af41480cc9730b3f) --- subsys/net/lib/lwm2m/lwm2m_engine.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 959d07419d3..85a428eeb5d 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -684,6 +684,8 @@ static int socket_send_message(struct lwm2m_ctx *client_ctx) if (rc < 0) { LOG_ERR("Failed to send packet, err %d", errno); rc = -errno; + } else { + engine_update_tx_time(); } if (msg->type != COAP_TYPE_CON) { From e1519af0be4b9937dc9a0c17a50c37f4d2f171a8 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 9 Nov 2023 11:59:09 +0200 Subject: [PATCH 0147/2300] [nrf fromtree] net: lwm2m: Transmission state indications Allow engine to give hints about ongoing CoAP transmissions. This information can be used to control various power saving modes for network interfaces. For example cellular networks might support release assist indicator. Signed-off-by: Seppo Takalo (cherry picked from commit 6161fbdf21fe5f567b5828c54f84c5e3405fca71) (cherry picked from commit aced8e7eb6e18ad4c3c12ee810883a3ff298866d) --- include/zephyr/net/lwm2m.h | 24 +++++++ samples/net/lwm2m_client/overlay-queue.conf | 2 + samples/net/lwm2m_client/src/lwm2m-client.c | 20 ++++++ subsys/net/lib/lwm2m/lwm2m_engine.c | 35 +++++++++- tests/net/lib/lwm2m/lwm2m_engine/src/main.c | 72 +++++++++++++++++++- tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c | 2 + tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h | 4 ++ 7 files changed, 155 insertions(+), 4 deletions(-) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index 51324f63153..3fca8bffae3 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -134,6 +134,22 @@ typedef void (*lwm2m_ctx_event_cb_t)(struct lwm2m_ctx *ctx, enum lwm2m_rd_client_event event); +/** + * @brief Different traffic states of the LwM2M socket. + * + * This information can be used to give hints for the network interface + * that can decide what kind of power management should be used. + * + * These hints are given from CoAP layer messages, so usage of DTLS might affect the + * actual number of expected datagrams. + */ +enum lwm2m_socket_states { + LWM2M_SOCKET_STATE_ONGOING, /**< Ongoing traffic is expected. */ + LWM2M_SOCKET_STATE_ONE_RESPONSE, /**< One response is expected for the next message. */ + LWM2M_SOCKET_STATE_LAST, /**< Next message is the last one. */ + LWM2M_SOCKET_STATE_NO_DATA, /**< No more data is expected. */ +}; + /** * @brief LwM2M context structure to maintain information for a single * LwM2M connection. @@ -249,6 +265,14 @@ struct lwm2m_ctx { * copied into the actual resource buffer. */ uint8_t validate_buf[CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE]; + + /** + * Callback to indicate transmission states. + * Client application may request LwM2M engine to indicate hints about + * transmission states and use that information to control various power + * saving modes. + */ + void (*set_socket_state)(int fd, enum lwm2m_socket_states state); }; /** diff --git a/samples/net/lwm2m_client/overlay-queue.conf b/samples/net/lwm2m_client/overlay-queue.conf index 1adc9eda5ec..946c0fbab67 100644 --- a/samples/net/lwm2m_client/overlay-queue.conf +++ b/samples/net/lwm2m_client/overlay-queue.conf @@ -1,5 +1,7 @@ CONFIG_LWM2M_QUEUE_MODE_ENABLED=y CONFIG_LWM2M_QUEUE_MODE_UPTIME=20 +CONFIG_LWM2M_RD_CLIENT_STOP_POLLING_AT_IDLE=y + # Default lifetime is 1 day CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIME=86400 # Send update once an hour diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index c610f1ad8dd..2e9792e51ea 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -253,6 +253,25 @@ static void rd_client_event(struct lwm2m_ctx *client, } } +static void socket_state(int fd, enum lwm2m_socket_states state) +{ + (void) fd; + switch (state) { + case LWM2M_SOCKET_STATE_ONGOING: + LOG_DBG("LWM2M_SOCKET_STATE_ONGOING"); + break; + case LWM2M_SOCKET_STATE_ONE_RESPONSE: + LOG_DBG("LWM2M_SOCKET_STATE_ONE_RESPONSE"); + break; + case LWM2M_SOCKET_STATE_LAST: + LOG_DBG("LWM2M_SOCKET_STATE_LAST"); + break; + case LWM2M_SOCKET_STATE_NO_DATA: + LOG_DBG("LWM2M_SOCKET_STATE_NO_DATA"); + break; + } +} + static void observe_cb(enum lwm2m_observe_event event, struct lwm2m_obj_path *path, void *user_data) { @@ -367,6 +386,7 @@ int main(void) #if defined(CONFIG_LWM2M_DTLS_SUPPORT) client_ctx.tls_tag = CONFIG_LWM2M_APP_TLS_TAG; #endif + client_ctx.set_socket_state = socket_state; /* client_ctx.sec_obj_inst is 0 as a starting point */ lwm2m_rd_client_start(&client_ctx, endpoint, flags, rd_client_event, observe_cb); diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 85a428eeb5d..d5a289a111f 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -197,6 +197,11 @@ int lwm2m_socket_suspend(struct lwm2m_ctx *client_ctx) lwm2m_close_socket(client_ctx); /* store back the socket handle */ client_ctx->sock_fd = socket_temp_id; + + if (client_ctx->set_socket_state) { + client_ctx->set_socket_state(client_ctx->sock_fd, + LWM2M_SOCKET_STATE_NO_DATA); + } } return ret; @@ -659,10 +664,10 @@ static int socket_recv_message(struct lwm2m_ctx *client_ctx) return 0; } -static int socket_send_message(struct lwm2m_ctx *client_ctx) +static int socket_send_message(struct lwm2m_ctx *ctx) { int rc; - sys_snode_t *msg_node = sys_slist_get(&client_ctx->pending_sends); + sys_snode_t *msg_node = sys_slist_get(&ctx->pending_sends); struct lwm2m_message *msg; if (!msg_node) { @@ -679,6 +684,32 @@ static int socket_send_message(struct lwm2m_ctx *client_ctx) coap_pending_cycle(msg->pending); } + if (ctx->set_socket_state) { +#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED) + bool empty = sys_slist_is_empty(&ctx->pending_sends) && + sys_slist_is_empty(&ctx->queued_messages); +#else + bool empty = sys_slist_is_empty(&ctx->pending_sends); +#endif + if (coap_pendings_count(ctx->pendings, ARRAY_SIZE(ctx->pendings)) > 1) { + empty = false; + } + + if (!empty) { + ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_ONGOING); + } else { + switch (msg->type) { + case COAP_TYPE_CON: + ctx->set_socket_state(ctx->sock_fd, + LWM2M_SOCKET_STATE_ONE_RESPONSE); + break; + default: + ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_LAST); + break; + } + } + } + rc = zsock_send(msg->ctx->sock_fd, msg->cpkt.data, msg->cpkt.offset, 0); if (rc < 0) { diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c index ed26380eccd..5d80f5d1049 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c @@ -13,10 +13,11 @@ #include "lwm2m_rd_client.h" #include "stubs.h" -#if defined(CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME) +#if defined(CONFIG_NATIVE_SIM_SLOWDOWN_TO_REAL_TIME) #include "timer_model.h" #endif +#define LOG_LEVEL LOG_LEVEL_DBG LOG_MODULE_REGISTER(lwm2m_engine_test); DEFINE_FFF_GLOBALS; @@ -67,7 +68,7 @@ static void test_service(struct k_work *work) static void setup(void *data) { -#if defined(CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME) +#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 */ @@ -467,3 +468,70 @@ ZTEST(lwm2m_engine, test_security) zassert_equal(tls_credential_add_fake.arg1_history[2], TLS_CREDENTIAL_CA_CERTIFICATE); zassert_equal(lwm2m_engine_stop(&ctx), 0); } + +static enum lwm2m_socket_states last_state; + +static void socket_state(int fd, enum lwm2m_socket_states state) +{ + (void) fd; + last_state = state; +} + +ZTEST(lwm2m_engine, test_socket_state) +{ + int ret; + struct lwm2m_ctx ctx = { + .remote_addr.sa_family = AF_INET, + .sock_fd = -1, + .set_socket_state = socket_state, + }; + struct lwm2m_message msg1 = { + .ctx = &ctx, + .type = COAP_TYPE_CON, + }; + struct lwm2m_message msg2 = msg1; + struct lwm2m_message ack = { + .ctx = &ctx, + .type = COAP_TYPE_ACK, + }; + + sys_slist_init(&ctx.pending_sends); + ret = lwm2m_engine_start(&ctx); + zassert_equal(ret, 0); + + /* One confimable in queue, should cause ONE_RESPONSE status */ + coap_pendings_count_fake.return_val = 1; + sys_slist_append(&ctx.pending_sends, &msg1.node); + set_socket_events(ZSOCK_POLLOUT); + k_sleep(K_MSEC(100)); + zassert_equal(last_state, LWM2M_SOCKET_STATE_ONE_RESPONSE); + + /* More than one messages in queue, not empty, should cause ONGOING */ + coap_pendings_count_fake.return_val = 2; + sys_slist_append(&ctx.pending_sends, &msg1.node); + sys_slist_append(&ctx.pending_sends, &msg2.node); + set_socket_events(ZSOCK_POLLOUT); + k_sleep(K_MSEC(100)); + zassert_equal(last_state, LWM2M_SOCKET_STATE_ONGOING); + + /* Last out, while waiting for ACK to both, should still cause ONGOING */ + coap_pendings_count_fake.return_val = 2; + set_socket_events(ZSOCK_POLLOUT); + k_sleep(K_MSEC(100)); + zassert_equal(last_state, LWM2M_SOCKET_STATE_ONGOING); + + /* Only one Ack transmiting, nothing expected back -> LAST */ + coap_pendings_count_fake.return_val = 0; + sys_slist_append(&ctx.pending_sends, &ack.node); + set_socket_events(ZSOCK_POLLOUT); + k_sleep(K_MSEC(100)); + zassert_equal(last_state, LWM2M_SOCKET_STATE_LAST); + + /* Socket suspended (as in QUEUE_RX_OFF), should cause NO_DATA */ + ret = lwm2m_socket_suspend(&ctx); + zassert_equal(ret, 0); + zassert_equal(last_state, LWM2M_SOCKET_STATE_NO_DATA); + + ret = lwm2m_engine_stop(&ctx); + zassert_equal(ret, 0); +} diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c index 5db155f1e29..0958d75a54a 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c @@ -19,6 +19,7 @@ DEFINE_FAKE_VALUE_FUNC(int, lwm2m_send_message_async, struct lwm2m_message *); DEFINE_FAKE_VOID_FUNC(lwm2m_registry_lock); DEFINE_FAKE_VOID_FUNC(lwm2m_registry_unlock); DEFINE_FAKE_VALUE_FUNC(bool, coap_pending_cycle, struct coap_pending *); +DEFINE_FAKE_VALUE_FUNC(size_t, coap_pendings_count, struct coap_pending *, size_t); DEFINE_FAKE_VALUE_FUNC(int, generate_notify_message, struct lwm2m_ctx *, struct observe_node *, void *); DEFINE_FAKE_VALUE_FUNC(int64_t, engine_observe_shedule_next_event, struct observe_node *, uint16_t, @@ -41,6 +42,7 @@ DEFINE_FAKE_VALUE_FUNC(int, lwm2m_delete_obj_inst, uint16_t, uint16_t); DEFINE_FAKE_VOID_FUNC(lwm2m_clear_block_contexts); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_security_mode, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(int, z_impl_zsock_setsockopt, int, int, int, const void *, socklen_t); +DEFINE_FAKE_VOID_FUNC(engine_update_tx_time); static sys_slist_t obs_obj_path_list = SYS_SLIST_STATIC_INIT(&obs_obj_path_list); sys_slist_t *lwm2m_obs_obj_path_list(void) diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h index 7b8ca481f85..67c4cde883d 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h @@ -28,6 +28,7 @@ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_rd_client_resume); DECLARE_FAKE_VALUE_FUNC(struct lwm2m_message *, find_msg, struct coap_pending *, struct coap_reply *); DECLARE_FAKE_VOID_FUNC(coap_pending_clear, struct coap_pending *); +DECLARE_FAKE_VALUE_FUNC(size_t, coap_pendings_count, struct coap_pending *, size_t); DECLARE_FAKE_VOID_FUNC(lwm2m_reset_message, struct lwm2m_message *, bool); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_send_message_async, struct lwm2m_message *); DECLARE_FAKE_VOID_FUNC(lwm2m_registry_lock); @@ -56,6 +57,7 @@ DECLARE_FAKE_VOID_FUNC(lwm2m_clear_block_contexts); DECLARE_FAKE_VALUE_FUNC(int, z_impl_zsock_connect, int, const struct sockaddr *, socklen_t); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_mode, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, z_impl_zsock_setsockopt, int, int, int, const void *, socklen_t); +DECLARE_FAKE_VOID_FUNC(engine_update_tx_time); #define DO_FOREACH_FAKE(FUNC) \ do { \ @@ -63,6 +65,7 @@ DECLARE_FAKE_VALUE_FUNC(int, z_impl_zsock_setsockopt, int, int, int, const void FUNC(lwm2m_rd_client_resume) \ FUNC(find_msg) \ FUNC(coap_pending_clear) \ + FUNC(coap_pendings_count) \ FUNC(lwm2m_reset_message) \ FUNC(lwm2m_send_message_async) \ FUNC(lwm2m_registry_lock) \ @@ -85,6 +88,7 @@ DECLARE_FAKE_VALUE_FUNC(int, z_impl_zsock_setsockopt, int, int, int, const void FUNC(z_impl_zsock_connect) \ FUNC(lwm2m_security_mode) \ FUNC(z_impl_zsock_setsockopt) \ + FUNC(engine_update_tx_time) \ } while (0) #endif /* STUBS_H */ From 8b012a34965f8bf722ab6751ec9c04dff4a72bda Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 20 Dec 2023 14:48:41 +0200 Subject: [PATCH 0148/2300] [nrf fromtree] net: lwm2m: Deprecate lwm2m_get/set_u64 Deprecate lwm2m_set_u64() and lwm2m_get_u64 as only LWM2M_RES_TYPE_S64 exist. Unsigned variant is not defined. Technically these might have worked OK, but it is undefined what happens to large unsigned values when those are converted to various payload formats (like CBOR) that might decode numbers differently depending of their signedness. Signed-off-by: Seppo Takalo (cherry picked from commit 071cad2e762b04e7ea782a1742ab35b802bbcd78) (cherry picked from commit 3fe5a7ae2f6ef9a4d7e1cdbb99fffe5c1ba66330) --- include/zephyr/net/lwm2m.h | 10 ++++++++++ subsys/net/lib/lwm2m/lwm2m_registry.c | 4 ++-- subsys/net/lib/lwm2m/lwm2m_shell.c | 10 ---------- .../net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c | 10 ---------- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index 3fca8bffae3..c643c32f0bf 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -1009,11 +1009,16 @@ int lwm2m_engine_set_u64(const char *pathstr, uint64_t value); /** * @brief Set resource (instance) value (u64) * + * @deprecated Unsigned 64bit value type does not exits. + * This is internally handled as a int64_t. + * Use lwm2m_set_s64() instead. + * * @param[in] path LwM2M path as a struct * @param[in] value u64 value * * @return 0 for success or negative in case of error. */ +__deprecated int lwm2m_set_u64(const struct lwm2m_obj_path *path, uint64_t value); /** @@ -1335,11 +1340,16 @@ int lwm2m_engine_get_u64(const char *pathstr, uint64_t *value); /** * @brief Get resource (instance) value (u64) * + * @deprecated Unsigned 64bit value type does not exits. + * This is internally handled as a int64_t. + * Use lwm2m_get_s64() instead. + * @param[in] path LwM2M path as a struct * @param[out] value u64 buffer to copy data into * * @return 0 for success or negative in case of error. */ +__deprecated int lwm2m_get_u64(const struct lwm2m_obj_path *path, uint64_t *value); /** diff --git a/subsys/net/lib/lwm2m/lwm2m_registry.c b/subsys/net/lib/lwm2m/lwm2m_registry.c index 210c5525756..1701b7f7412 100644 --- a/subsys/net/lib/lwm2m/lwm2m_registry.c +++ b/subsys/net/lib/lwm2m/lwm2m_registry.c @@ -890,7 +890,7 @@ int lwm2m_engine_set_u64(const char *pathstr, uint64_t value) if (ret < 0) { return ret; } - return lwm2m_set_u64(&path, value); + return lwm2m_set_s64(&path, (int64_t) value); } int lwm2m_set_s8(const struct lwm2m_obj_path *path, int8_t value) @@ -1378,7 +1378,7 @@ int lwm2m_engine_get_u64(const char *pathstr, uint64_t *value) if (ret < 0) { return ret; } - return lwm2m_get_u64(&path, value); + return lwm2m_get_s64(&path, (int64_t *) value); } int lwm2m_get_s8(const struct lwm2m_obj_path *path, int8_t *value) diff --git a/subsys/net/lib/lwm2m/lwm2m_shell.c b/subsys/net/lib/lwm2m/lwm2m_shell.c index a4cedf8cd62..aad7dc5d166 100644 --- a/subsys/net/lib/lwm2m/lwm2m_shell.c +++ b/subsys/net/lib/lwm2m/lwm2m_shell.c @@ -246,14 +246,6 @@ static int cmd_read(const struct shell *sh, size_t argc, char **argv) goto out; } shell_print(sh, "%d\n", temp); - } else if (strcmp(dtype, "-u64") == 0) { - uint64_t temp = 0; - - ret = lwm2m_get_u64(&path, &temp); - if (ret != 0) { - goto out; - } - shell_print(sh, "%lld\n", temp); } else if (strcmp(dtype, "-f") == 0) { double temp = 0; @@ -349,8 +341,6 @@ static int cmd_write(const struct shell *sh, size_t argc, char **argv) ret = lwm2m_set_u16(&path, strtoul(value, &e, 10)); } else if (strcmp(dtype, "-u32") == 0) { ret = lwm2m_set_u32(&path, strtoul(value, &e, 10)); - } else if (strcmp(dtype, "-u64") == 0) { - ret = lwm2m_set_u64(&path, strtoull(value, &e, 10)); } else if (strcmp(dtype, "-b") == 0) { ret = lwm2m_set_bool(&path, strtoul(value, &e, 10)); } else if (strcmp(dtype, "-t") == 0) { diff --git a/tests/net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c b/tests/net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c index d4c0a7757a6..8e99f666b7f 100644 --- a/tests/net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c +++ b/tests/net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c @@ -203,16 +203,6 @@ ZTEST(lwm2m_registry, test_get_set) zassert_equal(strlen(buf), 0); } -ZTEST(lwm2m_registry, test_missing_u64) -{ - /* This data type is missing, so use S64 resource instead */ - uint64_t u64 = 123; - - zassert_equal(lwm2m_set_u64(&LWM2M_OBJ(32768, 0, LWM2M_RES_TYPE_S64), u64), 0); - zassert_equal(lwm2m_get_u64(&LWM2M_OBJ(32768, 0, LWM2M_RES_TYPE_S64), &u64), 0); - zassert_equal(u64, 123); -} - ZTEST(lwm2m_registry, test_temp_sensor) { int ret; From 49cdc78cc0a313ef9796d84d327b3e508b238b77 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 21 Dec 2023 14:35:35 +0200 Subject: [PATCH 0149/2300] [nrf fromtree] net: lwm2m: Add transmission state indicator to RX as well Refactored the socket state indication into its own function that checks the state of TX queues as well as number of pending CoAP responses. Check the state after receiving a packet, as it might have been a last Ack packet we have been waiting. Signed-off-by: Seppo Takalo (cherry picked from commit dc6e7aa4b15b11094f2604c35180f7c72656896d) (cherry picked from commit fa2e2446f70fb44dafafa409b03fde40031d3b79) --- subsys/net/lib/lwm2m/lwm2m_engine.c | 72 +++++++++++++++++++---------- 1 file changed, 47 insertions(+), 25 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index d5a289a111f..639f65ea0fa 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -630,6 +630,50 @@ static int64_t check_notifications(struct lwm2m_ctx *ctx, const int64_t timestam return next; } +/** + * @brief Check TX queue states as well as number or pending CoAP transmissions. + * + * If all queues are empty and there is no packet we are currently transmitting and no + * CoAP responses (pendings) we are waiting, inform the application by a callback + * that socket is in state LWM2M_SOCKET_STATE_NO_DATA. + * Otherwise, before sending a packet, depending on the state of the queues, inform with + * one of the ONGOING, ONE_RESPONSE or LAST indicators. + * + * @param ctx Client context. + * @param ongoing_tx Current packet to be transmitted or NULL. + */ +static void hint_socket_state(struct lwm2m_ctx *ctx, struct lwm2m_message *ongoing_tx) +{ + if (!ctx->set_socket_state) { + return; + } + +#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED) + bool empty = sys_slist_is_empty(&ctx->pending_sends) && + sys_slist_is_empty(&ctx->queued_messages); +#else + bool empty = sys_slist_is_empty(&ctx->pending_sends); +#endif + size_t pendings = coap_pendings_count(ctx->pendings, ARRAY_SIZE(ctx->pendings)); + + if (ongoing_tx) { + /* Check if more than current TX is in pendings list*/ + if (pendings > 1) { + empty = false; + } + + if (!empty) { + ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_ONGOING); + } else if (ongoing_tx->type == COAP_TYPE_CON) { + ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_ONE_RESPONSE); + } else { + ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_LAST); + } + } else if (empty && pendings == 0) { + ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_NO_DATA); + } +} + static int socket_recv_message(struct lwm2m_ctx *client_ctx) { static uint8_t in_buf[NET_IPV6_MTU]; @@ -684,31 +728,7 @@ static int socket_send_message(struct lwm2m_ctx *ctx) coap_pending_cycle(msg->pending); } - if (ctx->set_socket_state) { -#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED) - bool empty = sys_slist_is_empty(&ctx->pending_sends) && - sys_slist_is_empty(&ctx->queued_messages); -#else - bool empty = sys_slist_is_empty(&ctx->pending_sends); -#endif - if (coap_pendings_count(ctx->pendings, ARRAY_SIZE(ctx->pendings)) > 1) { - empty = false; - } - - if (!empty) { - ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_ONGOING); - } else { - switch (msg->type) { - case COAP_TYPE_CON: - ctx->set_socket_state(ctx->sock_fd, - LWM2M_SOCKET_STATE_ONE_RESPONSE); - break; - default: - ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_LAST); - break; - } - } - } + hint_socket_state(ctx, msg); rc = zsock_send(msg->ctx->sock_fd, msg->cpkt.data, msg->cpkt.offset, 0); @@ -847,6 +867,8 @@ static void socket_loop(void *p1, void *p2, void *p3) break; } } + + hint_socket_state(sock_ctx[i], NULL); } if (sock_fds[i].revents & ZSOCK_POLLOUT) { From 05b16c31f8117654c11b67c8a848b58b9c3f91a5 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Wed, 3 Jan 2024 13:08:57 +0200 Subject: [PATCH 0150/2300] [nrf fromtree] net: lwm2m: Delay triggering registration update Add short delay before triggering registration update. This allows postponing the update from application side if needed. Signed-off-by: Juha Ylinen (cherry picked from commit 85dfe3df1422fd104a38bb1241235d92bc079d31) (cherry picked from commit 9029ec9bf830893072ca2825a9704eb8b0169df4) --- subsys/net/lib/lwm2m/lwm2m_rd_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.c b/subsys/net/lib/lwm2m/lwm2m_rd_client.c index 6b3fbcccc68..95b576cb1c6 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.c +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.c @@ -1132,7 +1132,7 @@ static void sm_registration_done(void) if (sm_is_registered() && (client.trigger_update || now >= next_update())) { - set_sm_state(ENGINE_UPDATE_REGISTRATION); + set_sm_state_delayed(ENGINE_UPDATE_REGISTRATION, DELAY_FOR_ACK); } else if (IS_ENABLED(CONFIG_LWM2M_QUEUE_MODE_ENABLED) && (client.engine_state != ENGINE_REGISTRATION_DONE_RX_OFF) && (now >= next_rx_off())) { From 8704811760810e0b0a38ef6f1333c95b584bafb4 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Wed, 3 Jan 2024 16:09:28 +0200 Subject: [PATCH 0151/2300] [nrf fromtree] net: lwm2m: Fix deadlock when calling lwm2m_engine_pause() lwm2m_engine_pause() caused deadlock if it was called within engine thread. Remove while loop from lwm2m_engine_resume(). Signed-off-by: Juha Ylinen (cherry picked from commit 7c53fa86ffa019a8497dd9a2b3943d5976769f07) (cherry picked from commit 38abd5701f082d0f219ba8e8f27763810d5d5adc) --- subsys/net/lib/lwm2m/lwm2m_engine.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 639f65ea0fa..e08bb4ca17e 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -1259,6 +1259,12 @@ int lwm2m_engine_pause(void) suspend_engine_thread = true; lwm2m_engine_wake_up(); + /* Check if pause requested within a engine thread, a callback for example. */ + if (engine_thread_id == k_current_get()) { + LOG_DBG("Pause requested"); + return 0; + } + while (active_engine_thread) { k_msleep(10); } @@ -1275,10 +1281,7 @@ int lwm2m_engine_resume(void) k_thread_resume(engine_thread_id); lwm2m_engine_wake_up(); - while (!active_engine_thread) { - k_msleep(10); - } - LOG_INF("LWM2M engine thread resume"); + return 0; } From 7490b84296dd130dda3f646bd0fa63db4c55966d Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 9 Jan 2024 16:58:18 -0800 Subject: [PATCH 0152/2300] [nrf fromtree] tests: net: lwm2m_engine: workaround stack overflow on qemu_x86 When running on qemu_x86, the test test_socket_state failed on stack overflow. Setting CONFIG_TEST_EXTRA_STACK_SIZE to 1024 seems to fix the issue. So add a board specific config for qemu_x86 so this test would pass. Signed-off-by: Daniel Leung (cherry picked from commit 78790a85aa86c7cd8ed7c9e8b1084306e68b85d7) (cherry picked from commit 30d13f412fd3adff9f781aa6ff6919fc1ba7c618) --- tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf diff --git a/tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf b/tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf new file mode 100644 index 00000000000..c735e1a8a2d --- /dev/null +++ b/tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf @@ -0,0 +1 @@ +CONFIG_TEST_EXTRA_STACK_SIZE=1024 From 649f3d95939d6c51debabb36a06d65da5024950a Mon Sep 17 00:00:00 2001 From: Simon Walz Date: Mon, 8 Jan 2024 13:42:28 +0100 Subject: [PATCH 0153/2300] [nrf fromtree] net: lwm2m: add gateway callback to handle prefixed messages Adding a callback for handling lwm2m messages with prefixed paths defined by the gateway object. If CONFIG_LWM2M_GATEWAY_OBJ_SUPPORT is set, each path is checked for the prefix stored in the object instances of the gateway object 25. If prefixes match the msg is passed to the gw_msg_cb. Signed-off-by: Simon Walz (cherry picked from commit 38aa4d5169e3fe60ef32b0de473831046516891d) (cherry picked from commit e1a716774ebac8c8fd9ef7baa0b7e3c04d1c9514) --- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 12 ++++- subsys/net/lib/lwm2m/lwm2m_message_handling.h | 2 + subsys/net/lib/lwm2m/lwm2m_obj_gateway.c | 52 +++++++++++++++++++ subsys/net/lib/lwm2m/lwm2m_obj_gateway.h | 40 ++++++++++++++ 4 files changed, 105 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 677879304f8..480c64372e8 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -46,6 +46,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include "lwm2m_object.h" #include "lwm2m_obj_access_control.h" #include "lwm2m_obj_server.h" +#include "lwm2m_obj_gateway.h" #include "lwm2m_rw_link_format.h" #include "lwm2m_rw_oma_tlv.h" #include "lwm2m_rw_plain_text.h" @@ -479,7 +480,7 @@ void lwm2m_engine_context_init(struct lwm2m_ctx *client_ctx) } /* utility functions */ -static int coap_options_to_path(struct coap_option *opt, int options_count, +int coap_options_to_path(struct coap_option *opt, int options_count, struct lwm2m_obj_path *path) { uint16_t len, @@ -2268,6 +2269,15 @@ static int handle_request(struct coap_packet *request, struct lwm2m_message *msg msg->token = token; } + if (IS_ENABLED(CONFIG_LWM2M_GATEWAY_OBJ_SUPPORT)) { + r = lwm2m_gw_handle_req(msg); + if (r == 0) { + return 0; + } else if (r != -ENOENT) { + goto error; + } + } + /* parse the URL path into components */ r = coap_find_options(msg->in.in_cpkt, COAP_OPTION_URI_PATH, options, ARRAY_SIZE(options)); if (r < 0) { diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.h b/subsys/net/lib/lwm2m/lwm2m_message_handling.h index c41fbbac0ee..3ac014b5db8 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.h +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.h @@ -39,6 +39,8 @@ #define NUM_OUTPUT_BLOCK_CONTEXT CONFIG_LWM2M_NUM_OUTPUT_BLOCK_CONTEXT #endif +int coap_options_to_path(struct coap_option *opt, int options_count, + struct lwm2m_obj_path *path); /* LwM2M message functions */ struct lwm2m_message *lwm2m_get_message(struct lwm2m_ctx *client_ctx); struct lwm2m_message *find_msg(struct coap_pending *pending, struct coap_reply *reply); diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_gateway.c b/subsys/net/lib/lwm2m/lwm2m_obj_gateway.c index 711fd5fe127..5bb12f80f47 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_gateway.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_gateway.c @@ -59,6 +59,7 @@ static struct lwm2m_engine_obj_field fields[] = { static struct lwm2m_engine_obj_inst inst[MAX_INSTANCE_COUNT]; static struct lwm2m_engine_res res[MAX_INSTANCE_COUNT][GATEWAY_MAX_ID]; static struct lwm2m_engine_res_inst res_inst[MAX_INSTANCE_COUNT][RESOURCE_INSTANCE_COUNT]; +lwm2m_engine_gateway_msg_cb gateway_msg_cb[MAX_INSTANCE_COUNT]; static int prefix_validation_cb(uint16_t obj_inst_id, uint16_t res_id, uint16_t res_inst_id, uint8_t *data, uint16_t data_len, bool last_block, @@ -146,6 +147,57 @@ static struct lwm2m_engine_obj_inst *lwm2m_gw_create(uint16_t obj_inst_id) return &inst[index]; } +int lwm2m_gw_handle_req(struct lwm2m_message *msg) +{ + struct coap_option options[4]; + int ret; + + ret = coap_find_options(msg->in.in_cpkt, COAP_OPTION_URI_PATH, options, + ARRAY_SIZE(options)); + if (ret < 0) { + return ret; + } + + for (int index = 0; index < MAX_INSTANCE_COUNT; index++) { + /* Skip uninitialized objects */ + if (!inst[index].obj) { + continue; + } + + char *prefix = device_table[index].prefix; + size_t prefix_len = strlen(prefix); + + if (prefix_len != options[0].len) { + continue; + } + if (strncmp(options[0].value, prefix, prefix_len) != 0) { + continue; + } + + if (gateway_msg_cb[index] == NULL) { + return -ENOENT; + } + /* Delete prefix from path*/ + ret = coap_options_to_path(&options[1], ret - 1, &msg->path); + if (ret < 0) { + return ret; + } + return gateway_msg_cb[index](msg); + } + return -ENOENT; +} + +int lwm2m_register_gw_callback(uint16_t obj_inst_id, lwm2m_engine_gateway_msg_cb cb) +{ + for (int index = 0; index < MAX_INSTANCE_COUNT; index++) { + if (inst[index].obj_inst_id == obj_inst_id) { + gateway_msg_cb[index] = cb; + return 0; + } + } + return -ENOENT; +} + static int lwm2m_gw_init(void) { int ret = 0; diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_gateway.h b/subsys/net/lib/lwm2m/lwm2m_obj_gateway.h index 597e3de19bc..0f7a82af249 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_gateway.h +++ b/subsys/net/lib/lwm2m/lwm2m_obj_gateway.h @@ -9,6 +9,8 @@ #ifndef __LWM2M_OBJ_GATEWAY__ #define __LWM2M_OBJ_GATEWAY__ +#include + /* LwM2M Gateway resource IDs */ /* clang-format off */ #define LWM2M_GATEWAY_DEVICE_RID 0 @@ -17,4 +19,42 @@ #define LWM2M_GATEWAY_IOT_DEVICE_OBJECTS_RID 3 /* clang-format on */ +/** + * @brief A callback which handles the prefixed messages from the server. + * + * The callback gets triggered each time the prefix in front of a received lwm2m + * msg path matches the prefix set in the LWM2M_GATEWAY_PREFIX_RID buffer. + * + * It must handle the content of the coap message completely. + * In case of success the LwM2M engine will then send the formatted coap message, + * otherwise a coap response code is sent. + * + * Example of returning CoAP response: + * @code{.c} + * lwm2m_init_message(msg); + * // Write CoAP packet to msg->out.out_cpkt + * return 0; + * @endcode + * + * + * @return 0 if msg contains a valid CoAP response. + * @return negative error code otherwise. + */ +typedef int (*lwm2m_engine_gateway_msg_cb)(struct lwm2m_message *msg); +/** + * @brief Register a callback which handles the prefixed messages from the server. + * + * @return 0 on success + * @return -ENOENT if no object instance with obj_inst_id was found + */ +int lwm2m_register_gw_callback(uint16_t obj_inst_id, lwm2m_engine_gateway_msg_cb cb); +/** + * @brief Check if given message is handled by Gateway callback. + * + * @return 0 if msg was handled by Gateawy and contains a valid response. Negative error code + * otherwise. + * @return -ENOENT if this msg was not handled by Gateway object. + */ +int lwm2m_gw_handle_req(struct lwm2m_message *msg); + #endif /* __LWM2M_OBJ_GATEWAY__ */ From c954e19d2b3b7419e9f1bb8df47d179bd3e74eba Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 3 Jan 2024 13:13:13 +0530 Subject: [PATCH 0154/2300] [nrf fromtree] wifi: shell: Use case insensitive comparison The help text uses the capital case as its an acronym, but passing capital case fails. Also extend that to others as well. Signed-off-by: Chaitanya Tata (cherry picked from commit 9e6542b0cc0a69ba18b8f9bd7d53ac6b51740db3) (cherry picked from commit fdb262308db6a867ad2ca650fd17c823fe1c58db) --- subsys/net/l2/wifi/wifi_shell.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index e1446cceca0..4f378a5029b 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #include #include #include +#include #include #include #include @@ -886,9 +887,9 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) return 0; } - if (!strncmp(argv[1], "on", 2)) { + if (!strncasecmp(argv[1], "on", 2)) { params.enabled = WIFI_PS_ENABLED; - } else if (!strncmp(argv[1], "off", 3)) { + } else if (!strncasecmp(argv[1], "off", 3)) { params.enabled = WIFI_PS_DISABLED; } else { shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n"); @@ -917,9 +918,9 @@ static int cmd_wifi_ps_mode(const struct shell *sh, size_t argc, char *argv[]) context.sh = sh; - if (!strncmp(argv[1], "legacy", 6)) { + if (!strncasecmp(argv[1], "legacy", 6)) { params.mode = WIFI_PS_MODE_LEGACY; - } else if (!strncmp(argv[1], "wmm", 3)) { + } else if (!strncasecmp(argv[1], "WMM", 4)) { params.mode = WIFI_PS_MODE_WMM; } else { shell_fprintf(sh, SHELL_WARNING, "Invalid PS mode\n"); @@ -1405,9 +1406,9 @@ static int cmd_wifi_ps_wakeup_mode(const struct shell *sh, size_t argc, char *ar context.sh = sh; - if (!strncmp(argv[1], "dtim", 4)) { + if (!strncasecmp(argv[1], "dtim", 4)) { params.wakeup_mode = WIFI_PS_WAKEUP_MODE_DTIM; - } else if (!strncmp(argv[1], "listen_interval", 15)) { + } else if (!strncasecmp(argv[1], "listen_interval", 15)) { params.wakeup_mode = WIFI_PS_WAKEUP_MODE_LISTEN_INTERVAL; } else { shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n"); From b5febfc6f0fa63b250d8d153ddf11086de6a8d2a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 10 Jan 2024 23:12:39 +0530 Subject: [PATCH 0155/2300] [nrf fromtree] wifi: shell: Fix missing case sensitivity This was missed in earlier that tried to fix all string comparisons to use case insensitive comparison. Signed-off-by: Chaitanya Tata (cherry picked from commit 2ce295b71e396f5305d39d819ada2fb179128748) (cherry picked from commit 8fe4834f8a7da79703d224f15547011e636c725e) --- subsys/net/l2/wifi/wifi_shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 4f378a5029b..450b7b00eb5 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -601,9 +601,9 @@ static int wifi_scan_args_to_params(const struct shell *sh, state = getopt_state_get(); switch (opt) { case 't': - if (!strcmp(optarg, "passive")) { + if (!strncasecmp(optarg, "passive", 7)) { params->scan_type = WIFI_SCAN_TYPE_PASSIVE; - } else if (!strcmp(optarg, "active")) { + } else if (!strncasecmp(optarg, "active", 6)) { params->scan_type = WIFI_SCAN_TYPE_ACTIVE; } else { shell_fprintf(sh, SHELL_ERROR, "Invalid scan type %s\n", optarg); From 24f0ec8739ff5ba47402d5779372df8c1a8494fb Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 16 Jan 2024 18:36:19 +0530 Subject: [PATCH 0156/2300] [nrf fromtree] wifi: shell: Fix typo in comparison The length should be 3 for WMM not 4. Signed-off-by: Chaitanya Tata (cherry picked from commit dc9d5d932120f22175857a80421c1c2df572af33) (cherry picked from commit cec939280dca0f61b214b0cd1141105b408651b8) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 450b7b00eb5..726ce69b435 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -920,7 +920,7 @@ static int cmd_wifi_ps_mode(const struct shell *sh, size_t argc, char *argv[]) if (!strncasecmp(argv[1], "legacy", 6)) { params.mode = WIFI_PS_MODE_LEGACY; - } else if (!strncasecmp(argv[1], "WMM", 4)) { + } else if (!strncasecmp(argv[1], "WMM", 3)) { params.mode = WIFI_PS_MODE_WMM; } else { shell_fprintf(sh, SHELL_WARNING, "Invalid PS mode\n"); From 3992dca805246f4938750910f9c8be0c6c3cbb73 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 16 Jan 2024 23:25:21 +0530 Subject: [PATCH 0157/2300] [nrf fromlist] wifi: shell: Make channel mandatory for AP For starting an AP mode, channel is mandatory, so, fix the arguments and the help text. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67694 Signed-off-by: Chaitanya Tata (cherry picked from commit e09a8d4a07e55e1e5666348f0c7b69d9f2b5bab7) --- 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 726ce69b435..96ce19e3e5c 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -458,7 +458,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], return -EINVAL; } - /* Channel (optional) */ + /* Channel (optional: STA, mandatory: AP) */ if ((idx < argc) && (strlen(argv[idx]) <= 3)) { params->channel = strtol(argv[idx], &endptr, 10); if (*endptr != '\0') { @@ -1769,14 +1769,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, 1, 0), SHELL_CMD_ARG(enable, NULL, "\"\"\n" - "[channel number: 0 means all]\n" + "\n" "[PSK: valid only for secure SSIDs]\n" "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_ap_enable, - 2, 4), + 3, 3), SHELL_CMD_ARG(stations, NULL, "List stations connected to the AP", cmd_wifi_ap_stations, From bf73ce4c05ed11871082e47e8dc5af812b732e77 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 16 Jan 2024 23:38:47 +0530 Subject: [PATCH 0158/2300] [nrf fromlist] wifi: shell: Add a sanity check for MFP For none and WPA-PSK MFP isn't applicable, it was only introduced in WPA2-PSK (RSN) and later. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67694 Signed-off-by: Chaitanya Tata (cherry picked from commit 75b68d8e2ace1632f64e9bdff36d571211ed4a1b) --- subsys/net/l2/wifi/wifi_shell.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 96ce19e3e5c..0ab9e884780 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -494,6 +494,11 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (idx < argc) { unsigned int mfp = strtol(argv[idx], &endptr, 10); + if (security == WIFI_SECURITY_TYPE_NONE || + security == WIFI_SECURITY_TYPE_WPA_PSK) { + return -EINVAL; + } + if (mfp <= WIFI_MFP_REQUIRED) { params->mfp = mfp; } From bc31c2f32edce5d7fbf958d2e5bc9adf816ba0f3 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 16 Jan 2024 23:30:13 +0530 Subject: [PATCH 0159/2300] [nrf fromlist] wifi: utils: Move channel helpers to public API These can be used for channel validation outside the utils. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67694 Signed-off-by: Chaitanya Tata (cherry picked from commit 02ac99c10a16f304298c6f39f5c5724fceda17bf) --- include/zephyr/net/wifi_utils.h | 43 +++++++++++++++++++++++++++++++++ subsys/net/l2/wifi/wifi_utils.c | 8 +++--- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/include/zephyr/net/wifi_utils.h b/include/zephyr/net/wifi_utils.h index c16eef0e5b2..537db787648 100644 --- a/include/zephyr/net/wifi_utils.h +++ b/include/zephyr/net/wifi_utils.h @@ -103,6 +103,49 @@ int wifi_utils_parse_scan_chan(char *scan_chan_str, struct wifi_band_channel *chan, uint8_t max_channels); + +/** + * @brief Validate a channel against a band. + * + * @param band Band to validate the channel against. + * @param chan Channel to validate. + * + * @retval true if the channel is valid for the band. + * @retval false if the channel is not valid for the band. + */ +bool wifi_utils_validate_chan(uint8_t band, + uint16_t chan); + +/** + * @brief Validate a channel against the 2.4 GHz band. + * + * @param chan Channel to validate. + * + * @retval true if the channel is valid for the band. + * @retval false if the channel is not valid for the band. + */ +bool wifi_utils_validate_chan_2g(uint16_t chan); + +/** + * @brief Validate a channel against the 5 GHz band. + * + * @param chan Channel to validate. + * + * @retval true if the channel is valid for the band. + * @retval false if the channel is not valid for the band. + */ +bool wifi_utils_validate_chan_5g(uint16_t chan); + +/** + * @brief Validate a channel against the 6 GHz band. + * + * @param chan Channel to validate. + * + * @retval true if the channel is valid for the band. + * @retval false if the channel is not valid for the band. + */ +bool wifi_utils_validate_chan_6g(uint16_t chan); + /** * @} */ diff --git a/subsys/net/l2/wifi/wifi_utils.c b/subsys/net/l2/wifi/wifi_utils.c index 52d25d90566..76e93fc33e0 100644 --- a/subsys/net/l2/wifi/wifi_utils.c +++ b/subsys/net/l2/wifi/wifi_utils.c @@ -44,7 +44,7 @@ static enum wifi_frequency_bands wifi_utils_map_band_str_to_idx(char *band_str) } -static bool wifi_utils_validate_chan_2g(uint16_t chan) +bool wifi_utils_validate_chan_2g(uint16_t chan) { if ((chan >= 1) && (chan <= 14)) { return true; @@ -54,7 +54,7 @@ static bool wifi_utils_validate_chan_2g(uint16_t chan) } -static bool wifi_utils_validate_chan_5g(uint16_t chan) +bool wifi_utils_validate_chan_5g(uint16_t chan) { uint16_t i; @@ -68,7 +68,7 @@ static bool wifi_utils_validate_chan_5g(uint16_t chan) } -static bool wifi_utils_validate_chan_6g(uint16_t chan) +bool wifi_utils_validate_chan_6g(uint16_t chan) { if (((chan >= 1) && (chan <= 233) && (!((chan - 1)%4))) || (chan == 2)) { @@ -79,7 +79,7 @@ static bool wifi_utils_validate_chan_6g(uint16_t chan) } -static bool wifi_utils_validate_chan(uint8_t band, +bool wifi_utils_validate_chan(uint8_t band, uint16_t chan) { bool result = false; From a98292f1375f301cbd296cb2c29bccd7240f95e2 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 16 Jan 2024 23:44:23 +0530 Subject: [PATCH 0160/2300] [nrf fromlist] wifi: shell: Add channel validation Validate the channel for both STA and AP modes. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67694 Signed-off-by: Chaitanya Tata (cherry picked from commit bf61fbcf89eaebefdb91d9bab370446cbd7edccc) --- subsys/net/l2/wifi/wifi_shell.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 0ab9e884780..01a76359702 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -437,7 +437,8 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, } static int __wifi_args_to_params(size_t argc, char *argv[], - struct wifi_connect_req_params *params) + struct wifi_connect_req_params *params, + enum wifi_iface_mode iface_mode) { char *endptr; int idx = 1; @@ -465,8 +466,26 @@ static int __wifi_args_to_params(size_t argc, char *argv[], return -EINVAL; } - if (params->channel == 0U) { + if (iface_mode == WIFI_MODE_INFRA && params->channel == 0) { params->channel = WIFI_CHANNEL_ANY; + } else { + const uint8_t bands[] = {WIFI_FREQ_BAND_2_4_GHZ, + WIFI_FREQ_BAND_5_GHZ, + WIFI_FREQ_BAND_6_GHZ}; + uint8_t band; + bool found = false; + + for (band = 0; band < ARRAY_SIZE(bands); band++) { + if (wifi_utils_validate_chan(bands[band], + params->channel)) { + found = true; + break; + } + } + + if (!found) { + return -EINVAL; + } } idx++; @@ -525,7 +544,7 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, struct net_if *iface = net_if_get_first_wifi(); struct wifi_connect_req_params cnx_params = { 0 }; - if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params)) { + if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_INFRA)) { shell_help(sh); return -ENOEXEC; } @@ -1210,7 +1229,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, static struct wifi_connect_req_params cnx_params; int ret; - if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params)) { + if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); return -ENOEXEC; } From 7927411d52ae2c7c945ad4ef2bd37e7fa2073db4 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 16 Jan 2024 23:54:36 +0530 Subject: [PATCH 0161/2300] [nrf fromlist] wifi: shell: Fix the channel extraction The channel extraction from string directly uses the end variable with limited data type, this causes issue if an invalid channel that exceeds the data is given as an input e.g., 300, which would end up as a valid channel 44. Use an intermediate variable with type that can hold all possible combinations (valid and invalid) and only after validation assign that to the end type. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67694 Signed-off-by: Chaitanya Tata (cherry picked from commit 595c41f2e62df604316f242afd8c65ab828ac299) --- subsys/net/l2/wifi/wifi_shell.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 01a76359702..49459774655 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -461,12 +461,13 @@ static int __wifi_args_to_params(size_t argc, char *argv[], /* Channel (optional: STA, mandatory: AP) */ if ((idx < argc) && (strlen(argv[idx]) <= 3)) { - params->channel = strtol(argv[idx], &endptr, 10); + long channel = strtol(argv[idx], &endptr, 10); + if (*endptr != '\0') { return -EINVAL; } - if (iface_mode == WIFI_MODE_INFRA && params->channel == 0) { + if (iface_mode == WIFI_MODE_INFRA && channel == 0) { params->channel = WIFI_CHANNEL_ANY; } else { const uint8_t bands[] = {WIFI_FREQ_BAND_2_4_GHZ, @@ -477,7 +478,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], for (band = 0; band < ARRAY_SIZE(bands); band++) { if (wifi_utils_validate_chan(bands[band], - params->channel)) { + channel)) { found = true; break; } @@ -486,8 +487,9 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (!found) { return -EINVAL; } - } + params->channel = channel; + } idx++; } From 5398fb4fd71a0b2663a532982a6894cdf75a3c08 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 17 Jan 2024 00:15:15 +0530 Subject: [PATCH 0162/2300] [nrf fromlist] wifi: shell: Log errors for validation Handy in giving feedback to the user rather than silent failure. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67694 Signed-off-by: Chaitanya Tata (cherry picked from commit c3be80e41e8271190d4b0eaa4923e28dfe5d6802) --- subsys/net/l2/wifi/wifi_shell.c | 43 ++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 49459774655..f470e700f8c 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -48,6 +48,8 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); NET_EVENT_WIFI_SCAN_RESULT) #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY */ +#define MAX_BANDS_STR_LEN 64 + static struct { const struct shell *sh; @@ -444,6 +446,8 @@ static int __wifi_args_to_params(size_t argc, char *argv[], int idx = 1; if (argc < 1) { + print(context.sh, SHELL_WARNING, + "SSID not specified\n"); return -EINVAL; } @@ -456,6 +460,9 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->ssid = argv[0]; params->ssid_length = strlen(params->ssid); if (params->ssid_length > WIFI_SSID_MAX_LEN) { + print(context.sh, SHELL_WARNING, + "SSID too long (max %d characters)\n", + WIFI_SSID_MAX_LEN); return -EINVAL; } @@ -464,6 +471,11 @@ static int __wifi_args_to_params(size_t argc, char *argv[], long channel = strtol(argv[idx], &endptr, 10); if (*endptr != '\0') { + print(context.sh, SHELL_ERROR, + "Failed to parse channel: %s: endp: %s, err: %s\n", + argv[idx], + endptr, + strerror(errno)); return -EINVAL; } @@ -475,8 +487,23 @@ static int __wifi_args_to_params(size_t argc, char *argv[], WIFI_FREQ_BAND_6_GHZ}; uint8_t band; bool found = false; + char bands_str[MAX_BANDS_STR_LEN] = {0}; + size_t offset = 0; for (band = 0; band < ARRAY_SIZE(bands); band++) { + offset += snprintf(bands_str + offset, + sizeof(bands_str) - offset, + "%s%s", + band ? "," : "", + wifi_band_txt(bands[band])); + if (offset >= sizeof(bands_str)) { + print(context.sh, SHELL_ERROR, + "Failed to parse channel: %s: " + "band string too long\n", + argv[idx]); + return -EINVAL; + } + if (wifi_utils_validate_chan(bands[band], channel)) { found = true; @@ -485,6 +512,10 @@ static int __wifi_args_to_params(size_t argc, char *argv[], } if (!found) { + print(context.sh, SHELL_ERROR, + "Invalid channel: %ld, checked bands: %s\n", + channel, + bands_str); return -EINVAL; } @@ -517,6 +548,9 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (security == WIFI_SECURITY_TYPE_NONE || security == WIFI_SECURITY_TYPE_WPA_PSK) { + print(context.sh, SHELL_ERROR, + "MFP not supported for security type %s\n", + wifi_security_txt(security)); return -EINVAL; } @@ -532,6 +566,10 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->psk_length > WIFI_PSK_MAX_LEN) || (params->security == WIFI_SECURITY_TYPE_SAE && params->psk_length > WIFI_SAE_PSWD_MAX_LEN)) { + print(context.sh, SHELL_ERROR, + "Invalid PSK length (%d) for security type %s\n", + params->psk_length, + wifi_security_txt(params->security)); return -EINVAL; } } @@ -546,13 +584,13 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, struct net_if *iface = net_if_get_first_wifi(); struct wifi_connect_req_params cnx_params = { 0 }; + context.sh = sh; if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_INFRA)) { shell_help(sh); return -ENOEXEC; } context.connecting = true; - context.sh = sh; if (net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, &cnx_params, sizeof(struct wifi_connect_req_params))) { @@ -1231,13 +1269,12 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, static struct wifi_connect_req_params cnx_params; int ret; + context.sh = sh; if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); return -ENOEXEC; } - context.sh = sh; - k_mutex_init(&wifi_ap_sta_list_lock); ret = net_mgmt(NET_REQUEST_WIFI_AP_ENABLE, iface, &cnx_params, From f3c9eaa01babbec87062e294e0c686ae2588d3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 18 Jan 2024 09:41:11 +0100 Subject: [PATCH 0163/2300] [nrf fromtree] drivers: nrf_qspi_nor: Deactivate QSPI peripheral after initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit ea1be7f242b9348863a27adb17215014f15b318a. After the driver performs its initialization, it needs to deactivate the QSPI peripheral. Otherwise, the peripheral would unnecessarily consume power until some QSPI operation is performed (and only then it will get deactivated), what depending on the application may take a significant amount of time. Signed-off-by: Andrzej Głąbek (cherry picked from commit 3f6373eb364bcb3d91ae3733509c41f9673785c3) (cherry picked from commit 4a043af1d0515aab82ec54ceeae543bb7f27a247) --- drivers/flash/nrf_qspi_nor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index d6695989857..0e9d4181418 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -1090,6 +1090,10 @@ static int qspi_nor_init(const struct device *dev) qspi_clock_div_restore(); + if (!IS_ENABLED(CONFIG_NORDIC_QSPI_NOR_XIP) && nrfx_qspi_init_check()) { + (void)nrfx_qspi_deactivate(); + } + #ifdef CONFIG_PM_DEVICE_RUNTIME int rc2 = pm_device_runtime_enable(dev); From 7b5a880d8e8fa917a9f95bdcdfe70ccd6c8e4a21 Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Fri, 24 Nov 2023 08:58:45 +0100 Subject: [PATCH 0164/2300] [nrf fromtree] net: openthread: upmerge to `75694d2` Regular OpenThread upmerge to commit `75694d2`. Move CONFIG_OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE from header file to Kconfig. Signed-off-by: Maciej Baczmanski (cherry picked from commit c2f1ff7f5fbf053def69606a18df4fea83dc7b18) (cherry picked from commit 6aa16dca7035766f29e87ea9f443d1f5d8fa9655) --- modules/openthread/CMakeLists.txt | 6 ++++++ modules/openthread/Kconfig.features | 6 ++++++ .../platform/openthread-core-zephyr-config.h | 10 ---------- subsys/net/l2/openthread/Kconfig | 10 ++-------- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 646b086ef1e..150039863d9 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -400,6 +400,12 @@ else() set(OT_PING_SENDER OFF CACHE BOOL "Enable ping sender support" FORCE) endif() +if(OPENTHREAD_PLATFORM_KEY_REF) + set(OT_PLATFORM_KEY_REF ON CACHE BOOL "Enable platform key reference support" FORCE) +else() + set(OT_PLATFORM_KEY_REF OFF CACHE BOOL "Enable platform key reference support" FORCE) +endif() + if(CONFIG_OPENTHREAD_PLATFORM_NETIF) set(OT_PLATFORM_NETIF ON CACHE BOOL "Enable platform netif support" FORCE) else() diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index 2be5332cde3..952a7853b43 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -249,6 +249,12 @@ config OPENTHREAD_OTNS config OPENTHREAD_PING_SENDER bool "Ping sender support" +config OPENTHREAD_PLATFORM_KEY_REF + bool "Platform cryptographic key reference support" + help + Enable usage of cryptographic key references instead of literal keys. + This requires a crypto backend library that supports key references. + config OPENTHREAD_PLATFORM_NETIF bool "Platform netif support" diff --git a/modules/openthread/platform/openthread-core-zephyr-config.h b/modules/openthread/platform/openthread-core-zephyr-config.h index 881585e5578..773cd170f2c 100644 --- a/modules/openthread/platform/openthread-core-zephyr-config.h +++ b/modules/openthread/platform/openthread-core-zephyr-config.h @@ -396,16 +396,6 @@ #define OPENTHREAD_CONFIG_CRYPTO_LIB OPENTHREAD_CONFIG_CRYPTO_LIB_PSA #endif -/** - * @def OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE - * - * Set to 1 if you want to enable key reference usage support. - * - */ -#ifdef CONFIG_OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE -#define OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE 1 -#endif - /** * @def OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE * diff --git a/subsys/net/l2/openthread/Kconfig b/subsys/net/l2/openthread/Kconfig index 98113975797..aa7e03b8204 100644 --- a/subsys/net/l2/openthread/Kconfig +++ b/subsys/net/l2/openthread/Kconfig @@ -324,21 +324,15 @@ config OPENTHREAD_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE config OPENTHREAD_CRYPTO_PSA bool "ARM PSA crypto API" depends on MBEDTLS_PSA_CRYPTO_C || BUILD_WITH_TFM - select OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE + select OPENTHREAD_PLATFORM_KEY_REF select OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE help Enable crypto backend library implementation based on ARM PSA crypto API instead of the default, using mbedTLS. -config OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE - bool "Cryptographic key reference support" - help - Enable usage of cryptographic key references instead of literal keys - This requires a crypto backend library that supports key references. - config OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE bool "Make MAC keys exportable" - depends on OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE + depends on OPENTHREAD_PLATFORM_KEY_REF help Enable the creation of exportable MAC keys in the OpenThread Key Manager. From ac7bd9f3aeba1fa757204b4b39644ee106d59e39 Mon Sep 17 00:00:00 2001 From: Przemyslaw Bida Date: Fri, 15 Dec 2023 21:30:27 +0100 Subject: [PATCH 0165/2300] [nrf fromtree] net: openthread: Add cmake makro to openthread cmake lists. This commit introduces `kconfig_to_ot_option` to simply fye the way of adding openthread related kconfigs. Signed-off-by: Przemyslaw Bida (cherry picked from commit b6d8d2715c31e971316cb1009460001e68df305f) (cherry picked from commit a0272bc8bc2343fefe6abcd5e3949b505b055c9f) --- modules/openthread/CMakeLists.txt | 571 +++++------------------------- 1 file changed, 90 insertions(+), 481 deletions(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 150039863d9..6691084eebd 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -3,6 +3,14 @@ if(CONFIG_OPENTHREAD_SOURCES) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +macro(kconfig_to_ot_option kconfig_option ot_config description) + if(${kconfig_option}) + set(${ot_config} ON CACHE BOOL "${description}" FORCE) + else() + set(${ot_config} OFF CACHE BOOL "${description}" FORCE) + endif() +endmacro() + # OpenThread options set(OT_BUILD_EXECUTABLES OFF CACHE BOOL "Disable OpenThread samples") set(OT_BUILTIN_MBEDTLS_MANAGEMENT OFF CACHE BOOL "Use Zephyr's mbedTLS heap") @@ -28,494 +36,95 @@ elseif(CONFIG_OPENTHREAD_MTD) set(OT_MTD ON CACHE BOOL "Enable MTD" FORCE) endif() -if(CONFIG_OPENTHREAD_ANYCAST_LOCATOR) - set(OT_ANYCAST_LOCATOR ON CACHE BOOL "Enable anycast locator" FORCE) -else() - set(OT_ANYCAST_LOCATOR OFF CACHE BOOL "Enable anycast locator" FORCE) -endif() - -if(CONFIG_ASSERT) - set(OT_ASSERT ON CACHE BOOL "Enable assert function OT_ASSERT()" FORCE) -else() - set(OT_ASSERT OFF CACHE BOOL "Enable assert function OT_ASSERT()" FORCE) -endif() - -if(CONFIG_OPENTHREAD_BACKBONE_ROUTER) - set(OT_BACKBONE_ROUTER ON CACHE BOOL "Enable backbone router functionality" FORCE) -else() - set(OT_BACKBONE_ROUTER OFF CACHE BOOL "Enable backbone router functionality" FORCE) -endif() - -if(CONFIG_OPENTHREAD_BACKBONE_ROUTER_DUA_NDPROXYING) - set(OT_BACKBONE_ROUTER_DUA_NDPROXYING ON CACHE BOOL "Enable BBR DUA ND Proxy support" FORCE) -else() - set(OT_BACKBONE_ROUTER_DUA_NDPROXYING OFF CACHE BOOL "Enable BBR DUA ND Proxy support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_BACKBONE_ROUTER_MULTICAST_ROUTING) - set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING ON CACHE BOOL "Enable BBR MR support" FORCE) -else() - set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OFF CACHE BOOL "Enable BBR MR support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_BLE_TCAT) - set(OT_BLE_TCAT ON CACHE BOOL "Enable BLE TCAT support" FORCE) -else() - set(OT_BLE_TCAT OFF CACHE BOOL "Enable BLE TCAT support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_BORDER_AGENT) - set(OT_BORDER_AGENT ON CACHE BOOL "Enable Border Agent" FORCE) -else() - set(OT_BORDER_AGENT OFF CACHE BOOL "Enable Border Agent" FORCE) -endif() - -if(CONFIG_OPENTHREAD_BORDER_ROUTER) - set(OT_BORDER_ROUTER ON CACHE BOOL "Enable Border Router" FORCE) -else() - set(OT_BORDER_ROUTER OFF CACHE BOOL "Enable Border Router" FORCE) -endif() - -if(CONFIG_OPENTHREAD_BORDER_ROUTING) - set(OT_BORDER_ROUTING ON CACHE BOOL "Enable Border routing" FORCE) -else() - set(OT_BORDER_ROUTING OFF CACHE BOOL "Enable Border routing" FORCE) -endif() - -if(CONFIG_OPENTHREAD_BORDER_ROUTING_COUNTERS) - set(OT_BORDER_ROUTING_COUNTERS ON CACHE BOOL "Enable Border routing counters" FORCE) -else() - set(OT_BORDER_ROUTING_COUNTERS OFF CACHE BOOL "Enable Border routing counters" FORCE) -endif() - -if(CONFIG_OPENTHREAD_BORDER_ROUTING_DHCP6_PD) - set(OT_BORDER_ROUTING_DHCP6_PD ON CACHE BOOL "DHCPv6-PD support in border routing" FORCE) -else() - set(OT_BORDER_ROUTING_DHCP6_PD OFF CACHE BOOL "DHCPv6-PD support in border routing" FORCE) -endif() - -if(CONFIG_OPENTHREAD_CHANNEL_MANAGER) - set(OT_CHANNEL_MANAGER ON CACHE BOOL "Enable channel manager support" FORCE) -else() - set(OT_CHANNEL_MANAGER OFF CACHE BOOL "Enable channel manager support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_CHANNEL_MONITOR) - set(OT_CHANNEL_MONITOR ON CACHE BOOL "Enable channel monitor support" FORCE) -else() - set(OT_CHANNEL_MONITOR OFF CACHE BOOL "Enable channel monitor support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_COAP) - set(OT_COAP ON CACHE BOOL "Enable CoAP API" FORCE) -else() - set(OT_COAP OFF CACHE BOOL "Enable CoAP API" FORCE) -endif() - -if(CONFIG_OPENTHREAD_COAP_BLOCK) - set(OT_COAP_BLOCK ON CACHE BOOL "Enable CoAP Block-wise option support" FORCE) -else() - set(OT_COAP_BLOCK OFF CACHE BOOL "Enable CoAP Block-wise option support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_COAP_OBSERVE) - set(OT_COAP_OBSERVE ON CACHE BOOL "Enable CoAP Observe option support" FORCE) -else() - set(OT_COAP_OBSERVE OFF CACHE BOOL "Enable CoAP Observe option support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_COAPS) - set(OT_COAPS ON CACHE BOOL "Enable secure CoAP API support" FORCE) -else() - set(OT_COAPS OFF CACHE BOOL "Enable secure CoAP API support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_COMMISSIONER) - set(OT_COMMISSIONER ON CACHE BOOL "Enable Commissioner" FORCE) -else() - set(OT_COMMISSIONER OFF CACHE BOOL "Enable Commissioner" FORCE) -endif() - -if(CONFIG_OPENTHREAD_CSL_AUTO_SYNC) - set(OT_CSL_AUTO_SYNC ON CACHE BOOL "Enable csl autosync" FORCE) -else() - set(OT_CSL_AUTO_SYNC OFF CACHE BOOL "Enable csl autosync" FORCE) -endif() - -if(CONFIG_OPENTHREAD_CSL_DEBUG) - set(OT_CSL_DEBUG ON CACHE BOOL "Enable CSL debug" FORCE) -else() - set(OT_CSL_DEBUG OFF CACHE BOOL "Enable CSL debug" FORCE) -endif() - -if(CONFIG_OPENTHREAD_CSL_RECEIVER) - set(OT_CSL_RECEIVER ON CACHE BOOL "Enable CSL receiver feature for Thread 1.2" FORCE) -else() - set(OT_CSL_RECEIVER OFF CACHE BOOL "Enable CSL receiver feature for Thread 1.2" FORCE) -endif() +kconfig_to_ot_option(CONFIG_OPENTHREAD_ANYCAST_LOCATOR OT_ANYCAST_LOCATOR "Enable anycast locator") +kconfig_to_ot_option(CONFIG_ASSERT OT_ASSERT "Enable assert function OT_ASSERT()") +kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER OT_BACKBONE_ROUTER "Enable backbone router functionality") +kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER_DUA_NDPROXYING OT_BACKBONE_ROUTER_DUA_NDPROXYING "Enable BBR DUA ND Proxy support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER_MULTICAST_ROUTING OT_BACKBONE_ROUTER_MULTICAST_ROUTING "Enable BBR MR support") +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_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") +kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING_DHCP6_PD OT_BORDER_ROUTING_DHCP6_PD "DHCPv6-PD support in border routing") +kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MANAGER OT_CHANNEL_MANAGER "Enable channel manager support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MONITOR OT_CHANNEL_MONITOR "Enable channel monitor support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP OT_COAP "Enable CoAP API") +kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP_BLOCK OT_COAP_BLOCK "Enable CoAP Block-wise option support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP_OBSERVE OT_COAP_OBSERVE "Enable CoAP Observe option support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_COAPS OT_COAPS "Enable secure CoAP API support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_COMMISSIONER OT_COMMISSIONER "Enable Commissioner") +kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_AUTO_SYNC OT_CSL_AUTO_SYNC "Enable csl autosync") +kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_DEBUG OT_CSL_DEBUG "Enable CSL debug") +kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_RECEIVER OT_CSL_RECEIVER "Enable CSL receiver feature for Thread 1.2") +kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_RECEIVER_LOCAL_TIME_SYNC OT_CSL_RECEIVER_LOCAL_TIME_SYNC "Use local time for CSL sync") +kconfig_to_ot_option(CONFIG_OPENTHREAD_DATASET_UPDATER OT_DATASET_UPDATER "Enable Dataset updater") +kconfig_to_ot_option(CONFIG_OPENTHREAD_DEVICE_PROP_LEADER_WEIGHT OT_DEVICE_PROP_LEADER_WEIGHT "Enable device props for leader weight") +kconfig_to_ot_option(CONFIG_OPENTHREAD_DHCP6_CLIENT OT_DHCP6_CLIENT "Enable DHCPv6 Client") +kconfig_to_ot_option(CONFIG_OPENTHREAD_DHCP6_SERVER OT_DHCP6_SERVER "Enable DHCPv6 Server") +kconfig_to_ot_option(CONFIG_OPENTHREAD_DIAG OT_DIAGNOSTIC "Enable Diagnostics support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_CLIENT OT_DNS_CLIENT "Enable DNS client support") +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_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_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") +kconfig_to_ot_option(CONFIG_OPENTHREAD_FIREWALL OT_FIREWALL "Enable firewall") +kconfig_to_ot_option(CONFIG_OPENTHREAD_FULL_LOGS OT_FULL_LOGS "Enable full logs") +kconfig_to_ot_option(CONFIG_OPENTHREAD_HISTORY_TRACKER OT_HISTORY_TRACKER "Enable history tracker support.") +kconfig_to_ot_option(CONFIG_OPENTHREAD_IP6_FRAGM OT_IP6_FRAGM "Enable IPv6 fragmentation support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_JAM_DETECTION OT_JAM_DETECTION "Enable Jam Detection") +kconfig_to_ot_option(CONFIG_OPENTHREAD_JOINER OT_JOINER "Enable Joiner") +kconfig_to_ot_option(CONFIG_OPENTHREAD_LEGACY OT_LEGACY "Enable legacy network support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_INITIATOR OT_LINK_METRICS_INITIATOR "Enable Link Metrics initiator for Thread 1.2") +kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_MANAGER OT_LINK_METRICS_MANAGER "Enable Link Metrics manager for Thread 1.2") +kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_SUBJECT OT_LINK_METRICS_SUBJECT "Enable Link Metrics subject for Thread 1.2") +kconfig_to_ot_option(CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC OT_LOG_LEVEL_DYNAMIC "Enable dynamic log level control") +kconfig_to_ot_option(CONFIG_OPENTHREAD_MAC_FILTER OT_MAC_FILTER "Enable MAC filter support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_MESH_DIAG OT_MESH_DIAG "Enable Mesh Diagnostics") +kconfig_to_ot_option(CONFIG_OPENTHREAD_MESSAGE_USE_HEAP OT_MESSAGE_USE_HEAP "Enable heap allocator for message buffers") +kconfig_to_ot_option(CONFIG_OPENTHREAD_MLE_LONG_ROUTES OT_MLE_LONG_ROUTES "Enable MLE long routes support (Experimental)") +kconfig_to_ot_option(CONFIG_OPENTHREAD_MLR OT_MLR "Enable Multicast Listener Registration feature for Thread 1.2") +kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTIPAN_RCP OT_MULTIPAN_RCP "Enable Multi-PAN RCP") +kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTIPLE_INSTANCE OT_MULTIPLE_INSTANCE "Enable multiple instances") +kconfig_to_ot_option(CONFIG_OPENTHREAD_NAT64_BORDER_ROUTING OT_NAT64_BORDER_ROUTING "Enable border routing NAT64 support") +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_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") +kconfig_to_ot_option(CONFIG_OPENTHREAD_PING_SENDER OT_PING_SENDER "Enable ping sender support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_KEY_REF OT_PLATFORM_KEY_REF "Enable platform key reference support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_NETIF OT_PLATFORM_NETIF "Enable platform netif support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_UDP OT_PLATFORM_UDP "Enable platform UDP support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_RADIO_LINK_IEEE_802_15_4_ENABLE OT_15_4 "Enable 802.15.4 radio") +kconfig_to_ot_option(CONFIG_OPENTHREAD_RAW OT_LINK_RAW "Enable Link Raw") +kconfig_to_ot_option(CONFIG_OPENTHREAD_REFERENCE_DEVICE OT_REFERENCE_DEVICE "Enable Thread Certification Reference Device") +kconfig_to_ot_option(CONFIG_OPENTHREAD_SETTINGS_RAM OT_SETTINGS_RAM "Enable volatile-only storage of settings") +kconfig_to_ot_option(CONFIG_OPENTHREAD_SLAAC OT_SLAAC "Enable SLAAC") +kconfig_to_ot_option(CONFIG_OPENTHREAD_SNTP_CLIENT OT_SNTP_CLIENT "Enable SNTP Client support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_CLIENT OT_SRP_CLIENT "Enable SRP Client support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_SERVER OT_SRP_SERVER "Enable SRP Server support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_TCP_ENABLE OT_TCP "Enable TCP support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_TIME_SYNC OT_TIME_SYNC "Enable the time synchronization service feature") +kconfig_to_ot_option(CONFIG_OPENTHREAD_TREL OT_TREL "Enable TREL radio link for Thread over Infrastructure feature") +kconfig_to_ot_option(CONFIG_OPENTHREAD_TX_BEACON_PAYLOAD OT_TX_BEACON_PAYLOAD "Enable tx beacon payload support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_TX_QUEUE_STATISTICS OT_TX_QUEUE_STATS "Enable tx queue statistics") +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") -if(CONFIG_OPENTHREAD_CSL_RECEIVER_LOCAL_TIME_SYNC) - set(OT_CSL_RECEIVER_LOCAL_TIME_SYNC ON CACHE BOOL "Use local time for CSL sync" FORCE) -else() - set(OT_CSL_RECEIVER_LOCAL_TIME_SYNC OFF CACHE BOOL "Use local time for CSL sync" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DATASET_UPDATER) - set(OT_DATASET_UPDATER ON CACHE BOOL "Enable Dataset updater" FORCE) -else() - set(OT_DATASET_UPDATER OFF CACHE BOOL "Enable Dataset updater" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DEVICE_PROP_LEADER_WEIGHT) - set(OT_DEVICE_PROP_LEADER_WEIGHT ON CACHE BOOL "Enable device props for leader weight" FORCE) -else() - set(OT_DEVICE_PROP_LEADER_WEIGHT OFF CACHE BOOL "Enable device props for leader weight" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DHCP6_CLIENT) - set(OT_DHCP6_CLIENT ON CACHE BOOL "Enable DHCPv6 Client" FORCE) -else() - set(OT_DHCP6_CLIENT OFF CACHE BOOL "Enable DHCPv6 Client" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DHCP6_SERVER) - set(OT_DHCP6_SERVER ON CACHE BOOL "Enable DHCPv6 Server" FORCE) -else() - set(OT_DHCP6_SERVER OFF CACHE BOOL "Enable DHCPv6 Server" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DIAG) - set(OT_DIAGNOSTIC ON CACHE BOOL "Enable Diagnostics support" FORCE) -else() - set(OT_DIAGNOSTIC OFF CACHE BOOL "Enable Diagnostics support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DNS_CLIENT) - set(OT_DNS_CLIENT ON CACHE BOOL "Enable DNS client support" FORCE) -else() - set(OT_DNS_CLIENT OFF CACHE BOOL "Enable DNS client support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DNS_CLIENT_OVER_TCP) - set(OT_DNS_CLIENT_OVER_TCP ON CACHE BOOL "Enable dns query over tcp" FORCE) -else() - set(OT_DNS_CLIENT_OVER_TCP OFF CACHE BOOL "Enable dns query over tcp" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DNS_DSO) - set(OT_DNS_DSO ON CACHE BOOL "Enable DNS Stateful Operations (DSO) support" FORCE) -else() - set(OT_DNS_DSO OFF CACHE BOOL "Enable DNS Stateful Operations (DSO) support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DNS_UPSTREAM_QUERY) - set(OT_DNS_UPSTREAM_QUERY ON CACHE BOOL "Enable forwarding DNS queries to upstream" FORCE) -else() - set(OT_DNS_UPSTREAM_QUERY OFF CACHE BOOL "Enable forwarding DNS queries to upstream" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DNSSD_SERVER) - set(OT_DNSSD_SERVER ON CACHE BOOL "Enable DNS-SD server support" FORCE) -else() - set(OT_DNSSD_SERVER OFF CACHE BOOL "Enable DNS-SD server support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_DUA) - set(OT_DUA ON CACHE BOOL "Enable Domain Unicast Address feature for Thread 1.2" FORCE) -else() - set(OT_DUA OFF CACHE BOOL "Enable Domain Unicast Address feature for Thread 1.2" FORCE) -endif() - -if(CONFIG_OPENTHREAD_ECDSA) - set(OT_ECDSA ON CACHE BOOL "Enable ECDSA support" FORCE) -else() - set(OT_ECDSA OFF CACHE BOOL "Enable ECDSA support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_ENABLE_SERVICE) - set(OT_SERVICE ON CACHE BOOL "Enable Service entries in Thread Network Data" FORCE) -else() - set(OT_SERVICE OFF CACHE BOOL "Enable Service entries in Thread Network Data" FORCE) -endif() - -if(CONFIG_OPENTHREAD_EXTERNAL_HEAP) - set(OT_EXTERNAL_HEAP ON CACHE BOOL "Enable external heap support" FORCE) -else() - set(OT_EXTERNAL_HEAP OFF CACHE BOOL "Enable external heap support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_FIREWALL) - set(OT_FIREWALL ON CACHE BOOL "Enable firewall" FORCE) -else() - set(OT_FIREWALL OFF CACHE BOOL "Enable firewall" FORCE) -endif() - -if(CONFIG_OPENTHREAD_FULL_LOGS) - set(OT_FULL_LOGS ON CACHE BOOL "Enable full logs" FORCE) -else() - set(OT_FULL_LOGS OFF CACHE BOOL "Enable full logs" FORCE) -endif() - -if(CONFIG_OPENTHREAD_HISTORY_TRACKER) - set(OT_HISTORY_TRACKER ON CACHE BOOL "Enable history tracker support." FORCE) -else() - set(OT_HISTORY_TRACKER OFF CACHE BOOL "Enable history tracker support." FORCE) -endif() - -if(CONFIG_OPENTHREAD_IP6_FRAGM) - set(OT_IP6_FRAGM ON CACHE BOOL "Enable IPv6 fragmentation support" FORCE) -else() - set(OT_IP6_FRAGM OFF CACHE BOOL "Enable IPv6 fragmentation support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_JAM_DETECTION) - set(OT_JAM_DETECTION ON CACHE BOOL "Enable Jam Detection" FORCE) -else() - set(OT_JAM_DETECTION OFF CACHE BOOL "Enable Jam Detection" FORCE) -endif() - -if(CONFIG_OPENTHREAD_JOINER) - set(OT_JOINER ON CACHE BOOL "Enable Joiner" FORCE) -else() - set(OT_JOINER OFF CACHE BOOL "Enable Joiner" FORCE) -endif() - -if(CONFIG_OPENTHREAD_LEGACY) - set(OT_LEGACY ON CACHE BOOL "Enable legacy network support" FORCE) -else() - set(OT_LEGACY OFF CACHE BOOL "Enable legacy network support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_LINK_METRICS_INITIATOR) - set(OT_LINK_METRICS_INITIATOR ON CACHE BOOL "Enable Link Metrics initiator for Thread 1.2" FORCE) -else() - set(OT_LINK_METRICS_INITIATOR OFF CACHE BOOL "Enable Link Metrics initiator for Thread 1.2" FORCE) -endif() - -if(CONFIG_OPENTHREAD_LINK_METRICS_MANAGER) - set(OT_LINK_METRICS_MANAGER ON CACHE BOOL "Enable Link Metrics manager for Thread 1.2" FORCE) -else() - set(OT_LINK_METRICS_MANAGER OFF CACHE BOOL "Enable Link Metrics manager for Thread 1.2" FORCE) -endif() - -if(CONFIG_OPENTHREAD_LINK_METRICS_SUBJECT) - set(OT_LINK_METRICS_SUBJECT ON CACHE BOOL "Enable Link Metrics subject for Thread 1.2" FORCE) -else() - set(OT_LINK_METRICS_SUBJECT OFF CACHE BOOL "Enable Link Metrics subject for Thread 1.2" FORCE) -endif() - -if(CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC) - set(OT_LOG_LEVEL_DYNAMIC ON CACHE BOOL "Enable dynamic log level control" FORCE) -else() - set(OT_LOG_LEVEL_DYNAMIC OFF CACHE BOOL "Enable dynamic log level control" FORCE) -endif() - -if(CONFIG_OPENTHREAD_MAC_FILTER) - set(OT_MAC_FILTER ON CACHE BOOL "Enable MAC filter support" FORCE) -else() - set(OT_MAC_FILTER OFF CACHE BOOL "Enable MAC filter support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_MESH_DIAG) - set(OT_MESH_DIAG ON CACHE BOOL "Enable Mesh Diagnostics" FORCE) -else() - set(OT_MESH_DIAG OFF CACHE BOOL "Enable Mesh Diagnostics" FORCE) -endif() - -if(CONFIG_OPENTHREAD_MESSAGE_USE_HEAP) - set(OT_MESSAGE_USE_HEAP ON CACHE BOOL "Enable heap allocator for message buffers" FORCE) -else() - set(OT_MESSAGE_USE_HEAP OFF CACHE BOOL "Enable heap allocator for message buffers" FORCE) -endif() - -if(CONFIG_OPENTHREAD_MLE_LONG_ROUTES) - set(OT_MLE_LONG_ROUTES ON CACHE BOOL "Enable MLE long routes support (Experimental)" FORCE) -else() - set(OT_MLE_LONG_ROUTES OFF CACHE BOOL "Enable MLE long routes support (Experimental)" FORCE) -endif() - -if(CONFIG_OPENTHREAD_MLR) - set(OT_MLR ON CACHE BOOL "Enable Multicast Listener Registration feature for Thread 1.2" FORCE) -else() - set(OT_MLR OFF CACHE BOOL "Enable Multicast Listener Registration feature for Thread 1.2" FORCE) -endif() - -if(CONFIG_OPENTHREAD_MULTIPAN_RCP) - set(OT_MULTIPAN_RCP ON CACHE BOOL "Enable Multi-PAN RCP" FORCE) -else() - set(OT_MULTIPAN_RCP OFF CACHE BOOL "Enable Multi-PAN RCP" FORCE) -endif() - -if(CONFIG_OPENTHREAD_MULTIPLE_INSTANCE) - set(OT_MULTIPLE_INSTANCE ON CACHE BOOL "Enable multiple instances" FORCE) -else() - set(OT_MULTIPLE_INSTANCE OFF CACHE BOOL "Enable multiple instances" FORCE) -endif() - -if(CONFIG_OPENTHREAD_NAT64_BORDER_ROUTING) - set(OT_NAT64_BORDER_ROUTING ON CACHE BOOL "Enable border routing NAT64 support" FORCE) -else() - set(OT_NAT64_BORDER_ROUTING OFF CACHE BOOL "Enable border routing NAT64 support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_NAT64_TRANSLATOR) - set(OT_NAT64_TRANSLATOR ON CACHE BOOL "Enable NAT64 translator" FORCE) -else() - set(OT_NAT64_TRANSLATOR OFF CACHE BOOL "Enable NAT64 translator" FORCE) -endif() - -if(CONFIG_OPENTHREAD_NEIGHBOR_DISCOVERY_AGENT) - set(OT_NEIGHBOR_DISCOVERY_AGENT ON CACHE BOOL "Enable neighbor discovery agent support" FORCE) -else() - set(OT_NEIGHBOR_DISCOVERY_AGENT OFF CACHE BOOL "Enable neighbor discovery agent support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_NETDIAG_CLIENT) - set(OT_NETDIAG_CLIENT ON CACHE BOOL "Enable TMF network diagnostics on clients" FORCE) -else() - set(OT_NETDIAG_CLIENT OFF CACHE BOOL "Enable TMF network diagnostics on clients" FORCE) -endif() - -if(CONFIG_OPENTHREAD_NETDATA_PUBLISHER) - set(OT_NETDATA_PUBLISHER ON CACHE BOOL "Enable Thread Network Data publisher" FORCE) -else() - set(OT_NETDATA_PUBLISHER OFF CACHE BOOL "Enable Thread Network Data publisher" FORCE) -endif() - -if(CONFIG_OPENTHREAD_OPERATIONAL_DATASET_AUTO_INIT) - set(OT_OPERATIONAL_DATASET_AUTO_INIT ON CACHE BOOL "Enable operational dataset auto init" FORCE) -else() - set(OT_OPERATIONAL_DATASET_AUTO_INIT OFF CACHE BOOL "Enable operational dataset auto init" FORCE) -endif() - -if(CONFIG_OPENTHREAD_OTNS) - set(OT_OTNS ON CACHE BOOL "Enable OTNS support" FORCE) -else() - set(OT_OTNS OFF CACHE BOOL "Enable OTNS support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_PING_SENDER) - set(OT_PING_SENDER ON CACHE BOOL "Enable ping sender support" FORCE) -else() - set(OT_PING_SENDER OFF CACHE BOOL "Enable ping sender support" FORCE) -endif() - -if(OPENTHREAD_PLATFORM_KEY_REF) - set(OT_PLATFORM_KEY_REF ON CACHE BOOL "Enable platform key reference support" FORCE) -else() - set(OT_PLATFORM_KEY_REF OFF CACHE BOOL "Enable platform key reference support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_PLATFORM_NETIF) - set(OT_PLATFORM_NETIF ON CACHE BOOL "Enable platform netif support" FORCE) -else() - set(OT_PLATFORM_NETIF OFF CACHE BOOL "Enable platform netif support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_PLATFORM_UDP) - set(OT_PLATFORM_UDP ON CACHE BOOL "Enable platform UDP support" FORCE) -else() - set(OT_PLATFORM_UDP OFF CACHE BOOL "Enable platform UDP support" FORCE) +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) endif() if(CONFIG_OPENTHREAD_POWER_SUPPLY) set(OT_POWER_SUPPLY ${CONFIG_OPENTHREAD_POWER_SUPPLY} CACHE STRING "Power supply configuration" FORCE) endif() -if(CONFIG_OPENTHREAD_RADIO_LINK_IEEE_802_15_4_ENABLE) - set(OT_15_4 ON CACHE BOOL "Enable 802.15.4 radio" FORCE) -else() - set(OT_15_4 OFF CACHE BOOL "Enable 802.15.4 radio" FORCE) -endif() - -if(CONFIG_OPENTHREAD_RAW) - set(OT_LINK_RAW ON CACHE BOOL "Enable Link Raw" FORCE) -else() - set(OT_LINK_RAW OFF CACHE BOOL "Enable Link Raw" FORCE) -endif() - -if(CONFIG_OPENTHREAD_REFERENCE_DEVICE) - set(OT_REFERENCE_DEVICE ON CACHE BOOL "Enable Thread Certification Reference Device" FORCE) -else() - set(OT_REFERENCE_DEVICE OFF CACHE BOOL "Enable Thread Certification Reference Device" FORCE) -endif() - -if(CONFIG_OPENTHREAD_SETTINGS_RAM) - set(OT_SETTINGS_RAM ON CACHE BOOL "Enable volatile-only storage of settings" FORCE) -else() - set(OT_SETTINGS_RAM OFF CACHE BOOL "Enable volatile-only storage of settings" FORCE) -endif() - -if(CONFIG_OPENTHREAD_SLAAC) - set(OT_SLAAC ON CACHE BOOL "Enable SLAAC" FORCE) -else() - set(OT_SLAAC OFF CACHE BOOL "Enable SLAAC" FORCE) -endif() - -if(CONFIG_OPENTHREAD_SNTP_CLIENT) - set(OT_SNTP_CLIENT ON CACHE BOOL "Enable SNTP Client support" FORCE) -else() - set(OT_SNTP_CLIENT OFF CACHE BOOL "Enable SNTP Client support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_SRP_CLIENT) - set(OT_SRP_CLIENT ON CACHE BOOL "Enable SRP Client support" FORCE) -else() - set(OT_SRP_CLIENT OFF CACHE BOOL "Enable SRP Client support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_SRP_SERVER) - set(OT_SRP_SERVER ON CACHE BOOL "Enable SRP Server support" FORCE) -else() - set(OT_SRP_SERVER OFF CACHE BOOL "Enable SRP Server support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_TCP_ENABLE) - set(OT_TCP ON CACHE BOOL "Enable TCP support" FORCE) -else() - set(OT_TCP OFF CACHE BOOL "Enable TCP support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_TIME_SYNC) - set(OT_TIME_SYNC ON CACHE BOOL "Enable the time synchronization service feature" FORCE) -else() - set(OT_TIME_SYNC OFF CACHE BOOL "Enable the time synchronization service feature" FORCE) -endif() - -if(CONFIG_OPENTHREAD_TREL) - set(OT_TREL ON CACHE BOOL "Enable TREL radio link for Thread over Infrastructure feature" FORCE) -else() - set(OT_TREL OFF CACHE BOOL "Enable TREL radio link for Thread over Infrastructure feature" FORCE) -endif() - -if(CONFIG_OPENTHREAD_TX_BEACON_PAYLOAD) - set(OT_TX_BEACON_PAYLOAD ON CACHE BOOL "Enable tx beacon payload support" FORCE) -else() - set(OT_TX_BEACON_PAYLOAD OFF CACHE BOOL "Enable tx beacon payload support" FORCE) -endif() - -if(CONFIG_OPENTHREAD_TX_QUEUE_STATISTICS) - set(OT_TX_QUEUE_STATS ON CACHE BOOL "Enable tx queue statistics" FORCE) -else() - set(OT_TX_QUEUE_STATS OFF CACHE BOOL "Enable tx queue statistics" FORCE) -endif() - -if(CONFIG_OPENTHREAD_UDP_FORWARD) - set(OT_UDP_FORWARD ON CACHE BOOL "Enable UDP forward feature" FORCE) -else() - set(OT_UDP_FORWARD OFF CACHE BOOL "Enable UDP forward feature" FORCE) -endif() - -if(CONFIG_OPENTHREAD_UPTIME) - set(OT_UPTIME ON CACHE BOOL "Enable support for tracking OpenThread instance's uptime" FORCE) -else() - set(OT_UPTIME OFF CACHE BOOL "Enable support for tracking OpenThread instance's uptime" FORCE) -endif() - -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) -endif() - set(BUILD_TESTING OFF CACHE BOOL "Disable openthread cmake testing targets" FORCE) # Zephyr logging options From e6a4ae7c8bd1d6f28158a86f15dcce78c6ba528b Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Wed, 3 Jan 2024 11:24:45 +0100 Subject: [PATCH 0166/2300] [nrf fromtree] net: openthread: increase TCAT stack size Running TCAT with PSA crypto API causes stack overflow. Increased stack size. Signed-off-by: Maciej Baczmanski (cherry picked from commit 11613e08e71d52db0438e4d25780f40489793ce4) (cherry picked from commit 2fea89562a6981c749378721e65cd3ed19d6c30a) --- modules/openthread/Kconfig.thread | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index 66e039b7300..542992e7fa1 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -184,6 +184,7 @@ config OPENTHREAD_DEFAULT_TX_POWER config OPENTHREAD_BLE_TCAT_THREAD_STACK_SIZE int "Openthread default TCAT stack size" + default 5120 if OPENTHREAD_CRYPTO_PSA default 4200 help Openthread default TCAT stack size. From 9ee703521969a90c51a086fb4320c8fde064e65a Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Thu, 4 Jan 2024 10:27:34 +0100 Subject: [PATCH 0167/2300] [nrf fromtree] net: openthread: add missing cmake option Added `OT_PLATFORM_POWER_CALIBRATION` and set to always off as in Zephyr power calibration is handled by Radio Driver. Signed-off-by: Maciej Baczmanski (cherry picked from commit d0283f9b158ddb36e79ec490a1f7f0ddbe3fb04c) (cherry picked from commit 49502a0e47021b69efc7b2708ff68c8a2dc19423) --- modules/openthread/CMakeLists.txt | 1 + .../platform/openthread-core-zephyr-config.h | 11 ----------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 6691084eebd..c9ccf074649 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -15,6 +15,7 @@ endmacro() set(OT_BUILD_EXECUTABLES OFF CACHE BOOL "Disable OpenThread samples") set(OT_BUILTIN_MBEDTLS_MANAGEMENT OFF CACHE BOOL "Use Zephyr's mbedTLS heap") set(OT_PLATFORM "zephyr" CACHE STRING "Zephyr as a target platform") +set(OT_PLATFORM_POWER_CALIBRATION OFF CACHE BOOL "Use Zephyr's power calibration handled by Radio Driver") set(OT_THREAD_VERSION ${CONFIG_OPENTHREAD_THREAD_VERSION} CACHE STRING "User selected Thread stack version") set(OT_CLI_TRANSPORT "CONSOLE" CACHE STRING "Set CLI to use console interpreter") diff --git a/modules/openthread/platform/openthread-core-zephyr-config.h b/modules/openthread/platform/openthread-core-zephyr-config.h index 773cd170f2c..71a087ca0b5 100644 --- a/modules/openthread/platform/openthread-core-zephyr-config.h +++ b/modules/openthread/platform/openthread-core-zephyr-config.h @@ -438,17 +438,6 @@ #define OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE 0 #endif -/** - * @def OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE - * - * In Zephyr, power calibration is handled by Radio Driver, so it can't be handled on OT level. - * - */ -#ifndef OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE -#define OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE 0 -#endif - - /** * @def OPENTHREAD_CONFIG_RADIO_STATS * From b25e8302a2820a6932f515b70c9aef99ef195680 Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Wed, 10 Jan 2024 13:03:21 +0100 Subject: [PATCH 0168/2300] [nrf fromtree] net: openthread: implement `otPlatResetToBootloader` This commit implements `otPlatResetToBootloader` in two ways: - trigger reset to bootloader using boot mode retention API - trigger reset to bootloader by triggering GPIO pin (applicable for nRF52840 Dongle) Signed-off-by: Maciej Baczmanski (cherry picked from commit f32e68651133960f257f7505ac7fac7f46986252) (cherry picked from commit aa1125153bc9e3ead72dc65ae5f969d3d4281965) --- dts/bindings/options/openthread,config.yaml | 7 +++ modules/openthread/CMakeLists.txt | 1 + modules/openthread/Kconfig.features | 23 ++++++- modules/openthread/platform/misc.c | 66 +++++++++++++++++++++ 4 files changed, 95 insertions(+), 2 deletions(-) diff --git a/dts/bindings/options/openthread,config.yaml b/dts/bindings/options/openthread,config.yaml index 054107fab44..6366c289c80 100644 --- a/dts/bindings/options/openthread,config.yaml +++ b/dts/bindings/options/openthread,config.yaml @@ -10,6 +10,7 @@ description: | compatible = "openthread,config"; diag-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>, <&gpio1 0 GPIO_ACTIVE_LOW>; + bootloader-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; }; }; @@ -21,3 +22,9 @@ properties: description: | This enables access to diagnostic GPIO pins. Each field consists of GPIO pin's configuration: controller's phandle, pin number and configuration flags. + + bootloader-gpios: + type: phandle-array + description: | + This enables resetting to bootloader by triggering given GPIO pin. Property represents + chosen GPIO pin's configuration: controller's phandle, pin number and configuration flags. diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index c9ccf074649..5b64d3be2f5 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -99,6 +99,7 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDATA_PUBLISHER OT_NETDATA_PUBLISHER "E 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") kconfig_to_ot_option(CONFIG_OPENTHREAD_PING_SENDER OT_PING_SENDER "Enable ping sender support") +kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE OT_PLATFORM_BOOTLOADER_MODE "Enable platform bootloader mode support") kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_KEY_REF OT_PLATFORM_KEY_REF "Enable platform key reference support") kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_NETIF OT_PLATFORM_NETIF "Enable platform netif support") kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_UDP OT_PLATFORM_UDP "Enable platform UDP support") diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index 952a7853b43..ba3990a348d 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -17,7 +17,7 @@ config OPENTHREAD_THREAD_VERSION_1_3 bool "Version 1.3" config OPENTHREAD_THREAD_VERSION_1_3_1 bool "Version 1.3.1" -endchoice +endchoice # OPENTHREAD_STACK_VERSION config OPENTHREAD_THREAD_VERSION string @@ -255,6 +255,25 @@ config OPENTHREAD_PLATFORM_KEY_REF Enable usage of cryptographic key references instead of literal keys. This requires a crypto backend library that supports key references. +choice OPENTHREAD_PLATFORM_BOOTLOADER_MODE_CHOICE + prompt "Platform bootloader mode configuration" + optional + +config OPENTHREAD_PLATFORM_BOOTLOADER_MODE_RETENTION + bool "Bootloader mode support with boot mode retention API" + depends on RETENTION_BOOT_MODE && REBOOT + select OPENTHREAD_PLATFORM_BOOTLOADER_MODE + +config OPENTHREAD_PLATFORM_BOOTLOADER_MODE_GPIO + bool "Bootloader mode support with GPIO pin trigger" + select OPENTHREAD_PLATFORM_BOOTLOADER_MODE +endchoice # OPENTHREAD_PLATFORM_BOOTLOADER_MODE + +config OPENTHREAD_PLATFORM_BOOTLOADER_MODE + bool + help + Platform bootloader mode support + config OPENTHREAD_PLATFORM_NETIF bool "Platform netif support" @@ -276,7 +295,7 @@ config OPENTHREAD_POWER_SUPPLY_EXTERNAL_STABLE config OPENTHREAD_POWER_SUPPLY_EXTERNAL_UNSTABLE bool "OT_POWER_SUPPLY_EXTERNAL_UNSTABLE" -endchoice +endchoice # OPENTHREAD_POWER_SUPPLY_CHOICE config OPENTHREAD_POWER_SUPPLY string diff --git a/modules/openthread/platform/misc.c b/modules/openthread/platform/misc.c index 7f57dddb9e3..11fdc42ec34 100644 --- a/modules/openthread/platform/misc.c +++ b/modules/openthread/platform/misc.c @@ -9,6 +9,24 @@ #include #include +#if defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_RETENTION) + +#include + +#elif defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_GPIO) + +BUILD_ASSERT(DT_HAS_COMPAT_STATUS_OKAY(openthread_config), + "`openthread,config` compatible node not found"); +BUILD_ASSERT(DT_NODE_HAS_PROP(DT_COMPAT_GET_ANY_STATUS_OKAY(openthread_config), bootloader_gpios), + "`bootloader-gpios` property missing from `openthread,config` compatible node"); + +#include + +static const struct gpio_dt_spec bootloader_gpio = + GPIO_DT_SPEC_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(openthread_config), + bootloader_gpios); +#endif + #include "platform-zephyr.h" void otPlatReset(otInstance *aInstance) @@ -19,6 +37,54 @@ void otPlatReset(otInstance *aInstance) sys_reboot(SYS_REBOOT_WARM); } +#if defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE) +otError otPlatResetToBootloader(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + +#if defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_RETENTION) + if (bootmode_set(BOOT_MODE_TYPE_BOOTLOADER)) { + return OT_ERROR_NOT_CAPABLE; + } + sys_reboot(SYS_REBOOT_WARM); + +#elif defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_GPIO) + /* + * To enable resetting to bootloader by triggering gpio pin, + * select `CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_GPIO=y`, + * and in Devicetree create `openthread` node in `/options/` path with + * `compatible = "openthread,config"` property and `bootloader-gpios` property, + * which should represent GPIO pin's configuration, + * containing controller phandle, pin number and pin flags. e.g: + * + * options { + * openthread { + * compatible = "openthread,config"; + * bootloader-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + * }; + * }; + * + * Note: in below implementation, chosen GPIO pin is configured as output + * and initialized to active state (logical value ‘1’). + * Configuring pin flags in `bootloader-gpios` allows to choose + * if pin should be active in high or in low state. + */ + + if (!gpio_is_ready_dt(&bootloader_gpio)) { + return OT_ERROR_NOT_CAPABLE; + } + gpio_pin_configure_dt(&bootloader_gpio, GPIO_OUTPUT_ACTIVE); + +#endif + + /* + * Return OT_ERROR_NOT_CAPABLE if resetting has been unsuccessful (invalid configuration or + * triggering reset had no effect) + */ + return OT_ERROR_NOT_CAPABLE; +} +#endif /* defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE) */ + otPlatResetReason otPlatGetResetReason(otInstance *aInstance) { ARG_UNUSED(aInstance); From 214cde4f5248edc1a7d54c939019ca66b0c5cecd Mon Sep 17 00:00:00 2001 From: Przemyslaw Bida Date: Wed, 10 Jan 2024 15:34:16 +0100 Subject: [PATCH 0169/2300] [nrf fromtree] net: openthread: Add new key and algorithm in PSA. This commit adds new types of keys and algorithm to crypto_psa backend of openthread. Added options: - `OT_CRYPTO_KEY_TYPE_ECDSA` - `OT_CRYPTO_KEY_ALG_ECDSA` - `OT_CRYPTO_KEY_USAGE_VERIFY_HASH` Signed-off-by: Przemyslaw Bida (cherry picked from commit 0018204091d104bda853ef870aaff8a1bc0e201c) (cherry picked from commit 6ba80b70b43cce7e3a84fcfb9833ea51b2139450) --- modules/openthread/platform/crypto_psa.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/openthread/platform/crypto_psa.c b/modules/openthread/platform/crypto_psa.c index e5b234ce030..0dcf3803fde 100644 --- a/modules/openthread/platform/crypto_psa.c +++ b/modules/openthread/platform/crypto_psa.c @@ -41,6 +41,8 @@ static psa_key_type_t toPsaKeyType(otCryptoKeyType aType) return PSA_KEY_TYPE_AES; case OT_CRYPTO_KEY_TYPE_HMAC: return PSA_KEY_TYPE_HMAC; + case OT_CRYPTO_KEY_TYPE_ECDSA: + return PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1); default: return PSA_KEY_TYPE_NONE; } @@ -53,6 +55,8 @@ static psa_algorithm_t toPsaAlgorithm(otCryptoKeyAlgorithm aAlgorithm) return PSA_ALG_ECB_NO_PADDING; case OT_CRYPTO_KEY_ALG_HMAC_SHA_256: return PSA_ALG_HMAC(PSA_ALG_SHA_256); + case OT_CRYPTO_KEY_ALG_ECDSA: + return PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256); default: /* * There is currently no constant like PSA_ALG_NONE, but 0 is used @@ -82,6 +86,10 @@ static psa_key_usage_t toPsaKeyUsage(int aUsage) usage |= PSA_KEY_USAGE_SIGN_HASH; } + if (aUsage & OT_CRYPTO_KEY_USAGE_VERIFY_HASH) { + usage |= PSA_KEY_USAGE_VERIFY_HASH; + } + return usage; } @@ -89,9 +97,10 @@ static bool checkKeyUsage(int aUsage) { /* Check if only supported flags have been passed */ int supported_flags = OT_CRYPTO_KEY_USAGE_EXPORT | - OT_CRYPTO_KEY_USAGE_ENCRYPT | - OT_CRYPTO_KEY_USAGE_DECRYPT | - OT_CRYPTO_KEY_USAGE_SIGN_HASH; + OT_CRYPTO_KEY_USAGE_ENCRYPT | + OT_CRYPTO_KEY_USAGE_DECRYPT | + OT_CRYPTO_KEY_USAGE_SIGN_HASH | + OT_CRYPTO_KEY_USAGE_VERIFY_HASH; return (aUsage & ~supported_flags) == 0; } From e915aca2d03a78f08485f8dd5099b68a803639f5 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Thu, 11 Jan 2024 16:59:23 +0100 Subject: [PATCH 0170/2300] [nrf fromtree] net: openthread: Remove PSA crypto backend workarounds Remove two workarounds in OpenThread's PSA crypto backend that were required when Zephyr used pre-1.5 TF-M version: 1. psa_open_key() is no longer needed to reference a persistent key 2. psa_cipher_encrypt() can be used to simplify AES encryption Signed-off-by: Damian Krolik (cherry picked from commit 36b7a3e701fb36135f97b60d893640a99cd0b7d6) (cherry picked from commit f6a644d15377ea7b9c8b953eb60398a017c6402a) --- modules/openthread/platform/crypto_psa.c | 68 +++--------------------- 1 file changed, 7 insertions(+), 61 deletions(-) diff --git a/modules/openthread/platform/crypto_psa.c b/modules/openthread/platform/crypto_psa.c index 0dcf3803fde..55018254154 100644 --- a/modules/openthread/platform/crypto_psa.c +++ b/modules/openthread/platform/crypto_psa.c @@ -111,31 +111,6 @@ static bool checkContext(otCryptoContext *aContext, size_t aMinSize) return aContext != NULL && aContext->mContext != NULL && aContext->mContextSize >= aMinSize; } -static void ensureKeyIsLoaded(otCryptoKeyRef aKeyRef) -{ - /* - * The workaround below will no longer be need after updating TF-M version used in Zephyr - * to 1.5.0 (see upstream commit 42e77b561fcfe19819ff1e63cb7c0b672ee8ba41). - * In the recent versions of TF-M the concept of key handles and psa_open_key()/ - * psa_close_key() APIs have been being deprecated, but the version currently used in Zephyr - * is in the middle of that transition. Consequently, psa_destroy_key() and lots of other - * functions will fail when a key ID that they take as a parameter is not loaded from the - * persistent storage. That may occur when a given persistent key is created via - * psa_generate_key() or psa_import_key(), and then the device reboots. - * - * Use psa_open_key() when the key has not been loaded yet to work around the issue. - */ - psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; - psa_status_t status = psa_get_key_attributes(aKeyRef, &attributes); - psa_key_id_t key_handle; - - if (status == PSA_ERROR_INVALID_HANDLE) { - psa_open_key(aKeyRef, &key_handle); - } - - psa_reset_key_attributes(&attributes); -} - void otPlatCryptoInit(void) { psa_crypto_init(); @@ -195,15 +170,11 @@ otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, return OT_ERROR_INVALID_ARGS; } - ensureKeyIsLoaded(aKeyRef); - return psaToOtError(psa_export_key(aKeyRef, aBuffer, aBufferLen, aKeyLen)); } otError otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef) { - ensureKeyIsLoaded(aKeyRef); - return psaToOtError(psa_destroy_key(aKeyRef)); } @@ -212,7 +183,6 @@ bool otPlatCryptoHasKey(otCryptoKeyRef aKeyRef) psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; psa_status_t status; - ensureKeyIsLoaded(aKeyRef); status = psa_get_key_attributes(aKeyRef, &attributes); psa_reset_key_attributes(&attributes); @@ -255,7 +225,6 @@ otError otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey return OT_ERROR_INVALID_ARGS; } - ensureKeyIsLoaded(aKey->mKeyRef); operation = aContext->mContext; status = psa_mac_sign_setup(operation, aKey->mKeyRef, PSA_ALG_HMAC(PSA_ALG_SHA_256)); @@ -323,7 +292,6 @@ otError otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, { const size_t block_size = PSA_BLOCK_CIPHER_BLOCK_LENGTH(PSA_KEY_TYPE_AES); psa_status_t status = PSA_SUCCESS; - psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT; psa_key_id_t *key_ref; size_t cipher_length; @@ -331,37 +299,15 @@ otError otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, return OT_ERROR_INVALID_ARGS; } - /* - * The code below can be simplified after updating TF-M version used in Zephyr to 1.5.0 - * (see upstream commit: 045ec4abfc73152a0116684ba9127d0a97cc8d34), using - * psa_cipher_encrypt() function which will replace the setup-update-finish sequence below. - */ key_ref = aContext->mContext; - ensureKeyIsLoaded(*key_ref); - status = psa_cipher_encrypt_setup(&operation, *key_ref, PSA_ALG_ECB_NO_PADDING); - - if (status != PSA_SUCCESS) { - goto out; - } - - status = psa_cipher_update(&operation, - aInput, - block_size, - aOutput, - block_size, - &cipher_length); + status = psa_cipher_encrypt(*key_ref, + PSA_ALG_ECB_NO_PADDING, + aInput, + block_size, + aOutput, + block_size, + &cipher_length); - if (status != PSA_SUCCESS) { - goto out; - } - - status = psa_cipher_finish(&operation, - aOutput + cipher_length, - block_size - cipher_length, - &cipher_length); - -out: - psa_cipher_abort(&operation); return psaToOtError(status); } From 1f497d41cb62d5299a87edc9458dd5823c017b23 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Fri, 12 Jan 2024 09:58:52 +0100 Subject: [PATCH 0171/2300] [nrf fromtree] net: openthread: Print the actual assert location When OpenThread application is built with CONFIG_ASSERT and CONFIG_ASSERT_NO_MSG_INFO, OT_ASSERT() prints a location that points to the otPlatAssertFail() function instead of the code that actually failed an assertion. This is confusing and CONFIG_ASSERT_NO_MSG_INFO sometimes cannot be disabled because of flash size limitations. Make otPlatAssertFail() always print the actual assert location. Signed-off-by: Damian Krolik (cherry picked from commit 7b42e36c68f3ecc476bb35b3066d5c5d8a639953) (cherry picked from commit 5d7a30bb2fa0bc6130e0e054821a0daa7043a736) --- modules/openthread/platform/misc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/openthread/platform/misc.c b/modules/openthread/platform/misc.c index 11fdc42ec34..5f9043dfa27 100644 --- a/modules/openthread/platform/misc.c +++ b/modules/openthread/platform/misc.c @@ -99,5 +99,10 @@ void otPlatWakeHost(void) void otPlatAssertFail(const char *aFilename, int aLineNumber) { - __ASSERT(false, "OpenThread ASSERT @ %s:%d", aFilename, aLineNumber); + /* + * The code below is used instead of __ASSERT(false) to print the actual assert + * location instead of __FILE__:__LINE__, which would point to this function. + */ + __ASSERT_PRINT("OpenThread ASSERT @ %s:%d\n", aFilename, aLineNumber); + __ASSERT_POST_ACTION(); } From 5b6e5bfa8b728f12944b1dc5d14f3ee426f4f755 Mon Sep 17 00:00:00 2001 From: Andy Sinclair Date: Wed, 22 Nov 2023 16:34:02 +0000 Subject: [PATCH 0172/2300] [nrf fromtree] drivers: regulator: Fixed reference counting during enable Reference counting was broken when adding the enable delay. Now reverted to previous pattern. Signed-off-by: Andy Sinclair (cherry picked from commit c3a54ae1c34e939db83431bea354c0f4d0add0b3) (cherry picked from commit 908763768e6de644d8d08a34dc3834c32563ab15) --- drivers/regulator/regulator_common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/regulator_common.c b/drivers/regulator/regulator_common.c index 7f33040d2d9..14866a3738f 100644 --- a/drivers/regulator/regulator_common.c +++ b/drivers/regulator/regulator_common.c @@ -107,10 +107,13 @@ int regulator_enable(const struct device *dev) (void)k_mutex_lock(&data->lock, K_FOREVER); #endif - if (data->refcnt == 0) { + data->refcnt++; + + if (data->refcnt == 1) { ret = api->enable(dev); - if (ret == 0) { - data->refcnt++; + if (ret < 0) { + data->refcnt--; + } else { regulator_delay(config->off_on_delay_us); } } From 25efcd89ff31b4089d01959f55a2b8a36a00d07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Thu, 18 Jan 2024 11:34:34 +0100 Subject: [PATCH 0173/2300] [nrf fromlist] drivers: ieee802154: fix nRF5 Rx error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current implementation implicitly assumes that if the device is configured to have the capability of acting as a CSL endpoint then in case a delayed reception with matching ID finishes with a timeout no action is needed. This assumption is correct when RxOnWhenIdle mode is disabled because the transition to sleep is done automatically by the driver below. However, it's wrong when RxOnWhenIdle is enabled. This commit fixes that case by adding a call to event handler that notifies the higher layer about the event and allows it to transition to RxOff if needed. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/67774 Signed-off-by: Jędrzej Ciupis (cherry picked from commit 8ba9711786a4cd6eea313b900130633f8b36145b) --- drivers/ieee802154/ieee802154_nrf5.c | 10 +++++++++- drivers/ieee802154/ieee802154_nrf5.h | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index a116c20f118..741979a6810 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -749,6 +749,7 @@ static int nrf5_init(const struct device *dev) nrf5_get_capabilities_at_boot(); + nrf5_radio->rx_on_when_idle = true; nrf5_radio_cfg->irq_config_func(dev); k_thread_create(&nrf5_radio->rx_thread, nrf5_radio->rx_stack, @@ -976,6 +977,7 @@ static int nrf5_configure(const struct device *dev, case IEEE802154_CONFIG_RX_ON_WHEN_IDLE: nrf_802154_rx_on_when_idle_set(config->rx_on_when_idle); + nrf5_data.rx_on_when_idle = config->rx_on_when_idle; break; default: @@ -1056,7 +1058,13 @@ void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id) #if defined(CONFIG_IEEE802154_CSL_ENDPOINT) if (id == DRX_SLOT_RX && error == NRF_802154_RX_ERROR_DELAYED_TIMEOUT) { - return; + if (!nrf5_data.rx_on_when_idle) { + /* Transition to RxOff done automatically by the driver */ + return; + } else if (nrf5_data.event_handler) { + /* Notify the higher layer to allow it to transition if needed */ + nrf5_data.event_handler(dev, IEEE802154_EVENT_RX_OFF, NULL); + } } #else ARG_UNUSED(id); diff --git a/drivers/ieee802154/ieee802154_nrf5.h b/drivers/ieee802154/ieee802154_nrf5.h index 79b47827d72..b1c95548210 100644 --- a/drivers/ieee802154/ieee802154_nrf5.h +++ b/drivers/ieee802154/ieee802154_nrf5.h @@ -107,6 +107,9 @@ struct nrf5_802154_data { /* The last configured value of CSL phase time in nanoseconds. */ net_time_t csl_rx_time; #endif /* CONFIG_NRF_802154_SER_HOST && CONFIG_IEEE802154_CSL_ENDPOINT */ + + /* Indicates if RxOnWhenIdle mode is enabled. */ + bool rx_on_when_idle; }; #endif /* ZEPHYR_DRIVERS_IEEE802154_IEEE802154_NRF5_H_ */ From ccc32b6b705b08d947bd9309bde19696a3feb6e0 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Sat, 25 Nov 2023 16:07:24 +0200 Subject: [PATCH 0174/2300] [nrf fromtree] drivers: sensor: adxl367: Add missing breaks Fix missing breaks errors. Signed-off-by: Andrei Emeltchenko (cherry picked from commit db1c21bfd75f9915d2d829f3c38f70ff65ae07f8) (cherry picked from commit 51d4b69e9a0e82ba04b226c338aea438315d9913) --- drivers/sensor/adxl367/adxl367.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/sensor/adxl367/adxl367.c b/drivers/sensor/adxl367/adxl367.c index f63b8f73a32..1d5c31ad021 100644 --- a/drivers/sensor/adxl367/adxl367.c +++ b/drivers/sensor/adxl367/adxl367.c @@ -287,16 +287,22 @@ int adxl367_self_test(const struct device *dev) switch (cfg->odr) { case ADXL367_ODR_12P5HZ: st_delay_ms = 320; + break; case ADXL367_ODR_25HZ: st_delay_ms = 160; + break; case ADXL367_ODR_50HZ: st_delay_ms = 80; + break; case ADXL367_ODR_100HZ: st_delay_ms = 40; + break; case ADXL367_ODR_200HZ: st_delay_ms = 20; + break; case ADXL367_ODR_400HZ: st_delay_ms = 10; + break; default: return -EINVAL; } From 8f1213662aa85dc960b191349652da8dbdc040a3 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Mon, 4 Dec 2023 16:47:01 +0100 Subject: [PATCH 0175/2300] [nrf fromtree] soc: arm: nordic_nrf: nrf91: add nRF9151 LACA This patch adds definitions for the nRF9151, which is software-compatible with nRF9161. Signed-off-by: Maximilian Deubel (cherry picked from commit efa030b32c874ea6840d509b1a80002497239bc7) (cherry picked from commit bc1d19177ed3633941254563852a9c3d2cf82ff3) --- dts/arm/nordic/nrf9151_laca.dtsi | 23 +++++++++++++++++++ dts/arm/nordic/nrf9151ns_laca.dtsi | 23 +++++++++++++++++++ .../nrf91/Kconfig.defconfig.nrf9151_LACA | 14 +++++++++++ soc/arm/nordic_nrf/nrf91/Kconfig.soc | 4 ++++ 4 files changed, 64 insertions(+) create mode 100644 dts/arm/nordic/nrf9151_laca.dtsi create mode 100644 dts/arm/nordic/nrf9151ns_laca.dtsi create mode 100644 soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf9151_LACA diff --git a/dts/arm/nordic/nrf9151_laca.dtsi b/dts/arm/nordic/nrf9151_laca.dtsi new file mode 100644 index 00000000000..9ed20274017 --- /dev/null +++ b/dts/arm/nordic/nrf9151_laca.dtsi @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +&flash0 { + reg = <0x00000000 DT_SIZE_K(1024)>; +}; + +&sram0 { + reg = <0x20000000 DT_SIZE_K(256)>; +}; + +/ { + soc { + compatible = "nordic,nrf9151-laca", "nordic,nrf9120", + "nordic,nrf91", "simple-bus"; + }; +}; diff --git a/dts/arm/nordic/nrf9151ns_laca.dtsi b/dts/arm/nordic/nrf9151ns_laca.dtsi new file mode 100644 index 00000000000..ac31c6e19c6 --- /dev/null +++ b/dts/arm/nordic/nrf9151ns_laca.dtsi @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +&flash0 { + reg = <0x00000000 DT_SIZE_K(1024)>; +}; + +&sram0 { + reg = <0x20000000 DT_SIZE_K(256)>; +}; + +/ { + soc { + compatible = "nordic,nrf9151-laca", "nordic,nrf9120", + "nordic,nrf91", "simple-bus"; + }; +}; diff --git a/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf9151_LACA b/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf9151_LACA new file mode 100644 index 00000000000..1b3ea88e359 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf9151_LACA @@ -0,0 +1,14 @@ +# Nordic Semiconductor nRF9151 MCU + +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF9151_LACA + +config SOC + default "nRF9151_LACA" + +config NUM_IRQS + default 65 + +endif # SOC_NRF9151_LACA diff --git a/soc/arm/nordic_nrf/nrf91/Kconfig.soc b/soc/arm/nordic_nrf/nrf91/Kconfig.soc index c9b8c54438b..0267ada4850 100644 --- a/soc/arm/nordic_nrf/nrf91/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf91/Kconfig.soc @@ -34,6 +34,10 @@ config SOC_NRF9131_LACA bool "NRF9131_LACA" select SOC_NRF9120 +config SOC_NRF9151_LACA + bool "NRF9151_LACA" + select SOC_NRF9120 + endchoice config NRF_ENABLE_ICACHE From 6a26f6b51450f09eab0e02c33fb8a40705d470b8 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Mon, 4 Dec 2023 16:57:34 +0100 Subject: [PATCH 0176/2300] [nrf fromtree] boards: arm: add nrf9151dk_nrf9151 This patch adds the nRF9151-DK board. Signed-off-by: Maximilian Deubel (cherry picked from commit ecf6287b8ce9508f04a7591367869719b99d23ca) (cherry picked from commit 79858b97c0996a8c67fdc70ffcc745b19111f9de) --- boards/arm/nrf9151dk_nrf9151/Kconfig.board | 14 + .../arm/nrf9151dk_nrf9151/Kconfig.defconfig | 47 +++ boards/arm/nrf9151dk_nrf9151/board.cmake | 14 + boards/arm/nrf9151dk_nrf9151/doc/index.rst | 203 +++++++++++++ .../nordic,nrf9151dk-nrf5340-reset.yaml | 18 ++ .../dts/nrf9151dk_buttons_on_io_expander.dtsi | 25 ++ .../dts/nrf9151dk_leds_on_io_expander.dtsi | 25 ++ .../nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts | 19 ++ .../nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml | 22 ++ .../nrf9151dk_nrf9151_common-pinctrl.dtsi | 96 +++++++ .../nrf9151dk_nrf9151_common.dtsi | 268 ++++++++++++++++++ .../nrf9151dk_nrf9151_defconfig | 24 ++ .../nrf9151dk_nrf9151_ns.dts | 22 ++ .../nrf9151dk_nrf9151_ns.yaml | 20 ++ .../nrf9151dk_nrf9151_ns_defconfig | 27 ++ .../nrf9151dk_nrf9151_partition_conf.dtsi | 60 ++++ .../arm/nrf9151dk_nrf9151/pre_dt_board.cmake | 7 + 17 files changed, 911 insertions(+) create mode 100644 boards/arm/nrf9151dk_nrf9151/Kconfig.board create mode 100644 boards/arm/nrf9151dk_nrf9151/Kconfig.defconfig create mode 100644 boards/arm/nrf9151dk_nrf9151/board.cmake create mode 100644 boards/arm/nrf9151dk_nrf9151/doc/index.rst create mode 100644 boards/arm/nrf9151dk_nrf9151/dts/bindings/nordic,nrf9151dk-nrf5340-reset.yaml create mode 100644 boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_buttons_on_io_expander.dtsi create mode 100644 boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_leds_on_io_expander.dtsi create mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts create mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml create mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common-pinctrl.dtsi create mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi create mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_defconfig create mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.dts create mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.yaml create mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns_defconfig create mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_partition_conf.dtsi create mode 100644 boards/arm/nrf9151dk_nrf9151/pre_dt_board.cmake diff --git a/boards/arm/nrf9151dk_nrf9151/Kconfig.board b/boards/arm/nrf9151dk_nrf9151/Kconfig.board new file mode 100644 index 00000000000..92352ddc16f --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/Kconfig.board @@ -0,0 +1,14 @@ +# nRF9151 DK NRF9151 board configuration + +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF9151_LACA + +config BOARD_NRF9151DK_NRF9151 + bool "nRF9151 DK NRF9151" + +config BOARD_NRF9151DK_NRF9151_NS + bool "nRF9151 DK NRF9151 non-secure" + +endif # SOC_NRF9151_LACA diff --git a/boards/arm/nrf9151dk_nrf9151/Kconfig.defconfig b/boards/arm/nrf9151dk_nrf9151/Kconfig.defconfig new file mode 100644 index 00000000000..3cbff101d63 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/Kconfig.defconfig @@ -0,0 +1,47 @@ +# nRF9151 DK NRF9151 board configuration + +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF9151DK_NRF9151 || BOARD_NRF9151DK_NRF9151_NS + +config BOARD + default "nrf9151dk_nrf9151" + +# 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. + +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + depends on BOARD_NRF9151DK_NRF9151 && TRUSTED_EXECUTION_SECURE + +if BOARD_NRF9151DK_NRF9151_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 # BOARD_NRF9151DK_NRF9151_NS + +config BT_HCI_VS + default y if BT + +config BT_WAIT_NOP + default BT && $(dt_nodelabel_enabled,nrf5340_reset) + +config I2C + default $(dt_compat_on_bus,$(DT_COMPAT_NXP_PCAL6408A),i2c) + +endif # BOARD_NRF9151DK_NRF9151 || BOARD_NRF9151DK_NRF9151_NS diff --git a/boards/arm/nrf9151dk_nrf9151/board.cmake b/boards/arm/nrf9151dk_nrf9151/board.cmake new file mode 100644 index 00000000000..a3126c941d9 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/board.cmake @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_BOARD_NRF9151DK_NRF9151_NS) + set(TFM_PUBLIC_KEY_FORMAT "full") +endif() + +if(CONFIG_TFM_FLASH_MERGED_BINARY) + set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex) +endif() + +# TODO: change to nRF9151_xxAA when such device is available in JLink +board_runner_args(jlink "--device=nRF9160_xxAA" "--speed=4000") +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/arm/nrf9151dk_nrf9151/doc/index.rst b/boards/arm/nrf9151dk_nrf9151/doc/index.rst new file mode 100644 index 00000000000..4c02e7ed372 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/doc/index.rst @@ -0,0 +1,203 @@ +.. _nrf9151dk_nrf9151: + +nRF9151 DK +########## + +Overview +******** + +The nRF9151 DK (PCA10171) is a single-board development kit for evaluation and +development on the nRF9151 SiP for DECT NR+ and LTE-M/NB-IoT with GNSS. The nrf9151dk_nrf9151 +board configuration provides support for the Nordic Semiconductor nRF9151 ARM +Cortex-M33F CPU with ARMv8-M Security Extension and the following devices: + +* :abbr:`ADC (Analog to Digital Converter)` +* CLOCK +* FLASH +* :abbr:`GPIO (General Purpose Input Output)` +* :abbr:`I2C (Inter-Integrated Circuit)` +* :abbr:`MPU (Memory Protection Unit)` +* :abbr:`NVIC (Nested Vectored Interrupt Controller)` +* :abbr:`PWM (Pulse Width Modulation)` +* :abbr:`RTC (nRF RTC System Clock)` +* Segger RTT (RTT Console) +* :abbr:`SPI (Serial Peripheral Interface)` +* :abbr:`UARTE (Universal asynchronous receiver-transmitter with EasyDMA)` +* :abbr:`WDT (Watchdog Timer)` +* :abbr:`IDAU (Implementation Defined Attribution Unit)` + +More information about the board can be found at the +`nRF9151 DK website`_. The `Nordic Semiconductor Infocenter`_ +contains the processor's information and the datasheet. + + +Hardware +******** + +nRF9151 DK has two external oscillators. The frequency of +the slow clock is 32.768 kHz. The frequency of the main clock +is 32 MHz. + +Supported Features +================== + +The nrf9151dk_nrf9151 board configuration supports the following +hardware features: + ++-----------+------------+----------------------+ +| Interface | Controller | Driver/Component | ++===========+============+======================+ +| ADC | on-chip | adc | ++-----------+------------+----------------------+ +| CLOCK | on-chip | clock_control | ++-----------+------------+----------------------+ +| FLASH | on-chip | flash | ++-----------+------------+----------------------+ +| FLASH | external | spi | ++-----------+------------+----------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+----------------------+ +| GPIO | external | i2c | ++-----------+------------+----------------------+ +| I2C(M) | on-chip | i2c | ++-----------+------------+----------------------+ +| MPU | on-chip | arch/arm | ++-----------+------------+----------------------+ +| NVIC | on-chip | arch/arm | ++-----------+------------+----------------------+ +| PWM | on-chip | pwm | ++-----------+------------+----------------------+ +| RTC | on-chip | system clock | ++-----------+------------+----------------------+ +| RTT | nRF53 | console | ++-----------+------------+----------------------+ +| SPI(M/S) | on-chip | spi | ++-----------+------------+----------------------+ +| SPU | on-chip | system protection | ++-----------+------------+----------------------+ +| UARTE | on-chip | serial | ++-----------+------------+----------------------+ +| WDT | on-chip | watchdog | ++-----------+------------+----------------------+ + + +.. _nrf9151dk_additional_hardware: + +Other hardware features have not been enabled yet for this board. +See `nRF9151 DK website`_ and `Nordic Semiconductor Infocenter`_ +for a complete list of nRF9151 DK board hardware features. + +Connections and IOs +=================== + +LED +--- + +* LED1 (green) = P0.0 +* LED2 (green) = P0.1 +* LED3 (green) = P0.4 +* LED4 (green) = P0.5 + +Push buttons and Switches +------------------------- + +* BUTTON1 = P0.8 +* BUTTON2 = P0.9 +* SWITCH1 = P0.18 +* SWITCH2 = P0.19 +* BOOT = SW5 = boot/reset + +Security components +=================== + +- Implementation Defined Attribution Unit (`IDAU`_). The IDAU is implemented + with the System Protection Unit and is used to define secure and non-secure + memory maps. By default, all of the memory space (Flash, SRAM, and + peripheral address space) is defined to be secure accessible only. +- Secure boot. + + +Programming and Debugging +************************* + +nrf9151dk_nrf9151 supports the Armv8m Security Extension, and by default boots +in the Secure state. + +Building Secure/Non-Secure Zephyr applications with Arm |reg| TrustZone |reg| +============================================================================= + +The process requires the following steps: + +1. Build the Secure Zephyr application using ``-DBOARD=nrf9151dk_nrf9151`` and + ``CONFIG_TRUSTED_EXECUTION_SECURE=y`` in the application project configuration file. +2. Build the Non-Secure Zephyr application using ``-DBOARD=nrf9151dk_nrf9151_ns``. +3. Merge the two binaries together. + +When building a Secure/Non-Secure application, the Secure application will +have to set the IDAU (SPU) configuration to allow Non-Secure access to all +CPU resources utilized by the Non-Secure application firmware. SPU +configuration shall take place before jumping to the Non-Secure application. + +Building a Secure only application +================================== + +Build the Zephyr app in the usual way (see :ref:`build_an_application` +and :ref:`application_run`), using ``-DBOARD=nrf9151dk_nrf9151``. + +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). + +Here is an example for the :ref:`hello_world` application. + +First, run your favorite terminal program to listen for output. + +.. code-block:: console + + $ minicom -D -b 115200 + +Replace :code:`` with the port where the nRF9151 DK +can be found. For example, under Linux, :code:`/dev/ttyACM0`. + +Then build and flash the application in the usual way. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: nrf9151dk_nrf9151 + :goals: build flash + +Debugging +========= + +Refer to the :ref:`nordic_segger` page to learn about debugging Nordic boards with a +Segger IC. + + +Testing the LEDs and buttons in the nRF9151 DK +********************************************** + +There are 2 samples that allow you to test that the buttons (switches) and LEDs on +the board are working properly with Zephyr: + +* :zephyr:code-sample:`blinky` +* :zephyr:code-sample:`button` + +You can build and flash the examples to make sure Zephyr is running correctly on +your board. The button and LED definitions can be found in +:zephyr_file:`boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi`. + +References +********** + +.. target-notes:: + +.. _IDAU: + https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau +.. _nRF9151 DK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9151-DK +.. _Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com +.. _Trusted Firmware M: https://www.trustedfirmware.org/projects/tf-m/ diff --git a/boards/arm/nrf9151dk_nrf9151/dts/bindings/nordic,nrf9151dk-nrf5340-reset.yaml b/boards/arm/nrf9151dk_nrf9151/dts/bindings/nordic,nrf9151dk-nrf5340-reset.yaml new file mode 100644 index 00000000000..2b51125312c --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/dts/bindings/nordic,nrf9151dk-nrf5340-reset.yaml @@ -0,0 +1,18 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: GPIO used to reset nRF5340 on nRF9151 DK + +compatible: "nordic,nrf9151dk-nrf5340-reset" + +include: base.yaml + +properties: + status: + required: true + + gpios: + type: phandle-array + required: true + description: | + GPIO to use as nRF5340 reset line: output in nRF9151, input in nRF5340. diff --git a/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_buttons_on_io_expander.dtsi b/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_buttons_on_io_expander.dtsi new file mode 100644 index 00000000000..20f7d2406a5 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_buttons_on_io_expander.dtsi @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pcal6408a { + status = "okay"; +}; + +&button0 { + gpios = <&pcal6408a 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; +}; + +&button1 { + gpios = <&pcal6408a 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; +}; + +&button2 { + gpios = <&pcal6408a 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; +}; + +&button3 { + gpios = <&pcal6408a 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; +}; diff --git a/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_leds_on_io_expander.dtsi b/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_leds_on_io_expander.dtsi new file mode 100644 index 00000000000..d80c509d215 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_leds_on_io_expander.dtsi @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pcal6408a { + status = "okay"; +}; + +&led0 { + gpios = <&pcal6408a 4 GPIO_ACTIVE_HIGH>; +}; + +&led1 { + gpios = <&pcal6408a 5 GPIO_ACTIVE_HIGH>; +}; + +&led2 { + gpios = <&pcal6408a 6 GPIO_ACTIVE_HIGH>; +}; + +&led3 { + gpios = <&pcal6408a 7 GPIO_ACTIVE_HIGH>; +}; diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts new file mode 100644 index 00000000000..8c3b4921434 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf9151dk_nrf9151_common.dtsi" + +/ { + chosen { + zephyr,sram = &sram0_s; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,sram-secure-partition = &sram0_s; + zephyr,sram-non-secure-partition = &sram0_ns; + }; +}; diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml new file mode 100644 index 00000000000..3ad90fea76d --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml @@ -0,0 +1,22 @@ +identifier: nrf9151dk_nrf9151 +name: nRF9151-DK-NRF9151 +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 88 +flash: 1024 +supported: + - arduino_gpio + - arduino_i2c + - arduino_serial + - arduino_spi + - gpio + - i2c + - pwm + - spi + - watchdog + - counter +vendor: nordic diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common-pinctrl.dtsi b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common-pinctrl.dtsi new file mode 100644 index 00000000000..a1680e830f4 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common-pinctrl.dtsi @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart0_default: uart0_default { + group1 { + psels = , + ; + }; + group2 { + psels = , + ; + bias-pull-up; + }; + }; + + uart0_sleep: uart0_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + + uart1_default: uart1_default { + group1 { + psels = , + ; + }; + group2 { + psels = , + ; + bias-pull-up; + }; + }; + + uart1_sleep: uart1_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + + i2c2_default: i2c2_default { + group1 { + psels = , + ; + }; + }; + + i2c2_sleep: i2c2_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + pwm0_default: pwm0_default { + group1 { + psels = ; + }; + }; + + pwm0_sleep: pwm0_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; + + spi3_default: spi3_default { + group1 { + psels = , + , + ; + nordic,drive-mode = ; + }; + }; + + spi3_sleep: spi3_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi new file mode 100644 index 00000000000..958e864c63c --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi @@ -0,0 +1,268 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nrf9151dk_nrf9151_common-pinctrl.dtsi" +#include + +/ { + model = "Nordic nRF9151 DK NRF9151"; + compatible = "nordic,nrf9151-dk-nrf9151"; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,uart-mcumgr = &uart0; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + led1: led_1 { + gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + led2: led_2 { + gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + led3: led_3 { + gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; + label = "Green LED 4"; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; + + buttons { + compatible = "gpio-keys"; + button0: button_0 { + gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 1"; + zephyr,code = ; + }; + button1: button_1 { + gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 2"; + zephyr,code = ; + }; + button2: button_2 { + gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 3"; + zephyr,code = ; + }; + button3: button_3 { + gpios = <&gpio0 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 4"; + zephyr,code = ; + }; + }; + + nrf5340_reset: gpio-reset { + compatible = "nordic,nrf9151dk-nrf5340-reset"; + status = "disabled"; + gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + }; + + arduino_header: connector { + compatible = "arduino-header-r3"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &gpio0 14 0>, /* A0 */ + <1 0 &gpio0 15 0>, /* A1 */ + <2 0 &gpio0 16 0>, /* A2 */ + <3 0 &gpio0 17 0>, /* A3 */ + <4 0 &gpio0 18 0>, /* A4 */ + <5 0 &gpio0 19 0>, /* A5 */ + <6 0 &gpio0 0 0>, /* D0 */ + <7 0 &gpio0 1 0>, /* D1 */ + <8 0 &gpio0 2 0>, /* D2 */ + <9 0 &gpio0 3 0>, /* D3 */ + <10 0 &gpio0 4 0>, /* D4 */ + <11 0 &gpio0 5 0>, /* D5 */ + <12 0 &gpio0 6 0>, /* D6 */ + <13 0 &gpio0 7 0>, /* D7 */ + <14 0 &gpio0 8 0>, /* D8 */ + <15 0 &gpio0 9 0>, /* D9 */ + <16 0 &gpio0 10 0>, /* D10 */ + <17 0 &gpio0 11 0>, /* D11 */ + <18 0 &gpio0 12 0>, /* D12 */ + <19 0 &gpio0 13 0>, /* D13 */ + <20 0 &gpio0 30 0>, /* D14 */ + <21 0 &gpio0 31 0>; /* D15 */ + }; + + arduino_adc: analog-connector { + compatible = "arduino,uno-adc"; + #io-channel-cells = <1>; + io-channel-map = <0 &adc 1>, /* A0 = P0.14 = AIN1 */ + <1 &adc 2>, /* A1 = P0.15 = AIN2 */ + <2 &adc 3>, /* A2 = P0.16 = AIN3 */ + <3 &adc 4>, /* A3 = P0.17 = AIN4 */ + <4 &adc 5>, /* A4 = P0.18 = AIN5 */ + <5 &adc 6>; /* A5 = P0.19 = AIN6 */ + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + pwm-led0 = &pwm_led0; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + bootloader-led0 = &led0; + mcuboot-button0 = &button0; + mcuboot-led0 = &led0; + watchdog0 = &wdt0; + spi-flash0 = &gd25wb256; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-1 = <&uart0_sleep>; + pinctrl-names = "default", "sleep"; +}; + +arduino_serial: &uart1 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart1_default>; + pinctrl-1 = <&uart1_sleep>; + pinctrl-names = "default", "sleep"; +}; + +arduino_i2c: &i2c2 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c2_default>; + pinctrl-1 = <&i2c2_sleep>; + pinctrl-names = "default", "sleep"; + clock-frequency = ; + + pcal6408a: pcal6408a@21 { + compatible = "nxp,pcal6408a"; + status = "disabled"; + reg = <0x21>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <8>; + int-gpios = <&gpio0 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + }; +}; + +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_default>; + pinctrl-1 = <&pwm0_sleep>; + pinctrl-names = "default", "sleep"; +}; + +arduino_spi: &spi3 { + compatible = "nordic,nrf-spim"; + status = "okay"; + cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>, /* D10 */ + <&gpio0 20 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&spi3_default>; + pinctrl-1 = <&spi3_sleep>; + pinctrl-names = "default", "sleep"; + + gd25wb256: gd25wb256e3ir@1 { + compatible = "jedec,spi-nor"; + status = "disabled"; + reg = <1>; + spi-max-frequency = <8000000>; + size = <268435456>; + has-dpd; + t-enter-dpd = <3000>; + t-exit-dpd = <40000>; + sfdp-bfp = [ + e5 20 f3 ff ff ff ff 0f 44 eb 08 6b 08 3b 42 bb + ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 + 10 d8 00 ff 44 7a c9 fe 83 67 26 62 ec 82 18 44 + 7a 75 7a 75 04 c4 d5 5c 00 06 74 00 08 50 00 01 + ]; + jedec-id = [c8 65 19]; + }; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x10000>; + }; + slot0_partition: partition@10000 { + label = "image-0"; + }; + slot0_ns_partition: partition@50000 { + label = "image-0-nonsecure"; + }; + slot1_partition: partition@85000 { + label = "image-1"; + }; + slot1_ns_partition: partition@c5000 { + label = "image-1-nonsecure"; + }; + storage_partition: partition@fa000 { + label = "storage"; + reg = <0x000fa000 0x00006000>; + }; + }; +}; + +/ { + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + sram0_s: image_s@20000000 { + /* Secure image memory */ + }; + + sram0_modem: image_modem@20016000 { + /* Modem (shared) memory */ + }; + + sram0_ns: image_ns@20020000 { + /* Non-Secure image memory */ + }; + }; +}; + +/* Include partition configuration file */ +#include "nrf9151dk_nrf9151_partition_conf.dtsi" diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_defconfig b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_defconfig new file mode 100644 index 00000000000..7afe5ac7aa9 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_defconfig @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF91X=y +CONFIG_SOC_NRF9151_LACA=y +CONFIG_BOARD_NRF9151DK_NRF9151=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# enable GPIO +CONFIG_GPIO=y + +# Enable uart driver +CONFIG_SERIAL=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.dts b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.dts new file mode 100644 index 00000000000..a41c4aad388 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.dts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf9151dk_nrf9151_common.dtsi" + +/ { + chosen { + zephyr,flash = &flash0; + zephyr,sram = &sram0_ns; + zephyr,code-partition = &slot0_ns_partition; + }; +}; + +/* Disable UART1, because it is used by default in TF-M */ +&uart1 { + status = "disabled"; +}; diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.yaml b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.yaml new file mode 100644 index 00000000000..c5d4fe92541 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.yaml @@ -0,0 +1,20 @@ +identifier: nrf9151dk_nrf9151_ns +name: nRF9151-DK-NRF9151-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 128 +flash: 192 +supported: + - arduino_gpio + - arduino_i2c + - arduino_serial + - arduino_spi + - i2c + - pwm + - watchdog + - netif:modem +vendor: nordic diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns_defconfig b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns_defconfig new file mode 100644 index 00000000000..949ef39f856 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns_defconfig @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF91X=y +CONFIG_SOC_NRF9151_LACA=y +CONFIG_BOARD_NRF9151DK_NRF9151_NS=y + +# 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 uart driver +CONFIG_SERIAL=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_partition_conf.dtsi b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_partition_conf.dtsi new file mode 100644 index 00000000000..b209608a725 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_partition_conf.dtsi @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Default Flash planning for nRF9151dk_nrf9151. + * + * Zephyr build for nRF9151 with ARM TrustZone-M support, + * implies building Secure and Non-Secure Zephyr images. + * + * Secure image will be placed, by default, in flash0 + * (or in slot0, if MCUboot is present). + * Secure image will use sram0 for system memory. + * + * Non-Secure image will be placed in slot0_ns, and use + * sram0_ns for system memory. + * + * Note that the Secure image only requires knowledge of + * the beginning of the Non-Secure image (not its size). + */ + +&slot0_partition { + reg = <0x00010000 0x40000>; +}; + +&slot0_ns_partition { + reg = <0x00050000 0x35000>; +}; + +&slot1_partition { + reg = <0x00085000 0x40000>; +}; + +&slot1_ns_partition { + reg = <0x000c5000 0x35000>; +}; + +/* Default SRAM planning when building for nRF9151 with + * ARM TrustZone-M support + * - Lowest 88 kB SRAM allocated to Secure image (sram0_s). + * - 40 kB SRAM reserved for and used by the modem library + * (sram0_modem). This memory is Non-Secure. + * - Upper 128 kB allocated to Non-Secure image (sram0_ns). + * When building with TF-M, both sram0_modem and sram0_ns + * are allocated to the Non-Secure image. + */ + +&sram0_s { + reg = <0x20000000 DT_SIZE_K(88)>; +}; + +&sram0_modem { + reg = <0x20016000 DT_SIZE_K(40)>; +}; + +&sram0_ns { + reg = <0x20020000 DT_SIZE_K(128)>; +}; diff --git a/boards/arm/nrf9151dk_nrf9151/pre_dt_board.cmake b/boards/arm/nrf9151dk_nrf9151/pre_dt_board.cmake new file mode 100644 index 00000000000..c8267afd1b4 --- /dev/null +++ b/boards/arm/nrf9151dk_nrf9151/pre_dt_board.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2021 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +# Suppress "unique_unit_address_if_enabled" to handle the following overlaps: +# - flash-controller@39000 & kmu@39000 +# - power@5000 & clock@5000 +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") From fd31aa1338a58288873062b548a61fbc93931ecf Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 9 Jan 2024 12:13:38 +0530 Subject: [PATCH 0177/2300] [nrf fromtree] net: wifi_utils: Fix max channels allow for scan Fix the maximum channels allow for scan command input. Signed-off-by: Kapil Bhatt (cherry picked from commit 3e8dbaf75fd0c239e00e33eb5970843341dad0f0) (cherry picked from commit 0b0b17ec9b28d37fa303ae49564a68420b902414) --- subsys/net/l2/wifi/wifi_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_utils.c b/subsys/net/l2/wifi/wifi_utils.c index 76e93fc33e0..bd47205e4f9 100644 --- a/subsys/net/l2/wifi/wifi_utils.c +++ b/subsys/net/l2/wifi/wifi_utils.c @@ -368,7 +368,7 @@ int wifi_utils_parse_scan_chan(char *scan_chan_str, memset(chan_str, 0, sizeof(chan_str)); if (chan_start) { - if ((chan_idx + (chan_val - chan_start)) >= max_channels) { + if ((chan_idx + (chan_val - chan_start)) > max_channels) { NET_ERR("Too many channels specified (%d)", max_channels); return -EINVAL; } From 3ac1de52fbe95ccbbad8fe8c6568a05d649e5d9f Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 9 Jan 2024 12:34:26 +0530 Subject: [PATCH 0178/2300] [nrf fromtree] net: wifi_shell: Update scan argument shell Update the example of scan -c argument. Default value for max channels is set to 3, So, update the example according to that. Add closing bracket in -s. Signed-off-by: Kapil Bhatt (cherry picked from commit 773ebe9c41903ce458eb2609c3c5668ef3976466) (cherry picked from commit 8505a727386cf57765845ca3110ef21bcdc6d91d) --- subsys/net/l2/wifi/wifi_shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index f470e700f8c..d3f573a28d6 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1903,9 +1903,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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" + "[-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-11,14_5:36,149-165,44\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\n" "[-h, --help] : Print out the help for the scan command.\n", cmd_wifi_scan, 1, 8), From b99ed41c94807c6a95e6cc40f7ed7bdfa18e00af Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 11 Jan 2024 15:29:23 +0530 Subject: [PATCH 0179/2300] [nrf fromtree] net: wifi_shell: Add example of scan option Add an example of the scan's -c parameter to help with understanding. Signed-off-by: Kapil Bhatt (cherry picked from commit d8c362253dab3304e54704be029a7518f8f19adc) (cherry picked from commit 11305e472b97ad23381700865c424926498301e5) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d3f573a28d6..1e1ab4a3724 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1905,7 +1905,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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\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\n" "[-h, --help] : Print out the help for the scan command.\n", cmd_wifi_scan, 1, 8), From 65ff791bf0cbd49132d819c9ae8fde6c2554fd63 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 18 Jan 2024 15:41:09 +0530 Subject: [PATCH 0180/2300] [nrf fromtree] net: wifi_shell: Add help for maximum channels in scan Add a line for scan's -c parameter which specify to take care of maximum channels. Signed-off-by: Kapil Bhatt (cherry picked from commit c22ce801e7fd6badde988e52e65a4b5c10bcef88) (cherry picked from commit 9c754a80d072e415d54fc6dd45235359b016433b) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1e1ab4a3724..1f13ae864ae 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1905,7 +1905,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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\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), From ab7ad7ce7d258d307123baed62332e332656ba6d Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 29 Nov 2023 13:36:27 +0100 Subject: [PATCH 0181/2300] [nrf fromtree] boards nrf5340bsim_cpuapp: Define chosen entropy source Override the chosen entropy source irrespectively of what the SOC may chose. This is to avoid problems as the SOC may select the cryptocell, but we do not support it in the simulated target. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 25599df05e4b060d83d6ccf03ded7b2b411bb7a4) (cherry picked from commit ba7cedd0bc880c07fef2c689a19561fd5b96631e) --- boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts b/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts index 36cbf9691b3..a7c3d39ace5 100644 --- a/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts +++ b/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts @@ -45,6 +45,7 @@ }; chosen { + zephyr,entropy = &rng_hci; zephyr,flash = &flash0; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; From ff0f17ada73b2fa470871e04ea4042bb7e35070f Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 1 Dec 2023 17:02:47 +0100 Subject: [PATCH 0182/2300] [nrf fromtree] manifest: Update nrf hw models to latest * Update the HW models module to 9b985ea6bc237b6ae06f48eb228f2ac7f6e3b96b Including the following: * 9b985ea nrf_ccm: Add RATEOVERRIDE subscribe support * 8592230 nrf_hack: Add comments * 5775f4c docs: Very minor typo and grammar fixes Signed-off-by: Alberto Escolar Piedras (cherry picked from commit c4e1807cdf4d4a868995bcbe51716ac7fef78d3d) (cherry picked from commit 09da644ab209a2a329b5ebd59c012822d0796e39) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index a141e94edd6..b9a84545850 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: a715dcc179f1a71f51c574165958b72fe932ae3f + revision: 9b985ea6bc237b6ae06f48eb228f2ac7f6e3b96b path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From 6e1e41298a25ef3c0e518e671013ebb6baf20d02 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 1 Dec 2023 16:52:19 +0100 Subject: [PATCH 0183/2300] [nrf fromtree] boards nrf5340bsim_cpuapp: Select approprite 802154 radio in DT Set the chosen 802154 radio in DT for the nrf5340bsim_nrf5340_cpuapp so we can build with the radio driver built into the net core. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 47b7eaece9419214fb2065cba4b9c520dc807ca6) (cherry picked from commit a8136cb27e83a594085a0f95d533c20ccd23354c) --- boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts b/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts index a7c3d39ace5..c5ec3c95af5 100644 --- a/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts +++ b/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts @@ -49,6 +49,7 @@ zephyr,flash = &flash0; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,ieee802154 = &ieee802154; }; soc { From f37612f347798bdfb8242a2a13744922105d21e2 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Thu, 18 Jan 2024 15:32:47 +0100 Subject: [PATCH 0184/2300] [nrf fromtree] Bluetooth: ISO: Fix CIS peripheral disconnection during setup When the central aborts the CIS setup during the CIS Creation procedure after it has accepted the CIS request, the peripheral will receive the HCI LE CIS Established event with an error code. It does not receive a disconnection event. See the message sequence chart in Core_v5.4, Vol 6, Part D, Section 6.23. This commit ensures that the perirpheral disconnected callback gets called for this particular scenario. Signed-off-by: Rubin Gerritsen (cherry picked from commit db588104921ac8bfd3f4c2b1b41c84cf5e710ec2) (cherry picked from commit d142e4b062d5e5c9f107d2702ee7db7f065292e0) --- subsys/bluetooth/host/iso.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index 42e9c877a9a..4d6366ead67 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -1117,7 +1117,8 @@ void hci_le_cis_established(struct net_buf *buf) bt_conn_set_state(iso, BT_CONN_CONNECTED); bt_conn_unref(iso); return; - } else if (evt->status != BT_HCI_ERR_OP_CANCELLED_BY_HOST) { + } else if (iso->role == BT_HCI_ROLE_PERIPHERAL || + evt->status != BT_HCI_ERR_OP_CANCELLED_BY_HOST) { iso->err = evt->status; bt_iso_disconnected(iso); } /* else we wait for disconnect event */ From 8dd6ce3b6a701c9e1c2f6a5b2a28b1a1d50d93c5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Sat, 9 Dec 2023 09:02:22 +0200 Subject: [PATCH 0185/2300] [nrf fromtree] net: Move trickle files to lib The trickle algorithm files are clearly a library so move them under lib/ directory. Signed-off-by: Jukka Rissanen (cherry picked from commit b6d9ed095d7bc395be602072db2679d201735113) (cherry picked from commit 2e5e0b159563eba914f44bdbcdbb06eef31f8f98) --- subsys/net/ip/CMakeLists.txt | 1 - subsys/net/ip/Kconfig | 14 -------------- subsys/net/lib/CMakeLists.txt | 1 + subsys/net/lib/Kconfig | 2 ++ subsys/net/lib/trickle/CMakeLists.txt | 7 +++++++ subsys/net/lib/trickle/Kconfig | 18 ++++++++++++++++++ subsys/net/{ip => lib/trickle}/trickle.c | 0 7 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 subsys/net/lib/trickle/CMakeLists.txt create mode 100644 subsys/net/lib/trickle/Kconfig rename subsys/net/{ip => lib/trickle}/trickle.c (100%) diff --git a/subsys/net/ip/CMakeLists.txt b/subsys/net/ip/CMakeLists.txt index b9493b894a7..3a93e5020d4 100644 --- a/subsys/net/ip/CMakeLists.txt +++ b/subsys/net/ip/CMakeLists.txt @@ -45,7 +45,6 @@ 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) zephyr_library_sources_ifdef(CONFIG_NET_TEST_PROTOCOL tp.c) -zephyr_library_sources_ifdef(CONFIG_NET_TRICKLE trickle.c) zephyr_library_sources_ifdef(CONFIG_NET_UDP udp.c) zephyr_library_sources_ifdef(CONFIG_NET_PROMISCUOUS_MODE promiscuous.c) diff --git a/subsys/net/ip/Kconfig b/subsys/net/ip/Kconfig index fffa028b628..a5a6b7ba01e 100644 --- a/subsys/net/ip/Kconfig +++ b/subsys/net/ip/Kconfig @@ -758,20 +758,6 @@ config NET_SLIP_TAP communicate via the SLIP driver. See net-tools project at https://github.com/zephyrproject-rtos/net-tools for more details. -config NET_TRICKLE - bool "Trickle library" - help - Normally this is enabled automatically if needed, - so say 'n' if unsure. - -if NET_TRICKLE -module = NET_TRICKLE -module-dep = NET_LOG -module-str = Log level for Trickle algorithm -module-help = Enables Trickle library output debug messages -source "subsys/net/Kconfig.template.log_config.net" -endif # NET_TRICKLE - endif # NET_RAW_MODE config NET_PKT_RX_COUNT diff --git a/subsys/net/lib/CMakeLists.txt b/subsys/net/lib/CMakeLists.txt index 756adb41341..5e4eae7e028 100644 --- a/subsys/net/lib/CMakeLists.txt +++ b/subsys/net/lib/CMakeLists.txt @@ -14,6 +14,7 @@ add_subdirectory_ifdef(CONFIG_TLS_CREDENTIALS tls_credentials) add_subdirectory_ifdef(CONFIG_NET_CAPTURE capture) add_subdirectory_ifdef(CONFIG_NET_ZPERF zperf) add_subdirectory_ifdef(CONFIG_NET_SHELL shell) +add_subdirectory_ifdef(CONFIG_NET_TRICKLE trickle) if (CONFIG_DNS_RESOLVER OR CONFIG_MDNS_RESPONDER diff --git a/subsys/net/lib/Kconfig b/subsys/net/lib/Kconfig index 5df4a445885..b70105d5f9b 100644 --- a/subsys/net/lib/Kconfig +++ b/subsys/net/lib/Kconfig @@ -39,6 +39,8 @@ menu "Network additional services" source "subsys/net/lib/capture/Kconfig" +source "subsys/net/lib/trickle/Kconfig" + source "subsys/net/lib/zperf/Kconfig" endmenu diff --git a/subsys/net/lib/trickle/CMakeLists.txt b/subsys/net/lib/trickle/CMakeLists.txt new file mode 100644 index 00000000000..b9cf222aab5 --- /dev/null +++ b/subsys/net/lib/trickle/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() + +zephyr_library_sources( + trickle.c + ) diff --git a/subsys/net/lib/trickle/Kconfig b/subsys/net/lib/trickle/Kconfig new file mode 100644 index 00000000000..edc4f8fcf56 --- /dev/null +++ b/subsys/net/lib/trickle/Kconfig @@ -0,0 +1,18 @@ +# Trickle Library for Zephyr + +# Copyright (c) 2016 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +config NET_TRICKLE + bool "Trickle library" + help + Normally this is enabled automatically if needed, + so say 'n' if unsure. + +if NET_TRICKLE +module = NET_TRICKLE +module-dep = NET_LOG +module-str = Log level for Trickle algorithm +module-help = Enables Trickle library output debug messages +source "subsys/net/Kconfig.template.log_config.net" +endif # NET_TRICKLE diff --git a/subsys/net/ip/trickle.c b/subsys/net/lib/trickle/trickle.c similarity index 100% rename from subsys/net/ip/trickle.c rename to subsys/net/lib/trickle/trickle.c From a2ab348e978d61aa41cb6385732f3a2bfb9c1c60 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 16 Nov 2023 17:06:12 +0200 Subject: [PATCH 0186/2300] [nrf fromtree] net: sockets: Create a socket service API The socket service provides a similar functionality as what initd provides in Linux. It listens user registered sockets for any activity and then launches a k_work for it. This way each application does not need to create a thread to listen a blocking socket. Signed-off-by: Jukka Rissanen (cherry picked from commit eff5d028728ccc8291f9d83a724517288e940435) (cherry picked from commit 87cbab4403bc4627e1454521631beba6d925355a) --- .../linker/common-rom/common-rom-net.ld | 4 + include/zephyr/net/socket_service.h | 246 +++++++++++++++ subsys/net/lib/sockets/CMakeLists.txt | 1 + subsys/net/lib/sockets/Kconfig | 25 ++ subsys/net/lib/sockets/sockets_service.c | 291 ++++++++++++++++++ 5 files changed, 567 insertions(+) create mode 100644 include/zephyr/net/socket_service.h create mode 100644 subsys/net/lib/sockets/sockets_service.c diff --git a/include/zephyr/linker/common-rom/common-rom-net.ld b/include/zephyr/linker/common-rom/common-rom-net.ld index 71c1c1e089f..18360212edc 100644 --- a/include/zephyr/linker/common-rom/common-rom-net.ld +++ b/include/zephyr/linker/common-rom/common-rom-net.ld @@ -21,3 +21,7 @@ #if defined(CONFIG_COAP_SERVER) ITERABLE_SECTION_ROM(coap_service, 4) #endif + +#if defined(CONFIG_NET_SOCKETS_SERVICE) + ITERABLE_SECTION_RAM(net_socket_service_desc, 4) +#endif diff --git a/include/zephyr/net/socket_service.h b/include/zephyr/net/socket_service.h new file mode 100644 index 00000000000..16da94d238b --- /dev/null +++ b/include/zephyr/net/socket_service.h @@ -0,0 +1,246 @@ +/** + * @file + * @brief BSD Socket service API + * + * API can be used to install a k_work that is called + * if there is data received to a socket. + */ + +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_NET_SOCKET_SERVICE_H_ +#define ZEPHYR_INCLUDE_NET_SOCKET_SERVICE_H_ + +/** + * @brief BSD socket service API + * @defgroup bsd_socket_service BSD socket service API + * @ingroup networking + * @{ + */ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * 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; + /** Socket information that triggered this event. */ + struct zsock_pollfd event; + /** User data */ + void *user_data; + /** Service back pointer */ + struct net_socket_service_desc *svc; +}; + +/** + * Main structure holding socket service configuration information. + * The k_work item is created so that when there is data coming + * to those fds, the k_work callback is then called. + * The workqueue can be set NULL in which case system workqueue is used. + * The service descriptor should be created at built time, and then used + * as a parameter to register the sockets to be monitored. + * User should create needed sockets and then setup the poll struct and + * then register the sockets to be monitored at runtime. + */ +struct net_socket_service_desc { +#if CONFIG_NET_SOCKETS_LOG_LEVEL >= LOG_LEVEL_DBG + /** + * Owner name. This can be used in debugging to see who has + * registered this service. + */ + 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. */ + int pev_len; + /** Where are my pollfd entries in the global list */ + int *idx; +}; + +#define __z_net_socket_svc_get_name(_svc_id) __z_net_socket_service_##_svc_id +#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 +#define NET_SOCKET_SERVICE_OWNER +#endif + +#define NET_SOCKET_SERVICE_CALLBACK_MODE(_flag) \ + IF_ENABLED(_flag, \ + (.work = Z_WORK_INITIALIZER(net_socket_service_callback),)) + +#define __z_net_socket_service_define(_name, _work_q, _cb, _count, _async, ...) \ + static int __z_net_socket_svc_get_idx(_name); \ + static struct net_socket_service_event \ + __z_net_socket_svc_get_name(_name)[_count] = { \ + [0 ... ((_count) - 1)] = { \ + .event.fd = -1, /* Invalid socket */ \ + NET_SOCKET_SERVICE_CALLBACK_MODE(_async) \ + .callback = _cb, \ + } \ + }; \ + 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), \ + } + +/** + * @brief Statically define a network socket service. + * The user callback is called asynchronously for this service meaning that + * the service API will not wait until the user callback returns before continuing + * with next socket service. + * + * The socket service can be accessed outside the module where it is defined using: + * + * @code extern struct net_socket_service_desc ; @endcode + * + * @note This macro cannot be used together with a static keyword. + * If such a use-case is desired, use NET_SOCKET_SERVICE_ASYNC_DEFINE_STATIC + * 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_ASYNC_DEFINE(name, work_q, cb, count) \ + __z_net_socket_service_define(name, work_q, cb, count, 1) + +/** + * @brief Statically define a network socket service in a private (static) scope. + * The user callback is called asynchronously for this service meaning that + * the service API will not wait until the user callback returns before continuing + * 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_ASYNC_DEFINE_STATIC(name, work_q, cb, count) \ + __z_net_socket_service_define(name, work_q, cb, count, 1, static) + +/** + * @brief Statically define a network socket service. + * The user callback is called synchronously for this service meaning that + * the service API will wait until the user callback returns before continuing + * with next socket service. + * + * The socket service can be accessed outside the module where it is defined using: + * + * @code extern struct net_socket_service_desc ; @endcode + * + * @note This macro cannot be used together with a static keyword. + * If such a use-case is desired, use NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC + * 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, 0) + +/** + * @brief Statically define a network socket service in a private (static) scope. + * The user callback is called synchronously for this service meaning that + * the service API will wait until the user callback returns before continuing + * 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, 0, static) + +/** + * @brief Register pollable sockets. + * + * @param service Pointer to a service description. + * @param fds Socket array to poll. + * @param len Length of the socket array. + * @param user_data User specific data. + * + * @retval 0 No error + * @retval -ENOENT Service is not found. + * @retval -ENINVAL Invalid parameter. + */ +__syscall int net_socket_service_register(const struct net_socket_service_desc *service, + struct zsock_pollfd *fds, int len, void *user_data); + +/** + * @brief Unregister pollable sockets. + * + * @param service Pointer to a service description. + * + * @retval 0 No error + * @retval -ENOENT Service is not found. + * @retval -ENINVAL Invalid parameter. + */ +static inline int net_socket_service_unregister(const struct net_socket_service_desc *service) +{ + return net_socket_service_register(service, NULL, 0, NULL); +} + +/** + * @typedef net_socket_service_cb_t + * @brief Callback used while iterating over socket services. + * + * @param svc Pointer to current socket service. + * @param user_data A valid pointer to user data or NULL + */ +typedef void (*net_socket_service_cb_t)(const struct net_socket_service_desc *svc, + void *user_data); + +/** + * @brief Go through all the socket services and call callback for each service. + * + * @param cb User-supplied callback function to call + * @param user_data User specified data + */ +void net_socket_service_foreach(net_socket_service_cb_t cb, void *user_data); + +#ifdef __cplusplus +} +#endif + +#include + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_NET_SOCKET_SERVICE_H_ */ diff --git a/subsys/net/lib/sockets/CMakeLists.txt b/subsys/net/lib/sockets/CMakeLists.txt index 7ffd6dc476b..253cb4a182f 100644 --- a/subsys/net/lib/sockets/CMakeLists.txt +++ b/subsys/net/lib/sockets/CMakeLists.txt @@ -26,6 +26,7 @@ zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_SOCKOPT_TLS sockets_tls.c zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_OFFLOAD socket_offload.c) zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_OFFLOAD_DISPATCHER socket_dispatcher.c) zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_OBJ_CORE socket_obj_core.c) +zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_SERVICE sockets_service.c) if(CONFIG_NET_SOCKETS_NET_MGMT) zephyr_library_sources(sockets_net_mgmt.c) diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index b2da30c1e48..40d86b9498f 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -73,6 +73,31 @@ config NET_SOCKET_MAX_SEND_WAIT The maximum time a socket is waiting for a blocked connection before returning an ENOBUFS error. +config NET_SOCKETS_SERVICE + bool "Socket service support [EXPERIMENTAL]" + select EXPERIMENTAL + select EVENTFD + help + 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 + 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. + +config NET_SOCKETS_SERVICE_STACK_SIZE + int "Stack size for the thread handling socket services" + default 1200 + depends on NET_SOCKETS_SERVICE + help + Set the internal stack size for the thread that polls sockets. + +config NET_SOCKETS_SERVICE_INIT_PRIO + int "Startup priority for the network socket service" + default 95 + depends on NET_SOCKETS_SERVICE + config NET_SOCKETS_SOCKOPT_TLS bool "TCP TLS socket option support [EXPERIMENTAL]" imply TLS_CREDENTIALS diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c new file mode 100644 index 00000000000..d253ece629c --- /dev/null +++ b/subsys/net/lib/sockets/sockets_service.c @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_REGISTER(net_sock_svc, CONFIG_NET_SOCKETS_LOG_LEVEL); + +#include +#include +#include + +static int init_socket_service(void); +static bool init_done; + +static K_MUTEX_DEFINE(lock); +static K_CONDVAR_DEFINE(wait_start); + +STRUCT_SECTION_START_EXTERN(net_socket_service_desc); +STRUCT_SECTION_END_EXTERN(net_socket_service_desc); + +static struct service { + /* The +1 is for triggering events from register function */ + struct zsock_pollfd events[1 + CONFIG_NET_SOCKETS_POLL_MAX]; + int count; +} ctx; + +#define get_idx(svc) (*(svc->idx)) + +void net_socket_service_foreach(net_socket_service_cb_t cb, void *user_data) +{ + STRUCT_SECTION_FOREACH(net_socket_service_desc, svc) { + cb(svc, user_data); + } +} + +static void cleanup_svc_events(const struct net_socket_service_desc *svc) +{ + for (int i = 0; i < svc->pev_len; i++) { + ctx.events[get_idx(svc) + i].fd = -1; + svc->pev[i].event.fd = -1; + svc->pev[i].event.events = 0; + } +} + +int z_impl_net_socket_service_register(const struct net_socket_service_desc *svc, + struct zsock_pollfd *fds, int len, + void *user_data) +{ + int i, ret = -ENOENT; + + k_mutex_lock(&lock, K_FOREVER); + + if (!init_done) { + (void)k_condvar_wait(&wait_start, &lock, K_FOREVER); + } + + if (STRUCT_SECTION_START(net_socket_service_desc) > svc || + STRUCT_SECTION_END(net_socket_service_desc) <= svc) { + goto out; + } + + if (fds == NULL) { + cleanup_svc_events(svc); + } else { + if (len > svc->pev_len) { + NET_DBG("Too many file descriptors, " + "max is %d for service %p", + svc->pev_len, svc); + ret = -ENOMEM; + goto out; + } + + for (i = 0; i < len; i++) { + svc->pev[i].event = fds[i]; + svc->pev[i].user_data = user_data; + } + + for (i = 0; i < svc->pev_len; i++) { + ctx.events[get_idx(svc) + i] = svc->pev[i].event; + } + } + + /* Tell the thread to re-read the variables */ + eventfd_write(ctx.events[0].fd, 1); + ret = 0; + +out: + k_mutex_unlock(&lock); + + return ret; +} + +static struct net_socket_service_desc *find_svc_and_event( + struct zsock_pollfd *pev, + struct net_socket_service_event **event) +{ + STRUCT_SECTION_FOREACH(net_socket_service_desc, svc) { + for (int i = 0; i < svc->pev_len; i++) { + if (svc->pev[i].event.fd == pev->fd) { + *event = &svc->pev[i]; + return svc; + } + } + } + + return NULL; +} + +/* We do not set the user callback to our work struct because we need to + * hook into the flow and restore the global poll array so that the next poll + * 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) +{ + 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; + + ev.callback(&ev.work); + + /* Copy back the socket fd to the global array because we marked + * it as -1 when triggering the work. + */ + for (int i = 0; i < svc->pev_len; i++) { + ctx.events[get_idx(svc) + i] = svc->pev[i].event; + } +} + +static int call_work(struct zsock_pollfd *pev, struct k_work_q *work_q, + struct k_work *work) +{ + int ret = 0; + + /* Mark the global fd non pollable so that we do not + * call the callback second time. + */ + pev->fd = -1; + + if (work->handler == NULL) { + /* Synchronous call */ + net_socket_service_callback(work); + } else { + if (work_q != NULL) { + ret = k_work_submit_to_queue(work_q, work); + } else { + ret = k_work_submit(work); + } + + k_yield(); + } + + return ret; + +} + +static int trigger_work(struct zsock_pollfd *pev) +{ + struct net_socket_service_event *event; + struct net_socket_service_desc *svc; + + svc = find_svc_and_event(pev, &event); + if (svc == NULL) { + return -ENOENT; + } + + event->svc = svc; + + /* Copy the triggered event to our event so that we know what + * was actually causing the event. + */ + event->event = *pev; + + return call_work(pev, svc->work_q, &event->work); +} + +static void socket_service_thread(void) +{ + int ret, i, fd, count = 0; + eventfd_t value; + + STRUCT_SECTION_COUNT(net_socket_service_desc, &ret); + if (ret == 0) { + NET_INFO("No socket services found, service disabled."); + goto fail; + } + + /* Create contiguous poll event array to enable socket polling */ + STRUCT_SECTION_FOREACH(net_socket_service_desc, svc) { + get_idx(svc) = count + 1; + count += svc->pev_len; + } + + if ((count + 1) > ARRAY_SIZE(ctx.events)) { + NET_WARN("You have %d services to monitor but " + "%d poll entries configured.", + count + 1, ARRAY_SIZE(ctx.events)); + NET_WARN("Consider increasing value of %s to %d", + "CONFIG_NET_SOCKETS_POLL_MAX", count + 1); + } + + NET_DBG("Monitoring %d socket entries", count); + + ctx.count = count + 1; + + /* Create an eventfd that can be used to trigger events during polling */ + fd = eventfd(0, 0); + if (fd < 0) { + fd = -errno; + NET_ERR("eventfd failed (%d)", fd); + goto out; + } + + init_done = true; + k_condvar_broadcast(&wait_start); + + ctx.events[0].fd = fd; + ctx.events[0].events = ZSOCK_POLLIN; + +restart: + i = 1; + + k_mutex_lock(&lock, K_FOREVER); + + /* Copy individual events to the big array */ + STRUCT_SECTION_FOREACH(net_socket_service_desc, svc) { + for (int j = 0; j < svc->pev_len; j++) { + ctx.events[get_idx(svc) + j] = svc->pev[j].event; + } + } + + k_mutex_unlock(&lock); + + while (true) { + ret = zsock_poll(ctx.events, count + 1, -1); + if (ret < 0) { + ret = -errno; + NET_ERR("poll failed (%d)", ret); + goto out; + } + + if (ret == 0) { + /* should not happen because timeout is -1 */ + break; + } + + if (ret > 0 && ctx.events[0].revents) { + eventfd_read(ctx.events[0].fd, &value); + NET_DBG("Received restart event."); + goto restart; + } + + for (i = 1; i < (count + 1); i++) { + if (ctx.events[i].fd < 0) { + continue; + } + + if (ctx.events[i].revents > 0) { + ret = trigger_work(&ctx.events[i]); + if (ret < 0) { + NET_DBG("Triggering work failed (%d)", ret); + } + } + } + } + +out: + NET_DBG("Socket service thread stopped"); + init_done = false; + + return; + +fail: + k_condvar_broadcast(&wait_start); +} + +K_THREAD_DEFINE(socket_service_monitor, CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE, + socket_service_thread, NULL, NULL, NULL, + K_LOWEST_APPLICATION_THREAD_PRIO, 0, 0); + +static int init_socket_service(void) +{ + k_thread_name_set(socket_service_monitor, "net_socket_service"); + + return 0; +} + +SYS_INIT(init_socket_service, APPLICATION, CONFIG_NET_SOCKETS_SERVICE_INIT_PRIO); From daa00eee818d73744503e02f3836b6b88838314b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 18 Jan 2024 12:55:25 +0100 Subject: [PATCH 0187/2300] [nrf fromtree] net: socket_service: Add underscore in the idx variable name Nothing critical, but it just looks better if the service name is separated from the prefix, i.e: _z_net_socket_service_idx_udp_service_async vs current: _z_net_socket_service_idxudp_service_async Signed-off-by: Robert Lubos (cherry picked from commit 3111b801d90ff9d109e678421097da01f45685e0) (cherry picked from commit 227b98f4aeeabb05f6660944f043a51bf6ef9f15) --- include/zephyr/net/socket_service.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/net/socket_service.h b/include/zephyr/net/socket_service.h index 16da94d238b..a4e21f00a33 100644 --- a/include/zephyr/net/socket_service.h +++ b/include/zephyr/net/socket_service.h @@ -76,7 +76,7 @@ struct net_socket_service_desc { }; #define __z_net_socket_svc_get_name(_svc_id) __z_net_socket_service_##_svc_id -#define __z_net_socket_svc_get_idx(_svc_id) __z_net_socket_service_idx##_svc_id +#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); From 406215a9b428a41655ef8da9155c48be0bc05ff1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 18 Jan 2024 12:57:49 +0100 Subject: [PATCH 0188/2300] [nrf fromtree] net: socket_service: Fix iterable section location The iterable section should be located in ROM and not RAM, this caused crashes on multiple platforms running socket services. Fixes #67762 Signed-off-by: Robert Lubos (cherry picked from commit 8ad0e5763f844e1cff81b21ebc54c1cc6101ff41) (cherry picked from commit 93ac51d09be899f0f5e5fea4e03dea49e60ce882) --- include/zephyr/linker/common-rom/common-rom-net.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/linker/common-rom/common-rom-net.ld b/include/zephyr/linker/common-rom/common-rom-net.ld index 18360212edc..2aa46dfecf5 100644 --- a/include/zephyr/linker/common-rom/common-rom-net.ld +++ b/include/zephyr/linker/common-rom/common-rom-net.ld @@ -23,5 +23,5 @@ #endif #if defined(CONFIG_NET_SOCKETS_SERVICE) - ITERABLE_SECTION_RAM(net_socket_service_desc, 4) + ITERABLE_SECTION_ROM(net_socket_service_desc, 4) #endif From 5176be65e79dc4a337e1230adbbfb424ed58b91c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 16 Jan 2024 17:37:59 +0100 Subject: [PATCH 0189/2300] [nrf fromtree] net: arp: Make arp_update() function externally visible So that it's possible to register ARP entries manually. Needed for DHCP server implementation, which in unicast mode needs to reply to an IP address that is not registered on the peer interface yet (hence no ARP reply will be sent). It's needed to add an ARP entry manually in that case, as hardware address is already known at that point. Signed-off-by: Robert Lubos (cherry picked from commit 1d14f13d75eb31104eb84d5d00e835cf82fb8377) (cherry picked from commit 70abf9f2c7ff978d3218e6a1246fb75dcfa0cd19) --- subsys/net/l2/ethernet/arp.c | 34 +++++++++++++++++----------------- subsys/net/l2/ethernet/arp.h | 4 ++++ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index 39a06ed64a0..6be7255b19b 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -457,11 +457,11 @@ static void arp_gratuitous(struct net_if *iface, } } -static void arp_update(struct net_if *iface, - struct in_addr *src, - struct net_eth_addr *hwaddr, - bool gratuitous, - bool force) +void net_arp_update(struct net_if *iface, + struct in_addr *src, + struct net_eth_addr *hwaddr, + bool gratuitous, + bool force) { struct arp_entry *entry; struct net_pkt *pkt; @@ -647,10 +647,10 @@ enum net_verdict net_arp_input(struct net_pkt *pkt, /* If the IP address is in our cache, * then update it here. */ - arp_update(net_pkt_iface(pkt), - (struct in_addr *)arp_hdr->src_ipaddr, - &arp_hdr->src_hwaddr, - true, false); + net_arp_update(net_pkt_iface(pkt), + (struct in_addr *)arp_hdr->src_ipaddr, + &arp_hdr->src_hwaddr, + true, false); break; } } @@ -689,10 +689,10 @@ enum net_verdict net_arp_input(struct net_pkt *pkt, net_sprint_ll_addr((uint8_t *)&arp_hdr->src_hwaddr, arp_hdr->hwlen)); - arp_update(net_pkt_iface(pkt), - (struct in_addr *)arp_hdr->src_ipaddr, - &arp_hdr->src_hwaddr, - false, true); + net_arp_update(net_pkt_iface(pkt), + (struct in_addr *)arp_hdr->src_ipaddr, + &arp_hdr->src_hwaddr, + false, true); dst_hw_addr = &arp_hdr->src_hwaddr; } else { @@ -711,10 +711,10 @@ enum net_verdict net_arp_input(struct net_pkt *pkt, case NET_ARP_REPLY: if (net_ipv4_is_my_addr((struct in_addr *)arp_hdr->dst_ipaddr)) { - arp_update(net_pkt_iface(pkt), - (struct in_addr *)arp_hdr->src_ipaddr, - &arp_hdr->src_hwaddr, - false, false); + net_arp_update(net_pkt_iface(pkt), + (struct in_addr *)arp_hdr->src_ipaddr, + &arp_hdr->src_hwaddr, + false, false); } break; diff --git a/subsys/net/l2/ethernet/arp.h b/subsys/net/l2/ethernet/arp.h index 28cafe5f20a..46589cbc1f7 100644 --- a/subsys/net/l2/ethernet/arp.h +++ b/subsys/net/l2/ethernet/arp.h @@ -67,6 +67,9 @@ int net_arp_foreach(net_arp_cb_t cb, void *user_data); void net_arp_clear_cache(struct net_if *iface); void net_arp_init(void); +void net_arp_update(struct net_if *iface, struct in_addr *src, + struct net_eth_addr *hwaddr, bool gratuitous, + bool force); /** * @} @@ -83,6 +86,7 @@ void net_arp_init(void); #define net_arp_foreach(...) 0 #define net_arp_init(...) #define net_arp_clear_pending(...) 0 +#define net_arp_update(...) #endif /* CONFIG_NET_ARP */ From f86772e8d17df0b3f10c2dd05a87752e287f9300 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 16 Jan 2024 17:38:16 +0100 Subject: [PATCH 0190/2300] [nrf fromtree] net: if: Add function to obtain IPv4 netmask Add a helper function to obtain IPv4 netmask configured on an interface. Signed-off-by: Robert Lubos (cherry picked from commit db80ed3e8df1d662f5e750b5629e5e6e7c1bddd5) (cherry picked from commit f3d115bad99c167900b83d59dd1a88bb75acf27a) --- include/zephyr/net/net_if.h | 9 +++++++++ subsys/net/ip/net_if.c | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/zephyr/net/net_if.h b/include/zephyr/net/net_if.h index 788c3316391..f1e5be67cf7 100644 --- a/include/zephyr/net/net_if.h +++ b/include/zephyr/net/net_if.h @@ -2217,6 +2217,15 @@ struct in_addr *net_if_ipv4_get_ll(struct net_if *iface, struct in_addr *net_if_ipv4_get_global_addr(struct net_if *iface, enum net_addr_state addr_state); +/** + * @brief Get IPv4 netmask of an interface. + * + * @param iface Interface to use. + * + * @return The netmask set on the interface, unspecified address if not found. + */ +struct in_addr net_if_ipv4_get_netmask(struct net_if *iface); + /** * @brief Set IPv4 netmask for an interface. * diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 00c9c74495d..1a8199ad62c 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -3532,6 +3532,27 @@ static inline int z_vrfy_net_if_ipv4_addr_lookup_by_index( #include #endif +struct in_addr net_if_ipv4_get_netmask(struct net_if *iface) +{ + struct in_addr netmask = { 0 }; + + net_if_lock(iface); + + if (net_if_config_ipv4_get(iface, NULL) < 0) { + goto out; + } + + if (!iface->config.ip.ipv4) { + goto out; + } + + netmask = iface->config.ip.ipv4->netmask; +out: + net_if_unlock(iface); + + return netmask; +} + void net_if_ipv4_set_netmask(struct net_if *iface, const struct in_addr *netmask) { From ba44512f525c8657eb65c5aa205ee04fdc704086 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 16 Jan 2024 17:38:56 +0100 Subject: [PATCH 0191/2300] [nrf fromtree] net: dhcpv4: Implement DHCPv4 server Add basic socket-based implementation of DHCPv4 sever. Signed-off-by: Robert Lubos (cherry picked from commit 1e08bbd5434f82e7a7849677e7dd10416d71488b) (cherry picked from commit fb9ace0f2e6ac68e2f7a3438cafdf6f6f5799f33) --- include/zephyr/net/dhcpv4_server.h | 118 ++ subsys/net/ip/dhcpv4.h | 11 + subsys/net/ip/net_core.c | 2 + subsys/net/lib/CMakeLists.txt | 1 + subsys/net/lib/Kconfig | 2 + subsys/net/lib/dhcpv4/CMakeLists.txt | 11 + subsys/net/lib/dhcpv4/Kconfig | 46 + subsys/net/lib/dhcpv4/dhcpv4_server.c | 1439 +++++++++++++++++++++++++ 8 files changed, 1630 insertions(+) create mode 100644 include/zephyr/net/dhcpv4_server.h create mode 100644 subsys/net/lib/dhcpv4/CMakeLists.txt create mode 100644 subsys/net/lib/dhcpv4/Kconfig create mode 100644 subsys/net/lib/dhcpv4/dhcpv4_server.c diff --git a/include/zephyr/net/dhcpv4_server.h b/include/zephyr/net/dhcpv4_server.h new file mode 100644 index 00000000000..18c4af114cd --- /dev/null +++ b/include/zephyr/net/dhcpv4_server.h @@ -0,0 +1,118 @@ +/** @file + * @brief DHCPv4 Server API + */ + +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_ +#define ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief DHCPv4 server + * @defgroup dhcpv4_server DHCPv4 server + * @ingroup networking + * @{ + */ + +/** @cond INTERNAL_HIDDEN */ + +struct net_if; + +#define DHCPV4_CLIENT_ID_MAX_SIZE 20 + +enum dhcpv4_server_addr_state { + DHCPV4_SERVER_ADDR_FREE, + DHCPV4_SERVER_ADDR_RESERVED, + DHCPV4_SERVER_ADDR_ALLOCATED, + DHCPV4_SERVER_ADDR_DECLINED, +}; + +struct dhcpv4_client_id { + uint8_t buf[DHCPV4_CLIENT_ID_MAX_SIZE]; + uint8_t len; +}; + +struct dhcpv4_addr_slot { + enum dhcpv4_server_addr_state state; + struct dhcpv4_client_id client_id; + struct in_addr addr; + uint32_t lease_time; + k_timepoint_t expiry; +}; + +/** @endcond */ + +/** + * @brief Start DHCPv4 server instance on an iface + * + * @details Start DHCPv4 server on a given interface. The server will start + * listening for DHCPv4 Discover/Request messages on the interface and assign + * IPv4 addresses from the configured address pool accordingly. + * + * @param iface A valid pointer on an interface + * @param base_addr First IPv4 address from the DHCPv4 address pool. The number + * of addresses in the pool is configured statically with Kconfig + * (CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT). + * + * @return 0 on success, a negative error code otherwise. + */ +int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr); + +/** + * @brief Stop DHCPv4 server instance on an iface + * + * @details Stop DHCPv4 server on a given interface. DHCPv4 requests will no + * longer be handled on the interface, and all of the allocations are cleared. + * + * @param iface A valid pointer on an interface + * + * @return 0 on success, a negative error code otherwise. + */ +int net_dhcpv4_server_stop(struct net_if *iface); + +/** + * @typedef net_dhcpv4_lease_cb_t + * @brief Callback used while iterating over active DHCPv4 address leases + * + * @param iface Pointer to the network interface + * @param lease Pointer to the DHPCv4 address lease slot + * @param user_data A valid pointer to user data or NULL + */ +typedef void (*net_dhcpv4_lease_cb_t)(struct net_if *iface, + struct dhcpv4_addr_slot *lease, + void *user_data); + +/** + * @brief Iterate over all DHCPv4 address leases on a given network interface + * and call callback for each lease. In case no network interface is provided + * (NULL interface pointer), will iterate over all interfaces running DHCPv4 + * server instance. + * + * @param iface Pointer to the network interface, can be NULL + * @param cb User-supplied callback function to call + * @param user_data User specified data + */ +int net_dhcpv4_server_foreach_lease(struct net_if *iface, + net_dhcpv4_lease_cb_t cb, + void *user_data); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_ */ diff --git a/subsys/net/ip/dhcpv4.h b/subsys/net/ip/dhcpv4.h index a274e3a6aea..712d361ac80 100644 --- a/subsys/net/ip/dhcpv4.h +++ b/subsys/net/ip/dhcpv4.h @@ -62,6 +62,7 @@ struct dhcp_msg { #define DHCPV4_OPTIONS_REQ_LIST 55 #define DHCPV4_OPTIONS_RENEWAL 58 #define DHCPV4_OPTIONS_REBINDING 59 +#define DHCPV4_OPTIONS_CLIENT_ID 61 #define DHCPV4_OPTIONS_END 255 /* Useful size macros */ @@ -142,4 +143,14 @@ static inline bool net_dhcpv4_accept_unicast(struct net_pkt *pkt) #endif /* CONFIG_NET_DHCPV4 && CONFIG_NET_DHCPV4_ACCEPT_UNICAST */ +#if defined(CONFIG_NET_DHCPV4_SERVER) + +void net_dhcpv4_server_init(void); + +#else + +#define net_dhcpv4_server_init() + +#endif /* CONFIG_NET_DHCPV4_SERVER */ + #endif /* __INTERNAL_DHCPV4_H */ diff --git a/subsys/net/ip/net_core.c b/subsys/net/ip/net_core.c index baa8cd695c5..3187b40a66b 100644 --- a/subsys/net/ip/net_core.c +++ b/subsys/net/ip/net_core.c @@ -495,6 +495,8 @@ static inline int services_init(void) return status; } + net_dhcpv4_server_init(); + dns_init_resolver(); websocket_init(); diff --git a/subsys/net/lib/CMakeLists.txt b/subsys/net/lib/CMakeLists.txt index 5e4eae7e028..e3319f6cd8d 100644 --- a/subsys/net/lib/CMakeLists.txt +++ b/subsys/net/lib/CMakeLists.txt @@ -15,6 +15,7 @@ add_subdirectory_ifdef(CONFIG_NET_CAPTURE capture) add_subdirectory_ifdef(CONFIG_NET_ZPERF zperf) add_subdirectory_ifdef(CONFIG_NET_SHELL shell) add_subdirectory_ifdef(CONFIG_NET_TRICKLE trickle) +add_subdirectory_ifdef(CONFIG_NET_DHCPV4_SERVER dhcpv4) if (CONFIG_DNS_RESOLVER OR CONFIG_MDNS_RESPONDER diff --git a/subsys/net/lib/Kconfig b/subsys/net/lib/Kconfig index b70105d5f9b..6cfa0445241 100644 --- a/subsys/net/lib/Kconfig +++ b/subsys/net/lib/Kconfig @@ -39,6 +39,8 @@ menu "Network additional services" source "subsys/net/lib/capture/Kconfig" +source "subsys/net/lib/dhcpv4/Kconfig" + source "subsys/net/lib/trickle/Kconfig" source "subsys/net/lib/zperf/Kconfig" diff --git a/subsys/net/lib/dhcpv4/CMakeLists.txt b/subsys/net/lib/dhcpv4/CMakeLists.txt new file mode 100644 index 00000000000..348b6c99bb7 --- /dev/null +++ b/subsys/net/lib/dhcpv4/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() + +zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/ip) + +zephyr_library_sources( + dhcpv4_server.c + ) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig new file mode 100644 index 00000000000..801d536a5a1 --- /dev/null +++ b/subsys/net/lib/dhcpv4/Kconfig @@ -0,0 +1,46 @@ +# DHCPv4 server implementation for Zephyr + +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +config NET_DHCPV4_SERVER + bool "DHCPv4 server" + depends on NET_IPV4 && NET_UDP + select NET_SOCKETS + select NET_SOCKETS_SERVICE + +if NET_DHCPV4_SERVER + +module = NET_DHCPV4_SERVER +module-dep = NET_LOG +module-str = Log level for DHCPv4 server +module-help = Enables DHCPv4 server output debug messages +source "subsys/net/Kconfig.template.log_config.net" + +config NET_DHCPV4_SERVER_INSTANCES + int "Maximum number of DHCPv4 server instances" + default 1 + help + Maximum number of DHCPv4 server instances supported by the system. + Each network interface that wants to act as a DHCPv4 server requires + a separate instance. + +config NET_DHCPV4_SERVER_ADDR_COUNT + int "Number of IPv4 addresses that can be assigned by the server" + default 4 + help + Maximum number of IPv4 addresses that can be assigned by the DHCPv4 + server instance. The base IPv4 address in the address pool is provided + at runtime, during server initialization. Consecutive addresses in the + pool have the lowest address octet incremented. + +config NET_DHCPV4_SERVER_ADDR_LEASE_TIME + int "Lease time for IPv4 addresses assigned by the server (seconds)" + default 86400 + help + Lease time in seconds for IPv4 addresses assigned by the server. + The lease time determines when the IPv4 address lease expires if the + client does not renew it. + +endif # NET_DHCPV4_SERVER diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c new file mode 100644 index 00000000000..714d036ddde --- /dev/null +++ b/subsys/net/lib/dhcpv4/dhcpv4_server.c @@ -0,0 +1,1439 @@ +/** @file + * @brief DHCPv4 server implementation + */ + +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +LOG_MODULE_REGISTER(net_dhcpv4_server, CONFIG_NET_DHCPV4_SERVER_LOG_LEVEL); + +#include "dhcpv4.h" +#include "net_private.h" +#include "../../l2/ethernet/arp.h" + +#define DHCPV4_OPTIONS_MSG_TYPE_SIZE 3 +#define DHCPV4_OPTIONS_IP_LEASE_TIME_SIZE 6 +#define DHCPV4_OPTIONS_SERVER_ID_SIZE 6 +#define DHCPV4_OPTIONS_SUBNET_MASK_SIZE 6 +#define DHCPV4_OPTIONS_CLIENT_ID_MIN_SIZE 2 + +#define ADDRESS_RESERVED_TIMEOUT K_SECONDS(5) + +/* RFC 1497 [17] */ +static const uint8_t magic_cookie[4] = { 0x63, 0x82, 0x53, 0x63 }; + +struct dhcpv4_server_ctx { + struct net_if *iface; + int sock; + struct k_work_delayable timeout_work; + struct dhcpv4_addr_slot addr_pool[CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT]; + struct in_addr server_addr; + struct in_addr netmask; +}; + +static struct dhcpv4_server_ctx server_ctx[CONFIG_NET_DHCPV4_SERVER_INSTANCES]; +static struct zsock_pollfd fds[CONFIG_NET_DHCPV4_SERVER_INSTANCES]; +static K_MUTEX_DEFINE(server_lock); + +#define DHCPV4_MAX_PARAMETERS_REQUEST_LEN 16 + +struct dhcpv4_parameter_request_list { + uint8_t list[DHCPV4_MAX_PARAMETERS_REQUEST_LEN]; + uint8_t count; +}; + +static void dhcpv4_server_timeout_recalc(struct dhcpv4_server_ctx *ctx) +{ + k_timepoint_t next = sys_timepoint_calc(K_FOREVER); + k_timeout_t timeout; + + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (slot->state == DHCPV4_SERVER_ADDR_RESERVED || + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) { + if (sys_timepoint_cmp(slot->expiry, next) < 0) { + next = slot->expiry; + } + } + } + + timeout = sys_timepoint_timeout(next); + + if (K_TIMEOUT_EQ(timeout, K_FOREVER)) { + LOG_DBG("No more addresses, canceling timer"); + k_work_cancel_delayable(&ctx->timeout_work); + } else { + k_work_reschedule(&ctx->timeout_work, timeout); + } +} + +/* Option parsing. */ + +static uint8_t *dhcpv4_find_option(uint8_t *data, size_t datalen, + uint8_t *optlen, uint8_t opt_code) +{ + uint8_t *opt = NULL; + + while (datalen > 0) { + uint8_t code; + uint8_t len; + + code = *data; + + /* Two special cases (fixed sized options) */ + if (code == 0) { + data++; + datalen--; + continue; + } + + if (code == DHCPV4_OPTIONS_END) { + break; + } + + /* Length field should now follow. */ + if (datalen < 2) { + break; + } + + len = *(data + 1); + + if (datalen < len + 2) { + break; + } + + if (code == opt_code) { + /* Found the option. */ + opt = data + 2; + *optlen = len; + break; + } + + data += len + 2; + datalen -= len + 2; + } + + return opt; +} + +static int dhcpv4_find_message_type_option(uint8_t *data, size_t datalen, + uint8_t *msgtype) +{ + uint8_t *opt; + uint8_t optlen; + + opt = dhcpv4_find_option(data, datalen, &optlen, + DHCPV4_OPTIONS_MSG_TYPE); + if (opt == NULL) { + return -ENOENT; + } + + if (optlen != 1) { + return -EINVAL; + } + + *msgtype = *opt; + + return 0; +} + +static int dhcpv4_find_server_id_option(uint8_t *data, size_t datalen, + struct in_addr *server_id) +{ + uint8_t *opt; + uint8_t optlen; + + opt = dhcpv4_find_option(data, datalen, &optlen, + DHCPV4_OPTIONS_SERVER_ID); + if (opt == NULL) { + return -ENOENT; + } + + if (optlen != sizeof(struct in_addr)) { + return -EINVAL; + } + + memcpy(server_id, opt, sizeof(struct in_addr)); + + return 0; +} + +static int dhcpv4_find_client_id_option(uint8_t *data, size_t datalen, + uint8_t *client_id, uint8_t *len) +{ + uint8_t *opt; + uint8_t optlen; + + opt = dhcpv4_find_option(data, datalen, &optlen, + DHCPV4_OPTIONS_CLIENT_ID); + if (opt == NULL) { + return -ENOENT; + } + + if (optlen < DHCPV4_OPTIONS_CLIENT_ID_MIN_SIZE) { + return -EINVAL; + } + + if (optlen > *len) { + LOG_ERR("Not enough memory for DHCPv4 client identifier."); + return -ENOMEM; + } + + memcpy(client_id, opt, optlen); + *len = optlen; + + return 0; +} + +static int dhcpv4_find_requested_ip_option(uint8_t *data, size_t datalen, + struct in_addr *requested_ip) +{ + uint8_t *opt; + uint8_t optlen; + + opt = dhcpv4_find_option(data, datalen, &optlen, + DHCPV4_OPTIONS_REQ_IPADDR); + if (opt == NULL) { + return -ENOENT; + } + + if (optlen != sizeof(struct in_addr)) { + return -EINVAL; + } + + memcpy(requested_ip, opt, sizeof(struct in_addr)); + + return 0; +} + +static int dhcpv4_find_ip_lease_time_option(uint8_t *data, size_t datalen, + uint32_t *lease_time) +{ + uint8_t *opt; + uint8_t optlen; + + opt = dhcpv4_find_option(data, datalen, &optlen, + DHCPV4_OPTIONS_LEASE_TIME); + if (opt == NULL) { + return -ENOENT; + } + + if (optlen != sizeof(uint32_t)) { + return -EINVAL; + } + + *lease_time = sys_get_be32(opt); + + return 0; +} + +static int dhcpv4_find_parameter_request_list_option( + uint8_t *data, size_t datalen, + struct dhcpv4_parameter_request_list *params) +{ + uint8_t *opt; + uint8_t optlen; + + opt = dhcpv4_find_option(data, datalen, &optlen, + DHCPV4_OPTIONS_REQ_LIST); + if (opt == NULL) { + return -ENOENT; + } + + if (optlen > sizeof(params->list)) { + /* Best effort here, copy as much as we can. */ + optlen = sizeof(params->list); + } + + memcpy(params->list, opt, optlen); + params->count = optlen; + + return 0; +} + +/* Option encoding. */ + +static uint8_t *dhcpv4_encode_magic_cookie(uint8_t *buf, size_t *buflen) +{ + if (buf == NULL || *buflen < SIZE_OF_MAGIC_COOKIE) { + return NULL; + } + + memcpy(buf, magic_cookie, SIZE_OF_MAGIC_COOKIE); + + *buflen -= SIZE_OF_MAGIC_COOKIE; + + return buf + SIZE_OF_MAGIC_COOKIE; +} + +static uint8_t *dhcpv4_encode_ip_lease_time_option(uint8_t *buf, size_t *buflen, + uint32_t lease_time) +{ + if (buf == NULL || *buflen < DHCPV4_OPTIONS_IP_LEASE_TIME_SIZE) { + return NULL; + } + + buf[0] = DHCPV4_OPTIONS_LEASE_TIME; + buf[1] = sizeof(lease_time); + sys_put_be32(lease_time, &buf[2]); + + *buflen -= DHCPV4_OPTIONS_IP_LEASE_TIME_SIZE; + + return buf + DHCPV4_OPTIONS_IP_LEASE_TIME_SIZE; +} + +static uint8_t *dhcpv4_encode_message_type_option(uint8_t *buf, size_t *buflen, + uint8_t msgtype) +{ + if (buf == NULL || *buflen < DHCPV4_OPTIONS_MSG_TYPE_SIZE) { + return NULL; + } + + buf[0] = DHCPV4_OPTIONS_MSG_TYPE; + buf[1] = 1; + buf[2] = msgtype; + + *buflen -= DHCPV4_OPTIONS_MSG_TYPE_SIZE; + + return buf + DHCPV4_OPTIONS_MSG_TYPE_SIZE; +} + +static uint8_t *dhcpv4_encode_server_id_option(uint8_t *buf, size_t *buflen, + struct in_addr *server_id) +{ + if (buf == NULL || *buflen < DHCPV4_OPTIONS_SERVER_ID_SIZE) { + return NULL; + } + + buf[0] = DHCPV4_OPTIONS_SERVER_ID; + buf[1] = sizeof(struct in_addr); + memcpy(&buf[2], server_id->s4_addr, sizeof(struct in_addr)); + + *buflen -= DHCPV4_OPTIONS_SERVER_ID_SIZE; + + return buf + DHCPV4_OPTIONS_SERVER_ID_SIZE; +} + +static uint8_t *dhcpv4_encode_subnet_mask_option(uint8_t *buf, size_t *buflen, + struct in_addr *mask) +{ + if (buf == NULL || *buflen < DHCPV4_OPTIONS_SUBNET_MASK_SIZE) { + return NULL; + } + + buf[0] = DHCPV4_OPTIONS_SUBNET_MASK; + buf[1] = sizeof(struct in_addr); + memcpy(&buf[2], mask->s4_addr, sizeof(struct in_addr)); + + *buflen -= DHCPV4_OPTIONS_SUBNET_MASK_SIZE; + + return buf + DHCPV4_OPTIONS_SUBNET_MASK_SIZE; +} + +static uint8_t *dhcpv4_encode_end_option(uint8_t *buf, size_t *buflen) +{ + if (buf == NULL || *buflen < 1) { + return NULL; + } + + buf[0] = DHCPV4_OPTIONS_END; + + *buflen -= 1; + + return buf + 1; +} + +/* Response handlers. */ + +static uint8_t *dhcpv4_encode_header(uint8_t *buf, size_t *buflen, + struct dhcp_msg *msg, + struct in_addr *yiaddr) +{ + struct dhcp_msg *reply_msg = (struct dhcp_msg *)buf; + + if (buf == NULL || *buflen < sizeof(struct dhcp_msg)) { + return NULL; + } + + reply_msg->op = DHCPV4_MSG_BOOT_REPLY; + reply_msg->htype = msg->htype; + reply_msg->hlen = msg->hlen; + reply_msg->hops = 0; + reply_msg->xid = msg->xid; + reply_msg->secs = 0; + reply_msg->flags = msg->flags; + memcpy(reply_msg->ciaddr, msg->ciaddr, sizeof(reply_msg->ciaddr)); + if (yiaddr != NULL) { + memcpy(reply_msg->yiaddr, yiaddr, sizeof(struct in_addr)); + } else { + memset(reply_msg->yiaddr, 0, sizeof(reply_msg->ciaddr)); + } + memset(reply_msg->siaddr, 0, sizeof(reply_msg->siaddr)); + memcpy(reply_msg->giaddr, msg->giaddr, sizeof(reply_msg->giaddr)); + memcpy(reply_msg->chaddr, msg->chaddr, sizeof(reply_msg->chaddr)); + + *buflen -= sizeof(struct dhcp_msg); + + return buf + sizeof(struct dhcp_msg); +} + +static uint8_t *dhcpv4_encode_string(uint8_t *buf, size_t *buflen, char *str, + size_t max_len) +{ + if (buf == NULL || *buflen < max_len) { + return NULL; + } + + memset(buf, 0, max_len); + + if (str == NULL) { + goto out; + } + + strncpy(buf, str, max_len - 1); + + out: + *buflen -= max_len; + + return buf + max_len; +} + +static uint8_t *dhcpv4_encode_sname(uint8_t *buf, size_t *buflen, char *sname) +{ + return dhcpv4_encode_string(buf, buflen, sname, SIZE_OF_SNAME); +} + +static uint8_t *dhcpv4_encode_file(uint8_t *buf, size_t *buflen, char *file) +{ + return dhcpv4_encode_string(buf, buflen, file, SIZE_OF_FILE); +} + +static uint8_t *dhcpv4_encode_requested_params( + uint8_t *buf, size_t *buflen, + struct dhcpv4_server_ctx *ctx, + struct dhcpv4_parameter_request_list *params) +{ + for (uint8_t i = 0; i < params->count; i++) { + switch (params->list[i]) { + case DHCPV4_OPTIONS_SUBNET_MASK: + buf = dhcpv4_encode_subnet_mask_option( + buf, buflen, &ctx->netmask); + if (buf == NULL) { + goto out; + } + break; + + /* Others - just ignore. */ + default: + break; + } + } + +out: + return buf; +} + +static int dhcpv4_send(struct dhcpv4_server_ctx *ctx, enum net_dhcpv4_msg_type type, + uint8_t *reply, size_t len, struct dhcp_msg *msg, + struct in_addr *yiaddr) +{ + struct sockaddr_in dst_addr = { + .sin_family = AF_INET, + .sin_port = htons(DHCPV4_CLIENT_PORT), + }; + struct in_addr giaddr; /* Relay agent address */ + struct in_addr ciaddr; /* Client address */ + int ret; + + memcpy(&giaddr, msg->giaddr, sizeof(giaddr)); + memcpy(&ciaddr, msg->ciaddr, sizeof(ciaddr)); + + /* Select destination address as described in ch. 4.1. */ + if (!net_ipv4_is_addr_unspecified(&giaddr)) { + /* If the 'giaddr' field in a DHCP message from a client is + * non-zero, the server sends any return messages to the + * 'DHCP server' port on the BOOTP relay agent whose address + * appears in 'giaddr'. + */ + dst_addr.sin_addr = giaddr; + dst_addr.sin_port = htons(DHCPV4_SERVER_PORT); + } else if (type == NET_DHCPV4_MSG_TYPE_NAK) { + /* In all cases, when 'giaddr' is zero, the server broadcasts + * any DHCPNAK messages to 0xffffffff. + */ + dst_addr.sin_addr = *net_ipv4_broadcast_address(); + } else if (!net_ipv4_is_addr_unspecified(&ciaddr)) { + /* If the 'giaddr' field is zero and the 'ciaddr' field is + * nonzero, then the server unicasts DHCPOFFER and DHCPACK + * messages to the address in 'ciaddr'. + */ + dst_addr.sin_addr = ciaddr; + } else if (ntohs(msg->flags) & DHCPV4_MSG_BROADCAST) { + /* If 'giaddr' is zero and 'ciaddr' is zero, and the broadcast + * bit is set, then the server broadcasts DHCPOFFER and DHCPACK + * messages to 0xffffffff. + */ + dst_addr.sin_addr = *net_ipv4_broadcast_address(); + } else if (yiaddr != NULL) { + /* If the broadcast bit is not set and 'giaddr' is zero and + * 'ciaddr' is zero, then the server unicasts DHCPOFFER and + * DHCPACK messages to the client's hardware address and 'yiaddr' + * address. + */ + struct net_eth_addr hwaddr; + + memcpy(&hwaddr, msg->chaddr, sizeof(hwaddr)); + net_arp_update(ctx->iface, yiaddr, &hwaddr, false, true); + dst_addr.sin_addr = *yiaddr; + } else { + NET_ERR("Unspecified destination address."); + return -EDESTADDRREQ; + } + + ret = zsock_sendto(ctx->sock, reply, len, 0, (struct sockaddr *)&dst_addr, + sizeof(dst_addr)); + if (ret < 0) { + return -errno; + } + + return 0; +} + +static int dhcpv4_send_offer(struct dhcpv4_server_ctx *ctx, struct dhcp_msg *msg, + struct in_addr *addr, uint32_t lease_time, + struct dhcpv4_parameter_request_list *params) +{ + uint8_t reply[NET_IPV4_MTU]; + uint8_t *buf = reply; + size_t buflen = sizeof(reply); + size_t reply_len = 0; + int ret; + + buf = dhcpv4_encode_header(buf, &buflen, msg, addr); + buf = dhcpv4_encode_sname(buf, &buflen, NULL); + buf = dhcpv4_encode_file(buf, &buflen, NULL); + buf = dhcpv4_encode_magic_cookie(buf, &buflen); + buf = dhcpv4_encode_ip_lease_time_option(buf, &buflen, lease_time); + buf = dhcpv4_encode_message_type_option(buf, &buflen, + NET_DHCPV4_MSG_TYPE_OFFER); + buf = dhcpv4_encode_server_id_option(buf, &buflen, &ctx->server_addr); + buf = dhcpv4_encode_requested_params(buf, &buflen, ctx, params); + buf = dhcpv4_encode_end_option(buf, &buflen); + + if (buf == NULL) { + LOG_ERR("Failed to encode %s message", "Offer"); + return -ENOMEM; + } + + reply_len = sizeof(reply) - buflen; + + ret = dhcpv4_send(ctx, NET_DHCPV4_MSG_TYPE_OFFER, reply, reply_len, + msg, addr); + if (ret < 0) { + LOG_ERR("Failed to send %s message, %d", "Offer", ret); + return ret; + } + + return 0; +} + +static int dhcpv4_send_ack(struct dhcpv4_server_ctx *ctx, struct dhcp_msg *msg, + struct in_addr *addr, uint32_t lease_time, + struct dhcpv4_parameter_request_list *params, + bool inform) +{ + uint8_t reply[NET_IPV4_MTU]; + uint8_t *buf = reply; + size_t buflen = sizeof(reply); + size_t reply_len = 0; + int ret; + + buf = dhcpv4_encode_header(buf, &buflen, msg, inform ? NULL : addr); + buf = dhcpv4_encode_sname(buf, &buflen, NULL); + buf = dhcpv4_encode_file(buf, &buflen, NULL); + buf = dhcpv4_encode_magic_cookie(buf, &buflen); + if (!inform) { + buf = dhcpv4_encode_ip_lease_time_option(buf, &buflen, lease_time); + } + buf = dhcpv4_encode_message_type_option(buf, &buflen, + NET_DHCPV4_MSG_TYPE_ACK); + buf = dhcpv4_encode_server_id_option(buf, &buflen, &ctx->server_addr); + buf = dhcpv4_encode_requested_params(buf, &buflen, ctx, params); + buf = dhcpv4_encode_end_option(buf, &buflen); + + if (buf == NULL) { + LOG_ERR("Failed to encode %s message", "ACK"); + return -ENOMEM; + } + + reply_len = sizeof(reply) - buflen; + + ret = dhcpv4_send(ctx, NET_DHCPV4_MSG_TYPE_ACK, reply, reply_len, msg, + addr); + if (ret < 0) { + LOG_ERR("Failed to send %s message, %d", "ACK", ret); + return ret; + } + + return 0; +} + +static int dhcpv4_send_nak(struct dhcpv4_server_ctx *ctx, struct dhcp_msg *msg) +{ + uint8_t reply[NET_IPV4_MTU]; + uint8_t *buf = reply; + size_t buflen = sizeof(reply); + size_t reply_len = 0; + int ret; + + buf = dhcpv4_encode_header(buf, &buflen, msg, NULL); + buf = dhcpv4_encode_sname(buf, &buflen, NULL); + buf = dhcpv4_encode_file(buf, &buflen, NULL); + buf = dhcpv4_encode_magic_cookie(buf, &buflen); + buf = dhcpv4_encode_message_type_option(buf, &buflen, + NET_DHCPV4_MSG_TYPE_NAK); + buf = dhcpv4_encode_server_id_option(buf, &buflen, &ctx->server_addr); + buf = dhcpv4_encode_end_option(buf, &buflen); + + if (buf == NULL) { + LOG_ERR("Failed to encode %s message", "NAK"); + return -ENOMEM; + } + + reply_len = sizeof(reply) - buflen; + + ret = dhcpv4_send(ctx, NET_DHCPV4_MSG_TYPE_NAK, reply, reply_len, msg, + NULL); + if (ret < 0) { + LOG_ERR("Failed to send %s message, %d", "NAK", ret); + return ret; + } + + return 0; +} + +/* Message handlers. */ + +static int dhcpv4_get_client_id(struct dhcp_msg *msg, uint8_t *options, + uint8_t optlen, struct dhcpv4_client_id *client_id) +{ + int ret; + + client_id->len = sizeof(client_id->buf); + + ret = dhcpv4_find_client_id_option(options, optlen, client_id->buf, + &client_id->len); + if (ret == 0) { + return 0; + } + + /* No Client Id option or too long to use, fallback to hardware address. */ + if (msg->hlen > sizeof(msg->chaddr)) { + LOG_ERR("Malformed chaddr length."); + return -EINVAL; + } + + client_id->buf[0] = msg->htype; + client_id->buf[1] = msg->hlen; + memcpy(client_id->buf + 2, msg->chaddr, msg->hlen); + client_id->len = msg->hlen + 2; + + return 0; +} + +static uint32_t dhcpv4_get_lease_time(uint8_t *options, uint8_t optlen) +{ + uint32_t lease_time; + + if (dhcpv4_find_ip_lease_time_option(options, optlen, + &lease_time) == 0) { + return lease_time; + } + + return CONFIG_NET_DHCPV4_SERVER_ADDR_LEASE_TIME; +} + +static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, + struct dhcp_msg *msg, uint8_t *options, + uint8_t optlen) +{ + struct dhcpv4_parameter_request_list params = { 0 }; + struct dhcpv4_addr_slot *selected = NULL; + struct dhcpv4_client_id client_id; + int ret; + + ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); + if (ret < 0) { + return; + } + + (void)dhcpv4_find_parameter_request_list_option(options, optlen, ¶ms); + + /* Address pool and address selection algorithm as + * described in 4.3.1 + */ + + /* 1. Check for current bindings */ + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if ((slot->state == DHCPV4_SERVER_ADDR_RESERVED || + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) && + slot->client_id.len == client_id.len && + memcmp(slot->client_id.buf, client_id.buf, + client_id.len) == 0) { + /* Got match in current bindings. */ + selected = slot; + break; + } + } + + /* 2. Skipped, for now expired/released entries are forgotten. */ + + /* 3. Check Requested IP Address option. */ + if (selected == NULL) { + struct in_addr requested_ip; + + ret = dhcpv4_find_requested_ip_option(options, optlen, + &requested_ip); + if (ret == 0) { + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = + &ctx->addr_pool[i]; + + if (net_ipv4_addr_cmp(&slot->addr, + &requested_ip) && + slot->state == DHCPV4_SERVER_ADDR_FREE) { + /* Requested address is free. */ + selected = slot; + break; + } + } + } + } + + /* 4. Allocate new address from pool, if available. */ + if (selected == NULL) { + struct in_addr giaddr; + + memcpy(&giaddr, msg->giaddr, sizeof(giaddr)); + if (!net_ipv4_is_addr_unspecified(&giaddr)) { + /* Only addresses in local subnet supproted for now. */ + return; + } + + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (slot->state == DHCPV4_SERVER_ADDR_FREE) { + /* Requested address is free. */ + selected = slot; + break; + } + } + } + + if (selected == NULL) { + LOG_ERR("No free address found in address pool"); + } else { + uint32_t lease_time = dhcpv4_get_lease_time(options, optlen); + + if (dhcpv4_send_offer(ctx, msg, &selected->addr, lease_time, + ¶ms) < 0) { + return; + } + + LOG_DBG("DHCPv4 processing Discover - reserved %s", + net_sprint_ipv4_addr(&selected->addr)); + + selected->state = DHCPV4_SERVER_ADDR_RESERVED; + selected->client_id.len = client_id.len; + memcpy(selected->client_id.buf, client_id.buf, client_id.len); + selected->lease_time = lease_time; + selected->expiry = sys_timepoint_calc(ADDRESS_RESERVED_TIMEOUT); + dhcpv4_server_timeout_recalc(ctx); + } +} + +static void dhcpv4_handle_request(struct dhcpv4_server_ctx *ctx, + struct dhcp_msg *msg, uint8_t *options, + uint8_t optlen) +{ + struct dhcpv4_parameter_request_list params = { 0 }; + struct dhcpv4_addr_slot *selected = NULL; + struct dhcpv4_client_id client_id; + struct in_addr requested_ip, server_id, ciaddr, giaddr; + int ret; + + memcpy(&ciaddr, msg->ciaddr, sizeof(ciaddr)); + memcpy(&giaddr, msg->giaddr, sizeof(giaddr)); + + if (!net_ipv4_is_addr_unspecified(&giaddr)) { + /* Only addresses in local subnet supported for now. */ + return; + } + + ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); + if (ret < 0) { + /* Failed to obtain Client ID, ignore. */ + return; + } + + (void)dhcpv4_find_parameter_request_list_option(options, optlen, ¶ms); + + ret = dhcpv4_find_server_id_option(options, optlen, &server_id); + if (ret == 0) { + /* Server ID present, Request generated during SELECTING. */ + if (!net_ipv4_addr_cmp(&ctx->server_addr, &server_id)) { + /* Not for us, ignore. */ + return; + } + + ret = dhcpv4_find_requested_ip_option(options, optlen, + &requested_ip); + if (ret < 0) { + /* Requested IP missing, ignore. */ + return; + } + + if (!net_ipv4_is_addr_unspecified(&ciaddr)) { + /* ciaddr MUST be zero */ + return; + } + + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (net_ipv4_addr_cmp(&slot->addr, &requested_ip) && + slot->client_id.len == client_id.len && + memcmp(slot->client_id.buf, client_id.buf, + client_id.len) == 0 && + slot->state == DHCPV4_SERVER_ADDR_RESERVED) { + selected = slot; + break; + } + } + + if (selected == NULL) { + LOG_ERR("No valid slot found for DHCPv4 Request"); + } else { + uint32_t lease_time = dhcpv4_get_lease_time(options, optlen); + + if (dhcpv4_send_ack(ctx, msg, &selected->addr, lease_time, + ¶ms, false) < 0) { + return; + } + + LOG_DBG("DHCPv4 processing Request - allocated %s", + net_sprint_ipv4_addr(&selected->addr)); + + selected->lease_time = lease_time; + selected->expiry = sys_timepoint_calc( + K_SECONDS(lease_time)); + selected->state = DHCPV4_SERVER_ADDR_ALLOCATED; + dhcpv4_server_timeout_recalc(ctx); + } + + return; + } + + /* No server ID option - check requested address. */ + ret = dhcpv4_find_requested_ip_option(options, optlen, &requested_ip); + if (ret == 0) { + /* Requested IP present, Request generated during INIT-REBOOT. */ + if (!net_ipv4_is_addr_unspecified(&ciaddr)) { + /* ciaddr MUST be zero */ + return; + } + + if (!net_if_ipv4_addr_mask_cmp(ctx->iface, &requested_ip)) { + /* Wrong subnet. */ + dhcpv4_send_nak(ctx, msg); + } + + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (slot->client_id.len == client_id.len && + memcmp(slot->client_id.buf, client_id.buf, + client_id.len) == 0 && + (slot->state == DHCPV4_SERVER_ADDR_RESERVED || + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED)) { + selected = slot; + break; + } + } + + if (selected != NULL) { + if (net_ipv4_addr_cmp(&selected->addr, &requested_ip)) { + uint32_t lease_time = dhcpv4_get_lease_time( + options, optlen); + + if (dhcpv4_send_ack(ctx, msg, &selected->addr, + lease_time, ¶ms, + false) < 0) { + return; + } + + selected->lease_time = lease_time; + selected->expiry = sys_timepoint_calc( + K_SECONDS(lease_time)); + dhcpv4_server_timeout_recalc(ctx); + } else { + dhcpv4_send_nak(ctx, msg); + } + } + + /* No notion of the client, remain silent. */ + return; + } + + /* Neither server ID or requested IP set, Request generated during + * RENEWING or REBINDING. + */ + + if (!net_if_ipv4_addr_mask_cmp(ctx->iface, &ciaddr)) { + /* Wrong subnet. */ + dhcpv4_send_nak(ctx, msg); + } + + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (net_ipv4_addr_cmp(&slot->addr, &ciaddr)) { + selected = slot; + break; + } + } + + if (selected != NULL) { + if (selected->state == DHCPV4_SERVER_ADDR_ALLOCATED && + selected->client_id.len == client_id.len && + memcmp(selected->client_id.buf, client_id.buf, + client_id.len) == 0) { + uint32_t lease_time = dhcpv4_get_lease_time( + options, optlen); + + if (dhcpv4_send_ack(ctx, msg, &ciaddr, lease_time, + ¶ms, false) < 0) { + return; + } + + selected->lease_time = lease_time; + selected->expiry = sys_timepoint_calc( + K_SECONDS(lease_time)); + dhcpv4_server_timeout_recalc(ctx); + } else { + dhcpv4_send_nak(ctx, msg); + } + } +} + +static void dhcpv4_handle_decline(struct dhcpv4_server_ctx *ctx, + struct dhcp_msg *msg, uint8_t *options, + uint8_t optlen) +{ + struct dhcpv4_client_id client_id; + struct in_addr requested_ip, server_id; + int ret; + + ret = dhcpv4_find_server_id_option(options, optlen, &server_id); + if (ret < 0) { + /* No server ID, ignore. */ + return; + } + + if (!net_ipv4_addr_cmp(&ctx->server_addr, &server_id)) { + /* Not for us, ignore. */ + return; + } + + ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); + if (ret < 0) { + /* Failed to obtain Client ID, ignore. */ + return; + } + + ret = dhcpv4_find_requested_ip_option(options, optlen, + &requested_ip); + if (ret < 0) { + /* Requested IP missing, ignore. */ + return; + } + + LOG_ERR("Received DHCPv4 Decline for %s (address already in use)", + net_sprint_ipv4_addr(&requested_ip)); + + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (net_ipv4_addr_cmp(&slot->addr, &requested_ip) && + slot->client_id.len == client_id.len && + memcmp(slot->client_id.buf, client_id.buf, + client_id.len) == 0 && + (slot->state == DHCPV4_SERVER_ADDR_RESERVED || + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED)) { + slot->state = DHCPV4_SERVER_ADDR_DECLINED; + slot->expiry = sys_timepoint_calc(K_FOREVER); + dhcpv4_server_timeout_recalc(ctx); + break; + } + } +} + +static void dhcpv4_handle_release(struct dhcpv4_server_ctx *ctx, + struct dhcp_msg *msg, uint8_t *options, + uint8_t optlen) +{ + struct dhcpv4_client_id client_id; + struct in_addr ciaddr, server_id; + int ret; + + ret = dhcpv4_find_server_id_option(options, optlen, &server_id); + if (ret < 0) { + /* No server ID, ignore. */ + return; + } + + if (!net_ipv4_addr_cmp(&ctx->server_addr, &server_id)) { + /* Not for us, ignore. */ + return; + } + + ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); + if (ret < 0) { + /* Failed to obtain Client ID, ignore. */ + return; + } + + memcpy(&ciaddr, msg->ciaddr, sizeof(ciaddr)); + + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (net_ipv4_addr_cmp(&slot->addr, &ciaddr) && + slot->client_id.len == client_id.len && + memcmp(slot->client_id.buf, client_id.buf, + client_id.len) == 0 && + (slot->state == DHCPV4_SERVER_ADDR_RESERVED || + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED)) { + LOG_DBG("DHCPv4 processing Release - %s", + net_sprint_ipv4_addr(&slot->addr)); + + slot->state = DHCPV4_SERVER_ADDR_FREE; + slot->expiry = sys_timepoint_calc(K_FOREVER); + dhcpv4_server_timeout_recalc(ctx); + break; + } + } +} + +static void dhcpv4_handle_inform(struct dhcpv4_server_ctx *ctx, + struct dhcp_msg *msg, uint8_t *options, + uint8_t optlen) +{ + struct dhcpv4_parameter_request_list params = { 0 }; + + (void)dhcpv4_find_parameter_request_list_option(options, optlen, ¶ms); + (void)dhcpv4_send_ack(ctx, msg, (struct in_addr *)msg->ciaddr, 0, + ¶ms, true); +} + +/* Server core. */ + +static void dhcpv4_server_timeout(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct dhcpv4_server_ctx *ctx = + CONTAINER_OF(dwork, struct dhcpv4_server_ctx, timeout_work); + + + k_mutex_lock(&server_lock, K_FOREVER); + + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (slot->state == DHCPV4_SERVER_ADDR_RESERVED || + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) { + if (sys_timepoint_expired(slot->expiry)) { + LOG_DBG("Address %s expired", + net_sprint_ipv4_addr(&slot->addr)); + slot->state = DHCPV4_SERVER_ADDR_FREE; + } + } + } + + dhcpv4_server_timeout_recalc(ctx); + + k_mutex_unlock(&server_lock); +} + +static void dhcpv4_process_data(struct dhcpv4_server_ctx *ctx, uint8_t *data, + size_t datalen) +{ + struct dhcp_msg *msg; + uint8_t msgtype; + int ret; + + if (datalen < sizeof(struct dhcp_msg)) { + LOG_DBG("DHCPv4 server malformed message"); + return; + } + + msg = (struct dhcp_msg *)data; + + if (msg->op != DHCPV4_MSG_BOOT_REQUEST) { + /* Silently drop messages other than BOOTREQUEST */ + return; + } + + data += sizeof(struct dhcp_msg); + datalen -= sizeof(struct dhcp_msg); + + /* Skip server hostname/filename/option cookie */ + if (datalen < (SIZE_OF_SNAME + SIZE_OF_FILE + SIZE_OF_MAGIC_COOKIE)) { + return; + } + + data += SIZE_OF_SNAME + SIZE_OF_FILE + SIZE_OF_MAGIC_COOKIE; + datalen -= SIZE_OF_SNAME + SIZE_OF_FILE + SIZE_OF_MAGIC_COOKIE; + + /* Search options for DHCP message type. */ + ret = dhcpv4_find_message_type_option(data, datalen, &msgtype); + if (ret < 0) { + LOG_ERR("No message type option"); + return; + } + + k_mutex_lock(&server_lock, K_FOREVER); + + switch (msgtype) { + case NET_DHCPV4_MSG_TYPE_DISCOVER: + dhcpv4_handle_discover(ctx, msg, data, datalen); + break; + case NET_DHCPV4_MSG_TYPE_REQUEST: + dhcpv4_handle_request(ctx, msg, data, datalen); + break; + case NET_DHCPV4_MSG_TYPE_DECLINE: + dhcpv4_handle_decline(ctx, msg, data, datalen); + break; + case NET_DHCPV4_MSG_TYPE_RELEASE: + dhcpv4_handle_release(ctx, msg, data, datalen); + break; + case NET_DHCPV4_MSG_TYPE_INFORM: + dhcpv4_handle_inform(ctx, msg, data, datalen); + break; + + case NET_DHCPV4_MSG_TYPE_OFFER: + case NET_DHCPV4_MSG_TYPE_ACK: + case NET_DHCPV4_MSG_TYPE_NAK: + default: + /* Ignore server initiated and unknown message types. */ + break; + } + + k_mutex_unlock(&server_lock); +} + +static void dhcpv4_server_cb(struct k_work *work) +{ + 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; + + for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { + if (server_ctx[i].sock == evt->event.fd) { + ctx = &server_ctx[i]; + break; + } + } + + if (ctx == NULL) { + LOG_ERR("No DHCPv4 server context found for given FD."); + return; + } + + if (evt->event.revents & ZSOCK_POLLERR) { + LOG_ERR("DHCPv4 server poll revents error"); + net_dhcpv4_server_stop(ctx->iface); + return; + } + + if (!(evt->event.revents & ZSOCK_POLLIN)) { + return; + } + + ret = zsock_recvfrom(evt->event.fd, recv_buf, sizeof(recv_buf), + ZSOCK_MSG_DONTWAIT, NULL, 0); + if (ret < 0) { + if (errno == EAGAIN) { + return; + } + + LOG_ERR("DHCPv4 server recv error, %d", errno); + net_dhcpv4_server_stop(ctx->iface); + return; + } + + dhcpv4_process_data(ctx, recv_buf, ret); +} + +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(dhcpv4_server, NULL, dhcpv4_server_cb, + CONFIG_NET_DHCPV4_SERVER_INSTANCES); + +int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr) +{ + struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_addr = INADDR_ANY_INIT, + .sin_port = htons(DHCPV4_SERVER_PORT), + }; + struct ifreq ifreq = { 0 }; + int ret, sock = -1, slot = -1; + const struct in_addr *server_addr; + struct in_addr netmask; + + if (iface == NULL || base_addr == NULL) { + return -EINVAL; + } + + if (!net_if_ipv4_addr_mask_cmp(iface, base_addr)) { + LOG_ERR("Address pool does not belong to the interface subnet."); + return -EINVAL; + } + + server_addr = net_if_ipv4_select_src_addr(iface, base_addr); + if (server_addr == NULL) { + LOG_ERR("Failed to obtain a valid server address."); + return -EINVAL; + } + + netmask = net_if_ipv4_get_netmask(iface); + if (net_ipv4_is_addr_unspecified(&netmask)) { + LOG_ERR("Failed to obtain subnet mask."); + return -EINVAL; + } + + k_mutex_lock(&server_lock, K_FOREVER); + + for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { + if (server_ctx[i].iface != NULL) { + if (server_ctx[i].iface == iface) { + LOG_ERR("DHCPv4 server instance already running."); + ret = -EALREADY; + goto error; + } + } else { + if (slot < 0) { + slot = i; + } + } + } + + if (slot < 0) { + LOG_ERR("No free DHCPv4 server intance."); + ret = -ENOMEM; + goto error; + } + + ret = net_if_get_name(iface, ifreq.ifr_name, sizeof(ifreq.ifr_name)); + if (ret < 0) { + LOG_ERR("Failed to obtain interface name."); + goto error; + } + + sock = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (sock < 0) { + ret = errno; + LOG_ERR("Failed to create DHCPv4 server socket, %d", ret); + goto error; + } + + ret = zsock_setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, &ifreq, + sizeof(ifreq)); + if (ret < 0) { + ret = errno; + LOG_ERR("Failed to bind DHCPv4 server socket with interface, %d", + ret); + goto error; + } + + ret = zsock_bind(sock, (struct sockaddr *)&addr, sizeof(addr)); + if (ret < 0) { + ret = errno; + LOG_ERR("Failed to bind DHCPv4 server socket, %d", ret); + goto error; + } + + fds[slot].fd = sock; + fds[slot].events = ZSOCK_POLLIN; + + server_ctx[slot].iface = iface; + server_ctx[slot].sock = sock; + server_ctx[slot].server_addr = *server_addr; + server_ctx[slot].netmask = netmask; + + k_work_init_delayable(&server_ctx[slot].timeout_work, + dhcpv4_server_timeout); + + LOG_DBG("Started DHCPv4 server, address pool:"); + for (int i = 0; i < ARRAY_SIZE(server_ctx[slot].addr_pool); i++) { + server_ctx[slot].addr_pool[i].state = DHCPV4_SERVER_ADDR_FREE; + server_ctx[slot].addr_pool[i].addr.s_addr = + htonl(ntohl(base_addr->s_addr) + i); + + LOG_DBG("\t%2d: %s", i, + net_sprint_ipv4_addr( + &server_ctx[slot].addr_pool[i].addr)); + } + + ret = net_socket_service_register(&dhcpv4_server, fds, ARRAY_SIZE(fds), + NULL); + if (ret < 0) { + LOG_ERR("Failed to register socket service, %d", ret); + memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); + fds[slot].fd = -1; + goto error; + } + + k_mutex_unlock(&server_lock); + + return 0; + +error: + if (sock >= 0) { + (void)zsock_close(sock); + } + + k_mutex_unlock(&server_lock); + + return ret; +} + +int net_dhcpv4_server_stop(struct net_if *iface) +{ + struct k_work_sync sync; + int slot = -1; + int ret = 0; + bool service_stop = true; + + if (iface == NULL) { + return -EINVAL; + } + + k_mutex_lock(&server_lock, K_FOREVER); + + for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { + if (server_ctx[i].iface == iface) { + slot = i; + break; + } + } + + if (slot < 0) { + ret = -ENOENT; + goto out; + } + + fds[slot].fd = -1; + (void)zsock_close(server_ctx[slot].sock); + + k_work_cancel_delayable_sync(&server_ctx[slot].timeout_work, &sync); + + memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); + + for (int i = 0; i < ARRAY_SIZE(fds); i++) { + if (fds[i].fd >= 0) { + service_stop = false; + break; + } + } + + if (service_stop) { + ret = net_socket_service_unregister(&dhcpv4_server); + } else { + ret = net_socket_service_register(&dhcpv4_server, fds, + ARRAY_SIZE(fds), NULL); + } + +out: + k_mutex_unlock(&server_lock); + + return ret; +} + +static void dhcpv4_server_foreach_lease_on_ctx(struct dhcpv4_server_ctx *ctx, + net_dhcpv4_lease_cb_t cb, + void *user_data) +{ + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *addr = &ctx->addr_pool[i]; + + if (addr->state != DHCPV4_SERVER_ADDR_FREE) { + cb(ctx->iface, addr, user_data); + } + } +} + +int net_dhcpv4_server_foreach_lease(struct net_if *iface, + net_dhcpv4_lease_cb_t cb, + void *user_data) +{ + int slot = -1; + int ret = 0; + + k_mutex_lock(&server_lock, K_FOREVER); + + if (iface == NULL) { + for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { + if (server_ctx[i].iface != NULL) { + dhcpv4_server_foreach_lease_on_ctx( + &server_ctx[i], cb, user_data); + } + } + + return 0; + } + + for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { + if (server_ctx[i].iface == iface) { + slot = i; + break; + } + } + + if (slot < 0) { + ret = -ENOENT; + goto out; + } + + dhcpv4_server_foreach_lease_on_ctx(&server_ctx[slot], cb, user_data); + +out: + k_mutex_unlock(&server_lock); + + return ret; +} + +void net_dhcpv4_server_init(void) +{ + for (int i = 0; i < ARRAY_SIZE(fds); i++) { + fds[i].fd = -1; + } +} From e707475bbfbbdc6c2a6b88b98db54a46b38ac221 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 16 Jan 2024 17:38:40 +0100 Subject: [PATCH 0192/2300] [nrf fromtree] net: socket_services: Increase default stack size for DHCPv4 server Increase socket services thread default stack size when DHCPv4 server is enabled, as it uses synchronous processing. Signed-off-by: Robert Lubos (cherry picked from commit 3bc50871bccb7a4ff9c03c845ac9a4a2208a0d12) (cherry picked from commit 7a0cbb67886c736bdf31f87246a5a626765087b3) --- subsys/net/lib/sockets/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 40d86b9498f..35750dd3583 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -88,6 +88,7 @@ config NET_SOCKETS_SERVICE config NET_SOCKETS_SERVICE_STACK_SIZE int "Stack size for the thread handling socket services" + default 2400 if NET_DHCPV4_SERVER default 1200 depends on NET_SOCKETS_SERVICE help From 1a61ddeef64be45e7eaba5eb12fb0f88a410e935 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 16 Jan 2024 17:38:23 +0100 Subject: [PATCH 0193/2300] [nrf fromtree] net: shell: Implement DHCPv4 server shell commands Implement DHCPv4 shell module, which allows to start/stop DHCPv4 server operation, and print server status (address leases). Signed-off-by: Robert Lubos (cherry picked from commit 2c70c5d74adb250420506d8a7f2aa40631a24916) (cherry picked from commit d97e4bc99ec6a3bbd96ebfa4a16b2a3a7efcf94f) --- subsys/net/lib/shell/CMakeLists.txt | 1 + subsys/net/lib/shell/dhcpv4.c | 215 ++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 subsys/net/lib/shell/dhcpv4.c diff --git a/subsys/net/lib/shell/CMakeLists.txt b/subsys/net/lib/shell/CMakeLists.txt index 2c5c0757505..5cfb5c269b4 100644 --- a/subsys/net/lib/shell/CMakeLists.txt +++ b/subsys/net/lib/shell/CMakeLists.txt @@ -10,6 +10,7 @@ zephyr_library_sources(allocs.c) zephyr_library_sources(arp.c) zephyr_library_sources(capture.c) zephyr_library_sources(conn.c) +zephyr_library_sources(dhcpv4.c) zephyr_library_sources(dns.c) zephyr_library_sources(events.c) zephyr_library_sources(gptp.c) diff --git a/subsys/net/lib/shell/dhcpv4.c b/subsys/net/lib/shell/dhcpv4.c new file mode 100644 index 00000000000..a59b9c45edb --- /dev/null +++ b/subsys/net/lib/shell/dhcpv4.c @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_DECLARE(net_shell); + +#include +#include +#include + +#include "net_shell_private.h" + +static int cmd_net_dhcpv4_server_start(const struct shell *sh, size_t argc, char *argv[]) +{ +#if defined(CONFIG_NET_DHCPV4_SERVER) + struct net_if *iface = NULL; + struct in_addr base_addr; + int idx, ret; + + idx = get_iface_idx(sh, argv[1]); + if (idx < 0) { + return -ENOEXEC; + } + + iface = net_if_get_by_index(idx); + if (!iface) { + PR_WARNING("No such interface in index %d\n", idx); + return -ENOEXEC; + } + + if (net_addr_pton(AF_INET, argv[2], &base_addr)) { + PR_ERROR("Invalid address: %s\n", argv[2]); + return -EINVAL; + } + + ret = net_dhcpv4_server_start(iface, &base_addr); + if (ret == -EALREADY) { + PR_WARNING("DHCPv4 server already running on interface %d\n", idx); + } else if (ret < 0) { + PR_ERROR("DHCPv4 server failed to start on interface %d, error %d\n", + idx, -ret); + } else { + PR("DHCPv4 server started on interface %d\n", idx); + } +#else /* CONFIG_NET_DHCPV4_SERVER */ + PR_INFO("Set %s to enable %s support.\n", + "CONFIG_NET_DHCPV4_SERVER", "DHCPv4 server"); +#endif /* CONFIG_NET_DHCPV4_SERVER */ + return 0; +} + +static int cmd_net_dhcpv4_server_stop(const struct shell *sh, size_t argc, char *argv[]) +{ +#if defined(CONFIG_NET_DHCPV4_SERVER) + struct net_if *iface = NULL; + int idx, ret; + + idx = get_iface_idx(sh, argv[1]); + if (idx < 0) { + return -ENOEXEC; + } + + iface = net_if_get_by_index(idx); + if (!iface) { + PR_WARNING("No such interface in index %d\n", idx); + return -ENOEXEC; + } + + ret = net_dhcpv4_server_stop(iface); + if (ret == -ENOENT) { + PR_WARNING("DHCPv4 server is not running on interface %d\n", idx); + } else if (ret < 0) { + PR_ERROR("DHCPv4 server failed to stop on interface %d, error %d\n", + idx, -ret); + } else { + PR("DHCPv4 server stopped on interface %d\n", idx); + } +#else /* CONFIG_NET_DHCPV4_SERVER */ + PR_INFO("Set %s to enable %s support.\n", + "CONFIG_NET_DHCPV4_SERVER", "DHCPv4 server"); +#endif /* CONFIG_NET_DHCPV4_SERVER */ + return 0; +} + +#if defined(CONFIG_NET_DHCPV4_SERVER) +static const char *dhcpv4_addr_state_to_str(enum dhcpv4_server_addr_state state) +{ + switch (state) { + case DHCPV4_SERVER_ADDR_FREE: + return "FREE"; + case DHCPV4_SERVER_ADDR_RESERVED: + return "RESERVED"; + case DHCPV4_SERVER_ADDR_ALLOCATED: + return "ALLOCATED"; + case DHCPV4_SERVER_ADDR_DECLINED: + return "DECLINED"; + } + + return ""; +} + +static uint32_t timepoint_to_s(k_timepoint_t timepoint) +{ + k_timeout_t timeout = sys_timepoint_timeout(timepoint); + + if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { + return 0; + } + + if (K_TIMEOUT_EQ(timeout, K_FOREVER)) { + return UINT32_MAX; + } + + return k_ticks_to_ms_floor64(timeout.ticks) / 1000; +} + +static void dhcpv4_lease_cb(struct net_if *iface, + struct dhcpv4_addr_slot *lease, + void *user_data) +{ + struct net_shell_user_data *data = user_data; + const struct shell *sh = data->sh; + int *count = data->user_data; + char expiry_str[] = "4294967295"; /* Lease time is uint32_t, so take + * theoretical max. + */ + char iface_name[IFNAMSIZ] = ""; + + if (*count == 0) { + PR(" Iface Address\t State\tExpiry (sec)\n"); + } + + (*count)++; + + (void)net_if_get_name(iface, iface_name, sizeof(iface_name)); + + if (lease->state == DHCPV4_SERVER_ADDR_DECLINED) { + snprintk(expiry_str, sizeof(expiry_str) - 1, "infinite"); + } else { + snprintk(expiry_str, sizeof(expiry_str) - 1, "%u", + timepoint_to_s(lease->expiry)); + } + + PR("%2d. %6s %15s\t%9s\t%12s\n", + *count, iface_name, net_sprint_ipv4_addr(&lease->addr), + dhcpv4_addr_state_to_str(lease->state), expiry_str); +} +#endif /* CONFIG_NET_DHCPV4_SERVER */ + +static int cmd_net_dhcpv4_server_status(const struct shell *sh, size_t argc, char *argv[]) +{ +#if defined(CONFIG_NET_DHCPV4_SERVER) + struct net_shell_user_data user_data; + struct net_if *iface = NULL; + int idx = 0, ret; + int count = 0; + + if (argc > 1) { + idx = get_iface_idx(sh, argv[1]); + if (idx < 0) { + return -ENOEXEC; + } + + iface = net_if_get_by_index(idx); + if (!iface) { + PR_WARNING("No such interface in index %d\n", idx); + return -ENOEXEC; + } + } + + user_data.sh = sh; + user_data.user_data = &count; + + ret = net_dhcpv4_server_foreach_lease(iface, dhcpv4_lease_cb, &user_data); + if (ret == -ENOENT) { + PR_WARNING("DHCPv4 server is not running on interface %d\n", idx); + } else if (count == 0) { + PR("DHCPv4 server - no addresses assigned\n"); + } +#else /* CONFIG_NET_DHCPV4_SERVER */ + PR_INFO("Set %s to enable %s support.\n", + "CONFIG_NET_DHCPV4_SERVER", "DHCPv4 server"); +#endif /* CONFIG_NET_DHCPV4_SERVER */ + return 0; +} + +SHELL_STATIC_SUBCMD_SET_CREATE(net_cmd_dhcpv4_server, + SHELL_CMD_ARG(start, NULL, "Start the DHCPv4 server operation on the interface.\n" + "'net dhcpv4 server start '\n" + " is the network interface index.\n" + " is the first address for the address pool.", + cmd_net_dhcpv4_server_start, 3, 0), + SHELL_CMD_ARG(stop, NULL, "Stop the DHCPv4 server operation on the interface.\n" + "'net dhcpv4 server stop '\n" + " is the network interface index.", + cmd_net_dhcpv4_server_stop, 2, 0), + SHELL_CMD_ARG(status, NULL, "Print the DHCPv4 server status on the interface.\n" + "'net dhcpv4 server status '\n" + " is the network interface index. Optional.", + cmd_net_dhcpv4_server_status, 1, 1), + SHELL_SUBCMD_SET_END +); + +SHELL_STATIC_SUBCMD_SET_CREATE(net_cmd_dhcpv4, + SHELL_CMD(server, &net_cmd_dhcpv4_server, + "DHCPv4 server service management.", + NULL), + SHELL_SUBCMD_SET_END +); + +SHELL_SUBCMD_ADD((net), dhcpv4, &net_cmd_dhcpv4, "Manage DHPCv4 services.", + NULL, 1, 0); From c8c1661aa423e9e173bb9ff1eca1c978c8ca70e6 Mon Sep 17 00:00:00 2001 From: Kamil Piszczek Date: Fri, 12 Jan 2024 11:30:21 +0100 Subject: [PATCH 0194/2300] [nrf fromtree] bluetooth: gatt: add authorization callback API for gatt operations Added the GATT authorization callback API that allows the user to define application-specific authorization logic for GATT operations. Signed-off-by: Kamil Piszczek (cherry picked from commit 6852abf521ba3a56c2aa9fa21040d9341adb84bd) (cherry picked from commit e537e00b1bc1325945dc9d29df13100d6ba2280a) --- include/zephyr/bluetooth/gatt.h | 51 ++++++++++++++++++ subsys/bluetooth/host/Kconfig.gatt | 9 ++++ subsys/bluetooth/host/att.c | 83 ++++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+) diff --git a/include/zephyr/bluetooth/gatt.h b/include/zephyr/bluetooth/gatt.h index c53422648f0..eb38f765afb 100644 --- a/include/zephyr/bluetooth/gatt.h +++ b/include/zephyr/bluetooth/gatt.h @@ -235,6 +235,37 @@ struct bt_gatt_cb { sys_snode_t node; }; +/** @brief GATT authorization callback structure. */ +struct bt_gatt_authorization_cb { + /** @brief Authorize the GATT read operation. + * + * This callback allows the application to authorize the GATT + * read operation for the attribute that is being read. + * + * @param conn Connection object. + * @param attr The attribute that is being read. + * + * @retval true Authorize the operation and allow it to execute. + * @retval false Reject the operation and prevent it from executing. + */ + bool (*read_operation_authorize)(struct bt_conn *conn, + const struct bt_gatt_attr *attr); + + /** @brief Authorize the GATT write operation. + * + * This callback allows the application to authorize the GATT + * write operation for the attribute that is being written. + * + * @param conn Connection object. + * @param attr The attribute that is being written. + * + * @retval true Authorize the operation and allow it to execute. + * @retval false Reject the operation and prevent it from executing. + */ + bool (*write_operation_authorize)(struct bt_conn *conn, + const struct bt_gatt_attr *attr); +}; + /** Characteristic Properties Bit field values */ /** @@ -377,6 +408,26 @@ struct bt_gatt_cpf { */ void bt_gatt_cb_register(struct bt_gatt_cb *cb); +/** @brief Register GATT authorization callbacks. + * + * Register callbacks to perform application-specific authorization of GATT + * operations on all registered GATT attributes. The callback structure must + * remain valid throughout the entire duration of the Bluetooth subsys + * activity. + * + * The @kconfig{CONFIG_BT_GATT_AUTHORIZATION_CUSTOM} Kconfig must be enabled + * to make this API functional. + * + * This API allows the user to register only one callback structure + * concurrently. Passing NULL unregisters the previous set of callbacks + * and makes it possible to register a new one. + * + * @param cb Callback struct. + * + * @return Zero on success or negative error code otherwise + */ +int bt_gatt_authorization_cb_register(const struct bt_gatt_authorization_cb *cb); + /** @brief Register GATT service. * * Register GATT service. Applications can make use of diff --git a/subsys/bluetooth/host/Kconfig.gatt b/subsys/bluetooth/host/Kconfig.gatt index 9209368f943..a2364bbe557 100644 --- a/subsys/bluetooth/host/Kconfig.gatt +++ b/subsys/bluetooth/host/Kconfig.gatt @@ -276,4 +276,13 @@ config DEVICE_NAME_GATT_WRITABLE_AUTHEN endif #BT_DEVICE_NAME_GATT_WRITABLE +config BT_GATT_AUTHORIZATION_CUSTOM + bool "Custom authorization of GATT operations [EXPERIMENTAL]" + select EXPERIMENTAL + help + This option allows the user to define application-specific + authorization logic for GATT operations that can be registered + with the bt_gatt_authorization_cb_register API. See the API + documentation for more details. + endmenu diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 130b4ab0853..44862f5bf25 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -115,6 +115,11 @@ static uint16_t bt_att_mtu(struct bt_att_chan *chan) return MIN(chan->chan.rx.mtu, chan->chan.tx.mtu); } +/* Descriptor of application-specific authorization callbacks that are used + * with the CONFIG_BT_GATT_AUTHORIZATION_CUSTOM Kconfig enabled. + */ +const static struct bt_gatt_authorization_cb *authorization_cb; + /* ATT connection specific data */ struct bt_att { struct bt_conn *conn; @@ -1289,6 +1294,20 @@ struct read_type_data { typedef bool (*attr_read_cb)(struct net_buf *buf, ssize_t read, void *user_data); +static bool attr_read_authorize(struct bt_conn *conn, + const struct bt_gatt_attr *attr) +{ + if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { + return true; + } + + if (!authorization_cb || !authorization_cb->read_operation_authorize) { + return true; + } + + return authorization_cb->read_operation_authorize(conn, attr); +} + static bool attr_read_type_cb(struct net_buf *frag, ssize_t read, void *user_data) { @@ -1398,6 +1417,12 @@ static uint8_t read_type_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } + /* Check the attribute authorization logic */ + if (!attr_read_authorize(conn, attr)) { + data->err = BT_ATT_ERR_AUTHORIZATION; + return BT_GATT_ITER_STOP; + } + /* * If any attribute is founded in handle range it means that error * should be changed from pre-set: attr not found error to no error. @@ -1526,6 +1551,12 @@ static uint8_t read_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } + /* Check the attribute authorization logic */ + if (!attr_read_authorize(conn, attr)) { + data->err = BT_ATT_ERR_AUTHORIZATION; + return BT_GATT_ITER_STOP; + } + /* Read attribute value and store in the buffer */ ret = att_chan_read(chan, attr, data->buf, data->offset, NULL, NULL); if (ret < 0) { @@ -1693,6 +1724,12 @@ static uint8_t read_vl_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } + /* Check the attribute authorization logic */ + if (!attr_read_authorize(conn, attr)) { + data->err = BT_ATT_ERR_AUTHORIZATION; + return BT_GATT_ITER_STOP; + } + /* The Length Value Tuple List may be truncated within the first two * octets of a tuple due to the size limits of the current ATT_MTU. */ @@ -1940,6 +1977,20 @@ struct write_data { uint8_t err; }; +static bool attr_write_authorize(struct bt_conn *conn, + const struct bt_gatt_attr *attr) +{ + if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { + return true; + } + + if (!authorization_cb || !authorization_cb->write_operation_authorize) { + return true; + } + + return authorization_cb->write_operation_authorize(conn, attr); +} + static uint8_t write_cb(const struct bt_gatt_attr *attr, uint16_t handle, void *user_data) { @@ -1956,6 +2007,12 @@ static uint8_t write_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } + /* Check the attribute authorization logic */ + if (!attr_write_authorize(data->conn, attr)) { + data->err = BT_ATT_ERR_AUTHORIZATION; + return BT_GATT_ITER_STOP; + } + /* Set command flag if not a request */ if (!data->req) { flags |= BT_GATT_WRITE_FLAG_CMD; @@ -2069,6 +2126,12 @@ static uint8_t prep_write_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } + /* Check the attribute authorization logic */ + if (!attr_write_authorize(data->conn, attr)) { + data->err = BT_ATT_ERR_AUTHORIZATION; + return BT_GATT_ITER_STOP; + } + /* Check if attribute requires handler to accept the data */ if (!(attr->perm & BT_GATT_PERM_PREPARE_WRITE)) { goto append; @@ -3997,3 +4060,23 @@ bool bt_att_chan_opt_valid(struct bt_conn *conn, enum bt_att_chan_opt chan_opt) return true; } + +int bt_gatt_authorization_cb_register(const struct bt_gatt_authorization_cb *cb) +{ + if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { + return -ENOSYS; + } + + if (!cb) { + authorization_cb = NULL; + return 0; + } + + if (authorization_cb) { + return -EALREADY; + } + + authorization_cb = cb; + + return 0; +} From 3f97d3e782d5ff3e42aa9d8d8fe043eb8ba1e8d2 Mon Sep 17 00:00:00 2001 From: Kamil Piszczek Date: Tue, 16 Jan 2024 13:11:57 +0100 Subject: [PATCH 0195/2300] [nrf fromtree] tests: bsim: bluetooth: host: gatt: add authorization callback API test Added a new BabbleSim test that validates the authorization callback API from the Bluetooth GATT header. Signed-off-by: Kamil Piszczek (cherry picked from commit a369eb7b367f485bece73cd4973e531bf54cd27b) (cherry picked from commit e4e6dc87bafd8f3e9c2562fc55dbfa4f8185b14b) --- tests/bsim/bluetooth/host/compile.sh | 1 + .../host/gatt/authorization/CMakeLists.txt | 14 + .../host/gatt/authorization/prj.conf | 7 + .../host/gatt/authorization/src/common.c | 20 + .../host/gatt/authorization/src/common.h | 73 ++++ .../gatt/authorization/src/gatt_client_test.c | 341 ++++++++++++++++ .../gatt/authorization/src/gatt_server_test.c | 370 ++++++++++++++++++ .../host/gatt/authorization/src/main.c | 22 ++ .../gatt/authorization/test_scripts/gatt.sh | 22 ++ 9 files changed, 870 insertions(+) create mode 100644 tests/bsim/bluetooth/host/gatt/authorization/CMakeLists.txt create mode 100644 tests/bsim/bluetooth/host/gatt/authorization/prj.conf create mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/common.c create mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/common.h create mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/gatt_client_test.c create mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c create mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/main.c create mode 100755 tests/bsim/bluetooth/host/gatt/authorization/test_scripts/gatt.sh diff --git a/tests/bsim/bluetooth/host/compile.sh b/tests/bsim/bluetooth/host/compile.sh index ff42fd27adf..098c983d75f 100755 --- a/tests/bsim/bluetooth/host/compile.sh +++ b/tests/bsim/bluetooth/host/compile.sh @@ -41,6 +41,7 @@ app=tests/bsim/bluetooth/host/att/sequential/dut compile app=tests/bsim/bluetooth/host/att/sequential/tester compile app=tests/bsim/bluetooth/host/att/long_read compile +app=tests/bsim/bluetooth/host/gatt/authorization compile app=tests/bsim/bluetooth/host/gatt/caching compile app=tests/bsim/bluetooth/host/gatt/general compile app=tests/bsim/bluetooth/host/gatt/notify compile diff --git a/tests/bsim/bluetooth/host/gatt/authorization/CMakeLists.txt b/tests/bsim/bluetooth/host/gatt/authorization/CMakeLists.txt new file mode 100644 index 00000000000..acb0dd45947 --- /dev/null +++ b/tests/bsim/bluetooth/host/gatt/authorization/CMakeLists.txt @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(bsim_test_gatt_authorization) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources} ) + +zephyr_include_directories( + ${BSIM_COMPONENTS_PATH}/libUtilv1/src/ + ${BSIM_COMPONENTS_PATH}/libPhyComv1/src/ + ) diff --git a/tests/bsim/bluetooth/host/gatt/authorization/prj.conf b/tests/bsim/bluetooth/host/gatt/authorization/prj.conf new file mode 100644 index 00000000000..9cba554afef --- /dev/null +++ b/tests/bsim/bluetooth/host/gatt/authorization/prj.conf @@ -0,0 +1,7 @@ +CONFIG_BT=y +CONFIG_BT_DEVICE_NAME="GATT tester" +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_AUTHORIZATION_CUSTOM=y +CONFIG_BT_ATT_PREPARE_COUNT=3 diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/common.c b/tests/bsim/bluetooth/host/gatt/authorization/src/common.c new file mode 100644 index 00000000000..adff2dd05ef --- /dev/null +++ b/tests/bsim/bluetooth/host/gatt/authorization/src/common.c @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "common.h" + +void test_tick(bs_time_t HW_device_time) +{ + if (bst_result != Passed) { + FAIL("test failed (not passed after %i seconds)\n", WAIT_TIME); + } +} + +void test_init(void) +{ + bst_ticker_set_next_tick_absolute(WAIT_TIME); + bst_result = In_progress; +} diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/common.h b/tests/bsim/bluetooth/host/gatt/authorization/src/common.h new file mode 100644 index 00000000000..339919dfe88 --- /dev/null +++ b/tests/bsim/bluetooth/host/gatt/authorization/src/common.h @@ -0,0 +1,73 @@ +/** + * Common functions and helpers for BSIM GATT tests + * + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include "bs_types.h" +#include "bs_tracing.h" +#include "time_machine.h" +#include "bstests.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +extern enum bst_result_t bst_result; + +#define WAIT_TIME (30 * 1e6) /*seconds*/ + +#define CREATE_FLAG(flag) static atomic_t flag = (atomic_t)false +#define SET_FLAG(flag) (void)atomic_set(&flag, (atomic_t)true) +#define UNSET_FLAG(flag) (void)atomic_set(&flag, (atomic_t)false) +#define WAIT_FOR_FLAG(flag) \ + while (!(bool)atomic_get(&flag)) { \ + (void)k_sleep(K_MSEC(1)); \ + } + +#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) + +#define CHRC_SIZE 10 + +#define TEST_SERVICE_UUID \ + BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00) + +#define TEST_UNHANDLED_CHRC_UUID \ + BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFD, 0x00) + +#define TEST_UNAUTHORIZED_CHRC_UUID \ + BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFE, 0x00) + +#define TEST_AUTHORIZED_CHRC_UUID \ + BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0x00) + +#define TEST_CP_CHRC_UUID \ + BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xF0, 0x00) + +void test_tick(bs_time_t HW_device_time); +void test_init(void); diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_client_test.c b/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_client_test.c new file mode 100644 index 00000000000..9c60c5b57b2 --- /dev/null +++ b/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_client_test.c @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "common.h" + +CREATE_FLAG(flag_is_connected); +CREATE_FLAG(flag_discover_complete); +CREATE_FLAG(flag_write_complete); +CREATE_FLAG(flag_read_complete); + +static struct bt_conn *g_conn; +static uint16_t unhandled_chrc_handle; +static uint16_t unauthorized_chrc_handle; +static uint16_t authorized_chrc_handle; +static uint16_t cp_chrc_handle; +static const struct bt_uuid *test_svc_uuid = TEST_SERVICE_UUID; + +#define ARRAY_ITEM(i, _) i +static uint8_t chrc_data[] = { LISTIFY(CHRC_SIZE, ARRAY_ITEM, (,)) }; /* 1, 2, 3 ... */ + +static void connected(struct bt_conn *conn, uint8_t err) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + + if (err != 0) { + FAIL("Failed to connect to %s (%u)\n", addr, err); + return; + } + + printk("Connected to %s\n", addr); + + __ASSERT_NO_MSG(g_conn == conn); + + SET_FLAG(flag_is_connected); +} + +static void disconnected(struct bt_conn *conn, uint8_t reason) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + if (conn != g_conn) { + return; + } + + bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + + printk("Disconnected: %s (reason 0x%02x)\n", addr, reason); + + bt_conn_unref(g_conn); + + g_conn = NULL; + UNSET_FLAG(flag_is_connected); +} + +BT_CONN_CB_DEFINE(conn_callbacks) = { + .connected = connected, + .disconnected = disconnected, +}; + +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]; + int err; + + if (g_conn != NULL) { + return; + } + + /* We're only interested in connectable events */ + if (type != BT_HCI_ADV_IND && type != BT_HCI_ADV_DIRECT_IND) { + return; + } + + bt_addr_le_to_str(addr, addr_str, sizeof(addr_str)); + printk("Device found: %s (RSSI %d)\n", addr_str, rssi); + + printk("Stopping scan\n"); + err = bt_le_scan_stop(); + if (err != 0) { + FAIL("Could not stop scan: %d"); + return; + } + + err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, + BT_LE_CONN_PARAM_DEFAULT, &g_conn); + if (err != 0) { + FAIL("Could not connect to peer: %d", err); + } +} + +static uint8_t discover_func(struct bt_conn *conn, + const struct bt_gatt_attr *attr, + struct bt_gatt_discover_params *params) +{ + int err; + + if (attr == NULL) { + if (unhandled_chrc_handle == 0 || + unauthorized_chrc_handle == 0 || + authorized_chrc_handle == 0) { + FAIL("Did not discover required characterstics"); + } + + (void)memset(params, 0, sizeof(*params)); + + SET_FLAG(flag_discover_complete); + + return BT_GATT_ITER_STOP; + } + + printk("[ATTRIBUTE] handle %u\n", attr->handle); + + if (params->type == BT_GATT_DISCOVER_PRIMARY && + bt_uuid_cmp(params->uuid, TEST_SERVICE_UUID) == 0) { + printk("Found test service\n"); + params->uuid = NULL; + params->start_handle = attr->handle + 1; + params->type = BT_GATT_DISCOVER_CHARACTERISTIC; + + err = bt_gatt_discover(conn, params); + if (err != 0) { + FAIL("Discover failed (err %d)\n", err); + } + + return BT_GATT_ITER_STOP; + } else if (params->type == BT_GATT_DISCOVER_CHARACTERISTIC) { + struct bt_gatt_chrc *chrc = (struct bt_gatt_chrc *)attr->user_data; + + if (bt_uuid_cmp(chrc->uuid, TEST_UNHANDLED_CHRC_UUID) == 0) { + printk("Found unhandled chrc\n"); + unhandled_chrc_handle = chrc->value_handle; + } else if (bt_uuid_cmp(chrc->uuid, TEST_UNAUTHORIZED_CHRC_UUID) == 0) { + printk("Found unauthorized\n"); + unauthorized_chrc_handle = chrc->value_handle; + } else if (bt_uuid_cmp(chrc->uuid, TEST_AUTHORIZED_CHRC_UUID) == 0) { + printk("Found authorized chrc\n"); + authorized_chrc_handle = chrc->value_handle; + } else if (bt_uuid_cmp(chrc->uuid, TEST_CP_CHRC_UUID) == 0) { + printk("Found CP chrc\n"); + cp_chrc_handle = chrc->value_handle; + } + } + + return BT_GATT_ITER_CONTINUE; +} + +static void gatt_discover(void) +{ + static struct bt_gatt_discover_params discover_params; + int err; + + printk("Discovering services and characteristics\n"); + + discover_params.uuid = test_svc_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_PRIMARY; + + err = bt_gatt_discover(g_conn, &discover_params); + if (err != 0) { + FAIL("Discover failed(err %d)\n", err); + } + + WAIT_FOR_FLAG(flag_discover_complete); + printk("Discover complete\n"); +} + +static void gatt_write_cb(struct bt_conn *conn, uint8_t err, + struct bt_gatt_write_params *params) +{ + if ((err != BT_ATT_ERR_SUCCESS) && (params->handle != unauthorized_chrc_handle)) { + FAIL("Write failed on authorized characteristics: 0x%02X\n", err); + } + + if ((err != BT_ATT_ERR_AUTHORIZATION) && (params->handle == unauthorized_chrc_handle)) { + FAIL("Write failed on unauthorized characteristics: 0x%02X\n", err); + } + + (void)memset(params, 0, sizeof(*params)); + + SET_FLAG(flag_write_complete); +} + +static void gatt_write(uint16_t handle) +{ + static struct bt_gatt_write_params write_params; + int err; + + printk("Writing to chrc\n"); + + write_params.data = chrc_data; + write_params.length = sizeof(chrc_data); + write_params.func = gatt_write_cb; + write_params.handle = handle; + + UNSET_FLAG(flag_write_complete); + + err = bt_gatt_write(g_conn, &write_params); + if (err != 0) { + FAIL("bt_gatt_write failed: %d\n", err); + } + + WAIT_FOR_FLAG(flag_write_complete); + printk("success\n"); +} + +static void gatt_cp_write(void) +{ + static struct bt_gatt_write_params write_params; + int err; + uint8_t cp_write_data[] = {0x00}; + + printk("Writing to CP chrc\n"); + + write_params.data = cp_write_data; + write_params.length = sizeof(cp_write_data); + write_params.func = gatt_write_cb; + write_params.handle = cp_chrc_handle; + + UNSET_FLAG(flag_write_complete); + + err = bt_gatt_write(g_conn, &write_params); + if (err != 0) { + FAIL("bt_gatt_write failed: %d\n", err); + } + + WAIT_FOR_FLAG(flag_write_complete); + printk("success\n"); +} + +static uint8_t gatt_read_cb(struct bt_conn *conn, uint8_t err, + struct bt_gatt_read_params *params, + const void *data, uint16_t length) +{ + if ((err != BT_ATT_ERR_SUCCESS) && + (params->single.handle != unauthorized_chrc_handle)) { + FAIL("Read failed on authorized characteristics: 0x%02X\n", err); + + if ((length != CHRC_SIZE) || (memcmp(data, chrc_data, length) != 0)) { + FAIL("chrc data different than expected", err); + } + } + + if ((err != BT_ATT_ERR_AUTHORIZATION) && + (params->single.handle == unauthorized_chrc_handle)) { + FAIL("Read failed on unauthorized characteristics: 0x%02X\n", err); + } + + (void)memset(params, 0, sizeof(*params)); + + SET_FLAG(flag_read_complete); + + return 0; +} + +static void gatt_read(uint16_t handle) +{ + static struct bt_gatt_read_params read_params; + int err; + + printk("Reading chrc\n"); + + read_params.func = gatt_read_cb; + read_params.handle_count = 1; + read_params.single.handle = handle; + read_params.single.offset = 0; + + UNSET_FLAG(flag_read_complete); + + err = bt_gatt_read(g_conn, &read_params); + if (err != 0) { + FAIL("bt_gatt_read failed: %d\n", err); + } + + WAIT_FOR_FLAG(flag_read_complete); + printk("success\n"); +} + +static void gatt_interact(uint16_t handle) +{ + gatt_write(handle); + gatt_read(handle); + gatt_cp_write(); +} + +static void test_main(void) +{ + int err; + + err = bt_enable(NULL); + if (err != 0) { + FAIL("Bluetooth discover failed (err %d)\n", err); + } + + err = bt_le_scan_start(BT_LE_SCAN_PASSIVE, device_found); + if (err != 0) { + FAIL("Scanning failed to start (err %d)\n", err); + } + + printk("Scanning successfully started\n"); + + WAIT_FOR_FLAG(flag_is_connected); + + gatt_discover(); + + printk("Interacting with the unhandled characteristic\n"); + gatt_interact(unhandled_chrc_handle); + + printk("Interacting with the unauthorized characteristic\n"); + gatt_interact(unauthorized_chrc_handle); + + printk("Interacting with the authorized characteristic\n"); + gatt_interact(authorized_chrc_handle); + + PASS("GATT client Passed\n"); +} + +static const struct bst_test_instance test_vcs[] = { + { + .test_id = "gatt_client", + .test_post_init_f = test_init, + .test_tick_f = test_tick, + .test_main_f = test_main + }, + BSTEST_END_MARKER +}; + +struct bst_test_list *test_gatt_client_install(struct bst_test_list *tests) +{ + return bst_add_tests(tests, test_vcs); +} 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 new file mode 100644 index 00000000000..d5dd5e0e0a7 --- /dev/null +++ b/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "common.h" + +extern enum bst_result_t bst_result; + +CREATE_FLAG(flag_is_chrc_ctx_validated); + +static struct bt_conn *g_conn; + +static void connected(struct bt_conn *conn, uint8_t err) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + + if (err != 0) { + FAIL("Failed to connect to %s (%u)\n", addr, err); + return; + } + + printk("Connected to %s\n", addr); + + g_conn = bt_conn_ref(conn); +} + +static void disconnected(struct bt_conn *conn, uint8_t reason) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + if (conn != g_conn) { + return; + } + + bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + + printk("Disconnected: %s (reason 0x%02x)\n", addr, reason); + + bt_conn_unref(g_conn); + + g_conn = NULL; +} + +BT_CONN_CB_DEFINE(conn_callbacks) = { + .connected = connected, + .disconnected = disconnected, +}; + +struct test_chrc_ctx { + uint16_t auth_read_cnt; + uint16_t read_cnt; + uint16_t auth_write_cnt; + uint16_t write_cnt; + uint8_t data[CHRC_SIZE]; +}; + +static ssize_t read_test_chrc(struct test_chrc_ctx *chrc_ctx, + struct bt_conn *conn, + const struct bt_gatt_attr *attr, + void *buf, uint16_t len, uint16_t offset) +{ + chrc_ctx->read_cnt++; + + return bt_gatt_attr_read(conn, attr, buf, len, offset, + (void *)chrc_ctx->data, + sizeof(chrc_ctx->data)); +} + +static ssize_t write_test_chrc(struct test_chrc_ctx *chrc_ctx, + const void *buf, uint16_t len, + uint16_t offset, uint8_t flags) +{ + chrc_ctx->write_cnt++; + + if (len != sizeof(chrc_ctx->data)) { + printk("Invalid chrc length\n"); + return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); + } + + if (offset != 0) { + printk("Invalid chrc offset and length\n"); + return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); + } + + if (flags != 0) { + FAIL("Invalid flags %u\n", flags); + return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); + } + + (void)memcpy(chrc_ctx->data, buf, len); + + return len; +} + +static struct test_chrc_ctx unhandled_chrc_ctx; + +static ssize_t read_test_unhandled_chrc(struct bt_conn *conn, + const struct bt_gatt_attr *attr, + void *buf, uint16_t len, uint16_t offset) +{ + return read_test_chrc(&unhandled_chrc_ctx, conn, attr, buf, len, offset); +} + +static ssize_t write_test_unhandled_chrc(struct bt_conn *conn, + const struct bt_gatt_attr *attr, + const void *buf, uint16_t len, + uint16_t offset, uint8_t flags) +{ + printk("unhandled chrc len %u offset %u\n", len, offset); + + return write_test_chrc(&unhandled_chrc_ctx, buf, len, offset, flags); +} + +static struct test_chrc_ctx unauthorized_chrc_ctx; + +static ssize_t read_test_unauthorized_chrc(struct bt_conn *conn, + const struct bt_gatt_attr *attr, + void *buf, uint16_t len, uint16_t offset) +{ + return read_test_chrc(&unauthorized_chrc_ctx, conn, attr, buf, len, offset); +} + +static ssize_t write_test_unauthorized_chrc(struct bt_conn *conn, + const struct bt_gatt_attr *attr, + const void *buf, uint16_t len, + uint16_t offset, uint8_t flags) +{ + printk("unauthorized chrc len %u offset %u\n", len, offset); + + return write_test_chrc(&unauthorized_chrc_ctx, buf, len, offset, flags); +} + +static struct test_chrc_ctx authorized_chrc_ctx; + +static ssize_t read_test_authorized_chrc(struct bt_conn *conn, + const struct bt_gatt_attr *attr, + void *buf, uint16_t len, uint16_t offset) +{ + return read_test_chrc(&authorized_chrc_ctx, conn, attr, buf, len, offset); +} + +static ssize_t write_test_authorized_chrc(struct bt_conn *conn, + const struct bt_gatt_attr *attr, + const void *buf, uint16_t len, + uint16_t offset, uint8_t flags) +{ + printk("authorized chrc len %u offset %u\n", len, offset); + + return write_test_chrc(&authorized_chrc_ctx, buf, len, offset, flags); +} + +static const struct test_chrc_ctx zeroed_chrc_ctx; + +static bool unhandled_chrc_operation_validate(void) +{ + if (memcmp(&unauthorized_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { + return false; + } + + if (memcmp(&authorized_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { + return false; + } + + if ((unhandled_chrc_ctx.read_cnt != 1) && (unhandled_chrc_ctx.write_cnt != 1)) { + return false; + } + + if ((unhandled_chrc_ctx.auth_read_cnt != 0) && + (unhandled_chrc_ctx.auth_write_cnt != 0)) { + return false; + } + + return true; +} + +static bool unauthorized_chrc_operation_validate(void) +{ + if (memcmp(&unhandled_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { + return false; + } + + if (memcmp(&authorized_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { + return false; + } + + if ((unauthorized_chrc_ctx.read_cnt != 0) && (unauthorized_chrc_ctx.write_cnt != 0)) { + return false; + } + + if ((unauthorized_chrc_ctx.auth_read_cnt != 1) && + (unauthorized_chrc_ctx.auth_write_cnt != 1)) { + return false; + } + + return true; +} + +static bool authorized_chrc_operation_validate(void) +{ + if (memcmp(&unhandled_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { + return false; + } + + if (memcmp(&unauthorized_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { + return false; + } + + if ((authorized_chrc_ctx.read_cnt != 1) && (authorized_chrc_ctx.write_cnt != 1)) { + return false; + } + + if ((authorized_chrc_ctx.auth_read_cnt != 1) && + (authorized_chrc_ctx.auth_write_cnt != 1)) { + return false; + } + + return true; +} + +static ssize_t write_cp_chrc(struct bt_conn *conn, + const struct bt_gatt_attr *attr, + const void *buf, uint16_t len, + uint16_t offset, uint8_t flags) +{ + static uint16_t cp_write_cnt; + bool pass; + char *log_str; + + if (cp_write_cnt == 0) { + pass = unhandled_chrc_operation_validate(); + log_str = "unhandled"; + } else if (cp_write_cnt == 1) { + pass = unauthorized_chrc_operation_validate(); + log_str = "unauthorized"; + } else if (cp_write_cnt == 2) { + pass = authorized_chrc_operation_validate(); + log_str = "authorized"; + } else { + FAIL("Invalid value of CP write counter %u\n", cp_write_cnt); + return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); + } + + if (pass) { + printk("Correct context for %s chrc\n", log_str); + } else { + FAIL("Invalid context for %s chrc\n", log_str); + return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); + } + + memset(&unhandled_chrc_ctx, 0, sizeof(unhandled_chrc_ctx)); + memset(&unauthorized_chrc_ctx, 0, sizeof(unauthorized_chrc_ctx)); + memset(&authorized_chrc_ctx, 0, sizeof(authorized_chrc_ctx)); + + cp_write_cnt++; + + if (cp_write_cnt == 3) { + SET_FLAG(flag_is_chrc_ctx_validated); + } + + return len; +} + +BT_GATT_SERVICE_DEFINE(test_svc, + BT_GATT_PRIMARY_SERVICE(TEST_SERVICE_UUID), + BT_GATT_CHARACTERISTIC(TEST_UNHANDLED_CHRC_UUID, + BT_GATT_CHRC_WRITE | BT_GATT_CHRC_READ, + BT_GATT_PERM_WRITE | BT_GATT_PERM_READ, + read_test_unhandled_chrc, + write_test_unhandled_chrc, NULL), + BT_GATT_CHARACTERISTIC(TEST_UNAUTHORIZED_CHRC_UUID, + BT_GATT_CHRC_WRITE | BT_GATT_CHRC_READ, + BT_GATT_PERM_WRITE | BT_GATT_PERM_READ, + read_test_unauthorized_chrc, + write_test_unauthorized_chrc, NULL), + BT_GATT_CHARACTERISTIC(TEST_AUTHORIZED_CHRC_UUID, + BT_GATT_CHRC_WRITE | BT_GATT_CHRC_READ, + BT_GATT_PERM_WRITE | BT_GATT_PERM_READ, + read_test_authorized_chrc, + write_test_authorized_chrc, NULL), + BT_GATT_CHARACTERISTIC(TEST_CP_CHRC_UUID, + BT_GATT_CHRC_WRITE, + BT_GATT_PERM_WRITE, + NULL, write_cp_chrc, NULL), +); + +static bool gatt_read_operation_authorize(struct bt_conn *conn, + const struct bt_gatt_attr *attr) +{ + if (bt_uuid_cmp(attr->uuid, TEST_UNAUTHORIZED_CHRC_UUID) == 0) { + unauthorized_chrc_ctx.auth_read_cnt++; + return false; + } else if (bt_uuid_cmp(attr->uuid, TEST_AUTHORIZED_CHRC_UUID) == 0) { + authorized_chrc_ctx.auth_read_cnt++; + return true; + } else { + return true; + } +} + +static bool gatt_write_operation_authorize(struct bt_conn *conn, + const struct bt_gatt_attr *attr) +{ + if (bt_uuid_cmp(attr->uuid, TEST_UNAUTHORIZED_CHRC_UUID) == 0) { + unauthorized_chrc_ctx.auth_write_cnt++; + return false; + } else if (bt_uuid_cmp(attr->uuid, TEST_AUTHORIZED_CHRC_UUID) == 0) { + authorized_chrc_ctx.auth_write_cnt++; + return true; + } else { + return true; + } +} + +static const struct bt_gatt_authorization_cb gatt_authorization_callbacks = { + .read_operation_authorize = gatt_read_operation_authorize, + .write_operation_authorize = gatt_write_operation_authorize, +}; + +static void test_main(void) +{ + int err; + const struct bt_data ad[] = { + BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)) + }; + + err = bt_gatt_authorization_cb_register(&gatt_authorization_callbacks); + if (err) { + FAIL("Registering GATT authorization callbacks failed (err %d)\n", err); + return; + } + + err = bt_enable(NULL); + if (err != 0) { + FAIL("Bluetooth init failed (err %d)\n", err); + return; + } + + printk("Bluetooth initialized\n"); + + err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0); + if (err != 0) { + FAIL("Advertising failed to start (err %d)\n", err); + return; + } + + printk("Advertising successfully started\n"); + + WAIT_FOR_FLAG(flag_is_chrc_ctx_validated); + + PASS("GATT server passed\n"); +} + +static const struct bst_test_instance test_gatt_server[] = { + { + .test_id = "gatt_server", + .test_post_init_f = test_init, + .test_tick_f = test_tick, + .test_main_f = test_main + }, + BSTEST_END_MARKER +}; + +struct bst_test_list *test_gatt_server_install(struct bst_test_list *tests) +{ + return bst_add_tests(tests, test_gatt_server); +} diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/main.c b/tests/bsim/bluetooth/host/gatt/authorization/src/main.c new file mode 100644 index 00000000000..a95f0285e75 --- /dev/null +++ b/tests/bsim/bluetooth/host/gatt/authorization/src/main.c @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "bstests.h" + +extern struct bst_test_list *test_gatt_server_install(struct bst_test_list *tests); +extern struct bst_test_list *test_gatt_client_install(struct bst_test_list *tests); + +bst_test_install_t test_installers[] = { + test_gatt_server_install, + test_gatt_client_install, + NULL +}; + +int main(void) +{ + bst_main(); + return 0; +} diff --git a/tests/bsim/bluetooth/host/gatt/authorization/test_scripts/gatt.sh b/tests/bsim/bluetooth/host/gatt/authorization/test_scripts/gatt.sh new file mode 100755 index 00000000000..edad0eb86c9 --- /dev/null +++ b/tests/bsim/bluetooth/host/gatt/authorization/test_scripts/gatt.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +simulation_id="gatt_authorization" +verbosity_level=2 +EXECUTE_TIMEOUT=120 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD}_tests_bsim_bluetooth_host_gatt_authorization_prj_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=gatt_client + +Execute ./bs_${BOARD}_tests_bsim_bluetooth_host_gatt_authorization_prj_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=gatt_server + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=2 -sim_length=60e6 $@ + +wait_for_background_jobs From 390cdf37088f4081263ec3512f86841c233a2546 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Thu, 11 Jan 2024 12:36:15 +0530 Subject: [PATCH 0196/2300] [nrf fromtree] net: mgmt: Update app of TWT teardown status Update user/app status of TWT teardown sessions. Signed-off-by: Ajay Parida (cherry picked from commit 3053484dcb646066fe738050d9d5e4c314f1235f) (cherry picked from commit 0f41950fd18eaa6125d2041ed2525a5aa27397ea) --- include/zephyr/net/wifi.h | 8 ++++++++ include/zephyr/net/wifi_mgmt.h | 2 ++ subsys/net/l2/wifi/wifi_shell.c | 9 +++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index 5c7d5b493fa..c49d6ad0f66 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -345,6 +345,14 @@ enum wifi_twt_fail_reason { WIFI_TWT_FAIL_FLOW_ALREADY_EXISTS, }; +/** Wi-Fi Target Wake Time (TWT) teradown status. */ +enum wifi_twt_teardown_status { + /** TWT teardown success */ + WIFI_TWT_TEARDOWN_SUCCESS = 0, + /** TWT teardown failure */ + WIFI_TWT_TEARDOWN_FAILED, +}; + /** @cond INTERNAL_HIDDEN */ static const char * const wifi_twt_err_code_tbl[] = { [WIFI_TWT_FAIL_UNSPECIFIED] = "Unspecified", diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index f6ae631a830..0c64cab3c01 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -470,6 +470,8 @@ struct wifi_twt_params { enum wifi_twt_setup_cmd setup_cmd; /** TWT setup response status, see enum wifi_twt_setup_resp_status */ enum wifi_twt_setup_resp_status resp_status; + /** TWT teardown cmd status, see enum wifi_twt_teardown_status */ + enum wifi_twt_teardown_status teardown_status; /** Dialog token, used to map requests to responses */ uint8_t dialog_token; /** Flow ID, used to map setup with teardown */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1f13ae864ae..44f507f6e02 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -293,8 +293,13 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) (const struct wifi_twt_params *)cb->info; if (resp->operation == WIFI_TWT_TEARDOWN) { - print(context.sh, SHELL_NORMAL, "TWT teardown received for flow ID %d\n", - resp->flow_id); + if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { + print(context.sh, SHELL_NORMAL, "TWT teardown received for flow ID %d\n", + resp->flow_id); + } else { + print(context.sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", + resp->flow_id); + } return; } From 9503b994dd3822e823be3f1ad3771bf56b696e47 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Wed, 17 Jan 2024 14:49:00 +0530 Subject: [PATCH 0197/2300] [nrf fromtree] net: mgmt: Print correct TWT teardown status message Print success message for TWT teardown successful case. Signed-off-by: Ajay Parida (cherry picked from commit 4d854a193e4958659669afadad621f86636b0bff) (cherry picked from commit 8f02d6eeec4b4b0a8aebfceca05f1a029b8b08a0) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 44f507f6e02..70b4f96d861 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -294,7 +294,7 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) if (resp->operation == WIFI_TWT_TEARDOWN) { if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { - print(context.sh, SHELL_NORMAL, "TWT teardown received for flow ID %d\n", + print(context.sh, SHELL_NORMAL, "TWT teardown succeeded for flow ID %d\n", resp->flow_id); } else { print(context.sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", From 60f94c3dad65ef9a568233553e795eb76f1e9e25 Mon Sep 17 00:00:00 2001 From: Przemyslaw Bida Date: Mon, 22 Jan 2024 08:39:32 +0100 Subject: [PATCH 0198/2300] [nrf fromtree] net: openthread: Regular openthread upmerge to `00076af` Regular upmerge. Signed-off-by: Przemyslaw Bida (cherry picked from commit f661aa7641ef4e9561ec9d7f654afbe7d7669f2e) (cherry picked from commit bca3722d75202fdbe6c7d8dcc546ad90f1c03895) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b9a84545850..2892d3db451 100644 --- a/west.yml +++ b/west.yml @@ -301,7 +301,7 @@ manifest: revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 path: modules/lib/open-amp - name: openthread - revision: 4ed44bc7d58d9a98c6cca13a50d38129045ab3df + revision: 00076aff3ae571db7c90509ec9dc293457098c35 path: modules/lib/openthread - name: percepio path: modules/debug/percepio From 4f28fcb0b54b504e076b9ef715f5cdf232f5d411 Mon Sep 17 00:00:00 2001 From: Przemyslaw Bida Date: Thu, 11 Jan 2024 12:25:18 +0100 Subject: [PATCH 0199/2300] [nrf fromtree] net: openthread: Fix key import in case of ECDSA. According to PSA specification in case of `PSA_KEY_TYPE_ECC_KEY_PAIR` function `psa_import_key` takes private key from key pair as argument. This commit adds extraction of Private key from ECDSA key pair. Also removes not needed `otPlatCryptoEcdsaGetPublicKey`. Signed-off-by: Przemyslaw Bida (cherry picked from commit a6184b9be3d14166c21827b3540cec6514fafe12) (cherry picked from commit 0c16a9a6fa8163a6166955124f7ab6a32217377e) --- modules/openthread/platform/crypto_psa.c | 114 +++++++++++------------ 1 file changed, 52 insertions(+), 62 deletions(-) diff --git a/modules/openthread/platform/crypto_psa.c b/modules/openthread/platform/crypto_psa.c index 55018254154..c818c5695a3 100644 --- a/modules/openthread/platform/crypto_psa.c +++ b/modules/openthread/platform/crypto_psa.c @@ -16,6 +16,7 @@ #if defined(CONFIG_OPENTHREAD_ECDSA) #include +#include #endif static otError psaToOtError(psa_status_t aStatus) @@ -62,7 +63,7 @@ static psa_algorithm_t toPsaAlgorithm(otCryptoKeyAlgorithm aAlgorithm) * There is currently no constant like PSA_ALG_NONE, but 0 is used * to indicate an unknown algorithm. */ - return (psa_algorithm_t) 0; + return (psa_algorithm_t)0; } } @@ -96,11 +97,9 @@ static psa_key_usage_t toPsaKeyUsage(int aUsage) static bool checkKeyUsage(int aUsage) { /* Check if only supported flags have been passed */ - int supported_flags = OT_CRYPTO_KEY_USAGE_EXPORT | - OT_CRYPTO_KEY_USAGE_ENCRYPT | - OT_CRYPTO_KEY_USAGE_DECRYPT | - OT_CRYPTO_KEY_USAGE_SIGN_HASH | - OT_CRYPTO_KEY_USAGE_VERIFY_HASH; + int supported_flags = OT_CRYPTO_KEY_USAGE_EXPORT | OT_CRYPTO_KEY_USAGE_ENCRYPT | + OT_CRYPTO_KEY_USAGE_DECRYPT | OT_CRYPTO_KEY_USAGE_SIGN_HASH | + OT_CRYPTO_KEY_USAGE_VERIFY_HASH; return (aUsage & ~supported_flags) == 0; } @@ -121,26 +120,57 @@ void otPlatCryptoInit(void) * PSA with emulated TFM, Settings have to be initialized at the end of otPlatCryptoInit(), * to be available before storing Network Key. */ - __ASSERT_EVAL((void) settings_subsys_init(), int err = settings_subsys_init(), - !err, "Failed to initialize settings"); + __ASSERT_EVAL((void)settings_subsys_init(), int err = settings_subsys_init(), !err, + "Failed to initialize settings"); #endif } -otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, - otCryptoKeyType aKeyType, - otCryptoKeyAlgorithm aKeyAlgorithm, - int aKeyUsage, - otCryptoKeyStorage aKeyPersistence, - const uint8_t *aKey, +otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, + otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, + otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, size_t aKeyLen) { +#if defined(CONFIG_OPENTHREAD_ECDSA) + int version; + size_t len; + unsigned char *p = (unsigned char *)aKey; + unsigned char *end; +#endif + psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; - psa_status_t status; + psa_status_t status = 0; if (aKeyRef == NULL || aKey == NULL || !checkKeyUsage(aKeyUsage)) { return OT_ERROR_INVALID_ARGS; } +#if defined(CONFIG_OPENTHREAD_ECDSA) + /* Check if key is ECDSA pair and extract private key from it since PSA expects it. */ + if (aKeyType == OT_CRYPTO_KEY_TYPE_ECDSA) { + + end = p + aKeyLen; + status = mbedtls_asn1_get_tag(&p, end, &len, + MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); + if (status != 0) { + return OT_ERROR_FAILED; + } + + end = p + len; + status = mbedtls_asn1_get_int(&p, end, &version); + if (status != 0) { + return OT_ERROR_FAILED; + } + + status = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OCTET_STRING); + if (status != 0 || len != 32) { + return OT_ERROR_FAILED; + } + + aKey = p; + aKeyLen = len; + } +#endif + psa_set_key_type(&attributes, toPsaKeyType(aKeyType)); psa_set_key_algorithm(&attributes, toPsaAlgorithm(aKeyAlgorithm)); psa_set_key_usage_flags(&attributes, toPsaKeyUsage(aKeyUsage)); @@ -161,9 +191,7 @@ otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, return psaToOtError(status); } -otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, - uint8_t *aBuffer, - size_t aBufferLen, +otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, size_t *aKeyLen) { if (aBuffer == NULL) { @@ -231,8 +259,7 @@ otError otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey return psaToOtError(status); } -otError otPlatCryptoHmacSha256Update(otCryptoContext *aContext, - const void *aBuf, +otError otPlatCryptoHmacSha256Update(otCryptoContext *aContext, const void *aBuf, uint16_t aBufLength) { psa_mac_operation_t *operation; @@ -243,7 +270,7 @@ otError otPlatCryptoHmacSha256Update(otCryptoContext *aContext, operation = aContext->mContext; - return psaToOtError(psa_mac_update(operation, (const uint8_t *) aBuf, aBufLength)); + return psaToOtError(psa_mac_update(operation, (const uint8_t *)aBuf, aBufLength)); } otError otPlatCryptoHmacSha256Finish(otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength) @@ -269,7 +296,7 @@ otError otPlatCryptoAesInit(otCryptoContext *aContext) } key_ref = aContext->mContext; - *key_ref = (psa_key_id_t) 0; /* In TF-M 1.5.0 this can be replaced with PSA_KEY_ID_NULL */ + *key_ref = (psa_key_id_t)0; /* In TF-M 1.5.0 this can be replaced with PSA_KEY_ID_NULL */ return OT_ERROR_NONE; } @@ -300,13 +327,8 @@ otError otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, } key_ref = aContext->mContext; - status = psa_cipher_encrypt(*key_ref, - PSA_ALG_ECB_NO_PADDING, - aInput, - block_size, - aOutput, - block_size, - &cipher_length); + status = psa_cipher_encrypt(*key_ref, PSA_ALG_ECB_NO_PADDING, aInput, block_size, aOutput, + block_size, &cipher_length); return psaToOtError(status); } @@ -366,7 +388,7 @@ otError otPlatCryptoSha256Update(otCryptoContext *aContext, const void *aBuf, ui operation = aContext->mContext; - return psaToOtError(psa_hash_update(operation, (const uint8_t *) aBuf, aBufLength)); + return psaToOtError(psa_hash_update(operation, (const uint8_t *)aBuf, aBufLength)); } otError otPlatCryptoSha256Finish(otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize) @@ -430,38 +452,6 @@ otError otPlatCryptoEcdsaGenerateKey(otPlatCryptoEcdsaKeyPair *aKeyPair) return psaToOtError(status); } -otError otPlatCryptoEcdsaGetPublicKey(const otPlatCryptoEcdsaKeyPair *aKeyPair, - otPlatCryptoEcdsaPublicKey *aPublicKey) -{ - psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; - psa_key_id_t key_id = 0; - psa_status_t status; - size_t exported_length; - uint8_t buffer[1 + OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE]; - - psa_set_key_algorithm(&attributes, PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256)); - psa_set_key_type(&attributes, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)); - psa_set_key_bits(&attributes, 256); - - status = psa_import_key(&attributes, aKeyPair->mDerBytes, aKeyPair->mDerLength, &key_id); - if (status != PSA_SUCCESS) { - goto out; - } - - status = psa_export_public_key(key_id, buffer, sizeof(buffer), &exported_length); - if (status != PSA_SUCCESS) { - goto out; - } - __ASSERT_NO_MSG(exported_length == sizeof(buffer)); - memcpy(aPublicKey->m8, buffer + 1, OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE); - -out: - psa_reset_key_attributes(&attributes); - psa_destroy_key(key_id); - - return psaToOtError(status); -} - otError otPlatCryptoEcdsaSign(const otPlatCryptoEcdsaKeyPair *aKeyPair, const otPlatCryptoSha256Hash *aHash, otPlatCryptoEcdsaSignature *aSignature) From 60eeedf060525bfa5a18816f61f762caa3d5fcae Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 8 Jan 2024 12:03:29 +0100 Subject: [PATCH 0200/2300] [nrf fromtree] Bluetooth: BAP: Add support for transparent coding format Add support for controlling whether the local controller should transcode, or whether it will be done by another module (e.g. the host). By default when using the macros, controller transcoding will be disabled. Signed-off-by: Emil Gydesen (cherry picked from commit 1faa5a2aa2a2c134f21e4a7dc62a374eaa5d7664) Signed-off-by: Jui-Chou Chung (cherry picked from commit e79378647820cd929411c0da58df5ede8075f1ec) --- include/zephyr/bluetooth/audio/audio.h | 14 ++++++++++++++ subsys/bluetooth/audio/bap_stream.c | 22 ++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/zephyr/bluetooth/audio/audio.h b/include/zephyr/bluetooth/audio/audio.h index 17bac991f18..03f451a3c8b 100644 --- a/include/zephyr/bluetooth/audio/audio.h +++ b/include/zephyr/bluetooth/audio/audio.h @@ -209,6 +209,7 @@ enum bt_audio_metadata_type { ((struct bt_audio_codec_cfg){ \ /* Use HCI data path as default, can be overwritten by application */ \ .path_id = BT_ISO_DATA_PATH_HCI, \ + .ctlr_transcode = false, \ .id = _id, \ .cid = _cid, \ .vid = _vid, \ @@ -231,6 +232,7 @@ enum bt_audio_metadata_type { ((struct bt_audio_codec_cap){ \ /* Use HCI data path as default, can be overwritten by application */ \ .path_id = BT_ISO_DATA_PATH_HCI, \ + .ctlr_transcode = false, \ .id = (_id), \ .cid = (_cid), \ .vid = (_vid), \ @@ -316,6 +318,12 @@ struct bt_audio_codec_cap { * vendor specific ID. */ uint8_t path_id; + /** Whether or not the local controller should transcode + * + * This effectively sets the coding format for the ISO data path to @ref + * BT_HCI_CODING_FORMAT_TRANSPARENT if false, else uses the @ref bt_audio_codec_cfg.id. + */ + bool ctlr_transcode; /** Codec ID */ uint8_t id; /** Codec Company ID */ @@ -344,6 +352,12 @@ struct bt_audio_codec_cfg { * vendor specific ID. */ uint8_t path_id; + /** Whether or not the local controller should transcode + * + * This effectively sets the coding format for the ISO data path to @ref + * BT_HCI_CODING_FORMAT_TRANSPARENT if false, else uses the @ref bt_audio_codec_cfg.id. + */ + bool ctlr_transcode; /** Codec ID */ uint8_t id; /** Codec Company ID */ diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index 23e5bb8564b..6dae679ddef 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -35,12 +35,22 @@ void bt_audio_codec_cfg_to_iso_path(struct bt_iso_chan_path *path, struct bt_audio_codec_cfg *codec_cfg) { path->pid = codec_cfg->path_id; - path->format = codec_cfg->id; - path->cid = codec_cfg->cid; - path->vid = codec_cfg->vid; - path->delay = 0; /* TODO: Add to bt_audio_codec_cfg? Use presentation delay? */ - path->cc_len = codec_cfg->data_len; - path->cc = codec_cfg->data; + + if (codec_cfg->ctlr_transcode) { + path->format = codec_cfg->id; + path->cid = codec_cfg->cid; + path->vid = codec_cfg->vid; + path->delay = 0; + path->cc_len = codec_cfg->data_len; + path->cc = codec_cfg->data; + } else { + path->format = BT_HCI_CODING_FORMAT_TRANSPARENT; + path->cid = 0; + path->vid = 0; + path->delay = 0; + path->cc_len = 0; + path->cc = NULL; + } } #if defined(CONFIG_BT_BAP_UNICAST_CLIENT) || defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || \ From a58c9b5190197c036a192bec02acf1ae98d9c682 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 19 Jan 2024 13:13:08 +0100 Subject: [PATCH 0201/2300] [nrf fromtree] Bluetooth: BAP: Fix issue with setting invalid iso data path BAP would always set up the ISO data path in both directions, even for unidirectional CIS. This meant that in the unconfigured direction, the data path configuration data would all be 0, which causes issues on some controllers. The new refactored approach implemented by this commit will always ensure that the data path is setup correctly, and that we only set the data path in one direction for unidirectional CIS. The unset path will use the default ISO path of HCI and transparant format, which should always be allowed by a controller. This is building on the requirement in BAP that all streams in a unicast group shall be QoS configured at the same time. This ensures that before any streams in the CIG has been connected, they have all been configured. Signed-off-by: Emil Gydesen (cherry picked from commit aef39f69239bf2c4f2e07c11171d1d3ad896ad4f) Signed-off-by: Jui-Chou Chung (cherry picked from commit efade47773f7a119b9576a168e1e5c59ceb2c3d3) --- subsys/bluetooth/audio/ascs.c | 6 +-- subsys/bluetooth/audio/bap_broadcast_sink.c | 2 +- subsys/bluetooth/audio/bap_broadcast_source.c | 4 +- subsys/bluetooth/audio/bap_iso.c | 48 +++++++++++++++---- subsys/bluetooth/audio/bap_iso.h | 1 + subsys/bluetooth/audio/bap_stream.c | 22 --------- subsys/bluetooth/audio/bap_stream.h | 2 - subsys/bluetooth/audio/bap_unicast_client.c | 13 +---- 8 files changed, 46 insertions(+), 52 deletions(-) diff --git a/subsys/bluetooth/audio/ascs.c b/subsys/bluetooth/audio/ascs.c index 116071d4c0f..6df91e5f43e 100644 --- a/subsys/bluetooth/audio/ascs.c +++ b/subsys/bluetooth/audio/ascs.c @@ -1820,11 +1820,7 @@ static int ase_stream_qos(struct bt_bap_stream *stream, struct bt_audio_codec_qo * we have the ISO <-> EP coupling completed (due to setting * the CIS ID in the QoS procedure). */ - if (ep->dir == BT_AUDIO_DIR_SINK) { - bt_audio_codec_cfg_to_iso_path(&ep->iso->rx.path, stream->codec_cfg); - } else { - bt_audio_codec_cfg_to_iso_path(&ep->iso->tx.path, stream->codec_cfg); - } + bt_bap_iso_configure_data_path(ep, stream->codec_cfg); ep->cig_id = cig_id; ep->cis_id = cis_id; diff --git a/subsys/bluetooth/audio/bap_broadcast_sink.c b/subsys/bluetooth/audio/bap_broadcast_sink.c index 4d2134455b8..aa4bc08f761 100644 --- a/subsys/bluetooth/audio/bap_broadcast_sink.c +++ b/subsys/bluetooth/audio/bap_broadcast_sink.c @@ -764,7 +764,7 @@ static int bt_bap_broadcast_sink_setup_stream(struct bt_bap_broadcast_sink *sink bt_bap_iso_bind_ep(iso, ep); bt_audio_codec_qos_to_iso_qos(iso->chan.qos->rx, &sink->codec_qos); - bt_audio_codec_cfg_to_iso_path(iso->chan.qos->rx->path, codec_cfg); + bt_bap_iso_configure_data_path(ep, codec_cfg); bt_bap_iso_unref(iso); diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index 8978e2816cb..33fd1f0e17d 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -288,7 +288,7 @@ static int broadcast_source_setup_stream(uint8_t index, struct bt_bap_stream *st bt_bap_iso_bind_ep(iso, ep); bt_audio_codec_qos_to_iso_qos(iso->chan.qos->tx, qos); - bt_audio_codec_cfg_to_iso_path(iso->chan.qos->tx->path, codec_cfg); + bt_bap_iso_configure_data_path(ep, codec_cfg); #if defined(CONFIG_BT_ISO_TEST_PARAMS) iso->chan.qos->num_subevents = qos->num_subevents; #endif /* CONFIG_BT_ISO_TEST_PARAMS */ @@ -878,7 +878,7 @@ int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, iso_qos = stream->ep->iso->chan.qos->tx; bt_bap_stream_attach(NULL, stream, stream->ep, codec_cfg); - bt_audio_codec_cfg_to_iso_path(iso_qos->path, codec_cfg); + bt_bap_iso_configure_data_path(stream->ep, codec_cfg); } } diff --git a/subsys/bluetooth/audio/bap_iso.c b/subsys/bluetooth/audio/bap_iso.c index cb68a8032f5..3fa2059ea94 100644 --- a/subsys/bluetooth/audio/bap_iso.c +++ b/subsys/bluetooth/audio/bap_iso.c @@ -129,19 +129,12 @@ void bt_bap_iso_init(struct bt_bap_iso *iso, struct bt_iso_chan_ops *ops) iso->chan.ops = ops; iso->chan.qos = &iso->qos; - /* Setup points for both Tx and Rx + /* Setup the QoS for both Tx and Rx * This is due to the limitation in the ISO API where pointers like - * the `qos->tx` shall be initialized before the CIS is connected if - * ever want to use it for TX, and ditto for RX. They cannot be - * initialized after the CIS has been connected + * the `qos->tx` shall be initialized before the CIS is created */ iso->chan.qos->rx = &iso->rx.qos; - iso->chan.qos->rx->path = &iso->rx.path; - iso->chan.qos->rx->path->cc = iso->rx.cc; - iso->chan.qos->tx = &iso->tx.qos; - iso->chan.qos->tx->path = &iso->tx.path; - iso->chan.qos->tx->path->cc = iso->tx.cc; } static struct bt_bap_iso_dir *bap_iso_get_iso_dir(bool unicast_client, struct bt_bap_iso *iso, @@ -164,6 +157,43 @@ static struct bt_bap_iso_dir *bap_iso_get_iso_dir(bool unicast_client, struct bt } } +void bt_bap_iso_configure_data_path(struct bt_bap_ep *ep, struct bt_audio_codec_cfg *codec_cfg) +{ + struct bt_bap_iso *bap_iso = ep->iso; + struct bt_iso_chan_qos *qos = bap_iso->chan.qos; + const bool is_unicast_client = + IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT) && bt_bap_ep_is_unicast_client(ep); + struct bt_bap_iso_dir *iso_dir = bap_iso_get_iso_dir(is_unicast_client, bap_iso, ep->dir); + struct bt_iso_chan_path *path = &iso_dir->path; + + /* Setup the data path objects */ + if (iso_dir == &bap_iso->rx) { + qos->rx->path = path; + } else { + qos->tx->path = path; + } + + /* Configure the data path to either use the controller for transcoding, or set the path to + * be transparant to indicate that the transcoding happens somewhere else + */ + path->pid = codec_cfg->path_id; + + if (codec_cfg->ctlr_transcode) { + path->format = codec_cfg->id; + path->cid = codec_cfg->cid; + path->vid = codec_cfg->vid; + path->delay = 0; + path->cc_len = codec_cfg->data_len; + path->cc = codec_cfg->data; + } else { + path->format = BT_HCI_CODING_FORMAT_TRANSPARENT; + path->cid = 0; + path->vid = 0; + path->delay = 0; + path->cc_len = 0; + path->cc = NULL; + } +} static bool is_unicast_client_ep(struct bt_bap_ep *ep) { return IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT) && bt_bap_ep_is_unicast_client(ep); diff --git a/subsys/bluetooth/audio/bap_iso.h b/subsys/bluetooth/audio/bap_iso.h index d3b27f3823a..4384182d697 100644 --- a/subsys/bluetooth/audio/bap_iso.h +++ b/subsys/bluetooth/audio/bap_iso.h @@ -41,6 +41,7 @@ void bt_bap_iso_foreach(bt_bap_iso_func_t func, void *user_data); struct bt_bap_iso *bt_bap_iso_find(bt_bap_iso_func_t func, void *user_data); void bt_bap_iso_init(struct bt_bap_iso *iso, struct bt_iso_chan_ops *ops); void bt_bap_iso_bind_ep(struct bt_bap_iso *iso, struct bt_bap_ep *ep); +void bt_bap_iso_configure_data_path(struct bt_bap_ep *ep, struct bt_audio_codec_cfg *codec_cfg); void bt_bap_iso_unbind_ep(struct bt_bap_iso *iso, struct bt_bap_ep *ep); struct bt_bap_ep *bt_bap_iso_get_ep(bool unicast_client, struct bt_bap_iso *iso, enum bt_audio_dir dir); diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index 6dae679ddef..d6df9524e14 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -31,28 +31,6 @@ LOG_MODULE_REGISTER(bt_bap_stream, CONFIG_BT_BAP_STREAM_LOG_LEVEL); -void bt_audio_codec_cfg_to_iso_path(struct bt_iso_chan_path *path, - struct bt_audio_codec_cfg *codec_cfg) -{ - path->pid = codec_cfg->path_id; - - if (codec_cfg->ctlr_transcode) { - path->format = codec_cfg->id; - path->cid = codec_cfg->cid; - path->vid = codec_cfg->vid; - path->delay = 0; - path->cc_len = codec_cfg->data_len; - path->cc = codec_cfg->data; - } else { - path->format = BT_HCI_CODING_FORMAT_TRANSPARENT; - path->cid = 0; - path->vid = 0; - path->delay = 0; - path->cc_len = 0; - path->cc = NULL; - } -} - #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, diff --git a/subsys/bluetooth/audio/bap_stream.h b/subsys/bluetooth/audio/bap_stream.h index 67e8c0470df..d16cf2cfcc9 100644 --- a/subsys/bluetooth/audio/bap_stream.h +++ b/subsys/bluetooth/audio/bap_stream.h @@ -17,8 +17,6 @@ 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_cfg_to_iso_path(struct bt_iso_chan_path *path, - 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); diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 933db93ec72..b6de9b61a66 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -774,17 +774,8 @@ static void unicast_client_ep_qos_state(struct bt_bap_ep *ep, struct net_buf_sim * we have the ISO <-> EP coupling completed (due to setting * the CIS ID in the QoS procedure). */ - if (ep->dir == BT_AUDIO_DIR_SOURCE) { - /* If the endpoint is a source, then we need to - * configure our RX parameters - */ - bt_audio_codec_cfg_to_iso_path(&ep->iso->rx.path, stream->codec_cfg); - } else { - /* If the endpoint is a sink, then we need to - * configure our TX parameters - */ - bt_audio_codec_cfg_to_iso_path(&ep->iso->tx.path, stream->codec_cfg); - } + + bt_bap_iso_configure_data_path(ep, stream->codec_cfg); } /* Notify upper layer */ From f02cd371e12572110f6ffb517ac05ce180143b5c Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 23 Jan 2024 19:55:32 +0530 Subject: [PATCH 0202/2300] [nrf fromlist] wifi: ap: Add support to disconnect a STA In AP mode, this can be used to disconnect a connected station. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68007 Signed-off-by: Chaitanya Tata (cherry picked from commit beb27ee66e9cac0d6cb09733a3c891bd85040a68) --- include/zephyr/net/wifi_mgmt.h | 15 +++++++++++++++ subsys/net/l2/wifi/wifi_mgmt.c | 24 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 0c64cab3c01..bd8cba81d28 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -81,6 +81,8 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_PACKET_FILTER, /** Set or get Wi-Fi channel for Monitor or TX-Injection mode */ NET_REQUEST_WIFI_CMD_CHANNEL, + /** Disconnect a STA from AP */ + NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT, NET_REQUEST_WIFI_CMD_MAX }; @@ -158,6 +160,11 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PACKET_FILTER); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL); +#define NET_REQUEST_WIFI_AP_STA_DISCONNECT \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT); + /** Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -726,6 +733,14 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*ap_disable)(const struct device *dev); + /** Disconnect a STA from AP + * + * @param dev Pointer to the device structure for the driver instance. + * @param mac MAC address of the STA to disconnect + * + * @return 0 if ok, < 0 if error + */ + int (*ap_sta_disconnect)(const struct device *dev, const uint8_t *mac); /** Get interface status * * @param dev Pointer to the device structure for the driver instance. diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 6e0cb761dbf..2cfe8e25d89 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -410,6 +410,30 @@ static int wifi_ap_disable(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_DISABLE, wifi_ap_disable); +static int wifi_ap_sta_disconnect(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); + uint8_t *mac = data; + + if (dev == NULL) { + return -ENODEV; + } + + if (wifi_mgmt_api == NULL || wifi_mgmt_api->ap_sta_disconnect == NULL) { + return -ENOTSUP; + } + + if (!data || len != sizeof(uint8_t) * WIFI_MAC_ADDR_LEN) { + return -EINVAL; + } + + return wifi_mgmt_api->ap_sta_disconnect(dev, mac); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT, wifi_ap_sta_disconnect); + static int wifi_iface_status(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { From 3a813989cee3728a64d67ca887b78fa814a304f4 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 23 Jan 2024 20:03:59 +0530 Subject: [PATCH 0203/2300] [nrf fromlist] wifi: shell: ap: Add a command to disconnect a station The shell commands can be used to disconnect a connected station in AP mode. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68007 Signed-off-by: Chaitanya Tata (cherry picked from commit 7265d089ed41eeaf0663cab55a3dab2215491d94) --- subsys/net/l2/wifi/wifi_shell.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 70b4f96d861..5a3d7e632a7 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1353,6 +1353,34 @@ static int cmd_wifi_ap_stations(const struct shell *sh, size_t argc, return 0; } +static int cmd_wifi_ap_sta_disconnect(const struct shell *sh, size_t argc, + char *argv[]) +{ + struct net_if *iface = net_if_get_first_wifi(); + uint8_t mac[6]; + int ret; + + if (argc != 2) { + shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); + shell_help(sh); + return -ENOEXEC; + } + + if (net_bytes_from_str(mac, sizeof(mac), argv[1]) < 0) { + shell_fprintf(sh, SHELL_WARNING, "Invalid MAC address\n"); + return -ENOEXEC; + } + + ret = net_mgmt(NET_REQUEST_WIFI_AP_STA_DISCONNECT, iface, mac, sizeof(mac)); + if (ret) { + shell_fprintf(sh, SHELL_WARNING, "AP station disconnect failed: %s\n", + strerror(-ret)); + return -ENOEXEC; + } + + shell_fprintf(sh, SHELL_NORMAL, "AP station disconnect requested\n"); + return 0; +} static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, char *argv[]) @@ -1849,6 +1877,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, "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), SHELL_SUBCMD_SET_END ); From 91c42f316a459d1c56d777dbf4cfef41ca961878 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Tue, 14 Nov 2023 16:28:11 +0100 Subject: [PATCH 0204/2300] [nrf fromtree] net: ethernet: Add support for setting T1S PLCA parameters The Zephyr's core ethernet code had to be adjusted to support setting T1S PLCA parameters from user Zephyr programs. Such approach allows more flexibility, as T1S network configuration; especially PLCA node numbers, can be assigned not only via device tree at compile time. For example user can read them from EEPROM and then configure the network accordingly. For now - the union in struct ethernet_t1s_param only consists of plca structure. This can change in the future, when other T1S OA parameters - like Receive/Transmit Cut-Through Enable (bits RXCTE/TXCTE in OA_CONFIG0 register) are made adjustable from user program. Signed-off-by: Lukasz Majewski (cherry picked from commit 25addd09842a05675b68e72d73acf3d616d4548b) (cherry picked from commit c6c44468cd4f3ddc9256cce990232ec2dbba4d64) --- include/zephyr/net/ethernet.h | 48 ++++++++++++++++++++++++++ include/zephyr/net/ethernet_mgmt.h | 7 ++++ subsys/net/l2/ethernet/ethernet_mgmt.c | 11 ++++++ 3 files changed, 66 insertions(+) diff --git a/include/zephyr/net/ethernet.h b/include/zephyr/net/ethernet.h index a47ec767a60..181503140a7 100644 --- a/include/zephyr/net/ethernet.h +++ b/include/zephyr/net/ethernet.h @@ -196,6 +196,7 @@ enum ethernet_config_type { ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM, ETHERNET_CONFIG_TYPE_FILTER, ETHERNET_CONFIG_TYPE_PORTS_NUM, + ETHERNET_CONFIG_TYPE_T1S_PARAM, }; enum ethernet_qav_param_type { @@ -206,7 +207,53 @@ enum ethernet_qav_param_type { ETHERNET_QAV_PARAM_TYPE_STATUS, }; +enum ethernet_t1s_param_type { + ETHERNET_T1S_PARAM_TYPE_PLCA_CONFIG, +}; + /** @endcond */ +struct ethernet_t1s_param { + /** Type of T1S parameter */ + enum ethernet_t1s_param_type type; + union { + /* PLCA is the Physical Layer (PHY) Collision + * Avoidance technique employed with multidrop + * 10Base-T1S standard. + * + * The PLCA parameters are described in standard [1] + * as registers in memory map 4 (MMS = 4) (point 9.6). + * + * IDVER (PLCA ID Version) + * CTRL0 (PLCA Control 0) + * CTRL1 (PLCA Control 1) + * STATUS (PLCA Status) + * TOTMR (PLCA TO Control) + * BURST (PLCA Burst Control) + * + * Those registers are implemented by each OA TC6 + * compliant vendor (like for e.g. LAN865x - e.g. [2]). + * + * Documents: + * [1] - "OPEN Alliance 10BASE-T1x MAC-PHY Serial + * Interface" (ver. 1.1) + * [2] - "DS60001734C" - LAN865x data sheet + */ + struct { + /** T1S PLCA enabled */ + bool enable; + /** T1S PLCA node id range: 0 to 254 */ + uint8_t node_id; + /** T1S PLCA node count range: 1 to 255 */ + uint8_t node_count; + /** T1S PLCA burst count range: 0x0 to 0xFF */ + uint8_t burst_count; + /** T1S PLCA burst timer */ + uint8_t burst_timer; + /** T1S PLCA TO value */ + uint8_t to_timer; + } plca; + }; +}; struct ethernet_qav_param { /** ID of the priority queue to use */ @@ -404,6 +451,7 @@ struct ethernet_config { struct net_eth_addr mac_address; + struct ethernet_t1s_param t1s_param; struct ethernet_qav_param qav_param; struct ethernet_qbv_param qbv_param; struct ethernet_qbu_param qbu_param; diff --git a/include/zephyr/net/ethernet_mgmt.h b/include/zephyr/net/ethernet_mgmt.h index 9d95fa7a42e..32a38f2df88 100644 --- a/include/zephyr/net/ethernet_mgmt.h +++ b/include/zephyr/net/ethernet_mgmt.h @@ -51,6 +51,7 @@ enum net_request_ethernet_cmd { NET_REQUEST_ETHERNET_CMD_GET_QBV_PARAM, NET_REQUEST_ETHERNET_CMD_GET_QBU_PARAM, NET_REQUEST_ETHERNET_CMD_GET_TXTIME_PARAM, + NET_REQUEST_ETHERNET_CMD_SET_T1S_PARAM, }; #define NET_REQUEST_ETHERNET_SET_AUTO_NEGOTIATION \ @@ -128,6 +129,11 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_QBU_PARAM); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXTIME_PARAM); +#define NET_REQUEST_ETHERNET_SET_T1S_PARAM \ + (_NET_ETHERNET_BASE | NET_REQUEST_ETHERNET_CMD_SET_T1S_PARAM) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_T1S_PARAM); + struct net_eth_addr; struct ethernet_qav_param; struct ethernet_qbv_param; @@ -152,6 +158,7 @@ struct ethernet_req_params { struct ethernet_qbv_param qbv_param; struct ethernet_qbu_param qbu_param; struct ethernet_txtime_param txtime_param; + struct ethernet_t1s_param t1s_param; int priority_queues_num; int ports_num; diff --git a/subsys/net/l2/ethernet/ethernet_mgmt.c b/subsys/net/l2/ethernet/ethernet_mgmt.c index e7fcae8ac99..3e957e52c1e 100644 --- a/subsys/net/l2/ethernet/ethernet_mgmt.c +++ b/subsys/net/l2/ethernet/ethernet_mgmt.c @@ -192,6 +192,14 @@ static int ethernet_set_config(uint32_t mgmt_request, config.promisc_mode = params->promisc_mode; type = ETHERNET_CONFIG_TYPE_PROMISC_MODE; + } else if (mgmt_request == NET_REQUEST_ETHERNET_SET_T1S_PARAM) { + if (net_if_is_up(iface)) { + return -EACCES; + } + + memcpy(&config.t1s_param, ¶ms->t1s_param, + sizeof(struct ethernet_t1s_param)); + type = ETHERNET_CONFIG_TYPE_T1S_PARAM; } else { return -EINVAL; } @@ -226,6 +234,9 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_TXTIME_PARAM, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_PROMISC_MODE, ethernet_set_config); +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_T1S_PARAM, + ethernet_set_config); + static int ethernet_get_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) From fafa7e12081d7e748599fb82a0f9fa6bc9e742fb Mon Sep 17 00:00:00 2001 From: Vivekananda Uppunda Date: Mon, 22 Jan 2024 10:08:03 +0530 Subject: [PATCH 0205/2300] [nrf fromtree] net: l2: ethernet: bring in TX-Injection mode to l2 ethernet This set of changes brings in raw packet tx injection mode feature to ethernet and removes it from being a Wi-Fi only feature. It was earlier envisaged as Wi-Fi net management feature only. Signed-off-by: Vivekananda Uppunda (cherry picked from commit db4bf8d409ce7d0b8b96363e868258d99ba2d28f) (cherry picked from commit f1f5d375838a07cf2c0d0669cec91a7133508d62) --- include/zephyr/net/ethernet.h | 16 ++++++++++++++++ include/zephyr/net/ethernet_mgmt.h | 13 +++++++++++++ subsys/net/l2/ethernet/ethernet.c | 14 ++++++++++++++ subsys/net/l2/ethernet/ethernet_mgmt.c | 26 ++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) diff --git a/include/zephyr/net/ethernet.h b/include/zephyr/net/ethernet.h index 181503140a7..faa6cf7fc0b 100644 --- a/include/zephyr/net/ethernet.h +++ b/include/zephyr/net/ethernet.h @@ -179,6 +179,9 @@ enum ethernet_hw_caps { /** TXTIME supported */ ETHERNET_TXTIME = BIT(19), + + /** TX-Injection supported */ + ETHERNET_TXINJECTION_MODE = BIT(20), }; /** @cond INTERNAL_HIDDEN */ @@ -197,6 +200,7 @@ enum ethernet_config_type { ETHERNET_CONFIG_TYPE_FILTER, ETHERNET_CONFIG_TYPE_PORTS_NUM, ETHERNET_CONFIG_TYPE_T1S_PARAM, + ETHERNET_CONFIG_TYPE_TXINJECTION_MODE, }; enum ethernet_qav_param_type { @@ -442,6 +446,7 @@ struct ethernet_config { bool auto_negotiation; bool full_duplex; bool promisc_mode; + bool txinjection_mode; struct { bool link_10bt; @@ -1029,6 +1034,17 @@ void net_eth_carrier_off(struct net_if *iface); */ int net_eth_promisc_mode(struct net_if *iface, bool enable); +/** + * @brief Set TX-Injection mode either ON or OFF. + * + * @param iface Network interface + * + * @param enable on (true) or off (false) + * + * @return 0 if mode set or unset was successful, <0 otherwise. + */ +int net_eth_txinjection_mode(struct net_if *iface, bool enable); + /** * @brief Return PTP clock that is tied to this ethernet network interface. * diff --git a/include/zephyr/net/ethernet_mgmt.h b/include/zephyr/net/ethernet_mgmt.h index 32a38f2df88..18039e9f3aa 100644 --- a/include/zephyr/net/ethernet_mgmt.h +++ b/include/zephyr/net/ethernet_mgmt.h @@ -52,6 +52,8 @@ enum net_request_ethernet_cmd { NET_REQUEST_ETHERNET_CMD_GET_QBU_PARAM, NET_REQUEST_ETHERNET_CMD_GET_TXTIME_PARAM, NET_REQUEST_ETHERNET_CMD_SET_T1S_PARAM, + NET_REQUEST_ETHERNET_CMD_SET_TXINJECTION_MODE, + NET_REQUEST_ETHERNET_CMD_GET_TXINJECTION_MODE, }; #define NET_REQUEST_ETHERNET_SET_AUTO_NEGOTIATION \ @@ -134,6 +136,16 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXTIME_PARAM); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_T1S_PARAM); +#define NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE \ + (_NET_ETHERNET_BASE | NET_REQUEST_ETHERNET_CMD_SET_TXINJECTION_MODE) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE); + +#define NET_REQUEST_ETHERNET_GET_TXINJECTION_MODE \ + (_NET_ETHERNET_BASE | NET_REQUEST_ETHERNET_CMD_GET_TXINJECTION_MODE) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXINJECTION_MODE); + struct net_eth_addr; struct ethernet_qav_param; struct ethernet_qbv_param; @@ -145,6 +157,7 @@ struct ethernet_req_params { bool auto_negotiation; bool full_duplex; bool promisc_mode; + bool txinjection_mode; struct { bool link_10bt; diff --git a/subsys/net/l2/ethernet/ethernet.c b/subsys/net/l2/ethernet/ethernet.c index 2be3c5f2820..8e73e8bcd43 100644 --- a/subsys/net/l2/ethernet/ethernet.c +++ b/subsys/net/l2/ethernet/ethernet.c @@ -1197,6 +1197,20 @@ int net_eth_promisc_mode(struct net_if *iface, bool enable) } #endif/* CONFIG_NET_PROMISCUOUS_MODE */ +int net_eth_txinjection_mode(struct net_if *iface, bool enable) +{ + struct ethernet_req_params params; + + if (!(net_eth_get_hw_capabilities(iface) & ETHERNET_TXINJECTION_MODE)) { + return -ENOTSUP; + } + + params.txinjection_mode = enable; + + return net_mgmt(NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE, iface, + ¶ms, sizeof(struct ethernet_req_params)); +} + void ethernet_init(struct net_if *iface) { struct ethernet_context *ctx = net_if_l2_data(iface); diff --git a/subsys/net/l2/ethernet/ethernet_mgmt.c b/subsys/net/l2/ethernet/ethernet_mgmt.c index 3e957e52c1e..899aa7a9516 100644 --- a/subsys/net/l2/ethernet/ethernet_mgmt.c +++ b/subsys/net/l2/ethernet/ethernet_mgmt.c @@ -200,6 +200,13 @@ static int ethernet_set_config(uint32_t mgmt_request, memcpy(&config.t1s_param, ¶ms->t1s_param, sizeof(struct ethernet_t1s_param)); type = ETHERNET_CONFIG_TYPE_T1S_PARAM; + } else if (mgmt_request == NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE) { + if (!is_hw_caps_supported(dev, ETHERNET_TXINJECTION_MODE)) { + return -ENOTSUP; + } + + config.txinjection_mode = params->txinjection_mode; + type = ETHERNET_CONFIG_TYPE_TXINJECTION_MODE; } else { return -EINVAL; } @@ -237,6 +244,9 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_PROMISC_MODE, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_T1S_PARAM, ethernet_set_config); +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE, + ethernet_set_config); + static int ethernet_get_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) @@ -430,6 +440,19 @@ static int ethernet_get_config(uint32_t mgmt_request, config.txtime_param.enable_txtime; break; } + } else if (mgmt_request == NET_REQUEST_ETHERNET_GET_TXINJECTION_MODE) { + if (!is_hw_caps_supported(dev, ETHERNET_TXINJECTION_MODE)) { + return -ENOTSUP; + } + + type = ETHERNET_CONFIG_TYPE_TXINJECTION_MODE; + + ret = api->get_config(dev, type, &config); + if (ret) { + return ret; + } + + params->txinjection_mode = config.txinjection_mode; } else { return -EINVAL; } @@ -455,6 +478,9 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_QBU_PARAM, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXTIME_PARAM, ethernet_get_config); +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXINJECTION_MODE, + ethernet_get_config); + void ethernet_mgmt_raise_carrier_on_event(struct net_if *iface) { net_mgmt_event_notify(NET_EVENT_ETHERNET_CARRIER_ON, iface); From 50e4e100d027724505a049264607ac2dac76d2b0 Mon Sep 17 00:00:00 2001 From: Vivekananda Uppunda Date: Mon, 22 Jan 2024 12:30:53 +0530 Subject: [PATCH 0206/2300] [nrf fromtree] net: wifi_shell: Remove TX-Injection and Promisc mode Remove TX-Injection and Promiscuous mode setting from Wi-Fi mode shell command. These commands are being moved to ethernet l2 layer Signed-off-by: Vivekananda Uppunda (cherry picked from commit 7eb0aa04689b3086bf513f30531747393d86007b) (cherry picked from commit f923004850f7ae85f2b02bf339edc69a4e9b0172) --- subsys/net/l2/wifi/wifi_shell.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 5a3d7e632a7..d70e48024b7 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1539,8 +1539,6 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, static struct option long_options[] = {{"if-index", optional_argument, 0, 'i'}, {"sta", no_argument, 0, 's'}, {"monitor", no_argument, 0, 'm'}, - {"tx-injection", no_argument, 0, 't'}, - {"promiscuous", no_argument, 0, 'p'}, {"ap", no_argument, 0, 'a'}, {"softap", no_argument, 0, 'k'}, {"get", no_argument, 0, 'g'}, @@ -1555,12 +1553,6 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, case 'm': mode->mode |= WIFI_MONITOR_MODE; break; - case 't': - mode->mode |= WIFI_TX_INJECTION_MODE; - break; - case 'p': - mode->mode |= WIFI_PROMISCUOUS_MODE; - break; case 'a': mode->mode |= WIFI_AP_MODE; break; @@ -1962,8 +1954,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-i, --if-index ] : Interface index\n" "[-s, --sta] : Station mode\n" "[-m, --monitor] : Monitor mode\n" - "[-p, --promiscuous] : Promiscuous mode\n" - "[-t, --tx-injection] : TX-Injection mode\n" "[-a, --ap] : AP mode\n" "[-k, --softap] : Softap mode\n" "[-h, --help] : Help\n" From b8954741257946674b21f10697585f7da4e355dc Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Tue, 23 Jan 2024 14:36:55 +0100 Subject: [PATCH 0207/2300] [nrf fromtree] drivers: ieee802154: fix ACK header IE implementation - In `set_vendor_ie_header_lm`, case when `link_metrics_data_len == 0` has been ignored. This commit fixes that by setting `header_ie->length = 0` before returning. - current implementation of enh ACK header IE returns `-ENOTSUP` when `ack_ie.header_ie == NULL` or `ack_ie.header_ie->length == 0`. This commit fixes that by refactoring checks in `nrf5_configure`. Co-authored-by: Przemyslaw Bida Signed-off-by: Maciej Baczmanski (cherry picked from commit d76bcd346ce7b9ede5144114fc357859e6a5d610) (cherry picked from commit 02e7e0f34df3ded888a736debf84573094d8af6c) --- drivers/ieee802154/ieee802154_nrf5.c | 38 ++++++++++++++-------------- modules/openthread/platform/radio.c | 13 ++++------ 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 741979a6810..dfb63eba476 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -885,35 +885,38 @@ static int nrf5_configure(const struct device *dev, uint8_t ext_addr_le[EXTENDED_ADDRESS_SIZE]; uint8_t short_addr_le[SHORT_ADDRESS_SIZE]; uint8_t element_id; + bool valid_vendor_specific_ie = false; if (config->ack_ie.short_addr == IEEE802154_BROADCAST_ADDRESS || config->ack_ie.ext_addr == NULL) { return -ENOTSUP; } - element_id = ieee802154_header_ie_get_element_id(config->ack_ie.header_ie); + sys_put_le16(config->ack_ie.short_addr, short_addr_le); + sys_memcpy_swap(ext_addr_le, config->ack_ie.ext_addr, EXTENDED_ADDRESS_SIZE); - if (element_id != IEEE802154_HEADER_IE_ELEMENT_ID_CSL_IE && - (!IS_ENABLED(CONFIG_NET_L2_OPENTHREAD) || - element_id != IEEE802154_HEADER_IE_ELEMENT_ID_VENDOR_SPECIFIC_IE)) { - return -ENOTSUP; - } + 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); + 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); #if defined(CONFIG_NET_L2_OPENTHREAD) - uint8_t vendor_oui_le[IEEE802154_OPENTHREAD_VENDOR_OUI_LEN] = - IEEE802154_OPENTHREAD_THREAD_IE_VENDOR_OUI; + uint8_t vendor_oui_le[IEEE802154_OPENTHREAD_VENDOR_OUI_LEN] = + IEEE802154_OPENTHREAD_THREAD_IE_VENDOR_OUI; - if (element_id == IEEE802154_HEADER_IE_ELEMENT_ID_VENDOR_SPECIFIC_IE && - memcmp(config->ack_ie.header_ie->content.vendor_specific.vendor_oui, - vendor_oui_le, sizeof(vendor_oui_le))) { - return -ENOTSUP; - } + if (element_id == IEEE802154_HEADER_IE_ELEMENT_ID_VENDOR_SPECIFIC_IE && + memcmp(config->ack_ie.header_ie->content.vendor_specific.vendor_oui, + vendor_oui_le, sizeof(vendor_oui_le)) == 0) { + valid_vendor_specific_ie = true; + } #endif - sys_put_le16(config->ack_ie.short_addr, short_addr_le); - sys_memcpy_swap(ext_addr_le, config->ack_ie.ext_addr, EXTENDED_ADDRESS_SIZE); + if (element_id != IEEE802154_HEADER_IE_ELEMENT_ID_CSL_IE && + !valid_vendor_specific_ie) { + return -ENOTSUP; + } - if (config->ack_ie.header_ie && config->ack_ie.header_ie->length > 0) { 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, @@ -922,9 +925,6 @@ static int nrf5_configure(const struct device *dev, config->ack_ie.header_ie->length + IEEE802154_HEADER_IE_HEADER_LENGTH, NRF_802154_ACK_DATA_IE); - } else { - 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); } } break; diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index cec73e3ef6f..a26c66d875d 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1348,7 +1348,7 @@ uint8_t otPlatRadioGetCslUncertainty(otInstance *aInstance) * | IE_VENDOR_THREAD_ACK_PROBING_ID | LINK_METRIC_TOKEN | LINK_METRIC_TOKEN| * |---------------------------------|-------------------|------------------| */ -static uint8_t set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, uint8_t *ie_header) +static void set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, uint8_t *ie_header) { /* Vendor-specific IE identifier */ const uint8_t ie_vendor_id = 0x00; @@ -1362,7 +1362,6 @@ static uint8_t set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, ui const uint8_t ie_vendor_thread_margin_token = 0x02; /* Thread Vendor-specific ACK Probing IE LQI value placeholder */ const uint8_t ie_vendor_thread_lqi_token = 0x03; - const uint8_t ie_header_size = 2; const uint8_t oui_size = 3; const uint8_t sub_type = 1; const uint8_t id_offset = 7; @@ -1380,7 +1379,8 @@ static uint8_t set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, ui __ASSERT(ie_header, "Invalid argument"); if (link_metrics_data_len == 0) { - return 0; + ie_header[0] = 0; + return; } /* Set Element ID */ @@ -1415,8 +1415,6 @@ static uint8_t set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, ui if (rssi) { ie_header[link_metrics_idx++] = ie_vendor_thread_rssi_token; } - - return ie_header_size + content_len; } otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics aLinkMetrics, @@ -1428,13 +1426,12 @@ otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics a .ack_ie.ext_addr = aExtAddress->m8, }; uint8_t header_ie_buf[OT_ACK_IE_MAX_SIZE]; - uint16_t header_ie_len; int result; ARG_UNUSED(aInstance); - header_ie_len = set_vendor_ie_header_lm(aLinkMetrics.mLqi, aLinkMetrics.mLinkMargin, - aLinkMetrics.mRssi, header_ie_buf); + set_vendor_ie_header_lm(aLinkMetrics.mLqi, aLinkMetrics.mLinkMargin, + aLinkMetrics.mRssi, header_ie_buf); config.ack_ie.header_ie = (struct ieee802154_header_ie *)header_ie_buf; result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); From f13234ced630404dbf4cb3eec5059a4cbfcc4fdb Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Tue, 23 Jan 2024 14:55:09 +0100 Subject: [PATCH 0208/2300] [nrf fromtree] drivers: ieee802154: fix handling of `struct ieee802154_config` `struct ieee802154_config config` is a struct containing an union. Members of `config` were accessed incorrectly in `otPlatRadioEnableCsl`. Fix by initializing `config` with `0` and accessing one member at a time. Signed-off-by: Maciej Baczmanski (cherry picked from commit 36b7f44c1d37e842048773f3ad11af59f7b465bb) (cherry picked from commit 93c590c3a81e738e59a95db384c58a8fbe73b762) --- modules/openthread/platform/radio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index a26c66d875d..c0df98367af 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1255,10 +1255,7 @@ void otPlatRadioSetMacFrameCounterIfLarger(otInstance *aInstance, uint32_t aMacF otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShortAddress aShortAddr, const otExtAddress *aExtAddr) { - struct ieee802154_config config = { - .ack_ie.short_addr = aShortAddr, - .ack_ie.ext_addr = aExtAddr->m8, - }; + struct ieee802154_config config = { 0 }; int result; ARG_UNUSED(aInstance); @@ -1271,6 +1268,8 @@ otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShort if (result) { return OT_ERROR_FAILED; } + config.ack_ie.short_addr = aShortAddr; + config.ack_ie.ext_addr = aExtAddr != NULL ? aExtAddr->m8 : NULL; /* Configure the CSL IE. */ if (aCslPeriod > 0) { From 69d2df6d19be8abacadfe9db098036dc9e2e3e49 Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Tue, 23 Jan 2024 14:56:03 +0100 Subject: [PATCH 0209/2300] [nrf fromtree] net: openthread: upmerge to `7761b81` additionaly, implement `otPlatRadioResetCsl` functionality Signed-off-by: Maciej Baczmanski (cherry picked from commit 0f1747e4e73fa1db67f65dfb251d202e8d552db6) (cherry picked from commit b3c97b010983e5523d90f9140b8e657b06a2ea3f) --- drivers/ieee802154/ieee802154_nrf5.c | 6 ++++++ include/zephyr/net/ieee802154_radio.h | 9 +++++++++ modules/openthread/platform/radio.c | 16 ++++++++++++++++ west.yml | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index dfb63eba476..1831a5b4a6a 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -887,6 +887,12 @@ static int nrf5_configure(const struct device *dev, uint8_t element_id; bool valid_vendor_specific_ie = false; + if (config->ack_ie.purge_ie) { + nrf_802154_ack_data_remove_all(false, NRF_802154_ACK_DATA_IE); + nrf_802154_ack_data_remove_all(true, NRF_802154_ACK_DATA_IE); + break; + } + if (config->ack_ie.short_addr == IEEE802154_BROADCAST_ADDRESS || config->ack_ie.ext_addr == NULL) { return -ENOTSUP; diff --git a/include/zephyr/net/ieee802154_radio.h b/include/zephyr/net/ieee802154_radio.h index de0cf89da4c..259d67b4321 100644 --- a/include/zephyr/net/ieee802154_radio.h +++ b/include/zephyr/net/ieee802154_radio.h @@ -1241,6 +1241,15 @@ struct ieee802154_config { * in CPU byte order */ uint16_t short_addr; + + /** + * Flag for purging enh ACK header IEs. + * When flag is set to true, driver should remove all existing + * header IEs, and all other entries in config should be ignored. + * This means that purging current header IEs and + * configuring a new one in the same call is not allowed. + */ + bool purge_ie; } ack_ie; }; }; diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index c0df98367af..d405539bcc0 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1294,6 +1294,22 @@ otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShort return result ? OT_ERROR_FAILED : OT_ERROR_NONE; } +otError otPlatRadioResetCsl(otInstance *aInstance) +{ + struct ieee802154_config config = { 0 }; + int result; + + result = radio_api->configure(radio_dev, IEEE802154_CONFIG_CSL_PERIOD, &config); + if (result) { + return OT_ERROR_FAILED; + } + + config.ack_ie.purge_ie = true; + result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); + + return result ? OT_ERROR_FAILED : OT_ERROR_NONE; +} + void otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTime) { ARG_UNUSED(aInstance); diff --git a/west.yml b/west.yml index 2892d3db451..ea8352aa7cf 100644 --- a/west.yml +++ b/west.yml @@ -301,7 +301,7 @@ manifest: revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 path: modules/lib/open-amp - name: openthread - revision: 00076aff3ae571db7c90509ec9dc293457098c35 + revision: 7761b81d23b10b3d5ee21b8504c67535cde10896 path: modules/lib/openthread - name: percepio path: modules/debug/percepio From b8110a76319fa80642c5487f6abc4757ea9a6b40 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Fri, 12 Jan 2024 11:30:23 +0100 Subject: [PATCH 0210/2300] [nrf fromtree] Bluetooth: Mesh: Fix dereferencing before null pointer check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't dereference pointer until it is checked on NULL. Fixes: #66805 Coverity-CID: 338098 Signed-off-by: Pavel Vasilyev (cherry picked from commit 27b1f4eb7f9d887d8fda81cbdc52f651223e75e9) Signed-off-by: Håvard Reierstad (cherry picked from commit c790da9970699f7271c096b66328fb531f4dc2ff) --- subsys/bluetooth/mesh/delayable_msg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/delayable_msg.c b/subsys/bluetooth/mesh/delayable_msg.c index 5fa43205d63..a1a247bb9c9 100644 --- a/subsys/bluetooth/mesh/delayable_msg.c +++ b/subsys/bluetooth/mesh/delayable_msg.c @@ -167,13 +167,15 @@ static bool push_msg_from_delayable_msgs(void) sys_snode_t *node; struct delayable_msg_chunk *chunk; struct delayable_msg_ctx *msg = peek_pending_msg(); - uint16_t len = msg->len; + uint16_t len; int err; if (!msg) { return false; } + len = msg->len; + NET_BUF_SIMPLE_DEFINE(buf, BT_MESH_TX_SDU_MAX); SYS_SLIST_FOR_EACH_NODE(&msg->chunks, node) { From a6a56ef4246671b04bf89cd61cb57948eada25a1 Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Tue, 9 Jan 2024 15:22:29 +0100 Subject: [PATCH 0211/2300] [nrf fromtree] Bluetooth: Mesh: enable access responses randomization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable by default the access layer responses random delays. Commit also adapts all mesh models, samples and babblesim tests to use random delay functionality correctly. Signed-off-by: Aleksandr Khromykh (cherry picked from commit 4e7d64b1b45247de1e1d71a4402f5637b0fd0afe) Signed-off-by: Håvard Reierstad (cherry picked from commit 7c3e830729b70943c82a7dd04ba33ed669894115) --- subsys/bluetooth/mesh/Kconfig | 15 +++++++++++++-- subsys/bluetooth/mesh/access.c | 10 ++++++++-- tests/bsim/bluetooth/mesh/src/test_access.c | 11 ++++++++--- tests/bsim/bluetooth/mesh/src/test_persistence.c | 6 ------ tests/bsim/bluetooth/mesh/src/test_provision.c | 10 ---------- .../access/access_transmit_delayable.sh | 2 +- .../priv_beacon/proxy_adv_multi_subnet_coex.sh | 4 ++++ 7 files changed, 34 insertions(+), 24 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index af6af8c44dc..555aac45bc0 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -639,6 +639,7 @@ config BT_MESH_LABEL_NO_RECOVER menuconfig BT_MESH_ACCESS_DELAYABLE_MSG bool "Access layer tx delayable message" + default y help Enable following of the message transmitting recommendations, the Access layer specification. The recommendations are optional. @@ -647,6 +648,16 @@ menuconfig BT_MESH_ACCESS_DELAYABLE_MSG if BT_MESH_ACCESS_DELAYABLE_MSG +config BT_MESH_ACCESS_DELAYABLE_MSG_CTX_ENABLED + bool "The delayable message in the notification message context" + default y + help + Controls whether the delayable message feature is enabled by default in + the message context of the opcode notifications. This allows the server part of any + model to not bother about additional context configuration to enable the delayable message. + Note that if this is disabled then all foundation models stop using the delayable message + functionality. + config BT_MESH_ACCESS_DELAYABLE_MSG_COUNT int "Number of simultaneously delayed messages" default 4 @@ -657,14 +668,14 @@ config BT_MESH_ACCESS_DELAYABLE_MSG_COUNT config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE int "Maximum delayable message storage chunk" - default 20 + default 10 help Size of memory that Access layer uses to split model message to. It allocates a sufficient number of these chunks from the pool to store the full model payload. config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT int "Maximum number of available chunks" - default 20 + default 40 help The maximum number of available chunks the Access layer allocates to store model payload. It is recommended to keep chunk size equal to the reasonable small value to prevent diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index c3ef6a40554..23fbb8e82c2 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -922,7 +922,7 @@ static void mod_publish(struct k_work *work) return; } - LOG_DBG("%u", k_uptime_get_32()); + LOG_DBG("timestamp: %u", k_uptime_get_32()); if (pub->count) { pub->count--; @@ -1504,6 +1504,10 @@ static int element_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple return ACCESS_STATUS_MESSAGE_NOT_UNDERSTOOD; } + if (IS_ENABLED(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CTX_ENABLED)) { + ctx->rnd_delay = true; + } + net_buf_simple_save(buf, &state); err = op->func(model, ctx, buf); net_buf_simple_restore(buf, &state); @@ -1578,7 +1582,9 @@ int bt_mesh_model_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx } #if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG - if (ctx->rnd_delay) { + /* No sense to use delayable message for unicast loopback. */ + if (ctx->rnd_delay && + !(bt_mesh_has_addr(ctx->addr) && BT_MESH_ADDR_IS_UNICAST(ctx->addr))) { return bt_mesh_delayable_msg_manage(ctx, msg, bt_mesh_model_elem(model)->rt->addr, cb, cb_data); } diff --git a/tests/bsim/bluetooth/mesh/src/test_access.c b/tests/bsim/bluetooth/mesh/src/test_access.c index 5cb7d2e28e1..6967aa6d71c 100644 --- a/tests/bsim/bluetooth/mesh/src/test_access.c +++ b/tests/bsim/bluetooth/mesh/src/test_access.c @@ -102,11 +102,15 @@ static bool publish_allow; static int model1_update(const struct bt_mesh_model *model) { - model->pub->msg->data[1]++; + if (!publish_allow) { + return -1; + } + model->pub->msg->data[1]++; LOG_DBG("New pub: n: %d t: %d", model->pub->msg->data[1], k_uptime_get_32()); + k_sem_give(&publish_sem); - return publish_allow ? k_sem_give(&publish_sem), 0 : -1; + return 0; } static int test_msgf_handler(const struct bt_mesh_model *model, @@ -604,7 +608,8 @@ static void recv_delayable_check(int32_t interval, uint8_t count) LOG_DBG("Recv time: %d delta: %d boundaries: %d/%d", (int32_t)timestamp, time_delta, lower_boundary, upper_boundary); - ASSERT_IN_RANGE(time_delta, lower_boundary, upper_boundary + RX_JITTER_MAX); + ASSERT_IN_RANGE(time_delta, lower_boundary - RX_JITTER_MAX, + upper_boundary + RX_JITTER_MAX); } } diff --git a/tests/bsim/bluetooth/mesh/src/test_persistence.c b/tests/bsim/bluetooth/mesh/src/test_persistence.c index ec7d838d26a..4bf1f9faa93 100644 --- a/tests/bsim/bluetooth/mesh/src/test_persistence.c +++ b/tests/bsim/bluetooth/mesh/src/test_persistence.c @@ -455,12 +455,6 @@ static void provisioner_setup(void) FAIL("Failed to add test_netkey (err: %d, status: %d)", err, status); } - err = bt_mesh_cfg_cli_net_transmit_set(test_netkey_idx, TEST_PROV_ADDR, - BT_MESH_TRANSMIT(3, 50), &status); - if (err || status != BT_MESH_TRANSMIT(3, 50)) { - FAIL("Net transmit set failed (err %d, transmit %x)", err, status); - } - provisioner_ready = true; } diff --git a/tests/bsim/bluetooth/mesh/src/test_provision.c b/tests/bsim/bluetooth/mesh/src/test_provision.c index 2bff871b187..3d0e8010c75 100644 --- a/tests/bsim/bluetooth/mesh/src/test_provision.c +++ b/tests/bsim/bluetooth/mesh/src/test_provision.c @@ -1205,7 +1205,6 @@ static void test_provisioner_pb_remote_client_nppi_robustness(void) uint16_t pb_remote_server_addr; uint8_t status; struct bt_mesh_cdb_node *node; - int err; provisioner_pb_remote_client_setup(); @@ -1219,15 +1218,6 @@ static void test_provisioner_pb_remote_client_nppi_robustness(void) .ttl = 3, }; - /* Set Network Transmit Count state on the remote client greater than on the remote server - * to increase probability of reception responses. - */ - err = bt_mesh_cfg_cli_net_transmit_set(0, current_dev_addr, BT_MESH_TRANSMIT(3, 50), - &status); - if (err || status != BT_MESH_TRANSMIT(3, 50)) { - FAIL("Net transmit set failed (err %d, transmit %x)", err, status); - } - ASSERT_OK(provision_remote(&srv, 2, &srv.addr)); /* Check device key by adding appkey. */ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh index 1622ac49f06..0e966288db0 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh @@ -14,4 +14,4 @@ RunTest mesh_access_pub_transmit_delayable_retr_1d1 \ conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_pub_transmit_delayable_retr_psa \ - access_tx_period_delayable access_rx_period_delayable + access_tx_transmit_delayable access_rx_transmit_delayable diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh index aa96ee325d8..42863a13458 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh @@ -22,6 +22,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # window. The Mesh Protocol specification does not specify exactly the # timing for Proxy ADV messages. +# Note 3: The proxy transmitting device mandates emitting of the secure +# network beacons. This allows to check that proxy goes back to normal +# behavior after the device advertises the secure network beacons. + # Test procedure: # 1. (0-20 seconds) A single subnet is active on the TX device with GATT # Proxy enabled. RX device verifies that the single subnet has exclusive From e0c92c46df4350dff6d4820ce29140a3ca0fdac1 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 26 Jan 2024 21:42:44 +0530 Subject: [PATCH 0212/2300] [nrf fromlist] wifi: shell: Add band support for STA For a Wi-Fi station the connect API supports both band and channel configuration, but for a shell command either channel or band makes sense, so, overload the channel field to support band. Rejig the band and channel validation to support all modes. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68174 Signed-off-by: Chaitanya Tata (cherry picked from commit 6994d092e1103ec8eaa65214d1d87164856334ac) --- subsys/net/l2/wifi/wifi_shell.c | 53 ++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d70e48024b7..7428a2a79e5 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -473,7 +473,14 @@ static int __wifi_args_to_params(size_t argc, char *argv[], /* Channel (optional: STA, mandatory: AP) */ if ((idx < argc) && (strlen(argv[idx]) <= 3)) { + uint8_t band; long channel = strtol(argv[idx], &endptr, 10); + const uint8_t all_bands[] = {WIFI_FREQ_BAND_2_4_GHZ, + WIFI_FREQ_BAND_5_GHZ, + WIFI_FREQ_BAND_6_GHZ}; + bool found = false; + char bands_str[MAX_BANDS_STR_LEN] = {0}; + size_t offset = 0; if (*endptr != '\0') { print(context.sh, SHELL_ERROR, @@ -484,23 +491,40 @@ static int __wifi_args_to_params(size_t argc, char *argv[], return -EINVAL; } - if (iface_mode == WIFI_MODE_INFRA && channel == 0) { - params->channel = WIFI_CHANNEL_ANY; + if (iface_mode == WIFI_MODE_INFRA) { + if (channel < 0) { + /* Negative channel means band */ + switch (-channel) { + case 2: + params->band = WIFI_FREQ_BAND_2_4_GHZ; + break; + case 5: + params->band = WIFI_FREQ_BAND_5_GHZ; + break; + case 6: + params->band = WIFI_FREQ_BAND_6_GHZ; + break; + default: + print(context.sh, SHELL_ERROR, + "Invalid band: %ld\n", channel); + return -EINVAL; + } + } } else { - const uint8_t bands[] = {WIFI_FREQ_BAND_2_4_GHZ, - WIFI_FREQ_BAND_5_GHZ, - WIFI_FREQ_BAND_6_GHZ}; - uint8_t band; - bool found = false; - char bands_str[MAX_BANDS_STR_LEN] = {0}; - size_t offset = 0; - - for (band = 0; band < ARRAY_SIZE(bands); band++) { + if (channel < 0) { + print(context.sh, SHELL_ERROR, + "Invalid channel: %ld\n", channel); + return -EINVAL; + } + } + + if (channel > 0) { + for (band = 0; band < ARRAY_SIZE(all_bands); band++) { offset += snprintf(bands_str + offset, sizeof(bands_str) - offset, "%s%s", band ? "," : "", - wifi_band_txt(bands[band])); + wifi_band_txt(all_bands[band])); if (offset >= sizeof(bands_str)) { print(context.sh, SHELL_ERROR, "Failed to parse channel: %s: " @@ -509,7 +533,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], return -EINVAL; } - if (wifi_utils_validate_chan(bands[band], + if (wifi_utils_validate_chan(all_bands[band], channel)) { found = true; break; @@ -1906,7 +1930,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD_ARG(connect, NULL, "Connect to a Wi-Fi AP\n" "\"\"\n" - "[channel number: 0 means all]\n" + "[channel number/band: > 0:Channel, 0:any channel,\n" + "< 0:band (-2:2.4GHz, -5:5GHz, -6:6GHz]\n" "[PSK: valid only for secure SSIDs]\n" "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" From 23ae71a580a8c1b56867f2c9ce002a6af6a0b2fd Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 31 Jan 2024 11:05:28 +0100 Subject: [PATCH 0213/2300] [nrf fromtree] Bluetooth: BAP: Update log for unicast iso recv without endpoint Since we always set up the ISO data path for endpoints in both directions (due to limitations in the ISO API), we can actually receive valid (empty) SDUs on a CIS in a direction that has not been configured. This is not the ideal solution, but prevents unncessary LOG_ERR. The ideal solution is to modify the ISO API to provide the flexibility that BAP needs w.r.t. ISO data paths, but that is a larger change for later. Signed-off-by: Emil Gydesen (cherry picked from commit 13a357b0198defde8f5c34920bec25b9ea2a0855) Signed-off-by: Alexander Svensen (cherry picked from commit 96325d267d652738e48d0be694f4b703d6912623) --- subsys/bluetooth/audio/ascs.c | 3 ++- subsys/bluetooth/audio/bap_unicast_client.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/audio/ascs.c b/subsys/bluetooth/audio/ascs.c index 6df91e5f43e..1709bc452d8 100644 --- a/subsys/bluetooth/audio/ascs.c +++ b/subsys/bluetooth/audio/ascs.c @@ -766,7 +766,8 @@ static void ascs_iso_recv(struct bt_iso_chan *chan, * host as HCI ISO data packets, which we should just ignore */ if ((info->flags & BT_ISO_FLAGS_VALID) != 0) { - LOG_ERR("iso %p not bound with ep", chan); + LOG_DBG("Valid ISO packet of len %zu received for iso %p not bound with ep", + net_buf_frags_len(buf), chan); } return; diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index b6de9b61a66..36938129773 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -231,7 +231,8 @@ static void unicast_client_ep_iso_recv(struct bt_iso_chan *chan, * host as HCI ISO data packets, which we should just ignore */ if ((info->flags & BT_ISO_FLAGS_VALID) != 0) { - LOG_ERR("iso %p not bound with ep", chan); + LOG_DBG("Valid ISO packet of len %zu received for iso %p not bound with ep", + net_buf_frags_len(buf), chan); } return; From a972da7bb50b86e68b0a7efd274077cdba3946e4 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Thu, 27 Apr 2023 15:40:36 +0530 Subject: [PATCH 0214/2300] [nrf fromtree] net: shell: Early wake up for TWT power save Provision of configurable parameter for generating unblock event ahead of TWT slot. Host application depending upon latencies can configure this to wakeup rpu ahead of the TWT slot. Signed-off-by: Ajay Parida (cherry picked from commit fc959fce475005b0e82ae1cfa91567190c4ff776) (cherry picked from commit df133beb17266a409cb25b3ef64cca1ed33a8e9f) --- include/zephyr/net/wifi_mgmt.h | 9 +++++++++ subsys/net/l2/wifi/wifi_shell.c | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index bd8cba81d28..982184a103b 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -498,6 +498,12 @@ struct wifi_twt_params { bool announce; /** Wake up time */ uint32_t twt_wake_interval; + /* Wake ahead notification is sent earlier than + * TWT Service period (SP) start based on this duration. + * This should give applications ample time to + * prepare the data before TWT SP starts. + */ + uint32_t twt_wake_ahead_duration; } setup; /** Teardown specific parameters */ struct { @@ -514,6 +520,7 @@ struct wifi_twt_params { #define WIFI_MAX_TWT_INTERVAL_US (LONG_MAX - 1) /* 256 (u8) * 1TU */ #define WIFI_MAX_TWT_WAKE_INTERVAL_US 262144 +#define WIFI_MAX_TWT_WAKE_AHEAD_DURATION_US (LONG_MAX - 1) /** Wi-Fi TWT flow information */ struct wifi_twt_flow_info { @@ -535,6 +542,8 @@ struct wifi_twt_flow_info { bool announce; /** Wake up time */ uint32_t twt_wake_interval; + /* wake ahead duration */ + uint32_t twt_wake_ahead_duration; }; /** Wi-Fi power save configuration */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 7428a2a79e5..2b131d4e0fb 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -975,6 +975,9 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) config.twt_flows[i].trigger, config.twt_flows[i].twt_wake_interval, config.twt_flows[i].twt_interval); + shell_fprintf(context.sh, SHELL_NORMAL, + "TWT Wake ahead duration : %d us\n", + config.twt_flows[i].twt_wake_ahead_duration); } } return 0; @@ -1133,7 +1136,7 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, context.sh = sh; - if (argc != 11) { + if (argc != 12) { shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); shell_help(sh); return -ENOEXEC; @@ -1193,6 +1196,11 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, } params.setup.twt_interval = (uint64_t)value; + if (!parse_number(sh, &value, argv[idx++], 0, WIFI_MAX_TWT_WAKE_AHEAD_DURATION_US)) { + return -EINVAL; + } + params.setup.twt_wake_ahead_duration = (uint32_t)value; + if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { shell_fprintf(sh, SHELL_WARNING, "%s with %s failed. reason : %s\n", wifi_twt_operation_txt(params.operation), @@ -1910,9 +1918,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, "\n" "\n" " " - " .\n", + " .\n" + ": 0us-2^31us>\n", cmd_wifi_twt_setup, - 11, 0), + 12, 0), SHELL_CMD_ARG(teardown, NULL, " Teardown a TWT flow:\n" "\n" "\n" From a48a5f40d14d07fd6d097057c6ff241d0167c6dd Mon Sep 17 00:00:00 2001 From: Kelly Helmut Lord Date: Thu, 21 Dec 2023 14:00:12 -0500 Subject: [PATCH 0215/2300] [nrf fromtree] drivers: qspi: added operation timeout Added Kconfig assignment of qspi timeout. Per nrfx v3.2 addition of qspi timeout in config struct. Signed-off-by: Kelly Helmut Lord (cherry picked from commit abafe9bbe24c5bb2c377702db1ba3d1d2cd8379a) (cherry picked from commit 41e34920abf4f6407178d8ce8bd78a882840caec) --- drivers/flash/Kconfig.nordic_qspi_nor | 9 +++++++++ drivers/flash/nrf_qspi_nor.c | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/flash/Kconfig.nordic_qspi_nor b/drivers/flash/Kconfig.nordic_qspi_nor index aac9830835a..ff652f60822 100644 --- a/drivers/flash/Kconfig.nordic_qspi_nor +++ b/drivers/flash/Kconfig.nordic_qspi_nor @@ -50,4 +50,13 @@ config NORDIC_QSPI_NOR_XIP QSPI NOR flash chip is executed until the driver has been setup. This will also disable power management for the QSPI NOR flash chip. +config NORDIC_QSPI_NOR_TIMEOUT_MS + int "Timeout for QSPI operations (ms)" + default 500 + help + The QSPI peripheral operation timeout in milliseconds. + Primarily intended for long running operations such as + a flash sector erase. The 500 ms default allows for + most typical NOR flash chips to erase a sector. + endif # NORDIC_QSPI_NOR diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 0e9d4181418..c0e8c397d8e 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -1386,6 +1386,7 @@ static const struct qspi_nor_config qspi_nor_dev_config = { .sck_delay = DT_INST_PROP(0, sck_delay), .spi_mode = INST_0_SPI_MODE, }, + .nrfx_cfg.timeout = CONFIG_NORDIC_QSPI_NOR_TIMEOUT_MS, .size = INST_0_BYTES, .id = DT_INST_PROP(0, jedec_id), From 7607bf679ea95d560b2e99016dd552d0433cd790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 30 Oct 2023 15:56:34 +0100 Subject: [PATCH 0216/2300] [nrf fromtree] drivers: pinctrl_nrf: Fix pin drive configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the introduction of nrfx 3.0.0, values of `nrf_gpio_pin_drive_t` constants may be defined differently, depending on the SoC family. Since the nrf-pinctrl.h file is included also from dts files, it is not possible to use there different definitions of `NRF_GPIO_PIN_*` values based on Kconfig symbols that indicate given SoC family (as Kconfig is processed after devicetree) so that those values could still match `nrf_gpio_pin_drive_t` constants. To solve this problem, the pinctrl_nrf driver now uses a lookup table for mapping `NRF_GPIO_PIN_*` indexes to drive configuration values required by the GPIO HAL. Signed-off-by: Andrzej Głąbek (cherry picked from commit 7a9ff701d434801b6e7c4b0c4c118b69ea2adf92) (cherry picked from commit 2d6f48b6db0148155c9b7bd7809d4c73c77a4ee5) --- drivers/pinctrl/pinctrl_nrf.c | 48 ++++++++++++------- .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 3 +- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index c2ac538c93b..12ee1d52294 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -13,19 +13,24 @@ BUILD_ASSERT(((NRF_PULL_NONE == NRF_GPIO_PIN_NOPULL) && (NRF_PULL_UP == NRF_GPIO_PIN_PULLUP)), "nRF pinctrl pull settings do not match HAL values"); -BUILD_ASSERT(((NRF_DRIVE_S0S1 == NRF_GPIO_PIN_S0S1) && - (NRF_DRIVE_H0S1 == NRF_GPIO_PIN_H0S1) && - (NRF_DRIVE_S0H1 == NRF_GPIO_PIN_S0H1) && - (NRF_DRIVE_H0H1 == NRF_GPIO_PIN_H0H1) && - (NRF_DRIVE_D0S1 == NRF_GPIO_PIN_D0S1) && - (NRF_DRIVE_D0H1 == NRF_GPIO_PIN_D0H1) && - (NRF_DRIVE_S0D1 == NRF_GPIO_PIN_S0D1) && - (NRF_DRIVE_H0D1 == NRF_GPIO_PIN_H0D1) && -#if defined(GPIO_PIN_CNF_DRIVE_E0E1) - (NRF_DRIVE_E0E1 == NRF_GPIO_PIN_E0E1) && -#endif /* defined(GPIO_PIN_CNF_DRIVE_E0E1) */ - (1U)), - "nRF pinctrl drive settings do not match HAL values"); +#if defined(GPIO_PIN_CNF_DRIVE_E0E1) || defined(GPIO_PIN_CNF_DRIVE0_E0) +#define NRF_DRIVE_COUNT (NRF_DRIVE_E0E1 + 1) +#else +#define NRF_DRIVE_COUNT (NRF_DRIVE_H0D1 + 1) +#endif +static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { + [NRF_DRIVE_S0S1] = NRF_GPIO_PIN_S0S1, + [NRF_DRIVE_H0S1] = NRF_GPIO_PIN_H0S1, + [NRF_DRIVE_S0H1] = NRF_GPIO_PIN_S0H1, + [NRF_DRIVE_H0H1] = NRF_GPIO_PIN_H0H1, + [NRF_DRIVE_D0S1] = NRF_GPIO_PIN_D0S1, + [NRF_DRIVE_D0H1] = NRF_GPIO_PIN_D0H1, + [NRF_DRIVE_S0D1] = NRF_GPIO_PIN_S0D1, + [NRF_DRIVE_H0D1] = NRF_GPIO_PIN_H0D1, +#if defined(GPIO_PIN_CNF_DRIVE_E0E1) || defined(GPIO_PIN_CNF_DRIVE0_E0) + [NRF_DRIVE_E0E1] = NRF_GPIO_PIN_E0E1, +#endif +}; /* value to indicate pin level doesn't need initialization */ #define NO_WRITE UINT32_MAX @@ -86,12 +91,19 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) { for (uint8_t i = 0U; i < pin_cnt; i++) { - nrf_gpio_pin_drive_t drive = NRF_GET_DRIVE(pins[i]); + nrf_gpio_pin_drive_t drive; + uint8_t drive_idx = NRF_GET_DRIVE(pins[i]); uint32_t psel = NRF_GET_PIN(pins[i]); uint32_t write = NO_WRITE; nrf_gpio_pin_dir_t dir; nrf_gpio_pin_input_t input; + if (drive_idx < ARRAY_SIZE(drive_modes)) { + drive = drive_modes[drive_idx]; + } else { + return -EINVAL; + } + if (psel == NRF_PIN_DISCONNECTED) { psel = PSEL_DISCONNECTED; } @@ -165,22 +177,22 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, #if defined(NRF_PSEL_TWIM) case NRF_FUN_TWIM_SCL: NRF_PSEL_TWIM(reg, SCL) = psel; - if (drive == NRF_DRIVE_S0S1) { + if (drive == NRF_GPIO_PIN_S0S1) { /* Override the default drive setting with one * suitable for TWI/TWIM peripherals (S0D1). * This drive cannot be used always so that * users are able to select e.g. H0D1 or E0E1 * in devicetree. */ - drive = NRF_DRIVE_S0D1; + drive = NRF_GPIO_PIN_S0D1; } dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; break; case NRF_FUN_TWIM_SDA: NRF_PSEL_TWIM(reg, SDA) = psel; - if (drive == NRF_DRIVE_S0S1) { - drive = NRF_DRIVE_S0D1; + if (drive == NRF_GPIO_PIN_S0S1) { + drive = NRF_GPIO_PIN_S0D1; } dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index b2dcd7ae6c9..9d7f8c2312f 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -131,7 +131,6 @@ /** * @name nRF pinctrl output drive. - * @note Values match nrf_gpio_pin_drive_t constants. * @{ */ @@ -152,7 +151,7 @@ /** High drive '0', disconnect '1'. */ #define NRF_DRIVE_H0D1 7U /** Extra high drive '0', extra high drive '1'. */ -#define NRF_DRIVE_E0E1 11U +#define NRF_DRIVE_E0E1 8U /** @} */ From 3f30758c5daba7664ae0f5f6d49763535c4a6909 Mon Sep 17 00:00:00 2001 From: Adam Wojasinski Date: Wed, 15 Nov 2023 14:01:59 +0100 Subject: [PATCH 0217/2300] [nrf fromtree] modules: hal_nordic: watchdog: Add Kconfig symbols for new WDT instances This commit is a part of introduction of new WTD instances. It adds new Kconfig symbols that can be used in WDT shim and nrfx driver. Signed-off-by: Adam Wojasinski (cherry picked from commit 38739368dd449064325ab5ea773390d0becc09f7) (cherry picked from commit 29fcc2e7e45ecac0c926f1dce46b5466e454af59) --- modules/hal_nordic/nrfx/Kconfig | 15 +++++++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 9 +++++++++ soc/arm/nordic_nrf/Kconfig.peripherals | 9 +++++++++ 3 files changed, 33 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 5dcda73c9be..c4bfcc2d60e 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -561,6 +561,21 @@ config NRFX_WDT1 depends on $(dt_nodelabel_has_compat,wdt1,$(DT_COMPAT_NORDIC_NRF_WDT)) select NRFX_WDT +config NRFX_WDT30 + bool "WDT30 driver instance" + depends on $(dt_nodelabel_has_compat,wdt30,$(DT_COMPAT_NORDIC_NRF_WDT)) + select NRFX_WDT + +config NRFX_WDT31 + bool "WDT31 driver instance" + depends on $(dt_nodelabel_has_compat,wdt31,$(DT_COMPAT_NORDIC_NRF_WDT)) + select NRFX_WDT + +config NRFX_WDT130 + bool "WDT130 driver instance" + depends on $(dt_nodelabel_has_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) + select NRFX_WDT + menu "Peripheral Resource Sharing module" config NRFX_PRS diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index b5b09b96078..a285d1c86db 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -580,6 +580,15 @@ #ifdef CONFIG_NRFX_WDT1 #define NRFX_WDT1_ENABLED 1 #endif +#ifdef CONFIG_NRFX_WDT30 +#define NRFX_WDT30_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_WDT31 +#define NRFX_WDT31_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_WDT130 +#define NRFX_WDT130_ENABLED 1 +#endif #ifdef CONFIG_NRF52_ANOMALY_109_WORKAROUND #define NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index 3aacc35a08a..55f44ccbc21 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -401,3 +401,12 @@ config HAS_HW_NRF_WDT0 config HAS_HW_NRF_WDT1 def_bool $(dt_nodelabel_enabled_with_compat,wdt1,$(DT_COMPAT_NORDIC_NRF_WDT)) + +config HAS_HW_NRF_WDT30 + def_bool $(dt_nodelabel_enabled_with_compat,wdt30,$(DT_COMPAT_NORDIC_NRF_WDT)) + +config HAS_HW_NRF_WDT31 + def_bool $(dt_nodelabel_enabled_with_compat,wdt31,$(DT_COMPAT_NORDIC_NRF_WDT)) + +config HAS_HW_NRF_WDT130 + def_bool $(dt_nodelabel_enabled_with_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) From 04b12701d770ecbeefb3116dafa5649182fbf7da Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 4 Jan 2024 16:06:15 +0100 Subject: [PATCH 0218/2300] [nrf fromtree] dts: arm: add new gpiote instances definition Added GPIOTE0, GPIOTE1 instances for legacy devices, GPIOTE20, GPIOTE30 for Moonlight and GPIOTE130, GPIOTE131 instances for Haltium. Signed-off-by: Jakub Zymelka (cherry picked from commit dfbcc8911a94f01de22a90282de5a00b8a30ec12) (cherry picked from commit 6b4e21ce24af4bb6ebcdd2065219286593a1da00) --- dts/arm/nordic/nrf51822.dtsi | 4 +- dts/arm/nordic/nrf52805.dtsi | 4 +- dts/arm/nordic/nrf52810.dtsi | 4 +- dts/arm/nordic/nrf52811.dtsi | 4 +- dts/arm/nordic/nrf52820.dtsi | 4 +- dts/arm/nordic/nrf52832.dtsi | 4 +- dts/arm/nordic/nrf52833.dtsi | 5 +- dts/arm/nordic/nrf52840.dtsi | 5 +- dts/arm/nordic/nrf5340_cpuapp.dtsi | 17 ++++--- .../nordic/nrf5340_cpuapp_peripherals.dtsi | 2 + .../nordic/nrf5340_cpuapp_peripherals_ns.dtsi | 20 -------- dts/arm/nordic/nrf5340_cpuappns.dtsi | 22 +++++---- dts/arm/nordic/nrf5340_cpunet.dtsi | 5 +- dts/arm/nordic/nrf91.dtsi | 17 ++++++- dts/arm/nordic/nrf91_peripherals.dtsi | 1 + dts/arm/nordic/nrf91ns.dtsi | 9 +++- dts/bindings/gpio/nordic,nrf-gpio.yaml | 5 ++ dts/bindings/gpio/nordic,nrf-gpiote.yaml | 12 +++++ modules/hal_nordic/nrfx/Kconfig | 33 ++++++++++++- modules/hal_nordic/nrfx/nrfx_config.h | 21 ++++++--- .../nrfx/nrfx_config_nrf5340_application.h | 11 ++--- modules/hal_nordic/nrfx/nrfx_config_nrf91.h | 10 ++-- soc/arm/nordic_nrf/Kconfig.peripherals | 19 +++++++- soc/arm/nordic_nrf/common/soc_nrf_common.h | 46 +++++++++++++++++++ soc/arm/nordic_nrf/validate_base_addresses.c | 10 ++++ 25 files changed, 221 insertions(+), 73 deletions(-) delete mode 100644 dts/arm/nordic/nrf5340_cpuapp_peripherals_ns.dtsi diff --git a/dts/arm/nordic/nrf51822.dtsi b/dts/arm/nordic/nrf51822.dtsi index 222ccd4854c..020711a7e7f 100644 --- a/dts/arm/nordic/nrf51822.dtsi +++ b/dts/arm/nordic/nrf51822.dtsi @@ -131,11 +131,12 @@ status = "disabled"; }; - gpiote: gpiote@40006000 { + gpiote: gpiote0: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; + instance = <0>; }; adc: adc@40007000 { @@ -316,6 +317,7 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index dd7845588e7..a54e8eca9c6 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -132,11 +132,12 @@ status = "disabled"; }; - gpiote: gpiote@40006000 { + gpiote: gpiote0: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; + instance = <0>; }; adc: adc@40007000 { @@ -311,6 +312,7 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 82f5afb99f6..ce5a2bce779 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -136,11 +136,12 @@ status = "disabled"; }; - gpiote: gpiote@40006000 { + gpiote: gpiote0: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; + instance = <0>; }; adc: adc@40007000 { @@ -337,6 +338,7 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 9e03d5edb32..9c9a3fa6b77 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -167,11 +167,12 @@ status = "disabled"; }; - gpiote: gpiote@40006000 { + gpiote: gpiote0: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; + instance = <0>; }; adc: adc@40007000 { @@ -372,6 +373,7 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index 71ff85afbeb..c210a7c23aa 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -180,11 +180,12 @@ status = "disabled"; }; - gpiote: gpiote@40006000 { + gpiote: gpiote0: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; + instance = <0>; }; timer0: timer@40008000 { @@ -389,6 +390,7 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 69de3aa591a..2e1fd68946b 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -179,11 +179,12 @@ status = "okay"; }; - gpiote: gpiote@40006000 { + gpiote: gpiote0: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; + instance = <0>; }; adc: adc@40007000 { @@ -465,6 +466,7 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 8003649385c..d55f0f6df9e 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -186,11 +186,12 @@ status = "okay"; }; - gpiote: gpiote@40006000 { + gpiote: gpiote0: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; + instance = <0>; }; adc: adc@40007000 { @@ -521,6 +522,7 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; gpio1: gpio@50000300 { @@ -532,6 +534,7 @@ ngpios = <10>; status = "disabled"; port = <1>; + gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 24710e8e0ff..e833835198b 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -181,11 +181,12 @@ status = "okay"; }; - gpiote: gpiote@40006000 { + gpiote: gpiote0: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; + instance = <0>; }; adc: adc@40007000 { @@ -525,6 +526,7 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; gpio1: gpio@50000300 { @@ -536,6 +538,7 @@ ngpios = <16>; status = "disabled"; port = <1>; + gpiote-instance = <&gpiote>; }; cryptocell: crypto@5002a000 { diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index 77762990e13..bc6b5316519 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -84,6 +84,16 @@ reg = <0x5000d000 0x1000>; interrupts = <13 5>; status = "disabled"; + instance = <0>; + }; + + /* Additional Non-Secure GPIOTE instance */ + gpiote1: gpiote@4002f000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x4002f000 0x1000>; + interrupts = <47 5>; + status = "disabled"; + instance = <1>; }; cryptocell: crypto@50844000 { @@ -104,10 +114,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -/* - * Include the non-secure peripherals file here since - * it expects to be at the root level. This provides - * a node for GPIOTE1. - */ -#include "nrf5340_cpuapp_peripherals_ns.dtsi" diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index e7aa0309f70..afb839fcef4 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -526,6 +526,7 @@ gpio0: gpio@842500 { #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; gpio1: gpio@842800 { @@ -536,6 +537,7 @@ gpio1: gpio@842800 { ngpios = <16>; status = "disabled"; port = <1>; + gpiote-instance = <&gpiote>; }; ieee802154: ieee802154 { diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals_ns.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals_ns.dtsi deleted file mode 100644 index 5cfe561e613..00000000000 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals_ns.dtsi +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2019 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * GPIOTE1 is always accessible as a non-secure peripheral. - */ - -/ { - soc { - gpiote1: gpiote@4002f000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x4002f000 0x1000>; - interrupts = <47 5>; - status = "disabled"; - }; - }; -}; diff --git a/dts/arm/nordic/nrf5340_cpuappns.dtsi b/dts/arm/nordic/nrf5340_cpuappns.dtsi index b5278745e5d..aa97c337067 100644 --- a/dts/arm/nordic/nrf5340_cpuappns.dtsi +++ b/dts/arm/nordic/nrf5340_cpuappns.dtsi @@ -48,6 +48,19 @@ */ #include "nrf5340_cpuapp_peripherals.dtsi" }; + + /* + * GPIOTE1 is always accessible as a non-secure peripheral, + * so we give it the 'gpiote' label for use when building + * code for this target. + */ + gpiote: gpiote1: gpiote@4002f000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x4002f000 0x1000>; + interrupts = <47 5>; + status = "disabled"; + instance = <1>; + }; }; /* Default IPC description */ @@ -64,12 +77,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -/* - * Include the non-secure peripherals file here since - * it expects to be at the root level, adding a 'gpiote' label - * for the GPIOTE1 peripheral defined in that file which is - * always accessible as a non-secure peripheral. - */ -#include "nrf5340_cpuapp_peripherals_ns.dtsi" -gpiote: &gpiote1 {}; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index c1e8371d410..d930cf603c0 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -108,11 +108,12 @@ status = "okay"; }; - gpiote: gpiote@4100a000 { + gpiote: gpiote0: gpiote@4100a000 { compatible = "nordic,nrf-gpiote"; reg = <0x4100a000 0x1000>; interrupts = <10 5>; status = "disabled"; + instance = <0>; }; wdt: wdt0: watchdog@4100b000 { @@ -318,6 +319,7 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; gpio1: gpio@418c0800 { @@ -328,6 +330,7 @@ ngpios = <16>; status = "disabled"; port = <1>; + gpiote-instance = <&gpiote>; }; }; diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 46024011166..a9f067a7e5a 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -60,11 +60,26 @@ status = "okay"; }; - gpiote: gpiote@5000d000 { + /* + * GPIOTE0 is always accessible as a secure peripheral, + * so we give it the 'gpiote' label for use when building + * code for this target. + */ + gpiote: gpiote0: gpiote@5000d000 { compatible = "nordic,nrf-gpiote"; reg = <0x5000d000 0x1000>; interrupts = <13 5>; status = "disabled"; + instance = <0>; + }; + + /* Additional Non-Secure GPIOTE instance */ + gpiote1: gpiote@40031000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x40031000 0x1000>; + interrupts = <49 5>; + status = "disabled"; + instance = <1>; }; spu: spu@50003000 { diff --git a/dts/arm/nordic/nrf91_peripherals.dtsi b/dts/arm/nordic/nrf91_peripherals.dtsi index 2e437eb082d..12e61743bfe 100644 --- a/dts/arm/nordic/nrf91_peripherals.dtsi +++ b/dts/arm/nordic/nrf91_peripherals.dtsi @@ -313,6 +313,7 @@ gpio0: gpio@842500 { #gpio-cells = <2>; status = "disabled"; port = <0>; + gpiote-instance = <&gpiote>; }; rtc0: rtc@14000 { diff --git a/dts/arm/nordic/nrf91ns.dtsi b/dts/arm/nordic/nrf91ns.dtsi index 910f45ec706..23af6ebe37f 100644 --- a/dts/arm/nordic/nrf91ns.dtsi +++ b/dts/arm/nordic/nrf91ns.dtsi @@ -46,12 +46,17 @@ #include "nrf91_peripherals.dtsi" }; - /* Additional Non-Secure peripherals */ - gpiote: gpiote@40031000 { + /* + * GPIOTE1 is always accessible as a non-secure peripheral, + * so we give it the 'gpiote' label for use when building + * code for this target. + */ + gpiote: gpiote1: gpiote@40031000 { compatible = "nordic,nrf-gpiote"; reg = <0x40031000 0x1000>; interrupts = <49 5>; status = "disabled"; + instance = <1>; }; }; diff --git a/dts/bindings/gpio/nordic,nrf-gpio.yaml b/dts/bindings/gpio/nordic,nrf-gpio.yaml index 550acd1a865..097a99d8fa9 100644 --- a/dts/bindings/gpio/nordic,nrf-gpio.yaml +++ b/dts/bindings/gpio/nordic,nrf-gpio.yaml @@ -11,6 +11,11 @@ properties: reg: required: true + gpiote-instance: + type: phandle + description: | + GPIOTE instance that can be used with this GPIO port. + "#gpio-cells": const: 2 diff --git a/dts/bindings/gpio/nordic,nrf-gpiote.yaml b/dts/bindings/gpio/nordic,nrf-gpiote.yaml index 49ddba3595b..cefc3385afe 100644 --- a/dts/bindings/gpio/nordic,nrf-gpiote.yaml +++ b/dts/bindings/gpio/nordic,nrf-gpiote.yaml @@ -13,3 +13,15 @@ properties: interrupts: required: true + + instance: + type: int + required: true + description: | + The GPIOTE instance number. GPIOTE instance GPIOTE0 has: + + instance = <0>; + + And GPIOTE1 has: + + instance = <1>; diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index c4bfcc2d60e..a92aa93d9a2 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -63,8 +63,37 @@ config NRFX_EGU5 select NRFX_EGU config NRFX_GPIOTE - bool "GPIOTE driver" - depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + bool + +config NRFX_GPIOTE0 + bool "GPIOTE0 driver instance" + depends on $(dt_nodelabel_has_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + select NRFX_GPIOTE + +config NRFX_GPIOTE1 + bool "GPIOTE1 driver instance" + depends on $(dt_nodelabel_has_compat,gpiote1,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + select NRFX_GPIOTE + +config NRFX_GPIOTE20 + bool "NRFX_GPIOTE20 driver instance" + depends on $(dt_nodelabel_has_compat,gpiote20,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + select NRFX_GPIOTE + +config NRFX_GPIOTE30 + bool "NRFX_GPIOTE30 driver instance" + depends on $(dt_nodelabel_has_compat,gpiote30,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + select NRFX_GPIOTE + +config NRFX_GPIOTE130 + bool "NRFX_GPIOTE130 driver instance" + depends on $(dt_nodelabel_has_compat,gpiote130,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + select NRFX_GPIOTE + +config NRFX_GPIOTE131 + bool "NRFX_GPIOTE131 driver instance" + depends on $(dt_nodelabel_has_compat,gpiote131,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + select NRFX_GPIOTE config NRFX_GPIOTE_NUM_OF_EVT_HANDLERS int "Number of event handlers" diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index a285d1c86db..72617325684 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -117,15 +117,24 @@ #ifdef CONFIG_NRFX_GPIOTE #define NRFX_GPIOTE_ENABLED 1 -#if (defined(CONFIG_SOC_SERIES_NRF91X) || defined(CONFIG_SOC_SERIES_NRF53X)) \ - && defined(NRF_TRUSTZONE_NONSECURE) -#define NRFX_GPIOTE1_ENABLED 1 -#else +#endif +#ifdef CONFIG_NRFX_GPIOTE0 #define NRFX_GPIOTE0_ENABLED 1 #endif +#ifdef CONFIG_NRFX_GPIOTE1 +#define NRFX_GPIOTE1_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_GPIOTE20 +#define NRFX_GPIOTE20_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_GPIOTE30 +#define NRFX_GPIOTE30_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_GPIOTE130 +#define NRFX_GPIOTE130_ENABLED 1 #endif -#ifdef CONFIG_NRFX_GPIOTE_LOG -#define NRFX_GPIOTE_CONFIG_LOG_ENABLED 1 +#ifdef CONFIG_NRFX_GPIOTE131 +#define NRFX_GPIOTE131_ENABLED 1 #endif #ifdef CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h index 4a42f92ca98..18bcc40b2ac 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h @@ -83,6 +83,7 @@ * between secure and non-secure mapping. */ #if defined(NRF_TRUSTZONE_NONSECURE) +#define NRF_GPIOTE NRF_GPIOTE1 #define NRF_GPIOTE1 NRF_GPIOTE1_NS #else #define NRF_CACHE NRF_CACHE_S @@ -91,20 +92,14 @@ #define NRF_CRYPTOCELL NRF_CRYPTOCELL_S #define NRF_CTI NRF_CTI_S #define NRF_FICR NRF_FICR_S +#define NRF_GPIOTE NRF_GPIOTE0 #define NRF_GPIOTE0 NRF_GPIOTE0_S +#define NRF_GPIOTE1 NRF_GPIOTE1_NS #define NRF_SPU NRF_SPU_S #define NRF_TAD NRF_TAD_S #define NRF_UICR NRF_UICR_S #endif -/* Fixups for the GPIOTE driver. */ -#if defined(NRF_TRUSTZONE_NONSECURE) -#define NRF_GPIOTE NRF_GPIOTE1 -#else -#define NRF_GPIOTE NRF_GPIOTE0 -#endif - - /** * @brief NRFX_DEFAULT_IRQ_PRIORITY * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf91.h b/modules/hal_nordic/nrfx/nrfx_config_nrf91.h index 873be583a35..c6029a18628 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf91.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf91.h @@ -67,25 +67,21 @@ * between secure and non-secure mapping. */ #if defined(NRF_TRUSTZONE_NONSECURE) +#define NRF_GPIOTE NRF_GPIOTE1 #define NRF_GPIOTE1 NRF_GPIOTE1_NS #else #define NRF_CC_HOST_RGF NRF_CC_HOST_RGF_S #define NRF_CRYPTOCELL NRF_CRYPTOCELL_S #define NRF_CTRL_AP_PERI NRF_CTRL_AP_PERI_S #define NRF_FICR NRF_FICR_S +#define NRF_GPIOTE NRF_GPIOTE0 #define NRF_GPIOTE0 NRF_GPIOTE0_S +#define NRF_GPIOTE1 NRF_GPIOTE1_NS #define NRF_SPU NRF_SPU_S #define NRF_TAD NRF_TAD_S #define NRF_UICR NRF_UICR_S #endif -/* Fixups for the GPIOTE driver. */ -#if defined(NRF_TRUSTZONE_NONSECURE) -#define NRF_GPIOTE NRF_GPIOTE1 -#else -#define NRF_GPIOTE NRF_GPIOTE0 -#endif - /** * @brief NRFX_DEFAULT_IRQ_PRIORITY * diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index 55f44ccbc21..9e637f2661e 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -69,8 +69,23 @@ config HAS_HW_NRF_GPIO0 config HAS_HW_NRF_GPIO1 def_bool $(dt_nodelabel_enabled_with_compat,gpio1,$(DT_COMPAT_NORDIC_NRF_GPIO)) -config HAS_HW_NRF_GPIOTE - def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) +config HAS_HW_NRF_GPIOTE0 + def_bool $(dt_nodelabel_enabled_with_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + +config HAS_HW_NRF_GPIOTE1 + def_bool $(dt_nodelabel_enabled_with_compat,gpiote1,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + +config HAS_HW_NRF_GPIOTE20 + def_bool $(dt_nodelabel_enabled_with_compat,gpiote20,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + +config HAS_HW_NRF_GPIOTE30 + def_bool $(dt_nodelabel_enabled_with_compat,gpiote30,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + +config HAS_HW_NRF_GPIOTE130 + def_bool $(dt_nodelabel_enabled_with_compat,gpiote130,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) + +config HAS_HW_NRF_GPIOTE131 + def_bool $(dt_nodelabel_enabled_with_compat,gpiote131,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) config HAS_HW_NRF_I2S0 def_bool $(dt_nodelabel_enabled_with_compat,i2s0,$(DT_COMPAT_NORDIC_NRF_I2S)) diff --git a/soc/arm/nordic_nrf/common/soc_nrf_common.h b/soc/arm/nordic_nrf/common/soc_nrf_common.h index 4c00d7c0237..1e5e603967b 100644 --- a/soc/arm/nordic_nrf/common/soc_nrf_common.h +++ b/soc/arm/nordic_nrf/common/soc_nrf_common.h @@ -149,6 +149,52 @@ (NRF_DT_GPIOS_TO_PSEL(node_id, prop)), \ (default_value)) +/** + * @brief Convert a devicetree GPIO phandle+specifier to GPIOTE instance number. + * + * Some of nRF SoCs may have more instances of GPIOTE. + * To handle this, we use the "gpiote-instance" property of the GPIO node. + * + * This macro converts a devicetree GPIO phandle array value + * "<&gpioX pin ...>" to a GPIOTE instance number. + * + * Examples: + * + * &gpiote0 { + * instance = <0>; + * }; + * + * &gpiote20 { + * instance = <20>; + * }; + * + * &gpio0 { + * gpiote-instance = <&gpiote0>; + * } + * + * &gpio1 { + * gpiote-instance = <&gpiote20>; + * } + * + * foo: my-node { + * tx-gpios = <&gpio0 4 ...>; + * rx-gpios = <&gpio0 5 ...>, <&gpio1 5 ...>; + * }; + * + * NRF_DT_GPIOTE_INST_BY_IDX(DT_NODELABEL(foo), tx_gpios, 0) // = 0 + * NRF_DT_GPIOTE_INST_BY_IDX(DT_NODELABEL(foo), rx_gpios, 1) // = 20 + */ +#define NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, idx) \ + DT_PROP(DT_PHANDLE(DT_GPIO_CTLR_BY_IDX(node_id, prop, idx), \ + gpiote_instance), \ + instance) + +/** + * @brief Equivalent to NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, 0) + */ +#define NRF_DT_GPIOTE_INST(node_id, prop) \ + NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, 0) + /** * Error out the build if 'prop' is set on node 'node_id' and * DT_GPIO_CTLR(node_id, prop) is not an SoC GPIO controller, diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 58aaa5a7513..ee440c3252c 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -16,6 +16,10 @@ #define NRF_CTRLAP NRF_CTRL_AP_PERI #endif +#if !defined(NRF_GPIOTE0) && defined(NRF_GPIOTE) +#define NRF_GPIOTE0 NRF_GPIOTE +#endif + #if !defined(NRF_I2S0) && defined(NRF_I2S) #define NRF_I2S0 NRF_I2S #endif @@ -141,6 +145,12 @@ CHECK_DT_REG(flash_controller, NRF_NVMC); CHECK_DT_REG(gpio0, NRF_P0); CHECK_DT_REG(gpio1, NRF_P1); CHECK_DT_REG(gpiote, NRF_GPIOTE); +CHECK_DT_REG(gpiote0, NRF_GPIOTE0); +CHECK_DT_REG(gpiote1, NRF_GPIOTE1); +CHECK_DT_REG(gpiote20, NRF_GPIOTE20); +CHECK_DT_REG(gpiote30, NRF_GPIOTE30); +CHECK_DT_REG(gpiote130, NRF_GPIOTE130); +CHECK_DT_REG(gpiote131, NRF_GPIOTE131); CHECK_I2C_REG(i2c0, 0); CHECK_I2C_REG(i2c1, 1); CHECK_DT_REG(i2c2, NRF_TWIM2); From 4124c8175711fd79f92bc34fe479c95462c62c35 Mon Sep 17 00:00:00 2001 From: Wilfried Chauveau Date: Mon, 6 Nov 2023 13:58:00 +0000 Subject: [PATCH 0219/2300] [nrf fromtree] modules: cmsis: Move cortex_m default configuration to its own file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kconfig parameters, header’s default & silicon vendor’s SDK configuration for CMSIS Core, must be consistent. Depending on the inclusion order of the headers, this is currently not always the case. This change introduces consistency checks & enusers defaults match their Kconfig settings. Signed-off-by: Wilfried Chauveau (cherry picked from commit 8d91ba200fa3460c51c4c4da6e0b2fc2a7676f3c) (cherry picked from commit 2549254c509dadd16442eb761938959397b95388) --- modules/cmsis/cmsis_core_m.h | 88 +--------------- modules/cmsis/cmsis_core_m_defaults.h | 142 ++++++++++++++++++++++++++ soc/arm/arm/mps2/soc.h | 10 +- soc/arm/arm/mps3/soc.h | 15 +-- 4 files changed, 145 insertions(+), 110 deletions(-) create mode 100644 modules/cmsis/cmsis_core_m_defaults.h diff --git a/modules/cmsis/cmsis_core_m.h b/modules/cmsis/cmsis_core_m.h index 880ff614b5b..dc468ada364 100644 --- a/modules/cmsis/cmsis_core_m.h +++ b/modules/cmsis/cmsis_core_m.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017 Nordic Semiconductor ASA + * Copyright (c) 2023 Arm Limited * * SPDX-License-Identifier: Apache-2.0 */ @@ -18,91 +19,4 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - -/* Fill in CMSIS required values for non-CMSIS compliant SoCs. - * Use __NVIC_PRIO_BITS as it is required and simple to check, but - * ultimately all SoCs will define their own CMSIS types and constants. - */ -#ifndef __NVIC_PRIO_BITS -typedef enum { - Reset_IRQn = -15, - NonMaskableInt_IRQn = -14, - HardFault_IRQn = -13, -#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) - MemoryManagement_IRQn = -12, - BusFault_IRQn = -11, - UsageFault_IRQn = -10, -#if defined(CONFIG_ARM_SECURE_FIRMWARE) - SecureFault_IRQn = -9, -#endif /* CONFIG_ARM_SECURE_FIRMWARE */ -#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ - SVCall_IRQn = -5, - DebugMonitor_IRQn = -4, - PendSV_IRQn = -2, - SysTick_IRQn = -1, - Max_IRQn = CONFIG_NUM_IRQS, -} IRQn_Type; - -#if defined(CONFIG_CPU_CORTEX_M0) -#define __CM0_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M0PLUS) -#define __CM0PLUS_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M1) -#define __CM1_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M3) -#define __CM3_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M4) -#define __CM4_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M7) -#define __CM7_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M23) -#define __CM23_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M33) -#define __CM33_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M55) -#define __CM55_REV 0 -#else -#error "Unknown Cortex-M device" -#endif - -#ifndef __MPU_PRESENT -#define __MPU_PRESENT 0U -#endif -#define __NVIC_PRIO_BITS NUM_IRQ_PRIO_BITS -#define __Vendor_SysTickConfig 0 /* Default to standard SysTick */ -#endif /* __NVIC_PRIO_BITS */ - -#if __NVIC_PRIO_BITS != NUM_IRQ_PRIO_BITS -#error "NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value" -#endif - -#ifdef __cplusplus -} -#endif - -#if defined(CONFIG_CPU_CORTEX_M0) -#include -#elif defined(CONFIG_CPU_CORTEX_M0PLUS) -#include -#elif defined(CONFIG_CPU_CORTEX_M1) -#include -#elif defined(CONFIG_CPU_CORTEX_M3) -#include -#elif defined(CONFIG_CPU_CORTEX_M4) -#include -#elif defined(CONFIG_CPU_CORTEX_M7) -#include -#elif defined(CONFIG_CPU_CORTEX_M23) -#include -#elif defined(CONFIG_CPU_CORTEX_M33) -#include -#elif defined(CONFIG_CPU_CORTEX_M55) -#include -#else -#error "Unknown Cortex-M device" -#endif - #endif /* ZEPHYR_MODULES_CMSIS_CMSIS_M_H_ */ diff --git a/modules/cmsis/cmsis_core_m_defaults.h b/modules/cmsis/cmsis_core_m_defaults.h new file mode 100644 index 00000000000..bef62665493 --- /dev/null +++ b/modules/cmsis/cmsis_core_m_defaults.h @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2017 Nordic Semiconductor ASA + * Copyright (c) 2023 Arm Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief CMSIS interface file + * + * This header populates the default values required to configure the + * ARM CMSIS Core headers. + */ + +#ifndef ZEPHYR_MODULES_CMSIS_CMSIS_M_DEFAULTS_H_ +#define ZEPHYR_MODULES_CMSIS_CMSIS_M_DEFAULTS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Fill in CMSIS required values for non-CMSIS compliant SoCs. + * Use __NVIC_PRIO_BITS as it is required and simple to check, but + * ultimately all SoCs will define their own CMSIS types and constants. + */ +#ifndef __NVIC_PRIO_BITS +typedef enum { + Reset_IRQn = -15, + NonMaskableInt_IRQn = -14, + HardFault_IRQn = -13, +#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) + MemoryManagement_IRQn = -12, + BusFault_IRQn = -11, + UsageFault_IRQn = -10, +#if defined(CONFIG_ARM_SECURE_FIRMWARE) + SecureFault_IRQn = -9, +#endif /* CONFIG_ARM_SECURE_FIRMWARE */ +#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ + SVCall_IRQn = -5, + DebugMonitor_IRQn = -4, + PendSV_IRQn = -2, + SysTick_IRQn = -1, + Max_IRQn = CONFIG_NUM_IRQS, +} IRQn_Type; + +#if defined(CONFIG_CPU_CORTEX_M0) +#define __CM0_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M0PLUS) +#define __CM0PLUS_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M1) +#define __CM1_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M3) +#define __CM3_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M4) +#define __CM4_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M7) +#define __CM7_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M23) +#define __CM23_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M33) +#define __CM33_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M55) +#define __CM55_REV 0 +#else +#error "Unknown Cortex-M device" +#endif + +#define __NVIC_PRIO_BITS NUM_IRQ_PRIO_BITS +#define __Vendor_SysTickConfig 0 /* Default to standard SysTick */ +#endif /* __NVIC_PRIO_BITS */ + +#ifndef __MPU_PRESENT +#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU +#endif + +#ifndef __FPU_PRESENT +#define __FPU_PRESENT CONFIG_CPU_HAS_FPU +#endif + +#ifndef __FPU_DP +#define __FPU_DP CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION +#endif + +#ifndef __VTOR_PRESENT +#define __VTOR_PRESENT CONFIG_CPU_CORTEX_M_HAS_VTOR +#endif + +#ifndef __DSP_PRESENT +#define __DSP_PRESENT CONFIG_ARMV8_M_DSP +#endif + +#ifndef __ICACHE_PRESENT +#define __ICACHE_PRESENT CONFIG_CPU_HAS_ICACHE +#endif + +#ifndef __DCACHE_PRESENT +#define __DCACHE_PRESENT CONFIG_CPU_HAS_DCACHE +#endif + +#ifndef __MVE_PRESENT +#define __MVE_PRESENT CONFIG_ARMV8_1_M_MVEI +#endif + +#ifndef __SAUREGION_PRESENT +#define __SAUREGION_PRESENT CONFIG_CPU_HAS_ARM_SAU +#endif + +#ifndef __PMU_PRESENT +#define __PMU_PRESENT CONFIG_ARMV8_1_M_PMU +#define __PMU_NUM_EVENTCNT CONFIG_ARMV8_1_M_PMU_EVENTCNT +#endif + +#ifdef __cplusplus +} +#endif + +#if defined(CONFIG_CPU_CORTEX_M0) +#include +#elif defined(CONFIG_CPU_CORTEX_M0PLUS) +#include +#elif defined(CONFIG_CPU_CORTEX_M1) +#include +#elif defined(CONFIG_CPU_CORTEX_M3) +#include +#elif defined(CONFIG_CPU_CORTEX_M4) +#include +#elif defined(CONFIG_CPU_CORTEX_M7) +#include +#elif defined(CONFIG_CPU_CORTEX_M23) +#include +#elif defined(CONFIG_CPU_CORTEX_M33) +#include +#elif defined(CONFIG_CPU_CORTEX_M55) +#include +#else +#error "Unknown Cortex-M device" +#endif + +#endif /* ZEPHYR_MODULES_CMSIS_CMSIS_M_DEFAULTS_H_ */ diff --git a/soc/arm/arm/mps2/soc.h b/soc/arm/arm/mps2/soc.h index 594d3d084c1..822c7ee01bd 100644 --- a/soc/arm/arm/mps2/soc.h +++ b/soc/arm/arm/mps2/soc.h @@ -7,15 +7,7 @@ #ifndef _SOC_H_ #define _SOC_H_ -#define __MPU_PRESENT 1 - -#if defined(CONFIG_SOC_MPS2_AN521) -#define __SAUREGION_PRESENT CONFIG_CPU_HAS_ARM_SAU -#define __FPU_PRESENT CONFIG_CPU_HAS_FPU -#define __DSP_PRESENT CONFIG_ARMV8_M_DSP - -#endif - +#include #include extern void wakeup_cpu1(void); diff --git a/soc/arm/arm/mps3/soc.h b/soc/arm/arm/mps3/soc.h index 6a325074cf2..c3a59da1c0d 100644 --- a/soc/arm/arm/mps3/soc.h +++ b/soc/arm/arm/mps3/soc.h @@ -7,19 +7,6 @@ #ifndef _SOC_H_ #define _SOC_H_ -#define __MPU_PRESENT 1 - -#if defined(CONFIG_SOC_MPS3_AN547) -#define __SAUREGION_PRESENT 1U /* SAU regions present */ -#define __FPU_PRESENT CONFIG_CPU_HAS_FPU -#define __DSP_PRESENT 1U /* DSP extension present */ -#define __MVE_PRESENT 1U /* MVE extensions present */ -#define __MVE_FP 1U /* MVE floating point present */ -#define __ICACHE_PRESENT 1U /* ICACHE present */ -#define __DCACHE_PRESENT 1U /* DCACHE present */ -#define __PMU_PRESENT 1U /* PMU present */ -#define __PMU_NUM_EVENTCNT 8U /* PMU Event Counters */ -#endif - +#include #endif /* _SOC_H_ */ From 5e42f2db2d3fbb1c37cc1c044151952f4b85ba5b Mon Sep 17 00:00:00 2001 From: Wilfried Chauveau Date: Tue, 31 Oct 2023 23:15:26 +0000 Subject: [PATCH 0220/2300] [nrf fromtree] arch: arm: cortex_m: add config for PMU This adds kconfig entries for Performance Monitoring Unit (PMU). Signed-off-by: Wilfried Chauveau (cherry picked from commit a00aa3bcfaeae0bfa69d6154920200ea7a7ab5eb) (cherry picked from commit f9aa18ad5eca7bad208c00b9d15e45372fb4ce9b) --- arch/arm/core/cortex_m/Kconfig | 15 ++++++++++++++- soc/arm/arm/mps3/Kconfig.soc | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/arm/core/cortex_m/Kconfig b/arch/arm/core/cortex_m/Kconfig index 95e05604783..61dd3dbba3c 100644 --- a/arch/arm/core/cortex_m/Kconfig +++ b/arch/arm/core/cortex_m/Kconfig @@ -283,7 +283,20 @@ config ARMV8_1_M_MVEF supporting the M-Profile Vector Extension (MVE) floating-point instruction set. -menu "ARM Cortex-M0/M0+/M1/M3/M4/M7/M23/M33 options" +config ARMV8_1_M_PMU + bool + help + This option is enabled when the CPU implements ARMv8-M Performance + Monitoring Unit (PMU). + +config ARMV8_M_PMU_EVENTCNT + int "Number of event counters in the Performance Monitoring Unit" + depends on ARMV8_1_M_PMU + range 2 8 + help + The number of event counters implemented. + +menu "ARM Cortex-M0/M0+/M1/M3/M4/M7/M23/M33/M55 options" depends on ARMV6_M_ARMV8_M_BASELINE || ARMV7_M_ARMV8_M_MAINLINE config GEN_ISR_TABLES diff --git a/soc/arm/arm/mps3/Kconfig.soc b/soc/arm/arm/mps3/Kconfig.soc index 86970e288cc..ae577fa549b 100644 --- a/soc/arm/arm/mps3/Kconfig.soc +++ b/soc/arm/arm/mps3/Kconfig.soc @@ -14,5 +14,10 @@ config SOC_MPS3_AN547 select ARMV8_M_DSP select ARMV8_1_M_MVEI select ARMV8_1_M_MVEF + select ARMV8_1_M_PMU endchoice + +config ARMV8_1_M_PMU_EVENTCNT + int + default 8 if SOC_MPS3_AN547 From 3b90e755e9adf33e7f03866ec7f7cb9a374274ba Mon Sep 17 00:00:00 2001 From: Wilfried Chauveau Date: Mon, 6 Nov 2023 14:23:19 +0000 Subject: [PATCH 0221/2300] [nrf fromtree] modules: cmsis: Add consistency checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change adds checks to validate consistency between Zephyr’s Kconfig settings and cmsis configuration defined in SiP’s sdk provided headers. This change also introduces a config to enable cmsis’ own checks which emits warnings if a parameter relies on auto-populated default values. Signed-off-by: Wilfried Chauveau (cherry picked from commit 3599fb47e12dd1f16fc620f5915eb408c1ada427) (cherry picked from commit 76945792a6387a9029c71954da9c922822a2af7f) --- modules/cmsis/Kconfig | 7 ++++++ modules/cmsis/cmsis_core_m.h | 49 ++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/modules/cmsis/Kconfig b/modules/cmsis/Kconfig index 4b5a8ee2855..eff0be6f40c 100644 --- a/modules/cmsis/Kconfig +++ b/modules/cmsis/Kconfig @@ -21,4 +21,11 @@ config HAS_CMSIS_CORE_R config HAS_CMSIS_CORE_M bool +config CMSIS_M_CHECK_DEVICE_DEFINES + bool "Check device defines" + default n + depends on HAS_CMSIS_CORE_M + help + This options enables the validation of CMSIS configuration flags. + endif diff --git a/modules/cmsis/cmsis_core_m.h b/modules/cmsis/cmsis_core_m.h index dc468ada364..e7382633945 100644 --- a/modules/cmsis/cmsis_core_m.h +++ b/modules/cmsis/cmsis_core_m.h @@ -15,8 +15,57 @@ #ifndef ZEPHYR_MODULES_CMSIS_CMSIS_M_H_ #define ZEPHYR_MODULES_CMSIS_CMSIS_M_H_ +#if defined(CONFIG_CMSIS_M_CHECK_DEVICE_DEFINES) && CONFIG_CMSIS_M_CHECK_DEVICE_DEFINES == 1U +#define __CHECK_DEVICE_DEFINES 1U +#endif + #include #include +#if __NVIC_PRIO_BITS != NUM_IRQ_PRIO_BITS +#error "NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value" +#endif + +#if __MPU_PRESENT != CONFIG_CPU_HAS_ARM_MPU +#error "__MPU_PRESENT and CONFIG_CPU_HAS_ARM_MPU are not set to the same value" +#endif + +#if __FPU_PRESENT != CONFIG_CPU_HAS_FPU +#error "__FPU_PRESENT and CONFIG_CPU_HAS_FPU are not set to the same value" +#endif + + +/* VTOR is only optional on armv6-m and armv8-m baseline. __VTOR_PRESENT is often + * left undefined on platform where it is not optional. + */ +#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) && \ + (__VTOR_PRESENT != CONFIG_CPU_CORTEX_M_HAS_VTOR) +#error "__VTOR_PRESENT and CONFIG_CPU_CORTEX_M_HAS_VTOR are not set to the same value." +#endif + +/* Some platform’s sdk incorrectly define __DSP_PRESENT for Cortex-M4 & Cortex-M7 + * DSP extension. __ARM_FEATURE_DSP is set by the compiler for these. So ignore + * __DSP_PRESENT discrepancy when __ARM_FEATURE_DSP is defined. + */ +#if !defined(__ARM_FEATURE_DSP) && (__DSP_PRESENT != CONFIG_ARMV8_M_DSP) +#error "__DSP_PRESENT and CONFIG_ARMV8_M_DSP are not set to the same value" +#endif + +#if __ICACHE_PRESENT != CONFIG_CPU_HAS_ICACHE +#error "__ICACHE_PRESENT and CONFIG_CPU_HAS_ICACHE are not set to the same value" +#endif + +#if __DCACHE_PRESENT != CONFIG_CPU_HAS_DCACHE +#error "__DCACHE_PRESENT and CONFIG_CPU_HAS_DCACHE are not set to the same value" +#endif + +#if __MVE_PRESENT != CONFIG_ARMV8_1_M_MVEI +#error "__MVE_PRESENT and CONFIG_ARMV8_1_M_MVEI are not set to the same value" +#endif + +#if __SAUREGION_PRESENT != CONFIG_CPU_HAS_ARM_SAU +#error "__SAUREGION_PRESENT and CONFIG_CPU_HAS_ARM_SAU are not set to the same value" +#endif + #endif /* ZEPHYR_MODULES_CMSIS_CMSIS_M_H_ */ From 806ea8be182a72e934a03ab11d08d7b85b66be93 Mon Sep 17 00:00:00 2001 From: Wilfried Chauveau Date: Tue, 7 Nov 2023 12:57:29 +0000 Subject: [PATCH 0222/2300] [nrf fromtree] soc: arm: fix missing configs & defines Some SoC have missing feature selections in their Kconfig. Some others are missing includes of CMSIS-Core headers. Signed-off-by: Wilfried Chauveau (cherry picked from commit af3a19106afe494f9ca7616e923e2b069e880c71) (cherry picked from commit b9bcccf9f65b3f821ce73cfbf04621b9af1088b0) --- soc/arm/ambiq/apollo4x/Kconfig.series | 1 + soc/arm/arm/designstart/soc.h | 3 +-- soc/arm/arm/musca_s1/Kconfig.soc | 2 ++ soc/arm/aspeed/ast10x0/soc.h | 2 ++ soc/arm/atmel_sam0/samc21/Kconfig.series | 1 + soc/arm/bcm_vk/valkyrie/soc.h | 2 ++ soc/arm/bcm_vk/viper/soc.h | 4 +++- soc/arm/cypress/Kconfig | 3 +++ soc/arm/gigadevice/gd32a50x/Kconfig.series | 1 + soc/arm/gigadevice/gd32e50x/Kconfig.series | 1 + soc/arm/gigadevice/gd32l23x/Kconfig.series | 1 + soc/arm/microchip_mec/mec1501/Kconfig.series | 1 + soc/arm/microchip_mec/mec172x/soc.h | 2 ++ soc/arm/nuvoton_npcx/npcx4/soc.h | 4 +--- soc/arm/nuvoton_npcx/npcx7/soc.h | 4 +--- soc/arm/nuvoton_npcx/npcx9/soc.h | 4 +--- soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series | 1 + soc/arm/nxp_imx/mcimx7_m4/Kconfig.series | 1 + soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series | 1 + soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series | 1 + soc/arm/nxp_imx/rt/Kconfig.soc | 4 ++++ soc/arm/nxp_kinetis/kl2x/Kconfig.series | 1 + soc/arm/nxp_kinetis/kwx/Kconfig.series | 1 + soc/arm/nxp_lpc/lpc11u6x/soc.h | 1 + soc/arm/nxp_lpc/lpc51u68/Kconfig.series | 1 + soc/arm/nxp_lpc/lpc51u68/soc.h | 2 ++ soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc | 1 + soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc | 1 + soc/arm/nxp_s32/s32k3/soc.h | 1 + soc/arm/quicklogic_eos_s3/Kconfig.soc | 1 + soc/arm/renesas_ra/common/ra_common_soc.h | 2 ++ soc/arm/renesas_smartbond/da1469x/Kconfig.series | 1 + soc/arm/rpi_pico/rp2/soc.h | 4 +--- soc/arm/silabs_exx32/efm32hg/Kconfig.series | 1 + soc/arm/silabs_exx32/efr32mg21/Kconfig.series | 1 + soc/arm/st_stm32/stm32mp1/Kconfig.series | 1 + soc/arm/ti_k3/am62x_m4/soc.h | 2 ++ soc/arm/ti_lm3s6965/soc.h | 1 + soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h | 4 ++++ soc/arm/ti_simplelink/cc32xx/soc.h | 4 ++++ soc/arm/ti_simplelink/msp432p4xx/Kconfig.series | 1 + 41 files changed, 61 insertions(+), 15 deletions(-) diff --git a/soc/arm/ambiq/apollo4x/Kconfig.series b/soc/arm/ambiq/apollo4x/Kconfig.series index b7982d3609e..a9e72567206 100644 --- a/soc/arm/ambiq/apollo4x/Kconfig.series +++ b/soc/arm/ambiq/apollo4x/Kconfig.series @@ -10,6 +10,7 @@ config SOC_SERIES_APOLLO4X select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_DWT select CPU_HAS_FPU + select CPU_HAS_ARM_MPU select SOC_FAMILY_AMBIQ select HAS_SWO select AMBIQ_HAL diff --git a/soc/arm/arm/designstart/soc.h b/soc/arm/arm/designstart/soc.h index ec58467f923..a9bcdb4e9cd 100644 --- a/soc/arm/arm/designstart/soc.h +++ b/soc/arm/arm/designstart/soc.h @@ -7,7 +7,6 @@ #ifndef _SOC_H_ #define _SOC_H_ - -#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU +#include #endif /* _SOC_H_ */ diff --git a/soc/arm/arm/musca_s1/Kconfig.soc b/soc/arm/arm/musca_s1/Kconfig.soc index 9bf02614308..0c0763fae2a 100644 --- a/soc/arm/arm/musca_s1/Kconfig.soc +++ b/soc/arm/arm/musca_s1/Kconfig.soc @@ -11,5 +11,7 @@ config SOC_V2M_MUSCA_S1 select CPU_HAS_ARM_SAU select CPU_HAS_ARM_MPU select CPU_CORTEX_M_HAS_DWT + select CPU_HAS_FPU + select ARMV8_M_DSP endchoice diff --git a/soc/arm/aspeed/ast10x0/soc.h b/soc/arm/aspeed/ast10x0/soc.h index f45df84c128..be1cced5da2 100644 --- a/soc/arm/aspeed/ast10x0/soc.h +++ b/soc/arm/aspeed/ast10x0/soc.h @@ -25,4 +25,6 @@ void aspeed_print_sysrst_info(void); +#include + #endif /* ZEPHYR_SOC_ARM_ASPEED_AST10X0_SOC_H_*/ diff --git a/soc/arm/atmel_sam0/samc21/Kconfig.series b/soc/arm/atmel_sam0/samc21/Kconfig.series index 044a7aea229..acb83679e18 100644 --- a/soc/arm/atmel_sam0/samc21/Kconfig.series +++ b/soc/arm/atmel_sam0/samc21/Kconfig.series @@ -10,6 +10,7 @@ config SOC_SERIES_SAMC21 select CPU_CORTEX_M0PLUS select CPU_CORTEX_M_HAS_SYSTICK select CPU_CORTEX_M_HAS_VTOR + select CPU_HAS_ARM_MPU select SOC_FAMILY_SAM0 select PLATFORM_SPECIFIC_INIT select ASF diff --git a/soc/arm/bcm_vk/valkyrie/soc.h b/soc/arm/bcm_vk/valkyrie/soc.h index 26863fbfea0..c3e21a89581 100644 --- a/soc/arm/bcm_vk/valkyrie/soc.h +++ b/soc/arm/bcm_vk/valkyrie/soc.h @@ -292,4 +292,6 @@ typedef enum IRQn { #define PCIE0_PERST_FE_INTR BIT(1) #define PCIE0_PERST_INB_FE_INTR BIT(3) +#include + #endif diff --git a/soc/arm/bcm_vk/viper/soc.h b/soc/arm/bcm_vk/viper/soc.h index 6695e92ef5c..06bf59fb24d 100644 --- a/soc/arm/bcm_vk/viper/soc.h +++ b/soc/arm/bcm_vk/viper/soc.h @@ -9,10 +9,10 @@ #include #include +#include #ifndef _ASMLANGUAGE - /* Interrupt Number Definition */ typedef enum IRQn { /* CORTEX-M7 Processor Exceptions Numbers */ @@ -301,4 +301,6 @@ typedef enum IRQn { #define LS_ICFG_PMON_LITE_SW_RESETN 0x482f0120 #define PCIE_PMON_LITE_SW_RESETN BIT(0) +#include + #endif diff --git a/soc/arm/cypress/Kconfig b/soc/arm/cypress/Kconfig index 352c66b4e76..cb76ccb1090 100644 --- a/soc/arm/cypress/Kconfig +++ b/soc/arm/cypress/Kconfig @@ -12,12 +12,15 @@ config SOC_PSOC6_M0 select CPU_CORTEX_M0PLUS select CPU_CORTEX_M_HAS_SYSTICK select CPU_CORTEX_M_HAS_VTOR + select CPU_HAS_ARM_MPU config SOC_PSOC6_M4 bool "SOC_PSOC6_M4" select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_DWT select CPU_CORTEX_M_HAS_SYSTICK + select CPU_HAS_ARM_MPU + select CPU_HAS_FPU endchoice diff --git a/soc/arm/gigadevice/gd32a50x/Kconfig.series b/soc/arm/gigadevice/gd32a50x/Kconfig.series index 96fc8c1d0af..2488c643727 100644 --- a/soc/arm/gigadevice/gd32a50x/Kconfig.series +++ b/soc/arm/gigadevice/gd32a50x/Kconfig.series @@ -6,6 +6,7 @@ config SOC_SERIES_GD32A50X select ARM select CPU_HAS_ARM_MPU select CPU_HAS_FPU + select ARMV8_M_DSP select CPU_CORTEX_M33 select SOC_FAMILY_GD32_ARM select GD32_HAS_AF_PINMUX diff --git a/soc/arm/gigadevice/gd32e50x/Kconfig.series b/soc/arm/gigadevice/gd32e50x/Kconfig.series index 8bc3f71118e..546ca456793 100644 --- a/soc/arm/gigadevice/gd32e50x/Kconfig.series +++ b/soc/arm/gigadevice/gd32e50x/Kconfig.series @@ -7,6 +7,7 @@ config SOC_SERIES_GD32E50X select CPU_HAS_ARM_MPU select CPU_HAS_FPU select CPU_CORTEX_M33 + select ARMV8_M_DSP select SOC_FAMILY_GD32_ARM select GD32_HAS_AFIO_PINMUX select GD32_HAS_IRC_40K diff --git a/soc/arm/gigadevice/gd32l23x/Kconfig.series b/soc/arm/gigadevice/gd32l23x/Kconfig.series index 5bdb0dba7d3..d6125ca4152 100644 --- a/soc/arm/gigadevice/gd32l23x/Kconfig.series +++ b/soc/arm/gigadevice/gd32l23x/Kconfig.series @@ -6,6 +6,7 @@ config SOC_SERIES_GD32L23X select ARM select CPU_CORTEX_M23 select CPU_CORTEX_M_HAS_SYSTICK + select CPU_CORTEX_M_HAS_VTOR select SOC_FAMILY_GD32_ARM select GD32_HAS_AF_PINMUX select GD32_HAS_IRC_32K diff --git a/soc/arm/microchip_mec/mec1501/Kconfig.series b/soc/arm/microchip_mec/mec1501/Kconfig.series index d3b679bb557..92dc6f3f8f9 100644 --- a/soc/arm/microchip_mec/mec1501/Kconfig.series +++ b/soc/arm/microchip_mec/mec1501/Kconfig.series @@ -8,6 +8,7 @@ config SOC_SERIES_MEC1501X select ARM select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_DWT + select CPU_HAS_ARM_MPU select SOC_FAMILY_MEC select HAS_PM help diff --git a/soc/arm/microchip_mec/mec172x/soc.h b/soc/arm/microchip_mec/mec172x/soc.h index 3bf4f533fdb..19afc4e920a 100644 --- a/soc/arm/microchip_mec/mec172x/soc.h +++ b/soc/arm/microchip_mec/mec172x/soc.h @@ -242,6 +242,8 @@ typedef enum { MAX_IRQn } IRQn_Type; +#include + #include /* chip specific register defines */ diff --git a/soc/arm/nuvoton_npcx/npcx4/soc.h b/soc/arm/nuvoton_npcx/npcx4/soc.h index a9d4e88424b..9c780ca034a 100644 --- a/soc/arm/nuvoton_npcx/npcx4/soc.h +++ b/soc/arm/nuvoton_npcx/npcx4/soc.h @@ -7,9 +7,7 @@ #ifndef _NUVOTON_NPCX_SOC_H_ #define _NUVOTON_NPCX_SOC_H_ -/* CMSIS required definitions */ -#define __FPU_PRESENT CONFIG_CPU_HAS_FPU -#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU +#include /* NPCX4 SCFG multi-registers */ #define NPCX_DEVALT_OFFSET(n) (0x010 + n) diff --git a/soc/arm/nuvoton_npcx/npcx7/soc.h b/soc/arm/nuvoton_npcx/npcx7/soc.h index 7099552cec3..9b523ce1b8f 100644 --- a/soc/arm/nuvoton_npcx/npcx7/soc.h +++ b/soc/arm/nuvoton_npcx/npcx7/soc.h @@ -7,9 +7,7 @@ #ifndef _NUVOTON_NPCX_SOC_H_ #define _NUVOTON_NPCX_SOC_H_ -/* CMSIS required definitions */ -#define __FPU_PRESENT CONFIG_CPU_HAS_FPU -#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU +#include /* NPCX7 SCFG multi-registers offset */ #define NPCX_DEVALT_OFFSET(n) (0x010 + n) diff --git a/soc/arm/nuvoton_npcx/npcx9/soc.h b/soc/arm/nuvoton_npcx/npcx9/soc.h index 6b6c3f30a44..2ce745650fb 100644 --- a/soc/arm/nuvoton_npcx/npcx9/soc.h +++ b/soc/arm/nuvoton_npcx/npcx9/soc.h @@ -7,9 +7,7 @@ #ifndef _NUVOTON_NPCX_SOC_H_ #define _NUVOTON_NPCX_SOC_H_ -/* CMSIS required definitions */ -#define __FPU_PRESENT CONFIG_CPU_HAS_FPU -#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU +#include /* NPCX9 SCFG multi-registers */ #define NPCX_DEVALT_OFFSET(n) (0x010 + n) diff --git a/soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series b/soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series index ac0428eff53..7279ac8596e 100644 --- a/soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series +++ b/soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series @@ -11,6 +11,7 @@ config SOC_SERIES_IMX_6X_M4 select HAS_IMX_HAL select SOC_FAMILY_IMX select CPU_HAS_FPU + select CPU_HAS_ARM_MPU select CLOCK_CONTROL help Enable support for M4 core of i.MX 6SoloX MCU series diff --git a/soc/arm/nxp_imx/mcimx7_m4/Kconfig.series b/soc/arm/nxp_imx/mcimx7_m4/Kconfig.series index be0065cb373..e7ae54bcbda 100644 --- a/soc/arm/nxp_imx/mcimx7_m4/Kconfig.series +++ b/soc/arm/nxp_imx/mcimx7_m4/Kconfig.series @@ -11,5 +11,6 @@ config SOC_SERIES_IMX7_M4 select SOC_FAMILY_IMX select CLOCK_CONTROL select CPU_HAS_FPU + select CPU_HAS_ARM_MPU help Enable support for i.MX7 M4 MCU series diff --git a/soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series b/soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series index dddb12d1b70..f860a7fbd26 100644 --- a/soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series +++ b/soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series @@ -9,5 +9,6 @@ config SOC_SERIES_IMX8MM_M4 select CPU_CORTEX_M4 select SOC_FAMILY_IMX select CPU_HAS_FPU + select CPU_HAS_ARM_MPU help Enable support for i.MX8MM M4 MCU series diff --git a/soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series b/soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series index c4b16d3fb5c..3933037c3a0 100644 --- a/soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series +++ b/soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series @@ -9,5 +9,6 @@ config SOC_SERIES_IMX8MQ_M4 select CPU_CORTEX_M4 select SOC_FAMILY_IMX select CPU_HAS_FPU + select CPU_HAS_ARM_MPU help Enable support for i.MX8MQ M4 MCU series diff --git a/soc/arm/nxp_imx/rt/Kconfig.soc b/soc/arm/nxp_imx/rt/Kconfig.soc index 0058993e825..96dcd14dc86 100644 --- a/soc/arm/nxp_imx/rt/Kconfig.soc +++ b/soc/arm/nxp_imx/rt/Kconfig.soc @@ -21,6 +21,7 @@ config SOC_MIMXRT1011 select HAS_MCUX_LPUART select HAS_MCUX_GPT select HAS_MCUX_TRNG + select CPU_HAS_FPU select CPU_HAS_ARM_MPU select INIT_ENET_PLL select HAS_MCUX_USB_EHCI @@ -45,6 +46,7 @@ config SOC_MIMXRT1015 select HAS_MCUX_LPUART select HAS_MCUX_GPT select HAS_MCUX_TRNG + select CPU_HAS_FPU select CPU_HAS_FPU_DOUBLE_PRECISION select CPU_HAS_ARM_MPU select INIT_ENET_PLL @@ -368,6 +370,7 @@ config SOC_MIMXRT1176_CM4 select HAS_MCUX_FLEXSPI select HAS_MCUX_LPUART select HAS_MCUX_GPT + select CPU_HAS_FPU select CPU_HAS_ARM_MPU select INIT_ARM_PLL select INIT_ENET_PLL if NET_L2_ETHERNET && ETH_DRIVER @@ -435,6 +438,7 @@ config SOC_MIMXRT1166_CM4 select HAS_MCUX_FLEXSPI select HAS_MCUX_GPT select CPU_HAS_ARM_MPU + select CPU_HAS_FPU select INIT_ARM_PLL select INIT_ENET_PLL if NET_L2_ETHERNET && ETH_DRIVER select INIT_VIDEO_PLL diff --git a/soc/arm/nxp_kinetis/kl2x/Kconfig.series b/soc/arm/nxp_kinetis/kl2x/Kconfig.series index 53558c81648..3c606c7db27 100644 --- a/soc/arm/nxp_kinetis/kl2x/Kconfig.series +++ b/soc/arm/nxp_kinetis/kl2x/Kconfig.series @@ -9,6 +9,7 @@ config SOC_SERIES_KINETIS_KL2X select CPU_CORTEX_M0PLUS select SOC_FAMILY_KINETIS select CPU_CORTEX_M_HAS_SYSTICK + select CPU_CORTEX_M_HAS_VTOR select CLOCK_CONTROL select PLATFORM_SPECIFIC_INIT help diff --git a/soc/arm/nxp_kinetis/kwx/Kconfig.series b/soc/arm/nxp_kinetis/kwx/Kconfig.series index 4b00dd997a9..36ba7b54c21 100644 --- a/soc/arm/nxp_kinetis/kwx/Kconfig.series +++ b/soc/arm/nxp_kinetis/kwx/Kconfig.series @@ -8,6 +8,7 @@ config SOC_SERIES_KINETIS_KWX select ARM select SOC_FAMILY_KINETIS select CPU_CORTEX_M_HAS_SYSTICK + select CPU_CORTEX_M_HAS_VTOR select CLOCK_CONTROL select PLATFORM_SPECIFIC_INIT help diff --git a/soc/arm/nxp_lpc/lpc11u6x/soc.h b/soc/arm/nxp_lpc/lpc11u6x/soc.h index fd7ffbd5400..ec0abb4faf1 100644 --- a/soc/arm/nxp_lpc/lpc11u6x/soc.h +++ b/soc/arm/nxp_lpc/lpc11u6x/soc.h @@ -19,6 +19,7 @@ #ifndef _ASMLANGUAGE #include +#include #endif /* !_ASMLANGUAGE */ diff --git a/soc/arm/nxp_lpc/lpc51u68/Kconfig.series b/soc/arm/nxp_lpc/lpc51u68/Kconfig.series index 6995de0917a..8b1a9dd18b1 100644 --- a/soc/arm/nxp_lpc/lpc51u68/Kconfig.series +++ b/soc/arm/nxp_lpc/lpc51u68/Kconfig.series @@ -13,6 +13,7 @@ config SOC_SERIES_LPC51U68 select HAS_MCUX_SCTIMER select SOC_FAMILY_LPC select CPU_CORTEX_M_HAS_SYSTICK + select CPU_CORTEX_M_HAS_VTOR select PLATFORM_SPECIFIC_INIT help Enable support for LPC LPC51U68 MCU Series diff --git a/soc/arm/nxp_lpc/lpc51u68/soc.h b/soc/arm/nxp_lpc/lpc51u68/soc.h index 45355fb148e..9135c3fed71 100644 --- a/soc/arm/nxp_lpc/lpc51u68/soc.h +++ b/soc/arm/nxp_lpc/lpc51u68/soc.h @@ -10,6 +10,8 @@ #ifndef _ASMLANGUAGE #include +#include + #endif /* !_ASMLANGUAGE*/ #define IOCON_PIO_DIGITAL_EN 0x80u diff --git a/soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc b/soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc index 099dc832d5b..e71bc8f451e 100644 --- a/soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc +++ b/soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc @@ -12,6 +12,7 @@ config SOC_LPC54114_M4 select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_DWT select CPU_HAS_ARM_MPU + select CPU_HAS_FPU select PLATFORM_SPECIFIC_INIT select CLOCK_CONTROL select HAS_MCUX_IAP_LEGACY diff --git a/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc b/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc index c0341a8e9c5..a80374f2d81 100644 --- a/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc +++ b/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc @@ -35,6 +35,7 @@ config SOC_LPC55S16 config SOC_LPC55S28 bool "SOC_LPC55S28 M33" select CPU_CORTEX_M33 + select CPU_HAS_ARM_SAU select CPU_HAS_ARM_MPU select CPU_HAS_FPU select ARMV8_M_DSP diff --git a/soc/arm/nxp_s32/s32k3/soc.h b/soc/arm/nxp_s32/s32k3/soc.h index bbc53e18023..9e273ac6816 100644 --- a/soc/arm/nxp_s32/s32k3/soc.h +++ b/soc/arm/nxp_s32/s32k3/soc.h @@ -8,6 +8,7 @@ #define _NXP_S32_S32K_SOC_H_ #include +#include #if defined(CONFIG_CMSIS_RTOS_V2) /* diff --git a/soc/arm/quicklogic_eos_s3/Kconfig.soc b/soc/arm/quicklogic_eos_s3/Kconfig.soc index cb5fd170870..e555933430b 100644 --- a/soc/arm/quicklogic_eos_s3/Kconfig.soc +++ b/soc/arm/quicklogic_eos_s3/Kconfig.soc @@ -7,4 +7,5 @@ config SOC_EOS_S3 select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_SYSTICK select CPU_HAS_ARM_MPU + select CPU_HAS_FPU select EOS_S3_HAL diff --git a/soc/arm/renesas_ra/common/ra_common_soc.h b/soc/arm/renesas_ra/common/ra_common_soc.h index 60559793743..f76c4c26fc0 100644 --- a/soc/arm/renesas_ra/common/ra_common_soc.h +++ b/soc/arm/renesas_ra/common/ra_common_soc.h @@ -11,6 +11,8 @@ extern "C" { #endif +#include + #ifdef __cplusplus } #endif diff --git a/soc/arm/renesas_smartbond/da1469x/Kconfig.series b/soc/arm/renesas_smartbond/da1469x/Kconfig.series index a3a9e569460..c3672a9ecaf 100644 --- a/soc/arm/renesas_smartbond/da1469x/Kconfig.series +++ b/soc/arm/renesas_smartbond/da1469x/Kconfig.series @@ -8,6 +8,7 @@ config SOC_SERIES_DA1469X select CPU_HAS_FPU select CPU_HAS_ARM_MPU select CPU_CORTEX_M_HAS_SYSTICK + select ARMV8_M_DSP select SOC_FAMILY_SMARTBOND select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select CLOCK_CONTROL diff --git a/soc/arm/rpi_pico/rp2/soc.h b/soc/arm/rpi_pico/rp2/soc.h index b38d2edf461..0eef4cf92a2 100644 --- a/soc/arm/rpi_pico/rp2/soc.h +++ b/soc/arm/rpi_pico/rp2/soc.h @@ -12,8 +12,6 @@ #ifndef _RPI_PICO_RP2040_SOC_H_ #define _RPI_PICO_RP2040_SOC_H_ - -#define __VTOR_PRESENT CONFIG_CPU_CORTEX_M_HAS_VTOR -#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU +#include #endif /* _RPI_PICO_RP2040_SOC_H_ */ diff --git a/soc/arm/silabs_exx32/efm32hg/Kconfig.series b/soc/arm/silabs_exx32/efm32hg/Kconfig.series index 33793b5386d..d17c24fbcdb 100644 --- a/soc/arm/silabs_exx32/efm32hg/Kconfig.series +++ b/soc/arm/silabs_exx32/efm32hg/Kconfig.series @@ -9,6 +9,7 @@ config SOC_SERIES_EFM32HG select CPU_CORTEX_M0PLUS select SOC_FAMILY_EXX32 select CPU_CORTEX_M_HAS_SYSTICK + select CPU_CORTEX_M_HAS_VTOR select HAS_SILABS_GECKO select SOC_GECKO_CMU select SOC_GECKO_GPIO diff --git a/soc/arm/silabs_exx32/efr32mg21/Kconfig.series b/soc/arm/silabs_exx32/efr32mg21/Kconfig.series index 146493469e8..731658d29e3 100644 --- a/soc/arm/silabs_exx32/efr32mg21/Kconfig.series +++ b/soc/arm/silabs_exx32/efr32mg21/Kconfig.series @@ -11,6 +11,7 @@ config SOC_SERIES_EFR32MG21 select ARMV8_M_DSP select CPU_HAS_FPU select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU select SOC_FAMILY_EXX32 select SOC_GECKO_HAS_RADIO select SOC_GECKO_SERIES2 diff --git a/soc/arm/st_stm32/stm32mp1/Kconfig.series b/soc/arm/st_stm32/stm32mp1/Kconfig.series index 0c6580e84cc..c1576a7ee17 100644 --- a/soc/arm/st_stm32/stm32mp1/Kconfig.series +++ b/soc/arm/st_stm32/stm32mp1/Kconfig.series @@ -11,6 +11,7 @@ config SOC_SERIES_STM32MP1X select SOC_FAMILY_STM32 select HAS_STM32CUBE select CPU_HAS_ARM_MPU + select CPU_HAS_FPU select OPENAMP_RSC_TABLE if RAM_CONSOLE help Enable support for STM32MP1 MPU series diff --git a/soc/arm/ti_k3/am62x_m4/soc.h b/soc/arm/ti_k3/am62x_m4/soc.h index 01ff4b07080..2fd6537b984 100644 --- a/soc/arm/ti_k3/am62x_m4/soc.h +++ b/soc/arm/ti_k3/am62x_m4/soc.h @@ -7,6 +7,8 @@ #ifndef __SOC_H_ #define __SOC_H_ +#include + #include #endif /* __SOC_H */ diff --git a/soc/arm/ti_lm3s6965/soc.h b/soc/arm/ti_lm3s6965/soc.h index bef939013ba..3c353b1a79b 100644 --- a/soc/arm/ti_lm3s6965/soc.h +++ b/soc/arm/ti_lm3s6965/soc.h @@ -15,6 +15,7 @@ #ifndef _BOARD__H_ #define _BOARD__H_ +#include #include /* default system clock */ diff --git a/soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h b/soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h index a1d3504b986..fdc9214732c 100644 --- a/soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h +++ b/soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h @@ -7,6 +7,8 @@ #ifndef TI_SIMPLELINK_CC13X2_CC26X2_SOC_H_ #define TI_SIMPLELINK_CC13X2_CC26X2_SOC_H_ +#include + /* CMSIS required values */ typedef enum { Reset_IRQn = -15, @@ -27,4 +29,6 @@ typedef enum { #define __Vendor_SysTickConfig 0 #define __FPU_PRESENT 1 +#include + #endif /* TI_SIMPLELINK_CC13X2_CC26X2_SOC_H_ */ diff --git a/soc/arm/ti_simplelink/cc32xx/soc.h b/soc/arm/ti_simplelink/cc32xx/soc.h index 9c841e0e4b0..e18dfce626a 100644 --- a/soc/arm/ti_simplelink/cc32xx/soc.h +++ b/soc/arm/ti_simplelink/cc32xx/soc.h @@ -7,6 +7,8 @@ #ifndef TI_SIMPLELINK_CC32XX_SOC_H_ #define TI_SIMPLELINK_CC32XX_SOC_H_ +#include + #include #include @@ -38,4 +40,6 @@ typedef enum { #define __NVIC_PRIO_BITS NUM_IRQ_PRIO_BITS #define __Vendor_SysTickConfig 0 /* Default to standard SysTick */ +#include + #endif /* TI_SIMPLELINK_CC32XX_SOC_H_ */ diff --git a/soc/arm/ti_simplelink/msp432p4xx/Kconfig.series b/soc/arm/ti_simplelink/msp432p4xx/Kconfig.series index 6bb0043ff90..8af48672ed2 100644 --- a/soc/arm/ti_simplelink/msp432p4xx/Kconfig.series +++ b/soc/arm/ti_simplelink/msp432p4xx/Kconfig.series @@ -11,5 +11,6 @@ config SOC_SERIES_MSP432P4XX select DYNAMIC_INTERRUPTS select SOC_FAMILY_TISIMPLELINK select CPU_HAS_FPU + select CPU_HAS_ARM_MPU help Enable support for TI SimpleLink MSP432P4XX. From dcbf88db3aac10d699a263508c338fd7ec5775b8 Mon Sep 17 00:00:00 2001 From: Adam Wojasinski Date: Wed, 19 Jul 2023 15:36:00 +0200 Subject: [PATCH 0223/2300] [nrf fromtree] drivers: watchdog: wdt_nrfx: Add support for new instances Add support for WDT30, WDT31, and WDT130 Signed-off-by: Adam Wojasinski (cherry picked from commit e654cb65b8943cdf5c66c4ad285ca26481a7da69) Signed-off-by: Robert Lubos (cherry picked from commit 717015975e8282ed7b98166814f29e0db2b6bdc1) --- drivers/watchdog/Kconfig.nrfx | 4 ++++ drivers/watchdog/wdt_nrfx.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/watchdog/Kconfig.nrfx b/drivers/watchdog/Kconfig.nrfx index 52cf45dc068..2967fe86489 100644 --- a/drivers/watchdog/Kconfig.nrfx +++ b/drivers/watchdog/Kconfig.nrfx @@ -9,5 +9,9 @@ config WDT_NRFX depends on DT_HAS_NORDIC_NRF_WDT_ENABLED select NRFX_WDT0 if HAS_HW_NRF_WDT0 select NRFX_WDT1 if HAS_HW_NRF_WDT1 + select NRFX_WDT30 if HAS_HW_NRF_WDT30 + select NRFX_WDT31 if HAS_HW_NRF_WDT31 + select NRFX_WDT130 if HAS_HW_NRF_WDT130 + help Enable support for nrfx WDT driver for nRF MCU series. diff --git a/drivers/watchdog/wdt_nrfx.c b/drivers/watchdog/wdt_nrfx.c index 98fcb713b81..363a1174e91 100644 --- a/drivers/watchdog/wdt_nrfx.c +++ b/drivers/watchdog/wdt_nrfx.c @@ -202,3 +202,15 @@ WDT_NRFX_WDT_DEVICE(0); #ifdef CONFIG_HAS_HW_NRF_WDT1 WDT_NRFX_WDT_DEVICE(1); #endif + +#ifdef CONFIG_HAS_HW_NRF_WDT30 +WDT_NRFX_WDT_DEVICE(30); +#endif + +#ifdef CONFIG_HAS_HW_NRF_WDT31 +WDT_NRFX_WDT_DEVICE(31); +#endif + +#ifdef CONFIG_HAS_HW_NRF_WDT130 +WDT_NRFX_WDT_DEVICE(130); +#endif From c6943ed3204609d5fa6a8de67e529ba163395240 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 4 Jan 2024 15:14:17 +0100 Subject: [PATCH 0224/2300] [nrf fromtree] boards: arm: nrf5340_audio_dk_cpunet_reset: switch to HAL Change the GPIOTE driver to HAL to prevent instantiation issues with a multi-instance GPIOTE driver. Signed-off-by: Jakub Zymelka (cherry picked from commit 7441ff0e7e4f2c8867f0f7b91818eddfe563aab7) Signed-off-by: Robert Lubos (cherry picked from commit 434667a68cec60ece2becade21b7941547b363c5) --- .../nrf5340_audio_dk_cpunet_reset.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c index 4368ca303fc..f9082e6ca40 100644 --- a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c @@ -10,8 +10,7 @@ #include #include - -#include +#include LOG_MODULE_REGISTER(nrf5340_audio_dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -25,11 +24,11 @@ static int core_config(void) { nrf_gpiote_latency_t latency; - latency = nrfx_gpiote_latency_get(); + latency = nrf_gpiote_latency_get(NRF_GPIOTE); if (latency != NRF_GPIOTE_LATENCY_LOWPOWER) { LOG_DBG("Setting gpiote latency to low power"); - nrfx_gpiote_latency_set(NRF_GPIOTE_LATENCY_LOWPOWER); + nrf_gpiote_latency_set(NRF_GPIOTE, NRF_GPIOTE_LATENCY_LOWPOWER); } return 0; From d8b0858b088646fb0a613b6aa2c079eb1b6a98f9 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Thu, 4 Jan 2024 16:18:40 +0100 Subject: [PATCH 0225/2300] [nrf fromtree] boards: arm: set gpiote status to okay as default After adding new GPIOTE instances, there is a need to enable the instance for individual boards. Signed-off-by: Jakub Zymelka (cherry picked from commit c546c8b96be8f7bf4289ce6bb546bfdf78d5e3fb) Signed-off-by: Robert Lubos (cherry picked from commit 7e399018289cb9ff0fb3fe88dfab3086ca31de7e) --- .../arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi | 4 ++++ boards/arm/bl654_usb/bl654_usb.dts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi b/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi index 200db7f94c7..3d31ede313f 100644 --- a/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi +++ b/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi @@ -189,6 +189,10 @@ arduino_spi: &spi2 { status = "okay"; }; +&gpiote { + status = "okay"; +}; + &pwm0 { status = "okay"; pinctrl-0 = <&pwm0_default>; diff --git a/boards/arm/bl654_usb/bl654_usb.dts b/boards/arm/bl654_usb/bl654_usb.dts index 80600290dbf..fa814f4b80e 100644 --- a/boards/arm/bl654_usb/bl654_usb.dts +++ b/boards/arm/bl654_usb/bl654_usb.dts @@ -59,6 +59,10 @@ status = "okay"; }; +&gpiote { + status = "okay"; +}; + &pwm0 { status = "okay"; pinctrl-0 = <&pwm0_default>; From 28ce3be0aee14149702f8eecb09ac0faef063a91 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Mon, 8 Jan 2024 09:45:46 +0100 Subject: [PATCH 0226/2300] [nrf fromtree] modules: hal_nordic: nrfx: update API version to 3.2.0 Updated API version enables multi-instance GPIOTE driver. Additionally obsolete symbol that was used to specify API version in the past was removed. Affected drivers have been adjusted and appropriate changes in affected files have been made. Signed-off-by: Jakub Zymelka (cherry picked from commit ade49f081df6fab0db6288bad25be4f5eff7ef3a) Signed-off-by: Robert Lubos (cherry picked from commit 65d99d10bd76b17647eb83569d6c0eab886122d0) --- drivers/adc/adc_nrfx_saadc.c | 4 +- drivers/display/display_nrf_led_matrix.c | 22 +- drivers/gpio/Kconfig.nrfx | 7 +- drivers/gpio/gpio_nrfx.c | 229 +++++++++++-------- drivers/pwm/pwm_nrf_sw.c | 20 +- drivers/spi/spi_nrfx_common.c | 31 ++- drivers/spi/spi_nrfx_common.h | 11 +- drivers/spi/spi_nrfx_spi.c | 7 +- drivers/spi/spi_nrfx_spim.c | 20 +- drivers/watchdog/wdt_nrfx.c | 16 +- modules/hal_nordic/nrfx/nrfx_config.h | 6 - modules/hal_nordic/nrfx/nrfx_config_common.h | 2 +- samples/boards/nrf/nrfx/Kconfig | 10 + samples/boards/nrf/nrfx/prj.conf | 1 - samples/boards/nrf/nrfx/src/main.c | 51 +++-- 15 files changed, 270 insertions(+), 167 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 72a20f47fc9..6d1973ca0aa 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -170,7 +170,7 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx, if (!repeat) { nrf_saadc_buffer_pointer_set( NRF_SAADC, - nrf_saadc_buffer_pointer_get(NRF_SAADC) + + (uint16_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + nrf_saadc_amount_get(NRF_SAADC)); } } @@ -256,7 +256,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, { size_t needed_buffer_size; - needed_buffer_size = active_channels * sizeof(nrf_saadc_value_t); + needed_buffer_size = active_channels * sizeof(uint16_t); if (sequence->options) { needed_buffer_size *= (1 + sequence->options->extra_samplings); } diff --git a/drivers/display/display_nrf_led_matrix.c b/drivers/display/display_nrf_led_matrix.c index dd36126a7ce..e27fb76a92a 100644 --- a/drivers/display/display_nrf_led_matrix.c +++ b/drivers/display/display_nrf_led_matrix.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #ifdef PWM_PRESENT #include @@ -89,6 +90,8 @@ struct display_drv_config { NRF_TIMER_Type *timer; #if USE_PWM NRF_PWM_Type *pwm; +#else + nrfx_gpiote_t gpiote; #endif uint8_t rows[ROW_COUNT]; uint8_t cols[COL_COUNT]; @@ -340,7 +343,7 @@ static void prepare_pixel_pulse(const struct device *dev, /* First timer channel is used for timing the period of pulses. */ nrf_timer_cc_set(dev_config->timer, 1 + channel_idx, pulse); - NRF_GPIOTE->CONFIG[dev_data->gpiote_ch[channel_idx]] = gpiote_cfg; + dev_config->gpiote.p_reg->CONFIG[dev_data->gpiote_ch[channel_idx]] = gpiote_cfg; #endif /* USE_PWM */ } @@ -370,7 +373,7 @@ static void timer_irq_handler(void *arg) } #else for (int i = 0; i < GROUP_SIZE; ++i) { - NRF_GPIOTE->CONFIG[dev_data->gpiote_ch[i]] = 0; + dev_config->gpiote.p_reg->CONFIG[dev_data->gpiote_ch[i]] = 0; } #endif @@ -466,7 +469,7 @@ static int instance_init(const struct device *dev) return -ENOMEM; } - err = nrfx_gpiote_channel_alloc(gpiote_ch); + err = nrfx_gpiote_channel_alloc(&dev_config->gpiote, gpiote_ch); if (err != NRFX_SUCCESS) { LOG_ERR("Failed to allocate GPIOTE channel."); /* Do not bother with freeing resources allocated @@ -479,7 +482,7 @@ static int instance_init(const struct device *dev) nrf_ppi_channel_endpoint_setup(NRF_PPI, ppi_ch, nrf_timer_event_address_get(dev_config->timer, nrf_timer_compare_event_get(1 + i)), - nrf_gpiote_event_address_get(NRF_GPIOTE, + nrf_gpiote_event_address_get(dev_config->gpiote.p_reg, nrf_gpiote_out_task_get(*gpiote_ch))); nrf_ppi_channel_enable(NRF_PPI, ppi_ch); } @@ -530,6 +533,14 @@ static struct display_drv_data instance_data = { .blanking = true, }; +#if !USE_PWM +#define CHECK_GPIOTE_INST(node_id, prop, idx) \ + BUILD_ASSERT(NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, idx) == \ + NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, 0), \ + "All column GPIOs must use the same GPIOTE instance"); +DT_FOREACH_PROP_ELEM(MATRIX_NODE, col_gpios, CHECK_GPIOTE_INST) +#endif + #define GET_PIN_INFO(node_id, pha, idx) \ (DT_GPIO_PIN_BY_IDX(node_id, pha, idx) | \ (DT_PROP_BY_PHANDLE_IDX(node_id, pha, idx, port) << 5) | \ @@ -546,6 +557,9 @@ static const struct display_drv_config instance_config = { .timer = (NRF_TIMER_Type *)DT_REG_ADDR(TIMER_NODE), #if USE_PWM .pwm = (NRF_PWM_Type *)DT_REG_ADDR(PWM_NODE), +#else + .gpiote = NRFX_GPIOTE_INSTANCE( + NRF_DT_GPIOTE_INST_BY_IDX(MATRIX_NODE, col_gpios, 0)), #endif .rows = { DT_FOREACH_PROP_ELEM(MATRIX_NODE, row_gpios, GET_PIN_INFO) }, .cols = { DT_FOREACH_PROP_ELEM(MATRIX_NODE, col_gpios, GET_PIN_INFO) }, diff --git a/drivers/gpio/Kconfig.nrfx b/drivers/gpio/Kconfig.nrfx index 356c43cb5fa..760a45204fd 100644 --- a/drivers/gpio/Kconfig.nrfx +++ b/drivers/gpio/Kconfig.nrfx @@ -5,7 +5,12 @@ menuconfig GPIO_NRFX bool "nRF GPIO driver" default y depends on DT_HAS_NORDIC_NRF_GPIO_ENABLED - select NRFX_GPIOTE + select NRFX_GPIOTE0 if HAS_HW_NRF_GPIOTE0 + select NRFX_GPIOTE1 if HAS_HW_NRF_GPIOTE1 + select NRFX_GPIOTE20 if HAS_HW_NRF_GPIOTE20 + select NRFX_GPIOTE30 if HAS_HW_NRF_GPIOTE30 + select NRFX_GPIOTE130 if HAS_HW_NRF_GPIOTE130 + select NRFX_GPIOTE131 if HAS_HW_NRF_GPIOTE131 help Enable GPIO driver for nRF line of MCUs. diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index 0aa282dda37..d89c964cc90 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -3,6 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ + #define DT_DRV_COMPAT nordic_nrf_gpio #include @@ -25,6 +26,7 @@ struct gpio_nrfx_cfg { NRF_GPIO_Type *port; uint32_t edge_sense; uint8_t port_num; + nrfx_gpiote_t gpiote; }; static inline struct gpio_nrfx_data *get_port_data(const struct device *port) @@ -37,131 +39,139 @@ static inline const struct gpio_nrfx_cfg *get_port_cfg(const struct device *port return port->config; } -static int get_drive(gpio_flags_t flags, nrf_gpio_pin_drive_t *drive) +static bool has_gpiote(const struct gpio_nrfx_cfg *cfg) +{ + return cfg->gpiote.p_reg != NULL; +} + +static nrf_gpio_pin_pull_t get_pull(gpio_flags_t flags) +{ + if (flags & GPIO_PULL_UP) { + return NRF_GPIO_PIN_PULLUP; + } else if (flags & GPIO_PULL_DOWN) { + return NRF_GPIO_PIN_PULLDOWN; + } + + return NRF_GPIO_PIN_NOPULL; +} + +static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, + gpio_flags_t flags) { + nrfx_err_t err = NRFX_SUCCESS; + uint8_t ch; + bool free_ch = false; + const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); + nrfx_gpiote_pin_t abs_pin = NRF_GPIO_PIN_MAP(cfg->port_num, pin); + nrf_gpio_pin_pull_t pull = get_pull(flags); + nrf_gpio_pin_drive_t drive; + switch (flags & (NRF_GPIO_DRIVE_MSK | GPIO_OPEN_DRAIN)) { case NRF_GPIO_DRIVE_S0S1: - *drive = NRF_GPIO_PIN_S0S1; + drive = NRF_GPIO_PIN_S0S1; break; case NRF_GPIO_DRIVE_S0H1: - *drive = NRF_GPIO_PIN_S0H1; + drive = NRF_GPIO_PIN_S0H1; break; case NRF_GPIO_DRIVE_H0S1: - *drive = NRF_GPIO_PIN_H0S1; + drive = NRF_GPIO_PIN_H0S1; break; case NRF_GPIO_DRIVE_H0H1: - *drive = NRF_GPIO_PIN_H0H1; + drive = NRF_GPIO_PIN_H0H1; break; case NRF_GPIO_DRIVE_S0 | GPIO_OPEN_DRAIN: - *drive = NRF_GPIO_PIN_S0D1; + drive = NRF_GPIO_PIN_S0D1; break; case NRF_GPIO_DRIVE_H0 | GPIO_OPEN_DRAIN: - *drive = NRF_GPIO_PIN_H0D1; + drive = NRF_GPIO_PIN_H0D1; break; case NRF_GPIO_DRIVE_S1 | GPIO_OPEN_SOURCE: - *drive = NRF_GPIO_PIN_D0S1; + drive = NRF_GPIO_PIN_D0S1; break; case NRF_GPIO_DRIVE_H1 | GPIO_OPEN_SOURCE: - *drive = NRF_GPIO_PIN_D0H1; + drive = NRF_GPIO_PIN_D0H1; break; default: return -EINVAL; } - return 0; -} - -static nrf_gpio_pin_pull_t get_pull(gpio_flags_t flags) -{ - if (flags & GPIO_PULL_UP) { - return NRF_GPIO_PIN_PULLUP; - } else if (flags & GPIO_PULL_DOWN) { - return NRF_GPIO_PIN_PULLDOWN; + if (flags & GPIO_OUTPUT_INIT_HIGH) { + nrf_gpio_port_out_set(cfg->port, BIT(pin)); + } else if (flags & GPIO_OUTPUT_INIT_LOW) { + nrf_gpio_port_out_clear(cfg->port, BIT(pin)); } - return NRF_GPIO_PIN_NOPULL; -} + if (!has_gpiote(cfg)) { + nrf_gpio_pin_dir_t dir = (flags & GPIO_OUTPUT) + ? NRF_GPIO_PIN_DIR_OUTPUT + : NRF_GPIO_PIN_DIR_INPUT; + nrf_gpio_pin_input_t input = (flags & GPIO_INPUT) + ? NRF_GPIO_PIN_INPUT_CONNECT + : NRF_GPIO_PIN_INPUT_DISCONNECT; -static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, - gpio_flags_t flags) -{ - nrfx_err_t err = NRFX_SUCCESS; - uint8_t ch; - bool free_ch = false; - const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); - nrfx_gpiote_pin_t abs_pin = NRF_GPIO_PIN_MAP(cfg->port_num, pin); + nrf_gpio_reconfigure(abs_pin, &dir, &input, &pull, &drive, NULL); + return 0; + } /* Get the GPIOTE channel associated with this pin, if any. It needs * to be freed when the pin is reconfigured or disconnected. */ if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT)) { - err = nrfx_gpiote_channel_get(abs_pin, &ch); + err = nrfx_gpiote_channel_get(&cfg->gpiote, abs_pin, &ch); free_ch = (err == NRFX_SUCCESS); } if ((flags & (GPIO_INPUT | GPIO_OUTPUT)) == GPIO_DISCONNECTED) { /* Ignore the error code. The pin may not have been used. */ - (void)nrfx_gpiote_pin_uninit(abs_pin); - - if (free_ch) { - err = nrfx_gpiote_channel_free(ch); - __ASSERT_NO_MSG(err == NRFX_SUCCESS); + (void)nrfx_gpiote_pin_uninit(&cfg->gpiote, abs_pin); + } else { + /* Remove previously configured trigger when pin is reconfigured. */ + if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT)) { + nrfx_gpiote_trigger_config_t trigger_config = { + .trigger = NRFX_GPIOTE_TRIGGER_NONE, + }; + nrfx_gpiote_input_pin_config_t input_pin_config = { + .p_trigger_config = &trigger_config, + }; + + err = nrfx_gpiote_input_configure(&cfg->gpiote, + abs_pin, &input_pin_config); + if (err != NRFX_SUCCESS) { + return -EINVAL; + } } - return 0; - } - - if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT)) { - nrfx_gpiote_trigger_config_t trigger_config = { - .trigger = NRFX_GPIOTE_TRIGGER_NONE - }; + if (flags & GPIO_OUTPUT) { + nrfx_gpiote_output_config_t output_config = { + .drive = drive, + .input_connect = (flags & GPIO_INPUT) + ? NRF_GPIO_PIN_INPUT_CONNECT + : NRF_GPIO_PIN_INPUT_DISCONNECT, + .pull = pull, + }; + + err = nrfx_gpiote_output_configure(&cfg->gpiote, + abs_pin, &output_config, NULL); + } else { + nrfx_gpiote_input_pin_config_t input_pin_config = { + .p_pull_config = &pull, + }; + + err = nrfx_gpiote_input_configure(&cfg->gpiote, + abs_pin, &input_pin_config); + } - /* Remove previously configured trigger when pin is reconfigured. */ - err = nrfx_gpiote_input_configure(abs_pin, NULL, &trigger_config, NULL); if (err != NRFX_SUCCESS) { return -EINVAL; } - - if (free_ch) { - err = nrfx_gpiote_channel_free(ch); - __ASSERT_NO_MSG(err == NRFX_SUCCESS); - } } - if (flags & GPIO_OUTPUT) { - nrf_gpio_pin_drive_t drive; - int rv = get_drive(flags, &drive); - - if (rv != 0) { - return rv; - } - - nrfx_gpiote_output_config_t output_config = { - .drive = drive, - .input_connect = (flags & GPIO_INPUT) ? - NRF_GPIO_PIN_INPUT_CONNECT : - NRF_GPIO_PIN_INPUT_DISCONNECT, - .pull = get_pull(flags) - }; - - - if (flags & GPIO_OUTPUT_INIT_HIGH) { - nrf_gpio_port_out_set(cfg->port, BIT(pin)); - } else if (flags & GPIO_OUTPUT_INIT_LOW) { - nrf_gpio_port_out_clear(cfg->port, BIT(pin)); - } - - err = nrfx_gpiote_output_configure(abs_pin, &output_config, NULL); - return (err != NRFX_SUCCESS) ? -EINVAL : 0; + if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT) && free_ch) { + err = nrfx_gpiote_channel_free(&cfg->gpiote, ch); + __ASSERT_NO_MSG(err == NRFX_SUCCESS); } - nrfx_gpiote_input_config_t input_config = { - .pull = get_pull(flags) - }; - - err = nrfx_gpiote_input_configure(abs_pin, &input_config, NULL, NULL); - - return (err != NRFX_SUCCESS) ? -EINVAL : 0; + return 0; } static int gpio_nrfx_port_get_raw(const struct device *port, @@ -242,12 +252,17 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, enum gpio_int_mode mode, enum gpio_int_trig trig) { - uint32_t abs_pin = NRF_GPIO_PIN_MAP(get_port_cfg(port)->port_num, pin); + const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); + uint32_t abs_pin = NRF_GPIO_PIN_MAP(cfg->port_num, pin); nrfx_err_t err; uint8_t ch; + if (!has_gpiote(cfg)) { + return -ENOTSUP; + } + if (mode == GPIO_INT_MODE_DISABLED) { - nrfx_gpiote_trigger_disable(abs_pin); + nrfx_gpiote_trigger_disable(&cfg->gpiote, abs_pin); return 0; } @@ -255,16 +270,19 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, nrfx_gpiote_trigger_config_t trigger_config = { .trigger = get_trigger(mode, trig), }; + nrfx_gpiote_input_pin_config_t input_pin_config = { + .p_trigger_config = &trigger_config, + }; /* If edge mode is to be used and pin is not configured to use sense for * edge use IN event. */ - if (!(BIT(pin) & get_port_cfg(port)->edge_sense) && + if (!(BIT(pin) & cfg->edge_sense) && (mode == GPIO_INT_MODE_EDGE) && (nrf_gpio_pin_dir_get(abs_pin) == NRF_GPIO_PIN_DIR_INPUT)) { - err = nrfx_gpiote_channel_get(abs_pin, &ch); + err = nrfx_gpiote_channel_get(&cfg->gpiote, abs_pin, &ch); if (err == NRFX_ERROR_INVALID_PARAM) { - err = nrfx_gpiote_channel_alloc(&ch); + err = nrfx_gpiote_channel_alloc(&cfg->gpiote, &ch); if (err != NRFX_SUCCESS) { return -ENOMEM; } @@ -273,12 +291,12 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, trigger_config.p_in_channel = &ch; } - err = nrfx_gpiote_input_configure(abs_pin, NULL, &trigger_config, NULL); + err = nrfx_gpiote_input_configure(&cfg->gpiote, abs_pin, &input_pin_config); if (err != NRFX_SUCCESS) { return -EINVAL; } - nrfx_gpiote_trigger_enable(abs_pin, true); + nrfx_gpiote_trigger_enable(&cfg->gpiote, abs_pin, true); return 0; } @@ -367,26 +385,31 @@ static void nrfx_gpio_handler(nrfx_gpiote_pin_t abs_pin, } #endif /* CONFIG_GPIO_NRFX_INTERRUPT */ -#define GPIOTE_NODE DT_INST(0, nordic_nrf_gpiote) +#define GPIOTE_IRQ_HANDLER_CONNECT(node_id) \ + IRQ_CONNECT(DT_IRQN(node_id), DT_IRQ(node_id, priority), nrfx_isr, \ + NRFX_CONCAT(nrfx_gpiote_, DT_PROP(node_id, instance), _irq_handler), 0); static int gpio_nrfx_init(const struct device *port) { + const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); nrfx_err_t err; - if (nrfx_gpiote_is_init()) { + if (!has_gpiote(cfg)) { + return 0; + } + + if (nrfx_gpiote_init_check(&cfg->gpiote)) { return 0; } - err = nrfx_gpiote_init(0/*not used*/); + err = nrfx_gpiote_init(&cfg->gpiote, 0 /*not used*/); if (err != NRFX_SUCCESS) { return -EIO; } #ifdef CONFIG_GPIO_NRFX_INTERRUPT - nrfx_gpiote_global_callback_set(nrfx_gpio_handler, NULL); - - IRQ_CONNECT(DT_IRQN(GPIOTE_NODE), DT_IRQ(GPIOTE_NODE, priority), - nrfx_isr, nrfx_gpiote_irq_handler, 0); + nrfx_gpiote_global_callback_set(&cfg->gpiote, nrfx_gpio_handler, NULL); + DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_IRQ_HANDLER_CONNECT); #endif /* CONFIG_GPIO_NRFX_INTERRUPT */ return 0; @@ -408,12 +431,27 @@ static const struct gpio_driver_api gpio_nrfx_drv_api_funcs = { #endif }; +#define GPIOTE_PHANDLE(id) DT_INST_PHANDLE(id, gpiote_instance) +#define GPIOTE_INST(id) DT_PROP(GPIOTE_PHANDLE(id), instance) + +#define GPIOTE_INSTANCE(id) \ + COND_CODE_1(DT_INST_NODE_HAS_PROP(id, gpiote_instance), \ + (NRFX_GPIOTE_INSTANCE(GPIOTE_INST(id))), \ + ({ .p_reg = NULL })) + /* Device instantiation is done with node labels because 'port_num' is * the peripheral number by SoC numbering. We therefore cannot use * DT_INST APIs here without wider changes. */ +#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), \ + "Please enable GPIOTE instance for used GPIO port!")), \ + ()) + #define GPIO_NRF_DEVICE(id) \ + GPIOTE_CHECK(id); \ static const struct gpio_nrfx_cfg gpio_nrfx_p##id##_cfg = { \ .common = { \ .port_pin_mask = \ @@ -421,7 +459,8 @@ static const struct gpio_driver_api gpio_nrfx_drv_api_funcs = { }, \ .port = _CONCAT(NRF_P, DT_INST_PROP(id, port)), \ .port_num = DT_INST_PROP(id, port), \ - .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0) \ + .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0), \ + .gpiote = GPIOTE_INSTANCE(id), \ }; \ \ static struct gpio_nrfx_data gpio_nrfx_p##id##_data; \ diff --git a/drivers/pwm/pwm_nrf_sw.c b/drivers/pwm/pwm_nrf_sw.c index f367bb59899..2b9a22a38f0 100644 --- a/drivers/pwm/pwm_nrf_sw.c +++ b/drivers/pwm/pwm_nrf_sw.c @@ -62,6 +62,7 @@ struct pwm_config { NRF_RTC_Type *rtc; NRF_TIMER_Type *timer; }; + nrfx_gpiote_t gpiote[PWM_0_MAP_SIZE]; uint8_t psel_ch[PWM_0_MAP_SIZE]; uint8_t initially_inverted; uint8_t map_size; @@ -123,6 +124,7 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, const struct pwm_config *config = dev->config; NRF_TIMER_Type *timer = pwm_config_timer(config); NRF_RTC_Type *rtc = pwm_config_rtc(config); + NRF_GPIOTE_Type *gpiote; struct pwm_data *data = dev->data; uint32_t ppi_mask; uint8_t active_level; @@ -161,6 +163,7 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, } } + gpiote = config->gpiote[channel].p_reg; psel_ch = config->psel_ch[channel]; gpiote_ch = data->gpiote_ch[channel]; ppi_chs = data->ppi_ch[channel]; @@ -186,7 +189,7 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, : active_level); /* clear GPIOTE config */ - nrf_gpiote_te_default(NRF_GPIOTE, gpiote_ch); + nrf_gpiote_te_default(gpiote, gpiote_ch); /* No PWM generation for this channel. */ data->pulse_cycles[channel] = 0U; @@ -235,7 +238,7 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, } /* Configure GPIOTE - toggle task with proper initial output value. */ - NRF_GPIOTE->CONFIG[gpiote_ch] = + gpiote->CONFIG[gpiote_ch] = (GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos) | ((uint32_t)psel_ch << 8) | (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos) | @@ -256,9 +259,9 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, pulse_end_task = period_end_task = nrf_gpiote_out_task_get(gpiote_ch); #endif uint32_t pulse_end_task_address = - nrf_gpiote_task_address_get(NRF_GPIOTE, pulse_end_task); + nrf_gpiote_task_address_get(gpiote, pulse_end_task); uint32_t period_end_task_address = - nrf_gpiote_task_address_get(NRF_GPIOTE, period_end_task); + nrf_gpiote_task_address_get(gpiote, period_end_task); if (USE_RTC) { uint32_t clear_task_address = @@ -359,7 +362,8 @@ static int pwm_nrf_sw_init(const struct device *dev) } } - err = nrfx_gpiote_channel_alloc(&data->gpiote_ch[i]); + err = nrfx_gpiote_channel_alloc(&config->gpiote[i], + &data->gpiote_ch[i]); if (err != NRFX_SUCCESS) { /* Do not free allocated resource. It is a fatal condition, * system requires reconfiguration. @@ -402,8 +406,14 @@ static int pwm_nrf_sw_init(const struct device *dev) ((DT_GPIO_FLAGS_BY_IDX(_node_id, _prop, _idx) & GPIO_ACTIVE_LOW) \ ? BIT(_idx) : 0) | +#define GPIOTE_AND_COMMA(_node_id, _prop, _idx) \ + NRFX_GPIOTE_INSTANCE(NRF_DT_GPIOTE_INST_BY_IDX(_node_id, _prop, _idx)), + static const struct pwm_config pwm_nrf_sw_0_config = { COND_CODE_1(USE_RTC, (.rtc), (.timer)) = GENERATOR_ADDR, + .gpiote = { + DT_INST_FOREACH_PROP_ELEM(0, channel_gpios, GPIOTE_AND_COMMA) + }, .psel_ch = { DT_INST_FOREACH_PROP_ELEM(0, channel_gpios, PSEL_AND_COMMA) }, diff --git a/drivers/spi/spi_nrfx_common.c b/drivers/spi/spi_nrfx_common.c index 1ef233cfab3..04a11c2367a 100644 --- a/drivers/spi/spi_nrfx_common.c +++ b/drivers/spi/spi_nrfx_common.c @@ -6,40 +6,39 @@ #include "spi_nrfx_common.h" #include -#include -int spi_nrfx_wake_init(uint32_t wake_pin) +int spi_nrfx_wake_init(const nrfx_gpiote_t *gpiote, uint32_t wake_pin) { - nrfx_gpiote_input_config_t input_config = { - .pull = NRF_GPIO_PIN_PULLDOWN, - }; + nrf_gpio_pin_pull_t pull_config = NRF_GPIO_PIN_PULLDOWN; uint8_t ch; nrfx_gpiote_trigger_config_t trigger_config = { .trigger = NRFX_GPIOTE_TRIGGER_HITOLO, .p_in_channel = &ch, }; + nrfx_gpiote_input_pin_config_t input_config = { + .p_pull_config = &pull_config, + .p_trigger_config = &trigger_config, + .p_handler_config = NULL, + }; nrfx_err_t res; - res = nrfx_gpiote_channel_alloc(&ch); + res = nrfx_gpiote_channel_alloc(gpiote, &ch); if (res != NRFX_SUCCESS) { return -ENODEV; } - res = nrfx_gpiote_input_configure(wake_pin, - &input_config, - &trigger_config, - NULL); + res = nrfx_gpiote_input_configure(gpiote, wake_pin, &input_config); if (res != NRFX_SUCCESS) { - nrfx_gpiote_channel_free(ch); + nrfx_gpiote_channel_free(gpiote, ch); return -EIO; } return 0; } -int spi_nrfx_wake_request(uint32_t wake_pin) +int spi_nrfx_wake_request(const nrfx_gpiote_t *gpiote, uint32_t wake_pin) { - nrf_gpiote_event_t trigger_event = nrfx_gpiote_in_event_get(wake_pin); + nrf_gpiote_event_t trigger_event = nrfx_gpiote_in_event_get(gpiote, wake_pin); uint32_t start_cycles; uint32_t max_wait_cycles = DIV_ROUND_UP(CONFIG_SPI_NRFX_WAKE_TIMEOUT_US * @@ -51,7 +50,7 @@ int spi_nrfx_wake_request(uint32_t wake_pin) * The expected time to wait is quite short so it is not worth paying * the overhead of context switching to handle the interrupt. */ - nrfx_gpiote_trigger_enable(wake_pin, false); + nrfx_gpiote_trigger_enable(gpiote, wake_pin, false); /* Enable pull-up on the WAKE line. After the slave device sees the * WAKE line going high, it will force the line to go low. This will * be caught by the enabled trigger and the loop below waits for that. @@ -59,7 +58,7 @@ int spi_nrfx_wake_request(uint32_t wake_pin) nrf_gpio_cfg_input(wake_pin, NRF_GPIO_PIN_PULLUP); start_cycles = k_cycle_get_32(); - while (!nrf_gpiote_event_check(NRF_GPIOTE, trigger_event)) { + while (!nrf_gpiote_event_check(gpiote->p_reg, trigger_event)) { uint32_t elapsed_cycles = k_cycle_get_32() - start_cycles; if (elapsed_cycles >= max_wait_cycles) { @@ -68,7 +67,7 @@ int spi_nrfx_wake_request(uint32_t wake_pin) } } - nrfx_gpiote_trigger_disable(wake_pin); + nrfx_gpiote_trigger_disable(gpiote, wake_pin); nrf_gpio_cfg_input(wake_pin, NRF_GPIO_PIN_PULLDOWN); return err; diff --git a/drivers/spi/spi_nrfx_common.h b/drivers/spi/spi_nrfx_common.h index 515ed5c6f1f..0cf17e2a035 100644 --- a/drivers/spi/spi_nrfx_common.h +++ b/drivers/spi/spi_nrfx_common.h @@ -8,10 +8,17 @@ #define ZEPHYR_DRIVERS_SPI_NRFX_COMMON_H_ #include +#include #define WAKE_PIN_NOT_USED UINT32_MAX -int spi_nrfx_wake_init(uint32_t wake_pin); -int spi_nrfx_wake_request(uint32_t wake_pin); +#define WAKE_GPIOTE_INSTANCE(node_id) \ + COND_CODE_1(DT_NODE_HAS_PROP(node_id, wake_gpios), \ + (NRFX_GPIOTE_INSTANCE( \ + NRF_DT_GPIOTE_INST(node_id, wake_gpios))), \ + ({0})) + +int spi_nrfx_wake_init(const nrfx_gpiote_t *gpiote, uint32_t wake_pin); +int spi_nrfx_wake_request(const nrfx_gpiote_t *gpiote, uint32_t wake_pin); #endif /* ZEPHYR_DRIVERS_SPI_NRFX_COMMON_H_ */ diff --git a/drivers/spi/spi_nrfx_spi.c b/drivers/spi/spi_nrfx_spi.c index fd1dc5d933c..04d7853d11d 100644 --- a/drivers/spi/spi_nrfx_spi.c +++ b/drivers/spi/spi_nrfx_spi.c @@ -31,6 +31,7 @@ struct spi_nrfx_config { void (*irq_connect)(void); const struct pinctrl_dev_config *pcfg; uint32_t wake_pin; + nrfx_gpiote_t wake_gpiote; }; static void event_handler(const nrfx_spi_evt_t *p_event, void *p_context); @@ -237,7 +238,8 @@ static int transceive(const struct device *dev, dev_data->busy = true; if (dev_config->wake_pin != WAKE_PIN_NOT_USED) { - error = spi_nrfx_wake_request(dev_config->wake_pin); + error = spi_nrfx_wake_request(&dev_config->wake_gpiote, + dev_config->wake_pin); if (error == -ETIMEDOUT) { LOG_WRN("Waiting for WAKE acknowledgment timed out"); /* If timeout occurs, try to perform the transfer @@ -381,7 +383,7 @@ static int spi_nrfx_init(const struct device *dev) } if (dev_config->wake_pin != WAKE_PIN_NOT_USED) { - err = spi_nrfx_wake_init(dev_config->wake_pin); + err = spi_nrfx_wake_init(&dev_config->wake_gpiote, dev_config->wake_pin); if (err == -ENODEV) { LOG_ERR("Failed to allocate GPIOTE channel for WAKE"); return err; @@ -444,6 +446,7 @@ static int spi_nrfx_init(const struct device *dev) .pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPI(idx)), \ .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPI(idx), wake_gpios, \ WAKE_PIN_NOT_USED), \ + .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPI(idx)), \ }; \ BUILD_ASSERT(!DT_NODE_HAS_PROP(SPI(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPI(idx), wake_gpios) & GPIO_ACTIVE_LOW), \ diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 8b187f54c52..fb89f096cca 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -9,7 +9,6 @@ #include #include #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 -#include #include #endif #include @@ -61,6 +60,7 @@ struct spi_nrfx_config { bool anomaly_58_workaround; #endif uint32_t wake_pin; + nrfx_gpiote_t wake_gpiote; }; static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context); @@ -204,6 +204,8 @@ static int configure(const struct device *dev, } #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 +static const nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE(0); + /* * Brief Workaround for transmitting 1 byte with SPIM. * @@ -223,15 +225,15 @@ static void anomaly_58_workaround_setup(const struct device *dev) NRF_SPIM_Type *spim = dev_config->spim.p_reg; uint32_t ppi_ch = dev_data->ppi_ch; uint32_t gpiote_ch = dev_data->gpiote_ch; - uint32_t eep = (uint32_t)&NRF_GPIOTE->EVENTS_IN[gpiote_ch]; + uint32_t eep = (uint32_t)&gpiote.p_reg->EVENTS_IN[gpiote_ch]; uint32_t tep = (uint32_t)&spim->TASKS_STOP; dev_data->anomaly_58_workaround_active = true; /* Create an event when SCK toggles */ - nrf_gpiote_event_configure(NRF_GPIOTE, gpiote_ch, spim->PSEL.SCK, + nrf_gpiote_event_configure(gpiote.p_reg, gpiote_ch, spim->PSEL.SCK, GPIOTE_CONFIG_POLARITY_Toggle); - nrf_gpiote_event_enable(NRF_GPIOTE, gpiote_ch); + nrf_gpiote_event_enable(gpiote.p_reg, gpiote_ch); /* Stop the spim instance when SCK toggles */ nrf_ppi_channel_endpoint_setup(NRF_PPI, ppi_ch, eep, tep); @@ -250,7 +252,7 @@ static void anomaly_58_workaround_clear(struct spi_nrfx_data *dev_data) if (dev_data->anomaly_58_workaround_active) { nrf_ppi_channel_disable(NRF_PPI, ppi_ch); - nrf_gpiote_task_disable(NRF_GPIOTE, gpiote_ch); + nrf_gpiote_task_disable(gpiote.p_reg, gpiote_ch); dev_data->anomaly_58_workaround_active = false; } @@ -271,7 +273,7 @@ static int anomaly_58_workaround_init(const struct device *dev) return -ENODEV; } - err_code = nrfx_gpiote_channel_alloc(&dev_data->gpiote_ch); + err_code = nrfx_gpiote_channel_alloc(&gpiote, &dev_data->gpiote_ch); if (err_code != NRFX_SUCCESS) { LOG_ERR("Failed to allocate GPIOTE channel"); return -ENODEV; @@ -399,7 +401,8 @@ static int transceive(const struct device *dev, dev_data->busy = true; if (dev_config->wake_pin != WAKE_PIN_NOT_USED) { - error = spi_nrfx_wake_request(dev_config->wake_pin); + error = spi_nrfx_wake_request(&dev_config->wake_gpiote, + dev_config->wake_pin); if (error == -ETIMEDOUT) { LOG_WRN("Waiting for WAKE acknowledgment timed out"); /* If timeout occurs, try to perform the transfer @@ -547,7 +550,7 @@ static int spi_nrfx_init(const struct device *dev) } if (dev_config->wake_pin != WAKE_PIN_NOT_USED) { - err = spi_nrfx_wake_init(dev_config->wake_pin); + err = spi_nrfx_wake_init(&dev_config->wake_gpiote, dev_config->wake_pin); if (err == -ENODEV) { LOG_ERR("Failed to allocate GPIOTE channel for WAKE"); return err; @@ -634,6 +637,7 @@ static int spi_nrfx_init(const struct device *dev) ()) \ .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPIM(idx), wake_gpios, \ WAKE_PIN_NOT_USED), \ + .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ }; \ BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIM(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ diff --git a/drivers/watchdog/wdt_nrfx.c b/drivers/watchdog/wdt_nrfx.c index 363a1174e91..8967d1e162b 100644 --- a/drivers/watchdog/wdt_nrfx.c +++ b/drivers/watchdog/wdt_nrfx.c @@ -145,8 +145,12 @@ static const struct wdt_driver_api wdt_nrfx_driver_api = { .feed = wdt_nrf_feed, }; -static void wdt_event_handler(const struct device *dev, uint32_t requests) +static void wdt_event_handler(const struct device *dev, nrf_wdt_event_t event_type, + uint32_t requests, void *p_context) { + (void)event_type; + (void)p_context; + struct wdt_nrfx_data *data = dev->data; while (requests) { @@ -162,9 +166,12 @@ static void wdt_event_handler(const struct device *dev, uint32_t requests) #define WDT(idx) DT_NODELABEL(wdt##idx) #define WDT_NRFX_WDT_DEVICE(idx) \ - static void wdt_##idx##_event_handler(uint32_t requests) \ + static void wdt_##idx##_event_handler(nrf_wdt_event_t event_type, \ + uint32_t requests, \ + void *p_context) \ { \ - wdt_event_handler(DEVICE_DT_GET(WDT(idx)), requests); \ + wdt_event_handler(DEVICE_DT_GET(WDT(idx)), event_type, \ + requests, p_context); \ } \ static int wdt_##idx##_init(const struct device *dev) \ { \ @@ -174,7 +181,8 @@ static void wdt_event_handler(const struct device *dev, uint32_t requests) nrfx_isr, nrfx_wdt_##idx##_irq_handler, 0); \ err_code = nrfx_wdt_init(&config->wdt, \ NULL, \ - wdt_##idx##_event_handler); \ + wdt_##idx##_event_handler, \ + NULL); \ if (err_code != NRFX_SUCCESS) { \ return -EBUSY; \ } \ diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 72617325684..57417644c32 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -9,12 +9,6 @@ #include -/* - * NRFX API version 2.10 flag. - * When the flag is set NRFX API is compatible with the newest NRFX release. - */ -#define NRFX_CONFIG_API_VER_2_10 1 - /* * These are mappings of Kconfig options enabling nrfx drivers and particular * peripheral instances to the corresponding symbols used inside of nrfx. diff --git a/modules/hal_nordic/nrfx/nrfx_config_common.h b/modules/hal_nordic/nrfx/nrfx_config_common.h index 8c0a58713a0..28a3a15b0de 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 0 +#define NRFX_CONFIG_API_VER_MINOR 2 #endif /** @brief Symbol specifying micro version of the nrfx API to be used. */ diff --git a/samples/boards/nrf/nrfx/Kconfig b/samples/boards/nrf/nrfx/Kconfig index 0d54067202a..09076c9da49 100644 --- a/samples/boards/nrf/nrfx/Kconfig +++ b/samples/boards/nrf/nrfx/Kconfig @@ -7,4 +7,14 @@ config NRFX_DPPI config NRFX_PPI default HAS_HW_NRF_PPI +config NRFX_GPIOTE0 + default y if SOC_SERIES_NRF51X || \ + SOC_SERIES_NRF52X || \ + (SOC_SERIES_NRF53X && !TRUSTED_EXECUTION_NONSECURE) || \ + (SOC_SERIES_NRF91X && !TRUSTED_EXECUTION_NONSECURE) + +config NRFX_GPIOTE1 + default y if (SOC_SERIES_NRF53X && TRUSTED_EXECUTION_NONSECURE) || \ + (SOC_SERIES_NRF91X && TRUSTED_EXECUTION_NONSECURE) + source "Kconfig.zephyr" diff --git a/samples/boards/nrf/nrfx/prj.conf b/samples/boards/nrf/nrfx/prj.conf index 32cbfc3279c..d4f0c29699f 100644 --- a/samples/boards/nrf/nrfx/prj.conf +++ b/samples/boards/nrf/nrfx/prj.conf @@ -1,4 +1,3 @@ CONFIG_GPIO=n -CONFIG_NRFX_GPIOTE=y CONFIG_LOG=y CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100 diff --git a/samples/boards/nrf/nrfx/src/main.c b/samples/boards/nrf/nrfx/src/main.c index 615b800545e..0643b1c0911 100644 --- a/samples/boards/nrf/nrfx/src/main.c +++ b/samples/boards/nrf/nrfx/src/main.c @@ -21,6 +21,15 @@ LOG_MODULE_REGISTER(nrfx_sample, LOG_LEVEL_INF); #define INPUT_PIN DT_GPIO_PIN(DT_ALIAS(sw0), gpios) #define OUTPUT_PIN DT_GPIO_PIN(DT_ALIAS(led0), gpios) +#define GPIOTE_INST NRF_DT_GPIOTE_INST(DT_ALIAS(sw0), gpios) +#define GPIOTE_NODE DT_NODELABEL(_CONCAT(gpiote, GPIOTE_INST)) + +BUILD_ASSERT(NRF_DT_GPIOTE_INST(DT_ALIAS(led0), gpios) == GPIOTE_INST, + "Both sw0 and led0 GPIOs must use the same GPIOTE instance"); +BUILD_ASSERT(IS_ENABLED(_CONCAT(CONFIG_, _CONCAT(NRFX_GPIOTE, GPIOTE_INST))), + "NRFX_GPIOTE" STRINGIFY(GPIOTE_INST) " must be enabled in Kconfig"); + + static void button_handler(nrfx_gpiote_pin_t pin, nrfx_gpiote_trigger_t trigger, void *context) @@ -35,28 +44,28 @@ int main(void) nrfx_err_t err; uint8_t in_channel, out_channel; uint8_t ppi_channel; + const nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE(GPIOTE_INST); - /* Connect GPIOTE_0 IRQ to nrfx_gpiote_irq_handler */ - IRQ_CONNECT(DT_IRQN(DT_NODELABEL(gpiote)), - DT_IRQ(DT_NODELABEL(gpiote), priority), - nrfx_isr, nrfx_gpiote_irq_handler, 0); + /* Connect GPIOTE instance IRQ to irq handler */ + IRQ_CONNECT(DT_IRQN(GPIOTE_NODE), DT_IRQ(GPIOTE_NODE, priority), nrfx_isr, + NRFX_CONCAT(nrfx_gpiote_, GPIOTE_INST, _irq_handler), 0); /* Initialize GPIOTE (the interrupt priority passed as the parameter * here is ignored, see nrfx_glue.h). */ - err = nrfx_gpiote_init(0); + err = nrfx_gpiote_init(&gpiote, 0); if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_gpiote_init error: 0x%08X", err); return 0; } - err = nrfx_gpiote_channel_alloc(&in_channel); + err = nrfx_gpiote_channel_alloc(&gpiote, &in_channel); if (err != NRFX_SUCCESS) { LOG_ERR("Failed to allocate in_channel, error: 0x%08X", err); return 0; } - err = nrfx_gpiote_channel_alloc(&out_channel); + err = nrfx_gpiote_channel_alloc(&gpiote, &out_channel); if (err != NRFX_SUCCESS) { LOG_ERR("Failed to allocate out_channel, error: 0x%08X", err); return 0; @@ -65,20 +74,22 @@ int main(void) /* Initialize input pin to generate event on high to low transition * (falling edge) and call button_handler() */ - static const nrfx_gpiote_input_config_t input_config = { - .pull = NRF_GPIO_PIN_PULLUP, - }; - const nrfx_gpiote_trigger_config_t trigger_config = { + static const nrf_gpio_pin_pull_t pull_config = NRF_GPIO_PIN_PULLUP; + nrfx_gpiote_trigger_config_t trigger_config = { .trigger = NRFX_GPIOTE_TRIGGER_HITOLO, .p_in_channel = &in_channel, }; static const nrfx_gpiote_handler_config_t handler_config = { .handler = button_handler, }; - err = nrfx_gpiote_input_configure(INPUT_PIN, - &input_config, - &trigger_config, - &handler_config); + nrfx_gpiote_input_pin_config_t input_config = { + .p_pull_config = &pull_config, + .p_trigger_config = &trigger_config, + .p_handler_config = &handler_config + }; + + err = nrfx_gpiote_input_configure(&gpiote, INPUT_PIN, &input_config); + if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_gpiote_input_configure error: 0x%08X", err); return 0; @@ -97,7 +108,7 @@ int main(void) .polarity = NRF_GPIOTE_POLARITY_TOGGLE, .init_val = 1, }; - err = nrfx_gpiote_output_configure(OUTPUT_PIN, + err = nrfx_gpiote_output_configure(&gpiote, OUTPUT_PIN, &output_config, &task_config); if (err != NRFX_SUCCESS) { @@ -105,8 +116,8 @@ int main(void) return 0; } - nrfx_gpiote_trigger_enable(INPUT_PIN, true); - nrfx_gpiote_out_task_enable(OUTPUT_PIN); + nrfx_gpiote_trigger_enable(&gpiote, INPUT_PIN, true); + nrfx_gpiote_out_task_enable(&gpiote, OUTPUT_PIN); LOG_INF("nrfx_gpiote initialized"); @@ -122,8 +133,8 @@ int main(void) * the button is pressed, the LED pin will be toggled. */ nrfx_gppi_channel_endpoints_setup(ppi_channel, - nrfx_gpiote_in_event_address_get(INPUT_PIN), - nrfx_gpiote_out_task_address_get(OUTPUT_PIN)); + nrfx_gpiote_in_event_address_get(&gpiote, INPUT_PIN), + nrfx_gpiote_out_task_address_get(&gpiote, OUTPUT_PIN)); /* Enable the channel. */ nrfx_gppi_channels_enable(BIT(ppi_channel)); From 3723866343b95bd394978d1cfc6b386b465c2296 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Thu, 21 Dec 2023 21:07:00 +0100 Subject: [PATCH 0227/2300] [nrf fromtree] manifest: hal_nordic: update revision to have nrfx 3.3.0 release New hal_nordic revision contains nrfx 3.3.0 which adds support for nRF54H20 EngA and nRF54L15 EngA devices. Signed-off-by: Nikodem Kastelik (cherry picked from commit c8d22cf13ae05e03695330bd34669af3c1336ea7) Signed-off-by: Robert Lubos (cherry picked from commit 500afdbfdb655b3c8bcd54eef3ca405f075aac9f) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index ea8352aa7cf..2697b445524 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 3786c55424d4d64c62dd25219de31618cef26fdf + revision: b55cfbbf0221d709560c2e438beef66842ada272 path: modules/hal/nordic groups: - hal From 06b8a5648cd644eb054a1df3165611f4eeb88359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 8 Nov 2023 13:33:57 +0100 Subject: [PATCH 0228/2300] [nrf fromtree] drivers: serial: Add async to interrupt driven adaptation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add adaptation layer which allows to provide interrupt driven API for drivers which exposes only asynchronous API. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 2854fc18fdbd626e9486a9808b598702198856a0) Signed-off-by: Robert Lubos (cherry picked from commit 6c7e834afa72ef9b2e35d78d05c6f4bf3827347d) --- drivers/serial/CMakeLists.txt | 1 + drivers/serial/Kconfig | 15 + drivers/serial/uart_async_to_irq.c | 377 ++++++++++++++++++ .../zephyr/drivers/serial/uart_async_to_irq.h | 285 +++++++++++++ 4 files changed, 678 insertions(+) create mode 100644 drivers/serial/uart_async_to_irq.c create mode 100644 include/zephyr/drivers/serial/uart_async_to_irq.h diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt index bfc38603864..2cd79e12f64 100644 --- a/drivers/serial/CMakeLists.txt +++ b/drivers/serial/CMakeLists.txt @@ -93,3 +93,4 @@ endif() 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 5eb183c9a3e..2d097932cf4 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -133,6 +133,21 @@ config UART_ASYNC_RX_HELPER is delayed. Module implements zero-copy approach with multiple reception buffers. +config UART_ASYNC_TO_INT_DRIVEN_API + bool + select UART_ASYNC_RX_HELPER + help + Asynchronous to Interrupt driven adaptation layer. When enabled device + which implements only asynchronous API can be used with interrupt driven + API implemented by the generic adaptation layer. + +config UART_ASYNC_TO_INT_DRIVEN_RX_TIMEOUT + int "Receiver timeout (in bauds)" + depends on UART_ASYNC_TO_INT_DRIVEN_API + default 100 + help + Receiver inactivity timeout. It is used to calculate timeout in microseconds. + comment "Serial Drivers" source "drivers/serial/Kconfig.b91" diff --git a/drivers/serial/uart_async_to_irq.c b/drivers/serial/uart_async_to_irq.c new file mode 100644 index 00000000000..209e8d4f205 --- /dev/null +++ b/drivers/serial/uart_async_to_irq.c @@ -0,0 +1,377 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +LOG_MODULE_REGISTER(UART_ASYNC_TO_IRQ_LOG_NAME, CONFIG_UART_LOG_LEVEL); + +/* Internal state flags. */ + +/* RX interrupt enabled. */ +#define A2I_RX_IRQ_ENABLED BIT(0) + +/* TX interrupt enabled. */ +#define A2I_TX_IRQ_ENABLED BIT(1) + +/* Error interrupt enabled. */ +#define A2I_ERR_IRQ_ENABLED BIT(2) + +/* Receiver to be kept enabled. */ +#define A2I_RX_ENABLE BIT(3) + +/* TX busy. */ +#define A2I_TX_BUSY BIT(4) + +static struct uart_async_to_irq_data *get_data(const struct device *dev) +{ + struct uart_async_to_irq_data **data = dev->data; + + return *data; +} + +static const struct uart_async_to_irq_config *get_config(const struct device *dev) +{ + const struct uart_async_to_irq_config * const *config = dev->config; + + return *config; +} + +/* Function calculates RX timeout based on baudrate. */ +static uint32_t get_rx_timeout(const struct device *dev) +{ + struct uart_config cfg; + int err; + uint32_t baudrate; + + err = uart_config_get(dev, &cfg); + if (err == 0) { + baudrate = cfg.baudrate; + } else { + baudrate = get_config(dev)->baudrate; + } + + uint32_t us = (CONFIG_UART_ASYNC_TO_INT_DRIVEN_RX_TIMEOUT * 1000000) / baudrate; + + return us; +} + +static int rx_enable(const struct device *dev, + struct uart_async_to_irq_data *data, + uint8_t *buf, + size_t len) +{ + int err; + const struct uart_async_to_irq_config *config = get_config(dev); + + err = config->api->rx_enable(dev, buf, len, get_rx_timeout(dev)); + + return err; +} + +static int try_rx_enable(const struct device *dev, struct uart_async_to_irq_data *data) +{ + uint8_t *buf = uart_async_rx_buf_req(&data->rx.async_rx); + size_t len = uart_async_rx_get_buf_len(&data->rx.async_rx); + + if (buf == NULL) { + return -EBUSY; + } + + return rx_enable(dev, data, buf, len); +} + +static void on_rx_buf_req(const struct device *dev, + const struct uart_async_to_irq_config *config, + struct uart_async_to_irq_data *data) +{ + struct uart_async_rx *async_rx = &data->rx.async_rx; + uint8_t *buf = uart_async_rx_buf_req(async_rx); + size_t len = uart_async_rx_get_buf_len(async_rx); + + if (buf) { + int err = config->api->rx_buf_rsp(dev, buf, len); + + if (err < 0) { + uart_async_rx_on_buf_rel(async_rx, buf); + } + } else { + atomic_inc(&data->rx.pending_buf_req); + } +} + +static void on_rx_dis(const struct device *dev, struct uart_async_to_irq_data *data) +{ + if (data->flags & A2I_RX_ENABLE) { + data->rx.pending_buf_req = 0; + + int err = try_rx_enable(dev, data); + + LOG_INST_DBG(get_config(dev)->log, "Reenabling RX from RX_DISABLED (err:%d)", err); + __ASSERT_NO_MSG(err >= 0); + return; + } + + k_sem_give(&data->rx.sem); +} + +static void uart_async_to_irq_callback(const struct device *dev, + struct uart_event *evt, + void *user_data) +{ + struct uart_async_to_irq_data *data = (struct uart_async_to_irq_data *)user_data; + const struct uart_async_to_irq_config *config = get_config(dev); + bool call_handler = false; + + switch (evt->type) { + case UART_TX_DONE: + atomic_and(&data->flags, ~A2I_TX_BUSY); + call_handler = data->flags & A2I_TX_IRQ_ENABLED; + break; + case UART_RX_RDY: + uart_async_rx_on_rdy(&data->rx.async_rx, evt->data.rx.buf, evt->data.rx.len); + call_handler = data->flags & A2I_RX_IRQ_ENABLED; + break; + case UART_RX_BUF_REQUEST: + on_rx_buf_req(dev, config, data); + break; + case UART_RX_BUF_RELEASED: + uart_async_rx_on_buf_rel(&data->rx.async_rx, evt->data.rx_buf.buf); + break; + case UART_RX_STOPPED: + call_handler = data->flags & A2I_ERR_IRQ_ENABLED; + break; + case UART_RX_DISABLED: + on_rx_dis(dev, data); + break; + default: + break; + } + + if (data->callback && call_handler) { + atomic_inc(&data->irq_req); + config->trampoline(dev); + } +} + +int z_uart_async_to_irq_fifo_fill(const struct device *dev, const uint8_t *buf, int len) +{ + struct uart_async_to_irq_data *data = get_data(dev); + const struct uart_async_to_irq_config *config = get_config(dev); + int err; + + len = MIN(len, data->tx.len); + if (atomic_or(&data->flags, A2I_TX_BUSY) & A2I_TX_BUSY) { + return 0; + } + + memcpy(data->tx.buf, buf, len); + + err = config->api->tx(dev, data->tx.buf, len, SYS_FOREVER_US); + if (err < 0) { + atomic_and(&data->flags, ~A2I_TX_BUSY); + return 0; + } + + return len; +} + +/** Interrupt driven FIFO read function */ +int z_uart_async_to_irq_fifo_read(const struct device *dev, + uint8_t *buf, + const int len) +{ + struct uart_async_to_irq_data *data = get_data(dev); + const struct uart_async_to_irq_config *config = get_config(dev); + struct uart_async_rx *async_rx = &data->rx.async_rx; + size_t claim_len; + uint8_t *claim_buf; + + claim_len = uart_async_rx_data_claim(async_rx, &claim_buf, len); + if (claim_len == 0) { + return 0; + } + + memcpy(buf, claim_buf, claim_len); + uart_async_rx_data_consume(async_rx, claim_len); + + if (data->rx.pending_buf_req) { + buf = uart_async_rx_buf_req(async_rx); + if (buf) { + int err; + size_t rx_len = uart_async_rx_get_buf_len(async_rx); + + atomic_dec(&data->rx.pending_buf_req); + err = config->api->rx_buf_rsp(dev, buf, rx_len); + if (err < 0) { + if (err == -EACCES) { + data->rx.pending_buf_req = 0; + err = rx_enable(dev, data, buf, rx_len); + } + if (err < 0) { + return err; + } + } + } + } + + return (int)claim_len; +} + +static void dir_disable(const struct device *dev, uint32_t flag) +{ + struct uart_async_to_irq_data *data = get_data(dev); + + atomic_and(&data->flags, ~flag); +} + +static void dir_enable(const struct device *dev, uint32_t flag) +{ + struct uart_async_to_irq_data *data = get_data(dev); + + atomic_or(&data->flags, flag); + + atomic_inc(&data->irq_req); + get_config(dev)->trampoline(dev); +} + +/** Interrupt driven transfer enabling function */ +void z_uart_async_to_irq_irq_tx_enable(const struct device *dev) +{ + dir_enable(dev, A2I_TX_IRQ_ENABLED); +} + +/** Interrupt driven transfer disabling function */ +void z_uart_async_to_irq_irq_tx_disable(const struct device *dev) +{ + dir_disable(dev, A2I_TX_IRQ_ENABLED); +} + +/** Interrupt driven transfer ready function */ +int z_uart_async_to_irq_irq_tx_ready(const struct device *dev) +{ + struct uart_async_to_irq_data *data = get_data(dev); + + return (data->flags & A2I_TX_IRQ_ENABLED) && !(data->flags & A2I_TX_BUSY); +} + +/** Interrupt driven receiver enabling function */ +void z_uart_async_to_irq_irq_rx_enable(const struct device *dev) +{ + dir_enable(dev, A2I_RX_IRQ_ENABLED); +} + +/** Interrupt driven receiver disabling function */ +void z_uart_async_to_irq_irq_rx_disable(const struct device *dev) +{ + dir_disable(dev, A2I_RX_IRQ_ENABLED); +} + +/** 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); +} + +/** Interrupt driven receiver ready function */ +int z_uart_async_to_irq_irq_rx_ready(const struct device *dev) +{ + struct uart_async_to_irq_data *data = get_data(dev); + + return (data->flags & A2I_RX_IRQ_ENABLED) && (data->rx.async_rx.pending_bytes > 0); +} + +/** Interrupt driven error enabling function */ +void z_uart_async_to_irq_irq_err_enable(const struct device *dev) +{ + dir_enable(dev, A2I_ERR_IRQ_ENABLED); +} + +/** Interrupt driven error disabling function */ +void z_uart_async_to_irq_irq_err_disable(const struct device *dev) +{ + dir_disable(dev, A2I_ERR_IRQ_ENABLED); +} + +/** Interrupt driven pending status function */ +int z_uart_async_to_irq_irq_is_pending(const struct device *dev) +{ + return z_uart_async_to_irq_irq_tx_ready(dev) || z_uart_async_to_irq_irq_rx_ready(dev); +} + +/** Interrupt driven interrupt update function */ +int z_uart_async_to_irq_irq_update(const struct device *dev) +{ + return 1; +} + +/** Set the irq callback function */ +void z_uart_async_to_irq_irq_callback_set(const struct device *dev, + uart_irq_callback_user_data_t cb, + void *user_data) +{ + struct uart_async_to_irq_data *data = get_data(dev); + + data->callback = cb; + data->user_data = user_data; +} + +int uart_async_to_irq_rx_enable(const struct device *dev) +{ + struct uart_async_to_irq_data *data = get_data(dev); + const struct uart_async_to_irq_config *config = get_config(dev); + int err; + + err = config->api->callback_set(dev, uart_async_to_irq_callback, data); + if (err < 0) { + return err; + } + + uart_async_rx_reset(&data->rx.async_rx); + + err = try_rx_enable(dev, data); + if (err == 0) { + atomic_or(&data->flags, A2I_RX_ENABLE); + } + + return err; +} + +int uart_async_to_irq_rx_disable(const struct device *dev) +{ + struct uart_async_to_irq_data *data = get_data(dev); + const struct uart_async_to_irq_config *config = get_config(dev); + int err; + + if (atomic_and(&data->flags, ~A2I_RX_ENABLE) & A2I_RX_ENABLE) { + err = config->api->rx_disable(dev); + if (err < 0) { + return err; + } + k_sem_take(&data->rx.sem, K_FOREVER); + } + + return 0; +} + +void uart_async_to_irq_trampoline_cb(const struct device *dev) +{ + struct uart_async_to_irq_data *data = get_data(dev); + + do { + data->callback(dev, data->user_data); + } while (atomic_dec(&data->irq_req) > 1); +} + +int uart_async_to_irq_init(struct uart_async_to_irq_data *data, + const struct uart_async_to_irq_config *config) +{ + data->tx.buf = config->tx_buf; + data->tx.len = config->tx_len; + + k_sem_init(&data->rx.sem, 0, 1); + + return uart_async_rx_init(&data->rx.async_rx, &config->async_rx); +} diff --git a/include/zephyr/drivers/serial/uart_async_to_irq.h b/include/zephyr/drivers/serial/uart_async_to_irq.h new file mode 100644 index 00000000000..d5116dee2c0 --- /dev/null +++ b/include/zephyr/drivers/serial/uart_async_to_irq.h @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_SERIAL_UART_ASYNC_TO_IRQ_H_ +#define ZEPHYR_DRIVERS_SERIAL_UART_ASYNC_TO_IRQ_H_ + +#include +#include +#include +#include +#include + +/** + * @brief UART Asynchronous to Interrupt driven API adaptation layer + * @ingroup uart_interface + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations. */ + +/** @brief Data structure used by the adaptation layer. + * + * Pointer to that data must be the first element of the UART device data structure. + */ +struct uart_async_to_irq_data; + +/** @brief Configuration structure used by the adaptation layer. + * + * Pointer to this data must be the first element of the UART device configuration structure. + */ +struct uart_async_to_irq_config; + +/* @brief Function that triggers trampoline to the interrupt context. + * + * This context is used to call user UART interrupt handler. It is to used to + * fulfill the requirement that UART interrupt driven API shall be called from + * the UART interrupt. Trampoline context shall have the same priority as UART. + * + * One option may be to use k_timer configured to expire immediately. + */ +typedef void (*uart_async_to_irq_trampoline)(const struct device *dev); + +/** @brief Callback to be called from trampoline context. + * + * @param dev UART device. + */ +void uart_async_to_irq_trampoline_cb(const struct device *dev); + +/** @brief Interrupt driven API initializer. + * + * It should be used in the initialization of the UART API structure in the + * driver to provide interrupt driven API functions. + */ +#define UART_ASYNC_TO_IRQ_API_INIT() \ + .fifo_fill = z_uart_async_to_irq_fifo_fill, \ + .fifo_read = z_uart_async_to_irq_fifo_read, \ + .irq_tx_enable = z_uart_async_to_irq_irq_tx_enable, \ + .irq_tx_disable = z_uart_async_to_irq_irq_tx_disable, \ + .irq_tx_ready = z_uart_async_to_irq_irq_tx_ready, \ + .irq_rx_enable = z_uart_async_to_irq_irq_rx_enable, \ + .irq_rx_disable = z_uart_async_to_irq_irq_rx_disable, \ + .irq_tx_complete = z_uart_async_to_irq_irq_tx_complete,\ + .irq_rx_ready = z_uart_async_to_irq_irq_rx_ready, \ + .irq_err_enable = z_uart_async_to_irq_irq_err_enable, \ + .irq_err_disable = z_uart_async_to_irq_irq_err_disable,\ + .irq_is_pending = z_uart_async_to_irq_irq_is_pending, \ + .irq_update = z_uart_async_to_irq_irq_update, \ + .irq_callback_set = z_uart_async_to_irq_irq_callback_set + +/** @brief Configuration structure initializer. + * + * @param _api Structure with UART asynchronous API. + * @param _trampoline Function that trampolines to the interrupt context. + * @param _baudrate UART baudrate. + * @param _tx_buf TX buffer. + * @param _tx_len TX buffer length. + * @param _rx_buf RX buffer. + * @param _rx_len RX buffer length. + * @param _rx_cnt Number of chunks into which RX buffer is divided. + * @param _log Logging instance, if not provided (empty) then default is used. + */ +#define UART_ASYNC_TO_IRQ_API_CONFIG_INITIALIZER(_api, _trampoline, _baudrate, _tx_buf, \ + _tx_len, _rx_buf, _rx_len, _rx_cnt, _log) \ + { \ + .tx_buf = _tx_buf, \ + .tx_len = _tx_len, \ + .async_rx = { \ + .buffer = _rx_buf, \ + .length = _rx_len, \ + .buf_cnt = _rx_cnt \ + }, \ + .api = _api, \ + .trampoline = _trampoline, \ + .baudrate = _baudrate, \ + LOG_OBJECT_PTR_INIT(log, \ + COND_CODE_1(IS_EMPTY(_log), \ + (LOG_OBJECT_PTR(UART_ASYNC_TO_IRQ_LOG_NAME)), \ + (_log) \ + ) \ + ) \ + } + +/** @brief Initialize the adaptation layer. + * + * @param data Data associated with the given adaptation layer instance. + * @param config Configuration structure. Must be persistent. + * + * @retval 0 On successful initialization. + */ +int uart_async_to_irq_init(struct uart_async_to_irq_data *data, + const struct uart_async_to_irq_config *config); + +/* @brief Enable RX for interrupt driven API. + * + * @param dev UART device. Device must support asynchronous API. + * + * @retval 0 on successful operation. + * @retval -EINVAL if adaption layer has wrong configuration. + * @retval negative value Error reported by the UART API. + */ +int uart_async_to_irq_rx_enable(const struct device *dev); + +/* @brief Disable RX for interrupt driven API. + * + * @param dev UART device. Device must support asynchronous API. + * + * @retval 0 on successful operation. + * @retval -EINVAL if adaption layer has wrong configuration. + * @retval negative value Error reported by the UART API. + */ +int uart_async_to_irq_rx_disable(const struct device *dev); + +/* Starting from here API is internal only. */ + +/** @cond INTERNAL_HIDDEN + * @brief Structure used by the adaptation layer. + */ +struct uart_async_to_irq_config { + /** Pointer to the TX buffer. */ + uint8_t *tx_buf; + + /** TX buffer length. */ + size_t tx_len; + + /** UART Asynchronous RX helper configuration. */ + struct uart_async_rx_config async_rx; + + /** Async API used by the a2i layer. */ + const struct uart_async_to_irq_async_api *api; + + /** Trampoline callback. */ + uart_async_to_irq_trampoline trampoline; + + /** Initial baudrate. */ + uint32_t baudrate; + + /** Instance logging handler. */ + LOG_INSTANCE_PTR_DECLARE(log); +}; + +/** @brief Asynchronous API used by the adaptation layer. */ +struct uart_async_to_irq_async_api { + int (*callback_set)(const struct device *dev, + uart_callback_t callback, + void *user_data); + + int (*tx)(const struct device *dev, const uint8_t *buf, size_t len, + int32_t timeout); + int (*tx_abort)(const struct device *dev); + + int (*rx_enable)(const struct device *dev, uint8_t *buf, size_t len, + int32_t timeout); + int (*rx_buf_rsp)(const struct device *dev, uint8_t *buf, size_t len); + int (*rx_disable)(const struct device *dev); +}; + +/** @brief Structure holding receiver data. */ +struct uart_async_to_irq_rx_data { + /** Asynchronous RX helper data. */ + struct uart_async_rx async_rx; + + /** Semaphore for pending on RX disable. */ + struct k_sem sem; + + /** Number of pending buffer requests which weren't handled because lack of free buffers. */ + atomic_t pending_buf_req; +}; + +/** @brief Structure holding transmitter data. */ +struct uart_async_to_irq_tx_data { + /** TX buffer. */ + uint8_t *buf; + + /** Length of the buffer. */ + size_t len; +}; + +/** @briref Data associated with the asynchronous to the interrupt driven API adaptation layer. */ +struct uart_async_to_irq_data { + /** User callback for interrupt driven API. */ + uart_irq_callback_user_data_t callback; + + /** User data. */ + void *user_data; + + /** Interrupt request counter. */ + atomic_t irq_req; + + /** RX specific data. */ + struct uart_async_to_irq_rx_data rx; + + /** TX specific data. */ + struct uart_async_to_irq_tx_data tx; + + /** Spinlock. */ + struct k_spinlock lock; + + /** Internally used flags for holding the state of the a2i layer. */ + atomic_t flags; +}; + +/** Interrupt driven FIFO fill function. */ +int z_uart_async_to_irq_fifo_fill(const struct device *dev, + const uint8_t *buf, + int len); + +/** Interrupt driven FIFO read function. */ +int z_uart_async_to_irq_fifo_read(const struct device *dev, + uint8_t *buf, + const int len); + +/** Interrupt driven transfer enabling function. */ +void z_uart_async_to_irq_irq_tx_enable(const struct device *dev); + +/** Interrupt driven transfer disabling function */ +void z_uart_async_to_irq_irq_tx_disable(const struct device *dev); + +/** Interrupt driven transfer ready function */ +int z_uart_async_to_irq_irq_tx_ready(const struct device *dev); + +/** Interrupt driven receiver enabling function */ +void z_uart_async_to_irq_irq_rx_enable(const struct device *dev); + +/** Interrupt driven receiver disabling function */ +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); + +/** Interrupt driven receiver ready function */ +int z_uart_async_to_irq_irq_rx_ready(const struct device *dev); + +/** Interrupt driven error enabling function */ +void z_uart_async_to_irq_irq_err_enable(const struct device *dev); + +/** Interrupt driven error disabling function */ +void z_uart_async_to_irq_irq_err_disable(const struct device *dev); + +/** Interrupt driven pending status function */ +int z_uart_async_to_irq_irq_is_pending(const struct device *dev); + +/** Interrupt driven interrupt update function */ +int z_uart_async_to_irq_irq_update(const struct device *dev); + +/** Set the irq callback function */ +void z_uart_async_to_irq_irq_callback_set(const struct device *dev, + uart_irq_callback_user_data_t cb, + void *user_data); + +/** @endcond */ + +#ifdef __cplusplus +} +#endif + +/** @} */ + +#endif /* ZEPHYR_DRIVERS_SERIAL_UART_ASYNC_TO_IRQ_H_ */ From 5cacd04c6195cd46daf81b9c9aedea267f3945dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 13 Nov 2023 11:14:37 +0100 Subject: [PATCH 0229/2300] [nrf fromtree] soc: arm: nordic_nrf: Disable UART runtime configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since it takes 400 bytes of code and it is rarely used disable by default this feature. Signed-off-by: Krzysztof Chruściński (cherry picked from commit a0382bd0f39e94461820fc31a7394d2be35cabf6) Signed-off-by: Robert Lubos (cherry picked from commit 8cf98c2026f65fea785dfef84ab2b831de5d55db) --- doc/releases/migration-guide-3.6.rst | 4 ++++ soc/arm/nordic_nrf/Kconfig.defconfig | 3 +++ 2 files changed, 7 insertions(+) diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index eeac0a89b75..c4cb37eaf94 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -55,6 +55,10 @@ Device Drivers and Device Tree (:github:`62994`) +* Runtime configuration is now disabled by default for Nordic UART drivers. The motivation for the + change is that this feature is rarely used and disabling it significantly reduces the memory + footprint. + Power Management ================ diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index 3eedcf350c6..858c60d1d88 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -40,4 +40,7 @@ config GPIO default y depends on SPI +config UART_USE_RUNTIME_CONFIGURE + default n + endif # SOC_FAMILY_NRF From 941a2567971d04944957bd2928ab7a118b18eb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 17 Jan 2024 11:53:35 +0100 Subject: [PATCH 0230/2300] [nrf fromtree] modules: hal_nordic: nrfx: Add new UARTE options to Kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Kconfig options to new configuration flags for nrfx_uarte. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 4fcf8e0630b64c3f40c5c6acb5feb6ad1cab714f) Signed-off-by: Robert Lubos (cherry picked from commit 2ecabec97c571bd5a739dd2193d8918df62f0228) --- modules/hal_nordic/nrfx/Kconfig | 21 +++++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 12 ++++++++++++ 2 files changed, 33 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index a92aa93d9a2..b4c00040ee1 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -573,6 +573,27 @@ config NRFX_UARTE3 depends on $(dt_nodelabel_has_compat,uart3,$(DT_COMPAT_NORDIC_NRF_UARTE)) select NRFX_UARTE +config NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG + bool "UARTE GPIO configuration support" + depends on NRFX_UARTE + +config NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG + bool "UARTE PSEL configuration support" + depends on NRFX_UARTE + +config NRFX_UARTE_CONFIG_TX_LINK + bool "UARTE TX transfer linking support" + depends on NRFX_UARTE + +config NRFX_UARTE_CONFIG_RX_CACHE_ENABLED + bool "UARTE RX caching support" + default y if $(dt_nodelabel_has_compat,ram3x,$(DT_COMPAT_MMIO_SRAM)) + depends on NRFX_UARTE + help + Feature might be enabled on platforms which has limitations regarding addresses + to which receiver can write data. If enabled then internal driver buffers + (cache buffers) are used for DMA transfers and data is copied to the user buffer. + config NRFX_USBREG bool "USBREG driver" depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_USBREG)) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 57417644c32..ac930b13639 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -563,6 +563,18 @@ #ifdef CONFIG_NRFX_UARTE3 #define NRFX_UARTE3_ENABLED 1 #endif +#ifdef CONFIG_NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 1 +#endif +#ifdef CONFIG_NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG 1 +#endif +#ifdef CONFIG_NRFX_UARTE_CONFIG_TX_LINK +#define NRFX_UARTE_CONFIG_TX_LINK 1 +#endif +#ifdef CONFIG_NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 1 +#endif #ifdef CONFIG_NRFX_USBREG #define NRFX_USBREG_ENABLED 1 From 001323e059c1ace212cc6ae42dd627b381759e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 17 Jan 2024 11:54:10 +0100 Subject: [PATCH 0231/2300] [nrf fromtree] drivers: serial: nrfx: Add new shim based on nrfx_uarte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new shim which is based on nrfx driver. Legacy shim is kept for transition period. It can be used after setting CONFIG_UART_NRFX_UARTE_LEGACY_SHIM. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 4cc213bc8d17220a2569ff8bb7548d6ed03f7d2f) Signed-off-by: Robert Lubos (cherry picked from commit f3b1f268ec4b356353154acc695f79fc2e6bb3c8) --- drivers/serial/CMakeLists.txt | 8 +- drivers/serial/Kconfig.nrfx | 11 +- drivers/serial/Kconfig.nrfx_uart_instance | 45 +- drivers/serial/uart_nrfx_uarte2.c | 1030 +++++++++++++++++++++ 4 files changed, 1091 insertions(+), 3 deletions(-) create mode 100644 drivers/serial/uart_nrfx_uarte2.c diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt index 2cd79e12f64..67e02e0c261 100644 --- a/drivers/serial/CMakeLists.txt +++ b/drivers/serial/CMakeLists.txt @@ -26,7 +26,13 @@ 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_NRFX_UART uart_nrfx_uart.c) -zephyr_library_sources_ifdef(CONFIG_UART_NRFX_UARTE uart_nrfx_uarte.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_NUMICRO uart_numicro.c) zephyr_library_sources_ifdef(CONFIG_UART_SAM uart_sam.c) zephyr_library_sources_ifdef(CONFIG_USART_SAM usart_sam.c) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 53553e3d06e..5709ca2d23a 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -25,11 +25,20 @@ config UART_NRFX_UART config UART_NRFX_UARTE def_bool y depends on DT_HAS_NORDIC_NRF_UARTE_ENABLED + imply NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM + imply NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM + +config UART_NRFX_UARTE_LEGACY_SHIM + bool "Legacy UARTE shim" + depends on UART_NRFX_UARTE + # New shim takes more ROM. Until it is fixed use legacy shim in memory + # constraint case. + default y if MCUBOOT config UART_ASYNC_TX_CACHE_SIZE int "TX cache buffer size" depends on UART_ASYNC_API - depends on UART_NRFX_UARTE + depends on UART_NRFX_UARTE_LEGACY_SHIM default 8 help For UARTE, TX cache buffer is used when provided TX buffer is not located diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index 39e774e2544..76f74caa038 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -6,6 +6,7 @@ config UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN bool "Interrupt support on port $(nrfx_uart_num)" depends on UART_INTERRUPT_DRIVEN + select UART_ASYNC_TO_INT_DRIVEN_API if !UART_NRFX_UARTE_LEGACY_SHIM default y help This option enables UART interrupt support on port $(nrfx_uart_num). @@ -27,6 +28,9 @@ config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT When enabled, polling out does not trigger interrupt which stops TX. Feature uses a PPI channel. +config NRFX_UARTE$(nrfx_uart_num) + def_bool y if HAS_HW_NRF_UARTE$(nrfx_uart_num) && !UART_NRFX_UARTE_LEGACY_SHIM + config UART_$(nrfx_uart_num)_NRF_PARITY_BIT bool "Parity bit" help @@ -34,7 +38,8 @@ config UART_$(nrfx_uart_num)_NRF_PARITY_BIT config UART_$(nrfx_uart_num)_NRF_TX_BUFFER_SIZE int "Size of RAM buffer" - depends on UART_INTERRUPT_DRIVEN + depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) + depends on UART_NRFX_UARTE_LEGACY_SHIM range 1 65535 default 32 help @@ -46,6 +51,7 @@ config UART_$(nrfx_uart_num)_NRF_HW_ASYNC bool "Use hardware RX byte counting" depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) depends on UART_ASYNC_API + depends on UART_NRFX_UARTE_LEGACY_SHIM select NRFX_PPI if HAS_HW_NRF_PPI select NRFX_DPPI if HAS_HW_NRF_DPPIC help @@ -58,6 +64,7 @@ config UART_$(nrfx_uart_num)_NRF_ASYNC_LOW_POWER bool "Low power mode" depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) depends on UART_ASYNC_API + depends on UART_NRFX_UARTE_LEGACY_SHIM 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 @@ -67,6 +74,42 @@ config UART_$(nrfx_uart_num)_NRF_HW_ASYNC_TIMER int "Timer instance" depends on UART_$(nrfx_uart_num)_NRF_HW_ASYNC +config UART_$(nrfx_uart_num)_TX_CACHE_SIZE + int "TX cache buffer size" + depends on !UART_NRFX_UARTE_LEGACY_SHIM + default 8 + help + For UARTE, TX cache buffer is used when provided TX buffer is not located + in memory which can be used by the EasyDMA. + +config UART_$(nrfx_uart_num)_RX_CACHE_SIZE + int "RX cache buffer size" + depends on !UART_NRFX_UARTE_LEGACY_SHIM + default 32 if $(dt_nodelabel_has_compat,ram3x,$(DT_COMPAT_MMIO_SRAM)) + default 5 + range 5 255 + help + For UARTE, RX cache buffer is used when provided RX buffer is not located + in memory which can be used by the EasyDMA. It is also used to store + flushed data. + +config UART_$(nrfx_uart_num)_A2I_RX_SIZE + depends on !UART_NRFX_UARTE_LEGACY_SHIM + int "Asynchronous to interrupt driven adaptation layer RX buffer size" + default 64 if UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN + default 0 + help + Amount of space dedicated for RX. It is divided into chunks with some + amount of that space used for control data. + +config UART_$(nrfx_uart_num)_A2I_RX_BUF_COUNT + depends on !UART_NRFX_UARTE_LEGACY_SHIM + int "Asynchronous to interrupt driven adaptation layer RX buffer count" + default 8 if UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN + default 0 + help + Number of chunks into RX space is divided. + config UART_$(nrfx_uart_num)_GPIO_MANAGEMENT bool "GPIO management on port $(nrfx_uart_num)" depends on PM_DEVICE diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c new file mode 100644 index 00000000000..c27f33c7284 --- /dev/null +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -0,0 +1,1030 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @brief Driver for Nordic Semiconductor nRF UARTE + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define LOG_MODULE_NAME uarte +LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_UART_LOG_LEVEL); + +#define INSTANCE_INT_DRIVEN(periph, prefix, i, _) \ + IS_ENABLED(CONFIG_UART_##prefix##i##_INTERRUPT_DRIVEN) + +#define INSTANCE_ASYNC(periph, prefix, i, _) \ + IS_ENABLED(CONFIG_UART_##prefix##i##_ASYNC) + +#define INSTANCE_POLLING(periph, prefix, id, _) \ + UTIL_AND(CONFIG_HAS_HW_NRF_UARTE##prefix##id, \ + UTIL_AND(COND_CODE_1(CONFIG_UART_##prefix##id##_INTERRUPT_DRIVEN, (0), (1)), \ + COND_CODE_1(CONFIG_UART_##prefix##id##_ASYNC, (0), (1)))) + +#define INSTANCE_ENHANCED_POLL_OUT(periph, prefix, i, _) \ + IS_ENABLED(CONFIG_UART_##prefix##i##_ENHANCED_POLL_OUT) + +/* Macro determining if any instance is using interrupt driven API. */ +#if (NRFX_FOREACH_ENABLED(UARTE, INSTANCE_INT_DRIVEN, (+), (0), _)) +#define UARTE_ANY_INTERRUPT_DRIVEN 1 +#else +#define UARTE_ANY_INTERRUPT_DRIVEN 0 +#endif + +/* Macro determining if any instance is enabled and using ASYNC API. */ +#if (NRFX_FOREACH_ENABLED(UARTE, INSTANCE_ASYNC, (+), (0), _)) +#define UARTE_ANY_ASYNC 1 +#else +#define UARTE_ANY_ASYNC 0 +#endif + +/* Macro determining if any instance is using only polling API. */ +#if (NRFX_FOREACH_ENABLED(UARTE, INSTANCE_POLLING, (+), (0), _)) +#define UARTE_ANY_POLLING 1 +#else +#define UARTE_ANY_POLLING 0 +#endif + +/* Macro determining if any instance is using interrupt driven API. */ +#if (NRFX_FOREACH_ENABLED(UARTE, INSTANCE_ENHANCED_POLL_OUT, (+), (0), _)) +#define UARTE_ENHANCED_POLL_OUT 1 +#else +#define UARTE_ENHANCED_POLL_OUT 0 +#endif + +#if UARTE_ANY_INTERRUPT_DRIVEN || UARTE_ANY_ASYNC +#define UARTE_INT_ASYNC 1 +#else +#define UARTE_INT_ASYNC 0 +#endif + +#if defined(UARTE_CONFIG_PARITYTYPE_Msk) +#define UARTE_ODD_PARITY_ALLOWED 1 +#else +#define UARTE_ODD_PARITY_ALLOWED 0 +#endif + +/* + * RX timeout is divided into time slabs, this define tells how many divisions + * should be made. More divisions - higher timeout accuracy and processor usage. + */ +#define RX_TIMEOUT_DIV 5 + +/* Macro for converting numerical baudrate to register value. It is convenient + * to use this approach because for constant input it can calculate nrf setting + * at compile time. + */ +#define NRF_BAUDRATE(baudrate) ((baudrate) == 300 ? 0x00014000 :\ + (baudrate) == 600 ? 0x00027000 : \ + (baudrate) == 1200 ? NRF_UARTE_BAUDRATE_1200 : \ + (baudrate) == 2400 ? NRF_UARTE_BAUDRATE_2400 : \ + (baudrate) == 4800 ? NRF_UARTE_BAUDRATE_4800 : \ + (baudrate) == 9600 ? NRF_UARTE_BAUDRATE_9600 : \ + (baudrate) == 14400 ? NRF_UARTE_BAUDRATE_14400 : \ + (baudrate) == 19200 ? NRF_UARTE_BAUDRATE_19200 : \ + (baudrate) == 28800 ? NRF_UARTE_BAUDRATE_28800 : \ + (baudrate) == 31250 ? NRF_UARTE_BAUDRATE_31250 : \ + (baudrate) == 38400 ? NRF_UARTE_BAUDRATE_38400 : \ + (baudrate) == 56000 ? NRF_UARTE_BAUDRATE_56000 : \ + (baudrate) == 57600 ? NRF_UARTE_BAUDRATE_57600 : \ + (baudrate) == 76800 ? NRF_UARTE_BAUDRATE_76800 : \ + (baudrate) == 115200 ? NRF_UARTE_BAUDRATE_115200 : \ + (baudrate) == 230400 ? NRF_UARTE_BAUDRATE_230400 : \ + (baudrate) == 250000 ? NRF_UARTE_BAUDRATE_250000 : \ + (baudrate) == 460800 ? NRF_UARTE_BAUDRATE_460800 : \ + (baudrate) == 921600 ? NRF_UARTE_BAUDRATE_921600 : \ + (baudrate) == 1000000 ? NRF_UARTE_BAUDRATE_1000000 : 0) + +#define UARTE_DATA_FLAG_TRAMPOLINE BIT(0) +#define UARTE_DATA_FLAG_RX_ENABLED BIT(1) + +struct uarte_async_data { + uart_callback_t user_callback; + void *user_data; + + struct k_timer tx_timer; + struct k_timer rx_timer; + + k_timeout_t rx_timeout; + + /* Keeps the most recent error mask. */ + uint32_t err; + + uint8_t idle_cnt; +}; + +/* Device data structure */ +struct uarte_nrfx_data { + struct uart_async_to_irq_data *a2i_data; +#if CONFIG_UART_USE_RUNTIME_CONFIGURE + struct uart_config uart_config; +#endif + struct uarte_async_data *async; + atomic_t flags; + uint8_t rx_byte; +}; +BUILD_ASSERT(offsetof(struct uarte_nrfx_data, a2i_data) == 0); + +/* If set then pins are managed when going to low power mode. */ +#define UARTE_CFG_FLAG_GPIO_MGMT BIT(0) + +/* If set then receiver is not used. */ +#define UARTE_CFG_FLAG_NO_RX BIT(1) + +/* If set then instance is using interrupt driven API. */ +#define UARTE_CFG_FLAG_INTERRUPT_DRIVEN_API BIT(2) + +/** + * @brief Structure for UARTE configuration. + */ +struct uarte_nrfx_config { + const struct uart_async_to_irq_config *a2i_config; + nrfx_uarte_t nrfx_dev; + nrfx_uarte_config_t nrfx_config; + const struct pinctrl_dev_config *pcfg; + uint32_t flags; + + LOG_INSTANCE_PTR_DECLARE(log); +}; +BUILD_ASSERT(offsetof(struct uarte_nrfx_config, a2i_config) == 0); + +#define UARTE_ERROR_FROM_MASK(mask) \ + ((mask) & NRF_UARTE_ERROR_OVERRUN_MASK ? UART_ERROR_OVERRUN \ + : (mask) & NRF_UARTE_ERROR_PARITY_MASK ? UART_ERROR_PARITY \ + : (mask) & NRF_UARTE_ERROR_FRAMING_MASK ? UART_ERROR_FRAMING \ + : (mask) & NRF_UARTE_ERROR_BREAK_MASK ? UART_BREAK \ + : 0) + +/* Determine if the device has interrupt driven API enabled. */ +#define IS_INT_DRIVEN_API(dev) \ + (UARTE_ANY_INTERRUPT_DRIVEN && \ + (((const struct uarte_nrfx_config *)dev->config)->flags & \ + UARTE_CFG_FLAG_INTERRUPT_DRIVEN_API)) + +/* Determine if the device supports only polling API. */ +#define IS_POLLING_API(dev) \ + (!UARTE_INT_ASYNC || (((struct uarte_nrfx_data *)dev->data)->async == NULL)) + +/* Determine if the device supports asynchronous API. */ +#define IS_ASYNC_API(dev) (!IS_INT_DRIVEN_API(dev) && !IS_POLLING_API(dev)) + +static inline const nrfx_uarte_t *get_nrfx_dev(const struct device *dev) +{ + const struct uarte_nrfx_config *config = dev->config; + + return &config->nrfx_dev; +} + +static int callback_set(const struct device *dev, uart_callback_t callback, void *user_data) +{ + struct uarte_nrfx_data *data = dev->data; + + data->async->user_callback = callback; + data->async->user_data = user_data; + + return 0; +} + +#if UARTE_ANY_ASYNC +static int api_callback_set(const struct device *dev, uart_callback_t callback, void *user_data) +{ + if (!IS_ASYNC_API(dev)) { + return -ENOTSUP; + } + + return callback_set(dev, callback, user_data); +} +#endif + +static void on_tx_done(const struct device *dev, const nrfx_uarte_event_t *event) +{ + struct uarte_nrfx_data *data = dev->data; + struct uart_event evt = { + .type = (event->data.tx.flags & NRFX_UARTE_TX_DONE_ABORTED) ? + UART_TX_ABORTED : UART_TX_DONE, + .data.tx.buf = event->data.tx.p_buffer, + .data.tx.len = event->data.tx.length + }; + bool hwfc; + +#if CONFIG_UART_USE_RUNTIME_CONFIGURE + hwfc = data->uart_config.flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS; +#else + const struct uarte_nrfx_config *config = dev->config; + + hwfc = config->nrfx_config.config.hwfc == NRF_UARTE_HWFC_ENABLED; +#endif + + if (hwfc) { + k_timer_stop(&data->async->tx_timer); + } + data->async->user_callback(dev, &evt, data->async->user_data); +} + +static void on_rx_done(const struct device *dev, const nrfx_uarte_event_t *event) +{ + struct uarte_nrfx_data *data = dev->data; + struct uart_event evt; + + if (event->data.rx.length) { + if (data->async->err) { + evt.type = UART_RX_STOPPED; + evt.data.rx_stop.reason = UARTE_ERROR_FROM_MASK(data->async->err); + evt.data.rx_stop.data.buf = event->data.rx.p_buffer; + evt.data.rx_stop.data.len = event->data.rx.length; + /* Keep error code for uart_err_check(). */ + if (!IS_INT_DRIVEN_API(dev)) { + data->async->err = 0; + } + } else { + evt.type = UART_RX_RDY, + evt.data.rx.buf = event->data.rx.p_buffer, + evt.data.rx.len = event->data.rx.length, + evt.data.rx.offset = 0; + } + data->async->user_callback(dev, &evt, data->async->user_data); + } + + evt.type = UART_RX_BUF_RELEASED; + evt.data.rx_buf.buf = event->data.rx.p_buffer; + + data->async->user_callback(dev, &evt, data->async->user_data); +} + +static void start_rx_timer(struct uarte_nrfx_data *data) +{ + struct uarte_async_data *adata = data->async; + + k_timer_start(&adata->rx_timer, adata->rx_timeout, K_NO_WAIT); +} + +static void on_rx_byte(const struct device *dev) +{ + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_data *adata = data->async; + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + + nrfx_uarte_rxdrdy_disable(nrfx_dev); + adata->idle_cnt = RX_TIMEOUT_DIV; + start_rx_timer(data); +} + +static void on_rx_buf_req(const struct device *dev) +{ + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_data *adata = data->async; + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + + struct uart_event evt = { + .type = UART_RX_BUF_REQUEST + }; + + /* If counter reached zero that indicates that timeout was reached and + * reception of one buffer was terminated to restart another transfer. + */ + if (!K_TIMEOUT_EQ(adata->rx_timeout, K_NO_WAIT)) { + /* Read and clear any pending new data information. */ + nrfx_uarte_rx_new_data_check(nrfx_dev); + nrfx_uarte_rxdrdy_enable(nrfx_dev); + } + data->async->user_callback(dev, &evt, data->async->user_data); +} + +static void on_rx_disabled(const struct device *dev, struct uarte_nrfx_data *data) +{ + struct uart_event evt = { + .type = UART_RX_DISABLED + }; + + atomic_and(&data->flags, ~UARTE_DATA_FLAG_RX_ENABLED); + k_timer_stop(&data->async->rx_timer); + + data->async->user_callback(dev, &evt, data->async->user_data); +} + +static void trigger_handler(const struct device *dev) +{ + struct uarte_nrfx_data *data = dev->data; + + if (UARTE_ANY_INTERRUPT_DRIVEN && + atomic_and(&data->flags, ~UARTE_DATA_FLAG_TRAMPOLINE) & + UARTE_DATA_FLAG_TRAMPOLINE) { + uart_async_to_irq_trampoline_cb(dev); + } +} + +static void evt_handler(nrfx_uarte_event_t const *event, void *context) +{ + const struct device *dev = context; + struct uarte_nrfx_data *data = dev->data; + + switch (event->type) { + case NRFX_UARTE_EVT_TX_DONE: + on_tx_done(dev, event); + break; + case NRFX_UARTE_EVT_RX_DONE: + on_rx_done(dev, event); + break; + case NRFX_UARTE_EVT_RX_BYTE: + on_rx_byte(dev); + break; + case NRFX_UARTE_EVT_ERROR: + data->async->err = event->data.error.error_mask; + break; + case NRFX_UARTE_EVT_RX_BUF_REQUEST: + on_rx_buf_req(dev); + break; + case NRFX_UARTE_EVT_RX_DISABLED: + on_rx_disabled(dev, data); + break; + case NRFX_UARTE_EVT_RX_BUF_TOO_LATE: + /* No support */ + break; + case NRFX_UARTE_EVT_TRIGGER: + trigger_handler(dev); + break; + default: + __ASSERT_NO_MSG(0); + } +} + +static int api_tx(const struct device *dev, const uint8_t *buf, size_t len, int32_t timeout) +{ + struct uarte_nrfx_data *data = dev->data; + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + nrfx_err_t err; + bool hwfc; + +#if CONFIG_UART_USE_RUNTIME_CONFIGURE + hwfc = data->uart_config.flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS; +#else + const struct uarte_nrfx_config *config = dev->config; + + hwfc = config->nrfx_config.config.hwfc == NRF_UARTE_HWFC_ENABLED; +#endif + + err = nrfx_uarte_tx(nrfx_dev, buf, len, 0); + if (err != NRFX_SUCCESS) { + return (err == NRFX_ERROR_BUSY) ? -EBUSY : -EIO; + } + + if (hwfc && timeout != SYS_FOREVER_US) { + k_timer_start(&data->async->tx_timer, K_USEC(timeout), K_NO_WAIT); + } + + return 0; +} + +static int api_tx_abort(const struct device *dev) +{ + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + nrfx_err_t err; + + err = nrfx_uarte_tx_abort(nrfx_dev, false); + return (err == NRFX_SUCCESS) ? 0 : -EFAULT; +} + +static void tx_timeout_handler(struct k_timer *timer) +{ + const struct device *dev = k_timer_user_data_get(timer); + + (void)api_tx_abort(dev); +} + +static void rx_timeout_handler(struct k_timer *timer) +{ + const struct device *dev = (const struct device *)k_timer_user_data_get(timer); + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_data *adata = data->async; + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + + if (nrfx_uarte_rx_new_data_check(nrfx_dev)) { + adata->idle_cnt = RX_TIMEOUT_DIV - 1; + } else { + adata->idle_cnt--; + if (adata->idle_cnt == 0) { + (void)nrfx_uarte_rx_abort(nrfx_dev, false, false); + return; + } + } + + start_rx_timer(data); +} + +/* Determine if RX FIFO content shall be kept when device is being disabled. + * When flow-control is used then we expect to keep RX FIFO content since HWFC + * enforces lossless communication. However, when HWFC is not used (by any instance + * then RX FIFO handling feature is disabled in the nrfx_uarte to save space. + * It is based on assumption that without HWFC it is expected that some data may + * be lost and there are means to prevent that (keeping receiver always opened by + * provided reception buffers on time). + */ +static inline uint32_t get_keep_fifo_content_flag(const struct device *dev) +{ +#if CONFIG_UART_USE_RUNTIME_CONFIGURE + struct uarte_nrfx_data *data = dev->data; + + if (data->uart_config.flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS) { + return NRFX_UARTE_RX_ENABLE_KEEP_FIFO_CONTENT; + } +#else + const struct uarte_nrfx_config *config = dev->config; + + if (config->nrfx_config.config.hwfc == NRF_UARTE_HWFC_ENABLED) { + return NRFX_UARTE_RX_ENABLE_KEEP_FIFO_CONTENT; + } +#endif + + return 0; +} + +static int api_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int32_t timeout) +{ + nrfx_err_t err; + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + struct uarte_async_data *adata = data->async; + uint32_t flags = NRFX_UARTE_RX_ENABLE_CONT | + get_keep_fifo_content_flag(dev) | + (IS_ASYNC_API(dev) ? NRFX_UARTE_RX_ENABLE_STOP_ON_END : 0); + + if (cfg->flags & UARTE_CFG_FLAG_NO_RX) { + return -ENOTSUP; + } + + if (timeout != SYS_FOREVER_US) { + adata->idle_cnt = RX_TIMEOUT_DIV + 1; + adata->rx_timeout = K_USEC(timeout / RX_TIMEOUT_DIV); + } else { + adata->rx_timeout = K_NO_WAIT; + } + + err = nrfx_uarte_rx_buffer_set(nrfx_dev, buf, len); + if (err != NRFX_SUCCESS) { + return -EIO; + } + + err = nrfx_uarte_rx_enable(nrfx_dev, flags); + if (err != NRFX_SUCCESS) { + return (err == NRFX_ERROR_BUSY) ? -EBUSY : -EIO; + } + + atomic_or(&data->flags, UARTE_DATA_FLAG_RX_ENABLED); + + return 0; +} + +static int api_rx_buf_rsp(const struct device *dev, uint8_t *buf, size_t len) +{ + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + struct uarte_nrfx_data *data = dev->data; + nrfx_err_t err; + + if (!(data->flags & UARTE_DATA_FLAG_RX_ENABLED)) { + return -EACCES; + } + + err = nrfx_uarte_rx_buffer_set(nrfx_dev, buf, len); + switch (err) { + case NRFX_SUCCESS: + return 0; + case NRFX_ERROR_BUSY: + return -EBUSY; + default: + return -EIO; + } +} + +static int api_rx_disable(const struct device *dev) +{ + struct uarte_nrfx_data *data = dev->data; + + k_timer_stop(&data->async->rx_timer); + + return (nrfx_uarte_rx_abort(get_nrfx_dev(dev), true, false) == NRFX_SUCCESS) ? 0 : -EFAULT; +} + +static int api_poll_in(const struct device *dev, unsigned char *c) +{ + const struct uarte_nrfx_config *cfg = dev->config; + const nrfx_uarte_t *instance = &cfg->nrfx_dev; + nrfx_err_t err; + + if (IS_INT_DRIVEN_API(dev)) { + return uart_fifo_read(dev, c, 1) == 0 ? -1 : 0; + } + + if (IS_ASYNC_API(dev)) { + return -EBUSY; + } + + err = nrfx_uarte_rx_ready(instance, NULL); + if (err == NRFX_SUCCESS) { + uint8_t *rx_byte = cfg->nrfx_config.rx_cache.p_buffer; + + *c = *rx_byte; + err = nrfx_uarte_rx_buffer_set(instance, rx_byte, 1); + __ASSERT_NO_MSG(err == NRFX_SUCCESS); + + return 0; + } + + return -1; +} + +static void api_poll_out(const struct device *dev, unsigned char out_char) +{ + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + nrfx_err_t err; + + do { + /* When runtime PM is used we cannot use early return because then + * we have no information when UART is actually done with the + * transmission. It reduces UART performance however, polling in + * general is not power efficient and should be avoided in low + * power applications. + */ + err = nrfx_uarte_tx(nrfx_dev, &out_char, 1, NRFX_UARTE_TX_EARLY_RETURN); + __ASSERT(err != NRFX_ERROR_INVALID_ADDR, "Invalid address of the buffer"); + + if (err == NRFX_ERROR_BUSY && + IS_ENABLED(CONFIG_MULTITHREADING) && k_is_preempt_thread()) { + k_msleep(1); + } + Z_SPIN_DELAY(3); + } while (err == NRFX_ERROR_BUSY); +} + +#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE +/** + * @brief Set the baud rate + * + * This routine set the given baud rate for the UARTE. + * + * @param dev UARTE device struct + * @param baudrate Baud rate + * + * @return 0 on success or error code + */ +static int baudrate_set(NRF_UARTE_Type *uarte, uint32_t baudrate) +{ + nrf_uarte_baudrate_t nrf_baudrate = NRF_BAUDRATE(baudrate); + + if (baudrate == 0) { + return -EINVAL; + } + + nrfy_uarte_baudrate_set(uarte, nrf_baudrate); + + return 0; +} + +static int uarte_nrfx_configure(const struct device *dev, + const struct uart_config *cfg) +{ + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + struct uarte_nrfx_data *data = dev->data; + nrf_uarte_config_t uarte_cfg; + +#if defined(UARTE_CONFIG_STOP_Msk) + switch (cfg->stop_bits) { + case UART_CFG_STOP_BITS_1: + uarte_cfg.stop = NRF_UARTE_STOP_ONE; + break; + case UART_CFG_STOP_BITS_2: + uarte_cfg.stop = NRF_UARTE_STOP_TWO; + break; + default: + return -ENOTSUP; + } +#else + if (cfg->stop_bits != UART_CFG_STOP_BITS_1) { + return -ENOTSUP; + } +#endif + + if (cfg->data_bits != UART_CFG_DATA_BITS_8) { + return -ENOTSUP; + } + + switch (cfg->flow_ctrl) { + case UART_CFG_FLOW_CTRL_NONE: + uarte_cfg.hwfc = NRF_UARTE_HWFC_DISABLED; + break; + case UART_CFG_FLOW_CTRL_RTS_CTS: + uarte_cfg.hwfc = NRF_UARTE_HWFC_ENABLED; + break; + default: + return -ENOTSUP; + } + +#if defined(UARTE_CONFIG_PARITYTYPE_Msk) + uarte_cfg.paritytype = NRF_UARTE_PARITYTYPE_EVEN; +#endif + switch (cfg->parity) { + case UART_CFG_PARITY_NONE: + uarte_cfg.parity = NRF_UARTE_PARITY_EXCLUDED; + break; + case UART_CFG_PARITY_EVEN: + uarte_cfg.parity = NRF_UARTE_PARITY_INCLUDED; + break; +#if defined(UARTE_CONFIG_PARITYTYPE_Msk) + case UART_CFG_PARITY_ODD: + uarte_cfg.parity = NRF_UARTE_PARITY_INCLUDED; + uarte_cfg.paritytype = NRF_UARTE_PARITYTYPE_ODD; + break; +#endif + default: + return -ENOTSUP; + } + + if (baudrate_set(nrfx_dev->p_reg, cfg->baudrate) != 0) { + return -ENOTSUP; + } + + nrfy_uarte_configure(nrfx_dev->p_reg, &uarte_cfg); + + data->uart_config = *cfg; + + return 0; +} + +static int uarte_nrfx_config_get(const struct device *dev, + struct uart_config *cfg) +{ + struct uarte_nrfx_data *data = dev->data; + + *cfg = data->uart_config; + return 0; +} +#endif /* CONFIG_UART_USE_RUNTIME_CONFIGURE */ + +#if UARTE_ANY_POLLING || UARTE_ANY_INTERRUPT_DRIVEN +static int api_err_check(const struct device *dev) +{ + if (IS_POLLING_API(dev)) { + const struct uarte_nrfx_config *cfg = dev->config; + const nrfx_uarte_t *instance = &cfg->nrfx_dev; + uint32_t mask = nrfx_uarte_errorsrc_get(instance); + + return mask; + } + + struct uarte_nrfx_data *data = dev->data; + uint32_t rv = data->async->err; + + data->async->err = 0; + + return rv; +} +#endif + +static const struct uart_async_to_irq_async_api a2i_api = { + .callback_set = callback_set, + .tx = api_tx, + .tx_abort = api_tx_abort, + .rx_enable = api_rx_enable, + .rx_buf_rsp = api_rx_buf_rsp, + .rx_disable = api_rx_disable, +}; + +static const struct uart_driver_api uart_nrfx_uarte_driver_api = { + .poll_in = api_poll_in, + .poll_out = api_poll_out, +#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE + .configure = uarte_nrfx_configure, + .config_get = uarte_nrfx_config_get, +#endif /* CONFIG_UART_USE_RUNTIME_CONFIGURE */ +#if UARTE_ANY_POLLING || UARTE_ANY_INTERRUPT_DRIVEN + .err_check = api_err_check, +#endif +#if UARTE_ANY_ASYNC + .callback_set = api_callback_set, + .tx = api_tx, + .tx_abort = api_tx_abort, + .rx_enable = api_rx_enable, + .rx_buf_rsp = api_rx_buf_rsp, + .rx_disable = api_rx_disable, +#endif /* UARTE_ANY_ASYNC */ +#if UARTE_ANY_INTERRUPT_DRIVEN + UART_ASYNC_TO_IRQ_API_INIT(), +#endif /* UARTE_ANY_INTERRUPT_DRIVEN */ +}; + +static int endtx_stoptx_ppi_init(NRF_UARTE_Type *uarte) +{ + nrfx_err_t ret; + uint8_t ch; + + ret = nrfx_gppi_channel_alloc(&ch); + if (ret != NRFX_SUCCESS) { + LOG_ERR("Failed to allocate PPI Channel"); + return -EIO; + } + + nrfx_gppi_channel_endpoints_setup(ch, + nrfy_uarte_event_address_get(uarte, NRF_UARTE_EVENT_ENDTX), + nrfy_uarte_task_address_get(uarte, NRF_UARTE_TASK_STOPTX)); + nrfx_gppi_channels_enable(BIT(ch)); + + return 0; +} + +static int start_rx(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + + if (IS_INT_DRIVEN_API(dev)) { + return uart_async_to_irq_rx_enable(dev); + } + + __ASSERT_NO_MSG(IS_POLLING_API(dev)); + + nrfx_err_t err; + const nrfx_uarte_t *instance = &cfg->nrfx_dev; + uint8_t *rx_byte = cfg->nrfx_config.rx_cache.p_buffer; + + err = nrfx_uarte_rx_buffer_set(instance, rx_byte, 1); + __ASSERT_NO_MSG(err == NRFX_SUCCESS); + + err = nrfx_uarte_rx_enable(instance, 0); + __ASSERT_NO_MSG(err == NRFX_SUCCESS || err == NRFX_ERROR_BUSY); + + (void)err; + + return 0; +} + +static void async_to_irq_trampoline(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + uint32_t prev = atomic_or(&data->flags, UARTE_DATA_FLAG_TRAMPOLINE); + + if (!(prev & UARTE_DATA_FLAG_TRAMPOLINE)) { + nrfx_uarte_int_trigger(&cfg->nrfx_dev); + } +} + +static int uarte_nrfx_init(const struct device *dev) +{ + int err; + nrfx_err_t nerr; + const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + + err = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); + if (err < 0) { + return err; + } + + if (UARTE_ENHANCED_POLL_OUT && cfg->nrfx_config.tx_stop_on_end) { + err = endtx_stoptx_ppi_init(nrfx_dev->p_reg); + if (err < 0) { + return err; + } + } + + if (UARTE_ANY_INTERRUPT_DRIVEN) { + if (cfg->a2i_config) { + err = uart_async_to_irq_init(data->a2i_data, cfg->a2i_config); + if (err < 0) { + return err; + } + } + } + + if (IS_ENABLED(UARTE_INT_ASYNC) && data->async) { + k_timer_init(&data->async->rx_timer, rx_timeout_handler, NULL); + k_timer_user_data_set(&data->async->rx_timer, (void *)dev); + k_timer_init(&data->async->tx_timer, tx_timeout_handler, NULL); + k_timer_user_data_set(&data->async->tx_timer, (void *)dev); + } + + nerr = nrfx_uarte_init(nrfx_dev, &cfg->nrfx_config, + IS_ENABLED(UARTE_INT_ASYNC) ? + (IS_POLLING_API(dev) ? NULL : evt_handler) : NULL); + if (nerr == NRFX_SUCCESS && !IS_ASYNC_API(dev) && !(cfg->flags & UARTE_CFG_FLAG_NO_RX)) { + err = start_rx(dev); + } + + switch (nerr) { + case NRFX_ERROR_INVALID_STATE: + return -EBUSY; + case NRFX_ERROR_BUSY: + return -EACCES; + case NRFX_ERROR_INVALID_PARAM: + return -EINVAL; + default: + return 0; + } +} + +#ifdef CONFIG_PM_DEVICE +static int stop_rx(const struct device *dev) +{ + const struct uarte_nrfx_config *cfg = dev->config; + + if (IS_INT_DRIVEN_API(dev)) { + return uart_async_to_irq_rx_disable(dev); + } + + __ASSERT_NO_MSG(IS_POLLING_API(dev)); + nrfx_err_t err; + const nrfx_uarte_t *instance = &cfg->nrfx_dev; + + err = nrfx_uarte_rx_abort(instance, true, true); + __ASSERT_NO_MSG(err == NRFX_SUCCESS); + + return 0; +} + +static int uarte_nrfx_pm_action(const struct device *dev, + enum pm_device_action action) +{ + const struct uarte_nrfx_config *cfg = dev->config; + int ret; + + switch (action) { + case PM_DEVICE_ACTION_RESUME: + if (cfg->flags & UARTE_CFG_FLAG_GPIO_MGMT) { + ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); + if (ret < 0) { + return ret; + } + } + if (!IS_ASYNC_API(dev) && !(cfg->flags & UARTE_CFG_FLAG_NO_RX)) { + return start_rx(dev); + } + + break; + case PM_DEVICE_ACTION_SUSPEND: + if (!IS_ASYNC_API(dev) && !(cfg->flags & UARTE_CFG_FLAG_NO_RX)) { + stop_rx(dev); + } + + if (cfg->flags & UARTE_CFG_FLAG_GPIO_MGMT) { + ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP); + if (ret < 0) { + return ret; + } + } + + break; + default: + return -ENOTSUP; + } + + return 0; +} +#endif + +#if defined(UARTE_CONFIG_STOP_Msk) +#define UARTE_HAS_STOP_CONFIG 1 +#endif + +#define UARTE(idx) DT_NODELABEL(uart##idx) +#define UARTE_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(UARTE(idx), prop) +#define UARTE_PROP(idx, prop) DT_PROP(UARTE(idx), prop) + +/* Macro returning initial log level. Logs are off for UART used for console. */ +#define GET_INIT_LOG_LEVEL(idx) \ + COND_CODE_1(DT_HAS_CHOSEN(zephyr_console), \ + (DT_SAME_NODE(UARTE(idx), \ + DT_CHOSEN(zephyr_console)) ? \ + LOG_LEVEL_NONE : CONFIG_UART_LOG_LEVEL), \ + (CONFIG_UART_LOG_LEVEL)) + +/* Macro puts buffers in dedicated section if device tree property is set. */ +#define UARTE_MEMORY_SECTION(idx) \ + COND_CODE_1(UARTE_HAS_PROP(idx, memory_regions), \ + (__attribute__((__section__(LINKER_DT_NODE_REGION_NAME( \ + DT_PHANDLE(UARTE(idx), memory_regions)))))), \ + ()) + +#define UART_NRF_UARTE_DEVICE(idx) \ + LOG_INSTANCE_REGISTER(LOG_MODULE_NAME, idx, GET_INIT_LOG_LEVEL(idx)); \ + static uint8_t uarte##idx##_tx_cache[CONFIG_UART_##idx##_TX_CACHE_SIZE] \ + UARTE_MEMORY_SECTION(idx) __aligned(4); \ + static uint8_t uarte##idx##_rx_cache[CONFIG_UART_##idx##_RX_CACHE_SIZE] \ + UARTE_MEMORY_SECTION(idx) __aligned(4); \ + static nrfx_uarte_rx_cache_t uarte##idx##_rx_cache_scratch; \ + IF_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN, \ + (static uint8_t a2i_rx_buf##idx[CONFIG_UART_##idx##_A2I_RX_SIZE];)) \ + PINCTRL_DT_DEFINE(UARTE(idx)); \ + static const struct uart_async_to_irq_config uarte_a2i_config_##idx = \ + UART_ASYNC_TO_IRQ_API_CONFIG_INITIALIZER(&a2i_api, \ + async_to_irq_trampoline, \ + UARTE_PROP(idx, current_speed), \ + uarte##idx##_tx_cache, \ + /* nrfx_uarte driver is using the last byte in the */ \ + /* cache buffer for keeping a byte that is currently*/\ + /* polled out so it cannot be used as a cache buffer*/\ + /* by the adaptation layer. */ \ + sizeof(uarte##idx##_tx_cache) - 1, \ + COND_CODE_1(CONFIG_UART_##idx##_INTERRUPT_DRIVEN, \ + (a2i_rx_buf##idx), (NULL)), \ + COND_CODE_1(CONFIG_UART_##idx##_INTERRUPT_DRIVEN, \ + (sizeof(a2i_rx_buf##idx)), (0)), \ + CONFIG_UART_##idx##_A2I_RX_BUF_COUNT, \ + LOG_INSTANCE_PTR(LOG_MODULE_NAME, idx)); \ + static const struct uarte_nrfx_config uarte_config_##idx = { \ + .a2i_config = IS_ENABLED(CONFIG_UART_##idx## _INTERRUPT_DRIVEN) ? \ + &uarte_a2i_config_##idx : NULL, \ + .nrfx_dev = NRFX_UARTE_INSTANCE(idx), \ + .nrfx_config = { \ + .p_context = (void *)DEVICE_DT_GET(UARTE(idx)), \ + .tx_cache = { \ + .p_buffer = uarte##idx##_tx_cache, \ + .length = CONFIG_UART_##idx##_TX_CACHE_SIZE \ + }, \ + .rx_cache = { \ + .p_buffer = uarte##idx##_rx_cache, \ + .length = CONFIG_UART_##idx##_RX_CACHE_SIZE \ + }, \ + .p_rx_cache_scratch = &uarte##idx##_rx_cache_scratch, \ + .baudrate = NRF_BAUDRATE(UARTE_PROP(idx, current_speed)), \ + .interrupt_priority = DT_IRQ(UARTE(idx), priority), \ + .config = { \ + .hwfc = (UARTE_PROP(idx, hw_flow_control) == \ + UART_CFG_FLOW_CTRL_RTS_CTS) ? \ + NRF_UARTE_HWFC_ENABLED : NRF_UARTE_HWFC_DISABLED, \ + .parity = IS_ENABLED(CONFIG_UART_##idx##_NRF_PARITY_BIT) ? \ + NRF_UARTE_PARITY_INCLUDED : NRF_UARTE_PARITY_EXCLUDED, \ + IF_ENABLED(UARTE_HAS_STOP_CONFIG, (.stop = NRF_UARTE_STOP_ONE,))\ + IF_ENABLED(UARTE_ODD_PARITY_ALLOWED, \ + (.paritytype = NRF_UARTE_PARITYTYPE_EVEN,)) \ + }, \ + .tx_stop_on_end = IS_ENABLED(CONFIG_UART_##idx##_ENHANCED_POLL_OUT), \ + .skip_psel_cfg = true, \ + .skip_gpio_cfg = true, \ + }, \ + .pcfg = PINCTRL_DT_DEV_CONFIG_GET(UARTE(idx)), \ + .flags = (UARTE_PROP(idx, disable_rx) ? UARTE_CFG_FLAG_NO_RX : 0) | \ + (IS_ENABLED(CONFIG_UART_##idx##_GPIO_MANAGEMENT) ? \ + UARTE_CFG_FLAG_GPIO_MGMT : 0) | \ + (IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN) ? \ + UARTE_CFG_FLAG_INTERRUPT_DRIVEN_API : 0), \ + LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \ + }; \ + static struct uart_async_to_irq_data uarte_a2i_data_##idx; \ + static struct uarte_async_data uarte_async_##idx; \ + static struct uarte_nrfx_data uarte_data_##idx = { \ + .a2i_data = IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN) ? \ + &uarte_a2i_data_##idx : NULL, \ + IF_ENABLED(CONFIG_UART_USE_RUNTIME_CONFIGURE, \ + (.uart_config = { \ + .baudrate = UARTE_PROP(idx, current_speed), \ + .parity = IS_ENABLED(CONFIG_UART_##idx##_NRF_PARITY_BIT) ? \ + UART_CFG_PARITY_EVEN : UART_CFG_PARITY_NONE, \ + .stop_bits = UART_CFG_STOP_BITS_1, \ + .data_bits = UART_CFG_DATA_BITS_8, \ + .flow_ctrl = UARTE_PROP(idx, hw_flow_control) ? \ + UART_CFG_FLOW_CTRL_RTS_CTS : UART_CFG_FLOW_CTRL_NONE, \ + },)) \ + .async = (IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN) || \ + IS_ENABLED(CONFIG_UART_##idx##_ASYNC)) ? &uarte_async_##idx : NULL \ + }; \ + static int uarte_init_##idx(const struct device *dev) \ + { \ + COND_CODE_1(INSTANCE_POLLING(_, /*empty*/, idx, _), (), \ + ( \ + IRQ_CONNECT(DT_IRQN(UARTE(idx)), DT_IRQ(UARTE(idx), priority), \ + nrfx_isr, nrfx_uarte_##idx##_irq_handler, 0); \ + irq_enable(DT_IRQN(UARTE(idx))); \ + ) \ + ) \ + return uarte_nrfx_init(dev); \ + } \ + PM_DEVICE_DT_DEFINE(UARTE(idx), uarte_nrfx_pm_action); \ + DEVICE_DT_DEFINE(UARTE(idx), \ + uarte_init_##idx, \ + PM_DEVICE_DT_GET(UARTE(idx)), \ + &uarte_data_##idx, \ + &uarte_config_##idx, \ + PRE_KERNEL_1, \ + CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ + &uart_nrfx_uarte_driver_api) + +/* Macro creates device instance if it is enabled in devicetree. */ +#define UARTE_DEVICE(periph, prefix, id, _) \ + IF_ENABLED(CONFIG_HAS_HW_NRF_UARTE##prefix##id, (UART_NRF_UARTE_DEVICE(prefix##id);)) + +/* Macro iterates over nrfx_uarte instances enabled in the nrfx_config.h. */ +NRFX_FOREACH_ENABLED(UARTE, UARTE_DEVICE, (), (), _) From 8dce4e1e13e41d6b79698002c7cc03fff4c5006c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 13 Nov 2023 09:47:24 +0100 Subject: [PATCH 0232/2300] [nrf fromtree] tests: drivers: uart: uart_mix_fifo_poll: Align the the new nrfx driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align test configurations to the new uart driver based on nrfx_uarte. Signed-off-by: Krzysztof Chruściński (cherry picked from commit b8c9aad728768dfc28551b5479865eff646436af) Signed-off-by: Robert Lubos (cherry picked from commit 0c56697d7268f707c77d45c85761efd11e2effc1) --- .../uart/uart_mix_fifo_poll/testcase.yaml | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 65848e6603e..c2196c1058d 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -18,22 +18,22 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=n + tags: bsim_skip_CI drivers.uart.uart_mix_poll_fifo: extra_configs: - CONFIG_UART_INTERRUPT_DRIVEN=y - CONFIG_UART_0_INTERRUPT_DRIVEN=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n + tags: bsim_skip_CI drivers.uart.uart_mix_poll_async_api: extra_configs: - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n + tags: bsim_skip_CI drivers.uart.uart_mix_poll_async_api_const: extra_args: TEST_CONST_BUFFER=1 @@ -41,22 +41,9 @@ tests: - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - - CONFIG_NRFX_TIMER2=y - - CONFIG_UART_0_ENHANCED_POLL_OUT=n - - CONFIG_UART_ASYNC_TX_CACHE_SIZE=2 - - drivers.uart.uart_mix_poll_async_api_low_power: - extra_configs: - - CONFIG_UART_ASYNC_API=y - - CONFIG_UART_0_INTERRUPT_DRIVEN=n - - CONFIG_UART_0_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC=y - - CONFIG_UART_0_NRF_ASYNC_LOW_POWER=y - - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n + - CONFIG_UART_0_TX_CACHE_SIZE=2 + tags: bsim_skip_CI # We skip a few tests to save CI time, as they give little extra coverage drivers.uart.uart_mix_poll_with_ppi: extra_configs: @@ -75,18 +62,29 @@ tests: - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC=y - - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y - drivers.uart.uart_mix_poll_async_api_with_ppi_low_power: + drivers.uart.legacy.uart_mix_poll: + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=n + - CONFIG_UART_ASYNC_API=n + - CONFIG_UART_0_ENHANCED_POLL_OUT=n + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y + + drivers.uart.legacy.uart_mix_poll_fifo: + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=y + - CONFIG_UART_0_INTERRUPT_DRIVEN=y + - CONFIG_UART_0_ENHANCED_POLL_OUT=n + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y + + drivers.uart.legacy.uart_mix_poll_async_api: extra_configs: - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y + - CONFIG_UART_0_ENHANCED_POLL_OUT=n - CONFIG_UART_0_NRF_HW_ASYNC=y - - CONFIG_UART_0_NRF_ASYNC_LOW_POWER=y - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - CONFIG_NRFX_TIMER2=y - - CONFIG_UART_0_ENHANCED_POLL_OUT=y + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y From 6e8622909e117c96432c691251027d614189e152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 17 Jan 2024 12:24:05 +0100 Subject: [PATCH 0233/2300] [nrf fromtree] tests: drivers: uart: async_api: Add configuration for legacy nrf driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration which tests legacy nrf uart driver. Prevent tests on nrf52_bsim of the new driver (it is requiring adjustments for the simulation). It will be fixed by another patch. Signed-off-by: Krzysztof Chruściński (cherry picked from commit e47bdb2555c8c63443a2baf375571439ed9255a9) Signed-off-by: Robert Lubos (cherry picked from commit 3ba0914d271c4a989fc52bf796fca20dad92f1d0) --- tests/drivers/uart/uart_async_api/testcase.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/drivers/uart/uart_async_api/testcase.yaml b/tests/drivers/uart/uart_async_api/testcase.yaml index e9914d48d99..3c5f2d5583e 100644 --- a/tests/drivers/uart/uart_async_api/testcase.yaml +++ b/tests/drivers/uart/uart_async_api/testcase.yaml @@ -13,6 +13,7 @@ tests: harness_config: fixture: gpio_loopback depends_on: gpio + tags: bsim_skip_CI drivers.uart.wide: filter: CONFIG_UART_CONSOLE and CONFIG_SERIAL_SUPPORT_ASYNC and not CONFIG_UART_MCUX_LPUART harness: ztest @@ -25,6 +26,15 @@ tests: platform_allow: nucleo_h743zi integration_platforms: - nucleo_h743zi + drivers.uart.async_api.nrf_uarte_legacy: + platform_allow: nrf52840dk_nrf52840 nrf52_bsim + filter: CONFIG_SERIAL_SUPPORT_ASYNC + harness: ztest + harness_config: + fixture: gpio_loopback + depends_on: gpio + extra_configs: + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.async_api.nrf_uart: filter: CONFIG_UART_CONSOLE and CONFIG_SERIAL_SUPPORT_ASYNC harness: ztest From 73c93a7bc212fb516d9afaa275e4de944eaf109e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 17 Jan 2024 12:25:02 +0100 Subject: [PATCH 0234/2300] [nrf fromtree] tests: drivers: uart: uart_pm: Use legacy nrf driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New nrf uart shim requires addiotional work around PM. Use legacy version for those tests until it is fixed. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 2ebf83176c2bd7012a49f1d9b5b6247f36a20efe) Signed-off-by: Robert Lubos (cherry picked from commit a7c7dcca6ec221b134a1306428920c431bffc77b) --- tests/drivers/uart/uart_pm/testcase.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index efb76ecf2c1..4d71ed881cd 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -13,12 +13,14 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=n + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.no_rxpin: extra_configs: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=n + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" drivers.uart.pm.enhanced_poll: @@ -26,6 +28,7 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.int_driven: extra_configs: @@ -33,6 +36,7 @@ tests: - CONFIG_UART_0_INTERRUPT_DRIVEN=y - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=n + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.int_driven.enhanced_poll: extra_configs: @@ -40,6 +44,7 @@ tests: - CONFIG_UART_0_INTERRUPT_DRIVEN=y - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.async: extra_configs: @@ -50,6 +55,7 @@ tests: - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.async.enhanced_poll: extra_configs: @@ -60,3 +66,4 @@ tests: - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y + - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y From 50163d00c2c15ec0a0a27f82fd5f205cd1f7f6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 17 Jan 2024 12:56:28 +0100 Subject: [PATCH 0235/2300] [nrf fromtree] boards: posix: nrf_bsim: Use legacy UART shim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New UART shim must be adapted to work in the simulated environment. Use legacy version until it is fixed. Signed-off-by: Krzysztof Chruściński (cherry picked from commit e2dccab4d5103fa6ac9745c610697666e244c708) Signed-off-by: Robert Lubos (cherry picked from commit e1b8a38b2bf50d98d1ec4689d1f649083bc93b56) --- boards/posix/nrf_bsim/Kconfig.defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boards/posix/nrf_bsim/Kconfig.defconfig b/boards/posix/nrf_bsim/Kconfig.defconfig index 6993048248c..0ee4c6ee2c1 100644 --- a/boards/posix/nrf_bsim/Kconfig.defconfig +++ b/boards/posix/nrf_bsim/Kconfig.defconfig @@ -93,4 +93,7 @@ config UART_CONSOLE endif # CONSOLE +config UART_NRFX_UARTE_LEGACY_SHIM + default y + endif # SOC_SERIES_BSIM_NRFXX From f84e3a8375361c8186131e8ecebee67458c6eafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 19 Jan 2024 10:59:10 +0100 Subject: [PATCH 0236/2300] [nrf fromtree] drivers: serial: nrfx_uarte: Use legacy shim by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New shim takes more flash and is causing some tests to overflow the ROM memory. Switching to the legacy shim as default until it is fixed. Signed-off-by: Krzysztof Chruściński (cherry picked from commit fb185fb5bd84efb9128ebceb671d051c711c2d71) (cherry picked from commit 4e00677dfdd416b25178f9d38e40dda39306c0f2) --- drivers/serial/Kconfig.nrfx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 5709ca2d23a..21a657fbaf4 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -31,9 +31,8 @@ config UART_NRFX_UARTE config UART_NRFX_UARTE_LEGACY_SHIM bool "Legacy UARTE shim" depends on UART_NRFX_UARTE - # New shim takes more ROM. Until it is fixed use legacy shim in memory - # constraint case. - default y if MCUBOOT + # New shim takes more ROM. Until it is fixed use legacy shim. + default y config UART_ASYNC_TX_CACHE_SIZE int "TX cache buffer size" From ce1761d97282e30d93430324f10075e6273fe524 Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Thu, 18 Jan 2024 15:17:38 +0100 Subject: [PATCH 0237/2300] [nrf fromtree] drivers: serial: align to nRF54L15 Align UARTE driver config to nRF54L15. Signed-off-by: Magdalena Pastula (cherry picked from commit 9b3b34f16e9645524007050e52b96437f96334bb) (cherry picked from commit b4b61f3c7e80c13326d12d83b4769bb041579017) --- drivers/serial/Kconfig.nrfx | 27 +++++++++++++++++++++++ drivers/serial/Kconfig.nrfx_uart_instance | 1 + 2 files changed, 28 insertions(+) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 21a657fbaf4..8995b6b9fbf 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -31,6 +31,8 @@ config UART_NRFX_UARTE config UART_NRFX_UARTE_LEGACY_SHIM bool "Legacy UARTE shim" depends on UART_NRFX_UARTE + # NRF54L15 need new UARTE driver + depends on !SOC_SERIES_NRF54LX # New shim takes more ROM. Until it is fixed use legacy shim. default y @@ -64,6 +66,31 @@ nrfx_uart_num = 3 rsource "Kconfig.nrfx_uart_instance" endif +if HAS_HW_NRF_UARTE00 +nrfx_uart_num = 00 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE20 +nrfx_uart_num = 20 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE21 +nrfx_uart_num = 21 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE22 +nrfx_uart_num = 22 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE30 +nrfx_uart_num = 30 +rsource "Kconfig.nrfx_uart_instance" +endif + config NRFX_TIMER0 default y depends on UART_0_NRF_HW_ASYNC_TIMER = 0 \ diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index 76f74caa038..718631a4d09 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -20,6 +20,7 @@ config UART_$(nrfx_uart_num)_ASYNC config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT bool "Efficient poll out on port $(nrfx_uart_num)" + depends on !SOC_SERIES_NRF54LX default y depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) select NRFX_PPI if HAS_HW_NRF_PPI From eaac5216f64fe7f14dbea98d7e7d34e4855ef7e1 Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Mon, 11 Dec 2023 15:10:04 +0100 Subject: [PATCH 0238/2300] [nrf fromtree] drivers: timer: move SYSTEM_CLOCK_WAIT to Kconfig.nrf_xrtc SYSTEM_CLOCK_WAIT will be a common part for a next version of Nordic timer. Signed-off-by: Witold Lukasik (cherry picked from commit ae78cf017d9a2da978c89278a0e6de5f2269462e) (cherry picked from commit 263b754845e73c8dcc74f3d45c69e9766b94cf6d) --- drivers/timer/Kconfig | 1 + drivers/timer/Kconfig.nrf_rtc | 32 ---------------------------- drivers/timer/Kconfig.nrf_xrtc | 38 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 drivers/timer/Kconfig.nrf_xrtc diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index 8a88e731986..b7e01eb5811 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -84,6 +84,7 @@ source "drivers/timer/Kconfig.mips_cp0" source "drivers/timer/Kconfig.native_posix" source "drivers/timer/Kconfig.npcx_itim" source "drivers/timer/Kconfig.nrf_rtc" +source "drivers/timer/Kconfig.nrf_xrtc" source "drivers/timer/Kconfig.rcar_cmt" source "drivers/timer/Kconfig.riscv_machine" source "drivers/timer/Kconfig.rv32m1_lptmr" diff --git a/drivers/timer/Kconfig.nrf_rtc b/drivers/timer/Kconfig.nrf_rtc index baa917282bc..729dc8d362a 100644 --- a/drivers/timer/Kconfig.nrf_rtc +++ b/drivers/timer/Kconfig.nrf_rtc @@ -42,36 +42,4 @@ config NRF_RTC_TIMER_TRIGGER_OVERFLOW When enabled, a function can be used to trigger RTC overflow and effectively shift time into the future. -choice - prompt "Clock startup policy" - default SYSTEM_CLOCK_WAIT_FOR_STABILITY - -config SYSTEM_CLOCK_NO_WAIT - bool "No wait" - help - System clock source is initiated but does not wait for clock readiness. - When this option is picked, system clock may not be ready when code relying - on kernel API is executed. Requested timeouts will be prolonged by the - remaining startup time. - -config SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY - bool "Wait for availability" - help - System clock source initialization waits until clock is available. In some - systems, clock initially runs from less accurate source which has faster - startup time and then seamlessly switches to the target clock source when - it is ready. When this option is picked, system clock is available after - system clock driver initialization but it may be less accurate. Option is - equivalent to waiting for stability if clock source does not have - intermediate state. - -config SYSTEM_CLOCK_WAIT_FOR_STABILITY - bool "Wait for stability" - help - System clock source initialization waits until clock is stable. When this - option is picked, system clock is available and stable after system clock - driver initialization. - -endchoice - endif # NRF_RTC_TIMER diff --git a/drivers/timer/Kconfig.nrf_xrtc b/drivers/timer/Kconfig.nrf_xrtc new file mode 100644 index 00000000000..56efbc3a298 --- /dev/null +++ b/drivers/timer/Kconfig.nrf_xrtc @@ -0,0 +1,38 @@ +# Common RTC configuration + +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if NRF_RTC_TIMER +choice + prompt "Clock startup policy" + default SYSTEM_CLOCK_WAIT_FOR_STABILITY + +config SYSTEM_CLOCK_NO_WAIT + bool "No wait" + help + System clock source is initiated but does not wait for clock readiness. + When this option is picked, system clock may not be ready when code relying + on kernel API is executed. Requested timeouts will be prolonged by the + remaining startup time. + +config SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY + bool "Wait for availability" + help + System clock source initialization waits until clock is available. In some + systems, clock initially runs from less accurate source which has faster + startup time and then seamlessly switches to the target clock source when + it is ready. When this option is picked, system clock is available after + system clock driver initialization but it may be less accurate. Option is + equivalent to waiting for stability if clock source does not have + intermediate state. + +config SYSTEM_CLOCK_WAIT_FOR_STABILITY + bool "Wait for stability" + help + System clock source initialization waits until clock is stable. When this + option is picked, system clock is available and stable after system clock + driver initialization. + +endchoice +endif # NRF_RTC_TIMER From 063b8a11583a917bddfe1170061428ca48a20820 Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Mon, 11 Dec 2023 15:13:40 +0100 Subject: [PATCH 0239/2300] [nrf fromtree] soc: arm: nordic_nrf: move NRF_RTC_TIMER not to be selected as default NRF_RTC_TIMER will not be a default timer in the next version of Nordic timer. It should be soc selection specific. Signed-off-by: Witold Lukasik (cherry picked from commit daa888c37ba71da40b3e78a60ab77afb5463d2a4) (cherry picked from commit c30a6ee741141d0cce1f3608bb07872c1c612c5e) --- soc/arm/nordic_nrf/Kconfig.defconfig | 5 +---- soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series | 4 ++++ soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series | 4 ++++ soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series | 4 ++++ soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series | 4 ++++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index 858c60d1d88..c20df806186 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -7,15 +7,12 @@ if SOC_FAMILY_NRF source "soc/arm/nordic_nrf/*/Kconfig.defconfig.series" -# If the kernel has timer support, enable both clock control and timer +# If the kernel has timer support, enable clock control if SYS_CLOCK_EXISTS config CLOCK_CONTROL default y -config NRF_RTC_TIMER - default y - endif # SYS_CLOCK_EXISTS config SYS_CLOCK_HW_CYCLES_PER_SEC diff --git a/soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series index 8c0bc74c02f..a4053bf7fed 100644 --- a/soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series +++ b/soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series @@ -14,4 +14,8 @@ config SOC_SERIES config NUM_IRQS default 26 +# If the kernel has timer support, enable the timer +config NRF_RTC_TIMER + default y if SYS_CLOCK_EXISTS + endif # SOC_SERIES_NRF51X diff --git a/soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series index 4a7edf2aa95..2e89a5130a6 100644 --- a/soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series +++ b/soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series @@ -10,4 +10,8 @@ source "soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.nrf52*" config SOC_SERIES default "nrf52" +# If the kernel has timer support, enable the timer +config NRF_RTC_TIMER + default y if SYS_CLOCK_EXISTS + endif # SOC_SERIES_NRF52X diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series index 2857d5dd25d..7e5660cf514 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series @@ -10,4 +10,8 @@ source "soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.nrf53*" config SOC_SERIES default "nrf53" +# If the kernel has timer support, enable the timer +config NRF_RTC_TIMER + default y if SYS_CLOCK_EXISTS + endif # SOC_SERIES_NRF53X diff --git a/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series index 9612555a4c8..6d6cccab999 100644 --- a/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series +++ b/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series @@ -10,4 +10,8 @@ source "soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf91*" config SOC_SERIES default "nrf91" +# If the kernel has timer support, enable the timer +config NRF_RTC_TIMER + default y if SYS_CLOCK_EXISTS + endif # SOC_SERIES_NRF91X From e66c7848b2e3363a5ef1c231417c60f41e0358cd Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 9 Jan 2024 15:47:17 +0100 Subject: [PATCH 0240/2300] [nrf fromtree] dts: binding: add binding for GRTC Add dts bindings for Global Real-Time Counter. Signed-off-by: Magdalena Pastula (cherry picked from commit 1d91a09bfee6f66c5063034784afa44e02463a60) (cherry picked from commit 0cf636a2e69718692534fa3b6b8e5827f4250bff) --- dts/bindings/misc/nordic,split-channels.yaml | 44 ++++++++++++++++++++ dts/bindings/timer/nordic,nrf-grtc.yaml | 25 +++++++++++ 2 files changed, 69 insertions(+) create mode 100644 dts/bindings/misc/nordic,split-channels.yaml create mode 100644 dts/bindings/timer/nordic,nrf-grtc.yaml diff --git a/dts/bindings/misc/nordic,split-channels.yaml b/dts/bindings/misc/nordic,split-channels.yaml new file mode 100644 index 00000000000..a875dc12d7f --- /dev/null +++ b/dts/bindings/misc/nordic,split-channels.yaml @@ -0,0 +1,44 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +description: | + Nordic Split Channels + + Some of Nordic's peripherals support split ownership feature that allows to + be used by independent owners. As an example the configuration of the + Global Real Time Counter (GRTC) is shown below: + owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; + child-owned-channels = <7 8 9 10 11>; + + Which means that channels 0-11 will be assigned to the particular CPU. + Other CPUs cannot use those and another set must be defined for them. + In addition, `child-owned-channels` property allows to use channels + 7-11 only by child subprocessor. If the CPU you're configuring has no + subprocessor(s) assigned, the `child-owned-channels` property + should not be defined. + +properties: + owned-channels: + type: array + description: | + List of channels in a split-ownership peripheral that are to be owned + for use by the compiled CPU. + + nonsecure-channels: + type: array + description: | + List of channels in a split-ownership, split-security peripheral that + are to be configured as nonsecure. In Trustzone systems, this property + is only evaluated for secure peripherals, as nonsecure channels are + implicitly specified through the owned-channels property. This property + is ignored in non-Trustzone systems. + + child-owned-channels: + type: array + description: | + List of channels in a split-ownership peripheral that are officially + owned by the compiled CPU but intended to be used by its child + subprocessor(s). diff --git a/dts/bindings/timer/nordic,nrf-grtc.yaml b/dts/bindings/timer/nordic,nrf-grtc.yaml new file mode 100644 index 00000000000..e78e57df97e --- /dev/null +++ b/dts/bindings/timer/nordic,nrf-grtc.yaml @@ -0,0 +1,25 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +description: Nordic GRTC (Global RTC) + +compatible: "nordic,nrf-grtc" + +include: + - "base.yaml" + - "nordic,split-channels.yaml" + +properties: + reg: + required: true + + interrupts: + required: true + + cc-num: + description: Number of capture/compare channels + type: int + required: true From 0e6ab260105aa75ee2c8a0d6f573b1e5daaa9485 Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 9 Jan 2024 15:48:04 +0100 Subject: [PATCH 0241/2300] [nrf fromtree] modules: hal_nordic: nrfx: add nRF54L15 GRTC instance Add GRTC instance in Nordic HAL configs. Signed-off-by: Magdalena Pastula (cherry picked from commit d3fa931dfdc01ac30c8fff4f443c2016317b5600) (cherry picked from commit 6009ece2edb63e0b524efc01a6dbf52662b685bc) --- modules/hal_nordic/nrfx/CMakeLists.txt | 7 +++++++ modules/hal_nordic/nrfx/Kconfig | 4 ++++ modules/hal_nordic/nrfx/Kconfig.logging | 4 ++++ modules/hal_nordic/nrfx/nrfx_config.h | 7 +++++++ 4 files changed, 22 insertions(+) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 69afbcc9c51..2e809c52b79 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -31,6 +31,8 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUAPP NRF5340_XXAA_APP zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP NRF5340_XXAA_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUNET NRF5340_XXAA_NETWORK) zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET NRF5340_XXAA_NETWORK) +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_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) @@ -79,6 +81,7 @@ zephyr_library_sources_ifdef(CONFIG_NRFX_COMP ${SRC_DIR}/nrfx_comp.c) zephyr_library_sources_ifdef(CONFIG_NRFX_DPPI ${SRC_DIR}/nrfx_dppi.c) zephyr_library_sources_ifdef(CONFIG_NRFX_EGU ${SRC_DIR}/nrfx_egu.c) zephyr_library_sources_ifdef(CONFIG_NRFX_GPIOTE ${SRC_DIR}/nrfx_gpiote.c) +zephyr_library_sources_ifdef(CONFIG_NRFX_GRTC ${SRC_DIR}/nrfx_grtc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_I2S ${SRC_DIR}/nrfx_i2s.c) zephyr_library_sources_ifdef(CONFIG_NRFX_IPC ${SRC_DIR}/nrfx_ipc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_LPCOMP ${SRC_DIR}/nrfx_lpcomp.c) @@ -111,6 +114,10 @@ if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM) zephyr_library_sources(${SRC_DIR}/nrfx_twi_twim.c) endif() +if (CONFIG_NRF_GRTC_TIMER AND CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) + zephyr_library_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) +endif() + # Inject HAL "CONFIG_NFCT_PINS_AS_GPIOS" definition if user requests to # configure the NFCT pins as GPIOS. Do the same with "CONFIG_GPIO_AS_PINRESET" # to configure the reset GPIO as nRESET. This way, the HAL will take care of diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index b4c00040ee1..bdca4016ee3 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -103,6 +103,10 @@ config NRFX_GPIOTE_NUM_OF_EVT_HANDLERS Specifies number of handlers that can be registered to nrfx_gpiote driver by the user. +config NRFX_GRTC + bool "GRTC driver" + depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_GRTC)) + config NRFX_I2S bool diff --git a/modules/hal_nordic/nrfx/Kconfig.logging b/modules/hal_nordic/nrfx/Kconfig.logging index 7f7b785e70c..b24d683d3de 100644 --- a/modules/hal_nordic/nrfx/Kconfig.logging +++ b/modules/hal_nordic/nrfx/Kconfig.logging @@ -28,6 +28,10 @@ config NRFX_GPIOTE_LOG bool "GPIOTE driver logging" depends on NRFX_GPIOTE +config NRFX_GRTC_LOG + bool "GRTC driver logging" + depends on NRFX_GRTC + config NRFX_I2S_LOG bool "I2S driver logging" depends on NRFX_I2S diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index ac930b13639..451101c8f4b 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -109,6 +109,13 @@ #define NRFX_EGU5_ENABLED 1 #endif +#ifdef CONFIG_NRFX_GRTC +#define NRFX_GRTC_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_GRTC_LOG +#define NRFX_GRTC_CONFIG_LOG_ENABLED 1 +#endif + #ifdef CONFIG_NRFX_GPIOTE #define NRFX_GPIOTE_ENABLED 1 #endif From b53542af11c5e7f97894b6f04b0571e41e23f0ce Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 9 Jan 2024 15:49:11 +0100 Subject: [PATCH 0242/2300] [nrf fromtree] soc: arm: nordic_nrf: add support for nRF54L15 GRTC instance Add GRTC as possible clock source. Signed-off-by: Magdalena Pastula (cherry picked from commit 70b21845b219cbd7a4bffd4f997fe604b8edd87d) (cherry picked from commit 506370123592c171541e50b721031ea7cf63dfe3) --- soc/arm/nordic_nrf/Kconfig.defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index c20df806186..879217a92fe 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -16,10 +16,12 @@ config CLOCK_CONTROL endif # SYS_CLOCK_EXISTS config SYS_CLOCK_HW_CYCLES_PER_SEC + default 1000000 if NRF_GRTC_TIMER default 32768 config SYS_CLOCK_TICKS_PER_SEC default 128 if !TICKLESS_KERNEL + default 10000 if NRF_GRTC_TIMER default 32768 config ARCH_HAS_CUSTOM_BUSY_WAIT From 4e2b9ca49e420a4e2f125553004bf4d0dd53e97a Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 9 Jan 2024 15:49:46 +0100 Subject: [PATCH 0243/2300] [nrf fromtree] drivers: timer: add GRTC driver Add Nordic driver for GRTC. Signed-off-by: Magdalena Pastula (cherry picked from commit b605c4219bf34663d249ffbcdf0fb735f3daaead) (cherry picked from commit bc68b120ee5d59ffa948f07df3f108e718709f5a) --- drivers/timer/CMakeLists.txt | 1 + drivers/timer/Kconfig | 1 + drivers/timer/Kconfig.nrf_grtc | 48 ++ drivers/timer/Kconfig.nrf_xrtc | 4 +- drivers/timer/nrf_grtc_timer.c | 566 ++++++++++++++++++ include/zephyr/drivers/timer/nrf_grtc_timer.h | 202 +++++++ 6 files changed, 820 insertions(+), 2 deletions(-) create mode 100644 drivers/timer/Kconfig.nrf_grtc create mode 100644 drivers/timer/nrf_grtc_timer.c create mode 100644 include/zephyr/drivers/timer/nrf_grtc_timer.h diff --git a/drivers/timer/CMakeLists.txt b/drivers/timer/CMakeLists.txt index 47a10b358c1..36534e4716f 100644 --- a/drivers/timer/CMakeLists.txt +++ b/drivers/timer/CMakeLists.txt @@ -24,6 +24,7 @@ zephyr_library_sources_ifdef(CONFIG_MCUX_GPT_TIMER mcux_gpt_timer.c) zephyr_library_sources_ifdef(CONFIG_MIPS_CP0_TIMER mips_cp0_timer.c) zephyr_library_sources_ifdef(CONFIG_NATIVE_POSIX_TIMER native_posix_timer.c) zephyr_library_sources_ifdef(CONFIG_NPCX_ITIM_TIMER npcx_itim_timer.c) +zephyr_library_sources_ifdef(CONFIG_NRF_GRTC_TIMER nrf_grtc_timer.c) zephyr_library_sources_ifdef(CONFIG_NRF_RTC_TIMER nrf_rtc_timer.c) zephyr_library_sources_ifdef(CONFIG_RCAR_CMT_TIMER rcar_cmt_timer.c) zephyr_library_sources_ifdef(CONFIG_RISCV_MACHINE_TIMER riscv_machine_timer.c) diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index b7e01eb5811..f20442dd2c5 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -84,6 +84,7 @@ source "drivers/timer/Kconfig.mips_cp0" source "drivers/timer/Kconfig.native_posix" source "drivers/timer/Kconfig.npcx_itim" source "drivers/timer/Kconfig.nrf_rtc" +source "drivers/timer/Kconfig.nrf_grtc" source "drivers/timer/Kconfig.nrf_xrtc" source "drivers/timer/Kconfig.rcar_cmt" source "drivers/timer/Kconfig.riscv_machine" diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc new file mode 100644 index 00000000000..442c524fd19 --- /dev/null +++ b/drivers/timer/Kconfig.nrf_grtc @@ -0,0 +1,48 @@ +# Timer driver configuration options +# Copyright (c) 2024 Nordic Semiconductor ASA + +menuconfig NRF_GRTC_TIMER + bool "nRF GRTC Timer" + default y if DT_HAS_NORDIC_NRF_GRTC_ENABLED + select TICKLESS_CAPABLE + select TIMER_HAS_64BIT_CYCLE_COUNTER + select NRFX_GRTC + help + This module implements a kernel device driver for the nRF Global Real + Time Counter NRF_GRTC and provides the standard "system clock driver" + interfaces. + +if NRF_GRTC_TIMER + +config NRF_GRTC_SLEEP_ALLOWED + def_bool y + depends on POWEROFF + help + This feature allows GRTC SYSCOUNTER to go to sleep state. + +config NRF_GRTC_TIMER_APP_DEFINED_INIT + bool "Application defines GRTC initialization" + help + Application defines the initialization procedure and time of the GRTC + drivers, rather than leaving it up to SYS_INIT. + +config NRF_GRTC_START_SYSCOUNTER + bool "Start SYSCOUNTER on driver init" + select NRF_GRTC_TIMER_CLOCK_MANAGEMENT + help + Start the SYSCOUNTER when initializing the GRTC. This should only be + handled by one processor in the system. + +config NRF_GRTC_TIMER_CLOCK_MANAGEMENT + bool + help + Compile additional driver code for enabling management functionality of + the GRTC. Usually this is only needed by the processor that is starting + the SYSCOUNTER, but can be shared by multiple processors in the system. + +config NRF_GRTC_SLEEP_MINIMUM_LATENCY + int + default 1000 + depends on NRF_GRTC_SLEEP_ALLOWED + +endif # NRF_GRTC_TIMER diff --git a/drivers/timer/Kconfig.nrf_xrtc b/drivers/timer/Kconfig.nrf_xrtc index 56efbc3a298..f9fa25a1c30 100644 --- a/drivers/timer/Kconfig.nrf_xrtc +++ b/drivers/timer/Kconfig.nrf_xrtc @@ -3,7 +3,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if NRF_RTC_TIMER +if NRF_RTC_TIMER || NRF_GRTC_TIMER choice prompt "Clock startup policy" default SYSTEM_CLOCK_WAIT_FOR_STABILITY @@ -35,4 +35,4 @@ config SYSTEM_CLOCK_WAIT_FOR_STABILITY driver initialization. endchoice -endif # NRF_RTC_TIMER +endif # NRF_RTC_TIMER || NRF_GRTC_TIMER diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c new file mode 100644 index 00000000000..dc6ac410905 --- /dev/null +++ b/drivers/timer/nrf_grtc_timer.c @@ -0,0 +1,566 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define CHAN_COUNT NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS +#define EXT_CHAN_COUNT (CHAN_COUNT - 1) +/* The reset value of waketime is 1, which doesn't seem to work. + * It's being looked into, but for the time being use 4. + * Timeout must always be higher than waketime, so setting that to 5. + */ +#define WAKETIME (4) +#define TIMEOUT (WAKETIME + 1) + +#define GRTC_NODE DT_NODELABEL(grtc) + +#ifndef GRTC_SYSCOUNTERL_VALUE_Msk +#define GRTC_SYSCOUNTERL_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERL_VALUE_Msk +#endif + +#ifndef GRTC_SYSCOUNTERH_VALUE_Msk +#define GRTC_SYSCOUNTERH_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERH_VALUE_Msk +#endif + +#define MAX_CC_LATCH_WAIT_TIME_US 77 + +#define CYC_PER_TICK \ + ((uint64_t)sys_clock_hw_cycles_per_sec() / (uint64_t)CONFIG_SYS_CLOCK_TICKS_PER_SEC) + +#define COUNTER_SPAN (GRTC_SYSCOUNTERL_VALUE_Msk | ((uint64_t)GRTC_SYSCOUNTERH_VALUE_Msk << 32)) +#define MAX_TICKS \ + (((COUNTER_SPAN / CYC_PER_TICK) > INT_MAX) ? INT_MAX : (COUNTER_SPAN / CYC_PER_TICK)) + +#define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) + +/* The maximum SYSCOUNTERVALID settling time equals 1x32k cycles + 20x1MHz cycles. */ +#define GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US 51 + +#if defined(CONFIG_TEST) +const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); +#endif + +static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_context); + +static struct k_spinlock lock; +static uint64_t last_count; +static atomic_t int_mask; +static uint8_t ext_channels_allocated; +static nrfx_grtc_channel_t system_clock_channel_data = { + .handler = sys_clock_timeout_handler, + .p_context = NULL, + .channel = (uint8_t)-1, +}; + +#define IS_CHANNEL_ALLOWED_ASSERT(chan) \ + __ASSERT_NO_MSG((NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK & (1UL << (chan))) && \ + ((chan) != system_clock_channel_data.channel)) + +static inline void grtc_active_set(void) +{ +#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) + nrfy_grtc_sys_counter_active_set(NRF_GRTC, true); + while (!nrfy_grtc_sys_conter_ready_check(NRF_GRTC)) { + } +#else + nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, true); + k_busy_wait(GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US); +#endif +} + +static inline void grtc_wakeup(void) +{ + if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { + grtc_active_set(); + } +} + +static inline void grtc_sleep(void) +{ + if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { +#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) + nrfy_grtc_sys_counter_active_set(NRF_GRTC, false); +#else + nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, false); +#endif + } +} + +static inline uint64_t counter_sub(uint64_t a, uint64_t b) +{ + return (a - b); +} + +static inline uint64_t counter(void) +{ + uint64_t now; + + grtc_wakeup(); + nrfx_grtc_syscounter_get(&now); + grtc_sleep(); + return now; +} + +static inline uint64_t get_comparator(uint32_t chan) +{ + uint64_t cc; + nrfx_err_t result; + + result = nrfx_grtc_syscounter_cc_value_read(chan, &cc); + if (result != NRFX_SUCCESS) { + if (result != NRFX_ERROR_INVALID_PARAM) { + return -EAGAIN; + } + return -EPERM; + } + return cc; +} + +static void system_timeout_set(uint64_t value) +{ + if (value <= NRF_GRTC_SYSCOUNTER_CCADD_MASK) { + grtc_wakeup(); + nrfx_grtc_syscounter_cc_relative_set(&system_clock_channel_data, value, true, + NRFX_GRTC_CC_RELATIVE_SYSCOUNTER); + grtc_sleep(); + } else { + nrfx_grtc_syscounter_cc_absolute_set(&system_clock_channel_data, value + counter(), + true); + } +} + +static bool compare_int_lock(int32_t chan) +{ + atomic_val_t prev = atomic_and(&int_mask, ~BIT(chan)); + + nrfx_grtc_syscounter_cc_int_disable(chan); + + return prev & BIT(chan); +} + +static void compare_int_unlock(int32_t chan, bool key) +{ + if (key) { + atomic_or(&int_mask, BIT(chan)); + nrfx_grtc_syscounter_cc_int_enable(chan); + } +} + +static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_context) +{ + ARG_UNUSED(id); + ARG_UNUSED(p_context); + uint64_t dticks; + uint64_t now = counter(); + + if (unlikely(now < cc_val)) { + return; + } + if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { + /* protection is not needed because we are in the GRTC interrupt + * so it won't get preempted by the interrupt. + */ + system_timeout_set(CYC_PER_TICK); + } + + dticks = counter_sub(now, last_count) / CYC_PER_TICK; + + last_count += dticks * CYC_PER_TICK; + sys_clock_announce(IS_ENABLED(CONFIG_TICKLESS_KERNEL) ? (int32_t)dticks : (dticks > 0)); +} + +int32_t z_nrf_grtc_timer_chan_alloc(void) +{ + uint8_t chan; + nrfx_err_t err_code; + + /* Prevent allocating all available channels - one must be left for system purposes. */ + if (ext_channels_allocated >= EXT_CHAN_COUNT) { + return -ENOMEM; + } + err_code = nrfx_grtc_channel_alloc(&chan); + if (err_code != NRFX_SUCCESS) { + return -ENOMEM; + } + ext_channels_allocated++; + return (int32_t)chan; +} + +void z_nrf_grtc_timer_chan_free(int32_t chan) +{ + IS_CHANNEL_ALLOWED_ASSERT(chan); + nrfx_err_t err_code = nrfx_grtc_channel_free(chan); + + if (err_code == NRFX_SUCCESS) { + ext_channels_allocated--; + } +} + +bool z_nrf_grtc_timer_compare_evt_check(int32_t chan) +{ + IS_CHANNEL_ALLOWED_ASSERT(chan); + + uint32_t event_address = nrfx_grtc_event_compare_address_get(chan); + + return *(volatile uint32_t *)event_address != 0; +} + +uint32_t z_nrf_grtc_timer_compare_evt_address_get(int32_t chan) +{ + IS_CHANNEL_ALLOWED_ASSERT(chan); + + return nrfx_grtc_event_compare_address_get(chan); +} + +uint32_t z_nrf_grtc_timer_capture_task_address_get(int32_t chan) +{ + IS_CHANNEL_ALLOWED_ASSERT(chan); + + return nrfx_grtc_capture_task_address_get(chan); +} + +uint64_t z_nrf_grtc_timer_read(void) +{ + return counter(); +} + +bool z_nrf_grtc_timer_compare_int_lock(int32_t chan) +{ + IS_CHANNEL_ALLOWED_ASSERT(chan); + + return compare_int_lock(chan); +} + +void z_nrf_grtc_timer_compare_int_unlock(int32_t chan, bool key) +{ + IS_CHANNEL_ALLOWED_ASSERT(chan); + + compare_int_unlock(chan, key); +} + +uint64_t z_nrf_grtc_timer_compare_read(int32_t chan) +{ + IS_CHANNEL_ALLOWED_ASSERT(chan); + + return get_comparator(chan); +} + +static int compare_set_nolocks(int32_t chan, uint64_t target_time, + z_nrf_grtc_timer_compare_handler_t handler, void *user_data) +{ + nrfx_err_t result; + + __ASSERT_NO_MSG(target_time < COUNTER_SPAN); + nrfx_grtc_channel_t user_channel_data = { + .handler = handler, + .p_context = user_data, + .channel = chan, + }; + result = nrfx_grtc_syscounter_cc_absolute_set(&user_channel_data, target_time, true); + if (result != NRFX_SUCCESS) { + return -EPERM; + } + return 0; +} + +static int compare_set(int32_t chan, uint64_t target_time, + z_nrf_grtc_timer_compare_handler_t handler, void *user_data) +{ + bool key = compare_int_lock(chan); + int ret = compare_set_nolocks(chan, target_time, handler, user_data); + + compare_int_unlock(chan, key); + + return ret; +} + +int z_nrf_grtc_timer_set(int32_t chan, uint64_t target_time, + z_nrf_grtc_timer_compare_handler_t handler, void *user_data) +{ + IS_CHANNEL_ALLOWED_ASSERT(chan); + + return compare_set(chan, target_time, (nrfx_grtc_cc_handler_t)handler, user_data); +} + +void z_nrf_grtc_timer_abort(int32_t chan) +{ + IS_CHANNEL_ALLOWED_ASSERT(chan); + + bool key = compare_int_lock(chan); + (void)nrfx_grtc_syscounter_cc_disable(chan); + compare_int_unlock(chan, key); +} + +uint64_t z_nrf_grtc_timer_get_ticks(k_timeout_t t) +{ + uint64_t curr_time; + int64_t curr_tick; + int64_t result; + int64_t abs_ticks; + + curr_time = counter(); + curr_tick = sys_clock_tick_get(); + + abs_ticks = Z_TICK_ABS(t.ticks); + if (abs_ticks < 0) { + /* relative timeout */ + return (t.ticks > (int64_t)COUNTER_SPAN) ? -EINVAL : (curr_time + t.ticks); + } + + /* absolute timeout */ + result = abs_ticks - curr_tick; + + if (result > (int64_t)COUNTER_SPAN) { + return -EINVAL; + } + + return curr_time + result; +} + +int z_nrf_grtc_timer_capture_prepare(int32_t chan) +{ + nrfx_grtc_channel_t user_channel_data = { + .handler = NULL, + .p_context = NULL, + .channel = chan, + }; + nrfx_err_t result; + + IS_CHANNEL_ALLOWED_ASSERT(chan); + + /* Set the CC value to mark channel as not triggered and also to enable it + * (makes CCEN=1). COUNTER_SPAN is used so as not to fire an event unnecessarily + * - it can be assumed that such a large value will never be reached. + */ + result = nrfx_grtc_syscounter_cc_absolute_set(&user_channel_data, COUNTER_SPAN, false); + + if (result != NRFX_SUCCESS) { + return -EPERM; + } + + return 0; +} + +int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) +{ + /* TODO: The implementation should probably go to nrfx_grtc and this + * should be just a wrapper for some nrfx_grtc_syscounter_capture_read. + */ + + uint64_t capt_time; + + IS_CHANNEL_ALLOWED_ASSERT(chan); + + /* TODO: Use `nrfy_grtc_sys_counter_enable_check` when available (NRFX-2480) */ + if (NRF_GRTC->CC[chan].CCEN == GRTC_CC_CCEN_ACTIVE_Enable) { + /* If the channel is enabled (.CCEN), it means that there was no capture + * triggering event. + */ + return -EBUSY; + } + + capt_time = nrfy_grtc_sys_counter_cc_get(NRF_GRTC, chan); + + __ASSERT_NO_MSG(capt_time < COUNTER_SPAN); + + *captured_time = capt_time; + + return 0; +} + +#if defined(CONFIG_NRF_GRTC_SLEEP_ALLOWED) +int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) +{ + nrfx_err_t err_code; + static uint8_t systemoff_channel; + uint64_t now = counter(); + /* Minimum time that ensures valid execution of system-off procedure. */ + uint32_t minimum_latency_us = nrfy_grtc_waketime_get(NRF_GRTC) + + nrfy_grtc_timeout_get(NRF_GRTC) + + CONFIG_NRF_GRTC_SLEEP_MINIMUM_LATENCY; + uint32_t chan; + int ret; + + if (minimum_latency_us > wake_time_us) { + return -EINVAL; + } + k_spinlock_key_t key = k_spin_lock(&lock); + + err_code = nrfx_grtc_channel_alloc(&systemoff_channel); + if (err_code != NRFX_SUCCESS) { + k_spin_unlock(&lock, key); + return -ENOMEM; + } + (void)nrfx_grtc_syscounter_cc_int_disable(systemoff_channel); + ret = compare_set(systemoff_channel, now + wake_time_us, NULL, NULL); + if (ret < 0) { + k_spin_unlock(&lock, key); + return ret; + } + + for (uint32_t grtc_chan_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; + grtc_chan_mask > 0; grtc_chan_mask &= ~BIT(chan)) { + /* Clear all GRTC channels except the systemoff_channel. */ + chan = u32_count_trailing_zeros(grtc_chan_mask); + if (chan != systemoff_channel) { + nrfx_grtc_syscounter_cc_disable(chan); + } + } + + /* Make sure that wake_time_us was not triggered yet. */ + if (nrfy_grtc_sys_counter_compare_event_check(NRF_GRTC, systemoff_channel)) { + k_spin_unlock(&lock, key); + return -EINVAL; + } + + /* This mechanism ensures that stored CC value is latched. */ + uint32_t wait_time = + 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 NRF_GRTC_HAS_CLKSEL + nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFXO); +#endif + k_spin_unlock(&lock, key); + return 0; +} +#endif /* CONFIG_NRF_GRTC_SLEEP_ALLOWED */ + +uint32_t sys_clock_cycle_get_32(void) +{ + k_spinlock_key_t key = k_spin_lock(&lock); + uint32_t ret = (uint32_t)counter(); + + k_spin_unlock(&lock, key); + return ret; +} + +uint64_t sys_clock_cycle_get_64(void) +{ + k_spinlock_key_t key = k_spin_lock(&lock); + uint64_t ret = counter(); + + k_spin_unlock(&lock, key); + return ret; +} + +uint32_t sys_clock_elapsed(void) +{ + if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { + return 0; + } + + return (uint32_t)(counter_sub(counter(), last_count) / CYC_PER_TICK); +} + +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. */ + nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFCLK); +#endif + +#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) + /* SYSCOUNTER needs to be turned off before initialization. */ + nrfy_grtc_sys_counter_set(NRF_GRTC, false); + nrfy_grtc_timeout_set(NRF_GRTC, TIMEOUT); + nrfy_grtc_waketime_set(NRF_GRTC, WAKETIME); +#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ + + IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_grtc_irq_handler, 0, 0); + + err_code = nrfx_grtc_init(0); + if (err_code != NRFX_SUCCESS) { + return -EPERM; + } + +#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) + err_code = nrfx_grtc_syscounter_start(true, &system_clock_channel_data.channel); + if (err_code != NRFX_SUCCESS) { + return err_code == NRFX_ERROR_NO_MEM ? -ENOMEM : -EPERM; + } + if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { + nrfy_grtc_sys_counter_auto_mode_set(NRF_GRTC, false); + } +#else + err_code = nrfx_grtc_channel_alloc(&system_clock_channel_data.channel); + if (err_code != NRFX_SUCCESS) { + return -ENOMEM; + } +#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ + + if (!IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { + grtc_active_set(); + } + + int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; + if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { + system_timeout_set(CYC_PER_TICK); + } + + static const enum nrf_lfclk_start_mode mode = + IS_ENABLED(CONFIG_SYSTEM_CLOCK_NO_WAIT) + ? CLOCK_CONTROL_NRF_LF_START_NOWAIT + : (IS_ENABLED(CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY) + ? CLOCK_CONTROL_NRF_LF_START_AVAILABLE + : CLOCK_CONTROL_NRF_LF_START_STABLE); + + z_nrf_clock_control_lf_on(mode); + + return 0; +} + +void sys_clock_set_timeout(int32_t ticks, bool idle) +{ + ARG_UNUSED(idle); + uint64_t cyc, off, now; + + if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { + return; + } + + ticks = (ticks == K_TICKS_FOREVER) ? MAX_TICKS : MIN(MAX_TICKS, MAX(ticks - 1, 0)); + + now = counter(); + + /* Round up to the next tick boundary */ + off = (now - last_count) + (CYC_PER_TICK - 1); + off = (off / CYC_PER_TICK) * CYC_PER_TICK; + + /* Get the offset with respect to now */ + off -= (now - last_count); + + /* Add the offset to get to the next tick boundary */ + cyc = (uint64_t)ticks * CYC_PER_TICK + off; + + /* Due to elapsed time the calculation above might produce a + * duration that laps the counter. Don't let it. + */ + if (cyc > MAX_CYCLES) { + cyc = MAX_CYCLES; + } + + system_timeout_set(cyc == 0 ? 1 : cyc); +} + +#if defined(CONFIG_NRF_GRTC_TIMER_APP_DEFINED_INIT) +int nrf_grtc_timer_clock_driver_init(void) +{ + return sys_clock_driver_init(); +} +#else +SYS_INIT(sys_clock_driver_init, PRE_KERNEL_2, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY); +#endif diff --git a/include/zephyr/drivers/timer/nrf_grtc_timer.h b/include/zephyr/drivers/timer/nrf_grtc_timer.h new file mode 100644 index 00000000000..172a904fdef --- /dev/null +++ b/include/zephyr/drivers/timer/nrf_grtc_timer.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_TIMER_NRF_GRTC_TIMER_H +#define ZEPHYR_INCLUDE_DRIVERS_TIMER_NRF_GRTC_TIMER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** @brief GRTC timer compare event handler. + * + * Called from GRTC ISR context when processing a compare event. + * + * @param id Compare channel ID. + * + * @param expire_time An actual absolute expiration time set for a compare + * channel. It can differ from the requested target time + * and the difference can be used to determine whether the + * time set was delayed. + * + * @param user_data Pointer to a user context data. + */ +typedef void (*z_nrf_grtc_timer_compare_handler_t)(int32_t id, uint64_t expire_time, + void *user_data); + +/** @brief Allocate GRTC capture/compare channel. + * + * @retval >=0 Non-negative indicates allocated channel ID. + * @retval -ENOMEM if channel cannot be allocated. + */ +int32_t z_nrf_grtc_timer_chan_alloc(void); + +/** @brief Free GRTC capture/compare channel. + * + * @param chan Previously allocated channel ID. + */ +void z_nrf_grtc_timer_chan_free(int32_t chan); + +/** @brief Read current absolute time. + * + * @return Current absolute time. + */ +uint64_t z_nrf_grtc_timer_read(void); + +/** @brief Check COMPARE event state. + * + * @param chan Channel ID. + * + * @retval true The event has been generated. + * @retval false The event has not been generated. + */ +bool z_nrf_grtc_timer_compare_evt_check(int32_t chan); + +/** @brief Get COMPARE event register address. + * + * Address can be used for DPPIC. + * + * @param chan Channel ID. + * + * @return Register address. + */ +uint32_t z_nrf_grtc_timer_compare_evt_address_get(int32_t chan); + +/** @brief Get CAPTURE task register address. + * + * Address can be used for DPPIC. + * + * @param chan Channel ID. + * + * @return Register address. + */ +uint32_t z_nrf_grtc_timer_capture_task_address_get(int32_t chan); + +/** @brief Safely disable compare event interrupt. + * + * Function returns key indicating whether interrupt was already disabled. + * + * @param chan Channel ID. + * + * @return key passed to z_nrf_grtc_timer_compare_int_unlock(). + */ +bool z_nrf_grtc_timer_compare_int_lock(int32_t chan); + +/** @brief Safely enable compare event interrupt. + * + * Event interrupt is conditionally enabled based on @p key. + * + * @param chan Channel ID. + * + * @param key Key returned by z_nrf_grtc_timer_compare_int_lock(). + */ +void z_nrf_grtc_timer_compare_int_unlock(int32_t chan, bool key); + +/** @brief Read compare register value. + * + * @param chan Channel ID. + * + * @retval >=0 Positive is a Value set in the compare register + * @retval -EAGAIN if compare for given channel is not set. + * @retval -EPERM if either channel is unavailable or SYSCOUNTER is not running. + */ +uint64_t z_nrf_grtc_timer_compare_read(int32_t chan); + +/** @brief Set compare channel to given value. + * + * @param chan Channel ID. + * + * @param target_time Absolute target time in ticks. + * + * @param handler User function called in the context of the GRTC interrupt. + * + * @param user_data Data passed to the handler. + * + * @retval 0 if the compare channel was set successfully. + * @retval -EPERM if either channel is unavailable or SYSCOUNTER is not running. + */ +int z_nrf_grtc_timer_set(int32_t chan, uint64_t target_time, + z_nrf_grtc_timer_compare_handler_t handler, void *user_data); + +/** @brief Abort a timer requested with z_nrf_grtc_timer_set(). + * + * If an abort operation is performed too late it is still possible for an event + * to fire. The user can detect a spurious event by comparing absolute time + * provided in callback and a result of z_nrf_grtc_timer_read(). During this + * operation interrupt from that compare channel is disabled. Other interrupts + * are not locked during this operation. + * + * @param chan Channel ID between 1 and CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT. + */ +void z_nrf_grtc_timer_abort(int32_t chan); + +/** @brief Convert system clock time to GRTC ticks. + * + * @p t can be absolute or relative. + * + * @retval >=0 Positive value represents @p t in GRTC tick value. + * @retval -EINVAL if @p t is out of range. + */ +uint64_t z_nrf_grtc_timer_get_ticks(k_timeout_t t); + +/** @brief Prepare channel for timestamp capture. + * + * Use z_nrf_grtc_timer_capture_task_address_get() to determine the register + * address that is used to trigger capture. + * + * @note Capture and compare are mutually exclusive features - they cannot be + * used simultaneously on the same GRTC channel. + * + * @param chan Channel ID. + * + * @retval 0 if the channel was successfully prepared. + * @retval -EPERM if either channel is unavailable or SYSCOUNTER is not running. + */ +int z_nrf_grtc_timer_capture_prepare(int32_t chan); + +/** @brief Read timestamp value captured on the channel. + * + * The @p chan must be prepared using z_nrf_grtc_timer_capture_prepare(). + * + * @param chan Channel ID. + * + * @param captured_time Pointer to store the value. + * + * @retval 0 if the timestamp was successfully caught and read. + * @retval -EBUSY if capturing has not been triggered. + */ +int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time); + +/** @brief Prepare GRTC as a source of wake up event and set the wake up time. + * + * @note Calling this function should be immediately followed by low-power mode enter + * (if it executed successfully). + * + * @param wake_time_us Relative wake up time in microseconds. + * + * @retval 0 if wake up time was successfully set. + * @retval -EPERM if the SYSCOUNTER is not running. + * @retval -ENOMEM if no available GRTC channels were found. + * @retval -EINVAL if @p wake_time_us is too low. + */ +int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us); + +/** + * @brief Initialize the GRTC clock timer driver from an application- + * defined function. + * + * @retval 0 on success. + * @retval -errno Negative error code on failure. + */ +int nrf_grtc_timer_clock_driver_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_DRIVERS_TIMER_NRF_GRTC_TIMER_H */ From 7cd3a07e7b6ae7c6341397f82fc708138e049de7 Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 23 Jan 2024 14:55:47 +0100 Subject: [PATCH 0244/2300] [nrf fromtree] modules: hal_nordic: nrfx: add nRF54L15 peripherals instances Add new TIMER and UARTE instances for nRF54L15. Signed-off-by: Magdalena Pastula (cherry picked from commit 7322abe588bfaef767ade47edd9132d8545249ca) (cherry picked from commit 8b607138a7bf004e2ce76e4bdf178bf42e34248e) --- modules/hal_nordic/nrfx/Kconfig | 60 +++++++++++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 36 ++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index bdca4016ee3..d4efbb7cac8 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -422,6 +422,41 @@ config NRFX_TIMER4 depends on $(dt_nodelabel_has_compat,timer4,$(DT_COMPAT_NORDIC_NRF_TIMER)) select NRFX_TIMER +config NRFX_TIMER00 + bool "TIMER00 driver instance" + depends on $(dt_nodelabel_has_compat,timer00,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER10 + bool "TIMER10 driver instance" + depends on $(dt_nodelabel_has_compat,timer10,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER20 + bool "TIMER20 driver instance" + depends on $(dt_nodelabel_has_compat,timer20,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER21 + bool "TIMER21 driver instance" + depends on $(dt_nodelabel_has_compat,timer21,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER22 + bool "TIMER22 driver instance" + depends on $(dt_nodelabel_has_compat,timer22,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER23 + bool "TIMER23 driver instance" + depends on $(dt_nodelabel_has_compat,timer23,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER24 + bool "TIMER24 driver instance" + depends on $(dt_nodelabel_has_compat,timer24,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + config NRFX_TWI bool @@ -577,6 +612,31 @@ config NRFX_UARTE3 depends on $(dt_nodelabel_has_compat,uart3,$(DT_COMPAT_NORDIC_NRF_UARTE)) select NRFX_UARTE +config NRFX_UARTE00 + bool "UARTE00 driver instance" + depends on $(dt_nodelabel_has_compat,uart00,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE20 + bool "UARTE20 driver instance" + depends on $(dt_nodelabel_has_compat,uart20,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE21 + bool "UARTE21 driver instance" + depends on $(dt_nodelabel_has_compat,uart21,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE22 + bool "UARTE22 driver instance" + depends on $(dt_nodelabel_has_compat,uart22,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE30 + bool "UARTE30 driver instance" + depends on $(dt_nodelabel_has_compat,uart30,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + config NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG bool "UARTE GPIO configuration support" depends on NRFX_UARTE diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 451101c8f4b..5d5746e2c88 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -451,6 +451,27 @@ #ifdef CONFIG_NRFX_TIMER4 #define NRFX_TIMER4_ENABLED 1 #endif +#ifdef CONFIG_NRFX_TIMER00 +#define NRFX_TIMER00_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER10 +#define NRFX_TIMER10_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER20 +#define NRFX_TIMER20_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER21 +#define NRFX_TIMER21_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER22 +#define NRFX_TIMER22_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER23 +#define NRFX_TIMER23_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER24 +#define NRFX_TIMER24_ENABLED 1 +#endif #ifdef CONFIG_NRFX_TWI #define NRFX_TWI_ENABLED 1 @@ -570,6 +591,21 @@ #ifdef CONFIG_NRFX_UARTE3 #define NRFX_UARTE3_ENABLED 1 #endif +#ifdef CONFIG_NRFX_UARTE00 +#define NRFX_UARTE00_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE20 +#define NRFX_UARTE20_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE21 +#define NRFX_UARTE21_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE22 +#define NRFX_UARTE22_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE30 +#define NRFX_UARTE30_ENABLED 1 +#endif #ifdef CONFIG_NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG #define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 1 #endif From e230752c19114850668375e03f7dd8e025d09d8c Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 23 Jan 2024 14:57:47 +0100 Subject: [PATCH 0245/2300] [nrf fromtree] soc: arm: nordic_nrf: add nRF54L15 peripherals instances Add support for nRF54L15 instances of UARTE, TIMER and WTD. Signed-off-by: Magdalena Pastula (cherry picked from commit a6bd4dbc33ea2362d1fed1bc16c99e877ab48813) (cherry picked from commit 947da7646f829893ed807cfe1059402e46115dba) --- soc/arm/nordic_nrf/Kconfig.peripherals | 36 ++++++++++++++++++++ soc/arm/nordic_nrf/validate_base_addresses.c | 14 ++++++++ 2 files changed, 50 insertions(+) diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index 9e637f2661e..5eeff856c96 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -318,6 +318,27 @@ config HAS_HW_NRF_TIMER3 config HAS_HW_NRF_TIMER4 def_bool $(dt_nodelabel_enabled_with_compat,timer4,$(DT_COMPAT_NORDIC_NRF_TIMER)) +config HAS_HW_NRF_TIMER00 + def_bool $(dt_nodelabel_enabled_with_compat,timer00,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER10 + def_bool $(dt_nodelabel_enabled_with_compat,timer10,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER20 + def_bool $(dt_nodelabel_enabled_with_compat,timer20,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER21 + def_bool $(dt_nodelabel_enabled_with_compat,timer21,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER22 + def_bool $(dt_nodelabel_enabled_with_compat,timer22,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER23 + def_bool $(dt_nodelabel_enabled_with_compat,timer23,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER24 + def_bool $(dt_nodelabel_enabled_with_compat,timer24,$(DT_COMPAT_NORDIC_NRF_TIMER)) + config HAS_HW_NRF_TWI0 def_bool $(dt_nodelabel_enabled_with_compat,i2c0,$(DT_COMPAT_NORDIC_NRF_TWI)) @@ -402,6 +423,21 @@ config HAS_HW_NRF_UARTE2 config HAS_HW_NRF_UARTE3 def_bool $(dt_nodelabel_enabled_with_compat,uart3,$(DT_COMPAT_NORDIC_NRF_UARTE)) +config HAS_HW_NRF_UARTE00 + def_bool $(dt_nodelabel_enabled_with_compat,uart00,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE20 + def_bool $(dt_nodelabel_enabled_with_compat,uart20,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE21 + def_bool $(dt_nodelabel_enabled_with_compat,uart21,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE22 + def_bool $(dt_nodelabel_enabled_with_compat,uart22,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE30 + def_bool $(dt_nodelabel_enabled_with_compat,uart30,$(DT_COMPAT_NORDIC_NRF_UARTE)) + config HAS_HW_NRF_USBD def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_USBD)) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index ee440c3252c..9daa820efa9 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -198,10 +198,22 @@ CHECK_DT_REG(timer1, NRF_TIMER1); CHECK_DT_REG(timer2, NRF_TIMER2); CHECK_DT_REG(timer3, NRF_TIMER3); CHECK_DT_REG(timer4, NRF_TIMER4); +CHECK_DT_REG(timer00, NRF_TIMER00); +CHECK_DT_REG(timer10, NRF_TIMER10); +CHECK_DT_REG(timer20, NRF_TIMER20); +CHECK_DT_REG(timer21, NRF_TIMER21); +CHECK_DT_REG(timer22, NRF_TIMER22); +CHECK_DT_REG(timer23, NRF_TIMER23); +CHECK_DT_REG(timer24, NRF_TIMER24); CHECK_UART_REG(uart0, 0); CHECK_DT_REG(uart1, NRF_UARTE1); CHECK_DT_REG(uart2, NRF_UARTE2); CHECK_DT_REG(uart3, NRF_UARTE3); +CHECK_DT_REG(uart00, NRF_UARTE00); +CHECK_DT_REG(uart20, NRF_UARTE20); +CHECK_DT_REG(uart21, NRF_UARTE21); +CHECK_DT_REG(uart22, NRF_UARTE22); +CHECK_DT_REG(uart30, NRF_UARTE30); CHECK_DT_REG(uicr, NRF_UICR); CHECK_DT_REG(usbd, NRF_USBD); CHECK_DT_REG(usbreg, NRF_USBREGULATOR); @@ -209,6 +221,8 @@ CHECK_DT_REG(vmc, NRF_VMC); CHECK_DT_REG(wdt, NRF_WDT0); /* this should be the same node as wdt0 */ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); +CHECK_DT_REG(wdt30, NRF_WDT30); +CHECK_DT_REG(wdt31, NRF_WDT31); /* nRF51/nRF52-specific addresses */ #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) From 57458404af37b3703ba7e1725b04090727178619 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Fri, 19 Jan 2024 13:21:53 +0100 Subject: [PATCH 0246/2300] [nrf fromtree] dts: bindings: clock: add nordic,nrf-lfxo To describe the low frequency crystal oscillator present in some nRF series. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit e65d4141e618ebe651b7e6bfa5f58473bde21e9d) (cherry picked from commit 7b60671260e30d930e5d62db1dc72318efbbe7d1) --- dts/bindings/clock/nordic,nrf-lfxo.yaml | 58 +++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 dts/bindings/clock/nordic,nrf-lfxo.yaml diff --git a/dts/bindings/clock/nordic,nrf-lfxo.yaml b/dts/bindings/clock/nordic,nrf-lfxo.yaml new file mode 100644 index 00000000000..f0090ff4a81 --- /dev/null +++ b/dts/bindings/clock/nordic,nrf-lfxo.yaml @@ -0,0 +1,58 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic nRF low-frequency crystal oscillator + +compatible: "nordic,nrf-lfxo" + +include: [fixed-clock.yaml] + +properties: + clock-frequency: + const: 32768 + + load-capacitors: + type: string + enum: + - "internal" + - "external" + description: | + Type of load capacitors connected to the crystal. If not specified, + adjustments may still happen when the device trimming happens during + system initialization. + + load-capacitance-femtofarad: + type: int + enum: + - 4000 + - 4500 + - 5000 + - 5500 + - 6000 + - 6500 + - 7000 + - 7500 + - 8000 + - 8500 + - 9000 + - 9500 + - 10000 + - 10500 + - 11000 + - 11500 + - 12000 + - 12500 + - 13000 + - 13500 + - 14000 + - 14500 + - 15000 + - 15500 + - 16000 + - 16500 + - 17000 + - 17500 + - 18000 + description: | + Load capacitance in femtofarads. This property is only used when + load-capacitors is set to "internal". From 65373fec37eaf992d9d25b8049a4574bc39c933c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Fri, 19 Jan 2024 13:39:19 +0100 Subject: [PATCH 0247/2300] [nrf fromtree] dts: bindings: clock: add nordic,nrf-hfxo: Add bindings for the nRF HFXO present in some nRF SoCs. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 32c7cd551a2e8c95143818ab12a3d593482b7300) (cherry picked from commit c21106567025850d8f5ade4bb9fb2bf724b9821e) --- dts/bindings/clock/nordic,nrf-hfxo.yaml | 82 +++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 dts/bindings/clock/nordic,nrf-hfxo.yaml diff --git a/dts/bindings/clock/nordic,nrf-hfxo.yaml b/dts/bindings/clock/nordic,nrf-hfxo.yaml new file mode 100644 index 00000000000..dc99c67e5cc --- /dev/null +++ b/dts/bindings/clock/nordic,nrf-hfxo.yaml @@ -0,0 +1,82 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic nRF high-frequency crystal oscillator + +compatible: "nordic,nrf-hfxo" + +include: [fixed-clock.yaml] + +properties: + clock-frequency: + const: 32000000 + + load-capacitors: + type: string + enum: + - "internal" + - "external" + description: | + Type of load capacitors connected to the crystal. If not specified, + adjustments may still happen when the device trimming happens during + system initialization. + + load-capacitance-femtofarad: + type: int + enum: + - 4000 + - 4250 + - 4500 + - 4750 + - 5000 + - 5250 + - 5500 + - 5750 + - 6000 + - 6250 + - 6500 + - 6750 + - 7000 + - 7250 + - 7500 + - 7750 + - 8000 + - 8250 + - 8500 + - 8750 + - 9000 + - 9250 + - 9500 + - 9750 + - 10000 + - 10250 + - 10500 + - 10750 + - 11000 + - 11250 + - 11500 + - 11750 + - 12000 + - 12250 + - 12500 + - 12750 + - 13000 + - 13250 + - 13500 + - 13750 + - 14000 + - 14250 + - 14500 + - 14750 + - 15000 + - 15250 + - 15500 + - 15750 + - 16000 + - 16250 + - 16500 + - 16750 + - 17000 + description: | + Load capacitance in femtofarads. This property is only used when + load-capacitors is set to "internal". From 983999dbeafb0339bdbe105a4cbc37b31c928f61 Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Mon, 11 Dec 2023 17:26:19 +0100 Subject: [PATCH 0248/2300] [nrf fromtree] dts: arm: nordic: add support for Nordic nRF54L15 Add dts files for nRF54L15 chip. Signed-off-by: Witold Lukasik (cherry picked from commit 0b2ed9888afc6329f015d4a6e6ddc6521297d509) (cherry picked from commit dec064215a5174fe38f912d7feab862c4af144e2) --- dts/arm/nordic/nrf54l15_cpuapp.dtsi | 90 ++++ .../nordic/nrf54l15_cpuapp_peripherals.dtsi | 412 ++++++++++++++++++ dts/arm/nordic/nrf54l_common.dtsi | 33 ++ 3 files changed, 535 insertions(+) create mode 100644 dts/arm/nordic/nrf54l15_cpuapp.dtsi create mode 100644 dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi create mode 100644 dts/arm/nordic/nrf54l_common.dtsi diff --git a/dts/arm/nordic/nrf54l15_cpuapp.dtsi b/dts/arm/nordic/nrf54l15_cpuapp.dtsi new file mode 100644 index 00000000000..7e90c8b1213 --- /dev/null +++ b/dts/arm/nordic/nrf54l15_cpuapp.dtsi @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +/ { + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu: cpu@0 { + clock-frequency = ; + device_type = "cpu"; + compatible = "arm,cortex-m33f"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + itm: itm@e0000000 { + compatible = "arm,armv8m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; + }; + }; + + 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 { + uicr: uicr@ffd000 { + compatible = "nordic,nrf-uicr"; + reg = <0xffd000 0x1000>; + }; + + ficr: ficr@ffc000 { + compatible = "nordic,nrf-ficr"; + reg = <0xffc000 0x1000>; + }; + + sram0: memory@20000000 { + compatible = "mmio-sram"; + reg = <0x20000000 DT_SIZE_K(256)>; + }; + + peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + + /* Common nRF54L15 peripheral description */ + #include "nrf54l15_cpuapp_peripherals.dtsi" + }; + }; +}; + +&nvic { + arm,num-irq-priority-bits = <3>; +}; + +&rram_controller { + rram0: rram@0 { + /* + * "1524 KB non-volatile memory (RRAM) and 256 KB RAM" + * -- Product Specification + * NB: 1524 = 1.5 * 1024 - 12 + */ + reg = <0x0 DT_SIZE_K(1524)>; + }; +}; + +/* Disable by default to use GRTC */ +&systick { + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi new file mode 100644 index 00000000000..786c21ab215 --- /dev/null +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -0,0 +1,412 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +dppic00: dppic@42000 { + compatible = "nordic,nrf-dppic"; + reg = <0x42000 0x808>; + 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>; + status = "disabled"; +}; + +uart00: uart@4a000 { + compatible = "nordic,nrf-uarte"; + reg = <0x4a000 0x1000>; + interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; + 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>; + prescaler = <0>; +}; + +dppic10: dppic@82000 { + compatible = "nordic,nrf-dppic"; + reg = <0x82000 0x808>; + 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>; + 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; + + ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; +}; + +dppic20: dppic@c2000 { + compatible = "nordic,nrf-dppic"; + reg = <0xc2000 0x808>; + status = "disabled"; +}; + +i2c20: i2c@c6000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + clock-frequency = ; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +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>; + status = "disabled"; +}; + +uart20: uart@c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +i2c21: i2c@c7000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + clock-frequency = ; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +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>; + status = "disabled"; +}; + +uart21: uart@c7000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +i2c22: i2c@c8000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc8000 0x1000>; + clock-frequency = ; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +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>; + status = "disabled"; +}; + +uart22: uart@c8000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +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>; +}; + +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>; + interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; + 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>; + owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; + interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +dppic30: dppic@102000 { + compatible = "nordic,nrf-dppic"; + reg = <0x102000 0x808>; + status = "disabled"; +}; + +i2c30: i2c@104000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + clock-frequency = ; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +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>; + status = "disabled"; +}; + +uart30: uart@104000 { + compatible = "nordic,nrf-uarte"; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +wdt30: watchdog@108000 { + compatible = "nordic,nrf-wdt"; + reg = <0x108000 0x620>; + interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; + +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>; + interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + instance = <30>; +}; + +clock: clock@10e000 { + compatible = "nordic,nrf-clock"; + reg = <0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi new file mode 100644 index 00000000000..4fb7768bd3f --- /dev/null +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include "nrf_common.dtsi" + +/ { + soc { + rram_controller: rram-controller@5004b000 { + compatible = "nordic,rram-controller"; + reg = <0x5004b000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + interrupts = <75 NRF_DEFAULT_IRQ_PRIORITY>; + rram0: rram@0 { + compatible = "soc-nv-flash"; + erase-block-size = <4096>; + write-block-size = <1>; + }; + }; + }; + + chosen { + zephyr,flash-controller = &rram_controller; + }; + + sw_pwm: sw-pwm { + generator = <&timer21>; + }; +}; From d9d6d3c83a37b9cb42b700f0bda2d651c7cb08c4 Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Mon, 11 Dec 2023 17:30:04 +0100 Subject: [PATCH 0249/2300] [nrf fromtree] soc: arm: nordic_nrf: add source code for validating rram partitions RRAM is a part of nRF54L15 SOC. Signed-off-by: Witold Lukasik (cherry picked from commit a5eeb6d6db3af44935efb2c4b5f3c9240c19d3d9) (cherry picked from commit 2b728821cc36a847b285b3c65b78fd042d375e01) --- soc/arm/nordic_nrf/validate_rram_partitions.c | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 soc/arm/nordic_nrf/validate_rram_partitions.c diff --git a/soc/arm/nordic_nrf/validate_rram_partitions.c b/soc/arm/nordic_nrf/validate_rram_partitions.c new file mode 100644 index 00000000000..f35d9cf73f3 --- /dev/null +++ b/soc/arm/nordic_nrf/validate_rram_partitions.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#define PAIR__(f, sep, arg_first, ...) FOR_EACH_FIXED_ARG(f, sep, arg_first, __VA_ARGS__) +#define PAIR_(f, sep, args_to_expand) PAIR__(f, sep, args_to_expand) +#define PAIR(n, f, sep, ...) PAIR_(f, sep, GET_ARGS_LESS_N(n, __VA_ARGS__)) + +/** + * @brief Call a macro on every unique pair of the given variadic arguments. + * + * For example, FOR_EACH_PAIR(f, (,), 1, 2, 3, 4) should expand to: + * + * f(2, 1) , f(3, 1) , f(4, 1) , f(3, 2) , f(4, 2) , f(4, 3) + * + * @param f Macro to call. Must accept two arguments. + * @param sep Separator between macro calls. Must be in parentheses. + * + * @see FOR_EACH + */ +#define FOR_EACH_PAIR(f, sep, ...) \ + LISTIFY(NUM_VA_ARGS_LESS_1(__VA_ARGS__), PAIR, sep, f, sep, __VA_ARGS__) + +/** + * @brief Get a node's non-secure register block start address. + * + * @param node_id Node identifier. + */ +#define REG_ADDR_NS(node_id) (DT_REG_ADDR(node_id) & 0xEFFFFFFFUL) + +/** + * @brief Get a node's non-secure register block end address. + * + * @param node_id Node identifier. + */ +#define REG_END_NS(node_id) (REG_ADDR_NS(node_id) + DT_REG_SIZE(node_id)) + +/* clang-format off */ + +#define RRAM_BASE REG_ADDR_NS(DT_NODELABEL(rram0)) +#define RRAM_CONTROLLER DT_NODELABEL(rram_controller) + +#if !DT_NODE_EXISTS(RRAM_CONTROLLER) +#error "Missing \"rram-controller\" node" +#endif + +#define CHECK_RRAM_NODE_COMPATIBLE(node_id) \ + BUILD_ASSERT(DT_NODE_HAS_COMPAT(node_id, soc_nv_flash), \ + "Missing compatible \"soc-nv-flash\" from " DT_NODE_FULL_NAME(node_id) \ + " (required for all children of " DT_NODE_PATH(RRAM_CONTROLLER) ")") + +#define CHECK_RRAM_PARTITION_WITHIN_PARENT(node_id) \ + BUILD_ASSERT(RRAM_BASE + REG_ADDR_NS(node_id) >= REG_ADDR_NS(DT_GPARENT(node_id)) && \ + RRAM_BASE + REG_END_NS(node_id) <= REG_END_NS(DT_GPARENT(node_id)), \ + DT_NODE_FULL_NAME(node_id) " is not fully contained within its parent " \ + DT_NODE_PATH(DT_GPARENT(node_id))) + +#define CHECK_NODES_NON_OVERLAPPING(node_id_1, node_id_2) \ + BUILD_ASSERT(REG_ADDR_NS(node_id_1) >= REG_END_NS(node_id_2) || \ + REG_ADDR_NS(node_id_2) >= REG_END_NS(node_id_1), \ + DT_NODE_PATH(node_id_1) " and " DT_NODE_PATH(node_id_2) " are overlapping") + +/* Retrieve all RRAM nodes that are children of "rram-controller". */ +#define COMMA(x) x, +#define RRAM_NODES_LIST LIST_DROP_EMPTY(DT_FOREACH_CHILD(RRAM_CONTROLLER, COMMA)) + +#if !IS_EMPTY(RRAM_NODES_LIST) + +/* Check that every RRAM node matches the "soc-nv-flash" compatible. */ +FOR_EACH(CHECK_RRAM_NODE_COMPATIBLE, (;), RRAM_NODES_LIST); + +/* Check that no two RRAM nodes are overlapping. */ +FOR_EACH_PAIR(CHECK_NODES_NON_OVERLAPPING, (;), RRAM_NODES_LIST); + +#endif + +/* Retrieve all RRAM partitions by looking for "fixed-partitions" compatibles in each RRAM node. */ +#define PARTITION_(x) \ + COND_CODE_1(DT_NODE_HAS_COMPAT(x, fixed_partitions), (DT_FOREACH_CHILD(x, COMMA)), ()) +#define PARTITION(x, ...) DT_FOREACH_CHILD_STATUS_OKAY(x, PARTITION_) +#define RRAM_PARTITION_LIST LIST_DROP_EMPTY(DT_FOREACH_CHILD_VARGS(RRAM_CONTROLLER, PARTITION)) + +#if !IS_EMPTY(RRAM_PARTITION_LIST) + +/* Check that every RRAM partition is within the bounds of its parent RRAM node. */ +FOR_EACH(CHECK_RRAM_PARTITION_WITHIN_PARENT, (;), RRAM_PARTITION_LIST); + +/* Check that no two RRAM partitions are overlapping. */ +FOR_EACH_PAIR(CHECK_NODES_NON_OVERLAPPING, (;), RRAM_PARTITION_LIST); + +#endif From bbb278ef8621d17fe48a18ba487b3647efc0fbb9 Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Mon, 11 Dec 2023 17:28:06 +0100 Subject: [PATCH 0250/2300] [nrf fromtree] soc: arm: nordic_nrf: add support for Nordic nrf54l family Add soc files for new Nordic family. Signed-off-by: Witold Lukasik (cherry picked from commit 1d9f70226098da5eb849dbaf4f4f9eddd710a86f) (cherry picked from commit 7e57cadfe6fbdabedd2d20a699f0386740fc5925) --- soc/arm/nordic_nrf/nrf54l/CMakeLists.txt | 12 ++ .../Kconfig.defconfig.nrf54l15_enga_cpuapp | 18 +++ .../nrf54l/Kconfig.defconfig.series | 19 +++ soc/arm/nordic_nrf/nrf54l/Kconfig.series | 13 ++ soc/arm/nordic_nrf/nrf54l/Kconfig.soc | 70 +++++++++ soc/arm/nordic_nrf/nrf54l/soc.c | 136 ++++++++++++++++++ soc/arm/nordic_nrf/nrf54l/soc.h | 21 +++ 7 files changed, 289 insertions(+) create mode 100644 soc/arm/nordic_nrf/nrf54l/CMakeLists.txt create mode 100644 soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuapp create mode 100644 soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.series create mode 100644 soc/arm/nordic_nrf/nrf54l/Kconfig.series create mode 100644 soc/arm/nordic_nrf/nrf54l/Kconfig.soc create mode 100644 soc/arm/nordic_nrf/nrf54l/soc.c create mode 100644 soc/arm/nordic_nrf/nrf54l/soc.h diff --git a/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt b/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt new file mode 100644 index 00000000000..914aad289ef --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources( + soc.c + ../validate_rram_partitions.c) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") + +if (CONFIG_ELV_GRTC_LFXO_ALLOWED) + message(WARNING "WARNING! ELV mode feature is EXPERIMENTAL and may brick your device!") +endif() diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuapp b/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuapp new file mode 100644 index 00000000000..d19df604c02 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuapp @@ -0,0 +1,18 @@ +# Nordic Semiconductor nRF54L15 MCU + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54L15_ENGA_CPUAPP + +config SOC + string + default "nrf54l15_cpuapp" + +config NUM_IRQS + default 271 + +config IEEE802154_NRF5 + default IEEE802154 + +endif # SOC_NRF54L15_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.series new file mode 100644 index 00000000000..6c0a5bc606d --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.series @@ -0,0 +1,19 @@ +# Nordic Semiconductor nRF54L MCU line + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_NRF54LX + +rsource "Kconfig.defconfig.nrf54l*" + +config SOC_SERIES + default "nrf54l" + +config CORTEX_M_SYSTICK + default !NRF_GRTC_TIMER + +config CACHE_NRF_CACHE + default y if EXTERNAL_CACHE + +endif # SOC_SERIES_NRF54LX diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.series b/soc/arm/nordic_nrf/nrf54l/Kconfig.series new file mode 100644 index 00000000000..a9367a0bf36 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.series @@ -0,0 +1,13 @@ +# Nordic Semiconductor nRF54L MCU line + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_NRF54LX + bool "Nordic Semiconductor nRF54L series MCU" + select HAS_NRFX + select HAS_NORDIC_DRIVERS + select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE + select SOC_FAMILY_NRF + help + Enable support for nRF54L MCU series diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc new file mode 100644 index 00000000000..c42c8cfc9b3 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc @@ -0,0 +1,70 @@ +# Nordic Semiconductor nRF54 MCU line + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_NRF54LX + +config SOC_NRF54L15 + bool "NRF54L15" + +config SOC_NRF54L15_ENGA + bool "NRF54L15 ENGA" + select SOC_NRF54L15 + +config SOC_NRF54L15_ENGA_CPUAPP + bool "NRF54L15 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_NRF54L15_ENGA + +config SOC_NRF54LX_SKIP_CLOCK_CONFIG + bool "Skip clock frequency configuration in system initialization" + help + With this option, the CPU clock frequency is not set during system initialization. + The CPU runs with the default, hardware-selected frequency. + +config SOC_NRF_FORCE_CONSTLAT + bool "Force constant-latency mode" + help + In constant latency mode the CPU wakeup latency and the PPI task response + will be constant and kept at a minimum. This is secured by forcing a set + 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_VREG_MAIN_DCDC + bool "NRF54L DC/DC converter." + help + To enable, an inductor must be connected to the DC/DC converter pin. + +config SOC_NRF54L_NORMAL_VOLTAGE_MODE + bool "NRF54L Normal Voltage Mode." + +config SOC_NRF54L_GLITCHDET_WORKAROUND + bool "Workaround that disables glitch detector" + default y + help + Temporary workaround - disabling glitch detector to limit power consumption. + +if NRF_GRTC_TIMER + +config ELV_GRTC_LFXO_ALLOWED + bool + depends on NRF_GRTC_SLEEP_ALLOWED + select EXPERIMENTAL + help + This feature allows using ELV mode when GRTC operates with the LFXO as + a low-frequency clock source. The LFXO is automatically activated when + preparing to system-off. + WARNING! This feature is EXPERIMENTAL and may brick your device! + +endif # NRF_GRTC_TIMER + +endif # SOC_SERIES_NRF54LX diff --git a/soc/arm/nordic_nrf/nrf54l/soc.c b/soc/arm/nordic_nrf/nrf54l/soc.c new file mode 100644 index 00000000000..a7b286fa048 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54l/soc.c @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief System/hardware module for Nordic Semiconductor nRF54L family processor + * + * This module provides routines to initialize and support board-level hardware + * for the Nordic Semiconductor nRF54L family processor. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); + +#define LFXO_NODE DT_NODELABEL(lfxo) +#define HFXO_NODE DT_NODELABEL(hfxo) + +static int nordicsemi_nrf54l_init(void) +{ + /* Update the SystemCoreClock global variable with current core clock + * retrieved from hardware state. + */ + SystemCoreClockUpdate(); + + /* Enable ICACHE */ + sys_cache_instr_enable(); + + if (IS_ENABLED(CONFIG_SOC_NRF54L_GLITCHDET_WORKAROUND)) { + nrf_glitchdet_enable_set(NRF_GLITCHDET, false); + } + +#if DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, internal) + uint32_t xosc32ktrim = NRF_FICR->XOSC32KTRIM; + + uint32_t offset_k = + (xosc32ktrim & FICR_XOSC32KTRIM_OFFSET_Msk) >> FICR_XOSC32KTRIM_OFFSET_Pos; + + uint32_t slope_field_k = + (xosc32ktrim & FICR_XOSC32KTRIM_SLOPE_Msk) >> FICR_XOSC32KTRIM_SLOPE_Pos; + uint32_t slope_mask_k = FICR_XOSC32KTRIM_SLOPE_Msk >> FICR_XOSC32KTRIM_SLOPE_Pos; + uint32_t slope_sign_k = (slope_mask_k - (slope_mask_k >> 1)); + int32_t slope_k = (int32_t)(slope_field_k ^ slope_sign_k) - (int32_t)slope_sign_k; + + /* As specified in the nRF54L15 PS: + * CAPVALUE = round( (CAPACITANCE - 4) * (FICR->XOSC32KTRIM.SLOPE + 0.765625 * 2^9)/(2^9) + * + FICR->XOSC32KTRIM.OFFSET/(2^6) ); + * where CAPACITANCE is the desired capacitor value in pF, holding any + * value between 4 pF and 18 pF in 0.5 pF steps. + */ + uint32_t mid_val = + (((DT_PROP(LFXO_NODE, load_capacitance_femtofarad) * 2UL) / 1000UL - 8UL) * + (uint32_t)(slope_k + 392)) + (offset_k << 4UL); + uint32_t capvalue_k = mid_val >> 10UL; + + /* Round. */ + if ((mid_val % 1024UL) >= 512UL) { + capvalue_k++; + } + nrf_oscillators_lfxo_cap_set(NRF_OSCILLATORS, (nrf_oscillators_lfxo_cap_t)capvalue_k); +#elif DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, external) + nrf_oscillators_lfxo_cap_set(NRF_OSCILLATORS, (nrf_oscillators_lfxo_cap_t)0); +#endif + +#if DT_ENUM_HAS_VALUE(HFXO_NODE, load_capacitors, internal) + uint32_t xosc32mtrim = NRF_FICR->XOSC32MTRIM; + /* The SLOPE field is in the two's complement form, hence this special + * handling. Ideally, it would result in just one SBFX instruction for + * extracting the slope value, at least gcc is capable of producing such + * output, but since the compiler apparently tries first to optimize + * additions and subtractions, it generates slightly less than optimal + * code. + */ + uint32_t slope_field = + (xosc32mtrim & FICR_XOSC32MTRIM_SLOPE_Msk) >> FICR_XOSC32MTRIM_SLOPE_Pos; + uint32_t slope_mask = FICR_XOSC32MTRIM_SLOPE_Msk >> FICR_XOSC32MTRIM_SLOPE_Pos; + uint32_t slope_sign = (slope_mask - (slope_mask >> 1)); + int32_t slope_m = (int32_t)(slope_field ^ slope_sign) - (int32_t)slope_sign; + uint32_t offset_m = + (xosc32mtrim & FICR_XOSC32MTRIM_OFFSET_Msk) >> FICR_XOSC32MTRIM_OFFSET_Pos; + /* As specified in the nRF54L15 PS: + * CAPVALUE = (((CAPACITANCE-5.5)*(FICR->XOSC32MTRIM.SLOPE+791)) + + * FICR->XOSC32MTRIM.OFFSET<<2)>>8; + * where CAPACITANCE is the desired total load capacitance value in pF, + * holding any value between 4.0 pF and 17.0 pF in 0.25 pF steps. + */ + uint32_t capvalue = + (((((DT_PROP(HFXO_NODE, load_capacitance_femtofarad) * 4UL) / 1000UL) - 22UL) * + (uint32_t)(slope_m + 791) / 4UL) + (offset_m << 2UL)) >> 8UL; + + nrf_oscillators_hfxo_cap_set(NRF_OSCILLATORS, true, capvalue); +#elif DT_ENUM_HAS_VALUE(HFXO_NODE, load_capacitors, external) + nrf_oscillators_hfxo_cap_set(NRF_OSCILLATORS, false, 0); +#endif + + if (IS_ENABLED(CONFIG_SOC_NRF_FORCE_CONSTLAT)) { + nrf_power_task_trigger(NRF_POWER, NRF_POWER_TASK_CONSTLAT); + } + + if (IS_ENABLED(CONFIG_SOC_NRF54L_VREG_MAIN_DCDC)) { + nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_MAIN, true); + } + + 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 */ + + return 0; +} + +void arch_busy_wait(uint32_t time_us) +{ + nrfx_coredep_delay_us(time_us); +} + +SYS_INIT(nordicsemi_nrf54l_init, PRE_KERNEL_1, 0); diff --git a/soc/arm/nordic_nrf/nrf54l/soc.h b/soc/arm/nordic_nrf/nrf54l/soc.h new file mode 100644 index 00000000000..721e9336989 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54l/soc.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file SoC configuration macros for the Nordic Semiconductor NRF54L family processors. + */ + +#ifndef _NORDICSEMI_NRF54L_SOC_H_ +#define _NORDICSEMI_NRF54L_SOC_H_ + +#define __ICACHE_PRESENT 1 + +#include + +#define FLASH_PAGE_ERASE_MAX_TIME_US 8000UL +#define FLASH_PAGE_MAX_CNT 381UL + +#endif /* _NORDICSEMI_NRF54L_SOC_H_ */ From 034fc6c356a788687b2da7ea7adeb355c19329ef Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Mon, 11 Dec 2023 17:37:22 +0100 Subject: [PATCH 0251/2300] [nrf fromtree] modules: hal_nordic: nrfx: add support for nRF54L15 SOC Add config files for nRF54L15. Signed-off-by: Witold Lukasik (cherry picked from commit 04e4e6e5e97ff1d72959e46a0f26d727aaeaecd5) (cherry picked from commit 171aa8a3e2e595521771f26b15be11d53efc34c2) --- modules/hal_nordic/nrfx/CMakeLists.txt | 13 + modules/hal_nordic/nrfx/nrfx_config.h | 2 + .../nrfx_config_nrf54l15_enga_application.h | 1538 +++++++++++++++++ 3 files changed, 1553 insertions(+) create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 2e809c52b79..20740683a44 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -66,6 +66,7 @@ zephyr_library_sources_ifdef(CONFIG_SOC_NRF52833 ${MDK_DIR}/system_nrf5283 zephyr_library_sources_ifdef(CONFIG_SOC_NRF52840 ${MDK_DIR}/system_nrf52840.c) 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_NRF54LX ${MDK_DIR}/system_nrf54l.c) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF91X ${MDK_DIR}/system_nrf91.c) zephyr_library_sources(nrfx_glue.c) @@ -135,3 +136,15 @@ if(DEFINED uicr_path) zephyr_library_compile_definitions(CONFIG_GPIO_AS_PINRESET) endif() endif() + +if(CONFIG_SOC_NRF54L15) + 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}") +endif() + +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_CLOCK_CONFIGURATION) + +if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) + zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib_lumos.c) +endif() diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 5d5746e2c88..543329b4a30 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -698,6 +698,8 @@ #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) #include +#elif defined(NRF54L15_ENGA_XXAA) && defined(NRF_APPLICATION) + #include #else #error "Unknown device." #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 new file mode 100644 index 00000000000..46b0aa0eff7 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h @@ -0,0 +1,1538 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54L15_APPLICATION_H__ +#define NRFX_CONFIG_NRF54L15_APPLICATION_H__ + +#ifndef NRFX_CONFIG_H__ +#error "This file should not be included directly. Include nrfx_config.h instead." +#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 0 +#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 0 +#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 0 +#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 0 +#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 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 + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_DPPI_CONFIG_LOG_LEVEL +#define NRFX_DPPI_CONFIG_LOG_LEVEL 0 +#endif + +/** + * @brief NRFX_EGU_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_EGU_ENABLED +#define NRFX_EGU_ENABLED 0 +#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_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 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_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 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 0 +#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 0 +#endif + +/** + * @brief NRFX_GRTC_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_GRTC_ENABLED +#define NRFX_GRTC_ENABLED 0 +#endif + +/** + * @brief GRTC CC channels ownership mask. + */ +#ifndef NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) +#if DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), owned_channels) +#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ + BIT(DT_PROP_BY_IDX(node_id, prop, idx)) +#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ + (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ + (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ + NRFX_CONFIG_BIT_DT, (|))), \ + (0))) + +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ + (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ + ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ + (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ + DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) + +#if ((NRFX_CONFIG_GRTC_MASK_DT(owned_channels) | \ + NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) != NRFX_CONFIG_GRTC_MASK_DT(owned_channels)) +#error "`child-owned-channels` property must be a subset of `owned-channels` property" +#endif +#else +#error "property `owned-channels` does not exist" +#endif /* DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), owned_channels) */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ + +#endif /* NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK */ + +/** + * @brief NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY 0 +#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 0 +#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 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 0 +#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 0 +#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 0 +#endif + +/** + * @brief NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID + * + * Boolean. Accepted values 0 and 1. + */ +#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 0 +#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 0 +#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 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 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_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_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 0 +#endif + +/** + * @brief NRFX_PWM_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_PWM_ENABLED +#define NRFX_PWM_ENABLED 0 +#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_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 0 +#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 0 +#endif + +/** + * @brief NRFX_QDEC_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_QDEC_ENABLED +#define NRFX_QDEC_ENABLED 0 +#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_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 0 +#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 0 +#endif + +/** + * @brief NRFX_RTC_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_RTC_ENABLED +#define NRFX_RTC_ENABLED 0 +#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_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 0 +#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 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 0 +#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 0 +#endif + +/** + * @brief NRFX_SPI_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPI_ENABLED +#define NRFX_SPI_ENABLED 0 +#endif + +/** + * @brief NRFX_SPI00_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPI00_ENABLED +#define NRFX_SPI00_ENABLED 0 +#endif + +/** + * @brief NRFX_SPI20_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPI20_ENABLED +#define NRFX_SPI20_ENABLED 0 +#endif + +/** + * @brief NRFX_SPI21_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPI21_ENABLED +#define NRFX_SPI21_ENABLED 0 +#endif + +/** + * @brief NRFX_SPI22_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPI22_ENABLED +#define NRFX_SPI22_ENABLED 0 +#endif + +/** + * @brief NRFX_SPI30_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPI30_ENABLED +#define NRFX_SPI30_ENABLED 0 +#endif + +/** + * @brief NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0 Maximum: 7 + */ +#ifndef NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY 0 +#endif + +/** + * @brief NRFX_SPI_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPI_CONFIG_LOG_ENABLED +#define NRFX_SPI_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SPI_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SPI_CONFIG_LOG_LEVEL +#define NRFX_SPI_CONFIG_LOG_LEVEL 0 +#endif + +/** + * @brief NRFX_SPIM_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPIM_ENABLED +#define NRFX_SPIM_ENABLED 0 +#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_SPIM_EXTENDED_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPIM_EXTENDED_ENABLED +#define NRFX_SPIM_EXTENDED_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 0 +#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 0 +#endif + +/** + * @brief NRFX_SPIS_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_SPIS_ENABLED +#define NRFX_SPIS_ENABLED 0 +#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_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 0 +#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 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 0 +#endif + +/** + * @brief NRFX_TIMER_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_TIMER_ENABLED +#define NRFX_TIMER_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_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 0 +#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 0 +#endif + +/** + * @brief NRFX_TWIM_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_TWIM_ENABLED +#define NRFX_TWIM_ENABLED 0 +#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_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 0 +#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 0 +#endif + +/** + * @brief NRFX_TWIS_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_TWIS_ENABLED +#define NRFX_TWIS_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS00_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_TWIS00_ENABLED +#define NRFX_TWIS00_ENABLED 0 +#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_TWIS_ASSUME_INIT_AFTER_RESET_ONLY + * + * 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 + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_TWIS_NO_SYNC_MODE +#define NRFX_TWIS_NO_SYNC_MODE 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 0 +#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_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 0 +#endif + +/** + * @brief NRFX_UARTE_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_UARTE_ENABLED +#define NRFX_UARTE_ENABLED 0 +#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_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 0 +#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 0 +#endif + +/** + * @brief NRFX_WDT_ENABLED + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_WDT_ENABLED +#define NRFX_WDT_ENABLED 0 +#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 + +/** + * @brief NRFX_WDT_CONFIG_NO_IRQ + * + * Boolean. Accepted values 0 and 1. + */ +#ifndef NRFX_WDT_CONFIG_NO_IRQ +#define NRFX_WDT_CONFIG_NO_IRQ 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 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 0 +#endif + +#endif /* NRFX_CONFIG_NRF54L15_APPLICATION_H__ */ From 9dc7ca71bea83594f529f7e9f28aed035052e35f Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Mon, 11 Dec 2023 17:43:27 +0100 Subject: [PATCH 0252/2300] [nrf fromtree] boards: arm: add Nordic nrf54l15dk_nrf54l15 Add board files for nRF54L15 DK. Signed-off-by: Witold Lukasik (cherry picked from commit 4a095bfb356c8d67c7ce828b8d7176ce63e747ad) (cherry picked from commit 64bccc5b90cfadb3981aaaba02ec0f5a9cd1877e) --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board | 6 + .../nrf54l15pdk_nrf54l15/Kconfig.defconfig | 12 ++ boards/arm/nrf54l15pdk_nrf54l15/board.cmake | 4 + .../doc/img/nrf54l15pdk_nrf54l15.webp | Bin 0 -> 35746 bytes boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst | 134 ++++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 36 +++++ .../nrf54l15pdk_nrf54l15_cpuapp.dts | 149 ++++++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.yaml | 19 +++ .../nrf54l15pdk_nrf54l15_cpuapp_defconfig | 32 ++++ .../arm/nrf54l15pdk_nrf54l15/revision.cmake | 9 ++ 10 files changed, 401 insertions(+) create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/board.cmake create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/doc/img/nrf54l15pdk_nrf54l15.webp create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_defconfig create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/revision.cmake diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board new file mode 100644 index 00000000000..d95fe51009f --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF54L15PDK_NRF54L15_CPUAPP + bool "nRF54L15 PDK nRF54L15 Application MCU" + depends on SOC_NRF54L15_ENGA_CPUAPP diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig new file mode 100644 index 00000000000..532ea07c859 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF54L15PDK_NRF54L15_CPUAPP + +config BOARD + default "nrf54l15pdk_nrf54l15_cpuapp" + +config BT_CTLR + default BT + +endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP diff --git a/boards/arm/nrf54l15pdk_nrf54l15/board.cmake b/boards/arm/nrf54l15pdk_nrf54l15/board.cmake new file mode 100644 index 00000000000..378b7bcdb57 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/board.cmake @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/doc/img/nrf54l15pdk_nrf54l15.webp b/boards/arm/nrf54l15pdk_nrf54l15/doc/img/nrf54l15pdk_nrf54l15.webp new file mode 100644 index 0000000000000000000000000000000000000000..80fb2060a0772776c3ba1a4e092ba7c28f13bbd7 GIT binary patch literal 35746 zcmZshLz6Cy4ur?HZQJ%4+qP}nwr!oUZQC}_*yek`A8@nks%%n~MdwMivXr=Zb_@`Z zhM0(=x*``*{C~P(1vn3wW(cGPSm3X0feZy1MHyAA&cOmYwA?nnnpP_aZXpd2bOX*) zJBGr$#hc*#XQ;D6OfKq`@OM3!kKpvzTtM%n}~`iv^bgjsbv|%b%-v3ji!2V-52+ z001yV1pIFOko^P$z<=)6DZ>G=0PHW9U)tq>iQkBC!FPpS#=E@(Y>R736~>&O!aa@B=8E z^8Nze=au`V0nh-MZ_WY4C&rtCH^AT*_wVtm&a}xb;f>%cAnzUY*W+gy!1y^oTVGyq z+y5QV0C2m+y#)OBU-f|olm&!5-v9uB;e)q3MgZWq0CB&EaKM*jUF765 zL064Pv9%g$y=%KSx7jwKM=P=_QM%)JG+KM@sSLkDvMo^V~ncloY;(XC8 zr~6_NZGEUC*c5R{K42-8ITK}Ads{)-+qLMRO--V#bK(iYZ~}8&i_Cnb%E$NgHD3`^ z;C@s4V&?5zAs-k$-#>TdT7+ph;Df^Y&L#B3#tZAP*|Vr{q72b(FO_5tWMCZ?bTtg zchU6ZG*`kA2F2_=STI+8Mae8}!dQHSK~qEwe&l_=^H!wdwjVP;J(@qInn9zrclk!x zhW(=RTrpi}v1F`7M_n&i;7Ft+GE=sGkEX4X@bwjwdHfzpw1f0|*+>3BkGyML2Yn@o zsp1o4*-&4Ob3>MC2bQ4fYg%`4-OQS9F7lbwhfg+HpO0MVVhL<%fS9k0tMAdH>wpm3 z15m>oT#vgJ8tTAut;?P@BMrCpZD%){`H<7V$C-?-6%hQW!8N+3Qs01W>|Mi?3}`cr zN=dpeLIkGjvu9*J|7jv}f35<<>f`qHu2+>B=MBgDEwJ*-c+zZ>S)CRHjV6_fZrf1^ z1j#A+dB)fr;zYh$fDm$^eu~TSGOuu2jwjHM}}3dVmX#ozr6w36w9}lM4~I zKv)cVyvr#+@Dk!gi8#+pgyWzP1;ZWyp{44#T8&|ArP9lV5LHfuTQRh8yBc^SX!VG% zzw2K?&g**uK0+qpEv)+z*|=w!Y4nXg*Xy?E)RubQYGx{z>2>PZrswnN_L_Rky+ZFx ze#hME-z$Gw(iaGv^Iiz~DG@%{Ee>yk$D$XDqDHX;+$u8eLmb(dW38R$E-Ps&94RsF#-Ir!%2{=%%T^H5wv z)l7XbZm=kwL>T-?l*>N6cNw{4#_YS*xEcekh!|tL!uf7NEZm1J+5ISFTOz|{L!ZVV zaC}VrIdx}X#wSno6>J)c&$sX!&*4oP*CjLeUQlQw=$-qe=HEjejZxuqyEBW@M%6))@IEfC zV2OGvT861RTLeWR7vCX35kePuaU8H=yD?9l*K9eh0AkaV{XLKs+Z4J8QeO_lryTG%Zi86s^;|b`04L6Au*S4Z8C?6MEppm=?=X- zX3~1kAnkEyrxm0 zA3q~0t^+=*!pIdj2q%n9!u<HH4E+#aK!7m(jK9SI%QkTVknqzZ3jxWuN%|9q zXV5m9iNl-89>s6rc9W2sy>wo(LJ)_)?`&G^E3bY9}%; z1*N;-2wh?Sm$-gcRkc}NkDa@nAU~o?nEY(iv*YatVpLAD5xQu&w#~8ZH~V}>ndaeI z5p`rxHVg`|L6z!Z!%D*zeS=lxTqQKFFTR07vAorc+1BsO|C=~UK#*3Vt5H%1Y*=b! zg)G<|mpyF%a%dxK;&|e7|w8Hw=cP3 zli;6#Z{s88SCeejfW6c)FZ@WgN5fu8ChJ)X-W)~{`ZHr$c=n*d_imW9yxXD%GI+<0 zTgKo|7|5xrGvU$)?IIa{ zO?cdQ>6)N;+J-bbeh_G(l_RirXpeO=xLUEj|n5;m`%)h6~V z^{ej8`aOC1NH4MEaPm|lcjPo75_RAybTGa1kI$hMD3S<+rD!xx@gixClRb z!2>h-fGSN>EhGJVFn+n|p@u1rMFS??VuGsD`R8{ty13hcHEACDJ!2FdVDEd=f*(1j zGY(X|l5MewDdpoF%OnP8@z`dHVMq%&xIjlq=o5=dc8O7zTm);V=C+6?%;OBvqEZ>{2 zxwf@b**hqT%3An8>_s}oHv<%!7X{=7EdAH;4j3V#SohjVQtDjfCK6If65HPPdgF%$ z>_PH91hmCbXVVMSUl?X=`FqLtcD##iemBe*52aXn67HndsE-$4#zO9>0v=THG{%Bsw8OAv&k5S5IeggwCM@(I{ij%AZ;JW9h> zKFtz@lDT|Ukf?H>^CY;y13TSKTjq5bOJ zOgsou&*?DS;z(nif2u$lS+cujP^w5!jN{qK?w22<=YH|PFj@C=i|uw{trsVbEpeaM znzc@nYJy@B#P7iR$0@9P*)Ku+n7Pol`pYO10sh4{>`FrlO08PsK%A5sO5L`G$Lr;& z$V6sHdtor_-*+XoOcL+x8kvGlQ_Xe5z027l%{ER0FF{xy0@8u3f)1kMi*xFdW&|^G z+-n$&)B+v>A&VhxgH1%+YPkW&XlN22cRcOQTG;~|#)Ld2q{UydKaWI^5TI)r=HW^nCTkWp^IF!I5-^r8SmWFR345eWfP7h{{8Nt4hu@;^xVaBv6iGPu3Y zDytWSpZ|#Uzj^XbV6_b6k~KQrnt9`j3@oAwm0+yB#l>tzM&%=`8MKOVzrr3)xnFJs zGQbv?&ld_Q6-JfT3pg)2V%5Lv8TDnKWTy1=hD1{t{M)_jlej15=KoSqM)V*5$2{;Pq>xZf1X?)PCMXGT9UY*IR((hr zoYwRl@kV1ar8~vU*4R!-ujoaE|pfjEn_c zPhpHFP}SVpImT~@{o`C=0^vx#ZtV}S*m~!xnvHbk4h$2E`b)w9`hGS)!A7J%&czw!d{kj3jwl*YyuUZn7KGPXb`Eu^Q-jQ$ls>=xCL_F?Lm-Q^$SKm zzKh#Sn9#i`-%Me<&y+EJitA(d!n=nT`o@J>-b{ z6 zB@I2(IgIi)i4GlyJToZ=A=Ks3mTkDwQr<)V7H6e5yr;G;h<`lW|9INrE7s1oRKYC! z+O*Y_DcvVJZ^RKM5TTzx?OW%uHWLWQLvyr^YIGafVr~u=pP>Flb%h=F zWDd1Nj~3Cg6n3lqNa@DpZ3RQ+_MQ7~7Hrb?|Dt)1-A+753!CTBLX%0QDIZOk5^z2P zmQM&p!abKKDFHHU=HU7?X8TdmHGJ?>V8^t_{UA_s=LoFsjKjJv5i|Xzhv*d#QZ-tXT$PX%VS3q)xOUJkp>7NcmL=7hn0dpMD_h|@_7oFCY z2&%E8b)uQcYYPa%4mrYqD?ibHa6*vpeIs&Py2StBtA9Fl=Bil2%SNK%Y|FO&Z0dy6 zICCgk=3!ArR@1RygI3;~PfCH%+2~;`{VBhzaqaB06uQe{CYai2(4vtSLQ63eJaplr z4x#JyRL%^j8($z>rUa$JfHk^Q zANj;w_ld~Gr@(4bX!82j z{1L}@Z1`VI$ycsZwc@7T_7Z zk9>BR#caz_WNi2E8YUEHz5vK~w!(6{!$cugtPC$(h{#*2+&+&~9~EL`pmvvosF&2c z{#_Qxf;P5;ShTGV$7WswgwX&YeLX-rSJ}Y>q}d%-++p;(kfe6unGvUqc)jO>>b1jn zFsE>pC9$9Iyr}kXl~1#20v^mfQJ-&c0)08?tU!Xs8NyF<`|c`z!3KN6rJ_X=!}HZ% z!^z<3C65;=l1to1E9y29db8|ZEI9%Yi9`O!t4G5DtKA=?p!n$AFp&}*0n0v{@qcDt zFpI=B$Hv)c?^{tm*~r)fwv$}kOv_fBI9fF9N{fqTz}gbc6|3jNVhxDkVo%az6<=$9I&K28SA-zb%#B&3;uUpJQ@bXY zN5HQ1?M$6dn}zUEM-$d@YOojL<#vCzD_}+G_2%U7k=Bvi{YzbYLt9HtI+p~g`q=gWPFSUNb#yJAXTu4l{l)Hku*? zCJ+>$W)g;jd-4uYV7rnfjNMqtX^!?s{Et%fwoXwz7?(20tp@anX#pWm9 z;t8-%^1b5C@~xwMlVXQ1a$7we-4M;qR6 z&_4VDdh^v0Y~mK@HY5tJv|$aAP2p@~#&z9Gx*Wz{i{18E)5q{#_EWL6iobx$D z?SQ?skyzpKw}F=JH~NvC`NcpnjQgQ~daY$;YMj8Lw%M?~@Kj?8z2wQJpG%5LZeN&h z>H7O5T|;>1w!U<=yv7eqo0|ZyUtYCH-^5ixvfw!%QtyX_y$WeZo=lwj{E?qSu{Q}X z;~D;+=b-~8%C>&DI;DFAz3Po%5i#H?^2{SDzHTslMyICKGj-Sy2>;VoV2XKabf&Z) zUjq+Atc5(twr%ZzWqSzJYKRyeV`sg-Tfu7o@;(g2v-s|KZkAG#=(5IsFI9~_tC(A8 z4daiJ%n6qMatwq_73G;faLEiR1kq}MHl$DsfT{s#)6nOj^NF5Pd?HKi#py{`U$MUv8qQc)6Ebc}X zs9;ik6HapWC!qT*hlZGe=*)G9+U@P;ccSgqlHMLbz$F77VDavG6(M zI#lMNr;H$z?z^ve#BghfXm}GNn0zz53mH6|lcH zhxyT>D#LR}MPn+0!Kr_tTTGE5RP7(aI`SYtB;;#j8JU8GZ9mS-K}TllHO4W#@SuDK z1@j8z%zdHy->lA_RzWSTPOdjGb)ze0o0)&KAUL!=Lh+Tt>b{Kn#CZe1c}T0@EcCXHH% zjHh=!|L<`J^-&uxd51di!^~hUn#+o2@U4xYw&F#fh-(}Xy=5ynK&a$VZ&c5=&+&u- z{(OC8x?6PCfk8?VZ~Z1Q4;7)B;fQ*XU=n+s!C?EG9dpA(a=rP$%Dx_)&0{N2zp>zeKTF~IgQHCC zFtEWHt%|xa?ei!h%RuJJCU0g^e1}JZxIh?e(#;1V$gzi2=E(NeO|Xb&5LKaMu?;UW z_!T*N&AtzIA^d$jQ+<=pND}`eZ5UvaiZIH`F4k=Z&c=hRU2863OJUaP|jYmwx&lQc_$s6x1Ch9~k zXiA+^FNUDFT`#?Zd+t6JpxwePr|W$_I;}b*t`4272Z{q9E|mp#MppPF)N6djXv96$ z%d_x^rWA*i4d;3NL&_u+!i4+|9J$c|Hh6R6G05Su#~TSPBJf7yJl42E8iGZW{u%!% zACF>Rhl4y8NasM{RMCjt&C!=4bHmFwnbjbNYX%SR>QGyC05FXL56@SgbtHsMr5XTkNZp;(3*wgS>)a=&g z>ac3?R>e_qwNbPiq(%G;?h%i!K8h9@lxmx~xm|VmNof?j&yu%TWx_9ZQtX|-VIw2t zHPT!jdS3LKX5+GM<2Aue11w|0hlgFuP$5xrMy!$8M3W#|FLs>3sot$# zZq>5Tg9+fZH0SE`GHI+ydhJ*y|o47}b{dG^k_J%BeZ^9xljU{A(pi*UVqCh5F>Oz#N(Y!*%M z#D(!QwSf&E5G-7}Qe%x$N>0`i0WGMKjf$%nRdeQ~fz0Jg7y6Mu2E|{Ch0W%#w$$FB z6yk?&(kvbvv^a=thvVSV5Mo@gG$T%ZafUHkfh?lB<%EmLt-D%G~@c8;3&?BRds=~0ad+b z^hjUl<*na9iH>kc-{snPO(uB>>yhjb1I%FsM}>qXj)kMer)a|;DZaIk0_p3ay`y;(|C+6lp96Gs_R z=mbm$qJ@TNTe`2?E-Z^be+dC#-_oY?7@n&C&~{Y7X%N#g-GhM*RJceV;2iKe9<~*tP4%PX9yJq>*+|j`fIhV9tM9BO z-RS0diuqqTk=`o}aVsP8dKhI{S?B~UVyoFhp^mh2!H0n%#$j$Nd6^?u@V=6v^vMy|gVRAGBKv3)wOTT zf)lAvh^?79=cgCF86;d#K40AQ!?Nqu#*#%}wewLejHUikR@bxP$V zr&#ft22Yz+%{vLkr3DfVJdgu8NyT3P1o)xj7F^b9HOO`ooi#iMs{TIuO<`T#l^(*eRvZgAi-7_k+7d2?Ov`;dz+1j#o7 z60f$;U>ObOlO&GdK~C4p7;y%^7+N5rNa}_d*Q-GEh?bXrC(q|lq2&Cfl_)q*=Ohd| z=(Zi_O(qnU+s1F4Lwga(S=yg;)6`k$dt0Jl6w3amD4uv7k2s!e~2yr9VbtYq@aMBBV};Xn$#?SQm*D8kH4Vcz==hy@q3l zi>zcTw}7Hd7)^~^K`pM0p_?Abh+c@vN(c7ky;A;d+Ub;>S(iy#hSv+bzdOfj_SYv* zBHhA5Vs{tX%^z=Rhj7cXq0vNbx{j`4Vp<_W#~zSsczTAwG3xtLVGnhwS1)5s4PGsF z<<}1`qKc0pi705+E=Z;-IQE_zJ>E7Iy4_a@S5U zyeWA~M1@Zy>N=)ayHG83Ji}ZAjdt+%)+THIF#7rXzH=LQewRMZhtyot4`|jEr75F3=o>`r*E2apWZrvCZ3ogd%a>tsgnEU@O;TZbA2=Lb^cQF~}d}k}8 z8dv$C)q>JHt}A^wq-rX88jHfS1cpXR>@M6QN+MrRl}(g$Gf?4jjS;v>jYwV5DCxs{FKrG(OGfMjn-TjwxL^M)lV}^3RQJ2^% zX8422b-^g-QLVXJ06x9~U>{_PQx-?{V<1OM0BO8d^73q3HwZPXVCUjU)rSVMVhXtbw7YiE+YcAw6xH370#7OU*l1MdG+mLTrG*v z@P3klVWEpi5v^GdL=eM%VM2U0{WKoxC=o2Rq#=VU?B6=6m!u9h0u?kRTA=wwT?;C_ zrnihr1P0TzBm$9G!*;Fa0ION{N z%@roMFWg&gzs;x%=S2^7jK05Qa}6`dr*9@RR6gS{kC2-1$hRfm7?mq1fWO9N@Rmf@ z4Hq3Gb@J8fHyI5nR$EtcQ4j^-%ChN<2jKPQ7SmC5rE#uxnr3j4xt|KL-xv1mHQ3DW zW)y`qi^brZ#1?8KK3S>pIZjMON2^*Yu_G^s4!pJeU;BLAAImCrxeqC)pp0t#@4*O} zlES_H2a2ZBX35GWw!NO5i<40F{XqoGS%K8%B#;$0pTNhpOAOtj79N)>2O|adhued3 zKTb296HGl!{dE%S>bx73wE6WV?76@J6GgAQs_vx>2r}*pdwE_Jwwb5$p=r`w87sZ` zp2F{XB6&KJ5jL_yPu!x`t71&p307d-*dcyWDg%w1)c(~Qp6vA=0nAzuIJ?fFZgaSwpc4C)2}lps1mS%O8**XQpahUAGbB1L&yG1RP8#nX z1~g~{2HN=+s}%sLL-=xCaY(*hz5GnL7Yn}^c zIdkRNCCem-&bE|o!f86zo9yU5Uew>>Boxd-tIY2!+ryM=O7+=)2wK9DEdaZWz}p}} z8?00fHx94^bJrEjg<^pQbI)3F-jn~b0z8w}s|_1)rl;vZ@mD+I9dR%@RLitFe&6Rs zsu;~%B0$^S`$6EOxV;9YFErjyAPXzW(fuQ0%GSU%UE5?+w}siX zBxk4Oa3@2wbf^AB2|jJy8f<&u-DSmv!0{X8x=oZ>f@D zd9`3>w`ur*;ks|A?3Levy#wM8%9MOm@~X*ea)sm>N=-k^Pyp?0|5{FnX- zF?u99dyhgv%-sn*ev`nZnEGR{_=sAD}mCBZh5 z(W}x>!;q^F9Ug^OlooQepdt;nO(l=v?01$#kEIesYcG$@v+8X3x3#=`3$>`%LlT%C(3XCbYO4?l5xd=81)d&dCaFh?C=hAXySMCQNLpYkSaQ^u{{B{N6%##v(El)cV3hwY=SaL@d-)b!+>O zb_YGk`%Ro+AYJ+lBL`@Kvw)L)5{$2GKs#s6fy2mAlJAoW^ke!qj19Jr2qwk2a`>jt zb2{!OSaU&;7&uew65Ks49a8a~juzb5QrKY|GrG0Z_ZOO5N#*_75kqRE?N!963DE&NqSN1Y4LiPP4)6#$xl|Y3+rGVK9;o z8eN=oU)lCIzeTtR;62gC6n~2w|5wltRUsCbS?Z9XeoMk+!lH||7lIly=ptR@` zDo`Y+#tJ@9jJJNJj;f%RXN` z+DT#C#OxRH6@c~Y64i*@97q-lsqts={lRf$jDf1m7bJZ)WPqkfR=_?+F~|*vWF<32~=>e0j7)e#PPF=fUYLY?t5W za3tb>Nxuk35+n^>V>c%vxxAqrVr=&l#O;GWGLM#s<<(xfB*EwV&nx5s;33cpR} zoYWr(gWiazF7Ru%DI=_E$5)U2qv)jZ2)eF20R1aMZWOP_BSJGTR#JFocQjcVGkfR3MAXawp3x5t{S)Rst?PPWT772A3Mr-@M!bPEwiC zU#e_lNO@w7EkKO`JqdgMi!oEPj^8f9wit9ew`bxvCB#bCe1ku;F%|;7=Po7-m4gn& zOB>I=-qjO37WLq)aGXqBijpP2*1N(KNREElmDHh1k{TX>6xY=2O-B^|l``Z%7D4jm zjQv&99p~`5Yd}iRz9~<{?rKiCDfxO$1 zoV4@^*^iL9o5ItpNHOV|Tt6&ff+SJlGA(Q1v!%6M`ZzmLR;aEv+t%@_mJs%fKXqes zRrhPDR~L_DecqNc4er)@&XXjv)`MDbk-x&{Eb8N~i^Zf<=5_#j>s05V?Fp*4cZUA~ z(Y&k`<)^7ibubpoXdoaj#5MKO(A3e`h3f1^soE@RXT&fSmo$yh#_6Cm5sqsDUNwvI zP6*)N-J8G~tj%V%%ny(E*sS^6U5r`o$|xnD6#skX?tHK>kA8O@Kc=XgjAJg)3?&|* z^Cufm+)}MIZ>)MCJJRmadw0qJmSR5hR3`89&2?XX3@o$Z-?hk6@O+&~Ek6pSv0wX) zKFq#=AY&fCaS~tLXC?tnQXPEG{V3tjLDpVWua;52yi2Z{tnmbPc^amc1-6DqUWXs= zM!1!`i1^|xnfNMWoiaUj(3U&SXUKGsBmrgjStW8md$Tc)RfNU1w_n*O&r%){e78|CT`fka;cniEx^6Q-SEq)2lrKx-b$bfQ7w z@`RRjgkJw_!Vd`mY{}phFi`ckMVz#I51a-3ENr+X?30u7Wi|)P6HsIDmOrT2@f!jE zy;N;*AKpxzO)CTb3(?e7XX&1jTla;NczY`SHxd;3aw!_a=M=$`Hc|x3lMD<$wxCcI zHh>B7*|e{!LLy50ZR1@FHa)A_XtUt3?|saI9tmzM_6)RQ7Ba_yQ;Wkhy5oLoGW=R7 z{7G;`-Q%7VRKgJf4N@ilLxzIVXC4wXX@0wnT$SCtu6oGG$}#Mn6`Ztj?y!)jK<)lC zn_%NntTl((0;kkTD?|?AU}e9c%E%9<6{{#m_6FC#k*x-h&MRvRCaA!B@J81oSeYk3 z_pjG}TqM2Pdzj2W9TS9qVl=`5zlsEk@Y>0Wci#SuOvVP%GJkon1}f7KH>{4CD%XF( zvR_$C)-qR_s89ZPGB~v*-aF&l_*sQO6z&2k2uB9PC6sg^wxU#Vo@aMNg(hy-yGd0) z>3b=AZq#%lo3cslE9qzFYws&1)->Bh(L z_fHjo1-W|5EGbOpsMBB)N)B!S#9Lr?mk?F_v;Oek6iERr>zVRyl1rJCJXV>~FqPM< z_7iF|4NIzoW0oMnMz}K%OABbK0dq2rltl8ei^G1@(9Z|&vo2c^sD9;~V{~>N>3Dnh z*oyft_eiW zG4ePsh!D*^gk3LT`oeNJxI-bn#46JxI7V{S(f#+8f2cDe*L>xF6EqA2iApy904mW( zWD$nzk!|8TV|8o#jJGD)OoYkU8I2U2WDFZKfjUIqphRg&{uONgi{V{>^A_#K(4_uU zC>u!bi#CI#M`e-#3obx7$GPNTT}_Y{FcTagyl!`rth{j1v;y^4)ik)lsI^E=&9_VFd>%kA)) zxiMi0ft567X%_soo(4PP2P{4URfk=iL|1n|2E#v|wRTpht8s(eryG2j#qdHfRqQm2 zu#1~N1OQX6X{NB`FfNf3b+Lpp{s`4tjS@<^Jnft>YsX*8QhqaJTv)zC zdd~NtxI^TTUY8@ZBc{w6l>~U>q4M zaKO)l9|Jjqaj_u9Up)`)^C`G1JdrGP!EWUg`!F{h(w>di5OI67?a9AJkS~M|XQ&W6 z$(+h<`Ccei(UKn=7(t=`#gLj`!m=AVAOR{HLytf2?ng~^5T(bK!5o~xu0yT&hNYzJ-8nZ%RfnH@hs-NSIdj{Ii;09qZ=?v^*`Yp~Rv zkL8^^e$b$HDeeKCgi9c+lH3VCa!6H)f`SqUT@Y`z23+GI>J;-I$8w_knBc6F3*xNX zJ={iDd!ZLA=hG|4?Do9iolEEfA{}WdbYWq#`V$?$g)0DSWy1+U7HC{gb{jV24LtvZ z@|+M8@)oahC5g^4@(D&I6){d-@`lMH)r}&+_r{yMk<(1|`+^MLDNklw2h2lGg1k5D z+;o?UCZ+m(bQ6a*#p3O^{Fm1bn5jEO2ddL1a`P=z#~+Mhg{dzx_k63i6cvSxW1Kyf z>@cc`@h3Aat4fO|3{F*;(xjcl=iSG$kLF}ACf~c-lvEC@_lc+0YI6o=#Xf_V&z~A?Ak=~u zN;e}_bh;EL_m=Q(O%YT`V=h$<{+Nnrl!%&17PQsH&l}!Q+>4>$@Ad5zn;2!MwI{-x z^^`HyjDMvwQ5CS4^MM7{9lyYnp>ZCHPYJ7Bs$6UB3`FvP0#V=%npxQ~&^Kgn)sTB4psoTX0uj0xO-XK=tfr9w zgiWJG@~nrpnREnOAewK`LPACOG8n+ajEraS7Z4E&w$+oH87UX@Aqu zO0EkE8u`Y-Vu)FdkNy*dl$Ct_*ebTb@=mydl0Y3o(wc$mDtx?=6-axB`E2on<-H?Y zf!z5uO;(QFHobnNkEwWWet`4d-9iP*S%D*jG`Q$NA`eA@UZ@X#n=GVnbbry2uy-#~ z@>m2OiACNwSa&adQa!U7%07#>1B8l|6Gp4nXw-N;$M~N2`lkfA5f@lQ9XJuXMXI6&TP2W(lTwD7RJC2EXn{*1?<5N>@&qWC9BXt z+`k%9YjBjpbPXp-J*Ivr;n-ea1S;?>lk;VcYh!~0w{BZH*x6ikhhJd9+DV^?HkV<5 z`p4C=p zE2+lYorDQKxl)z`+{&xU(_dT}2SwF#+#;-BLFVR(h0?N1Hd78h?P0+rAHvP`UW-+;oa>a`rMFK;fa3h@Wz-NOG_ivj@5z14B7c0kaPCq*t zeydUjBow8A&WagVab4ai;}wD^{sulQ70|#3{$etWBZV(vq_^R@s!u55OOWp+C(Vx| zue&zT2@~wIa@Yc4!E*T5r2cFV99eTJ-s&7+WI*LmLe;yHf47hEBG0;fi2f~B84*Z5e?b+Ullpm? z+!&k)q3CNp^7M~IGj$lYFHN{qs9QgRf)ZF!Ym!`etS(!>Z~2@ujF$cq8>KksU_9PTaY-^?$s@hF zgaQ9e=Q)LRj#LSG+*mX&{6_!qJT&nFPycz@+q5xgWxLsX@qyWnil#B&^W^$G>LsvL0N zACI`5Qn}JfrrzdJ@=0+;6&_4?G;w>{1$61l@X=^L=Q(&$8Y)xn_4Hq*f*u=N!Y7~p zAOX83O5&5c8^)|_vL1ZwI^`jvf0WvsBk7>^X31?TvZI-l(FIdAaD?&oeM81QY^<3$ znNIK^L52e}unL@5>NLPRx7^x#gXp1-(jkcl&22yf)H9v3*wryO4d#ef?9fl6DHy_e zHb(;Cmwtu6=J}cj)Whl>uYsR6G-;9Yotc+4NGw4aILb#Ns})(C&KPVb$_G)|XXy!- zt6mlxBag98GKExeJVQe4=j5Z?sdaK^Bq1Eua+pa%eL%W%6~zK7T94*zg)|oh!v0hra28=}@1F-TN&z1%+JDeIc0c$y=~?N{X>qp`~*Oefc>MBcrX zN@7?8Y`nmcCjD~fh*rrr3r~pEYxj@G)L_0fh`OIZ7V$qGna3o0&F-t2epIl7XS`~yin3}m#s zSELe{*zHf^Wfat~(w@3$%2{OHi<tuxxxK2^w z6kXKi66Sv2+smDGIJ(ioz#jpIt(U0U6+0D$?eMIvn1K(qi3R?ExzWl?ghOoN(4+{w zl@gCO4wem{8;8!;<5O*fPo+bL`Y@)D9NkCf3&nW9v<`wH!@VN*1ZN0P7~*?UvQz|> zCk-X1#gPzC2J?q)!q3sGCf2?IPtg7kBS750a|?`vNLTr`Fy~ zV6DnGGTdyVqGBL23w8P7e?$?GrA7nXSZ!Yi*1|;LozC(;(Fw=5LFpV+(QsU2gTe+Z z?b9&Bt+Lp0RN(;y7v5w3k0u7NoBmf)7QmXpMlu9<7g4}~7;p9j<2C0gxQvIhU`;Rt zP&D*QMMNsC;)%DPZ7u7G%!#3YSFB(w zC*v%z%!tT%gK)H!Wz(P(D~DG_#n_|Zc6SEYs`P&1GGowRrp^0EmnGc;zJ3V@FvK?( z+#sJ!S$`pAVF3NcV2RJ3hHt<-Ilb<__2(MZ@yu%& zC0{eA{x}?J;yiavfX3r%d4?*uN;Lu0WkT<|AH{B~66RBTp&zZ^50LS-ais)aBAa=z zymOsgd@Bn!LAB$hG4VXmK@Wn&KJLGLb~vtrMBnb1f3p17s}ecRlY){L5&?sp(_>iq zjKgYj^Fh9x2}5ZvUi(TvFk$Jp)0FP3ofhwj&O6KS^=Od(=K0JFZNgiiagc*8iPV#f zsFr7(SnN0`I28=7kzG#xfEpL7Yv!PmQ6}qSbtS&i*}5BRSLuJx+9H$Rh8`(E-NyPX zsmK6#m76J|jX73|;tsu$ zE-%~n+Ymx?Wguz;Tq{!|9fX9%7fK2Av)Ln`JMlakTW#0&? zAYG4R_SS{k0YLIj|83GSb8jL2%HJ>Hk#QR&@J2ArJ6CM9B4t0zf~)aFJW zF~e|;f>p_CdwV|k(qQ+i)?0Tt$%aZ323bB&xh=JCiCZD0V3?1xAcAn3_&9y+(q9ZW zNGyGX@kuhDD^@sLD6*^7mO!=r{2=AxKatIj}2db97Cw%LMW$4t= zUtDpdB7p^39`hQY_oUPXovf40J5bQBIashcM${#CW35B-s9)Yh5XuAWTq5BBL4r%m zK@6uVRXh3J7ALF{xU@>>>Zcaw2A@%G^Ip0+_?S~z;h*6|O0F^q%EJ)ahL}FWlHfxp zPkOoPX>2Oj^Vco=YY~+Ub{UJQxN(}qH!-%bIgh2S?EnRAefc0p2c={aZfSMs^Pcnl z=$`)Go0M?JMj^Q|te*Wp3s}O6XNlw0CUzz45sa@`O4sL_Z+v}u*IMc;&a=xZh(!V! z0CVfDaqizU$sk~;|KBW`R19s!A`-OPBhp)x5uo_Ns4}M8py0LTx%tgPU0~wIOF6_1 ze?9Upiq&YKAHt<2n*Z-hyi44ikE`;Bj`}$HVQRZmx3i(?gg$?`C>Q6)Hx%i; zl>5{t{eW*wc?o1~QmY9|0$tfl^`1jb9%+CBnVh0qWEPzzUUL#9^Y{yg8#&3s`>drf zZJPB?xu#)Nt3zb*)6re6yjm)6KdZ3LwaMk0*XHnHNldz0ExR(OT|^s>b+n%ymo`rP zs;NUi?D2&n{JA!Y?_$TUu#pYRoe_hP8snip1o$r5`%VwfnJWY(cWdK9_G(Q6$PF;x zUVh_Kyzd&rIM!eb^Xn*DXeYtB=+=H|Os_r-D#>+&vxEU!cjbOnapZ(lvp(1UGu;c8 ze5w??^f`4J;J;}SZ4AC=i6hPya^Vvr?rdkg7{uVkrWf zz=Gc)_fNo|pJ#;XZn$3K5=bN7Z~(MQpQV|IwDnNCG;*=m04muF|K0Ru`yfVsYhCBm zL$CBC#%tBLu5hPOWJ#?IEX@<>Om(~gl(t|`NKTOB9}RTw{%9qB|HylcA;&HI4J~qD zyLK0oP;MT@MGv8rPyteQ(~-xD{G$FR-j#KXC&AH?6!>3}7xdPN0DI6nS?Wu6X0cfr z5H*Rbw8hd}Mpd;DL;?(ns28@#@cZZEi>#2lrQ&}^lmxRjgy5&DVr;l+#LFgY|ayy|4R6?rGHHkZxj;XQuZVnQ<0_0|o@kgDQFjd1{?(6 zImVj!lejd8)**b4?r~P{CqT?;#YX2o6fd1?{5Bg5n3gBZdsw1 z`JR1?HxWB3pf4UslY0*&H7aT5+Jx^p~?H|yp>3rw4 ziTdYw{wRK&u6rw^8j&6a74gK}zKm<{%CUI1%STvrttM^i&*L_vX6S`>Nls-C>sW-L zkgR2P@L^mR0CU6Ho*FNs3v5hl+R1!I0nn3U^OpZx4wLG~R63q^;oLjt zMch-g;EU70OAa!tL#|MVa~}C)De3ucN$28zrJEikx_eBWD=}iS>;tsYmy5z2JD9gF zL{1I-Ua(qCtUy#=h=oIj=>Qn()~zBMB-Eimj;=QXQL-PE`F2F@7y-HKU zVGTmKy_Kwd=;91t>10WaU|)O!RN$jg{{k5-u#7km*J=rqL%~UZVs!vADz;k2WUf1h z-sNf`A96N}b*$&`GaK|E32enJyc+R3S9W?$#Xol9VO!e%gmbM&f;_ykeBz$UA!ydT zq-c3pBf1uPXlEzI=-Es~{yjTAQ+ zW@Xxd$-tiNsmcp5h3^Hs zAnc>6YMExyb&h-flah5I(z#!Lt~(xpoX<1v(P06C0oVGoWb21OkJ*?kY%fMQ)?`E8 zuCxuBnpdw2NKnDo_&lvL)i753?}cE8-m zsYUE#$sFVugOyM`hW=Q%Gg(ICR~ulOQkICBc^;6#j=z7tOvHT`ZZ^Qt8S!V5lTw(D z110|0vy2f~^o5YR!X0vjr18ke4ppMF;gQz9{RS|4=(gt+EBKU%4IZMSDpxM!4Z4`M zsXhX7B_ku+h%2lOh+QdErt(#xk)rH-NgRFcf}{KS`ch@%pFmfHnba zeJkp)cbw;|u>k8#F_&%97d%&V;nyC1uEj_sS}G%$t&Q8eRj!wIS44lM=DIGTDBJQi zS-HCc1P!<{+Z%jz^&H8YoJ5{eLs13%nI^DCJK8J35*`(?qXbvvll$y&p_3K!22w|n zy_(IQq%*NaJKLabsN~JL9b`xX_N!=ZIV;k7<9!+wS1kVj=w0ByuPVLBF4}T+DplNc z@c@8r)>BcRxjy>nkuP+&M+8xkrHA@Li~wq=C;I2LyXgF6OxYpqe^)qyTB}tq)mo>jp51bx}R*u6KiKhKA<2=2C+K_-aRKFZ^R)EP&r0PdZ z(HvB2>yDL6%{biZKS5UIuK26l!&9j`UsHQI+%K$or;b}i)88_o8CB&ZPSBG)B^hpBZ?un*c+7ko4} z>d&S;DHnefh{mRCrz4p`nYS&nNIQxKdY--q$M6OyQdE>1&5p?l!NXexeR5T=68t!e z%_MGjk_;COisEq%A62myn||Ze`ni0_JkOUS%C`=Nypb5c(M=3$F;|by{7>Qz`Mjj| zXD~4)Nh}dE*dP-uj4D z`gn|K1)31*}GjWg8x2t$Svh1Haj=_M{V!@)sko z;ip69V;%_0uo{QWw690BQKz(U@^+ zQOPO)AJ!c63v2K?;oK*OD?Y}XD^^qdc3+=+H7d4ONX9c^d;un&{T$GJeOsFGGzYDB zQfE^TDk3M&Up0_(jYNAtqsiW(BbZ|bHgmhq2tnpS_ z+}LggatC@TF5TJpku@m$Oi>mRXy8^59V8^yyB3EtARDK+qgqI9^gAN!ro(&uRHAnJ zSVKv+pWV)lt%k#10Ex{hg>m@;3eRC=t1+Min>-4AL$Z?hGFDQYU6KW~DTw7(oK}h%ODD0Ab^ds-9k3D+q%TeDZ zoewN9@R_#SkgS$Ib!V<5wGY#Cx*9oi-vj`!y_?Lb#!<%84 zk~^ClC-HtQud}B48)CF8CWO!aAUFw_KxGJ79hK|)N?V%9GUAsPC*uo0a5C2%7maN# zYZKZ_x8cBn{E4Jy#O-*4HgL!QM!-~xbY&J&@_UpPeZ}7S(S$kSsr9WLVZ8!wyT!ot zm=6r~rqgUz2_$z`0pYvQhy`Tw{jy}WNW<=phXNALBvRw|EUY8pXa zc2GC|BR`dGeS279=lGbpY9*!YST$96lMhWr^Rein&381pU>vsY@m&KsMv|bfX-|nf z4IE5{{-*n8*LuzySJlt%M&2ZrPXE?KZTA6;v|eDGV#5@vRgGH|d|L2vzq!$$G|evd zAANLC!W}%`UQsgxq9PpLY~7H3UZm;k^eaEv`#LF1=MdFspW}#luaauS?CS#KbR=wI z$lgO#s=<`Yn~X|dtEQ!uTU8>eh!At!05#FQ~Q2x%?}1d3j# zmw(V5P^8TQF_@g|u?>(W3Q-Z2fRVFmmZ2i#` zCLGH&lEMzbs-M`tLPwt(`UIDolmIsYkY|=KD2GRn=kU@g`%!>@3QhVv>QEfz^Yu?0 z6<&iS7+Yw_aQXo{Na;t*&@M}Uu>Tu?TkTBy*F8lvPLs=r2@CfZ`rdD%nMMsrjkti{ z)XBd!q7$t;ig!$WDZj;2q5zTOCO?_aJa;Ap*I+04yq7lO%okJnGBN-m2#|$4&iOZW z2?(l?;&c~5utXT~z1CPavc+0Z8%(!FdMNa~v8+b| zhfUnKcIj3v8`z=}Gl3Wh%}ZP>)$J@(O19?pJ0r&IZUM3#RRz}BW?w&^nX*nI2Z7f) z)Tn6}b(v_Hc01}qm+H#mGMp7waABErTzz zJ_o(fyaJWscX}O1_Qxw)PN`bdY>aH*)%R1OonluEw3$nRlJ=n3;h)>z*IL@IVc-Bz zY4clL04q$H(}~%Kz}mF}X_=d4gRf3xMa_)soj%Tke-*#cvKE7POR5?&jk%*x;+f}^ z?~_%0ASAwiB*~Le(=uK6nc@$9=ZzOfi_(h@rcmv?z04@z+zk>C&EB!Ap`x^X)BsuB zNsa+SjREOzmj%yRQJ($;?Sx2UApQE0H*M^BkCcBblNe-#26PpbZOKaFJ zo8dNPRr|ObE;pF8$Go@nEgze`{m-Mo{OjM81~7^XnZq3*?Q@xt(`($Myr7MmCiJT^ zFYaZYg8_8WFN|m&Lq#OfLL%Ov{NSd-9i#?MX~Rdj7_MH<19B|)b&yf~MDGQEU#(&0 zaW_SVHxGUMAynQG(&onHlXtZusJ(P>wa*1;HF2Ekoz!M9ITkIaV9%e-S+;dsfWrB8 z6kOXLMubFNuLs<|^Pc&}0XpMd4-Yu7>vS&s>UTq9O)~A8LEvq?SW0BVD+o+k(=}=w zJpf=%6?#;ToVS-r56;&nWFZMeCW3K(+YU$Y`H})RV})_+5+xyx_beoqg-CNw+buJ( zoxE3OM`5`Ho06Qv8Dkc(Pm-4xC8b}obroBF0uTm;#YAI5G{`x}1#!J;$!K)SSr5@o z8BU>yJ?d4y;hKJAvuG7rHfcfRCrZZp{aht98CO%RFOAEkd>V_}{UWwH65v`cnU>y! z#+IzNq~{8a#aF?HENp+R5-wI9x%>sGxsCl@7qPu7p%U|bTfI+1x`wm|d{ChLF+YvZ zNlXL^)iU}{bgRLsk4tpgZIEAf4?$X-zBK5MgM_}K+R`Kl^eHpRucICSu5Xw z>Ae=X4@h9qWl!59-VHVxZ0CD|@+s;n+XU!(p1v?V9Uk5V0*1Owz`hg30|rmmm z4*G$Q(17%b%^9MH5QfAMC!!UZ@5GVF=c1thV`9oq<2*iO^s}x#nn#r)Wv&L=u^7c1 znROXgVBMPM+wjz5>*W_21Tp7s1L47eVA%JKx@XfSAWv|nx)=gdNi&L>d%MY{Vb#xZ0B|)%j zOY8$FzEyCU>=7Khgz8y2d};)X+0tr@XQAAfv8DUlYieEuBwjsWo;wZfWiKqq<5t*` zH~Q=Jz>z3i0 z_+xL1>z(Pbso`n_&DeB2(K{Pny5sPsyQ8l3=sf4C+u}sWK)0cTQII=;5yq}_RW`*V zFj}Q;YY;Rg>=QNmjfP5jZSB@XfZ>D5_6W4u`mMSWbJ%8CmYa{v{B6*D=DVTKFFJnK zA@nVEim>f~V_}2k?T=Ts$g%6#@a-{_$`4q7-8%iNYKSQ`O9#427(O+`QHH*sCD3~^ zUy;L~6s`a=#MK-AC)j6_j*6lFaE!!G$?H5Ajxr$^Peoy=Q3&x?;;6W9HMfO>N0s=+ z5E!o}RdJkL)wCkX#Q*8@tmG|^Gr?y|D!9ZTOh_(~91{Y1Nnc{cG;TCNlUPH{6suodkzFNrbD#guM!dWqExmhCHOYLQ zg+iO3_l!q|{B_l4c(5j75{!A5Tv3g#J zhAs3I<$cQ9)!QTQSc}K8W2!fsl_7Li5$xw({uS{j!;TR4Cds0yPWFG3f9o{uHX_ZO z{A_P|8B^^jpY?&Gd%1cet<7hozj}ABak_pOpa*u{PiesqC;jYkpYQnRh=2HNhRV{u zmD&8Vq7qT})5i7UEfwM~55pk&c&|Qb?2W-36u7BfEKj?H5!@%=M+i@3%{q3v)8am2 zCKF!JL&|V{=u?=i$4o>o`}B%}#{Y@skFbny)8cRP21lS3P=eAm3znL?d0b$w9mDJM zGFRyBzmAQ;@$EcwG*5+fzl>$!H}Bp#4gvs!fo!?2BVBFZQD30fD^{+s@KVxq8P_qn$S}K*9pK3g(H${?Azsbq>+o^@v*UK1bv_%tj#v868k;HEyC0i~sZ|zy@;-+$Fa$!2G=GtB zmrCdJ|Dc(sbbMD^ZdGg9xBhJB$f~`CCeMU$i~!nrmpFTg+>m~O7fIe2PiD;`io)h2 z8Ck4ia#O8oM14B6o~v1Id3sG99&F^bN(XO z|CDZk^IVyx6rlKjAw&#(993>+Vff%(@~(r-+Y?xCLJF_wrNe3bGz2Z}rgSc=ylwO% zLwn*LLMm9FurkHkr|@#wPLrvSOmfhtugqq1XorBL9bS2xpzUQ4N5V1_cFKkeb<9d6 zICy73>FO1L*Zs`bl`Ykc)o=I>Sv^y^8#i1-zLpq!Q}n*i8z&=98m#VPobW*JL0m*a zch{dlbalNk#-UYt3eOCs;z0MNN3EuP)t8@oYUW#!-e4SadZ|YjPNhB0CnQNDJn8!@ z@RXz1{)O7T=cpRHSxBZ3{#nHyn_(lDX$;hQt}aNVz7p&vKqWq z)oJt~Sue4qfmv5Dc@|>-YCmBG=M)e1qO}oFsGuZZzw9@Ytt;UQG6Tyt2We8Vh7`SlBeyxyH%W zn0YaqS}Fd9Cj3l0k{`Ra-*%`MOs+ko)_zuFoc-jr*9~qu_JuumU@*ZoOT@_$)ent8 zxe9oMM^{Z%B)i_?-C;7~d=^&P!Vw`yf1gqH>)Q=$RA>#ToSLp{Te7YXBc2i+= zR;s>wZnnW*nnsHTI+hpl8kudTUy(o2%)umX;JcwnUq@2i*(@*m*Cses48-_k<2 zI7MlM%xK4-`mk-42aeX*w);edE!EZO&gV;mSK<7_z=;ir`D zs%ChvuvMGy0Kn9miz}NIl^dfFN4F0%LCCqp8qAr`*CjNTph|+MPeEKHFJK*&_aVH* z_Oo&Q6vc@{R_Y@`j zkS)&DH{)dYehQ0Sf7}YkgVjm&=+>Zzv;Q!LO=get@8Et-zT*n!RLz2WSsaBX8$*)UGXeB1`&a}*hwKN{J5wBZJY1oqf!3gtrUP-Orl1xaY9JZT!uG?kwl}B6pt}U^uva}G z35qYx@b=)KF|!h6F3sylmXP^5EoD#_T4uTdS}b2PnY4QHx`+stpzQteY+FF^Fr$7n z&Ap6H5a`G;829Cr1H>c_qVv!XRh0dPJMQAZx~8cGR?VBxHmUaxzibQzv_K?kho7 z5TF$#2Tit}vd5oZf-|T>wy$}Kodo18u9m0#@U~E%IB}4BPp7dhJo-qR@{=Y@^ocIa zfY?@GRJ;BmxHYYy;`gf6(^GFjX?EQkj}Wxs2vzxm4e5R-qoWuFoCiFX#~9&V)v$k#xs{GRiY34$q6!K~j~c^hl2oQ(V-wB; z!XuzNyav0hjeV7vo+t{aWeJcKmzRVnZs&7(%VH0H^bFWs$PhfaPk7RNd|u4aFOK_R z(UC5x*A^P?z?Jn-zPMWo)iVC)=0_%qX|u2VW=$ixVmq_I7!FW<-}jhw`SG{~=9b`B zJBjNKX`V8Sbh0K5$}%uGOmLdojn+KfiJ^LN-kA$F5UcDvD`v|GSU{9<4jiM*sY6v; zzOxrypxjbfh0on*Mp;~mR%bsP^)~mwGZSMu_u6FX4~2HGd+YFttnt05IZ;5A|HM_I zh!0s3qkTL1@+$*gNM$C)n|}<|rPW(N*;u|uS=9DeHM_Im&{d1xtZmha%zt-5j@$=! zZ2~z5!{lAL>t8Uq z+@FjkiObqBI2tGc#>XnIf4^p|!cFHX&P@Gp_&GYllNqeN|9n9C>$OTHSTl&2dNG=+ z!YV}Tx0LX>7ANGn&?aRV%+n2Df^Q*GY_e16g7H0jyRXPxuU{+HOy3r~|`=%&7a*0)!#U*%)%@-;z zKH(|=R||!^m3?d&UH~FlnYxofdGj>C8h3%;Puv}n=ot9`Te4q02xQ&`FEa`oq z2>N~B7~AW)7QT}*uD9?pZC4MR&xr~lg~QKqcTdWYc&OA5-JQ#cVz+5o>F-Mqe;H~E zh*0J9^_|b^97UXzrrh<>j(4@|cuR&s2Y}@bT!9}o>E@`)E597x^Bf>g+Kd5RjNXJ}@i>zvYiDC^68zwhKv!aw|y0?7N6!5BZDnIzAMt zJE~r=*8lqFpsTpn%l`|1>8`bWy552KgH2;yddj=LmLRPq#dUax+Z=0>$w59SP1lF_ zG>^0GY!I|&J8*vU#%49Ust(5CoO3f)T_=pn$aCouBSb8tgGi$uLHh2Ye)N>?dIRAJ z{0YVjUNfcu-lOBZ${(Z95%%W__J$K>`0Sx>40@$(-4Sq+W-QTLdW+zo)>na^?CVe< zd3)UQR1{|EmM&63tP9dH0>0r#{I}Q$^{1N*R2G|iS^X-*iDdmPji~b6a(yg<@~W~z zinDJ=^5wpcdevSN$w{<7)p&L2O4aFFdfywAy!enYka+LZM)mtyzAr#D?^Y~7U2`K8 zFr8RN84X+Y>Fps&K1hHQh-953b!cssubC*5sbYf^e3#?f{^z|##L#HI}hPnDtX4N-iw#L6exaSMUs_)T&JMIp_b)^drMthTO6p=)DwF_G?ffbW?Se z9L0L|nPB*J&kGWNuvS#18W*q)7(rf*JdGILA6@*-&> z%Vg&e%OjGTX9zC2Y4(2x+#{IZ^3f?+f>cT21Cvt}Dd!0e2ry?gr5hcu!*QH$q<)Kv zM)rHzA0*n>pJ9h*!}%qjtt9>57mla|!on3VOE3h7#FjmN%o~~bL0LQ#%rv}m!YdqOGrIgP%&O!ahB0{&FPll*a)FQf5B*soq zZ7XQv-@o%2Hb!QAQ)@%d;lk|_oMm`)GOu_epu?A#b8Wbaj z&x^ve=1|5O!}z|tX3@-?p_Gikws%dqUo`R#uVv(sGS&lFHYZ@cP|57MpjsjQd}pX-eI z|1Sd`jGXBSnQuuRr++0SU#g%p-ZM1uRUkAP`UMNhEhwL_1P@|94BqwBSP=R$0DhN8 zh)KY5b2?JY2g84QhiKHNNe0zJB}#^skv?N2u3$Vcte~vMmF){0jbcL!KXf3UsFNE) zWR<5a_w_hqkZ5vN)@DJ@IP;+lz$FH#gfaGJfZp`MaUbvb`R9u>$6QS!{DSX$k^wR{ zC64p{ZsE8@j^X1ovF*WtI7}hXz7^ouOq%*4gAL1v4^mWNGLubF#*tvy_0gXGnk?m> zNUibw*P#)w#85cjdn>}Y<8&!V>;$LiU!#++N~{}n+{&MhrpmF((nKnof$lIrtQ|Ww z^?^R@%A^};q*W?OWN9K+w?Yn2nK@1w^D2teaZlQPa4f@4h{8eWs~X~__4F&`RWX^9 zGFlcP0bIToxrNo+Vm_w|g&}V^8mM$UV!M@pOs^lJ$ZN@ko-`U)Z>C>M;I%NqI;CVk zlUj)mU}TWT?8Xi!cM#7HHT;?@=S$~in7q^a1|pTz3}Z1^=X2Gjp)FmKCU&F%EMNmg zcjB3orHNz+Sn*(ydkqUG{4Gh$;y5YLa<@n#Q#GBHLbZ1M51s$QV5(_Mzk=NKyUJ9R z`d6QejNl_`0x1zKfAv>dG3E&SCuMf?(FFI21YRVNZkE^~{h*;hTPa}T9b)m(V-vb}{D&UpiWu#Y0X| z578>Q()z`|bK6qMRBKlr%-2ip45m(S3Dcqw8UQp?ihLn39k1I_kj-l7yrv72Iz=gk zhS6&{p`+tO`+OfFdy!ELs4W+7UmR58#`CLjSq9VIKd@`GEEcYBY4bzrO34fuI=Tf{ z#?|}3F~g4@dVK+$WTA4<_`YKb|8>uY_ z$Nl9q+(01|w3U~8eaJmYKn4z(5JKI}ab2s5fTMey*mqfW|nzQaj{_+Rs1D=2in9+ts1>88a?Zbf)8X7JAIju!b~GI7KU^&> z(T8TTw;sAGTDL$d@p>cPr(7nuEJnOQ-J{fe3ASt8Q!Mt1S6;8T_hH~#sA9Sl#h_Tl zD+UpjoH1=I*v@03*~P|K@rbvY-qv?{G@?el>`yg9jGYpkcmVfVECwLtK(5v<_RBEi z3#|}zk$?md2`^y2cAtFdS_ve-Djh#1~%&(-AC`P z(|O}&LlDr0Q?35KR&E6D;RYT~**7d|n~hw(Fh_JpFW=MN-KnGC0`s0dg`K2#%a5O; z*(zyeamV2$CvCUINrtWfOgW#^5Ccd4qrQNafT#Zw-JFX+fM$QzrXZ5_P((9AIIdq> zAcbF0Xd(q;?osWR1LQ1V^(=gsiUG|zOihnO9B0QeZ@vD3fCn*S2&o-(ULS+G$8^5T zY=kNO+fG8P4X2agJIN{0z`=}k%SB*oKU5>j-Lflrhb>^{u&HhY9wa(U5`-Edjj=ru zUGHVgHvpxG*TT#T5fAp&4D~A5(;=;2rj^SY?(1+TGox09aLq&tx!NH7A|PUBQsg86 z-?o{$68%r~jE|Nozs8a$p~M1dV<#el=NLN{*wYqEHbZ-=Nea|M;n~$4Ma6u;6?iJI$4Dmk$gVN?n z$J|~cV|;~K*wArSfQT7jbNZTc1y5JW=S4p-3&{c*XXQMwp6rl?Swi3TlMYggfEz7{ zJ%6kt@&@G-EKAd8ws}LJv&>^+20uqEV~FB%&8xcM3$We=K6V-kx{P@UT`?N4ZzLOs zh@+!{pBW}<{yb4$R9?->U^?Ag;s2H-0OAqy<^{QB$SA^5za2I0jTX3~SF-@u^e*js z)S7Lvv}@1trZbrfcSs_%*&7P7N(-ftUwki#^DmX%l?r{!L62d5?&S{#Xy1J~!tA<> z7OvK(Qjc!z&EWDwPsbu%H1mW|sF9fq$mu`1#E%fr!nRllJ$S#s2KZy{GUjt>rD||? z23AYwym5_Pv<0M-?d9ZqFY(YEREv|&>ywm?_mcCxUTlzf{><)_oJ@bb>ZmzMe#HNq zPP;=7za9A%oMp^?bC+BfHTsdt8$(HRAg0ft7m$UaQ{wB26g1Ia)wxXNIJWF|4cCI9 z6wCD+ke87muIVugb2!g9*&j!CxAN*3Pp6?>+q`igan?sf8HV|V{~I3{1YvN|ntFW7 zMAn{>;(y$*oitG9ChgrpR^ri#_6JqMFhOOM!pG%s2qU@8y>|WWFx}{jP^@*Uzx00J~YhUmpAQFVJK5%%L3#21votrlq&h zTH}S8q^sJffGY^B5gZmk)h0&Q=D_~iP%R5uJO1o4tSYH7G#gNi7sZ4IO(DBU_yN0^FWQTd878XD0+s8 z`ratf6!$1$PL0UYyq)bEG0xQ6Wy*c?*9g0!V90=J^qw&!TWGURRLMn%4YO?QVVr1t z?Hl40vqgQx0wZxz@ZaU|cAYiRH?&aU`bs4rc%AJE$c3W!7W{ZUYGK;t2UW-qLt!h3 zeb1Jd^#b=9a}%*;=!VioVMc38$6~^sw?cbHZ;)d=6P&A_suYfNvCBtKOXA_n7 z-^ihcQ2i<>>b#Eg0o7HMWC1apR*+sNk2Nq&jwbP4ILDt z;aG&%)fRk*wvRRNP!z#%SD&G{`QORQj_r?AKIw1Va&>u&@9vVO501%$0Zo%&I?0jW zSD+GROnLvS*!84`bw8ND;alF}IytsGjix ze%lsoVLZZDkU@=kYlK8r9U9!%YZ`XRMOtV!cOotk>ROL!#r$v9jKh8=!qPrOm5t~d?2+(BS=Od}Td4dG#A4B%gx03SRmsZfVDtjtsWgM} zi=2aK0t#)}NGL`M?US^iYMKw_&>+@CiBzzFZ?`dh>e+hHPC}q*35xySZDHb^LeIV`{XrAr7KG%)fE=_|z zs3>1i|AhcUQ5}yovwgP)Y&{pWN4NC@SXb=O**+OCRx(o*zY?GObx$K_5kDFibalUY`^N zNyz6LBQn%mJ@%3uTjcdL@N*nGV^lW;M!y&Y>nV&3V_&WDWmE{(d{SU_#3J6a-uU7~ zz)(pq&0Nyf`B;{mOwJA)C#`rIo+)_DuC`;50*>#nY7tr5kMni+) zLAoN0-1lA7FNdr*w9}F=6cL3OQ%WehZsR>Rs3r zL<|JsOrT18t)250Z44hP^gbtX<6R-XA=!U+`S#ya@Bf&-wtY_3LT7dXoMaO`WMLv) zD*2irK_pD~q5YNd{)f!n=!UC_iv)xTvv3`SK4L~92?4$)$R@4?AC9ix18*#w)AVp* zL>3v|W9V#&g6{&>&Y@}Oed%NDNeAJ)6w0zQHJzqOS8|a~1!oiYZRZ%>-8qNGbtw^( zOii3Od)>;tXh+V*eVA5~UmBPPs9~n5F(^FVF(vr&Q5_?AMoE6Wa>Lm0Y0(sPk9lJ3 zdNs9QcNNdrt*qijq@eQ4>f%s11@@?;YZrU|76=f}Ia5N}w`~swA}+OfJV&5O$QsG) z0*Mnkv(uMMpPUnQ;XzM44PVJI+79eLnCw=GLSU5E0Vt2^B?Qe7f{MVIC1e3od{lsv z$YWju3{a?;mzoKip6H_zDe@Qip>xq$P6&(7hBB3>Tq|R9zp=P2VQ1r8buBSg0lM2t zP@S5J9^>0heI63Y!o93p;d)cjydksGZsqGV+T{px*9{FLwKDT-+fy8!h`hwW>0)9w zw+~pSMLHnQw~M{Rs^@%ps|SZ$_#~UF&Nck#7R-$k7sjq8;?|U2eOm4i8gU8ZnXVg4; zb_or~vuU<#m9U?i+#^B{xN(~iPF1P(_a;gSXi(8dD_TDo_#5sZ^bT<&jFf+bO6DUn ze+pqvb+279=VzVIPMCJP$f?@a;g@LZD-XW44ERt(9rL(MGy3!fx|DQP$whRq-^s&b zl&qAL0;5k-$21}+-q077AaE)jJQFpnrQJy>m5HE@d!;t|$`Kpg_N99bx590U?0g<` z5z{-g-yRT&4{%KkdG@>na=7}eeE960PnC%%B^$3Bw)Xw; z$QO&k^DP*A`!=17Oa}-xP;3cnXyne`AUA0B-E_P__s?+5D<@+F`~pxQ5cCRFtyK>X z9dg%zzfocjp1XX$&=>ZJ{=tJMO(ziQKO@x-j~+x~y;Ey2SY%XRf8>T_CY;0_&3xB4HMjyl9>tV=w~F1fG;=YK%H!q5k8H&z;j|HjfS#fBxYOouo-fIVT)p7X}W^Iv2Z{#`O3>uJCf~b?zx1L zLq>VK>?U~#{9S8(C*+U;F$>Q0*cf@UAOJ52to|ybTj0Ab`{%OCv^+{$p~5%@Zrf>P z9z0VE_=fM2K}6PS>^NX6loxjFL@9fVYew`bm#+GIh=EE10Ld^*=1I-xO<&Ng?Y2Y< zo`y#eX&O1c!roqp_$cSf!1{4XWnPNu&i^T@QG3&Ti>{bG0yfysGZfTe^>LL=Y1sCY zD|xMgKFN387irPu0QttZI}6l^B?!?u5wt`_zs!S`xu#!Hc&r4W)@qy&B^YC8(#vq? z*B1!7m#M*`1rmTJL@Z&Vs=GX;z}_pnv#0>-#7^+{J1(SZ9!Tg1EYG;9J;%W)JUc78 zEr!iRe9wNO%8!B#XVy{#ARP!lm(QWO^8sj5-GT`8O8;}MS;h0>rz%3gXw0(br0MgJGBkl;**j;-;LkU zt6Nz!hob;gb>zZX-3Sa%8{-Iu46X{~;Cxz}O>*L%|KZL8i zz>jTL`Z=LXU(zRXSy`bl6@8%C9kUl^mkjHW$9QY;vzzfh=k!a?;!+YIO4s&R0oNJ> zbADBi*ktG)OxnDMtYw1C@`)km6R+kNHxavm*rnj8QdjfNV#f9HkT)Z@7F;ywkrwW% zN<^K5n?)C^gn{igBc72Grh#r26~`1rDrK7UXfNR+y!b=mG0iqWtBtjoSD7Dh-59Vw z+vCR$C+=lrHz{=(JTY9mDIK;yKen-8D=FXQ54t9vZD=Rj$)r?o`67AohrLR2R>ui% zG|*Fla^A1DtYwQ!YS$KeCPl%ZmGXVJ;`87zmHhXB0!Nf!!Z4*%FanvflAx&5nCORx z$UYHAa~#6Vx7^z72{Q#bZ6ti^4QU;IJp0-&riL~v&L|_RUj{b^_(-UnZfSa>c_Yp3BM^U@p--Q05B;q0I>@hWpS0wN?7le;m>LnY}HOWyIrDJd(1dz7yFrZxBKfwQ+2(UT{0Dc6{OVr$Z?P~63;!pct|m}L z@%|;@YpY2V-LX|QRZxGF^V!Qwlr^wF=}3*^fXsD>EA5~=lVLEMla?nqToBdAKVqKJ z4+9o8_%7~Yw;slL82F2t%>K^JBgiJ=mx87RtV|6MBL~y#rnh_lrEH{?vf-0*vP}_5 za&w-^hq*2ZAU*j40%jWjX1#^0qs^l30}^ju{7&ld6eoU8Y|y*-1X%9q8XM)B7t7X( zxY)R=3)B+Y!0!zhMHfZaf;K9AU33NAOK}w_V~2CaOeD|MUg^v3%QTnCfofJWuzNo@ zLm+zEu2H@m$RidKGlq)WDv->|d%pn(gvv>HjeTrK|F?Z!G^#k_^yG~b&#fNC8Kd`7 zn-5R0wKJ@8QumgYQMTdxh|aR`3(%4EYE%4@b4|M0bJI&(7jZ89QM zowJ07SfAxY;3cRXUlcub zLP6DIY%#xDEiMs|PaOOEGK}&C@H%b&>udM=()JU@{W0i~Ezvt4=fBAEIdG%fNrL2# zg+4Q-aLk<0Wy@UU_x-rWlI9-M>Ux5A(DeS1-qgn6(!O#|t zTYafoTw%VMXQUUUiEiL7Si0=&yXa9kc6d9^jSjad3`%-Yf8zg@?Q} z>dsjM@BaLG<%k!HD>u_p(by+2~pnsdP%xbc!BARz6dIcTYx`kEpco_r7&6T$1 z{kyv^*JcPD5AmA`T@>d&Cbsq~@-{6`00GyTchvb_6kk?I;<()2R6Pm{x{w-RmIb>+ zXy^?6w{UF|n3nrQSN_Ije@~e0htJTM>cs?7l$s z&FW5U;WQf(W9A_vgax`qAk=eH9uU}T+Y<3WpC1ZgCq70ep<3M7Vbtbi?jW`=4nklI z$vHMhA{bT|V=pv-;>-xyynSLiMsiGOl`f;+N}2kH3P)};lIz_isVwHenI zh|H;@#b0!g0r9Q2i;XzBh6V>*cW0?#dbjy>Y$&>*F@+5$^26vN0{r?cQ*z<3`z!uEd9| z5oOS9aI8IMJkiq-nA0A6B68Hx1z~egUYPhYT#VXk3^pL3;vd_2_#=3g5D~3@!geGp zVp4-_SYmd?zY{It1=BWK1Z*M9o@-x;Xtf>Y!YSOS;k{7o>*+>$3V?-XKa=DNx#QS~ zz1LcfeP7ZD@zYP4NGQtM=-U@ZA7X+O+|)V#v`@qrjpHS6(05y8c2>ns6!NM7MlC2@ zh{}psQhZNd6!Mj{R%NDFqLg`Y?ho`(+0pCCp?lhdhJ_2=6&q!G7xNZZLb^Z{1d z$S4F~B8-49n}iz+t6Buj1To3+oB2Ml9HK)xr`7aqV!vv3YJGE~zj0A;?*J8_Gr$wa zd&|${Iw&AuVCE&vHT&&V+R%VtjRM%~&*XVb=G=VvVuDP{hUaLu;42<;f0ZhsU7vhn zz5oZ|SPiH-`$4BRX_AHP;MEw~lytqy#)K4U4+Fh*Q!FKfs-|r;+W$%tM}n*`M<66t zv&NM%u@v3TNb#aAelSu6N}vD$00000 c0000000000000000000000000000000Kr;4x&QzG literal 0 HcmV?d00001 diff --git a/boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst b/boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst new file mode 100644 index 00000000000..fa896f98398 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst @@ -0,0 +1,134 @@ +.. _nrf54l15pdk_nrf54l15: + +nRF54L15 PDK +############ + +Overview +******** + +The nRF54L15 Preview Development Kit hardware provides +support for the Nordic Semiconductor nRF54L15 Arm Cortex-M33 CPU and +the following devices: + +* :abbr:`SAADC (Successive Approximation Analog to Digital Converter)` +* CLOCK +* RRAM +* :abbr:`GPIO (General Purpose Input Output)` +* :abbr:`TWIM (I2C-compatible two-wire interface master with EasyDMA)` +* :abbr:`MPU (Memory Protection Unit)` +* :abbr:`NVIC (Nested Vectored Interrupt Controller)` +* :abbr:`PWM (Pulse Width Modulation)` +* :abbr:`GRTC (Global real-time counter)` +* Segger RTT (RTT Console) +* :abbr:`SPI (Serial Peripheral Interface)` +* :abbr:`UARTE (Universal asynchronous receiver-transmitter)` +* :abbr:`WDT (Watchdog Timer)` + +.. figure:: img/nrf54l15pdk_nrf54l15.webp + :align: center + :alt: nRF54L15 PDK + + nRF54L15 PDK (Credit: Nordic Semiconductor) + +Hardware +******** + +nRF54L15 PDK has two crystal oscillators: + +* High-frequency 32 MHz crystal oscillator (HFXO) +* Low-frequency 32.768 kHz crystal oscillator (LFXO) + +The crystal oscillators can be configured to use either +internal or external capacitors. + +Supported Features +================== + +The nrf54l15pdk_nrf54l15 board configuration supports the following +hardware features: + ++-----------+------------+----------------------+ +| Interface | Controller | Driver/Component | ++===========+============+======================+ +| SAADC | on-chip | adc | ++-----------+------------+----------------------+ +| CLOCK | on-chip | clock_control | ++-----------+------------+----------------------+ +| RRAM | on-chip | flash | ++-----------+------------+----------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+----------------------+ +| TWIM | on-chip | i2c | ++-----------+------------+----------------------+ +| MPU | on-chip | arch/arm | ++-----------+------------+----------------------+ +| NVIC | on-chip | arch/arm | ++-----------+------------+----------------------+ +| PWM | on-chip | pwm | ++-----------+------------+----------------------+ +| GRTC | on-chip | counter | ++-----------+------------+----------------------+ +| RTT | Segger | console | ++-----------+------------+----------------------+ +| SPI(M/S) | on-chip | spi | ++-----------+------------+----------------------+ +| SPU | on-chip | system protection | ++-----------+------------+----------------------+ +| UARTE | on-chip | serial | ++-----------+------------+----------------------+ +| WDT | on-chip | watchdog | ++-----------+------------+----------------------+ + +Other hardware features have not been enabled yet for this board. + +Programming and Debugging +************************* + +Applications for the ``nrf54l15pdk_nrf54l15_cpuapp`` board 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 +======== + +As an example, this section shows how to build and flash the :ref:`hello_world` +application. + +.. warning:: + + When programming the device, you might get an error similar to the following message:: + + ERROR: The operation attempted is unavailable due to readback protection in + ERROR: your device. Please use --recover to unlock the device. + + This error occurs when readback protection is enabled. + To disable the readback protection, you must *recover* your device. + + Enter the following command to recover the core:: + + west flash --recover + + The ``--recover`` command erases the flash memory and then writes a small binary into + the recovered flash memory. + This binary prevents the readback protection from enabling itself again after a pin + reset or power cycle. + +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`. + +To build and program the sample to the nRF54L15 PDK, complete the following steps: + +First, connect the nRF54L15 PDK to you computer using the IMCU USB port on the PDK. +Next, build the sample by running the following command: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: nrf54l15pdk_nrf54l15_cpuapp + :goals: build flash + +Testing the LEDs and buttons in the nRF54L15 PDK +************************************************ + +Test the nRF54L15 PDK with a :zephyr:code-sample:`blinky` sample. diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi new file mode 100644 index 00000000000..02b02bc8171 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart20_default: uart20_default { + group1 { + psels = , + ; + }; + }; + + uart20_sleep: uart20_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart30_default: uart30_default { + group1 { + psels = , + ; + }; + }; + + uart30_sleep: uart30_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts new file mode 100644 index 00000000000..1e0245f6cc3 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi" +#include + +/ { + model = "Nordic nRF54L15 PDK nRF54L15 Application MCU"; + compatible = "nordic,nrf54l15pdk_nrf54l15-cpuapp"; + + chosen { + zephyr,console = &uart20; + zephyr,shell-uart = &uart20; + zephyr,sram = &sram0; + zephyr,flash = &rram0; + zephyr,code-partition = &slot0_partition; + zephyr,ieee802154 = &ieee802154; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + led1: led_1 { + gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + led2: led_2 { + gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + led3: led_3 { + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; + + buttons { + compatible = "gpio-keys"; + button0: button_0 { + gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 0"; + zephyr,code = ; + }; + button1: button_1 { + gpios = <&gpio1 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 1"; + zephyr,code = ; + }; + button2: button_2 { + gpios = <&gpio2 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 2"; + zephyr,code = ; + }; + button3: button_3 { + gpios = <&gpio2 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 3"; + zephyr,code = ; + }; + }; + + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + watchdog0 = &wdt30; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + }; +}; + +&lfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15500>; +}; + +&hfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15000>; +}; + +&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"; +}; + +&grtc { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&rram0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + slot0_partition: partition@0 { + label = "image-0"; + reg = <0x0 DT_SIZE_K(64)>; + }; + storage_partition: partition@f2000 { + label = "storage"; + reg = <0xf2000 DT_SIZE_K(24)>; + }; + }; +}; + +&clock { + status = "okay"; +}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml new file mode 100644 index 00000000000..de5ce29d162 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml @@ -0,0 +1,19 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54l15pdk_nrf54l15_cpuapp +name: nRF54l15-PDK-nRF54l15-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 256 +flash: 1536 +supported: + - gpio + - i2c + - spi + - watchdog + - i2s diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_defconfig b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_defconfig new file mode 100644 index 00000000000..bc74c3eeb33 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_defconfig @@ -0,0 +1,32 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54LX=y +CONFIG_SOC_NRF54L15_ENGA_CPUAPP=y +CONFIG_BOARD_NRF54L15PDK_NRF54L15_CPUAPP=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 + +CONFIG_UART_CONSOLE=y +CONFIG_CONSOLE=y +CONFIG_SERIAL=y + +# Enable GPIO +CONFIG_GPIO=y + +CONFIG_SOC_NRF_FORCE_CONSTLAT=y + +# Start SYSCOUNTER on driver init +CONFIG_NRF_GRTC_START_SYSCOUNTER=y diff --git a/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake b/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake new file mode 100644 index 00000000000..4fe5b260db3 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +board_check_revision(FORMAT MAJOR.MINOR.PATCH + VALID_REVISIONS 0.2.0 + DEFAULT_REVISION 0.2.0) From f4ded0b8a67fa86a820716f4322980ea00a08beb Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Mon, 11 Dec 2023 15:01:50 +0100 Subject: [PATCH 0253/2300] [nrf fromtree] drivers: cache: add Nordic cache driver Add Nordic driver for cache. Signed-off-by: Witold Lukasik (cherry picked from commit 6d3009ff2bf80a8e76f1ab928a65b14621f05bb3) (cherry picked from commit 4ae085e8116590eb7f3b00ee8e7602bac071fdd8) --- drivers/cache/CMakeLists.txt | 1 + drivers/cache/Kconfig | 1 + drivers/cache/Kconfig.nrf | 9 + drivers/cache/cache_nrf.c | 390 +++++++++++++++++++++++++++++++++++ 4 files changed, 401 insertions(+) create mode 100644 drivers/cache/Kconfig.nrf create mode 100644 drivers/cache/cache_nrf.c diff --git a/drivers/cache/CMakeLists.txt b/drivers/cache/CMakeLists.txt index 47c790f0a89..23cb11afb6a 100644 --- a/drivers/cache/CMakeLists.txt +++ b/drivers/cache/CMakeLists.txt @@ -7,3 +7,4 @@ zephyr_library_property(ALLOW_EMPTY TRUE) zephyr_library_sources_ifdef(CONFIG_CACHE_ASPEED cache_aspeed.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE cache_handlers.c) +zephyr_library_sources_ifdef(CONFIG_CACHE_NRF_CACHE cache_nrf.c) diff --git a/drivers/cache/Kconfig b/drivers/cache/Kconfig index 834cc49e181..4dcb64f488a 100644 --- a/drivers/cache/Kconfig +++ b/drivers/cache/Kconfig @@ -19,5 +19,6 @@ source "subsys/logging/Kconfig.template.log_config" comment "Device Drivers" source "drivers/cache/Kconfig.aspeed" +source "drivers/cache/Kconfig.nrf" endif # CACHE diff --git a/drivers/cache/Kconfig.nrf b/drivers/cache/Kconfig.nrf new file mode 100644 index 00000000000..820445db432 --- /dev/null +++ b/drivers/cache/Kconfig.nrf @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Carlo Caione +# SPDX-License-Identifier: Apache-2.0 + +config CACHE_NRF_CACHE + bool "nRF cache driver" + select CACHE_HAS_DRIVER + depends on HAS_NRFX && CACHE_MANAGEMENT + help + Enable support for the nRF cache driver. diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c new file mode 100644 index 00000000000..63d76a47d6e --- /dev/null +++ b/drivers/cache/cache_nrf.c @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include + +LOG_MODULE_REGISTER(cache_nrfx, CONFIG_CACHE_LOG_LEVEL); + +#if !defined(NRF_ICACHE) && defined(NRF_CACHE) +#define NRF_ICACHE NRF_CACHE +#endif + +#define CACHE_LINE_SIZE 32 +#define CACHE_BUSY_RETRY_INTERVAL_US 10 + +static struct k_spinlock lock; + +enum k_nrf_cache_op { + /* + * Sequentially loop through all dirty lines and write those data units to + * memory. + * + * This is FLUSH in Zephyr nomenclature. + */ + K_NRF_CACHE_CLEAN, + + /* + * Mark all lines as invalid, ignoring any dirty data. + * + * This is INVALIDATE in Zephyr nomenclature. + */ + K_NRF_CACHE_INVD, + + /* + * Clean followed by invalidate + * + * This is FLUSH_AND_INVALIDATE in Zephyr nomenclature. + */ + K_NRF_CACHE_FLUSH, +}; + +static inline bool is_cache_busy(NRF_CACHE_Type *cache) +{ +#if NRF_CACHE_HAS_STATUS + return nrf_cache_busy_check(cache); +#else + return false; +#endif +} + +static inline void wait_for_cache(NRF_CACHE_Type *cache) +{ + while (is_cache_busy(cache)) { + k_busy_wait(CACHE_BUSY_RETRY_INTERVAL_US); + } +} + +static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) +{ + /* + * We really do not want to invalidate the whole cache. + */ + if (op == K_NRF_CACHE_INVD) { + return -ENOTSUP; + } + + k_spinlock_key_t key = k_spin_lock(&lock); + + /* + * Invalidating the whole cache is dangerous. For good measure + * disable the cache. + */ + nrf_cache_disable(cache); + + wait_for_cache(cache); + + switch (op) { + +#if NRF_CACHE_HAS_TASK_CLEAN + case K_NRF_CACHE_CLEAN: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANCACHE); + break; +#endif + + case K_NRF_CACHE_INVD: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATECACHE); + break; + +#if NRF_CACHE_HAS_TASK_FLUSH + case K_NRF_CACHE_FLUSH: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHCACHE); + break; +#endif + + default: + break; + } + + wait_for_cache(cache); + + nrf_cache_enable(cache); + + k_spin_unlock(&lock, key); + + return 0; +} + +static inline void _cache_line(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, uintptr_t line_addr) +{ + wait_for_cache(cache); + + nrf_cache_lineaddr_set(cache, line_addr); + + switch (op) { + +#if NRF_CACHE_HAS_TASK_CLEAN + case K_NRF_CACHE_CLEAN: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANLINE); + break; +#endif + + case K_NRF_CACHE_INVD: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATELINE); + break; + +#if NRF_CACHE_HAS_TASK_FLUSH + case K_NRF_CACHE_FLUSH: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHLINE); + break; +#endif + + default: + break; + } + + wait_for_cache(cache); +} + +static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, void *addr, + size_t size) +{ + uintptr_t line_addr = (uintptr_t)addr; + uintptr_t end_addr = line_addr + size; + + /* + * Align address to line size + */ + line_addr &= ~(CACHE_LINE_SIZE - 1); + + do { + k_spinlock_key_t key = k_spin_lock(&lock); + + _cache_line(cache, op, line_addr); + + k_spin_unlock(&lock, key); + + line_addr += CACHE_LINE_SIZE; + + } while (line_addr < end_addr); + + return 0; +} + +static inline int _cache_checks(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, void *addr, + size_t size, bool is_range) +{ + /* Check if the cache is enabled */ + if (!(cache->ENABLE & CACHE_ENABLE_ENABLE_Enabled)) { + return -EAGAIN; + } + + if (!is_range) { + return _cache_all(cache, op); + } + + /* Check for invalid address or size */ + if ((!addr) || (!size)) { + return -EINVAL; + } + + return _cache_range(cache, op, addr, size); +} + +#if defined(NRF_DCACHE) && NRF_CACHE_HAS_TASKS + +void cache_data_enable(void) +{ + nrf_cache_enable(NRF_DCACHE); +} + +void cache_data_disable(void) +{ + nrf_cache_disable(NRF_DCACHE); +} + +int cache_data_flush_all(void) +{ +#if NRF_CACHE_HAS_TASK_CLEAN + return _cache_checks(NRF_DCACHE, K_NRF_CACHE_CLEAN, NULL, 0, false); +#else + return -ENOTSUP; +#endif +} + +int cache_data_invd_all(void) +{ + return _cache_checks(NRF_DCACHE, K_NRF_CACHE_INVD, NULL, 0, false); +} + +int cache_data_flush_and_invd_all(void) +{ +#if NRF_CACHE_HAS_TASK_FLUSH + return _cache_checks(NRF_DCACHE, K_NRF_CACHE_FLUSH, NULL, 0, false); +#else + return -ENOTSUP; +#endif +} + +int cache_data_flush_range(void *addr, size_t size) +{ +#if NRF_CACHE_HAS_TASK_CLEAN + return _cache_checks(NRF_DCACHE, K_NRF_CACHE_CLEAN, addr, size, true); +#else + return -ENOTSUP; +#endif +} + +int cache_data_invd_range(void *addr, size_t size) +{ + return _cache_checks(NRF_DCACHE, K_NRF_CACHE_INVD, addr, size, true); +} + +int cache_data_flush_and_invd_range(void *addr, size_t size) +{ +#if NRF_CACHE_HAS_TASK_FLUSH + return _cache_checks(NRF_DCACHE, K_NRF_CACHE_FLUSH, addr, size, true); +#else + return -ENOTSUP; +#endif +} + +#else + +void cache_data_enable(void) +{ + /* Nothing */ +} + +void cache_data_disable(void) +{ + /* Nothing */ +} + +int cache_data_flush_all(void) +{ + return -ENOTSUP; +} + +int cache_data_invd_all(void) +{ + return -ENOTSUP; +} + +int cache_data_flush_and_invd_all(void) +{ + return -ENOTSUP; +} + +int cache_data_flush_range(void *addr, size_t size) +{ + return -ENOTSUP; +} + +int cache_data_invd_range(void *addr, size_t size) +{ + return -ENOTSUP; +} + +int cache_data_flush_and_invd_range(void *addr, size_t size) +{ + return -ENOTSUP; +} + +#endif /* NRF_DCACHE */ + +#if defined(NRF_ICACHE) && NRF_CACHE_HAS_TASKS + +void cache_instr_enable(void) +{ + nrf_cache_enable(NRF_ICACHE); +} + +void cache_instr_disable(void) +{ + nrf_cache_disable(NRF_ICACHE); +} + +int cache_instr_flush_all(void) +{ +#if NRF_CACHE_HAS_TASK_CLEAN + return _cache_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN, NULL, 0, false); +#else + return -ENOTSUP; +#endif +} + +int cache_instr_invd_all(void) +{ + return _cache_checks(NRF_ICACHE, K_NRF_CACHE_INVD, NULL, 0, false); +} + +int cache_instr_flush_and_invd_all(void) +{ +#if NRF_CACHE_HAS_TASK_FLUSH + return _cache_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH, NULL, 0, false); +#else + return -ENOTSUP; +#endif +} + +int cache_instr_flush_range(void *addr, size_t size) +{ +#if NRF_CACHE_HAS_TASK_CLEAN + return _cache_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN, addr, size, true); +#else + return -ENOTSUP; +#endif +} + +int cache_instr_invd_range(void *addr, size_t size) +{ + return _cache_checks(NRF_ICACHE, K_NRF_CACHE_INVD, addr, size, true); +} + +int cache_instr_flush_and_invd_range(void *addr, size_t size) +{ +#if NRF_CACHE_HAS_TASK_FLUSH + return _cache_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH, addr, size, true); +#else + return -ENOTSUP; +#endif +} + +#else + +void cache_instr_enable(void) +{ + /* Nothing */ +} + +void cache_instr_disable(void) +{ + /* Nothing */ +} + +int cache_instr_flush_all(void) +{ + return -ENOTSUP; +} + +int cache_instr_invd_all(void) +{ + return -ENOTSUP; +} + +int cache_instr_flush_and_invd_all(void) +{ + return -ENOTSUP; +} + +int cache_instr_flush_range(void *addr, size_t size) +{ + return -ENOTSUP; +} + +int cache_instr_invd_range(void *addr, size_t size) +{ + return -ENOTSUP; +} + +int cache_instr_flush_and_invd_range(void *addr, size_t size) +{ + return -ENOTSUP; +} + +#endif /* NRF_ICACHE */ From e141bc55f6860d2aee9242ffeae3b44d1a7062d8 Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Mon, 11 Dec 2023 17:44:16 +0100 Subject: [PATCH 0254/2300] [nrf fromtree] scripts: west_commands: runners: nrf_common: add support for nRF54L Add support for new Nordic family in west commands. Signed-off-by: Witold Lukasik (cherry picked from commit 13abdcccb3f81d1f0299246b298b74b984e8f74a) (cherry picked from commit a47efab18d29ecb73ac8f251000382eb1ec01a34) --- scripts/west_commands/runners/nrf_common.py | 4 +++- scripts/west_commands/runners/nrfjprog.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 2ff51d7e85d..788021c6191 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -59,7 +59,7 @@ def dev_id_help(cls) -> str: @classmethod def do_add_parser(cls, parser): parser.add_argument('--nrf-family', - choices=['NRF51', 'NRF52', 'NRF53', 'NRF91'], + choices=['NRF51', 'NRF52', 'NRF53', 'NRF54L', 'NRF91'], help='''MCU family; still accepted for compatibility only''') parser.add_argument('--softreset', required=False, @@ -161,6 +161,8 @@ def ensure_family(self): self.family = 'NRF52_FAMILY' elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF53X'): self.family = 'NRF53_FAMILY' + elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF54LX'): + self.family = 'NRF54L_FAMILY' elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF91X'): self.family = 'NRF91_FAMILY' else: diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index 8762ce0e740..a28681ae6a5 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -46,7 +46,7 @@ def do_exec_op(self, op, force=False): # Translate the op families = {'NRF51_FAMILY': 'NRF51', 'NRF52_FAMILY': 'NRF52', - 'NRF53_FAMILY': 'NRF53', 'NRF91_FAMILY': 'NRF91'} + 'NRF53_FAMILY': 'NRF53', 'NRF54L_FAMILY': 'NRF54L', 'NRF91_FAMILY': 'NRF91'} cores = {'NRFDL_DEVICE_CORE_APPLICATION': 'CP_APPLICATION', 'NRFDL_DEVICE_CORE_NETWORK': 'CP_NETWORK'} From c4ab770ca4f55518376ebe2424cc46969cf43cb8 Mon Sep 17 00:00:00 2001 From: Witold Lukasik Date: Tue, 12 Dec 2023 10:39:07 +0100 Subject: [PATCH 0255/2300] [nrf fromtree] tests: arch: arm: arm: align tests to nRF54L15 Changed _ISR_OFFSET to be 28 as specified in OPS. Removed console ISR. Signed-off-by: Witold Lukasik (cherry picked from commit cac2990c04d6ea9c63031c7ef3c4ab830dedcb68) (cherry picked from commit cd00d9b92c50731de56bd30f23b531c56bca2ee6) --- .../src/arm_irq_vector_table.c | 120 +++++------------- 1 file changed, 35 insertions(+), 85 deletions(-) diff --git a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c index 7d793066109..f18c30dac9a 100644 --- a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c +++ b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c @@ -16,66 +16,22 @@ */ #define _ISR_OFFSET 0 -#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) -/* The customized solution for nRF51X-based and nRF52X-based - * platforms requires that the POWER_CLOCK_IRQn line equals 0. - */ -BUILD_ASSERT(POWER_CLOCK_IRQn == 0, - "POWER_CLOCK_IRQn != 0. Consider rework manual vector table."); - -/* The customized solution for nRF51X-based and nRF52X-based - * platforms requires that the RTC1 IRQ line equals 17. - */ -BUILD_ASSERT(RTC1_IRQn == 17, - "RTC1_IRQn != 17. Consider rework manual vector table."); - +#if defined(CONFIG_SOC_FAMILY_NRF) #undef _ISR_OFFSET -#if !defined(CONFIG_BOARD_QEMU_CORTEX_M0) -/* Interrupt line 0 is used by POWER_CLOCK */ -#define _ISR_OFFSET 1 +#if defined(CONFIG_BOARD_QEMU_CORTEX_M0) +/* For the nRF51-based QEMU Cortex-M0 platform, the first set of consecutive + * implemented interrupts that can be used by this test starts right after + * the TIMER0 IRQ line, which is used by the system timer. + */ +#define _ISR_OFFSET (TIMER0_IRQn + 1) +#elif defined(CONFIG_SOC_SERIES_NRF54LX) +/* For nRF54L Series, use SWI00-02 interrupt lines. */ +#define _ISR_OFFSET SWI00_IRQn #else -/* The customized solution for nRF51-based QEMU Cortex-M0 platform - * requires that the TIMER0 IRQ line equals 8. - */ -BUILD_ASSERT(TIMER0_IRQn == 8, - "TIMER0_IRQn != 8. Consider rework manual vector table."); -/* Interrupt lines 9-11 is the first set of consecutive interrupts implemented - * in QEMU Cortex M0. - */ -#define _ISR_OFFSET 9 - +/* For other nRF targets, use TIMER0-2 interrupt lines. */ +#define _ISR_OFFSET TIMER0_IRQn #endif - -#elif defined(CONFIG_SOC_SERIES_NRF53X) || defined(CONFIG_SOC_SERIES_NRF91X) -/* The customized solution for nRF91X-based and nRF53X-based - * platforms requires that the POWER_CLOCK_IRQn line equals 5. - */ -BUILD_ASSERT(CLOCK_POWER_IRQn == 5, - "POWER_CLOCK_IRQn != 5." - "Consider rework manual vector table."); - -#if !defined(CONFIG_SOC_NRF5340_CPUNET) -/* The customized solution for nRF91X-based platforms - * requires that the RTC1 IRQ line equals 21. - */ -BUILD_ASSERT(RTC1_IRQn == 21, - "RTC1_IRQn != 21. Consider rework manual vector table."); - -#else /* CONFIG_SOC_NRF5340_CPUNET */ -/* The customized solution for nRF5340_CPUNET - * requires that the RTC1 IRQ line equals 22. - */ -BUILD_ASSERT(RTC1_IRQn == 22, - "RTC1_IRQn != 22. Consider rework manual vector table."); -#endif -#undef _ISR_OFFSET -/* Interrupt lines 8-10 is the first set of consecutive interrupts implemented - * in nRF9160 SOC. - */ -#define _ISR_OFFSET 8 - -#endif /* CONFIG_SOC_SERIES_NRF52X */ - +#endif /* CONFIG_SOC_FAMILY_NRF */ struct k_sem sem[3]; @@ -182,40 +138,34 @@ typedef void (*vth)(void); /* Vector Table Handler */ * * Note: qemu_cortex_m0 uses TIMER0 to implement system timer. */ -void rtc_nrf_isr(void); void nrfx_power_clock_irq_handler(void); #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) +#define POWER_CLOCK_IRQ_NUM POWER_CLOCK_IRQn +#else +#define POWER_CLOCK_IRQ_NUM CLOCK_POWER_IRQn +#endif + #if defined(CONFIG_BOARD_QEMU_CORTEX_M0) void timer0_nrf_isr(void); -vth __irq_vector_table _irq_vector_table[] = { - nrfx_power_clock_irq_handler, 0, 0, 0, 0, 0, 0, 0, - timer0_nrf_isr, isr0, isr1, isr2 -}; -#else -vth __irq_vector_table _irq_vector_table[] = { - nrfx_power_clock_irq_handler, - isr0, isr1, isr2, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - rtc_nrf_isr -}; -#endif /* CONFIG_BOARD_QEMU_CORTEX_M0 */ -#elif defined(CONFIG_SOC_SERIES_NRF53X) || defined(CONFIG_SOC_SERIES_NRF91X) -#ifndef CONFIG_SOC_NRF5340_CPUNET -vth __irq_vector_table _irq_vector_table[] = { - 0, 0, 0, 0, 0, nrfx_power_clock_irq_handler, 0, 0, - isr0, isr1, isr2, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - rtc_nrf_isr -}; +#define TIMER_IRQ_HANDLER timer0_nrf_isr +#define TIMER_IRQ_NUM TIMER0_IRQn +#elif defined(CONFIG_SOC_SERIES_NRF54LX) +void nrfx_grtc_irq_handler(void); +#define TIMER_IRQ_HANDLER nrfx_grtc_irq_handler +#define TIMER_IRQ_NUM GRTC_0_IRQn #else -vth __irq_vector_table _irq_vector_table[] = { - 0, 0, 0, 0, 0, nrfx_power_clock_irq_handler, 0, 0, - isr0, isr1, isr2, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - rtc_nrf_isr -}; -#endif +void rtc_nrf_isr(void); +#define TIMER_IRQ_HANDLER rtc_nrf_isr +#define TIMER_IRQ_NUM RTC1_IRQn #endif + +#define IRQ_VECTOR_TABLE_SIZE (MAX(POWER_CLOCK_IRQ_NUM, MAX(TIMER_IRQ_NUM, _ISR_OFFSET + 2)) + 1) + +vth __irq_vector_table _irq_vector_table[IRQ_VECTOR_TABLE_SIZE] = { + [POWER_CLOCK_IRQ_NUM] = nrfx_power_clock_irq_handler, + [TIMER_IRQ_NUM] = TIMER_IRQ_HANDLER, + [_ISR_OFFSET] = isr0, isr1, isr2, +}; #elif defined(CONFIG_SOC_SERIES_CC13X2_CC26X2) || defined(CONFIG_SOC_SERIES_CC13X2X7_CC26X2X7) /* TI CC13x2/CC26x2 based platforms also employ a Hardware RTC peripheral * to implement the Kernel system timer, instead of the ARM Cortex-M From 0aceeeb549ad60a4906be93c6878d8fc2146b0fd Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 23 Jan 2024 12:53:53 +0100 Subject: [PATCH 0256/2300] [nrf fromtree] tests: drivers: add overlay files for nRF54L15 Add nRF54L15 overlay files for driver tests that need them. Signed-off-by: Magdalena Pastula (cherry picked from commit d8203d2e1f4917447757dfabd92f286ac51021a1) (cherry picked from commit 0c6cdd39c2da00f7c73014b6462e2db097ca7b8c) --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 21 +++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 30 ++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 30 ++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 46 +++++++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 36 +++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 43 +++++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 36 +++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 9 ++++ 8 files changed, 251 insertions(+) create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/i2s/i2s_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/i2s/i2s_speed/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_pm/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..97702240047 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15pdk_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"; +}; diff --git a/tests/drivers/i2s/i2s_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/i2s/i2s_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..8b82825a0f2 --- /dev/null +++ b/tests/drivers/i2s/i2s_api/boards/nrf54l15pdk_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/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/i2s/i2s_speed/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..8b82825a0f2 --- /dev/null +++ b/tests/drivers/i2s/i2s_speed/boards/nrf54l15pdk_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/spi/spi_loopback/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..f2e84b72f9b --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi00_default: spi00_default { + group1 { + psels = , + , + ; + }; + }; + + spi00_sleep: spi00_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; + +&spi00 { + status = "okay"; + pinctrl-0 = <&spi00_default>; + pinctrl-1 = <&spi00_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 = ; + }; +}; + +&gpio2 { + status = "okay"; +}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..033aab401ac --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +/ { + chosen { + zephyr,console = &uart20; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..945b8628e7a --- /dev/null +++ b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; + +counter_dev: &timer00 { + status = "okay"; +}; + +&grtc { + interrupts = <228 2>; +}; diff --git a/tests/drivers/uart/uart_pm/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..033aab401ac --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +/ { + chosen { + zephyr,console = &uart20; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..aa2789dd45e --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt30 { + status = "okay"; +}; From 1aa018c7d6e57b52eb98a732a2c2d02a639443c2 Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 23 Jan 2024 14:42:22 +0100 Subject: [PATCH 0257/2300] [nrf fromtree] samples: add overlay files for nRF54L15 Add nRF54L15 overlays to samples that needed them. Signed-off-by: Magdalena Pastula (cherry picked from commit 361a5a11aa2ccb1f997b0de78b21eb6c3d94fb70) (cherry picked from commit 353b582a0fa5a6d6558e023630cb703652187679) --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 8 ++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 43 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 samples/sensor/qdec/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..66157d79fb3 --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt30 { + status = "okay"; +}; diff --git a/samples/sensor/qdec/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/samples/sensor/qdec/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..3d872a2071b --- /dev/null +++ b/samples/sensor/qdec/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -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 = <120>; + led-pre = <500>; +}; From d051c5a5b7d39cb5f650be1995fcdef719f17694 Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 9 Jan 2024 15:27:01 +0100 Subject: [PATCH 0258/2300] [nrf fromtree] drivers: hwinfo: update to be aligned to nRF54L15 Update hwinfo driver to be aligned to nRF54L15. Signed-off-by: Magdalena Pastula (cherry picked from commit 5a32e6e21c2270641ba834e33470ff845afba437) (cherry picked from commit 47e402dd4afa48668b44a6b2bcba7b4631b96753) --- drivers/hwinfo/hwinfo_nrf.c | 60 ++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/drivers/hwinfo/hwinfo_nrf.c b/drivers/hwinfo/hwinfo_nrf.c index 2a79f1d0c0d..4375cf05b2f 100644 --- a/drivers/hwinfo/hwinfo_nrf.c +++ b/drivers/hwinfo/hwinfo_nrf.c @@ -58,22 +58,56 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause) if (reason & NRFX_RESET_REASON_DIF_MASK) { flags |= RESET_DEBUG; } + if (reason & NRFX_RESET_REASON_SREQ_MASK) { + flags |= RESET_SOFTWARE; + } -#if !NRF_POWER_HAS_RESETREAS +#if NRFX_RESET_REASON_HAS_CTRLAP if (reason & NRFX_RESET_REASON_CTRLAP_MASK) { flags |= RESET_DEBUG; } - if (reason & NRFX_RESET_REASON_DOG0_MASK) { - flags |= RESET_WATCHDOG; +#endif +#if NRFX_RESET_REASON_HAS_LPCOMP + if (reason & NRFX_RESET_REASON_LPCOMP_MASK) { + flags |= RESET_LOW_POWER_WAKE; + } +#endif +#if NRFX_RESET_REASON_HAS_NFC + if (reason & NRFX_RESET_REASON_NFC_MASK) { + flags |= RESET_LOW_POWER_WAKE; + } +#endif +#if NRFX_RESET_REASON_HAS_VBUS + if (reason & NRFX_RESET_REASON_VBUS_MASK) { + flags |= RESET_POR; + } +#endif +#if NRFX_RESET_REASON_HAS_CTRLAPSOFT + if (reason & NRFX_RESET_REASON_CTRLAPSOFT_MASK) { + flags |= RESET_DEBUG; + } +#endif +#if NRFX_RESET_REASON_HAS_CTRLAPHARD + if (reason & NRFX_RESET_REASON_CTRLAPHARD_MASK) { + flags |= RESET_DEBUG; + } +#endif +#if NRFX_RESET_REASON_HAS_CTRLAPPIN + if (reason & NRFX_RESET_REASON_CTRLAPPIN_MASK) { + flags |= RESET_DEBUG; } +#endif +#if !NRF_POWER_HAS_RESETREAS if (reason & NRFX_RESET_REASON_DOG1_MASK) { flags |= RESET_WATCHDOG; } - if (reason & NRFX_RESETREAS_SREQ_MASK) { - flags |= RESET_SOFTWARE; +#endif +#if NRFX_RESET_REASON_HAS_GRTC + if (reason & NRFX_RESET_REASON_GRTC_MASK) { + flags |= RESET_CLOCK; } - -#if NRF_RESET_HAS_NETWORK +#endif +#if NRFX_RESET_REASON_HAS_NETWORK if (reason & NRFX_RESET_REASON_LSREQ_MASK) { flags |= RESET_SOFTWARE; } @@ -87,10 +121,14 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause) flags |= RESET_DEBUG; } #endif - -#else - if (reason & NRFX_RESET_REASON_SREQ_MASK) { - flags |= RESET_SOFTWARE; +#if defined(NRFX_RESET_REASON_TAMPC_MASK) + if (reason & NRFX_RESET_REASON_TAMPC_MASK) { + flags |= RESET_SECURITY; + } +#endif +#if defined(NRFX_RESET_REASON_SECTAMPER_MASK) + if (reason & NRFX_RESET_REASON_SECTAMPER_MASK) { + flags |= RESET_SECURITY; } #endif From f3757a85b149a78b9b7d2d6cb12467c800dd981a Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 16 Jan 2024 17:24:22 +0100 Subject: [PATCH 0259/2300] [nrf fromtree] soc: arm: nordic_nrf: align soc_secure.h to nRF54L In nRF54L15 FICR can be accessed also from non-secure code, so it does not have NRF_FICR_S defined. Signed-off-by: Magdalena Pastula (cherry picked from commit e4aebf9cea50e26c666aa69b9de4a802b9bcc6dc) (cherry picked from commit 3fea81732e92a899f5aaa704f75bcd83032f30a6) --- soc/arm/nordic_nrf/common/soc_secure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/arm/nordic_nrf/common/soc_secure.h b/soc/arm/nordic_nrf/common/soc_secure.h index 948f38547aa..d38d66ab488 100644 --- a/soc/arm/nordic_nrf/common/soc_secure.h +++ b/soc/arm/nordic_nrf/common/soc_secure.h @@ -59,7 +59,7 @@ static inline void soc_secure_gpio_pin_mcu_select(uint32_t pin_number, #if defined(CONFIG_SOC_HFXO_CAP_INTERNAL) static inline uint32_t soc_secure_read_xosc32mtrim(void) { - return NRF_FICR_S->XOSC32MTRIM; + return NRF_FICR->XOSC32MTRIM; } #endif /* defined(CONFIG_SOC_HFXO_CAP_INTERNAL) */ From af627187895ac36af25032bf592b4a0d419bdb1d Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 30 Jan 2024 10:40:15 +0100 Subject: [PATCH 0260/2300] [nrf fromtree] tests: lib: cpp: exclude nRF54L15 Exclude nRF54L15 from possible targets as its HAL is incompatible with C++98. Signed-off-by: Magdalena Pastula (cherry picked from commit d7d254140d02ef30821262853e46c794f7b515e5) (cherry picked from commit 6751caf4f67d9fc8cff31a107360db8da5d52ab1) --- 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 77d1b06dbb2..cbdaacf714c 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -34,6 +34,8 @@ tests: # -std=c++98) cpp.main.cpp98: arch_exclude: posix + # Exclude nRF54L15 as its HAL is not compatible with C++98. + platform_exclude: nrf54l15pdk_nrf54l15_cpuapp build_only: true extra_configs: - CONFIG_STD_CPP98=y From 332c3a32ebde869df10a5166b09892a010bdd043 Mon Sep 17 00:00:00 2001 From: Jeremy Bettis Date: Wed, 20 Dec 2023 22:36:20 +0000 Subject: [PATCH 0261/2300] [nrf fromtree] tests: Add unittest for gpio_ite_it8xxx2_v2 Add a unittest for 100% of the lines in gpio_ite_it8xxx2_v2. The test fakes the registers by overriding the ECREG macro to call a function provided by the test. Does not test the code guarded by CONFIG_SOC_IT8XXX2_GPIO_GROUP_K_L_DEFAULT_PULL_DOWN Bug #66401 Signed-off-by: Jeremy Bettis (cherry picked from commit 6c567d489974933f152a532a7e9400b8f6b9bc5d) (cherry picked from commit 11ebed1212a667337a8baf835ff455d7faac0903) --- .../gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt | 23 + .../drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig | 12 + .../boards/native_sim.overlay | 45 ++ .../include/chip_chipregs.h | 20 + .../include/zephyr/arch/cpu.h | 16 + .../drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf | 9 + .../gpio/gpio_ite_it8xxx2_v2/src/main.c | 460 ++++++++++++++++++ .../gpio/gpio_ite_it8xxx2_v2/testcase.yaml | 14 + 8 files changed, 599 insertions(+) create mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt create mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig create mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/boards/native_sim.overlay create mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h create mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/zephyr/arch/cpu.h create mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf create mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c create mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/testcase.yaml diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt new file mode 100644 index 00000000000..bf01055ffc3 --- /dev/null +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright 2023 The ChromiumOS Authors +# +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(gpio_ite_it8xxx2_v2) + +target_include_directories(app PRIVATE + include +) + +zephyr_include_directories( + include + ${ZEPHYR_BASE}/soc/riscv/riscv-ite/common + ${ZEPHYR_BASE}/soc/riscv/riscv-ite/it8xxx2 +) + +target_sources(app + PRIVATE + src/main.c +) diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig new file mode 100644 index 00000000000..bb5e43e8e20 --- /dev/null +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig @@ -0,0 +1,12 @@ +# Copyright 2023 The ChromiumOS Authors +# +# SPDX-License-Identifier: Apache-2.0 + +source "Kconfig.zephyr" + +config SOC_IT8XXX2_GPIO_GROUP_K_L_DEFAULT_PULL_DOWN + bool + default n +config HAS_ITE_INTC + bool + default y diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/boards/native_sim.overlay b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/boards/native_sim.overlay new file mode 100644 index 00000000000..7f22c83ffb1 --- /dev/null +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/boards/native_sim.overlay @@ -0,0 +1,45 @@ +/* + * Copyright 2023 The ChromiumOS Authors + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +/ { + intc: interrupt-controller@f03f00 { + compatible = "vnd,intc"; + #address-cells = <0>; + #interrupt-cells = <2>; + interrupt-controller; + reg = <0x00f03f00 0x0100>; + }; + + gpioa: gpio@f01601 { + compatible = "ite,it8xxx2-gpio-v2"; + reg = <0x00f01601 1 /* GPDR (set) */ + 0x00f01618 1 /* GPDMR (get) */ + 0x00f01630 1 /* GPOTR */ + 0x00f01648 1 /* P18SCR */ + 0x00f01660 8>; /* GPCR */ + ngpios = <8>; + gpio-controller; + interrupts = <9 IRQ_TYPE_LEVEL_HIGH + 2 IRQ_TYPE_LEVEL_HIGH + 3 IRQ_TYPE_LEVEL_HIGH + 4 IRQ_TYPE_LEVEL_HIGH + 5 IRQ_TYPE_LEVEL_HIGH + 6 IRQ_TYPE_LEVEL_HIGH + 7 IRQ_TYPE_LEVEL_HIGH + 8 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&intc>; + wuc-base = <0xf01b20 0xf01b20 0xf01b20 0xf01b1c + 0xf01b1c 0xf01b1c 0xf01b1c 0xf01b24>; + wuc-mask = ; + has-volt-sel = <1 1 1 1 1 1 1 1>; + #gpio-cells = <2>; + }; +}; diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h new file mode 100644 index 00000000000..3372a845aa9 --- /dev/null +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h @@ -0,0 +1,20 @@ +/* + * Copyright 2023 The ChromiumOS Authors + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include <../soc/riscv/riscv-ite/common/chip_chipregs.h> + +/* + * Macros for emulated hardware registers access. + */ +#undef ECREG +#undef ECREG_u16 +#undef ECREG_u32 +#define ECREG(x) (*((volatile unsigned char *)fake_ecreg((intptr_t)x))) +#define ECREG_u16(x) (*((volatile unsigned short *)fake_ecreg((intptr_t)x))) +#define ECREG_u32(x) (*((volatile unsigned long *)fake_ecreg((intptr_t)x))) + +unsigned int *fake_ecreg(intptr_t r); +uint8_t ite_intc_get_irq_num(void); diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/zephyr/arch/cpu.h b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/zephyr/arch/cpu.h new file mode 100644 index 00000000000..ab921224676 --- /dev/null +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/zephyr/arch/cpu.h @@ -0,0 +1,16 @@ +/* + * Copyright 2023 The ChromiumOS Authors + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +int arch_irq_connect_dynamic(unsigned int irq, unsigned int priority, + void (*routine)(const void *parameter), + const void *parameter, uint32_t flags); +int arch_irq_disconnect_dynamic(unsigned int irq, unsigned int priority, + void (*routine)(const void *parameter), + const void *parameter, uint32_t flags); +typedef struct z_thread_stack_element k_thread_stack_t; diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf new file mode 100644 index 00000000000..cf7d90e583c --- /dev/null +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf @@ -0,0 +1,9 @@ +# Copyright 2023 The ChromiumOS Authors +# +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ZTEST=y +CONFIG_GPIO_ITE_IT8XXX2_V2=y +CONFIG_GPIO=y +CONFIG_DYNAMIC_INTERRUPTS=y +CONFIG_GPIO_GET_CONFIG=y diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c new file mode 100644 index 00000000000..4272fbe42f9 --- /dev/null +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c @@ -0,0 +1,460 @@ +/* + * Copyright 2023 The ChromiumOS Authors + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#define MY_GPIO DT_NODELABEL(gpioa) + +const struct device *const gpio_dev = DEVICE_DT_GET(MY_GPIO); +static struct { + uint8_t fake; + uint8_t gpdmr; + uint8_t gpdr; + uint8_t gpotr; + uint8_t p18scr; + uint8_t wuemr, wuesr, wubemr; + uint8_t gpcr[DT_REG_SIZE_BY_IDX(MY_GPIO, 4)]; + bool clear_gpcr_before_read; +} registers; +static int callback_called; +static struct gpio_callback callback_struct; + +/* These values must match what is set in the dts overlay. */ +#define TEST_PIN 1 +#define TEST_IRQ DT_IRQ_BY_IDX(MY_GPIO, TEST_PIN, irq) +#define TEST_MASK DT_PROP_BY_IDX(MY_GPIO, wuc_mask, TEST_PIN) + +DEFINE_FFF_GLOBALS; + +uint8_t ite_intc_get_irq_num(void) +{ + return posix_get_current_irq(); +} + +unsigned int *fake_ecreg(intptr_t r) +{ + switch (r) { + case DT_REG_ADDR_BY_IDX(MY_GPIO, 0): /* GPDR */ + return (unsigned int *)®isters.gpdr; + case DT_REG_ADDR_BY_IDX(MY_GPIO, 1): /* GPDMR */ + return (unsigned int *)®isters.gpdmr; + case DT_REG_ADDR_BY_IDX(MY_GPIO, 2): /* GPOTR */ + return (unsigned int *)®isters.gpotr; + case DT_REG_ADDR_BY_IDX(MY_GPIO, 3): /* P18SCR */ + return (unsigned int *)®isters.p18scr; + case DT_PROP_BY_IDX(MY_GPIO, wuc_base, TEST_PIN): + return (unsigned int *)®isters.wuemr; + case DT_PROP_BY_IDX(MY_GPIO, wuc_base, TEST_PIN) + 1: + return (unsigned int *)®isters.wuesr; + case DT_PROP_BY_IDX(MY_GPIO, wuc_base, TEST_PIN) + 3: + return (unsigned int *)®isters.wubemr; + } + if (r >= DT_REG_ADDR_BY_IDX(MY_GPIO, 4) && + r < DT_REG_ADDR_BY_IDX(MY_GPIO, 4) + DT_REG_SIZE_BY_IDX(MY_GPIO, 4)) { + if (registers.clear_gpcr_before_read) { + registers.gpcr[r - DT_REG_ADDR_BY_IDX(MY_GPIO, 4)] = 0; + } + return (unsigned int *)®isters.gpcr[r - DT_REG_ADDR_BY_IDX(MY_GPIO, 4)]; + } + zassert_unreachable("Register access: %x", r); + return (unsigned int *)®isters.fake; +} + +static void callback(const struct device *port, struct gpio_callback *cb, gpio_port_pins_t pins) +{ + callback_called++; + zexpect_equal(pins, BIT(TEST_PIN)); +} + +static void before_test(void *fixture) +{ + callback_called = 0; + memset(®isters, 0, sizeof(registers)); +} + +static void after_test(void *fixture) +{ + if (callback_struct.handler != NULL) { + zassert_ok(gpio_remove_callback(gpio_dev, &callback_struct)); + } + callback_struct.handler = NULL; +} + +ZTEST_SUITE(gpio_ite_it8xxx2_v2, NULL, NULL, before_test, after_test, NULL); + +ZTEST(gpio_ite_it8xxx2_v2, test_get_active_high) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + registers.gpdmr = (uint8_t)~BIT(TEST_PIN); + zassert_false(gpio_pin_get(gpio_dev, TEST_PIN)); + registers.gpdmr = BIT(TEST_PIN); + zassert_true(gpio_pin_get(gpio_dev, TEST_PIN)); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_get_active_low) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_LOW)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + registers.gpdmr = (uint8_t)~BIT(TEST_PIN); + zassert_true(gpio_pin_get(gpio_dev, TEST_PIN)); + registers.gpdmr = BIT(TEST_PIN); + zassert_false(gpio_pin_get(gpio_dev, TEST_PIN)); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_edge_rising) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); + + gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); + zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_ACTIVE)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); + zexpect_equal(registers.wuemr, 0, "wuemr=%x", registers.wuemr); + zexpect_equal(registers.wuesr, TEST_MASK, "wuesr=%x", registers.wuesr); + registers.wuesr = 0; + + registers.gpdmr = BIT(TEST_PIN); + /* Mock the hardware interrupt. */ + posix_sw_set_pending_IRQ(TEST_IRQ); + k_sleep(K_MSEC(100)); + zassert_equal(callback_called, 1, "callback_called=%d", callback_called); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_enable_disable) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); + + gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); + zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_ACTIVE)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); + zexpect_equal(registers.wuemr, 0, "wuemr=%x", registers.wuemr); + zexpect_equal(registers.wuesr, TEST_MASK, "wuesr=%x", registers.wuesr); + registers.wuesr = 0; + + registers.gpdmr = BIT(TEST_PIN); + /* Mock the hardware interrupt. */ + posix_sw_set_pending_IRQ(TEST_IRQ); + k_sleep(K_MSEC(100)); + zassert_equal(callback_called, 1, "callback_called=%d", callback_called); + registers.gpdmr = 0; + + zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_MODE_DISABLED)); + registers.gpdmr = BIT(TEST_PIN); + /* Mock the hardware interrupt, should be ignored */ + posix_sw_set_pending_IRQ(TEST_IRQ); + k_sleep(K_MSEC(100)); + zassert_equal(callback_called, 1, "callback_called=%d", callback_called); + /* Clear the missed interrupt */ + posix_sw_clear_pending_IRQ(TEST_IRQ); + registers.gpdmr = 0; + + zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_ACTIVE)); + registers.gpdmr = BIT(TEST_PIN); + /* Mock the hardware interrupt */ + posix_sw_set_pending_IRQ(TEST_IRQ); + k_sleep(K_MSEC(100)); + zassert_equal(callback_called, 2, "callback_called=%d", callback_called); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_edge_falling) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); + + gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); + zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_INACTIVE)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); + zexpect_equal(registers.wuemr, TEST_MASK, "wuemr=%x", registers.wuemr); + zexpect_equal(registers.wuesr, TEST_MASK, "wuesr=%x", registers.wuesr); + registers.wuesr = 0; + + registers.gpdmr = (uint8_t)~BIT(TEST_PIN); + /* Mock the hardware interrupt. */ + posix_sw_set_pending_IRQ(TEST_IRQ); + k_sleep(K_MSEC(100)); + zassert_equal(callback_called, 1, "callback_called=%d", callback_called); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_edge_both) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); + + gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); + zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_BOTH)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + zexpect_equal(registers.wubemr, TEST_MASK, "wubemr=%x", registers.wubemr); + zexpect_equal(registers.wuemr, TEST_MASK, "wuemr=%x", registers.wuemr); + zexpect_equal(registers.wuesr, TEST_MASK, "wuesr=%x", registers.wuesr); + registers.wuesr = 0; + + registers.gpdmr = BIT(TEST_PIN); + /* Mock the hardware interrupt. */ + posix_sw_set_pending_IRQ(TEST_IRQ); + k_sleep(K_MSEC(100)); + zassert_equal(callback_called, 1, "callback_called=%d", callback_called); + registers.gpdmr &= ~BIT(TEST_PIN); + /* Mock the hardware interrupt. */ + posix_sw_set_pending_IRQ(TEST_IRQ); + k_sleep(K_MSEC(100)); + zassert_equal(callback_called, 2, "callback_called=%d", callback_called); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_level_active) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); + zassert_equal(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_LEVEL_ACTIVE), + -ENOTSUP); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); + zexpect_equal(registers.wuemr, 0, "wuemr=%x", registers.wuemr); + zexpect_equal(registers.wuesr, 0, "wuesr=%x", registers.wuesr); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_level_inactive) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); + zassert_equal(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_LEVEL_INACTIVE), + -ENOTSUP); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); + zexpect_equal(registers.wuemr, 0, "wuemr=%x", registers.wuemr); + zexpect_equal(registers.wuesr, 0, "wuesr=%x", registers.wuesr); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_set_active_high) +{ + gpio_flags_t flags; + + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_OUTPUT_INACTIVE | GPIO_ACTIVE_HIGH)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_OUTPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + + zexpect_equal(registers.gpdr, 0, "gpdr=%x", registers.gpdr); + zassert_ok(gpio_pin_set(gpio_dev, TEST_PIN, true)); + zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); + zassert_ok(gpio_pin_set(gpio_dev, TEST_PIN, false)); + zexpect_equal(registers.gpdr, 0, "gpdr=%x", registers.gpdr); + zassert_ok(gpio_port_toggle_bits(gpio_dev, BIT(TEST_PIN))); + zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); + registers.gpdr = 0; + zassert_ok(gpio_port_set_masked(gpio_dev, BIT(TEST_PIN), 255)); + zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); + registers.gpdr = 255; + zassert_ok(gpio_port_set_masked(gpio_dev, BIT(TEST_PIN), 0)); + zexpect_equal(registers.gpdr, (uint8_t)~BIT(TEST_PIN), "gpdr=%x", registers.gpdr); + + registers.gpdr = BIT(TEST_PIN); + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_OUTPUT_HIGH, "flags=%x", flags); + registers.gpdr = 0; + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_OUTPUT_LOW, "flags=%x", flags); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_set_active_low) +{ + gpio_flags_t flags; + + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_OUTPUT_INACTIVE | GPIO_ACTIVE_LOW)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_OUTPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + + zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); + zassert_ok(gpio_pin_set(gpio_dev, TEST_PIN, true)); + zexpect_equal(registers.gpdr, 0, "gpdr=%x", registers.gpdr); + zassert_ok(gpio_pin_set(gpio_dev, TEST_PIN, false)); + zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); + zassert_ok(gpio_port_toggle_bits(gpio_dev, BIT(TEST_PIN))); + zexpect_equal(registers.gpdr, 0, "gpdr=%x", registers.gpdr); + registers.gpdr = 255; + zassert_ok(gpio_port_set_masked(gpio_dev, BIT(TEST_PIN), 255)); + zexpect_equal(registers.gpdr, (uint8_t)~BIT(TEST_PIN), "gpdr=%x", registers.gpdr); + registers.gpdr = 0; + zassert_ok(gpio_port_set_masked(gpio_dev, BIT(TEST_PIN), 0)); + zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); + + registers.gpdr = 0; + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_OUTPUT_LOW, "flags=%x", flags); + registers.gpdr = BIT(TEST_PIN); + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_OUTPUT_HIGH, "flags=%x", flags); +} + +/* The next few tests just verify that the registers are set as expected on configure. */ + +ZTEST(gpio_ite_it8xxx2_v2, test_open_source) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_equal(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_OPEN_SOURCE), -ENOTSUP); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], 0, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_open_drain_output) +{ + gpio_flags_t flags; + + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_OUTPUT | GPIO_OPEN_DRAIN)); + zexpect_equal(registers.gpotr, BIT(TEST_PIN), "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_OUTPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_OUTPUT_LOW | GPIO_OPEN_DRAIN, "flags=%x", flags); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_pull_up_input) +{ + gpio_flags_t flags; + + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_PULL_UP)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], + GPCR_PORT_PIN_MODE_INPUT | GPCR_PORT_PIN_MODE_PULLUP, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_INPUT | GPIO_PULL_UP, "flags=%x", flags); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_pull_down_input) +{ + gpio_flags_t flags; + + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_PULL_DOWN)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], + GPCR_PORT_PIN_MODE_INPUT | GPCR_PORT_PIN_MODE_PULLDOWN, "gpcr[%d]=%x", + TEST_PIN, registers.gpcr[TEST_PIN]); + + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_INPUT | GPIO_PULL_DOWN, "flags=%x", flags); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_disconnected_tristate_supported) +{ + gpio_flags_t flags; + + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_DISCONNECTED)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_TRISTATE, "gpcr[%d]=%x", + TEST_PIN, registers.gpcr[TEST_PIN]); + + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_PULL_UP | GPIO_PULL_DOWN | GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_3P3, + "flags=%x", flags); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_disconnected_tristate_unsupported) +{ + registers.clear_gpcr_before_read = true; + zassert_true(device_is_ready(gpio_dev)); + zassert_equal(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_DISCONNECTED), -ENOTSUP); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_input_1P8V) +{ + gpio_flags_t flags; + + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_1P8)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, BIT(TEST_PIN)); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_1P8, "flags=%x", flags); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_input_3P3V) +{ + gpio_flags_t flags; + + zassert_true(device_is_ready(gpio_dev)); + zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_3P3)); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); + + zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); + zexpect_equal(flags, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_3P3, "flags=%x", flags); +} + +ZTEST(gpio_ite_it8xxx2_v2, test_input_5V) +{ + zassert_true(device_is_ready(gpio_dev)); + zassert_equal(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_5P0), + -EINVAL); + zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); + zexpect_equal(registers.p18scr, 0); + zexpect_equal(registers.gpcr[TEST_PIN], 0, "gpcr[%d]=%x", TEST_PIN, + registers.gpcr[TEST_PIN]); +} diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/testcase.yaml b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/testcase.yaml new file mode 100644 index 00000000000..67cc43b474b --- /dev/null +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/testcase.yaml @@ -0,0 +1,14 @@ +# Copyright 2023 The ChromiumOS Authors +# +# SPDX-License-Identifier: Apache-2.0 + +tests: + gpio.gpio_ite_it8xxx2_v2: + tags: + - drivers + - gpio + depends_on: gpio + platform_allow: + - native_sim + integration_platforms: + - native_sim From 4a96d149452c8328e11af32e784254af730aa8d2 Mon Sep 17 00:00:00 2001 From: Conor Paxton Date: Mon, 4 Dec 2023 23:59:00 +0000 Subject: [PATCH 0262/2300] [nrf fromtree] boards: riscv: introduce support for Beagleboard BeagleV-Fire The BeagleV-Fire is a SBC powered by Microchip's PolarFire SoC MPFS025T. Signed-off-by: Conor Paxton (cherry picked from commit f0495d4d472f5852906318bdf93582af07b3c12d) (cherry picked from commit 2812a3b24d1a18b0f9b9bc2d6e614fde991f7e65) --- boards/riscv/beaglev_fire/Kconfig.board | 9 ++ boards/riscv/beaglev_fire/Kconfig.defconfig | 6 ++ boards/riscv/beaglev_fire/beaglev_fire.dts | 33 +++++++ boards/riscv/beaglev_fire/beaglev_fire.yaml | 12 +++ .../riscv/beaglev_fire/beaglev_fire_defconfig | 18 ++++ .../BeagleV-Fire-Front-Annotated-768x432.webp | Bin 0 -> 42568 bytes .../beaglev_fire/doc/img/board-booting.png | Bin 0 -> 16583 bytes boards/riscv/beaglev_fire/doc/index.rst | 85 ++++++++++++++++++ 8 files changed, 163 insertions(+) create mode 100644 boards/riscv/beaglev_fire/Kconfig.board create mode 100644 boards/riscv/beaglev_fire/Kconfig.defconfig create mode 100644 boards/riscv/beaglev_fire/beaglev_fire.dts create mode 100644 boards/riscv/beaglev_fire/beaglev_fire.yaml create mode 100644 boards/riscv/beaglev_fire/beaglev_fire_defconfig create mode 100644 boards/riscv/beaglev_fire/doc/img/BeagleV-Fire-Front-Annotated-768x432.webp create mode 100644 boards/riscv/beaglev_fire/doc/img/board-booting.png create mode 100644 boards/riscv/beaglev_fire/doc/index.rst diff --git a/boards/riscv/beaglev_fire/Kconfig.board b/boards/riscv/beaglev_fire/Kconfig.board new file mode 100644 index 00000000000..1984bb05c09 --- /dev/null +++ b/boards/riscv/beaglev_fire/Kconfig.board @@ -0,0 +1,9 @@ +# Copyright (c) 2023 Microchip Technology Inc +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_BEAGLEV_FIRE + bool "Beagleboard BeagleV-Fire" + depends on SOC_MPFS + select 64BIT + select SCHED_IPI_SUPPORTED + select CPU_HAS_FPU_DOUBLE_PRECISION diff --git a/boards/riscv/beaglev_fire/Kconfig.defconfig b/boards/riscv/beaglev_fire/Kconfig.defconfig new file mode 100644 index 00000000000..df89660bcb6 --- /dev/null +++ b/boards/riscv/beaglev_fire/Kconfig.defconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2023 Microchip Technology Inc +# SPDX-License-Identifier: Apache-2.0 + +config BOARD + default "beaglev_fire" + depends on BOARD_BEAGLEV_FIRE diff --git a/boards/riscv/beaglev_fire/beaglev_fire.dts b/boards/riscv/beaglev_fire/beaglev_fire.dts new file mode 100644 index 00000000000..df956f5c8f2 --- /dev/null +++ b/boards/riscv/beaglev_fire/beaglev_fire.dts @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 Microchip Technology Inc + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include + +/ { + model = "BeagleV-Fire"; + compatible = "beagle,beaglev-fire", "microchip,mpfs"; + aliases { + }; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &sram1; + }; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + clock-frequency = <150000000>; +}; + +&gpio2 { + status = "okay"; +}; diff --git a/boards/riscv/beaglev_fire/beaglev_fire.yaml b/boards/riscv/beaglev_fire/beaglev_fire.yaml new file mode 100644 index 00000000000..64d34b454f8 --- /dev/null +++ b/boards/riscv/beaglev_fire/beaglev_fire.yaml @@ -0,0 +1,12 @@ +identifier: beaglev_fire +name: Beagleboard BeagleV-Fire +type: mcu +arch: riscv64 +toolchain: + - zephyr +ram: 3840 +testing: + ignore_tags: + - net + - bluetooth +vendor: beagle diff --git a/boards/riscv/beaglev_fire/beaglev_fire_defconfig b/boards/riscv/beaglev_fire/beaglev_fire_defconfig new file mode 100644 index 00000000000..a60ed8c1691 --- /dev/null +++ b/boards/riscv/beaglev_fire/beaglev_fire_defconfig @@ -0,0 +1,18 @@ +# Copyright (c) 2023 Microchip Technology Inc +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_RISCV64_MIV=y +CONFIG_SOC_MPFS=y +CONFIG_MPFS_HAL=n +CONFIG_BASE64=y +CONFIG_INCLUDE_RESET_VECTOR=y +CONFIG_BOARD_BEAGLEV_FIRE=y +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_RISCV_SOC_INTERRUPT_INIT=y +CONFIG_RISCV_HAS_PLIC=y +CONFIG_XIP=n +CONFIG_INIT_STACKS=y +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 +CONFIG_FPU=n diff --git a/boards/riscv/beaglev_fire/doc/img/BeagleV-Fire-Front-Annotated-768x432.webp b/boards/riscv/beaglev_fire/doc/img/BeagleV-Fire-Front-Annotated-768x432.webp new file mode 100644 index 0000000000000000000000000000000000000000..a4ba6b0d98e9e985397ab938b9c56f50fd3111f9 GIT binary patch literal 42568 zcmV)mK%T!+Nk&FMrT_p}MM6+kP&gnorT_qt1OlA_DgXnp0X|6}jYOiNArv{Ss3-)4 zrtTLU=9eHlT(jQWeoL`FQS_(iKfQk4f0Fls0|L}e~|D)KK#Q(_hpXYD- zzv6!@K4^ca|FQmS{RhH->VM?F?*Ezn_WA_=rTw4&$M|pZ-wD6z{^9$${@MRG@{{0K z^k49Q`+v!P|NOoGuKl+6RsF;Lf9;?A?~qUHKjgpi`&xhF|NriX{!{+H|Nn7s=>O~g z{(A6!=6o>!b^oLLkN=0^)BShi>QA|N1UN`xXC_{U@ov%)aM-Q~S61&-VY~e{g>0|0Vwi{9pO+ z+P_ZzF#m)8SNCuIugFK{Kg@r?e{}u3{~h~*_6_tO_&>@2xbUIdKihxT|0(Pd>vz&W z+W&fv_k;C+^B?p7#D4010RJuioBoIVFYTB3pa1{!KJEXD z|14i8qAUUCEH`vTfE?&-fZVhzDEp!;0p=_>V`#`O9Y>1|-4S39F=4x+ zEC4I(3K0>TXv2`=vGu(S8e)!nF=~diB=_-2S|@2*H}W<^uH9t3a{cSk_t4-%zq!`2A``jRv80YLn)m5aZZRUw~5 z(H}gMq_78=u-(xV%-==rp!nyqcc-id%v|cbK-Gn*JESMIBrLysSD;P!-OdSxv49GO zb^~o2vi6UbTxSOmsE1-e^!*wZCOA4Hl)04^BENV)D&TCC%$=s9HZ$jvbd~_~78|-8 zK*$RiOXSi2eBz|SW)&amLgeuwaCvnnXx{^cjQOIAoF~lezc}jRww&Fm6^)z`QtB-; z6p7`oFvJZxFPmvR74KACw}qfmWFjKkU{?fmf(MHY-4S39F=4tA6O$qWSN0DCGi>Uk40er`AsUBymYH##kNPG)UJ+yh~=ZYGq0Uh90f)awyq>>M;GPUGDBWqQld@JG&kmr`>%Y2skBx6kTi?;n)50Iq8y zpe`L#U!C8HKZxvVNNnVg1J%6|BOCazFH2*h)F-O&POl`{6+d+X%Lx_aKu{f{ox{(U zC192hy(YlFI?wef_RlIo8-#3^N%Rt4(bcL+ZJu$nulGZ7B#&0h9ly$JbD!2Zy0~4| zvRNp3Fsai(=UD|uiw)foU=J}Tx3EhO3y;t`GoN}2tH83yMKx+By(z!_GR~M=!lPAW zz88(LIWyz_(2d=Si)i`ZAQY(#s`5oMwziO!X?0JFBq}3?8ih+9laSsklyV4p2cX9< zDI^VjBJo8d3hy%|OQZ16=Er+$iML7NJ_;NnJB>S! znB=>Dx_U?~JD9ND(G~#f6V}qF>{b(z{7R&|hu5~!_-q2lY)Zu;m@2^d`NC7~g`BSb zl-NlBo%+lr-wrGlt`E5kjG>ip9~;0^s&V^@GT-qztH`8U_DWGPZfIBMsx3VY@a)<86-)I z7>ONq9Wc(M+3buqWB4XicA!7Z>0OgU&tIog{qFL}4II(%bIq$w5Q$4h$wV+`G~!}FG&gX-lPbHu{sAesrc_-gnACW-g-TqyKt4S*qT+EZ zbyGs-1>=E!+XTGy=WE9YPo7E9;AeSZJJoR|x~5bbXBRw!w+jyF=|?buZh2D_q&7K# zGHUSJlU#*cLP0h0CUlf~!Uh**;DHEeZe|9>Ij|%$rpZFxGp~ui>cC48VI_y0IjdI2 zsgG5o6~4b+-7Di;*7M?_S%JVDzM=S2=zJrnw=L``v$J$i=R*=-E-TurSJx^rzd&>6 zb)P(sxmW4KUwt!Ru0)dgvbuy3vR(tH(L>fj{+U!4oC0ek+EbLXfQRAJSFxMuDpp^8 zKFrH!P&#g2G0b z@H?eh%dDqc=A~s0h%lpIH+}tU^uj}tw67P}gN^SX0vvANgS3F~^<{w(mrvsfg^>8T zf(cnu2R9RYmnR`(lz2bWrmW&7l0X8rQUcQP1EaiGVbrnJP6x$ zL?$HUo|U=MX=Vx)O)R@*xr@%XzIR#k!&B}PkUl zLkOWpw*a&%N0U?50&8**0AzY2w@lK1P2nek8{`0aBmy*Wc|SUh;}lQNBS zr1W#->!F7oN;dR)7UF?gtK!};1@rAv*XN&ctEPP7dG7%I5LmdJ1lDZu{Bpx#e3xhu zy?dK0WuA{Ne1BC&5Fak!$@YM+-uY3sTt<5+Le;5{x+F6Avb(w)#9qG>e8VRxh@=&g z^XZunS>`|mBp!+&2?xlF)$>rJKRSBiecHTL@>z6ErW3*RI3e89H4Ee&< z*KqK~dV5_FU=J#@x2+`Y+R;+Dx&p29w}^4=vLTk^nb*J>wSO&~7DY{3gT8Rpa2nt_ zv2{Q^;fHo8uPz`fAo3+|ce_Z8A99lU(<~FcLL29C%j-Wb15|c&#Jr^Mn>OASIpK1) z`c<#fVqtv4OV}YY`-78>&mp+5D+x>1OIpb-DH&Xv%+6RYclg2}- zAorl;YwHr(uw~=kE%1@L*H&l-P&u9}B_*H=wx;tx1N|`wxUr$O{Ql1%x{ZDIUe3J>Po40~_R$ z6j7x5lNG<{IidN<-qd;7r&%X!K0Q`G$Uj`Lq8^78yUmAqXm6x$v-CwE|I`g8&&wYRE~(g9DjDr^DBmjgPiGsDziZt^u%%iuWG}|jjv)$uFI`90+b)_pJ_gCq z-q884$~c)DHdIr{Yxkk)+4Ny?7Cl@tC`G?mV8R^|{uPTU(pUq`SZ?gKIa`il-7aBBo25$)^qwqKO5Gu@I*W~1Z-FEoN$PC1%K-;rnrxrx<%Y=X>_d?-NPwJ zkYjT`UlXVEgdM2=rYZj*`+Uc6C^*ATT=MReIIpJ+UQkRjipscK$-s$zG3l0ns$jRc z#h}cF-;5)JI*v<=xzc}r${Z*Zn5%I{}|H7NdZ^#j-x$-gfQwXh^z35yW}P4DRL(@PU&>iI^amg3NeEo?+V|Y)_n3!*GLmL zLj)DCsc@j#Tjd1N<&mqab2*%c(T@b&l6o#3&rGNk+UMt6o}H6e@E!~>*GSg!Oc4|; zY}T0o91+}L-7*=bksp_CCSe9))3Reu2yMBi7`-=A=iKTmZX>$-U-v$aFsW)O%(tKh zsZj7(7E?)TIA(rEo`m_15M^W8(%qZqs`jbWAP+T&CH#-^^|!sT#04w?<}5dKMSwh@ zO-l$zf;W)HP4DFI*8x0;q}qKJtc-Jq3=NKkM12uaDbUvhGX%~NI>Pn6C0Zf_IoJyD zzTq+U*`6`?y@79ZzhEsGdG5OR)ByU|&}mi{A=Vt;7V8pVJ- z#fI*PwB~I2c`RLs(8MA3v@4%E)|g#fdLIwhOpDETiQ2x;=9KYN2O4?yd~VqngX4bCEtbTl^v{8 zsZWJ(;AQwv-xe|I;^YHN%+wYy8ORda4{KebCo}6@7A%NBspIRudMhqeSRNU%G z%d{^9^FR=%q5C(39bfPmEGugV~>pMO~J@ytw?%hj^p&@heMGf9mxLeN3^6PPn zyY0}Vs)0TkiaM{-{;GaBwkMRQE^_#j zZNNs@(EJE`V$>K+;|M)H)UI=JlJoKo2w|wB--{v!Ff}Db4uen<9&Mm18kT@0Cju#t zGfTm~m0q9Pn%PX5A_*OuVZuiF(PbU8+mC2FM*#+YxI1G!)t!`crsqte`-~XB25KRzK&|p_PK>uL3VClKVib5O zn3SO43gu8L=+a)HcSYB(!x~#tq@n1edN2ii!8XAFNtlafvrJKyt6rgc#px4Ew59z& zWC(gexoRfFkCI3?YGRgz`ThBfmpE3njrpQ`SzO$`2ty3VH#PxH0)T-y)pT5rzN0Q- z|L%?w-p5{18x@>;YU`mwqCkK;r3>o1^C{NoG2V-J;3HeWkBn&@+|a)nWWmVc+?%^+ z&1r8or>`@-Iqsw*P2Jdj)c$-95j=270#%)+$M;Iuxzsp;ss6JpM6bL?Gt<*ENd@53 zo}ZS@3j=I3`#Kri#?81dEXrZesUM#3&#A=z*}Y@%cX7M@aH1PsU8K`Ib88c>QxkiV zVr{u?WvMdRGtKE;`6BA3a1$pAGZPvi703jS8~ zW!q&iJnfK8i%{cZS6j_U42S)>_JLDu;Bf4t-kI>!CmBFd%mixU`T}o{-etEiU~trq z*H!&8?%bUQ)78vY>x+Y!Y$nd4Bzc)UfPURqUzoi#FLANW+oJ-~b!DQS2sj|&^`RV_ zde?^%YT1895!u_gfA(*wg3C?%Dx+Z`{1oni-yQQTa3?7pO@n-y>fMgJozgd~T7l^B zu#)hCUbJ`kaBff>(FNrE2raozZa?v@C=gNCmtQ#@31(XRqGbnGS{c;UmhM)0IOJ|D zmh4wbQd69+6^zBG>khqm7NBNDv2fI0ZfTV)09`~=f?7}c?#38@QLMSU3PW2}k%fL+ z#=TNZRHEI7i1H6e#+n(`lhlzwlmHCIO12KS#Q!GaqMc>3Ie>Kf_)x*Psmx+$}yOiOyGR3Za$i5Fu zY@kBWw-ojop+3A@GtG_UQ3ntCn4H!;;>l_Hn)nu~_9voutgCIlB0EE=2*rB#>YYUU z;ncZ4O9*n+DU>i$l#0H8BuV6RA90UJxcf*7hqAuoWWub!auj$^WV#-ztq5$xZH+g7 zXioS|$3{<#4qQA@k52Ontu}&XWg!Ei6T1v3o&<-NZ5LW#>6i)`HMjD6saqZ6&1~Vt zd@p5g1luaAkSIvPYJm--r#F2@yWYh28#l0M?4{h$sL_IrbmEtPR!51ArYr&(g@q)2 zJe63-@$Xzl8vMPLs$LRv^<<;pYnFm?mGHj|ZTb;PP~O7#^LTkQaHoRw4t%n* zr*Cqu?cM|l?dhFqiUW*~#z(1U@ezU=%nXwSg4jZV78T1H&VBZqTqy>9Jybp4eN#rT zz2fR(I`7S}(_B##yVHAbML;-*N+EZ^_(1R~tP$mSVV{wTV0pgL_JMrk ze1W`efCZj?A!=MO#P`E@JF@hyS#i-`VNgF)o#NcnfqVufqWRf(+t|IUEe|u9^f7#g z81c1%bJ^?plcYBE@#%z`N+T}kdv23$sUY-nlugD3WR-ul1bjCtXjJv`IDW_rL=nCc z*w6?NN_Q5_py4W#Zq>hb%%66oLuIrSLw^4=cdj}e*vinU96LCMz?W*VG$E|Bhi7Ot z^~_>Ri$jxvLK1&@@(_w2mS16jYzyJz!qk)gpgkg3;y&mx)eF`Xl2@Z^UinAx|{=(PR z5-@;xAWX1p`o%2c5Va^IcI@>dJ)Y@+>p@_iKMe@UYeaIHVHURsa}UI&s+XUOk#d9W@0JoWAYP`~qMHo+>fO0`J%b z{7u8@E!b>yCyXq`8Y`}58TB}(@}fHAJrj-`-$G|Mo5tD8_h8ORo}2>kY`m(J57Y=M zgyNXNK&GcfBR0A!ia+hOa6t?LdmSe@d@Jc6n|Ok~(HJlilXS*@>-S2jK*8&8RBoHg zUZ3yaKzu++zF@UbG+p1pA91g>x`LY9MU=x~8_DkUO>Ol-mj{-4C&0FGFS~_h%zUHA zCqG+V;J4i6=}j7wIgpCvHK2Og%U_c%1EqH!?_)qN_#cM;l|a};%G#8`M1*&)bJl6( zYI?nd0Uwqdk!CaSRyINoN|CyHA9#=n>@|rL?@a()gi$VmPS0h-%a$m~2J@$TsQsA} z2>6jWDWgwzJs19xAIJBRm$l9X{!iLYWHT0`(2jvyiUeaw8tvq&Y zg&V9PP#hw%(-qjz?mj6Bbhp<@o5yJfcWNXxXp1byCbU@Ybq#mR^I@W8tj#gR=i0yp zC^L;ZT4wA?C(4K7&kpzOcnmMaTsL>1HXjDmbpeS#ah0u7LQY|Qot~gz+ z6}>ZX1Aoqs=9bl%gilEdnzb%130w78)ED2b^-X0E;sD0|yys)}`yfTo50;Zoj3gJG z#xUmPN*$Lx$Yt^#3Wy8B*~-q+7H!Pynv^DY_U;C4e>?%M1%Vl?eswYjSjm^7-sr(z zq_;4qFu@zTk4{WBeb)G}Z^LqDA@yo^QQ=i7gORMO=N4-bSC|F?RU$9puw9&kW#705 zzB|A(HPm-UrJK4?llKA!?yn*m_YdL6@VR|zHUStw_RCgR&HolkkkiN}N(7yMgo(c&RZ#UdE-2D-fqi;_~J-hhlHUOv!+9RkAJ}^iZkZcD>>f zQ)wke-(dDsK4m^KgV5Pz@rwJq<`&x3s8s5+$$VuhwhkDjElXWODxrON;_-~*`V}+K zf+mHy&Egm5Qv<7H=A zzT%~4==p&_%&#IQiQbRlwC+c17$|&fpou1}0io3bn8O8hOHmlsRXyzP@|%xIG+vr zpT@{FQmQSd3A)@0aM)do55fqa#FK*l?-D1#O)l*Hb=LrM4s_PH_o^Hq=omZuX(h~J z_s>O6o+Hi`qF#XC!FR=kpcs_h>b5*~CJ|C|oG9~aDjb{ymzFdkh}F2BcyB{puecPr z1B@8HugVKT}j7MOFQRy*NOrXJGx={|aBa$RR+A$ZA2RFb6EOsP z+2L5dPy)SS*<_U?)1RX|dKHO)*=cgtj+^RAk7-*t*ne{wYSn_UdHEiO4oDfQ*?vxL zVgS&bgDL9LTFU82@}Pfril$pg?*bJ7v?!s2J&`kHajm%ZXqeURQ6<_stUJF^!^{WE zQ)KU_N~m7$|Lp#mui>(F#U}9^hg&5bK2pYKPM-*wq)e=o?#HmZ0QiW(w<8I1R-~TJ z0DtftaozD`XcenmxDxB``DrFl6MSss9fsphQK+G0G(y2}mvq`YNAz^9N|>vC&iipL zF$T0*=MuSP-sfD&`o>?oP}VRxLX~Qb5#&3L(lqQR-i1Nji(&LM4r%PbErNdKZ>>Ne zvK~hz$bcJk*NS|438quY&Ll`ttlsXWYwG0;8*^W4O-5w<6A2r*qOX})W2u4+k z%-pmM6xaPfVZ}{RmA!s4;@eAQ zaPY5;Av5fsi-)|BLvgZ0oYp+Vgwj|DDVP!p98)OBiN@@3;`v7R^%}rj zW79mxI~*f7I+sf>!8=kVp*9~%y_X_3tSbUjF-w2H%@L=nk3R*c+R=vE)wn}`nA~JF z3{CWL;t&RAN=h6l>DD1w=$Xe9kPG%8xeI5{YYT2Ar_dvka#alyu3}>f6AGF5gEzv4 zH}BCAc493N{HkYs^&>8~p7I&!qycPnN#jI0B2KmkwPH0Hf9aq*!eF==1R z=2VOswoO=5Ynwe_Flqve-N^Ic@IqA4O(k{aKd)kmg%CsZr*DYh<;*?;byO{DxC>-k zp1zsOj8JfLJt`gVuj9DrwV*wxGu<(-2V&f9)9z7B<&%I^3Yq~)?)N@;^)*l#J7H@Q0|H&OQP$i@6*UOb1elQi{~!orbKYAM4%>TeU+&<%V(Fr z$urKH7$|_7q0Sn)kl5sMt;)p#HS~fMgM)Lpe|7efR~Geu?uAt0H>({B^aSs_FtlxYl;_tYWO}h^BmsG+Sl3u|_{A#UV=aN;E_@h&G5V0uGv)dN_P2!3Adyrd@mJPAd|Co>f6gAaL`#pgwz?2s7ZEwIwf~dP*J|r}CK#H70kr_Wy=%5#dUNDbrhwa2p;aF8w zrM@9KmKL7nSmLwX48eTjww2$Qh)_!NS{8a9Z>*h@g6(Z1hY)!`oA z=Ikz|2Jr6-t;9prXu(GA*T?UJIT;_%x2NiyAA714KKA9*n!za`Dek*H3U^;`-qJ6i z>GT#Ym{fA4NQM8|0kO4NtF$Sk-L45N^ro6m;2fSRyd7{@p1zJ`UWo25;~uQxjgZN+ zMJ;E9-BBl~bQ7ncb%G2Xkz>Kc5_E`#ck=V={9aad17lejB#ZRI5abNHB-OtdUkHQ? z=nsGA-_D6qPt8GtAB7Y*L)@4*mw&Pk@Jny%0dvZ0j%epgLvxVhI&uEJ3=h$ z64%T@r=HVId0D*XRuAA0(AwN%G#u088T@WbkC$m2j`(wkHdO7fCp{Y@hFi|exrP$N zx6?I={N4u|OYSw=u^3bsiuVAH(h8EnBybib6QzJwJh@+a6qZ+wbGos(M^3#-Uzw(7 zjHCnRg?*KO(#ak?=AzmxN9r&>UXRR>5#=(U@c$2jn$sZ2y7Fhjb$bm*DUuVB|1t|)VjBfu->Vh{=!mJeuQCrSn?rf@H8G}qmyLgw?j z)z4>HpeZVx@rSFQiJkZtw8=eev@{EI9pW;)y}?D8mFtA7)E={p0ZSwlA!|>Omz6qk zl(OmiM3CYYr+IYkN?MAgryn1byUnl1O@|F;!&>2bbt+qnS3oPkT0rGN7VMXmv}?&? zInW?S!x{&rW-)BMf9N|B9~!t|{V_w{dDyMNYv8giXc%!lIlJeC4}WPQawjW-$7gAj z)#F7X_JFq-m%u0QySh-Qg=WSQ!hs`~AKYB+Fqgv+@^JI>JKQzegyUjrIm>b&2CytS zV*K^V7`BKqd}8f6zxuJ5FXBq={`nuLQXKZhg=a8`6iTYW+Zexw^0Wa5PSk^&DW_j3 ztJl5XBug#8c+)6%&0{g0f&p|(v+)OUf%G-%PDjmY?~5y!htZ&T092wXymVChjLoFu zVfv7esCgHz=iP?aPdaO7<{KY2V5uAFkeq1VdpkD`;n1HsS@ukE{6MQf({~ifX~E&Q zWsiN%C{QjjU^m{>T2t$CZ1{*6U1Rtb{27j)E-q;<3CZS zH7jq*Kl>D0x>SKt$X+}JY<0SCVA=WG0a*3)Y*$GZ0<_mVw6tNH94)1{OnFNXA?|Lk z*ZC`aS+QE{plv7`<(3I;1S+6jeBTP4fe6R(>VjIi-CEnxj7;9`A)B?CSJ}aiFwi2u z%n;f{-o%&yPt<%$*8@Iz=A^0xfTxK{X{ck&95z`Ul2Vi>*fIFF`ae1g_QZRLb{bLBa>aPzTcZ1=0o&q-!sZ zjA`}Nz`4|FAkK2xh1dZwDd1pb#xnAvvyyIAOG`qv7z?vU4EI@!cv4mAU=r==c_7k*vocQi=PIDJ@Hwa}~C@RzVSOB`C6 zfrfk5HepH$Yb}>ahgMQB4$#98Jss`(2}=r$AnRIV%+^7AF+?Qlzv=@RkV2LUz&NZ= z80~$EmZz7qP0fxgMR#fTMN%8O6=q5JJ)t;ucPcS*c!9CD4<5?!44V)I^jvWyag&8t zZx&w&Bf3U*Bt_T<)6-w=sF95X@a28j@TUcW6g-hrkq&z{FK?q(8YCZRo}beZSWpSE z@iW}QVPA#(+W+2(wd(K3X*cni%HyeOQk=KyeZsKJeMJ$Jw$fNR!3Zp-Rg=Iud!Rv9 zHnu1BGO;T~C%y1ExbI7Qqo*q;-17b_Hpsy&?zTKo$;8+^*i)L`+=mv^(&Ym1w~EL^ ze_s~vO|-Hr`XZLUe7CeM#xS|CrT|+CHGiC8*0aDCBJB5W8JOut6-!p78)SGnEM7n6 z>52?(WpP(@<|PNV^YZ~n_bcLLKEZJ3ti-bu#zb4egy2PP0`&Zs+3H7^0K88ix#RJi zq*UM`Je$vj%UqX@ z9&xXxihJjj#Hh=A{@m0@Joe^Gy#BEnK1a$}*WdL}0FI@`$RO^Cg8XK`E)OCbf!)cs~ z?0aSf?`3b{JNH!yIizO75psYP9)(^QXmk%o5e>)PfVe5J$*iclydlkpV=8fEK7;3f zQn)D{ngJc9vJTGa@^+?(q~?s~R&6in14xQW;l*_{iwmeaMZvrq6oG~`dlOGtk5|9P zn}v{ka{iCp?~KViBstuG_vzGQI_sh_bxItCa#=ELaYY=zvBnZy41E#I9pGm9a!Nkn z192TE4m&U=hcK)sNVluaAbg@x^kLKa8Nkb*ZUw=nUU_g$!}J_*(Pe+-MJ|&pd`4R2 z`c@7mR7znqZ*azc>G22|IKY^T!l-B>Uw7j+oHUeAY3f(N)JLmz8(@@UV>F}fh>BBi zaeiwN50>97Ki@9qP1&w;s}mHi5*npyzX9!24U>LdefIfi}|p(Si^l@ z)f1_jl2=fmEZj;<7~T$nlg+M8xi)1I3`z_=74ezmu2+g94i3!ua>ZhSiVREFeCtwo zM|-8qo2#Kqq*QqL@1K^C^{Xh9A-X{6PGqB3!kYHnJA2|X^U%Y5VZG9d)=YEIsWo;L z$RNFNR!7q5oz@}cF|4lw(QsMpwTQDhvt-W{`YIZDlqoo1O9?<_!BF7v=zn z;EUW06F66hDsL^Y1gn$}g%9R{4;Z4ey8XAmDwlBAl+C22k6L^+BEe5A?6)hG9#-bb24wf=s{G}o6pLR7N0DedY?SY5ZWmqeEphm?* z{=fkd(nm377~cq?rBqn~$PC0pP#naaa^OAX7y7_=2xGiGle)!4U(G0hAKXhQ)3pUBTRNW>3_!~9s4-OT~EmL z^o<3(yiI~_KQK72jJ?8Q@aWCnpB>0dfiO=#wEbO3zd6(g+C4MGrwzBdVl>_`Ni*1K z4!HuPtnXjVEmg_?mf7i3FMHrk#C@beHRc!v4b3B~F|V~4Xr00$2=;Uq%jJUi&2Fp9 zeZcv@Md+kK*A1BWLEu)yO}n0>Gbbe&y@S-S3Q{)DN;=nq#DA$!$;sD}%j87#y*|}F z6_&Ezhmm(N$vzNK$TrhIGZhf)bI|N_c~B?Dc5dH04W+!~FiBmj*&{n(0V4A!7|w*E zIclE=gYA~^89Rhc&0E4RIdGREt5J_G_pwCoV z*>#nBJ}-yG_|A=u*$57I2h#oTnR zWizfiv|VY+g?q3t%CCU^V7Fy`PyHb50zg3NnM>63TnM&A?&4IW`q(DN!hvrDh>10R zhfpv`OPz=$_SiiN?!u}XAtaw&_Tv%~ZBA6+c#X1e6m=Sx;WR)bNH;*uB&Sok^{;f; zm397I(5ouWN$gg}9oEQBd;=~b-D=X^otXvKRE;B|gc7Z@Npd8P<&bk731T)&6W{X? z828e(Ya8Dl@?aq{B2&(?W8yp=$F`u zGT2R$e-konAPzl06$Px7ABnJus+?u&FlNZ(@=msNb&+7ds^n}at)T<{H z*86}592uuc>jK(-$XVz^ z-7*5*6vh=`FKM^gVS5@;Na?f6A8OtuXO|){IryMf>om{i@n=fy|2$Iy(A|8q%0QSX zHNZI^7gC9{Q}koINj|pz2tQ>WrSKIjD{t0aInXe-k{g3>aS7=#Y!F<)B8M~tiTUbR zkg`6MYy&uKzr2m04Gb01Cg&1!^9^8?9<1+6+1Eq4laO#h1oTm>h)YP|Jq|a(2E;uX zz$cin`(lEwznw(20F3Sra?p}cYdf#mvv$U%Yo1%GE@FCfSs(lIX+@XU#q1X`4Ldx5 z3MhkZP}CZb9}A)l5hu90$I;nLdW##42DVC}hV4wX?mJU$#VjG4{b&p1^-))=Nx??% zoj~bH@O)SE!KDn}F;7nn9wYmbVhv^GzHMt8|2gT`jsO4y z_x06u`HP2u9e9RwGy;PAO=7TOxF`hRJliA`t5&K2B>$$!y8UaB(w9?&Ac;g0rxc&J zWx3oo67(s(L@W`FHZwHW%<0MPdRX8xKqx9VPI=n~zmrUdNs_~4^sYJRS>`QC%=0fp zxW;@R>vljyzc}q^Mcuo$zy9=MxAVJRlJ?aeP|jtVec1m3VpJ|8H)P2BR{PwnJXB1d z0wf@~%lb>k*>3~un_wZ{$WS`OFMcQHzpoPzI4~RHIRqnJtsn>ktroR?;~)VLFG46v z1yV^#m-|}Kh>O-B9$W55soxKipz1|j-!R6$BNL6yb*S`~G{66OIU;lqoi+8iZ zXb@Ye<|#fQLUFN9k&xD8V1t!c*`J&&4{V*a3C}O~76Cyx?yw|wQO9A~*-6LtfQPONqn+0i9qVq?6h zdW`}*$w%pcWSBh&f{h=O_0M8}uZtdT|Axh63}L!)Zl=ujIuA#-vk7#5PI6N46&!T^ zMwn&WtTl6=V3xEt;UyV04znYINO)k`8)KhL)f#9lM1n^}+>Nd)!}4a@+D7uzO8-Ex z$~=BgwBT6tm0Cr!*u>nbM%pc>s!oL{=Oq1@q8^E#j@1fP)02ncF>)OB#}l~TM>{4> zCSsK+-}Nv@q>h+Oex5+L+y_tuiHT-}?aCWF#FaDiM<~AVmhqYjjbwsSa*~R6?r^T~ zC_`Se8FrL9aDr-tQu%R6yegPT8pp;BHZ0cEAjR`dW)zECN5F3lyMff$1bQWM7Nn&n zhzIxgyUfpdW1lbNAbnLQuB7QZ9CW_WSpo`=K%N(+od0Kf3=uR|W(NnKIe3!|uT<3; zCJCRi2Z?r+(Va>T1JYr8G{g#aq&`Wfp97YL1@hcpwXYJRLWJ2DBf{&gb9)&PGGI*# z7Ef@n@)apVSD0?Z$6_&s|GYT7EA6Jbo;q4`VyVp$f*R+13@8j$*SY*7l#=S)_qyL- zkL<1m-39*lZEB{XX#ITv2EfGk+z2f&dO?b-7kyHc$PRX)FP;O`qYj+wbOdzj>`gTH zg2H;{mK*7II z(ix}{$MrjK$}BVBo7DJ<67&c&AlGhs66qq7wG4?zo>aQAa%9AeFy2C}M#Zu6TwciO zi~-{d%L%45u;8NnOo?X*!f;8ssNnjmIfLv8)J$;b)k*N!9X42U=GamT4fp@Bhu2BJ zU9n31Q>RUnkzk1^hqNpFlMtLkSFk@(ynwDk2ID_+$tg9~fha%!?qj8!PIRRHWIi$xjx9=TFHE35D&_JM@GZ;ULW>&Bwpazgjv zQf*3kb0|f-kdx$v9nKYu0|Rs?c6U{LDHIlf%Mfjj*v2h77&atG^dFt>8-X!(zeVO0l&&&9Y{@Ifk+Mx60y-A z;^yhZZ$-PE!JM=7S`(DNHmj zboPER(8!w3Ki{-2vJH^dG@Whb621|pcQT`6x9|Kn75*$at>@Q>*b6Udc@yyU%IIi{9>lpc*NC{9tJ<+R~r8? zljRwNy*JhqT!`W989B$Xl_946(zg3jDM0*N^}D}qx>u78ayX-#EHP*K_U`$p|Co%dUqB2O+`cH+nU*UKMjfDG>LIlHK zv40&<6f8r4R<{ht|3d=u+r#hx}I%5t$|Q+8dS#U8Yy-g7^{}f2e=68{6UZHq8VJO7z4y? zW}5(F!y|h^@%QJ>U+~Z4h1Da0@I^NHc)s%fC9BE^H90&M{RWS^M6#1HmF`1|J~#?d zY(+T-qLfoW!8kwu4_>X?BcGekJ7@UnC1Ni__OrYra$Z zSR?f4Gzy@O>!NajXphsV5Nl;2e79FOYo-{W`0`)enP7T>^4w}Snkv>iP(!=XjjYrR|;GAiwb$MzOU zF1K=@R`ElyH$8gOyH!SYVC|bLqK*3VK^G>!y!d}SH7fV#q!)@%?LZ`WtFnOzBUF~O z>FYtu@D0G5IOG|RO^SEmd`U7-1r8y<^!xn&%rj?S} zoI(!fnoZ9o^S(A6uO~)TJxz56^qYECk{f!D9P0_$rcxel6#=}RmUS`FwG>>Ps568= zEWHozuLb^Pa+tO7j{~}_(!Q4dgSr6)FH?%r-YJvHyqv9pW@&dae?DMa_4n2wNPT3S z)T&AL#Q=^)YB1p@uJ--7{~4!2`B_rf)L+-pWn+n<1NRqriXkioCC(GD%S9r2n? zlrBNNI*BdOm=J*g`!-ddu+RNzgJr=ib_ADC$33vl%!+gu_6f&gcp9xM$*SB8p9pTo z%B~#P05d?$zq0-S0X7t6|KL1D4+IR8hV+#hVEo-j;0vl7hBBGWY8s#lMMUmUt_Oy>`|4h zGxyWNDpmPbc-y$0?W4sCA@VZNDNHpt;9*HH>KAGav(W=+kvE$oZtBRQ^Iyc2S*K7< z!>^?|g5Sa2(*px54@`-K|KRFxV5y~^UZE$Di^+?r5x^xlDOgklrDCELF(Bg%mb3m1 zZ2`PJ8%D`br@>Sy1{|-Jz57!0bd`5!Vv3)wMH@G!p__5oY43;6m7LV`PhI4N??ZDljKc0B4hr>NO+tIo+<|XEg8SRhCV#6RS zM7c%zk!q}9%`}(=29w2iPml~aitlw-_Y^ZZfoBY;XGP~hH7tOc6dfb9C|n{CjyKVn z4(O7@r$qS3b3Kl;gCyOxB`-h4(VrIt=}(c^M^mdClGY@#^jQodkmAsOK?RYV)%(2! zZ4mGwzrrCP6f@O)PI~CD1`3v71U4nd4O{~MiU2D;$cS-BOUaJ^7)H8~WYs7&ttO>I z8Slz)H~r0W+z9BM8t|Vi^#SXh-2z#ErbeWvK&CZ+Zi_KZOT~XHophC$v#C>5D?%() zYlA2zFf`ONSOfT|#uJhOwJMU%`dokJI^25>KH6ATbVPwh>1^CBf({9za-2$H!;H4={r zsC;JL6|!bFA3N9zBElD$wwp;`D5Jp(#6-FM!yNTACQOU)_W9`x3-OKS z4Dvy@Ie=TO(XcjlEtvBmAlQCkMp*2hT=kjSBV(J=AklJ<$sY&%-LPCM0wiv4d$ zJhI$!__9qn|WQz&aL(pwRqa$aj>iZ6JX(l8Ng${p?&KJ23>>q2Xyh8&AJBjFS zs|&3=_J~Nf*>tdm@sEwXRpCbGoHGMhflbySH?^fqqBMfG^h%}~UN!H^w@ON2)n4v7 zTEYHD(=B}sL2s#42kp)@08DFC>E&NLx6$v9-}4|9Zt?DiLV7dbM?JRn>*D0&8Dt$! zwpv#dIO-^Jh%cQNP-95AODZ9cM=x*Zg3F09$bTnzlm44cJ*=tecO3U&OK(FfROeILE-uinl0X+f^Ny&IFo{bxG*R(Y?Aq4M_`X)@J&^uyat6X98yho0 zdW4aEwX8wiELjN`+VK{A8N%mFzI6(v+spUrCf_vCb?6*Wmerg*^wz*_TinT{Lp+m+ zPbPkywpNzWl%=sS1{`jCg}{CZ-w6qxbI|_^4EF)bbZnbt+fwW5w-xL(KM`!-=uA(^ zCBM2HIS^4ArKYJE3+YVo<6KvOhPX#l4&oJau^oEk_)-B1xN`1mAb35!roO=)&DxAf z*zFe+VA`@Lu#^LvCc?|S4C8VFAL3WK1_9YDl3Xh-!gk726eXVFGh2RBEof_U)DxMZ zT1a*RejQ@JDN-*_QB3;fp(TPEtd>& z`HblPQ(q{3tZIH3V(Ofu+FRr8Ai56{x&_6d=B6Gv*k^z=t!x!WS`TsS4$2)}AU&ou zZ0>wOrC>}QP%)UBJrXY_c1#Y~Gm0lIw&_(0$!a>`?L@@|nVg;oA}PGR)-E1Y!U$&` z%V@l@39lC=hGZ1|MQVv0L~pTOr|VBaQ@Om;-^Aivb5|RH4(qa>bN9^Vefc8XVCfVDbsELNsI8Q(ImwTG%p6(-@3P zz|ot*`N$s?ir~5EDOnZEXTd!ssl10+!J3S|nIkDxoSpe_en*w(06TEXQX`ws`l%Z6 z$GeOHfG1MEkwu;{F{RtbeG8H-Bde)z5Zop~6a7|c-oV3``J{)Kuw9xVUoyUImydIE zbOGyGa`R^Yd;2DuX;Tf|`AgyWweB=4c8w4oKsH5p|xdcCRiq6 zb1yx5#T>v!+ZdzLw=ar~Yrj^qYx?+XDbzL6KD7GWZ8pkrpgz1=w^(y0eL-G30Cf-7U_@$IcD)reV&*QjPj2ZE3=25d%^-woj(9Uj^ z=%2J@_~eJ4PB%L`T0Kw}^%{QSCsu3?jl(6>bRT(Lb*&Sw&~eB-P^XU6Sp)+JP%EjO zu}xOn!z5wc`OE&p0C+em|`|ybDa3R<2xrYX0L=RWH~U?V9O%v=lqL?-Y82D_l2)r?}(J z8v@+yxnNx}8>@7IH2`+7FY15(IYYC(>gXeCa@)I%h|zR4%W)(8yScu1DlwYF>LQ#1 z`sS!wH1QRWi)J%mmN0i2Kg698Fw|Y2@?uTH1O$IxMqkco(!yiL^dTM+t%DOj zO*v#F2~BG$%d#hHa7WgwPx z?#B6JYcl#>PCp2jPg78UqHZCYP650#Vo?@r#tlrd>l4|22`@&-4-AC4 z_W6J;ZV!%#$zisXt$$qbD7?0gtiCc~Hij}Vwg^UJcP(-rt+t7PNVw{U^)c2Rk`#@0 z`h5Zxi}RB+K&t=s6#DLj(K+WE@dC$jl5O7qe&)_8Vzz5xIqxY&qy_Ebaoifp1cn_d zX}sxc^U9v^-Kl`2MG~(^>dmnhYUhkWLq|WuMC~mUtIPH#x!D)<{L_)-x+vCzn9V*j z?HveUeyN;v5dKYmzo7P(>n9|<%xRbLJkS&&xVYSYRhb5`YcID4)zj& z+d6^*VKBZ#Nv~5?dy~QbcIld9!oB_6yKsR0Q|R2iIa?5fi7vJ#lK+)eny<+x?s;$~ zva?r6{y)pMg3CI7nHu9Qj9Yz$1z#PrW|IIKpJcg-d6(UZY0VJQe^f7|9EX^1mh+I3 zD-}L16H_$dHRgMR%!J@O)9uMWc*R0V%HjF}LuRfTrH%g@`0b_+JLUTM*PoRqm)Mf$pg+B zj6txh=nrAB{wK;pxtyya`@nMF?NO9alx1-ia)juGWW2cJkmTE})mjnUN^Am(D+5Lt zJe2T9Pl;V|5An+}fSprfE@!{!YQd>}#X%N3!=;}HVp_#{+Ezv8U(l*RG# z=2spnrwu^6I6=l;1w6H35R ziP8G=Lu!NHSN-`{XRAap4`<+IQ;ofUdt4Rd?PrU^@;#kUWdO1;CQ%67`gC~KI5psT zELIm1&7`uVbA#W8hnno?QV-?)z#fi6Kt32wN^H5k+R%>6-daKxLGH5R`!HAmml{02 z59#X!uQ(hFg{|vd$yC`8z075;nSv-+t$%rG;c>`%g;9y5XJ?=&yzU>Irl$xUe$k zv0eS6>G6|x1tBR$B8@w{Rx!waX@3lqlY?*_ZuAu`fWGyPg^#3-Iz7Qlc|PWRW*?RQbSYS&foA zE4&vXX-~vM!aJrUnK2gS(l^!?AttSDm;xV=YUxo!{p>=*fZYPH0IwzLA!SCK&q;9p z3f1+LY!SH5_7)eOW-C?$Yi4@i`Iya10nI3Ve5J(%9llX}pNID6h^oJmouT7owCln# zW9Iv(C{R0j3C=sy943C?@lG)JGPLO>63z_nwTU!GU@8gao2$TF2{-#nrMT^j`IfbU zCX|WfZ&Wr%S=Zee0o!PUE3}gk<;`pJ1be1Qh*B4aPkxgBXjkHl33&%1;oY`*2GEDU zGyWjivV6E;6Xv<1wis`o3hcXKg7(rOiTb3br^4d9+v>G2z})yNemcS))5K{>7RK}^ zHm|~*axE2aFkl`LBNCahGoR{9R^Z7R1D>pnX&_iqG$V?F)a$p0vCUm7b7oJ@(XGY`732o3&n-bY32t{W5GNt;gHIqd-u`I9nTc= zY8zkl+bptn z9mESZZLzPd{xLXeJ(@4%SwiBey@HM|%H(BL?1 z7NhDw-k)SMJ<5?^6Tb^89mcu{52UcE^l7J6}&5Cy`hA-k9nEpQ%;X985d6bw8Ryp;d!gua^JF$*~OV50z z2HUTH=ApKIWc`rO$U(ic=Hi(X&)w+llKW{dWc{*#Hw#0w09S9*!2Ix4;j%mifMXOAy5x zd2wMo(?}b)LDK^#)4<8=JF+rg7POM&dvq{yqBe*w@6J5JJoz>XxLo5kVF$ zDJ+9i=2>Sva!E!%-Opc6LhMkzKmY(ig2+P$<>gdzGC(B{KyLF(BdAXuo9c|Ye35$9CSNqsJYbv~+ z#DNy359PfMzi*|Zs05(fM`iy!`dEFC?dm{U?1yyLPe(@bO)87PF>ErSmPt<3<(m%&guh}82z@0)Y0 z!MKi`$!qX(^T}wYaAZ#C(AJ^VXXA*&>nLRb4Zf`%l}~rk;2oB7X|XY!07D_!R*3eO zSD2lEkz2=}`#Qv2E#flk?c1=6;jP)1Ff&9@6p_g8?z?=9M1qZ;%n9eN^qrCB9GNok z`rS2NjxqfW1!|%YI!OL1c0V53n1e%dIP065c2JTQ15B|V+Zp;792-s{?kvZ z5R~}x0sio>hP6DGw?(imB(hmM=2?E0*Ooy^rWC^j3CbyMr-|pNRzf=c7A&fbJmZ>x zgsnw4jp~xdVAUb=2y$eyyDx}S!x;)M7UNR|f?cRxIR@0rej`#GRukO&BKHcsX znZVK|C>2@aoS3Uc5)C*la+j&0nfAM<(H#606(|t7#ATmW9)uKz)6>#M% zuD9laPZEeANIGJmgO+?$bX`GILDt%Wq=!Y1M<2?^(tDKys6*EQtN!i4*A^j90ceH= z;WhTc6*kTfQm$2gE|GBQjTK*`Iiu07QdLjb;AdjrF*ze&Xp93f%N`)4qBmxz9-^vMNNX- z0BCi{?0tgj*U)&}f_D8GVQAkOP8YB_4mHQs6*vG9$=*7sjtmeD52QCQ%xl-^XG$7M zHRZP9qw@@~B5!}ZkK<4yzK>RY97XLZSb)T0P_O7X9j{I@Ei4i%620hc(>7+L{qFjM z@~ORq^YIq29@HSSkqkBbb`b*de(9`jW!UX6lO6++WF*nI`&Rxr?&E&bwa$DeO%=9K zD>zXV(ME_N&=(#uvS{_G9&ckG!hbvJ-r?ymXzS;-dori)2+-{jNUwL#;^l(hek|ua?R8yO7;nwcz8r@ za|Y$z6~5-4V{GWuj=6b%0l-+9XiHytu3Oa*4;6_X-2&c((hSO(DY=8A2s3d2U!zJ3v{H(Gx>^*Q zt{skdZE4OmP>=A)03QMC3|;oPIXCY9N(NKxr-bWGjNXkwIbFWm3^jkmI;!hHeBGA50-c;Hg)+96&@oe_ z_-DyLQ*0`sq%_H}93I@TYYqmnlzMutJ_Sj0A6sN}T9NhG<;b<4I->fXECen^h{=gZ zNWC;Istza#oP#5yGl~*fC0(-KCvXV`$V4$C$PmgP*S)_=xk*a5u$97^uvB4Dfc6F* zo5h)0qv&%qszwEBU@L$@8Ze9HoF^$nvk1;Q(z(lh z?ij7rvegGG>Co*ho<2ch*MF7L=*5+5#LPbg%EqqEJ`T$usC7eIy{CUI(J5j{VKd6V z8}h!zkLMN`Rv`Y(1R^O)HsM>SdZs>wG)17x7e!N4`d(9_f4rNqX{IV-qqy^Rz^e6agoHFiA?igS$ejvbF^nC7sBBi78wS)lpI! zWR`;_m^l*E)}$ANQt1M*%2_e_WG6+Fiz2=Sd;=Wp+Q8#V7*~ox>PJMpXI-o%eBd*@mSOaLr5xITSDX5*U+XCTpcxGaVBO(#a`79)?9 zSY(Z+IT{e2q?A(3$1SIghjyJMD~Zpi^)Ac|#KZ1AwS=H~aki*=kX9ad(kX%Ng;NeO z5H(eWHmYKON#w5%;kdUPey}=~!)0b>mpB{rlVwSLkmoV>YZ&&6)2gxfcU7J!&| zzamSK8^7p-_4`U4#aMcCelUpzT1v1-@gm*ZA*C?>%waKki>3j#<)L==vCNcbMZIN+ zysa!sR``U<_t?sU>&ts+R?m|3Mcd1x>H8-5xoA>g1N&f(p?bT?AwV?&es(%@B|o-#4%0wnu>6=t1F^;8Kl4`8XoKjZ>Y z9=CYg4^iB=MB95p1yZ*+5)y803^lWLOky5j9~Lm%Lo@Ry|~x2g|0u z?aP=`#<<_o9NjNY1%V+@3D_ANSNS(@{b@aR8Vzk=PItBBYQAJ)BH=?qWETZ#a&4c2 zMee_qC!nRh^NHhV{UY;`KvrZKumLc=@J9HnV`qO4%2JU`wsB59|L(!uxtT|&pny|i zIB+ImGlKQpo0wk_6?u%3+G;Io;Eb-SvhDZlut(2-~AYeXC_{;Ab=& z#MMjes~|$!3XA)ghp|um9yI37{e_gMs}+^Ep7-2Y{_@If=aAC|-GvjzmD#c!4~h5a z;+=J{6lnS4I|lTzsLd3mDnWv*(5_;m?D3ww^aQsQA8JQ=$Z7EK9F}9c=C*ua zRL?-E+5L?Zh@H@O`ik6!x|pn&1}H&B1l>JND4G&k%PW~k8=7T|Ql1bbBL0f%Om5Vk zVl+6HCjmJ|T5125Hn$V)n~dtP8?un~vh|VrKaPV}n`n;@SbX_3kPPR$guqA&C6b}W zmR0fk=mVmEOx)o}iR8SxNtF~u9L9cYM`>^@Sk^ck%rp$f z3&-MhaRrkNfzh1OAx?800UhL{@Y4VOu!Do0iOZ=ffyf{2;qJIhE0G<1zfIprwWRlO zDdwn8N3)9mU*YfB0&Ti_jkEBvK&)XV;p~tq_P~Y=;BB@`oK1 z{<-BRb-iqB$|em`A5f&*1yh1Pr%Ku~iD+QoO-+ecamL051H}`XVcIOK8uisbZP1-K zAT@yUxG7(1p^=itN09-ee3&>1tytG&Vc9))EQ51hQCXd^4}CbUu%X0UpALI!klGF! zoVKC| zb&Hv}n+ZIlk&1u|I64yrF-=PU@CAq~?(c}ZUQOdvH5l1=M#ikMtsuj|*-`WjFe$q~ zD!pM0@y~O@&W$L(s`WtDy-orwq8fF-^+61qN(2Ez)vbeL#2kI1s(pV(CD{>)o0-c~ z_;PcUccx4Vkmb}EqW|&vY_h%ML@cSIr;qD&{@;w~l;B_x4O3hVV>pX*CLt7T+gAGH zq0FFuA_Y*x+Nt0P2Q284**A?9cHKBo*^Y_i4bfyX)3N1Fu}Z{hZ5$-J?sUEHx|LyP z`*TcXMUcLU!&Qd#7`GzuvYi9j{kzQo3Ifr4K-U=Ocz|RV8rfx_}kGEf7P4ToRc+R;{EF9qjGD%0`%mXhH@8Iyaz(|}m452`7;wYCLubqQGL zQ85Ww^sagL4fb-c7L0)v{?8f9fi+) zug=X@%U+U_+%o@rjlxWj9NAF-Y0VMDgjr<7_&ImmM*3`L$KLrOxr5FkDGGdam3hSqctJ7T*&NNdlTe@dh7sdf*=nxh4PK+X(FlZ)Y~Mm^K{k;_qnv-NZvu zH_4n-mAGon%570<3CUDlm=!js{U{;Unaws2XpGK+7(s zayTN82-1+B+sWWq!E-039+^Os9ofEi1n?dzJgn8RVsT?r@f*vI!d%{HrS%<@hno_0Daks z8dEUA5StHisF|ZGaE@a?H!x6Q-*aY)3-3q0u#dKOH!+A3yq)1X9#hUZl z6_#xp&R&)DQS}taa`3chn<5>Qb0en6YQn@q6@xxf&>1zw788 zm81edM#2nY4szy}(%e=A^_$N>W!J_3d%;5IH5=KIBdVdgJl?5q`CaB>m-5%DbDZjl zJb!;P!X0oOsLAmileZAA8e#SiTRW> z;U-HPQdi?1kl0i&(FWOeXA!EAMbQS!1*lF&FdoyKEF3cegX;pd_?ho`>$hdF7V}gC zB)@0%XT5v-$(x#LIDsV*KB$2*B{)I!rz)$V{G;Q+V&M_dYHH&erRgnyH>GvF(A}!@ zE?K7HN_l+oOC@4y}lD$bvq8nfqrH4xyJ_L?{tFGq<}!6gAaMz3M8-i1GU`LO~LV$gG7 zHb^EvGIwB(bz*v5m>(9!3Xrdwf89Pp5-~oDeJ~lInJvgNIsmGqM41U^5C-gDKMgCCsbc;ME{&$ctTOWpM99Tl zVjVZ;J9*FfsAMwEabisXa?A~>q4xa|>!n_QL|tEQrsXG>MF)ett3y3^nHnStHE}SeNrTtQIj*gq3~HDRmXZf&Gn(CR#tF$KTO%HcvM}z}J23_?MMl$p=dopW*CQ36Ugp;c16yWh9xbBn55(rM@l5V+5 zcNL*_caF*yk(Q;K2V|DR%1p7#SGdi~5urb>SG$=_o?Es2SfoOEw-~dgQ{+3=oCFO| zXY}}CTN9U0^#DZ-q>rae2>6hWGjS5ilNMuEuno(7w$lbG*=)K%MQK!CP*)Y&6FPqkG&~)sBJPUQi;!IN%!b`Z-2hHXd?f<@{ z&jZ?7r)cvhyuf>y+-)~7&L}#a`F+rt)lH=)dMkRhuK>ROdcJou?cg5ZuLSeH1!M#d zDeX{1f=xQW%RdtdFt>HhOAV*{RvCMi#vunSw`%l<*QBKz0{5 zI!}mXJ2J435LWX++~=aGI5|_E*2h&aluU$#5mT>IAixI2 z2`k8i=H)In2>-FZbhEzaFNjy1WA!~fwi)|RthHh7qtLEgv@e&dpKnGlZshce?DLa3O zC_ig1*izO#D9i=qf}4Rc_mykF!v%peaT3@U4b}=c_S_q97dhbAJ{~MP*uPFWVOu6dThi4Obut|+ld{?ttTvcnYX@dR9MI}Y+6}@JQ9~Mb-~er~+!OAC zvU%Mowc5*ynTwb>&Hr0B&EH8M;?fB?osx8Xzt4CsJ~uVto+E&D5V9GbL6&jGq5Z=4 z^I36gS$R(jaBA+AUjI}@LOafI$HSe_t#H^dH^9vK>EOCx^V+jwc?ve4uJrlzsx`Cf@f3q)@PKT=8XMsl*LOq<`5)HiJcD zgC>tMefMh_O|h(As!~?&%#TwU++n3YY6)?*(PbjU8bN+KY_IzBW=o`R{aQF(%L!@p zl9abfl~SrK*)&!aVY7zek)3vG?ZMIkfd-^bR0fDoecG167r{2=qN<0}7;fW!@s5GI z*oux+_xjk50ijWaks7hGX zcy2gGd>Ez6bKg9xgK%ns(!3gi;9%mKfR$ z*Gn*P_cMv(irS_w`=aPD)Y*^#2pR}s&c`jRlA;M=spUj58ZVB@PKU)QqcO1kU_5Z^ zafy5`CL}AHS`PSoo69A=v$s0XM|ePF`$zX>kTq$(WVg?v=-E{jF3B_^~D!M2V| zORis2SDLzGEoHQ~P76LvVI;7H#IpdH=d}1HlUrbS;Kz)q;(VOY{`MK3HI~`7++rh{ zo*V(mG)^UUDw>d1F73^s_=@(3rgn7-YbyEyN&r>6Rd|;R`iyni>OHWb4_=_xj#{_r+~ zz2DVT8T4<8qjc?7g6}L^nDN)7v~VyRBGqFQPXv#2H>c3yv(5YKKv>A1+i}qBAv+xv{;{m-T7RsZtNlIHw+mKM!~le+bz@tl)aFThI3Nz z#q95t*q4*&h*PC&|3Yla9aG^Cghee=%|Iw%O&R)x35 z99+328f9*8oQu{UO$WM91YD1wauPb&wzFXv3Hsv!?_cNGX$p!auHqdrFQxv_KE z^C^$O*Bku=b$@Ui)4qYTSsPLs|yyiKA79-?fQhR=2azG(i6{3zo-tGug` zDc;~$W}r5&?(%TZE*l6j0B1dfA~|Toq8O@1*{|Xwe{+4~`CYSzLbl&DAs*?C7yOh; zuSPzu%66TOn|mIXHR|%V>CB)*?Nd* zfQD}aE3_33FeM=VTqGHi*3YUAFkt*M6=MjR9?K&?DMB-=Da_PSHTx8UgrFsaTP zyo+R>w=TT7?~EZx&Fs14Mr(;b?)&p@%ms|S&eb#sk(%;NeGX;jSpds^atC9FcHN$0 z-|)zsNr`kyps;6f3b*fZuhc(#3#d({wNufb9^bLb%kHj#7D$7NT)En)b@g;gO+>p) zkj3_1Z~{aRic|m{L7eYHA~Fp25}}+RJDVyt@>9@X`{P@g#;YR8#*3|Y?Sp=bG^RKv=7a zsRU+@d3R%CS+-kohGb`KZ%{`WBqsNO1TP6lEKg)#wdy=74-2hu^!{jAjs`47VoghR zdh==|)yB7$B$Y~?ck!MbaQEn$l~juuTXgBMWf){Z@IQgzsTAa^e7w1kuI0 zHU_t`D}*M3tD6vnKm8LVr2dMN(_5>0WIBR!qY=j^M&tb&~>Ut>UTb4;Z zMCt3H2$dibWTM%mZ@&^saJKnNUw`&RMuc-Ezpv$*=0a5j+t(hpjIinLfJtB+z@gUI zVOHS8YJ{pfO#RpN{S}oxeyi%MDO>@MK@?Ec9u8FWaB_7AA+Y~`X1X^~iA3#R!Q)^| zeT_k;R@CyE2#A8zdQ-tOhtjezlCL~~Bx{ip|^YFb88 zkabqz-Q66BfqP+krPD&4-+4Yz0(}Zzp!?ieQ` zO^GP^87Y^d+l{#(M`RK7aAzYsE*gfjQQY|5mUVU6Dp+~6$QJGj1sPTL)+~545l&+= zoO|&*j@8Gs^QGpu?C0dU5F*w9dDB(vQ4?3aBCb|oh}ws*c#}UoRvxSTweKBbwY5yw zCPm)i+cy+g$ecLqvM|+DH91YnYGrAjSMDsx^f+2SvW-k{CszATg-DTc608tw@DIoX zq%83yjWn)__cvIM{6@5_)wJK|l(kUztwkdvP$U)Q>@n$@J`UG4jM0yMzQTvE z?Nyq5)TsiS|KN*E+q-^H;LfHX6hHKve9fn@x|v$#pVhJVV1@{P&EhIu;VI2_Mo@xQ zK6(F*tWTH(l9h*R-Oqm(u`aXg(x!9e1F<4!bk%~rPp?Opgb!9FEgXRx{@1>?ziPG$a zNP2>HP|>WH>K}wKT8cf6{hB<@_B({I%<1>yZhF3oLIzDZu_iBIc{xi|V(aA~bIxct zJTYr|V)U8YX~d=H_jHz3Ws0ksOLTShA$I6OX{+48T+X``{;-H!M@a?5EUUZPtv}1b zHQH?7L!aTOmN@Crd>gM{Rk0)-mEa(Ky#u)Oc-mEQh!{b=3+H05#-DfN!NlpJ1vuVL^9l+** zaSL=c&=MWeoy!MxK;v{^@ zt&CrP;P4Ifus&Xl(kko6=?A)>dHab$boUE!e~wc&XS%7H}%(zT{>c2e2O zo)1+75OeHERkz(JIj*Xg4WOT33V7(DnDgwz8P$K}aMY!mhr$ex%^cAR0k3J2*b`|1zT3x7D?=PYp)?W;iYW}B^oN=<4xu^DH$Tlv-co(l-*Un zPoG+mkNQ9ML#twN474c%KY%eHG5kcaId^a)xF(7&#ZBAo-i9DilCgOFt|5$if86lS zT?cMF;8~E&JY@i80jR&;ShU}YCwY?a)fKnNodiDLNlTH&Cp;P zQ6dflEIW;Og~@ytO^pzx#ozxBa7`od6i`f|a?7&SNwsO1WQ?bi6iOnyl@30=EAI-Q z0FfsnjXOU>~#$)mJSiG*l0%FE&E2$gf)Sg6|nLxM9`NhPJp#{jlj znt*N$6K^4v?lkC(x~)Ohh1O;(|mec<2-cN25(5C-AqPvb99l$$na4t9O_QG(|(j zeIi}=ySL`P6ljyW5$oa5Nhb+59OB@Qy!CD>@MmC1jlRbFt)`OkvZL?-m3_VAXtTe4 znFffE)ypCMjmn-pNI;${spGlml>^CQD8moSqreOzO8 z(HjJ{$*Jk_IONOC{;}TC=<|1n@2nZLZ>1{9aESF3O-qbun2mL|g2()&kZ6>!*1(Rv zi3dK)Nfey{t37|~!`7P4vEueWV}^nTa|b2d<_<;&P*O~c=6)f@(W~iC_;*(FU_nd% zzY{7dt#`kD4?5x^sF!69iP0lln7D1H+^A{|n*wkl|plUk?1n^OgsVK@sCnWxs??kz9m=uDHWb6!*z`x?pf!i=hWCy zEPQT=Eh~2hmDuqUCv7Nkhg4bqqL{!;GdK*g%%;IGz!h{djfHR3!esFbxa!4{Fx)2F zgLtW-F|;!}CiRssfF~y72f*>pnoBf5W05Uu$owG;A{3ae5R^AK$JpLJa&4ws4eF(P zObz{ua{)BV7dTf?LzNPPfX)u6PjumCiAQN(fNJDFRmv|zU0YDK)0!vYnSwZJr)&A&zT|vFS!FEiL;n2|7m>F9XxN%!__)T3?4ZQ@ecG|WD)Bi)KR(O5O|!FqlCyY>Q3jS6TzOU z6+MX3nL{!wk}-0@R#SC4r@wx1-5fbZ!N$tCj&4ns5s^PdH^2Y(JS>|BJtWkY2D8(I z#ol{&GO+ANrGhaVymxh-2$`;Pw5rY}wOu_}I%dxlEqLE_#SC&$-U`)V z_SEAI;N^#OD33DOH=$!S`$>j1#vI59GO-+FK2srstD=fxFErkpbgLqmdHLLkGUG#L z9uuuv3_Dus_J(){!z=lDsQ)qhM`>q8Pr@c31xyTbc-vE93)UKs z%c0Z?>|9ZO?ZpjqfL$MJ$&P|s$oDW~Zy6gE%}u5w2~W+;j1Xkgfmd&&)kCZ?G4HJW zvhpg>LMfk*qux+Ul<8ceiqBU$C?>b7;4g2mlphE6;iXxQ%1xh%tlm(Glpx2Qe^Z=Mqk}&LExXM)p%mM z=P^Jl?V&$`Rk9S6d_n(W-HQx(yporU042a`@;tJz8(2a*$WQ6Tho6dtVn$jXRl|wN z)xXr)4EhupB9v<5KtlutH;sWf@2S7U)@lw)UOWf>SrL^*-9H~pj9JADq)}`OpF~`) zBCXn03-U1Asa_nx;~x%3~+tk;@C!}v5qme8Ba zBlM8b!{GgUsES?6)6a18Z}PGfWz19{-!{JEu|X$fKlE#-V0E|Hu{#ymrm}S)1T`{I=EExx&&73zB1i)erB3@1rriKAaq`#IU+egc! zfc zYDp@8F6bg=&BNbdA=v{CJ-W#`g?^So`f&Gq)Ekx1#G-6z!LHTYrj!PRqXT4Sf%*6- zBMqq~9sarZ`2%@5bIDWW&XEGJfdZ69ZX2^BHc>_G7v{A{Gs{Wy{zwVtKPZcXb?lf; zQ{_C+1_<`|B<^I=vY2+E-mdnshJO{Jz!2Ch)7wisYo!D^*(F4rhNk~_J_Q{imx&Sk zN)Fe3Bz2*=1-~))es@|#60b+p?ZDT6kM&#~L)AYQ8(|^lHTxvg#w4B0h}vz5PtXw( zN}*(VpXq7pfAT|IBY&hdt3I3l9I5*uhE2;qfc>Q&YZc@Q0!J85j$k}s`cP}sauvT$_?1sPqj2{YA&`MqPaNJw0)-n<<-vSV# zn^lQ*KuP^!Z-QB!h|fnqip7j^7>P_Xdc#C5bngpHC~f1SLy_nc9V=#>7YSuuge4}> zj+WXsRU$zO_yquj1}l?02S-kPJ&#EJf_;Pw$ z3vG)lb0B0Oo+CYFf>HZ;^PnKchMuq$3TGke>7mglbNN|$MlU_`XR1auw{LfkFvB? zyQgJ2#Gh%kwsexenFE>%qMX=UBMc&k-WD_+y!LS9TTCU#ufhmP|3>oeEiBK92)*=| zu6TX19NOz%RxCFgr12Jav6T986zrEYGrDs-q653$B$Oi6zwk+CQv*K}M1_^iYZ(eL z{+j6W9k95>d1O)P^`lo)fly&5a8@h*E5sDK8s~Pksb3(eDooBpC}*8Qm!#n(De0Ak zQs-e&xKH0~;!p6_O}otxP4TR!2cMj?s(}z>PV5GO+5BsGpbuJl_BSWQG$#Zzelm7q z%?K1$)glsPq}ZE_o+d37zp17`E9alPN_ttryg7YgHP2EzO2l&OGV)@;hRlcr$6P_v+52ocrGd`a&QK- z)Cv%+9g?RL>-;nhiOq66u80oQa>X>9asBg0M2g`-gfTalDla1aYQR;r(AmAf(mScc zcNPqRkQ}~zn#i0JO%+j$0j0IQi=eXjh>FX(%c^YK7N4de01`0j@938c57#bHn#po* z9wm3`Y8v&l@~(>(iyI43b#M4n=jX&$sF5%4e~$;EdK^@SN<;x-E254Q46UKY>_8AD z<^(B7u#5xowzy@Qx`P=hi>#MmJBKLk?#?)D2tG(n1ldw_WlVdyX^kz z7*NT~2El3wgAMqQA)sD-&;_>n3@etDH2~^fZ;6TXQd^CELUR=%>xDlMR;&EG7p|6G z>TE1aLCEsR9Y?~kZxv;=-Cm*K?J8MhvL{zVSK@}j-nM6Qu8nBp@;YX04qTch3QnYh z?6*GbK$*)-d!#t_WZDK0a^F8tGQt9P6f#wpms^m#60Y|Xx;7gTXsJR{?Nv`10|o;iB6Z!*SHV-ZB{~E5?!r0+^-) zGn^L#^=@|Ce>iILNTvVIpYBVT>4qF3Jml~{G`h@wB7>Yo^kS6Y3Z&r|r#%8&8$`ov zT2`!h^+3fh$_lkS`c1`+f$mis8n1K{*lH=DZzcwpC++q!cviKS1%=YaA;&)w@sO+L zYa#s;arJNiEE8i0po=?%r@eFH)mDy}pYMPIUe6dF@>=uy5iX5p(Zj9SN9^30i1`wJ z>JhgSlB){s2>_TL-sUGOj{6N-Twc-XZTL4nn4GqodsfPwl=&rgUEDt+K9)5cK>G-F zL%i){66-mQ3}>j|w&!XY?FM2Cc2h`JR`ed(6QC)irZRbkaOYM|cIRcU6`eWn4?p@-EGxM}jtUEsj45L>W`GYE9|(P7RSn}w@~?zFCXCihcHPf` z^J3{+v{9Sw_|5*>NX{D3ovDSf>mYEAYoXiSn?L6WhoVcN)VX!K$&w7@ z9Vt1A6?LcdzuiM*>*{Vp`Scr;*z7W9lYMCzHGq!P!wKkdl>wh%|6?c!o@+eX4Y*CT zuitAHy11w*7vo$el%YOVw!=k>js>CdzJZcI$*R&;UN0Mqns17!s6$iXDu63~nv4&J;!UTvxFf(@g$I=_v zDV?!cqd!&p(k+i9xF!BM6@va-V8Q>s8A8VcHlgPn(7j^-im!N)2_~Qui7<)kMVj{` zmi0HLfLl6NFBiZAAtw-_gD}2K_6J24Mfo{xRwREtzJ9b2gr(1ZdFLY&Zt&qaE~#}} zMeO-hVjF(A9)EmxD;+a*M?u5mg#x5GxOYBtAU%{4rr7w3$G> z3uyysUcq@sWk_rwC9x+uh?ZL4Gj(B>-taC}6yDy~62&`LlXy(FIcxdu^I=-TWha(% z0Y9v++WVYLfk5VAI!gSw(kefnUTn;0?XPJKpr3<3ZN?P$Ml>BP+F&SM#mTSENa5*p zzdz+)sBx2Ynvgd579isvZ{N!0w33bik!@jvILIiPGe%R5FHs01S744}0sd zFGih?<04cdcHAXOMKX|zlTF35jH=P=ac zZbUnc9f?%BL0{Q4TWs(v-67iwB_kUzqTcppG*a*daM&fp^~(=+ke@3>SGs|s$Ce!m zk-9E1BH#}TTT1LnmM{w0hk<$EaRUq?ZmXX2e3#N5mZX($q}VpMm1fCz)N^FeXOj(f zAXZ8mxSr1@Z|2k8NcPH55cJHqb!e#!ohj(fxzvf0mk}sPwbWVBv+Lm8q&A}@1H^Zy zWT2phkF>nr4>qsR^^yb`%`b}kTY=n!xaJwtT#aVbnQovP8pL;F)8lsIAOH!V@&aJ_ zUN^bk!gsqK?{OPm0yw#+t7A|w;J?XWeA9Hza5uy0q`4vO}pvJ2urFu;3MicWe zuA5K;38l*F->_M;CI$DR);l$;n(X48XFZd+Q1XZEBUFOALdGl2MNe=&r-o`}_=`?M zhv5rP5$|dDB)9S}ZW{s9KcDvjiW;p3HIAObs&4!)jIGea>oQHCdTkTYA?m$Biu^3; z_$~A;Lui-&?U>h%Kdk1km}VbfVl09>D>bxCHKH0cvQeM` zKDUpOw3%kliNi?zZ$Toas#bW-fqFBLE=KnL+OYsb31~};eF}iAT0@ZE9zMQqbrD|FV~<$?97}WZw7e5jw8dk7**4xLLBGGCdssez&w|+)p$;L5 z#)*{XKSVsEZSvpyv`M$O!iCX4=i5Xu)UUE#E4ri314aJmd%b?KYh2&={5{s`b?GQ* zi5c>iS}Nb%{@sTL;m(73RHX@C;cr@A1?LYzvV+`!3P0k^1{+t>k_A9D4Qu6Iy2U&W zQS`WYP88Ib?qUG|4q*i~_H8|6Y()*Ye`yV{4HXZ%SGJ5leTv4N`Vzz3K9^>j?m|wF z!to2R6WPFL(&~p6A2v&3W=$kG)&D{lqn%?WSL#&vJKJi{E{k4=J=^}JO*igTJoZ@7s`MtoJ1Y08KoLhPWY)}Sa51Y~{h%H~ zxRa8vcqN3HX)1W4R1yG+5>H$!mzkb=`U+=1#MK5-Lu4g)#T-QI>39`ztkPtDu62GD zqx_jahPnD!FV@Vl0<6-_Q4?b-o=o?h)scKGv~2#p^moV*T%_+fIG-tWy+7oIxL=(-Om}BFQ5&^z;U|*rEnQQ6 zPt~u5b;uj2a)Xd|I6rT$N2&jzoVPXfp*x^HzP)A}^y60g#v4))W z*6CDR&(i+G29m_RTyG7Td0%}~+c-l|IORMJXd_9waypWaz%a3&uvFVv zNiK-6vaXUPEOgAU3`l8zgolI6g57^D%vv`h&}H;Ax9)-WAk-cDvV=zzL6dlz#`HlK zDcn6M0&(YsrY06po#&$JI0jxdi}`>Sx}kipV8A-ac!;ExmUX@=M(fn{rUQ;@_g~f9 zox~p^B=~2!^zcim0{;zHF1x2_ji;{q^B+H4s}e*yM9((&Z@ifvd$N(V9Z0@9PlTE5 zSrzFe*O!ZW!WE*-Pk4GBSM%DTPxkc#ercDf}EDYl|Yxg^7k`2^+onn(aHb=KZAwi(9a7SGM)`=X@?onUGN^ zK#hdq{NLGo zSFbt|krax;B$(mue@qlP0rnVA;4Swq?UqD}e#h_UAn_#OYaPtmGV^^_epbGuiQCyc z<+fn8?@(+Z8I;g~;!BH4ZbgQ} zc8w@nlz!TDO9RQU{PFB4&k}I$ADR;d;v;JAtl~Q+c<*!VGjhT+{y%ySgQH2Pn5#pox$DiO)1S$>N#fvQHzCCt6)(L(3 zk0yBSyXRM^%CJ)-GGR;Uncu6Y`KGlmaAkp=-c3IR@yXTT&^-Z{Zma59ou?z?Qmdo< z52~tPviy_17EVONv8*VXDX@?%st8{;?lH{gm12qfyJqHn&LulkZToC?aB>`ag!tat4g9wbb5N^&HiLxsLy+_Blr=;pq-|!&8U>h!e zAWqn>d+!+W<(6s+>y!WhV<{-1{FLTVyv$$l0EWPb8OVh;E3!+ixpZH0C>n{0_$IXB z+aTvPO#RAm9LxXHC**zw`M+q^v;0$j6s9ekElLX5u>$8cd$F1Di~=s)k{5LszJt1Z zk_^W?l*KCqF?$KVIGy$b8e@RO_TNgVBCN7v&~I*#S+bB;NXiZwa!frP>gXMD*UY;D01h~6tG*^f-QFzafAB2fZod+PhwZ+D(lRMi@~9{-r)sXrDL5w zI9uTkj~K9T$eYYW5M%R4eBSI}%K23CLKB3)L%mZ){VJGE{P-p9`)L)}@TF8E_p`ZL zNpsMOIrADyH| z>Vi5{Z}NlWVBf)SitW(=LyrAY3J6;N#qBvaEFn%qodbz*WI`fF&b z#X3fmrDZk3E7Yfbj0y8gdu@8k^6i8B8Jb}G0F_5(sp~uw8nTQ2x^oG;CYV$ev3R2dUHbRjfHJlc|+Ivbt;hhbd>li6b#0` ztXzD*0gsi?BFwqyYSF~SM-wnH*4c07i)mQb8iaBoDK!jXu~Z>a@cFJ(7O1Wk(+wO~4b7(O?qhcB*!VMqeFjhNp+i~y_+px6`xCus zT}WMWF9LNzw2n_&b&!#McQ~8k1LXiKj=COL*J=G~W0s?eJP(^~tnk^tk6l1uV@GCKrNTZ5GER+rpOXGwiC`!nP#-m1`C>Cw5Y zH{td|gX|*aXtZsS`2LuqZ{ssgP&yC&!_FdhI!nJ(a|dqylNa^R|F{lD;$*Ecz3JIo z2)>&FJ>B^Q)MP%9qTpctFxJh-ffw-(`>>u|=Z-QLTyCYR5CwbWX}z32bhVXwu51 za|9q++o=;4pNT;&aB^<$<0HhO@CWI_o-XM%z{*uf>Z4r<8ztuK7o@e$X23BuQXLq2 zr`Wg_cJ_43)jUByW39AL-2(4Ehly#ElA_lmQ7!G`s6zX!f$^K(A8~y6Vu6aJ<)`rg zCL)IJrp8O>{MS1gsnUMg1lUD?eYOE?rv6H!#Iyv{sES0x@mSbJL{$D;6mAAJ?9VU_ ztux7=B>aa}kqM{j?n3=|i}cQAc$aRA3g?^{vd(M*mptCgZ(BL-0QkkcUxN7UYFI`# z0kuXWu|1X1Uug03mDP6IVG!gPe#Z=;*!D%-i7`d#< z*yigl^ku`FB_^N*qgl;e+RWHCd8&-Wg}rytnu%))n6U*6ODeZa@%t~x&HT7@oCiP$ z;zB47WmX=-W-q*R&5CDjG!pck7kGFX3A}SXX{=gW#-dVsi`JA_d~s6-X$su{aVcUR zmPT45Sp!m|K-IA1KX5PvuZvnWglAL{UKW9)SQ6&k^#`Ec02&BPRWT_5; zTWO{67gd`mJ%3O}-m+4Xh&s->nJrR7Jp)9sq>~8+ZZn4{<rLV9{KfRM?3HlHbsi#r7tWonzZWEBoN)raT+yLX zLIT%tqt*WZ zEs-L+P0SCz5@Scdn_vu*H;O+~yqB@_hL}WfX%_f<%aJ6)L%?F|tP}wPNRz|5LG8`GJ(R$zl2>Ry*x`+BPo2;a*;>g|?3`YPbZ_duTBCK=Tl8Yxo ze5`8s1J>%fLL-`zJp+ymQxQ;!X4!8$C}r>Ry=QebZHw1;@8r|Pajc!Gxx{C}<%4zX zXs?marhy`NdHl~s>ODiI)P!T-TvJoJ=AKmU?~B~5d;cK)CSifne0x_qae_PQgO+8!dVw5p0`P;wY3G|&v zSyt=A{l{jDX@<3MKxRVPCyoj74B^S(bTIPD{4(cIAI@k8WHe>-hg*uZgCkG|*Nw@x z6XEZ?7*&>CTQ#N7e?RA}m%@nwP_QZ=(LUSLm7@FQd^G06CsyDj-eu<<26PF{;Vt=T zp`b9Od}ea+!sVOt5lb$#bX`$V#~v|95jl~@tDGO`_4l3~W zHe9S^!M!`kX;^6Xv*2)}g0*Ir;YojFxC~hhB_;WubAiDy&*}M~00N+TU`eqVqpTwy zp@iGnG!G@Im#UKpwY=PaUK3@+lUem=5|%+?Jd#QDNdH?3S%Y2BH`Lfudk$s0omz&5 zXv()%p0{m8`VuxwhudcKpW{kQW$s$2VS)v zBAexo!ZH(m3ELqtCLg<~8bTB46_g{_LM?pKD^56dtoDi{B?LoHOc>|W0t&JG50Bs- z3L=2DM^vsC1pb%23h*UT#p;d5=4t>JIs8ReArwdZzJqofP8Mk4vte6k_8_PkGL_j% zfb_(Vq&U0*DlB#A&NT$2yOv_J0!S6a3^@s4iMZz65QP(SmQKKuqJ`VoyM($JB>Bg z!XRz&Qr>#SXfv%N{X^tSXd9Z z?%H*a@7?{r2c%fI`}5?ZqMLrYkxF8g$rE0UhPjV2>N?rD- z?+6_9KHvROSjovH`YNt(X=Q12WmsIyhQf;*@Mj8GSl%55rgnc@SSxam<^HzbJi?Fs z+xU$8lK7v$E$TO{|MnOCtoh*YC!etLAOCIaU`Z4FZH)i(js9=r`~Cl~+~~9HEQPnq zYf^ZCpjW&QRcFvlN!HP6>nN@cwH?gq;A$oClhsg{jl%lMD1FMp6nv@8@yr)Ist4qi zPst&rbr)LO>9uKdv5sgRrNU}g&))vr0$ngX5tr#Zj9?NC!SMA-{M=mO~H(sXOZFF=&+MDQaBd@&lwY2}3 zuTR}9dVtmQ`(RNJnq0y-@8&IHK8%1ly87(i!pkZtR7Gu$v%youQ2WQz#k1?y(fHo; z4s342YeNS2i)j+W?q#u`oc8d79MR#_QE?DRm{8a2f@{T>v*ehT!e{*FMAeHOxqu## zMw;bLaCV|bm7&jpeVNDe?MY9k+cyk6*Tb14ed`Y*0L>B00gSTAx5vK|W77DZ>iSmN ze4MM%G>%o&S)MyNi!HrXULW=G$e81N6BoD8@zK#b*B73U?ibbsm~9BotElRVA5x2I z^FwT4a{R_5^c*a|Ac2R4$(1Yxhd-VC9SE>KT<`?Z}_)M^&aLKKNkXsm{LjK8!yFG5 zhf+XA83MDV=pgb&SCpXHAG#%hRzOH4&63ZNjc$U*#A}Jqf{zU;3=0%xEp4|Jg}?nY z@JtuZPY~e%n$I6EU+$~RGnJpKja20X|H~tNl#SvEPj>V^N0b zoa=Reg=ScS5cSnWye;_ITh|QOYf9Fjyx? z^IN?O|JoV1d}F1B4y$CfE_abB$b#X*Ut%w68Lz@5?N(?ZN~qW$#u;ssGy3(B&qt

L|hW3iC1Md|@mzDQAsw%U5E<2FI>MDxn%tOPw~z2uD1vhYZiC#2)G2Vyk5> zgK`o87H14NA2j>I^HKe}Q1GJeYe;TJP6FyYznTwd zRlv?|Zb`h<+158|GqIWMxYZJ*ZU=^~6zSFDpWzrMDL*Kz3|I%!ym(S}O9MV<-@!j~ z)71)qhUPaSVzUG01%w>N88zkGmE{NzbxNb zRY9I`aev7hrO*#sGo|~#-*TFmij7=dPvopb0d&fwZ{r%s0Cv|H{o^Mkv(Cb4jD$Rd z0SqBu_1{C~!KtGoecXoZI8+V4%V*@_SZ~yfaOH$c)V~@T)>s}jGIc-V?9km1>Nxk4 z$k0jAFFwaIDvTDXb-jLKx?NCrX9?ENBj&vdX!E(X9|ytb2$Y5{+kGzpKWuwP@NETSugan+}yZB>SccT(za1Fo=t}??_)%r1eBo5l}SV%b^Ur`e+A|kUFUo z&3`MOOiMzrY1C)VVg9AwtAS&4<&a9aYbpdftJ0;3i3#v4P-zgh%;nXnG`g{b3pRQ*@s;JKTvn=Dz}Hrf8~{N5*931W zKM>+E2-LcIo_%t!&V1MtV?Quf}t!b#R_j&=X!)vgqRh(9Q#y3_KxOR_GabOa_tvMTO+PlihIE)RbA= zDUtdpwV*|b8H|=p<7p$5L2`ZOMnir?G8cu)Qgl$eai7Pk7=n3Zee9BOx+#${@?&Fs zo{)ZffXO)Q9KE#xe6n5T=ET9c!P-Y{K@NMUaJde7mwt!WTVaOXG6y!#6Z-8W7KE&R zHgrB6fzF1O=KR%5oW*C$IvR|DZu%I)oqRI$OyBnu}IIS+^(^;wDomh z-A@R?KWh~(E4hw|klGqHa;=|eH_gND1>Jt%?g}3?t;{w~8ZUHPBh59OBflgatz4|PyO=%DVTFTMo2H=*o~FyFO}Bg}>1-D^hAjY7NNqmswXKJM*elG*vEa$~brMqqJK zg!NeebDZ)|*~(314l~UuR~@gh)nh~vyB8S0e2;83rZLAnRCM}rr_d{O@eaap{!~}$ zb}Zuhx_wIW(^c}5uSULEDin8?f?gRI>GW?thd%-glAHhu)&R@O#C!89m4{UZz83|P zTx&Lg2(`JmiR1)P(#G@7Ilx;a=Gt~KKYqwOhAkwy%kKp zk)%^DCHugXBHAZuEXe%zPnq6u|C#mva3ov7Qim-X1FQNdj#9)g+ZcIjAH!9zKl}k+ zso}3KJ=L?Qk#f^yCeU%OO~aIc@Emdc#28)?8646HaGu6#A( zz`t{aLEv=Ka3yBCdk4(`+(oCyS?E|WGa+peEjNNI|Im1d#hEV^OqWL#28t)$tVQu@ z-M7+?>SZ9Ey0{QfQW?-nr!o}EIqo?((leFetS3s+Athx7-v{Erf^Lw<+dga7^1aNq zW(YqGYS99a@ydGEHiPy9D+Pd*elyU*eQ(N@M#6F+MSmjv_|=x}l&ONddx&)YYrdKF z2l{E0U<)g<*fKj+ABrbzKE0`1ygVXYo4RlByrDsu%b8#xbSaTRl4Erg%`$dc4BSd> z@|=;RJEVb|YPuXxPW>zz$HxH_-R{9tSV4OoE9`I2U};kj z;oGSj>dQ9&--{*Y9gX#)Y4b=zs5(t+snd$;$`7CKm=o=g)=xJcnS%T_JqJ-?8f5$A zyrGkeeHz7x-6L2-g5_b8b%Og-T+h`jmfKwaeu1jN?~e|w#KyIGATvBOje8kCO$wpKt&?xBejl9V0l+C-gameGfT^w? ztCeTg5s|ZNbw-6`{?jXl-0)v3BD7-*G=?9A@{Rx9L692x(n!OHdSJQ z0z$8TetRb&S!aFG9>W4JI+K;n&QMT9Zeed%leJX+YQf7qb1tFu^*;zUBU-%zx#2vD|wRi?p+C9&45*`9`g^Xq!Ze;%EFmS_ek_GTf zo?bqY3F7unS_~f%V|i#Gn8^>F(f6>wRxsxhAxx5q9`1$Zv|XR7eDDtx?hIs*<`ki` z-7e_{&)@FIaVMtCUp?~M%;Bsx1l#V0upsSlV7F^QljHM!WS8;U4-L|S&7%j}+dmy| zn2(V;fx6NkL>v6@m5#SxUZv%SiC*WWU5*q7cH3z@5wvrIJ0nqr8AzH9d;(WspoASp zyh_9UiT2vfMEKr$bo^%uZj9Ze$H_?xXAzsRLRg?r`FSm_ zfNDAE`n~%$2fM-0*FqyB&H!Iqou(z7YGI1^M@HxQRK;hdHCR#YLk@Os>g#66hYZ;+ zb5U2pLgO$|wXdp8hhq&+Q&U+)iR#pG)|C3f&LDCBjV`XhXA$AywLA5waUr_I)2C^r zyqm>Tb-tWmNM4v#D}9M?%QDF`ilENFZifSo;=SPpSs6 zpIu$A8BqYY#b2)NP^N)^hjRbeFW1B&v@n?~?iaD8&x6Cy4;EF81v}H)c?e+W7Ra+2XKnP~~;UPG^dF6Ss2{ zN01-FuKw01Q6rQlr{orMiGkVSI_}yVc^+5U-{_xmjlf|ZS93Kq_qXlsFXemN5uYz+ zUYzh`0X3FC?e`pNN^VYqprm2j$p>RKO{P+m2MmRk&!plqF6=gj-YuiPL8E|NPxTWk zw?1PK=g&I6o*nU(7mIM%nxpKe6gp}AR;uv{ZVyHy)HrZS59=sGp5s+GDx%O*K=ox* zd)`}F|I=a^b5J8+uHA^Szi_GT1SYPuwZZ3bTJ@cx#87c@jv? zmouXi)!r>n${uxQozUab(N9Cy&m?aTLn9dlS}z^7ENKGr`IueLE>-7*uM4jgEZxGx zWo`UrH-`EiIs^tPuKl*|ON{sQgyk!Q7^%Lc2txM{lsd7iL(fxw)|jk>6k|fXWx2{a- zM(l@$E7B*#<2QRP=j-s=i+)#$adRNzxrXE)ndjThI z{tAFf>F-NvSqN+%vpy!q)qYSyNRUUGGjH-k&!}RM)64{YtgX3;dEZDX6MCz6y28 zlL*}MEN{B;t`m*fqkIj4E!T6le_;A4C0ZlY4oOs;X_X7Z#*U7^nvIl#leCHTNJ)M= z_LX!MjG-i>Ox!k+kuen^)Vein+zbpEn}SwAd8fVl8Z(~+Szu_9-aK)o=4s}?0)`kZG|5K~jvWaM|7V^;Dx}l@DBo9>_76u1y z%e?K>%aimNY?sQydMM1%*vw@Os3inKP+QIoRP1R%JeOUmBh8Vqq&B9{I#Vtn7xJ`t>$gt`1@O-_^$O*o#er)oLImcBKWgacPq$PT- zn|iyU)=|i@#Jp{!LJzd)PS=!8C7cNaJ*T_S`*boIo?bFc5<#v9*h8Rb;DfCh4L+vjq(0l_=9G zhyQkj;MY2(T*OzHU_umT=_BK|A~JR}=m{96q0m!c27qp~5#A+*Bn?p0>B%!Y9bj=B zn%k6KKCK$PQ0czWT*o~Bj9Ug(>;K_?`V+jyu%Fn9p^bGkTUm6=Gn*6M?n-4cbH)x7 zrmIZJvgxjU7Nok*cN+Jo_;x`+4dlTLWWGBzW+t1Q-tU>(AP#mQuJ$IkQc<}d8h&;l zx;a#BL!Hd`ddfRuxgko>NQ9n(vrjRrgimr=KNAe;Q65N(7?fV-eKmPC+_~B=7=V-dkxSWi~&O-!xY$mM(ki zKln)!Shu!qN?0UY0}xBA%g9mjVRoNHeook)V<&$#p1{Ev){YiJJh>1bV|X6iLljH< z6zOr;hoiQKcc|^SzBIHME#R1GhV%wEcpCR}zk?I2_T#$)j*L8iyBJof2dZvV1hC9+ z0|=%Z$jN~(YhNa(W!gl={&?nJTPAx=k}DC*0T2!Fp^A?x7uU@Qnn9t6HG6VQ1dq;1 zZ!hl4Ki^&M9jiwiXH;QFi?*EZ?+&T6Bx?y~0%ys`Dm?zFdr0(2S<0L~?-pBioV~N% zY!(3o4w^}EN7yUO!hM%)6>}s595F56$}?^VwV3~U($58ftcS*xu*?rHh$&gEuEM+f z)&_T#p2pouxY}8o(h@PeBMDs7Dfo_1;Mc8m+eBp6q~_;wn$N*hm?5-i @7=|-LM zr3>l$nLK54R*`B(PBE| zek=+r{Tr_clL<#%Oj=}e7WFJWZJD_fWr6Wj___@< z;NKUm9F7*w16l)0GlcFO&qBk4Qg13FQ=U4OzqZZv+?9 z_>^PY%G8KPN_F177JVTn@CrPru@&b-E5fo`QOAhjaa z6turndnzQc3C|HG;2Z6WSufN;RV0=0b=q(0K6ae8ygALg@g2B3`T6s?oz5V8Xan+{ zi<`+Zr<*gA9(+?f(vx8qUlH;+KJT=A7KByepomurC+0ROSsNyoMnmZ$BC zvPDN5hH6lKYTBS%i&Vwzkdic;2t0w0XKt*4UOe3Fr=F5LT6qf?-yUch*Y+x!=Ok5&N=+m)vG_NCI%Qh{D984=0yVV4jC&QmDICb(@;tBk*#_|2V z9V+b5DS`KjiUC)eRbih?lX3+-pO@|f0HswlW=GR}X?1dmQ+snOEjwe$wNBT8A0yfx zcdd6LL2Pm}d+3^Kbq93ybt!b4&}Xf35!ZXHyvwPgnnp77CtspbhwsDwNK6Ee{ZvUk zhk}3CfK{%CiG7jv=_L`_$>sWM!v0#pbn#-ncw&dBEkZN3e%`r zPU9}%9R=l|Zs@Jw=AnGvpS3z8F<0aIVkaHxZq{gUiFl#8-}$iX+bwR~L2~4I*0rlU zG_ge4`+R#W>u7@qNSF624+^T*P4FY})%)i#R1IAd;_Ah>Ay0u zSgF~I7?zL`6=bVZYdKxon_e|!JR#@Z&Kj-ec4X?EYlByU{1#j-FH&H$sp!}CjkV02 zlDRYUn>Jpd^-kiLeG5s#HQK`^|GLVKFm~Ye^{T(GD&#kaqnSlLu(2WN+L=i&hGmq}Pz4?Xx-q}=+FT=`yh&DWmzy(S zWYsF%cu?a?1cRAiXg(7O1Kt<&cK08yWzY@4$dRxWx-4x+Fnaif3B;#m?9b|(MdznP zWo0==1aUPnhp@jItv;OP*g|}Qk`czDk9XVam0N6{kh*m%&(382^&^yP>u{-lQYEc= z$2=n-H%NMPs(CTmCNDHOpf;g((|F_>l$mx2?~M?cZW+*8-faXCZW?zSriCK%d+(6V z<%y#>6HC*QvpE8Z-pDV!oJa3W+*-B9(-zxW4X9k7KcSet%ST?hxsXhfbs60}oKvEp z4`{{$Ftlb=$Dr(Tjjj;DpLs~X2eF1Noo5J@S*!XYy%og0W!2mxIXH`5jS>}i@ug&pP^=K6>MI?K`G`z1~b!wb~>8*XTRLff1;!`FrXAs+ou=Mx$c>O`fvwl zo@Gi%9SQ8MXBYXsdlyH@=cZ)t0@sH2jfNLiI&!4ZatX=;4Sh#z4}T<7nGTbAnV6ZGndoibeMtqdb1aNwj_g--`fE^O-QYrb~pAi>zZ!UN4Uc*%#3|@1#;_bZj%#1 z+c~I$>3-)iyU(sP%Tfnx-B?IU^f^C(o4*Vofa$PCx4E1h z3No}i1Rf({RbAXm${R72CiflgkQg2$Dc}?B@>p9XcY*D-!-846JZQmuI}_}-i%~QBOJMJQ}xEPwC}Too_-Y67WQR-@yv|$`rrqLLUXlI z>)tpzyS#||bOlne%G2VpjBqRH0@&K`Q-!m!bW)3+{@P%pZ2;|RmSk8_)4#jE8s6gu zo4r`}wSj2`ww6Bc~H zpO9WHE(|hYE!e$Yh0`wkk9SyoRI`f{)uS0RC)Tz1(l{_XIZMoGjtqO8S!`E%4+fu^ zuf2+qEvqg5diUlaAlRhHF|OHlD9h?Df2-R08sI(G{Y1Oh^GU-QPT*LYBC(sL24|K4 zO92{aK6sF+6E&FpZ+7tnUO{X*8H|Hu`F7F7u}#Vwggl;jRM@d3g4wNQNC0^ZfhQk7 z2~wky*C>fSoEYzE3>^C6sJ+1#yLBSRH6m2ep1wzYRiWdT9~e+^4VUxrS>34}wAX&r ze0==jD)$jVgpU$I8~AoL%tPqw77pC_0&co|I^EFW?QGW6IVhG!KgnLrb!P&N<3IkG z0R3cxto7vQgZQ;$4a4snJ<-=$1p~GQ}2X@>JP_bPVOmfsvmLb@k*ix z(8!YvBf!R#lvE|SET*HdI3t**a8T73b?oYP⋙=X0LB2ORQzinB28xAnvHAh*hpb zP%7K#9E|Bsxi2={c7g4*Z=CP&W2IaX3Y!hO=lFhi!^z5}h{d`D(gR^my)K5epO#Ce zIR1gH1n78by{as%x;Be@m!p)1CpMNUOu^F`x5|?Z=&GahX?f^rfW%=MGs42=h7Sw$ z4)KltSkIdx(tpu&2m6p49HMWK^$!PL;Cy@wMtfGWbJte+;T@srXBM_&8df>A<9w0f z=WpN6cS>2pW&RMIp5C#e#tCPbe;9{ZF6QGCQ2e;WSeg(qgvQ<4!5*4w2>$8hZPmUz zCW__l_}bRv(a7}m%ht%TahU|RZ|?}JeO)A~u4=|XDv)Lb@qTI{=vK6~Nb zk*YWe*2bJ*6mu0e_dz$D9aQbUraHw-C`SaIRJC|k_(PFD_vf~lzY&Y(@vPo;RjULf(;gT|A6TZzzAoknds+zmKNR|I{QA+TCSX@Ihe;Ho?`<$=r zmXPA=v*XycgRGb=jFN%l>;cs(9xtT%=<3gqSh{p<+ki@sBnz3WxsS54jFI>9($KGV zCvx_;$IRnKHY##+!~Z4s_@3bMNO6ntA$GrJ>5qjdux#rdW_9cqA;N+Ln(A>>@&hx- z)C2t_Z#l&z|J?aaN-|mG>qt>kY@E}z$WE>;Nbbt%kXO{Dyj`TOk_N?%hUSYs% zgT)*M{=MI_=t2^tVB?BG+lD?o-PRwTBh+=!IbV44-*g{aJ%MOLoy(KIk|{50*W3`1 z+#T*kln_1Cb11DjD_t&ib@uCvr*m(5@JO8oahPAiBzlnvWLYCp2Q7Z&QnF^k2F?he zC_|>aYD=g6dX*n_1TzRN&B|~5G?;Q)E|bx;y%+_oBx`<)Gq_mYx$+ELi|O=~*ON&t zNB)SQgkjxQlObW9D!MFQx$Zr-$*7(Z!)inMkb`+R{W!?p$ zCW{Ll2B_kwr!6n1WHM4vE+HQ;Vm+C9%|5A7xLdBD5&_`<^+<2ds2i>t!a1Q~YKynY zcF_)TsD?1BhhgLV5(Ig^uJhbMOiv(#Uo)>%1V$~`iac>=bQfMl3)FmayZq$dz{}21 z@ITQUo*H@_s`L&LUvM2AjS2#dL^yOsBw4iQTD*UVr1(hx(Gb>P@o1@{k~9h?#dWlD zki{(jHlWql`Fd0DA<^f%$7s2Pi*F1lvp2uq4%bN;Wc**#+A@sry5Fjc()-Q2C7nmd zof5m;dRmHKJC}q&^%Q5P@N0r7-G#8U^`T*NL*(=cW4;Z5-p}?yOpj${A>_gW zds8KgNO;JMt6&OoyY}!{_>)_|?n(2R92M49gKYOZo{4LN#za!Js6++y+p>M}tL^xy z%=7I!3~342{}vi_C>DeCmc8t)1`>weMTh^;2BMr|beH>B=;<@uv+$VX;LB4`lQ=rU z>u4kkCY{f*XGH$YGk}u36Z19q8N+MZ=YOQZuG6CVO;J&}201(xKO^t*iw;)>(4#YT zJ@s0GAwij(o`>6*O@}uO!ivglbTqS86Xy_k&F0@JHTGtZ_y+WUJ9%sajHZmvK+EA# z$@i;8Mf^BpWy*>^Z1_l<5dp!rpyk=9(m$y&%p(m5T~i~>M4C!0WCNd}{={qB1w5#|Ri+y?!x-MzOw&%B zg%;oWt%^pD8u51&n})@83({U6byYO-bS0tdL*YRuQuaFs>rsCF95*zTLqEBDt+u|Zmrv^*HzG=W4VM*qZ=!W7uO1WmlFMKSFQg^ zF3OPO{`Daqx`Dd)^NtxM%^BrklY=@rRI3gp+r*97W0~WS_*Ej@%Ehyy$wGRgpNdN; z2_ivt%m++D`U`sccNDY)6#759NB%n*6D<=St`WC%bqF9kl^x|O&38;m(|Y|X&1n6pmIr7@BwJ>PF#`_=}FRG3B;@!YtMbweDj%@-iLiyWO8lu8{=dZVtBK zs@5wo3Y1RN;f^`D&frk)9sX7> z1y9bPC8ao-j)z-BuIlYqx5+b&IP}e8#Dn1e%3tHIhbHH$AwPB=eBx zQ9s|74u;WdY0%=uhR1av-&Bow4k>X1?LWV1`Stk>lzXcianKcXN!0kKZK`~w2^JBR+)~-#SLbW=3-&s;g~+a0JwEx zm`X=as3Ji}pBLBjmzw=OSUHTo?xre})nF~pr2Y6!j%2CtZqGSU6e*44i8Dum6!;yi%*FrP#5eBf zLw5uU9ni*IF|n;D)q&r683yCBO9GqEO$7=xTrdI>!ow338?L9G%~ZQcD8yd%4*Qa%|CqSUABpEj@p%q0lbGiR(eEM z)$wk1g9ZnBb}1CtDQF}okLXnogvoQDecol{FoZ+M=jO8SqGtaa zCDCXz^)(!438I;6cUc6-5IL3;ZRmLU{+Zl3uYjmU_I5faSs$^Fl8&V4>Ciby&rFqr zsb-u%fDIC@9kosCg6{TPFzOtIEra*qU|3`G1!dhD$Tp2zuGfaAH&wm5n#~azH~+%C zh9TMPO`iRIss)3)myvf>2G+11`-qGs(!e?h z0&k9UogY<0w(SK1PMTQ`^ExZN`t5KU8v;!guN)U%`-*xv#f5TJBaB-~{U7JK^2Y_u zKT2uk-(6`b4otXo#eOPA7LxOfAYym$>sjPC`l9yskLL!P4P{@Ay}kMU$G(O`+Ka+X zVYkQKtyyo+LN7TXLSMHtCqhO|8(s zE~JU)$jsVc`_T>3|!GS^E>Lid$mQ)h|* zcNQ|gXAE3I*ApG-#KonvTVdK!E3-jA+}?-z%r<fNM8XL` z^IxL`-YzXTj6a;IQ>w>$@?>}7oyJNq58WT_jNki4|6TC!$w^eOZq3-{|9Es#^}P3| zS7W<7QN#CB^7_`VTmI)U?5pas8;8iaT%hfyimH>uJsHYt!`-C4iC7Vpv5g(kq(9dj zr`}bnI1v3`9h_KqxV-*$_4L{H9RI>@^?!C!dj5*wZ{&{oPX)}+2US8k=Y)8sc6VPW zuL@kmR@dK+M;lDt@aJw=ZypW4Ac<%tD4PgwN24mTDgJ)yt^Z!<|53qAdq(^sm?y%5w~ zP%233R`nH<^Ut(3Jt}REe-n&2JwtR~wIKuNKXEE}8Tu-8q~t$#G~+%P0`)a|@>pj` zbD#CDKHd7AWEsJvPHoGD24-db8Y*hs4{6w!u>MV(7kj-byB75`#C;F^9vw{@c`#>; z=eFFY>M$>OzP;M5zobcunr_)<(eB>sy>&gdtAfzUMh{nb-2S5T1)04I>2q27x8Ue| zCeLXm9FKBCzmzuHi`RE^%TZ(}tiu*y&e~1Vuvmk&LCcRXIN zkkA;$%XaKtmes?0X1=CZyL`4^8E0Jx_zOx7#r??kK%Z79!%2d*fWL z3hJId1PQ4Cn+}Ct!a=IT!nfVy6BY0cLV}56_w8JxhZw=16GbbJtX38UY=SZs2|>L$ z!xYnHow$-)5j*qq0W5@m2oRCU*hi>&My31ZM2<7tR-BEW@;6akCfg+mzpIaLh5uR~ zC^#MQyDQ<*-C5{*mJ+l$+zwr-v)RXvk@ugI9o>*a3)=7X(z`0!8!TRm3h-NAA+xqX zel%hD2@v<+5E|SU1huEOrbevf^p=~XPgC8rwevu@1W+xgth|GZ%V6TW;~Ki)8$&xi z(39EI_`ii=Kil>XpUSCbB0d26p4f*4nv&$p8@$&M>Ng)e=25`3oVbOEI>Hc8f`54F zcJ*}V$NKM4&7|Iu8geq2;&bzVoxP*)9UuQp(35@eqPGlLI@)yp0a>?fL`(R0VS0OY z=;nt9=8T8--Z7^4;M%(mmF#OK?Gon{Jlk7{G@|e1XM#jh&w28v*3YDjyxC>m$B4I6 zi_l{(Qu<#cV)IuzD&8q*24pw(6t7zDG$s_Mx+KrTc6vdD{NEAAbDQm}9&i6%cOKNj zbcAOqs~;_wtMqMoEIUUV*f^M+r>r9{vfGp1SuaUjTG@>x#$PdV!LK<&apcjU4w9q* z`}w;?%;f2M?|N=wzUEVw2HI{KxWnA-H)1q+B%HTC4ff*Xx*jig9vpQSTYPuWYVMWR zr11K$-_V&^B#x}PP``K;F(0Sx6pCqbk**=RbPHOUq4tZT^mDyVzU358Lebm4f3Buh z^gM#Xe)l1_VnA5Hd6;Hh$zlgdp&heb>F|1@_D91F8?tDUp$X&Wo*dFdV`gI@?HDsXeK6Ud?IYuJo>XU+IQ#dnnBiHS8>-9%1WHAO z^z>$|tp~EiPuFm}=sC##MVv-CC_c#!3jgshbF}O$z1cmH_9bCF2zx2NzKDLn9j-%-i zBHa0a{C@Cr_bJ<*^SajFqBW&ik^*{krTS*$3#>F&fpmz5{ zqjBJmlVGLpC+0X8zsnCD|LV4#Xr(~&+bK;S^J56*z-DpmW_ZCH2(j;5Z*O@1n@Yod zP$113+bY}{73h3ERHj=Q5>~>*aT-S>&Q35}6Kg8(Ra-J=I^SMIOGQ zV+lb7%%QcEW03Um*^*I=yWg*+@$ra_GS6$ zsjOv@*1*{+X@rjSoo%xV(A3^}H8}Rn9MAXa&JH?lSFIui-=d)I$*<~v98r3p^>k=f zi}j21lgW(bb~Q6=voU7tgZ43Fj&#%`N20JvjZr_Z|Yo+B=-`YvBLr`0`@cM>QxIkS8GGLvBW_i zp$UZbtyoyUmm&WqJ}u949B&3Wzywj}igD)vb>H#E=2ygYgB=~1!WCMs1wT%@v2n@o z7Es$?9!nd^Zu{^aqMH~KngmnvjyqaY1ICKF(QFvPL~4_a_-7CObuT-_DYIal^H4@jV!{3h(lHa7S@dnN7?b zmcFJ#4kB$;U3;6jxIAsObZ?-KF7vD%gnubJZ0$GzveS-#ThwWB%nDdd*j?uXr04n{ zF8iTChw8~-i~y{6Kt<`COBt``wn1V-NVCA0U+e3i(ibW zzahSyWPg0O!cfBT;~m~9vQRHO7q2LUAGt&7xIvD;p(rcMeiR=~C;hjMTeFJ%zF#Lc z4r&~4Mua#xHk_>uGka5GmS06JtE*S8d2v^Rem7x`E2N`>;G*6Ss#jY!mO(mqRp132 z1-uf5Bb)kvI((P&S2xm9?-}^s+ToFP{ny9*4EpE4>%oJ0h0gv$D_EtH^;0{p*McprRw|9z_6>nGV01Ap|ZB&RN0E&cw>{{T@Zh8O?< literal 0 HcmV?d00001 diff --git a/boards/riscv/beaglev_fire/doc/index.rst b/boards/riscv/beaglev_fire/doc/index.rst new file mode 100644 index 00000000000..88808145c9b --- /dev/null +++ b/boards/riscv/beaglev_fire/doc/index.rst @@ -0,0 +1,85 @@ +.. _beaglev_fire: + +BeagleV®-Fire +############# + +Overview +******** + +BeagleV®-Fire is a revolutionary single-board computer (SBC) powered by the Microchip’s +PolarFire® MPFS025T 5x core RISC-V System on Chip (SoC) with FPGA fabric. BeagleV®-Fire opens up new +horizons for developers, tinkerers, and the open-source community to explore the vast potential of +RISC-V architecture and FPGA technology. It has the same P8 & P9 cape header pins as BeagleBone +Black allowing you to stack your favorite BeagleBone cape on top to expand it’s capability. +Built around the powerful and energy-efficient RISC-V instruction set architecture (ISA) along with +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 +======== + +Applications for the ``beaglev_fire`` board configuration can be built as usual: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: beaglev_fire + :goals: build + +Debugging +========= + +In order to upload the application to the device, you'll need OpenOCD and GDB +with RISC-V support. +You can get them as a part of SoftConsole SDK. +Download and installation instructions can be found on +`Microchip's SoftConsole website +`_. + +You will also require a Debugger such as Microchip's FlashPro5/6. + +Connect to BeagleV-Fire UART debug port using a 3.3v USB to UART bridge. +Now you can run ``tio `` in a terminal window to access the UART debug port connection. Once you +are connected properly you can press the Reset button which will show you a progress bar like: + +.. image:: img/board-booting.png + :align: center + :alt: beaglev_fire + +Once you see that progress bar on your screen you can start pressing any button (0-9/a-z) which +will interrupt the Hart Software Services from booting its payload. + +With the necessary tools installed, you can connect to the board using OpenOCD. +from a different terminal, run: + +.. code-block:: bash + + /openocd/bin/openocd --file \ + /openocd/share/openocd/scripts/board/microsemi-riscv.cfg + + +Leave it running, and in a different terminal, use GDB to upload the binary to +the board. You can use the RISC-V GDB from the Zephyr SDK. +launch GDB: + +.. code-block:: bash + + /riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gdb + + + +Here is the GDB terminal command to connect to the device +and load the binary: + +.. code-block:: bash + + set arch riscv:rv64 + set mem inaccessible-by-default off + file + target extended-remote localhost:3333 + load + break main + continue From b6bc79d215cda84b4441836c9b96939ef1b662f5 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sat, 23 Dec 2023 17:35:24 +0800 Subject: [PATCH 0263/2300] [nrf fromtree] soc: riscv: add support for Renode Virt RISCV32 SoC Add a beef-ed up version of Renode's `riscv_virt` SoC Signed-off-by: Yong Cong Sin (cherry picked from commit c328a38a94962cc64325b525fad8013331291e35) (cherry picked from commit c69028760cda83bad337c9acecda745e1a15b359) --- .../renode_virt/CMakeLists.txt | 6 +++ .../renode_virt/Kconfig.defconfig.series | 48 +++++++++++++++++++ .../renode_virt/Kconfig.series | 9 ++++ .../riscv-privileged/renode_virt/Kconfig.soc | 19 ++++++++ soc/riscv/riscv-privileged/renode_virt/soc.h | 12 +++++ 5 files changed, 94 insertions(+) create mode 100644 soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt create mode 100644 soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series create mode 100644 soc/riscv/riscv-privileged/renode_virt/Kconfig.series create mode 100644 soc/riscv/riscv-privileged/renode_virt/Kconfig.soc create mode 100644 soc/riscv/riscv-privileged/renode_virt/soc.h diff --git a/soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt b/soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt new file mode 100644 index 00000000000..56d36b84ec8 --- /dev/null +++ b/soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (c) 2023 Meta +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources() + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series new file mode 100644 index 00000000000..09adc3d00e8 --- /dev/null +++ b/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series @@ -0,0 +1,48 @@ +# Copyright (c) 2023 Meta +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_RISCV32_VIRTUAL_RENODE + +config SOC_SERIES + default "renode_virt" + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default 4000000 + +config RISCV_SOC_INTERRUPT_INIT + default y + +config RISCV_HAS_CPU_IDLE + default y + +config RISCV_HAS_PLIC + default y + +config RISCV_GP + default y + +config 1ST_LEVEL_INTERRUPT_BITS + default 4 + +config NUM_2ND_LEVEL_AGGREGATORS + default 2 + +config 2ND_LEVEL_INTERRUPT_BITS + default 11 + +config 2ND_LVL_ISR_TBL_OFFSET + default 12 + +config 2ND_LVL_INTR_00_OFFSET + default 11 + +config 2ND_LVL_INTR_01_OFFSET + default 4 + +config MAX_IRQ_PER_AGGREGATOR + default 1023 + +config NUM_IRQS + default 2058 + +endif # SOC_SERIES_RISCV32_VIRTUAL_RENODE diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.series b/soc/riscv/riscv-privileged/renode_virt/Kconfig.series new file mode 100644 index 00000000000..22e27cf38b4 --- /dev/null +++ b/soc/riscv/riscv-privileged/renode_virt/Kconfig.series @@ -0,0 +1,9 @@ +# Copyright (c) 2023 Meta +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_RISCV32_VIRTUAL_RENODE + bool "Renode RISC-V32 Virtual SoC implementation" + select RISCV + select SOC_FAMILY_RISCV_PRIVILEGED + help + Enable support for Renode RISC-V Virtual diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc b/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc new file mode 100644 index 00000000000..d123e797229 --- /dev/null +++ b/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc @@ -0,0 +1,19 @@ +# Copyright (c) 2023 Meta +# SPDX-License-Identifier: Apache-2.0 + +choice + prompt "Renode RISCV32 Virtual system implementation" + depends on SOC_SERIES_RISCV32_VIRTUAL_RENODE + +config SOC_RISCV32_VIRTUAL_RENODE + bool "Renode RISCV32 Virtual system implementation" + select ATOMIC_OPERATIONS_BUILTIN + select INCLUDE_RESET_VECTOR + select RISCV_ISA_RV32I + select RISCV_ISA_EXT_M + select RISCV_ISA_EXT_A + select RISCV_ISA_EXT_C + select RISCV_ISA_EXT_ZICSR + select RISCV_ISA_EXT_ZIFENCEI + +endchoice diff --git a/soc/riscv/riscv-privileged/renode_virt/soc.h b/soc/riscv/riscv-privileged/renode_virt/soc.h new file mode 100644 index 00000000000..c82e16f1613 --- /dev/null +++ b/soc/riscv/riscv-privileged/renode_virt/soc.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2023 Meta + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __RISCV32_RENODE_SOC_H_ +#define __RISCV32_RENODE_SOC_H_ + +#include + +#endif /* __RISCV32_RENODE_SOC_H_ */ From b05c04cd83d4a35c5ad2370536aa95f5d2f25cb0 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sat, 23 Dec 2023 17:36:07 +0800 Subject: [PATCH 0264/2300] [nrf fromtree] boards: riscv: add RISCV32 Virtual board made with Renode The RISCV32 Virtual board is a virtual platform made with Renode as an alternative to QEMU. Contrary to QEMU, the peripherals of this platform can be easily configured by editing the `riscv32_virtual.repl` script and the devicetree files accordingly, this allows certain hardware configurations that only exist in proprietary boards/SoCs to be tested in upstream CI. Added another entry for this board to the excluded platform in `kernel.timer.timer` test. Signed-off-by: Yong Cong Sin (cherry picked from commit 7fac758bdb33ad893af25cc27126da0a5bee3e9c) (cherry picked from commit 1f4042263729e6b5d6145fd7fd687ead84838389) --- boards/riscv/riscv32_virtual/Kconfig.board | 6 ++ .../riscv/riscv32_virtual/Kconfig.defconfig | 6 ++ boards/riscv/riscv32_virtual/board.cmake | 6 ++ boards/riscv/riscv32_virtual/doc/index.rst | 56 +++++++++++++++++++ .../riscv/riscv32_virtual/riscv32_virtual.dts | 25 +++++++++ .../riscv32_virtual/riscv32_virtual.yaml | 16 ++++++ .../riscv32_virtual/riscv32_virtual_defconfig | 14 +++++ .../support/riscv32_virtual.repl | 33 +++++++++++ .../support/riscv32_virtual.resc | 17 ++++++ 9 files changed, 179 insertions(+) create mode 100644 boards/riscv/riscv32_virtual/Kconfig.board create mode 100644 boards/riscv/riscv32_virtual/Kconfig.defconfig create mode 100644 boards/riscv/riscv32_virtual/board.cmake create mode 100644 boards/riscv/riscv32_virtual/doc/index.rst create mode 100644 boards/riscv/riscv32_virtual/riscv32_virtual.dts create mode 100644 boards/riscv/riscv32_virtual/riscv32_virtual.yaml create mode 100644 boards/riscv/riscv32_virtual/riscv32_virtual_defconfig create mode 100644 boards/riscv/riscv32_virtual/support/riscv32_virtual.repl create mode 100644 boards/riscv/riscv32_virtual/support/riscv32_virtual.resc diff --git a/boards/riscv/riscv32_virtual/Kconfig.board b/boards/riscv/riscv32_virtual/Kconfig.board new file mode 100644 index 00000000000..c8722acb384 --- /dev/null +++ b/boards/riscv/riscv32_virtual/Kconfig.board @@ -0,0 +1,6 @@ +# Copyright (c) 2023 Meta +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_RISCV32_VIRTUAL + bool "riscv32_virtual" + depends on SOC_RISCV32_VIRTUAL_RENODE diff --git a/boards/riscv/riscv32_virtual/Kconfig.defconfig b/boards/riscv/riscv32_virtual/Kconfig.defconfig new file mode 100644 index 00000000000..840b10fd594 --- /dev/null +++ b/boards/riscv/riscv32_virtual/Kconfig.defconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2023 Meta +# SPDX-License-Identifier: Apache-2.0 + +config BOARD + default "riscv32_virtual" + depends on BOARD_RISCV32_VIRTUAL diff --git a/boards/riscv/riscv32_virtual/board.cmake b/boards/riscv/riscv32_virtual/board.cmake new file mode 100644 index 00000000000..cc177a69ce9 --- /dev/null +++ b/boards/riscv/riscv32_virtual/board.cmake @@ -0,0 +1,6 @@ +# Copyright (c) 2023 Meta +# SPDX-License-Identifier: Apache-2.0 + +set(SUPPORTED_EMU_PLATFORMS renode) +set(RENODE_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/support/riscv32_virtual.resc) +set(RENODE_UART sysbus.uart0) diff --git a/boards/riscv/riscv32_virtual/doc/index.rst b/boards/riscv/riscv32_virtual/doc/index.rst new file mode 100644 index 00000000000..a53384f5331 --- /dev/null +++ b/boards/riscv/riscv32_virtual/doc/index.rst @@ -0,0 +1,56 @@ +.. _riscv32-virtual: + +RISCV32 Virtual +############### + +Overview +******** + +The RISCV32 Virtual board is a virtual platform made with Renode as an alternative to QEMU. +Contrary to QEMU, the peripherals of this platform can be easily configured by editing the +``riscv32_virtual.repl`` script and the devicetree files accordingly, this allows certain hardware +configurations that only exist in proprietary boards/SoCs to be tested in upstream CI. + +Programming and debugging +************************* + +Building +======== + +Applications for the ``riscv32_virtual`` board configuration can be built as usual +(see :ref:`build_an_application`): + +.. zephyr-app-commands:: + :board: riscv32_virtual + :goals: build + +Flashing +======== + +While this board is emulated and you can't "flash" it, you can use this +configuration to run basic Zephyr applications and kernel tests in the Renode +emulated environment. For example, with the :zephyr:code-sample:`synchronization` sample: + +.. zephyr-app-commands:: + :zephyr-app: samples/synchronization + :host-os: unix + :board: riscv32_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 zephyr-v3.5.0-1511-g56f73bde0fb0 *** + thread_a: Hello World from cpu 0 on riscv32_virtual! + thread_b: Hello World from cpu 0 on riscv32_virtual! + thread_a: Hello World from cpu 0 on riscv32_virtual! + thread_b: Hello World from cpu 0 on riscv32_virtual! + +Exit Renode by pressing :kbd:`CTRL+C`. + +Debugging +========= + +Refer to the detailed overview about :ref:`application_debugging`. diff --git a/boards/riscv/riscv32_virtual/riscv32_virtual.dts b/boards/riscv/riscv32_virtual/riscv32_virtual.dts new file mode 100644 index 00000000000..326b9757518 --- /dev/null +++ b/boards/riscv/riscv32_virtual/riscv32_virtual.dts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 Meta + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include + +/ { + model = "Renode RISCV32 Virtual target"; + compatible = "renode,riscv32-virtual"; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,flash = &flash0; + zephyr,sram = &sram0; + }; +}; + +&uart0 { + status = "okay"; +}; diff --git a/boards/riscv/riscv32_virtual/riscv32_virtual.yaml b/boards/riscv/riscv32_virtual/riscv32_virtual.yaml new file mode 100644 index 00000000000..11cefb035df --- /dev/null +++ b/boards/riscv/riscv32_virtual/riscv32_virtual.yaml @@ -0,0 +1,16 @@ +identifier: riscv32_virtual +name: Renode RISC-V 32-bit Virtual Board +type: mcu +arch: riscv32 +toolchain: + - zephyr +ram: 4096 +flash: 4096 +simulation: renode +simulation_exec: renode +testing: + ignore_tags: + - net + - bluetooth +supported: + - uart diff --git a/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig b/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig new file mode 100644 index 00000000000..a905f99da2e --- /dev/null +++ b/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2023 Meta +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_RISCV32_VIRTUAL_RENODE=y +CONFIG_SOC_RISCV32_VIRTUAL_RENODE=y +CONFIG_BOARD_RISCV32_VIRTUAL=y +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=n +CONFIG_XIP=y + +# Workaround for incorrect SYS_CLOCK_HW_CYCLES_PER_SEC +CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 diff --git a/boards/riscv/riscv32_virtual/support/riscv32_virtual.repl b/boards/riscv/riscv32_virtual/support/riscv32_virtual.repl new file mode 100644 index 00000000000..e0df808631b --- /dev/null +++ b/boards/riscv/riscv32_virtual/support/riscv32_virtual.repl @@ -0,0 +1,33 @@ +// Copyright (c) 2023 Meta +// SPDX-License-Identifier: Apache-2.0 + +flash: Memory.MappedMemory @ sysbus 0x80000000 + size: 0x400000 + +ddr: Memory.MappedMemory @ sysbus 0x80400000 + size: 0x400000 + +uart0: UART.NS16550 @ sysbus 0x10000000 + IRQ -> plic0@10 + +uart1: UART.NS16550 @ sysbus 0x10000100 + IRQ -> plic1@10 + +cpu: CPU.RiscV32 @ sysbus + cpuType: "rv32imac_zicsr_zifencei" + privilegeArchitecture: PrivilegeArchitecture.Priv1_10 + timeProvider: clint + +plic0: IRQControllers.PlatformLevelInterruptController @ sysbus 0x0C000000 + 0 -> cpu@11 + numberOfSources: 1023 + numberOfContexts: 1 + +plic1: IRQControllers.PlatformLevelInterruptController @ sysbus 0x08000000 + 0 -> cpu@4 + numberOfSources: 1023 + numberOfContexts: 1 + +clint: IRQControllers.CoreLevelInterruptor @ sysbus 0x02000000 + [0,1] -> cpu@[3,7] + frequency: 4000000 diff --git a/boards/riscv/riscv32_virtual/support/riscv32_virtual.resc b/boards/riscv/riscv32_virtual/support/riscv32_virtual.resc new file mode 100644 index 00000000000..87e327287b6 --- /dev/null +++ b/boards/riscv/riscv32_virtual/support/riscv32_virtual.resc @@ -0,0 +1,17 @@ +:name: RISCV32-Virtual +:description: This script is prepared to run Zephyr on a Renode RISCV32 board. + +$name?="RISCV32-Virtual" + +using sysbus +mach create $name +machine LoadPlatformDescription $ORIGIN/riscv32_virtual.repl + +showAnalyzer uart0 +cpu PerformanceInMips 4 + +macro reset +""" + sysbus LoadELF $bin +""" +runMacro $reset From 773b977cc015ee925707dff71c1118e64754b79c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 12:17:30 +0100 Subject: [PATCH 0265/2300] [nrf fromtree] soc: riscv: move privileged code to common folder Add a new riscv/common directory where to store common code between SoCs, e.g. those implementing the privileged spec. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 6443c50bd04d4f11900b48fed80726ed0bc969f6) (cherry picked from commit 37c830845c9c6fdc2a5449eabeb9c505902ae574) --- soc/riscv/CMakeLists.txt | 2 ++ soc/riscv/common/CMakeLists.txt | 1 + soc/riscv/common/Kconfig | 4 +++ .../riscv-privileged}/CMakeLists.txt | 0 soc/riscv/common/riscv-privileged/Kconfig | 36 +++++++++++++++++++ .../common => common/riscv-privileged}/idle.c | 0 .../riscv-privileged}/nuclei/nuclei_csr.h | 0 .../riscv-privileged}/soc_common.h | 0 .../riscv-privileged}/soc_common_irq.c | 0 .../riscv-privileged}/soc_irq.S | 0 .../riscv-privileged}/vector.S | 0 soc/riscv/litex-vexriscv/CMakeLists.txt | 4 +-- soc/riscv/litex-vexriscv/soc.h | 2 +- soc/riscv/riscv-privileged/CMakeLists.txt | 1 - soc/riscv/riscv-privileged/Kconfig | 34 ------------------ 15 files changed, 46 insertions(+), 38 deletions(-) create mode 100644 soc/riscv/common/CMakeLists.txt create mode 100644 soc/riscv/common/Kconfig rename soc/riscv/{riscv-privileged/common => common/riscv-privileged}/CMakeLists.txt (100%) create mode 100644 soc/riscv/common/riscv-privileged/Kconfig rename soc/riscv/{riscv-privileged/common => common/riscv-privileged}/idle.c (100%) rename soc/riscv/{riscv-privileged/common => common/riscv-privileged}/nuclei/nuclei_csr.h (100%) rename soc/riscv/{riscv-privileged/common => common/riscv-privileged}/soc_common.h (100%) rename soc/riscv/{riscv-privileged/common => common/riscv-privileged}/soc_common_irq.c (100%) rename soc/riscv/{riscv-privileged/common => common/riscv-privileged}/soc_irq.S (100%) rename soc/riscv/{riscv-privileged/common => common/riscv-privileged}/vector.S (100%) diff --git a/soc/riscv/CMakeLists.txt b/soc/riscv/CMakeLists.txt index b826da926ca..79d115704b2 100644 --- a/soc/riscv/CMakeLists.txt +++ b/soc/riscv/CMakeLists.txt @@ -1,5 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 +add_subdirectory(common) + if(SOC_FAMILY) add_subdirectory(${SOC_FAMILY}) else() diff --git a/soc/riscv/common/CMakeLists.txt b/soc/riscv/common/CMakeLists.txt new file mode 100644 index 00000000000..9102b32a45f --- /dev/null +++ b/soc/riscv/common/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_RISCV_PRIVILEGED riscv-privileged) diff --git a/soc/riscv/common/Kconfig b/soc/riscv/common/Kconfig new file mode 100644 index 00000000000..91f2c5cf80a --- /dev/null +++ b/soc/riscv/common/Kconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 +# +source "soc/riscv/common/riscv-privileged/Kconfig" diff --git a/soc/riscv/riscv-privileged/common/CMakeLists.txt b/soc/riscv/common/riscv-privileged/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/common/CMakeLists.txt rename to soc/riscv/common/riscv-privileged/CMakeLists.txt diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig new file mode 100644 index 00000000000..6bc12b46c5a --- /dev/null +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -0,0 +1,36 @@ +# Configuration options for riscv SOCs supporting the riscv privileged +# architecture specification + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_RISCV_PRIVILEGE + bool + select DEPRECATED + +config SOC_FAMILY_RISCV_PRIVILEGED + bool + select ARCH_HAS_RAMFUNC_SUPPORT if XIP + +config SOC_FAMILY + string + default "riscv-privileged" + depends on SOC_FAMILY_RISCV_PRIVILEGED + +config RISCV_HAS_PLIC + bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" + depends on SOC_FAMILY_RISCV_PRIVILEGED + help + Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). + +config RISCV_HAS_CLIC + bool "Does the SOC provide support for a Core-Local Interrupt Controller (CLIC)" + depends on SOC_FAMILY_RISCV_PRIVILEGED + help + Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). + +config RISCV_VECTORED_MODE + bool "Should the SOC use vectored mode" + depends on SOC_FAMILY_RISCV_PRIVILEGED + help + Should the SOC use vectored mode. diff --git a/soc/riscv/riscv-privileged/common/idle.c b/soc/riscv/common/riscv-privileged/idle.c similarity index 100% rename from soc/riscv/riscv-privileged/common/idle.c rename to soc/riscv/common/riscv-privileged/idle.c diff --git a/soc/riscv/riscv-privileged/common/nuclei/nuclei_csr.h b/soc/riscv/common/riscv-privileged/nuclei/nuclei_csr.h similarity index 100% rename from soc/riscv/riscv-privileged/common/nuclei/nuclei_csr.h rename to soc/riscv/common/riscv-privileged/nuclei/nuclei_csr.h diff --git a/soc/riscv/riscv-privileged/common/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h similarity index 100% rename from soc/riscv/riscv-privileged/common/soc_common.h rename to soc/riscv/common/riscv-privileged/soc_common.h diff --git a/soc/riscv/riscv-privileged/common/soc_common_irq.c b/soc/riscv/common/riscv-privileged/soc_common_irq.c similarity index 100% rename from soc/riscv/riscv-privileged/common/soc_common_irq.c rename to soc/riscv/common/riscv-privileged/soc_common_irq.c diff --git a/soc/riscv/riscv-privileged/common/soc_irq.S b/soc/riscv/common/riscv-privileged/soc_irq.S similarity index 100% rename from soc/riscv/riscv-privileged/common/soc_irq.S rename to soc/riscv/common/riscv-privileged/soc_irq.S diff --git a/soc/riscv/riscv-privileged/common/vector.S b/soc/riscv/common/riscv-privileged/vector.S similarity index 100% rename from soc/riscv/riscv-privileged/common/vector.S rename to soc/riscv/common/riscv-privileged/vector.S diff --git a/soc/riscv/litex-vexriscv/CMakeLists.txt b/soc/riscv/litex-vexriscv/CMakeLists.txt index 9d100ea0e2a..98386f6b57a 100644 --- a/soc/riscv/litex-vexriscv/CMakeLists.txt +++ b/soc/riscv/litex-vexriscv/CMakeLists.txt @@ -5,8 +5,8 @@ # zephyr_sources( - ../riscv-privileged/common/soc_irq.S - ../riscv-privileged/common/vector.S + ../common/riscv-privileged/soc_irq.S + ../common/riscv-privileged/vector.S ) set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/litex-vexriscv/soc.h b/soc/riscv/litex-vexriscv/soc.h index b738deec771..b3521b51e8e 100644 --- a/soc/riscv/litex-vexriscv/soc.h +++ b/soc/riscv/litex-vexriscv/soc.h @@ -7,7 +7,7 @@ #ifndef __RISCV32_LITEX_VEXRISCV_SOC_H_ #define __RISCV32_LITEX_VEXRISCV_SOC_H_ -#include "../riscv-privileged/common/soc_common.h" +#include "../common/riscv-privileged/soc_common.h" #include #include diff --git a/soc/riscv/riscv-privileged/CMakeLists.txt b/soc/riscv/riscv-privileged/CMakeLists.txt index c5f97039eb7..226f3bd626f 100644 --- a/soc/riscv/riscv-privileged/CMakeLists.txt +++ b/soc/riscv/riscv-privileged/CMakeLists.txt @@ -1,4 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 -add_subdirectory(common) add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/riscv-privileged/Kconfig b/soc/riscv/riscv-privileged/Kconfig index abbeeac242b..b0700dd3440 100644 --- a/soc/riscv/riscv-privileged/Kconfig +++ b/soc/riscv/riscv-privileged/Kconfig @@ -1,38 +1,4 @@ -# Configuration options for riscv SOCs supporting the riscv privileged -# architecture specification - # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 -config SOC_FAMILY_RISCV_PRIVILEGE - bool - select DEPRECATED - -config SOC_FAMILY_RISCV_PRIVILEGED - bool - select ARCH_HAS_RAMFUNC_SUPPORT if XIP - -config SOC_FAMILY - string - default "riscv-privileged" - depends on SOC_FAMILY_RISCV_PRIVILEGED - -config RISCV_HAS_PLIC - bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" - depends on SOC_FAMILY_RISCV_PRIVILEGED - help - Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). - -config RISCV_HAS_CLIC - bool "Does the SOC provide support for a Core-Local Interrupt Controller (CLIC)" - depends on SOC_FAMILY_RISCV_PRIVILEGED - help - Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). - -config RISCV_VECTORED_MODE - bool "Should the SOC use vectored mode" - depends on SOC_FAMILY_RISCV_PRIVILEGED - help - Should the SOC use vectored mode. - source "soc/riscv/riscv-privileged/*/Kconfig.soc" From 24df39abb916d27254b8fcc80c3bc8583705750b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 12:20:19 +0100 Subject: [PATCH 0266/2300] [nrf fromtree] soc: riscv: gd32vf103: move nuclei CSR header The header is common to all Nuclei based cores (not strictly related to RISCV privileged spec). Since only GD32VF103 uses a Nuclei core, move the file to its SoC folder. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 9a35ad858c6d32a25e36c6244f9ab709c9b279d0) (cherry picked from commit 9cf4288b0a6f74899019febc0624a5ab51960a3d) --- soc/riscv/riscv-privileged/gd32vf103/entry.S | 3 ++- .../nuclei => riscv-privileged/gd32vf103}/nuclei_csr.h | 0 2 files changed, 2 insertions(+), 1 deletion(-) rename soc/riscv/{common/riscv-privileged/nuclei => riscv-privileged/gd32vf103}/nuclei_csr.h (100%) diff --git a/soc/riscv/riscv-privileged/gd32vf103/entry.S b/soc/riscv/riscv-privileged/gd32vf103/entry.S index 5f8af0d691f..41cc6cc686b 100644 --- a/soc/riscv/riscv-privileged/gd32vf103/entry.S +++ b/soc/riscv/riscv-privileged/gd32vf103/entry.S @@ -4,9 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "nuclei_csr.h" + #include #include -#include GTEXT(__nuclei_start) SECTION_FUNC(vectors, __nuclei_start) diff --git a/soc/riscv/common/riscv-privileged/nuclei/nuclei_csr.h b/soc/riscv/riscv-privileged/gd32vf103/nuclei_csr.h similarity index 100% rename from soc/riscv/common/riscv-privileged/nuclei/nuclei_csr.h rename to soc/riscv/riscv-privileged/gd32vf103/nuclei_csr.h From 61f8380f5404337122b30dbb0ea0172c0222f4e9 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 12:39:36 +0100 Subject: [PATCH 0267/2300] [nrf fromtree] arch: riscv: introduce RISCV_PRIVILEGED Introduce a new arch level Kconfig option to signal the implementation of the RISCV Privileged ISA spec. This replaces SOC_FAMILY_RISCV_PRIVILEGED, because this is not a SoC specific property, nor a SoC family. Note that the SoC family naming scheme will be fixed in upcoming commits. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 0106e8d14c34f3dcd75e8858d01d904375076a34) (cherry picked from commit 6f160c4135b705cabd34aa196b6e348375eec5f1) --- arch/riscv/Kconfig | 8 +++++++- drivers/interrupt_controller/intc_plic.c | 4 ++-- include/zephyr/arch/riscv/arch.h | 2 +- soc/riscv/common/CMakeLists.txt | 2 +- soc/riscv/common/riscv-privileged/Kconfig | 17 ++++------------- .../riscv-privileged/andes_v5/Kconfig.series | 2 +- .../efinix-sapphire/Kconfig.series | 2 +- .../riscv-privileged/gd32vf103/Kconfig.series | 2 +- soc/riscv/riscv-privileged/miv/Kconfig.series | 2 +- soc/riscv/riscv-privileged/mpfs/Kconfig.series | 2 +- .../riscv-privileged/neorv32/Kconfig.series | 2 +- soc/riscv/riscv-privileged/niosv/Kconfig.series | 2 +- .../riscv-privileged/opentitan/Kconfig.series | 2 +- .../sifive-freedom/Kconfig.series | 2 +- .../starfive_jh71xx/Kconfig.series | 2 +- .../riscv-privileged/telink_b91/Kconfig.series | 2 +- soc/riscv/riscv-privileged/virt/Kconfig.series | 2 +- tests/kernel/gen_isr_table/testcase.yaml | 8 ++++---- 18 files changed, 31 insertions(+), 34 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index a1cefcbdf43..80249670d09 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -47,6 +47,12 @@ config INCLUDE_RESET_VECTOR Include the reset vector stub, which initializes the stack and prepares for running C code. +config RISCV_PRIVILEGED + bool + select ARCH_HAS_RAMFUNC_SUPPORT if XIP + help + Option selected by SoCs implementing the RISC-V privileged ISA. + config RISCV_SOC_HAS_ISR_STACKING bool depends on !USERSPACE @@ -333,7 +339,7 @@ config RISCV_TRAP_HANDLER_ALIGNMENT The minimum alignment is 4 bytes according to the Spec. config GEN_IRQ_VECTOR_TABLE - select RISCV_VECTORED_MODE if SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_VECTORED_MODE if RISCV_PRIVILEGED config ARCH_HAS_SINGLE_THREAD_SUPPORT default y if !SMP diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index 51ce1769396..211a6f11041 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -135,7 +135,7 @@ static int riscv_plic_is_edge_irq(const struct device *dev, uint32_t local_irq) * @brief Enable a riscv PLIC-specific interrupt line * * This routine enables a RISCV PLIC-specific interrupt line. - * riscv_plic_irq_enable is called by SOC_FAMILY_RISCV_PRIVILEGED + * riscv_plic_irq_enable is called by RISCV_PRIVILEGED * arch_irq_enable function to enable external interrupts for * IRQS level == 2, whenever CONFIG_RISCV_HAS_PLIC variable is set. * @@ -161,7 +161,7 @@ void riscv_plic_irq_enable(uint32_t irq) * @brief Disable a riscv PLIC-specific interrupt line * * This routine disables a RISCV PLIC-specific interrupt line. - * riscv_plic_irq_disable is called by SOC_FAMILY_RISCV_PRIVILEGED + * riscv_plic_irq_disable is called by RISCV_PRIVILEGED * arch_irq_disable function to disable external interrupts, for * IRQS level == 2, whenever CONFIG_RISCV_HAS_PLIC variable is set. * diff --git a/include/zephyr/arch/riscv/arch.h b/include/zephyr/arch/riscv/arch.h index 99bccb74a08..1ab509c162e 100644 --- a/include/zephyr/arch/riscv/arch.h +++ b/include/zephyr/arch/riscv/arch.h @@ -300,7 +300,7 @@ static inline uint64_t arch_k_cycle_get_64(void) #endif /*_ASMLANGUAGE */ -#if defined(CONFIG_SOC_FAMILY_RISCV_PRIVILEGED) +#if defined(CONFIG_RISCV_PRIVILEGED) #include #endif diff --git a/soc/riscv/common/CMakeLists.txt b/soc/riscv/common/CMakeLists.txt index 9102b32a45f..91ef5c975b9 100644 --- a/soc/riscv/common/CMakeLists.txt +++ b/soc/riscv/common/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory_ifdef(CONFIG_SOC_FAMILY_RISCV_PRIVILEGED riscv-privileged) +add_subdirectory_ifdef(CONFIG_RISCV_PRIVILEGED riscv-privileged) diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index 6bc12b46c5a..526dea4bbfb 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -4,33 +4,24 @@ # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 -config SOC_FAMILY_RISCV_PRIVILEGE - bool - select DEPRECATED - -config SOC_FAMILY_RISCV_PRIVILEGED - bool - select ARCH_HAS_RAMFUNC_SUPPORT if XIP - config SOC_FAMILY string - default "riscv-privileged" - depends on SOC_FAMILY_RISCV_PRIVILEGED + default "riscv-privileged" if RISCV_PRIVILEGED config RISCV_HAS_PLIC bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" - depends on SOC_FAMILY_RISCV_PRIVILEGED + depends on RISCV_PRIVILEGED help Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). config RISCV_HAS_CLIC bool "Does the SOC provide support for a Core-Local Interrupt Controller (CLIC)" - depends on SOC_FAMILY_RISCV_PRIVILEGED + depends on RISCV_PRIVILEGED help Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). config RISCV_VECTORED_MODE bool "Should the SOC use vectored mode" - depends on SOC_FAMILY_RISCV_PRIVILEGED + depends on RISCV_PRIVILEGED help Should the SOC use vectored mode. diff --git a/soc/riscv/riscv-privileged/andes_v5/Kconfig.series b/soc/riscv/riscv-privileged/andes_v5/Kconfig.series index 9a99711b04c..a85c521492b 100644 --- a/soc/riscv/riscv-privileged/andes_v5/Kconfig.series +++ b/soc/riscv/riscv-privileged/andes_v5/Kconfig.series @@ -4,6 +4,6 @@ config SOC_SERIES_RISCV_ANDES_V5 bool "Andes V5 SoC Series Implementation" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED help Enable support for Andes V5 SoC Series diff --git a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series index 8505cf1318a..421d81a7e33 100644 --- a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series +++ b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series @@ -4,6 +4,6 @@ config SOC_SERIES_EFINIX_SAPPHIRE bool "Efinix Sapphire SOC implementation" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED help Enable support for Efinix Sapphire SOC implementation diff --git a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series index 3922bf19bdd..79bb3690743 100644 --- a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series +++ b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series @@ -6,7 +6,7 @@ config SOC_SERIES_GD32VF103 bool "GigaDevice GD32VF103 series SoC implementation" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED select ATOMIC_OPERATIONS_C select INCLUDE_RESET_VECTOR select BUILD_OUTPUT_HEX diff --git a/soc/riscv/riscv-privileged/miv/Kconfig.series b/soc/riscv/riscv-privileged/miv/Kconfig.series index 00a6f129f9f..017de686a94 100644 --- a/soc/riscv/riscv-privileged/miv/Kconfig.series +++ b/soc/riscv/riscv-privileged/miv/Kconfig.series @@ -6,6 +6,6 @@ config SOC_SERIES_RISCV32_MIV bool "Microchip Mi-V implementation" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED help Enable support for Microchip Mi-V diff --git a/soc/riscv/riscv-privileged/mpfs/Kconfig.series b/soc/riscv/riscv-privileged/mpfs/Kconfig.series index ca37731f192..3b30cd15365 100644 --- a/soc/riscv/riscv-privileged/mpfs/Kconfig.series +++ b/soc/riscv/riscv-privileged/mpfs/Kconfig.series @@ -6,6 +6,6 @@ config SOC_SERIES_RISCV64_MIV bool "Microchip RV64 implementation" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED help Enable support for Microchip RISCV 64bit diff --git a/soc/riscv/riscv-privileged/neorv32/Kconfig.series b/soc/riscv/riscv-privileged/neorv32/Kconfig.series index 98c7f34024d..0f8f9ca8fd4 100644 --- a/soc/riscv/riscv-privileged/neorv32/Kconfig.series +++ b/soc/riscv/riscv-privileged/neorv32/Kconfig.series @@ -9,7 +9,7 @@ config SOC_SERIES_NEORV32 select RISCV_ISA_EXT_A select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED help Enable support for the NEORV32 Processor (SoC). diff --git a/soc/riscv/riscv-privileged/niosv/Kconfig.series b/soc/riscv/riscv-privileged/niosv/Kconfig.series index 7de17cf2db0..104f5a48352 100644 --- a/soc/riscv/riscv-privileged/niosv/Kconfig.series +++ b/soc/riscv/riscv-privileged/niosv/Kconfig.series @@ -4,6 +4,6 @@ config SOC_SERIES_NIOSV bool "INTEL FPGA NIOSV" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED help Enable support for the INTEL FPGA NIOSV. diff --git a/soc/riscv/riscv-privileged/opentitan/Kconfig.series b/soc/riscv/riscv-privileged/opentitan/Kconfig.series index f8bbc2840fe..b516e6d8092 100644 --- a/soc/riscv/riscv-privileged/opentitan/Kconfig.series +++ b/soc/riscv/riscv-privileged/opentitan/Kconfig.series @@ -4,7 +4,7 @@ config SOC_SERIES_RISCV_OPENTITAN bool "OpenTitan implementation" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. select RISCV_VECTORED_MODE select GEN_IRQ_VECTOR_TABLE diff --git a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series index 523f6a4ffe9..a24b4812c28 100644 --- a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series +++ b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series @@ -6,6 +6,6 @@ config SOC_SERIES_RISCV_SIFIVE_FREEDOM bool "SiFive Freedom SOC implementation" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED help Enable support for SiFive Freedom SOC diff --git a/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series b/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series index b360f78b77b..19cedcefe27 100644 --- a/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series +++ b/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series @@ -4,6 +4,6 @@ config SOC_SERIES_STARFIVE_JH71XX bool "Starfive JH71XX series" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED help Enable support for Starfive JH71XX SoC Series. diff --git a/soc/riscv/riscv-privileged/telink_b91/Kconfig.series b/soc/riscv/riscv-privileged/telink_b91/Kconfig.series index a966dfe447b..cce6011ce68 100644 --- a/soc/riscv/riscv-privileged/telink_b91/Kconfig.series +++ b/soc/riscv/riscv-privileged/telink_b91/Kconfig.series @@ -10,7 +10,7 @@ config SOC_SERIES_RISCV_TELINK_B91 select RISCV_ISA_EXT_C select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED select HAS_TELINK_DRIVERS help Enable support for Telink B91 SoC diff --git a/soc/riscv/riscv-privileged/virt/Kconfig.series b/soc/riscv/riscv-privileged/virt/Kconfig.series index e9846764f6b..44ec681a308 100644 --- a/soc/riscv/riscv-privileged/virt/Kconfig.series +++ b/soc/riscv/riscv-privileged/virt/Kconfig.series @@ -4,4 +4,4 @@ config SOC_SERIES_RISCV_VIRT bool "QEMU RISC-V VirtIO Board" select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED + select RISCV_PRIVILEGED diff --git a/tests/kernel/gen_isr_table/testcase.yaml b/tests/kernel/gen_isr_table/testcase.yaml index cd8c95e2584..4ee3ad00ac9 100644 --- a/tests/kernel/gen_isr_table/testcase.yaml +++ b/tests/kernel/gen_isr_table/testcase.yaml @@ -53,7 +53,7 @@ tests: platform_exclude: - m2gl025_miv - adp_xc7k_ae350 - filter: CONFIG_SOC_FAMILY_RISCV_PRIVILEGED + filter: CONFIG_RISCV_PRIVILEGED extra_configs: - CONFIG_GEN_IRQ_VECTOR_TABLE=y arch.interrupt.gen_isr_table.riscv_no_direct: @@ -61,18 +61,18 @@ tests: arch_allow: - riscv32 - riscv64 - filter: CONFIG_SOC_FAMILY_RISCV_PRIVILEGED + filter: CONFIG_RISCV_PRIVILEGED extra_configs: - CONFIG_GEN_IRQ_VECTOR_TABLE=n arch.interrupt.gen_isr_table.bit_shift_2nd_level: platform_allow: qemu_riscv32 - filter: CONFIG_SOC_FAMILY_RISCV_PRIVILEGED + filter: CONFIG_RISCV_PRIVILEGED extra_configs: - CONFIG_1ST_LEVEL_INTERRUPT_BITS=10 - CONFIG_2ND_LEVEL_INTERRUPT_BITS=10 arch.interrupt.gen_isr_table.bit_shift_3rd_level: platform_allow: qemu_riscv32 - filter: CONFIG_SOC_FAMILY_RISCV_PRIVILEGED + filter: CONFIG_RISCV_PRIVILEGED extra_configs: - CONFIG_MULTI_LEVEL_INTERRUPTS=y - CONFIG_2ND_LEVEL_INTERRUPTS=y From 5effef88cfdc66a9c0e8253ab961d48540dc9828 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 14:02:24 +0100 Subject: [PATCH 0268/2300] [nrf fromtree] soc: riscv: introduce temporary RISCV_PRIVILEGED_STANDALONE So that SoCs can be ported outside of riscv-privileged folder, setting their own family name. This will be removed once all SoCs are ported. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit d8c0cc2e3502da55338c5563feb8b4bebe193d5e) (cherry picked from commit 69b5551bf88f4f30cc766ffcc5d1a15b6a3b8588) --- soc/riscv/common/riscv-privileged/Kconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index 526dea4bbfb..de064842604 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -4,9 +4,12 @@ # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 +config RISCV_PRIVILEGED_STANDALONE + bool + config SOC_FAMILY string - default "riscv-privileged" if RISCV_PRIVILEGED + default "riscv-privileged" if RISCV_PRIVILEGED && !RISCV_PRIVILEGED_STANDALONE config RISCV_HAS_PLIC bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" From 1270903d32f0a4598f2169b4ce83f9cf39947f65 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 14:00:12 +0100 Subject: [PATCH 0269/2300] [nrf fromtree] soc: riscv: telink_b91: reorganize SoC folder Reorganize following the hierarchy found in the vendor website [1]: - SoC Family: Telink TLSR - SoC series: TLSR951X - SoC: TLSR9518 Also split out from riscv-privileged folder. Note that B91 was the name of a starter kit [2]. [1]: http://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series/ [2]: https://wiki.telink-semi.cn/wiki/Hardware/ B91_Generic_Starter_Kit_Hardware_Guide/ Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 72e52a06aa474917443e522963429448d2d780b8) (cherry picked from commit a8ac61d44bef8a27180e5810827c77ce669c170f) --- boards/riscv/tlsr9518adk80d/Kconfig.board | 2 +- .../tlsr9518adk80d/tlsr9518adk80d_defconfig | 4 +- .../riscv-privileged/telink_b91/Kconfig.soc | 40 ------------------- soc/riscv/telink_tlsr/CMakeLists.txt | 4 ++ soc/riscv/telink_tlsr/Kconfig | 15 +++++++ soc/riscv/telink_tlsr/Kconfig.defconfig | 4 ++ soc/riscv/telink_tlsr/Kconfig.soc | 4 ++ .../tlsr951x}/CMakeLists.txt | 0 .../tlsr951x}/Kconfig.defconfig.series | 8 ++-- .../tlsr951x/Kconfig.defconfig.tlsr9518 | 5 +++ .../tlsr951x}/Kconfig.series | 11 +++-- soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc | 23 +++++++++++ .../tlsr951x}/init.ld | 0 .../tlsr951x}/linker.ld | 0 .../tlsr951x}/pinctrl_soc.h | 0 .../telink_b91 => telink_tlsr/tlsr951x}/soc.c | 0 .../telink_b91 => telink_tlsr/tlsr951x}/soc.h | 0 .../tlsr951x}/soc_context.h | 0 .../tlsr951x}/soc_irq.S | 0 .../tlsr951x}/soc_offsets.h | 0 .../tlsr951x}/start.S | 0 21 files changed, 71 insertions(+), 49 deletions(-) delete mode 100644 soc/riscv/riscv-privileged/telink_b91/Kconfig.soc create mode 100644 soc/riscv/telink_tlsr/CMakeLists.txt create mode 100644 soc/riscv/telink_tlsr/Kconfig create mode 100644 soc/riscv/telink_tlsr/Kconfig.defconfig create mode 100644 soc/riscv/telink_tlsr/Kconfig.soc rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/Kconfig.defconfig.series (81%) create mode 100644 soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr9518 rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/Kconfig.series (55%) create mode 100644 soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/init.ld (100%) rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/linker.ld (100%) rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/pinctrl_soc.h (100%) rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/soc.c (100%) rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/soc.h (100%) rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/soc_context.h (100%) rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/soc_irq.S (100%) rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/soc_offsets.h (100%) rename soc/riscv/{riscv-privileged/telink_b91 => telink_tlsr/tlsr951x}/start.S (100%) diff --git a/boards/riscv/tlsr9518adk80d/Kconfig.board b/boards/riscv/tlsr9518adk80d/Kconfig.board index bd36cb0e481..971b34dc13b 100644 --- a/boards/riscv/tlsr9518adk80d/Kconfig.board +++ b/boards/riscv/tlsr9518adk80d/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_TLSR9518ADK80D bool "Telink B91 Platform" - depends on SOC_RISCV_TELINK_B91 + depends on SOC_TELINK_TLSR9518 diff --git a/boards/riscv/tlsr9518adk80d/tlsr9518adk80d_defconfig b/boards/riscv/tlsr9518adk80d/tlsr9518adk80d_defconfig index fe5cfbe8c2e..c4cfdfea718 100644 --- a/boards/riscv/tlsr9518adk80d/tlsr9518adk80d_defconfig +++ b/boards/riscv/tlsr9518adk80d/tlsr9518adk80d_defconfig @@ -1,8 +1,8 @@ # Copyright (c) 2021 Telink Semiconductor # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_TELINK_B91=y -CONFIG_SOC_RISCV_TELINK_B91=y +CONFIG_SOC_SERIES_TELINK_TLSR951X=y +CONFIG_SOC_TELINK_TLSR9518=y CONFIG_BOARD_TLSR9518ADK80D=y CONFIG_GPIO=y CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 diff --git a/soc/riscv/riscv-privileged/telink_b91/Kconfig.soc b/soc/riscv/riscv-privileged/telink_b91/Kconfig.soc deleted file mode 100644 index 3f4f96c332e..00000000000 --- a/soc/riscv/riscv-privileged/telink_b91/Kconfig.soc +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) 2021 Telink Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -choice -prompt "CPU Architecture of SoC" -depends on SOC_SERIES_RISCV_TELINK_B91 - -config B91_CPU_RISCV32 - bool "RISCV32 CPU Architecture" - select RISCV_ISA_RV32I - select RISCV_ISA_EXT_M - select RISCV_ISA_EXT_A - select RISCV_ISA_EXT_C - select RISCV_ISA_EXT_ZICSR - select RISCV_ISA_EXT_ZIFENCEI - -endchoice - -config TELINK_B91_HWDSP - bool "Support Hardware DSP" - select RISCV_SOC_CONTEXT_SAVE - depends on SOC_SERIES_RISCV_TELINK_B91 - -config TELINK_B91_PFT_ARCH - bool "Support performance throttling" - default y - select RISCV_SOC_CONTEXT_SAVE - depends on SOC_SERIES_RISCV_TELINK_B91 - -choice -prompt "Telink B91 SoC implementation" -depends on SOC_SERIES_RISCV_TELINK_B91 - -config SOC_RISCV_TELINK_B91 - bool "Telink B91 SoC implementation" - select ATOMIC_OPERATIONS_BUILTIN - select CPU_HAS_FPU - select INCLUDE_RESET_VECTOR - -endchoice diff --git a/soc/riscv/telink_tlsr/CMakeLists.txt b/soc/riscv/telink_tlsr/CMakeLists.txt new file mode 100644 index 00000000000..69b2926358e --- /dev/null +++ b/soc/riscv/telink_tlsr/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/telink_tlsr/Kconfig b/soc/riscv/telink_tlsr/Kconfig new file mode 100644 index 00000000000..144751311ba --- /dev/null +++ b/soc/riscv/telink_tlsr/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_TELINK_TLSR + bool + +if SOC_FAMILY_TELINK_TLSR + +config SOC_FAMILY + string + default "telink_tlsr" + +source "soc/riscv/telink_tlsr/*/Kconfig.soc" + +endif # SOC_FAMILY_TELINK_TLSR diff --git a/soc/riscv/telink_tlsr/Kconfig.defconfig b/soc/riscv/telink_tlsr/Kconfig.defconfig new file mode 100644 index 00000000000..04a888381fa --- /dev/null +++ b/soc/riscv/telink_tlsr/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/telink_tlsr/*/Kconfig.defconfig.series" diff --git a/soc/riscv/telink_tlsr/Kconfig.soc b/soc/riscv/telink_tlsr/Kconfig.soc new file mode 100644 index 00000000000..db09c69d1f4 --- /dev/null +++ b/soc/riscv/telink_tlsr/Kconfig.soc @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/telink_tlsr/*/Kconfig.series" diff --git a/soc/riscv/riscv-privileged/telink_b91/CMakeLists.txt b/soc/riscv/telink_tlsr/tlsr951x/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/CMakeLists.txt rename to soc/riscv/telink_tlsr/tlsr951x/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/telink_b91/Kconfig.defconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series similarity index 81% rename from soc/riscv/riscv-privileged/telink_b91/Kconfig.defconfig.series rename to soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series index 986b6240750..23a78c9f0da 100644 --- a/soc/riscv/riscv-privileged/telink_b91/Kconfig.defconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series @@ -1,11 +1,11 @@ # Copyright (c) 2021 Telink Semiconductor # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_RISCV_TELINK_B91 +if SOC_SERIES_TELINK_TLSR951X config SOC_SERIES string - default "telink_b91" + default "tlsr951x" config SYS_CLOCK_HW_CYCLES_PER_SEC int @@ -56,4 +56,6 @@ config 2ND_LVL_INTR_00_OFFSET config HAS_FLASH_LOAD_OFFSET default y if BOOTLOADER_MCUBOOT -endif # SOC_SERIES_RISCV_TELINK_B91 +source "soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr*" + +endif # SOC_SERIES_TELINK_TLSR951X diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr9518 b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr9518 new file mode 100644 index 00000000000..4ffdebdaf6b --- /dev/null +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr9518 @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC + default "tlsr9518" if SOC_TELINK_TLSR9518 diff --git a/soc/riscv/riscv-privileged/telink_b91/Kconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series similarity index 55% rename from soc/riscv/riscv-privileged/telink_b91/Kconfig.series rename to soc/riscv/telink_tlsr/tlsr951x/Kconfig.series index cce6011ce68..e074a53e11b 100644 --- a/soc/riscv/riscv-privileged/telink_b91/Kconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series @@ -1,8 +1,8 @@ # Copyright (c) 2021 Telink Semiconductor # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_RISCV_TELINK_B91 - bool "Telink B91 SoC Implementation" +config SOC_SERIES_TELINK_TLSR951X + bool "Telink TLSR951X" select RISCV select RISCV_ISA_RV32I select RISCV_ISA_EXT_M @@ -12,5 +12,10 @@ config SOC_SERIES_RISCV_TELINK_B91 select RISCV_ISA_EXT_ZIFENCEI select RISCV_PRIVILEGED select HAS_TELINK_DRIVERS + select ATOMIC_OPERATIONS_BUILTIN + select CPU_HAS_FPU + select INCLUDE_RESET_VECTOR + select SOC_FAMILY_TELINK_TLSR + select RISCV_PRIVILEGED_STANDALONE help - Enable support for Telink B91 SoC + Enable support for Telink TLSR951X diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc new file mode 100644 index 00000000000..2abc12cc58c --- /dev/null +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc @@ -0,0 +1,23 @@ +# Copyright (c) 2021 Telink Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_TELINK_TLSR951X + +choice + prompt "Telink TLSR951X SoC implementation" + +config SOC_TELINK_TLSR9518 + bool "Telink TLSR9518" + +endchoice + +config TELINK_B91_HWDSP + bool "Support Hardware DSP" + select RISCV_SOC_CONTEXT_SAVE + +config TELINK_B91_PFT_ARCH + bool "Support performance throttling" + default y + select RISCV_SOC_CONTEXT_SAVE + +endif # SOC_SERIES_TELINK_TLSR951X diff --git a/soc/riscv/riscv-privileged/telink_b91/init.ld b/soc/riscv/telink_tlsr/tlsr951x/init.ld similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/init.ld rename to soc/riscv/telink_tlsr/tlsr951x/init.ld diff --git a/soc/riscv/riscv-privileged/telink_b91/linker.ld b/soc/riscv/telink_tlsr/tlsr951x/linker.ld similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/linker.ld rename to soc/riscv/telink_tlsr/tlsr951x/linker.ld diff --git a/soc/riscv/riscv-privileged/telink_b91/pinctrl_soc.h b/soc/riscv/telink_tlsr/tlsr951x/pinctrl_soc.h similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/pinctrl_soc.h rename to soc/riscv/telink_tlsr/tlsr951x/pinctrl_soc.h diff --git a/soc/riscv/riscv-privileged/telink_b91/soc.c b/soc/riscv/telink_tlsr/tlsr951x/soc.c similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/soc.c rename to soc/riscv/telink_tlsr/tlsr951x/soc.c diff --git a/soc/riscv/riscv-privileged/telink_b91/soc.h b/soc/riscv/telink_tlsr/tlsr951x/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/soc.h rename to soc/riscv/telink_tlsr/tlsr951x/soc.h diff --git a/soc/riscv/riscv-privileged/telink_b91/soc_context.h b/soc/riscv/telink_tlsr/tlsr951x/soc_context.h similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/soc_context.h rename to soc/riscv/telink_tlsr/tlsr951x/soc_context.h diff --git a/soc/riscv/riscv-privileged/telink_b91/soc_irq.S b/soc/riscv/telink_tlsr/tlsr951x/soc_irq.S similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/soc_irq.S rename to soc/riscv/telink_tlsr/tlsr951x/soc_irq.S diff --git a/soc/riscv/riscv-privileged/telink_b91/soc_offsets.h b/soc/riscv/telink_tlsr/tlsr951x/soc_offsets.h similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/soc_offsets.h rename to soc/riscv/telink_tlsr/tlsr951x/soc_offsets.h diff --git a/soc/riscv/riscv-privileged/telink_b91/start.S b/soc/riscv/telink_tlsr/tlsr951x/start.S similarity index 100% rename from soc/riscv/riscv-privileged/telink_b91/start.S rename to soc/riscv/telink_tlsr/tlsr951x/start.S From e161f49c59086ac9525cf95270944e03d799d06a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 14:14:00 +0100 Subject: [PATCH 0270/2300] [nrf fromtree] soc: riscv: gd32vf103: reorganize SoC folder Move things out from riscv-privileged, and create the new RISC-V GD32 family. New family folder follows the _ naming convention. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 5a98d87335a2db818259dd71f84b4a9e8df052a2) (cherry picked from commit 8dc0338a3a585d0d6012b8045572af067f312aa5) --- MAINTAINERS.yml | 2 +- soc/riscv/gd_gd32/CMakeLists.txt | 4 ++++ soc/riscv/gd_gd32/Kconfig | 15 +++++++++++++++ soc/riscv/gd_gd32/Kconfig.defconfig | 4 ++++ soc/riscv/gd_gd32/Kconfig.soc | 4 ++++ .../gd32vf103/CMakeLists.txt | 0 .../gd32vf103/Kconfig.defconfig.gd32vf103 | 0 .../gd32vf103/Kconfig.defconfig.series | 2 +- .../gd32vf103/Kconfig.series | 3 ++- .../gd32vf103/Kconfig.soc | 0 .../gd32vf103/entry.S | 0 .../gd32vf103/gd32_regs.h | 0 .../gd32vf103/nuclei_csr.h | 0 .../gd32vf103/pinctrl_soc.h | 0 .../{riscv-privileged => gd_gd32}/gd32vf103/soc.c | 0 .../{riscv-privileged => gd_gd32}/gd32vf103/soc.h | 0 16 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 soc/riscv/gd_gd32/CMakeLists.txt create mode 100644 soc/riscv/gd_gd32/Kconfig create mode 100644 soc/riscv/gd_gd32/Kconfig.defconfig create mode 100644 soc/riscv/gd_gd32/Kconfig.soc rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/Kconfig.defconfig.gd32vf103 (100%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/Kconfig.defconfig.series (72%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/Kconfig.series (89%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/Kconfig.soc (100%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/entry.S (100%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/gd32_regs.h (100%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/nuclei_csr.h (100%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/pinctrl_soc.h (100%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/soc.c (100%) rename soc/riscv/{riscv-privileged => gd_gd32}/gd32vf103/soc.h (100%) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 97d0ec0222f..99b12fe4a5d 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -2473,7 +2473,7 @@ GD32 Platforms: - dts/*/gigadevice/ - dts/bindings/*/*gd32* - soc/arm/gigadevice/ - - soc/riscv/riscv-privileged/gd32vf103/ + - soc/riscv/gd_gd32/ - scripts/west_commands/*/*gd32* labels: - "platform: GD32" diff --git a/soc/riscv/gd_gd32/CMakeLists.txt b/soc/riscv/gd_gd32/CMakeLists.txt new file mode 100644 index 00000000000..69b2926358e --- /dev/null +++ b/soc/riscv/gd_gd32/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/gd_gd32/Kconfig b/soc/riscv/gd_gd32/Kconfig new file mode 100644 index 00000000000..46f2dd0b1d6 --- /dev/null +++ b/soc/riscv/gd_gd32/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_GD32 + bool + +if SOC_FAMILY_GD32 + +config SOC_FAMILY + string + default "gd_gd32" + +source "soc/riscv/gd_gd32/*/Kconfig.soc" + +endif # SOC_FAMILY_GIGADEVICE_GD32 diff --git a/soc/riscv/gd_gd32/Kconfig.defconfig b/soc/riscv/gd_gd32/Kconfig.defconfig new file mode 100644 index 00000000000..2be284db7ea --- /dev/null +++ b/soc/riscv/gd_gd32/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/gd_gd32/*/Kconfig.defconfig.series" diff --git a/soc/riscv/gd_gd32/Kconfig.soc b/soc/riscv/gd_gd32/Kconfig.soc new file mode 100644 index 00000000000..09d7d5d627e --- /dev/null +++ b/soc/riscv/gd_gd32/Kconfig.soc @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/gd_gd32/*/Kconfig.series" diff --git a/soc/riscv/riscv-privileged/gd32vf103/CMakeLists.txt b/soc/riscv/gd_gd32/gd32vf103/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/CMakeLists.txt rename to soc/riscv/gd_gd32/gd32vf103/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.gd32vf103 rename to soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 diff --git a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.series b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.series similarity index 72% rename from soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.series rename to soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.series index 061b53b2514..17ab7a87c39 100644 --- a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.series +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.series @@ -3,7 +3,7 @@ if SOC_SERIES_GD32VF103 -source "soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.gd32vf103*" +source "soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103*" config SOC_SERIES default "gd32vf103" diff --git a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series b/soc/riscv/gd_gd32/gd32vf103/Kconfig.series similarity index 89% rename from soc/riscv/riscv-privileged/gd32vf103/Kconfig.series rename to soc/riscv/gd_gd32/gd32vf103/Kconfig.series index 79bb3690743..b0b86db7c02 100644 --- a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.series @@ -15,6 +15,7 @@ config SOC_SERIES_GD32VF103 select GD32_HAS_IRC_40K select HAS_GD32_HAL select RISCV_HAS_CLIC - + select SOC_FAMILY_GD32 + select RISCV_PRIVILEGED_STANDALONE help Enable support for GigaDevice GD32VF1 series SoC diff --git a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.soc b/soc/riscv/gd_gd32/gd32vf103/Kconfig.soc similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/Kconfig.soc rename to soc/riscv/gd_gd32/gd32vf103/Kconfig.soc diff --git a/soc/riscv/riscv-privileged/gd32vf103/entry.S b/soc/riscv/gd_gd32/gd32vf103/entry.S similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/entry.S rename to soc/riscv/gd_gd32/gd32vf103/entry.S diff --git a/soc/riscv/riscv-privileged/gd32vf103/gd32_regs.h b/soc/riscv/gd_gd32/gd32vf103/gd32_regs.h similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/gd32_regs.h rename to soc/riscv/gd_gd32/gd32vf103/gd32_regs.h diff --git a/soc/riscv/riscv-privileged/gd32vf103/nuclei_csr.h b/soc/riscv/gd_gd32/gd32vf103/nuclei_csr.h similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/nuclei_csr.h rename to soc/riscv/gd_gd32/gd32vf103/nuclei_csr.h diff --git a/soc/riscv/riscv-privileged/gd32vf103/pinctrl_soc.h b/soc/riscv/gd_gd32/gd32vf103/pinctrl_soc.h similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/pinctrl_soc.h rename to soc/riscv/gd_gd32/gd32vf103/pinctrl_soc.h diff --git a/soc/riscv/riscv-privileged/gd32vf103/soc.c b/soc/riscv/gd_gd32/gd32vf103/soc.c similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/soc.c rename to soc/riscv/gd_gd32/gd32vf103/soc.c diff --git a/soc/riscv/riscv-privileged/gd32vf103/soc.h b/soc/riscv/gd_gd32/gd32vf103/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/soc.h rename to soc/riscv/gd_gd32/gd32vf103/soc.h From 8a47d8208036745fbaf399f2c8d7f6d6fa9234f2 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 15:15:05 +0100 Subject: [PATCH 0271/2300] [nrf fromtree] soc: riscv: starfive_jh71xx: reorganize SoC folder Move it out from RISC-V privileged folder, and create a standalone family. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 87f3b072922fe3f5f6e55f090e6abd3d155cbf0e) (cherry picked from commit 13dbdb2dd7a1de4cdeab1ed987ca0bdf1e52c942) --- soc/riscv/starfive_jh71xx/CMakeLists.txt | 4 ++++ soc/riscv/starfive_jh71xx/Kconfig | 15 +++++++++++++++ soc/riscv/starfive_jh71xx/Kconfig.defconfig | 4 ++++ soc/riscv/starfive_jh71xx/Kconfig.soc | 4 ++++ .../jh71xx}/CMakeLists.txt | 0 .../jh71xx/Kconfig.defconfig.jh7100 | 5 +++++ .../jh71xx}/Kconfig.defconfig.series | 4 +++- .../jh71xx}/Kconfig.series | 1 + .../jh71xx}/Kconfig.soc | 0 .../jh71xx}/soc.h | 0 10 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 soc/riscv/starfive_jh71xx/CMakeLists.txt create mode 100644 soc/riscv/starfive_jh71xx/Kconfig create mode 100644 soc/riscv/starfive_jh71xx/Kconfig.defconfig create mode 100644 soc/riscv/starfive_jh71xx/Kconfig.soc rename soc/riscv/{riscv-privileged/starfive_jh71xx => starfive_jh71xx/jh71xx}/CMakeLists.txt (100%) create mode 100644 soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh7100 rename soc/riscv/{riscv-privileged/starfive_jh71xx => starfive_jh71xx/jh71xx}/Kconfig.defconfig.series (84%) rename soc/riscv/{riscv-privileged/starfive_jh71xx => starfive_jh71xx/jh71xx}/Kconfig.series (88%) rename soc/riscv/{riscv-privileged/starfive_jh71xx => starfive_jh71xx/jh71xx}/Kconfig.soc (100%) rename soc/riscv/{riscv-privileged/starfive_jh71xx => starfive_jh71xx/jh71xx}/soc.h (100%) diff --git a/soc/riscv/starfive_jh71xx/CMakeLists.txt b/soc/riscv/starfive_jh71xx/CMakeLists.txt new file mode 100644 index 00000000000..69b2926358e --- /dev/null +++ b/soc/riscv/starfive_jh71xx/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/starfive_jh71xx/Kconfig b/soc/riscv/starfive_jh71xx/Kconfig new file mode 100644 index 00000000000..65694c07eff --- /dev/null +++ b/soc/riscv/starfive_jh71xx/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_STARFIVE_JH71XX + bool + +if SOC_FAMILY_STARFIVE_JH71XX + +config SOC_FAMILY + string + default "starfive_jh71xx" + +source "soc/riscv/starfive_jh71xx/*/Kconfig.soc" + +endif # SOC_FAMILY_STARFIVE_JH71XX diff --git a/soc/riscv/starfive_jh71xx/Kconfig.defconfig b/soc/riscv/starfive_jh71xx/Kconfig.defconfig new file mode 100644 index 00000000000..b399e38b340 --- /dev/null +++ b/soc/riscv/starfive_jh71xx/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/starfive_jh71xx/*/Kconfig.defconfig.series" diff --git a/soc/riscv/starfive_jh71xx/Kconfig.soc b/soc/riscv/starfive_jh71xx/Kconfig.soc new file mode 100644 index 00000000000..1ff54faa970 --- /dev/null +++ b/soc/riscv/starfive_jh71xx/Kconfig.soc @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/starfive_jh71xx/*/Kconfig.series" diff --git a/soc/riscv/riscv-privileged/starfive_jh71xx/CMakeLists.txt b/soc/riscv/starfive_jh71xx/jh71xx/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/starfive_jh71xx/CMakeLists.txt rename to soc/riscv/starfive_jh71xx/jh71xx/CMakeLists.txt diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh7100 b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh7100 new file mode 100644 index 00000000000..6f38d61dd4e --- /dev/null +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh7100 @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC + default "jh7100" if SOC_JH7100 diff --git a/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.defconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series similarity index 84% rename from soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.defconfig.series rename to soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series index c488c614b7d..77436b593e1 100644 --- a/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.defconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series @@ -4,7 +4,7 @@ if SOC_SERIES_STARFIVE_JH71XX config SOC_SERIES - default "starfive_jh71xx" + default "jh71xx" config SYS_CLOCK_HW_CYCLES_PER_SEC default 6250000 @@ -30,4 +30,6 @@ config 2ND_LVL_INTR_00_OFFSET config NUM_IRQS default 139 +source "soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh71*" + endif diff --git a/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series similarity index 88% rename from soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series rename to soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series index 19cedcefe27..d70cff1c63d 100644 --- a/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series @@ -5,5 +5,6 @@ config SOC_SERIES_STARFIVE_JH71XX bool "Starfive JH71XX series" select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE help Enable support for Starfive JH71XX SoC Series. diff --git a/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.soc b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.soc similarity index 100% rename from soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.soc rename to soc/riscv/starfive_jh71xx/jh71xx/Kconfig.soc diff --git a/soc/riscv/riscv-privileged/starfive_jh71xx/soc.h b/soc/riscv/starfive_jh71xx/jh71xx/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/starfive_jh71xx/soc.h rename to soc/riscv/starfive_jh71xx/jh71xx/soc.h From afb3219d6e3d6e9109b6c54f68f2ee9fb2af3f1c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 15:25:56 +0100 Subject: [PATCH 0272/2300] [nrf fromtree] soc: riscv: andes_v5: reorganize SoC folder Split out from riscv-privileged folder, and create a new family. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 8027689392f6ba835906efe56296094bf49e3aa8) (cherry picked from commit e49c07725f1b8bbce00b2406b2630ba13b75e176) --- boards/riscv/adp_xc7k_ae350/Kconfig.board | 2 +- .../riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig | 4 ++-- drivers/hwinfo/Kconfig | 2 +- soc/riscv/andes_v5/CMakeLists.txt | 4 ++++ soc/riscv/andes_v5/Kconfig | 15 +++++++++++++++ soc/riscv/andes_v5/Kconfig.defconfig | 4 ++++ soc/riscv/andes_v5/Kconfig.soc | 4 ++++ .../andes_v5 => andes_v5/ae350}/CMakeLists.txt | 6 +++--- .../ae350}/Kconfig.defconfig.ae350 | 4 ++-- .../ae350}/Kconfig.defconfig.series | 8 ++++---- soc/riscv/andes_v5/ae350/Kconfig.series | 11 +++++++++++ .../andes_v5 => andes_v5/ae350}/Kconfig.soc | 8 ++++---- .../ae350}/common_linker/execit.ld | 0 .../ae350}/common_linker/init.ld | 0 .../ae350}/common_linker/ram_start_nonzero.ld | 0 .../andes_v5 => andes_v5/ae350}/l2_cache.c | 0 .../andes_v5/ae350/linker.ld | 0 .../andes_v5 => andes_v5/ae350}/pma.c | 0 .../{riscv-privileged => }/andes_v5/ae350/soc.h | 0 .../andes_v5 => andes_v5/ae350}/soc_context.h | 0 .../andes_v5 => andes_v5/ae350}/soc_irq.S | 0 .../andes_v5 => andes_v5/ae350}/soc_offsets.h | 0 .../andes_v5 => andes_v5/ae350}/soc_v5.h | 0 .../andes_v5 => andes_v5/ae350}/start.S | 0 .../riscv-privileged/andes_v5/Kconfig.series | 9 --------- 25 files changed, 55 insertions(+), 26 deletions(-) create mode 100644 soc/riscv/andes_v5/CMakeLists.txt create mode 100644 soc/riscv/andes_v5/Kconfig create mode 100644 soc/riscv/andes_v5/Kconfig.defconfig create mode 100644 soc/riscv/andes_v5/Kconfig.soc rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/CMakeLists.txt (82%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/Kconfig.defconfig.ae350 (88%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/Kconfig.defconfig.series (83%) create mode 100644 soc/riscv/andes_v5/ae350/Kconfig.series rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/Kconfig.soc (95%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/common_linker/execit.ld (100%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/common_linker/init.ld (100%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/common_linker/ram_start_nonzero.ld (100%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/l2_cache.c (100%) rename soc/riscv/{riscv-privileged => }/andes_v5/ae350/linker.ld (100%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/pma.c (100%) rename soc/riscv/{riscv-privileged => }/andes_v5/ae350/soc.h (100%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/soc_context.h (100%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/soc_irq.S (100%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/soc_offsets.h (100%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/soc_v5.h (100%) rename soc/riscv/{riscv-privileged/andes_v5 => andes_v5/ae350}/start.S (100%) delete mode 100644 soc/riscv/riscv-privileged/andes_v5/Kconfig.series diff --git a/boards/riscv/adp_xc7k_ae350/Kconfig.board b/boards/riscv/adp_xc7k_ae350/Kconfig.board index 085eb9696a8..5b58e01fbfd 100644 --- a/boards/riscv/adp_xc7k_ae350/Kconfig.board +++ b/boards/riscv/adp_xc7k_ae350/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_ADP_XC7K_AE350 bool "Andes ADP-XC7K AE350 Platform" - depends on SOC_RISCV_ANDES_AE350 + depends on SOC_ANDES_AE350 diff --git a/boards/riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig b/boards/riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig index 3f7f1f727c6..edbe7118c64 100644 --- a/boards/riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig +++ b/boards/riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig @@ -1,5 +1,5 @@ -CONFIG_SOC_SERIES_RISCV_ANDES_V5=y -CONFIG_SOC_RISCV_ANDES_AE350=y +CONFIG_SOC_SERIES_ANDES_AE350=y +CONFIG_SOC_ANDES_AE350=y CONFIG_BOARD_ADP_XC7K_AE350=y CONFIG_XIP=n CONFIG_CONSOLE=y diff --git a/drivers/hwinfo/Kconfig b/drivers/hwinfo/Kconfig index 7c4cc7f0805..4bf9e462318 100644 --- a/drivers/hwinfo/Kconfig +++ b/drivers/hwinfo/Kconfig @@ -181,7 +181,7 @@ config HWINFO_GECKO config HWINFO_ANDES bool "Andes system ID" default y - depends on SOC_SERIES_RISCV_ANDES_V5 + depends on SOC_FAMILY_ANDES_V5 help Enable Andes hwinfo driver diff --git a/soc/riscv/andes_v5/CMakeLists.txt b/soc/riscv/andes_v5/CMakeLists.txt new file mode 100644 index 00000000000..69b2926358e --- /dev/null +++ b/soc/riscv/andes_v5/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/andes_v5/Kconfig b/soc/riscv/andes_v5/Kconfig new file mode 100644 index 00000000000..f3c78ab7f81 --- /dev/null +++ b/soc/riscv/andes_v5/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_ANDES_V5 + bool + +if SOC_FAMILY_ANDES_V5 + +config SOC_FAMILY + string + default "andes_v5" + +source "soc/riscv/andes_v5/*/Kconfig.soc" + +endif # SOC_FAMILY_ANDES_V5 diff --git a/soc/riscv/andes_v5/Kconfig.defconfig b/soc/riscv/andes_v5/Kconfig.defconfig new file mode 100644 index 00000000000..6213f28d2cb --- /dev/null +++ b/soc/riscv/andes_v5/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/andes_v5/*/Kconfig.defconfig.series" diff --git a/soc/riscv/andes_v5/Kconfig.soc b/soc/riscv/andes_v5/Kconfig.soc new file mode 100644 index 00000000000..9efb4781934 --- /dev/null +++ b/soc/riscv/andes_v5/Kconfig.soc @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/andes_v5/*/Kconfig.series" diff --git a/soc/riscv/riscv-privileged/andes_v5/CMakeLists.txt b/soc/riscv/andes_v5/ae350/CMakeLists.txt similarity index 82% rename from soc/riscv/riscv-privileged/andes_v5/CMakeLists.txt rename to soc/riscv/andes_v5/ae350/CMakeLists.txt index 21268312347..b8eac026dfb 100644 --- a/soc/riscv/riscv-privileged/andes_v5/CMakeLists.txt +++ b/soc/riscv/andes_v5/ae350/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_include_directories(${CONFIG_SOC}) +zephyr_include_directories(.) zephyr_sources( start.S @@ -24,6 +24,6 @@ if(CONFIG_SOC_ANDES_V5_EXECIT) zephyr_ld_options(-Wl,--mexecit) endif() -if(CONFIG_SOC_RISCV_ANDES_AE350) - set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/ae350/linker.ld CACHE INTERNAL "") +if(CONFIG_SOC_ANDES_AE350) + set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "") endif() diff --git a/soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.ae350 b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.ae350 similarity index 88% rename from soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.ae350 rename to soc/riscv/andes_v5/ae350/Kconfig.defconfig.ae350 index 5d652057a38..fee73684b71 100644 --- a/soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.ae350 +++ b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.ae350 @@ -1,7 +1,7 @@ # Copyright (c) 2021 Andes Technology Corporation # SPDX-License-Identifier: Apache-2.0 -if SOC_RISCV_ANDES_AE350 +if SOC_ANDES_AE350 config SOC default "ae350" @@ -25,4 +25,4 @@ config MP_MAX_NUM_CPUS default 1 range 1 8 -endif # SOC_RISCV_ANDES_AE350 +endif # SOC_ANDES_AE350 diff --git a/soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series similarity index 83% rename from soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.series rename to soc/riscv/andes_v5/ae350/Kconfig.defconfig.series index c6436807825..7bd679e5f45 100644 --- a/soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.series +++ b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series @@ -1,15 +1,15 @@ # Copyright (c) 2021 Andes Technology Corporation # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_RISCV_ANDES_V5 +if SOC_SERIES_ANDES_AE350 # Kconfig picks the first default with a satisfied condition. # SoC defaults should be parsed before SoC Series defaults, because SoCs usually # overrides SoC Series values. -source "soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.ae*" +source "soc/riscv/andes_v5/ae350/Kconfig.defconfig.ae*" config SOC_SERIES - default "andes_v5" + default "ae350" config SYS_CLOCK_HW_CYCLES_PER_SEC default 60000000 @@ -45,4 +45,4 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 64 -endif # SOC_SERIES_RISCV_ANDES_V5 +endif # SOC_SERIES_ANDES_AE350 diff --git a/soc/riscv/andes_v5/ae350/Kconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.series new file mode 100644 index 00000000000..4eb9557f92f --- /dev/null +++ b/soc/riscv/andes_v5/ae350/Kconfig.series @@ -0,0 +1,11 @@ +# Copyright (c) 2021 Andes Technology Corporation +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_ANDES_AE350 + bool "Andes V5 AE350 SoC Series Implementation" + select RISCV + select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE + select SOC_FAMILY_ANDES_V5 + help + Enable support for Andes V5 AE350 SoC Series diff --git a/soc/riscv/riscv-privileged/andes_v5/Kconfig.soc b/soc/riscv/andes_v5/ae350/Kconfig.soc similarity index 95% rename from soc/riscv/riscv-privileged/andes_v5/Kconfig.soc rename to soc/riscv/andes_v5/ae350/Kconfig.soc index 19f215e2c5a..1731cc08f51 100644 --- a/soc/riscv/riscv-privileged/andes_v5/Kconfig.soc +++ b/soc/riscv/andes_v5/ae350/Kconfig.soc @@ -3,9 +3,9 @@ choice prompt "Andes V5 SoC Selection" -depends on SOC_SERIES_RISCV_ANDES_V5 +depends on SOC_SERIES_ANDES_AE350 -config SOC_RISCV_ANDES_AE350 +config SOC_ANDES_AE350 bool "Andes AE350 SoC implementation" select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR @@ -18,7 +18,7 @@ config SOC_RISCV_ANDES_AE350 endchoice -if SOC_SERIES_RISCV_ANDES_V5 +if SOC_SERIES_ANDES_AE350 choice prompt "Base CPU ISA options" @@ -121,4 +121,4 @@ config SOC_ANDES_V5_IOCP between cache and external non-caching master, such as DMA controller. -endif # SOC_SERIES_RISCV_ANDES_V5 +endif # SOC_SERIES_ANDES_AE350 diff --git a/soc/riscv/riscv-privileged/andes_v5/common_linker/execit.ld b/soc/riscv/andes_v5/ae350/common_linker/execit.ld similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/common_linker/execit.ld rename to soc/riscv/andes_v5/ae350/common_linker/execit.ld diff --git a/soc/riscv/riscv-privileged/andes_v5/common_linker/init.ld b/soc/riscv/andes_v5/ae350/common_linker/init.ld similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/common_linker/init.ld rename to soc/riscv/andes_v5/ae350/common_linker/init.ld diff --git a/soc/riscv/riscv-privileged/andes_v5/common_linker/ram_start_nonzero.ld b/soc/riscv/andes_v5/ae350/common_linker/ram_start_nonzero.ld similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/common_linker/ram_start_nonzero.ld rename to soc/riscv/andes_v5/ae350/common_linker/ram_start_nonzero.ld diff --git a/soc/riscv/riscv-privileged/andes_v5/l2_cache.c b/soc/riscv/andes_v5/ae350/l2_cache.c similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/l2_cache.c rename to soc/riscv/andes_v5/ae350/l2_cache.c diff --git a/soc/riscv/riscv-privileged/andes_v5/ae350/linker.ld b/soc/riscv/andes_v5/ae350/linker.ld similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/ae350/linker.ld rename to soc/riscv/andes_v5/ae350/linker.ld diff --git a/soc/riscv/riscv-privileged/andes_v5/pma.c b/soc/riscv/andes_v5/ae350/pma.c similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/pma.c rename to soc/riscv/andes_v5/ae350/pma.c diff --git a/soc/riscv/riscv-privileged/andes_v5/ae350/soc.h b/soc/riscv/andes_v5/ae350/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/ae350/soc.h rename to soc/riscv/andes_v5/ae350/soc.h diff --git a/soc/riscv/riscv-privileged/andes_v5/soc_context.h b/soc/riscv/andes_v5/ae350/soc_context.h similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/soc_context.h rename to soc/riscv/andes_v5/ae350/soc_context.h diff --git a/soc/riscv/riscv-privileged/andes_v5/soc_irq.S b/soc/riscv/andes_v5/ae350/soc_irq.S similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/soc_irq.S rename to soc/riscv/andes_v5/ae350/soc_irq.S diff --git a/soc/riscv/riscv-privileged/andes_v5/soc_offsets.h b/soc/riscv/andes_v5/ae350/soc_offsets.h similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/soc_offsets.h rename to soc/riscv/andes_v5/ae350/soc_offsets.h diff --git a/soc/riscv/riscv-privileged/andes_v5/soc_v5.h b/soc/riscv/andes_v5/ae350/soc_v5.h similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/soc_v5.h rename to soc/riscv/andes_v5/ae350/soc_v5.h diff --git a/soc/riscv/riscv-privileged/andes_v5/start.S b/soc/riscv/andes_v5/ae350/start.S similarity index 100% rename from soc/riscv/riscv-privileged/andes_v5/start.S rename to soc/riscv/andes_v5/ae350/start.S diff --git a/soc/riscv/riscv-privileged/andes_v5/Kconfig.series b/soc/riscv/riscv-privileged/andes_v5/Kconfig.series deleted file mode 100644 index a85c521492b..00000000000 --- a/soc/riscv/riscv-privileged/andes_v5/Kconfig.series +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2021 Andes Technology Corporation -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_RISCV_ANDES_V5 - bool "Andes V5 SoC Series Implementation" - select RISCV - select RISCV_PRIVILEGED - help - Enable support for Andes V5 SoC Series From d6d4a4e5914ffbff3e49883bc3936249b6cfaf74 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 15:36:49 +0100 Subject: [PATCH 0273/2300] [nrf fromtree] soc: riscv: ite: reorganize SoC folder Follow the vendor structure [1]: - Family: ITE Embedded Controller SoCs - Series: IT8XXX2 - SoCs: IT81202BX, IT81202CX, etc. [1]: https://www.ite.com.tw/en/product/category?cid=1 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 4a0d880350b84d22789a37c942a567c6036e8aca) (cherry picked from commit c0174179b7a7679bd3c9ad9c0132df6990fa27fd) --- MAINTAINERS.yml | 2 +- boards/riscv/it82xx2_evb/it82xx2_evb_defconfig | 2 +- boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig | 2 +- soc/riscv/{riscv-ite => ite_ec}/CMakeLists.txt | 0 soc/riscv/ite_ec/Kconfig | 17 +++++++++++++++++ .../{riscv-ite => ite_ec}/Kconfig.defconfig | 2 +- soc/riscv/{riscv-ite => ite_ec}/Kconfig.soc | 2 +- .../{riscv-ite => ite_ec}/common/CMakeLists.txt | 0 .../{riscv-ite => ite_ec}/common/check_regs.c | 0 .../common/chip_chipregs.h | 0 .../{riscv-ite => ite_ec}/common/pinctrl_soc.h | 0 soc/riscv/{riscv-ite => ite_ec}/common/policy.c | 0 soc/riscv/{riscv-ite => ite_ec}/common/power.c | 0 .../{riscv-ite => ite_ec}/common/soc_common.h | 0 .../common/soc_common_irq.c | 0 soc/riscv/{riscv-ite => ite_ec}/common/soc_dt.h | 0 .../{riscv-ite => ite_ec}/common/soc_espi.h | 0 .../{riscv-ite => ite_ec}/common/soc_irq.S | 0 soc/riscv/{riscv-ite => ite_ec}/common/vector.S | 0 .../it8xxx2/CMakeLists.txt | 0 .../it8xxx2/Kconfig.defconfig.it81202bx | 0 .../it8xxx2/Kconfig.defconfig.it81202cx | 0 .../it8xxx2/Kconfig.defconfig.it81302bx | 0 .../it8xxx2/Kconfig.defconfig.it81302cx | 0 .../it8xxx2/Kconfig.defconfig.it82002aw | 0 .../it8xxx2/Kconfig.defconfig.it82202ax | 0 .../it8xxx2/Kconfig.defconfig.it82302ax | 0 .../it8xxx2/Kconfig.defconfig.series | 6 +++--- .../it8xxx2/Kconfig.series | 4 ++-- .../{riscv-ite => ite_ec}/it8xxx2/Kconfig.soc | 2 +- .../it8xxx2/__arithmetic.S | 0 soc/riscv/{riscv-ite => ite_ec}/it8xxx2/ilm.c | 0 soc/riscv/{riscv-ite => ite_ec}/it8xxx2/ilm.h | 0 .../{riscv-ite => ite_ec}/it8xxx2/linker.ld | 0 soc/riscv/{riscv-ite => ite_ec}/it8xxx2/soc.c | 0 soc/riscv/{riscv-ite => ite_ec}/it8xxx2/soc.h | 0 soc/riscv/riscv-ite/Kconfig | 14 -------------- .../gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt | 4 ++-- .../gpio_ite_it8xxx2_v2/include/chip_chipregs.h | 2 +- 39 files changed, 31 insertions(+), 28 deletions(-) rename soc/riscv/{riscv-ite => ite_ec}/CMakeLists.txt (100%) create mode 100644 soc/riscv/ite_ec/Kconfig rename soc/riscv/{riscv-ite => ite_ec}/Kconfig.defconfig (63%) rename soc/riscv/{riscv-ite => ite_ec}/Kconfig.soc (68%) rename soc/riscv/{riscv-ite => ite_ec}/common/CMakeLists.txt (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/check_regs.c (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/chip_chipregs.h (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/pinctrl_soc.h (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/policy.c (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/power.c (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/soc_common.h (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/soc_common_irq.c (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/soc_dt.h (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/soc_espi.h (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/soc_irq.S (100%) rename soc/riscv/{riscv-ite => ite_ec}/common/vector.S (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/CMakeLists.txt (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.defconfig.it81202bx (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.defconfig.it81202cx (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.defconfig.it81302bx (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.defconfig.it81302cx (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.defconfig.it82002aw (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.defconfig.it82202ax (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.defconfig.it82302ax (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.defconfig.series (87%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.series (86%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/Kconfig.soc (99%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/__arithmetic.S (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/ilm.c (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/ilm.h (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/linker.ld (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/soc.c (100%) rename soc/riscv/{riscv-ite => ite_ec}/it8xxx2/soc.h (100%) delete mode 100644 soc/riscv/riscv-ite/Kconfig diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 99b12fe4a5d..d2c888654cf 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -2851,7 +2851,7 @@ ITE Platforms: - drivers/*/*it8xxx2*.c - dts/bindings/*/*ite* - dts/riscv/ite/ - - soc/riscv/riscv-ite/ + - soc/riscv/ite_ec/ labels: - "platform: ITE" diff --git a/boards/riscv/it82xx2_evb/it82xx2_evb_defconfig b/boards/riscv/it82xx2_evb/it82xx2_evb_defconfig index f082e4a7bad..6866e3f633b 100644 --- a/boards/riscv/it82xx2_evb/it82xx2_evb_defconfig +++ b/boards/riscv/it82xx2_evb/it82xx2_evb_defconfig @@ -1,7 +1,7 @@ # Copyright (c) 2023 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV32_IT8XXX2=y +CONFIG_SOC_SERIES_ITE_IT8XXX2=y CONFIG_SOC_IT8XXX2=y CONFIG_SOC_IT82202_AX=y CONFIG_BOARD_IT82XX2_EVB=y diff --git a/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig b/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig index 21967527f8e..38a44d6f8f3 100644 --- a/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig +++ b/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig @@ -1,7 +1,7 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV32_IT8XXX2=y +CONFIG_SOC_SERIES_ITE_IT8XXX2=y CONFIG_SOC_IT8XXX2=y CONFIG_BOARD_IT8XXX2_EVB=y CONFIG_BOOT_DELAY=1 diff --git a/soc/riscv/riscv-ite/CMakeLists.txt b/soc/riscv/ite_ec/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-ite/CMakeLists.txt rename to soc/riscv/ite_ec/CMakeLists.txt diff --git a/soc/riscv/ite_ec/Kconfig b/soc/riscv/ite_ec/Kconfig new file mode 100644 index 00000000000..54628029a4e --- /dev/null +++ b/soc/riscv/ite_ec/Kconfig @@ -0,0 +1,17 @@ +# Copyright (c) 2020 ITE Corporation. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_ITE_EC + bool + help + ITE Embedded Controller SoC family + +if SOC_FAMILY_ITE_EC + +config SOC_FAMILY + string + default "ite_ec" + +source "soc/riscv/ite_ec/*/Kconfig.soc" + +endif # SOC_FAMILY_ITE_EC diff --git a/soc/riscv/riscv-ite/Kconfig.defconfig b/soc/riscv/ite_ec/Kconfig.defconfig similarity index 63% rename from soc/riscv/riscv-ite/Kconfig.defconfig rename to soc/riscv/ite_ec/Kconfig.defconfig index ae18beac098..8994f47abd9 100644 --- a/soc/riscv/riscv-ite/Kconfig.defconfig +++ b/soc/riscv/ite_ec/Kconfig.defconfig @@ -1,4 +1,4 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -source "soc/riscv/riscv-ite/*/Kconfig.defconfig.series" +source "soc/riscv/ite_ec/*/Kconfig.defconfig.series" diff --git a/soc/riscv/riscv-ite/Kconfig.soc b/soc/riscv/ite_ec/Kconfig.soc similarity index 68% rename from soc/riscv/riscv-ite/Kconfig.soc rename to soc/riscv/ite_ec/Kconfig.soc index 925edb1543c..13f951c0466 100644 --- a/soc/riscv/riscv-ite/Kconfig.soc +++ b/soc/riscv/ite_ec/Kconfig.soc @@ -1,4 +1,4 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -source "soc/riscv/riscv-ite/*/Kconfig.series" +source "soc/riscv/ite_ec/*/Kconfig.series" diff --git a/soc/riscv/riscv-ite/common/CMakeLists.txt b/soc/riscv/ite_ec/common/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-ite/common/CMakeLists.txt rename to soc/riscv/ite_ec/common/CMakeLists.txt diff --git a/soc/riscv/riscv-ite/common/check_regs.c b/soc/riscv/ite_ec/common/check_regs.c similarity index 100% rename from soc/riscv/riscv-ite/common/check_regs.c rename to soc/riscv/ite_ec/common/check_regs.c diff --git a/soc/riscv/riscv-ite/common/chip_chipregs.h b/soc/riscv/ite_ec/common/chip_chipregs.h similarity index 100% rename from soc/riscv/riscv-ite/common/chip_chipregs.h rename to soc/riscv/ite_ec/common/chip_chipregs.h diff --git a/soc/riscv/riscv-ite/common/pinctrl_soc.h b/soc/riscv/ite_ec/common/pinctrl_soc.h similarity index 100% rename from soc/riscv/riscv-ite/common/pinctrl_soc.h rename to soc/riscv/ite_ec/common/pinctrl_soc.h diff --git a/soc/riscv/riscv-ite/common/policy.c b/soc/riscv/ite_ec/common/policy.c similarity index 100% rename from soc/riscv/riscv-ite/common/policy.c rename to soc/riscv/ite_ec/common/policy.c diff --git a/soc/riscv/riscv-ite/common/power.c b/soc/riscv/ite_ec/common/power.c similarity index 100% rename from soc/riscv/riscv-ite/common/power.c rename to soc/riscv/ite_ec/common/power.c diff --git a/soc/riscv/riscv-ite/common/soc_common.h b/soc/riscv/ite_ec/common/soc_common.h similarity index 100% rename from soc/riscv/riscv-ite/common/soc_common.h rename to soc/riscv/ite_ec/common/soc_common.h diff --git a/soc/riscv/riscv-ite/common/soc_common_irq.c b/soc/riscv/ite_ec/common/soc_common_irq.c similarity index 100% rename from soc/riscv/riscv-ite/common/soc_common_irq.c rename to soc/riscv/ite_ec/common/soc_common_irq.c diff --git a/soc/riscv/riscv-ite/common/soc_dt.h b/soc/riscv/ite_ec/common/soc_dt.h similarity index 100% rename from soc/riscv/riscv-ite/common/soc_dt.h rename to soc/riscv/ite_ec/common/soc_dt.h diff --git a/soc/riscv/riscv-ite/common/soc_espi.h b/soc/riscv/ite_ec/common/soc_espi.h similarity index 100% rename from soc/riscv/riscv-ite/common/soc_espi.h rename to soc/riscv/ite_ec/common/soc_espi.h diff --git a/soc/riscv/riscv-ite/common/soc_irq.S b/soc/riscv/ite_ec/common/soc_irq.S similarity index 100% rename from soc/riscv/riscv-ite/common/soc_irq.S rename to soc/riscv/ite_ec/common/soc_irq.S diff --git a/soc/riscv/riscv-ite/common/vector.S b/soc/riscv/ite_ec/common/vector.S similarity index 100% rename from soc/riscv/riscv-ite/common/vector.S rename to soc/riscv/ite_ec/common/vector.S diff --git a/soc/riscv/riscv-ite/it8xxx2/CMakeLists.txt b/soc/riscv/ite_ec/it8xxx2/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/CMakeLists.txt rename to soc/riscv/ite_ec/it8xxx2/CMakeLists.txt diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81202bx b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81202bx similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81202bx rename to soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81202bx diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81202cx b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81202cx similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81202cx rename to soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81202cx diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81302bx b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81302bx similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81302bx rename to soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81302bx diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81302cx b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81302cx similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81302cx rename to soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81302cx diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82002aw b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82002aw similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82002aw rename to soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82002aw diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82202ax b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82202ax similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82202ax rename to soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82202ax diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82302ax b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82302ax similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82302ax rename to soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82302ax diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.series b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series similarity index 87% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.series rename to soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series index 4e6b7c18cca..7c5bc0ee897 100644 --- a/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.series +++ b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series @@ -1,7 +1,7 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_RISCV32_IT8XXX2 +if SOC_SERIES_ITE_IT8XXX2 config SOC_SERIES default "it8xxx2" @@ -57,6 +57,6 @@ config GEN_SW_ISR_TABLE config RISCV_SOC_INTERRUPT_INIT default y -source "soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it8*" +source "soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it8*" -endif # SOC_SERIES_RISCV32_IT8XXX2 +endif # SOC_SERIES_ITE_IT8XXX2 diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.series b/soc/riscv/ite_ec/it8xxx2/Kconfig.series similarity index 86% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.series rename to soc/riscv/ite_ec/it8xxx2/Kconfig.series index ebed0fcd120..265bf855f12 100644 --- a/soc/riscv/riscv-ite/it8xxx2/Kconfig.series +++ b/soc/riscv/ite_ec/it8xxx2/Kconfig.series @@ -1,13 +1,13 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_RISCV32_IT8XXX2 +config SOC_SERIES_ITE_IT8XXX2 bool "ITE IT8XXX2 implementation" #depends on RISCV # RV32IAFC is an uncommon configuration which is not supported by # default in most toolchains, causing link-time errors. select CPU_HAS_FPU if "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "zephyr" || RISCV_ISA_EXT_M - select SOC_FAMILY_RISCV_ITE + select SOC_FAMILY_ITE_EC select HAS_PM help Enable support for ITE IT8XXX2 diff --git a/soc/riscv/riscv-ite/it8xxx2/Kconfig.soc b/soc/riscv/ite_ec/it8xxx2/Kconfig.soc similarity index 99% rename from soc/riscv/riscv-ite/it8xxx2/Kconfig.soc rename to soc/riscv/ite_ec/it8xxx2/Kconfig.soc index 38525449f89..800a2a9dafd 100644 --- a/soc/riscv/riscv-ite/it8xxx2/Kconfig.soc +++ b/soc/riscv/ite_ec/it8xxx2/Kconfig.soc @@ -3,7 +3,7 @@ choice prompt "ITE IT8XXX2 system implementation" -depends on SOC_SERIES_RISCV32_IT8XXX2 +depends on SOC_SERIES_ITE_IT8XXX2 config SOC_IT8XXX2 bool "ITE IT8XXX2 system implementation" diff --git a/soc/riscv/riscv-ite/it8xxx2/__arithmetic.S b/soc/riscv/ite_ec/it8xxx2/__arithmetic.S similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/__arithmetic.S rename to soc/riscv/ite_ec/it8xxx2/__arithmetic.S diff --git a/soc/riscv/riscv-ite/it8xxx2/ilm.c b/soc/riscv/ite_ec/it8xxx2/ilm.c similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/ilm.c rename to soc/riscv/ite_ec/it8xxx2/ilm.c diff --git a/soc/riscv/riscv-ite/it8xxx2/ilm.h b/soc/riscv/ite_ec/it8xxx2/ilm.h similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/ilm.h rename to soc/riscv/ite_ec/it8xxx2/ilm.h diff --git a/soc/riscv/riscv-ite/it8xxx2/linker.ld b/soc/riscv/ite_ec/it8xxx2/linker.ld similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/linker.ld rename to soc/riscv/ite_ec/it8xxx2/linker.ld diff --git a/soc/riscv/riscv-ite/it8xxx2/soc.c b/soc/riscv/ite_ec/it8xxx2/soc.c similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/soc.c rename to soc/riscv/ite_ec/it8xxx2/soc.c diff --git a/soc/riscv/riscv-ite/it8xxx2/soc.h b/soc/riscv/ite_ec/it8xxx2/soc.h similarity index 100% rename from soc/riscv/riscv-ite/it8xxx2/soc.h rename to soc/riscv/ite_ec/it8xxx2/soc.h diff --git a/soc/riscv/riscv-ite/Kconfig b/soc/riscv/riscv-ite/Kconfig deleted file mode 100644 index f25c53d1ffb..00000000000 --- a/soc/riscv/riscv-ite/Kconfig +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2020 ITE Corporation. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_RISCV_ITE - bool - help - omit prompt to signify a "hidden" option - -config SOC_FAMILY - string - default "riscv-ite" - depends on SOC_FAMILY_RISCV_ITE - -source "soc/riscv/riscv-ite/*/Kconfig.soc" diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt index bf01055ffc3..1079605a2b4 100644 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt @@ -13,8 +13,8 @@ target_include_directories(app PRIVATE zephyr_include_directories( include - ${ZEPHYR_BASE}/soc/riscv/riscv-ite/common - ${ZEPHYR_BASE}/soc/riscv/riscv-ite/it8xxx2 + ${ZEPHYR_BASE}/soc/riscv/ite_ec/common + ${ZEPHYR_BASE}/soc/riscv/ite_ec/it8xxx2 ) target_sources(app diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h index 3372a845aa9..d3c1f7c827e 100644 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include <../soc/riscv/riscv-ite/common/chip_chipregs.h> +#include <../soc/riscv/ite_ec/common/chip_chipregs.h> /* * Macros for emulated hardware registers access. From 953a23809ec29ae6f4785d941467c840864bd6a3 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 15:40:52 +0100 Subject: [PATCH 0274/2300] [nrf fromtree] soc: riscv: s/litex-vexriscv/litex_vexriscv To be consistent with other SoCs in the same folder. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 7a44806a53e74b7720382298afcd502dd5912782) (cherry picked from commit d64f09a6a52abeeef13f5b7dd3cd90eb2dcfea2d) --- soc/riscv/{litex-vexriscv => litex_vexriscv}/CMakeLists.txt | 0 soc/riscv/{litex-vexriscv => litex_vexriscv}/Kconfig.defconfig | 2 +- soc/riscv/{litex-vexriscv => litex_vexriscv}/Kconfig.soc | 0 soc/riscv/{litex-vexriscv => litex_vexriscv}/soc.h | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename soc/riscv/{litex-vexriscv => litex_vexriscv}/CMakeLists.txt (100%) rename soc/riscv/{litex-vexriscv => litex_vexriscv}/Kconfig.defconfig (92%) rename soc/riscv/{litex-vexriscv => litex_vexriscv}/Kconfig.soc (100%) rename soc/riscv/{litex-vexriscv => litex_vexriscv}/soc.h (100%) diff --git a/soc/riscv/litex-vexriscv/CMakeLists.txt b/soc/riscv/litex_vexriscv/CMakeLists.txt similarity index 100% rename from soc/riscv/litex-vexriscv/CMakeLists.txt rename to soc/riscv/litex_vexriscv/CMakeLists.txt diff --git a/soc/riscv/litex-vexriscv/Kconfig.defconfig b/soc/riscv/litex_vexriscv/Kconfig.defconfig similarity index 92% rename from soc/riscv/litex-vexriscv/Kconfig.defconfig rename to soc/riscv/litex_vexriscv/Kconfig.defconfig index 9447948b567..3efdf200ee7 100644 --- a/soc/riscv/litex-vexriscv/Kconfig.defconfig +++ b/soc/riscv/litex_vexriscv/Kconfig.defconfig @@ -4,7 +4,7 @@ if SOC_RISCV32_LITEX_VEXRISCV config SOC - default "litex-vexriscv" + default "litex_vexriscv" config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 diff --git a/soc/riscv/litex-vexriscv/Kconfig.soc b/soc/riscv/litex_vexriscv/Kconfig.soc similarity index 100% rename from soc/riscv/litex-vexriscv/Kconfig.soc rename to soc/riscv/litex_vexriscv/Kconfig.soc diff --git a/soc/riscv/litex-vexriscv/soc.h b/soc/riscv/litex_vexriscv/soc.h similarity index 100% rename from soc/riscv/litex-vexriscv/soc.h rename to soc/riscv/litex_vexriscv/soc.h From cd7e000c74a7f4356b7960308f13d1ebea0b6381 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 15:50:51 +0100 Subject: [PATCH 0275/2300] [nrf fromtree] soc: riscv: neorv32: reorganize SoC folder Move out of riscv-privileged and convert to a standalone SoC. Note that the family/series structure has been dropped in favor of a single SoC (what NEORV32 seems to be). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit b7b19b8b05d23406358d721f325715fccb39f330) (cherry picked from commit a6b1be1a2db484ed1aaf8f4378653e76c71ee6a6) --- boards/riscv/neorv32/Kconfig.board | 2 +- boards/riscv/neorv32/neorv32_defconfig | 2 +- .../neorv32/CMakeLists.txt | 0 .../Kconfig.defconfig} | 6 ++-- .../Kconfig.series => neorv32/Kconfig.soc} | 27 +++++++++++++++- .../{riscv-privileged => }/neorv32/linker.ld | 0 .../{riscv-privileged => }/neorv32/reset.S | 0 .../{riscv-privileged => }/neorv32/soc.c | 0 .../{riscv-privileged => }/neorv32/soc.h | 0 .../{riscv-privileged => }/neorv32/soc_irq.S | 0 .../riscv-privileged/neorv32/Kconfig.soc | 32 ------------------- 11 files changed, 31 insertions(+), 38 deletions(-) rename soc/riscv/{riscv-privileged => }/neorv32/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged/neorv32/Kconfig.defconfig.series => neorv32/Kconfig.defconfig} (88%) rename soc/riscv/{riscv-privileged/neorv32/Kconfig.series => neorv32/Kconfig.soc} (56%) rename soc/riscv/{riscv-privileged => }/neorv32/linker.ld (100%) rename soc/riscv/{riscv-privileged => }/neorv32/reset.S (100%) rename soc/riscv/{riscv-privileged => }/neorv32/soc.c (100%) rename soc/riscv/{riscv-privileged => }/neorv32/soc.h (100%) rename soc/riscv/{riscv-privileged => }/neorv32/soc_irq.S (100%) delete mode 100644 soc/riscv/riscv-privileged/neorv32/Kconfig.soc diff --git a/boards/riscv/neorv32/Kconfig.board b/boards/riscv/neorv32/Kconfig.board index eee37f4a8c3..6d85ebb2e40 100644 --- a/boards/riscv/neorv32/Kconfig.board +++ b/boards/riscv/neorv32/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_NEORV32 bool "NEORV32 Processor (SoC)" - depends on SOC_SERIES_NEORV32 + depends on SOC_NEORV32 diff --git a/boards/riscv/neorv32/neorv32_defconfig b/boards/riscv/neorv32/neorv32_defconfig index 17e9b8038ce..7dc8a74ffff 100644 --- a/boards/riscv/neorv32/neorv32_defconfig +++ b/boards/riscv/neorv32/neorv32_defconfig @@ -1,7 +1,7 @@ # Copyright (c) 2021 Henrik Brix Andersen # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_NEORV32=y +CONFIG_SOC_NEORV32=y CONFIG_SOC_NEORV32_ISA_C=y CONFIG_BOARD_NEORV32=y CONFIG_SERIAL=y diff --git a/soc/riscv/riscv-privileged/neorv32/CMakeLists.txt b/soc/riscv/neorv32/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/neorv32/CMakeLists.txt rename to soc/riscv/neorv32/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/neorv32/Kconfig.defconfig.series b/soc/riscv/neorv32/Kconfig.defconfig similarity index 88% rename from soc/riscv/riscv-privileged/neorv32/Kconfig.defconfig.series rename to soc/riscv/neorv32/Kconfig.defconfig index 11bd7ef7d33..86aed551f5d 100644 --- a/soc/riscv/riscv-privileged/neorv32/Kconfig.defconfig.series +++ b/soc/riscv/neorv32/Kconfig.defconfig @@ -1,9 +1,9 @@ # Copyright (c) 2021 Henrik Brix Andersen # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_NEORV32 +if SOC_NEORV32 -config SOC_SERIES +config SOC default "neorv32" config SYS_CLOCK_HW_CYCLES_PER_SEC @@ -29,4 +29,4 @@ config ENTROPY_INIT_PRIORITY default 55 depends on ENTROPY_GENERATOR -endif # SOC_SERIES_NEORV32 +endif # SOC_NEORV32 diff --git a/soc/riscv/riscv-privileged/neorv32/Kconfig.series b/soc/riscv/neorv32/Kconfig.soc similarity index 56% rename from soc/riscv/riscv-privileged/neorv32/Kconfig.series rename to soc/riscv/neorv32/Kconfig.soc index 0f8f9ca8fd4..f07bba96574 100644 --- a/soc/riscv/riscv-privileged/neorv32/Kconfig.series +++ b/soc/riscv/neorv32/Kconfig.soc @@ -1,7 +1,7 @@ # Copyright (c) 2021 Henrik Brix Andersen # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_NEORV32 +config SOC_NEORV32 bool "NEORV32 Processor" select RISCV select RISCV_ISA_RV32I @@ -10,6 +10,7 @@ config SOC_SERIES_NEORV32 select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE help Enable support for the NEORV32 Processor (SoC). @@ -24,3 +25,27 @@ config SOC_SERIES_NEORV32 - E (Embedded, only 16 integer registers) - Zbb (Basic Bit Manipulation) - Zfinx (Floating Point in Integer Registers) + +if SOC_NEORV32 + +config SOC_NEORV32_V1_8_6 + bool "v1.8.6" + # NEORV32 RISC-V ISA A extension implements only LR/SC, not AMO + select ATOMIC_OPERATIONS_C + +config SOC_NEORV32_VERSION + hex + default 0x01080600 if SOC_NEORV32_V1_8_6 + help + The targeted NEORV32 version as BCD-coded number. The format is + identical to that of the NEORV32 Machine implementation ID (mimpid) + register. + +config SOC_NEORV32_ISA_C + bool "RISC-V ISA Extension \"C\"" + select RISCV_ISA_EXT_C + help + Enable this if the NEORV32 CPU implementation supports the RISC-V ISA + "C" extension (Compressed Instructions). + +endif # SOC_NEORV32 diff --git a/soc/riscv/riscv-privileged/neorv32/linker.ld b/soc/riscv/neorv32/linker.ld similarity index 100% rename from soc/riscv/riscv-privileged/neorv32/linker.ld rename to soc/riscv/neorv32/linker.ld diff --git a/soc/riscv/riscv-privileged/neorv32/reset.S b/soc/riscv/neorv32/reset.S similarity index 100% rename from soc/riscv/riscv-privileged/neorv32/reset.S rename to soc/riscv/neorv32/reset.S diff --git a/soc/riscv/riscv-privileged/neorv32/soc.c b/soc/riscv/neorv32/soc.c similarity index 100% rename from soc/riscv/riscv-privileged/neorv32/soc.c rename to soc/riscv/neorv32/soc.c diff --git a/soc/riscv/riscv-privileged/neorv32/soc.h b/soc/riscv/neorv32/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/neorv32/soc.h rename to soc/riscv/neorv32/soc.h diff --git a/soc/riscv/riscv-privileged/neorv32/soc_irq.S b/soc/riscv/neorv32/soc_irq.S similarity index 100% rename from soc/riscv/riscv-privileged/neorv32/soc_irq.S rename to soc/riscv/neorv32/soc_irq.S diff --git a/soc/riscv/riscv-privileged/neorv32/Kconfig.soc b/soc/riscv/riscv-privileged/neorv32/Kconfig.soc deleted file mode 100644 index 93c9da8cc3d..00000000000 --- a/soc/riscv/riscv-privileged/neorv32/Kconfig.soc +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2021 Henrik Brix Andersen -# SPDX-License-Identifier: Apache-2.0 - -choice - prompt "NEORV32 Version" - depends on SOC_SERIES_NEORV32 - -config SOC_NEORV32_V1_8_6 - bool "v1.8.6" - # NEORV32 RISC-V ISA A extension implements only LR/SC, not AMO - select ATOMIC_OPERATIONS_C - -endchoice - -if SOC_SERIES_NEORV32 - -config SOC_NEORV32_VERSION - hex - default 0x01080600 if SOC_NEORV32_V1_8_6 - help - The targeted NEORV32 version as BCD-coded number. The format is - identical to that of the NEORV32 Machine implementation ID (mimpid) - register. - -config SOC_NEORV32_ISA_C - bool "RISC-V ISA Extension \"C\"" - select RISCV_ISA_EXT_C - help - Enable this if the NEORV32 CPU implementation supports the RISC-V ISA - "C" extension (Compressed Instructions). - -endif # SOC_SERIES_NEORV32 From 07f0ae103e5e1f6b4e405a8b1300cbcdfe2a8328 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 15:57:37 +0100 Subject: [PATCH 0276/2300] [nrf fromtree] soc: riscv: virt: reorganize SoC folder Move out of riscv-privileged, and convert to single SoC (no family/series). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 7da6342dff4a3ff62de02e15a8c9959bef7d46a1) (cherry picked from commit bea9968589b410489829c758ad5a7309c154800a) --- boards/riscv/qemu_riscv32/qemu_riscv32_defconfig | 1 - boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig | 1 - boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig | 1 - boards/riscv/qemu_riscv64/qemu_riscv64_defconfig | 1 - boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig | 1 - soc/riscv/riscv-privileged/virt/Kconfig.series | 7 ------- soc/riscv/{riscv-privileged => }/virt/CMakeLists.txt | 0 .../Kconfig.defconfig.series => virt/Kconfig.defconfig} | 4 ++-- soc/riscv/{riscv-privileged => }/virt/Kconfig.soc | 9 +++------ soc/riscv/{riscv-privileged => }/virt/soc.c | 0 soc/riscv/{riscv-privileged => }/virt/soc.h | 0 11 files changed, 5 insertions(+), 20 deletions(-) delete mode 100644 soc/riscv/riscv-privileged/virt/Kconfig.series rename soc/riscv/{riscv-privileged => }/virt/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged/virt/Kconfig.defconfig.series => virt/Kconfig.defconfig} (91%) rename soc/riscv/{riscv-privileged => }/virt/Kconfig.soc (75%) rename soc/riscv/{riscv-privileged => }/virt/soc.c (100%) rename soc/riscv/{riscv-privileged => }/virt/soc.h (100%) diff --git a/boards/riscv/qemu_riscv32/qemu_riscv32_defconfig b/boards/riscv/qemu_riscv32/qemu_riscv32_defconfig index f50d82dcb76..946e679a6e8 100644 --- a/boards/riscv/qemu_riscv32/qemu_riscv32_defconfig +++ b/boards/riscv/qemu_riscv32/qemu_riscv32_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV32=y CONFIG_CONSOLE=y diff --git a/boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig b/boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig index eef7d03e356..90f87ef6b98 100644 --- a/boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig +++ b/boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV32_SMP=y CONFIG_CONSOLE=y diff --git a/boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig b/boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig index ef4d6273cfb..1f1c46acb10 100644 --- a/boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig +++ b/boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV32E=y CONFIG_CONSOLE=y diff --git a/boards/riscv/qemu_riscv64/qemu_riscv64_defconfig b/boards/riscv/qemu_riscv64/qemu_riscv64_defconfig index 6f51da3c592..6bfc46ac907 100644 --- a/boards/riscv/qemu_riscv64/qemu_riscv64_defconfig +++ b/boards/riscv/qemu_riscv64/qemu_riscv64_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV64=y CONFIG_PRIVILEGED_STACK_SIZE=2048 diff --git a/boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig b/boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig index 78b5b74de9a..265d84a1ded 100644 --- a/boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig +++ b/boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV64_SMP=y CONFIG_PRIVILEGED_STACK_SIZE=2048 diff --git a/soc/riscv/riscv-privileged/virt/Kconfig.series b/soc/riscv/riscv-privileged/virt/Kconfig.series deleted file mode 100644 index 44ec681a308..00000000000 --- a/soc/riscv/riscv-privileged/virt/Kconfig.series +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2020 Cobham Gaisler AB -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_RISCV_VIRT - bool "QEMU RISC-V VirtIO Board" - select RISCV - select RISCV_PRIVILEGED diff --git a/soc/riscv/riscv-privileged/virt/CMakeLists.txt b/soc/riscv/virt/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/virt/CMakeLists.txt rename to soc/riscv/virt/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/virt/Kconfig.defconfig.series b/soc/riscv/virt/Kconfig.defconfig similarity index 91% rename from soc/riscv/riscv-privileged/virt/Kconfig.defconfig.series rename to soc/riscv/virt/Kconfig.defconfig index 231d4519d67..9773586e922 100644 --- a/soc/riscv/riscv-privileged/virt/Kconfig.defconfig.series +++ b/soc/riscv/virt/Kconfig.defconfig @@ -1,9 +1,9 @@ # Copyright (c) 2020 Cobham Gaisler AB # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_RISCV_VIRT +if SOC_RISCV_VIRT -config SOC_SERIES +config SOC default "virt" config SYS_CLOCK_HW_CYCLES_PER_SEC diff --git a/soc/riscv/riscv-privileged/virt/Kconfig.soc b/soc/riscv/virt/Kconfig.soc similarity index 75% rename from soc/riscv/riscv-privileged/virt/Kconfig.soc rename to soc/riscv/virt/Kconfig.soc index 35a2853eb50..fb615005b0a 100644 --- a/soc/riscv/riscv-privileged/virt/Kconfig.soc +++ b/soc/riscv/virt/Kconfig.soc @@ -1,10 +1,6 @@ # Copyright (c) 2020 Cobham Gaisler AB # SPDX-License-Identifier: Apache-2.0 -choice - prompt "QEMU RISC-V VirtIO Board" - depends on SOC_SERIES_RISCV_VIRT - config SOC_RISCV_VIRT bool "QEMU RISC-V VirtIO Board" select ATOMIC_OPERATIONS_BUILTIN @@ -12,5 +8,6 @@ config SOC_RISCV_VIRT select RISCV_ISA_EXT_M select RISCV_ISA_EXT_A select RISCV_ISA_EXT_C - -endchoice + select RISCV + select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE diff --git a/soc/riscv/riscv-privileged/virt/soc.c b/soc/riscv/virt/soc.c similarity index 100% rename from soc/riscv/riscv-privileged/virt/soc.c rename to soc/riscv/virt/soc.c diff --git a/soc/riscv/riscv-privileged/virt/soc.h b/soc/riscv/virt/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/virt/soc.h rename to soc/riscv/virt/soc.h From 3b27f84a0d1f6c122cb762a72bac2ead7ffd9323 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 16:04:26 +0100 Subject: [PATCH 0277/2300] [nrf fromtree] soc: riscv: efinix-sapphire: reorganize SoC folder Move things out from riscv-privileged, and convert to single SoC. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 4c4beabecc3cb4eb80aae32e590a2fe21c84bd6a) (cherry picked from commit c9cf4960df274f909610f607015e6404961d71ee) --- boards/riscv/titanium_ti60_f225/Kconfig.board | 2 +- .../titanium_ti60_f225/titanium_ti60_f225_defconfig | 2 +- .../CMakeLists.txt | 0 .../Kconfig.defconfig} | 8 ++++---- .../efinix-sapphire => efinix_sapphire}/Kconfig.soc | 11 ++++------- .../efinix-sapphire => efinix_sapphire}/soc.h | 0 .../riscv-privileged/efinix-sapphire/Kconfig.series | 9 --------- 7 files changed, 10 insertions(+), 22 deletions(-) rename soc/riscv/{riscv-privileged/efinix-sapphire => efinix_sapphire}/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged/efinix-sapphire/Kconfig.defconfig.series => efinix_sapphire/Kconfig.defconfig} (74%) rename soc/riscv/{riscv-privileged/efinix-sapphire => efinix_sapphire}/Kconfig.soc (72%) rename soc/riscv/{riscv-privileged/efinix-sapphire => efinix_sapphire}/soc.h (100%) delete mode 100644 soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series diff --git a/boards/riscv/titanium_ti60_f225/Kconfig.board b/boards/riscv/titanium_ti60_f225/Kconfig.board index d6ed41ffc79..bac70816b20 100644 --- a/boards/riscv/titanium_ti60_f225/Kconfig.board +++ b/boards/riscv/titanium_ti60_f225/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_TITANIUM_TI60_F225 bool "Board with Efinix Sapphire riscv SoC" - depends on SOC_SERIES_EFINIX_SAPPHIRE + depends on SOC_EFINIX_SAPPHIRE diff --git a/boards/riscv/titanium_ti60_f225/titanium_ti60_f225_defconfig b/boards/riscv/titanium_ti60_f225/titanium_ti60_f225_defconfig index 096980b864e..0608a8e8953 100644 --- a/boards/riscv/titanium_ti60_f225/titanium_ti60_f225_defconfig +++ b/boards/riscv/titanium_ti60_f225/titanium_ti60_f225_defconfig @@ -1,7 +1,7 @@ # Copyright (c) 2023 Efinix Inc. # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_EFINIX_SAPPHIRE=y +CONFIG_SOC_EFINIX_SAPPHIRE=y CONFIG_BOARD_TITANIUM_TI60_F225=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/soc/riscv/riscv-privileged/efinix-sapphire/CMakeLists.txt b/soc/riscv/efinix_sapphire/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/efinix-sapphire/CMakeLists.txt rename to soc/riscv/efinix_sapphire/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.defconfig.series b/soc/riscv/efinix_sapphire/Kconfig.defconfig similarity index 74% rename from soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.defconfig.series rename to soc/riscv/efinix_sapphire/Kconfig.defconfig index 233428931a3..5424bca7baf 100644 --- a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.defconfig.series +++ b/soc/riscv/efinix_sapphire/Kconfig.defconfig @@ -1,10 +1,10 @@ # Copyright (c) 2023 Efinix Inc. # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_EFINIX_SAPPHIRE +if SOC_EFINIX_SAPPHIRE -config SOC_SERIES - default "efinix-sapphire" +config SOC + default "efinix_sapphire" config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 @@ -27,4 +27,4 @@ config NUM_IRQS config 2ND_LVL_INTR_00_OFFSET default 11 -endif # SOC_SERIES_EFINIX_SAPPHIRE +endif # SOC_EFINIX_SAPPHIRE diff --git a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.soc b/soc/riscv/efinix_sapphire/Kconfig.soc similarity index 72% rename from soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.soc rename to soc/riscv/efinix_sapphire/Kconfig.soc index dba8491b8bd..2cc5f3ba361 100644 --- a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.soc +++ b/soc/riscv/efinix_sapphire/Kconfig.soc @@ -1,11 +1,7 @@ # Copyright (c) 2023 Efinix Inc. # SPDX-License-Identifier: Apache-2.0 -choice - prompt "Efinix SoC selection" - depends on SOC_SERIES_EFINIX_SAPPHIRE - -config SOC_RISCV32_EFINIX_SAPPHIRE +config SOC_EFINIX_SAPPHIRE bool "Efinix Sapphire VexRiscv system implementation" select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR @@ -14,5 +10,6 @@ config SOC_RISCV32_EFINIX_SAPPHIRE select RISCV_ISA_EXT_A select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI - -endchoice + select RISCV + select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE diff --git a/soc/riscv/riscv-privileged/efinix-sapphire/soc.h b/soc/riscv/efinix_sapphire/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/efinix-sapphire/soc.h rename to soc/riscv/efinix_sapphire/soc.h diff --git a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series deleted file mode 100644 index 421d81a7e33..00000000000 --- a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Efinix Inc. -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_EFINIX_SAPPHIRE - bool "Efinix Sapphire SOC implementation" - select RISCV - select RISCV_PRIVILEGED - help - Enable support for Efinix Sapphire SOC implementation From 2934a5522545b141506929c7e5a3916ac5dd52b7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 16:43:52 +0100 Subject: [PATCH 0278/2300] [nrf fromtree] soc: riscv: miv/mpfs: reorganize SoC folder Merge both series into a new family: microchip_miv [1], moving them out of riscv-privileged. Updated naming to stay closer to what vendor announces on their website. [1]: https://www.microchip.com/en-us/products/fpgas-and-plds/ fpga-and-soc-design-tools/mi-v Signed-off-by: Gerard Marull-Paretas (cherry picked from commit b2b86556a7a381d6f776f1a682ac2b347b20acf9) (cherry picked from commit 448985fca20ff183aab51ad29271056d8091a877) --- boards/riscv/beaglev_fire/Kconfig.board | 2 +- boards/riscv/beaglev_fire/beaglev_fire_defconfig | 4 ++-- boards/riscv/m2gl025_miv/Kconfig.board | 2 +- boards/riscv/m2gl025_miv/m2gl025_miv_defconfig | 4 ++-- boards/riscv/mpfs_icicle/Kconfig.board | 2 +- boards/riscv/mpfs_icicle/mpfs_icicle_defconfig | 4 ++-- soc/riscv/microchip_miv/CMakeLists.txt | 4 ++++ soc/riscv/microchip_miv/Kconfig | 15 +++++++++++++++ soc/riscv/microchip_miv/Kconfig.defconfig | 4 ++++ soc/riscv/microchip_miv/Kconfig.soc | 4 ++++ .../miv/CMakeLists.txt | 0 .../miv/Kconfig.defconfig.series | 4 ++-- .../miv/Kconfig.series | 4 +++- .../miv/Kconfig.soc | 4 ++-- .../{riscv-privileged => microchip_miv}/miv/soc.h | 0 .../polarfire}/CMakeLists.txt | 0 .../polarfire}/Kconfig.defconfig.series | 6 +++--- .../polarfire}/Kconfig.series | 4 +++- .../mpfs => microchip_miv/polarfire}/Kconfig.soc | 6 +++--- .../mpfs => microchip_miv/polarfire}/soc.h | 0 20 files changed, 52 insertions(+), 21 deletions(-) create mode 100644 soc/riscv/microchip_miv/CMakeLists.txt create mode 100644 soc/riscv/microchip_miv/Kconfig create mode 100644 soc/riscv/microchip_miv/Kconfig.defconfig create mode 100644 soc/riscv/microchip_miv/Kconfig.soc rename soc/riscv/{riscv-privileged => microchip_miv}/miv/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged => microchip_miv}/miv/Kconfig.defconfig.series (88%) rename soc/riscv/{riscv-privileged => microchip_miv}/miv/Kconfig.series (72%) rename soc/riscv/{riscv-privileged => microchip_miv}/miv/Kconfig.soc (88%) rename soc/riscv/{riscv-privileged => microchip_miv}/miv/soc.h (100%) rename soc/riscv/{riscv-privileged/mpfs => microchip_miv/polarfire}/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged/mpfs => microchip_miv/polarfire}/Kconfig.defconfig.series (89%) rename soc/riscv/{riscv-privileged/mpfs => microchip_miv/polarfire}/Kconfig.series (71%) rename soc/riscv/{riscv-privileged/mpfs => microchip_miv/polarfire}/Kconfig.soc (89%) rename soc/riscv/{riscv-privileged/mpfs => microchip_miv/polarfire}/soc.h (100%) diff --git a/boards/riscv/beaglev_fire/Kconfig.board b/boards/riscv/beaglev_fire/Kconfig.board index 1984bb05c09..55b59d4ac92 100644 --- a/boards/riscv/beaglev_fire/Kconfig.board +++ b/boards/riscv/beaglev_fire/Kconfig.board @@ -3,7 +3,7 @@ config BOARD_BEAGLEV_FIRE bool "Beagleboard BeagleV-Fire" - depends on SOC_MPFS + depends on SOC_POLARFIRE select 64BIT select SCHED_IPI_SUPPORTED select CPU_HAS_FPU_DOUBLE_PRECISION diff --git a/boards/riscv/beaglev_fire/beaglev_fire_defconfig b/boards/riscv/beaglev_fire/beaglev_fire_defconfig index a60ed8c1691..3b264d6c288 100644 --- a/boards/riscv/beaglev_fire/beaglev_fire_defconfig +++ b/boards/riscv/beaglev_fire/beaglev_fire_defconfig @@ -1,8 +1,8 @@ # Copyright (c) 2023 Microchip Technology Inc # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV64_MIV=y -CONFIG_SOC_MPFS=y +CONFIG_SOC_SERIES_POLARFIRE=y +CONFIG_SOC_POLARFIRE=y CONFIG_MPFS_HAL=n CONFIG_BASE64=y CONFIG_INCLUDE_RESET_VECTOR=y diff --git a/boards/riscv/m2gl025_miv/Kconfig.board b/boards/riscv/m2gl025_miv/Kconfig.board index 51c2f9d8de3..9f81fad406f 100644 --- a/boards/riscv/m2gl025_miv/Kconfig.board +++ b/boards/riscv/m2gl025_miv/Kconfig.board @@ -2,4 +2,4 @@ config BOARD_M2GL025_MIV bool "Microchip M2GL025 IGLOO2 dev board with Mi-V CPU" - depends on SOC_RISCV32_MIV + depends on SOC_MIV diff --git a/boards/riscv/m2gl025_miv/m2gl025_miv_defconfig b/boards/riscv/m2gl025_miv/m2gl025_miv_defconfig index 8c944a10a74..e33765680d5 100644 --- a/boards/riscv/m2gl025_miv/m2gl025_miv_defconfig +++ b/boards/riscv/m2gl025_miv/m2gl025_miv_defconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV32_MIV=y -CONFIG_SOC_RISCV32_MIV=y +CONFIG_SOC_SERIES_MIV=y +CONFIG_SOC_MIV=y CONFIG_BOARD_M2GL025_MIV=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/riscv/mpfs_icicle/Kconfig.board b/boards/riscv/mpfs_icicle/Kconfig.board index 297f4ce4bc7..e772b82d7f5 100644 --- a/boards/riscv/mpfs_icicle/Kconfig.board +++ b/boards/riscv/mpfs_icicle/Kconfig.board @@ -3,7 +3,7 @@ config BOARD_MPFS_ICICLE bool "Microchip PolarFire SoC ICICLE kit" - depends on SOC_MPFS + depends on SOC_POLARFIRE select 64BIT select SCHED_IPI_SUPPORTED select CPU_HAS_FPU_DOUBLE_PRECISION diff --git a/boards/riscv/mpfs_icicle/mpfs_icicle_defconfig b/boards/riscv/mpfs_icicle/mpfs_icicle_defconfig index 5c41649cb3e..00b44f7a6d5 100644 --- a/boards/riscv/mpfs_icicle/mpfs_icicle_defconfig +++ b/boards/riscv/mpfs_icicle/mpfs_icicle_defconfig @@ -1,8 +1,8 @@ # Copyright (c) 2020-2021 Microchip Technology Inc # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV64_MIV=y -CONFIG_SOC_MPFS=y +CONFIG_SOC_SERIES_POLARFIRE=y +CONFIG_SOC_POLARFIRE=y CONFIG_MPFS_HAL=n CONFIG_BASE64=y CONFIG_INCLUDE_RESET_VECTOR=y diff --git a/soc/riscv/microchip_miv/CMakeLists.txt b/soc/riscv/microchip_miv/CMakeLists.txt new file mode 100644 index 00000000000..69b2926358e --- /dev/null +++ b/soc/riscv/microchip_miv/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/microchip_miv/Kconfig b/soc/riscv/microchip_miv/Kconfig new file mode 100644 index 00000000000..46616636aa1 --- /dev/null +++ b/soc/riscv/microchip_miv/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_MICROCHIP_MIV + bool + +if SOC_FAMILY_MICROCHIP_MIV + +config SOC_FAMILY + string + default "microchip_miv" + +source "soc/riscv/microchip_miv/*/Kconfig.soc" + +endif # SOC_FAMILY_MICROCHIP_MIV diff --git a/soc/riscv/microchip_miv/Kconfig.defconfig b/soc/riscv/microchip_miv/Kconfig.defconfig new file mode 100644 index 00000000000..2fe508bddba --- /dev/null +++ b/soc/riscv/microchip_miv/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/microchip_miv/*/Kconfig.defconfig.series" diff --git a/soc/riscv/microchip_miv/Kconfig.soc b/soc/riscv/microchip_miv/Kconfig.soc new file mode 100644 index 00000000000..8677f1ba448 --- /dev/null +++ b/soc/riscv/microchip_miv/Kconfig.soc @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/microchip_miv/*/Kconfig.series" diff --git a/soc/riscv/riscv-privileged/miv/CMakeLists.txt b/soc/riscv/microchip_miv/miv/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/miv/CMakeLists.txt rename to soc/riscv/microchip_miv/miv/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/miv/Kconfig.defconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series similarity index 88% rename from soc/riscv/riscv-privileged/miv/Kconfig.defconfig.series rename to soc/riscv/microchip_miv/miv/Kconfig.defconfig.series index 81b224ed397..ef161321a5b 100644 --- a/soc/riscv/riscv-privileged/miv/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_RISCV32_MIV +if SOC_SERIES_MIV config SOC_SERIES default "miv" @@ -32,4 +32,4 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 42 -endif # SOC_SERIES_RISCV32_MIV +endif # SOC_SERIES_MIV diff --git a/soc/riscv/riscv-privileged/miv/Kconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.series similarity index 72% rename from soc/riscv/riscv-privileged/miv/Kconfig.series rename to soc/riscv/microchip_miv/miv/Kconfig.series index 017de686a94..20430e6d0f9 100644 --- a/soc/riscv/riscv-privileged/miv/Kconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.series @@ -3,9 +3,11 @@ # Copyright (c) 2018 Antmicro # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_RISCV32_MIV +config SOC_SERIES_MIV bool "Microchip Mi-V implementation" + select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE help Enable support for Microchip Mi-V diff --git a/soc/riscv/riscv-privileged/miv/Kconfig.soc b/soc/riscv/microchip_miv/miv/Kconfig.soc similarity index 88% rename from soc/riscv/riscv-privileged/miv/Kconfig.soc rename to soc/riscv/microchip_miv/miv/Kconfig.soc index 189abb6879c..0a48c2e0524 100644 --- a/soc/riscv/riscv-privileged/miv/Kconfig.soc +++ b/soc/riscv/microchip_miv/miv/Kconfig.soc @@ -5,9 +5,9 @@ choice prompt "Microchip Mi-V system implementation" - depends on SOC_SERIES_RISCV32_MIV + depends on SOC_SERIES_MIV -config SOC_RISCV32_MIV +config SOC_MIV bool "Microchip Mi-V system implementation" select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR diff --git a/soc/riscv/riscv-privileged/miv/soc.h b/soc/riscv/microchip_miv/miv/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/miv/soc.h rename to soc/riscv/microchip_miv/miv/soc.h diff --git a/soc/riscv/riscv-privileged/mpfs/CMakeLists.txt b/soc/riscv/microchip_miv/polarfire/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/mpfs/CMakeLists.txt rename to soc/riscv/microchip_miv/polarfire/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/mpfs/Kconfig.defconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series similarity index 89% rename from soc/riscv/riscv-privileged/mpfs/Kconfig.defconfig.series rename to soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series index fb9f6d2d3af..0e5629927ae 100644 --- a/soc/riscv/riscv-privileged/mpfs/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series @@ -1,10 +1,10 @@ # Copyright (c) 2020-2021 Microchip Technology Inc # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_RISCV64_MIV +if SOC_SERIES_POLARFIRE config SOC_SERIES - default "mpfs" + default "polarfire" # MPFS should be configured so that the mtimer clock is 1MHz independent of the CPU clock... @@ -38,4 +38,4 @@ config NUM_IRQS # config NO_OPTIMIZATIONS # default y -endif # SOC_SERIES_RISCV64_MIV +endif # SOC_SERIES_POLARFIRE diff --git a/soc/riscv/riscv-privileged/mpfs/Kconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.series similarity index 71% rename from soc/riscv/riscv-privileged/mpfs/Kconfig.series rename to soc/riscv/microchip_miv/polarfire/Kconfig.series index 3b30cd15365..4bbceaee745 100644 --- a/soc/riscv/riscv-privileged/mpfs/Kconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.series @@ -3,9 +3,11 @@ # Copyright (c) 2018 Antmicro # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_RISCV64_MIV +config SOC_SERIES_POLARFIRE bool "Microchip RV64 implementation" + select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE help Enable support for Microchip RISCV 64bit diff --git a/soc/riscv/riscv-privileged/mpfs/Kconfig.soc b/soc/riscv/microchip_miv/polarfire/Kconfig.soc similarity index 89% rename from soc/riscv/riscv-privileged/mpfs/Kconfig.soc rename to soc/riscv/microchip_miv/polarfire/Kconfig.soc index 7f20dc703c2..101e8b4d029 100644 --- a/soc/riscv/riscv-privileged/mpfs/Kconfig.soc +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.soc @@ -5,9 +5,9 @@ choice prompt "Microchip Polarfire SOC implementation" - depends on SOC_SERIES_RISCV64_MIV + depends on SOC_SERIES_POLARFIRE -config SOC_MPFS +config SOC_POLARFIRE bool "Microchip MPFS system implementation" select ATOMIC_OPERATIONS_BUILTIN select RISCV_GP @@ -25,6 +25,6 @@ config SOC_MPFS endchoice config MPFS_HAL - depends on SOC_MPFS + depends on SOC_POLARFIRE bool "Microchip Polarfire SOC hardware abstracton layer" select HAS_MPFS_HAL diff --git a/soc/riscv/riscv-privileged/mpfs/soc.h b/soc/riscv/microchip_miv/polarfire/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/mpfs/soc.h rename to soc/riscv/microchip_miv/polarfire/soc.h From 46b0dae15b5bbfb362e147ac45ce1ba899afb2ba Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 17:26:25 +0100 Subject: [PATCH 0279/2300] [nrf fromtree] soc: riscv: sifive-freedom: reorganize SoC folder Reorganized as follows: - Created a new SiFive Freedom family - Created 3 new series: E300/E500/E700 - Created Socs within each series (e.g. E340) Also moved out of riscv-privileged folder. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 38a44e683eaa92c642b5aaa59fe3f10a3ac28941) (cherry picked from commit 36ce51fee3661211976ea2e205a4d85fc5bf2499) --- boards/riscv/hifive1/Kconfig.board | 2 +- boards/riscv/hifive1/hifive1_defconfig | 4 +- boards/riscv/hifive1_revb/Kconfig.board | 2 +- .../riscv/hifive1_revb/hifive1_revb_defconfig | 4 +- boards/riscv/hifive_unleashed/Kconfig.board | 2 +- .../hifive_unleashed_defconfig | 4 +- boards/riscv/hifive_unmatched/Kconfig.board | 2 +- .../hifive_unmatched_defconfig | 4 +- boards/riscv/qemu_riscv32/Kconfig.board | 2 +- .../qemu_riscv32/qemu_riscv32_xip_defconfig | 4 +- .../sparkfun_red_v_things_plus/Kconfig.board | 2 +- .../sparkfun_red_v_things_plus_defconfig | 4 +- .../sifive-freedom/CMakeLists.txt | 8 ---- .../sifive-freedom/Kconfig.series | 11 ----- .../sifive-freedom/Kconfig.soc | 44 ------------------- soc/riscv/sifive_freedom/CMakeLists.txt | 5 +++ soc/riscv/sifive_freedom/Kconfig | 15 +++++++ soc/riscv/sifive_freedom/Kconfig.defconfig | 4 ++ soc/riscv/sifive_freedom/Kconfig.soc | 4 ++ .../sifive_freedom/common/CMakeLists.txt | 3 ++ .../common}/pinctrl_soc.h | 0 soc/riscv/sifive_freedom/e300/CMakeLists.txt | 5 +++ .../e300/Kconfig.defconfig.e340 | 5 +++ .../e300}/Kconfig.defconfig.series | 9 ++-- soc/riscv/sifive_freedom/e300/Kconfig.series | 13 ++++++ soc/riscv/sifive_freedom/e300/Kconfig.soc | 20 +++++++++ .../e300/clock.c} | 2 +- .../e300/prci.h} | 0 .../e300}/soc.h | 27 ++---------- soc/riscv/sifive_freedom/u500/CMakeLists.txt | 5 +++ .../u500/Kconfig.defconfig.series | 38 ++++++++++++++++ .../u500/Kconfig.defconfig.u540 | 5 +++ soc/riscv/sifive_freedom/u500/Kconfig.series | 13 ++++++ soc/riscv/sifive_freedom/u500/Kconfig.soc | 22 ++++++++++ .../u500/clock.c} | 2 +- .../u500/prci.h} | 0 soc/riscv/sifive_freedom/u500/soc.h | 32 ++++++++++++++ soc/riscv/sifive_freedom/u700/CMakeLists.txt | 5 +++ .../u700/Kconfig.defconfig.series | 38 ++++++++++++++++ .../u700/Kconfig.defconfig.u740 | 5 +++ soc/riscv/sifive_freedom/u700/Kconfig.series | 13 ++++++ soc/riscv/sifive_freedom/u700/Kconfig.soc | 22 ++++++++++ .../u700/clock.c} | 2 +- .../u700/prci.h} | 0 soc/riscv/sifive_freedom/u700/soc.h | 26 +++++++++++ 45 files changed, 328 insertions(+), 111 deletions(-) delete mode 100644 soc/riscv/riscv-privileged/sifive-freedom/CMakeLists.txt delete mode 100644 soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series delete mode 100644 soc/riscv/riscv-privileged/sifive-freedom/Kconfig.soc create mode 100644 soc/riscv/sifive_freedom/CMakeLists.txt create mode 100644 soc/riscv/sifive_freedom/Kconfig create mode 100644 soc/riscv/sifive_freedom/Kconfig.defconfig create mode 100644 soc/riscv/sifive_freedom/Kconfig.soc create mode 100644 soc/riscv/sifive_freedom/common/CMakeLists.txt rename soc/riscv/{riscv-privileged/sifive-freedom => sifive_freedom/common}/pinctrl_soc.h (100%) create mode 100644 soc/riscv/sifive_freedom/e300/CMakeLists.txt create mode 100644 soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e340 rename soc/riscv/{riscv-privileged/sifive-freedom => sifive_freedom/e300}/Kconfig.defconfig.series (65%) create mode 100644 soc/riscv/sifive_freedom/e300/Kconfig.series create mode 100644 soc/riscv/sifive_freedom/e300/Kconfig.soc rename soc/riscv/{riscv-privileged/sifive-freedom/fe310_clock.c => sifive_freedom/e300/clock.c} (98%) rename soc/riscv/{riscv-privileged/sifive-freedom/fe310_prci.h => sifive_freedom/e300/prci.h} (100%) rename soc/riscv/{riscv-privileged/sifive-freedom => sifive_freedom/e300}/soc.h (52%) create mode 100644 soc/riscv/sifive_freedom/u500/CMakeLists.txt create mode 100644 soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series create mode 100644 soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u540 create mode 100644 soc/riscv/sifive_freedom/u500/Kconfig.series create mode 100644 soc/riscv/sifive_freedom/u500/Kconfig.soc rename soc/riscv/{riscv-privileged/sifive-freedom/fu540_clock.c => sifive_freedom/u500/clock.c} (97%) rename soc/riscv/{riscv-privileged/sifive-freedom/fu540_prci.h => sifive_freedom/u500/prci.h} (100%) create mode 100644 soc/riscv/sifive_freedom/u500/soc.h create mode 100644 soc/riscv/sifive_freedom/u700/CMakeLists.txt create mode 100644 soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series create mode 100644 soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u740 create mode 100644 soc/riscv/sifive_freedom/u700/Kconfig.series create mode 100644 soc/riscv/sifive_freedom/u700/Kconfig.soc rename soc/riscv/{riscv-privileged/sifive-freedom/fu740_clock.c => sifive_freedom/u700/clock.c} (99%) rename soc/riscv/{riscv-privileged/sifive-freedom/fu740_prci.h => sifive_freedom/u700/prci.h} (100%) create mode 100644 soc/riscv/sifive_freedom/u700/soc.h diff --git a/boards/riscv/hifive1/Kconfig.board b/boards/riscv/hifive1/Kconfig.board index b5b32649441..d2f40472f24 100644 --- a/boards/riscv/hifive1/Kconfig.board +++ b/boards/riscv/hifive1/Kconfig.board @@ -2,4 +2,4 @@ config BOARD_HIFIVE1 bool "HiFive1 target" - depends on SOC_RISCV_SIFIVE_FREEDOM + depends on SOC_SIFIVE_FREEDOM_E340 diff --git a/boards/riscv/hifive1/hifive1_defconfig b/boards/riscv/hifive1/hifive1_defconfig index d37ded2bb25..8e4e8e21c1a 100644 --- a/boards/riscv/hifive1/hifive1_defconfig +++ b/boards/riscv/hifive1/hifive1_defconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y -CONFIG_SOC_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_SERIES_SIFIVE_FREEDOM_E300=y +CONFIG_SOC_SIFIVE_FREEDOM_E340=y CONFIG_BOARD_HIFIVE1=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/riscv/hifive1_revb/Kconfig.board b/boards/riscv/hifive1_revb/Kconfig.board index d4c5b99ce72..b0bf1edd156 100644 --- a/boards/riscv/hifive1_revb/Kconfig.board +++ b/boards/riscv/hifive1_revb/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_HIFIVE1_REVB bool "HiFive1 Rev B target" - depends on SOC_RISCV_SIFIVE_FREEDOM + depends on SOC_SIFIVE_FREEDOM_E340 diff --git a/boards/riscv/hifive1_revb/hifive1_revb_defconfig b/boards/riscv/hifive1_revb/hifive1_revb_defconfig index 4f691bd9435..b2119eecae9 100644 --- a/boards/riscv/hifive1_revb/hifive1_revb_defconfig +++ b/boards/riscv/hifive1_revb/hifive1_revb_defconfig @@ -1,5 +1,5 @@ -CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y -CONFIG_SOC_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_SERIES_SIFIVE_FREEDOM_E300=y +CONFIG_SOC_SIFIVE_FREEDOM_E340=y CONFIG_BOARD_HIFIVE1_REVB=y CONFIG_GPIO=y CONFIG_PINCTRL=y diff --git a/boards/riscv/hifive_unleashed/Kconfig.board b/boards/riscv/hifive_unleashed/Kconfig.board index 4766e0ea792..f6c623e9928 100644 --- a/boards/riscv/hifive_unleashed/Kconfig.board +++ b/boards/riscv/hifive_unleashed/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_HIFIVE_UNLEASHED bool "HiFive Unleashed target" - depends on SOC_RISCV_SIFIVE_FU540 + depends on SOC_SIFIVE_FREEDOM_U540 diff --git a/boards/riscv/hifive_unleashed/hifive_unleashed_defconfig b/boards/riscv/hifive_unleashed/hifive_unleashed_defconfig index 15c9e60d552..51d324d457d 100644 --- a/boards/riscv/hifive_unleashed/hifive_unleashed_defconfig +++ b/boards/riscv/hifive_unleashed/hifive_unleashed_defconfig @@ -1,5 +1,5 @@ -CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y -CONFIG_SOC_RISCV_SIFIVE_FU540=y +CONFIG_SOC_SERIES_SIFIVE_FREEDOM_U500=y +CONFIG_SOC_SIFIVE_FREEDOM_U540=y CONFIG_BOARD_HIFIVE_UNLEASHED=y CONFIG_CONSOLE=y CONFIG_GPIO=y diff --git a/boards/riscv/hifive_unmatched/Kconfig.board b/boards/riscv/hifive_unmatched/Kconfig.board index cf6ac1c8392..bb303cc3aac 100644 --- a/boards/riscv/hifive_unmatched/Kconfig.board +++ b/boards/riscv/hifive_unmatched/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_HIFIVE_UNMATCHED bool "HiFive Unmatched target" - depends on SOC_RISCV_SIFIVE_FU740 + depends on SOC_SIFIVE_FREEDOM_U740 diff --git a/boards/riscv/hifive_unmatched/hifive_unmatched_defconfig b/boards/riscv/hifive_unmatched/hifive_unmatched_defconfig index 654fdc1bf2a..be13ed10358 100644 --- a/boards/riscv/hifive_unmatched/hifive_unmatched_defconfig +++ b/boards/riscv/hifive_unmatched/hifive_unmatched_defconfig @@ -1,5 +1,5 @@ -CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y -CONFIG_SOC_RISCV_SIFIVE_FU740=y +CONFIG_SOC_SERIES_SIFIVE_FREEDOM_U700=y +CONFIG_SOC_SIFIVE_FREEDOM_U740=y CONFIG_BOARD_HIFIVE_UNMATCHED=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/riscv/qemu_riscv32/Kconfig.board b/boards/riscv/qemu_riscv32/Kconfig.board index 989fa13b453..7c94b59455c 100644 --- a/boards/riscv/qemu_riscv32/Kconfig.board +++ b/boards/riscv/qemu_riscv32/Kconfig.board @@ -22,7 +22,7 @@ config BOARD_QEMU_RISCV32_SMP config BOARD_QEMU_RISCV32_XIP bool "QEMU RISCV32 XIP target" - depends on SOC_RISCV_SIFIVE_FREEDOM + depends on SOC_SIFIVE_FREEDOM_E340 select QEMU_TARGET select HAS_COVERAGE_SUPPORT select CPU_HAS_FPU diff --git a/boards/riscv/qemu_riscv32/qemu_riscv32_xip_defconfig b/boards/riscv/qemu_riscv32/qemu_riscv32_xip_defconfig index 2cd0b2cbecb..948fa909a08 100644 --- a/boards/riscv/qemu_riscv32/qemu_riscv32_xip_defconfig +++ b/boards/riscv/qemu_riscv32/qemu_riscv32_xip_defconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y -CONFIG_SOC_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_SERIES_SIFIVE_FREEDOM_E300=y +CONFIG_SOC_SIFIVE_FREEDOM_E340=y CONFIG_BOARD_QEMU_RISCV32_XIP=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/riscv/sparkfun_red_v_things_plus/Kconfig.board b/boards/riscv/sparkfun_red_v_things_plus/Kconfig.board index 34f852dc0ec..cc9e7b4f935 100644 --- a/boards/riscv/sparkfun_red_v_things_plus/Kconfig.board +++ b/boards/riscv/sparkfun_red_v_things_plus/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_SPARKFUN_RED_V_THINGS_PLUS bool "SparkFun RED-V Things Plus board" - depends on SOC_RISCV_SIFIVE_FREEDOM + depends on SOC_SIFIVE_FREEDOM_E340 diff --git a/boards/riscv/sparkfun_red_v_things_plus/sparkfun_red_v_things_plus_defconfig b/boards/riscv/sparkfun_red_v_things_plus/sparkfun_red_v_things_plus_defconfig index de3d18bcfde..8cf24ffbe09 100644 --- a/boards/riscv/sparkfun_red_v_things_plus/sparkfun_red_v_things_plus_defconfig +++ b/boards/riscv/sparkfun_red_v_things_plus/sparkfun_red_v_things_plus_defconfig @@ -1,8 +1,8 @@ # Copyright (c) 2022 TOKITA Hiroshi # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y -CONFIG_SOC_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_SERIES_SIFIVE_FREEDOM_E300=y +CONFIG_SOC_SIFIVE_FREEDOM_E340=y CONFIG_BOARD_SPARKFUN_RED_V_THINGS_PLUS=y CONFIG_GPIO=y CONFIG_PINCTRL=y diff --git a/soc/riscv/riscv-privileged/sifive-freedom/CMakeLists.txt b/soc/riscv/riscv-privileged/sifive-freedom/CMakeLists.txt deleted file mode 100644 index ff4cc56d739..00000000000 --- a/soc/riscv/riscv-privileged/sifive-freedom/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -zephyr_sources() -zephyr_sources_ifdef(CONFIG_SOC_RISCV_SIFIVE_FREEDOM fe310_clock.c) -zephyr_sources_ifdef(CONFIG_SOC_RISCV_SIFIVE_FU540 fu540_clock.c) -zephyr_sources_ifdef(CONFIG_SOC_RISCV_SIFIVE_FU740 fu740_clock.c) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series deleted file mode 100644 index a24b4812c28..00000000000 --- a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series +++ /dev/null @@ -1,11 +0,0 @@ -# RISCV_SIFIVE_FREEDOM SOC implementation - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_RISCV_SIFIVE_FREEDOM - bool "SiFive Freedom SOC implementation" - select RISCV - select RISCV_PRIVILEGED - help - Enable support for SiFive Freedom SOC diff --git a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.soc b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.soc deleted file mode 100644 index 7840f8a09ba..00000000000 --- a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.soc +++ /dev/null @@ -1,44 +0,0 @@ -# RISCV_SIFIVE_FREEDOM SOC configuration options - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -choice - prompt "SiFive Freedom SOC implementation" - depends on SOC_SERIES_RISCV_SIFIVE_FREEDOM - -config SOC_RISCV_SIFIVE_FREEDOM - bool "SiFive Freedom SOC implementation" - select ATOMIC_OPERATIONS_C - select INCLUDE_RESET_VECTOR - select RISCV_ISA_RV32I - select RISCV_ISA_EXT_M - select RISCV_ISA_EXT_A - select RISCV_ISA_EXT_ZICSR - select RISCV_ISA_EXT_ZIFENCEI - -config SOC_RISCV_SIFIVE_FU540 - bool "SiFive Freedom U540 SOC implementation" - select ATOMIC_OPERATIONS_C - select INCLUDE_RESET_VECTOR - select 64BIT - select RISCV_ISA_RV64I - select RISCV_ISA_EXT_M - select RISCV_ISA_EXT_A - select RISCV_ISA_EXT_C - select RISCV_ISA_EXT_ZICSR - select RISCV_ISA_EXT_ZIFENCEI - -config SOC_RISCV_SIFIVE_FU740 - bool "SiFive Freedom U740 SOC implementation" - select ATOMIC_OPERATIONS_C - select INCLUDE_RESET_VECTOR - select 64BIT - select RISCV_ISA_RV64I - select RISCV_ISA_EXT_M - select RISCV_ISA_EXT_A - select RISCV_ISA_EXT_C - select RISCV_ISA_EXT_ZICSR - select RISCV_ISA_EXT_ZIFENCEI - -endchoice diff --git a/soc/riscv/sifive_freedom/CMakeLists.txt b/soc/riscv/sifive_freedom/CMakeLists.txt new file mode 100644 index 00000000000..6a5b10545ff --- /dev/null +++ b/soc/riscv/sifive_freedom/CMakeLists.txt @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(common) +add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/sifive_freedom/Kconfig b/soc/riscv/sifive_freedom/Kconfig new file mode 100644 index 00000000000..0fed11158af --- /dev/null +++ b/soc/riscv/sifive_freedom/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_SIFIVE_FREEDOM + bool + +if SOC_FAMILY_SIFIVE_FREEDOM + +config SOC_FAMILY + string + default "sifive_freedom" + +source "soc/riscv/sifive_freedom/*/Kconfig.soc" + +endif # SOC_FAMILY_SIFIVE_FREEDOM diff --git a/soc/riscv/sifive_freedom/Kconfig.defconfig b/soc/riscv/sifive_freedom/Kconfig.defconfig new file mode 100644 index 00000000000..5adf8fc437e --- /dev/null +++ b/soc/riscv/sifive_freedom/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/sifive_freedom/*/Kconfig.defconfig.series" diff --git a/soc/riscv/sifive_freedom/Kconfig.soc b/soc/riscv/sifive_freedom/Kconfig.soc new file mode 100644 index 00000000000..54274defd91 --- /dev/null +++ b/soc/riscv/sifive_freedom/Kconfig.soc @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/sifive_freedom/*/Kconfig.series" diff --git a/soc/riscv/sifive_freedom/common/CMakeLists.txt b/soc/riscv/sifive_freedom/common/CMakeLists.txt new file mode 100644 index 00000000000..f75aec6b311 --- /dev/null +++ b/soc/riscv/sifive_freedom/common/CMakeLists.txt @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_include_directories(.) diff --git a/soc/riscv/riscv-privileged/sifive-freedom/pinctrl_soc.h b/soc/riscv/sifive_freedom/common/pinctrl_soc.h similarity index 100% rename from soc/riscv/riscv-privileged/sifive-freedom/pinctrl_soc.h rename to soc/riscv/sifive_freedom/common/pinctrl_soc.h diff --git a/soc/riscv/sifive_freedom/e300/CMakeLists.txt b/soc/riscv/sifive_freedom/e300/CMakeLists.txt new file mode 100644 index 00000000000..baf01a6b047 --- /dev/null +++ b/soc/riscv/sifive_freedom/e300/CMakeLists.txt @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources(clock.c) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e340 b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e340 new file mode 100644 index 00000000000..cb0131f1427 --- /dev/null +++ b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e340 @@ -0,0 +1,5 @@ +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +config SOC + default "e340" if SOC_SIFIVE_FREEDOM_E340 diff --git a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series similarity index 65% rename from soc/riscv/riscv-privileged/sifive-freedom/Kconfig.defconfig.series rename to soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series index 0c3cd541773..b2f16e5261d 100644 --- a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series @@ -1,9 +1,10 @@ +# Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_RISCV_SIFIVE_FREEDOM +if SOC_SERIES_SIFIVE_FREEDOM_E300 config SOC_SERIES - default "sifive-freedom" + default "e300" config SYS_CLOCK_HW_CYCLES_PER_SEC default 32768 @@ -32,4 +33,6 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 64 -endif # SOC_SERIES_RISCV_SIFIVE_FREEDOM +source "soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e*" + +endif # SOC_SERIES_SIFIVE_FREEDOM_E300 diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.series new file mode 100644 index 00000000000..066f8909d53 --- /dev/null +++ b/soc/riscv/sifive_freedom/e300/Kconfig.series @@ -0,0 +1,13 @@ +# RISCV_SIFIVE_FREEDOM SOC implementation + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_SIFIVE_FREEDOM_E300 + bool "SiFive Freedom E300 SOC implementation" + select RISCV + select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE + select SOC_FAMILY_SIFIVE_FREEDOM + help + Enable support for SiFive Freedom FE300 SOC diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.soc b/soc/riscv/sifive_freedom/e300/Kconfig.soc new file mode 100644 index 00000000000..e53b84c0890 --- /dev/null +++ b/soc/riscv/sifive_freedom/e300/Kconfig.soc @@ -0,0 +1,20 @@ +# RISCV_SIFIVE_FREEDOM SOC configuration options + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +choice + prompt "SiFive Freedom SOC implementation" + depends on SOC_SERIES_SIFIVE_FREEDOM_E300 + +config SOC_SIFIVE_FREEDOM_E340 + bool "SiFive Freedom SOC implementation" + select ATOMIC_OPERATIONS_C + select INCLUDE_RESET_VECTOR + select RISCV_ISA_RV32I + select RISCV_ISA_EXT_M + select RISCV_ISA_EXT_A + select RISCV_ISA_EXT_ZICSR + select RISCV_ISA_EXT_ZIFENCEI + +endchoice diff --git a/soc/riscv/riscv-privileged/sifive-freedom/fe310_clock.c b/soc/riscv/sifive_freedom/e300/clock.c similarity index 98% rename from soc/riscv/riscv-privileged/sifive-freedom/fe310_clock.c rename to soc/riscv/sifive_freedom/e300/clock.c index 0b642f3e8b2..8fde8121db9 100644 --- a/soc/riscv/riscv-privileged/sifive-freedom/fe310_clock.c +++ b/soc/riscv/sifive_freedom/e300/clock.c @@ -7,7 +7,7 @@ #include #include -#include "fe310_prci.h" +#include "prci.h" #define CORECLK_HZ (DT_PROP(DT_NODELABEL(coreclk), clock_frequency)) BUILD_ASSERT(DT_PROP(DT_NODELABEL(tlclk), clock_div) == 1, diff --git a/soc/riscv/riscv-privileged/sifive-freedom/fe310_prci.h b/soc/riscv/sifive_freedom/e300/prci.h similarity index 100% rename from soc/riscv/riscv-privileged/sifive-freedom/fe310_prci.h rename to soc/riscv/sifive_freedom/e300/prci.h diff --git a/soc/riscv/riscv-privileged/sifive-freedom/soc.h b/soc/riscv/sifive_freedom/e300/soc.h similarity index 52% rename from soc/riscv/riscv-privileged/sifive-freedom/soc.h rename to soc/riscv/sifive_freedom/e300/soc.h index 958891a9d6a..c83f5f322b6 100644 --- a/soc/riscv/riscv-privileged/sifive-freedom/soc.h +++ b/soc/riscv/sifive_freedom/e300/soc.h @@ -8,30 +8,17 @@ * @file SoC configuration macros for the SiFive Freedom processor */ -#ifndef __RISCV_SIFIVE_FREEDOM_SOC_H_ -#define __RISCV_SIFIVE_FREEDOM_SOC_H_ +#ifndef __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ +#define __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ #include -#if defined(CONFIG_SOC_RISCV_SIFIVE_FREEDOM) /* PINMUX MAX PINS */ #define SIFIVE_PINMUX_PINS 32 /* Clock controller. */ #define PRCI_BASE_ADDR 0x10008000 -#elif defined(CONFIG_SOC_RISCV_SIFIVE_FU540) || defined(CONFIG_SOC_RISCV_SIFIVE_FU740) - -/* Clock controller. */ -#define PRCI_BASE_ADDR 0x10000000 - -/* PINMUX MAX PINS */ -#define SIFIVE_PINMUX_PINS 16 - -#endif - -#if defined(CONFIG_SOC_RISCV_SIFIVE_FREEDOM) || defined(CONFIG_SOC_RISCV_SIFIVE_FU540) - /* * On FE310 and FU540, peripherals such as SPI, UART, I2C and PWM are clocked * by TLCLK, which is derived from CORECLK. @@ -42,12 +29,4 @@ #define SIFIVE_PERIPHERAL_CLOCK_FREQUENCY \ (SIFIVE_TLCLK_BASE_FREQUENCY / SIFIVE_TLCLK_DIVIDER) -#elif defined(CONFIG_SOC_RISCV_SIFIVE_FU740) - -/* On FU740, peripherals are clocked by PCLK. */ -#define SIFIVE_PERIPHERAL_CLOCK_FREQUENCY \ - DT_PROP(DT_NODELABEL(pclk), clock_frequency) - -#endif - -#endif /* __RISCV_SIFIVE_FREEDOM_SOC_H_ */ +#endif /* __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ */ diff --git a/soc/riscv/sifive_freedom/u500/CMakeLists.txt b/soc/riscv/sifive_freedom/u500/CMakeLists.txt new file mode 100644 index 00000000000..baf01a6b047 --- /dev/null +++ b/soc/riscv/sifive_freedom/u500/CMakeLists.txt @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources(clock.c) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series new file mode 100644 index 00000000000..d6b94678686 --- /dev/null +++ b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series @@ -0,0 +1,38 @@ +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_SIFIVE_FREEDOM_U500 + +config SOC_SERIES + default "u500" + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default 32768 + +config RISCV_SOC_INTERRUPT_INIT + default y + +config RISCV_HAS_CPU_IDLE + default y + +config RISCV_HAS_PLIC + default y + +config RISCV_GP + default y + +config 2ND_LVL_ISR_TBL_OFFSET + default 12 + +config 2ND_LVL_INTR_00_OFFSET + default 11 + +config MAX_IRQ_PER_AGGREGATOR + default 52 + +config NUM_IRQS + default 64 + +source "soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u*" + +endif # SOC_SERIES_SIFIVE_FREEDOM_U500 diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u540 b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u540 new file mode 100644 index 00000000000..f559f5914b3 --- /dev/null +++ b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u540 @@ -0,0 +1,5 @@ +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +config SOC + default "u540" if SOC_SIFIVE_FREEDOM_U540 diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.series new file mode 100644 index 00000000000..963a265f383 --- /dev/null +++ b/soc/riscv/sifive_freedom/u500/Kconfig.series @@ -0,0 +1,13 @@ +# RISCV_SIFIVE_FREEDOM SOC implementation + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_SIFIVE_FREEDOM_U500 + bool "SiFive Freedom U500 SOC implementation" + select RISCV + select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE + select SOC_FAMILY_SIFIVE_FREEDOM + help + Enable support for SiFive Freedom U500 SOC diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.soc b/soc/riscv/sifive_freedom/u500/Kconfig.soc new file mode 100644 index 00000000000..0a88ccf8cc1 --- /dev/null +++ b/soc/riscv/sifive_freedom/u500/Kconfig.soc @@ -0,0 +1,22 @@ +# RISCV_SIFIVE_FREEDOM SOC configuration options + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +choice + prompt "SiFive Freedom SOC implementation" + depends on SOC_SERIES_SIFIVE_FREEDOM_U500 + +config SOC_SIFIVE_FREEDOM_U540 + bool "SiFive Freedom U540 SOC implementation" + select ATOMIC_OPERATIONS_C + select INCLUDE_RESET_VECTOR + select 64BIT + select RISCV_ISA_RV64I + select RISCV_ISA_EXT_M + select RISCV_ISA_EXT_A + select RISCV_ISA_EXT_C + select RISCV_ISA_EXT_ZICSR + select RISCV_ISA_EXT_ZIFENCEI + +endchoice diff --git a/soc/riscv/riscv-privileged/sifive-freedom/fu540_clock.c b/soc/riscv/sifive_freedom/u500/clock.c similarity index 97% rename from soc/riscv/riscv-privileged/sifive-freedom/fu540_clock.c rename to soc/riscv/sifive_freedom/u500/clock.c index bc68a502f59..87929892f77 100644 --- a/soc/riscv/riscv-privileged/sifive-freedom/fu540_clock.c +++ b/soc/riscv/sifive_freedom/u500/clock.c @@ -7,7 +7,7 @@ #include #include #include -#include "fu540_prci.h" +#include "prci.h" BUILD_ASSERT(MHZ(1000) == DT_PROP(DT_NODELABEL(coreclk), clock_frequency), "Unsupported CORECLK frequency"); diff --git a/soc/riscv/riscv-privileged/sifive-freedom/fu540_prci.h b/soc/riscv/sifive_freedom/u500/prci.h similarity index 100% rename from soc/riscv/riscv-privileged/sifive-freedom/fu540_prci.h rename to soc/riscv/sifive_freedom/u500/prci.h diff --git a/soc/riscv/sifive_freedom/u500/soc.h b/soc/riscv/sifive_freedom/u500/soc.h new file mode 100644 index 00000000000..ed367950278 --- /dev/null +++ b/soc/riscv/sifive_freedom/u500/soc.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2017 Jean-Paul Etienne + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file SoC configuration macros for the SiFive Freedom processor + */ + +#ifndef __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ +#define __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ + +#include + +/* Clock controller. */ +#define PRCI_BASE_ADDR 0x10000000 + +/* PINMUX MAX PINS */ +#define SIFIVE_PINMUX_PINS 16 + +/* + * On FE310 and FU540, peripherals such as SPI, UART, I2C and PWM are clocked + * by TLCLK, which is derived from CORECLK. + */ +#define SIFIVE_TLCLK_BASE_FREQUENCY \ + DT_PROP_BY_PHANDLE_IDX(DT_NODELABEL(tlclk), clocks, 0, clock_frequency) +#define SIFIVE_TLCLK_DIVIDER DT_PROP(DT_NODELABEL(tlclk), clock_div) +#define SIFIVE_PERIPHERAL_CLOCK_FREQUENCY \ + (SIFIVE_TLCLK_BASE_FREQUENCY / SIFIVE_TLCLK_DIVIDER) + +#endif /* __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ */ diff --git a/soc/riscv/sifive_freedom/u700/CMakeLists.txt b/soc/riscv/sifive_freedom/u700/CMakeLists.txt new file mode 100644 index 00000000000..baf01a6b047 --- /dev/null +++ b/soc/riscv/sifive_freedom/u700/CMakeLists.txt @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources(clock.c) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series new file mode 100644 index 00000000000..347ac14b551 --- /dev/null +++ b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series @@ -0,0 +1,38 @@ +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_SIFIVE_FREEDOM_U700 + +config SOC_SERIES + default "u700" + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default 32768 + +config RISCV_SOC_INTERRUPT_INIT + default y + +config RISCV_HAS_CPU_IDLE + default y + +config RISCV_HAS_PLIC + default y + +config RISCV_GP + default y + +config 2ND_LVL_ISR_TBL_OFFSET + default 12 + +config 2ND_LVL_INTR_00_OFFSET + default 11 + +config MAX_IRQ_PER_AGGREGATOR + default 52 + +config NUM_IRQS + default 64 + +source "soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u*" + +endif # SOC_SERIES_SIFIVE_FREEDOM_U700 diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u740 b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u740 new file mode 100644 index 00000000000..ca935f772eb --- /dev/null +++ b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u740 @@ -0,0 +1,5 @@ +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +config SOC + default "u740" if SOC_SIFIVE_FREEDOM_U740 diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.series new file mode 100644 index 00000000000..b4ca38697f8 --- /dev/null +++ b/soc/riscv/sifive_freedom/u700/Kconfig.series @@ -0,0 +1,13 @@ +# RISCV_SIFIVE_FREEDOM SOC implementation + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_SIFIVE_FREEDOM_U700 + bool "SiFive Freedom SOC U700 implementation" + select RISCV + select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE + select SOC_FAMILY_SIFIVE_FREEDOM + help + Enable support for SiFive Freedom U700 SOC diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.soc b/soc/riscv/sifive_freedom/u700/Kconfig.soc new file mode 100644 index 00000000000..1eec9b4bb17 --- /dev/null +++ b/soc/riscv/sifive_freedom/u700/Kconfig.soc @@ -0,0 +1,22 @@ +# RISCV_SIFIVE_FREEDOM SOC configuration options + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +choice + prompt "SiFive Freedom SOC implementation" + depends on SOC_SERIES_SIFIVE_FREEDOM_U700 + +config SOC_SIFIVE_FREEDOM_U740 + bool "SiFive Freedom U740 SOC implementation" + select ATOMIC_OPERATIONS_C + select INCLUDE_RESET_VECTOR + select 64BIT + select RISCV_ISA_RV64I + select RISCV_ISA_EXT_M + select RISCV_ISA_EXT_A + select RISCV_ISA_EXT_C + select RISCV_ISA_EXT_ZICSR + select RISCV_ISA_EXT_ZIFENCEI + +endchoice diff --git a/soc/riscv/riscv-privileged/sifive-freedom/fu740_clock.c b/soc/riscv/sifive_freedom/u700/clock.c similarity index 99% rename from soc/riscv/riscv-privileged/sifive-freedom/fu740_clock.c rename to soc/riscv/sifive_freedom/u700/clock.c index e6bbee93689..5c3fa567343 100644 --- a/soc/riscv/riscv-privileged/sifive-freedom/fu740_clock.c +++ b/soc/riscv/sifive_freedom/u700/clock.c @@ -8,7 +8,7 @@ #include #include -#include "fu740_prci.h" +#include "prci.h" BUILD_ASSERT(MHZ(1000) == DT_PROP(DT_NODELABEL(coreclk), clock_frequency), "Unsupported CORECLK frequency"); diff --git a/soc/riscv/riscv-privileged/sifive-freedom/fu740_prci.h b/soc/riscv/sifive_freedom/u700/prci.h similarity index 100% rename from soc/riscv/riscv-privileged/sifive-freedom/fu740_prci.h rename to soc/riscv/sifive_freedom/u700/prci.h diff --git a/soc/riscv/sifive_freedom/u700/soc.h b/soc/riscv/sifive_freedom/u700/soc.h new file mode 100644 index 00000000000..91aac61afdd --- /dev/null +++ b/soc/riscv/sifive_freedom/u700/soc.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2017 Jean-Paul Etienne + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file SoC configuration macros for the SiFive Freedom processor + */ + +#ifndef __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ +#define __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ + +#include + +/* Clock controller. */ +#define PRCI_BASE_ADDR 0x10000000 + +/* PINMUX MAX PINS */ +#define SIFIVE_PINMUX_PINS 16 + +/* On FU740, peripherals are clocked by PCLK. */ +#define SIFIVE_PERIPHERAL_CLOCK_FREQUENCY \ + DT_PROP(DT_NODELABEL(pclk), clock_frequency) + +#endif /* __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ */ From 388121ddb79fa3e5038831de965abfd7ba93fac5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 17:30:23 +0100 Subject: [PATCH 0280/2300] [nrf fromtree] soc: riscv: opentitan: reorganize SoC folder Remove from riscv-privileged, and create a standalone SoC. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit b5fb00bdc87588607940d2af053866d04d11d423) (cherry picked from commit 821879ccab8c320f778dd1435091b104faa23840) --- boards/riscv/opentitan_earlgrey/Kconfig.board | 2 +- .../opentitan_earlgrey_defconfig | 3 +-- .../opentitan/CMakeLists.txt | 0 .../Kconfig.defconfig} | 6 +++--- .../{riscv-privileged => }/opentitan/Kconfig.soc | 14 +++++++------- .../{riscv-privileged => }/opentitan/rom_header.S | 0 .../{riscv-privileged => }/opentitan/rom_header.ld | 0 soc/riscv/{riscv-privileged => }/opentitan/soc.c | 0 soc/riscv/{riscv-privileged => }/opentitan/soc.h | 0 .../riscv-privileged/opentitan/Kconfig.series | 12 ------------ 10 files changed, 12 insertions(+), 25 deletions(-) rename soc/riscv/{riscv-privileged => }/opentitan/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged/opentitan/Kconfig.defconfig.series => opentitan/Kconfig.defconfig} (83%) rename soc/riscv/{riscv-privileged => }/opentitan/Kconfig.soc (63%) rename soc/riscv/{riscv-privileged => }/opentitan/rom_header.S (100%) rename soc/riscv/{riscv-privileged => }/opentitan/rom_header.ld (100%) rename soc/riscv/{riscv-privileged => }/opentitan/soc.c (100%) rename soc/riscv/{riscv-privileged => }/opentitan/soc.h (100%) delete mode 100644 soc/riscv/riscv-privileged/opentitan/Kconfig.series diff --git a/boards/riscv/opentitan_earlgrey/Kconfig.board b/boards/riscv/opentitan_earlgrey/Kconfig.board index ec7f735b442..544c02b1b2a 100644 --- a/boards/riscv/opentitan_earlgrey/Kconfig.board +++ b/boards/riscv/opentitan_earlgrey/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_OPENTITAN_EARLGREY bool "OpenTitan Earl Grey Target" - depends on SOC_RISCV_OPENTITAN + depends on SOC_OPENTITAN diff --git a/boards/riscv/opentitan_earlgrey/opentitan_earlgrey_defconfig b/boards/riscv/opentitan_earlgrey/opentitan_earlgrey_defconfig index 79299c3892f..886e439b88a 100644 --- a/boards/riscv/opentitan_earlgrey/opentitan_earlgrey_defconfig +++ b/boards/riscv/opentitan_earlgrey/opentitan_earlgrey_defconfig @@ -1,8 +1,7 @@ # Copyright (c) 2023 by Rivos Inc. # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV_OPENTITAN=y -CONFIG_SOC_RISCV_OPENTITAN=y +CONFIG_SOC_OPENTITAN=y CONFIG_BOARD_OPENTITAN_EARLGREY=y CONFIG_XIP=y CONFIG_SERIAL=y diff --git a/soc/riscv/riscv-privileged/opentitan/CMakeLists.txt b/soc/riscv/opentitan/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/opentitan/CMakeLists.txt rename to soc/riscv/opentitan/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/opentitan/Kconfig.defconfig.series b/soc/riscv/opentitan/Kconfig.defconfig similarity index 83% rename from soc/riscv/riscv-privileged/opentitan/Kconfig.defconfig.series rename to soc/riscv/opentitan/Kconfig.defconfig index c9e7f8396a0..cc27b7ffd6b 100644 --- a/soc/riscv/riscv-privileged/opentitan/Kconfig.defconfig.series +++ b/soc/riscv/opentitan/Kconfig.defconfig @@ -1,9 +1,9 @@ # Copyright (c) 2023 Rivos Inc. # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_RISCV_OPENTITAN +if SOC_OPENTITAN -config SOC_SERIES +config SOC default "opentitan" config SYS_CLOCK_HW_CYCLES_PER_SEC @@ -30,4 +30,4 @@ config 2ND_LVL_INTR_00_OFFSET config NUM_IRQS default 217 -endif # SOC_SERIES_RISCV_OPENTITAN +endif # SOC_OPENTITAN diff --git a/soc/riscv/riscv-privileged/opentitan/Kconfig.soc b/soc/riscv/opentitan/Kconfig.soc similarity index 63% rename from soc/riscv/riscv-privileged/opentitan/Kconfig.soc rename to soc/riscv/opentitan/Kconfig.soc index 098b1844e52..b482afce469 100644 --- a/soc/riscv/riscv-privileged/opentitan/Kconfig.soc +++ b/soc/riscv/opentitan/Kconfig.soc @@ -1,11 +1,7 @@ # Copyright (c) 2023 Rivos Inc. # SPDX-License-Identifier: Apache-2.0 -choice - prompt "OpenTitan implementation" - depends on SOC_SERIES_RISCV_OPENTITAN - -config SOC_RISCV_OPENTITAN +config SOC_OPENTITAN bool "OpenTitan implementation" select ATOMIC_OPERATIONS_C select INCLUDE_RESET_VECTOR @@ -18,5 +14,9 @@ config SOC_RISCV_OPENTITAN select RISCV_ISA_EXT_ZBB select RISCV_ISA_EXT_ZBC select RISCV_ISA_EXT_ZBS - -endchoice + select RISCV + select RISCV_PRIVILEGED + # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. + select RISCV_VECTORED_MODE + select GEN_IRQ_VECTOR_TABLE + select RISCV_PRIVILEGED_STANDALONE diff --git a/soc/riscv/riscv-privileged/opentitan/rom_header.S b/soc/riscv/opentitan/rom_header.S similarity index 100% rename from soc/riscv/riscv-privileged/opentitan/rom_header.S rename to soc/riscv/opentitan/rom_header.S diff --git a/soc/riscv/riscv-privileged/opentitan/rom_header.ld b/soc/riscv/opentitan/rom_header.ld similarity index 100% rename from soc/riscv/riscv-privileged/opentitan/rom_header.ld rename to soc/riscv/opentitan/rom_header.ld diff --git a/soc/riscv/riscv-privileged/opentitan/soc.c b/soc/riscv/opentitan/soc.c similarity index 100% rename from soc/riscv/riscv-privileged/opentitan/soc.c rename to soc/riscv/opentitan/soc.c diff --git a/soc/riscv/riscv-privileged/opentitan/soc.h b/soc/riscv/opentitan/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/opentitan/soc.h rename to soc/riscv/opentitan/soc.h diff --git a/soc/riscv/riscv-privileged/opentitan/Kconfig.series b/soc/riscv/riscv-privileged/opentitan/Kconfig.series deleted file mode 100644 index b516e6d8092..00000000000 --- a/soc/riscv/riscv-privileged/opentitan/Kconfig.series +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2023 Rivos Inc. -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_RISCV_OPENTITAN - bool "OpenTitan implementation" - select RISCV - select RISCV_PRIVILEGED - # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. - select RISCV_VECTORED_MODE - select GEN_IRQ_VECTOR_TABLE - help - Enable support for OpenTitan From 1f276b7c1baa3aaa51c0c7387846d14798ad7eaf Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 17:36:53 +0100 Subject: [PATCH 0281/2300] [nrf fromtree] soc: riscv: niosv: reorganize SoC folder Move out of riscv-privileged, create new family for it. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 8729a782f96eaa2d673517048dd1afef0513ffd2) (cherry picked from commit ccb9ae80dc6fb9a6e8c1d9048e5c2f3561f2d639) --- .../CMakeLists.txt | 1 + soc/riscv/intel_niosv/Kconfig | 15 +++++++++++++++ soc/riscv/intel_niosv/Kconfig.defconfig | 4 ++++ soc/riscv/intel_niosv/Kconfig.soc | 4 ++++ .../niosv/CMakeLists.txt | 0 .../niosv/Kconfig.defconfig.series | 2 +- .../niosv/Kconfig.series | 2 ++ .../niosv/Kconfig.soc | 0 .../niosv/linker.ld | 0 .../{riscv-privileged => intel_niosv}/niosv/soc.h | 0 soc/riscv/riscv-privileged/Kconfig | 4 ---- soc/riscv/riscv-privileged/Kconfig.defconfig | 6 ------ soc/riscv/riscv-privileged/Kconfig.soc | 6 ------ 13 files changed, 27 insertions(+), 17 deletions(-) rename soc/riscv/{riscv-privileged => intel_niosv}/CMakeLists.txt (62%) create mode 100644 soc/riscv/intel_niosv/Kconfig create mode 100644 soc/riscv/intel_niosv/Kconfig.defconfig create mode 100644 soc/riscv/intel_niosv/Kconfig.soc rename soc/riscv/{riscv-privileged => intel_niosv}/niosv/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged => intel_niosv}/niosv/Kconfig.defconfig.series (94%) rename soc/riscv/{riscv-privileged => intel_niosv}/niosv/Kconfig.series (76%) rename soc/riscv/{riscv-privileged => intel_niosv}/niosv/Kconfig.soc (100%) rename soc/riscv/{riscv-privileged => intel_niosv}/niosv/linker.ld (100%) rename soc/riscv/{riscv-privileged => intel_niosv}/niosv/soc.h (100%) delete mode 100644 soc/riscv/riscv-privileged/Kconfig delete mode 100644 soc/riscv/riscv-privileged/Kconfig.defconfig delete mode 100644 soc/riscv/riscv-privileged/Kconfig.soc diff --git a/soc/riscv/riscv-privileged/CMakeLists.txt b/soc/riscv/intel_niosv/CMakeLists.txt similarity index 62% rename from soc/riscv/riscv-privileged/CMakeLists.txt rename to soc/riscv/intel_niosv/CMakeLists.txt index 226f3bd626f..69b2926358e 100644 --- a/soc/riscv/riscv-privileged/CMakeLists.txt +++ b/soc/riscv/intel_niosv/CMakeLists.txt @@ -1,3 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor # SPDX-License-Identifier: Apache-2.0 add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/intel_niosv/Kconfig b/soc/riscv/intel_niosv/Kconfig new file mode 100644 index 00000000000..b841d19c922 --- /dev/null +++ b/soc/riscv/intel_niosv/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_INTEL_NIOSV + bool + +if SOC_FAMILY_INTEL_NIOSV + +config SOC_FAMILY + string + default "intel_niosv" + +source "soc/riscv/intel_niosv/*/Kconfig.soc" + +endif # SOC_FAMILY_INTEL_NIOSV diff --git a/soc/riscv/intel_niosv/Kconfig.defconfig b/soc/riscv/intel_niosv/Kconfig.defconfig new file mode 100644 index 00000000000..2afa0f7e0e6 --- /dev/null +++ b/soc/riscv/intel_niosv/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/intel_niosv/*/Kconfig.defconfig.series" diff --git a/soc/riscv/intel_niosv/Kconfig.soc b/soc/riscv/intel_niosv/Kconfig.soc new file mode 100644 index 00000000000..8567429c61f --- /dev/null +++ b/soc/riscv/intel_niosv/Kconfig.soc @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/intel_niosv/*/Kconfig.series" diff --git a/soc/riscv/riscv-privileged/niosv/CMakeLists.txt b/soc/riscv/intel_niosv/niosv/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/niosv/CMakeLists.txt rename to soc/riscv/intel_niosv/niosv/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/niosv/Kconfig.defconfig.series b/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series similarity index 94% rename from soc/riscv/riscv-privileged/niosv/Kconfig.defconfig.series rename to soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series index 532a67959d2..8e8ea255202 100644 --- a/soc/riscv/riscv-privileged/niosv/Kconfig.defconfig.series +++ b/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series @@ -21,4 +21,4 @@ config RISCV_GP config RISCV_SOC_INTERRUPT_INIT default y -endif # SOC_SERIES_NIOSV +endif # SOC_NIOSV diff --git a/soc/riscv/riscv-privileged/niosv/Kconfig.series b/soc/riscv/intel_niosv/niosv/Kconfig.series similarity index 76% rename from soc/riscv/riscv-privileged/niosv/Kconfig.series rename to soc/riscv/intel_niosv/niosv/Kconfig.series index 104f5a48352..b8edc073916 100644 --- a/soc/riscv/riscv-privileged/niosv/Kconfig.series +++ b/soc/riscv/intel_niosv/niosv/Kconfig.series @@ -5,5 +5,7 @@ config SOC_SERIES_NIOSV bool "INTEL FPGA NIOSV" select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE + select SOC_FAMILY_INTEL_NIOSV help Enable support for the INTEL FPGA NIOSV. diff --git a/soc/riscv/riscv-privileged/niosv/Kconfig.soc b/soc/riscv/intel_niosv/niosv/Kconfig.soc similarity index 100% rename from soc/riscv/riscv-privileged/niosv/Kconfig.soc rename to soc/riscv/intel_niosv/niosv/Kconfig.soc diff --git a/soc/riscv/riscv-privileged/niosv/linker.ld b/soc/riscv/intel_niosv/niosv/linker.ld similarity index 100% rename from soc/riscv/riscv-privileged/niosv/linker.ld rename to soc/riscv/intel_niosv/niosv/linker.ld diff --git a/soc/riscv/riscv-privileged/niosv/soc.h b/soc/riscv/intel_niosv/niosv/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/niosv/soc.h rename to soc/riscv/intel_niosv/niosv/soc.h diff --git a/soc/riscv/riscv-privileged/Kconfig b/soc/riscv/riscv-privileged/Kconfig deleted file mode 100644 index b0700dd3440..00000000000 --- a/soc/riscv/riscv-privileged/Kconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/riscv-privileged/*/Kconfig.soc" diff --git a/soc/riscv/riscv-privileged/Kconfig.defconfig b/soc/riscv/riscv-privileged/Kconfig.defconfig deleted file mode 100644 index 6793d72a385..00000000000 --- a/soc/riscv/riscv-privileged/Kconfig.defconfig +++ /dev/null @@ -1,6 +0,0 @@ -# riscv SOC family supporting the riscv privileged architecture spec - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/riscv-privileged/*/Kconfig.defconfig.series" diff --git a/soc/riscv/riscv-privileged/Kconfig.soc b/soc/riscv/riscv-privileged/Kconfig.soc deleted file mode 100644 index 14d141223e0..00000000000 --- a/soc/riscv/riscv-privileged/Kconfig.soc +++ /dev/null @@ -1,6 +0,0 @@ -# riscv SOC series supporting the riscv privileged architecture spec - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/riscv-privileged/*/Kconfig.series" From 6054e60839979c9146a7b9fad70d496d93a74cf4 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 8 Jan 2024 14:13:06 +0100 Subject: [PATCH 0282/2300] [nrf fromtree] soc: riscv: renove_virt: reorganize SoC folder Move out from riscv-privileged, and convert to a standalone SoC. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 724a967c1a170f181e4fccb974fb22127fb0d75a) (cherry picked from commit 2ba07f2e7af19338f6fff5d296b1829f1ff2ffc6) --- boards/riscv/riscv32_virtual/riscv32_virtual_defconfig | 1 - .../{riscv-privileged => }/renode_virt/CMakeLists.txt | 0 .../Kconfig.defconfig} | 6 +++--- soc/riscv/{riscv-privileged => }/renode_virt/Kconfig.soc | 9 +++------ soc/riscv/{riscv-privileged => }/renode_virt/soc.h | 0 soc/riscv/riscv-privileged/renode_virt/Kconfig.series | 9 --------- 6 files changed, 6 insertions(+), 19 deletions(-) rename soc/riscv/{riscv-privileged => }/renode_virt/CMakeLists.txt (100%) rename soc/riscv/{riscv-privileged/renode_virt/Kconfig.defconfig.series => renode_virt/Kconfig.defconfig} (86%) rename soc/riscv/{riscv-privileged => }/renode_virt/Kconfig.soc (75%) rename soc/riscv/{riscv-privileged => }/renode_virt/soc.h (100%) delete mode 100644 soc/riscv/riscv-privileged/renode_virt/Kconfig.series diff --git a/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig b/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig index a905f99da2e..4dcad0a7ea1 100644 --- a/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig +++ b/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig @@ -1,7 +1,6 @@ # Copyright (c) 2023 Meta # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_RISCV32_VIRTUAL_RENODE=y CONFIG_SOC_RISCV32_VIRTUAL_RENODE=y CONFIG_BOARD_RISCV32_VIRTUAL=y CONFIG_CONSOLE=y diff --git a/soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt b/soc/riscv/renode_virt/CMakeLists.txt similarity index 100% rename from soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt rename to soc/riscv/renode_virt/CMakeLists.txt diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series b/soc/riscv/renode_virt/Kconfig.defconfig similarity index 86% rename from soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series rename to soc/riscv/renode_virt/Kconfig.defconfig index 09adc3d00e8..89e226edbb1 100644 --- a/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series +++ b/soc/riscv/renode_virt/Kconfig.defconfig @@ -1,9 +1,9 @@ # Copyright (c) 2023 Meta # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_RISCV32_VIRTUAL_RENODE +if SOC_RISCV32_VIRTUAL_RENODE -config SOC_SERIES +config SOC default "renode_virt" config SYS_CLOCK_HW_CYCLES_PER_SEC @@ -45,4 +45,4 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 2058 -endif # SOC_SERIES_RISCV32_VIRTUAL_RENODE +endif # SOC_RISCV32_VIRTUAL_RENODE diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc b/soc/riscv/renode_virt/Kconfig.soc similarity index 75% rename from soc/riscv/riscv-privileged/renode_virt/Kconfig.soc rename to soc/riscv/renode_virt/Kconfig.soc index d123e797229..3e8af25099f 100644 --- a/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc +++ b/soc/riscv/renode_virt/Kconfig.soc @@ -1,12 +1,11 @@ # Copyright (c) 2023 Meta # SPDX-License-Identifier: Apache-2.0 -choice - prompt "Renode RISCV32 Virtual system implementation" - depends on SOC_SERIES_RISCV32_VIRTUAL_RENODE - config SOC_RISCV32_VIRTUAL_RENODE bool "Renode RISCV32 Virtual system implementation" + select RISCV + select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR select RISCV_ISA_RV32I @@ -15,5 +14,3 @@ config SOC_RISCV32_VIRTUAL_RENODE select RISCV_ISA_EXT_C select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI - -endchoice diff --git a/soc/riscv/riscv-privileged/renode_virt/soc.h b/soc/riscv/renode_virt/soc.h similarity index 100% rename from soc/riscv/riscv-privileged/renode_virt/soc.h rename to soc/riscv/renode_virt/soc.h diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.series b/soc/riscv/riscv-privileged/renode_virt/Kconfig.series deleted file mode 100644 index 22e27cf38b4..00000000000 --- a/soc/riscv/riscv-privileged/renode_virt/Kconfig.series +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Meta -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_RISCV32_VIRTUAL_RENODE - bool "Renode RISC-V32 Virtual SoC implementation" - select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED - help - Enable support for Renode RISC-V Virtual From d89a3dcfeddd95e4803e86289ac2df9d55957593 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 3 Jan 2024 17:39:38 +0100 Subject: [PATCH 0283/2300] [nrf fromtree] soc: riscv: drop RISCV_PRIVILEGED_STANDALONE This option is no longer needed, all SoCs have been moved out from soc/riscv/riscv-privileged folder. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 14ff171411901b994f2761a76af4baf17bcdab7b) (cherry picked from commit dfd6d6bd0522713ede8d3c0ab534e438f211aef5) --- soc/riscv/andes_v5/ae350/Kconfig.series | 1 - soc/riscv/common/riscv-privileged/Kconfig | 7 ------- soc/riscv/efinix_sapphire/Kconfig.soc | 1 - soc/riscv/gd_gd32/gd32vf103/Kconfig.series | 1 - soc/riscv/intel_niosv/niosv/Kconfig.series | 1 - soc/riscv/microchip_miv/miv/Kconfig.series | 1 - soc/riscv/microchip_miv/polarfire/Kconfig.series | 1 - soc/riscv/neorv32/Kconfig.soc | 1 - soc/riscv/opentitan/Kconfig.soc | 1 - soc/riscv/renode_virt/Kconfig.soc | 1 - soc/riscv/sifive_freedom/e300/Kconfig.series | 1 - soc/riscv/sifive_freedom/u500/Kconfig.series | 1 - soc/riscv/sifive_freedom/u700/Kconfig.series | 1 - soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series | 1 - soc/riscv/telink_tlsr/tlsr951x/Kconfig.series | 1 - soc/riscv/virt/Kconfig.soc | 1 - 16 files changed, 22 deletions(-) diff --git a/soc/riscv/andes_v5/ae350/Kconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.series index 4eb9557f92f..ebf68f7a3aa 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.series +++ b/soc/riscv/andes_v5/ae350/Kconfig.series @@ -5,7 +5,6 @@ config SOC_SERIES_ANDES_AE350 bool "Andes V5 AE350 SoC Series Implementation" select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_ANDES_V5 help Enable support for Andes V5 AE350 SoC Series diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index de064842604..a4a8da0bf1f 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -4,13 +4,6 @@ # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 -config RISCV_PRIVILEGED_STANDALONE - bool - -config SOC_FAMILY - string - default "riscv-privileged" if RISCV_PRIVILEGED && !RISCV_PRIVILEGED_STANDALONE - config RISCV_HAS_PLIC bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" depends on RISCV_PRIVILEGED diff --git a/soc/riscv/efinix_sapphire/Kconfig.soc b/soc/riscv/efinix_sapphire/Kconfig.soc index 2cc5f3ba361..bf57d9cc541 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.soc +++ b/soc/riscv/efinix_sapphire/Kconfig.soc @@ -12,4 +12,3 @@ config SOC_EFINIX_SAPPHIRE select RISCV_ISA_EXT_ZIFENCEI select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.series b/soc/riscv/gd_gd32/gd32vf103/Kconfig.series index b0b86db7c02..e50567e0798 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.series +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.series @@ -16,6 +16,5 @@ config SOC_SERIES_GD32VF103 select HAS_GD32_HAL select RISCV_HAS_CLIC select SOC_FAMILY_GD32 - select RISCV_PRIVILEGED_STANDALONE help Enable support for GigaDevice GD32VF1 series SoC diff --git a/soc/riscv/intel_niosv/niosv/Kconfig.series b/soc/riscv/intel_niosv/niosv/Kconfig.series index b8edc073916..9d7aa492692 100644 --- a/soc/riscv/intel_niosv/niosv/Kconfig.series +++ b/soc/riscv/intel_niosv/niosv/Kconfig.series @@ -5,7 +5,6 @@ config SOC_SERIES_NIOSV bool "INTEL FPGA NIOSV" select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_INTEL_NIOSV help Enable support for the INTEL FPGA NIOSV. diff --git a/soc/riscv/microchip_miv/miv/Kconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.series index 20430e6d0f9..2989876c0e0 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.series @@ -8,6 +8,5 @@ config SOC_SERIES_MIV select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE help Enable support for Microchip Mi-V diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.series index 4bbceaee745..9001efc2858 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.series @@ -8,6 +8,5 @@ config SOC_SERIES_POLARFIRE select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE help Enable support for Microchip RISCV 64bit diff --git a/soc/riscv/neorv32/Kconfig.soc b/soc/riscv/neorv32/Kconfig.soc index f07bba96574..3155d1b7c31 100644 --- a/soc/riscv/neorv32/Kconfig.soc +++ b/soc/riscv/neorv32/Kconfig.soc @@ -10,7 +10,6 @@ config SOC_NEORV32 select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE help Enable support for the NEORV32 Processor (SoC). diff --git a/soc/riscv/opentitan/Kconfig.soc b/soc/riscv/opentitan/Kconfig.soc index b482afce469..8270fde110d 100644 --- a/soc/riscv/opentitan/Kconfig.soc +++ b/soc/riscv/opentitan/Kconfig.soc @@ -19,4 +19,3 @@ config SOC_OPENTITAN # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. select RISCV_VECTORED_MODE select GEN_IRQ_VECTOR_TABLE - select RISCV_PRIVILEGED_STANDALONE diff --git a/soc/riscv/renode_virt/Kconfig.soc b/soc/riscv/renode_virt/Kconfig.soc index 3e8af25099f..5aae660880a 100644 --- a/soc/riscv/renode_virt/Kconfig.soc +++ b/soc/riscv/renode_virt/Kconfig.soc @@ -5,7 +5,6 @@ config SOC_RISCV32_VIRTUAL_RENODE bool "Renode RISCV32 Virtual system implementation" select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR select RISCV_ISA_RV32I diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.series index 066f8909d53..47ae89e6d4c 100644 --- a/soc/riscv/sifive_freedom/e300/Kconfig.series +++ b/soc/riscv/sifive_freedom/e300/Kconfig.series @@ -7,7 +7,6 @@ config SOC_SERIES_SIFIVE_FREEDOM_E300 bool "SiFive Freedom E300 SOC implementation" select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom FE300 SOC diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.series index 963a265f383..a576dfbc6f7 100644 --- a/soc/riscv/sifive_freedom/u500/Kconfig.series +++ b/soc/riscv/sifive_freedom/u500/Kconfig.series @@ -7,7 +7,6 @@ config SOC_SERIES_SIFIVE_FREEDOM_U500 bool "SiFive Freedom U500 SOC implementation" select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom U500 SOC diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.series index b4ca38697f8..613844703c7 100644 --- a/soc/riscv/sifive_freedom/u700/Kconfig.series +++ b/soc/riscv/sifive_freedom/u700/Kconfig.series @@ -7,7 +7,6 @@ config SOC_SERIES_SIFIVE_FREEDOM_U700 bool "SiFive Freedom SOC U700 implementation" select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom U700 SOC diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series index d70cff1c63d..19cedcefe27 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series @@ -5,6 +5,5 @@ config SOC_SERIES_STARFIVE_JH71XX bool "Starfive JH71XX series" select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE help Enable support for Starfive JH71XX SoC Series. diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series index e074a53e11b..5ad3053725e 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series @@ -16,6 +16,5 @@ config SOC_SERIES_TELINK_TLSR951X select CPU_HAS_FPU select INCLUDE_RESET_VECTOR select SOC_FAMILY_TELINK_TLSR - select RISCV_PRIVILEGED_STANDALONE help Enable support for Telink TLSR951X diff --git a/soc/riscv/virt/Kconfig.soc b/soc/riscv/virt/Kconfig.soc index fb615005b0a..9a9168f5a8c 100644 --- a/soc/riscv/virt/Kconfig.soc +++ b/soc/riscv/virt/Kconfig.soc @@ -10,4 +10,3 @@ config SOC_RISCV_VIRT select RISCV_ISA_EXT_C select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE From 39e621b7d51023bf0a43f401e81eea19e024f390 Mon Sep 17 00:00:00 2001 From: Chen Xingyu Date: Sun, 26 Nov 2023 13:08:45 +0800 Subject: [PATCH 0284/2300] [nrf fromtree] soc: riscv: privileged: efinix-sapphire: Enable CONFIG_RISCV_HAS_CPU_IDLE In an earlier commit, the riscv-privileged level implementation of `arch_cpu_idle()` is not included unless `CONFIG_RISCV_HAS_CPU_IDLE` is enabled. This commit ensures the option is enabled on all the existing CPUs, thereby maintaining the existing behavior. Signed-off-by: Chen Xingyu (cherry picked from commit 3f7e73416de99bdc35819e0af394ed9dc74e2a2a) (cherry picked from commit 1d4e70e7eb1816cb24d342b376017cd2496e007c) --- soc/riscv/efinix_sapphire/Kconfig.defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/riscv/efinix_sapphire/Kconfig.defconfig b/soc/riscv/efinix_sapphire/Kconfig.defconfig index 5424bca7baf..7018c0f11fb 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.defconfig +++ b/soc/riscv/efinix_sapphire/Kconfig.defconfig @@ -11,6 +11,7 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_HAS_CPU_IDLE bool + default y config RISCV_SOC_INTERRUPT_INIT bool From f07659bdbf3d6b790d58e2b895e2c55f163ed979 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 12:54:55 +0100 Subject: [PATCH 0285/2300] [nrf fromtree] arch: riscv: idle: trace idle and call wfi While going to idle may require SoC specific implementations, provide a more sensible default implementation. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 5fb6e267f629dedb8382da6bcad8018b1bb8930a) (cherry picked from commit f1267f855e15141fb43c3e4a4e5a9cdaa692f807) --- arch/riscv/core/cpu_idle.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/arch/riscv/core/cpu_idle.c b/arch/riscv/core/cpu_idle.c index 0c7f5f3dac7..0d8e4fedeb2 100644 --- a/arch/riscv/core/cpu_idle.c +++ b/arch/riscv/core/cpu_idle.c @@ -5,24 +5,18 @@ */ #include - -/* - * In RISC-V there is no conventional way to handle CPU power save. - * Each RISC-V SOC handles it in its own way. - * Hence, by default, arch_cpu_idle and arch_cpu_atomic_idle functions just - * unlock interrupts and return to the caller, without issuing any CPU power - * saving instruction. - * - * Nonetheless, define the default arch_cpu_idle and arch_cpu_atomic_idle - * functions as weak functions, so that they can be replaced at the SOC-level. - */ +#include void __weak arch_cpu_idle(void) { + sys_trace_idle(); irq_unlock(MSTATUS_IEN); + __asm__ volatile("wfi"); } void __weak arch_cpu_atomic_idle(unsigned int key) { + sys_trace_idle(); irq_unlock(key); + __asm__ volatile("wfi"); } From 263d40bf3444039a1279db342beb9eb589ccfde8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 12:56:27 +0100 Subject: [PATCH 0286/2300] [nrf fromtree] soc: riscv: espressif_esp32: use arch idle It is equivalent to the provided custom implementation. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 1dbcef9d3c98dc84148572d91600a4a87e69cc93) (cherry picked from commit 44bd379ddbea148f0057f6cae8ba83a37a983303) --- .../espressif_esp32/esp32c3/CMakeLists.txt | 1 - soc/riscv/espressif_esp32/esp32c3/idle.c | 27 ------------------- 2 files changed, 28 deletions(-) delete mode 100644 soc/riscv/espressif_esp32/esp32c3/idle.c diff --git a/soc/riscv/espressif_esp32/esp32c3/CMakeLists.txt b/soc/riscv/espressif_esp32/esp32c3/CMakeLists.txt index e97f71751ef..d6772eacbfc 100644 --- a/soc/riscv/espressif_esp32/esp32c3/CMakeLists.txt +++ b/soc/riscv/espressif_esp32/esp32c3/CMakeLists.txt @@ -1,7 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_sources( - idle.c vectors.S soc_irq.S soc_irq.c diff --git a/soc/riscv/espressif_esp32/esp32c3/idle.c b/soc/riscv/espressif_esp32/esp32c3/idle.c deleted file mode 100644 index 1bfb2832187..00000000000 --- a/soc/riscv/espressif_esp32/esp32c3/idle.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -/** - * @brief Power save idle routine - * - * This function will be called by the kernel idle loop or possibly within - * an implementation of _pm_save_idle in the kernel when the - * '_pm_save_flag' variable is non-zero. - */ -void arch_cpu_idle(void) -{ - /* curiously it arrives here with the interrupts masked - * so umask it before wait for an event - */ - arch_irq_unlock(MSTATUS_IEN); - - /* Wait for interrupt */ - __asm__ volatile("wfi"); -} From a71821dcc658aefe42a6628fd5b3dfbc4f0b5e8c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 12:57:35 +0100 Subject: [PATCH 0287/2300] [nrf fromtree] soc: riscv: riscv-privileged: remove redundant idle implementation Default RISC-V arch level implementation is equivalent. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 7631e0ddfaa9ff2f286fb11983cbab2db510f900) (cherry picked from commit 4a6f191b29bb7e174570204dcba12a1d892cdabb) --- soc/riscv/common/riscv-privileged/idle.c | 53 ------------------------ 1 file changed, 53 deletions(-) delete mode 100644 soc/riscv/common/riscv-privileged/idle.c diff --git a/soc/riscv/common/riscv-privileged/idle.c b/soc/riscv/common/riscv-privileged/idle.c deleted file mode 100644 index e61ce72b280..00000000000 --- a/soc/riscv/common/riscv-privileged/idle.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017 Jean-Paul Etienne - * Contributors: 2018 Antmicro - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include - -static ALWAYS_INLINE void riscv_idle(unsigned int key) -{ - sys_trace_idle(); - /* unlock interrupts */ - irq_unlock(key); - - /* Wait for interrupt */ - __asm__ volatile("wfi"); -} - -/** - * @brief Power save idle routine - * - * This function will be called by the kernel idle loop or possibly within - * an implementation of _pm_save_idle in the kernel when the - * '_pm_save_flag' variable is non-zero. - */ -void arch_cpu_idle(void) -{ - riscv_idle(MSTATUS_IEN); -} - -/** - * @brief Atomically re-enable interrupts and enter low power mode - * - * INTERNAL - * The requirements for arch_cpu_atomic_idle() are as follows: - * 1) The enablement of interrupts and entering a low-power mode needs to be - * atomic, i.e. there should be no period of time where interrupts are - * enabled before the processor enters a low-power mode. See the comments - * in k_lifo_get(), for example, of the race condition that - * occurs if this requirement is not met. - * - * 2) After waking up from the low-power mode, the interrupt lockout state - * must be restored as indicated in the 'imask' input parameter. - */ -void arch_cpu_atomic_idle(unsigned int key) -{ - riscv_idle(key); -} From 8b1b13b3d575e286ebcd9722870a88df41c38a46 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 13:05:28 +0100 Subject: [PATCH 0288/2300] [nrf fromtree] arch: riscv: drop RISCV_HAS_CPU_IDLE Because it was exclusively used by the "common" RISC-V privileged code to build CPU idle routines that are now handled by arch level code. Also, all platforms defaulted to "y", making it pointless in practice. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit f885763b507a29431c5b6dbdb44a410ec88c76bf) (cherry picked from commit b1f37d65806ffb636e4a06fd08726f7a89f9fea5) --- arch/riscv/Kconfig | 5 ----- soc/riscv/andes_v5/ae350/Kconfig.defconfig.series | 3 --- soc/riscv/efinix_sapphire/Kconfig.defconfig | 4 ---- soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 | 3 --- soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series | 3 --- soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series | 3 --- soc/riscv/litex_vexriscv/Kconfig.defconfig | 3 --- soc/riscv/microchip_miv/miv/Kconfig.defconfig.series | 3 --- soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series | 3 --- soc/riscv/neorv32/Kconfig.defconfig | 3 --- soc/riscv/opentitan/Kconfig.defconfig | 3 --- soc/riscv/renode_virt/Kconfig.defconfig | 3 --- soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series | 3 --- soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series | 3 --- soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series | 3 --- soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series | 3 --- soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series | 4 ---- soc/riscv/virt/Kconfig.defconfig | 3 --- tests/kernel/context/src/main.c | 7 +++---- 19 files changed, 3 insertions(+), 62 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 80249670d09..60d33b18071 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -174,11 +174,6 @@ config RISCV_GENERIC_TOOLCHAIN Allow SOCs that have custom extended riscv ISA to still compile with generic riscv32 toolchain. -config RISCV_HAS_CPU_IDLE - bool "Does SOC has CPU IDLE instruction" - help - Does SOC has CPU IDLE instruction - config GEN_ISR_TABLES default y diff --git a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series index 7bd679e5f45..699e54e66b8 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series +++ b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series @@ -24,9 +24,6 @@ config RISCV_GENERIC_TOOLCHAIN config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/soc/riscv/efinix_sapphire/Kconfig.defconfig b/soc/riscv/efinix_sapphire/Kconfig.defconfig index 7018c0f11fb..08e2c851a21 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.defconfig +++ b/soc/riscv/efinix_sapphire/Kconfig.defconfig @@ -9,10 +9,6 @@ config SOC config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 -config RISCV_HAS_CPU_IDLE - bool - default y - config RISCV_SOC_INTERRUPT_INIT bool default y diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 index 1e93f2703b2..4d65e4c43cd 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 @@ -20,9 +20,6 @@ config RISCV_SOC_MCAUSE_EXCEPTION_MASK config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_GP default y diff --git a/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series b/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series index 8e8ea255202..15e98314c89 100644 --- a/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series +++ b/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config NUM_IRQS # Platform interrupts IRQs index start from index 16 default 32 -config RISCV_HAS_CPU_IDLE - default y - config RISCV_GP default y diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series index 7c5bc0ee897..0ed7358b631 100644 --- a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series +++ b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series @@ -22,9 +22,6 @@ config UART_NS16550_WA_ISR_REENABLE_INTERRUPT default y depends on UART_NS16550 -config RISCV_HAS_CPU_IDLE - default y - config FLASH_INIT_PRIORITY default 0 diff --git a/soc/riscv/litex_vexriscv/Kconfig.defconfig b/soc/riscv/litex_vexriscv/Kconfig.defconfig index 3efdf200ee7..f3e4c7cc79c 100644 --- a/soc/riscv/litex_vexriscv/Kconfig.defconfig +++ b/soc/riscv/litex_vexriscv/Kconfig.defconfig @@ -9,9 +9,6 @@ config SOC config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 -config RISCV_HAS_CPU_IDLE - bool - config RISCV_HAS_PLIC bool diff --git a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series index ef161321a5b..fc5aaa7c186 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series @@ -11,9 +11,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series index 0e5629927ae..f41ae867153 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series @@ -14,9 +14,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/soc/riscv/neorv32/Kconfig.defconfig b/soc/riscv/neorv32/Kconfig.defconfig index 86aed551f5d..bc37ea74727 100644 --- a/soc/riscv/neorv32/Kconfig.defconfig +++ b/soc/riscv/neorv32/Kconfig.defconfig @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config NUM_IRQS default 32 -config RISCV_HAS_CPU_IDLE - default y - config RISCV_GP default y diff --git a/soc/riscv/opentitan/Kconfig.defconfig b/soc/riscv/opentitan/Kconfig.defconfig index cc27b7ffd6b..4ec6bffc4e7 100644 --- a/soc/riscv/opentitan/Kconfig.defconfig +++ b/soc/riscv/opentitan/Kconfig.defconfig @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/soc/riscv/renode_virt/Kconfig.defconfig b/soc/riscv/renode_virt/Kconfig.defconfig index 89e226edbb1..5d2cd649b0b 100644 --- a/soc/riscv/renode_virt/Kconfig.defconfig +++ b/soc/riscv/renode_virt/Kconfig.defconfig @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series index b2f16e5261d..661fe4ba1eb 100644 --- a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series index d6b94678686..3db750cb1a6 100644 --- a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series index 347ac14b551..83165d58870 100644 --- a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series index 77436b593e1..2dc45e1f347 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series index 23a78c9f0da..5b62959858e 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series @@ -15,10 +15,6 @@ config RISCV_SOC_INTERRUPT_INIT bool default y -config RISCV_HAS_CPU_IDLE - bool - default y - config RISCV_HAS_PLIC bool default y diff --git a/soc/riscv/virt/Kconfig.defconfig b/soc/riscv/virt/Kconfig.defconfig index 9773586e922..e0982bc185b 100644 --- a/soc/riscv/virt/Kconfig.defconfig +++ b/soc/riscv/virt/Kconfig.defconfig @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_CPU_IDLE - default y - config RISCV_HAS_PLIC default y diff --git a/tests/kernel/context/src/main.c b/tests/kernel/context/src/main.c index 2e3ad1a36c9..a138e012280 100644 --- a/tests/kernel/context/src/main.c +++ b/tests/kernel/context/src/main.c @@ -72,11 +72,10 @@ extern const int32_t z_sys_timer_irq_for_test; #endif -/* Cortex-M1, Nios II, and RISCV without CONFIG_RISCV_HAS_CPU_IDLE - * do have a power saving instruction, so k_cpu_idle() returns immediately +/* Cortex-M1 and Nios II do have a power saving instruction, so k_cpu_idle() + * returns immediately */ -#if !defined(CONFIG_CPU_CORTEX_M1) && !defined(CONFIG_NIOS2) && \ - (!defined(CONFIG_RISCV) || defined(CONFIG_RISCV_HAS_CPU_IDLE)) +#if !defined(CONFIG_CPU_CORTEX_M1) && !defined(CONFIG_NIOS2) #define HAS_POWERSAVE_INSTRUCTION #endif From 4c1b24d100f760ad9fecf9f3c5ace2831222eb3e Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 13 Dec 2023 12:53:49 -0500 Subject: [PATCH 0289/2300] [nrf fromtree] arch: introduce arch_smp_init Introduce a new arch interface for intializing smp. Signed-off-by: Anas Nashif (cherry picked from commit 37f427a5c728855767bd77291f58f078ad4d0a4b) (cherry picked from commit 8d3c0379e09ca9afd962109afc3c61becfa9e93d) --- arch/arc/core/arc_smp.c | 5 ++--- arch/arm/core/cortex_a_r/smp.c | 4 ++-- arch/arm64/core/prep_c.c | 1 + arch/arm64/core/smp.c | 4 ++-- arch/riscv/core/smp.c | 5 ++--- arch/x86/core/intel64/irq.c | 6 +++++- arch/x86/core/prep_c.c | 2 +- include/zephyr/sys/arch_interface.h | 3 +++ 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/arch/arc/core/arc_smp.c b/arch/arc/core/arc_smp.c index 9fb43c41152..1aa61be53f0 100644 --- a/arch/arc/core/arc_smp.c +++ b/arch/arc/core/arc_smp.c @@ -145,7 +145,7 @@ void arch_sched_ipi(void) } } -static int arc_smp_init(void) +int arch_smp_init(void) { struct arc_connect_bcr bcr; @@ -188,6 +188,5 @@ static int arc_smp_init(void) return 0; } - -SYS_INIT(arc_smp_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(arch_smp_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #endif diff --git a/arch/arm/core/cortex_a_r/smp.c b/arch/arm/core/cortex_a_r/smp.c index 2aeb36c1735..c17f2fa048f 100644 --- a/arch/arm/core/cortex_a_r/smp.c +++ b/arch/arm/core/cortex_a_r/smp.c @@ -245,7 +245,7 @@ void arch_sched_ipi(void) broadcast_ipi(SGI_SCHED_IPI); } -static int arm_smp_init(void) +int arch_smp_init(void) { cpu_map[0] = MPIDR_TO_CORE(GET_MPIDR()); @@ -259,6 +259,6 @@ static int arm_smp_init(void) return 0; } -SYS_INIT(arm_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(arch_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #endif diff --git a/arch/arm64/core/prep_c.c b/arch/arm64/core/prep_c.c index c12d5e7d1c4..510476d2ef7 100644 --- a/arch/arm64/core/prep_c.c +++ b/arch/arm64/core/prep_c.c @@ -69,6 +69,7 @@ void z_arm64_prep_c(void) CODE_UNREACHABLE; } + #if CONFIG_MP_MAX_NUM_CPUS > 1 extern FUNC_NORETURN void z_arm64_secondary_start(void); void z_arm64_secondary_prep_c(void) diff --git a/arch/arm64/core/smp.c b/arch/arm64/core/smp.c index e67032eb2a4..043e07eb305 100644 --- a/arch/arm64/core/smp.c +++ b/arch/arm64/core/smp.c @@ -279,7 +279,7 @@ void arch_spin_relax(void) } #endif -static int arm64_smp_init(void) +int arch_smp_init(void) { cpu_map[0] = MPIDR_TO_CORE(GET_MPIDR()); @@ -302,6 +302,6 @@ static int arm64_smp_init(void) return 0; } -SYS_INIT(arm64_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(arch_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #endif diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 6154450e58d..3294f9006f3 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -151,7 +151,7 @@ void arch_spin_relax(void) } #endif -static int riscv_smp_init(void) +int arch_smp_init(void) { IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 0, ipi_handler, NULL, 0); @@ -159,6 +159,5 @@ static int riscv_smp_init(void) return 0; } - -SYS_INIT(riscv_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(arch_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #endif /* CONFIG_SMP */ diff --git a/arch/x86/core/intel64/irq.c b/arch/x86/core/intel64/irq.c index a7304271746..09b1961585c 100644 --- a/arch/x86/core/intel64/irq.c +++ b/arch/x86/core/intel64/irq.c @@ -14,6 +14,7 @@ #include #include #include +#include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); @@ -154,7 +155,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter) #if defined(CONFIG_SMP) -void z_x86_ipi_setup(void) +int arch_smp_init(void) { /* * z_sched_ipi() doesn't have the same signature as a typical ISR, so @@ -166,8 +167,11 @@ void z_x86_ipi_setup(void) /* TLB shootdown handling */ x86_irq_funcs[CONFIG_TLB_IPI_VECTOR - IV_IRQS] = z_x86_tlb_ipi; + return 0; } +SYS_INIT(arch_smp_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); + /* * it is not clear exactly how/where/why to abstract this, as it * assumes the use of a local APIC (but there's no other mechanism). diff --git a/arch/x86/core/prep_c.c b/arch/x86/core/prep_c.c index ee095efe33d..8f7618495a9 100644 --- a/arch/x86/core/prep_c.c +++ b/arch/x86/core/prep_c.c @@ -74,7 +74,7 @@ FUNC_NORETURN void z_x86_prep_c(void *arg) #endif #if defined(CONFIG_SMP) - z_x86_ipi_setup(); + arch_smp_init(); #endif z_cstart(); diff --git a/include/zephyr/sys/arch_interface.h b/include/zephyr/sys/arch_interface.h index e694bce55cc..722bacd76d5 100644 --- a/include/zephyr/sys/arch_interface.h +++ b/include/zephyr/sys/arch_interface.h @@ -495,6 +495,9 @@ static inline uint32_t arch_proc_id(void); */ void arch_sched_ipi(void); + +int arch_smp_init(void); + #endif /* CONFIG_SMP */ /** From 3ed0f6c4367ce2b4e274dadaad55df5633e6f989 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 13 Dec 2023 13:23:56 -0500 Subject: [PATCH 0290/2300] [nrf fromtree] arch: ipi_handler -> sched_ipi_handler unifiy naming for ipi handler call and use the same signature everywhere. Signed-off-by: Anas Nashif (cherry picked from commit 17080d0215c906082f6b669d0f762241c50739eb) (cherry picked from commit d8562de468436950c76ae4dac0a71cfed8033559) --- arch/riscv/core/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 3294f9006f3..4e9cdb55f48 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -104,7 +104,7 @@ void z_riscv_flush_fpu_ipi(unsigned int cpu) } #endif -static void ipi_handler(const void *unused) +static void sched_ipi_handler(const void *unused) { ARG_UNUSED(unused); @@ -154,7 +154,7 @@ void arch_spin_relax(void) int arch_smp_init(void) { - IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 0, ipi_handler, NULL, 0); + IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 0, sched_ipi_handler, NULL, 0); irq_enable(RISCV_MACHINE_SOFT_IRQ); return 0; From 869bb72f1c9efe630e7631d5a14b0ec49beb2427 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 15:38:15 +0100 Subject: [PATCH 0291/2300] [nrf fromtree] arch: riscv: define some RISC-V exception codes As defined in Table 3.6 of "The RISC-V Instruction Set Manual, Volume II: Privileged Architecture". Delete all spread definitions of the same, weirdly prefixed with "SOC". Signed-off-by: Gerard Marull-Paretas (cherry picked from commit fcbfe74df1a52a92c9f10d8aedb0f9199d92dbbf) (cherry picked from commit 7714efd77be6352889afb4d7ebd21f516cc47f2f) --- arch/riscv/core/isr.S | 9 +++++---- include/zephyr/arch/riscv/irq.h | 15 ++++++++++++--- soc/riscv/common/riscv-privileged/soc_common.h | 4 ---- soc/riscv/espressif_esp32/esp32c3/soc.h | 5 +---- soc/riscv/ite_ec/common/soc_common.h | 3 --- soc/riscv/openisa_rv32m1/soc_ri5cy.h | 2 -- soc/riscv/openisa_rv32m1/soc_zero_riscy.h | 3 --- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index c36679ae6db..a4db1ff053b 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "asm_macros.inc" @@ -298,18 +299,18 @@ no_fp: /* increment _current->arch.exception_depth */ and t0, t0, t2 /* - * If mcause == SOC_MCAUSE_ECALL_EXP, handle system call from + * If mcause == RISCV_EXC_ECALLM, handle system call from * kernel thread. */ - li t1, SOC_MCAUSE_ECALL_EXP + li t1, RISCV_EXC_ECALLM beq t0, t1, is_kernel_syscall #ifdef CONFIG_USERSPACE /* - * If mcause == SOC_MCAUSE_USER_ECALL_EXP, handle system call + * If mcause == RISCV_EXC_ECALLU, handle system call * for user mode thread. */ - li t1, SOC_MCAUSE_USER_ECALL_EXP + li t1, RISCV_EXC_ECALLU beq t0, t1, is_user_syscall #endif /* CONFIG_USERSPACE */ diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index 77c0d4057aa..2e3e813872e 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -14,16 +14,25 @@ #ifndef ZEPHYR_INCLUDE_ARCH_RISCV_IRQ_H_ #define ZEPHYR_INCLUDE_ARCH_RISCV_IRQ_H_ -#ifndef _ASMLANGUAGE - #ifdef __cplusplus extern "C" { #endif +#ifndef _ASMLANGUAGE #include #include #include #include +#endif /* !_ASMLANGUAGE */ + +/* Exceptions 0-15 (MCAUSE interrupt=0) */ + +/* Environment Call from U-mode */ +#define RISCV_EXC_ECALLU 8 +/** Environment Call from M-mode */ +#define RISCV_EXC_ECALLM 11 + +#ifndef _ASMLANGUAGE extern void arch_irq_enable(unsigned int irq); extern void arch_irq_disable(unsigned int irq); @@ -102,10 +111,10 @@ static inline void arch_isr_direct_footer(int swap) } \ static inline int name##_body(void) +#endif /* _ASMLANGUAGE */ #ifdef __cplusplus } #endif -#endif /* _ASMLANGUAGE */ #endif /* ZEPHYR_INCLUDE_ARCH_RISCV_IRQ_H_ */ diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index 79f458924c6..27eed85c684 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -16,10 +16,6 @@ #define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ -/* ECALL Exception numbers */ -#define SOC_MCAUSE_ECALL_EXP 11 /* Machine ECALL instruction */ -#define SOC_MCAUSE_USER_ECALL_EXP 8 /* User ECALL instruction */ - /* SOC-specific MCAUSE bitfields */ #ifdef CONFIG_64BIT /* Interrupt Mask */ diff --git a/soc/riscv/espressif_esp32/esp32c3/soc.h b/soc/riscv/espressif_esp32/esp32c3/soc.h index a3709819abc..4d8904c5b2a 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc.h +++ b/soc/riscv/espressif_esp32/esp32c3/soc.h @@ -21,12 +21,9 @@ #define RISCV_MACHINE_TIMER_IRQ 7 /* Machine Timer Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ -/* ECALL Exception numbers */ -#define SOC_MCAUSE_ECALL_EXP 11 /* Machine ECALL instruction */ -#define SOC_MCAUSE_USER_ECALL_EXP 8 /* User ECALL instruction */ - /* Interrupt Mask */ #define SOC_MCAUSE_IRQ_MASK (1 << 31) + /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF diff --git a/soc/riscv/ite_ec/common/soc_common.h b/soc/riscv/ite_ec/common/soc_common.h index 5b981783164..0504118199a 100644 --- a/soc/riscv/ite_ec/common/soc_common.h +++ b/soc/riscv/ite_ec/common/soc_common.h @@ -22,9 +22,6 @@ /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF -/* Exception code of environment call from M-mode */ -#define SOC_MCAUSE_ECALL_EXP 11 - #ifndef _ASMLANGUAGE #ifdef CONFIG_HAS_ITE_INTC diff --git a/soc/riscv/openisa_rv32m1/soc_ri5cy.h b/soc/riscv/openisa_rv32m1/soc_ri5cy.h index 27ebcbe6f35..12a001defba 100644 --- a/soc/riscv/openisa_rv32m1/soc_ri5cy.h +++ b/soc/riscv/openisa_rv32m1/soc_ri5cy.h @@ -55,6 +55,4 @@ */ #define SOC_MCAUSE_EXP_MASK 0x1F -/* The ecall exception number. This is a standard value. */ -#define SOC_MCAUSE_ECALL_EXP 11 #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_RI5CY_H_ */ diff --git a/soc/riscv/openisa_rv32m1/soc_zero_riscy.h b/soc/riscv/openisa_rv32m1/soc_zero_riscy.h index d5fa48297f7..4453b3665f6 100644 --- a/soc/riscv/openisa_rv32m1/soc_zero_riscy.h +++ b/soc/riscv/openisa_rv32m1/soc_zero_riscy.h @@ -43,7 +43,4 @@ */ #define SOC_MCAUSE_EXP_MASK 0x1F -/* The ecall exception number. This is a standard value. */ -#define SOC_MCAUSE_ECALL_EXP 11 - #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_ZERO_RISCY_H_ */ From b9720babe23ddcaf4b497c7a1798ae752b653241 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 13:39:29 +0100 Subject: [PATCH 0292/2300] [nrf fromtree] soc: riscv: cleanup usage/definition of MCAUSE IRQ flag The MCAUSE register has the "Interrupt" flag defined defined at XLEN-1 position (31 for 32-bit, 63 for 64-bit). This is not an SoC specific option, and there's no need to expose it publicly. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit a364420b30f96df97cc7a50b4674eaee6ce2e918) (cherry picked from commit 66f9e1e7be188e61f3b3d3a2e028e9a897675d68) --- include/zephyr/arch/riscv/irq.h | 6 ++++++ soc/riscv/common/riscv-privileged/soc_common.h | 9 --------- soc/riscv/common/riscv-privileged/soc_irq.S | 4 ++-- soc/riscv/espressif_esp32/esp32c3/soc.h | 3 --- soc/riscv/ite_ec/common/soc_common.h | 3 --- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index 2e3e813872e..f0b1f88642d 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -32,6 +32,12 @@ extern "C" { /** Environment Call from M-mode */ #define RISCV_EXC_ECALLM 11 +#ifdef CONFIG_64BIT +#define RISCV_MCAUSE_IRQ_BIT (1 << 63) +#else +#define RISCV_MCAUSE_IRQ_BIT (1 << 31) +#endif + #ifndef _ASMLANGUAGE extern void arch_irq_enable(unsigned int irq); diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index 27eed85c684..8b993c8a946 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -16,15 +16,6 @@ #define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ -/* SOC-specific MCAUSE bitfields */ -#ifdef CONFIG_64BIT -/* Interrupt Mask */ -#define SOC_MCAUSE_IRQ_MASK (1 << 63) -#else -/* Interrupt Mask */ -#define SOC_MCAUSE_IRQ_MASK (1 << 31) -#endif - /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK CONFIG_RISCV_SOC_MCAUSE_EXCEPTION_MASK diff --git a/soc/riscv/common/riscv-privileged/soc_irq.S b/soc/riscv/common/riscv-privileged/soc_irq.S index 73fc24431d5..377edbf600d 100644 --- a/soc/riscv/common/riscv-privileged/soc_irq.S +++ b/soc/riscv/common/riscv-privileged/soc_irq.S @@ -12,7 +12,7 @@ #include #include #include -#include +#include /* * __soc_handle_irq is defined as .weak to allow re-implementation by @@ -48,7 +48,7 @@ WTEXT(__soc_is_irq) SECTION_FUNC(exception.other, __soc_is_irq) /* Read mcause and check if interrupt bit is set */ csrr t0, mcause - li t1, SOC_MCAUSE_IRQ_MASK + li t1, RISCV_MCAUSE_IRQ_BIT and t0, t0, t1 /* If interrupt bit is not set, return with 0 */ diff --git a/soc/riscv/espressif_esp32/esp32c3/soc.h b/soc/riscv/espressif_esp32/esp32c3/soc.h index 4d8904c5b2a..6f6c9263da2 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc.h +++ b/soc/riscv/espressif_esp32/esp32c3/soc.h @@ -21,9 +21,6 @@ #define RISCV_MACHINE_TIMER_IRQ 7 /* Machine Timer Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ -/* Interrupt Mask */ -#define SOC_MCAUSE_IRQ_MASK (1 << 31) - /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF diff --git a/soc/riscv/ite_ec/common/soc_common.h b/soc/riscv/ite_ec/common/soc_common.h index 0504118199a..b50f16df0fb 100644 --- a/soc/riscv/ite_ec/common/soc_common.h +++ b/soc/riscv/ite_ec/common/soc_common.h @@ -16,9 +16,6 @@ /* SOC-specific MCAUSE bitfields */ -/* Interrupt Mask. 1 (interrupt) or 0 (exception) */ -#define SOC_MCAUSE_IRQ_MASK BIT(31) - /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF From dbe994dd4b9f951731ae8c35db419d08295c6e4d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 15:50:18 +0100 Subject: [PATCH 0293/2300] [nrf fromtree] soc: riscv: gd32vf103: simplify MCAUSE exception mask handling The exception mask needs to cover MCAUSE bits 11:0, there's no need to overengineer this setting using DT properties. Ref. https://doc.nucleisys.com/nuclei_spec/isa/core_csr.html#mcause Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 6edb0624d8549339ed08dfeb19fe471be556d3ff) (cherry picked from commit 3df1eadf7e1cf8d712d938bcb6c39eed009ae7d6) --- dts/bindings/cpu/nuclei,bumblebee.yaml | 6 ------ dts/riscv/gigadevice/gd32vf103.dtsi | 1 - soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/dts/bindings/cpu/nuclei,bumblebee.yaml b/dts/bindings/cpu/nuclei,bumblebee.yaml index 8c9dfc7d35d..96eebcd0fb8 100644 --- a/dts/bindings/cpu/nuclei,bumblebee.yaml +++ b/dts/bindings/cpu/nuclei,bumblebee.yaml @@ -6,9 +6,3 @@ description: Nuclei Bumblebee RISC-V Core compatible: "nuclei,bumblebee" include: riscv,cpus.yaml - -properties: - mcause-exception-mask: - type: int - required: true - description: Specify the bits to use for exception code in mcause register. diff --git a/dts/riscv/gigadevice/gd32vf103.dtsi b/dts/riscv/gigadevice/gd32vf103.dtsi index c9f37db5180..b52aee61fbc 100644 --- a/dts/riscv/gigadevice/gd32vf103.dtsi +++ b/dts/riscv/gigadevice/gd32vf103.dtsi @@ -23,7 +23,6 @@ cpu: cpu@0 { clock-frequency = ; - mcause-exception-mask = <0x7ff>; compatible = "nuclei,bumblebee"; riscv,isa = "rv32imac_zicsr_zifencei"; reg = <0>; diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 index 4d65e4c43cd..ade07b45635 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 @@ -15,7 +15,7 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC default 27000000 config RISCV_SOC_MCAUSE_EXCEPTION_MASK - default $(dt_node_int_prop_hex,/cpus/cpu@0,mcause-exception-mask) + default 0xFFF config RISCV_SOC_INTERRUPT_INIT default y From a6c91c4d1060a6da084010a500840c32d48f95ea Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 15:53:24 +0100 Subject: [PATCH 0294/2300] [nrf fromtree] arch: riscv: remove SOC from RISCV_SOC_MCAUSE_EXCEPTION_MASK Just to stay consistent with other RISC-V related settings. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit ee6097795855c8752d2060f8cb5a5cad0d7b7dd3) (cherry picked from commit d6a51f75244642b5afc4e152c19b2536b5f01f2e) --- arch/riscv/Kconfig | 2 +- soc/riscv/common/riscv-privileged/soc_common.h | 2 +- soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 60d33b18071..1c5defbacaf 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -159,7 +159,7 @@ config RISCV_SOC_INTERRUPT_INIT Enable SOC-based interrupt initialization (call soc_interrupt_init, within _IntLibInit when enabled) -config RISCV_SOC_MCAUSE_EXCEPTION_MASK +config RISCV_MCAUSE_EXCEPTION_MASK hex default 0x7FFFFFFFFFFFFFFF if 64BIT default 0x7FFFFFFF diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index 8b993c8a946..6e75d4acf06 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -17,7 +17,7 @@ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ /* Exception code Mask */ -#define SOC_MCAUSE_EXP_MASK CONFIG_RISCV_SOC_MCAUSE_EXCEPTION_MASK +#define SOC_MCAUSE_EXP_MASK CONFIG_RISCV_MCAUSE_EXCEPTION_MASK #ifndef _ASMLANGUAGE diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 index ade07b45635..0da92e80e36 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 @@ -14,7 +14,7 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC # The CPU frequency is set to the maximum value of 108MHz by default. default 27000000 -config RISCV_SOC_MCAUSE_EXCEPTION_MASK +config RISCV_MCAUSE_EXCEPTION_MASK default 0xFFF config RISCV_SOC_INTERRUPT_INIT From 1f4a165509b0e2aabd6a52d03469ab6a12722997 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 16:11:51 +0100 Subject: [PATCH 0295/2300] [nrf fromtree] arch: riscv: use CONFIG_RISCV_MCAUSE_EXCEPTION_MASK Instead of custom SOC_MCAUSE_EXP_MASK definition. Note that SoCs selecting RISCV_PRIVILEGED already used such config indirectly (see changes in soc_common.h). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 452a2f67cdac4d076a481f584d0f7d658e806cde) (cherry picked from commit 326c5229ff4931933cb3e4e44560df2af356cff5) --- arch/riscv/core/fatal.c | 2 +- arch/riscv/core/irq_manage.c | 2 +- arch/riscv/core/isr.S | 4 ++-- include/zephyr/arch/riscv/irq.h | 2 +- soc/riscv/common/riscv-privileged/soc_common.h | 3 --- soc/riscv/espressif_esp32/esp32c3/soc.h | 3 --- soc/riscv/ite_ec/common/soc_common.h | 5 ----- soc/riscv/openisa_rv32m1/Kconfig.defconfig | 3 +++ soc/riscv/openisa_rv32m1/soc_ri5cy.h | 15 --------------- soc/riscv/openisa_rv32m1/soc_zero_riscy.h | 15 --------------- 10 files changed, 8 insertions(+), 46 deletions(-) diff --git a/arch/riscv/core/fatal.c b/arch/riscv/core/fatal.c index 171497ff0ca..6e8831f1026 100644 --- a/arch/riscv/core/fatal.c +++ b/arch/riscv/core/fatal.c @@ -167,7 +167,7 @@ void _Fault(z_arch_esf_t *esf) __asm__ volatile("csrr %0, mtval" : "=r" (mtval)); #endif - mcause &= SOC_MCAUSE_EXP_MASK; + mcause &= CONFIG_RISCV_MCAUSE_EXCEPTION_MASK; LOG_ERR(""); LOG_ERR(" mcause: %ld, %s", mcause, cause_str(mcause)); #ifndef CONFIG_SOC_OPENISA_RV32M1_RISCV32 diff --git a/arch/riscv/core/irq_manage.c b/arch/riscv/core/irq_manage.c index e0ef1374bf1..6ed5781c731 100644 --- a/arch/riscv/core/irq_manage.c +++ b/arch/riscv/core/irq_manage.c @@ -20,7 +20,7 @@ FUNC_NORETURN void z_irq_spurious(const void *unused) mcause = csr_read(mcause); - mcause &= SOC_MCAUSE_EXP_MASK; + mcause &= CONFIG_RISCV_MCAUSE_EXCEPTION_MASK; LOG_ERR("Spurious interrupt detected! IRQ: %ld", mcause); #if defined(CONFIG_RISCV_HAS_PLIC) diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index a4db1ff053b..558d2a41fbe 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -295,7 +295,7 @@ no_fp: /* increment _current->arch.exception_depth */ * to report the exception. */ csrr t0, mcause - li t2, SOC_MCAUSE_EXP_MASK + li t2, CONFIG_RISCV_MCAUSE_EXCEPTION_MASK and t0, t0, t2 /* @@ -528,7 +528,7 @@ on_irq_stack: /* Get IRQ causing interrupt */ csrr a0, mcause - li t0, SOC_MCAUSE_EXP_MASK + li t0, CONFIG_RISCV_MCAUSE_EXCEPTION_MASK and a0, a0, t0 /* diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index f0b1f88642d..d4dfd54d92a 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -91,7 +91,7 @@ static inline void arch_isr_direct_footer(int swap) /* Get the IRQ number */ __asm__ volatile("csrr %0, mcause" : "=r" (mcause)); - mcause &= SOC_MCAUSE_EXP_MASK; + mcause &= CONFIG_RISCV_MCAUSE_EXCEPTION_MASK; /* Clear the pending IRQ */ __soc_handle_irq(mcause); diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index 6e75d4acf06..01a6b783850 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -16,9 +16,6 @@ #define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ -/* Exception code Mask */ -#define SOC_MCAUSE_EXP_MASK CONFIG_RISCV_MCAUSE_EXCEPTION_MASK - #ifndef _ASMLANGUAGE #include diff --git a/soc/riscv/espressif_esp32/esp32c3/soc.h b/soc/riscv/espressif_esp32/esp32c3/soc.h index 6f6c9263da2..8076f2ae045 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc.h +++ b/soc/riscv/espressif_esp32/esp32c3/soc.h @@ -21,9 +21,6 @@ #define RISCV_MACHINE_TIMER_IRQ 7 /* Machine Timer Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ -/* Exception code Mask */ -#define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF - #ifndef _ASMLANGUAGE void __esp_platform_start(void); diff --git a/soc/riscv/ite_ec/common/soc_common.h b/soc/riscv/ite_ec/common/soc_common.h index b50f16df0fb..b7e0cdd5e55 100644 --- a/soc/riscv/ite_ec/common/soc_common.h +++ b/soc/riscv/ite_ec/common/soc_common.h @@ -14,11 +14,6 @@ #include "chip_chipregs.h" -/* SOC-specific MCAUSE bitfields */ - -/* Exception code Mask */ -#define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF - #ifndef _ASMLANGUAGE #ifdef CONFIG_HAS_ITE_INTC diff --git a/soc/riscv/openisa_rv32m1/Kconfig.defconfig b/soc/riscv/openisa_rv32m1/Kconfig.defconfig index 3976c9940c5..52d652a061e 100644 --- a/soc/riscv/openisa_rv32m1/Kconfig.defconfig +++ b/soc/riscv/openisa_rv32m1/Kconfig.defconfig @@ -33,6 +33,9 @@ config RISCV_SOC_OFFSETS config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_MCAUSE_EXCEPTION_MASK + default 0x1F + # We need to disable the watchdog out of reset, as it's enabled by # default. Use the WDOG_INIT hook for doing that. config WDOG_INIT diff --git a/soc/riscv/openisa_rv32m1/soc_ri5cy.h b/soc/riscv/openisa_rv32m1/soc_ri5cy.h index 12a001defba..d9158935e08 100644 --- a/soc/riscv/openisa_rv32m1/soc_ri5cy.h +++ b/soc/riscv/openisa_rv32m1/soc_ri5cy.h @@ -40,19 +40,4 @@ #define RI5CY_PRIVLV 0xC10 #define RI5CY_MHARTID 0xF14 -/* - * Map from SoC-specific configuration to generic Zephyr macros. - * - * These are expected by the code in arch/, and must be provided for - * the kernel to work (or even build at all). - * - * Some of these may also apply to ZERO-RISCY; needs investigation. - */ - -/* - * Exception code mask. Use of the bottom five bits is a subset of - * what the standard allocates (which is XLEN-1 bits). - */ -#define SOC_MCAUSE_EXP_MASK 0x1F - #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_RI5CY_H_ */ diff --git a/soc/riscv/openisa_rv32m1/soc_zero_riscy.h b/soc/riscv/openisa_rv32m1/soc_zero_riscy.h index 4453b3665f6..43cd144823a 100644 --- a/soc/riscv/openisa_rv32m1/soc_zero_riscy.h +++ b/soc/riscv/openisa_rv32m1/soc_zero_riscy.h @@ -28,19 +28,4 @@ #define ZERO_RISCY_PCMR 0x7A1U #define ZERO_RISCY_MHARTID 0xF14U -/* - * Map from SoC-specific configuration to generic Zephyr macros. - * - * These are expected by the code in arch/, and must be provided for - * the kernel to work (or even build at all). - * - * Some of these may also apply to ZERO-RISCY; needs investigation. - */ - -/* - * Exception code mask. Use of the bottom five bits is a subset of - * what the standard allocates (which is XLEN-1 bits). - */ -#define SOC_MCAUSE_EXP_MASK 0x1F - #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_ZERO_RISCY_H_ */ From e6aa4dd59d7caa7da23df5582c6e6ec625f47b2e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 16:25:05 +0100 Subject: [PATCH 0296/2300] [nrf fromtree] arch: riscv: define RISC_IRQ_MSOFT/MEXT Instead of relying on spread definitions within SoC files. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit c725c91d951874726392b60c4fd8137ca9d6b920) (cherry picked from commit 41738f5a2962ba98a74a970ff0d31f811656532b) --- arch/riscv/core/irq_manage.c | 2 +- arch/riscv/core/smp.c | 7 ++++--- drivers/interrupt_controller/intc_swerv_pic.c | 5 +++-- drivers/interrupt_controller/intc_vexriscv_litex.c | 5 +++-- drivers/mbox/mbox_andes_plic_sw.c | 4 ++-- include/zephyr/arch/riscv/irq.h | 7 +++++++ soc/riscv/common/riscv-privileged/soc_common.h | 4 ---- soc/riscv/espressif_esp32/esp32c3/soc.h | 5 ----- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/arch/riscv/core/irq_manage.c b/arch/riscv/core/irq_manage.c index 6ed5781c731..f3e0cc09ab1 100644 --- a/arch/riscv/core/irq_manage.c +++ b/arch/riscv/core/irq_manage.c @@ -24,7 +24,7 @@ FUNC_NORETURN void z_irq_spurious(const void *unused) LOG_ERR("Spurious interrupt detected! IRQ: %ld", mcause); #if defined(CONFIG_RISCV_HAS_PLIC) - if (mcause == RISCV_MACHINE_EXT_IRQ) { + if (mcause == RISCV_IRQ_MEXT) { unsigned int save_irq = riscv_plic_get_irq(); const struct device *save_dev = riscv_plic_get_dev(); diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 4e9cdb55f48..b0c2b98de81 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -9,6 +9,7 @@ #include #include #include +#include #include volatile struct { @@ -67,7 +68,7 @@ void z_riscv_secondary_cpu_init(int hartid) z_riscv_pmp_init(); #endif #ifdef CONFIG_SMP - irq_enable(RISCV_MACHINE_SOFT_IRQ); + irq_enable(RISCV_IRQ_MSOFT); #endif riscv_cpu_init[cpu_num].fn(riscv_cpu_init[cpu_num].arg); } @@ -154,8 +155,8 @@ void arch_spin_relax(void) int arch_smp_init(void) { - IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 0, sched_ipi_handler, NULL, 0); - irq_enable(RISCV_MACHINE_SOFT_IRQ); + IRQ_CONNECT(RISCV_IRQ_MSOFT, 0, sched_ipi_handler, NULL, 0); + irq_enable(RISCV_IRQ_MSOFT); return 0; } diff --git a/drivers/interrupt_controller/intc_swerv_pic.c b/drivers/interrupt_controller/intc_swerv_pic.c index 5c52ab49614..96eb248d27c 100644 --- a/drivers/interrupt_controller/intc_swerv_pic.c +++ b/drivers/interrupt_controller/intc_swerv_pic.c @@ -15,6 +15,7 @@ #include #include #include +#include #define SWERV_PIC_MAX_NUM CONFIG_NUM_IRQS #define SWERV_PIC_MAX_ID (SWERV_PIC_MAX_NUM + RISCV_MAX_GENERIC_IRQ) @@ -176,14 +177,14 @@ static int swerv_pic_init(const struct device *dev) __asm__ swerv_pic_writecsr(meicurpl, 0); /* Setup IRQ handler for SweRV PIC driver */ - IRQ_CONNECT(RISCV_MACHINE_EXT_IRQ, + IRQ_CONNECT(RISCV_IRQ_MEXT, 0, swerv_pic_irq_handler, NULL, 0); /* Enable IRQ for SweRV PIC driver */ - irq_enable(RISCV_MACHINE_EXT_IRQ); + irq_enable(RISCV_IRQ_MEXT); return 0; } diff --git a/drivers/interrupt_controller/intc_vexriscv_litex.c b/drivers/interrupt_controller/intc_vexriscv_litex.c index efec4d2478e..2d5d2233ab2 100644 --- a/drivers/interrupt_controller/intc_vexriscv_litex.c +++ b/drivers/interrupt_controller/intc_vexriscv_litex.c @@ -11,6 +11,7 @@ #include #include #include +#include #define IRQ_MASK DT_INST_REG_ADDR_BY_NAME(0, irq_mask) #define IRQ_PENDING DT_INST_REG_ADDR_BY_NAME(0, irq_pending) @@ -122,9 +123,9 @@ int arch_irq_is_enabled(unsigned int irq) static int vexriscv_litex_irq_init(const struct device *dev) { __asm__ volatile ("csrrs x0, mie, %0" - :: "r"(1 << RISCV_MACHINE_EXT_IRQ)); + :: "r"(1 << RISCV_IRQ_MEXT)); vexriscv_litex_irq_setie(1); - IRQ_CONNECT(RISCV_MACHINE_EXT_IRQ, 0, vexriscv_litex_irq_handler, + IRQ_CONNECT(RISCV_IRQ_MEXT, 0, vexriscv_litex_irq_handler, NULL, 0); return 0; diff --git a/drivers/mbox/mbox_andes_plic_sw.c b/drivers/mbox/mbox_andes_plic_sw.c index bc01da73a30..e2c287ae216 100644 --- a/drivers/mbox/mbox_andes_plic_sw.c +++ b/drivers/mbox/mbox_andes_plic_sw.c @@ -199,11 +199,11 @@ static void andes_plic_sw_irq_handler(const struct device *dev) static int mbox_andes_init(const struct device *dev) { /* Setup IRQ handler for PLIC SW driver */ - IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 1, + IRQ_CONNECT(RISCV_IRQ_MSOFT, 1, andes_plic_sw_irq_handler, DEVICE_DT_INST_GET(0), 0); #ifndef CONFIG_SMP - irq_enable(RISCV_MACHINE_SOFT_IRQ); + irq_enable(RISCV_IRQ_MSOFT); #endif return 0; } diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index d4dfd54d92a..84d3a4949a9 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -32,6 +32,13 @@ extern "C" { /** Environment Call from M-mode */ #define RISCV_EXC_ECALLM 11 +/* IRQs 0-15 (MCAUSE interrupt=1) */ + +/** Machine Software Interrupt */ +#define RISCV_IRQ_MSOFT 3 +/** Machine External Interrupt */ +#define RISCV_IRQ_MEXT 11 + #ifdef CONFIG_64BIT #define RISCV_MCAUSE_IRQ_BIT (1 << 63) #else diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index 01a6b783850..bf9600ab880 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -12,10 +12,6 @@ #ifndef __SOC_COMMON_H_ #define __SOC_COMMON_H_ -/* IRQ numbers */ -#define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ -#define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ - #ifndef _ASMLANGUAGE #include diff --git a/soc/riscv/espressif_esp32/esp32c3/soc.h b/soc/riscv/espressif_esp32/esp32c3/soc.h index 8076f2ae045..68fb6fdb1ce 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc.h +++ b/soc/riscv/espressif_esp32/esp32c3/soc.h @@ -16,11 +16,6 @@ #include "esp32c3/clk.h" #endif -/* IRQ numbers */ -#define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ -#define RISCV_MACHINE_TIMER_IRQ 7 /* Machine Timer Interrupt */ -#define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ - #ifndef _ASMLANGUAGE void __esp_platform_start(void); From 6646e3c8fba80d55325e13ad106c05349388e7da Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 16:33:19 +0100 Subject: [PATCH 0297/2300] [nrf fromtree] arch: riscv: define local soc_interrupt_init prototypes Instead of relying on messy soc.h files which are included via a fragile chain of includes. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 0addc80d102175f40acb40c8a80101a6ff5d4913) (cherry picked from commit 52e484037e39eb0cbe7d00e5d338bddbd16b5255) --- arch/riscv/core/prep_c.c | 4 ++++ arch/riscv/core/smp.c | 4 ++++ soc/riscv/common/riscv-privileged/soc_common.h | 4 ---- soc/riscv/ite_ec/it8xxx2/soc.h | 4 ---- soc/riscv/openisa_rv32m1/soc.h | 2 -- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/arch/riscv/core/prep_c.c b/arch/riscv/core/prep_c.c index 8b9b118b24c..b486b4949d8 100644 --- a/arch/riscv/core/prep_c.c +++ b/arch/riscv/core/prep_c.c @@ -20,6 +20,10 @@ #include #include +#if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) +void soc_interrupt_init(void); +#endif + /** * * @brief Prepare to and run C code diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index b0c2b98de81..928edb63d8f 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -23,6 +23,10 @@ volatile void *riscv_cpu_sp; extern void __start(void); +#if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) +void soc_interrupt_init(void); +#endif + void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, arch_cpustart_t fn, void *arg) { diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index bf9600ab880..f8f1c13cb59 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -17,10 +17,6 @@ #include #include -#if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) -void soc_interrupt_init(void); -#endif - #endif /* !_ASMLANGUAGE */ #endif /* __SOC_COMMON_H_ */ diff --git a/soc/riscv/ite_ec/it8xxx2/soc.h b/soc/riscv/ite_ec/it8xxx2/soc.h index bc790768369..ea9d30d11fc 100644 --- a/soc/riscv/ite_ec/it8xxx2/soc.h +++ b/soc/riscv/ite_ec/it8xxx2/soc.h @@ -25,8 +25,4 @@ COND_CODE_1(DT_NODE_EXISTS(DT_INST(1, ite_it8xxx2_usbpd)), (2), (1)) */ #define SOC_USBPD_ITE_ACTIVE_PORT_COUNT DT_NUM_INST_STATUS_OKAY(ite_it8xxx2_usbpd) -#ifndef _ASMLANGUAGE -void soc_interrupt_init(void); -#endif - #endif /* __RISCV_ITE_SOC_H_ */ diff --git a/soc/riscv/openisa_rv32m1/soc.h b/soc/riscv/openisa_rv32m1/soc.h index 1b2643d0b66..75011d36283 100644 --- a/soc/riscv/openisa_rv32m1/soc.h +++ b/soc/riscv/openisa_rv32m1/soc.h @@ -94,8 +94,6 @@ static inline uint32_t rv32m1_intmux_line(unsigned int irq) return ((irq >> 8) & 0xff) - 1; } -void soc_interrupt_init(void); - #endif /* !_ASMLANGUAGE */ #if defined(CONFIG_SOC_OPENISA_RV32M1_RI5CY) From 9d511877a9a0d3aaa2be3c481f20a3a8da86eceb Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 11 Jan 2024 10:42:51 +0100 Subject: [PATCH 0298/2300] [nrf fromtree] arch: riscv: irq_manage: add missing PLIC header Module uses RISC-V PLIC interrupt controller API without including the necessary headers. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 6252e8576c94a4ad7549d4c6180a3e0d3c8eb3a8) (cherry picked from commit b39a1a74bfcce36b130f78f0aa079f48f43ad2e5) --- arch/riscv/core/irq_manage.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/core/irq_manage.c b/arch/riscv/core/irq_manage.c index f3e0cc09ab1..f95b099a4da 100644 --- a/arch/riscv/core/irq_manage.c +++ b/arch/riscv/core/irq_manage.c @@ -10,6 +10,10 @@ #include #include +#ifdef CONFIG_RISCV_HAS_PLIC +#include +#endif + LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); FUNC_NORETURN void z_irq_spurious(const void *unused) From 9f10a81663e9425e7b6f801d249972deba314895 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 11 Jan 2024 11:31:24 +0100 Subject: [PATCH 0299/2300] [nrf fromtree] drivers: gpio: sifive: add missing PLIC header Driver is using the PLIC API without including the right header. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 36069b6c9aeb4971955fd2850457b6cdc42e9039) (cherry picked from commit 69388c7268d91c5e1ebf280c36a05bd2b741c11c) --- drivers/gpio/gpio_sifive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio_sifive.c b/drivers/gpio/gpio_sifive.c index 77703f25707..a412fdd1528 100644 --- a/drivers/gpio/gpio_sifive.c +++ b/drivers/gpio/gpio_sifive.c @@ -18,7 +18,7 @@ #include #include #include - +#include #include typedef void (*sifive_cfg_func_t)(void); From e8427bf4c91e952f5a072ee0698fe05c7bc19bf3 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 11 Jan 2024 13:35:47 +0100 Subject: [PATCH 0300/2300] [nrf fromtree] drivers: gpio: b91: add missing PLIC header Driver is using the RISC-V PLIC interrupt controller without including the necessary headers. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 992f25b0c929cad7c1e26ef7cec72ae7823e396d) (cherry picked from commit 637e8eafcb3a32cd507e2ec2dfb8a5319ef3eeb4) --- drivers/gpio/gpio_b91.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio_b91.c b/drivers/gpio/gpio_b91.c index bc73f9db9f5..4c4c14dc909 100644 --- a/drivers/gpio/gpio_b91.c +++ b/drivers/gpio/gpio_b91.c @@ -10,6 +10,7 @@ #include #include #include +#include /* Driver dts compatibility: telink,b91_gpio */ From 271464a0a50e53e480aa3c4d70d863a85c4ad2d0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 11 Jan 2024 20:00:37 +0100 Subject: [PATCH 0301/2300] [nrf fromtree] drivers: ieee802154: b91: add missing PLIC include Driver was using RISC-V PLIC API without including the necessary headers. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 87bb281a9f8692c8755edb58353085f6b7b4c3be) (cherry picked from commit bbcb4f1e16c968e246bbc2ef59cf3fd64df69338) --- drivers/ieee802154/ieee802154_b91.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ieee802154/ieee802154_b91.c b/drivers/ieee802154/ieee802154_b91.c index 0557c533944..0897b2b54df 100644 --- a/drivers/ieee802154/ieee802154_b91.c +++ b/drivers/ieee802154/ieee802154_b91.c @@ -26,6 +26,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #endif +#include + #include "ieee802154_b91.h" From 147c18e1bb9510a1b7e6c7b6298afc78bc4dafb5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Fri, 12 Jan 2024 12:30:17 +0100 Subject: [PATCH 0302/2300] [nrf fromtree] drivers: serial: b91: add missing RISC-V PLIC header Driver was using PLIC without including necessary headers. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 3ed16b38e555a5b17469578b69e479e8434cd257) (cherry picked from commit 61e57d1d73bf7c68f1663ac90855af02adb27c53) --- drivers/serial/uart_b91.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/serial/uart_b91.c b/drivers/serial/uart_b91.c index cb2d7ebd190..e2502f4fd9b 100644 --- a/drivers/serial/uart_b91.c +++ b/drivers/serial/uart_b91.c @@ -11,6 +11,7 @@ #include #include #include +#include /* Driver dts compatibility: telink,b91_uart */ From 41d4309b38d1a53e5ce4e6b8b7802091c9434572 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 10 Jan 2024 16:38:50 +0100 Subject: [PATCH 0303/2300] [nrf fromtree] soc: riscv: riscv-privileged: drop soc_common.h The header file is no longer needed. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 6876f9eea1acce965be5ba8f7f786ee232e49029) (cherry picked from commit 593dad9bf06a597b3c8ed13f4d9d7da787eb3c1e) --- soc/riscv/andes_v5/ae350/soc.h | 2 -- .../common/riscv-privileged/soc_common.h | 22 ------------------- soc/riscv/efinix_sapphire/soc.h | 1 - soc/riscv/gd_gd32/gd32vf103/soc.h | 2 -- soc/riscv/intel_niosv/niosv/soc.h | 1 - soc/riscv/litex_vexriscv/soc.h | 1 - soc/riscv/microchip_miv/miv/soc.h | 2 -- soc/riscv/microchip_miv/polarfire/soc.h | 1 - soc/riscv/neorv32/soc.h | 2 -- soc/riscv/opentitan/soc.h | 1 - soc/riscv/renode_virt/soc.h | 2 -- soc/riscv/sifive_freedom/e300/soc.h | 2 -- soc/riscv/sifive_freedom/u500/soc.h | 2 -- soc/riscv/sifive_freedom/u700/soc.h | 2 -- soc/riscv/starfive_jh71xx/jh71xx/soc.h | 2 -- soc/riscv/telink_tlsr/tlsr951x/soc.h | 2 -- soc/riscv/virt/soc.h | 2 -- 17 files changed, 49 deletions(-) delete mode 100644 soc/riscv/common/riscv-privileged/soc_common.h diff --git a/soc/riscv/andes_v5/ae350/soc.h b/soc/riscv/andes_v5/ae350/soc.h index 95ea7486fd3..fd3a9e63c0d 100644 --- a/soc/riscv/andes_v5/ae350/soc.h +++ b/soc/riscv/andes_v5/ae350/soc.h @@ -11,8 +11,6 @@ #ifndef __RISCV_ANDES_AE350_SOC_H_ #define __RISCV_ANDES_AE350_SOC_H_ -#include - /* Include CSRs available for Andes V5 SoCs */ #include "soc_v5.h" diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h deleted file mode 100644 index f8f1c13cb59..00000000000 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2017 Jean-Paul Etienne - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file configuration macros for riscv SOCs supporting the riscv - * privileged architecture specification - */ - -#ifndef __SOC_COMMON_H_ -#define __SOC_COMMON_H_ - -#ifndef _ASMLANGUAGE - -#include -#include - -#endif /* !_ASMLANGUAGE */ - -#endif /* __SOC_COMMON_H_ */ diff --git a/soc/riscv/efinix_sapphire/soc.h b/soc/riscv/efinix_sapphire/soc.h index 1d566e2f293..5530af16729 100644 --- a/soc/riscv/efinix_sapphire/soc.h +++ b/soc/riscv/efinix_sapphire/soc.h @@ -7,7 +7,6 @@ #ifndef __RISCV32_EFINIX_SAPPHIRE_SOC_H_ #define __RISCV32_EFINIX_SAPPHIRE_SOC_H_ -#include "soc_common.h" #include #include diff --git a/soc/riscv/gd_gd32/gd32vf103/soc.h b/soc/riscv/gd_gd32/gd32vf103/soc.h index 14cdd6b733c..ad2add6fa80 100644 --- a/soc/riscv/gd_gd32/gd32vf103/soc.h +++ b/soc/riscv/gd_gd32/gd32vf103/soc.h @@ -11,6 +11,4 @@ #ifndef RISCV_GD32VF103_SOC_H_ #define RISCV_GD32VF103_SOC_H_ -#include - #endif /* RISCV_GD32VF103_SOC_H */ diff --git a/soc/riscv/intel_niosv/niosv/soc.h b/soc/riscv/intel_niosv/niosv/soc.h index 8c10fec4540..87458c91dff 100644 --- a/soc/riscv/intel_niosv/niosv/soc.h +++ b/soc/riscv/intel_niosv/niosv/soc.h @@ -7,7 +7,6 @@ #ifndef RISCV_INTEL_FPGA_NIOSV_H #define RISCV_INTEL_FPGA_NIOSV_H -#include #include #endif /* RISCV_INTEL_FPGA_NIOSV_H */ diff --git a/soc/riscv/litex_vexriscv/soc.h b/soc/riscv/litex_vexriscv/soc.h index b3521b51e8e..4334be4ec1c 100644 --- a/soc/riscv/litex_vexriscv/soc.h +++ b/soc/riscv/litex_vexriscv/soc.h @@ -7,7 +7,6 @@ #ifndef __RISCV32_LITEX_VEXRISCV_SOC_H_ #define __RISCV32_LITEX_VEXRISCV_SOC_H_ -#include "../common/riscv-privileged/soc_common.h" #include #include diff --git a/soc/riscv/microchip_miv/miv/soc.h b/soc/riscv/microchip_miv/miv/soc.h index 1608c9e6773..c5827ceed21 100644 --- a/soc/riscv/microchip_miv/miv/soc.h +++ b/soc/riscv/microchip_miv/miv/soc.h @@ -4,8 +4,6 @@ #ifndef __RISCV32_MIV_SOC_H_ #define __RISCV32_MIV_SOC_H_ -#include - /* UART Configuration */ #define MIV_UART_0_LINECFG 0x1 diff --git a/soc/riscv/microchip_miv/polarfire/soc.h b/soc/riscv/microchip_miv/polarfire/soc.h index d6a7d2d2e37..f12bea7d533 100644 --- a/soc/riscv/microchip_miv/polarfire/soc.h +++ b/soc/riscv/microchip_miv/polarfire/soc.h @@ -6,7 +6,6 @@ #ifndef __RISCV64_MPFS_SOC_H_ #define __RISCV64_MPFS_SOC_H_ -#include #include diff --git a/soc/riscv/neorv32/soc.h b/soc/riscv/neorv32/soc.h index a1e721923a4..a97daa0fc15 100644 --- a/soc/riscv/neorv32/soc.h +++ b/soc/riscv/neorv32/soc.h @@ -7,8 +7,6 @@ #ifndef RISCV_NEORV32_SOC_H #define RISCV_NEORV32_SOC_H -#include - /* System information (SYSINFO) register offsets */ #define NEORV32_SYSINFO_CLK 0x00U #define NEORV32_SYSINFO_CPU 0x04U diff --git a/soc/riscv/opentitan/soc.h b/soc/riscv/opentitan/soc.h index 13bb5c43b54..c7f75beb877 100644 --- a/soc/riscv/opentitan/soc.h +++ b/soc/riscv/opentitan/soc.h @@ -7,7 +7,6 @@ #ifndef __RISCV_OPENTITAN_SOC_H_ #define __RISCV_OPENTITAN_SOC_H_ -#include #include /* OpenTitan power management regs. */ diff --git a/soc/riscv/renode_virt/soc.h b/soc/riscv/renode_virt/soc.h index c82e16f1613..3edef49c88c 100644 --- a/soc/riscv/renode_virt/soc.h +++ b/soc/riscv/renode_virt/soc.h @@ -7,6 +7,4 @@ #ifndef __RISCV32_RENODE_SOC_H_ #define __RISCV32_RENODE_SOC_H_ -#include - #endif /* __RISCV32_RENODE_SOC_H_ */ diff --git a/soc/riscv/sifive_freedom/e300/soc.h b/soc/riscv/sifive_freedom/e300/soc.h index c83f5f322b6..3c29efb2a71 100644 --- a/soc/riscv/sifive_freedom/e300/soc.h +++ b/soc/riscv/sifive_freedom/e300/soc.h @@ -11,8 +11,6 @@ #ifndef __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ #define __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ -#include - /* PINMUX MAX PINS */ #define SIFIVE_PINMUX_PINS 32 diff --git a/soc/riscv/sifive_freedom/u500/soc.h b/soc/riscv/sifive_freedom/u500/soc.h index ed367950278..1e18850787b 100644 --- a/soc/riscv/sifive_freedom/u500/soc.h +++ b/soc/riscv/sifive_freedom/u500/soc.h @@ -11,8 +11,6 @@ #ifndef __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ #define __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ -#include - /* Clock controller. */ #define PRCI_BASE_ADDR 0x10000000 diff --git a/soc/riscv/sifive_freedom/u700/soc.h b/soc/riscv/sifive_freedom/u700/soc.h index 91aac61afdd..2f15ba3b1cb 100644 --- a/soc/riscv/sifive_freedom/u700/soc.h +++ b/soc/riscv/sifive_freedom/u700/soc.h @@ -11,8 +11,6 @@ #ifndef __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ #define __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ -#include - /* Clock controller. */ #define PRCI_BASE_ADDR 0x10000000 diff --git a/soc/riscv/starfive_jh71xx/jh71xx/soc.h b/soc/riscv/starfive_jh71xx/jh71xx/soc.h index 796f07201d9..df3559c96e3 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/soc.h +++ b/soc/riscv/starfive_jh71xx/jh71xx/soc.h @@ -7,6 +7,4 @@ #ifndef __RISCV_VIRT_SOC_H_ #define __RISCV_VIRT_SOC_H_ -#include - #endif diff --git a/soc/riscv/telink_tlsr/tlsr951x/soc.h b/soc/riscv/telink_tlsr/tlsr951x/soc.h index a46b4c620c7..6acfd63dd02 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/soc.h +++ b/soc/riscv/telink_tlsr/tlsr951x/soc.h @@ -7,6 +7,4 @@ #ifndef RISCV_TELINK_B91_SOC_H #define RISCV_TELINK_B91_SOC_H -#include - #endif /* RISCV_TELINK_B91_SOC_H */ diff --git a/soc/riscv/virt/soc.h b/soc/riscv/virt/soc.h index 8fd5e2108ce..d821c4653e6 100644 --- a/soc/riscv/virt/soc.h +++ b/soc/riscv/virt/soc.h @@ -7,8 +7,6 @@ #ifndef __RISCV_VIRT_SOC_H_ #define __RISCV_VIRT_SOC_H_ -#include - #define SIFIVE_SYSCON_TEST 0x00100000 #define RISCV_MSIP_BASE 0x02000000 From f6c7f112e82a082efaa0ce5e6e30d2139ebf3c54 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 18 Jan 2024 15:25:29 +0100 Subject: [PATCH 0304/2300] [nrf fromtree] arch: riscv: offsets: fix header race condition It looks like some soc_offsets.h files need to be included before kernel_offsets, otherwise there are some header race conditions due to the infamous soc.h. This problem is exposed if all soc.h are removed from RISC-V arch header files (see the upcoming commits). It can be reproduced by building rv32m1_vega_ri5cy board after applying all the patches in this series (excluding this one, of course). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 7af4f7eb8a2ca9cd2eb3e5b2d2c74f31d2b2263e) (cherry picked from commit a13732cc5088f56629abb421beef0f1a91265cde) --- arch/riscv/core/offsets/offsets.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/core/offsets/offsets.c b/arch/riscv/core/offsets/offsets.c index 7730138a376..96982341b1a 100644 --- a/arch/riscv/core/offsets/offsets.c +++ b/arch/riscv/core/offsets/offsets.c @@ -16,7 +16,6 @@ #include #include #include -#include #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE #include @@ -25,6 +24,8 @@ #include #endif +#include + /* struct _callee_saved member offsets */ GEN_OFFSET_SYM(_callee_saved_t, sp); GEN_OFFSET_SYM(_callee_saved_t, ra); From b4a4909af17a9d021dd96bb85a0ba5beb06e8154 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 16 Jan 2024 14:54:01 +0100 Subject: [PATCH 0305/2300] [nrf fromtree] arch: riscv: smp: define MSIP_BASE Instead of relying on definitions included indirectly. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit a5ded8aa9f75851931f1eb321a0e19790eb3181f) (cherry picked from commit 5a328d5f8a3acee0c1d64e531af12e881ad34d98) --- arch/riscv/core/smp.c | 3 ++- soc/riscv/microchip_miv/polarfire/soc.h | 3 --- soc/riscv/virt/soc.h | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 928edb63d8f..99f67f57ecc 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -79,7 +79,8 @@ void z_riscv_secondary_cpu_init(int hartid) #ifdef CONFIG_SMP -#define MSIP(hartid) ((volatile uint32_t *)RISCV_MSIP_BASE)[hartid] +#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 diff --git a/soc/riscv/microchip_miv/polarfire/soc.h b/soc/riscv/microchip_miv/polarfire/soc.h index f12bea7d533..3bcb9569c6e 100644 --- a/soc/riscv/microchip_miv/polarfire/soc.h +++ b/soc/riscv/microchip_miv/polarfire/soc.h @@ -8,7 +8,4 @@ #include - -#define RISCV_MSIP_BASE 0x02000000 - #endif /* __RISCV64_MPFS_SOC_H_ */ diff --git a/soc/riscv/virt/soc.h b/soc/riscv/virt/soc.h index d821c4653e6..8aa4238010c 100644 --- a/soc/riscv/virt/soc.h +++ b/soc/riscv/virt/soc.h @@ -8,6 +8,5 @@ #define __RISCV_VIRT_SOC_H_ #define SIFIVE_SYSCON_TEST 0x00100000 -#define RISCV_MSIP_BASE 0x02000000 #endif From 7a554229571ac87580d1007b10f55955050a4d6f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 16 Jan 2024 15:55:41 +0100 Subject: [PATCH 0306/2300] [nrf fromtree] soc: riscv: make RISCV_HAS_(C|P)LIC promptless These options are meant to be selected by SoC series supporting (C|P)LIC. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 2dcbb0ee3fbbc738f94c1ccea9761b42ee8b5b39) (cherry picked from commit 0dd01f0067c19eedb2dc3b9a2f59ca118734a46d) --- soc/riscv/andes_v5/ae350/Kconfig.defconfig.series | 3 --- soc/riscv/andes_v5/ae350/Kconfig.series | 1 + soc/riscv/common/riscv-privileged/Kconfig | 4 ++-- soc/riscv/efinix_sapphire/Kconfig.defconfig | 4 ---- soc/riscv/efinix_sapphire/Kconfig.soc | 1 + soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 | 3 --- soc/riscv/litex_vexriscv/Kconfig.defconfig | 3 --- soc/riscv/microchip_miv/miv/Kconfig.defconfig.series | 3 --- soc/riscv/microchip_miv/miv/Kconfig.series | 1 + soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series | 3 --- soc/riscv/microchip_miv/polarfire/Kconfig.series | 1 + soc/riscv/opentitan/Kconfig.defconfig | 3 --- soc/riscv/opentitan/Kconfig.soc | 1 + soc/riscv/renode_virt/Kconfig.defconfig | 3 --- soc/riscv/renode_virt/Kconfig.soc | 1 + soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series | 3 --- soc/riscv/sifive_freedom/e300/Kconfig.series | 1 + soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series | 3 --- soc/riscv/sifive_freedom/u500/Kconfig.series | 1 + soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series | 3 --- soc/riscv/sifive_freedom/u700/Kconfig.series | 1 + soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series | 3 --- soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series | 1 + soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series | 4 ---- soc/riscv/telink_tlsr/tlsr951x/Kconfig.series | 1 + soc/riscv/virt/Kconfig.defconfig | 3 --- soc/riscv/virt/Kconfig.soc | 1 + 27 files changed, 14 insertions(+), 46 deletions(-) diff --git a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series index 699e54e66b8..7b9bbc3eadb 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series +++ b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series @@ -24,9 +24,6 @@ config RISCV_GENERIC_TOOLCHAIN config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/andes_v5/ae350/Kconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.series index ebf68f7a3aa..c2e9b40bfb7 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.series +++ b/soc/riscv/andes_v5/ae350/Kconfig.series @@ -5,6 +5,7 @@ config SOC_SERIES_ANDES_AE350 bool "Andes V5 AE350 SoC Series Implementation" select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC select SOC_FAMILY_ANDES_V5 help Enable support for Andes V5 AE350 SoC Series diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index a4a8da0bf1f..016919c4661 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -5,13 +5,13 @@ # SPDX-License-Identifier: Apache-2.0 config RISCV_HAS_PLIC - bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" + bool depends on RISCV_PRIVILEGED help Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). config RISCV_HAS_CLIC - bool "Does the SOC provide support for a Core-Local Interrupt Controller (CLIC)" + bool depends on RISCV_PRIVILEGED help Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). diff --git a/soc/riscv/efinix_sapphire/Kconfig.defconfig b/soc/riscv/efinix_sapphire/Kconfig.defconfig index 08e2c851a21..95a33b4ab82 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.defconfig +++ b/soc/riscv/efinix_sapphire/Kconfig.defconfig @@ -13,10 +13,6 @@ config RISCV_SOC_INTERRUPT_INIT bool default y -config RISCV_HAS_PLIC - bool - default y - config NUM_IRQS int default 36 diff --git a/soc/riscv/efinix_sapphire/Kconfig.soc b/soc/riscv/efinix_sapphire/Kconfig.soc index bf57d9cc541..4bad3b5cb79 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.soc +++ b/soc/riscv/efinix_sapphire/Kconfig.soc @@ -12,3 +12,4 @@ config SOC_EFINIX_SAPPHIRE select RISCV_ISA_EXT_ZIFENCEI select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 index 0da92e80e36..94af3ff773c 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 @@ -23,9 +23,6 @@ config RISCV_SOC_INTERRUPT_INIT config RISCV_GP default y -config RISCV_HAS_PLIC - default n - config NUM_IRQS default 87 if NUCLEI_ECLIC default 16 if !NUCLEI_ECLIC diff --git a/soc/riscv/litex_vexriscv/Kconfig.defconfig b/soc/riscv/litex_vexriscv/Kconfig.defconfig index f3e4c7cc79c..0088420459f 100644 --- a/soc/riscv/litex_vexriscv/Kconfig.defconfig +++ b/soc/riscv/litex_vexriscv/Kconfig.defconfig @@ -9,9 +9,6 @@ config SOC config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 -config RISCV_HAS_PLIC - bool - config NUM_IRQS default 12 diff --git a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series index fc5aaa7c186..35f4365b02b 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series @@ -11,9 +11,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/microchip_miv/miv/Kconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.series index 2989876c0e0..9f348619624 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.series @@ -8,5 +8,6 @@ config SOC_SERIES_MIV select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC help Enable support for Microchip Mi-V diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series index f41ae867153..5a3f113c13e 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series @@ -14,9 +14,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.series index 9001efc2858..59ec4dbdd7a 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.series @@ -8,5 +8,6 @@ config SOC_SERIES_POLARFIRE select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC help Enable support for Microchip RISCV 64bit diff --git a/soc/riscv/opentitan/Kconfig.defconfig b/soc/riscv/opentitan/Kconfig.defconfig index 4ec6bffc4e7..19a72fc70bd 100644 --- a/soc/riscv/opentitan/Kconfig.defconfig +++ b/soc/riscv/opentitan/Kconfig.defconfig @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/opentitan/Kconfig.soc b/soc/riscv/opentitan/Kconfig.soc index 8270fde110d..c76cfe013b1 100644 --- a/soc/riscv/opentitan/Kconfig.soc +++ b/soc/riscv/opentitan/Kconfig.soc @@ -16,6 +16,7 @@ config SOC_OPENTITAN select RISCV_ISA_EXT_ZBS select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. select RISCV_VECTORED_MODE select GEN_IRQ_VECTOR_TABLE diff --git a/soc/riscv/renode_virt/Kconfig.defconfig b/soc/riscv/renode_virt/Kconfig.defconfig index 5d2cd649b0b..fab59719595 100644 --- a/soc/riscv/renode_virt/Kconfig.defconfig +++ b/soc/riscv/renode_virt/Kconfig.defconfig @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/renode_virt/Kconfig.soc b/soc/riscv/renode_virt/Kconfig.soc index 5aae660880a..ba42c40c28d 100644 --- a/soc/riscv/renode_virt/Kconfig.soc +++ b/soc/riscv/renode_virt/Kconfig.soc @@ -13,3 +13,4 @@ config SOC_RISCV32_VIRTUAL_RENODE select RISCV_ISA_EXT_C select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI + select RISCV_HAS_PLIC diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series index 661fe4ba1eb..eaa43e68e70 100644 --- a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.series index 47ae89e6d4c..81634da000d 100644 --- a/soc/riscv/sifive_freedom/e300/Kconfig.series +++ b/soc/riscv/sifive_freedom/e300/Kconfig.series @@ -7,6 +7,7 @@ config SOC_SERIES_SIFIVE_FREEDOM_E300 bool "SiFive Freedom E300 SOC implementation" select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom FE300 SOC diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series index 3db750cb1a6..d306b60252a 100644 --- a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.series index a576dfbc6f7..7335a1a5293 100644 --- a/soc/riscv/sifive_freedom/u500/Kconfig.series +++ b/soc/riscv/sifive_freedom/u500/Kconfig.series @@ -7,6 +7,7 @@ config SOC_SERIES_SIFIVE_FREEDOM_U500 bool "SiFive Freedom U500 SOC implementation" select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom U500 SOC diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series index 83165d58870..a0e730d608f 100644 --- a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.series index 613844703c7..04bdc1fb9b2 100644 --- a/soc/riscv/sifive_freedom/u700/Kconfig.series +++ b/soc/riscv/sifive_freedom/u700/Kconfig.series @@ -7,6 +7,7 @@ config SOC_SERIES_SIFIVE_FREEDOM_U700 bool "SiFive Freedom SOC U700 implementation" select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom U700 SOC diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series index 2dc45e1f347..0f058cb6c25 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series index 19cedcefe27..f392a5d1f97 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series @@ -5,5 +5,6 @@ config SOC_SERIES_STARFIVE_JH71XX bool "Starfive JH71XX series" select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC help Enable support for Starfive JH71XX SoC Series. diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series index 5b62959858e..2b72ad9960c 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series @@ -15,10 +15,6 @@ config RISCV_SOC_INTERRUPT_INIT bool default y -config RISCV_HAS_PLIC - bool - default y - config RISCV_GP bool default y diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series index 5ad3053725e..5d5fc3226e5 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series @@ -11,6 +11,7 @@ config SOC_SERIES_TELINK_TLSR951X select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI select RISCV_PRIVILEGED + select RISCV_HAS_PLIC select HAS_TELINK_DRIVERS select ATOMIC_OPERATIONS_BUILTIN select CPU_HAS_FPU diff --git a/soc/riscv/virt/Kconfig.defconfig b/soc/riscv/virt/Kconfig.defconfig index e0982bc185b..bed5ff8bec7 100644 --- a/soc/riscv/virt/Kconfig.defconfig +++ b/soc/riscv/virt/Kconfig.defconfig @@ -12,9 +12,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_HAS_PLIC - default y - config RISCV_GP default y diff --git a/soc/riscv/virt/Kconfig.soc b/soc/riscv/virt/Kconfig.soc index 9a9168f5a8c..59e553a9d7b 100644 --- a/soc/riscv/virt/Kconfig.soc +++ b/soc/riscv/virt/Kconfig.soc @@ -10,3 +10,4 @@ config SOC_RISCV_VIRT select RISCV_ISA_EXT_C select RISCV select RISCV_PRIVILEGED + select RISCV_HAS_PLIC From 617448b1b2f856a53a593876da364d803ff548a5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 16 Jan 2024 16:01:41 +0100 Subject: [PATCH 0307/2300] [nrf fromtree] arch: riscv: add RISCV_HAS_(C|P)LIC from soc/riscv Because these are general RISC-V options, not soc specific. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 49e2bc69a2fc5a8cbb2873d4a35fd416a38ee84d) (cherry picked from commit 73a3223830a478cf5f9a23710bb1fc9544812553) --- arch/riscv/Kconfig | 12 ++++++++++++ soc/riscv/common/riscv-privileged/Kconfig | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 1c5defbacaf..708c529f237 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -153,6 +153,18 @@ config RISCV_SOC_OFFSETS in offsets.h. The last one should not end in a semicolon. See gen_offset.h for more details. +config RISCV_HAS_PLIC + bool + depends on RISCV_PRIVILEGED + help + Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). + +config RISCV_HAS_CLIC + bool + depends on RISCV_PRIVILEGED + help + Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). + config RISCV_SOC_INTERRUPT_INIT bool "SOC-based interrupt initialization" help diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index 016919c4661..10c2e37712b 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -4,18 +4,6 @@ # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 -config RISCV_HAS_PLIC - bool - depends on RISCV_PRIVILEGED - help - Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). - -config RISCV_HAS_CLIC - bool - depends on RISCV_PRIVILEGED - help - Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). - config RISCV_VECTORED_MODE bool "Should the SOC use vectored mode" depends on RISCV_PRIVILEGED From 9133757d0ba41da4fff94e85a0289ecd23d1ff8b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 16 Jan 2024 16:31:26 +0100 Subject: [PATCH 0308/2300] [nrf fromtree] arch: riscv: make __soc_is_irq optional It looks like all SoCs in tree check if an exception comes from an IRQ the same way, so let's provide a common logic by default, still customizable if the SoC selects RISCV_SOC_ISR_CHECK. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 68799d507da32fde0459c6abffba33182ba73f2f) (cherry picked from commit 2001c6ababf44c171e8f2debc619cfcc2f9fd5de) --- arch/riscv/Kconfig | 7 ++++++ arch/riscv/core/isr.S | 13 +++++++--- include/zephyr/arch/riscv/irq.h | 6 +++-- soc/riscv/common/riscv-privileged/soc_irq.S | 27 --------------------- soc/riscv/espressif_esp32/esp32c3/soc_irq.S | 6 ----- soc/riscv/ite_ec/common/soc_irq.S | 18 -------------- soc/riscv/openisa_rv32m1/soc_irq.S | 10 -------- 7 files changed, 21 insertions(+), 66 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 708c529f237..a816d1c5501 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -165,6 +165,13 @@ config RISCV_HAS_CLIC help Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). +config RISCV_SOC_EXCEPTION_FROM_IRQ + bool + help + Option selected by SoCs that require a custom mechanism to check if + an exception is the result of an interrupt or not. If selected, + __soc_is_irq() needs to be implemented by the SoC. + config RISCV_SOC_INTERRUPT_INIT bool "SOC-based interrupt initialization" help diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index 558d2a41fbe..982e6777b36 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -51,7 +51,9 @@ /* imports */ GDATA(_sw_isr_table) +#ifdef CONFIG_RISCV_SOC_EXCEPTION_FROM_IRQ GTEXT(__soc_is_irq) +#endif GTEXT(__soc_handle_irq) GTEXT(_Fault) #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE @@ -91,7 +93,8 @@ GTEXT(_isr_wrapper) * what standard behavior is defined). Hence, the arch level code expects * the following functions to be provided at the SOC level: * - * - __soc_is_irq: decide if we're handling an interrupt or an exception + * - __soc_is_irq (optional): decide if we're handling an interrupt or an + exception * - __soc_handle_irq: handle SoC-specific details for a pending IRQ * (e.g. clear a pending bit in a SoC-specific register) * @@ -284,10 +287,14 @@ no_fp: /* increment _current->arch.exception_depth */ * function (that needs to be implemented by each SOC). The result is * returned via register a0 (1: interrupt, 0 exception) */ +#ifdef CONFIG_RISCV_SOC_EXCEPTION_FROM_IRQ jal ra, __soc_is_irq - - /* If a0 != 0, jump to is_interrupt */ bnez a0, is_interrupt +#else + csrr t0, mcause + srli t0, t0, RISCV_MCAUSE_IRQ_POS + bnez t0, is_interrupt +#endif /* * If the exception is the result of an ECALL, check whether to diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index 84d3a4949a9..c0db9a6687d 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -40,9 +40,11 @@ extern "C" { #define RISCV_IRQ_MEXT 11 #ifdef CONFIG_64BIT -#define RISCV_MCAUSE_IRQ_BIT (1 << 63) +#define RISCV_MCAUSE_IRQ_POS 63U +#define RISCV_MCAUSE_IRQ_BIT BIT64(RISCV_MCAUSE_IRQ_POS) #else -#define RISCV_MCAUSE_IRQ_BIT (1 << 31) +#define RISCV_MCAUSE_IRQ_POS 31U +#define RISCV_MCAUSE_IRQ_BIT BIT(RISCV_MCAUSE_IRQ_POS) #endif #ifndef _ASMLANGUAGE diff --git a/soc/riscv/common/riscv-privileged/soc_irq.S b/soc/riscv/common/riscv-privileged/soc_irq.S index 377edbf600d..acf7e724aea 100644 --- a/soc/riscv/common/riscv-privileged/soc_irq.S +++ b/soc/riscv/common/riscv-privileged/soc_irq.S @@ -32,30 +32,3 @@ SECTION_FUNC(exception.other, __soc_handle_irq) /* Return */ ret - -/* - * __soc_is_irq is defined as .weak to allow re-implementation by - * SOCs that do not truly follow the riscv privilege specification. - */ -WTEXT(__soc_is_irq) - -/* - * SOC-specific function to determine if the exception is the result of a - * an interrupt or an exception - * return 1 (interrupt) or 0 (exception) - * - */ -SECTION_FUNC(exception.other, __soc_is_irq) - /* Read mcause and check if interrupt bit is set */ - csrr t0, mcause - li t1, RISCV_MCAUSE_IRQ_BIT - and t0, t0, t1 - - /* If interrupt bit is not set, return with 0 */ - addi a0, x0, 0 - beqz t0, not_interrupt - addi a0, a0, 1 - -not_interrupt: - /* return */ - ret diff --git a/soc/riscv/espressif_esp32/esp32c3/soc_irq.S b/soc/riscv/espressif_esp32/esp32c3/soc_irq.S index c1ad164c153..6ce11ae6a81 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc_irq.S +++ b/soc/riscv/espressif_esp32/esp32c3/soc_irq.S @@ -7,15 +7,9 @@ #include /* Exports */ -GTEXT(__soc_is_irq) GTEXT(__soc_handle_irq) GTEXT(soc_intr_get_next_source) -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - SECTION_FUNC(exception.other, __soc_handle_irq) addi sp, sp,-4 sw ra, 0x00(sp) diff --git a/soc/riscv/ite_ec/common/soc_irq.S b/soc/riscv/ite_ec/common/soc_irq.S index a412ca6a796..ceb0f3afecb 100644 --- a/soc/riscv/ite_ec/common/soc_irq.S +++ b/soc/riscv/ite_ec/common/soc_irq.S @@ -25,21 +25,3 @@ GTEXT(__soc_handle_irq) */ SECTION_FUNC(exception.other, __soc_handle_irq) j get_irq - -/* - * __soc_is_irq is defined as .weak to allow re-implementation by - * SOCs that does not truely follow the riscv privilege specification. - */ -WTEXT(__soc_is_irq) - -/* - * SOC-specific function to determine if the exception is the result of a - * an interrupt or an exception - * return 1 (interrupt) or 0 (exception) - * - */ -SECTION_FUNC(exception.other, __soc_is_irq) - /* Read mcause and check if interrupt bit (bit 31) is set */ - csrr a0, mcause - srli a0, a0, 31 - ret diff --git a/soc/riscv/openisa_rv32m1/soc_irq.S b/soc/riscv/openisa_rv32m1/soc_irq.S index 23222ea2c70..d3059d2bd28 100644 --- a/soc/riscv/openisa_rv32m1/soc_irq.S +++ b/soc/riscv/openisa_rv32m1/soc_irq.S @@ -10,22 +10,12 @@ #include /* Exports */ -GTEXT(__soc_is_irq) GTEXT(__soc_handle_irq) #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE GTEXT(__soc_save_context) GTEXT(__soc_restore_context) #endif -/* - * Whether we're in an IRQ is bog-standard RISC-V on this SoC: - * yes if the top mcause bit is set, otherwise no. - */ -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - /* * With a0 == irq_num, this is equivalent to: * From 9cac0ccffcdd0955503bec03bda595411b28721e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 25 Jan 2024 16:59:40 +0100 Subject: [PATCH 0309/2300] [nrf fromtree] dts: bindings: nordic,nrf-ficr: move to misc folder It's not related to ARM. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 6ec2dbf8ee3d7ed66bc7a1f5cbaeb599a58cf229) (cherry picked from commit 7f26bed98ed7f3d4acc37cafe0d17b57b2680125) --- dts/bindings/{arm => misc}/nordic,nrf-ficr.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dts/bindings/{arm => misc}/nordic,nrf-ficr.yaml (100%) diff --git a/dts/bindings/arm/nordic,nrf-ficr.yaml b/dts/bindings/misc/nordic,nrf-ficr.yaml similarity index 100% rename from dts/bindings/arm/nordic,nrf-ficr.yaml rename to dts/bindings/misc/nordic,nrf-ficr.yaml From 3963e0f14c72a90daa268f813b2a4cd95cd2374e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 20 Nov 2023 23:34:32 +0100 Subject: [PATCH 0310/2300] [nrf fromtree] dts: bindings: arm: nordic,nrf-ficr: add #nordic,ficr-cells Add a new #nordic,ficr-cells property, so that we can specify a FICR offset in a phandle-array, e.g. nordic,ficrs = <&ficr 0xff>; Signed-off-by: Gerard Marull-Paretas (cherry picked from commit ed0fc03f677b5cc5552c477b0f288cb4a77aa4e9) (cherry picked from commit 35a86dd63583fdc6cc6fbc83cf18ff647f27f74f) --- dts/arm/nordic/nrf51822.dtsi | 1 + dts/arm/nordic/nrf52805.dtsi | 1 + dts/arm/nordic/nrf52810.dtsi | 1 + dts/arm/nordic/nrf52811.dtsi | 1 + dts/arm/nordic/nrf52820.dtsi | 1 + dts/arm/nordic/nrf52832.dtsi | 1 + dts/arm/nordic/nrf52833.dtsi | 1 + dts/arm/nordic/nrf52840.dtsi | 1 + dts/arm/nordic/nrf5340_cpuapp.dtsi | 1 + dts/arm/nordic/nrf5340_cpunet.dtsi | 1 + dts/arm/nordic/nrf54l15_cpuapp.dtsi | 1 + dts/arm/nordic/nrf91.dtsi | 1 + dts/bindings/misc/nordic,nrf-ficr.yaml | 8 ++++++++ 13 files changed, 20 insertions(+) diff --git a/dts/arm/nordic/nrf51822.dtsi b/dts/arm/nordic/nrf51822.dtsi index 020711a7e7f..499140a0fb8 100644 --- a/dts/arm/nordic/nrf51822.dtsi +++ b/dts/arm/nordic/nrf51822.dtsi @@ -24,6 +24,7 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index a54e8eca9c6..c8839897f3c 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -28,6 +28,7 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index ce5a2bce779..cd2543ce511 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -32,6 +32,7 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 9c9a3fa6b77..4034b4958e7 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -36,6 +36,7 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index c210a7c23aa..c702cd45227 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -37,6 +37,7 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 2e1fd68946b..d3fb288f449 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -32,6 +32,7 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index d55f0f6df9e..9ba7a85ad4a 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -36,6 +36,7 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index e833835198b..ae7a0b58ae9 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -32,6 +32,7 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index bc6b5316519..02b115b3cfe 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -41,6 +41,7 @@ ficr: ficr@ff0000 { compatible = "nordic,nrf-ficr"; reg = <0xff0000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index d930cf603c0..ae819dfb64f 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -35,6 +35,7 @@ ficr: ficr@1ff0000 { compatible = "nordic,nrf-ficr"; reg = <0x01ff0000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l15_cpuapp.dtsi b/dts/arm/nordic/nrf54l15_cpuapp.dtsi index 7e90c8b1213..df4ccc52294 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp.dtsi @@ -51,6 +51,7 @@ ficr: ficr@ffc000 { compatible = "nordic,nrf-ficr"; reg = <0xffc000 0x1000>; + #nordic,ficr-cells = <1>; }; sram0: memory@20000000 { diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index a9f067a7e5a..05a69b47583 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -92,6 +92,7 @@ ficr: ficr@ff0000 { compatible = "nordic,nrf-ficr"; reg = <0xff0000 0x1000>; + #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/bindings/misc/nordic,nrf-ficr.yaml b/dts/bindings/misc/nordic,nrf-ficr.yaml index bea0762573e..ca199c24f07 100644 --- a/dts/bindings/misc/nordic,nrf-ficr.yaml +++ b/dts/bindings/misc/nordic,nrf-ficr.yaml @@ -7,3 +7,11 @@ include: base.yaml properties: reg: required: true + + "#nordic,ficr-cells": + type: int + required: true + const: 1 + +nordic,ficr-cells: + - offset From e01d3bcd33bea6d95fe5c015b6460594bc7ac5a5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 25 Jan 2024 17:06:24 +0100 Subject: [PATCH 0311/2300] [nrf fromtree] dts: bindings: misc: add nordic-nrf-ficr-client So that FICR clients can include this file instead of redefining FICR properties every time. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit e57ad265fb4fd9f2fcd1237b8ee7897245b62fcd) (cherry picked from commit 85a97f550ff5a2687864a53487629e175179d75e) --- dts/bindings/misc/nordic-nrf-ficr-client.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 dts/bindings/misc/nordic-nrf-ficr-client.yaml diff --git a/dts/bindings/misc/nordic-nrf-ficr-client.yaml b/dts/bindings/misc/nordic-nrf-ficr-client.yaml new file mode 100644 index 00000000000..06a1e727f3f --- /dev/null +++ b/dts/bindings/misc/nordic-nrf-ficr-client.yaml @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +properties: + nordic,ficrs: + type: phandle-array + description: | + FICR entries, e.g. <&ficr OFFSET>. Available offsets (or FICR entries) are + available at . + + nordic,ficr-names: + type: string-array + description: | + Names of each nordic,ficrs entry. From eeff1d08217eb50208903e5f7de58ab9146e8e1c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 29 Jan 2024 16:09:25 +0100 Subject: [PATCH 0312/2300] [nrf fromtree] scripts: west: runners: nrf: fix UICR check uicr_ranges dictionary entries did not contain the `_FAMILY` suffix, now used by self.family variable, resulting in an always false check. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit ec9dc5d73997a5f80e379bfe188384639a87dfc5) (cherry picked from commit c5c0ce7ca4c7205b84b585b319636f88e8f7a044) --- scripts/west_commands/runners/nrf_common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 788021c6191..93871d831ee 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -178,9 +178,9 @@ def hex_has_uicr_content(self): # A map from SoCs which need this check to their UICR address # ranges. If self.family isn't in here, do nothing. uicr_ranges = { - 'NRF53': ((0x00FF8000, 0x00FF8800), - (0x01FF8000, 0x01FF8800)), - 'NRF91': ((0x00FF8000, 0x00FF8800),), + 'NRF53_FAMILY': ((0x00FF8000, 0x00FF8800), + (0x01FF8000, 0x01FF8800)), + 'NRF91_FAMILY': ((0x00FF8000, 0x00FF8800),), } if self.family not in uicr_ranges: From 291839a90ad8e8564176ca1baa067fd112c24aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 9 Jan 2024 16:16:27 +0100 Subject: [PATCH 0313/2300] [nrf fromtree] soc: arm: nordic_nrf: Clean up and unify a bit cmake code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consistently use `zephyr_library*` cmake functions for all nRF Series and set the Cortex-M linker script in a common place for all of them. Remove no longer needed include directories. Signed-off-by: Andrzej Głąbek (cherry picked from commit eb78b719148016a0852f0d43163663cd24330baa) (cherry picked from commit a75a5b4011e52d1006fb05c6ad38e1cbad11ab30) --- soc/arm/nordic_nrf/CMakeLists.txt | 4 +++- soc/arm/nordic_nrf/common/CMakeLists.txt | 5 ++++- soc/arm/nordic_nrf/nrf51/CMakeLists.txt | 13 +------------ soc/arm/nordic_nrf/nrf52/CMakeLists.txt | 13 +------------ soc/arm/nordic_nrf/nrf53/CMakeLists.txt | 10 ++-------- soc/arm/nordic_nrf/nrf54l/CMakeLists.txt | 4 +--- soc/arm/nordic_nrf/nrf91/CMakeLists.txt | 6 +----- 7 files changed, 13 insertions(+), 42 deletions(-) diff --git a/soc/arm/nordic_nrf/CMakeLists.txt b/soc/arm/nordic_nrf/CMakeLists.txt index 3b097d73569..bd7725404b8 100644 --- a/soc/arm/nordic_nrf/CMakeLists.txt +++ b/soc/arm/nordic_nrf/CMakeLists.txt @@ -1,9 +1,11 @@ # SPDX-License-Identifier: Apache-2.0 +zephyr_library() + add_subdirectory(${SOC_SERIES}) add_subdirectory(common) -zephyr_sources( +zephyr_library_sources( validate_base_addresses.c validate_enabled_instances.c ) diff --git a/soc/arm/nordic_nrf/common/CMakeLists.txt b/soc/arm/nordic_nrf/common/CMakeLists.txt index eb074dd0548..c894615a700 100644 --- a/soc/arm/nordic_nrf/common/CMakeLists.txt +++ b/soc/arm/nordic_nrf/common/CMakeLists.txt @@ -3,10 +3,13 @@ zephyr_library_sources_ifdef(CONFIG_SOC_FAMILY_NRF soc_nrf_common.S) zephyr_library_sources_ifdef(CONFIG_POWEROFF poweroff.c) + zephyr_include_directories(.) +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") + if (CONFIG_TFM_PARTITION_PLATFORM) - zephyr_sources(soc_secure.c) + zephyr_library_sources(soc_secure.c) zephyr_library_include_directories( $/install/interface/include ) diff --git a/soc/arm/nordic_nrf/nrf51/CMakeLists.txt b/soc/arm/nordic_nrf/nrf51/CMakeLists.txt index 44d139e422a..35d47fb252b 100644 --- a/soc/arm/nordic_nrf/nrf51/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf51/CMakeLists.txt @@ -1,14 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_library() - -zephyr_library_sources( - soc.c - ) - -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/arm/include - ) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") +zephyr_library_sources(soc.c) diff --git a/soc/arm/nordic_nrf/nrf52/CMakeLists.txt b/soc/arm/nordic_nrf/nrf52/CMakeLists.txt index 04e255a3eb1..1b7d4d5257a 100644 --- a/soc/arm/nordic_nrf/nrf52/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf52/CMakeLists.txt @@ -1,15 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_library() - -zephyr_library_sources( - soc.c - ) - -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/arm/include - ) +zephyr_library_sources(soc.c) if(CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 AND CONFIG_SPI_NRFX_SPIM) message(WARNING "Both SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 and an NRF SPIM driver are enabled, therefore PAN 58 will apply if RXD.MAXCNT == 1 and TXD.MAXCNT <= 1") @@ -22,5 +13,3 @@ if(CONFIG_SOC_NRF52832) endif() endif() endif() - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/arm/nordic_nrf/nrf53/CMakeLists.txt b/soc/arm/nordic_nrf/nrf53/CMakeLists.txt index b4e82f52c28..be275df68f5 100644 --- a/soc/arm/nordic_nrf/nrf53/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf53/CMakeLists.txt @@ -1,12 +1,8 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_sources( - soc.c - ) +zephyr_library_sources(soc.c) -zephyr_library_sources_ifdef(CONFIG_NRF53_SYNC_RTC - sync_rtc.c - ) +zephyr_library_sources_ifdef(CONFIG_NRF53_SYNC_RTC sync_rtc.c) if (CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED AND NOT CONFIG_SYS_CLOCK_EXISTS) @@ -19,5 +15,3 @@ if (CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED AND At your own risk, you can suppress this warning by setting CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED=n.") endif() - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt b/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt index 914aad289ef..33036acce8f 100644 --- a/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt @@ -1,12 +1,10 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -zephyr_sources( +zephyr_library_sources( soc.c ../validate_rram_partitions.c) -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") - if (CONFIG_ELV_GRTC_LFXO_ALLOWED) message(WARNING "WARNING! ELV mode feature is EXPERIMENTAL and may brick your device!") endif() diff --git a/soc/arm/nordic_nrf/nrf91/CMakeLists.txt b/soc/arm/nordic_nrf/nrf91/CMakeLists.txt index 7424bb9f7b9..35d47fb252b 100644 --- a/soc/arm/nordic_nrf/nrf91/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf91/CMakeLists.txt @@ -1,7 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_sources( - soc.c - ) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") +zephyr_library_sources(soc.c) From ed497d5f8be311b09d0b2179ede71815abf699ac Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 21 Dec 2023 14:07:17 +0100 Subject: [PATCH 0314/2300] [nrf fromtree] boards nrf5*_bsim: Provide more common headers Provide some more common headers some nRF drivers expect. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 572ba26b1fcc46dd943a90e37c1d04168242a4bf) (cherry picked from commit 6d1328d7c316c4e38db23c40601d764d1e925606) --- boards/posix/nrf_bsim/board_soc.h | 1 + boards/posix/nrf_bsim/soc/pinctrl_soc.h | 13 +++++++++++++ boards/posix/nrf_bsim/soc/soc_nrf_common.h | 13 +++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 boards/posix/nrf_bsim/soc/pinctrl_soc.h create mode 100644 boards/posix/nrf_bsim/soc/soc_nrf_common.h diff --git a/boards/posix/nrf_bsim/board_soc.h b/boards/posix/nrf_bsim/board_soc.h index 1b7e7a85c0c..d75a187aa61 100644 --- a/boards/posix/nrf_bsim/board_soc.h +++ b/boards/posix/nrf_bsim/board_soc.h @@ -29,6 +29,7 @@ #include #include #include "cmsis.h" +#include "soc_nrf_common.h" #if defined(CONFIG_BOARD_NRF52_BSIM) #define OFFLOAD_SW_IRQ SWI0_EGU0_IRQn diff --git a/boards/posix/nrf_bsim/soc/pinctrl_soc.h b/boards/posix/nrf_bsim/soc/pinctrl_soc.h new file mode 100644 index 00000000000..08252b57fee --- /dev/null +++ b/boards/posix/nrf_bsim/soc/pinctrl_soc.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H +#define BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H + +/* We reuse the real SOC's header: */ +#include "../soc/arm/nordic_nrf/common/pinctrl_soc.h" + +#endif /* BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H */ diff --git a/boards/posix/nrf_bsim/soc/soc_nrf_common.h b/boards/posix/nrf_bsim/soc/soc_nrf_common.h new file mode 100644 index 00000000000..a77778de653 --- /dev/null +++ b/boards/posix/nrf_bsim/soc/soc_nrf_common.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef BOARDS_POSIX_NRF_BSIM_SOC_SOC_NRF_COMMON_H +#define BOARDS_POSIX_NRF_BSIM_SOC_SOC_NRF_COMMON_H + +/* We reuse the real SOC's header: */ +#include "../soc/arm/nordic_nrf/common/soc_nrf_common.h" + +#endif /* BOARDS_POSIX_NRF_BSIM_SOC_SOC_NRF_COMMON_H */ From d72b6870ae4df3f14ae028588efd5457e105785d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 16 Jan 2024 15:22:23 +0100 Subject: [PATCH 0315/2300] [nrf fromtree] arch: riscv: remode redundant soc.h includes They are just not needed. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit e7cc2fafb49c1b760bdd85ebf2bc67c53b30c031) (cherry picked from commit 1714c2ea47fd4669a9bcbfa96a333d2dcd009bea) --- include/zephyr/arch/riscv/arch.h | 1 - include/zephyr/arch/riscv/common/linker.ld | 1 - include/zephyr/arch/riscv/irq.h | 1 - 3 files changed, 3 deletions(-) diff --git a/include/zephyr/arch/riscv/arch.h b/include/zephyr/arch/riscv/arch.h index 1ab509c162e..bbde28bdfbe 100644 --- a/include/zephyr/arch/riscv/arch.h +++ b/include/zephyr/arch/riscv/arch.h @@ -26,7 +26,6 @@ #endif /* CONFIG_USERSPACE */ #include #include -#include #include #include #include diff --git a/include/zephyr/arch/riscv/common/linker.ld b/include/zephyr/arch/riscv/common/linker.ld index eb5c4782441..128f823c4df 100644 --- a/include/zephyr/arch/riscv/common/linker.ld +++ b/include/zephyr/arch/riscv/common/linker.ld @@ -11,7 +11,6 @@ * Generic Linker script for the riscv platform */ -#include #include #include diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index c0db9a6687d..fa4b3989f05 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -22,7 +22,6 @@ extern "C" { #include #include #include -#include #endif /* !_ASMLANGUAGE */ /* Exceptions 0-15 (MCAUSE interrupt=0) */ From f01b9b89d0f9244f4804632f8df617a5767cc493 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Fri, 19 Jan 2024 10:10:08 +0100 Subject: [PATCH 0316/2300] [nrf fromtree] dts: Move nrf_common.dtsi to the common directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... so that it can be included by ARM and RISC-V cores. For the same reason, SysTick can no longer be disabled in this common file. Signed-off-by: Grzegorz Swiderski Signed-off-by: Andrzej Głąbek (cherry picked from commit 3cfa2296a6aed2e326166d521a3fd1978abb29a9) (cherry picked from commit 8f65f56adce8086eff1c2ae34d5f9facba49bf88) --- dts/arm/nordic/nrf51822.dtsi | 2 +- dts/arm/nordic/nrf52805.dtsi | 7 ++++++- dts/arm/nordic/nrf52810.dtsi | 7 ++++++- dts/arm/nordic/nrf52811.dtsi | 7 ++++++- dts/arm/nordic/nrf52820.dtsi | 7 ++++++- dts/arm/nordic/nrf52832.dtsi | 7 ++++++- dts/arm/nordic/nrf52833.dtsi | 7 ++++++- dts/arm/nordic/nrf52840.dtsi | 7 ++++++- dts/arm/nordic/nrf5340_cpuapp.dtsi | 7 ++++++- dts/arm/nordic/nrf5340_cpuappns.dtsi | 7 ++++++- dts/arm/nordic/nrf5340_cpunet.dtsi | 7 ++++++- dts/arm/nordic/nrf54l_common.dtsi | 2 +- dts/arm/nordic/nrf91.dtsi | 7 ++++++- dts/arm/nordic/nrf91ns.dtsi | 7 ++++++- dts/{arm => common}/nordic/nrf_common.dtsi | 8 -------- 15 files changed, 74 insertions(+), 22 deletions(-) rename dts/{arm => common}/nordic/nrf_common.dtsi (86%) diff --git a/dts/arm/nordic/nrf51822.dtsi b/dts/arm/nordic/nrf51822.dtsi index 499140a0fb8..b64de1d4985 100644 --- a/dts/arm/nordic/nrf51822.dtsi +++ b/dts/arm/nordic/nrf51822.dtsi @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ #include -#include "nrf_common.dtsi" +#include / { chosen { diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index c8839897f3c..c5a184d5e28 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -5,7 +5,7 @@ */ #include -#include "nrf_common.dtsi" +#include / { chosen { @@ -321,3 +321,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index cd2543ce511..1ca4a9ea378 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ #include -#include "nrf_common.dtsi" +#include / { chosen { @@ -347,3 +347,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 4034b4958e7..63b85676587 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -5,7 +5,7 @@ */ #include -#include "nrf_common.dtsi" +#include / { chosen { @@ -382,3 +382,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index c702cd45227..f93e449b0b2 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -5,7 +5,7 @@ */ #include -#include "nrf_common.dtsi" +#include / { @@ -399,3 +399,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index d3fb288f449..ed5a21b9935 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ #include -#include "nrf_common.dtsi" +#include / { chosen { @@ -475,3 +475,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 9ba7a85ad4a..5ac9cb2d2f8 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -5,7 +5,7 @@ */ #include -#include "nrf_common.dtsi" +#include / { chosen { @@ -543,3 +543,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index ae7a0b58ae9..20c18cf3d84 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ #include -#include "nrf_common.dtsi" +#include / { chosen { @@ -555,3 +555,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index 02b115b3cfe..e40f6241d91 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -5,7 +5,7 @@ */ #include -#include "nrf_common.dtsi" +#include / { cpus { @@ -115,3 +115,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf5340_cpuappns.dtsi b/dts/arm/nordic/nrf5340_cpuappns.dtsi index aa97c337067..6df1be54b34 100644 --- a/dts/arm/nordic/nrf5340_cpuappns.dtsi +++ b/dts/arm/nordic/nrf5340_cpuappns.dtsi @@ -7,7 +7,7 @@ /* .dtsi header for nRF5340 CPUAPP (Application MCU), Non-Secure domain */ #include -#include "nrf_common.dtsi" +#include / { cpus { @@ -77,3 +77,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index ae819dfb64f..8a95b3e9985 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -5,7 +5,7 @@ */ #include -#include "nrf_common.dtsi" +#include / { chosen { @@ -351,3 +351,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index 4fb7768bd3f..415f2471174 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -5,7 +5,7 @@ */ #include -#include "nrf_common.dtsi" +#include / { soc { diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 05a69b47583..66c80c73a44 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -5,7 +5,7 @@ */ #include -#include "nrf_common.dtsi" +#include / { cpus { @@ -107,3 +107,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf91ns.dtsi b/dts/arm/nordic/nrf91ns.dtsi index 23af6ebe37f..c692873981b 100644 --- a/dts/arm/nordic/nrf91ns.dtsi +++ b/dts/arm/nordic/nrf91ns.dtsi @@ -5,7 +5,7 @@ */ #include -#include "nrf_common.dtsi" +#include / { cpus { @@ -69,3 +69,8 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +&systick { + /* Use RTC for system clock, instead of SysTick. */ + status = "disabled"; +}; diff --git a/dts/arm/nordic/nrf_common.dtsi b/dts/common/nordic/nrf_common.dtsi similarity index 86% rename from dts/arm/nordic/nrf_common.dtsi rename to dts/common/nordic/nrf_common.dtsi index 8aec8dd0c89..f09557b23de 100644 --- a/dts/arm/nordic/nrf_common.dtsi +++ b/dts/common/nordic/nrf_common.dtsi @@ -43,11 +43,3 @@ #pwm-cells = <3>; }; }; - -&systick { - /* - * Nordic SoCs rely by default on the RTC for system clock - * implementation, so the SysTick node is not to be enabled. - */ - status = "disabled"; -}; From 687f04d8c0064fac013570ae5bfbaf7538cb2672 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 24 Jan 2024 15:58:47 +0100 Subject: [PATCH 0317/2300] [nrf fromtree] dt-bindings: misc: add nordic,nrf-ficr helper definitions Add definitions to access all FICR fields in the nRF54H20 EngA SoC. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 928dbb58c2c4a9d3283a6856e3728b6a77f4e22e) (cherry picked from commit 3c7e9dcfa5520864634d8b8763caa6a66bc00913) --- .../misc/nordic-nrf-ficr-nrf54h20-enga.h | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h diff --git a/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h b/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h new file mode 100644 index 00000000000..60b788a3516 --- /dev/null +++ b/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/* autogenerated using Nordic HAL utils/gen_offsets.py script */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ + +#define NRF_FICR_BLE_ADDRTYPE 0x00CU +#define NRF_FICR_BLE_ADDR_0 0x010U +#define NRF_FICR_BLE_ADDR_1 0x014U +#define NRF_FICR_BLE_ER_0 0x018U +#define NRF_FICR_BLE_ER_1 0x01CU +#define NRF_FICR_BLE_ER_2 0x020U +#define NRF_FICR_BLE_ER_3 0x024U +#define NRF_FICR_BLE_IR_0 0x028U +#define NRF_FICR_BLE_IR_1 0x02CU +#define NRF_FICR_BLE_IR_2 0x030U +#define NRF_FICR_BLE_IR_3 0x034U +#define NRF_FICR_NFC_TAGHEADER_0 0x040U +#define NRF_FICR_NFC_TAGHEADER_1 0x044U +#define NRF_FICR_NFC_TAGHEADER_2 0x048U +#define NRF_FICR_NFC_TAGHEADER_3 0x04CU +#define NRF_FICR_INFO_CONFIGID 0x050U +#define NRF_FICR_INFO_PART 0x054U +#define NRF_FICR_INFO_VARIANT 0x058U +#define NRF_FICR_INFO_PACKAGE 0x05CU +#define NRF_FICR_INFO_RAM 0x060U +#define NRF_FICR_INFO_MRAM 0x064U +#define NRF_FICR_INFO_CODEPAGESIZE 0x068U +#define NRF_FICR_INFO_CODESIZE 0x06CU +#define NRF_FICR_INFO_DEVICETYPE 0x070U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALVREF 0x384U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_0 0x388U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_1 0x38CU +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_2 0x390U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALOFFSET 0x394U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_0 0x398U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_1 0x39CU +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_2 0x3A0U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_3 0x3A4U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_4 0x3A8U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_5 0x3ACU +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALIREF 0x3B0U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALVREFTC 0x3B4U +#define NRF_FICR_TRIM_GLOBAL_NFCT_BIASCFG 0x3BCU +#define NRF_FICR_TRIM_GLOBAL_CANPLL_TRIM_CTUNE 0x3C0U +#define NRF_FICR_TRIM_GLOBAL_COMP_REFTRIM 0x3D0U +#define NRF_FICR_TRIM_GLOBAL_COMP_RCALTRIM 0x3D4U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP 0x3D8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0 0x3DCU +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_1 0x3E0U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_2 0x3E4U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_3 0x3E8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_4 0x3ECU +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_5 0x3F0U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0 0x3F4U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_1 0x3F8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_2 0x3FCU +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_3 0x400U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_4 0x404U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_5 0x408U +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_0_TRIM 0x40CU +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_1_TRIM 0x410U +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_2_TRIM 0x414U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP 0x418U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_0 0x41CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1 0x420U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_2 0x424U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_3 0x428U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_4 0x42CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_5 0x430U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_0 0x434U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1 0x438U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_2 0x43CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_3 0x440U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_4 0x444U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_5 0x448U +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_0_TRIM 0x44CU +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_1_TRIM 0x450U +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_2_TRIM 0x454U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL0 0x458U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL1 0x45CU +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL2 0x460U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_RXCTRL 0x464U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_OVRRXTRIMCODE 0x468U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_RXAGC_CALIBRATION 0x46CU +#define NRF_FICR_TRIM_RADIOCORE_RADIO_PVTTOT 0x470U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_KDTC 0x474U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_TXHFGAIN 0x478U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_PVTTOFIX 0x47CU +#define NRF_FICR_TRIM_RADIOCORE_RADIO_LOOPGAIN 0x480U + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ */ From da8b5b2e9bda4482b0b8ef95f5c6e05d27c653c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 31 Jan 2024 18:10:55 +0100 Subject: [PATCH 0318/2300] [nrf fromtree] dts: Add and extend Nordic bindings needed for nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a set of bindings that will be used in the nRF54H20 SoC definition. Extend the existing GPIOTE binding with properties needed for this SoC. Also do a tiny clean-up in the bindings added recently for nRF54L15 (HFXO and LFXO). Signed-off-by: Grzegorz Swiderski Signed-off-by: Gerard Marull-Paretas Signed-off-by: Andrzej Głąbek (cherry picked from commit 6bce7898291b86d8d5b1ea929e49fd7bd7a3988e) (cherry picked from commit 56f6642d5f46d67cda96b6d5187dc6c65ce705b4) --- dts/bindings/arm/nordic,nrf-uicr-v2.yaml | 26 ++++++ dts/bindings/clock/nordic,nrf-hfxo.yaml | 2 +- dts/bindings/clock/nordic,nrf-hsfll.yaml | 65 ++++++++++++++ dts/bindings/clock/nordic,nrf-lfxo.yaml | 2 +- dts/bindings/cpu/nordic,vpr.yaml | 18 ++++ dts/bindings/gpio/nordic,nrf-gpiote.yaml | 4 +- .../interrupt-controller/nordic,nrf-clic.yaml | 19 ++++ dts/bindings/mtd/nordic,mram.yaml | 12 +++ dts/bindings/mtd/nordic,owned-partitions.yaml | 89 +++++++++++++++++++ .../reserved-memory/nordic,owned-memory.yaml | 46 ++++++++++ .../riscv/nordic,nrf-vpr-coprocessor.yaml | 29 ++++++ 11 files changed, 309 insertions(+), 3 deletions(-) create mode 100644 dts/bindings/arm/nordic,nrf-uicr-v2.yaml create mode 100644 dts/bindings/clock/nordic,nrf-hsfll.yaml create mode 100644 dts/bindings/cpu/nordic,vpr.yaml create mode 100644 dts/bindings/interrupt-controller/nordic,nrf-clic.yaml create mode 100644 dts/bindings/mtd/nordic,mram.yaml create mode 100644 dts/bindings/mtd/nordic,owned-partitions.yaml create mode 100644 dts/bindings/reserved-memory/nordic,owned-memory.yaml create mode 100644 dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml diff --git a/dts/bindings/arm/nordic,nrf-uicr-v2.yaml b/dts/bindings/arm/nordic,nrf-uicr-v2.yaml new file mode 100644 index 00000000000..f509fdf4061 --- /dev/null +++ b/dts/bindings/arm/nordic,nrf-uicr-v2.yaml @@ -0,0 +1,26 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic UICR v2 (User Information Configuration Registers) + +compatible: "nordic,nrf-uicr-v2" + +include: base.yaml + +properties: + reg: + required: true + + domain: + type: int + required: true + 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/bindings/clock/nordic,nrf-hfxo.yaml b/dts/bindings/clock/nordic,nrf-hfxo.yaml index dc99c67e5cc..cd82e1c34d3 100644 --- a/dts/bindings/clock/nordic,nrf-hfxo.yaml +++ b/dts/bindings/clock/nordic,nrf-hfxo.yaml @@ -5,7 +5,7 @@ description: Nordic nRF high-frequency crystal oscillator compatible: "nordic,nrf-hfxo" -include: [fixed-clock.yaml] +include: fixed-clock.yaml properties: clock-frequency: diff --git a/dts/bindings/clock/nordic,nrf-hsfll.yaml b/dts/bindings/clock/nordic,nrf-hsfll.yaml new file mode 100644 index 00000000000..3614d80870f --- /dev/null +++ b/dts/bindings/clock/nordic,nrf-hsfll.yaml @@ -0,0 +1,65 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic nRF HSFLL + + The HSFLL mixed-mode IP generates several clock frequencies in the range from + 64 MHz to 400 MHz (in steps of 16 MHz). + + Usage example: + + hsfll: clock@deadbeef { + compatible = "nordic,nrf-hsfll"; + reg = <0xdeadbeef 0x1000>; + clocks = <&fll16m>; + clock-frequency = ; + nordic,ficrs = <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; + nordic,ficr-names = "vsup", "coarse", "fine"; + }; + + Required FICR entries are for VSUP, COARSE and FINE trim values. + +compatible: "nordic,nrf-hsfll" + +include: [base.yaml, fixed-clock.yaml, nordic-nrf-ficr-client.yaml] + +properties: + reg: + required: true + + clocks: + required: true + + clock-frequency: + enum: + - 64000000 + - 80000000 + - 96000000 + - 112000000 + - 128000000 + - 144000000 + - 160000000 + - 176000000 + - 192000000 + - 208000000 + - 224000000 + - 240000000 + - 256000000 + - 272000000 + - 288000000 + - 304000000 + - 320000000 + - 336000000 + - 352000000 + - 368000000 + - 384000000 + - 400000000 + + nordic,ficrs: + required: true + + nordic,ficr-names: + required: true diff --git a/dts/bindings/clock/nordic,nrf-lfxo.yaml b/dts/bindings/clock/nordic,nrf-lfxo.yaml index f0090ff4a81..328c374769c 100644 --- a/dts/bindings/clock/nordic,nrf-lfxo.yaml +++ b/dts/bindings/clock/nordic,nrf-lfxo.yaml @@ -5,7 +5,7 @@ description: Nordic nRF low-frequency crystal oscillator compatible: "nordic,nrf-lfxo" -include: [fixed-clock.yaml] +include: fixed-clock.yaml properties: clock-frequency: diff --git a/dts/bindings/cpu/nordic,vpr.yaml b/dts/bindings/cpu/nordic,vpr.yaml new file mode 100644 index 00000000000..11146f89c51 --- /dev/null +++ b/dts/bindings/cpu/nordic,vpr.yaml @@ -0,0 +1,18 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic Semiconductor RISC-V VPR CPU + +compatible: "nordic,vpr" + +include: riscv,cpus.yaml + +properties: + nordic,bus-width: + type: int + enum: + - 32 + - 64 + required: true + description: + Bus width of the CPU. diff --git a/dts/bindings/gpio/nordic,nrf-gpiote.yaml b/dts/bindings/gpio/nordic,nrf-gpiote.yaml index cefc3385afe..4bb09574e9b 100644 --- a/dts/bindings/gpio/nordic,nrf-gpiote.yaml +++ b/dts/bindings/gpio/nordic,nrf-gpiote.yaml @@ -5,7 +5,9 @@ description: NRF5 GPIOTE node compatible: "nordic,nrf-gpiote" -include: base.yaml +include: + - base.yaml + - nordic,split-channels.yaml properties: reg: diff --git a/dts/bindings/interrupt-controller/nordic,nrf-clic.yaml b/dts/bindings/interrupt-controller/nordic,nrf-clic.yaml new file mode 100644 index 00000000000..f570e668ea5 --- /dev/null +++ b/dts/bindings/interrupt-controller/nordic,nrf-clic.yaml @@ -0,0 +1,19 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic VPR CLIC + +compatible: "nordic,nrf-clic" + +include: [interrupt-controller.yaml, base.yaml] + +properties: + reg: + required: true + + "#interrupt-cells": + const: 2 + +interrupt-cells: + - irq + - priority diff --git a/dts/bindings/mtd/nordic,mram.yaml b/dts/bindings/mtd/nordic,mram.yaml new file mode 100644 index 00000000000..dac7d14305d --- /dev/null +++ b/dts/bindings/mtd/nordic,mram.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic MRAM + +compatible: nordic,mram + +include: soc-nv-flash.yaml + +properties: + reg: + required: true diff --git a/dts/bindings/mtd/nordic,owned-partitions.yaml b/dts/bindings/mtd/nordic,owned-partitions.yaml new file mode 100644 index 00000000000..bf42c13346a --- /dev/null +++ b/dts/bindings/mtd/nordic,owned-partitions.yaml @@ -0,0 +1,89 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic Owned Partitions + + Memory partition table with permission attributes common to its partitions. + This is a special case of the Nordic Owned Memory binding. + + Every compatible node is expected to be a child of a memory node, where the + listed partitions belong. + + A single memory node can contain multiple partition tables, each with a + different set of permissions. For each such table, the smallest memory region + spanning the contained partitions will be recorded in the UICR. These regions + are allowed to contain gaps between the partitions, but this is discouraged. + + Example: + + mram1x: mram@e000000 { + compatible = "nordic,mram"; + reg = <0xe000000 0x200000>; + ... + + rx-partitions { + compatible = "nordic,owned-partitions"; + perm-read; + perm-execute; + #address-cells = <1>; + #size-cells = <1>; + + slot0_partition: partition@c0000 { + label = "image-0"; + reg = <0xc0000 0x40000>; + }; + }; + + rw-partitions { + compatible = "nordic,owned-partitions"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + + slot1_partition: partition@100000 { + label = "image-1"; + reg = <0x100000 0x50000>; + }; + storage_partition: partition@150000 { + label = "storage"; + reg = <0x150000 0x6000>; + }; + }; + }; + + From this example, two memory regions will be inferred: + + - 0x0E0C0000--0x0E100000, with read & execute permissions, containing the + partition labeled "image-0". + - 0x0E100000--0x0E156000, with read & write permissions, containing the + partitions labeled "image-1" and "storage". + +compatible: "nordic,owned-partitions" + +include: + - name: nordic,owned-memory.yaml + property-blocklist: + - reg + +properties: + "#address-cells": + required: true + + "#size-cells": + required: true + +child-binding: + description: | + Partitions in the table are defined as subnodes. Each partition must have a + size and an offset relative to the base address of the parent memory node. + + include: + - name: base.yaml + property-blocklist: + - compatible + + properties: + reg: + required: true diff --git a/dts/bindings/reserved-memory/nordic,owned-memory.yaml b/dts/bindings/reserved-memory/nordic,owned-memory.yaml new file mode 100644 index 00000000000..9b13c965ac8 --- /dev/null +++ b/dts/bindings/reserved-memory/nordic,owned-memory.yaml @@ -0,0 +1,46 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic Owned Memory + + Memory region with permission attributes. Each enabled region of this kind + 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. + +compatible: "nordic,owned-memory" + +include: base.yaml + +properties: + reg: + required: true + + owner-id: + type: int + description: | + Owner ID of the domain that will own this memory region. If not defined, + the ownership will default to the domain being compiled. + + Note: owner ID is not the same as domain ID; see the product specification + for details. + + perm-read: + type: boolean + description: Owner has read access to the region. + + perm-write: + type: boolean + description: Owner has write access to the region. + + perm-execute: + type: boolean + description: Owner can execute code from the region. + + perm-secure: + type: boolean + description: Owner has secure-only access to the region. + + non-secure-callable: + type: boolean + description: Memory region is used for non-secure-callable code. diff --git a/dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml b/dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml new file mode 100644 index 00000000000..6be94dce25d --- /dev/null +++ b/dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml @@ -0,0 +1,29 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +compatible: "nordic,nrf-vpr-coprocessor" + +description: | + VPR coprocessor + + VPR is a RISC-V CPU implementation. VPR instances are exposed to other CPUs as + peripherals. + +include: base.yaml + +properties: + cpu: + type: int + description: | + Processor ID of the VPR core. + + execution-memory: + type: phandle + required: true + description: | + Memory area from which the VPR core will execute. + + source-memory: + type: phandle + description: | + Memory area or partition from which the VPR code will be loaded. From 1c3ff0d3e866ff8e99072980ff661a193b607372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 31 Jan 2024 18:22:59 +0100 Subject: [PATCH 0319/2300] [nrf fromtree] dts: Add initial support for nRF54H20 EngA SoC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add definition of the nRF54H20 SoC revision EngA with its Application, Radio, and Peripheral Processor (PPR) cores and basic peripherals: GRTC, GPIOs, GPIOTE, and UARTs. Signed-off-by: Grzegorz Swiderski Signed-off-by: Gerard Marull-Paretas Signed-off-by: Andrzej Głąbek (cherry picked from commit 50d56c9503cfcd1c75d83f095d04c8b221d9076f) (cherry picked from commit bdecfda0b9e9dfcf8595987848dbc60e6b818217) --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 38 +++ dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 38 +++ dts/common/nordic/nrf54h20_enga.dtsi | 310 +++++++++++++++++++++ dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 35 +++ 4 files changed, 421 insertions(+) create mode 100644 dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi create mode 100644 dts/arm/nordic/nrf54h20_enga_cpurad.dtsi create mode 100644 dts/common/nordic/nrf54h20_enga.dtsi create mode 100644 dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi new file mode 100644 index 00000000000..f51528d5733 --- /dev/null +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuapp {}; +systick: &cpuapp_systick {}; +nvic: &cpuapp_nvic {}; + +/delete-node/ &cpuppr; +/delete-node/ &cpurad; +/delete-node/ &cpurad_peripherals; +/delete-node/ &cpurad_ppb; +/delete-node/ &cpurad_ram0; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuapp_nvic>; + ranges; + }; +}; + +&cpuapp_ppb { + compatible = "simple-bus"; + ranges; +}; + +&gpiote130 { + interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&grtc { + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi new file mode 100644 index 00000000000..cb2767381da --- /dev/null +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpurad {}; +systick: &cpurad_systick {}; +nvic: &cpurad_nvic {}; + +/delete-node/ &cpuapp; +/delete-node/ &cpuapp_peripherals; +/delete-node/ &cpuapp_ppb; +/delete-node/ &cpuapp_ram0; +/delete-node/ &cpuppr; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpurad_nvic>; + ranges; + }; +}; + +&cpurad_ppb { + compatible = "simple-bus"; + ranges; +}; + +&gpiote130 { + interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&grtc { + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi new file mode 100644 index 00000000000..1b8f7b6f9e8 --- /dev/null +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include + +/delete-node/ &sw_pwm; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpuapp: cpu@2 { + compatible = "arm,cortex-m33"; + reg = <2>; + device_type = "cpu"; + clock-frequency = ; + }; + + cpurad: cpu@3 { + compatible = "arm,cortex-m33"; + reg = <3>; + device_type = "cpu"; + clock-frequency = ; + }; + + cpuppr: cpu@d { + compatible = "nordic,vpr"; + reg = <13>; + device_type = "cpu"; + clock-frequency = ; + riscv,isa = "rv32emc"; + nordic,bus-width = <32>; + }; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + + cpurad_uicr_ext: memory@e1ff000 { + reg = <0xe1ff000 DT_SIZE_K(2)>; + }; + + cpuapp_uicr_ext: memory@e1ff800 { + reg = <0xe1ff800 DT_SIZE_K(2)>; + }; + }; + + clocks { + fll16m: fll16m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + + mram1x: mram@e000000 { + compatible = "nordic,mram"; + reg = <0xe000000 DT_SIZE_K(2048)>; + write-block-size = <16>; + }; + + cpuapp_uicr: uicr@fff8000 { + 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 { + compatible = "nordic,nrf-ficr"; + reg = <0xfffe000 DT_SIZE_K(2)>; + #nordic,ficr-cells = <1>; + }; + + cpuapp_ram0: sram@22000000 { + compatible = "mmio-sram"; + reg = <0x22000000 DT_SIZE_K(32)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x22000000 0x8000>; + }; + + cpurad_ram0: sram@23000000 { + compatible = "mmio-sram"; + reg = <0x23000000 DT_SIZE_K(64)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x23000000 0x10000>; + }; + + cpuapp_peripherals: peripheral@52000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x52000000 0x1000000>; + + cpuapp_hsfll: clock@d000 { + compatible = "nordic,nrf-hsfll"; + #clock-cells = <0>; + reg = <0xd000 0x1000>; + clocks = <&fll16m>; + clock-frequency = ; + nordic,ficrs = + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; + nordic,ficr-names = "vsup", "coarse", "fine"; + }; + }; + + cpurad_peripherals: peripheral@53000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x53000000 0x1000000>; + + cpurad_hsfll: clock@d000 { + compatible = "nordic,nrf-hsfll"; + #clock-cells = <0>; + reg = <0xd000 0x1000>; + clocks = <&fll16m>; + clock-frequency = ; + nordic,ficrs = + <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP>, + <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1>, + <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1>; + nordic,ficr-names = "vsup", "coarse", "fine"; + }; + }; + + global_peripherals: peripheral@5f000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x5f000000 0x1000000>; + + cpuppr_vpr: vpr@908000 { + compatible = "nordic,nrf-vpr-coprocessor"; + reg = <0x908000 0x1000>; + status = "disabled"; + cpu = <13>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x908000 0x4000>; + + cpuppr_clic: interrupt-controller@1000 { + compatible = "nordic,nrf-clic"; + reg = <0x1000 0x3000>; + status = "disabled"; + #interrupt-cells = <2>; + interrupt-controller; + #address-cells = <1>; + }; + }; + + gpiote130: gpiote@934000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x934000 0x1000>; + status = "disabled"; + instance = <130>; + }; + + gpio0: gpio@938000 { + compatible = "nordic,nrf-gpio"; + reg = <0x938000 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <12>; + port = <0>; + }; + + gpio1: gpio@938200 { + compatible = "nordic,nrf-gpio"; + reg = <0x938200 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <12>; + port = <1>; + }; + + gpio2: gpio@938400 { + compatible = "nordic,nrf-gpio"; + reg = <0x938400 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <12>; + port = <2>; + }; + + gpio6: gpio@938c00 { + compatible = "nordic,nrf-gpio"; + reg = <0x938c00 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + ngpios = <14>; + port = <6>; + }; + + gpio7: gpio@938e00 { + compatible = "nordic,nrf-gpio"; + reg = <0x938e00 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + ngpios = <8>; + port = <7>; + }; + + gpio9: gpio@939200 { + compatible = "nordic,nrf-gpio"; + reg = <0x939200 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <6>; + port = <9>; + }; + + grtc: grtc@99c000 { + compatible = "nordic,nrf-grtc"; + reg = <0x99c000 0x1000>; + status = "disabled"; + cc-num = <16>; + }; + + uart135: uart@9c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9c6000 0x1000>; + status = "disabled"; + current-speed = <115200>; + interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + uart136: uart@9d5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9d5000 0x1000>; + status = "disabled"; + current-speed = <115200>; + interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; + }; + }; + }; + + cpuapp_ppb: cpuapp-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + + cpuapp_nvic: interrupt-controller@e000e100 { + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + #interrupt-cells = <2>; + interrupt-controller; + #address-cells = <1>; + }; + }; + + cpurad_ppb: cpurad-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpurad_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + + cpurad_nvic: interrupt-controller@e000e100 { + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + #interrupt-cells = <2>; + interrupt-controller; + #address-cells = <1>; + }; + }; +}; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi new file mode 100644 index 00000000000..d42a815a4b2 --- /dev/null +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuppr {}; +clic: &cpuppr_clic {}; + +/delete-node/ &cpuapp; +/delete-node/ &cpuapp_peripherals; +/delete-node/ &cpuapp_ppb; +/delete-node/ &cpuapp_ram0; +/delete-node/ &cpurad; +/delete-node/ &cpurad_peripherals; +/delete-node/ &cpurad_ppb; +/delete-node/ &cpurad_ram0; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuppr_clic>; + ranges; + }; +}; + +&gpiote130 { + interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&grtc { + interrupts = <108 NRF_DEFAULT_IRQ_PRIORITY>; +}; From 39d25074c235a69b5c9d756f9285d4ed93d32609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 31 Jan 2024 18:34:10 +0100 Subject: [PATCH 0320/2300] [nrf fromtree] modules: hal_nordic: nrfx_glue: Include cmsis_core_m_defaults.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... to cover missing __ICACHE_PRESENT and __DCACHE_PRESENT symbols that should be defined in MDK files. Signed-off-by: Andrzej Głąbek (cherry picked from commit 2efd34bda32febd07d9618ebb0683a445d3abb62) (cherry picked from commit 02298edda42fa45f0d576d2aaf4831efbfb8ed35) --- modules/hal_nordic/nrfx/nrfx_glue.h | 7 +++++++ soc/arm/nordic_nrf/nrf54l/soc.h | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/hal_nordic/nrfx/nrfx_glue.h b/modules/hal_nordic/nrfx/nrfx_glue.h index 2257ea879a3..851cb8a9614 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.h +++ b/modules/hal_nordic/nrfx/nrfx_glue.h @@ -7,6 +7,13 @@ #ifndef NRFX_GLUE_H__ #define NRFX_GLUE_H__ +#if defined(CONFIG_CPU_CORTEX_M) +/* Workaround for missing __ICACHE_PRESENT and __DCACHE_PRESENT symbols in MDK + * SoC definitions. To be removed when this is fixed. + */ +#include +#endif + #include #include #include diff --git a/soc/arm/nordic_nrf/nrf54l/soc.h b/soc/arm/nordic_nrf/nrf54l/soc.h index 721e9336989..b775fa9d0f3 100644 --- a/soc/arm/nordic_nrf/nrf54l/soc.h +++ b/soc/arm/nordic_nrf/nrf54l/soc.h @@ -11,8 +11,6 @@ #ifndef _NORDICSEMI_NRF54L_SOC_H_ #define _NORDICSEMI_NRF54L_SOC_H_ -#define __ICACHE_PRESENT 1 - #include #define FLASH_PAGE_ERASE_MAX_TIME_US 8000UL From 23bd29072f8c16ef0ce26bee318a97d0dd34bc79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 1 Feb 2024 09:40:57 +0100 Subject: [PATCH 0321/2300] [nrf fromtree] modules: hal_nordic: Use common nrfx_config section for GRTC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move code that prepares `NRFX_CONFIG_GRTC_*` definitions based on information from devicetree from the nRF54L15 nrfx_config header to the global one, so that the code can be used by nRF54H20, too. The checks that validate owned-channels and child-owned-channels DT properties are moved to the nrf_grtc_timer driver so that the global nrfx_config is not polluted unnecessarily. The default values in nrfx_config_nrf54l15_enga_application.h are restored to those from the corresponding template file. Signed-off-by: Andrzej Głąbek (cherry picked from commit 139b97a64af4414963cbe5de1f0fea3bc7a4f969) (cherry picked from commit 48ca22f1d90cd11b43ee74b0afa8f368b4b7154b) --- drivers/timer/nrf_grtc_timer.c | 14 ++++++- modules/hal_nordic/nrfx/nrfx_config.h | 21 ++++++++++ .../nrfx_config_nrf54l15_enga_application.h | 38 ++++++------------- 3 files changed, 44 insertions(+), 29 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index dc6ac410905..a706c04bae0 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -13,6 +13,18 @@ #include #include +#define GRTC_NODE DT_NODELABEL(grtc) + +/* Ensure that GRTC properties in devicetree are defined correctly. */ +#if !DT_NODE_HAS_PROP(GRTC_NODE, owned_channels) +#error GRTC owned-channels DT property is not defined +#endif +#define OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(owned_channels) +#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels) +#if ((OWNED_CHANNELS_MASK | CHILD_OWNED_CHANNELS_MASK) != OWNED_CHANNELS_MASK) +#error GRTC child-owned-channels DT property must be a subset of owned-channels +#endif + #define CHAN_COUNT NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS #define EXT_CHAN_COUNT (CHAN_COUNT - 1) /* The reset value of waketime is 1, which doesn't seem to work. @@ -22,8 +34,6 @@ #define WAKETIME (4) #define TIMEOUT (WAKETIME + 1) -#define GRTC_NODE DT_NODELABEL(grtc) - #ifndef GRTC_SYSCOUNTERL_VALUE_Msk #define GRTC_SYSCOUNTERL_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERL_VALUE_Msk #endif diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 543329b4a30..d315fd2622c 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -675,6 +675,27 @@ #define NRF_PERIPH(P) P##_S #endif +/* If the GRTC system timer driver is to be used, prepare definitions required + * by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and + * NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree. + */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) +#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ + BIT(DT_PROP_BY_IDX(node_id, prop, idx)) +#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ + (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ + (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ + NRFX_CONFIG_BIT_DT, (|))), \ + (0))) + +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ + (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ + ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ + (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ + DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ + #include #if defined(NRF51) #include 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 46b0aa0eff7..a694a07955d 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h @@ -249,37 +249,21 @@ #define NRFX_GRTC_ENABLED 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 11 +#endif + /** * @brief GRTC CC channels ownership mask. */ #ifndef NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) -#if DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), owned_channels) -#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ - BIT(DT_PROP_BY_IDX(node_id, prop, idx)) -#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ - (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ - (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ - NRFX_CONFIG_BIT_DT, (|))), \ - (0))) - -#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ - (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ - ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) -#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ - (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ - DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) - -#if ((NRFX_CONFIG_GRTC_MASK_DT(owned_channels) | \ - NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) != NRFX_CONFIG_GRTC_MASK_DT(owned_channels)) -#error "`child-owned-channels` property must be a subset of `owned-channels` property" -#endif -#else -#error "property `owned-channels` does not exist" -#endif /* DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), owned_channels) */ -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ - -#endif /* NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK */ +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK 0x000007ff +#endif /** * @brief NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY From 3e755b05f407d5bbfcdac976c7e19cefa498d864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 23 Jan 2024 17:54:21 +0100 Subject: [PATCH 0322/2300] [nrf fromtree] soc: nordic: Add initial support for nRF54H20 EngA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nrfx and Kconfig related infrastructure plus SoC initialization code to allow building for nRF54H20 targets (Application and Radio cores). Signed-off-by: Gerard Marull-Paretas Signed-off-by: Andrzej Głąbek (cherry picked from commit abb0934deffa16d6a11dd58559faaf2984f90285) (cherry picked from commit 664240c23d847784f2a6956ba3f33d7729c02222) --- modules/hal_nordic/nrfx/CMakeLists.txt | 6 + modules/hal_nordic/nrfx/nrfx_config.h | 4 + .../nrfx_config_nrf54h20_enga_application.h | 1935 ++++++++++++++++ .../nrfx_config_nrf54h20_enga_radiocore.h | 2016 +++++++++++++++++ soc/arm/nordic_nrf/Kconfig | 1 + soc/arm/nordic_nrf/Kconfig.defconfig | 2 +- soc/arm/nordic_nrf/nrf54h/CMakeLists.txt | 7 + .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 14 + .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 14 + .../nrf54h/Kconfig.defconfig.series | 16 + soc/arm/nordic_nrf/nrf54h/Kconfig.series | 16 + soc/arm/nordic_nrf/nrf54h/Kconfig.soc | 37 + soc/arm/nordic_nrf/nrf54h/align.ld | 10 + soc/arm/nordic_nrf/nrf54h/soc.c | 104 + soc/arm/nordic_nrf/nrf54h/soc.h | 12 + 15 files changed, 4193 insertions(+), 1 deletion(-) create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h create mode 100644 soc/arm/nordic_nrf/nrf54h/CMakeLists.txt create mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp create mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad create mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.series create mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.series create mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.soc create mode 100644 soc/arm/nordic_nrf/nrf54h/align.ld create mode 100644 soc/arm/nordic_nrf/nrf54h/soc.c create mode 100644 soc/arm/nordic_nrf/nrf54h/soc.h diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 20740683a44..f2ddea1a23a 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -36,6 +36,11 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_ENGA_CPUAPP NRF_APPLICATION zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP NRF54H20_ENGA_XXAA + NRF_APPLICATION) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD NRF54H20_ENGA_XXAA + NRF_RADIOCORE) + zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_LOCK ENABLE_APPROTECT) zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_USER_HANDLING @@ -66,6 +71,7 @@ zephyr_library_sources_ifdef(CONFIG_SOC_NRF52833 ${MDK_DIR}/system_nrf5283 zephyr_library_sources_ifdef(CONFIG_SOC_NRF52840 ${MDK_DIR}/system_nrf52840.c) 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) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF91X ${MDK_DIR}/system_nrf91.c) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index d315fd2622c..215eff5bfcd 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -717,6 +717,10 @@ #include #elif defined(NRF5340_XXAA_NETWORK) #include +#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_APPLICATION) + #include +#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_RADIOCORE) + #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) #include #elif defined(NRF54L15_ENGA_XXAA) && defined(NRF_APPLICATION) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h new file mode 100644 index 00000000000..e6c79341b9a --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h @@ -0,0 +1,1935 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54H20_ENGA_APPLICATION_H__ +#define NRFX_CONFIG_NRF54H20_ENGA_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_BELLBOARD_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD_ENABLED +#define NRFX_BELLBOARD_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_BELLBOARD0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD0_ENABLED +#define NRFX_BELLBOARD0_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD1_ENABLED +#define NRFX_BELLBOARD1_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD2_ENABLED +#define NRFX_BELLBOARD2_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD3_ENABLED +#define NRFX_BELLBOARD3_ENABLED 0 +#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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 +#endif + +/** + * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e +#endif + +/** + * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 +#endif + +/** + * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 +#endif + +/** + * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 +#endif + +/** + * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f +#endif + +/** + * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 +#endif + +/** + * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df +#endif + +/** + * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf +#endif + +/** + * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e +#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 1 +#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_GPIOTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE130_ENABLED +#define NRFX_GPIOTE130_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_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: 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_I2S130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S130_ENABLED +#define NRFX_I2S130_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S131_ENABLED +#define NRFX_I2S131_ENABLED 0 +#endif + +/** + * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#endif + +/** + * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#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_MVDMA_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA_ENABLED +#define NRFX_MVDMA_ENABLED 0 +#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_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_PRS_BOX_6_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_6_ENABLED +#define NRFX_PRS_BOX_6_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_7_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_7_ENABLED +#define NRFX_PRS_BOX_7_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_8_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_8_ENABLED +#define NRFX_PRS_BOX_8_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_9_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_9_ENABLED +#define NRFX_PRS_BOX_9_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_PWM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM120_ENABLED +#define NRFX_PWM120_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM130_ENABLED +#define NRFX_PWM130_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM131_ENABLED +#define NRFX_PWM131_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM132_ENABLED +#define NRFX_PWM132_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM133_ENABLED +#define NRFX_PWM133_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_QDEC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC130_ENABLED +#define NRFX_QDEC130_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC131_ENABLED +#define NRFX_QDEC131_ENABLED 0 +#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_RTC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC130_ENABLED +#define NRFX_RTC130_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC131_ENABLED +#define NRFX_RTC131_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_SPIM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM120_ENABLED +#define NRFX_SPIM120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM121_ENABLED +#define NRFX_SPIM121_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM130_ENABLED +#define NRFX_SPIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM131_ENABLED +#define NRFX_SPIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM132_ENABLED +#define NRFX_SPIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM133_ENABLED +#define NRFX_SPIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM134_ENABLED +#define NRFX_SPIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM135_ENABLED +#define NRFX_SPIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM136_ENABLED +#define NRFX_SPIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM137_ENABLED +#define NRFX_SPIM137_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_SPIS120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS120_ENABLED +#define NRFX_SPIS120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS130_ENABLED +#define NRFX_SPIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS131_ENABLED +#define NRFX_SPIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS132_ENABLED +#define NRFX_SPIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS133_ENABLED +#define NRFX_SPIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS134_ENABLED +#define NRFX_SPIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS135_ENABLED +#define NRFX_SPIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS136_ENABLED +#define NRFX_SPIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS137_ENABLED +#define NRFX_SPIS137_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_TIMER120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER120_ENABLED +#define NRFX_TIMER120_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER121_ENABLED +#define NRFX_TIMER121_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER130_ENABLED +#define NRFX_TIMER130_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER131_ENABLED +#define NRFX_TIMER131_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER132_ENABLED +#define NRFX_TIMER132_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER133_ENABLED +#define NRFX_TIMER133_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER134_ENABLED +#define NRFX_TIMER134_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER135_ENABLED +#define NRFX_TIMER135_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER136_ENABLED +#define NRFX_TIMER136_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER137_ENABLED +#define NRFX_TIMER137_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_TWIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM130_ENABLED +#define NRFX_TWIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM131_ENABLED +#define NRFX_TWIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM132_ENABLED +#define NRFX_TWIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM133_ENABLED +#define NRFX_TWIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM134_ENABLED +#define NRFX_TWIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM135_ENABLED +#define NRFX_TWIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM136_ENABLED +#define NRFX_TWIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM137_ENABLED +#define NRFX_TWIM137_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_TWIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS130_ENABLED +#define NRFX_TWIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS131_ENABLED +#define NRFX_TWIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS132_ENABLED +#define NRFX_TWIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS133_ENABLED +#define NRFX_TWIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS134_ENABLED +#define NRFX_TWIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS135_ENABLED +#define NRFX_TWIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS136_ENABLED +#define NRFX_TWIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS137_ENABLED +#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE120_ENABLED +#define NRFX_UARTE120_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE130_ENABLED +#define NRFX_UARTE130_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE131_ENABLED +#define NRFX_UARTE131_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE132_ENABLED +#define NRFX_UARTE132_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE133_ENABLED +#define NRFX_UARTE133_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE134_ENABLED +#define NRFX_UARTE134_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE135_ENABLED +#define NRFX_UARTE135_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE136_ENABLED +#define NRFX_UARTE136_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE137_ENABLED +#define NRFX_UARTE137_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_WDT010_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT010_ENABLED +#define NRFX_WDT010_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT011_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT011_ENABLED +#define NRFX_WDT011_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT131_ENABLED +#define NRFX_WDT131_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT132_ENABLED +#define NRFX_WDT132_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54H20_ENGA_APPLICATION_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h new file mode 100644 index 00000000000..7b9a1c4b733 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h @@ -0,0 +1,2016 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_H__ +#define NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_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_BELLBOARD_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD_ENABLED +#define NRFX_BELLBOARD_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_BELLBOARD0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD0_ENABLED +#define NRFX_BELLBOARD0_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD1_ENABLED +#define NRFX_BELLBOARD1_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD2_ENABLED +#define NRFX_BELLBOARD2_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD3_ENABLED +#define NRFX_BELLBOARD3_ENABLED 0 +#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_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#endif + +/** + * @brief NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#endif + +/** + * @brief NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 +#endif + +/** + * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e +#endif + +/** + * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 +#endif + +/** + * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 +#endif + +/** + * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 +#endif + +/** + * @brief NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f +#endif + +/** + * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 +#endif + +/** + * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df +#endif + +/** + * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf +#endif + +/** + * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e +#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_EGU020_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU020_ENABLED +#define NRFX_EGU020_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 1 +#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_GPIOTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE130_ENABLED +#define NRFX_GPIOTE130_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_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 0x00000f00 +#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_I2S130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S130_ENABLED +#define NRFX_I2S130_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S131_ENABLED +#define NRFX_I2S131_ENABLED 0 +#endif + +/** + * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 +#endif + +/** + * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000c0 +#endif + +/** + * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#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_MVDMA_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA_ENABLED +#define NRFX_MVDMA_ENABLED 0 +#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_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_PRS_BOX_6_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_6_ENABLED +#define NRFX_PRS_BOX_6_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_7_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_7_ENABLED +#define NRFX_PRS_BOX_7_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_8_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_8_ENABLED +#define NRFX_PRS_BOX_8_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_9_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_9_ENABLED +#define NRFX_PRS_BOX_9_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_PWM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM120_ENABLED +#define NRFX_PWM120_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM130_ENABLED +#define NRFX_PWM130_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM131_ENABLED +#define NRFX_PWM131_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM132_ENABLED +#define NRFX_PWM132_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM133_ENABLED +#define NRFX_PWM133_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_QDEC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC130_ENABLED +#define NRFX_QDEC130_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC131_ENABLED +#define NRFX_QDEC131_ENABLED 0 +#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_RTC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC130_ENABLED +#define NRFX_RTC130_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC131_ENABLED +#define NRFX_RTC131_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_SPIM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM120_ENABLED +#define NRFX_SPIM120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM121_ENABLED +#define NRFX_SPIM121_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM130_ENABLED +#define NRFX_SPIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM131_ENABLED +#define NRFX_SPIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM132_ENABLED +#define NRFX_SPIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM133_ENABLED +#define NRFX_SPIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM134_ENABLED +#define NRFX_SPIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM135_ENABLED +#define NRFX_SPIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM136_ENABLED +#define NRFX_SPIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM137_ENABLED +#define NRFX_SPIM137_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_SPIS120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS120_ENABLED +#define NRFX_SPIS120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS130_ENABLED +#define NRFX_SPIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS131_ENABLED +#define NRFX_SPIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS132_ENABLED +#define NRFX_SPIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS133_ENABLED +#define NRFX_SPIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS134_ENABLED +#define NRFX_SPIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS135_ENABLED +#define NRFX_SPIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS136_ENABLED +#define NRFX_SPIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS137_ENABLED +#define NRFX_SPIS137_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_TIMER020_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER020_ENABLED +#define NRFX_TIMER020_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER021_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER021_ENABLED +#define NRFX_TIMER021_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER022_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER022_ENABLED +#define NRFX_TIMER022_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER120_ENABLED +#define NRFX_TIMER120_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER121_ENABLED +#define NRFX_TIMER121_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER130_ENABLED +#define NRFX_TIMER130_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER131_ENABLED +#define NRFX_TIMER131_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER132_ENABLED +#define NRFX_TIMER132_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER133_ENABLED +#define NRFX_TIMER133_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER134_ENABLED +#define NRFX_TIMER134_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER135_ENABLED +#define NRFX_TIMER135_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER136_ENABLED +#define NRFX_TIMER136_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER137_ENABLED +#define NRFX_TIMER137_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_TWIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM130_ENABLED +#define NRFX_TWIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM131_ENABLED +#define NRFX_TWIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM132_ENABLED +#define NRFX_TWIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM133_ENABLED +#define NRFX_TWIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM134_ENABLED +#define NRFX_TWIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM135_ENABLED +#define NRFX_TWIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM136_ENABLED +#define NRFX_TWIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM137_ENABLED +#define NRFX_TWIM137_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_TWIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS130_ENABLED +#define NRFX_TWIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS131_ENABLED +#define NRFX_TWIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS132_ENABLED +#define NRFX_TWIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS133_ENABLED +#define NRFX_TWIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS134_ENABLED +#define NRFX_TWIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS135_ENABLED +#define NRFX_TWIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS136_ENABLED +#define NRFX_TWIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS137_ENABLED +#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE120_ENABLED +#define NRFX_UARTE120_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE130_ENABLED +#define NRFX_UARTE130_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE131_ENABLED +#define NRFX_UARTE131_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE132_ENABLED +#define NRFX_UARTE132_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE133_ENABLED +#define NRFX_UARTE133_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE134_ENABLED +#define NRFX_UARTE134_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE135_ENABLED +#define NRFX_UARTE135_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE136_ENABLED +#define NRFX_UARTE136_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE137_ENABLED +#define NRFX_UARTE137_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_WDT010_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT010_ENABLED +#define NRFX_WDT010_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT011_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT011_ENABLED +#define NRFX_WDT011_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT131_ENABLED +#define NRFX_WDT131_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT132_ENABLED +#define NRFX_WDT132_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_H__ */ diff --git a/soc/arm/nordic_nrf/Kconfig b/soc/arm/nordic_nrf/Kconfig index 0372492cd7d..69d83ae5e9b 100644 --- a/soc/arm/nordic_nrf/Kconfig +++ b/soc/arm/nordic_nrf/Kconfig @@ -18,6 +18,7 @@ source "soc/arm/nordic_nrf/*/Kconfig.soc" config NRF_SOC_SECURE_SUPPORTED def_bool !TRUSTED_EXECUTION_NONSECURE || (BUILD_WITH_TFM && TFM_PARTITION_PLATFORM) + depends on !SOC_SERIES_NRF54HX help Hidden function to indicate that that the soc_secure functions are available. diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index 879217a92fe..ad3c97443ff 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -11,7 +11,7 @@ source "soc/arm/nordic_nrf/*/Kconfig.defconfig.series" if SYS_CLOCK_EXISTS config CLOCK_CONTROL - default y + default y if !SOC_SERIES_NRF54HX endif # SYS_CLOCK_EXISTS diff --git a/soc/arm/nordic_nrf/nrf54h/CMakeLists.txt b/soc/arm/nordic_nrf/nrf54h/CMakeLists.txt new file mode 100644 index 00000000000..8b4df42fa55 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library_sources(soc.c) + +# 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) diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp new file mode 100644 index 00000000000..eb56b8c369e --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -0,0 +1,14 @@ +# Nordic Semiconductor nRF54H20 Application MCU + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54H20_ENGA_CPUAPP + +config SOC + default "nrf54h20_enga_cpuapp" + +config NUM_IRQS + default 471 + +endif # SOC_NRF54H20_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad new file mode 100644 index 00000000000..f63b9437775 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -0,0 +1,14 @@ +# Nordic Semiconductor nRF54H20 Radio MCU + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54H20_ENGA_CPURAD + +config SOC + default "nrf54h20_enga_cpurad" + +config NUM_IRQS + default 471 + +endif # SOC_NRF54H20_ENGA_CPURAD diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.series new file mode 100644 index 00000000000..ddc902d213e --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.series @@ -0,0 +1,16 @@ +# Nordic Semiconductor nRF54H MCU line + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_NRF54HX + +rsource "Kconfig.defconfig.nrf54h*" + +config SOC_SERIES + default "nrf54h" + +config CACHE_NRF_CACHE + default y if EXTERNAL_CACHE + +endif # SOC_SERIES_NRF54HX diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.series b/soc/arm/nordic_nrf/nrf54h/Kconfig.series new file mode 100644 index 00000000000..0b896f477ac --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.series @@ -0,0 +1,16 @@ +# Nordic Semiconductor nRF54H MCU line + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_NRF54HX + bool "Nordic Semiconductor nRF54H series MCU" + select ARM + select ARMV8_M_DSP + select CPU_CORTEX_M33 + select SOC_FAMILY_NRF + select HAS_NRFX + select HAS_NORDIC_DRIVERS + select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE + help + Enable support for nRF54H MCU series diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc new file mode 100644 index 00000000000..9c065e79eaf --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc @@ -0,0 +1,37 @@ +# Nordic Semiconductor nRF54H MCU line + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_NRF54H20 + bool "nRF54H20" + depends on SOC_SERIES_NRF54HX + +if SOC_NRF54H20 + +choice + prompt "nRF54H20 MCU Selection" + +config SOC_NRF54H20_ENGA_CPUAPP + bool "nRF54H20 ENGA CPUAPP" + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_DCACHE + select CPU_HAS_ICACHE + select CPU_HAS_FPU + +config SOC_NRF54H20_ENGA_CPURAD + bool "nRF54H20 ENGA CPURAD" + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_DCACHE + select CPU_HAS_ICACHE + select CPU_HAS_FPU + +endchoice + +config NRF_ENABLE_ICACHE + bool "Instruction cache (I-Cache)" + default y + +endif # SOC_NRF54H20 diff --git a/soc/arm/nordic_nrf/nrf54h/align.ld b/soc/arm/nordic_nrf/nrf54h/align.ld new file mode 100644 index 00000000000..0905aa7f7bc --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/align.ld @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA. + * SPDX-License-Identifier: Apache-2.0 + */ + +SECTION_PROLOGUE(.align16,,) +{ + . = (ALIGN(16) > 0 ? ALIGN(16) : 16) - 1; + BYTE(0); +} GROUP_LINK_IN(ROMABLE_REGION) diff --git a/soc/arm/nordic_nrf/nrf54h/soc.c b/soc/arm/nordic_nrf/nrf54h/soc.c new file mode 100644 index 00000000000..9fefd414152 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/soc.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); + +#if defined(NRF_APPLICATION) +#define HSFLL_NODE DT_NODELABEL(cpuapp_hsfll) +#elif defined(NRF_RADIOCORE) +#define HSFLL_NODE DT_NODELABEL(cpurad_hsfll) +#endif + +#define FICR_ADDR_GET(node_id, name) \ + DT_REG_ADDR(DT_PHANDLE_BY_NAME(node_id, nordic_ficrs, name)) + \ + DT_PHA_BY_NAME(node_id, nordic_ficrs, name, offset) + +static void power_domain_init(void) +{ + /* + * Set: + * - LRCCONF010.POWERON.MAIN: 1 + * - LRCCONF010.POWERON.ACT: 1 + * - LRCCONF010.RETAIN.MAIN: 1 + * - LRCCONF010.RETAIN.ACT: 1 + * + * This is done here at boot so that when the idle routine will hit + * WFI the power domain will be correctly retained. + */ + + nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, true); + nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, true); + + nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, true); + nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, true); + +#if defined(CONFIG_SOC_NRF54H20_ENGA_CPUAPP) + nrf_lrcconf_poweron_force_set(NRF_LRCCONF000, NRF_LRCCONF_POWER_DOMAIN_0, true); +#endif +} + +static int trim_hsfll(void) +{ + NRF_HSFLL_Type *hsfll = (NRF_HSFLL_Type *)DT_REG_ADDR(HSFLL_NODE); + nrf_hsfll_trim_t trim = { + .vsup = sys_read32(FICR_ADDR_GET(HSFLL_NODE, vsup)), + .coarse = sys_read32(FICR_ADDR_GET(HSFLL_NODE, coarse)), + .fine = sys_read32(FICR_ADDR_GET(HSFLL_NODE, fine)) + }; + + LOG_DBG("Trim: HSFLL VSUP: 0x%.8x", trim.vsup); + LOG_DBG("Trim: HSFLL COARSE: 0x%.8x", trim.coarse); + LOG_DBG("Trim: HSFLL FINE: 0x%.8x", trim.fine); + + nrf_hsfll_clkctrl_mult_set(hsfll, + DT_PROP(HSFLL_NODE, clock_frequency) / + DT_PROP(DT_CLOCKS_CTLR(HSFLL_NODE), clock_frequency)); + nrf_hsfll_trim_set(hsfll, &trim); + + nrf_hsfll_task_trigger(hsfll, NRF_HSFLL_TASK_FREQ_CHANGE); +#if defined(CONFIG_SOC_NRF54H20_ENGA_CPUAPP) || defined(CONFIG_SOC_NRF54H20_ENGA_CPURAD) + /* In this HW revision, HSFLL task frequency change needs to be + * triggered additional time to take effect. + */ + nrf_hsfll_task_trigger(hsfll, NRF_HSFLL_TASK_FREQ_CHANGE); +#endif + + LOG_DBG("NRF_HSFLL->TRIM.VSUP = %d", hsfll->TRIM.VSUP); + LOG_DBG("NRF_HSFLL->TRIM.COARSE = %d", hsfll->TRIM.COARSE); + LOG_DBG("NRF_HSFLL->TRIM.FINE = %d", hsfll->TRIM.FINE); + + return 0; +} + +static int nordicsemi_nrf54h_init(void) +{ +#if defined(CONFIG_NRF_ENABLE_ICACHE) + sys_cache_instr_enable(); +#endif + + power_domain_init(); + + trim_hsfll(); + + return 0; +} + +void arch_busy_wait(uint32_t time_us) +{ + nrfx_coredep_delay_us(time_us); +} + +SYS_INIT(nordicsemi_nrf54h_init, PRE_KERNEL_1, 0); diff --git a/soc/arm/nordic_nrf/nrf54h/soc.h b/soc/arm/nordic_nrf/nrf54h/soc.h new file mode 100644 index 00000000000..9a44ab24982 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/soc.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SOC_ARM_NORDIC_NRF_NRF54H_SOC_H_ +#define SOC_ARM_NORDIC_NRF_NRF54H_SOC_H_ + +#include + +#endif /* SOC_ARM_NORDIC_NRF_NRF54H_SOC_H_ */ From 18f843fab8fa0fbbb8b302b40369974a78f731ae Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 30 Jan 2024 14:30:20 +0100 Subject: [PATCH 0323/2300] [nrf fromtree] modules: hal_nordic: Set SOC_SVD_FILE This CMake variable contains a path to a CMSIS-SVD file from nRF MDK, which describes the selected Nordic SoC. Initially, this will be used as an argument to nrf-regtool. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 7740bcf670595cbf83d6c9f59159da7b7b057cb6) (cherry picked from commit bc8908a9e992b6307192c60a22fb3da82b4bacdc) --- modules/hal_nordic/nrfx/CMakeLists.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index f2ddea1a23a..cd8392e118f 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -154,3 +154,25 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_C if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib_lumos.c) endif() + +# Get the SVD file for the current SoC +macro(mdk_svd_ifdef feature_toggle filename) + if(${feature_toggle}) + set(SOC_SVD_FILE ${MDK_DIR}/${filename} CACHE FILEPATH "Path to a CMSIS-SVD file") + endif() +endmacro() + +mdk_svd_ifdef(CONFIG_SOC_SERIES_NRF51X nrf51.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF52805 nrf52805.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF52810 nrf52810.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF52811 nrf52811.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF52820 nrf52820.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF52832 nrf52.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF52833 nrf52833.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF52840 nrf52840.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUAPP nrf5340_application.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUNET nrf5340_network.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP nrf54h20_enga_application.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD nrf54h20_enga_radiocore.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF9120 nrf9120.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF9160 nrf9160.svd) From e9b2875acd83fe9a21811994aaa31bed30019610 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 30 Jan 2024 14:30:20 +0100 Subject: [PATCH 0324/2300] [nrf fromtree] modules: hal_nordic: Integrate nrf-regtool nrf-regtool is a Python utility from Nordic Semiconductor, which is used for generating binary files with register values for given peripherals. It sources the descriptions of peripheral registers from CMSIS-SVD files (typically ones bundled with nRF MDK). For some peripherals, such as UICR, nrf-regtool supports parsing values from devicetree as well, based on the bindings already found in Zephyr. Currently, this tool is not submitted as a script to Zephyr, but it can be installed from PyPI. Having nrf-regtool installed is recommended when working with nRF54H20. Booting the Application or Radiocore CPU requires flashing not only its firmware, but also its respective UICR instance. On this SoC, the UICR is used to assign ownership of global hardware resources, including memory and peripherals, to individual cores. The Zephyr build system can call nrf-regtool to generate the UICR based on devicetree, to reflect the boot-time hardware configuration required for a given application. The generated `uicr.hex` is then merged with `zephyr.hex`, so that they can be flashed together using west. The build system integration takes the form of a CMake package, which includes a version check and reusable components; over time, some of these components can be reused by sysbuild. This package is located in the `hal_nordic` module, because it depends on the `SOC_SVD_FILE` CMake variable, which is defined there as well. Signed-off-by: Grzegorz Swiderski (cherry picked from commit be8b2663c6cd52b6d263de93e9ea1d92d6a5d215) (cherry picked from commit 0ac354d30303149bc6482fdea8b9f562bb9d8f36) --- modules/hal_nordic/CMakeLists.txt | 16 +++++++ modules/hal_nordic/Kconfig | 1 + modules/hal_nordic/Kconfig.nrf_regtool | 36 ++++++++++++++ .../nrf-regtool/nrf-regtoolConfig.cmake | 48 +++++++++++++++++++ .../nrf-regtoolConfigVersion.cmake | 32 +++++++++++++ .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 3 ++ .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 3 ++ 7 files changed, 139 insertions(+) create mode 100644 modules/hal_nordic/Kconfig.nrf_regtool create mode 100644 modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake create mode 100644 modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index 693400aba76..6f5364ac8de 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -6,3 +6,19 @@ if (CONFIG_NRF_802154_RADIO_DRIVER OR CONFIG_NRF_802154_SERIALIZATION) endif (CONFIG_NRF_802154_RADIO_DRIVER OR CONFIG_NRF_802154_SERIALIZATION) add_subdirectory_ifdef(CONFIG_HAS_NRFX nrfx) + +if(CONFIG_NRF_REGTOOL_GENERATE_UICR) + list(APPEND nrf_regtool_components GENERATE:UICR) +endif() +if(DEFINED nrf_regtool_components) + find_package(nrf-regtool 5.0.1 + COMPONENTS ${nrf_regtool_components} + PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool + NO_CMAKE_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_PACKAGE_REGISTRY + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_SYSTEM_PACKAGE_REGISTRY + ) +endif() diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index 6f77bbea427..c9cc93e9329 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -236,3 +236,4 @@ endif # NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION endmenu # HAS_NORDIC_DRIVERS rsource "nrfx/Kconfig" +rsource "Kconfig.nrf_regtool" diff --git a/modules/hal_nordic/Kconfig.nrf_regtool b/modules/hal_nordic/Kconfig.nrf_regtool new file mode 100644 index 00000000000..81659bcf0bb --- /dev/null +++ b/modules/hal_nordic/Kconfig.nrf_regtool @@ -0,0 +1,36 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +menu "nrf-regtool options" + depends on SOC_SERIES_NRF54HX + +config NRF_REGTOOL_GENERATE_UICR + bool "Generate UICR" + help + Generate a UICR hex based on devicetree contents using nrf-regtool. + CPU domains that require UICR allocation aren't bootable without it + being programmed alongside the firmware. + +config NRF_REGTOOL_VERBOSITY + int "Verbosity level of console output" + range 0 3 + default 0 + help + Level of verbose output that nrf-regtool will print to the console. + + 0. Only critical information and warnings. + 1. Print a pretty, human-readable representation of a peripheral's + configuration. This is recommended for inspecting register values. + 2. Print extra details for debugging purposes, such as memory maps of + the peripheral configurations, but in a less readable format. + 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 new file mode 100644 index 00000000000..d057c735e3f --- /dev/null +++ b/modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake @@ -0,0 +1,48 @@ +# 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) + + # 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 ${NRF_REGTOOL} ${verbosity} generate + --peripheral ${peripheral} + --svd-file ${SOC_SVD_FILE} + --dts-file ${ZEPHYR_DTS} + ${bindings_dirs} + --output-file ${generated_hex_file} + ${extra_args} + WORKING_DIRECTORY ${APPLICATION_SOURCE_DIR} + 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() + + +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(operation STREQUAL "GENERATE") + nrf_regtool_generate_hex_from_dts(${peripheral}) + else() + message(FATAL_ERROR "Unrecognized package component: \"${component}\"") + endif() +endforeach() diff --git a/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake b/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake new file mode 100644 index 00000000000..e147d1b0532 --- /dev/null +++ b/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake @@ -0,0 +1,32 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +find_program(NRF_REGTOOL nrf-regtool) + +if(NRF_REGTOOL) + execute_process( + COMMAND ${NRF_REGTOOL} --version + OUTPUT_VARIABLE version + RESULT_VARIABLE result + ) + + if(result EQUAL 0 AND version MATCHES "version ([0-9]+[.][0-9]+[.][0-9]+)") + set(PACKAGE_VERSION ${CMAKE_MATCH_1}) + if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() + + message(STATUS + "Found nrf-regtool (found suitable version \"${PACKAGE_VERSION}\", " + "minimum required is \"${PACKAGE_FIND_VERSION}\")" + ) + return() + endif() + endif() +endif() + +# We only get here if we don't pass the version check. +set(PACKAGE_VERSION_UNSUITABLE TRUE) +set(NRF_REGTOOL NRF_REGTOOL-NOTFOUND CACHE INTERNAL "Path to a program") diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index eb56b8c369e..d90f87c0b89 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -11,4 +11,7 @@ config SOC config NUM_IRQS default 471 +config NRF_REGTOOL_GENERATE_UICR + default y + endif # SOC_NRF54H20_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad index f63b9437775..6aae8c3a105 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -11,4 +11,7 @@ config SOC config NUM_IRQS default 471 +config NRF_REGTOOL_GENERATE_UICR + default y + endif # SOC_NRF54H20_ENGA_CPURAD From 025cef148ce7682a9906f19626fc29dfe4642ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 31 Jan 2024 15:20:20 +0100 Subject: [PATCH 0325/2300] [nrf fromtree] drivers: serial: Kconfig.nrfx: Filter out options unsupported on nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On nRF54H20, only the new shim can be used and the enhanced poll out cannot be enabled since there is no DPPI support for this SoC yet. Signed-off-by: Andrzej Głąbek (cherry picked from commit 784688a511fdfb493289b41e8253163e41fb29b6) (cherry picked from commit f5cec5f5dd7d2b77fc5934edb5a683a8815308c6) --- drivers/serial/Kconfig.nrfx | 3 +-- drivers/serial/Kconfig.nrfx_uart_instance | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 8995b6b9fbf..4ea38e7b996 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -31,8 +31,7 @@ config UART_NRFX_UARTE config UART_NRFX_UARTE_LEGACY_SHIM bool "Legacy UARTE shim" depends on UART_NRFX_UARTE - # NRF54L15 need new UARTE driver - depends on !SOC_SERIES_NRF54LX + depends on !SOC_SERIES_NRF54LX && !SOC_SERIES_NRF54HX # New shim takes more ROM. Until it is fixed use legacy shim. default y diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index 718631a4d09..9e992ca9737 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -23,6 +23,7 @@ config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT depends on !SOC_SERIES_NRF54LX 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 help From a902aa39e7ee0ec5b73556436a331232c59b21ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 19 Jan 2024 11:51:41 +0100 Subject: [PATCH 0326/2300] [nrf fromtree] drivers: serial: nrfx: Allow new UARTE instances to be used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend Kconfig definitions and nrfx_config translations so that UARTE instances that are available in nRF54H20 can be used. Signed-off-by: Andrzej Głąbek (cherry picked from commit 976de4edbe57b000e5a6fb8239733fe51b45ae60) (cherry picked from commit 3a07b53476431a1cc3ddfaa9e7666512535c0db2) --- drivers/serial/Kconfig.nrfx | 45 ++++++++++++++++++++ modules/hal_nordic/nrfx/Kconfig | 45 ++++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 27 ++++++++++++ soc/arm/nordic_nrf/Kconfig.peripherals | 27 ++++++++++++ soc/arm/nordic_nrf/validate_base_addresses.c | 9 ++++ 5 files changed, 153 insertions(+) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 4ea38e7b996..158731404e6 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -90,6 +90,51 @@ nrfx_uart_num = 30 rsource "Kconfig.nrfx_uart_instance" endif +if HAS_HW_NRF_UARTE120 +nrfx_uart_num = 120 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE130 +nrfx_uart_num = 130 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE131 +nrfx_uart_num = 131 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE132 +nrfx_uart_num = 132 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE133 +nrfx_uart_num = 133 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE134 +nrfx_uart_num = 134 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE135 +nrfx_uart_num = 135 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE136 +nrfx_uart_num = 136 +rsource "Kconfig.nrfx_uart_instance" +endif + +if HAS_HW_NRF_UARTE137 +nrfx_uart_num = 137 +rsource "Kconfig.nrfx_uart_instance" +endif + config NRFX_TIMER0 default y depends on UART_0_NRF_HW_ASYNC_TIMER = 0 \ diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index d4efbb7cac8..ee1bd76b52f 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -637,6 +637,51 @@ config NRFX_UARTE30 depends on $(dt_nodelabel_has_compat,uart30,$(DT_COMPAT_NORDIC_NRF_UARTE)) select NRFX_UARTE +config NRFX_UARTE120 + bool "UARTE120 driver instance" + depends on $(dt_nodelabel_has_compat,uart120,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE130 + bool "UARTE130 driver instance" + depends on $(dt_nodelabel_has_compat,uart130,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE131 + bool "UARTE131 driver instance" + depends on $(dt_nodelabel_has_compat,uart131,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE132 + bool "UARTE132 driver instance" + depends on $(dt_nodelabel_has_compat,uart132,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE133 + bool "UARTE133 driver instance" + depends on $(dt_nodelabel_has_compat,uart133,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE134 + bool "UARTE134 driver instance" + depends on $(dt_nodelabel_has_compat,uart134,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE135 + bool "UARTE135 driver instance" + depends on $(dt_nodelabel_has_compat,uart135,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE136 + bool "UARTE136 driver instance" + depends on $(dt_nodelabel_has_compat,uart136,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + +config NRFX_UARTE137 + bool "UARTE137 driver instance" + depends on $(dt_nodelabel_has_compat,uart137,$(DT_COMPAT_NORDIC_NRF_UARTE)) + select NRFX_UARTE + config NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG bool "UARTE GPIO configuration support" depends on NRFX_UARTE diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 215eff5bfcd..be2f5599f78 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -606,6 +606,33 @@ #ifdef CONFIG_NRFX_UARTE30 #define NRFX_UARTE30_ENABLED 1 #endif +#ifdef CONFIG_NRFX_UARTE120 +#define NRFX_UARTE120_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE130 +#define NRFX_UARTE130_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE131 +#define NRFX_UARTE131_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE132 +#define NRFX_UARTE132_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE133 +#define NRFX_UARTE133_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE134 +#define NRFX_UARTE134_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE135 +#define NRFX_UARTE135_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE136 +#define NRFX_UARTE136_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_UARTE137 +#define NRFX_UARTE137_ENABLED 1 +#endif #ifdef CONFIG_NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG #define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 1 #endif diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index 5eeff856c96..da1c5f473c7 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -438,6 +438,33 @@ config HAS_HW_NRF_UARTE22 config HAS_HW_NRF_UARTE30 def_bool $(dt_nodelabel_enabled_with_compat,uart30,$(DT_COMPAT_NORDIC_NRF_UARTE)) +config HAS_HW_NRF_UARTE120 + def_bool $(dt_nodelabel_enabled_with_compat,uart120,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE130 + def_bool $(dt_nodelabel_enabled_with_compat,uart130,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE131 + def_bool $(dt_nodelabel_enabled_with_compat,uart131,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE132 + def_bool $(dt_nodelabel_enabled_with_compat,uart132,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE133 + def_bool $(dt_nodelabel_enabled_with_compat,uart133,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE134 + def_bool $(dt_nodelabel_enabled_with_compat,uart134,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE135 + def_bool $(dt_nodelabel_enabled_with_compat,uart135,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE136 + def_bool $(dt_nodelabel_enabled_with_compat,uart136,$(DT_COMPAT_NORDIC_NRF_UARTE)) + +config HAS_HW_NRF_UARTE137 + def_bool $(dt_nodelabel_enabled_with_compat,uart137,$(DT_COMPAT_NORDIC_NRF_UARTE)) + config HAS_HW_NRF_USBD def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_USBD)) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 9daa820efa9..28ec231b132 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -214,6 +214,15 @@ CHECK_DT_REG(uart20, NRF_UARTE20); CHECK_DT_REG(uart21, NRF_UARTE21); CHECK_DT_REG(uart22, NRF_UARTE22); CHECK_DT_REG(uart30, NRF_UARTE30); +CHECK_DT_REG(uart120, NRF_UARTE120); +CHECK_DT_REG(uart130, NRF_UARTE130); +CHECK_DT_REG(uart131, NRF_UARTE131); +CHECK_DT_REG(uart132, NRF_UARTE132); +CHECK_DT_REG(uart133, NRF_UARTE133); +CHECK_DT_REG(uart134, NRF_UARTE134); +CHECK_DT_REG(uart135, NRF_UARTE135); +CHECK_DT_REG(uart136, NRF_UARTE136); +CHECK_DT_REG(uart137, NRF_UARTE137); CHECK_DT_REG(uicr, NRF_UICR); CHECK_DT_REG(usbd, NRF_USBD); CHECK_DT_REG(usbreg, NRF_USBREGULATOR); From 2fccbac518783d064515bd0c0f8334595e18b42c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 31 Jan 2024 15:30:27 +0100 Subject: [PATCH 0327/2300] [nrf fromtree] drivers: timer: nrf_grtc_timer: Add dependency on nRF clock control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... in the related parts, so that the driver can be used on nRF54H20 where the clock control is not present yet. Signed-off-by: Andrzej Głąbek (cherry picked from commit bb065262bc8ea42ab56eda1d4e142b2e9c0ec617) (cherry picked from commit fceaaea0d7c613ecccb94c2b8011da09d7a98e23) --- drivers/timer/nrf_grtc_timer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index a706c04bae0..8ac357864cc 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -7,7 +7,9 @@ #include #include #include +#if defined(CONFIG_CLOCK_CONTROL_NRF) #include +#endif #include #include #include @@ -521,6 +523,7 @@ static int sys_clock_driver_init(void) system_timeout_set(CYC_PER_TICK); } +#if defined(CONFIG_CLOCK_CONTROL_NRF) static const enum nrf_lfclk_start_mode mode = IS_ENABLED(CONFIG_SYSTEM_CLOCK_NO_WAIT) ? CLOCK_CONTROL_NRF_LF_START_NOWAIT @@ -529,6 +532,7 @@ static int sys_clock_driver_init(void) : CLOCK_CONTROL_NRF_LF_START_STABLE); z_nrf_clock_control_lf_on(mode); +#endif return 0; } From 0364029a589ca098d56b772a46ad40cef58b35e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 31 Jan 2024 13:05:36 +0100 Subject: [PATCH 0328/2300] [nrf fromtree] tests: arm_irq_vector_table: Add special handling for nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Different set of IRQ lines need to be used for this SoC and the CLOCK IRQ is not to be installed in the vector table. Signed-off-by: Andrzej Głąbek (cherry picked from commit c50c4130a012ea7ceca2b4400173fe4db68f0f42) (cherry picked from commit a254d89aa6d97b3c55d8d8974ec41b1ee73aa0bf) --- .../arm/arm_irq_vector_table/src/arm_irq_vector_table.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c index f18c30dac9a..61679107103 100644 --- a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c +++ b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c @@ -27,6 +27,9 @@ #elif defined(CONFIG_SOC_SERIES_NRF54LX) /* For nRF54L Series, use SWI00-02 interrupt lines. */ #define _ISR_OFFSET SWI00_IRQn +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +/* For nRF54H Series, use BELLBOARD_0-2 interrupt lines. */ +#define _ISR_OFFSET BELLBOARD_0_IRQn #else /* For other nRF targets, use TIMER0-2 interrupt lines. */ #define _ISR_OFFSET TIMER0_IRQn @@ -141,6 +144,8 @@ typedef void (*vth)(void); /* Vector Table Handler */ void nrfx_power_clock_irq_handler(void); #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) #define POWER_CLOCK_IRQ_NUM POWER_CLOCK_IRQn +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#define POWER_CLOCK_IRQ_NUM -1 /* not needed */ #else #define POWER_CLOCK_IRQ_NUM CLOCK_POWER_IRQn #endif @@ -149,7 +154,7 @@ void nrfx_power_clock_irq_handler(void); void timer0_nrf_isr(void); #define TIMER_IRQ_HANDLER timer0_nrf_isr #define TIMER_IRQ_NUM TIMER0_IRQn -#elif defined(CONFIG_SOC_SERIES_NRF54LX) +#elif defined(CONFIG_SOC_SERIES_NRF54LX) || defined(CONFIG_SOC_SERIES_NRF54HX) void nrfx_grtc_irq_handler(void); #define TIMER_IRQ_HANDLER nrfx_grtc_irq_handler #define TIMER_IRQ_NUM GRTC_0_IRQn @@ -162,7 +167,9 @@ void rtc_nrf_isr(void); #define IRQ_VECTOR_TABLE_SIZE (MAX(POWER_CLOCK_IRQ_NUM, MAX(TIMER_IRQ_NUM, _ISR_OFFSET + 2)) + 1) vth __irq_vector_table _irq_vector_table[IRQ_VECTOR_TABLE_SIZE] = { +#if (POWER_CLOCK_IRQ_NUM != -1) [POWER_CLOCK_IRQ_NUM] = nrfx_power_clock_irq_handler, +#endif [TIMER_IRQ_NUM] = TIMER_IRQ_HANDLER, [_ISR_OFFSET] = isr0, isr1, isr2, }; From 6b7d48c1d361406f740a5c3b70b8d289ef6fd488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 1 Feb 2024 09:10:52 +0100 Subject: [PATCH 0329/2300] [nrf fromtree] dts: nordic: Include input-event-codes.h from nrf_common.dtsi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... so that there is no need to include that header individually for every added board based on an nRF SoC. Signed-off-by: Andrzej Głąbek (cherry picked from commit 1606f65972bea823bea8bbad181d8610c064bc71) (cherry picked from commit 7dc7df419c99d2da221a548248bc093fcf126654) --- dts/common/nordic/nrf_common.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/dts/common/nordic/nrf_common.dtsi b/dts/common/nordic/nrf_common.dtsi index f09557b23de..cb2df6bcccd 100644 --- a/dts/common/nordic/nrf_common.dtsi +++ b/dts/common/nordic/nrf_common.dtsi @@ -8,6 +8,7 @@ #include #include #include +#include #include #include From 81faa51ddcf11ff19448eff9a41f596c9f681388 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 29 Jan 2024 16:13:27 +0100 Subject: [PATCH 0330/2300] [nrf fromtree] scripts: west: runners: nrfjprog: add option to not erase On some new SoCs, the erase option is not required, so introduce a new option that doesn't set any erase mode. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit b2c8f7680d1ad3cdb308c0a45c2c30f61d2c87e3) (cherry picked from commit b28169ebb247c6f9eaaff44d993d8527d1fb9f73) --- scripts/west_commands/runners/nrfjprog.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index a28681ae6a5..15f147a4d87 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -69,6 +69,8 @@ def do_exec_op(self, op, force=False): cmd.append('--sectorerase') elif erase == 'ERASE_PAGES_INCLUDING_UICR': cmd.append('--sectoranduicrerase') + elif erase == 'NO_ERASE': + pass else: raise RuntimeError(f'Invalid erase mode: {erase}') From 16bcdf444079df595651e9bcc37ffe02abea6a36 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 29 Jan 2024 16:15:03 +0100 Subject: [PATCH 0331/2300] [nrf fromtree] scripts: west: runners: nrfjprog: add erasepage op Add a new operation that allows erasing pages. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit a99b5ca01b2e3d641e61c8a7f0b98e44e5cd42b5) (cherry picked from commit 54fa6aee2c806a6578b667e3959a37b9324f64a9) --- scripts/west_commands/runners/nrfjprog.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index 15f147a4d87..c1eebd32914 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -87,6 +87,9 @@ def do_exec_op(self, op, force=False): cmd.append('--reset') if _op['option'] == 'RESET_PIN': cmd.append('--pinreset') + elif op_type == 'erasepage': + cmd.append('--erasepage') + cmd.append(f"0x{_op['page']:08x}") else: raise RuntimeError(f'Invalid operation: {op_type}') From 7d9a021c8e97912863848f1b6143c2a637c4f2c7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 29 Jan 2024 16:19:30 +0100 Subject: [PATCH 0332/2300] [nrf fromtree] scripts: west: runners: nrfjprog: add basic support for nRF54H series Add basic support to flash application and/or radio core for nRF54H series. Note that features like merged hexes present in nRF53 series is not supported. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 6b987d31922d870b91b3530153243e2b4787be44) (cherry picked from commit 308ac2fe5dcdc58c1cecfd37367cce6ec853090e) --- scripts/west_commands/runners/nrf_common.py | 63 +++++++++++++++------ scripts/west_commands/runners/nrfjprog.py | 6 +- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 93871d831ee..76662c72ea9 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -24,11 +24,26 @@ ErrNotAvailableBecauseProtection = 24 ErrVerify = 25 +UICR_RANGES = { + 'NRF53_FAMILY': { + '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), + } +} + class NrfBinaryRunner(ZephyrBinaryRunner): '''Runner front-end base class for nrf tools.''' 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, + erase_all_uicrs=False): super().__init__(cfg) self.hex_ = cfg.hex_file if family and not family.endswith('_FAMILY'): @@ -40,6 +55,7 @@ def __init__(self, cfg, family, softreset, dev_id, erase=False, self.reset = bool(reset) self.force = force self.recover = bool(recover) + self.erase_all_uicrs = bool(erase_all_uicrs) self.tool_opt = [] for opts in [shlex.split(opt) for opt in tool_opt]: @@ -59,7 +75,8 @@ def dev_id_help(cls) -> str: @classmethod def do_add_parser(cls, parser): parser.add_argument('--nrf-family', - choices=['NRF51', 'NRF52', 'NRF53', 'NRF54L', 'NRF91'], + choices=['NRF51', 'NRF52', 'NRF53', 'NRF54L', + 'NRF54H', 'NRF91'], help='''MCU family; still accepted for compatibility only''') parser.add_argument('--softreset', required=False, @@ -75,6 +92,11 @@ def do_add_parser(cls, parser): help='''erase all user available non-volatile memory and disable read back protection before flashing (erases flash for both cores on nRF53)''') + parser.add_argument('--erase-all-uicrs', required=False, + action='store_true', + help='''Erase all UICR registers before flashing + (nRF54H only). When not set, only UICR registers + present in the hex file will be erased.''') parser.set_defaults(reset=True) @@ -163,6 +185,8 @@ def ensure_family(self): self.family = 'NRF53_FAMILY' elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF54LX'): self.family = 'NRF54L_FAMILY' + elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF54HX'): + self.family = 'NRF54H_FAMILY' elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF91X'): self.family = 'NRF91_FAMILY' else: @@ -174,21 +198,15 @@ def hex_refers_region(self, region_start, region_end): return True return False - def hex_has_uicr_content(self): - # A map from SoCs which need this check to their UICR address - # ranges. If self.family isn't in here, do nothing. - uicr_ranges = { - 'NRF53_FAMILY': ((0x00FF8000, 0x00FF8800), - (0x01FF8000, 0x01FF8800)), - 'NRF91_FAMILY': ((0x00FF8000, 0x00FF8800),), - } + def hex_get_uicrs(self): + hex_uicrs = {} - if self.family not in uicr_ranges: - return + if self.family in UICR_RANGES: + for uicr_core, uicr_range in UICR_RANGES[self.family].items(): + if self.hex_refers_region(*uicr_range): + hex_uicrs[uicr_core] = uicr_range - for region_start, region_end in uicr_ranges[self.family]: - if self.hex_refers_region(region_start, region_end): - return True + return hex_uicrs def flush(self, force=False): try: @@ -213,7 +231,7 @@ def flush(self, force=False): # 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 # a warning here will hopefully enhance UX. - if self.hex_has_uicr_content(): + 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 ' @@ -266,11 +284,24 @@ def program_hex(self): if self.family == 'NRF53_FAMILY': # nRF53 requires special treatment due to the extra coprocessor. self.program_hex_nrf53(erase_arg, qspi_erase_opt) + elif self.family == 'NRF54H_FAMILY': + self.program_hex_nrf54h() else: self.op_program(self.hex_, erase_arg, qspi_erase_opt, defer=True) self.flush(force=False) + def program_hex_nrf54h(self): + if self.erase_all_uicrs: + uicrs = UICR_RANGES['NRF54H_FAMILY'] + else: + uicrs = self.hex_get_uicrs() + + for uicr_core, range in uicrs.items(): + self.exec_op('erasepage', defer=True, core=uicr_core, page=range[0]) + + self.op_program(self.hex_, 'NO_ERASE', None, defer=True) + def program_hex_nrf53(self, erase_arg, qspi_erase_opt): # program_hex() helper for nRF53. diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index c1eebd32914..723080d56c3 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -32,7 +32,8 @@ 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, + erase_all_uicrs=args.erase_all_uicrs) def do_get_boards(self): snrs = self.check_output(['nrfjprog', '--ids']) @@ -46,7 +47,8 @@ def do_exec_op(self, op, force=False): # Translate the op families = {'NRF51_FAMILY': 'NRF51', 'NRF52_FAMILY': 'NRF52', - 'NRF53_FAMILY': 'NRF53', 'NRF54L_FAMILY': 'NRF54L', 'NRF91_FAMILY': 'NRF91'} + 'NRF53_FAMILY': 'NRF53', 'NRF54L_FAMILY': 'NRF54L', + 'NRF54H_FAMILY': 'NRF54H', 'NRF91_FAMILY': 'NRF91'} cores = {'NRFDL_DEVICE_CORE_APPLICATION': 'CP_APPLICATION', 'NRFDL_DEVICE_CORE_NETWORK': 'CP_NETWORK'} From 5ebe3f7244f6e5c6fe3c00d3c40aa946f63e8c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 23 Jan 2024 17:54:45 +0100 Subject: [PATCH 0333/2300] [nrf fromtree] boards: arm: Add initial support for nRF54H20 PDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add targets that allows building for the Application and Radio cores in the nRF54H20 SoC on the nRF54H20 PDK board. Signed-off-by: Grzegorz Swiderski Signed-off-by: Gerard Marull-Paretas Signed-off-by: Andrzej Głąbek (cherry picked from commit 38520a93d3f0e11ee54e9ae326d8139bd17e8ac0) (cherry picked from commit 05bf13a4d2d3b9d742f552b9a40d7461bd8b0805) --- boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board | 10 ++ .../nrf54h20pdk_nrf54h20/Kconfig.defconfig | 14 ++ boards/arm/nrf54h20pdk_nrf54h20/board.cmake | 3 + .../doc/img/nrf54h20pdk_nrf54h20.webp | Bin 0 -> 27232 bytes boards/arm/nrf54h20pdk_nrf54h20/doc/index.rst | 148 ++++++++++++++++++ .../nrf54h20pdk_nrf54h20-memory_map.dtsi | 79 ++++++++++ .../nrf54h20pdk_nrf54h20-pinctrl.dtsi | 53 +++++++ .../nrf54h20pdk_nrf54h20_cpuapp.dts | 137 ++++++++++++++++ .../nrf54h20pdk_nrf54h20_cpuapp.yaml | 15 ++ .../nrf54h20pdk_nrf54h20_cpuapp_defconfig | 33 ++++ .../nrf54h20pdk_nrf54h20_cpurad.dts | 58 +++++++ .../nrf54h20pdk_nrf54h20_cpurad.yaml | 15 ++ .../nrf54h20pdk_nrf54h20_cpurad_defconfig | 30 ++++ 13 files changed, 595 insertions(+) create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/board.cmake create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/doc/index.rst create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig diff --git a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board new file mode 100644 index 00000000000..b76cfce6800 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF54H20PDK_NRF54H20_CPUAPP + bool "nRF54H20 PDK nRF54H20 Application MCU" + depends on SOC_NRF54H20_ENGA_CPUAPP + +config BOARD_NRF54H20PDK_NRF54H20_CPURAD + bool "nRF54H20 PDK nRF54H20 Radio MCU" + depends on SOC_NRF54H20_ENGA_CPURAD diff --git a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig new file mode 100644 index 00000000000..954276ec829 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD + default "nrf54h20pdk_nrf54h20_cpuapp" if BOARD_NRF54H20PDK_NRF54H20_CPUAPP + default "nrf54h20pdk_nrf54h20_cpurad" if BOARD_NRF54H20PDK_NRF54H20_CPURAD + +if BOARD_NRF54H20PDK_NRF54H20_CPUAPP || BOARD_NRF54H20PDK_NRF54H20_CPURAD + +# Data cache is disabled due to a HW issue in the EngA SoC revision. +config DCACHE + default n + +endif # BOARD_NRF54H20PDK_NRF54H20_CPUAPP || BOARD_NRF54H20PDK_NRF54H20_CPURAD diff --git a/boards/arm/nrf54h20pdk_nrf54h20/board.cmake b/boards/arm/nrf54h20pdk_nrf54h20/board.cmake new file mode 100644 index 00000000000..4c63f1dd05e --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/board.cmake @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: Apache-2.0 + +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp b/boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp new file mode 100644 index 0000000000000000000000000000000000000000..bcda6b0732b3acefe24e83332692e8ae898d47b4 GIT binary patch literal 27232 zcmV(sK<&R$Nk&FkY5)LNMM6+kP&il$000000001Q0stKW09H^qAmnKP05D|%odGIv z0v-WAkv^G7C8MIFs<#_f`^Tyu{XVb1!~f~^1^a#KxBm0?$KBueKTr?yzxRD)|MGwT|LO39{#*Y? z|NsC01K+xSonO6Q4IkwH^m@#H=j+tz7wmud-%B0?{y+QA?r)yHJUxT_SMGoKKW`kl z_1&qL&c6bG5BukzfAhb|en2ZGY47uKWM|&)k22Kj|Op|7*S3zsvvi{~yuM z*Z#sCHT^9R#aYszQ6T%hXv25?9kP{cS8-sRRn~HZN_VFXGV_7VrZsBY0)EkU@d%ZP zDO{TD=THao;x*IxY4#c%C(_1A-lkL*4UEJII+fEPN{Tm_c_=izGlI;`lSSSfQ&t9l zr!I}oC4w&O?eX&8`wfx=cGKmU^0F!HK1YUGbmK>s5-#N>dX$p2G$E`oDFWY!)i+## zd~+uIv%gtK<6x(}ETEzWU-?>~k@tVdC6*nRFigE{`(T}MwKtOqR%7*Jtn+!K>=}cb zbyvmBmyR(sqMS!NVOh7e3k|ou*deS&v`)jorS3@ymUpRq1A$;uo)9%LD^< zh=}Us5mBoS+gPPc*@)d!vMnORyv7#TFtjumnwldw|J8g^k}rN8I9I*5DbpyQ`|mW( zD+G^|`+*4Ja?x^ts{$+3v)S2UM7^`AiNaS;hd9;seAUMqr+9D-8iCaJ_ij5YqzeYm zI=hf_SF}=<&P~E_P4XzSt$8bfx~@R`qEzV$K)U)jmsdPI=-Kbr&3$RqA{CHeX%vWE}L zq}8~4%$5>tvzCXYthxOrQlB!E9>%Pmj!kqXJhftBHWw@-rTspQU5+AM(!&Gu^m?H8R+r9W|7OPb$( zYDC_gB~1y#f%h}(abst_&Om9KRYgE%lnRKl(gCV(4Cj+GXI6+P>vOLZSr~r-@iJ*Z{Y+qy3{$w(C-Ucc4h zv9!P&vpEx0kT__~G=X4!;tK#)8*>t-N>>N`?NPs_X%-or-`*+KI4Y3$!)&tPBEAx4 zYatLe>3vUy6~2>cH6@kvW&ZSF$7@@ev{kO-PLQl?{=crSVuUvGUW^Th(=(JgBjeZ0 z;)88URvX0eAKkhTubh_R^qf$wc_SZF*vuky=$h&e)nkc+_IS0l7^SZGP1IpCWnjyB zpawTHE%E)vx@Q+{4nc;Kwm|5M8gK0az z71Ld7vyjEYF=th7=^J$&EJ~Ed1a%(NV#SMvy}v3i79?kpY76T{5W3iL)1Jq2c%`v( zwk`3GjAO|q{2?cl+T{OnW?fT>qO6++?{`kSH!jMqAXzvyBaLUQjxE#F8&xIy^Y)D# zC@H_5Z{&b#;#I~3fJGDAvH1)$@!vy}4A~h3`!;s&=@h0_pMF84pZ@O*J@Tz)N%6N! zROKOkZ8eLWk*l!(13)c>wWQ!|(NS9G-1q23b0tK3-a)c<2;XUB=Pe$ZeR*7QkqH^7 z*VrmOSjt3)60pVtn9Tui({4DuO&TOo$XthUv*tuzA=r|m=BOPPcRbvBR;h%~n@%OU zLIMVSbvOIQK@!2KqR>g9`Ddud83VY3NS;%GqCwTJs-_9=5dwV&0Y6teSdh;9vyyGi z0=We0p!o*?js{=;5aV2%J`T^dIlsLu@a|?-@nam-0ES{-*s|Jr{zhoat=OeHF}7%34UQ6FI8SaIA1OAW~jJ9Pc;uW32%OwwPOVSw9Cr^O%soLQel;5n--6nirp9 z_|-k_VQmU7)DR*DJG8X>JjF$(d)vp%HKfV%*q2&9gpxUXjVMeL?e}W#C+igTu|z&j z7mPj*8p6t40Pxb!^~=p``t}Q_585gJeE}`m*@f!{-w3WIbjC`9Gvuf(BmUN+U=`;THq{Xavb@z$ zyZ^aK1}HInId#{m!&1i3&B*+IeEIeE%h;vMdJ0JsNLcEIhu?uKomXy6*VR8giG2jT zu|f+Z*=f7AN#%9b!j&RzE94h;U#LzF^S%Cpz@^t;iScjLPA1wvGq!1RmBO0wQ;|BS zWx%qB8MI5O$#Y@Kw(&7T-YkCP>Yq@Nr}C9YC(0>|Z6O%Osa-y&Raic5Qt*Ni64Ru1 zwMJC=YisyI%9*fZ#2*3(i;<#9ib1D!3|Bu19y7YXimF65wrKsuLK$yqh+5UI-UVnk zH0+}t>U!R}UJ__UE@xzz7%gov`WDi3hmbnH_zsp$vo~gn#rG$5gWzgwWAuRTdKKw{ zMduHokK=vhZ2B|Kh^d?ijGOxst1#hv4&(oNzqCQY?r^N;I0Z6I6cJH!4yjMgb{F1z z%C7w(JwiMdJ=B2MnvEVE2||zzWM)m*t!vfJjOj6-G_^;j!{YmaPy_1|+(zBs z*i81H?~5W*Qkb90GH7oS|Kc&nasWqVdoSK-3}i;#s#5br%W=WRF2T{rOHB05zB0=+ z0V_yxt$G99+O3$HHl=+rq{cRojAO`4%X{MN23V!fR}9LzUnAn73ne> zPgOXA{**J8^y7&^SWH?|S@Jgtm91Ui%qHsvUMu6^GC{b7&peXC#aGSe0pJeC6A3T? z{`8#BZ5?p7{dSb@IVt~BaRa`7lxF99Dm8<73C;^CAnL|g-t?8qX%ORlH<@gsgebT@ zN<`mk-QVA{cC0S!-FWh%SJ)p#@m-2vv-1nVce?2Ns)WFdzt_*3!gojBHQk<*mylRW zYr}$X4s=OUV9txH^r>|74HP7eR9dt4f#ftC+yCP83)Zzx+nCdRxazNs1R=rv_K*9# zAQe4r(=SCI$O%4e3te9%Y51uh8I~Q;X&-No^U0Jy_W}Q}UDhN9dEotk6Vo*}_CI0| zX36tA-3SzaxiFf}xBX9L<&@;-?qwL*?mWKlKp!W5_W#lg&QS!i-`Tt$FbX#dH z;`^{4jTMsXRE)fiz`|xHcDLrMv!b@f&^dyxhw*8e#?O_AZZwHozPbR*lB6pp5x;el z8AXZd<;6O1{1kR))iMwn62g&*x8>8L6dfvKs)F0k(2!F)^fMV5Sq<)0lfhK88)-P2 z!?Q_Uqh|)v1;47?OkIDg@ zaSj4MQaO%ZKAq{RQF{iI3j*xNEtvbd@Wx5^`!sE-b&rT zsQz`zy4f1s;zaIaWk#MKcvLFk{w>bmdN9a6m1i@%PUp3>l-WG05DD#8QL3>;=3YQ! zen{XB`5-d}G52gZ`DaspS#{{5#am0f-SFQ5M-|F!Nqyt^|2;?tlyAV#IZ*-AI4gyn zIyIHu#E3WS-eMIT2#Ij~@KsX|Wm5cFlh8~;vN1f4&-lfzOzrvtV1SfD6}S!~gnwnG zPURmT{w*F~N>ehBA8Wi+p5cw*!=m#i&ab4WHJIYk+%wlmyaL;TIoPH;u{5LjiN~&} zkes=zmF~|9&kN`)jMNkVF;pXd%RKdXlMe`k+KGJLE%X)OcZ)qtzOf&-pn*EjiJnU( z0dsC4`Xh^FnPnkyK$TGk!mg?f0AEPXHIk}ok=`MYW&3ik-VH~GB_?`*adTL00z-0u z`D(CtB0^<3$afjF;UD)3@crO2tnbx855onX!q13kp5|6vCD zcDzPoPEmcfin7a1WJ}l$ACGUg7qe&&GG;zi%OTD85h_7Z+meLOerw&cA*=9?odO(E zL()JqK~(Z{J50(|rqdr;r9Rp8BM8Cm)dM0Cs7MMN(E|g0YJKPOem~P zD-nQ4nfM2hE99CazCnnN51GO%itIW6$g)7vd_l%uPFNNw*BL)Py5$K%dCe(n%DGWl za27H9|B@tCeQZr%FL#tTCD)Gl20tS=7);1Kk=wggPNb}f zk*`&NF;Sd5ih3l#l=<^zI64rO$bqe_HAErlLcU5s)JORWPv0mCrVRp%;r3$twB^3B zdux$6{KHOkH(=u^O|-%t&m46{O50M_(&*dec+h$=VaUl(blK*L47HSVN>{MZJ-O0Z?!UZ2VNK5)kjilN+q28AX z9kVtbgu)9}(iT(Rvgj8vZ@?U~_gCb)!0mQn$xu2QF_-US?aEG~MB^IJK$67L;LiyR zQ22quWB~v`7Kx%aV6M{TvBaI}0d}#`e}e^K-d859f0+k7HJ(YYfdz-g_$Gm|8u~M< z?W$>?4q&)yh4B4cnIggu(O$=XgEhXJ1)*urcplQLiv^?yzc+;_8w;O&)lS_J+Ib^J zY~PWbh2}h*<%Ew?Kg1-mp<>pOlK~q~?E!yQ^AYfxYVTFw8CHyG zfX^kR9u>}l`LYfwF!rS;h#Yx1uraqn{u}+-+&Gf|ov$Fx=FcUey#YD%IVu0n!Xz0gwsT5acjwL0klt@REZ-Q?jgYYDVtzNe^y}Z$bvy?SnZ2xiJ)7;P z>`v(zw?j!<8)4Dq>%9jSX6dbV7jT^oUIQu0Q?Qsv)j3H)n~RYbDAP*#nQbGOvOriw zI@pP)EN*xT?}$VwYtgpW?q%v>nv)ui2!>N1wtRN$ftd&ccxzV_7A0g-ba4QV@nZdc z*}c2S;{1)ZdSOaPyPFOE7{8Z)jzTf=;L8IIRfxeA)^yH&1CJ?z9EC%81a6u?z2sT2 zyEYiM48bul<7V-?W(RjVX))jSPcDt@rNI&K2pQYtM5YE;O;Mp9N{QwA ztZI_~nuQ!*v_{30cGph$-=^9^+xB~|Ea9EqmpQ8$v)~T^x_RQw*@Qg>wpf4Scgy5Qm-iJo$#K7 zI?SQ9IhY{Zi^@I`w5dbATKNd@ZTz+9MdB_*kmy6N&yEhd{HS(yr9L)MJF}$P^V zxNmr&l`9X{spN=;|K&h7>|%KVcfLJ|TOIV9U&!hOU036Gm*AoNZ|>Xgc$65Oedseq z3!4KcigwSe_Oi^tZ{@sTQ|3*x5iUTpnUwC$JbpUVhldI*hoer zj_*FnL;EMUO}NkH0CFGw3R=b3FkOTWMYWdLl?dozvU`K{_~ie+IJcRlpjUnWuRwU5 z{4SRbS5uyc9bGps=Py1Mzo#2aPHl1lAw2uA=lEpukj~H(89kPPZrlIXTB(Ko;I-%{18 zPOpR-j8sxZ$V5gG*y221Wt19=6_X>HS5@wj11nX9HH8{dfTVDxu0D6t$S;j@^jvCW z!olT+(Zvn-?*8sRIJixwOMm%>+96cQ$r&7p2HN3sEpiIa)n1p_LQUN#@x)N5ng3-> zHSWNB?9c&8*GpMZrs#J7olsbbGN)>(`ZT7kY;LKuJJ5jp5rIY|%f#-~=NWQYm)~li zqg;bftvGJ@Vr?Ybr`ymNO#J2xUE4dS^s`D`nyEqdV=D`et7hMS%INSqQFv{Q0{ zM+bU3YxhPx!|Tn~pW`!Fs&*qV7aqo~+(b%Pt zJr~{_6hzg)aU;sF`i^$O zKe5zwh*!h$jo%8YO=HA6Y0qMChzNf;Z*G}8TQ&++YQgwW#IpWCd|v4z6u#)tHr`;9 z3Z~d-7JrO!{HK0q%pzIlzA6?-v@LA{-8CglV`Vzxv5GV=nnxE6d|DoUnUaKEEQWQo zCsHo_lfAe1o5&w@O25m;6@4=lkYh#91(jZS5~OE8WiL=3zYE+!C7{>=5F4XtJS*W3 z)wDCMtrnaif)d1w+p?o)!?@|#+^)*koobI{Nv_~nIbpz#C3!*7)?5L^{s$^-{A5mh z-X9kl-RD*8l&zLsB}sjS>XgGfWh%I;MKOxoBMIu2tD8osePcxJa-|c|vnPlBtqDj0 z4tGz(mV;Yq)Yu&b$bl0sqAT;HF_;7VkmJ^H-0$YW&-0>wEMtzzqKh%IO}j2Zc+em5 z>GauvL;0{kdnpPw9&dQLh*xFG57}we?|-t`raj;6)U-k>K%VH1V;|YbSL%quLB(J+ zklCSUN8=)_@%vFO7PAL?5}ZXKavcOs@3Cb=l;_hL;}*LJb7u+f1r6dS_Dk}`j$C44 zm(F;3wUhkMk?W^PjX>ApHU{%t1%mkD9u_RcUy-gZqlWDXT9z{yrO@ksgVaKQ`Gs=j zj9qr-;Aov`Kfo{;6+%47ZTn#x(pP%ZeI-nFdp7C)-t87)PmH&Umalwgg@rxr36<`Y z;k7gayCe->lHn2eIBDq_>^ zlFJngySy4vFeM7%*XkwF@AHW+JG0AV1yJk7?B}|HR0P>lJ6ZHIjK?|~=u!wR zZQo^uxH6SY!2R}_Yr?#6h(L#2f*t zP_+=a#R&1tm8AZFr_(g;Gv#M+RsW#|kV$fx^91Ofd6$~MC8tx^6ITU&lMONq!qZCM zTn+M-ZX}@P5a*H<=5H_UV%_BTf<=lW=^=B3c`7?r#&$v?x#{f3UV8wCf($Y-PKyDP z^r7FzxO=k7K)r0RmkX(W^sp0n{5S6X7*F*NxqGkZd(Pz2KS`lk^z7VPo6BQtk{DWqm&yGZi{ zV)#}3Fr=3Yao*l6Gup{6PGLQz;j@hdduqGRIBPMHlC^GwJTB}jV65Tlw0;RcibHe1 z<{oh*+!ItduzbCNz#DcXnl(73^^3LhQ^vBeV_hO+?GJ7A&AY9SOEVBLo6XIN{MNjo zv1X%5ZGzz8&hso|plf{X&@ifuUwMG+FTbbvDG6Ka1_?xJdx6xrQ!>pqRG*Umej&n=AO?86T(8%U8=Lih19_GgXyCOV zV-P`;y+d{(ylfaGtAB5I{vB&-3H=@lle)VoCL3w@-H?0MuspM%+xHVsBunIze8dvo zSR+w6bY^Jm=d#*|NulZc$GZNwS_cn$5+nry=JJ=CSiCMUX~+Rxq?8xfx^f)#k1^n{ zu8p+pxnRL#^GvmUvBTE^Ab@M@AIA$14ZVdWRS0ZqHT+h8#$8bpVIrQ#hx0M9 z9-OlvAcJaeria$VW;ujxk(NokEOVe%FC#onSD85yP*(eHb*gUI{tZsevZ_lPS2toO zgCdJFww-RrvHDpFhz&hysu3|3#)bnC>_%p?H>P6KB*vGHht8Tk`?Wd_fZVvvEW-;h z!Ep588D?(~g-Q6;IWW$_?R_D${2;R@t*C{dP%U z0@9Up(bA7EkNd!W`IU>kD*^-2CCx2M(;| zp4XV#eeeI%(Eir%o8W|J^J_&Kje0eDh8>_n5k*}^6odIY7m-ADyx9S?D#fj^-`eDd z{6!(Ftp;a{K_eIXtb$sR0Fx2&7KcQ-Iup@|{Z#`W3p zpJH@4g^C1S&-SsxuD5oy>cBfXjf)1;k0L11`}epol(tlO;5Mt)@|`VFi-c%tzoWE-Zp>fKB=T^3XJ>qt8XK_25APWndGefr#C_;$(~jMXS% z-8@*u+_~`JN+~<)#mkY<2Tr;aLU*8gs48ZL$B*mW%;xg#7ud+JY+Y@>a4JVR6&R$S zqpgzfW9}Un-bHGKm+V(dzoZ<+?Ig<5OM#KyAdCTv_pVB^<#BxgrMjC@`!=OlyV}=& zA~Q`j>78q}E4ggkM5mUz^dm?Wue`sKL0fsd-n`BrF#$m)&yCN@B^cmm(NRB;NarC> z*T^M-i6k7*7Q&@?QfxQXJPj{Ef>0hHD%HBhNF;Sr-2_>SL3ry7t?*#*(C3Rk_YAB0`?&@i{RVFeI^U;0}4j0Ej;7UO(2XgZM`1 zQ^3xNA3YLg)grUg2jMMUw49ViK@kWR-?x*!Q3LVqJzk@`awvM_7?)&#Jq0p7$e4t) z_gU7$La{k}pgvT0J9uM9>LySuXo=N2m{MigR2!dWh1*-3Ib)uUX{8qCV}XU&^gx4) zh|&5f+jGsp9-#kDXcq^g>D|>OD)_3d#p;X7O}dEE7_i!u@1WpY=G9Wc(xEXAm(64L zAWvVH2>Twg98`B+q1qAqwHaf>xqp~y(KQ^^dGJ+OXehr<_dU-JP!fsGOBnQdtHlo2 z9y-QPF%vqHCypnIl@wzVk_MfSSN+ zJN(`Vd@J6)A3{TW$K|vW22`l6~2ZA2Y{nIJQVHA2AVguRVjTDAg^C(J!3s}Z8 z+7iX2X%m13LpNl3aBn{})%z!|61O%gwb|z?u#>>F#GfYL$aX}IBxQ$!zQ0@jG0lcf zm4tMh{EXJ*Ii;$`IWpI z<1epa3{=CAlD#c3Siq4$`LAgyS|tzcPUNTPd+<%Rges7^6A598WL7X(0R>=@~j zHV|xmX1P&VDm1w9pyFk`;0L@y!R0mhh}Mqh)IZO3Bw5+Wv;1F{iDZw7eHrrr9aXce zwIBfE>(0Zkn4Id&)=j^hD;oS1W5@i#E50&$v%P(1I&lM$;)#h*#g*dTQ1;HPYKsOh zwA_o>Y~cI`(YU3xy@DojtK~LQr!Kb$Wr^D34Fis#f_F6WfYCGxY(xe7k6EdJL?a4< zV)%h_0MSRz`XDOY6wZb%1S${Drg771P~Jgor3nW49tSx;&!EYWH`7e)N+H;m_!mmC=V|Kq^B1ZRk_L#dh7_3Ov32?U@e!*w1APB+>Ggzsxa z$~|qq+yt}STSQm6TB4tXQ#RJk41+yRLR}^fZ%vJH7-a?NJyqZ=nZlh|(V{lCG(y5PG!Pz0ga)V1U2k}^6+a4xX0kn;!u(QD^`6n5>p&N z)q6tik+t{#1_`+g_FXCL+9SQW$m(vd=rQfzIL;NgybvI?5`@_zYM%w~?|b@GUBT(!~m;WRo#C6hHQ@X5w;I6g0)%e>M$ zS%Xq6o|x7$CY-Ag6yG)_I0O)1ya6z4EPX@Ug=xAKjY@%}O&u3gGhcQdPq7;Z!5Y*U zUo0B_J*P~0B}Het-iixTjHExMlobl@sL=xTUB(^HgkDm?n;?x#%r+f_nLCqGjM$$%n7tl7+o=Rh2926#KzsQ?hzP*?lS= zSvblAU`b#I1hfhu-&$6i#xThk|8N19{FTPkm)S|Kn)S&|!}gzvUHzWdf-TFI2^O@> zbaV}Oh7u9XJ1u8J+(bl#aep=SWk6|(oOQ2RMaX`6xC@#8Wh{ybI|xMT3FQWp9LBP! zwsu9`3A5UEnpV~ppRE=EVD?zIqD zi=Q1Q;L#7YWMw3_X9i1%rv7hfncX&QM8mghyaJ|WeNy>?0&fIP9Gqo}CSncZ$+xny zF&g(Z4inYGAyDA`Jh!TmPRW~PrxxIZ8)GzN@||=7denUduMA!{UweGLZ6M;6jX`u(m}n?BPw zp7(PmFOx)V4TB`uaFJWS$UZN)?*8%BY;H`gI$S`lGaR=yF!QkYq63|^-n>}T*SAD7 z`<9y3T@bW4IjEDb6v}92r`VUn3ItlC(XBdV^CoY0=K2bbku6~EPCLfFW0$CWInUmf z(xyNQd;lokaOPboaAVxivIvsdIrhte>?i}^DqE}(qq7;Ly{%KkZkn^Noml*ky11ML z@B58I(o=+YVZ}%Ti6(jGZ@?Iiy?zy~vW7&5CGWnu77mqqUP-@^Ef`Oe4nD561t4|J)>WTAWeAtxreKDRxuJ+Li*jhkCHNB7(1R4wDks#UI z4n5`(w72#LU_lB;h|Goev4&qbM^j~);~m?QZEEZ~6EAPR>QSgR`ozV~1Lw3qvT6u$ z5}S2O3V7OB8=-H&qge5Oc?7?$bEq?{4Z*&T9xJFlt27`o#tmiz@S9#%`f9v^)s-A z+s4|lxHkzN&tg~)#11dEg!@)IW}{Z%?=I|fBdsX2CTdeeY`99`5AcXmCLbWt6(5D6 z4-9vYK`Sf5X+;pnd(6=NnA*JO;%*NE)E_RCur9eh$C3t z7qZqw0gYxC>Lo_r^-y`#`!hgB#FXX_US&+-2*(WcTMnb#@bPv5 z{$)|wnK1^LQ+8S(MAsXRo5H)Q%H<6HD9AY?>opn2Zy_}CYScPg(4Xg#&Xe9KcL{1NGuB1;vHP0~Xsrcf;2Bdy(6XC#9 zkqn?K7ya`(gRsA4rvDn$`bL_68;zWHg1JHxp0ah+klacJWegH_K50JPt53X$1k|-D zluJYDq4YCiOUA_3VV5Dz1D`V60dufOonH&d7n`*qxdDHllg>30(YoDY(PR>NHROcTCTpB= zpJsVS+ip#<3L>7pUv_F79pimKgXloIqb8ZrTid9cUCY#sL!MwXe>nwvxmFu}=~QYo z21m#^fvTSIkE3k0(EWh2z)r4kry>2qnxxn_1XlMB`QFHX%&m^zFHq0=&gMu(W8dwn zTXi>8g>4hH^us-YVQ$H2XM19sLKO?qt=**zf|mXG_L$?O{C-C1CQgGN*6r6k&DNmE z;clq2ay>Rf!e;S=$YS_sDQKKrX9?$E&DoX(|F?Lxdk{X;v!IUZRdz!43qh)a`?qdt z@W75Zj_SY(7DDxjICf_KC-P)?qUoQs6E0!svimPIhj4l}pu7C5{nc+yIip2LQ3&k$cAcasX=T@eu(HkcL|fS)k@W**pITdy zzfi`hS8>e|2O=`wtc>J(;}PYx%_PC4I}HV8_~|LOrvqiLCY*Lra+qOXV1_OwB|Rk2 zA7{QPX}Tydhu*-m$_MzozD_n?lMy&pR(o??LgD~*t;L&AZ4<6A>oLzr+QkDX^YkXh zx~ohy!XhTJOuV8w#{t&*$_vkn^_#*NKj~gFv};1{0=3i(3DMD|nz21uM@6?UMf~9x zU78U0YYw~>IkDSLpC|{K*dtY(;67-@qn0T*KWRF;{Un*pcw!0Zu1U7nv-3bRo&tJh zM9f5G755j-*J79?jqNy0>5AMiL{GbVrNRq|ViXXBubfA^_h-M{P(V|*n-N;4q0qE{ znJUS{G-TLkRiML=KZV@RPR7q-s(w+(C=nx7aRX%cPdQ?B>%tg65bCQ zQ~rZHt7f3$>~nZj7!e#^RZ+RY88C)9;DNTC)t>?->AX{mMsom5PTKwV_qxm5k1)n; zZ@x(`hFwA$IwS%UwdHAMx@4ifSpM(vn89$zZtz)dXcpY7OhDz75GZzXxNy$53c!)q z9wqSQj_KYl3du=I6W#1%?0jvOl(lITW@eYjg>JK;&ytMJWa;^!rQ3#wvDs`wc*&$d*D9GI# z90SSv=^Mb4yloqYSi~^8<7Y|bDAFG0i+=|d&fBSS>8#W|UC{M#5Fp1Z+ZM&wtNtoc zK1k6UqwL+k7Zzs-O^n#55#jcKvx=k*478(y zhj)soOt9XzVBKr)l)o5J=S^wSPz{3Sex=N@B{^pyOwsfWF~o#^V6ho`f@%TLNn&LVz5X_xBOR%vEcPyO*L)!$E0Hms(mL}e40XNIwUUD>b;h0u;FidkK5p3J z4{OxfJQoh~(OEM~XEz?n@(?Z*UYgo0(GPr61hX6gwf=oWIZ^Wj%ij{tsz52bfxm8# zc7vBT;r|AVwoTmdzfi2X<`3t>*s!y^wN5bQ4u*PL=KB7^TFg=NYPt&MS~x827~-9D zXLA4LA;jcbeTFv7@JsXanQ|79pHv&iygfJKx52Q`Sh7~MW&F-vz*~w;+3{nUxxDfb z6=F)ED4I~YG{~t57E?%pX)isUME_Fo+m``xL;YsH$IISb?qJ38++q+!6YJDQ5z4IC zfWwXRdAY5>Nm!%@_9;fF38O&w(<}en7-TIkZu+X_NMH18XB+T}_rgyqEcc`(A9G!k z@3<;=6FXoKWDB;@M#+7){{m?+xEquLM!4j`p4TYJK3K?v%o7&Vf}PEp4M-0fFw79G z6zooEEf;#+?Of3EecMDwbbNT+i8y}pFr5M7?F5BeG2=xq_Qy%%wokBji1RA{h;=L) z7M@mMqaX3GskS(sBrc!RSWCLuS=!Z?OQ;7lC%4nldVHk%i$&`n4TO)O6+}-t1rjC4 zqX&p81bB@PYAUn*yMO)S!u!BLdNYbS<8Df^FJP$#7qG^>wx{X7(J&l@XsTUkHMWs89Xt;ro5?DUn}>$e6m$2@&Shlk-7~D7O52Pt0WR;ZeE1M1 zdiEkgY@PIr=Z#Z%16k+2kjCuDF{6n~7!XHCH-f16=jnPCs=`@p{Tqdf{)O6(ZLtho zpKvnbU31JRS9TY5UrmA~%1OVMnL@S@1q<=&hjH2s4>n`hAPW@x(Yw)k-=Cw3p+N26 zAoN=kQH*7*P&FcktczYONK3}EWJjOdD#juacZ{3!Zu?z&qxr~nJSZ0nLMJ;s^8XtD z2bkw~=r`r`%SyE~o*{FOeMJd-9s;d3@RJ?nx z7_v=Bx-N3F`m6y~`o^LQ)`Qc{(Sti8LQXJdq(g5JUrSX;8R#(EP2h0kZae zoHp82VkRbYl&&WM0Ze=Z7^T3dg!RxfO;BcR*p`DF*bXPBrrag9QaJWE!mmJ|xTDC} z*|qb{y2F+|&2~xe8eIgI{5$NcSfN^O1+MO98A<6S%YUfK*s&KObA}QZ!Lz;kuHj+f4ROmzt%2_q86P z#6~TUWXpkoC{#pv?}6TFF%CcDXSndS8aL-lILAMVe}+wJxXjpv?s}V%vJZ}V-VGWe zGqAEAML>@s6JHrAIaNo#&_-s(7DGtDj(L}z`iJ-2lqU{8zJII~Rx?|qF4B*^wmSNZ zZAGQv^fE6|t3*42BD3gI)snVAs0c?vW|f@cxtRA}$ydnpn2Y~Ur-{#rZk%F%!7jt{l}`O>35J|iqNAZNlcluqoV=p0xg&@ zhCp6{>;#2T)nhZOzU-cOnzSo|A1;HD&;@&fufFrb?>UGmqUF5UR36Jizs%$%qyWo_ zAKcqX>Pk^KM5~=q<4L*ze@DwF=?nb1T?@A{^NT`J#q>Ja;U`CY0pNO0pS1=-Tv);g z>_%Ibv{=-ZE??}$6K)m3%0LYUBU+Q@^$a$JqZWy6>p6`AQ6R!6ErEHk-C-6R1fJyV zehqbBSr_i;G^%vn6fq<=+2fa|Wy}Pd-83OXZXL!V@CcaFrpbNws@NL(I7Iw;p#Fx$ zR1j_E(;TNrAI=j(eBH@N;mkuryzmi9vV}q|`tj%J?(a1c09LMj*xWmkJ+VDLghPUMe33bcyrHV>v~-7f-3h!?}*#v z3ZX|VwP{1Wj@U1WO^Pk1eV3sA;L?=hZx%r9Nz>VJV7cIy_W(oRIRLA;Md>vFoNM{T4Q2HM_Ev$s~Qsn;f)1QRc%`F|0De| zdiJt3VHpLE7ulbz%!uu4Sgt_(@Ubu1>>_p{MHCrbE+8A}i6tO?2hqIE%2y;Qp~ea= zPBDYLj9C8-k&+#JsD3jqw;D#+bR-5lf-ylU!ZlmJgjx#wRzDz=SLOWSN>{er^z$Y2 znm&&h!|iUU<+R2Jo_FPU8Vs<2*$Ks03J7LWjjil`myqIs&tkQ*hxz>R+Z zXhXT~I3qfhfzFsx&<<9KxEO*4IAyFyZJT*C&8Qj#`6`Np>qGb>wIIpIEOo41)*hc# z#3$E;$`i^4tHv`ojq3Ygl!dVQ5Th*7O`JG3w);!_a}fb&LVFnV0;UL8uDBukf}t}@ zvD;g>yN>nm@N>OAo0Dcx8ix7r>9j~%UCSj7j5A}5SIiiTMzwkFt~2mHP#xLgmA7m2 zZv7quKC7VtOOyr&*50y}u5S`M#ufQ@V?i$=@QW;`00DNylEcp@a7 zlW9Ye9+XS`Zv%P3pvZyndTxW0iLG6R89t-*{SnK22J?@W6V^@wG(7SxD`{ptS#M8; zO(QF63*MC)u~C*$OI-;L$O+ns@R} zjxlumh^oaIisFFx@rGkOkF=_4I~aE&hDQGJc~k-)ML5_GUK%-ZFn0vu|zDFC0-D716cj5Mn_9mPJeua&XwE<2lvDH+su*IpyJfp~7e#)O`r1}7l zR~+0?PV`&o9(z*+1|D=Gt;kmSf5$|YH!~P{D)}XQdD?n7mH}7lTv^G_5_j%v=#vk* zBF%;D;V75cfAKDa9Ky6!e;X-#V(;`gBGWTVmuW!nIR?lBF^mH!)IXtNZ{Vq`{zYbl zn67J_{2;e`5MXy%^{)fSN}v->DYg);7|f3Cd%aubw5DDi^t$soO(#;2d}-qS zUUPB(^*Ls`Mg-1*NfFnj()QA{=bSxo-*U0!%f(;c0Qcq(!t~a@0$?pH1_A?}Kge9t zBq)CZw=-T@jyP&#$2HxiBx7y1x+;Oio1di}WAR=?)T9(`hJorx3=1 z7h)lfH-xn-iL)9#%NAk*R8d0~fj6@L1m-YVX~Okyw7Qz!<-$0QO>UvYIieb@0dxpd z3P2w~Vc=~>MJDrxm?$uXp*fo~H8b5x-Tf`l7K3pwL1uO8^06I& zr7^W#yxbE%<0qzTYvY*J%y^ec@2>#0k+sP;YA?**O?!YN7y%G^TT}~-?+w=1Y)g+x zl^(ObODmd`iO>2A#$}ZB;5hzC1@_*UsVQ=HC#xreFjdOYTkG}dH;9Wl_|r!-n);k) zdWkLr?5L#OzDachyqkyzJo=wmxEbQxTR{HA2xYhUHTtsseb28TBXABd0TBE4Z%>KF z_oau~64jMT045a0H(x>}CX1}QT1`&GA1@2(mHQ;tzGonsHOvmttIXw10(Y+~G-m!% zKM;TlN^D|PkhG|!7;K2FyPl32xU#2kIn*R66lGwpHz7(wvZIuU;1x5IAef3zL(;-Y zo>=#`W{nJwq`{6Y&x_#Z1=mj-%Qk|YAY6l5r4w4V4v1TowrcJ*Qndr>T5N)yrw0jD zOC+p2#2HOA4jB|Z zhdm48o#{AvZOyFTWY?lew4nm>KX>LZ-rD^4hwRun_twdfnzfWJ-S8TWIJzgt#g2B1 z9wWd`t&NkXp=W7D&2Ep>Zloz+?sCU%T|V{dxk19JCINQ1QtFP!kbQ8}aqm#ZBp zieN@o8_x00u{=hYLF1aYofoY?S*_hGkvDYA?Ydw?F zFty4U5M>{R4HjvB=!OA~V%We)d8A4LT#0NULxQBsdMm{q4uNr6gtmv2jwaV7ns^t3 zWy8eFrACDyM-;sHX|Cv$ucuaY%I8nTPMq7?5#{)Y4mnwS){AmHXi$+|c>4|jiqv99nP*F3 zUp@>CXq6ohTQ@YGSF63yF|4`0802!vC5J5C@d5*9?rw@Ob8}_V)#gl89+5(g*fL7Uvj{_Rb_Wh8b-C4&ttd$RU92|M z`x?1U0HjeZgtwLm%&@lh-jP3=7EsO8bOP~?dmOm9S^nXT3O!NCn(;M-b|E^aY0ttb zkf`j?|G~S6ofwdSg1KbqmrTAjPbv6di(LdzBKyz6YCg8e!l%MxDyF}+YZ*S1)UztlpmHtS^Dgnb`gM~B)#DaCvu|z)J^GGl zN|mk*V=2GiqgJN-y*i8T@yN(XG5aqmT$ z9Bd`2{i?A^%Sumzb^BR-GV!}j^PLp*a}PVxc}u&USN9Q;nh>=SgE=d@HB$DKu2${$ zk`Az?(a)hZ6iY2RP9PJl9&~>q3H#oBsG6sGXBf zrC0fy|1K8*iM^36jvumMY()?6d`+d&-*36B?I%cuK-&h#UIBW;VQL`5ZcU>rU9cW z*UiHi6b>u@?B%69tETpE*_O~cUDdnDrVuP#KJ~}G+Nta($jMO&3x*_a;`D5 z%z&}*DeREg_I4mnU)AI8WzH60o3mbk6M^M%s28gjPEx3F-wt0TKPc-4z2C2Pny!OEfM& z{SqE_U}pl6M6~>xDA`L3w^zI+f@L_t5$~D9w?_!_H7f02atl)z%FP4#KKjnzC6lk?tR0o+L#=Fho(0*#x zIXgLyWaLB4pw^^MA;1?fPfX&+(oXf0uvwQpDej}5qk1S|i^?EDTAo;jnC;tgC8I{( z#N!9U&9zorsq0?v&wqNLjfARkZ{1pfq?X#L%3;8{BJDYJ$<;qKm^`NTiN-{%rQE*J z{IkJBH;qK711NdHc9=US$9G}OWHp*-J75*S1du`!A?y|wux8W(#i>FSEC>@yNH|1W z!8ItEC0m=cet?Xc)AZIN zv5kJc?$oviQn(pvZQ~QTPb&4jo1Isa>;s=~-RP#c+PRu74$ja8S9FqXZU=6wctfGF z=shij1v(~$$Oe{L5-_pGi`3m*^=+Ggo?1a`pOs{>K3v^2lkbuDw>>v^_0{FBPEMUF z>&V!I3*2H|ZHFASFh~StF&@X2jwPxY=Fq1N{URvcvY|>bQP}bT4OL&RclvmwPHcec zl%CkPrM|0NML@I9^;toXy-@Y-Fx5bHMZ`*9}qf0CP#WanRIwy;clK0ar zz*iB@mna^3H}5A=sP6E*Zmq)t+9G&3`XTx~s%O*Ip#_cje#y~h2&Wv~SJp0Gu;C?g z5heJF61IlamdA9}2RuS(vJ2Pu$ccFpl3rlYRXAE_Tj;zQeWhg49W(2ovlo}oLeJ0d zkBE-I`Quq1*S9J;5J=wHL?y^HtDiLO;km04X2t>=G3Vr(0giKT$b{3~qG}k46hp!3 zsxMeaZh7Rc!xte^$vQfxC_VquvJjgU4uBGtxFhVf5qzi=KG)W!Cyp0t_pPVnaG**q zuiEpw6A)$MC~_$0ssP@@vd9s{i?f;9QjD~!x%7|ik$SJ7;EV>)^_g^+s&09dSGvhl z>#^+RGyUxhfLk`W@4D7mX~1NGlh2Y5wwQxs3Xi2-!EmEaUq&$i30C{wk)XPasx0rS zeCU*p98z2iPZNmFpu%S*QWobJ9j;^4z~RpN!^`58&}oc<>5X?HdV0Kx>(lU|>twx{dpG_!lO*)|b9#M}JUF9W$bqy3 z<-a^P8-6xV#_3p_LUoFg$P$=xoGa*OFsr3E;%k$Wzk=85*3_ofO+xULrv};7ZHc1k zwyCg>-xG2QRov$Z_nQ=FWo*xVs5(;+@#r7?T8AZ?9pOu6K4Kk?S1%a+EiNx&lk!+CqNkPcT+`dB+>5tZT%j<Ts91u>cHElNLL|>t6`nD|0Rv8%PcD2c`DYb8(B% zY-9UDfm9ElY-;D~)<(jJ0Ol4WuKfHbcp8g8A$^f*fVp^mxEoH8KBum5C3dI49x|Jj zn~p@x@v{^&^I8!i^ad-TnWrxziWzJt17Ogd9u8fIZAKo7Cy$9|Z86u4{Sgl=aZjh4 zlNaN-c9mda0Pd_@Z(X%4uU7}5-1UsEDxnD9_LlSPhI(<((puQ}jL#mBC4Lo?0XNpn z-o86n31O|#=G?fR74$kX5=tmgHuOK2Hir4bh6R};+2e%nnSEmP4tUvQ#g0s$6@C9% z!u5sbjgGaU4P>V_YLsg&7BubdB*KD^8q^So6snGX4fkrFfej0h5x@~<@gQGiPy+ci z%X<4ytF*0@qgKp3LjiJnEhquQM_~?RbW<;VK)U`OCbMn1G}+mMS`ygia~|xIRDS=WJCP%QbID3>v?9dgeiB<||5XsEQO*%C zcM1e&E4So84(^V@Jgs0jaYK#u@y(;drdt82Jtja02hE}3V-=$&p({*$XIkrt_%2Wb zYjKeekiKbukWGq^jnCZgI?im_3zmw$x3(E>zokza(B2g&LD#iMC&NP`$p{v%$`J1#DW_Xr3o&P%tK^J~8Il^(Qw>*b(Yp zT*$ob*Ktqy=%yml9q8|70Rj<&UsbExmeaumwc?0+)V`?BPN%(Mpv0j)xW+zozg}0M zzO0=J%JfH)u5CV|qJ9_Y0GJG3SAP|G;Syg><_CRt9S$2iphYK$+mtMctHcXQ1qIq>Y4I`>*C?w_n7>U$TRlr__7*X_C zH1l!bX)36_RG;PWhL0Q=5@uXW8|kZIim=eG+Emg$WGJh`B8J{-9qt~CsXFF9w8bJ0 zCSIs#K491h=t%(ysg1sC*jz>}c4En32nz=RsO&6b%RriWN9TXy|1)85U#S(ESfB8L z&CFGd@xp%9G33B&f1K-`rXDoFj&XU5?WEoeXj$59s2b?s8k z=ONT{_VuiGefx=}rt*Y(f?l@F3&cEu^3V7Than9xgPw`MaG{L5OVem0n-@LgDl2RC za1pNG{>vhVXQ=)$+d__=0+8O{z4*Us>l+g5;Te zs69Z(V6Y<5zUX%@u)f>!g+9$a!OR|))Ura04`=mt586Vl#L!PQdK*eMTYn6V1{nrI z0FY2t==EJMnsJl&Vdy(R|D3#42R12!xy|~(!hm(cjvcxH00CtDLD$Ewt3g^?SG12F zvtpb+3{g+Ngx8F(Qi|p{A-PT{sQ%p(7kHj%DT$*t-2V#k3#oZQN;=u_7Q@0`r2pH+gBz6swQ~Z)rFiO5 zU4!mZzCea@G1^Mfo^g5J#!)Lb6(4<-pJsd_sXZM+bMRyHInfe(}L$G#B$f2X7_gc_Wz0`M<12xCR2Gv(16fTri z971@n)%{~VN`w!%sr?HB8pTc%8T==Uh4I6>duX-OAOg}Dnpa`8#OBWHmWj_DsY35{ zhjGb*E#Rsb13IXTQ*adl=;?M03<&zZxtU`5d2~U0Oa1z(#gIYk<`;tRa`Ule!sN4r z-YvQ-u?sAX#s+=o2Qiwx`iBSm?uFrbP3~TN*U^HH-jO)`!R}y)P`Ilvo{e)wk+K5pd%-K(93?AAO7Q z{ z+M6JA(CqeEuOlDfwL(kgn=SjBU|0u6GpB;=KoI)7a%JT$I(Hm7n4x@Oh<6vhh^%J< zTsG9iRI(qfKYj;RC6aMLCuLwik8}~)T&iN=Bo86|TT>>>KLY{`gEkuBSbM1B531rc z0NYj$tId{AsPJoKU`14Guj(t#volrwiSxfxZGpT*q^O0b_LhjIHR1JD+qMfuH&JTSSQojJrHiG- zCj1N=f;DMSnoQ^eK|vOzWQ000FF7&vMTpszA;c068v<=z9s z2HG(PJG@EvGpmchb)3Rr)GcH%Rh>xd{!GzoNr||tin>vbA4sL=AUraA_ecZPpHSr^ zlf8f+WskMrRSZY-)=-yRaN6L?}^NO_c|&5by>CG49#YHdi#~K zrt0M#kWz7e?2bxGG!mjWCkVStvcjP6rct?5maE*{NTpeqpQ>`8m-R;Z${_i^TuOGf8op*_Xr3m9XU>R7;k0blj!ShlR+>0C{7$U@ zV*h|pLKs#I&oDq8*p%N$h9kQFDNB=sCkt&JpJT`Q-zmc(9y+>9mb{D#%OJ`i{kSnY3AN}7<{AQ>7pQ#`V{x!3N z5jF_@Ooc-)i9Zcos9b1iOMvIuM-r1Qi20*1U9a`|vem!M$Bszxg%k92usgs`37ZPN znvdz$(BvwdUPuhUWY(~^SYPp~W`9lJ$-;3!LUXLGRa<=<7j6$((N=lasIg)eu2VIN zZM8)R>S_e@IJ6sX@~;uOe9);@w>*}DJdGFKi|GdUTq6pCv%E#H=>JxS1F`6O?S9yu%fV9Scd^B4jY zQlC9RJ&yco)#-rO2CZ%aG{3L#&W8o{)uoeD7v-(zuUh{qZkV8RzWTy^DW2i6QLch9 zZ233BnnbmSsn8ryvrJeZyVNNP&|efR*Y6$Vo^w>Azwi5S>*YXNpdMj6idRx-=fPF7 zhhDZ?+q;btDEbA??Ft{4iKrgi7E!o`q&{y8wH*Q4MgFTO_*_T{C42!o&5Oj*Zo>Kc zt5hS%`xP#-9v~Z7KxCOxqQQy;Z+m?#oLRi+7y*O1X zfry2HyWl934q2eFwa({}fA{ZwxSUP|W;~}AKRCM8@Ga^3w zRRE|_8+O{*S<9{6H}|@4-8Dn;24Y)gF$DY-fJE7w- zHM<$yRPfS@5c?PBg#6w}%~2wuP0e-D^sk`}QL2vpf`ek4Eb7U$$jqeTr-cYcvS+<4 zw;bQcfa&IK zd+q7XvyG#{M$P8KF#A3+SIDLLKr6gz>7dBj^)W>6VGuW)5le!P#%zX#^lGQ1*!plw zq|TmchIo!8l3SG}7!;JRz4`48xeE*}#G-SnN{m$zc7N|MZ8cNd_tVBkiGylMXhiIS%3e5n` zB#_QM!SN-4SK#0%DA;TGb_XIr=v$Jx%y9_wg(*9nW9-#UK^}7{0hIMB`hgdD-=zNm zl_{;M(x%>yqq~Ofy29$o=AAB5^U|1I3T6=ww?PpCg`96t1PL?B{G?Ej625gBf6BIO z;!4)12ltK3?OI7|Dzy}aF{K{-I zR?cAUNk-8!XXH{04dWemXTjZ~6W)Gl%ko*p=)}yvb_@SJ67?OBuS0$M#L9+*k3FS%>eT59X{iROEPwz(W}#q&0x|i+Q2WK!?c}N= z1_fm9ss0kFlo_Fr1i~fpT&e2H9bYI^JXin}De#O5Jd!fmgAGurA8#|HLdiS1_B?bM zB^UYiD?)UR)TNX@7VDtzmjkupr87f0CqFpI!&z}}r+q$p0J5!KQLgS9A=(|}YP1H< zT;`oU!h-;AVe@c^ud8Ip|+$il}po#6??=%)lCdSuIU99aF%)bbURj9QEL}QZm z*B#rxPO{zk&t&rIFnc^uv%Rk6e9y9B+!wo!KvA$ew4%gOevJHwI@VhVGx_{#_&rh$fhM%XWEB)DstnVvI|iA3ZfYcl`2 zB*e|guVf*^w^RrHw(VIRWv-Wkm@15n;ttbzh0Wzc$hnRZT^Y1oF&{ zIE8?g!4VXGP>l*d)vy6H!$o4=B85hx3T4)sMk!V36nZbXI>s-oJo<5?D%^2I^EwHt zJypczl#$yr(D3~B+${+gKg`v9Iz|=BJi=Fs{RCc1m3jRA#gcy*x^YN{0cagH(OU*{ zCXE37GF>(K;kdq*jSsxGfehKv40er;kcIETft%^*RoCtSmjlC{w;d~IALp%U0AiD; z<#6rltA44gB^hzVMqL)B%GK-FXO0&YoyMko?Y38L=SisWc`82q9KQ- zMV=op;`9nI9wk)f+fo$Y}yDrlVJ>U|d>MTZW}zl&22fUfHzuM~087f(u>CGxAI z+#J`lfLg9>o&wLoyl(j{-qR`ez<4j&?Kdav!^%I*P&(Tq~QjVq4q z>Jat5kt0PeNGns@TyUb}R2UQh00004%9rC15?<5O4Wtg1P7}FxP0xXs8C-P!`RLLuM z+AD#+U)aw-9GQ8t4wpAM>^O4smyH+E{P5C4c{*UqQO8&Iu|LO85}^)F;u%bracM|?d_`q16RwtytCw`t__27Uc-=G@$` ziNMu15-b?jZu6;`C%feZpNXvDKNCgVO%h;@oC(gFB;l%(qa#LY`Zy|_16<~^j@8r} zvmms3KN^>|YAzqBtn34I>ps1;)bG%?q6kd|rW79|(sShsy%G6#be=~tfjt*y4;h(2 zzR!InryGgEy#TIHS3(*pK6BEDhXB~VE?~mk46&?=5%d<3gjk6ni$f1dM^cU?A^FGP zzoY@aSAKXV-dUBh%oQ`K5967$&EybidTzApYc&qRD1A?PWeA|SM2peYR2j04$B(c? z^u1Z8D5|^%a+CM;Vahun2|cRqV1nK`5; + status = "disabled"; + perm-read; + perm-write; + perm-execute; + }; + + ram3x_dma_region: memory@2fc07000 { + compatible = "nordic,owned-memory"; + reg = <0x2fc07000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2fc07000 0x1000>; + + cpuapp_dma_region: memory@680 { + compatible = "zephyr,memory-region"; + reg = <0x680 DT_SIZE_K(2)>; + status = "disabled"; + #memory-region-cells = <0>; + zephyr,memory-region = "DMA_RAM3x_APP"; + }; + + cpurad_dma_region: memory@e80 { + compatible = "zephyr,memory-region"; + reg = <0xe80 0x80>; + status = "disabled"; + #memory-region-cells = <0>; + zephyr,memory-region = "DMA_RAM3x_RAD"; + }; + }; + }; +}; + +&mram1x { + cpurad_rx_partitions: cpurad-rx-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + perm-read; + perm-execute; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + + cpurad_slot0_partition: partition@66000 { + reg = <0x66000 DT_SIZE_K(256)>; + }; + }; + + cpuapp_rx_partitions: cpuapp-rx-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + perm-read; + perm-execute; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_slot0_partition: partition@a6000 { + reg = <0xa6000 DT_SIZE_K(512)>; + }; + + cpuppr_code_partition: partition@126000 { + reg = <0x126000 DT_SIZE_K(28)>; + }; + }; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi new file mode 100644 index 00000000000..d3b79120322 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + /omit-if-no-ref/ uart135_default: uart135_default { + group1 { + psels = , + ; + }; + + group2 { + bias-pull-up; + psels = , + ; + }; + }; + + /omit-if-no-ref/ uart135_sleep: uart135_sleep { + group1 { + low-power-enable; + psels = , + , + , + ; + }; + }; + + /omit-if-no-ref/ uart136_default: uart136_default { + group1 { + psels = , + ; + }; + + group2 { + bias-pull-up; + psels = , + ; + }; + }; + + /omit-if-no-ref/ uart136_sleep: uart136_sleep { + group1 { + low-power-enable; + psels = , + , + , + ; + }; + }; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts new file mode 100644 index 00000000000..359c1f84307 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" + +/ { + compatible = "nordic,nrf54h20pdk_nrf54h20-cpuapp"; + model = "Nordic nRF54H20 PDK nRF54H20 Application MCU"; + + chosen { + zephyr,console = &uart136; + zephyr,code-partition = &cpuapp_slot0_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpuapp_ram0; + }; + + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + }; + + buttons { + compatible = "gpio-keys"; + + button0: button_0 { + gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 0"; + zephyr,code = ; + }; + + button1: button_1 { + gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 1"; + zephyr,code = ; + }; + + button2: button_2 { + gpios = <&gpio0 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 2"; + zephyr,code = ; + }; + + button3: button_3 { + gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 3"; + zephyr,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + + led1: led_1 { + gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + + led2: led_2 { + gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + + led3: led_3 { + gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; +}; + +&ram3x_dma_region { + status = "okay"; +}; + +&cpuapp_dma_region { + status = "okay"; +}; + +&cpuapp_rx_partitions { + status = "okay"; +}; + +&cpuppr_vpr { + source-memory = <&cpuppr_code_partition>; + execution-memory = <&cpuppr_ram3x_region>; +}; + +&gpiote130 { + status = "okay"; + owned-channels = <0 1 2 3 4 5 6 7>; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio9 { + status = "okay"; +}; + +&grtc { + status = "okay"; + child-owned-channels = <5 6>; + nonsecure-channels = <5 6>; + owned-channels = <4 5 6>; +}; + +&uart135 { + pinctrl-0 = <&uart135_default>; + pinctrl-1 = <&uart135_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart136 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart136_default>; + pinctrl-1 = <&uart136_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml new file mode 100644 index 00000000000..a364c2863d3 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20pdk_nrf54h20_cpuapp +name: nRF54H20-PDK-nRF54H20-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 32 +flash: 368 +supported: + - gpio diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig new file mode 100644 index 00000000000..1f7ef38a7fc --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig @@ -0,0 +1,33 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_ENGA_CPUAPP=y +CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUAPP=y + +CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts new file mode 100644 index 00000000000..02213d88645 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" + +/ { + compatible = "nordic,nrf54h20pdk_nrf54h20-cpurad"; + model = "Nordic nRF54H20 PDK nRF54H20 Radio MCU"; + + chosen { + zephyr,console = &uart135; + zephyr,code-partition = &cpurad_slot0_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpurad_ram0; + }; +}; + +&ram3x_dma_region { + status = "okay"; +}; + +&cpurad_dma_region { + status = "okay"; +}; + +&cpurad_rx_partitions { + status = "okay"; +}; + +&grtc { + status = "okay"; + child-owned-channels = <8 9 10 11 12>; + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, + <108 NRF_DEFAULT_IRQ_PRIORITY>; + nonsecure-channels = <8 9 10 11 12>; + owned-channels = <7 8 9 10 11 12 13 14>; +}; + +&uart135 { + status = "okay"; + memory-regions = <&cpurad_dma_region>; + pinctrl-0 = <&uart135_default>; + pinctrl-1 = <&uart135_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart136 { + pinctrl-0 = <&uart136_default>; + pinctrl-1 = <&uart136_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml new file mode 100644 index 00000000000..d1c8548d07d --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20pdk_nrf54h20_cpurad +name: nRF54H20-PDK-nRF54H20-Radio +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 32 +flash: 368 +supported: + - gpio diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig new file mode 100644 index 00000000000..254d8656e61 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig @@ -0,0 +1,30 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_ENGA_CPURAD=y +CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPURAD=y + +CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y From 6450e4a56d0ad90639f90e5e87d77649aee10bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 31 Jan 2024 15:37:12 +0100 Subject: [PATCH 0334/2300] [nrf fromtree] tests: lib: cpp: Exclude cpp98 test on nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to nRF54L15, the MDK files in HAL for this SoC are not compatible with C++98, so currently the test cannot be performed on this SoC. Signed-off-by: Andrzej Głąbek (cherry picked from commit 00566d64fa901cbd7725068f6ff82ee0f0fffc16) (cherry picked from commit 6c5a7ba4cd796e99a9d0ed828c992e45e946c366) --- tests/lib/cpp/cxx/testcase.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/lib/cpp/cxx/testcase.yaml b/tests/lib/cpp/cxx/testcase.yaml index cbdaacf714c..d1a7235a84c 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -34,8 +34,11 @@ tests: # -std=c++98) cpp.main.cpp98: arch_exclude: posix - # Exclude nRF54L15 as its HAL is not compatible with C++98. - platform_exclude: nrf54l15pdk_nrf54l15_cpuapp + # Exclude nRF54L15 and nRF54H20 as Nordic HAL is not compatible with C++98. + platform_exclude: + - nrf54l15pdk_nrf54l15_cpuapp + - nrf54h20pdk_nrf54h20_cpuapp + - nrf54h20pdk_nrf54h20_cpurad build_only: true extra_configs: - CONFIG_STD_CPP98=y From 1b90f1e9bcc1972f870514e01911164948679d50 Mon Sep 17 00:00:00 2001 From: Christopher Friedt Date: Wed, 4 Oct 2023 13:46:54 -0400 Subject: [PATCH 0335/2300] [nrf fromtree] iterable_sections: define iterable_named_alternate variant Add STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE() for structures ordered by name in a custom section. Signed-off-by: Christopher Friedt (cherry picked from commit 903f6281ace3f58adc96d26d04cbae212c3968bb) (cherry picked from commit 566c717fc028cb4cd4bad8f0c925e9c2137f5207) --- include/zephyr/sys/iterable_sections.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/zephyr/sys/iterable_sections.h b/include/zephyr/sys/iterable_sections.h index fe1976363ca..3ec4af5e9a0 100644 --- a/include/zephyr/sys/iterable_sections.h +++ b/include/zephyr/sys/iterable_sections.h @@ -234,6 +234,16 @@ extern "C" { #define STRUCT_SECTION_ITERABLE_NAMED(struct_type, name, varname) \ TYPE_SECTION_ITERABLE(struct struct_type, varname, struct_type, name) +/** + * @brief Defines a new element for an iterable section with a custom name, + * placed in a custom section. + * + * The name can be used to customize how iterable section entries are sorted. + * @see STRUCT_SECTION_ITERABLE_NAMED() + */ +#define STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(struct_type, secname, name, varname) \ + TYPE_SECTION_ITERABLE(struct struct_type, varname, secname, name) + /** * @brief Iterate over a specified iterable section (alternate). * From 7e355ff16bdd1e6c2430611eb6a01de02f87f632 Mon Sep 17 00:00:00 2001 From: Christopher Friedt Date: Wed, 4 Oct 2023 13:40:29 -0400 Subject: [PATCH 0336/2300] [nrf fromtree] tests: misc: iterable_sections: add named alternate tests Add tests for the newly added STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(). This type of section should be iterated with STRUCT_SECTION_FOREACH_ALTERNATE(). Signed-off-by: Christopher Friedt (cherry picked from commit 28dccf236b2e34ad8567db2bf708f472e02ce8ee) (cherry picked from commit 5ccd0f365eeac4b335b3a30a95b9ed61a92c87fd) --- tests/misc/iterable_sections/CMakeLists.txt | 2 ++ tests/misc/iterable_sections/sections-ram.ld | 1 + tests/misc/iterable_sections/sections-rom.ld | 1 + tests/misc/iterable_sections/src/main.c | 24 ++++++++++++++++++++ 4 files changed, 28 insertions(+) diff --git a/tests/misc/iterable_sections/CMakeLists.txt b/tests/misc/iterable_sections/CMakeLists.txt index 24472eb8574..1a187eace6d 100644 --- a/tests/misc/iterable_sections/CMakeLists.txt +++ b/tests/misc/iterable_sections/CMakeLists.txt @@ -12,9 +12,11 @@ zephyr_iterable_section(NAME test_ram GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} zephyr_iterable_section(NAME test_ram2 GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) zephyr_iterable_section(NAME test_ram_named GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) zephyr_iterable_section(NAME test_ram_numeric NUMERIC GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) +zephyr_iterable_section(NAME ramn_alt GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) zephyr_linker_sources(SECTIONS sections-rom.ld) zephyr_iterable_section(NAME test_rom KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) zephyr_iterable_section(NAME test_rom2 KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) zephyr_iterable_section(NAME test_rom_named KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) zephyr_iterable_section(NAME test_rom_numeric NUMERIC KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) +zephyr_iterable_section(NAME romn_alt KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) diff --git a/tests/misc/iterable_sections/sections-ram.ld b/tests/misc/iterable_sections/sections-ram.ld index c7c86a8d97c..96454fb282d 100644 --- a/tests/misc/iterable_sections/sections-ram.ld +++ b/tests/misc/iterable_sections/sections-ram.ld @@ -4,3 +4,4 @@ ITERABLE_SECTION_RAM(test_ram, 4) ITERABLE_SECTION_RAM(test_ram2, 4) ITERABLE_SECTION_RAM(test_ram_named, 4) ITERABLE_SECTION_RAM_NUMERIC(test_ram_numeric, 4) +ITERABLE_SECTION_RAM(ramn_alt, 4) diff --git a/tests/misc/iterable_sections/sections-rom.ld b/tests/misc/iterable_sections/sections-rom.ld index c837cbfbc4b..525c480c7bf 100644 --- a/tests/misc/iterable_sections/sections-rom.ld +++ b/tests/misc/iterable_sections/sections-rom.ld @@ -4,3 +4,4 @@ ITERABLE_SECTION_ROM(test_rom, 4) ITERABLE_SECTION_ROM(test_rom2, 4) ITERABLE_SECTION_ROM(test_rom_named, 4) ITERABLE_SECTION_ROM_NUMERIC(test_rom_numeric, 4) +ITERABLE_SECTION_ROM(romn_alt, 4) diff --git a/tests/misc/iterable_sections/src/main.c b/tests/misc/iterable_sections/src/main.c index e5d697b8a80..a2dde51bd23 100644 --- a/tests/misc/iterable_sections/src/main.c +++ b/tests/misc/iterable_sections/src/main.c @@ -44,6 +44,12 @@ const STRUCT_SECTION_ITERABLE(test_ram_numeric, ramn_10) = {0x03}; const STRUCT_SECTION_ITERABLE(test_ram_numeric, ramn_11) = {0x04}; const STRUCT_SECTION_ITERABLE(test_ram_numeric, ramn_3) = {0x02}; +#define NAMED_ALT_EXPECT 0x4273 + +/* alternate naming */ +const STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(test_ram_named, ramn_alt, R, ramn_42) = {0x42}; +const STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(test_ram_named, ramn_alt, W, ramn_73) = {0x73}; + /** * * @brief Test iterable in read write section. @@ -89,6 +95,13 @@ ZTEST(iterable_sections, test_ram) } zassert_equal(out, RAM_EXPECT, "Check value incorrect (got: 0x%x)", out); + + out = 0; + STRUCT_SECTION_FOREACH_ALTERNATE(ramn_alt, test_ram_named, t) { + out = (out << 8) | t->i; + } + + zassert_equal(out, NAMED_ALT_EXPECT, "Check value incorrect (got: 0x%x)", out); } struct test_rom { @@ -126,6 +139,10 @@ const STRUCT_SECTION_ITERABLE(test_rom_numeric, romn_10) = {0x30}; const STRUCT_SECTION_ITERABLE(test_rom_numeric, romn_11) = {0x40}; const STRUCT_SECTION_ITERABLE(test_rom_numeric, romn_3) = {0x20}; +/* alternate naming */ +const STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(test_rom_named, romn_alt, R, romn_73) = {0x73}; +const STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(test_rom_named, romn_alt, O, romn_42) = {0x42}; + /** * * @brief Test iterable in read only section. @@ -161,6 +178,13 @@ ZTEST(iterable_sections, test_rom) } zassert_equal(out, ROM_EXPECT, "Check value incorrect (got: 0x%x)", out); + + out = 0; + STRUCT_SECTION_FOREACH_ALTERNATE(romn_alt, test_rom_named, t) { + out = (out << 8) | t->i; + } + + zassert_equal(out, NAMED_ALT_EXPECT, "Check value incorrect (got: 0x%x)", out); } ZTEST_SUITE(iterable_sections, NULL, NULL, NULL, NULL, NULL); From 1b794d8227078d95098b12e695d29e44fb6cd538 Mon Sep 17 00:00:00 2001 From: Christopher Friedt Date: Fri, 22 Sep 2023 15:08:11 -0400 Subject: [PATCH 0337/2300] [nrf fromtree] device: support for mutable devices Add support for mutable devices. Mutable devices are those which can be modified after declaration, in-place, in kernel mode. In order for a device to be mutable, the following must be true * `CONFIG_DEVICE_MUTABLE` must be y-selected * the Devicetree bindings for the device must include `mutable.yaml` * the Devicetree node must include the `zephyr,mutable` property Signed-off-by: Christopher Friedt (cherry picked from commit afc59112a96c884abf39100b06e89bde4effea29) (cherry picked from commit c18e8542d823008c96ffd4039e73e7af8b2ca48d) --- cmake/linker_script/common/common-ram.cmake | 4 +++ dts/bindings/base/mutable.yaml | 13 +++++++ include/zephyr/device.h | 40 ++++++++++++--------- include/zephyr/init.h | 18 +++++++++- include/zephyr/linker/common-ram.ld | 4 +++ kernel/Kconfig | 7 ++++ 6 files changed, 68 insertions(+), 18 deletions(-) create mode 100644 dts/bindings/base/mutable.yaml diff --git a/cmake/linker_script/common/common-ram.cmake b/cmake/linker_script/common/common-ram.cmake index a116977ce8c..7e639043bce 100644 --- a/cmake/linker_script/common/common-ram.cmake +++ b/cmake/linker_script/common/common-ram.cmake @@ -128,3 +128,7 @@ if(CONFIG_USB_HOST_STACK) zephyr_iterable_section(NAME usbh_contex GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) zephyr_iterable_section(NAME usbh_class_data GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) endif() + +if(CONFIG_DEVICE_MUTABLE) + zephyr_iterable_section(NAME device_mutable GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) +endif() diff --git a/dts/bindings/base/mutable.yaml b/dts/bindings/base/mutable.yaml new file mode 100644 index 00000000000..0e2d1cad3b0 --- /dev/null +++ b/dts/bindings/base/mutable.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2023, Meta +# SPDX-License-Identifier: Apache-2.0 + +# Properties for Mutable devices + +properties: + zephyr,mutable: + type: boolean + description: | + True iff the device structure may be mutated. + + Inherit this binding for devices that are runtime-modifiable, in-place. + This places the device structure into SRAM rather than Flash. diff --git a/include/zephyr/device.h b/include/zephyr/device.h index 630a059c155..77c0537ffdf 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -41,6 +41,10 @@ extern "C" { */ #define Z_DEVICE_DEPS_ENDS INT16_MAX +/** @brief Determine if a DT node is mutable */ +#define Z_DEVICE_IS_MUTABLE(node_id) \ + COND_CODE_1(IS_ENABLED(CONFIG_DEVICE_MUTABLE), (DT_PROP(node_id, zephyr_mutable)), (0)) + /** @endcond */ /** @@ -924,12 +928,13 @@ static inline bool z_impl_device_is_ready(const struct device *dev) * @param api Reference to device API. * @param ... Optional dependencies, manually specified. */ -#define Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, \ - prio, api, state, deps) \ - COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \ - const STRUCT_SECTION_ITERABLE_NAMED(device, \ - Z_DEVICE_SECTION_NAME(level, prio), \ - DEVICE_NAME_GET(dev_id)) = \ +#define Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, prio, api, state, \ + deps) \ + COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \ + COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), (const)) \ + STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE( \ + device, COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (device_mutable), (device)), \ + Z_DEVICE_SECTION_NAME(level, prio), DEVICE_NAME_GET(dev_id)) = \ Z_DEVICE_INIT(name, pm, data, config, api, state, deps) /* deprecated device initialization levels */ @@ -961,15 +966,15 @@ static inline bool z_impl_device_is_ready(const struct device *dev) * @param level Initialization level. * @param prio Initialization priority. */ -#define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_, level, prio) \ - Z_DEVICE_LEVEL_CHECK_DEPRECATED_LEVEL(level) \ - \ - static const Z_DECL_ALIGN(struct init_entry) __used __noasan \ - Z_INIT_ENTRY_SECTION(level, prio, \ - Z_DEVICE_INIT_SUB_PRIO(node_id)) \ - Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \ - .init_fn = {.dev = (init_fn_)}, \ - .dev = &DEVICE_NAME_GET(dev_id), \ +#define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_, level, prio) \ + Z_DEVICE_LEVEL_CHECK_DEPRECATED_LEVEL(level) \ + \ + static const Z_DECL_ALIGN(struct init_entry) __used __noasan Z_INIT_ENTRY_SECTION( \ + level, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \ + Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \ + .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \ + (init_fn_)}, \ + .dev = &DEVICE_NAME_GET(dev_id), \ } /** @@ -1015,8 +1020,9 @@ static inline bool z_impl_device_is_ready(const struct device *dev) * don't have a corresponding @ref device allocated. There's no way to figure * that out until after we've built the zephyr image, though. */ -#define Z_MAYBE_DEVICE_DECLARE_INTERNAL(node_id) \ - extern const struct device DEVICE_DT_NAME_GET(node_id); +#define Z_MAYBE_DEVICE_DECLARE_INTERNAL(node_id) \ + extern COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), \ + (const)) struct device DEVICE_DT_NAME_GET(node_id); DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_DEVICE_DECLARE_INTERNAL) diff --git a/include/zephyr/init.h b/include/zephyr/init.h index 9b0d2993d62..7882b207b8d 100644 --- a/include/zephyr/init.h +++ b/include/zephyr/init.h @@ -73,6 +73,17 @@ union init_function { * @retval -errno If device initialization fails. */ int (*dev)(const struct device *dev); +#ifdef CONFIG_DEVICE_MUTABLE + /** + * Device initialization function (rw). + * + * @param dev Device instance. + * + * @retval 0 On success + * @retval -errno If device initialization fails. + */ + int (*dev_rw)(struct device *dev); +#endif }; /** @@ -96,7 +107,12 @@ struct init_entry { * If the init entry belongs to a device, this fields stores a * reference to it, otherwise it is set to NULL. */ - const struct device *dev; + union { + const struct device *dev; +#ifdef CONFIG_DEVICE_MUTABLE + struct device *dev_rw; +#endif + }; }; /** @cond INTERNAL_HIDDEN */ diff --git a/include/zephyr/linker/common-ram.ld b/include/zephyr/linker/common-ram.ld index c03351abf98..7bb6e55f1c1 100644 --- a/include/zephyr/linker/common-ram.ld +++ b/include/zephyr/linker/common-ram.ld @@ -137,6 +137,10 @@ ITERABLE_SECTION_RAM(zbus_channel_observation_mask, 1) #endif /* CONFIG_ZBUS */ +#if defined(CONFIG_DEVICE_MUTABLE) + ITERABLE_SECTION_RAM(device_mutable, 4) +#endif + #ifdef CONFIG_USERSPACE _static_kernel_objects_end = .; #endif diff --git a/kernel/Kconfig b/kernel/Kconfig index 6280e80a400..d5e737e7655 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -1260,6 +1260,13 @@ config DEVICE_DEPS_DYNAMIC Option that makes it possible to manipulate device dependencies at runtime. +config DEVICE_MUTABLE + bool "Mutable devices [EXPERIMENTAL]" + select EXPERIMENTAL + help + Support mutable devices. Mutable devices are instantiated in SRAM + instead of Flash and are runtime modifiable in kernel mode. + endmenu rsource "Kconfig.vm" From a096f3cdf48389826ee52933922b10cdecbb65f3 Mon Sep 17 00:00:00 2001 From: Christopher Friedt Date: Fri, 22 Sep 2023 15:26:11 -0400 Subject: [PATCH 0338/2300] [nrf fromtree] drivers: misc: devmux: a device multiplexer pseudo-device The Device Multiplexer (devmux) is a pseudo-device that can be used to select between multiple included sub-devices. It is experimental, but its current use is in system remediation. Take for example, the scenario where the system console and log subsystem both have the uart backend enabled. The case may arise, where the chosen backing uart could be an abstraction of another very high-bandwidth bus - such as a PCIe BAR, a UDP socket, or even even just memory. If the "service" (for lack of a better term) that backs this abstract "uart" experiences an error, it is of critical importance to be able to switch the system console, uart log backend, or whatever to another uart (semi-transparently) in order to bring up a shell, continue to view system logs, or even just support user console I/O. Signed-off-by: Christopher Friedt (cherry picked from commit 37e19451ec2d8cf3e48edb6c8bf9333cb796ab6c) (cherry picked from commit 5e3875f0752dd5fb0c129551ceb13e73ae9ede5d) --- drivers/misc/CMakeLists.txt | 1 + drivers/misc/Kconfig | 1 + drivers/misc/devmux/CMakeLists.txt | 10 ++ drivers/misc/devmux/Kconfig | 23 +++ drivers/misc/devmux/devmux.c | 179 ++++++++++++++++++++ dts/bindings/misc/zephyr,devmux.yaml | 33 ++++ include/zephyr/drivers/misc/devmux/devmux.h | 90 ++++++++++ 7 files changed, 337 insertions(+) create mode 100644 drivers/misc/devmux/CMakeLists.txt create mode 100644 drivers/misc/devmux/Kconfig create mode 100644 drivers/misc/devmux/devmux.c create mode 100644 dts/bindings/misc/zephyr,devmux.yaml create mode 100644 include/zephyr/drivers/misc/devmux/devmux.h diff --git a/drivers/misc/CMakeLists.txt b/drivers/misc/CMakeLists.txt index 863f839184e..6c4ec2384d9 100644 --- a/drivers/misc/CMakeLists.txt +++ b/drivers/misc/CMakeLists.txt @@ -6,3 +6,4 @@ add_subdirectory_ifdef(CONFIG_GROVE_LCD_RGB grove_lcd_rgb) add_subdirectory_ifdef(CONFIG_PIO_RPI_PICO pio_rpi_pico) add_subdirectory_ifdef(CONFIG_NXP_S32_EMIOS nxp_s32_emios) add_subdirectory_ifdef(CONFIG_TIMEAWARE_GPIO timeaware_gpio) +add_subdirectory_ifdef(CONFIG_DEVMUX devmux) diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 66d83fc693d..52c77b4c7ec 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -10,5 +10,6 @@ source "drivers/misc/grove_lcd_rgb/Kconfig" source "drivers/misc/pio_rpi_pico/Kconfig" source "drivers/misc/nxp_s32_emios/Kconfig" source "drivers/misc/timeaware_gpio/Kconfig" +source "drivers/misc/devmux/Kconfig" endmenu diff --git a/drivers/misc/devmux/CMakeLists.txt b/drivers/misc/devmux/CMakeLists.txt new file mode 100644 index 00000000000..94f74ea57ce --- /dev/null +++ b/drivers/misc/devmux/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2023, Meta +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() + +zephyr_syscall_header( + ${ZEPHYR_BASE}/include/zephyr/drivers/misc/devmux/devmux.h +) + +zephyr_library_sources(devmux.c) diff --git a/drivers/misc/devmux/Kconfig b/drivers/misc/devmux/Kconfig new file mode 100644 index 00000000000..4f848b4e06c --- /dev/null +++ b/drivers/misc/devmux/Kconfig @@ -0,0 +1,23 @@ +# Copyright (c) 2023, Meta +# SPDX-License-Identifier: Apache-2.0 + +config DEVMUX + bool "Device Multiplexer (devmux) [EXPERIMENTAL]" + depends on DT_HAS_ZEPHYR_DEVMUX_ENABLED + depends on DEVICE_MUTABLE + select EXPERIMENTAL + help + Devmux is a pseudo-device that operates as a device switch. It allows + software to select the data, config, and api from a number of linked + devices. + +if DEVMUX + +config DEVMUX_INIT_PRIORITY + int "Devmux init priority" + default 51 + help + Init priority for the devmux driver. It must be + greater than the priority of the initially selected muxed device. + +endif diff --git a/drivers/misc/devmux/devmux.c b/drivers/misc/devmux/devmux.c new file mode 100644 index 00000000000..653236f903d --- /dev/null +++ b/drivers/misc/devmux/devmux.c @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2023, Meta + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT zephyr_devmux + +#include +#include +#include +#include + +struct devmux_config { + const struct device **devs; + const size_t n_devs; +}; + +struct devmux_data { + struct k_spinlock lock; + size_t selected; +}; + +/* The number of devmux devices */ +#define N DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) + +static const struct device *devmux_devices[N]; +static const struct devmux_config *devmux_configs[N]; +static struct devmux_data *devmux_datas[N]; + +static bool devmux_device_is_valid(const struct device *dev) +{ + for (size_t i = 0; i < N; ++i) { + if (dev == devmux_devices[i]) { + return true; + } + } + + return false; +} + +static size_t devmux_inst_get(const struct device *dev) +{ + for (size_t i = 0; i < N; i++) { + if (dev == devmux_devices[i]) { + return i; + } + } + + return SIZE_MAX; +} + +const struct devmux_config *devmux_config_get(const struct device *dev) +{ + for (size_t i = 0; i < N; i++) { + if (dev == devmux_devices[i]) { + return devmux_configs[i]; + } + } + + return NULL; +} + +struct devmux_data *devmux_data_get(const struct device *dev) +{ + for (size_t i = 0; i < N; i++) { + if (dev == devmux_devices[i]) { + return devmux_datas[i]; + } + } + + return NULL; +} + +ssize_t z_impl_devmux_select_get(const struct device *dev) +{ + ssize_t index; + struct devmux_data *const data = devmux_data_get(dev); + + if (!devmux_device_is_valid(dev)) { + return -EINVAL; + } + + K_SPINLOCK(&data->lock) + { + index = data->selected; + } + + return index; +} + +#ifdef CONFIG_USERSPACE +ssize_t z_vrfy_devmux_select_get(const struct device *dev) +{ + return z_impl_devmux_select_get(dev); +} +#include +#endif + +int z_impl_devmux_select_set(struct device *dev, size_t index) +{ + struct devmux_data *const data = devmux_data_get(dev); + const struct devmux_config *config = devmux_config_get(dev); + + if (!devmux_device_is_valid(dev) || index >= config->n_devs) { + return -EINVAL; + } + + if (!device_is_ready(config->devs[index])) { + return -ENODEV; + } + + K_SPINLOCK(&data->lock) + { + *dev = *config->devs[index]; + data->selected = index; + } + + return 0; +} + +#ifdef CONFIG_USERSPACE +int z_vrfy_devmux_select_set(struct device *dev, size_t index) +{ + return z_impl_devmux_select_set(dev, index); +} +#include +#endif + +static int devmux_init(struct device *const dev) +{ + size_t inst = devmux_inst_get(dev); + struct devmux_data *const data = dev->data; + const struct devmux_config *config = dev->config; + size_t sel = data->selected; + + devmux_configs[inst] = config; + devmux_datas[inst] = data; + + if (!device_is_ready(config->devs[sel])) { + return -ENODEV; + } + + *dev = *config->devs[sel]; + + return 0; +} + +#define DEVMUX_PHANDLE_TO_DEVICE(node_id, prop, idx) \ + DEVICE_DT_GET(DT_PHANDLE_BY_IDX(node_id, prop, idx)) + +#define DEVMUX_PHANDLE_DEVICES(_n) \ + DT_INST_FOREACH_PROP_ELEM_SEP(_n, devices, DEVMUX_PHANDLE_TO_DEVICE, (,)) + +#define DEVMUX_SELECTED(_n) DT_INST_PROP(_n, selected) + +#define DEVMUX_DEFINE(_n) \ + BUILD_ASSERT(DT_INST_PROP_OR(_n, zephyr_mutable, 0), \ + "devmux nodes must contain the 'zephyr,mutable' property"); \ + BUILD_ASSERT(DT_INST_PROP_LEN(_n, devices) > 0, "devices array must have non-zero size"); \ + BUILD_ASSERT(DEVMUX_SELECTED(_n) >= 0, "selected must be > 0"); \ + BUILD_ASSERT(DEVMUX_SELECTED(_n) < DT_INST_PROP_LEN(_n, devices), \ + "selected must be within bounds of devices phandle array"); \ + static const struct device *demux_devs_##_n[] = {DEVMUX_PHANDLE_DEVICES(_n)}; \ + static const struct devmux_config devmux_config_##_n = { \ + .devs = demux_devs_##_n, \ + .n_devs = DT_INST_PROP_LEN(_n, devices), \ + }; \ + static struct devmux_data devmux_data_##_n = { \ + .selected = DEVMUX_SELECTED(_n), \ + }; \ + \ + DEVICE_DT_INST_DEFINE(_n, devmux_init, NULL, &devmux_data_##_n, &devmux_config_##_n, \ + PRE_KERNEL_1, CONFIG_DEVMUX_INIT_PRIORITY, NULL); + +DT_INST_FOREACH_STATUS_OKAY(DEVMUX_DEFINE) + +#define DEVMUX_DEVICE_GET(_n) DEVICE_DT_INST_GET(_n), +static const struct device *devmux_devices[] = {DT_INST_FOREACH_STATUS_OKAY(DEVMUX_DEVICE_GET)}; diff --git a/dts/bindings/misc/zephyr,devmux.yaml b/dts/bindings/misc/zephyr,devmux.yaml new file mode 100644 index 00000000000..744daaca120 --- /dev/null +++ b/dts/bindings/misc/zephyr,devmux.yaml @@ -0,0 +1,33 @@ +# Copyright (c) 2023, Meta +# SPDX-License-Identifier: Apache-2.0 + +description: Generic Device Multiplexer + +compatible: "zephyr,devmux" + +include: [base.yaml, mutable.yaml] + +properties: + + devices: + type: phandles + required: true + description: | + Devices to be multiplexed. + + selected: + type: int + default: 0 + description: | + Initial multiplexer selection. + + This must be in the range [0, N-1], where N is the length of the + 'devices' phandle list. + + If unspecified, the default selection is zero in order to ensure that + the multiplexer is ready for use (i.e. one of the [0, N-1] multiplexed + devices is selected). Zero is, necessarily, the only possible valid + default value since the phandle list must have length >= 1. + + Note: Specifying a value of 'selected' outside the range [0, N-1] + results in a compile-time error. diff --git a/include/zephyr/drivers/misc/devmux/devmux.h b/include/zephyr/drivers/misc/devmux/devmux.h new file mode 100644 index 00000000000..1772d719d96 --- /dev/null +++ b/include/zephyr/drivers/misc/devmux/devmux.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023, Meta + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Public APIs for the Device Multiplexer driver + */ + +#ifndef INCLUDE_ZEPHYR_DRIVERS_MISC_DEVMUX_H_ +#define INCLUDE_ZEPHYR_DRIVERS_MISC_DEVMUX_H_ + +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Devmux Driver APIs + * @defgroup demux_interface Devmux Driver APIs + * @ingroup misc_interfaces + * + * @details + * Devmux operates as a device multiplexer, forwarding the characteristics of + * the selected device. + * + * ``` + * +----------+ +----------+ + * | devmux | | devmux | + * | | | | + * dev0 | | dev0 | | + * +----------> \ | +----------> | + * | \ | | | + * dev1 | \ | dev0 dev1 | | dev2 + * +----------> O +----------> +----------> O +----------> + * | | | / | + * dev2 | | dev2 | / | + * +----------> | +----------> / | + * | | | | + * | | | | + * | | | | + * +-----^----+ +-----^----+ + * | | + * select == 0 | select == 2 | + * +--------------+ +---------------+ + * ``` + * @{ + */ + +/** + * @brief Get the current selection of a devmux device. + * + * Return the index of the currently selected device. + * + * @param dev the devmux device + * @return The index (>= 0) of the currently active multiplexed device on success + * @retval -EINVAL If @p dev is invalid + */ +__syscall ssize_t devmux_select_get(const struct device *dev); + +/** + * @brief Set the selection of a devmux device. + * + * Select the device at @p index. + * + * @param[in] dev the devmux device + * @param index the index representing the desired selection + * @retval 0 On success + * @retval -EINVAL If @p dev is invalid + * @retval -ENODEV If the multiplexed device at @p index is not ready + */ +__syscall int devmux_select_set(struct device *dev, size_t index); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#include + +#endif /* INCLUDE_ZEPHYR_DRIVERS_MISC_DEVMUX_H_ */ From 7cd3905c5307dfd7581afc681ab8cf2a36e9ca83 Mon Sep 17 00:00:00 2001 From: Christopher Friedt Date: Fri, 22 Sep 2023 15:36:43 -0400 Subject: [PATCH 0339/2300] [nrf fromtree] tests: drivers: console: add console_switching test This testsuite exercises a number of things. Namely * `mutable` devices (i.e. those backed in SRAM) * `uart_emul` support for interrupt mode (receive only) * `devmux` capabilities of multiplexing several uarts * switching the system console between several uart backends Testing Done: ``` west build -p auto -b qemu_riscv64 -t run \ tests/drivers/console_switching/ ... *** Booting Zephyr OS build zephyr-v3.4.0-3988-gaaefb2d764ea *** Running TESTSUITE console_switching ================================================================ START - test_read read "Hello, uart_emul0!" from uart_emul0 read "Hello, uart_emul1!" from uart_emul1 read "Hello, uart_emul0!" from uart_emul0 read "Hello, uart_emul1!" from uart_emul1 PASS - test_read in 0.005 seconds ================================================================ START - test_write wrote "Hello, uart_emul0!" to uart_emul0 wrote "Hello, uart_emul1!" to uart_emul1 wrote "Hello, uart_emul0!" to uart_emul0 wrote "Hello, uart_emul1!" to uart_emul1 PASS - test_write in 0.003 seconds ================================================================ TESTSUITE console_switching succeeded ------ TESTSUITE SUMMARY START ------ SUITE PASS - 100.00% [console_switching]: pass = 2, fail = 0,... - PASS - [console_switching.test_read] duration = 0.005 seconds - PASS - [console_switching.test_write] duration = 0.003 seconds ------ TESTSUITE SUMMARY END ------ =============================================================== PROJECT EXECUTION SUCCESSFUL ``` Signed-off-by: Christopher Friedt (cherry picked from commit b13ec704d0dcb3cb2d99f8c7236b4baa13833639) (cherry picked from commit 92e2ba15bdf9265155cabcafa4bcb11d3d14ad04) --- .../drivers/console_switching/CMakeLists.txt | 9 ++ .../boards/qemu_riscv64.overlay | 39 ++++++ tests/drivers/console_switching/prj.conf | 9 ++ tests/drivers/console_switching/src/main.c | 124 ++++++++++++++++++ tests/drivers/console_switching/testcase.yaml | 16 +++ 5 files changed, 197 insertions(+) create mode 100644 tests/drivers/console_switching/CMakeLists.txt create mode 100644 tests/drivers/console_switching/boards/qemu_riscv64.overlay create mode 100644 tests/drivers/console_switching/prj.conf create mode 100644 tests/drivers/console_switching/src/main.c create mode 100644 tests/drivers/console_switching/testcase.yaml diff --git a/tests/drivers/console_switching/CMakeLists.txt b/tests/drivers/console_switching/CMakeLists.txt new file mode 100644 index 00000000000..3ba70cc081e --- /dev/null +++ b/tests/drivers/console_switching/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(uart_console_switching) + +target_sources(app PRIVATE + src/main.c + ) diff --git a/tests/drivers/console_switching/boards/qemu_riscv64.overlay b/tests/drivers/console_switching/boards/qemu_riscv64.overlay new file mode 100644 index 00000000000..47bd7945189 --- /dev/null +++ b/tests/drivers/console_switching/boards/qemu_riscv64.overlay @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023, Meta + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,console = &devmux0; + zephyr,shell_uart = &devmux0; + }; + + euart0: uart_emul0 { + compatible = "zephyr,uart-emul"; + current-speed = <0>; + status = "okay"; + }; + + euart1: uart_emul1 { + compatible = "zephyr,uart-emul"; + current-speed = <0>; + status = "okay"; + }; + + devmux0: dev_mux_0 { + compatible = "zephyr,devmux"; + devices = <&uart0 &euart0 &euart1>; + zephyr,mutable; + status = "okay"; + }; + + devmux1: dev_mux_1 { + compatible = "zephyr,devmux"; + devices = <&uart0 &euart0 &euart1>; + zephyr,mutable; + selected = <2>; + status = "okay"; + }; +}; diff --git a/tests/drivers/console_switching/prj.conf b/tests/drivers/console_switching/prj.conf new file mode 100644 index 00000000000..fcdd67928c4 --- /dev/null +++ b/tests/drivers/console_switching/prj.conf @@ -0,0 +1,9 @@ +CONFIG_ZTEST=y +CONFIG_ZTEST_NEW_API=y +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_CONSOLE_SUBSYS=y +CONFIG_CONSOLE_GETLINE=y +CONFIG_DEVICE_MUTABLE=y +CONFIG_DEVMUX=y +CONFIG_UART_EMUL=y diff --git a/tests/drivers/console_switching/src/main.c b/tests/drivers/console_switching/src/main.c new file mode 100644 index 00000000000..95cde150c9b --- /dev/null +++ b/tests/drivers/console_switching/src/main.c @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2023, Meta + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#define BUF_SIZE 32 + +/* array of const struct device* */ +#define PHANDLE_TO_DEVICE(node_id, prop, idx) DEVICE_DT_GET(DT_PHANDLE_BY_IDX(node_id, prop, idx)) +static const struct device *devs[] = { + DT_FOREACH_PROP_ELEM_SEP(DT_NODELABEL(devmux0), devices, PHANDLE_TO_DEVICE, (,))}; + +/* array of names, e.g. "euart0" */ +#define PHANDLE_TO_NAME(node_id, prop, idx) DT_NODE_FULL_NAME(DT_PHANDLE_BY_IDX(node_id, prop, idx)) +static const char *const name[] = { + DT_FOREACH_PROP_ELEM_SEP(DT_NODELABEL(devmux0), devices, PHANDLE_TO_NAME, (,))}; + +/* array of greetings, e.g. "Hello, euart0!" */ +#define PHANDLE_TO_TEXT(node_id, prop, idx) \ + "Hello, " DT_NODE_FULL_NAME(DT_PHANDLE_BY_IDX(node_id, prop, idx)) "!" +static const char *const text[] = { + DT_FOREACH_PROP_ELEM_SEP(DT_NODELABEL(devmux0), devices, PHANDLE_TO_TEXT, (,))}; + +ZTEST(console_switching, test_write) +{ + size_t normal_uart = DT_PROP(DT_NODELABEL(devmux0), selected); + struct device *const devmux_dev = DEVICE_DT_GET(DT_NODELABEL(devmux0)); + + /* for each uart_emul device */ + for (size_t i = 0, j = 0, N = ARRAY_SIZE(devs); i < 2 * N; i++, j++, j %= N) { + if (j == normal_uart) { + /* skip testing non-emul uart */ + continue; + } + + int ret[4]; + char buf[BUF_SIZE] = {0}; + + /* write text[j] to dev[j] */ + ret[0] = devmux_select_set(devmux_dev, j); + printk("%s", text[j]); + ret[1] = uart_emul_get_tx_data(devs[j], buf, ARRAY_SIZE(buf)); + ret[2] = devmux_select_set(devmux_dev, normal_uart); + + zassert_ok(ret[0], "Failed to select devmux %zu", j); + zassert_ok(ret[2], "Switching back to selection %zu failed", normal_uart); + + /* verify that text[j] was written to dev[j] */ + TC_PRINT("wrote '%s' to %s\n", buf, name[j]); + + zassert_equal(ret[1], strlen(text[j]), "Only wrote %zu/%zu bytes of '%s'", + ret[1], strlen(text[j]), text[j]); + zassert_equal(0, strcmp(text[j], buf), "Strings '%s' and '%s' do not match", + text[j], buf); + } +} + +ZTEST(console_switching, test_read) +{ + size_t normal_uart = DT_PROP(DT_NODELABEL(devmux0), selected); + struct device *const devmux_dev = DEVICE_DT_GET(DT_NODELABEL(devmux0)); + + /* for each uart_emul device */ + for (size_t i = 0, j = 0, N = ARRAY_SIZE(devs); i < 2 * N; i++, j++, j %= N) { + if (j == normal_uart) { + /* skip testing non-emul uart */ + continue; + } + + int ret[4]; + char buf[BUF_SIZE] = {0}; + + /* read text[j] from dev[j] */ + ret[0] = devmux_select_set(devmux_dev, j); + console_getline_init(); + ret[1] = uart_emul_put_rx_data(devs[j], (uint8_t *)text[j], strlen(text[j])); + ret[3] = uart_emul_put_rx_data(devs[j], "\n", 1); + snprintf(buf, BUF_SIZE, "%s", console_getline()); + ret[2] = devmux_select_set(devmux_dev, normal_uart); + + zassert_ok(ret[0], "Failed to select devmux %zu", j); + zassert_ok(ret[2], "Switching back to selection %zu failed", normal_uart); + + /* verify that text[j] was written to dev[j] */ + TC_PRINT("read '%s' from %s\n", buf, name[j]); + + zassert_equal(ret[1], strlen(text[j]), "Only put %zu/%zu bytes of '%s'", + ret[1], strlen(text[j]), text[j]); + zassert_equal(0, strcmp(text[j], buf), "Strings '%s' and '%s' do not match", + text[j], buf); + } +} + +static void *setup(void) +{ + size_t selected = DT_PROP(DT_NODELABEL(devmux1), selected); + struct device *const devmux_dev = DEVICE_DT_GET(DT_NODELABEL(devmux1)); + + /* ensure that non-default initial selection via DT works */ + zassert_equal(devmux_select_get(devmux_dev), selected); + + return NULL; +} + +static void before(void *arg) +{ + struct device *const devmux_dev = DEVICE_DT_GET(DT_NODELABEL(devmux0)); + + zassert_ok(devmux_select_set(devmux_dev, 0)); + zassert_ok(devmux_select_get(devmux_dev)); + + for (size_t i = 1; i < ARRAY_SIZE(devs); ++i) { + uart_emul_flush_tx_data(devs[i]); + } +} + +ZTEST_SUITE(console_switching, NULL, setup, before, NULL, NULL); diff --git a/tests/drivers/console_switching/testcase.yaml b/tests/drivers/console_switching/testcase.yaml new file mode 100644 index 00000000000..0d24b5e596e --- /dev/null +++ b/tests/drivers/console_switching/testcase.yaml @@ -0,0 +1,16 @@ +common: + tags: + - drivers + - console + - emul + platform_allow: + - qemu_riscv64 + integration_platforms: + - qemu_riscv64 + +tests: + drivers.console_switching: {} + drivers.console_switching.user: + tags: userspace + extra_configs: + - CONFIG_USERSPACE=y From f678f1e09b39345ba8e48d1bf69afa564fa4b849 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 29 Nov 2023 10:32:41 +0000 Subject: [PATCH 0340/2300] [nrf fromtree] device: add braces around dev/dev_rw initializer The init_entry struct got modified to add a union with a non const dev pointer in afc59112a9. Some old compiler (such as GCC 4) seems to require a pair of brackets to correctly initialize the field in the union. Add those brackets to the initializers in device.h and init.h to maintain compatibility. Signed-off-by: Fabio Baltieri (cherry picked from commit 153f38a412f87aa652a1857ab83df2f4f9746326) (cherry picked from commit 301dbb2f4f817882c0cfe8b32d226ee0e34e8571) --- include/zephyr/device.h | 5 ++++- include/zephyr/init.h | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/zephyr/device.h b/include/zephyr/device.h index 77c0537ffdf..c55958924ff 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -974,7 +974,10 @@ static inline bool z_impl_device_is_ready(const struct device *dev) Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \ .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \ (init_fn_)}, \ - .dev = &DEVICE_NAME_GET(dev_id), \ + { \ + COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \ + &DEVICE_NAME_GET(dev_id), \ + }, \ } /** diff --git a/include/zephyr/init.h b/include/zephyr/init.h index 7882b207b8d..78ec454f27c 100644 --- a/include/zephyr/init.h +++ b/include/zephyr/init.h @@ -205,10 +205,7 @@ struct init_entry { #define SYS_INIT_NAMED(name, init_fn_, level, prio) \ static const Z_DECL_ALIGN(struct init_entry) \ Z_INIT_ENTRY_SECTION(level, prio, 0) __used __noasan \ - Z_INIT_ENTRY_NAME(name) = { \ - .init_fn = {.sys = (init_fn_)}, \ - .dev = NULL, \ - } + Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}} /** @} */ From de79ed64536275b9f6f5841c41c1b4fb82f2a2e7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 31 Jan 2024 13:21:10 +0100 Subject: [PATCH 0341/2300] [nrf fromtree] drivers: misc: nordic_vpr_launcher: initial version Add a custom driver that takes care of loading and launching RISC-V VPR cores found on the new nRF54 SoCs. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit d1468b8484af50053b29b2fd673d577623979324) (cherry picked from commit 22792ced4d19d97c88bbeb7f31e79fb294af96d6) --- drivers/misc/CMakeLists.txt | 1 + drivers/misc/Kconfig | 1 + .../misc/nordic_vpr_launcher/CMakeLists.txt | 5 ++ drivers/misc/nordic_vpr_launcher/Kconfig | 24 +++++++ .../nordic_vpr_launcher/nordic_vpr_launcher.c | 71 +++++++++++++++++++ 5 files changed, 102 insertions(+) create mode 100644 drivers/misc/nordic_vpr_launcher/CMakeLists.txt create mode 100644 drivers/misc/nordic_vpr_launcher/Kconfig create mode 100644 drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c diff --git a/drivers/misc/CMakeLists.txt b/drivers/misc/CMakeLists.txt index 6c4ec2384d9..c23bdb185de 100644 --- a/drivers/misc/CMakeLists.txt +++ b/drivers/misc/CMakeLists.txt @@ -7,3 +7,4 @@ add_subdirectory_ifdef(CONFIG_PIO_RPI_PICO pio_rpi_pico) add_subdirectory_ifdef(CONFIG_NXP_S32_EMIOS nxp_s32_emios) add_subdirectory_ifdef(CONFIG_TIMEAWARE_GPIO timeaware_gpio) add_subdirectory_ifdef(CONFIG_DEVMUX devmux) +add_subdirectory_ifdef(CONFIG_NORDIC_VPR_LAUNCHER nordic_vpr_launcher) diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 52c77b4c7ec..3511b8b6fd4 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -11,5 +11,6 @@ source "drivers/misc/pio_rpi_pico/Kconfig" source "drivers/misc/nxp_s32_emios/Kconfig" source "drivers/misc/timeaware_gpio/Kconfig" source "drivers/misc/devmux/Kconfig" +source "drivers/misc/nordic_vpr_launcher/Kconfig" endmenu diff --git a/drivers/misc/nordic_vpr_launcher/CMakeLists.txt b/drivers/misc/nordic_vpr_launcher/CMakeLists.txt new file mode 100644 index 00000000000..70c84e84217 --- /dev/null +++ b/drivers/misc/nordic_vpr_launcher/CMakeLists.txt @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() +zephyr_library_sources(nordic_vpr_launcher.c) diff --git a/drivers/misc/nordic_vpr_launcher/Kconfig b/drivers/misc/nordic_vpr_launcher/Kconfig new file mode 100644 index 00000000000..57605e505f2 --- /dev/null +++ b/drivers/misc/nordic_vpr_launcher/Kconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config NORDIC_VPR_LAUNCHER + bool "Nordic VPR coprocessor launcher" + default y + depends on DT_HAS_NORDIC_NRF_VPR_COPROCESSOR_ENABLED + help + When enabled, the VPR coprocessors will be automatically launched + during system initialization. + +if NORDIC_VPR_LAUNCHER + +module = NORDIC_VPR_LAUNCHER +module-str = Nordic VPR Launcher +source "subsys/logging/Kconfig.template.log_config" + +config NORDIC_VPR_LAUNCHER_INIT_PRIORITY + int "Nordic VPR coprocessor launcher init priority" + default KERNEL_INIT_PRIORITY_DEVICE + help + The init priority of the VPR coprocessor launcher. + +endif # NORDIC_VPR_LAUNCHER diff --git a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c new file mode 100644 index 00000000000..161465ba02c --- /dev/null +++ b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nordic_nrf_vpr_coprocessor + +#include + +#include +#include +#include +#include +#include + +#include + +LOG_MODULE_REGISTER(nordic_vpr_launcher, CONFIG_NORDIC_VPR_LAUNCHER_LOG_LEVEL); + +struct nordic_vpr_launcher_config { + NRF_VPR_Type *vpr; + uintptr_t exec_addr; +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory) + uintptr_t src_addr; + size_t src_size; +#endif +}; + +static int nordic_vpr_launcher_init(const struct device *dev) +{ + const struct nordic_vpr_launcher_config *config = dev->config; + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory) + if (config->src_size > 0U) { + LOG_DBG("Loading VPR (%p) from %p to %p (%zu bytes)", config->vpr, + (void *)config->src_addr, (void *)config->exec_addr, config->src_size); + memcpy((void *)config->exec_addr, (void *)config->src_addr, config->src_size); + } +#endif + + LOG_DBG("Launching VPR (%p) from %p", config->vpr, (void *)config->exec_addr); + nrf_vpr_initpc_set(config->vpr, config->exec_addr); + nrf_vpr_cpurun_set(config->vpr, true); + + return 0; +} + +/* obtain VPR source address either from memory or partition */ +#define VPR_SRC_ADDR(node_id) \ + (DT_REG_ADDR(node_id) + \ + COND_CODE_0(DT_FIXED_PARTITION_EXISTS(node_id), (0), (DT_REG_ADDR(DT_GPARENT(node_id))))) + +#define NORDIC_VPR_LAUNCHER_DEFINE(inst) \ + COND_CODE_1(DT_NODE_HAS_PROP(inst, source_memory), \ + (BUILD_ASSERT((DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)) == \ + DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory))), \ + "Source/execution memory sizes mismatch");), \ + ()) \ + \ + static const struct nordic_vpr_launcher_config config##inst = { \ + .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ + .exec_addr = DT_REG_ADDR(DT_INST_PHANDLE(inst, execution_memory)), \ + COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, source_memory), \ + (.src_addr = VPR_SRC_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ + .src_size = DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory)),), \ + ())}; \ + \ + DEVICE_DT_INST_DEFINE(inst, nordic_vpr_launcher_init, NULL, NULL, &config##inst, \ + POST_KERNEL, CONFIG_NORDIC_VPR_LAUNCHER_INIT_PRIORITY, NULL); + +DT_INST_FOREACH_STATUS_OKAY(NORDIC_VPR_LAUNCHER_DEFINE) From 075318b3cb8ddbb0cbcc8f0fe31099bdb5e04164 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 1 Feb 2024 15:14:53 +0100 Subject: [PATCH 0342/2300] [nrf fromtree] snippets: add nordic-ppr Add a new snippet that allows to build any application with the capability to boot the PPR core found in some nRF54 SoCs. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 245da8aae65b2abdaa2654c63dc22994de64ee08) (cherry picked from commit 38c3336cc7bd672d03e5265f1aa068694edd51d7) --- snippets/nordic-ppr/README.rst | 10 ++++++++++ .../boards/nrf54h20pdk_nrf54h20_cpuapp.overlay | 12 ++++++++++++ snippets/nordic-ppr/nordic-ppr.overlay | 8 ++++++++ snippets/nordic-ppr/snippet.yml | 8 ++++++++ 4 files changed, 38 insertions(+) create mode 100644 snippets/nordic-ppr/README.rst create mode 100644 snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay create mode 100644 snippets/nordic-ppr/nordic-ppr.overlay create mode 100644 snippets/nordic-ppr/snippet.yml diff --git a/snippets/nordic-ppr/README.rst b/snippets/nordic-ppr/README.rst new file mode 100644 index 00000000000..36eb74d193f --- /dev/null +++ b/snippets/nordic-ppr/README.rst @@ -0,0 +1,10 @@ +.. _nordic-ppr: + +Nordic PPR snippet (nordic-ppr) +############################### + +Overview +******** + +This snippet allows users to build Zephyr with the capability to boot Nordic PPR +(Peripheral Processor) from another core. diff --git a/snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..75128f42a13 --- /dev/null +++ b/snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuppr_ram3x_region { + status = "okay"; +}; + +&uart135 { + status = "reserved"; +}; diff --git a/snippets/nordic-ppr/nordic-ppr.overlay b/snippets/nordic-ppr/nordic-ppr.overlay new file mode 100644 index 00000000000..e33885fc10d --- /dev/null +++ b/snippets/nordic-ppr/nordic-ppr.overlay @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuppr_vpr { + status = "okay"; +}; diff --git a/snippets/nordic-ppr/snippet.yml b/snippets/nordic-ppr/snippet.yml new file mode 100644 index 00000000000..9e1f20bb757 --- /dev/null +++ b/snippets/nordic-ppr/snippet.yml @@ -0,0 +1,8 @@ +name: nordic-ppr +append: + EXTRA_DTC_OVERLAY_FILE: nordic-ppr.overlay + +boards: + nrf54h20pdk_nrf54h20_cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20pdk_nrf54h20_cpuapp.overlay From 7240cdfea4bca4bdeb85b1036e1972f036d2d8db Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 31 Jan 2024 20:16:21 +0100 Subject: [PATCH 0343/2300] [nrf fromtree] drivers: serial: nrfx_uarte2: drop soc.h As it is not required (e.g. RISC-V nRF54H port does not provide soc.h) Signed-off-by: Gerard Marull-Paretas (cherry picked from commit d230542f1d0e94f10cf817f6b4c9a99b49927259) (cherry picked from commit 902f8bde1cbeaffcb5b1bed68a12bfcbf8ff0ce2) --- drivers/serial/uart_nrfx_uarte2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index c27f33c7284..bfc770f1399 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include From bf40cc299b5133b6d259fa72f6a460bc5550e5d8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 31 Jan 2024 20:15:20 +0100 Subject: [PATCH 0344/2300] [nrf fromtree] modules: hal_nordic: add configuration for nRF54H PPR core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nrfx configuration file to make the nrfx HAL work for nRF54H PPR core. Signed-off-by: Gerard Marull-Paretas Signed-off-by: Andrzej Głąbek (cherry picked from commit 270ae630368781b58701f76ee1559391d83f1d39) (cherry picked from commit 6733ed1418125be94189844c2dcddb1b0a894bf1) --- modules/hal_nordic/nrfx/nrfx_config.h | 2 + .../nrfx/nrfx_config_nrf54h20_enga_ppr.h | 1855 +++++++++++++++++ modules/hal_nordic/nrfx/nrfx_glue.h | 23 +- 3 files changed, 1877 insertions(+), 3 deletions(-) create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index be2f5599f78..26d662be39d 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -748,6 +748,8 @@ #include #elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_RADIOCORE) #include +#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_PPR) + #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) #include #elif defined(NRF54L15_ENGA_XXAA) && defined(NRF_APPLICATION) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h new file mode 100644 index 00000000000..369fe18a81f --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h @@ -0,0 +1,1855 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54H20_ENGA_PPR_H__ +#define NRFX_CONFIG_NRF54H20_ENGA_PPR_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 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_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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 +#endif + +/** + * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e +#endif + +/** + * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 +#endif + +/** + * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 +#endif + +/** + * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 +#endif + +/** + * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 +#endif + +/** + * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df +#endif + +/** + * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf +#endif + +/** + * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e +#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 1 +#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_GPIOTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE130_ENABLED +#define NRFX_GPIOTE130_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_NUM_OF_CC_CHANNELS + * + * Integer value. + */ +#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 2 +#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 0x000000c0 +#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_I2S130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S130_ENABLED +#define NRFX_I2S130_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S131_ENABLED +#define NRFX_I2S131_ENABLED 0 +#endif + +/** + * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#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_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_PRS_BOX_6_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_6_ENABLED +#define NRFX_PRS_BOX_6_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_7_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_7_ENABLED +#define NRFX_PRS_BOX_7_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_8_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_8_ENABLED +#define NRFX_PRS_BOX_8_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_9_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_9_ENABLED +#define NRFX_PRS_BOX_9_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_PWM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM120_ENABLED +#define NRFX_PWM120_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM130_ENABLED +#define NRFX_PWM130_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM131_ENABLED +#define NRFX_PWM131_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM132_ENABLED +#define NRFX_PWM132_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM133_ENABLED +#define NRFX_PWM133_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_QDEC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC130_ENABLED +#define NRFX_QDEC130_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC131_ENABLED +#define NRFX_QDEC131_ENABLED 0 +#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_RTC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC130_ENABLED +#define NRFX_RTC130_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC131_ENABLED +#define NRFX_RTC131_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_SPIM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM120_ENABLED +#define NRFX_SPIM120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM121_ENABLED +#define NRFX_SPIM121_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM130_ENABLED +#define NRFX_SPIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM131_ENABLED +#define NRFX_SPIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM132_ENABLED +#define NRFX_SPIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM133_ENABLED +#define NRFX_SPIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM134_ENABLED +#define NRFX_SPIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM135_ENABLED +#define NRFX_SPIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM136_ENABLED +#define NRFX_SPIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM137_ENABLED +#define NRFX_SPIM137_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_SPIS120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS120_ENABLED +#define NRFX_SPIS120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS130_ENABLED +#define NRFX_SPIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS131_ENABLED +#define NRFX_SPIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS132_ENABLED +#define NRFX_SPIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS133_ENABLED +#define NRFX_SPIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS134_ENABLED +#define NRFX_SPIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS135_ENABLED +#define NRFX_SPIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS136_ENABLED +#define NRFX_SPIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS137_ENABLED +#define NRFX_SPIS137_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_TIMER120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER120_ENABLED +#define NRFX_TIMER120_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER121_ENABLED +#define NRFX_TIMER121_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER130_ENABLED +#define NRFX_TIMER130_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER131_ENABLED +#define NRFX_TIMER131_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER132_ENABLED +#define NRFX_TIMER132_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER133_ENABLED +#define NRFX_TIMER133_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER134_ENABLED +#define NRFX_TIMER134_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER135_ENABLED +#define NRFX_TIMER135_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER136_ENABLED +#define NRFX_TIMER136_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER137_ENABLED +#define NRFX_TIMER137_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_TWIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM130_ENABLED +#define NRFX_TWIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM131_ENABLED +#define NRFX_TWIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM132_ENABLED +#define NRFX_TWIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM133_ENABLED +#define NRFX_TWIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM134_ENABLED +#define NRFX_TWIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM135_ENABLED +#define NRFX_TWIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM136_ENABLED +#define NRFX_TWIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM137_ENABLED +#define NRFX_TWIM137_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_TWIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS130_ENABLED +#define NRFX_TWIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS131_ENABLED +#define NRFX_TWIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS132_ENABLED +#define NRFX_TWIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS133_ENABLED +#define NRFX_TWIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS134_ENABLED +#define NRFX_TWIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS135_ENABLED +#define NRFX_TWIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS136_ENABLED +#define NRFX_TWIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS137_ENABLED +#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE120_ENABLED +#define NRFX_UARTE120_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE130_ENABLED +#define NRFX_UARTE130_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE131_ENABLED +#define NRFX_UARTE131_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE132_ENABLED +#define NRFX_UARTE132_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE133_ENABLED +#define NRFX_UARTE133_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE134_ENABLED +#define NRFX_UARTE134_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE135_ENABLED +#define NRFX_UARTE135_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE136_ENABLED +#define NRFX_UARTE136_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE137_ENABLED +#define NRFX_UARTE137_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_WDT131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT131_ENABLED +#define NRFX_WDT131_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT132_ENABLED +#define NRFX_WDT132_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54H20_ENGA_PPR_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_glue.h b/modules/hal_nordic/nrfx/nrfx_glue.h index 851cb8a9614..0edda440112 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.h +++ b/modules/hal_nordic/nrfx/nrfx_glue.h @@ -42,6 +42,11 @@ extern "C" { #define NRFX_ASSERT(expression) __ASSERT_NO_MSG(expression) #endif +#if defined(CONFIG_RISCV) +/* included here due to dependency on NRFX_ASSERT definition */ +#include +#endif + /** * @brief Macro for placing a compile time assertion. * @@ -91,14 +96,22 @@ extern "C" { * * @param irq_number IRQ number. */ -#define NRFX_IRQ_PENDING_SET(irq_number) NVIC_SetPendingIRQ(irq_number) +#if defined(CONFIG_RISCV) +#define NRFX_IRQ_PENDING_SET(irq_number) nrf_vpr_clic_int_pending_set(NRF_VPRCLIC, irq_number) +#else +#define NRFX_IRQ_PENDING_SET(irq_number) NVIC_SetPendingIRQ(irq_number) +#endif /** * @brief Macro for clearing the pending status of a specific IRQ. * * @param irq_number IRQ number. */ -#define NRFX_IRQ_PENDING_CLEAR(irq_number) NVIC_ClearPendingIRQ(irq_number) +#if defined(CONFIG_RISCV) +#define NRFX_IRQ_PENDING_CLEAR(irq_number) nrf_vpr_clic_int_pending_clear(NRF_VPRCLIC, irq_number) +#else +#define NRFX_IRQ_PENDING_CLEAR(irq_number) NVIC_ClearPendingIRQ(irq_number) +#endif /** * @brief Macro for checking the pending status of a specific IRQ. @@ -106,7 +119,11 @@ extern "C" { * @retval true If the IRQ is pending. * @retval false Otherwise. */ -#define NRFX_IRQ_IS_PENDING(irq_number) (NVIC_GetPendingIRQ(irq_number) == 1) +#if defined(CONFIG_RISCV) +#define NRFX_IRQ_IS_PENDING(irq_number) nrf_vpr_clic_int_pending_check(NRF_VPRCLIC, irq_number) +#else +#define NRFX_IRQ_IS_PENDING(irq_number) (NVIC_GetPendingIRQ(irq_number) == 1) +#endif /** @brief Macro for entering into a critical section. */ #define NRFX_CRITICAL_SECTION_ENTER() { unsigned int irq_lock_key = irq_lock(); From a6dabe9cd93f37002e2b147a57df0f0c608dd4c8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 1 Feb 2024 10:25:18 +0100 Subject: [PATCH 0345/2300] [nrf fromtree] scripts: kconfig: functions: add dt_chosen_partition_addr_int|hex dt_chosen_partition_addr_int|hex allow obtaining the absolute address of a partition, which is the result of the grandparent node address plus the partition node address. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 018cf08d8dbcfb3d2da2d2f26e067e3a8e92ba0e) (cherry picked from commit 784a08fadedbbaf3600ba87dac79e1ef205638f0) --- scripts/kconfig/kconfigfunctions.py | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py index 621ec3cb3a8..754a312ebb7 100644 --- a/scripts/kconfig/kconfigfunctions.py +++ b/scripts/kconfig/kconfigfunctions.py @@ -309,6 +309,48 @@ def dt_chosen_reg(kconf, name, chosen, index=0, unit=None): return hex(_dt_chosen_reg_addr(kconf, chosen, index, unit)) +def _dt_chosen_partition_addr(kconf, chosen, index=0, unit=None): + """ + This function takes a 'chosen' property and treats that property as a path + to an EDT node. If it finds an EDT node, it will look to see if that + node has a register, and if that node has a grandparent that has a register + at the given 'index'. The addition of both addresses will be returned, if + not, we return 0. + + The function will divide the value based on 'unit': + None No division + 'k' or 'K' divide by 1024 (1 << 10) + 'm' or 'M' divide by 1,048,576 (1 << 20) + 'g' or 'G' divide by 1,073,741,824 (1 << 30) + 'kb' or 'Kb' divide by 8192 (1 << 13) + 'mb' or 'Mb' divide by 8,388,608 (1 << 23) + 'gb' or 'Gb' divide by 8,589,934,592 (1 << 33) + """ + if doc_mode or edt is None: + return 0 + + node = edt.chosen_node(chosen) + if not node: + return 0 + + p_node = node.parent + if not p_node: + return 0 + + return _node_reg_addr(p_node.parent, index, unit) + _node_reg_addr(node, 0, unit) + + +def dt_chosen_partition_addr(kconf, name, chosen, index=0, unit=None): + """ + This function just routes to the proper function and converts + the result to either a string int or string hex value. + """ + if name == "dt_chosen_partition_addr_int": + return str(_dt_chosen_partition_addr(kconf, chosen, index, unit)) + if name == "dt_chosen_partition_addr_hex": + return hex(_dt_chosen_partition_addr(kconf, chosen, index, unit)) + + def _dt_node_reg_addr(kconf, path, index=0, unit=None): """ This function takes a 'path' and looks for an EDT node at that path. If it @@ -806,5 +848,7 @@ def shields_list_contains(kconf, _, shield): "dt_node_parent": (dt_node_parent, 1, 1), "dt_nodelabel_array_prop_has_val": (dt_nodelabel_array_prop_has_val, 3, 3), "dt_gpio_hogs_enabled": (dt_gpio_hogs_enabled, 0, 0), + "dt_chosen_partition_addr_int": (dt_chosen_partition_addr, 1, 3), + "dt_chosen_partition_addr_hex": (dt_chosen_partition_addr, 1, 3), "shields_list_contains": (shields_list_contains, 1, 1), } From be2aca2863cf038f0669d5c790ba085e958795f9 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 1 Feb 2024 10:40:53 +0100 Subject: [PATCH 0346/2300] [nrf fromtree] soc: common: nordic_nrf: move pinctrl_soc.h to a common dir Because both, RISC-V and ARM cores share the same pinctrl driver. The top level common folder will disappear with the introduction of HWMv2, where multi-arch SoCs will be well supported. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit d7dc942382a2c05539c14f8df32d5756fd88a9a2) (cherry picked from commit 4b9cb331f97c42d3f08043f4d6b70456e18b0e77) --- boards/posix/nrf_bsim/soc/pinctrl_soc.h | 2 +- soc/CMakeLists.txt | 2 ++ soc/common/CMakeLists.txt | 4 ++++ soc/common/nordic_nrf/CMakeLists.txt | 4 ++++ .../nordic_nrf/common => common/nordic_nrf}/pinctrl_soc.h | 0 5 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 soc/common/CMakeLists.txt create mode 100644 soc/common/nordic_nrf/CMakeLists.txt rename soc/{arm/nordic_nrf/common => common/nordic_nrf}/pinctrl_soc.h (100%) diff --git a/boards/posix/nrf_bsim/soc/pinctrl_soc.h b/boards/posix/nrf_bsim/soc/pinctrl_soc.h index 08252b57fee..f0be0443d5b 100644 --- a/boards/posix/nrf_bsim/soc/pinctrl_soc.h +++ b/boards/posix/nrf_bsim/soc/pinctrl_soc.h @@ -8,6 +8,6 @@ #define BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H /* We reuse the real SOC's header: */ -#include "../soc/arm/nordic_nrf/common/pinctrl_soc.h" +#include "../soc/common/nordic_nrf/pinctrl_soc.h" #endif /* BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H */ diff --git a/soc/CMakeLists.txt b/soc/CMakeLists.txt index 6706168281e..d55bd63f496 100644 --- a/soc/CMakeLists.txt +++ b/soc/CMakeLists.txt @@ -9,6 +9,8 @@ if(_SOC_IS_IN_TREE) endif() unset(_SOC_IS_IN_TREE) +add_subdirectory(common) + if(EXISTS ${SOC_DIR}/${ARCH}/CMakeLists.txt) add_subdirectory(${SOC_DIR}/${ARCH} soc/${ARCH}) else() diff --git a/soc/common/CMakeLists.txt b/soc/common/CMakeLists.txt new file mode 100644 index 00000000000..d9abad218cd --- /dev/null +++ b/soc/common/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_NRF nordic_nrf) diff --git a/soc/common/nordic_nrf/CMakeLists.txt b/soc/common/nordic_nrf/CMakeLists.txt new file mode 100644 index 00000000000..6f397a07fab --- /dev/null +++ b/soc/common/nordic_nrf/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +zephyr_include_directories(.) diff --git a/soc/arm/nordic_nrf/common/pinctrl_soc.h b/soc/common/nordic_nrf/pinctrl_soc.h similarity index 100% rename from soc/arm/nordic_nrf/common/pinctrl_soc.h rename to soc/common/nordic_nrf/pinctrl_soc.h From 7f033c323335c24f582ae93abafe156b43d1e223 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 1 Feb 2024 10:44:47 +0100 Subject: [PATCH 0347/2300] [nrf fromtree] soc: arm: nordic_nrf: move Kconfig.peripherals to common folder Because RISC-V cores also need to include this file, so it is no longer ARM specific. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 1a6b88608e10b6f2dde0c99077d32a63f9337a0b) (cherry picked from commit dcba645f74cfd3e8e5df00f964151df9a7133089) --- boards/posix/nrf_bsim/Kconfig | 2 +- soc/arm/nordic_nrf/Kconfig | 2 +- soc/{arm => common}/nordic_nrf/Kconfig.peripherals | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename soc/{arm => common}/nordic_nrf/Kconfig.peripherals (100%) diff --git a/boards/posix/nrf_bsim/Kconfig b/boards/posix/nrf_bsim/Kconfig index 7d67c44d284..d85b497f671 100644 --- a/boards/posix/nrf_bsim/Kconfig +++ b/boards/posix/nrf_bsim/Kconfig @@ -6,7 +6,7 @@ if SOC_SERIES_BSIM_NRFXX # used by Nordic SoCs, so to make the symbols defined in this file available for # the simulated nrf5x_bsim boards, which use the POSIX architecture, the file # must be read also from here. -source "soc/arm/nordic_nrf/Kconfig.peripherals" +source "soc/common/nordic_nrf/Kconfig.peripherals" endif # SOC_SERIES_BSIM_NRFXX diff --git a/soc/arm/nordic_nrf/Kconfig b/soc/arm/nordic_nrf/Kconfig index 69d83ae5e9b..ba0c9d4b164 100644 --- a/soc/arm/nordic_nrf/Kconfig +++ b/soc/arm/nordic_nrf/Kconfig @@ -13,7 +13,7 @@ config SOC_FAMILY string default "nordic_nrf" -source "soc/arm/nordic_nrf/Kconfig.peripherals" +source "soc/common/nordic_nrf/Kconfig.peripherals" source "soc/arm/nordic_nrf/*/Kconfig.soc" config NRF_SOC_SECURE_SUPPORTED diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals similarity index 100% rename from soc/arm/nordic_nrf/Kconfig.peripherals rename to soc/common/nordic_nrf/Kconfig.peripherals From d44f8b501ab80a0d45df8c05cf30cde3155929c5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 31 Jan 2024 19:46:00 +0100 Subject: [PATCH 0348/2300] [nrf fromtree] soc: riscv: nordic_nrf: add initial support for VPR core Add initial support for the VPR RISC-V core found in the new nRF54 SoCs. Signed-off-by: Carlo Caione Signed-off-by: Gerard Marull-Paretas (cherry picked from commit ba16e3dd13e5d16d038c816defebad62ef8249a1) (cherry picked from commit 6b31b5aa424d763051d7a47b69702f10a437542d) --- soc/riscv/nordic_nrf/CMakeLists.txt | 4 + soc/riscv/nordic_nrf/Kconfig | 15 +++ soc/riscv/nordic_nrf/Kconfig.defconfig | 8 ++ soc/riscv/nordic_nrf/common/CMakeLists.txt | 4 + soc/riscv/nordic_nrf/common/Kconfig | 4 + soc/riscv/nordic_nrf/common/Kconfig.defconfig | 8 ++ .../nordic_nrf/common/vpr/CMakeLists.txt | 9 ++ soc/riscv/nordic_nrf/common/vpr/Kconfig | 18 +++ .../nordic_nrf/common/vpr/Kconfig.defconfig | 27 ++++ soc/riscv/nordic_nrf/common/vpr/soc_context.h | 12 ++ soc/riscv/nordic_nrf/common/vpr/soc_irq.S | 30 +++++ soc/riscv/nordic_nrf/common/vpr/soc_irq.c | 26 ++++ .../nordic_nrf/common/vpr/soc_isr_stacking.h | 118 ++++++++++++++++++ soc/riscv/nordic_nrf/common/vpr/soc_offsets.h | 11 ++ soc/riscv/nordic_nrf/common/vpr/vector.S | 28 +++++ 15 files changed, 322 insertions(+) create mode 100644 soc/riscv/nordic_nrf/CMakeLists.txt create mode 100644 soc/riscv/nordic_nrf/Kconfig create mode 100644 soc/riscv/nordic_nrf/Kconfig.defconfig create mode 100644 soc/riscv/nordic_nrf/common/CMakeLists.txt create mode 100644 soc/riscv/nordic_nrf/common/Kconfig create mode 100644 soc/riscv/nordic_nrf/common/Kconfig.defconfig create mode 100644 soc/riscv/nordic_nrf/common/vpr/CMakeLists.txt create mode 100644 soc/riscv/nordic_nrf/common/vpr/Kconfig create mode 100644 soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig create mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_context.h create mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_irq.S create mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_irq.c create mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_isr_stacking.h create mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_offsets.h create mode 100644 soc/riscv/nordic_nrf/common/vpr/vector.S diff --git a/soc/riscv/nordic_nrf/CMakeLists.txt b/soc/riscv/nordic_nrf/CMakeLists.txt new file mode 100644 index 00000000000..91bd222e147 --- /dev/null +++ b/soc/riscv/nordic_nrf/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory(common) diff --git a/soc/riscv/nordic_nrf/Kconfig b/soc/riscv/nordic_nrf/Kconfig new file mode 100644 index 00000000000..3f17bea1756 --- /dev/null +++ b/soc/riscv/nordic_nrf/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_NRF + bool + +if SOC_FAMILY_NRF + +config SOC_FAMILY + string + default "nordic_nrf" + +source "soc/riscv/nordic_nrf/common/Kconfig" + +endif # SOC_FAMILY_NRF diff --git a/soc/riscv/nordic_nrf/Kconfig.defconfig b/soc/riscv/nordic_nrf/Kconfig.defconfig new file mode 100644 index 00000000000..a6d85ac846a --- /dev/null +++ b/soc/riscv/nordic_nrf/Kconfig.defconfig @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_FAMILY_NRF + +source "soc/riscv/nordic_nrf/common/Kconfig.defconfig" + +endif # SOC_FAMILY_NRF diff --git a/soc/riscv/nordic_nrf/common/CMakeLists.txt b/soc/riscv/nordic_nrf/common/CMakeLists.txt new file mode 100644 index 00000000000..806a295ea22 --- /dev/null +++ b/soc/riscv/nordic_nrf/common/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +add_subdirectory_ifdef(CONFIG_RISCV_CORE_NORDIC_VPR vpr) diff --git a/soc/riscv/nordic_nrf/common/Kconfig b/soc/riscv/nordic_nrf/common/Kconfig new file mode 100644 index 00000000000..610689ecc6d --- /dev/null +++ b/soc/riscv/nordic_nrf/common/Kconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/nordic_nrf/common/vpr/Kconfig" diff --git a/soc/riscv/nordic_nrf/common/Kconfig.defconfig b/soc/riscv/nordic_nrf/common/Kconfig.defconfig new file mode 100644 index 00000000000..9beb943edb8 --- /dev/null +++ b/soc/riscv/nordic_nrf/common/Kconfig.defconfig @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if RISCV_CORE_NORDIC_VPR + +source "soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig" + +endif # RISCV_CORE_NORDIC_VPR diff --git a/soc/riscv/nordic_nrf/common/vpr/CMakeLists.txt b/soc/riscv/nordic_nrf/common/vpr/CMakeLists.txt new file mode 100644 index 00000000000..e0331bb8e0b --- /dev/null +++ b/soc/riscv/nordic_nrf/common/vpr/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +zephyr_include_directories(.) + +zephyr_library() +zephyr_library_sources(soc_irq.S soc_irq.c vector.S) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig new file mode 100644 index 00000000000..40a7d199c0c --- /dev/null +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig @@ -0,0 +1,18 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config RISCV_CORE_NORDIC_VPR + bool "RISC-V Nordic VPR core" + default y + depends on DT_HAS_NORDIC_VPR_ENABLED + depends on RISCV + select ATOMIC_OPERATIONS_C + select RISCV_ISA_RV32E + select RISCV_ISA_EXT_M + select RISCV_ISA_EXT_C + select RISCV_ISA_EXT_ZICSR + select RISCV_ISA_EXT_ZIFENCEI + select RISCV_SOC_HAS_ISR_STACKING + select RISCV_SOC_CONTEXT_SAVE + help + Enable support for the RISC-V Nordic VPR core. diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig new file mode 100644 index 00000000000..f0014455b3a --- /dev/null +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig @@ -0,0 +1,27 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CPU_PATH := $(dt_nodelabel_path,cpu) +CPU_ID := $(dt_node_reg_addr_int,$(CPU_PATH)) + +config RV_BOOT_HART + default $(CPU_ID) + +config RISCV_MCAUSE_EXCEPTION_MASK + default 0xFFF + +config RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET + default 16 + +config GEN_IRQ_VECTOR_TABLE + default y + +choice IRQ_VECTOR_TABLE_TYPE + default IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS +endchoice + +config ARCH_SW_ISR_TABLE_ALIGN + default 64 + +config RISCV_ALWAYS_SWITCH_THROUGH_ECALL + default y if MULTITHREADING diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_context.h b/soc/riscv/nordic_nrf/common/vpr/soc_context.h new file mode 100644 index 00000000000..8cd0d1e5094 --- /dev/null +++ b/soc/riscv/nordic_nrf/common/vpr/soc_context.h @@ -0,0 +1,12 @@ +/* + * Copyright (C) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ +#define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ + +#define SOC_ESF_MEMBERS unsigned long minttresh +#define SOC_ESF_INIT 0 + +#endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ */ diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_irq.S b/soc/riscv/nordic_nrf/common/vpr/soc_irq.S new file mode 100644 index 00000000000..0e9db48d9b4 --- /dev/null +++ b/soc/riscv/nordic_nrf/common/vpr/soc_irq.S @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/* Exports */ +GTEXT(__soc_handle_irq) +GTEXT(__soc_save_context) +GTEXT(__soc_restore_context) + +/* + * No need to clear anything, pending bit is cleared by HW. + */ +SECTION_FUNC(exception.other, __soc_handle_irq) + ret + +SECTION_FUNC(exception.other, __soc_save_context) + csrr t0, 0x347 + sw t0, __soc_esf_t_minttresh_OFFSET(a0) + + ret + +SECTION_FUNC(exception.other, __soc_restore_context) + lw t0, __soc_esf_t_minttresh_OFFSET(a0) + csrw 0x347, t0 + + ret diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_irq.c b/soc/riscv/nordic_nrf/common/vpr/soc_irq.c new file mode 100644 index 00000000000..88655f6efa0 --- /dev/null +++ b/soc/riscv/nordic_nrf/common/vpr/soc_irq.c @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +void arch_irq_enable(unsigned int irq) +{ + nrf_vpr_clic_int_enable_set(NRF_VPRCLIC, irq, true); +} + +void arch_irq_disable(unsigned int irq) +{ + nrf_vpr_clic_int_enable_set(NRF_VPRCLIC, irq, false); +} + +void arch_irq_priority_set(unsigned int irq, unsigned int prio) +{ + nrf_vpr_clic_int_priority_set(NRF_VPRCLIC, irq, prio); +} + +int arch_irq_is_enabled(unsigned int irq) +{ + return nrf_vpr_clic_int_enable_check(NRF_VPRCLIC, irq); +} diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_isr_stacking.h b/soc/riscv/nordic_nrf/common/vpr/soc_isr_stacking.h new file mode 100644 index 00000000000..d5b139111d0 --- /dev/null +++ b/soc/riscv/nordic_nrf/common/vpr/soc_isr_stacking.h @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_ISR_STACKING_H_ +#define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_ISR_STACKING_H_ + +#include + +#if !defined(_ASMLANGUAGE) + +#include + +#define VPR_CPU DT_INST(0, nordic_vpr) + +#if DT_PROP(VPR_CPU, nordic_bus_width) == 64 + +#define SOC_ISR_STACKING_ESF_DECLARE \ + struct __esf { \ + unsigned long s0; \ + unsigned long mstatus; \ + unsigned long tp; \ + struct soc_esf soc_context; \ + \ + unsigned long t2; \ + unsigned long ra; \ + unsigned long t0; \ + unsigned long t1; \ + unsigned long a4; \ + unsigned long a5; \ + unsigned long a2; \ + unsigned long a3; \ + unsigned long a0; \ + unsigned long a1; \ + unsigned long mepc; \ + unsigned long _mcause; \ + } __aligned(16); + +#else /* DT_PROP(VPR_CPU, nordic_bus_width) == 32 */ + +#define SOC_ISR_STACKING_ESF_DECLARE \ + struct __esf { \ + unsigned long s0; \ + unsigned long mstatus; \ + unsigned long tp; \ + struct soc_esf soc_context; \ + \ + unsigned long ra; \ + unsigned long t2; \ + unsigned long t1; \ + unsigned long t0; \ + unsigned long a5; \ + unsigned long a4; \ + unsigned long a3; \ + unsigned long a2; \ + unsigned long a1; \ + unsigned long a0; \ + unsigned long mepc; \ + unsigned long _mcause; \ + } __aligned(16); + +#endif /* DT_PROP(VPR_CPU, nordic_bus_width) == 64 */ + +#else /* _ASMLANGUAGE */ + +/* + * Size of the HW managed part of the ESF: + * sizeof(_mcause) + sizeof(_mepc) + */ +#define ESF_HW_SIZEOF (0x8) + +/* + * Size of the SW managed part of the ESF in case of exception + */ +#define ESF_SW_EXC_SIZEOF (__z_arch_esf_t_SIZEOF - ESF_HW_SIZEOF) + +/* + * Size of the SW managed part of the ESF in case of interrupt + * sizeof(__padding) + ... + sizeof(soc_context) + */ +#define ESF_SW_IRQ_SIZEOF (0x10) + +#define SOC_ISR_SW_STACKING \ + csrw mscratch, t0; \ + \ + csrr t0, mcause; \ + srli t0, t0, RISCV_MCAUSE_IRQ_POS; \ + bnez t0, stacking_is_interrupt; \ + \ + csrrw t0, mscratch, zero; \ + \ + addi sp, sp, -ESF_SW_EXC_SIZEOF; \ + DO_CALLER_SAVED(sr); \ + j stacking_keep_going; \ + \ +stacking_is_interrupt: \ + addi sp, sp, -ESF_SW_IRQ_SIZEOF; \ + \ +stacking_keep_going: + +#define SOC_ISR_SW_UNSTACKING \ + csrr t0, mcause; \ + srli t0, t0, RISCV_MCAUSE_IRQ_POS; \ + bnez t0, unstacking_is_interrupt; \ + \ + DO_CALLER_SAVED(lr); \ + addi sp, sp, ESF_SW_EXC_SIZEOF; \ + j unstacking_keep_going; \ + \ +unstacking_is_interrupt: \ + addi sp, sp, ESF_SW_IRQ_SIZEOF; \ + \ +unstacking_keep_going: + +#endif /* _ASMLANGUAGE */ + +#endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_ISR_STACKING_H_ */ diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_offsets.h b/soc/riscv/nordic_nrf/common/vpr/soc_offsets.h new file mode 100644 index 00000000000..92d91044e1a --- /dev/null +++ b/soc/riscv/nordic_nrf/common/vpr/soc_offsets.h @@ -0,0 +1,11 @@ +/* + * Copyright (C) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ +#define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ + +#define GEN_SOC_OFFSET_SYMS() GEN_OFFSET_SYM(soc_esf_t, minttresh) + +#endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ */ diff --git a/soc/riscv/nordic_nrf/common/vpr/vector.S b/soc/riscv/nordic_nrf/common/vpr/vector.S new file mode 100644 index 00000000000..b8c6d97170c --- /dev/null +++ b/soc/riscv/nordic_nrf/common/vpr/vector.S @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/* Imports */ +GTEXT(__initialize) + +/* Exports */ +GTEXT(__start) + +SECTION_FUNC(vectors, __start) + /* Set mtvec.base (mtvec.mode is RO, no need to mask it). */ + la t0, _isr_wrapper + csrw mtvec, t0 + + /* Set mtvt. */ + la t0, _irq_vector_table + csrw 0x307, t0 + + /* Enable mstatus.mie */ + li t0, 0x1888 + csrw mstatus, t0 + + /* Call into Zephyr initialization. */ + tail __initialize From 89295660dfe2cdfe636b9bf3329a4dac4853f2ac Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 1 Feb 2024 10:36:27 +0100 Subject: [PATCH 0349/2300] [nrf fromtree] soc: riscv: nordic_nrf: nrf54h: introduce PPR support Add support for the nRF54H PPR (Peripheral Processor), based on the VPR RISC-V core. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 426bbf5649a93aba5d42bf1087178b992e5e3409) (cherry picked from commit b60fd105ee36ab8b91e860d61eaae1a29ca81386) --- modules/hal_nordic/nrfx/CMakeLists.txt | 3 +++ soc/riscv/nordic_nrf/CMakeLists.txt | 1 + soc/riscv/nordic_nrf/Kconfig | 3 +++ soc/riscv/nordic_nrf/Kconfig.defconfig | 8 ++++++++ soc/riscv/nordic_nrf/Kconfig.soc | 4 ++++ soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt | 6 ++++++ .../Kconfig.defconfig.nrf54h20_enga_cpuppr | 15 +++++++++++++++ .../nrf54h/Kconfig.defconfig.series | 19 +++++++++++++++++++ soc/riscv/nordic_nrf/nrf54h/Kconfig.series | 10 ++++++++++ soc/riscv/nordic_nrf/nrf54h/Kconfig.soc | 19 +++++++++++++++++++ soc/riscv/nordic_nrf/nrf54h/align.ld | 10 ++++++++++ 11 files changed, 98 insertions(+) create mode 100644 soc/riscv/nordic_nrf/Kconfig.soc create mode 100644 soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt create mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr create mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.series create mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.series create mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.soc create mode 100644 soc/riscv/nordic_nrf/nrf54h/align.ld diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index cd8392e118f..ffd2e9aebc1 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -40,6 +40,8 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP NRF54H20_ENGA_X NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD NRF54H20_ENGA_XXAA NRF_RADIOCORE) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR NRF54H20_ENGA_XXAA + NRF_PPR) zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_LOCK ENABLE_APPROTECT) @@ -173,6 +175,7 @@ mdk_svd_ifdef(CONFIG_SOC_NRF52840 nrf52840.svd) mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUAPP nrf5340_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUNET nrf5340_network.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP nrf54h20_enga_application.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR nrf54h20_enga_ppr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD nrf54h20_enga_radiocore.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9120 nrf9120.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9160 nrf9160.svd) diff --git a/soc/riscv/nordic_nrf/CMakeLists.txt b/soc/riscv/nordic_nrf/CMakeLists.txt index 91bd222e147..6a5b10545ff 100644 --- a/soc/riscv/nordic_nrf/CMakeLists.txt +++ b/soc/riscv/nordic_nrf/CMakeLists.txt @@ -2,3 +2,4 @@ # SPDX-License-Identifier: Apache-2.0 add_subdirectory(common) +add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/nordic_nrf/Kconfig b/soc/riscv/nordic_nrf/Kconfig index 3f17bea1756..a39db4671d5 100644 --- a/soc/riscv/nordic_nrf/Kconfig +++ b/soc/riscv/nordic_nrf/Kconfig @@ -12,4 +12,7 @@ config SOC_FAMILY source "soc/riscv/nordic_nrf/common/Kconfig" +source "soc/common/nordic_nrf/Kconfig.peripherals" +source "soc/riscv/nordic_nrf/*/Kconfig.soc" + endif # SOC_FAMILY_NRF diff --git a/soc/riscv/nordic_nrf/Kconfig.defconfig b/soc/riscv/nordic_nrf/Kconfig.defconfig index a6d85ac846a..cc3ec954985 100644 --- a/soc/riscv/nordic_nrf/Kconfig.defconfig +++ b/soc/riscv/nordic_nrf/Kconfig.defconfig @@ -3,6 +3,14 @@ if SOC_FAMILY_NRF +source "soc/riscv/nordic_nrf/*/Kconfig.defconfig.series" source "soc/riscv/nordic_nrf/common/Kconfig.defconfig" +config BUILD_OUTPUT_HEX + default y + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default 1000000 if NRF_GRTC_TIMER + default 32768 if NRF_RTC_TIMER + endif # SOC_FAMILY_NRF diff --git a/soc/riscv/nordic_nrf/Kconfig.soc b/soc/riscv/nordic_nrf/Kconfig.soc new file mode 100644 index 00000000000..593d6f91769 --- /dev/null +++ b/soc/riscv/nordic_nrf/Kconfig.soc @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/nordic_nrf/*/Kconfig.series" diff --git a/soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt b/soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt new file mode 100644 index 00000000000..5b37b3a54d8 --- /dev/null +++ b/soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +# 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) diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr new file mode 100644 index 00000000000..a36d24c72ae --- /dev/null +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54H20_ENGA_CPUPPR + +config SOC + default "nrf54h20_enga_cpuppr" + +config NUM_IRQS + default 496 + +config SYS_CLOCK_TICKS_PER_SEC + default 1000 + +endif # SOC_NRF54H20_ENGA_CPUPPR diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.series b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.series new file mode 100644 index 00000000000..0f827fbe96b --- /dev/null +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.series @@ -0,0 +1,19 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_NRF54HX + +rsource "Kconfig.defconfig.nrf54h*" + +config SOC_SERIES + default "nrf54h" + +DT_CHOSEN_Z_SRAM = zephyr,sram +DT_CHOSEN_Z_CODE = zephyr,code-partition + +config BUILD_OUTPUT_ADJUST_LMA + depends on !XIP + default "$(dt_chosen_partition_addr_hex,$(DT_CHOSEN_Z_CODE)) - \ + $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))" + +endif # SOC_SERIES_NRF54HX diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.series b/soc/riscv/nordic_nrf/nrf54h/Kconfig.series new file mode 100644 index 00000000000..acb85b5623a --- /dev/null +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.series @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_NRF54HX + bool "Nordic Semiconductor nRF54H series MCU" + select SOC_FAMILY_NRF + select HAS_NRFX + select HAS_NORDIC_DRIVERS + help + Enable support for nRF54H MCU series diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc new file mode 100644 index 00000000000..17a6dd667c6 --- /dev/null +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc @@ -0,0 +1,19 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_NRF54H20 + bool "nRF54H20" + depends on SOC_SERIES_NRF54HX + +if SOC_NRF54H20 + +choice + prompt "nRF54Hx MCU Selection" + +config SOC_NRF54H20_ENGA_CPUPPR + bool "nRF54H20 ENGA CPUPPR" + select RISCV + +endchoice + +endif # SOC_NRF54H20 diff --git a/soc/riscv/nordic_nrf/nrf54h/align.ld b/soc/riscv/nordic_nrf/nrf54h/align.ld new file mode 100644 index 00000000000..0905aa7f7bc --- /dev/null +++ b/soc/riscv/nordic_nrf/nrf54h/align.ld @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA. + * SPDX-License-Identifier: Apache-2.0 + */ + +SECTION_PROLOGUE(.align16,,) +{ + . = (ALIGN(16) > 0 ? ALIGN(16) : 16) - 1; + BYTE(0); +} GROUP_LINK_IN(ROMABLE_REGION) From 55252ae8194208dbfbe81545f703b4344d249767 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 31 Jan 2024 19:47:33 +0100 Subject: [PATCH 0350/2300] [nrf fromtree] boards: riscv: add nrf54h20pdk_nrf54h20_cpuppr Add a board that allows to build for the nRF54H20 PPR RISC-V core. Signed-off-by: Grzegorz Swiderski Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 117194ae22b16faa54716701f3f949d643e10d68) (cherry picked from commit e9d353d3df4d028966a85d41b255ae04c32d5841) --- .../riscv/nrf54h20pdk_nrf54h20/Kconfig.board | 6 +++ .../nrf54h20pdk_nrf54h20/Kconfig.defconfig | 6 +++ boards/riscv/nrf54h20pdk_nrf54h20/board.cmake | 3 ++ .../nrf54h20pdk_nrf54h20_cpuppr.dts | 43 +++++++++++++++++++ .../nrf54h20pdk_nrf54h20_cpuppr.yaml | 13 ++++++ .../nrf54h20pdk_nrf54h20_cpuppr_defconfig | 14 ++++++ .../nrf54h20pdk_nrf54h20/pre_dt_board.cmake | 7 +++ 7 files changed, 92 insertions(+) create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/board.cmake create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board new file mode 100644 index 00000000000..9bbbba60dd4 --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF54H20PDK_NRF54H20_CPUPPR + bool "nRF54H20 PDK nRF54H20 PPR MCU" + depends on SOC_NRF54H20_ENGA_CPUPPR diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig new file mode 100644 index 00000000000..256976d6519 --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD + default "nrf54h20pdk_nrf54h20_cpuppr" + depends on BOARD_NRF54H20PDK_NRF54H20_CPUPPR diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake b/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake new file mode 100644 index 00000000000..4c63f1dd05e --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: Apache-2.0 + +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts new file mode 100644 index 00000000000..83aface6f5c --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" + +/ { + compatible = "nordic,nrf54h20pdk_nrf54h20-cpuppr"; + model = "Nordic nRF54H20 PDK nRF54H20 Peripheral Processor MCU"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart135; + zephyr,code-partition = &cpuppr_code_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpuppr_ram3x_region; + }; +}; + +&grtc { + status = "okay"; + owned-channels = <5>; +}; + +&uart135 { + status = "okay"; + pinctrl-0 = <&uart135_default>; + pinctrl-1 = <&uart135_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart136 { + pinctrl-0 = <&uart136_default>; + pinctrl-1 = <&uart136_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml new file mode 100644 index 00000000000..274be865c36 --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20pdk_nrf54h20_cpuppr +name: nRF54H20-PDK-nRF54H20-PPR +type: mcu +arch: riscv +toolchain: + - zephyr +ram: 28 +flash: 28 +supported: + - gpio diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig new file mode 100644 index 00000000000..fb3dca2266d --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_ENGA_CPUPPR=y +CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUPPR=y + +CONFIG_XIP=n + +CONFIG_SERIAL=y + +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake b/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake new file mode 100644 index 00000000000..5e0fecebdc8 --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Allow common DTS files to be included from the other board directory. +# To be removed after HWMv2 (#51831), once both directories can be merged into one. +string(REGEX REPLACE "/riscv/(.*$)" "/arm/\\1" BOARD_DIR_ARM "${BOARD_DIR}") +list(APPEND DTS_EXTRA_CPPFLAGS -isystem "${BOARD_DIR_ARM}") From f43242374bdbf87608a0e5db7ecc68c07c3859d4 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 6 Feb 2024 15:05:08 +0100 Subject: [PATCH 0351/2300] [nrf fromtree] drivers: console: uart_mux: fix incorrect usage of configuration API First, the API ops are available only if CONFIG_UART_USE_RUNTIME_CONFIGURE=y, but the driver was not guarding the code. Also, according to the API specs, these functions are optional, and the interface already returns -ENOSYS if they are not implemented. To solve both problems, just drop the dummy implementation. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit b548a73e79cdfce64d6ffc85cfeaf95fdf35acd1) (cherry picked from commit 6749d9b377f45f0b92d2cc2a3c514d7a417c05f1) --- drivers/console/uart_mux.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/console/uart_mux.c b/drivers/console/uart_mux.c index ca445a1f5b7..8ade93ef0bb 100644 --- a/drivers/console/uart_mux.c +++ b/drivers/console/uart_mux.c @@ -481,24 +481,6 @@ static int uart_mux_err_check(const struct device *dev) return -ENOTSUP; } -static int uart_mux_configure(const struct device *dev, - const struct uart_config *cfg) -{ - ARG_UNUSED(dev); - ARG_UNUSED(cfg); - - return -ENOTSUP; -} - -static int uart_mux_config_get(const struct device *dev, - struct uart_config *cfg) -{ - ARG_UNUSED(dev); - ARG_UNUSED(cfg); - - return -ENOTSUP; -} - static int uart_mux_fifo_fill(const struct device *dev, const uint8_t *tx_data, int len) { @@ -714,8 +696,6 @@ static struct uart_mux_driver_api uart_mux_driver_api = { .uart_api.poll_in = uart_mux_poll_in, .uart_api.poll_out = uart_mux_poll_out, .uart_api.err_check = uart_mux_err_check, - .uart_api.configure = uart_mux_configure, - .uart_api.config_get = uart_mux_config_get, .uart_api.fifo_fill = uart_mux_fifo_fill, .uart_api.fifo_read = uart_mux_fifo_read, .uart_api.irq_tx_enable = uart_mux_irq_tx_enable, From 948e41321b8fd3659d7b9f172ffa8d4e581969e3 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 7 Feb 2024 13:04:15 +0100 Subject: [PATCH 0352/2300] [nrf fromtree] dts: arm: nordic: nrf54l15: add missing easydma-maxcnt-bits Unlike SPI nodes, I2C nodes (i2c20, i2c21, i2c22 and i2c30) did not have this required property. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit bf4a021fba16885f87d53f220b9289a064f889ef) (cherry picked from commit ba520c3278ae12aa94c26ce851bf2c04ec69408e) --- dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index 786c21ab215..485d85829a4 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -106,6 +106,7 @@ i2c20: i2c@c6000 { reg = <0xc6000 0x1000>; clock-frequency = ; interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; status = "disabled"; }; @@ -140,6 +141,7 @@ i2c21: i2c@c7000 { reg = <0xc7000 0x1000>; clock-frequency = ; interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; status = "disabled"; }; @@ -174,6 +176,7 @@ i2c22: i2c@c8000 { reg = <0xc8000 0x1000>; clock-frequency = ; interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; status = "disabled"; }; @@ -344,6 +347,7 @@ i2c30: i2c@104000 { reg = <0x104000 0x1000>; clock-frequency = ; interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; status = "disabled"; }; From 2040c6caced995ad85abf9d5cbfb8cb73ccfc8c8 Mon Sep 17 00:00:00 2001 From: Alexander Svensen Date: Wed, 7 Feb 2024 08:47:01 +0100 Subject: [PATCH 0353/2300] [nrf fromtree] Bluetooth: Host: Send status for terminated directed adv - Fix bug where status was only sent for legacy adv Signed-off-by: Alexander Svensen (cherry picked from commit 199487be54246436f0bd75aa9965927db7623f85) Signed-off-by: Alexander Svensen (cherry picked from commit d2d7e710544d094bf45d480b209d91a1134502f1) --- subsys/bluetooth/host/adv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 7134e6fa89a..734c835a841 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -2185,11 +2185,10 @@ void bt_hci_le_adv_set_terminated(struct net_buf *buf) if (evt->status && IS_ENABLED(CONFIG_BT_PERIPHERAL) && atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { - /* Only set status for legacy advertising API. - * This will call connected callback for high duty cycle + /* This will call connected callback for high duty cycle * directed advertiser timeout. */ - le_adv_stop_free_conn(adv, adv == bt_dev.adv ? evt->status : 0); + le_adv_stop_free_conn(adv, evt->status); } if (IS_ENABLED(CONFIG_BT_CONN) && !evt->status) { From 87ef222d3dd2c530db087b06014718fbdb6c7aa7 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 8 Jan 2024 15:08:26 +0100 Subject: [PATCH 0354/2300] [nrf fromtree] manifest: Update nrf hw models to latest * Update the HW models module to c744f2c762aad79e59bd7e99002f2fcab0a2f288 Including the following: * docs: UART: several minor fixes * UART(E): Add peripherals and connect to (D)PPI Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 85d3ad11179cdc4bf030659e1d413215f1c6b866) Signed-off-by: Ivan Iushkov (cherry picked from commit 278144be7db76913170fe241bb9d83e46b0ddc47) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 2697b445524..821824a5936 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 9b985ea6bc237b6ae06f48eb228f2ac7f6e3b96b + revision: c744f2c762aad79e59bd7e99002f2fcab0a2f288 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From dd49bf3b9fe2e1fdba53f193ffb06516ad35d42c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 11 Jan 2024 13:52:24 +0100 Subject: [PATCH 0355/2300] [nrf fromtree] manifest: Update nrf hw models to latest * Update the HW models module to a08acc7d3a853f890df2bf82167c02ab2153ffe7 Including the following: * a08acc7 UART(E): Duty cycle warnings due to Rx while Rx Off * aa1f38d UART(E): FIFO backend Minor bugfix * 8b0819f UART(E): Add Loopback backend * bc648f2 UART(E): Update RTS pin level as soon as the conf is changed * b39e448 UART(E): Detect receiver opening mid frame Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 992c04c471edc0ea63a4f572cf72b2195ef6a99b) Signed-off-by: Ivan Iushkov (cherry picked from commit 1e49447b9fe2d444500dbb90ae0ab82c7dd0fb3d) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 821824a5936..c72b0910b99 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: c744f2c762aad79e59bd7e99002f2fcab0a2f288 + revision: a08acc7d3a853f890df2bf82167c02ab2153ffe7 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From c8e120fae407f3c0090311cc41e202a50ac4654a Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 16 Jan 2024 17:48:10 +0100 Subject: [PATCH 0356/2300] [nrf fromtree] manifest: Update nrf hw models to latest * Update the HW models module to 6b6ae3652c92c95edd945dce6ad9ef9892aab89b Including the following: * 6b6ae36 UART: Minor optimization * afe84c1 fake timer: Minor speed optimization for nrf52 * a5a4dfd RTC: Fix counter value when CLEAR after STOP Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 33d4b6d1482c7ba2cf97a037b2a8dde260547379) Signed-off-by: Ivan Iushkov (cherry picked from commit 4d36dfa4a889ff688faea10990ff1faa3e8e9e05) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c72b0910b99..a8c1f512b68 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: a08acc7d3a853f890df2bf82167c02ab2153ffe7 + revision: 6b6ae3652c92c95edd945dce6ad9ef9892aab89b path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From 8e313aec37fc48a873d2ee9f7d5bbc60b212f258 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 18 Jan 2024 13:52:52 +0100 Subject: [PATCH 0357/2300] [nrf fromtree] manifest: Update nrf hw models to latest * Update the HW models module to d17c9d749c817d2522468fa3c0eee3705feb8951 Including the following: * d17c9d7 UART: Bugfix: Support STARTRX while Rx is stopping * d982e76 UART: Minor bugfix: Fix 2 warning messages * eda7af9 UART: Bugfix: Handle task STOPTX while stopping * b8ea63b UART: BugFix: Support STARTTx even if Tx is not Off * c0d28cc nrf_common: Add replacement for nrf_dma_accessible_check() * feb91bb nrfx_common replacement: nrfx_get_irq_number() Add missing peri * c95d9af Makefile: By default lets build both 52833 and 5340 targets * cf41110 UART: FIFO backend: Check for failure of fcntl Signed-off-by: Alberto Escolar Piedras (cherry picked from commit c9d489d38b0cd25f35d5e33c03144c90204600d0) Signed-off-by: Ivan Iushkov (cherry picked from commit 3bdb32e0ab7409197e4e3a3afc42871038904be1) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index a8c1f512b68..c0f729f7fe7 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 6b6ae3652c92c95edd945dce6ad9ef9892aab89b + revision: d17c9d749c817d2522468fa3c0eee3705feb8951 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From e134f7688d2799b6ff4ff117ca57cdc7ff506edd Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 6 Feb 2024 17:40:53 +0100 Subject: [PATCH 0358/2300] [nrf fromtree] manifest: Update nrf hw models to latest * Update the HW models module to 52d0b4b7b7431d8da6222cc3b17a8afdcb099baf Including the following: * 52d0b4b UART: FIFO backend: Do not error out if other side disconnects Rx * 3582b68 UART: FIFO backend: Avoid possible race * 414f160 AAR: Fix UBSAN warnings * 24f5d3d PPI: Fix UBSAN warning Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 189d4d4b069d78de1f17b4179229ca00d4d80789) Signed-off-by: Ivan Iushkov (cherry picked from commit 7e22d688b57cd3b85b293fe8995bc593d761c4f9) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c0f729f7fe7..7ce69358f52 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: d17c9d749c817d2522468fa3c0eee3705feb8951 + revision: 52d0b4b7b7431d8da6222cc3b17a8afdcb099baf path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From e2190a79a2eee5eca843baa1c302482edd9df656 Mon Sep 17 00:00:00 2001 From: Ivan Iushkov Date: Tue, 6 Feb 2024 13:08:30 +0100 Subject: [PATCH 0359/2300] [nrf fromtree] Bluetooth: Fixing UBSAN warning in CTE field parsing in adv.c/scan.c during local testling, UBSAN reported the following warnings: - bluetooth/host/adv.c:2067:19: runtime error: shift exponent 255 is too large for 32-bit type 'long unsigned int' - bluetooth/host/scan.c:828:18: runtime error: shift exponent 255 is too large for 32-bit type 'long unsigned int' It turned out that we can't use BIT() macro directly on bt_hci_evt_le_per_advertising_report::cte_type field. According to Core Spec, `cte_type = 0xFF` corresponds to `No contstant tone extension`. Added separate function to convert CTE bit field from HCI format to bt_df_cte_type Signed-off-by: Ivan Iushkov (cherry picked from commit b1e9f86378c1c2f591aa2d6882da9a1a8ca4ac78) Signed-off-by: Ivan Iushkov (cherry picked from commit 4c9479b079d2edce2e5dd1d53a6c0006a31dcc1f) --- subsys/bluetooth/host/adv.c | 2 +- subsys/bluetooth/host/hci_core.c | 16 ++++++++++++++++ subsys/bluetooth/host/hci_core.h | 9 ++++++++- subsys/bluetooth/host/scan.c | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 734c835a841..7a312d5e05c 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -2064,7 +2064,7 @@ void bt_hci_le_per_adv_response_report(struct net_buf *buf) response = net_buf_pull_mem(buf, sizeof(struct bt_hci_evt_le_per_adv_response)); info.tx_power = response->tx_power; info.rssi = response->rssi; - info.cte_type = BIT(response->cte_type); + info.cte_type = bt_get_df_cte_type(response->cte_type); info.response_slot = response->response_slot; if (buf->len < response->data_length) { diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index b37cd45e1ae..ee1c822d9f9 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -422,6 +422,22 @@ uint8_t bt_get_phy(uint8_t hci_phy) } } +int bt_get_df_cte_type(uint8_t hci_cte_type) +{ + switch (hci_cte_type) { + case BT_HCI_LE_AOA_CTE: + return BT_DF_CTE_TYPE_AOA; + case BT_HCI_LE_AOD_CTE_1US: + return BT_DF_CTE_TYPE_AOD_1US; + case BT_HCI_LE_AOD_CTE_2US: + return BT_DF_CTE_TYPE_AOD_2US; + case BT_HCI_LE_NO_CTE: + return BT_DF_CTE_TYPE_NONE; + default: + return BT_DF_CTE_TYPE_NONE; + } +} + #if defined(CONFIG_BT_CONN_TX) static void hci_num_completed_packets(struct net_buf *buf) { diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index ce4fc5a9b63..1a3c06414a0 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -434,7 +434,14 @@ int bt_le_set_data_len(struct bt_conn *conn, uint16_t tx_octets, uint16_t tx_tim int bt_le_set_phy(struct bt_conn *conn, uint8_t all_phys, uint8_t pref_tx_phy, uint8_t pref_rx_phy, uint8_t phy_opts); uint8_t bt_get_phy(uint8_t hci_phy); - +/** + * @brief Convert CTE type value from HCI format to @ref bt_df_cte_type format. + * + * @param hci_cte_type CTE type in an HCI format. + * + * @return CTE type (@ref bt_df_cte_type). + */ +int bt_get_df_cte_type(uint8_t hci_cte_type); int bt_le_scan_update(bool fast_scan); int bt_le_create_conn(const struct bt_conn *conn); diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index 168d7f6ead3..0b61305e2c3 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -825,7 +825,7 @@ static void bt_hci_le_per_adv_report_common(struct net_buf *buf) info.tx_power = evt->tx_power; info.rssi = evt->rssi; - info.cte_type = BIT(evt->cte_type); + info.cte_type = bt_get_df_cte_type(evt->cte_type); info.addr = &per_adv_sync->addr; info.sid = per_adv_sync->sid; From c127c41548dcb59716d7bf5e7ac90b0139f399a5 Mon Sep 17 00:00:00 2001 From: Ivan Iushkov Date: Mon, 5 Feb 2024 16:30:36 +0100 Subject: [PATCH 0360/2300] [nrf fromtree] Bluetooth: fixing UBSAN warnings related to Codec Configuration During local testing with UBSAN enabled, warning was reported: bluetooth/host/iso.c:237:2: runtime error: null pointer passed as argument 2, which is declared to never be null It turned out that when datapath doesn't contain codec information, cc_len is 0 and cc is NULL In order to avoid UB, now we call memcpy only when cp->codec_config_len > 0 Signed-off-by: Ivan Iushkov (cherry picked from commit e8d090011b6fa9d7e37e05dd03eb457e801b2e97) Signed-off-by: Ivan Iushkov (cherry picked from commit 2ef9e28a442e35fdb47d0225d782943cc3db01a4) --- subsys/bluetooth/host/iso.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index 4d6366ead67..05b5cc2f613 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -233,9 +233,10 @@ static int hci_le_setup_iso_data_path(const struct bt_conn *iso, uint8_t dir, cp->codec_id.vs_codec_id = sys_cpu_to_le16(path->vid); sys_put_le24(path->delay, cp->controller_delay); cp->codec_config_len = path->cc_len; - cc = net_buf_add(buf, cp->codec_config_len); - memcpy(cc, path->cc, cp->codec_config_len); - + cc = net_buf_add(buf, path->cc_len); + if (path->cc_len) { + memcpy(cc, path->cc, path->cc_len); + } err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_SETUP_ISO_PATH, buf, &rsp); if (err) { return err; From 8766adfd46d141fde0a6bba5c309de96e4275758 Mon Sep 17 00:00:00 2001 From: Ivan Iushkov Date: Tue, 6 Feb 2024 09:34:16 +0100 Subject: [PATCH 0361/2300] [nrf fromtree] Bluetooth: fixing null-pointer dereference in l2cap channel destroyer During local testing with UBSAN enabled, warning was reported: bluetooth/host/l2cap.c:980:25: runtime error: member access within null pointer of type 'struct k_work_q' It turned out that le_chan->rtx_work.queue can be NULL. Since null-pointer dereference is a UB, additional check was added to ensure we don't access `le_chan->rtx_work.queue->thread` when `le_chan->rtx_work.queue == NULL` The same changes applied to l2cap_br.c Signed-off-by: Ivan Iushkov (cherry picked from commit a3cbf8e2aca97548c9a7380c76b8bf8e0161006a) Signed-off-by: Ivan Iushkov (cherry picked from commit e9bb83320a4cd303135203fae18136a71e87f26e) --- subsys/bluetooth/host/l2cap.c | 4 +++- subsys/bluetooth/host/l2cap_br.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index e6fbe2144f8..b8faa1efcae 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -977,7 +977,9 @@ static void l2cap_chan_destroy(struct bt_l2cap_chan *chan) * In the case where we are in the context of executing the rtx_work * item, we don't sync as it will deadlock the workqueue. */ - if (k_current_get() != &le_chan->rtx_work.queue->thread) { + struct k_work_q *rtx_work_queue = le_chan->rtx_work.queue; + + if (rtx_work_queue == NULL || k_current_get() != &rtx_work_queue->thread) { k_work_cancel_delayable_sync(&le_chan->rtx_work, &le_chan->rtx_sync); } else { k_work_cancel_delayable(&le_chan->rtx_work); diff --git a/subsys/bluetooth/host/l2cap_br.c b/subsys/bluetooth/host/l2cap_br.c index e9a10ff8d72..3a33ff293c6 100644 --- a/subsys/bluetooth/host/l2cap_br.c +++ b/subsys/bluetooth/host/l2cap_br.c @@ -165,7 +165,9 @@ static void l2cap_br_chan_destroy(struct bt_l2cap_chan *chan) * In the case where we are in the context of executing the rtx_work * item, we don't sync as it will deadlock the workqueue. */ - if (k_current_get() != &br_chan->rtx_work.queue->thread) { + struct k_work_q *rtx_work_queue = br_chan->rtx_work.queue; + + if (rtx_work_queue == NULL || k_current_get() != &rtx_work_queue->thread) { k_work_cancel_delayable_sync(&br_chan->rtx_work, &br_chan->rtx_sync); } else { k_work_cancel_delayable(&br_chan->rtx_work); From f4266dc3891c1de97205800397260c516748e8e8 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Tue, 16 Jan 2024 14:44:53 +0100 Subject: [PATCH 0362/2300] [nrf fromtree] Bluetooth: Mesh: Fix processing SegAcks to wrong destination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not process SegAcks which were not targeted to the node. They were rejected in the next if statement always, but generated the annyoing warning "No matching TX context for ack". Signed-off-by: Pavel Vasilyev (cherry picked from commit 7a41a9d864cdd00bda521d09662ecf4fcfa6f2a5) Signed-off-by: Alperen Şener (cherry picked from commit 3a4daeda7027aa1e3224175f3353c92ddcb614d4) --- subsys/bluetooth/mesh/transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/transport.c b/subsys/bluetooth/mesh/transport.c index 47e8492a901..a0364dceb25 100644 --- a/subsys/bluetooth/mesh/transport.c +++ b/subsys/bluetooth/mesh/transport.c @@ -869,6 +869,8 @@ static int trans_ack(struct bt_mesh_net_rx *rx, uint8_t hdr, /* Best effort - we don't have enough info for true SeqAuth */ *seq_auth = SEQ_AUTH(BT_MESH_NET_IVI_RX(rx), seq_zero); return 0; + } else if (!rx->local_match) { + return 0; } ack = net_buf_simple_pull_be32(buf); @@ -969,7 +971,7 @@ static int ctl_recv(struct bt_mesh_net_rx *rx, uint8_t hdr, return bt_mesh_hb_recv(rx, buf); } - /* Only acks and heartbeats may need processing without local_match */ + /* Only acks for friendship and heartbeats may need processing without local_match */ if (!rx->local_match) { return 0; } From 2f87aac6b97873a65ee636d74597e32be407a900 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 29 Nov 2023 13:28:08 +0100 Subject: [PATCH 0363/2300] [nrf fromtree] Bluetooth: Mesh: Drop explicit support for Bluetooth Mesh 1.0.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bluetooth Mesh Protocol 1.1 is backward compatible with Bluetooth Mesh Profile 1.0.1, therefore the stack can still be qualified for 1.0.1 if needed. But explicit support for both versions requires additional maintenance efforts and doubles the CI time. To make the stack qualifiable for 1.0.1, the one needs to remove Private Beacons reception and compile out SHA256 algorithm support. What is changed: - Removed `CONFIG_BT_MESH_V1d1` option. - Removed `transport_legacy.c` which was using 1.0.1 implementation. The new transport layer has new SaR logic that should still be possible to qualify for 1.0.1. - Removed the legacy transport Kconfig options. They are superseded by the new transport Kconfig options. - Tester app: `overlay-mesh-v1d1.conf` is merged into `overlay-mesh.conf`. - Removed BabbleSim tests for 1.0.1. - Updated documentation. Signed-off-by: Pavel Vasilyev (cherry picked from commit 981c79b7ce9377cebbab89ac1770ee922061db58) Signed-off-by: Alperen Şener (cherry picked from commit 6bc6ab47474ab774903d5fa9df9ca4458a9e5b75) --- doc/connectivity/bluetooth/api/mesh.rst | 5 +- .../bluetooth/api/mesh/access.rst | 9 - .../bluetooth/api/mesh/sar_cfg.rst | 56 +- doc/releases/migration-guide-3.6.rst | 19 + doc/releases/release-notes-3.6.rst | 1 + include/zephyr/bluetooth/mesh/main.h | 4 - subsys/bluetooth/mesh/CMakeLists.txt | 7 +- subsys/bluetooth/mesh/Kconfig | 62 +- subsys/bluetooth/mesh/access.c | 3 +- subsys/bluetooth/mesh/beacon.c | 6 - subsys/bluetooth/mesh/net.c | 5 - subsys/bluetooth/mesh/subnet.h | 2 - subsys/bluetooth/mesh/transport_legacy.c | 1656 ----------------- tests/bluetooth/mesh/blob_io_flash/prj.conf | 1 - .../mesh_shell/proxy_solicitation.conf | 1 - tests/bluetooth/tester/overlay-mesh-v1d1.conf | 30 - tests/bluetooth/tester/overlay-mesh.conf | 29 + tests/bluetooth/tester/testcase.yaml | 10 - tests/bsim/bluetooth/mesh/CMakeLists.txt | 45 +- tests/bsim/bluetooth/mesh/compile.sh | 21 +- tests/bsim/bluetooth/mesh/overlay_pst.conf | 3 - tests/bsim/bluetooth/mesh/prj.conf | 28 +- tests/bsim/bluetooth/mesh/prj_mesh1d1.conf | 73 - tests/bsim/bluetooth/mesh/src/main.c | 17 +- tests/bsim/bluetooth/mesh/src/test_beacon.c | 17 +- .../bsim/bluetooth/mesh/src/test_provision.c | 4 - .../bluetooth/mesh/src/test_replay_cache.c | 4 - .../bsim/bluetooth/mesh/src/test_transport.c | 2 - .../tests_scripts/access/access_cancel.sh | 5 - .../tests_scripts/access/access_ext_sub.sh | 5 - .../access/access_ext_sub_cap.sh | 4 - .../tests_scripts/access/access_period.sh | 5 - .../access/access_period_delayable.sh | 5 - .../tests_scripts/access/access_transmit.sh | 5 - .../access/access_transmit_delayable.sh | 5 - .../tests_scripts/advertiser/proxy_mixin.sh | 5 - .../tests_scripts/advertiser/random_order.sh | 4 - .../tests_scripts/advertiser/reverse_order.sh | 4 - .../tests_scripts/advertiser/send_order.sh | 4 - .../tests_scripts/advertiser/tx_cb_multi.sh | 4 - .../tests_scripts/advertiser/tx_cb_single.sh | 4 - .../mesh/tests_scripts/beacon/beacon_cache.sh | 6 - .../tests_scripts/beacon/beacon_interval.sh | 6 - .../mesh/tests_scripts/beacon/invalid.sh | 6 - .../mesh/tests_scripts/beacon/iv_update.sh | 6 - .../mesh/tests_scripts/beacon/key_refresh.sh | 6 - .../mesh/tests_scripts/beacon/kr_old_key.sh | 6 - .../tests_scripts/beacon/multiple_netkeys.sh | 6 - .../blob_mdls/blob_cli_broadcast_basic.sh | 2 - .../blob_mdls/blob_cli_broadcast_trans.sh | 2 - .../blob_mdls/blob_cli_broadcast_unicast.sh | 2 - .../blob_cli_broadcast_unicast_seq.sh | 2 - .../blob_mdls/blob_cli_caps_all_rsp.sh | 2 - .../blob_mdls/blob_cli_caps_cancelled.sh | 2 - .../blob_mdls/blob_cli_caps_no_rsp.sh | 2 - .../blob_mdls/blob_cli_caps_partial_rsp.sh | 2 - .../blob_mdls/blob_cli_friend.sh | 2 - .../blob_mdls/blob_cli_no_rsp_block.sh | 2 - .../blob_mdls/blob_cli_no_rsp_xfer.sh | 2 - .../blob_mdls/blob_cli_persistent_transfer.sh | 2 - .../blob_cli_persistent_transfer_pull.sh | 2 - .../blob_mdls/blob_cli_trans_complete_pull.sh | 2 - .../blob_mdls/blob_cli_trans_complete_push.sh | 2 - .../blob_mdls/blob_cli_trans_resume_pull.sh | 2 - .../blob_mdls/blob_cli_trans_resume_push.sh | 2 - .../blob_mdls/blob_srv_persistence.sh | 12 - .../comp_data/cdp1_encode_decode.sh | 2 - .../dfu/dfu_cli_all_targets_lost_on_apply.sh | 2 - .../dfu_cli_all_targets_lost_on_caps_get.sh | 2 - .../dfu_cli_all_targets_lost_on_metadata.sh | 2 - .../dfu_cli_all_targets_lost_on_update_get.sh | 2 - .../dfu/dfu_cli_all_targets_lost_on_verify.sh | 2 - .../dfu/dfu_cli_persistent_transfer.sh | 2 - .../tests_scripts/dfu/dfu_dist_self_update.sh | 2 - .../dfu/dfu_dist_self_update_mult_targets.sh | 2 - .../mesh/tests_scripts/dfu/dfu_mixed.sh | 2 - .../mesh/tests_scripts/dfu/dfu_mixed_fail.sh | 2 - .../mesh/tests_scripts/dfu/dfu_slot.sh | 2 - .../tests_scripts/dfu/dfu_slot_idempotency.sh | 2 - .../tests_scripts/dfu/dfu_slot_reservation.sh | 2 - .../tests_scripts/dfu/dfu_srv_persistence.sh | 14 - .../tests_scripts/friendship/establish.sh | 6 - .../friendship/establish_multi.sh | 10 - .../tests_scripts/friendship/lpn_disable.sh | 6 - .../tests_scripts/friendship/lpn_loopback.sh | 6 - .../friendship/lpn_terminate_cb.sh | 6 - .../mesh/tests_scripts/friendship/msg_frnd.sh | 6 - .../tests_scripts/friendship/msg_group.sh | 7 - .../mesh/tests_scripts/friendship/msg_mesh.sh | 7 - .../friendship/msg_mesh_low_lat.sh | 8 - .../friendship/msg_va_collision.sh | 6 - .../mesh/tests_scripts/friendship/overflow.sh | 6 - .../mesh/tests_scripts/friendship/poll.sh | 6 - .../tests_scripts/friendship/re-establish.sh | 6 - .../tests_scripts/heartbeat/sub_cb_api_all.sh | 7 - .../heartbeat/sub_cb_api_unicast.sh | 7 - .../tests_scripts/iv_index/iv_deferring.sh | 4 - .../tests_scripts/iv_index/iv_recovery.sh | 4 - .../mesh/tests_scripts/iv_index/iv_update.sh | 4 - .../large_comp_data/get_comp0_data_split.sh | 2 - .../get_comp0_data_split_dfu.sh | 2 - .../large_comp_data/get_comp128_data_split.sh | 2 - .../get_comp128_data_split_dfu.sh | 2 - .../large_comp_data/get_comp129_data_split.sh | 2 - .../get_comp129_data_split_dfu.sh | 2 - .../large_comp_data/get_comp130_data_split.sh | 2 - .../get_comp130_data_split_dfu.sh | 2 - .../large_comp_data/get_comp1_data_split.sh | 2 - .../get_comp1_data_split_dfu.sh | 2 - .../large_comp_data/get_comp2_data_split.sh | 2 - .../get_comp2_data_split_dfu.sh | 2 - .../large_comp_data/get_comp_data_max_sdu.sh | 2 - .../large_comp_data/get_metadata_max_sdu.sh | 2 - .../large_comp_data/get_metadata_split.sh | 2 - .../op_agg/full_status_msg_list.sh | 2 - .../mesh/tests_scripts/op_agg/loopback.sh | 2 - .../mesh/tests_scripts/op_agg/model_coex.sh | 2 - .../mesh/tests_scripts/persistence/access.sh | 35 - .../mesh/tests_scripts/persistence/cfg.sh | 24 - .../tests_scripts/persistence/provisioning.sh | 10 - .../persistence/reprovisioning.sh | 14 - .../priv_beacon/priv_beacon_adv.sh | 2 - .../priv_beacon/priv_beacon_cache.sh | 2 - .../priv_beacon/priv_beacon_interleave.sh | 2 - .../priv_beacon/priv_beacon_invalid.sh | 2 - .../priv_beacon/priv_beacon_ivu.sh | 2 - .../priv_beacon_ivu_long_interval.sh | 2 - .../priv_beacon/priv_beacon_kr.sh | 2 - .../priv_beacon_kr_long_interval.sh | 2 - .../priv_beacon/priv_proxy_gatt.sh | 2 - .../priv_beacon/priv_proxy_net_id.sh | 2 - .../priv_beacon/priv_proxy_net_id_multi.sh | 2 - .../priv_beacon/priv_proxy_node_id.sh | 2 - .../proxy_adv_multi_subnet_coex.sh | 2 - .../provision/ivu_flag_one_duration.sh | 4 - .../provision/ivu_flag_zero_duration.sh | 4 - .../tests_scripts/provision/pb_adv_multi.sh | 8 - .../tests_scripts/provision/pb_adv_no_oob.sh | 6 - .../provision/pb_adv_oob_auth_ib_pk.sh | 5 - .../pb_adv_oob_auth_ignore_oob_pk.sh | 5 - .../provision/pb_adv_oob_auth_oob_pk.sh | 5 - .../provision/pb_adv_reprovision.sh | 6 - .../pb_remote_client_server_same_dev.sh | 2 - .../provision/pb_remote_nppi_robustness.sh | 2 - .../provision/pb_remote_parallel.sh | 2 - .../provision/pb_remote_pst_ncrp.sh | 6 - .../provision/pb_remote_reprovision.sh | 2 - .../provision/pb_remote_timeout.sh | 2 - .../replay_cache/replay_attack.sh | 14 - .../tests_scripts/replay_cache/rpl_frag.sh | 13 - .../sar/sar_cfg_persistent_storage.sh | 2 - .../tests_scripts/sar/slow_transfer_test.sh | 2 - .../mesh/tests_scripts/sar/stress_test.sh | 2 - .../tests_scripts/scanner/invalid_ad_type.sh | 6 - .../scanner/wrong_packet_length.sh | 6 - .../suspend/gatt_suspend_disable_resume.sh | 31 + .../suspend/gatt_suspend_resume.sh | 31 + .../suspend/suspend_disable_resume.sh | 28 + .../tests_scripts/suspend/suspend_resume.sh | 27 + .../mesh/tests_scripts/transport/fixed.sh | 4 - .../mesh/tests_scripts/transport/group.sh | 4 - .../mesh/tests_scripts/transport/loopback.sh | 4 - .../tests_scripts/transport/loopback_group.sh | 4 - .../transport/loopback_group_low_lat.sh | 5 - .../mesh/tests_scripts/transport/seg_block.sh | 4 - .../tests_scripts/transport/seg_concurrent.sh | 4 - .../mesh/tests_scripts/transport/seg_fail.sh | 4 - .../mesh/tests_scripts/transport/seg_ivu.sh | 4 - .../mesh/tests_scripts/transport/unicast.sh | 4 - .../transport/unicast_low_lat.sh | 5 - .../tests_scripts/transport/unknown_app.sh | 4 - .../mesh/tests_scripts/transport/va.sh | 4 - .../tests_scripts/transport/va_collision.sh | 4 - 173 files changed, 236 insertions(+), 2609 deletions(-) delete mode 100644 subsys/bluetooth/mesh/transport_legacy.c delete mode 100644 tests/bluetooth/tester/overlay-mesh-v1d1.conf delete mode 100644 tests/bsim/bluetooth/mesh/prj_mesh1d1.conf create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_disable_resume.sh create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_resume.sh create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_disable_resume.sh create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_resume.sh diff --git a/doc/connectivity/bluetooth/api/mesh.rst b/doc/connectivity/bluetooth/api/mesh.rst index f234ff7cedc..358ba3dc62e 100644 --- a/doc/connectivity/bluetooth/api/mesh.rst +++ b/doc/connectivity/bluetooth/api/mesh.rst @@ -5,10 +5,7 @@ Bluetooth Mesh Profile The Bluetooth Mesh profile adds secure wireless multi-hop communication for Bluetooth Low Energy. This module implements the -`Bluetooth Mesh Profile Specification v1.0.1 `_. - -Implementation of the `Bluetooth Mesh Protocol Specification v1.1 `_ -is in experimental state. +`Bluetooth Mesh Protocol Specification v1.1 `_. Read more about Bluetooth Mesh on the `Bluetooth SIG Website `_. diff --git a/doc/connectivity/bluetooth/api/mesh/access.rst b/doc/connectivity/bluetooth/api/mesh/access.rst index cb02028b697..7af8ca7ec68 100644 --- a/doc/connectivity/bluetooth/api/mesh/access.rst +++ b/doc/connectivity/bluetooth/api/mesh/access.rst @@ -168,15 +168,6 @@ needs to be stored. Composition Data ================ -.. note:: - - The implementation of the Bluetooth Mesh Protocol Specification version 1.1 - is currently in an experimental state. For Bluetooth Mesh Profile Specification - version 1.0.1, only Composition Data Page 0 is supported. Users that are developing - for Bluetooth Mesh Profile Specification version 1.0.1 may therefore disregard all - parts of the following section mentioning the :ref:`bluetooth_mesh_lcd_srv` - model and Composition Data Pages 1, 2, 128, 129 and 130. - The Composition Data provides information about a mesh device. A device's Composition Data holds information about the elements on the device, the models that it supports, and other features. The Composition diff --git a/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst b/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst index 4f3354945c9..76bd0330a98 100644 --- a/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst +++ b/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst @@ -43,36 +43,8 @@ Keep this in mind when defining the size of the buffers. SAR does not impose extra overhead on the access layer payload per segment. -Intervals, timers and retransmission counters -********************************************* - -The current stable stack implementation allows you to configure the following SAR behavior. - -When sending a segmented message to a unicast address, the unacknowledged segments are repeated -the :kconfig:option:`CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT` number of times before the transmission -is considered as failed. The same option configures a number of retransmissions to a group or -virtual address, but the transmission always succeedes after retransmitting all segments the -configured number of times. - -The timeout between each retransmission to a unicast address is configured by the Kconfig option -:kconfig:option:`CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST`. The timeout between each -retransmission to a group or a virtual address is configured by the Kconfig option -:kconfig:option:`CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP`. - -The time before sending a Segment Acknowledgment message is controlled by the Kconfig options -:kconfig:option:`CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT`, -:kconfig:option:`CONFIG_BT_MESH_SEG_ACK_PER_HOP_TIMEOUT` and -:kconfig:option:`CONFIG_BT_MESH_SEG_ACK_PER_SEGMENT_TIMEOUT`, and is defined as: - -.. math:: - \begin{aligned} - \max(&\mathtt{CONFIG\_BT\_MESH\_SEG\_ACK\_BASE\_TIMEOUT} \\ - &+ \text{TTL} \times \mathtt{CONFIG\_BT\_MESH\_SEG\_ACK\_PER\_HOP\_TIMEOUT} \\ - &+ \text{number of un-acked segments} \times \mathtt{CONFIG\_BT\_MESH\_SEG\_ACK\_PER\_SEGMENT\_TIMEOUT} , 400) - \end{aligned} - Segmentation and reassembly (SAR) Configuration models -====================================================== +****************************************************** With Bluetooth Mesh Protocol Specification version 1.1, it became possible to configure SAR behavior, such as intervals, timers and retransmission counters, over a mesh network using SAR @@ -139,7 +111,7 @@ of the `SAR Acknowledgment Retransmissions Count`_ state. .. _bt_mesh_sar_cfg_states: SAR states -========== +********** There are two states defined related to segmentation and reassembly: @@ -168,7 +140,7 @@ the following states: * SAR Receiver Segment Interval Step SAR Segment Interval Step -------------------------- +========================= SAR Segment Interval Step state holds a value that controls the interval between transmissions of segments of a segmented message. The interval is measured in milliseconds. @@ -182,7 +154,7 @@ value. Segment transmission interval is then calculated using the following form SAR Unicast Retransmissions Count ---------------------------------- +================================= SAR Unicast Retransmissions Count holds a value that defines the maximum number of retransmissions of a segmented message to a unicast destination. Use the @@ -190,7 +162,7 @@ of a segmented message to a unicast destination. Use the value for this state. SAR Unicast Retransmissions Without Progress Count --------------------------------------------------- +================================================== This state holds a value that defines the maximum number of retransmissions of a segmented message to a unicast address that will be sent if no acknowledgment was received during the timeout, or if @@ -199,7 +171,7 @@ an acknowledgment with already confirmed segments was received. Use the Kconfig of retransmissions. SAR Unicast Retransmissions Interval Step ------------------------------------------ +========================================= The value of this state controls the interval step used for delaying the retransmissions of unacknowledged segments of a segmented message to a unicast address. The interval step is measured @@ -214,7 +186,7 @@ default value. This value is then used to calculate the interval step using the SAR Unicast Retransmissions Interval Increment ----------------------------------------------- +============================================== SAR Unicast Retransmissions Interval Increment holds a value that controls the interval increment used for delaying the retransmissions of unacknowledged segments of a segmented message to a unicast @@ -230,7 +202,7 @@ formula: SAR Multicast Retransmissions Count ------------------------------------ +=================================== The state holds a value that controls the total number of retransmissions of a segmented message to a multicast address. Use the Kconfig option @@ -238,7 +210,7 @@ a multicast address. Use the Kconfig option retransmissions. SAR Multicast Retransmissions Interval Step -------------------------------------------- +=========================================== This state holds a value that controls the interval between retransmissions of all segments in a segmented message to a multicast address. The interval is measured in milliseconds. @@ -252,7 +224,7 @@ default value that is used to calculate the interval using the following formula SAR Discard Timeout -------------------- +=================== The value of this state defines the time in seconds that the lower transport layer waits after receiving segments of a segmented message before discarding that segmented message. Use the Kconfig @@ -265,7 +237,7 @@ timeout will be calculated using the following formula: SAR Acknowledgment Delay Increment ----------------------------------- +================================== This state holds a value that controls the delay increment of an interval used for delaying the transmission of an acknowledgment message after receiving a new segment. The increment is measured @@ -276,7 +248,7 @@ value. The increment value is calculated to be :math:`\verb|CONFIG_BT_MESH_SAR_RX_ACK_DELAY_INC| + 1.5`. SAR Segments Threshold ----------------------- +====================== SAR Segments Threshold state holds a value that defines a threshold in number of segments of a segmented message for acknowledgment retransmissions. Use the Kconfig option @@ -287,7 +259,7 @@ additionally retransmit every acknowledgment message the number of times given b :kconfig:option:`CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT`. SAR Acknowledgment Retransmissions Count ----------------------------------------- +======================================== The SAR Acknowledgment Retransmissions Count state controls the number of retransmissions of Segment Acknowledgment messages sent by the lower transport layer. It gives the total number of @@ -300,7 +272,7 @@ value for this state. The maximum number of transmissions of a Segment Acknowle :math:`\verb|CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT| + 1`. SAR Receiver Segment Interval Step ----------------------------------- +================================== The SAR Receiver Segment Interval Step defines the segments reception interval step used for delaying the transmission of an acknowledgment message after receiving a new segment. The interval diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index c4cb37eaf94..8428e2a4645 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -135,6 +135,25 @@ Bluetooth * Deprecated :kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE`. This option is replaced by new option :kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` to be aligned with Mesh Protocol Specification v1.1, section 5.4. (:github:`64252`) + * Removed the ``CONFIG_BT_MESH_V1d1`` Kconfig option. + * Removed the ``CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT``, + ``CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST``, + ``CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP``, ``CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT``, + ``CONFIG_BT_MESH_SEG_ACK_PER_HOP_TIMEOUT``, ``BT_MESH_SEG_ACK_PER_SEGMENT_TIMEOUT`` + Kconfig options. They are superseded by the + :kconfig:option:`CONFIG_BT_MESH_SAR_TX_SEG_INT_STEP`, + :kconfig:option:`CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_COUNT`, + :kconfig:option:`CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_WITHOUT_PROG_COUNT`, + :kconfig:option:`CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP`, + :kconfig:option:`CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC`, + :kconfig:option:`CONFIG_BT_MESH_SAR_TX_MULTICAST_RETRANS_COUNT`, + :kconfig:option:`CONFIG_BT_MESH_SAR_TX_MULTICAST_RETRANS_INT`, + :kconfig:option:`CONFIG_BT_MESH_SAR_RX_SEG_THRESHOLD`, + :kconfig:option:`CONFIG_BT_MESH_SAR_RX_ACK_DELAY_INC`, + :kconfig:option:`CONFIG_BT_MESH_SAR_RX_SEG_INT_STEP`, + :kconfig:option:`CONFIG_BT_MESH_SAR_RX_DISCARD_TIMEOUT`, + :kconfig:option:`CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT` Kconfig options. + LoRaWAN ======= diff --git a/doc/releases/release-notes-3.6.rst b/doc/releases/release-notes-3.6.rst index f4d813432b1..31dcb4c8dcd 100644 --- a/doc/releases/release-notes-3.6.rst +++ b/doc/releases/release-notes-3.6.rst @@ -56,6 +56,7 @@ Bluetooth the transmitted responses on the Access layer. The functionality is enabled by the :kconfig:option:`CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG` Kconfig option. + * The Bluetooth Mesh Protocol 1.1 is now supported by default. * Controller diff --git a/include/zephyr/bluetooth/mesh/main.h b/include/zephyr/bluetooth/mesh/main.h index a213e8ce22c..1622ccebbd8 100644 --- a/include/zephyr/bluetooth/mesh/main.h +++ b/include/zephyr/bluetooth/mesh/main.h @@ -783,7 +783,6 @@ struct bt_mesh_snb { uint64_t auth_val; }; -#if defined(CONFIG_BT_MESH_V1d1) struct bt_mesh_prb { /** Random */ uint8_t random[13]; @@ -797,7 +796,6 @@ struct bt_mesh_prb { /** Authentication tag */ uint64_t auth_tag; }; -#endif /** Beacon callback functions. */ struct bt_mesh_beacon_cb { @@ -810,7 +808,6 @@ struct bt_mesh_beacon_cb { */ void (*snb_received)(const struct bt_mesh_snb *snb); -#if defined(CONFIG_BT_MESH_V1d1) /** @brief Private Beacon received. * * This callback notifies the application that Private Beacon @@ -819,7 +816,6 @@ struct bt_mesh_beacon_cb { * @param prb Structure describing received Private Beacon */ void (*priv_received)(const struct bt_mesh_prb *prb); -#endif }; /** diff --git a/subsys/bluetooth/mesh/CMakeLists.txt b/subsys/bluetooth/mesh/CMakeLists.txt index fe4444b28ab..5d4f41ce7f7 100644 --- a/subsys/bluetooth/mesh/CMakeLists.txt +++ b/subsys/bluetooth/mesh/CMakeLists.txt @@ -18,14 +18,9 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH cfg_srv.c health_srv.c va.c + transport.c ) -if (CONFIG_BT_MESH_V1d1) - zephyr_library_sources(transport.c) -else() - zephyr_library_sources(transport_legacy.c) -endif() - zephyr_library_sources_ifdef(CONFIG_BT_MESH_ADV_LEGACY adv_legacy.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_ADV_EXT adv_ext.c) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 555aac45bc0..0f38a2e3ba0 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -512,56 +512,6 @@ config BT_MESH_TX_SEG_MAX which leaves 56 bytes for application layer data using a 4-byte MIC and 52 bytes using an 8-byte MIC. -if !BT_MESH_V1d1 - -config BT_MESH_TX_SEG_RETRANS_COUNT - int "Transport message segment retransmit attempts" - default 4 - range 1 8 - help - Maximum number of transport message segment retransmit attempts - for outgoing segment message. - -config BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST - int "Transport message segment retransmit interval for unicast messages" - default 400 - range 200 500 - help - Maximum time of retransmit segment message to unicast address. - -config BT_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP - int "Transport message segment retransmit interval for group messages" - default 50 - range 20 200 - help - Maximum time of retransmit segment message to group address. - -config BT_MESH_SEG_ACK_BASE_TIMEOUT - int "SegAck transmission base timeout" - default 150 - range 150 400 - help - Defines a base timeout for the acknowledgment timer used to delay - transmission of the Segmented Acknowledgment message. - -config BT_MESH_SEG_ACK_PER_HOP_TIMEOUT - int "SegAck transmission timeout per hop" - default 50 - range 50 250 - help - Defines an additional per-hop timeout for the acknowledgment timer - used to delay transmission of the Segmented Acknowledgment message. - -config BT_MESH_SEG_ACK_PER_SEGMENT_TIMEOUT - int "SegAck transmission timeout per segment not yet received" - default 0 - range 0 100 - help - Defines an additional timeout for the acknowledgment timer for every - segment not yet received. - -endif # !BT_MESH_V1d1 - endmenu # Transport SAR configuration config BT_MESH_DEFAULT_TTL @@ -1112,21 +1062,13 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -menuconfig BT_MESH_V1d1 - bool "Bluetooth Mesh v1.1 support" - help - This option enables Bluetooth Mesh v1.1 support. Bluetooth Mesh v1.1 - is backward compatible with v1.0.1. - config BT_MESH_ECDH_P256_CMAC_AES128_AES_CCM - bool "Support CMAC AES128 for OOB authentication" if BT_MESH_V1d1 + bool "Support CMAC AES128 for OOB authentication" depends on BT_MESH_PROV default y help Enable this option to support CMAC AES128 for OOB authentication. -if BT_MESH_V1d1 - config BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM bool "Support HMAC SHA256 for OOB authentication" depends on BT_MESH_PROV @@ -1696,8 +1638,6 @@ config BT_MESH_SAR_RX_ACK_RETRANS_COUNT endmenu -endif # BT_MESH_V1d1 - menu "Capabilities" config BT_MESH_SUBNET_COUNT diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 23fbb8e82c2..4ff80333187 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -2380,7 +2380,6 @@ size_t bt_mesh_comp_page_size(uint8_t page) int bt_mesh_comp_store(void) { -#if IS_ENABLED(CONFIG_BT_MESH_V1d1) NET_BUF_SIMPLE_DEFINE(buf, CONFIG_BT_MESH_COMP_PST_BUF_SIZE); int err; @@ -2410,7 +2409,7 @@ int bt_mesh_comp_store(void) LOG_DBG("Stored CDP%d", comp_data_pages[i].page); } -#endif + return 0; } diff --git a/subsys/bluetooth/mesh/beacon.c b/subsys/bluetooth/mesh/beacon.c index ef337f9f510..6eb2c9be3a7 100644 --- a/subsys/bluetooth/mesh/beacon.c +++ b/subsys/bluetooth/mesh/beacon.c @@ -528,7 +528,6 @@ static bool secure_beacon_authenticate(struct bt_mesh_subnet *sub, void *cb_data return false; } -#if defined(CONFIG_BT_MESH_V1d1) static bool priv_beacon_decrypt(struct bt_mesh_subnet *sub, void *cb_data) { struct beacon_params *params = cb_data; @@ -567,7 +566,6 @@ static bool priv_beacon_decrypt(struct bt_mesh_subnet *sub, void *cb_data) return false; } -#endif static void net_beacon_register(struct bt_mesh_beacon *beacon, bool priv) { @@ -658,7 +656,6 @@ static void secure_beacon_recv(struct net_buf_simple *buf) net_beacon_resolve(¶ms, secure_beacon_authenticate); } -#if defined(CONFIG_BT_MESH_V1d1) static void private_beacon_recv(struct net_buf_simple *buf) { struct beacon_params params; @@ -675,7 +672,6 @@ static void private_beacon_recv(struct net_buf_simple *buf) net_beacon_resolve(¶ms, priv_beacon_decrypt); } -#endif void bt_mesh_beacon_recv(struct net_buf_simple *buf) { @@ -699,9 +695,7 @@ void bt_mesh_beacon_recv(struct net_buf_simple *buf) secure_beacon_recv(buf); break; case BEACON_TYPE_PRIVATE: -#if defined(CONFIG_BT_MESH_V1d1) private_beacon_recv(buf); -#endif break; default: LOG_WRN("Unknown beacon type 0x%02x", type); diff --git a/subsys/bluetooth/mesh/net.c b/subsys/bluetooth/mesh/net.c index 943a5e83c23..07c6f1aa18a 100644 --- a/subsys/bluetooth/mesh/net.c +++ b/subsys/bluetooth/mesh/net.c @@ -35,10 +35,7 @@ #include "prov.h" #include "cfg.h" #include "statistic.h" - -#ifdef CONFIG_BT_MESH_V1d1 #include "sar_cfg_internal.h" -#endif #define LOG_LEVEL CONFIG_BT_MESH_NET_LOG_LEVEL #include @@ -84,10 +81,8 @@ static uint16_t msg_cache_next; /* Singleton network context (the implementation only supports one) */ struct bt_mesh_net bt_mesh = { .local_queue = SYS_SLIST_STATIC_INIT(&bt_mesh.local_queue), -#ifdef CONFIG_BT_MESH_V1d1 .sar_tx = BT_MESH_SAR_TX_INIT, .sar_rx = BT_MESH_SAR_RX_INIT, -#endif #if defined(CONFIG_BT_MESH_PRIV_BEACONS) .priv_beacon_int = 0x3c, diff --git a/subsys/bluetooth/mesh/subnet.h b/subsys/bluetooth/mesh/subnet.h index f19b1d2abea..e04f9855b66 100644 --- a/subsys/bluetooth/mesh/subnet.h +++ b/subsys/bluetooth/mesh/subnet.h @@ -76,9 +76,7 @@ struct bt_mesh_subnet { struct bt_mesh_key identity; /* IdentityKey */ #endif struct bt_mesh_key beacon; /* BeaconKey */ -#if defined(CONFIG_BT_MESH_V1d1) struct bt_mesh_key priv_beacon; /* PrivateBeaconKey */ -#endif } keys[2]; #if defined(CONFIG_BT_MESH_PROXY_SOLICITATION) bool sol_tx; diff --git a/subsys/bluetooth/mesh/transport_legacy.c b/subsys/bluetooth/mesh/transport_legacy.c deleted file mode 100644 index 1a826db4ac4..00000000000 --- a/subsys/bluetooth/mesh/transport_legacy.c +++ /dev/null @@ -1,1656 +0,0 @@ -/* - * Copyright (c) 2017 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include "common/bt_str.h" - -#include "host/testing.h" - -#include "crypto.h" -#include "mesh.h" -#include "net.h" -#include "app_keys.h" -#include "lpn.h" -#include "rpl.h" -#include "friend.h" -#include "access.h" -#include "foundation.h" -#include "settings.h" -#include "heartbeat.h" -#include "transport.h" -#include "va.h" - -#define LOG_LEVEL CONFIG_BT_MESH_TRANS_LOG_LEVEL -#include -LOG_MODULE_REGISTER(bt_mesh_transport); - -#define AID_MASK ((uint8_t)(BIT_MASK(6))) - -#define SEG(data) ((data)[0] >> 7) -#define AKF(data) (((data)[0] >> 6) & 0x01) -#define AID(data) ((data)[0] & AID_MASK) -#define ASZMIC(data) (((data)[1] >> 7) & 1) - -#define APP_MIC_LEN(aszmic) ((aszmic) ? BT_MESH_MIC_LONG : BT_MESH_MIC_SHORT) - -#define UNSEG_HDR(akf, aid) ((akf << 6) | (aid & AID_MASK)) -#define SEG_HDR(akf, aid) (UNSEG_HDR(akf, aid) | 0x80) - -#define BLOCK_COMPLETE(seg_n) (uint32_t)(((uint64_t)1 << (seg_n + 1)) - 1) - -#define SEQ_AUTH(iv_index, seq) (((uint64_t)iv_index) << 24 | (uint64_t)seq) - -/* Number of retransmit attempts (after the initial transmit) per segment */ -#define SEG_RETRANSMIT_ATTEMPTS CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT - -/* "This timer shall be set to a minimum of 200 + 50 * TTL milliseconds.". - * We use 400 since 300 is a common send duration for standard HCI, and we - * need to have a timeout that's bigger than that. - */ -#define SEG_RETRANSMIT_TIMEOUT_UNICAST(tx) \ - (CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST + 50 * (tx)->ttl) - -/* When sending to a group, the messages are not acknowledged, and there's no - * reason to delay the repetitions significantly. Delaying by more than 0 ms - * to avoid flooding the network. - */ -#define SEG_RETRANSMIT_TIMEOUT_GROUP CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP - -#define SEG_RETRANSMIT_TIMEOUT(tx) \ - (BT_MESH_ADDR_IS_UNICAST(tx->dst) ? \ - SEG_RETRANSMIT_TIMEOUT_UNICAST(tx) : \ - SEG_RETRANSMIT_TIMEOUT_GROUP) -/* How long to wait for available buffers before giving up */ -#define BUF_TIMEOUT K_NO_WAIT - -static struct seg_tx { - struct bt_mesh_subnet *sub; - void *seg[BT_MESH_TX_SEG_MAX]; - uint64_t seq_auth; - uint16_t src; - uint16_t dst; - uint16_t ack_src; - uint16_t len; - uint8_t hdr; - uint8_t xmit; - uint8_t seg_n; /* Last segment index */ - uint8_t seg_o; /* Segment being sent */ - uint8_t nack_count; /* Number of unacked segs */ - uint8_t attempts; /* Remaining tx attempts */ - uint8_t ttl; /* Transmitted TTL value */ - uint8_t blocked:1, /* Blocked by ongoing tx */ - ctl:1, /* Control packet */ - aszmic:1, /* MIC size */ - started:1, /* Start cb called */ - friend_cred:1, /* Using Friend credentials */ - seg_send_started:1; /* Used to check if seg_send_start cb is called */ - const struct bt_mesh_send_cb *cb; - void *cb_data; - struct k_work_delayable retransmit; /* Retransmit timer */ -} seg_tx[CONFIG_BT_MESH_TX_SEG_MSG_COUNT]; - -static struct seg_rx { - struct bt_mesh_subnet *sub; - void *seg[BT_MESH_RX_SEG_MAX]; - uint64_t seq_auth; - uint16_t src; - uint16_t dst; - uint16_t len; - uint8_t hdr; - uint8_t seg_n:5, - ctl:1, - in_use:1, - obo:1; - uint8_t ttl; - uint32_t block; - uint32_t last; - struct k_work_delayable ack; -} seg_rx[CONFIG_BT_MESH_RX_SEG_MSG_COUNT]; - -K_MEM_SLAB_DEFINE(segs, BT_MESH_APP_SEG_SDU_MAX, CONFIG_BT_MESH_SEG_BUFS, 4); - -static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, - const struct bt_mesh_send_cb *cb, void *cb_data, - const uint8_t *ctl_op) -{ - struct bt_mesh_adv *adv; - - adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, - tx->xmit, BUF_TIMEOUT); - if (!adv) { - LOG_ERR("Out of network advs"); - return -ENOBUFS; - } - - net_buf_simple_reserve(&adv->b, BT_MESH_NET_HDR_LEN); - - if (ctl_op) { - net_buf_simple_add_u8(&adv->b, TRANS_CTL_HDR(*ctl_op, 0)); - } else if (BT_MESH_IS_DEV_KEY(tx->ctx->app_idx)) { - net_buf_simple_add_u8(&adv->b, UNSEG_HDR(0, 0)); - } else { - net_buf_simple_add_u8(&adv->b, UNSEG_HDR(1, tx->aid)); - } - - net_buf_simple_add_mem(&adv->b, sdu->data, sdu->len); - - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { - if (!bt_mesh_friend_queue_has_space(tx->sub->net_idx, - tx->src, tx->ctx->addr, - NULL, 1)) { - if (BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { - LOG_ERR("Not enough space in Friend Queue"); - bt_mesh_adv_unref(adv); - return -ENOBUFS; - } - - LOG_WRN("No space in Friend Queue"); - goto send; - } - - if (bt_mesh_friend_enqueue_tx(tx, BT_MESH_FRIEND_PDU_SINGLE, - NULL, 1, &adv->b) && - BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { - /* PDUs for a specific Friend should only go - * out through the Friend Queue. - */ - bt_mesh_adv_unref(adv); - send_cb_finalize(cb, cb_data); - return 0; - } - } - -send: - return bt_mesh_net_send(tx, adv, cb, cb_data); -} - -static inline uint8_t seg_len(bool ctl) -{ - if (ctl) { - return BT_MESH_CTL_SEG_SDU_MAX; - } else { - return BT_MESH_APP_SEG_SDU_MAX; - } -} - -bool bt_mesh_tx_in_progress(void) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(seg_tx); i++) { - if (seg_tx[i].nack_count) { - return true; - } - } - - return false; -} - -static void seg_tx_done(struct seg_tx *tx, uint8_t seg_idx) -{ - k_mem_slab_free(&segs, (void *)tx->seg[seg_idx]); - tx->seg[seg_idx] = NULL; - tx->nack_count--; -} - -static bool seg_tx_blocks(struct seg_tx *tx, uint16_t src, uint16_t dst) -{ - return (tx->src == src) && (tx->dst == dst); -} - -static void seg_tx_unblock_check(struct seg_tx *tx) -{ - struct seg_tx *blocked = NULL; - int i; - - /* Unblock the first blocked tx with the same params. */ - for (i = 0; i < ARRAY_SIZE(seg_tx); ++i) { - if (&seg_tx[i] != tx && - seg_tx[i].blocked && - seg_tx_blocks(tx, seg_tx[i].src, seg_tx[i].dst) && - (!blocked || seg_tx[i].seq_auth < blocked->seq_auth)) { - blocked = &seg_tx[i]; - } - } - - if (blocked) { - LOG_DBG("Unblocked 0x%04x", (uint16_t)(blocked->seq_auth & TRANS_SEQ_ZERO_MASK)); - blocked->blocked = false; - k_work_reschedule(&blocked->retransmit, K_NO_WAIT); - } -} - -static void seg_tx_reset(struct seg_tx *tx) -{ - int i; - - /* If this call fails, the handler will exit early, as nack_count is 0. */ - (void)k_work_cancel_delayable(&tx->retransmit); - - tx->cb = NULL; - tx->cb_data = NULL; - tx->seq_auth = 0U; - tx->sub = NULL; - tx->src = BT_MESH_ADDR_UNASSIGNED; - tx->dst = BT_MESH_ADDR_UNASSIGNED; - tx->ack_src = BT_MESH_ADDR_UNASSIGNED; - tx->blocked = false; - - for (i = 0; i <= tx->seg_n && tx->nack_count; i++) { - if (!tx->seg[i]) { - continue; - } - - seg_tx_done(tx, i); - } - - tx->nack_count = 0; - tx->seg_send_started = 0; - - if (atomic_test_and_clear_bit(bt_mesh.flags, BT_MESH_IVU_PENDING)) { - LOG_DBG("Proceeding with pending IV Update"); - /* bt_mesh_net_iv_update() will re-enable the flag if this - * wasn't the only transfer. - */ - bt_mesh_net_iv_update(bt_mesh.iv_index, false); - } -} - -static inline void seg_tx_complete(struct seg_tx *tx, int err) -{ - const struct bt_mesh_send_cb *cb = tx->cb; - void *cb_data = tx->cb_data; - - seg_tx_unblock_check(tx); - - seg_tx_reset(tx); - - if (cb && cb->end) { - cb->end(err, cb_data); - } -} - -static void schedule_retransmit(struct seg_tx *tx) -{ - if (!tx->nack_count) { - return; - } - - LOG_DBG(""); - - /* If we haven't gone through all the segments for this attempt yet, - * (likely because of a buffer allocation failure or because we - * called this from inside bt_mesh_net_send), we should continue the - * retransmit immediately, as we just freed up a tx buffer. - */ - k_work_reschedule(&tx->retransmit, K_NO_WAIT); -} - -static void seg_send_start(uint16_t duration, int err, void *user_data) -{ - struct seg_tx *tx = user_data; - - if (!tx->started && tx->cb && tx->cb->start) { - tx->cb->start(duration, err, tx->cb_data); - tx->started = 1U; - } - - tx->seg_send_started = 1U; - - /* If there's an error in transmitting the 'sent' callback will never - * be called. Make sure that we kick the retransmit timer also in this - * case since otherwise we risk the transmission of becoming stale. - */ - if (err) { - schedule_retransmit(tx); - } -} - -static void seg_sent(int err, void *user_data) -{ - struct seg_tx *tx = user_data; - - if (!tx->seg_send_started) { - return; - } - - schedule_retransmit(tx); -} - -static const struct bt_mesh_send_cb seg_sent_cb = { - .start = seg_send_start, - .end = seg_sent, -}; - -static void seg_tx_buf_build(struct seg_tx *tx, uint8_t seg_o, - struct net_buf_simple *buf) -{ - uint16_t seq_zero = tx->seq_auth & TRANS_SEQ_ZERO_MASK; - uint8_t len = MIN(seg_len(tx->ctl), tx->len - (seg_len(tx->ctl) * seg_o)); - - net_buf_simple_add_u8(buf, tx->hdr); - net_buf_simple_add_u8(buf, (tx->aszmic << 7) | seq_zero >> 6); - net_buf_simple_add_u8(buf, (((seq_zero & 0x3f) << 2) | (seg_o >> 3))); - net_buf_simple_add_u8(buf, ((seg_o & 0x07) << 5) | tx->seg_n); - net_buf_simple_add_mem(buf, tx->seg[seg_o], len); -} - -static void seg_tx_send_unacked(struct seg_tx *tx) -{ - if (!tx->nack_count) { - return; - } - - struct bt_mesh_msg_ctx ctx = { - .net_idx = tx->sub->net_idx, - /* App idx only used by network to detect control messages: */ - .app_idx = (tx->ctl ? BT_MESH_KEY_UNUSED : 0), - .addr = tx->dst, - .send_rel = true, - .send_ttl = tx->ttl, - }; - struct bt_mesh_net_tx net_tx = { - .sub = tx->sub, - .ctx = &ctx, - .src = tx->src, - .xmit = tx->xmit, - .friend_cred = tx->friend_cred, - .aid = tx->hdr & AID_MASK, - }; - - if (!tx->attempts) { - if (BT_MESH_ADDR_IS_UNICAST(tx->dst)) { - LOG_ERR("Ran out of retransmit attempts"); - seg_tx_complete(tx, -ETIMEDOUT); - } else { - /* Segmented sending to groups doesn't have acks, so - * running out of attempts is the expected behavior. - */ - seg_tx_complete(tx, 0); - } - - return; - } - - LOG_DBG("SeqZero: 0x%04x Attempts: %u", (uint16_t)(tx->seq_auth & TRANS_SEQ_ZERO_MASK), - tx->attempts); - - while (tx->seg_o <= tx->seg_n) { - struct bt_mesh_adv *seg; - int err; - - if (!tx->seg[tx->seg_o]) { - /* Move on to the next segment */ - tx->seg_o++; - continue; - } - - seg = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, - tx->xmit, BUF_TIMEOUT); - if (!seg) { - LOG_DBG("Allocating segment failed"); - goto end; - } - - net_buf_simple_reserve(&seg->b, BT_MESH_NET_HDR_LEN); - seg_tx_buf_build(tx, tx->seg_o, &seg->b); - - LOG_DBG("Sending %u/%u", tx->seg_o, tx->seg_n); - - err = bt_mesh_net_send(&net_tx, seg, &seg_sent_cb, tx); - if (err) { - LOG_DBG("Sending segment failed"); - goto end; - } - - /* Move on to the next segment */ - tx->seg_o++; - - return; - } - - tx->seg_o = 0U; - tx->attempts--; - -end: - if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER) && - bt_mesh_lpn_established() && !bt_mesh_has_addr(ctx.addr)) { - bt_mesh_lpn_poll(); - } - - k_work_reschedule(&tx->retransmit, K_MSEC(SEG_RETRANSMIT_TIMEOUT(tx))); -} - -static void seg_retransmit(struct k_work *work) -{ - struct k_work_delayable *dwork = k_work_delayable_from_work(work); - struct seg_tx *tx = CONTAINER_OF(dwork, struct seg_tx, retransmit); - - seg_tx_send_unacked(tx); -} - -static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu, - const struct bt_mesh_send_cb *cb, void *cb_data, - uint8_t *ctl_op) -{ - bool blocked = false; - struct seg_tx *tx; - uint8_t seg_o; - int i; - - LOG_DBG("src 0x%04x dst 0x%04x app_idx 0x%04x aszmic %u sdu_len %u", net_tx->src, - net_tx->ctx->addr, net_tx->ctx->app_idx, net_tx->aszmic, sdu->len); - - for (tx = NULL, i = 0; i < ARRAY_SIZE(seg_tx); i++) { - if (seg_tx[i].nack_count) { - blocked |= seg_tx_blocks(&seg_tx[i], net_tx->src, - net_tx->ctx->addr); - } else if (!tx) { - tx = &seg_tx[i]; - } - } - - if (!tx) { - LOG_ERR("No multi-segment message contexts available"); - return -EBUSY; - } - - if (ctl_op) { - tx->hdr = TRANS_CTL_HDR(*ctl_op, 1); - } else if (BT_MESH_IS_DEV_KEY(net_tx->ctx->app_idx)) { - tx->hdr = SEG_HDR(0, 0); - } else { - tx->hdr = SEG_HDR(1, net_tx->aid); - } - - tx->src = net_tx->src; - tx->dst = net_tx->ctx->addr; - tx->seg_n = (sdu->len - 1) / seg_len(!!ctl_op); - tx->seg_o = 0; - tx->len = sdu->len; - tx->nack_count = tx->seg_n + 1; - tx->seq_auth = SEQ_AUTH(BT_MESH_NET_IVI_TX, bt_mesh.seq); - tx->sub = net_tx->sub; - tx->cb = cb; - tx->cb_data = cb_data; - tx->attempts = SEG_RETRANSMIT_ATTEMPTS; - tx->xmit = net_tx->xmit; - tx->aszmic = net_tx->aszmic; - tx->friend_cred = net_tx->friend_cred; - tx->blocked = blocked; - tx->started = 0; - tx->seg_send_started = 0; - tx->ctl = !!ctl_op; - tx->ttl = net_tx->ctx->send_ttl; - - LOG_DBG("SeqZero 0x%04x (segs: %u)", (uint16_t)(tx->seq_auth & TRANS_SEQ_ZERO_MASK), - tx->nack_count); - - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && - !bt_mesh_friend_queue_has_space(tx->sub->net_idx, net_tx->src, - tx->dst, &tx->seq_auth, - tx->seg_n + 1) && - BT_MESH_ADDR_IS_UNICAST(tx->dst)) { - LOG_ERR("Not enough space in Friend Queue for %u segments", tx->seg_n + 1); - seg_tx_reset(tx); - return -ENOBUFS; - } - - for (seg_o = 0U; sdu->len; seg_o++) { - void *buf; - uint16_t len; - int err; - - err = k_mem_slab_alloc(&segs, &buf, BUF_TIMEOUT); - if (err) { - LOG_ERR("Out of segment buffers"); - seg_tx_reset(tx); - return -ENOBUFS; - } - - len = MIN(sdu->len, seg_len(!!ctl_op)); - memcpy(buf, net_buf_simple_pull_mem(sdu, len), len); - - LOG_DBG("seg %u: %s", seg_o, bt_hex(buf, len)); - - tx->seg[seg_o] = buf; - - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { - enum bt_mesh_friend_pdu_type type; - - NET_BUF_SIMPLE_DEFINE(seg, 16); - seg_tx_buf_build(tx, seg_o, &seg); - - if (seg_o == tx->seg_n) { - type = BT_MESH_FRIEND_PDU_COMPLETE; - } else { - type = BT_MESH_FRIEND_PDU_PARTIAL; - } - - if (bt_mesh_friend_enqueue_tx( - net_tx, type, ctl_op ? NULL : &tx->seq_auth, - tx->seg_n + 1, &seg) && - BT_MESH_ADDR_IS_UNICAST(net_tx->ctx->addr)) { - /* PDUs for a specific Friend should only go - * out through the Friend Queue. - */ - k_mem_slab_free(&segs, buf); - tx->seg[seg_o] = NULL; - } - - } - - } - - /* This can happen if segments only went into the Friend Queue */ - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && !tx->seg[0]) { - seg_tx_reset(tx); - - /* If there was a callback notify sending immediately since - * there's no other way to track this (at least currently) - * with the Friend Queue. - */ - send_cb_finalize(cb, cb_data); - return 0; - } - - if (blocked) { - /* Move the sequence number, so we don't end up creating - * another segmented transmission with the same SeqZero while - * this one is blocked. - */ - bt_mesh_next_seq(); - LOG_DBG("Blocked."); - return 0; - } - - seg_tx_send_unacked(tx); - - return 0; -} - -static int trans_encrypt(const struct bt_mesh_net_tx *tx, const struct bt_mesh_key *key, - struct net_buf_simple *msg) -{ - struct bt_mesh_app_crypto_ctx crypto = { - .dev_key = BT_MESH_IS_DEV_KEY(tx->ctx->app_idx), - .aszmic = tx->aszmic, - .src = tx->src, - .dst = tx->ctx->addr, - .seq_num = bt_mesh.seq, - .iv_index = BT_MESH_NET_IVI_TX, - }; - - if (BT_MESH_ADDR_IS_VIRTUAL(tx->ctx->addr)) { - crypto.ad = tx->ctx->uuid; - if (crypto.ad == NULL) { - return -ENOENT; - } - } - - return bt_mesh_app_encrypt(key, &crypto, msg); -} - -int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg, - const struct bt_mesh_send_cb *cb, void *cb_data) -{ - const struct bt_mesh_key *key; - uint8_t aid; - int err; - - if (msg->len < 1) { - LOG_ERR("Zero-length SDU not allowed"); - return -EINVAL; - } - - if (msg->len > BT_MESH_TX_SDU_MAX - BT_MESH_MIC_SHORT) { - LOG_ERR("Message too big: %u", msg->len); - return -EMSGSIZE; - } - - if (net_buf_simple_tailroom(msg) < BT_MESH_MIC_SHORT) { - LOG_ERR("Insufficient tailroom for Transport MIC"); - return -EINVAL; - } - - if (tx->ctx->send_ttl == BT_MESH_TTL_DEFAULT) { - tx->ctx->send_ttl = bt_mesh_default_ttl_get(); - } else if (tx->ctx->send_ttl > BT_MESH_TTL_MAX) { - LOG_ERR("TTL too large (max 127)"); - return -EINVAL; - } - - if (msg->len > BT_MESH_SDU_UNSEG_MAX) { - tx->ctx->send_rel = true; - } - - if (tx->ctx->addr == BT_MESH_ADDR_UNASSIGNED || - (!BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr) && - BT_MESH_IS_DEV_KEY(tx->ctx->app_idx))) { - LOG_ERR("Invalid destination address"); - return -EINVAL; - } - - err = bt_mesh_keys_resolve(tx->ctx, &tx->sub, &key, &aid); - if (err) { - return err; - } - - LOG_DBG("net_idx 0x%04x app_idx 0x%04x dst 0x%04x", tx->sub->net_idx, tx->ctx->app_idx, - tx->ctx->addr); - LOG_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len)); - - tx->xmit = bt_mesh_net_transmit_get(); - tx->aid = aid; - - if (!tx->ctx->send_rel || net_buf_simple_tailroom(msg) < 8) { - tx->aszmic = 0U; - } else { - tx->aszmic = 1U; - } - - err = trans_encrypt(tx, key, msg); - if (err) { - return err; - } - - if (tx->ctx->send_rel) { - err = send_seg(tx, msg, cb, cb_data, NULL); - } else { - err = send_unseg(tx, msg, cb, cb_data, NULL); - } - - return err; -} - -static void seg_rx_assemble(struct seg_rx *rx, struct net_buf_simple *buf, - uint8_t aszmic) -{ - int i; - - net_buf_simple_reset(buf); - - for (i = 0; i <= rx->seg_n; i++) { - net_buf_simple_add_mem(buf, rx->seg[i], - MIN(seg_len(rx->ctl), - rx->len - (i * seg_len(rx->ctl)))); - } - - /* Adjust the length to not contain the MIC at the end */ - if (!rx->ctl) { - buf->len -= APP_MIC_LEN(aszmic); - } -} - -struct decrypt_ctx { - struct bt_mesh_app_crypto_ctx crypto; - struct net_buf_simple *buf; - struct net_buf_simple *sdu; - struct seg_rx *seg; -}; - -static int sdu_try_decrypt(struct bt_mesh_net_rx *rx, const struct bt_mesh_key *key, - void *cb_data) -{ - struct decrypt_ctx *ctx = cb_data; - int err; - - ctx->crypto.ad = NULL; - - do { - if (ctx->seg) { - seg_rx_assemble(ctx->seg, ctx->buf, ctx->crypto.aszmic); - } - - if (BT_MESH_ADDR_IS_VIRTUAL(rx->ctx.recv_dst)) { - ctx->crypto.ad = bt_mesh_va_uuid_get(rx->ctx.recv_dst, ctx->crypto.ad, - NULL); - - if (!ctx->crypto.ad) { - return -ENOENT; - } - } - - net_buf_simple_reset(ctx->sdu); - - err = bt_mesh_app_decrypt(key, &ctx->crypto, ctx->buf, ctx->sdu); - } while (err && ctx->crypto.ad != NULL); - - if (!err && BT_MESH_ADDR_IS_VIRTUAL(rx->ctx.recv_dst)) { - rx->ctx.uuid = ctx->crypto.ad; - } - - return err; -} - -static int sdu_recv(struct bt_mesh_net_rx *rx, uint8_t hdr, uint8_t aszmic, - struct net_buf_simple *buf, struct net_buf_simple *sdu, - struct seg_rx *seg) -{ - struct decrypt_ctx ctx = { - .crypto = { - .dev_key = !AKF(&hdr), - .aszmic = aszmic, - .src = rx->ctx.addr, - .dst = rx->ctx.recv_dst, - .seq_num = seg ? (seg->seq_auth & 0xffffff) : rx->seq, - .iv_index = BT_MESH_NET_IVI_RX(rx), - }, - .buf = buf, - .sdu = sdu, - .seg = seg, - }; - - LOG_DBG("AKF %u AID 0x%02x", !ctx.crypto.dev_key, AID(&hdr)); - - if (!rx->local_match) { - return 0; - } - - rx->ctx.app_idx = bt_mesh_app_key_find(ctx.crypto.dev_key, AID(&hdr), - rx, sdu_try_decrypt, &ctx); - if (rx->ctx.app_idx == BT_MESH_KEY_UNUSED) { - LOG_DBG("No matching AppKey"); - return 0; - } - - LOG_DBG("Decrypted (AppIdx: 0x%03x)", rx->ctx.app_idx); - - bt_mesh_model_recv(&rx->ctx, sdu); - - return 0; -} - -static struct seg_tx *seg_tx_lookup(uint16_t seq_zero, uint8_t obo, uint16_t addr) -{ - struct seg_tx *tx; - int i; - - for (i = 0; i < ARRAY_SIZE(seg_tx); i++) { - tx = &seg_tx[i]; - - if ((tx->seq_auth & TRANS_SEQ_ZERO_MASK) != seq_zero) { - continue; - } - - if (tx->dst == addr) { - return tx; - } - - /* If the expected remote address doesn't match, - * but the OBO flag is set and this is the first - * acknowledgment, assume it's a Friend that's - * responding and therefore accept the message. - */ - if (obo && (tx->nack_count == tx->seg_n + 1 || tx->ack_src == addr)) { - tx->ack_src = addr; - return tx; - } - } - - return NULL; -} - -static int trans_ack(struct bt_mesh_net_rx *rx, uint8_t hdr, - struct net_buf_simple *buf, uint64_t *seq_auth) -{ - struct seg_tx *tx; - unsigned int bit; - uint32_t ack; - uint16_t seq_zero; - uint8_t obo; - - if (buf->len < 6) { - LOG_ERR("Too short ack message"); - return -EINVAL; - } - - seq_zero = net_buf_simple_pull_be16(buf); - obo = seq_zero >> 15; - seq_zero = (seq_zero >> 2) & TRANS_SEQ_ZERO_MASK; - - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && rx->friend_match) { - LOG_DBG("Ack for LPN 0x%04x of this Friend", rx->ctx.recv_dst); - /* Best effort - we don't have enough info for true SeqAuth */ - *seq_auth = SEQ_AUTH(BT_MESH_NET_IVI_RX(rx), seq_zero); - return 0; - } - - ack = net_buf_simple_pull_be32(buf); - - LOG_DBG("OBO %u seq_zero 0x%04x ack 0x%08x", obo, seq_zero, ack); - - tx = seg_tx_lookup(seq_zero, obo, rx->ctx.addr); - if (!tx) { - LOG_WRN("No matching TX context for ack"); - return -EINVAL; - } - - if (!BT_MESH_ADDR_IS_UNICAST(tx->dst)) { - LOG_ERR("Received ack for group seg"); - return -EINVAL; - } - - *seq_auth = tx->seq_auth; - - if (!ack) { - LOG_WRN("SDU canceled"); - seg_tx_complete(tx, -ECANCELED); - return 0; - } - - if (find_msb_set(ack) - 1 > tx->seg_n) { - LOG_ERR("Too large segment number in ack"); - return -EINVAL; - } - - while ((bit = find_lsb_set(ack))) { - if (tx->seg[bit - 1]) { - LOG_DBG("seg %u/%u acked", bit - 1, tx->seg_n); - seg_tx_done(tx, bit - 1); - } - - ack &= ~BIT(bit - 1); - } - - if (tx->nack_count) { - /* According to MshPRFv1.0.1: 3.5.3.3, we should reset the retransmit timer and - * retransmit immediately when receiving a valid ack message. Don't reset the - * retransmit timer if we didn't finish sending segments. - */ - if (tx->seg_o == 0) { - k_work_reschedule(&tx->retransmit, K_NO_WAIT); - } - } else { - LOG_DBG("SDU TX complete"); - seg_tx_complete(tx, 0); - } - - return 0; -} - -static int ctl_recv(struct bt_mesh_net_rx *rx, uint8_t hdr, - struct net_buf_simple *buf, uint64_t *seq_auth) -{ - uint8_t ctl_op = TRANS_CTL_OP(&hdr); - - LOG_DBG("OpCode 0x%02x len %u", ctl_op, buf->len); - - switch (ctl_op) { - case TRANS_CTL_OP_ACK: - return trans_ack(rx, hdr, buf, seq_auth); - case TRANS_CTL_OP_HEARTBEAT: - return bt_mesh_hb_recv(rx, buf); - } - - /* Only acks and heartbeats may need processing without local_match */ - if (!rx->local_match) { - return 0; - } - - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && !bt_mesh_lpn_established()) { - switch (ctl_op) { - case TRANS_CTL_OP_FRIEND_POLL: - return bt_mesh_friend_poll(rx, buf); - case TRANS_CTL_OP_FRIEND_REQ: - return bt_mesh_friend_req(rx, buf); - case TRANS_CTL_OP_FRIEND_CLEAR: - return bt_mesh_friend_clear(rx, buf); - case TRANS_CTL_OP_FRIEND_CLEAR_CFM: - return bt_mesh_friend_clear_cfm(rx, buf); - case TRANS_CTL_OP_FRIEND_SUB_ADD: - return bt_mesh_friend_sub_add(rx, buf); - case TRANS_CTL_OP_FRIEND_SUB_REM: - return bt_mesh_friend_sub_rem(rx, buf); - } - } - -#if defined(CONFIG_BT_MESH_LOW_POWER) - if (ctl_op == TRANS_CTL_OP_FRIEND_OFFER) { - return bt_mesh_lpn_friend_offer(rx, buf); - } - - if (rx->ctx.addr == bt_mesh.lpn.frnd) { - if (ctl_op == TRANS_CTL_OP_FRIEND_CLEAR_CFM) { - return bt_mesh_lpn_friend_clear_cfm(rx, buf); - } - - if (!rx->friend_cred) { - LOG_WRN("Message from friend with wrong credentials"); - return -EINVAL; - } - - switch (ctl_op) { - case TRANS_CTL_OP_FRIEND_UPDATE: - return bt_mesh_lpn_friend_update(rx, buf); - case TRANS_CTL_OP_FRIEND_SUB_CFM: - return bt_mesh_lpn_friend_sub_cfm(rx, buf); - } - } -#endif /* CONFIG_BT_MESH_LOW_POWER */ - - LOG_WRN("Unhandled TransOpCode 0x%02x", ctl_op); - - return -ENOENT; -} - -static int trans_unseg(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx, - uint64_t *seq_auth) -{ - NET_BUF_SIMPLE_DEFINE_STATIC(sdu, BT_MESH_SDU_UNSEG_MAX); - uint8_t hdr; - - LOG_DBG("AFK %u AID 0x%02x", AKF(buf->data), AID(buf->data)); - - if (buf->len < 1) { - LOG_ERR("Too small unsegmented PDU"); - return -EINVAL; - } - - if (bt_mesh_rpl_check(rx, NULL)) { - LOG_WRN("Replay: src 0x%04x dst 0x%04x seq 0x%06x", rx->ctx.addr, rx->ctx.recv_dst, - rx->seq); - return -EINVAL; - } - - hdr = net_buf_simple_pull_u8(buf); - - if (rx->ctl) { - return ctl_recv(rx, hdr, buf, seq_auth); - } - - if (buf->len < 1 + APP_MIC_LEN(0)) { - LOG_ERR("Too short SDU + MIC"); - return -EINVAL; - } - - /* Adjust the length to not contain the MIC at the end */ - buf->len -= APP_MIC_LEN(0); - - return sdu_recv(rx, hdr, 0, buf, &sdu, NULL); -} - -static inline int32_t ack_timeout(struct seg_rx *rx) -{ - int32_t to; - uint8_t ttl; - - if (rx->ttl == BT_MESH_TTL_DEFAULT) { - ttl = bt_mesh_default_ttl_get(); - } else { - ttl = rx->ttl; - } - - /* The acknowledgment timer shall be set to a minimum of - * 150 + 50 * TTL milliseconds. - */ - to = CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT + - (ttl * (int32_t)CONFIG_BT_MESH_SEG_ACK_PER_HOP_TIMEOUT); - - /* Add timeout for evenry not yet received segment. */ - to += ((rx->seg_n + 1) - POPCOUNT(rx->block)) * - (int32_t)CONFIG_BT_MESH_SEG_ACK_PER_SEGMENT_TIMEOUT; - - /* Make sure we don't send more frequently than the duration for - * each packet (default is 400ms). - */ - return MAX(to, 400); -} - -int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data, - size_t data_len, - const struct bt_mesh_send_cb *cb, void *cb_data) -{ - struct net_buf_simple buf; - - if (tx->ctx->send_ttl == BT_MESH_TTL_DEFAULT) { - tx->ctx->send_ttl = bt_mesh_default_ttl_get(); - } else if (tx->ctx->send_ttl > BT_MESH_TTL_MAX) { - LOG_ERR("TTL too large (max 127)"); - return -EINVAL; - } - - net_buf_simple_init_with_data(&buf, data, data_len); - - if (data_len > BT_MESH_SDU_UNSEG_MAX) { - tx->ctx->send_rel = true; - } - - tx->ctx->app_idx = BT_MESH_KEY_UNUSED; - - if (tx->ctx->addr == BT_MESH_ADDR_UNASSIGNED || - BT_MESH_ADDR_IS_VIRTUAL(tx->ctx->addr)) { - LOG_ERR("Invalid destination address"); - return -EINVAL; - } - - LOG_DBG("src 0x%04x dst 0x%04x ttl 0x%02x ctl 0x%02x", tx->src, tx->ctx->addr, - tx->ctx->send_ttl, ctl_op); - LOG_DBG("len %zu: %s", data_len, bt_hex(data, data_len)); - - if (tx->ctx->send_rel) { - return send_seg(tx, &buf, cb, cb_data, &ctl_op); - } else { - return send_unseg(tx, &buf, cb, cb_data, &ctl_op); - } -} - -static int send_ack(struct bt_mesh_subnet *sub, uint16_t src, uint16_t dst, - uint8_t ttl, uint64_t *seq_auth, uint32_t block, uint8_t obo) -{ - struct bt_mesh_msg_ctx ctx = { - .net_idx = sub->net_idx, - .app_idx = BT_MESH_KEY_UNUSED, - .addr = dst, - .send_ttl = ttl, - }; - struct bt_mesh_net_tx tx = { - .sub = sub, - .ctx = &ctx, - .src = obo ? bt_mesh_primary_addr() : src, - .xmit = bt_mesh_net_transmit_get(), - }; - uint16_t seq_zero = *seq_auth & TRANS_SEQ_ZERO_MASK; - uint8_t buf[6]; - - LOG_DBG("SeqZero 0x%04x Block 0x%08x OBO %u", seq_zero, block, obo); - - if (bt_mesh_lpn_established() && !bt_mesh_has_addr(ctx.addr)) { - LOG_WRN("Not sending ack when LPN is enabled"); - return 0; - } - - /* This can happen if the segmented message was destined for a group - * or virtual address. - */ - if (!BT_MESH_ADDR_IS_UNICAST(src)) { - LOG_DBG("Not sending ack for non-unicast address"); - return 0; - } - - sys_put_be16(((seq_zero << 2) & 0x7ffc) | (obo << 15), buf); - sys_put_be32(block, &buf[2]); - - return bt_mesh_ctl_send(&tx, TRANS_CTL_OP_ACK, buf, sizeof(buf), - NULL, NULL); -} - -static void seg_rx_reset(struct seg_rx *rx, bool full_reset) -{ - int i; - - LOG_DBG("rx %p", rx); - - /* If this fails, the handler will exit early on the next execution, as - * it checks rx->in_use. - */ - (void)k_work_cancel_delayable(&rx->ack); - - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && rx->obo && - rx->block != BLOCK_COMPLETE(rx->seg_n)) { - LOG_WRN("Clearing incomplete buffers from Friend queue"); - bt_mesh_friend_clear_incomplete(rx->sub, rx->src, rx->dst, - &rx->seq_auth); - } - - for (i = 0; i <= rx->seg_n; i++) { - if (!rx->seg[i]) { - continue; - } - - k_mem_slab_free(&segs, rx->seg[i]); - rx->seg[i] = NULL; - } - - rx->in_use = 0U; - - /* We don't always reset these values since we need to be able to - * send an ack if we receive a segment after we've already received - * the full SDU. - */ - if (full_reset) { - rx->seq_auth = 0U; - rx->sub = NULL; - rx->src = BT_MESH_ADDR_UNASSIGNED; - rx->dst = BT_MESH_ADDR_UNASSIGNED; - } -} - -static void seg_ack(struct k_work *work) -{ - struct k_work_delayable *dwork = k_work_delayable_from_work(work); - struct seg_rx *rx = CONTAINER_OF(dwork, struct seg_rx, ack); - int32_t timeout; - - if (!rx->in_use || rx->block == BLOCK_COMPLETE(rx->seg_n)) { - /* Cancellation of this timer may have failed. If it fails as - * part of seg_reset, in_use will be false. - * If it fails as part of the processing of a fully received - * SDU, the ack is already being sent from the receive handler, - * and the timer based ack sending can be ignored. - */ - return; - } - - LOG_DBG("rx %p", rx); - - if (k_uptime_get_32() - rx->last > (60 * MSEC_PER_SEC)) { - LOG_WRN("Incomplete timer expired"); - seg_rx_reset(rx, false); - - if (IS_ENABLED(CONFIG_BT_TESTING)) { - bt_test_mesh_trans_incomp_timer_exp(); - } - - return; - } - - send_ack(rx->sub, rx->dst, rx->src, rx->ttl, &rx->seq_auth, - rx->block, rx->obo); - - timeout = ack_timeout(rx); - k_work_schedule(&rx->ack, K_MSEC(timeout)); -} - -static inline bool sdu_len_is_ok(bool ctl, uint8_t seg_n) -{ - return (seg_n < BT_MESH_RX_SEG_MAX); -} - -static struct seg_rx *seg_rx_find(struct bt_mesh_net_rx *net_rx, - const uint64_t *seq_auth) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(seg_rx); i++) { - struct seg_rx *rx = &seg_rx[i]; - - if (rx->src != net_rx->ctx.addr || - rx->dst != net_rx->ctx.recv_dst) { - continue; - } - - /* Return newer RX context in addition to an exact match, so - * the calling function can properly discard an old SeqAuth. - */ - if (rx->seq_auth >= *seq_auth) { - return rx; - } - - if (rx->in_use) { - LOG_WRN("Duplicate SDU from src 0x%04x", net_rx->ctx.addr); - - /* Clear out the old context since the sender - * has apparently started sending a new SDU. - */ - seg_rx_reset(rx, true); - - /* Return non-match so caller can re-allocate */ - return NULL; - } - } - - return NULL; -} - -static bool seg_rx_is_valid(struct seg_rx *rx, struct bt_mesh_net_rx *net_rx, - const uint8_t *hdr, uint8_t seg_n) -{ - if (rx->hdr != *hdr || rx->seg_n != seg_n) { - LOG_ERR("Invalid segment for ongoing session"); - return false; - } - - if (rx->src != net_rx->ctx.addr || rx->dst != net_rx->ctx.recv_dst) { - LOG_ERR("Invalid source or destination for segment"); - return false; - } - - if (rx->ctl != net_rx->ctl) { - LOG_ERR("Inconsistent CTL in segment"); - return false; - } - - return true; -} - -static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx, - const uint8_t *hdr, const uint64_t *seq_auth, - uint8_t seg_n) -{ - int i; - - /* No race condition on this check, as this function only executes in - * the collaborative Bluetooth rx thread: - */ - if (k_mem_slab_num_free_get(&segs) < 1) { - LOG_WRN("Not enough segments for incoming message"); - return NULL; - } - - for (i = 0; i < ARRAY_SIZE(seg_rx); i++) { - struct seg_rx *rx = &seg_rx[i]; - - if (rx->in_use) { - continue; - } - - rx->in_use = 1U; - rx->sub = net_rx->sub; - rx->ctl = net_rx->ctl; - rx->seq_auth = *seq_auth; - rx->seg_n = seg_n; - rx->hdr = *hdr; - rx->ttl = net_rx->ctx.send_ttl; - rx->src = net_rx->ctx.addr; - rx->dst = net_rx->ctx.recv_dst; - rx->block = 0U; - - LOG_DBG("New RX context. Block Complete 0x%08x", BLOCK_COMPLETE(seg_n)); - - return rx; - } - - return NULL; -} - -static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx, - enum bt_mesh_friend_pdu_type *pdu_type, uint64_t *seq_auth, - uint8_t *seg_count) -{ - struct bt_mesh_rpl *rpl = NULL; - struct seg_rx *rx; - uint8_t *hdr = buf->data; - uint16_t seq_zero; - uint32_t auth_seqnum; - uint8_t seg_n; - uint8_t seg_o; - int err; - - if (buf->len < 5) { - LOG_ERR("Too short segmented message (len %u)", buf->len); - return -EINVAL; - } - - if (bt_mesh_rpl_check(net_rx, &rpl)) { - LOG_WRN("Replay: src 0x%04x dst 0x%04x seq 0x%06x", net_rx->ctx.addr, - net_rx->ctx.recv_dst, net_rx->seq); - return -EINVAL; - } - - LOG_DBG("ASZMIC %u AKF %u AID 0x%02x", ASZMIC(hdr), AKF(hdr), AID(hdr)); - - net_buf_simple_pull(buf, 1); - - seq_zero = net_buf_simple_pull_be16(buf); - seg_o = (seq_zero & 0x03) << 3; - seq_zero = (seq_zero >> 2) & TRANS_SEQ_ZERO_MASK; - seg_n = net_buf_simple_pull_u8(buf); - seg_o |= seg_n >> 5; - seg_n &= 0x1f; - - LOG_DBG("SeqZero 0x%04x SegO %u SegN %u", seq_zero, seg_o, seg_n); - - if (seg_o > seg_n) { - LOG_ERR("SegO greater than SegN (%u > %u)", seg_o, seg_n); - return -EINVAL; - } - - /* According to MshPRFv1.0.1: - * "The SeqAuth is composed of the IV Index and the sequence number - * (SEQ) of the first segment" - * - * Therefore we need to calculate very first SEQ in order to find - * seqAuth. We can calculate as below: - * - * SEQ(0) = SEQ(n) - (delta between seqZero and SEQ(n) by looking into - * 14 least significant bits of SEQ(n)) - * - * Mentioned delta shall be >= 0, if it is not then seq_auth will - * be broken and it will be verified by the code below. - */ - *seq_auth = SEQ_AUTH(BT_MESH_NET_IVI_RX(net_rx), - (net_rx->seq - - ((((net_rx->seq & BIT_MASK(14)) - seq_zero)) & - BIT_MASK(13)))); - auth_seqnum = *seq_auth & BIT_MASK(24); - *seg_count = seg_n + 1; - - /* Look for old RX sessions */ - rx = seg_rx_find(net_rx, seq_auth); - if (rx) { - /* Discard old SeqAuth packet */ - if (rx->seq_auth > *seq_auth) { - LOG_WRN("Ignoring old SeqAuth"); - return -EINVAL; - } - - if (!seg_rx_is_valid(rx, net_rx, hdr, seg_n)) { - return -EINVAL; - } - - if (rx->in_use) { - LOG_DBG("Existing RX context. Block 0x%08x", rx->block); - goto found_rx; - } - - if (rx->block == BLOCK_COMPLETE(rx->seg_n)) { - LOG_DBG("Got segment for already complete SDU"); - - send_ack(net_rx->sub, net_rx->ctx.recv_dst, - net_rx->ctx.addr, net_rx->ctx.send_ttl, - seq_auth, rx->block, rx->obo); - - if (rpl) { - bt_mesh_rpl_update(rpl, net_rx); - } - - return -EALREADY; - } - - /* We ignore instead of sending block ack 0 since the - * ack timer is always smaller than the incomplete - * timer, i.e. the sender is misbehaving. - */ - LOG_WRN("Got segment for canceled SDU"); - return -EINVAL; - } - - /* Bail out early if we're not ready to receive such a large SDU */ - if (!sdu_len_is_ok(net_rx->ctl, seg_n)) { - LOG_ERR("Too big incoming SDU length"); - send_ack(net_rx->sub, net_rx->ctx.recv_dst, net_rx->ctx.addr, - net_rx->ctx.send_ttl, seq_auth, 0, - net_rx->friend_match); - return -EMSGSIZE; - } - - /* Verify early that there will be space in the Friend Queue(s) in - * case this message is destined to an LPN of ours. - */ - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && - net_rx->friend_match && !net_rx->local_match && - !bt_mesh_friend_queue_has_space(net_rx->sub->net_idx, - net_rx->ctx.addr, - net_rx->ctx.recv_dst, seq_auth, - *seg_count)) { - LOG_ERR("No space in Friend Queue for %u segments", *seg_count); - send_ack(net_rx->sub, net_rx->ctx.recv_dst, net_rx->ctx.addr, - net_rx->ctx.send_ttl, seq_auth, 0, - net_rx->friend_match); - return -ENOBUFS; - } - - /* Keep track of the received SeqAuth values received from this address - * and discard segmented messages that are not newer, as described in - * MshPRFv1.0.1: 3.5.3.4. - * - * The logic on the first segmented receive is a bit special, since the - * initial value of rpl->seg is 0, which would normally fail the - * comparison check with auth_seqnum: - * - If this is the first time we receive from this source, rpl->src - * will be 0, and we can skip this check. - * - If this is the first time we receive from this source on the new IV - * index, rpl->old_iv will be set, and the check is also skipped. - * - If this is the first segmented message on the new IV index, but we - * have received an unsegmented message already, the unsegmented - * message will have reset rpl->seg to 0, and this message's SeqAuth - * cannot be zero. - */ - if (rpl && rpl->src && auth_seqnum <= rpl->seg && - (!rpl->old_iv || net_rx->old_iv)) { - LOG_WRN("Ignoring old SeqAuth 0x%06x", auth_seqnum); - return -EALREADY; - } - - /* Look for free slot for a new RX session */ - rx = seg_rx_alloc(net_rx, hdr, seq_auth, seg_n); - if (!rx) { - /* Warn but don't cancel since the existing slots will - * eventually be freed up and we'll be able to process - * this one. - */ - LOG_WRN("No free slots for new incoming segmented messages"); - return -ENOMEM; - } - - rx->obo = net_rx->friend_match; - -found_rx: - if (BIT(seg_o) & rx->block) { - LOG_DBG("Received already received fragment"); - return -EALREADY; - } - - /* All segments, except the last one, must either have 8 bytes of - * payload (for 64bit Net MIC) or 12 bytes of payload (for 32bit - * Net MIC). - */ - if (seg_o == seg_n) { - /* Set the expected final buffer length */ - rx->len = seg_n * seg_len(rx->ctl) + buf->len; - LOG_DBG("Target len %u * %u + %u = %u", seg_n, seg_len(rx->ctl), buf->len, rx->len); - - if (rx->len > BT_MESH_RX_SDU_MAX) { - LOG_ERR("Too large SDU len"); - send_ack(net_rx->sub, net_rx->ctx.recv_dst, - net_rx->ctx.addr, net_rx->ctx.send_ttl, - seq_auth, 0, rx->obo); - seg_rx_reset(rx, true); - return -EMSGSIZE; - } - } else { - if (buf->len != seg_len(rx->ctl)) { - LOG_ERR("Incorrect segment size for message type"); - return -EINVAL; - } - } - - /* Reset the Incomplete Timer */ - rx->last = k_uptime_get_32(); - - if (!bt_mesh_lpn_established()) { - int32_t timeout = ack_timeout(rx); - /* Should only start ack timer if it isn't running already: */ - k_work_schedule(&rx->ack, K_MSEC(timeout)); - } - - /* Allocated segment here */ - err = k_mem_slab_alloc(&segs, &rx->seg[seg_o], K_NO_WAIT); - if (err) { - LOG_WRN("Unable allocate buffer for Seg %u", seg_o); - return -ENOBUFS; - } - - memcpy(rx->seg[seg_o], buf->data, buf->len); - - LOG_DBG("Received %u/%u", seg_o, seg_n); - - /* Mark segment as received */ - rx->block |= BIT(seg_o); - - if (rx->block != BLOCK_COMPLETE(seg_n)) { - *pdu_type = BT_MESH_FRIEND_PDU_PARTIAL; - return 0; - } - - LOG_DBG("Complete SDU"); - - if (rpl) { - bt_mesh_rpl_update(rpl, net_rx); - /* Update the seg, unless it has already been surpassed: - * This needs to happen after rpl_update to ensure that the IV - * update reset logic inside rpl_update doesn't overwrite the - * change. - */ - rpl->seg = MAX(rpl->seg, auth_seqnum); - } - - *pdu_type = BT_MESH_FRIEND_PDU_COMPLETE; - - /* If this fails, the work handler will either exit early because the - * block is fully received, or rx->in_use is false. - */ - (void)k_work_cancel_delayable(&rx->ack); - send_ack(net_rx->sub, net_rx->ctx.recv_dst, net_rx->ctx.addr, - net_rx->ctx.send_ttl, seq_auth, rx->block, rx->obo); - - if (net_rx->ctl) { - NET_BUF_SIMPLE_DEFINE(sdu, BT_MESH_RX_CTL_MAX); - seg_rx_assemble(rx, &sdu, 0U); - err = ctl_recv(net_rx, *hdr, &sdu, seq_auth); - } else if (rx->len < 1 + APP_MIC_LEN(ASZMIC(hdr))) { - LOG_ERR("Too short SDU + MIC"); - err = -EINVAL; - } else { - NET_BUF_SIMPLE_DEFINE_STATIC(seg_buf, BT_MESH_RX_SDU_MAX); - struct net_buf_simple sdu; - - /* Decrypting in place to avoid creating two assembly buffers. - * We'll reassemble the buffer from the segments before each - * decryption attempt. - */ - net_buf_simple_init(&seg_buf, 0); - net_buf_simple_init_with_data( - &sdu, seg_buf.data, rx->len - APP_MIC_LEN(ASZMIC(hdr))); - - err = sdu_recv(net_rx, *hdr, ASZMIC(hdr), &seg_buf, &sdu, rx); - } - - seg_rx_reset(rx, false); - - return err; -} - -int bt_mesh_trans_recv(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx) -{ - uint64_t seq_auth = TRANS_SEQ_AUTH_NVAL; - enum bt_mesh_friend_pdu_type pdu_type = BT_MESH_FRIEND_PDU_SINGLE; - struct net_buf_simple_state state; - uint8_t seg_count = 0; - int err; - - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { - rx->friend_match = bt_mesh_friend_match(rx->sub->net_idx, - rx->ctx.recv_dst); - } else { - rx->friend_match = false; - } - - LOG_DBG("src 0x%04x dst 0x%04x seq 0x%08x friend_match %u", rx->ctx.addr, rx->ctx.recv_dst, - rx->seq, rx->friend_match); - - /* Remove network headers */ - net_buf_simple_pull(buf, BT_MESH_NET_HDR_LEN); - - LOG_DBG("Payload %s", bt_hex(buf->data, buf->len)); - - if (IS_ENABLED(CONFIG_BT_TESTING)) { - bt_test_mesh_net_recv(rx->ctx.recv_ttl, rx->ctl, rx->ctx.addr, - rx->ctx.recv_dst, buf->data, buf->len); - } - - /* If LPN mode is enabled messages are only accepted when we've - * requested the Friend to send them. The messages must also - * be encrypted using the Friend Credentials. - */ - if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER) && - bt_mesh_lpn_established() && rx->net_if == BT_MESH_NET_IF_ADV && - (!bt_mesh_lpn_waiting_update() || !rx->friend_cred)) { - LOG_WRN("Ignoring unexpected message in Low Power mode"); - return -EAGAIN; - } - - /* Save the app-level state so the buffer can later be placed in - * the Friend Queue. - */ - net_buf_simple_save(buf, &state); - - if (SEG(buf->data)) { - /* Segmented messages must match a local element or an - * LPN of this Friend. - */ - if (!rx->local_match && !rx->friend_match) { - return 0; - } - - err = trans_seg(buf, rx, &pdu_type, &seq_auth, &seg_count); - } else { - seg_count = 1; - err = trans_unseg(buf, rx, &seq_auth); - } - - /* Notify LPN state machine so a Friend Poll will be sent. */ - if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) { - bt_mesh_lpn_msg_received(rx); - } - - net_buf_simple_restore(buf, &state); - - if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && rx->friend_match && !err) { - if (seq_auth == TRANS_SEQ_AUTH_NVAL) { - bt_mesh_friend_enqueue_rx(rx, pdu_type, NULL, - seg_count, buf); - } else { - bt_mesh_friend_enqueue_rx(rx, pdu_type, &seq_auth, - seg_count, buf); - } - } - - return err; -} - -void bt_mesh_rx_reset(void) -{ - int i; - - LOG_DBG(""); - - for (i = 0; i < ARRAY_SIZE(seg_rx); i++) { - seg_rx_reset(&seg_rx[i], true); - } -} - -void bt_mesh_trans_reset(void) -{ - int i; - - bt_mesh_rx_reset(); - - LOG_DBG(""); - - for (i = 0; i < ARRAY_SIZE(seg_tx); i++) { - seg_tx_reset(&seg_tx[i]); - } - - bt_mesh_rpl_clear(); - bt_mesh_va_clear(); -} - -void bt_mesh_trans_init(void) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(seg_tx); i++) { - k_work_init_delayable(&seg_tx[i].retransmit, seg_retransmit); - } - - for (i = 0; i < ARRAY_SIZE(seg_rx); i++) { - k_work_init_delayable(&seg_rx[i].ack, seg_ack); - } -} diff --git a/tests/bluetooth/mesh/blob_io_flash/prj.conf b/tests/bluetooth/mesh/blob_io_flash/prj.conf index 2a0e98421fa..1e7864aa05d 100644 --- a/tests/bluetooth/mesh/blob_io_flash/prj.conf +++ b/tests/bluetooth/mesh/blob_io_flash/prj.conf @@ -15,7 +15,6 @@ CONFIG_BT_NO_DRIVER=y CONFIG_BT_OBSERVER=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_MESH=y -CONFIG_BT_MESH_V1d1=y CONFIG_BT_MESH_BLOB_SRV=y CONFIG_BT_MESH_BLOB_CLI=y CONFIG_BT_MESH_BLOB_IO_FLASH=y diff --git a/tests/bluetooth/mesh_shell/proxy_solicitation.conf b/tests/bluetooth/mesh_shell/proxy_solicitation.conf index f900d743516..51e50c07a01 100644 --- a/tests/bluetooth/mesh_shell/proxy_solicitation.conf +++ b/tests/bluetooth/mesh_shell/proxy_solicitation.conf @@ -1,4 +1,3 @@ -CONFIG_BT_MESH_V1d1=y CONFIG_BT_CENTRAL=y CONFIG_BT_MESH_PROXY_CLIENT=y CONFIG_BT_MESH_PROXY_SOLICITATION=y diff --git a/tests/bluetooth/tester/overlay-mesh-v1d1.conf b/tests/bluetooth/tester/overlay-mesh-v1d1.conf deleted file mode 100644 index 52045ce34df..00000000000 --- a/tests/bluetooth/tester/overlay-mesh-v1d1.conf +++ /dev/null @@ -1,30 +0,0 @@ -CONFIG_ENTROPY_GENERATOR=y - -CONFIG_BT_MESH_V1d1=y -CONFIG_BT_MESH_OP_AGG_CLI=y -CONFIG_BT_MESH_OP_AGG_SRV=y -# PTS requires more key slots. -# First one is implicitly taken by Device Key. -CONFIG_BT_MESH_MODEL_KEY_COUNT=3 -CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y -CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y -CONFIG_BT_MESH_SAR_CFG_SRV=y -CONFIG_BT_MESH_SAR_CFG_CLI=y -CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 -CONFIG_BT_MESH_RPR_SRV=y -CONFIG_BT_MESH_RPR_CLI=y -CONFIG_BT_MESH_RPR_AD_TYPES_MAX=2 -CONFIG_BT_MESH_BLOB_CLI=y -CONFIG_BT_MESH_DFU_CLI=y -CONFIG_BT_MESH_BLOB_SRV=y -CONFIG_BT_MESH_DFU_SRV=y -CONFIG_BT_MESH_DFD_SRV=y -CONFIG_BT_MESH_DFU_SLOT_CNT=2 -CONFIG_BT_MESH_PRIV_BEACONS=y -CONFIG_BT_MESH_PRIV_BEACON_SRV=y -CONFIG_BT_MESH_PRIV_BEACON_CLI=y -CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y -CONFIG_BT_MESH_MODEL_EXTENSIONS=y -CONFIG_BT_MESH_COMP_PAGE_1=y -CONFIG_BT_MESH_COMP_PAGE_2=y -CONFIG_SETTINGS=y diff --git a/tests/bluetooth/tester/overlay-mesh.conf b/tests/bluetooth/tester/overlay-mesh.conf index 840af06c1c0..9fded71f792 100644 --- a/tests/bluetooth/tester/overlay-mesh.conf +++ b/tests/bluetooth/tester/overlay-mesh.conf @@ -1,3 +1,5 @@ +CONFIG_ENTROPY_GENERATOR=y + CONFIG_BT_MESH=y CONFIG_BT_MESH_RELAY=y CONFIG_BT_MESH_PB_ADV=y @@ -23,3 +25,30 @@ CONFIG_BT_MESH_CDB_NODE_COUNT=3 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y CONFIG_BT_MESH_MSG_CACHE_SIZE=10 CONFIG_BT_MESH_PROXY_CLIENT=y +CONFIG_BT_MESH_OP_AGG_CLI=y +CONFIG_BT_MESH_OP_AGG_SRV=y +# PTS requires more key slots. +# First one is implicitly taken by Device Key. +CONFIG_BT_MESH_MODEL_KEY_COUNT=3 +CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y +CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y +CONFIG_BT_MESH_SAR_CFG_SRV=y +CONFIG_BT_MESH_SAR_CFG_CLI=y +CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 +CONFIG_BT_MESH_RPR_SRV=y +CONFIG_BT_MESH_RPR_CLI=y +CONFIG_BT_MESH_RPR_AD_TYPES_MAX=2 +CONFIG_BT_MESH_BLOB_CLI=y +CONFIG_BT_MESH_DFU_CLI=y +CONFIG_BT_MESH_BLOB_SRV=y +CONFIG_BT_MESH_DFU_SRV=y +CONFIG_BT_MESH_DFD_SRV=y +CONFIG_BT_MESH_DFU_SLOT_CNT=2 +CONFIG_BT_MESH_PRIV_BEACONS=y +CONFIG_BT_MESH_PRIV_BEACON_SRV=y +CONFIG_BT_MESH_PRIV_BEACON_CLI=y +CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y +CONFIG_BT_MESH_MODEL_EXTENSIONS=y +CONFIG_BT_MESH_COMP_PAGE_1=y +CONFIG_BT_MESH_COMP_PAGE_2=y +CONFIG_SETTINGS=y diff --git a/tests/bluetooth/tester/testcase.yaml b/tests/bluetooth/tester/testcase.yaml index 8c36291b30f..37c7ab3193d 100644 --- a/tests/bluetooth/tester/testcase.yaml +++ b/tests/bluetooth/tester/testcase.yaml @@ -28,13 +28,3 @@ tests: extra_args: OVERLAY_CONFIG="overlay-mesh.conf" tags: bluetooth harness: bluetooth - bluetooth.general.tester_mesh_v1d1: - build_only: true - platform_allow: - - qemu_x86 - - native_posix - - native_sim - - nrf52840dk_nrf52840 - extra_args: OVERLAY_CONFIG="overlay-mesh.conf;overlay-mesh-v1d1.conf" - tags: bluetooth - harness: bluetooth diff --git a/tests/bsim/bluetooth/mesh/CMakeLists.txt b/tests/bsim/bluetooth/mesh/CMakeLists.txt index 44c72dd9cbb..17bcb3f208f 100644 --- a/tests/bsim/bluetooth/mesh/CMakeLists.txt +++ b/tests/bsim/bluetooth/mesh/CMakeLists.txt @@ -9,30 +9,21 @@ target_sources(app PRIVATE src/main.c src/mesh_test.c src/friendship_common.c + src/gatt_common.c + src/dfu_blob_common.c ) -if(CONFIG_BT_MESH_V1d1) - target_sources(app PRIVATE - src/dfu_blob_common.c - ) -endif() - if(CONFIG_SETTINGS) target_sources(app PRIVATE src/test_persistence.c src/test_replay_cache.c src/test_provision.c - ) - - if(CONFIG_BT_MESH_V1d1) - target_sources(app PRIVATE - src/test_dfu.c - src/test_blob.c - src/test_sar.c - src/test_lcd.c - ) - endif() + src/test_dfu.c + src/test_blob.c + src/test_sar.c + src/test_lcd.c +) if(CONFIG_BT_MESH_USES_MBEDTLS_PSA) target_sources(app PRIVATE @@ -45,13 +36,9 @@ elseif(CONFIG_BT_MESH_GATT_PROXY) target_sources(app PRIVATE src/test_advertiser.c - ) - - if(CONFIG_BT_MESH_V1d1) - target_sources(app PRIVATE + src/test_suspend.c src/test_beacon.c - ) - endif() + ) elseif(CONFIG_BT_CTLR_LOW_LAT) @@ -72,17 +59,13 @@ else() src/test_access.c src/test_iv_index.c src/test_advertiser.c + src/test_suspend.c + src/test_blob.c + src/test_op_agg.c + src/test_sar.c + src/test_cdp1.c ) - if(CONFIG_BT_MESH_V1d1) - target_sources(app PRIVATE - src/test_blob.c - src/test_op_agg.c - src/test_sar.c - src/test_cdp1.c - ) - endif() - endif() zephyr_include_directories( diff --git a/tests/bsim/bluetooth/mesh/compile.sh b/tests/bsim/bluetooth/mesh/compile.sh index de9b4bd6af0..06557ef0ebb 100755 --- a/tests/bsim/bluetooth/mesh/compile.sh +++ b/tests/bsim/bluetooth/mesh/compile.sh @@ -18,22 +18,13 @@ mkdir -p ${WORK_DIR} source ${ZEPHYR_BASE}/tests/bsim/compile.source app=tests/bsim/bluetooth/mesh compile -app=tests/bsim/bluetooth/mesh conf_overlay=overlay_low_lat.conf compile 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_file=prj_mesh1d1.conf compile -app=tests/bsim/bluetooth/mesh \ - conf_file=prj_mesh1d1.conf conf_overlay=overlay_pst.conf compile -app=tests/bsim/bluetooth/mesh \ - conf_file=prj_mesh1d1.conf conf_overlay=overlay_gatt.conf compile -app=tests/bsim/bluetooth/mesh \ - conf_file=prj_mesh1d1.conf conf_overlay=overlay_low_lat.conf compile -app=tests/bsim/bluetooth/mesh conf_file=prj_mesh1d1.conf conf_overlay=overlay_psa.conf compile -app=tests/bsim/bluetooth/mesh \ - conf_file=prj_mesh1d1.conf conf_overlay="overlay_pst.conf;overlay_psa.conf" compile -app=tests/bsim/bluetooth/mesh \ - conf_file=prj_mesh1d1.conf conf_overlay="overlay_gatt.conf;overlay_psa.conf" compile -app=tests/bsim/bluetooth/mesh \ - conf_file=prj_mesh1d1.conf conf_overlay="overlay_low_lat.conf;overlay_psa.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_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_low_lat.conf;overlay_psa.conf" compile +app=tests/bsim/bluetooth/mesh conf_overlay="overlay_gatt.conf;overlay_low_lat.conf" compile wait_for_background_jobs diff --git a/tests/bsim/bluetooth/mesh/overlay_pst.conf b/tests/bsim/bluetooth/mesh/overlay_pst.conf index 6730b9ee233..e02c0ec2b93 100644 --- a/tests/bsim/bluetooth/mesh/overlay_pst.conf +++ b/tests/bsim/bluetooth/mesh/overlay_pst.conf @@ -18,7 +18,4 @@ CONFIG_BT_MESH_SUBNET_COUNT=2 CONFIG_BT_MESH_SEQ_STORE_RATE=1 CONFIG_BT_MESH_RPL_STORE_TIMEOUT=1 CONFIG_BT_MESH_STORE_TIMEOUT=1 -CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT=1 -CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST=200 -CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT=400 CONFIG_BT_MESH_COMP_PST_BUF_SIZE=600 diff --git a/tests/bsim/bluetooth/mesh/prj.conf b/tests/bsim/bluetooth/mesh/prj.conf index e9c719de6d7..1c343bb512f 100644 --- a/tests/bsim/bluetooth/mesh/prj.conf +++ b/tests/bsim/bluetooth/mesh/prj.conf @@ -19,11 +19,12 @@ CONFIG_BT_CTLR_PRIVACY=n CONFIG_BT_MESH=y CONFIG_BT_MESH_LOG_LEVEL_DBG=y CONFIG_BT_MESH_RELAY=y -CONFIG_BT_MESH_ADV_BUF_COUNT=32 +CONFIG_BT_MESH_ADV_BUF_COUNT=64 CONFIG_BT_MESH_TX_SEG_MAX=32 CONFIG_BT_MESH_RX_SEG_MAX=32 CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 CONFIG_BT_MESH_RX_SEG_MSG_COUNT=10 +CONFIG_BT_MESH_SEG_BUFS=100 CONFIG_BT_MESH_CFG_CLI=y CONFIG_BT_MESH_MODEL_GROUP_COUNT=3 CONFIG_BT_MESH_LOW_POWER=y @@ -43,4 +44,29 @@ CONFIG_BT_MESH_CDB_NODE_COUNT=4 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y CONFIG_BT_MESH_MODEL_EXTENSIONS=y CONFIG_BT_MESH_SUBNET_COUNT=5 +CONFIG_BT_MESH_SAR_CFG_CLI=y +CONFIG_BT_MESH_SAR_CFG_SRV=y +CONFIG_BT_MESH_BLOB_SRV=y +CONFIG_BT_MESH_BLOB_CLI=y +CONFIG_BT_MESH_BLOB_BLOCK_SIZE_MIN=256 +CONFIG_BT_MESH_RPR_CLI=y +CONFIG_BT_MESH_RPR_SRV=y +CONFIG_BT_MESH_OP_AGG_CLI=y +CONFIG_BT_MESH_OP_AGG_SRV=y +CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y +CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y +CONFIG_BT_MESH_DFU_SRV=y +CONFIG_BT_MESH_DFU_CLI=y +CONFIG_BT_MESH_DFD_SRV=y +CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD=y +CONFIG_BT_MESH_DFU_SLOT_CNT=4 +CONFIG_BT_MESH_PRIV_BEACON_SRV=y +CONFIG_BT_MESH_PRIV_BEACON_CLI=y +CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y +CONFIG_BT_MESH_OD_PRIV_PROXY_CLI=y +CONFIG_BT_MESH_COMP_PAGE_1=y +CONFIG_BT_MESH_COMP_PAGE_2=y CONFIG_BT_TESTING=y + +# Needed for RPR tests due to huge amount of retransmitted messages +CONFIG_BT_MESH_MSG_CACHE_SIZE=64 diff --git a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf deleted file mode 100644 index fd0c953226b..00000000000 --- a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf +++ /dev/null @@ -1,73 +0,0 @@ -CONFIG_LOG_MODE_IMMEDIATE=y -CONFIG_ASSERT=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=32768 - -# Bluetooth configuration -CONFIG_BT=y -CONFIG_LOG=y -CONFIG_BT_PRIVACY=n -CONFIG_BT_COMPANY_ID=0x0059 -CONFIG_BT_DEVICE_NAME="Mesh test" -CONFIG_BT_OBSERVER=y -CONFIG_BT_BROADCASTER=y - -# Disable unused Bluetooth features -CONFIG_BT_CTLR_DUP_FILTER_LEN=0 -CONFIG_BT_CTLR_PRIVACY=n - -# Bluetooth Mesh configuration -CONFIG_BT_MESH=y -CONFIG_BT_MESH_V1d1=y -CONFIG_BT_MESH_LOG_LEVEL_DBG=y -CONFIG_BT_MESH_RELAY=y -CONFIG_BT_MESH_ADV_BUF_COUNT=64 -CONFIG_BT_MESH_TX_SEG_MAX=32 -CONFIG_BT_MESH_RX_SEG_MAX=32 -CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 -CONFIG_BT_MESH_RX_SEG_MSG_COUNT=10 -CONFIG_BT_MESH_SEG_BUFS=100 -CONFIG_BT_MESH_CFG_CLI=y -CONFIG_BT_MESH_MODEL_GROUP_COUNT=3 -CONFIG_BT_MESH_LOW_POWER=y -CONFIG_BT_MESH_LPN_AUTO=n -CONFIG_BT_MESH_FRIEND=y -CONFIG_BT_MESH_FRIEND_ENABLED=n -CONFIG_BT_MESH_FRIEND_LPN_COUNT=5 -CONFIG_BT_MESH_APP_KEY_COUNT=2 -CONFIG_BT_MESH_MODEL_KEY_COUNT=2 -CONFIG_BT_MESH_LABEL_COUNT=3 -CONFIG_BT_MESH_IV_UPDATE_TEST=y -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_PROV_OOB_PUBLIC_KEY=y -CONFIG_BT_MESH_MODEL_EXTENSIONS=y -CONFIG_BT_MESH_SUBNET_COUNT=5 -CONFIG_BT_MESH_SAR_CFG_CLI=y -CONFIG_BT_MESH_SAR_CFG_SRV=y -CONFIG_BT_MESH_BLOB_SRV=y -CONFIG_BT_MESH_BLOB_CLI=y -CONFIG_BT_MESH_BLOB_BLOCK_SIZE_MIN=256 -CONFIG_BT_MESH_RPR_CLI=y -CONFIG_BT_MESH_RPR_SRV=y -CONFIG_BT_MESH_OP_AGG_CLI=y -CONFIG_BT_MESH_OP_AGG_SRV=y -CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y -CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y -CONFIG_BT_MESH_DFU_SRV=y -CONFIG_BT_MESH_DFU_CLI=y -CONFIG_BT_MESH_DFD_SRV=y -CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD=y -CONFIG_BT_MESH_DFU_SLOT_CNT=4 -CONFIG_BT_MESH_PRIV_BEACON_SRV=y -CONFIG_BT_MESH_PRIV_BEACON_CLI=y -CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y -CONFIG_BT_MESH_OD_PRIV_PROXY_CLI=y -CONFIG_BT_MESH_COMP_PAGE_1=y -CONFIG_BT_MESH_COMP_PAGE_2=y -CONFIG_BT_TESTING=y - -# Needed for RPR tests due to huge amount of retransmitted messages -CONFIG_BT_MESH_MSG_CACHE_SIZE=64 diff --git a/tests/bsim/bluetooth/mesh/src/main.c b/tests/bsim/bluetooth/mesh/src/main.c index 127e52faa49..a3dfb59373f 100644 --- a/tests/bsim/bluetooth/mesh/src/main.c +++ b/tests/bsim/bluetooth/mesh/src/main.c @@ -11,18 +11,14 @@ extern struct bst_test_list *test_persistence_install(struct bst_test_list *tests); extern struct bst_test_list *test_rpc_install(struct bst_test_list *tests); extern struct bst_test_list *test_provision_pst_install(struct bst_test_list *tests); -#if defined(CONFIG_BT_MESH_V1d1) extern struct bst_test_list *test_dfu_install(struct bst_test_list *test); extern struct bst_test_list *test_blob_pst_install(struct bst_test_list *test); extern struct bst_test_list *test_lcd_install(struct bst_test_list *test); extern struct bst_test_list *test_sar_pst_install(struct bst_test_list *test); -#endif /* defined(CONFIG_BT_MESH_V1d1) */ #elif defined(CONFIG_BT_MESH_GATT_PROXY) extern struct bst_test_list *test_adv_install(struct bst_test_list *test); -#if defined(CONFIG_BT_MESH_V1d1) +extern struct bst_test_list *test_suspend_install(struct bst_test_list *test); extern struct bst_test_list *test_beacon_install(struct bst_test_list *tests); -#endif /* defined(CONFIG_BT_MESH_V1d1) */ - #elif defined(CONFIG_BT_CTLR_LOW_LAT) extern struct bst_test_list *test_transport_install(struct bst_test_list *tests); extern struct bst_test_list *test_friendship_install(struct bst_test_list *tests); @@ -36,30 +32,26 @@ extern struct bst_test_list *test_heartbeat_install(struct bst_test_list *test); extern struct bst_test_list *test_access_install(struct bst_test_list *test); extern struct bst_test_list *test_ivi_install(struct bst_test_list *test); extern struct bst_test_list *test_adv_install(struct bst_test_list *test); -#if defined(CONFIG_BT_MESH_V1d1) +extern struct bst_test_list *test_suspend_install(struct bst_test_list *test); extern struct bst_test_list *test_blob_install(struct bst_test_list *test); extern struct bst_test_list *test_op_agg_install(struct bst_test_list *test); extern struct bst_test_list *test_sar_install(struct bst_test_list *test); extern struct bst_test_list *test_cdp1_install(struct bst_test_list *test); -#endif /* defined(CONFIG_BT_MESH_V1d1) */ #endif bst_test_install_t test_installers[] = { #if defined(CONFIG_SETTINGS) test_persistence_install, test_rpc_install, -#if defined(CONFIG_BT_MESH_V1d1) test_provision_pst_install, test_dfu_install, test_blob_pst_install, test_lcd_install, test_sar_pst_install, -#endif /* defined(CONFIG_BT_MESH_V1d1) */ #elif defined(CONFIG_BT_MESH_GATT_PROXY) test_adv_install, -#if defined(CONFIG_BT_MESH_V1d1) + test_suspend_install, test_beacon_install, -#endif /* defined(CONFIG_BT_MESH_V1d1) */ #elif defined(CONFIG_BT_CTLR_LOW_LAT) test_transport_install, test_friendship_install, @@ -73,12 +65,11 @@ bst_test_install_t test_installers[] = { test_access_install, test_ivi_install, test_adv_install, -#if defined(CONFIG_BT_MESH_V1d1) + test_suspend_install, test_blob_install, test_op_agg_install, test_sar_install, test_cdp1_install, -#endif /* defined(CONFIG_BT_MESH_V1d1) */ #endif NULL }; diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index e5f7d515da7..7a74123cb0f 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -27,9 +27,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL_INF); #define BEACON_INTERVAL 10 /*seconds*/ #define BEACON_TYPE_SECURE 0x01 -#if CONFIG_BT_MESH_V1d1 #define BEACON_TYPE_PRIVATE 0x02 -#endif static uint8_t test_net_key_2[16] = { 0xca, 0x11, 0xab, 0x1e }; static struct { @@ -71,7 +69,6 @@ BT_MESH_BEACON_CB_DEFINE(snb) = { /* Setting for scanner defining what beacon is expected next, SNB as default */ static uint8_t expected_beacon = BEACON_TYPE_SECURE; -#if CONFIG_BT_MESH_V1d1 static struct bt_mesh_cfg_cli cfg_cli; static struct bt_mesh_priv_beacon_cli priv_beacon_cli; @@ -99,7 +96,6 @@ static uint8_t last_random[13]; static bt_addr_le_t last_beacon_adv_addr; static struct bt_mesh_key priv_beacon_key; -#endif /* CONFIG_BT_MESH_V1d1 */ static int random_interval; @@ -330,13 +326,11 @@ static struct k_sem observer_sem; static struct { uint8_t flags; uint32_t iv_index; -#if CONFIG_BT_MESH_V1d1 uint8_t random[13]; uint64_t pp_hash; uint64_t pp_random; uint64_t net_id; bt_addr_le_t adv_addr; -#endif bool (*process_cb)(const uint8_t *net_id, void *ctx); void *user_ctx; } beacon; @@ -364,7 +358,6 @@ static void beacon_scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_ty net_id = net_buf_simple_pull_mem(buf, 8); beacon.iv_index = net_buf_simple_pull_be32(buf); } -#if CONFIG_BT_MESH_V1d1 else if (expected_beacon == BEACON_TYPE_PRIVATE) { uint8_t private_beacon_data[5]; @@ -377,7 +370,7 @@ static void beacon_scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_ty beacon.flags = private_beacon_data[0]; beacon.iv_index = sys_get_be32(&private_beacon_data[1]); } -#endif + if (!beacon.process_cb || beacon.process_cb(net_id, beacon.user_ctx)) { k_sem_give(&observer_sem); } @@ -1064,8 +1057,6 @@ static void test_tx_beacon_cache(void) PASS(); } -#if CONFIG_BT_MESH_V1d1 - typedef void (*priv_beacon_cb)(const struct bt_mesh_prb *prb); static priv_beacon_cb priv_beacon_cb_ptr; @@ -2196,8 +2187,6 @@ static void test_rx_priv_gatt_proxy(void) #endif -#endif /* CONFIG_BT_MESH_V1d1 */ - #define TEST_CASE(role, name, description) \ { \ .test_id = "beacon_" #role "_" #name, \ @@ -2216,7 +2205,6 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(tx, multiple_netkeys, "Beacon: multiple Net Keys"), TEST_CASE(tx, secure_beacon_interval, "Beacon: send secure beacons"), TEST_CASE(tx, beacon_cache, "Beacon: advertise duplicate SNBs"), -#if CONFIG_BT_MESH_V1d1 TEST_CASE(tx, priv_on_iv_update, "Private Beacon: send on IV update"), TEST_CASE(tx, priv_on_key_refresh, "Private Beacon: send on Key Refresh"), TEST_CASE(tx, priv_adv, "Private Beacon: advertise Private Beacons"), @@ -2230,7 +2218,6 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(tx, priv_gatt_proxy, "Private Proxy: Send Private Beacons over GATT"), TEST_CASE(tx, proxy_adv_multi_subnet_coex, "Proxy Adv: Multi subnet coex proxy adv"), TEST_CASE(tx, proxy_adv_solicit_trigger, "Proxy Adv: Trigger Solicitation"), -#endif #endif TEST_CASE(rx, on_iv_update, "Beacon: receive with IV update flag"), @@ -2240,7 +2227,6 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(rx, multiple_netkeys, "Beacon: multiple Net Keys"), TEST_CASE(rx, secure_beacon_interval, "Beacon: receive and send secure beacons"), TEST_CASE(rx, beacon_cache, "Beacon: receive duplicate SNBs"), -#if CONFIG_BT_MESH_V1d1 TEST_CASE(rx, priv_adv, "Private Beacon: verify random regeneration"), TEST_CASE(rx, priv_invalid, "Private Beacon: receive invalid beacons"), TEST_CASE(rx, priv_interleave, "Private Beacon: interleaved with SNB"), @@ -2251,7 +2237,6 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(rx, priv_multi_net_id, "Private Proxy: scan for multiple Net ID"), TEST_CASE(rx, priv_gatt_proxy, "Private Proxy: Receive Private Beacons over GATT"), TEST_CASE(rx, proxy_adv_multi_subnet_coex, "Proxy Adv: Multi subnet coex proxy adv"), -#endif #endif BSTEST_END_MARKER }; diff --git a/tests/bsim/bluetooth/mesh/src/test_provision.c b/tests/bsim/bluetooth/mesh/src/test_provision.c index 3d0e8010c75..789de47837b 100644 --- a/tests/bsim/bluetooth/mesh/src/test_provision.c +++ b/tests/bsim/bluetooth/mesh/src/test_provision.c @@ -52,11 +52,9 @@ enum test_flags { static uint8_t static_key1[] = {0x6E, 0x6F, 0x72, 0x64, 0x69, 0x63, 0x5F, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x5F, 0x31}; static uint8_t static_key2[] = {0x6E, 0x6F, 0x72, 0x64, 0x69, 0x63, 0x5F}; -#if IS_ENABLED(CONFIG_BT_MESH_V1d1) static uint8_t static_key3[] = {0x45, 0x6E, 0x68, 0x61, 0x6E, 0x63, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6F, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x69, 0x6E, 0x67, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x20, 0x4F, 0x4F, 0x42}; -#endif static uint8_t private_key_be[32]; static uint8_t public_key_be[64]; @@ -72,9 +70,7 @@ static struct oob_auth_test_vector_s { {NULL, 0, 0, 0, 0, 0}, {static_key1, sizeof(static_key1), 0, 0, 0, 0}, {static_key2, sizeof(static_key2), 0, 0, 0, 0}, -#if IS_ENABLED(CONFIG_BT_MESH_V1d1) {static_key3, sizeof(static_key3), 0, 0, 0, 0}, -#endif {NULL, 0, 3, BT_MESH_BLINK, 0, 0}, {NULL, 0, 5, BT_MESH_BEEP, 0, 0}, {NULL, 0, 6, BT_MESH_VIBRATE, 0, 0}, diff --git a/tests/bsim/bluetooth/mesh/src/test_replay_cache.c b/tests/bsim/bluetooth/mesh/src/test_replay_cache.c index 68dc52a7b5d..57d605fb97a 100644 --- a/tests/bsim/bluetooth/mesh/src/test_replay_cache.c +++ b/tests/bsim/bluetooth/mesh/src/test_replay_cache.c @@ -78,7 +78,6 @@ static void rx_ended(uint8_t *data, size_t len) static void tx_sar_conf(void) { -#ifdef CONFIG_BT_MESH_V1d1 /* Reconfigure SAR Transmitter state so that the transport layer doesn't * retransmit. */ @@ -97,12 +96,10 @@ static void tx_sar_conf(void) #else bt_mesh.sar_tx = tx_set; #endif -#endif } static void rx_sar_conf(void) { -#ifdef CONFIG_BT_MESH_V1d1 /* Reconfigure SAR Receiver state so that the transport layer does * generate Segmented Acks as rarely as possible. */ @@ -119,7 +116,6 @@ static void rx_sar_conf(void) #else bt_mesh.sar_rx = rx_set; #endif -#endif } static void test_tx_immediate_replay_attack(void) diff --git a/tests/bsim/bluetooth/mesh/src/test_transport.c b/tests/bsim/bluetooth/mesh/src/test_transport.c index 05026f6dcf7..309681ceafe 100644 --- a/tests/bsim/bluetooth/mesh/src/test_transport.c +++ b/tests/bsim/bluetooth/mesh/src/test_transport.c @@ -94,7 +94,6 @@ static void async_send_end(int err, void *data) static void rx_sar_conf(void) { -#ifdef CONFIG_BT_MESH_V1d1 /* Reconfigure SAR Receiver state so that the transport layer does * generate Segmented Acks as rarely as possible. */ @@ -111,7 +110,6 @@ static void rx_sar_conf(void) #else bt_mesh.sar_rx = rx_set; #endif -#endif } static const struct bt_mesh_send_cb async_send_cb = { diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_cancel.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_cancel.sh index 6a56a084c60..85b76062b60 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_cancel.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_cancel.sh @@ -7,11 +7,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_publication_cancel \ access_tx_cancel access_rx_cancel -conf=prj_mesh1d1_conf -RunTest mesh_access_publication_cancel_1d1 \ - access_tx_cancel access_rx_cancel - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_publication_cancel_psa \ access_tx_cancel access_rx_cancel diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub.sh index 862291b4c76..66caf516bb2 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub.sh @@ -7,11 +7,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_extended_model_subs \ access_tx_ext_model access_sub_ext_model -conf=prj_mesh1d1_conf -RunTest mesh_access_extended_model_subs_1d1 \ - access_tx_ext_model access_sub_ext_model - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_extended_model_subs_psa \ access_tx_ext_model access_sub_ext_model diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub_cap.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub_cap.sh index 2a4f9ccc247..91576f34aa0 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub_cap.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub_cap.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_extended_model_subs_cap access_sub_capacity_ext_model -conf=prj_mesh1d1_conf -RunTest mesh_access_extended_model_subs_cap_1d1 access_sub_capacity_ext_model - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_extended_model_subs_cap_psa access_sub_capacity_ext_model diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period.sh index d2bb07c6de7..f2e72085ac7 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period.sh @@ -7,11 +7,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_per_pub \ access_tx_period access_rx_period -conf=prj_mesh1d1_conf -RunTest mesh_access_per_pub_1d1 \ - access_tx_period access_rx_period - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_per_pub_psa \ access_tx_period access_rx_period diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh index 5ecd4a061de..0148026fc6f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh @@ -7,11 +7,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_pub_period_delayable_retr \ access_tx_period_delayable access_rx_period_delayable -conf=prj_mesh1d1_conf -RunTest mesh_access_pub_period_delayable_retr_1d1 \ - access_tx_period_delayable access_rx_period_delayable - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_pub_period_delayable_retr_psa \ access_tx_period_delayable access_rx_period_delayable diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit.sh index c2f4a27ddbd..0a0ec47da15 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit.sh @@ -7,11 +7,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_pub_retr \ access_tx_transmit access_rx_transmit -conf=prj_mesh1d1_conf -RunTest mesh_access_pub_retr_1d1 \ - access_tx_transmit access_rx_transmit - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_pub_retr_psa \ access_tx_period access_rx_period diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh index 0e966288db0..2dba89f2d76 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh @@ -7,11 +7,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_pub_transmit_delayable_retr \ access_tx_transmit_delayable access_rx_transmit_delayable -conf=prj_mesh1d1_conf -RunTest mesh_access_pub_transmit_delayable_retr_1d1 \ - access_tx_transmit_delayable access_rx_transmit_delayable - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_pub_transmit_delayable_retr_psa \ access_tx_transmit_delayable access_rx_transmit_delayable 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 86255277277..6c49d03fe9f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/proxy_mixin.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/proxy_mixin.sh @@ -21,10 +21,5 @@ 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 -conf=prj_mesh1d1_conf -overlay=overlay_gatt_conf -RunTest mesh_adv_proxy_mixin_1d1 adv_tx_proxy_mixin adv_rx_proxy_mixin - -conf=prj_mesh1d1_conf 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 8cfe0f9366a..a171ffd60f3 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/random_order.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/random_order.sh @@ -7,9 +7,5 @@ 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 -conf=prj_mesh1d1_conf -RunTest mesh_adv_random_order_1d1 adv_tx_random_order adv_rx_random_order - -conf=prj_mesh1d1_conf 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 96b30394f12..2b047138109 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/reverse_order.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/reverse_order.sh @@ -7,9 +7,5 @@ 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 -conf=prj_mesh1d1_conf -RunTest mesh_adv_reverse_order_1d1 adv_tx_reverse_order adv_rx_receive_order - -conf=prj_mesh1d1_conf 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 e208bf54579..a9e8d1ea861 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/send_order.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/send_order.sh @@ -7,9 +7,5 @@ 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 -conf=prj_mesh1d1_conf -RunTest mesh_adv_send_order_1d1 adv_tx_send_order adv_rx_receive_order - -conf=prj_mesh1d1_conf 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 28827c872f8..4ca2838ddf9 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,9 +7,5 @@ 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 -conf=prj_mesh1d1_conf -RunTest mesh_adv_tx_cb_multi_1d1 adv_tx_cb_multi - -conf=prj_mesh1d1_conf 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 edf4ba0996b..a2b1ad0e961 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,9 +7,5 @@ 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 -conf=prj_mesh1d1_conf -RunTest mesh_adv_tx_cb_single_1d1 adv_tx_cb_single adv_rx_xmit - -conf=prj_mesh1d1_conf 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/beacon/beacon_cache.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_cache.sh index c0f741e9aae..ab43e2b74db 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_cache.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_cache.sh @@ -15,12 +15,6 @@ RunTest mesh_beacon_cache \ beacon_tx_beacon_cache \ beacon_rx_beacon_cache -conf=prj_mesh1d1_conf -RunTest mesh_beacon_cache \ - beacon_tx_beacon_cache \ - beacon_rx_beacon_cache - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_cache \ beacon_tx_beacon_cache \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_interval.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_interval.sh index ec70eb2f02c..a671c90d668 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_interval.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_interval.sh @@ -22,12 +22,6 @@ RunTest mesh_beacon_interval \ beacon_tx_secure_beacon_interval \ beacon_rx_secure_beacon_interval -conf=prj_mesh1d1_conf -RunTest mesh_beacon_interval_1d1 \ - beacon_tx_secure_beacon_interval \ - beacon_rx_secure_beacon_interval - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_interval_psa \ beacon_tx_secure_beacon_interval \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/invalid.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/invalid.sh index ccce8c3a1f5..96d5b0a0f6b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/invalid.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/invalid.sh @@ -8,12 +8,6 @@ RunTest mesh_beacon_invalid \ beacon_tx_invalid \ beacon_rx_invalid -conf=prj_mesh1d1_conf -RunTest mesh_beacon_invalid_1d1 \ - beacon_tx_invalid \ - beacon_rx_invalid - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_invalid_psa \ beacon_tx_invalid \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/iv_update.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/iv_update.sh index 64225fd9cf5..d719aef86bc 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/iv_update.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/iv_update.sh @@ -8,12 +8,6 @@ RunTest mesh_beacon_on_iv_update \ beacon_tx_on_iv_update \ beacon_rx_on_iv_update -conf=prj_mesh1d1_conf -RunTest mesh_beacon_on_iv_update_1d1 \ - beacon_tx_on_iv_update \ - beacon_rx_on_iv_update - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_on_iv_update_psa \ beacon_tx_on_iv_update \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/key_refresh.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/key_refresh.sh index 00f82704718..9223d7d1d29 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/key_refresh.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/key_refresh.sh @@ -8,12 +8,6 @@ RunTest mesh_beacon_on_key_refresh \ beacon_tx_on_key_refresh \ beacon_rx_on_key_refresh -conf=prj_mesh1d1_conf -RunTest mesh_beacon_on_key_refresh_1d1 \ - beacon_tx_on_key_refresh \ - beacon_rx_on_key_refresh - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_on_key_refresh_psa \ beacon_tx_on_key_refresh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/kr_old_key.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/kr_old_key.sh index 3d6b151a068..ecd83e415a9 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/kr_old_key.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/kr_old_key.sh @@ -8,12 +8,6 @@ RunTest mesh_beacon_kr_old_key \ beacon_tx_kr_old_key \ beacon_rx_kr_old_key -conf=prj_mesh1d1_conf -RunTest mesh_beacon_kr_old_key_1d1 \ - beacon_tx_kr_old_key \ - beacon_rx_kr_old_key - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_kr_old_key_psa \ beacon_tx_kr_old_key \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/multiple_netkeys.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/multiple_netkeys.sh index 677e4227669..a8c154f5204 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/multiple_netkeys.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/multiple_netkeys.sh @@ -8,12 +8,6 @@ RunTest mesh_beacon_multiple_netkeys \ beacon_tx_multiple_netkeys \ beacon_rx_multiple_netkeys -conf=prj_mesh1d1_conf -RunTest mesh_beacon_multiple_netkeys_1d1 \ - beacon_tx_multiple_netkeys \ - beacon_rx_multiple_netkeys - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_multiple_netkeys_psa \ beacon_tx_multiple_netkeys \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_basic.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_basic.sh index 6f1ec61ad27..d8665ac4cfd 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_basic.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_basic.sh @@ -4,9 +4,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh -conf=prj_mesh1d1_conf RunTest blob_broadcast_basic blob_cli_broadcast_basic -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_broadcast_basic_psa blob_cli_broadcast_basic diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_trans.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_trans.sh index d5d0f60d1ce..25198e70a38 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_trans.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_trans.sh @@ -4,9 +4,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh -conf=prj_mesh1d1_conf RunTest blob_broadcast_trans blob_cli_broadcast_trans -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_broadcast_trans_psa blob_cli_broadcast_trans diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast.sh index ee86ce33cfa..654753e2188 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast.sh @@ -4,9 +4,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh -conf=prj_mesh1d1_conf RunTest blob_broadcast_unicast blob_cli_broadcast_unicast -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_broadcast_unicast_psa blob_cli_broadcast_unicast diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast_seq.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast_seq.sh index c356122145c..cb569fdc3b4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast_seq.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast_seq.sh @@ -4,9 +4,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh -conf=prj_mesh1d1_conf RunTest blob_broadcast_unicast_seq blob_cli_broadcast_unicast_seq -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_broadcast_unicast_seq_psa blob_cli_broadcast_unicast_seq diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_all_rsp.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_all_rsp.sh index bc2aa351987..d7f54a34d22 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_all_rsp.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_all_rsp.sh @@ -5,11 +5,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf RunTest blob_caps_all_rsp \ blob_cli_caps_all_rsp blob_srv_caps_standard blob_srv_caps_standard -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_caps_all_rsp_psa \ blob_cli_caps_all_rsp blob_srv_caps_standard blob_srv_caps_standard diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_cancelled.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_cancelled.sh index 3e1bd343a70..e287dcbd9fc 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_cancelled.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_cancelled.sh @@ -5,11 +5,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance seqence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf RunTest blob_caps_cancelled \ blob_cli_caps_cancelled blob_srv_caps_standard -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_caps_cancelled_psa \ blob_cli_caps_cancelled blob_srv_caps_standard diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_no_rsp.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_no_rsp.sh index e53864f8be4..e5ee44b5a08 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_no_rsp.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_no_rsp.sh @@ -5,11 +5,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf RunTest blob_caps_no_rsp \ blob_cli_caps_no_rsp blob_srv_caps_no_rsp blob_srv_caps_no_rsp -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_caps_no_rsp_psa \ blob_cli_caps_no_rsp blob_srv_caps_no_rsp blob_srv_caps_no_rsp diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_partial_rsp.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_partial_rsp.sh index 9a1675bd279..2da51b0e37e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_partial_rsp.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_partial_rsp.sh @@ -5,11 +5,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf RunTest blob_caps_partial_rsp \ blob_cli_caps_partial_rsp blob_srv_caps_standard blob_srv_caps_no_rsp -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_caps_partial_rsp_psa \ blob_cli_caps_partial_rsp blob_srv_caps_standard blob_srv_caps_no_rsp diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_friend.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_friend.sh index 1c2bde7a109..0e82cf8df11 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_friend.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_friend.sh @@ -7,7 +7,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Establish multiple different friendships concurrently. Perform BLOB transfer with BLOB Client # on friend node and BLOB Server on LPNs. # Note: The number of LPNs must match CONFIG_BT_MESH_FRIEND_LPN_COUNT. -conf=prj_mesh1d1_conf RunTest blob_transfer_lpn \ blob_cli_friend_pull \ blob_srv_lpn_pull \ @@ -16,7 +15,6 @@ RunTest blob_transfer_lpn \ blob_srv_lpn_pull \ blob_srv_lpn_pull -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_transfer_lpn_psa \ blob_cli_friend_pull \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_block.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_block.sh index 73728d1f141..a30a54f79ff 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_block.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_block.sh @@ -4,13 +4,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh -conf=prj_mesh1d1_conf RunTest blob_no_rsp_block_get \ blob_cli_fail_on_no_rsp \ blob_srv_fail_on_block_get \ blob_srv_fail_on_block_get -- -argstest msg-fail-type=0 -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_no_rsp_block_get_psa \ blob_cli_fail_on_no_rsp \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_xfer.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_xfer.sh index 4137deba007..4ecc650aa8f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_xfer.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_xfer.sh @@ -4,13 +4,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh -conf=prj_mesh1d1_conf RunTest blob_no_rsp_xfer_get \ blob_cli_fail_on_no_rsp \ blob_srv_fail_on_xfer_get \ blob_srv_fail_on_xfer_get -- -argstest msg-fail-type=1 -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_no_rsp_xfer_get_psa \ blob_cli_fail_on_no_rsp \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer.sh index e5bb421af14..a7cfdac206d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer.sh @@ -5,7 +5,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf RunTest blob_fail \ blob_cli_fail_on_persistency \ blob_srv_fail_on_block_start\ @@ -13,7 +12,6 @@ RunTest blob_fail \ blob_srv_fail_on_xfer_get \ blob_srv_fail_on_nothing -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_fail_psa \ blob_cli_fail_on_persistency \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer_pull.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer_pull.sh index 8ead73c4ec7..11bafde8fbc 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer_pull.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer_pull.sh @@ -5,13 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Client continues BLOB Transfer after one target timed out while sending chunks. -conf=prj_mesh1d1_conf RunTest blob_pst_pull \ blob_cli_trans_persistency_pull \ blob_srv_trans_persistency_pull \ blob_srv_trans_persistency_pull -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_pst_pull_psa \ blob_cli_trans_persistency_pull \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_pull.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_pull.sh index fdb1a8020e1..2e89819bb1f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_pull.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_pull.sh @@ -5,13 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Transfer completes successfully in Pull mode -conf=prj_mesh1d1_conf RunTest blob_success_pull blob_cli_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ -- -argstest use-pull-mode=1 -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_success_pull_psa blob_cli_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_push.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_push.sh index 5345eab11e8..9695d1bb941 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_push.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_push.sh @@ -5,12 +5,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Transfer completes successfully in Push mode -conf=prj_mesh1d1_conf RunTest blob_success_push blob_cli_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_success_push_psa blob_cli_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_pull.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_pull.sh index 5b05446694b..4459c4419b4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_pull.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_pull.sh @@ -5,11 +5,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Client can resume a suspended BLOB Transfer in Pull mode -conf=prj_mesh1d1_conf RunTest blob_resume_pull \ blob_cli_trans_resume blob_srv_trans_resume -- -argstest use-pull-mode=1 -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_resume_pull_psa \ blob_cli_trans_resume blob_srv_trans_resume -- -argstest use-pull-mode=1 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_push.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_push.sh index 01150c8b0eb..2bbc627b05c 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_push.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_push.sh @@ -5,9 +5,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Client can resume a suspended BLOB Transfer in Push mode -conf=prj_mesh1d1_conf RunTest blob_resume_push blob_cli_trans_resume blob_srv_trans_resume -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_resume_push_psa blob_cli_trans_resume blob_srv_trans_resume diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh index 8c59c82da6f..9973a82dc49 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh @@ -10,65 +10,53 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Tests with -flash_rm clean up stored settings after them # to run tests with -flash_erase correctly. # Test cases are designed to be run using single target. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=1 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop blob_srv_stop -- -argstest expected-phase=2 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop blob_srv_stop -- -argstest expected-phase=3 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 # Test reaching suspended state and continuation after reboot on new procedure. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=5 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 # The same test but with PSA crypto -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop blob_srv_stop -- -argstest expected-phase=2 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop blob_srv_stop -- -argstest expected-phase=3 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 # Test reaching suspended state and continuation after reboot on new procedure. -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=5 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/comp_data/cdp1_encode_decode.sh b/tests/bsim/bluetooth/mesh/tests_scripts/comp_data/cdp1_encode_decode.sh index e4f99e80d5d..d2a3c5de696 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/comp_data/cdp1_encode_decode.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/comp_data/cdp1_encode_decode.sh @@ -13,11 +13,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 0. Provisioning and setup. # 1. Configuration client requests the node's CDP1. # 2. The received CDP1 is compared to a hardcoded version. -conf=prj_mesh1d1_conf RunTest mesh_cdp1_test \ cdp1_node_data_comparison -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_cdp1_test_psa \ cdp1_node_data_comparison diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_apply.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_apply.sh index f612119bdee..4f87fb10fef 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_apply.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_apply.sh @@ -8,7 +8,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # callback is called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_apply \ dfu_cli_all_targets_lost_on_apply \ @@ -17,7 +16,6 @@ RunTest dfu_all_tgts_lost_on_apply \ dfu_target_fail_on_apply \ -- -argstest targets=3 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_apply_psa \ dfu_cli_all_targets_lost_on_apply \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_caps_get.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_caps_get.sh index 36dcf8f24ae..572445e4779 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_caps_get.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_caps_get.sh @@ -8,7 +8,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # and `ended` callback is called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_caps_get \ dfu_cli_all_targets_lost_on_caps_get \ @@ -17,7 +16,6 @@ RunTest dfu_all_tgts_lost_on_caps_get \ dfu_target_fail_on_caps_get \ -- -argstest targets=3 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_caps_get_psa \ dfu_cli_all_targets_lost_on_caps_get \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_metadata.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_metadata.sh index eacb921a214..e4fbe146dcd 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_metadata.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_metadata.sh @@ -8,7 +8,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_metadata \ dfu_cli_all_targets_lost_on_metadata \ @@ -17,7 +16,6 @@ RunTest dfu_all_tgts_lost_on_metadata \ dfu_target_fail_on_metadata \ -- -argstest targets=3 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_metadata_psa \ dfu_cli_all_targets_lost_on_metadata \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_update_get.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_update_get.sh index f6c53482834..7b96161eccd 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_update_get.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_update_get.sh @@ -8,7 +8,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Firmware Update Get message and `ended` callback is called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_update_get \ dfu_cli_all_targets_lost_on_update_get \ @@ -17,7 +16,6 @@ RunTest dfu_all_tgts_lost_on_update_get \ dfu_target_fail_on_update_get \ -- -argstest targets=3 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_update_get_psa \ dfu_cli_all_targets_lost_on_update_get \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_verify.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_verify.sh index 929ab93b81e..5daedaca71d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_verify.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_verify.sh @@ -8,7 +8,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # callback is called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_verify \ dfu_cli_all_targets_lost_on_verify \ @@ -17,7 +16,6 @@ RunTest dfu_all_tgts_lost_on_verify \ dfu_target_fail_on_verify \ -- -argstest targets=3 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_verify_psa \ dfu_cli_all_targets_lost_on_verify \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_persistent_transfer.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_persistent_transfer.sh index bcc98df48b5..2ff4a696639 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_persistent_transfer.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_persistent_transfer.sh @@ -5,7 +5,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_persistency \ dfu_cli_fail_on_persistency \ @@ -16,7 +15,6 @@ RunTest dfu_persistency \ dfu_target_fail_on_apply \ dfu_target_fail_on_nothing -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_persistency_psa \ dfu_cli_fail_on_persistency \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update.sh index 64f33013e74..5c00349f24e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update.sh @@ -4,10 +4,8 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_self_update dfu_dist_dfu_self_update -- -argstest targets=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_self_update_psa dfu_dist_dfu_self_update -- -argstest targets=1 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update_mult_targets.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update_mult_targets.sh index af7acb10723..42087f1ad13 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update_mult_targets.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update_mult_targets.sh @@ -4,12 +4,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_self_update_no_change \ dfu_dist_dfu_self_update dfu_target_dfu_no_change -- -argstest targets=2 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_self_update_no_change_psa \ dfu_dist_dfu_self_update dfu_target_dfu_no_change -- -argstest targets=2 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed.sh index bcac2cbba5b..1c5ff82d8fb 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed.sh @@ -5,12 +5,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test DFU with all variants of firmware effect -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_mixed dfu_dist_dfu dfu_target_dfu_unprov dfu_target_dfu_no_change \ dfu_target_dfu_new_comp_rpr dfu_target_dfu_new_comp_no_rpr -- -argstest targets=4 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_mixed_psa dfu_dist_dfu dfu_target_dfu_unprov dfu_target_dfu_no_change \ dfu_target_dfu_new_comp_rpr dfu_target_dfu_new_comp_no_rpr -- -argstest targets=4 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed_fail.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed_fail.sh index c5f67e2521e..3382e458b2e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed_fail.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed_fail.sh @@ -5,13 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that confirm step fails with all variants of firmware effect -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_mixed_fail dfu_dist_dfu dfu_target_dfu_unprov dfu_target_dfu_no_change \ dfu_target_dfu_new_comp_rpr dfu_target_dfu_new_comp_no_rpr -- -argstest targets=4 \ fail-confirm=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_mixed_fail_psa dfu_dist_dfu dfu_target_dfu_unprov dfu_target_dfu_no_change \ dfu_target_dfu_new_comp_rpr dfu_target_dfu_new_comp_no_rpr -- -argstest targets=4 \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh index c187d8cfbff..587908c6497 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh @@ -11,7 +11,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # and verifies they do not exist. # - Fourth test is rebooted device that verifies if removing all slots also removed them # from storage. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_slot dfu_dist_dfu_slot_create -flash_erase @@ -21,7 +20,6 @@ RunTestFlash dfu_slot dfu_dist_dfu_slot_delete_all RunTestFlash dfu_slot dfu_dist_dfu_slot_check_delete_all -flash_rm -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_slot_psa dfu_dist_dfu_slot_create -flash_erase diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_idempotency.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_idempotency.sh index 3f18f1a2651..abce47dba13 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_idempotency.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_idempotency.sh @@ -5,10 +5,8 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test DFU Slot API. This test tests that the APIs are idempotent. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_slot_idempotency dfu_dist_dfu_slot_idempotency -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_slot_idempotency_psa dfu_dist_dfu_slot_idempotency diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_reservation.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_reservation.sh index ddd7d0123f5..0ce234116b2 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_reservation.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_reservation.sh @@ -5,10 +5,8 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test DFU Slot API. This test tests slot reservation APIs. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_slot_reservation dfu_dist_dfu_slot_reservation -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_slot_reservation_psa dfu_dist_dfu_slot_reservation diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh index 6ed7099c987..b18a949b43d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh @@ -13,32 +13,27 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # image index were loaded correctly. # Test cases are designed to be run using single target. `dfu_cli_stop` test case in recovery part # plays dummy role, and is there to keep order of settings files being loaded. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ -- -argstest recover=0 expected-phase=2 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=3 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=4 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=6 # Use phase `BT_MESH_DFU_PHASE_APPLY_SUCCESS` as marker to bring whole procedure to an end -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ @@ -46,45 +41,38 @@ RunTestFlash dfu_dist_recover_phase \ # To test recovery from Verify Fail begin new distribution that will end there, # reboot devices and continue to Applying. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ -- -argstest recover=0 expected-phase=5 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ -- -argstest recover=1 expected-phase=6 # The same test but with PSA crypto -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ -- -argstest recover=0 expected-phase=2 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=3 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=4 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=6 # Use phase `BT_MESH_DFU_PHASE_APPLY_SUCCESS` as marker to bring whole procedure to an end -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ @@ -92,13 +80,11 @@ RunTestFlash dfu_dist_recover_phase_psa \ # To test recovery from Verify Fail begin new distribution that will end there, # reboot devices and continue to Applying. -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ -- -argstest recover=0 expected-phase=5 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish.sh index b89ad3af2c7..d1082fa9f29 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish.sh @@ -9,12 +9,6 @@ RunTest mesh_friendship_est \ friendship_friend_est \ friendship_lpn_est -conf=prj_mesh1d1_conf -RunTest mesh_friendship_est_1d1 \ - friendship_friend_est \ - friendship_lpn_est - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_est_psa \ friendship_friend_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish_multi.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish_multi.sh index 725ddae596e..32e4752123d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish_multi.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish_multi.sh @@ -14,16 +14,6 @@ RunTest mesh_friendship_est_multi \ friendship_lpn_est \ friendship_lpn_est -conf=prj_mesh1d1_conf -RunTest mesh_friendship_est_multi_1d1 \ - friendship_friend_est_multi \ - friendship_lpn_est \ - friendship_lpn_est \ - friendship_lpn_est \ - friendship_lpn_est \ - friendship_lpn_est - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_est_multi_psa \ friendship_friend_est_multi \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_disable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_disable.sh index be22829d615..f8e24e51a3b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_disable.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_disable.sh @@ -16,12 +16,6 @@ RunTest mesh_lpn_disable_check \ friendship_friend_no_est \ friendship_lpn_disable -conf=prj_mesh1d1_conf -RunTest mesh_lpn_disable_check_1d1 \ - friendship_friend_no_est \ - friendship_lpn_disable - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_lpn_disable_check_psa \ friendship_friend_no_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_loopback.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_loopback.sh index 676b6b81ccc..7c42d7912ff 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_loopback.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_loopback.sh @@ -9,12 +9,6 @@ RunTest mesh_friendship_lpn_loopback \ friendship_lpn_loopback \ friendship_friend_est -conf=prj_mesh1d1_conf -RunTest mesh_friendship_lpn_loopback_1d1 \ - friendship_lpn_loopback \ - friendship_friend_est - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_lpn_loopback_psa \ friendship_lpn_loopback \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_terminate_cb.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_terminate_cb.sh index 75163076af4..e51fec31dd2 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_terminate_cb.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_terminate_cb.sh @@ -14,12 +14,6 @@ RunTest mesh_lpn_terminate_cb_check \ friendship_friend_est \ friendship_lpn_term_cb_check -conf=prj_mesh1d1_conf -RunTest mesh_lpn_terminate_cb_check_1d1 \ - friendship_friend_est \ - friendship_lpn_term_cb_check - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_lpn_terminate_cb_check_psa \ friendship_friend_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_frnd.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_frnd.sh index 94d6224da5b..2329ed289eb 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_frnd.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_frnd.sh @@ -9,12 +9,6 @@ RunTest mesh_friendship_msg_frnd \ friendship_friend_msg \ friendship_lpn_msg_frnd -conf=prj_mesh1d1_conf -RunTest mesh_friendship_msg_frnd_1d1 \ - friendship_friend_msg \ - friendship_lpn_msg_frnd - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_msg_frnd_psa \ friendship_friend_msg \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_group.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_group.sh index 6e7287b00ff..d6de655ba5b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_group.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_group.sh @@ -10,13 +10,6 @@ RunTest mesh_friendship_msg_group \ friendship_other_group \ friendship_friend_group -conf=prj_mesh1d1_conf -RunTest mesh_friendship_msg_group_1d1 \ - friendship_lpn_group \ - friendship_other_group \ - friendship_friend_group - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_msg_group_psa \ friendship_lpn_group \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh.sh index 072e427d72a..f05261bb258 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh.sh @@ -10,13 +10,6 @@ RunTest mesh_friendship_msg_mesh \ friendship_other_msg \ friendship_friend_est -conf=prj_mesh1d1_conf -RunTest mesh_friendship_msg_mesh_1d1 \ - friendship_lpn_msg_mesh \ - friendship_other_msg \ - friendship_friend_est - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_msg_mesh_psa \ friendship_lpn_msg_mesh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh_low_lat.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh_low_lat.sh index d659281e4e9..3352d5812e6 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh_low_lat.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh_low_lat.sh @@ -11,14 +11,6 @@ RunTest mesh_friendship_msg_mesh_low_lat \ friendship_other_msg \ friendship_friend_est -conf=prj_mesh1d1_conf -overlay=overlay_low_lat_conf -RunTest mesh_friendship_msg_mesh_low_lat_1d1 \ - friendship_lpn_msg_mesh \ - friendship_other_msg \ - friendship_friend_est - -conf=prj_mesh1d1_conf overlay="overlay_low_lat_conf_overlay_psa_conf" RunTest mesh_friendship_msg_mesh_low_lat_psa \ friendship_lpn_msg_mesh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_va_collision.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_va_collision.sh index 360095d2e5f..3ec9cd29162 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_va_collision.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_va_collision.sh @@ -24,12 +24,6 @@ RunTest mesh_friendship_msg_va_collision \ friendship_lpn_va_collision \ friendship_friend_va_collision -conf=prj_mesh1d1_conf -RunTest mesh_friendship_msg_va_collision_1d1 \ - friendship_lpn_va_collision \ - friendship_friend_va_collision - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_msg_va_collision_psa \ friendship_lpn_va_collision \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/overflow.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/overflow.sh index d717be60292..90398fb4d8a 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/overflow.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/overflow.sh @@ -9,12 +9,6 @@ RunTest mesh_friendship_overflow \ friendship_friend_overflow \ friendship_lpn_overflow -conf=prj_mesh1d1_conf -RunTest mesh_friendship_overflow_1d1 \ - friendship_friend_overflow \ - friendship_lpn_overflow - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_overflow_psa \ friendship_friend_overflow \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/poll.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/poll.sh index 90e744a7001..328050ba39e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/poll.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/poll.sh @@ -9,12 +9,6 @@ RunTest mesh_friendship_poll \ friendship_friend_est \ friendship_lpn_poll -conf=prj_mesh1d1_conf -RunTest mesh_friendship_poll_1d1 \ - friendship_friend_est \ - friendship_lpn_poll - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_poll_psa \ friendship_friend_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/re-establish.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/re-establish.sh index 10abb4413ea..27b3e07e5f6 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/re-establish.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/re-establish.sh @@ -9,12 +9,6 @@ RunTest mesh_friendship_re_est \ friendship_friend_est \ friendship_lpn_re_est -conf=prj_mesh1d1_conf -RunTest mesh_friendship_re_est_1d1 \ - friendship_friend_est \ - friendship_lpn_re_est - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_re_est_psa \ friendship_friend_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_all.sh b/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_all.sh index eef25d08cf2..5bef1473a07 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_all.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_all.sh @@ -10,13 +10,6 @@ RunTest mesh_heartbeat_sub_cb_api_all \ heartbeat_publish_all \ heartbeat_subscribe_all -conf=prj_mesh1d1_conf -RunTest mesh_heartbeat_sub_cb_api_all_1d1 \ - heartbeat_publish_all \ - heartbeat_publish_all \ - heartbeat_subscribe_all - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_heartbeat_sub_cb_api_all_psa \ heartbeat_publish_all \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_unicast.sh b/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_unicast.sh index fc0660e5676..93b1e2ffe9f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_unicast.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_unicast.sh @@ -10,13 +10,6 @@ RunTest mesh_heartbeat_sub_cb_api_unicast \ heartbeat_publish_unicast \ heartbeat_subscribe_unicast -conf=prj_mesh1d1_conf -RunTest mesh_heartbeat_sub_cb_api_unicast_1d1 \ - heartbeat_publish_unicast \ - heartbeat_publish_unicast \ - heartbeat_subscribe_unicast - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_heartbeat_sub_cb_api_unicast_psa \ heartbeat_publish_unicast \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_deferring.sh b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_deferring.sh index cdf39dac438..6696b28ae00 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_deferring.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_deferring.sh @@ -7,9 +7,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test deferring of the IV index update procedure RunTest mesh_ivi_deferring ivi_ivu_deferring -conf=prj_mesh1d1_conf -RunTest mesh_ivi_deferring_1d1 ivi_ivu_deferring - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_ivi_deferring_psa ivi_ivu_deferring diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_recovery.sh b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_recovery.sh index 39514bf39e6..a827f9b3abf 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_recovery.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_recovery.sh @@ -7,9 +7,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test IV index recovery procedure RunTest mesh_ivi_recovery ivi_ivu_recovery -conf=prj_mesh1d1_conf -RunTest mesh_ivi_recovery_1d1 ivi_ivu_recovery - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_ivi_recovery_psa ivi_ivu_recovery diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_update.sh b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_update.sh index ee2b6b20000..f2f652012b8 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_update.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_update.sh @@ -7,9 +7,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test IV index update procedure RunTest mesh_ivi_update ivi_ivu_normal -conf=prj_mesh1d1_conf -RunTest mesh_ivi_update_1d1 ivi_ivu_normal - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_ivi_update_psa ivi_ivu_normal diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split.sh index d65326b3d7f..dcaba598a57 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split.sh @@ -19,12 +19,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp0_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=0 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp0_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=0 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split_dfu.sh index 6a65a2492ed..004a5224961 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split_dfu.sh @@ -20,13 +20,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp0_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=0 comp-changed-mode=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp0_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split.sh index 77d4a1737a5..f88db1b7391 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split.sh @@ -19,12 +19,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp128_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=128 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp128_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=128 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split_dfu.sh index 9abdfd00dd7..084125c79a4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split_dfu.sh @@ -20,13 +20,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp128_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=128 comp-changed-mode=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp128_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split.sh index fba1760cb36..ab46d32048f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split.sh @@ -19,12 +19,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp129_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=129 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp129_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=129 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split_dfu.sh index 282c3425c81..179c052e0ef 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split_dfu.sh @@ -20,13 +20,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp129_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=129 comp-changed-mode=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp129_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split.sh index e3e8f2bad85..eb25353581b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split.sh @@ -19,12 +19,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp130_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=130 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp130_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=130 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split_dfu.sh index 5daf32c54c0..a667f53abc8 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split_dfu.sh @@ -20,13 +20,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp130_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=130 comp-changed-mode=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp130_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split.sh index bc24a9c9bf9..06312cf558b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split.sh @@ -19,12 +19,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp1_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp1_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=1 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split_dfu.sh index 59383bb18f1..61f19ea3dcc 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split_dfu.sh @@ -20,13 +20,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp1_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=1 comp-changed-mode=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp1_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split.sh index 53def43d5a0..3da45434ee1 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split.sh @@ -19,12 +19,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp2_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=2 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp2_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=2 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split_dfu.sh index f314f00d6ef..8ad929f1374 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split_dfu.sh @@ -20,13 +20,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp2_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=2 comp-changed-mode=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp2_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp_data_max_sdu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp_data_max_sdu.sh index b050037ccf0..71a692fa22c 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp_data_max_sdu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp_data_max_sdu.sh @@ -14,12 +14,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 3. When server status arrive, remove status field data and compare received # comp data with local comp data and assure that the received message length # is 378 bytes (380 bytes access payload). -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_max_access_payload \ lcd_cli_max_sdu_comp_data_request lcd_srv_comp_data_status_respond -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_max_access_payload_psa \ lcd_cli_max_sdu_comp_data_request lcd_srv_comp_data_status_respond diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_max_sdu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_max_sdu.sh index 9b0be5ea20f..ef0f5712526 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_max_sdu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_max_sdu.sh @@ -15,12 +15,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # is 378 bytes (380 bytes access payload). # 4. Remove status field data and compare received metadata with # local metadata data. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_max_metadata_access_payload \ lcd_cli_max_sdu_metadata_request lcd_srv_metadata_status_respond -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_max_metadata_access_payload_psa \ lcd_cli_max_sdu_metadata_request lcd_srv_metadata_status_respond diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_split.sh index 0e29e7d4219..38e43f88601 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_split.sh @@ -18,12 +18,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # received metadata with corresponding bytes in local data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local metadata. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_split_metadata \ lcd_cli_split_metadata_request lcd_srv_metadata_status_respond -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_split_metadata_psa \ lcd_cli_split_metadata_request lcd_srv_metadata_status_respond diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/full_status_msg_list.sh b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/full_status_msg_list.sh index fb60110ad7b..7a226017470 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/full_status_msg_list.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/full_status_msg_list.sh @@ -22,11 +22,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 6. The client keeps track of the number of received status messages. When X messages have been # received, the client pass if the sequence of received status messages corresponds to the order # in which the messages were sent, or the test fails. -conf=prj_mesh1d1_conf RunTest mesh_op_agg_test_max_access_payload \ op_agg_cli_max_len_sequence_msg_send op_agg_srv_max_len_status_msg_send -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_op_agg_test_max_access_payload_psa \ op_agg_cli_max_len_sequence_msg_send op_agg_srv_max_len_status_msg_send diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh index 3a4720bdaf4..7d2c7eec7d2 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh @@ -12,11 +12,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 2. The device starts sending the sequence on loopback. # 3. The device verifies that the sequence is correctly received by the server model. # 4. The device confirms that the client model received all status messages. -conf=prj_mesh1d1_conf RunTest mesh_op_agg_model_coex_loopback \ op_agg_dut_model_coex_loopback -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_op_agg_model_coex_loopback \ op_agg_dut_model_coex_loopback diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/model_coex.sh b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/model_coex.sh index 08fcdf9f41e..928abd666f9 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/model_coex.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/model_coex.sh @@ -21,11 +21,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # aggregated sequence from the DUT device is correctly received. # 5. Finally, the DUT device waits and confirms that it received all status messages # related to its own aggregated sequence from the cli device. -conf=prj_mesh1d1_conf RunTest mesh_op_agg_model_coex \ op_agg_tester_model_coex op_agg_dut_model_coex -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_op_agg_model_coex \ op_agg_tester_model_coex op_agg_dut_model_coex diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh index 0392430adba..cf9ec54faec 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh @@ -31,60 +31,25 @@ overlay=overlay_pst_conf RunTestFlash mesh_pst_access_data_check persistence_access_data_load -flash_rm \ -- -argstest access-cfg=not-configured -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_save -flash_erase - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_load \ - -- -argstest access-cfg=configured - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_sub_overwrite \ - -- -argstest access-cfg=configured - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_load \ - -- -argstest access-cfg=new-subs - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_remove \ - -- -argstest access-cfg=new-subs - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_load -flash_rm \ - -- -argstest access-cfg=not-configured - -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_save -flash_erase -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_load \ -- -argstest access-cfg=configured -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_sub_overwrite \ -- -argstest access-cfg=configured -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_load \ -- -argstest access-cfg=new-subs -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_remove \ -- -argstest access-cfg=new-subs -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_load -flash_rm \ -- -argstest access-cfg=not-configured diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh index bb3074905a9..f9655ef7462 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh @@ -24,42 +24,18 @@ overlay=overlay_pst_conf RunTestFlash mesh_pst_cfg_check persistence_cfg_load -flash_rm \ -- -argstest stack-cfg=1 -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_save -flash_erase \ - -- -argstest stack-cfg=0 - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_load -flash_rm \ - -- -argstest stack-cfg=0 - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_save -flash_erase \ - -- -argstest stack-cfg=1 - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_load -flash_rm \ - -- -argstest stack-cfg=1 - -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_save -flash_erase \ -- -argstest stack-cfg=0 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_load -flash_rm \ -- -argstest stack-cfg=0 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_save -flash_erase \ -- -argstest stack-cfg=1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_load -flash_rm \ -- -argstest stack-cfg=1 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh index f1e0591ef13..8dc7baa3e9d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh @@ -16,18 +16,8 @@ RunTestFlash mesh_pst_prov_data_check persistence_provisioning_data_save -flash_ overlay=overlay_pst_conf RunTestFlash mesh_pst_prov_data_check persistence_provisioning_data_load -flash_rm -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_prov_data_check_1d1 persistence_provisioning_data_save -flash_erase - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTestFlash mesh_pst_prov_data_check_1d1 persistence_provisioning_data_load -flash_rm - -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_prov_data_check_psa persistence_provisioning_data_save -flash_erase -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_prov_data_check_psa persistence_provisioning_data_load -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh index 922b4c8a513..511c04f766f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh @@ -20,25 +20,11 @@ RunTest mesh_pst_repr persistence_reprovisioning_device \ -flash=../results/mesh_pst_repr/flash.bin -flash_rm \ persistence_reprovisioning_provisioner -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTest mesh_pst_repr_1d1 persistence_reprovisioning_device \ - -flash=../results/mesh_pst_repr_1d1/flash.bin -flash_erase \ - persistence_reprovisioning_provisioner - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTest mesh_pst_repr_1d1 persistence_reprovisioning_device \ - -flash=../results/mesh_pst_repr_1d1/flash.bin -flash_rm \ - persistence_reprovisioning_provisioner - -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_pst_repr_psa persistence_reprovisioning_device \ -flash=../results/mesh_pst_repr_psa/flash.bin -flash_erase \ persistence_reprovisioning_provisioner -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_pst_repr_psa persistence_reprovisioning_device \ -flash=../results/mesh_pst_repr_psa/flash.bin -flash_rm \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_adv.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_adv.sh index 48724dd7fbd..36c322a54da 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_adv.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_adv.sh @@ -6,9 +6,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising on node supporting relay feature. # Test Random value changes for different Random intervals (10s, 0 - on every beacon, 30s). -conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_adv beacon_rx_priv_adv beacon_tx_priv_adv -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_adv_psa beacon_rx_priv_adv beacon_tx_priv_adv diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_cache.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_cache.sh index 0cb5cdaea0a..46a460c7ec7 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_cache.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_cache.sh @@ -12,12 +12,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 2. TX device sends a secondary private beacons to the RX device, marking the end of the test. # 3. RX device verifies that only one of the two identical beacons was processed. -conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_cache \ beacon_tx_priv_beacon_cache \ beacon_rx_priv_beacon_cache -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_cache \ beacon_tx_priv_beacon_cache \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_interleave.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_interleave.sh index 6d574a72c73..cda94a89d93 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_interleave.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_interleave.sh @@ -15,9 +15,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # - PRB is disabled, SNB enabled: second SNB is advertised # - KR is initiated, third SNB is advertised with new flags (IVU + KR) # - PRB is enabled, SNB is disabled. Third PRB is advertised -conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_interleave beacon_rx_priv_interleave beacon_tx_priv_interleave -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_interleave_psa beacon_rx_priv_interleave beacon_tx_priv_interleave diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_invalid.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_invalid.sh index b1983284a51..028ba0eabff 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_invalid.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_invalid.sh @@ -5,9 +5,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test if Private Beacons with invalid data do not affect device -conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_invalid beacon_rx_priv_invalid beacon_tx_priv_invalid -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_invalid_psa beacon_rx_priv_invalid beacon_tx_priv_invalid diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu.sh index bb9a591fcb0..32232573305 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu.sh @@ -5,13 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising during IV Update procedure -conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_on_iv_update \ beacon_rx_on_iv_update \ beacon_tx_priv_on_iv_update \ -- -argstest rand-int=1 -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_on_iv_update_psa \ beacon_rx_on_iv_update \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu_long_interval.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu_long_interval.sh index ad0d11dbc96..d44ba297a0e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu_long_interval.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu_long_interval.sh @@ -7,13 +7,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising during IV Update procedure, with long Random Interval set. # Random value is expected to change before Random Interval is reached due to # Flags field change. -conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_on_iv_update_long_interval \ beacon_rx_on_iv_update \ beacon_tx_priv_on_iv_update \ -- -argstest rand-int=3 -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_on_iv_update_long_interval_psa \ beacon_rx_on_iv_update \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr.sh index eaf6338684f..59fe95658c2 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr.sh @@ -5,13 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising during Key Refresh procedure -conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_on_key_refresh \ beacon_rx_on_key_refresh \ beacon_tx_priv_on_key_refresh \ -- -argstest rand-int=1 -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_on_key_refresh_psa \ beacon_rx_on_key_refresh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr_long_interval.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr_long_interval.sh index cc5722e4432..b0ec45b3f1d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr_long_interval.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr_long_interval.sh @@ -7,13 +7,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising during Key Refresh procedure, with long Random Interval set. # Random value is expected to change before Random Interval is reached due to # Flags field change. -conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_on_key_refresh_long_interval \ beacon_rx_on_key_refresh \ beacon_tx_priv_on_key_refresh \ -- -argstest rand-int=3 -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_on_key_refresh_long_interval_psa \ beacon_rx_on_key_refresh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_gatt.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_gatt.sh index a1b9ea7d8d6..8080b6ec70f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_gatt.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_gatt.sh @@ -17,13 +17,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. Both TX and RX device verifies that the IV index has been updated. # This proves that the RX device (Proxy CLI) successfully received # a Private beacon over the GATT connection -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest mesh_priv_proxy_gatt_priv_beacon \ beacon_tx_priv_gatt_proxy \ beacon_rx_priv_gatt_proxy -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest mesh_priv_proxy_gatt_priv_beacon \ beacon_tx_priv_gatt_proxy \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id.sh index 02fcf03c001..a431cdd9f6b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id.sh @@ -18,13 +18,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 5. Test passes if the random field of the two Private Net ID advertisements # are NOT equal. -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest mesh_priv_proxy_net_id \ beacon_tx_priv_net_id \ beacon_rx_priv_net_id -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest mesh_priv_proxy_net_id \ beacon_tx_priv_net_id \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id_multi.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id_multi.sh index 9d89b5af36c..cffb5adbeb0 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id_multi.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id_multi.sh @@ -15,13 +15,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # advertisemen from each of the networks within the given time # limit. -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest mesh_priv_proxy_net_id_multi \ beacon_tx_priv_multi_net_id \ beacon_rx_priv_multi_net_id -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest mesh_priv_proxy_net_id_multi \ beacon_tx_priv_multi_net_id \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_node_id.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_node_id.sh index 2aff351bd78..2557c9c1506 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_node_id.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_node_id.sh @@ -23,13 +23,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 5. Test passes if the random field of the two Private Node ID advertisements # are NOT equal. -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest mesh_priv_proxy_node_id \ beacon_tx_priv_node_id \ beacon_rx_priv_node_id -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest mesh_priv_proxy_node_id \ beacon_tx_priv_node_id \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh index 42863a13458..0a3b5771bfd 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh @@ -43,14 +43,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # to the adv medium again. -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest proxy_adv_multi_subnet_coex \ beacon_tx_proxy_adv_multi_subnet_coex \ beacon_rx_proxy_adv_multi_subnet_coex \ beacon_tx_proxy_adv_solicit_trigger -conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest proxy_adv_multi_subnet_coex \ beacon_tx_proxy_adv_multi_subnet_coex \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_one_duration.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_one_duration.sh index 168c2620212..36c996269cf 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_one_duration.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_one_duration.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_iv_update_one_duration prov_provisioner_iv_update_flag_one -conf=prj_mesh1d1_conf -RunTest mesh_prov_iv_update_one_duration_1d1 prov_provisioner_iv_update_flag_one - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_iv_update_one_duration_psa prov_provisioner_iv_update_flag_one diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_zero_duration.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_zero_duration.sh index 07165b31c1d..cb3294950f8 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_zero_duration.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_zero_duration.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_iv_update_zero_duration prov_provisioner_iv_update_flag_zero -conf=prj_mesh1d1_conf -RunTest mesh_prov_iv_update_zero_duration_1d1 prov_provisioner_iv_update_flag_zero - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_iv_update_zero_duration_psa prov_provisioner_iv_update_flag_zero diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_multi.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_multi.sh index 7d8dfbe6388..61bbbcc1a27 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_multi.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_multi.sh @@ -13,14 +13,6 @@ RunTest mesh_prov_pb_adv_multi \ prov_device_pb_adv_no_oob \ prov_device_pb_adv_no_oob -conf=prj_mesh1d1_conf -RunTest mesh_prov_pb_adv_multi_1d1 \ - prov_provisioner_pb_adv_multi \ - prov_device_pb_adv_no_oob \ - prov_device_pb_adv_no_oob \ - prov_device_pb_adv_no_oob - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_multi_psa \ prov_provisioner_pb_adv_multi \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_no_oob.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_no_oob.sh index bfcb8540ae1..91bde356f2b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_no_oob.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_no_oob.sh @@ -8,12 +8,6 @@ RunTest mesh_prov_pb_adv_on_oob \ prov_device_pb_adv_no_oob \ prov_provisioner_pb_adv_no_oob -conf=prj_mesh1d1_conf -RunTest mesh_prov_pb_adv_on_oob_1d1 \ - prov_device_pb_adv_no_oob \ - prov_provisioner_pb_adv_no_oob - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_on_oob_psa \ prov_device_pb_adv_no_oob \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ib_pk.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ib_pk.sh index 22d197a0adc..ef8e07f7c80 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ib_pk.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ib_pk.sh @@ -8,11 +8,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_pb_adv_oob_auth \ prov_device_pb_adv_oob_auth prov_provisioner_pb_adv_oob_auth -conf=prj_mesh1d1_conf -RunTest mesh_prov_pb_adv_oob_auth_1d1 \ - prov_device_pb_adv_oob_auth prov_provisioner_pb_adv_oob_auth - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_oob_auth_psa \ prov_device_pb_adv_oob_auth prov_provisioner_pb_adv_oob_auth diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ignore_oob_pk.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ignore_oob_pk.sh index 5459997e547..8df3c6a4bf6 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ignore_oob_pk.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ignore_oob_pk.sh @@ -9,11 +9,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_pb_adv_device_w_oob_pk_prvnr_wt_pk \ prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_auth_no_oob_public_key -conf=prj_mesh1d1_conf -RunTest mesh_prov_pb_adv_device_w_oob_pk_prvnr_wt_pk_1d1 \ - prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_auth_no_oob_public_key - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_device_w_oob_pk_prvnr_wt_pk_psa \ prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_auth_no_oob_public_key diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_oob_pk.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_oob_pk.sh index b8ab3a5d899..d24e5afccd4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_oob_pk.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_oob_pk.sh @@ -8,11 +8,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_pb_adv_oob_public_key \ prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_public_key -conf=prj_mesh1d1_conf -RunTest mesh_prov_pb_adv_oob_public_key_1d1 \ - prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_public_key - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_oob_public_key_psa \ prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_public_key diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_reprovision.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_reprovision.sh index 9c70514a093..0e3b84e3138 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_reprovision.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_reprovision.sh @@ -8,12 +8,6 @@ RunTest mesh_prov_pb_adv_repr \ prov_device_pb_adv_reprovision \ prov_provisioner_pb_adv_reprovision -conf=prj_mesh1d1_conf -RunTest mesh_prov_pb_adv_repr_1d1 \ - prov_device_pb_adv_reprovision \ - prov_provisioner_pb_adv_reprovision - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_repr_psa \ prov_device_pb_adv_reprovision \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_client_server_same_dev.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_client_server_same_dev.sh index 33de74370e1..9175a9ac015 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_client_server_same_dev.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_client_server_same_dev.sh @@ -20,12 +20,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # composition refresh procedure on it self with local RPR client and server. # 7. The first device (prov_device_pb_remote_client_server_same_dev) execute # address refresh procedure on it self with local RPR client and server. -conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_client_server_same_dev \ prov_device_pb_remote_client_server_same_dev \ prov_device_pb_remote_server_same_dev -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_client_server_same_dev \ prov_device_pb_remote_client_server_same_dev \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_nppi_robustness.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_nppi_robustness.sh index d707fdb6d6c..a59cf04aef4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_nppi_robustness.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_nppi_robustness.sh @@ -13,13 +13,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. Execute composition refresh procedure 3 times for the third device. # 5. Execute address refresh procedure 3 times for the third device. # (Step 3-5 is executed without sending a node reset message) -conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_nppi_robustness \ prov_provisioner_pb_remote_client_nppi_robustness \ prov_device_pb_remote_server_unproved \ prov_device_pb_remote_server_nppi_robustness -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_nppi_robustness_psa \ prov_provisioner_pb_remote_client_nppi_robustness \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_parallel.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_parallel.sh index 2c3394381cd..6ecb3292193 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_parallel.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_parallel.sh @@ -11,14 +11,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. The provisioner scans for an unprovisioned device idx 3 through the node with RPR server; # 5. The provisioner checks scanning and provisioning succeeded; # 6. The provisioner provisions an unprovisioned device idx 3 through the node with RPR server; -conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_parallel \ prov_provisioner_pb_remote_client_parallel \ prov_device_pb_remote_server_unproved \ prov_device_pb_adv_no_oob \ prov_device_pb_adv_no_oob -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_parallel_psa \ prov_provisioner_pb_remote_client_parallel \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh index ed5f619b310..2bba5147d8f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh @@ -31,7 +31,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # - verify that the device is not re-provisioned again. # Step 1 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_provisioner_pb_remote_client_ncrp_provision -flash_erase \ @@ -39,7 +38,6 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_device_pb_remote_server_ncrp_prepare -flash_erase # Step 2 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_provisioner_pb_remote_client_ncrp \ @@ -47,7 +45,6 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_device_pb_remote_server_ncrp # Step 3 -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_provisioner_pb_remote_client_ncrp_second_time -flash_rm \ @@ -56,7 +53,6 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp \ # The same test but with PSA crypto # Step 1 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_provisioner_pb_remote_client_ncrp_provision -flash_erase \ @@ -64,7 +60,6 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_device_pb_remote_server_ncrp_prepare -flash_erase # Step 2 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_provisioner_pb_remote_client_ncrp \ @@ -72,7 +67,6 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_device_pb_remote_server_ncrp # Step 3 -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_provisioner_pb_remote_client_ncrp_second_time -flash_rm \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_reprovision.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_reprovision.sh index a49cbcd7ca9..1a2ae89d655 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_reprovision.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_reprovision.sh @@ -12,13 +12,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 5. The provisioner configures the health server on the recently provisioned device and sends Node # Reset; # 6. Repeat steps 3-5 multiple times. -conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_reprovision \ prov_provisioner_pb_remote_client_reprovision \ prov_device_pb_remote_server_unproved \ prov_device_pb_adv_reprovision -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_reprovision_psa \ prov_provisioner_pb_remote_client_reprovision \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_timeout.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_timeout.sh index 8ef61c2666b..7feba542c44 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_timeout.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_timeout.sh @@ -24,13 +24,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 11. 3rd device opens provisioning link. # 12. 2nd device stops communicating with either devices. # 13. After 60s RPR timeout is reached on 1st device. RPR Client closes provisioning link. -conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_provisioning_timeout \ prov_provisioner_pb_remote_client_provision_timeout \ prov_device_pb_remote_server_unproved_unresponsive \ prov_device_unresponsive -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_provisioning_timeout_psa \ prov_provisioner_pb_remote_client_provision_timeout \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh index 50387776dfb..d09e014bd0e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh @@ -14,25 +14,11 @@ RunTest mesh_replay_attack \ rpc_tx_power_replay_attack \ rpc_rx_power_replay_attack -flash=../results/mesh_replay_attack/flash.bin -flash_rm -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTest mesh_replay_attack_1d1 \ - rpc_tx_immediate_replay_attack \ - rpc_rx_immediate_replay_attack -flash=../results/mesh_replay_attack_1d1/flash.bin -flash_erase - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTest mesh_replay_attack_1d1 \ - rpc_tx_power_replay_attack \ - rpc_rx_power_replay_attack -flash=../results/mesh_replay_attack_1d1/flash.bin -flash_rm - -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_attack_psa \ rpc_tx_immediate_replay_attack \ rpc_rx_immediate_replay_attack -flash=../results/mesh_replay_attack_psa/flash.bin -flash_erase -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_attack_psa \ rpc_tx_power_replay_attack \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh index 8c7a7866eb3..7212b567a24 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh @@ -21,24 +21,11 @@ overlay=overlay_pst_conf RunTest mesh_replay_fragmentation \ rpc_rx_reboot_after_defrag -flash=../results/mesh_replay_fragmentation/flash.bin -flash_rm -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTest mesh_replay_fragmentation_1d1 \ - rpc_rx_rpl_frag -flash=../results/mesh_replay_fragmentation_1d1/flash.bin -flash_erase \ - rpc_tx_rpl_frag - -conf=prj_mesh1d1_conf -overlay=overlay_pst_conf -RunTest mesh_replay_fragmentation_1d1 \ - rpc_rx_reboot_after_defrag -flash=../results/mesh_replay_fragmentation_1d1/flash.bin -flash_rm - -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_fragmentation_psa \ rpc_rx_rpl_frag -flash=../results/mesh_replay_fragmentation_psa/flash.bin -flash_erase \ rpc_tx_rpl_frag -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_fragmentation_psa \ rpc_rx_reboot_after_defrag -flash=../results/mesh_replay_fragmentation_psa/flash.bin -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh b/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh index dc27c4dceda..0e67d5ab4d5 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh @@ -8,12 +8,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Tests must be added in sequence. # First test sets SAR TX/RX configuration. # Second test restores it from flash and checks if configuration persisted. -conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash sar_persistence sar_srv_cfg_store -flash_erase RunTestFlash sar_persistence sar_srv_cfg_restore -flash_rm -conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash sar_persistence_psa sar_srv_cfg_store -flash_erase RunTestFlash sar_persistence_psa sar_srv_cfg_restore -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/sar/slow_transfer_test.sh b/tests/bsim/bluetooth/mesh/tests_scripts/sar/slow_transfer_test.sh index a022c23c3f4..db8f8f9dc21 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/sar/slow_transfer_test.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/sar/slow_transfer_test.sh @@ -14,11 +14,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. The Client sends a Get-message with a maximum length SDU, targeting the server. # 5. The Server responds with a maximum length SDU Status-message. # 6. The test passes when the Client successfully receives the Status response. -conf=prj_mesh1d1_conf RunTest sar_slow_test \ sar_cli_max_len_sdu_slow_send sar_srv_max_len_sdu_slow_receive -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest sar_slow_test_psa \ sar_cli_max_len_sdu_slow_send sar_srv_max_len_sdu_slow_receive diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/sar/stress_test.sh b/tests/bsim/bluetooth/mesh/tests_scripts/sar/stress_test.sh index 89707adf031..34b05446702 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/sar/stress_test.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/sar/stress_test.sh @@ -13,11 +13,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. The Client sends a Get-message with a maximum length SDU, targeting the server. # 5. The Server responds with a maximum length SDU Status-message. # 6. The test passes when the Client successfully receives the Status response. -conf=prj_mesh1d1_conf RunTest sar_test \ sar_cli_max_len_sdu_send sar_srv_max_len_sdu_receive -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest sar_test_psa \ sar_cli_max_len_sdu_send sar_srv_max_len_sdu_receive diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/scanner/invalid_ad_type.sh b/tests/bsim/bluetooth/mesh/tests_scripts/scanner/invalid_ad_type.sh index 9199ac69da8..c46088c5a15 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/scanner/invalid_ad_type.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/scanner/invalid_ad_type.sh @@ -8,12 +8,6 @@ RunTest mesh_scanner_invalid_ad_type \ scanner_tx_invalid_ad_type \ scanner_rx_invalid_packet -conf=prj_mesh1d1_conf -RunTest mesh_scanner_invalid_ad_type_1d1 \ - scanner_tx_invalid_ad_type \ - scanner_rx_invalid_packet - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_scanner_invalid_ad_type_psa \ scanner_tx_invalid_ad_type \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/scanner/wrong_packet_length.sh b/tests/bsim/bluetooth/mesh/tests_scripts/scanner/wrong_packet_length.sh index 8f0919058ed..80f8cacca83 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/scanner/wrong_packet_length.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/scanner/wrong_packet_length.sh @@ -8,12 +8,6 @@ RunTest mesh_scanner_wrong_packet_length \ scanner_tx_wrong_packet_length \ scanner_rx_invalid_packet -conf=prj_mesh1d1_conf -RunTest mesh_scanner_wrong_packet_length_1d1 \ - scanner_tx_wrong_packet_length \ - scanner_rx_invalid_packet - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_scanner_wrong_packet_length_psa \ scanner_tx_wrong_packet_length \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_disable_resume.sh b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_disable_resume.sh new file mode 100755 index 00000000000..711f92f4007 --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_disable_resume.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +# Test that GATT advertisement is stopped when suspending Mesh and disabling +# Bluetooth, and that it is started again when Bluetooth is re-enabled and Mesh is resumed. +# +# Test procedure: +# 0. DUT (Device 0) initializes the Mesh stack, and starts provisioning procedure using +# bt_mesh_prov_enable(BT_MESH_PROV_GATT). +# 1. Tester (Device 1) observes PB-GATT advs, and will fail the test if the expected +# amount of advs is not received. +# 2. DUT is provisioned, and Tester observes GATT proxy advs. +# 3. DUT notifies the Tester that it will be suspended, and Tester observes for advs after a +# brief delay. Receiving an adv while DUT is suspended will cause the test to fail. +# 4. After a delay, the DUT resumes and notifies the Tester, which checks that the +# advertising resumes. + +overlay=overlay_gatt_conf +RunTest mesh_gatt_suspend_disable_resume \ + suspend_dut_gatt_suspend_disable_resume suspend_tester_gatt + +overlay="overlay_gatt_conf_overlay_low_lat_conf" +RunTest mesh_gatt_suspend_disable_resume_low_lat \ + suspend_dut_gatt_suspend_disable_resume suspend_tester_gatt + +overlay="overlay_gatt_conf_overlay_psa_conf" +RunTest mesh_gatt_suspend_disable_resume_psa \ + suspend_dut_gatt_suspend_disable_resume suspend_tester_gatt diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_resume.sh b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_resume.sh new file mode 100755 index 00000000000..f0e4fb23502 --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_resume.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +# Test that GATT advertisement is stopped when suspending Mesh, and that it is started again +# when Mesh is resumed. +# +# Test procedure: +# 0. DUT (Device 0) initializes the Mesh stack, and starts provisioning procedure using +# bt_mesh_prov_enable(BT_MESH_PROV_GATT). +# 1. Tester (Device 1) observes PB-GATT advs, and will fail the test if the expected +# amount of advs is not received. +# 2. DUT is provisioned, and Tester observes GATT proxy advs. +# 3. DUT notifies the Tester that it will be suspended, and Tester observes for advs after a +# brief delay. Receiving an adv while DUT is suspended will cause the test to fail. +# 4. After a delay, the DUT resumes and notifies the Tester, which checks that the +# advertising resumes. + +overlay=overlay_gatt_conf +RunTest mesh_gatt_suspend_resume \ + suspend_dut_gatt_suspend_resume suspend_tester_gatt + +overlay="overlay_gatt_conf_overlay_low_lat_conf" +RunTest mesh_gatt_suspend_resume_low_lat \ + suspend_dut_gatt_suspend_resume suspend_tester_gatt + +overlay="overlay_gatt_conf_overlay_psa_conf" +RunTest mesh_gatt_suspend_resume_psa \ + suspend_dut_gatt_suspend_resume suspend_tester_gatt diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_disable_resume.sh b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_disable_resume.sh new file mode 100755 index 00000000000..bfe42e15c16 --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_disable_resume.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +# Test that periodic publication is stopped when suspending Mesh and disabling +# Bluetooth, and that it is started again when Bluetooth is re-enabled and Mesh is resumed. +# The test will fail under two conditions; if no publication is received while +# Mesh is enabled, or if a publication is received while Mesh is suspended. +# +# Test procedure: +# 0. Provisioning and setup. +# 1. Start publication. +# 2. Suspend Mesh and disable Bluetooth, checking that publication stops. +# 3. Enable Bluetooth and resume Mesh a specified time after suspension. +# Check that publication resumes. + +RunTest mesh_suspend_disable_resume \ + suspend_dut_suspend_disable_resume suspend_tester_pub + +overlay=overlay_low_lat_conf +RunTest mesh_suspend_disable_resume_low_lat \ + suspend_dut_suspend_disable_resume suspend_tester_pub + +overlay=overlay_psa_conf +RunTest mesh_suspend_disable_resume_psa \ + suspend_dut_suspend_disable_resume suspend_tester_pub diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_resume.sh b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_resume.sh new file mode 100755 index 00000000000..31d151201a8 --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_resume.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +# Test that periodic publication is stopped when suspending Mesh, and that it +# is started again when Mesh is resumed. The test will fail under two +# conditions; if no publication is received while Mesh is enabled, +# or if a publication is received while Mesh is suspended. +# +# Test procedure: +# 0. Provisioning and setup. +# 1. Start publication. +# 2. Suspend Mesh, checking that publication stops. +# 3. Resume Mesh a specified time after suspension. Check that publication resumes. + +RunTest mesh_suspend_resume \ + suspend_dut_suspend_resume suspend_tester_pub + +overlay=overlay_low_lat_conf +RunTest mesh_suspend_resume_low_lat \ + suspend_dut_suspend_resume suspend_tester_pub + +overlay=overlay_psa_conf +RunTest mesh_suspend_resume_psa \ + suspend_dut_suspend_resume suspend_tester_pub diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/fixed.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/fixed.sh index d4b86d2f98a..f4d0cfc0cac 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/fixed.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/fixed.sh @@ -15,9 +15,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # model; RunTest mesh_transport_fixed transport_tx_fixed transport_rx_fixed -conf=prj_mesh1d1_conf -RunTest mesh_transport_fixed_1d1 transport_tx_fixed transport_rx_fixed - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_fixed_1d1 transport_tx_fixed transport_rx_fixed diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/group.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/group.sh index d85d7cf8604..7b7c6a559fc 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/group.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/group.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_group transport_tx_group transport_rx_group -conf=prj_mesh1d1_conf -RunTest mesh_transport_group_1d1 transport_tx_group transport_rx_group - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_group_psa transport_tx_group transport_rx_group diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback.sh index 9cc1fb33041..e2812efda23 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest transport_loopback transport_tx_loopback transport_rx_none -conf=prj_mesh1d1_conf -RunTest transport_loopback_1d1 transport_tx_loopback transport_rx_none - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest transport_loopback_psa transport_tx_loopback transport_rx_none diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group.sh index 3be2bb24367..38b6c8dd906 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_loopback_group transport_tx_loopback_group transport_rx_group -conf=prj_mesh1d1_conf -RunTest mesh_transport_loopback_group_1d1 transport_tx_loopback_group transport_rx_group - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_loopback_group_psa transport_tx_loopback_group transport_rx_group diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group_low_lat.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group_low_lat.sh index 63829e012a5..3972edd3034 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group_low_lat.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group_low_lat.sh @@ -7,10 +7,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh overlay=overlay_low_lat_conf RunTest mesh_transport_loopback_group_low_lat transport_tx_loopback_group transport_rx_group -conf=prj_mesh1d1_conf -overlay=overlay_low_lat_conf -RunTest mesh_transport_loopback_group_low_lat_1d1 transport_tx_loopback_group transport_rx_group - -conf=prj_mesh1d1_conf overlay="overlay_low_lat_conf_overlay_psa_conf" RunTest mesh_transport_loopback_group_low_lat_psa transport_tx_loopback_group transport_rx_group diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_block.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_block.sh index 21a56f37478..788d3eeebdf 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_block.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_block.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_seg_block transport_tx_seg_block transport_rx_seg_block -conf=prj_mesh1d1_conf -RunTest mesh_transport_seg_block_1d1 transport_tx_seg_block transport_rx_seg_block - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_seg_block_psa transport_tx_seg_block transport_rx_seg_block diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_concurrent.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_concurrent.sh index 40ba38aae12..d07c90c8d22 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_concurrent.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_concurrent.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_seg_concurrent transport_tx_seg_concurrent transport_rx_seg_concurrent -conf=prj_mesh1d1_conf -RunTest mesh_transport_seg_concurrent_1d1 transport_tx_seg_concurrent transport_rx_seg_concurrent - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_seg_concurrent_psa transport_tx_seg_concurrent transport_rx_seg_concurrent diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_fail.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_fail.sh index ca650ede1f4..72639370b93 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_fail.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_fail.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_seg_fail transport_tx_seg_fail -conf=prj_mesh1d1_conf -RunTest mesh_transport_seg_fail_1d1 transport_tx_seg_fail - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_seg_fail_psa transport_tx_seg_fail diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_ivu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_ivu.sh index 9268e42029e..0ef30273341 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_ivu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_ivu.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_seg_ivu transport_tx_seg_ivu transport_rx_seg_ivu -conf=prj_mesh1d1_conf -RunTest mesh_transport_seg_ivu_1d1 transport_tx_seg_ivu transport_rx_seg_ivu - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_seg_ivu_psa transport_tx_seg_ivu transport_rx_seg_ivu diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast.sh index a107a86146c..c91397f4f4b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_unicast transport_tx_unicast transport_rx_unicast -conf=prj_mesh1d1_conf -RunTest mesh_transport_unicast_1d1 transport_tx_unicast transport_rx_unicast - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_unicast_psa transport_tx_unicast transport_rx_unicast diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast_low_lat.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast_low_lat.sh index cbfc8ea5ce7..981347a3385 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast_low_lat.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast_low_lat.sh @@ -7,10 +7,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh overlay=overlay_low_lat_conf RunTest mesh_transport_unicast_low_lat transport_tx_unicast transport_rx_unicast -conf=prj_mesh1d1_conf -overlay=overlay_low_lat_conf -RunTest mesh_transport_unicast_low_lat_1d1 transport_tx_unicast transport_rx_unicast - -conf=prj_mesh1d1_conf overlay="overlay_low_lat_conf_overlay_psa_conf" RunTest mesh_transport_unicast_low_lat_psa transport_tx_unicast transport_rx_unicast diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unknown_app.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unknown_app.sh index 2a1b2741b60..6f077ee0c8b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unknown_app.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unknown_app.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_unknown_app transport_tx_unknown_app transport_rx_none -conf=prj_mesh1d1_conf -RunTest mesh_transport_unknown_app_1d1 transport_tx_unknown_app transport_rx_none - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_unknown_app_psa transport_tx_unknown_app transport_rx_none diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/va.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/va.sh index 698bd164485..4336a2aa042 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/va.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/va.sh @@ -6,9 +6,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_va transport_tx_va transport_rx_va -conf=prj_mesh1d1_conf -RunTest mesh_transport_va_1d1 transport_tx_va transport_rx_va - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_va_psa transport_tx_va transport_rx_va diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/va_collision.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/va_collision.sh index 631c43790ef..dbcc3c64bc7 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/va_collision.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/va_collision.sh @@ -7,9 +7,5 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test transmission to virtual addresses with collision RunTest mesh_transport_va_collision transport_tx_va_collision transport_rx_va_collision -conf=prj_mesh1d1_conf -RunTest mesh_transport_va_collision_1d1 transport_tx_va_collision transport_rx_va_collision - -conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_va_collision_psa transport_tx_va_collision transport_rx_va_collision From 9a7f6aa37a26123cf818475d86042b74d680b8c8 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:44:24 +0100 Subject: [PATCH 0364/2300] [nrf fromtree] Bluetooth: Mesh: Move mesh-1.1 transport sar configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move mesh 1.1 transport sar configuration under transport menu Signed-off-by: Pavel Vasilyev (cherry picked from commit 6060dfbc7fef9d81cfe887c7ed1230b2621015d0) Signed-off-by: Alperen Şener (cherry picked from commit 6ef5422dbd7c77555b162b2e26146a1e50d80cf6) --- subsys/bluetooth/mesh/Kconfig | 244 +++++++++++++++++----------------- 1 file changed, 120 insertions(+), 124 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 0f38a2e3ba0..d3c3397a63d 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -512,6 +512,126 @@ config BT_MESH_TX_SEG_MAX which leaves 56 bytes for application layer data using a 4-byte MIC and 52 bytes using an 8-byte MIC. +config BT_MESH_SAR_TX_SEG_INT_STEP + hex "Interval between sending two consecutive segments" + range 0x00 0x0F + default 0x05 + help + This value controls the interval between sending two consecutive + segments in a segmented message. The interval is measured in + milliseconds and calculated using the following formula: + (CONFIG_BT_MESH_SAR_TX_SEG_INT_STEP + 1) * 10 ms. + +config BT_MESH_SAR_TX_UNICAST_RETRANS_COUNT + hex "Maximum number of retransmissions to unicast address" + range 0x00 0x0F + default 0x02 + help + This value controls the maximum number of retransmissions of a + segmented message to a unicast address before giving up the transfer. + +config BT_MESH_SAR_TX_UNICAST_RETRANS_WITHOUT_PROG_COUNT + hex "Maximum number of retransmissions without progress to a unicast address" + range 0x00 0x0F + default 0x02 + help + This value defines the maximum number of retransmissions of a + segmented message to a unicast address that the stack will send if no + acknowledgment was received during timeout, or if an + acknowledgment with already confirmed segments was received. + +config BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP + hex "Retransmissions interval step of missing segments to unicast address" + range 0x00 0x0F + default 0x07 + help + This value controls the interval step used for delaying the + retransmissions of unacknowledged segments of a segmented message to + a unicast address. The interval step is measured in milliseconds and + calculated using the following formula: + (CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP + 1) * 25 ms. + +config BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC + hex "Retransmissions interval increment of missing segments to unicast address" + range 0x00 0x0F + default 0x01 + help + This value controls the interval increment used for delaying the + retransmissions of unacknowledged segments of a segmented message to + a unicast address. The increment is measured in milliseconds and + calculated using the following formula: + (CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC + 1) * 25 ms. + +config BT_MESH_SAR_TX_MULTICAST_RETRANS_COUNT + hex "Total number of retransmissions to multicast address" + range 0x00 0x0F + default 0x02 + help + This value controls the total number of retransmissions of a segmented + message to a multicast address. + +config BT_MESH_SAR_TX_MULTICAST_RETRANS_INT + hex "Interval between retransmissions to multicast address" + range 0x00 0x0F + default 0x09 + help + This value controls the interval between retransmissions of all + segments in a segmented message to a multicast address. The + interval is measured in milliseconds and calculated using the + following formula: + (CONFIG_BT_MESH_SAR_TX_MULTICAST_RETRANS_INT + 1) * 25 ms. + +config BT_MESH_SAR_RX_SEG_THRESHOLD + hex "Acknowledgments retransmission threshold" + range 0x00 0x1F + default 0x03 + help + This value defines a threshold in number of segments of a segmented + message for acknowledgment retransmissions. When the number of + segments of a segmented message is above this threshold, the stack + will additionally retransmit every acknowledgment message the + number of times given by value of CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT. + +config BT_MESH_SAR_RX_ACK_DELAY_INC + hex "Acknowledgment delay increment" + range 0x00 0x07 + default 0x01 + help + This value controls the delay increment of an interval used for + delaying the transmission of an acknowledgment message after + receiving a new segment. The increment is measured in segments + and calculated using the following formula: + CONFIG_BT_MESH_SAR_RX_ACK_DELAY_INC + 1.5. + +config BT_MESH_SAR_RX_SEG_INT_STEP + hex "Segments reception interval step" + range 0x00 0x0F + default 0x05 + help + This value defines the segments reception interval step used for + delaying the transmission of an acknowledgment message after + receiving a new segmnet. The interval is measured in milliseconds + and calculated using the following formula: + (CONFIG_BT_MESH_SAR_RX_SEG_INT_STEP + 1) * 10 ms + +config BT_MESH_SAR_RX_DISCARD_TIMEOUT + hex "Discard timeout for reception of a segmented message" + range 0x00 0x0F + default 0x01 + help + This value defines the time since the last successfully received + segment before giving up the reception of a segmented message. + +config BT_MESH_SAR_RX_ACK_RETRANS_COUNT + hex "Total number of acknowledgment message retransmission" + range 0x00 0x03 + default 0x00 + help + This value defines the total number of retranmissions of an + acknowledgment message that the stack will additionally send when the + size of segments in a segmented message is above the + CONFIG_BT_MESH_SAR_RX_SEG_THRESHOLD value. + endmenu # Transport SAR configuration config BT_MESH_DEFAULT_TTL @@ -1514,130 +1634,6 @@ config BT_MESH_SOL_PDU_RPL_CLI_TIMEOUT for a response message to arrive. This value can be changed at runtime using @ref bt_mesh_sol_pdu_rpl_cli_timeout_set. -menu "Transport SAR configuration" - -config BT_MESH_SAR_TX_SEG_INT_STEP - hex "Interval between sending two consecutive segments" - range 0x00 0x0F - default 0x05 - help - This value controls the interval between sending two consecutive - segments in a segmented message. The interval is measured in - milliseconds and calculated using the following formula: - (CONFIG_BT_MESH_SAR_TX_SEG_INT_STEP + 1) * 10 ms. - -config BT_MESH_SAR_TX_UNICAST_RETRANS_COUNT - hex "Maximum number of retransmissions to unicast address" - range 0x00 0x0F - default 0x02 - help - This value controls the maximum number of retransmissions of a - segmented message to a unicast address before giving up the transfer. - -config BT_MESH_SAR_TX_UNICAST_RETRANS_WITHOUT_PROG_COUNT - hex "Maximum number of retransmissions without progress to a unicast address" - range 0x00 0x0F - default 0x02 - help - This value defines the maximum number of retransmissions of a - segmented message to a unicast address that the stack will send if no - acknowledgment was received during timeout, or if an - acknowledgment with already confirmed segments was received. - -config BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP - hex "Retransmissions interval step of missing segments to unicast address" - range 0x00 0x0F - default 0x07 - help - This value controls the interval step used for delaying the - retransmissions of unacknowledged segments of a segmented message to - a unicast address. The interval step is measured in milliseconds and - calculated using the following formula: - (CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP + 1) * 25 ms. - -config BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC - hex "Retransmissions interval increment of missing segments to unicast address" - range 0x00 0x0F - default 0x01 - help - This value controls the interval increment used for delaying the - retransmissions of unacknowledged segments of a segmented message to - a unicast address. The increment is measured in milliseconds and - calculated using the following formula: - (CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC + 1) * 25 ms. - -config BT_MESH_SAR_TX_MULTICAST_RETRANS_COUNT - hex "Total number of retransmissions to multicast address" - range 0x00 0x0F - default 0x02 - help - This value controls the total number of retransmissions of a segmented - message to a multicast address. - -config BT_MESH_SAR_TX_MULTICAST_RETRANS_INT - hex "Interval between retransmissions to multicast address" - range 0x00 0x0F - default 0x09 - help - This value controls the interval between retransmissions of all - segments in a segmented message to a multicast address. The - interval is measured in milliseconds and calculated using the - following formula: - (CONFIG_BT_MESH_SAR_TX_MULTICAST_RETRANS_INT + 1) * 25 ms. - -config BT_MESH_SAR_RX_SEG_THRESHOLD - hex "Acknowledgments retransmission threshold" - range 0x00 0x1F - default 0x03 - help - This value defines a threshold in number of segments of a segmented - message for acknowledgment retransmissions. When the number of - segments of a segmented message is above this threshold, the stack - will additionally retransmit every acknowledgment message the - number of times given by value of CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT. - -config BT_MESH_SAR_RX_ACK_DELAY_INC - hex "Acknowledgment delay increment" - range 0x00 0x07 - default 0x01 - help - This value controls the delay increment of an interval used for - delaying the transmission of an acknowledgment message after - receiving a new segment. The increment is measured in segments - and calculated using the following formula: - CONFIG_BT_MESH_SAR_RX_ACK_DELAY_INC + 1.5. - -config BT_MESH_SAR_RX_SEG_INT_STEP - hex "Segments reception interval step" - range 0x00 0x0F - default 0x05 - help - This value defines the segments reception interval step used for - delaying the transmission of an acknowledgment message after - receiving a new segmnet. The interval is measured in milliseconds - and calculated using the following formula: - (CONFIG_BT_MESH_SAR_RX_SEG_INT_STEP + 1) * 10 ms - -config BT_MESH_SAR_RX_DISCARD_TIMEOUT - hex "Discard timeout for reception of a segmented message" - range 0x00 0x0F - default 0x01 - help - This value defines the time since the last successfully received - segment before giving up the reception of a segmented message. - -config BT_MESH_SAR_RX_ACK_RETRANS_COUNT - hex "Total number of acknowledgment message retransmission" - range 0x00 0x03 - default 0x00 - help - This value defines the total number of retranmissions of an - acknowledgment message that the stack will additionally send when the - size of segments in a segmented message is above the - CONFIG_BT_MESH_SAR_RX_SEG_THRESHOLD value. - -endmenu - menu "Capabilities" config BT_MESH_SUBNET_COUNT From 703022a82847bf827f43c5edd0b8a47252822c0f Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:46:27 +0100 Subject: [PATCH 0365/2300] =?UTF-8?q?[nrf=20fromtree]=C2=A0Bluetooth:=20Me?= =?UTF-8?q?sh:=20Move=20provisioning=201.1=20Kconfig=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move provisioning 1.1 Kconfig options to the provisioning menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit b94b9c7759fefe5dfe424554afa87d65b32bfd73) Signed-off-by: Alperen Şener (cherry picked from commit c67094ab46a6ee93467e127d6e3d8fbdd2c3869b) --- subsys/bluetooth/mesh/Kconfig | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index d3c3397a63d..df16e0696af 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -289,6 +289,24 @@ config BT_MESH_PROV_OOB_PUBLIC_KEY help Enable this option if public key is to be exchanged via Out of Band (OOB) technology. +config BT_MESH_ECDH_P256_CMAC_AES128_AES_CCM + bool "Support CMAC AES128 for OOB authentication" + depends on BT_MESH_PROV + default y + help + Enable this option to support CMAC AES128 for OOB authentication. + +config BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM + bool "Support HMAC SHA256 for OOB authentication" + depends on BT_MESH_PROV + default y + help + Enable this option to support HMAC SHA256 for OOB authentication. + +config BT_MESH_OOB_AUTH_REQUIRED + bool "OOB authentication mandates to use HMAC SHA256" + depends on BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM + config BT_MESH_PROVISIONER bool "Provisioner support" depends on BT_MESH_CDB @@ -1182,24 +1200,6 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -config BT_MESH_ECDH_P256_CMAC_AES128_AES_CCM - bool "Support CMAC AES128 for OOB authentication" - depends on BT_MESH_PROV - default y - help - Enable this option to support CMAC AES128 for OOB authentication. - -config BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM - bool "Support HMAC SHA256 for OOB authentication" - depends on BT_MESH_PROV - default y - help - Enable this option to support HMAC SHA256 for OOB authentication. - -config BT_MESH_OOB_AUTH_REQUIRED - bool "OOB authentication mandates to use HMAC SHA256" - depends on BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM - menuconfig BT_MESH_BLOB_SRV bool "Support for BLOB Transfer Server model" help From 967a3049d9b2633901a91b411f0eb3e6d6a1d1b1 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:48:07 +0100 Subject: [PATCH 0366/2300] [nrf fromtree] Bluetooth: Mesh: Move CDP 1.1 Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move CDP 1.1 Kconfig options to the access layer menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit dcdbb4bceb2dff4d80adb34ec38686483796e40f) Signed-off-by: Alperen Şener (cherry picked from commit a5d294d77beaabc33d99a86491339ebcf35b7081) --- subsys/bluetooth/mesh/Kconfig | 62 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index df16e0696af..8cf91f60221 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -710,6 +710,37 @@ config BT_MESH_MODEL_EXTENSIONS Enable support for the model extension concept, allowing the Access layer to know about mesh model relationships. +config BT_MESH_COMP_PAGE_1 + bool "Support for Composition Data Page 1" + depends on BT_MESH_MODEL_EXTENSIONS + help + Enable support for Composition Data Page 1. + +config BT_MESH_MODEL_EXTENSION_LIST_SIZE + int "Model extensions list size" + depends on BT_MESH_COMP_PAGE_1 + range 0 255 + default 10 + help + This option specifies how many models relations can be saved. + Equals to the number of `bt_mesh_model_extend` and `bt_mesh_model_correspond` calls. + This information is used to construct Composition Data Page 1. + +config BT_MESH_COMP_PAGE_2 + bool "Support for Composition Data Page 2" + help + Enable support for Composition Data Page 2. + +config BT_MESH_COMP_PST_BUF_SIZE + int "Composition Data Page persistence buffer size" + default 100 + help + Stack allocated buffer used to temporarily hold Composition + Data Pages during flash operations. Should reflect the size + of the largest Composition Data Page present in the application. + Note that this buffer should still be large enough to restore previously stored + pages after a performed device firmware update. + config BT_MESH_LABEL_NO_RECOVER bool "[DEPRECATED] Don't recover Label UUIDs from groups address subscription list" select DEPRECATED @@ -1530,37 +1561,6 @@ config BT_MESH_PRIV_BEACON_CLI endif # BT_MESH_PRIV_BEACONS -config BT_MESH_COMP_PST_BUF_SIZE - int "Composition Data Page persistence buffer size" - default 100 - help - Stack allocated buffer used to temporarily hold Composition - Data Pages during flash operations. Should reflect the size - of the largest Composition Data Page present in the application. - Note that this buffer should still be large enough to restore previously stored - pages after a performed device firmware update. - -config BT_MESH_COMP_PAGE_1 - bool "Support for Composition Data Page 1" - depends on BT_MESH_MODEL_EXTENSIONS - help - Enable support for Composition Data Page 1. - -config BT_MESH_COMP_PAGE_2 - bool "Support for Composition Data Page 2" - help - Enable support for Composition Data Page 2. - -config BT_MESH_MODEL_EXTENSION_LIST_SIZE - int "Model extensions list size" - depends on BT_MESH_COMP_PAGE_1 - range 0 255 - default 10 - help - This option specifies how many models relations can be saved. - Equals to the number of `bt_mesh_model_extend` and `bt_mesh_model_correspond` calls. - This information is used to construct Composition Data Page 1. - config BT_MESH_SOLICITATION bool From 30ef569abe584721c9b0f739a969361adc79c607 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:50:38 +0100 Subject: [PATCH 0367/2300] [nrf fromtree] Bluetooth: Mesh: Move MBT models Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move MBT models Kconfig options under the models menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit 11986a29d848d2b6cb082bf2dc9e7bf05aac8f3a) Signed-off-by: Alperen Şener (cherry picked from commit b0bf2220c609a3d47fcb9bb59fa009998141cd38) --- subsys/bluetooth/mesh/Kconfig | 210 +++++++++++++++++----------------- 1 file changed, 105 insertions(+), 105 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 8cf91f60221..55cea1faa65 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -849,6 +849,111 @@ config BT_MESH_HEALTH_CLI_TIMEOUT endif # BT_MESH_HEALTH_CLI +menuconfig BT_MESH_BLOB_SRV + bool "Support for BLOB Transfer Server model" + help + Enable the Binary Large Object (BLOB) Transfer Server model. + +if BT_MESH_BLOB_SRV + +config BT_MESH_BLOB_SRV_PULL_REQ_COUNT + int "Number of chunks to request for each pull" + default 4 + range 1 16 + help + In Pull mode (Pull BLOB Transfer Mode), the BLOB Transfer Server + requests a fixed number of chunks from the Client. Use this option to + control the chunk count in the request. If the BLOB Transfer Server + is instantiated on a Low Power node, the pull request count will be + trimmed to not overflow the Friend queue. + +config BT_MESH_BLOB_SIZE_MAX + int "Largest BLOB size in bytes" + default 524288 + range 1 3257617792 + help + The maximum object size a BLOB Transfer Server can receive. + +config BT_MESH_BLOB_BLOCK_SIZE_MIN + int "Minimum block size" + default 4096 + range 64 1048576 # 2^6 - 2^20 + help + Minimum acceptable block size in a BLOB transfer. The transfer block + size will be some number that is a power of two, and is between block + size min and block size max. If no such number exists, a compile + time warning will be issued. + +config BT_MESH_BLOB_BLOCK_SIZE_MAX + int "Maximum block size" + default 4096 + range BT_MESH_BLOB_BLOCK_SIZE_MIN 1048576 + help + Maximum acceptable block size in a BLOB transfer. The transfer block + size will be some number that is a power of two, and is between block + size min and block size max. If no such number exists, a compile + time warning will be issued. + +config BT_MESH_BLOB_REPORT_TIMEOUT + int "Partial Block Report interval in Pull mode" + default 10 + range 1 31 + help + The timer value that Pull BLOB Transfer Server uses to report missed chunks. + +endif # BT_MESH_BLOB_SRV + +menuconfig BT_MESH_BLOB_CLI + bool "Support for BLOB Transfer Client model" + help + Enable the Binary Large Object (BLOB) Transfer Client model. + +if BT_MESH_BLOB_CLI + +config BT_MESH_BLOB_CLI_BLOCK_RETRIES + int "Number of retries per block" + default 5 + help + Controls the number of times the client will attempt to resend missing + chunks to the BLOB receivers for every block. + +endif + +menu "BLOB models common configuration" + visible if BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI + +config BT_MESH_BLOB_CHUNK_COUNT_MAX + int "Maximum chunk count per block" + default 256 + range 1 2992 + help + A BLOB transfer contains several blocks. Each block is made up of + several chunks. This option controls the maximum chunk count per + block. + +endmenu + +config BT_MESH_BLOB_IO_FLASH + bool "BLOB flash stream" + default y + depends on BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI + depends on FLASH_MAP + help + Enable the BLOB flash stream for reading and writing BLOBs directly to + and from flash. + +config BT_MESH_DFU_SRV + bool "Support for Firmware Update Server model" + depends on BT_MESH_BLOB_SRV + help + Enable the Firmware Update Server model. + +config BT_MESH_DFU_CLI + bool "Support for Firmware Update Client model" + depends on BT_MESH_BLOB_CLI + help + Enable the Firmware Update Client model. + endmenu # Models menu "Proxy" @@ -1231,111 +1336,6 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -menuconfig BT_MESH_BLOB_SRV - bool "Support for BLOB Transfer Server model" - help - Enable the Binary Large Object (BLOB) Transfer Server model. - -if BT_MESH_BLOB_SRV - -config BT_MESH_BLOB_SRV_PULL_REQ_COUNT - int "Number of chunks to request for each pull" - default 4 - range 1 16 - help - In Pull mode (Pull BLOB Transfer Mode), the BLOB Transfer Server - requests a fixed number of chunks from the Client. Use this option to - control the chunk count in the request. If the BLOB Transfer Server - is instantiated on a Low Power node, the pull request count will be - trimmed to not overflow the Friend queue. - -config BT_MESH_BLOB_SIZE_MAX - int "Largest BLOB size in bytes" - default 524288 - range 1 3257617792 - help - The maximum object size a BLOB Transfer Server can receive. - -config BT_MESH_BLOB_BLOCK_SIZE_MIN - int "Minimum block size" - default 4096 - range 64 1048576 # 2^6 - 2^20 - help - Minimum acceptable block size in a BLOB transfer. The transfer block - size will be some number that is a power of two, and is between block - size min and block size max. If no such number exists, a compile - time warning will be issued. - -config BT_MESH_BLOB_BLOCK_SIZE_MAX - int "Maximum block size" - default 4096 - range BT_MESH_BLOB_BLOCK_SIZE_MIN 1048576 - help - Maximum acceptable block size in a BLOB transfer. The transfer block - size will be some number that is a power of two, and is between block - size min and block size max. If no such number exists, a compile - time warning will be issued. - -config BT_MESH_BLOB_REPORT_TIMEOUT - int "Partial Block Report interval in Pull mode" - default 10 - range 1 31 - help - The timer value that Pull BLOB Transfer Server uses to report missed chunks. - -endif # BT_MESH_BLOB_SRV - -menuconfig BT_MESH_BLOB_CLI - bool "Support for BLOB Transfer Client model" - help - Enable the Binary Large Object (BLOB) Transfer Client model. - -if BT_MESH_BLOB_CLI - -config BT_MESH_BLOB_CLI_BLOCK_RETRIES - int "Number of retries per block" - default 5 - help - Controls the number of times the client will attempt to resend missing - chunks to the BLOB receivers for every block. - -endif - -menu "BLOB models common configuration" - visible if BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI - -config BT_MESH_BLOB_CHUNK_COUNT_MAX - int "Maximum chunk count per block" - default 256 - range 1 2992 - help - A BLOB transfer contains several blocks. Each block is made up of - several chunks. This option controls the maximum chunk count per - block. - -endmenu - -config BT_MESH_BLOB_IO_FLASH - bool "BLOB flash stream" - default y - depends on BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI - depends on FLASH_MAP - help - Enable the BLOB flash stream for reading and writing BLOBs directly to - and from flash. - -config BT_MESH_DFU_SRV - bool "Support for Firmware Update Server model" - depends on BT_MESH_BLOB_SRV - help - Enable the Firmware Update Server model. - -config BT_MESH_DFU_CLI - bool "Support for Firmware Update Client model" - depends on BT_MESH_BLOB_CLI - help - Enable the Firmware Update Client model. - menu "Firmware Update model configuration" visible if BT_MESH_DFU_SRV || BT_MESH_DFU_CLI From 260c2c0331280bae8c1db7331b848f7e3f9a4c02 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:51:29 +0100 Subject: [PATCH 0368/2300] [nrf fromtree] Bluetooth: Mesh: Move DFU models Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move DFU models Kconfig options under the models menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit c2299e21206a54aa1234e2566d1f1572fdaa422a) Signed-off-by: Alperen Şener (cherry picked from commit f939aa5332dd07a4127982ecdb9a1797abd0c177) --- subsys/bluetooth/mesh/Kconfig | 190 +++++++++++++++++----------------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 55cea1faa65..a86bb076839 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -954,6 +954,101 @@ config BT_MESH_DFU_CLI help Enable the Firmware Update Client model. +menu "Firmware Update model configuration" + visible if BT_MESH_DFU_SRV || BT_MESH_DFU_CLI + +config BT_MESH_DFU_FWID_MAXLEN + int "DFU FWID max length" + default 16 + range 0 106 + help + This value defines the maximum length of an image's firmware ID. + +config BT_MESH_DFU_METADATA_MAXLEN + int "DFU metadata max length" + default 32 + range 18 255 if BT_MESH_DFU_METADATA + range 0 255 + help + This value defines the maximum length of an image's metadata. + +config BT_MESH_DFU_METADATA + bool "Support for the default metadata format" + help + This option adds a set of functions that can be used to encode and decode a firmware + metadata using the format defined in the Bluetooth Mesh DFU subsystem. + +config BT_MESH_DFU_URI_MAXLEN + int "DFU URI max length" + default 32 + range 0 255 + help + This value defines the maximum length of an image's URI, not including + a string terminator. + +endmenu # Firmware Update model configuration + +menuconfig BT_MESH_DFU_SLOTS + bool "Firmware image slot manager" + default y if BT_MESH_DFU_CLI + help + Enable the DFU image slot manager, for managing firmware distribution slots + for the Firmware Update Client model. + +if BT_MESH_DFU_SLOTS + +config BT_MESH_DFU_SLOT_CNT + int "Number of firmware image slots" + default 1 + range 1 32767 + help + This value defines the number of firmware slots the DFU image slot manager + can keep simultaneously. + +endif + +menuconfig BT_MESH_DFD_SRV + bool "Support for Firmware Distribution Server model" + depends on BT_MESH_BLOB_SRV + depends on BT_MESH_DFU_CLI + help + Enable the Firmware Distribution Server model. + +if BT_MESH_DFD_SRV + +config BT_MESH_DFD_SRV_SLOT_MAX_SIZE + int "Largest DFU image that can be stored" + default BT_MESH_BLOB_SIZE_MAX + range 0 BT_MESH_BLOB_SIZE_MAX + help + This value defines the largest DFU image a single slot can store. + +config BT_MESH_DFD_SRV_SLOT_SPACE + int "Total DFU image storage space" + default BT_MESH_DFD_SRV_SLOT_MAX_SIZE + range 0 4294967295 + help + This value defines the total storage space dedicated to storing DFU + images on the Firmware Distribution Server. + +config BT_MESH_DFD_SRV_TARGETS_MAX + int "Maximum Target node count" + default 8 + range 1 65535 + help + This value defines the maximum number of Target nodes the Firmware + Distribution Server can target simultaneously. + +config BT_MESH_DFD_SRV_OOB_UPLOAD + bool "Support for DFU image OOB upload" + help + This enables support for OOB upload of firmware images for + distribution. This makes several callbacks and use of the init + macro BT_MESH_DFD_SRV_INIT_OOB mandatory. See the API documentation + for bt_mesh_dfd_srv_cb for details about the mandatory callbacks. + +endif + endmenu # Models menu "Proxy" @@ -1336,101 +1431,6 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -menu "Firmware Update model configuration" - visible if BT_MESH_DFU_SRV || BT_MESH_DFU_CLI - -config BT_MESH_DFU_FWID_MAXLEN - int "DFU FWID max length" - default 16 - range 0 106 - help - This value defines the maximum length of an image's firmware ID. - -config BT_MESH_DFU_METADATA_MAXLEN - int "DFU metadata max length" - default 32 - range 18 255 if BT_MESH_DFU_METADATA - range 0 255 - help - This value defines the maximum length of an image's metadata. - -config BT_MESH_DFU_METADATA - bool "Support for the default metadata format" - help - This option adds a set of functions that can be used to encode and decode a firmware - metadata using the format defined in the Bluetooth Mesh DFU subsystem. - -config BT_MESH_DFU_URI_MAXLEN - int "DFU URI max length" - default 32 - range 0 255 - help - This value defines the maximum length of an image's URI, not including - a string terminator. - -endmenu - -menuconfig BT_MESH_DFU_SLOTS - bool "Firmware image slot manager" - default y if BT_MESH_DFU_CLI - help - Enable the DFU image slot manager, for managing firmware distribution slots - for the Firmware Update Client model. - -if BT_MESH_DFU_SLOTS - -config BT_MESH_DFU_SLOT_CNT - int "Number of firmware image slots" - default 1 - range 1 32767 - help - This value defines the number of firmware slots the DFU image slot manager - can keep simultaneously. - -endif - -menuconfig BT_MESH_DFD_SRV - bool "Support for Firmware Distribution Server model" - depends on BT_MESH_BLOB_SRV - depends on BT_MESH_DFU_CLI - help - Enable the Firmware Distribution Server model. - -if BT_MESH_DFD_SRV - -config BT_MESH_DFD_SRV_SLOT_MAX_SIZE - int "Largest DFU image that can be stored" - default BT_MESH_BLOB_SIZE_MAX - range 0 BT_MESH_BLOB_SIZE_MAX - help - This value defines the largest DFU image a single slot can store. - -config BT_MESH_DFD_SRV_SLOT_SPACE - int "Total DFU image storage space" - default BT_MESH_DFD_SRV_SLOT_MAX_SIZE - range 0 4294967295 - help - This value defines the total storage space dedicated to storing DFU - images on the Firmware Distribution Server. - -config BT_MESH_DFD_SRV_TARGETS_MAX - int "Maximum Target node count" - default 8 - range 1 65535 - help - This value defines the maximum number of Target nodes the Firmware - Distribution Server can target simultaneously. - -config BT_MESH_DFD_SRV_OOB_UPLOAD - bool "Support for DFU image OOB upload" - help - This enables support for OOB upload of firmware images for - distribution. This makes several callbacks and use of the init - macro BT_MESH_DFD_SRV_INIT_OOB mandatory. See the API documentation - for bt_mesh_dfd_srv_cb for details about the mandatory callbacks. - -endif - config BT_MESH_RPR_SRV bool "Support for Remote Provisioning Server model" help From a1a2fcd3ed1fdcb2de195e67b207b6f43a0df050 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:52:20 +0100 Subject: [PATCH 0369/2300] [nrf fromtree] Bluetooth: Mesh: Move RPR models Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move RPR models Kconfig options under the models menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit f89effbe755e06d9b8dab83cbda8473e4b739902) Signed-off-by: Alperen Şener (cherry picked from commit bcc463dbb4903f234c8949c5409cef85cb1cd4c8) --- subsys/bluetooth/mesh/Kconfig | 95 ++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index a86bb076839..95a7d468f83 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1049,6 +1049,54 @@ config BT_MESH_DFD_SRV_OOB_UPLOAD endif +config BT_MESH_RPR_SRV + bool "Support for Remote Provisioning Server model" + help + The Remote Provisioning Server is the proxy for a provisioning + process, allowing provisioners to tunnel their provisioning + messages through the mesh to the Remote Provisioning Server, which + communicates directly with the unprovisioned node. + +config BT_MESH_RPR_CLI + bool "Support for Remote Provisioning Client model" + depends on BT_MESH_PROVISIONER + help + The Remote Provisioning Client is instantiated on the provisioner + node, and allows provisioning of new devices through the mesh network + by tunnelling provisioning messages to a Remote Provisioning Server. + +menu "Remote Provisioning configuration" + visible if BT_MESH_RPR_SRV || BT_MESH_RPR_CLI + +config BT_MESH_RPR_AD_TYPES_MAX + int "Max AD types in extended scanning" + default 1 + range 1 16 + help + During extended scanning, the Remote Provisioning Server can include + a set of AD types in the scan reports, collected from the + unprovisioned device's advertisement data. This option controls + the highest number of AD types a single server can scan for, and a + Client can request. + +config BT_MESH_RPR_SRV_SCANNED_ITEMS_MAX + int "Max scannable unprovisioned devices for Remote Provisioning Server" + default 4 + range 4 255 + help + Max number of unique unprovisioned devices a single Remote + Provisioning Server can hold. + +config BT_MESH_RPR_SRV_AD_DATA_MAX + int "Max additional advertisement data to report" + default 31 + range 3 255 + help + Buffer size for the additional advertisement data reported during + extended scanning. + +endmenu # Remote Provisioning configuration + endmenu # Models menu "Proxy" @@ -1431,53 +1479,6 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -config BT_MESH_RPR_SRV - bool "Support for Remote Provisioning Server model" - help - The Remote Provisioning Server is the proxy for a provisioning - process, allowing provisioners to tunnel their provisioning - messages through the mesh to the Remote Provisioning Server, which - communicates directly with the unprovisioned node. - -config BT_MESH_RPR_CLI - bool "Support for Remote Provisioning Client model" - depends on BT_MESH_PROVISIONER - help - The Remote Provisioning Client is instantiated on the provisioner - node, and allows provisioning of new devices through the mesh network - by tunnelling provisioning messages to a Remote Provisioning Server. - -menu "Remote Provisioning configuration" - visible if BT_MESH_RPR_SRV || BT_MESH_RPR_CLI - -config BT_MESH_RPR_AD_TYPES_MAX - int "Max AD types in extended scanning" - default 1 - range 1 16 - help - During extended scanning, the Remote Provisioning Server can include - a set of AD types in the scan reports, collected from the - unprovisioned device's advertisement data. This option controls - the highest number of AD types a single server can scan for, and a - Client can request. - -config BT_MESH_RPR_SRV_SCANNED_ITEMS_MAX - int "Max scannable unprovisioned devices for Remote Provisioning Server" - default 4 - range 4 255 - help - Max number of unique unprovisioned devices a single Remote - Provisioning Server can hold. - -config BT_MESH_RPR_SRV_AD_DATA_MAX - int "Max additional advertisement data to report" - default 31 - range 3 255 - help - Buffer size for the additional advertisement data reported during - extended scanning. -endmenu - config BT_MESH_SAR_CFG bool From 39fb5c567cdfbb368f45bca8352215cffaf77f8f Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:53:04 +0100 Subject: [PATCH 0370/2300] [nrf fromtree] Bluetooth: Mesh: Move SAR models Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move SAR models Kconfig options under the models menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit 5b0a1bb165b8f822f6bc5b75a44f986aa8dfd3f1) Signed-off-by: Alperen Şener (cherry picked from commit b7e7d148f7850dd772316b76111190216393e47c) --- subsys/bluetooth/mesh/Kconfig | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 95a7d468f83..28316764852 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1097,6 +1097,21 @@ config BT_MESH_RPR_SRV_AD_DATA_MAX endmenu # Remote Provisioning configuration +config BT_MESH_SAR_CFG + bool + +config BT_MESH_SAR_CFG_SRV + bool "Support for SAR Configuration Server model" + select BT_MESH_SAR_CFG + help + Enable support for the SAR configuration server model. + +config BT_MESH_SAR_CFG_CLI + bool "Support for SAR Configuration Client Model" + select BT_MESH_SAR_CFG + help + Enable support for the SAR configuration client model. + endmenu # Models menu "Proxy" @@ -1479,21 +1494,6 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -config BT_MESH_SAR_CFG - bool - -config BT_MESH_SAR_CFG_SRV - bool "Support for SAR Configuration Server model" - select BT_MESH_SAR_CFG - help - Enable support for the SAR configuration server model. - -config BT_MESH_SAR_CFG_CLI - bool "Support for SAR Configuration Client Model" - select BT_MESH_SAR_CFG - help - Enable support for the SAR configuration client model. - config BT_MESH_OP_AGG bool From 77b440e6f3dcab982c1c1b466985bd385f3bf348 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:53:41 +0100 Subject: [PATCH 0371/2300] [nrf fromtree] Bluetooth: Mesh: Move OpAgg models Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move OpAgg models Kconfig options under the models menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit 5156f78386efabecef54150b5dc5803c2541e1a7) Signed-off-by: Alperen Şener (cherry picked from commit 99d5b7513896c05291652abfa6f1690bca38a37e) --- subsys/bluetooth/mesh/Kconfig | 64 +++++++++++++++++------------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 28316764852..7f405a0b97d 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1112,6 +1112,38 @@ config BT_MESH_SAR_CFG_CLI help Enable support for the SAR configuration client model. +config BT_MESH_OP_AGG + bool + +config BT_MESH_OP_AGG_SRV + bool "Support for Opcode Aggregator Server Model" + select BT_MESH_OP_AGG + help + Enable support for the Opcode Aggregator Server model. + +config BT_MESH_OP_AGG_CLI + bool "Support for Opcode Aggregator Client Model" + select BT_MESH_OP_AGG + help + Enable support for the Opcode Aggregator Client model. + +if BT_MESH_OP_AGG_CLI + +config BT_MESH_OP_AGG_CLI_TIMEOUT + int "Opcodes Aggregator Client model timeout in milliseconds" + default 10000 + help + This timeout controls how long Opcodes Aggregator Client waits + for a response message to arrive. This value can be changed at + runtime using @ref bt_mesh_op_agg_cli_timeout_set. + +endif # BT_MESH_OP_AGG_CLI + +config BT_MESH_LARGE_COMP_DATA_SRV + bool "Support for Large Composition Data Server Model" + help + Enable support for the Large Composition Data Server model. + endmenu # Models menu "Proxy" @@ -1494,38 +1526,6 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -config BT_MESH_OP_AGG - bool - -config BT_MESH_OP_AGG_SRV - bool "Support for Opcode Aggregator Server Model" - select BT_MESH_OP_AGG - help - Enable support for the Opcode Aggregator Server model. - -config BT_MESH_OP_AGG_CLI - bool "Support for Opcode Aggregator Client Model" - select BT_MESH_OP_AGG - help - Enable support for the Opcode Aggregator Client model. - -if BT_MESH_OP_AGG_CLI - -config BT_MESH_OP_AGG_CLI_TIMEOUT - int "Opcodes Aggregator Client model timeout in milliseconds" - default 10000 - help - This timeout controls how long Opcodes Aggregator Client waits - for a response message to arrive. This value can be changed at - runtime using @ref bt_mesh_op_agg_cli_timeout_set. - -endif # BT_MESH_OP_AGG_CLI - -config BT_MESH_LARGE_COMP_DATA_SRV - bool "Support for Large Composition Data Server Model" - help - Enable support for the Large Composition Data Server model. - if BT_MESH_LARGE_COMP_DATA_SRV config BT_MESH_MODELS_METADATA_PAGE_LEN From 410a6425c3a758b483b57072df5f212514010347 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:54:31 +0100 Subject: [PATCH 0372/2300] [nrf fromtree] Bluetooth: Mesh: Move LCD models Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move LCD models Kconfig options under the models menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit 84febe83a9e37e4a47dba9e334865208849ec3bb) Signed-off-by: Alperen Şener (cherry picked from commit 858988e8ae024aa3144e77f168bc3af2763a233c) --- subsys/bluetooth/mesh/Kconfig | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 7f405a0b97d..96dc0153794 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1144,6 +1144,22 @@ config BT_MESH_LARGE_COMP_DATA_SRV help Enable support for the Large Composition Data Server model. +if BT_MESH_LARGE_COMP_DATA_SRV + +config BT_MESH_MODELS_METADATA_PAGE_LEN + int "Maximum length of the Models Metadata Page" + default 150 + help + This value is the combined total metadata length for + all models on the device. + +endif # BT_MESH_LARGE_COMP_DATA_SRV + +config BT_MESH_LARGE_COMP_DATA_CLI + bool "Support for Large Composition Data Client model" + help + Enable support for the Large Composition Data Client model. + endmenu # Models menu "Proxy" @@ -1526,22 +1542,6 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -if BT_MESH_LARGE_COMP_DATA_SRV - -config BT_MESH_MODELS_METADATA_PAGE_LEN - int "Maximum length of the Models Metadata Page" - default 150 - help - This value is the combined total metadata length for - all models on the device. - -endif # BT_MESH_LARGE_COMP_DATA_SRV - -config BT_MESH_LARGE_COMP_DATA_CLI - bool "Support for Large Composition Data Client model" - help - Enable support for the Large Composition Data Client model. - config BT_MESH_PRIV_BEACONS bool "Support for private beacons" default y From 80aa4a1031ec04cc66d55e0719bc762fa6affefe Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:55:06 +0100 Subject: [PATCH 0373/2300] [nrf fromtree] Bluetooth: Mesh: Move PRB models Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move PRB models Kconfig options under the models menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit 168af2324d21ff1db187996e5484081ee94e5791) Signed-off-by: Alperen Şener (cherry picked from commit 7f59f5ec5693fce145d530829230c306f3c7a9be) --- subsys/bluetooth/mesh/Kconfig | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 96dc0153794..8c84465c6a0 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1160,6 +1160,26 @@ config BT_MESH_LARGE_COMP_DATA_CLI help Enable support for the Large Composition Data Client model. +config BT_MESH_PRIV_BEACONS + bool "Support for private beacons" + default y + help + Enable support for private beacons. + +if BT_MESH_PRIV_BEACONS + +config BT_MESH_PRIV_BEACON_SRV + bool "Support for Private Beacon Server Model" + help + Enable support for the Private Beacon Server model. + +config BT_MESH_PRIV_BEACON_CLI + bool "Support for Private Beacon Client Model" + help + Enable support for the Private Beacon Client model. + +endif # BT_MESH_PRIV_BEACONS + endmenu # Models menu "Proxy" @@ -1542,26 +1562,6 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -config BT_MESH_PRIV_BEACONS - bool "Support for private beacons" - default y - help - Enable support for private beacons. - -if BT_MESH_PRIV_BEACONS - -config BT_MESH_PRIV_BEACON_SRV - bool "Support for Private Beacon Server Model" - help - Enable support for the Private Beacon Server model. - -config BT_MESH_PRIV_BEACON_CLI - bool "Support for Private Beacon Client Model" - help - Enable support for the Private Beacon Client model. - -endif # BT_MESH_PRIV_BEACONS - config BT_MESH_SOLICITATION bool From 0492d2b2738f04ee3fe14bbc2d0083f0ed536d4e Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:56:32 +0100 Subject: [PATCH 0374/2300] [nrf fromtree] Bluetooth: Mesh: Move OdProxy models Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move OdProxy models Kconfig options under the models menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit 343fa6d04439abc220d96e759165da9b750ab064) Signed-off-by: Alperen Şener (cherry picked from commit 23fa37872b170bd11c8dd25dd10dc8089ea1309f) --- subsys/bluetooth/mesh/Kconfig | 110 +++++++++++++++++----------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 8c84465c6a0..89e905f4f0c 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1180,6 +1180,61 @@ config BT_MESH_PRIV_BEACON_CLI endif # BT_MESH_PRIV_BEACONS +config BT_MESH_OD_PRIV_PROXY_CLI + bool "Support for On-Demand Private Proxy Client model" + help + On-Demand Private Proxy Client allows to configure and check the state + of On-Demand Private Proxy Servers. The state determines if the peers will + advertise the Private Network Identity type after receiving a Solicitation PDU. + + +config BT_MESH_OD_PRIV_PROXY_CLI_TIMEOUT + int "Solicitation PDU RPL Configuration Client model timeout in milliseconds" + default 5000 + depends on BT_MESH_OD_PRIV_PROXY_CLI + help + This timeout controls how long the On-Demand Private Proxy Client waits + for a response message to arrive. This value can be changed at runtime + using @ref bt_mesh_od_priv_proxy_cli_timeout_set. + +config BT_MESH_OD_PRIV_PROXY_SRV + bool "Support for On-Demand Private Proxy Server model" + depends on BT_MESH_PRIV_BEACON_SRV + select BT_MESH_SOLICITATION + help + The On-Demand Private Proxy Server is used to support configuration of + advertising with Private Network Identity type of a node. + When enabled, the Solicitation PDU RPL Configuration Server model is also enabled. + +config BT_MESH_PROXY_SRPL_SIZE + int "Size of solicitation replay protection list (SRPL)" + depends on BT_MESH_OD_PRIV_PROXY_SRV + default 10 + range 1 255 + help + Size of SRPL. The list is used to determine if a received Solicitation PDU + is valid. It is valid when the SSRC field value of the received Solicitation PDU + is stored in the SRPL and the SSEQ field value is bigger than the corresponding + stored SSEQ value, or if the SSRC was not stored in the RPL and the SRPL still has + space for new entries. + +config BT_MESH_SOL_PDU_RPL_CLI + bool "Support for Solicitation PDU RPL Configuration Client model" + help + The Solicitation PDU RPL Configuration Client is used to support the + functionality of removing addresses from the solicitation replay + protection list (SRPL) of a node that supports the Solicitation + PDU RPL Configuration Server model. + +config BT_MESH_SOL_PDU_RPL_CLI_TIMEOUT + int "Solicitation PDU RPL Configuration Client model timeout in milliseconds" + default 5000 + depends on BT_MESH_SOL_PDU_RPL_CLI + help + This timeout controls how long Solicitation PDU RPL Configuration Client waits + for a response message to arrive. This value can be changed at runtime + using @ref bt_mesh_sol_pdu_rpl_cli_timeout_set. + endmenu # Models menu "Proxy" @@ -1580,61 +1635,6 @@ config BT_MESH_SOL_ADV_XMIT How many times Solicitation PDU advertisements will be repeated. 0 means that there will be 1 transmission without retransmissions. -config BT_MESH_OD_PRIV_PROXY_CLI - bool "Support for On-Demand Private Proxy Client model" - help - On-Demand Private Proxy Client allows to configure and check the state - of On-Demand Private Proxy Servers. The state determines if the peers will - advertise the Private Network Identity type after receiving a Solicitation PDU. - - -config BT_MESH_OD_PRIV_PROXY_CLI_TIMEOUT - int "Solicitation PDU RPL Configuration Client model timeout in milliseconds" - default 5000 - depends on BT_MESH_OD_PRIV_PROXY_CLI - help - This timeout controls how long the On-Demand Private Proxy Client waits - for a response message to arrive. This value can be changed at runtime - using @ref bt_mesh_od_priv_proxy_cli_timeout_set. - -config BT_MESH_OD_PRIV_PROXY_SRV - bool "Support for On-Demand Private Proxy Server model" - depends on BT_MESH_PRIV_BEACON_SRV - select BT_MESH_SOLICITATION - help - The On-Demand Private Proxy Server is used to support configuration of - advertising with Private Network Identity type of a node. - When enabled, the Solicitation PDU RPL Configuration Server model is also enabled. - -config BT_MESH_PROXY_SRPL_SIZE - int "Size of solicitation replay protection list (SRPL)" - depends on BT_MESH_OD_PRIV_PROXY_SRV - default 10 - range 1 255 - help - Size of SRPL. The list is used to determine if a received Solicitation PDU - is valid. It is valid when the SSRC field value of the received Solicitation PDU - is stored in the SRPL and the SSEQ field value is bigger than the corresponding - stored SSEQ value, or if the SSRC was not stored in the RPL and the SRPL still has - space for new entries. - -config BT_MESH_SOL_PDU_RPL_CLI - bool "Support for Solicitation PDU RPL Configuration Client model" - help - The Solicitation PDU RPL Configuration Client is used to support the - functionality of removing addresses from the solicitation replay - protection list (SRPL) of a node that supports the Solicitation - PDU RPL Configuration Server model. - -config BT_MESH_SOL_PDU_RPL_CLI_TIMEOUT - int "Solicitation PDU RPL Configuration Client model timeout in milliseconds" - default 5000 - depends on BT_MESH_SOL_PDU_RPL_CLI - help - This timeout controls how long Solicitation PDU RPL Configuration Client waits - for a response message to arrive. This value can be changed at runtime - using @ref bt_mesh_sol_pdu_rpl_cli_timeout_set. - menu "Capabilities" config BT_MESH_SUBNET_COUNT From 95d9d5faa20d9e85ec0405fce9daa1feb4d37b91 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 15:57:17 +0100 Subject: [PATCH 0375/2300] [nrf fromtree] Bluetooth: Mesh: Move Solicitation Kconfig options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move Solicitation Kconfig options under the models menu. Signed-off-by: Pavel Vasilyev (cherry picked from commit bb75d1f8130faefff8775d513f4c23af8fe922b1) Signed-off-by: Alperen Şener (cherry picked from commit e5501fa91a2ff5dba2b0f43d6baf7370bba6a355) --- subsys/bluetooth/mesh/Kconfig | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 89e905f4f0c..63d10e8f6d4 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1299,6 +1299,24 @@ config BT_MESH_PROXY_CLIENT i.e. the ability to act as a proxy between a Mesh GATT Service and a Mesh network. +config BT_MESH_SOLICITATION + bool + +config BT_MESH_PROXY_SOLICITATION + bool "Proxy solicitation feature" + select BT_MESH_SOLICITATION + help + This option enables support for sending Solicitation PDUs. + +config BT_MESH_SOL_ADV_XMIT + int "Solicitation PDU retransmission count" + depends on BT_MESH_PROXY_SOLICITATION + range 0 10 + default 2 + help + How many times Solicitation PDU advertisements will be repeated. 0 means that there will be + 1 transmission without retransmissions. + endmenu # Proxy choice BT_MESH_CRYPTO_LIB @@ -1617,24 +1635,6 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND -config BT_MESH_SOLICITATION - bool - -config BT_MESH_PROXY_SOLICITATION - bool "Proxy solicitation feature" - select BT_MESH_SOLICITATION - help - This option enables support for sending Solicitation PDUs. - -config BT_MESH_SOL_ADV_XMIT - int "Solicitation PDU retransmission count" - depends on BT_MESH_PROXY_SOLICITATION - range 0 10 - default 2 - help - How many times Solicitation PDU advertisements will be repeated. 0 means that there will be - 1 transmission without retransmissions. - menu "Capabilities" config BT_MESH_SUBNET_COUNT From bb085651454d2de9be468854ea97927420568802 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Dec 2023 16:01:00 +0100 Subject: [PATCH 0376/2300] [nrf fromtree] Bluetooth: Mesh: Move beacons Kconfiguration under separate submenu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Collect beacons Kconfiguration under own submenu. Signed-off-by: Pavel Vasilyev (cherry picked from commit 83b7513937e03507230bdb35d59275f63fbb47d6) Signed-off-by: Alperen Şener (cherry picked from commit 1e7d45fe707c2c7bde31579e4a85bd720487d084) --- subsys/bluetooth/mesh/Kconfig | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 63d10e8f6d4..e0b4761232c 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1160,12 +1160,6 @@ config BT_MESH_LARGE_COMP_DATA_CLI help Enable support for the Large Composition Data Client model. -config BT_MESH_PRIV_BEACONS - bool "Support for private beacons" - default y - help - Enable support for private beacons. - if BT_MESH_PRIV_BEACONS config BT_MESH_PRIV_BEACON_SRV @@ -1388,6 +1382,8 @@ config BT_MESH_PSA_KEY_ID_USER_MIN_OFFSET endif # BT_MESH_USES_MBEDTLS_PSA || BT_MESH_USES_TFM_PSA +menu "Beacons" + config BT_MESH_BEACON_ENABLED bool "Secure network beacon enabled" default y @@ -1395,6 +1391,14 @@ config BT_MESH_BEACON_ENABLED Controls whether the Secure network beacon feature is enabled by default. Can be changed through runtime configuration. +config BT_MESH_PRIV_BEACONS + bool "Support for private beacons" + default y + help + Enable support for private beacons. + +endmenu # Beacons + menu "IV Index & Sequence number" config BT_MESH_IV_UPDATE_TEST From d5528269c830cc62de3da0e5962d16182334f9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Thu, 18 Jan 2024 14:01:37 +0100 Subject: [PATCH 0377/2300] [nrf fromtree] Bluetooth: Mesh: Add artificial beacon delay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After removing 20ms in advertiser, all subnetwork beacons are sent as high dense packet of frames with minimal distance between them. That might cause collisions if beacon interval on devices will coincide. This commit adds an artificial delay between each subnet advertsing beacons. Signed-off-by: Anders Storrø (cherry picked from commit 93a6ee501ae01bd480eda1151a681aa1f76d84d7) Signed-off-by: Alperen Şener (cherry picked from commit 74bfee1fc5eec7d32cd438d7ccd21b388291fe4f) --- subsys/bluetooth/mesh/beacon.c | 78 ++++++++++++++++----- tests/bsim/bluetooth/mesh/src/test_beacon.c | 22 +++--- 2 files changed, 76 insertions(+), 24 deletions(-) diff --git a/subsys/bluetooth/mesh/beacon.c b/subsys/bluetooth/mesh/beacon.c index 6eb2c9be3a7..cdd5862330e 100644 --- a/subsys/bluetooth/mesh/beacon.c +++ b/subsys/bluetooth/mesh/beacon.c @@ -40,6 +40,8 @@ LOG_MODULE_REGISTER(bt_mesh_beacon); #define PROV_XMIT BT_MESH_TRANSMIT(0, 20) static struct k_work_delayable beacon_timer; +static struct bt_mesh_subnet *beacon_send_sub_curr; + #if defined(CONFIG_BT_MESH_PRIV_BEACONS) static struct { /** @@ -111,13 +113,26 @@ void bt_mesh_beacon_cache_clear(struct bt_mesh_subnet *sub) #endif } +static void beacon_start(uint16_t duration, int err, void *user_data) +{ + if (err) { + LOG_ERR("Failed to send beacon: err %d", err); + if (beacon_send_sub_curr) { + k_work_reschedule(&beacon_timer, K_NO_WAIT); + } + } +} + static void beacon_complete(int err, void *user_data) { struct bt_mesh_beacon *beacon = user_data; LOG_DBG("err %d", err); - beacon->sent = k_uptime_get_32(); + + if (beacon_send_sub_curr) { + k_work_reschedule(&beacon_timer, K_MSEC(20)); + } } static int secure_beacon_create(struct bt_mesh_subnet *sub, @@ -247,11 +262,12 @@ static bool secure_beacon_is_running(void) atomic_test_bit(bt_mesh.flags, BT_MESH_IVU_INITIATOR); } -static bool net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *beacon, - void *cb_data, int (*beacon_create)(struct bt_mesh_subnet *sub, - struct net_buf_simple *buf)) +static int net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *beacon, + int (*beacon_create)(struct bt_mesh_subnet *sub, + struct net_buf_simple *buf)) { static const struct bt_mesh_send_cb send_cb = { + .start = beacon_start, .end = beacon_complete, }; uint32_t now = k_uptime_get_32(); @@ -267,14 +283,14 @@ static bool net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *b if (time_diff < (600 * MSEC_PER_SEC) && (time_diff < BEACON_THRESHOLD(beacon) || time_since_last_recv < (10 * MSEC_PER_SEC))) { - return false; + return -ENOMSG; } adv = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, PROV_XMIT, K_NO_WAIT); if (!adv) { LOG_ERR("Unable to allocate beacon adv"); - return true; /* Bail out */ + return -ENOMEM; /* Bail out */ } err = beacon_create(sub, &adv->b); @@ -284,12 +300,12 @@ static bool net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *b bt_mesh_adv_unref(adv); - return err != 0; + return err; } -static bool net_beacon_for_subnet_send(struct bt_mesh_subnet *sub, void *cb_data) +static int net_beacon_for_subnet_send(struct bt_mesh_subnet *sub) { - bool res = true; + int err = -ENOMSG; struct { struct bt_mesh_beacon *beacon; @@ -315,14 +331,14 @@ static bool net_beacon_for_subnet_send(struct bt_mesh_subnet *sub, void *cb_data continue; } - res = net_beacon_send(sub, beacons[i].beacon, cb_data, beacons[i].create_fn); - if (res) { + err = net_beacon_send(sub, beacons[i].beacon, beacons[i].create_fn); + if (err < 0) { /* Bail out */ break; } } - return res; + return err; } static int unprovisioned_beacon_send(void) @@ -449,6 +465,30 @@ static bool net_beacon_is_running(void) (bt_mesh_priv_beacon_get() == BT_MESH_FEATURE_ENABLED); } +static bool beacons_send_next(void) +{ + int err; + struct bt_mesh_subnet *sub_first = bt_mesh_subnet_next(NULL); + struct bt_mesh_subnet *sub_next; + + do { + sub_next = bt_mesh_subnet_next(beacon_send_sub_curr); + if (sub_next == sub_first && beacon_send_sub_curr != NULL) { + beacon_send_sub_curr = NULL; + return false; + } + + beacon_send_sub_curr = sub_next; + err = net_beacon_for_subnet_send(beacon_send_sub_curr); + if (err < 0 && (err != -ENOMSG)) { + LOG_ERR("Failed to advertise subnet %d: err %d", + beacon_send_sub_curr->net_idx, err); + } + } while (err); + + return true; +} + static void beacon_send(struct k_work *work) { LOG_DBG(""); @@ -458,10 +498,14 @@ static void beacon_send(struct k_work *work) return; } - update_beacon_observation(); - (void)bt_mesh_subnet_find(net_beacon_for_subnet_send, NULL); + if (!beacon_send_sub_curr) { + update_beacon_observation(); + } + + if (!beacons_send_next()) { + k_work_schedule(&beacon_timer, PROVISIONED_INTERVAL); + } - k_work_schedule(&beacon_timer, PROVISIONED_INTERVAL); return; } @@ -473,7 +517,6 @@ static void beacon_send(struct k_work *work) k_work_schedule(&beacon_timer, K_SECONDS(CONFIG_BT_MESH_UNPROV_BEACON_INT)); } - } static bool auth_match(struct bt_mesh_subnet_keys *keys, @@ -757,6 +800,7 @@ void bt_mesh_beacon_ivu_initiator(bool enable) * still have to implement an early exit mechanism, so we might as well * just use this every time. */ + beacon_send_sub_curr = NULL; k_work_schedule(&beacon_timer, K_NO_WAIT); } @@ -779,11 +823,13 @@ void bt_mesh_beacon_enable(void) bt_mesh_subnet_foreach(subnet_beacon_enable); } + beacon_send_sub_curr = NULL; k_work_reschedule(&beacon_timer, K_NO_WAIT); } void bt_mesh_beacon_disable(void) { /* If this fails, we'll do an early exit in the work handler. */ + beacon_send_sub_curr = NULL; (void)k_work_cancel_delayable(&beacon_timer); } diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index 7a74123cb0f..869dbd4965f 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -507,8 +507,11 @@ static void corrupted_beacon_test(const uint8_t *offsets, } /* Now the beacon payload is valid and it shall trigger IV Update on the node. It shall also - * increase the beacon interval. + * increase the beacon interval. We delay the outgoing beacon for a couple of seconds to + * avoid near perfect syncing with the beacon interval cycle of the device we just received + * a beacon from. */ + k_sleep(K_SECONDS(3)); send_beacon(buf); /* The beacon interval shall be changed and the node shall skip transmission of the next @@ -1365,7 +1368,7 @@ static void test_tx_priv_interleave(void) struct bt_mesh_subnet *sub; - bt_mesh_test_cfg_set(NULL, BEACON_INTERVAL_WAIT_TIME); + bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&prov, &prb_comp); provision(&tx_cfg); @@ -1398,6 +1401,8 @@ static void test_tx_priv_interleave(void) k_sleep(K_SECONDS(BEACON_INTERVAL + 5)); toggle_priv_beacon(tx_cfg.addr, 0); + /* Small delay to let beacons complete before subnet update is applied */ + k_sleep(K_MSEC(20)); status = bt_mesh_subnet_update(BT_MESH_KEY_PRIMARY, net_key_new); ASSERT_TRUE(status == STATUS_SUCCESS); @@ -1423,7 +1428,7 @@ static void test_rx_priv_interleave(void) int err; bool same_random = false; - bt_mesh_test_cfg_set(&rx_cfg, BEACON_INTERVAL_WAIT_TIME); + bt_mesh_test_cfg_set(&rx_cfg, WAIT_TIME); bt_mesh_crypto_init(); k_sem_init(&observer_sem, 0, 1); @@ -1898,9 +1903,10 @@ static void proxy_adv_confirm_evt(struct expected_proxy_adv_evt *exp_evts, uint8 for (int i = 0; i < cnt; i++) { if (exp_evts[i].evt_cnt) { - LOG_ERR("Missing %d expected %s events in period %llums-%llums", + LOG_ERR("Missing %d expected %s idx %d events in period %llums-%llums", exp_evts[i].evt_cnt, proxy_adv_str[exp_evts[i].evt_type], - exp_evts[i].time.after, exp_evts[i].time.before); + exp_evts[i].net_idx, exp_evts[i].time.after, + exp_evts[i].time.before); missing_evts = true; } } @@ -2029,13 +2035,13 @@ static void test_rx_proxy_adv_multi_subnet_coex(void) * is advertised by this subnet, and that the two others * continues to advertise NET_ID. */ - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 17, + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 16, .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, - {.evt_type = BEACON_TYPE_NODE_ID, .net_idx = 1, .evt_cnt = 17, + {.evt_type = BEACON_TYPE_NODE_ID, .net_idx = 1, .evt_cnt = 16, .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 17, + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 16, .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, From f069c9f4cd6bbb7dbc3b174edb2569b53979ce76 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 22 Jan 2024 14:40:38 +0100 Subject: [PATCH 0378/2300] [nrf fromtree] Bluetooth: Mesh: Call bt_mesh_send_cb.end cb by the end of adv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this change, the bt_mesh_send_cb.end callback was called when all references to the adv were removed. If an implementation kept more references to the adv buffer after calling `bt_mesh_adv_send`, the end callback would not be called when the advertiser finished advertising this adv. With this change, the end callback is always called by the advertiser when the advertisement is finished regardless of the number of references. This allows an implementation to keep the adv buffer for the future use. As an example, pb_adv.c keeps advs for retransmission. Signed-off-by: Pavel Vasilyev (cherry picked from commit 9af051e3499fccdb1898748d2afd8dcd06d013f2) Signed-off-by: Alperen Şener (cherry picked from commit a3fe63240749bf6f442c66a7f9dc7ee04a1e60fb) --- subsys/bluetooth/mesh/adv.c | 4 +--- subsys/bluetooth/mesh/adv.h | 1 + subsys/bluetooth/mesh/adv_ext.c | 5 +++++ subsys/bluetooth/mesh/adv_legacy.c | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index 00e2a4aa7bb..d51f0946b85 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -76,7 +76,7 @@ void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv_ctx * } } -static void bt_mesh_adv_send_end(int err, struct bt_mesh_adv_ctx const *ctx) +void bt_mesh_adv_send_end(int err, struct bt_mesh_adv_ctx const *ctx) { if (ctx->started && ctx->cb && ctx->cb->end) { ctx->cb->end(err, ctx->cb_data); @@ -136,7 +136,6 @@ void bt_mesh_adv_unref(struct bt_mesh_adv *adv) } struct k_mem_slab *slab = &local_adv_pool; - struct bt_mesh_adv_ctx ctx = adv->ctx; #if defined(CONFIG_BT_MESH_RELAY) if (adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) { @@ -151,7 +150,6 @@ void bt_mesh_adv_unref(struct bt_mesh_adv *adv) #endif k_mem_slab_free(slab, (void *)adv); - bt_mesh_adv_send_end(0, &ctx); } struct bt_mesh_adv *bt_mesh_adv_create(enum bt_mesh_adv_type type, diff --git a/subsys/bluetooth/mesh/adv.h b/subsys/bluetooth/mesh/adv.h index 0c936a1aa52..e79d082862a 100644 --- a/subsys/bluetooth/mesh/adv.h +++ b/subsys/bluetooth/mesh/adv.h @@ -76,6 +76,7 @@ struct bt_mesh_adv *bt_mesh_adv_create(enum bt_mesh_adv_type type, void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, void *cb_data); +void bt_mesh_adv_send_end(int err, struct bt_mesh_adv_ctx const *ctx); struct bt_mesh_adv *bt_mesh_adv_get(k_timeout_t timeout); diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 8f4f05a34cf..1cac272f7c3 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -284,7 +284,12 @@ static void send_pending_adv(struct k_work *work) atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); if (ext_adv->adv) { + struct bt_mesh_adv_ctx ctx = ext_adv->adv->ctx; + + ext_adv->adv->ctx.started = 0; bt_mesh_adv_unref(ext_adv->adv); + bt_mesh_adv_send_end(0, &ctx); + ext_adv->adv = NULL; } diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index d4003e497bb..135f444b9b4 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -182,7 +182,11 @@ static void adv_thread(void *p1, void *p2, void *p3) adv_send(adv); } + struct bt_mesh_adv_ctx ctx = adv->ctx; + + adv->ctx.started = 0; bt_mesh_adv_unref(adv); + bt_mesh_adv_send_end(0, &ctx); /* Give other threads a chance to run */ k_yield(); From 300cc7f19a4f615d087fe470e918af58e50e18d9 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 22 Jan 2024 14:49:19 +0100 Subject: [PATCH 0379/2300] [nrf fromtree] Bluetooth: Mesh: Add error code for bt_mesh_adv_terminate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return error code to let an implementation know if the adv was actually stopped (was scheduled) or not. Signed-off-by: Pavel Vasilyev (cherry picked from commit fcfc99a21d25b38aad036937f6aabef244390644) Signed-off-by: Alperen Şener (cherry picked from commit 9ad707761b1a781a4dbe48074966d20e09e89066) --- subsys/bluetooth/mesh/adv.h | 2 +- subsys/bluetooth/mesh/adv_ext.c | 10 ++++++---- subsys/bluetooth/mesh/adv_legacy.c | 4 +++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/mesh/adv.h b/subsys/bluetooth/mesh/adv.h index e79d082862a..6595badc9f9 100644 --- a/subsys/bluetooth/mesh/adv.h +++ b/subsys/bluetooth/mesh/adv.h @@ -101,7 +101,7 @@ void bt_mesh_adv_local_ready(void); void bt_mesh_adv_relay_ready(void); -void bt_mesh_adv_terminate(struct bt_mesh_adv *adv); +int bt_mesh_adv_terminate(struct bt_mesh_adv *adv); void bt_mesh_adv_friend_ready(void); diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 1cac272f7c3..c195671ebcb 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -395,7 +395,7 @@ void bt_mesh_adv_friend_ready(void) } } -void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) +int bt_mesh_adv_terminate(struct bt_mesh_adv *adv) { int err; @@ -407,13 +407,13 @@ void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) } if (!atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { - return; + return 0; } err = bt_le_ext_adv_stop(ext_adv->instance); if (err) { LOG_ERR("Failed to stop adv %d", err); - return; + return err; } /* Do not call `cb:end`, since this user action */ @@ -423,8 +423,10 @@ void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) k_work_submit(&ext_adv->work); - return; + return 0; } + + return -EINVAL; } void bt_mesh_adv_init(void) diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index 135f444b9b4..867c91bbf8e 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -214,9 +214,11 @@ void bt_mesh_adv_gatt_update(void) bt_mesh_adv_get_cancel(); } -void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) +int bt_mesh_adv_terminate(struct bt_mesh_adv *adv) { ARG_UNUSED(adv); + + return 0; } void bt_mesh_adv_init(void) From ae1cfd686cc6c72bee6e37052ed0ec1434a83732 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 22 Jan 2024 14:50:19 +0100 Subject: [PATCH 0380/2300] [nrf fromtree] Bluetooth: Mesh: Send provisioning PDUs with randomized delay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This implements the following statement from the section 5.3.3: Each Generic Provisioning PDU shall be sent after a random delay between 20 and 50 milliseconds. Signed-off-by: Pavel Vasilyev (cherry picked from commit 54c048989d343ecfd1a8dd00ce9993cbd11685d8) Signed-off-by: Alperen Şener (cherry picked from commit ef91b0264dabaebf984be44bd1f0a8ec8539d110) --- subsys/bluetooth/mesh/pb_adv.c | 224 +++++++++++++++++++++++++-------- 1 file changed, 174 insertions(+), 50 deletions(-) diff --git a/subsys/bluetooth/mesh/pb_adv.c b/subsys/bluetooth/mesh/pb_adv.c index f723ff48c14..c5c56b1e5b0 100644 --- a/subsys/bluetooth/mesh/pb_adv.c +++ b/subsys/bluetooth/mesh/pb_adv.c @@ -67,6 +67,8 @@ enum { ADV_LINK_INVALID, /* Error occurred during provisioning */ ADV_ACK_PENDING, /* An acknowledgment is being sent */ ADV_PROVISIONER, /* The link was opened as provisioner */ + ADV_LINK_ACK_SENDING, /* Link Ack tx was scheduled but not finished. */ + ADV_SENDING, /* Sending any PDU */ ADV_NUM_FLAGS, }; @@ -100,15 +102,30 @@ struct pb_adv { /* Transaction timeout in seconds */ uint8_t timeout; - /* Pending outgoing adv(s) */ + /* Pending outgoing adv(s) (Link Open, Gen Trans Start and Gen Trans Cont) */ struct bt_mesh_adv *adv[3]; + /* Index of the next adv to be sent */ + int next; + prov_bearer_send_complete_t cb; void *cb_data; /* Retransmit timer */ struct k_work_delayable retransmit; + + /* Unacked adv buffers (Link Ack, Link Close and Gen Trans Ack). Array size is + * hardcoded to 2 allowing to send Gen Trans Ack and Link Close at the same time. + */ + struct unacked_adv_ctx { + struct bt_mesh_adv *adv; + prov_bearer_send_complete_t cb; + void *cb_data; + } unacked[2]; + + /* Last sent unacked[] buffer */ + int last_unacked; } tx; /* Protocol timeout */ @@ -132,28 +149,124 @@ static void link_close(struct prov_rx *rx, struct net_buf_simple *buf); static void prov_link_close(enum prov_bearer_link_status status); static void close_link(enum prov_bearer_link_status status); -static void buf_sent(int err, void *user_data) +static void tx_work_handler(struct k_work *work); +static K_WORK_DELAYABLE_DEFINE(tx_work, tx_work_handler); + +static void tx_schedule(void) { - enum prov_bearer_link_status reason = (enum prov_bearer_link_status)(int)user_data; + uint16_t random_delay; - if (atomic_test_and_clear_bit(link.flags, ADV_LINK_CLOSING)) { - close_link(reason); + if (atomic_test_bit(link.flags, ADV_SENDING)) { + LOG_DBG("Another tx is in progress"); return; } + + (void)bt_rand(&random_delay, sizeof(random_delay)); + random_delay = 20 + (random_delay % 30); + + LOG_DBG("Next PDU delayed by %ums", random_delay); + + (void)k_work_schedule(&tx_work, K_MSEC(random_delay)); +} + +static int send_unacked(struct bt_mesh_adv *adv, prov_bearer_send_complete_t cb, + void *cb_data) +{ + for (int i = 0; i < ARRAY_SIZE(link.tx.unacked); i++) { + if (link.tx.unacked[i].adv != NULL) { + continue; + } + + link.tx.unacked[i].adv = adv; + link.tx.unacked[i].cb = cb; + link.tx.unacked[i].cb_data = cb_data; + + tx_schedule(); + + return 0; + } + + LOG_WRN("No memory to send unacked PDU: %s", bt_hex(adv->b.data, adv->b.len)); + return -ENOMEM; +} + +static void send_reliable(void) +{ + /* Dropping next tx adv index to start transmission from the first adv buffer. */ + link.tx.next = 0; + + tx_schedule(); +} + +static void delayed_adv_send_end(int err, void *user_data) +{ + bool unacked = (bool)user_data; + struct unacked_adv_ctx *unacked_adv = &link.tx.unacked[link.tx.last_unacked]; + + if (unacked && unacked_adv->adv != NULL) { + if (unacked_adv->cb) { + unacked_adv->cb(err, unacked_adv->cb_data); + } + + bt_mesh_adv_unref(unacked_adv->adv); + unacked_adv->adv = NULL; + } + + atomic_clear_bit(link.flags, ADV_SENDING); + tx_schedule(); } -static void buf_start(uint16_t duration, int err, void *user_data) +static void delayed_adv_send_start(uint16_t duration, int err, void *user_data) { if (err) { - buf_sent(err, user_data); + delayed_adv_send_end(err, user_data); } } -static struct bt_mesh_send_cb buf_sent_cb = { - .start = buf_start, - .end = buf_sent, +static const struct bt_mesh_send_cb delayed_adv_send_cb = { + .start = delayed_adv_send_start, + .end = delayed_adv_send_end, }; +static void tx_work_handler(struct k_work *work) +{ + int i; + + /* Send Link Ack, Link Close and Gen Trans Ack first. */ + for (i = 0; i < ARRAY_SIZE(link.tx.unacked); i++) { + int idx = (i + link.tx.last_unacked) % ARRAY_SIZE(link.tx.unacked); + struct unacked_adv_ctx *unacked = &link.tx.unacked[idx]; + + if (!unacked->adv) { + continue; + } + + atomic_set_bit(link.flags, ADV_SENDING); + bt_mesh_adv_send(unacked->adv, &delayed_adv_send_cb, (void *)true); + + link.tx.last_unacked = idx; + + return; + } + + /* Send Trans Start, Trans Cont and Link Open */ + if (link.tx.next >= ARRAY_SIZE(link.tx.adv) || link.tx.adv[link.tx.next] == NULL) { + LOG_DBG("All PDUs were sent"); + return; + } + + atomic_set_bit(link.flags, ADV_SENDING); + bt_mesh_adv_send(link.tx.adv[link.tx.next], &delayed_adv_send_cb, (void *)false); + + link.tx.next++; + + if (link.tx.next == ARRAY_SIZE(link.tx.adv) || link.tx.adv[link.tx.next] == NULL) { + /* All ack-able PDUs are sent. Now we can run the retransmit timer. */ + LOG_DBG("Starting retransmit timer"); + k_work_reschedule(&link.tx.retransmit, RETRANSMIT_TIMEOUT); + } +} + static uint8_t last_seg(uint16_t len) { if (len <= START_PAYLOAD_MAX) { @@ -168,9 +281,11 @@ static uint8_t last_seg(uint16_t len) static void free_segments(void) { int i; + bool canceled = false; for (i = 0; i < ARRAY_SIZE(link.tx.adv); i++) { struct bt_mesh_adv *adv = link.tx.adv[i]; + int err; if (!adv) { break; @@ -180,14 +295,23 @@ static void free_segments(void) /* Terminate active adv */ if (adv->ctx.busy == 0U) { - bt_mesh_adv_terminate(adv); + err = bt_mesh_adv_terminate(adv); + if (err == 0) { + canceled = true; + } } else { /* Mark as canceled */ adv->ctx.busy = 0U; + canceled = true; } bt_mesh_adv_unref(adv); } + + if (canceled) { + atomic_clear_bit(link.flags, ADV_SENDING); + tx_schedule(); + } } static uint8_t next_transaction_id(uint8_t id) @@ -268,7 +392,7 @@ static struct bt_mesh_adv *adv_create(uint8_t retransmits) return adv; } -static void ack_complete(uint16_t duration, int err, void *user_data) +static void ack_complete(int err, void *user_data) { LOG_DBG("xact 0x%x complete", (uint8_t)link.tx.pending_ack); atomic_clear_bit(link.flags, ADV_ACK_PENDING); @@ -323,12 +447,9 @@ static void protocol_timeout(struct k_work *work) static void gen_prov_ack_send(uint8_t xact_id) { - static const struct bt_mesh_send_cb cb = { - .start = ack_complete, - }; - const struct bt_mesh_send_cb *complete; struct bt_mesh_adv *adv; bool pending = atomic_test_and_set_bit(link.flags, ADV_ACK_PENDING); + int err; LOG_DBG("xact_id 0x%x", xact_id); @@ -343,19 +464,18 @@ static void gen_prov_ack_send(uint8_t xact_id) return; } - if (pending) { - complete = NULL; - } else { + if (!pending) { link.tx.pending_ack = xact_id; - complete = &cb; } net_buf_simple_add_be32(&adv->b, link.id); net_buf_simple_add_u8(&adv->b, xact_id); net_buf_simple_add_u8(&adv->b, GPC_ACK); - bt_mesh_adv_send(adv, complete, NULL); - bt_mesh_adv_unref(adv); + err = send_unacked(adv, pending ? NULL : ack_complete, NULL); + if (err) { + atomic_clear_bit(link.flags, ADV_ACK_PENDING); + } } static void gen_prov_cont(struct prov_rx *rx, struct net_buf_simple *buf) @@ -591,29 +711,6 @@ static void gen_prov_recv(struct prov_rx *rx, struct net_buf_simple *buf) * TX ******************************************************************************/ -static void send_reliable(void) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(link.tx.adv); i++) { - struct bt_mesh_adv *adv = link.tx.adv[i]; - - if (!adv) { - break; - } - - if (adv->ctx.busy) { - continue; - } - - LOG_DBG("%u bytes: %s", adv->b.len, bt_hex(adv->b.data, adv->b.len)); - - bt_mesh_adv_send(adv, NULL, NULL); - } - - k_work_reschedule(&link.tx.retransmit, RETRANSMIT_TIMEOUT); -} - static void prov_retransmit(struct k_work *work) { LOG_DBG(""); @@ -669,8 +766,22 @@ static int bearer_ctl_send(struct bt_mesh_adv *adv) return 0; } +static void buf_sent(int err, void *user_data) +{ + enum prov_bearer_link_status reason = (enum prov_bearer_link_status)(int)user_data; + + atomic_clear_bit(link.flags, ADV_LINK_ACK_SENDING); + + if (atomic_test_and_clear_bit(link.flags, ADV_LINK_CLOSING)) { + close_link(reason); + return; + } +} + static int bearer_ctl_send_unacked(struct bt_mesh_adv *adv, void *user_data) { + int err; + if (!adv) { return -ENOMEM; } @@ -678,10 +789,12 @@ static int bearer_ctl_send_unacked(struct bt_mesh_adv *adv, void *user_data) prov_clear_tx(); k_work_reschedule(&link.prot_timer, bt_mesh_prov_protocol_timeout_get()); - bt_mesh_adv_send(adv, &buf_sent_cb, user_data); - bt_mesh_adv_unref(adv); + err = send_unacked(adv, &buf_sent, user_data); + if (err) { + bt_mesh_adv_unref(adv); + } - return 0; + return err; } static int prov_send_adv(struct net_buf_simple *msg, @@ -772,8 +885,13 @@ static void link_open(struct prov_rx *rx, struct net_buf_simple *buf) return; } - LOG_DBG("Resending link ack"); + if (atomic_test_bit(link.flags, ADV_LINK_ACK_SENDING)) { + LOG_DBG("Still sending Link Ack"); + return; + } + /* Ignore errors, message will be attempted again if we keep receiving link open: */ + atomic_set_bit(link.flags, ADV_LINK_ACK_SENDING); (void)bearer_ctl_send_unacked( ctl_adv_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), (void *)PROV_BEARER_LINK_STATUS_SUCCESS); @@ -789,6 +907,7 @@ static void link_open(struct prov_rx *rx, struct net_buf_simple *buf) atomic_set_bit(link.flags, ADV_LINK_ACTIVE); net_buf_simple_reset(link.rx.buf); + atomic_set_bit(link.flags, ADV_LINK_ACK_SENDING); err = bearer_ctl_send_unacked( ctl_adv_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), (void *)PROV_BEARER_LINK_STATUS_SUCCESS); @@ -923,6 +1042,8 @@ static int prov_link_accept(const struct prov_bearer_cb *cb, void *cb_data) static void prov_link_close(enum prov_bearer_link_status status) { + int err; + if (atomic_test_and_set_bit(link.flags, ADV_LINK_CLOSING)) { return; } @@ -934,9 +1055,12 @@ static void prov_link_close(enum prov_bearer_link_status status) */ link.tx.timeout = CLOSING_TIMEOUT; /* Ignore errors, the link will time out eventually if this doesn't get sent */ - bearer_ctl_send_unacked( + err = bearer_ctl_send_unacked( ctl_adv_create(LINK_CLOSE, &status, 1, RETRANSMITS_LINK_CLOSE), (void *)status); + if (err) { + close_link(status); + } } void bt_mesh_pb_adv_init(void) From e91d83a89cd29f3234831c961b2e568d0b1df4b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stine=20=C3=85kredalen?= Date: Wed, 31 Jan 2024 04:03:52 -0800 Subject: [PATCH 0381/2300] [nrf fromtree] Bluetooth: Mesh: fix SRPL always accepting sol pdus with sseq 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated logic in srpl_entry_save. Signed-off-by: Stine Åkredalen (cherry picked from commit a1b9f0a7d6b3844a7836d993ae45b6790577d57a) Signed-off-by: Alperen Şener (cherry picked from commit b722252e766abd738257540a7f30cab4ef41633e) --- subsys/bluetooth/mesh/solicitation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/solicitation.c b/subsys/bluetooth/mesh/solicitation.c index 642abfd87f1..a2872daecb0 100644 --- a/subsys/bluetooth/mesh/solicitation.c +++ b/subsys/bluetooth/mesh/solicitation.c @@ -65,7 +65,7 @@ static int srpl_entry_save(struct bt_mesh_subnet *sub, uint32_t sseq, uint16_t s entry = srpl_find_by_addr(ssrc); if (entry) { - if (entry->sseq >= sseq && sseq != 0) { + if (entry->sseq >= sseq) { LOG_WRN("Higher or equal SSEQ already saved for this SSRC"); return -EALREADY; } From 753f3c21ef9ced4b4c1da3dde07def93e373f820 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 5 Feb 2024 13:07:18 +0100 Subject: [PATCH 0382/2300] [nrf fromtree] Bluetooth: Mesh: Reset solicitation settings before calling reset cb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trigger erasing solicitation settings before calling `bt_mesh_settings_store_pending` and `bt_mesh_prov.reset` callback. The `bt_mesh_settings_store_pending` flushes every settings that is pending to be erased. The `bt_mesh_prov.reset` callback must be called as the last step because a user is free to do anything from this callback including rebooting or reprovisioning the device. Signed-off-by: Pavel Vasilyev (cherry picked from commit e495876db6900a4b64d82825f795454b2b507a5d) Signed-off-by: Alperen Şener (cherry picked from commit db6e332e4704d2fd700fac7cc9463ff2c142b814) --- subsys/bluetooth/mesh/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 1b80233cec1..77ca15b2d61 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -401,6 +401,10 @@ void bt_mesh_reset(void) bt_mesh_comp_unprovision(); + if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION)) { + bt_mesh_sol_reset(); + } + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { bt_mesh_settings_store_pending(); } @@ -408,10 +412,6 @@ void bt_mesh_reset(void) if (IS_ENABLED(CONFIG_BT_MESH_PROV)) { bt_mesh_prov_reset(); } - - if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION)) { - bt_mesh_sol_reset(); - } } bool bt_mesh_is_provisioned(void) From 0ec9f7cef89c90428f2d92531bec7bcce74c236b Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 5 Feb 2024 16:15:41 +0100 Subject: [PATCH 0383/2300] [nrf fromtree] Bluetooth: Mesh: Fix solicitation PDU tx dep on proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If `CONFIG_BT_MESH_GATT_SERVER` is disabled or the advertising set doesn't support proxy adv, the solicitation PDU will not be sent. However, solicitation PDU transmission doesn't depend on the proxy feature of the device it sends. Therefore, solicatation PDU should be sent regradless of `CONFIG_BT_MESH_GATT_SERVER` option and advertiser tag. Signed-off-by: Pavel Vasilyev (cherry picked from commit 548851ac7a530f20cadab680000282f1e3c697c5) Signed-off-by: Alperen Şener (cherry picked from commit 491c33f2bd4e5191dc96efb1643d7f3b39c4ab70) --- subsys/bluetooth/mesh/adv_ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index c195671ebcb..a80a47760ea 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -317,13 +317,13 @@ static void send_pending_adv(struct k_work *work) } } - if (!IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER) || - !(ext_adv->tags & BT_MESH_ADV_TAG_BIT_PROXY)) { + if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && + !bt_mesh_sol_send()) { return; } - if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && - !bt_mesh_sol_send()) { + if (!IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER) || + !(ext_adv->tags & BT_MESH_ADV_TAG_BIT_PROXY)) { return; } From ea43799e039973838c673a0225422e842afba5a6 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 1 Feb 2024 23:04:30 +0100 Subject: [PATCH 0384/2300] [nrf fromtree] Bluetooth: Mesh: Warn if trying to send adv while suspended MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will warn if any of the mesh module will try to send anything while the stack is suspended. Not clear what to do here as both advertisers (legacy and ext) behaves differently. The legacy advertiser has a thread which is stopped after the `bt_mesh_adv_disable` call and any sent advs after suspending the stack will stay in the pool until the advertiser is resumed. The extended advertiser will schedule its work, but then fail because `ext_adv->instance` value is NULL, but will call `bt_mesh_send_cb.start` with error `-ENODEV`. What to do with these 2 behaviors is unclear at the moment. Ideally none of the mesh stack modules should call `bt_mesh_adv_send` after the stack was suspended, so if this warning appears, the faulty module wasn't stopped properly and this should be fixed. If not to add the adv to the pool, then it kind of gets lost as the implementation probably expects one of `bt_mesh_send_cb` callbacks which will never be called. Leaving the warning until clear customer request comes. Signed-off-by: Pavel Vasilyev (cherry picked from commit 9171ee24da8f0042c6f96cac21daeb283f29b521) Signed-off-by: Alperen Şener (cherry picked from commit aa7858fc7a11bbb9419d45c748fedb76c2f57abe) --- subsys/bluetooth/mesh/adv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index d51f0946b85..d9b191120d1 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -257,6 +257,10 @@ void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, LOG_DBG("type 0x%02x len %u: %s", adv->ctx.type, adv->b.len, bt_hex(adv->b.data, adv->b.len)); + if (atomic_test_bit(bt_mesh.flags, BT_MESH_SUSPENDED)) { + LOG_WRN("Sending advertisement while suspended"); + } + adv->ctx.cb = cb; adv->ctx.cb_data = cb_data; adv->ctx.busy = 1U; From 3d12d97604944eca3fe781ed9b02695eec2307b0 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 8 Feb 2024 14:47:24 +0100 Subject: [PATCH 0385/2300] [nrf fromtree] Bluetooth: Mesh: Disable randomization in DFD model for canceling update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable randomization in the access layer when cancelling update in the distribution server model. This is needed because the server sends 2 messages in a row and the gets reordered by the access layer randomization feature making DFU/SR/FD/BV-43-C test to fail. This fixes DFU/SR/FD/BV-43-C test. Signed-off-by: Pavel Vasilyev (cherry picked from commit 44f86b81a3134ad6d9ac8d71c33c5880572cf8f8) Signed-off-by: Alperen Şener (cherry picked from commit f64ac7ad2b66abaa44d615af28f0f04fabf828fa) --- subsys/bluetooth/mesh/dfd_srv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subsys/bluetooth/mesh/dfd_srv.c b/subsys/bluetooth/mesh/dfd_srv.c index 54184acd9b8..e765f2d5d7b 100644 --- a/subsys/bluetooth/mesh/dfd_srv.c +++ b/subsys/bluetooth/mesh/dfd_srv.c @@ -1148,6 +1148,14 @@ enum bt_mesh_dfd_status bt_mesh_dfd_srv_cancel(struct bt_mesh_dfd_srv *srv, return BT_MESH_DFD_ERR_INTERNAL; } + if (prev_phase == BT_MESH_DFD_PHASE_APPLYING_UPDATE && ctx) { + /* Disable randomization for the Firmware Distribution State message to avoid + * reordering when Firmware Distribution Server sends 2 messages in a row when + * cancelling the update (see section 6.2.3.10 of MshDFUv1.0). + */ + ctx->rnd_delay = false; + } + if (ctx != NULL) { status_rsp(srv, ctx, BT_MESH_DFD_SUCCESS); } From 0ec3ab3bb6212be934d6ce0d91fde2442ff2b139 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 8 Feb 2024 14:49:21 +0100 Subject: [PATCH 0386/2300] [nrf fromtree] Bluetooth: Mesh: Disable randomization on Link Close in RPR server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable randomization at the access layer in the Remote Provisioning server when sending Link Stauts message as a responce on Link Close message and then sending Link Report message right after it. Because of the randomization, the report message is sent before the status message which makes MESH/SR/RPR/PDU/BV-03-C test to fail. This fixes MESH/SR/RPR/PDU/BV-03-C test. Signed-off-by: Pavel Vasilyev (cherry picked from commit 0ea8cef97afe7b45719a2e181867e21f316d9347) Signed-off-by: Alperen Şener (cherry picked from commit 91f4f5af6aea0e653ef18d71dc85261e1633678f) --- subsys/bluetooth/mesh/rpr_srv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subsys/bluetooth/mesh/rpr_srv.c b/subsys/bluetooth/mesh/rpr_srv.c index e97df35f28f..ac3fd190880 100644 --- a/subsys/bluetooth/mesh/rpr_srv.c +++ b/subsys/bluetooth/mesh/rpr_srv.c @@ -968,6 +968,12 @@ static int handle_link_close(const struct bt_mesh_model *mod, struct bt_mesh_msg * which will be used in the link report when the link is fully closed. */ + /* Disable randomization for the Remote Provisioning Link Status message to avoid reordering + * of it with the Remote Provisioning Link Report message that shall be sent in a sequence + * when closing an active link (see section 4.4.5.5.3.3 of MshPRTv1.1). + */ + ctx->rnd_delay = false; + link_status_send(ctx, BT_MESH_RPR_SUCCESS); link_close(BT_MESH_RPR_ERR_LINK_CLOSED_BY_CLIENT, reason); From ebe182e21cae4b4cf0739c691cb9f371a2aef284 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Wed, 17 Jan 2024 14:02:34 +0200 Subject: [PATCH 0387/2300] [nrf fromtree] net: lwm2m: Allow send operations when sleeping Add new kconfig CONFIG_LWM2M_QUEUE_MODE_NO_MSG_BUFFERING. When enabled and device is sleeping, Reqistration Update message is skipped and messages from send operation and notifications are sent right away. Reqistration update message is also skipped when lwm2m_engine resumes from pause state. Signed-off-by: Juha Ylinen (cherry picked from commit 9eee8d2be594a23eca102e21790e2d6db65ec2de) (cherry picked from commit e325adbe0d71625323a5e9d8cedfa979491558c4) --- subsys/net/lib/lwm2m/Kconfig | 7 +++++++ subsys/net/lib/lwm2m/lwm2m_engine.c | 1 + subsys/net/lib/lwm2m/lwm2m_message_handling.c | 7 +++++++ subsys/net/lib/lwm2m/lwm2m_rd_client.c | 7 ++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/Kconfig b/subsys/net/lib/lwm2m/Kconfig index 1e5a7ac8f6a..33a093308df 100644 --- a/subsys/net/lib/lwm2m/Kconfig +++ b/subsys/net/lib/lwm2m/Kconfig @@ -110,6 +110,13 @@ config LWM2M_QUEUE_MODE_UPTIME defaults to 93 seconds, see RFC 7252), it does not forbid other values though. +config LWM2M_QUEUE_MODE_NO_MSG_BUFFERING + bool "Disable buffering notifications and messages on queue mode" + select EXPERIMENTAL + help + Messages are sent right away instead of waiting for next registration update. + This might not be supported on all servers. + config LWM2M_TLS_SESSION_CACHING bool "TLS session caching" help diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index e08bb4ca17e..60ea1bdb794 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -244,6 +244,7 @@ int lwm2m_push_queued_buffers(struct lwm2m_ctx *client_ctx) break; } msg = SYS_SLIST_CONTAINER(msg_node, msg, node); + msg->pending->t0 = k_uptime_get(); sys_slist_append(&msg->ctx->pending_sends, &msg->node); } #endif diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 480c64372e8..19a2e1ccdd0 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -726,6 +726,13 @@ int lwm2m_information_interface_send(struct lwm2m_message *msg) return ret; } + if (IS_ENABLED(CONFIG_LWM2M_QUEUE_MODE_NO_MSG_BUFFERING)) { + sys_slist_append(&msg->ctx->pending_sends, &msg->node); + lwm2m_engine_wake_up(); + lwm2m_engine_connection_resume(msg->ctx); + return 0; + } + if (msg->ctx->buffer_client_messages) { sys_slist_append(&msg->ctx->queued_messages, &msg->node); lwm2m_engine_wake_up(); diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.c b/subsys/net/lib/lwm2m/lwm2m_rd_client.c index 95b576cb1c6..22ce51e5248 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.c +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.c @@ -1726,7 +1726,12 @@ int lwm2m_rd_client_connection_resume(struct lwm2m_ctx *client_ctx) IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_LISTEN_AT_IDLE)) || !IS_ENABLED(CONFIG_LWM2M_DTLS_SUPPORT)) { client.engine_state = ENGINE_REGISTRATION_DONE; - client.trigger_update = true; + if (IS_ENABLED(CONFIG_LWM2M_QUEUE_MODE_NO_MSG_BUFFERING)) { + /* Force online for a short period */ + engine_update_tx_time(); + } else { + client.trigger_update = true; + } } else { client.engine_state = ENGINE_DO_REGISTRATION; } From 3e68a136083e3c959549307a145b41747b5348bb Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 22 Jan 2024 14:35:45 +0200 Subject: [PATCH 0388/2300] [nrf fromtree] net: lwm2m: Fix segfault on failed bootstrap If bootstrap fails, RD client will call lwm2m_engine_stop() which will close the context. The socket loop, however still contains a call to hint_socket_state(context, NULL) which has a null pointer now. Fix the segfault by allowing nullpointer on hint_socket_state(). Signed-off-by: Seppo Takalo (cherry picked from commit bf872870eab5177e2eb2700e5ebfde8e41a0a6d1) (cherry picked from commit 1e73fb82453c95c536aa491a4a78d4bb3a4786aa) --- subsys/net/lib/lwm2m/lwm2m_engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 60ea1bdb794..bad54c521d7 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -645,7 +645,7 @@ static int64_t check_notifications(struct lwm2m_ctx *ctx, const int64_t timestam */ static void hint_socket_state(struct lwm2m_ctx *ctx, struct lwm2m_message *ongoing_tx) { - if (!ctx->set_socket_state) { + if (!ctx || !ctx->set_socket_state) { return; } From 57675c7ac0d0e2e6eeccc9e27bbcea4087463f91 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 25 Jan 2024 16:35:29 +0200 Subject: [PATCH 0389/2300] [nrf fromtree] net: lwm2m: Use CID_SUPPORTED instead of CID_ENABLED When ENABLED flag is used, we generate 32 byte DTLS Connection Identifier and include that in our DTLS Client HELO. This has no benefit as client only has one connection toward the server, it does not need any identification. When SUPPORTED flag is used, we just include zero length Connection Identifier in the handshake, which tell server that we support Connection Identifier and server can generate one for it. We then use the CID in the packets that we send towards server, but response packets don't contain any CID. This gives all the benefit of CID as server is able to identify us even when NAT mapping have changed. Signed-off-by: Seppo Takalo (cherry picked from commit 992936300bf684806ca02022399224a2030ad4e9) (cherry picked from commit 307f3191775d8390a35239ac9b6f9c2c92045ccf) --- subsys/net/lib/lwm2m/lwm2m_engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index bad54c521d7..55f23f77692 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -1060,7 +1060,7 @@ int lwm2m_set_default_sockopt(struct lwm2m_ctx *ctx) } if (IS_ENABLED(CONFIG_LWM2M_DTLS_CID)) { /* Enable CID */ - int cid = TLS_DTLS_CID_ENABLED; + int cid = TLS_DTLS_CID_SUPPORTED; ret = zsock_setsockopt(ctx->sock_fd, SOL_TLS, TLS_DTLS_CID, &cid, sizeof(cid)); From 0d290712960e737ce061e60df08d9e700f04dd82 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Thu, 18 Jan 2024 09:55:02 +0200 Subject: [PATCH 0390/2300] [nrf fromtree] tests: lwm2m: Update lwm2m_engine tests Fix lwm2m_message initialization. Pending struct was NULL. Signed-off-by: Juha Ylinen (cherry picked from commit c84dc7ee2ed6211eae7ec33abdbe5472fd5bf621) (cherry picked from commit acb2e8c364292eeda394760fb470e24537d033c3) --- tests/net/lib/lwm2m/lwm2m_engine/src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c index 5d80f5d1049..7078fbebe6d 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c @@ -260,11 +260,13 @@ ZTEST(lwm2m_engine, test_push_queued_buffers) int ret; struct lwm2m_ctx ctx; struct lwm2m_message msg; + struct coap_pending pending; (void)memset(&ctx, 0x0, sizeof(ctx)); sys_slist_init(&ctx.queued_messages); msg.ctx = &ctx; + msg.pending = &pending; sys_slist_append(&ctx.queued_messages, &msg.node); ret = lwm2m_push_queued_buffers(&ctx); zassert_equal(ret, 0); @@ -391,6 +393,7 @@ ZTEST(lwm2m_engine, test_socket_send) int ret; struct lwm2m_ctx ctx; struct lwm2m_message msg; + struct coap_pending pending; (void)memset(&ctx, 0x0, sizeof(ctx)); @@ -398,6 +401,7 @@ ZTEST(lwm2m_engine, test_socket_send) ctx.sock_fd = -1; sys_slist_init(&ctx.queued_messages); msg.ctx = &ctx; + msg.pending = &pending; msg.type = COAP_TYPE_CON; sys_slist_append(&ctx.queued_messages, &msg.node); From c162a6a69e37aa1960a070e2d29bdd1b10fbd73e Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 9 Feb 2024 12:28:15 +0100 Subject: [PATCH 0391/2300] [nrf fromtree] manifest: Update hal_nordic revision Updated hal_nordic fixes APPROTECT handling on nRF91 target, as well as fixes missing alignment of nrfx samples to modified API of the GPIOTE driver. Signed-off-by: Nikodem Kastelik (cherry picked from commit ba44a8663492e43349b82b0db62eeb334e2f1877) (cherry picked from commit 258a846cfb5d1cb8100d19dc67653c37b451033d) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 7ce69358f52..65c1c5a0837 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: b55cfbbf0221d709560c2e438beef66842ada272 + revision: dce8519f7da37b0a745237679fd3f88250b495ff path: modules/hal/nordic groups: - hal From 975eb2134eeb6b788469db1764fb7b3b1e1a82bb Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 5 Feb 2024 15:58:16 +0100 Subject: [PATCH 0392/2300] [nrf fromtree] Bluetooth: CAP: Fix uninitialized values in broadcast start When CONFIG_BT_ISO_TEST_PARAMS is enabled then the bt_bap_broadcast_source_param in bt_cap_initiator_broadcast_audio_create had uninitialized values. A general and future proof solution for this is to simply initialize the entire struct to 0. Signed-off-by: Emil Gydesen (cherry picked from commit f4b83415d6f39389eab3c4120d21ae2174c9740f) (cherry picked from commit adde9221c022503fcf5011e8f2c6a71a884dfe92) --- subsys/bluetooth/audio/cap_initiator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/audio/cap_initiator.c b/subsys/bluetooth/audio/cap_initiator.c index 46b39afcb41..3b8ee2fc3f2 100644 --- a/subsys/bluetooth/audio/cap_initiator.c +++ b/subsys/bluetooth/audio/cap_initiator.c @@ -192,7 +192,7 @@ int bt_cap_initiator_broadcast_audio_create( bap_subgroup_params[CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT]; struct bt_bap_broadcast_source_stream_param bap_stream_params[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT]; - struct bt_bap_broadcast_source_param bap_create_param; + struct bt_bap_broadcast_source_param bap_create_param = {0}; CHECKIF(param == NULL) { LOG_DBG("param is NULL"); From 79340c129a3137bf25177546147aabd2c8beda03 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 5 Feb 2024 15:46:22 +0100 Subject: [PATCH 0393/2300] [nrf fromtree] Bluetooth: BAP: Broadcast source enabling state transition fix Since we may go from enabling to qos-configured state if the call to bt_iso_big_create fails, that is a valid transition. If bt_iso_big_create currently fails, then the source ends in a state where it cannot be recovered. Signed-off-by: Emil Gydesen (cherry picked from commit 590d3e1114d09d2967929f6cc6897566948f2d3e) (cherry picked from commit c35cf22f87b5aceac52f574fbef6b0654b09d8f8) --- subsys/bluetooth/audio/bap_broadcast_source.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index 33fd1f0e17d..61ef7a1fe29 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -86,7 +86,7 @@ static void broadcast_source_set_ep_state(struct bt_bap_ep *ep, uint8_t state) } break; case BT_BAP_EP_STATE_ENABLING: - if (state != BT_BAP_EP_STATE_STREAMING) { + if (state != BT_BAP_EP_STATE_STREAMING && state != BT_BAP_EP_STATE_QOS_CONFIGURED) { LOG_DBG("Invalid broadcast sync endpoint state transition"); return; } From 73f47f2b91f132357c60a7ff6b1a1fb81d5fdf52 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 1 Feb 2024 15:50:32 +0100 Subject: [PATCH 0394/2300] [nrf fromtree] Bluetooth: BAP: Do not send PA term request on local remove If the receive state is locally removed, then we should not request permission from the application, as that is implicit when removing the source locally. Signed-off-by: Emil Gydesen (cherry picked from commit 764352608676bac4caa1bb69c74ee9bacfa63a88) (cherry picked from commit 617d3fb299da8cfcc4edbcb529b94a6fd51fea8c) --- subsys/bluetooth/audio/bap_scan_delegator.c | 5 +++-- tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/audio/bap_scan_delegator.c b/subsys/bluetooth/audio/bap_scan_delegator.c index 3cef96bd1b8..41f77391a68 100644 --- a/subsys/bluetooth/audio/bap_scan_delegator.c +++ b/subsys/bluetooth/audio/bap_scan_delegator.c @@ -863,8 +863,9 @@ static int scan_delegator_rem_src(struct bt_conn *conn, state = &internal_state->state; - if (state->pa_sync_state == BT_BAP_PA_STATE_INFO_REQ || - state->pa_sync_state == BT_BAP_PA_STATE_SYNCED) { + /* If conn == NULL then it's a local operation and we do not need to ask the application */ + if (conn != NULL && (state->pa_sync_state == BT_BAP_PA_STATE_INFO_REQ || + state->pa_sync_state == BT_BAP_PA_STATE_SYNCED)) { int err; /* Terminate PA sync */ 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 8827a06bc93..81d3ed7ec2b 100644 --- a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c @@ -616,6 +616,13 @@ static void remove_all_sources(void) printk("[%zu]: Source removed with id %u\n", i, state->src_id); + + printk("Terminating PA sync\n"); + err = pa_sync_term(state); + if (err) { + FAIL("[%zu]: PA sync term failed (err %d)\n", err); + return; + } } } } From e0f4b70201e7f7e1bbe16600e51e263cef32c3bb Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 1 Feb 2024 15:47:03 +0100 Subject: [PATCH 0395/2300] [nrf fromtree] Bluetooth: BAP: Stop broadcast sink from removing receive state The receive state may be added by the broadcast sink if not added by the application, but even in that case when the broadcast sink is deleted, we should not remove the receive state, as the receive state may still container information about the PA sync that has a lifetime not coupled with the broadcast sink. Signed-off-by: Emil Gydesen (cherry picked from commit 43bc3200faf5b3afe0b1c61883da37c14e38b115) (cherry picked from commit 64350aec6d4d8d8c558978900981b7ec470c744b) --- subsys/bluetooth/audio/bap_broadcast_sink.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/subsys/bluetooth/audio/bap_broadcast_sink.c b/subsys/bluetooth/audio/bap_broadcast_sink.c index aa4bc08f761..ceafaf6389c 100644 --- a/subsys/bluetooth/audio/bap_broadcast_sink.c +++ b/subsys/bluetooth/audio/bap_broadcast_sink.c @@ -798,17 +798,6 @@ static void broadcast_sink_cleanup_streams(struct bt_bap_broadcast_sink *sink) static void broadcast_sink_cleanup(struct bt_bap_broadcast_sink *sink) { - if (atomic_test_bit(sink->flags, - BT_BAP_BROADCAST_SINK_FLAG_SRC_ID_VALID)) { - int err; - - err = bt_bap_scan_delegator_rem_src(sink->bass_src_id); - if (err != 0) { - /* This is likely due to the receive state been removed */ - LOG_DBG("Could not remove Receive State for sink %p: %d", sink, err); - } - } - if (sink->stream_count > 0U) { broadcast_sink_cleanup_streams(sink); } From 8e3387de2f54ec21db9782e3967d30da3f09a132 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 25 Jan 2024 09:18:52 +0100 Subject: [PATCH 0396/2300] [nrf fromtree] Bluetooth: BAP: client: Add support for source ASEs disconnects When the CIS of a source ASE disconnects, the server shall put it into the QoS Configured state, which is not really part of the state machine for source ASEs, but more like a hidden bonus state change. The state machine handler in the unicast client has been updated to support this state change. Signed-off-by: Emil Gydesen (cherry picked from commit b173c21d9c310c044198a10d52d937e54c2528d2) (cherry picked from commit e43120c251f8eec50381ab85d826204719059c7a) --- subsys/bluetooth/audio/bap_unicast_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 36938129773..45523e003d4 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -1016,6 +1016,8 @@ static void unicast_client_ep_set_status(struct bt_bap_ep *ep, struct net_buf_si case BT_BAP_EP_STATE_CODEC_CONFIGURED: /* or 0x02 (QoS Configured) */ case BT_BAP_EP_STATE_QOS_CONFIGURED: + /* or 0x04 (Streaming) if there is a disconnect */ + case BT_BAP_EP_STATE_STREAMING: /* or 0x05 (Disabling) */ case BT_BAP_EP_STATE_DISABLING: break; From 9f098f8a51736bbb000d7ecf3e49df9caefceb67 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 22 Jan 2024 08:47:27 +0100 Subject: [PATCH 0397/2300] [nrf fromtree] Bluetooth: BAP: Add missing reset of client on disconnected If we disconnect in the middle of e.g. a discovery, then client-busy (and other values) were not correctly reset, which effectively rendered the client useless. Signed-off-by: Emil Gydesen (cherry picked from commit 8b8569e1da447978bc44e57d085f750415fe3efa) (cherry picked from commit a48cd2d332771553e39c90d8f0ac74c30fa422b2) --- subsys/bluetooth/audio/bap_unicast_client.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 45523e003d4..7cbde2464c2 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -2055,6 +2055,7 @@ static void unicast_client_reset(struct bt_bap_ep *ep, uint8_t reason) static void unicast_client_ep_reset(struct bt_conn *conn, uint8_t reason) { + struct unicast_client *client; uint8_t index; LOG_DBG("conn %p", conn); @@ -2076,6 +2077,11 @@ static void unicast_client_ep_reset(struct bt_conn *conn, uint8_t reason) unicast_client_reset(ep, reason); } #endif /* CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0 */ + + client = &uni_cli_insts[index]; + client->busy = false; + client->dir = 0U; + reset_att_buf(client); } static void bt_audio_codec_qos_to_cig_param(struct bt_iso_cig_param *cig_param, From fa8d07affb466ab51369f327aab02bfc09421aff Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 12 Jan 2024 11:32:30 +0100 Subject: [PATCH 0398/2300] [nrf fromtree] Bluetooth: Audio: Fix off-by-one error in codec.c:ltv_set_val The function did not move data correctly when increasing or decreasing the size of a value that was not the last value in the LTV array. Added a few tests to verify the fix, using the CCID list as the main way of verifying it. Signed-off-by: Emil Gydesen (cherry picked from commit 68f8c8ff29d0c72d77acb1db7dc66ad669731965) (cherry picked from commit fc4e559df38a0d201bb2b94bf622457a5c5652f6) --- subsys/bluetooth/audio/codec.c | 4 +- tests/bluetooth/audio/codec/src/main.c | 111 ++++++++++++++++++++++++- 2 files changed, 112 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/audio/codec.c b/subsys/bluetooth/audio/codec.c index 38b1ef7d22b..e376b71d1c3 100644 --- a/subsys/bluetooth/audio/codec.c +++ b/subsys/bluetooth/audio/codec.c @@ -162,8 +162,8 @@ static int ltv_set_val(struct net_buf_simple *buf, uint8_t type, const uint8_t * if (value + value_len == buf->data + buf->len) { data_len_to_move = 0U; } else { - old_next_data_start = value + value_len + 1; - new_next_data_start = value + data_len + 1; + old_next_data_start = value + value_len; + new_next_data_start = value + data_len; data_len_to_move = buf->len - (old_next_data_start - buf->data); } diff --git a/tests/bluetooth/audio/codec/src/main.c b/tests/bluetooth/audio/codec/src/main.c index 386ef40e7f7..3b909e4582f 100644 --- a/tests/bluetooth/audio/codec/src/main.c +++ b/tests/bluetooth/audio/codec/src/main.c @@ -57,6 +57,26 @@ ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_get_freq) zassert_equal(ret, 0x03, "unexpected return value %d", ret); } +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_set_val_new) +{ + struct bt_bap_lc3_preset preset = BT_BAP_LC3_UNICAST_PRESET_16_2_1( + BT_AUDIO_LOCATION_FRONT_LEFT, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED); + const uint8_t frame_blocks = 0x02; + int ret; + + /* Frame blocks are not part of the preset, so we can use that to test adding a new type to + * the config + */ + ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(&preset.codec_cfg, false); + zassert_equal(ret, -ENODATA, "Unexpected return value %d", ret); + + ret = bt_audio_codec_cfg_set_frame_blocks_per_sdu(&preset.codec_cfg, frame_blocks); + zassert_true(ret > 0, "Unexpected return value %d", ret); + + ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(&preset.codec_cfg, false); + zassert_equal(ret, frame_blocks, "Unexpected return value %d", ret); +} + ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_set_freq) { struct bt_bap_lc3_preset preset = BT_BAP_LC3_UNICAST_PRESET_16_2_1( @@ -371,7 +391,7 @@ ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_get_ccid_list) zassert_mem_equal(expected_data, ccid_list, ARRAY_SIZE(expected_data)); } -ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list) +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list_shorter) { const uint8_t expected_data[] = {0x05, 0x10, 0x15}; const uint8_t new_expected_data[] = {0x25, 0x30}; @@ -394,6 +414,95 @@ ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list) zassert_mem_equal(new_expected_data, ccid_list, ARRAY_SIZE(new_expected_data)); } +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list_longer) +{ + const uint8_t expected_data[] = {0x05, 0x10, 0x15}; + const uint8_t new_expected_data[] = {0x25, 0x30, 0x35, 0x40}; + 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_CCID_LIST, 0x05, 0x10, 0x15)}); + const uint8_t *ccid_list; + int ret; + + ret = bt_audio_codec_cfg_meta_get_ccid_list(&codec_cfg, &ccid_list); + zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(expected_data, ccid_list, ARRAY_SIZE(expected_data)); + + ret = bt_audio_codec_cfg_meta_set_ccid_list(&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_ccid_list(&codec_cfg, &ccid_list); + zassert_equal(ret, ARRAY_SIZE(new_expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(new_expected_data, ccid_list, ARRAY_SIZE(new_expected_data)); +} + +/* Providing multiple BT_AUDIO_CODEC_DATA to BT_AUDIO_CODEC_CFG without packing it in a macro + * cause compile issue, so define a macro to denote 2 types of data for the ccid_list_first tests + */ +#define DOUBLE_CFG_DATA \ + { \ + BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_CCID_LIST, 0x05, 0x10, 0x15), \ + BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_PARENTAL_RATING, \ + BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE) \ + } + +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list_first_shorter) +{ + const uint8_t expected_data[] = {0x05, 0x10, 0x15}; + const uint8_t new_expected_data[] = {0x25, 0x30}; + struct bt_audio_codec_cfg codec_cfg = + BT_AUDIO_CODEC_CFG(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, {}, DOUBLE_CFG_DATA); + const uint8_t *ccid_list; + int ret; + + ret = bt_audio_codec_cfg_meta_get_ccid_list(&codec_cfg, &ccid_list); + zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(expected_data, ccid_list, ARRAY_SIZE(expected_data)); + + ret = bt_audio_codec_cfg_meta_get_parental_rating(&codec_cfg); + zassert_equal(ret, 0x07, "Unexpected return value %d", ret); + + ret = bt_audio_codec_cfg_meta_set_ccid_list(&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_ccid_list(&codec_cfg, &ccid_list); + zassert_equal(ret, ARRAY_SIZE(new_expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(new_expected_data, ccid_list, ARRAY_SIZE(new_expected_data)); + + ret = bt_audio_codec_cfg_meta_get_parental_rating(&codec_cfg); + zassert_equal(ret, 0x07, "Unexpected return value %d", ret); +} + +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list_first_longer) +{ + const uint8_t expected_data[] = {0x05, 0x10, 0x15}; + const uint8_t new_expected_data[] = {0x25, 0x30, 0x35, 0x40}; + struct bt_audio_codec_cfg codec_cfg = + BT_AUDIO_CODEC_CFG(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, {}, DOUBLE_CFG_DATA); + const uint8_t *ccid_list; + int ret; + + ret = bt_audio_codec_cfg_meta_get_ccid_list(&codec_cfg, &ccid_list); + zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(expected_data, ccid_list, ARRAY_SIZE(expected_data)); + + ret = bt_audio_codec_cfg_meta_get_parental_rating(&codec_cfg); + zassert_equal(ret, 0x07, "Unexpected return value %d", ret); + + ret = bt_audio_codec_cfg_meta_set_ccid_list(&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_ccid_list(&codec_cfg, &ccid_list); + zassert_equal(ret, ARRAY_SIZE(new_expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(new_expected_data, ccid_list, ARRAY_SIZE(new_expected_data)); + + ret = bt_audio_codec_cfg_meta_get_parental_rating(&codec_cfg); + zassert_equal(ret, 0x07, "Unexpected return value %d", ret); +} + ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_get_parental_rating) { const struct bt_audio_codec_cfg codec_cfg = From 5f4b62a955eea0da96801ac6470e0f7caeaa2ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20Rist=20Sk=C3=B8ien?= Date: Mon, 29 Jan 2024 16:49:25 +0100 Subject: [PATCH 0399/2300] [nrf fromtree] Bluetooth: Audio: Moved seq_num check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moved seq_num check to after bt_iso_chan_send. This prevents WRN prints if ISO send fails. Signed-off-by: Kristoffer Rist Skøien (cherry picked from commit ace435d0d17015bf97a07264c5f02a2cf64ed504) (cherry picked from commit 390f21f4660ba71279d97230f84b26bcb24549a5) --- subsys/bluetooth/audio/bap_stream.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index d6df9524e14..fd38a90371c 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -245,6 +245,7 @@ static bool bt_bap_stream_can_send(const struct bt_bap_stream *stream) int bt_bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num, uint32_t ts) { + int ret; struct bt_bap_ep *ep; if (stream == NULL || stream->ep == NULL) { @@ -265,6 +266,12 @@ int bt_bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf, return -EBADMSG; } + ret = bt_iso_chan_send(bt_bap_stream_iso_chan_get(stream), + buf, seq_num, ts); + if (ret) { + return ret; + } + #if defined(CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM) if (stream->_prev_seq_num != 0U && seq_num != 0U && (stream->_prev_seq_num + 1U) != seq_num) { @@ -277,8 +284,7 @@ int bt_bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf, /* TODO: Add checks for broadcast sink */ - return bt_iso_chan_send(bt_bap_stream_iso_chan_get(stream), - buf, seq_num, ts); + return ret; } int bt_bap_stream_get_tx_sync(struct bt_bap_stream *stream, struct bt_iso_tx_info *info) From b811f777a615a200a3898d1d94e64148f2b05df8 Mon Sep 17 00:00:00 2001 From: Mariusz Skamra Date: Tue, 21 Nov 2023 12:45:10 +0100 Subject: [PATCH 0400/2300] [nrf fromtree] Bluetooth: audio: ascs: Remove spurious error message This removes spurious error message printed when CIS has been disconnected and it was not used by any of the endpoints. This case is valid and may happen on Connection Timeout when the controller reports ACL Disconnection first. When the CIS Disconnection is reported after, the ASE is already in idle state and the referenece to CIS has been already removed (on ACL disconnection). Fixes: #64896 Signed-off-by: Mariusz Skamra (cherry picked from commit b37307927523ac4a38b4e81c50baebff37b8b5c5) (cherry picked from commit 79389295d6135633e458107cd76be8e8819a695e) --- subsys/bluetooth/audio/ascs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/bluetooth/audio/ascs.c b/subsys/bluetooth/audio/ascs.c index 1709bc452d8..4127b1a4ce4 100644 --- a/subsys/bluetooth/audio/ascs.c +++ b/subsys/bluetooth/audio/ascs.c @@ -945,7 +945,6 @@ static void ascs_iso_disconnected(struct bt_iso_chan *chan, uint8_t reason) struct bt_bap_iso *iso = CONTAINER_OF(chan, struct bt_bap_iso, chan); if (iso->rx.ep == NULL && iso->tx.ep == NULL) { - LOG_ERR("iso %p not bound with ep", chan); return; } From 4124a4d34649008d4a3ee544dcfa655938e7ebcb Mon Sep 17 00:00:00 2001 From: Magdalena Kasenberg Date: Wed, 20 Dec 2023 16:47:34 +0100 Subject: [PATCH 0401/2300] [nrf fromtree] bluetooth: audio: broadcast: Fix missing update of meta_len The length of the updated metadata was not updated. Fixes the CAP/INI/BST/BV-13-C test case. Signed-off-by: Magdalena Kasenberg (cherry picked from commit e05d964b461ea6d1df846bf54dab464232ece6e2) (cherry picked from commit e5a2ebaad073aa01d1da37053e6ce5cbc3d67424) --- subsys/bluetooth/audio/bap_broadcast_source.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index 61ef7a1fe29..132578470d7 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -938,6 +938,7 @@ int bt_bap_broadcast_source_update_metadata(struct bt_bap_broadcast_source *sour SYS_SLIST_FOR_EACH_CONTAINER(&source->subgroups, subgroup, _node) { memset(subgroup->codec_cfg->meta, 0, sizeof(subgroup->codec_cfg->meta)); memcpy(subgroup->codec_cfg->meta, meta, meta_len); + subgroup->codec_cfg->meta_len = meta_len; } return 0; From 2441a763cc74b4e45074a937c10ab9c28e8329ef Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 2 Jan 2024 14:55:00 +0100 Subject: [PATCH 0402/2300] [nrf fromtree] Bluetooth: Audio: Fix len check in ltv_set_val The length check in ltv_set_val did not consider the size of the length or type fields. Signed-off-by: Emil Gydesen (cherry picked from commit 234b322dc306a1c936161e4107370dcf5c9cb59e) (cherry picked from commit 8afed95b636fa443639e05f0c491b6e04d1de1e0) --- subsys/bluetooth/audio/codec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/audio/codec.c b/subsys/bluetooth/audio/codec.c index e376b71d1c3..3f5f2b56629 100644 --- a/subsys/bluetooth/audio/codec.c +++ b/subsys/bluetooth/audio/codec.c @@ -142,6 +142,8 @@ static bool parse_cb(struct bt_data *data, void *user_data) static int ltv_set_val(struct net_buf_simple *buf, uint8_t type, const uint8_t *data, size_t data_len) { + size_t new_buf_len; + for (uint16_t i = 0U; i < buf->len;) { uint8_t *len = &buf->data[i++]; const uint8_t data_type = buf->data[i++]; @@ -207,11 +209,12 @@ static int ltv_set_val(struct net_buf_simple *buf, uint8_t type, const uint8_t * } /* If we reach here, we did not find the data in the buffer, so we simply add it */ - if ((buf->len + data_len) <= buf->size) { - net_buf_simple_add_u8(buf, data_len + sizeof(type)); - net_buf_simple_add_u8(buf, type); + new_buf_len = buf->len + 1 /* len */ + sizeof(type) + data_len; + if (new_buf_len <= buf->size) { + net_buf_simple_add_u8(buf, data_len + sizeof(type)); /* len */ + net_buf_simple_add_u8(buf, type); /* type */ if (data_len > 0) { - net_buf_simple_add_mem(buf, data, data_len); + net_buf_simple_add_mem(buf, data, data_len); /* value */ } } else { LOG_DBG("Cannot fit data_len %zu in codec_cfg with len %u and size %u", data_len, From 4cc9561f155f892adfe05c9bba8b7f5e0d8304bf Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 3 Jan 2024 09:58:07 +0100 Subject: [PATCH 0403/2300] [nrf fromtree] Bluetooth: BAP: Fix uninitialized variable in source_reconfig The stream_in_subgroup variable in bt_bap_broadcast_source_reconfig may have been uninitialized. Signed-off-by: Emil Gydesen (cherry picked from commit f4cbf403e8238109fd5b00add8e5dee4114aeb61) (cherry picked from commit 617f2d3fc477a6e11863e2edae3f98b4e4ba533e) --- subsys/bluetooth/audio/bap_broadcast_source.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index 132578470d7..2167366c7e1 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -788,7 +788,7 @@ int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, for (size_t i = 0U; i < subgroup_param->params_count; i++) { struct bt_bap_stream *subgroup_stream; struct bt_bap_stream *param_stream; - bool stream_in_subgroup; + bool stream_in_subgroup = false; param_stream = subgroup_param->params[i].stream; From 4722e1323c926b1c03a96a0538ae80f41f71b180 Mon Sep 17 00:00:00 2001 From: Adam Cavender Date: Mon, 27 Nov 2023 10:55:45 +0000 Subject: [PATCH 0404/2300] [nrf fromtree] Bluetooth: Host: Fix bt_le_set_chan_map Allow the channel map to be set when periodic advertising or acting as an ISO source. Signed-off-by: Adam Cavender (cherry picked from commit ad485866b083f470c01e1b07575866423a00dc45) (cherry picked from commit 43ce6c74715ba933ff6866bab323bbcbf2a3f4a3) --- subsys/bluetooth/host/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index ee1c822d9f9..dbb79f3ecdd 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -4326,7 +4326,7 @@ int bt_le_set_chan_map(uint8_t chan_map[5]) struct bt_hci_cp_le_set_host_chan_classif *cp; struct net_buf *buf; - if (!IS_ENABLED(CONFIG_BT_CENTRAL)) { + if (!(IS_ENABLED(CONFIG_BT_CENTRAL) || IS_ENABLED(CONFIG_BT_BROADCASTER))) { return -ENOTSUP; } From 2acdac654a6f288a5a888dd6a9cad84baf8880e2 Mon Sep 17 00:00:00 2001 From: Adam Cavender Date: Mon, 27 Nov 2023 12:39:15 +0000 Subject: [PATCH 0405/2300] [nrf fromtree] Bluetooth: Shell: Fix cmd_chan_map Allow the channel map to be set when periodic advertising or acting as an ISO source. Signed-off-by: Adam Cavender (cherry picked from commit ac4f9a6962e17cf1e34b7238aec44b6f7b0f1417) (cherry picked from commit ff855dc9516a0a02341165379ba86f2ddc17447d) --- subsys/bluetooth/shell/bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index 4e0111fa757..ac1d78c44df 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -4286,7 +4286,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, SHELL_CMD_ARG(phy-update, NULL, " [rx_phy] [s2] [s8]", cmd_conn_phy_update, 2, 3), #endif -#if defined(CONFIG_BT_CENTRAL) +#if defined(CONFIG_BT_CENTRAL) || defined(CONFIG_BT_BROADCASTER) SHELL_CMD_ARG(channel-map, NULL, " (36-0)", cmd_chan_map, 2, 1), #endif /* CONFIG_BT_CENTRAL */ From db2ba28ebcef019afa8dd68f35ee4042e2e6874a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 25 Jan 2024 11:14:44 +0100 Subject: [PATCH 0406/2300] [nrf fromtree] net: dhcpv4_server: Improve address pool range validation Not only check if the address pool belongs to the same subnet as the server, but also that it does not overlap with the server address - otherwise the server might end up assigning its own address. Signed-off-by: Robert Lubos (cherry picked from commit a147ac9a47dee34f16ebd26a3d0af59afbb7cb39) (cherry picked from commit 5c8e8e21b020d19eb1e05c186dd576ab71d83ce9) --- subsys/net/lib/dhcpv4/dhcpv4_server.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c index 714d036ddde..5940c8ca207 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4_server.c +++ b/subsys/net/lib/dhcpv4/dhcpv4_server.c @@ -1224,6 +1224,13 @@ int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr) return -EINVAL; } + if ((htonl(server_addr->s_addr) >= htonl(base_addr->s_addr)) && + (htonl(server_addr->s_addr) < + htonl(base_addr->s_addr) + CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT)) { + LOG_ERR("Address pool overlaps with server address."); + return -EINVAL; + } + netmask = net_if_ipv4_get_netmask(iface); if (net_ipv4_is_addr_unspecified(&netmask)) { LOG_ERR("Failed to obtain subnet mask."); From 552225970ec2a7253cce0f818056465925f5fab1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 26 Jan 2024 14:39:22 +0100 Subject: [PATCH 0407/2300] [nrf fromtree] net: dhcpv4_server: Implement ICMP probing of offered addresses DHCPv4 server will send an ICMP probe (echo request) for the requested address before replying with DHCP Offer, unless probing is disabled in Kconfig. Signed-off-by: Robert Lubos (cherry picked from commit 3c76ff9a8c41d217bf6c28d930f2620cb5cd26a2) (cherry picked from commit f0a7caf91fbfa3b9479390743bbb485c20c07c9e) --- subsys/net/lib/dhcpv4/Kconfig | 8 + subsys/net/lib/dhcpv4/dhcpv4_server.c | 251 ++++++++++++++++++++++++-- 2 files changed, 241 insertions(+), 18 deletions(-) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig index 801d536a5a1..8ae65344f31 100644 --- a/subsys/net/lib/dhcpv4/Kconfig +++ b/subsys/net/lib/dhcpv4/Kconfig @@ -43,4 +43,12 @@ config NET_DHCPV4_SERVER_ADDR_LEASE_TIME The lease time determines when the IPv4 address lease expires if the client does not renew it. +config NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT + int "Timeout for ICMP probes sent by the server (miliseconds)" + default 1000 + help + DHCPv4 server will probe the offered IP address (send ICMP echo + request) and wait for the time specific by this config before offering + the address. If set to 0, ICMP probing will be disabled. + endif # NET_DHCPV4_SERVER diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c index 5940c8ca207..e683fdf5f0e 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4_server.c +++ b/subsys/net/lib/dhcpv4/dhcpv4_server.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -31,10 +32,29 @@ LOG_MODULE_REGISTER(net_dhcpv4_server, CONFIG_NET_DHCPV4_SERVER_LOG_LEVEL); #define DHCPV4_OPTIONS_CLIENT_ID_MIN_SIZE 2 #define ADDRESS_RESERVED_TIMEOUT K_SECONDS(5) +#define ADDRESS_PROBE_TIMEOUT K_MSEC(CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT) + +#if (CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT > 0) +#define DHCPV4_SERVER_ICMP_PROBE 1 +#endif /* RFC 1497 [17] */ static const uint8_t magic_cookie[4] = { 0x63, 0x82, 0x53, 0x63 }; +#define DHCPV4_MAX_PARAMETERS_REQUEST_LEN 16 + +struct dhcpv4_parameter_request_list { + uint8_t list[DHCPV4_MAX_PARAMETERS_REQUEST_LEN]; + uint8_t count; +}; + +struct dhcpv4_server_probe_ctx { + struct net_icmp_ctx icmp_ctx; + struct dhcp_msg discovery; + struct dhcpv4_parameter_request_list params; + struct dhcpv4_addr_slot *slot; +}; + struct dhcpv4_server_ctx { struct net_if *iface; int sock; @@ -42,19 +62,15 @@ struct dhcpv4_server_ctx { struct dhcpv4_addr_slot addr_pool[CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT]; struct in_addr server_addr; struct in_addr netmask; +#if defined(DHCPV4_SERVER_ICMP_PROBE) + struct dhcpv4_server_probe_ctx probe_ctx; +#endif }; static struct dhcpv4_server_ctx server_ctx[CONFIG_NET_DHCPV4_SERVER_INSTANCES]; static struct zsock_pollfd fds[CONFIG_NET_DHCPV4_SERVER_INSTANCES]; static K_MUTEX_DEFINE(server_lock); -#define DHCPV4_MAX_PARAMETERS_REQUEST_LEN 16 - -struct dhcpv4_parameter_request_list { - uint8_t list[DHCPV4_MAX_PARAMETERS_REQUEST_LEN]; - uint8_t count; -}; - static void dhcpv4_server_timeout_recalc(struct dhcpv4_server_ctx *ctx) { k_timepoint_t next = sys_timepoint_calc(K_FOREVER); @@ -667,6 +683,167 @@ static uint32_t dhcpv4_get_lease_time(uint8_t *options, uint8_t optlen) return CONFIG_NET_DHCPV4_SERVER_ADDR_LEASE_TIME; } +#if defined(DHCPV4_SERVER_ICMP_PROBE) +static int dhcpv4_probe_address(struct dhcpv4_server_ctx *ctx, + struct dhcpv4_addr_slot *slot) +{ + struct sockaddr_in dest_addr = { + .sin_family = AF_INET, + .sin_addr = slot->addr, + }; + int ret; + + ret = net_icmp_send_echo_request(&ctx->probe_ctx.icmp_ctx, ctx->iface, + (struct sockaddr *)&dest_addr, + NULL, ctx); + if (ret < 0) { + LOG_ERR("Failed to send ICMP probe"); + } + + return ret; +} + +static int echo_reply_handler(struct net_icmp_ctx *icmp_ctx, + struct net_pkt *pkt, + struct net_icmp_ip_hdr *ip_hdr, + struct net_icmp_hdr *icmp_hdr, + void *user_data) +{ + struct dhcpv4_server_ctx *ctx = user_data; + struct dhcpv4_server_probe_ctx *probe_ctx = &ctx->probe_ctx; + struct dhcpv4_addr_slot *new_slot = NULL; + struct in_addr peer_addr; + + ARG_UNUSED(icmp_ctx); + ARG_UNUSED(pkt); + ARG_UNUSED(ip_hdr); + ARG_UNUSED(icmp_hdr); + + k_mutex_lock(&server_lock, K_FOREVER); + + if (probe_ctx->slot == NULL) { + goto out; + } + + if (ip_hdr->family != AF_INET) { + goto out; + } + + net_ipv4_addr_copy_raw((uint8_t *)&peer_addr, ip_hdr->ipv4->src); + if (!net_ipv4_addr_cmp(&peer_addr, &probe_ctx->slot->addr)) { + goto out; + } + + LOG_DBG("Got ICMP probe response, blocking address %s", + net_sprint_ipv4_addr(&probe_ctx->slot->addr)); + + probe_ctx->slot->state = DHCPV4_SERVER_ADDR_DECLINED; + + /* Try to find next free address */ + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (slot->state == DHCPV4_SERVER_ADDR_FREE) { + new_slot = slot; + break; + } + } + + if (new_slot == NULL) { + LOG_DBG("No more free addresses to assign, ICMP probing stopped"); + probe_ctx->slot = NULL; + dhcpv4_server_timeout_recalc(ctx); + goto out; + } + + if (dhcpv4_probe_address(ctx, new_slot) < 0) { + probe_ctx->slot = NULL; + dhcpv4_server_timeout_recalc(ctx); + goto out; + } + + new_slot->state = DHCPV4_SERVER_ADDR_RESERVED; + new_slot->expiry = sys_timepoint_calc(ADDRESS_PROBE_TIMEOUT); + new_slot->client_id.len = probe_ctx->slot->client_id.len; + memcpy(new_slot->client_id.buf, probe_ctx->slot->client_id.buf, + new_slot->client_id.len); + new_slot->lease_time = probe_ctx->slot->lease_time; + + probe_ctx->slot = new_slot; + + dhcpv4_server_timeout_recalc(ctx); + +out: + k_mutex_unlock(&server_lock); + + return 0; +} + +static int dhcpv4_server_probing_init(struct dhcpv4_server_ctx *ctx) +{ + return net_icmp_init_ctx(&ctx->probe_ctx.icmp_ctx, + NET_ICMPV4_ECHO_REPLY, 0, + echo_reply_handler); +} + +static void dhcpv4_server_probing_deinit(struct dhcpv4_server_ctx *ctx) +{ + (void)net_icmp_cleanup_ctx(&ctx->probe_ctx.icmp_ctx); +} + +static int dhcpv4_server_probe_setup(struct dhcpv4_server_ctx *ctx, + struct dhcpv4_addr_slot *slot, + struct dhcp_msg *msg, + struct dhcpv4_parameter_request_list *params) +{ + int ret; + + if (ctx->probe_ctx.slot != NULL) { + return -EBUSY; + } + + ret = dhcpv4_probe_address(ctx, slot); + if (ret < 0) { + return ret; + } + + ctx->probe_ctx.slot = slot; + ctx->probe_ctx.discovery = *msg; + ctx->probe_ctx.params = *params; + + return 0; +} + +static void dhcpv4_server_probe_timeout(struct dhcpv4_server_ctx *ctx, + struct dhcpv4_addr_slot *slot) +{ + /* Probe timer expired, send offer. */ + ctx->probe_ctx.slot = NULL; + + (void)net_arp_clear_pending(ctx->iface, &slot->addr); + + if (dhcpv4_send_offer(ctx, &ctx->probe_ctx.discovery, &slot->addr, + slot->lease_time, &ctx->probe_ctx.params) < 0) { + slot->state = DHCPV4_SERVER_ADDR_FREE; + return; + } + + slot->expiry = sys_timepoint_calc(ADDRESS_RESERVED_TIMEOUT); +} + +static bool dhcpv4_server_is_slot_probed(struct dhcpv4_server_ctx *ctx, + struct dhcpv4_addr_slot *slot) +{ + return (ctx->probe_ctx.slot == slot); +} +#else /* defined(DHCPV4_SERVER_ICMP_PROBE) */ +#define dhcpv4_server_probing_init(...) (0) +#define dhcpv4_server_probing_deinit(...) +#define dhcpv4_server_probe_setup(...) (-ENOTSUP) +#define dhcpv4_server_probe_timeout(...) +#define dhcpv4_server_is_slot_probed(...) (false) +#endif /* defined(DHCPV4_SERVER_ICMP_PROBE) */ + static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, struct dhcp_msg *msg, uint8_t *options, uint8_t optlen) @@ -674,6 +851,7 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, struct dhcpv4_parameter_request_list params = { 0 }; struct dhcpv4_addr_slot *selected = NULL; struct dhcpv4_client_id client_id; + bool probe = false; int ret; ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); @@ -696,6 +874,12 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, slot->client_id.len == client_id.len && memcmp(slot->client_id.buf, client_id.buf, client_id.len) == 0) { + if (slot->state == DHCPV4_SERVER_ADDR_RESERVED && + dhcpv4_server_is_slot_probed(ctx, slot)) { + LOG_DBG("ICMP probing in progress, ignore Discovery"); + return; + } + /* Got match in current bindings. */ selected = slot; break; @@ -720,6 +904,7 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, slot->state == DHCPV4_SERVER_ADDR_FREE) { /* Requested address is free. */ selected = slot; + probe = true; break; } } @@ -742,6 +927,7 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, if (slot->state == DHCPV4_SERVER_ADDR_FREE) { /* Requested address is free. */ selected = slot; + probe = true; break; } } @@ -752,9 +938,26 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, } else { uint32_t lease_time = dhcpv4_get_lease_time(options, optlen); - if (dhcpv4_send_offer(ctx, msg, &selected->addr, lease_time, - ¶ms) < 0) { - return; + if (IS_ENABLED(DHCPV4_SERVER_ICMP_PROBE) && probe) { + if (dhcpv4_server_probe_setup(ctx, selected, + msg, ¶ms) < 0) { + /* Probing context already in use or failed to + * send probe, ignore Discovery for now and wait + * for retransmission. + */ + return; + } + + selected->expiry = + sys_timepoint_calc(ADDRESS_PROBE_TIMEOUT); + } else { + if (dhcpv4_send_offer(ctx, msg, &selected->addr, + lease_time, ¶ms) < 0) { + return; + } + + selected->expiry = + sys_timepoint_calc(ADDRESS_RESERVED_TIMEOUT); } LOG_DBG("DHCPv4 processing Discover - reserved %s", @@ -764,7 +967,6 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, selected->client_id.len = client_id.len; memcpy(selected->client_id.buf, client_id.buf, client_id.len); selected->lease_time = lease_time; - selected->expiry = sys_timepoint_calc(ADDRESS_RESERVED_TIMEOUT); dhcpv4_server_timeout_recalc(ctx); } } @@ -1061,15 +1263,18 @@ static void dhcpv4_server_timeout(struct k_work *work) struct dhcpv4_server_ctx *ctx = CONTAINER_OF(dwork, struct dhcpv4_server_ctx, timeout_work); - k_mutex_lock(&server_lock, K_FOREVER); for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - if (slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) { - if (sys_timepoint_expired(slot->expiry)) { + if ((slot->state == DHCPV4_SERVER_ADDR_RESERVED || + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) && + sys_timepoint_expired(slot->expiry)) { + if (slot->state == DHCPV4_SERVER_ADDR_RESERVED && + dhcpv4_server_is_slot_probed(ctx, slot)) { + dhcpv4_server_probe_timeout(ctx, slot); + } else { LOG_DBG("Address %s expired", net_sprint_ipv4_addr(&slot->addr)); slot->state = DHCPV4_SERVER_ADDR_FREE; @@ -1310,19 +1515,28 @@ int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr) &server_ctx[slot].addr_pool[i].addr)); } + ret = dhcpv4_server_probing_init(&server_ctx[slot]); + if (ret < 0) { + LOG_ERR("Failed to register probe handler, %d", ret); + goto cleanup; + } + ret = net_socket_service_register(&dhcpv4_server, fds, ARRAY_SIZE(fds), NULL); if (ret < 0) { LOG_ERR("Failed to register socket service, %d", ret); - memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); - fds[slot].fd = -1; - goto error; + dhcpv4_server_probing_deinit(&server_ctx[slot]); + goto cleanup; } k_mutex_unlock(&server_lock); return 0; +cleanup: + memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); + fds[slot].fd = -1; + error: if (sock >= 0) { (void)zsock_close(sock); @@ -1361,6 +1575,7 @@ int net_dhcpv4_server_stop(struct net_if *iface) fds[slot].fd = -1; (void)zsock_close(server_ctx[slot].sock); + dhcpv4_server_probing_deinit(&server_ctx[slot]); k_work_cancel_delayable_sync(&server_ctx[slot].timeout_work, &sync); memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); From 7acbc8f4aca49662f04d3f7f8cf405a1cd3828da Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 12 Feb 2024 09:46:48 +0100 Subject: [PATCH 0408/2300] [nrf fromlist] net: dhcpv4_server: Improve declined addresses management Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68848 In case conflict is detected (either due to receiving Decline message or due to ICMP probe getting reply), the conflicting address becomes blocked for further use. Although the RFC is not specific about how long should the address be blocked, it make sense to implement some fallback mechanisms to reuse blocked addresses in the server, otherwise, after longer period of operation, it may run out of usable address. This commit adds a timeout for declined addresses, so that by default the address is marked back as "free" after 24 hrs (default lease time). It also implements a mechanism, which allows to re-use the oldest declined entry in case the server runs out of fresh addresses to assign. Signed-off-by: Robert Lubos (cherry picked from commit e57e9eade53f08e5e74cfc1dd704cd10a57f7a28) --- subsys/net/lib/dhcpv4/Kconfig | 11 +++++++++ subsys/net/lib/dhcpv4/dhcpv4_server.c | 34 +++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig index 8ae65344f31..c8ca410d39c 100644 --- a/subsys/net/lib/dhcpv4/Kconfig +++ b/subsys/net/lib/dhcpv4/Kconfig @@ -43,6 +43,17 @@ config NET_DHCPV4_SERVER_ADDR_LEASE_TIME The lease time determines when the IPv4 address lease expires if the client does not renew it. +config NET_DHCPV4_SERVER_ADDR_DECLINE_TIME + int "The time IPv4 addresses remains blocked after conflict detection (seconds)" + default 86400 + help + In case IPv4 address becomes blocked (either because of receiving + Decline message or due to ICMP probe detecting conflict), the address + can no longer be assigned. This timeout specifies how long the address + remains in the Declined state. + Note, that the server may try to reuse the oldest declined address in + case it runs out of free addresses to assign. + config NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT int "Timeout for ICMP probes sent by the server (miliseconds)" default 1000 diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c index e683fdf5f0e..fdaab75c950 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4_server.c +++ b/subsys/net/lib/dhcpv4/dhcpv4_server.c @@ -33,6 +33,7 @@ LOG_MODULE_REGISTER(net_dhcpv4_server, CONFIG_NET_DHCPV4_SERVER_LOG_LEVEL); #define ADDRESS_RESERVED_TIMEOUT K_SECONDS(5) #define ADDRESS_PROBE_TIMEOUT K_MSEC(CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT) +#define ADDRESS_DECLINED_TIMEOUT K_SECONDS(CONFIG_NET_DHCPV4_SERVER_ADDR_DECLINE_TIME) #if (CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT > 0) #define DHCPV4_SERVER_ICMP_PROBE 1 @@ -80,7 +81,8 @@ static void dhcpv4_server_timeout_recalc(struct dhcpv4_server_ctx *ctx) struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; if (slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) { + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED || + slot->state == DHCPV4_SERVER_ADDR_DECLINED) { if (sys_timepoint_cmp(slot->expiry, next) < 0) { next = slot->expiry; } @@ -738,6 +740,7 @@ static int echo_reply_handler(struct net_icmp_ctx *icmp_ctx, net_sprint_ipv4_addr(&probe_ctx->slot->addr)); probe_ctx->slot->state = DHCPV4_SERVER_ADDR_DECLINED; + probe_ctx->slot->expiry = sys_timepoint_calc(ADDRESS_DECLINED_TIMEOUT); /* Try to find next free address */ for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { @@ -933,6 +936,27 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, } } + /* In case no free address slot was found, as a last resort, try to + * reuse the oldest declined entry, if present. + */ + if (selected == NULL) { + for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { + struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; + + if (slot->state != DHCPV4_SERVER_ADDR_DECLINED) { + continue; + } + + /* Find first to expire (oldest) entry. */ + if ((selected == NULL) || + (sys_timepoint_cmp(slot->expiry, + selected->expiry) < 0)) { + selected = slot; + probe = true; + } + } + } + if (selected == NULL) { LOG_ERR("No free address found in address pool"); } else { @@ -1190,7 +1214,8 @@ static void dhcpv4_handle_decline(struct dhcpv4_server_ctx *ctx, (slot->state == DHCPV4_SERVER_ADDR_RESERVED || slot->state == DHCPV4_SERVER_ADDR_ALLOCATED)) { slot->state = DHCPV4_SERVER_ADDR_DECLINED; - slot->expiry = sys_timepoint_calc(K_FOREVER); + slot->expiry = + sys_timepoint_calc(ADDRESS_DECLINED_TIMEOUT); dhcpv4_server_timeout_recalc(ctx); break; } @@ -1280,6 +1305,11 @@ static void dhcpv4_server_timeout(struct k_work *work) slot->state = DHCPV4_SERVER_ADDR_FREE; } } + + if (slot->state == DHCPV4_SERVER_ADDR_DECLINED && + sys_timepoint_expired(slot->expiry)) { + slot->state = DHCPV4_SERVER_ADDR_FREE; + } } dhcpv4_server_timeout_recalc(ctx); From 9cd4f43a9b97cf696aff6405ede6c8f551aad4d5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 12 Feb 2024 11:06:26 +0100 Subject: [PATCH 0409/2300] [nrf fromlist] net: dhcpv4_server: Apply range limits for Kconfig options Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68848 Apply ranges to DHCPv4 server timeout Kconfig options, so that it cannot be set to a negative value by mistake. Signed-off-by: Robert Lubos (cherry picked from commit 352bf882873d9666c88d693296ce778ff1aa44ec) --- subsys/net/lib/dhcpv4/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig index c8ca410d39c..34125b6066c 100644 --- a/subsys/net/lib/dhcpv4/Kconfig +++ b/subsys/net/lib/dhcpv4/Kconfig @@ -37,6 +37,7 @@ config NET_DHCPV4_SERVER_ADDR_COUNT config NET_DHCPV4_SERVER_ADDR_LEASE_TIME int "Lease time for IPv4 addresses assigned by the server (seconds)" + range 0 4294967295 default 86400 help Lease time in seconds for IPv4 addresses assigned by the server. @@ -45,6 +46,7 @@ config NET_DHCPV4_SERVER_ADDR_LEASE_TIME config NET_DHCPV4_SERVER_ADDR_DECLINE_TIME int "The time IPv4 addresses remains blocked after conflict detection (seconds)" + range 0 4294967295 default 86400 help In case IPv4 address becomes blocked (either because of receiving @@ -56,6 +58,7 @@ config NET_DHCPV4_SERVER_ADDR_DECLINE_TIME config NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT int "Timeout for ICMP probes sent by the server (miliseconds)" + range 0 60000 default 1000 help DHCPv4 server will probe the offered IP address (send ICMP echo From 439aad97defd163c6134996bdb5e6fa8f2987ea4 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 16 Jan 2024 16:53:53 +0200 Subject: [PATCH 0410/2300] [nrf fromtree] net: zperf: Convert TCP receiver to use socket services Use socket services API for TCP receiver. Signed-off-by: Jukka Rissanen (cherry picked from commit 07823f771049bd64809b4c8b24854a0c116cab2b) (cherry picked from commit 1dae63f6d3867609aa682628a810846710f93e65) --- subsys/net/lib/zperf/Kconfig | 1 + subsys/net/lib/zperf/zperf_common.c | 1 - subsys/net/lib/zperf/zperf_internal.h | 1 - subsys/net/lib/zperf/zperf_tcp_receiver.c | 302 +++++++++++----------- 4 files changed, 157 insertions(+), 148 deletions(-) diff --git a/subsys/net/lib/zperf/Kconfig b/subsys/net/lib/zperf/Kconfig index 204144a805b..0cb637f376e 100644 --- a/subsys/net/lib/zperf/Kconfig +++ b/subsys/net/lib/zperf/Kconfig @@ -5,6 +5,7 @@ menuconfig NET_ZPERF bool "zperf shell utility" select NET_CONTEXT_RCVTIMEO if NET_NATIVE_UDP + select NET_SOCKETS_SERVICE help This option enables zperf shell utility, which allows to generate network traffic and evaluate network bandwidth. diff --git a/subsys/net/lib/zperf/zperf_common.c b/subsys/net/lib/zperf/zperf_common.c index 4bc675ed45e..3a2674dc05c 100644 --- a/subsys/net/lib/zperf/zperf_common.c +++ b/subsys/net/lib/zperf/zperf_common.c @@ -223,7 +223,6 @@ static int zperf_init(void) zperf_udp_uploader_init(); zperf_tcp_uploader_init(); zperf_udp_receiver_init(); - zperf_tcp_receiver_init(); zperf_session_init(); diff --git a/subsys/net/lib/zperf/zperf_internal.h b/subsys/net/lib/zperf/zperf_internal.h index 592424a9446..6fdb545cdd2 100644 --- a/subsys/net/lib/zperf/zperf_internal.h +++ b/subsys/net/lib/zperf/zperf_internal.h @@ -104,7 +104,6 @@ void zperf_async_work_submit(struct k_work *work); void zperf_udp_uploader_init(void); void zperf_tcp_uploader_init(void); void zperf_udp_receiver_init(void); -void zperf_tcp_receiver_init(void); void zperf_shell_init(void); diff --git a/subsys/net/lib/zperf/zperf_tcp_receiver.c b/subsys/net/lib/zperf/zperf_tcp_receiver.c index 344d34fe98c..c782124e36b 100644 --- a/subsys/net/lib/zperf/zperf_tcp_receiver.c +++ b/subsys/net/lib/zperf/zperf_tcp_receiver.c @@ -14,6 +14,7 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); #include #include +#include #include #include "zperf_internal.h" @@ -23,23 +24,11 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE) -#define TCP_RECEIVER_THREAD_PRIORITY K_PRIO_COOP(8) -#else -#define TCP_RECEIVER_THREAD_PRIORITY K_PRIO_PREEMPT(8) -#endif - -#define TCP_RECEIVER_STACK_SIZE 2048 - #define SOCK_ID_IPV4_LISTEN 0 #define SOCK_ID_IPV6_LISTEN 1 #define SOCK_ID_MAX (CONFIG_NET_ZPERF_MAX_SESSIONS + 2) #define TCP_RECEIVER_BUF_SIZE 1500 -#define POLL_TIMEOUT_MS 100 - -static K_THREAD_STACK_DEFINE(tcp_receiver_stack_area, TCP_RECEIVER_STACK_SIZE); -static struct k_thread tcp_receiver_thread_data; static zperf_callback tcp_session_cb; static void *tcp_user_data; @@ -49,6 +38,14 @@ static uint16_t tcp_server_port; static struct sockaddr tcp_server_addr; static K_SEM_DEFINE(tcp_server_run, 0, 1); +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); + +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_tcp, NULL, tcp_svc_handler, + SOCK_ID_MAX); + static void tcp_received(const struct sockaddr *addr, size_t datalen) { struct session *session; @@ -99,6 +96,143 @@ static void tcp_received(const struct sockaddr *addr, size_t datalen) } } +static void tcp_session_error_report(void) +{ + if (tcp_session_cb != NULL) { + tcp_session_cb(ZPERF_SESSION_ERROR, NULL, tcp_user_data); + } +} + +static int tcp_recv_data(struct net_socket_service_event *pev) +{ + static uint8_t buf[TCP_RECEIVER_BUF_SIZE]; + int i, ret = 0; + int family, sock; + struct sockaddr addr_incoming_conn; + socklen_t optlen = sizeof(int); + socklen_t addrlen = sizeof(struct sockaddr); + + if (tcp_server_stop) { + ret = -ENOENT; + goto cleanup; + } + + if ((pev->event.revents & ZSOCK_POLLERR) || + (pev->event.revents & ZSOCK_POLLNVAL)) { + (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, + SO_DOMAIN, &family, &optlen); + NET_ERR("TCP receiver IPv%d socket error", + family == AF_INET ? 4 : 6); + goto error; + } + + if (!(pev->event.revents & ZSOCK_POLLIN)) { + return 0; + } + + /* What is the index to first accepted socket */ + i = SOCK_ID_IPV6_LISTEN + 1; + + /* Check first if we need to accept a connection */ + if (fds[SOCK_ID_IPV4_LISTEN].fd == pev->event.fd || + fds[SOCK_ID_IPV6_LISTEN].fd == pev->event.fd) { + sock = zsock_accept(pev->event.fd, + &addr_incoming_conn, + &addrlen); + if (sock < 0) { + (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, + SO_DOMAIN, &family, &optlen); + NET_ERR("TCP receiver IPv%d accept error", + family == AF_INET ? 4 : 6); + goto error; + } + + for (; i < SOCK_ID_MAX; i++) { + if (fds[i].fd < 0) { + break; + } + } + + if (i == SOCK_ID_MAX) { + /* Too many connections. */ + NET_ERR("Dropping TCP connection, reached maximum limit."); + zsock_close(sock); + } else { + fds[i].fd = sock; + fds[i].events = ZSOCK_POLLIN; + memcpy(&sock_addr[i], &addr_incoming_conn, addrlen); + + (void)net_socket_service_register(&svc_tcp, fds, + ARRAY_SIZE(fds), + NULL); + } + + } else { + ret = zsock_recv(pev->event.fd, buf, sizeof(buf), 0); + if (ret < 0) { + (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, + SO_DOMAIN, &family, &optlen); + NET_ERR("recv failed on IPv%d socket (%d)", + family == AF_INET ? 4 : 6, + errno); + tcp_session_error_report(); + /* This will close the zperf session */ + ret = 0; + } + + for (; i < SOCK_ID_MAX; i++) { + if (fds[i].fd == pev->event.fd) { + break; + } + } + + if (i == SOCK_ID_MAX) { + NET_ERR("Descriptor %d not found.", pev->event.fd); + } else { + tcp_received(&sock_addr[i], ret); + if (ret == 0) { + zsock_close(fds[i].fd); + fds[i].fd = -1; + memset(&sock_addr[i], 0, sizeof(struct sockaddr)); + + (void)net_socket_service_register(&svc_tcp, fds, + ARRAY_SIZE(fds), + NULL); + } + } + } + + return ret; + +error: + tcp_session_error_report(); + +cleanup: + for (i = 0; i < ARRAY_SIZE(fds); i++) { + if (fds[i].fd >= 0) { + zsock_close(fds[i].fd); + fds[i].fd = -1; + memset(&sock_addr[i], 0, sizeof(struct sockaddr)); + } + } + + (void)net_socket_service_unregister(&svc_tcp); + + return ret; +} + +static void tcp_svc_handler(struct k_work *work) +{ + struct net_socket_service_event *pev = + CONTAINER_OF(work, struct net_socket_service_event, work); + int ret; + + ret = tcp_recv_data(pev); + if (ret < 0) { + (void)net_socket_service_unregister(&svc_tcp); + } +} + static int tcp_bind_listen_connection(struct zsock_pollfd *pollfd, struct sockaddr *address) { @@ -114,14 +248,14 @@ static int tcp_bind_listen_connection(struct zsock_pollfd *pollfd, ret = zsock_bind(pollfd->fd, address, sizeof(*address)); if (ret < 0) { NET_ERR("Cannot bind IPv%d TCP port %d (%d)", - (address->sa_family == AF_INET ? 4 : 6), port, errno); + address->sa_family == AF_INET ? 4 : 6, port, errno); goto out; } ret = zsock_listen(pollfd->fd, 1); if (ret < 0) { NET_ERR("Cannot listen IPv%d TCP (%d)", - (address->sa_family == AF_INET ? 4 : 6), errno); + address->sa_family == AF_INET ? 4 : 6, errno); goto out; } @@ -131,18 +265,8 @@ static int tcp_bind_listen_connection(struct zsock_pollfd *pollfd, return ret; } -static void tcp_session_error_report(void) +static void zperf_tcp_receiver_init(void) { - if (tcp_session_cb != NULL) { - tcp_session_cb(ZPERF_SESSION_ERROR, NULL, tcp_user_data); - } -} - -static void tcp_server_session(void) -{ - static uint8_t buf[TCP_RECEIVER_BUF_SIZE]; - static struct zsock_pollfd fds[SOCK_ID_MAX]; - static struct sockaddr sock_addr[SOCK_ID_MAX]; int ret; for (int i = 0; i < ARRAY_SIZE(fds); i++) { @@ -243,130 +367,14 @@ static void tcp_server_session(void) NET_INFO("Listening on port %d", tcp_server_port); - while (true) { - ret = zsock_poll(fds, ARRAY_SIZE(fds), POLL_TIMEOUT_MS); - if (ret < 0) { - NET_ERR("TCP receiver poll error (%d)", errno); - goto error; - } - - if (tcp_server_stop) { - goto cleanup; - } - - if (ret == 0) { - continue; - } - - for (int i = 0; i < ARRAY_SIZE(fds); i++) { - if ((fds[i].revents & ZSOCK_POLLERR) || - (fds[i].revents & ZSOCK_POLLNVAL)) { - NET_ERR("TCP receiver IPv%d socket error", - (sock_addr[i].sa_family == AF_INET - ? 4 : 6)); - goto error; - } - - if (!(fds[i].revents & ZSOCK_POLLIN)) { - continue; - } - - if ((i >= SOCK_ID_IPV4_LISTEN) && (i <= SOCK_ID_IPV6_LISTEN)) { - int j = SOCK_ID_IPV6_LISTEN + 1; - struct sockaddr addr_incoming_conn; - socklen_t addrlen = sizeof(struct sockaddr); - int sock = zsock_accept(fds[i].fd, - &addr_incoming_conn, - &addrlen); - - if (sock < 0) { - NET_ERR("TCP receiver IPv%d accept error", - (sock_addr[i].sa_family == AF_INET - ? 4 : 6)); - goto error; - } - - for (; j < SOCK_ID_MAX; j++) { - if (fds[j].fd < 0) { - break; - } - } - - if (j == SOCK_ID_MAX) { - /* Too many connections. */ - NET_ERR("Dropping TCP connection, reached maximum limit."); - zsock_close(sock); - } else { - fds[j].fd = sock; - fds[j].events = ZSOCK_POLLIN; - memcpy(&sock_addr[j], - &addr_incoming_conn, - addrlen); - } - } else if ((i > SOCK_ID_IPV6_LISTEN) && (i < SOCK_ID_MAX)) { - ret = zsock_recv(fds[i].fd, buf, sizeof(buf), 0); - if (ret < 0) { - NET_ERR("recv failed on IPv%d socket (%d)", - (sock_addr[i].sa_family == AF_INET - ? 4 : 6), - errno); - tcp_session_error_report(); - /* This will close the zperf session */ - ret = 0; - } - - tcp_received(&sock_addr[i], ret); - - if (ret == 0) { - zsock_close(fds[i].fd); - fds[i].fd = -1; - memset(&sock_addr[i], 0, - sizeof(struct sockaddr)); - } - } else { - goto error; - } - } + ret = net_socket_service_register(&svc_tcp, fds, + ARRAY_SIZE(fds), NULL); + if (ret < 0) { + LOG_ERR("Cannot register socket service handler (%d)", ret); } error: - tcp_session_error_report(); - -cleanup: - for (int i = 0; i < ARRAY_SIZE(fds); i++) { - if (fds[i].fd >= 0) { - zsock_close(fds[i].fd); - memset(&sock_addr[i], 0, sizeof(struct sockaddr)); - } - } -} - -void tcp_receiver_thread(void *ptr1, void *ptr2, void *ptr3) -{ - ARG_UNUSED(ptr1); - ARG_UNUSED(ptr2); - ARG_UNUSED(ptr3); - - while (true) { - k_sem_take(&tcp_server_run, K_FOREVER); - - tcp_server_session(); - - tcp_server_running = false; - } -} - -void zperf_tcp_receiver_init(void) -{ - k_thread_create(&tcp_receiver_thread_data, - tcp_receiver_stack_area, - K_THREAD_STACK_SIZEOF(tcp_receiver_stack_area), - tcp_receiver_thread, - NULL, NULL, NULL, - TCP_RECEIVER_THREAD_PRIORITY, - IS_ENABLED(CONFIG_USERSPACE) ? K_USER | - K_INHERIT_PERMS : 0, - K_NO_WAIT); + return; } int zperf_tcp_download(const struct zperf_download_params *param, @@ -387,6 +395,8 @@ int zperf_tcp_download(const struct zperf_download_params *param, tcp_server_stop = false; memcpy(&tcp_server_addr, ¶m->addr, sizeof(struct sockaddr)); + zperf_tcp_receiver_init(); + k_sem_give(&tcp_server_run); return 0; From de4a8e3562b5d27910bf302df3cf914e0439f6b3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 17 Jan 2024 14:57:43 +0200 Subject: [PATCH 0411/2300] [nrf fromtree] net: zperf: Convert UDP receiver to use socket services Use socket services API for UDP receiver. Signed-off-by: Jukka Rissanen (cherry picked from commit 1e8cbd5d43fc108ec4be8eebe653e62f842e0def) (cherry picked from commit 2d0354b2a4ad8221a2445dd130a64b5bdd90995c) --- subsys/net/lib/zperf/zperf_common.c | 1 - subsys/net/lib/zperf/zperf_internal.h | 1 - subsys/net/lib/zperf/zperf_udp_receiver.c | 177 +++++++++++----------- 3 files changed, 86 insertions(+), 93 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_common.c b/subsys/net/lib/zperf/zperf_common.c index 3a2674dc05c..89224b691ca 100644 --- a/subsys/net/lib/zperf/zperf_common.c +++ b/subsys/net/lib/zperf/zperf_common.c @@ -222,7 +222,6 @@ static int zperf_init(void) zperf_udp_uploader_init(); zperf_tcp_uploader_init(); - zperf_udp_receiver_init(); zperf_session_init(); diff --git a/subsys/net/lib/zperf/zperf_internal.h b/subsys/net/lib/zperf/zperf_internal.h index 6fdb545cdd2..b8cdb84cbbf 100644 --- a/subsys/net/lib/zperf/zperf_internal.h +++ b/subsys/net/lib/zperf/zperf_internal.h @@ -103,7 +103,6 @@ uint32_t zperf_packet_duration(uint32_t packet_size, uint32_t rate_in_kbps); void zperf_async_work_submit(struct k_work *work); void zperf_udp_uploader_init(void); void zperf_tcp_uploader_init(void); -void zperf_udp_receiver_init(void); void zperf_shell_init(void); diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index 75a0b35b234..ba44590c621 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -13,6 +13,7 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); #include #include +#include #include #include "zperf_internal.h" @@ -25,14 +26,6 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); static struct sockaddr_in6 *in6_addr_my; static struct sockaddr_in *in4_addr_my; -#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE) -#define UDP_RECEIVER_THREAD_PRIORITY K_PRIO_COOP(8) -#else -#define UDP_RECEIVER_THREAD_PRIORITY K_PRIO_PREEMPT(8) -#endif - -#define UDP_RECEIVER_STACK_SIZE 2048 - #define SOCK_ID_IPV4 0 #define SOCK_ID_IPV6 1 #define SOCK_ID_MAX 2 @@ -40,9 +33,6 @@ static struct sockaddr_in *in4_addr_my; #define UDP_RECEIVER_BUF_SIZE 1500 #define POLL_TIMEOUT_MS 100 -static K_THREAD_STACK_DEFINE(udp_receiver_stack_area, UDP_RECEIVER_STACK_SIZE); -static struct k_thread udp_receiver_thread_data; - static zperf_callback udp_session_cb; static void *udp_user_data; static bool udp_server_running; @@ -51,6 +41,13 @@ static uint16_t udp_server_port; static struct sockaddr udp_server_addr; static K_SEM_DEFINE(udp_server_run, 0, 1); +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, + SOCK_ID_MAX); + static inline void build_reply(struct zperf_udp_datagram *hdr, struct zperf_server_hdr *stat, uint8_t *buf) @@ -230,10 +227,79 @@ static void udp_received(int sock, const struct sockaddr *addr, uint8_t *data, } } -static void udp_server_session(void) +static int udp_recv_data(struct net_socket_service_event *pev) { static uint8_t buf[UDP_RECEIVER_BUF_SIZE]; - struct zsock_pollfd fds[SOCK_ID_MAX] = { 0 }; + int i, ret = 0; + int family; + struct sockaddr addr; + socklen_t optlen = sizeof(int); + socklen_t addrlen = sizeof(addr); + + if (udp_server_stop) { + ret = -ENOENT; + goto cleanup; + } + + if ((pev->event.revents & ZSOCK_POLLERR) || + (pev->event.revents & ZSOCK_POLLNVAL)) { + (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, + SO_DOMAIN, &family, &optlen); + NET_ERR("UDP receiver IPv%d socket error", + family == AF_INET ? 4 : 6); + goto error; + } + + if (!(pev->event.revents & ZSOCK_POLLIN)) { + return 0; + } + + ret = zsock_recvfrom(pev->event.fd, buf, sizeof(buf), 0, + &addr, &addrlen); + if (ret < 0) { + (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, + SO_DOMAIN, &family, &optlen); + NET_ERR("recv failed on IPv%d socket (%d)", + family == AF_INET ? 4 : 6, errno); + goto error; + } + + udp_received(pev->event.fd, &addr, buf, ret); + + return ret; + +error: + if (udp_session_cb != NULL) { + udp_session_cb(ZPERF_SESSION_ERROR, NULL, udp_user_data); + } + +cleanup: + for (i = 0; i < ARRAY_SIZE(fds); i++) { + if (fds[i].fd >= 0) { + zsock_close(fds[i].fd); + fds[i].fd = -1; + } + } + + (void)net_socket_service_unregister(&svc_udp); + + return ret; +} + +static void udp_svc_handler(struct k_work *work) +{ + struct net_socket_service_event *pev = + CONTAINER_OF(work, struct net_socket_service_event, work); + int ret; + + ret = udp_recv_data(pev); + if (ret < 0) { + (void)net_socket_service_unregister(&svc_udp); + } +} + +static void zperf_udp_receiver_init(void) +{ int ret; for (int i = 0; i < ARRAY_SIZE(fds); i++) { @@ -341,87 +407,14 @@ static void udp_server_session(void) NET_INFO("Listening on port %d", udp_server_port); - while (true) { - ret = zsock_poll(fds, ARRAY_SIZE(fds), POLL_TIMEOUT_MS); - if (ret < 0) { - NET_ERR("UDP receiver poll error (%d)", errno); - goto error; - } - - if (udp_server_stop) { - goto cleanup; - } - - if (ret == 0) { - continue; - } - - for (int i = 0; i < ARRAY_SIZE(fds); i++) { - struct sockaddr addr; - socklen_t addrlen = sizeof(addr); - - if ((fds[i].revents & ZSOCK_POLLERR) || - (fds[i].revents & ZSOCK_POLLNVAL)) { - NET_ERR("UDP receiver IPv%d socket error", - (i == SOCK_ID_IPV4) ? 4 : 6); - goto error; - } - - if (!(fds[i].revents & ZSOCK_POLLIN)) { - continue; - } - - ret = zsock_recvfrom(fds[i].fd, buf, sizeof(buf), 0, - &addr, &addrlen); - if (ret < 0) { - NET_ERR("recv failed on IPv%d socket (%d)", - (i == SOCK_ID_IPV4) ? 4 : 6, errno); - goto error; - } - - udp_received(fds[i].fd, &addr, buf, ret); - } + ret = net_socket_service_register(&svc_udp, fds, + ARRAY_SIZE(fds), NULL); + if (ret < 0) { + LOG_ERR("Cannot register socket service handler (%d)", ret); } error: - if (udp_session_cb != NULL) { - udp_session_cb(ZPERF_SESSION_ERROR, NULL, udp_user_data); - } - -cleanup: - for (int i = 0; i < ARRAY_SIZE(fds); i++) { - if (fds[i].fd >= 0) { - zsock_close(fds[i].fd); - } - } -} - -static void udp_receiver_thread(void *ptr1, void *ptr2, void *ptr3) -{ - ARG_UNUSED(ptr1); - ARG_UNUSED(ptr2); - ARG_UNUSED(ptr3); - - while (true) { - k_sem_take(&udp_server_run, K_FOREVER); - - udp_server_session(); - - udp_server_running = false; - } -} - -void zperf_udp_receiver_init(void) -{ - k_thread_create(&udp_receiver_thread_data, - udp_receiver_stack_area, - K_THREAD_STACK_SIZEOF(udp_receiver_stack_area), - udp_receiver_thread, - NULL, NULL, NULL, - UDP_RECEIVER_THREAD_PRIORITY, - IS_ENABLED(CONFIG_USERSPACE) ? K_USER | - K_INHERIT_PERMS : 0, - K_NO_WAIT); + return; } int zperf_udp_download(const struct zperf_download_params *param, @@ -442,6 +435,8 @@ int zperf_udp_download(const struct zperf_download_params *param, udp_server_stop = false; memcpy(&udp_server_addr, ¶m->addr, sizeof(struct sockaddr)); + zperf_udp_receiver_init(); + k_sem_give(&udp_server_run); return 0; From 65535b8ddb0c9aaabb912d1af5fb3d2a215d0492 Mon Sep 17 00:00:00 2001 From: Fengming Ye Date: Sun, 21 Jan 2024 16:49:20 +0900 Subject: [PATCH 0412/2300] [nrf fromtree] net: zperf: fix the calculation ratio between mbps, kbps and bps The ratio between mbps and kbps, kbps and bps should be 1000, instead of 1024, as common sense. The wrong ratio will decrease the Zperf throughput result. Signed-off-by: Fengming Ye (cherry picked from commit f61a0cb1fa5de524ade69e241d9737173b49d947) (cherry picked from commit f2bbad75158a76dbc497d2b2cbbc48771f678818) --- subsys/net/lib/zperf/zperf_shell.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_shell.c b/subsys/net/lib/zperf/zperf_shell.c index 444cf125c31..2c30c1e33e3 100644 --- a/subsys/net/lib/zperf/zperf_shell.c +++ b/subsys/net/lib/zperf/zperf_shell.c @@ -76,9 +76,9 @@ static struct in_addr shell_ipv4; const uint32_t TIME_US[] = { 60 * 1000 * 1000, 1000 * 1000, 1000, 0 }; const char *TIME_US_UNIT[] = { "m", "s", "ms", "us" }; -const uint32_t KBPS[] = { 1024, 0 }; +const uint32_t KBPS[] = { 1000, 0 }; const char *KBPS_UNIT[] = { "Mbps", "Kbps" }; -const uint32_t K[] = { 1024 * 1024, 1024, 0 }; +const uint32_t K[] = { 1000 * 1000, 1000, 0 }; const char *K_UNIT[] = { "M", "K", "" }; static void print_number(const struct shell *sh, uint32_t value, @@ -308,7 +308,7 @@ static void udp_session_cb(enum zperf_status status, rate_in_kbps = (uint32_t) (((uint64_t)result->total_len * 8ULL * (uint64_t)USEC_PER_SEC) / - ((uint64_t)result->time_in_us * 1024ULL)); + ((uint64_t)result->time_in_us * 1000ULL)); } else { rate_in_kbps = 0U; } @@ -408,7 +408,7 @@ static void shell_udp_upload_print_stats(const struct shell *sh, rate_in_kbps = (uint32_t) (((uint64_t)results->total_len * (uint64_t)8 * (uint64_t)USEC_PER_SEC) / - ((uint64_t)results->time_in_us * 1024U)); + ((uint64_t)results->time_in_us * 1000U)); } else { rate_in_kbps = 0U; } @@ -418,7 +418,7 @@ static void shell_udp_upload_print_stats(const struct shell *sh, (((uint64_t)results->nb_packets_sent * (uint64_t)results->packet_size * (uint64_t)8 * (uint64_t)USEC_PER_SEC) / - ((uint64_t)results->client_time_in_us * 1024U)); + ((uint64_t)results->client_time_in_us * 1000U)); } else { client_rate_in_kbps = 0U; } @@ -474,7 +474,7 @@ static void shell_tcp_upload_print_stats(const struct shell *sh, (((uint64_t)results->nb_packets_sent * (uint64_t)results->packet_size * (uint64_t)8 * (uint64_t)USEC_PER_SEC) / - ((uint64_t)results->client_time_in_us * 1024U)); + ((uint64_t)results->client_time_in_us * 1000U)); } else { client_rate_in_kbps = 0U; } @@ -884,7 +884,7 @@ static int shell_cmd_upload(const struct shell *sh, size_t argc, if (argc > 5) { param.rate_kbps = - (parse_number(argv[start + 5], K, K_UNIT) + 1023) / 1024; + (parse_number(argv[start + 5], K, K_UNIT) + 999) / 1000; } else { param.rate_kbps = 10U; } @@ -1035,7 +1035,7 @@ static int shell_cmd_upload2(const struct shell *sh, size_t argc, if (argc > 4) { param.rate_kbps = - (parse_number(argv[start + 4], K, K_UNIT) + 1023) / 1024; + (parse_number(argv[start + 4], K, K_UNIT) + 999) / 1000; } else { param.rate_kbps = 10U; } @@ -1108,7 +1108,7 @@ static void tcp_session_cb(enum zperf_status status, rate_in_kbps = (uint32_t) (((uint64_t)result->total_len * 8ULL * (uint64_t)USEC_PER_SEC) / - ((uint64_t)result->time_in_us * 1024ULL)); + ((uint64_t)result->time_in_us * 1000ULL)); } else { rate_in_kbps = 0U; } From 8759556a08276c1a35423b9ec0c95a6320721cb4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 31 Jan 2024 15:33:27 +0100 Subject: [PATCH 0413/2300] [nrf fromtree] net: zperf: Fix UDP receiver start/stop operation This commit fixes restarting of UDP receiver service, along with some other minor cleanups: * The core issue was udp_server_running flag not being cleared when service was stopped. Fix this by introducing udp_receiver_cleanup() which does all of the required cleanups when receiver service is stopped. The function is called either when the application stopped the service with zperf_udp_download_stop(), or when the service was stopped due to error. * net_socket_service_unregister() was not called on zperf_udp_download_stop(), but only from the service callback - that would not work in case there's no active communication. * at the same time, net_socket_service_unregister() would be called from the service callback in case of errors. Fix this, by making udp_recv_data() only return an error, and let the service callback to do the cleanup. * Remove no longer used udp_server_run semaphore * Remove udp_server_stop - with socket services it seems no longer needed. * zperf_udp_receiver_init() now returns an error, so that we don't mark the service as running in case of socket/services error. Signed-off-by: Robert Lubos (cherry picked from commit 139bc4e87e7c219fc9dc9b04a34a8cea13bb164e) (cherry picked from commit 1ff0c29f0c3d19cb9bc52a15bc9ab8b4ee19de81) --- subsys/net/lib/zperf/zperf_udp_receiver.c | 72 ++++++++++++++--------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index ba44590c621..64f489ed8dc 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -36,10 +36,8 @@ static struct sockaddr_in *in4_addr_my; static zperf_callback udp_session_cb; static void *udp_user_data; static bool udp_server_running; -static bool udp_server_stop; static uint16_t udp_server_port; static struct sockaddr udp_server_addr; -static K_SEM_DEFINE(udp_server_run, 0, 1); struct zsock_pollfd fds[SOCK_ID_MAX] = { 0 }; @@ -227,26 +225,45 @@ static void udp_received(int sock, const struct sockaddr *addr, uint8_t *data, } } +static void udp_receiver_cleanup(void) +{ + int i; + + (void)net_socket_service_unregister(&svc_udp); + + for (i = 0; i < ARRAY_SIZE(fds); i++) { + if (fds[i].fd >= 0) { + zsock_close(fds[i].fd); + fds[i].fd = -1; + } + } + + udp_server_running = false; + udp_session_cb = NULL; +} + static int udp_recv_data(struct net_socket_service_event *pev) { static uint8_t buf[UDP_RECEIVER_BUF_SIZE]; - int i, ret = 0; - int family; + int ret = 0; + int family, sock_error; struct sockaddr addr; socklen_t optlen = sizeof(int); socklen_t addrlen = sizeof(addr); - if (udp_server_stop) { - ret = -ENOENT; - goto cleanup; + if (!udp_server_running) { + return -ENOENT; } if ((pev->event.revents & ZSOCK_POLLERR) || (pev->event.revents & ZSOCK_POLLNVAL)) { (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, SO_DOMAIN, &family, &optlen); - NET_ERR("UDP receiver IPv%d socket error", - family == AF_INET ? 4 : 6); + (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, + SO_ERROR, &sock_error, &optlen); + NET_ERR("UDP receiver IPv%d socket error (%d)", + family == AF_INET ? 4 : 6, sock_error); + ret = -sock_error; goto error; } @@ -257,10 +274,11 @@ static int udp_recv_data(struct net_socket_service_event *pev) ret = zsock_recvfrom(pev->event.fd, buf, sizeof(buf), 0, &addr, &addrlen); if (ret < 0) { + ret = -errno; (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, SO_DOMAIN, &family, &optlen); NET_ERR("recv failed on IPv%d socket (%d)", - family == AF_INET ? 4 : 6, errno); + family == AF_INET ? 4 : 6, -ret); goto error; } @@ -273,16 +291,6 @@ static int udp_recv_data(struct net_socket_service_event *pev) udp_session_cb(ZPERF_SESSION_ERROR, NULL, udp_user_data); } -cleanup: - for (i = 0; i < ARRAY_SIZE(fds); i++) { - if (fds[i].fd >= 0) { - zsock_close(fds[i].fd); - fds[i].fd = -1; - } - } - - (void)net_socket_service_unregister(&svc_udp); - return ret; } @@ -294,11 +302,11 @@ static void udp_svc_handler(struct k_work *work) ret = udp_recv_data(pev); if (ret < 0) { - (void)net_socket_service_unregister(&svc_udp); + udp_receiver_cleanup(); } } -static void zperf_udp_receiver_init(void) +static int zperf_udp_receiver_init(void) { int ret; @@ -314,6 +322,7 @@ static void zperf_udp_receiver_init(void) fds[SOCK_ID_IPV4].fd = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fds[SOCK_ID_IPV4].fd < 0) { + ret = -errno; NET_ERR("Cannot create IPv4 network socket."); goto error; } @@ -362,6 +371,7 @@ static void zperf_udp_receiver_init(void) fds[SOCK_ID_IPV6].fd = zsock_socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (fds[SOCK_ID_IPV6].fd < 0) { + ret = -errno; NET_ERR("Cannot create IPv4 network socket."); goto error; } @@ -414,12 +424,15 @@ static void zperf_udp_receiver_init(void) } error: - return; + + return ret; } int zperf_udp_download(const struct zperf_download_params *param, zperf_callback callback, void *user_data) { + int ret; + if (param == NULL || callback == NULL) { return -EINVAL; } @@ -431,13 +444,15 @@ int zperf_udp_download(const struct zperf_download_params *param, udp_session_cb = callback; udp_user_data = user_data; udp_server_port = param->port; - udp_server_running = true; - udp_server_stop = false; memcpy(&udp_server_addr, ¶m->addr, sizeof(struct sockaddr)); - zperf_udp_receiver_init(); + ret = zperf_udp_receiver_init(); + if (ret < 0) { + udp_receiver_cleanup(); + return ret; + } - k_sem_give(&udp_server_run); + udp_server_running = true; return 0; } @@ -448,8 +463,7 @@ int zperf_udp_download_stop(void) return -EALREADY; } - udp_server_stop = true; - udp_session_cb = NULL; + udp_receiver_cleanup(); return 0; } From 40c0461b6ef606eb8230b2ab6ed26500c9a068c0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 31 Jan 2024 15:58:20 +0100 Subject: [PATCH 0414/2300] [nrf fromtree] net: zperf: Fix TCP receiver start/stop operation The issues found for UDP receiver were also identified for TCP receiver, this commit applies practically the same set of changes as in case of UDP. Signed-off-by: Robert Lubos (cherry picked from commit 4ce03520264d7bd135eb5eccf4fabe060e78e9ae) (cherry picked from commit 6e23a9d89a2e80bbb5618715e99abf76d602ae9e) --- subsys/net/lib/zperf/zperf_tcp_receiver.c | 73 +++++++++++++---------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_tcp_receiver.c b/subsys/net/lib/zperf/zperf_tcp_receiver.c index c782124e36b..09624dd07b7 100644 --- a/subsys/net/lib/zperf/zperf_tcp_receiver.c +++ b/subsys/net/lib/zperf/zperf_tcp_receiver.c @@ -33,10 +33,8 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); static zperf_callback tcp_session_cb; static void *tcp_user_data; static bool tcp_server_running; -static bool tcp_server_stop; static uint16_t tcp_server_port; static struct sockaddr tcp_server_addr; -static K_SEM_DEFINE(tcp_server_run, 0, 1); static struct zsock_pollfd fds[SOCK_ID_MAX]; static struct sockaddr sock_addr[SOCK_ID_MAX]; @@ -103,26 +101,46 @@ static void tcp_session_error_report(void) } } +static void tcp_receiver_cleanup(void) +{ + int i; + + (void)net_socket_service_unregister(&svc_tcp); + + for (i = 0; i < ARRAY_SIZE(fds); i++) { + if (fds[i].fd >= 0) { + zsock_close(fds[i].fd); + fds[i].fd = -1; + memset(&sock_addr[i], 0, sizeof(struct sockaddr)); + } + } + + tcp_server_running = false; + tcp_session_cb = NULL; +} + static int tcp_recv_data(struct net_socket_service_event *pev) { static uint8_t buf[TCP_RECEIVER_BUF_SIZE]; int i, ret = 0; - int family, sock; + int family, sock, sock_error; struct sockaddr addr_incoming_conn; socklen_t optlen = sizeof(int); socklen_t addrlen = sizeof(struct sockaddr); - if (tcp_server_stop) { - ret = -ENOENT; - goto cleanup; + if (!tcp_server_running) { + return -ENOENT; } if ((pev->event.revents & ZSOCK_POLLERR) || (pev->event.revents & ZSOCK_POLLNVAL)) { (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, SO_DOMAIN, &family, &optlen); - NET_ERR("TCP receiver IPv%d socket error", - family == AF_INET ? 4 : 6); + (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, + SO_ERROR, &sock_error, &optlen); + NET_ERR("TCP receiver IPv%d socket error (%d)", + family == AF_INET ? 4 : 6, sock_error); + ret = -sock_error; goto error; } @@ -140,10 +158,11 @@ static int tcp_recv_data(struct net_socket_service_event *pev) &addr_incoming_conn, &addrlen); if (sock < 0) { + ret = -errno; (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, SO_DOMAIN, &family, &optlen); - NET_ERR("TCP receiver IPv%d accept error", - family == AF_INET ? 4 : 6); + NET_ERR("TCP receiver IPv%d accept error (%d)", + family == AF_INET ? 4 : 6, ret); goto error; } @@ -207,17 +226,6 @@ static int tcp_recv_data(struct net_socket_service_event *pev) error: tcp_session_error_report(); -cleanup: - for (i = 0; i < ARRAY_SIZE(fds); i++) { - if (fds[i].fd >= 0) { - zsock_close(fds[i].fd); - fds[i].fd = -1; - memset(&sock_addr[i], 0, sizeof(struct sockaddr)); - } - } - - (void)net_socket_service_unregister(&svc_tcp); - return ret; } @@ -229,7 +237,7 @@ static void tcp_svc_handler(struct k_work *work) ret = tcp_recv_data(pev); if (ret < 0) { - (void)net_socket_service_unregister(&svc_tcp); + tcp_receiver_cleanup(); } } @@ -265,7 +273,7 @@ static int tcp_bind_listen_connection(struct zsock_pollfd *pollfd, return ret; } -static void zperf_tcp_receiver_init(void) +static int zperf_tcp_receiver_init(void) { int ret; @@ -280,6 +288,7 @@ static void zperf_tcp_receiver_init(void) fds[SOCK_ID_IPV4_LISTEN].fd = zsock_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fds[SOCK_ID_IPV4_LISTEN].fd < 0) { + ret = -errno; NET_ERR("Cannot create IPv4 network socket."); goto error; } @@ -325,6 +334,7 @@ static void zperf_tcp_receiver_init(void) fds[SOCK_ID_IPV6_LISTEN].fd = zsock_socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); if (fds[SOCK_ID_IPV6_LISTEN].fd < 0) { + ret = -errno; NET_ERR("Cannot create IPv6 network socket."); goto error; } @@ -374,12 +384,14 @@ static void zperf_tcp_receiver_init(void) } error: - return; + return ret; } int zperf_tcp_download(const struct zperf_download_params *param, zperf_callback callback, void *user_data) { + int ret; + if (param == NULL || callback == NULL) { return -EINVAL; } @@ -391,13 +403,15 @@ int zperf_tcp_download(const struct zperf_download_params *param, tcp_session_cb = callback; tcp_user_data = user_data; tcp_server_port = param->port; - tcp_server_running = true; - tcp_server_stop = false; memcpy(&tcp_server_addr, ¶m->addr, sizeof(struct sockaddr)); - zperf_tcp_receiver_init(); + ret = zperf_tcp_receiver_init(); + if (ret < 0) { + tcp_receiver_cleanup(); + return ret; + } - k_sem_give(&tcp_server_run); + tcp_server_running = true; return 0; } @@ -408,8 +422,7 @@ int zperf_tcp_download_stop(void) return -EALREADY; } - tcp_server_stop = true; - tcp_session_cb = NULL; + tcp_receiver_cleanup(); return 0; } From 7df557f01329d51a85b96fae45b3c6049e8d9cbe Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 31 Jan 2024 16:17:45 +0100 Subject: [PATCH 0415/2300] [nrf fromtree] net: zperf: Fix session leak In case zperf session was aborted by the user (by for instance stopping it from shell), or practically in case of any other communication-related error, the zperf session could end up in a state other than NULL or COMPLETED, with no way to recover. This made the session no longer usable and eventually could lead to zperf being not able to start a new session anymore. Fix this by introducing zperf_session_reset() function, which resets the session state back to defaults. The function is called when the zperf receiver service is stopped. Signed-off-by: Robert Lubos (cherry picked from commit 68bc981c523d085f5a705cfae63b95fc6b5015ca) (cherry picked from commit aca817354edd91b57c7cc1cd9362d7d63ea3b5be) --- subsys/net/lib/zperf/zperf_session.c | 23 ++++++++++++++++++----- subsys/net/lib/zperf/zperf_session.h | 2 ++ subsys/net/lib/zperf/zperf_tcp_receiver.c | 2 ++ subsys/net/lib/zperf/zperf_udp_receiver.c | 2 ++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_session.c b/subsys/net/lib/zperf/zperf_session.c index 3b72367e179..6fff4abf9cc 100644 --- a/subsys/net/lib/zperf/zperf_session.c +++ b/subsys/net/lib/zperf/zperf_session.c @@ -102,14 +102,27 @@ void zperf_reset_session_stats(struct session *session) session->last_transit_time = 0; } -void zperf_session_init(void) +void zperf_session_reset(enum session_proto proto) { int i, j; + if (proto >= SESSION_PROTO_END) { + return; + } + + i = (int)proto; + + for (j = 0; j < SESSION_MAX; j++) { + sessions[i][j].state = STATE_NULL; + zperf_reset_session_stats(&(sessions[i][j])); + } +} + +void zperf_session_init(void) +{ + int i; + for (i = 0; i < SESSION_PROTO_END; i++) { - for (j = 0; j < SESSION_MAX; j++) { - sessions[i][j].state = STATE_NULL; - zperf_reset_session_stats(&(sessions[i][j])); - } + zperf_session_reset(i); } } diff --git a/subsys/net/lib/zperf/zperf_session.h b/subsys/net/lib/zperf/zperf_session.h index ea28dec2c60..f01bc66b71a 100644 --- a/subsys/net/lib/zperf/zperf_session.h +++ b/subsys/net/lib/zperf/zperf_session.h @@ -58,5 +58,7 @@ struct session *get_session(const struct sockaddr *addr, enum session_proto proto); void zperf_session_init(void); void zperf_reset_session_stats(struct session *session); +/* Reset all sessions for a given protocol. */ +void zperf_session_reset(enum session_proto proto); #endif /* __ZPERF_SESSION_H */ diff --git a/subsys/net/lib/zperf/zperf_tcp_receiver.c b/subsys/net/lib/zperf/zperf_tcp_receiver.c index 09624dd07b7..3efd3ff630b 100644 --- a/subsys/net/lib/zperf/zperf_tcp_receiver.c +++ b/subsys/net/lib/zperf/zperf_tcp_receiver.c @@ -117,6 +117,8 @@ static void tcp_receiver_cleanup(void) tcp_server_running = false; tcp_session_cb = NULL; + + zperf_session_reset(SESSION_TCP); } static int tcp_recv_data(struct net_socket_service_event *pev) diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index 64f489ed8dc..ae1ac063300 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -240,6 +240,8 @@ static void udp_receiver_cleanup(void) udp_server_running = false; udp_session_cb = NULL; + + zperf_session_reset(SESSION_UDP); } static int udp_recv_data(struct net_socket_service_event *pev) From 6c976412d1091fe29dc186e92d3efeb932ec99f2 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Thu, 7 Dec 2023 18:26:01 +0100 Subject: [PATCH 0416/2300] [nrf fromtree] manifest: TF-M v2.0.0 update Update TF-M to version 2.0.0 including MbedTLS to v3.5.0 TF-M-Tests to v2.0.0 PSA-Arch_Tests to v23.06_API1.5_ADAC_EAC Signed-off-by: Markus Swarowsky (cherry picked from commit 917bec37d0849932c122d355ded690697a5bf812) Signed-off-by: Markus Swarowsky (cherry picked from commit ff5ebf0f5b8d641a893392d6dc949e6a2ec193e6) --- submanifests/optional.yaml | 4 ++-- west.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index 54b3d77c0cb..00b0408c454 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -28,7 +28,7 @@ manifest: groups: - optional - name: psa-arch-tests - revision: 6a17330e0dfb5f319730f974d5b05f7b7f04757b + revision: 2cadb02a72eacda7042505dcbdd492371e8ce024 path: modules/tee/tf-m/psa-arch-tests remote: upstream groups: @@ -40,7 +40,7 @@ manifest: groups: - optional - name: tf-m-tests - revision: a878426da78fbd1486dfc29d6c6b82be4ee79e72 + revision: 08a3158f0623a4205608a52d880b17ae394e31d2 path: modules/tee/tf-m/tf-m-tests remote: upstream groups: diff --git a/west.yml b/west.yml index 65c1c5a0837..200690b6f3e 100644 --- a/west.yml +++ b/west.yml @@ -277,7 +277,7 @@ manifest: revision: 7c61a4cec26402d20c845c95dcad0e39dcd319f8 path: modules/lib/gui/lvgl - name: mbedtls - revision: 7053083b0cff8462464e3cbb826e87852fc03da6 + revision: 66ed2279d6222056af172c188eaf4dcfed481032 path: modules/crypto/mbedtls groups: - crypto @@ -322,7 +322,7 @@ manifest: groups: - crypto - name: trusted-firmware-m - revision: 33c0f47bcb19721a5c33e6fe1eee9225d00bb5bc + revision: 58d0b5367f0fada9dbaddad1e08e302aeb044863 path: modules/tee/tf-m/trusted-firmware-m groups: - tee From ae9e596dc543cd85f963e130381ce0465067ec5c Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 8 Dec 2023 10:45:07 +0100 Subject: [PATCH 0417/2300] [nrf fromtree] modules: mbedtls: Sort base src Sort the list of source files for the mbedTLSBase library Signed-off-by: Markus Swarowsky (cherry picked from commit e53485c012e6b7cae1762bb41ea9d4cda0c05cd3) Signed-off-by: Markus Swarowsky (cherry picked from commit 4a539ee50b453d83624a5ad595ee41602f90e26c) --- modules/mbedtls/CMakeLists.txt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index f061605c027..ae6c7e13ad6 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -28,30 +28,24 @@ zephyr_interface_library_named(mbedTLS) # Base mbed TLS files list(APPEND mbedtls_base_src + ${ZEPHYR_CURRENT_MODULE_DIR}/library/aes.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/aesni.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/aria.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/asn1parse.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/asn1write.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/base64.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum_core.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum_mod.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum_mod_raw.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/nist_kw.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/oid.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/padlock.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/platform.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/platform_util.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/version.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/constant_time.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/aes.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/aesni.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/aria.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum_mod.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/camellia.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ccm.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/chacha20.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/chachapoly.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/cipher.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/cipher_wrap.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/cipher.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/cmac.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/constant_time.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ctr_drbg.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/debug.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/des.c @@ -59,10 +53,10 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecdh.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecdsa.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecjpake.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp_curves.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy_poll.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/error.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/gcm.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/hash_info.c @@ -70,11 +64,16 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/hmac_drbg.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/lmots.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/lms.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/md5.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/md.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/md5.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/memory_buffer_alloc.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/mps_reader.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/mps_trace.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/nist_kw.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/oid.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/padlock.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/platform_util.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/platform.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/poly1305.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_util.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ripemd160.c @@ -86,6 +85,7 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/threading.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/timing.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/version_features.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/version.c zephyr_init.c ) From a1f89bdc9bdf9d239e451c68d94a690ac425373b Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 8 Dec 2023 10:48:28 +0100 Subject: [PATCH 0418/2300] [nrf fromtree] modules: mbedtls: Adapt source list to 3.5.0 remove hash_info.c and add ecp_curves_new.c Signed-off-by: Markus Swarowsky (cherry picked from commit 85ecdd70e4b35d63f942fc87165aa4da732ab5ea) Signed-off-by: Markus Swarowsky (cherry picked from commit d277d2d4a47ab965ede843b4b417e3c955bf41c2) --- modules/mbedtls/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index ae6c7e13ad6..74cd4853b8d 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -53,13 +53,13 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecdh.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecdsa.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecjpake.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp_curves_new.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp_curves.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy_poll.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/error.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/gcm.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/hash_info.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/hkdf.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/hmac_drbg.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/lmots.c From c41f1a4235ad69941f61e32ec78929911955b61a Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 8 Dec 2023 13:34:48 +0100 Subject: [PATCH 0419/2300] [nrf fromtree] modules: tf-m: nrf5340_cpuapp: Change to cpuarch.cmake The preload.cmake was renamed to cpuarch.cmake in TF-M so change Signed-off-by: Markus Swarowsky (cherry picked from commit 21098acdec4bbec304a89caf5a969857059139e6) Signed-off-by: Markus Swarowsky (cherry picked from commit 4601e0d8969e62357e3dc478e969b536a2b76803) --- .../nordic_nrf/nrf5340_cpuapp/{preload.cmake => cpuarch.cmake} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/{preload.cmake => cpuarch.cmake} (60%) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/preload.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake similarity index 60% rename from modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/preload.cmake rename to modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake index d9bd226eb65..903b23e4cc6 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/preload.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake @@ -4,4 +4,4 @@ # SPDX-License-Identifier: Apache-2.0 # -include(platform/ext/target/nordic_nrf/common/nrf5340/preload.cmake) +include(platform/ext/target/nordic_nrf/common/nrf5340/cpuarch.cmake) From becddd8298096e6a4c499c02c380af581c5d3f97 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 8 Dec 2023 13:35:11 +0100 Subject: [PATCH 0420/2300] [nrf fromtree] modules: tf-m: nrf9120: Change to cpuarch.cmake The preload.cmake was renamed to cpuarch.cmake in TF-M so change Signed-off-by: Markus Swarowsky (cherry picked from commit 132bfc45b7bfc5baefb02cc3d3c0dc51b7622838) Signed-off-by: Markus Swarowsky (cherry picked from commit f4469995f182b370f202078738beaa9912f67cd3) --- .../nordic_nrf/nrf9120/{preload.cmake => cpuarch.cmake} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename modules/trusted-firmware-m/nordic_nrf/nrf9120/{preload.cmake => cpuarch.cmake} (60%) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/preload.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake similarity index 60% rename from modules/trusted-firmware-m/nordic_nrf/nrf9120/preload.cmake rename to modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake index 4b3c6ee79ab..b34a8ddab1a 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/preload.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake @@ -4,4 +4,4 @@ # SPDX-License-Identifier: Apache-2.0 # -include(platform/ext/target/nordic_nrf/common/nrf9120/preload.cmake) +include(platform/ext/target/nordic_nrf/common/nrf9120/cpuarch.cmake) From 98d15e727b63d98a9d3711365ef67f59fb711746 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 8 Dec 2023 13:35:33 +0100 Subject: [PATCH 0421/2300] [nrf fromtree] modules: tf-m: nrf9160: Change to cpuarch.cmake The preload.cmake was renamed to cpuarch.cmake in TF-M so change Signed-off-by: Markus Swarowsky (cherry picked from commit 78fd53fae796aee3fd6087b0ac6ef86c8284ee6f) Signed-off-by: Markus Swarowsky (cherry picked from commit adf06e7beab0b50fdd665b7dff65e193efd85742) --- .../nordic_nrf/nrf9160/{preload.cmake => cpuarch.cmake} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename modules/trusted-firmware-m/nordic_nrf/nrf9160/{preload.cmake => cpuarch.cmake} (60%) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/preload.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake similarity index 60% rename from modules/trusted-firmware-m/nordic_nrf/nrf9160/preload.cmake rename to modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake index 364480a6f7f..228252f0147 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/preload.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake @@ -4,4 +4,4 @@ # SPDX-License-Identifier: Apache-2.0 # -include(platform/ext/target/nordic_nrf/common/nrf9160/preload.cmake) +include(platform/ext/target/nordic_nrf/common/nrf9160/cpuarch.cmake) From 71edd6a837497042963764244b241650349e688e Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 8 Dec 2023 14:03:30 +0100 Subject: [PATCH 0422/2300] [nrf fromtree] tf-m: Change NS include path for TF-M 2.0.0 The place where TF-M places its non-secure api header files has changed Therefore changing it for for all applications that use it. Signed-off-by: Markus Swarowsky (cherry picked from commit 11175c3ad3111f2bfb92084289f17f24207ed544) Signed-off-by: Markus Swarowsky (cherry picked from commit 60c0c534e1adbcd9b692c41bb6dcfdf85da7197f) --- boards/arm/bl5340_dvk/CMakeLists.txt | 2 +- boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt | 2 +- boards/arm/nrf5340dk_nrf5340/CMakeLists.txt | 2 +- drivers/entropy/CMakeLists.txt | 2 +- modules/uoscore-uedhoc/CMakeLists.txt | 2 +- samples/bluetooth/mesh/CMakeLists.txt | 2 +- samples/bluetooth/mesh_demo/CMakeLists.txt | 2 +- samples/bluetooth/mesh_provisioner/CMakeLists.txt | 2 +- samples/drivers/counter/alarm/CMakeLists.txt | 2 +- samples/subsys/usb/mass/CMakeLists.txt | 2 +- samples/tfm_integration/psa_crypto/CMakeLists.txt | 2 +- .../tfm_integration/psa_protected_storage/CMakeLists.txt | 2 +- samples/tfm_integration/tfm_ipc/CMakeLists.txt | 2 +- samples/tfm_integration/tfm_psa_test/CMakeLists.txt | 2 +- samples/tfm_integration/tfm_secure_partition/CMakeLists.txt | 2 +- soc/arm/nordic_nrf/common/CMakeLists.txt | 2 +- subsys/bluetooth/mesh/CMakeLists.txt | 2 +- subsys/net/lib/tls_credentials/CMakeLists.txt | 6 ++++++ tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt | 2 +- 19 files changed, 24 insertions(+), 18 deletions(-) diff --git a/boards/arm/bl5340_dvk/CMakeLists.txt b/boards/arm/bl5340_dvk/CMakeLists.txt index 541334195dd..863c8bb599e 100644 --- a/boards/arm/bl5340_dvk/CMakeLists.txt +++ b/boards/arm/bl5340_dvk/CMakeLists.txt @@ -9,7 +9,7 @@ zephyr_library_sources(bl5340_dvk_cpunet_reset.c) if (CONFIG_BUILD_WITH_TFM) zephyr_library_include_directories( - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt b/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt index c950fd91724..fa1c1ba14d9 100644 --- a/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt +++ b/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt @@ -8,7 +8,7 @@ if ((CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF5340_AUDIO_ if (CONFIG_BUILD_WITH_TFM) zephyr_library_include_directories( - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/boards/arm/nrf5340dk_nrf5340/CMakeLists.txt b/boards/arm/nrf5340dk_nrf5340/CMakeLists.txt index 8ba3238c40b..5128462d70c 100644 --- a/boards/arm/nrf5340dk_nrf5340/CMakeLists.txt +++ b/boards/arm/nrf5340dk_nrf5340/CMakeLists.txt @@ -8,7 +8,7 @@ zephyr_library_sources(nrf5340_cpunet_reset.c) if (CONFIG_BUILD_WITH_TFM) zephyr_library_include_directories( - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 99184f3b1e5..7ca87d60944 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -28,6 +28,6 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypt if (CONFIG_BUILD_WITH_TFM) target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/modules/uoscore-uedhoc/CMakeLists.txt b/modules/uoscore-uedhoc/CMakeLists.txt index e23ad7da2e6..aaf842e392c 100644 --- a/modules/uoscore-uedhoc/CMakeLists.txt +++ b/modules/uoscore-uedhoc/CMakeLists.txt @@ -29,7 +29,7 @@ if (CONFIG_UOSCORE OR CONFIG_UEDHOC) if (CONFIG_BUILD_WITH_TFM) zephyr_library_include_directories( - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/samples/bluetooth/mesh/CMakeLists.txt b/samples/bluetooth/mesh/CMakeLists.txt index 6ee28b12d48..74734eb84b4 100644 --- a/samples/bluetooth/mesh/CMakeLists.txt +++ b/samples/bluetooth/mesh/CMakeLists.txt @@ -16,6 +16,6 @@ endif() if (CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/samples/bluetooth/mesh_demo/CMakeLists.txt b/samples/bluetooth/mesh_demo/CMakeLists.txt index 07736d6c12e..f5d347ab373 100644 --- a/samples/bluetooth/mesh_demo/CMakeLists.txt +++ b/samples/bluetooth/mesh_demo/CMakeLists.txt @@ -15,6 +15,6 @@ endif() if (CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/samples/bluetooth/mesh_provisioner/CMakeLists.txt b/samples/bluetooth/mesh_provisioner/CMakeLists.txt index 7b22bd0fe14..aefe3628ba8 100644 --- a/samples/bluetooth/mesh_provisioner/CMakeLists.txt +++ b/samples/bluetooth/mesh_provisioner/CMakeLists.txt @@ -10,6 +10,6 @@ target_sources(app PRIVATE src/main.c) if (CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/samples/drivers/counter/alarm/CMakeLists.txt b/samples/drivers/counter/alarm/CMakeLists.txt index eadc9e99e67..747c2b27ebd 100644 --- a/samples/drivers/counter/alarm/CMakeLists.txt +++ b/samples/drivers/counter/alarm/CMakeLists.txt @@ -9,6 +9,6 @@ target_sources(app PRIVATE ${app_sources}) if(CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/samples/subsys/usb/mass/CMakeLists.txt b/samples/subsys/usb/mass/CMakeLists.txt index ef71596104d..2ac19d9b016 100644 --- a/samples/subsys/usb/mass/CMakeLists.txt +++ b/samples/subsys/usb/mass/CMakeLists.txt @@ -15,6 +15,6 @@ target_sources(app PRIVATE ${app_sources}) if(CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/samples/tfm_integration/psa_crypto/CMakeLists.txt b/samples/tfm_integration/psa_crypto/CMakeLists.txt index 17339b470b8..f8ef1eca23f 100644 --- a/samples/tfm_integration/psa_crypto/CMakeLists.txt +++ b/samples/tfm_integration/psa_crypto/CMakeLists.txt @@ -16,7 +16,7 @@ target_sources(app PRIVATE src/util_app_log.c) target_sources(app PRIVATE src/util_sformat.c) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) # In TF-M, default value of CRYPTO_ENGINE_BUF_SIZE is 0x2080. It causes diff --git a/samples/tfm_integration/psa_protected_storage/CMakeLists.txt b/samples/tfm_integration/psa_protected_storage/CMakeLists.txt index bbb8a2041fd..dfb0169eda6 100644 --- a/samples/tfm_integration/psa_protected_storage/CMakeLists.txt +++ b/samples/tfm_integration/psa_protected_storage/CMakeLists.txt @@ -13,5 +13,5 @@ project(protected_storage) target_sources(app PRIVATE src/main.c) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) diff --git a/samples/tfm_integration/tfm_ipc/CMakeLists.txt b/samples/tfm_integration/tfm_ipc/CMakeLists.txt index f11b67af843..896af7bfbda 100644 --- a/samples/tfm_integration/tfm_ipc/CMakeLists.txt +++ b/samples/tfm_integration/tfm_ipc/CMakeLists.txt @@ -9,5 +9,5 @@ project(tfm_ipc) target_sources(app PRIVATE src/main.c) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) diff --git a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt index 9dcbf12ae64..7692ea3dfd1 100644 --- a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt @@ -13,5 +13,5 @@ project(tfm_psa_storage_test) target_sources(app PRIVATE src/main.c) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) diff --git a/samples/tfm_integration/tfm_secure_partition/CMakeLists.txt b/samples/tfm_integration/tfm_secure_partition/CMakeLists.txt index 69901f73928..beadae9230a 100644 --- a/samples/tfm_integration/tfm_secure_partition/CMakeLists.txt +++ b/samples/tfm_integration/tfm_secure_partition/CMakeLists.txt @@ -28,7 +28,7 @@ target_sources(app PRIVATE ) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) target_compile_definitions(app diff --git a/soc/arm/nordic_nrf/common/CMakeLists.txt b/soc/arm/nordic_nrf/common/CMakeLists.txt index c894615a700..ea05f3d369e 100644 --- a/soc/arm/nordic_nrf/common/CMakeLists.txt +++ b/soc/arm/nordic_nrf/common/CMakeLists.txt @@ -11,6 +11,6 @@ set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/li if (CONFIG_TFM_PARTITION_PLATFORM) zephyr_library_sources(soc_secure.c) zephyr_library_include_directories( - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/subsys/bluetooth/mesh/CMakeLists.txt b/subsys/bluetooth/mesh/CMakeLists.txt index 5d4f41ce7f7..c628fb6d9db 100644 --- a/subsys/bluetooth/mesh/CMakeLists.txt +++ b/subsys/bluetooth/mesh/CMakeLists.txt @@ -129,6 +129,6 @@ zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) if (CONFIG_BUILD_WITH_TFM) target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE - $/install/interface/include + $/api_ns/interface/include ) endif() diff --git a/subsys/net/lib/tls_credentials/CMakeLists.txt b/subsys/net/lib/tls_credentials/CMakeLists.txt index 490a558953d..5a80bed58a6 100644 --- a/subsys/net/lib/tls_credentials/CMakeLists.txt +++ b/subsys/net/lib/tls_credentials/CMakeLists.txt @@ -15,3 +15,9 @@ zephyr_library_sources_ifdef(CONFIG_TLS_CREDENTIALS_SHELL ) zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) + +if (CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE AND CONFIG_BUILD_WITH_TFM) + target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE + $/api_ns/interface/include + ) +endif() diff --git a/tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt b/tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt index 93e91deafcb..10ee1786e16 100644 --- a/tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt +++ b/tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt @@ -14,6 +14,6 @@ target_sources(app PRIVATE ${app_sources}) if (CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/install/interface/include + $/api_ns/interface/include ) endif() From d86c7d352fc09a985b251bd195eddde1baf761f5 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 8 Dec 2023 14:12:07 +0100 Subject: [PATCH 0423/2300] [nrf fromtree] modules: tf-m: Remove platform_ns target The platform_ns library is no longer build with the split build anymore so removing it. Signed-off-by: Markus Swarowsky (cherry picked from commit 8b257c058da9249ecce580beed8516b274bf44a0) Signed-off-by: Markus Swarowsky (cherry picked from commit 5691f379873872198379bd516222c7830780cc8f) --- modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt index 41dca2f15a9..d5bc57ac5d9 100644 --- a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt @@ -36,14 +36,6 @@ target_include_directories(platform_s ${board_includes} ) -target_include_directories(platform_ns - PUBLIC - include - include/util - ${partition_includes} - ${board_includes} -) - if(BL2) target_include_directories(platform_bl2 PUBLIC From d5ee84cee2e8c1edab5fe61cedad9e87614e8b90 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 8 Dec 2023 15:16:35 +0100 Subject: [PATCH 0424/2300] [nrf fromtree] modules: Update source, lib and include path for TF-M interface files Update source lib and include path for TF-M interface files. Signed-off-by: Joakim Andersson Signed-off-by: Markus Swarowsky (cherry picked from commit a14f42a817a3b9a412bf1669ae4134054131b210) Signed-off-by: Markus Swarowsky (cherry picked from commit 85025b0c329f2e89b697882ee909d5ce76473d2b) --- boards/arm/b_u585i_iot02a/CMakeLists.txt | 2 +- boards/arm/b_u585i_iot02a/doc/index.rst | 4 +-- boards/arm/nucleo_l552ze_q/CMakeLists.txt | 2 +- .../nucleo_l552ze_q/doc/nucleol552ze_q.rst | 2 +- boards/arm/nucleo_u575zi_q/doc/index.rst | 2 +- boards/arm/nucleo_u5a5zj_q/CMakeLists.txt | 2 +- boards/arm/nucleo_u5a5zj_q/doc/index.rst | 2 +- boards/arm/stm32l562e_dk/CMakeLists.txt | 2 +- boards/arm/stm32l562e_dk/doc/index.rst | 2 +- modules/trusted-firmware-m/CMakeLists.txt | 25 ++++++++----------- 10 files changed, 21 insertions(+), 24 deletions(-) diff --git a/boards/arm/b_u585i_iot02a/CMakeLists.txt b/boards/arm/b_u585i_iot02a/CMakeLists.txt index dde73804665..f6ca91f1a73 100644 --- a/boards/arm/b_u585i_iot02a/CMakeLists.txt +++ b/boards/arm/b_u585i_iot02a/CMakeLists.txt @@ -10,6 +10,6 @@ endif() if(CONFIG_BUILD_WITH_TFM) set_property(GLOBAL APPEND PROPERTY extra_post_build_commands #Execute post build script postbuild.sh - COMMAND $/postbuild.sh ${COMPILER_FULL_PATH} + COMMAND $/api_ns/postbuild.sh ${COMPILER_FULL_PATH} ) endif() diff --git a/boards/arm/b_u585i_iot02a/doc/index.rst b/boards/arm/b_u585i_iot02a/doc/index.rst index 3c794b4de79..5512a95f16d 100644 --- a/boards/arm/b_u585i_iot02a/doc/index.rst +++ b/boards/arm/b_u585i_iot02a/doc/index.rst @@ -346,14 +346,14 @@ can be generated using ``b_u585i_iot02a_ns`` as build target. $ west build -b b_u585i_iot02a_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. .. code-block:: bash - $ build/tfm/regression.sh + $ build/tfm/api_ns/regression.sh Finally, to flash the board, run: diff --git a/boards/arm/nucleo_l552ze_q/CMakeLists.txt b/boards/arm/nucleo_l552ze_q/CMakeLists.txt index d170d283e99..260ecca2707 100644 --- a/boards/arm/nucleo_l552ze_q/CMakeLists.txt +++ b/boards/arm/nucleo_l552ze_q/CMakeLists.txt @@ -10,6 +10,6 @@ endif() if (CONFIG_BUILD_WITH_TFM) set_property(GLOBAL APPEND PROPERTY extra_post_build_commands #Execute post build script postbuild.sh - COMMAND $/postbuild.sh ${COMPILER_FULL_PATH} + COMMAND $/api_ns/postbuild.sh ${COMPILER_FULL_PATH} ) endif() diff --git a/boards/arm/nucleo_l552ze_q/doc/nucleol552ze_q.rst b/boards/arm/nucleo_l552ze_q/doc/nucleol552ze_q.rst index 51675477af4..fbf77de1c44 100644 --- a/boards/arm/nucleo_l552ze_q/doc/nucleol552ze_q.rst +++ b/boards/arm/nucleo_l552ze_q/doc/nucleol552ze_q.rst @@ -338,7 +338,7 @@ can be generated using ``nucleo_l552ze_q_ns`` as build target. $ west build -b nucleo_l552ze_q_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. diff --git a/boards/arm/nucleo_u575zi_q/doc/index.rst b/boards/arm/nucleo_u575zi_q/doc/index.rst index 0de2c364ecf..e7035dd497a 100644 --- a/boards/arm/nucleo_u575zi_q/doc/index.rst +++ b/boards/arm/nucleo_u575zi_q/doc/index.rst @@ -308,7 +308,7 @@ can be generated using ``nucleo_u575zi_q_ns`` as build target. $ west build -b nucleo_u575zi_q_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. diff --git a/boards/arm/nucleo_u5a5zj_q/CMakeLists.txt b/boards/arm/nucleo_u5a5zj_q/CMakeLists.txt index c79a4b7b4e7..7c2da293e20 100644 --- a/boards/arm/nucleo_u5a5zj_q/CMakeLists.txt +++ b/boards/arm/nucleo_u5a5zj_q/CMakeLists.txt @@ -9,6 +9,6 @@ endif() if(CONFIG_BUILD_WITH_TFM) set_property(GLOBAL APPEND PROPERTY extra_post_build_commands #Execute post build script postbuild.sh - COMMAND $/postbuild.sh ${COMPILER_FULL_PATH} + COMMAND $/api_ns/postbuild.sh ${COMPILER_FULL_PATH} ) endif() diff --git a/boards/arm/nucleo_u5a5zj_q/doc/index.rst b/boards/arm/nucleo_u5a5zj_q/doc/index.rst index f877be5c168..154dbd32579 100644 --- a/boards/arm/nucleo_u5a5zj_q/doc/index.rst +++ b/boards/arm/nucleo_u5a5zj_q/doc/index.rst @@ -342,7 +342,7 @@ can be generated using ``nucleo_u5a5zj_q_ns`` as build target. $ west build -b nucleo_u5a5zj_q_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. diff --git a/boards/arm/stm32l562e_dk/CMakeLists.txt b/boards/arm/stm32l562e_dk/CMakeLists.txt index dde73804665..f6ca91f1a73 100644 --- a/boards/arm/stm32l562e_dk/CMakeLists.txt +++ b/boards/arm/stm32l562e_dk/CMakeLists.txt @@ -10,6 +10,6 @@ endif() if(CONFIG_BUILD_WITH_TFM) set_property(GLOBAL APPEND PROPERTY extra_post_build_commands #Execute post build script postbuild.sh - COMMAND $/postbuild.sh ${COMPILER_FULL_PATH} + COMMAND $/api_ns/postbuild.sh ${COMPILER_FULL_PATH} ) endif() diff --git a/boards/arm/stm32l562e_dk/doc/index.rst b/boards/arm/stm32l562e_dk/doc/index.rst index 5a4f5845617..0eb2aa7630c 100644 --- a/boards/arm/stm32l562e_dk/doc/index.rst +++ b/boards/arm/stm32l562e_dk/doc/index.rst @@ -340,7 +340,7 @@ can be generated using ``stm32l562e_dk_ns`` as build target. $ west build -b stm32l562e_dk_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index ad1109d849b..8cc546883d0 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -181,11 +181,12 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_TEST_REPO_PATH ${ZEPHYR_CURRENT_MODULE_DIR}/../tf-m-tests) set(PSA_ARCH_TESTS_PATH ${ZEPHYR_CURRENT_MODULE_DIR}/../psa-arch-tests) - set(VENEERS_FILE ${TFM_BINARY_DIR}/secure_fw/s_veneers.o) + set(TFM_INTERFACE_SOURCE_DIR ${TFM_BINARY_DIR}/api_ns/interface/src) + set(TFM_INTERFACE_INCLUDE_DIR ${TFM_BINARY_DIR}/api_ns/interface/include) + set(TFM_INTERFACE_LIB_DIR ${TFM_BINARY_DIR}/api_ns/interface/lib) + set(TFM_API_NS_PATH ${TFM_BINARY_DIR}/tf-m-tests/app/libtfm_api_ns.a) set(PLATFORM_NS_FILE ${TFM_BINARY_DIR}/platform/ns/libplatform_ns.a) - set(TFM_GENERATED_INCLUDES ${TFM_BINARY_DIR}/generated/interface/include) - set(TFM_INTERFACE_SOURCE_DIR ${TFM_BINARY_DIR}/install/interface/src) if (TFM_PSA_TEST_SUITE) set(PSA_TEST_VAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/val/val_nspe.a) @@ -213,9 +214,7 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_S_NS_SIGNED_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_s_ns_signed.bin) set(BUILD_BYPRODUCTS - ${VENEERS_FILE} ${TFM_API_NS_PATH} - ${TFM_GENERATED_INCLUDES}/psa_manifest/sid.h ${PSA_TEST_VAL_FILE} ${PSA_TEST_PAL_FILE} ${PSA_TEST_COMBINE_FILE} @@ -232,13 +231,15 @@ if (CONFIG_BUILD_WITH_TFM) ${TFM_NS_SIGNED_BIN_FILE} ${TFM_S_NS_SIGNED_BIN_FILE} + ${TFM_INTERFACE_LIB_DIR}/s_veneers.o + ${TFM_INTERFACE_SOURCE_DIR}/tfm_attest_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_crypto_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_fwu_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_its_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_platform_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_ps_api.c - ${TFM_INTERFACE_SOURCE_DIR}/tfm_psa_ns_api.c + ${TFM_INTERFACE_SOURCE_DIR}/tfm_tz_psa_ns_api.c # Specific to nordic_nrf platform ${TFM_INTERFACE_SOURCE_DIR}/tfm_ioctl_core_ns_api.c @@ -433,7 +434,7 @@ if (CONFIG_BUILD_WITH_TFM) zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INITIAL_ATTESTATION ${TFM_INTERFACE_SOURCE_DIR}/tfm_attest_api.c) zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_FIRMWARE_UPDATE ${TFM_INTERFACE_SOURCE_DIR}/tfm_fwu_api.c) - zephyr_library_sources(${TFM_INTERFACE_SOURCE_DIR}/tfm_psa_ns_api.c) + zephyr_library_sources(${TFM_INTERFACE_SOURCE_DIR}/tfm_tz_psa_ns_api.c) if(CONFIG_SOC_FAMILY_NRF) zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_ioctl_core_ns_api.c) @@ -446,17 +447,13 @@ if (CONFIG_BUILD_WITH_TFM) ) endif() - zephyr_include_directories( - ${TFM_GENERATED_INCLUDES} - ) - target_include_directories(tfm_api PRIVATE - ${TFM_BINARY_DIR}/install/interface/include - ${TFM_BINARY_DIR}/install/interface/include/crypto_keys + ${TFM_INTERFACE_INCLUDE_DIR} + ${TFM_INTERFACE_INCLUDE_DIR}/crypto_keys ) zephyr_library_link_libraries( - ${VENEERS_FILE} + ${TFM_INTERFACE_LIB_DIR}/s_veneers.o ) # To ensure that generated include files are created before they are used. From 2206bbd3ff665e51caaceef002a779fa8ea39998 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 8 Dec 2023 15:17:10 +0100 Subject: [PATCH 0425/2300] [nrf fromtree] tfm: Use PSA error codes instead of TFM error codes The TFM error codes are no longer in the interface headers. All TF-M functions return PSA status codes, so use this here as well. Signed-off-by: Joakim Andersson Signed-off-by: Markus Swarowsky (cherry picked from commit d931dded119f3fcbc7352ca0b580e3fdfd1fe296) Signed-off-by: Markus Swarowsky (cherry picked from commit d4c928c9061b52f36d2b6314d7970e7e8edc26c5) --- modules/trusted-firmware-m/interface/interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/trusted-firmware-m/interface/interface.c b/modules/trusted-firmware-m/interface/interface.c index ad0ed1abdfe..d949a9dc027 100644 --- a/modules/trusted-firmware-m/interface/interface.c +++ b/modules/trusted-firmware-m/interface/interface.c @@ -35,7 +35,7 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn, if (!is_pre_kernel) { /* TF-M request protected by NS lock */ if (k_mutex_lock(&tfm_mutex, K_FOREVER) != 0) { - return (int32_t)TFM_ERROR_GENERIC; + return (int32_t)PSA_ERROR_GENERIC_ERROR; } #if !defined(CONFIG_ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS) @@ -79,7 +79,7 @@ uint32_t tfm_ns_interface_init(void) * The static K_MUTEX_DEFINE handles mutex initialization, * so this function may be implemented as no-op. */ - return TFM_SUCCESS; + return PSA_SUCCESS; } @@ -90,7 +90,7 @@ uint32_t tfm_ns_interface_init(void) static int ns_interface_init(void) { - __ASSERT(tfm_ns_interface_init() == TFM_SUCCESS, + __ASSERT(tfm_ns_interface_init() == PSA_SUCCESS, "TF-M NS interface init failed"); return 0; From 65ac0c2cf0d221ec2dae01e3e73bd3510a217099 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 8 Dec 2023 15:18:21 +0100 Subject: [PATCH 0426/2300] [nrf fromtree] tfm: nordic_nrf: Remove include of tfm_api.h, update install path Update install path of tfm_ioctl_api.h, remove include of tfm_api.h Signed-off-by: Joakim Andersson Signed-off-by: Markus Swarowsky (cherry picked from commit f5eecd500d46a62a32f360bc42d082bd8cd7640c) Signed-off-by: Markus Swarowsky (cherry picked from commit b139d4fea0a9f325ef2e1891f016a824aed9c58f) --- modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt | 2 +- modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h | 1 - samples/tfm_integration/tfm_ipc/src/main.c | 1 - .../tfm_secure_partition/dummy_partition/dummy_partition.c | 1 - .../tfm_integration/tfm_secure_partition/src/dummy_partition.h | 2 -- 5 files changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt index d5bc57ac5d9..39aa2199b47 100644 --- a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt @@ -48,7 +48,7 @@ endif() if (TFM_PARTITION_PLATFORM) install(FILES include/tfm_ioctl_api.h - DESTINATION ${TFM_INSTALL_PATH}/interface/include) + DESTINATION ${INSTALL_INTERFACE_INC_DIR}) endif() #========================= tfm_spm ============================================# diff --git a/modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h b/modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h index c6c36ee927f..3fade10525a 100644 --- a/modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h +++ b/modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h @@ -9,7 +9,6 @@ #include #include -#include #include /* Include core IOCTL services */ diff --git a/samples/tfm_integration/tfm_ipc/src/main.c b/samples/tfm_integration/tfm_ipc/src/main.c index 7179705cbe3..133c7203b0e 100644 --- a/samples/tfm_integration/tfm_ipc/src/main.c +++ b/samples/tfm_integration/tfm_ipc/src/main.c @@ -7,7 +7,6 @@ #include #include -#include "tfm_api.h" #include "tfm_ns_interface.h" #ifdef TFM_PSA_API #include "psa_manifest/sid.h" diff --git a/samples/tfm_integration/tfm_secure_partition/dummy_partition/dummy_partition.c b/samples/tfm_integration/tfm_secure_partition/dummy_partition/dummy_partition.c index 6519723058c..d618868ddbf 100644 --- a/samples/tfm_integration/tfm_secure_partition/dummy_partition/dummy_partition.c +++ b/samples/tfm_integration/tfm_secure_partition/dummy_partition/dummy_partition.c @@ -7,7 +7,6 @@ #include #include #include -#include "tfm_api.h" #include "psa/service.h" #include "psa_manifest/tfm_dummy_partition.h" diff --git a/samples/tfm_integration/tfm_secure_partition/src/dummy_partition.h b/samples/tfm_integration/tfm_secure_partition/src/dummy_partition.h index b31ce897d27..7ca52b3c5c4 100644 --- a/samples/tfm_integration/tfm_secure_partition/src/dummy_partition.h +++ b/samples/tfm_integration/tfm_secure_partition/src/dummy_partition.h @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "tfm_api.h" - psa_status_t dp_secret_digest(uint32_t secret_index, void *p_digest, size_t digest_size); From 2b3fd1b23c501c88de7d5d6ac83d8ab5df2dada6 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 11 Dec 2023 13:33:35 +0100 Subject: [PATCH 0427/2300] [nrf fromtree] modules: mbedtls: Rename of psa_crypto_driver_wrappers psa_crypto_driver_wrappers.c got changed to psa_crypto_driver_wrappers_no_static.c Signed-off-by: Markus Swarowsky (cherry picked from commit fbee1c61ed3f927c04a939f8a1ff9662c98f3c6c) Signed-off-by: Markus Swarowsky (cherry picked from commit da6042c528658181550370e5c375338b43fe44aa) --- modules/mbedtls/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 74cd4853b8d..2bab7fe1038 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -111,7 +111,7 @@ zephyr_interface_library_named(mbedTLS) list(APPEND crypto_source ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_aead.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_cipher.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_driver_wrappers.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_driver_wrappers_no_static.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_ecp.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_hash.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_mac.c From 7b5026086ab20eddc6841571eed779cb29ff404c Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 11 Dec 2023 17:27:32 +0100 Subject: [PATCH 0428/2300] [nrf fromtree] modules: mbedtls: Add a mbedtls_ms_time implementation MbedTLS 3.5.0 requires a implementation of mbedtls_ms_time giving a time in ms for TLS 1.3 Therefor adding an alternative implementation using zephyrs k_uptime_get Signed-off-by: Markus Swarowsky (cherry picked from commit dc7613865dc52b33d56a898ee27d8b0423ada6f0) Signed-off-by: Markus Swarowsky (cherry picked from commit 175564c0f3a79efef10b9ceb78ecb66d432bdb2c) --- modules/mbedtls/configs/config-mini-tls1_1.h | 1 + modules/mbedtls/configs/config-no-entropy.h | 1 + modules/mbedtls/configs/config-suite-b.h | 1 + modules/mbedtls/configs/config-tls-generic.h | 1 + modules/mbedtls/zephyr_init.c | 8 ++++++++ tests/subsys/jwt/src/tls_config/user-tls-conf.h | 1 + 6 files changed, 13 insertions(+) diff --git a/modules/mbedtls/configs/config-mini-tls1_1.h b/modules/mbedtls/configs/config-mini-tls1_1.h index 2bce8647caf..da8bf795c1d 100644 --- a/modules/mbedtls/configs/config-mini-tls1_1.h +++ b/modules/mbedtls/configs/config-mini-tls1_1.h @@ -59,6 +59,7 @@ /* System support */ #define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_TIME +#define MBEDTLS_PLATFORM_MS_TIME_ALT /* mbed TLS feature support */ #define MBEDTLS_CIPHER_MODE_CBC diff --git a/modules/mbedtls/configs/config-no-entropy.h b/modules/mbedtls/configs/config-no-entropy.h index b5295bf1fb7..b3406a394b4 100644 --- a/modules/mbedtls/configs/config-no-entropy.h +++ b/modules/mbedtls/configs/config-no-entropy.h @@ -62,6 +62,7 @@ /* System support */ #define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_TIME +#define MBEDTLS_PLATFORM_MS_TIME_ALT /* mbed TLS feature support */ #define MBEDTLS_CIPHER_MODE_CBC diff --git a/modules/mbedtls/configs/config-suite-b.h b/modules/mbedtls/configs/config-suite-b.h index 6f2cc963bd1..7468f763358 100644 --- a/modules/mbedtls/configs/config-suite-b.h +++ b/modules/mbedtls/configs/config-suite-b.h @@ -66,6 +66,7 @@ /* System support */ #define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_TIME +#define MBEDTLS_PLATFORM_MS_TIME_ALT /* mbed TLS feature support */ #define MBEDTLS_ECP_DP_SECP256R1_ENABLED diff --git a/modules/mbedtls/configs/config-tls-generic.h b/modules/mbedtls/configs/config-tls-generic.h index 7cf85731c85..2d1b53c54fd 100644 --- a/modules/mbedtls/configs/config-tls-generic.h +++ b/modules/mbedtls/configs/config-tls-generic.h @@ -37,6 +37,7 @@ #if defined(CONFIG_MBEDTLS_HAVE_TIME_DATE) #define MBEDTLS_HAVE_TIME #define MBEDTLS_HAVE_TIME_DATE +#define MBEDTLS_PLATFORM_MS_TIME_ALT #endif #if defined(CONFIG_MBEDTLS_TEST) diff --git a/modules/mbedtls/zephyr_init.c b/modules/mbedtls/zephyr_init.c index d882b0aedb8..28a6a40fdc5 100644 --- a/modules/mbedtls/zephyr_init.c +++ b/modules/mbedtls/zephyr_init.c @@ -15,6 +15,8 @@ #include #include #include +#include + #include @@ -107,3 +109,9 @@ int mbedtls_init(void) { return _mbedtls_init(); } + +/* TLS 1.3 ticket lifetime needs a timing interface */ +mbedtls_ms_time_t mbedtls_ms_time(void) +{ + return (mbedtls_ms_time_t)k_uptime_get(); +} diff --git a/tests/subsys/jwt/src/tls_config/user-tls-conf.h b/tests/subsys/jwt/src/tls_config/user-tls-conf.h index 035f2b062ec..0d95ee80ac0 100644 --- a/tests/subsys/jwt/src/tls_config/user-tls-conf.h +++ b/tests/subsys/jwt/src/tls_config/user-tls-conf.h @@ -3,3 +3,4 @@ #define MBEDTLS_HAVE_TIME #define MBEDTLS_HAVE_TIME_DATE #define MBEDTLS_PLATFORM_TIME_ALT +#define MBEDTLS_PLATFORM_MS_TIME_ALT From 164d0097036e585e2915c591e502f50f9af9c3e2 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Mon, 11 Dec 2023 21:52:07 +0100 Subject: [PATCH 0429/2300] [nrf fromtree] modules: mbedtls: Use TF-M PSA API headers Use TF-M PSA API headers when compiling with TF-M enabled. Fixes: #43249 Signed-off-by: Joakim Andersson Signed-off-by: Markus Swarowsky (cherry picked from commit 3398c987439eb06a8dcb8f27adc5d010dca2604c) Signed-off-by: Markus Swarowsky (cherry picked from commit a8400a927fc44e50cb9e8f9c5bdf0bc0d4f78a48) --- modules/mbedtls/CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 2bab7fe1038..929ea17ecea 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -16,6 +16,12 @@ zephyr_interface_library_named(mbedTLS) MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}" ) + if (CONFIG_BUILD_WITH_TFM) + target_include_directories(mbedTLS INTERFACE + $/api_ns/interface/include + ) + endif() + # Add regular includes target_include_directories(mbedTLS INTERFACE ${ZEPHYR_CURRENT_MODULE_DIR}/include @@ -107,7 +113,7 @@ zephyr_interface_library_named(mbedTLS) zephyr_library_named(mbedTLSCrypto) - if (CONFIG_MBEDTLS_PSA_CRYPTO_C) + if (CONFIG_MBEDTLS_PSA_CRYPTO_C AND NOT CONFIG_BUILD_WITH_TFM) list(APPEND crypto_source ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_aead.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_cipher.c @@ -119,11 +125,6 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_se.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_storage.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_its_file.c - ) - endif() - - if (NOT CONFIG_BUILD_WITH_TFM) - list(APPEND crypto_source ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_client.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_slot_management.c From da4a15ae8e6cff0844ca7a89227c836ed4bcc09d Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Wed, 13 Dec 2023 16:31:32 +0100 Subject: [PATCH 0430/2300] [nrf fromtree] sample: tfm_secure_partition: Change tfm_partition_defs to tfm_config The target tfm_partition_defs got removed and tfm_config gets used now so updating it Signed-off-by: Markus Swarowsky (cherry picked from commit e8eeecddcf7d7b442106b92087696d837a2aa619) Signed-off-by: Markus Swarowsky (cherry picked from commit 2bb1039e58d0cf817a00ac7736bb3ce0b2c9c843) --- .../tfm_secure_partition/dummy_partition/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/tfm_integration/tfm_secure_partition/dummy_partition/CMakeLists.txt b/samples/tfm_integration/tfm_secure_partition/dummy_partition/CMakeLists.txt index 0e335a73028..013332ccb1a 100644 --- a/samples/tfm_integration/tfm_secure_partition/dummy_partition/CMakeLists.txt +++ b/samples/tfm_integration/tfm_secure_partition/dummy_partition/CMakeLists.txt @@ -50,7 +50,7 @@ target_link_libraries(tfm_partitions tfm_app_rot_partition_dp ) -target_compile_definitions(tfm_partition_defs +target_compile_definitions(tfm_config INTERFACE TFM_PARTITION_DUMMY_PARTITION ) From fe824020252f125b473d48bfe1912add573ce286 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 14 Dec 2023 12:47:13 +0100 Subject: [PATCH 0431/2300] [nrf fromtree] tfm: Add NS build support for zephyr out-of-tree nordic_nrf platform. Add build of the NS application in the zephyr defined out-of-tree board support for the nordic_nrf platform. Signed-off-by: Joakim Andersson Signed-off-by: Markus Swarowsky (cherry picked from commit 6c927490d0fc0ebc488e09c84b01ef7f924e1827) Signed-off-by: Markus Swarowsky (cherry picked from commit 856a6108754e29b7fef672ab9cf6cfadb185571d) --- .../nordic_nrf/CMakeLists.txt | 16 ++++--- .../nordic_nrf/nrf5340_cpuapp/CMakeLists.txt | 8 +++- .../nordic_nrf/nrf5340_cpuapp/config.cmake | 3 +- .../nordic_nrf/nrf5340_cpuapp/cpuarch.cmake | 4 +- .../nrf5340_cpuapp/ns/cpuarch_ns.cmake | 10 ++++ .../nordic_nrf/nrf9120/CMakeLists.txt | 11 ++++- .../nordic_nrf/nrf9120/config.cmake | 3 +- .../nordic_nrf/nrf9120/cpuarch.cmake | 3 +- .../nordic_nrf/nrf9120/ns/cpuarch_ns.cmake | 10 ++++ .../nordic_nrf/nrf9160/CMakeLists.txt | 11 ++++- .../nordic_nrf/nrf9160/config.cmake | 3 +- .../nordic_nrf/nrf9160/cpuarch.cmake | 4 +- .../nordic_nrf/nrf9160/ns/cpuarch_ns.cmake | 10 ++++ .../nordic_nrf/ns/CMakeLists.txt | 46 +++++++++++++++++++ 14 files changed, 127 insertions(+), 15 deletions(-) create mode 100644 modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/ns/cpuarch_ns.cmake create mode 100644 modules/trusted-firmware-m/nordic_nrf/nrf9120/ns/cpuarch_ns.cmake create mode 100644 modules/trusted-firmware-m/nordic_nrf/nrf9160/ns/cpuarch_ns.cmake create mode 100644 modules/trusted-firmware-m/nordic_nrf/ns/CMakeLists.txt diff --git a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt index 39aa2199b47..d75b34a8109 100644 --- a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt @@ -46,14 +46,18 @@ if(BL2) ) endif() +target_sources(tfm_spm + PRIVATE + src/tfm_hal_platform.c +) + if (TFM_PARTITION_PLATFORM) install(FILES include/tfm_ioctl_api.h + include/device_cfg.h + include/RTE_Device.h + include/tfm_ioctl_api.h DESTINATION ${INSTALL_INTERFACE_INC_DIR}) endif() -#========================= tfm_spm ============================================# - -target_sources(tfm_spm - PRIVATE - src/tfm_hal_platform.c -) +install(FILES ns/CMakeLists.txt + DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt index 279ea385996..35338d542d7 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt @@ -5,8 +5,14 @@ # set(NRF_BOARD_SELECTED True) -set(NRF_SOC_VARIANT nrf5340) add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf5340 nrf5340) add_subdirectory(.. common) + +install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR} + RENAME cpuarch.cmake) + +install(FILES config.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/config.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/config.cmake index b3e5d74181c..ae50a4846dd 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/config.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/config.cmake @@ -4,5 +4,6 @@ # SPDX-License-Identifier: Apache-2.0 # -set(PLATFORM_PATH platform/ext/target/nordic_nrf/) +set(NRF_SOC_VARIANT nrf5340 CACHE STRING "nRF SoC Variant") + include(${PLATFORM_PATH}/common/nrf5340/config.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake index 903b23e4cc6..f19d7f43c67 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake @@ -4,4 +4,6 @@ # SPDX-License-Identifier: Apache-2.0 # -include(platform/ext/target/nordic_nrf/common/nrf5340/cpuarch.cmake) +set(PLATFORM_PATH platform/ext/target/nordic_nrf) + +include(${PLATFORM_PATH}/common/nrf5340/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/ns/cpuarch_ns.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/ns/cpuarch_ns.cmake new file mode 100644 index 00000000000..077e88bd37b --- /dev/null +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/ns/cpuarch_ns.cmake @@ -0,0 +1,10 @@ +# +# Copyright (c) 2023, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) +set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/common/nrf5340/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt index a84c6fd9fd5..fe2c161200d 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt @@ -5,8 +5,17 @@ # set(NRF_BOARD_SELECTED True) -set(NRF_SOC_VARIANT nrf91) add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf91 nrf91) add_subdirectory(.. common) + +install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR} + RENAME cpuarch.cmake) + +install(FILES ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf9120/cpuarch.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR}/common/nrf9120) + +install(FILES config.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/config.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9120/config.cmake index 3f58e7b89eb..e858eda3a27 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/config.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/config.cmake @@ -4,5 +4,6 @@ # SPDX-License-Identifier: Apache-2.0 # -set(PLATFORM_PATH platform/ext/target/nordic_nrf/) +set(NRF_SOC_VARIANT nrf91 CACHE STRING "nRF SoC Variant") + include(${PLATFORM_PATH}/common/nrf91/config.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake index b34a8ddab1a..9f0886c7a51 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake @@ -3,5 +3,6 @@ # # SPDX-License-Identifier: Apache-2.0 # +set(PLATFORM_PATH platform/ext/target/nordic_nrf) -include(platform/ext/target/nordic_nrf/common/nrf9120/cpuarch.cmake) +include(${PLATFORM_PATH}/common/nrf9120/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/ns/cpuarch_ns.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9120/ns/cpuarch_ns.cmake new file mode 100644 index 00000000000..c53d684d7e8 --- /dev/null +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/ns/cpuarch_ns.cmake @@ -0,0 +1,10 @@ +# +# Copyright (c) 2023, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) +set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/common/nrf9120/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt index a84c6fd9fd5..ba840c6c8d1 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt @@ -5,8 +5,17 @@ # set(NRF_BOARD_SELECTED True) -set(NRF_SOC_VARIANT nrf91) add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf91 nrf91) add_subdirectory(.. common) + +install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR} + RENAME cpuarch.cmake) + +install(FILES ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf9160/cpuarch.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR}/common/nrf9160) + +install(FILES config.cmake + DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/config.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9160/config.cmake index 3f58e7b89eb..e858eda3a27 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/config.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/config.cmake @@ -4,5 +4,6 @@ # SPDX-License-Identifier: Apache-2.0 # -set(PLATFORM_PATH platform/ext/target/nordic_nrf/) +set(NRF_SOC_VARIANT nrf91 CACHE STRING "nRF SoC Variant") + include(${PLATFORM_PATH}/common/nrf91/config.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake index 228252f0147..f728014d3f7 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake @@ -4,4 +4,6 @@ # SPDX-License-Identifier: Apache-2.0 # -include(platform/ext/target/nordic_nrf/common/nrf9160/cpuarch.cmake) +set(PLATFORM_PATH platform/ext/target/nordic_nrf) + +include(${PLATFORM_PATH}/common/nrf9160/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/ns/cpuarch_ns.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9160/ns/cpuarch_ns.cmake new file mode 100644 index 00000000000..902e7fe7ef4 --- /dev/null +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/ns/cpuarch_ns.cmake @@ -0,0 +1,10 @@ +# +# Copyright (c) 2023, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) +set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/common/nrf9160/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/ns/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/ns/CMakeLists.txt new file mode 100644 index 00000000000..5bb8cb5bd94 --- /dev/null +++ b/modules/trusted-firmware-m/nordic_nrf/ns/CMakeLists.txt @@ -0,0 +1,46 @@ +# +# Copyright (c) 2023, Nordic Semiconductor ASA. +# +# SPDX-License-Identifier: Apache-2.0 +# + +cmake_policy(SET CMP0076 NEW) +set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) +set(NRF_BOARD_SELECTED True) + +add_library(platform_ns STATIC) + +set(partition_includes + ${CMAKE_CURRENT_LIST_DIR}/common/${NRF_SOC_VARIANT}/partition + ${CMAKE_BINARY_DIR}/../zephyr/include/generated +) + +set(board_includes + ${CMAKE_BINARY_DIR}/../zephyr/misc/generated/syscalls_links/include + ${ZEPHYR_BASE}/include +) + +target_include_directories(platform_region_defs + INTERFACE + ${partition_includes} +) + +target_include_directories(platform_ns + PUBLIC + ${partition_includes} + ${board_includes} +) + +# Get the value of HAL_NORDIC_PATH +include(${CMAKE_CURRENT_LIST_DIR}/common/core/config_nordic_nrf_spe.cmake) +add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common/${NRF_SOC_VARIANT} ${NRF_SOC_VARIANT}) + +target_include_directories(platform_ns + PUBLIC + ${CMAKE_CURRENT_LIST_DIR} +) + +target_link_libraries(platform_ns + PUBLIC + platform_region_defs +) From 7d8018a4e804dc3ae700e8a7bdfff55b44fe3420 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 14 Dec 2023 11:05:49 +0100 Subject: [PATCH 0432/2300] [nrf fromtree] tfm: Remove TFM_BUILD_NS and update TFM_USE_NS_APP for NS build folder TF-M no longer builds the NS app, but exports build files to api_ns folder and expects the user to build the rest themselves. Remove the option to build the NS app, and update the TFM_USE_NS_APP to look for an output hex file in the tfm_ns folder. Signed-off-by: Joakim Andersson Signed-off-by: Markus Swarowsky (cherry picked from commit f49cbf13ca8ff389bcf857eba542b2bb250a8545) Signed-off-by: Markus Swarowsky (cherry picked from commit 665488340d1e3b3201d62a413be1d1e583bdd94c) --- modules/trusted-firmware-m/CMakeLists.txt | 41 +++++-------------- modules/trusted-firmware-m/Kconfig.tfm | 11 ----- samples/tfm_integration/tfm_psa_test/prj.conf | 1 - .../tfm_regression_test/prj.conf | 1 - 4 files changed, 10 insertions(+), 44 deletions(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 8cc546883d0..26109bef223 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -51,11 +51,6 @@ if (CONFIG_BUILD_WITH_TFM) else() list(APPEND TFM_CMAKE_ARGS -DBL2=FALSE) endif() - if (CONFIG_TFM_BUILD_NS) - list(APPEND TFM_CMAKE_ARGS -DNS=TRUE) - else() - list(APPEND TFM_CMAKE_ARGS -DNS=FALSE) - endif() if (CONFIG_TFM_ISOLATION_LEVEL) list(APPEND TFM_CMAKE_ARGS -DTFM_ISOLATION_LEVEL=${CONFIG_TFM_ISOLATION_LEVEL}) endif() @@ -185,9 +180,6 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_INTERFACE_INCLUDE_DIR ${TFM_BINARY_DIR}/api_ns/interface/include) set(TFM_INTERFACE_LIB_DIR ${TFM_BINARY_DIR}/api_ns/interface/lib) - set(TFM_API_NS_PATH ${TFM_BINARY_DIR}/tf-m-tests/app/libtfm_api_ns.a) - set(PLATFORM_NS_FILE ${TFM_BINARY_DIR}/platform/ns/libplatform_ns.a) - if (TFM_PSA_TEST_SUITE) set(PSA_TEST_VAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/val/val_nspe.a) set(PSA_TEST_PAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/platform/pal_nspe.a) @@ -208,27 +200,22 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_S_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_s.bin) set(TFM_S_HEX_FILE ${TFM_BINARY_DIR}/bin/tfm_s.hex) set(TFM_NS_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_ns.bin) - set(TFM_NS_HEX_FILE ${TFM_BINARY_DIR}/bin/tfm_ns.hex) + set(TFM_NS_HEX_FILE ${CMAKE_BINARY_DIR}/tfm_ns/bin/tfm_ns.hex) set(TFM_S_SIGNED_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_s_signed.bin) set(TFM_NS_SIGNED_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_ns_signed.bin) set(TFM_S_NS_SIGNED_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_s_ns_signed.bin) set(BUILD_BYPRODUCTS - ${TFM_API_NS_PATH} ${PSA_TEST_VAL_FILE} ${PSA_TEST_PAL_FILE} ${PSA_TEST_COMBINE_FILE} - ${PLATFORM_NS_FILE} ${BL2_ELF_FILE} ${BL2_BIN_FILE} ${BL2_HEX_FILE} ${TFM_S_ELF_FILE} ${TFM_S_BIN_FILE} ${TFM_S_HEX_FILE} - ${TFM_NS_BIN_FILE} - ${TFM_NS_HEX_FILE} ${TFM_S_SIGNED_BIN_FILE} - ${TFM_NS_SIGNED_BIN_FILE} ${TFM_S_NS_SIGNED_BIN_FILE} ${TFM_INTERFACE_LIB_DIR}/s_veneers.o @@ -426,25 +413,17 @@ if (CONFIG_BUILD_WITH_TFM) ) endif() - if(NOT CONFIG_TFM_BUILD_NS) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_platform_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PROTECTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_ps_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_its_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_CRYPTO ${TFM_INTERFACE_SOURCE_DIR}/tfm_crypto_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INITIAL_ATTESTATION ${TFM_INTERFACE_SOURCE_DIR}/tfm_attest_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_FIRMWARE_UPDATE ${TFM_INTERFACE_SOURCE_DIR}/tfm_fwu_api.c) - - zephyr_library_sources(${TFM_INTERFACE_SOURCE_DIR}/tfm_tz_psa_ns_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_platform_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PROTECTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_ps_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_its_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_CRYPTO ${TFM_INTERFACE_SOURCE_DIR}/tfm_crypto_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INITIAL_ATTESTATION ${TFM_INTERFACE_SOURCE_DIR}/tfm_attest_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_FIRMWARE_UPDATE ${TFM_INTERFACE_SOURCE_DIR}/tfm_fwu_api.c) - if(CONFIG_SOC_FAMILY_NRF) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_ioctl_core_ns_api.c) - endif() + zephyr_library_sources(${TFM_INTERFACE_SOURCE_DIR}/tfm_tz_psa_ns_api.c) - else() - zephyr_library_link_libraries( - ${PLATFORM_NS_FILE} - ${TFM_API_NS_PATH} - ) + if(CONFIG_SOC_FAMILY_NRF) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_ioctl_core_ns_api.c) endif() target_include_directories(tfm_api PRIVATE diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index a0d71328540..f8285da53d6 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -226,19 +226,8 @@ config TFM_BL2 TFM is designed to run with MCUboot in a certain configuration. This config adds MCUboot to the build - built via TFM's build system. -config TFM_BUILD_NS - bool "Build the TF-M Non-Secure application and libraries" - help - Instruct the TF-M build system to build the TF-M Non-Secure - application and libraries. - - This option is intended for testing purposes only, since this is the - easiest way to build the TF-M regression tests application and test - support libraries in the zephyr build system. - config TFM_USE_NS_APP bool "Use the TF-M Non-Secure application" - depends on TFM_BUILD_NS help The TF-M build system can produce multiple executable files. The main one is the TF-M secure firmware. Optionally the TF-M diff --git a/samples/tfm_integration/tfm_psa_test/prj.conf b/samples/tfm_integration/tfm_psa_test/prj.conf index 3ceca574528..aa35a6c27db 100644 --- a/samples/tfm_integration/tfm_psa_test/prj.conf +++ b/samples/tfm_integration/tfm_psa_test/prj.conf @@ -5,7 +5,6 @@ # CONFIG_BUILD_WITH_TFM=y -CONFIG_TFM_BUILD_NS=y CONFIG_TFM_PROFILE_TYPE_NOT_SET=y CONFIG_QEMU_ICOUNT_SHIFT=1 diff --git a/samples/tfm_integration/tfm_regression_test/prj.conf b/samples/tfm_integration/tfm_regression_test/prj.conf index 6817a7f717b..0a6573f811c 100644 --- a/samples/tfm_integration/tfm_regression_test/prj.conf +++ b/samples/tfm_integration/tfm_regression_test/prj.conf @@ -6,7 +6,6 @@ CONFIG_BUILD_WITH_TFM=y CONFIG_TFM_PROFILE_TYPE_NOT_SET=y -CONFIG_TFM_BUILD_NS=y CONFIG_TFM_USE_NS_APP=y CONFIG_TFM_REGRESSION_S=y CONFIG_TFM_REGRESSION_NS=y From a0e4f8af32167219a886966a68667d99917da355 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 14 Dec 2023 13:13:50 +0100 Subject: [PATCH 0433/2300] [nrf fromtree] tfm: Update TF-M regression tests sample to build NS app Update the TF-M regression tests sample to build the NS app in the tf-m-tests repository as an external project. The regression tests need to provide test configurations to both TF-M an NS app. Duplicate configuration done in the spe/CMakeLists.txt to configure TF-M image for the regression tests. Signed-off-by: Joakim Andersson Signed-off-by: Markus Swarowsky (cherry picked from commit f48467a2a61799b457750758ceeb3a393b841eda) Signed-off-by: Markus Swarowsky (cherry picked from commit fec869599ef608f2d8b7ed0674fc9cedaf274d39) --- modules/trusted-firmware-m/CMakeLists.txt | 2 + .../tfm_regression_test/CMakeLists.txt | 48 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 26109bef223..dc9827db830 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -40,9 +40,11 @@ if (CONFIG_BUILD_WITH_TFM) endif() if (CONFIG_TFM_REGRESSION_S) list(APPEND TFM_CMAKE_ARGS -DTEST_S=ON) + list(APPEND TFM_CMAKE_ARGS -DTFM_S_REG_TEST:BOOL=ON) endif() if (CONFIG_TFM_REGRESSION_NS) list(APPEND TFM_CMAKE_ARGS -DTEST_NS=ON) + list(APPEND TFM_CMAKE_ARGS -DTFM_NS_REG_TEST:BOOL=ON) endif() if (CONFIG_TFM_BL2) list(APPEND TFM_CMAKE_ARGS -DBL2=TRUE) diff --git a/samples/tfm_integration/tfm_regression_test/CMakeLists.txt b/samples/tfm_integration/tfm_regression_test/CMakeLists.txt index 5f34b1c0b26..571bf986206 100644 --- a/samples/tfm_integration/tfm_regression_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_regression_test/CMakeLists.txt @@ -11,3 +11,51 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(tfm_regression_test) target_sources(app PRIVATE src/main.c) + +get_target_property(TFM_BINARY_DIR tfm TFM_BINARY_DIR) +get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE) +get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE) +get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE) + +set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests) + +set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_reg/test/secure_regression") +set(TFM_TEST_CONFIG_FILE "${TFM_TEST_REPO_PATH}/tests_reg/test/config/config.cmake") + +set_property(TARGET zephyr_property_target + APPEND PROPERTY TFM_CMAKE_OPTIONS + -DCONFIG_TFM_TEST_DIR=${TFM_TEST_DIR} +) + +set_property(TARGET zephyr_property_target + APPEND PROPERTY TFM_CMAKE_OPTIONS + -DCONFIG_TFM_TEST_CONFIG_FILE=${TFM_TEST_CONFIG_FILE} +) + +include(ExternalProject) + +ExternalProject_Add(tfm_regression_test_app + SOURCE_DIR ${TFM_TEST_REPO_PATH}/tests_reg + BINARY_DIR ${PROJECT_BINARY_DIR}/tfm_ns + CONFIGURE_COMMAND + ${CMAKE_COMMAND} + -G ${CMAKE_GENERATOR} + -S ${TFM_TEST_REPO_PATH}/tests_reg + -B ${PROJECT_BINARY_DIR}/tfm_ns + -DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns + -DTFM_TOOLCHAIN_FILE=cmake/toolchain_ns_GNUARM.cmake + -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH} + -DCMAKE_BUILD_TYPE=RelWithDebInfo + BUILD_COMMAND ${CMAKE_COMMAND} --build . + INSTALL_COMMAND "" + BUILD_ALWAYS True + USES_TERMINAL_BUILD True + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tfm_ns + DEPENDS tfm + BUILD_BYPRODUCTS + ${TFM_NS_HEX_FILE} + ${TFM_NS_BIN_FILE} + ${TFM_NS_SIGNED_BIN_FILE} +) + +add_dependencies(app tfm_regression_test_app) From db37b46039dcc4ec1106bc68c4a1bc3495fc0284 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Thu, 14 Dec 2023 18:01:59 +0100 Subject: [PATCH 0434/2300] [nrf fromtree] modules: tf-m: Remove building of PSA arch tests This removed the CMake code that builds the TF-M arch tests within the TF-M CMakeFile. It will be moved to the tfm_integration/tfm_psa_test sample CMakeFile. Signed-off-by: Markus Swarowsky (cherry picked from commit cac7f4058ff3668b67fdb2c972ee9bb2fee1bfb5) Signed-off-by: Markus Swarowsky (cherry picked from commit 5c33a8712401f1a57790ca86d130a512b6bfa1ca) --- modules/trusted-firmware-m/CMakeLists.txt | 61 ------------------- .../src/zephyr_tfm_psa_test.c | 19 ------ 2 files changed, 80 deletions(-) delete mode 100644 modules/trusted-firmware-m/src/zephyr_tfm_psa_test.c diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index dc9827db830..2ee282905e6 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -65,20 +65,6 @@ if (CONFIG_BUILD_WITH_TFM) if (CONFIG_TFM_PROFILE) list(APPEND TFM_CMAKE_ARGS -DTFM_PROFILE=${CONFIG_TFM_PROFILE}) endif() - if (CONFIG_TFM_PSA_TEST_CRYPTO) - set(TFM_PSA_TEST_SUITE CRYPTO) - elseif (CONFIG_TFM_PSA_TEST_PROTECTED_STORAGE) - set(TFM_PSA_TEST_SUITE PROTECTED_STORAGE) - elseif (CONFIG_TFM_PSA_TEST_INTERNAL_TRUSTED_STORAGE) - set(TFM_PSA_TEST_SUITE INTERNAL_TRUSTED_STORAGE) - elseif (CONFIG_TFM_PSA_TEST_STORAGE) - set(TFM_PSA_TEST_SUITE STORAGE) - elseif (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION) - set(TFM_PSA_TEST_SUITE INITIAL_ATTESTATION) - endif() - if (DEFINED TFM_PSA_TEST_SUITE) - list(APPEND TFM_CMAKE_ARGS -DTEST_PSA_API=${TFM_PSA_TEST_SUITE}) - endif() if (CONFIG_TFM_CMAKE_BUILD_TYPE_RELEASE) set(TFM_CMAKE_BUILD_TYPE "Release") elseif (CONFIG_TFM_CMAKE_BUILD_TYPE_MINSIZEREL) @@ -182,17 +168,6 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_INTERFACE_INCLUDE_DIR ${TFM_BINARY_DIR}/api_ns/interface/include) set(TFM_INTERFACE_LIB_DIR ${TFM_BINARY_DIR}/api_ns/interface/lib) - if (TFM_PSA_TEST_SUITE) - set(PSA_TEST_VAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/val/val_nspe.a) - set(PSA_TEST_PAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/platform/pal_nspe.a) - set(COMBINE_DIR_STORAGE storage) - set(COMBINE_DIR_PROTECTED_STORAGE storage) - set(COMBINE_DIR_INTERNAL_TRUSTED_STORAGE storage) - set(COMBINE_DIR_CRYPTO crypto) - set(COMBINE_DIR_INITIAL_ATTESTATION initial_attestation) - set(PSA_TEST_COMBINE_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/dev_apis/${COMBINE_DIR_${TFM_PSA_TEST_SUITE}}/test_combine.a) - endif() - if(CONFIG_TFM_BL2) set(BL2_ELF_FILE ${TFM_BINARY_DIR}/bin/bl2.elf) set(BL2_BIN_FILE ${TFM_BINARY_DIR}/bin/bl2.bin) @@ -253,26 +228,6 @@ if (CONFIG_BUILD_WITH_TFM) message(FATAL_ERROR "Unsupported ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT}") endif() - if (CONFIG_TFM_PARTITION_INITIAL_ATTESTATION AND CONFIG_TFM_QCBOR_PATH STREQUAL "") - # TODO: Remove this when QCBOR licensing issues w/t_cose have been resolved, - # or only allow it when 'QCBOR_PATH' is set to a local path where QCBOR has - # been manually downloaded by the user before starting the build. - message(FATAL_ERROR "CONFIG_TFM_PARTITION_INITIAL_ATTESTATION is not available " - "with TF-M 1.7.0 due to licensing issues with a dependent library. This " - "restriction will be removed once licensing issues have been resolved." - ) - endif() - - if (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION AND CONFIG_TFM_QCBOR_PATH STREQUAL "") - # TODO: Remove this when QCBOR licensing issues w/t_cose have been resolved, - # or only allow it when 'QCBOR_PATH' is set to a local path where QCBOR has - # been manually downloaded by the user before starting the build. - message(FATAL_ERROR "CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION is not available " - "with TF-M 1.7.0 due to licensing issues with a dependent library. This " - "restriction will be removed once licensing issues have been resolved." - ) - endif() - if (CONFIG_TFM_QCBOR_PATH STREQUAL "DOWNLOAD") # Change CMake cache type to string to avoid QCBOR_PATH=/absolute/path/DOWNLOAD being set. set(QCBOR_PATH_TYPE ":STRING") @@ -296,13 +251,6 @@ if (CONFIG_BUILD_WITH_TFM) list(APPEND TFM_CMAKE_ARGS -DMCUBOOT_DATA_SHARING=ON) endif() - if(TFM_PSA_TEST_SUITE) - list(APPEND TFM_CMAKE_ARGS - -DPSA_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/psa/GNUARM.cmake - -DTOOLCHAIN=INHERIT - ) - endif() - if(CONFIG_FPU AND CONFIG_FP_HARDABI) list(APPEND TFM_CMAKE_ARGS -DCONFIG_TFM_ENABLE_FP=ON) # Note: This is not a cmake option in TF-M. @@ -405,15 +353,6 @@ if (CONFIG_BUILD_WITH_TFM) if (CONFIG_TFM_PARTITION_PLATFORM AND NOT CONFIG_TFM_PARTITION_PLATFORM_CUSTOM_REBOOT) zephyr_library_sources(src/reboot.c) endif() - zephyr_library_sources_ifndef(CONFIG_TFM_PSA_TEST_NONE src/zephyr_tfm_psa_test.c) - - if (TFM_PSA_TEST_SUITE) - zephyr_library_link_libraries( - ${PSA_TEST_VAL_FILE} - ${PSA_TEST_PAL_FILE} - ${PSA_TEST_COMBINE_FILE} - ) - endif() zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_platform_api.c) zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PROTECTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_ps_api.c) diff --git a/modules/trusted-firmware-m/src/zephyr_tfm_psa_test.c b/modules/trusted-firmware-m/src/zephyr_tfm_psa_test.c deleted file mode 100644 index d7d68f9db67..00000000000 --- a/modules/trusted-firmware-m/src/zephyr_tfm_psa_test.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2021 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -/** - * \brief This symbol is the entry point provided by the PSA API compliance - * test libraries - */ -extern void val_entry(void); - - -void psa_test(void) -{ - val_entry(); -} From bd990cb227e36bb366fd22ffd44fd7398d85caa4 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Thu, 14 Dec 2023 18:04:20 +0100 Subject: [PATCH 0435/2300] [nrf fromtree] samples: tfm_psa_test: Adapt to TF-M split build The sample now builds the psa-arch-tests itself and doesn't rely anymore on the TF-M module CMakeFile. Additionally it will not run the zephyr main.c anymore but therefore only uses the tf-m non-secure application. Signed-off-by: Markus Swarowsky (cherry picked from commit ad9cdf06c4c3021ddaad8721d4621acc9d1d9dec) Signed-off-by: Markus Swarowsky (cherry picked from commit 218bb94a8fda694530bccad0f308ae143362baba) --- .../nordic_nrf/nrf5340_cpuapp/CMakeLists.txt | 5 + .../nordic_nrf/nrf9120/CMakeLists.txt | 4 + .../nordic_nrf/nrf9160/CMakeLists.txt | 4 + .../tfm_psa_test/CMakeLists.txt | 99 ++++++++++++++++++- samples/tfm_integration/tfm_psa_test/prj.conf | 2 + .../tfm_integration/tfm_psa_test/src/main.c | 12 +-- 6 files changed, 114 insertions(+), 12 deletions(-) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt index 35338d542d7..b74620fe2d5 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt @@ -16,3 +16,8 @@ install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake install(FILES config.cmake DESTINATION ${INSTALL_PLATFORM_NS_DIR}) + +install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf5340dk_nrf5340_cpuapp/tests + + DESTINATION ${INSTALL_PLATFORM_NS_DIR} +) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt index fe2c161200d..64fff7cdb86 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt @@ -19,3 +19,7 @@ install(FILES ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordi install(FILES config.cmake DESTINATION ${INSTALL_PLATFORM_NS_DIR}) + +install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf9161dk_nrf9161/tests + + DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt index ba840c6c8d1..aa2ef831031 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt @@ -19,3 +19,7 @@ install(FILES ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordi install(FILES config.cmake DESTINATION ${INSTALL_PLATFORM_NS_DIR}) + +install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf9160dk_nrf9160/tests + + DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt index 7692ea3dfd1..0d11c021627 100644 --- a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt @@ -8,10 +8,103 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(tfm_psa_storage_test) +project(tfm_psa_arch_test) target_sources(app PRIVATE src/main.c) -target_include_directories(app PRIVATE - $/api_ns/interface/include +get_target_property(TFM_BINARY_DIR tfm TFM_BINARY_DIR) +get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE) +get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE) +get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE) + +get_target_property(TFM_TOOLCHAIN_PATH tfm TFM_TOOLCHAIN_PATH) +get_target_property(TFM_TOOLCHAIN_PREFIX tfm TFM_TOOLCHAIN_PREFIX) +get_target_property(TFM_TOOLCHAIN_NS_FILE tfm TFM_TOOLCHAIN_NS_FILE) + +set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests) +set(TFM_PSA_ARCHTEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../psa-arch-tests) + +if (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION AND CONFIG_TFM_QCBOR_PATH STREQUAL "") +# TODO: Remove this when QCBOR licensing issues w/t_cose have been resolved, +# or only allow it when 'QCBOR_PATH' is set to a local path where QCBOR has +# been manually downloaded by the user before starting the build. +message(FATAL_ERROR "CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION is not available " + "with TF-M 2.0.0 due to licensing issues with a dependent library. This " + "restriction will be removed once licensing issues have been resolved." + ) +endif() + + +set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_psa_arch/spe/partitions") +set(PSA_ARCH_TESTS_CONFIG_FILE "${TFM_TEST_REPO_PATH}/tests_psa_arch/spe/config/config_test_psa_api.cmake") +if (CONFIG_TFM_PSA_TEST_CRYPTO) +set(TFM_PSA_TEST_SUITE CRYPTO) +elseif (CONFIG_TFM_PSA_TEST_PROTECTED_STORAGE) +set(TFM_PSA_TEST_SUITE PROTECTED_STORAGE) +elseif (CONFIG_TFM_PSA_TEST_INTERNAL_TRUSTED_STORAGE) +set(TFM_PSA_TEST_SUITE INTERNAL_TRUSTED_STORAGE) +elseif (CONFIG_TFM_PSA_TEST_STORAGE) +set(TFM_PSA_TEST_SUITE STORAGE) +elseif (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION) +set(TFM_PSA_TEST_SUITE INITIAL_ATTESTATION) +endif() + +if (NOT DEFINED TFM_PSA_TEST_SUITE) + message(FATAL_ERROR "Please define witch test suite to run: + CONFIG_TFM_PSA_TEST_CRYPTO + CONFIG_TFM_PSA_TEST_PROTECTED_STORAGE + CONFIG_TFM_PSA_TEST_STORAGE + CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION") +endif() +set(TEST_PSA_API "${TFM_PSA_TEST_SUITE}") + +set_property(TARGET zephyr_property_target + APPEND PROPERTY TFM_CMAKE_OPTIONS + -DPSA_ARCH_TESTS_PATH=${TFM_PSA_ARCHTEST_REPO_PATH} +) + +set_property(TARGET zephyr_property_target + APPEND PROPERTY TFM_CMAKE_OPTIONS + -DCONFIG_TFM_TEST_DIR=${TFM_TEST_DIR} ) + +set_property(TARGET zephyr_property_target + APPEND PROPERTY TFM_CMAKE_OPTIONS + -DCONFIG_PSA_ARCH_TESTS_CONFIG_FILE=${PSA_ARCH_TESTS_CONFIG_FILE} +) + +set_property(TARGET zephyr_property_target + APPEND PROPERTY TFM_CMAKE_OPTIONS + -DTEST_PSA_API=${TEST_PSA_API} +) + +include(ExternalProject) + +ExternalProject_Add(tfm_psa_arch_test_app + SOURCE_DIR ${TFM_TEST_REPO_PATH}/tests_psa_arch + BINARY_DIR ${PROJECT_BINARY_DIR}/tfm_ns + CONFIGURE_COMMAND + ${CMAKE_COMMAND} + -G ${CMAKE_GENERATOR} + -S ${TFM_TEST_REPO_PATH}/tests_psa_arch + -B ${PROJECT_BINARY_DIR}/tfm_ns + -DCROSS_COMPILE=${TFM_TOOLCHAIN_PATH}/${TFM_TOOLCHAIN_PREFIX} + -DPSA_TOOLCHAIN_FILE=${TFM_BINARY_DIR}/api_ns/cmake/${TFM_TOOLCHAIN_NS_FILE} + -DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns + -DTFM_TOOLCHAIN_FILE=cmake/${TFM_TOOLCHAIN_NS_FILE} + -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH} + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DTEST_PSA_API=${TEST_PSA_API} + BUILD_COMMAND ${CMAKE_COMMAND} --build . + INSTALL_COMMAND "" + BUILD_ALWAYS True + USES_TERMINAL_BUILD True + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tfm_ns + DEPENDS tfm + BUILD_BYPRODUCTS + ${TFM_NS_HEX_FILE} + ${TFM_NS_BIN_FILE} + ${TFM_NS_SIGNED_BIN_FILE} +) + +add_dependencies(app tfm_psa_arch_test_app) diff --git a/samples/tfm_integration/tfm_psa_test/prj.conf b/samples/tfm_integration/tfm_psa_test/prj.conf index aa35a6c27db..bab1254229d 100644 --- a/samples/tfm_integration/tfm_psa_test/prj.conf +++ b/samples/tfm_integration/tfm_psa_test/prj.conf @@ -6,7 +6,9 @@ CONFIG_BUILD_WITH_TFM=y CONFIG_TFM_PROFILE_TYPE_NOT_SET=y +CONFIG_TFM_USE_NS_APP=y CONFIG_QEMU_ICOUNT_SHIFT=1 + # Needed for CRYPTO and INITIAL_ATTESTATION CONFIG_MAIN_STACK_SIZE=4096 diff --git a/samples/tfm_integration/tfm_psa_test/src/main.c b/samples/tfm_integration/tfm_psa_test/src/main.c index 232fc505cfd..9d2809fe269 100644 --- a/samples/tfm_integration/tfm_psa_test/src/main.c +++ b/samples/tfm_integration/tfm_psa_test/src/main.c @@ -1,21 +1,15 @@ /* - * Copyright (c) 2021 Nordic Semiconductor ASA. + * Copyright (c) 2023 Nordic Semiconductor ASA. * * SPDX-License-Identifier: Apache-2.0 */ #include -/* Run the PSA test suite */ -void psa_test(void); - int main(void) { -#ifdef CONFIG_TFM_PSA_TEST_NONE - #error "No PSA test suite set. Use Kconfig to enable a test suite.\n" -#else - psa_test(); -#endif + printk("Should not be printed, expected TF-M's NS application to be run instead.\n"); + k_panic(); for (;;) { } From e3cc28b9892cd71952994f48026ab9a01232beb8 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 15 Dec 2023 10:33:50 +0100 Subject: [PATCH 0436/2300] [nrf fromtree] tfm: Provide properties for selected TF-M toolchain for NS application Provide properties for selected TF-M toolchain so that the NS application will use the same toolchain as TF-M. Signed-off-by: Joakim Andersson Signed-off-by: Markus Swarowsky (cherry picked from commit 3a830433be49df2ddd2e30feac5ce494f9537026) Signed-off-by: Markus Swarowsky (cherry picked from commit e19049aad109e2f0ba3a9b3c31db04fea475e5ca) --- modules/trusted-firmware-m/CMakeLists.txt | 7 +++++++ samples/tfm_integration/tfm_regression_test/CMakeLists.txt | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 2ee282905e6..a9036495add 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -228,6 +228,8 @@ if (CONFIG_BUILD_WITH_TFM) message(FATAL_ERROR "Unsupported ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT}") endif() + string(REPLACE "toolchain" "toolchain_ns" TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_FILE}) + if (CONFIG_TFM_QCBOR_PATH STREQUAL "DOWNLOAD") # Change CMake cache type to string to avoid QCBOR_PATH=/absolute/path/DOWNLOAD being set. set(QCBOR_PATH_TYPE ":STRING") @@ -317,6 +319,11 @@ if (CONFIG_BUILD_WITH_TFM) # This is the root of all TFM build artifacts. set_target_properties(tfm PROPERTIES TFM_BINARY_DIR ${TFM_BINARY_DIR}) + # Set TFM toolchain properties on 'tfm' + set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_NS_FILE}) + set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_PREFIX ${TFM_TOOLCHAIN_PREFIX}) + set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_PATH ${TFM_TOOLCHAIN_PATH}) + # Set BL2 (MCUboot) executable file paths as target properties on 'tfm' # These files are produced by the TFM build system. if(CONFIG_TFM_BL2) diff --git a/samples/tfm_integration/tfm_regression_test/CMakeLists.txt b/samples/tfm_integration/tfm_regression_test/CMakeLists.txt index 571bf986206..b86eebc4a81 100644 --- a/samples/tfm_integration/tfm_regression_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_regression_test/CMakeLists.txt @@ -17,6 +17,10 @@ get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE) get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE) get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE) +get_target_property(TFM_TOOLCHAIN_PATH tfm TFM_TOOLCHAIN_PATH) +get_target_property(TFM_TOOLCHAIN_PREFIX tfm TFM_TOOLCHAIN_PREFIX) +get_target_property(TFM_TOOLCHAIN_NS_FILE tfm TFM_TOOLCHAIN_NS_FILE) + set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests) set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_reg/test/secure_regression") @@ -43,7 +47,8 @@ ExternalProject_Add(tfm_regression_test_app -S ${TFM_TEST_REPO_PATH}/tests_reg -B ${PROJECT_BINARY_DIR}/tfm_ns -DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns - -DTFM_TOOLCHAIN_FILE=cmake/toolchain_ns_GNUARM.cmake + -DTFM_TOOLCHAIN_FILE=cmake/${TFM_TOOLCHAIN_NS_FILE} + -DCROSS_COMPILE=${TFM_TOOLCHAIN_PATH}/${TFM_TOOLCHAIN_PREFIX} -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH} -DCMAKE_BUILD_TYPE=RelWithDebInfo BUILD_COMMAND ${CMAKE_COMMAND} --build . From f7724b256c93e00bb8fb91bb1d2ed950ea925fd9 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 22 Jan 2024 12:28:47 +0100 Subject: [PATCH 0437/2300] [nrf fromtree] modules: tf-m: Remove TFM_TEST_REPO_PATH TF-M 2.0.0 doesn't use the TFM_TEST_REPO_PATH anymore so removing it. Signed-off-by: Markus Swarowsky (cherry picked from commit 8e16b36c18a94b9509b8ca1f5f33188d8ae488a8) Signed-off-by: Markus Swarowsky (cherry picked from commit 30ef63cee29387d6484082780ff112d296fd37e2) --- modules/trusted-firmware-m/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index a9036495add..1fcffaa49b4 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -161,7 +161,6 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_BINARY_DIR ${CMAKE_BINARY_DIR}/tfm) - set(TFM_TEST_REPO_PATH ${ZEPHYR_CURRENT_MODULE_DIR}/../tf-m-tests) set(PSA_ARCH_TESTS_PATH ${ZEPHYR_CURRENT_MODULE_DIR}/../psa-arch-tests) set(TFM_INTERFACE_SOURCE_DIR ${TFM_BINARY_DIR}/api_ns/interface/src) @@ -280,7 +279,6 @@ if (CONFIG_BUILD_WITH_TFM) ${TFM_CMAKE_ARGS} $> -DMBEDCRYPTO_PATH=$>,$,${ZEPHYR_MBEDTLS_MODULE_DIR}> - -DTFM_TEST_REPO_PATH=${TFM_TEST_REPO_PATH} -DPSA_ARCH_TESTS_PATH=${PSA_ARCH_TESTS_PATH} ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR} WORKING_DIRECTORY ${TFM_BINARY_DIR} From b97054511cb55b0693729c1777b7b986b1f06d1f Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 22 Jan 2024 13:28:35 +0100 Subject: [PATCH 0438/2300] [nrf fromtree] modules: tf-m: Remove QCBOR path from build QCBOR is only needed by the TF-M tests, as they are not build separately due to the TF-M split build. If we still set it there is a CMake build warning. Signed-off-by: Markus Swarowsky (cherry picked from commit 75fc64969dd08d2949d248f27651cc5aa27857e3) Signed-off-by: Markus Swarowsky (cherry picked from commit 89b5ce8b44abc743a62194365adf43444bd74aec) --- modules/trusted-firmware-m/CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 1fcffaa49b4..ea057498d2d 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -229,14 +229,6 @@ if (CONFIG_BUILD_WITH_TFM) string(REPLACE "toolchain" "toolchain_ns" TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_FILE}) - if (CONFIG_TFM_QCBOR_PATH STREQUAL "DOWNLOAD") - # Change CMake cache type to string to avoid QCBOR_PATH=/absolute/path/DOWNLOAD being set. - set(QCBOR_PATH_TYPE ":STRING") - endif() - # Always set QCBOR_PATH, this will make sure that we don't automatically download this - # dependency in the TF-M build system and it will fail when set to an invalid value. - list(APPEND TFM_CMAKE_ARGS -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH}) - if(CONFIG_BOARD_LPCXPRESSO55S69_CPU0) # Supply path to NXP HAL sources used for TF-M build set(TFM_PLATFORM_NXP_HAL_FILE_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/platform/ext/target/nxp/) From b3039fd008b0edbafb2a74a79c004ea2b27eb59d Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 22 Jan 2024 14:05:52 +0100 Subject: [PATCH 0439/2300] [nrf fromtree] modules: tf-m: Rename crypto modules to ENABLED The TF-M crypto modules got renames from CRYPTO_XXX_MODULE_DISABLED to CRYPTO_XXX_MODULE_ENABLED Therefore also re naming it in zephyr build integration. Signed-off-by: Markus Swarowsky (cherry picked from commit 49c7f43561e8dcad06df696cb4da65536ad5330f) Signed-off-by: Markus Swarowsky (cherry picked from commit b2750e2bc91a6e56be98cacacaeb088eb5a2ed19) --- modules/trusted-firmware-m/CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index ea057498d2d..2bba4a45c6d 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -152,11 +152,8 @@ if (CONFIG_BUILD_WITH_TFM) foreach(module ${TFM_CRYPTO_MODULES}) if (CONFIG_TFM_${module}_ENABLED) # list(APPEND TFM_ENABLED_CRYPTO_MODULES_ARG ${module}) - set(val "FALSE") - else() - set(val "TRUE") + list(APPEND TFM_CMAKE_ARGS -D${module}_ENABLED=True) endif() - list(APPEND TFM_CMAKE_ARGS -D${module}_DISABLED=${val}) endforeach() set(TFM_BINARY_DIR ${CMAKE_BINARY_DIR}/tfm) From 38b93c87dc585d2af6f218bf15752235b66e3b28 Mon Sep 17 00:00:00 2001 From: Maciej Perkowski Date: Tue, 19 Dec 2023 15:28:24 +0100 Subject: [PATCH 0440/2300] [nrf fromlist] scripts: Allow using quarantine mechanism with test_plan.py script In twister, applying quarantine is a part of apply_filters() function. However, this function is not called when --load-test is used. Therefore, if one wants to use quarantines in combination with dynamic scope from the test_plan.py script, one has to pass such info through the script. Signed-off-by: Maciej Perkowski Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/66659 (cherry picked from commit a8dec43b92d373e00bc33ef957c0c7bc5f6989d1) --- scripts/ci/test_plan.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index a2ba406d8ce..26227d570aa 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -95,7 +95,7 @@ def __repr__(self): class Filters: def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, - pull_request=False, platforms=[], detailed_test_id=True): + pull_request=False, platforms=[], detailed_test_id=True, quarantine_list=None): self.modified_files = modified_files self.testsuite_root = testsuite_root self.resolved_files = [] @@ -108,6 +108,7 @@ def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, self.detailed_test_id = detailed_test_id self.ignore_path = ignore_path self.tag_cfg_file = alt_tags + self.quarantine_list = quarantine_list def process(self): self.find_modules() @@ -128,6 +129,9 @@ def get_plan(self, options, integration=False, use_testsuite_root=True): cmd+=["-T", root] if integration: cmd.append("--integration") + if self.quarantine_list: + for q in self.quarantine_list: + cmd += ["--quarantine-list", q] logging.info(" ".join(cmd)) _ = subprocess.call(cmd) @@ -415,6 +419,12 @@ def parse_args(): "testcase.yaml files under here will be processed. May be " "called multiple times. Defaults to the 'samples/' and " "'tests/' directories at the base of the Zephyr tree.") + parser.add_argument( + "--quarantine-list", action="append", metavar="FILENAME", + help="Load list of test scenarios under quarantine. The entries in " + "the file need to correspond to the test scenarios names as in " + "corresponding tests .yaml files. These scenarios " + "will be skipped with quarantine as the reason.") # Include paths in names by default. parser.set_defaults(detailed_test_id=True) @@ -443,7 +453,7 @@ def parse_args(): print("=========") f = Filters(files, args.ignore_path, args.alt_tags, args.testsuite_root, - args.pull_request, args.platform, args.detailed_test_id) + args.pull_request, args.platform, args.detailed_test_id, args.quarantine_list) f.process() # remove dupes and filtered cases From 15669d37378a22dcdc5bc80db0b79fcb21f3a8ea Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Fri, 16 Feb 2024 09:29:06 +0100 Subject: [PATCH 0441/2300] [nrf fromlist] modules: hal_nordic: nrfx: Fix DPPI support for nRF54L15 Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69079 Add required dppic interconnect files for nRF54L15. Signed-off-by: Adam Kondraciuk (cherry picked from commit 8cd3e479cb0036748361e284da6bd02a9dd8657d) --- 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 ffd2e9aebc1..71d57814f36 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -155,6 +155,7 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_C if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) 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() # Get the SVD file for the current SoC From fde57a95792a240114b209d6ed1d80bd7b5538e5 Mon Sep 17 00:00:00 2001 From: Jonathan Rico Date: Fri, 2 Feb 2024 13:56:23 +0100 Subject: [PATCH 0442/2300] [nrf fromtree] ipc: Drain pending work items before deregistering endpoint The work item will attempt to dereference pointers that have been nulled by the backend. To avoid that, wait until all items currently on the queue have been processed. The symptom is a busfault on ARM, and is "fixed" by adding a `k_msleep(1)` right before `ipc_service_deregister_endpoint()`. This will in effect do the same thing as this patch, and allow the scheduler to run the work item on the ipc workqueue. Signed-off-by: Jonathan Rico (cherry picked from commit f24a01e6d1e6804af9ae3fd81850e798076027ff) (cherry picked from commit 321387bc4e61b025d861f7d6df08d7e692125e9d) --- subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 dcbff7b360c..5478ece7ee3 100644 --- a/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c +++ b/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c @@ -456,6 +456,7 @@ static int deregister_ept(const struct device *instance, void *token) { struct backend_data_t *data = instance->data; struct ipc_rpmsg_ept *rpmsg_ept; + static struct k_work_sync sync; /* Instance is not ready */ if (atomic_get(&data->state) != STATE_INITED) { @@ -469,6 +470,13 @@ static int deregister_ept(const struct device *instance, void *token) return -ENOENT; } + /* Drain pending work items before tearing down channel. + * + * Note: `k_work_flush` Faults on Cortex-M33 with "illegal use of EPSR" + * if `sync` is not declared static. + */ + k_work_flush(&data->mbox_work, &sync); + rpmsg_destroy_ept(&rpmsg_ept->ep); memset(rpmsg_ept, 0, sizeof(struct ipc_rpmsg_ept)); From 4c805d97081938cfb673fb9f9253e6be671fa1e8 Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Mon, 12 Feb 2024 16:52:37 +0100 Subject: [PATCH 0443/2300] [nrf fromtree] Bluetooth: Correct `bt_att_create_rsp_pdu` reservation when EATT is enabled When EATT is enabled, bt_att_create_rsp_pdu used to reserve headroom for the SDU header even when responding on the UATT bearer. That subtracted from the room for the ATT payload in the buffers. The remaining buffer size was insufficient to create a PDU of ATT MTU size, since the exchanged local MTU is calculated the with the assumption that the SDU header is not present. This broke the ATT MTU promise, and e.g. our read response will have two bytes fewer than promised. This caused a failure in PTS. The new bt_att_create_rsp_pdu pays attention to the bearer type and only allocates the SDU header on EATT bearers. Signed-off-by: Aleksander Wasaznik (cherry picked from commit 98409830a2738a9a4ed766d52d62b4c07f5609d6) (cherry picked from commit 0eae7f0ce51df8a1f2ddb4e0d959d4ccf835a467) --- subsys/bluetooth/host/att.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 44862f5bf25..f8e924852e3 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -3007,13 +3007,40 @@ struct net_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, size_t len) struct net_buf *bt_att_create_rsp_pdu(struct bt_att_chan *chan, uint8_t op, size_t len) { - if (len + sizeof(op) > bt_att_mtu(chan)) { - LOG_WRN("ATT channel %p MTU too small for RSP (%u < %u)", - chan, bt_att_mtu(chan), len + sizeof(op)); + size_t headroom; + struct bt_att_hdr *hdr; + struct bt_att_tx_meta_data *data; + struct net_buf *buf; + + ARG_UNUSED(len); + + buf = bt_l2cap_create_pdu_timeout(NULL, 0, BT_ATT_TIMEOUT); + if (!buf) { + LOG_ERR("Unable to allocate buffer for op 0x%02x", op); return NULL; } - return bt_att_chan_create_pdu(chan, op, len); + headroom = BT_L2CAP_BUF_SIZE(0); + + if (bt_att_is_enhanced(chan)) { + headroom += BT_L2CAP_SDU_HDR_SIZE; + } + + net_buf_reserve(buf, headroom); + + data = tx_meta_data_alloc(BT_ATT_TIMEOUT); + if (!data) { + LOG_WRN("Unable to allocate ATT TX meta"); + net_buf_unref(buf); + return NULL; + } + data->att_chan = chan; + bt_att_tx_meta_data(buf) = data; + + hdr = net_buf_add(buf, sizeof(*hdr)); + hdr->code = op; + + return buf; } static void att_reset(struct bt_att *att) From 233af099c57352b72e84121bd23db88a82575701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Thu, 18 Jan 2024 12:27:56 +0100 Subject: [PATCH 0444/2300] [nrf fromtree] drivers: i2s_nrfx: Generate master clock if pin is connected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The driver uses pinctrl to configure pins instead of nrfx I2S API. Check whether MCK pin was actually connected by pinctrl instead of comparing nrfx_cfg.mck_pin that is always NRF_I2S_PIN_NOT_CONNECTED. This makes it possible for nRF I2S to provide master clock even when operating in I2S Slave mode. Signed-off-by: Tomasz Moń (cherry picked from commit 76e12a33d94bf72d1351171cec1875c64ec93f0c) (cherry picked from commit 815560169829ee2cb7b4aaf89c6e677554402cd6) --- drivers/i2s/i2s_nrfx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2s/i2s_nrfx.c b/drivers/i2s/i2s_nrfx.c index e1b3684c4f7..3c5af08e592 100644 --- a/drivers/i2s/i2s_nrfx.c +++ b/drivers/i2s/i2s_nrfx.c @@ -501,7 +501,8 @@ static int i2s_nrfx_configure(const struct device *dev, enum i2s_dir dir, * the MCK output is used), find a suitable clock configuration for it. */ if (nrfx_cfg.mode == NRF_I2S_MODE_MASTER || - nrfx_cfg.mck_pin != NRF_I2S_PIN_NOT_CONNECTED) { + (nrf_i2s_mck_pin_get(drv_cfg->i2s.p_reg) & I2S_PSEL_MCK_CONNECT_Msk) + == I2S_PSEL_MCK_CONNECT_Connected << I2S_PSEL_MCK_CONNECT_Pos) { find_suitable_clock(drv_cfg, &nrfx_cfg, i2s_cfg); /* Unless the PCLK32M source is used with the HFINT oscillator * (which is always available without any additional actions), From c2e86baa6025ec8ee91dbb49d942bd2007549137 Mon Sep 17 00:00:00 2001 From: Adam Wojasinski Date: Thu, 5 Oct 2023 09:09:30 +0200 Subject: [PATCH 0445/2300] [nrf fromtree] drivers: spi: spi_nrfx_spim: Include nrf_clock.h only for nRF5340 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CLOCK HAL header is only needed for nRF5340 SoC. It's used when user wants to configure SPIM instance to 32 Mbps. The HAL checks if is running at 128 MHz as only then 32 Mbps is supported. Signed-off-by: Adam Wojasinski (cherry picked from commit e6bcc986bf2aef30936c4d9c518673ae3cfdfa1a) Signed-off-by: Andrzej Głąbek (cherry picked from commit ca8cca2745e437d110f673ffece3e90ae4b634a9) --- drivers/spi/spi_nrfx_spim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index fb89f096cca..2b7407ed56c 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -11,8 +11,10 @@ #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 #include #endif -#include +#ifdef CONFIG_SOC_NRF5340_CPUAPP #include +#endif +#include #include #include From 850cfff1420e2ff48ec0c2a69f8bbbbf2f6d7fc0 Mon Sep 17 00:00:00 2001 From: Adam Wojasinski Date: Thu, 5 Oct 2023 09:15:24 +0200 Subject: [PATCH 0446/2300] [nrf fromtree] drivers: spi: spi_nrfx_spim: Add additional symbol check for frequency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some targets may not have `NRF_SPIM_HAS_32_MHZ_FREQ` or `NRF_SPIM_HAS_16_MHZ_FREQ` symbols but have `NRF_SPIM_HAS_PRESCALER` symbol defined. The symbol informs that target supports 32 MHz and 16 MHz frequencies for SPIM instances. Signed-off-by: Adam Wojasinski (cherry picked from commit 058eebe4797a1ba17a6a9cc2d3a449dddcfce6de) Signed-off-by: Andrzej Głąbek (cherry picked from commit 35ca365d5e0eff92254058b3b68cb164c3d44502) --- drivers/spi/spi_nrfx_spim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 2b7407ed56c..20aae46b8db 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -71,9 +71,9 @@ static inline uint32_t get_nrf_spim_frequency(uint32_t frequency) { /* Get the highest supported frequency not exceeding the requested one. */ - if (frequency >= MHZ(32) && NRF_SPIM_HAS_32_MHZ_FREQ) { + if (frequency >= MHZ(32) && (NRF_SPIM_HAS_32_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) { return MHZ(32); - } else if (frequency >= MHZ(16) && NRF_SPIM_HAS_16_MHZ_FREQ) { + } else if (frequency >= MHZ(16) && (NRF_SPIM_HAS_16_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) { return MHZ(16); } else if (frequency >= MHZ(8)) { return MHZ(8); From 5f313a2b654efea6a3a2750c1f6cc545e091c5d2 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 25 Aug 2023 18:27:52 +0530 Subject: [PATCH 0447/2300] [nrf fromtree] drivers: spi: spi_nrfx_spim: Use generic macro for RAM address check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of assuming only RAM is accessible by EasyDMA, use the generic DMA accessible function. Signed-off-by: Chaitanya Tata (cherry picked from commit 2c0f121727456f01422833b5e7b3ef2a29976a45) Signed-off-by: Andrzej Głąbek (cherry picked from commit 0eb931d0ca5844340da7b7dda585c6df8e6ab6bb) --- drivers/spi/spi_nrfx_spim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 20aae46b8db..acd99264099 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -315,7 +315,8 @@ static void transfer_next_chunk(const struct device *dev) nrfx_err_t result; const uint8_t *tx_buf = ctx->tx_buf; #if (CONFIG_SPI_NRFX_RAM_BUFFER_SIZE > 0) - if (spi_context_tx_buf_on(ctx) && !nrfx_is_in_ram(tx_buf)) { + if (spi_context_tx_buf_on(ctx) && + !nrf_dma_accessible_check(&dev_config->spim.p_reg, tx_buf)) { if (chunk_len > CONFIG_SPI_NRFX_RAM_BUFFER_SIZE) { chunk_len = CONFIG_SPI_NRFX_RAM_BUFFER_SIZE; } From 323863c7e343de0a8a7bd94844f72480bd3336fa Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 25 Aug 2023 17:45:17 +0530 Subject: [PATCH 0448/2300] [nrf fromtree] drivers: spim: Move the length check to beginning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This check has to be done independent of whether RAM is used for buffers or not and depends on device maximum length property. Signed-off-by: Chaitanya Tata (cherry picked from commit 0a1eff8d97f88546d07d4f0715628ffe0f06aaf6) Signed-off-by: Andrzej Głąbek (cherry picked from commit 373db5da8cfeb9469b4bcfb537ff8411f5ed9ca1) --- drivers/spi/spi_nrfx_spim.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index acd99264099..8a325097caa 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -314,6 +314,11 @@ static void transfer_next_chunk(const struct device *dev) nrfx_spim_xfer_desc_t xfer; nrfx_err_t result; const uint8_t *tx_buf = ctx->tx_buf; + + if (chunk_len > dev_config->max_chunk_len) { + chunk_len = dev_config->max_chunk_len; + } + #if (CONFIG_SPI_NRFX_RAM_BUFFER_SIZE > 0) if (spi_context_tx_buf_on(ctx) && !nrf_dma_accessible_check(&dev_config->spim.p_reg, tx_buf)) { @@ -325,10 +330,6 @@ static void transfer_next_chunk(const struct device *dev) tx_buf = dev_data->buffer; } #endif - if (chunk_len > dev_config->max_chunk_len) { - chunk_len = dev_config->max_chunk_len; - } - dev_data->chunk_len = chunk_len; xfer.p_tx_buffer = tx_buf; From 1a180f541af22e30fdf8d3f125019c554816bcf6 Mon Sep 17 00:00:00 2001 From: Marcin Szymczyk Date: Fri, 11 Mar 2022 12:26:24 +0100 Subject: [PATCH 0449/2300] [nrf fromtree] drivers: spi: nrfx: add dependency to PPI for PAN 58 on nRF52832 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While enabling workaround for PAN 58 the PPI driver is used. This requires the nrfx PPI driver to be enabled thus CONFIG_NRFX_PPI Kconfig symbol needs to be set. Jira: NRFX-1616 Signed-off-by: Marcin Szymczyk (cherry picked from commit 2a38230a31c6ef6333444578bc7b5c7e6aad6c52) Signed-off-by: Andrzej Głąbek (cherry picked from commit 0a25c054187e9848f5020b94488ad9d46b8259ba) --- drivers/spi/Kconfig.nrfx | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/Kconfig.nrfx b/drivers/spi/Kconfig.nrfx index c185efa9f8f..611bad822b2 100644 --- a/drivers/spi/Kconfig.nrfx +++ b/drivers/spi/Kconfig.nrfx @@ -54,6 +54,7 @@ config SPI_NRFX_SPIS config SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 depends on SOC_NRF52832 + select NRFX_PPI bool "Allow enabling the SPIM driver despite PAN 58" help Allow enabling the nRF SPI Master with EasyDMA, despite From d4c49ce4ec8411c4fb09f5117773ab4d7ffabd32 Mon Sep 17 00:00:00 2001 From: Adam Wojasinski Date: Fri, 22 Oct 2021 16:40:18 +0200 Subject: [PATCH 0450/2300] [nrf fromtree] drivers: spi: spi_nrfx_spim: Add support for RX buffer from RAM region MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds support for RX buffer placed by a linker in memory region defined in SPIM devicetree node. The buffer is placed in memory region defined as devicetree node. The memory region node's reference is then stored in `memory-regions` property of SPIM node. Added build time assertion to check if `CONFIG_SPI_NRFX_RAM_BUFFER_SIZE` Kconfig symbol has value greater than 0 when given SPIM node has `memory-region` property. Signed-off-by: Adam Wojasinski (cherry picked from commit ae75a8f73a583967354987be682d9c88c1cad6f5) Signed-off-by: Andrzej Głąbek (cherry picked from commit 74f5e087ed0f60e61d95cfd9bfe15a449af80769) --- drivers/spi/spi_nrfx_spim.c | 45 +++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 8a325097caa..95b737d6cf5 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -41,8 +41,9 @@ struct spi_nrfx_data { size_t chunk_len; bool busy; bool initialized; -#if SPI_BUFFER_IN_RAM - uint8_t *buffer; +#ifdef SPI_BUFFER_IN_RAM + uint8_t *tx_buffer; + uint8_t *rx_buffer; #endif #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 bool anomaly_58_workaround_active; @@ -314,27 +315,40 @@ static void transfer_next_chunk(const struct device *dev) nrfx_spim_xfer_desc_t xfer; nrfx_err_t result; const uint8_t *tx_buf = ctx->tx_buf; + uint8_t *rx_buf = ctx->rx_buf; if (chunk_len > dev_config->max_chunk_len) { chunk_len = dev_config->max_chunk_len; } -#if (CONFIG_SPI_NRFX_RAM_BUFFER_SIZE > 0) +#ifdef SPI_BUFFER_IN_RAM if (spi_context_tx_buf_on(ctx) && !nrf_dma_accessible_check(&dev_config->spim.p_reg, tx_buf)) { + if (chunk_len > CONFIG_SPI_NRFX_RAM_BUFFER_SIZE) { chunk_len = CONFIG_SPI_NRFX_RAM_BUFFER_SIZE; } - memcpy(dev_data->buffer, tx_buf, chunk_len); - tx_buf = dev_data->buffer; + memcpy(dev_data->tx_buffer, tx_buf, chunk_len); + tx_buf = dev_data->tx_buffer; + } + + if (spi_context_rx_buf_on(ctx) && + !nrf_dma_accessible_check(&dev_config->spim.p_reg, rx_buf)) { + + if (chunk_len > CONFIG_SPI_NRFX_RAM_BUFFER_SIZE) { + chunk_len = CONFIG_SPI_NRFX_RAM_BUFFER_SIZE; + } + + rx_buf = dev_data->rx_buffer; } #endif + dev_data->chunk_len = chunk_len; xfer.p_tx_buffer = tx_buf; xfer.tx_length = spi_context_tx_buf_on(ctx) ? chunk_len : 0; - xfer.p_rx_buffer = ctx->rx_buf; + xfer.p_rx_buffer = rx_buf; xfer.rx_length = spi_context_rx_buf_on(ctx) ? chunk_len : 0; #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 @@ -378,6 +392,15 @@ static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context) #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 anomaly_58_workaround_clear(dev_data); +#endif +#ifdef SPI_BUFFER_IN_RAM + if (spi_context_rx_buf_on(&dev_data->ctx) && + p_event->xfer_desc.p_rx_buffer != NULL && + p_event->xfer_desc.p_rx_buffer != dev_data->ctx.rx_buf) { + (void)memcpy(dev_data->ctx.rx_buf, + dev_data->rx_buffer, + dev_data->chunk_len); + } #endif spi_context_update_tx(&dev_data->ctx, 1, dev_data->chunk_len); spi_context_update_rx(&dev_data->ctx, 1, dev_data->chunk_len); @@ -606,7 +629,10 @@ static int spi_nrfx_init(const struct device *dev) nrfx_isr, nrfx_spim_##idx##_irq_handler, 0); \ } \ IF_ENABLED(SPI_BUFFER_IN_RAM, \ - (static uint8_t spim_##idx##_buffer \ + (static uint8_t spim_##idx##_tx_buffer \ + [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ + SPIM_MEMORY_SECTION(idx); \ + static uint8_t spim_##idx##_rx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ SPIM_MEMORY_SECTION(idx);)) \ static struct spi_nrfx_data spi_##idx##_data = { \ @@ -614,7 +640,8 @@ static int spi_nrfx_init(const struct device *dev) SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(SPIM(idx), ctx) \ IF_ENABLED(SPI_BUFFER_IN_RAM, \ - (.buffer = spim_##idx##_buffer,)) \ + (.tx_buffer = spim_##idx##_tx_buffer, \ + .rx_buffer = spim_##idx##_rx_buffer,)) \ .dev = DEVICE_DT_GET(SPIM(idx)), \ .busy = false, \ }; \ @@ -643,7 +670,7 @@ static int spi_nrfx_init(const struct device *dev) WAKE_PIN_NOT_USED), \ .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ }; \ - BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIM(idx), wake_gpios) || \ + BUILD_ASSERT(!SPIM_HAS_PROP(idx, wake_gpios) || \ !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ "WAKE line must be configured as active high"); \ PM_DEVICE_DT_DEFINE(SPIM(idx), spim_nrfx_pm_action); \ From 47bd797f34aba9775720545aca1afa01e49901cb Mon Sep 17 00:00:00 2001 From: Adam Wojasinski Date: Thu, 16 Nov 2023 12:22:08 +0100 Subject: [PATCH 0451/2300] [nrf fromtree] drivers: spi: nrfx: Update doc for RAM_BUFFER_SIZE Kconfig symbol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update documentation for SPI_NRFX_RAM_BUFFER_SIZE Kconfig symbol to reflect new usage of it. Now the symbol specifies size of RX buffer. The change introducing support for RX buffer placed by a linker in memory region defined in SPIM devicetree node is in a parent commit of that one. Signed-off-by: Adam Wojasinski (cherry picked from commit c88b492842b3021efeb42dd181406c9b30c07c44) Signed-off-by: Andrzej Głąbek (cherry picked from commit dbefe6d8e0e9e78a80afed834bb8f97320953d3a) --- drivers/spi/Kconfig.nrfx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/spi/Kconfig.nrfx b/drivers/spi/Kconfig.nrfx index 611bad822b2..0ee1c03065b 100644 --- a/drivers/spi/Kconfig.nrfx +++ b/drivers/spi/Kconfig.nrfx @@ -75,14 +75,20 @@ config SPI_NRFX_RAM_BUFFER_SIZE default 8 depends on SPI_NRFX_SPIM help - SPIM peripherals cannot transmit data directly from flash. Therefore, - a buffer in RAM needs to be provided for each instance of SPI driver - using SPIM peripheral, so that the driver can copy there a chunk of - data from flash and transmit it. - The size is specified in bytes. A size of 0 means that this feature - should be disabled, and the application must then take care of not - supplying buffers located in flash to the driver, otherwise such - transfers will fail. + Because of using EasyDMA, SPIM peripherals cannot use transmit and + receive buffers from all memory locations. They are restricted to + buffers located in certain RAM memories only. Therefore, each SPIM + driver instance needs to use an intermediate local RAM buffer, + to transfer data in chunks not exceeding the size of that buffer, + and to copy those chunks between the local buffer and the one + specified in the transfer request if the latter is not accessible + by EasyDMA. + + This option specifies the size in bytes of such local RAM buffers + for both TX and RX paths. A size of 0 means that this feature should + be disabled and the driver user must take care of not making transfer + requests with buffers not accessible by EasyDMA since such transfers + will fail. config SPI_NRFX_WAKE_TIMEOUT_US int "Maximum time to wait for SPI slave to wake up" From e2e36fe60e49524f445170a0ddd04a5c8e7743fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 28 Nov 2023 13:05:59 +0100 Subject: [PATCH 0452/2300] [nrf fromtree] soc: nrf53: Add implementation of workaround for anomaly 168 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the already available in the tree mechanism of adding assembly instructions right after WFI/WFE to implement the workaround for nRF5340 anomaly 168 (replace the 4 NOP solution used on the network core as it turned out to be insufficient) and provide two related Kconfig options so that users are able to adjust the workaround to their actual needs (disable it entirely or use it in the extended version). Signed-off-by: Andrzej Głąbek (cherry picked from commit 23e15c480ac85ae450fc99e9a75cf04e3f188931) (cherry picked from commit a5fc368218367bf8524e66da20db133678a57556) --- soc/arm/nordic_nrf/nrf53/Kconfig.soc | 22 +++++++++++++++++++++- soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h | 10 ++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.soc b/soc/arm/nordic_nrf/nrf53/Kconfig.soc index 3afcd96f70d..3ecf09ecd92 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.soc @@ -12,13 +12,14 @@ config SOC_NRF5340_CPUAPP select HAS_POWEROFF select SOC_COMPATIBLE_NRF5340_CPUAPP imply SOC_NRF53_RTC_PRETICK + imply SOC_NRF53_ANOMALY_168_WORKAROUND config SOC_NRF5340_CPUNET bool - select ARM_ON_EXIT_CPU_IDLE select SOC_COMPATIBLE_NRF5340_CPUNET imply SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED imply SOC_NRF53_RTC_PRETICK if !WDT_NRFX + imply SOC_NRF53_ANOMALY_168_WORKAROUND choice prompt "nRF53x MCU Selection" @@ -79,6 +80,25 @@ config SOC_NRF53_RTC_PRETICK_IPC_CH_TO_NET endif +config SOC_NRF53_ANOMALY_168_WORKAROUND + bool "Workaround for nRF5340 anomaly 168" + select ARM_ON_EXIT_CPU_IDLE + help + Indicates that the workaround for the anomaly 168 that affects + the nRF5340 SoC should be applied. + The workaround involves execution of 8 NOP instructions when the CPU + exist its idle state (when the WFI/WFE instruction returns) and it is + enabled by default for both the application and network core. + +config SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM + bool "Extend the workaround to execution at 128 MHz from RAM" + depends on SOC_NRF53_ANOMALY_168_WORKAROUND && SOC_NRF5340_CPUAPP + help + Indicates that the anomaly 168 workaround is to be extended to cover + also a specific case when the WFI/WFE instruction is executed at 128 + MHz from RAM. Then, 26 instead of 8 NOP instructions needs to be + executed after WFI/WFE. This extension is not enabled by default. + if SOC_NRF5340_CPUAPP config SOC_DCDC_NRF53X_APP diff --git a/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h b/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h index b6cd92ca092..dcb0c73d068 100644 --- a/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h +++ b/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h @@ -11,10 +11,16 @@ #if defined(_ASMLANGUAGE) +#if defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM) #define SOC_ON_EXIT_CPU_IDLE \ + .rept 26 \ nop; \ + .endr +#elif defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND) +#define SOC_ON_EXIT_CPU_IDLE \ + .rept 8 \ nop; \ - nop; \ - nop; + .endr +#endif #endif /* _ASMLANGUAGE */ From a9b738e897ccb0dae74c46aef788ba09c5e0d78f Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Sat, 30 Dec 2023 15:45:44 -0500 Subject: [PATCH 0453/2300] [nrf fromtree] soc: nrf53: fix building anomaly 168 workaround MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With GCC 12.3 and binutils 2.40, the build fails with: <...>/zephyr/arch/arm/core/cortex_m/cpu_idle.S: Assembler messages: <...>/zephyr/arch/arm/core/cortex_m/cpu_idle.S:51: Error: junk at end of line, first unrecognized character is `n' <...>/zephyr/arch/arm/core/cortex_m/cpu_idle.S:133: Info: macro invoked from here Because the SOC_ON_EXIT_CPU_IDLE macro puts all the statements on a single line, there must be a semicolon after .rept Signed-off-by: Ben Wolsieffer (cherry picked from commit 37352d3d2993f02b26b027b1a3bde11ab2254319) Signed-off-by: Andrzej Głąbek (cherry picked from commit 415c01affc316187ed9e4f4b1a3212a55c5465de) --- soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h b/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h index dcb0c73d068..c02c9451419 100644 --- a/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h +++ b/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h @@ -13,12 +13,12 @@ #if defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM) #define SOC_ON_EXIT_CPU_IDLE \ - .rept 26 \ + .rept 26; \ nop; \ .endr #elif defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND) #define SOC_ON_EXIT_CPU_IDLE \ - .rept 8 \ + .rept 8; \ nop; \ .endr #endif From 6a311c3a569a9cbe6069638d4521683b712f2eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 5 Jan 2024 10:26:59 +0100 Subject: [PATCH 0454/2300] [nrf fromtree] drivers: spi: nrfx: Deactivate CS from thread context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... so that it is possible to use a GPIO expander pin as the CS line. Communication with the expander may involve an operation that cannot be done from the interrupt context (e.g. an I2C transaction). Signed-off-by: Andrzej Głąbek (cherry picked from commit db4344b6591c8a0477d15ebd892a5ccd1d13b1b9) (cherry picked from commit d5ea3dcf3e232ec785d4d6dd3633843ee3b79cf9) --- drivers/spi/spi_nrfx_spi.c | 4 ++-- drivers/spi/spi_nrfx_spim.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi_nrfx_spi.c b/drivers/spi/spi_nrfx_spi.c index 04d7853d11d..752132fb248 100644 --- a/drivers/spi/spi_nrfx_spi.c +++ b/drivers/spi/spi_nrfx_spi.c @@ -161,8 +161,6 @@ static void finish_transaction(const struct device *dev, int error) struct spi_nrfx_data *dev_data = dev->data; struct spi_context *ctx = &dev_data->ctx; - spi_context_cs_control(ctx, false); - LOG_DBG("Transaction finished with status %d", error); spi_context_complete(ctx, dev, error); @@ -277,6 +275,8 @@ static int transceive(const struct device *dev, /* Clean up the driver state. */ k_sem_reset(&dev_data->ctx.sync); } + + spi_context_cs_control(&dev_data->ctx, false); } spi_context_release(&dev_data->ctx, error); diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 95b737d6cf5..08012b389c5 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -294,8 +294,6 @@ static void finish_transaction(const struct device *dev, int error) struct spi_nrfx_data *dev_data = dev->data; struct spi_context *ctx = &dev_data->ctx; - spi_context_cs_control(ctx, false); - LOG_DBG("Transaction finished with status %d", error); spi_context_complete(ctx, dev, error); @@ -470,6 +468,8 @@ static int transceive(const struct device *dev, anomaly_58_workaround_clear(dev_data); #endif } + + spi_context_cs_control(&dev_data->ctx, false); } spi_context_release(&dev_data->ctx, error); From 9eef3ac843217fe6d3990f30a96ede465bd87330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 31 Jan 2024 08:11:21 +0100 Subject: [PATCH 0455/2300] [nrf fromtree] drivers: serial: Fix async to interrupt driven adaptation layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Whenever UART_RX_DISABLED event is received module attempts to re-enable receiver since in interrupt driven API receiver is always on. However, it is possible that there is no free buffers and in that case attempt to enable the receiver will fail with -EBUSY. That scenario shall be accepted since the receiver will be re-enabled when at least one buffer will be freed. Given that, -EBUSY return shall be accepted (no assert) and number of pending RX buffer requests shall be reset only on successful enabling. Signed-off-by: Krzysztof Chruściński (cherry picked from commit f6ecad20a1e7ee3c52116cd46c93ac72eccdd3c8) Signed-off-by: Andrzej Głąbek (cherry picked from commit bc2740c37c5587c6450d059cdd7d7309451c6cf2) --- drivers/serial/uart_async_to_irq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/serial/uart_async_to_irq.c b/drivers/serial/uart_async_to_irq.c index 209e8d4f205..e18536449f3 100644 --- a/drivers/serial/uart_async_to_irq.c +++ b/drivers/serial/uart_async_to_irq.c @@ -105,12 +105,15 @@ static void on_rx_buf_req(const struct device *dev, static void on_rx_dis(const struct device *dev, struct uart_async_to_irq_data *data) { if (data->flags & A2I_RX_ENABLE) { - data->rx.pending_buf_req = 0; + int err; - int err = try_rx_enable(dev, data); + err = try_rx_enable(dev, data); + if (err == 0) { + data->rx.pending_buf_req = 0; + } LOG_INST_DBG(get_config(dev)->log, "Reenabling RX from RX_DISABLED (err:%d)", err); - __ASSERT_NO_MSG(err >= 0); + __ASSERT((err >= 0) || (err == -EBUSY), "err: %d", err); return; } From d45b0926081aa2b936c3123606800d1e3a49b4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 6 Feb 2024 13:15:34 +0100 Subject: [PATCH 0456/2300] [nrf fromtree] drivers: serial: nrfx_uarte: Fix misbehavior due to preemption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UART_RX_RDY event can be generated from UARTE interrupt or k_timer handler. When ENDRX event occurs then k_timer is stopped (it can be restarted if there is another buffer provided). However, if UARTE interrupt priority is higher than k_timer priority (RTC is used underneath) then k_timer handler may still be executed later. K_timer notifies new bytes based on RXDRDY HW event which is counter by the TIMER (using PPI). It may happen that RXDRDY event arrives due to byte received into RX FIFO but since there is not buffer provided it stays in that FIFO. Given all this, it was possible that RX_RDY event was reported from ENDRX UARTE event, timer was stopped but because UARTE interrupt had higher priority timer handler is executed after UARTE interrupt is handled. In timer handler TIMER counter reports more bytes and calls UART_RX_RDY event with null buffer and non-zero amount of bytes. Fixed by generating UART_RX_RDY event only if RX buffer is not null. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 5db338c035fc3cb246e09ba2d2290369a17d9661) Signed-off-by: Andrzej Głąbek (cherry picked from commit 4d8b300173376e216e6857785bf9bd37d59099f3) --- drivers/serial/uart_nrfx_uarte.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 3a62057a47a..6e1ecfadfd8 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -1043,9 +1043,11 @@ static void rx_timeout(struct k_timer *timer) (data->async->rx_timeout_left < data->async->rx_timeout_slab)) { /* rx_timeout us elapsed since last receiving */ - notify_uart_rx_rdy(dev, len); - data->async->rx_offset += len; - data->async->rx_total_user_byte_cnt += len; + if (data->async->rx_buf != NULL) { + notify_uart_rx_rdy(dev, len); + data->async->rx_offset += len; + data->async->rx_total_user_byte_cnt += len; + } } else { data->async->rx_timeout_left -= data->async->rx_timeout_slab; From 26c470e997954297bd4c9c74f9cf79b615656118 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 23 Jan 2024 21:46:24 +0530 Subject: [PATCH 0457/2300] [nrf fromtree] wifi: shell: Remove duplicate argument count checks Now that we are using the shell macro to enforce argument count check, both mandatory and optional arguments, these additions checks are unnecessary. Signed-off-by: Chaitanya Tata (cherry picked from commit c07d6483044f63a57ea26b65405793d5fa8f5c95) (cherry picked from commit e6cfb46b441ff1fc57658ee55656ed5b00ab088f) --- subsys/net/l2/wifi/wifi_shell.c | 46 +++++---------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 2b131d4e0fb..823f389decb 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -450,12 +450,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], char *endptr; int idx = 1; - if (argc < 1) { - print(context.sh, SHELL_WARNING, - "SSID not specified\n"); - return -EINVAL; - } - /* Defaults */ params->band = WIFI_FREQ_BAND_UNKNOWN; params->channel = WIFI_CHANNEL_ANY; @@ -1082,12 +1076,6 @@ static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc, context.sh = sh; - if (argc != 3) { - shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); - shell_help(sh); - return -ENOEXEC; - } - /* Sensible defaults */ params.operation = WIFI_TWT_SETUP; params.negotiation_type = WIFI_TWT_INDIVIDUAL; @@ -1136,12 +1124,6 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, context.sh = sh; - if (argc != 12) { - shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); - shell_help(sh); - return -ENOEXEC; - } - params.operation = WIFI_TWT_SETUP; if (!parse_number(sh, &value, argv[idx++], WIFI_TWT_INDIVIDUAL, @@ -1227,12 +1209,6 @@ static int cmd_wifi_twt_teardown(const struct shell *sh, size_t argc, context.sh = sh; int idx = 1; - if (argc != 5) { - shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); - shell_help(sh); - return -ENOEXEC; - } - params.operation = WIFI_TWT_TEARDOWN; if (!parse_number(sh, &value, argv[idx++], WIFI_TWT_INDIVIDUAL, @@ -1705,13 +1681,8 @@ static int cmd_wifi_channel(const struct shell *sh, size_t argc, char *argv[]) int ret; bool do_channel_oper = true; - if (argc > 1) { - channel_info.oper = WIFI_MGMT_SET; - parse_channel_args_to_params(sh, argc, argv, &channel_info, &do_channel_oper); - } else { - shell_fprintf(sh, SHELL_ERROR, "Invalid number of arguments\n"); - return -EINVAL; - } + channel_info.oper = WIFI_MGMT_SET; + parse_channel_args_to_params(sh, argc, argv, &channel_info, &do_channel_oper); if (do_channel_oper) { /* @@ -1827,13 +1798,8 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg int ret; bool do_filter_oper = true; - if (argc > 1) { - packet_filter.oper = WIFI_MGMT_SET; - parse_filter_args_to_params(sh, argc, argv, &packet_filter, &do_filter_oper); - } else { - shell_fprintf(sh, SHELL_ERROR, "Invalid number of arguments\n"); - return -EINVAL; - } + packet_filter.oper = WIFI_MGMT_SET; + parse_filter_args_to_params(sh, argc, argv, &packet_filter, &do_filter_oper); if (do_filter_oper) { /* @@ -2015,7 +1981,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "Set operation example for interface index 1 - set data+management frame filter\n" "wifi packet_filter -i1 -md.\n", cmd_wifi_packet_filter, - 1, 8), + 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" @@ -2029,7 +1995,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "Set operation example for interface index 1 (setting channel 5)\n" "wifi -i1 -c5.\n", cmd_wifi_channel, - 1, 4), + 2, 4), SHELL_CMD_ARG(ps_timeout, NULL, " - PS inactivity timer(in ms).\n", From f72c03ef68974e0a3c5fce8f958b323491a04c93 Mon Sep 17 00:00:00 2001 From: Sandip Dalvi Date: Sat, 20 Jan 2024 10:25:47 +0530 Subject: [PATCH 0458/2300] [nrf fromtree] net: wifi: add wifi driver version API Add command to query to WiFi driver/firmware revision. The API is expected to return the firmware revision and driver version as a string, and can be used by the user to determine what revision of the WiFi driver is in use. Signed-off-by: Sandip Dalvi (cherry picked from commit 4c7eb600c694a46b0039970ba0bd0ebe3992cd81) (cherry picked from commit c66ca8573640c3b7ef986e776beda0736b0d4fd4) --- include/zephyr/net/wifi_mgmt.h | 28 ++++++++++++++++++++++++++++ subsys/net/l2/wifi/wifi_mgmt.c | 16 ++++++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 24 ++++++++++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 982184a103b..c287db650cb 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -83,6 +83,8 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_CHANNEL, /** Disconnect a STA from AP */ NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT, + /** Get Wi-Fi driver and Firmware versions */ + NET_REQUEST_WIFI_CMD_VERSION, NET_REQUEST_WIFI_CMD_MAX }; @@ -165,6 +167,11 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT); +#define NET_REQUEST_WIFI_VERSION \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_VERSION) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION); + /** Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -236,6 +243,14 @@ enum net_event_wifi_cmd { #define NET_EVENT_WIFI_AP_STA_DISCONNECTED \ (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED) +/** Wi-Fi version */ +struct wifi_version { + /** Driver version */ + const char *drv_version; + /** Firmware version */ + const char *fw_version; +}; + /** * @brief Wi-Fi structure to uniquely identify a band-channel pair */ @@ -824,6 +839,19 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*channel)(const struct device *dev, struct wifi_channel_info *channel); + /** Get Version of WiFi driver and Firmware + * + * The driver that implements the get_version function must not use stack to allocate the + * version information pointers that are returned as params struct members. + * The version pointer parameters should point to a static memory either in ROM (preferred) + * or in RAM. + * + * @param dev Pointer to the device structure for the driver instance + * @param params Version parameters + * + * @return 0 if ok, < 0 if error + */ + int (*get_version)(const struct device *dev, struct wifi_version *params); }; /** Wi-Fi management offload API */ diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 2cfe8e25d89..bc844016fa5 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -703,6 +703,22 @@ static int wifi_channel(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL, wifi_channel); +static int wifi_get_version(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_version *ver_params = data; + + if (wifi_mgmt_api == NULL || wifi_mgmt_api->get_version == NULL) { + return -ENOTSUP; + } + + return wifi_mgmt_api->get_version(dev, ver_params); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION, wifi_get_version); + #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface, struct wifi_raw_scan_result *raw_scan_result) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 823f389decb..829f0dc96da 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1848,6 +1848,27 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg return 0; } +static int cmd_wifi_version(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = net_if_get_first_wifi(); + struct wifi_version version = {0}; + + if (argc > 1) { + shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); + return -ENOEXEC; + } + + if (net_mgmt(NET_REQUEST_WIFI_VERSION, iface, &version, sizeof(version))) { + shell_fprintf(sh, SHELL_WARNING, "Failed to get Wi-Fi versions\n"); + return -ENOEXEC; + } + + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Driver Version: %s\n", version.drv_version); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Firmware Version: %s\n", version.fw_version); + + return 0; +} + SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, SHELL_CMD_ARG(disable, NULL, "Disable Access Point mode.\n", @@ -1901,6 +1922,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, ); 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, "Connect to a Wi-Fi AP\n" From f8bfd5b161edec8dccf8c89e402b3125e8cb9fbf Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 27 Jan 2024 16:58:45 +0700 Subject: [PATCH 0459/2300] [nrf fromtree] wifi: shell: introduce local 'sh' variable This commit introduces a local variable 'sh' to store 'context.sh' for use with the 'shell_fprintf' function. By doing so, we avoid the repeated dereferencing of 'context.sh', thereby reducing the code footprint. Signed-off-by: Pisit Sawangvonganan (cherry picked from commit a8a39231e7acc28a0ac92111ac46977482227707) (cherry picked from commit a63cb57fd0affde5e55e51d0be690a89fa9eaa76) --- subsys/net/l2/wifi/wifi_shell.c | 80 ++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 829f0dc96da..1bda0e1610d 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -184,11 +184,12 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) int rssi; int i = 0; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; + const struct shell *sh = context.sh; scan_result++; if (scan_result == 1U) { - print(context.sh, SHELL_NORMAL, + print(sh, SHELL_NORMAL, "\n%-4s | %-13s | %-4s | %-15s | %-15s | %-32s\n", "Num", "Channel (Band)", "RSSI", "BSSID", "Frame length", "Frame Body"); } @@ -197,7 +198,7 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) channel = wifi_freq_to_channel(raw->frequency); band = wifi_freq_to_band(raw->frequency); - print(context.sh, SHELL_NORMAL, "%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", + print(sh, SHELL_NORMAL, "%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", scan_result, channel, wifi_band_txt(band), @@ -206,10 +207,10 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) sizeof(mac_string_buf)), raw->frame_length); for (i = 0; i < 32; i++) { - print(context.sh, SHELL_NORMAL, "%02X ", *(raw->data + i)); + print(sh, SHELL_NORMAL, "%02X ", *(raw->data + i)); } - print(context.sh, SHELL_NORMAL, "\n"); + print(sh, SHELL_NORMAL, "\n"); } #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ @@ -217,12 +218,13 @@ static void handle_wifi_scan_done(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *)cb->info; + const struct shell *sh = context.sh; if (status->status) { - print(context.sh, SHELL_WARNING, + print(sh, SHELL_WARNING, "Scan request failed (%d)\n", status->status); } else { - print(context.sh, SHELL_NORMAL, "Scan request done\n"); + print(sh, SHELL_NORMAL, "Scan request done\n"); } scan_result = 0U; @@ -266,47 +268,50 @@ static void print_twt_params(uint8_t dialog_token, uint8_t flow_id, bool trigger, uint32_t twt_wake_interval, uint64_t twt_interval) { - print(context.sh, SHELL_NORMAL, "TWT Dialog token: %d\n", + const struct shell *sh = context.sh; + + print(sh, SHELL_NORMAL, "TWT Dialog token: %d\n", dialog_token); - print(context.sh, SHELL_NORMAL, "TWT flow ID: %d\n", + print(sh, SHELL_NORMAL, "TWT flow ID: %d\n", flow_id); - print(context.sh, SHELL_NORMAL, "TWT negotiation type: %s\n", + print(sh, SHELL_NORMAL, "TWT negotiation type: %s\n", wifi_twt_negotiation_type_txt(negotiation_type)); - print(context.sh, SHELL_NORMAL, "TWT responder: %s\n", + print(sh, SHELL_NORMAL, "TWT responder: %s\n", responder ? "true" : "false"); - print(context.sh, SHELL_NORMAL, "TWT implicit: %s\n", + print(sh, SHELL_NORMAL, "TWT implicit: %s\n", implicit ? "true" : "false"); - print(context.sh, SHELL_NORMAL, "TWT announce: %s\n", + print(sh, SHELL_NORMAL, "TWT announce: %s\n", announce ? "true" : "false"); - print(context.sh, SHELL_NORMAL, "TWT trigger: %s\n", + print(sh, SHELL_NORMAL, "TWT trigger: %s\n", trigger ? "true" : "false"); - print(context.sh, SHELL_NORMAL, "TWT wake interval: %d us\n", + print(sh, SHELL_NORMAL, "TWT wake interval: %d us\n", twt_wake_interval); - print(context.sh, SHELL_NORMAL, "TWT interval: %lld us\n", + print(sh, SHELL_NORMAL, "TWT interval: %lld us\n", twt_interval); - print(context.sh, SHELL_NORMAL, "========================\n"); + print(sh, SHELL_NORMAL, "========================\n"); } static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) { const struct wifi_twt_params *resp = (const struct wifi_twt_params *)cb->info; + const struct shell *sh = context.sh; if (resp->operation == WIFI_TWT_TEARDOWN) { if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { - print(context.sh, SHELL_NORMAL, "TWT teardown succeeded for flow ID %d\n", + print(sh, SHELL_NORMAL, "TWT teardown succeeded for flow ID %d\n", resp->flow_id); } else { - print(context.sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", + print(sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", resp->flow_id); } return; } if (resp->resp_status == WIFI_TWT_RESP_RECEIVED) { - print(context.sh, SHELL_NORMAL, "TWT response: %s\n", + print(sh, SHELL_NORMAL, "TWT response: %s\n", wifi_twt_setup_cmd_txt(resp->setup_cmd)); - print(context.sh, SHELL_NORMAL, "== TWT negotiated parameters ==\n"); + print(sh, SHELL_NORMAL, "== TWT negotiated parameters ==\n"); print_twt_params(resp->dialog_token, resp->flow_id, resp->negotiation_type, @@ -317,7 +322,7 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) resp->setup.twt_wake_interval, resp->setup.twt_interval); } else { - print(context.sh, SHELL_NORMAL, "TWT response timed out\n"); + print(sh, SHELL_NORMAL, "TWT response timed out\n"); } } @@ -325,12 +330,13 @@ static void handle_wifi_ap_enable_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *)cb->info; + const struct shell *sh = context.sh; if (status->status) { - print(context.sh, SHELL_WARNING, + print(sh, SHELL_WARNING, "AP enable request failed (%d)\n", status->status); } else { - print(context.sh, SHELL_NORMAL, "AP enabled\n"); + print(sh, SHELL_NORMAL, "AP enabled\n"); } } @@ -338,12 +344,13 @@ static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *)cb->info; + const struct shell *sh = context.sh; if (status->status) { - print(context.sh, SHELL_WARNING, + print(sh, SHELL_WARNING, "AP disable request failed (%d)\n", status->status); } else { - print(context.sh, SHELL_NORMAL, "AP disabled\n"); + print(sh, SHELL_NORMAL, "AP disabled\n"); } k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); @@ -355,10 +362,11 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) { const struct wifi_ap_sta_info *sta_info = (const struct wifi_ap_sta_info *)cb->info; + const struct shell *sh = context.sh; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; int i; - print(context.sh, SHELL_NORMAL, "Station connected: %s\n", + print(sh, SHELL_NORMAL, "Station connected: %s\n", net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, mac_string_buf, sizeof(mac_string_buf))); @@ -371,7 +379,7 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) } } if (i == CONFIG_WIFI_SHELL_MAX_AP_STA) { - print(context.sh, SHELL_WARNING, "No space to store station info: " + print(sh, SHELL_WARNING, "No space to store station info: " "Increase CONFIG_WIFI_SHELL_MAX_AP_STA\n"); } k_mutex_unlock(&wifi_ap_sta_list_lock); @@ -381,9 +389,10 @@ static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) { const struct wifi_ap_sta_info *sta_info = (const struct wifi_ap_sta_info *)cb->info; + const struct shell *sh = context.sh; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - print(context.sh, SHELL_NORMAL, "Station disconnected: %s\n", + print(sh, SHELL_NORMAL, "Station disconnected: %s\n", net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, mac_string_buf, sizeof(mac_string_buf))); @@ -449,6 +458,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], { char *endptr; int idx = 1; + const struct shell *sh = context.sh; /* Defaults */ params->band = WIFI_FREQ_BAND_UNKNOWN; @@ -459,7 +469,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->ssid = argv[0]; params->ssid_length = strlen(params->ssid); if (params->ssid_length > WIFI_SSID_MAX_LEN) { - print(context.sh, SHELL_WARNING, + print(sh, SHELL_WARNING, "SSID too long (max %d characters)\n", WIFI_SSID_MAX_LEN); return -EINVAL; @@ -477,7 +487,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], size_t offset = 0; if (*endptr != '\0') { - print(context.sh, SHELL_ERROR, + print(sh, SHELL_ERROR, "Failed to parse channel: %s: endp: %s, err: %s\n", argv[idx], endptr, @@ -520,7 +530,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], band ? "," : "", wifi_band_txt(all_bands[band])); if (offset >= sizeof(bands_str)) { - print(context.sh, SHELL_ERROR, + print(sh, SHELL_ERROR, "Failed to parse channel: %s: " "band string too long\n", argv[idx]); @@ -535,7 +545,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], } if (!found) { - print(context.sh, SHELL_ERROR, + print(sh, SHELL_ERROR, "Invalid channel: %ld, checked bands: %s\n", channel, bands_str); @@ -571,7 +581,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (security == WIFI_SECURITY_TYPE_NONE || security == WIFI_SECURITY_TYPE_WPA_PSK) { - print(context.sh, SHELL_ERROR, + print(sh, SHELL_ERROR, "MFP not supported for security type %s\n", wifi_security_txt(security)); return -EINVAL; @@ -589,7 +599,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->psk_length > WIFI_PSK_MAX_LEN) || (params->security == WIFI_SECURITY_TYPE_SAE && params->psk_length > WIFI_SAE_PSWD_MAX_LEN)) { - print(context.sh, SHELL_ERROR, + print(sh, SHELL_ERROR, "Invalid PSK length (%d) for security type %s\n", params->psk_length, wifi_security_txt(params->security)); @@ -969,7 +979,7 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) config.twt_flows[i].trigger, config.twt_flows[i].twt_wake_interval, config.twt_flows[i].twt_interval); - shell_fprintf(context.sh, SHELL_NORMAL, + shell_fprintf(sh, SHELL_NORMAL, "TWT Wake ahead duration : %d us\n", config.twt_flows[i].twt_wake_ahead_duration); } From 99f8db6805a7b18a29b3f0825df0733091f52385 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 27 Jan 2024 23:27:18 +0700 Subject: [PATCH 0460/2300] [nrf fromtree] wifi: shell: move "scan_result" variable into context struct Moved 'scan_result' from a standalone variable into the 'context' struct to enhance code optimization. Signed-off-by: Pisit Sawangvonganan (cherry picked from commit 10939c7a02120e91dc8743ee135a593e0707bd1f) (cherry picked from commit 69e85ccd9fa312dc8bbef0559ab1924a06d4d915) --- subsys/net/l2/wifi/wifi_shell.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1bda0e1610d..a181315d8c1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -52,6 +52,7 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); static struct { const struct shell *sh; + uint32_t scan_result; union { struct { @@ -64,8 +65,6 @@ static struct { }; } context; -static uint32_t scan_result; - static struct net_mgmt_event_callback wifi_shell_mgmt_cb; static struct wifi_reg_chan_info chan_info[MAX_REG_CHAN_NUM]; @@ -117,9 +116,9 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) (const struct wifi_scan_result *)cb->info; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - scan_result++; + context.scan_result++; - if (scan_result == 1U) { + if (context.scan_result == 1U) { print(context.sh, SHELL_NORMAL, "\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n", "Num", "SSID", "(len)", "Chan (Band)", "RSSI", "Security", "BSSID", "MFP"); @@ -127,7 +126,7 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) print(context.sh, SHELL_NORMAL, "%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", - scan_result, entry->ssid, entry->ssid_length, entry->channel, + context.scan_result, entry->ssid, entry->ssid_length, entry->channel, wifi_band_txt(entry->band), entry->rssi, wifi_security_txt(entry->security), @@ -186,9 +185,9 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; const struct shell *sh = context.sh; - scan_result++; + context.scan_result++; - if (scan_result == 1U) { + if (context.scan_result == 1U) { print(sh, SHELL_NORMAL, "\n%-4s | %-13s | %-4s | %-15s | %-15s | %-32s\n", "Num", "Channel (Band)", "RSSI", "BSSID", "Frame length", "Frame Body"); @@ -199,7 +198,7 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) band = wifi_freq_to_band(raw->frequency); print(sh, SHELL_NORMAL, "%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", - scan_result, + context.scan_result, channel, wifi_band_txt(band), rssi, @@ -227,7 +226,7 @@ static void handle_wifi_scan_done(struct net_mgmt_event_callback *cb) print(sh, SHELL_NORMAL, "Scan request done\n"); } - scan_result = 0U; + context.scan_result = 0U; } static void handle_wifi_connect_result(struct net_mgmt_event_callback *cb) @@ -2058,7 +2057,7 @@ static int wifi_shell_init(void) context.sh = NULL; context.all = 0U; - scan_result = 0U; + context.scan_result = 0U; net_mgmt_init_event_callback(&wifi_shell_mgmt_cb, wifi_mgmt_event_handler, From 7f820a70b55baadec6f90e3f58be0986110ec395 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sun, 28 Jan 2024 00:21:43 +0700 Subject: [PATCH 0461/2300] [nrf fromtree] wifi: shell: refactor to use PR(...) from "net_shell_private.h" Replaced direct shell_fprintf calls with PR, PR_ERROR, PR_INFO and PR_WARNING macros. This change simplifies the code by using predefined macros. Signed-off-by: Pisit Sawangvonganan (cherry picked from commit 81342132fb9e5950016a255a160e3d8cef8ef459) (cherry picked from commit 61568b94461cb3e8cc3935c2fb63ead40845be08) --- subsys/net/l2/wifi/CMakeLists.txt | 3 + subsys/net/l2/wifi/wifi_shell.c | 486 ++++++++++++++---------------- 2 files changed, 224 insertions(+), 265 deletions(-) diff --git a/subsys/net/l2/wifi/CMakeLists.txt b/subsys/net/l2/wifi/CMakeLists.txt index 445eb56c0a7..aaf825599f0 100644 --- a/subsys/net/l2/wifi/CMakeLists.txt +++ b/subsys/net/l2/wifi/CMakeLists.txt @@ -2,6 +2,9 @@ zephyr_library() zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/ip) +zephyr_library_include_directories_ifdef( + CONFIG_NET_L2_WIFI_SHELL ${ZEPHYR_BASE}/subsys/net/lib/shell + ) zephyr_library_compile_definitions_ifdef( CONFIG_NEWLIB_LIBC __LINUX_ERRNO_EXTENSIONS__ ) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index a181315d8c1..bfaa35c9a71 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -27,13 +27,13 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #include #include -#include "net_private.h" +#include "net_shell_private.h" #define WIFI_SHELL_MODULE "wifi" #define WIFI_SHELL_MGMT_EVENTS_COMMON (NET_EVENT_WIFI_SCAN_DONE |\ NET_EVENT_WIFI_CONNECT_RESULT |\ - NET_EVENT_WIFI_DISCONNECT_RESULT | \ + NET_EVENT_WIFI_DISCONNECT_RESULT |\ NET_EVENT_WIFI_TWT |\ NET_EVENT_WIFI_RAW_SCAN_RESULT |\ NET_EVENT_WIFI_AP_ENABLE_RESULT |\ @@ -57,9 +57,9 @@ static struct { union { struct { - uint8_t connecting : 1; - uint8_t disconnecting : 1; - uint8_t _unused : 6; + uint8_t connecting: 1; + uint8_t disconnecting: 1; + uint8_t _unused: 6; }; uint8_t all; }; @@ -163,9 +163,9 @@ static enum wifi_frequency_bands wifi_freq_to_band(int frequency) { enum wifi_frequency_bands band = WIFI_FREQ_BAND_2_4_GHZ; - if ((frequency >= 2401) && (frequency <= 2495)) { + if ((frequency >= 2401) && (frequency <= 2495)) { band = WIFI_FREQ_BAND_2_4_GHZ; - } else if ((frequency >= 5170) && (frequency <= 5895)) { + } else if ((frequency >= 5170) && (frequency <= 5895)) { band = WIFI_FREQ_BAND_5_GHZ; } else { band = WIFI_FREQ_BAND_6_GHZ; @@ -452,8 +452,8 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, } static int __wifi_args_to_params(size_t argc, char *argv[], - struct wifi_connect_req_params *params, - enum wifi_iface_mode iface_mode) + struct wifi_connect_req_params *params, + enum wifi_iface_mode iface_mode) { char *endptr; int idx = 1; @@ -508,14 +508,14 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->band = WIFI_FREQ_BAND_6_GHZ; break; default: - print(context.sh, SHELL_ERROR, + print(sh, SHELL_ERROR, "Invalid band: %ld\n", channel); return -EINVAL; } } } else { if (channel < 0) { - print(context.sh, SHELL_ERROR, + print(sh, SHELL_ERROR, "Invalid channel: %ld\n", channel); return -EINVAL; } @@ -524,10 +524,10 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (channel > 0) { for (band = 0; band < ARRAY_SIZE(all_bands); band++) { offset += snprintf(bands_str + offset, - sizeof(bands_str) - offset, - "%s%s", - band ? "," : "", - wifi_band_txt(all_bands[band])); + sizeof(bands_str) - offset, + "%s%s", + band ? "," : "", + wifi_band_txt(all_bands[band])); if (offset >= sizeof(bands_str)) { print(sh, SHELL_ERROR, "Failed to parse channel: %s: " @@ -546,8 +546,8 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (!found) { print(sh, SHELL_ERROR, "Invalid channel: %ld, checked bands: %s\n", - channel, - bands_str); + channel, + bands_str); return -EINVAL; } @@ -606,7 +606,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], } } - return 0; } @@ -626,14 +625,13 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, if (net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, &cnx_params, sizeof(struct wifi_connect_req_params))) { - shell_fprintf(sh, SHELL_WARNING, - "Connection request failed\n"); + PR_WARNING("Connection request failed\n"); context.connecting = false; return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "Connection requested\n"); + PR("Connection requested\n"); return 0; } @@ -653,23 +651,18 @@ static int cmd_wifi_disconnect(const struct shell *sh, size_t argc, context.disconnecting = false; if (status == -EALREADY) { - shell_fprintf(sh, SHELL_INFO, - "Already disconnected\n"); + PR_INFO("Already disconnected\n"); } else { - shell_fprintf(sh, SHELL_WARNING, - "Disconnect request failed\n"); + PR_WARNING("Disconnect request failed\n"); return -ENOEXEC; } } else { - shell_fprintf(sh, SHELL_NORMAL, - "Disconnect requested\n"); + PR("Disconnect requested\n"); } return 0; } - - static int wifi_scan_args_to_params(const struct shell *sh, size_t argc, char *argv[], @@ -702,7 +695,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, } else if (!strncasecmp(optarg, "active", 6)) { params->scan_type = WIFI_SCAN_TYPE_ACTIVE; } else { - shell_fprintf(sh, SHELL_ERROR, "Invalid scan type %s\n", optarg); + PR_ERROR("Invalid scan type %s\n", optarg); return -ENOEXEC; } @@ -710,7 +703,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, break; case 'b': if (wifi_utils_parse_scan_bands(optarg, ¶ms->bands)) { - shell_fprintf(sh, SHELL_ERROR, "Invalid band value(s)\n"); + PR_ERROR("Invalid band value(s)\n"); return -ENOEXEC; } @@ -720,7 +713,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, val = atoi(optarg); if ((val < 5) || (val > 1000)) { - shell_fprintf(sh, SHELL_ERROR, "Invalid dwell_time_active val\n"); + PR_ERROR("Invalid dwell_time_active val\n"); return -ENOEXEC; } @@ -731,7 +724,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, val = atoi(optarg); if ((val < 10) || (val > 1000)) { - shell_fprintf(sh, SHELL_ERROR, "Invalid dwell_time_passive val\n"); + PR_ERROR("Invalid dwell_time_passive val\n"); return -ENOEXEC; } @@ -742,7 +735,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, if (wifi_utils_parse_scan_ssids(optarg, params->ssids, ARRAY_SIZE(params->ssids))) { - shell_fprintf(sh, SHELL_ERROR, "Invalid SSID(s)\n"); + PR_ERROR("Invalid SSID(s)\n"); return -ENOEXEC; } @@ -752,7 +745,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, val = atoi(optarg); if ((val < 0) || (val > 65535)) { - shell_fprintf(sh, SHELL_ERROR, "Invalid max_bss val\n"); + PR_ERROR("Invalid max_bss val\n"); return -ENOEXEC; } @@ -763,9 +756,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, if (wifi_utils_parse_scan_chan(optarg, params->band_chan, ARRAY_SIZE(params->band_chan))) { - shell_fprintf(sh, - SHELL_ERROR, - "Invalid band or channel value(s)\n"); + PR_ERROR("Invalid band or channel value(s)\n"); return -ENOEXEC; } @@ -778,8 +769,8 @@ static int wifi_scan_args_to_params(const struct shell *sh, break; case '?': default: - shell_fprintf(sh, SHELL_ERROR, "Invalid option or option usage: %s\n", - argv[opt_index + 1]); + PR_ERROR("Invalid option or option usage: %s\n", + argv[opt_index + 1]); return -ENOEXEC; } } @@ -803,23 +794,23 @@ static int cmd_wifi_scan(const struct shell *sh, size_t argc, char *argv[]) shell_help(sh); return -ENOEXEC; } else if (!opt_num) { - shell_fprintf(sh, SHELL_WARNING, "No valid option(s) found\n"); + PR_WARNING("No valid option(s) found\n"); do_scan = false; } } if (do_scan) { if (net_mgmt(NET_REQUEST_WIFI_SCAN, iface, ¶ms, sizeof(params))) { - shell_fprintf(sh, SHELL_WARNING, "Scan request failed\n"); + PR_WARNING("Scan request failed\n"); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "Scan requested\n"); + PR("Scan requested\n"); return 0; } - shell_fprintf(sh, SHELL_WARNING, "Scan not initiated\n"); + PR_WARNING("Scan not initiated\n"); return -ENOEXEC; } @@ -831,43 +822,37 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) context.sh = sh; if (net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, iface, &status, - sizeof(struct wifi_iface_status))) { - shell_fprintf(sh, SHELL_WARNING, "Status request failed\n"); + sizeof(struct wifi_iface_status))) { + PR_WARNING("Status request failed\n"); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "Status: successful\n"); - shell_fprintf(sh, SHELL_NORMAL, "==================\n"); - shell_fprintf(sh, SHELL_NORMAL, "State: %s\n", wifi_state_txt(status.state)); + PR("Status: successful\n"); + PR("==================\n"); + PR("State: %s\n", wifi_state_txt(status.state)); if (status.state >= WIFI_STATE_ASSOCIATED) { uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - shell_fprintf(sh, SHELL_NORMAL, "Interface Mode: %s\n", - wifi_mode_txt(status.iface_mode)); - shell_fprintf(sh, SHELL_NORMAL, "Link Mode: %s\n", - wifi_link_mode_txt(status.link_mode)); - shell_fprintf(sh, SHELL_NORMAL, "SSID: %.32s\n", status.ssid); - shell_fprintf(sh, SHELL_NORMAL, "BSSID: %s\n", - net_sprint_ll_addr_buf(status.bssid, + 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)) - ); - shell_fprintf(sh, SHELL_NORMAL, "Band: %s\n", - wifi_band_txt(status.band)); - shell_fprintf(sh, SHELL_NORMAL, "Channel: %d\n", status.channel); - shell_fprintf(sh, SHELL_NORMAL, "Security: %s\n", - wifi_security_txt(status.security)); - shell_fprintf(sh, SHELL_NORMAL, "MFP: %s\n", - wifi_mfp_txt(status.mfp)); + 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) { - shell_fprintf(sh, SHELL_NORMAL, "RSSI: %d\n", status.rssi); + PR("RSSI: %d\n", status.rssi); } - shell_fprintf(sh, SHELL_NORMAL, "Beacon Interval: %d\n", status.beacon_interval); - shell_fprintf(sh, SHELL_NORMAL, "DTIM: %d\n", status.dtim_period); - shell_fprintf(sh, SHELL_NORMAL, "TWT: %s\n", - status.twt_capable ? "Supported" : "Not supported"); + 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; @@ -876,24 +861,23 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) #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, - const struct shell *sh) + const struct shell *sh) { - shell_fprintf(sh, SHELL_NORMAL, "Statistics for Wi-Fi interface %p [%d]\n", iface, - net_if_get_by_iface(iface)); - - shell_fprintf(sh, SHELL_NORMAL, "Bytes received : %u\n", data->bytes.received); - shell_fprintf(sh, SHELL_NORMAL, "Bytes sent : %u\n", data->bytes.sent); - shell_fprintf(sh, SHELL_NORMAL, "Packets received : %u\n", data->pkts.rx); - shell_fprintf(sh, SHELL_NORMAL, "Packets sent : %u\n", data->pkts.tx); - shell_fprintf(sh, SHELL_NORMAL, "Receive errors : %u\n", data->errors.rx); - shell_fprintf(sh, SHELL_NORMAL, "Send errors : %u\n", data->errors.tx); - shell_fprintf(sh, SHELL_NORMAL, "Bcast received : %u\n", data->broadcast.rx); - shell_fprintf(sh, SHELL_NORMAL, "Bcast sent : %u\n", data->broadcast.tx); - shell_fprintf(sh, SHELL_NORMAL, "Mcast received : %u\n", data->multicast.rx); - shell_fprintf(sh, SHELL_NORMAL, "Mcast sent : %u\n", data->multicast.tx); - shell_fprintf(sh, SHELL_NORMAL, "Beacons received : %u\n", data->sta_mgmt.beacons_rx); - shell_fprintf(sh, SHELL_NORMAL, "Beacons missed : %u\n", - data->sta_mgmt.beacons_miss); + PR("Statistics for Wi-Fi interface %p [%d]\n", iface, + net_if_get_by_iface(iface)); + + PR("Bytes received : %u\n", data->bytes.received); + PR("Bytes sent : %u\n", data->bytes.sent); + PR("Packets received : %u\n", data->pkts.rx); + PR("Packets sent : %u\n", data->pkts.tx); + PR("Receive errors : %u\n", data->errors.rx); + PR("Send errors : %u\n", data->errors.tx); + PR("Bcast received : %u\n", data->broadcast.rx); + PR("Bcast sent : %u\n", data->broadcast.tx); + PR("Mcast received : %u\n", data->multicast.rx); + PR("Mcast sent : %u\n", data->multicast.tx); + PR("Beacons received : %u\n", data->sta_mgmt.beacons_rx); + PR("Beacons missed : %u\n", data->sta_mgmt.beacons_miss); } #endif /* CONFIG_NET_STATISTICS_WIFI && CONFIG_NET_STATISTICS_USER_API */ @@ -914,7 +898,7 @@ static int cmd_wifi_stats(const struct shell *sh, size_t argc, char *argv[]) ARG_UNUSED(argc); ARG_UNUSED(argv); - shell_fprintf(sh, SHELL_INFO, "Set %s to enable %s support.\n", + PR_INFO("Set %s to enable %s support.\n", "CONFIG_NET_STATISTICS_WIFI and CONFIG_NET_STATISTICS_USER_API", "statistics"); #endif /* CONFIG_NET_STATISTICS_WIFI && CONFIG_NET_STATISTICS_USER_API */ @@ -930,7 +914,7 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) context.sh = sh; if (argc > 2) { - shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); + PR_WARNING("Invalid number of arguments\n"); return -ENOEXEC; } @@ -939,33 +923,32 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) if (net_mgmt(NET_REQUEST_WIFI_PS_CONFIG, iface, &config, sizeof(config))) { - shell_fprintf(sh, SHELL_WARNING, "Failed to get PS config\n"); + PR_WARNING("Failed to get PS config\n"); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "PS status: %s\n", - wifi_ps_txt(config.ps_params.enabled)); + PR("PS status: %s\n", + wifi_ps_txt(config.ps_params.enabled)); if (config.ps_params.enabled) { - shell_fprintf(sh, SHELL_NORMAL, "PS mode: %s\n", - wifi_ps_mode_txt(config.ps_params.mode)); + PR("PS mode: %s\n", + wifi_ps_mode_txt(config.ps_params.mode)); } - shell_fprintf(sh, SHELL_NORMAL, "PS listen_interval: %d\n", - config.ps_params.listen_interval); + PR("PS listen_interval: %d\n", + config.ps_params.listen_interval); - shell_fprintf(sh, SHELL_NORMAL, "PS wake up mode: %s\n", - config.ps_params.wakeup_mode ? "Listen interval" : "DTIM"); + PR("PS wake up mode: %s\n", + config.ps_params.wakeup_mode ? "Listen interval" : "DTIM"); if (config.ps_params.timeout_ms) { - shell_fprintf(sh, SHELL_NORMAL, "PS timeout: %d ms\n", - config.ps_params.timeout_ms); + PR("PS timeout: %d ms\n", + config.ps_params.timeout_ms); } else { - shell_fprintf(sh, SHELL_NORMAL, "PS timeout: disabled\n"); + PR("PS timeout: disabled\n"); } - if (config.num_twt_flows == 0) { - shell_fprintf(sh, SHELL_NORMAL, "No TWT flows\n"); + PR("No TWT flows\n"); } else { for (int i = 0; i < config.num_twt_flows; i++) { print_twt_params( @@ -978,9 +961,8 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) config.twt_flows[i].trigger, config.twt_flows[i].twt_wake_interval, config.twt_flows[i].twt_interval); - shell_fprintf(sh, SHELL_NORMAL, - "TWT Wake ahead duration : %d us\n", - config.twt_flows[i].twt_wake_ahead_duration); + PR("TWT Wake ahead duration : %d us\n", + config.twt_flows[i].twt_wake_ahead_duration); } } return 0; @@ -991,21 +973,20 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) } else if (!strncasecmp(argv[1], "off", 3)) { params.enabled = WIFI_PS_DISABLED; } else { - shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n"); + PR_WARNING("Invalid argument\n"); return -ENOEXEC; } params.type = WIFI_PS_PARAM_STATE; if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { - shell_fprintf(sh, SHELL_WARNING, - "PS %s failed. Reason: %s\n", - params.enabled ? "enable" : "disable", - wifi_ps_get_config_err_code_str(params.fail_reason)); + PR_WARNING("PS %s failed. Reason: %s\n", + params.enabled ? "enable" : "disable", + wifi_ps_get_config_err_code_str(params.fail_reason)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "%s\n", wifi_ps_txt(params.enabled)); + PR("%s\n", wifi_ps_txt(params.enabled)); return 0; } @@ -1022,20 +1003,20 @@ static int cmd_wifi_ps_mode(const struct shell *sh, size_t argc, char *argv[]) } else if (!strncasecmp(argv[1], "WMM", 3)) { params.mode = WIFI_PS_MODE_WMM; } else { - shell_fprintf(sh, SHELL_WARNING, "Invalid PS mode\n"); + PR_WARNING("Invalid PS mode\n"); return -ENOEXEC; } params.type = WIFI_PS_PARAM_MODE; if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { - shell_fprintf(sh, SHELL_WARNING, "%s failed Reason : %s\n", - wifi_ps_mode_txt(params.mode), - wifi_ps_get_config_err_code_str(params.fail_reason)); + PR_WARNING("%s failed Reason : %s\n", + wifi_ps_mode_txt(params.mode), + wifi_ps_get_config_err_code_str(params.fail_reason)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "%s\n", wifi_ps_mode_txt(params.mode)); + PR("%s\n", wifi_ps_mode_txt(params.mode)); return 0; } @@ -1060,23 +1041,22 @@ static int cmd_wifi_ps_timeout(const struct shell *sh, size_t argc, char *argv[] params.type = WIFI_PS_PARAM_TIMEOUT; if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { - shell_fprintf(sh, SHELL_WARNING, - "Setting PS timeout failed. Reason : %s\n", - wifi_ps_get_config_err_code_str(params.fail_reason)); + PR_WARNING("Setting PS timeout failed. Reason : %s\n", + wifi_ps_get_config_err_code_str(params.fail_reason)); return -ENOEXEC; } if (params.timeout_ms) { - shell_fprintf(sh, SHELL_NORMAL, "PS timeout: %d ms\n", params.timeout_ms); + PR("PS timeout: %d ms\n", params.timeout_ms); } else { - shell_fprintf(sh, SHELL_NORMAL, "PS timeout: disabled\n"); + PR("PS timeout: disabled\n"); } return 0; } static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc, - char *argv[]) + char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); struct wifi_twt_params params = { 0 }; @@ -1107,22 +1087,21 @@ static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc, params.setup.twt_interval = (uint64_t)value; if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { - shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n", - wifi_twt_operation_txt(params.operation), - wifi_twt_negotiation_type_txt(params.negotiation_type), - wifi_twt_get_err_code_str(params.fail_reason)); + PR_WARNING("%s with %s failed, reason : %s\n", + wifi_twt_operation_txt(params.operation), + wifi_twt_negotiation_type_txt(params.negotiation_type), + wifi_twt_get_err_code_str(params.fail_reason)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "TWT operation %s with dg: %d, flow_id: %d requested\n", - wifi_twt_operation_txt(params.operation), - params.dialog_token, params.flow_id); + PR("TWT operation %s with dg: %d, flow_id: %d requested\n", + wifi_twt_operation_txt(params.operation), + params.dialog_token, params.flow_id); return 0; } - static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, char *argv[]) { @@ -1193,23 +1172,23 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, params.setup.twt_wake_ahead_duration = (uint32_t)value; if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { - shell_fprintf(sh, SHELL_WARNING, "%s with %s failed. reason : %s\n", - wifi_twt_operation_txt(params.operation), - wifi_twt_negotiation_type_txt(params.negotiation_type), - wifi_twt_get_err_code_str(params.fail_reason)); + PR_WARNING("%s with %s failed. reason : %s\n", + wifi_twt_operation_txt(params.operation), + wifi_twt_negotiation_type_txt(params.negotiation_type), + wifi_twt_get_err_code_str(params.fail_reason)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "TWT operation %s with dg: %d, flow_id: %d requested\n", - wifi_twt_operation_txt(params.operation), - params.dialog_token, params.flow_id); + PR("TWT operation %s with dg: %d, flow_id: %d requested\n", + wifi_twt_operation_txt(params.operation), + params.dialog_token, params.flow_id); return 0; } static int cmd_wifi_twt_teardown(const struct shell *sh, size_t argc, - char *argv[]) + char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); struct wifi_twt_params params = { 0 }; @@ -1243,23 +1222,23 @@ static int cmd_wifi_twt_teardown(const struct shell *sh, size_t argc, params.flow_id = (uint8_t)value; if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { - shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n", - wifi_twt_operation_txt(params.operation), - wifi_twt_negotiation_type_txt(params.negotiation_type), - wifi_twt_get_err_code_str(params.fail_reason)); + PR_WARNING("%s with %s failed, reason : %s\n", + wifi_twt_operation_txt(params.operation), + wifi_twt_negotiation_type_txt(params.negotiation_type), + wifi_twt_get_err_code_str(params.fail_reason)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "TWT operation %s with dg: %d, flow_id: %d success\n", - wifi_twt_operation_txt(params.operation), - params.dialog_token, params.flow_id); + PR("TWT operation %s with dg: %d, flow_id: %d success\n", + wifi_twt_operation_txt(params.operation), + params.dialog_token, params.flow_id); return 0; } static int cmd_wifi_twt_teardown_all(const struct shell *sh, size_t argc, - char *argv[]) + char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); struct wifi_twt_params params = { 0 }; @@ -1270,16 +1249,16 @@ static int cmd_wifi_twt_teardown_all(const struct shell *sh, size_t argc, params.teardown.teardown_all = 1; if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { - shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n", - wifi_twt_operation_txt(params.operation), - wifi_twt_negotiation_type_txt(params.negotiation_type), - wifi_twt_get_err_code_str(params.fail_reason)); + PR_WARNING("%s with %s failed, reason : %s\n", + wifi_twt_operation_txt(params.operation), + wifi_twt_negotiation_type_txt(params.negotiation_type), + wifi_twt_get_err_code_str(params.fail_reason)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "TWT operation %s all flows success\n", - wifi_twt_operation_txt(params.operation)); + PR("TWT operation %s all flows success\n", + wifi_twt_operation_txt(params.operation)); return 0; } @@ -1300,13 +1279,13 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, k_mutex_init(&wifi_ap_sta_list_lock); ret = net_mgmt(NET_REQUEST_WIFI_AP_ENABLE, iface, &cnx_params, - sizeof(struct wifi_connect_req_params)); + sizeof(struct wifi_connect_req_params)); if (ret) { - shell_fprintf(sh, SHELL_WARNING, "AP mode enable failed: %s\n", strerror(-ret)); + PR_WARNING("AP mode enable failed: %s\n", strerror(-ret)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "AP mode enable requested\n"); + PR("AP mode enable requested\n"); return 0; } @@ -1319,11 +1298,11 @@ static int cmd_wifi_ap_disable(const struct shell *sh, size_t argc, ret = net_mgmt(NET_REQUEST_WIFI_AP_DISABLE, iface, NULL, 0); if (ret) { - shell_fprintf(sh, SHELL_WARNING, "AP mode disable failed: %s\n", strerror(-ret)); + PR_WARNING("AP mode disable failed: %s\n", strerror(-ret)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "AP mode disable requested\n"); + PR("AP mode disable requested\n"); return 0; } @@ -1335,8 +1314,8 @@ static int cmd_wifi_ap_stations(const struct shell *sh, size_t argc, ARG_UNUSED(argv); ARG_UNUSED(argc); - shell_fprintf(sh, SHELL_NORMAL, "AP stations:\n"); - shell_fprintf(sh, SHELL_NORMAL, "============\n"); + PR("AP stations:\n"); + PR("============\n"); k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); for (int i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { @@ -1349,21 +1328,21 @@ static int cmd_wifi_ap_stations(const struct shell *sh, size_t argc, sta = &sta_list[i].sta_info; - shell_fprintf(sh, SHELL_NORMAL, "Station %zu:\n", id++); - shell_fprintf(sh, SHELL_NORMAL, "==========\n"); - shell_fprintf(sh, SHELL_NORMAL, "MAC: %s\n", - net_sprint_ll_addr_buf(sta->mac, - WIFI_MAC_ADDR_LEN, - mac_string_buf, - sizeof(mac_string_buf))); - shell_fprintf(sh, SHELL_NORMAL, "Link mode: %s\n", - wifi_link_mode_txt(sta->link_mode)); - shell_fprintf(sh, SHELL_NORMAL, "TWT: %s\n", - sta->twt_capable ? "Supported" : "Not supported"); + PR("Station %zu:\n", id++); + PR("==========\n"); + PR("MAC: %s\n", + net_sprint_ll_addr_buf(sta->mac, + WIFI_MAC_ADDR_LEN, + mac_string_buf, + sizeof(mac_string_buf))); + PR("Link mode: %s\n", + wifi_link_mode_txt(sta->link_mode)); + PR("TWT: %s\n", + sta->twt_capable ? "Supported" : "Not supported"); } if (id == 1) { - shell_fprintf(sh, SHELL_NORMAL, "No stations connected\n"); + PR("No stations connected\n"); } k_mutex_unlock(&wifi_ap_sta_list_lock); @@ -1384,18 +1363,18 @@ static int cmd_wifi_ap_sta_disconnect(const struct shell *sh, size_t argc, } if (net_bytes_from_str(mac, sizeof(mac), argv[1]) < 0) { - shell_fprintf(sh, SHELL_WARNING, "Invalid MAC address\n"); + PR_WARNING("Invalid MAC address\n"); return -ENOEXEC; } ret = net_mgmt(NET_REQUEST_WIFI_AP_STA_DISCONNECT, iface, mac, sizeof(mac)); if (ret) { - shell_fprintf(sh, SHELL_WARNING, "AP station disconnect failed: %s\n", - strerror(-ret)); + PR_WARNING("AP station disconnect failed: %s\n", + strerror(-ret)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "AP station disconnect requested\n"); + PR("AP station disconnect requested\n"); return 0; } @@ -1412,8 +1391,7 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, } else if (argc >= 2 && argc <= 3) { regd.oper = WIFI_MGMT_SET; if (strlen(argv[1]) != 2) { - shell_fprintf(sh, SHELL_WARNING, - "Invalid reg domain: Length should be two letters/digits\n"); + PR_WARNING("Invalid reg domain: Length should be two letters/digits\n"); return -ENOEXEC; } @@ -1421,8 +1399,7 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, if (((argv[1][0] < 'A' || argv[1][0] > 'Z') || (argv[1][1] < 'A' || argv[1][1] > 'Z')) && (argv[1][0] != '0' || argv[1][1] != '0')) { - shell_fprintf(sh, SHELL_WARNING, "Invalid reg domain %c%c\n", argv[1][0], - argv[1][1]); + PR_WARNING("Invalid reg domain %c%c\n", argv[1][0], argv[1][1]); return -ENOEXEC; } regd.country_code[0] = argv[1][0]; @@ -1432,7 +1409,7 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, if (strncmp(argv[2], "-f", 2) == 0) { regd.force = true; } else { - shell_fprintf(sh, SHELL_WARNING, "Invalid option %s\n", argv[2]); + PR_WARNING("Invalid option %s\n", argv[2]); return -ENOEXEC; } } @@ -1444,30 +1421,28 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, ret = net_mgmt(NET_REQUEST_WIFI_REG_DOMAIN, iface, ®d, sizeof(regd)); if (ret) { - shell_fprintf(sh, SHELL_WARNING, "Cannot %s Regulatory domain: %d\n", - regd.oper == WIFI_MGMT_GET ? "get" : "set", ret); + PR_WARNING("Cannot %s Regulatory domain: %d\n", + regd.oper == WIFI_MGMT_GET ? "get" : "set", ret); return -ENOEXEC; } if (regd.oper == WIFI_MGMT_GET) { - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Regulatory domain is: %c%c\n", - regd.country_code[0], regd.country_code[1]); - shell_fprintf(sh, SHELL_NORMAL, - "\t

\t\t" - "\t\t\n"); + PR("Wi-Fi Regulatory domain is: %c%c\n", + regd.country_code[0], regd.country_code[1]); + PR("\t
\t\t" + "\t\t\n"); for (chan_idx = 0; chan_idx < regd.num_channels; chan_idx++) { - shell_fprintf(sh, SHELL_NORMAL, - " %d\t\t\t\%d\t\t\t\%s\t\t\t%d\t\t\t%s\t\t\t\t%s\n", - wifi_freq_to_channel(chan_info[chan_idx].center_frequency), - chan_info[chan_idx].center_frequency, - chan_info[chan_idx].supported ? "y" : "n", - chan_info[chan_idx].max_power, - chan_info[chan_idx].passive_only ? "y" : "n", - chan_info[chan_idx].dfs ? "y" : "n"); + PR(" %d\t\t\t\%d\t\t\t\%s\t\t\t%d\t\t\t%s\t\t\t\t%s\n", + wifi_freq_to_channel(chan_info[chan_idx].center_frequency), + chan_info[chan_idx].center_frequency, + chan_info[chan_idx].supported ? "y" : "n", + chan_info[chan_idx].max_power, + chan_info[chan_idx].passive_only ? "y" : "n", + chan_info[chan_idx].dfs ? "y" : "n"); } } else { - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Regulatory domain set to: %c%c\n", - regd.country_code[0], regd.country_code[1]); + PR("Wi-Fi Regulatory domain set to: %c%c\n", + regd.country_code[0], regd.country_code[1]); } return 0; @@ -1493,21 +1468,17 @@ static int cmd_wifi_listen_interval(const struct shell *sh, size_t argc, char *a if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { if (params.fail_reason == WIFI_PS_PARAM_LISTEN_INTERVAL_RANGE_INVALID) { - shell_fprintf(sh, SHELL_WARNING, - "Setting listen interval failed. Reason :%s\n", - wifi_ps_get_config_err_code_str(params.fail_reason)); - shell_fprintf(sh, SHELL_WARNING, - "Hardware support valid range : 3 - 65535\n"); - } else { - shell_fprintf(sh, SHELL_WARNING, - "Setting listen interval failed. Reason :%s\n", - wifi_ps_get_config_err_code_str(params.fail_reason)); + 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)); } return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, - "Listen interval %hu\n", params.listen_interval); + PR("Listen interval %hu\n", params.listen_interval); return 0; } @@ -1524,24 +1495,21 @@ static int cmd_wifi_ps_wakeup_mode(const struct shell *sh, size_t argc, char *ar } else if (!strncasecmp(argv[1], "listen_interval", 15)) { params.wakeup_mode = WIFI_PS_WAKEUP_MODE_LISTEN_INTERVAL; } else { - shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n"); - shell_fprintf(sh, SHELL_INFO, - "Valid argument : / \n"); + PR_WARNING("Invalid argument\n"); + PR_INFO("Valid argument : / \n"); return -ENOEXEC; } params.type = WIFI_PS_PARAM_WAKEUP_MODE; if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { - shell_fprintf(sh, SHELL_WARNING, - "Setting PS wake up mode to %s failed..Reason :%s\n", - params.wakeup_mode ? "Listen interval" : "DTIM interval", - wifi_ps_get_config_err_code_str(params.fail_reason)); + PR_WARNING("Setting PS wake up mode to %s failed..Reason :%s\n", + params.wakeup_mode ? "Listen interval" : "DTIM interval", + wifi_ps_get_config_err_code_str(params.fail_reason)); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "%s\n", - wifi_ps_wakeup_mode_txt(params.wakeup_mode)); + PR("%s\n", wifi_ps_wakeup_mode_txt(params.wakeup_mode)); return 0; } @@ -1604,7 +1572,7 @@ static int cmd_wifi_mode(const struct shell *sh, size_t argc, char *argv[]) mode_info.oper = WIFI_MGMT_SET; parse_mode_args_to_params(sh, argc, argv, &mode_info, &do_mode_oper); } else { - shell_fprintf(sh, SHELL_ERROR, "Invalid number of arguments\n"); + PR_ERROR("Invalid number of arguments\n"); return -EINVAL; } @@ -1615,17 +1583,15 @@ static int cmd_wifi_mode(const struct shell *sh, size_t argc, char *argv[]) if (mode_info.if_index == 0) { iface = net_if_get_first_wifi(); if (iface == NULL) { - shell_fprintf(sh, SHELL_ERROR, - "Cannot find the default wifi interface\n"); + PR_ERROR("Cannot find the default wifi interface\n"); return -ENOEXEC; } mode_info.if_index = net_if_get_by_iface(iface); } else { iface = net_if_get_by_index(mode_info.if_index); if (iface == NULL) { - shell_fprintf(sh, SHELL_ERROR, - "Cannot find interface for if_index %d\n", - mode_info.if_index); + PR_ERROR("Cannot find interface for if_index %d\n", + mode_info.if_index); return -ENOEXEC; } } @@ -1633,16 +1599,15 @@ static int cmd_wifi_mode(const struct shell *sh, size_t argc, char *argv[]) ret = net_mgmt(NET_REQUEST_WIFI_MODE, iface, &mode_info, sizeof(mode_info)); if (ret) { - shell_fprintf(sh, SHELL_ERROR, "mode %s operation failed with reason %d\n", - mode_info.oper == WIFI_MGMT_GET ? "get" : "set", ret); + PR_ERROR("mode %s operation failed with reason %d\n", + mode_info.oper == WIFI_MGMT_GET ? "get" : "set", ret); return -ENOEXEC; } if (mode_info.oper == WIFI_MGMT_GET) { - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi current mode is %x\n", - mode_info.mode); + PR("Wi-Fi current mode is %x\n", mode_info.mode); } else { - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi mode set to %x\n", mode_info.mode); + PR("Wi-Fi mode set to %x\n", mode_info.mode); } } return 0; @@ -1661,7 +1626,7 @@ void parse_channel_args_to_params(const struct shell *sh, int argc, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; - while ((opt = getopt_long(argc, argv, "i:c:gh", long_options, &option_index)) != -1) { + while ((opt = getopt_long(argc, argv, "i:c:gh", long_options, &option_index)) != -1) { switch (opt) { case 'c': channel->channel = (uint16_t)atoi(optarg); @@ -1704,17 +1669,15 @@ static int cmd_wifi_channel(const struct shell *sh, size_t argc, char *argv[]) if (channel_info.if_index == 0) { iface = net_if_get_first_wifi(); if (iface == NULL) { - shell_fprintf(sh, SHELL_ERROR, - "Cannot find the default wifi interface\n"); + PR_ERROR("Cannot find the default wifi interface\n"); return -ENOEXEC; } channel_info.if_index = net_if_get_by_iface(iface); } else { iface = net_if_get_by_index(channel_info.if_index); if (iface == NULL) { - shell_fprintf(sh, SHELL_ERROR, - "Cannot find interface for if_index %d\n", - channel_info.if_index); + PR_ERROR("Cannot find interface for if_index %d\n", + channel_info.if_index); return -ENOEXEC; } } @@ -1722,28 +1685,24 @@ static int cmd_wifi_channel(const struct shell *sh, size_t argc, char *argv[]) if (channel_info.oper == WIFI_MGMT_SET) { if ((channel_info.channel < WIFI_CHANNEL_MIN) || (channel_info.channel > WIFI_CHANNEL_MAX)) { - shell_fprintf(sh, SHELL_ERROR, - "Invalid channel number. Range is (1-233)\n"); + PR_ERROR("Invalid channel number. Range is (1-233)\n"); return -ENOEXEC; } } - ret = net_mgmt(NET_REQUEST_WIFI_CHANNEL, iface, - &channel_info, sizeof(channel_info)); + ret = net_mgmt(NET_REQUEST_WIFI_CHANNEL, iface, &channel_info, + sizeof(channel_info)); if (ret) { - shell_fprintf(sh, SHELL_ERROR, - "channel %s operation failed with reason %d\n", - channel_info.oper == WIFI_MGMT_GET ? "get" : "set", ret); + PR_ERROR("channel %s operation failed with reason %d\n", + channel_info.oper == WIFI_MGMT_GET ? "get" : "set", ret); return -ENOEXEC; } if (channel_info.oper == WIFI_MGMT_GET) { - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi current channel is: %d\n", - channel_info.channel); + PR("Wi-Fi current channel is: %d\n", channel_info.channel); } else { - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi channel set to %d\n", - channel_info.channel); + PR("Wi-Fi channel set to %d\n", channel_info.channel); } } return 0; @@ -1766,7 +1725,7 @@ void parse_filter_args_to_params(const struct shell *sh, int argc, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; - while ((opt = getopt_long(argc, argv, "i:b:amcdgh", long_options, &option_index)) != -1) { + while ((opt = getopt_long(argc, argv, "i:b:amcdgh", long_options, &option_index)) != -1) { switch (opt) { case 'a': filter->filter |= WIFI_PACKET_FILTER_ALL; @@ -1821,37 +1780,34 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg if (packet_filter.if_index == 0) { iface = net_if_get_first_wifi(); if (iface == NULL) { - shell_fprintf(sh, SHELL_ERROR, - "Cannot find the default wifi interface\n"); + PR_ERROR("Cannot find the default wifi interface\n"); return -ENOEXEC; } packet_filter.if_index = net_if_get_by_iface(iface); } else { iface = net_if_get_by_index(packet_filter.if_index); if (iface == NULL) { - shell_fprintf(sh, SHELL_ERROR, - "Cannot find interface for if_index %d\n", - packet_filter.if_index); + PR_ERROR("Cannot find interface for if_index %d\n", + packet_filter.if_index); return -ENOEXEC; } } - ret = net_mgmt(NET_REQUEST_WIFI_PACKET_FILTER, iface, - &packet_filter, sizeof(packet_filter)); + ret = net_mgmt(NET_REQUEST_WIFI_PACKET_FILTER, iface, &packet_filter, + sizeof(packet_filter)); if (ret) { - shell_fprintf(sh, SHELL_ERROR, - "Wi-Fi packet filter %s operation failed with reason %d\n", - packet_filter.oper == WIFI_MGMT_GET ? "get" : "set", ret); + PR_ERROR("Wi-Fi packet filter %s operation failed with reason %d\n", + packet_filter.oper == WIFI_MGMT_GET ? "get" : "set", ret); return -ENOEXEC; } if (packet_filter.oper == WIFI_MGMT_GET) { - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi current mode packet filter is %d\n", - packet_filter.filter); + PR("Wi-Fi current mode packet filter is %d\n", + packet_filter.filter); } else { - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi mode packet filter set to %d\n", - packet_filter.filter); + PR("Wi-Fi mode packet filter set to %d\n", + packet_filter.filter); } } return 0; @@ -1863,17 +1819,17 @@ static int cmd_wifi_version(const struct shell *sh, size_t argc, char *argv[]) struct wifi_version version = {0}; if (argc > 1) { - shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); + PR_WARNING("Invalid number of arguments\n"); return -ENOEXEC; } if (net_mgmt(NET_REQUEST_WIFI_VERSION, iface, &version, sizeof(version))) { - shell_fprintf(sh, SHELL_WARNING, "Failed to get Wi-Fi versions\n"); + PR_WARNING("Failed to get Wi-Fi versions\n"); return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Driver Version: %s\n", version.drv_version); - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Firmware Version: %s\n", version.fw_version); + PR("Wi-Fi Driver Version: %s\n", version.drv_version); + PR("Wi-Fi Firmware Version: %s\n", version.fw_version); return 0; } From 09d53a0fc0039662a8785ae16dee4d34a55a432a Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Wed, 31 Jan 2024 21:37:07 +0700 Subject: [PATCH 0462/2300] [nrf fromtree] wifi: shell: replace print(...) with PR(...) Additionally, replace the local print(sh, level, fmt, ...) macros with PR, PR_ERROR, and PR_WARNING macros. Then remove the print(sh, level, fmt, ...) macros. Signed-off-by: Pisit Sawangvonganan (cherry picked from commit 055ac615427fd55fa347cd1744280734e730a42a) (cherry picked from commit 9e1de3d954561a372926ec00423a519e888fd9dd) --- subsys/net/l2/wifi/wifi_shell.c | 193 ++++++++++++++------------------ 1 file changed, 86 insertions(+), 107 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index bfaa35c9a71..304f1748bfe 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -75,15 +75,6 @@ struct wifi_ap_sta_node { }; static struct wifi_ap_sta_node sta_list[CONFIG_WIFI_SHELL_MAX_AP_STA]; -#define print(sh, level, fmt, ...) \ - do { \ - if (sh) { \ - shell_fprintf(sh, level, fmt, ##__VA_ARGS__); \ - } else { \ - printk(fmt, ##__VA_ARGS__); \ - } \ - } while (false) - static bool parse_number(const struct shell *sh, long *param, char *str, long min, long max) { char *endptr; @@ -98,12 +89,12 @@ static bool parse_number(const struct shell *sh, long *param, char *str, long mi } if (*endptr != '\0') { - print(sh, SHELL_ERROR, "Invalid number: %s", str_tmp); + PR_ERROR("Invalid number: %s", str_tmp); return false; } if ((num) < (min) || (num) > (max)) { - print(sh, SHELL_WARNING, "Value out of range: %s, (%ld-%ld)", str_tmp, min, max); + PR_WARNING("Value out of range: %s, (%ld-%ld)", str_tmp, min, max); return false; } *param = num; @@ -115,26 +106,25 @@ static void handle_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")]; + const struct shell *sh = context.sh; context.scan_result++; if (context.scan_result == 1U) { - print(context.sh, SHELL_NORMAL, - "\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n", - "Num", "SSID", "(len)", "Chan (Band)", "RSSI", "Security", "BSSID", "MFP"); - } - - print(context.sh, SHELL_NORMAL, - "%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", - context.scan_result, entry->ssid, 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)); + PR("\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n", + "Num", "SSID", "(len)", "Chan (Band)", "RSSI", "Security", "BSSID", "MFP"); + } + + PR("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", + context.scan_result, entry->ssid, 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 int wifi_freq_to_channel(int frequency) @@ -188,28 +178,27 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) context.scan_result++; if (context.scan_result == 1U) { - print(sh, SHELL_NORMAL, - "\n%-4s | %-13s | %-4s | %-15s | %-15s | %-32s\n", - "Num", "Channel (Band)", "RSSI", "BSSID", "Frame length", "Frame Body"); + PR("\n%-4s | %-13s | %-4s | %-15s | %-15s | %-32s\n", + "Num", "Channel (Band)", "RSSI", "BSSID", "Frame length", "Frame Body"); } rssi = raw->rssi; channel = wifi_freq_to_channel(raw->frequency); band = wifi_freq_to_band(raw->frequency); - print(sh, SHELL_NORMAL, "%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", - context.scan_result, - channel, - wifi_band_txt(band), - rssi, - net_sprint_ll_addr_buf(raw->data + 10, WIFI_MAC_ADDR_LEN, mac_string_buf, - sizeof(mac_string_buf)), raw->frame_length); + PR("%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", + context.scan_result, + channel, + wifi_band_txt(band), + rssi, + net_sprint_ll_addr_buf(raw->data + 10, WIFI_MAC_ADDR_LEN, mac_string_buf, + sizeof(mac_string_buf)), raw->frame_length); for (i = 0; i < 32; i++) { - print(sh, SHELL_NORMAL, "%02X ", *(raw->data + i)); + PR("%02X ", *(raw->data + i)); } - print(sh, SHELL_NORMAL, "\n"); + PR("\n"); } #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ @@ -220,10 +209,9 @@ static void handle_wifi_scan_done(struct net_mgmt_event_callback *cb) const struct shell *sh = context.sh; if (status->status) { - print(sh, SHELL_WARNING, - "Scan request failed (%d)\n", status->status); + PR_WARNING("Scan request failed (%d)\n", status->status); } else { - print(sh, SHELL_NORMAL, "Scan request done\n"); + PR("Scan request done\n"); } context.scan_result = 0U; @@ -233,12 +221,12 @@ static void handle_wifi_connect_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *) cb->info; + const struct shell *sh = context.sh; if (status->status) { - print(context.sh, SHELL_WARNING, - "Connection request failed (%d)\n", status->status); + PR_WARNING("Connection request failed (%d)\n", status->status); } else { - print(context.sh, SHELL_NORMAL, "Connected\n"); + PR("Connected\n"); } context.connecting = false; @@ -248,16 +236,17 @@ static void handle_wifi_disconnect_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *) cb->info; + const struct shell *sh = context.sh; if (context.disconnecting) { - print(context.sh, - status->status ? SHELL_WARNING : SHELL_NORMAL, - "Disconnection request %s (%d)\n", - status->status ? "failed" : "done", - status->status); + if (status->status) { + PR_WARNING("Disconnection request failed (%d)\n", status->status); + } else { + PR("Disconnection request done (%d)\n", status->status); + } context.disconnecting = false; } else { - print(context.sh, SHELL_NORMAL, "Disconnected\n"); + PR("Disconnected\n"); } } @@ -269,25 +258,25 @@ static void print_twt_params(uint8_t dialog_token, uint8_t flow_id, { const struct shell *sh = context.sh; - print(sh, SHELL_NORMAL, "TWT Dialog token: %d\n", + PR("TWT Dialog token: %d\n", dialog_token); - print(sh, SHELL_NORMAL, "TWT flow ID: %d\n", + PR("TWT flow ID: %d\n", flow_id); - print(sh, SHELL_NORMAL, "TWT negotiation type: %s\n", + PR("TWT negotiation type: %s\n", wifi_twt_negotiation_type_txt(negotiation_type)); - print(sh, SHELL_NORMAL, "TWT responder: %s\n", + PR("TWT responder: %s\n", responder ? "true" : "false"); - print(sh, SHELL_NORMAL, "TWT implicit: %s\n", + PR("TWT implicit: %s\n", implicit ? "true" : "false"); - print(sh, SHELL_NORMAL, "TWT announce: %s\n", + PR("TWT announce: %s\n", announce ? "true" : "false"); - print(sh, SHELL_NORMAL, "TWT trigger: %s\n", + PR("TWT trigger: %s\n", trigger ? "true" : "false"); - print(sh, SHELL_NORMAL, "TWT wake interval: %d us\n", + PR("TWT wake interval: %d us\n", twt_wake_interval); - print(sh, SHELL_NORMAL, "TWT interval: %lld us\n", + PR("TWT interval: %lld us\n", twt_interval); - print(sh, SHELL_NORMAL, "========================\n"); + PR("========================\n"); } static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) @@ -298,19 +287,19 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) if (resp->operation == WIFI_TWT_TEARDOWN) { if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { - print(sh, SHELL_NORMAL, "TWT teardown succeeded for flow ID %d\n", + PR("TWT teardown succeeded for flow ID %d\n", resp->flow_id); } else { - print(sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", + PR("TWT teardown failed for flow ID %d\n", resp->flow_id); } return; } if (resp->resp_status == WIFI_TWT_RESP_RECEIVED) { - print(sh, SHELL_NORMAL, "TWT response: %s\n", + PR("TWT response: %s\n", wifi_twt_setup_cmd_txt(resp->setup_cmd)); - print(sh, SHELL_NORMAL, "== TWT negotiated parameters ==\n"); + PR("== TWT negotiated parameters ==\n"); print_twt_params(resp->dialog_token, resp->flow_id, resp->negotiation_type, @@ -321,7 +310,7 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) resp->setup.twt_wake_interval, resp->setup.twt_interval); } else { - print(sh, SHELL_NORMAL, "TWT response timed out\n"); + PR("TWT response timed out\n"); } } @@ -332,10 +321,9 @@ static void handle_wifi_ap_enable_result(struct net_mgmt_event_callback *cb) const struct shell *sh = context.sh; if (status->status) { - print(sh, SHELL_WARNING, - "AP enable request failed (%d)\n", status->status); + PR_WARNING("AP enable request failed (%d)\n", status->status); } else { - print(sh, SHELL_NORMAL, "AP enabled\n"); + PR("AP enabled\n"); } } @@ -346,10 +334,9 @@ static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) const struct shell *sh = context.sh; if (status->status) { - print(sh, SHELL_WARNING, - "AP disable request failed (%d)\n", status->status); + PR_WARNING("AP disable request failed (%d)\n", status->status); } else { - print(sh, SHELL_NORMAL, "AP disabled\n"); + PR("AP disabled\n"); } k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); @@ -365,9 +352,9 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; int i; - print(sh, SHELL_NORMAL, "Station connected: %s\n", - net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, - mac_string_buf, sizeof(mac_string_buf))); + PR("Station connected: %s\n", + net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, + mac_string_buf, sizeof(mac_string_buf))); k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); for (i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { @@ -378,8 +365,8 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) } } if (i == CONFIG_WIFI_SHELL_MAX_AP_STA) { - print(sh, SHELL_WARNING, "No space to store station info: " - "Increase CONFIG_WIFI_SHELL_MAX_AP_STA\n"); + PR_WARNING("No space to store station info: " + "Increase CONFIG_WIFI_SHELL_MAX_AP_STA\n"); } k_mutex_unlock(&wifi_ap_sta_list_lock); } @@ -391,9 +378,9 @@ static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) const struct shell *sh = context.sh; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - print(sh, SHELL_NORMAL, "Station disconnected: %s\n", - net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, - mac_string_buf, sizeof(mac_string_buf))); + PR("Station disconnected: %s\n", + net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, + mac_string_buf, sizeof(mac_string_buf))); k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); for (int i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { @@ -468,9 +455,8 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->ssid = argv[0]; params->ssid_length = strlen(params->ssid); if (params->ssid_length > WIFI_SSID_MAX_LEN) { - print(sh, SHELL_WARNING, - "SSID too long (max %d characters)\n", - WIFI_SSID_MAX_LEN); + PR_WARNING("SSID too long (max %d characters)\n", + WIFI_SSID_MAX_LEN); return -EINVAL; } @@ -486,11 +472,10 @@ static int __wifi_args_to_params(size_t argc, char *argv[], size_t offset = 0; if (*endptr != '\0') { - print(sh, SHELL_ERROR, - "Failed to parse channel: %s: endp: %s, err: %s\n", - argv[idx], - endptr, - strerror(errno)); + PR_ERROR("Failed to parse channel: %s: endp: %s, err: %s\n", + argv[idx], + endptr, + strerror(errno)); return -EINVAL; } @@ -508,15 +493,13 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->band = WIFI_FREQ_BAND_6_GHZ; break; default: - print(sh, SHELL_ERROR, - "Invalid band: %ld\n", channel); + PR_ERROR("Invalid band: %ld\n", channel); return -EINVAL; } } } else { if (channel < 0) { - print(sh, SHELL_ERROR, - "Invalid channel: %ld\n", channel); + PR_ERROR("Invalid channel: %ld\n", channel); return -EINVAL; } } @@ -529,10 +512,9 @@ static int __wifi_args_to_params(size_t argc, char *argv[], band ? "," : "", wifi_band_txt(all_bands[band])); if (offset >= sizeof(bands_str)) { - print(sh, SHELL_ERROR, - "Failed to parse channel: %s: " - "band string too long\n", - argv[idx]); + PR_ERROR("Failed to parse channel: %s: " + "band string too long\n", + argv[idx]); return -EINVAL; } @@ -544,10 +526,9 @@ static int __wifi_args_to_params(size_t argc, char *argv[], } if (!found) { - print(sh, SHELL_ERROR, - "Invalid channel: %ld, checked bands: %s\n", - channel, - bands_str); + PR_ERROR("Invalid channel: %ld, checked bands: %s\n", + channel, + bands_str); return -EINVAL; } @@ -580,9 +561,8 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (security == WIFI_SECURITY_TYPE_NONE || security == WIFI_SECURITY_TYPE_WPA_PSK) { - print(sh, SHELL_ERROR, - "MFP not supported for security type %s\n", - wifi_security_txt(security)); + PR_ERROR("MFP not supported for security type %s\n", + wifi_security_txt(security)); return -EINVAL; } @@ -598,10 +578,9 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->psk_length > WIFI_PSK_MAX_LEN) || (params->security == WIFI_SECURITY_TYPE_SAE && params->psk_length > WIFI_SAE_PSWD_MAX_LEN)) { - print(sh, SHELL_ERROR, - "Invalid PSK length (%d) for security type %s\n", - params->psk_length, - wifi_security_txt(params->security)); + PR_ERROR("Invalid PSK length (%d) for security type %s\n", + params->psk_length, + wifi_security_txt(params->security)); return -EINVAL; } } From b3ab0a74995528fd39328c0e41a9bf7ec8b7055c Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 6 Feb 2024 14:03:43 +0530 Subject: [PATCH 0463/2300] [nrf fromtree] net: l2: wifi: Fix Print of SSID in WIFI scan result MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WIFI scan result shows junk character in SSID because of the length of ssid is maximum(32 character) which leads to buffer overflow. It required one character for null terminator ‘\0’. Signed-off-by: Kapil Bhatt (cherry picked from commit 2207fedbc81720d50b67a70a463da4387acf3e18) (cherry picked from commit ea1fd932d014b49f27482463ce291b5697df9b38) --- subsys/net/l2/wifi/wifi_shell.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 304f1748bfe..71f3cec7c10 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -107,6 +107,7 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) (const struct wifi_scan_result *)cb->info; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; const struct shell *sh = context.sh; + uint8_t ssid_print[WIFI_SSID_MAX_LEN + 1]; context.scan_result++; @@ -115,8 +116,11 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) "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'; + PR("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", - context.scan_result, entry->ssid, entry->ssid_length, entry->channel, + context.scan_result, ssid_print, entry->ssid_length, entry->channel, wifi_band_txt(entry->band), entry->rssi, wifi_security_txt(entry->security), From 49d76e4330ad5a064e33d510fc49a8bec377d4b5 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 20 Nov 2023 15:54:07 +0100 Subject: [PATCH 0464/2300] [nrf fromtree] tests/subsys/modem/*: Switch to native_sim Enable all these tests which run in native_posix in native_sim And add native_sim as default test platform Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 13b7557fe10b037ced8aa5cdac2d064bb1c45ca5) (cherry picked from commit 314da392dfc6fe699cefb1069c3305ab4c959784) --- tests/subsys/modem/backends/tty/testcase.yaml | 6 +++++- tests/subsys/modem/modem_chat/testcase.yaml | 6 +++++- tests/subsys/modem/modem_cmux/testcase.yaml | 6 +++++- tests/subsys/modem/modem_ppp/testcase.yaml | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/subsys/modem/backends/tty/testcase.yaml b/tests/subsys/modem/backends/tty/testcase.yaml index 11f78b1d641..28d3c3d4aa2 100644 --- a/tests/subsys/modem/backends/tty/testcase.yaml +++ b/tests/subsys/modem/backends/tty/testcase.yaml @@ -5,4 +5,8 @@ tests: modem.backends.tty: tags: modem_backend_tty harness: ztest - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim + integration_platforms: + - native_sim diff --git a/tests/subsys/modem/modem_chat/testcase.yaml b/tests/subsys/modem/modem_chat/testcase.yaml index 8716d7f0d17..2b8723428ea 100644 --- a/tests/subsys/modem/modem_chat/testcase.yaml +++ b/tests/subsys/modem/modem_chat/testcase.yaml @@ -5,4 +5,8 @@ tests: modem.modem_chat: tags: modem_chat harness: ztest - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim + integration_platforms: + - native_sim diff --git a/tests/subsys/modem/modem_cmux/testcase.yaml b/tests/subsys/modem/modem_cmux/testcase.yaml index c7d1f53a085..fd89a3f5656 100644 --- a/tests/subsys/modem/modem_cmux/testcase.yaml +++ b/tests/subsys/modem/modem_cmux/testcase.yaml @@ -5,4 +5,8 @@ tests: modem.modem_cmux: tags: modem_cmux harness: ztest - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim + integration_platforms: + - native_sim diff --git a/tests/subsys/modem/modem_ppp/testcase.yaml b/tests/subsys/modem/modem_ppp/testcase.yaml index 0b3fef701f3..7e0937ea144 100644 --- a/tests/subsys/modem/modem_ppp/testcase.yaml +++ b/tests/subsys/modem/modem_ppp/testcase.yaml @@ -5,4 +5,8 @@ tests: modem.modem_ppp: tags: modem_ppp harness: ztest - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim + integration_platforms: + - native_sim From d01d7ceb658714724564975893f37bc055fb6a9f Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 23 Nov 2023 18:23:34 +0100 Subject: [PATCH 0465/2300] [nrf fromtree] tests/drivers/build_all/*: Switch to native_sim Enable all these tests which run in native_posix in native_sim, Switch from native_posix to native_sim as default test platform And switch native_posix overlays to native_sim. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 7b1813e9dcfb36b6472eb979fd11995729597619) (cherry picked from commit ea0825757952d9788fbaf62e3ddc9355efe5bc60) --- .../adc/boards/{native_posix.overlay => native_sim.overlay} | 0 .../boards/{native_posix_64.overlay => native_sim_64.overlay} | 2 +- tests/drivers/build_all/adc/testcase.yaml | 4 ++-- tests/drivers/build_all/charger/testcase.yaml | 4 +++- tests/drivers/build_all/dac/testcase.yaml | 4 +++- tests/drivers/build_all/fpga/testcase.yaml | 4 +++- tests/drivers/build_all/ieee802154/testcase.yaml | 4 +++- tests/drivers/build_all/input/testcase.yaml | 4 +++- tests/drivers/build_all/mfd/testcase.yaml | 4 +++- tests/drivers/build_all/modem/testcase.yaml | 2 ++ tests/drivers/build_all/regulator/testcase.yaml | 4 +++- tests/drivers/build_all/video/testcase.yaml | 4 +++- 12 files changed, 29 insertions(+), 11 deletions(-) rename tests/drivers/build_all/adc/boards/{native_posix.overlay => native_sim.overlay} (100%) rename tests/drivers/build_all/adc/boards/{native_posix_64.overlay => native_sim_64.overlay} (74%) diff --git a/tests/drivers/build_all/adc/boards/native_posix.overlay b/tests/drivers/build_all/adc/boards/native_sim.overlay similarity index 100% rename from tests/drivers/build_all/adc/boards/native_posix.overlay rename to tests/drivers/build_all/adc/boards/native_sim.overlay diff --git a/tests/drivers/build_all/adc/boards/native_posix_64.overlay b/tests/drivers/build_all/adc/boards/native_sim_64.overlay similarity index 74% rename from tests/drivers/build_all/adc/boards/native_posix_64.overlay rename to tests/drivers/build_all/adc/boards/native_sim_64.overlay index b5655714d89..16e56822d5f 100644 --- a/tests/drivers/build_all/adc/boards/native_posix_64.overlay +++ b/tests/drivers/build_all/adc/boards/native_sim_64.overlay @@ -3,4 +3,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "native_posix.overlay" +#include "native_sim.overlay" diff --git a/tests/drivers/build_all/adc/testcase.yaml b/tests/drivers/build_all/adc/testcase.yaml index a8102364b60..3b8995e1769 100644 --- a/tests/drivers/build_all/adc/testcase.yaml +++ b/tests/drivers/build_all/adc/testcase.yaml @@ -7,8 +7,8 @@ tests: drivers.adc.build: # will cover I2C, SPI, and emul based drivers platform_allow: - - native_posix - - native_posix_64 + - native_sim + - native_sim_64 extra_args: "CONFIG_GPIO=y" drivers.adc.cc32xx.build: platform_allow: cc3220sf_launchxl diff --git a/tests/drivers/build_all/charger/testcase.yaml b/tests/drivers/build_all/charger/testcase.yaml index f2005d9f238..0a29ccc7b39 100644 --- a/tests/drivers/build_all/charger/testcase.yaml +++ b/tests/drivers/build_all/charger/testcase.yaml @@ -7,4 +7,6 @@ tests: - drivers - charger build_only: true - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim diff --git a/tests/drivers/build_all/dac/testcase.yaml b/tests/drivers/build_all/dac/testcase.yaml index 12252b8661f..a298ded77b4 100644 --- a/tests/drivers/build_all/dac/testcase.yaml +++ b/tests/drivers/build_all/dac/testcase.yaml @@ -6,7 +6,9 @@ common: tests: drivers.dac.build: # will cover I2C, SPI based drivers - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim extra_args: "CONFIG_GPIO=y" drivers.dac.mcux.build: platform_allow: frdm_k22f diff --git a/tests/drivers/build_all/fpga/testcase.yaml b/tests/drivers/build_all/fpga/testcase.yaml index 33cccf76dde..ad0d3e8123e 100644 --- a/tests/drivers/build_all/fpga/testcase.yaml +++ b/tests/drivers/build_all/fpga/testcase.yaml @@ -2,7 +2,9 @@ common: tags: - drivers - sensors - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim build_only: true tests: drivers.fpga.build: diff --git a/tests/drivers/build_all/ieee802154/testcase.yaml b/tests/drivers/build_all/ieee802154/testcase.yaml index fd9fb07e062..399f3fac3cf 100644 --- a/tests/drivers/build_all/ieee802154/testcase.yaml +++ b/tests/drivers/build_all/ieee802154/testcase.yaml @@ -5,7 +5,9 @@ common: build_only: true tests: ieee802154.build.external: - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim ieee802154.build.cc13xx_cc26xx: platform_allow: cc1352r_sensortag ieee802154.build.kw41z: diff --git a/tests/drivers/build_all/input/testcase.yaml b/tests/drivers/build_all/input/testcase.yaml index 32fe44b883f..80a60399464 100644 --- a/tests/drivers/build_all/input/testcase.yaml +++ b/tests/drivers/build_all/input/testcase.yaml @@ -3,7 +3,9 @@ common: - drivers - input build_only: true - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim tests: drivers.input.default: {} diff --git a/tests/drivers/build_all/mfd/testcase.yaml b/tests/drivers/build_all/mfd/testcase.yaml index 80864481bdf..126fdb40e55 100644 --- a/tests/drivers/build_all/mfd/testcase.yaml +++ b/tests/drivers/build_all/mfd/testcase.yaml @@ -5,4 +5,6 @@ common: - mfd tests: drivers.mfd.build: - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim diff --git a/tests/drivers/build_all/modem/testcase.yaml b/tests/drivers/build_all/modem/testcase.yaml index 89abfbd79df..25c338b9fda 100644 --- a/tests/drivers/build_all/modem/testcase.yaml +++ b/tests/drivers/build_all/modem/testcase.yaml @@ -79,6 +79,8 @@ tests: platform_allow: - native_posix_64 - native_posix + - native_sim_64 + - native_sim - qemu_x86 - qemu_x86_64 min_ram: 36 diff --git a/tests/drivers/build_all/regulator/testcase.yaml b/tests/drivers/build_all/regulator/testcase.yaml index 9b9c25511c4..58fc0851981 100644 --- a/tests/drivers/build_all/regulator/testcase.yaml +++ b/tests/drivers/build_all/regulator/testcase.yaml @@ -7,4 +7,6 @@ tests: - drivers - regulator build_only: true - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim diff --git a/tests/drivers/build_all/video/testcase.yaml b/tests/drivers/build_all/video/testcase.yaml index 22595c7be54..08dd430da73 100644 --- a/tests/drivers/build_all/video/testcase.yaml +++ b/tests/drivers/build_all/video/testcase.yaml @@ -5,7 +5,9 @@ common: - video tests: drivers.video.build: - platform_allow: native_posix + platform_allow: + - native_posix + - native_sim min_ram: 32 depends_on: - gpio From bdf52e223ddb44bf585d24924548452f899da9e8 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Sat, 23 Sep 2023 13:41:34 +0100 Subject: [PATCH 0466/2300] [nrf fromtree] drivers: gnss: add a generic NMEA GNSS driver Add a generic NMEA GNSS driver. Signed-off-by: Fabio Baltieri (cherry picked from commit d14066b061b0aeb0834473c0d991009388591656) (cherry picked from commit f713a797ef07b1c8294b456d6826cc8d94e2f959) --- drivers/gnss/CMakeLists.txt | 1 + drivers/gnss/Kconfig | 1 + drivers/gnss/Kconfig.generic | 26 ++++ drivers/gnss/gnss_nmea_generic.c | 176 +++++++++++++++++++++++ dts/bindings/gnss/gnss-nmea-generic.yaml | 32 +++++ 5 files changed, 236 insertions(+) create mode 100644 drivers/gnss/Kconfig.generic create mode 100644 drivers/gnss/gnss_nmea_generic.c create mode 100644 dts/bindings/gnss/gnss-nmea-generic.yaml diff --git a/drivers/gnss/CMakeLists.txt b/drivers/gnss/CMakeLists.txt index 6c24df4903e..cfa5c6ed210 100644 --- a/drivers/gnss/CMakeLists.txt +++ b/drivers/gnss/CMakeLists.txt @@ -7,4 +7,5 @@ zephyr_library_sources_ifdef(CONFIG_GNSS_DUMP gnss_dump.c) zephyr_library_sources_ifdef(CONFIG_GNSS_PARSE gnss_parse.c) zephyr_library_sources_ifdef(CONFIG_GNSS_NMEA0183 gnss_nmea0183.c) zephyr_library_sources_ifdef(CONFIG_GNSS_NMEA0183_MATCH gnss_nmea0183_match.c) +zephyr_library_sources_ifdef(CONFIG_GNSS_NMEA_GENERIC gnss_nmea_generic.c) zephyr_library_sources_ifdef(CONFIG_GNSS_QUECTEL_LCX6G gnss_quectel_lcx6g.c) diff --git a/drivers/gnss/Kconfig b/drivers/gnss/Kconfig index 5bdc0f530d8..2ff552940a3 100644 --- a/drivers/gnss/Kconfig +++ b/drivers/gnss/Kconfig @@ -64,6 +64,7 @@ module = GNSS module-str = gnss source "subsys/logging/Kconfig.template.log_config" +rsource "Kconfig.generic" rsource "Kconfig.quectel_lcx6g" endif diff --git a/drivers/gnss/Kconfig.generic b/drivers/gnss/Kconfig.generic new file mode 100644 index 00000000000..47fbd4a7c6c --- /dev/null +++ b/drivers/gnss/Kconfig.generic @@ -0,0 +1,26 @@ +# Copyright 2023 Google LLC +# SPDX-License-Identifier: Apache-2.0 + +config GNSS_NMEA_GENERIC + bool "Generic GNSS NMEA device" + default y + depends on GNSS + depends on DT_HAS_GNSS_NMEA_GENERIC_ENABLED + select MODEM_MODULES + select MODEM_BACKEND_UART + select MODEM_CHAT + select GNSS_PARSE + select GNSS_NMEA0183 + select GNSS_NMEA0183_MATCH + help + Generic NMEA based GNSS device. + +config GNSS_NMEA_GENERIC_SATELLITES_COUNT + int "Maximum satellite count" + depends on GNSS_SATELLITES + default 24 + help + Maximum number of satellite that the driver that can be decoded from + the GNSS device. This does not affect the number of devices that the + device is actually tracking, just how many of those can be reported + in the satellites callback. diff --git a/drivers/gnss/gnss_nmea_generic.c b/drivers/gnss/gnss_nmea_generic.c new file mode 100644 index 00000000000..d24ee2b034d --- /dev/null +++ b/drivers/gnss/gnss_nmea_generic.c @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2023 Trackunit Corporation + * Copyright (c) 2023 Bjarki Arge Andreasen + * Copyright 2023 Google LLC + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include "gnss_publish.h" +#include "gnss_nmea0183.h" +#include "gnss_nmea0183_match.h" +#include "gnss_parse.h" + +#include +LOG_MODULE_REGISTER(gnss_nmea_generic, CONFIG_GNSS_LOG_LEVEL); + +#define DT_DRV_COMPAT gnss_nmea_generic + +#define UART_RECV_BUF_SZ 128 +#define CHAT_RECV_BUF_SZ 256 +#define CHAT_ARGV_SZ 32 + +struct gnss_nmea_generic_config { + const struct device *uart; + uint16_t nmea_timeout_ms; +}; + +struct gnss_nmea_generic_data { + struct gnss_nmea0183_match_data match_data; +#if CONFIG_GNSS_SATELLITES + struct gnss_satellite satellites[CONFIG_GNSS_NMEA_GENERIC_SATELLITES_COUNT]; +#endif + + /* UART backend */ + struct modem_pipe *uart_pipe; + struct modem_backend_uart uart_backend; + uint8_t uart_backend_receive_buf[UART_RECV_BUF_SZ]; + + /* Modem chat */ + struct modem_chat chat; + uint8_t chat_receive_buf[CHAT_RECV_BUF_SZ]; + uint8_t *chat_argv[CHAT_ARGV_SZ]; + + struct k_spinlock lock; +}; + +MODEM_CHAT_MATCHES_DEFINE(unsol_matches, + MODEM_CHAT_MATCH_WILDCARD("$??GGA,", ",*", gnss_nmea0183_match_gga_callback), + MODEM_CHAT_MATCH_WILDCARD("$??RMC,", ",*", gnss_nmea0183_match_rmc_callback), +#if CONFIG_GNSS_SATELLITES + MODEM_CHAT_MATCH_WILDCARD("$??GSV,", ",*", gnss_nmea0183_match_gsv_callback), +#endif +); + +static int gnss_nmea_generic_resume(const struct device *dev) +{ + struct gnss_nmea_generic_data *data = dev->data; + int ret; + + ret = modem_pipe_open(data->uart_pipe); + if (ret < 0) { + return ret; + } + + ret = modem_chat_attach(&data->chat, data->uart_pipe); + if (ret < 0) { + modem_pipe_close(data->uart_pipe); + return ret; + } + + return ret; +} + +static struct gnss_driver_api gnss_api = { +}; + +static int gnss_nmea_generic_init_nmea0183_match(const struct device *dev) +{ + const struct gnss_nmea_generic_config *cfg = dev->config; + struct gnss_nmea_generic_data *data = dev->data; + + const struct gnss_nmea0183_match_config match_config = { + .gnss = dev, +#if CONFIG_GNSS_SATELLITES + .satellites = data->satellites, + .satellites_size = ARRAY_SIZE(data->satellites), +#endif + .timeout_ms = cfg->nmea_timeout_ms, + }; + + return gnss_nmea0183_match_init(&data->match_data, &match_config); +} + +static void gnss_nmea_generic_init_pipe(const struct device *dev) +{ + const struct gnss_nmea_generic_config *cfg = dev->config; + struct gnss_nmea_generic_data *data = dev->data; + + const struct modem_backend_uart_config uart_backend_config = { + .uart = cfg->uart, + .receive_buf = data->uart_backend_receive_buf, + .receive_buf_size = sizeof(data->uart_backend_receive_buf), + }; + + data->uart_pipe = modem_backend_uart_init(&data->uart_backend, &uart_backend_config); +} + +static uint8_t gnss_nmea_generic_char_delimiter[] = {'\r', '\n'}; + +static int gnss_nmea_generic_init_chat(const struct device *dev) +{ + struct gnss_nmea_generic_data *data = dev->data; + + const struct modem_chat_config chat_config = { + .user_data = data, + .receive_buf = data->chat_receive_buf, + .receive_buf_size = sizeof(data->chat_receive_buf), + .delimiter = gnss_nmea_generic_char_delimiter, + .delimiter_size = ARRAY_SIZE(gnss_nmea_generic_char_delimiter), + .filter = NULL, + .filter_size = 0, + .argv = data->chat_argv, + .argv_size = ARRAY_SIZE(data->chat_argv), + .unsol_matches = unsol_matches, + .unsol_matches_size = ARRAY_SIZE(unsol_matches), + .process_timeout = K_MSEC(2), + }; + + return modem_chat_init(&data->chat, &chat_config); +} + +static int gnss_nmea_generic_init(const struct device *dev) +{ + int ret; + + ret = gnss_nmea_generic_init_nmea0183_match(dev); + if (ret < 0) { + return ret; + } + + gnss_nmea_generic_init_pipe(dev); + + ret = gnss_nmea_generic_init_chat(dev); + if (ret < 0) { + return ret; + } + + ret = gnss_nmea_generic_resume(dev); + if (ret < 0) { + return ret; + } + + return 0; +} + +#define GNSS_NMEA_GENERIC(inst) \ + static struct gnss_nmea_generic_config gnss_nmea_generic_cfg_##inst = { \ + .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ + .nmea_timeout_ms = DT_INST_PROP(inst, nmea_timeout_ms), \ + }; \ + \ + static struct gnss_nmea_generic_data gnss_nmea_generic_data_##inst; \ + \ + DEVICE_DT_INST_DEFINE(inst, gnss_nmea_generic_init, NULL, \ + &gnss_nmea_generic_data_##inst, \ + &gnss_nmea_generic_cfg_##inst, \ + POST_KERNEL, CONFIG_GNSS_INIT_PRIORITY, &gnss_api); + +DT_INST_FOREACH_STATUS_OKAY(GNSS_NMEA_GENERIC) diff --git a/dts/bindings/gnss/gnss-nmea-generic.yaml b/dts/bindings/gnss/gnss-nmea-generic.yaml new file mode 100644 index 00000000000..4be7bde1186 --- /dev/null +++ b/dts/bindings/gnss/gnss-nmea-generic.yaml @@ -0,0 +1,32 @@ +# Copyright 2023 Google LLC +# SPDX-License-Identifier: Apache-2.0 + +description: | + Generic GNSS NMEA receiver + + Implement a generic NMEA based GNSS device. + + Example configuration: + + &uart0 { + current-speed = <9600>; + ... + gnss: gnss-nmea-generic { + compatible = "gnss-nmea-generic"; + }; + }; + +compatible: "gnss-nmea-generic" + +include: + - uart-device.yaml + +properties: + nmea-timeout-ms: + type: int + default: 500 + description: | + Synchronization timeout for NMEA sentences. The NMEA parser is expecting + to receive a GGA and RMC sentences within this time frame to publish a + location data. Set accordingly to the UART datarate and location + reporting frequency. Defaults to 500ms if unspecified. From daaa3f6b31239069d0a26144b085883a81a4ce7a Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 22 Nov 2023 23:13:18 +0000 Subject: [PATCH 0467/2300] [nrf fromtree] test: add a gnss build_all test Add a generic test for GNSS devices. Signed-off-by: Fabio Baltieri (cherry picked from commit 407e9a4c74d610f57a1e1b54d3a9f5adf724495d) (cherry picked from commit 8ba71023376cc99eb357f213feb5343c8fc0269c) --- MAINTAINERS.yml | 1 + tests/drivers/build_all/gnss/CMakeLists.txt | 8 ++++++++ tests/drivers/build_all/gnss/app.overlay | 22 +++++++++++++++++++++ tests/drivers/build_all/gnss/prj.conf | 3 +++ tests/drivers/build_all/gnss/src/main.c | 10 ++++++++++ tests/drivers/build_all/gnss/testcase.yaml | 8 ++++++++ 6 files changed, 52 insertions(+) create mode 100644 tests/drivers/build_all/gnss/CMakeLists.txt create mode 100644 tests/drivers/build_all/gnss/app.overlay create mode 100644 tests/drivers/build_all/gnss/prj.conf create mode 100644 tests/drivers/build_all/gnss/src/main.c create mode 100644 tests/drivers/build_all/gnss/testcase.yaml diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index d2c888654cf..11c8009827c 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1100,6 +1100,7 @@ Release Notes: - doc/hardware/peripherals/gnss.rst - drivers/gnss/ - include/zephyr/drivers/gnss.h + - tests/drivers/build_all/gnss/ - tests/drivers/gnss/ labels: - "area: GNSS" diff --git a/tests/drivers/build_all/gnss/CMakeLists.txt b/tests/drivers/build_all/gnss/CMakeLists.txt new file mode 100644 index 00000000000..518596a02f7 --- /dev/null +++ b/tests/drivers/build_all/gnss/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/drivers/build_all/gnss/app.overlay b/tests/drivers/build_all/gnss/app.overlay new file mode 100644 index 00000000000..1d43fa61525 --- /dev/null +++ b/tests/drivers/build_all/gnss/app.overlay @@ -0,0 +1,22 @@ +/* + * Copyright 2023 Google LLC + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_uart: uart@0 { + compatible = "vnd,serial"; + reg = <0x0 0x1000>; + status = "okay"; + + gnss: gnss-nmea-generic { + compatible = "gnss-nmea-generic"; + }; + }; + }; +}; diff --git a/tests/drivers/build_all/gnss/prj.conf b/tests/drivers/build_all/gnss/prj.conf new file mode 100644 index 00000000000..945eb0df717 --- /dev/null +++ b/tests/drivers/build_all/gnss/prj.conf @@ -0,0 +1,3 @@ +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_GNSS=y diff --git a/tests/drivers/build_all/gnss/src/main.c b/tests/drivers/build_all/gnss/src/main.c new file mode 100644 index 00000000000..ccbdca6d36b --- /dev/null +++ b/tests/drivers/build_all/gnss/src/main.c @@ -0,0 +1,10 @@ +/* + * Copyright 2023 Google LLC + * + * SPDX-License-Identifier: Apache-2.0 + */ + +int main(void) +{ + return 0; +} diff --git a/tests/drivers/build_all/gnss/testcase.yaml b/tests/drivers/build_all/gnss/testcase.yaml new file mode 100644 index 00000000000..faaec12c745 --- /dev/null +++ b/tests/drivers/build_all/gnss/testcase.yaml @@ -0,0 +1,8 @@ +common: + tags: + - drivers + - gnss + build_only: true + platform_allow: native_sim +tests: + drivers.gnss.default: {} From 097ff270ecf4454484fc9506b747cbb52aae6e5a Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 22 Nov 2023 23:20:52 +0000 Subject: [PATCH 0468/2300] [nrf fromtree] drivers: gnss: use absolute values for signed fractionals Printing fractionals currently put the sign on integer values on the fractional part, for example: longitude : -6.-207483333 Run an extra abs to get rid of the sign there for latitude, longitude and altitude, compute the sign separately so it works for numbers between -1 and 0 as well. Signed-off-by: Fabio Baltieri (cherry picked from commit 96b9bd472068a80c727febbc87c553b168f91299) (cherry picked from commit 670c5cfb5010fba56f99b5208cfd29da6dddfd3a) --- drivers/gnss/gnss_dump.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/gnss/gnss_dump.c b/drivers/gnss/gnss_dump.c index 1946d65ea2e..f87b64a4946 100644 --- a/drivers/gnss/gnss_dump.c +++ b/drivers/gnss/gnss_dump.c @@ -5,6 +5,7 @@ */ #include "gnss_dump.h" +#include #include #include @@ -94,20 +95,22 @@ int gnss_dump_info(char *str, uint16_t strsize, const struct gnss_info *info) int gnss_dump_nav_data(char *str, uint16_t strsize, const struct navigation_data *nav_data) { int ret; - int32_t altitude_int; - int32_t altitude_fraction; - const char *fmt = "navigation_data: {latitude: %lli.%lli, longitude : %lli.%lli, " - "bearing %u.%u, speed %u.%u, altitude: %i.%i}"; - - altitude_int = nav_data->altitude / 1000; - altitude_fraction = nav_data->altitude % 1000; - altitude_fraction = (altitude_fraction < 0) ? -altitude_fraction : altitude_fraction; - - ret = snprintk(str, strsize, fmt, nav_data->latitude / 1000000000, - nav_data->latitude % 1000000000, nav_data->longitude / 1000000000, - nav_data->longitude % 1000000000, nav_data->bearing / 1000, - nav_data->bearing % 1000, nav_data->speed / 1000, nav_data->speed % 1000, - altitude_int, altitude_fraction); + const char *fmt = "navigation_data: {latitude: %s%lli.%09lli, longitude : %s%lli.%09lli, " + "bearing %u.%03u, speed %u.%03u, altitude: %s%i.%03i}"; + char *lat_sign = nav_data->latitude < 0 ? "-" : ""; + char *lon_sign = nav_data->longitude < 0 ? "-" : ""; + char *alt_sign = nav_data->altitude < 0 ? "-" : ""; + + ret = snprintk(str, strsize, fmt, + lat_sign, + llabs(nav_data->latitude) / 1000000000, + llabs(nav_data->latitude) % 1000000000, + lon_sign, + llabs(nav_data->longitude) / 1000000000, + llabs(nav_data->longitude) % 1000000000, + nav_data->bearing / 1000, nav_data->bearing % 1000, + nav_data->speed / 1000, nav_data->speed % 1000, + alt_sign, abs(nav_data->altitude) / 1000, abs(nav_data->altitude) % 1000); return (strsize < ret) ? -ENOMEM : 0; } From 93177c9f7aec917ad674d9a0cf03775a63fa4614 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Sun, 26 Nov 2023 15:35:04 +0000 Subject: [PATCH 0469/2300] [nrf fromtree] drivers: gnss: move gnss_publish.h in include/ Move gnss_publish.h in include/ so that out of tree drivers and tests can use it. Signed-off-by: Fabio Baltieri (cherry picked from commit f9ab0503069ab7456ed11df0c5af4c013482663f) (cherry picked from commit 1dd9a7934396159c0c920e02b5bc3cb2ac01268a) --- MAINTAINERS.yml | 1 + drivers/gnss/gnss_nmea0183_match.c | 2 +- drivers/gnss/gnss_nmea_generic.c | 2 +- drivers/gnss/gnss_publish.c | 2 +- drivers/gnss/gnss_quectel_lcx6g.c | 2 +- {drivers => include/zephyr/drivers}/gnss/gnss_publish.h | 0 6 files changed, 5 insertions(+), 4 deletions(-) rename {drivers => include/zephyr/drivers}/gnss/gnss_publish.h (100%) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 11c8009827c..a6d820aca82 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1100,6 +1100,7 @@ Release Notes: - doc/hardware/peripherals/gnss.rst - drivers/gnss/ - include/zephyr/drivers/gnss.h + - include/zephyr/drivers/gnss/ - tests/drivers/build_all/gnss/ - tests/drivers/gnss/ labels: diff --git a/drivers/gnss/gnss_nmea0183_match.c b/drivers/gnss/gnss_nmea0183_match.c index 3fe3b159fdb..2b971937c8d 100644 --- a/drivers/gnss/gnss_nmea0183_match.c +++ b/drivers/gnss/gnss_nmea0183_match.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include @@ -11,7 +12,6 @@ #include "gnss_nmea0183.h" #include "gnss_nmea0183_match.h" -#include "gnss_publish.h" static bool gnss_nmea0183_match_timed_out(struct gnss_nmea0183_match_data *data) { diff --git a/drivers/gnss/gnss_nmea_generic.c b/drivers/gnss/gnss_nmea_generic.c index d24ee2b034d..0e7611ba495 100644 --- a/drivers/gnss/gnss_nmea_generic.c +++ b/drivers/gnss/gnss_nmea_generic.c @@ -7,13 +7,13 @@ */ #include +#include #include #include #include #include #include -#include "gnss_publish.h" #include "gnss_nmea0183.h" #include "gnss_nmea0183_match.h" #include "gnss_parse.h" diff --git a/drivers/gnss/gnss_publish.c b/drivers/gnss/gnss_publish.c index 98e3a2e5e19..7ddfa5e09fe 100644 --- a/drivers/gnss/gnss_publish.c +++ b/drivers/gnss/gnss_publish.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "gnss_publish.h" +#include #include #include diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 0ca7f5203ac..9565d46cdfb 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #include -#include "gnss_publish.h" #include "gnss_nmea0183.h" #include "gnss_nmea0183_match.h" #include "gnss_parse.h" diff --git a/drivers/gnss/gnss_publish.h b/include/zephyr/drivers/gnss/gnss_publish.h similarity index 100% rename from drivers/gnss/gnss_publish.h rename to include/zephyr/drivers/gnss/gnss_publish.h From 4233f880fb46f071cbaf8a2b1f0882bad0e935cb Mon Sep 17 00:00:00 2001 From: Emil Lindqvist Date: Thu, 9 Nov 2023 14:09:57 +0100 Subject: [PATCH 0470/2300] [nrf fromtree] modem: modem_cellular: add PAP authentication support Some modems or networks require PAP authentication for successful LCP handshake. Tested on U-blox SARA-R5 with zephyr,gsm-ppp. Signed-off-by: Emil Lindqvist (cherry picked from commit 79c2fafe6a6beac219462213b2f96d6fcc39437e) (cherry picked from commit d931e8844a8fb97c19ea8b5c17ac20bb4e2bf476) --- drivers/modem/Kconfig.cellular | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 7817fb599e3..72e6a74acbb 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -11,6 +11,7 @@ config MODEM_CELLULAR select MODEM_BACKEND_UART select RING_BUFFER select NET_L2_PPP_OPTION_MRU + select NET_L2_PPP_PAP depends on (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ DT_HAS_SWIR_HL7800_ENABLED || DT_HAS_TELIT_ME910G1_ENABLED || \ From 3bf8c4be2645df0ea54c419aa6a6567400edb7c6 Mon Sep 17 00:00:00 2001 From: Emil Lindqvist Date: Mon, 4 Dec 2023 10:25:09 +0100 Subject: [PATCH 0471/2300] [nrf fromtree] modem: modem_cellular: add U-blox SARA-R5 as modem U-blox SARA-R4 already exists but the behavior is different, requiring a separate driver instance. For instance, R5 autostarts, so this commit also adds support for skipping power on pulse. Signed-off-by: Emil Lindqvist (cherry picked from commit 1cd7c55af9758f336d5ed1b453ef61970c1cd125) (cherry picked from commit 26d9f102455a501fb2be6d7f808c99a2e43a0563) --- drivers/modem/Kconfig.cellular | 4 +- drivers/modem/modem_cellular.c | 84 ++++++++++++++++++++++++++ dts/bindings/modem/u-blox,sara-r5.yaml | 15 +++++ 3 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 dts/bindings/modem/u-blox,sara-r5.yaml diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 72e6a74acbb..0460cda8d96 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -14,8 +14,8 @@ config MODEM_CELLULAR select NET_L2_PPP_PAP depends on (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ - DT_HAS_SWIR_HL7800_ENABLED || DT_HAS_TELIT_ME910G1_ENABLED || \ - DT_HAS_QUECTEL_EG25_G_ENABLED) + DT_HAS_U_BLOX_SARA_R5_ENABLED || DT_HAS_SWIR_HL7800_ENABLED || \ + DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED) help This driver uses the generic 3gpp AT commands, along with the standard protocols CMUX and PPP, to configure diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index c3b97f0b618..a038da1805e 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -114,6 +114,7 @@ struct modem_cellular_config { const uint16_t reset_pulse_duration_ms; const uint16_t startup_time_ms; const uint16_t shutdown_time_ms; + const bool autostarts; const struct modem_chat_script *init_chat_script; const struct modem_chat_script *dial_chat_script; const struct modem_chat_script *periodic_chat_script; @@ -444,6 +445,11 @@ static void modem_cellular_idle_event_handler(struct modem_cellular_data *data, switch (evt) { case MODEM_CELLULAR_EVENT_RESUME: + if (config->autostarts) { + modem_cellular_enter_state(data, MODEM_CELLULAR_STATE_AWAIT_POWER_ON); + break; + } + if (modem_cellular_gpio_is_enabled(&config->power_gpio)) { modem_cellular_enter_state(data, MODEM_CELLULAR_STATE_POWER_ON_PULSE); break; @@ -1538,6 +1544,51 @@ MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r4_periodic_chat_script, modem_cellular_chat_callback_handler, 4); #endif +#if DT_HAS_COMPAT_STATUS_OKAY(u_blox_sara_r5) +MODEM_CHAT_SCRIPT_CMDS_DEFINE(u_blox_sara_r5_init_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), + MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), + MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), + MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), + MODEM_CHAT_SCRIPT_CMD_RESP("ATE0", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMUX=0,0,5,127", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r5_init_chat_script, u_blox_sara_r5_init_chat_script_cmds, + abort_matches, modem_cellular_chat_callback_handler, 10); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(u_blox_sara_r5_dial_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP_MULT("AT+CGACT=0,1", allow_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGDCONT=1,\"IP\"," + "\""CONFIG_MODEM_CELLULAR_APN"\"", + ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP_NONE("ATD*99***1#", 0),); + +MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r5_dial_chat_script, u_blox_sara_r5_dial_chat_script_cmds, + dial_abort_matches, modem_cellular_chat_callback_handler, 10); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(u_blox_sara_r5_periodic_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r5_periodic_chat_script, + u_blox_sara_r5_periodic_chat_script_cmds, abort_matches, + modem_cellular_chat_callback_handler, 4); +#endif + #if DT_HAS_COMPAT_STATUS_OKAY(swir_hl7800) MODEM_CHAT_SCRIPT_CMDS_DEFINE(swir_hl7800_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), @@ -1778,6 +1829,35 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, &MODEM_CELLULAR_INST_NAME(data, inst), \ &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); +#define MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R5(inst) \ + MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + \ + static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ + .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ + }; \ + \ + static struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \ + .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ + .power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \ + .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_reset_gpios, {}), \ + .autostarts = true, \ + .power_pulse_duration_ms = 1500, \ + .reset_pulse_duration_ms = 100, \ + .startup_time_ms = 1500, \ + .shutdown_time_ms = 13000, \ + .init_chat_script = &u_blox_sara_r5_init_chat_script, \ + .dial_chat_script = &u_blox_sara_r5_dial_chat_script, \ + .periodic_chat_script = &u_blox_sara_r5_periodic_chat_script, \ + }; \ + \ + PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ + \ + DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ + &MODEM_CELLULAR_INST_NAME(data, inst), \ + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); + #define MODEM_CELLULAR_DEVICE_SWIR_HL7800(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ @@ -1854,6 +1934,10 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SIMCOM_SIM7080) DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R4) #undef DT_DRV_COMPAT +#define DT_DRV_COMPAT u_blox_sara_r5 +DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R5) +#undef DT_DRV_COMPAT + #define DT_DRV_COMPAT swir_hl7800 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #undef DT_DRV_COMPAT diff --git a/dts/bindings/modem/u-blox,sara-r5.yaml b/dts/bindings/modem/u-blox,sara-r5.yaml new file mode 100644 index 00000000000..af6c3318fd0 --- /dev/null +++ b/dts/bindings/modem/u-blox,sara-r5.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2023 Emil Lindqvist +# SPDX-License-Identifier: Apache-2.0 + +description: u-blox SARA-R5 modem + +compatible: "u-blox,sara-r5" + +include: uart-device.yaml + +properties: + mdm-power-gpios: + type: phandle-array + + mdm-reset-gpios: + type: phandle-array From 3fff3690e37cf319a6612617dc68e24fb82e6286 Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Wed, 29 Nov 2023 17:51:11 +0200 Subject: [PATCH 0472/2300] [nrf fromtree] modem: modem_cmux: Support modem CMUX DCE role Added missing command and message handling for use existing modem cmux for DCE role. DCE CMUX connection can be now initialized from DTE side. Signed-off-by: Juha Heiskanen (cherry picked from commit 093efc444d65a6477688b5884915be5151fc62f1) (cherry picked from commit 256ffa99b6cdab1d04de0a41337b8547fe141473) --- subsys/modem/modem_cmux.c | 108 ++++++++++++++++++++++++++++++++++---- 1 file changed, 99 insertions(+), 9 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 9c95e124fc2..29ff41c1ca7 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -340,9 +340,11 @@ static void modem_cmux_acknowledge_received_frame(struct modem_cmux *cmux) } } -static void modem_cmux_on_msc_command(struct modem_cmux *cmux) +static void modem_cmux_on_msc_command(struct modem_cmux *cmux, struct modem_cmux_command *command) { - modem_cmux_acknowledge_received_frame(cmux); + if (command->type.cr) { + modem_cmux_acknowledge_received_frame(cmux); + } } static void modem_cmux_on_fcon_command(struct modem_cmux *cmux) @@ -361,17 +363,27 @@ static void modem_cmux_on_fcoff_command(struct modem_cmux *cmux) modem_cmux_acknowledge_received_frame(cmux); } -static void modem_cmux_on_cld_command(struct modem_cmux *cmux) +static void modem_cmux_on_cld_command(struct modem_cmux *cmux, struct modem_cmux_command *command) { - if (cmux->state != MODEM_CMUX_STATE_DISCONNECTING) { + if (command->type.cr) { + modem_cmux_acknowledge_received_frame(cmux); + } + + if (cmux->state != MODEM_CMUX_STATE_DISCONNECTING && + cmux->state != MODEM_CMUX_STATE_CONNECTED) { LOG_WRN("Unexpected close down"); + return; + } + + if (cmux->state == MODEM_CMUX_STATE_DISCONNECTING) { + k_work_cancel_delayable(&cmux->disconnect_work); } cmux->state = MODEM_CMUX_STATE_DISCONNECTED; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = false; k_mutex_unlock(&cmux->transmit_rb_lock); - k_work_cancel_delayable(&cmux->disconnect_work); + modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_DISCONNECTED); k_event_clear(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); k_event_post(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); @@ -381,7 +393,6 @@ static void modem_cmux_on_control_frame_ua(struct modem_cmux *cmux) { if (cmux->state != MODEM_CMUX_STATE_CONNECTING) { LOG_DBG("Unexpected UA frame"); - return; } @@ -414,11 +425,11 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) switch (command->type.value) { case MODEM_CMUX_COMMAND_CLD: - modem_cmux_on_cld_command(cmux); + modem_cmux_on_cld_command(cmux, command); break; case MODEM_CMUX_COMMAND_MSC: - modem_cmux_on_msc_command(cmux); + modem_cmux_on_msc_command(cmux, command); break; case MODEM_CMUX_COMMAND_FCON: @@ -435,6 +446,40 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) } } +static void modem_cmux_connect_response_transmit(struct modem_cmux *cmux) +{ + struct modem_cmux_frame frame = { + .dlci_address = cmux->frame.dlci_address, + .cr = cmux->frame.cr, + .pf = cmux->frame.pf, + .type = MODEM_CMUX_FRAME_TYPE_UA, + .data = NULL, + .data_len = 0, + }; + + LOG_DBG("SABM/DISC request state send ack"); + modem_cmux_transmit_cmd_frame(cmux, &frame); +} + +static void modem_cmux_on_control_frame_sabm(struct modem_cmux *cmux) +{ + modem_cmux_connect_response_transmit(cmux); + + if ((cmux->state == MODEM_CMUX_STATE_CONNECTED) || + (cmux->state == MODEM_CMUX_STATE_DISCONNECTING)) { + LOG_DBG("Connect request not accepted"); + return; + } + + cmux->state = MODEM_CMUX_STATE_CONNECTED; + k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); + cmux->flow_control_on = true; + k_mutex_unlock(&cmux->transmit_rb_lock); + modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_CONNECTED); + k_event_clear(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); + k_event_post(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); +} + static void modem_cmux_on_control_frame(struct modem_cmux *cmux) { modem_cmux_log_received_frame(&cmux->frame); @@ -448,6 +493,10 @@ static void modem_cmux_on_control_frame(struct modem_cmux *cmux) modem_cmux_on_control_frame_uih(cmux); break; + case MODEM_CMUX_FRAME_TYPE_SABM: + modem_cmux_on_control_frame_sabm(cmux); + break; + default: LOG_WRN("Unknown %s frame type", "control"); break; @@ -509,6 +558,39 @@ static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) modem_pipe_notify_receive_ready(&dlci->pipe); } +static void modem_cmux_on_dlci_frame_sabm(struct modem_cmux_dlci *dlci) +{ + struct modem_cmux *cmux = dlci->cmux; + + modem_cmux_connect_response_transmit(cmux); + + if (dlci->state == MODEM_CMUX_DLCI_STATE_OPEN) { + LOG_DBG("Unexpected SABM frame"); + return; + } + + dlci->state = MODEM_CMUX_DLCI_STATE_OPEN; + modem_pipe_notify_opened(&dlci->pipe); + k_mutex_lock(&dlci->receive_rb_lock, K_FOREVER); + ring_buf_reset(&dlci->receive_rb); + k_mutex_unlock(&dlci->receive_rb_lock); +} + +static void modem_cmux_on_dlci_frame_disc(struct modem_cmux_dlci *dlci) +{ + struct modem_cmux *cmux = dlci->cmux; + + modem_cmux_connect_response_transmit(cmux); + + if (dlci->state != MODEM_CMUX_DLCI_STATE_OPEN) { + LOG_DBG("Unexpected Disc frame"); + return; + } + + dlci->state = MODEM_CMUX_DLCI_STATE_CLOSED; + modem_pipe_notify_closed(&dlci->pipe); +} + static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) { struct modem_cmux_dlci *dlci; @@ -532,6 +614,14 @@ static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) modem_cmux_on_dlci_frame_uih(dlci); break; + case MODEM_CMUX_FRAME_TYPE_SABM: + modem_cmux_on_dlci_frame_sabm(dlci); + break; + + case MODEM_CMUX_FRAME_TYPE_DISC: + modem_cmux_on_dlci_frame_disc(dlci); + break; + default: LOG_WRN("Unknown %s frame type", "DLCI"); break; @@ -996,6 +1086,7 @@ void modem_cmux_init(struct modem_cmux *cmux, const struct modem_cmux_config *co k_work_init_delayable(&cmux->connect_work, modem_cmux_connect_handler); k_work_init_delayable(&cmux->disconnect_work, modem_cmux_disconnect_handler); k_event_init(&cmux->event); + k_event_clear(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); k_event_post(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); } @@ -1071,7 +1162,6 @@ int modem_cmux_disconnect(struct modem_cmux *cmux) if (ret < 0) { return ret; } - if (k_event_wait(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT, false, MODEM_CMUX_T2_TIMEOUT) == 0) { return -EAGAIN; From 29100cdf5e779741fe79a50980a6e1a2761c208e Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Wed, 29 Nov 2023 17:47:55 +0200 Subject: [PATCH 0473/2300] [nrf fromtree] tests: modem: Modem backend mock update Added possibility for link 2 modem mock instance for validating P2P communication without any data stubbing. Signed-off-by: Juha Heiskanen (cherry picked from commit 6943cd497c8e0e81816364f6570641d367172da4) (cherry picked from commit 8dcf22f4992d5c1d509e96b78454d46956a1269d) --- tests/subsys/modem/mock/modem_backend_mock.c | 15 +++++++++++++++ tests/subsys/modem/mock/modem_backend_mock.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/tests/subsys/modem/mock/modem_backend_mock.c b/tests/subsys/modem/mock/modem_backend_mock.c index 55c5679f35f..0a12fc43674 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.c +++ b/tests/subsys/modem/mock/modem_backend_mock.c @@ -42,6 +42,15 @@ static int modem_backend_mock_transmit(void *data, const uint8_t *buf, size_t si int ret; size = (mock->limit < size) ? mock->limit : size; + + if (mock->bridge) { + struct modem_backend_mock *t_mock = mock->bridge; + + ret = ring_buf_put(&t_mock->rx_rb, buf, size); + k_work_submit(&t_mock->received_work_item.work); + return ret; + } + ret = ring_buf_put(&mock->tx_rb, buf, size); if (modem_backend_mock_update(mock, buf, size)) { modem_backend_mock_put(mock, mock->transaction->put, @@ -130,3 +139,9 @@ void modem_backend_mock_prime(struct modem_backend_mock *mock, mock->transaction = transaction; mock->transaction_match_cnt = 0; } + +void modem_backend_mock_bridge(struct modem_backend_mock *mock_a, struct modem_backend_mock *mock_b) +{ + mock_a->bridge = mock_b; + mock_b->bridge = mock_a; +} diff --git a/tests/subsys/modem/mock/modem_backend_mock.h b/tests/subsys/modem/mock/modem_backend_mock.h index 1c221963aa8..7d9ad11bf41 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.h +++ b/tests/subsys/modem/mock/modem_backend_mock.h @@ -41,6 +41,8 @@ struct modem_backend_mock { /* Max allowed read/write size */ size_t limit; + /* Mock Brige pair */ + struct modem_backend_mock *bridge; }; struct modem_backend_mock_config { @@ -63,4 +65,7 @@ void modem_backend_mock_put(struct modem_backend_mock *mock, const uint8_t *buf, void modem_backend_mock_prime(struct modem_backend_mock *mock, const struct modem_backend_mock_transaction *transaction); +void modem_backend_mock_bridge(struct modem_backend_mock *mock_a, + struct modem_backend_mock *mock_b); + #endif /* ZEPHYR_DRIVERS_MODEM_MODEM_PIPE_MOCK */ From 40502447e65525c42c7772d945c5389fc11f6508 Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Wed, 29 Nov 2023 17:43:05 +0200 Subject: [PATCH 0474/2300] [nrf fromtree] tests: mode: Modem CMUX DTE / DCE test Added unite test for for validate modem CMUX DTE & DCE role communication together. Signed-off-by: Juha Heiskanen (cherry picked from commit 34d4e503745b7f2b6b572f9c994d7140214c6847) (cherry picked from commit 018a26c48cfcb5a5d384c66686313eff65c86377) --- .../modem/modem_cmux_pair/CMakeLists.txt | 9 + tests/subsys/modem/modem_cmux_pair/prj.conf | 9 + tests/subsys/modem/modem_cmux_pair/src/main.c | 596 ++++++++++++++++++ .../modem/modem_cmux_pair/testcase.yaml | 8 + 4 files changed, 622 insertions(+) create mode 100644 tests/subsys/modem/modem_cmux_pair/CMakeLists.txt create mode 100644 tests/subsys/modem/modem_cmux_pair/prj.conf create mode 100644 tests/subsys/modem/modem_cmux_pair/src/main.c create mode 100644 tests/subsys/modem/modem_cmux_pair/testcase.yaml diff --git a/tests/subsys/modem/modem_cmux_pair/CMakeLists.txt b/tests/subsys/modem/modem_cmux_pair/CMakeLists.txt new file mode 100644 index 00000000000..00efcc5695b --- /dev/null +++ b/tests/subsys/modem/modem_cmux_pair/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2023 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(modem_cmux_pair_test) + +target_sources(app PRIVATE src/main.c ../mock/modem_backend_mock.c) +target_include_directories(app PRIVATE ../mock) diff --git a/tests/subsys/modem/modem_cmux_pair/prj.conf b/tests/subsys/modem/modem_cmux_pair/prj.conf new file mode 100644 index 00000000000..bf21fcb42ac --- /dev/null +++ b/tests/subsys/modem/modem_cmux_pair/prj.conf @@ -0,0 +1,9 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_NO_OPTIMIZATIONS=y + +CONFIG_MODEM_MODULES=y +CONFIG_MODEM_CMUX=y + +CONFIG_ZTEST=y diff --git a/tests/subsys/modem/modem_cmux_pair/src/main.c b/tests/subsys/modem/modem_cmux_pair/src/main.c new file mode 100644 index 00000000000..6c38fd7e98b --- /dev/null +++ b/tests/subsys/modem/modem_cmux_pair/src/main.c @@ -0,0 +1,596 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include + +/* CMUX state flags */ +#define EVENT_CMUX_CONNECTED BIT(0) +#define EVENT_CMUX_DLCI1_OPEN BIT(1) +#define EVENT_CMUX_DLCI2_OPEN BIT(2) +#define EVENT_CMUX_DLCI1_CLOSED BIT(3) +#define EVENT_CMUX_DLCI2_CLOSED BIT(4) +#define EVENT_CMUX_DISCONNECTED BIT(5) +#define EVENT_CMUX_DLCI1_RX_DATA BIT(6) +#define EVENT_CMUX_DLCI2_RX_DATA BIT(7) + +/* CMUX DTE variables */ +static struct modem_cmux cmux_dte; +static uint8_t cmux_receive_buf[127]; +static uint8_t cmux_transmit_buf[149]; +static struct modem_cmux_dlci dlci1; +static struct modem_cmux_dlci dlci2; +static struct modem_pipe *dlci1_pipe; +static struct modem_pipe *dlci2_pipe; + +/* CMUX DCE variables */ +static struct modem_cmux cmux_dce; +static uint8_t cmux_receive_buf_dce[127]; +static uint8_t cmux_transmit_buf_dce[149]; +static struct modem_cmux_dlci dlci1_dce; +static struct modem_cmux_dlci dlci2_dce; +static struct modem_pipe *dlci1_pipe_dce; +static struct modem_pipe *dlci2_pipe_dce; + +/* DTE & DCE Event */ +static struct k_event cmux_event_dte; +static struct k_event cmux_event_dce; + +/* Backend MOCK */ +static struct modem_backend_mock bus_mock_dte; +static struct modem_backend_mock bus_mock_dce; +static uint8_t bus_mock_rx_buf[2048]; +static uint8_t bus_mock_tx_buf[2048]; +static uint8_t bus_mock_rx_buf_dce[2048]; +static uint8_t bus_mock_tx_buf_dce[2048]; +static struct modem_pipe *bus_mock_pipe; +static struct modem_pipe *bus_mock_pipe_dce; + +static uint8_t dlci1_receive_buf[127]; +static uint8_t dlci2_receive_buf[127]; +static uint8_t dlci1_receive_buf_dce[127]; +static uint8_t dlci2_receive_buf_dce[127]; + +static uint8_t buffer1[2048]; +static uint8_t buffer2[2048]; + +static void test_dlci1_pipe_cb(struct modem_pipe *pipe, enum modem_pipe_event event, + void *user_data) +{ + switch (event) { + case MODEM_PIPE_EVENT_OPENED: + k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI1_OPEN); + break; + + case MODEM_PIPE_EVENT_CLOSED: + k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI1_CLOSED); + break; + + case MODEM_PIPE_EVENT_RECEIVE_READY: + k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI1_RX_DATA); + break; + + default: + break; + } +} + +static void test_dlci2_pipe_cb(struct modem_pipe *pipe, enum modem_pipe_event event, + void *user_data) +{ + switch (event) { + case MODEM_PIPE_EVENT_OPENED: + k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI2_OPEN); + break; + + case MODEM_PIPE_EVENT_CLOSED: + k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI2_CLOSED); + break; + case MODEM_PIPE_EVENT_RECEIVE_READY: + k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI2_RX_DATA); + break; + + default: + break; + } +} + +static void test_dlci1_pipe_cb_dce(struct modem_pipe *pipe, enum modem_pipe_event event, + void *user_data) +{ + switch (event) { + case MODEM_PIPE_EVENT_OPENED: + k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI1_OPEN); + break; + + case MODEM_PIPE_EVENT_CLOSED: + k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI1_CLOSED); + break; + + case MODEM_PIPE_EVENT_RECEIVE_READY: + k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI1_RX_DATA); + break; + + default: + break; + } +} + +static void test_dlci2_pipe_cb_dce(struct modem_pipe *pipe, enum modem_pipe_event event, + void *user_data) +{ + switch (event) { + case MODEM_PIPE_EVENT_OPENED: + k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI2_OPEN); + break; + + case MODEM_PIPE_EVENT_CLOSED: + k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI2_CLOSED); + break; + case MODEM_PIPE_EVENT_RECEIVE_READY: + k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI2_RX_DATA); + break; + + default: + break; + } +} + +/*************************************************************************************************/ +/* DLCI2 AT CMUX frames */ +/*************************************************************************************************/ +static uint8_t cmux_frame_data_dlci2_at_cgdcont[] = { + 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}; + +static uint8_t cmux_frame_data_dlci2_at_newline[] = {0x0D, 0x0A}; + +/*************************************************************************************************/ +/* DLCI1 AT CMUX frames */ +/*************************************************************************************************/ +static uint8_t cmux_frame_data_dlci1_at_at[] = {0x41, 0x54}; + +static uint8_t cmux_frame_data_dlci1_at_newline[] = {0x0D, 0x0A}; + +/*************************************************************************************************/ +/* DLCI2 PPP CMUX frames */ +/*************************************************************************************************/ +static uint8_t cmux_frame_data_dlci2_ppp_52[] = { + 0x7E, 0xFF, 0x7D, 0x23, 0xC0, 0x21, 0x7D, 0x21, 0x7D, 0x20, 0x7D, 0x20, 0x7D, + 0x38, 0x7D, 0x22, 0x7D, 0x26, 0x7D, 0x20, 0x7D, 0x20, 0x7D, 0x20, 0x7D, 0x20, + 0x7D, 0x23, 0x7D, 0x24, 0xC0, 0x23, 0x7D, 0x25, 0x7D, 0x26, 0x53, 0x96, 0x7D, + 0x38, 0xAA, 0x7D, 0x27, 0x7D, 0x22, 0x7D, 0x28, 0x7D, 0x22, 0xD5, 0xA8, 0x7E}; + +static uint8_t cmux_frame_data_dlci2_ppp_18[] = {0x7E, 0xFF, 0x7D, 0x23, 0xC0, 0x21, + 0x7D, 0x22, 0x7D, 0x21, 0x7D, 0x20, + 0x7D, 0x24, 0x7D, 0x3C, 0x90, 0x7E}; + +static void test_cmux_ctrl_cb(struct modem_cmux *cmux, enum modem_cmux_event event, void *user_data) +{ + if (event == MODEM_CMUX_EVENT_CONNECTED) { + k_event_post(&cmux_event_dte, EVENT_CMUX_CONNECTED); + return; + } + + if (event == MODEM_CMUX_EVENT_DISCONNECTED) { + k_event_post(&cmux_event_dte, EVENT_CMUX_DISCONNECTED); + return; + } +} + +static void test_cmux_ctrl_cb_dce(struct modem_cmux *cmux, enum modem_cmux_event event, + void *user_data) +{ + if (event == MODEM_CMUX_EVENT_CONNECTED) { + k_event_post(&cmux_event_dce, EVENT_CMUX_CONNECTED); + return; + } + + if (event == MODEM_CMUX_EVENT_DISCONNECTED) { + k_event_post(&cmux_event_dce, EVENT_CMUX_DISCONNECTED); + return; + } +} + +static void cmux_dte_init(void) +{ + struct modem_cmux_dlci_config dlci1_config = { + .dlci_address = 1, + .receive_buf = dlci1_receive_buf, + .receive_buf_size = sizeof(dlci1_receive_buf), + }; + + struct modem_cmux_dlci_config dlci2_config = { + .dlci_address = 2, + .receive_buf = dlci2_receive_buf, + .receive_buf_size = sizeof(dlci2_receive_buf), + }; + + struct modem_cmux_config cmux_config = { + .callback = test_cmux_ctrl_cb, + .user_data = NULL, + .receive_buf = cmux_receive_buf, + .receive_buf_size = sizeof(cmux_receive_buf), + .transmit_buf = cmux_transmit_buf, + .transmit_buf_size = ARRAY_SIZE(cmux_transmit_buf), + }; + + const struct modem_backend_mock_config bus_mock_config = { + .rx_buf = bus_mock_rx_buf, + .rx_buf_size = sizeof(bus_mock_rx_buf), + .tx_buf = bus_mock_tx_buf, + .tx_buf_size = sizeof(bus_mock_tx_buf), + .limit = 32, + }; + + modem_cmux_init(&cmux_dte, &cmux_config); + dlci1_pipe = modem_cmux_dlci_init(&cmux_dte, &dlci1, &dlci1_config); + dlci2_pipe = modem_cmux_dlci_init(&cmux_dte, &dlci2, &dlci2_config); + /* Init Backend DTE */ + bus_mock_pipe = modem_backend_mock_init(&bus_mock_dte, &bus_mock_config); + __ASSERT_NO_MSG(modem_pipe_open(bus_mock_pipe) == 0); + __ASSERT_NO_MSG(modem_cmux_attach(&cmux_dte, bus_mock_pipe) == 0); + modem_pipe_attach(dlci1_pipe, test_dlci1_pipe_cb, NULL); + modem_pipe_attach(dlci2_pipe, test_dlci2_pipe_cb, NULL); +} + +static void cmux_dce_init(void) +{ + struct modem_cmux_dlci_config dlci1_config = { + .dlci_address = 1, + .receive_buf = dlci1_receive_buf_dce, + .receive_buf_size = sizeof(dlci1_receive_buf_dce), + }; + + struct modem_cmux_dlci_config dlci2_config = { + .dlci_address = 2, + .receive_buf = dlci2_receive_buf_dce, + .receive_buf_size = sizeof(dlci2_receive_buf_dce), + }; + + struct modem_cmux_config cmux_config_dce = { + .callback = test_cmux_ctrl_cb_dce, + .user_data = NULL, + .receive_buf = cmux_receive_buf_dce, + .receive_buf_size = sizeof(cmux_receive_buf_dce), + .transmit_buf = cmux_transmit_buf_dce, + .transmit_buf_size = ARRAY_SIZE(cmux_transmit_buf_dce), + }; + + const struct modem_backend_mock_config bus_mock_config = { + .rx_buf = bus_mock_rx_buf_dce, + .rx_buf_size = sizeof(bus_mock_rx_buf_dce), + .tx_buf = bus_mock_tx_buf_dce, + .tx_buf_size = sizeof(bus_mock_tx_buf_dce), + .limit = 32, + }; + + modem_cmux_init(&cmux_dce, &cmux_config_dce); + dlci1_pipe_dce = modem_cmux_dlci_init(&cmux_dce, &dlci1_dce, &dlci1_config); + dlci2_pipe_dce = modem_cmux_dlci_init(&cmux_dce, &dlci2_dce, &dlci2_config); + /* Init Backend DCE */ + bus_mock_pipe_dce = modem_backend_mock_init(&bus_mock_dce, &bus_mock_config); + __ASSERT_NO_MSG(modem_pipe_open(bus_mock_pipe_dce) == 0); + __ASSERT_NO_MSG(modem_cmux_attach(&cmux_dce, bus_mock_pipe_dce) == 0); + modem_pipe_attach(dlci1_pipe_dce, test_dlci1_pipe_cb_dce, NULL); + modem_pipe_attach(dlci2_pipe_dce, test_dlci2_pipe_cb_dce, NULL); +} + +static void *test_setup(void) +{ + uint32_t events; + + /* Init Event mask's */ + k_event_init(&cmux_event_dte); + k_event_init(&cmux_event_dce); + + /* Init CMUX, Pipe and Backend instances */ + cmux_dte_init(); + cmux_dce_init(); + + /* Create MOCK bridge */ + modem_backend_mock_bridge(&bus_mock_dte, &bus_mock_dce); + + /* Connect CMUX by DTE */ + __ASSERT_NO_MSG(modem_cmux_connect_async(&cmux_dte) == 0); + events = k_event_wait(&cmux_event_dte, EVENT_CMUX_CONNECTED, false, K_MSEC(100)); + __ASSERT_NO_MSG((events & EVENT_CMUX_CONNECTED)); + events = k_event_wait(&cmux_event_dce, EVENT_CMUX_CONNECTED, false, K_MSEC(100)); + __ASSERT_NO_MSG((events & EVENT_CMUX_CONNECTED)); + + /* Open DLCI channels init by DTE */ + __ASSERT_NO_MSG(modem_pipe_open_async(dlci1_pipe) == 0); + events = k_event_wait(&cmux_event_dte, EVENT_CMUX_DLCI1_OPEN, false, K_MSEC(100)); + __ASSERT_NO_MSG((events & EVENT_CMUX_DLCI1_OPEN)); + events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI1_OPEN, false, K_MSEC(100)); + __ASSERT_NO_MSG((events & EVENT_CMUX_DLCI1_OPEN)); + + __ASSERT_NO_MSG(modem_pipe_open_async(dlci2_pipe) == 0); + events = k_event_wait(&cmux_event_dte, EVENT_CMUX_DLCI2_OPEN, false, K_MSEC(100)); + __ASSERT_NO_MSG((events & EVENT_CMUX_DLCI2_OPEN)); + events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI2_OPEN, false, K_MSEC(100)); + __ASSERT_NO_MSG((events & EVENT_CMUX_DLCI2_OPEN)); + + return NULL; +} + +static void test_before(void *f) +{ + /* Reset events */ + k_event_clear(&cmux_event_dte, UINT32_MAX); + k_event_clear(&cmux_event_dce, UINT32_MAX); + + /* Reset mock pipes */ + modem_backend_mock_reset(&bus_mock_dte); + modem_backend_mock_reset(&bus_mock_dce); +} + +ZTEST(modem_cmux_pair, test_modem_cmux_dce_receive_dlci2_at) +{ + int ret; + uint32_t events; + + modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_at_cgdcont, + sizeof(cmux_frame_data_dlci2_at_cgdcont)); + + modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_at_newline, + sizeof(cmux_frame_data_dlci2_at_newline)); + + k_msleep(100); + + events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI2_RX_DATA, false, K_MSEC(100)); + zassert_true((events & EVENT_CMUX_DLCI2_RX_DATA), "DLCI2 dce not rx data"); + + ret = modem_pipe_receive(dlci2_pipe_dce, 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(modem_cmux_pair, test_modem_cmux_dce_receive_dlci1_at) +{ + int ret; + uint32_t events; + + modem_pipe_transmit(dlci1_pipe, cmux_frame_data_dlci1_at_at, + sizeof(cmux_frame_data_dlci1_at_at)); + modem_pipe_transmit(dlci1_pipe, cmux_frame_data_dlci1_at_newline, + sizeof(cmux_frame_data_dlci1_at_newline)); + + k_msleep(100); + + events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI1_RX_DATA, false, K_MSEC(100)); + zassert_true((events & EVENT_CMUX_DLCI1_RX_DATA), "DLCI1 dce not rx data"); + + ret = modem_pipe_receive(dlci1_pipe_dce, buffer1, sizeof(buffer1)); + zassert_true(ret == (sizeof(cmux_frame_data_dlci1_at_at) + + sizeof(cmux_frame_data_dlci1_at_newline)), + "Incorrect number of bytes received"); + + zassert_true(memcmp(buffer1, cmux_frame_data_dlci1_at_at, + sizeof(cmux_frame_data_dlci1_at_at)) == 0, + "Incorrect data received"); + + zassert_true(memcmp(&buffer1[sizeof(cmux_frame_data_dlci1_at_at)], + cmux_frame_data_dlci1_at_newline, + sizeof(cmux_frame_data_dlci1_at_newline)) == 0, + "Incorrect data received"); +} + +ZTEST(modem_cmux_pair, test_modem_cmux_dce_receive_dlci2_ppp) +{ + int ret; + + uint32_t events; + + modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_ppp_52, + sizeof(cmux_frame_data_dlci2_ppp_52)); + modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_ppp_18, + sizeof(cmux_frame_data_dlci2_ppp_18)); + + k_msleep(100); + + events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI2_RX_DATA, false, K_MSEC(100)); + zassert_true((events & EVENT_CMUX_DLCI2_RX_DATA), "DLCI2 dce not rx data"); + + ret = modem_pipe_receive(dlci2_pipe_dce, buffer2, sizeof(buffer2)); + zassert_true(ret == (sizeof(cmux_frame_data_dlci2_ppp_52) + + sizeof(cmux_frame_data_dlci2_ppp_18)), + "Incorrect number of bytes received"); + + zassert_true(memcmp(buffer2, cmux_frame_data_dlci2_ppp_52, + sizeof(cmux_frame_data_dlci2_ppp_52)) == 0, + "Incorrect data received"); + + zassert_true(memcmp(&buffer2[sizeof(cmux_frame_data_dlci2_ppp_52)], + cmux_frame_data_dlci2_ppp_18, + sizeof(cmux_frame_data_dlci2_ppp_18)) == 0, + "Incorrect data received"); +} + +ZTEST(modem_cmux_pair, test_modem_cmux_dce_transmit_dlci2_ppp) +{ + int ret; + uint32_t events; + + ret = modem_pipe_transmit(dlci2_pipe_dce, cmux_frame_data_dlci2_ppp_52, + sizeof(cmux_frame_data_dlci2_ppp_52)); + + zassert_true(ret == sizeof(cmux_frame_data_dlci2_ppp_52), "Failed to send DLCI2 PPP 52 %d", + ret); + ret = modem_pipe_transmit(dlci2_pipe_dce, cmux_frame_data_dlci2_ppp_18, + sizeof(cmux_frame_data_dlci2_ppp_18)); + + zassert_true(ret == sizeof(cmux_frame_data_dlci2_ppp_18), "Failed to send DLCI2 PPP 18"); + + k_msleep(100); + + events = k_event_wait(&cmux_event_dte, EVENT_CMUX_DLCI2_RX_DATA, false, K_MSEC(100)); + zassert_true((events & EVENT_CMUX_DLCI2_RX_DATA), "DLCI2 dce not rx data"); + + ret = modem_pipe_receive(dlci2_pipe, buffer2, sizeof(buffer2)); + zassert_true(ret == (sizeof(cmux_frame_data_dlci2_ppp_52) + + sizeof(cmux_frame_data_dlci2_ppp_18)), + "Incorrect number of bytes received"); + + zassert_true(memcmp(buffer2, cmux_frame_data_dlci2_ppp_52, + sizeof(cmux_frame_data_dlci2_ppp_52)) == 0, + "Incorrect data received"); + + zassert_true(memcmp(&buffer2[sizeof(cmux_frame_data_dlci2_ppp_52)], + cmux_frame_data_dlci2_ppp_18, + sizeof(cmux_frame_data_dlci2_ppp_18)) == 0, + "Incorrect data received"); +} + +ZTEST(modem_cmux_pair, test_modem_cmux_dlci1_close_open) +{ + uint32_t events; + + /* Close DLCI1 */ + zassert_true(modem_pipe_close_async(dlci1_pipe) == 0, "Failed to close DLCI1 pipe"); + k_msleep(100); + events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DLCI1_CLOSED), false, K_MSEC(100)); + + zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "DLCI1 not closed as expected"); + events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DLCI1_CLOSED), false, K_MSEC(100)); + + zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "DLCI1 not closed as expected"); + + /* Open DLCI1 */ + zassert_true(modem_pipe_open_async(dlci1_pipe) == 0, "Failed to open DLCI1 pipe"); + + k_msleep(100); + + events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DLCI1_OPEN), false, K_MSEC(100)); + + zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DLCI1 not opened as expected"); + events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DLCI1_OPEN), false, K_MSEC(100)); + + zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DLCI1 not opened as expected"); +} + +ZTEST(modem_cmux_pair, test_modem_cmux_disconnect_connect) +{ + uint32_t events; + + /* Disconnect CMUX */ + zassert_true(modem_pipe_close_async(dlci1_pipe) == 0, "Failed to close DLCI1"); + zassert_true(modem_pipe_close_async(dlci2_pipe) == 0, "Failed to close DLCI2"); + k_msleep(100); + + events = k_event_wait_all(&cmux_event_dte, + (EVENT_CMUX_DLCI1_CLOSED | EVENT_CMUX_DLCI2_CLOSED), false, + K_MSEC(100)); + + zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "Failed to close DLCI1"); + zassert_true((events & EVENT_CMUX_DLCI2_CLOSED), "Failed to close DLCI2"); + + /* Discard CMUX DLCI DISC commands */ + modem_backend_mock_reset(&bus_mock_dte); + zassert_true(modem_cmux_disconnect_async(&cmux_dte) == 0, "Failed to disconnect CMUX"); + + k_msleep(100); + + events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DISCONNECTED), false, K_MSEC(100)); + zassert_true((events & EVENT_CMUX_DISCONNECTED), "Failed to disconnect CMUX"); + + /* Reconnect CMUX */ + zassert_true(modem_cmux_connect_async(&cmux_dte) == 0, "Failed to connect CMUX"); + + k_msleep(100); + + events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_CONNECTED), false, K_MSEC(100)); + zassert_true((events & EVENT_CMUX_CONNECTED), "Failed to connect CMUX"); + + /* Open DLCI1 */ + zassert_true(modem_pipe_open_async(dlci1_pipe) == 0, "Failed to open DLCI1 pipe"); + + k_msleep(100); + + events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DLCI1_OPEN), false, K_MSEC(100)); + + zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DLCI1 not opened as expected"); + + /* Open DLCI2 */ + zassert_true(modem_pipe_open_async(dlci2_pipe) == 0, "Failed to open DLCI2 pipe"); + + k_msleep(100); + + events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DLCI2_OPEN), false, K_MSEC(100)); + + zassert_true((events & EVENT_CMUX_DLCI2_OPEN), "DLCI1 not opened as expected"); +} + +ZTEST(modem_cmux_pair, test_modem_cmux_disconnect_connect_sync) +{ + uint32_t events; + + zassert_true(modem_pipe_close(dlci1_pipe) == 0, "Failed to close DLCI1"); + zassert_true(modem_pipe_close(dlci2_pipe) == 0, "Failed to close DLCI2"); + events = k_event_wait_all(&cmux_event_dce, + (EVENT_CMUX_DLCI1_CLOSED | EVENT_CMUX_DLCI2_CLOSED), false, + K_MSEC(100)); + zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "DCE DLCI1 not closed as expected"); + zassert_true((events & EVENT_CMUX_DLCI2_CLOSED), "DCE DLCI2 not closed as expected"); + + zassert_true(modem_cmux_disconnect(&cmux_dte) == 0, "Failed to disconnect CMUX"); + zassert_true(modem_cmux_disconnect(&cmux_dte) == -EALREADY, + "Should already be disconnected"); + zassert_true(modem_cmux_disconnect(&cmux_dce) == -EALREADY, + "Should already be disconnected"); + + k_msleep(100); + + zassert_true(modem_cmux_connect(&cmux_dte) == 0, "Failed to connect CMUX"); + zassert_true(modem_cmux_connect(&cmux_dte) == -EALREADY, "Should already be connected"); + zassert_true(modem_cmux_connect(&cmux_dce) == -EALREADY, "Should already be connected"); + + zassert_true(modem_pipe_open(dlci1_pipe) == 0, "Failed to open DLCI1 pipe"); + zassert_true(modem_pipe_open(dlci2_pipe) == 0, "Failed to open DLCI2 pipe"); + events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DLCI1_OPEN | EVENT_CMUX_DLCI2_OPEN), + false, K_MSEC(100)); + zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DCE DLCI1 not open as expected"); + zassert_true((events & EVENT_CMUX_DLCI2_OPEN), "DCE DLCI2 not open as expected"); +} + +ZTEST(modem_cmux_pair, test_modem_cmux_dlci_close_open_sync) +{ + uint32_t events; + + zassert_true(modem_pipe_close(dlci1_pipe) == 0, "Failed to close DLCI1"); + zassert_true(modem_pipe_close(dlci2_pipe) == 0, "Failed to close DLCI2"); + + events = k_event_wait_all(&cmux_event_dce, + (EVENT_CMUX_DLCI1_CLOSED | EVENT_CMUX_DLCI2_CLOSED), false, + K_MSEC(100)); + zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "DCE DLCI1 not closed as expected"); + zassert_true((events & EVENT_CMUX_DLCI2_CLOSED), "DCE DLCI2 not closed as expected"); + + zassert_true(modem_pipe_open(dlci1_pipe) == 0, "Failed to open DLCI1 pipe"); + zassert_true(modem_pipe_open(dlci2_pipe) == 0, "Failed to open DLCI2 pipe"); + /* Verify DCE side channels are open also */ + events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DLCI1_OPEN | EVENT_CMUX_DLCI2_OPEN), + false, K_MSEC(100)); + zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DCE DLCI1 not open as expected"); + zassert_true((events & EVENT_CMUX_DLCI2_OPEN), "DCE DLCI2 not open as expected"); +} + +ZTEST_SUITE(modem_cmux_pair, NULL, test_setup, test_before, NULL, NULL); diff --git a/tests/subsys/modem/modem_cmux_pair/testcase.yaml b/tests/subsys/modem/modem_cmux_pair/testcase.yaml new file mode 100644 index 00000000000..9d0cdf33420 --- /dev/null +++ b/tests/subsys/modem/modem_cmux_pair/testcase.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +tests: + modem.modem_cmux_pair: + tags: modem_cmux + harness: ztest + platform_allow: native_sim From 137218cc886efde3c94113de636ba6b4dc112b18 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Sun, 29 Oct 2023 10:00:28 +0100 Subject: [PATCH 0475/2300] [nrf fromtree] drivers: Add cellular API for network configuration Adds two APIs which allow for configuring the cellular network configuration of a cellular network device. like a cellular modem. The first allows for configuring which access technology to use, and optionally, which bands to use. The second allows for getting all supported access technologies are supported, and which bands for each tech are supported. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit ad011695aba725f6c5887981529e12d101d968a6) (cherry picked from commit d93c2baa7f08f14b75050ed37f170ece69714c88) --- include/zephyr/drivers/cellular.h | 101 ++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 include/zephyr/drivers/cellular.h diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h new file mode 100644 index 00000000000..303e5237e84 --- /dev/null +++ b/include/zephyr/drivers/cellular.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2023 Bjarki Arge Andreasen + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file drivers/cellular.h + * @brief Public cellular network API + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ +#define ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ + +/** + * @brief Cellular interface + * @defgroup cellular_interface Cellular Interface + * @ingroup io_interfaces + * @{ + */ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Cellular access technologies */ +enum cellular_access_technology { + CELLULAR_ACCESS_TECHNOLOGY_GSM = 0, + CELLULAR_ACCESS_TECHNOLOGY_GPRS, + CELLULAR_ACCESS_TECHNOLOGY_UMTS, + CELLULAR_ACCESS_TECHNOLOGY_EDGE, + CELLULAR_ACCESS_TECHNOLOGY_LTE, + CELLULAR_ACCESS_TECHNOLOGY_LTE_CAT_M1, + CELLULAR_ACCESS_TECHNOLOGY_LTE_CAT_M2, + CELLULAR_ACCESS_TECHNOLOGY_NB_IOT, +}; + +/** Cellular network structure */ +struct cellular_network { + /** Cellular access technology */ + enum cellular_access_technology technology; + /** + * List of bands, as defined by the specified cellular access technology, + * to enables. All supported bands are enabled if none are provided. + */ + uint16_t *bands; + /** Size of bands */ + uint16_t size; +}; + +/** + * @brief Configure cellular networks for the device + * + * @details Cellular network devices support at least one cellular access technology. + * Each cellular access technology defines a set of bands, of which the cellular device + * will support all or a subset of. + * + * The cellular device can only use one cellular network technology at a time. It must + * exclusively use the cellular network configurations provided, and will prioritize + * the cellular network configurations in the order they are provided in case there are + * multiple (the first cellular network configuration has the highest priority). + * + * @param dev Cellular network device instance. + * @param networks List of cellular network configurations to apply. + * @param size Size of list of cellular network configurations. + * + * @retval 0 if successful. + * @retval -EINVAL if any provided cellular network configuration is invalid or unsupported. + * @retval -ENOTSUP if API is not supported by cellular network device. + * @retval Negative errno-code otherwise. + */ +int cellular_configure_networks(const struct device *dev, const struct cellular_network *networks, + uint8_t size); + +/** + * @brief Get supported cellular networks for the device + * + * @param dev Cellular network device instance + * @param networks Pointer to list of supported cellular network configurations. + * @param size Size of list of cellular network configurations. + * + * @retval 0 if successful. + * @retval -ENOTSUP if API is not supported by cellular network device. + * @retval Negative errno-code otherwise. + */ +int cellular_get_supported_networks(const struct device *dev, + const struct cellular_network **networks, uint8_t *size); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ */ From 0b0496425c9ad0d54ed049515b57aed757f71f5e Mon Sep 17 00:00:00 2001 From: Lucas Denefle Date: Mon, 6 Nov 2023 16:32:01 +0000 Subject: [PATCH 0476/2300] [nrf fromtree] drivers: cellular: add signal and modem_info API Implement modem info pulling using the init and periodic chat scripts Signed-off-by: Lucas Denefle (cherry picked from commit d1ba79a070d6939d0bf52fe4f9faf2ad3d89a4f4) (cherry picked from commit 57304f06779d3697af68c37f5e692a2af94c5e14) --- drivers/modem/modem_cellular.c | 231 ++++++++++++++++++++++++++---- include/zephyr/drivers/cellular.h | 53 +++++++ 2 files changed, 259 insertions(+), 25 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index a038da1805e..ad1bb920cd5 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -25,6 +26,13 @@ LOG_MODULE_REGISTER(modem_cellular, CONFIG_MODEM_LOG_LEVEL); #define MODEM_CELLULAR_PERIODIC_SCRIPT_TIMEOUT \ K_MSEC(CONFIG_MODEM_CELLULAR_PERIODIC_SCRIPT_MS) +#define MODEM_CELLULAR_DATA_IMEI_LEN (15) +#define MODEM_CELLULAR_DATA_MODEL_ID_LEN (64) +#define MODEM_CELLULAR_DATA_IMSI_LEN (22) +#define MODEM_CELLULAR_DATA_ICCID_LEN (22) +#define MODEM_CELLULAR_DATA_MANUFACTURER_LEN (64) +#define MODEM_CELLULAR_DATA_FW_VERSION_LEN (64) + enum modem_cellular_state { MODEM_CELLULAR_STATE_IDLE = 0, MODEM_CELLULAR_STATE_RESET_PULSE, @@ -83,11 +91,16 @@ struct modem_cellular_data { uint8_t *chat_argv[32]; /* Status */ - uint8_t imei[15]; - uint8_t hwinfo[64]; uint8_t registration_status_gsm; uint8_t registration_status_gprs; uint8_t registration_status_lte; + int8_t rssi; + uint8_t imei[MODEM_CELLULAR_DATA_IMEI_LEN]; + uint8_t model_id[MODEM_CELLULAR_DATA_MODEL_ID_LEN]; + uint8_t imsi[MODEM_CELLULAR_DATA_IMSI_LEN]; + uint8_t iccid[MODEM_CELLULAR_DATA_ICCID_LEN]; + uint8_t manufacturer[MODEM_CELLULAR_DATA_MANUFACTURER_LEN]; + uint8_t fw_version[MODEM_CELLULAR_DATA_FW_VERSION_LEN]; /* PPP */ struct modem_ppp *ppp; @@ -118,6 +131,7 @@ struct modem_cellular_config { const struct modem_chat_script *init_chat_script; const struct modem_chat_script *dial_chat_script; const struct modem_chat_script *periodic_chat_script; + const struct modem_chat_script *get_signal_chat_script; }; static const char *modem_cellular_state_str(enum modem_cellular_state state) @@ -276,16 +290,34 @@ static void modem_cellular_chat_on_imei(struct modem_chat *chat, char **argv, ui return; } - if (strlen(argv[1]) != 15) { + strncpy(data->imei, argv[1], sizeof(data->imei)); +} + +static void modem_cellular_chat_on_cgmm(struct modem_chat *chat, char **argv, uint16_t argc, + void *user_data) +{ + struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; + + if (argc != 2) { return; } - for (uint8_t i = 0; i < 15; i++) { - data->imei[i] = argv[1][i] - '0'; + strncpy(data->model_id, argv[1], sizeof(data->model_id)); +} + +static void modem_cellular_chat_on_cgmi(struct modem_chat *chat, char **argv, uint16_t argc, + void *user_data) +{ + struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; + + if (argc != 2) { + return; } + + strncpy(data->manufacturer, argv[1], sizeof(data->manufacturer)); } -static void modem_cellular_chat_on_cgmm(struct modem_chat *chat, char **argv, uint16_t argc, +static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, uint16_t argc, void *user_data) { struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; @@ -294,7 +326,50 @@ static void modem_cellular_chat_on_cgmm(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->hwinfo, argv[1], sizeof(data->hwinfo) - 1); + strncpy(data->fw_version, argv[1], sizeof(data->fw_version)); +} + +static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uint16_t argc, + void *user_data) +{ + uint8_t rssi; + + /* AT+CSQ returns a response +CSQ: , where: + * - rssi is a integer from 0 to 31 whose values describes a signal strength + * between -113 dBm for 0 and -51dbM for 31 or unknown for 99 + * - ber is an integer from 0 to 7 that describes the error rate, it can also + * be 99 for an unknown error rate + */ + struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; + + if (argc != 3) { + return; + } + + /* Read rssi */ + rssi = atoi(argv[1]); + + if (rssi == 99) { + return; + } + + data->rssi = (-113 + (2 * rssi)); +} + +static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, uint16_t argc, + void *user_data) +{ + struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; + + strncpy(data->imsi, (char *)argv[1], sizeof(data->imsi)); +} + +static void modem_cellular_chat_on_iccid(struct modem_chat *chat, char **argv, uint16_t argc, + void *user_data) +{ + struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; + + strncpy(data->iccid, (char *)argv[1], sizeof(data->iccid)); } static bool modem_cellular_is_registered(struct modem_cellular_data *data) @@ -346,6 +421,11 @@ MODEM_CHAT_MATCHES_DEFINE(allow_match, MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); +MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); +MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); +MODEM_CHAT_MATCH_DEFINE(ccid_match, "+QCCID: ", "", modem_cellular_chat_on_iccid); +MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); +MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); MODEM_CHAT_MATCHES_DEFINE(unsol_matches, MODEM_CHAT_MATCH("+CREG: ", ",", modem_cellular_chat_on_cxreg), @@ -1336,6 +1416,14 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+QCCID", ccid_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127", 300)); MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_init_chat_script, quectel_bg95_init_chat_script_cmds, @@ -1355,29 +1443,45 @@ MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_dial_chat_script, quectel_bg95_dial_chat_s MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match)); + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_periodic_chat_script, quectel_bg95_periodic_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 4); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_get_signal_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); + +MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_get_signal_chat_script, + quectel_bg95_get_signal_chat_script_cmds, abort_matches, + modem_cellular_chat_callback_handler, 4); #endif #if DT_HAS_COMPAT_STATUS_OKAY(quectel_eg25_g) -MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_init_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("ATE0", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), - MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127,10,3,30,10,2", - 100)); +MODEM_CHAT_SCRIPT_CMDS_DEFINE( + quectel_eg25_g_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("ATE0", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+QCCID", ccid_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127,10,3,30,10,2", 100)); MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_init_chat_script, quectel_eg25_g_init_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 10); @@ -1396,11 +1500,19 @@ MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_dial_chat_script, quectel_eg25_g_dial_ch MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match)); + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_periodic_chat_script, quectel_eg25_g_periodic_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 4); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_get_signal_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); + +MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_get_signal_chat_script, + quectel_eg25_g_get_signal_chat_script_cmds, abort_matches, + modem_cellular_chat_callback_handler, 4); #endif #if DT_HAS_COMPAT_STATUS_OKAY(zephyr_gsm_ppp) @@ -1708,7 +1820,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, .shutdown_time_ms = 5000, \ .init_chat_script = &quectel_bg95_init_chat_script, \ .dial_chat_script = &quectel_bg95_dial_chat_script, \ - .periodic_chat_script = &quectel_bg95_periodic_chat_script, \ + .periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \ + .get_signal_chat_script = &_CONCAT(DT_DRV_COMPAT, _get_signal_chat_script), \ }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ @@ -1737,6 +1850,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, .init_chat_script = &quectel_eg25_g_init_chat_script, \ .dial_chat_script = &quectel_eg25_g_dial_chat_script, \ .periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \ + .get_signal_chat_script = &_CONCAT(DT_DRV_COMPAT, _get_signal_chat_script), \ }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ @@ -1945,3 +2059,70 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #define DT_DRV_COMPAT telit_me910g1 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) #undef DT_DRV_COMPAT + +int cellular_get_modem_info(const struct device *dev, enum cellular_modem_info_type type, + char *info, size_t size) +{ + int ret = 0; + struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; + + switch (type) { + case CELLULAR_MODEM_INFO_IMEI: + strncpy(info, &data->imei[0], MIN(size, sizeof(data->imei))); + break; + case CELLULAR_MODEM_INFO_SIM_IMSI: + strncpy(info, &data->imsi[0], MIN(size, sizeof(data->imsi))); + break; + case CELLULAR_MODEM_INFO_SIM_ICCID: + strncpy(info, &data->iccid[0], MIN(size, sizeof(data->iccid))); + break; + case CELLULAR_MODEM_INFO_MANUFACTURER: + strncpy(info, &data->manufacturer[0], MIN(size, sizeof(data->manufacturer))); + break; + case CELLULAR_MODEM_INFO_FW_VERSION: + strncpy(info, &data->fw_version[0], MIN(size, sizeof(data->fw_version))); + break; + case CELLULAR_MODEM_INFO_MODEL_ID: + strncpy(info, &data->model_id[0], MIN(size, sizeof(data->model_id))); + break; + default: + ret = -ENODATA; + break; + } + + return ret; +} + +int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, + int16_t *value) +{ + int ret; + struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; + const struct modem_cellular_config *config = (struct modem_cellular_config *)dev->config; + + if (config->get_signal_chat_script == NULL) { + return -ENOTSUP; + } + + if ((data->state != MODEM_CELLULAR_STATE_AWAIT_REGISTERED) && + (data->state != MODEM_CELLULAR_STATE_CARRIER_ON)) { + return -ENODATA; + } + + ret = modem_chat_run_script(&data->chat, config->get_signal_chat_script); + if (ret != 0) { + return ret; + } + + switch (type) { + case CELLULAR_SIGNAL_RSSI: { + *value = data->rssi; + } break; + case CELLULAR_SIGNAL_RSRP: + return -ENOTSUP; + case CELLULAR_SIGNAL_RSRQ: + return -ENOTSUP; + } + + return ret; +} diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h index 303e5237e84..83135967123 100644 --- a/include/zephyr/drivers/cellular.h +++ b/include/zephyr/drivers/cellular.h @@ -52,6 +52,28 @@ struct cellular_network { uint16_t size; }; +enum cellular_signal_type { + CELLULAR_SIGNAL_RSSI, + CELLULAR_SIGNAL_RSRP, + CELLULAR_SIGNAL_RSRQ, +}; + +/** Cellular modem info type */ +enum cellular_modem_info_type { + /** International Mobile Equipment Identity */ + CELLULAR_MODEM_INFO_IMEI, + /** Modem model ID */ + CELLULAR_MODEM_INFO_MODEL_ID, + /** Modem manufacturer */ + CELLULAR_MODEM_INFO_MANUFACTURER, + /** Modem fw version */ + CELLULAR_MODEM_INFO_FW_VERSION, + /** International Mobile Subscriber Identity */ + CELLULAR_MODEM_INFO_SIM_IMSI, + /** Integrated Circuit Card Identification Number (SIM) */ + CELLULAR_MODEM_INFO_SIM_ICCID, +}; + /** * @brief Configure cellular networks for the device * @@ -90,6 +112,37 @@ int cellular_configure_networks(const struct device *dev, const struct cellular_ int cellular_get_supported_networks(const struct device *dev, const struct cellular_network **networks, uint8_t *size); +/** + * @brief Get signal for the device + * + * @param dev Cellular network device instance + * @param type Type of the signal information requested + * @param value Signal strength destination (one of RSSI, RSRP, RSRQ) + * + * @retval 0 if successful. + * @retval -ENOTSUP if API is not supported by cellular network device. + * @retval -ENODATA if device is not in a state where signal can be polled + * @retval Negative errno-code otherwise. + */ +int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, + int16_t *value); + +/** + * @brief Get modem info for the device + * + * @param dev Cellular network device instance + * @param type Type of the modem info requested + * @param info Info string destination + * @param size Info string size + * + * @retval 0 if successful. + * @retval -ENOTSUP if API is not supported by cellular network device. + * @retval -ENODATA if modem does not provide info requested + * @retval Negative errno-code from chat module otherwise. + */ +int cellular_get_modem_info(const struct device *dev, const enum cellular_modem_info_type type, + char *info, size_t size); + #ifdef __cplusplus } #endif From 37e944781bdab749c2efa637b3caf5ecaf8bac8f Mon Sep 17 00:00:00 2001 From: Alessio Lei Date: Tue, 12 Dec 2023 14:28:20 +0100 Subject: [PATCH 0477/2300] [nrf fromtree] drivers: modem: remove dependency of modem_socket Fixed Kconfig to remove dependency between modem_socket and modem_context, the two do not depend on each other and should be possible to use independently Signed-off-by: Alessio Lei (cherry picked from commit 733b81d2c79fe17ca993ce9875f6790f7b756459) (cherry picked from commit e4c7fef4599f80bd2394330a11c57902f34ab73e) --- drivers/modem/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/modem/Kconfig b/drivers/modem/Kconfig index c233d5db821..02e3557918f 100644 --- a/drivers/modem/Kconfig +++ b/drivers/modem/Kconfig @@ -142,6 +142,8 @@ config MODEM_CMD_HANDLER_MAX_PARAM_COUNT of the match_buf (match_buf_len) field as it needs to be large enough to hold a single line of data (ending with /r). +endif # MODEM_CONTEXT + config MODEM_SOCKET bool "Generic modem socket support layer" help @@ -165,8 +167,6 @@ config MODEM_SOCKET_PACKET_COUNT these values are organized into "packets". This setting limits the maximum number of packet sizes the socket can keep track of. -endif # MODEM_CONTEXT - config MODEM_SHELL bool "Modem shell utilities" select SHELL From 9616cdb230e580641c8393fd2627f24b865f9d7e Mon Sep 17 00:00:00 2001 From: Lucas Denefle Date: Tue, 19 Dec 2023 15:20:01 +0000 Subject: [PATCH 0478/2300] [nrf fromtree] drivers: cellular: add ldenefle to copyright Add Lucas Denefle to copyright of the cellular API. Signed-off-by: Lucas Denefle (cherry picked from commit a5e5c1d00aa19138e7c88430e5e95a8dacdeada2) (cherry picked from commit a3dd7a71cb4e1e7f56ac3143fda767819e939ff8) --- include/zephyr/drivers/cellular.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h index 83135967123..445cd83857c 100644 --- a/include/zephyr/drivers/cellular.h +++ b/include/zephyr/drivers/cellular.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2023 Bjarki Arge Andreasen + * Copyright (c) 2023 Lucas Denefle * * SPDX-License-Identifier: Apache-2.0 */ From f915b63c0b96da804f1908b704adcfaec7b14128 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 29 Dec 2023 11:23:38 +0200 Subject: [PATCH 0479/2300] [nrf fromtree] modem: cmux: fix frame data length encoding In cases where the data is bigger than 127 bytes, the first bit of the second byte of the data length field used to always be set. This is wrong as according to the 3GPP 27.010 spec only the first bit of the first byte is the EA bit; all the others denote the data length. Signed-off-by: Tomi Fontanilles (cherry picked from commit 6564e8b756c95d3cc5b5e473d5b6b27d31c6cdb2) (cherry picked from commit 58de2e316c4726de422f79770623e959c002dff9) --- subsys/modem/modem_cmux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 29ff41c1ca7..3ace00d6583 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -232,7 +232,7 @@ static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, byte = data_len << 1; fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); ring_buf_put(&cmux->transmit_rb, &byte, 1); - byte = 0x01 | (data_len >> 7); + byte = data_len >> 7; ring_buf_put(&cmux->transmit_rb, &byte, 1); } else { byte = 0x01 | (data_len << 1); From bbd5d79029cad3c5173b52d2e0aed81a0e098947 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 29 Dec 2023 10:44:28 +0100 Subject: [PATCH 0480/2300] [nrf fromtree] modem: cellular: Restructure cellular API to fit device driver model The current cellular API header is not written to conform with the device driver model. This commit fixes that. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 6f55309659ed8fd5d96d7ecf4819a7987e43bd23) (cherry picked from commit 361f49fb816f127641df59214b46fb99b7984721) --- include/zephyr/drivers/cellular.h | 100 +++++++++++++++++++++++++++--- 1 file changed, 92 insertions(+), 8 deletions(-) diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h index 445cd83857c..b4202d81b0a 100644 --- a/include/zephyr/drivers/cellular.h +++ b/include/zephyr/drivers/cellular.h @@ -53,6 +53,7 @@ struct cellular_network { uint16_t size; }; +/** Cellular signal type */ enum cellular_signal_type { CELLULAR_SIGNAL_RSSI, CELLULAR_SIGNAL_RSRP, @@ -75,6 +76,33 @@ enum cellular_modem_info_type { CELLULAR_MODEM_INFO_SIM_ICCID, }; +/** API for configuring networks */ +typedef int (*cellular_api_configure_networks)(const struct device *dev, + const struct cellular_network *networks, + uint8_t size); + +/** API for getting supported networks */ +typedef int (*cellular_api_get_supported_networks)(const struct device *dev, + const struct cellular_network **networks, + uint8_t *size); + +/** API for getting network signal strength */ +typedef int (*cellular_api_get_signal)(const struct device *dev, + const enum cellular_signal_type type, int16_t *value); + +/** API for getting modem information */ +typedef int (*cellular_api_get_modem_info)(const struct device *dev, + const enum cellular_modem_info_type type, + char *info, size_t size); + +/** Cellular driver API */ +__subsystem struct cellular_driver_api { + cellular_api_configure_networks configure_networks; + cellular_api_get_supported_networks get_supported_networks; + cellular_api_get_signal get_signal; + cellular_api_get_modem_info get_modem_info; +}; + /** * @brief Configure cellular networks for the device * @@ -96,8 +124,21 @@ enum cellular_modem_info_type { * @retval -ENOTSUP if API is not supported by cellular network device. * @retval Negative errno-code otherwise. */ -int cellular_configure_networks(const struct device *dev, const struct cellular_network *networks, - uint8_t size); +__syscall int cellular_configure_networks(const struct device *dev, + const struct cellular_network *networks, uint8_t size); + +static inline int z_impl_cellular_configure_networks(const struct device *dev, + const struct cellular_network *networks, + uint8_t size) +{ + const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; + + if (api->configure_networks == NULL) { + return -ENOTSUP; + } + + return api->configure_networks(dev, networks, size); +} /** * @brief Get supported cellular networks for the device @@ -110,8 +151,22 @@ int cellular_configure_networks(const struct device *dev, const struct cellular_ * @retval -ENOTSUP if API is not supported by cellular network device. * @retval Negative errno-code otherwise. */ -int cellular_get_supported_networks(const struct device *dev, - const struct cellular_network **networks, uint8_t *size); +__syscall int cellular_get_supported_networks(const struct device *dev, + const struct cellular_network **networks, + uint8_t *size); + +static inline int z_impl_cellular_get_supported_networks(const struct device *dev, + const struct cellular_network **networks, + uint8_t *size) +{ + const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; + + if (api->get_supported_networks == NULL) { + return -ENOTSUP; + } + + return api->get_supported_networks(dev, networks, size); +} /** * @brief Get signal for the device @@ -125,8 +180,21 @@ int cellular_get_supported_networks(const struct device *dev, * @retval -ENODATA if device is not in a state where signal can be polled * @retval Negative errno-code otherwise. */ -int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, - int16_t *value); +__syscall int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, + int16_t *value); + +static inline int z_impl_cellular_get_signal(const struct device *dev, + const enum cellular_signal_type type, + int16_t *value) +{ + const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; + + if (api->get_signal == NULL) { + return -ENOTSUP; + } + + return api->get_signal(dev, type, value); +} /** * @brief Get modem info for the device @@ -141,8 +209,22 @@ int cellular_get_signal(const struct device *dev, const enum cellular_signal_typ * @retval -ENODATA if modem does not provide info requested * @retval Negative errno-code from chat module otherwise. */ -int cellular_get_modem_info(const struct device *dev, const enum cellular_modem_info_type type, - char *info, size_t size); +__syscall int cellular_get_modem_info(const struct device *dev, + const enum cellular_modem_info_type type, + char *info, size_t size); + +static inline int z_impl_cellular_get_modem_info(const struct device *dev, + const enum cellular_modem_info_type type, + char *info, size_t size) +{ + const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; + + if (api->get_modem_info == NULL) { + return -ENOTSUP; + } + + return api->get_modem_info(dev, type, info, size); +} #ifdef __cplusplus } @@ -152,4 +234,6 @@ int cellular_get_modem_info(const struct device *dev, const enum cellular_modem_ * @} */ +#include + #endif /* ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ */ From 9dff19acc067785738a8c3b06adf29f22f46ccee Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 29 Dec 2023 10:48:44 +0100 Subject: [PATCH 0481/2300] [nrf fromtree] modem: modem_cellular: Update driver to implement cellular API Move the implementations of the cellular API in modem_cellular.c to an cellular_driver_structure, and implement this API structure withing the device drivers. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit f9491034bec762be4d99bdb798f758514502075a) (cherry picked from commit d07ec775c0cd3c34014cd591cbaf385171d40460) --- drivers/modem/modem_cellular.c | 165 ++++++++++++++++-------------- include/zephyr/drivers/cellular.h | 46 +++------ 2 files changed, 104 insertions(+), 107 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index ad1bb920cd5..ea39cecabaf 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1263,6 +1263,80 @@ static void modem_cellular_cmux_handler(struct modem_cmux *cmux, enum modem_cmux } } +static int modem_cellular_get_signal(const struct device *dev, + const enum cellular_signal_type type, + int16_t *value) +{ + int ret; + struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; + const struct modem_cellular_config *config = (struct modem_cellular_config *)dev->config; + + if (config->get_signal_chat_script == NULL) { + return -ENOTSUP; + } + + if ((data->state != MODEM_CELLULAR_STATE_AWAIT_REGISTERED) && + (data->state != MODEM_CELLULAR_STATE_CARRIER_ON)) { + return -ENODATA; + } + + ret = modem_chat_run_script(&data->chat, config->get_signal_chat_script); + if (ret != 0) { + return ret; + } + + switch (type) { + case CELLULAR_SIGNAL_RSSI: { + *value = data->rssi; + } break; + case CELLULAR_SIGNAL_RSRP: + return -ENOTSUP; + case CELLULAR_SIGNAL_RSRQ: + return -ENOTSUP; + } + + return ret; +} + +static int modem_cellular_get_modem_info(const struct device *dev, + enum cellular_modem_info_type type, + char *info, size_t size) +{ + int ret = 0; + struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; + + switch (type) { + case CELLULAR_MODEM_INFO_IMEI: + strncpy(info, &data->imei[0], MIN(size, sizeof(data->imei))); + break; + case CELLULAR_MODEM_INFO_SIM_IMSI: + strncpy(info, &data->imsi[0], MIN(size, sizeof(data->imsi))); + break; + case CELLULAR_MODEM_INFO_SIM_ICCID: + strncpy(info, &data->iccid[0], MIN(size, sizeof(data->iccid))); + break; + case CELLULAR_MODEM_INFO_MANUFACTURER: + strncpy(info, &data->manufacturer[0], MIN(size, sizeof(data->manufacturer))); + break; + case CELLULAR_MODEM_INFO_FW_VERSION: + strncpy(info, &data->fw_version[0], MIN(size, sizeof(data->fw_version))); + break; + case CELLULAR_MODEM_INFO_MODEL_ID: + strncpy(info, &data->model_id[0], MIN(size, sizeof(data->model_id))); + break; + default: + ret = -ENODATA; + break; + } + + return ret; +} + +const static struct cellular_driver_api modem_cellular_api = { + .get_signal = modem_cellular_get_signal, + .get_modem_info = modem_cellular_get_modem_info, +}; + #ifdef CONFIG_PM_DEVICE static int modem_cellular_pm_action(const struct device *dev, enum pm_device_action action) { @@ -1828,7 +1902,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); #define MODEM_CELLULAR_DEVICE_QUECTEL_EG25_G(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -1857,7 +1932,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); #define MODEM_CELLULAR_DEVICE_GSM_PPP(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -1885,7 +1961,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); #define MODEM_CELLULAR_DEVICE_SIMCOM_SIM7080(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -1913,7 +1990,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); #define MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R4(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -1941,7 +2019,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); #define MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R5(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -1970,7 +2049,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); #define MODEM_CELLULAR_DEVICE_SWIR_HL7800(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -1998,7 +2078,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); #define MODEM_CELLULAR_DEVICE_TELIT_ME910G1(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -2026,7 +2107,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); #define DT_DRV_COMPAT quectel_bg95 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_QUECTEL_BG95) @@ -2059,70 +2141,3 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #define DT_DRV_COMPAT telit_me910g1 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) #undef DT_DRV_COMPAT - -int cellular_get_modem_info(const struct device *dev, enum cellular_modem_info_type type, - char *info, size_t size) -{ - int ret = 0; - struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; - - switch (type) { - case CELLULAR_MODEM_INFO_IMEI: - strncpy(info, &data->imei[0], MIN(size, sizeof(data->imei))); - break; - case CELLULAR_MODEM_INFO_SIM_IMSI: - strncpy(info, &data->imsi[0], MIN(size, sizeof(data->imsi))); - break; - case CELLULAR_MODEM_INFO_SIM_ICCID: - strncpy(info, &data->iccid[0], MIN(size, sizeof(data->iccid))); - break; - case CELLULAR_MODEM_INFO_MANUFACTURER: - strncpy(info, &data->manufacturer[0], MIN(size, sizeof(data->manufacturer))); - break; - case CELLULAR_MODEM_INFO_FW_VERSION: - strncpy(info, &data->fw_version[0], MIN(size, sizeof(data->fw_version))); - break; - case CELLULAR_MODEM_INFO_MODEL_ID: - strncpy(info, &data->model_id[0], MIN(size, sizeof(data->model_id))); - break; - default: - ret = -ENODATA; - break; - } - - return ret; -} - -int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, - int16_t *value) -{ - int ret; - struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; - const struct modem_cellular_config *config = (struct modem_cellular_config *)dev->config; - - if (config->get_signal_chat_script == NULL) { - return -ENOTSUP; - } - - if ((data->state != MODEM_CELLULAR_STATE_AWAIT_REGISTERED) && - (data->state != MODEM_CELLULAR_STATE_CARRIER_ON)) { - return -ENODATA; - } - - ret = modem_chat_run_script(&data->chat, config->get_signal_chat_script); - if (ret != 0) { - return ret; - } - - switch (type) { - case CELLULAR_SIGNAL_RSSI: { - *value = data->rssi; - } break; - case CELLULAR_SIGNAL_RSRP: - return -ENOTSUP; - case CELLULAR_SIGNAL_RSRQ: - return -ENOTSUP; - } - - return ret; -} diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h index b4202d81b0a..fba05e6e440 100644 --- a/include/zephyr/drivers/cellular.h +++ b/include/zephyr/drivers/cellular.h @@ -124,17 +124,13 @@ __subsystem struct cellular_driver_api { * @retval -ENOTSUP if API is not supported by cellular network device. * @retval Negative errno-code otherwise. */ -__syscall int cellular_configure_networks(const struct device *dev, - const struct cellular_network *networks, uint8_t size); - -static inline int z_impl_cellular_configure_networks(const struct device *dev, - const struct cellular_network *networks, - uint8_t size) +static inline int cellular_configure_networks(const struct device *dev, + const struct cellular_network *networks, uint8_t size) { const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; if (api->configure_networks == NULL) { - return -ENOTSUP; + return -ENOSYS; } return api->configure_networks(dev, networks, size); @@ -151,18 +147,14 @@ static inline int z_impl_cellular_configure_networks(const struct device *dev, * @retval -ENOTSUP if API is not supported by cellular network device. * @retval Negative errno-code otherwise. */ -__syscall int cellular_get_supported_networks(const struct device *dev, - const struct cellular_network **networks, - uint8_t *size); - -static inline int z_impl_cellular_get_supported_networks(const struct device *dev, - const struct cellular_network **networks, - uint8_t *size) +static inline int cellular_get_supported_networks(const struct device *dev, + const struct cellular_network **networks, + uint8_t *size) { const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; if (api->get_supported_networks == NULL) { - return -ENOTSUP; + return -ENOSYS; } return api->get_supported_networks(dev, networks, size); @@ -180,17 +172,13 @@ static inline int z_impl_cellular_get_supported_networks(const struct device *de * @retval -ENODATA if device is not in a state where signal can be polled * @retval Negative errno-code otherwise. */ -__syscall int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, - int16_t *value); - -static inline int z_impl_cellular_get_signal(const struct device *dev, - const enum cellular_signal_type type, - int16_t *value) +static inline int cellular_get_signal(const struct device *dev, + const enum cellular_signal_type type, int16_t *value) { const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; if (api->get_signal == NULL) { - return -ENOTSUP; + return -ENOSYS; } return api->get_signal(dev, type, value); @@ -209,18 +197,14 @@ static inline int z_impl_cellular_get_signal(const struct device *dev, * @retval -ENODATA if modem does not provide info requested * @retval Negative errno-code from chat module otherwise. */ -__syscall int cellular_get_modem_info(const struct device *dev, - const enum cellular_modem_info_type type, - char *info, size_t size); - -static inline int z_impl_cellular_get_modem_info(const struct device *dev, - const enum cellular_modem_info_type type, - char *info, size_t size) +static inline int cellular_get_modem_info(const struct device *dev, + const enum cellular_modem_info_type type, char *info, + size_t size) { const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; if (api->get_modem_info == NULL) { - return -ENOTSUP; + return -ENOSYS; } return api->get_modem_info(dev, type, info, size); @@ -234,6 +218,4 @@ static inline int z_impl_cellular_get_modem_info(const struct device *dev, * @} */ -#include - #endif /* ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ */ From 2f55e3c3f6a9c45ef6149f296154254169d9a1f0 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 29 Dec 2023 13:02:48 +0100 Subject: [PATCH 0482/2300] [nrf fromtree] modem: modem_cellular: Rework cellular_get_signal implementation The modem_cellular.c driver now uses a common script to get signal strenght, which is run on demand. This is more efficient than polling it, and simpler since every modem doesn't have to define their own variant of the script. Additionally, the CSQ handler now stores the "raw" rssi value returned from AT+CSQ to be parsed by the cellular_modem_get_signal implementation. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 572c5e6d5a6a10f7c5cf9f7313626b6f89453d6f) (cherry picked from commit e6ded9416de862472aa961954b2d91d79970e4c5) --- drivers/modem/modem_cellular.c | 107 ++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 49 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index ea39cecabaf..78958bdec2c 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -94,7 +94,7 @@ struct modem_cellular_data { uint8_t registration_status_gsm; uint8_t registration_status_gprs; uint8_t registration_status_lte; - int8_t rssi; + uint8_t rssi; uint8_t imei[MODEM_CELLULAR_DATA_IMEI_LEN]; uint8_t model_id[MODEM_CELLULAR_DATA_MODEL_ID_LEN]; uint8_t imsi[MODEM_CELLULAR_DATA_IMSI_LEN]; @@ -131,7 +131,6 @@ struct modem_cellular_config { const struct modem_chat_script *init_chat_script; const struct modem_chat_script *dial_chat_script; const struct modem_chat_script *periodic_chat_script; - const struct modem_chat_script *get_signal_chat_script; }; static const char *modem_cellular_state_str(enum modem_cellular_state state) @@ -332,28 +331,13 @@ static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, ui static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uint16_t argc, void *user_data) { - uint8_t rssi; - - /* AT+CSQ returns a response +CSQ: , where: - * - rssi is a integer from 0 to 31 whose values describes a signal strength - * between -113 dBm for 0 and -51dbM for 31 or unknown for 99 - * - ber is an integer from 0 to 7 that describes the error rate, it can also - * be 99 for an unknown error rate - */ struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; if (argc != 3) { return; } - /* Read rssi */ - rssi = atoi(argv[1]); - - if (rssi == 99) { - return; - } - - data->rssi = (-113 + (2 * rssi)); + data->rssi = (uint8_t)atoi(argv[1]); } static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, uint16_t argc, @@ -1263,36 +1247,78 @@ static void modem_cellular_cmux_handler(struct modem_cmux *cmux, enum modem_cmux } } +MODEM_CHAT_SCRIPT_CMDS_DEFINE(get_signal_csq_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(get_signal_csq_chat_script, get_signal_csq_chat_script_cmds, + abort_matches, modem_cellular_chat_callback_handler, 2); + +static inline int modem_cellular_csq_parse_rssi(uint8_t rssi, int16_t *value) +{ + /* AT+CSQ returns a response +CSQ: , where: + * - rssi is a integer from 0 to 31 whose values describes a signal strength + * between -113 dBm for 0 and -51dbM for 31 or unknown for 99 + * - ber is an integer from 0 to 7 that describes the error rate, it can also + * be 99 for an unknown error rate + */ + if (rssi == 99) { + return -EINVAL; + } + + *value = (int16_t)(-113 + (2 * rssi)); + return 0; +} + static int modem_cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, int16_t *value) { - int ret; + int ret = -ENOTSUP; struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; - const struct modem_cellular_config *config = (struct modem_cellular_config *)dev->config; - - if (config->get_signal_chat_script == NULL) { - return -ENOTSUP; - } if ((data->state != MODEM_CELLULAR_STATE_AWAIT_REGISTERED) && (data->state != MODEM_CELLULAR_STATE_CARRIER_ON)) { return -ENODATA; } - ret = modem_chat_run_script(&data->chat, config->get_signal_chat_script); - if (ret != 0) { + /* Run chat script */ + switch (type) { + case CELLULAR_SIGNAL_RSSI: + ret = modem_chat_run_script(&data->chat, &get_signal_csq_chat_script); + break; + + case CELLULAR_SIGNAL_RSRP: + case CELLULAR_SIGNAL_RSRQ: + /* TODO: Run CESQ script */ + ret = -ENOTSUP; + break; + + default: + ret = -ENOTSUP; + break; + } + + /* Verify chat script ran successfully */ + if (ret < 0) { return ret; } + /* Parse received value */ switch (type) { - case CELLULAR_SIGNAL_RSSI: { - *value = data->rssi; - } break; + case CELLULAR_SIGNAL_RSSI: + ret = modem_cellular_csq_parse_rssi(data->rssi, value); + break; + case CELLULAR_SIGNAL_RSRP: - return -ENOTSUP; case CELLULAR_SIGNAL_RSRQ: - return -ENOTSUP; + /* TODO: Validate and set values */ + ret = -ENODATA; + break; + + default: + ret = -ENOTSUP; + break; } return ret; @@ -1517,19 +1543,11 @@ MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_dial_chat_script, quectel_bg95_dial_chat_s MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match)); MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_periodic_chat_script, quectel_bg95_periodic_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 4); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_get_signal_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); - -MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_get_signal_chat_script, - quectel_bg95_get_signal_chat_script_cmds, abort_matches, - modem_cellular_chat_callback_handler, 4); #endif #if DT_HAS_COMPAT_STATUS_OKAY(quectel_eg25_g) @@ -1580,13 +1598,6 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_periodic_chat_script, quectel_eg25_g_periodic_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 4); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_get_signal_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); - -MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_get_signal_chat_script, - quectel_eg25_g_get_signal_chat_script_cmds, abort_matches, - modem_cellular_chat_callback_handler, 4); #endif #if DT_HAS_COMPAT_STATUS_OKAY(zephyr_gsm_ppp) @@ -1895,7 +1906,6 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, .init_chat_script = &quectel_bg95_init_chat_script, \ .dial_chat_script = &quectel_bg95_dial_chat_script, \ .periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \ - .get_signal_chat_script = &_CONCAT(DT_DRV_COMPAT, _get_signal_chat_script), \ }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ @@ -1925,7 +1935,6 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, .init_chat_script = &quectel_eg25_g_init_chat_script, \ .dial_chat_script = &quectel_eg25_g_dial_chat_script, \ .periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \ - .get_signal_chat_script = &_CONCAT(DT_DRV_COMPAT, _get_signal_chat_script), \ }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ From 71d91e386a3e6080ea42c82bbbebc6adb2ae29ad Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 29 Dec 2023 13:33:24 +0100 Subject: [PATCH 0483/2300] [nrf fromtree] modem: modem_cellular.c: Remove non standard QCCID handler The QCCID handler is Quectel specific and as such may not be part of the modem cellular driver which only supports commands defined in 3GPP TS 27.007 Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 1ee092673a13c1f74da932c6ca27fc634304d118) (cherry picked from commit 8fdf4874aac9e4bb1bd0ac6f7494ce197b98461f) --- drivers/modem/modem_cellular.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 78958bdec2c..16530edde6c 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -348,14 +348,6 @@ static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, ui strncpy(data->imsi, (char *)argv[1], sizeof(data->imsi)); } -static void modem_cellular_chat_on_iccid(struct modem_chat *chat, char **argv, uint16_t argc, - void *user_data) -{ - struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; - - strncpy(data->iccid, (char *)argv[1], sizeof(data->iccid)); -} - static bool modem_cellular_is_registered(struct modem_cellular_data *data) { return (data->registration_status_gsm == 1) @@ -407,7 +399,6 @@ MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); -MODEM_CHAT_MATCH_DEFINE(ccid_match, "+QCCID: ", "", modem_cellular_chat_on_iccid); MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); @@ -1338,9 +1329,6 @@ static int modem_cellular_get_modem_info(const struct device *dev, case CELLULAR_MODEM_INFO_SIM_IMSI: strncpy(info, &data->imsi[0], MIN(size, sizeof(data->imsi))); break; - case CELLULAR_MODEM_INFO_SIM_ICCID: - strncpy(info, &data->iccid[0], MIN(size, sizeof(data->iccid))); - break; case CELLULAR_MODEM_INFO_MANUFACTURER: strncpy(info, &data->manufacturer[0], MIN(size, sizeof(data->manufacturer))); break; @@ -1522,8 +1510,6 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+QCCID", ccid_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127", 300)); MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_init_chat_script, quectel_bg95_init_chat_script_cmds, @@ -1571,8 +1557,6 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE( MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+QCCID", ccid_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127,10,3,30,10,2", 100)); MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_init_chat_script, quectel_eg25_g_init_chat_script_cmds, From fdc36654de16308a06e44ce7ca09c1b5411e5a7c Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 25 Dec 2023 09:26:47 +0100 Subject: [PATCH 0484/2300] [nrf fromtree] modem: chat: Patch invalid dereference The chat module contains an array of three lists of matches, one of which are static, two of which are contained within the currently running script. The current match, which is an object stored in one of the three lists, is stored in its own pointer in the chat module context. A memory error occurs when the script is stopped, while the chat module is using one of the matches stored withing the script. This commit clears the match pointer when the script is stopped if the match is stored within the script. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 3ebe8142945e53828c1a6c91f4b134adece4af33) (cherry picked from commit dc270c2815d564f882cf271e563ddb51decf5f5b) --- subsys/modem/modem_chat.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index 0ab1175f980..7cf7692c514 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -60,7 +60,7 @@ static void modem_chat_log_received_command(struct modem_chat *chat) static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_script_result result) { - if (!chat || !chat->script) { + if ((chat == NULL) || (chat->script == NULL)) { return; } @@ -78,6 +78,14 @@ static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_scri chat->script->callback(chat, result, chat->user_data); } + /* Clear parse_match in case it is stored in the script being stopped */ + if ((chat->parse_match != NULL) && + ((chat->parse_match_type == MODEM_CHAT_MATCHES_INDEX_ABORT) || + (chat->parse_match_type == MODEM_CHAT_MATCHES_INDEX_RESPONSE))) { + chat->parse_match = NULL; + chat->parse_match_len = 0; + } + /* Clear reference to script */ chat->script = NULL; @@ -822,4 +830,8 @@ void modem_chat_release(struct modem_chat *chat) chat->parse_match = NULL; chat->parse_match_len = 0; chat->parse_arg_len = 0; + chat->matches[MODEM_CHAT_MATCHES_INDEX_ABORT] = NULL; + chat->matches_size[MODEM_CHAT_MATCHES_INDEX_ABORT] = 0; + chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = NULL; + chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = 0; } From 9caac0b72dd741c2a071b9090401c97a61403cfd Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 6 Dec 2023 18:22:28 +0100 Subject: [PATCH 0485/2300] [nrf fromtree] modem: cmux: Patch resync mechanism The CMUX resync mechanism can get stuck between states MODEM_CMUX_RECEIVE_STATE_RESYNC_0 and MODEM_CMUX_RECEIVE_STATE_RESYNC_1 if the resync flags, which are sent only once in state MODEM_CMUX_RECEIVE_STATE_SOF, are not responded to, or the response is lost. This patch ensures resync flags are sent from states MODEM_CMUX_RECEIVE_STATE_SOF, MODEM_CMUX_RECEIVE_STATE_RESYNC_1 and MODEM_CMUX_RECEIVE_STATE_RESYNC_2 if its determined that the resync flags are not being responded to. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 48fa603da37e6161c299af52bccad6165222548f) (cherry picked from commit 47b99cf2c8201bc592e5ce467f2ac4ccc2150614) --- subsys/modem/modem_cmux.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 3ace00d6583..7f40fa6e95d 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -638,10 +638,16 @@ static void modem_cmux_on_frame(struct modem_cmux *cmux) modem_cmux_on_dlci_frame(cmux); } +static void modem_cmux_transmit_resync(struct modem_cmux *cmux) +{ + static const uint8_t resync[3] = {0xF9, 0xF9, 0xF9}; + + modem_pipe_transmit(cmux->pipe, resync, sizeof(resync)); +} + static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t byte) { uint8_t fcs; - static const uint8_t resync[3] = {0xF9, 0xF9, 0xF9}; switch (cmux->receive_state) { case MODEM_CMUX_RECEIVE_STATE_SOF: @@ -650,10 +656,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by break; } - /* Send resync flags */ - modem_pipe_transmit(cmux->pipe, resync, sizeof(resync)); - - /* Await resync flags */ + modem_cmux_transmit_resync(cmux); cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; break; @@ -668,6 +671,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by if (byte == 0xF9) { cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_2; } else { + modem_cmux_transmit_resync(cmux); cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; } @@ -677,6 +681,7 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by if (byte == 0xF9) { cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_3; } else { + modem_cmux_transmit_resync(cmux); cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; } From 1509eb594e237e9b9856a569c6fee088bbd63308 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 4 Jan 2024 13:32:35 +0100 Subject: [PATCH 0486/2300] [nrf fromtree] modem: cmux: Add DLCI receive buffer overrun LOG WRN DLCI receive buffer may overrun if data is not processed fast enough. This error was not reported before this patch, resulting in unexplained missing bytes. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit b3971d01129676f566ab813f2cb34ffbfb12d8d1) (cherry picked from commit dfe74143f488f25728336a26169f596391608e68) --- subsys/modem/modem_cmux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 7f40fa6e95d..258f969c498 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -546,6 +546,7 @@ static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci) static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) { struct modem_cmux *cmux = dlci->cmux; + uint32_t written; if (dlci->state != MODEM_CMUX_DLCI_STATE_OPEN) { LOG_DBG("Unexpected UIH frame"); @@ -553,8 +554,11 @@ static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) } k_mutex_lock(&dlci->receive_rb_lock, K_FOREVER); - ring_buf_put(&dlci->receive_rb, cmux->frame.data, cmux->frame.data_len); + written = ring_buf_put(&dlci->receive_rb, cmux->frame.data, cmux->frame.data_len); k_mutex_unlock(&dlci->receive_rb_lock); + if (written != cmux->frame.data_len) { + LOG_WRN("DLCI %u receive buffer overrun", dlci->dlci_address); + } modem_pipe_notify_receive_ready(&dlci->pipe); } From 6045ceaffde8a2f0b4395a56fb6742724c45ff75 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 9 Jan 2024 15:13:57 +0100 Subject: [PATCH 0487/2300] [nrf fromtree] modem: cmux: Simplify resync mechanism Some modems don't start sending resync flags as described in 3G TS 27.010 V2.0.0 5.2.5, which results in the CMUX being stuck in resync mode for said modems. This patch simplifies the resync mechanism to simply drop invalid frames, and wait for atleast two consequtive frame flags (stop+start). Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 3debfc8c8d4d224d92be35786fd9774f6030580a) (cherry picked from commit 5c15715bdb6eda6fa995e5365c9fa39b23b98018) --- include/zephyr/modem/cmux.h | 5 +--- subsys/modem/modem_cmux.c | 46 +++++++------------------------------ 2 files changed, 9 insertions(+), 42 deletions(-) diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index 4562cb544d9..58959d6136b 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -63,10 +63,7 @@ enum modem_cmux_state { enum modem_cmux_receive_state { MODEM_CMUX_RECEIVE_STATE_SOF = 0, - MODEM_CMUX_RECEIVE_STATE_RESYNC_0, - MODEM_CMUX_RECEIVE_STATE_RESYNC_1, - MODEM_CMUX_RECEIVE_STATE_RESYNC_2, - MODEM_CMUX_RECEIVE_STATE_RESYNC_3, + MODEM_CMUX_RECEIVE_STATE_RESYNC, MODEM_CMUX_RECEIVE_STATE_ADDRESS, MODEM_CMUX_RECEIVE_STATE_ADDRESS_CONT, MODEM_CMUX_RECEIVE_STATE_CONTROL, diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 258f969c498..472d1a7149a 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -642,13 +642,6 @@ static void modem_cmux_on_frame(struct modem_cmux *cmux) modem_cmux_on_dlci_frame(cmux); } -static void modem_cmux_transmit_resync(struct modem_cmux *cmux) -{ - static const uint8_t resync[3] = {0xF9, 0xF9, 0xF9}; - - modem_pipe_transmit(cmux->pipe, resync, sizeof(resync)); -} - static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t byte) { uint8_t fcs; @@ -656,46 +649,23 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by switch (cmux->receive_state) { case MODEM_CMUX_RECEIVE_STATE_SOF: if (byte == 0xF9) { - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_ADDRESS; + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC; break; } - modem_cmux_transmit_resync(cmux); - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; - break; - - case MODEM_CMUX_RECEIVE_STATE_RESYNC_0: - if (byte == 0xF9) { - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_1; - } - - break; - - case MODEM_CMUX_RECEIVE_STATE_RESYNC_1: - if (byte == 0xF9) { - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_2; - } else { - modem_cmux_transmit_resync(cmux); - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; - } - break; - case MODEM_CMUX_RECEIVE_STATE_RESYNC_2: - if (byte == 0xF9) { - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_3; - } else { - modem_cmux_transmit_resync(cmux); - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; - } - - break; - - case MODEM_CMUX_RECEIVE_STATE_RESYNC_3: + case MODEM_CMUX_RECEIVE_STATE_RESYNC: + /* + * Allow any number of consequtive flags (0xF9). + * 0xF9 could also be a valid address field for DLCI 62. + */ if (byte == 0xF9) { break; } + __fallthrough; + case MODEM_CMUX_RECEIVE_STATE_ADDRESS: /* Initialize */ cmux->receive_buf_len = 0; From ada67f53d9507ec3726100258c91674b109f3b27 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 10 Jan 2024 17:55:33 +0100 Subject: [PATCH 0488/2300] [nrf fromtree] tests: subsys: modem: cmux: Update resync unit test Update the unit test to expect the new simplified resync behavior, and validate that new resync is working. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 7d7f7aaf03fd0728d298dce22c20cb3098c3d0aa) (cherry picked from commit 242758ddf41eddac4f8fe4b0fabcf5fe17de13a4) --- tests/subsys/modem/modem_cmux/src/main.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tests/subsys/modem/modem_cmux/src/main.c b/tests/subsys/modem/modem_cmux/src/main.c index 9df6837efc5..d601eeb1446 100644 --- a/tests/subsys/modem/modem_cmux/src/main.c +++ b/tests/subsys/modem/modem_cmux/src/main.c @@ -144,8 +144,6 @@ static uint8_t cmux_frame_data_dlci1_at_newline[] = {0x0D, 0x0A}; /*************************************************************************************************/ static uint8_t cmux_frame_dlci1_at_at_desync[] = {0x41, 0x54, 0x30, 0xF9}; -static uint8_t cmux_frame_resync[] = {0xF9, 0xF9, 0xF9}; - /*************************************************************************************************/ /* DLCI2 PPP CMUX frames */ /*************************************************************************************************/ @@ -401,15 +399,6 @@ ZTEST(modem_cmux, test_modem_cmux_resync) modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_at_desync, sizeof(cmux_frame_dlci1_at_at_desync)); - - k_msleep(100); - - ret = modem_backend_mock_get(&bus_mock, buffer1, sizeof(buffer1)); - zassert_true(ret == sizeof(cmux_frame_resync), "Expected resync flags to be sent to bus"); - zassert_true(memcmp(buffer1, cmux_frame_resync, sizeof(cmux_frame_resync)) == 0, - "Expected resync flags to be sent to bus"); - - modem_backend_mock_put(&bus_mock, cmux_frame_resync, sizeof(cmux_frame_resync)); modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_at, sizeof(cmux_frame_dlci1_at_at)); modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_newline, sizeof(cmux_frame_dlci1_at_newline)); From 893ce44e201f4a678129a5d9174163af6f969851 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 22 Nov 2023 06:59:44 +0100 Subject: [PATCH 0489/2300] [nrf fromtree] modem: pipe: Add TRANSMIT_IDLE event Add transmit idle event to modem_pipe_event enum. This will allow modules to await transmit idle before trying to transmit more data, instead of blindly calling modem_pipe_transmit in a loop until all data has been accepted. This will reduce the time spent trying to transmit data while the backend is blocked. Similarly to the RECEIVE_READY event, backends will call modem_pipe_notify_transmit_idle() to indicate that transmit is idle, and the TRANSMIT_IDLE event will be reinvoked when the modem pipe is attached to synchronize the state of the pipe with the user of it. Additionally, the TRANSMIT_IDLE event is also invoked when the modem is opened to further help synchronization with the user of the pipe. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 516af3cb8432fd8fde2b10b8f7e78486d51b69d4) (cherry picked from commit 27c617380c172c2c382fca49f2ef4332f42c46c6) --- include/zephyr/modem/pipe.h | 13 ++++++++++++- subsys/modem/modem_pipe.c | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/zephyr/modem/pipe.h b/include/zephyr/modem/pipe.h index abf8d74918e..a741a94a34c 100644 --- a/include/zephyr/modem/pipe.h +++ b/include/zephyr/modem/pipe.h @@ -25,6 +25,7 @@ extern "C" { enum modem_pipe_event { MODEM_PIPE_EVENT_OPENED = 0, MODEM_PIPE_EVENT_RECEIVE_READY, + MODEM_PIPE_EVENT_TRANSMIT_IDLE, MODEM_PIPE_EVENT_CLOSED, }; @@ -73,7 +74,8 @@ struct modem_pipe { enum modem_pipe_state state; struct k_mutex lock; struct k_condvar condvar; - bool receive_ready_pending; + uint8_t receive_ready_pending : 1; + uint8_t transmit_idle_pending : 1; }; /** @@ -213,6 +215,15 @@ void modem_pipe_notify_closed(struct modem_pipe *pipe); */ void modem_pipe_notify_receive_ready(struct modem_pipe *pipe); +/** + * @brief Notify user of pipe that pipe has no more data to transmit + * + * @param pipe Pipe instance + * + * @note Invoked from instance which initialized the pipe instance + */ +void modem_pipe_notify_transmit_idle(struct modem_pipe *pipe); + /** * @endcond */ diff --git a/subsys/modem/modem_pipe.c b/subsys/modem/modem_pipe.c index 01bdac50d3a..b0088fdefed 100644 --- a/subsys/modem/modem_pipe.c +++ b/subsys/modem/modem_pipe.c @@ -21,6 +21,7 @@ void modem_pipe_init(struct modem_pipe *pipe, void *data, struct modem_pipe_api pipe->user_data = NULL; pipe->state = MODEM_PIPE_STATE_CLOSED; pipe->receive_ready_pending = false; + pipe->transmit_idle_pending = true; k_mutex_init(&pipe->lock); k_condvar_init(&pipe->condvar); @@ -82,6 +83,10 @@ void modem_pipe_attach(struct modem_pipe *pipe, modem_pipe_api_callback callback pipe->callback(pipe, MODEM_PIPE_EVENT_RECEIVE_READY, pipe->user_data); } + if (pipe->transmit_idle_pending && (pipe->callback != NULL)) { + pipe->callback(pipe, MODEM_PIPE_EVENT_TRANSMIT_IDLE, pipe->user_data); + } + k_mutex_unlock(&pipe->lock); } @@ -97,6 +102,7 @@ int modem_pipe_transmit(struct modem_pipe *pipe, const uint8_t *buf, size_t size } ret = pipe->api->transmit(pipe->data, buf, size); + pipe->transmit_idle_pending = false; k_mutex_unlock(&pipe->lock); return ret; } @@ -179,6 +185,7 @@ void modem_pipe_notify_opened(struct modem_pipe *pipe) if (pipe->callback != NULL) { pipe->callback(pipe, MODEM_PIPE_EVENT_OPENED, pipe->user_data); + pipe->callback(pipe, MODEM_PIPE_EVENT_TRANSMIT_IDLE, pipe->user_data); } k_condvar_signal(&pipe->condvar); @@ -190,6 +197,7 @@ void modem_pipe_notify_closed(struct modem_pipe *pipe) k_mutex_lock(&pipe->lock, K_FOREVER); pipe->state = MODEM_PIPE_STATE_CLOSED; pipe->receive_ready_pending = false; + pipe->transmit_idle_pending = true; if (pipe->callback != NULL) { pipe->callback(pipe, MODEM_PIPE_EVENT_CLOSED, pipe->user_data); @@ -211,3 +219,16 @@ void modem_pipe_notify_receive_ready(struct modem_pipe *pipe) k_mutex_unlock(&pipe->lock); } + +void modem_pipe_notify_transmit_idle(struct modem_pipe *pipe) +{ + k_mutex_lock(&pipe->lock, K_FOREVER); + + pipe->transmit_idle_pending = true; + + if (pipe->callback != NULL) { + pipe->callback(pipe, MODEM_PIPE_EVENT_TRANSMIT_IDLE, pipe->user_data); + } + + k_mutex_unlock(&pipe->lock); +} From 1f341f90c8a86acce58659780d8378cd93408ef1 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 22 Nov 2023 07:30:12 +0100 Subject: [PATCH 0490/2300] [nrf fromtree] modem: backend: uart: Implement transmit idle event Make async and interrupt driven UART backends notify transmit idle when transmit is idle. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 8c6a9ee594acdf300636dd30f86fd05fe16fb03f) (cherry picked from commit 86431c23d1cd59fc8cd8e040f1a1af62b554ed27) --- include/zephyr/modem/backend/uart.h | 1 + subsys/modem/backends/modem_backend_uart.c | 9 +++++++++ subsys/modem/backends/modem_backend_uart_async.c | 2 ++ subsys/modem/backends/modem_backend_uart_isr.c | 1 + 4 files changed, 13 insertions(+) diff --git a/include/zephyr/modem/backend/uart.h b/include/zephyr/modem/backend/uart.h index 0ddef4df734..5f9f99370a0 100644 --- a/include/zephyr/modem/backend/uart.h +++ b/include/zephyr/modem/backend/uart.h @@ -43,6 +43,7 @@ struct modem_backend_uart { const struct device *uart; struct modem_pipe pipe; struct k_work receive_ready_work; + struct k_work transmit_idle_work; union { struct modem_backend_uart_isr isr; diff --git a/subsys/modem/backends/modem_backend_uart.c b/subsys/modem/backends/modem_backend_uart.c index b4b0b81c291..a8348b0b8a0 100644 --- a/subsys/modem/backends/modem_backend_uart.c +++ b/subsys/modem/backends/modem_backend_uart.c @@ -22,6 +22,14 @@ static void modem_backend_uart_receive_ready_handler(struct k_work *item) modem_pipe_notify_receive_ready(&backend->pipe); } +static void modem_backend_uart_transmit_idle_handler(struct k_work *item) +{ + struct modem_backend_uart *backend = + CONTAINER_OF(item, struct modem_backend_uart, transmit_idle_work); + + modem_pipe_notify_transmit_idle(&backend->pipe); +} + struct modem_pipe *modem_backend_uart_init(struct modem_backend_uart *backend, const struct modem_backend_uart_config *config) { @@ -35,6 +43,7 @@ struct modem_pipe *modem_backend_uart_init(struct modem_backend_uart *backend, memset(backend, 0x00, sizeof(*backend)); backend->uart = config->uart; k_work_init(&backend->receive_ready_work, modem_backend_uart_receive_ready_handler); + k_work_init(&backend->transmit_idle_work, modem_backend_uart_transmit_idle_handler); #ifdef CONFIG_MODEM_BACKEND_UART_ASYNC if (modem_backend_uart_async_is_supported(backend)) { diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index bd18edbd2f5..47148a77f77 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -44,6 +44,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, case UART_TX_DONE: atomic_clear_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT); + k_work_submit(&backend->transmit_idle_work); break; @@ -51,6 +52,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, LOG_WRN("Transmit aborted"); atomic_clear_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT); + k_work_submit(&backend->transmit_idle_work); break; diff --git a/subsys/modem/backends/modem_backend_uart_isr.c b/subsys/modem/backends/modem_backend_uart_isr.c index 7c88cb4673c..8a7075e3519 100644 --- a/subsys/modem/backends/modem_backend_uart_isr.c +++ b/subsys/modem/backends/modem_backend_uart_isr.c @@ -56,6 +56,7 @@ static void modem_backend_uart_isr_irq_handler_transmit_ready(struct modem_backe if (ring_buf_is_empty(&backend->isr.transmit_rb) == true) { uart_irq_tx_disable(backend->uart); + k_work_submit(&backend->transmit_idle_work); return; } From ffc3c8c6aa24c0b459bfc7b5d725b9699cff7680 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 22 Nov 2023 07:33:38 +0100 Subject: [PATCH 0491/2300] [nrf fromtree] modem: backend: tty: Implement transmit idle event Implement transmit idle notification for TTY backend. Since TTY has an "infinite" transmit buffer, we invoke transmit idle immediately after writing the data to the TTY file. The test suite for the TTY backend has been updated to match the new behavior. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 4d99c69e4aa818c1407789e4e21dfa9102cb533b) (cherry picked from commit 7fb5794f6795de91f3677c39cd1f03ea0ffd912b) --- subsys/modem/backends/modem_backend_tty.c | 5 ++++- tests/subsys/modem/backends/tty/src/main.c | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/subsys/modem/backends/modem_backend_tty.c b/subsys/modem/backends/modem_backend_tty.c index b8864fc3d91..8375183be48 100644 --- a/subsys/modem/backends/modem_backend_tty.c +++ b/subsys/modem/backends/modem_backend_tty.c @@ -73,8 +73,11 @@ static int modem_backend_tty_open(void *data) static int modem_backend_tty_transmit(void *data, const uint8_t *buf, size_t size) { struct modem_backend_tty *backend = (struct modem_backend_tty *)data; + int ret; - return write(backend->tty_fd, buf, size); + ret = write(backend->tty_fd, buf, size); + modem_pipe_notify_transmit_idle(&backend->pipe); + return ret; } static int modem_backend_tty_receive(void *data, uint8_t *buf, size_t size) diff --git a/tests/subsys/modem/backends/tty/src/main.c b/tests/subsys/modem/backends/tty/src/main.c index 49a1841486a..96ebdb2763d 100644 --- a/tests/subsys/modem/backends/tty/src/main.c +++ b/tests/subsys/modem/backends/tty/src/main.c @@ -22,7 +22,8 @@ #define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_OPENED_BIT (0) #define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_RRDY_BIT (1) -#define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_CLOSED_BIT (2) +#define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT (2) +#define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_CLOSED_BIT (3) #define TEST_MODEM_BACKEND_TTY_OP_DELAY (K_MSEC(1000)) @@ -72,6 +73,10 @@ static void modem_pipe_callback_handler(struct modem_pipe *pipe, enum modem_pipe atomic_set_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_RRDY_BIT); break; + case MODEM_PIPE_EVENT_TRANSMIT_IDLE: + atomic_set_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT); + break; + case MODEM_PIPE_EVENT_CLOSED: atomic_set_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_CLOSED_BIT); break; @@ -122,9 +127,13 @@ static void test_modem_backend_tty_teardown(void *f) /*************************************************************************************************/ ZTEST(modem_backend_tty_suite, test_close_open) { + bool result; + zassert_ok(modem_pipe_close(tty_pipe), "Failed to close pipe"); zassert_ok(modem_pipe_close(tty_pipe), "Pipe should already be closed"); zassert_ok(modem_pipe_open(tty_pipe), "Failed to open pipe"); + result = atomic_test_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT); + zassert_true(result, "Transmit idle event should be set"); zassert_ok(modem_pipe_open(tty_pipe), "Pipe should already be open"); } @@ -172,12 +181,19 @@ ZTEST(modem_backend_tty_suite, test_transmit) { int ret; char msg[] = "Test me buddy 2"; + bool result; + + result = atomic_test_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT); + zassert_false(result, "Transmit idle event should not be set"); ret = modem_pipe_transmit(tty_pipe, msg, sizeof(msg)); zassert_true(ret == sizeof(msg), "Failed to transmit using pipe"); k_sleep(TEST_MODEM_BACKEND_TTY_OP_DELAY); + result = atomic_test_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT); + zassert_true(result, "Transmit idle event should be set"); + ret = read(primary_fd, buffer1, sizeof(buffer1)); zassert_true(ret == sizeof(msg), "Read incorrect number of bytes"); ret = memcmp(msg, buffer1, sizeof(msg)); From 2e69f96276887085af2a0f248d8341c33aaa0fb4 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 23 Nov 2023 11:15:09 +0100 Subject: [PATCH 0492/2300] [nrf fromtree] modem: pipe: Add test suite Add test suite for the modem_pipe module. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 9176e5c5681d3cafc6087c29d52017fe134ccde8) (cherry picked from commit 49b54ccf858d5e8f85ca7263e46da0209a12c4e1) --- tests/subsys/modem/modem_pipe/CMakeLists.txt | 8 + tests/subsys/modem/modem_pipe/prj.conf | 8 + tests/subsys/modem/modem_pipe/src/main.c | 401 +++++++++++++++++++ tests/subsys/modem/modem_pipe/testcase.yaml | 8 + 4 files changed, 425 insertions(+) create mode 100644 tests/subsys/modem/modem_pipe/CMakeLists.txt create mode 100644 tests/subsys/modem/modem_pipe/prj.conf create mode 100644 tests/subsys/modem/modem_pipe/src/main.c create mode 100644 tests/subsys/modem/modem_pipe/testcase.yaml diff --git a/tests/subsys/modem/modem_pipe/CMakeLists.txt b/tests/subsys/modem/modem_pipe/CMakeLists.txt new file mode 100644 index 00000000000..9d160a67720 --- /dev/null +++ b/tests/subsys/modem/modem_pipe/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2023 Trackunit Corporation +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(modem_pipe_test) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/subsys/modem/modem_pipe/prj.conf b/tests/subsys/modem/modem_pipe/prj.conf new file mode 100644 index 00000000000..ab3228738b9 --- /dev/null +++ b/tests/subsys/modem/modem_pipe/prj.conf @@ -0,0 +1,8 @@ +# Copyright (c) 2023 Trackunit Corporation +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_NO_OPTIMIZATIONS=y +CONFIG_MODEM_MODULES=y +CONFIG_MODEM_PIPE=y +CONFIG_EVENTS=y +CONFIG_ZTEST=y diff --git a/tests/subsys/modem/modem_pipe/src/main.c b/tests/subsys/modem/modem_pipe/src/main.c new file mode 100644 index 00000000000..07cc93decfe --- /dev/null +++ b/tests/subsys/modem/modem_pipe/src/main.c @@ -0,0 +1,401 @@ +/* + * Copyright (c) 2023 Trackunit Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/*************************************************************************************************/ +/* Dependencies */ +/*************************************************************************************************/ +#include +#include +#include +#include +#include + +#define TEST_MODEM_PIPE_EVENT_OPENED_BIT 0 +#define TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT 1 +#define TEST_MODEM_PIPE_EVENT_RECEIVE_READY_BIT 2 +#define TEST_MODEM_PIPE_EVENT_CLOSED_BIT 3 +#define TEST_MODEM_PIPE_NOTIFY_TIMEOUT K_MSEC(10) +#define TEST_MODEM_PIPE_WAIT_TIMEOUT K_MSEC(20) + +/*************************************************************************************************/ +/* Fake modem_pipe backend */ +/*************************************************************************************************/ +struct modem_backend_fake { + struct modem_pipe pipe; + + struct k_work_delayable opened_dwork; + struct k_work_delayable transmit_idle_dwork; + struct k_work_delayable closed_dwork; + + const uint8_t *transmit_buffer; + size_t transmit_buffer_size; + + uint8_t *receive_buffer; + size_t receive_buffer_size; + + uint8_t synchronous : 1; + uint8_t open_called : 1; + uint8_t transmit_called : 1; + uint8_t receive_called : 1; + uint8_t close_called : 1; +}; + +static void modem_backend_fake_opened_handler(struct k_work *item) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(item); + struct modem_backend_fake *backend = + CONTAINER_OF(dwork, struct modem_backend_fake, opened_dwork); + + modem_pipe_notify_opened(&backend->pipe); +} + +static int modem_backend_fake_open(void *data) +{ + struct modem_backend_fake *backend = data; + + backend->open_called = true; + + if (backend->synchronous) { + modem_pipe_notify_opened(&backend->pipe); + } else { + k_work_schedule(&backend->opened_dwork, TEST_MODEM_PIPE_NOTIFY_TIMEOUT); + } + + return 0; +} + +static void modem_backend_fake_transmit_idle_handler(struct k_work *item) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(item); + struct modem_backend_fake *backend = + CONTAINER_OF(dwork, struct modem_backend_fake, transmit_idle_dwork); + + modem_pipe_notify_transmit_idle(&backend->pipe); +} + +static int modem_backend_fake_transmit(void *data, const uint8_t *buf, size_t size) +{ + struct modem_backend_fake *backend = data; + + backend->transmit_called = true; + backend->transmit_buffer = buf; + backend->transmit_buffer_size = size; + + if (backend->synchronous) { + modem_pipe_notify_transmit_idle(&backend->pipe); + } else { + k_work_schedule(&backend->transmit_idle_dwork, TEST_MODEM_PIPE_NOTIFY_TIMEOUT); + } + + return size; +} + +static int modem_backend_fake_receive(void *data, uint8_t *buf, size_t size) +{ + struct modem_backend_fake *backend = data; + + backend->receive_called = true; + backend->receive_buffer = buf; + backend->receive_buffer_size = size; + return size; +} + +static void modem_backend_fake_closed_handler(struct k_work *item) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(item); + struct modem_backend_fake *backend = + CONTAINER_OF(dwork, struct modem_backend_fake, closed_dwork); + + modem_pipe_notify_closed(&backend->pipe); +} + +static int modem_backend_fake_close(void *data) +{ + struct modem_backend_fake *backend = data; + + backend->close_called = true; + + if (backend->synchronous) { + modem_pipe_notify_closed(&backend->pipe); + } else { + k_work_schedule(&backend->closed_dwork, TEST_MODEM_PIPE_NOTIFY_TIMEOUT); + } + + return 0; +} + +static struct modem_pipe_api modem_backend_fake_api = { + .open = modem_backend_fake_open, + .transmit = modem_backend_fake_transmit, + .receive = modem_backend_fake_receive, + .close = modem_backend_fake_close, +}; + +static struct modem_pipe *modem_backend_fake_init(struct modem_backend_fake *backend) +{ + k_work_init_delayable(&backend->opened_dwork, + modem_backend_fake_opened_handler); + k_work_init_delayable(&backend->transmit_idle_dwork, + modem_backend_fake_transmit_idle_handler); + k_work_init_delayable(&backend->closed_dwork, + modem_backend_fake_closed_handler); + + modem_pipe_init(&backend->pipe, backend, &modem_backend_fake_api); + return &backend->pipe; +} + +static void modem_backend_fake_reset(struct modem_backend_fake *backend) +{ + backend->transmit_buffer = NULL; + backend->transmit_buffer_size = 0; + backend->receive_buffer = NULL; + backend->transmit_buffer_size = 0; + backend->open_called = false; + backend->transmit_called = false; + backend->receive_called = false; + backend->close_called = false; +} + +static void modem_backend_fake_set_sync(struct modem_backend_fake *backend, bool sync) +{ + backend->synchronous = sync; +} + +/*************************************************************************************************/ +/* Instances */ +/*************************************************************************************************/ +static struct modem_backend_fake test_backend; +static struct modem_pipe *test_pipe; +static uint32_t test_user_data; +static atomic_t test_state; +static uint8_t test_buffer[4]; +static size_t test_buffer_size = sizeof(test_buffer); + +/*************************************************************************************************/ +/* Callbacks */ +/*************************************************************************************************/ +static void modem_pipe_fake_handler(struct modem_pipe *pipe, enum modem_pipe_event event, + void *user_data) +{ + __ASSERT(pipe == test_pipe, "Incorrect pipe provided with callback"); + __ASSERT(user_data == (void *)&test_user_data, "Incorrect user data ptr"); + + switch (event) { + case MODEM_PIPE_EVENT_OPENED: + atomic_set_bit(&test_state, TEST_MODEM_PIPE_EVENT_OPENED_BIT); + break; + + case MODEM_PIPE_EVENT_RECEIVE_READY: + atomic_set_bit(&test_state, TEST_MODEM_PIPE_EVENT_RECEIVE_READY_BIT); + break; + + case MODEM_PIPE_EVENT_TRANSMIT_IDLE: + atomic_set_bit(&test_state, TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT); + break; + + case MODEM_PIPE_EVENT_CLOSED: + atomic_set_bit(&test_state, TEST_MODEM_PIPE_EVENT_CLOSED_BIT); + break; + } +} + +static void test_reset(void) +{ + modem_backend_fake_reset(&test_backend); + atomic_set(&test_state, 0); +} + +static void *modem_backend_fake_setup(void) +{ + test_pipe = modem_backend_fake_init(&test_backend); + return NULL; +} + +static void modem_backend_fake_before(void *f) +{ + modem_backend_fake_set_sync(&test_backend, false); + modem_pipe_attach(test_pipe, modem_pipe_fake_handler, &test_user_data); + test_reset(); +} + +static void modem_backend_fake_after(void *f) +{ + __ASSERT(modem_pipe_close(test_pipe) == 0, "Failed to close pipe"); + modem_pipe_release(test_pipe); +} + +/* Opening pipe shall raise events OPENED and TRANSMIT_IDLE */ +static void test_pipe_open(void) +{ + zassert_ok(modem_pipe_open(test_pipe), "Failed to open pipe"); + zassert_true(test_backend.open_called, "open was not called"); + zassert_equal(atomic_get(&test_state), + BIT(TEST_MODEM_PIPE_EVENT_OPENED_BIT) | + BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT), + "Unexpected state %u", atomic_get(&test_state)); +} + +/* Re-opening pipe shall have no effect */ +static void test_pipe_reopen(void) +{ + zassert_ok(modem_pipe_open(test_pipe), "Failed to re-open pipe"); + zassert_false(test_backend.open_called, "open was called"); + zassert_equal(atomic_get(&test_state), 0, + "Unexpected state %u", atomic_get(&test_state)); +} + +/* Closing pipe shall raise event CLOSED */ +static void test_pipe_close(void) +{ + zassert_ok(modem_pipe_close(test_pipe), "Failed to close pipe"); + zassert_true(test_backend.close_called, "close was not called"); + zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_CLOSED_BIT), + "Unexpected state %u", atomic_get(&test_state)); +} + +/* Re-closing pipe shall have no effect */ +static void test_pipe_reclose(void) +{ + zassert_ok(modem_pipe_close(test_pipe), "Failed to re-close pipe"); + zassert_false(test_backend.close_called, "close was called"); + zassert_equal(atomic_get(&test_state), 0, + "Unexpected state %u", atomic_get(&test_state)); +} + +static void test_pipe_async_transmit(void) +{ + zassert_equal(modem_pipe_transmit(test_pipe, test_buffer, test_buffer_size), + test_buffer_size, "Failed to transmit"); + zassert_true(test_backend.transmit_called, "transmit was not called"); + zassert_equal(test_backend.transmit_buffer, test_buffer, "Incorrect buffer"); + zassert_equal(test_backend.transmit_buffer_size, test_buffer_size, + "Incorrect buffer size"); + zassert_equal(atomic_get(&test_state), 0, "Unexpected state %u", + atomic_get(&test_state)); + k_sleep(TEST_MODEM_PIPE_WAIT_TIMEOUT); + zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT), + "Unexpected state %u", atomic_get(&test_state)); +} + +static void test_pipe_sync_transmit(void) +{ + zassert_equal(modem_pipe_transmit(test_pipe, test_buffer, test_buffer_size), + test_buffer_size, "Failed to transmit"); + zassert_true(test_backend.transmit_called, "transmit was not called"); + zassert_equal(test_backend.transmit_buffer, test_buffer, "Incorrect buffer"); + zassert_equal(test_backend.transmit_buffer_size, test_buffer_size, + "Incorrect buffer size"); + zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT), + "Unexpected state %u", atomic_get(&test_state)); +} + +static void test_pipe_attach_receive_not_ready_transmit_idle(void) +{ + modem_pipe_attach(test_pipe, modem_pipe_fake_handler, &test_user_data); + zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT), + "Unexpected state %u", atomic_get(&test_state)); +} + +static void test_pipe_attach_receive_ready_transmit_idle(void) +{ + modem_pipe_attach(test_pipe, modem_pipe_fake_handler, &test_user_data); + zassert_equal(atomic_get(&test_state), + BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT) | + BIT(TEST_MODEM_PIPE_EVENT_RECEIVE_READY_BIT), + "Unexpected state %u", atomic_get(&test_state)); +} + +static void test_pipe_receive(void) +{ + zassert_equal(modem_pipe_receive(test_pipe, test_buffer, test_buffer_size), + test_buffer_size, "Failed to receive"); + zassert_true(test_backend.receive_called, "receive was not called"); + zassert_equal(test_backend.receive_buffer, test_buffer, "Incorrect buffer"); + zassert_equal(test_backend.receive_buffer_size, test_buffer_size, + "Incorrect buffer size"); + zassert_equal(atomic_get(&test_state), 0, "Unexpected state %u", + atomic_get(&test_state)); +} + +static void test_pipe_notify_receive_ready(void) +{ + modem_pipe_notify_receive_ready(test_pipe); + zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_RECEIVE_READY_BIT), + "Unexpected state %u", atomic_get(&test_state)); +} + +ZTEST(modem_pipe, test_async_open_close) +{ + test_pipe_open(); + test_reset(); + test_pipe_reopen(); + test_reset(); + test_pipe_close(); + test_reset(); + test_pipe_reclose(); +} + +ZTEST(modem_pipe, test_sync_open_close) +{ + modem_backend_fake_set_sync(&test_backend, true); + test_pipe_open(); + test_reset(); + test_pipe_reopen(); + test_reset(); + test_pipe_close(); + test_reset(); + test_pipe_reclose(); +} + +ZTEST(modem_pipe, test_async_transmit) +{ + test_pipe_open(); + test_reset(); + test_pipe_async_transmit(); +} + +ZTEST(modem_pipe, test_sync_transmit) +{ + modem_backend_fake_set_sync(&test_backend, true); + test_pipe_open(); + test_reset(); + test_pipe_sync_transmit(); +} + +ZTEST(modem_pipe, test_attach) +{ + test_pipe_open(); + + /* + * Attaching pipe shall reinvoke TRANSMIT IDLE, but not RECEIVE READY as + * receive is not ready. + */ + test_reset(); + test_pipe_attach_receive_not_ready_transmit_idle(); + + /* + * Notify receive ready and expect receive ready to be re-invoked every + * time the pipe is attached to. + */ + test_reset(); + test_pipe_notify_receive_ready(); + test_reset(); + test_pipe_attach_receive_ready_transmit_idle(); + test_reset(); + test_pipe_attach_receive_ready_transmit_idle(); + + /* + * Receiving data from the pipe shall clear the receive ready state, stopping + * the invocation of receive ready on attach. + */ + test_reset(); + test_pipe_receive(); + test_reset(); + test_pipe_attach_receive_not_ready_transmit_idle(); +} + +ZTEST_SUITE(modem_pipe, NULL, modem_backend_fake_setup, modem_backend_fake_before, + modem_backend_fake_after, NULL); diff --git a/tests/subsys/modem/modem_pipe/testcase.yaml b/tests/subsys/modem/modem_pipe/testcase.yaml new file mode 100644 index 00000000000..39a8c8e6c2c --- /dev/null +++ b/tests/subsys/modem/modem_pipe/testcase.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2023 Trackunit Corporation +# SPDX-License-Identifier: Apache-2.0 + +tests: + modem.modem_pipe: + tags: modem_pipe + harness: ztest + platform_allow: native_sim From 646e31ea443402f9360c7deb1faf13c107d7a2c5 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Tue, 2 Jan 2024 22:53:57 +0700 Subject: [PATCH 0493/2300] [nrf fromtree] modem: modem_cmux: optimize modem_cmux_transmit_frame to save ROM This optimization aggregates frame headers before adding to the ring buffer and computes the FCS of the frame header in one operation. This approach improves execution efficiency and reduces memory footprint. This code adjustment aligns with the changes proposed in https://github.com/zephyrproject-rtos/zephyr/pull/67062. Signed-off-by: Pisit Sawangvonganan (cherry picked from commit 1270bce4d84b6146aae7ffbe07579aa4a85ebf27) (cherry picked from commit 97a72e72ef8021988c21d83e87eb1870d4c814c6) --- subsys/modem/modem_cmux.c | 46 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 472d1a7149a..dc7c3915566 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -205,57 +205,55 @@ static void modem_cmux_bus_callback(struct modem_pipe *pipe, enum modem_pipe_eve static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, const struct modem_cmux_frame *frame) { - uint8_t byte; + uint8_t buf[MODEM_CMUX_FRAME_SIZE_MAX]; uint8_t fcs; uint16_t space; uint16_t data_len; + uint16_t buf_idx; space = ring_buf_space_get(&cmux->transmit_rb) - MODEM_CMUX_FRAME_SIZE_MAX; data_len = (space < frame->data_len) ? space : frame->data_len; /* SOF */ - byte = 0xF9; - ring_buf_put(&cmux->transmit_rb, &byte, 1); + buf[0] = 0xF9; /* DLCI Address (Max 63) */ - byte = 0x01 | (frame->cr << 1) | (frame->dlci_address << 2); - fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, MODEM_CMUX_FCS_INIT_VALUE, true); - ring_buf_put(&cmux->transmit_rb, &byte, 1); + buf[1] = 0x01 | (frame->cr << 1) | (frame->dlci_address << 2); /* Frame type and poll/final */ - byte = frame->type | (frame->pf << 4); - fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); - ring_buf_put(&cmux->transmit_rb, &byte, 1); + buf[2] = frame->type | (frame->pf << 4); /* Data length */ if (data_len > 127) { - byte = data_len << 1; - fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); - ring_buf_put(&cmux->transmit_rb, &byte, 1); - byte = data_len >> 7; - ring_buf_put(&cmux->transmit_rb, &byte, 1); + buf[3] = data_len << 1; + buf[4] = data_len >> 7; + buf_idx = 5; } else { - byte = 0x01 | (data_len << 1); - ring_buf_put(&cmux->transmit_rb, &byte, 1); + buf[3] = 0x01 | (data_len << 1); + buf_idx = 4; } + /* 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 final */ if (frame->type == MODEM_CMUX_FRAME_TYPE_UIH) { - fcs = 0xFF - crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); + fcs = 0xFF - fcs; } else { - fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); fcs = 0xFF - crc8(frame->data, data_len, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); } + /* Frame header */ + ring_buf_put(&cmux->transmit_rb, buf, buf_idx); + /* Data */ ring_buf_put(&cmux->transmit_rb, frame->data, data_len); - /* FCS */ - ring_buf_put(&cmux->transmit_rb, &fcs, 1); - - /* EOF */ - byte = 0xF9; - ring_buf_put(&cmux->transmit_rb, &byte, 1); + /* FCS and EOF will be put on the same call */ + buf[0] = fcs; + buf[1] = 0xF9; + ring_buf_put(&cmux->transmit_rb, buf, 2); k_work_schedule(&cmux->transmit_work, K_NO_WAIT); return data_len; } From 861bf0c87539580efd0bd6ca575cd37aea151f78 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 11 Jan 2024 13:12:00 +0100 Subject: [PATCH 0494/2300] [nrf fromtree] modem: chat: Start waiting for response after request is sent This PR makes the modem_chat wait until a chat script chat request has been sent before accepting responses to said request. This helps ensure that an unsolicitet response is not mistaken for a response to a request, which is especially problematic if the chat script chat is using an any match. For example, start chat script sending AT+CGMI, expecting the modem name as a response followed by OK > start script, waiting for response immediately > start sending "AT+CGMI" > receive "+CEREG 1,0" while sending > script accepts "+CEREG 1,0" as the response to "AT+CGMI" > "AT+CGMI" sent > receive "QUECTEL BG95" > receive "OK" script handler got "+CEREG 1,0" instead of "QUECTEL BG95" After this PR: > start script > start sending AT+CGMI > receive "+CEREG 1,0" while sending > "AT+CGMI" sent > start waiting for response > receive "QUECTEL BG95" > script accepts "QUECTEL BG95" as response to "AT+CGMI" > receive "OK" Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 7c9f2872e17d168cf28c6e77dd5fcb71b892c33d) (cherry picked from commit c183d3ef9694f2cb0ebcfbff8715388004d63d2a) --- subsys/modem/modem_chat.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index 7cf7692c514..f3857bcfbc3 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -95,8 +95,10 @@ static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_scri chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = NULL; chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = 0; - /* Cancel timeout work */ + /* Cancel work */ k_work_cancel_delayable(&chat->script_timeout_work); + k_work_cancel_delayable(&chat->script_send_work); + k_work_cancel_delayable(&chat->script_send_timeout_work); /* Clear script running state */ atomic_clear_bit(&chat->script_state, MODEM_CHAT_SCRIPT_STATE_RUNNING_BIT); @@ -118,6 +120,21 @@ static void modem_chat_script_send(struct modem_chat *chat) k_work_schedule(&chat->script_send_work, K_NO_WAIT); } +static void modem_chat_script_set_response_matches(struct modem_chat *chat) +{ + const struct modem_chat_script_chat *script_chat = + &chat->script->script_chats[chat->script_chat_it]; + + chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = script_chat->response_matches; + chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = script_chat->response_matches_size; +} + +static void modem_chat_script_clear_response_matches(struct modem_chat *chat) +{ + chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = NULL; + chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = 0; +} + static void modem_chat_script_next(struct modem_chat *chat, bool initial) { const struct modem_chat_script_chat *script_chat; @@ -142,14 +159,13 @@ static void modem_chat_script_next(struct modem_chat *chat, bool initial) script_chat = &chat->script->script_chats[chat->script_chat_it]; - /* Set response command handlers */ - chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = script_chat->response_matches; - chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = script_chat->response_matches_size; - - /* Check if work must be sent */ + /* Check if request must be sent */ if (script_chat->request_size > 0) { LOG_DBG("sending: %.*s", script_chat->request_size, script_chat->request); + modem_chat_script_clear_response_matches(chat); modem_chat_script_send(chat); + } else { + modem_chat_script_set_response_matches(chat); } } @@ -322,6 +338,8 @@ static void modem_chat_script_send_handler(struct k_work *item) } else { k_work_schedule(&chat->script_send_timeout_work, K_MSEC(timeout)); } + } else { + modem_chat_script_set_response_matches(chat); } } From 469bad7589b2ff3beda485c49b2e79b833c1402b Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 12 Jan 2024 11:31:14 +0100 Subject: [PATCH 0495/2300] [nrf fromtree] tests: modem: pipe: mock: Implement TRANSMIT_IDLE event Implements TRANSMIT_IDLE event notification for mock modem_pipe. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 325bc953a89d79ca71b6f8b59ea320bbf78fa656) (cherry picked from commit 05222f38816ac0e3a195ec04fc05ada95aff3f90) --- tests/subsys/modem/mock/modem_backend_mock.c | 24 ++++++++++++++------ tests/subsys/modem/mock/modem_backend_mock.h | 10 ++------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/subsys/modem/mock/modem_backend_mock.c b/tests/subsys/modem/mock/modem_backend_mock.c index 0a12fc43674..5b7b47c0eb4 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.c +++ b/tests/subsys/modem/mock/modem_backend_mock.c @@ -47,7 +47,8 @@ static int modem_backend_mock_transmit(void *data, const uint8_t *buf, size_t si struct modem_backend_mock *t_mock = mock->bridge; ret = ring_buf_put(&t_mock->rx_rb, buf, size); - k_work_submit(&t_mock->received_work_item.work); + k_work_submit(&t_mock->receive_ready_work); + k_work_submit(&mock->transmit_idle_work); return ret; } @@ -59,6 +60,7 @@ static int modem_backend_mock_transmit(void *data, const uint8_t *buf, size_t si mock->transaction = NULL; } + k_work_submit(&mock->transmit_idle_work); return ret; } @@ -85,14 +87,22 @@ struct modem_pipe_api modem_backend_mock_api = { .close = modem_backend_mock_close, }; -static void modem_backend_mock_received_handler(struct k_work *item) +static void modem_backend_mock_receive_ready_handler(struct k_work *item) { - struct modem_backend_mock_work *mock_work_item = (struct modem_backend_mock_work *)item; - struct modem_backend_mock *mock = mock_work_item->mock; + struct modem_backend_mock *mock = + CONTAINER_OF(item, struct modem_backend_mock, receive_ready_work); modem_pipe_notify_receive_ready(&mock->pipe); } +static void modem_backend_mock_transmit_idle_handler(struct k_work *item) +{ + struct modem_backend_mock *mock = + CONTAINER_OF(item, struct modem_backend_mock, transmit_idle_work); + + modem_pipe_notify_transmit_idle(&mock->pipe); +} + struct modem_pipe *modem_backend_mock_init(struct modem_backend_mock *mock, const struct modem_backend_mock_config *config) { @@ -100,8 +110,8 @@ struct modem_pipe *modem_backend_mock_init(struct modem_backend_mock *mock, ring_buf_init(&mock->rx_rb, config->rx_buf_size, config->rx_buf); ring_buf_init(&mock->tx_rb, config->tx_buf_size, config->tx_buf); - mock->received_work_item.mock = mock; - k_work_init(&mock->received_work_item.work, modem_backend_mock_received_handler); + k_work_init(&mock->receive_ready_work, modem_backend_mock_receive_ready_handler); + k_work_init(&mock->transmit_idle_work, modem_backend_mock_transmit_idle_handler); mock->limit = config->limit; modem_pipe_init(&mock->pipe, mock, &modem_backend_mock_api); return &mock->pipe; @@ -130,7 +140,7 @@ void modem_backend_mock_put(struct modem_backend_mock *mock, const uint8_t *buf, __ASSERT(ring_buf_put(&mock->rx_rb, buf, size) == size, "Mock buffer capacity exceeded"); - k_work_submit(&mock->received_work_item.work); + k_work_submit(&mock->receive_ready_work); } void modem_backend_mock_prime(struct modem_backend_mock *mock, diff --git a/tests/subsys/modem/mock/modem_backend_mock.h b/tests/subsys/modem/mock/modem_backend_mock.h index 7d9ad11bf41..56a5b585cb1 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.h +++ b/tests/subsys/modem/mock/modem_backend_mock.h @@ -11,13 +11,6 @@ #ifndef ZEPHYR_DRIVERS_MODEM_MODEM_PIPE_MOCK #define ZEPHYR_DRIVERS_MODEM_MODEM_PIPE_MOCK -struct modem_backend_mock; - -struct modem_backend_mock_work { - struct k_work work; - struct modem_backend_mock *mock; -}; - struct modem_backend_mock_transaction { /* Get data which will trigger put */ const uint8_t *get; @@ -34,7 +27,8 @@ struct modem_backend_mock { struct ring_buf rx_rb; struct ring_buf tx_rb; - struct modem_backend_mock_work received_work_item; + struct k_work receive_ready_work; + struct k_work transmit_idle_work; const struct modem_backend_mock_transaction *transaction; size_t transaction_match_cnt; From b83915af7ad091c908e4ebd31e7424981d4619b8 Mon Sep 17 00:00:00 2001 From: Emil Lindqvist Date: Thu, 4 Jan 2024 10:21:07 +0100 Subject: [PATCH 0496/2300] [nrf fromtree] modem_cellular: add RSRP & RSRQ to U-blox SARA-R5 modem This commit implements parsing of the CESQ extended signal quality AT command, extracting RSRP and RSRQ which is relevant for LTE connections. It's used in the U-blox SARA-R5 modem instance. Furthermore, the IMEI, IMSI is extracted in the same modem. Signed-off-by: Emil Lindqvist (cherry picked from commit 342e10b0b80504c3b119e36994be2ea0659e9326) (cherry picked from commit 30e3637d54852f2c31db5374167db25380653030) --- drivers/modem/modem_cellular.c | 78 +++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 16530edde6c..d1f3a69c94e 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -33,6 +33,16 @@ LOG_MODULE_REGISTER(modem_cellular, CONFIG_MODEM_LOG_LEVEL); #define MODEM_CELLULAR_DATA_MANUFACTURER_LEN (64) #define MODEM_CELLULAR_DATA_FW_VERSION_LEN (64) +/* Magic constants */ +#define CSQ_RSSI_UNKNOWN (99) +#define CESQ_RSRP_UNKNOWN (255) +#define CESQ_RSRQ_UNKNOWN (255) + +/* Magic numbers to units conversions */ +#define CSQ_RSSI_TO_DB(v) (-113 + (2 * (rssi))) +#define CESQ_RSRP_TO_DB(v) (-140 + (v)) +#define CESQ_RSRQ_TO_DB(v) (-20 + ((v) / 2)) + enum modem_cellular_state { MODEM_CELLULAR_STATE_IDLE = 0, MODEM_CELLULAR_STATE_RESET_PULSE, @@ -95,6 +105,8 @@ struct modem_cellular_data { uint8_t registration_status_gprs; uint8_t registration_status_lte; uint8_t rssi; + uint8_t rsrp; + uint8_t rsrq; uint8_t imei[MODEM_CELLULAR_DATA_IMEI_LEN]; uint8_t model_id[MODEM_CELLULAR_DATA_MODEL_ID_LEN]; uint8_t imsi[MODEM_CELLULAR_DATA_IMSI_LEN]; @@ -340,6 +352,19 @@ static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uin data->rssi = (uint8_t)atoi(argv[1]); } +static void modem_cellular_chat_on_cesq(struct modem_chat *chat, char **argv, uint16_t argc, + void *user_data) +{ + struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; + + if (argc != 7) { + return; + } + + data->rsrq = (uint8_t)atoi(argv[5]); + data->rsrp = (uint8_t)atoi(argv[6]); +} + static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, uint16_t argc, void *user_data) { @@ -398,6 +423,7 @@ MODEM_CHAT_MATCHES_DEFINE(allow_match, MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); +MODEM_CHAT_MATCH_DEFINE(cesq_match, "+CESQ: ", ",", modem_cellular_chat_on_cesq); MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); @@ -1253,11 +1279,44 @@ static inline int modem_cellular_csq_parse_rssi(uint8_t rssi, int16_t *value) * - ber is an integer from 0 to 7 that describes the error rate, it can also * be 99 for an unknown error rate */ - if (rssi == 99) { + if (rssi == CSQ_RSSI_UNKNOWN) { + return -EINVAL; + } + + *value = (int16_t)CSQ_RSSI_TO_DB(rssi); + return 0; +} + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(get_signal_cesq_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CESQ", cesq_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(get_signal_cesq_chat_script, get_signal_cesq_chat_script_cmds, + abort_matches, modem_cellular_chat_callback_handler, 2); + +/* AT+CESQ returns a response +CESQ: ,,,,, where: + * - rsrq is a integer from 0 to 34 whose values describes the Reference Signal Receive + * Quality between -20 dB for 0 and -3 dB for 34 (0.5 dB steps), or unknown for 255 + * - rsrp is an integer from 0 to 97 that describes the Reference Signal Receive Power + * between -140 dBm for 0 and -44 dBm for 97 (1 dBm steps), or unknown for 255 + */ +static inline int modem_cellular_cesq_parse_rsrp(uint8_t rsrp, int16_t *value) +{ + if (rsrp == CESQ_RSRP_UNKNOWN) { + return -EINVAL; + } + + *value = (int16_t)CESQ_RSRP_TO_DB(rsrp); + return 0; +} + +static inline int modem_cellular_cesq_parse_rsrq(uint8_t rsrq, int16_t *value) +{ + if (rsrq == CESQ_RSRQ_UNKNOWN) { return -EINVAL; } - *value = (int16_t)(-113 + (2 * rssi)); + *value = (int16_t)CESQ_RSRQ_TO_DB(rsrq); return 0; } @@ -1281,8 +1340,7 @@ static int modem_cellular_get_signal(const struct device *dev, case CELLULAR_SIGNAL_RSRP: case CELLULAR_SIGNAL_RSRQ: - /* TODO: Run CESQ script */ - ret = -ENOTSUP; + ret = modem_chat_run_script(&data->chat, &get_signal_cesq_chat_script); break; default: @@ -1302,9 +1360,11 @@ static int modem_cellular_get_signal(const struct device *dev, break; case CELLULAR_SIGNAL_RSRP: + ret = modem_cellular_cesq_parse_rsrp(data->rsrp, value); + break; + case CELLULAR_SIGNAL_RSRQ: - /* TODO: Validate and set values */ - ret = -ENODATA; + ret = modem_cellular_cesq_parse_rsrq(data->rsrq, value); break; default: @@ -1744,6 +1804,12 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(u_blox_sara_r5_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMUX=0,0,5,127", ok_match)); MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r5_init_chat_script, u_blox_sara_r5_init_chat_script_cmds, From b8288d540647a5f137aa21546c3ccf97be5e5b3a Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 24 Nov 2023 14:47:59 +0100 Subject: [PATCH 0497/2300] [nrf fromtree] modem: cmux: Implement TRANSMIT_IDLE event Implement transmit idle event both for transmitting data to the bus, and for the individual DLCI channels. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit c1146278536ccf135695004b24eb8242add74b75) (cherry picked from commit 54f90a7c27056211eb1e1e2730e0fb03f16728d0) --- subsys/modem/modem_cmux.c | 58 ++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index dc7c3915566..13a153b8533 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -197,8 +197,17 @@ static void modem_cmux_bus_callback(struct modem_pipe *pipe, enum modem_pipe_eve { struct modem_cmux *cmux = (struct modem_cmux *)user_data; - if (event == MODEM_PIPE_EVENT_RECEIVE_READY) { + switch (event) { + case MODEM_PIPE_EVENT_RECEIVE_READY: k_work_schedule(&cmux->receive_work, K_NO_WAIT); + break; + + case MODEM_PIPE_EVENT_TRANSMIT_IDLE: + k_work_schedule(&cmux->transmit_work, K_NO_WAIT); + break; + + default: + break; } } @@ -833,6 +842,17 @@ static void modem_cmux_receive_handler(struct k_work *item) k_work_schedule(&cmux->receive_work, K_NO_WAIT); } +static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux) +{ + sys_snode_t *node; + struct modem_cmux_dlci *dlci; + + SYS_SLIST_FOR_EACH_NODE(&cmux->dlcis, node) { + dlci = (struct modem_cmux_dlci *)node; + modem_pipe_notify_transmit_idle(&dlci->pipe); + } +} + static void modem_cmux_transmit_handler(struct k_work *item) { struct k_work_delayable *dwork = k_work_delayable_from_work(item); @@ -840,31 +860,37 @@ static void modem_cmux_transmit_handler(struct k_work *item) uint8_t *reserved; uint32_t reserved_size; int ret; + bool transmit_rb_empty; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); - /* Reserve data to transmit from transmit ring buffer */ - reserved_size = ring_buf_get_claim(&cmux->transmit_rb, &reserved, UINT32_MAX); + while (true) { + transmit_rb_empty = ring_buf_is_empty(&cmux->transmit_rb); - /* Transmit reserved data */ - ret = modem_pipe_transmit(cmux->pipe, reserved, reserved_size); - if (ret < 1) { - ring_buf_get_finish(&cmux->transmit_rb, 0); - k_mutex_unlock(&cmux->transmit_rb_lock); - k_work_schedule(&cmux->transmit_work, K_NO_WAIT); + if (transmit_rb_empty) { + break; + } - return; - } + reserved_size = ring_buf_get_claim(&cmux->transmit_rb, &reserved, UINT32_MAX); - /* Release remaining reserved data */ - ring_buf_get_finish(&cmux->transmit_rb, ret); + ret = modem_pipe_transmit(cmux->pipe, reserved, reserved_size); + if (ret < 0) { + ring_buf_get_finish(&cmux->transmit_rb, 0); + break; + } - /* Resubmit transmit work if data remains */ - if (ring_buf_is_empty(&cmux->transmit_rb) == false) { - k_work_schedule(&cmux->transmit_work, K_NO_WAIT); + ring_buf_get_finish(&cmux->transmit_rb, (uint32_t)ret); + + if (ret == 0) { + break; + } } k_mutex_unlock(&cmux->transmit_rb_lock); + + if (transmit_rb_empty) { + modem_cmux_dlci_notify_transmit_idle(cmux); + } } static void modem_cmux_connect_handler(struct k_work *item) From e8bc50ebf26d3d46a1fdd988a7b5fd4bd3badbeb Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 24 Nov 2023 16:09:40 +0100 Subject: [PATCH 0498/2300] [nrf fromtree] tests: modem: cmux: Implement TRANSMIT_IDLE into test suite Use transmit idle event to synchronize with data transmitted through DLCI pipes to test TRANSMIT_IDLE implementation. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 358f1ff93404d081b8f07c9faacb81097ce09346) (cherry picked from commit 914e33b692d891ba3197602195a4ddf259168f63) --- subsys/modem/modem_cmux.c | 2 +- tests/subsys/modem/modem_cmux/src/main.c | 61 ++++++++++++++++++++---- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 13a153b8533..16dc60b7219 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -881,7 +881,7 @@ static void modem_cmux_transmit_handler(struct k_work *item) ring_buf_get_finish(&cmux->transmit_rb, (uint32_t)ret); - if (ret == 0) { + if (ret < reserved_size) { break; } } diff --git a/tests/subsys/modem/modem_cmux/src/main.c b/tests/subsys/modem/modem_cmux/src/main.c index d601eeb1446..b08cf26b5af 100644 --- a/tests/subsys/modem/modem_cmux/src/main.c +++ b/tests/subsys/modem/modem_cmux/src/main.c @@ -17,12 +17,16 @@ /*************************************************************************************************/ /* Definitions */ /*************************************************************************************************/ -#define EVENT_CMUX_CONNECTED BIT(0) -#define EVENT_CMUX_DLCI1_OPEN BIT(1) -#define EVENT_CMUX_DLCI2_OPEN BIT(2) -#define EVENT_CMUX_DLCI1_CLOSED BIT(3) -#define EVENT_CMUX_DLCI2_CLOSED BIT(4) -#define EVENT_CMUX_DISCONNECTED BIT(5) +#define EVENT_CMUX_CONNECTED BIT(0) +#define EVENT_CMUX_DLCI1_OPEN BIT(1) +#define EVENT_CMUX_DLCI2_OPEN BIT(2) +#define EVENT_CMUX_DLCI1_RECEIVE_READY BIT(3) +#define EVENT_CMUX_DLCI1_TRANSMIT_IDLE BIT(4) +#define EVENT_CMUX_DLCI2_RECEIVE_READY BIT(5) +#define EVENT_CMUX_DLCI2_TRANSMIT_IDLE BIT(6) +#define EVENT_CMUX_DLCI1_CLOSED BIT(7) +#define EVENT_CMUX_DLCI2_CLOSED BIT(8) +#define EVENT_CMUX_DISCONNECTED BIT(9) /*************************************************************************************************/ /* Instances */ @@ -59,6 +63,14 @@ static void test_modem_dlci1_pipe_callback(struct modem_pipe *pipe, enum modem_p k_event_post(&cmux_event, EVENT_CMUX_DLCI1_OPEN); break; + case MODEM_PIPE_EVENT_RECEIVE_READY: + k_event_post(&cmux_event, EVENT_CMUX_DLCI1_RECEIVE_READY); + break; + + case MODEM_PIPE_EVENT_TRANSMIT_IDLE: + k_event_post(&cmux_event, EVENT_CMUX_DLCI1_TRANSMIT_IDLE); + break; + case MODEM_PIPE_EVENT_CLOSED: k_event_post(&cmux_event, EVENT_CMUX_DLCI1_CLOSED); break; @@ -76,6 +88,14 @@ static void test_modem_dlci2_pipe_callback(struct modem_pipe *pipe, enum modem_p k_event_post(&cmux_event, EVENT_CMUX_DLCI2_OPEN); break; + case MODEM_PIPE_EVENT_RECEIVE_READY: + k_event_post(&cmux_event, EVENT_CMUX_DLCI2_RECEIVE_READY); + break; + + case MODEM_PIPE_EVENT_TRANSMIT_IDLE: + k_event_post(&cmux_event, EVENT_CMUX_DLCI2_TRANSMIT_IDLE); + break; + case MODEM_PIPE_EVENT_CLOSED: k_event_post(&cmux_event, EVENT_CMUX_DLCI2_CLOSED); break; @@ -300,6 +320,7 @@ static void test_modem_cmux_before(void *f) ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_at) { int ret; + uint32_t events; modem_backend_mock_put(&bus_mock, cmux_frame_dlci2_at_cgdcont, sizeof(cmux_frame_dlci2_at_cgdcont)); @@ -309,6 +330,10 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_at) 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)), @@ -327,6 +352,7 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_at) ZTEST(modem_cmux, test_modem_cmux_receive_dlci1_at) { int ret; + uint32_t events; modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_at, sizeof(cmux_frame_dlci1_at_at)); modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_newline, @@ -334,6 +360,10 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci1_at) k_msleep(100); + events = k_event_test(&cmux_event, EVENT_CMUX_DLCI1_RECEIVE_READY); + zassert_equal(events, EVENT_CMUX_DLCI1_RECEIVE_READY, + "Receive ready event not received for DLCI1 pipe"); + ret = modem_pipe_receive(dlci1_pipe, buffer1, sizeof(buffer1)); zassert_true(ret == (sizeof(cmux_frame_data_dlci1_at_at) + sizeof(cmux_frame_data_dlci1_at_newline)), @@ -352,12 +382,17 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci1_at) ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_ppp) { int ret; + uint32_t events; modem_backend_mock_put(&bus_mock, cmux_frame_dlci2_ppp_52, sizeof(cmux_frame_dlci2_ppp_52)); modem_backend_mock_put(&bus_mock, cmux_frame_dlci2_ppp_18, sizeof(cmux_frame_dlci2_ppp_18)); 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_ppp_52) + sizeof(cmux_frame_data_dlci2_ppp_18)), @@ -376,17 +411,25 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_ppp) ZTEST(modem_cmux, test_modem_cmux_transmit_dlci2_ppp) { int ret; + uint32_t events; ret = modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_ppp_52, sizeof(cmux_frame_data_dlci2_ppp_52)); - zassert_true(ret == sizeof(cmux_frame_data_dlci2_ppp_52), "Failed to send DLCI2 PPP 52"); + + events = k_event_wait(&cmux_event, EVENT_CMUX_DLCI2_TRANSMIT_IDLE, false, K_MSEC(200)); + zassert_equal(events, EVENT_CMUX_DLCI2_TRANSMIT_IDLE, + "Transmit idle event not received for DLCI2 pipe"); + + k_event_clear(&cmux_event, EVENT_CMUX_DLCI2_TRANSMIT_IDLE); + ret = modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_ppp_18, sizeof(cmux_frame_data_dlci2_ppp_18)); - zassert_true(ret == sizeof(cmux_frame_data_dlci2_ppp_18), "Failed to send DLCI2 PPP 18"); - k_msleep(100); + events = k_event_wait(&cmux_event, EVENT_CMUX_DLCI2_TRANSMIT_IDLE, false, K_MSEC(200)); + zassert_equal(events, EVENT_CMUX_DLCI2_TRANSMIT_IDLE, + "Transmit idle event not received for DLCI2 pipe"); ret = modem_backend_mock_get(&bus_mock, buffer2, sizeof(buffer2)); zassert_true(ret == (sizeof(cmux_frame_dlci2_ppp_52) + sizeof(cmux_frame_dlci2_ppp_18)), From cff74b2b5589b5774894eae3a91e04da0d3c8bfa Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 16 Jan 2024 14:37:01 +0100 Subject: [PATCH 0499/2300] [nrf fromtree] drivers: gnss: match: Change RMC/GGA sync from timeout to UTC Change the synchronization of RMC and GGA NMEA messages from a timeout to matching their UTC timestamps. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 1bc8490c6ccb67391ddd28c8fd3a569b859bd7e5) (cherry picked from commit 9a1cd2cbbb47f17fb4be8cfba87b7758029ee5c6) --- drivers/gnss/gnss_nmea0183_match.c | 58 ++++++++++++------------ drivers/gnss/gnss_nmea0183_match.h | 10 ++-- drivers/gnss/gnss_nmea_generic.c | 4 -- drivers/gnss/gnss_quectel_lcx6g.c | 1 - dts/bindings/gnss/gnss-nmea-generic.yaml | 10 ---- 5 files changed, 31 insertions(+), 52 deletions(-) diff --git a/drivers/gnss/gnss_nmea0183_match.c b/drivers/gnss/gnss_nmea0183_match.c index 2b971937c8d..cd82c552ee4 100644 --- a/drivers/gnss/gnss_nmea0183_match.c +++ b/drivers/gnss/gnss_nmea0183_match.c @@ -10,16 +10,22 @@ #include +#include "gnss_parse.h" #include "gnss_nmea0183.h" #include "gnss_nmea0183_match.h" -static bool gnss_nmea0183_match_timed_out(struct gnss_nmea0183_match_data *data) +static int gnss_nmea0183_match_parse_utc(char **argv, uint16_t argc, uint32_t *utc) { - int64_t delta; + int64_t i64; - delta = k_uptime_delta(&data->timestamp); - data->timestamp = k_uptime_get(); - return ((uint16_t)delta) > data->timeout_ms; + if ((gnss_parse_dec_to_milli(argv[1], &i64) < 0) || + (i64 < 0) || + (i64 > UINT32_MAX)) { + return -EINVAL; + } + + *utc = (uint32_t)i64; + return 0; } #if CONFIG_GNSS_SATELLITES @@ -30,10 +36,15 @@ static void gnss_nmea0183_match_reset_gsv(struct gnss_nmea0183_match_data *data) } #endif -static void gnss_nmea0183_match_reset(struct gnss_nmea0183_match_data *data) +static void gnss_nmea0183_match_publish(struct gnss_nmea0183_match_data *data) { - data->gga_received = false; - data->rmc_received = false; + if ((data->gga_utc == 0) || (data->rmc_utc == 0)) { + return; + } + + if (data->gga_utc == data->rmc_utc) { + gnss_publish_data(data->gnss, &data->data); + } } void gnss_nmea0183_match_gga_callback(struct modem_chat *chat, char **argv, uint16_t argc, @@ -41,19 +52,15 @@ void gnss_nmea0183_match_gga_callback(struct modem_chat *chat, char **argv, uint { struct gnss_nmea0183_match_data *data = user_data; - if (gnss_nmea0183_match_timed_out(data)) { - gnss_nmea0183_match_reset(data); - } - if (gnss_nmea0183_parse_gga((const char **)argv, argc, &data->data) < 0) { return; } - data->gga_received = true; - - if (data->gga_received && data->rmc_received) { - gnss_publish_data(data->gnss, &data->data); + if (gnss_nmea0183_match_parse_utc(argv, argc, &data->gga_utc) < 0) { + return; } + + gnss_nmea0183_match_publish(data); } void gnss_nmea0183_match_rmc_callback(struct modem_chat *chat, char **argv, uint16_t argc, @@ -61,19 +68,15 @@ void gnss_nmea0183_match_rmc_callback(struct modem_chat *chat, char **argv, uint { struct gnss_nmea0183_match_data *data = user_data; - if (gnss_nmea0183_match_timed_out(data)) { - gnss_nmea0183_match_reset(data); - } - if (gnss_nmea0183_parse_rmc((const char **)argv, argc, &data->data) < 0) { return; } - data->rmc_received = true; - - if (data->gga_received && data->rmc_received) { - gnss_publish_data(data->gnss, &data->data); + if (gnss_nmea0183_match_parse_utc(argv, argc, &data->rmc_utc) < 0) { + return; } + + gnss_nmea0183_match_publish(data); } #if CONFIG_GNSS_SATELLITES @@ -84,10 +87,6 @@ void gnss_nmea0183_match_gsv_callback(struct modem_chat *chat, char **argv, uint struct gnss_nmea0183_gsv_header header; int ret; - if (gnss_nmea0183_match_timed_out(data)) { - gnss_nmea0183_match_reset(data); - } - if (gnss_nmea0183_parse_gsv_header((const char **)argv, argc, &header) < 0) { return; } @@ -124,7 +123,7 @@ int gnss_nmea0183_match_init(struct gnss_nmea0183_match_data *data, const struct gnss_nmea0183_match_config *config) { __ASSERT(data != NULL, "data argument must be provided"); - __ASSERT(config != NULL, "data argument must be provided"); + __ASSERT(config != NULL, "config argument must be provided"); memset(data, 0, sizeof(struct gnss_nmea0183_match_data)); data->gnss = config->gnss; @@ -132,6 +131,5 @@ int gnss_nmea0183_match_init(struct gnss_nmea0183_match_data *data, data->satellites = config->satellites; data->satellites_size = config->satellites_size; #endif - data->timeout_ms = config->timeout_ms; return 0; } diff --git a/drivers/gnss/gnss_nmea0183_match.h b/drivers/gnss/gnss_nmea0183_match.h index 65104e1dc8a..28ed395320b 100644 --- a/drivers/gnss/gnss_nmea0183_match.h +++ b/drivers/gnss/gnss_nmea0183_match.h @@ -49,11 +49,9 @@ struct gnss_nmea0183_match_data { uint16_t satellites_size; uint16_t satellites_length; #endif - int64_t timestamp; - uint16_t timeout_ms; - uint8_t gga_received : 1; - uint8_t rmc_received : 1; - uint8_t gsv_message_number : 6; + uint32_t gga_utc; + uint32_t rmc_utc; + uint8_t gsv_message_number; }; /** GNSS NMEA0183 match configuration structure */ @@ -66,8 +64,6 @@ struct gnss_nmea0183_match_config { /** Number of elements in buffer for parsed satellites */ uint16_t satellites_size; #endif - /** The maximum time from the first to the last NMEA0183 message of a fix */ - uint16_t timeout_ms; }; /** diff --git a/drivers/gnss/gnss_nmea_generic.c b/drivers/gnss/gnss_nmea_generic.c index 0e7611ba495..6d9adfb6990 100644 --- a/drivers/gnss/gnss_nmea_generic.c +++ b/drivers/gnss/gnss_nmea_generic.c @@ -29,7 +29,6 @@ LOG_MODULE_REGISTER(gnss_nmea_generic, CONFIG_GNSS_LOG_LEVEL); struct gnss_nmea_generic_config { const struct device *uart; - uint16_t nmea_timeout_ms; }; struct gnss_nmea_generic_data { @@ -83,7 +82,6 @@ static struct gnss_driver_api gnss_api = { static int gnss_nmea_generic_init_nmea0183_match(const struct device *dev) { - const struct gnss_nmea_generic_config *cfg = dev->config; struct gnss_nmea_generic_data *data = dev->data; const struct gnss_nmea0183_match_config match_config = { @@ -92,7 +90,6 @@ static int gnss_nmea_generic_init_nmea0183_match(const struct device *dev) .satellites = data->satellites, .satellites_size = ARRAY_SIZE(data->satellites), #endif - .timeout_ms = cfg->nmea_timeout_ms, }; return gnss_nmea0183_match_init(&data->match_data, &match_config); @@ -163,7 +160,6 @@ static int gnss_nmea_generic_init(const struct device *dev) #define GNSS_NMEA_GENERIC(inst) \ static struct gnss_nmea_generic_config gnss_nmea_generic_cfg_##inst = { \ .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ - .nmea_timeout_ms = DT_INST_PROP(inst, nmea_timeout_ms), \ }; \ \ static struct gnss_nmea_generic_data gnss_nmea_generic_data_##inst; \ diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 9565d46cdfb..f7b29b4640d 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -649,7 +649,6 @@ static int quectel_lcx6g_init_nmea0183_match(const struct device *dev) .satellites = data->satellites, .satellites_size = ARRAY_SIZE(data->satellites), #endif - .timeout_ms = 50, }; return gnss_nmea0183_match_init(&data->match_data, &config); diff --git a/dts/bindings/gnss/gnss-nmea-generic.yaml b/dts/bindings/gnss/gnss-nmea-generic.yaml index 4be7bde1186..a3887995e10 100644 --- a/dts/bindings/gnss/gnss-nmea-generic.yaml +++ b/dts/bindings/gnss/gnss-nmea-generic.yaml @@ -20,13 +20,3 @@ compatible: "gnss-nmea-generic" include: - uart-device.yaml - -properties: - nmea-timeout-ms: - type: int - default: 500 - description: | - Synchronization timeout for NMEA sentences. The NMEA parser is expecting - to receive a GGA and RMC sentences within this time frame to publish a - location data. Set accordingly to the UART datarate and location - reporting frequency. Defaults to 500ms if unspecified. From b661d7209958ea0fbdd93f886459a22b65d0fb5f Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 27 Nov 2023 15:09:01 +0100 Subject: [PATCH 0500/2300] [nrf fromtree] modem: ppp: Implement TRANSMIT_IDLE event Implement TRANSMIT_IDLE event for modem_ppp module. This addition optimizes the sys workque CPU time when performing a throughput test from 36% to 5%, while only reducing the throughput by 12%. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit a9779eca400e67e2eebfc1f774eb4186efdc7a96) (cherry picked from commit 985a4fb0b68c38fe4d5e0470ac43e6dacb57c5fb) --- subsys/modem/modem_ppp.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/subsys/modem/modem_ppp.c b/subsys/modem/modem_ppp.c index 476926f4db3..1d47542f24a 100644 --- a/subsys/modem/modem_ppp.c +++ b/subsys/modem/modem_ppp.c @@ -314,8 +314,17 @@ static void modem_ppp_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_eve { struct modem_ppp *ppp = (struct modem_ppp *)user_data; - if (event == MODEM_PIPE_EVENT_RECEIVE_READY) { + switch (event) { + case MODEM_PIPE_EVENT_RECEIVE_READY: k_work_submit(&ppp->process_work); + break; + + case MODEM_PIPE_EVENT_TRANSMIT_IDLE: + k_work_submit(&ppp->send_work); + break; + + default: + break; } } @@ -351,22 +360,20 @@ static void modem_ppp_send_handler(struct k_work *item) } } - reserved_size = ring_buf_get_claim(&ppp->transmit_rb, &reserved, UINT32_MAX); - if (reserved_size == 0) { - ring_buf_get_finish(&ppp->transmit_rb, 0); - return; - } + while (!ring_buf_is_empty(&ppp->transmit_rb)) { + reserved_size = ring_buf_get_claim(&ppp->transmit_rb, &reserved, UINT32_MAX); + + ret = modem_pipe_transmit(ppp->pipe, reserved, reserved_size); + if (ret < 0) { + ring_buf_get_finish(&ppp->transmit_rb, 0); + break; + } - ret = modem_pipe_transmit(ppp->pipe, reserved, reserved_size); - if (ret < 0) { - ring_buf_get_finish(&ppp->transmit_rb, 0); - } else { ring_buf_get_finish(&ppp->transmit_rb, (uint32_t)ret); - } - /* Resubmit send work if data remains */ - if ((ring_buf_is_empty(&ppp->transmit_rb) == false) || (ppp->tx_pkt != NULL)) { - k_work_submit(&ppp->send_work); + if (ret < reserved_size) { + break; + } } } From c37b0b9efdb50868f21ec62e9d15ebd3fe24dbf7 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 19 Jan 2024 09:03:26 +0100 Subject: [PATCH 0501/2300] [nrf fromtree] tests: build_all: modem: Remove net tag and clean up Remove the net tag, allowing the modem driver tests to be built for PRs, and limit the scope of the test suite to only build for select emulated 32 and 64 bit boards. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 140a510030ef5cfc1feca9fc44249a2d2373cc01) (cherry picked from commit 8b904adc1559cd5a166d9cf04cd024a5b68cf6e9) --- .../build_all/modem/modem_cellular.conf | 6 +- .../drivers/build_all/modem/modem_esp_at.conf | 5 +- tests/drivers/build_all/modem/modem_gsm.conf | 5 +- .../build_all/modem/modem_gsm_mux.conf | 11 ++ .../modem/{modem.conf => modem_hl7800.conf} | 6 +- .../build_all/modem/modem_quectel_bg9x.conf | 6 +- .../build_all/modem/modem_simcom_sim7080.conf | 7 +- .../build_all/modem/modem_ublox_sara.conf | 6 +- tests/drivers/build_all/modem/prj.conf | 3 - tests/drivers/build_all/modem/testcase.yaml | 137 ++++++++---------- 10 files changed, 88 insertions(+), 104 deletions(-) create mode 100644 tests/drivers/build_all/modem/modem_gsm_mux.conf rename tests/drivers/build_all/modem/{modem.conf => modem_hl7800.conf} (79%) delete mode 100644 tests/drivers/build_all/modem/prj.conf diff --git a/tests/drivers/build_all/modem/modem_cellular.conf b/tests/drivers/build_all/modem/modem_cellular.conf index 3366fcf32d4..4582216f772 100644 --- a/tests/drivers/build_all/modem/modem_cellular.conf +++ b/tests/drivers/build_all/modem/modem_cellular.conf @@ -1,10 +1,8 @@ -CONFIG_TEST=y -CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_GPIO=y CONFIG_SERIAL=y +CONFIG_MODEM=y CONFIG_NETWORKING=y CONFIG_NET_L2_PPP=y -CONFIG_MODEM=y CONFIG_PM_DEVICE=y CONFIG_MODEM_CELLULAR=y CONFIG_UART_ASYNC_API=y -CONFIG_GPIO=y diff --git a/tests/drivers/build_all/modem/modem_esp_at.conf b/tests/drivers/build_all/modem/modem_esp_at.conf index 01d4b62ba50..6ba79c82653 100644 --- a/tests/drivers/build_all/modem/modem_esp_at.conf +++ b/tests/drivers/build_all/modem/modem_esp_at.conf @@ -1,7 +1,6 @@ -CONFIG_TEST=y -CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_SERIAL=y CONFIG_GPIO=y +CONFIG_SERIAL=y +CONFIG_MODEM=y CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y CONFIG_NET_IPV4=y diff --git a/tests/drivers/build_all/modem/modem_gsm.conf b/tests/drivers/build_all/modem/modem_gsm.conf index a7c4e492bc3..dd5b37afb9e 100644 --- a/tests/drivers/build_all/modem/modem_gsm.conf +++ b/tests/drivers/build_all/modem/modem_gsm.conf @@ -1,10 +1,9 @@ -CONFIG_TEST=y -CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_GPIO=y CONFIG_SERIAL=y +CONFIG_MODEM=y CONFIG_NETWORKING=y CONFIG_NET_IPV4=y CONFIG_NET_DRIVERS=y CONFIG_NET_PPP=y CONFIG_NET_L2_PPP=y -CONFIG_MODEM=y CONFIG_MODEM_GSM_PPP=y diff --git a/tests/drivers/build_all/modem/modem_gsm_mux.conf b/tests/drivers/build_all/modem/modem_gsm_mux.conf new file mode 100644 index 00000000000..952ace2466d --- /dev/null +++ b/tests/drivers/build_all/modem/modem_gsm_mux.conf @@ -0,0 +1,11 @@ +CONFIG_GPIO=y +CONFIG_SERIAL=y +CONFIG_MODEM=y +CONFIG_NETWORKING=y +CONFIG_NET_IPV4=y +CONFIG_NET_DRIVERS=y +CONFIG_NET_PPP=y +CONFIG_NET_L2_PPP=y +CONFIG_MODEM_GSM_PPP=y +CONFIG_GSM_MUX=y +CONFIG_UART_MUX=y diff --git a/tests/drivers/build_all/modem/modem.conf b/tests/drivers/build_all/modem/modem_hl7800.conf similarity index 79% rename from tests/drivers/build_all/modem/modem.conf rename to tests/drivers/build_all/modem/modem_hl7800.conf index 0143f6fcd7f..5cc44bb71ea 100644 --- a/tests/drivers/build_all/modem/modem.conf +++ b/tests/drivers/build_all/modem/modem_hl7800.conf @@ -1,10 +1,8 @@ -CONFIG_TEST=y -CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_TEST_USERSPACE=y +CONFIG_GPIO=y CONFIG_SERIAL=y +CONFIG_MODEM=y CONFIG_NETWORKING=y CONFIG_NET_IPV4=y -CONFIG_MODEM=y CONFIG_MODEM_HL7800=y CONFIG_MODEM_HL7800_FW_UPDATE=y CONFIG_MODEM_HL7800_SET_APN_NAME_ON_STARTUP=y diff --git a/tests/drivers/build_all/modem/modem_quectel_bg9x.conf b/tests/drivers/build_all/modem/modem_quectel_bg9x.conf index 9fb71bbe412..f868a0ef77a 100644 --- a/tests/drivers/build_all/modem/modem_quectel_bg9x.conf +++ b/tests/drivers/build_all/modem/modem_quectel_bg9x.conf @@ -1,9 +1,7 @@ -CONFIG_TEST=y -CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_SERIAL=y CONFIG_GPIO=y +CONFIG_SERIAL=y +CONFIG_MODEM=y CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y -CONFIG_MODEM=y CONFIG_MODEM_QUECTEL_BG9X=y CONFIG_MODEM_QUECTEL_BG9X_APN="hologram" diff --git a/tests/drivers/build_all/modem/modem_simcom_sim7080.conf b/tests/drivers/build_all/modem/modem_simcom_sim7080.conf index dc4645a2455..b6f1530f8a2 100644 --- a/tests/drivers/build_all/modem/modem_simcom_sim7080.conf +++ b/tests/drivers/build_all/modem/modem_simcom_sim7080.conf @@ -1,8 +1,7 @@ -CONFIG_TEST=y -CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_SERIAL=y CONFIG_GPIO=y +CONFIG_SERIAL=y +CONFIG_MODEM=y CONFIG_NETWORKING=y +CONFIG_GPIO=y CONFIG_NET_SOCKETS=y -CONFIG_MODEM=y CONFIG_MODEM_SIM7080=y diff --git a/tests/drivers/build_all/modem/modem_ublox_sara.conf b/tests/drivers/build_all/modem/modem_ublox_sara.conf index 21e61c8ec54..8cef947f051 100644 --- a/tests/drivers/build_all/modem/modem_ublox_sara.conf +++ b/tests/drivers/build_all/modem/modem_ublox_sara.conf @@ -1,8 +1,6 @@ -CONFIG_TEST=y -CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_SERIAL=y CONFIG_GPIO=y +CONFIG_SERIAL=y +CONFIG_MODEM=y CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y -CONFIG_MODEM=y CONFIG_MODEM_UBLOX_SARA=y diff --git a/tests/drivers/build_all/modem/prj.conf b/tests/drivers/build_all/modem/prj.conf deleted file mode 100644 index bb5ccbec1ba..00000000000 --- a/tests/drivers/build_all/modem/prj.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_TEST=y -CONFIG_TEST_USERSPACE=y -CONFIG_SERIAL=y diff --git a/tests/drivers/build_all/modem/testcase.yaml b/tests/drivers/build_all/modem/testcase.yaml index 25c338b9fda..303e0ee44e8 100644 --- a/tests/drivers/build_all/modem/testcase.yaml +++ b/tests/drivers/build_all/modem/testcase.yaml @@ -1,86 +1,73 @@ common: build_only: true - tags: - - drivers - - net - - modem + platform_allow: + - native_sim + - native_sim_64 + - qemu_x86 + - qemu_x86_64 + tests: - drivers.modem.build: - extra_args: CONF_FILE=modem.conf - platform_exclude: - - serpente - - particle_boron - - rak5010_nrf52840 - - litex_vexriscv - - ip_k66f - min_ram: 68 - min_flash: 115 - drivers.modem.ublox_sara.build: + drivers.modem.modem_hl7800.interrupt_driven.build: + extra_args: CONF_FILE=modem_hl7800.conf + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=y + drivers.modem.modem_hl7800.async.build: + extra_args: CONF_FILE=modem_hl7800.conf + extra_configs: + - CONFIG_UART_ASYNC_API=y + drivers.modem.modem_ublox_sara.interrupt_driven.build: extra_args: CONF_FILE=modem_ublox_sara.conf - platform_exclude: - - serpente - - pinnacle_100_dvk - - litex_vexriscv - - ip_k66f - - mg100 - drivers.modem.simcom_sim7080.build: - extra_args: CONF_FILE=modem_simcom_sim7080.conf - platform_exclude: - - serpente - - pinnacle_100_dvk - - litex_vexriscv - - ip_k66f - - mg100 - drivers.modem.quectel_bg9x.build: + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=y + drivers.modem.modem_ublox_sara.async.build: + extra_args: CONF_FILE=modem_ublox_sara.conf + extra_configs: + - CONFIG_UART_ASYNC_API=y + drivers.modem.modem_quectel_bg9x.interrupt_driven.build: extra_args: CONF_FILE=modem_quectel_bg9x.conf - platform_exclude: - - serpente - - pinnacle_100_dvk - - litex_vexriscv - - ip_k66f - - mg100 - min_ram: 36 - drivers.modem.gsm.build: + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=y + drivers.modem.modem_quectel_bg9x.async.build: + extra_args: CONF_FILE=modem_quectel_bg9x.conf + extra_configs: + - CONFIG_UART_ASYNC_API=y + drivers.modem.modem_gsm.interrupt_driven.build: extra_args: CONF_FILE=modem_gsm.conf - platform_exclude: - - serpente - - particle_boron - - rak5010_nrf52840 - - litex_vexriscv - - ip_k66f - min_ram: 36 - drivers.modem.gsm_mux.build: + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=y + drivers.modem.modem_gsm.async.build: extra_args: CONF_FILE=modem_gsm.conf - platform_exclude: - - serpente - - particle_boron - - rak5010_nrf52840 - - litex_vexriscv - - ip_k66f - min_ram: 36 - extra_configs: - - CONFIG_GSM_MUX=y - - CONFIG_UART_MUX=y - drivers.modem.esp_at.build: + extra_configs: + - CONFIG_UART_ASYNC_API=y + drivers.modem.modem_gsm_mux.interrupt_driven.build: + extra_args: CONF_FILE=modem_gsm_mux.conf + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=y + drivers.modem.modem_gsm_mux.async.build: + extra_args: CONF_FILE=modem_gsm_mux.conf + extra_configs: + - CONFIG_UART_ASYNC_API=y + drivers.modem.modem_esp_at.interrupt_driven.build: extra_args: CONF_FILE=modem_esp_at.conf - platform_exclude: - - ip_k66f - - cy8cproto_062_4343w - filter: CONFIG_SERIAL - min_ram: 36 - drivers.modem.esp_at.async.build: + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=y + drivers.modem.modem_esp_at.async.build: extra_args: CONF_FILE=modem_esp_at.conf - filter: CONFIG_SERIAL and CONFIG_QEMU_TARGET - min_ram: 36 extra_configs: - - CONFIG_MODEM_IFACE_UART_ASYNC=y - drivers.modem.modem_cellular.build: + - CONFIG_UART_ASYNC_API=y + drivers.modem.modem_cellular.interrupt_driven.build: + extra_args: CONF_FILE=modem_cellular.conf + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=y + drivers.modem.modem_cellular.async.build: extra_args: CONF_FILE=modem_cellular.conf - platform_allow: - - native_posix_64 - - native_posix - - native_sim_64 - - native_sim - - qemu_x86 - - qemu_x86_64 - min_ram: 36 + extra_configs: + - CONFIG_UART_ASYNC_API=y + drivers.modem.modem_simcom_sim7080.interrupt_driven.build: + extra_args: CONF_FILE=modem_simcom_sim7080.conf + extra_configs: + - CONFIG_UART_INTERRUPT_DRIVEN=y + drivers.modem.modem_simcom_sim7080.async.build: + extra_args: CONF_FILE=modem_simcom_sim7080.conf + extra_configs: + - CONFIG_UART_ASYNC_API=y From 2dc90d9e7d6d3aff63d1c325d910368b3ba15ea8 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Mon, 22 Jan 2024 15:33:13 +0700 Subject: [PATCH 0502/2300] [nrf fromtree] drivers: gnss: quectel_lcx6g: fix compilation error when CONFIG_PM_DEVICE=y Fixes a compilation error in quectel_lcx6g driver when CONFIG_PM_DEVICE=y. Corrects the function call in quectel_lcx6g_suspend from 'modem_chat_run_script_run' to 'modem_chat_run_script'. Signed-off-by: Pisit Sawangvonganan (cherry picked from commit 78faf5eb8e5c1f79dc7afd3183a4d969b3b7b146) (cherry picked from commit 40489905c63a629e83e4ec440706849ece242320) --- drivers/gnss/gnss_quectel_lcx6g.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index f7b29b4640d..61d39140a9a 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -211,7 +211,7 @@ static int quectel_lcx6g_suspend(const struct device *dev) struct quectel_lcx6g_data *data = dev->data; int ret; - ret = modem_chat_run_script_run(&data->chat, &suspend_script); + ret = modem_chat_run_script(&data->chat, &suspend_script); if (ret < 0) { modem_pipe_close(data->uart_pipe); } From 606f754cf2a1c71cdd25a1028be3f5cebfc84590 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 15 Jan 2024 10:19:29 +0100 Subject: [PATCH 0503/2300] [nrf fromtree] modem: chat: remove receive and transmit timeouts Remove receive and transmit timeouts which are no longer useful as the RECEIVE_READY and TRANSMIT_IDLE events will be used to efficiently manage timeouts between transmit/receive calls. Then update the the in-tree drivers using the modem_chat module to omit the process timeout parameter. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 27b0d4e3fee2f56413757e13a3fcd522e9447921) (cherry picked from commit 65fecdaf9f29d3043064f42da0d153c8241435b5) --- drivers/gnss/gnss_nmea_generic.c | 1 - drivers/gnss/gnss_quectel_lcx6g.c | 1 - drivers/modem/modem_cellular.c | 1 - include/zephyr/modem/chat.h | 7 ++---- subsys/modem/modem_chat.c | 27 +++++++++++------------- tests/subsys/modem/modem_chat/src/main.c | 1 - 6 files changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/gnss/gnss_nmea_generic.c b/drivers/gnss/gnss_nmea_generic.c index 6d9adfb6990..2f23f4d7353 100644 --- a/drivers/gnss/gnss_nmea_generic.c +++ b/drivers/gnss/gnss_nmea_generic.c @@ -127,7 +127,6 @@ static int gnss_nmea_generic_init_chat(const struct device *dev) .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, .unsol_matches_size = ARRAY_SIZE(unsol_matches), - .process_timeout = K_MSEC(2), }; return modem_chat_init(&data->chat, &chat_config); diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 61d39140a9a..9c706e237a3 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -686,7 +686,6 @@ static int quectel_lcx6g_init_chat(const struct device *dev) .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, .unsol_matches_size = ARRAY_SIZE(unsol_matches), - .process_timeout = K_MSEC(2), }; return modem_chat_init(&data->chat, &chat_config); diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index d1f3a69c94e..8aca855f55b 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1520,7 +1520,6 @@ static int modem_cellular_init(const struct device *dev) .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, .unsol_matches_size = ARRAY_SIZE(unsol_matches), - .process_timeout = K_MSEC(2), }; modem_chat_init(&data->chat, &chat_config); diff --git a/include/zephyr/modem/chat.h b/include/zephyr/modem/chat.h index d46ffc7c24a..7079cb8c61d 100644 --- a/include/zephyr/modem/chat.h +++ b/include/zephyr/modem/chat.h @@ -242,7 +242,7 @@ struct modem_chat { /* Script sending */ uint16_t script_send_request_pos; uint16_t script_send_delimiter_pos; - struct k_work_delayable script_send_work; + struct k_work script_send_work; struct k_work_delayable script_send_timeout_work; /* Match parsing */ @@ -252,8 +252,7 @@ struct modem_chat { uint16_t parse_match_type; /* Process received data */ - struct k_work_delayable process_work; - k_timeout_t process_timeout; + struct k_work receive_work; }; /** @@ -282,8 +281,6 @@ struct modem_chat_config { const struct modem_chat_match *unsol_matches; /** Elements in array of unsolicited matches */ uint16_t unsol_matches_size; - /** Delay from receive ready event to pipe receive occurs */ - k_timeout_t process_timeout; }; /** diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index f3857bcfbc3..99cf9bdbfa6 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -97,7 +97,7 @@ static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_scri /* Cancel work */ k_work_cancel_delayable(&chat->script_timeout_work); - k_work_cancel_delayable(&chat->script_send_work); + k_work_cancel(&chat->script_send_work); k_work_cancel_delayable(&chat->script_send_timeout_work); /* Clear script running state */ @@ -117,7 +117,7 @@ static void modem_chat_script_send(struct modem_chat *chat) chat->script_send_delimiter_pos = 0; /* Schedule script send work */ - k_work_schedule(&chat->script_send_work, K_NO_WAIT); + k_work_submit(&chat->script_send_work); } static void modem_chat_script_set_response_matches(struct modem_chat *chat) @@ -308,8 +308,7 @@ static uint16_t modem_chat_script_chat_get_send_timeout(struct modem_chat *chat) static void modem_chat_script_send_handler(struct k_work *item) { - struct k_work_delayable *dwork = k_work_delayable_from_work(item); - struct modem_chat *chat = CONTAINER_OF(dwork, struct modem_chat, script_send_work); + struct modem_chat *chat = CONTAINER_OF(item, struct modem_chat, script_send_work); uint16_t timeout; /* Validate script running */ @@ -319,13 +318,13 @@ static void modem_chat_script_send_handler(struct k_work *item) /* Send request */ if (modem_chat_script_send_request(chat) == false) { - k_work_schedule(&chat->script_send_work, chat->process_timeout); + k_work_submit(&chat->script_send_work); return; } /* Send delimiter */ if (modem_chat_script_send_delimiter(chat) == false) { - k_work_schedule(&chat->script_send_work, chat->process_timeout); + k_work_submit(&chat->script_send_work); return; } @@ -687,8 +686,7 @@ static void modem_chat_process_bytes(struct modem_chat *chat) static void modem_chat_process_handler(struct k_work *item) { - struct k_work_delayable *dwork = k_work_delayable_from_work(item); - struct modem_chat *chat = CONTAINER_OF(dwork, struct modem_chat, process_work); + struct modem_chat *chat = CONTAINER_OF(item, struct modem_chat, receive_work); int ret; /* Fill work buffer */ @@ -702,7 +700,7 @@ static void modem_chat_process_handler(struct k_work *item) /* Process data */ modem_chat_process_bytes(chat); - k_work_schedule(&chat->process_work, K_NO_WAIT); + k_work_submit(&chat->receive_work); } static void modem_chat_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_event event, @@ -711,7 +709,7 @@ static void modem_chat_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_ev struct modem_chat *chat = (struct modem_chat *)user_data; if (event == MODEM_PIPE_EVENT_RECEIVE_READY) { - k_work_schedule(&chat->process_work, chat->process_timeout); + k_work_submit(&chat->receive_work); } } @@ -741,14 +739,13 @@ int modem_chat_init(struct modem_chat *chat, const struct modem_chat_config *con chat->filter_size = config->filter_size; chat->matches[MODEM_CHAT_MATCHES_INDEX_UNSOL] = config->unsol_matches; chat->matches_size[MODEM_CHAT_MATCHES_INDEX_UNSOL] = config->unsol_matches_size; - chat->process_timeout = config->process_timeout; atomic_set(&chat->script_state, 0); k_sem_init(&chat->script_stopped_sem, 0, 1); - k_work_init_delayable(&chat->process_work, modem_chat_process_handler); + k_work_init(&chat->receive_work, modem_chat_process_handler); k_work_init(&chat->script_run_work, modem_chat_script_run_handler); k_work_init_delayable(&chat->script_timeout_work, modem_chat_script_timeout_handler); k_work_init(&chat->script_abort_work, modem_chat_script_abort_handler); - k_work_init_delayable(&chat->script_send_work, modem_chat_script_send_handler); + k_work_init(&chat->script_send_work, modem_chat_script_send_handler); k_work_init_delayable(&chat->script_send_timeout_work, modem_chat_script_send_timeout_handler); @@ -831,8 +828,8 @@ void modem_chat_release(struct modem_chat *chat) k_work_cancel_sync(&chat->script_run_work, &sync); k_work_cancel_sync(&chat->script_abort_work, &sync); - k_work_cancel_delayable_sync(&chat->process_work, &sync); - k_work_cancel_delayable_sync(&chat->script_send_work, &sync); + k_work_cancel_sync(&chat->receive_work, &sync); + k_work_cancel_sync(&chat->script_send_work, &sync); chat->pipe = NULL; chat->receive_buf_len = 0; diff --git a/tests/subsys/modem/modem_chat/src/main.c b/tests/subsys/modem/modem_chat/src/main.c index 3f1ef57754d..f9a37ecc6cc 100644 --- a/tests/subsys/modem/modem_chat/src/main.c +++ b/tests/subsys/modem/modem_chat/src/main.c @@ -254,7 +254,6 @@ static void *test_modem_chat_setup(void) .argv_size = ARRAY_SIZE(cmd_argv), .unsol_matches = unsol_matches, .unsol_matches_size = ARRAY_SIZE(unsol_matches), - .process_timeout = K_MSEC(2), }; zassert(modem_chat_init(&cmd, &cmd_config) == 0, "Failed to init modem CMD"); From cfe7d6d9f94f535412a4616a528a4cfb823a641c Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 15 Jan 2024 14:29:48 +0100 Subject: [PATCH 0504/2300] [nrf fromtree] modem: chat: Implement TRANSMIT_IDLE event Refactors modem chat module to use TRANSMIT_IDLE event instead of polling when transmitting, cleaning up the transmit handler by combining duplicate code and using an internal state instead of multiple iterators to track send state. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit d801e697ddd1b0a3ae3df14f66c1d3a8f646d79b) (cherry picked from commit 79b90e6ca8dd2d5e1ed6f24ef4b74119c0f314c3) --- include/zephyr/modem/chat.h | 4 +- subsys/modem/modem_chat.c | 153 ++++++++++++++++-------------------- 2 files changed, 71 insertions(+), 86 deletions(-) diff --git a/include/zephyr/modem/chat.h b/include/zephyr/modem/chat.h index 7079cb8c61d..28a2bc6bf9f 100644 --- a/include/zephyr/modem/chat.h +++ b/include/zephyr/modem/chat.h @@ -240,8 +240,8 @@ struct modem_chat { struct k_sem script_stopped_sem; /* Script sending */ - uint16_t script_send_request_pos; - uint16_t script_send_delimiter_pos; + enum modem_chat_script_send_state script_send_state; + uint16_t script_send_pos; struct k_work script_send_work; struct k_work_delayable script_send_timeout_work; diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index 99cf9bdbfa6..b2d63b05e9e 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -110,13 +110,16 @@ static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_scri k_sem_give(&chat->script_stopped_sem); } -static void modem_chat_script_send(struct modem_chat *chat) +static void modem_chat_set_script_send_state(struct modem_chat *chat, + enum modem_chat_script_send_state state) { - /* Initialize script send work */ - chat->script_send_request_pos = 0; - chat->script_send_delimiter_pos = 0; + chat->script_send_pos = 0; + chat->script_send_state = state; +} - /* Schedule script send work */ +static void modem_chat_script_send(struct modem_chat *chat) +{ + modem_chat_set_script_send_state(chat, MODEM_CHAT_SCRIPT_SEND_STATE_REQUEST); k_work_submit(&chat->script_send_work); } @@ -219,91 +222,58 @@ static void modem_chat_script_abort_handler(struct k_work *item) modem_chat_script_stop(chat, MODEM_CHAT_SCRIPT_RESULT_ABORT); } -static bool modem_chat_script_send_request(struct modem_chat *chat) +static bool modem_chat_script_chat_is_no_response(struct modem_chat *chat) { const struct modem_chat_script_chat *script_chat = &chat->script->script_chats[chat->script_chat_it]; - uint8_t *script_chat_request_start; - uint16_t script_chat_request_remaining; - int ret; - - /* Validate data to send */ - if (script_chat->request_size == chat->script_send_request_pos) { - return true; - } - - script_chat_request_start = (uint8_t *)&script_chat->request[chat->script_send_request_pos]; - script_chat_request_remaining = script_chat->request_size - chat->script_send_request_pos; - - /* Send data through pipe */ - ret = modem_pipe_transmit(chat->pipe, script_chat_request_start, - script_chat_request_remaining); - - /* Validate transmit successful */ - if (ret < 1) { - return false; - } - - /* Update script send position */ - chat->script_send_request_pos += (uint16_t)ret; + return (script_chat->response_matches_size == 0) ? true : false; +} - /* Check if data remains */ - if (chat->script_send_request_pos < script_chat->request_size) { - return false; - } +static uint16_t modem_chat_script_chat_get_send_timeout(struct modem_chat *chat) +{ + const struct modem_chat_script_chat *script_chat = + &chat->script->script_chats[chat->script_chat_it]; - return true; + return script_chat->timeout; } -static bool modem_chat_script_send_delimiter(struct modem_chat *chat) +/* Returns true when request part has been sent */ +static bool modem_chat_send_script_request_part(struct modem_chat *chat) { - uint8_t *script_chat_delimiter_start; - uint8_t script_chat_delimiter_remaining; - int ret; + const struct modem_chat_script_chat *script_chat = + &chat->script->script_chats[chat->script_chat_it]; - /* Validate data to send */ - if (chat->delimiter_size == chat->script_send_delimiter_pos) { - return true; - } + uint8_t *request_part; + uint16_t request_size; + uint16_t request_part_size; + int ret; - script_chat_delimiter_start = (uint8_t *)&chat->delimiter[chat->script_send_delimiter_pos]; - script_chat_delimiter_remaining = chat->delimiter_size - chat->script_send_delimiter_pos; + switch (chat->script_send_state) { + case MODEM_CHAT_SCRIPT_SEND_STATE_REQUEST: + request_part = (uint8_t *)(&script_chat->request[chat->script_send_pos]); + request_size = script_chat->request_size; + break; - /* Send data through pipe */ - ret = modem_pipe_transmit(chat->pipe, script_chat_delimiter_start, - script_chat_delimiter_remaining); + case MODEM_CHAT_SCRIPT_SEND_STATE_DELIMITER: + request_part = (uint8_t *)(&chat->delimiter[chat->script_send_pos]); + request_size = chat->delimiter_size; + break; - /* Validate transmit successful */ - if (ret < 1) { + default: return false; } - /* Update script send position */ - chat->script_send_delimiter_pos += (uint8_t)ret; - - /* Check if data remains */ - if (chat->script_send_delimiter_pos < chat->delimiter_size) { + request_part_size = request_size - chat->script_send_pos; + ret = modem_pipe_transmit(chat->pipe, request_part, request_part_size); + if (ret < 1) { return false; } - return true; -} - -static bool modem_chat_script_chat_is_no_response(struct modem_chat *chat) -{ - const struct modem_chat_script_chat *script_chat = - &chat->script->script_chats[chat->script_chat_it]; - - return (script_chat->response_matches_size == 0) ? true : false; -} + chat->script_send_pos += (uint16_t)ret; -static uint16_t modem_chat_script_chat_get_send_timeout(struct modem_chat *chat) -{ - const struct modem_chat_script_chat *script_chat = - &chat->script->script_chats[chat->script_chat_it]; - - return script_chat->timeout; + /* Return true if all data was sent */ + return request_size <= chat->script_send_pos; } static void modem_chat_script_send_handler(struct k_work *item) @@ -311,27 +281,33 @@ static void modem_chat_script_send_handler(struct k_work *item) struct modem_chat *chat = CONTAINER_OF(item, struct modem_chat, script_send_work); uint16_t timeout; - /* Validate script running */ if (chat->script == NULL) { return; } - /* Send request */ - if (modem_chat_script_send_request(chat) == false) { - k_work_submit(&chat->script_send_work); + switch (chat->script_send_state) { + case MODEM_CHAT_SCRIPT_SEND_STATE_IDLE: return; - } - /* Send delimiter */ - if (modem_chat_script_send_delimiter(chat) == false) { - k_work_submit(&chat->script_send_work); - return; + case MODEM_CHAT_SCRIPT_SEND_STATE_REQUEST: + if (!modem_chat_send_script_request_part(chat)) { + return; + } + + modem_chat_set_script_send_state(chat, MODEM_CHAT_SCRIPT_SEND_STATE_DELIMITER); + __fallthrough; + + case MODEM_CHAT_SCRIPT_SEND_STATE_DELIMITER: + if (!modem_chat_send_script_request_part(chat)) { + return; + } + + modem_chat_set_script_send_state(chat, MODEM_CHAT_SCRIPT_SEND_STATE_IDLE); + break; } - /* Check if script command is no response */ if (modem_chat_script_chat_is_no_response(chat)) { timeout = modem_chat_script_chat_get_send_timeout(chat); - if (timeout == 0) { modem_chat_script_next(chat, false); } else { @@ -708,8 +684,17 @@ static void modem_chat_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_ev { struct modem_chat *chat = (struct modem_chat *)user_data; - if (event == MODEM_PIPE_EVENT_RECEIVE_READY) { + switch (event) { + case MODEM_PIPE_EVENT_RECEIVE_READY: k_work_submit(&chat->receive_work); + break; + + case MODEM_PIPE_EVENT_TRANSMIT_IDLE: + k_work_submit(&chat->script_send_work); + break; + + default: + break; } } @@ -840,8 +825,8 @@ void modem_chat_release(struct modem_chat *chat) atomic_set(&chat->script_state, 0); chat->script_result = MODEM_CHAT_SCRIPT_RESULT_ABORT; k_sem_reset(&chat->script_stopped_sem); - chat->script_send_request_pos = 0; - chat->script_send_delimiter_pos = 0; + chat->script_send_state = MODEM_CHAT_SCRIPT_SEND_STATE_IDLE; + chat->script_send_pos = 0; chat->parse_match = NULL; chat->parse_match_len = 0; chat->parse_arg_len = 0; From 9bd8e18d1bffa65deb2c676630961ec859addb9d Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 28 Dec 2023 17:31:10 +0100 Subject: [PATCH 0505/2300] [nrf fromtree] tests modem/backends/tty: Define _XOPEN_SOURCE This test uses functions which are extensions to the C library. Let's explicity select one of the extensions which includes it instead of relaying on somebody having set it for this file somewhere else. (Note this test is exclusive to native targets) Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 68c3a9ba4618698233578469c07fb35f0fa41841) (cherry picked from commit ee6ff8ebb13606f4e913e7a0b60b6f41ff579d9e) --- tests/subsys/modem/backends/tty/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/modem/backends/tty/CMakeLists.txt b/tests/subsys/modem/backends/tty/CMakeLists.txt index e692be0de90..44597d8ae95 100644 --- a/tests/subsys/modem/backends/tty/CMakeLists.txt +++ b/tests/subsys/modem/backends/tty/CMakeLists.txt @@ -6,3 +6,4 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(modem_backend_tty_test) target_sources(app PRIVATE src/main.c) +target_compile_definitions(app PRIVATE _XOPEN_SOURCE=600) From f4fcf95f5bc120a63eb3a85d1bb5a38ebef0748f Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 24 Jan 2024 08:48:30 +0100 Subject: [PATCH 0506/2300] [nrf fromtree] drivers: gnss: lcx6g: Remove left over from testing The k_msleep() removed with this has no utility. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit a9ffd91294fc8d0cc29c20136bd2e986daa86af6) (cherry picked from commit 299d77ecd474917c74062f1287b30c18dcb71214) --- drivers/gnss/gnss_quectel_lcx6g.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 9c706e237a3..8ab3b26a6d9 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -195,8 +195,6 @@ static int quectel_lcx6g_resume(const struct device *dev) return ret; } - k_msleep(1000); - ret = quectel_lcx6g_configure_pps(dev); if (ret < 0) { modem_pipe_close(data->uart_pipe); From 258622482edef3bb2621a991df26cbcd785a2490 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 24 Jan 2024 09:06:26 +0100 Subject: [PATCH 0507/2300] [nrf fromtree] drivers: gnss: lcx7g: Refactor power management The implementation of power management did not account for being on a power domain when initializing, and handling being powered on and off at runtime. The GNSS requires time to start up, which it always does when powered on, before accepting commands. It also requires time after resuming and suspending before accepting commands. This commit implements this timeout, and improves logging to make the power management more transparent, and removes some redundant parenthesis for better readability. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 59b9a86f30af343c16bc2f7b35d328fe91e5e718) (cherry picked from commit 66ac3d1a00b00acc63b07ac8138fb8a7a4e980ce) --- drivers/gnss/gnss_quectel_lcx6g.c | 91 +++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 24 deletions(-) diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 8ab3b26a6d9..30919f963ac 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -22,20 +22,18 @@ #include LOG_MODULE_REGISTER(quectel_lcx6g, CONFIG_GNSS_LOG_LEVEL); -#define QUECTEL_LCX6G_STARTUP_DELAY (K_MSEC(300U)) -#define QUECTEL_LCX6G_STATE_CHANGE_DELAY_MSEC (300LL) -#define QUECTEL_LCX6G_PAIR_TIMEOUT (K_SECONDS(11)) -#define QUECTEL_LCX6G_SCRIPT_TIMEOUT_S (10U) +#define QUECTEL_LCX6G_PM_TIMEOUT_MS 500U +#define QUECTEL_LCX6G_SCRIPT_TIMEOUT_S 10U -#define QUECTEL_LCX6G_PAIR_NAV_MODE_STATIONARY (4) -#define QUECTEL_LCX6G_PAIR_NAV_MODE_FITNESS (1) -#define QUECTEL_LCX6G_PAIR_NAV_MODE_NORMAL (0) -#define QUECTEL_LCX6G_PAIR_NAV_MODE_DRONE (5) +#define QUECTEL_LCX6G_PAIR_NAV_MODE_STATIONARY 4 +#define QUECTEL_LCX6G_PAIR_NAV_MODE_FITNESS 1 +#define QUECTEL_LCX6G_PAIR_NAV_MODE_NORMAL 0 +#define QUECTEL_LCX6G_PAIR_NAV_MODE_DRONE 5 -#define QUECTEL_LCX6G_PAIR_PPS_MODE_DISABLED (0) -#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED (4) -#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED_AFTER_LOCK (1) -#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED_WHILE_LOCKED (2) +#define QUECTEL_LCX6G_PAIR_PPS_MODE_DISABLED 0 +#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED 4 +#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED_AFTER_LOCK 1 +#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED_WHILE_LOCKED 2 struct quectel_lcx6g_config { const struct device *uart; @@ -77,6 +75,7 @@ struct quectel_lcx6g_data { }; struct k_spinlock lock; + k_timeout_t pm_timeout; }; #define MODEM_CHAT_SCRIPT_NO_ABORT_DEFINE(_sym, _script_chats, _callback, _timeout) \ @@ -173,33 +172,60 @@ static int quectel_lcx6g_configure_pps(const struct device *dev) return modem_chat_run_script(&data->chat, &data->dynamic_script); } +static void quectel_lcx6g_pm_changed(const struct device *dev) +{ + struct quectel_lcx6g_data *data = dev->data; + uint32_t pm_ready_at_ms; + + pm_ready_at_ms = k_uptime_get() + QUECTEL_LCX6G_PM_TIMEOUT_MS; + data->pm_timeout = K_TIMEOUT_ABS_MS(pm_ready_at_ms); +} + +static void quectel_lcx6g_await_pm_ready(const struct device *dev) +{ + struct quectel_lcx6g_data *data = dev->data; + + LOG_INF("Waiting until PM ready"); + k_sleep(data->pm_timeout); +} + static int quectel_lcx6g_resume(const struct device *dev) { struct quectel_lcx6g_data *data = dev->data; int ret; + LOG_INF("Resuming"); + + quectel_lcx6g_await_pm_ready(dev); + ret = modem_pipe_open(data->uart_pipe); if (ret < 0) { + LOG_ERR("Failed to open pipe"); return ret; } ret = modem_chat_attach(&data->chat, data->uart_pipe); if (ret < 0) { + LOG_ERR("Failed to attach chat"); modem_pipe_close(data->uart_pipe); return ret; } ret = modem_chat_run_script(&data->chat, &resume_script); if (ret < 0) { + LOG_ERR("Failed to initialize GNSS"); modem_pipe_close(data->uart_pipe); return ret; } ret = quectel_lcx6g_configure_pps(dev); if (ret < 0) { + LOG_ERR("Failed to configure PPS"); modem_pipe_close(data->uart_pipe); + return ret; } + LOG_INF("Resumed"); return ret; } @@ -209,18 +235,32 @@ static int quectel_lcx6g_suspend(const struct device *dev) struct quectel_lcx6g_data *data = dev->data; int ret; + LOG_INF("Suspending"); + + quectel_lcx6g_await_pm_ready(dev); + ret = modem_chat_run_script(&data->chat, &suspend_script); if (ret < 0) { + LOG_ERR("Failed to suspend GNSS"); modem_pipe_close(data->uart_pipe); + return ret; } + LOG_INF("Suspended"); return ret; } +static void quectel_lcx6g_turn_on(const struct device *dev) +{ + LOG_INF("Powered on"); +} + static int quectel_lcx6g_turn_off(const struct device *dev) { struct quectel_lcx6g_data *data = dev->data; + LOG_INF("Powered off"); + return modem_pipe_close(data->uart_pipe); } @@ -242,6 +282,7 @@ static int quectel_lcx6g_pm_action(const struct device *dev, enum pm_device_acti break; case PM_DEVICE_ACTION_TURN_ON: + quectel_lcx6g_turn_on(dev); ret = 0; break; @@ -253,6 +294,8 @@ static int quectel_lcx6g_pm_action(const struct device *dev, enum pm_device_acti break; } + quectel_lcx6g_pm_changed(dev); + k_spin_unlock(&data->lock, key); return ret; } @@ -717,7 +760,6 @@ static int quectel_lcx6g_init(const struct device *dev) { int ret; - LOG_INF("Initializing Quectel LCX6G"); ret = quectel_lcx6g_init_nmea0183_match(dev); if (ret < 0) { return ret; @@ -732,18 +774,19 @@ static int quectel_lcx6g_init(const struct device *dev) quectel_lcx6g_init_dynamic_script(dev); -#ifdef CONFIG_PM_DEVICE_RUNTIME - pm_device_init_suspended(dev); -#else - LOG_INF("Resuming Quectel LCX6G"); - ret = quectel_lcx6g_resume(dev); - if (ret < 0) { - LOG_ERR("Failed to resume Quectel LCX6G"); - return ret; + quectel_lcx6g_pm_changed(dev); + + if (pm_device_is_powered(dev)) { + ret = quectel_lcx6g_resume(dev); + if (ret < 0) { + return ret; + } + quectel_lcx6g_pm_changed(dev); + } else { + pm_device_init_off(dev); } -#endif - LOG_INF("Quectel LCX6G initialized"); - return 0; + + return pm_device_runtime_enable(dev); } #define LCX6G_INST_NAME(inst, name) \ From 2d52fd091371773527579ea5846dd28939512e9d Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 24 Jan 2024 10:16:09 +0100 Subject: [PATCH 0508/2300] [nrf fromtree] drivers: gnss: lcx7g: Close pipe on suspend The pipe should be closed when suspended, both to save ressources and to flush it. Without flushing the pipe, the driver may fail to either resume or suspend the GNSS as the chat module starts processing old data, which can contain acks to commands, breaking the scripts. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 41240f9fb1074ec4cf7d486a86b8062e2a7e39ed) (cherry picked from commit 98a6793b39341c383e8dc72703ce66195d6dd34f) --- drivers/gnss/gnss_quectel_lcx6g.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 30919f963ac..ee15a573ffe 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -242,11 +242,11 @@ static int quectel_lcx6g_suspend(const struct device *dev) ret = modem_chat_run_script(&data->chat, &suspend_script); if (ret < 0) { LOG_ERR("Failed to suspend GNSS"); - modem_pipe_close(data->uart_pipe); - return ret; + } else { + LOG_INF("Suspended"); } - LOG_INF("Suspended"); + modem_pipe_close(data->uart_pipe); return ret; } From a3e53fb2841a3518c48ecdae188fdb1ed7069db4 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 24 Jan 2024 10:39:29 +0100 Subject: [PATCH 0509/2300] [nrf fromtree] drivers: gnss: lcx7g: Add Kconfigs for configurable buffers Added Kconfigs to define the size of: - UART backend receive buffer - UART backend transmit buffer - Satellites array size and increased the UART RX buffer size a default to 256 as 128 is just on the edge of to small at a baudrate of 115200. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 98d95851c6778e86fca22dec3314fcd756ae25a9) (cherry picked from commit d6aa22362121fc7d2d7ab34dcb29a97e9f1768a0) --- drivers/gnss/Kconfig.quectel_lcx6g | 20 ++++++++++++++++++++ drivers/gnss/gnss_quectel_lcx6g.c | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/gnss/Kconfig.quectel_lcx6g b/drivers/gnss/Kconfig.quectel_lcx6g index 6736015aed7..3036f76d05b 100644 --- a/drivers/gnss/Kconfig.quectel_lcx6g +++ b/drivers/gnss/Kconfig.quectel_lcx6g @@ -15,3 +15,23 @@ config GNSS_QUECTEL_LCX6G select GNSS_NMEA0183_MATCH help Enable quectel LCX6G series GNSS modem driver. + +if GNSS_QUECTEL_LCX6G + +config GNSS_QUECTEL_LCX6G_UART_RX_BUF_SIZE + int "Size of UART backend receive buffer" + default 256 + +config GNSS_QUECTEL_LCX6G_UART_TX_BUF_SIZE + int "Size of UART backend transmit buffer" + default 64 + +if GNSS_SATELLITES + +config GNSS_QUECTEL_LCX6G_SAT_ARRAY_SIZE + int "Size of GNSS satellites array" + default 24 + +endif # GNSS_SATELLITES + +endif # GNSS_QUECTEL_LCX6G diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index ee15a573ffe..09fa8fd8e4a 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -44,14 +44,14 @@ struct quectel_lcx6g_config { struct quectel_lcx6g_data { struct gnss_nmea0183_match_data match_data; #if CONFIG_GNSS_SATELLITES - struct gnss_satellite satellites[24]; + struct gnss_satellite satellites[CONFIG_GNSS_QUECTEL_LCX6G_SAT_ARRAY_SIZE]; #endif /* UART backend */ struct modem_pipe *uart_pipe; struct modem_backend_uart uart_backend; - uint8_t uart_backend_receive_buf[128]; - uint8_t uart_backend_transmit_buf[64]; + uint8_t uart_backend_receive_buf[CONFIG_GNSS_QUECTEL_LCX6G_UART_RX_BUF_SIZE]; + uint8_t uart_backend_transmit_buf[CONFIG_GNSS_QUECTEL_LCX6G_UART_TX_BUF_SIZE]; /* Modem chat */ struct modem_chat chat; From cc0433b81c54c58c658187f0d9b5eb0f180d80c0 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sat, 27 Jan 2024 13:15:39 +1000 Subject: [PATCH 0510/2300] [nrf fromtree] tests: build_all: modem: test compilation with connectivity Ensure WiFi modems still build with the `CONNECTIVITY_WIFI_MGMT` connectivity backend enabled. Signed-off-by: Jordan Yates (cherry picked from commit 651ffb1d0687e2b197110f8aa7c92c42dee21a47) (cherry picked from commit 4c676acc03dd7daaa24b11a549e9b81fb70b6f1f) --- tests/drivers/build_all/modem/modem_esp_at.conf | 2 ++ tests/drivers/build_all/modem/src/main.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/tests/drivers/build_all/modem/modem_esp_at.conf b/tests/drivers/build_all/modem/modem_esp_at.conf index 6ba79c82653..e24bee337af 100644 --- a/tests/drivers/build_all/modem/modem_esp_at.conf +++ b/tests/drivers/build_all/modem/modem_esp_at.conf @@ -5,3 +5,5 @@ CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y CONFIG_NET_IPV4=y CONFIG_WIFI=y +CONFIG_NET_CONNECTION_MANAGER=y +CONFIG_NET_CONNECTION_MANAGER_CONNECTIVITY_WIFI_MGMT=y diff --git a/tests/drivers/build_all/modem/src/main.c b/tests/drivers/build_all/modem/src/main.c index 90b910a7799..527f64e3f1e 100644 --- a/tests/drivers/build_all/modem/src/main.c +++ b/tests/drivers/build_all/modem/src/main.c @@ -8,3 +8,15 @@ int main(void) { return 0; } + +#ifdef CONFIG_CONNECTIVITY_WIFI_MGMT_APPLICATION + +#include +#include + +/* Bind L2 connectity APIs. */ +static struct conn_mgr_conn_api conn_api = { 0 }; + +CONN_MGR_CONN_DEFINE(CONNECTIVITY_WIFI_MGMT, &conn_api); + +#endif /* CONFIG_CONNECTIVITY_WIFI_MGMT_APPLICATION */ From 1561f544e4e97598c5727409aa838f1bd0a62d3f Mon Sep 17 00:00:00 2001 From: Parthiban Nallathambi Date: Mon, 5 Feb 2024 16:15:18 +0530 Subject: [PATCH 0511/2300] [nrf fromtree] modem: change log level of events prints to debug info level is printed always to console and it's noisy. Change to debug level, which can be enabled with CONFIG_MODEM_MODULES_LOG_LEVEL_DBG Signed-off-by: Parthiban Nallathambi (cherry picked from commit fd85021718d1dfbac8d8d4c477f3ba2a0a9226eb) (cherry picked from commit 007da96aa26d29396e2360806b90a3a7d708b233) --- drivers/modem/modem_cellular.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 8aca855f55b..996a1e838c4 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -445,13 +445,13 @@ MODEM_CHAT_MATCHES_DEFINE(dial_abort_matches, static void modem_cellular_log_state_changed(enum modem_cellular_state last_state, enum modem_cellular_state new_state) { - LOG_INF("switch from %s to %s", modem_cellular_state_str(last_state), + LOG_DBG("switch from %s to %s", modem_cellular_state_str(last_state), modem_cellular_state_str(new_state)); } static void modem_cellular_log_event(enum modem_cellular_event evt) { - LOG_INF("event %s", modem_cellular_event_str(evt)); + LOG_DBG("event %s", modem_cellular_event_str(evt)); } static void modem_cellular_start_timer(struct modem_cellular_data *data, k_timeout_t timeout) From b05aac4d00caf876d2378ec7c417135bddbd65cf Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 12 Feb 2024 17:10:19 +0100 Subject: [PATCH 0512/2300] [nrf fromtree] modem: modem_cellular: CID 338164 strncpy() passed incorrect size Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit adcdf64a0f3f05151ad88425ac707420a96926ca) (cherry picked from commit 30f01a55bf61892924b51da112aeafcd134e1598) --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 996a1e838c4..217f2b3ff2d 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -337,7 +337,7 @@ static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->fw_version, argv[1], sizeof(data->fw_version)); + strncpy(data->fw_version, argv[1], sizeof(data->fw_version) - 1); } static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uint16_t argc, From aa9fe5ba2885c649babf062ce4103b4647c5232b Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 12 Feb 2024 17:11:42 +0100 Subject: [PATCH 0513/2300] [nrf fromtree] modem: modem_cellular: CID 338140 incorrect size passed to strncpy Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit ae951f5f0215b8b8c57a5fed97d773770e7ed16f) (cherry picked from commit 0074fed59ad645c84eaf1769676265a8e175908c) --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 217f2b3ff2d..c3912c119c3 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -325,7 +325,7 @@ static void modem_cellular_chat_on_cgmi(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->manufacturer, argv[1], sizeof(data->manufacturer)); + strncpy(data->manufacturer, argv[1], sizeof(data->manufacturer) - 1); } static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, uint16_t argc, From 478f0d19ff5930779035b1dbf9dc9583d7da4f42 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 12 Feb 2024 17:12:26 +0100 Subject: [PATCH 0514/2300] [nrf fromtree] modem: modem_cellular: CID 338115 incorrect size passed to strncpy() Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 08a51bae89c6f552363f31a152912819e099021b) (cherry picked from commit 907b6b929ced39b6243ca81c979762792d4f2e4b) --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index c3912c119c3..6ef6d125ea9 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -313,7 +313,7 @@ static void modem_cellular_chat_on_cgmm(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->model_id, argv[1], sizeof(data->model_id)); + strncpy(data->model_id, argv[1], sizeof(data->model_id) - 1); } static void modem_cellular_chat_on_cgmi(struct modem_chat *chat, char **argv, uint16_t argc, From 710a0c8998004460f13ffff8fbd5f850b8fb7e09 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 12 Feb 2024 17:13:07 +0100 Subject: [PATCH 0515/2300] [nrf fromtree] modem: modem_cellular: CID 338073 incorrect size passed to strncpy() Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit b668296a50a17132cc911fac3009ef8ee01652d2) (cherry picked from commit 7b07143975ad8abf6cb39cc7fd5838d3cf53a40b) --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 6ef6d125ea9..36596c6447e 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -301,7 +301,7 @@ static void modem_cellular_chat_on_imei(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->imei, argv[1], sizeof(data->imei)); + strncpy(data->imei, argv[1], sizeof(data->imei) - 1); } static void modem_cellular_chat_on_cgmm(struct modem_chat *chat, char **argv, uint16_t argc, From 562cc0177d92a3618c71501214ae94f91001bd73 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 12 Feb 2024 17:14:00 +0100 Subject: [PATCH 0516/2300] [nrf fromtree] modem: modem_cellular: CID 338067 incorrect size passed to strncpy() Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 080d51bb367836b73021fdd7ade3e2c4c54a0435) (cherry picked from commit 9d1143390287ed92444046c59bf70f8b689d0e49) --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 36596c6447e..f5e099cd08c 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -370,7 +370,7 @@ static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, ui { struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; - strncpy(data->imsi, (char *)argv[1], sizeof(data->imsi)); + strncpy(data->imsi, argv[1], sizeof(data->imsi) - 1); } static bool modem_cellular_is_registered(struct modem_cellular_data *data) From 291a41f6011ed51845c4515669fa2f49c05d4a24 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Mon, 29 Jan 2024 11:41:56 +0200 Subject: [PATCH 0517/2300] [nrf fromlist] modem: small improvements Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68206 Changes include: - Improving handling of frames for unconfigured DLCIs. - Adding logs and outputting error codes in failure cases. - Adding warnings to not reuse buffers. - Fixing comments. Signed-off-by: Tomi Fontanilles (cherry picked from commit 5e495c448230b2597987ac7cdd264d8e8bc9722c) --- include/zephyr/modem/pipe.h | 20 ++++++++------- .../modem/backends/modem_backend_uart_async.c | 5 ++-- subsys/modem/modem_cmux.c | 25 ++++++++++++------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/include/zephyr/modem/pipe.h b/include/zephyr/modem/pipe.h index a741a94a34c..70a37302273 100644 --- a/include/zephyr/modem/pipe.h +++ b/include/zephyr/modem/pipe.h @@ -130,25 +130,27 @@ void modem_pipe_attach(struct modem_pipe *pipe, modem_pipe_api_callback callback * @brief Transmit data through pipe * * @param pipe Pipe to transmit through - * @param buf Destination for reveived data - * @param size Capacity of destination for recevied data + * @param buf Data to transmit + * @param size Number of bytes to transmit * - * @return Number of bytes placed in pipe + * @retval Number of bytes placed in pipe + * @retval -EPERM if pipe is closed + * @retval -errno code on error * * @warning This call must be non-blocking */ int modem_pipe_transmit(struct modem_pipe *pipe, const uint8_t *buf, size_t size); /** - * @brief Reveive data through pipe + * @brief Receive data through pipe * * @param pipe Pipe to receive from - * @param buf Destination for reveived data - * @param size Capacity of destination for recevied data + * @param buf Destination for received data; must not be already in use in a modem module. + * @param size Capacity of destination for received data * - * @return Number of bytes received from pipe if any - * @return -EPERM if pipe is closed - * @return -errno code on error + * @retval Number of bytes received from pipe + * @retval -EPERM if pipe is closed + * @retval -errno code on error * * @warning This call must be non-blocking */ diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 47148a77f77..0aa88ccd48c 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -185,8 +185,9 @@ static int modem_backend_uart_async_transmit(void *data, const uint8_t *buf, siz ret = uart_tx(backend->uart, backend->async.transmit_buf, bytes_to_transmit, CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS * 1000L); - if (ret < 0) { - LOG_WRN("Failed to start async transmit"); + if (ret != 0) { + LOG_ERR("Failed to %s %u bytes. (%d)", + "start async transmit for", bytes_to_transmit, ret); return ret; } diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 16dc60b7219..6f9f10c04a6 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -564,7 +564,8 @@ static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) written = ring_buf_put(&dlci->receive_rb, cmux->frame.data, cmux->frame.data_len); k_mutex_unlock(&dlci->receive_rb_lock); if (written != cmux->frame.data_len) { - LOG_WRN("DLCI %u receive buffer overrun", dlci->dlci_address); + LOG_WRN("DLCI %u receive buffer overrun (dropped %u out of %u bytes)", + dlci->dlci_address, cmux->frame.data_len - written, cmux->frame.data_len); } modem_pipe_notify_receive_ready(&dlci->pipe); } @@ -606,16 +607,15 @@ static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) { struct modem_cmux_dlci *dlci; - dlci = modem_cmux_find_dlci(cmux); + modem_cmux_log_received_frame(&cmux->frame); + dlci = modem_cmux_find_dlci(cmux); if (dlci == NULL) { - LOG_WRN("Could not find DLCI: %u", cmux->frame.dlci_address); - + LOG_WRN("Ignoring frame intended for unconfigured DLCI %u.", + cmux->frame.dlci_address); return; } - modem_cmux_log_received_frame(&cmux->frame); - switch (cmux->frame.type) { case MODEM_CMUX_FRAME_TYPE_UA: modem_cmux_on_dlci_frame_ua(dlci); @@ -643,10 +643,9 @@ static void modem_cmux_on_frame(struct modem_cmux *cmux) { if (cmux->frame.dlci_address == 0) { modem_cmux_on_control_frame(cmux); - return; + } else { + modem_cmux_on_dlci_frame(cmux); } - - modem_cmux_on_dlci_frame(cmux); } static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t byte) @@ -830,6 +829,9 @@ static void modem_cmux_receive_handler(struct k_work *item) /* Receive data from pipe */ ret = modem_pipe_receive(cmux->pipe, buf, sizeof(buf)); if (ret < 1) { + if (ret < 0) { + LOG_ERR("Pipe receiving error: %d", ret); + } return; } @@ -876,12 +878,17 @@ static void modem_cmux_transmit_handler(struct k_work *item) ret = modem_pipe_transmit(cmux->pipe, reserved, reserved_size); if (ret < 0) { ring_buf_get_finish(&cmux->transmit_rb, 0); + if (ret != -EPERM) { + LOG_ERR("Failed to %s %u bytes. (%d)", + "transmit", reserved_size, ret); + } break; } ring_buf_get_finish(&cmux->transmit_rb, (uint32_t)ret); if (ret < reserved_size) { + LOG_DBG("Transmitted only %u out of %u bytes at once.", ret, reserved_size); break; } } From 5ef64362bb7a9003b01f1cd9d753b38871b9437f Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Tue, 6 Feb 2024 12:51:46 +0200 Subject: [PATCH 0518/2300] [nrf fromlist] modem: backends: use CONFIG_MODEM_MODULES_LOG_LEVEL Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68651 This makes the modem backends use the log level set for the modem modules instead of the default one. Signed-off-by: Tomi Fontanilles (cherry picked from commit 8017cad4e529c965afc0c747e342e17ba44c254f) --- subsys/modem/backends/modem_backend_tty.c | 2 +- subsys/modem/backends/modem_backend_uart.c | 2 +- subsys/modem/backends/modem_backend_uart_async.c | 2 +- subsys/modem/backends/modem_backend_uart_isr.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/modem/backends/modem_backend_tty.c b/subsys/modem/backends/modem_backend_tty.c index 8375183be48..e511150ae9d 100644 --- a/subsys/modem/backends/modem_backend_tty.c +++ b/subsys/modem/backends/modem_backend_tty.c @@ -7,7 +7,7 @@ #include #include -LOG_MODULE_REGISTER(modem_backend_tty); +LOG_MODULE_REGISTER(modem_backend_tty, CONFIG_MODEM_MODULES_LOG_LEVEL); #include #include diff --git a/subsys/modem/backends/modem_backend_uart.c b/subsys/modem/backends/modem_backend_uart.c index a8348b0b8a0..b77a7331899 100644 --- a/subsys/modem/backends/modem_backend_uart.c +++ b/subsys/modem/backends/modem_backend_uart.c @@ -10,7 +10,7 @@ #include #include -LOG_MODULE_REGISTER(modem_backend_uart); +LOG_MODULE_REGISTER(modem_backend_uart, CONFIG_MODEM_MODULES_LOG_LEVEL); #include diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 0aa88ccd48c..107f5e4290e 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -7,7 +7,7 @@ #include "modem_backend_uart_async.h" #include -LOG_MODULE_DECLARE(modem_backend_uart); +LOG_MODULE_DECLARE(modem_backend_uart, CONFIG_MODEM_MODULES_LOG_LEVEL); #include #include diff --git a/subsys/modem/backends/modem_backend_uart_isr.c b/subsys/modem/backends/modem_backend_uart_isr.c index 8a7075e3519..9eed7913496 100644 --- a/subsys/modem/backends/modem_backend_uart_isr.c +++ b/subsys/modem/backends/modem_backend_uart_isr.c @@ -7,7 +7,7 @@ #include "modem_backend_uart_isr.h" #include -LOG_MODULE_DECLARE(modem_backend_uart); +LOG_MODULE_DECLARE(modem_backend_uart, CONFIG_MODEM_MODULES_LOG_LEVEL); #include From 83ed9b883c2113d8c3c1c27e7853da7ef2da3a61 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Tue, 6 Feb 2024 15:42:11 +0200 Subject: [PATCH 0519/2300] [nrf fromlist] modem: ppp: fix crash when attaching to a pipe Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68651 modem_pipe_attach() can send events before returning, which could provoke a crash as ppp->pipe, still NULL at that time, could be used either in receiving (if the pipe had some data pending) or in sending (if the PPP module had already been attached and had some data to send in its transmit buffer). ppp->pipe is now set before modem_pipe_attach(). Also, the ATTACHED_BIT is now set only after having actually attached. And finally, the send_work is now scheduled on PIPE_EVENT_OPENED so that data is flushed when the (closed) attached pipe is opened. Signed-off-by: Tomi Fontanilles (cherry picked from commit 8b32ec35dc133c67c110bfa0eea63724a8780018) --- subsys/modem/modem_ppp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subsys/modem/modem_ppp.c b/subsys/modem/modem_ppp.c index 1d47542f24a..dffa4f68dbf 100644 --- a/subsys/modem/modem_ppp.c +++ b/subsys/modem/modem_ppp.c @@ -319,6 +319,7 @@ static void modem_ppp_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_eve k_work_submit(&ppp->process_work); break; + case MODEM_PIPE_EVENT_OPENED: case MODEM_PIPE_EVENT_TRANSMIT_IDLE: k_work_submit(&ppp->send_work); break; @@ -467,12 +468,14 @@ const struct ppp_api modem_ppp_ppp_api = { int modem_ppp_attach(struct modem_ppp *ppp, struct modem_pipe *pipe) { - if (atomic_test_and_set_bit(&ppp->state, MODEM_PPP_STATE_ATTACHED_BIT) == true) { + if (atomic_test_bit(&ppp->state, MODEM_PPP_STATE_ATTACHED_BIT) == true) { return 0; } - modem_pipe_attach(pipe, modem_ppp_pipe_callback, ppp); ppp->pipe = pipe; + modem_pipe_attach(pipe, modem_ppp_pipe_callback, ppp); + + atomic_set_bit(&ppp->state, MODEM_PPP_STATE_ATTACHED_BIT); return 0; } From ca3e68ec22fb62428c42ab539ba821b6086c4611 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 05:42:22 +0200 Subject: [PATCH 0520/2300] [nrf fromlist] modem: ppp: fix receiving of successive frames when one 0x7E is omitted Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68651 The SOF delimiter byte may be omitted when a frame follows another that just ended with that byte. The parsing used to expect that second delimiter anyway, which resulted in PPP frames going missing. As an additional improvement, dropped bytes as well as the length of received frames are now (debug) logged. Signed-off-by: Tomi Fontanilles (cherry picked from commit 6fa0378cef081f48548ffc7916d45e5fa484550c) --- subsys/modem/modem_ppp.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/subsys/modem/modem_ppp.c b/subsys/modem/modem_ppp.c index dffa4f68dbf..91085317d99 100644 --- a/subsys/modem/modem_ppp.c +++ b/subsys/modem/modem_ppp.c @@ -192,40 +192,45 @@ static uint8_t modem_ppp_wrap_net_pkt_byte(struct modem_ppp *ppp) return 0; } +static bool modem_ppp_is_byte_expected(uint8_t byte, uint8_t expected_byte) +{ + if (byte == expected_byte) { + return true; + } + LOG_DBG("Dropping byte 0x%02hhx because 0x%02hhx was expected.", byte, expected_byte); + return false; +} + static void modem_ppp_process_received_byte(struct modem_ppp *ppp, uint8_t byte) { switch (ppp->receive_state) { case MODEM_PPP_RECEIVE_STATE_HDR_SOF: - if (byte == MODEM_PPP_CODE_DELIMITER) { + if (modem_ppp_is_byte_expected(byte, MODEM_PPP_CODE_DELIMITER)) { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_FF; } - break; case MODEM_PPP_RECEIVE_STATE_HDR_FF: if (byte == MODEM_PPP_CODE_DELIMITER) { break; } - - if (byte == 0xFF) { + if (modem_ppp_is_byte_expected(byte, 0xFF)) { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_7D; } else { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_SOF; } - break; case MODEM_PPP_RECEIVE_STATE_HDR_7D: - if (byte == MODEM_PPP_CODE_ESCAPE) { + if (modem_ppp_is_byte_expected(byte, MODEM_PPP_CODE_ESCAPE)) { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_23; } else { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_SOF; } - break; case MODEM_PPP_RECEIVE_STATE_HDR_23: - if (byte == 0x23) { + if (modem_ppp_is_byte_expected(byte, 0x23)) { ppp->rx_pkt = net_pkt_rx_alloc_with_buffer(ppp->iface, CONFIG_MODEM_PPP_NET_BUF_FRAG_SIZE, AF_UNSPEC, 0, K_NO_WAIT); @@ -238,7 +243,6 @@ static void modem_ppp_process_received_byte(struct modem_ppp *ppp, uint8_t byte) LOG_DBG("Receiving PPP frame"); ppp->receive_state = MODEM_PPP_RECEIVE_STATE_WRITING; net_pkt_cursor_init(ppp->rx_pkt); - } else { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_SOF; } @@ -247,11 +251,10 @@ static void modem_ppp_process_received_byte(struct modem_ppp *ppp, uint8_t byte) case MODEM_PPP_RECEIVE_STATE_WRITING: if (byte == MODEM_PPP_CODE_DELIMITER) { - LOG_DBG("Received PPP frame"); + LOG_DBG("Received PPP frame (len %zu)", net_pkt_get_len(ppp->rx_pkt)); /* Remove FCS */ net_pkt_remove_tail(ppp->rx_pkt, MODEM_PPP_FRAME_TAIL_SIZE); - net_pkt_cursor_init(ppp->rx_pkt); net_pkt_set_ppp(ppp->rx_pkt, true); if (net_recv_data(ppp->iface, ppp->rx_pkt) < 0) { @@ -260,7 +263,8 @@ static void modem_ppp_process_received_byte(struct modem_ppp *ppp, uint8_t byte) } ppp->rx_pkt = NULL; - ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_SOF; + /* Skip SOF because the delimiter may be omitted for successive frames. */ + ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_FF; break; } From f0b9e3368ade6b8b16c1ee485f86065d91ae329c Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 05:42:38 +0200 Subject: [PATCH 0521/2300] [nrf fromlist] modem: backend: uart_async: improve logging on UART_TX_ABORTED Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68651 Only log if the abort is not self-triggered, and also print the number of bytes sent. Signed-off-by: Tomi Fontanilles (cherry picked from commit 6ae16aac09d717957a4a2e39c5569bc8293b22d9) --- .../modem/backends/modem_backend_uart_async.c | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 107f5e4290e..29107198c2f 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -12,12 +12,15 @@ LOG_MODULE_DECLARE(modem_backend_uart, CONFIG_MODEM_MODULES_LOG_LEVEL); #include #include -#define MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT (0) -#define MODEM_BACKEND_UART_ASYNC_STATE_RECEIVING_BIT (1) -#define MODEM_BACKEND_UART_ASYNC_STATE_RX_BUF0_USED_BIT (2) -#define MODEM_BACKEND_UART_ASYNC_STATE_RX_BUF1_USED_BIT (3) +enum { + MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT, + MODEM_BACKEND_UART_ASYNC_STATE_RECEIVING_BIT, + MODEM_BACKEND_UART_ASYNC_STATE_RX_BUF0_USED_BIT, + MODEM_BACKEND_UART_ASYNC_STATE_RX_BUF1_USED_BIT, + MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT, +}; -static bool modem_backend_uart_async_is_closed(struct modem_backend_uart *backend) +static bool modem_backend_uart_async_is_uart_stopped(struct modem_backend_uart *backend) { if (!atomic_test_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT) && @@ -33,6 +36,12 @@ static bool modem_backend_uart_async_is_closed(struct modem_backend_uart *backen return false; } +static bool modem_backend_uart_async_is_open(struct modem_backend_uart *backend) +{ + return atomic_test_bit(&backend->async.state, + MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); +} + static void modem_backend_uart_async_event_handler(const struct device *dev, struct uart_event *evt, void *user_data) { @@ -49,7 +58,9 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, break; case UART_TX_ABORTED: - LOG_WRN("Transmit aborted"); + if (modem_backend_uart_async_is_open(backend)) { + LOG_WRN("Transmit aborted (%zu sent)", evt->data.tx.len); + } atomic_clear_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT); k_work_submit(&backend->transmit_idle_work); @@ -124,7 +135,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, break; } - if (modem_backend_uart_async_is_closed(backend)) { + if (modem_backend_uart_async_is_uart_stopped(backend)) { k_work_submit(&backend->async.rx_disabled_work); } } @@ -155,6 +166,8 @@ static int modem_backend_uart_async_open(void *data) atomic_set_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_RECEIVING_BIT); + atomic_set_bit(&backend->async.state, + MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); modem_pipe_notify_opened(&backend->pipe); return 0; @@ -217,6 +230,7 @@ static int modem_backend_uart_async_close(void *data) { struct modem_backend_uart *backend = (struct modem_backend_uart *)data; + atomic_clear_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); uart_tx_abort(backend->uart); uart_rx_disable(backend->uart); return 0; From 872b195fb56cdadf2360dda2bc8e2ddffab50694 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 06:08:26 +0200 Subject: [PATCH 0522/2300] [nrf fromlist] modem: cmux: improve handling of receive buffer overrun Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68651 This allows to properly drop single CMUX frames that are too big to fit in the receive buffer, keeping track of where they end so that following frames are received correctly regardless of the data contents. Signed-off-by: Tomi Fontanilles (cherry picked from commit 8b3d940fb4f4283bd39893da146c5f3f2ab26e87) --- subsys/modem/modem_cmux.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 6f9f10c04a6..67190934c45 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -221,7 +221,7 @@ static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, uint16_t buf_idx; space = ring_buf_space_get(&cmux->transmit_rb) - MODEM_CMUX_FRAME_SIZE_MAX; - data_len = (space < frame->data_len) ? space : frame->data_len; + data_len = MIN(space, frame->data_len); /* SOF */ buf[0] = 0xF9; @@ -746,28 +746,27 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by case MODEM_CMUX_RECEIVE_STATE_DATA: /* Copy byte to data */ - cmux->receive_buf[cmux->receive_buf_len] = byte; + if (cmux->receive_buf_len < cmux->receive_buf_size) { + cmux->receive_buf[cmux->receive_buf_len] = byte; + } cmux->receive_buf_len++; /* Check if datalen reached */ if (cmux->frame.data_len == cmux->receive_buf_len) { /* Await FCS */ cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_FCS; - break; } - /* Check if receive buffer overrun */ - if (cmux->receive_buf_len == cmux->receive_buf_size) { - LOG_WRN("Receive buf overrun"); + break; - /* Drop frame */ - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_EOF; + case MODEM_CMUX_RECEIVE_STATE_FCS: + if (cmux->receive_buf_len > cmux->receive_buf_size) { + LOG_WRN("Receive buffer overrun (%u > %u)", + cmux->receive_buf_len, cmux->receive_buf_size); + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_DROP; break; } - break; - - case MODEM_CMUX_RECEIVE_STATE_FCS: /* Compute FCS */ if (cmux->frame.type == MODEM_CMUX_FRAME_TYPE_UIH) { fcs = 0xFF - crc8(cmux->frame_header, cmux->frame_header_len, From 869e3ec68265cf28170f8ca7ac916a9d63a5053f Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 06:09:57 +0200 Subject: [PATCH 0523/2300] [nrf fromlist] modem: chat: fix init assert Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68651 Use the proper variable. Signed-off-by: Tomi Fontanilles (cherry picked from commit 6e0bea15c4f56c811c9d30f826d53aca137793a6) --- subsys/modem/modem_chat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index b2d63b05e9e..c689ff2e0ab 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -708,7 +708,7 @@ int modem_chat_init(struct modem_chat *chat, const struct modem_chat_config *con __ASSERT_NO_MSG(config->argv_size > 0); __ASSERT_NO_MSG(config->delimiter != NULL); __ASSERT_NO_MSG(config->delimiter_size > 0); - __ASSERT_NO_MSG(!((config->filter == NULL) && (config->filter > 0))); + __ASSERT_NO_MSG(!((config->filter == NULL) && (config->filter_size > 0))); __ASSERT_NO_MSG(!((config->unsol_matches == NULL) && (config->unsol_matches_size > 0))); memset(chat, 0x00, sizeof(*chat)); From 9bc3b8295d15e46e6139f93339ad8613eca48b2c Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 06:36:29 +0200 Subject: [PATCH 0524/2300] [nrf fromlist] modem: pipe: add warning to synchronous pipe open/close functions Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68651 This might be useful to those not familiar with how they work. Signed-off-by: Tomi Fontanilles (cherry picked from commit 82f7e2300acc1602c8276fdcb4056fce63a2f9a0) --- include/zephyr/modem/pipe.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/zephyr/modem/pipe.h b/include/zephyr/modem/pipe.h index 70a37302273..60e877e44a3 100644 --- a/include/zephyr/modem/pipe.h +++ b/include/zephyr/modem/pipe.h @@ -98,6 +98,10 @@ void modem_pipe_init(struct modem_pipe *pipe, void *data, struct modem_pipe_api * * @retval 0 if pipe was successfully opened or was already open * @retval -errno code otherwise + * + * @warning Be cautious when using this synchronous version of the call. + * It may block the calling thread, which in the case of the system workqueue + * can result in a deadlock until this call times out waiting for the pipe to be open. */ int modem_pipe_open(struct modem_pipe *pipe); @@ -170,6 +174,10 @@ void modem_pipe_release(struct modem_pipe *pipe); * * @retval 0 if pipe open was called closed or pipe was already closed * @retval -errno code otherwise + * + * @warning Be cautious when using this synchronous version of the call. + * It may block the calling thread, which in the case of the system workqueue + * can result in a deadlock until this call times out waiting for the pipe to be closed. */ int modem_pipe_close(struct modem_pipe *pipe); From 4974702e2bcc03fd5a938b12d5bad628b4ab95b5 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 07:24:26 +0200 Subject: [PATCH 0525/2300] [nrf fromlist] drivers: modem_cellular: allow variable length chat delimiter and filter Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68981 To allow for differences between modems. Signed-off-by: Tomi Fontanilles (cherry picked from commit b6577fd6ff96da8853a5b193a31801e996ff143c) --- drivers/modem/modem_cellular.c | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index f5e099cd08c..35b05602a74 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -96,8 +96,8 @@ struct modem_cellular_data { /* Modem chat */ struct modem_chat chat; uint8_t chat_receive_buf[128]; - uint8_t chat_delimiter[1]; - uint8_t chat_filter[1]; + uint8_t *chat_delimiter; + uint8_t *chat_filter; uint8_t *chat_argv[32]; /* Status */ @@ -424,9 +424,9 @@ MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); MODEM_CHAT_MATCH_DEFINE(cesq_match, "+CESQ: ", ",", modem_cellular_chat_on_cesq); -MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); -MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); -MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); +MODEM_CHAT_MATCH_DEFINE(cimi_match __maybe_unused, "", "", modem_cellular_chat_on_imsi); +MODEM_CHAT_MATCH_DEFINE(cgmi_match __maybe_unused, "", "", modem_cellular_chat_on_cgmi); +MODEM_CHAT_MATCH_DEFINE(cgmr_match __maybe_unused, "", "", modem_cellular_chat_on_cgmr); MODEM_CHAT_MATCHES_DEFINE(unsol_matches, MODEM_CHAT_MATCH("+CREG: ", ",", modem_cellular_chat_on_cxreg), @@ -1513,9 +1513,9 @@ static int modem_cellular_init(const struct device *dev) .receive_buf = data->chat_receive_buf, .receive_buf_size = ARRAY_SIZE(data->chat_receive_buf), .delimiter = data->chat_delimiter, - .delimiter_size = ARRAY_SIZE(data->chat_delimiter), + .delimiter_size = strlen(data->chat_delimiter), .filter = data->chat_filter, - .filter_size = ARRAY_SIZE(data->chat_filter), + .filter_size = strlen(data->chat_filter), .argv = data->chat_argv, .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, @@ -1939,8 +1939,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -1968,8 +1968,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -1997,8 +1997,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2026,8 +2026,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2055,8 +2055,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2084,8 +2084,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2114,8 +2114,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2143,8 +2143,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ From d2822f2f951966ef9042935ec75b094df853e6b6 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 08:12:34 +0200 Subject: [PATCH 0526/2300] [nrf fromlist] drivers: modem_cellular: make the buffer sizes configurable Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68981 To allow fine tuning and accommodate modem differences. Signed-off-by: Tomi Fontanilles (cherry picked from commit 6b2f8b1939e1028c5bf808901709429ca4d10361) --- drivers/modem/Kconfig.cellular | 14 ++++++++++++++ drivers/modem/modem_cellular.c | 15 ++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 0460cda8d96..599a8a61138 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -36,4 +36,18 @@ config MODEM_CELLULAR_PERIODIC_SCRIPT_MS int "Periodic script interval in milliseconds" default 2000 +config MODEM_CELLULAR_UART_BUFFER_SIZES + int "The UART receive and transmit buffer sizes in bytes." + default 512 + +config MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE + int "The maximum CMUX frame size in bytes." + default 128 + help + This value affects the size of buffers used to receive and transmit CMUX frames. + +config MODEM_CELLULAR_CHAT_BUFFER_SIZES + int "The size of the buffers used for the chat scripts in bytes." + default 128 + endif diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 35b05602a74..63430d45c1a 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -79,23 +79,24 @@ struct modem_cellular_data { /* UART backend */ struct modem_pipe *uart_pipe; struct modem_backend_uart uart_backend; - uint8_t uart_backend_receive_buf[512]; - uint8_t uart_backend_transmit_buf[512]; + uint8_t uart_backend_receive_buf[CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES]; + uint8_t uart_backend_transmit_buf[CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES]; /* CMUX */ struct modem_cmux cmux; - uint8_t cmux_receive_buf[128]; - uint8_t cmux_transmit_buf[256]; + uint8_t cmux_receive_buf[CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; + uint8_t cmux_transmit_buf[2 * CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; struct modem_cmux_dlci dlci1; struct modem_cmux_dlci dlci2; struct modem_pipe *dlci1_pipe; struct modem_pipe *dlci2_pipe; - uint8_t dlci1_receive_buf[128]; - uint8_t dlci2_receive_buf[256]; + uint8_t dlci1_receive_buf[CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; + /* DLCI 2 is only used for chat scripts. */ + uint8_t dlci2_receive_buf[CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES]; /* Modem chat */ struct modem_chat chat; - uint8_t chat_receive_buf[128]; + uint8_t chat_receive_buf[CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES]; uint8_t *chat_delimiter; uint8_t *chat_filter; uint8_t *chat_argv[32]; From 509dcb2757b9ec83cddba8a7f166fb11dcef3208 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 08:43:10 +0200 Subject: [PATCH 0527/2300] [nrf fromlist] samples: net: cellular_modem: small improvements Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68981 - It now uses the first PPP network interface instead of the default network interface. - Logs are added/improved. - Potentially unused modem_chat matches are declared as such to suppress compiler warnings. Signed-off-by: Tomi Fontanilles (cherry picked from commit 278f8b8e2ec347a5381165f4a533e6bbc28308ef) --- samples/net/cellular_modem/README.rst | 2 +- samples/net/cellular_modem/src/main.c | 63 ++++++++++++++++----------- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/samples/net/cellular_modem/README.rst b/samples/net/cellular_modem/README.rst index 384d8b3bef5..b845b2e37d8 100644 --- a/samples/net/cellular_modem/README.rst +++ b/samples/net/cellular_modem/README.rst @@ -18,7 +18,7 @@ Notes This sample uses the devicetree alias modem to identify the modem instance to use. The sample also presumes that -the modem driver creates the only network interface. +the modem driver creates the only PPP network interface. Setup ***** diff --git a/samples/net/cellular_modem/src/main.c b/samples/net/cellular_modem/src/main.c index 95e1c45f160..543f8d6d711 100644 --- a/samples/net/cellular_modem/src/main.c +++ b/samples/net/cellular_modem/src/main.c @@ -83,7 +83,7 @@ static int sample_dns_request(void) return 0; } -int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen) +int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t *port) { int ret; int socket_fd; @@ -96,22 +96,16 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen) socket_fd = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (socket_fd < 0) { - printk("Failed to open socket\n"); + printk("Failed to open socket (%d)\n", errno); return -1; } printk("Socket opened\n"); - if (ai_addr->sa_family == AF_INET) { - net_sin(ai_addr)->sin_port = htons(SAMPLE_TEST_ENDPOINT_UDP_ECHO_PORT); - } else if (ai_addr->sa_family == AF_INET6) { - net_sin6(ai_addr)->sin6_port = htons(SAMPLE_TEST_ENDPOINT_UDP_ECHO_PORT); - } else { - printk("Unsupported address family\n"); - return -1; - } + *port = htons(SAMPLE_TEST_ENDPOINT_UDP_ECHO_PORT); for (uint32_t i = 0; i < SAMPLE_TEST_ECHO_PACKETS; i++) { + printk("Sending echo packet\n"); send_start_ms = k_uptime_get_32(); ret = zsock_sendto(socket_fd, sample_test_packet, sizeof(sample_test_packet), 0, @@ -122,6 +116,7 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen) continue; } + printk("Receiving echoed packet"); ret = zsock_recv(socket_fd, sample_recv_buffer, sizeof(sample_recv_buffer), 0); if (ret != sizeof(sample_test_packet)) { printk("Echoed sample test packet has incorrect size\n"); @@ -160,7 +155,7 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen) } -int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen) +int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t *port) { int ret; int socket_fd; @@ -180,14 +175,7 @@ int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen) printk("Socket opened\n"); - if (ai_addr->sa_family == AF_INET) { - net_sin(ai_addr)->sin_port = htons(SAMPLE_TEST_ENDPOINT_UDP_RECEIVE_PORT); - } else if (ai_addr->sa_family == AF_INET6) { - net_sin6(ai_addr)->sin6_port = htons(SAMPLE_TEST_ENDPOINT_UDP_RECEIVE_PORT); - } else { - printk("Unsupported address family\n"); - return -1; - } + *port = htons(SAMPLE_TEST_ENDPOINT_UDP_RECEIVE_PORT); printk("Sending %u packets\n", SAMPLE_TEST_TRANSMIT_PACKETS); send_start_ms = k_uptime_get_32(); @@ -232,7 +220,9 @@ int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen) int main(void) { + struct net_if *const iface = net_if_get_first_by_type(&NET_L2_GET_NAME(PPP)); uint32_t raised_event; + uint16_t *port; const void *info; size_t info_len; int ret; @@ -243,14 +233,14 @@ int main(void) pm_device_action_run(modem, PM_DEVICE_ACTION_RESUME); printk("Bring up network interface\n"); - ret = net_if_up(net_if_get_default()); + ret = net_if_up(iface); if (ret < 0) { printk("Failed to bring up network interface\n"); return -1; } printk("Waiting for L4 connected\n"); - ret = net_mgmt_event_wait_on_iface(net_if_get_default(), + ret = net_mgmt_event_wait_on_iface(iface, NET_EVENT_L4_CONNECTED, &raised_event, &info, &info_len, K_SECONDS(120)); @@ -260,7 +250,7 @@ int main(void) } printk("Waiting for DNS server added\n"); - ret = net_mgmt_event_wait_on_iface(net_if_get_default(), + ret = net_mgmt_event_wait_on_iface(iface, NET_EVENT_DNS_SERVER_ADD, &raised_event, &info, &info_len, K_SECONDS(10)); @@ -271,8 +261,29 @@ int main(void) return -1; } + { + char ip_str[INET6_ADDRSTRLEN]; + const void *src; + + switch (sample_test_dns_addrinfo.ai_addr.sa_family) { + case AF_INET: + src = &net_sin(&sample_test_dns_addrinfo.ai_addr)->sin_addr; + port = &net_sin(&sample_test_dns_addrinfo.ai_addr)->sin_port; + break; + case AF_INET6: + src = &net_sin6(&sample_test_dns_addrinfo.ai_addr)->sin6_addr; + port = &net_sin6(&sample_test_dns_addrinfo.ai_addr)->sin6_port; + break; + default: + printk("Unsupported address family\n"); + return -1; + } + inet_ntop(sample_test_dns_addrinfo.ai_addr.sa_family, src, ip_str, sizeof(ip_str)); + printk("Resolved to %s\n", ip_str); + } + ret = sample_echo_packet(&sample_test_dns_addrinfo.ai_addr, - sample_test_dns_addrinfo.ai_addrlen); + sample_test_dns_addrinfo.ai_addrlen, port); if (ret < 0) { printk("Failed to send echo\n"); @@ -280,7 +291,7 @@ int main(void) } ret = sample_transmit_packets(&sample_test_dns_addrinfo.ai_addr, - sample_test_dns_addrinfo.ai_addrlen); + sample_test_dns_addrinfo.ai_addrlen, port); if (ret < 0) { printk("Failed to send packets\n"); @@ -295,6 +306,8 @@ int main(void) } pm_device_action_run(modem, PM_DEVICE_ACTION_RESUME); + + printk("Waiting for L4 connected\n"); ret = net_mgmt_event_wait_on_iface(net_if_get_default(), NET_EVENT_L4_CONNECTED, &raised_event, &info, &info_len, K_SECONDS(60)); @@ -305,7 +318,7 @@ int main(void) } ret = sample_echo_packet(&sample_test_dns_addrinfo.ai_addr, - sample_test_dns_addrinfo.ai_addrlen); + sample_test_dns_addrinfo.ai_addrlen, port); if (ret < 0) { printk("Failed to send echo after restart\n"); From 5d4b1d296970c3bd05f84a4586a74b0a7f679382 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 10:27:55 +0200 Subject: [PATCH 0528/2300] [nrf fromlist] drivers: modem_cellular: add nRF91 series (w/ SLM) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68981 The nRF91 series devices, when running the Serial LTE Modem (SLM) application starting with nRF Connect SDK 2.6.0, can now be used as standalone modems via the generic modem_cellular driver. A configuration to run the cellular_modem sample on the nRF9160 DK (plugged in to another nRF91 series device running SLM) is provided. Signed-off-by: Tomi Fontanilles (cherry picked from commit f41b357a25cc302f9c2bcd37fb7976306f04f027) --- drivers/modem/Kconfig.cellular | 3 +- drivers/modem/modem_cellular.c | 67 +++++++++++++++++++ dts/bindings/modem/nordic,nrf91-slm.yaml | 9 +++ .../boards/nrf9160dk_nrf9160_ns.conf | 16 +++++ .../boards/nrf9160dk_nrf9160_ns.overlay | 34 ++++++++++ tests/drivers/build_all/modem/uart.dtsi | 6 ++ 6 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 dts/bindings/modem/nordic,nrf91-slm.yaml create mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf create mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 599a8a61138..aacf4449d28 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -15,7 +15,8 @@ config MODEM_CELLULAR depends on (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ DT_HAS_U_BLOX_SARA_R5_ENABLED || DT_HAS_SWIR_HL7800_ENABLED || \ - DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED) + DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED || \ + DT_HAS_NORDIC_NRF91_SLM_ENABLED) help This driver uses the generic 3gpp AT commands, along with the standard protocols CMUX and PPP, to configure diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 63430d45c1a..ed4e998fec3 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1933,6 +1933,41 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, modem_cellular_chat_callback_handler, 4); #endif +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf91_slm) +MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_init_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP_MULT("AT", allow_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT#XCMUX=1", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_init_chat_script, nordic_nrf91_slm_init_chat_script_cmds, + abort_matches, modem_cellular_chat_callback_handler, 10); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_dial_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT#XCMUX=2", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_dial_chat_script, nordic_nrf91_slm_dial_chat_script_cmds, + dial_abort_matches, modem_cellular_chat_callback_handler, 10); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_periodic_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, + nordic_nrf91_slm_periodic_chat_script_cmds, abort_matches, + modem_cellular_chat_callback_handler, 4); +#endif + #define MODEM_CELLULAR_INST_NAME(name, inst) \ _CONCAT(_CONCAT(_CONCAT(name, _), DT_DRV_COMPAT), inst) @@ -2169,6 +2204,34 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ &modem_cellular_api); +#define MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM(inst) \ + MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 1500); \ + \ + static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ + .chat_delimiter = "\r\n", \ + .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ + }; \ + \ + static struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \ + .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ + .power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \ + .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_reset_gpios, {}), \ + .power_pulse_duration_ms = 100, \ + .reset_pulse_duration_ms = 100, \ + .startup_time_ms = 2000, \ + .shutdown_time_ms = 3000, \ + .init_chat_script = &nordic_nrf91_slm_init_chat_script, \ + .dial_chat_script = &nordic_nrf91_slm_dial_chat_script, \ + .periodic_chat_script = &nordic_nrf91_slm_periodic_chat_script, \ + }; \ + \ + PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ + \ + DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ + &MODEM_CELLULAR_INST_NAME(data, inst), \ + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); + #define DT_DRV_COMPAT quectel_bg95 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_QUECTEL_BG95) #undef DT_DRV_COMPAT @@ -2200,3 +2263,7 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #define DT_DRV_COMPAT telit_me910g1 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) #undef DT_DRV_COMPAT + +#define DT_DRV_COMPAT nordic_nrf91_slm +DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM) +#undef DT_DRV_COMPAT diff --git a/dts/bindings/modem/nordic,nrf91-slm.yaml b/dts/bindings/modem/nordic,nrf91-slm.yaml new file mode 100644 index 00000000000..3f06696197d --- /dev/null +++ b/dts/bindings/modem/nordic,nrf91-slm.yaml @@ -0,0 +1,9 @@ +description: Nordic nRF91 series running the Serial LTE Modem application + +compatible: "nordic,nrf91-slm" + +include: uart-device.yaml + +properties: + mdm-power-gpios: + type: phandle-array diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf new file mode 100644 index 00000000000..441a5395ca1 --- /dev/null +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf @@ -0,0 +1,16 @@ +CONFIG_UART_ASYNC_API=y + +# Align with the Serial LTE Modem (SLM) application. +CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE=1500 +CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=1500 + +# Allow large UART TXs to go through @115200. +CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS=200 + +# Prevent sockets getting offloaded to the modem. +CONFIG_NET_SOCKETS_OFFLOAD=n + +# Print logs and printk() output on uart0. +CONFIG_LOG=y +CONFIG_LOG_BACKEND_UART=y +CONFIG_MODEM_LOG_LEVEL_DBG=y diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay new file mode 100644 index 00000000000..44ce80601a1 --- /dev/null +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay @@ -0,0 +1,34 @@ +/ { + aliases { + modem = &modem; + }; +}; + +&uart1 { + compatible = "nordic,nrf-uarte"; + current-speed = <115200>; + hw-flow-control; + status = "okay"; + + pinctrl-0 = <&uart1_default_alt>; + + modem: modem { + compatible = "nordic,nrf91-slm"; + status = "okay"; + mdm-power-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + }; +}; + +&pinctrl { + uart1_default_alt: uart1_default_alt { + group1 { + psels = ; + bias-pull-up; + }; + group2 { + psels = , + , + ; + }; + }; +}; diff --git a/tests/drivers/build_all/modem/uart.dtsi b/tests/drivers/build_all/modem/uart.dtsi index 3d649a2ff60..08da2c325d3 100644 --- a/tests/drivers/build_all/modem/uart.dtsi +++ b/tests/drivers/build_all/modem/uart.dtsi @@ -70,3 +70,9 @@ test_telit_me910g1: telit_me910g1 { test_esp_at: esp_at { compatible = "espressif,esp-at"; }; + +test_nordic_nrf91_slm: nordic_nrf91_slm { + compatible = "nordic,nrf91-slm"; + + mdm-power-gpios = <&test_gpio 0 0>; +}; From fd85f70a2ee59ced961574b84f6dea1952dc4b72 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Mon, 12 Feb 2024 14:20:43 +0100 Subject: [PATCH 0529/2300] [nrf fromlist] samples: Bluetooth: Only connect to devices with rssi below -50 When the Bluetooth central samples in an open air environment it is very likely that there are multiple devices nearby with a received signal strength stronger than -70 dBm. To avoid connecting to the wrong device, make the check stricter. For tests using those samples, the NtNcable attenuation is changed from the default 60 dBm to 40 dBm to satisfy the new requirement. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68870 Signed-off-by: Rubin Gerritsen (cherry picked from commit 2c8d14ac87245a4fb15b6ccaee659e3205e67f65) --- samples/bluetooth/central/src/main.c | 2 +- samples/bluetooth/central_gatt_write/src/central_gatt_write.c | 2 +- samples/bluetooth/central_iso/src/main.c | 2 +- samples/bluetooth/central_multilink/src/central_multilink.c | 2 +- samples/bluetooth/mtu_update/central/src/central_mtu_update.c | 2 +- samples/bluetooth/unicast_audio_client/src/main.c | 2 +- .../unicast_audio_client/tests_scripts/unicast_client.sh | 2 +- .../bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh | 2 +- tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh | 2 +- tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/bluetooth/central/src/main.c b/samples/bluetooth/central/src/main.c index 0c88f647539..e6305ea70b6 100644 --- a/samples/bluetooth/central/src/main.c +++ b/samples/bluetooth/central/src/main.c @@ -43,7 +43,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -70) { + if (rssi < -50) { return; } diff --git a/samples/bluetooth/central_gatt_write/src/central_gatt_write.c b/samples/bluetooth/central_gatt_write/src/central_gatt_write.c index 385877ec280..fada73d9d94 100644 --- a/samples/bluetooth/central_gatt_write/src/central_gatt_write.c +++ b/samples/bluetooth/central_gatt_write/src/central_gatt_write.c @@ -35,7 +35,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, } /* connect only to devices in close proximity */ - if (rssi < -70) { + if (rssi < -50) { return; } diff --git a/samples/bluetooth/central_iso/src/main.c b/samples/bluetooth/central_iso/src/main.c index a0062fcfa73..20c848cb121 100644 --- a/samples/bluetooth/central_iso/src/main.c +++ b/samples/bluetooth/central_iso/src/main.c @@ -99,7 +99,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -70) { + if (rssi < -50) { return; } diff --git a/samples/bluetooth/central_multilink/src/central_multilink.c b/samples/bluetooth/central_multilink/src/central_multilink.c index ea9afbb977c..197021efe97 100644 --- a/samples/bluetooth/central_multilink/src/central_multilink.c +++ b/samples/bluetooth/central_multilink/src/central_multilink.c @@ -70,7 +70,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -70) { + if (rssi < -50) { return; } diff --git a/samples/bluetooth/mtu_update/central/src/central_mtu_update.c b/samples/bluetooth/mtu_update/central/src/central_mtu_update.c index 046446882dc..9db4b507d3c 100644 --- a/samples/bluetooth/mtu_update/central/src/central_mtu_update.c +++ b/samples/bluetooth/mtu_update/central/src/central_mtu_update.c @@ -131,7 +131,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -70) { + if (rssi < -50) { return; } diff --git a/samples/bluetooth/unicast_audio_client/src/main.c b/samples/bluetooth/unicast_audio_client/src/main.c index 3953bee99f0..974d4f825f8 100644 --- a/samples/bluetooth/unicast_audio_client/src/main.c +++ b/samples/bluetooth/unicast_audio_client/src/main.c @@ -480,7 +480,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -70) { + if (rssi < -50) { return; } diff --git a/tests/bsim/bluetooth/audio_samples/unicast_audio_client/tests_scripts/unicast_client.sh b/tests/bsim/bluetooth/audio_samples/unicast_audio_client/tests_scripts/unicast_client.sh index cc92cda1328..6387b68af7f 100755 --- a/tests/bsim/bluetooth/audio_samples/unicast_audio_client/tests_scripts/unicast_client.sh +++ b/tests/bsim/bluetooth/audio_samples/unicast_audio_client/tests_scripts/unicast_client.sh @@ -24,6 +24,6 @@ Execute ./bs_${BOARD}_tests_bsim_bluetooth_audio_samples_unicast_audio_client_pr -testid=unicast_client Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=20e6 $@ + -D=2 -sim_length=20e6 $@ -argschannel -at=40 wait_for_background_jobs #Wait for all programs in background and return != 0 if any fails diff --git a/tests/bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh b/tests/bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh index 087aa9385d4..255f6f4f9fa 100755 --- a/tests/bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh +++ b/tests/bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh @@ -21,6 +21,6 @@ Execute "$peripheral_exe" \ -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -RealEncryption=1 Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=60e6 $@ + -D=2 -sim_length=60e6 $@ -argschannel -at=40 wait_for_background_jobs diff --git a/tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh b/tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh index 1bdd2874916..cfbac8c313f 100755 --- a/tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh +++ b/tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh @@ -18,6 +18,6 @@ Execute ./bs_${BOARD}_tests_bsim_bluetooth_ll_multiple_id_prj_conf\ -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=4500e6 $@ + -D=2 -sim_length=4500e6 $@ -argschannel -at=40 wait_for_background_jobs 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 df82f924fb8..64a3dabac3b 100755 --- a/tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh +++ b/tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh @@ -17,6 +17,6 @@ Execute ./bs_${BOARD}_tests_bsim_bluetooth_ll_throughput_prj_conf\ -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=60e6 $@ + -D=2 -sim_length=60e6 $@ -argschannel -at=40 wait_for_background_jobs From c87c561053fc7afb91568b5c9255efba9ff186c2 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Mon, 12 Feb 2024 14:25:53 +0100 Subject: [PATCH 0530/2300] [nrf fromlist] samples: bluetooth: central_iso: Remove the CONFIG_BT_SMP=y Some SoCs in the nRF52 series do not support encrypting and decrypting isochronous channels packets. To make it easier to get started with the central_iso sample, we want to turn of SMP by default. Without this config, the sample still serves its purpose. Encrypting the isochronous channel is as simple as enabling BT_SMP. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68870 Signed-off-by: Rubin Gerritsen (cherry picked from commit b1980edde9dd32c5decc5c281c7afb5c10a24fce) --- samples/bluetooth/central_iso/prj.conf | 8 -------- 1 file changed, 8 deletions(-) diff --git a/samples/bluetooth/central_iso/prj.conf b/samples/bluetooth/central_iso/prj.conf index ab5a202401f..81264161a5c 100644 --- a/samples/bluetooth/central_iso/prj.conf +++ b/samples/bluetooth/central_iso/prj.conf @@ -1,11 +1,3 @@ CONFIG_BT=y CONFIG_LOG=y CONFIG_BT_ISO_CENTRAL=y -CONFIG_BT_SMP=y - -CONFIG_BT_KEYS_OVERWRITE_OLDEST=y -CONFIG_BT_SETTINGS=y -CONFIG_FLASH=y -CONFIG_FLASH_MAP=y -CONFIG_NVS=y -CONFIG_SETTINGS=y From 05038fd841144545c89a2ceea928e7fecd66c122 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Mon, 12 Feb 2024 14:29:42 +0100 Subject: [PATCH 0531/2300] [nrf fromlist] samples: bluetooth: iso: Extend sample documentation Extend the sample documentation for the central and peripheral iso samples so that they become easier to get started with. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68870 Signed-off-by: Rubin Gerritsen (cherry picked from commit eb59f8d92c7a3aedbf33fcbefb25665da5128a73) --- samples/bluetooth/central_iso/README.rst | 31 ++++++++++--- samples/bluetooth/peripheral_iso/README.rst | 48 +++++++++++++++++++-- 2 files changed, 68 insertions(+), 11 deletions(-) diff --git a/samples/bluetooth/central_iso/README.rst b/samples/bluetooth/central_iso/README.rst index 4965ea96b3b..13e6f56d778 100644 --- a/samples/bluetooth/central_iso/README.rst +++ b/samples/bluetooth/central_iso/README.rst @@ -6,12 +6,12 @@ Bluetooth: Central ISO Overview ******** -Application demonstrating a connected isochronous channel functional as the -central role, by scanning for peripheral devices and establishing a connection -to the first one with a strong enough signal. -The application then attempts to setup a connected isochronous channel and -starts sending data. +This sample demonstrates how to use an isochronous channel as a central. +The sample scans for a peripheral, establishes a connection, and sets up a connected isochronous channel to it. +Once the isochronous channel is connected, isochronous data is transferred to the peer device every 10 milliseconds. +It is recommended to run this sample together with the :ref:`Bluetooth: Peripheral ISO ` sample. +To run the sample with an encrypted isochronous channel, enable :kconfig:option:`CONFIG_BT_SMP`. Requirements ************ @@ -19,11 +19,28 @@ Requirements * BlueZ running on the host, or * A board with Bluetooth Low Energy 5.2 support * A Bluetooth Controller and board that supports setting - CONFIG_BT_CTLR_CENTRAL_ISO=y + :kconfig:option:`CONFIG_BT_CTLR_CENTRAL_ISO`. Building and Running ******************** This sample can be found under :zephyr_file:`samples/bluetooth/central_iso` in the Zephyr tree. -See :ref:`bluetooth samples section ` for details. +1. Start the application. + In the terminal window, check that it is scanning for other devices. + + Bluetooth initialized + Scanning successfully started + Device found: D3:3A:5D:F5:73:33 (random) (RSSI -78) + Device found: 70:7B:F4:2B:76:AD (random) (RSSI -68) + Device found: 65:CF:20:0D:CB:9D (random) (RSSI -82) + +2. Observe that the device connects. + + Connected: 65:CF:20:0D:CB:9D (random) + +3. Observe that the ISO channel is connected + + ISO Channel 0x200048f8 connected + +See :ref:`bluetooth samples section ` for more details. diff --git a/samples/bluetooth/peripheral_iso/README.rst b/samples/bluetooth/peripheral_iso/README.rst index 4d5d8c1b576..d877cf3a98f 100644 --- a/samples/bluetooth/peripheral_iso/README.rst +++ b/samples/bluetooth/peripheral_iso/README.rst @@ -6,9 +6,10 @@ Bluetooth: Peripheral ISO Overview ******** -Similar to the :ref:`Peripheral ` sample, except that this application enables -support for connected isochronous (ISO) channels. - +This sample demonstrates how to use isochronous channels as a peripheral. +The sample starts advertising, waits for a central to connect to it and set up an isochronous channel. +Once the isochronous channel is set up, received isochronous data is printed out. +It is recommended to run this sample together with the :ref:`Bluetooth: Central ISO ` sample. Requirements ************ @@ -23,4 +24,43 @@ Building and Running This sample can be found under :zephyr_file:`samples/bluetooth/peripheral_iso` in the Zephyr tree. -See :ref:`bluetooth samples section ` for details. +1. Start the application. + In the terminal window, check that it is advertising. + + Bluetooth initialized + Advertising successfully started + +2. Observe that the central device connects and sets up an isochronous channel. + + Connected E8:DC:8D:B3:47:69 (random) + Incoming request from 0x20002260 + ISO Channel 0x20000698 connected + +3. Observe that incoming data is printed. + + Incoming data channel 0x20000698 len 1 + 00 + Incoming data channel 0x20000698 len 2 + 0001 + Incoming data channel 0x20000698 len 3 + 000102 + Incoming data channel 0x20000698 len 4 + 00010203 + Incoming data channel 0x20000698 len 5 + 0001020304 + Incoming data channel 0x20000698 len 6 + 000102030405 + Incoming data channel 0x20000698 len 7 + 000102...040506 + Incoming data channel 0x20000698 len 8 + 000102...050607 + Incoming data channel 0x20000698 len 9 + 000102...060708 + Incoming data channel 0x20000698 len 10 + 000102...070809 + Incoming data channel 0x20000698 len 11 + 000102...08090a + Incoming data channel 0x20000698 len 12 + 000102...090a0b + +See :ref:`bluetooth samples section ` for more details. From 4ad91289b1da1e485404ef9fbf02992f1e22d22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Fri, 19 Jan 2024 09:11:18 +0100 Subject: [PATCH 0532/2300] [nrf fromtree] west.yml: Update uoscore-edhoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit from 2.2.1 to 3.0.2 Signed-off-by: Øyvind Rønningstad (cherry picked from commit 33c84d8af063586fd280882add96951a309fa03e) (cherry picked from commit 3edb81c23e2fa3076bce0cac4278f119f99dc0b9) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 200690b6f3e..898783ecdba 100644 --- a/west.yml +++ b/west.yml @@ -332,7 +332,7 @@ manifest: groups: - tee - name: uoscore-uedhoc - revision: 5fe2cb613bd7e4590bd1b00c2adf181ac0229379 + revision: 5024d8c98b3864c6698f0195a53e19c484bc8cd3 path: modules/lib/uoscore-uedhoc - name: zcbor revision: 67fd8bb88d3136738661fa8bb5f9989103f4599e From 48b1c47eb18490ef99f6a4e191390e0885fdc172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Wed, 10 Jan 2024 09:09:41 +0100 Subject: [PATCH 0533/2300] [nrf fromtree] west.yml: Update zcbor to 0.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit as well as uoscore-uedhoc and MCUboot Highlights of zcbor 0.8.0: - Add support for unordered maps - Performance improvements - Naming improvements for generated code - Bugfixes Update MCUboot and uoscore-uedhoc to bring in changes related to zcbor 0.8.0. Signed-off-by: Øyvind Rønningstad (cherry picked from commit 0786e523da4b247dd8f60cbb5da4aea2f954a021) (cherry picked from commit 9293021b1c06e63fe04874d95ef3388dc92400a3) --- west.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/west.yml b/west.yml index 898783ecdba..18e4ba0ab58 100644 --- a/west.yml +++ b/west.yml @@ -282,7 +282,7 @@ manifest: groups: - crypto - name: mcuboot - revision: 0c0470e294dcfb52aab92299356a5f3caa0aa52b + revision: f09e205b1e4a8d2bc3f50dffa7960d6ccd14df59 path: bootloader/mcuboot - name: mipi-sys-t path: modules/debug/mipi-sys-t @@ -332,10 +332,10 @@ manifest: groups: - tee - name: uoscore-uedhoc - revision: 5024d8c98b3864c6698f0195a53e19c484bc8cd3 + revision: 150f4eb2955eaf36ac0f9519d4f4f58d5ade5740 path: modules/lib/uoscore-uedhoc - name: zcbor - revision: 67fd8bb88d3136738661fa8bb5f9989103f4599e + revision: dbe20afd00b3ddd6956f4b47f5df202bb49a8707 path: modules/lib/zcbor self: From e17704a05e5ec815839d5fbe3c19b708974e508a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Wed, 24 Jan 2024 15:20:57 +0100 Subject: [PATCH 0534/2300] [nrf fromtree] scripts: requirements-extra.txt: Update zcbor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit from 0.6.0 to 0.8.0 If people are using the zcbor script for code generation, it needs to be at the latest version Signed-off-by: Øyvind Rønningstad (cherry picked from commit 5d95776514df12a9dbfc239dd05f05e78ed461ed) (cherry picked from commit 73ddbd6e1030cf333d27322d6c7cb261a62dc608) --- scripts/requirements-extras.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/requirements-extras.txt b/scripts/requirements-extras.txt index f210f069de9..99fa4f16cf4 100644 --- a/scripts/requirements-extras.txt +++ b/scripts/requirements-extras.txt @@ -32,4 +32,4 @@ PyGithub graphviz # used to generate CBOR encoders and decoders, e.g. lwm2m_senml_cbor. -zcbor>=0.6.0 +zcbor>=0.8.0 From c9adead115725cbf5246ac7ad0bb4a01a5bb751e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Thu, 11 Jan 2024 14:18:21 +0100 Subject: [PATCH 0535/2300] [nrf fromtree] modules: zcbor: Add config CONFIG_ZCBOR_MAX_STR_LEN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For use with zcbor_tstr_put_term() which needs a maximum string length. Signed-off-by: Øyvind Rønningstad (cherry picked from commit ea4c12df8229519961b27aa6b4af4e5205cfe27e) (cherry picked from commit e458adad772684fe0ff5de48d25f8771ad419fd1) --- modules/zcbor/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/zcbor/Kconfig b/modules/zcbor/Kconfig index 1b3fd15d5e3..655fb2ed2a8 100644 --- a/modules/zcbor/Kconfig +++ b/modules/zcbor/Kconfig @@ -33,4 +33,11 @@ config ZCBOR_ASSERT config ZCBOR_BIG_ENDIAN def_bool BIG_ENDIAN +config ZCBOR_MAX_STR_LEN + int "Default max length when calling zcbor_tstr_put_term()" + default 256 + help + This can be manually used if no other value is readily available, but + using this is discouraged. + endif # ZCBOR From 8520d89fba3a7a5bea13c71e5caee5a3611c511f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Wed, 10 Jan 2024 10:00:53 +0100 Subject: [PATCH 0536/2300] [nrf fromtree] lwm2m: Adapt to zcbor 0.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regenerate from CDDL, update patch, fix references in code. Signed-off-by: Øyvind Rønningstad (cherry picked from commit 1bbb0a9ddb40f1c7ca5af66b19f3cb279fa2aa65) (cherry picked from commit b85a6b635d997f37bf5f546aaa2fbc007e35b88b) --- subsys/net/lib/lwm2m/lwm2m_rw_cbor.c | 22 +- subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c | 144 +++++----- subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch | 218 +++++---------- .../net/lib/lwm2m/lwm2m_senml_cbor_decode.c | 220 ++++++++------- .../net/lib/lwm2m/lwm2m_senml_cbor_decode.h | 2 +- .../net/lib/lwm2m/lwm2m_senml_cbor_encode.c | 254 ++++++++++-------- .../net/lib/lwm2m/lwm2m_senml_cbor_encode.h | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h | 116 ++++---- 8 files changed, 465 insertions(+), 513 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_rw_cbor.c b/subsys/net/lib/lwm2m/lwm2m_rw_cbor.c index daa37d3b4ba..3b35d579569 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rw_cbor.c +++ b/subsys/net/lib/lwm2m/lwm2m_rw_cbor.c @@ -66,7 +66,7 @@ static int put_time(struct lwm2m_output_context *out, struct lwm2m_obj_path *pat ZCBOR_STATE_E(states, 0, CPKT_BUF_W_PTR(out->out_cpkt), CPKT_BUF_W_SIZE(out->out_cpkt), 1); /* Are tags required? V1.1 leaves this unspecified but some servers require tags */ - ret = zcbor_tag_encode(states, ZCBOR_TAG_TIME_TSTR); + ret = zcbor_tag_put(states, ZCBOR_TAG_TIME_TSTR); if (!ret) { LOG_ERR("unable to encode date/time string tag"); @@ -77,7 +77,7 @@ static int put_time(struct lwm2m_output_context *out, struct lwm2m_obj_path *pat out->out_cpkt->offset += tag_sz; - ret = zcbor_tstr_put_term(states, time_str); + ret = zcbor_tstr_put_term(states, time_str, sizeof(time_str)); if (!ret) { LOG_ERR("unable to encode date/time string"); return -ENOMEM; @@ -232,7 +232,7 @@ static int put_objlnk(struct lwm2m_output_context *out, struct lwm2m_obj_path *p static int get_s64(struct lwm2m_input_context *in, int64_t *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); if (!zcbor_int64_decode(states, value)) { LOG_WRN("unable to decode a 64-bit integer value"); @@ -248,7 +248,7 @@ static int get_s64(struct lwm2m_input_context *in, int64_t *value) static int get_s32(struct lwm2m_input_context *in, int32_t *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); if (!zcbor_int32_decode(states, value)) { LOG_WRN("unable to decode a 32-bit integer value, err: %d", @@ -265,7 +265,7 @@ static int get_s32(struct lwm2m_input_context *in, int32_t *value) static int get_float(struct lwm2m_input_context *in, double *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); if (!zcbor_float_decode(states, value)) { LOG_ERR("unable to decode a floating-point value"); @@ -284,7 +284,7 @@ static int get_string(struct lwm2m_input_context *in, uint8_t *value, size_t buf struct zcbor_string hndl; int len; - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); if (!zcbor_tstr_decode(states, &hndl)) { LOG_WRN("unable to decode a string"); @@ -313,7 +313,7 @@ static int get_time_string(struct lwm2m_input_context *in, int64_t *value) char time_str[sizeof("4294967295")] = { 0 }; struct zcbor_string hndl = { .value = time_str, .len = sizeof(time_str) - 1 }; - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); if (!zcbor_tstr_decode(states, &hndl)) { return -EBADMSG; @@ -331,7 +331,7 @@ static int get_time_string(struct lwm2m_input_context *in, int64_t *value) */ static int get_time_numerical(struct lwm2m_input_context *in, int64_t *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); if (!zcbor_int64_decode(states, value)) { LOG_WRN("unable to decode seconds since Epoch"); @@ -350,7 +350,7 @@ static int get_time(struct lwm2m_input_context *in, time_t *value) bool success; int64_t temp64; - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); success = zcbor_tag_decode(states, &tag); @@ -400,7 +400,7 @@ static int get_time(struct lwm2m_input_context *in, time_t *value) static int get_bool(struct lwm2m_input_context *in, bool *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); if (!zcbor_bool_decode(states, value)) { LOG_WRN("unable to decode a boolean value"); @@ -420,7 +420,7 @@ static int get_opaque(struct lwm2m_input_context *in, uint8_t *value, size_t buf struct zcbor_string_fragment hndl = { 0 }; int ret; - ZCBOR_STATE_D(states, 1, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); + ZCBOR_STATE_D(states, 1, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); /* Get the CBOR header only on first read. */ if (opaque->remaining == 0) { diff --git a/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c b/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c index dd963aa0583..6c20024bbde 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c +++ b/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c @@ -81,12 +81,12 @@ K_MUTEX_DEFINE(fd_mtx); #define GET_CBOR_FD_NAME(fd) ((fd)->names[(fd)->name_cnt]) /* Get the current record */ #define GET_CBOR_FD_REC(fd) \ - &((fd)->input._lwm2m_senml__record[(fd)->input._lwm2m_senml__record_count]) + &((fd)->input.lwm2m_senml_record_m[(fd)->input.lwm2m_senml_record_m_count]) /* Get a record */ -#define GET_IN_FD_REC_I(fd, i) &((fd)->dcd._lwm2m_senml__record[i]) +#define GET_IN_FD_REC_I(fd, i) &((fd)->dcd.lwm2m_senml_record_m[i]) /* Consume the current record */ #define CONSUME_CBOR_FD_REC(fd) \ - &((fd)->input._lwm2m_senml__record[(fd)->input._lwm2m_senml__record_count++]) + &((fd)->input.lwm2m_senml_record_m[(fd)->input.lwm2m_senml_record_m_count++]) /* Get CBOR output formatter data */ #define LWM2M_OFD_CBOR(octx) ((struct cbor_out_fmt_data *)engine_get_out_user_data(octx)) @@ -131,7 +131,7 @@ static int fmt_range_check(struct cbor_out_fmt_data *fd) { if (fd->name_cnt >= CONFIG_LWM2M_RW_SENML_CBOR_RECORDS || fd->objlnk_cnt >= CONFIG_LWM2M_RW_SENML_CBOR_RECORDS || - fd->input._lwm2m_senml__record_count >= CONFIG_LWM2M_RW_SENML_CBOR_RECORDS) { + fd->input.lwm2m_senml_record_m_count >= CONFIG_LWM2M_RW_SENML_CBOR_RECORDS) { LOG_ERR("CONFIG_LWM2M_RW_SENML_CBOR_RECORDS too small"); return -ENOMEM; } @@ -161,9 +161,9 @@ static int put_basename(struct lwm2m_output_context *out, struct lwm2m_obj_path /* Tell CBOR encoder where to find the name */ struct record *record = GET_CBOR_FD_REC(fd); - record->_record_bn._record_bn.value = basename; - record->_record_bn._record_bn.len = len; - record->_record_bn_present = 1; + record->record_bn.record_bn.value = basename; + record->record_bn.record_bn.len = len; + record->record_bn_present = 1; if ((len < sizeof("/0/0") - 1) || (len >= SENML_MAX_NAME_SIZE)) { __ASSERT_NO_MSG(false); @@ -190,7 +190,7 @@ static int put_end(struct lwm2m_output_context *out, struct lwm2m_obj_path *path size_t len; struct lwm2m_senml *input = &(LWM2M_OFD_CBOR(out)->input); - if (!input->_lwm2m_senml__record_count) { + if (!input->lwm2m_senml_record_m_count) { len = put_empty_array(out); return len; @@ -258,9 +258,9 @@ static int put_begin_r(struct lwm2m_output_context *out, struct lwm2m_obj_path * /* Tell CBOR encoder where to find the name */ struct record *record = GET_CBOR_FD_REC(fd); - record->_record_n._record_n.value = name; - record->_record_n._record_n.len = len; - record->_record_n_present = 1; + record->record_n.record_n.value = name; + record->record_n.record_n.len = len; + record->record_n_present = 1; /* Makes possible to use same slot for storing r/ri name combination. * No need to increase the name count if an existing name has been used @@ -287,12 +287,12 @@ static int put_data_timestamp(struct lwm2m_output_context *out, time_t value) out_record = GET_CBOR_FD_REC(fd); if (fd->basetime) { - out_record->_record_t._record_t = value - fd->basetime; - out_record->_record_t_present = 1; + out_record->record_t.record_t = value - fd->basetime; + out_record->record_t_present = 1; } else { fd->basetime = value; - out_record->_record_bt._record_bt = value; - out_record->_record_bt_present = 1; + out_record->record_bt.record_bt = value; + out_record->record_bt_present = 1; } return 0; @@ -332,9 +332,9 @@ static int put_begin_ri(struct lwm2m_output_context *out, struct lwm2m_obj_path } /* Tell CBOR encoder where to find the name */ - record->_record_n._record_n.value = name; - record->_record_n._record_n.len = len; - record->_record_n_present = 1; + record->record_n.record_n.value = name; + record->record_n.record_n.len = len; + record->record_n_present = 1; /* No need to increase the name count if an existing name has been used */ if (name == GET_CBOR_FD_NAME(fd)) { @@ -353,7 +353,7 @@ static int put_name_nth_ri(struct lwm2m_output_context *out, struct lwm2m_obj_pa /* With the first ri the resource name (and ri name) are already in place*/ if (path->res_inst_id > 0) { ret = put_begin_ri(out, path); - } else if (record && record->_record_t_present) { + } else if (record && record->record_t_present) { /* Name need to be add for each time serialized record */ ret = put_begin_r(out, path); } @@ -372,9 +372,9 @@ static int put_value(struct lwm2m_output_context *out, struct lwm2m_obj_path *pa struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->_record_union._record_union_choice = _union_vi; - record->_record_union._union_vi = value; - record->_record_union_present = 1; + record->record_union.record_union_choice = union_vi_c; + record->record_union.union_vi = value; + record->record_union_present = 1; return 0; } @@ -410,9 +410,9 @@ static int put_time(struct lwm2m_output_context *out, struct lwm2m_obj_path *pat struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->_record_union._record_union_choice = _union_vi; - record->_record_union._union_vi = (int64_t)value; - record->_record_union_present = 1; + record->record_union.record_union_choice = union_vi_c; + record->record_union.union_vi = (int64_t)value; + record->record_union_present = 1; return 0; } @@ -428,9 +428,9 @@ static int put_float(struct lwm2m_output_context *out, struct lwm2m_obj_path *pa struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->_record_union._record_union_choice = _union_vf; - record->_record_union._union_vf = *value; - record->_record_union_present = 1; + record->record_union.record_union_choice = union_vf_c; + record->record_union.union_vf = *value; + record->record_union_present = 1; return 0; } @@ -447,10 +447,10 @@ static int put_string(struct lwm2m_output_context *out, struct lwm2m_obj_path *p struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->_record_union._record_union_choice = _union_vs; - record->_record_union._union_vs.value = buf; - record->_record_union._union_vs.len = buflen; - record->_record_union_present = 1; + record->record_union.record_union_choice = union_vs_c; + record->record_union.union_vs.value = buf; + record->record_union.union_vs.len = buflen; + record->record_union_present = 1; return 0; } @@ -466,9 +466,9 @@ static int put_bool(struct lwm2m_output_context *out, struct lwm2m_obj_path *pat struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->_record_union._record_union_choice = _union_vb; - record->_record_union._union_vb = value; - record->_record_union_present = 1; + record->record_union.record_union_choice = union_vb_c; + record->record_union.union_vb = value; + record->record_union_present = 1; return 0; } @@ -485,10 +485,10 @@ static int put_opaque(struct lwm2m_output_context *out, struct lwm2m_obj_path *p struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->_record_union._record_union_choice = _union_vd; - record->_record_union._union_vd.value = buf; - record->_record_union._union_vd.len = buflen; - record->_record_union_present = 1; + record->record_union.record_union_choice = union_vd_c; + record->record_union.union_vd.value = buf; + record->record_union.union_vd.len = buflen; + record->record_union_present = 1; return 0; } @@ -522,10 +522,10 @@ static int put_objlnk(struct lwm2m_output_context *out, struct lwm2m_obj_path *p struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->_record_union._record_union_choice = _union_vlo; - record->_record_union._union_vlo.value = objlink_buf; - record->_record_union._union_vlo.len = objlnk_len; - record->_record_union_present = 1; + record->record_union.record_union_choice = union_vlo_c; + record->record_union.union_vlo.value = objlink_buf; + record->record_union.union_vlo.len = objlnk_len; + record->record_union_present = 1; fd->objlnk_cnt++; @@ -548,14 +548,14 @@ static int get_opaque(struct lwm2m_input_context *in, return -EINVAL; } - opaque->len = fd->current->_record_union._union_vd.len; + opaque->len = fd->current->record_union.union_vd.len; if (buflen < opaque->len) { LOG_DBG("Write opaque failed, no buffer space"); return -ENOMEM; } - dest = memcpy(value, fd->current->_record_union._union_vd.value, opaque->len); + dest = memcpy(value, fd->current->record_union.union_vd.value, opaque->len); *last_block = true; } else { LOG_DBG("Blockwise transfer not supported with SenML CBOR"); @@ -574,7 +574,7 @@ static int get_s32(struct lwm2m_input_context *in, int32_t *value) return -EINVAL; } - *value = fd->current->_record_union._union_vi; + *value = fd->current->record_union.union_vi; fd->current = NULL; return 0; @@ -589,7 +589,7 @@ static int get_s64(struct lwm2m_input_context *in, int64_t *value) return -EINVAL; } - *value = fd->current->_record_union._union_vi; + *value = fd->current->record_union.union_vi; fd->current = NULL; return 0; @@ -615,7 +615,7 @@ static int get_float(struct lwm2m_input_context *in, double *value) return -EINVAL; } - *value = fd->current->_record_union._union_vf; + *value = fd->current->record_union.union_vf; fd->current = NULL; return 0; @@ -631,9 +631,9 @@ static int get_string(struct lwm2m_input_context *in, uint8_t *buf, size_t bufle return -EINVAL; } - len = MIN(buflen-1, fd->current->_record_union._union_vs.len); + len = MIN(buflen-1, fd->current->record_union.union_vs.len); - memcpy(buf, fd->current->_record_union._union_vs.value, len); + memcpy(buf, fd->current->record_union.union_vs.value, len); buf[len] = '\0'; fd->current = NULL; @@ -698,7 +698,7 @@ static int get_bool(struct lwm2m_input_context *in, bool *value) return -EINVAL; } - *value = fd->current->_record_union._union_vb; + *value = fd->current->record_union.union_vb; fd->current = NULL; return 0; @@ -727,9 +727,9 @@ static int do_write_op_item(struct lwm2m_message *msg, struct record *rec) } /* If there's no name then the basename forms the path */ - if (rec->_record_n_present) { - len = MIN(sizeof(name) - 1, rec->_record_n._record_n.len); - snprintk(name, len + 1, "%s", rec->_record_n._record_n.value); + if (rec->record_n_present) { + len = MIN(sizeof(name) - 1, rec->record_n.record_n.len); + snprintk(name, len + 1, "%s", rec->record_n.record_n.value); } /* Form fully qualified path name */ @@ -853,29 +853,29 @@ static uint8_t parse_composite_read_paths(struct lwm2m_message *msg, msg->in.offset += isize; - for (int idx = 0; idx < fd->dcd._lwm2m_senml__record_count; idx++) { + for (int idx = 0; idx < fd->dcd.lwm2m_senml_record_m_count; idx++) { /* Where to find the basenames and names */ struct record *record = GET_IN_FD_REC_I(fd, idx); /* Set null terminated effective basename */ - if (record->_record_bn_present) { - len = MIN(sizeof(basename)-1, record->_record_bn._record_bn.len); - snprintk(basename, len + 1, "%s", record->_record_bn._record_bn.value); + if (record->record_bn_present) { + len = MIN(sizeof(basename)-1, record->record_bn.record_bn.len); + snprintk(basename, len + 1, "%s", record->record_bn.record_bn.value); basename[len] = '\0'; } /* Best effort with read, skip if no proper name is available */ - if (!record->_record_n_present) { + if (!record->record_n_present) { if (strcmp(basename, "") == 0) { continue; } } /* Set null terminated name */ - if (record->_record_n_present) { - len = MIN(sizeof(name)-1, record->_record_n._record_n.len); - snprintk(name, len + 1, "%s", record->_record_n._record_n.value); + if (record->record_n_present) { + len = MIN(sizeof(name)-1, record->record_n.record_n.len); + snprintk(name, len + 1, "%s", record->record_n.record_n.value); name[len] = '\0'; } @@ -979,30 +979,30 @@ int do_write_op_senml_cbor(struct lwm2m_message *msg) msg->in.offset += decoded_sz; - for (int idx = 0; idx < fd->dcd._lwm2m_senml__record_count; idx++) { + for (int idx = 0; idx < fd->dcd.lwm2m_senml_record_m_count; idx++) { - struct record *rec = &fd->dcd._lwm2m_senml__record[idx]; + struct record *rec = &fd->dcd.lwm2m_senml_record_m[idx]; /* Basename applies for current and succeeding records */ - if (rec->_record_bn_present) { + if (rec->record_bn_present) { int len = MIN(sizeof(fd->basename) - 1, - rec->_record_bn._record_bn.len); + rec->record_bn.record_bn.len); - snprintk(fd->basename, len + 1, "%s", rec->_record_bn._record_bn.value); + snprintk(fd->basename, len + 1, "%s", rec->record_bn.record_bn.value); goto write; } /* Keys' lexicographic order differ from the default */ - for (int jdx = 0; jdx < rec->_record__key_value_pair_count; jdx++) { + for (int jdx = 0; jdx < rec->record_key_value_pair_m_count; jdx++) { struct key_value_pair *kvp = - &(rec->_record__key_value_pair[jdx]._record__key_value_pair); + &(rec->record_key_value_pair_m[jdx].record_key_value_pair_m); - if (kvp->_key_value_pair_key == lwm2m_senml_cbor_key_bn) { + if (kvp->key_value_pair_key == lwm2m_senml_cbor_key_bn) { int len = MIN(sizeof(fd->basename) - 1, - kvp->_key_value_pair._value_tstr.len); + kvp->key_value_pair.value_tstr.len); snprintk(fd->basename, len + 1, "%s", - kvp->_key_value_pair._value_tstr.value); + kvp->key_value_pair.value_tstr.value); break; } } diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch b/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch index 48b984aafac..81ec06bab8b 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch @@ -1,94 +1,59 @@ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c -index f97f0ebb2d..1c1233d616 100644 +index c12f477cce..f41b81275d 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -15,9 +15,6 @@ - #include "zcbor_decode.h" +@@ -16,10 +16,6 @@ #include "lwm2m_senml_cbor_decode.h" + #include "zcbor_print.h" -#if DEFAULT_MAX_QTY != 99 -#error "The type file was generated with a different default_max_qty than this file" -#endif - +- static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *result); static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *result); -@@ -52,7 +49,7 @@ static bool decode_repeated_record_bt( - - bool tmp_result = ((((zcbor_int32_expect(state, (-3)))) - && (zcbor_int64_decode(state, (&(*result)._record_bt))) -- && ((((*result)._record_bt >= -9223372036854775807LL) -+ && ((((*result)._record_bt >= INT64_MIN) - && ((*result)._record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); - - if (!tmp_result) -@@ -82,7 +79,7 @@ static bool decode_repeated_record_t( - - bool tmp_result = ((((zcbor_uint32_expect(state, (6)))) - && (zcbor_int64_decode(state, (&(*result)._record_t))) -- && ((((*result)._record_t >= -9223372036854775807LL) -+ && ((((*result)._record_t >= INT64_MIN) - && ((*result)._record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); - - if (!tmp_result) -@@ -100,7 +97,7 @@ static bool decode_repeated_record_union( - - bool tmp_result = (((zcbor_union_start_code(state) && (int_res = (((((zcbor_uint32_expect_union(state, (2)))) - && (zcbor_int64_decode(state, (&(*result)._union_vi))) -- && ((((*result)._union_vi >= -9223372036854775807LL) -+ && ((((*result)._union_vi >= INT64_MIN) - && ((*result)._union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && (((*result)._record_union_choice = _union_vi), true)) - || ((((zcbor_uint32_expect_union(state, (2)))) - && (zcbor_float_decode(state, (&(*result)._union_vf)))) && (((*result)._record_union_choice = _union_vf), true)) -@@ -128,7 +125,7 @@ static bool decode_value( - bool tmp_result = (((zcbor_union_start_code(state) && (int_res = ((((zcbor_tstr_decode(state, (&(*result)._value_tstr)))) && (((*result)._value_choice = _value_tstr), true)) - || (((zcbor_bstr_decode(state, (&(*result)._value_bstr)))) && (((*result)._value_choice = _value_bstr), true)) - || (((zcbor_int64_decode(state, (&(*result)._value_int))) -- && ((((*result)._value_int >= -9223372036854775807LL) -+ && ((((*result)._value_int >= INT64_MIN) - && ((*result)._value_int <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && (((*result)._value_choice = _value_int), true)) - || (((zcbor_float_decode(state, (&(*result)._value_float)))) && (((*result)._value_choice = _value_float), true)) - || (((zcbor_bool_decode(state, (&(*result)._value_bool)))) && (((*result)._value_choice = _value_bool), true))), zcbor_union_end_code(state), int_res)))); -@@ -176,7 +173,7 @@ static bool decode_record( - && zcbor_present_decode(&((*result)._record_n_present), (zcbor_decoder_t *)decode_repeated_record_n, state, (&(*result)._record_n)) - && zcbor_present_decode(&((*result)._record_t_present), (zcbor_decoder_t *)decode_repeated_record_t, state, (&(*result)._record_t)) - && zcbor_present_decode(&((*result)._record_union_present), (zcbor_decoder_t *)decode_repeated_record_union, state, (&(*result)._record_union)) -- && zcbor_multi_decode(0, 5, &(*result)._record__key_value_pair_count, (zcbor_decoder_t *)decode_repeated_record__key_value_pair, state, (&(*result)._record__key_value_pair), sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); -+ && zcbor_multi_decode(0, ZCBOR_ARRAY_SIZE(result->_record__key_value_pair), &(*result)._record__key_value_pair_count, (zcbor_decoder_t *)decode_repeated_record__key_value_pair, state, (&(*result)._record__key_value_pair), sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); - - if (!tmp_result) - zcbor_trace(); -@@ -189,7 +186,7 @@ static bool decode_lwm2m_senml( + static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *result); +@@ -209,7 +205,7 @@ static bool decode_record( + && zcbor_present_decode(&((*result).record_n_present), (zcbor_decoder_t *)decode_repeated_record_n, state, (&(*result).record_n)) + && zcbor_present_decode(&((*result).record_t_present), (zcbor_decoder_t *)decode_repeated_record_t, state, (&(*result).record_t)) + && zcbor_present_decode(&((*result).record_union_present), (zcbor_decoder_t *)decode_repeated_record_union, state, (&(*result).record_union)) +- && zcbor_multi_decode(0, 5, &(*result).record_key_value_pair_m_count, (zcbor_decoder_t *)decode_repeated_record_key_value_pair_m, state, (&(*result).record_key_value_pair_m), sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); ++ && zcbor_multi_decode(0, ZCBOR_ARRAY_SIZE(result->record_key_value_pair_m), &(*result).record_key_value_pair_m_count, (zcbor_decoder_t *)decode_repeated_record_key_value_pair_m, state, (&(*result).record_key_value_pair_m), sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); + + if (!tmp_result) { + zcbor_trace_file(state); +@@ -226,7 +222,7 @@ static bool decode_lwm2m_senml( { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); -- bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(1, 99, &(*result)._lwm2m_senml__record_count, (zcbor_decoder_t *)decode_record, state, (&(*result)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); -+ bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(1, ZCBOR_ARRAY_SIZE(result->_lwm2m_senml__record), &(*result)._lwm2m_senml__record_count, (zcbor_decoder_t *)decode_record, state, (&(*result)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); +- bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(1, 99, &(*result).lwm2m_senml_record_m_count, (zcbor_decoder_t *)decode_record, state, (&(*result).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); ++ bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(1, ZCBOR_ARRAY_SIZE(result->lwm2m_senml_record_m), &(*result).lwm2m_senml_record_m_count, (zcbor_decoder_t *)decode_record, state, (&(*result).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); - if (!tmp_result) - zcbor_trace(); + if (!tmp_result) { + zcbor_trace_file(state); diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h -index cb5d5c9695..7db7ed0591 100644 +index a36f8782c6..b913fb78e9 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -21,10 +21,6 @@ +@@ -21,11 +21,6 @@ extern "C" { #endif @@ -96,25 +61,26 @@ index cb5d5c9695..7db7ed0591 100644 -#error "The type file was generated with a different default_max_qty than this file" -#endif - - +- int cbor_decode_lwm2m_senml( - const uint8_t *payload, size_t payload_len, + const uint8_t *payload, size_t payload_len, + struct lwm2m_senml *result, diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c -index 982cfca6c3..afdc6a32f7 100644 +index 94926c531f..5521917853 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -15,10 +15,6 @@ - #include "zcbor_encode.h" +@@ -16,10 +16,6 @@ #include "lwm2m_senml_cbor_encode.h" + #include "zcbor_print.h" -#if DEFAULT_MAX_QTY != 99 -#error "The type file was generated with a different default_max_qty than this file" @@ -123,80 +89,44 @@ index 982cfca6c3..afdc6a32f7 100644 static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_bn *input); static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_bt *input); static bool encode_repeated_record_n(zcbor_state_t *state, const struct record_n *input); -@@ -51,7 +47,7 @@ static bool encode_repeated_record_bt( - zcbor_print("%s\r\n", __func__); - - bool tmp_result = ((((zcbor_int32_put(state, (-3)))) -- && ((((*input)._record_bt >= -9223372036854775807LL) -+ && ((((*input)._record_bt >= INT64_MIN) - && ((*input)._record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) - && (zcbor_int64_encode(state, (&(*input)._record_bt))))); - -@@ -81,7 +77,7 @@ static bool encode_repeated_record_t( - zcbor_print("%s\r\n", __func__); - - bool tmp_result = ((((zcbor_uint32_put(state, (6)))) -- && ((((*input)._record_t >= -9223372036854775807LL) -+ && ((((*input)._record_t >= INT64_MIN) - && ((*input)._record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) - && (zcbor_int64_encode(state, (&(*input)._record_t))))); - -@@ -98,7 +94,7 @@ static bool encode_repeated_record_union( - struct zcbor_string tmp_str; - - bool tmp_result = (((((*input)._record_union_choice == _union_vi) ? (((zcbor_uint32_put(state, (2)))) -- && ((((*input)._union_vi >= -9223372036854775807LL) -+ && ((((*input)._union_vi >= INT64_MIN) - && ((*input)._union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) - && (zcbor_int64_encode(state, (&(*input)._union_vi)))) - : (((*input)._record_union_choice == _union_vf) ? (((zcbor_uint32_put(state, (2)))) -@@ -126,7 +122,7 @@ static bool encode_value( - - bool tmp_result = (((((*input)._value_choice == _value_tstr) ? ((zcbor_tstr_encode(state, (&(*input)._value_tstr)))) - : (((*input)._value_choice == _value_bstr) ? ((zcbor_bstr_encode(state, (&(*input)._value_bstr)))) -- : (((*input)._value_choice == _value_int) ? (((((*input)._value_int >= -9223372036854775807LL) -+ : (((*input)._value_choice == _value_int) ? (((((*input)._value_int >= INT64_MIN) - && ((*input)._value_int <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) - && (zcbor_int64_encode(state, (&(*input)._value_int)))) - : (((*input)._value_choice == _value_float) ? ((zcbor_float64_encode(state, (&(*input)._value_float)))) -@@ -171,12 +167,12 @@ static bool encode_record( +@@ -204,12 +200,12 @@ static bool encode_record( { - zcbor_print("%s\r\n", __func__); - -- bool tmp_result = (((zcbor_map_start_encode(state, 10) && ((zcbor_present_encode(&((*input)._record_bn_present), (zcbor_encoder_t *)encode_repeated_record_bn, state, (&(*input)._record_bn)) -+ bool tmp_result = (((zcbor_map_start_encode(state, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair)) && ((zcbor_present_encode(&((*input)._record_bn_present), (zcbor_encoder_t *)encode_repeated_record_bn, state, (&(*input)._record_bn)) - && zcbor_present_encode(&((*input)._record_bt_present), (zcbor_encoder_t *)encode_repeated_record_bt, state, (&(*input)._record_bt)) - && zcbor_present_encode(&((*input)._record_n_present), (zcbor_encoder_t *)encode_repeated_record_n, state, (&(*input)._record_n)) - && zcbor_present_encode(&((*input)._record_t_present), (zcbor_encoder_t *)encode_repeated_record_t, state, (&(*input)._record_t)) - && zcbor_present_encode(&((*input)._record_union_present), (zcbor_encoder_t *)encode_repeated_record_union, state, (&(*input)._record_union)) -- && zcbor_multi_encode_minmax(0, 5, &(*input)._record__key_value_pair_count, (zcbor_encoder_t *)encode_repeated_record__key_value_pair, state, (&(*input)._record__key_value_pair), sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, 10)))); -+ && zcbor_multi_encode_minmax(0, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair), &(*input)._record__key_value_pair_count, (zcbor_encoder_t *)encode_repeated_record__key_value_pair, state, (&(*input)._record__key_value_pair), sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair))))); - - if (!tmp_result) - zcbor_trace(); -@@ -189,7 +185,7 @@ static bool encode_lwm2m_senml( + zcbor_log("%s\r\n", __func__); + +- bool tmp_result = (((zcbor_map_start_encode(state, 10) && (((!(*input).record_bn_present || encode_repeated_record_bn(state, (&(*input).record_bn))) ++ bool tmp_result = (((zcbor_map_start_encode(state, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m)) && (((!(*input).record_bn_present || encode_repeated_record_bn(state, (&(*input).record_bn))) + && (!(*input).record_bt_present || encode_repeated_record_bt(state, (&(*input).record_bt))) + && (!(*input).record_n_present || encode_repeated_record_n(state, (&(*input).record_n))) + && (!(*input).record_t_present || encode_repeated_record_t(state, (&(*input).record_t))) + && (!(*input).record_union_present || encode_repeated_record_union(state, (&(*input).record_union))) +- && zcbor_multi_encode_minmax(0, 5, &(*input).record_key_value_pair_m_count, (zcbor_encoder_t *)encode_repeated_record_key_value_pair_m, state, (&(*input).record_key_value_pair_m), sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, 10)))); ++ && zcbor_multi_encode_minmax(0, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m), &(*input).record_key_value_pair_m_count, (zcbor_encoder_t *)encode_repeated_record_key_value_pair_m, state, (&(*input).record_key_value_pair_m), sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m))))); + + if (!tmp_result) { + zcbor_trace_file(state); +@@ -226,7 +222,7 @@ static bool encode_lwm2m_senml( { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); -- bool tmp_result = (((zcbor_list_start_encode(state, 99) && ((zcbor_multi_encode_minmax(1, 99, &(*input)._lwm2m_senml__record_count, (zcbor_encoder_t *)encode_record, state, (&(*input)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 99)))); -+ bool tmp_result = (((zcbor_list_start_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record)) && ((zcbor_multi_encode_minmax(1, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record), &(*input)._lwm2m_senml__record_count, (zcbor_encoder_t *)encode_record, state, (&(*input)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record))))); +- bool tmp_result = (((zcbor_list_start_encode(state, 99) && ((zcbor_multi_encode_minmax(1, 99, &(*input).lwm2m_senml_record_m_count, (zcbor_encoder_t *)encode_record, state, (&(*input).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 99)))); ++ bool tmp_result = (((zcbor_list_start_encode(state, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m)) && ((zcbor_multi_encode_minmax(1, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m), &(*input).lwm2m_senml_record_m_count, (zcbor_encoder_t *)encode_record, state, (&(*input).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m))))); - if (!tmp_result) - zcbor_trace(); + if (!tmp_result) { + zcbor_trace_file(state); diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h -index b6c54afde5..cbc32e540c 100644 +index df2f0ac6a1..8fa1eedb2b 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -21,10 +21,6 @@ +@@ -21,11 +21,6 @@ extern "C" { #endif @@ -204,26 +134,36 @@ index b6c54afde5..cbc32e540c 100644 -#error "The type file was generated with a different default_max_qty than this file" -#endif - - +- int cbor_encode_lwm2m_senml( - uint8_t *payload, size_t payload_len, + uint8_t *payload, size_t payload_len, + const struct lwm2m_senml *input, diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h -index e12f33636e..f709086a5c 100644 +index 77649036ef..f0a2958072 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -20,6 +20,18 @@ +@@ -20,14 +20,18 @@ extern "C" { #endif +-/** Which value for --default-max-qty this file was created with. +- * +- * The define is used in the other generated file to do a build-time +- * compatibility check. +- * +- * See `zcbor --help` for more information about --default-max-qty +- */ +-#define DEFAULT_MAX_QTY 99 ++ +enum lwm2m_senml_cbor_key { + lwm2m_senml_cbor_key_bn = -2, + lwm2m_senml_cbor_key_bt = -3, @@ -235,25 +175,15 @@ index e12f33636e..f709086a5c 100644 + lwm2m_senml_cbor_key_vb = 4, + lwm2m_senml_cbor_key_vd = 8, +}; -+ - /** Which value for --default-max-qty this file was created with. - * - * The define is used in the other generated file to do a build-time -@@ -27,7 +39,7 @@ extern "C" { - * - * See `zcbor --help` for more information about --default-max-qty - */ --#define DEFAULT_MAX_QTY 99 -+#define DEFAULT_MAX_QTY CONFIG_LWM2M_RW_SENML_CBOR_RECORDS struct record_bn { - struct zcbor_string _record_bn; -@@ -118,7 +130,7 @@ struct record { + struct zcbor_string record_bn; +@@ -118,7 +122,7 @@ struct record { }; struct lwm2m_senml { -- struct record _lwm2m_senml__record[99]; -+ struct record _lwm2m_senml__record[DEFAULT_MAX_QTY]; - size_t _lwm2m_senml__record_count; +- struct record lwm2m_senml_record_m[99]; ++ struct record lwm2m_senml_record_m[CONFIG_LWM2M_RW_SENML_CBOR_RECORDS]; + size_t lwm2m_senml_record_m_count; }; diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c index a75aee02120..3906d476cac 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ @@ -14,28 +14,32 @@ #include #include "zcbor_decode.h" #include "lwm2m_senml_cbor_decode.h" +#include "zcbor_print.h" static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *result); static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *result); static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *result); static bool decode_repeated_record_t(zcbor_state_t *state, struct record_t *result); -static bool decode_repeated_record_union(zcbor_state_t *state, struct record_union_ *result); -static bool decode_value(zcbor_state_t *state, struct value_ *result); +static bool decode_repeated_record_union(zcbor_state_t *state, struct record_union_r *result); +static bool decode_value(zcbor_state_t *state, struct value_r *result); static bool decode_key_value_pair(zcbor_state_t *state, struct key_value_pair *result); -static bool decode_repeated_record__key_value_pair(zcbor_state_t *state, - struct record__key_value_pair *result); +static bool decode_repeated_record_key_value_pair_m(zcbor_state_t *state, + struct record_key_value_pair_m *result); static bool decode_record(zcbor_state_t *state, struct record *result); static bool decode_lwm2m_senml(zcbor_state_t *state, struct lwm2m_senml *result); static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = ((((zcbor_int32_expect(state, (-2)))) && - (zcbor_tstr_decode(state, (&(*result)._record_bn))))); + (zcbor_tstr_decode(state, (&(*result).record_bn))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -43,16 +47,19 @@ static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *re static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = ((((zcbor_int32_expect(state, (-3)))) && - (zcbor_int64_decode(state, (&(*result)._record_bt))) && - ((((*result)._record_bt >= INT64_MIN) && ((*result)._record_bt <= INT64_MAX)) || + (zcbor_int64_decode(state, (&(*result).record_bt))) && + ((((*result).record_bt >= INT64_MIN) && ((*result).record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -60,13 +67,16 @@ static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *re static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = ((((zcbor_uint32_expect(state, (0)))) && - (zcbor_tstr_decode(state, (&(*result)._record_n))))); + (zcbor_tstr_decode(state, (&(*result).record_n))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -74,86 +84,94 @@ static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *resu static bool decode_repeated_record_t(zcbor_state_t *state, struct record_t *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = ((((zcbor_uint32_expect(state, (6)))) && - (zcbor_int64_decode(state, (&(*result)._record_t))) && - ((((*result)._record_t >= INT64_MIN) && ((*result)._record_t <= INT64_MAX)) || + (zcbor_int64_decode(state, (&(*result).record_t))) && + ((((*result).record_t >= INT64_MIN) && ((*result).record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; } -static bool decode_repeated_record_union(zcbor_state_t *state, struct record_union_ *result) +static bool decode_repeated_record_union(zcbor_state_t *state, struct record_union_r *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); struct zcbor_string tmp_str; bool int_res; bool tmp_result = (((zcbor_union_start_code(state) && (int_res = (((((zcbor_uint32_expect_union(state, (2)))) && - (zcbor_int64_decode(state, (&(*result)._union_vi))) && - ((((*result)._union_vi >= INT64_MIN) && - ((*result)._union_vi <= INT64_MAX)) || + (zcbor_int64_decode(state, (&(*result).union_vi))) && + ((((*result).union_vi >= INT64_MIN) && + ((*result).union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && - (((*result)._record_union_choice = _union_vi), true)) || + (((*result).record_union_choice = union_vi_c), true)) || ((((zcbor_uint32_expect_union(state, (2)))) && - (zcbor_float_decode(state, (&(*result)._union_vf)))) && - (((*result)._record_union_choice = _union_vf), true)) || + (zcbor_float_decode(state, (&(*result).union_vf)))) && + (((*result).record_union_choice = union_vf_c), true)) || ((((zcbor_uint32_expect_union(state, (3)))) && - (zcbor_tstr_decode(state, (&(*result)._union_vs)))) && - (((*result)._record_union_choice = _union_vs), true)) || + (zcbor_tstr_decode(state, (&(*result).union_vs)))) && + (((*result).record_union_choice = union_vs_c), true)) || ((((zcbor_uint32_expect_union(state, (4)))) && - (zcbor_bool_decode(state, (&(*result)._union_vb)))) && - (((*result)._record_union_choice = _union_vb), true)) || + (zcbor_bool_decode(state, (&(*result).union_vb)))) && + (((*result).record_union_choice = union_vb_c), true)) || ((((zcbor_uint32_expect_union(state, (8)))) && - (zcbor_bstr_decode(state, (&(*result)._union_vd)))) && - (((*result)._record_union_choice = _union_vd), true)) || + (zcbor_bstr_decode(state, (&(*result).union_vd)))) && + (((*result).record_union_choice = union_vd_c), true)) || (zcbor_union_elem_code(state) && ((((zcbor_tstr_expect( state, ((tmp_str.value = (uint8_t *)"vlo", tmp_str.len = sizeof("vlo") - 1, &tmp_str))))) && - (zcbor_tstr_decode(state, (&(*result)._union_vlo)))) && - (((*result)._record_union_choice = _union_vlo), true)))), + (zcbor_tstr_decode(state, (&(*result).union_vlo)))) && + (((*result).record_union_choice = union_vlo_c), true)))), zcbor_union_end_code(state), int_res)))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; } -static bool decode_value(zcbor_state_t *state, struct value_ *result) +static bool decode_value(zcbor_state_t *state, struct value_r *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool int_res; - bool tmp_result = - (((zcbor_union_start_code(state) && - (int_res = ((((zcbor_tstr_decode(state, (&(*result)._value_tstr)))) && - (((*result)._value_choice = _value_tstr), true)) || - (((zcbor_bstr_decode(state, (&(*result)._value_bstr)))) && - (((*result)._value_choice = _value_bstr), true)) || - (((zcbor_int64_decode(state, (&(*result)._value_int))) && - ((((*result)._value_int >= INT64_MIN) && - ((*result)._value_int <= INT64_MAX)) || - (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && - (((*result)._value_choice = _value_int), true)) || - (((zcbor_float_decode(state, (&(*result)._value_float)))) && - (((*result)._value_choice = _value_float), true)) || - (((zcbor_bool_decode(state, (&(*result)._value_bool)))) && - (((*result)._value_choice = _value_bool), true))), - zcbor_union_end_code(state), int_res)))); + bool tmp_result = (((zcbor_union_start_code(state) && + (int_res = ((((zcbor_tstr_decode(state, (&(*result).value_tstr)))) && + (((*result).value_choice = value_tstr_c), true)) || + (((zcbor_bstr_decode(state, (&(*result).value_bstr)))) && + (((*result).value_choice = value_bstr_c), true)) || + (((zcbor_int64_decode(state, (&(*result).value_int))) && + ((((*result).value_int >= INT64_MIN) && + ((*result).value_int <= INT64_MAX)) || + (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && + (((*result).value_choice = value_int_c), true)) || + (((zcbor_float_decode(state, (&(*result).value_float)))) && + (((*result).value_choice = value_float_c), true)) || + (((zcbor_bool_decode(state, (&(*result).value_bool)))) && + (((*result).value_choice = value_bool_c), true))), + zcbor_union_end_code(state), int_res)))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -161,27 +179,33 @@ static bool decode_value(zcbor_state_t *state, struct value_ *result) static bool decode_key_value_pair(zcbor_state_t *state, struct key_value_pair *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); - bool tmp_result = ((((zcbor_int32_decode(state, (&(*result)._key_value_pair_key)))) && - (decode_value(state, (&(*result)._key_value_pair))))); + bool tmp_result = ((((zcbor_int32_decode(state, (&(*result).key_value_pair_key)))) && + (decode_value(state, (&(*result).key_value_pair))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; } -static bool decode_repeated_record__key_value_pair(zcbor_state_t *state, - struct record__key_value_pair *result) +static bool decode_repeated_record_key_value_pair_m(zcbor_state_t *state, + struct record_key_value_pair_m *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); - bool tmp_result = (((decode_key_value_pair(state, (&(*result)._record__key_value_pair))))); + bool tmp_result = (((decode_key_value_pair(state, (&(*result).record_key_value_pair_m))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -189,35 +213,38 @@ static bool decode_repeated_record__key_value_pair(zcbor_state_t *state, static bool decode_record(zcbor_state_t *state, struct record *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = (((zcbor_map_start_decode(state) && - ((zcbor_present_decode(&((*result)._record_bn_present), + ((zcbor_present_decode(&((*result).record_bn_present), (zcbor_decoder_t *)decode_repeated_record_bn, state, - (&(*result)._record_bn)) && - zcbor_present_decode(&((*result)._record_bt_present), + (&(*result).record_bn)) && + zcbor_present_decode(&((*result).record_bt_present), (zcbor_decoder_t *)decode_repeated_record_bt, state, - (&(*result)._record_bt)) && - zcbor_present_decode(&((*result)._record_n_present), + (&(*result).record_bt)) && + zcbor_present_decode(&((*result).record_n_present), (zcbor_decoder_t *)decode_repeated_record_n, state, - (&(*result)._record_n)) && - zcbor_present_decode(&((*result)._record_t_present), + (&(*result).record_n)) && + zcbor_present_decode(&((*result).record_t_present), (zcbor_decoder_t *)decode_repeated_record_t, state, - (&(*result)._record_t)) && - zcbor_present_decode(&((*result)._record_union_present), + (&(*result).record_t)) && + zcbor_present_decode(&((*result).record_union_present), (zcbor_decoder_t *)decode_repeated_record_union, state, - (&(*result)._record_union)) && - zcbor_multi_decode(0, ZCBOR_ARRAY_SIZE(result->_record__key_value_pair), - &(*result)._record__key_value_pair_count, - (zcbor_decoder_t *)decode_repeated_record__key_value_pair, - state, (&(*result)._record__key_value_pair), - sizeof(struct record__key_value_pair))) || + (&(*result).record_union)) && + zcbor_multi_decode(0, ZCBOR_ARRAY_SIZE(result->record_key_value_pair_m), + &(*result).record_key_value_pair_m_count, + (zcbor_decoder_t *)decode_repeated_record_key_value_pair_m, + state, (&(*result).record_key_value_pair_m), + sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -225,19 +252,22 @@ static bool decode_record(zcbor_state_t *state, struct record *result) static bool decode_lwm2m_senml(zcbor_state_t *state, struct lwm2m_senml *result) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode( - 1, ZCBOR_ARRAY_SIZE(result->_lwm2m_senml__record), - &(*result)._lwm2m_senml__record_count, (zcbor_decoder_t *)decode_record, - state, (&(*result)._lwm2m_senml__record), sizeof(struct record))) || + 1, ZCBOR_ARRAY_SIZE(result->lwm2m_senml_record_m), + &(*result).lwm2m_senml_record_m_count, (zcbor_decoder_t *)decode_record, + state, (&(*result).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -248,19 +278,7 @@ int cbor_decode_lwm2m_senml(const uint8_t *payload, size_t payload_len, struct l { zcbor_state_t states[5]; - zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 1); - - bool ret = decode_lwm2m_senml(states, result); - - if (ret && (payload_len_out != NULL)) { - *payload_len_out = MIN(payload_len, (size_t)states[0].payload - (size_t)payload); - } - - if (!ret) { - int err = zcbor_pop_error(states); - - zcbor_print("Return error: %d\r\n", err); - return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err; - } - return ZCBOR_SUCCESS; + return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states, + (zcbor_decoder_t *)decode_lwm2m_senml, + sizeof(states) / sizeof(zcbor_state_t), 1); } diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h index a8ae779b6a1..b47b79de615 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c index 74c9310941b..9cf4f3457c6 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ @@ -14,28 +14,32 @@ #include #include "zcbor_encode.h" #include "lwm2m_senml_cbor_encode.h" +#include "zcbor_print.h" static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_bn *input); static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_bt *input); static bool encode_repeated_record_n(zcbor_state_t *state, const struct record_n *input); static bool encode_repeated_record_t(zcbor_state_t *state, const struct record_t *input); -static bool encode_repeated_record_union(zcbor_state_t *state, const struct record_union_ *input); -static bool encode_value(zcbor_state_t *state, const struct value_ *input); +static bool encode_repeated_record_union(zcbor_state_t *state, const struct record_union_r *input); +static bool encode_value(zcbor_state_t *state, const struct value_r *input); static bool encode_key_value_pair(zcbor_state_t *state, const struct key_value_pair *input); -static bool encode_repeated_record__key_value_pair(zcbor_state_t *state, - const struct record__key_value_pair *input); +static bool encode_repeated_record_key_value_pair_m(zcbor_state_t *state, + const struct record_key_value_pair_m *input); static bool encode_record(zcbor_state_t *state, const struct record *input); static bool encode_lwm2m_senml(zcbor_state_t *state, const struct lwm2m_senml *input); static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_bn *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = ((((zcbor_int32_put(state, (-2)))) && - (zcbor_tstr_encode(state, (&(*input)._record_bn))))); + (zcbor_tstr_encode(state, (&(*input).record_bn))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -43,16 +47,19 @@ static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_ static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_bt *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = ((((zcbor_int32_put(state, (-3)))) && - ((((*input)._record_bt >= INT64_MIN) && ((*input)._record_bt <= INT64_MAX)) || + ((((*input).record_bt >= INT64_MIN) && ((*input).record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) && - (zcbor_int64_encode(state, (&(*input)._record_bt))))); + (zcbor_int64_encode(state, (&(*input).record_bt))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -60,13 +67,16 @@ static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_ static bool encode_repeated_record_n(zcbor_state_t *state, const struct record_n *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = ((((zcbor_uint32_put(state, (0)))) && - (zcbor_tstr_encode(state, (&(*input)._record_n))))); + (zcbor_tstr_encode(state, (&(*input).record_n))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -74,81 +84,98 @@ static bool encode_repeated_record_n(zcbor_state_t *state, const struct record_n static bool encode_repeated_record_t(zcbor_state_t *state, const struct record_t *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = ((((zcbor_uint32_put(state, (6)))) && - ((((*input)._record_t >= INT64_MIN) && ((*input)._record_t <= INT64_MAX)) || + ((((*input).record_t >= INT64_MIN) && ((*input).record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) && - (zcbor_int64_encode(state, (&(*input)._record_t))))); + (zcbor_int64_encode(state, (&(*input).record_t))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; } -static bool encode_repeated_record_union(zcbor_state_t *state, const struct record_union_ *input) +static bool encode_repeated_record_union(zcbor_state_t *state, const struct record_union_r *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); struct zcbor_string tmp_str; bool tmp_result = ((( - ((*input)._record_union_choice == _union_vi) + ((*input).record_union_choice == union_vi_c) ? (((zcbor_uint32_put(state, (2)))) && - ((((*input)._union_vi >= INT64_MIN) && - ((*input)._union_vi <= INT64_MAX)) || + ((((*input).union_vi >= INT64_MIN) && + ((*input).union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) && - (zcbor_int64_encode(state, (&(*input)._union_vi)))) - : (((*input)._record_union_choice == _union_vf) - ? (((zcbor_uint32_put(state, (2)))) && - (zcbor_float64_encode(state, (&(*input)._union_vf)))) - : (((*input)._record_union_choice == _union_vs) - ? (((zcbor_uint32_put(state, (3)))) && - (zcbor_tstr_encode(state, (&(*input)._union_vs)))) - : (((*input)._record_union_choice == _union_vb) - ? (((zcbor_uint32_put(state, (4)))) && - (zcbor_bool_encode(state, (&(*input)._union_vb)))) - : (((*input)._record_union_choice == _union_vd) - ? (((zcbor_uint32_put(state, (8)))) && - (zcbor_bstr_encode(state, (&(*input)._union_vd)))) - : (((*input)._record_union_choice == _union_vlo) - ? (((zcbor_tstr_encode(state, ((tmp_str.value = (uint8_t *)"vlo", - tmp_str.len = sizeof("vlo") - 1, - &tmp_str))))) && - (zcbor_tstr_encode(state, (&(*input)._union_vlo)))) - : false)))))))); + (zcbor_int64_encode(state, (&(*input).union_vi)))) + : (((*input).record_union_choice == union_vf_c) + ? (((zcbor_uint32_put(state, (2)))) && + (zcbor_float64_encode(state, (&(*input).union_vf)))) + : (((*input).record_union_choice == union_vs_c) + ? (((zcbor_uint32_put(state, (3)))) && + (zcbor_tstr_encode(state, (&(*input).union_vs)))) + : (((*input).record_union_choice == union_vb_c) + ? (((zcbor_uint32_put(state, (4)))) && + (zcbor_bool_encode(state, (&(*input).union_vb)))) + : (((*input).record_union_choice == union_vd_c) + ? (((zcbor_uint32_put(state, (8)))) && + (zcbor_bstr_encode(state, (&(*input).union_vd)))) + : (((*input).record_union_choice == union_vlo_c) + ? (((zcbor_tstr_encode( + state, + ((tmp_str.value = (uint8_t *)"vlo", + tmp_str.len = sizeof("vlo") - 1, + &tmp_str))))) && + (zcbor_tstr_encode( + state, + (&(*input).union_vlo)))) + : false)))))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; } -static bool encode_value(zcbor_state_t *state, const struct value_ *input) +static bool encode_value(zcbor_state_t *state, const struct value_r *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = ((( - ((*input)._value_choice == _value_tstr) - ? ((zcbor_tstr_encode(state, (&(*input)._value_tstr)))) - : (((*input)._value_choice == _value_bstr) - ? ((zcbor_bstr_encode(state, (&(*input)._value_bstr)))) - : (((*input)._value_choice == _value_int) - ? (((((*input)._value_int >= INT64_MIN) && - ((*input)._value_int <= INT64_MAX)) || - (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) && - (zcbor_int64_encode(state, (&(*input)._value_int)))) - : (((*input)._value_choice == _value_float) - ? ((zcbor_float64_encode(state, (&(*input)._value_float)))) - : (((*input)._value_choice == _value_bool) - ? ((zcbor_bool_encode(state, (&(*input)._value_bool)))) - : false))))))); + ((*input).value_choice == value_tstr_c) + ? ((zcbor_tstr_encode(state, (&(*input).value_tstr)))) + : (((*input).value_choice == value_bstr_c) + ? ((zcbor_bstr_encode(state, (&(*input).value_bstr)))) + : (((*input).value_choice == value_int_c) + ? (((((*input).value_int >= INT64_MIN) && + ((*input).value_int <= INT64_MAX)) || + (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), + false)) && + (zcbor_int64_encode(state, (&(*input).value_int)))) + : (((*input).value_choice == value_float_c) + ? ((zcbor_float64_encode( + state, (&(*input).value_float)))) + : (((*input).value_choice == value_bool_c) + ? ((zcbor_bool_encode( + state, + (&(*input).value_bool)))) + : false))))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -156,27 +183,33 @@ static bool encode_value(zcbor_state_t *state, const struct value_ *input) static bool encode_key_value_pair(zcbor_state_t *state, const struct key_value_pair *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); - bool tmp_result = ((((zcbor_int32_encode(state, (&(*input)._key_value_pair_key)))) && - (encode_value(state, (&(*input)._key_value_pair))))); + bool tmp_result = ((((zcbor_int32_encode(state, (&(*input).key_value_pair_key)))) && + (encode_value(state, (&(*input).key_value_pair))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; } -static bool encode_repeated_record__key_value_pair(zcbor_state_t *state, - const struct record__key_value_pair *input) +static bool encode_repeated_record_key_value_pair_m(zcbor_state_t *state, + const struct record_key_value_pair_m *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); - bool tmp_result = (((encode_key_value_pair(state, (&(*input)._record__key_value_pair))))); + bool tmp_result = (((encode_key_value_pair(state, (&(*input).record_key_value_pair_m))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -184,36 +217,34 @@ static bool encode_repeated_record__key_value_pair(zcbor_state_t *state, static bool encode_record(zcbor_state_t *state, const struct record *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = (( - (zcbor_map_start_encode(state, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair)) && - ((zcbor_present_encode(&((*input)._record_bn_present), - (zcbor_encoder_t *)encode_repeated_record_bn, state, - (&(*input)._record_bn)) && - zcbor_present_encode(&((*input)._record_bt_present), - (zcbor_encoder_t *)encode_repeated_record_bt, state, - (&(*input)._record_bt)) && - zcbor_present_encode(&((*input)._record_n_present), - (zcbor_encoder_t *)encode_repeated_record_n, state, - (&(*input)._record_n)) && - zcbor_present_encode(&((*input)._record_t_present), - (zcbor_encoder_t *)encode_repeated_record_t, state, - (&(*input)._record_t)) && - zcbor_present_encode(&((*input)._record_union_present), - (zcbor_encoder_t *)encode_repeated_record_union, state, - (&(*input)._record_union)) && + (zcbor_map_start_encode(state, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m)) && + (((!(*input).record_bn_present || + encode_repeated_record_bn(state, (&(*input).record_bn))) && + (!(*input).record_bt_present || + encode_repeated_record_bt(state, (&(*input).record_bt))) && + (!(*input).record_n_present || + encode_repeated_record_n(state, (&(*input).record_n))) && + (!(*input).record_t_present || + encode_repeated_record_t(state, (&(*input).record_t))) && + (!(*input).record_union_present || + encode_repeated_record_union(state, (&(*input).record_union))) && zcbor_multi_encode_minmax( - 0, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair), - &(*input)._record__key_value_pair_count, - (zcbor_encoder_t *)encode_repeated_record__key_value_pair, state, - (&(*input)._record__key_value_pair), - sizeof(struct record__key_value_pair))) || + 0, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m), + &(*input).record_key_value_pair_m_count, + (zcbor_encoder_t *)encode_repeated_record_key_value_pair_m, state, + (&(*input).record_key_value_pair_m), + sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_encode(state), false)) && - zcbor_map_end_encode(state, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair))))); + zcbor_map_end_encode(state, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -221,19 +252,22 @@ static bool encode_record(zcbor_state_t *state, const struct record *input) static bool encode_lwm2m_senml(zcbor_state_t *state, const struct lwm2m_senml *input) { - zcbor_print("%s\r\n", __func__); + zcbor_log("%s\r\n", __func__); bool tmp_result = - (((zcbor_list_start_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record)) && + (((zcbor_list_start_encode(state, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m)) && ((zcbor_multi_encode_minmax( - 1, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record), - &(*input)._lwm2m_senml__record_count, (zcbor_encoder_t *)encode_record, - state, (&(*input)._lwm2m_senml__record), sizeof(struct record))) || + 1, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m), + &(*input).lwm2m_senml_record_m_count, (zcbor_encoder_t *)encode_record, + state, (&(*input).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && - zcbor_list_end_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record))))); + zcbor_list_end_encode(state, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m))))); if (!tmp_result) { - zcbor_trace(); + zcbor_trace_file(state); + zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); + } else { + zcbor_log("%s success\r\n", __func__); } return tmp_result; @@ -244,19 +278,7 @@ int cbor_encode_lwm2m_senml(uint8_t *payload, size_t payload_len, const struct l { zcbor_state_t states[5]; - zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 1); - - bool ret = encode_lwm2m_senml(states, input); - - if (ret && (payload_len_out != NULL)) { - *payload_len_out = MIN(payload_len, (size_t)states[0].payload - (size_t)payload); - } - - if (!ret) { - int err = zcbor_pop_error(states); - - zcbor_print("Return error: %d\r\n", err); - return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err; - } - return ZCBOR_SUCCESS; + return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states, + (zcbor_decoder_t *)encode_lwm2m_senml, + sizeof(states) / sizeof(zcbor_state_t), 1); } diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h index 05d2664c2a0..49ce5c55159 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h index f1b86bb60b0..4c41385ba4b 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.7.0 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ @@ -32,115 +32,97 @@ enum lwm2m_senml_cbor_key { lwm2m_senml_cbor_key_vd = 8, }; -/** Which value for --default-max-qty this file was created with. - * - * The define is used in the other generated file to do a build-time - * compatibility check. - * - * See `zcbor --help` for more information about --default-max-qty - */ -#define DEFAULT_MAX_QTY CONFIG_LWM2M_RW_SENML_CBOR_RECORDS - struct record_bn { - struct zcbor_string _record_bn; + struct zcbor_string record_bn; }; struct record_bt { - int64_t _record_bt; + int64_t record_bt; }; struct record_n { - struct zcbor_string _record_n; + struct zcbor_string record_n; }; struct record_t { - int64_t _record_t; + int64_t record_t; }; -/* The union members and enum members have the same names. - * This is intentional so we need to ignore -Wshadow to avoid - * compiler complaining about them. - */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wshadow" - -struct record_union_ { +struct record_union_r { union { struct { - int64_t _union_vi; + int64_t union_vi; }; struct { - double _union_vf; + double union_vf; }; struct { - struct zcbor_string _union_vs; + struct zcbor_string union_vs; }; struct { - bool _union_vb; + bool union_vb; }; struct { - struct zcbor_string _union_vd; + struct zcbor_string union_vd; }; struct { - struct zcbor_string _union_vlo; + struct zcbor_string union_vlo; }; }; enum { - _union_vi, - _union_vf, - _union_vs, - _union_vb, - _union_vd, - _union_vlo, - } _record_union_choice; + union_vi_c, + union_vf_c, + union_vs_c, + union_vb_c, + union_vd_c, + union_vlo_c, + } record_union_choice; }; -struct value_ { +struct value_r { union { - struct zcbor_string _value_tstr; - struct zcbor_string _value_bstr; - int64_t _value_int; - double _value_float; - bool _value_bool; + struct zcbor_string value_tstr; + struct zcbor_string value_bstr; + int64_t value_int; + double value_float; + bool value_bool; }; enum { - _value_tstr, - _value_bstr, - _value_int, - _value_float, - _value_bool, - } _value_choice; + value_tstr_c, + value_bstr_c, + value_int_c, + value_float_c, + value_bool_c, + } value_choice; }; -#pragma GCC diagnostic pop - struct key_value_pair { - int32_t _key_value_pair_key; - struct value_ _key_value_pair; + int32_t key_value_pair_key; + struct value_r key_value_pair; }; -struct record__key_value_pair { - struct key_value_pair _record__key_value_pair; +struct record_key_value_pair_m { + struct key_value_pair record_key_value_pair_m; }; struct record { - struct record_bn _record_bn; - bool _record_bn_present; - struct record_bt _record_bt; - bool _record_bt_present; - struct record_n _record_n; - bool _record_n_present; - struct record_t _record_t; - bool _record_t_present; - struct record_union_ _record_union; - bool _record_union_present; - struct record__key_value_pair _record__key_value_pair[5]; - size_t _record__key_value_pair_count; + struct record_bn record_bn; + bool record_bn_present; + struct record_bt record_bt; + bool record_bt_present; + struct record_n record_n; + bool record_n_present; + struct record_t record_t; + bool record_t_present; + struct record_union_r record_union; + bool record_union_present; + struct record_key_value_pair_m record_key_value_pair_m[5]; + size_t record_key_value_pair_m_count; }; struct lwm2m_senml { - struct record _lwm2m_senml__record[DEFAULT_MAX_QTY]; - size_t _lwm2m_senml__record_count; + struct record lwm2m_senml_record_m[CONFIG_LWM2M_RW_SENML_CBOR_RECORDS]; + size_t lwm2m_senml_record_m_count; }; #ifdef __cplusplus From 775a4d3e42971fbf491f0b941ad0522378547a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Wed, 10 Jan 2024 14:39:42 +0100 Subject: [PATCH 0537/2300] [nrf fromtree] mgmt: Adapt to API changes in zcbor 0.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit zcbor_new_state and zcbor_tstr_put_term Signed-off-by: Øyvind Rønningstad (cherry picked from commit 527af809f88166725ae1ac432851d0e81e97e56d) (cherry picked from commit 0014f3dc4dda0142561b6495fc9213a4eacf8c27) --- include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h | 3 ++- subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c | 2 +- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 4 ++-- .../mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c | 6 +++--- subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 2 +- .../mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c | 7 ++++--- subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig | 9 ++++++--- subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c | 5 +++-- subsys/mgmt/mcumgr/smp/src/smp.c | 4 ++-- 9 files changed, 24 insertions(+), 18 deletions(-) diff --git a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h index 0b12ccdb684..ba63c136f50 100644 --- a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h +++ b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h @@ -45,11 +45,12 @@ void os_mgmt_client_init(struct os_mgmt_client *client, struct smp_client_object * * @param client OS mgmt client object * @param echo_string Echo string + * @param max_len Max length of @p echo_string * * @return 0 on success. * @return @ref mcumgr_err_t code on failure. */ -int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string); +int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string, size_t max_len); /** * @brief Send SMP Reset command. diff --git a/subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c b/subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c index 3458c3d6f8b..ae75aea9140 100644 --- a/subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c @@ -783,7 +783,7 @@ static int fs_mgmt_file_hash_checksum(struct smp_streamer *ctxt) } ok &= zcbor_tstr_put_lit(zse, "type") && - zcbor_tstr_put_term(zse, type_arr); + zcbor_tstr_put_term(zse, type_arr, sizeof(type_arr)); if (off != 0) { ok &= zcbor_tstr_put_lit(zse, "off") && 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 0968694c614..c54fbd4d0c6 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 @@ -442,11 +442,11 @@ static bool img_mgmt_state_encode_slot(zcbor_state_t *zse, uint32_t slot, int st ok = zcbor_tstr_put_lit(zse, "<\?\?\?>"); } else { vers_str[sizeof(vers_str) - 1] = '\0'; - ok = zcbor_tstr_put_term(zse, vers_str); + ok = zcbor_tstr_put_term(zse, vers_str, sizeof(vers_str)); } } - ok = ok && zcbor_tstr_put_term(zse, "hash") && + ok = ok && zcbor_tstr_put_lit(zse, "hash") && zcbor_bstr_encode(zse, &zhash) && ZCBOR_ENCODE_FLAG(zse, "bootable", !(flags & IMAGE_F_NON_BOOTABLE)) && ZCBOR_ENCODE_FLAG(zse, "pending", state_flags & REPORT_SLOT_PENDING) && diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c b/subsys/mgmt/mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c index 9ab8ee02dcd..b8cbc38b275 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c @@ -74,7 +74,7 @@ static int image_state_res_fn(struct net_buf *nb, void *user_data) goto out; } - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_start_decode(zsd); if (!ok) { @@ -201,7 +201,7 @@ static int image_upload_res_fn(struct net_buf *nb, void *user_data) goto end; } - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1, NULL, 0); rc = zcbor_map_decode_bulk(zsd, upload_res_decode, ARRAY_SIZE(upload_res_decode), &decoded); if (rc || image_upload_buf->image_upload_offset == SIZE_MAX) { @@ -233,7 +233,7 @@ static int erase_res_fn(struct net_buf *nb, void *user_data) goto end; } - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1, NULL, 0); rc = zcbor_map_decode_bulk(zsd, upload_res_decode, ARRAY_SIZE(upload_res_decode), &decoded); if (rc) { diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 13de45f02a9..d5244cb07d8 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -207,7 +207,7 @@ os_mgmt_taskstat_encode_thread_name(zcbor_state_t *zse, int idx, snprintf(thread_name, sizeof(thread_name) - 1, "%d", idx); thread_name[sizeof(thread_name) - 1] = 0; - return zcbor_tstr_put_term(zse, thread_name); + return zcbor_tstr_put_term(zse, thread_name, sizeof(thread_name)); } #endif diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c b/subsys/mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c index 2bd804494c4..0bd174d1c97 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c @@ -104,7 +104,7 @@ static int echo_res_fn(struct net_buf *nb, void *user_data) } /* Init ZCOR decoder state */ - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, echo_response, ARRAY_SIZE(echo_response), &decoded) == 0; @@ -119,7 +119,7 @@ static int echo_res_fn(struct net_buf *nb, void *user_data) return rc; } -int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string) +int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string, size_t max_len) { struct net_buf *nb; int rc; @@ -138,7 +138,8 @@ int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string) zcbor_new_encode_state(zse, ARRAY_SIZE(zse), nb->data + nb->len, net_buf_tailroom(nb), 0); ok = zcbor_map_start_encode(zse, 2) && - zcbor_tstr_put_lit(zse, "d") && zcbor_tstr_put_term(zse, echo_string) && + zcbor_tstr_put_lit(zse, "d") && + zcbor_tstr_put_term(zse, echo_string, max_len) && zcbor_map_end_encode(zse, 2); if (!ok) { diff --git a/subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig index 757d290d10d..1ab882c33ee 100644 --- a/subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig @@ -28,9 +28,12 @@ config MCUMGR_GRP_STAT_MAX_NAME_LEN depends on MCUMGR_GRP_STAT help Limits the maximum stat group name length in MCUmgr requests, in bytes. - A buffer of this size gets allocated on the stack during handling of all - stat read commands. If a stat group's name exceeds this limit, it will - be impossible to retrieve its values with a stat show command. + For stat group names. a buffer of this size gets allocated on the stack + during handling of all stat read commands. If a stat group's name + exceeds this limit, it will be impossible to retrieve its values with + a stat show command. + For stat names s_name and snm_name, this is the maximum length when + encoding the name to cbor. module = MCUMGR_GRP_STAT module-str = mcumgr_grp_stat 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 4740073cf01..29e546bdb86 100644 --- a/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c @@ -110,7 +110,7 @@ stat_mgmt_foreach_entry(zcbor_state_t *zse, const char *group_name, stat_mgmt_fo static int stat_mgmt_cb_encode(zcbor_state_t *zse, struct stat_mgmt_entry *entry) { - bool ok = zcbor_tstr_put_term(zse, entry->name) && + bool ok = zcbor_tstr_put_term(zse, entry->name, CONFIG_MCUMGR_GRP_STAT_MAX_NAME_LEN) && zcbor_uint32_put(zse, entry->value); return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; @@ -215,7 +215,8 @@ stat_mgmt_list(struct smp_streamer *ctxt) do { cur = stats_group_get_next(cur); if (cur != NULL) { - ok = zcbor_tstr_put_term(zse, cur->s_name); + ok = zcbor_tstr_put_term(zse, cur->s_name, + CONFIG_MCUMGR_GRP_STAT_MAX_NAME_LEN); } } while (ok && cur != NULL); diff --git a/subsys/mgmt/mcumgr/smp/src/smp.c b/subsys/mgmt/mcumgr/smp/src/smp.c index a97beebddaa..902979d9faf 100644 --- a/subsys/mgmt/mcumgr/smp/src/smp.c +++ b/subsys/mgmt/mcumgr/smp/src/smp.c @@ -53,7 +53,7 @@ static void cbor_nb_reader_init(struct cbor_nb_reader *cnr, struct net_buf *nb) { cnr->nb = nb; zcbor_new_decode_state(cnr->zs, ARRAY_SIZE(cnr->zs), nb->data, - nb->len, 1); + nb->len, 1, NULL, 0); } static void cbor_nb_writer_init(struct cbor_nb_writer *cnw, struct net_buf *nb) @@ -125,7 +125,7 @@ static int smp_build_err_rsp(struct smp_streamer *streamer, const struct smp_hdr #ifdef CONFIG_MCUMGR_SMP_VERBOSE_ERR_RESPONSE if (ok && rc_rsn != NULL) { ok = zcbor_tstr_put_lit(zsp, "rsn") && - zcbor_tstr_put_term(zsp, rc_rsn); + zcbor_tstr_put_term(zsp, rc_rsn, CONFIG_ZCBOR_MAX_STR_LEN); } #else ARG_UNUSED(rc_rsn); From 05cc67b8108002ad8a1978eca3b89db830299fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Wed, 10 Jan 2024 14:39:42 +0100 Subject: [PATCH 0538/2300] [nrf fromtree] tests: mgmt: Adapt to API changes in zcbor 0.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit zcbor_new_state and zcbor_tstr_put_term Signed-off-by: Øyvind Rønningstad (cherry picked from commit 223b4c372f3af02e55980526256482d2a8b3e70b) (cherry picked from commit f4cd3d3c14b4d8d3738409a29246fa6fa0af1292) --- .../cb_notifications/src/smp_test_util.c | 2 +- .../mcumgr/fs_mgmt_hash_supported/src/main.c | 2 +- .../mcumgr/mcumgr_client/src/img_gr_stub.c | 11 +++-- .../mgmt/mcumgr/mcumgr_client/src/main.c | 4 +- .../mcumgr/mcumgr_client/src/os_gr_stub.c | 3 +- .../mgmt/mcumgr/os_mgmt_datetime/src/main.c | 44 +++++++++---------- .../os_mgmt_datetime/src/smp_test_util.c | 6 +-- .../mgmt/mcumgr/os_mgmt_info/src/build_date.c | 4 +- .../mgmt/mcumgr/os_mgmt_info/src/limited.c | 6 +-- .../mgmt/mcumgr/os_mgmt_info/src/main.c | 44 +++++++++---------- .../mcumgr/os_mgmt_info/src/smp_test_util.c | 2 +- .../mgmt/mcumgr/settings_mgmt/src/main.c | 14 +++--- .../mcumgr/settings_mgmt/src/smp_test_util.c | 18 ++++---- .../subsys/mgmt/mcumgr/smp_version/src/main.c | 6 +-- .../mcumgr/smp_version/src/smp_test_util.c | 2 +- .../subsys/mgmt/mcumgr/zcbor_bulk/src/main.c | 22 +++++----- 16 files changed, 97 insertions(+), 93 deletions(-) diff --git a/tests/subsys/mgmt/mcumgr/cb_notifications/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/cb_notifications/src/smp_test_util.c index a20f948f30b..270f232af77 100644 --- a/tests/subsys/mgmt/mcumgr/cb_notifications/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/cb_notifications/src/smp_test_util.c @@ -29,7 +29,7 @@ bool create_mcumgr_format_packet(zcbor_state_t *zse, uint8_t *buffer, uint8_t *o ok = zcbor_map_start_encode(zse, 2) && zcbor_tstr_put_lit(zse, "d") && - zcbor_tstr_put_term(zse, "some test data") && + zcbor_tstr_put_lit(zse, "some test data") && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/fs_mgmt_hash_supported/src/main.c b/tests/subsys/mgmt/mcumgr/fs_mgmt_hash_supported/src/main.c index a5cafef589d..30575172a84 100644 --- a/tests/subsys/mgmt/mcumgr/fs_mgmt_hash_supported/src/main.c +++ b/tests/subsys/mgmt/mcumgr/fs_mgmt_hash_supported/src/main.c @@ -97,7 +97,7 @@ ZTEST(fs_mgmt_hash_supported, test_supported) /* Search expected type array for this type and update details */ zcbor_new_decode_state(state, 10, &nb->data[sizeof(struct smp_hdr)], - (nb->len - sizeof(struct smp_hdr)), 1); + (nb->len - sizeof(struct smp_hdr)), 1, NULL, 0); ok = zcbor_map_start_decode(state); diff --git a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/img_gr_stub.c b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/img_gr_stub.c index aea03935fe6..9b12fd7b2b0 100644 --- a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/img_gr_stub.c +++ b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/img_gr_stub.c @@ -120,9 +120,10 @@ void img_read_response(int count) zcbor_tstr_put_lit(zse, "slot") && zcbor_uint32_put(zse, image_dummy_info[i].slot_num) && zcbor_tstr_put_lit(zse, "version") && - zcbor_tstr_put_term(zse, image_dummy_info[i].version) && + zcbor_tstr_put_term(zse, image_dummy_info[i].version, + sizeof(image_dummy_info[i].version)) && - zcbor_tstr_put_term(zse, "hash") && + zcbor_tstr_put_lit(zse, "hash") && zcbor_bstr_encode_ptr(zse, image_dummy_info[i].hash, IMG_MGMT_DATA_SHA_LEN) && ZCBOR_ENCODE_FLAG(zse, "bootable", image_dummy_info[i].flags.bootable) && ZCBOR_ENCODE_FLAG(zse, "pending", image_dummy_info[i].flags.pending) && @@ -180,7 +181,8 @@ void img_state_write_verify(struct net_buf *nb) ZCBOR_MAP_DECODE_KEY_DECODER("hash", zcbor_bstr_decode, &hash) }; - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1, + NULL, 0); decoded = 0; /* Init buffer values */ @@ -231,7 +233,8 @@ void img_upload_init_verify(struct net_buf *nb) ZCBOR_MAP_DECODE_KEY_DECODER("sha", zcbor_bstr_decode, &sha) }; - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1, + NULL, 0); decoded = 0; /* Init buffer values */ diff --git a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/main.c b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/main.c index bf70f178fe7..c724c72c2cc 100644 --- a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/main.c +++ b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/main.c @@ -225,12 +225,12 @@ ZTEST(mcumgr_client, test_os_echo) smp_stub_set_rx_data_verify(NULL); smp_client_send_status_stub(MGMT_ERR_EOK); /* Test timeout */ - rc = os_mgmt_client_echo(&os_client, os_echo_test); + rc = os_mgmt_client_echo(&os_client, os_echo_test, sizeof(os_echo_test)); zassert_equal(MGMT_ERR_ETIMEOUT, rc, "Expected to receive %d response %d", MGMT_ERR_ETIMEOUT, rc); /* Test successfully operation */ smp_stub_set_rx_data_verify(os_echo_verify); - rc = os_mgmt_client_echo(&os_client, os_echo_test); + rc = os_mgmt_client_echo(&os_client, os_echo_test, sizeof(os_echo_test)); zassert_equal(MGMT_ERR_EOK, rc, "Expected to receive %d response %d", MGMT_ERR_EOK, rc); } diff --git a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/os_gr_stub.c b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/os_gr_stub.c index 888f00dba38..c7196874556 100644 --- a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/os_gr_stub.c +++ b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/os_gr_stub.c @@ -81,7 +81,8 @@ void os_echo_verify(struct net_buf *nb) ZCBOR_MAP_DECODE_KEY_DECODER("d", zcbor_tstr_decode, &echo_data) }; - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1, + NULL, 0); echo_data.len = 0; rc = zcbor_map_decode_bulk(zsd, list_res_decode, ARRAY_SIZE(list_res_decode), &decoded); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/main.c b/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/main.c index c387c3b4812..05adb1d6de4 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/main.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/main.c @@ -191,7 +191,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_get_not_set_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -253,7 +253,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_get_not_set_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -318,7 +318,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -365,7 +365,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -428,7 +428,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -475,7 +475,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -538,7 +538,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_3) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -585,7 +585,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_3) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -648,7 +648,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -695,7 +695,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -760,7 +760,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -807,7 +807,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -872,7 +872,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_3) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -919,7 +919,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_3) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -984,7 +984,7 @@ ZTEST(os_mgmt_datetime_set, test_datetime_set_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1030,7 +1030,7 @@ ZTEST(os_mgmt_datetime_set, test_datetime_set_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1098,7 +1098,7 @@ ZTEST(os_mgmt_datetime_set, test_datetime_set_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1144,7 +1144,7 @@ ZTEST(os_mgmt_datetime_set, test_datetime_set_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1225,7 +1225,7 @@ ZTEST(os_mgmt_datetime_hook, test_datetime_set_valid_hook_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1287,7 +1287,7 @@ ZTEST(os_mgmt_datetime_hook, test_datetime_set_valid_hook_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1357,7 +1357,7 @@ ZTEST(os_mgmt_datetime_hook, test_datetime_set_valid_hook_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1418,7 +1418,7 @@ ZTEST(os_mgmt_datetime_hook, test_datetime_set_valid_hook_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/smp_test_util.c index 927089c3ee3..d2b969999cd 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/smp_test_util.c @@ -49,9 +49,9 @@ bool create_mcumgr_datetime_set_packet_str(zcbor_state_t *zse, bool version2, co uint8_t *buffer, uint8_t *output_buffer, uint16_t *buffer_size) { - bool ok = zcbor_map_start_encode(zse, 2) && - zcbor_tstr_put_lit(zse, "datetime") && - zcbor_tstr_put_term(zse, data) && + bool ok = zcbor_map_start_encode(zse, 2) && + zcbor_tstr_put_lit(zse, "datetime") && + zcbor_tstr_put_term(zse, data, CONFIG_ZCBOR_MAX_STR_LEN) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/build_date.c b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/build_date.c index 4af977895c3..5674e338dfa 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/build_date.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/build_date.c @@ -121,7 +121,7 @@ ZTEST(os_mgmt_info_build_date, test_info_build_date_1_build_date) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -197,7 +197,7 @@ ZTEST(os_mgmt_info_build_date, test_info_build_date_2_all) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/limited.c b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/limited.c index f8899734351..613402e1624 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/limited.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/limited.c @@ -81,7 +81,7 @@ ZTEST(os_mgmt_info_limited, test_info_1_kernel_name) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -147,7 +147,7 @@ ZTEST(os_mgmt_info_limited, test_info_2_all) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); /* Ensure only an error is received */ ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -155,7 +155,7 @@ ZTEST(os_mgmt_info_limited, test_info_2_all) zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/main.c b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/main.c index 8ffc2a354b8..6e8cc61098d 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/main.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/main.c @@ -338,7 +338,7 @@ ZTEST(os_mgmt_info, test_info_2_kernel_name) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -399,7 +399,7 @@ ZTEST(os_mgmt_info, test_info_3_node_name) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -461,7 +461,7 @@ ZTEST(os_mgmt_info, test_info_4_kernel_release) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -523,7 +523,7 @@ ZTEST(os_mgmt_info, test_info_5_kernel_version) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -584,7 +584,7 @@ ZTEST(os_mgmt_info, test_info_6_machine) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -645,7 +645,7 @@ ZTEST(os_mgmt_info, test_info_7_processor) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -706,7 +706,7 @@ ZTEST(os_mgmt_info, test_info_8_platform) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -778,7 +778,7 @@ ZTEST(os_mgmt_info, test_info_9_os) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -839,7 +839,7 @@ ZTEST(os_mgmt_info, test_info_10_all) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -914,7 +914,7 @@ ZTEST(os_mgmt_info, test_info_11_multi_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -979,7 +979,7 @@ ZTEST(os_mgmt_info, test_info_12_multi_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1051,7 +1051,7 @@ ZTEST(os_mgmt_info, test_info_13_invalid_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); /* Ensure only an error is received */ ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1059,7 +1059,7 @@ ZTEST(os_mgmt_info, test_info_13_invalid_1) zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); @@ -1122,7 +1122,7 @@ ZTEST(os_mgmt_info, test_info_14_invalid_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); /* Ensure only an error is received */ ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1130,7 +1130,7 @@ ZTEST(os_mgmt_info, test_info_14_invalid_2) zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); @@ -1199,7 +1199,7 @@ ZTEST(os_mgmt_info_custom_os, test_info_os_custom) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1260,7 +1260,7 @@ ZTEST(os_mgmt_info_custom_os_disabled, test_info_os_custom_disabled) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1333,7 +1333,7 @@ ZTEST(os_mgmt_info_custom_cmd, test_info_cmd_custom) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1399,14 +1399,14 @@ ZTEST(os_mgmt_info_custom_cmd_disabled, test_info_cmd_custom_disabled) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); @@ -1468,14 +1468,14 @@ ZTEST(os_mgmt_info_custom_cmd_disabled_verify, test_info_cmd_custom_disabled) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/smp_test_util.c index c1dcded0ff6..b76ac1ad623 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/smp_test_util.c @@ -31,7 +31,7 @@ bool create_mcumgr_format_packet(zcbor_state_t *zse, const uint8_t *format, uint ok = zcbor_map_start_encode(zse, 2) && zcbor_tstr_put_lit(zse, "format") && - zcbor_tstr_put_term(zse, format) && + zcbor_tstr_put_term(zse, format, CONFIG_ZCBOR_MAX_STR_LEN) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c b/tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c index 745fa333790..869a4f750d9 100644 --- a/tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c +++ b/tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c @@ -487,7 +487,7 @@ ZTEST(settings_mgmt, test_set_read) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -590,7 +590,7 @@ ZTEST(settings_mgmt, test_read_max_size) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 2, "Expected to receive 2 decoded zcbor elements"); @@ -745,7 +745,7 @@ ZTEST(settings_mgmt, test_set_disallowed) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); @@ -875,7 +875,7 @@ ZTEST(settings_mgmt, test_set_disallowed) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); @@ -1147,7 +1147,7 @@ ZTEST(settings_mgmt, test_delete) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); @@ -1274,7 +1274,7 @@ ZTEST(settings_mgmt, test_delete) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); @@ -1519,7 +1519,7 @@ ZTEST(settings_mgmt, test_delete) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); diff --git a/tests/subsys/mgmt/mcumgr/settings_mgmt/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/settings_mgmt/src/smp_test_util.c index 63b91151797..dcabd0d08c3 100644 --- a/tests/subsys/mgmt/mcumgr/settings_mgmt/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/settings_mgmt/src/smp_test_util.c @@ -31,7 +31,7 @@ bool create_settings_mgmt_read_packet(zcbor_state_t *zse, uint8_t *buffer, uint8 ok = zcbor_map_start_encode(zse, 2) && zcbor_tstr_put_lit(zse, "name") && - zcbor_tstr_put_term(zse, name) && + zcbor_tstr_put_term(zse, name, CONFIG_ZCBOR_MAX_STR_LEN) && (max_size == 0 || (zcbor_tstr_put_lit(zse, "max_size") && zcbor_uint32_put(zse, max_size))) && zcbor_map_end_encode(zse, 2); @@ -51,11 +51,11 @@ bool create_settings_mgmt_write_packet(zcbor_state_t *zse, uint8_t *buffer, uint { bool ok; - ok = zcbor_map_start_encode(zse, 2) && - zcbor_tstr_put_lit(zse, "name") && - zcbor_tstr_put_term(zse, name) && - zcbor_tstr_put_lit(zse, "val") && - zcbor_bstr_encode_ptr(zse, val, val_size) && + ok = zcbor_map_start_encode(zse, 2) && + zcbor_tstr_put_lit(zse, "name") && + zcbor_tstr_put_term(zse, name, CONFIG_ZCBOR_MAX_STR_LEN) && + zcbor_tstr_put_lit(zse, "val") && + zcbor_bstr_encode_ptr(zse, val, val_size) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); @@ -72,9 +72,9 @@ bool create_settings_mgmt_delete_packet(zcbor_state_t *zse, uint8_t *buffer, { bool ok; - ok = zcbor_map_start_encode(zse, 2) && - zcbor_tstr_put_lit(zse, "name") && - zcbor_tstr_put_term(zse, name) && + ok = zcbor_map_start_encode(zse, 2) && + zcbor_tstr_put_lit(zse, "name") && + zcbor_tstr_put_term(zse, name, CONFIG_ZCBOR_MAX_STR_LEN) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/smp_version/src/main.c b/tests/subsys/mgmt/mcumgr/smp_version/src/main.c index 8676678336e..ed596ae964e 100644 --- a/tests/subsys/mgmt/mcumgr/smp_version/src/main.c +++ b/tests/subsys/mgmt/mcumgr/smp_version/src/main.c @@ -155,7 +155,7 @@ ZTEST(smp_version, test_legacy_command) zassert_equal(smp_header->nh_version, LEGACY_VERSION, "Expected response header version mismatch"); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -242,7 +242,7 @@ ZTEST(smp_version, test_current_command) zassert_equal(smp_header->nh_version, CURRENT_VERSION, "Expected response header version mismatch"); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -328,7 +328,7 @@ ZTEST(smp_version, test_new_command) zassert_equal(smp_header->nh_version, CURRENT_VERSION, "Expected response header version mismatch"); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); diff --git a/tests/subsys/mgmt/mcumgr/smp_version/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/smp_version/src/smp_test_util.c index e93ad69ff2a..96d97a6b6fa 100644 --- a/tests/subsys/mgmt/mcumgr/smp_version/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/smp_version/src/smp_test_util.c @@ -32,7 +32,7 @@ bool create_mcumgr_format_packet(zcbor_state_t *zse, const uint8_t *format, uint ok = zcbor_map_start_encode(zse, 2) && zcbor_tstr_put_lit(zse, "format") && - zcbor_tstr_put_term(zse, format) && + zcbor_tstr_put_term(zse, format, CONFIG_ZCBOR_MAX_STR_LEN) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c b/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c index e50dc8fe51f..b1d3d79b30a 100644 --- a/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c +++ b/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c @@ -60,7 +60,7 @@ ZTEST(zcbor_bulk, test_correct) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -101,7 +101,7 @@ ZTEST(zcbor_bulk, test_correct_out_of_order) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -140,7 +140,7 @@ ZTEST(zcbor_bulk, test_not_map) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -175,7 +175,7 @@ ZTEST(zcbor_bulk, test_bad_type) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -211,7 +211,7 @@ ZTEST(zcbor_bulk, test_bad_type_2) zcbor_tstr_put_lit(zsd, "bool val") && zcbor_true_put(zsd) && zcbor_map_end_encode(zsd, 10); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -252,7 +252,7 @@ ZTEST(zcbor_bulk, test_bad_type_encoded) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -287,7 +287,7 @@ ZTEST(zcbor_bulk, test_duplicate) zcbor_tstr_put_lit(zsd, "hello") && zcbor_tstr_put_lit(zsd, "world") && zcbor_map_end_encode(zsd, 10); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -366,7 +366,7 @@ ZTEST(zcbor_bulk, test_map_in_map_correct) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -445,7 +445,7 @@ ZTEST(zcbor_bulk, test_map_in_map_bad) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -486,7 +486,7 @@ ZTEST(zcbor_bulk, test_key_found) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -528,7 +528,7 @@ ZTEST(zcbor_bulk, test_reset) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); From a0cbbed81a09dfb959a2272639f144c99de92a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Fri, 26 Jan 2024 13:27:12 +0100 Subject: [PATCH 0539/2300] [nrf fromtree] west.yml: Update zcbor from 0.8.0 to 0.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Brings a few improvements and bugfixes, most notably: - Adds a forward declaration of strnlen() - Adds a ZCBOR_VERSION macro Signed-off-by: Øyvind Rønningstad (cherry picked from commit 8396bf0d9843439dfa558f2d391ed60c71c378fd) (cherry picked from commit 5a0e16d090126266dd5fa2d07b9cf01b51aa339a) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 18e4ba0ab58..03a830da77c 100644 --- a/west.yml +++ b/west.yml @@ -335,7 +335,7 @@ manifest: revision: 150f4eb2955eaf36ac0f9519d4f4f58d5ade5740 path: modules/lib/uoscore-uedhoc - name: zcbor - revision: dbe20afd00b3ddd6956f4b47f5df202bb49a8707 + revision: d3093b5684f62268c7f27f8a5079f166772619de path: modules/lib/zcbor self: From 227f00280cd44bbd05fd2918189f318ab41507a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Fri, 26 Jan 2024 15:17:44 +0100 Subject: [PATCH 0540/2300] [nrf fromtree] lwm2m: Regenerate zcbor files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with zcbor 0.8.1 Signed-off-by: Øyvind Rønningstad (cherry picked from commit 3ad47d214a7d5b5af233060413e92e97a21b13e4) (cherry picked from commit c5c7fb3967905dcaef1035ac8d5b234176a2cc0a) --- subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch | 10 +++++----- subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch b/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch index 81ec06bab8b..41bb3f0a5d4 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch @@ -5,7 +5,7 @@ index c12f477cce..f41b81275d 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 @@ -47,7 +47,7 @@ index a36f8782c6..b913fb78e9 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 @@ -72,7 +72,7 @@ index 94926c531f..5521917853 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 @@ -120,7 +120,7 @@ index df2f0ac6a1..8fa1eedb2b 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 @@ -145,7 +145,7 @@ index 77649036ef..f0a2958072 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c index 3906d476cac..28b0265b9cc 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h index b47b79de615..4e1fdeb66a2 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c index 9cf4f3457c6..14ec7431e5b 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h index 49ce5c55159..fc08ead18d4 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh index 448a9020862..cf293d7b579 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh @@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0 git add -A git commit -s -m"pre-patch" -git apply lwm2m_senml_cbor.patch +git apply --reject lwm2m_senml_cbor.patch clang-format -i \ lwm2m_senml_cbor_decode.c lwm2m_senml_cbor_decode.h \ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h index 4c41385ba4b..dbb5a368551 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.8.1 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ From 5423e96da2a404ec57296ecf432e0bca32a28236 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Fri, 23 Jun 2023 13:11:20 +0200 Subject: [PATCH 0541/2300] [nrf fromlist] drivers: Add flash driver for RRAM Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68309 Added a simple driver for RRAM. It is implemented as a flash driver, because the "RRAM eFlash" macro obeys flash-like constraints. Although users are not required to erase before write. Signed-off-by: Jakub Zymelka (cherry picked from commit 166f0c03cc452794c6446e7482a78e835fb435e2) --- drivers/flash/CMakeLists.txt | 1 + drivers/flash/Kconfig | 2 + drivers/flash/Kconfig.nrf_rram | 38 ++++ drivers/flash/soc_flash_nrf_rram.c | 180 ++++++++++++++++++ .../nordic,rram-controller.yaml | 16 ++ 5 files changed, 237 insertions(+) create mode 100644 drivers/flash/Kconfig.nrf_rram create mode 100644 drivers/flash/soc_flash_nrf_rram.c create mode 100644 dts/bindings/flash_controller/nordic,rram-controller.yaml diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index 4a02268a2b4..7426b43b089 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -118,3 +118,4 @@ 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_SOC_FLASH_NUMAKER soc_flash_numaker.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_RRAM soc_flash_nrf_rram.c) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index 698190e7780..03d4d07a193 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -160,4 +160,6 @@ source "drivers/flash/Kconfig.andes" source "drivers/flash/Kconfig.ambiq" +source "drivers/flash/Kconfig.nrf_rram" + endif # FLASH diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram new file mode 100644 index 00000000000..6d100dabab6 --- /dev/null +++ b/drivers/flash/Kconfig.nrf_rram @@ -0,0 +1,38 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +menuconfig SOC_FLASH_NRF_RRAM + bool "Nordic Semiconductor flash driver for nRF RRAM" + default y + depends on DT_HAS_NORDIC_RRAM_CONTROLLER_ENABLED + select FLASH_HAS_DRIVER_ENABLED + select FLASH_HAS_PAGE_LAYOUT + select FLASH_NRF_FORCE_ALT + select MPU_ALLOW_FLASH_WRITE if ARM_MPU + help + Enables Nordic Semiconductor flash driver for nRF RRAM controllers. + The entire contiguous block of RRAM gets logically divided into pages, + but partial erase is always supported. + +if SOC_FLASH_NRF_RRAM + +config NRF_RRAM_WRITE_BUFFER_SIZE + int "Internal write-buffer size" + default 0 + range 0 32 + help + Number of 128-bit words. + Maximum buffer size can be configured to the value of 32 (128-bit words). + Set 0 to disable write-buffer. + +config NRF_RRAM_READYNEXT_TIMEOUT_VALUE + int "Preload timeout value for waiting for a next write in RRAMC clock cycles" + default 128 + range 0 4095 + help + Set 0 to disable ready next timeout counter. + +endif # SOC_FLASH_NRF_RRAM diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c new file mode 100644 index 00000000000..76a855b9787 --- /dev/null +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nordic_rram_controller + +#include +#include +#include +#include +#include +#include +#include +#include + +LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); + +#define RRAM DT_INST(0, soc_nv_flash) + +#define RRAM_START DT_REG_ADDR(RRAM) +#define RRAM_SIZE DT_REG_SIZE(RRAM) + +#define RRAM_WORD_SIZE 4 + +#define PAGE_SIZE DT_PROP(RRAM, erase_block_size) +#define PAGE_COUNT ((RRAM_SIZE) / (PAGE_SIZE)) + +#define ERASE_VALUE 0xFF + +#if CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE > 0 +#define WRITE_BUFFER_ENABLE 1 +#define WRITE_BUFFER_SIZE CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE +#define WRITE_LINE_SIZE 16 /* In bytes, one line is 128 bits. */ +#else +#define WRITE_BUFFER_ENABLE 0 +#define WRITE_BUFFER_SIZE 0 +#define WRITE_LINE_SIZE RRAM_WORD_SIZE +#endif + +static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start, + size_t boundary_size) +{ + return (addr >= boundary_start && (addr < (boundary_start + boundary_size)) && + (len <= (boundary_start + boundary_size - addr))); +} + +#if WRITE_BUFFER_ENABLE +static void commit_changes(size_t len) +{ + if (nrf_rramc_empty_buffer_check(NRF_RRAMC)) { + /* The internal write-buffer has been committed to RRAM and is now empty. */ + return; + } + + if ((len % (WRITE_LINE_SIZE * WRITE_BUFFER_SIZE)) == 0) { + /* Our last operation was buffer size-aligned, so we're done. */ + return; + } + + nrf_rramc_task_trigger(NRF_RRAMC, NRF_RRAMC_TASK_COMMIT_WRITEBUF); + + barrier_dmem_fence_full(); +} +#endif + +static int rram_write(const struct device *dev, off_t addr, const void *data, size_t len) +{ + ARG_UNUSED(dev); + + if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { + return -EINVAL; + } + addr += RRAM_START; + + LOG_DBG("Write: %p:%zu", (void *)addr, len); + + nrf_rramc_config_t config = {.mode_write = true, .write_buff_size = WRITE_BUFFER_SIZE}; + + nrf_rramc_config_set(NRF_RRAMC, &config); + + if (data) { + memcpy((void *)addr, data, len); + } else { + memset((void *)addr, ERASE_VALUE, len); + } + + barrier_dmem_fence_full(); /* Barrier following our last write. */ + +#if WRITE_BUFFER_ENABLE + commit_changes(len); +#endif + + config.mode_write = false; + nrf_rramc_config_set(NRF_RRAMC, &config); + + return 0; +} + +static int flash_nrf_rram_read(const struct device *dev, off_t addr, void *data, size_t len) +{ + ARG_UNUSED(dev); + + if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { + return -EINVAL; + } + addr += RRAM_START; + + memcpy(data, (void *)addr, len); + + return 0; +} + +static int flash_nrf_rram_write(const struct device *dev, off_t addr, const void *data, size_t len) +{ + return rram_write(dev, addr, data, len); +} + +static int flash_nrf_rram_erase(const struct device *dev, off_t addr, size_t len) +{ + return rram_write(dev, addr, NULL, len); +} + +static const struct flash_parameters *flash_nrf_rram_get_parameters(const struct device *dev) +{ + ARG_UNUSED(dev); + + static const struct flash_parameters parameters = { + .write_block_size = WRITE_LINE_SIZE, + .erase_value = ERASE_VALUE, + }; + + return ¶meters; +} + +#if defined(CONFIG_FLASH_PAGE_LAYOUT) +static void flash_nrf_rram_page_layout(const struct device *dev, + const struct flash_pages_layout **layout, + size_t *layout_size) +{ + ARG_UNUSED(dev); + + static const struct flash_pages_layout pages_layout = { + .pages_count = PAGE_COUNT, + .pages_size = PAGE_SIZE, + }; + + *layout = &pages_layout; + *layout_size = 1; +} +#endif + +static const struct flash_driver_api flash_nrf_rram_api = { + .read = flash_nrf_rram_read, + .write = flash_nrf_rram_write, + .erase = flash_nrf_rram_erase, + .get_parameters = flash_nrf_rram_get_parameters, +#if defined(CONFIG_FLASH_PAGE_LAYOUT) + .page_layout = flash_nrf_rram_page_layout, +#endif +}; + +static int flash_nrf_rram_init(const struct device *dev) +{ + ARG_UNUSED(dev); + +#if CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE > 0 + nrf_rramc_ready_next_timeout_t params = { + .value = CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE, + .enable = true, + }; + nrf_rramc_ready_next_timeout_set(NRF_RRAMC, ¶ms); +#endif + + return 0; +} + +DEVICE_DT_INST_DEFINE(0, flash_nrf_rram_init, NULL, NULL, NULL, POST_KERNEL, + CONFIG_FLASH_INIT_PRIORITY, &flash_nrf_rram_api); diff --git a/dts/bindings/flash_controller/nordic,rram-controller.yaml b/dts/bindings/flash_controller/nordic,rram-controller.yaml new file mode 100644 index 00000000000..be764127f09 --- /dev/null +++ b/dts/bindings/flash_controller/nordic,rram-controller.yaml @@ -0,0 +1,16 @@ +# +# Copyright (c) 2023 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-4-Clause +# + +description: | + Nordic RRAMC (Resistive random access memory controller) + + The resistive random access memory controller (RRAMC) is used for writing + the internal RRAM memory, the secure information configuration registers (SICR), + and the user information configuration registers (UICR). + +compatible: "nordic,rram-controller" + +include: base.yaml From 16dbfa6172d366029f48d9f33c014ed5f4a3ed2a Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 10 Aug 2023 15:33:30 +0200 Subject: [PATCH 0542/2300] [nrf fromlist] drivers/flash: add radio synchronization to RRAM Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68309 Added synchronization with BLE radio operation to the RRAM flash driver. The implementation is using framework which is already provided for nrf52's flash driver. Additional added resource locking mechanism while driver does writing which solves mutual exclusion write access problem. Signed-off-by: Andrzej Puzdrowski Signed-off-by: Jakub Zymelka (cherry picked from commit 54f071c8064eea36938ffd66952bc15848d2cd58) --- drivers/flash/Kconfig.nrf_rram | 25 +++++ drivers/flash/soc_flash_nrf_rram.c | 142 ++++++++++++++++++++++++++--- 2 files changed, 154 insertions(+), 13 deletions(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index 6d100dabab6..f6e3ccc6416 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -35,4 +35,29 @@ config NRF_RRAM_READYNEXT_TIMEOUT_VALUE help Set 0 to disable ready next timeout counter. +choice SOC_FLASH_NRF_RADIO_SYNC_CHOICE + prompt "Nordic nRFx flash driver synchronization" + default SOC_FLASH_NRF_RADIO_SYNC_TICKER if BT_LL_SW_SPLIT + default SOC_FLASH_NRF_RADIO_SYNC_NONE + help + synchronization between flash memory driver and radio. + +config SOC_FLASH_NRF_RADIO_SYNC_TICKER + bool "Nordic nRFx flash driver synchronized with radio" + depends on BT_LL_SW_SPLIT + help + Enable synchronization between flash memory driver and radio using + BLE LL controller ticker API. + +config SOC_FLASH_NRF_RADIO_SYNC_NONE + bool "none" + help + disable synchronization between flash memory driver and radio. +endchoice + +config SOC_FLASH_NRF_TIMEOUT_MULTIPLIER + int + depends on !SOC_FLASH_NRF_RADIO_SYNC_NONE + default 1 + endif # SOC_FLASH_NRF_RRAM diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 76a855b9787..64780fc3013 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -15,6 +15,8 @@ #include #include +#include + LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define RRAM DT_INST(0, soc_nv_flash) @@ -29,6 +31,11 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define ERASE_VALUE 0xFF +static struct k_sem sem_lock; +#define SYNC_INIT() k_sem_init(&sem_lock, 1, 1) +#define SYNC_LOCK() k_sem_take(&sem_lock, K_FOREVER) +#define SYNC_UNLOCK() k_sem_give(&sem_lock) + #if CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE > 0 #define WRITE_BUFFER_ENABLE 1 #define WRITE_BUFFER_SIZE CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE @@ -39,6 +46,20 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define WRITE_LINE_SIZE RRAM_WORD_SIZE #endif +#ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE +#define FLASH_SLOT_WRITE 5000 + +#if WRITE_BUFFER_ENABLE +#define RRAM_MAX_WRITE_BUFFER (WRITE_BUFFER_SIZE * WRITE_LINE_SIZE) +#else +#define RRAM_MAX_WRITE_BUFFER (WRITE_LINE_SIZE * 32) +#endif + +static int write_op(void *context); /* instance of flash_op_handler_t */ +static int write_synchronously(off_t addr, const void *data, size_t len); + +#endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ + static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start, size_t boundary_size) { @@ -65,17 +86,8 @@ static void commit_changes(size_t len) } #endif -static int rram_write(const struct device *dev, off_t addr, const void *data, size_t len) +static void rram_write(off_t addr, const void *data, size_t len) { - ARG_UNUSED(dev); - - if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { - return -EINVAL; - } - addr += RRAM_START; - - LOG_DBG("Write: %p:%zu", (void *)addr, len); - nrf_rramc_config_t config = {.mode_write = true, .write_buff_size = WRITE_BUFFER_SIZE}; nrf_rramc_config_set(NRF_RRAMC, &config); @@ -94,8 +106,102 @@ static int rram_write(const struct device *dev, off_t addr, const void *data, si config.mode_write = false; nrf_rramc_config_set(NRF_RRAMC, &config); +} - return 0; +#ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE +static void shift_write_context(uint32_t shift, struct flash_context *w_ctx) +{ + w_ctx->flash_addr += shift; + + /* NULL data_addr => erase emulation request*/ + if (w_ctx->data_addr) { + w_ctx->data_addr += shift; + } + + w_ctx->len -= shift; +} + +static int write_op(void *context) +{ + struct flash_context *w_ctx = context; + size_t len; + + uint32_t i = 0U; + + if (w_ctx->enable_time_limit) { + nrf_flash_sync_get_timestamp_begin(); + } + + while (w_ctx->len > 0) { + if (RRAM_MAX_WRITE_BUFFER < w_ctx->len) { + len = (RRAM_MAX_WRITE_BUFFER < w_ctx->len) ? RRAM_MAX_WRITE_BUFFER + : w_ctx->len; + } + + rram_write(w_ctx->flash_addr, (const void *)w_ctx->data_addr, len); + + shift_write_context(sizeof(uint32_t), w_ctx); + + if (w_ctx->len > 0) { + i++; + + if (w_ctx->enable_time_limit) { + if (nrf_flash_sync_check_time_limit(i)) { + return FLASH_OP_ONGOING; + } + } + } + } + + return FLASH_OP_DONE; +} + +static int write_synchronously(off_t addr, const void *data, size_t len) +{ + struct flash_context context = { + .data_addr = (uint32_t)data, + .flash_addr = addr, + .len = len, + .enable_time_limit = 1 /* enable time limit */ + }; + + struct flash_op_desc flash_op_desc = {.handler = write_op, .context = &context}; + + nrf_flash_sync_set_context(FLASH_SLOT_WRITE); + return nrf_flash_sync_exe(&flash_op_desc); +} + +#endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ + +static int flash_nrf_write(off_t addr, const void *data, size_t len) +{ + int ret = 0; + + if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { + return -EINVAL; + } + addr += RRAM_START; + + if (!len) { + return 0; + } + + LOG_DBG("Write: %p:%zu", (void *)addr, len); + + SYNC_LOCK(); + +#ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE + if (nrf_flash_sync_is_required()) { + ret = write_synchronously(addr, data, len); + } else +#endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ + { + rram_write(addr, data, len); + } + + SYNC_UNLOCK(); + + return ret; } static int flash_nrf_rram_read(const struct device *dev, off_t addr, void *data, size_t len) @@ -114,12 +220,16 @@ static int flash_nrf_rram_read(const struct device *dev, off_t addr, void *data, static int flash_nrf_rram_write(const struct device *dev, off_t addr, const void *data, size_t len) { - return rram_write(dev, addr, data, len); + ARG_UNUSED(dev); + + return flash_nrf_write(addr, data, len); } static int flash_nrf_rram_erase(const struct device *dev, off_t addr, size_t len) { - return rram_write(dev, addr, NULL, len); + ARG_UNUSED(dev); + + return flash_nrf_write(addr, NULL, len); } static const struct flash_parameters *flash_nrf_rram_get_parameters(const struct device *dev) @@ -165,6 +275,12 @@ static int flash_nrf_rram_init(const struct device *dev) { ARG_UNUSED(dev); + SYNC_INIT(); + +#ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE + nrf_flash_sync_init(); +#endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ + #if CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE > 0 nrf_rramc_ready_next_timeout_t params = { .value = CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE, From 679b781fe5f78da22f81995a1734cb372b6252e7 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 7 Sep 2023 20:29:16 +0200 Subject: [PATCH 0543/2300] [nrf fromlist] drivers/flash: fix nRF RRAM write-length issue while MPSL in use Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68309 When radio-synchronization was on (CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE=n) context of writing was shifted by 4 instead of write-length (this caused redundant, self-shortening writes to the same block.) write-len was unset when requested write len was less than RRAM_MAX_WRITE_BUFFER. Signed-off-by: Andrzej Puzdrowski Signed-off-by: Jakub Zymelka (cherry picked from commit 2e5653202b8ba503ff5b99612ef5601ff4301b30) --- drivers/flash/soc_flash_nrf_rram.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 64780fc3013..8c97285319f 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -133,14 +133,11 @@ static int write_op(void *context) } while (w_ctx->len > 0) { - if (RRAM_MAX_WRITE_BUFFER < w_ctx->len) { - len = (RRAM_MAX_WRITE_BUFFER < w_ctx->len) ? RRAM_MAX_WRITE_BUFFER - : w_ctx->len; - } + len = (RRAM_MAX_WRITE_BUFFER < w_ctx->len) ? RRAM_MAX_WRITE_BUFFER : w_ctx->len; rram_write(w_ctx->flash_addr, (const void *)w_ctx->data_addr, len); - shift_write_context(sizeof(uint32_t), w_ctx); + shift_write_context(len, w_ctx); if (w_ctx->len > 0) { i++; From 936f88282e0d6f6c6317c2ad6a57209ab397ed21 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 26 Sep 2023 17:02:10 +0200 Subject: [PATCH 0544/2300] [nrf fromlist] drivers/flash/rram: set to use up to 512 B burst writes by default Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68309 Now RRAMC is set to use up to 512 B burst writes by default as most time effective. Requested slot time was changed to 8000 us for that case, as this is required in order to hold the longest write operation. Drivers differs slot duration depending on configured RRAMC buffers count (CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE). Signed-off-by: Andrzej Puzdrowski (cherry picked from commit eb33cf1ffbda3885e72271008a66721bba1d7cc1) --- drivers/flash/Kconfig.nrf_rram | 1 + drivers/flash/soc_flash_nrf_rram.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index f6e3ccc6416..3ec7005acde 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -21,6 +21,7 @@ if SOC_FLASH_NRF_RRAM config NRF_RRAM_WRITE_BUFFER_SIZE int "Internal write-buffer size" + default 32 if !SOC_FLASH_NRF_RADIO_SYNC_NONE default 0 range 0 32 help diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 8c97285319f..44ce514cda8 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -47,7 +47,18 @@ static struct k_sem sem_lock; #endif #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE -#define FLASH_SLOT_WRITE 5000 + +#if (WRITE_BUFFER_SIZE < 2) +#define FLASH_SLOT_WRITE 500 +#elif (WRITE_BUFFER_SIZE < 4) +#define FLASH_SLOT_WRITE 1000 +#elif (WRITE_BUFFER_SIZE < 9) +#define FLASH_SLOT_WRITE 2000 +#elif (WRITE_BUFFER_SIZE < 17) +#define FLASH_SLOT_WRITE 4000 +#else +#define FLASH_SLOT_WRITE 8000 /* longest write takes 7107 us */ +#endif #if WRITE_BUFFER_ENABLE #define RRAM_MAX_WRITE_BUFFER (WRITE_BUFFER_SIZE * WRITE_LINE_SIZE) From 76a054d357f7a288d8135757b63d654ffc8113d2 Mon Sep 17 00:00:00 2001 From: Pierce Lowe Date: Fri, 10 Nov 2023 09:23:49 +0100 Subject: [PATCH 0545/2300] [nrf fromlist] drivers: flash: rram: Make rram flash timeout multiplier user selectable Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68309 Make flash timeout multiplier user selectable for rram flash driver Signed-off-by: Pierce Lowe (cherry picked from commit ff4fea43b026f16392ec4e9ad458593974980caf) --- drivers/flash/Kconfig.nrf_rram | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index 3ec7005acde..68efde1ab30 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -57,8 +57,13 @@ config SOC_FLASH_NRF_RADIO_SYNC_NONE endchoice config SOC_FLASH_NRF_TIMEOUT_MULTIPLIER - int + int "Multiplier for flash operation timeouts [x0.1]" depends on !SOC_FLASH_NRF_RADIO_SYNC_NONE default 1 + help + This is a multiplier that will be divided by 10 that is applied + to the flash erase and write operations timeout. The base for + the multiplication would allow erasing all nRF flash pages in + blocking mode. endif # SOC_FLASH_NRF_RRAM From 33b35ded3b3b641005eea1edc71cd4da523090bb Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Tue, 6 Feb 2024 22:01:14 +0100 Subject: [PATCH 0546/2300] [nrf fromlist] drivers: flash: rram: minor driver code changes Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68309 Minor changes to standardize the driver code. Signed-off-by: Jakub Zymelka Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 76bc861882642baa4d49b8d83184f19e50851712) --- drivers/flash/soc_flash_nrf_rram.c | 75 ++++++++++++++++-------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 44ce514cda8..369ff61c556 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -24,12 +24,11 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define RRAM_START DT_REG_ADDR(RRAM) #define RRAM_SIZE DT_REG_SIZE(RRAM) -#define RRAM_WORD_SIZE 4 - #define PAGE_SIZE DT_PROP(RRAM, erase_block_size) #define PAGE_COUNT ((RRAM_SIZE) / (PAGE_SIZE)) -#define ERASE_VALUE 0xFF +#define WRITE_BLOCK_SIZE_FROM_DT DT_PROP(RRAM, write_block_size) +#define ERASE_VALUE 0xFF static struct k_sem sem_lock; #define SYNC_INIT() k_sem_init(&sem_lock, 1, 1) @@ -37,13 +36,20 @@ static struct k_sem sem_lock; #define SYNC_UNLOCK() k_sem_give(&sem_lock) #if CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE > 0 -#define WRITE_BUFFER_ENABLE 1 -#define WRITE_BUFFER_SIZE CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE -#define WRITE_LINE_SIZE 16 /* In bytes, one line is 128 bits. */ +#define WRITE_BUFFER_ENABLE 1 +#define WRITE_BUFFER_SIZE CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE +#define WRITE_LINE_SIZE 16 /* In bytes, one line is 128 bits. */ +#define WRITE_BUFFER_MAX_SIZE (WRITE_BUFFER_SIZE * WRITE_LINE_SIZE) +BUILD_ASSERT((PAGE_SIZE % (WRITE_LINE_SIZE) == 0), "erase-block-size must be a multiple of 16"); +BUILD_ASSERT((WRITE_BLOCK_SIZE_FROM_DT % (WRITE_LINE_SIZE) == 0), + "if NRF_RRAM_WRITE_BUFFER_SIZE > 0, then write-block-size must be a multiple of 16"); #else -#define WRITE_BUFFER_ENABLE 0 -#define WRITE_BUFFER_SIZE 0 -#define WRITE_LINE_SIZE RRAM_WORD_SIZE +#define WRITE_BUFFER_ENABLE 0 +#define WRITE_BUFFER_SIZE 0 +#define WRITE_LINE_SIZE WRITE_BLOCK_SIZE_FROM_DT +#define WRITE_BUFFER_MAX_SIZE 16 /* In bytes, one line is 128 bits. */ +BUILD_ASSERT((PAGE_SIZE % (WRITE_LINE_SIZE) == 0), + "erase-block-size must be a multiple of write-block-size"); #endif #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE @@ -60,12 +66,6 @@ static struct k_sem sem_lock; #define FLASH_SLOT_WRITE 8000 /* longest write takes 7107 us */ #endif -#if WRITE_BUFFER_ENABLE -#define RRAM_MAX_WRITE_BUFFER (WRITE_BUFFER_SIZE * WRITE_LINE_SIZE) -#else -#define RRAM_MAX_WRITE_BUFFER (WRITE_LINE_SIZE * 32) -#endif - static int write_op(void *context); /* instance of flash_op_handler_t */ static int write_synchronously(off_t addr, const void *data, size_t len); @@ -86,7 +86,7 @@ static void commit_changes(size_t len) return; } - if ((len % (WRITE_LINE_SIZE * WRITE_BUFFER_SIZE)) == 0) { + if ((len % (WRITE_BUFFER_MAX_SIZE)) == 0) { /* Our last operation was buffer size-aligned, so we're done. */ return; } @@ -144,7 +144,7 @@ static int write_op(void *context) } while (w_ctx->len > 0) { - len = (RRAM_MAX_WRITE_BUFFER < w_ctx->len) ? RRAM_MAX_WRITE_BUFFER : w_ctx->len; + len = (w_ctx->len > WRITE_BUFFER_MAX_SIZE) ? WRITE_BUFFER_MAX_SIZE : w_ctx->len; rram_write(w_ctx->flash_addr, (const void *)w_ctx->data_addr, len); @@ -181,7 +181,7 @@ static int write_synchronously(off_t addr, const void *data, size_t len) #endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ -static int flash_nrf_write(off_t addr, const void *data, size_t len) +static int nrf_write(off_t addr, const void *data, size_t len) { int ret = 0; @@ -212,7 +212,7 @@ static int flash_nrf_write(off_t addr, const void *data, size_t len) return ret; } -static int flash_nrf_rram_read(const struct device *dev, off_t addr, void *data, size_t len) +static int nrf_rram_read(const struct device *dev, off_t addr, void *data, size_t len) { ARG_UNUSED(dev); @@ -226,21 +226,25 @@ static int flash_nrf_rram_read(const struct device *dev, off_t addr, void *data, return 0; } -static int flash_nrf_rram_write(const struct device *dev, off_t addr, const void *data, size_t len) +static int nrf_rram_write(const struct device *dev, off_t addr, const void *data, size_t len) { ARG_UNUSED(dev); - return flash_nrf_write(addr, data, len); + if (data == NULL) { + return -EINVAL; + } + + return nrf_write(addr, data, len); } -static int flash_nrf_rram_erase(const struct device *dev, off_t addr, size_t len) +static int nrf_rram_erase(const struct device *dev, off_t addr, size_t len) { ARG_UNUSED(dev); - return flash_nrf_write(addr, NULL, len); + return nrf_write(addr, NULL, len); } -static const struct flash_parameters *flash_nrf_rram_get_parameters(const struct device *dev) +static const struct flash_parameters *nrf_rram_get_parameters(const struct device *dev) { ARG_UNUSED(dev); @@ -253,9 +257,8 @@ static const struct flash_parameters *flash_nrf_rram_get_parameters(const struct } #if defined(CONFIG_FLASH_PAGE_LAYOUT) -static void flash_nrf_rram_page_layout(const struct device *dev, - const struct flash_pages_layout **layout, - size_t *layout_size) +static void nrf_rram_page_layout(const struct device *dev, const struct flash_pages_layout **layout, + size_t *layout_size) { ARG_UNUSED(dev); @@ -269,17 +272,17 @@ static void flash_nrf_rram_page_layout(const struct device *dev, } #endif -static const struct flash_driver_api flash_nrf_rram_api = { - .read = flash_nrf_rram_read, - .write = flash_nrf_rram_write, - .erase = flash_nrf_rram_erase, - .get_parameters = flash_nrf_rram_get_parameters, +static const struct flash_driver_api nrf_rram_api = { + .read = nrf_rram_read, + .write = nrf_rram_write, + .erase = nrf_rram_erase, + .get_parameters = nrf_rram_get_parameters, #if defined(CONFIG_FLASH_PAGE_LAYOUT) - .page_layout = flash_nrf_rram_page_layout, + .page_layout = nrf_rram_page_layout, #endif }; -static int flash_nrf_rram_init(const struct device *dev) +static int nrf_rram_init(const struct device *dev) { ARG_UNUSED(dev); @@ -300,5 +303,5 @@ static int flash_nrf_rram_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, flash_nrf_rram_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_nrf_rram_api); +DEVICE_DT_INST_DEFINE(0, nrf_rram_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, + &nrf_rram_api); From bbe2567a9ba81c2fdba57f324d39ce22fe633a25 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Wed, 31 Jan 2024 10:25:08 +0100 Subject: [PATCH 0547/2300] [nrf fromlist] drivers: flash: rram singlethreading support Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68309 Adds conditional usage of locking mechanisms to allow building without multithreading. Signed-off-by: Mateusz Michalek (cherry picked from commit 1d09dda4feb77fa36549cd32cf88dd13d0abeb4e) --- drivers/flash/soc_flash_nrf_rram.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 369ff61c556..4930eb31697 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -30,10 +30,16 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define WRITE_BLOCK_SIZE_FROM_DT DT_PROP(RRAM, write_block_size) #define ERASE_VALUE 0xFF +#ifdef CONFIG_MULTITHREADING static struct k_sem sem_lock; #define SYNC_INIT() k_sem_init(&sem_lock, 1, 1) #define SYNC_LOCK() k_sem_take(&sem_lock, K_FOREVER) #define SYNC_UNLOCK() k_sem_give(&sem_lock) +#else +#define SYNC_INIT() +#define SYNC_LOCK() +#define SYNC_UNLOCK() +#endif /* CONFIG_MULTITHREADING */ #if CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE > 0 #define WRITE_BUFFER_ENABLE 1 From 1ead4c257b3b67b92e0e3f39eb2c763673cc666a Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Tue, 20 Feb 2024 15:05:57 +0100 Subject: [PATCH 0548/2300] [nrf fromlist] Bluetooth: Controller: Remove experimental from LE Set Host Feature Out-of-tree controllers do not necessarily mark the LE Set Host Feature command as experimantal. Add an additional entry to solve this like done for other ISO entries. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69245 Signed-off-by: Rubin Gerritsen (cherry picked from commit 577ef433310216cbc4acd38be0724f0821ffa520) --- subsys/bluetooth/controller/Kconfig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 7d430ded1e1..d982f3c8d26 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -812,11 +812,14 @@ config BT_CTLR_SYNC_ISO_PDU_LEN_MAX endif # BT_CTLR_ADV_EXT config BT_CTLR_SET_HOST_FEATURE - bool "LE Set Host Feature Command [EXPERIMENTAL]" - select EXPERIMENTAL + bool "LE Set Host Feature Command" if !BT_LL_SW_SPLIT help Enables optional LE Set Host Feature Command +config BT_CTLR_SET_HOST_FEATURE + bool "LE Set Host Feature Command (Split Link Layer) [EXPERIMENTAL]" if BT_LL_SW_SPLIT + select EXPERIMENTAL if BT_LL_SW_SPLIT + config BT_CTLR_CENTRAL_ISO bool "LE Connected Isochronous Stream Central" if !BT_LL_SW_SPLIT depends on BT_CTLR_CENTRAL_ISO_SUPPORT && BT_CENTRAL From 53f95da47e946c118367fd3724d9b6410cfe9ea3 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 21 Feb 2024 13:21:30 +0200 Subject: [PATCH 0549/2300] [nrf fromlist] modem: backends: uart_async: log the number of bytes dropped Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69288 When a receive buffer overrun happens. Signed-off-by: Tomi Fontanilles (cherry picked from commit 73c45775c314af2b0c1c8ee4837caafa6439c166) --- subsys/modem/backends/modem_backend_uart_async.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 29107198c2f..0fa3684780e 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -114,7 +114,8 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, if (received < evt->data.rx.len) { ring_buf_reset(&backend->async.receive_rb); k_spin_unlock(&backend->async.receive_rb_lock, key); - LOG_WRN("Receive buffer overrun"); + LOG_WRN("Receive buffer overrun (%u/%u dropped)", + evt->data.rx.len - received, evt->data.rx.len); break; } From 4c36459d673f2d4bda0dc7a031862dae947aacd0 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 21 Feb 2024 13:27:31 +0200 Subject: [PATCH 0550/2300] [nrf fromlist] drivers: modem_cellular: fine tune nRF91's shutdown_time Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69288 A shutdown lasting more than 5 seconds was experienced. Signed-off-by: Tomi Fontanilles (cherry picked from commit f7718c38852467bb30095015c92222ddaddd57d5) --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index ed4e998fec3..276c9d38f7b 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -2219,7 +2219,7 @@ MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, .power_pulse_duration_ms = 100, \ .reset_pulse_duration_ms = 100, \ .startup_time_ms = 2000, \ - .shutdown_time_ms = 3000, \ + .shutdown_time_ms = 10000, \ .init_chat_script = &nordic_nrf91_slm_init_chat_script, \ .dial_chat_script = &nordic_nrf91_slm_dial_chat_script, \ .periodic_chat_script = &nordic_nrf91_slm_periodic_chat_script, \ From bd0953fe392f6e5f787ce92f85ada2ded6207eab Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 21 Feb 2024 13:36:22 +0200 Subject: [PATCH 0551/2300] [nrf fromlist] samples: net: cellular_modem: small fixes/improvements Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69288 - A small delay is added after the post-restart L4_CONNECTED event is received to prevent trying to send packets too quickly. Otherwise the first packet would not get sent and the sample would hang on recv(). - Some logs and function parameters are fixed. Signed-off-by: Tomi Fontanilles (cherry picked from commit 86d6106f9c3836bd97ddd6bd82d9e1964641fa7f) --- samples/net/cellular_modem/prj.conf | 4 +++ samples/net/cellular_modem/src/main.c | 39 ++++++++++++++------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/samples/net/cellular_modem/prj.conf b/samples/net/cellular_modem/prj.conf index 52d0ca26bde..ab44ca9528e 100644 --- a/samples/net/cellular_modem/prj.conf +++ b/samples/net/cellular_modem/prj.conf @@ -22,3 +22,7 @@ CONFIG_NET_CONNECTION_MANAGER=y CONFIG_MODEM=y CONFIG_PM_DEVICE=y CONFIG_MODEM_CELLULAR=y + +# Logging +CONFIG_MODEM_MODULES_LOG_LEVEL_DBG=y +#CONFIG_MODEM_CMUX_LOG_LEVEL_DBG=y diff --git a/samples/net/cellular_modem/src/main.c b/samples/net/cellular_modem/src/main.c index 543f8d6d711..422b19b3c34 100644 --- a/samples/net/cellular_modem/src/main.c +++ b/samples/net/cellular_modem/src/main.c @@ -116,7 +116,7 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t continue; } - printk("Receiving echoed packet"); + printk("Receiving echoed packet\n"); ret = zsock_recv(socket_fd, sample_recv_buffer, sizeof(sample_recv_buffer), 0); if (ret != sizeof(sample_test_packet)) { printk("Echoed sample test packet has incorrect size\n"); @@ -137,10 +137,10 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t printk("Echo transmit time %ums\n", echo_received_ms - send_start_ms); } - printk("Successfully sent %u packets of %u packets\n", packets_sent, + printk("Successfully sent and received %u of %u packets\n", packets_sent, SAMPLE_TEST_ECHO_PACKETS); - printk("Average time per echo: %u ms\n", + printk("Average time per successful echo: %u ms\n", accumulated_ms / packets_sent); printk("Close UDP socket\n"); @@ -221,10 +221,7 @@ int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint int main(void) { struct net_if *const iface = net_if_get_first_by_type(&NET_L2_GET_NAME(PPP)); - uint32_t raised_event; uint16_t *port; - const void *info; - size_t info_len; int ret; init_sample_test_packet(); @@ -240,9 +237,8 @@ int main(void) } printk("Waiting for L4 connected\n"); - ret = net_mgmt_event_wait_on_iface(iface, - NET_EVENT_L4_CONNECTED, &raised_event, &info, - &info_len, K_SECONDS(120)); + ret = net_mgmt_event_wait_on_iface(iface, NET_EVENT_L4_CONNECTED, NULL, NULL, NULL, + K_SECONDS(120)); if (ret != 0) { printk("L4 was not connected in time\n"); @@ -250,9 +246,12 @@ int main(void) } printk("Waiting for DNS server added\n"); - ret = net_mgmt_event_wait_on_iface(iface, - NET_EVENT_DNS_SERVER_ADD, &raised_event, &info, - &info_len, K_SECONDS(10)); + ret = net_mgmt_event_wait_on_iface(iface, NET_EVENT_DNS_SERVER_ADD, NULL, NULL, NULL, + K_SECONDS(10)); + if (ret) { + printk("DNS server was not added in time\n"); + return -1; + } printk("Performing DNS lookup of %s\n", SAMPLE_TEST_ENDPOINT_HOSTNAME); ret = sample_dns_request(); @@ -286,7 +285,7 @@ int main(void) sample_test_dns_addrinfo.ai_addrlen, port); if (ret < 0) { - printk("Failed to send echo\n"); + printk("Failed to send echos\n"); return -1; } @@ -308,24 +307,26 @@ int main(void) pm_device_action_run(modem, PM_DEVICE_ACTION_RESUME); printk("Waiting for L4 connected\n"); - ret = net_mgmt_event_wait_on_iface(net_if_get_default(), - NET_EVENT_L4_CONNECTED, &raised_event, &info, - &info_len, K_SECONDS(60)); - + ret = net_mgmt_event_wait_on_iface(iface, NET_EVENT_L4_CONNECTED, NULL, NULL, NULL, + K_SECONDS(60)); if (ret != 0) { printk("L4 was not connected in time\n"); return -1; } + printk("L4 connected\n"); + + /* Wait a bit to avoid (unsuccessfully) trying to send the first echo packet too quickly. */ + k_sleep(K_SECONDS(1)); ret = sample_echo_packet(&sample_test_dns_addrinfo.ai_addr, sample_test_dns_addrinfo.ai_addrlen, port); if (ret < 0) { - printk("Failed to send echo after restart\n"); + printk("Failed to send echos after restart\n"); return -1; } - ret = net_if_down(net_if_get_default()); + ret = net_if_down(iface); if (ret < 0) { printk("Failed to bring down network interface\n"); return -1; From 3a97de47ca5cde5dba3a6584add1aa6b60d3ac5a Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Thu, 22 Feb 2024 14:54:45 +0200 Subject: [PATCH 0552/2300] [nrf fromlist] samples: net: cellular_modem: add nRF9160 DK's nRF52840 Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69288 The added configuration files allow the sample to be run on the nRF52840 present on the nRF9160 DK with the nRF9160 (running SLM) being the modem and communication happening through pins that are routed internally between the two. Signed-off-by: Tomi Fontanilles (cherry picked from commit 40a147896ec6e679ee96fbc9c16328054326d75e) --- .../boards/nrf9160dk_nrf52840.conf | 13 +++++++++++++ .../boards/nrf9160dk_nrf52840.overlay | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf create mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf52840.overlay diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf new file mode 100644 index 00000000000..2af3b6d2a41 --- /dev/null +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf @@ -0,0 +1,13 @@ +CONFIG_UART_ASYNC_API=y + +# Align with the Serial LTE Modem (SLM) application. +CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE=1500 +CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=1500 + +# Allow large UART TXs to go through @115200. +CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS=200 + +# Print logs and printk() output on uart0. +CONFIG_LOG=y +CONFIG_LOG_BACKEND_UART=y +CONFIG_MODEM_LOG_LEVEL_DBG=y diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.overlay b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.overlay new file mode 100644 index 00000000000..c639ec8b305 --- /dev/null +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.overlay @@ -0,0 +1,18 @@ +#include + +/ { + aliases { + modem = &modem; + }; +}; + +&uart1 { + current-speed = <115200>; + hw-flow-control; + + modem: modem { + compatible = "nordic,nrf91-slm"; + status = "okay"; + mdm-power-gpios = <&interface_to_nrf9160 4 GPIO_ACTIVE_LOW>; + }; +}; From 9cd72adc187f9901b6d6c783dbf6971ea4c42fdc Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Thu, 22 Feb 2024 13:42:14 +0100 Subject: [PATCH 0553/2300] [nrf fromlist] drivers: sensor: adxl367: fix trigger support The adxl367_trigger.c file was missing a DT_COMPAT definition, which resulted in the driver config structs being misaligned between the driver source files. This is fixed here. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69339 Signed-off-by: Maximilian Deubel (cherry picked from commit b7a83778dff35a6c94b20509453d31ef0caaabb7) (cherry picked from commit 2977baaec1238116c8fb8ae76757afc173e1dc07) --- drivers/sensor/adxl367/adxl367_trigger.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/sensor/adxl367/adxl367_trigger.c b/drivers/sensor/adxl367/adxl367_trigger.c index 4e86d466343..534bd07324e 100644 --- a/drivers/sensor/adxl367/adxl367_trigger.c +++ b/drivers/sensor/adxl367/adxl367_trigger.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT adi_adxl367 + #include #include #include From d93196475baa7b27cb626d9e3bdd9fc3af35daf2 Mon Sep 17 00:00:00 2001 From: Jui-Chou Chung Date: Fri, 16 Feb 2024 22:05:31 +0800 Subject: [PATCH 0554/2300] [nrf fromlist] boards: added arduino pins to nrf5340 audio DK network core Added arduino pin definition for nRF5340 audio DK network core, so we can use nrf21540-ek easily with SDC. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69085 Signed-off-by: Jui-Chou Chung (cherry picked from commit 5a29acce05deffa81087b732091638413b5a2271) Signed-off-by: Jui-Chou Chung (cherry picked from commit 86bf8d3d8b6033acba65d17933cf1091a552c1b0) --- ...f5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi | 17 ++++++++ .../nrf5340_audio_dk_nrf5340_cpunet.dts | 40 +++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi index ada32e709ac..6804c040d12 100644 --- a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi @@ -26,4 +26,21 @@ }; }; + spi0_default: spi0_default { + group1 { + psels = , + , + ; + }; + }; + + spi0_sleep: spi0_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + }; diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.dts b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.dts index 16aa4179fa9..22a05cac020 100644 --- a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.dts +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.dts @@ -24,6 +24,46 @@ zephyr,code-partition = &slot0_partition; watchdog0 = &wdt0; }; + + arduino_header: connector { + compatible = "arduino-header-r3"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &gpio0 4 0>, /* A0 */ + <1 0 &gpio0 5 0>, /* A1 */ + <2 0 &gpio0 6 0>, /* A2 */ + <3 0 &gpio0 7 0>, /* A3 */ + <4 0 &gpio0 25 0>, /* A4 */ + <5 0 &gpio0 26 0>, /* A5 */ + <6 0 &gpio1 9 0>, /* D0 */ + <7 0 &gpio1 8 0>, /* D1 */ + <8 0 &gpio0 31 0>, /* D2 */ + <9 0 &gpio1 0 0>, /* D3 */ + <10 0 &gpio1 1 0>, /* D4 */ + <11 0 &gpio1 14 0>, /* D5 */ + <12 0 &gpio1 7 0>, /* D6 */ + <13 0 &gpio1 11 0>, /* D7 */ + <14 0 &gpio1 10 0>, /* D8 */ + <15 0 &gpio1 13 0>, /* D9 */ + <16 0 &gpio1 12 0>, /* D10 */ + <17 0 &gpio0 9 0>, /* D11 */ + <18 0 &gpio0 10 0>, /* D12 */ + <19 0 &gpio0 8 0>, /* D13 */ + <20 0 &gpio1 2 0>, /* D14 */ + <21 0 &gpio1 3 0>; /* D15 */ + }; + +}; + +arduino_spi: &spi0 { + compatible = "nordic,nrf-spim"; + /* Cannot be used together with uart0. */ + /* status = "okay"; */ + cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */ + pinctrl-0 = <&spi0_default>; + pinctrl-1 = <&spi0_sleep>; + pinctrl-names = "default", "sleep"; }; &gpiote { From f2de48f36b21d9b1f0f43239c7a08aca950e5523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Fri, 23 Feb 2024 13:13:10 +0100 Subject: [PATCH 0555/2300] [nrf fromlist] drivers: ieee802154: gracefully handle invalid Ack timestamp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nRF IEEE 802.15.4 driver might report a received Ack frame with invalid timestamp, if the timestamp could not have been taken. The upper layers are not prepared to handle such a case as they expect that for a received frame, the timestamp is always present and valid. This commit detects this situation and handles it gracefully by reporting the transmission as failed as if no Ack was received. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69388 Signed-off-by: Jędrzej Ciupis (cherry picked from commit 17d9e0f7bdfda0a4c88e6ba880d2b0a7314c6cf7) --- drivers/ieee802154/ieee802154_nrf5.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 1831a5b4a6a..80435f06fba 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -387,6 +387,17 @@ static int handle_ack(struct nrf5_802154_data *nrf5_radio) struct net_pkt *ack_pkt; int err = 0; +#if defined(CONFIG_NET_PKT_TIMESTAMP) + if (nrf5_radio->ack_frame.time == NRF_802154_NO_TIMESTAMP) { + /* Ack timestamp is invalid and cannot be used by the upper layer. + * Report the transmission as failed as if the Ack was not received at all. + */ + LOG_WRN("Invalid ACK timestamp."); + err = -ENOMSG; + goto free_nrf_ack; + } +#endif + if (IS_ENABLED(CONFIG_IEEE802154_NRF5_FCS_IN_LENGTH)) { ack_len = nrf5_radio->ack_frame.psdu[0]; } else { @@ -1130,8 +1141,14 @@ void nrf_802154_transmitted_raw(uint8_t *frame, nrf5_data.ack_frame.lqi = metadata->data.transmitted.lqi; #if defined(CONFIG_NET_PKT_TIMESTAMP) - nrf5_data.ack_frame.time = nrf_802154_timestamp_end_to_phr_convert( - metadata->data.transmitted.time, nrf5_data.ack_frame.psdu[0]); + if (metadata->data.transmitted.time == NRF_802154_NO_TIMESTAMP) { + /* Ack timestamp is invalid. Keep this value to detect it when handling Ack + */ + nrf5_data.ack_frame.time = NRF_802154_NO_TIMESTAMP; + } else { + nrf5_data.ack_frame.time = nrf_802154_timestamp_end_to_phr_convert( + metadata->data.transmitted.time, nrf5_data.ack_frame.psdu[0]); + } #endif } From d0b1f82b4d856f2425ea250a683822d8e4ff90dd Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 26 Jan 2024 11:18:09 +0100 Subject: [PATCH 0556/2300] [nrf fromtree] version: export tweak version in version.h The commit export TWEAK version to code through version.h. This aligns the symbols available in code with those available in CMake and Kconfig. The new define is available for both KERNEL, APP, and custom version types (such as MCUBOOT). Signed-off-by: Torsten Rasmussen (cherry picked from commit 738999e191297c737fda647b5ba73e9897a581a8) (cherry picked from commit 51cdc6d42099cb1b76bdb91fff439f15ea2c64e2) --- doc/build/version/index.rst | 2 ++ version.h.in | 1 + 2 files changed, 3 insertions(+) diff --git a/doc/build/version/index.rst b/doc/build/version/index.rst index 8d169a85bf5..ef702c7ac2c 100644 --- a/doc/build/version/index.rst +++ b/doc/build/version/index.rst @@ -91,6 +91,8 @@ following defines are available: +--------------------+-------------------+------------------------------------------------------+-------------------------+ | APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | +--------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ | APP_VERSION_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3-unstable" | | | | ``VERSION_MINOR``, |br| | | | | | ``PATCHLEVEL``, |br| | | diff --git a/version.h.in b/version.h.in index c60fb721804..476d97eabbb 100644 --- a/version.h.in +++ b/version.h.in @@ -14,6 +14,7 @@ #define @VERSION_TYPE@_VERSION_MAJOR @@VERSION_TYPE@_VERSION_MAJOR@ #define @VERSION_TYPE@_VERSION_MINOR @@VERSION_TYPE@_VERSION_MINOR@ #define @VERSION_TYPE@_PATCHLEVEL @@VERSION_TYPE@_PATCHLEVEL@ +#define @VERSION_TYPE@_TWEAK @@VERSION_TYPE@_VERSION_TWEAK@ #define @VERSION_TYPE@_VERSION_STRING "@@VERSION_TYPE@_VERSION_STRING@" #define @BUILD_VERSION_NAME@ @@BUILD_VERSION_NAME@@ From 9627c2c522be40e732066312a4cd2ae20821c856 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 26 Jan 2024 12:19:29 +0100 Subject: [PATCH 0557/2300] [nrf fromtree] version: cmake: kconfig: introduce extra _VERSION__STRING Fixes: #68360 This commit introduces _VERSION_TWEAK_STRING which includes the tweak field in the string, but without the extra version. This format is used by MCUboot / imgtool, and thus makes it easier to align code to the format used by MCUboot. This commit also introduces _VERSION_EXTENDED_STRING which includes the tweak field in the string in addition to the extra version field. The new defines / variables is available in code, CMake, and Kconfig, and it defined for KERNEL, APP, and custom types, such as MCUBOOT. Signed-off-by: Torsten Rasmussen Signed-off-by: Jamie McCrae (cherry picked from commit a306397818d2644e5b2a5222bf5cc3a4a81da0d4) (cherry picked from commit ed9ae51ea224e89ba4ec7beda3881c0d9be83f2b) --- cmake/modules/kconfig.cmake | 2 + cmake/modules/version.cmake | 14 ++- doc/build/version/index.rst | 174 +++++++++++++++++++++--------------- version.h.in | 16 ++-- 4 files changed, 123 insertions(+), 83 deletions(-) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 632e9a72422..2077dc926e7 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -133,6 +133,8 @@ set(COMMON_KCONFIG_ENV_SETTINGS srctree=${ZEPHYR_BASE} KERNELVERSION=${KERNELVERSION} APPVERSION=${APP_VERSION_STRING} + APP_VERSION_EXTENDED_STRING=${APP_VERSION_EXTENDED_STRING} + APP_VERSION_TWEAK_STRING=${APP_VERSION_TWEAK_STRING} CONFIG_=${KCONFIG_NAMESPACE}_ KCONFIG_CONFIG=${DOTCONFIG} # Set environment variables so that Kconfig can prune Kconfig source diff --git a/cmake/modules/version.cmake b/cmake/modules/version.cmake index 49d172871e7..4c80c5fcdc9 100644 --- a/cmake/modules/version.cmake +++ b/cmake/modules/version.cmake @@ -11,8 +11,10 @@ # # Outputs with examples:: # -# PROJECT_VERSION 1.14.99.07 -# KERNEL_VERSION_STRING "1.14.99-extraver" +# PROJECT_VERSION 1.14.99.07 +# KERNEL_VERSION_STRING "1.14.99-extraver" +# KERNEL_VERSION_EXTENDED_STRING "1.14.99-extraver+7" +# KERNEL_VERSION_TWEAK_STRING "1.14.99+7" # # KERNEL_VERSION_MAJOR 1 # KERNEL_VERSION_MINOR 14 @@ -62,9 +64,9 @@ foreach(type file IN ZIP_LISTS VERSION_TYPE VERSION_FILE) string(REGEX MATCH "EXTRAVERSION = ([a-z0-9]*)" _ ${ver}) set(${type}_VERSION_EXTRA ${CMAKE_MATCH_1}) - # Temporary convenience variable + # Temporary convenience variables set(${type}_VERSION_WITHOUT_TWEAK ${${type}_VERSION_MAJOR}.${${type}_VERSION_MINOR}.${${type}_PATCHLEVEL}) - + set(${type}_VERSION_WITH_TWEAK ${${type}_VERSION_MAJOR}.${${type}_VERSION_MINOR}.${${type}_PATCHLEVEL}+${${type}_VERSION_TWEAK}) set(MAJOR ${${type}_VERSION_MAJOR}) # Temporary convenience variable set(MINOR ${${type}_VERSION_MINOR}) # Temporary convenience variable @@ -82,6 +84,8 @@ foreach(type file IN ZIP_LISTS VERSION_TYPE VERSION_FILE) else() set(${type}_VERSION_STRING "${${type}_VERSION_WITHOUT_TWEAK}") endif() + set(${type}_VERSION_TWEAK_STRING "${${type}_VERSION_WITH_TWEAK}") + set(${type}_VERSION_EXTENDED_STRING "${${type}_VERSION_STRING}+${${type}_VERSION_TWEAK}") if(type STREQUAL KERNEL) set(PROJECT_VERSION_MAJOR ${${type}_VERSION_MAJOR}) @@ -118,5 +122,7 @@ foreach(type file IN ZIP_LISTS VERSION_TYPE VERSION_FILE) unset(MAJOR) unset(MINOR) unset(PATCH) + unset(TWEAK) unset(${type}_VERSION_WITHOUT_TWEAK) + unset(${type}_VERSION_WITH_TWEAK) endforeach() diff --git a/doc/build/version/index.rst b/doc/build/version/index.rst index ef702c7ac2c..2106a65e169 100644 --- a/doc/build/version/index.rst +++ b/doc/build/version/index.rst @@ -73,87 +73,120 @@ To use the version information in application code, the version file must be inc fields can be freely used. The include file name is :file:`app_version.h` (no path is needed), the following defines are available: -+--------------------+-------------------+------------------------------------------------------+-------------------------+ -| Define | Type | Field(s) | Example | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ -| APPVERSION | Numerical | ``VERSION_MAJOR`` (left shifted by 24 bits), |br| | 0x1020304 | -| | | ``VERSION_MINOR`` (left shifted by 16 bits), |br| | | -| | | ``PATCHLEVEL`` (left shifted by 8 bits), |br| | | -| | | ``VERSION_TWEAK`` | | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_NUMBER | Numerical | ``VERSION_MAJOR`` (left shifted by 16 bits), |br| | 0x10203 | -| | | ``VERSION_MINOR`` (left shifted by 8 bits), |br| | | -| | | ``PATCHLEVEL`` | | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_MAJOR | Numerical | ``VERSION_MAJOR`` | 1 | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_MINOR | Numerical | ``VERSION_MINOR`` | 2 | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3-unstable" | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``EXTRAVERSION`` |br| | | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_BUILD_VERSION | String (unquoted) | None (value of ``git describe --abbrev=12 --always`` | v3.3.0-18-g2c85d9224fca | -| | | from application repository) | | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| Define | Type | Field(s) | Example | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APPVERSION | Numerical | ``VERSION_MAJOR`` (left shifted by 24 bits), |br| | 0x1020304 | +| | | ``VERSION_MINOR`` (left shifted by 16 bits), |br| | | +| | | ``PATCHLEVEL`` (left shifted by 8 bits), |br| | | +| | | ``VERSION_TWEAK`` | | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_NUMBER | Numerical | ``VERSION_MAJOR`` (left shifted by 16 bits), |br| | 0x10203 | +| | | ``VERSION_MINOR`` (left shifted by 8 bits), |br| | | +| | | ``PATCHLEVEL`` | | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_MAJOR | Numerical | ``VERSION_MAJOR`` | 1 | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_MINOR | Numerical | ``VERSION_MINOR`` | 2 | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3-unstable" | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``EXTRAVERSION`` |br| | | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_EXTENDED_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3-unstable+4" | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``EXTRAVERSION`` |br| | | +| | | ``VERSION_TWEAK`` |br| | | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_TWEAK_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3+4" | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``VERSION_TWEAK`` |br| | | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_BUILD_VERSION | String (unquoted) | None (value of ``git describe --abbrev=12 --always`` | v3.3.0-18-g2c85d9224fca | +| | | from application repository) | | ++-----------------------------+-------------------+------------------------------------------------------+-------------------------+ Use in Kconfig ============== The following variables are available for usage in Kconfig files: -+------------------+-----------+-------------------------+----------------+ -| Variable | Type | Field(s) | Example | -+------------------+-----------+-------------------------+----------------+ -| $(VERSION_MAJOR) | Numerical | ``VERSION_MAJOR`` | 1 | -+------------------+-----------+-------------------------+----------------+ -| $(VERSION_MINOR) | Numerical | ``VERSION_MINOR`` | 2 | -+------------------+-----------+-------------------------+----------------+ -| $(PATCHLEVEL) | Numerical | ``PATCHLEVEL`` | 3 | -+------------------+-----------+-------------------------+----------------+ -| $(VERSION_TWEAK) | Numerical | ``VERSION_TWEAK`` | 4 | -+------------------+-----------+-------------------------+----------------+ -| $(APPVERSION) | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``EXTRAVERSION`` | | -+------------------+-----------+-------------------------+----------------+ ++--------------------------------+-----------+--------------------------+------------------+ +| Variable | Type | Field(s) | Example | ++--------------------------------+-----------+--------------------------+------------------+ +| $(VERSION_MAJOR) | Numerical | ``VERSION_MAJOR`` | 1 | ++--------------------------------+-----------+--------------------------+------------------+ +| $(VERSION_MINOR) | Numerical | ``VERSION_MINOR`` | 2 | ++--------------------------------+-----------+--------------------------+------------------+ +| $(PATCHLEVEL) | Numerical | ``PATCHLEVEL`` | 3 | ++--------------------------------+-----------+--------------------------+------------------+ +| $(VERSION_TWEAK) | Numerical | ``VERSION_TWEAK`` | 4 | ++--------------------------------+-----------+--------------------------+------------------+ +| $(APPVERSION) | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``EXTRAVERSION`` | | ++--------------------------------+-----------+--------------------------+------------------+ +| $(APP_VERSION_EXTENDED_STRING) | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable+4 | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``EXTRAVERSION``, |br| | | +| | | ``VERSION_TWEAK`` | | ++--------------------------------+-----------+--------------------------+------------------+ +| $(APP_VERSION_TWEAK_STRING) | String | ``VERSION_MAJOR``, |br| | 1.2.3+4 | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``VERSION_TWEAK`` | | ++--------------------------------+-----------+--------------------------+------------------+ Use in CMake ============ The following variable are available for usage in CMake files: -+--------------------+-----------------+---------------------------------------------------+----------------+ -| Variable | Type | Field(s) | Example | -+--------------------+-----------------+---------------------------------------------------+----------------+ -| APPVERSION | Numerical (hex) | ``VERSION_MAJOR`` (left shifted by 24 bits), |br| | 0x1020304 | -| | | ``VERSION_MINOR`` (left shifted by 16 bits), |br| | | -| | | ``PATCHLEVEL`` (left shifted by 8 bits), |br| | | -| | | ``VERSION_TWEAK`` | | -+--------------------+-----------------+---------------------------------------------------+----------------+ -| APP_VERSION_NUMBER | Numerical (hex) | ``VERSION_MAJOR`` (left shifted by 16 bits), |br| | 0x10203 | -| | | ``VERSION_MINOR`` (left shifted by 8 bits), |br| | | -| | | ``PATCHLEVEL`` | | -+--------------------+-----------------+---------------------------------------------------+----------------+ -| APP_VERSION_MAJOR | Numerical | ``VERSION_MAJOR`` | 1 | -+--------------------+-----------------+---------------------------------------------------+----------------+ -| APP_VERSION_MINOR | Numerical | ``VERSION_MINOR`` | 2 | -+--------------------+-----------------+---------------------------------------------------+----------------+ -| APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | -+--------------------+-----------------+---------------------------------------------------+----------------+ -| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | -+--------------------+-----------------+---------------------------------------------------+----------------+ -| APP_VERSION_STRING | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``EXTRAVERSION`` | | -+--------------------+-----------------+---------------------------------------------------+----------------+ ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| Variable | Type | Field(s) | Example | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| APPVERSION | Numerical (hex) | ``VERSION_MAJOR`` (left shifted by 24 bits), |br| | 0x1020304 | +| | | ``VERSION_MINOR`` (left shifted by 16 bits), |br| | | +| | | ``PATCHLEVEL`` (left shifted by 8 bits), |br| | | +| | | ``VERSION_TWEAK`` | | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| APP_VERSION_NUMBER | Numerical (hex) | ``VERSION_MAJOR`` (left shifted by 16 bits), |br| | 0x10203 | +| | | ``VERSION_MINOR`` (left shifted by 8 bits), |br| | | +| | | ``PATCHLEVEL`` | | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| APP_VERSION_MAJOR | Numerical | ``VERSION_MAJOR`` | 1 | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| APP_VERSION_MINOR | Numerical | ``VERSION_MINOR`` | 2 | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| APP_VERSION_STRING | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``EXTRAVERSION`` | | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| APP_VERSION_EXTENDED_STRING | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable+4 | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``EXTRAVERSION``, |br| | | +| | | ``VERSION_TWEAK`` | | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ +| APP_VERSION_TWEAK_STRING | String | ``VERSION_MAJOR``, |br| | 1.2.3+4 | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``VERSION_TWEAK`` | | ++-----------------------------+-----------------+---------------------------------------------------+------------------+ Use in MCUboot-supported applications ===================================== @@ -161,6 +194,3 @@ Use in MCUboot-supported applications No additional configuration needs to be done to the target application so long as it is configured to support MCUboot and a signed image is generated, the version information will be automatically included in the image data. - -The format used for signing is ``VERSION_MAJOR`` . ``VERSION_MINOR`` . ``PATCHLEVEL``, the tweak -version field is not currently used. diff --git a/version.h.in b/version.h.in index 476d97eabbb..bfb2eb3edb7 100644 --- a/version.h.in +++ b/version.h.in @@ -9,13 +9,15 @@ #cmakedefine ZEPHYR_VERSION_CODE @ZEPHYR_VERSION_CODE@ #cmakedefine ZEPHYR_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#define @VERSION_TYPE@VERSION @@VERSION_TYPE@VERSION@ -#define @VERSION_TYPE@_VERSION_NUMBER @@VERSION_TYPE@_VERSION_NUMBER@ -#define @VERSION_TYPE@_VERSION_MAJOR @@VERSION_TYPE@_VERSION_MAJOR@ -#define @VERSION_TYPE@_VERSION_MINOR @@VERSION_TYPE@_VERSION_MINOR@ -#define @VERSION_TYPE@_PATCHLEVEL @@VERSION_TYPE@_PATCHLEVEL@ -#define @VERSION_TYPE@_TWEAK @@VERSION_TYPE@_VERSION_TWEAK@ -#define @VERSION_TYPE@_VERSION_STRING "@@VERSION_TYPE@_VERSION_STRING@" +#define @VERSION_TYPE@VERSION @@VERSION_TYPE@VERSION@ +#define @VERSION_TYPE@_VERSION_NUMBER @@VERSION_TYPE@_VERSION_NUMBER@ +#define @VERSION_TYPE@_VERSION_MAJOR @@VERSION_TYPE@_VERSION_MAJOR@ +#define @VERSION_TYPE@_VERSION_MINOR @@VERSION_TYPE@_VERSION_MINOR@ +#define @VERSION_TYPE@_PATCHLEVEL @@VERSION_TYPE@_PATCHLEVEL@ +#define @VERSION_TYPE@_TWEAK @@VERSION_TYPE@_VERSION_TWEAK@ +#define @VERSION_TYPE@_VERSION_STRING "@@VERSION_TYPE@_VERSION_STRING@" +#define @VERSION_TYPE@_VERSION_EXTENDED_STRING "@@VERSION_TYPE@_VERSION_EXTENDED_STRING@" +#define @VERSION_TYPE@_VERSION_TWEAK_STRING "@@VERSION_TYPE@_VERSION_TWEAK_STRING@" #define @BUILD_VERSION_NAME@ @@BUILD_VERSION_NAME@@ @@VERSION_TYPE@_VERSION_CUSTOMIZATION@ From 40bb150723ecf33df58615ae99a34c149afb784f Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 1 Feb 2024 08:24:59 +0000 Subject: [PATCH 0558/2300] [nrf fromtree] mcuboot: Use tweak version string Replaces the default with a shorter variable of equal value Signed-off-by: Jamie McCrae (cherry picked from commit 835d78ec59e185705238acc46cfaaefaa1ea7024) (cherry picked from commit f3f276dd2ecad981a2abf1d87c3d3d0b2e9d5373) --- modules/Kconfig.mcuboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index 8df4bde8829..4849b456f22 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -103,7 +103,7 @@ config MCUBOOT_ENCRYPTION_KEY_FILE config MCUBOOT_IMGTOOL_SIGN_VERSION string "Version to pass to imgtool when signing" - default "$(VERSION_MAJOR).$(VERSION_MINOR).$(PATCHLEVEL)+$(VERSION_TWEAK)" if "$(VERSION_MAJOR)" != "" + default "$(APP_VERSION_TWEAK_STRING)" if "$(VERSION_MAJOR)" != "" default "0.0.0+0" help When signing with imgtool then this setting will be passed as version From 5dd0a61b52fc95e575484ff85015f12b96e1a436 Mon Sep 17 00:00:00 2001 From: Kyra Lengfeld Date: Thu, 20 Jul 2023 10:29:53 +0200 Subject: [PATCH 0559/2300] [nrf fromtree] Bluetooth: Controller: Add nRF54x Tx Power Kconfig This commit adds tx power config options for nRF54Hx and nrf54Lx SoCs, as well as the new radio defines. Signed-off-by: Kyra Lengfeld (cherry picked from commit 83926830cf89fc57f53e1fe3d1b7bb53beaa557e) Signed-off-by: Kyra Lengfeld (cherry picked from commit e88d540cfc964c156a56cf2d074a415f0376a22d) --- subsys/bluetooth/controller/Kconfig | 72 ++++++++++++++----- .../nordic/hal/nrf5/radio/radio_nrf5_txp.h | 18 ++++- 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index d982f3c8d26..b8e0d78c2ce 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -255,92 +255,126 @@ choice BT_CTLR_TX_PWR The value set here represents the actual default power level fed to the antenna. +config BT_CTLR_TX_PWR_PLUS_10 + bool "+10 dBm" + depends on SOC_SERIES_NRF54HX + +config BT_CTLR_TX_PWR_PLUS_9 + bool "+9 dBm" + depends on SOC_SERIES_NRF54HX + config BT_CTLR_TX_PWR_PLUS_8 bool "+8 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_PLUS_7 bool "+7 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_PLUS_6 bool "+6 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_PLUS_5 bool "+5 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_PLUS_4 bool "+4 dBm" - depends on SOC_SERIES_NRF51X || SOC_COMPATIBLE_NRF52X + depends on SOC_SERIES_NRF51X || SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_PLUS_3 bool "+3 dBm" - depends on SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF53X + depends on SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_PLUS_2 bool "+2 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF53X + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_PLUS_1 bool "+1 dBm" - depends on SOC_SERIES_NRF53X + depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_0 bool "0 dBm" config BT_CTLR_TX_PWR_MINUS_1 bool "-1 dBm" - depends on SOC_SERIES_NRF53X + depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_MINUS_2 bool "-2 dBm" - depends on SOC_SERIES_NRF53X + depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_MINUS_3 bool "-3 dBm" - depends on SOC_SERIES_NRF53X + depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_MINUS_4 bool "-4 dBm" config BT_CTLR_TX_PWR_MINUS_5 bool "-5 dBm" - depends on SOC_SERIES_NRF53X + depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_MINUS_6 bool "-6 dBm" - depends on SOC_SERIES_NRF53X + depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_MINUS_7 bool "-7 dBm" - depends on SOC_SERIES_NRF53X + depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54LX config BT_CTLR_TX_PWR_MINUS_8 bool "-8 dBm" +config BT_CTLR_TX_PWR_MINUS_9 + bool "-9 dBm" + depends on SOC_SERIES_NRF54LX + +config BT_CTLR_TX_PWR_MINUS_10 + bool "-10 dBm" + depends on SOC_SERIES_NRF54LX + config BT_CTLR_TX_PWR_MINUS_12 bool "-12 dBm" +config BT_CTLR_TX_PWR_MINUS_14 + bool "-14 dBm" + depends on SOC_SERIES_NRF54LX + config BT_CTLR_TX_PWR_MINUS_16 bool "-16 dBm" config BT_CTLR_TX_PWR_MINUS_20 bool "-20 dBm" +config BT_CTLR_TX_PWR_MINUS_26 + bool "-26 dBm" + depends on SOC_SERIES_NRF54LX + config BT_CTLR_TX_PWR_MINUS_30 bool "-30 dBm" - depends on SOC_SERIES_NRF51X + depends on SOC_SERIES_NRF51X || SOC_SERIES_NRF54HX config BT_CTLR_TX_PWR_MINUS_40 bool "-40 dBm" - depends on SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF53X + depends on SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + +config BT_CTLR_TX_PWR_MINUS_46 + bool "-46 dBm" + depends on SOC_SERIES_NRF54LX + +config BT_CTLR_TX_PWR_MINUS_70 + bool "-70 dBm" + depends on SOC_SERIES_NRF54HX endchoice config BT_CTLR_TX_PWR_DBM int + default 10 if BT_CTLR_TX_PWR_PLUS_10 + default 9 if BT_CTLR_TX_PWR_PLUS_9 default 8 if BT_CTLR_TX_PWR_PLUS_8 default 7 if BT_CTLR_TX_PWR_PLUS_7 default 6 if BT_CTLR_TX_PWR_PLUS_6 @@ -358,11 +392,17 @@ config BT_CTLR_TX_PWR_DBM default -6 if BT_CTLR_TX_PWR_MINUS_6 default -7 if BT_CTLR_TX_PWR_MINUS_7 default -8 if BT_CTLR_TX_PWR_MINUS_8 + default -9 if BT_CTLR_TX_PWR_MINUS_9 + default -10 if BT_CTLR_TX_PWR_MINUS_10 default -12 if BT_CTLR_TX_PWR_MINUS_12 + default -14 if BT_CTLR_TX_PWR_MINUS_14 default -16 if BT_CTLR_TX_PWR_MINUS_16 default -20 if BT_CTLR_TX_PWR_MINUS_20 + default -26 if BT_CTLR_TX_PWR_MINUS_26 default -30 if BT_CTLR_TX_PWR_MINUS_30 default -40 if BT_CTLR_TX_PWR_MINUS_40 + default -46 if BT_CTLR_TX_PWR_MINUS_46 + default -70 if BT_CTLR_TX_PWR_MINUS_70 config BT_CTLR_TX_PWR_ANTENNA int "Set TX power (dBm)" diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_txp.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_txp.h index 2eb772f20cc..c3bb09fd1b3 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_txp.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_txp.h @@ -4,7 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -#if defined(CONFIG_BT_CTLR_TX_PWR_PLUS_8) +#if defined(CONFIG_BT_CTLR_TX_PWR_PLUS_10) +#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos10dBm +#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_9) +#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos9dBm +#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_8) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos8dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_7) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos7dBm @@ -38,14 +42,26 @@ #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg7dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_8) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg8dBm +#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_9) +#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg9dBm +#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_10) +#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg10dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_12) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg12dBm +#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_14) +#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg14dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_16) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg16dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_20) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg20dBm +#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_26) +#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg26dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_30) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg30dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_40) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg40dBm +#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_46) +#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg46dBm +#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_70) +#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg70dBm #endif From da9587f700ed05af1c6be0adaae6b8e0be6c0f10 Mon Sep 17 00:00:00 2001 From: Bernt Johan Damslora Date: Thu, 22 Feb 2024 13:04:37 +0100 Subject: [PATCH 0560/2300] [nrf fromtree] drivers: mfd: npm6001: set SWREADY Sets SWREADY in MFD initialization, so that hysteresis mode can be used. Signed-off-by: Bernt Johan Damslora (cherry picked from commit 73d56dea6603bf54d2c989da0b57b1de4d907946) (cherry picked from commit c5acff5307b657be641a67fe7c3a6a0a35fdf457) --- drivers/mfd/mfd_npm6001.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mfd/mfd_npm6001.c b/drivers/mfd/mfd_npm6001.c index 1a077791816..b03b10b4cba 100644 --- a/drivers/mfd/mfd_npm6001.c +++ b/drivers/mfd/mfd_npm6001.c @@ -11,6 +11,7 @@ #include /* nPM6001 registers */ +#define NPM6001_SWREADY 0x01U #define NPM6001_BUCK3SELDAC 0x44U #define NPM6001_BUCKMODEPADCONF 0x4EU #define NPM6001_PADDRIVESTRENGTH 0x53U @@ -60,6 +61,12 @@ static int mfd_npm6001_init(const struct device *dev) return ret; } + /* Enable switching to hysteresis mode */ + ret = i2c_reg_write_byte_dt(&config->i2c, NPM6001_SWREADY, 1U); + if (ret < 0) { + return ret; + } + return 0; } From 9188dc281d339b082eb3948e8a7f023e8e44949b Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Wed, 10 Jan 2024 12:23:11 +0100 Subject: [PATCH 0561/2300] [nrf fromtree] arch: isr_tables: Add __used attribute to int_list_header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds missing __used attribute it int_list_header, preventing it from being optimized out. Signed-off-by: Radosław Koppel (cherry picked from commit 717c5835d6df56f58e114fb9e4548d963332a87d) (cherry picked from commit 0644eb74774ea26ec7e96a2ef73003af9b3900a2) --- arch/common/isr_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/common/isr_tables.c b/arch/common/isr_tables.c index 0311f81f252..9677c92683d 100644 --- a/arch/common/isr_tables.c +++ b/arch/common/isr_tables.c @@ -21,7 +21,7 @@ struct int_list_header { * header of the initList section, which is used by gen_isr_tables.py to create * the vector and sw isr tables, */ -Z_GENERIC_SECTION(.irq_info) struct int_list_header _iheader = { +Z_GENERIC_SECTION(.irq_info) __used struct int_list_header _iheader = { .table_size = IRQ_TABLE_SIZE, .offset = CONFIG_GEN_IRQ_START_VECTOR, }; From d483add5e73420f429a55e33ba79c5cdda6517bc Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 6 Dec 2023 13:14:18 +0800 Subject: [PATCH 0562/2300] [nrf fromtree] scripts: build: gen_isr_tables: fix calculation of THIRD_LVL_INTERRUPTS The calculation of `THIRD_LVL_INTERRUPTS` bitmask in the `update_masks()` function is wrong, the number of bits to shift should be the sum of the first two levels. Signed-off-by: Yong Cong Sin (cherry picked from commit 56570cc8c164b524f3eded011c153fe49441974b) (cherry picked from commit d7af1ded08730084eebb22e48e8ba35ca4ba7b71) --- scripts/build/gen_isr_tables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index cd329f85551..314b56604ec 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -287,7 +287,7 @@ def update_masks(): FIRST_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[0]) SECND_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] - THIRD_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[2] + THIRD_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] def main(): parse_args() From 88399d57216261cedb33c776303544a67f806150 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 6 Dec 2023 13:17:55 +0800 Subject: [PATCH 0563/2300] [nrf fromtree] scripts: build: gen_isr_tables: change naming of bitmask variables Rename the bitmask variables from `*_LVL_INTERRUPTS` to `INTERRUPT_LVL_BITMASK[]` array to be consistent with `INTERRUPT_BITS`, making it easier to loop over the bitmasks. Signed-off-by: Yong Cong Sin (cherry picked from commit b4db285c1fde9dcd287c1f0b084b7c6eaa691bfe) (cherry picked from commit 0328516feda62f61af7cde750738563f601b7a18) --- scripts/build/gen_isr_tables.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 314b56604ec..ea14b0ebf52 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -23,9 +23,7 @@ # into 1 line which then goes into the 1st level) # 0x00FF0000 - represents the 3rd level (i.e. the interrupts funnel # into 1 line which then goes into the 2nd level) -FIRST_LVL_INTERRUPTS = 0x000000FF -SECND_LVL_INTERRUPTS = 0x0000FF00 -THIRD_LVL_INTERRUPTS = 0x00FF0000 +INTERRUPT_LVL_BITMASK = [0x000000FF, 0x0000FF00, 0x00FF0000] INTERRUPT_BITS = [8, 8, 8] @@ -278,16 +276,12 @@ def bit_mask(bits): return mask def update_masks(): - global FIRST_LVL_INTERRUPTS - global SECND_LVL_INTERRUPTS - global THIRD_LVL_INTERRUPTS - if sum(INTERRUPT_BITS) > 32: raise ValueError("Too many interrupt bits") - FIRST_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[0]) - SECND_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] - THIRD_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + INTERRUPT_LVL_BITMASK[0] = bit_mask(INTERRUPT_BITS[0]) + INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] + INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] def main(): parse_args() @@ -377,9 +371,9 @@ def main(): else: # Figure out third level interrupt position debug('IRQ = ' + hex(irq)) - irq3 = (irq & THIRD_LVL_INTERRUPTS) >> INTERRUPT_BITS[0] + INTERRUPT_BITS[1] - irq2 = (irq & SECND_LVL_INTERRUPTS) >> INTERRUPT_BITS[0] - irq1 = irq & FIRST_LVL_INTERRUPTS + irq3 = (irq & INTERRUPT_LVL_BITMASK[2]) >> INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + irq2 = (irq & INTERRUPT_LVL_BITMASK[1]) >> INTERRUPT_BITS[0] + irq1 = irq & INTERRUPT_LVL_BITMASK[0] if irq3: irq_parent = irq2 From 248e21e30665506b362698afd2eee7645c59489e Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 6 Dec 2023 13:21:33 +0800 Subject: [PATCH 0564/2300] [nrf fromtree] scripts: build: gen_isr_tables: add some debug prints Add some debug prints for the interrupts bits and bitmasks in each level. Signed-off-by: Yong Cong Sin (cherry picked from commit 0884a33ee3da3c20e6416039e0ec71927020f06a) (cherry picked from commit 2bb8cbddc56696fa0d0b68c9caccbe8021fd80c0) --- scripts/build/gen_isr_tables.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index ea14b0ebf52..13c9d79b0b3 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -283,6 +283,12 @@ def update_masks(): INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + debug("Level Bits Bitmask") + debug("----------------------------") + for i in range(3): + bitmask_str = "0x" + format(INTERRUPT_LVL_BITMASK[i], '08X') + debug(f"{i + 1:>5} {INTERRUPT_BITS[i]:>7} {bitmask_str:>14}") + def main(): parse_args() From 7a2e82c778c059f10ae7044ef02170dcc9cd64d0 Mon Sep 17 00:00:00 2001 From: Greter Raffael Date: Tue, 14 Nov 2023 15:54:27 +0000 Subject: [PATCH 0565/2300] [nrf fromtree] gen_isr_tables: Add meaningful error message When using direct isrs, a vector table is needed. However, if none is present , i.e. `CONFIG_GEN_IRQ_VECTOR_TABLE=n`, this script failed. The given error message was not helpful (`'NoneType' has no len()`). This change makes it clearer, where to look for the problem. Signed-off-by: Greter Raffael (cherry picked from commit 7bcd0699e6c42217567d5297271fe3ca1b13aba7) (cherry picked from commit 1864665cd403eebc29a5f1efaf67f6ac54d2ed94) --- scripts/build/gen_isr_tables.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 13c9d79b0b3..08ab9cc148c 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -358,6 +358,10 @@ def main(): for irq, flags, func, param in intlist["interrupts"]: if flags & ISR_FLAG_DIRECT: + if not vt: + error("Direct Interrupt %d declared with parameter 0x%x " + "but no vector table in use" + % (irq, param)) if param != 0: error("Direct irq %d declared, but has non-NULL parameter" % irq) From 47a43022ce367989556267254a05e5703ce37486 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Thu, 4 Jan 2024 00:56:37 +0800 Subject: [PATCH 0566/2300] [nrf fromtree] gen_isr_tables: print index number at the end of each entry as comment Make it easier to debug by printing the index number at the end, this is especially helpful when there's a lot of interrupts. Before: ```c /* build/zephyr/isr_tables.c */ {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, ``` After: ```c /* build/zephyr/isr_tables.c */ {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 0 */ {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 1 */ {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 2 */ {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 3 */ {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 4 */ {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 5 */ {(const void *)0x0, (ISR)((uintptr_t)&z_irq_spurious)}, /* 6 */ ``` Signed-off-by: Yong Cong Sin (cherry picked from commit 89fb8f8b9887aeb47f4503fd7a09e168928f9ee2) (cherry picked from commit 46070a4423b549a36a90e26453322760c754474e) --- scripts/build/gen_isr_tables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 08ab9cc148c..e257074e55b 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -250,7 +250,7 @@ def write_source_file(fp, vt, swt, intlist, syms, shared): fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". format(level3_offset)) - fp.write("\t{{(const void *){0}, (ISR){1}}},\n".format(param, func_as_string)) + fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) fp.write("};\n") def get_symbols(obj): From d069b2c6aceb2e0c4a4a67df70185c04654c3c39 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Mon, 30 Oct 2023 16:23:58 +0100 Subject: [PATCH 0567/2300] [nrf fromtree] scripts: gen_isr_tables: Code cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit cleans up the gen_isr_tables code for better clarity and easier modification. Changes include: - Separate functions to load intList section. - Replace spurious handlers in internal data with None. Now it is the output generator work to choose right function. - All the work to generate vt and swt separated into its own functions. - Remove the need for internal shared array - all the information is here in swt array. - The update_masks function - more functionality moved here. - Simplify bit_mask function. Signed-off-by: Radosław Koppel (cherry picked from commit 4360acb27ea2c28c7db555a6be02c0da74d8b6fd) (cherry picked from commit c6400ed6e895a0a7e821121493cb35825fb0f13f) --- scripts/build/gen_isr_tables.py | 364 ++++++++++++++++++-------------- 1 file changed, 207 insertions(+), 157 deletions(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index e257074e55b..41fc20957a6 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -2,6 +2,7 @@ # # Copyright (c) 2017 Intel Corporation # Copyright (c) 2018 Foundries.io +# Copyright (c) 2023 Nordic Semiconductor NA # # SPDX-License-Identifier: Apache-2.0 # @@ -27,6 +28,13 @@ INTERRUPT_BITS = [8, 8, 8] +swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" +swt_shared_handler = "((uintptr_t)&z_shared_isr)" +vt_spurious_handler = "z_irq_spurious" +vt_irq_handler = "_isr_wrapper" +vt_default_handler = None + + def debug(text): if args.debug: sys.stdout.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") @@ -40,7 +48,7 @@ def endian_prefix(): else: return "<" -def read_intlist(elfobj, syms, snames): +def read_intlist(intlist_data, syms): """read a binary file containing the contents of the kernel's .intList section. This is an instance of a header created by include/zephyr/linker/intlist.ld: @@ -64,37 +72,25 @@ def read_intlist(elfobj, syms, snames): const void *param; }; """ - intList_sect = None intlist = {} - prefix = endian_prefix() + # Extract header and the rest of the data intlist_header_fmt = prefix + "II" + header_sz = struct.calcsize(intlist_header_fmt) + header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) + debug(str(header_raw)) + + intlist["num_vectors"] = header_raw[0] + intlist["offset"] = header_raw[1] + intdata = intlist_data[header_sz:] + + # Extract information about interrupts if "CONFIG_64BIT" in syms: intlist_entry_fmt = prefix + "iiQQ" else: intlist_entry_fmt = prefix + "iiII" - for sname in snames: - intList_sect = elfobj.get_section_by_name(sname) - if intList_sect is not None: - debug("Found intlist section: \"{}\"".format(sname)) - break - - if intList_sect is None: - error("Cannot find the intlist section!") - - intdata = intList_sect.data() - - header_sz = struct.calcsize(intlist_header_fmt) - header = struct.unpack_from(intlist_header_fmt, intdata, 0) - intdata = intdata[header_sz:] - - debug(str(header)) - - intlist["num_vectors"] = header[0] - intlist["offset"] = header[1] - intlist["interrupts"] = [i for i in struct.iter_unpack(intlist_entry_fmt, intdata)] @@ -108,32 +104,6 @@ def read_intlist(elfobj, syms, snames): return intlist - -def parse_args(): - global args - - parser = argparse.ArgumentParser(description=__doc__, - formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False) - - parser.add_argument("-e", "--big-endian", action="store_true", - help="Target encodes data in big-endian format (little endian is " - "the default)") - parser.add_argument("-d", "--debug", action="store_true", - help="Print additional debugging information") - parser.add_argument("-o", "--output-source", required=True, - help="Output source file") - parser.add_argument("-k", "--kernel", required=True, - help="Zephyr kernel image") - parser.add_argument("-s", "--sw-isr-table", action="store_true", - help="Generate SW ISR table") - parser.add_argument("-V", "--vector-table", action="store_true", - help="Generate vector table") - parser.add_argument("-i", "--intlist-section", action="append", required=True, - help="The name of the section to search for the interrupt data. " - "This is accumulative argument. The first section found would be used.") - - args = parser.parse_args() - source_assembly_header = """ #ifndef ARCH_IRQ_VECTOR_JUMP_CODE #error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" @@ -153,6 +123,9 @@ def write_code_irq_vector_table(fp, vt, nv, syms): for i in range(nv): func = vt[i] + if func is None: + func = vt_default_handler + if isinstance(func, int): func_as_string = get_symbol_from_addr(syms, func) else: @@ -166,10 +139,13 @@ def write_address_irq_vector_table(fp, vt, nv): for i in range(nv): func = vt[i] + if func is None: + func = vt_default_handler + if isinstance(func, int): - fp.write("\t{},\n".format(vt[i])) + fp.write("\t{},\n".format(func)) else: - fp.write("\t((uintptr_t)&{}),\n".format(vt[i])) + fp.write("\t((uintptr_t)&{}),\n".format(func)) fp.write("};\n") @@ -184,15 +160,19 @@ def write_address_irq_vector_table(fp, vt, nv): typedef void (* ISR)(const void *); """ -def write_shared_table(fp, shared, nv): +def write_shared_table(fp, swt, nv): fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" " z_shared_sw_isr_table[%d] = {\n" % nv) for i in range(nv): - client_num = shared[i][1] - client_list = shared[i][0] + if swt[i] is None: + client_num = 0 + client_list = None + else: + client_num = len(swt[i]) + client_list = swt[i] - if not client_num: + if client_num <= 1: fp.write("\t{ },\n") else: fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") @@ -207,13 +187,13 @@ def write_shared_table(fp, shared, nv): fp.write("};\n") -def write_source_file(fp, vt, swt, intlist, syms, shared): +def write_source_file(fp, vt, swt, intlist, syms): fp.write(source_header) nv = intlist["num_vectors"] if "CONFIG_SHARED_INTERRUPTS" in syms: - write_shared_table(fp, shared, nv) + write_shared_table(fp, swt, nv) if vt: if "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS" in syms: @@ -233,11 +213,19 @@ def write_source_file(fp, vt, swt, intlist, syms, shared): level3_offset = syms.get("CONFIG_3RD_LVL_ISR_TBL_OFFSET") for i in range(nv): - param = "{0:#x}".format(swt[i][0]) - func = swt[i][1] - - if isinstance (func, str) and "z_shared_isr" in func: + if len(swt[i]) == 0: + # Not used interrupt + param = "0x0" + func = swt_spurious_handler + elif len(swt[i]) == 1: + # Single interrupt + param = "{0:#x}".format(swt[i][0][0]) + func = swt[i][0][1] + else: + # Shared interrupt param = "&z_shared_sw_isr_table[{0}]".format(i) + func = swt_shared_handler + if isinstance(func, int): func_as_string = "{0:#x}".format(func) else: @@ -253,14 +241,6 @@ def write_source_file(fp, vt, swt, intlist, syms, shared): fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) fp.write("};\n") -def get_symbols(obj): - for section in obj.iter_sections(): - if isinstance(section, SymbolTableSection): - return {sym.name: sym.entry.st_value - for sym in section.iter_symbols()} - - error("Could not find symbol table") - def getindex(irq, irq_aggregator_pos): try: return irq_aggregator_pos.index(irq) @@ -270,32 +250,9 @@ def getindex(irq, irq_aggregator_pos): " Recheck interrupt configuration.") def bit_mask(bits): - mask = 0 - for _ in range(0, bits): - mask = (mask << 1) | 1 - return mask - -def update_masks(): - if sum(INTERRUPT_BITS) > 32: - raise ValueError("Too many interrupt bits") - - INTERRUPT_LVL_BITMASK[0] = bit_mask(INTERRUPT_BITS[0]) - INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] - INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + return (1 << bits) - 1 - debug("Level Bits Bitmask") - debug("----------------------------") - for i in range(3): - bitmask_str = "0x" + format(INTERRUPT_LVL_BITMASK[i], '08X') - debug(f"{i + 1:>5} {INTERRUPT_BITS[i]:>7} {bitmask_str:>14}") - -def main(): - parse_args() - - with open(args.kernel, "rb") as fp: - kernel = ELFFile(fp) - syms = get_symbols(kernel) - intlist = read_intlist(kernel, syms, args.intlist_section) +def update_masks(syms): if "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: max_irq_per = syms["CONFIG_MAX_IRQ_PER_AGGREGATOR"] @@ -303,59 +260,98 @@ def main(): INTERRUPT_BITS[0] = syms["CONFIG_1ST_LEVEL_INTERRUPT_BITS"] INTERRUPT_BITS[1] = syms["CONFIG_2ND_LEVEL_INTERRUPT_BITS"] INTERRUPT_BITS[2] = syms["CONFIG_3RD_LEVEL_INTERRUPT_BITS"] - update_masks() - if "CONFIG_2ND_LEVEL_INTERRUPTS" in syms: - num_aggregators = syms["CONFIG_NUM_2ND_LEVEL_AGGREGATORS"] - irq2_baseoffset = syms["CONFIG_2ND_LVL_ISR_TBL_OFFSET"] - list_2nd_lvl_offsets = [syms['CONFIG_2ND_LVL_INTR_{}_OFFSET'. - format(str(i).zfill(2))] for i in - range(num_aggregators)] + if sum(INTERRUPT_BITS) > 32: + raise ValueError("Too many interrupt bits") - debug('2nd level offsets: {}'.format(list_2nd_lvl_offsets)) + INTERRUPT_LVL_BITMASK[0] = bit_mask(INTERRUPT_BITS[0]) + INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] + INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] - if "CONFIG_3RD_LEVEL_INTERRUPTS" in syms: - num_aggregators = syms["CONFIG_NUM_3RD_LEVEL_AGGREGATORS"] - irq3_baseoffset = syms["CONFIG_3RD_LVL_ISR_TBL_OFFSET"] - list_3rd_lvl_offsets = [syms['CONFIG_3RD_LVL_INTR_{}_OFFSET'. - format(str(i).zfill(2))] for i in - range(num_aggregators)] + debug("Level Bits Bitmask") + debug("----------------------------") + for i in range(3): + bitmask_str = "0x" + format(INTERRUPT_LVL_BITMASK[i], '08X') + debug(f"{i + 1:>5} {INTERRUPT_BITS[i]:>7} {bitmask_str:>14}") - debug('3rd level offsets: {}'.format(list_3rd_lvl_offsets)) +def update_vt_default_handler(): + """Update the vt default handler based on parsed arguments. + + The default vt handler would be different depending on the fact if we have sw_isr_table. + If we have it - the default handler would lead to common handler. + If we do not - the default handler would be spurious handler + + The result is writen into vt_default_handler variable. + """ + global vt_default_handler + + if args.sw_isr_table: + vt_default_handler = vt_irq_handler + else: + vt_default_handler = vt_spurious_handler +def parse_intlist(intlist, syms): + """All the intlist data are parsed into swt and vt arrays. + + The vt array is prepared for hardware interrupt table. + Every entry in the selected position would contain None or the name of the function pointer + (address or string). + + The swt is a little more complex. At every position it would contain an array of parameter and + function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. + If empty array is placed on selected position - it means that the application does not implement + this interrupt. + + Parameters: + - intlist: The preprocessed list of intlist section content (see read_intlist) + - syms: Symbols + + Return: + vt, swt - parsed vt and swt arrays (see function description above) + """ nvec = intlist["num_vectors"] offset = intlist["offset"] if nvec > pow(2, 15): raise ValueError('nvec is too large, check endianness.') - swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" - swt_shared_handler = "((uintptr_t)&z_shared_isr)" - vt_spurious_handler = "z_irq_spurious" - vt_irq_handler = "_isr_wrapper" - debug('offset is ' + str(offset)) debug('num_vectors is ' + str(nvec)) # Set default entries in both tables + if not(args.sw_isr_table or args.vector_table): + error("one or both of -s or -V needs to be specified on command line") + if args.vector_table: + vt = [None for i in range(nvec)] + else: + vt = None if args.sw_isr_table: - # All vectors just jump to the common vt_irq_handler. If some entries - # are used for direct interrupts, they will be replaced later. - if args.vector_table: - vt = [vt_irq_handler for i in range(nvec)] - else: - vt = None - # Default to spurious interrupt handler. Configured interrupts - # will replace these entries. - swt = [(0, swt_spurious_handler) for i in range(nvec)] - shared = [([], 0) for i in range(nvec)] + swt = [[] for i in range(nvec)] else: - if args.vector_table: - vt = [vt_spurious_handler for i in range(nvec)] - else: - error("one or both of -s or -V needs to be specified on command line") swt = None + # Gather info about multi level interrupts if enabled + if "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: + max_irq_per = syms["CONFIG_MAX_IRQ_PER_AGGREGATOR"] + + if "CONFIG_2ND_LEVEL_INTERRUPTS" in syms: + num_aggregators = syms["CONFIG_NUM_2ND_LEVEL_AGGREGATORS"] + irq2_baseoffset = syms["CONFIG_2ND_LVL_ISR_TBL_OFFSET"] + list_2nd_lvl_offsets = [syms['CONFIG_2ND_LVL_INTR_{}_OFFSET'. + format(str(i).zfill(2))] for i in + range(num_aggregators)] + + debug('2nd level offsets: {}'.format(list_2nd_lvl_offsets)) + + if "CONFIG_3RD_LEVEL_INTERRUPTS" in syms: + num_aggregators = syms["CONFIG_NUM_3RD_LEVEL_AGGREGATORS"] + irq3_baseoffset = syms["CONFIG_3RD_LVL_ISR_TBL_OFFSET"] + list_3rd_lvl_offsets = [syms['CONFIG_3RD_LVL_INTR_{}_OFFSET'. + format(str(i).zfill(2))] for i in + range(num_aggregators)] + + debug('3rd level offsets: {}'.format(list_3rd_lvl_offsets)) + # Process intlist and write to the tables created for irq, flags, func, param in intlist["interrupts"]: if flags & ISR_FLAG_DIRECT: if not vt: @@ -381,13 +377,12 @@ def main(): else: # Figure out third level interrupt position debug('IRQ = ' + hex(irq)) - irq3 = (irq & INTERRUPT_LVL_BITMASK[2]) >> INTERRUPT_BITS[0] + INTERRUPT_BITS[1] - irq2 = (irq & INTERRUPT_LVL_BITMASK[1]) >> INTERRUPT_BITS[0] + irq3 = (irq & INTERRUPT_LVL_BITMASK[2]) >> (INTERRUPT_BITS[0] + INTERRUPT_BITS[1]) + irq2 = (irq & INTERRUPT_LVL_BITMASK[1]) >> (INTERRUPT_BITS[0]) irq1 = irq & INTERRUPT_LVL_BITMASK[0] if irq3: - irq_parent = irq2 - list_index = getindex(irq_parent, list_3rd_lvl_offsets) + list_index = getindex(irq2, list_3rd_lvl_offsets) irq3_pos = irq3_baseoffset + max_irq_per*list_index + irq3 - 1 debug('IRQ_level = 3') debug('IRQ_Indx = ' + str(irq3)) @@ -396,8 +391,7 @@ def main(): # Figure out second level interrupt position elif irq2: - irq_parent = irq1 - list_index = getindex(irq_parent, list_2nd_lvl_offsets) + list_index = getindex(irq1, list_2nd_lvl_offsets) irq2_pos = irq2_baseoffset + max_irq_per*list_index + irq2 - 1 debug('IRQ_level = 2') debug('IRQ_Indx = ' + str(irq2)) @@ -415,36 +409,92 @@ def main(): error("IRQ %d (offset=%d) exceeds the maximum of %d" % (table_index, offset, len(swt) - 1)) if "CONFIG_SHARED_INTERRUPTS" in syms: - if swt[table_index] != (0, swt_spurious_handler): - # check client limit - if syms["CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"] == shared[table_index][1]: - error(f"Reached shared interrupt client limit. Maybe increase" + lst = swt[table_index] + if (param, func) in lst: + error("Attempting to register the same ISR/arg pair twice.") + if len(lst) >= syms["CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"]: + error(f"Reached shared interrupt client limit. Maybe increase" + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") - lst = shared[table_index][0] - delta_size = 1 - if not shared[table_index][1]: - lst.append(swt[table_index]) - # note: the argument will be fixed when writing the ISR table - # to isr_table.c - swt[table_index] = (0, swt_shared_handler) - delta_size += 1 - if (param, func) in lst: - error("Attempting to register the same ISR/arg pair twice.") - lst.append((param, func)) - shared[table_index] = (lst, shared[table_index][1] + delta_size) - else: - swt[table_index] = (param, func) else: - if swt[table_index] != (0, swt_spurious_handler): + if len(swt[table_index]) > 0: error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" - + f"\nExisting handler 0x{swt[table_index][1]:x}, new handler 0x{func:x}" + + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" ) - else: - swt[table_index] = (param, func) + swt[table_index].append((param, func)) + + return vt, swt + +def get_symbols(obj): + for section in obj.iter_sections(): + if isinstance(section, SymbolTableSection): + return {sym.name: sym.entry.st_value + for sym in section.iter_symbols()} + + error("Could not find symbol table") + +def read_intList_sect(elfobj, snames): + """ + Load the raw intList section data in a form of byte array. + """ + intList_sect = None + + for sname in snames: + intList_sect = elfobj.get_section_by_name(sname) + if intList_sect is not None: + debug("Found intlist section: \"{}\"".format(sname)) + break + + if intList_sect is None: + error("Cannot find the intlist section!") + + intdata = intList_sect.data() + + return intdata + +def parse_args(): + global args + + parser = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False) + + parser.add_argument("-e", "--big-endian", action="store_true", + help="Target encodes data in big-endian format (little endian is " + "the default)") + parser.add_argument("-d", "--debug", action="store_true", + help="Print additional debugging information") + parser.add_argument("-o", "--output-source", required=True, + help="Output source file") + parser.add_argument("-k", "--kernel", required=True, + help="Zephyr kernel image") + parser.add_argument("-s", "--sw-isr-table", action="store_true", + help="Generate SW ISR table") + parser.add_argument("-V", "--vector-table", action="store_true", + help="Generate vector table") + parser.add_argument("-i", "--intlist-section", action="append", required=True, + help="The name of the section to search for the interrupt data. " + "This is accumulative argument. The first section found would be used.") + + args = parser.parse_args() + +def main(): + """ + All the input data are parsed to vt + """ + parse_args() + + with open(args.kernel, "rb") as fp: + kernel = ELFFile(fp) + syms = get_symbols(kernel) + intlist_data = read_intList_sect(kernel, args.intlist_section) + intlist = read_intlist(intlist_data, syms) + + update_masks(syms) + update_vt_default_handler() + vt, swt = parse_intlist(intlist, syms) with open(args.output_source, "w") as fp: - write_source_file(fp, vt, swt, intlist, syms, shared) + write_source_file(fp, vt, swt, intlist, syms) if __name__ == "__main__": main() From a56a957bcb8758dce90bedc8ebae5c2816d271ff Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Thu, 9 Nov 2023 09:41:43 +0100 Subject: [PATCH 0568/2300] [nrf fromtree] scripts: gen_isr_tables: Break code into classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit breaks the code into functional classes. This way the functionality is visibly splitted into functional parts and it is easier to replace the specific parser part to implement new code generators. There is also common functionality to handle multi level interrupts moved to configuration class. Signed-off-by: Radosław Koppel (cherry picked from commit 568cced14fabe686b01ceea3884a488ca4213fb4) (cherry picked from commit 34d26ee38bec4b8444661de8eb2fc02ab8de9056) --- scripts/build/gen_isr_tables.py | 826 ++++++++++++++++++-------------- 1 file changed, 456 insertions(+), 370 deletions(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 41fc20957a6..3032d1e30c9 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -14,142 +14,227 @@ from elftools.elf.elffile import ELFFile from elftools.elf.sections import SymbolTableSection -ISR_FLAG_DIRECT = 1 << 0 - -# The below few hardware independent magic numbers represent various -# levels of interrupts in a multi-level interrupt system. -# 0x000000FF - represents the 1st level (i.e. the interrupts -# that directly go to the processor). -# 0x0000FF00 - represents the 2nd level (i.e. the interrupts funnel -# into 1 line which then goes into the 1st level) -# 0x00FF0000 - represents the 3rd level (i.e. the interrupts funnel -# into 1 line which then goes into the 2nd level) -INTERRUPT_LVL_BITMASK = [0x000000FF, 0x0000FF00, 0x00FF0000] - -INTERRUPT_BITS = [8, 8, 8] - -swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" -swt_shared_handler = "((uintptr_t)&z_shared_isr)" -vt_spurious_handler = "z_irq_spurious" -vt_irq_handler = "_isr_wrapper" -vt_default_handler = None - - -def debug(text): - if args.debug: - sys.stdout.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") - -def error(text): - sys.exit(os.path.basename(sys.argv[0]) + ": error: " + text + "\n") - -def endian_prefix(): - if args.big_endian: - return ">" - else: - return "<" - -def read_intlist(intlist_data, syms): - """read a binary file containing the contents of the kernel's .intList - section. This is an instance of a header created by - include/zephyr/linker/intlist.ld: - - struct { - uint32_t num_vectors; <- typically CONFIG_NUM_IRQS - struct _isr_list isrs[]; <- Usually of smaller size than num_vectors - } - - Followed by instances of struct _isr_list created by IRQ_CONNECT() - calls: - - struct _isr_list { - /** IRQ line number */ - int32_t irq; - /** Flags for this IRQ, see ISR_FLAG_* definitions */ - int32_t flags; - /** ISR to call */ - void *func; - /** Parameter for non-direct IRQs */ - const void *param; - }; - """ - intlist = {} - prefix = endian_prefix() - - # Extract header and the rest of the data - intlist_header_fmt = prefix + "II" - header_sz = struct.calcsize(intlist_header_fmt) - header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) - debug(str(header_raw)) - intlist["num_vectors"] = header_raw[0] - intlist["offset"] = header_raw[1] - intdata = intlist_data[header_sz:] +class gen_isr_log: - # Extract information about interrupts - if "CONFIG_64BIT" in syms: - intlist_entry_fmt = prefix + "iiQQ" - else: - intlist_entry_fmt = prefix + "iiII" + def __init__(self, debug = False): + self.__debug = debug - intlist["interrupts"] = [i for i in - struct.iter_unpack(intlist_entry_fmt, intdata)] + def debug(self, text): + """Print debug message if debugging is enabled. - debug("Configured interrupt routing") - debug("handler irq flags param") - debug("--------------------------") + Note - this function requires config global variable to be initialized. + """ + if self.__debug: + sys.stdout.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") - for irq in intlist["interrupts"]: - debug("{0:<10} {1:<3} {2:<3} {3}".format( - hex(irq[2]), irq[0], irq[1], hex(irq[3]))) + @staticmethod + def error(text): + sys.exit(os.path.basename(sys.argv[0]) + ": error: " + text + "\n") - return intlist - -source_assembly_header = """ -#ifndef ARCH_IRQ_VECTOR_JUMP_CODE -#error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" -#endif -""" + def set_debug(self, state): + self.__debug = state -def get_symbol_from_addr(syms, addr): - for key, value in syms.items(): - if addr == value: - return key - return None -def write_code_irq_vector_table(fp, vt, nv, syms): - fp.write(source_assembly_header) +log = gen_isr_log() - fp.write("void __irq_vector_table __attribute__((naked)) _irq_vector_table(void) {\n") - for i in range(nv): - func = vt[i] - if func is None: - func = vt_default_handler - - if isinstance(func, int): - func_as_string = get_symbol_from_addr(syms, func) +class gen_isr_config: + """All the constants and configuration gathered in single class for readability. + """ + # Constants + __ISR_FLAG_DIRECT = 1 << 0 + __swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" + __swt_shared_handler = "((uintptr_t)&z_shared_isr)" + __vt_spurious_handler = "z_irq_spurious" + __vt_irq_handler = "_isr_wrapper" + + @staticmethod + def __bm(bits): + return (1 << bits) - 1 + + def __init__(self, args, syms, log): + """Initialize the configuration object. + + The configuration object initialization takes only arguments as a parameter. + This is done to allow debug function work as soon as possible. + """ + # Store the arguments required for work + self.__args = args + self.__syms = syms + self.__log = log + + # Select the default interrupt vector handler + if self.args.sw_isr_table: + self.__vt_default_handler = self.__vt_irq_handler else: - func_as_string = func - - fp.write("\t__asm(ARCH_IRQ_VECTOR_JUMP_CODE({}));\n".format(func_as_string)) - fp.write("}\n") - -def write_address_irq_vector_table(fp, vt, nv): - fp.write("uintptr_t __irq_vector_table _irq_vector_table[%d] = {\n" % nv) - for i in range(nv): - func = vt[i] - - if func is None: - func = vt_default_handler - - if isinstance(func, int): - fp.write("\t{},\n".format(func)) + self.__vt_default_handler = self.__vt_spurious_handler + # Calculate interrupt bits + self.__int_bits = [8, 8, 8] + # The below few hardware independent magic numbers represent various + # levels of interrupts in a multi-level interrupt system. + # 0x000000FF - represents the 1st level (i.e. the interrupts + # that directly go to the processor). + # 0x0000FF00 - represents the 2nd level (i.e. the interrupts funnel + # into 1 line which then goes into the 1st level) + # 0x00FF0000 - represents the 3rd level (i.e. the interrupts funnel + # into 1 line which then goes into the 2nd level) + self.__int_lvl_masks = [0x000000FF, 0x0000FF00, 0x00FF0000] + + self.__irq2_baseoffset = None + self.__irq3_baseoffset = None + self.__irq2_offsets = None + self.__irq3_offsets = None + + if self.check_multi_level_interrupts(): + self.__max_irq_per = self.get_sym("CONFIG_MAX_IRQ_PER_AGGREGATOR") + + self.__int_bits[0] = self.get_sym("CONFIG_1ST_LEVEL_INTERRUPT_BITS") + self.__int_bits[1] = self.get_sym("CONFIG_2ND_LEVEL_INTERRUPT_BITS") + self.__int_bits[2] = self.get_sym("CONFIG_3RD_LEVEL_INTERRUPT_BITS") + + if sum(self.int_bits) > 32: + raise ValueError("Too many interrupt bits") + + self.__int_lvl_masks[0] = self.__bm(self.int_bits[0]) + self.__int_lvl_masks[1] = self.__bm(self.int_bits[1]) << self.int_bits[0] + self.__int_lvl_masks[2] = self.__bm(self.int_bits[2]) << (self.int_bits[0] + self.int_bits[1]) + + self.__log.debug("Level Bits Bitmask") + self.__log.debug("----------------------------") + for i in range(3): + bitmask_str = "0x" + format(self.__int_lvl_masks[i], '08X') + self.__log.debug(f"{i + 1:>5} {self.__int_bits[i]:>7} {bitmask_str:>14}") + + if self.check_sym("CONFIG_2ND_LEVEL_INTERRUPTS"): + num_aggregators = self.get_sym("CONFIG_NUM_2ND_LEVEL_AGGREGATORS") + self.__irq2_baseoffset = self.get_sym("CONFIG_2ND_LVL_ISR_TBL_OFFSET") + self.__irq2_offsets = [self.get_sym('CONFIG_2ND_LVL_INTR_{}_OFFSET'. + format(str(i).zfill(2))) for i in + range(num_aggregators)] + + self.__log.debug('2nd level offsets: {}'.format(self.__irq2_offsets)) + + if self.check_sym("CONFIG_3RD_LEVEL_INTERRUPTS"): + num_aggregators = self.get_sym("CONFIG_NUM_3RD_LEVEL_AGGREGATORS") + self.__irq3_baseoffset = self.get_sym("CONFIG_3RD_LVL_ISR_TBL_OFFSET") + self.__irq3_offsets = [self.get_sym('CONFIG_3RD_LVL_INTR_{}_OFFSET'. + format(str(i).zfill(2))) for i in + range(num_aggregators)] + + self.__log.debug('3rd level offsets: {}'.format(self.__irq3_offsets)) + + @property + def args(self): + return self.__args + + @property + def swt_spurious_handler(self): + return self.__swt_spurious_handler + + @property + def swt_shared_handler(self): + return self.__swt_shared_handler + + @property + def vt_default_handler(self): + return self.__vt_default_handler + + @property + def int_bits(self): + return self.__int_bits + + @property + def int_lvl_masks(self): + return self.__int_lvl_masks + + def endian_prefix(self): + if self.args.big_endian: + return ">" else: - fp.write("\t((uintptr_t)&{}),\n".format(func)) - - fp.write("};\n") - -source_header = """ + return "<" + + def get_irq_baseoffset(self, lvl): + if lvl == 2: + return self.__irq2_baseoffset + if lvl == 3: + return self.__irq3_baseoffset + self.__log.error("Unsupported irq level: {}".format(lvl)) + + def get_irq_index(self, irq, lvl): + if lvl == 2: + offsets = self.__irq2_offsets + elif lvl == 3: + offsets = self.__irq3_offsets + else: + self.__log.error("Unsupported irq level: {}".format(lvl)) + try: + return offsets.index(irq) + except ValueError: + self.__log.error("IRQ {} not present in parent offsets ({}). ". + format(irq, offsets) + + " Recheck interrupt configuration.") + + def get_swt_table_index(self, offset, irq): + if not self.check_multi_level_interrupts(): + return irq - offset + # Calculate index for multi level interrupts + self.__log.debug('IRQ = ' + hex(irq)) + irq3 = (irq & self.int_lvl_masks[2]) >> (self.int_bits[0] + self.int_bits[1]) + irq2 = (irq & self.int_lvl_masks[1]) >> (self.int_bits[0]) + irq1 = irq & self.int_lvl_masks[0] + # Figure out third level interrupt position + if irq3: + list_index = self.get_irq_index(irq2, 3) + irq3_pos = self.get_irq_baseoffset(3) + self.__max_irq_per * list_index + irq3 - 1 + self.__log.debug('IRQ_level = 3') + self.__log.debug('IRQ_Indx = ' + str(irq3)) + self.__log.debug('IRQ_Pos = ' + str(irq3_pos)) + return irq3_pos - offset + # Figure out second level interrupt position + if irq2: + list_index = self.get_irq_index(irq1, 2) + irq2_pos = self.get_irq_baseoffset(2) + self.__max_irq_per * list_index + irq2 - 1 + self.__log.debug('IRQ_level = 2') + self.__log.debug('IRQ_Indx = ' + str(irq2)) + self.__log.debug('IRQ_Pos = ' + str(irq2_pos)) + return irq2_pos - offset + # Figure out first level interrupt position + self.__log.debug('IRQ_level = 1') + self.__log.debug('IRQ_Indx = ' + str(irq1)) + self.__log.debug('IRQ_Pos = ' + str(irq1)) + return irq1 - offset + + def get_intlist_snames(self): + return self.args.intlist_section + + def test_isr_direct(self, flags): + return flags & self.__ISR_FLAG_DIRECT + + def get_sym_from_addr(self, addr): + for key, value in self.__syms.items(): + if addr == value: + return key + return None + + def get_sym(self, name): + return self.__syms.get(name) + + def check_sym(self, name): + return name in self.__syms + + def check_multi_level_interrupts(self): + return self.check_sym("CONFIG_MULTI_LEVEL_INTERRUPTS") + + def check_shared_interrupts(self): + return self.check_sym("CONFIG_SHARED_INTERRUPTS") + + def check_64b(self): + return self.check_sym("CONFIG_64BIT") + + +class gen_isr_parser: + source_header = """ /* AUTO-GENERATED by gen_isr_tables.py, do not edit! */ #include @@ -160,270 +245,276 @@ def write_address_irq_vector_table(fp, vt, nv): typedef void (* ISR)(const void *); """ -def write_shared_table(fp, swt, nv): - fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" - " z_shared_sw_isr_table[%d] = {\n" % nv) + source_assembly_header = """ +#ifndef ARCH_IRQ_VECTOR_JUMP_CODE +#error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" +#endif +""" - for i in range(nv): - if swt[i] is None: - client_num = 0 - client_list = None + def __init__(self, intlist_data, config, log): + """Initialize the parser. + + The function prepares parser to work. + Parameters: + - intlist_data: The binnary data from intlist section + - config: The configuration object + - log: The logging object, has to have error and debug methods + """ + self.__config = config + self.__log = log + intlist = self.__read_intlist(intlist_data) + self.__vt, self.__swt, self.__nv = self.__parse_intlist(intlist) + + def __read_intlist(self, intlist_data): + """read a binary file containing the contents of the kernel's .intList + section. This is an instance of a header created by + include/zephyr/linker/intlist.ld: + + struct { + uint32_t num_vectors; <- typically CONFIG_NUM_IRQS + struct _isr_list isrs[]; <- Usually of smaller size than num_vectors + } + + Followed by instances of struct _isr_list created by IRQ_CONNECT() + calls: + + struct _isr_list { + /** IRQ line number */ + int32_t irq; + /** Flags for this IRQ, see ISR_FLAG_* definitions */ + int32_t flags; + /** ISR to call */ + void *func; + /** Parameter for non-direct IRQs */ + const void *param; + }; + """ + intlist = {} + prefix = self.__config.endian_prefix() + + # Extract header and the rest of the data + intlist_header_fmt = prefix + "II" + header_sz = struct.calcsize(intlist_header_fmt) + header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) + self.__log.debug(str(header_raw)) + + intlist["num_vectors"] = header_raw[0] + intlist["offset"] = header_raw[1] + intdata = intlist_data[header_sz:] + + # Extract information about interrupts + if self.__config.check_64b(): + intlist_entry_fmt = prefix + "iiQQ" else: - client_num = len(swt[i]) - client_list = swt[i] + intlist_entry_fmt = prefix + "iiII" - if client_num <= 1: - fp.write("\t{ },\n") - else: - fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") - for j in range(0, client_num): - routine = client_list[j][1] - arg = client_list[j][0] + intlist["interrupts"] = [i for i in + struct.iter_unpack(intlist_entry_fmt, intdata)] + + self.__log.debug("Configured interrupt routing") + self.__log.debug("handler irq flags param") + self.__log.debug("--------------------------") + + for irq in intlist["interrupts"]: + self.__log.debug("{0:<10} {1:<3} {2:<3} {3}".format( + hex(irq[2]), irq[0], irq[1], hex(irq[3]))) - fp.write(f"{{ .isr = (ISR){ hex(routine) if isinstance(routine, int) else routine }, " - f".arg = (const void *){hex(arg)} }},") + return intlist - fp.write(" },\n},\n") + def __parse_intlist(self, intlist): + """All the intlist data are parsed into swt and vt arrays. - fp.write("};\n") + The vt array is prepared for hardware interrupt table. + Every entry in the selected position would contain None or the name of the function pointer + (address or string). -def write_source_file(fp, vt, swt, intlist, syms): - fp.write(source_header) + The swt is a little more complex. At every position it would contain an array of parameter and + function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. + If empty array is placed on selected position - it means that the application does not implement + this interrupt. - nv = intlist["num_vectors"] + Parameters: + - intlist: The preprocessed list of intlist section content (see read_intlist) - if "CONFIG_SHARED_INTERRUPTS" in syms: - write_shared_table(fp, swt, nv) + Return: + vt, swt - parsed vt and swt arrays (see function description above) + """ + nvec = intlist["num_vectors"] + offset = intlist["offset"] - if vt: - if "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS" in syms: - write_address_irq_vector_table(fp, vt, nv) - elif "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE" in syms: - write_code_irq_vector_table(fp, vt, nv, syms) + if nvec > pow(2, 15): + raise ValueError('nvec is too large, check endianness.') + + self.__log.debug('offset is ' + str(offset)) + self.__log.debug('num_vectors is ' + str(nvec)) + + # Set default entries in both tables + if not(self.__config.args.sw_isr_table or self.__config.args.vector_table): + self.__log.error("one or both of -s or -V needs to be specified on command line") + if self.__config.args.vector_table: + vt = [None for i in range(nvec)] else: - error("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set") - - if not swt: - return - - fp.write("struct _isr_table_entry __sw_isr_table _sw_isr_table[%d] = {\n" - % nv) - - level2_offset = syms.get("CONFIG_2ND_LVL_ISR_TBL_OFFSET") - level3_offset = syms.get("CONFIG_3RD_LVL_ISR_TBL_OFFSET") - - for i in range(nv): - if len(swt[i]) == 0: - # Not used interrupt - param = "0x0" - func = swt_spurious_handler - elif len(swt[i]) == 1: - # Single interrupt - param = "{0:#x}".format(swt[i][0][0]) - func = swt[i][0][1] + vt = None + if self.__config.args.sw_isr_table: + swt = [[] for i in range(nvec)] else: - # Shared interrupt - param = "&z_shared_sw_isr_table[{0}]".format(i) - func = swt_shared_handler + swt = None - if isinstance(func, int): - func_as_string = "{0:#x}".format(func) - else: - func_as_string = func + # Process intlist and write to the tables created + for irq, flags, func, param in intlist["interrupts"]: + if not vt: + error("Direct Interrupt %d declared with parameter 0x%x " + "but no vector table in use" + % (irq, param)) + if self.__config.test_isr_direct(flags): + if param != 0: + self.__log.error("Direct irq %d declared, but has non-NULL parameter" + % irq) + if not 0 <= irq - offset < len(vt): + self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % + (irq - offset, offset, len(vt) - 1)) + vt[irq - offset] = func + else: + # Regular interrupt + if not swt: + self.__log.error("Regular Interrupt %d declared with parameter 0x%x " + "but no SW ISR_TABLE in use" + % (irq, param)) + + table_index = self.__config.get_swt_table_index(offset, irq) + + if not 0 <= table_index < len(swt): + self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % + (table_index, offset, len(swt) - 1)) + if self.__config.check_shared_interrupts(): + lst = swt[table_index] + if (param, func) in lst: + self.__log.error("Attempting to register the same ISR/arg pair twice.") + if len(lst) >= self.__config.get_sym("CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"): + self.__log.error(f"Reached shared interrupt client limit. Maybe increase" + + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") + else: + if len(swt[table_index]) > 0: + self.__log.error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" + + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" + + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" + ) + swt[table_index].append((param, func)) - if level2_offset is not None and i == level2_offset: - fp.write("\t/* Level 2 interrupts start here (offset: {}) */\n". - format(level2_offset)) - if level3_offset is not None and i == level3_offset: - fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". - format(level3_offset)) + return vt, swt, nvec - fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) - fp.write("};\n") + def __write_code_irq_vector_table(self, fp): + fp.write(self.source_assembly_header) -def getindex(irq, irq_aggregator_pos): - try: - return irq_aggregator_pos.index(irq) - except ValueError: - error("IRQ {} not present in parent offsets ({}). ". - format(irq, irq_aggregator_pos) + - " Recheck interrupt configuration.") + fp.write("void __irq_vector_table __attribute__((naked)) _irq_vector_table(void) {\n") + for i in range(self.__nv): + func = self.__vt[i] -def bit_mask(bits): - return (1 << bits) - 1 + if func is None: + func = self.__config.vt_default_handler -def update_masks(syms): + if isinstance(func, int): + func_as_string = self.__config.get_sym_from_addr(func) + else: + func_as_string = func - if "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: - max_irq_per = syms["CONFIG_MAX_IRQ_PER_AGGREGATOR"] + fp.write("\t__asm(ARCH_IRQ_VECTOR_JUMP_CODE({}));\n".format(func_as_string)) + fp.write("}\n") - INTERRUPT_BITS[0] = syms["CONFIG_1ST_LEVEL_INTERRUPT_BITS"] - INTERRUPT_BITS[1] = syms["CONFIG_2ND_LEVEL_INTERRUPT_BITS"] - INTERRUPT_BITS[2] = syms["CONFIG_3RD_LEVEL_INTERRUPT_BITS"] + def __write_address_irq_vector_table(self, fp): + fp.write("uintptr_t __irq_vector_table _irq_vector_table[%d] = {\n" % self.__nv) + for i in range(self.__nv): + func = self.__vt[i] - if sum(INTERRUPT_BITS) > 32: - raise ValueError("Too many interrupt bits") + if func is None: + func = self.__config.vt_default_handler - INTERRUPT_LVL_BITMASK[0] = bit_mask(INTERRUPT_BITS[0]) - INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] - INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + if isinstance(func, int): + fp.write("\t{},\n".format(func)) + else: + fp.write("\t((uintptr_t)&{}),\n".format(func)) - debug("Level Bits Bitmask") - debug("----------------------------") - for i in range(3): - bitmask_str = "0x" + format(INTERRUPT_LVL_BITMASK[i], '08X') - debug(f"{i + 1:>5} {INTERRUPT_BITS[i]:>7} {bitmask_str:>14}") + fp.write("};\n") -def update_vt_default_handler(): - """Update the vt default handler based on parsed arguments. + def __write_shared_table(self, fp): + fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" + " z_shared_sw_isr_table[%d] = {\n" % self.__nv) - The default vt handler would be different depending on the fact if we have sw_isr_table. - If we have it - the default handler would lead to common handler. - If we do not - the default handler would be spurious handler + for i in range(self.__nv): + if self.__swt[i] is None: + client_num = 0 + client_list = None + else: + client_num = len(self.__swt[i]) + client_list = self.__swt[i] - The result is writen into vt_default_handler variable. - """ - global vt_default_handler + if client_num <= 1: + fp.write("\t{ },\n") + else: + fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") + for j in range(0, client_num): + routine = client_list[j][1] + arg = client_list[j][0] - if args.sw_isr_table: - vt_default_handler = vt_irq_handler - else: - vt_default_handler = vt_spurious_handler + fp.write(f"{{ .isr = (ISR){ hex(routine) if isinstance(routine, int) else routine }, " + f".arg = (const void *){hex(arg)} }},") -def parse_intlist(intlist, syms): - """All the intlist data are parsed into swt and vt arrays. + fp.write(" },\n},\n") - The vt array is prepared for hardware interrupt table. - Every entry in the selected position would contain None or the name of the function pointer - (address or string). + fp.write("};\n") - The swt is a little more complex. At every position it would contain an array of parameter and - function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. - If empty array is placed on selected position - it means that the application does not implement - this interrupt. + def write_source(self, fp): + fp.write(self.source_header) - Parameters: - - intlist: The preprocessed list of intlist section content (see read_intlist) - - syms: Symbols + if self.__config.check_shared_interrupts(): + self.__write_shared_table(fp) - Return: - vt, swt - parsed vt and swt arrays (see function description above) - """ - nvec = intlist["num_vectors"] - offset = intlist["offset"] - - if nvec > pow(2, 15): - raise ValueError('nvec is too large, check endianness.') - - debug('offset is ' + str(offset)) - debug('num_vectors is ' + str(nvec)) - - # Set default entries in both tables - if not(args.sw_isr_table or args.vector_table): - error("one or both of -s or -V needs to be specified on command line") - if args.vector_table: - vt = [None for i in range(nvec)] - else: - vt = None - if args.sw_isr_table: - swt = [[] for i in range(nvec)] - else: - swt = None - - # Gather info about multi level interrupts if enabled - if "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: - max_irq_per = syms["CONFIG_MAX_IRQ_PER_AGGREGATOR"] - - if "CONFIG_2ND_LEVEL_INTERRUPTS" in syms: - num_aggregators = syms["CONFIG_NUM_2ND_LEVEL_AGGREGATORS"] - irq2_baseoffset = syms["CONFIG_2ND_LVL_ISR_TBL_OFFSET"] - list_2nd_lvl_offsets = [syms['CONFIG_2ND_LVL_INTR_{}_OFFSET'. - format(str(i).zfill(2))] for i in - range(num_aggregators)] - - debug('2nd level offsets: {}'.format(list_2nd_lvl_offsets)) - - if "CONFIG_3RD_LEVEL_INTERRUPTS" in syms: - num_aggregators = syms["CONFIG_NUM_3RD_LEVEL_AGGREGATORS"] - irq3_baseoffset = syms["CONFIG_3RD_LVL_ISR_TBL_OFFSET"] - list_3rd_lvl_offsets = [syms['CONFIG_3RD_LVL_INTR_{}_OFFSET'. - format(str(i).zfill(2))] for i in - range(num_aggregators)] - - debug('3rd level offsets: {}'.format(list_3rd_lvl_offsets)) - # Process intlist and write to the tables created - for irq, flags, func, param in intlist["interrupts"]: - if flags & ISR_FLAG_DIRECT: - if not vt: - error("Direct Interrupt %d declared with parameter 0x%x " - "but no vector table in use" - % (irq, param)) - if param != 0: - error("Direct irq %d declared, but has non-NULL parameter" - % irq) - if not 0 <= irq - offset < len(vt): - error("IRQ %d (offset=%d) exceeds the maximum of %d" % - (irq - offset, offset, len(vt) - 1)) - vt[irq - offset] = func - else: - # Regular interrupt - if not swt: - error("Regular Interrupt %d declared with parameter 0x%x " - "but no SW ISR_TABLE in use" - % (irq, param)) - - if not "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: - table_index = irq - offset + if self.__vt: + if self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS"): + self.__write_address_irq_vector_table(fp) + elif self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE"): + self.__write_code_irq_vector_table(fp) else: - # Figure out third level interrupt position - debug('IRQ = ' + hex(irq)) - irq3 = (irq & INTERRUPT_LVL_BITMASK[2]) >> (INTERRUPT_BITS[0] + INTERRUPT_BITS[1]) - irq2 = (irq & INTERRUPT_LVL_BITMASK[1]) >> (INTERRUPT_BITS[0]) - irq1 = irq & INTERRUPT_LVL_BITMASK[0] - - if irq3: - list_index = getindex(irq2, list_3rd_lvl_offsets) - irq3_pos = irq3_baseoffset + max_irq_per*list_index + irq3 - 1 - debug('IRQ_level = 3') - debug('IRQ_Indx = ' + str(irq3)) - debug('IRQ_Pos = ' + str(irq3_pos)) - table_index = irq3_pos - offset - - # Figure out second level interrupt position - elif irq2: - list_index = getindex(irq1, list_2nd_lvl_offsets) - irq2_pos = irq2_baseoffset + max_irq_per*list_index + irq2 - 1 - debug('IRQ_level = 2') - debug('IRQ_Indx = ' + str(irq2)) - debug('IRQ_Pos = ' + str(irq2_pos)) - table_index = irq2_pos - offset - - # Figure out first level interrupt position - else: - debug('IRQ_level = 1') - debug('IRQ_Indx = ' + str(irq1)) - debug('IRQ_Pos = ' + str(irq1)) - table_index = irq1 - offset - - if not 0 <= table_index < len(swt): - error("IRQ %d (offset=%d) exceeds the maximum of %d" % - (table_index, offset, len(swt) - 1)) - if "CONFIG_SHARED_INTERRUPTS" in syms: - lst = swt[table_index] - if (param, func) in lst: - error("Attempting to register the same ISR/arg pair twice.") - if len(lst) >= syms["CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"]: - error(f"Reached shared interrupt client limit. Maybe increase" - + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") + self.__log.error("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set") + + if not self.__swt: + return + + fp.write("struct _isr_table_entry __sw_isr_table _sw_isr_table[%d] = {\n" + % self.__nv) + + level2_offset = self.__config.get_irq_baseoffset(2) + level3_offset = self.__config.get_irq_baseoffset(3) + + for i in range(self.__nv): + if len(self.__swt[i]) == 0: + # Not used interrupt + param = "0x0" + func = self.__config.swt_spurious_handler + elif len(self.__swt[i]) == 1: + # Single interrupt + param = "{0:#x}".format(self.__swt[i][0][0]) + func = self.__swt[i][0][1] + else: + # Shared interrupt + param = "&z_shared_sw_isr_table[{0}]".format(i) + func = self.__config.swt_shared_handler + + if isinstance(func, int): + func_as_string = "{0:#x}".format(func) else: - if len(swt[table_index]) > 0: - error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" - + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" - + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" - ) - swt[table_index].append((param, func)) + func_as_string = func + + if level2_offset is not None and i == level2_offset: + fp.write("\t/* Level 2 interrupts start here (offset: {}) */\n". + format(level2_offset)) + if level3_offset is not None and i == level3_offset: + fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". + format(level3_offset)) + + fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) + fp.write("};\n") - return vt, swt def get_symbols(obj): for section in obj.iter_sections(): @@ -431,7 +522,7 @@ def get_symbols(obj): return {sym.name: sym.entry.st_value for sym in section.iter_symbols()} - error("Could not find symbol table") + log.error("Could not find symbol table") def read_intList_sect(elfobj, snames): """ @@ -442,19 +533,17 @@ def read_intList_sect(elfobj, snames): for sname in snames: intList_sect = elfobj.get_section_by_name(sname) if intList_sect is not None: - debug("Found intlist section: \"{}\"".format(sname)) + log.debug("Found intlist section: \"{}\"".format(sname)) break if intList_sect is None: - error("Cannot find the intlist section!") + log.error("Cannot find the intlist section!") intdata = intList_sect.data() return intdata def parse_args(): - global args - parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False) @@ -475,26 +564,23 @@ def parse_args(): help="The name of the section to search for the interrupt data. " "This is accumulative argument. The first section found would be used.") - args = parser.parse_args() + return parser.parse_args() def main(): - """ - All the input data are parsed to vt - """ - parse_args() + args = parse_args() + # Configure logging as soon as possible + log.set_debug(args.debug) with open(args.kernel, "rb") as fp: kernel = ELFFile(fp) - syms = get_symbols(kernel) - intlist_data = read_intList_sect(kernel, args.intlist_section) - intlist = read_intlist(intlist_data, syms) + config = gen_isr_config(args, get_symbols(kernel), log) + intlist_data = read_intList_sect(kernel, config.get_intlist_snames()) - update_masks(syms) - update_vt_default_handler() - vt, swt = parse_intlist(intlist, syms) + parser = gen_isr_parser(intlist_data, config, log) with open(args.output_source, "w") as fp: - write_source_file(fp, vt, swt, intlist, syms) + parser.write_source(fp) + if __name__ == "__main__": main() From d5e421e235ed1a1d69e5e31e893f3409a392e91b Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Wed, 31 Jan 2024 22:50:24 +0100 Subject: [PATCH 0569/2300] [nrf fromtree] arch: sw_isr_table: Update shared interrupts structures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates the definition of z_shared_isr_table_entry to use _isr_table_entry instead of specially created z_shared_isr_client. Signed-off-by: Radosław Koppel (cherry picked from commit b0c83f328c2bc62c1bade3e77da083a00ce36102) (cherry picked from commit 308d52c158f099b9dae396395937b8357f3b25ea) --- arch/common/shared_irq.c | 12 ++++++------ doc/kernel/services/interrupts.rst | 11 +---------- include/zephyr/sw_isr_table.h | 7 +------ tests/kernel/interrupt/src/test_shared_irq.h | 2 +- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/arch/common/shared_irq.c b/arch/common/shared_irq.c index 68641cb2bb0..a05e78002ce 100644 --- a/arch/common/shared_irq.c +++ b/arch/common/shared_irq.c @@ -20,7 +20,7 @@ void z_shared_isr(const void *data) { size_t i; const struct z_shared_isr_table_entry *entry; - const struct z_shared_isr_client *client; + const struct _isr_table_entry *client; entry = data; @@ -42,7 +42,7 @@ void z_isr_install(unsigned int irq, void (*routine)(const void *), { struct z_shared_isr_table_entry *shared_entry; struct _isr_table_entry *entry; - struct z_shared_isr_client *client; + struct _isr_table_entry *client; unsigned int table_idx; int i; k_spinlock_key_t key; @@ -103,10 +103,10 @@ void z_isr_install(unsigned int irq, void (*routine)(const void *), k_spin_unlock(&lock, key); } -static void swap_client_data(struct z_shared_isr_client *a, - struct z_shared_isr_client *b) +static void swap_client_data(struct _isr_table_entry *a, + struct _isr_table_entry *b) { - struct z_shared_isr_client tmp; + struct _isr_table_entry tmp; tmp.arg = a->arg; tmp.isr = a->isr; @@ -162,7 +162,7 @@ int z_isr_uninstall(unsigned int irq, { struct z_shared_isr_table_entry *shared_entry; struct _isr_table_entry *entry; - struct z_shared_isr_client *client; + struct _isr_table_entry *client; unsigned int table_idx; size_t i; k_spinlock_key_t key; diff --git a/doc/kernel/services/interrupts.rst b/doc/kernel/services/interrupts.rst index 849e614a562..44f0805edb0 100644 --- a/doc/kernel/services/interrupts.rst +++ b/doc/kernel/services/interrupts.rst @@ -549,7 +549,7 @@ This is an array of struct z_shared_isr_table_entry: .. code-block:: c struct z_shared_isr_table_entry { - struct z_shared_isr_client clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; + struct _isr_table_entry clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; size_t client_num; }; @@ -558,15 +558,6 @@ lines. Whenever an interrupt line becomes shared, c:func:`z_shared_isr` will replace the currently registered ISR in _sw_isr_table. This special ISR will iterate through the list of registered clients and invoke the ISRs. -The definition for struct z_shared_isr_client is as follows: - -.. code-block:: c - - struct z_shared_isr_client { - void (*isr)(const void *arg); - const void *arg; - }; - x86 Details ----------- diff --git a/include/zephyr/sw_isr_table.h b/include/zephyr/sw_isr_table.h index f43efafad49..fc094b887ba 100644 --- a/include/zephyr/sw_isr_table.h +++ b/include/zephyr/sw_isr_table.h @@ -69,13 +69,8 @@ struct _isr_list { }; #ifdef CONFIG_SHARED_INTERRUPTS -struct z_shared_isr_client { - void (*isr)(const void *arg); - const void *arg; -}; - struct z_shared_isr_table_entry { - struct z_shared_isr_client clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; + struct _isr_table_entry clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; size_t client_num; }; diff --git a/tests/kernel/interrupt/src/test_shared_irq.h b/tests/kernel/interrupt/src/test_shared_irq.h index fd3c4c4a624..5ddd50a16e1 100644 --- a/tests/kernel/interrupt/src/test_shared_irq.h +++ b/tests/kernel/interrupt/src/test_shared_irq.h @@ -41,7 +41,7 @@ static inline bool client_exists_at_index(void (*routine)(const void *arg), { size_t i; struct z_shared_isr_table_entry *shared_entry; - struct z_shared_isr_client *client; + struct _isr_table_entry *client; shared_entry = &z_shared_sw_isr_table[irq]; From c994131159644b58dbaa1985643c799e703b07e3 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Sat, 2 Dec 2023 23:09:11 +0100 Subject: [PATCH 0570/2300] [nrf fromtree] scripts: build: gen_isr_tables: Implement local ISR generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit moves all the functionality related to the current interrupt parser into gen_isr_tables_parser_carrays.py file. The new parser file gen_isr_tables_parser_local.py file is implemented with the new parser that. Additional information added to the generated interrupt header that contains data required by the new parser. Signed-off-by: Radosław Koppel (cherry picked from commit 0ae48ecb58da5ab8c3e942aa02b28ac4d604afbe) (cherry picked from commit 920b24369620af175f3d5f8cf2d2a99222eea9b0) --- CMakeLists.txt | 3 +- arch/common/isr_tables.c | 12 + scripts/build/gen_isr_tables.py | 332 +++------------- .../build/gen_isr_tables_parser_carrays.py | 292 ++++++++++++++ scripts/build/gen_isr_tables_parser_local.py | 375 ++++++++++++++++++ 5 files changed, 726 insertions(+), 288 deletions(-) create mode 100644 scripts/build/gen_isr_tables_parser_carrays.py create mode 100644 scripts/build/gen_isr_tables_parser_local.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 97bcd98d0d7..4292e06e211 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1226,10 +1226,11 @@ if(CONFIG_GEN_ISR_TABLES) # isr_tables.c is generated from ${ZEPHYR_LINK_STAGE_EXECUTABLE} by # gen_isr_tables.py add_custom_command( - OUTPUT isr_tables.c + OUTPUT isr_tables.c isr_tables_vt.ld isr_tables_swi.ld COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/gen_isr_tables.py --output-source isr_tables.c + --linker-output-files isr_tables_vt.ld isr_tables_swi.ld --kernel $ --intlist-section .intList --intlist-section intList diff --git a/arch/common/isr_tables.c b/arch/common/isr_tables.c index 9677c92683d..050597b7b1d 100644 --- a/arch/common/isr_tables.c +++ b/arch/common/isr_tables.c @@ -15,6 +15,11 @@ struct int_list_header { uint32_t table_size; uint32_t offset; +#if IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) + uint32_t swi_table_entry_size; + uint32_t shared_isr_table_entry_size; + uint32_t shared_isr_client_num_offset; +#endif /* IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) */ }; /* These values are not included in the resulting binary, but instead form the @@ -24,6 +29,13 @@ struct int_list_header { Z_GENERIC_SECTION(.irq_info) __used struct int_list_header _iheader = { .table_size = IRQ_TABLE_SIZE, .offset = CONFIG_GEN_IRQ_START_VECTOR, +#if IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) + .swi_table_entry_size = sizeof(struct _isr_table_entry), +#if IS_ENABLED(CONFIG_SHARED_INTERRUPTS) + .shared_isr_table_entry_size = sizeof(struct z_shared_isr_table_entry), + .shared_isr_client_num_offset = offsetof(struct z_shared_isr_table_entry, client_num), +#endif /* IS_ENABLED(CONFIG_SHARED_INTERRUPTS) */ +#endif /* IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) */ }; /* These are placeholder tables. They will be replaced by the real tables diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 3032d1e30c9..84812d708e8 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -8,9 +8,9 @@ # import argparse -import struct import sys import os +import importlib from elftools.elf.elffile import ELFFile from elftools.elf.sections import SymbolTableSection @@ -44,10 +44,13 @@ class gen_isr_config: """ # Constants __ISR_FLAG_DIRECT = 1 << 0 - __swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" - __swt_shared_handler = "((uintptr_t)&z_shared_isr)" + __swt_spurious_handler = "z_irq_spurious" + __swt_shared_handler = "z_shared_isr" __vt_spurious_handler = "z_irq_spurious" __vt_irq_handler = "_isr_wrapper" + __shared_array_name = "z_shared_sw_isr_table" + __sw_isr_array_name = "_sw_isr_table" + __irq_vector_array_name = "_irq_vector_table" @staticmethod def __bm(bits): @@ -140,6 +143,18 @@ def swt_shared_handler(self): def vt_default_handler(self): return self.__vt_default_handler + @property + def shared_array_name(self): + return self.__shared_array_name + + @property + def sw_isr_array_name(self): + return self.__sw_isr_array_name + + @property + def irq_vector_array_name(self): + return self.__irq_vector_array_name + @property def int_bits(self): return self.__int_bits @@ -233,289 +248,6 @@ def check_64b(self): return self.check_sym("CONFIG_64BIT") -class gen_isr_parser: - source_header = """ -/* AUTO-GENERATED by gen_isr_tables.py, do not edit! */ - -#include -#include -#include -#include - -typedef void (* ISR)(const void *); -""" - - source_assembly_header = """ -#ifndef ARCH_IRQ_VECTOR_JUMP_CODE -#error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" -#endif -""" - - def __init__(self, intlist_data, config, log): - """Initialize the parser. - - The function prepares parser to work. - Parameters: - - intlist_data: The binnary data from intlist section - - config: The configuration object - - log: The logging object, has to have error and debug methods - """ - self.__config = config - self.__log = log - intlist = self.__read_intlist(intlist_data) - self.__vt, self.__swt, self.__nv = self.__parse_intlist(intlist) - - def __read_intlist(self, intlist_data): - """read a binary file containing the contents of the kernel's .intList - section. This is an instance of a header created by - include/zephyr/linker/intlist.ld: - - struct { - uint32_t num_vectors; <- typically CONFIG_NUM_IRQS - struct _isr_list isrs[]; <- Usually of smaller size than num_vectors - } - - Followed by instances of struct _isr_list created by IRQ_CONNECT() - calls: - - struct _isr_list { - /** IRQ line number */ - int32_t irq; - /** Flags for this IRQ, see ISR_FLAG_* definitions */ - int32_t flags; - /** ISR to call */ - void *func; - /** Parameter for non-direct IRQs */ - const void *param; - }; - """ - intlist = {} - prefix = self.__config.endian_prefix() - - # Extract header and the rest of the data - intlist_header_fmt = prefix + "II" - header_sz = struct.calcsize(intlist_header_fmt) - header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) - self.__log.debug(str(header_raw)) - - intlist["num_vectors"] = header_raw[0] - intlist["offset"] = header_raw[1] - intdata = intlist_data[header_sz:] - - # Extract information about interrupts - if self.__config.check_64b(): - intlist_entry_fmt = prefix + "iiQQ" - else: - intlist_entry_fmt = prefix + "iiII" - - intlist["interrupts"] = [i for i in - struct.iter_unpack(intlist_entry_fmt, intdata)] - - self.__log.debug("Configured interrupt routing") - self.__log.debug("handler irq flags param") - self.__log.debug("--------------------------") - - for irq in intlist["interrupts"]: - self.__log.debug("{0:<10} {1:<3} {2:<3} {3}".format( - hex(irq[2]), irq[0], irq[1], hex(irq[3]))) - - return intlist - - def __parse_intlist(self, intlist): - """All the intlist data are parsed into swt and vt arrays. - - The vt array is prepared for hardware interrupt table. - Every entry in the selected position would contain None or the name of the function pointer - (address or string). - - The swt is a little more complex. At every position it would contain an array of parameter and - function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. - If empty array is placed on selected position - it means that the application does not implement - this interrupt. - - Parameters: - - intlist: The preprocessed list of intlist section content (see read_intlist) - - Return: - vt, swt - parsed vt and swt arrays (see function description above) - """ - nvec = intlist["num_vectors"] - offset = intlist["offset"] - - if nvec > pow(2, 15): - raise ValueError('nvec is too large, check endianness.') - - self.__log.debug('offset is ' + str(offset)) - self.__log.debug('num_vectors is ' + str(nvec)) - - # Set default entries in both tables - if not(self.__config.args.sw_isr_table or self.__config.args.vector_table): - self.__log.error("one or both of -s or -V needs to be specified on command line") - if self.__config.args.vector_table: - vt = [None for i in range(nvec)] - else: - vt = None - if self.__config.args.sw_isr_table: - swt = [[] for i in range(nvec)] - else: - swt = None - - # Process intlist and write to the tables created - for irq, flags, func, param in intlist["interrupts"]: - if not vt: - error("Direct Interrupt %d declared with parameter 0x%x " - "but no vector table in use" - % (irq, param)) - if self.__config.test_isr_direct(flags): - if param != 0: - self.__log.error("Direct irq %d declared, but has non-NULL parameter" - % irq) - if not 0 <= irq - offset < len(vt): - self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % - (irq - offset, offset, len(vt) - 1)) - vt[irq - offset] = func - else: - # Regular interrupt - if not swt: - self.__log.error("Regular Interrupt %d declared with parameter 0x%x " - "but no SW ISR_TABLE in use" - % (irq, param)) - - table_index = self.__config.get_swt_table_index(offset, irq) - - if not 0 <= table_index < len(swt): - self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % - (table_index, offset, len(swt) - 1)) - if self.__config.check_shared_interrupts(): - lst = swt[table_index] - if (param, func) in lst: - self.__log.error("Attempting to register the same ISR/arg pair twice.") - if len(lst) >= self.__config.get_sym("CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"): - self.__log.error(f"Reached shared interrupt client limit. Maybe increase" - + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") - else: - if len(swt[table_index]) > 0: - self.__log.error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" - + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" - + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" - ) - swt[table_index].append((param, func)) - - return vt, swt, nvec - - def __write_code_irq_vector_table(self, fp): - fp.write(self.source_assembly_header) - - fp.write("void __irq_vector_table __attribute__((naked)) _irq_vector_table(void) {\n") - for i in range(self.__nv): - func = self.__vt[i] - - if func is None: - func = self.__config.vt_default_handler - - if isinstance(func, int): - func_as_string = self.__config.get_sym_from_addr(func) - else: - func_as_string = func - - fp.write("\t__asm(ARCH_IRQ_VECTOR_JUMP_CODE({}));\n".format(func_as_string)) - fp.write("}\n") - - def __write_address_irq_vector_table(self, fp): - fp.write("uintptr_t __irq_vector_table _irq_vector_table[%d] = {\n" % self.__nv) - for i in range(self.__nv): - func = self.__vt[i] - - if func is None: - func = self.__config.vt_default_handler - - if isinstance(func, int): - fp.write("\t{},\n".format(func)) - else: - fp.write("\t((uintptr_t)&{}),\n".format(func)) - - fp.write("};\n") - - def __write_shared_table(self, fp): - fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" - " z_shared_sw_isr_table[%d] = {\n" % self.__nv) - - for i in range(self.__nv): - if self.__swt[i] is None: - client_num = 0 - client_list = None - else: - client_num = len(self.__swt[i]) - client_list = self.__swt[i] - - if client_num <= 1: - fp.write("\t{ },\n") - else: - fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") - for j in range(0, client_num): - routine = client_list[j][1] - arg = client_list[j][0] - - fp.write(f"{{ .isr = (ISR){ hex(routine) if isinstance(routine, int) else routine }, " - f".arg = (const void *){hex(arg)} }},") - - fp.write(" },\n},\n") - - fp.write("};\n") - - def write_source(self, fp): - fp.write(self.source_header) - - if self.__config.check_shared_interrupts(): - self.__write_shared_table(fp) - - if self.__vt: - if self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS"): - self.__write_address_irq_vector_table(fp) - elif self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE"): - self.__write_code_irq_vector_table(fp) - else: - self.__log.error("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set") - - if not self.__swt: - return - - fp.write("struct _isr_table_entry __sw_isr_table _sw_isr_table[%d] = {\n" - % self.__nv) - - level2_offset = self.__config.get_irq_baseoffset(2) - level3_offset = self.__config.get_irq_baseoffset(3) - - for i in range(self.__nv): - if len(self.__swt[i]) == 0: - # Not used interrupt - param = "0x0" - func = self.__config.swt_spurious_handler - elif len(self.__swt[i]) == 1: - # Single interrupt - param = "{0:#x}".format(self.__swt[i][0][0]) - func = self.__swt[i][0][1] - else: - # Shared interrupt - param = "&z_shared_sw_isr_table[{0}]".format(i) - func = self.__config.swt_shared_handler - - if isinstance(func, int): - func_as_string = "{0:#x}".format(func) - else: - func_as_string = func - - if level2_offset is not None and i == level2_offset: - fp.write("\t/* Level 2 interrupts start here (offset: {}) */\n". - format(level2_offset)) - if level3_offset is not None and i == level3_offset: - fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". - format(level3_offset)) - - fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) - fp.write("};\n") - - def get_symbols(obj): for section in obj.iter_sections(): if isinstance(section, SymbolTableSection): @@ -554,6 +286,12 @@ def parse_args(): help="Print additional debugging information") parser.add_argument("-o", "--output-source", required=True, help="Output source file") + parser.add_argument("-l", "--linker-output-files", + nargs=2, + metavar=("vector_table_link", "software_interrupt_link"), + help="Output linker files. " + "Used only if CONFIG_ISR_TABLES_LOCAL_DECLARATION is enabled. " + "In other case empty file would be generated.") parser.add_argument("-k", "--kernel", required=True, help="Zephyr kernel image") parser.add_argument("-s", "--sw-isr-table", action="store_true", @@ -576,11 +314,31 @@ def main(): config = gen_isr_config(args, get_symbols(kernel), log) intlist_data = read_intList_sect(kernel, config.get_intlist_snames()) - parser = gen_isr_parser(intlist_data, config, log) + if config.check_sym("CONFIG_ISR_TABLES_LOCAL_DECLARATION"): + sys.stdout.write( + "Warning: The EXPERIMENTAL ISR_TABLES_LOCAL_DECLARATION feature selected\n") + parser_module = importlib.import_module('gen_isr_tables_parser_local') + parser = parser_module.gen_isr_parser(intlist_data, config, log) + else: + parser_module = importlib.import_module('gen_isr_tables_parser_carrays') + parser = parser_module.gen_isr_parser(intlist_data, config, log) with open(args.output_source, "w") as fp: parser.write_source(fp) + if args.linker_output_files is not None: + with open(args.linker_output_files[0], "w") as fp_vt, \ + open(args.linker_output_files[1], "w") as fp_swi: + if hasattr(parser, 'write_linker_vt'): + parser.write_linker_vt(fp_vt) + else: + log.debug("Chosen parser does not support vector table linker file") + fp_vt.write('/* Empty */\n') + if hasattr(parser, 'write_linker_swi'): + parser.write_linker_swi(fp_swi) + else: + log.debug("Chosen parser does not support software interrupt linker file") + fp_swi.write('/* Empty */\n') if __name__ == "__main__": main() diff --git a/scripts/build/gen_isr_tables_parser_carrays.py b/scripts/build/gen_isr_tables_parser_carrays.py new file mode 100644 index 00000000000..e13ef19c1f8 --- /dev/null +++ b/scripts/build/gen_isr_tables_parser_carrays.py @@ -0,0 +1,292 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2017 Intel Corporation +# Copyright (c) 2018 Foundries.io +# Copyright (c) 2023 Nordic Semiconductor NA +# +# SPDX-License-Identifier: Apache-2.0 +# + +import struct + +class gen_isr_parser: + source_header = """ +/* AUTO-GENERATED by gen_isr_tables.py, do not edit! */ + +#include +#include +#include +#include + +typedef void (* ISR)(const void *); +""" + + source_assembly_header = """ +#ifndef ARCH_IRQ_VECTOR_JUMP_CODE +#error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" +#endif +""" + + def __init__(self, intlist_data, config, log): + """Initialize the parser. + + The function prepares parser to work. + Parameters: + - intlist_data: The binnary data from intlist section + - config: The configuration object + - log: The logging object, has to have error and debug methods + """ + self.__config = config + self.__log = log + intlist = self.__read_intlist(intlist_data) + self.__vt, self.__swt, self.__nv = self.__parse_intlist(intlist) + + def __read_intlist(self, intlist_data): + """read a binary file containing the contents of the kernel's .intList + section. This is an instance of a header created by + include/zephyr/linker/intlist.ld: + + struct { + uint32_t num_vectors; <- typically CONFIG_NUM_IRQS + struct _isr_list isrs[]; <- Usually of smaller size than num_vectors + } + + Followed by instances of struct _isr_list created by IRQ_CONNECT() + calls: + + struct _isr_list { + /** IRQ line number */ + int32_t irq; + /** Flags for this IRQ, see ISR_FLAG_* definitions */ + int32_t flags; + /** ISR to call */ + void *func; + /** Parameter for non-direct IRQs */ + const void *param; + }; + """ + intlist = {} + prefix = self.__config.endian_prefix() + + # Extract header and the rest of the data + intlist_header_fmt = prefix + "II" + header_sz = struct.calcsize(intlist_header_fmt) + header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) + self.__log.debug(str(header_raw)) + + intlist["num_vectors"] = header_raw[0] + intlist["offset"] = header_raw[1] + intdata = intlist_data[header_sz:] + + # Extract information about interrupts + if self.__config.check_64b(): + intlist_entry_fmt = prefix + "iiQQ" + else: + intlist_entry_fmt = prefix + "iiII" + + intlist["interrupts"] = [i for i in + struct.iter_unpack(intlist_entry_fmt, intdata)] + + self.__log.debug("Configured interrupt routing") + self.__log.debug("handler irq flags param") + self.__log.debug("--------------------------") + + for irq in intlist["interrupts"]: + self.__log.debug("{0:<10} {1:<3} {2:<3} {3}".format( + hex(irq[2]), irq[0], irq[1], hex(irq[3]))) + + return intlist + + def __parse_intlist(self, intlist): + """All the intlist data are parsed into swt and vt arrays. + + The vt array is prepared for hardware interrupt table. + Every entry in the selected position would contain None or the name of the function pointer + (address or string). + + The swt is a little more complex. At every position it would contain an array of parameter and + function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. + If empty array is placed on selected position - it means that the application does not implement + this interrupt. + + Parameters: + - intlist: The preprocessed list of intlist section content (see read_intlist) + + Return: + vt, swt - parsed vt and swt arrays (see function description above) + """ + nvec = intlist["num_vectors"] + offset = intlist["offset"] + + if nvec > pow(2, 15): + raise ValueError('nvec is too large, check endianness.') + + self.__log.debug('offset is ' + str(offset)) + self.__log.debug('num_vectors is ' + str(nvec)) + + # Set default entries in both tables + if not(self.__config.args.sw_isr_table or self.__config.args.vector_table): + self.__log.error("one or both of -s or -V needs to be specified on command line") + if self.__config.args.vector_table: + vt = [None for i in range(nvec)] + else: + vt = None + if self.__config.args.sw_isr_table: + swt = [[] for i in range(nvec)] + else: + swt = None + + # Process intlist and write to the tables created + for irq, flags, func, param in intlist["interrupts"]: + if self.__config.test_isr_direct(flags): + if not vt: + self.__log.error("Direct Interrupt %d declared with parameter 0x%x " + "but no vector table in use" + % (irq, param)) + if param != 0: + self.__log.error("Direct irq %d declared, but has non-NULL parameter" + % irq) + if not 0 <= irq - offset < len(vt): + self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" + % (irq - offset, offset, len(vt) - 1)) + vt[irq - offset] = func + else: + # Regular interrupt + if not swt: + self.__log.error("Regular Interrupt %d declared with parameter 0x%x " + "but no SW ISR_TABLE in use" + % (irq, param)) + + table_index = self.__config.get_swt_table_index(offset, irq) + + if not 0 <= table_index < len(swt): + self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % + (table_index, offset, len(swt) - 1)) + if self.__config.check_shared_interrupts(): + lst = swt[table_index] + if (param, func) in lst: + self.__log.error("Attempting to register the same ISR/arg pair twice.") + if len(lst) >= self.__config.get_sym("CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"): + self.__log.error(f"Reached shared interrupt client limit. Maybe increase" + + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") + else: + if len(swt[table_index]) > 0: + self.__log.error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" + + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" + + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" + ) + swt[table_index].append((param, func)) + + return vt, swt, nvec + + def __write_code_irq_vector_table(self, fp): + fp.write(self.source_assembly_header) + + fp.write("void __irq_vector_table __attribute__((naked)) _irq_vector_table(void) {\n") + for i in range(self.__nv): + func = self.__vt[i] + + if func is None: + func = self.__config.vt_default_handler + + if isinstance(func, int): + func_as_string = self.__config.get_sym_from_addr(func) + else: + func_as_string = func + + fp.write("\t__asm(ARCH_IRQ_VECTOR_JUMP_CODE({}));\n".format(func_as_string)) + fp.write("}\n") + + def __write_address_irq_vector_table(self, fp): + fp.write("uintptr_t __irq_vector_table _irq_vector_table[%d] = {\n" % self.__nv) + for i in range(self.__nv): + func = self.__vt[i] + + if func is None: + func = self.__config.vt_default_handler + + if isinstance(func, int): + fp.write("\t{},\n".format(func)) + else: + fp.write("\t((uintptr_t)&{}),\n".format(func)) + + fp.write("};\n") + + def __write_shared_table(self, fp): + fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" + " z_shared_sw_isr_table[%d] = {\n" % self.__nv) + + for i in range(self.__nv): + if self.__swt[i] is None: + client_num = 0 + client_list = None + else: + client_num = len(self.__swt[i]) + client_list = self.__swt[i] + + if client_num <= 1: + fp.write("\t{ },\n") + else: + fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") + for j in range(0, client_num): + routine = client_list[j][1] + arg = client_list[j][0] + + fp.write(f"{{ .isr = (ISR){ hex(routine) if isinstance(routine, int) else routine }, " + f".arg = (const void *){hex(arg)} }},") + + fp.write(" },\n},\n") + + fp.write("};\n") + + def write_source(self, fp): + fp.write(self.source_header) + + if self.__config.check_shared_interrupts(): + self.__write_shared_table(fp) + + if self.__vt: + if self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS"): + self.__write_address_irq_vector_table(fp) + elif self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE"): + self.__write_code_irq_vector_table(fp) + else: + self.__log.error("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set") + + if not self.__swt: + return + + fp.write("struct _isr_table_entry __sw_isr_table _sw_isr_table[%d] = {\n" + % self.__nv) + + level2_offset = self.__config.get_irq_baseoffset(2) + level3_offset = self.__config.get_irq_baseoffset(3) + + for i in range(self.__nv): + if len(self.__swt[i]) == 0: + # Not used interrupt + param = "0x0" + func = self.__config.swt_spurious_handler + elif len(self.__swt[i]) == 1: + # Single interrupt + param = "{0:#x}".format(self.__swt[i][0][0]) + func = self.__swt[i][0][1] + else: + # Shared interrupt + param = "&z_shared_sw_isr_table[{0}]".format(i) + func = self.__config.swt_shared_handler + + if isinstance(func, int): + func_as_string = "{0:#x}".format(func) + else: + func_as_string = func + + if level2_offset is not None and i == level2_offset: + fp.write("\t/* Level 2 interrupts start here (offset: {}) */\n". + format(level2_offset)) + if level3_offset is not None and i == level3_offset: + fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". + format(level3_offset)) + + fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) + fp.write("};\n") diff --git a/scripts/build/gen_isr_tables_parser_local.py b/scripts/build/gen_isr_tables_parser_local.py new file mode 100644 index 00000000000..91bd4a65471 --- /dev/null +++ b/scripts/build/gen_isr_tables_parser_local.py @@ -0,0 +1,375 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2017 Intel Corporation +# Copyright (c) 2018 Foundries.io +# Copyright (c) 2023 Nordic Semiconductor NA +# +# SPDX-License-Identifier: Apache-2.0 +# + +import struct + +class gen_isr_parser: + source_header = """ +/* AUTO-GENERATED by gen_isr_tables.py, do not edit! */ + +#include +#include +#include +#include + +""" + + shared_isr_table_header = """ + +/* For this parser to work, we have to be sure that shared interrupts table entry + * and the normal isr table entry have exactly the same layout + */ +BUILD_ASSERT(sizeof(struct _isr_table_entry) + == + sizeof(struct z_shared_isr_table_entry), + "Shared ISR and ISR table entries layout do not match"); +BUILD_ASSERT(offsetof(struct _isr_table_entry, arg) + == + offsetof(struct z_shared_isr_table_entry, arg), + "Shared ISR and ISR table entries layout do not match"); +BUILD_ASSERT(offsetof(struct _isr_table_entry, isr) + == + offsetof(struct z_shared_isr_table_entry, isr), + "Shared ISR and ISR table entries layout do not match"); + +""" + + def __init__(self, intlist_data, config, log): + """Initialize the parser. + + The function prepares parser to work. + Parameters: + - intlist_data: The binnary data from intlist section + - config: The configuration object + - log: The logging object, has to have error and debug methods + """ + self.__config = config + self.__log = log + intlist = self.__read_intlist(intlist_data) + self.__vt, self.__swt, self.__nv, header = self.__parse_intlist(intlist) + self.__swi_table_entry_size = header["swi_table_entry_size"] + self.__shared_isr_table_entry_size = header["shared_isr_table_entry_size"] + self.__shared_isr_client_num_offset = header["shared_isr_client_num_offset"] + + def __read_intlist(self, intlist_data): + """read an intList section from the elf file. + This is version 2 of a header created by include/zephyr/linker/intlist.ld: + + struct { + uint32_t num_vectors; <- typically CONFIG_NUM_IRQS + uint8_t stream[]; <- the stream with the interrupt data + }; + + The stream is contained from variable length records in a form: + + struct _isr_list_sname { + /** IRQ line number */ + int32_t irq; + /** Flags for this IRQ, see ISR_FLAG_* definitions */ + int32_t flags; + /** The section name */ + const char sname[]; + }; + + The flexible array member here (sname) contains the name of the section where the structure + with interrupt data is located. + It is always Null-terminated string thus we have to search through the input data for the + structure end. + + """ + intlist = {} + prefix = self.__config.endian_prefix() + + # Extract header and the rest of the data + intlist_header_fmt = prefix + "IIIII" + header_sz = struct.calcsize(intlist_header_fmt) + header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) + self.__log.debug(str(header_raw)) + + intlist["num_vectors"] = header_raw[0] + intlist["offset"] = header_raw[1] + intlist["swi_table_entry_size"] = header_raw[2] + intlist["shared_isr_table_entry_size"] = header_raw[3] + intlist["shared_isr_client_num_offset"] = header_raw[4] + + intdata = intlist_data[header_sz:] + + # Extract information about interrupts + intlist_entry_fmt = prefix + "ii" + entry_sz = struct.calcsize(intlist_entry_fmt) + intlist["interrupts"] = [] + + while len(intdata) > entry_sz: + entry_raw = struct.unpack_from(intlist_entry_fmt, intdata, 0) + intdata = intdata[entry_sz:] + null_idx = intdata.find(0) + if null_idx < 0: + self.__log.error("Cannot find sname null termination at IRQ{}".format(entry_raw[0])) + bname = intdata[:null_idx] + # Next structure starts with 4B alignment + next_idx = null_idx + 1 + next_idx = (next_idx + 3) & ~3 + intdata = intdata[next_idx:] + sname = bname.decode() + intlist["interrupts"].append([entry_raw[0], entry_raw[1], sname]) + self.__log.debug("Unpacked IRQ{}, flags: {}, sname: \"{}\"\n".format( + entry_raw[0], entry_raw[1], sname)) + + # If any data left at the end - it has to be all the way 0 - this is just a check + if (len(intdata) and not all([d == 0 for d in intdata])): + self.__log.error("Non-zero data found at the end of the intList data.\n") + + self.__log.debug("Configured interrupt routing with linker") + self.__log.debug("irq flags sname") + self.__log.debug("--------------------------") + + for irq in intlist["interrupts"]: + self.__log.debug("{0:<3} {1:<5} {2}".format( + hex(irq[0]), irq[1], irq[2])) + + return intlist + + def __parse_intlist(self, intlist): + """All the intlist data are parsed into swt and vt arrays. + + The vt array is prepared for hardware interrupt table. + Every entry in the selected position would contain None or the name of the function pointer + (address or string). + + The swt is a little more complex. At every position it would contain an array of parameter and + function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. + If empty array is placed on selected position - it means that the application does not implement + this interrupt. + + Parameters: + - intlist: The preprocessed list of intlist section content (see read_intlist) + + Return: + vt, swt - parsed vt and swt arrays (see function description above) + """ + nvec = intlist["num_vectors"] + offset = intlist["offset"] + header = { + "swi_table_entry_size": intlist["swi_table_entry_size"], + "shared_isr_table_entry_size": intlist["shared_isr_table_entry_size"], + "shared_isr_client_num_offset": intlist["shared_isr_client_num_offset"] + } + + if nvec > pow(2, 15): + raise ValueError('nvec is too large, check endianness.') + + self.__log.debug('offset is ' + str(offset)) + self.__log.debug('num_vectors is ' + str(nvec)) + + # Set default entries in both tables + if not(self.__config.args.sw_isr_table or self.__config.args.vector_table): + self.__log.error("one or both of -s or -V needs to be specified on command line") + if self.__config.args.vector_table: + vt = [None for i in range(nvec)] + else: + vt = None + if self.__config.args.sw_isr_table: + swt = [[] for i in range(nvec)] + else: + swt = None + + # Process intlist and write to the tables created + for irq, flags, sname in intlist["interrupts"]: + if self.__config.test_isr_direct(flags): + if not 0 <= irq - offset < len(vt): + self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % + (irq - offset, offset, len(vt) - 1)) + vt[irq - offset] = sname + else: + # Regular interrupt + if not swt: + self.__log.error("Regular Interrupt %d declared with section name %s " + "but no SW ISR_TABLE in use" + % (irq, sname)) + + table_index = self.__config.get_swt_table_index(offset, irq) + + if not 0 <= table_index < len(swt): + self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % + (table_index, offset, len(swt) - 1)) + # Check if the given section name does not repeat outside of current interrupt + for i in range(nvec): + if i == irq: + continue + if sname in swt[i]: + self.__log.error(("Attempting to register the same section name \"{}\"for" + + "different interrupts: {} and {}").format(sname, i, irq)) + if self.__config.check_shared_interrupts(): + lst = swt[table_index] + if len(lst) >= self.__config.get_sym("CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"): + self.__log.error(f"Reached shared interrupt client limit. Maybe increase" + + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") + else: + if len(swt[table_index]) > 0: + self.__log.error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" + + f"\nExisting section {swt[table_index]}, new section {sname}" + + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" + ) + swt[table_index].append(sname) + + return vt, swt, nvec, header + + @staticmethod + def __irq_spurious_section(irq): + return '.irq_spurious.0x{:x}'.format(irq) + + @staticmethod + def __isr_generated_section(irq): + return '.isr_generated.0x{:x}'.format(irq) + + @staticmethod + def __shared_entry_section(irq, ent): + return '.isr_shared.0x{:x}_0x{:x}'.format(irq, ent) + + @staticmethod + def __shared_client_num_section(irq): + return '.isr_shared.0x{:x}_client_num'.format(irq) + + def __isr_spurious_entry(self, irq): + return '_Z_ISR_TABLE_ENTRY({irq}, {func}, NULL, "{sect}");'.format( + irq = irq, + func = self.__config.swt_spurious_handler, + sect = self.__isr_generated_section(irq) + ) + + def __isr_shared_entry(self, irq): + return '_Z_ISR_TABLE_ENTRY({irq}, {func}, {arg}, "{sect}");'.format( + irq = irq, + arg = '&{}[{}]'.format(self.__config.shared_array_name, irq), + func = self.__config.swt_shared_handler, + sect = self.__isr_generated_section(irq) + ) + + def __irq_spurious_entry(self, irq): + return '_Z_ISR_DIRECT_TABLE_ENTRY({irq}, {func}, "{sect}");'.format( + irq = irq, + func = self.__config.vt_default_handler, + sect = self.__irq_spurious_section(irq) + ) + + def __write_isr_handlers(self, fp): + for i in range(self.__nv): + if len(self.__swt[i]) <= 0: + fp.write(self.__isr_spurious_entry(i) + '\n') + elif len(self.__swt[i]) > 1: + # Connect to shared handlers + fp.write(self.__isr_shared_entry(i) + '\n') + else: + fp.write('/* ISR: {} implemented in app in "{}" section. */\n'.format( + i, self.__swt[i][0])) + + def __write_irq_handlers(self, fp): + for i in range(self.__nv): + if self.__vt[i] is None: + fp.write(self.__irq_spurious_entry(i) + '\n') + else: + fp.write('/* ISR: {} implemented in app. */\n'.format(i)) + + def __write_shared_handlers(self, fp): + fp.write("extern struct z_shared_isr_table_entry " + "{}[{}];\n".format(self.__config.shared_array_name, self.__nv)) + + shared_cnt = self.__config.get_sym('CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS') + for i in range(self.__nv): + swt_len = len(self.__swt[i]) + for j in range(shared_cnt): + if (swt_len <= 1) or (swt_len <= j): + # Add all unused entry + fp.write('static Z_DECL_ALIGN(struct _isr_table_entry)\n' + + '\tZ_GENERIC_SECTION({})\n'.format(self.__shared_entry_section(i, j)) + + '\t__used isr_shared_empty_entry_0x{:x}_0x{:x} = {{\n'.format(i, j) + + '\t\t.arg = (const void *)NULL,\n' + + '\t\t.isr = (void (*)(const void *))(void *)0\n' + + '};\n' + ) + else: + # Add information about entry implemented by application + fp.write('/* Shared isr {} entry {} implemented in "{}" section*/\n'.format( + i, j, self.__swt[i][j])) + + # Add information about clients count + fp.write(('static size_t Z_GENERIC_SECTION({}) __used\n' + + 'isr_shared_client_num_0x{:x} = {};\n\n').format( + self.__shared_client_num_section(i), + i, + 0 if swt_len < 2 else swt_len) + ) + + def write_source(self, fp): + fp.write(self.source_header) + + if self.__vt: + self.__write_irq_handlers(fp) + + if not self.__swt: + return + + if self.__config.check_shared_interrupts(): + self.__write_shared_handlers(fp) + + self.__write_isr_handlers(fp) + + def __write_linker_irq(self, fp): + fp.write('{} = .;\n'.format(self.__config.irq_vector_array_name)) + for i in range(self.__nv): + if self.__vt[i] is None: + sname = self.__irq_spurious_section(i) + else: + sname = self.__vt[i] + fp.write('KEEP(*("{}"))\n'.format(sname)) + + def __write_linker_shared(self, fp): + fp.write(". = ALIGN({});\n".format(self.__shared_isr_table_entry_size)) + fp.write('{} = .;\n'.format(self.__config.shared_array_name)) + shared_cnt = self.__config.get_sym('CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS') + client_num_pads = self.__shared_isr_client_num_offset - \ + shared_cnt * self.__swi_table_entry_size + if client_num_pads < 0: + self.__log.error("Invalid __shared_isr_client_num_offset header value") + for i in range(self.__nv): + swt_len = len(self.__swt[i]) + # Add all entries + for j in range(shared_cnt): + if (swt_len <= 1) or (swt_len <= j): + fp.write('KEEP(*("{}"))\n'.format(self.__shared_entry_section(i, j))) + else: + sname = self.__swt[i][j] + if (j != 0) and (sname in self.__swt[i][0:j]): + fp.write('/* Repetition of "{}" section */\n'.format(sname)) + else: + fp.write('KEEP(*("{}"))\n'.format(sname)) + fp.write('. = . + {};\n'.format(client_num_pads)) + fp.write('KEEP(*("{}"))\n'.format(self.__shared_client_num_section(i))) + fp.write(". = ALIGN({});\n".format(self.__shared_isr_table_entry_size)) + + def __write_linker_isr(self, fp): + fp.write(". = ALIGN({});\n".format(self.__swi_table_entry_size)) + fp.write('{} = .;\n'.format(self.__config.sw_isr_array_name)) + for i in range(self.__nv): + if (len(self.__swt[i])) == 1: + sname = self.__swt[i][0] + else: + sname = self.__isr_generated_section(i) + fp.write('KEEP(*("{}"))\n'.format(sname)) + + def write_linker_vt(self, fp): + if self.__vt: + self.__write_linker_irq(fp) + + def write_linker_swi(self, fp): + if self.__swt: + self.__write_linker_isr(fp) + + if self.__config.check_shared_interrupts(): + self.__write_linker_shared(fp) From bc839026a8eeee96ee311fc6278860a6d94bc2da Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Tue, 17 Oct 2023 17:41:17 +0200 Subject: [PATCH 0571/2300] [nrf fromtree] arch: sw_isr_table: Implement local interrupt table entry creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit implements the possibility to locally create an interrupt table entry. This changes the way interrput table is created, now it should not be created as an source file but rather it would be constructed by the linker. Signed-off-by: Radosław Koppel (cherry picked from commit 13638a03519db634c519a6511b9719f6d6f6b674) (cherry picked from commit 47a5ad2d459a021d02ead1ab2a694dd401dbbd06) --- arch/Kconfig | 23 +++++++ include/zephyr/sw_isr_table.h | 114 ++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index 5e3b96f414d..5c0ad5f49d9 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -391,6 +391,29 @@ config NOCACHE_MEMORY menu "Interrupt Configuration" +config ISR_TABLES_LOCAL_DECLARATION_SUPPORTED + bool + default y + # Userspace is currently not supported + depends on !USERSPACE + # List of currently supported architectures + depends on ARM || ARM64 + # List of currently supported toolchains + depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr" || "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "gnuarmemb" + +config ISR_TABLES_LOCAL_DECLARATION + bool "ISR tables created locally and placed by linker [EXPERIMENTAL]" + depends on ISR_TABLES_LOCAL_DECLARATION_SUPPORTED + select EXPERIMENTAL + help + Enable new scheme of interrupt tables generation. + This is totally different generator that would create tables entries locally + where the IRQ_CONNECT macro is called and then use the linker script to position it + in the right place in memory. + The most important advantage of such approach is that the generated interrupt tables + are LTO compatible. + The drawback is that the support on the architecture port is required. + config DYNAMIC_INTERRUPTS bool "Installation of IRQs at runtime" help diff --git a/include/zephyr/sw_isr_table.h b/include/zephyr/sw_isr_table.h index fc094b887ba..7b1bfddb2cb 100644 --- a/include/zephyr/sw_isr_table.h +++ b/include/zephyr/sw_isr_table.h @@ -18,6 +18,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -56,6 +57,9 @@ struct _irq_parent_entry { * uses it to create the IRQ vector table and the _sw_isr_table. * * More discussion in include/linker/intlist.ld + * + * This is a version used when CONFIG_ISR_TABLES_LOCAL_DECLARATION is disabled. + * See _isr_list_sname used otherwise. */ struct _isr_list { /** IRQ line number */ @@ -68,6 +72,24 @@ struct _isr_list { const void *param; }; +/* + * Data structure created in a special binary .intlist section for each + * configured interrupt. gen_isr_tables.py pulls this out of the binary and + * uses it to create linker script chunks that would place interrupt table entries + * in the right place in the memory. + * + * This is a version used when CONFIG_ISR_TABLES_LOCAL_DECLARATION is enabled. + * See _isr_list used otherwise. + */ +struct _isr_list_sname { + /** IRQ line number */ + int32_t irq; + /** Flags for this IRQ, see ISR_FLAG_* definitions */ + int32_t flags; + /** The section name */ + const char sname[]; +}; + #ifdef CONFIG_SHARED_INTERRUPTS struct z_shared_isr_table_entry { struct _isr_table_entry clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; @@ -85,6 +107,90 @@ extern struct z_shared_isr_table_entry z_shared_sw_isr_table[]; #define _MK_ISR_NAME(x, y) __MK_ISR_NAME(x, y) #define __MK_ISR_NAME(x, y) __isr_ ## x ## _irq_ ## y + +#if IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) + +#define _MK_ISR_ELEMENT_NAME(func, id) __MK_ISR_ELEMENT_NAME(func, id) +#define __MK_ISR_ELEMENT_NAME(func, id) __isr_table_entry_ ## func ## _irq_ ## id + +#define _MK_IRQ_ELEMENT_NAME(func, id) __MK_ISR_ELEMENT_NAME(func, id) +#define __MK_IRQ_ELEMENT_NAME(func, id) __irq_table_entry_ ## func ## _irq_ ## id + +#define _MK_ISR_SECTION_NAME(prefix, file, counter) \ + "." Z_STRINGIFY(prefix)"."file"." Z_STRINGIFY(counter) + +#define _MK_ISR_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(irq, __FILE__, counter) +#define _MK_IRQ_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(isr, __FILE__, counter) + +/* Separated macro to create ISR table entry only. + * Used by Z_ISR_DECLARE and ISR tables generation script. + */ +#define _Z_ISR_TABLE_ENTRY(irq, func, param, sect) \ + static Z_DECL_ALIGN(struct _isr_table_entry) \ + __attribute__((section(sect))) \ + __used _MK_ISR_ELEMENT_NAME(func, __COUNTER__) = { \ + .arg = (const void *)(param), \ + .isr = (void (*)(const void *))(void *)(func) \ + } + +#define Z_ISR_DECLARE_C(irq, flags, func, param, counter) \ + _Z_ISR_DECLARE_C(irq, flags, func, param, counter) + +#define _Z_ISR_DECLARE_C(irq, flags, func, param, counter) \ + _Z_ISR_TABLE_ENTRY(irq, func, param, _MK_ISR_ELEMENT_SECTION(counter)); \ + static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \ + __used _MK_ISR_NAME(func, counter) = \ + {irq, flags, _MK_ISR_ELEMENT_SECTION(counter)} + +/* Create an entry for _isr_table to be then placed by the linker. + * An instance of struct _isr_list which gets put in the .intList + * section is created with the name of the section where _isr_table entry is placed to be then + * used by isr generation script to create linker script chunk. + */ +#define Z_ISR_DECLARE(irq, flags, func, param) \ + BUILD_ASSERT(((flags) & ISR_FLAG_DIRECT) == 0, "Use Z_ISR_DECLARE_DIRECT macro"); \ + Z_ISR_DECLARE_C(irq, flags, func, param, __COUNTER__) + + +/* Separated macro to create ISR Direct table entry only. + * Used by Z_ISR_DECLARE_DIRECT and ISR tables generation script. + */ +#define _Z_ISR_DIRECT_TABLE_ENTRY(irq, func, sect) \ + COND_CODE_1(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS, ( \ + static Z_DECL_ALIGN(uintptr_t) \ + __attribute__((section(sect))) \ + __used _MK_IRQ_ELEMENT_NAME(func, __COUNTER__) = ((uintptr_t)(func)); \ + ), ( \ + static void __attribute__((section(sect))) __attribute__((naked)) \ + __used _MK_IRQ_ELEMENT_NAME(func, __COUNTER__)(void) { \ + __asm(ARCH_IRQ_VECTOR_JUMP_CODE(func)); \ + } \ + )) + +#define Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) \ + _Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) + +#define _Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) \ + _Z_ISR_DIRECT_TABLE_ENTRY(irq, func, _MK_IRQ_ELEMENT_SECTION(counter)); \ + static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \ + __used _MK_ISR_NAME(func, counter) = { \ + irq, \ + ISR_FLAG_DIRECT | (flags), \ + _MK_IRQ_ELEMENT_SECTION(counter)} + +/* Create an entry to irq table and place it in specific section which name is then placed + * in an instance of struct _isr_list to be then used by the isr generation script to create + * the linker script chunks. + */ +#define Z_ISR_DECLARE_DIRECT(irq, flags, func) \ + BUILD_ASSERT(IS_ENABLED(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS) || \ + IS_ENABLED(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE), \ + "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set"); \ + Z_ISR_DECLARE_DIRECT_C(irq, flags, func, __COUNTER__) + + +#else /* IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) */ + /* Create an instance of struct _isr_list which gets put in the .intList * section. This gets consumed by gen_isr_tables.py which creates the vector * and/or SW ISR tables. @@ -94,6 +200,14 @@ extern struct z_shared_isr_table_entry z_shared_sw_isr_table[]; __used _MK_ISR_NAME(func, __COUNTER__) = \ {irq, flags, (void *)&func, (const void *)param} +/* The version of the Z_ISR_DECLARE that should be used for direct ISR declaration. + * It is here for the API match the version with CONFIG_ISR_TABLES_LOCAL_DECLARATION enabled. + */ +#define Z_ISR_DECLARE_DIRECT(irq, flags, func) \ + Z_ISR_DECLARE(irq, ISR_FLAG_DIRECT | (flags), func, NULL) + +#endif + #define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR) #ifdef CONFIG_DYNAMIC_INTERRUPTS From 8d2e8b57a06bad6e49ff2245216f264e780544c3 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Thu, 1 Feb 2024 16:34:55 +0100 Subject: [PATCH 0572/2300] [nrf fromtree] doc: kernel: interrupts: Description of the local isr declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a documentation about the new parser of the interrupt vectors tables that is using linker to construct the arrays with all the runtime required data. Signed-off-by: Radosław Koppel (cherry picked from commit 19bb21ef6d95a850f598822c7d4a872f8f127a9a) (cherry picked from commit f63cccafdc4d3fee81dc80a5f088e90a20f083db) --- doc/kernel/services/interrupts.rst | 120 ++++++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 3 deletions(-) diff --git a/doc/kernel/services/interrupts.rst b/doc/kernel/services/interrupts.rst index 44f0805edb0..7af101a40d1 100644 --- a/doc/kernel/services/interrupts.rst +++ b/doc/kernel/services/interrupts.rst @@ -457,6 +457,38 @@ Interrupt tables are set up at build time using some special build tools. The details laid out here apply to all architectures except x86, which are covered in the `x86 Details`_ section below. +The invocation of :c:macro:`IRQ_CONNECT` will declare an instance of +struct _isr_list wich is placed in a special .intList section. +This section is placed in compiled code on precompilation stages only. +It is meant to be used by Zephyr script to generate interrupt tables +and is removed from the final build. +The script implements different parsers to process the data from .intList section +and produce the required output. + +The default parser generates C arrays filled with arguments and interrupt +handlers in a form of addresses directly taken from .intList section entries. +It works with all the architectures and compillers (with the exception mentioned above). +The limitation of this parser is the fact that after the arrays are generated +it is expected for the code not to relocate. +Any relocation on this stage may lead to the situation where the entry in the interrupt array +is no longer pointing to the function that was expected. +It means that this parser, being more compatible is limiting us from using Link Time Optimization. + +The local isr declaration parser uses different approach to construct +the same arrays at binnary level. +All the entries to the arrays are declared and defined locally, +directly in the file where :c:macro:`IRQ_CONNECT` is used. +They are placed in a section with the unique, synthetized name. +The name of the section is then placed in .intList section and it is used to create linker script +to properly place the created entry in the right place in the memory. +This parser is now limited to the supported architectures and toolchains but in reward it keeps +the information about object relations for linker thus allowing the Link Time Optimization. + +Implementation using C arrays +----------------------------- + +This is the default configuration available for all Zephyr supported architectures. + Any invocation of :c:macro:`IRQ_CONNECT` will declare an instance of struct _isr_list which is placed in a special .intList section: @@ -500,7 +532,7 @@ do not support the notion of interrupt priority, in which case the priority argument is ignored. Vector Table ------------- +~~~~~~~~~~~~ A vector table is generated when :kconfig:option:`CONFIG_GEN_IRQ_VECTOR_TABLE` is enabled. This data structure is used natively by the CPU and is simply an array of function pointers, where each element n corresponds to the IRQ handler @@ -527,7 +559,7 @@ CONFIG_GEN_IRQ_START_VECTOR needs to be set to properly offset the indices in the table. SW ISR Table ------------- +~~~~~~~~~~~~ This is an array of struct _isr_table_entry: .. code-block:: c @@ -542,7 +574,7 @@ argument and execute it. The active IRQ line is looked up in an interrupt controller register and used to index this table. Shared SW ISR Table -------------------- +~~~~~~~~~~~~~~~~~~~ This is an array of struct z_shared_isr_table_entry: @@ -558,6 +590,88 @@ lines. Whenever an interrupt line becomes shared, c:func:`z_shared_isr` will replace the currently registered ISR in _sw_isr_table. This special ISR will iterate through the list of registered clients and invoke the ISRs. +Implementation using linker script +---------------------------------- + +This way of prepare and parse .isrList section to implement interrupt vectors arrays +is called local isr declaration. +The name comes from the fact that all the entries to the arrays that would create +interrupt vectors are created locally in place of invocation of :c:macro:`IRQ_CONNECT` macro. +Then automatically generated linker scripts are used to place it in the right place in the memory. + +This option requires enabling by the choose of :kconfig:option:`ISR_TABLES_LOCAL_DECLARATION`. +If this configuration is supported by the used architecture and toolchaing the +:kconfig:option:`ISR_TABLES_LOCAL_DECLARATION_SUPPORTED` is set. +See defails of this option for the information about currently supported configurations. + +Any invocation of :c:macro:`IRQ_CONNECT` or `IRQ_DIRECT_CONNECT` will declare an instance of struct +_isr_list_sname which is placde in a special .intList section: + +.. code-block:: c + + struct _isr_list_sname { + /** IRQ line number */ + int32_t irq; + /** Flags for this IRQ, see ISR_FLAG_* definitions */ + int32_t flags; + /** The section name */ + const char sname[]; + }; + +Note that the section name is placed in flexible array member. +It means that the size of the initialized structure will warry depending on the +structure name length. +The whole entry is used by the script during the build of the application +and has all the information needed for proper interrupt placement. + +Beside of the _isr_list_sname the :c:macro:`IRQ_CONNECT` macro generates an entry +that would be the part of the interrupt array: + +.. code-block:: c + + struct _isr_table_entry { + const void *arg; + void (*isr)(const void *); + }; + +This array is placed in a section with the name saved in _isr_list_sname structure. + +The values created by :c:macro:`IRQ_DIRECT_CONNECT` macro depends on the architecture. +It can be changed to variable that points to a interrupt handler: + +.. code-block:: c + + static uintptr_t = ((uintptr_t)func); + +Or to actuall naked function that implements a jump to the interrupt handler: + +.. code-block:: c + + static void (void) + { + __asm(ARCH_IRQ_VECTOR_JUMP_CODE(func)); + } + +Simillar like for :c:macro:`IRQ_CONNECT`, the created variable or function is placed +in a section, saved in _isr_list_sname section. + +Files generated by the script +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The interrupt tables generator script creates 3 files: +isr_tables.c, isr_tables_swi.ld, and isr_tables_vt.ld. + +The isr_tables.c will contain all the structures for interrupts, direct interrupts and +shared interrupts (if enabled). This file implements only all the structures that +are not implemented by the application, leaving a comment where the interrupt +not implemented here can be found. + +Then two linker files are used. The isr_tables_vt.ld file is included in place +where the interrupt vectors are required to be placed in the selected architecture. +The isr_tables_swi.ld file describes the placement of the software interrupt table +elements. The separated file is required as it might be placed in writable on nonwritable +section, depending on the current configuration. + x86 Details ----------- From 89f5e4bee9a5f13cabc58371cc466ec08091a867 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Fri, 22 Dec 2023 14:44:15 +0100 Subject: [PATCH 0573/2300] [nrf fromtree] arch: irq: Use Z_ISR_DECLARE_DIRECT for direct ISR declaration. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit changes the way how ARCH_IRQ_DIRECT_CONNECT is defined. Now it uses Z_ISR_DECLARE_DIRECT internally. That is a requirement for local isr declaration. Signed-off-by: Radosław Koppel (cherry picked from commit 8174c7e049414747ad9077a6da5c608ad0ef61c6) (cherry picked from commit d700c2ed505fb92826e3447266db0210ccbb4718) --- include/zephyr/arch/arc/v2/irq.h | 2 +- include/zephyr/arch/arm/irq.h | 2 +- include/zephyr/arch/riscv/irq.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/zephyr/arch/arc/v2/irq.h b/include/zephyr/arch/arc/v2/irq.h index e0b42549597..45b9d138857 100644 --- a/include/zephyr/arch/arc/v2/irq.h +++ b/include/zephyr/arch/arc/v2/irq.h @@ -77,7 +77,7 @@ extern void z_irq_priority_set(unsigned int irq, unsigned int prio, */ #define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \ { \ - Z_ISR_DECLARE(irq_p, ISR_FLAG_DIRECT, isr_p, NULL); \ + Z_ISR_DECLARE_DIRECT(irq_p, ISR_FLAG_DIRECT, isr_p); \ BUILD_ASSERT(priority_p || !IS_ENABLED(CONFIG_ARC_FIRQ) || \ (IS_ENABLED(CONFIG_ARC_FIRQ_STACK) && \ !IS_ENABLED(CONFIG_ARC_STACK_CHECKING)), \ diff --git a/include/zephyr/arch/arm/irq.h b/include/zephyr/arch/arm/irq.h index 357c91a83ae..143b8e54179 100644 --- a/include/zephyr/arch/arm/irq.h +++ b/include/zephyr/arch/arm/irq.h @@ -127,7 +127,7 @@ extern void z_arm_interrupt_init(void); BUILD_ASSERT(IS_ENABLED(CONFIG_ZERO_LATENCY_IRQS) || !(flags_p & IRQ_ZERO_LATENCY), \ "ZLI interrupt registered but feature is disabled"); \ _CHECK_PRIO(priority_p, flags_p) \ - Z_ISR_DECLARE(irq_p, ISR_FLAG_DIRECT, isr_p, NULL); \ + Z_ISR_DECLARE_DIRECT(irq_p, ISR_FLAG_DIRECT, isr_p); \ z_arm_irq_priority_set(irq_p, priority_p, flags_p); \ } diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index fa4b3989f05..d067ccfca23 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -69,8 +69,8 @@ extern void z_riscv_irq_priority_set(unsigned int irq, #define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \ { \ - Z_ISR_DECLARE(irq_p + CONFIG_RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET, \ - ISR_FLAG_DIRECT, isr_p, NULL); \ + Z_ISR_DECLARE_DIRECT(irq_p + CONFIG_RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET, \ + ISR_FLAG_DIRECT, isr_p); \ } #define ARCH_ISR_DIRECT_HEADER() arch_isr_direct_header() From 7dfe1310ee332d9ab1c54590b47c0a6f92504c5f Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Tue, 19 Dec 2023 16:54:18 +0100 Subject: [PATCH 0574/2300] [nrf fromtree] arch: arm: Update to support local ISR declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates the arm and arm64 architecture files to support the new ISR handlers creation parser. Signed-off-by: Radosław Koppel (cherry picked from commit 1ff24b34ebe568a5d606928af69914de946b9762) (cherry picked from commit 7c7b018f5a65c10f6184eeee1115ed59c2829108) --- arch/arm/core/CMakeLists.txt | 8 ++++++++ arch/arm/core/swi_tables.ld | 8 ++++++++ arch/arm/core/vector_table.ld | 4 ++++ arch/arm64/core/CMakeLists.txt | 8 ++++++++ arch/arm64/core/swi_tables.ld | 8 ++++++++ arch/common/CMakeLists.txt | 5 +++++ include/zephyr/arch/arm64/scripts/linker.ld | 5 ++++- include/zephyr/linker/irq-vector-table-section.ld | 2 ++ include/zephyr/linker/isr-local-drop-unused.ld | 9 +++++++++ 9 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 arch/arm/core/swi_tables.ld create mode 100644 arch/arm64/core/swi_tables.ld create mode 100644 include/zephyr/linker/isr-local-drop-unused.ld diff --git a/arch/arm/core/CMakeLists.txt b/arch/arm/core/CMakeLists.txt index 1b4fa58eae5..680e21fdb59 100644 --- a/arch/arm/core/CMakeLists.txt +++ b/arch/arm/core/CMakeLists.txt @@ -34,3 +34,11 @@ else() zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors vector_table.ld) zephyr_linker_sources(ROM_START SORT_KEY 0x1vectors cortex_m/vector_table_pad.ld) endif() + +if(CONFIG_GEN_SW_ISR_TABLE) + if(CONFIG_DYNAMIC_INTERRUPTS) + zephyr_linker_sources(RWDATA swi_tables.ld) + else() + zephyr_linker_sources(RODATA swi_tables.ld) + endif() +endif() diff --git a/arch/arm/core/swi_tables.ld b/arch/arm/core/swi_tables.ld new file mode 100644 index 00000000000..c6ca94604dd --- /dev/null +++ b/arch/arm/core/swi_tables.ld @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#if LINKER_ZEPHYR_FINAL +INCLUDE zephyr/isr_tables_swi.ld +#endif diff --git a/arch/arm/core/vector_table.ld b/arch/arm/core/vector_table.ld index 615067dbf74..58210afdcbc 100644 --- a/arch/arm/core/vector_table.ld +++ b/arch/arm/core/vector_table.ld @@ -51,6 +51,10 @@ _vector_start = .; KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) +#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION +INCLUDE zephyr/isr_tables_vt.ld +#else KEEP(*(.vectors)) +#endif _vector_end = .; diff --git a/arch/arm64/core/CMakeLists.txt b/arch/arm64/core/CMakeLists.txt index 1804556c1a7..05e4be8c0ea 100644 --- a/arch/arm64/core/CMakeLists.txt +++ b/arch/arm64/core/CMakeLists.txt @@ -55,3 +55,11 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU") endif() add_subdirectory_ifdef(CONFIG_XEN xen) + +if(CONFIG_GEN_SW_ISR_TABLE) + if(CONFIG_DYNAMIC_INTERRUPTS) + zephyr_linker_sources(RWDATA swi_tables.ld) + else() + zephyr_linker_sources(RODATA swi_tables.ld) + endif() +endif() diff --git a/arch/arm64/core/swi_tables.ld b/arch/arm64/core/swi_tables.ld new file mode 100644 index 00000000000..c6ca94604dd --- /dev/null +++ b/arch/arm64/core/swi_tables.ld @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#if LINKER_ZEPHYR_FINAL +INCLUDE zephyr/isr_tables_swi.ld +#endif diff --git a/arch/common/CMakeLists.txt b/arch/common/CMakeLists.txt index 1a89ba9c13a..409c378f620 100644 --- a/arch/common/CMakeLists.txt +++ b/arch/common/CMakeLists.txt @@ -39,6 +39,11 @@ zephyr_linker_sources_ifdef(CONFIG_GEN_ISR_TABLES ${ZEPHYR_BASE}/include/zephyr/linker/intlist.ld ) +zephyr_linker_sources_ifdef(CONFIG_ISR_TABLES_LOCAL_DECLARATION + SECTIONS + ${ZEPHYR_BASE}/include/zephyr/linker/isr-local-drop-unused.ld +) + zephyr_linker_sources_ifdef(CONFIG_GEN_IRQ_VECTOR_TABLE ROM_START SORT_KEY 0x0vectors diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index fa08b730304..d2a0d32d581 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -105,8 +105,11 @@ SECTIONS KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) +#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION + INCLUDE zephyr/isr_tables_vt.ld +#else KEEP(*(.vectors)) - +#endif _vector_end = .; *(.text) diff --git a/include/zephyr/linker/irq-vector-table-section.ld b/include/zephyr/linker/irq-vector-table-section.ld index 17c483db98f..141eee4d28d 100644 --- a/include/zephyr/linker/irq-vector-table-section.ld +++ b/include/zephyr/linker/irq-vector-table-section.ld @@ -1,7 +1,9 @@ /* SPDX-License-Identifier: Apache-2.0 */ +#if !(LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION) . = ALIGN(CONFIG_ARCH_IRQ_VECTOR_TABLE_ALIGN); KEEP(*(_IRQ_VECTOR_TABLE_SECTION_SYMS)) +#endif /* * Some ARM platforms require this symbol to be placed after the IRQ vector diff --git a/include/zephyr/linker/isr-local-drop-unused.ld b/include/zephyr/linker/isr-local-drop-unused.ld new file mode 100644 index 00000000000..9b6e1272413 --- /dev/null +++ b/include/zephyr/linker/isr-local-drop-unused.ld @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION +/DISCARD/ : +{ + KEEP(*(.vectors)) + KEEP(*(_IRQ_VECTOR_TABLE_SECTION_SYMS)) +} +#endif From 2ceeebc0cc27840431bc4601d98c30c4832e106f Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Thu, 4 Jan 2024 13:41:27 +0100 Subject: [PATCH 0575/2300] [nrf fromtree] arch: arm: Upgrade IDT_LIST memory section size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make IDT_LIST section bigger to fit bigger interrupt description. Note: This section would be removed from final build. Signed-off-by: Radosław Koppel (cherry picked from commit 664319f9efc933ee0d3cc4e331b95d1bafe3ba58) (cherry picked from commit d7c4d9845907dca72bbfd9c1b00a906f655b2145) --- include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld | 2 +- include/zephyr/arch/arm/cortex_m/scripts/linker.ld | 2 +- include/zephyr/arch/arm64/scripts/linker.ld | 2 +- 3 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 a27dd55a8cf..f8b117e9193 100644 --- a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld @@ -81,7 +81,7 @@ MEMORY RAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE LINKER_DT_REGIONS() /* Used by and documented in include/linker/intlist.ld */ - IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K + IDT_LIST (wx) : ORIGIN = 0xFFFF8000, LENGTH = 32K } ENTRY(CONFIG_KERNEL_ENTRY) diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 13c2747f5a3..4fcd99b5ac8 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -86,7 +86,7 @@ MEMORY #endif LINKER_DT_REGIONS() /* Used by and documented in include/linker/intlist.ld */ - IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K + IDT_LIST (wx) : ORIGIN = 0xFFFF7FFF, LENGTH = 32K } ENTRY(CONFIG_KERNEL_ENTRY) diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index d2a0d32d581..beea11a68dd 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -61,7 +61,7 @@ MEMORY FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE RAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE /* Used by and documented in include/linker/intlist.ld */ - IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K + IDT_LIST (wx) : ORIGIN = 0xFFFF8000, LENGTH = 32K } ENTRY(CONFIG_KERNEL_ENTRY) From 8d49b362415999b0cc373b2003a6d111bc68ac23 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Fri, 22 Dec 2023 14:45:18 +0100 Subject: [PATCH 0576/2300] [nrf fromtree] bluetooth: nordic: lll: Use direct ISR when applicable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates nordic lll controller to use IRQ_DIRECT_CONNECT where applicable instead of using IRQ_CONNECT with ISR_FLAG_DIRECT. Signed-off-by: Radosław Koppel (cherry picked from commit 8f98b8b574bdce4c930a7b2a2e2c78764940b6dd) (cherry picked from commit 9af6008b1d86f7188d65a22c3a3109fd96f330ce) --- subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index db8f25a374c..cde5f5befc9 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -191,8 +191,13 @@ int lll_init(void) radio_nrf5_isr, IRQ_CONNECT_FLAGS); IRQ_CONNECT(RTC0_IRQn, CONFIG_BT_CTLR_ULL_HIGH_PRIO, rtc0_nrf5_isr, NULL, 0); +#if defined(CONFIG_BT_CTLR_ZLI) + IRQ_DIRECT_CONNECT(HAL_SWI_RADIO_IRQ, CONFIG_BT_CTLR_LLL_PRIO, + swi_lll_nrf5_isr, IRQ_CONNECT_FLAGS); +#else IRQ_CONNECT(HAL_SWI_RADIO_IRQ, CONFIG_BT_CTLR_LLL_PRIO, swi_lll_nrf5_isr, NULL, IRQ_CONNECT_FLAGS); +#endif #if defined(CONFIG_BT_CTLR_LOW_LAT) || \ (CONFIG_BT_CTLR_ULL_HIGH_PRIO != CONFIG_BT_CTLR_ULL_LOW_PRIO) IRQ_CONNECT(HAL_SWI_JOB_IRQ, CONFIG_BT_CTLR_ULL_LOW_PRIO, From a95608573993b93c657a2a34067335476715faa1 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Mon, 8 Jan 2024 14:50:30 +0100 Subject: [PATCH 0577/2300] [nrf fromtree] tests: kernel: gen_isr_table: Add tests for local ISR tables declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds configurations to test local ISR tables declaration. Signed-off-by: Radosław Koppel (cherry picked from commit 3799b9368955f0299cd4ab68946b8a548ac9746f) (cherry picked from commit 79a403a01ae1711fb7f6c9522c9a00707d49bc2d) --- tests/kernel/gen_isr_table/testcase.yaml | 27 +++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/kernel/gen_isr_table/testcase.yaml b/tests/kernel/gen_isr_table/testcase.yaml index 4ee3ad00ac9..eb8babe3635 100644 --- a/tests/kernel/gen_isr_table/testcase.yaml +++ b/tests/kernel/gen_isr_table/testcase.yaml @@ -4,12 +4,12 @@ common: - interrupt - isr_table tests: - arch.interrupt.gen_isr_table.arm_baseline: + arch.interrupt.gen_isr_table.arm_baseline: &arm-baseline platform_allow: qemu_cortex_m3 filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE extra_configs: - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - arch.interrupt.gen_isr_table.arm_baseline.linker_generator: + arch.interrupt.gen_isr_table.arm_baseline.linker_generator: &arm-baseline-linker-generator platform_allow: qemu_cortex_m3 filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE tags: @@ -17,7 +17,7 @@ tests: extra_configs: - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - CONFIG_CMAKE_LINKER_GENERATOR=y - arch.interrupt.gen_isr_table.arm_mainline: + arch.interrupt.gen_isr_table.arm_mainline: &arm-mainline platform_allow: qemu_cortex_m3 platform_exclude: - stmf103_mini @@ -40,6 +40,27 @@ tests: - CONFIG_GEN_ISR_TABLES=n - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y build_only: true + + arch.interrupt.gen_isr_table_local.arm_baseline: + <<: *arm-baseline + filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE and not CONFIG_USERSPACE + extra_configs: + - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y + arch.interrupt.gen_isr_table_local.arm_baseline.linker_generator: + <<: *arm-baseline-linker-generator + filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE and not CONFIG_USERSPACE + extra_configs: + - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + - CONFIG_CMAKE_LINKER_GENERATOR=y + - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y + arch.interrupt.gen_isr_table_local.arm_mainline: + <<: *arm-mainline + filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE and not CONFIG_USERSPACE + extra_configs: + - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y + arch.interrupt.gen_isr_table.arc: arch_allow: arc filter: CONFIG_RGF_NUM_BANKS > 1 From ca5928595dbad03be6029132d9e2efb579a05f6a Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Tue, 30 Jan 2024 12:32:32 +0100 Subject: [PATCH 0578/2300] [nrf fromtree] buildsystem: Add an option to enable LTO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds option to enable Link Time Optimization. Signed-off-by: Radosław Koppel (cherry picked from commit 26c8776c70ea00773f1c9e9947c38ffe8719233c) (cherry picked from commit 2989942eec23ab4936350c1777eba64bc9861ff5) --- CMakeLists.txt | 9 +++++++++ Kconfig.zephyr | 7 +++++++ cmake/bintools/gnu/target.cmake | 9 +++++++-- cmake/compiler/gcc/compiler_flags.cmake | 3 +++ cmake/linker/ld/linker_flags.cmake | 2 ++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4292e06e211..5bb1774d020 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,6 +213,11 @@ endif() # Apply the final optimization flag(s) zephyr_compile_options(${OPTIMIZATION_FLAG}) +if(CONFIG_LTO) + add_compile_options($) + add_link_options($) +endif() + # @Intent: Obtain compiler specific flags related to C++ that are not influenced by kconfig zephyr_compile_options($<$:$>) @@ -803,6 +808,10 @@ target_include_directories(${OFFSETS_LIB} PRIVATE kernel/include ${ARCH_DIR}/${ARCH}/include ) + +# Make sure that LTO will never be enabled when compiling offsets.c +set_source_files_properties(${OFFSETS_C_PATH} PROPERTIES COMPILE_OPTIONS $) + target_link_libraries(${OFFSETS_LIB} zephyr_interface) add_dependencies(zephyr_interface ${SYSCALL_LIST_H_TARGET} diff --git a/Kconfig.zephyr b/Kconfig.zephyr index c484898206b..848ce58da7e 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -417,6 +417,13 @@ config NO_OPTIMIZATIONS default stack sizes in order to avoid stack overflows. endchoice +config LTO + bool "Link Time Optimization [EXPERIMENTAL]" + depends on !(GEN_ISR_TABLES || GEN_IRQ_VECTOR_TABLE) || ISR_TABLES_LOCAL_DECLARATION + select EXPERIMENTAL + help + This option enables Link Time Optimization. + config COMPILER_WARNINGS_AS_ERRORS bool "Treat warnings as errors" help diff --git a/cmake/bintools/gnu/target.cmake b/cmake/bintools/gnu/target.cmake index 86c66b4825c..612f6de79b2 100644 --- a/cmake/bintools/gnu/target.cmake +++ b/cmake/bintools/gnu/target.cmake @@ -5,8 +5,13 @@ find_program(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) find_program(CMAKE_OBJDUMP ${CROSS_COMPILE}objdump PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) find_program(CMAKE_AS ${CROSS_COMPILE}as PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) -find_program(CMAKE_AR ${CROSS_COMPILE}ar PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) -find_program(CMAKE_RANLIB ${CROSS_COMPILE}ranlib PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) +if(CONFIG_LTO) + find_program(CMAKE_AR ${CROSS_COMPILE}gcc-ar PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) + find_program(CMAKE_RANLIB ${CROSS_COMPILE}gcc-ranlib PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) +else() + find_program(CMAKE_AR ${CROSS_COMPILE}ar PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) + find_program(CMAKE_RANLIB ${CROSS_COMPILE}ranlib PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) +endif() find_program(CMAKE_READELF ${CROSS_COMPILE}readelf PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) find_program(CMAKE_NM ${CROSS_COMPILE}nm PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) find_program(CMAKE_STRIP ${CROSS_COMPILE}strip PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 5b1dbde49c6..8e79d32387f 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -21,6 +21,9 @@ endif() set_compiler_property(PROPERTY optimization_speed -O2) set_compiler_property(PROPERTY optimization_size -Os) +set_compiler_property(PROPERTY optimization_lto -flto) +set_compiler_property(PROPERTY prohibit_lto -fno-lto) + ####################################################### # This section covers flags related to warning levels # ####################################################### diff --git a/cmake/linker/ld/linker_flags.cmake b/cmake/linker/ld/linker_flags.cmake index 8209f4dfbdc..5660b410760 100644 --- a/cmake/linker/ld/linker_flags.cmake +++ b/cmake/linker/ld/linker_flags.cmake @@ -12,6 +12,8 @@ endif() set_property(TARGET linker PROPERTY partial_linking "-r") +set_property(TARGET linker PROPERTY lto_arguments -flto -fno-ipa-sra -ffunction-sections -fdata-sections) + # Some linker flags might not be purely ld specific, but a combination of # linker and compiler, such as: # --coverage for clang From 5c4ccc6c38edb3220a44b5b849c8d6ca86700f4d Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Tue, 30 Jan 2024 13:15:36 +0100 Subject: [PATCH 0579/2300] [nrf fromtree] tests: kernel: common: Enable tests with LTO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit enables some kernel tests with Link Time Optimization enabled. Signed-off-by: Radosław Koppel (cherry picked from commit 53becb05bfa1d383b0497a0422761fd53e9ead24) (cherry picked from commit 526699525cd894551176dd5739fcffcadf389747) --- tests/kernel/common/testcase.yaml | 7 +++++++ tests/kernel/interrupt/testcase.yaml | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/kernel/common/testcase.yaml b/tests/kernel/common/testcase.yaml index 721d4bb9c3d..ae9c39c8fb5 100644 --- a/tests/kernel/common/testcase.yaml +++ b/tests/kernel/common/testcase.yaml @@ -43,3 +43,10 @@ tests: tags: picolibc extra_configs: - CONFIG_PICOLIBC=y + kernel.common.lto: + filter: CONFIG_ISR_TABLES_LOCAL_DECLARATION_SUPPORTED + tags: lto + extra_configs: + - CONFIG_TEST_USERSPACE=n + - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y + - CONFIG_LTO=y diff --git a/tests/kernel/interrupt/testcase.yaml b/tests/kernel/interrupt/testcase.yaml index cbe58c65e47..47cbba93e0d 100644 --- a/tests/kernel/interrupt/testcase.yaml +++ b/tests/kernel/interrupt/testcase.yaml @@ -52,3 +52,23 @@ tests: extra_configs: - CONFIG_SHARED_INTERRUPTS=y filter: not CONFIG_TRUSTED_EXECUTION_NONSECURE + arch.shared_interrupt.lto: + # excluded because of failures during test_prevent_interruption + platform_exclude: qemu_cortex_m0 + arch_exclude: + # same as above, #22956 + - nios2 + # test needs 2 working interrupt lines + - xtensa + # TODO: make test work on this arch + - mips + tags: + - kernel + - interrupt + - lto + extra_configs: + - CONFIG_SHARED_INTERRUPTS=y + - CONFIG_TEST_USERSPACE=n + - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y + - CONFIG_LTO=y + filter: not CONFIG_TRUSTED_EXECUTION_NONSECURE and CONFIG_ISR_TABLES_LOCAL_DECLARATION_SUPPORTED From 04ddd1e43a1a1fe278a8bab4ca5ab68e773a5622 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Mon, 5 Feb 2024 10:28:06 +0100 Subject: [PATCH 0580/2300] [nrf fromtree] arch: arm, arm64: Disable swi_tables.ld file when not required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit removes the need of swi_tables.ld file if the ISR table generator is not configured to use it. Signed-off-by: Radosław Koppel (cherry picked from commit adaacefc2032721c510e91d3ac8b50251c95300c) (cherry picked from commit d80235af2f65498ec3192a6768ea21d6b5f874e1) --- arch/arm/core/swi_tables.ld | 2 +- arch/arm/core/vector_table.ld | 2 +- arch/arm64/core/swi_tables.ld | 2 +- include/zephyr/arch/arm64/scripts/linker.ld | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/swi_tables.ld b/arch/arm/core/swi_tables.ld index c6ca94604dd..a06e851e52e 100644 --- a/arch/arm/core/swi_tables.ld +++ b/arch/arm/core/swi_tables.ld @@ -3,6 +3,6 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#if LINKER_ZEPHYR_FINAL +#if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) INCLUDE zephyr/isr_tables_swi.ld #endif diff --git a/arch/arm/core/vector_table.ld b/arch/arm/core/vector_table.ld index 58210afdcbc..a5af58fe6de 100644 --- a/arch/arm/core/vector_table.ld +++ b/arch/arm/core/vector_table.ld @@ -51,7 +51,7 @@ _vector_start = .; KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) -#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION +#if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) INCLUDE zephyr/isr_tables_vt.ld #else KEEP(*(.vectors)) diff --git a/arch/arm64/core/swi_tables.ld b/arch/arm64/core/swi_tables.ld index c6ca94604dd..a06e851e52e 100644 --- a/arch/arm64/core/swi_tables.ld +++ b/arch/arm64/core/swi_tables.ld @@ -3,6 +3,6 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#if LINKER_ZEPHYR_FINAL +#if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) INCLUDE zephyr/isr_tables_swi.ld #endif diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index beea11a68dd..18f973e7968 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -105,7 +105,7 @@ SECTIONS KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) -#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION +#if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) INCLUDE zephyr/isr_tables_vt.ld #else KEEP(*(.vectors)) From d23be97ec577386d4dc69bd8a4dc4d30bc93ce32 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Mon, 5 Feb 2024 10:59:22 +0100 Subject: [PATCH 0581/2300] [nrf fromtree] arch: arm, arm64: Remove zephyr prefix from linker includes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fix removes the zephyr/ prefix from linker included files. With this prefix the build works only for Ninja and not for other build tools. Linking in Zephyr / CMake: - Ninja invokes linking directly from . - Make invokes linking form /zephyr. The linker default uses cwd for looking up INCLUDE directives if not found in list of includes. Zephyr always adds /zephyr as link include using CMake, and this is passed to ld as -L/zephyr therefore using INCLUDE isr_tables_swi.ld ensures it will be correctly found in all cases. Signed-off-by: Radosław Koppel (cherry picked from commit 08070fbf1f4ca15956a7aef104a131ec5924462c) (cherry picked from commit efdefefc2bc5b9255576301cb06adfa38f04ebb1) --- arch/arm/core/swi_tables.ld | 2 +- arch/arm/core/vector_table.ld | 2 +- arch/arm64/core/swi_tables.ld | 2 +- include/zephyr/arch/arm64/scripts/linker.ld | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/swi_tables.ld b/arch/arm/core/swi_tables.ld index a06e851e52e..a5dd3eaf652 100644 --- a/arch/arm/core/swi_tables.ld +++ b/arch/arm/core/swi_tables.ld @@ -4,5 +4,5 @@ * SPDX-License-Identifier: Apache-2.0 */ #if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) -INCLUDE zephyr/isr_tables_swi.ld +INCLUDE isr_tables_swi.ld #endif diff --git a/arch/arm/core/vector_table.ld b/arch/arm/core/vector_table.ld index a5af58fe6de..463e389de9f 100644 --- a/arch/arm/core/vector_table.ld +++ b/arch/arm/core/vector_table.ld @@ -52,7 +52,7 @@ KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) #if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) -INCLUDE zephyr/isr_tables_vt.ld +INCLUDE isr_tables_vt.ld #else KEEP(*(.vectors)) #endif diff --git a/arch/arm64/core/swi_tables.ld b/arch/arm64/core/swi_tables.ld index a06e851e52e..a5dd3eaf652 100644 --- a/arch/arm64/core/swi_tables.ld +++ b/arch/arm64/core/swi_tables.ld @@ -4,5 +4,5 @@ * SPDX-License-Identifier: Apache-2.0 */ #if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) -INCLUDE zephyr/isr_tables_swi.ld +INCLUDE isr_tables_swi.ld #endif diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index 18f973e7968..ad7832f16ec 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -106,7 +106,7 @@ SECTIONS KEEP(*(".exc_vector_table.*")) #if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) - INCLUDE zephyr/isr_tables_vt.ld + INCLUDE isr_tables_vt.ld #else KEEP(*(.vectors)) #endif From 7c98778bba3b954f42139e03127798deaf926c34 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:05:02 +0100 Subject: [PATCH 0582/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: current-speed needs to be set by boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a setting that depends on the board or application, so it should not be part of SoC definition files. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 04025d87db5e8e51fef531e1f312a73eb8e6e346) Signed-off-by: Andrzej Głąbek (cherry picked from commit ff9acf5d7de51089fab4ea54122e24f2b72df716) --- boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts | 2 ++ boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts | 2 ++ .../riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts | 2 ++ dts/common/nordic/nrf54h20_enga.dtsi | 2 -- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 359c1f84307..5fb345ec808 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -123,6 +123,7 @@ }; &uart135 { + current-speed = <115200>; pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; @@ -131,6 +132,7 @@ &uart136 { status = "okay"; memory-regions = <&cpuapp_dma_region>; + current-speed = <115200>; pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index 02213d88645..a7d142b06c4 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -46,12 +46,14 @@ &uart135 { status = "okay"; memory-regions = <&cpurad_dma_region>; + current-speed = <115200>; pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; }; &uart136 { + current-speed = <115200>; pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts index 83aface6f5c..3c74e7c88d4 100644 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts @@ -31,12 +31,14 @@ &uart135 { status = "okay"; + current-speed = <115200>; pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; }; &uart136 { + current-speed = <115200>; pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 1b8f7b6f9e8..af751c4344b 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -254,7 +254,6 @@ compatible = "nordic,nrf-uarte"; reg = <0x9c6000 0x1000>; status = "disabled"; - current-speed = <115200>; interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; }; @@ -262,7 +261,6 @@ compatible = "nordic,nrf-uarte"; reg = <0x9d5000 0x1000>; status = "disabled"; - current-speed = <115200>; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; }; }; From af8bea679e79366f22a12ee33b5c6adf6773a4ce Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:02:54 +0100 Subject: [PATCH 0583/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add missing UARTE nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing UARTE nodes. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 5adbac51abf4e1d33a4d7bc897e5f3ac9b56f948) Signed-off-by: Andrzej Głąbek (cherry picked from commit 4ca348d278e0922f360be0a88fe56594907327be) --- dts/common/nordic/nrf54h20_enga.dtsi | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index af751c4344b..97dcb222746 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -153,6 +153,13 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; + uart120: uart@8e5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x8e5000 0x1000>; + status = "disabled"; + interrupts = <229 NRF_DEFAULT_IRQ_PRIORITY>; + }; + cpuppr_vpr: vpr@908000 { compatible = "nordic,nrf-vpr-coprocessor"; reg = <0x908000 0x1000>; @@ -250,6 +257,41 @@ cc-num = <16>; }; + uart130: uart@9a5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9a5000 0x1000>; + status = "disabled"; + interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + uart131: uart@9a6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9a6000 0x1000>; + status = "disabled"; + interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + uart132: uart@9b5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9b5000 0x1000>; + status = "disabled"; + interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + uart133: uart@9b6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9b6000 0x1000>; + status = "disabled"; + interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + uart134: uart@9c5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9c5000 0x1000>; + status = "disabled"; + interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; + }; + uart135: uart@9c6000 { compatible = "nordic,nrf-uarte"; reg = <0x9c6000 0x1000>; @@ -263,6 +305,13 @@ status = "disabled"; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; }; + + uart137: uart@9d6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9d6000 0x1000>; + status = "disabled"; + interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; + }; }; }; From a012a955eb2da44bf3a5625e81641118b3c9f7f7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 14:56:50 +0100 Subject: [PATCH 0584/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add TIMER nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nodes for TIMER peripherals (Timer/Counter). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 083bf7e5495136cf4d6a2073656d927772bda945) Signed-off-by: Andrzej Głąbek (cherry picked from commit 86dc192be6f4d6030af05aacb7c553e4cf56a4c0) --- dts/common/nordic/nrf54h20_enga.dtsi | 130 +++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 97dcb222746..6d27042cb6b 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -146,6 +146,36 @@ <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1>; nordic,ficr-names = "vsup", "coarse", "fine"; }; + + timer020: timer@28000 { + compatible = "nordic,nrf-timer"; + reg = <0x28000 0x1000>; + status = "disabled"; + cc-num = <8>; + interrupts = <40 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer021: timer@29000 { + compatible = "nordic,nrf-timer"; + reg = <0x29000 0x1000>; + status = "disabled"; + cc-num = <8>; + interrupts = <41 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer022: timer@2a000 { + compatible = "nordic,nrf-timer"; + reg = <0x2a000 0x1000>; + status = "disabled"; + cc-num = <8>; + interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; }; global_peripherals: peripheral@5f000000 { @@ -153,6 +183,26 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; + timer120: timer@8e2000 { + compatible = "nordic,nrf-timer"; + reg = <0x8e2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer121: timer@8e3000 { + compatible = "nordic,nrf-timer"; + reg = <0x8e3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + uart120: uart@8e5000 { compatible = "nordic,nrf-uarte"; reg = <0x8e5000 0x1000>; @@ -257,6 +307,26 @@ cc-num = <16>; }; + timer130: timer@9a2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9a2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <418 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer131: timer@9a3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9a3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <419 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + uart130: uart@9a5000 { compatible = "nordic,nrf-uarte"; reg = <0x9a5000 0x1000>; @@ -271,6 +341,26 @@ interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; }; + timer132: timer@9b2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9b2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <434 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer133: timer@9b3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9b3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <435 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + uart132: uart@9b5000 { compatible = "nordic,nrf-uarte"; reg = <0x9b5000 0x1000>; @@ -285,6 +375,26 @@ interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; }; + timer134: timer@9c2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9c2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <450 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer135: timer@9c3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9c3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <451 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + uart134: uart@9c5000 { compatible = "nordic,nrf-uarte"; reg = <0x9c5000 0x1000>; @@ -299,6 +409,26 @@ interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; }; + timer136: timer@9d2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9d2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <466 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer137: timer@9d3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9d3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <467 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + uart136: uart@9d5000 { compatible = "nordic,nrf-uarte"; reg = <0x9d5000 0x1000>; From 58fb3f4103462dfa2af1e3ee69dc6a6833e130a2 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:54:16 +0100 Subject: [PATCH 0585/2300] [nrf fromtree] modules: hal_nordic: add support for TIMER020-022|120-121|130-137 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new HAL glue Kconfig options so that new TIMER instances can be used. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 7dd985338255e1c3c9219454d53e0da663d009e0) Signed-off-by: Andrzej Głąbek (cherry picked from commit 8c65cb77e54a4b96174e5c64d69b4c64178bbde0) --- modules/hal_nordic/nrfx/Kconfig | 65 +++++++++++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 39 ++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index ee1bd76b52f..784a2087139 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -457,6 +457,71 @@ config NRFX_TIMER24 depends on $(dt_nodelabel_has_compat,timer24,$(DT_COMPAT_NORDIC_NRF_TIMER)) select NRFX_TIMER +config NRFX_TIMER020 + bool "TIMER020 driver instance" + depends on $(dt_nodelabel_has_compat,timer020,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER021 + bool "TIMER021 driver instance" + depends on $(dt_nodelabel_has_compat,timer021,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER022 + bool "TIMER022 driver instance" + depends on $(dt_nodelabel_has_compat,timer022,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER120 + bool "TIMER120 driver instance" + depends on $(dt_nodelabel_has_compat,timer120,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER121 + bool "TIMER121 driver instance" + depends on $(dt_nodelabel_has_compat,timer121,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER130 + bool "TIMER130 driver instance" + depends on $(dt_nodelabel_has_compat,timer130,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER131 + bool "TIMER131 driver instance" + depends on $(dt_nodelabel_has_compat,timer131,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER132 + bool "TIMER132 driver instance" + depends on $(dt_nodelabel_has_compat,timer132,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER133 + bool "TIMER133 driver instance" + depends on $(dt_nodelabel_has_compat,timer133,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER134 + bool "TIMER134 driver instance" + depends on $(dt_nodelabel_has_compat,timer134,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER135 + bool "TIMER135 driver instance" + depends on $(dt_nodelabel_has_compat,timer135,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER136 + bool "TIMER136 driver instance" + depends on $(dt_nodelabel_has_compat,timer136,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + +config NRFX_TIMER137 + bool "TIMER137 driver instance" + depends on $(dt_nodelabel_has_compat,timer137,$(DT_COMPAT_NORDIC_NRF_TIMER)) + select NRFX_TIMER + config NRFX_TWI bool diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 26d662be39d..20facba229c 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -472,6 +472,45 @@ #ifdef CONFIG_NRFX_TIMER24 #define NRFX_TIMER24_ENABLED 1 #endif +#ifdef CONFIG_NRFX_TIMER020 +#define NRFX_TIMER020_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER021 +#define NRFX_TIMER021_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER022 +#define NRFX_TIMER022_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER120 +#define NRFX_TIMER120_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER121 +#define NRFX_TIMER121_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER130 +#define NRFX_TIMER130_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER131 +#define NRFX_TIMER131_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER132 +#define NRFX_TIMER132_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER133 +#define NRFX_TIMER133_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER134 +#define NRFX_TIMER134_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER135 +#define NRFX_TIMER135_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER136 +#define NRFX_TIMER136_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TIMER137 +#define NRFX_TIMER137_ENABLED 1 +#endif #ifdef CONFIG_NRFX_TWI #define NRFX_TWI_ENABLED 1 From 82d956cc9c6621b9bd6947b6e7543e268cb670ce Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:56:59 +0100 Subject: [PATCH 0586/2300] [nrf fromtree] soc: nordic_nrf: add support for TIMER020-022|120-121|130-137 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new Kconfig options so that new TIMER instances can be used. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 07d961c1124a46e3bd2429f567909aaaa12c631c) Signed-off-by: Andrzej Głąbek (cherry picked from commit 2c870baff32a358cc78473e042eee478d5de4742) --- soc/common/nordic_nrf/Kconfig.peripherals | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index da1c5f473c7..6ebf0702cda 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -339,6 +339,45 @@ config HAS_HW_NRF_TIMER23 config HAS_HW_NRF_TIMER24 def_bool $(dt_nodelabel_enabled_with_compat,timer24,$(DT_COMPAT_NORDIC_NRF_TIMER)) +config HAS_HW_NRF_TIMER020 + def_bool $(dt_nodelabel_enabled_with_compat,timer020,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER021 + def_bool $(dt_nodelabel_enabled_with_compat,timer021,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER022 + def_bool $(dt_nodelabel_enabled_with_compat,timer022,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER120 + def_bool $(dt_nodelabel_enabled_with_compat,timer120,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER121 + def_bool $(dt_nodelabel_enabled_with_compat,timer121,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER130 + def_bool $(dt_nodelabel_enabled_with_compat,timer130,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER131 + def_bool $(dt_nodelabel_enabled_with_compat,timer131,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER132 + def_bool $(dt_nodelabel_enabled_with_compat,timer132,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER133 + def_bool $(dt_nodelabel_enabled_with_compat,timer133,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER134 + def_bool $(dt_nodelabel_enabled_with_compat,timer134,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER135 + def_bool $(dt_nodelabel_enabled_with_compat,timer135,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER136 + def_bool $(dt_nodelabel_enabled_with_compat,timer136,$(DT_COMPAT_NORDIC_NRF_TIMER)) + +config HAS_HW_NRF_TIMER137 + def_bool $(dt_nodelabel_enabled_with_compat,timer137,$(DT_COMPAT_NORDIC_NRF_TIMER)) + config HAS_HW_NRF_TWI0 def_bool $(dt_nodelabel_enabled_with_compat,i2c0,$(DT_COMPAT_NORDIC_NRF_TWI)) From 619fb93a32561dba8ca579b8a59fc696758e9a1a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 14:58:55 +0100 Subject: [PATCH 0587/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add RTC nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add RTC (Real Time Counter) node. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 35fecb731a1b40f1fd8f7c5fa0a9ada83421164c) Signed-off-by: Andrzej Głąbek (cherry picked from commit 67417f138709cd6ab7b1026122e97b7a23ed0ae8) --- dts/common/nordic/nrf54h20_enga.dtsi | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 6d27042cb6b..b8341c257e2 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -176,6 +176,16 @@ max-bit-width = <32>; prescaler = <0>; }; + + rtc: rtc@2b000 { + compatible = "nordic,nrf-rtc"; + reg = <0x2b000 0x1000>; + status = "disabled"; + cc-num = <4>; + clock-frequency = <32768>; + interrupts = <43 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <1>; + }; }; global_peripherals: peripheral@5f000000 { @@ -229,6 +239,26 @@ }; }; + rtc130: rtc@928000 { + compatible = "nordic,nrf-rtc"; + reg = <0x928000 0x1000>; + status = "disabled"; + cc-num = <4>; + clock-frequency = <32768>; + interrupts = <296 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <1>; + }; + + rtc131: rtc@929000 { + compatible = "nordic,nrf-rtc"; + reg = <0x929000 0x1000>; + status = "disabled"; + cc-num = <4>; + clock-frequency = <32768>; + interrupts = <297 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <1>; + }; + gpiote130: gpiote@934000 { compatible = "nordic,nrf-gpiote"; reg = <0x934000 0x1000>; From cf099e417174d0f1e7183c6f69cca742d9a0d7b2 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 16:14:56 +0100 Subject: [PATCH 0588/2300] [nrf fromtree] modules: hal_nordic: add support for RTC130-131 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new HAL glue Kconfig options for RTC130-131. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 3dd2b0d8b3da9a3650078b535b31b0c28a73d071) Signed-off-by: Andrzej Głąbek (cherry picked from commit e41fccdef97d30cdfd8232445bce716b3c4d803b) --- modules/hal_nordic/nrfx/Kconfig | 10 ++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 784a2087139..34dbb43f3d4 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -238,6 +238,16 @@ config NRFX_RTC2 depends on $(dt_nodelabel_has_compat,rtc2,$(DT_COMPAT_NORDIC_NRF_RTC)) select NRFX_RTC +config NRFX_RTC130 + bool "RTC130 driver instance" + depends on $(dt_nodelabel_has_compat,rtc130,$(DT_COMPAT_NORDIC_NRF_RTC)) + select NRFX_RTC + +config NRFX_RTC131 + bool "RTC131 driver instance" + depends on $(dt_nodelabel_has_compat,rtc131,$(DT_COMPAT_NORDIC_NRF_RTC)) + select NRFX_RTC + config NRFX_SAADC bool "SAADC driver" depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_SAADC)) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 20facba229c..0f52cd17cf2 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -299,6 +299,12 @@ #ifdef CONFIG_NRFX_RTC2 #define NRFX_RTC2_ENABLED 1 #endif +#ifdef CONFIG_NRFX_RTC130 +#define NRFX_RTC130_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_RTC131 +#define NRFX_RTC131_ENABLED 1 +#endif #ifdef CONFIG_NRFX_SAADC #define NRFX_SAADC_ENABLED 1 From 1f88cf5ce952ac1aca94f4dc7febc6c3ab160e96 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 16:15:42 +0100 Subject: [PATCH 0589/2300] [nrf fromtree] soc: nordic_nrf: add support for RTC130-131 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new Kconfig options for RTC130-131 so that the new instances can be used. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit f77b30fa1762f3173b2cb3de09d524d327921e5a) Signed-off-by: Andrzej Głąbek (cherry picked from commit a46ad87180076f78e23764b1af8b698471d328b4) --- soc/common/nordic_nrf/Kconfig.peripherals | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 6ebf0702cda..14f598ecf85 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -195,6 +195,12 @@ config HAS_HW_NRF_RTC1 config HAS_HW_NRF_RTC2 def_bool $(dt_nodelabel_enabled_with_compat,rtc2,$(DT_COMPAT_NORDIC_NRF_RTC)) +config HAS_HW_NRF_RTC130 + def_bool $(dt_nodelabel_enabled_with_compat,rtc130,$(DT_COMPAT_NORDIC_NRF_RTC)) + +config HAS_HW_NRF_RTC131 + def_bool $(dt_nodelabel_enabled_with_compat,rtc131,$(DT_COMPAT_NORDIC_NRF_RTC)) + config HAS_HW_NRF_SAADC def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_SAADC)) From 339554ab6db1839cdf95d3aa7d4a6c0425daccd1 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:12:05 +0100 Subject: [PATCH 0590/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add SPIM nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add SPIM (SPI with EasyDMA) nodes. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit e5ef767ab2016a608627b7d01e440b11b6cdb0fd) Signed-off-by: Andrzej Głąbek (cherry picked from commit 8aa62327d9109f0809258fe744cdeb03f9ec4e14) --- dts/common/nordic/nrf54h20_enga.dtsi | 110 +++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index b8341c257e2..b762c5c7f91 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -220,6 +220,28 @@ interrupts = <229 NRF_DEFAULT_IRQ_PRIORITY>; }; + spi120: spi@8e6000 { + compatible = "nordic,nrf-spim"; + reg = <0x8e6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi121: spi@8e7000 { + compatible = "nordic,nrf-spim"; + reg = <0x8e7000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <231 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + cpuppr_vpr: vpr@908000 { compatible = "nordic,nrf-vpr-coprocessor"; reg = <0x908000 0x1000>; @@ -357,6 +379,17 @@ prescaler = <0>; }; + spi130: spi@9a5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9a5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + uart130: uart@9a5000 { compatible = "nordic,nrf-uarte"; reg = <0x9a5000 0x1000>; @@ -364,6 +397,17 @@ interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; }; + spi131: spi@9a6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9a6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + uart131: uart@9a6000 { compatible = "nordic,nrf-uarte"; reg = <0x9a6000 0x1000>; @@ -391,6 +435,17 @@ prescaler = <0>; }; + spi132: spi@9b5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9b5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + uart132: uart@9b5000 { compatible = "nordic,nrf-uarte"; reg = <0x9b5000 0x1000>; @@ -398,6 +453,17 @@ interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; }; + spi133: spi@9b6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9b6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + uart133: uart@9b6000 { compatible = "nordic,nrf-uarte"; reg = <0x9b6000 0x1000>; @@ -425,6 +491,17 @@ prescaler = <0>; }; + spi134: spi@9c5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9c5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + uart134: uart@9c5000 { compatible = "nordic,nrf-uarte"; reg = <0x9c5000 0x1000>; @@ -432,6 +509,17 @@ interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; }; + spi135: spi@9c6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9c6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + uart135: uart@9c6000 { compatible = "nordic,nrf-uarte"; reg = <0x9c6000 0x1000>; @@ -459,6 +547,17 @@ prescaler = <0>; }; + spi136: spi@9d5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9d5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + uart136: uart@9d5000 { compatible = "nordic,nrf-uarte"; reg = <0x9d5000 0x1000>; @@ -466,6 +565,17 @@ interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; }; + spi137: spi@9d6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9d6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + uart137: uart@9d6000 { compatible = "nordic,nrf-uarte"; reg = <0x9d6000 0x1000>; From 83dc3594722ad3671914dd09ea262fbcbbc198df Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:22:09 +0100 Subject: [PATCH 0591/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add TWIM nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nodes for I2C/TWIM. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 010519c8e3d9234ca841291517bb159d9ebebd42) Signed-off-by: Andrzej Głąbek (cherry picked from commit e8794fc883893a79d7016aff8f5b7e6bc9fff185) --- dts/common/nordic/nrf54h20_enga.dtsi | 80 ++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index b762c5c7f91..20ec8466ee5 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -379,6 +379,16 @@ prescaler = <0>; }; + i2c130: i2c@9a5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9a5000 0x1000>; + status = "disabled"; + interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + spi130: spi@9a5000 { compatible = "nordic,nrf-spim"; reg = <0x9a5000 0x1000>; @@ -397,6 +407,16 @@ interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; }; + i2c131: i2c@9a6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9a6000 0x1000>; + status = "disabled"; + interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + spi131: spi@9a6000 { compatible = "nordic,nrf-spim"; reg = <0x9a6000 0x1000>; @@ -435,6 +455,16 @@ prescaler = <0>; }; + i2c132: i2c@9b5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9b5000 0x1000>; + status = "disabled"; + interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + spi132: spi@9b5000 { compatible = "nordic,nrf-spim"; reg = <0x9b5000 0x1000>; @@ -453,6 +483,16 @@ interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; }; + i2c133: i2c@9b6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9b6000 0x1000>; + status = "disabled"; + interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + spi133: spi@9b6000 { compatible = "nordic,nrf-spim"; reg = <0x9b6000 0x1000>; @@ -491,6 +531,16 @@ prescaler = <0>; }; + i2c134: i2c@9c5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9c5000 0x1000>; + status = "disabled"; + interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + spi134: spi@9c5000 { compatible = "nordic,nrf-spim"; reg = <0x9c5000 0x1000>; @@ -509,6 +559,16 @@ interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; }; + i2c135: i2c@9c6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9c6000 0x1000>; + status = "disabled"; + interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + spi135: spi@9c6000 { compatible = "nordic,nrf-spim"; reg = <0x9c6000 0x1000>; @@ -547,6 +607,16 @@ prescaler = <0>; }; + i2c136: i2c@9d5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9d5000 0x1000>; + status = "disabled"; + interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + spi136: spi@9d5000 { compatible = "nordic,nrf-spim"; reg = <0x9d5000 0x1000>; @@ -565,6 +635,16 @@ interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; }; + i2c137: i2c@9d6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9d6000 0x1000>; + status = "disabled"; + interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + spi137: spi@9d6000 { compatible = "nordic,nrf-spim"; reg = <0x9d6000 0x1000>; From 2d7891968fba4d088dd1cbea747898e7f7142cc4 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:24:16 +0100 Subject: [PATCH 0592/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add QDEC nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nodes for QDEC (Quadrature Decoder). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 720719cf80ba19625eef8f9e37bb5e73e1736c5b) Signed-off-by: Andrzej Głąbek (cherry picked from commit 0cfd5a585ec4efec2ba77f42e6af3e8ba6f7e436) --- dts/common/nordic/nrf54h20_enga.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 20ec8466ee5..0e586962b0f 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -352,6 +352,20 @@ port = <9>; }; + qdec130: qdec@994000 { + compatible = "nordic,nrf-qdec"; + reg = <0x994000 0x1000>; + status = "disabled"; + interrupts = <404 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + qdec131: qdec@995000 { + compatible = "nordic,nrf-qdec"; + reg = <0x995000 0x1000>; + status = "disabled"; + interrupts = <405 NRF_DEFAULT_IRQ_PRIORITY>; + }; + grtc: grtc@99c000 { compatible = "nordic,nrf-grtc"; reg = <0x99c000 0x1000>; From 935914974f94a19c836c45c52d01c917df27808d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:25:11 +0100 Subject: [PATCH 0593/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add NFCT node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add node for the NFCT (Near Field Connect Tag) peripheral. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 735ee4c83ab34ea76322a6cf4f0aa14e5e36e62b) Signed-off-by: Andrzej Głąbek (cherry picked from commit 99e686563223c705f8e0ac3385e76da85817eb86) --- dts/common/nordic/nrf54h20_enga.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 0e586962b0f..817c346e066 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -352,6 +352,13 @@ port = <9>; }; + nfct: nfct@985000 { + compatible = "nordic,nrf-nfct"; + reg = <0x985000 0x1000>; + status = "disabled"; + interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; + }; + qdec130: qdec@994000 { compatible = "nordic,nrf-qdec"; reg = <0x994000 0x1000>; From d2d65a04e2bf586af62cf4f040bd48affdbc297e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:26:19 +0100 Subject: [PATCH 0594/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add TEMP node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nodes for the TEMP (temperature sensor) peripheral. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit f1a352d00f951f060437d4ec7dce9bfda4b69544) Signed-off-by: Andrzej Głąbek (cherry picked from commit edbdb319c8c058da799301ed72c42765282b779c) --- dts/common/nordic/nrf54h20_enga.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 817c346e066..6999a52278e 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -352,6 +352,13 @@ port = <9>; }; + temp: temperature-sensor@984000 { + compatible = "nordic,nrf-temp"; + reg = <0x984000 0x1000>; + interrupts = <388 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + nfct: nfct@985000 { compatible = "nordic,nrf-nfct"; reg = <0x985000 0x1000>; From 9e55d5d70d1da36474f89eee4188f64d507bd47d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:31:04 +0100 Subject: [PATCH 0595/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add COMP node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add node for COMP (comparator). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 9c6f47d7860face9bf26c9570705da168b8bf854) Signed-off-by: Andrzej Głąbek (cherry picked from commit 7a5873a94d2f597e0b705362ead819de3881f647) --- dts/common/nordic/nrf54h20_enga.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 6999a52278e..d6208a3f2d7 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -352,6 +352,14 @@ port = <9>; }; + comp: comparator@983000 { + compatible = "nordic,nrf-comp"; + reg = <0x983000 0x1000>; + status = "disabled"; + interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; + #io-channel-cells = <1>; + }; + temp: temperature-sensor@984000 { compatible = "nordic,nrf-temp"; reg = <0x984000 0x1000>; From 1d7d7b612c461345b2048b0c29b9c636d174ebb8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:37:02 +0100 Subject: [PATCH 0596/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add EGU node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add node for EGU (Event Generator Unit). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit bc53031824b38b860b7716a3da8cb80d8bbdbab6) Signed-off-by: Andrzej Głąbek (cherry picked from commit d94e17813f169b8d51e24d9daf072a48c0f51950) --- dts/common/nordic/nrf54h20_enga.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index d6208a3f2d7..e3010a1de58 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -147,6 +147,13 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; + egu020: egu@25000 { + compatible = "nordic,nrf-egu"; + reg = <0x25000 0x1000>; + status = "disabled"; + interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; + }; + timer020: timer@28000 { compatible = "nordic,nrf-timer"; reg = <0x28000 0x1000>; From b16a3284fb92e0ea7692f4153b2ca3fe7cc973d6 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 16:17:29 +0100 Subject: [PATCH 0597/2300] [nrf fromtree] modules: hal_nordic: add support for EGU020 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add HAL glue code to support EGU020. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 01b43074ab2451a5e17d770c4d62d8d3bba781e5) Signed-off-by: Andrzej Głąbek (cherry picked from commit d4e36bec63b5a0dd33b38ae3b3f60279bc4dd4d5) --- modules/hal_nordic/nrfx/Kconfig | 5 +++++ modules/hal_nordic/nrfx/nrfx_config.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 34dbb43f3d4..88b19159730 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -62,6 +62,11 @@ config NRFX_EGU5 depends on $(dt_nodelabel_has_compat,egu5,$(DT_COMPAT_NORDIC_NRF_EGU)) select NRFX_EGU +config NRFX_EGU020 + bool "EGU020 driver instance" + depends on $(dt_nodelabel_has_compat,egu020,$(DT_COMPAT_NORDIC_NRF_EGU)) + select NRFX_EGU + config NRFX_GPIOTE bool diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 0f52cd17cf2..5ec7b137703 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -108,6 +108,9 @@ #ifdef CONFIG_NRFX_EGU5 #define NRFX_EGU5_ENABLED 1 #endif +#ifdef CONFIG_NRFX_EGU020 +#define NRFX_EGU020_ENABLED 1 +#endif #ifdef CONFIG_NRFX_GRTC #define NRFX_GRTC_ENABLED 1 From 4ee03da12222ec8398dce056f3c2fbbccd595f66 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 16:18:23 +0100 Subject: [PATCH 0598/2300] [nrf fromtree] soc: nordic_nrf: add support for EGU020 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for EGU020. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 0cb51de315049a8cdb82d955f9961fae909cfd47) Signed-off-by: Andrzej Głąbek (cherry picked from commit 7782e88dc2912e2d7d975aee3391ec9d6481955f) --- soc/common/nordic_nrf/Kconfig.peripherals | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 14f598ecf85..aa0d753d89a 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -63,6 +63,9 @@ config HAS_HW_NRF_EGU4 config HAS_HW_NRF_EGU5 def_bool $(dt_nodelabel_enabled_with_compat,egu5,$(DT_COMPAT_NORDIC_NRF_EGU)) +config HAS_HW_NRF_EGU020 + def_bool $(dt_nodelabel_enabled_with_compat,egu020,$(DT_COMPAT_NORDIC_NRF_EGU)) + config HAS_HW_NRF_GPIO0 def_bool $(dt_nodelabel_enabled_with_compat,gpio0,$(DT_COMPAT_NORDIC_NRF_GPIO)) From 215516af6ea4c45e5f603ca581181517bbc5ad6b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:38:13 +0100 Subject: [PATCH 0599/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add RADIO node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add node for the RADIO. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit d33e5fc7afb98a5648627d65e8c507d5d6a24d06) Signed-off-by: Andrzej Głąbek (cherry picked from commit 7a6f0f979e5403459aa2fac762f2a8d2d669c705) --- dts/common/nordic/nrf54h20_enga.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index e3010a1de58..b08a8ee6cb3 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -193,6 +193,22 @@ interrupts = <43 NRF_DEFAULT_IRQ_PRIORITY>; prescaler = <1>; }; + + radio: radio@2c000 { + compatible = "nordic,nrf-radio"; + reg = <0x2c000 0x1000>; + status = "disabled"; + ble-2mbps-supported; + ble-coded-phy-supported; + dfe-supported; + ieee802154-supported; + interrupts = <44 NRF_DEFAULT_IRQ_PRIORITY>; + + cpurad_ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; + }; }; global_peripherals: peripheral@5f000000 { From a56e671dcce77b16052e796e76f68f9481a8f55f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:39:25 +0100 Subject: [PATCH 0600/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add ECB node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add node for ECB (AES electronic codebook mode encryption). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 4db40601dd7f0b98a48f3e6072bf44643a4ea3db) Signed-off-by: Andrzej Głąbek (cherry picked from commit 59460ab14a9beadc2c1209db5877d53f599c3556) --- dts/common/nordic/nrf54h20_enga.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index b08a8ee6cb3..980546bcf00 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -209,6 +209,13 @@ status = "disabled"; }; }; + + ecb030: ecb@3b000 { + compatible = "nordic,nrf-ecb"; + reg = <0x3b000 0x1000>; + interrupts = <59 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; }; global_peripherals: peripheral@5f000000 { From a291c2c5daf019a8244db64f32937d28e1c2bea7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 15:42:15 +0100 Subject: [PATCH 0601/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: add WDT nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nodes for WDT (Watchdog Timer). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 30c77786e5390133a1a675e03c2cfde7dd846938) Signed-off-by: Andrzej Głąbek (cherry picked from commit dd4209b756794b77a6cc8fbf94193fb08b578d3e) --- dts/common/nordic/nrf54h20_enga.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 980546bcf00..5a9af57801c 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -311,6 +311,20 @@ prescaler = <1>; }; + wdt131: watchdog@92b000 { + compatible = "nordic,nrf-wdt"; + reg = <0x92b000 0x1000>; + status = "disabled"; + interrupts = <299 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + wdt132: watchdog@92c000 { + compatible = "nordic,nrf-wdt"; + reg = <0x92c000 0x1000>; + status = "disabled"; + interrupts = <300 NRF_DEFAULT_IRQ_PRIORITY>; + }; + gpiote130: gpiote@934000 { compatible = "nordic,nrf-gpiote"; reg = <0x934000 0x1000>; From be9797d28cacc5ed663d3a650d7dc406c2f5d35f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 16:24:27 +0100 Subject: [PATCH 0602/2300] [nrf fromtree] modules: hal_nordic: add support for WDT131-132 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add HAL glue code to support WDT131-132. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit c57ec6f07ab7e8cd18ccc1396782c906acb47281) Signed-off-by: Andrzej Głąbek (cherry picked from commit 4652b914d62ae9d02cd6ecafbc4e0dd4946def9c) --- modules/hal_nordic/nrfx/Kconfig | 10 ++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 88b19159730..a511af42e17 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -815,6 +815,16 @@ config NRFX_WDT130 depends on $(dt_nodelabel_has_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) select NRFX_WDT +config NRFX_WDT131 + bool "WDT131 driver instance" + depends on $(dt_nodelabel_has_compat,wdt131,$(DT_COMPAT_NORDIC_NRF_WDT)) + select NRFX_WDT + +config NRFX_WDT132 + bool "WDT132 driver instance" + depends on $(dt_nodelabel_has_compat,wdt132,$(DT_COMPAT_NORDIC_NRF_WDT)) + select NRFX_WDT + menu "Peripheral Resource Sharing module" config NRFX_PRS diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 5ec7b137703..5ebc243541e 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -722,6 +722,12 @@ #ifdef CONFIG_NRFX_WDT130 #define NRFX_WDT130_ENABLED 1 #endif +#ifdef CONFIG_NRFX_WDT131 +#define NRFX_WDT131_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_WDT132 +#define NRFX_WDT132_ENABLED 1 +#endif #ifdef CONFIG_NRF52_ANOMALY_109_WORKAROUND #define NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 From dc6303cddd22998b0cccf8bedac9907389397fb7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 16:25:01 +0100 Subject: [PATCH 0603/2300] [nrf fromtree] soc: nordic_nrf: add support for WDT131-132 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new Kconfig options to select WDT131-132. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 1453008f6fe77540eec54c002188a828e0274489) Signed-off-by: Andrzej Głąbek (cherry picked from commit 38cfef4e5b9f006259a4c837929650d560e6a78d) --- soc/common/nordic_nrf/Kconfig.peripherals | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index aa0d753d89a..01b53bbe651 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -536,3 +536,9 @@ config HAS_HW_NRF_WDT31 config HAS_HW_NRF_WDT130 def_bool $(dt_nodelabel_enabled_with_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) + +config HAS_HW_NRF_WDT131 + def_bool $(dt_nodelabel_enabled_with_compat,wdt131,$(DT_COMPAT_NORDIC_NRF_WDT)) + +config HAS_HW_NRF_WDT132 + def_bool $(dt_nodelabel_enabled_with_compat,wdt132,$(DT_COMPAT_NORDIC_NRF_WDT)) From 5a0c50e3d8f3e3117e5cc3bef201a528d1b9464d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Feb 2024 16:20:18 +0100 Subject: [PATCH 0604/2300] [nrf fromtree] soc: nordic_nrf: add missing GRTC Kconfig option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing option to select GRTC. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 349c06ebc5e7c7be7b39a57106ab989b590738f1) Signed-off-by: Andrzej Głąbek (cherry picked from commit ab0d6af736b634de495b9e599f46ccfa272b85bb) --- soc/common/nordic_nrf/Kconfig.peripherals | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 01b53bbe651..ca24384cf8e 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -90,6 +90,9 @@ config HAS_HW_NRF_GPIOTE130 config HAS_HW_NRF_GPIOTE131 def_bool $(dt_nodelabel_enabled_with_compat,gpiote131,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) +config HAS_HW_NRF_GRTC + def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GRTC)) + config HAS_HW_NRF_I2S0 def_bool $(dt_nodelabel_enabled_with_compat,i2s0,$(DT_COMPAT_NORDIC_NRF_I2S)) From 0c5f35d9ccc2b9aadfe492fbb3f75c8de485e749 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 17 Jan 2024 10:15:04 +0200 Subject: [PATCH 0605/2300] [nrf fromtree] net: socket: Allow user to tweak service dispatcher thread priority User is able to tweak the socket service dispatcher thread priority in order to get better performance from the system if needed. By default the dispatcher thread runs in lowest application thread priority (K_LOWEST_APPLICATION_THREAD_PRIO). Signed-off-by: Jukka Rissanen (cherry picked from commit 84ff0e8cdfa985b325d4e1004df6484ae1fa6fa0) Signed-off-by: Robert Lubos (cherry picked from commit c4fb0723bde01a328fd1218cf8970451ca2a3630) --- subsys/net/lib/sockets/Kconfig | 21 +++++++++++++++++++++ subsys/net/lib/sockets/sockets_service.c | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 35750dd3583..4d6c091b749 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -86,6 +86,27 @@ config NET_SOCKETS_SERVICE system needs as multiple services can be activated at the same time depending on network configuration. +config NET_SOCKETS_SERVICE_THREAD_PRIO + int "Priority of the socket service dispatcher thread" + default NUM_PREEMPT_PRIORITIES + 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. + + 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" default 2400 if NET_DHCPV4_SERVER diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index d253ece629c..2863de005ea 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -279,7 +279,9 @@ static void socket_service_thread(void) K_THREAD_DEFINE(socket_service_monitor, CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE, socket_service_thread, NULL, NULL, NULL, - K_LOWEST_APPLICATION_THREAD_PRIO, 0, 0); + CLAMP(CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO, + K_HIGHEST_APPLICATION_THREAD_PRIO, + K_LOWEST_APPLICATION_THREAD_PRIO), 0, 0); static int init_socket_service(void) { From 519263ac0f85ffeb2fe44715fdec88fd39a7a0ef Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 17 Jan 2024 18:45:09 +0200 Subject: [PATCH 0606/2300] [nrf fromtree] net: socket: Change the printf modifier to print size_t correctly The argument is size_t, so change the printf modifier to %zd to avoid warning prints. Signed-off-by: Jukka Rissanen (cherry picked from commit 5a933299bbfe33f32a78a2e0f6e730b60bd0f18f) Signed-off-by: Robert Lubos (cherry picked from commit bd9efc686964e110b5857ef71abc001bef837018) --- subsys/net/lib/sockets/sockets_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index 2863de005ea..19efef93add 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -196,7 +196,7 @@ static void socket_service_thread(void) if ((count + 1) > ARRAY_SIZE(ctx.events)) { NET_WARN("You have %d services to monitor but " - "%d poll entries configured.", + "%zd poll entries configured.", count + 1, ARRAY_SIZE(ctx.events)); NET_WARN("Consider increasing value of %s to %d", "CONFIG_NET_SOCKETS_POLL_MAX", count + 1); From 0098cf342ce11b201cf172b7b8f100f2f2761ce0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 29 Jan 2024 13:31:25 +0200 Subject: [PATCH 0607/2300] [nrf fromtree] net: socket: Start service thread from initialization function We cannot always start the service monitor thread statically because the static threads are started after the application level. This means that when config library wants to start dhcpv4 server which uses socket services, there would be a deadlock. Simplest solution is to start the service thread directly from socket service init function. Signed-off-by: Jukka Rissanen (cherry picked from commit b03c3c0c48c0771c4bf0141dde7380429c41f2f4) Signed-off-by: Robert Lubos (cherry picked from commit 48639d90925c68694c73299a8f4123a8c84b77f5) --- subsys/net/lib/sockets/sockets_service.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index 19efef93add..4c9270af116 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -277,15 +277,23 @@ static void socket_service_thread(void) k_condvar_broadcast(&wait_start); } -K_THREAD_DEFINE(socket_service_monitor, CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE, - socket_service_thread, NULL, NULL, NULL, - CLAMP(CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO, - K_HIGHEST_APPLICATION_THREAD_PRIO, - K_LOWEST_APPLICATION_THREAD_PRIO), 0, 0); - static int init_socket_service(void) { - k_thread_name_set(socket_service_monitor, "net_socket_service"); + k_tid_t ssm; + static struct k_thread service_thread; + + static K_THREAD_STACK_DEFINE(service_thread_stack, + CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE); + + ssm = k_thread_create(&service_thread, + service_thread_stack, + K_THREAD_STACK_SIZEOF(service_thread_stack), + (k_thread_entry_t)socket_service_thread, NULL, NULL, NULL, + CLAMP(CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO, + K_HIGHEST_APPLICATION_THREAD_PRIO, + K_LOWEST_APPLICATION_THREAD_PRIO), 0, K_NO_WAIT); + + k_thread_name_set(ssm, "net_socket_service"); return 0; } From 9b48bc1e5e648560b46ef2fca342290736bffecc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 20 Feb 2024 13:50:48 +0200 Subject: [PATCH 0608/2300] [nrf fromtree] net: sockets: Do not start service thread if too little resources If the CONFIG_NET_SOCKETS_POLL_MAX is smaller than what is needed for the socket service API to work properly, then we should not start the service thread as the service API cannot work and might cause memory overwrite in ctx.events[] array. Fixes #69233 Signed-off-by: Jukka Rissanen (cherry picked from commit ea189d5aeee1bfa728ecbc7818baa68d03d2a377) Signed-off-by: Robert Lubos (cherry picked from commit 461eb711814da02a0eea14f06b42515758205aa8) --- subsys/net/lib/sockets/sockets_service.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index 4c9270af116..89b653d31e5 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -195,11 +195,12 @@ static void socket_service_thread(void) } if ((count + 1) > ARRAY_SIZE(ctx.events)) { - NET_WARN("You have %d services to monitor but " - "%zd poll entries configured.", - count + 1, ARRAY_SIZE(ctx.events)); - NET_WARN("Consider increasing value of %s to %d", - "CONFIG_NET_SOCKETS_POLL_MAX", count + 1); + NET_ERR("You have %d services to monitor but " + "%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); + goto fail; } NET_DBG("Monitoring %d socket entries", count); From 0182e10ddd32d556e14c3551ade651fbedefca35 Mon Sep 17 00:00:00 2001 From: Herman Berget Date: Tue, 27 Feb 2024 09:29:38 +0100 Subject: [PATCH 0609/2300] [nrf fromtree] Bluetooth: hci: Add hw variant definitions for nrf54H/L Assign new numbers for new soc series and update string conversion function. Signed-off-by: Herman Berget (cherry picked from commit 9135de7a66940f651a38f6117082eec36e3281b3) Signed-off-by: Herman Berget (cherry picked from commit 0a1854bb2c1eba17490d1c82ba1f749a5745fc1e) --- include/zephyr/bluetooth/hci_vs.h | 2 ++ subsys/bluetooth/controller/hci/nordic/hci_vendor.h | 4 ++++ subsys/bluetooth/host/hci_core.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/hci_vs.h b/include/zephyr/bluetooth/hci_vs.h index aea92846e56..3561e20e9aa 100644 --- a/include/zephyr/bluetooth/hci_vs.h +++ b/include/zephyr/bluetooth/hci_vs.h @@ -47,6 +47,8 @@ extern "C" { #define BT_HCI_VS_HW_VAR_NORDIC_NRF51X 0x0001 #define BT_HCI_VS_HW_VAR_NORDIC_NRF52X 0x0002 #define BT_HCI_VS_HW_VAR_NORDIC_NRF53X 0x0003 +#define BT_HCI_VS_HW_VAR_NORDIC_NRF54HX 0x0004 +#define BT_HCI_VS_HW_VAR_NORDIC_NRF54LX 0x0005 #define BT_HCI_VS_FW_VAR_STANDARD_CTLR 0x0001 #define BT_HCI_VS_FW_VAR_VS_CTLR 0x0002 diff --git a/subsys/bluetooth/controller/hci/nordic/hci_vendor.h b/subsys/bluetooth/controller/hci/nordic/hci_vendor.h index bea7004f9c9..ecbe8968476 100644 --- a/subsys/bluetooth/controller/hci/nordic/hci_vendor.h +++ b/subsys/bluetooth/controller/hci/nordic/hci_vendor.h @@ -12,6 +12,10 @@ #define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF52X #elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) #define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF53X +#elif defined(CONFIG_SOC_SERIES_NRF54HX) +#define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF54HX +#elif defined(CONFIG_SOC_SERIES_NRF54LX) +#define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF54LX #endif #else #define BT_HCI_VS_HW_PLAT 0 diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index dbb79f3ecdd..9b72e5548bc 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -3558,7 +3558,7 @@ static const char *vs_hw_platform(uint16_t platform) static const char *vs_hw_variant(uint16_t platform, uint16_t variant) { static const char * const nordic_str[] = { - "reserved", "nRF51x", "nRF52x", "nRF53x" + "reserved", "nRF51x", "nRF52x", "nRF53x", "nRF54Hx", "nRF54Lx" }; if (platform != BT_HCI_VS_HW_PLAT_NORDIC) { From 7055b6a7204cef31d00ff4fe5c20ae0c07520c87 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 19 Feb 2024 11:26:12 +0100 Subject: [PATCH 0610/2300] [nrf fromtree] Bluetooth: Mesh: Enable CDP1 by default CDP1 is mandatory to qualify a mesh device for mesh protocol v1.1. The dependency on BT_MESH_MODEL_EXTENSIONS is removed because if a node contains only base models (for example Generic OnOff Server), this API will consume extra RAM bytes which won't be used. Signed-off-by: Pavel Vasilyev (cherry picked from commit e30b7a84bc421dc16e87c47deab1921186604830) Signed-off-by: Pavel Vasilyev (cherry picked from commit 7735bc6d171ab2fe6590ab47171f5decdbe2ddfd) --- subsys/bluetooth/mesh/Kconfig | 3 ++- subsys/bluetooth/mesh/access.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index e0b4761232c..ce845e995fd 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -712,7 +712,7 @@ config BT_MESH_MODEL_EXTENSIONS config BT_MESH_COMP_PAGE_1 bool "Support for Composition Data Page 1" - depends on BT_MESH_MODEL_EXTENSIONS + default y help Enable support for Composition Data Page 1. @@ -720,6 +720,7 @@ config BT_MESH_MODEL_EXTENSION_LIST_SIZE int "Model extensions list size" depends on BT_MESH_COMP_PAGE_1 range 0 255 + default 0 if !BT_MESH_MODEL_EXTENSIONS default 10 help This option specifies how many models relations can be saved. diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 4ff80333187..328ec0dd281 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -1066,13 +1066,13 @@ int bt_mesh_comp_register(const struct bt_mesh_comp *comp) err = 0; - if (IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { + if (MOD_REL_LIST_SIZE > 0) { memset(mod_rel_list, 0, sizeof(mod_rel_list)); } bt_mesh_model_foreach(mod_init, &err); - if (IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { + if (MOD_REL_LIST_SIZE > 0) { int i; MOD_REL_LIST_FOR_EACH(i) { @@ -1744,7 +1744,8 @@ static int mod_rel_register(const struct bt_mesh_model *base, return 0; } } - LOG_ERR("Failed to extend"); + + LOG_ERR("CONFIG_BT_MESH_MODEL_EXTENSION_LIST_SIZE is too small"); return -ENOMEM; } @@ -1784,8 +1785,11 @@ int bt_mesh_model_extend(const struct bt_mesh_model *extending_mod, } register_extension: - if (IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { + if (MOD_REL_LIST_SIZE > 0) { return mod_rel_register(base_mod, extending_mod, RELATION_TYPE_EXT); + } else if (IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { + LOG_ERR("CONFIG_BT_MESH_MODEL_EXTENSION_LIST_SIZE is too small"); + return -ENOMEM; } return 0; @@ -1797,7 +1801,7 @@ int bt_mesh_model_correspond(const struct bt_mesh_model *corresponding_mod, int i, err; uint8_t cor_id = 0; - if (!IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { + if (MOD_REL_LIST_SIZE == 0) { return -ENOTSUP; } From 11bb9ac66c152d0dfea62d615b63b6bf4ac5399b Mon Sep 17 00:00:00 2001 From: Kamil Piszczek Date: Tue, 7 Nov 2023 12:27:25 +0100 Subject: [PATCH 0611/2300] [nrf fromtree] settings: nvs: improve the name ID metadata handling on delete operation Improved the updates to the name ID metadata (NVS_NAMECNT_ID) item in the Settings NVS backend implementation. The improvements should make the implementation more robust in handling edge cases such as: power downs, resets or a case in which the storage partition is full. In the last case, the NVS backend could return an ENOSPC error in the context of the settings_delete API. This change also fixes this issue. Signed-off-by: Kamil Piszczek (cherry picked from commit 1ab08634f2799556e924cc8c7f70a60cd292ed4e) Signed-off-by: Pavel Vasilyev (cherry picked from commit d2a11c2c29080669187bb77b1d658821cd1986e9) --- subsys/settings/src/settings_nvs.c | 59 ++++++++++++++++++------------ 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/subsys/settings/src/settings_nvs.c b/subsys/settings/src/settings_nvs.c index 8e5bfbf3767..f1e53bfad22 100644 --- a/subsys/settings/src/settings_nvs.c +++ b/subsys/settings/src/settings_nvs.c @@ -147,6 +147,17 @@ static int settings_nvs_load(struct settings_store *cs, &buf, sizeof(buf)); if ((rc1 <= 0) && (rc2 <= 0)) { + /* Settings largest ID in use is invalid due to + * reset, power failure or partition overflow. + * Decrement it and check the next ID in subsequent + * iteration. + */ + if (name_id == cf->last_name_id) { + cf->last_name_id--; + nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, + &cf->last_name_id, sizeof(uint16_t)); + } + continue; } @@ -156,13 +167,15 @@ static int settings_nvs_load(struct settings_store *cs, * or deleted. Clean dirty entries to make space for * future settings item. */ + nvs_delete(&cf->cf_nvs, name_id); + nvs_delete(&cf->cf_nvs, name_id + NVS_NAME_ID_OFFSET); + if (name_id == cf->last_name_id) { cf->last_name_id--; nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, &cf->last_name_id, sizeof(uint16_t)); } - nvs_delete(&cf->cf_nvs, name_id); - nvs_delete(&cf->cf_nvs, name_id + NVS_NAME_ID_OFFSET); + continue; } @@ -254,6 +267,16 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, return 0; } + rc = nvs_delete(&cf->cf_nvs, name_id); + if (rc >= 0) { + rc = nvs_delete(&cf->cf_nvs, name_id + + NVS_NAME_ID_OFFSET); + } + + if (rc < 0) { + return rc; + } + if (name_id == cf->last_name_id) { cf->last_name_id--; rc = nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, @@ -266,17 +289,6 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, } } - rc = nvs_delete(&cf->cf_nvs, name_id); - - if (rc >= 0) { - rc = nvs_delete(&cf->cf_nvs, name_id + - NVS_NAME_ID_OFFSET); - } - - if (rc < 0) { - return rc; - } - return 0; } @@ -285,6 +297,16 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, return -ENOMEM; } + /* update the last_name_id and write to flash if required*/ + if (write_name_id > cf->last_name_id) { + cf->last_name_id = write_name_id; + rc = nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, &cf->last_name_id, + sizeof(uint16_t)); + if (rc < 0) { + return rc; + } + } + /* write the value */ rc = nvs_write(&cf->cf_nvs, write_name_id + NVS_NAME_ID_OFFSET, value, val_len); @@ -300,17 +322,6 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, } } - /* update the last_name_id and write to flash if required*/ - if (write_name_id > cf->last_name_id) { - cf->last_name_id = write_name_id; - rc = nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, &cf->last_name_id, - sizeof(uint16_t)); - } - - if (rc < 0) { - return rc; - } - return 0; } From 6ad928353c157b954ce3f8642846cba685c2a509 Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Mon, 12 Feb 2024 13:18:23 +0100 Subject: [PATCH 0612/2300] [nrf fromtree] settings: NVS: add entry into cache after writing Settings NVS adds entry into Settings NVS cache after writing it into flash. Previously, the entry was added into cache only on the second writing attempt that caused very huge timing despite cache was enabled since it was still empty. Signed-off-by: Aleksandr Khromykh (cherry picked from commit 6bb5076a2125e2446cf23e34139841cf320f2c40) Signed-off-by: Pavel Vasilyev (cherry picked from commit db40a0187d5ba025a23fac055517adac3ad46474) --- subsys/settings/src/settings_nvs.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/subsys/settings/src/settings_nvs.c b/subsys/settings/src/settings_nvs.c index f1e53bfad22..c6efa6cb289 100644 --- a/subsys/settings/src/settings_nvs.c +++ b/subsys/settings/src/settings_nvs.c @@ -216,10 +216,13 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, delete = ((value == NULL) || (val_len == 0)); #if CONFIG_SETTINGS_NVS_NAME_CACHE + bool name_in_cache = false; + name_id = settings_nvs_cache_match(cf, name, rdname, sizeof(rdname)); if (name_id != NVS_NAMECNT_ID) { write_name_id = name_id; write_name = false; + name_in_cache = true; goto found; } #endif @@ -251,9 +254,6 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, } if (!delete) { -#if CONFIG_SETTINGS_NVS_NAME_CACHE - settings_nvs_cache_add(cf, name, name_id); -#endif write_name_id = name_id; write_name = false; } @@ -322,6 +322,12 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, } } +#if CONFIG_SETTINGS_NVS_NAME_CACHE + if (!name_in_cache) { + settings_nvs_cache_add(cf, name, write_name_id); + } +#endif + return 0; } From bbbabb2d31d8a1b3cea6b12520442a089a04e291 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 15 Feb 2024 21:37:53 +0100 Subject: [PATCH 0613/2300] [nrf fromtree] settings: nvs: Fix first write issue with cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: When the setting nvs cache is disabled and `settings_nvs_save` is called, the function reads all stored setting name entries from NVS until either finds the desired setting name entry or reaches the last stored setting name entry. With the settings nvs cache enabled, `settings_nvs_save` runs through the cached setting name entries first. If the cached entry matches with the desired one, it immediately writes the new setting value to NVS that corresponds to the cached setting name entry. However, if the setting name entry is not found in the cache (which is the case for a new entry), `settings_nvs_save` reads all stored setting name entries from NVS again. This means that even if the number of stored entries in the settings is less than the cache size, for each new setting entry to be stored `settings_nvs_save` will first run through the cache, then read all stored setting name entries from NVS and only then will pick the next free name id for this new setting name entry and will finally store the new setting entry. This makes the cache ineffiсient for every new entry to be stored even when the cache size is always able to keep all setting entries that will be stored in NVS. Use-case: In the Bluetooth mesh there is a Replay Protection List which keeps sequence numbers of all nodes it received messages from. The RPL is stored persistently in NVS. The setting name entry is the source address of the node and the setting value entry is the sequence number. The common use case is when RPL is quite big (for example, 255 entries). With the current settings nvs cache implementation, every time the node stores a new RPL entry in settings (which is the first received message from a particular source address), `settings_nvs_save` will always check the cache first, then also read all stored entries in NVS and only then will figure out that this is a new entry. With every new RPL entry to be stored this search time increases. This behavior results in much worse performance in comparison with when the corresponding entry was already stored. E.g. on nRF52840, with bare minimal mesh stack configuration, when the cache is bigger than number of stored entries or close to it, storing of 255 RPL entries takes ~25 seconds. The time of subsequent store of 255 RPL entires is ~2 seconds with the cache. Solution: This commit improves the behavior of the first write by bypassing the reading from NVS if the following conditions are met: 1. `settings_nvs_load` was called, 2. the cache was not overflowed (bigger than the number of stored entries). As long as these 2 conditiones are met, it is safe to skip reading from NVS, pick the next free name id and write the value immediately. Signed-off-by: Pavel Vasilyev (cherry picked from commit a35bb6608d4029ccdc9c7fc42113018b142f8ba7) Signed-off-by: Pavel Vasilyev (cherry picked from commit 083222106e98fb886c82e1b71760c06396dc62fa) --- .../settings/include/settings/settings_nvs.h | 2 ++ subsys/settings/src/settings_nvs.c | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/subsys/settings/include/settings/settings_nvs.h b/subsys/settings/include/settings/settings_nvs.h index ce34e192c24..6db576da631 100644 --- a/subsys/settings/include/settings/settings_nvs.h +++ b/subsys/settings/include/settings/settings_nvs.h @@ -45,6 +45,8 @@ struct settings_nvs { } cache[CONFIG_SETTINGS_NVS_NAME_CACHE_SIZE]; uint16_t cache_next; + uint16_t cache_total; + bool loaded; #endif }; diff --git a/subsys/settings/src/settings_nvs.c b/subsys/settings/src/settings_nvs.c index c6efa6cb289..6764c7587a3 100644 --- a/subsys/settings/src/settings_nvs.c +++ b/subsys/settings/src/settings_nvs.c @@ -74,6 +74,8 @@ int settings_nvs_dst(struct settings_nvs *cf) } #if CONFIG_SETTINGS_NVS_NAME_CACHE +#define SETTINGS_NVS_CACHE_OVFL(cf) ((cf)->cache_total > ARRAY_SIZE((cf)->cache)) + static void settings_nvs_cache_add(struct settings_nvs *cf, const char *name, uint16_t name_id) { @@ -129,12 +131,22 @@ static int settings_nvs_load(struct settings_store *cs, ssize_t rc1, rc2; uint16_t name_id = NVS_NAMECNT_ID; +#if CONFIG_SETTINGS_NVS_NAME_CACHE + uint16_t cached = 0; + + cf->loaded = false; +#endif + name_id = cf->last_name_id + 1; while (1) { name_id--; if (name_id == NVS_NAMECNT_ID) { +#if CONFIG_SETTINGS_NVS_NAME_CACHE + cf->loaded = true; + cf->cache_total = cached; +#endif break; } @@ -186,6 +198,7 @@ static int settings_nvs_load(struct settings_store *cs, #if CONFIG_SETTINGS_NVS_NAME_CACHE settings_nvs_cache_add(cf, name, name_id); + cached++; #endif ret = settings_call_set_handler( @@ -231,6 +244,13 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, write_name_id = cf->last_name_id + 1; write_name = true; +#if CONFIG_SETTINGS_NVS_NAME_CACHE + /* We can skip reading NVS if we know that the cache wasn't overflowed. */ + if (cf->loaded && !SETTINGS_NVS_CACHE_OVFL(cf)) { + goto found; + } +#endif + while (1) { name_id--; if (name_id == NVS_NAMECNT_ID) { @@ -325,6 +345,9 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, #if CONFIG_SETTINGS_NVS_NAME_CACHE if (!name_in_cache) { settings_nvs_cache_add(cf, name, write_name_id); + if (cf->loaded && !SETTINGS_NVS_CACHE_OVFL(cf)) { + cf->cache_total++; + } } #endif From 62370cc9697084993eb3830163b7e7c6bbc320dc Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Fri, 9 Feb 2024 21:03:47 +0700 Subject: [PATCH 0614/2300] [nrf fromtree] net: shell: ensure the shell `sh` is valid before call shell_printf It is possible that the `sh` was not set before use. This change adds a NULL check for `sh` in the following macros: PR, PR_SHELL, PR_ERROR, PR_INFO, and PR_WARNING. In case `sh` is NULL, the above macros will call `printk` instead. Fixes #68793 Signed-off-by: Pisit Sawangvonganan (cherry picked from commit 7b8a9e1818f75a2a61ea40537a9d4299eb3225a6) Signed-off-by: Kapil Bhatt (cherry picked from commit e4827fba2254402b99a7be249974de4e0acbcba1) --- subsys/net/lib/shell/net_shell_private.h | 50 +++++++++++++++++++----- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/subsys/net/lib/shell/net_shell_private.h b/subsys/net/lib/shell/net_shell_private.h index 8b5566022d9..076bfd63d33 100644 --- a/subsys/net/lib/shell/net_shell_private.h +++ b/subsys/net/lib/shell/net_shell_private.h @@ -8,20 +8,50 @@ #include #include -#define PR(fmt, ...) \ - shell_fprintf(sh, SHELL_NORMAL, fmt, ##__VA_ARGS__) +#define PR(fmt, ...) \ + do { \ + if (sh) { \ + shell_fprintf(sh, SHELL_NORMAL, fmt, ##__VA_ARGS__); \ + } else { \ + printk(fmt, ##__VA_ARGS__); \ + } \ + } while (false) -#define PR_SHELL(sh, fmt, ...) \ - shell_fprintf(sh, SHELL_NORMAL, fmt, ##__VA_ARGS__) +#define PR_SHELL(sh, fmt, ...) \ + do { \ + if (sh) { \ + shell_fprintf(sh, SHELL_NORMAL, fmt, ##__VA_ARGS__); \ + } else { \ + printk(fmt, ##__VA_ARGS__); \ + } \ + } while (false) -#define PR_ERROR(fmt, ...) \ - shell_fprintf(sh, SHELL_ERROR, fmt, ##__VA_ARGS__) +#define PR_ERROR(fmt, ...) \ + do { \ + if (sh) { \ + shell_fprintf(sh, SHELL_ERROR, fmt, ##__VA_ARGS__); \ + } else { \ + printk(fmt, ##__VA_ARGS__); \ + } \ + } while (false) -#define PR_INFO(fmt, ...) \ - shell_fprintf(sh, SHELL_INFO, fmt, ##__VA_ARGS__) +#define PR_INFO(fmt, ...) \ + do { \ + if (sh) { \ + shell_fprintf(sh, SHELL_INFO, fmt, ##__VA_ARGS__); \ + } else { \ + printk(fmt, ##__VA_ARGS__); \ + } \ + } while (false) -#define PR_WARNING(fmt, ...) \ - shell_fprintf(sh, SHELL_WARNING, fmt, ##__VA_ARGS__) +#define PR_WARNING(fmt, ...) \ + do { \ + if (sh) { \ + shell_fprintf(sh, SHELL_WARNING, fmt, ##__VA_ARGS__); \ + } else { \ + printk(fmt, ##__VA_ARGS__); \ + } \ + } while (false) #include "net_private.h" #include "../ip/ipv6.h" From 46584250a7b9dcdb2dbad84175d6fee7ff489d26 Mon Sep 17 00:00:00 2001 From: Tomas Galbicka Date: Thu, 21 Dec 2023 14:15:22 +0000 Subject: [PATCH 0615/2300] [nrf fromtree] samples: mbox: Add support for NXP RT boards This commit adds mbox sample support for these NXP boards: - MIMXRT1160-EVK - MIMXRT1170-EVK - MIMXRT1170-EVKB Signed-off-by: Tomas Galbicka (cherry picked from commit d161d05e3390c373d532887e9e36eaa5e4663c19) (cherry picked from commit fc7d362601fe4c0581b111e79bbba6d6b8a9fecb) --- samples/drivers/mbox/CMakeLists.txt | 11 +++++ samples/drivers/mbox/Kconfig | 11 +++++ samples/drivers/mbox/Kconfig.sysbuild | 4 ++ .../mbox/boards/mimxrt1160_evk_cm7.conf | 3 ++ .../mbox/boards/mimxrt1160_evk_cm7.overlay | 29 +++++++++++ .../mbox/boards/mimxrt1170_evk_cm7.conf | 3 ++ .../mbox/boards/mimxrt1170_evk_cm7.overlay | 29 +++++++++++ .../mbox/boards/mimxrt1170_evkb_cm7.conf | 3 ++ .../mbox/boards/mimxrt1170_evkb_cm7.overlay | 29 +++++++++++ samples/drivers/mbox/remote/CMakeLists.txt | 4 ++ .../remote/boards/mimxrt1160_evk_cm4.conf | 4 ++ .../remote/boards/mimxrt1160_evk_cm4.overlay | 48 ++++++++++++++++++ .../remote/boards/mimxrt1170_evk_cm4.conf | 4 ++ .../remote/boards/mimxrt1170_evk_cm4.overlay | 48 ++++++++++++++++++ .../remote/boards/mimxrt1170_evkb_cm4.conf | 4 ++ .../remote/boards/mimxrt1170_evkb_cm4.overlay | 49 +++++++++++++++++++ samples/drivers/mbox/sample.yaml | 13 ++++- samples/drivers/mbox/sysbuild.cmake | 12 +++++ 18 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 samples/drivers/mbox/Kconfig create mode 100644 samples/drivers/mbox/boards/mimxrt1160_evk_cm7.conf create mode 100644 samples/drivers/mbox/boards/mimxrt1160_evk_cm7.overlay create mode 100644 samples/drivers/mbox/boards/mimxrt1170_evk_cm7.conf create mode 100644 samples/drivers/mbox/boards/mimxrt1170_evk_cm7.overlay create mode 100644 samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.conf create mode 100644 samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.overlay create mode 100644 samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.conf create mode 100644 samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.overlay create mode 100644 samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.conf create mode 100644 samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.overlay create mode 100644 samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.conf create mode 100644 samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index e65d44f0048..4344f4f3ce9 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -1,5 +1,6 @@ # # Copyright (c) 2021 Carlo Caione +# Copyright 2023 NXP # # SPDX-License-Identifier: Apache-2.0 # @@ -8,9 +9,14 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) + if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "adp_xc7k_ae350") OR + ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR + ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt595_evk_cm33")) message(STATUS "${BOARD} compile as Main in this sample") else() @@ -21,4 +27,9 @@ project(mbox_ipc) enable_language(C ASM) +if(CONFIG_INCLUDE_REMOTE_DIR) + target_include_directories(zephyr_interface + INTERFACE ${REMOTE_ZEPHYR_DIR}/include/public) +endif() + target_sources(app PRIVATE src/main.c) diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig new file mode 100644 index 00000000000..3837c49b6e9 --- /dev/null +++ b/samples/drivers/mbox/Kconfig @@ -0,0 +1,11 @@ +# Copyright 2023 NXP +# +# SPDX-License-Identifier: Apache-2.0 + +source "Kconfig.zephyr" + +config INCLUDE_REMOTE_DIR + bool "Include remote core header directory" + help + Include remote build header files. Can be used if primary image + needs to be aware of size or base address of secondary image diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 46ffe3e12ae..f472576df82 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -1,4 +1,5 @@ # Copyright 2023 Nordic Semiconductor ASA +# Copyright 2023 NXP # # SPDX-License-Identifier: Apache-2.0 @@ -10,3 +11,6 @@ string default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" default "adp_xc7k_ae350" if $(BOARD) = "adp_xc7k_ae350" default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "mimxrt595_evk_cm33" + default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" + default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" + default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" diff --git a/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.conf b/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.conf new file mode 100644 index 00000000000..583b4950360 --- /dev/null +++ b/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.conf @@ -0,0 +1,3 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_INCLUDE_REMOTE_DIR=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.overlay b/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.overlay new file mode 100644 index 00000000000..942f67ba6a9 --- /dev/null +++ b/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2023 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c48000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c48000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c48000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.conf b/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.conf new file mode 100644 index 00000000000..583b4950360 --- /dev/null +++ b/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.conf @@ -0,0 +1,3 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_INCLUDE_REMOTE_DIR=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.overlay b/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.overlay new file mode 100644 index 00000000000..942f67ba6a9 --- /dev/null +++ b/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2023 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c48000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c48000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c48000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.conf b/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.conf new file mode 100644 index 00000000000..0dfb100ed70 --- /dev/null +++ b/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.conf @@ -0,0 +1,3 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_SECOND_CORE_MCUX=y +CONFIG_INCLUDE_REMOTE_DIR=y diff --git a/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.overlay b/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.overlay new file mode 100644 index 00000000000..942f67ba6a9 --- /dev/null +++ b/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2023 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c48000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c48000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c48000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index 3aee2d96482..e7db9b8cadf 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -1,5 +1,6 @@ # # Copyright (c) 2021 Carlo Caione +# Copyright 2023 NXP # # SPDX-License-Identifier: Apache-2.0 # @@ -10,6 +11,9 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpunet") OR + ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR + ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR ("${BOARD}" STREQUAL "adp_xc7k_ae350")) message(STATUS "${BOARD} compile as remote in this sample") else() diff --git a/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.conf b/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.conf new file mode 100644 index 00000000000..0d36a72aec6 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.conf @@ -0,0 +1,4 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_BUILD_OUTPUT_INFO_HEADER=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.overlay b/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.overlay new file mode 100644 index 00000000000..cc05e9b96c1 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.overlay @@ -0,0 +1,48 @@ +/* + * Copyright 2023 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,flash = &ocram; + zephyr,console = &lpuart1; + zephyr,shell-uart = &lpuart1; + + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /delete-node/ gpt@400f0000; + + /* Replace GPT2 with another GPT kernel timer */ + gpt2_hw_timer:gpt@400f0000 { + compatible = "nxp,gpt-hw-timer"; + reg = <0x400f0000 0x4000>; + interrupts = <120 0>; + status = "okay"; + }; + + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c4c000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c4c000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c4c000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; + +/* Disable primary GPT timer */ +&gpt_hw_timer { + status = "disabled"; +}; diff --git a/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.conf b/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.conf new file mode 100644 index 00000000000..0d36a72aec6 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.conf @@ -0,0 +1,4 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_BUILD_OUTPUT_INFO_HEADER=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.overlay b/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.overlay new file mode 100644 index 00000000000..cc05e9b96c1 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.overlay @@ -0,0 +1,48 @@ +/* + * Copyright 2023 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,flash = &ocram; + zephyr,console = &lpuart1; + zephyr,shell-uart = &lpuart1; + + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /delete-node/ gpt@400f0000; + + /* Replace GPT2 with another GPT kernel timer */ + gpt2_hw_timer:gpt@400f0000 { + compatible = "nxp,gpt-hw-timer"; + reg = <0x400f0000 0x4000>; + interrupts = <120 0>; + status = "okay"; + }; + + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c4c000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c4c000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c4c000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; + +/* Disable primary GPT timer */ +&gpt_hw_timer { + status = "disabled"; +}; diff --git a/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.conf b/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.conf new file mode 100644 index 00000000000..0d36a72aec6 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.conf @@ -0,0 +1,4 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_BUILD_OUTPUT_INFO_HEADER=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.overlay b/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.overlay new file mode 100644 index 00000000000..392141712a9 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.overlay @@ -0,0 +1,49 @@ +/* + * Copyright 2023 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,flash = &ocram; + zephyr,console = &lpuart1; + zephyr,shell-uart = &lpuart1; + + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /delete-node/ gpt@400f0000; + + /* Replace GPT2 with another GPT kernel timer */ + gpt2_hw_timer:gpt@400f0000 { + compatible = "nxp,gpt-hw-timer"; + reg = <0x400f0000 0x4000>; + interrupts = <120 0>; + status = "okay"; + }; + + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c4c000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c4c000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c4c000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; + +}; + +/* Disable primary GPT timer */ +&gpt_hw_timer { + status = "disabled"; +}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index f7aa8953ea1..e8015cf7c25 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -9,9 +9,20 @@ tests: - nrf5340dk_nrf5340_cpuapp - adp_xc7k_ae350 - mimxrt595_evk_cm33 + - mimxrt1170_evkb_cm7 + - mimxrt1170_evk_cm7 + - mimxrt1160_evk_cm7 integration_platforms: - nrf5340dk_nrf5340_cpuapp - harness: remote + harness: console + harness_config: + type: multi_line + ordered: false + regex: + - "Ping \\(on channel 0\\)" + - "Pong \\(on channel 0\\)" + - "Ping \\(on channel 1\\)" + - "Pong \\(on channel 1\\)" sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp diff --git a/samples/drivers/mbox/sysbuild.cmake b/samples/drivers/mbox/sysbuild.cmake index a8dfb8ebdf4..7a5d32d4c74 100644 --- a/samples/drivers/mbox/sysbuild.cmake +++ b/samples/drivers/mbox/sysbuild.cmake @@ -1,4 +1,5 @@ # Copyright (c) 2023 Nordic Semiconductor ASA +# Copyright 2023 NXP # SPDX-License-Identifier: Apache-2.0 if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") @@ -18,3 +19,14 @@ ExternalZephyrProject_Add( native_simulator_set_child_images(${DEFAULT_IMAGE} ${REMOTE_APP}) native_simulator_set_final_executable(${DEFAULT_IMAGE}) + +if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR + "${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR + "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" + ) + # For these NXP boards the main core application is dependent on + # 'zephyr_image_info.h' generated by remote application. + + # Let's build the remote application first + add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) +endif() From 4776a21ef6c2afa4a77d120f4402e63ffa4e2a01 Mon Sep 17 00:00:00 2001 From: Tomas Galbicka Date: Fri, 12 Jan 2024 15:48:59 +0100 Subject: [PATCH 0616/2300] [nrf fromtree] samples: mbox: Add mbox sample with data transfer This commits add mbox sample which supports transfering of 4 bytes of data between cores. Signed-off-by: Tomas Galbicka (cherry picked from commit e776051cadfd9d723be6cbebeb2a41d2f94aec6a) (cherry picked from commit 6d7dc5e730dde6fc1aa91819a3e6c44d1fe109f6) --- samples/drivers/mbox_data/CMakeLists.txt | 29 ++++++ samples/drivers/mbox_data/Kconfig | 11 +++ samples/drivers/mbox_data/Kconfig.sysbuild | 11 +++ samples/drivers/mbox_data/README.rst | 95 +++++++++++++++++++ .../mbox_data/boards/mimxrt1160_evk_cm7.conf | 3 + .../boards/mimxrt1160_evk_cm7.overlay | 29 ++++++ .../mbox_data/boards/mimxrt1170_evk_cm7.conf | 3 + .../boards/mimxrt1170_evk_cm7.overlay | 29 ++++++ .../mbox_data/boards/mimxrt1170_evkb_cm7.conf | 3 + .../boards/mimxrt1170_evkb_cm7.overlay | 29 ++++++ samples/drivers/mbox_data/prj.conf | 2 + .../drivers/mbox_data/remote/CMakeLists.txt | 20 ++++ .../remote/boards/mimxrt1160_evk_cm4.conf | 4 + .../remote/boards/mimxrt1160_evk_cm4.overlay | 54 +++++++++++ .../remote/boards/mimxrt1170_evk_cm4.conf | 4 + .../remote/boards/mimxrt1170_evk_cm4.overlay | 54 +++++++++++ .../remote/boards/mimxrt1170_evkb_cm4.conf | 4 + .../remote/boards/mimxrt1170_evkb_cm4.overlay | 55 +++++++++++ samples/drivers/mbox_data/remote/prj.conf | 2 + samples/drivers/mbox_data/remote/src/main.c | 75 +++++++++++++++ samples/drivers/mbox_data/sample.yaml | 27 ++++++ samples/drivers/mbox_data/src/main.c | 74 +++++++++++++++ samples/drivers/mbox_data/sysbuild.cmake | 28 ++++++ 23 files changed, 645 insertions(+) create mode 100644 samples/drivers/mbox_data/CMakeLists.txt create mode 100644 samples/drivers/mbox_data/Kconfig create mode 100644 samples/drivers/mbox_data/Kconfig.sysbuild create mode 100644 samples/drivers/mbox_data/README.rst create mode 100644 samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.conf create mode 100644 samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.overlay create mode 100644 samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.conf create mode 100644 samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.overlay create mode 100644 samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.conf create mode 100644 samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.overlay create mode 100644 samples/drivers/mbox_data/prj.conf create mode 100644 samples/drivers/mbox_data/remote/CMakeLists.txt create mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf create mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay create mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf create mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay create mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf create mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay create mode 100644 samples/drivers/mbox_data/remote/prj.conf create mode 100644 samples/drivers/mbox_data/remote/src/main.c create mode 100644 samples/drivers/mbox_data/sample.yaml create mode 100644 samples/drivers/mbox_data/src/main.c create mode 100644 samples/drivers/mbox_data/sysbuild.cmake diff --git a/samples/drivers/mbox_data/CMakeLists.txt b/samples/drivers/mbox_data/CMakeLists.txt new file mode 100644 index 00000000000..a67552bf52e --- /dev/null +++ b/samples/drivers/mbox_data/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) + +if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR + ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) + message(STATUS "${BOARD} compile as Main in this sample") +else() + message(FATAL_ERROR "${BOARD} is not supported for this sample") +endif() + +project(mbox_data_ipc) + +enable_language(C ASM) + +if(CONFIG_INCLUDE_REMOTE_DIR) + target_include_directories(zephyr_interface + INTERFACE ${REMOTE_ZEPHYR_DIR}/include/public) +endif() + +target_sources(app PRIVATE src/main.c) diff --git a/samples/drivers/mbox_data/Kconfig b/samples/drivers/mbox_data/Kconfig new file mode 100644 index 00000000000..ee3874c39f9 --- /dev/null +++ b/samples/drivers/mbox_data/Kconfig @@ -0,0 +1,11 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 + +source "Kconfig.zephyr" + +config INCLUDE_REMOTE_DIR + bool "Include remote core header directory" + help + Include remote build header files. Can be used if primary image + needs to be aware of size or base address of secondary image diff --git a/samples/drivers/mbox_data/Kconfig.sysbuild b/samples/drivers/mbox_data/Kconfig.sysbuild new file mode 100644 index 00000000000..e355713e714 --- /dev/null +++ b/samples/drivers/mbox_data/Kconfig.sysbuild @@ -0,0 +1,11 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 + +source "share/sysbuild/Kconfig" + +config REMOTE_BOARD +string + default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" + default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" + default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" diff --git a/samples/drivers/mbox_data/README.rst b/samples/drivers/mbox_data/README.rst new file mode 100644 index 00000000000..3ead1ec3b87 --- /dev/null +++ b/samples/drivers/mbox_data/README.rst @@ -0,0 +1,95 @@ +.. zephyr:code-sample:: mbox_data + :name: MBOX Data + :relevant-api: mbox_interface + + Perform inter-processor mailbox communication using the MBOX API with data. + +Overview +******** + +This sample demonstrates how to use the :ref:`MBOX API ` in data transfer mode. +It can be used only with mbox driver which supports data transfer mode. + +Sample will ping-pong 4 bytes of data between two cores via two mbox channels. +After each core receives data, it increments it by one and sends it back to other core. + +Building and Running +******************** + +The sample can be built and executed on boards supporting MBOX with data transfer mode. + +Building the application for mimxrt1160_evk_cm7 +=============================================== + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/mbox_data/ + :board: mimxrt1160_evk_cm7 + :goals: debug + :west-args: --sysbuild + +Building the application for mimxrt1170_evk_cm7 +=============================================== + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/mbox_data/ + :board: mimxrt1170_evk_cm7 + :goals: debug + :west-args: --sysbuild + +Building the application for mimxrt1170_evkb_cm7 +================================================ + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/mbox_data/ + :board: mimxrt1170_evkb_cm7 + :goals: debug + :west-args: --sysbuild + +Sample Output +============= + +Open a serial terminal (minicom, putty, etc.) and connect the board with the +following settings: + +- Speed: 115200 +- Data: 8 bits +- Parity: None +- Stop bits: 1 + +Reset the board and the following message will appear on the corresponding +serial port, one is the main core another is the remote core: + +.. code-block:: console + + *** Booting Zephyr OS build zephyr-v3.5.0-4051-g12f4f4dc8679 *** + mbox_data Client demo started + Client send (on channel 3) value: 0 + Client received (on channel 2) value: 1 + Client send (on channel 3) value: 2 + Client received (on channel 2) value: 3 + Client send (on channel 3) value: 4 + ... + Client received (on channel 2) value: 95 + Client send (on channel 3) value: 96 + Client received (on channel 2) value: 97 + Client send (on channel 3) value: 98 + Client received (on channel 2) value: 99 + mbox_data Client demo ended + + +.. code-block:: console + + *** Booting Zephyr OS build zephyr-v3.5.0-4051-g12f4f4dc8679 *** + mbox_data Server demo started + Server receive (on channel 3) value: 0 + Server send (on channel 2) value: 1 + Server receive (on channel 3) value: 2 + Server send (on channel 2) value: 3 + Server receive (on channel 3) value: 4 + ... + Server send (on channel 2) value: 95 + Server receive (on channel 3) value: 96 + Server send (on channel 2) value: 97 + Server receive (on channel 3) value: 98 + Server send (on channel 2) value: 99 + mbox_data Server demo ended. diff --git a/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.conf b/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.conf new file mode 100644 index 00000000000..583b4950360 --- /dev/null +++ b/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.conf @@ -0,0 +1,3 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_INCLUDE_REMOTE_DIR=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.overlay b/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.overlay new file mode 100644 index 00000000000..870b9928faf --- /dev/null +++ b/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c48000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c48000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c48000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.conf b/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.conf new file mode 100644 index 00000000000..583b4950360 --- /dev/null +++ b/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.conf @@ -0,0 +1,3 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_INCLUDE_REMOTE_DIR=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.overlay b/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.overlay new file mode 100644 index 00000000000..870b9928faf --- /dev/null +++ b/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c48000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c48000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c48000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.conf b/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.conf new file mode 100644 index 00000000000..0dfb100ed70 --- /dev/null +++ b/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.conf @@ -0,0 +1,3 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_SECOND_CORE_MCUX=y +CONFIG_INCLUDE_REMOTE_DIR=y diff --git a/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.overlay b/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.overlay new file mode 100644 index 00000000000..870b9928faf --- /dev/null +++ b/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c48000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c48000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c48000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/samples/drivers/mbox_data/prj.conf b/samples/drivers/mbox_data/prj.conf new file mode 100644 index 00000000000..293e2834f25 --- /dev/null +++ b/samples/drivers/mbox_data/prj.conf @@ -0,0 +1,2 @@ +CONFIG_PRINTK=y +CONFIG_MBOX=y diff --git a/samples/drivers/mbox_data/remote/CMakeLists.txt b/samples/drivers/mbox_data/remote/CMakeLists.txt new file mode 100644 index 00000000000..31f6db9b641 --- /dev/null +++ b/samples/drivers/mbox_data/remote/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR + ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) + message(STATUS "${BOARD} compile as remote in this sample") +else() + message(FATAL_ERROR "${BOARD} is not supported for this sample") +endif() + +project(mbox_data_ipc_remote) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf b/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf new file mode 100644 index 00000000000..0d36a72aec6 --- /dev/null +++ b/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf @@ -0,0 +1,4 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_BUILD_OUTPUT_INFO_HEADER=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay b/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay new file mode 100644 index 00000000000..3f6115b9c58 --- /dev/null +++ b/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay @@ -0,0 +1,54 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,flash = &ocram; + zephyr,console = &lpuart2; + zephyr,shell-uart = &lpuart2; + + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /delete-node/ gpt@400f0000; + + /* Replace GPT2 with another GPT kernel timer */ + gpt2_hw_timer:gpt@400f0000 { + compatible = "nxp,gpt-hw-timer"; + reg = <0x400f0000 0x4000>; + interrupts = <120 0>; + status = "okay"; + }; + + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c4c000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c4c000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c4c000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; + +/* Enable secondary LPUART */ +&lpuart2 { + status = "okay"; + current-speed = <115200>; +}; + +/* Disable primary GPT timer */ +&gpt_hw_timer { + status = "disabled"; +}; diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf new file mode 100644 index 00000000000..0d36a72aec6 --- /dev/null +++ b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf @@ -0,0 +1,4 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_BUILD_OUTPUT_INFO_HEADER=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay new file mode 100644 index 00000000000..3f6115b9c58 --- /dev/null +++ b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay @@ -0,0 +1,54 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,flash = &ocram; + zephyr,console = &lpuart2; + zephyr,shell-uart = &lpuart2; + + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /delete-node/ gpt@400f0000; + + /* Replace GPT2 with another GPT kernel timer */ + gpt2_hw_timer:gpt@400f0000 { + compatible = "nxp,gpt-hw-timer"; + reg = <0x400f0000 0x4000>; + interrupts = <120 0>; + status = "okay"; + }; + + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c4c000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c4c000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c4c000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; + +/* Enable secondary LPUART */ +&lpuart2 { + status = "okay"; + current-speed = <115200>; +}; + +/* Disable primary GPT timer */ +&gpt_hw_timer { + status = "disabled"; +}; diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf new file mode 100644 index 00000000000..0d36a72aec6 --- /dev/null +++ b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf @@ -0,0 +1,4 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_BUILD_OUTPUT_INFO_HEADER=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay new file mode 100644 index 00000000000..e3576826702 --- /dev/null +++ b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay @@ -0,0 +1,55 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,flash = &ocram; + zephyr,console = &lpuart2; + zephyr,shell-uart = &lpuart2; + + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /delete-node/ gpt@400f0000; + + /* Replace GPT2 with another GPT kernel timer */ + gpt2_hw_timer:gpt@400f0000 { + compatible = "nxp,gpt-hw-timer"; + reg = <0x400f0000 0x4000>; + interrupts = <120 0>; + status = "okay"; + }; + + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c4c000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c4c000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c4c000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; + +}; + +/* Enable secondary LPUART */ +&lpuart2 { + status = "okay"; + current-speed = <115200>; +}; + +/* Disable primary GPT timer */ +&gpt_hw_timer { + status = "disabled"; +}; diff --git a/samples/drivers/mbox_data/remote/prj.conf b/samples/drivers/mbox_data/remote/prj.conf new file mode 100644 index 00000000000..473e4280601 --- /dev/null +++ b/samples/drivers/mbox_data/remote/prj.conf @@ -0,0 +1,2 @@ +CONFIG_STDOUT_CONSOLE=n +CONFIG_MBOX=y diff --git a/samples/drivers/mbox_data/remote/src/main.c b/samples/drivers/mbox_data/remote/src/main.c new file mode 100644 index 00000000000..9fccf155c23 --- /dev/null +++ b/samples/drivers/mbox_data/remote/src/main.c @@ -0,0 +1,75 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +static K_SEM_DEFINE(g_mbox_data_rx_sem, 0, 1); + +static uint32_t g_mbox_received_data; +static uint32_t g_mbox_received_channel; + +#define TX_ID (2) +#define RX_ID (3) + +static void callback(const struct device *dev, uint32_t channel, void *user_data, + struct mbox_msg *data) +{ + memcpy(&g_mbox_received_data, data->data, data->size); + g_mbox_received_channel = channel; + + k_sem_give(&g_mbox_data_rx_sem); +} + +int main(void) +{ + struct mbox_channel tx_channel; + struct mbox_channel rx_channel; + const struct device *dev; + struct mbox_msg msg = {0}; + uint32_t message = 0; + + printk("mbox_data Server demo started\n"); + + dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + + mbox_init_channel(&tx_channel, dev, TX_ID); + mbox_init_channel(&rx_channel, dev, RX_ID); + + if (mbox_register_callback(&rx_channel, callback, NULL)) { + printk("mbox_register_callback() error\n"); + return 0; + } + + if (mbox_set_enabled(&rx_channel, 1)) { + printk("mbox_set_enable() error\n"); + return 0; + } + + while (message < 99) { + k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); + message = g_mbox_received_data; + + printk("Server receive (on channel %d) value: %d\n", g_mbox_received_channel, + g_mbox_received_data); + + message++; + + msg.data = &message; + msg.size = 4; + + printk("Server send (on channel %d) value: %d\n", tx_channel.id, message); + if (mbox_send(&tx_channel, &msg) < 0) { + printk("mbox_send() error\n"); + return 0; + } + } + + printk("mbox_data Server demo ended.\n"); + return 0; +} diff --git a/samples/drivers/mbox_data/sample.yaml b/samples/drivers/mbox_data/sample.yaml new file mode 100644 index 00000000000..5484233b2e8 --- /dev/null +++ b/samples/drivers/mbox_data/sample.yaml @@ -0,0 +1,27 @@ +sample: + name: MBOX Data IPC sample +common: + sysbuild: true + tags: mbox +tests: + sample.drivers.mbox_data.real_hw: + platform_allow: + - mimxrt1170_evkb_cm7 + - mimxrt1170_evk_cm7 + - mimxrt1160_evk_cm7 + integration_platforms: + - mimxrt1160_evk_cm7 + harness: console + harness_config: + type: multi_line + ordered: false + regex: + - "Client received \\(on channel 2\\) value: 1" + - "Client send \\(on channel 3\\) value: 2" + - "Client received \\(on channel 2\\) value: 3" + - "Client send \\(on channel 3\\) value: 4" + - "Client received \\(on channel 2\\) value: 41" + - "Client send \\(on channel 3\\) value: 42" + - "Client received \\(on channel 2\\) value: 97" + - "Client send \\(on channel 3\\) value: 98" + - "Client received \\(on channel 2\\) value: 99" diff --git a/samples/drivers/mbox_data/src/main.c b/samples/drivers/mbox_data/src/main.c new file mode 100644 index 00000000000..27c29b07554 --- /dev/null +++ b/samples/drivers/mbox_data/src/main.c @@ -0,0 +1,74 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +static K_SEM_DEFINE(g_mbox_data_rx_sem, 0, 1); + +static uint32_t g_mbox_received_data; +static uint32_t g_mbox_received_channel; + +#define TX_ID (3) +#define RX_ID (2) + +static void callback(const struct device *dev, uint32_t channel, void *user_data, + struct mbox_msg *data) +{ + memcpy(&g_mbox_received_data, data->data, data->size); + g_mbox_received_channel = channel; + + k_sem_give(&g_mbox_data_rx_sem); +} + +int main(void) +{ + struct mbox_channel tx_channel; + struct mbox_channel rx_channel; + const struct device *dev; + struct mbox_msg msg = {0}; + uint32_t message = 0; + + printk("mbox_data Client demo started\n"); + + dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + + mbox_init_channel(&tx_channel, dev, TX_ID); + mbox_init_channel(&rx_channel, dev, RX_ID); + + if (mbox_register_callback(&rx_channel, callback, NULL)) { + printk("mbox_register_callback() error\n"); + return 0; + } + + if (mbox_set_enabled(&rx_channel, 1)) { + printk("mbox_set_enable() error\n"); + return 0; + } + + while (message < 100) { + msg.data = &message; + msg.size = 4; + + printk("Client send (on channel %d) value: %d\n", tx_channel.id, message); + if (mbox_send(&tx_channel, &msg) < 0) { + printk("mbox_send() error\n"); + return 0; + } + + k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); + message = g_mbox_received_data; + + printk("Client received (on channel %d) value: %d\n", g_mbox_received_channel, + message); + message++; + } + + printk("mbox_data Client demo ended\n"); + return 0; +} diff --git a/samples/drivers/mbox_data/sysbuild.cmake b/samples/drivers/mbox_data/sysbuild.cmake new file mode 100644 index 00000000000..5c536a6229a --- /dev/null +++ b/samples/drivers/mbox_data/sysbuild.cmake @@ -0,0 +1,28 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 + +if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") + message(FATAL_ERROR + "Target ${BOARD} not supported for this sample. " + "There is no remote board selected in Kconfig.sysbuild") +endif() + +set(REMOTE_APP remote) + +ExternalZephyrProject_Add( + APPLICATION ${REMOTE_APP} + SOURCE_DIR ${APP_DIR}/${REMOTE_APP} + BOARD ${SB_CONFIG_REMOTE_BOARD} +) + +if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR + "${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR + "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" + ) + # For these NXP boards the main core application is dependent on + # 'zephyr_image_info.h' generated by remote application. + + # Let's build the remote application first + add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) +endif() From 881419f4f5dfc5bcd9402404112c1d09b16bd5d3 Mon Sep 17 00:00:00 2001 From: Tomas Galbicka Date: Fri, 12 Jan 2024 15:50:35 +0100 Subject: [PATCH 0617/2300] [nrf fromtree] tests: mbox: Add test for mbox with data transfer This commit adds extended test for mbox driver with data transfer to verify correct mbox functionality. Signed-off-by: Tomas Galbicka (cherry picked from commit 554f2ba08e13f48571c3b91c824b4be41c4848b6) (cherry picked from commit 8cad9dc1dddb9574546458ce516c999ca662c4cd) --- tests/drivers/mbox/mbox_data/CMakeLists.txt | 29 +++ tests/drivers/mbox/mbox_data/Kconfig | 11 ++ tests/drivers/mbox/mbox_data/Kconfig.sysbuild | 11 ++ .../mbox_data/boards/mimxrt1160_evk_cm7.conf | 3 + .../boards/mimxrt1160_evk_cm7.overlay | 29 +++ .../mbox_data/boards/mimxrt1170_evk_cm7.conf | 3 + .../boards/mimxrt1170_evk_cm7.overlay | 29 +++ .../mbox_data/boards/mimxrt1170_evkb_cm7.conf | 3 + .../boards/mimxrt1170_evkb_cm7.overlay | 29 +++ tests/drivers/mbox/mbox_data/prj.conf | 3 + .../mbox/mbox_data/remote/CMakeLists.txt | 20 ++ .../remote/boards/mimxrt1160_evk_cm4.conf | 4 + .../remote/boards/mimxrt1160_evk_cm4.overlay | 54 +++++ .../remote/boards/mimxrt1170_evk_cm4.conf | 4 + .../remote/boards/mimxrt1170_evk_cm4.overlay | 54 +++++ .../remote/boards/mimxrt1170_evkb_cm4.conf | 4 + .../remote/boards/mimxrt1170_evkb_cm4.overlay | 55 ++++++ tests/drivers/mbox/mbox_data/remote/prj.conf | 3 + .../drivers/mbox/mbox_data/remote/src/main.c | 91 +++++++++ tests/drivers/mbox/mbox_data/src/main.c | 184 ++++++++++++++++++ tests/drivers/mbox/mbox_data/sysbuild.cmake | 28 +++ tests/drivers/mbox/mbox_data/testcase.yaml | 12 ++ 22 files changed, 663 insertions(+) create mode 100644 tests/drivers/mbox/mbox_data/CMakeLists.txt create mode 100644 tests/drivers/mbox/mbox_data/Kconfig create mode 100644 tests/drivers/mbox/mbox_data/Kconfig.sysbuild create mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.conf create mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.overlay create mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.conf create mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.overlay create mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.conf create mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.overlay create mode 100644 tests/drivers/mbox/mbox_data/prj.conf create mode 100644 tests/drivers/mbox/mbox_data/remote/CMakeLists.txt create mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf create mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay create mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf create mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay create mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf create mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay create mode 100644 tests/drivers/mbox/mbox_data/remote/prj.conf create mode 100644 tests/drivers/mbox/mbox_data/remote/src/main.c create mode 100644 tests/drivers/mbox/mbox_data/src/main.c create mode 100644 tests/drivers/mbox/mbox_data/sysbuild.cmake create mode 100644 tests/drivers/mbox/mbox_data/testcase.yaml diff --git a/tests/drivers/mbox/mbox_data/CMakeLists.txt b/tests/drivers/mbox/mbox_data/CMakeLists.txt new file mode 100644 index 00000000000..a67552bf52e --- /dev/null +++ b/tests/drivers/mbox/mbox_data/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) + +if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR + ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) + message(STATUS "${BOARD} compile as Main in this sample") +else() + message(FATAL_ERROR "${BOARD} is not supported for this sample") +endif() + +project(mbox_data_ipc) + +enable_language(C ASM) + +if(CONFIG_INCLUDE_REMOTE_DIR) + target_include_directories(zephyr_interface + INTERFACE ${REMOTE_ZEPHYR_DIR}/include/public) +endif() + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/mbox/mbox_data/Kconfig b/tests/drivers/mbox/mbox_data/Kconfig new file mode 100644 index 00000000000..ee3874c39f9 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/Kconfig @@ -0,0 +1,11 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 + +source "Kconfig.zephyr" + +config INCLUDE_REMOTE_DIR + bool "Include remote core header directory" + help + Include remote build header files. Can be used if primary image + needs to be aware of size or base address of secondary image diff --git a/tests/drivers/mbox/mbox_data/Kconfig.sysbuild b/tests/drivers/mbox/mbox_data/Kconfig.sysbuild new file mode 100644 index 00000000000..e355713e714 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/Kconfig.sysbuild @@ -0,0 +1,11 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 + +source "share/sysbuild/Kconfig" + +config REMOTE_BOARD +string + default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" + default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" + default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.conf b/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.conf new file mode 100644 index 00000000000..583b4950360 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.conf @@ -0,0 +1,3 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_INCLUDE_REMOTE_DIR=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.overlay b/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.overlay new file mode 100644 index 00000000000..870b9928faf --- /dev/null +++ b/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c48000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c48000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c48000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.conf b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.conf new file mode 100644 index 00000000000..583b4950360 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.conf @@ -0,0 +1,3 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_INCLUDE_REMOTE_DIR=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.overlay b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.overlay new file mode 100644 index 00000000000..870b9928faf --- /dev/null +++ b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c48000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c48000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c48000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.conf b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.conf new file mode 100644 index 00000000000..0dfb100ed70 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.conf @@ -0,0 +1,3 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_SECOND_CORE_MCUX=y +CONFIG_INCLUDE_REMOTE_DIR=y diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.overlay b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.overlay new file mode 100644 index 00000000000..870b9928faf --- /dev/null +++ b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c48000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c48000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c48000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/tests/drivers/mbox/mbox_data/prj.conf b/tests/drivers/mbox/mbox_data/prj.conf new file mode 100644 index 00000000000..c4c2b474a7d --- /dev/null +++ b/tests/drivers/mbox/mbox_data/prj.conf @@ -0,0 +1,3 @@ +CONFIG_PRINTK=y +CONFIG_MBOX=y +CONFIG_ZTEST=y diff --git a/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt b/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt new file mode 100644 index 00000000000..31f6db9b641 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR + ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) + message(STATUS "${BOARD} compile as remote in this sample") +else() + message(FATAL_ERROR "${BOARD} is not supported for this sample") +endif() + +project(mbox_data_ipc_remote) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf new file mode 100644 index 00000000000..0d36a72aec6 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf @@ -0,0 +1,4 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_BUILD_OUTPUT_INFO_HEADER=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay new file mode 100644 index 00000000000..3f6115b9c58 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay @@ -0,0 +1,54 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,flash = &ocram; + zephyr,console = &lpuart2; + zephyr,shell-uart = &lpuart2; + + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /delete-node/ gpt@400f0000; + + /* Replace GPT2 with another GPT kernel timer */ + gpt2_hw_timer:gpt@400f0000 { + compatible = "nxp,gpt-hw-timer"; + reg = <0x400f0000 0x4000>; + interrupts = <120 0>; + status = "okay"; + }; + + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c4c000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c4c000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c4c000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; + +/* Enable secondary LPUART */ +&lpuart2 { + status = "okay"; + current-speed = <115200>; +}; + +/* Disable primary GPT timer */ +&gpt_hw_timer { + status = "disabled"; +}; diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf new file mode 100644 index 00000000000..0d36a72aec6 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf @@ -0,0 +1,4 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_BUILD_OUTPUT_INFO_HEADER=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay new file mode 100644 index 00000000000..3f6115b9c58 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay @@ -0,0 +1,54 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,flash = &ocram; + zephyr,console = &lpuart2; + zephyr,shell-uart = &lpuart2; + + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /delete-node/ gpt@400f0000; + + /* Replace GPT2 with another GPT kernel timer */ + gpt2_hw_timer:gpt@400f0000 { + compatible = "nxp,gpt-hw-timer"; + reg = <0x400f0000 0x4000>; + interrupts = <120 0>; + status = "okay"; + }; + + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c4c000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c4c000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c4c000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; + +/* Enable secondary LPUART */ +&lpuart2 { + status = "okay"; + current-speed = <115200>; +}; + +/* Disable primary GPT timer */ +&gpt_hw_timer { + status = "disabled"; +}; diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf new file mode 100644 index 00000000000..0d36a72aec6 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf @@ -0,0 +1,4 @@ +CONFIG_MBOX_NXP_IMX_MU=y +CONFIG_BUILD_OUTPUT_INFO_HEADER=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay new file mode 100644 index 00000000000..e3576826702 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay @@ -0,0 +1,55 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,flash = &ocram; + zephyr,console = &lpuart2; + zephyr,shell-uart = &lpuart2; + + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /delete-node/ gpt@400f0000; + + /* Replace GPT2 with another GPT kernel timer */ + gpt2_hw_timer:gpt@400f0000 { + compatible = "nxp,gpt-hw-timer"; + reg = <0x400f0000 0x4000>; + interrupts = <120 0>; + status = "okay"; + }; + + /* Delete IPM Driver node nxp,imx-mu */ + /delete-node/ mailbox@40c4c000; + + /* Attach MBOX driver to MU Unit */ + mbox:mbox@40c4c000 { + compatible = "nxp,mbox-imx-mu"; + reg = <0x40c4c000 0x4000>; + interrupts = <118 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; + +}; + +/* Enable secondary LPUART */ +&lpuart2 { + status = "okay"; + current-speed = <115200>; +}; + +/* Disable primary GPT timer */ +&gpt_hw_timer { + status = "disabled"; +}; diff --git a/tests/drivers/mbox/mbox_data/remote/prj.conf b/tests/drivers/mbox/mbox_data/remote/prj.conf new file mode 100644 index 00000000000..f2859becbe9 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/prj.conf @@ -0,0 +1,3 @@ +CONFIG_STDOUT_CONSOLE=n +CONFIG_MBOX=y +# CONFIG_NO_OPTIMIZATIONS=y diff --git a/tests/drivers/mbox/mbox_data/remote/src/main.c b/tests/drivers/mbox/mbox_data/remote/src/main.c new file mode 100644 index 00000000000..7bbc1c2efd0 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/src/main.c @@ -0,0 +1,91 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +static K_SEM_DEFINE(g_mbox_data_rx_sem, 0, 1); + +static uint32_t g_mbox_received_data; +static uint32_t g_mbox_received_channel; + +#define TX_ID0 (2) +#define RX_ID0 (3) +#define TX_ID1 (0) +#define RX_ID1 (1) +#define TX_ID2 (3) +#define RX_ID2 (2) +#define TX_ID3 (1) +#define RX_ID3 (0) + +#define CHANNELS_TO_TEST (4) +#define TX_CHANNEL_INDEX (0) +#define RX_CHANNEL_INDEX (1) +const static uint32_t TEST_CHANNELS[CHANNELS_TO_TEST][2] = { + {TX_ID0, RX_ID0}, {TX_ID1, RX_ID1}, {TX_ID2, RX_ID2}, {TX_ID3, RX_ID3}}; + +static void callback(const struct device *dev, uint32_t channel, void *user_data, + struct mbox_msg *data) +{ + if (data != NULL) { + memcpy(&g_mbox_received_data, data->data, data->size); + g_mbox_received_channel = channel; + } + + k_sem_give(&g_mbox_data_rx_sem); +} + +int main(void) +{ + struct mbox_channel tx_channel; + struct mbox_channel rx_channel; + const struct device *dev; + struct mbox_msg msg = {0}; + uint32_t message = 0; + + dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + + for (int i_test_channel = 0; i_test_channel < CHANNELS_TO_TEST; i_test_channel++) { + mbox_init_channel(&tx_channel, dev, + TEST_CHANNELS[i_test_channel][TX_CHANNEL_INDEX]); + mbox_init_channel(&rx_channel, dev, + TEST_CHANNELS[i_test_channel][RX_CHANNEL_INDEX]); + + if (mbox_register_callback(&rx_channel, callback, NULL)) { + printk("mbox_register_callback() error\n"); + return 0; + } + + if (mbox_set_enabled(&rx_channel, 1)) { + printk("mbox_set_enable() error\n"); + return 0; + } + + int test_count = 0; + + while (test_count < 100) { + test_count++; + + k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); + message = g_mbox_received_data; + + message++; + + msg.data = &message; + msg.size = 4; + + if (mbox_send(&tx_channel, &msg) < 0) { + printk("mbox_send() error\n"); + return 0; + } + } + + /* Disable current rx channel after channel loop */ + mbox_set_enabled(&rx_channel, 0); + } +} diff --git a/tests/drivers/mbox/mbox_data/src/main.c b/tests/drivers/mbox/mbox_data/src/main.c new file mode 100644 index 00000000000..1cdfb0ca43e --- /dev/null +++ b/tests/drivers/mbox/mbox_data/src/main.c @@ -0,0 +1,184 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#include + +static K_SEM_DEFINE(g_mbox_data_rx_sem, 0, 1); + +static uint32_t g_mbox_received_data; +static uint32_t g_mbox_expected_data; +static uint32_t g_mbox_received_channel; +static uint32_t g_mbox_expected_channel; + +static bool g_received_size_error; +static size_t g_received_size; + +static struct mbox_channel g_tx_channel; +static struct mbox_channel g_rx_channel; + +#define TX_ID0 (3) +#define RX_ID0 (2) +#define TX_ID1 (1) +#define RX_ID1 (0) +#define TX_ID2 (2) +#define RX_ID2 (3) +#define TX_ID3 (0) +#define RX_ID3 (1) + +#define CHANNELS_TO_TEST (4) +#define TX_CHANNEL_INDEX (0) +#define RX_CHANNEL_INDEX (1) +const static uint32_t TEST_CHANNELS[CHANNELS_TO_TEST][2] = { + {TX_ID0, RX_ID0}, {TX_ID1, RX_ID1}, {TX_ID2, RX_ID2}, {TX_ID3, RX_ID3}}; +static uint32_t current_channel_index; + +static void callback(const struct device *dev, uint32_t channel, void *user_data, + struct mbox_msg *data) +{ + /* Handle the case if received invalid size */ + if (data->size > sizeof(g_mbox_received_data)) { + g_received_size_error = true; + g_received_size = data->size; + } else { + memcpy(&g_mbox_received_data, data->data, data->size); + } + + g_mbox_received_channel = channel; + + k_sem_give(&g_mbox_data_rx_sem); +} + +static void mbox_data_tests_before(void *f) +{ + zassert_false(current_channel_index >= CHANNELS_TO_TEST, "Channel to test is out of range"); + + const struct device *dev; + int ret_val = 0; + + dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + + mbox_init_channel(&g_tx_channel, dev, + TEST_CHANNELS[current_channel_index][TX_CHANNEL_INDEX]); + mbox_init_channel(&g_rx_channel, dev, + TEST_CHANNELS[current_channel_index][RX_CHANNEL_INDEX]); + + ret_val = mbox_register_callback(&g_rx_channel, callback, NULL); + zassert_false(ret_val != 0, "mbox failed to register callback. ret_val", ret_val); + + ret_val = mbox_set_enabled(&g_rx_channel, 1); + zassert_false(ret_val != 0, "mbox failed to enable mbox. ret_val: %d", ret_val); +} + +static void mbox_data_tests_after(void *f) +{ + /* Disable channel after test end */ + int ret_val = mbox_set_enabled(&g_rx_channel, 0); + + zassert_false(ret_val != 0, "mbox failed to disable mbox. ret_val: %d", ret_val); + + /* Increment current channel index to its prepared for next test */ + current_channel_index++; +} + +static void mbox_test(const uint32_t data) +{ + struct mbox_msg msg = {0}; + uint32_t test_data = data; + int test_count = 0; + int ret_val = 0; + + while (test_count < 100) { + /* Main core prepare test data */ + msg.data = &test_data; + msg.size = 4; + + /* Main core send test data */ + ret_val = mbox_send(&g_tx_channel, &msg); + zassert_false(ret_val < 0, "mbox failed to send. ret_val: %d", ret_val); + + /* Expect next received data will be incremented by one */ + g_mbox_expected_data = test_data; + g_mbox_expected_data++; + + k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); + + if (g_received_size_error) { + zassert_false(1, "mbox received invalid size in callback: %d", + g_received_size); + } + + test_data = g_mbox_received_data; + + /* Main core check received data */ + zassert_equal(g_mbox_expected_data, test_data, + "Received test_data does not match!: Expected: %08X, Got: %08X", + g_mbox_expected_data, test_data); + + /* Expect reception of data on current RX channel */ + g_mbox_expected_channel = TEST_CHANNELS[current_channel_index][RX_CHANNEL_INDEX]; + zassert_equal(g_mbox_expected_channel, g_mbox_received_channel, + "Received channel does not match!: Expected: %d, Got: %d", + g_mbox_expected_channel, g_mbox_received_channel); + + /* Increment for next send */ + test_data++; + test_count++; + } +} + +/** + * @brief MBOX Data transfer by ping pong for first set of channels + * + * This test verifies that the data transfer via MBOX. + * Main core will transfer test data to remote core. + * Remote core will increment data by one and transfer it back to Main core. + * Main core will check that data it sent to remote core was incremented by one. + * Main core will again increment test data by one, send it to remote core and repeat 100 times. + */ +ZTEST(mbox_data_tests, test_ping_pong_1) +{ + mbox_test(0xADADADAD); +} + +/** + * @brief MBOX Data transfer by ping pong for second set of channels + * + * Description same as for test_ping_pong_1 + * + */ +ZTEST(mbox_data_tests, test_ping_pong_2) +{ + mbox_test(0xDADADADA); +} + +/** + * @brief MBOX Data transfer by ping pong for third set of channels + * + * Description same as for test_ping_pong_1 + * + */ +ZTEST(mbox_data_tests, test_ping_pong_3) +{ + mbox_test(0xADADADAD); +} + +/** + * @brief MBOX Data transfer by ping pong for forth set of channels + * + * Description same as for test_ping_pong_1 + * + */ +ZTEST(mbox_data_tests, test_ping_pong_4) +{ + mbox_test(0xDADADADA); +} + +ZTEST_SUITE(mbox_data_tests, NULL, NULL, mbox_data_tests_before, mbox_data_tests_after, NULL); diff --git a/tests/drivers/mbox/mbox_data/sysbuild.cmake b/tests/drivers/mbox/mbox_data/sysbuild.cmake new file mode 100644 index 00000000000..5c536a6229a --- /dev/null +++ b/tests/drivers/mbox/mbox_data/sysbuild.cmake @@ -0,0 +1,28 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 + +if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") + message(FATAL_ERROR + "Target ${BOARD} not supported for this sample. " + "There is no remote board selected in Kconfig.sysbuild") +endif() + +set(REMOTE_APP remote) + +ExternalZephyrProject_Add( + APPLICATION ${REMOTE_APP} + SOURCE_DIR ${APP_DIR}/${REMOTE_APP} + BOARD ${SB_CONFIG_REMOTE_BOARD} +) + +if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR + "${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR + "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" + ) + # For these NXP boards the main core application is dependent on + # 'zephyr_image_info.h' generated by remote application. + + # Let's build the remote application first + add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) +endif() diff --git a/tests/drivers/mbox/mbox_data/testcase.yaml b/tests/drivers/mbox/mbox_data/testcase.yaml new file mode 100644 index 00000000000..d4890ff7c55 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/testcase.yaml @@ -0,0 +1,12 @@ +tests: + drivers.mbox_data: + tags: + - drivers + - mbox + sysbuild: true + platform_allow: + - mimxrt1170_evkb_cm7 + - mimxrt1170_evk_cm7 + - mimxrt1160_evk_cm7 + integration_platforms: + - mimxrt1170_evkb_cm7 From a80e82990c338fba8913c3d547377a405d517d7b Mon Sep 17 00:00:00 2001 From: Tomas Galbicka Date: Tue, 30 Jan 2024 17:12:34 +0100 Subject: [PATCH 0618/2300] [nrf fromtree] samples: tests: mbox: Add lpcpresso55s69 support This commit adds support for NXP board LPCXpresso55S69 for mbox. - samples/drivers/mbox/ - mbox signaling mode - samples/drivers/mbox_data/ - mbox data transfer mode - tests/drivers/mbox/mbox_data/ - mbox test to verify functionality. **NOTE**: manually fixed west.yml conflict to avoid pulling multiple non-relevant NXP HAL updates. Signed-off-by: Tomas Galbicka (cherry picked from commit 73d6c336cad7e6fd739ab397dabbe5748d274a82) (cherry picked from commit 3f18688c6bcbdadef2400bde65419abd5f05cf63) --- samples/drivers/mbox/CMakeLists.txt | 5 ++- samples/drivers/mbox/Kconfig.sysbuild | 3 +- .../mbox/boards/lpcxpresso55s69_cpu0.conf | 3 ++ .../mbox/boards/lpcxpresso55s69_cpu0.overlay | 29 +++++++++++++ samples/drivers/mbox/remote/CMakeLists.txt | 3 +- .../remote/boards/lpcxpresso55s69_cpu1.conf | 10 +++++ .../boards/lpcxpresso55s69_cpu1.overlay | 43 +++++++++++++++++++ samples/drivers/mbox/sample.yaml | 1 + samples/drivers/mbox/sysbuild.cmake | 5 ++- samples/drivers/mbox_data/CMakeLists.txt | 3 +- samples/drivers/mbox_data/Kconfig.sysbuild | 1 + samples/drivers/mbox_data/README.rst | 11 ++++- .../boards/lpcxpresso55s69_cpu0.conf | 3 ++ .../boards/lpcxpresso55s69_cpu0.overlay | 29 +++++++++++++ .../drivers/mbox_data/remote/CMakeLists.txt | 3 +- .../remote/boards/lpcxpresso55s69_cpu1.conf | 3 ++ .../boards/lpcxpresso55s69_cpu1.overlay | 29 +++++++++++++ samples/drivers/mbox_data/remote/src/main.c | 10 ++++- samples/drivers/mbox_data/sample.yaml | 2 + samples/drivers/mbox_data/src/main.c | 10 ++++- tests/drivers/mbox/mbox_data/CMakeLists.txt | 3 +- tests/drivers/mbox/mbox_data/Kconfig.sysbuild | 1 + .../boards/lpcxpresso55s69_cpu0.conf | 3 ++ .../boards/lpcxpresso55s69_cpu0.overlay | 29 +++++++++++++ .../mbox/mbox_data/remote/CMakeLists.txt | 3 +- .../remote/boards/lpcxpresso55s69_cpu1.conf | 3 ++ .../boards/lpcxpresso55s69_cpu1.overlay | 29 +++++++++++++ .../drivers/mbox/mbox_data/remote/src/main.c | 10 ++++- tests/drivers/mbox/mbox_data/src/main.c | 19 ++++++-- tests/drivers/mbox/mbox_data/testcase.yaml | 2 + west.yml | 2 +- 31 files changed, 292 insertions(+), 18 deletions(-) create mode 100644 samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.conf create mode 100644 samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.overlay create mode 100644 samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.conf create mode 100644 samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.overlay create mode 100644 samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.conf create mode 100644 samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.overlay create mode 100644 samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf create mode 100644 samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay create mode 100644 tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.conf create mode 100644 tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.overlay create mode 100644 tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf create mode 100644 tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index 4344f4f3ce9..ca6513822a8 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -1,6 +1,6 @@ # # Copyright (c) 2021 Carlo Caione -# Copyright 2023 NXP +# Copyright 2023-2024 NXP # # SPDX-License-Identifier: Apache-2.0 # @@ -17,7 +17,8 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt595_evk_cm33")) + ("${BOARD}" STREQUAL "mimxrt595_evk_cm33") OR + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index f472576df82..20903872c34 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -1,5 +1,5 @@ # Copyright 2023 Nordic Semiconductor ASA -# Copyright 2023 NXP +# Copyright 2023-2024 NXP # # SPDX-License-Identifier: Apache-2.0 @@ -14,3 +14,4 @@ string default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" + default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" diff --git a/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.conf b/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.conf new file mode 100644 index 00000000000..5077d775881 --- /dev/null +++ b/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.conf @@ -0,0 +1,3 @@ +CONFIG_SECOND_CORE_MCUX=y +CONFIG_MBOX_NXP_MAILBOX=y +CONFIG_BUILD_OUTPUT_HEX=y diff --git a/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.overlay b/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.overlay new file mode 100644 index 00000000000..b5919c4fd72 --- /dev/null +++ b/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,lpc-mailbox */ + /delete-node/ mailbox@8b000; + + /* Attach MBOX driver to Mailbox Unit */ + mbox:mailbox0@5008b000 { + compatible = "nxp,mbox-mailbox"; + reg = <0x5008b000 0xEC>; + interrupts = <31 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index e7db9b8cadf..2c7c8fff29e 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -1,6 +1,6 @@ # # Copyright (c) 2021 Carlo Caione -# Copyright 2023 NXP +# Copyright 2023-2024 NXP # # SPDX-License-Identifier: Apache-2.0 # @@ -14,6 +14,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1") OR ("${BOARD}" STREQUAL "adp_xc7k_ae350")) message(STATUS "${BOARD} compile as remote in this sample") else() diff --git a/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.conf b/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.conf new file mode 100644 index 00000000000..b499f5da051 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.conf @@ -0,0 +1,10 @@ +CONFIG_SECOND_CORE_MCUX=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_MBOX_NXP_MAILBOX=y + +# For purpose of sample enable UART Console on CPU1 +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_CLOCK_CONTROL=y diff --git a/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.overlay b/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.overlay new file mode 100644 index 00000000000..36e6f0ff267 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.overlay @@ -0,0 +1,43 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + zephyr,console = &flexcomm0; + zephyr,shell-uart = &flexcomm0; + }; + + soc { + /* Delete IPM Driver node nxp,lpc-mailbox */ + /delete-node/ mailbox@8b000; + + /* Attach MBOX driver to Mailbox Unit */ + mbox:mbox@5008b000 { + compatible = "nxp,mbox-mailbox"; + reg = <0x5008b000 0xEC>; + interrupts = <31 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; + +&flexcomm0 { + status = "okay"; +}; + +&dma0 { + status = "okay"; +}; + +&syscon { + status = "okay"; +}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index e8015cf7c25..d646b241e9e 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -12,6 +12,7 @@ tests: - mimxrt1170_evkb_cm7 - mimxrt1170_evk_cm7 - mimxrt1160_evk_cm7 + - lpcxpresso55s69_cpu0 integration_platforms: - nrf5340dk_nrf5340_cpuapp harness: console diff --git a/samples/drivers/mbox/sysbuild.cmake b/samples/drivers/mbox/sysbuild.cmake index 7a5d32d4c74..063f6157ddb 100644 --- a/samples/drivers/mbox/sysbuild.cmake +++ b/samples/drivers/mbox/sysbuild.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2023 Nordic Semiconductor ASA -# Copyright 2023 NXP +# Copyright 2023-2024 NXP # SPDX-License-Identifier: Apache-2.0 if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") @@ -22,7 +22,8 @@ native_simulator_set_final_executable(${DEFAULT_IMAGE}) if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR "${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR - "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" + "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" OR + "${BOARD}" STREQUAL "lpcxpresso55s69_cpu0" ) # For these NXP boards the main core application is dependent on # 'zephyr_image_info.h' generated by remote application. diff --git a/samples/drivers/mbox_data/CMakeLists.txt b/samples/drivers/mbox_data/CMakeLists.txt index a67552bf52e..a410ac3d214 100644 --- a/samples/drivers/mbox_data/CMakeLists.txt +++ b/samples/drivers/mbox_data/CMakeLists.txt @@ -11,7 +11,8 @@ set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox_data/Kconfig.sysbuild b/samples/drivers/mbox_data/Kconfig.sysbuild index e355713e714..2ddab228177 100644 --- a/samples/drivers/mbox_data/Kconfig.sysbuild +++ b/samples/drivers/mbox_data/Kconfig.sysbuild @@ -9,3 +9,4 @@ string default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" + default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" diff --git a/samples/drivers/mbox_data/README.rst b/samples/drivers/mbox_data/README.rst index 3ead1ec3b87..1f8b1615f8e 100644 --- a/samples/drivers/mbox_data/README.rst +++ b/samples/drivers/mbox_data/README.rst @@ -10,7 +10,7 @@ Overview This sample demonstrates how to use the :ref:`MBOX API ` in data transfer mode. It can be used only with mbox driver which supports data transfer mode. -Sample will ping-pong 4 bytes of data between two cores via two mbox channels. +Sample will ping-pong up to 4 bytes of data between two cores via two mbox channels. After each core receives data, it increments it by one and sends it back to other core. Building and Running @@ -45,6 +45,15 @@ Building the application for mimxrt1170_evkb_cm7 :goals: debug :west-args: --sysbuild +Building the application for lpcxpresso55s69_cpu1 +================================================= + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/mbox_data/ + :board: lpcxpresso55s69_cpu1 + :goals: debug + :west-args: --sysbuild + Sample Output ============= diff --git a/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.conf b/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.conf new file mode 100644 index 00000000000..5077d775881 --- /dev/null +++ b/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.conf @@ -0,0 +1,3 @@ +CONFIG_SECOND_CORE_MCUX=y +CONFIG_MBOX_NXP_MAILBOX=y +CONFIG_BUILD_OUTPUT_HEX=y diff --git a/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.overlay b/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.overlay new file mode 100644 index 00000000000..b5919c4fd72 --- /dev/null +++ b/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,lpc-mailbox */ + /delete-node/ mailbox@8b000; + + /* Attach MBOX driver to Mailbox Unit */ + mbox:mailbox0@5008b000 { + compatible = "nxp,mbox-mailbox"; + reg = <0x5008b000 0xEC>; + interrupts = <31 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/samples/drivers/mbox_data/remote/CMakeLists.txt b/samples/drivers/mbox_data/remote/CMakeLists.txt index 31f6db9b641..47e1cae8628 100644 --- a/samples/drivers/mbox_data/remote/CMakeLists.txt +++ b/samples/drivers/mbox_data/remote/CMakeLists.txt @@ -9,7 +9,8 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf b/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf new file mode 100644 index 00000000000..14ed92ba8f4 --- /dev/null +++ b/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf @@ -0,0 +1,3 @@ +CONFIG_SECOND_CORE_MCUX=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_MBOX_NXP_MAILBOX=y diff --git a/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay b/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay new file mode 100644 index 00000000000..96bd5aa1c3a --- /dev/null +++ b/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,lpc-mailbox */ + /delete-node/ mailbox@8b000; + + /* Attach MBOX driver to Mailbox Unit */ + mbox:mbox@5008b000 { + compatible = "nxp,mbox-mailbox"; + reg = <0x5008b000 0xEC>; + interrupts = <31 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/samples/drivers/mbox_data/remote/src/main.c b/samples/drivers/mbox_data/remote/src/main.c index 9fccf155c23..0f3ad77a4d0 100644 --- a/samples/drivers/mbox_data/remote/src/main.c +++ b/samples/drivers/mbox_data/remote/src/main.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -41,6 +42,13 @@ int main(void) mbox_init_channel(&tx_channel, dev, TX_ID); mbox_init_channel(&rx_channel, dev, RX_ID); + const int max_transfer_size_bytes = mbox_mtu_get(dev); + /* Sample currently supports only transfer size up to 4 bytes */ + if ((max_transfer_size_bytes <= 0) || (max_transfer_size_bytes > 4)) { + printk("mbox_mtu_get() error\n"); + return 0; + } + if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); return 0; @@ -61,7 +69,7 @@ int main(void) message++; msg.data = &message; - msg.size = 4; + msg.size = max_transfer_size_bytes; printk("Server send (on channel %d) value: %d\n", tx_channel.id, message); if (mbox_send(&tx_channel, &msg) < 0) { diff --git a/samples/drivers/mbox_data/sample.yaml b/samples/drivers/mbox_data/sample.yaml index 5484233b2e8..b4a1e23a9bc 100644 --- a/samples/drivers/mbox_data/sample.yaml +++ b/samples/drivers/mbox_data/sample.yaml @@ -9,8 +9,10 @@ tests: - mimxrt1170_evkb_cm7 - mimxrt1170_evk_cm7 - mimxrt1160_evk_cm7 + - lpcxpresso55s69_cpu0 integration_platforms: - mimxrt1160_evk_cm7 + - lpcxpresso55s69_cpu0 harness: console harness_config: type: multi_line diff --git a/samples/drivers/mbox_data/src/main.c b/samples/drivers/mbox_data/src/main.c index 27c29b07554..85df24940c4 100644 --- a/samples/drivers/mbox_data/src/main.c +++ b/samples/drivers/mbox_data/src/main.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -41,6 +42,13 @@ int main(void) mbox_init_channel(&tx_channel, dev, TX_ID); mbox_init_channel(&rx_channel, dev, RX_ID); + const int max_transfer_size_bytes = mbox_mtu_get(dev); + /* Sample currently supports only transfer size up to 4 bytes */ + if ((max_transfer_size_bytes < 0) || (max_transfer_size_bytes > 4)) { + printk("mbox_mtu_get() error\n"); + return 0; + } + if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); return 0; @@ -53,7 +61,7 @@ int main(void) while (message < 100) { msg.data = &message; - msg.size = 4; + msg.size = max_transfer_size_bytes; printk("Client send (on channel %d) value: %d\n", tx_channel.id, message); if (mbox_send(&tx_channel, &msg) < 0) { diff --git a/tests/drivers/mbox/mbox_data/CMakeLists.txt b/tests/drivers/mbox/mbox_data/CMakeLists.txt index a67552bf52e..a410ac3d214 100644 --- a/tests/drivers/mbox/mbox_data/CMakeLists.txt +++ b/tests/drivers/mbox/mbox_data/CMakeLists.txt @@ -11,7 +11,8 @@ set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/tests/drivers/mbox/mbox_data/Kconfig.sysbuild b/tests/drivers/mbox/mbox_data/Kconfig.sysbuild index e355713e714..2ddab228177 100644 --- a/tests/drivers/mbox/mbox_data/Kconfig.sysbuild +++ b/tests/drivers/mbox/mbox_data/Kconfig.sysbuild @@ -9,3 +9,4 @@ string default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" + default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" diff --git a/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.conf b/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.conf new file mode 100644 index 00000000000..5077d775881 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.conf @@ -0,0 +1,3 @@ +CONFIG_SECOND_CORE_MCUX=y +CONFIG_MBOX_NXP_MAILBOX=y +CONFIG_BUILD_OUTPUT_HEX=y diff --git a/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.overlay b/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.overlay new file mode 100644 index 00000000000..b5919c4fd72 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,lpc-mailbox */ + /delete-node/ mailbox@8b000; + + /* Attach MBOX driver to Mailbox Unit */ + mbox:mailbox0@5008b000 { + compatible = "nxp,mbox-mailbox"; + reg = <0x5008b000 0xEC>; + interrupts = <31 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt b/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt index 31f6db9b641..47e1cae8628 100644 --- a/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt +++ b/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt @@ -9,7 +9,8 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf b/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf new file mode 100644 index 00000000000..14ed92ba8f4 --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf @@ -0,0 +1,3 @@ +CONFIG_SECOND_CORE_MCUX=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_MBOX_NXP_MAILBOX=y diff --git a/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay b/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay new file mode 100644 index 00000000000..96bd5aa1c3a --- /dev/null +++ b/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* Delete ipc chosen property where old IPM mailbox driver bellow is + * configured. + */ + /delete-property/ zephyr,ipc; + }; + + soc { + /* Delete IPM Driver node nxp,lpc-mailbox */ + /delete-node/ mailbox@8b000; + + /* Attach MBOX driver to Mailbox Unit */ + mbox:mbox@5008b000 { + compatible = "nxp,mbox-mailbox"; + reg = <0x5008b000 0xEC>; + interrupts = <31 0>; + rx-channels = <4>; + #mbox-cells = <1>; + status = "okay"; + }; + }; +}; diff --git a/tests/drivers/mbox/mbox_data/remote/src/main.c b/tests/drivers/mbox/mbox_data/remote/src/main.c index 7bbc1c2efd0..d9eba4d3b7c 100644 --- a/tests/drivers/mbox/mbox_data/remote/src/main.c +++ b/tests/drivers/mbox/mbox_data/remote/src/main.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -50,6 +51,13 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + const int max_transfer_size_bytes = mbox_mtu_get(dev); + /* Sample currently supports only transfer size up to 4 bytes */ + if ((max_transfer_size_bytes <= 0) || (max_transfer_size_bytes > 4)) { + printk("mbox_mtu_get() error\n"); + return 0; + } + for (int i_test_channel = 0; i_test_channel < CHANNELS_TO_TEST; i_test_channel++) { mbox_init_channel(&tx_channel, dev, TEST_CHANNELS[i_test_channel][TX_CHANNEL_INDEX]); @@ -77,7 +85,7 @@ int main(void) message++; msg.data = &message; - msg.size = 4; + msg.size = max_transfer_size_bytes; if (mbox_send(&tx_channel, &msg) < 0) { printk("mbox_send() error\n"); diff --git a/tests/drivers/mbox/mbox_data/src/main.c b/tests/drivers/mbox/mbox_data/src/main.c index 1cdfb0ca43e..82cce00ae7f 100644 --- a/tests/drivers/mbox/mbox_data/src/main.c +++ b/tests/drivers/mbox/mbox_data/src/main.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -20,6 +21,7 @@ static uint32_t g_mbox_expected_channel; static bool g_received_size_error; static size_t g_received_size; +static int g_max_transfer_size_bytes; static struct mbox_channel g_tx_channel; static struct mbox_channel g_rx_channel; @@ -65,6 +67,14 @@ static void mbox_data_tests_before(void *f) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + g_max_transfer_size_bytes = mbox_mtu_get(dev); + /* Test currently supports only transfer size up to 4 bytes */ + if ((g_max_transfer_size_bytes < 0) || (g_max_transfer_size_bytes > 4)) { + printk("mbox_mtu_get() error\n"); + zassert_false(1, "mbox invalid maximum transfer unit: %d", + g_max_transfer_size_bytes); + } + mbox_init_channel(&g_tx_channel, dev, TEST_CHANNELS[current_channel_index][TX_CHANNEL_INDEX]); mbox_init_channel(&g_rx_channel, dev, @@ -98,14 +108,17 @@ static void mbox_test(const uint32_t data) while (test_count < 100) { /* Main core prepare test data */ msg.data = &test_data; - msg.size = 4; + msg.size = g_max_transfer_size_bytes; /* Main core send test data */ ret_val = mbox_send(&g_tx_channel, &msg); zassert_false(ret_val < 0, "mbox failed to send. ret_val: %d", ret_val); - /* Expect next received data will be incremented by one */ - g_mbox_expected_data = test_data; + /* Expect next received data will be incremented by one. + * And based on Maximum Transfer Unit determine expected data. + * Currently supported MTU's are 1, 2, 3, and 4 bytes. + */ + g_mbox_expected_data = test_data & ~(0xFFFFFFFF << (g_max_transfer_size_bytes * 8)); g_mbox_expected_data++; k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); diff --git a/tests/drivers/mbox/mbox_data/testcase.yaml b/tests/drivers/mbox/mbox_data/testcase.yaml index d4890ff7c55..72aff63ac3a 100644 --- a/tests/drivers/mbox/mbox_data/testcase.yaml +++ b/tests/drivers/mbox/mbox_data/testcase.yaml @@ -8,5 +8,7 @@ tests: - mimxrt1170_evkb_cm7 - mimxrt1170_evk_cm7 - mimxrt1160_evk_cm7 + - lpcxpresso55s69_cpu0 integration_platforms: - mimxrt1170_evkb_cm7 + - lpcxpresso55s69_cpu0 diff --git a/west.yml b/west.yml index 03a830da77c..68a87e6cf76 100644 --- a/west.yml +++ b/west.yml @@ -193,7 +193,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 69046233b7a7fac3138ae4dd5bcf6158e82529bb + revision: 0463d6aa0de62761fb9ae56e3521c61b0e490374 path: modules/hal/nxp groups: - hal From 668b9c46299a1087d09ee0ca6f52c9758bc7bfb6 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 16 Feb 2024 10:34:25 -0600 Subject: [PATCH 0619/2300] [nrf fromtree] samples: drivers: mbox: remove mimxrt595_evk_cm33 Remove mimxrt595_evk_cm33 from the MBOX sample. Although this SOC has support for both cores, there is no support in tree for booting the secondary core from the primary one, so this sample cannot run on hardware. Fixes #69092 Signed-off-by: Daniel DeGrasse (cherry picked from commit 39ea8ac87ab0a01f6c8ff0b2717ab5036d71793b) (cherry picked from commit 0cfeb7b92687134eda3d5e63abfbd7e0f065a2bd) --- samples/drivers/mbox/CMakeLists.txt | 1 - samples/drivers/mbox/Kconfig.sysbuild | 1 - samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf | 1 - samples/drivers/mbox/sample.yaml | 1 - 4 files changed, 4 deletions(-) delete mode 100644 samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index ca6513822a8..ec79db9deed 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -17,7 +17,6 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt595_evk_cm33") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) message(STATUS "${BOARD} compile as Main in this sample") else() diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 20903872c34..a17dd56ee55 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -10,7 +10,6 @@ string default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" default "adp_xc7k_ae350" if $(BOARD) = "adp_xc7k_ae350" - default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "mimxrt595_evk_cm33" default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" diff --git a/samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf b/samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf deleted file mode 100644 index b01ff58e024..00000000000 --- a/samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index d646b241e9e..e38deda55d3 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -8,7 +8,6 @@ tests: platform_allow: - nrf5340dk_nrf5340_cpuapp - adp_xc7k_ae350 - - mimxrt595_evk_cm33 - mimxrt1170_evkb_cm7 - mimxrt1170_evk_cm7 - mimxrt1160_evk_cm7 From 917c74752a2b6b4ea0bf7bc4f44396057e9b990c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 1 Nov 2023 09:55:59 +0000 Subject: [PATCH 0620/2300] [nrf fromtree] cmake: linker: arm: Fix missing flash load size use Fixes a mismatch between the cmake and ld linker scripts whereby the cmake script was missing using the flash load size Kconfig option (if it was said), which would result in images far larger than they should have allowed to be Signed-off-by: Jamie McCrae (cherry picked from commit 5031da95c6abf7f40a43286c946abbe2f65f2ce1) (cherry picked from commit 836f29ace3721ea01dec8b8f8f205fd17b6ef336) --- cmake/linker_script/arm/linker.cmake | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmake/linker_script/arm/linker.cmake b/cmake/linker_script/arm/linker.cmake index 0c7310ab905..3610260afaf 100644 --- a/cmake/linker_script/arm/linker.cmake +++ b/cmake/linker_script/arm/linker.cmake @@ -16,10 +16,17 @@ math(EXPR FLASH_ADDR OUTPUT_FORMAT HEXADECIMAL ) -math(EXPR FLASH_SIZE - "(${CONFIG_FLASH_SIZE} + 0) * 1024 - (${CONFIG_FLASH_LOAD_OFFSET} + 0)" - OUTPUT_FORMAT HEXADECIMAL -) +if(CONFIG_FLASH_LOAD_SIZE GREATER 0) + math(EXPR FLASH_SIZE + "(${CONFIG_FLASH_LOAD_SIZE} + 0)" + OUTPUT_FORMAT HEXADECIMAL + ) +else() + math(EXPR FLASH_SIZE + "(${CONFIG_FLASH_SIZE} + 0) * 1024 - (${CONFIG_FLASH_LOAD_OFFSET} + 0)" + OUTPUT_FORMAT HEXADECIMAL + ) +endif() set(RAM_ADDR ${CONFIG_SRAM_BASE_ADDRESS}) math(EXPR RAM_SIZE "(${CONFIG_SRAM_SIZE} + 0) * 1024" OUTPUT_FORMAT HEXADECIMAL) From f5de370a5f27f6bb1f2f08a200157ff6610574a0 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 30 Oct 2023 17:17:40 +0000 Subject: [PATCH 0621/2300] [nrf fromtree] linker: Add flash end ROM offset Reduces the size of an image in the linker script by using the ROM end offset Kconfig value Signed-off-by: Jamie McCrae (cherry picked from commit 2522a7856682ffff7965164c91aae53618d7c4b7) (cherry picked from commit 5187db6427f6610d69333219789d70f48b92042a) --- cmake/linker_script/arm/linker.cmake | 4 ++-- include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld | 10 ++++++++-- include/zephyr/arch/arm/cortex_m/scripts/linker.ld | 10 ++++++++-- include/zephyr/arch/arm64/scripts/linker.ld | 10 ++++++++-- include/zephyr/arch/nios2/linker.ld | 7 ++++++- include/zephyr/arch/riscv/common/linker.ld | 12 +++++++++--- include/zephyr/arch/x86/memory.ld | 8 +++++++- 7 files changed, 48 insertions(+), 13 deletions(-) diff --git a/cmake/linker_script/arm/linker.cmake b/cmake/linker_script/arm/linker.cmake index 3610260afaf..332d44b2435 100644 --- a/cmake/linker_script/arm/linker.cmake +++ b/cmake/linker_script/arm/linker.cmake @@ -18,12 +18,12 @@ math(EXPR FLASH_ADDR if(CONFIG_FLASH_LOAD_SIZE GREATER 0) math(EXPR FLASH_SIZE - "(${CONFIG_FLASH_LOAD_SIZE} + 0)" + "(${CONFIG_FLASH_LOAD_SIZE} + 0) - (${CONFIG_ROM_END_OFFSET} + 0)" OUTPUT_FORMAT HEXADECIMAL ) else() math(EXPR FLASH_SIZE - "(${CONFIG_FLASH_SIZE} + 0) * 1024 - (${CONFIG_FLASH_LOAD_OFFSET} + 0)" + "(${CONFIG_FLASH_SIZE} + 0) * 1024 - (${CONFIG_FLASH_LOAD_OFFSET} + 0) - (${CONFIG_ROM_END_OFFSET} + 0)" OUTPUT_FORMAT HEXADECIMAL ) endif() 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 f8b117e9193..a28209c1b43 100644 --- a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld @@ -32,10 +32,16 @@ #define ROM_ADDR (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET) #endif +#if defined(CONFIG_ROM_END_OFFSET) +#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET +#else +#define ROM_END_OFFSET 0 +#endif + #if CONFIG_FLASH_LOAD_SIZE > 0 - #define ROM_SIZE CONFIG_FLASH_LOAD_SIZE + #define ROM_SIZE (CONFIG_FLASH_LOAD_SIZE - ROM_END_OFFSET) #else - #define ROM_SIZE (CONFIG_FLASH_SIZE*1K - CONFIG_FLASH_LOAD_OFFSET) + #define ROM_SIZE (CONFIG_FLASH_SIZE*1K - CONFIG_FLASH_LOAD_OFFSET - ROM_END_OFFSET) #endif #if defined(CONFIG_XIP) diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 4fcd99b5ac8..3160aa5d4ae 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -32,10 +32,16 @@ #define ROM_ADDR (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET) #endif +#if defined(CONFIG_ROM_END_OFFSET) +#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET +#else +#define ROM_END_OFFSET 0 +#endif + #if CONFIG_FLASH_LOAD_SIZE > 0 -#define ROM_SIZE CONFIG_FLASH_LOAD_SIZE +#define ROM_SIZE (CONFIG_FLASH_LOAD_SIZE - ROM_END_OFFSET) #else -#define ROM_SIZE (CONFIG_FLASH_SIZE * 1024 - CONFIG_FLASH_LOAD_OFFSET) +#define ROM_SIZE (CONFIG_FLASH_SIZE * 1024 - CONFIG_FLASH_LOAD_OFFSET - ROM_END_OFFSET) #endif #if defined(CONFIG_XIP) diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index ad7832f16ec..5a8e1404a98 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -31,10 +31,16 @@ #define ROM_ADDR (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET) #endif +#if defined(CONFIG_ROM_END_OFFSET) +#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET +#else +#define ROM_END_OFFSET 0 +#endif + #if CONFIG_FLASH_LOAD_SIZE > 0 - #define ROM_SIZE CONFIG_FLASH_LOAD_SIZE + #define ROM_SIZE (CONFIG_FLASH_LOAD_SIZE - ROM_END_OFFSET) #else - #define ROM_SIZE (CONFIG_FLASH_SIZE * 1K - CONFIG_FLASH_LOAD_OFFSET) + #define ROM_SIZE (CONFIG_FLASH_SIZE * 1K - CONFIG_FLASH_LOAD_OFFSET - ROM_END_OFFSET) #endif #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K) diff --git a/include/zephyr/arch/nios2/linker.ld b/include/zephyr/arch/nios2/linker.ld index 6958533eaf6..f7ba64088fc 100644 --- a/include/zephyr/arch/nios2/linker.ld +++ b/include/zephyr/arch/nios2/linker.ld @@ -39,6 +39,11 @@ * the exception vector is in RAM */ +#if defined(CONFIG_ROM_END_OFFSET) +#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET +#else +#define ROM_END_OFFSET 0 +#endif #ifdef CONFIG_XIP #define ROMABLE_REGION FLASH @@ -54,7 +59,7 @@ ASSERT(_RESET_VECTOR == _ROM_ADDR, "Reset vector not at beginning of ROM!") MEMORY { RESET (rx) : ORIGIN = _RESET_VECTOR, LENGTH = 0x20 - FLASH (rx) : ORIGIN = _RESET_VECTOR + 0x20 , LENGTH = (_ROM_SIZE - 0x20) + FLASH (rx) : ORIGIN = _RESET_VECTOR + 0x20 , LENGTH = (_ROM_SIZE - 0x20 - ROM_END_OFFSET) RAM (wx) : ORIGIN = _EXC_VECTOR, LENGTH = _RAM_SIZE - (_EXC_VECTOR - _RAM_ADDR) /* Used by and documented in include/linker/intlist.ld */ IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K diff --git a/include/zephyr/arch/riscv/common/linker.ld b/include/zephyr/arch/riscv/common/linker.ld index 128f823c4df..e9ac6d32d86 100644 --- a/include/zephyr/arch/riscv/common/linker.ld +++ b/include/zephyr/arch/riscv/common/linker.ld @@ -29,6 +29,12 @@ #define _EXCEPTION_SECTION_NAME exceptions #define _RESET_SECTION_NAME reset +#if defined(CONFIG_ROM_END_OFFSET) +#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET +#else +#define ROM_END_OFFSET 0 +#endif + #ifdef CONFIG_XIP #if DT_NODE_HAS_COMPAT_STATUS(DT_CHOSEN(zephyr_flash), soc_nv_flash, okay) #ifdef CONFIG_FLASH_LOAD_OFFSET @@ -37,7 +43,7 @@ #else /* !CONFIG_FLASH_LOAD_OFFSET */ #define ROM_BASE DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) #endif /* CONFIG_FLASH_LOAD_OFFSET */ -#define ROM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) +#define ROM_SIZE (DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) - ROM_END_OFFSET) #elif DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_flash), jedec_spi_nor) /* For jedec,spi-nor we expect the spi controller to memory map the flash * and for that mapping to be the second register property of the spi @@ -45,11 +51,11 @@ */ #define SPI_CTRL DT_PARENT(DT_CHOSEN(zephyr_flash)) #define ROM_BASE DT_REG_ADDR_BY_IDX(SPI_CTRL, 1) -#define ROM_SIZE DT_REG_SIZE_BY_IDX(SPI_CTRL, 1) +#define ROM_SIZE (DT_REG_SIZE_BY_IDX(SPI_CTRL, 1) - ROM_END_OFFSET) #endif #else /* CONFIG_XIP */ #define ROM_BASE CONFIG_SRAM_BASE_ADDRESS -#define ROM_SIZE KB(CONFIG_SRAM_SIZE) +#define ROM_SIZE (KB(CONFIG_SRAM_SIZE) - ROM_END_OFFSET) #endif /* CONFIG_XIP */ #define RAM_BASE CONFIG_SRAM_BASE_ADDRESS diff --git a/include/zephyr/arch/x86/memory.ld b/include/zephyr/arch/x86/memory.ld index 72b400dd079..c9ede2b9d23 100644 --- a/include/zephyr/arch/x86/memory.ld +++ b/include/zephyr/arch/x86/memory.ld @@ -50,12 +50,18 @@ /* "kernel RAM" for linker VMA allocations starts at the offset */ +#if defined(CONFIG_ROM_END_OFFSET) +#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET +#else +#define ROM_END_OFFSET 0 +#endif + #ifdef CONFIG_XIP /* "ROM" is flash, we leave rodata and text there and just copy in data. * Board-level DTS must specify a flash region that doesn't overlap with * sram0, so that DT_PHYS_LOAD_ADDR is set. */ - #define FLASH_ROM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) + #define FLASH_ROM_SIZE (DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) - ROM_END_OFFSET) #define PHYS_LOAD_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) #else /* Physical RAM location where the kernel image is loaded */ From 508e9098a1a7a00832a289223fd3ddcd1473009e Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Fri, 2 Feb 2024 10:57:12 +0100 Subject: [PATCH 0622/2300] [nrf fromtree] riscv: linker: Fallback to Kconfig when defining ROM region With `CONFIG_XIP=y`, this linker script would derive the ROM region from the chosen `zephyr,flash` DT node with "soc-nv-flash" or "jedec,spi-nor" as its compatible. If the node was absent or had a different compatible, then linking would fail with: undefined symbol `ROM_BASE' referenced in expression Fix this by using `CONFIG_FLASH_BASE_ADDRESS` and `CONFIG_FLASH_SIZE` for ROM base and size respectively. The existing DT logic is preserved for compatibility with out-of-tree boards, so the flash Kconfigs serve as a mere fallback. In addition, use `CONFIG_FLASH_LOAD_OFFSET` and `CONFIG_FLASH_LOAD_SIZE` if defined, to align with some other architectures' linker scripts. For the existing in-tree RISC-V boards, this should not make a difference. The alternative would've been making sure that all boards and SoCs have the relevant Kconfigs set, and only using those in the linker script. The downside is that `CONFIG_FLASH_SIZE` is given in units of 1 KiB, while some existing boards - hifive1_revb, sparkfun_red_v_things_plus - have more granular flash sizes, which would've been rounded down. Signed-off-by: Grzegorz Swiderski (cherry picked from commit e5d14c682136832652c74b2c054c91e203b04950) (cherry picked from commit 74b40a2328f4c6865067681e89f88926e34be698) --- include/zephyr/arch/riscv/common/linker.ld | 33 +++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/include/zephyr/arch/riscv/common/linker.ld b/include/zephyr/arch/riscv/common/linker.ld index e9ac6d32d86..3245012731d 100644 --- a/include/zephyr/arch/riscv/common/linker.ld +++ b/include/zephyr/arch/riscv/common/linker.ld @@ -35,24 +35,43 @@ #define ROM_END_OFFSET 0 #endif +#if defined(CONFIG_FLASH_LOAD_OFFSET) +#define FLASH_LOAD_OFFSET CONFIG_FLASH_LOAD_OFFSET +#else +#define FLASH_LOAD_OFFSET 0 +#endif + #ifdef CONFIG_XIP + +#if CONFIG_FLASH_LOAD_SIZE > 0 +#define ROM_SIZE (CONFIG_FLASH_LOAD_SIZE - ROM_END_OFFSET) +#endif + #if DT_NODE_HAS_COMPAT_STATUS(DT_CHOSEN(zephyr_flash), soc_nv_flash, okay) -#ifdef CONFIG_FLASH_LOAD_OFFSET -#define ROM_BASE (DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) + \ - CONFIG_FLASH_LOAD_OFFSET) -#else /* !CONFIG_FLASH_LOAD_OFFSET */ -#define ROM_BASE DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) -#endif /* CONFIG_FLASH_LOAD_OFFSET */ +#define ROM_BASE (DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) + FLASH_LOAD_OFFSET) +#ifndef ROM_SIZE #define ROM_SIZE (DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) - ROM_END_OFFSET) +#endif + #elif DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_flash), jedec_spi_nor) /* For jedec,spi-nor we expect the spi controller to memory map the flash * and for that mapping to be the second register property of the spi * controller. */ #define SPI_CTRL DT_PARENT(DT_CHOSEN(zephyr_flash)) -#define ROM_BASE DT_REG_ADDR_BY_IDX(SPI_CTRL, 1) +#define ROM_BASE (DT_REG_ADDR_BY_IDX(SPI_CTRL, 1) + FLASH_LOAD_OFFSET) +#ifndef ROM_SIZE #define ROM_SIZE (DT_REG_SIZE_BY_IDX(SPI_CTRL, 1) - ROM_END_OFFSET) #endif + +#else /* Use Kconfig to cover the remaining cases */ +#define ROM_BASE (CONFIG_FLASH_BASE_ADDRESS + FLASH_LOAD_OFFSET) +#ifndef ROM_SIZE +#define ROM_SIZE (CONFIG_FLASH_SIZE * 1024 - FLASH_LOAD_OFFSET - ROM_END_OFFSET) +#endif + +#endif /* DT_NODE_HAS_COMPAT_STATUS */ + #else /* CONFIG_XIP */ #define ROM_BASE CONFIG_SRAM_BASE_ADDRESS #define ROM_SIZE (KB(CONFIG_SRAM_SIZE) - ROM_END_OFFSET) From cd025655fbb8da11faf5e70c69fe95fbc8e2caa3 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 26 Feb 2024 17:41:58 +0100 Subject: [PATCH 0623/2300] [nrf fromtree] drivers: misc: nordic_vpr_launcher: fix address handling When CONFIG_XIP=y, execution address may come from a partition, so its absolute address is needed. Fix code by using VPR_ADDR() macro in all cases: execution and source addresses. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit f0b975032a68c2da38c34f01b836edb5e9e62b12) (cherry picked from commit 915121647d215ba55f01ad210fd49a363bfa6298) --- drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c index 161465ba02c..64d4969081b 100644 --- a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c +++ b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c @@ -45,8 +45,8 @@ static int nordic_vpr_launcher_init(const struct device *dev) return 0; } -/* obtain VPR source address either from memory or partition */ -#define VPR_SRC_ADDR(node_id) \ +/* obtain VPR address either from memory or partition */ +#define VPR_ADDR(node_id) \ (DT_REG_ADDR(node_id) + \ COND_CODE_0(DT_FIXED_PARTITION_EXISTS(node_id), (0), (DT_REG_ADDR(DT_GPARENT(node_id))))) @@ -59,9 +59,9 @@ static int nordic_vpr_launcher_init(const struct device *dev) \ static const struct nordic_vpr_launcher_config config##inst = { \ .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ - .exec_addr = DT_REG_ADDR(DT_INST_PHANDLE(inst, execution_memory)), \ + .exec_addr = VPR_ADDR(DT_INST_PHANDLE(inst, execution_memory)), \ COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, source_memory), \ - (.src_addr = VPR_SRC_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ + (.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ .src_size = DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory)),), \ ())}; \ \ From 9f066cce9dffad3b6438287fca7117efc92ee319 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 26 Feb 2024 17:50:12 +0100 Subject: [PATCH 0624/2300] [nrf fromtree] soc: riscv: nordic_nrf: vpr: select HAS_FLASH_LOAD_OFFSET if XIP This option is required to enable usage of DT partitions, used when CONFIG_XIP=y. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 43f97710af81a9e551e12979dc9c44ed770009ba) (cherry picked from commit 70d2749bb097f42c790a24d8092a0b3e260bdf14) --- soc/riscv/nordic_nrf/common/vpr/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig index 40a7d199c0c..3750716a713 100644 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig @@ -14,5 +14,6 @@ config RISCV_CORE_NORDIC_VPR select RISCV_ISA_EXT_ZIFENCEI select RISCV_SOC_HAS_ISR_STACKING select RISCV_SOC_CONTEXT_SAVE + select HAS_FLASH_LOAD_OFFSET if XIP help Enable support for the RISC-V Nordic VPR core. From 64e2ca95d6f82b8484eeed0abcfc95fb05c21d7b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 26 Feb 2024 18:04:39 +0100 Subject: [PATCH 0625/2300] [nrf fromtree] boards: nrf54h20pdk_nrf54h20: use XIP for PPR The amount of RAM owned by PPR core is quite limited, making it difficult to fit many samples. Instead, use execution in place and increase its code partition from 28K to 64K (as now it doesn't have to match RAM size). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit d1e59cf39f16d45f936a1df14a18e3ba92763791) (cherry picked from commit 9ed9a149bac7a11558c1258701d7e5c46e3a539a) --- .../nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi | 2 +- .../arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts | 3 +-- .../nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi index 00f28fad9f1..cb5a4fe0b0c 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi @@ -73,7 +73,7 @@ }; cpuppr_code_partition: partition@126000 { - reg = <0x126000 DT_SIZE_K(28)>; + reg = <0x126000 DT_SIZE_K(64)>; }; }; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 5fb345ec808..8500d22a924 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -98,8 +98,7 @@ }; &cpuppr_vpr { - source-memory = <&cpuppr_code_partition>; - execution-memory = <&cpuppr_ram3x_region>; + execution-memory = <&cpuppr_code_partition>; }; &gpiote130 { diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig index fb3dca2266d..112140693ef 100644 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig @@ -6,7 +6,7 @@ CONFIG_SOC_NRF54H20=y CONFIG_SOC_NRF54H20_ENGA_CPUPPR=y CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUPPR=y -CONFIG_XIP=n +CONFIG_USE_DT_CODE_PARTITION=y CONFIG_SERIAL=y From 9262b790d416b2a873310b68230886ad5ad127c4 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 26 Feb 2024 18:03:09 +0100 Subject: [PATCH 0626/2300] [nrf fromtree] snippets: add snippet to boot Nordic PPR core from RAM Add a new snippet that allows booting PPR core found in some Nordic SoCs, configuring it with CONFIG_XIP=n. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 75839ea4ad58127febff768310734d0898623071) (cherry picked from commit 76c8a0ad9d875c62f20713ba85fc8f4ef5635743) --- snippets/nordic-ppr-ram/README.rst | 11 +++++++++++ .../boards/nrf54h20pdk_nrf54h20_cpuapp.overlay | 16 ++++++++++++++++ snippets/nordic-ppr-ram/nordic-ppr-ram.overlay | 15 +++++++++++++++ snippets/nordic-ppr-ram/snippet.yml | 8 ++++++++ 4 files changed, 50 insertions(+) create mode 100644 snippets/nordic-ppr-ram/README.rst create mode 100644 snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay create mode 100644 snippets/nordic-ppr-ram/nordic-ppr-ram.overlay create mode 100644 snippets/nordic-ppr-ram/snippet.yml diff --git a/snippets/nordic-ppr-ram/README.rst b/snippets/nordic-ppr-ram/README.rst new file mode 100644 index 00000000000..501e5073357 --- /dev/null +++ b/snippets/nordic-ppr-ram/README.rst @@ -0,0 +1,11 @@ +.. _nordic-ppr-ram: + +Nordic boot PPR snippet with execution from RAM (nordic-ppr-ram) +################################################################ + +Overview +******** + +This snippet allows users to build Zephyr with the capability to boot Nordic PPR +(Peripheral Processor) from another core. PPR code is executed from RAM. Note +that PPR image must be built with :kconfig:option:`CONFIG_XIP` disabled. diff --git a/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..5597c886b85 --- /dev/null +++ b/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuppr_ram3x_region { + status = "okay"; +}; + +&cpuppr_vpr { + execution-memory = <&cpuppr_ram3x_region>; +}; + +&uart135 { + status = "reserved"; +}; diff --git a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay new file mode 100644 index 00000000000..e69c3a0d2bf --- /dev/null +++ b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +/* code is sourced from cpuppr code partition */ +&cpuppr_vpr { + status = "okay"; + source-memory = <&cpuppr_code_partition>; +}; + +/* code partition size must match RAM size */ +&cpuppr_code_partition { + reg = <0x126000 DT_SIZE_K(28)>; +}; diff --git a/snippets/nordic-ppr-ram/snippet.yml b/snippets/nordic-ppr-ram/snippet.yml new file mode 100644 index 00000000000..0d6039af2e5 --- /dev/null +++ b/snippets/nordic-ppr-ram/snippet.yml @@ -0,0 +1,8 @@ +name: nordic-ppr-ram +append: + EXTRA_DTC_OVERLAY_FILE: nordic-ppr-ram.overlay + +boards: + nrf54h20pdk_nrf54h20_cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20pdk_nrf54h20_cpuapp.overlay From 41acdd4ac70f65f11654eaa594558562e15a8fee Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 27 Feb 2024 14:03:42 +0100 Subject: [PATCH 0627/2300] [nrf fromtree] modules: hal_nordic: require nrf-regtool 5.1.0 This new version is required to handle the upcoming IPC-related DT structure (i.e. BELLBOARD/VEVIF). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit afdddf1d22b7bbb1521061d4ebb3f96906f6ee48) (cherry picked from commit 91c24f8538b0f3a6f0d200e406da23ba8d458bf2) --- 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 6f5364ac8de..c4a7134935c 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -11,7 +11,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.0.1 + find_package(nrf-regtool 5.1.0 COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From 77878202ae4e676750b2337b60a30d3f69d9c19a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 16:12:50 +0100 Subject: [PATCH 0628/2300] [nrf fromlist] dts: bindings: mbox: add nordic,nrf-vevif-local|remote Add a new binding for Nordic VEVIF (VPR Event Interface) (local and remote modes). Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 965c91ed503d83a6f5eb778b85fe65b5984a53e8) (cherry picked from commit 039f5ba892274a7faeeccd94f59393f3985f6872) --- .../mbox/nordic,nrf-vevif-common.yaml | 18 +++++++++++ dts/bindings/mbox/nordic,nrf-vevif-local.yaml | 32 +++++++++++++++++++ .../mbox/nordic,nrf-vevif-remote.yaml | 29 +++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 dts/bindings/mbox/nordic,nrf-vevif-common.yaml create mode 100644 dts/bindings/mbox/nordic,nrf-vevif-local.yaml create mode 100644 dts/bindings/mbox/nordic,nrf-vevif-remote.yaml diff --git a/dts/bindings/mbox/nordic,nrf-vevif-common.yaml b/dts/bindings/mbox/nordic,nrf-vevif-common.yaml new file mode 100644 index 00000000000..b7cb15457f6 --- /dev/null +++ b/dts/bindings/mbox/nordic,nrf-vevif-common.yaml @@ -0,0 +1,18 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +include: mailbox-controller.yaml + +properties: + nordic,tasks: + type: int + required: true + description: Number of tasks supported by the VEVIF instance. + + nordic,tasks-mask: + type: int + required: true + description: Mask of tasks supported by the VEVIF instance. + +mbox-cells: + - channel diff --git a/dts/bindings/mbox/nordic,nrf-vevif-local.yaml b/dts/bindings/mbox/nordic,nrf-vevif-local.yaml new file mode 100644 index 00000000000..5d23cfdcf1e --- /dev/null +++ b/dts/bindings/mbox/nordic,nrf-vevif-local.yaml @@ -0,0 +1,32 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic VEVIF (VPR Event Interface) - Local + + VEVIF is an event interface for VPR, allowing connection to the domain's DPPI + system. VEVIF can also generate IRQs to other CPUs. + + Example definition: + + cpuppr: cpu@d { + ... + cpuppr_vevif_local: mailbox { + compatible = "nordic,nrf-vevif-local"; + interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, + <1 NRF_DEFAULT_IRQ_PRIORITY>, + ... + ; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask: <0xfffffff0>; + }; + }; + +compatible: "nordic,nrf-vevif-local" + +include: [base.yaml, "nordic,nrf-vevif-common.yaml"] + +properties: + interrupts: + required: true diff --git a/dts/bindings/mbox/nordic,nrf-vevif-remote.yaml b/dts/bindings/mbox/nordic,nrf-vevif-remote.yaml new file mode 100644 index 00000000000..07522fed99d --- /dev/null +++ b/dts/bindings/mbox/nordic,nrf-vevif-remote.yaml @@ -0,0 +1,29 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic VEVIF (VPR Event Interface) - Remote + + VEVIF is an event interface for VPR, allowing connection to the domain's DPPI + system. VEVIF can also generate IRQs to other CPUs. + + Example definition: + + cpuppr_vpr: vpr@deadbeef{ + ... + cpuppr_vevif_remote: mailbox@0 { + compatible = "nordic,nrf-vevif-remote"; + reg = <0x0 0x1000>; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask: <0xfffffff0>; + }; + }; + +compatible: "nordic,nrf-vevif-remote" + +include: [base.yaml, "nordic,nrf-vevif-common.yaml"] + +properties: + reg: + required: true From 1bcad2f40ec7094f379848f45ac7e1810193f1ca Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:33:24 +0100 Subject: [PATCH 0629/2300] [nrf fromlist] drivers: misc: nordic_vpr_launcher: initialize earlier Set driver to initialize at early POST_KERNEL, so that we make sure other future dependencies priorities (eg VEVIF) do not conflict. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 3e8ea343878acabdf163d1a084cef61f8e077ed5) (cherry picked from commit 851de7e087d0aae184299f46f0f128e95dc16ec6) --- drivers/misc/nordic_vpr_launcher/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/nordic_vpr_launcher/Kconfig b/drivers/misc/nordic_vpr_launcher/Kconfig index 57605e505f2..6aeabcd251c 100644 --- a/drivers/misc/nordic_vpr_launcher/Kconfig +++ b/drivers/misc/nordic_vpr_launcher/Kconfig @@ -17,7 +17,7 @@ source "subsys/logging/Kconfig.template.log_config" config NORDIC_VPR_LAUNCHER_INIT_PRIORITY int "Nordic VPR coprocessor launcher init priority" - default KERNEL_INIT_PRIORITY_DEVICE + default 0 help The init priority of the VPR coprocessor launcher. From 630a73a6c641eb2f3152aba23920862439fa4096 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 16:16:58 +0100 Subject: [PATCH 0630/2300] [nrf fromlist] drivers: mbox: add initial driver for nRF VEVIF Add a mailbox driver for VEVIF. The driver can be built in either 'local' or 'remote' configuration. This depends on the existence of the 'interrupts' property, which signals that the instance is managed locally. VEVIF is, as expected, always managed by a VPR core. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 16807ea1c8a6e2c719e43370b6b645539dc72933) (cherry picked from commit 942d10d274917268909d4d1714e50e39b973cfe3) --- drivers/mbox/CMakeLists.txt | 2 + drivers/mbox/Kconfig | 1 + drivers/mbox/Kconfig.nrf_vevif | 16 ++++ drivers/mbox/mbox_nrf_vevif_local.c | 123 +++++++++++++++++++++++++++ drivers/mbox/mbox_nrf_vevif_remote.c | 76 +++++++++++++++++ 5 files changed, 218 insertions(+) create mode 100644 drivers/mbox/Kconfig.nrf_vevif create mode 100644 drivers/mbox/mbox_nrf_vevif_local.c create mode 100644 drivers/mbox/mbox_nrf_vevif_remote.c diff --git a/drivers/mbox/CMakeLists.txt b/drivers/mbox/CMakeLists.txt index b81a3bb679f..6ecbfa5e7ed 100644 --- a/drivers/mbox/CMakeLists.txt +++ b/drivers/mbox/CMakeLists.txt @@ -9,3 +9,5 @@ zephyr_library_sources_ifdef(CONFIG_MBOX_NRFX_IPC mbox_nrfx_ipc.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_S32_MRU mbox_nxp_s32_mru.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_IMX_MU mbox_nxp_imx_mu.c) zephyr_library_sources_ifdef(CONFIG_MBOX_ANDES_PLIC_SW mbox_andes_plic_sw.c) +zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_LOCAL mbox_nrf_vevif_local.c) +zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_REMOTE mbox_nrf_vevif_remote.c) diff --git a/drivers/mbox/Kconfig b/drivers/mbox/Kconfig index 0668c9aab8b..711e6637c4e 100644 --- a/drivers/mbox/Kconfig +++ b/drivers/mbox/Kconfig @@ -15,6 +15,7 @@ source "drivers/mbox/Kconfig.nrfx" source "drivers/mbox/Kconfig.nxp_s32" source "drivers/mbox/Kconfig.nxp_imx" source "drivers/mbox/Kconfig.andes" +source "drivers/mbox/Kconfig.nrf_vevif" config MBOX_INIT_PRIORITY int "MBOX init priority" diff --git a/drivers/mbox/Kconfig.nrf_vevif b/drivers/mbox/Kconfig.nrf_vevif new file mode 100644 index 00000000000..4abb0ef8241 --- /dev/null +++ b/drivers/mbox/Kconfig.nrf_vevif @@ -0,0 +1,16 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config MBOX_NRF_VEVIF_LOCAL + bool "nRF VEVIF local driver" + depends on DT_HAS_NORDIC_NRF_VEVIF_LOCAL_ENABLED + default y + help + Mailbox driver for local Nordic nRF VEVIF (VPR Event Interface) + +config MBOX_NRF_VEVIF_REMOTE + bool "nRF VEVIF remote driver" + depends on DT_HAS_NORDIC_NRF_VEVIF_REMOTE_ENABLED + default y + help + Mailbox driver for remote Nordic nRF VEVIF (VPR Event Interface) diff --git a/drivers/mbox/mbox_nrf_vevif_local.c b/drivers/mbox/mbox_nrf_vevif_local.c new file mode 100644 index 00000000000..31b89e1e6fb --- /dev/null +++ b/drivers/mbox/mbox_nrf_vevif_local.c @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nordic_nrf_vevif_local + +#include +#include + +#include +#include +#include + +#define VEVIF_TASKS_NUM DT_INST_PROP(0, nordic_tasks) +#define VEVIF_TASKS_MASK DT_INST_PROP(0, nordic_tasks_mask) + +BUILD_ASSERT(VEVIF_TASKS_NUM <= VPR_TASKS_TRIGGER_MaxCount, "Number of tasks exceeds maximum"); +BUILD_ASSERT(VEVIF_TASKS_NUM == DT_NUM_IRQS(DT_DRV_INST(0)), "# IRQs != # tasks"); + +/* callbacks */ +struct mbox_vevif_local_cbs { + mbox_callback_t cb[VEVIF_TASKS_NUM]; + void *user_data[VEVIF_TASKS_NUM]; + uint32_t enabled_mask; +}; + +static struct mbox_vevif_local_cbs cbs; + +/* IRQ list */ +#define VEVIF_IRQN(idx, _) DT_INST_IRQ_BY_IDX(0, idx, irq) + +static const uint8_t vevif_irqs[VEVIF_TASKS_NUM] = { + LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), VEVIF_IRQN, (,)) +}; + +static void vevif_local_isr(const void *parameter) +{ + uint8_t id = *(uint8_t *)parameter; + + nrf_vpr_csr_vevif_tasks_clear(BIT(id)); + + if (cbs.cb[id] != NULL) { + cbs.cb[id](DEVICE_DT_INST_GET(0), id, cbs.user_data[id], NULL); + } +} + +static inline bool vevif_local_is_task_valid(uint32_t id) +{ + return (id < VEVIF_TASKS_NUM) && ((VEVIF_TASKS_MASK & BIT(id)) != 0U); +} + +static uint32_t vevif_local_max_channels_get(const struct device *dev) +{ + ARG_UNUSED(dev); + + return VEVIF_TASKS_NUM; +} + +static int vevif_local_register_callback(const struct device *dev, uint32_t id, mbox_callback_t cb, + void *user_data) +{ + ARG_UNUSED(dev); + + if (!vevif_local_is_task_valid(id)) { + return -EINVAL; + } + + cbs.cb[id] = cb; + cbs.user_data[id] = user_data; + + return 0; +} + +static int vevif_local_set_enabled(const struct device *dev, uint32_t id, bool enable) +{ + ARG_UNUSED(dev); + + if (!vevif_local_is_task_valid(id)) { + return -EINVAL; + } + + if (enable) { + if ((cbs.enabled_mask & BIT(id)) != 0U) { + return -EALREADY; + } + + cbs.enabled_mask |= BIT(id); + irq_enable(vevif_irqs[id]); + } else { + if ((cbs.enabled_mask & BIT(id)) == 0U) { + return -EALREADY; + } + + cbs.enabled_mask &= ~BIT(id); + irq_disable(vevif_irqs[id]); + } + + return 0; +} + +static const struct mbox_driver_api vevif_local_driver_api = { + .max_channels_get = vevif_local_max_channels_get, + .register_callback = vevif_local_register_callback, + .set_enabled = vevif_local_set_enabled, +}; + +#define VEVIF_IRQ_CONNECT(idx, _) \ + IRQ_CONNECT(DT_INST_IRQ_BY_IDX(0, idx, irq), DT_INST_IRQ_BY_IDX(0, idx, priority), \ + vevif_local_isr, &vevif_irqs[idx], 0) + +static int vevif_local_init(const struct device *dev) +{ + nrf_vpr_csr_rtperiph_enable_set(true); + nrf_vpr_csr_vevif_tasks_clear(NRF_VPR_TASK_TRIGGER_ALL_MASK); + + LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), VEVIF_IRQ_CONNECT, (;)); + + return 0; +} + +DEVICE_DT_INST_DEFINE(0, vevif_local_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_MBOX_INIT_PRIORITY, + &vevif_local_driver_api); diff --git a/drivers/mbox/mbox_nrf_vevif_remote.c b/drivers/mbox/mbox_nrf_vevif_remote.c new file mode 100644 index 00000000000..cb5d7c507c5 --- /dev/null +++ b/drivers/mbox/mbox_nrf_vevif_remote.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nordic_nrf_vevif_remote + +#include +#include + +#include + +struct mbox_vevif_remote_conf { + NRF_VPR_Type *vpr; + uint32_t tasks_mask; + uint8_t tasks; +}; + +static inline bool vevif_remote_is_task_valid(const struct device *dev, uint32_t id) +{ + const struct mbox_vevif_remote_conf *config = dev->config; + + return (id < config->tasks) && ((config->tasks_mask & BIT(id)) != 0U); +} + +static int vevif_remote_send(const struct device *dev, uint32_t id, const struct mbox_msg *msg) +{ + const struct mbox_vevif_remote_conf *config = dev->config; + + if (!vevif_remote_is_task_valid(dev, id)) { + return -EINVAL; + } + + if (msg != NULL) { + return -ENOTSUP; + } + + nrfy_vpr_task_trigger(config->vpr, nrfy_vpr_trigger_task_get(id)); + + return 0; +} + +static int vevif_remote_mtu_get(const struct device *dev) +{ + ARG_UNUSED(dev); + + return 0; +} + +static uint32_t vevif_remote_max_channels_get(const struct device *dev) +{ + const struct mbox_vevif_remote_conf *config = dev->config; + + return config->tasks; +} + +static const struct mbox_driver_api vevif_remote_driver_api = { + .send = vevif_remote_send, + .mtu_get = vevif_remote_mtu_get, + .max_channels_get = vevif_remote_max_channels_get, +}; + +#define VEVIF_REMOTE_DEFINE(inst) \ + BUILD_ASSERT(DT_INST_PROP(inst, nordic_tasks) <= VPR_TASKS_TRIGGER_MaxCount, \ + "Number of tasks exceeds maximum"); \ + \ + static const struct mbox_vevif_remote_conf conf##inst = { \ + .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ + .tasks = DT_INST_PROP(inst, nordic_tasks), \ + .tasks_mask = DT_INST_PROP(inst, nordic_tasks_mask), \ + }; \ + \ + DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ + CONFIG_MBOX_INIT_PRIORITY, &vevif_remote_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(VEVIF_REMOTE_DEFINE) From 5529abcb2a92f4a7648001f0e846aca51e255381 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:42:14 +0100 Subject: [PATCH 0631/2300] [nrf fromlist] samples: drivers: mbox: allow to configure RX/TX channels By adding Kconfig options for both samples. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 253593c966f339e7aebbdbbbb8126963f3529ebe) (cherry picked from commit a1701713c22ad32b4345ee19e958f24d46e4e599) --- samples/drivers/mbox/Kconfig | 13 +++++++++++++ samples/drivers/mbox/remote/Kconfig | 17 +++++++++++++++++ samples/drivers/mbox/remote/src/main.c | 7 ++----- samples/drivers/mbox/src/main.c | 7 ++----- 4 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 samples/drivers/mbox/remote/Kconfig diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig index 3837c49b6e9..79dd2d09689 100644 --- a/samples/drivers/mbox/Kconfig +++ b/samples/drivers/mbox/Kconfig @@ -9,3 +9,16 @@ config INCLUDE_REMOTE_DIR help Include remote build header files. Can be used if primary image needs to be aware of size or base address of secondary image + +config TX_CHANNEL_ID + int "Channel ID for TX" + default 1 + help + Channel ID for TX + + +config RX_CHANNEL_ID + int "Channel ID for RX" + default 0 + help + Channel ID for RX diff --git a/samples/drivers/mbox/remote/Kconfig b/samples/drivers/mbox/remote/Kconfig new file mode 100644 index 00000000000..a8897e4aab0 --- /dev/null +++ b/samples/drivers/mbox/remote/Kconfig @@ -0,0 +1,17 @@ +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "Kconfig.zephyr" + +config TX_CHANNEL_ID + int "Channel ID for TX" + default 0 + help + Channel ID for TX + + +config RX_CHANNEL_ID + int "Channel ID for RX" + default 1 + help + Channel ID for RX diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index 89039e3b277..a256ed21daa 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -9,9 +9,6 @@ #include #include -#define TX_ID (0) -#define RX_ID (1) - static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { @@ -28,8 +25,8 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, TX_ID); - mbox_init_channel(&rx_channel, dev, RX_ID); + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); + mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index d6c79729b4f..bfe28443f95 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -9,9 +9,6 @@ #include #include -#define TX_ID (1) -#define RX_ID (0) - static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { @@ -28,8 +25,8 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, TX_ID); - mbox_init_channel(&rx_channel, dev, RX_ID); + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); + mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); From e4189b3f9d2f1adc5abf801dca5f607b2a383abf Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:48:59 +0100 Subject: [PATCH 0632/2300] [nrf fromlist] samples: drivers: mbox: allow to enable RX/TX This can be useful to provide multiple setups, eg unidirectional ping-pong. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 5cb43795d8082be70e4a18f90e66c50122f3c293) (cherry picked from commit 20f4571b37cf92b6558eb81551401fd5c6f97105) --- samples/drivers/mbox/Kconfig | 13 +++++++++++++ samples/drivers/mbox/remote/Kconfig | 13 +++++++++++++ samples/drivers/mbox/remote/src/main.c | 20 +++++++++++++++++--- samples/drivers/mbox/src/main.c | 15 ++++++++++++--- 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig index 79dd2d09689..3af6e740bfc 100644 --- a/samples/drivers/mbox/Kconfig +++ b/samples/drivers/mbox/Kconfig @@ -10,15 +10,28 @@ config INCLUDE_REMOTE_DIR Include remote build header files. Can be used if primary image needs to be aware of size or base address of secondary image +config TX_ENABLED + bool "TX enabled" + default y + help + Enable TX + config TX_CHANNEL_ID int "Channel ID for TX" default 1 + depends on TX_ENABLED help Channel ID for TX +config RX_ENABLED + bool "RX enabled" + default y + help + Enable RX config RX_CHANNEL_ID int "Channel ID for RX" + depends on RX_ENABLED default 0 help Channel ID for RX diff --git a/samples/drivers/mbox/remote/Kconfig b/samples/drivers/mbox/remote/Kconfig index a8897e4aab0..7edb8574359 100644 --- a/samples/drivers/mbox/remote/Kconfig +++ b/samples/drivers/mbox/remote/Kconfig @@ -3,15 +3,28 @@ source "Kconfig.zephyr" +config TX_ENABLED + bool "TX enabled" + default y + help + Enable TX + config TX_CHANNEL_ID int "Channel ID for TX" default 0 + depends on TX_ENABLED help Channel ID for TX +config RX_ENABLED + bool "RX enabled" + default y + help + Enable RX config RX_CHANNEL_ID int "Channel ID for RX" + depends on RX_ENABLED default 1 help Channel ID for RX diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index a256ed21daa..31665951172 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -9,23 +9,29 @@ #include #include +#if !defined(CONFIG_RX_ENABLED) && !defined(CONFIG_TX_ENABLED) +#error "At least one of CONFIG_RX_ENABLED or CONFIG_TX_ENABLED must be set" +#endif + +#ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { printk("Pong (on channel %d)\n", channel); } +#endif /* CONFIG_RX_ENABLED */ int main(void) { - struct mbox_channel tx_channel; - struct mbox_channel rx_channel; const struct device *dev; printk("Hello from NET\n"); dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); +#ifdef CONFIG_RX_ENABLED + struct mbox_channel rx_channel; + mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { @@ -37,6 +43,12 @@ int main(void) printk("mbox_set_enable() error\n"); return 0; } +#endif /* CONFIG_RX_ENABLED */ + +#ifdef CONFIG_TX_ENABLED + struct mbox_channel tx_channel; + + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { @@ -49,5 +61,7 @@ int main(void) k_sleep(K_MSEC(3000)); } +#endif /* CONFIG_TX_ENABLED */ + return 0; } diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index bfe28443f95..cea34afb29a 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -9,23 +9,25 @@ #include #include +#ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { printk("Pong (on channel %d)\n", channel); } +#endif int main(void) { - struct mbox_channel tx_channel; - struct mbox_channel rx_channel; const struct device *dev; printk("Hello from APP\n"); dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); +#ifdef CONFIG_RX_ENABLED + struct mbox_channel rx_channel; + mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { @@ -37,6 +39,12 @@ int main(void) printk("mbox_set_enable() error\n"); return 0; } +#endif /* CONFIG_RX_ENABLED */ + +#ifdef CONFIG_TX_ENABLED + struct mbox_channel tx_channel; + + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { k_sleep(K_MSEC(2000)); @@ -48,5 +56,6 @@ int main(void) return 0; } } +#endif /* CONFIG_TX_ENABLED */ return 0; } From fdd4cbee5e08c04c725340774831a4d14d03841d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:59:22 +0100 Subject: [PATCH 0633/2300] [nrf fromlist] samples: drivers: mbox: misc cleanups/enhancements - Include cleanup - s/NET/REMOTE (remote core may have nothing to do with NET) - Improved error reporting Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit cf67d54ed49d896112a285044a12a28b7dfacff0) (cherry picked from commit 56cc531bd5ba1ea1f22e726f9cbd9b72247cc8fb) --- samples/drivers/mbox/remote/src/main.c | 26 +++++++++++++------------- samples/drivers/mbox/src/main.c | 23 ++++++++++++----------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index 31665951172..1ca832a697c 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -4,10 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include #include #include +#include #if !defined(CONFIG_RX_ENABLED) && !defined(CONFIG_TX_ENABLED) #error "At least one of CONFIG_RX_ENABLED or CONFIG_TX_ENABLED must be set" @@ -23,24 +22,25 @@ static void callback(const struct device *dev, uint32_t channel, int main(void) { - const struct device *dev; + int ret; + const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - printk("Hello from NET\n"); - - dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + printk("Hello from REMOTE\n"); #ifdef CONFIG_RX_ENABLED struct mbox_channel rx_channel; mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); - if (mbox_register_callback(&rx_channel, callback, NULL)) { - printk("mbox_register_callback() error\n"); + ret = mbox_register_callback(&rx_channel, callback, NULL); + if (ret < 0) { + printk("Could not register callback (%d)\n", ret); return 0; } - if (mbox_set_enabled(&rx_channel, 1)) { - printk("mbox_set_enable() error\n"); + ret = mbox_set_enabled(&rx_channel, true); + if (ret < 0) { + printk("Could not enable RX channel %d (%d)\n", rx_channel.id, ret); return 0; } #endif /* CONFIG_RX_ENABLED */ @@ -51,11 +51,11 @@ int main(void) mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { - printk("Ping (on channel %d)\n", tx_channel.id); - if (mbox_send(&tx_channel, NULL) < 0) { - printk("mbox_send() error\n"); + ret = mbox_send(&tx_channel, NULL); + if (ret < 0) { + printk("Could not send (%d)\n", ret); return 0; } diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index cea34afb29a..d4dd21d342f 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -4,10 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include #include #include +#include #ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, @@ -19,24 +18,25 @@ static void callback(const struct device *dev, uint32_t channel, int main(void) { - const struct device *dev; + int ret; + const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); printk("Hello from APP\n"); - dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - #ifdef CONFIG_RX_ENABLED struct mbox_channel rx_channel; mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); - if (mbox_register_callback(&rx_channel, callback, NULL)) { - printk("mbox_register_callback() error\n"); + ret = mbox_register_callback(&rx_channel, callback, NULL); + if (ret < 0) { + printk("Could not register callback (%d)\n", ret); return 0; } - if (mbox_set_enabled(&rx_channel, 1)) { - printk("mbox_set_enable() error\n"); + ret = mbox_set_enabled(&rx_channel, true); + if (ret < 0) { + printk("Could not enable RX channel %d (%d)\n", rx_channel.id, ret); return 0; } #endif /* CONFIG_RX_ENABLED */ @@ -51,8 +51,9 @@ int main(void) printk("Ping (on channel %d)\n", tx_channel.id); - if (mbox_send(&tx_channel, NULL) < 0) { - printk("mbox_send() error\n"); + ret = mbox_send(&tx_channel, NULL); + if (ret < 0) { + printk("Could not send (%d)\n", ret); return 0; } } From 76156d457aab3145e9366602955cac2608d37667 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 22 Feb 2024 16:23:08 +0100 Subject: [PATCH 0634/2300] [nrf fromlist] dts: bindings: mbox: add nordic,nrf-bellboard-local|remote Add new bindings to describe the BELLBOARD peripheral in its two _programming modes_ local or remote. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit fc76661da25e408d6580f10d3efdc5cfcceb85cf) (cherry picked from commit 10563e2ffaed381c3f593fac7df98ef0bb8d3a41) --- .../mbox/nordic,nrf-bellboard-common.yaml | 11 +++++ .../mbox/nordic,nrf-bellboard-local.yaml | 43 +++++++++++++++++++ .../mbox/nordic,nrf-bellboard-remote.yaml | 22 ++++++++++ 3 files changed, 76 insertions(+) create mode 100644 dts/bindings/mbox/nordic,nrf-bellboard-common.yaml create mode 100644 dts/bindings/mbox/nordic,nrf-bellboard-local.yaml create mode 100644 dts/bindings/mbox/nordic,nrf-bellboard-remote.yaml diff --git a/dts/bindings/mbox/nordic,nrf-bellboard-common.yaml b/dts/bindings/mbox/nordic,nrf-bellboard-common.yaml new file mode 100644 index 00000000000..0d1d0bc26e2 --- /dev/null +++ b/dts/bindings/mbox/nordic,nrf-bellboard-common.yaml @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +include: [base.yaml, "mailbox-controller.yaml"] + +properties: + reg: + required: true + +mbox-cells: + - channel diff --git a/dts/bindings/mbox/nordic,nrf-bellboard-local.yaml b/dts/bindings/mbox/nordic,nrf-bellboard-local.yaml new file mode 100644 index 00000000000..5c1709987cc --- /dev/null +++ b/dts/bindings/mbox/nordic,nrf-bellboard-local.yaml @@ -0,0 +1,43 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic BELLBOARD + + BELLBOARD provides support for inter-domain software signaling. It implements + a set of tasks and events intended for signaling within an interprocessor + communication (IPC) framework. When used in local mode, the BELLBOARD + instance is used to receive events triggered by other remote cores. + + Example definition: + + bellboard: mailbox@deadbeef { + compatible = "nordic,nrf-bellboard-local"; + reg = <0xdeadbeef 0x1000>; + interrupts = <98 NRF_DEFAULT_IRQ_PRIORITY>, + <99 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq2", "irq3"; + nordic,interrupt-mapping = <0x0000000f 2>, <0x000000f0 3>; + #mbox-cells = <1>; + }; + +compatible: "nordic,nrf-bellboard-local" + +include: "nordic,nrf-bellboard-common.yaml" + +properties: + interrupts: + required: true + + interrupt-names: + required: true + + nordic,interrupt-mapping: + type: array + required: true + description: | + Set of interrupt mapping pairs. Each pair consists of a bitmask and an + interrupt identifier. The bitmask is used to indicate which of the 32 + possible events are mapped to the given interrupt. For example, given + <0x0000000f 2>, the first four events are mapped to interrupt 2 + (irq2). diff --git a/dts/bindings/mbox/nordic,nrf-bellboard-remote.yaml b/dts/bindings/mbox/nordic,nrf-bellboard-remote.yaml new file mode 100644 index 00000000000..ae17fc916a1 --- /dev/null +++ b/dts/bindings/mbox/nordic,nrf-bellboard-remote.yaml @@ -0,0 +1,22 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic BELLBOARD + + BELLBOARD provides support for inter-domain software signaling. It implements + a set of tasks and events intended for signaling within an interprocessor + communication (IPC) framework. When used in remote mode, the BELLBOARD + instance is used to trigger events to another core. + + Example definition: + + bellboard: mailbox@deadbeef { + compatible = "nordic,nrf-bellboard-remote"; + reg = <0xdeadbeef 0x1000>; + #mbox-cells = <1>; + }; + +compatible: "nordic,nrf-bellboard-remote" + +include: "nordic,nrf-bellboard-common.yaml" From eadc28bcec9158f7bc7caec1e1a24006df0c3a0b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 22 Feb 2024 16:24:14 +0100 Subject: [PATCH 0635/2300] [nrf fromlist] dts: nordic: nrf54h20_enga: add BELLBOARD nodes Add nodes for APP/RAD BELLBOARD peripherals. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 19dca26c3c2801123b6c4e7e9d7915dba4f4ccce) (cherry picked from commit 831c6b056dfbc412aea0c2d824c44ec11a2a8db4) --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 12 ++++++++++++ dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 12 ++++++++++++ dts/common/nordic/nrf54h20_enga.dtsi | 18 ++++++++++++++++++ dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 12 ++++++++++++ 4 files changed, 54 insertions(+) diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi index f51528d5733..25585659968 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -29,6 +29,18 @@ nvic: &cpuapp_nvic {}; ranges; }; +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-local"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + &gpiote130 { interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi index cb2767381da..e51ce316c3f 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -29,6 +29,18 @@ nvic: &cpurad_nvic {}; ranges; }; +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-local"; +}; + &gpiote130 { interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 5a9af57801c..3a8a5759268 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -223,6 +223,24 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; + cpusec_bellboard: mailbox@99000 { + reg = <0x99000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + cpuapp_bellboard: mailbox@9a000 { + reg = <0x9a000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + cpurad_bellboard: mailbox@9b000 { + reg = <0x9b000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + timer120: timer@8e2000 { compatible = "nordic,nrf-timer"; reg = <0x8e2000 0x1000>; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi index d42a815a4b2..dcefe95885c 100644 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -26,6 +26,18 @@ clic: &cpuppr_clic {}; }; }; +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + &gpiote130 { interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; }; From cc15acc1654fb0687e6cf107b8cb692d03405fbf Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 22 Feb 2024 16:26:00 +0100 Subject: [PATCH 0636/2300] [nrf fromlist] drivers: mbox: nrf_bellboard: add initial driver Add a new driver for nRF BELLBOARD peripheral, in both local and remote modes. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit c0d4e0294cbf35a0a14e3a5726a8f1f01689876e) (cherry picked from commit 4ff2b8ae813cfeac39548ee5467433996fe8e89b) --- drivers/mbox/CMakeLists.txt | 2 + drivers/mbox/Kconfig | 1 + drivers/mbox/Kconfig.nrf_bellboard | 16 +++ drivers/mbox/mbox_nrf_bellboard_local.c | 169 +++++++++++++++++++++++ drivers/mbox/mbox_nrf_bellboard_remote.c | 62 +++++++++ 5 files changed, 250 insertions(+) create mode 100644 drivers/mbox/Kconfig.nrf_bellboard create mode 100644 drivers/mbox/mbox_nrf_bellboard_local.c create mode 100644 drivers/mbox/mbox_nrf_bellboard_remote.c diff --git a/drivers/mbox/CMakeLists.txt b/drivers/mbox/CMakeLists.txt index 6ecbfa5e7ed..476e131f00b 100644 --- a/drivers/mbox/CMakeLists.txt +++ b/drivers/mbox/CMakeLists.txt @@ -11,3 +11,5 @@ zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_IMX_MU mbox_nxp_imx_mu.c) zephyr_library_sources_ifdef(CONFIG_MBOX_ANDES_PLIC_SW mbox_andes_plic_sw.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_LOCAL mbox_nrf_vevif_local.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_REMOTE mbox_nrf_vevif_remote.c) +zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_LOCAL mbox_nrf_bellboard_local.c) +zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_REMOTE mbox_nrf_bellboard_remote.c) diff --git a/drivers/mbox/Kconfig b/drivers/mbox/Kconfig index 711e6637c4e..eb138dca145 100644 --- a/drivers/mbox/Kconfig +++ b/drivers/mbox/Kconfig @@ -16,6 +16,7 @@ source "drivers/mbox/Kconfig.nxp_s32" source "drivers/mbox/Kconfig.nxp_imx" source "drivers/mbox/Kconfig.andes" source "drivers/mbox/Kconfig.nrf_vevif" +source "drivers/mbox/Kconfig.nrf_bellboard" config MBOX_INIT_PRIORITY int "MBOX init priority" diff --git a/drivers/mbox/Kconfig.nrf_bellboard b/drivers/mbox/Kconfig.nrf_bellboard new file mode 100644 index 00000000000..45233122bd5 --- /dev/null +++ b/drivers/mbox/Kconfig.nrf_bellboard @@ -0,0 +1,16 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config MBOX_NRF_BELLBOARD_LOCAL + bool "nRF BELLBOARD local driver" + depends on DT_HAS_NORDIC_NRF_BELLBOARD_LOCAL_ENABLED + default y + help + Mailbox driver for local Nordic nRF BELLBOARD + +config MBOX_NRF_BELLBOARD_REMOTE + bool "nRF BELLBOARD remote driver" + depends on DT_HAS_NORDIC_NRF_BELLBOARD_REMOTE_ENABLED + default y + help + Mailbox driver for remote Nordic nRF BELLBOARD diff --git a/drivers/mbox/mbox_nrf_bellboard_local.c b/drivers/mbox/mbox_nrf_bellboard_local.c new file mode 100644 index 00000000000..99d05351aaa --- /dev/null +++ b/drivers/mbox/mbox_nrf_bellboard_local.c @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nordic_nrf_bellboard_local + +#include +#include +#include + +#include + +#define BELLBOARD_NUM_IRQS 4U + +BUILD_ASSERT(DT_NUM_IRQS(DT_DRV_INST(0)) <= BELLBOARD_NUM_IRQS, "# interrupt exceeds maximum"); + +BUILD_ASSERT((DT_INST_PROP_LEN(0, nordic_interrupt_mapping) % 2) == 0, + "# interrupt mappings not specified in pairs"); + +/* BELLBOARD event mappings */ +#define EVT_MAPPING_ITEM(idx) DT_INST_PROP_BY_IDX(0, nordic_interrupt_mapping, idx) +#define BELLBOARD_GET_EVT_MAPPING(idx, _) \ + COND_CODE_1( \ + DT_INST_PROP_HAS_IDX(0, nordic_interrupt_mapping, UTIL_INC(UTIL_X2(idx))), \ + ([EVT_MAPPING_ITEM(UTIL_INC(UTIL_X2(idx)))] = EVT_MAPPING_ITEM(UTIL_X2(idx)),), \ + ()) + +static const uint32_t evt_mappings[BELLBOARD_NUM_IRQS] = { + LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), BELLBOARD_GET_EVT_MAPPING, ())}; + +/* BELLBOARD instance */ +static NRF_BELLBOARD_Type *bellboard = (NRF_BELLBOARD_Type *)DT_INST_REG_ADDR(0); + +/* BELLBOARD runtime resources */ +static mbox_callback_t cbs[NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT]; +static void *cbs_ctx[NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT]; +static uint32_t evt_enabled_masks[BELLBOARD_NUM_IRQS]; + +static void bellboard_local_isr(const void *parameter) +{ + uint8_t irq_idx = (uint8_t)(uintptr_t)parameter; + uint32_t int_pend; + + int_pend = nrf_bellboard_int_pending_get(bellboard, irq_idx); + + for (uint8_t i = 0U; i < NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT; i++) { + nrf_bellboard_event_t event = nrf_bellboard_triggered_event_get(i); + + if (nrf_bellboard_event_check(bellboard, event)) { + nrf_bellboard_event_clear(bellboard, event); + } + + if ((int_pend & BIT(i)) != 0U) { + if (cbs[i] != NULL) { + cbs[i](DEVICE_DT_INST_GET(0), i, cbs_ctx[i], NULL); + } + } + } +} + +static uint32_t bellboard_local_max_channels_get(const struct device *dev) +{ + ARG_UNUSED(dev); + + return NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT; +} + +static int bellboard_local_register_callback(const struct device *dev, uint32_t id, + mbox_callback_t cb, void *user_data) +{ + ARG_UNUSED(dev); + + if (id >= NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT) { + return -EINVAL; + } + + cbs[id] = cb; + cbs_ctx[id] = user_data; + + return 0; +} + +static int bellboard_local_set_enabled(const struct device *dev, uint32_t id, bool enable) +{ + bool valid_found = false; + + ARG_UNUSED(dev); + + if (id >= NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT) { + return -EINVAL; + } + + for (uint8_t i = 0U; i < BELLBOARD_NUM_IRQS; i++) { + uint32_t *evt_enabled_mask; + + if ((evt_mappings[i] == 0U) || ((evt_mappings[i] & BIT(id)) == 0U)) { + continue; + } + + valid_found = true; + evt_enabled_mask = &evt_enabled_masks[i]; + + if (enable) { + if ((*evt_enabled_mask & BIT(id)) != 0U) { + return -EALREADY; + } + + *evt_enabled_mask |= BIT(id); + nrf_bellboard_int_enable(bellboard, i, BIT(id)); + } else { + if ((*evt_enabled_mask & BIT(id)) == 0U) { + return -EALREADY; + } + + *evt_enabled_mask &= ~BIT(id); + nrf_bellboard_int_disable(bellboard, i, BIT(id)); + } + } + + if (!valid_found) { + return -EINVAL; + } + + return 0; +} + +static const struct mbox_driver_api bellboard_local_driver_api = { + .max_channels_get = bellboard_local_max_channels_get, + .register_callback = bellboard_local_register_callback, + .set_enabled = bellboard_local_set_enabled, +}; + +#define BELLBOARD_IRQ_CONFIGURE(name, idx) \ + COND_CODE_1(DT_INST_IRQ_HAS_NAME(0, name), \ + (IRQ_CONNECT(DT_INST_IRQ_BY_NAME(0, name, irq), \ + DT_INST_IRQ_BY_NAME(0, name, priority), bellboard_local_isr, \ + (const void *)idx, 0); \ + irq_enable(DT_INST_IRQ_BY_NAME(0, name, irq));), \ + ()) + +static int bellboard_local_init(const struct device *dev) +{ + uint32_t evt_all_mappings = + evt_mappings[0] | evt_mappings[1] | evt_mappings[2] | evt_mappings[3]; + + ARG_UNUSED(dev); + + nrf_bellboard_int_disable(bellboard, 0, evt_mappings[0]); + nrf_bellboard_int_disable(bellboard, 1, evt_mappings[1]); + nrf_bellboard_int_disable(bellboard, 2, evt_mappings[2]); + nrf_bellboard_int_disable(bellboard, 3, evt_mappings[3]); + + for (uint8_t i = 0U; i < NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT; i++) { + if ((evt_all_mappings & BIT(i)) != 0U) { + nrf_bellboard_event_clear(bellboard, nrf_bellboard_triggered_event_get(i)); + } + } + + BELLBOARD_IRQ_CONFIGURE(irq0, 0); + BELLBOARD_IRQ_CONFIGURE(irq1, 1); + BELLBOARD_IRQ_CONFIGURE(irq2, 2); + BELLBOARD_IRQ_CONFIGURE(irq3, 3); + + return 0; +} + +DEVICE_DT_INST_DEFINE(0, bellboard_local_init, NULL, NULL, NULL, POST_KERNEL, + CONFIG_MBOX_INIT_PRIORITY, &bellboard_local_driver_api); diff --git a/drivers/mbox/mbox_nrf_bellboard_remote.c b/drivers/mbox/mbox_nrf_bellboard_remote.c new file mode 100644 index 00000000000..c362522c0bf --- /dev/null +++ b/drivers/mbox/mbox_nrf_bellboard_remote.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nordic_nrf_bellboard_remote + +#include +#include + +#include + +struct mbox_bellboard_remote_conf { + NRF_BELLBOARD_Type *bellboard; +}; + +static int bellboard_remote_send(const struct device *dev, uint32_t id, const struct mbox_msg *msg) +{ + const struct mbox_bellboard_remote_conf *config = dev->config; + + if (id >= BELLBOARD_TASKS_TRIGGER_MaxCount) { + return -EINVAL; + } + + if (msg != NULL) { + return -ENOTSUP; + } + + nrfy_bellboard_task_trigger(config->bellboard, nrf_bellboard_trigger_task_get(id)); + + return 0; +} + +static int bellboard_remote_mtu_get(const struct device *dev) +{ + ARG_UNUSED(dev); + + return 0; +} + +static uint32_t bellboard_remote_max_channels_get(const struct device *dev) +{ + ARG_UNUSED(dev); + + return BELLBOARD_TASKS_TRIGGER_MaxCount; +} + +static const struct mbox_driver_api bellboard_remote_driver_api = { + .send = bellboard_remote_send, + .mtu_get = bellboard_remote_mtu_get, + .max_channels_get = bellboard_remote_max_channels_get, +}; + +#define BELLBOARD_REMOTE_DEFINE(inst) \ + static const struct mbox_bellboard_remote_conf conf##inst = { \ + .bellboard = (NRF_BELLBOARD_Type *)DT_INST_REG_ADDR(inst), \ + }; \ + \ + DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ + CONFIG_MBOX_INIT_PRIORITY, &bellboard_remote_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(BELLBOARD_REMOTE_DEFINE) From 7e15ea29496a13608de49588efa0a2bdd7511900 Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Wed, 28 Feb 2024 08:10:20 +0100 Subject: [PATCH 0637/2300] [nrf fromlist] modules: hal_nordic: remove weak nrf_802154_clock_hfclk_ready MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The __WEAK-tagged function `nrf_802154_clock_hfclk_ready` is removed. The implementation is provided by the nRF 802.15.4 Radio Driver. Existence of __WEAK-tagged version causes incorrect behavior when Link Time Optimization is used. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69581 Signed-off-by: Andrzej Kuroś (cherry picked from commit 768228d18f786e7c3f83f29eea23865c45d54e91) --- .../sl_opensource/platform/nrf_802154_clock_zephyr.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index c9260bf278a..3a3d9501d0c 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -109,11 +109,6 @@ bool nrf_802154_clock_lfclk_is_running(void) return lfclk_is_running; } -__WEAK void nrf_802154_clock_hfclk_ready(void) -{ - /* Intentionally empty. */ -} - __WEAK void nrf_802154_clock_lfclk_ready(void) { /* Intentionally empty. */ From a75b8284e97e7fc868acd58041ec8c1ea01b7a7a Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Tue, 27 Feb 2024 12:21:12 +0100 Subject: [PATCH 0638/2300] [nrf fromlist] boards: arm: nrf9151dk: fix broken link This patch fixes a broken link in the docs for the nrf9151dk. It points to the SiP's product page for now. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69516 Signed-off-by: Maximilian Deubel (cherry picked from commit 1b88b6f4d1384d69fde89f2ff67612288ccca998) (cherry picked from commit 9af8910735cf0a233288da4d9f2b570b0787ba03) --- boards/arm/nrf9151dk_nrf9151/doc/index.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/boards/arm/nrf9151dk_nrf9151/doc/index.rst b/boards/arm/nrf9151dk_nrf9151/doc/index.rst index 4c02e7ed372..91e9b75ad9c 100644 --- a/boards/arm/nrf9151dk_nrf9151/doc/index.rst +++ b/boards/arm/nrf9151dk_nrf9151/doc/index.rst @@ -26,9 +26,7 @@ Cortex-M33F CPU with ARMv8-M Security Extension and the following devices: * :abbr:`WDT (Watchdog Timer)` * :abbr:`IDAU (Implementation Defined Attribution Unit)` -More information about the board can be found at the -`nRF9151 DK website`_. The `Nordic Semiconductor Infocenter`_ -contains the processor's information and the datasheet. +More information about the board can be found at the `nRF9151 website`_. Hardware @@ -84,8 +82,7 @@ hardware features: .. _nrf9151dk_additional_hardware: Other hardware features have not been enabled yet for this board. -See `nRF9151 DK website`_ and `Nordic Semiconductor Infocenter`_ -for a complete list of nRF9151 DK board hardware features. +See the `nRF9151 website`_ for more information. Connections and IOs =================== @@ -198,6 +195,6 @@ References .. _IDAU: https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau -.. _nRF9151 DK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9151-DK +.. _nRF9151 website: https://www.nordicsemi.com/Products/nRF9151 .. _Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com .. _Trusted Firmware M: https://www.trustedfirmware.org/projects/tf-m/ From eb64ac18ece7b8c7054c6a9710e3b9ca92f8acad Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 16:13:59 +0100 Subject: [PATCH 0639/2300] [nrf fromlist] dts: nordic: nrf54h20_enga: add PPR VEVIF nodes Add a new nodes for PPR's VEVIF. In app cores, VEVIF registers are part of the VPR peripheral, so it is exposed as a child node (since it requires its own properties, eg #mbox-cells). In VPR, it's a CPU child since it's not a memory-mapped peripheral, but used with CSRs. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 901708525cd5fdeabdea78d3272c2639d796c0d0) (cherry picked from commit 743cc86218e1bf355bda66cdd535bf837b958ef0) --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 1 + dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 1 + dts/common/nordic/nrf54h20_enga.dtsi | 34 ++++++++++++++++++++++ dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 1 + 4 files changed, 37 insertions(+) diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi index 25585659968..7252b3d5a04 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -9,6 +9,7 @@ cpu: &cpuapp {}; systick: &cpuapp_systick {}; nvic: &cpuapp_nvic {}; +cpuppr_vevif: &cpuppr_vevif_remote {}; /delete-node/ &cpuppr; /delete-node/ &cpurad; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi index e51ce316c3f..d2aaa790349 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -9,6 +9,7 @@ cpu: &cpurad {}; systick: &cpurad_systick {}; nvic: &cpurad_nvic {}; +cpuppr_vevif: &cpuppr_vevif_remote {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 3a8a5759268..610fbd81587 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -40,6 +40,31 @@ clock-frequency = ; riscv,isa = "rv32emc"; nordic,bus-width = <32>; + + cpuppr_vevif_local: mailbox { + compatible = "nordic,nrf-vevif-local"; + status = "disabled"; + interrupt-parent = <&cpuppr_clic>; + interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, + <1 NRF_DEFAULT_IRQ_PRIORITY>, + <2 NRF_DEFAULT_IRQ_PRIORITY>, + <3 NRF_DEFAULT_IRQ_PRIORITY>, + <4 NRF_DEFAULT_IRQ_PRIORITY>, + <5 NRF_DEFAULT_IRQ_PRIORITY>, + <6 NRF_DEFAULT_IRQ_PRIORITY>, + <7 NRF_DEFAULT_IRQ_PRIORITY>, + <8 NRF_DEFAULT_IRQ_PRIORITY>, + <9 NRF_DEFAULT_IRQ_PRIORITY>, + <10 NRF_DEFAULT_IRQ_PRIORITY>, + <11 NRF_DEFAULT_IRQ_PRIORITY>, + <12 NRF_DEFAULT_IRQ_PRIORITY>, + <13 NRF_DEFAULT_IRQ_PRIORITY>, + <14 NRF_DEFAULT_IRQ_PRIORITY>, + <15 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask = <0xfffffff0>; + }; }; }; @@ -299,6 +324,15 @@ #size-cells = <1>; ranges = <0x0 0x908000 0x4000>; + cpuppr_vevif_remote: mailbox@0 { + compatible = "nordic,nrf-vevif-remote"; + reg = <0x0 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask = <0xfffffff0>; + }; + cpuppr_clic: interrupt-controller@1000 { compatible = "nordic,nrf-clic"; reg = <0x1000 0x3000>; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi index dcefe95885c..0af6618688f 100644 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -8,6 +8,7 @@ cpu: &cpuppr {}; clic: &cpuppr_clic {}; +cpuppr_vevif: &cpuppr_vevif_local {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; From ccbbadfcea727cdd93d6a314f996896552313e60 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 26 Feb 2024 14:50:21 +0100 Subject: [PATCH 0640/2300] [nrf fromlist] boards: nrf54h20pdk_nrf54h20: Update memory map Add IPC shared memory regions in the global RAM, as well as an enlarged SRAM region for Application core. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Grzegorz Swiderski (cherry picked from commit 7a5f20bc041a73d89484607bdf0fb8001bf146f3) (cherry picked from commit 458185d22602e2d372240008564fdd88909babe4) --- .../nrf54h20pdk_nrf54h20-memory_map.dtsi | 100 +++++++++++++++++- .../nrf54h20pdk_nrf54h20_cpuapp.dts | 8 +- .../nrf54h20pdk_nrf54h20_cpurad.dts | 2 +- 3 files changed, 106 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi index cb5a4fe0b0c..560700b1756 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi @@ -6,6 +6,96 @@ / { reserved-memory { + cpuapp_ram0x_region: memory@2f000000 { + compatible = "nordic,owned-memory"; + reg = <0x2f000000 DT_SIZE_K(260)>; + status = "disabled"; + perm-read; + perm-write; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f000000 0x41000>; + + cpusec_cpuapp_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpuapp_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + + cpuapp_data: memory@1000 { + reg = <0x1000 DT_SIZE_K(256)>; + }; + }; + + cpurad_ram0x_region: memory@2f041000 { + compatible = "nordic,owned-memory"; + reg = <0x2f041000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f041000 0x1000>; + + cpusec_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + }; + + cpuapp_cpurad_ram0x_region: memory@2f0bf000 { + compatible = "nordic,owned-memory"; + reg = <0x2f0bf000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f0bf000 0x1000>; + + cpuapp_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpuapp_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + }; + + shared_ram20_region: memory@2f88f000 { + compatible = "nordic,owned-memory"; + reg = <0x2f88f000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f88f000 0x1000>; + + cpuapp_cpusys_ipc_shm: memory@ce0 { + reg = <0xce0 0x80>; + }; + + cpusys_cpuapp_ipc_shm: memory@d60 { + reg = <0xd60 0x80>; + }; + + cpurad_cpusys_ipc_shm: memory@e00 { + reg = <0xe00 0x80>; + }; + + cpusys_cpurad_ipc_shm: memory@e80 { + reg = <0xe80 0x80>; + }; + }; + cpuppr_ram3x_region: memory@2fc00000 { compatible = "nordic,owned-memory"; reg = <0x2fc00000 DT_SIZE_K(28)>; @@ -15,7 +105,7 @@ perm-execute; }; - ram3x_dma_region: memory@2fc07000 { + shared_ram3x_region: memory@2fc07000 { compatible = "nordic,owned-memory"; reg = <0x2fc07000 DT_SIZE_K(4)>; status = "disabled"; @@ -25,6 +115,14 @@ #size-cells = <1>; ranges = <0x0 0x2fc07000 0x1000>; + cpuapp_cpuppr_ipc_shm: memory@0 { + reg = <0x0 0x340>; + }; + + cpuppr_cpuapp_ipc_shm: memory@340 { + reg = <0x340 0x340>; + }; + cpuapp_dma_region: memory@680 { compatible = "zephyr,memory-region"; reg = <0x680 DT_SIZE_K(2)>; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 8500d22a924..0251fbded25 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -18,7 +18,7 @@ zephyr,console = &uart136; zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; - zephyr,sram = &cpuapp_ram0; + zephyr,sram = &cpuapp_data; }; aliases { @@ -85,7 +85,11 @@ }; }; -&ram3x_dma_region { +&cpuapp_ram0x_region { + status = "okay"; +}; + +&shared_ram3x_region { status = "okay"; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index a7d142b06c4..d639847e197 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -22,7 +22,7 @@ }; }; -&ram3x_dma_region { +&shared_ram3x_region { status = "okay"; }; From f256013e8ee1d18284e575bef6470f4e20a633e9 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 29 Feb 2024 11:49:37 +0100 Subject: [PATCH 0641/2300] [nrf fromlist] boards: nrf54h20pdk: Add default IPC configuration Add `zephyr,ipc-icmsg*` nodes, with mboxes specified in a common file. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Grzegorz Swiderski Signed-off-by: Gerard Marull-Partetas (cherry picked from commit 035adef5768e79f4466e1f74dcd501efc39e2dc2) (cherry picked from commit 6319eaa2d2bfe96e7e8358c2acfee19d534358e0) --- .../nrf54h20pdk_nrf54h20-ipc_conf.dtsi | 36 +++++++++++++++++++ .../nrf54h20pdk_nrf54h20_cpuapp.dts | 29 +++++++++++++++ .../nrf54h20pdk_nrf54h20_cpurad.dts | 24 +++++++++++++ .../nrf54h20pdk_nrf54h20_cpuppr.dts | 11 ++++++ 4 files changed, 100 insertions(+) create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi new file mode 100644 index 00000000000..9c3d971b9bc --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + ipc { + cpusec_cpuapp_ipc: ipc-1-2 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpusec_bellboard 12>, + <&cpuapp_bellboard 0>; + }; + + cpusec_cpurad_ipc: ipc-1-3 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpusec_bellboard 18>, + <&cpurad_bellboard 0>; + }; + + cpuapp_cpurad_ipc: ipc-2-3 { + status = "disabled"; + mboxes = <&cpuapp_bellboard 18>, + <&cpurad_bellboard 12>; + }; + + cpuapp_cpuppr_ipc: ipc-2-13 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpuapp_bellboard 13>, + <&cpuppr_vevif 12>; + }; + }; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 0251fbded25..b2db9e4b9b1 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -8,8 +8,11 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" +/delete-node/ &cpusec_cpurad_ipc; + / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpuapp"; model = "Nordic nRF54H20 PDK nRF54H20 Application MCU"; @@ -93,6 +96,32 @@ status = "okay"; }; +&cpuapp_bellboard { + interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq0"; + /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ + nordic,interrupt-mapping = <0x00042001 0>; +}; + +&cpusec_cpuapp_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuapp_cpusec_ipc_shm>; + rx-region = <&cpusec_cpuapp_ipc_shm>; +}; + +&cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-initiator"; + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpurad_ipc_shm>; + rx-region = <&cpurad_cpuapp_ipc_shm>; +}; + +&cpuapp_cpuppr_ipc { + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpuppr_ipc_shm>; + rx-region = <&cpuppr_cpuapp_ipc_shm>; +}; + &cpuapp_dma_region { status = "okay"; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index d639847e197..8d2629df62e 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -8,8 +8,12 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" +/delete-node/ &cpuapp_cpuppr_ipc; +/delete-node/ &cpusec_cpuapp_ipc; + / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpurad"; model = "Nordic nRF54H20 PDK nRF54H20 Radio MCU"; @@ -26,6 +30,26 @@ status = "okay"; }; +&cpurad_bellboard { + interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq0"; + /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ + nordic,interrupt-mapping = <0x00001001 0>; +}; + +&cpusec_cpurad_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpusec_ipc_shm>; + rx-region = <&cpusec_cpurad_ipc_shm>; +}; + +&cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-follower"; + mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpurad_ipc_shm>; +}; + &cpurad_dma_region { status = "okay"; }; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts index 3c74e7c88d4..f98abb9e44b 100644 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts @@ -8,8 +8,13 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" +/delete-node/ &cpuapp_cpurad_ipc; +/delete-node/ &cpusec_cpuapp_ipc; +/delete-node/ &cpusec_cpurad_ipc; + / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpuppr"; model = "Nordic nRF54H20 PDK nRF54H20 Peripheral Processor MCU"; @@ -24,6 +29,12 @@ }; }; +&cpuapp_cpuppr_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuppr_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpuppr_ipc_shm>; +}; + &grtc { status = "okay"; owned-channels = <5>; From a66f3be42739460fc1da6cf14564b1b25e9e87cd Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:36:43 +0100 Subject: [PATCH 0642/2300] [nrf fromlist] samples: drivers: mbox: add support for nRF VEVIF Add support for nRF VEVIF. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit d40fd1f886666d0d61a7a555439857c5654bec55) (cherry picked from commit 599986ab52c40d96ee293687718a32fcfb5d09be) --- samples/drivers/mbox/CMakeLists.txt | 3 ++- samples/drivers/mbox/Kconfig.sysbuild | 1 + .../nrf54h20pdk_nrf54h20_cpuapp_vevif.conf | 2 ++ .../nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay | 8 +++++++ samples/drivers/mbox/remote/CMakeLists.txt | 3 ++- .../nrf54h20pdk_nrf54h20_cpuppr_vevif.conf | 2 ++ .../nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay | 8 +++++++ samples/drivers/mbox/sample.yaml | 21 +++++++++++++++++++ 8 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf create mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay create mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf create mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index ec79db9deed..c69621c2496 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -17,7 +17,8 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0") OR + ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuapp")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index a17dd56ee55..aca48b8ead3 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -14,3 +14,4 @@ string default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" + default "nrf54h20pdk_nrf54h20_cpuppr" if $(BOARD) = "nrf54h20pdk_nrf54h20_cpuapp" diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf new file mode 100644 index 00000000000..d8d66e9812d --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf @@ -0,0 +1,2 @@ +CONFIG_RX_ENABLED=n +CONFIG_TX_CHANNEL_ID=4 diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay new file mode 100644 index 00000000000..ed631f04cc3 --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +mbox: &cpuppr_vevif { + status = "okay"; +}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index 2c7c8fff29e..cb024cb6112 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -15,7 +15,8 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1") OR - ("${BOARD}" STREQUAL "adp_xc7k_ae350")) + ("${BOARD}" STREQUAL "adp_xc7k_ae350") OR + ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuppr")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf new file mode 100644 index 00000000000..19e03b75c63 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf @@ -0,0 +1,2 @@ +CONFIG_TX_ENABLED=n +CONFIG_RX_CHANNEL_ID=4 diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay new file mode 100644 index 00000000000..ed631f04cc3 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +mbox: &cpuppr_vevif { + status = "okay"; +}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index e38deda55d3..8c85a8d5150 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -23,6 +23,27 @@ tests: - "Pong \\(on channel 0\\)" - "Ping \\(on channel 1\\)" - "Pong \\(on channel 1\\)" + + sample.drivers.mbox.nrf54h20_vevif: + platform_allow: + - nrf54h20pdk_nrf54h20_cpuapp + integration_platforms: + - nrf54h20pdk_nrf54h20_cpuapp + extra_args: + mbox_SNIPPET=nordic-ppr + mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf + mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay + remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf + remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay + sysbuild: true + harness: console + harness_config: + type: multi_line + ordered: false + regex: + - "Ping \\(on channel 4\\)" + - "Pong \\(on channel 4\\)" + sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp From 34e58efcd85ab0dae226d0be16c3224e5b1b584d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 22 Feb 2024 16:22:21 +0100 Subject: [PATCH 0643/2300] [nrf fromlist] samples: drivers: mbox: add support for nRF BELLBOARD Add support for testing BELLBOARD between cpuapp (local) and cpuppr (remote). Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 54d64e39a00b6ef9383ea46eb79a409e11ccc189) (cherry picked from commit bd0efe3503272d4af94b193a1d6a629dc08ddb30) --- ...nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf | 1 + ...54h20pdk_nrf54h20_cpuapp_bellboard.overlay | 8 ++++++++ ...nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf | 1 + ...54h20pdk_nrf54h20_cpuppr_bellboard.overlay | 8 ++++++++ samples/drivers/mbox/sample.yaml | 20 +++++++++++++++++++ 5 files changed, 38 insertions(+) create mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf create mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay create mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf create mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf new file mode 100644 index 00000000000..0b6bc73d6bc --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf @@ -0,0 +1 @@ +CONFIG_TX_ENABLED=n diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay new file mode 100644 index 00000000000..5f0cfe2261d --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +mbox: &cpuapp_bellboard { + status = "okay"; +}; diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf new file mode 100644 index 00000000000..4596bc3a757 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf @@ -0,0 +1 @@ +CONFIG_RX_ENABLED=n diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay new file mode 100644 index 00000000000..5f0cfe2261d --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +mbox: &cpuapp_bellboard { + status = "okay"; +}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 8c85a8d5150..b386b9d2b4b 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -44,6 +44,26 @@ tests: - "Ping \\(on channel 4\\)" - "Pong \\(on channel 4\\)" + sample.drivers.mbox.nrf54h20_bellboard: + platform_allow: + - nrf54h20pdk_nrf54h20_cpuapp + integration_platforms: + - nrf54h20pdk_nrf54h20_cpuapp + extra_args: + mbox_SNIPPET=nordic-ppr + mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf + mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay + remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf + remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay + sysbuild: true + harness: console + harness_config: + type: multi_line + ordered: false + regex: + - "Ping \\(on channel 0\\)" + - "Pong \\(on channel 0\\)" + sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp From 229904255a65fc168fe04b07a62c70bd8f868023 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Wed, 31 Jan 2024 17:00:20 +0100 Subject: [PATCH 0644/2300] [nrf fromlist] dts: arm: nrf54l: Add nodes required by MCUboot Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68393 The commit adds partitons on rram0. Signed-off-by: Mateusz Michalek (cherry picked from commit 1f01183e44e290eeed5632bdd9bc3fd8fadea650) --- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index 1e0245f6cc3..f2703872899 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -133,13 +133,30 @@ compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - slot0_partition: partition@0 { - label = "image-0"; + boot_partition: partition@0 { + label = "mcuboot"; reg = <0x0 DT_SIZE_K(64)>; }; - storage_partition: partition@f2000 { + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(348)>; + }; + slot0_ns_partition: partition@67000 { + label = "image-0-nonsecure"; + reg = <0x67000 DT_SIZE_K(348)>; + }; + slot1_partition: partition@be000 { + label = "image-1"; + reg = <0xbe000 DT_SIZE_K(348)>; + }; + slot1_ns_partition: partition@115000 { + label = "image-1-nonsecure"; + reg = <0x115000 DT_SIZE_K(348)>; + }; + /* 32k from 0x16c000 to 0x173fff reserved for TF-M partitions */ + storage_partition: partition@174000 { label = "storage"; - reg = <0xf2000 DT_SIZE_K(24)>; + reg = <0x174000 DT_SIZE_K(36)>; }; }; }; From 54f6f538b691e3ec1dbcb7ec14466e07dedbf698 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Fri, 16 Feb 2024 12:57:30 +0100 Subject: [PATCH 0645/2300] [nrf fromlist] dts: arm: add uart-mcumgr choosen for 54L15 Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68393 setting uart20 as default uart-mcumgr Signed-off-by: Mateusz Michalek (cherry picked from commit a7971abcb9a7daca57756ca96045a24014a0f396) --- boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index f2703872899..9876e3996e8 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -16,6 +16,7 @@ chosen { zephyr,console = &uart20; zephyr,shell-uart = &uart20; + zephyr,uart-mcumgr = &uart20; zephyr,sram = &sram0; zephyr,flash = &rram0; zephyr,code-partition = &slot0_partition; From 1d331bf7e78fde7c98fe87cf385ebd5ff970196b Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 13 Feb 2024 12:44:45 +0100 Subject: [PATCH 0646/2300] [nrf fromlist] linker: Set ROM offset for MCUboot with NRF54L Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68393 Due to number of IRQs the ROM offset, that contains MCUboot, needs to be moved to address that is aligned with 2048 byte long vector table. This comes from Cortex-M requirement where vector table needs to be placed at offset equal to lowest power of two number that will fit vector table. Signed-off-by: Dominik Ermel Signed-off-by: Mateusz Michalek Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 3912101710c23bfa3b6a2c5ab6fdecb6043a7133) --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig index 532ea07c859..3e47a0bb583 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig @@ -9,4 +9,8 @@ config BOARD config BT_CTLR default BT +config ROM_START_OFFSET + hex + default 0x800 if BOOTLOADER_MCUBOOT + endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP From 739b8f74740eccc2f320ac684d6b3934b2144fe3 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Tue, 27 Feb 2024 13:17:37 +0100 Subject: [PATCH 0647/2300] [nrf fromlist] buildsystem: Enable LTO also for the application MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69519 It turns out that currently LTO is enabled only for the kernel. This commit updates it to enable it for the whole application and adds additional LTO exclusions required for the standard C libraries to build and link properly. Signed-off-by: Radosław Koppel (cherry picked from commit 9448e2b8de2772771a7faae884a4adaee451cba8) --- CMakeLists.txt | 2 +- lib/libc/newlib/CMakeLists.txt | 3 +++ lib/libc/picolibc/CMakeLists.txt | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bb1774d020..10196c43540 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,7 +214,7 @@ endif() zephyr_compile_options(${OPTIMIZATION_FLAG}) if(CONFIG_LTO) - add_compile_options($) + zephyr_compile_options($) add_link_options($) endif() diff --git a/lib/libc/newlib/CMakeLists.txt b/lib/libc/newlib/CMakeLists.txt index 6556a3e814c..35c6a9b6337 100644 --- a/lib/libc/newlib/CMakeLists.txt +++ b/lib/libc/newlib/CMakeLists.txt @@ -3,6 +3,9 @@ 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 normally uses -ffreestanding, which with current GNU toolchains # means that the flag macros used by newlib 3.x to signal # support for PRI.64 macros are not present. To make them available we diff --git a/lib/libc/picolibc/CMakeLists.txt b/lib/libc/picolibc/CMakeLists.txt index 232e4ba8fc1..719ff70f49d 100644 --- a/lib/libc/picolibc/CMakeLists.txt +++ b/lib/libc/picolibc/CMakeLists.txt @@ -3,6 +3,9 @@ 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 $) + # define __LINUX_ERRNO_EXTENSIONS__ so we get errno defines like -ESHUTDOWN # used by the network stack zephyr_compile_definitions(__LINUX_ERRNO_EXTENSIONS__) From 3eb95e74276b956f1eda8649e54a6fbd8f8a46b1 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Thu, 29 Feb 2024 19:40:12 +0100 Subject: [PATCH 0648/2300] [nrf fromlist] modules: hal_nordic: Enforce nrf-regtool minimum version Require the presence of the nrf-regtool package as well as requiring a minimum version, failing the build whenever a suitable version is not found in the system. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69633 Signed-off-by: Carles Cufi (cherry picked from commit 0e13f61d8ed687a2cc428c8a0458f496e639bd70) (cherry picked from commit 8d93a161567dcc525771f70692587e6a37947b71) --- 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 c4a7134935c..7f46997c697 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -11,7 +11,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.1.0 + find_package(nrf-regtool 5.1.0 REQUIRED COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From 724394e5c95d1424daead22e5550d06c26c92fcb Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Tue, 5 Mar 2024 09:01:16 +0100 Subject: [PATCH 0649/2300] [nrf fromlist] kconfig: shell: fix incorrect shell stack size for Thread Shell stack size is too low for OpenThread without joiner functionality, causing overflow. In this commit, the value of stack size is not changed. Incorrect assigning of value for opentrhead with no joiner functionality has been removed. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69783 Signed-off-by: Maciej Baczmanski (cherry picked from commit c346df93cf8d8a3be8a82fd2b23ae083dda64abb) (cherry picked from commit d10178eca5c0c3ae8be42532af603568d9fb54d7) --- subsys/shell/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/shell/Kconfig b/subsys/shell/Kconfig index 43035e520e1..cb9af338b20 100644 --- a/subsys/shell/Kconfig +++ b/subsys/shell/Kconfig @@ -40,9 +40,8 @@ endif config SHELL_STACK_SIZE int "Shell thread stack size" - default 3168 if OPENTHREAD_SHELL && OPENTHREAD_JOINER + default 3168 if OPENTHREAD_SHELL default 3072 if 64BIT - default 2616 if OPENTHREAD_SHELL default 2048 if MULTITHREADING default 0 if !MULTITHREADING help From 9982b0f82554206e4c5ecd79919aea8b212447bf Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 5 Mar 2024 13:32:42 +0100 Subject: [PATCH 0650/2300] [nrf fromtree] manifest: remove .git suffixes from repo-paths Some entries had the .git suffix in the repo-path property. While it does not affect e.g. clones, it makes the project URL (built using base url and repo-path) unusable to build other URLs (e.g. to point to a commit, release tag, etc.). Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 16a60630830d19c0be6c3118c9dd3f33d03d0ac7) (cherry picked from commit 58e83a8da428b96bc00267e8480eabcc89875a00) --- west.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/west.yml b/west.yml index 68a87e6cf76..46e2085d756 100644 --- a/west.yml +++ b/west.yml @@ -40,77 +40,77 @@ manifest: - babblesim - name: babblesim_base remote: babblesim - repo-path: base.git + repo-path: base path: tools/bsim/components revision: 19d62424c0802c6c9fc15528febe666e40f372a1 groups: - babblesim - name: babblesim_ext_2G4_libPhyComv1 remote: babblesim - repo-path: ext_2G4_libPhyComv1.git + repo-path: ext_2G4_libPhyComv1 path: tools/bsim/components/ext_2G4_libPhyComv1 revision: 9018113a362fa6c9e8f4b9cab9e5a8f12cc46b94 groups: - babblesim - name: babblesim_ext_2G4_phy_v1 remote: babblesim - repo-path: ext_2G4_phy_v1.git + repo-path: ext_2G4_phy_v1 path: tools/bsim/components/ext_2G4_phy_v1 revision: d47c6dd90035b41b14f6921785ccb7b8484868e2 groups: - babblesim - name: babblesim_ext_2G4_channel_NtNcable remote: babblesim - repo-path: ext_2G4_channel_NtNcable.git + repo-path: ext_2G4_channel_NtNcable path: tools/bsim/components/ext_2G4_channel_NtNcable revision: 20a38c997f507b0aa53817aab3d73a462fff7af1 groups: - babblesim - name: babblesim_ext_2G4_channel_multiatt remote: babblesim - repo-path: ext_2G4_channel_multiatt.git + repo-path: ext_2G4_channel_multiatt path: tools/bsim/components/ext_2G4_channel_multiatt revision: bde72a57384dde7a4310bcf3843469401be93074 groups: - babblesim - name: babblesim_ext_2G4_modem_magic remote: babblesim - repo-path: ext_2G4_modem_magic.git + repo-path: ext_2G4_modem_magic path: tools/bsim/components/ext_2G4_modem_magic revision: cb70771794f0bf6f262aa474848611c68ae8f1ed groups: - babblesim - name: babblesim_ext_2G4_modem_BLE_simple remote: babblesim - repo-path: ext_2G4_modem_BLE_simple.git + repo-path: ext_2G4_modem_BLE_simple path: tools/bsim/components/ext_2G4_modem_BLE_simple revision: 809ab073159c9ab6686c2fea5749b0702e0909f7 groups: - babblesim - name: babblesim_ext_2G4_device_burst_interferer remote: babblesim - repo-path: ext_2G4_device_burst_interferer.git + repo-path: ext_2G4_device_burst_interferer path: tools/bsim/components/ext_2G4_device_burst_interferer revision: 5b5339351d6e6a2368c686c734dc8b2fc65698fc groups: - babblesim - name: babblesim_ext_2G4_device_WLAN_actmod remote: babblesim - repo-path: ext_2G4_device_WLAN_actmod.git + repo-path: ext_2G4_device_WLAN_actmod path: tools/bsim/components/ext_2G4_device_WLAN_actmod revision: 9cb6d8e72695f6b785e57443f0629a18069d6ce4 groups: - babblesim - name: babblesim_ext_2G4_device_playback remote: babblesim - repo-path: ext_2G4_device_playback.git + repo-path: ext_2G4_device_playback path: tools/bsim/components/ext_2G4_device_playback revision: 85c645929cf1ce995d8537107d9dcbd12ed64036 groups: - babblesim - name: babblesim_ext_libCryptov1 remote: babblesim - repo-path: ext_libCryptov1.git + repo-path: ext_libCryptov1 path: tools/bsim/components/ext_libCryptov1 revision: eed6d7038e839153e340bd333bc43541cb90ba64 groups: From c82c6569ace538abf08f9dd8e469d3ae5a289597 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 10 Jan 2024 12:17:53 -0600 Subject: [PATCH 0651/2300] [nrf fromtree] net: l2: wifi: wifi_utils: Resolve build warning with strncpy function ARM GCC version 12.2.0 (Zephyr SDK 0.16.4) generates the following build warning from the strncpy call in "wifi_utils_parse_scan_bands": warning: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length To resolve this warning, pass the maximum length of the temporary parse_str buffer to strncpy. This also has the benefit of correctly null terminating parse_str, since we already verify the scan_bands_str is properly null terminated with the strlen() check in this function. We can therefore remove the line adding a null terminator to parse_str as well. Signed-off-by: Daniel DeGrasse (cherry picked from commit 76f547e7633266c51a6e9c147da1658afa9e5b88) (cherry picked from commit a8a670326d5dc69eca2a570a808bc4c4aefd136c) --- subsys/net/l2/wifi/wifi_utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_utils.c b/subsys/net/l2/wifi/wifi_utils.c index bd47205e4f9..01c4bf1ea81 100644 --- a/subsys/net/l2/wifi/wifi_utils.c +++ b/subsys/net/l2/wifi/wifi_utils.c @@ -241,8 +241,7 @@ int wifi_utils_parse_scan_bands(char *scan_bands_str, uint8_t *band_map) return -EINVAL; } - strncpy(parse_str, scan_bands_str, len); - parse_str[len] = '\0'; + strncpy(parse_str, scan_bands_str, sizeof(parse_str)); band_str = strtok_r(parse_str, ",", &ctx); From 04aecc5917ed08d4e9d4b7705f5aa99d7c4e4c0f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 6 Mar 2024 11:50:42 +0100 Subject: [PATCH 0652/2300] [nrf fromlist] net: sockets: packet: Ignore the packet type if LL address is not set In case the LL address is not set on a packet for any reason, don't try to access address structure to determine packet type. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69850 Signed-off-by: Robert Lubos (cherry picked from commit 7d195f1a20bdb1da597e92e6b88382c6e8aa0cf7) --- subsys/net/lib/sockets/sockets_packet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/net/lib/sockets/sockets_packet.c b/subsys/net/lib/sockets/sockets_packet.c index bcf063abe29..ce4f83190c4 100644 --- a/subsys/net/lib/sockets/sockets_packet.c +++ b/subsys/net/lib/sockets/sockets_packet.c @@ -144,6 +144,10 @@ static void zpacket_set_eth_pkttype(struct net_if *iface, struct sockaddr_ll *addr, struct net_linkaddr *lladdr) { + if (lladdr == NULL || lladdr->addr == NULL) { + return; + } + if (net_eth_is_addr_broadcast((struct net_eth_addr *)lladdr->addr)) { addr->sll_pkttype = PACKET_BROADCAST; } else if (net_eth_is_addr_multicast( From e71b56e87ba8b50962709a68593076a771bfe50e Mon Sep 17 00:00:00 2001 From: Jonathan Rico Date: Mon, 4 Mar 2024 09:45:12 +0100 Subject: [PATCH 0653/2300] [nrf fromlist] Bluetooth: ATT: lock scheduler when sending from user thread `att_req_send_process` is not thread safe. In the case where the current context is pre-emptible (e.g. when a user sends something over GATT from the main thread): The iterator in `att_req_send_process` can get interrupted mid-processing, breaking the logic and resulting in an assert/crash/data corruption. Additionally, the connection state check in this fn is also not thread-safe, the RX thread could pre-empt us and disconnect right before we attempt to send on an ATT bearer that is on it. This is a hotfix until we have a generalized solution for the host API surface. It seems a lot of our logic assumes cooperative priority. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69738 Signed-off-by: Jonathan Rico (cherry picked from commit 226b676f94f6d0999b3199a6723057f533754ac7) --- subsys/bluetooth/host/att.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index f8e924852e3..4e7e5b4880c 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -3928,14 +3928,19 @@ int bt_att_req_send(struct bt_conn *conn, struct bt_att_req *req) __ASSERT_NO_MSG(conn); __ASSERT_NO_MSG(req); + k_sched_lock(); + att = att_get(conn); if (!att) { + k_sched_unlock(); return -ENOTCONN; } sys_slist_append(&att->reqs, &req->node); att_req_send_process(att); + k_sched_unlock(); + return 0; } From 01f4a78eca85ee7d902bd4e3c10566ff896fb4e5 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Thu, 7 Mar 2024 11:35:04 +0200 Subject: [PATCH 0654/2300] [nrf fromtree] drivers: modem_cellular: allow leaving out the chat_filter parameter Allow not specifying the chat_filter parameter in a device definition, which is equivalent to setting it to "". Signed-off-by: Tomi Fontanilles (cherry picked from commit fd5c76ddfdfe4c0e32c77f5baaf0bc62c8c8d950) (cherry picked from commit c92db91f87efccfb6c1a586a48b04b96c0ca525d) --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 276c9d38f7b..15f10f11a52 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1516,7 +1516,7 @@ static int modem_cellular_init(const struct device *dev) .delimiter = data->chat_delimiter, .delimiter_size = strlen(data->chat_delimiter), .filter = data->chat_filter, - .filter_size = strlen(data->chat_filter), + .filter_size = data->chat_filter ? strlen(data->chat_filter) : 0, .argv = data->chat_argv, .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, From f57e95b2762782f390d731ab5dfbeaefe0feda3e Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 5 Mar 2024 14:18:50 +0100 Subject: [PATCH 0655/2300] [nrf fromtree] drivers: flash: Add flash driver for MRAM Basic driver utilizing the flash API for NVM operations on the nRF54H20. Signed-off-by: Grzegorz Swiderski (cherry picked from commit f91323ee5da06fa8e26f47317a2dddb2d52da154) (cherry picked from commit ad03431d632d1629a38cae504ba2b162d0098d05) --- drivers/flash/CMakeLists.txt | 1 + drivers/flash/Kconfig | 2 + drivers/flash/Kconfig.nrf_mram | 19 ++++ drivers/flash/soc_flash_nrf_mram.c | 177 +++++++++++++++++++++++++++++ 4 files changed, 199 insertions(+) create mode 100644 drivers/flash/Kconfig.nrf_mram create mode 100644 drivers/flash/soc_flash_nrf_mram.c diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index 7426b43b089..7e8e5832afe 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -119,3 +119,4 @@ 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_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) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index 03d4d07a193..7f882c517ac 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -162,4 +162,6 @@ source "drivers/flash/Kconfig.ambiq" source "drivers/flash/Kconfig.nrf_rram" +source "drivers/flash/Kconfig.nrf_mram" + endif # FLASH diff --git a/drivers/flash/Kconfig.nrf_mram b/drivers/flash/Kconfig.nrf_mram new file mode 100644 index 00000000000..0ef65864a62 --- /dev/null +++ b/drivers/flash/Kconfig.nrf_mram @@ -0,0 +1,19 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config SOC_FLASH_NRF_MRAM + bool "Nordic Semiconductor flash driver for MRAM" + default y + depends on DT_HAS_NORDIC_MRAM_ENABLED + select FLASH_HAS_DRIVER_ENABLED + select FLASH_HAS_PAGE_LAYOUT + imply MPU_ALLOW_FLASH_WRITE if ARM_MPU + help + Enables Nordic Semiconductor flash driver for MRAM in direct write mode. + + Note that MRAM words are auto-erased when written to, but writing to a + pre-erased area is faster. Hence, the erase API is not required, but + it can be used to amortize write performance for some use cases. diff --git a/drivers/flash/soc_flash_nrf_mram.c b/drivers/flash/soc_flash_nrf_mram.c new file mode 100644 index 00000000000..9b33ee05d6f --- /dev/null +++ b/drivers/flash/soc_flash_nrf_mram.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include + +LOG_MODULE_REGISTER(flash_nrf_mram, CONFIG_FLASH_LOG_LEVEL); + +#define DT_DRV_COMPAT nordic_mram + +#define MRAM_START DT_INST_REG_ADDR(0) +#define MRAM_SIZE DT_INST_REG_SIZE(0) + +#define MRAM_WORD_SIZE 16 +#define MRAM_WORD_MASK 0xf + +#define WRITE_BLOCK_SIZE DT_INST_PROP_OR(0, write_block_size, MRAM_WORD_SIZE) +#define ERASE_BLOCK_SIZE DT_INST_PROP_OR(0, erase_block_size, WRITE_BLOCK_SIZE) + +#define ERASE_VALUE 0xff + +BUILD_ASSERT(MRAM_START > 0, "nordic,mram: start address expected to be non-zero"); +BUILD_ASSERT((ERASE_BLOCK_SIZE % WRITE_BLOCK_SIZE) == 0, + "erase-block-size expected to be a multiple of write-block-size"); + +/** + * @param[in,out] offset Relative offset into memory, from the driver API. + * @param[in] len Number of bytes for the intended operation. + * @param[in] must_align Require MRAM word alignment, if applicable. + * + * @return Absolute address in MRAM, or NULL if @p offset or @p len are not + * within bounds or appropriately aligned. + */ +static uintptr_t validate_and_map_addr(off_t offset, size_t len, bool must_align) +{ + if (unlikely(offset < 0 || offset >= MRAM_SIZE || len > MRAM_SIZE - offset)) { + LOG_ERR("invalid offset: %ld:%zu", offset, len); + return 0; + } + + const uintptr_t addr = MRAM_START + offset; + + if (WRITE_BLOCK_SIZE > 1 && must_align && + unlikely((addr % WRITE_BLOCK_SIZE) != 0 || (len % WRITE_BLOCK_SIZE) != 0)) { + LOG_ERR("invalid alignment: %p:%zu", (void *)addr, len); + return 0; + } + + return addr; +} + +/** + * @param[in] addr_end Last modified MRAM address (not inclusive). + */ +static void commit_changes(uintptr_t addr_end) +{ + /* Barrier following our last write. */ + barrier_dmem_fence_full(); + + if ((WRITE_BLOCK_SIZE & MRAM_WORD_MASK) == 0 || (addr_end & MRAM_WORD_MASK) == 0) { + /* Our last operation was MRAM word-aligned, so we're done. + * Note: if WRITE_BLOCK_SIZE is a multiple of MRAM_WORD_SIZE, + * then this was already checked in validate_and_map_addr(). + */ + return; + } + + /* Get the most significant byte (MSB) of the last MRAM word we were modifying. + * Writing to this byte makes the MRAM controller commit other pending writes to that word. + */ + addr_end |= MRAM_WORD_MASK; + + /* Issue a dummy write, since we didn't have anything to write here. + * Doing this lets us finalize our changes before we exit the driver API. + */ + sys_write8(sys_read8(addr_end), addr_end); +} + +static int nrf_mram_read(const struct device *dev, off_t offset, void *data, size_t len) +{ + ARG_UNUSED(dev); + + const uintptr_t addr = validate_and_map_addr(offset, len, false); + + if (!addr) { + return -EINVAL; + } + + LOG_DBG("read: %p:%zu", (void *)addr, len); + + memcpy(data, (void *)addr, len); + + return 0; +} + +static int nrf_mram_write(const struct device *dev, off_t offset, const void *data, size_t len) +{ + ARG_UNUSED(dev); + + const uintptr_t addr = validate_and_map_addr(offset, len, true); + + if (!addr) { + return -EINVAL; + } + + LOG_DBG("write: %p:%zu", (void *)addr, len); + + memcpy((void *)addr, data, len); + commit_changes(addr + len); + + return 0; +} + +static int nrf_mram_erase(const struct device *dev, off_t offset, size_t size) +{ + ARG_UNUSED(dev); + + const uintptr_t addr = validate_and_map_addr(offset, size, true); + + if (!addr) { + return -EINVAL; + } + + LOG_DBG("erase: %p:%zu", (void *)addr, size); + + memset((void *)addr, ERASE_VALUE, size); + commit_changes(addr + size); + + return 0; +} + +static const struct flash_parameters *nrf_mram_get_parameters(const struct device *dev) +{ + ARG_UNUSED(dev); + + static const struct flash_parameters parameters = { + .write_block_size = WRITE_BLOCK_SIZE, + .erase_value = ERASE_VALUE, + }; + + return ¶meters; +} + +#if defined(CONFIG_FLASH_PAGE_LAYOUT) +static void nrf_mram_page_layout(const struct device *dev, const struct flash_pages_layout **layout, + size_t *layout_size) +{ + ARG_UNUSED(dev); + + static const struct flash_pages_layout pages_layout = { + .pages_count = (MRAM_SIZE) / (ERASE_BLOCK_SIZE), + .pages_size = ERASE_BLOCK_SIZE, + }; + + *layout = &pages_layout; + *layout_size = 1; +} +#endif + +static const struct flash_driver_api nrf_mram_api = { + .read = nrf_mram_read, + .write = nrf_mram_write, + .erase = nrf_mram_erase, + .get_parameters = nrf_mram_get_parameters, +#if defined(CONFIG_FLASH_PAGE_LAYOUT) + .page_layout = nrf_mram_page_layout, +#endif +}; + +DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, + &nrf_mram_api); From 04433a6c721c96b04f4c162e0c33ca7d4786d295 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 7 Mar 2024 15:59:15 +0100 Subject: [PATCH 0656/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: Add erase-block-size to mram1x The MRAM has no concept of erase blocks or pages, so this is treated as driver configuration. Signed-off-by: Grzegorz Swiderski (cherry picked from commit beab89d6e82bce3de5ef827074e9273811949ddd) (cherry picked from commit cce721bce2b15685cca65f2d1943cafdd4d6e1e6) --- dts/common/nordic/nrf54h20_enga.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 610fbd81587..70c994ccd06 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -96,6 +96,7 @@ mram1x: mram@e000000 { compatible = "nordic,mram"; reg = <0xe000000 DT_SIZE_K(2048)>; + erase-block-size = <4096>; write-block-size = <16>; }; From 826a22820c6decf9daeebe0d60ecd07370840965 Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Tue, 6 Feb 2024 09:29:33 +0100 Subject: [PATCH 0657/2300] [nrf fromtree] manifest: update hal_nordic revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates revision of hal_nordic repo. Signed-off-by: Andrzej Kuroś (cherry picked from commit fa3f2ee485309fee44fa7d78f7a53946983d53fa) Signed-off-by: Andrzej Głąbek (cherry picked from commit 157e4838b541a0fb03acdf648104e4dec1ca86ee) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 46e2085d756..1f2a4317a4d 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: dce8519f7da37b0a745237679fd3f88250b495ff + revision: daf875285120be6b2825969b7a0abc3f415b248d path: modules/hal/nordic groups: - hal From 50e4aa2286986e8c66b7a5c713907f4195b9aeb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 29 Feb 2024 16:30:41 +0100 Subject: [PATCH 0658/2300] [nrf fromlist] dts: nordic: Add DPPIC and IPCT nodes to nRF54H20 EngA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And add the corresponding bindings. Move alse the already existing bindings for nrf-dppic, nrf-ppi, and nrf-ipc so they are located together with the new ones and in more appropriate folders (DPPIC and PPI peripherals are not related to ARM, and IPC is for sending and receiving events, not messages, so ipm/ does not seem to be the best fit for it). Signed-off-by: Andrzej Głąbek (cherry picked from commit ae33b354173ab96065abe69d26c73b8ebe30aeac) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit cbe75dd25eee898ac91b0e4e2018016722504fa1) --- dts/bindings/{ipm => ipc}/nordic,nrf-ipc.yaml | 0 dts/bindings/ipc/nordic,nrf-ipct-common.yaml | 45 +++++++++ dts/bindings/ipc/nordic,nrf-ipct-global.yaml | 17 ++++ dts/bindings/ipc/nordic,nrf-ipct-local.yaml | 12 +++ .../misc/nordic,nrf-dppic-global.yaml | 18 ++++ dts/bindings/misc/nordic,nrf-dppic-links.yaml | 17 ++++ dts/bindings/misc/nordic,nrf-dppic-local.yaml | 13 +++ .../{arm => misc}/nordic,nrf-dppic.yaml | 0 .../{arm => misc}/nordic,nrf-ppi.yaml | 0 .../misc/nordic,split-channel-groups.yaml | 20 ++++ dts/common/nordic/nrf54h20_enga.dtsi | 94 +++++++++++++++++++ 11 files changed, 236 insertions(+) rename dts/bindings/{ipm => ipc}/nordic,nrf-ipc.yaml (100%) create mode 100644 dts/bindings/ipc/nordic,nrf-ipct-common.yaml create mode 100644 dts/bindings/ipc/nordic,nrf-ipct-global.yaml create mode 100644 dts/bindings/ipc/nordic,nrf-ipct-local.yaml create mode 100644 dts/bindings/misc/nordic,nrf-dppic-global.yaml create mode 100644 dts/bindings/misc/nordic,nrf-dppic-links.yaml create mode 100644 dts/bindings/misc/nordic,nrf-dppic-local.yaml rename dts/bindings/{arm => misc}/nordic,nrf-dppic.yaml (100%) rename dts/bindings/{arm => misc}/nordic,nrf-ppi.yaml (100%) create mode 100644 dts/bindings/misc/nordic,split-channel-groups.yaml diff --git a/dts/bindings/ipm/nordic,nrf-ipc.yaml b/dts/bindings/ipc/nordic,nrf-ipc.yaml similarity index 100% rename from dts/bindings/ipm/nordic,nrf-ipc.yaml rename to dts/bindings/ipc/nordic,nrf-ipc.yaml diff --git a/dts/bindings/ipc/nordic,nrf-ipct-common.yaml b/dts/bindings/ipc/nordic,nrf-ipct-common.yaml new file mode 100644 index 00000000000..a75b63577c4 --- /dev/null +++ b/dts/bindings/ipc/nordic,nrf-ipct-common.yaml @@ -0,0 +1,45 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic IPCT (Interprocessor Communication Transceiver) + +include: base.yaml + +properties: + reg: + required: true + + channels: + type: int + required: true + description: Number of channels implemented by the IPCT instance. + + source-channel-links: + type: array + description: | + Mapping of IPCT channels that are mapped between two IPCT instances on + separate domains, in which a channel on this IPCT node is considered + the source. This array is then comprised of a 3-integer-wide "unit" + that defines one connection of the mapping. The format of this unit + is . Units are sequential + in the array, therefore requiring the length of this property to be + a factor of 3. + + For example, if channel 2 is to be mapped to Radio Core (ID: 3) IPCT + channel 4, then the array "unit" would be <2 NRF_DOMAIN_ID_RADIOCORE 4> + or <2 3 4>. + + sink-channel-links: + type: array + description: | + Mapping of IPCT channels that are mapped between two IPCT instances on + separate domains, in which a channel on this IPCT node is considered + the sink. This array is then comprised of a 3-integer-wide "unit" + that defines one connection of the mapping. The format of this unit + is . Units are sequential + in the array, therefore requiring the length of this property to be + a factor of 3. + + For example, if channel 2 is to be mapped to Radio Core (ID: 3) IPCT + channel 4, then the array "unit" would be <2 NRF_DOMAIN_ID_RADIOCORE 4> + or <2 3 4>. diff --git a/dts/bindings/ipc/nordic,nrf-ipct-global.yaml b/dts/bindings/ipc/nordic,nrf-ipct-global.yaml new file mode 100644 index 00000000000..a1f7776d464 --- /dev/null +++ b/dts/bindings/ipc/nordic,nrf-ipct-global.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic Global IPCT (Interprocessor Communication Transceiver) + +compatible: "nordic,nrf-ipct-global" + +include: ["nordic,nrf-ipct-common.yaml", "nordic,split-channels.yaml"] + +properties: + global-domain-id: + required: true + type: int + description: | + Global IPCT instances reside on specific buses within the Global Domain, + such as fast and slow, which have different IDs that do not match the + standard Global Domain ID presented in their address. diff --git a/dts/bindings/ipc/nordic,nrf-ipct-local.yaml b/dts/bindings/ipc/nordic,nrf-ipct-local.yaml new file mode 100644 index 00000000000..9f055eb8b79 --- /dev/null +++ b/dts/bindings/ipc/nordic,nrf-ipct-local.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic Local IPCT (Interprocessor Communication Transceiver) + +compatible: "nordic,nrf-ipct-local" + +include: "nordic,nrf-ipct-common.yaml" + +properties: + interrupts: + required: true diff --git a/dts/bindings/misc/nordic,nrf-dppic-global.yaml b/dts/bindings/misc/nordic,nrf-dppic-global.yaml new file mode 100644 index 00000000000..3257c519348 --- /dev/null +++ b/dts/bindings/misc/nordic,nrf-dppic-global.yaml @@ -0,0 +1,18 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic Global DPPIC + (Distributed Programmable Peripheral Interconnect Controller) + + Updated DPPIC binding set for Nordic products that have global DPPIC instances + with inter-bridge functionality. These instances also have split-ownership + of its channels and channel groups. + +compatible: "nordic,nrf-dppic-global" + +include: + - "nordic,nrf-dppic.yaml" + - "nordic,nrf-dppic-links.yaml" + - "nordic,split-channels.yaml" + - "nordic,split-channel-groups.yaml" diff --git a/dts/bindings/misc/nordic,nrf-dppic-links.yaml b/dts/bindings/misc/nordic,nrf-dppic-links.yaml new file mode 100644 index 00000000000..db12ccb72cb --- /dev/null +++ b/dts/bindings/misc/nordic,nrf-dppic-links.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic DPPIC Channel Linking + +properties: + source-channels: + type: array + description: | + Channels that are linked to channels of DPPIC instances on separate + bridges as publishing sources. + + sink-channels: + type: array + description: | + Channels that are linked to channels of DPPIC instances on separate + bridges as subscribing sinks. diff --git a/dts/bindings/misc/nordic,nrf-dppic-local.yaml b/dts/bindings/misc/nordic,nrf-dppic-local.yaml new file mode 100644 index 00000000000..bea53bddec8 --- /dev/null +++ b/dts/bindings/misc/nordic,nrf-dppic-local.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +description: | + Nordic Local DPPIC + (Distributed Programmable Peripheral Interconnect Controller) + + Updated DPPIC binding set for Nordic products that have local DPPIC instances + with inter-bridge functionality. + +compatible: "nordic,nrf-dppic-local" + +include: ["nordic,nrf-dppic.yaml", "nordic,nrf-dppic-links.yaml"] diff --git a/dts/bindings/arm/nordic,nrf-dppic.yaml b/dts/bindings/misc/nordic,nrf-dppic.yaml similarity index 100% rename from dts/bindings/arm/nordic,nrf-dppic.yaml rename to dts/bindings/misc/nordic,nrf-dppic.yaml diff --git a/dts/bindings/arm/nordic,nrf-ppi.yaml b/dts/bindings/misc/nordic,nrf-ppi.yaml similarity index 100% rename from dts/bindings/arm/nordic,nrf-ppi.yaml rename to dts/bindings/misc/nordic,nrf-ppi.yaml diff --git a/dts/bindings/misc/nordic,split-channel-groups.yaml b/dts/bindings/misc/nordic,split-channel-groups.yaml new file mode 100644 index 00000000000..868bc5fecec --- /dev/null +++ b/dts/bindings/misc/nordic,split-channel-groups.yaml @@ -0,0 +1,20 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic Split Channel Groups + +properties: + owned-channel-groups: + type: array + description: | + List of channel groups of a split-ownership peripheral that are to be + owned for use by the compiled domain. + + nonsecure-channel-groups: + type: array + description: | + List of channel groups in a split-ownership, split-security peripheral + that are to be configured as nonsecure. In Trustzone systems, this + property is only evaluated for secure peripherals, as nonsecure channels + are implicitly specified through the owned-channels property. This + property is ignored in non-Trustzone systems. diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 70c994ccd06..47aba0df253 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -9,6 +9,12 @@ #include +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 2 +#define NRF_DOMAIN_ID_RADIOCORE 3 +#define NRF_DOMAIN_ID_GLOBALFAST 12 +#define NRF_DOMAIN_ID_GLOBALSLOW 13 + /delete-node/ &sw_pwm; / { @@ -153,6 +159,15 @@ <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; nordic,ficr-names = "vsup", "coarse", "fine"; }; + + cpuapp_ipct: ipct@13000 { + compatible = "nordic,nrf-ipct-local"; + reg = <0x13000 0x1000>; + status = "disabled"; + channels = <4>; + interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, + <65 NRF_DEFAULT_IRQ_PRIORITY>; + }; }; cpurad_peripherals: peripheral@53000000 { @@ -173,6 +188,21 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; + dppic020: dppic@22000 { + compatible = "nordic,nrf-dppic-local"; + reg = <0x22000 0x1000>; + status = "disabled"; + }; + + cpurad_ipct: ipct@24000 { + compatible = "nordic,nrf-ipct-local"; + reg = <0x24000 0x1000>; + status = "disabled"; + channels = <8>; + interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, + <65 NRF_DEFAULT_IRQ_PRIORITY>; + }; + egu020: egu@25000 { compatible = "nordic,nrf-egu"; reg = <0x25000 0x1000>; @@ -267,6 +297,20 @@ #mbox-cells = <1>; }; + ipct120: ipct@8d1000 { + compatible = "nordic,nrf-ipct-global"; + reg = <0x8d1000 0x1000>; + status = "disabled"; + channels = <8>; + global-domain-id = <12>; + }; + + dppic120: dppic@8e1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x8e1000 0x1000>; + status = "disabled"; + }; + timer120: timer@8e2000 { compatible = "nordic,nrf-timer"; reg = <0x8e2000 0x1000>; @@ -344,6 +388,20 @@ }; }; + ipct130: ipct@921000 { + compatible = "nordic,nrf-ipct-global"; + reg = <0x921000 0x1000>; + status = "disabled"; + channels = <8>; + global-domain-id = <13>; + }; + + dppic130: dppic@922000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x922000 0x1000>; + status = "disabled"; + }; + rtc130: rtc@928000 { compatible = "nordic,nrf-rtc"; reg = <0x928000 0x1000>; @@ -449,6 +507,12 @@ port = <9>; }; + dppic131: dppic@981000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x981000 0x1000>; + status = "disabled"; + }; + comp: comparator@983000 { compatible = "nordic,nrf-comp"; reg = <0x983000 0x1000>; @@ -471,6 +535,12 @@ interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; }; + dppic132: dppic@991000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x991000 0x1000>; + status = "disabled"; + }; + qdec130: qdec@994000 { compatible = "nordic,nrf-qdec"; reg = <0x994000 0x1000>; @@ -492,6 +562,12 @@ cc-num = <16>; }; + dppic133: dppic@9a1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9a1000 0x1000>; + status = "disabled"; + }; + timer130: timer@9a2000 { compatible = "nordic,nrf-timer"; reg = <0x9a2000 0x1000>; @@ -568,6 +644,12 @@ interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; }; + dppic134: dppic@9b1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9b1000 0x1000>; + status = "disabled"; + }; + timer132: timer@9b2000 { compatible = "nordic,nrf-timer"; reg = <0x9b2000 0x1000>; @@ -644,6 +726,12 @@ interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; }; + dppic135: dppic@9c1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9c1000 0x1000>; + status = "disabled"; + }; + timer134: timer@9c2000 { compatible = "nordic,nrf-timer"; reg = <0x9c2000 0x1000>; @@ -720,6 +808,12 @@ interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; }; + dppic136: dppic@9d1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9d1000 0x1000>; + status = "disabled"; + }; + timer136: timer@9d2000 { compatible = "nordic,nrf-timer"; reg = <0x9d2000 0x1000>; From 0ab98d9e8869f01eb3781ea231a92fac95c8a118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 6 Mar 2024 12:31:23 +0100 Subject: [PATCH 0659/2300] [nrf fromlist] dts: nordic: Add missing ECB020 node in nRF54H20 EngA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit 4db40601dd7f0b98a48f3e6072bf44643a4ea3db. There are two ECB instances in nRF54H20 and the above commit added only one of them. Signed-off-by: Andrzej Głąbek (cherry picked from commit d7c2c5e723f1b86f1824fdc83eacfc779202e04d) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit 9b6a87d8b08dd4d5f32c48f4bd7997d2a57ae8a2) --- dts/common/nordic/nrf54h20_enga.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 47aba0df253..8552b9534eb 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -210,6 +210,13 @@ interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; }; + ecb020: ecb@27000 { + compatible = "nordic,nrf-ecb"; + reg = <0x27000 0x1000>; + status = "disabled"; + interrupts = <39 NRF_DEFAULT_IRQ_PRIORITY>; + }; + timer020: timer@28000 { compatible = "nordic,nrf-timer"; reg = <0x28000 0x1000>; From 81c93e932666b923915e0fa87c6c430c8f288b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 6 Mar 2024 12:02:36 +0100 Subject: [PATCH 0660/2300] [nrf fromlist] soc: nordic_nrf: Add address validation entries for nRF54H/L dts nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add entries for checking if the recently added dts nodes for nRF54H20 and nRF54L15 have correct base addresses (if they match those provided by MDK). Signed-off-by: Andrzej Głąbek (cherry picked from commit f3e6d39b90bbcf763fca76e0752a703f49a9c58e) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit 8d6f1543ef71ceffd36284714b1fde9986b8c6ec) --- soc/arm/nordic_nrf/validate_base_addresses.c | 76 ++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 28ec231b132..04c7a1ae3cd 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -133,17 +133,39 @@ CHECK_DT_REG(cryptocell, NRF_CRYPTOCELL); CHECK_DT_REG(ctrlap, NRF_CTRLAP); CHECK_DT_REG(dcnf, NRF_DCNF); CHECK_DT_REG(dppic, NRF_DPPIC); +CHECK_DT_REG(dppic00, NRF_DPPIC00); +CHECK_DT_REG(dppic10, NRF_DPPIC10); +CHECK_DT_REG(dppic20, NRF_DPPIC20); +CHECK_DT_REG(dppic30, NRF_DPPIC30); +CHECK_DT_REG(dppic020, NRF_DPPIC020); +CHECK_DT_REG(dppic120, NRF_DPPIC120); +CHECK_DT_REG(dppic130, NRF_DPPIC130); +CHECK_DT_REG(dppic131, NRF_DPPIC131); +CHECK_DT_REG(dppic132, NRF_DPPIC132); +CHECK_DT_REG(dppic133, NRF_DPPIC133); +CHECK_DT_REG(dppic134, NRF_DPPIC134); +CHECK_DT_REG(dppic135, NRF_DPPIC135); +CHECK_DT_REG(dppic136, NRF_DPPIC136); CHECK_DT_REG(ecb, NRF_ECB); +CHECK_DT_REG(ecb020, NRF_ECB020); +CHECK_DT_REG(ecb030, NRF_ECB030); CHECK_DT_REG(egu0, NRF_EGU0); CHECK_DT_REG(egu1, NRF_EGU1); CHECK_DT_REG(egu2, NRF_EGU2); CHECK_DT_REG(egu3, NRF_EGU3); CHECK_DT_REG(egu4, NRF_EGU4); CHECK_DT_REG(egu5, NRF_EGU5); +CHECK_DT_REG(egu10, NRF_EGU10); +CHECK_DT_REG(egu20, NRF_EGU20); +CHECK_DT_REG(egu020, NRF_EGU020); CHECK_DT_REG(ficr, NRF_FICR); CHECK_DT_REG(flash_controller, NRF_NVMC); CHECK_DT_REG(gpio0, NRF_P0); CHECK_DT_REG(gpio1, NRF_P1); +CHECK_DT_REG(gpio2, NRF_P2); +CHECK_DT_REG(gpio6, NRF_P6); +CHECK_DT_REG(gpio7, NRF_P7); +CHECK_DT_REG(gpio9, NRF_P9); CHECK_DT_REG(gpiote, NRF_GPIOTE); CHECK_DT_REG(gpiote0, NRF_GPIOTE0); CHECK_DT_REG(gpiote1, NRF_GPIOTE1); @@ -155,8 +177,25 @@ CHECK_I2C_REG(i2c0, 0); CHECK_I2C_REG(i2c1, 1); CHECK_DT_REG(i2c2, NRF_TWIM2); CHECK_DT_REG(i2c3, NRF_TWIM3); +CHECK_DT_REG(i2c20, NRF_TWIM20); +CHECK_DT_REG(i2c21, NRF_TWIM21); +CHECK_DT_REG(i2c22, NRF_TWIM22); +CHECK_DT_REG(i2c30, NRF_TWIM30); +CHECK_DT_REG(i2c130, NRF_TWIM130); +CHECK_DT_REG(i2c131, NRF_TWIM131); +CHECK_DT_REG(i2c132, NRF_TWIM132); +CHECK_DT_REG(i2c133, NRF_TWIM133); +CHECK_DT_REG(i2c134, NRF_TWIM134); +CHECK_DT_REG(i2c135, NRF_TWIM135); +CHECK_DT_REG(i2c136, NRF_TWIM136); +CHECK_DT_REG(i2c137, NRF_TWIM137); CHECK_DT_REG(i2s0, NRF_I2S0); +CHECK_DT_REG(i2s20, NRF_I2S20); CHECK_DT_REG(ipc, NRF_IPC); +CHECK_DT_REG(cpuapp_ipct, NRF_IPCT); +CHECK_DT_REG(cpurad_ipct, NRF_IPCT); +CHECK_DT_REG(ipct120, NRF_IPCT120); +CHECK_DT_REG(ipct130, NRF_IPCT130); CHECK_DT_REG(kmu, NRF_KMU); CHECK_DT_REG(mutex, NRF_MUTEX); CHECK_DT_REG(mwu, NRF_MWU); @@ -173,18 +212,40 @@ CHECK_DT_REG(pwm3, NRF_PWM3); CHECK_DT_REG(qdec, NRF_QDEC0); /* this should be the same node as qdec0 */ CHECK_DT_REG(qdec0, NRF_QDEC0); CHECK_DT_REG(qdec1, NRF_QDEC1); +CHECK_DT_REG(qdec20, NRF_QDEC20); +CHECK_DT_REG(qdec21, NRF_QDEC21); +CHECK_DT_REG(qdec130, NRF_QDEC130); +CHECK_DT_REG(qdec131, NRF_QDEC131); CHECK_DT_REG(radio, NRF_RADIO); CHECK_DT_REG(regulators, NRF_REGULATORS); CHECK_DT_REG(reset, NRF_RESET); CHECK_DT_REG(rng, NRF_RNG); +CHECK_DT_REG(rtc, NRF_RTC); CHECK_DT_REG(rtc0, NRF_RTC0); CHECK_DT_REG(rtc1, NRF_RTC1); CHECK_DT_REG(rtc2, NRF_RTC2); +CHECK_DT_REG(rtc130, NRF_RTC130); +CHECK_DT_REG(rtc131, NRF_RTC131); CHECK_SPI_REG(spi0, 0); CHECK_SPI_REG(spi1, 1); CHECK_SPI_REG(spi2, 2); CHECK_DT_REG(spi3, NRF_SPIM3); CHECK_DT_REG(spi4, NRF_SPIM4); +CHECK_DT_REG(spi00, NRF_SPIM00); +CHECK_DT_REG(spi20, NRF_SPIM20); +CHECK_DT_REG(spi21, NRF_SPIM21); +CHECK_DT_REG(spi22, NRF_SPIM22); +CHECK_DT_REG(spi30, NRF_SPIM30); +CHECK_DT_REG(spi120, NRF_SPIM120); +CHECK_DT_REG(spi121, NRF_SPIM121); +CHECK_DT_REG(spi130, NRF_SPIM130); +CHECK_DT_REG(spi131, NRF_SPIM131); +CHECK_DT_REG(spi132, NRF_SPIM132); +CHECK_DT_REG(spi133, NRF_SPIM133); +CHECK_DT_REG(spi134, NRF_SPIM134); +CHECK_DT_REG(spi135, NRF_SPIM135); +CHECK_DT_REG(spi136, NRF_SPIM136); +CHECK_DT_REG(spi137, NRF_SPIM137); CHECK_DT_REG(spu, NRF_SPU); CHECK_DT_REG(swi0, NRF_SWI0); CHECK_DT_REG(swi1, NRF_SWI1); @@ -205,6 +266,19 @@ CHECK_DT_REG(timer21, NRF_TIMER21); CHECK_DT_REG(timer22, NRF_TIMER22); CHECK_DT_REG(timer23, NRF_TIMER23); CHECK_DT_REG(timer24, NRF_TIMER24); +CHECK_DT_REG(timer020, NRF_TIMER020); +CHECK_DT_REG(timer021, NRF_TIMER021); +CHECK_DT_REG(timer022, NRF_TIMER022); +CHECK_DT_REG(timer120, NRF_TIMER120); +CHECK_DT_REG(timer121, NRF_TIMER121); +CHECK_DT_REG(timer130, NRF_TIMER130); +CHECK_DT_REG(timer131, NRF_TIMER131); +CHECK_DT_REG(timer132, NRF_TIMER132); +CHECK_DT_REG(timer133, NRF_TIMER133); +CHECK_DT_REG(timer134, NRF_TIMER134); +CHECK_DT_REG(timer135, NRF_TIMER135); +CHECK_DT_REG(timer136, NRF_TIMER136); +CHECK_DT_REG(timer137, NRF_TIMER137); CHECK_UART_REG(uart0, 0); CHECK_DT_REG(uart1, NRF_UARTE1); CHECK_DT_REG(uart2, NRF_UARTE2); @@ -232,6 +306,8 @@ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); CHECK_DT_REG(wdt30, NRF_WDT30); CHECK_DT_REG(wdt31, NRF_WDT31); +CHECK_DT_REG(wdt131, NRF_WDT131); +CHECK_DT_REG(wdt132, NRF_WDT132); /* nRF51/nRF52-specific addresses */ #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) From b3850e23340108a71cedb780a893138dac95fbf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 5 Mar 2024 15:34:32 +0100 Subject: [PATCH 0661/2300] [nrf fromlist] manifest: Update hal_nordic revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pull in fixes in the nrfx_gppi_dppi_ppib helper so that it can be compiled successfuly. Signed-off-by: Andrzej Głąbek (cherry picked from commit a84e44b68b4a291a28466e320207926b56514a77) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit 1382003ca06daa80bbbd6f68580db828167cd0f8) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 1f2a4317a4d..1de62a11029 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: daf875285120be6b2825969b7a0abc3f415b248d + revision: 5470822384781624efb2fda28cbc6a895a227677 path: modules/hal/nordic groups: - hal From 413344936c729e7813173a121c4e2155b683a912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 1 Mar 2024 11:16:28 +0100 Subject: [PATCH 0662/2300] [nrf fromlist] modules: hal_nordic: Enable support for DPPI on nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include into compilation the nrfx_gppi_dppi_ppib helper and related interconnect layers when DPPIC nodes are enabled in DTS. Provide macro definitions required by those interconnect layers based on information from devicetree (the nrf_grtc_timer is only modified because a macro that it uses became more generic). Signed-off-by: Andrzej Głąbek (cherry picked from commit e46a0a51650dcd2afd3216fdb8a003dd7080cdf9) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit 7285f59cbbeff4a660e622a6f9053174d1a0e751) --- drivers/timer/nrf_grtc_timer.c | 4 +- modules/hal_nordic/nrfx/CMakeLists.txt | 8 ++ modules/hal_nordic/nrfx/nrfx_config.h | 121 +++++++++++++++++++++++-- 3 files changed, 121 insertions(+), 12 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 8ac357864cc..c9e51db2469 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -21,8 +21,8 @@ #if !DT_NODE_HAS_PROP(GRTC_NODE, owned_channels) #error GRTC owned-channels DT property is not defined #endif -#define OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(owned_channels) -#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels) +#define OWNED_CHANNELS_MASK NRFX_CONFIG_MASK_DT(GRTC_NODE, owned_channels) +#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_MASK_DT(GRTC_NODE, child_owned_channels) #if ((OWNED_CHANNELS_MASK | CHILD_OWNED_CHANNELS_MASK) != OWNED_CHANNELS_MASK) #error GRTC child-owned-channels DT property must be a subset of owned-channels #endif diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 71d57814f36..573cd5ecfd4 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -158,6 +158,14 @@ if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) zephyr_library_sources(${NRFX_DIR}/soc/interconnect/dppic_ppib/nrfx_interconnect_dppic_ppib.c) endif() +if(CONFIG_SOC_SERIES_NRF54HX AND + (CONFIG_DT_HAS_NORDIC_NRF_DPPIC_LOCAL_ENABLED OR + CONFIG_DT_HAS_NORDIC_NRF_DPPIC_GLOBAL_ENABLED)) + zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib.c) + zephyr_library_sources(${NRFX_DIR}/soc/interconnect/apb/nrfx_interconnect_apb.c) + zephyr_library_sources(${NRFX_DIR}/soc/interconnect/ipct/nrfx_interconnect_ipct.c) +endif() + # Get the SVD file for the current SoC macro(mdk_svd_ifdef feature_toggle filename) if(${feature_toggle}) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 5ebc243541e..5c1a071f9bf 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -8,6 +8,7 @@ #define NRFX_CONFIG_H__ #include +#include /* * These are mappings of Kconfig options enabling nrfx drivers and particular @@ -756,27 +757,127 @@ #define NRF_PERIPH(P) P##_S #endif +#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) BIT(DT_PROP_BY_IDX(node_id, prop, idx)) +#define NRFX_CONFIG_MASK_DT(node_id, prop) \ + (COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \ + (DT_FOREACH_PROP_ELEM_SEP(node_id, prop, NRFX_CONFIG_BIT_DT, (|))), \ + (0))) + /* If the GRTC system timer driver is to be used, prepare definitions required * by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and * NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree. */ #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) -#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ - BIT(DT_PROP_BY_IDX(node_id, prop, idx)) -#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ - (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ - (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ - NRFX_CONFIG_BIT_DT, (|))), \ - (0))) - #define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ - (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ - ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) + (NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), owned_channels) & \ + ~NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), child_owned_channels)) #define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ +/* If global of local DPPIC peripherals are used, provide the following macro + * definitions required by the interconnect/apb layer: + * - NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) + * - NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) + * - NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) + * - NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) + * - NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE + * - NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE + * based on information from devicetree. + */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || \ + DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_local) +#ifndef NRFX_DPPI_ENABLED +#define NRFX_DPPI_ENABLED 1 +#endif +/* Source (publish) channels masks generation. */ +#define NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels) + +/* Sink (subscribe) channels masks generation. */ +#define NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels) + +#define NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) \ + UTIL_OR(DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels), \ + DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels)) + +/* Variables names generation. */ +#define NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) +#define NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(DT_NODELABEL(_CONCAT(dppic, inst_num))) + +/* Variables entries generation. */ +#define NRFX_CONFIG_DPPI_CHANNELS_ENTRY(node_id) \ + static nrfx_atomic_t NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) \ + __attribute__((used)) = \ + NRFX_CONFIG_MASK_DT(node_id, source_channels) | \ + NRFX_CONFIG_MASK_DT(node_id, sink_channels); +#define NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE \ + DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_global, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) +#define NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE \ + DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_local, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || ... */ + +/* If local or global DPPIC peripherals are used, provide the following macro + * definitions required by the interconnect/ipct layer: + * - NRFX_IPCTx_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) + * - NRFX_IPCTx_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) + * - NRFX_IPCT_PUB_OR_SUB_MASK(inst_num) + * - NRFX_IPCTx_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) + * - NRFX_INTERCONNECT_IPCT_GLOBAL_DEFINE + * - NRFX_INTERCONNECT_IPCT_LOCAL_DEFINE + * based on information from devicetree. + */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_global) || \ + DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_local) +/* Channels masks generation. */ +#define NRFX_CONFIG_IPCT_MASK_DT(node_id) \ + COND_CODE_1(DT_NODE_HAS_PROP(node_id, owned_channels), \ + (NRFX_CONFIG_MASK_DT(node_id, owned_channels)), \ + (COND_CODE_1(DT_NODE_HAS_COMPAT(node_id, nordic_nrf_ipct_local), \ + (BIT_MASK(DT_PROP(node_id, channels))), (0)))) + +#if defined(NRF_APPLICATION) +#define NRFX_CONFIG_IPCT_LOCAL_NODE DT_NODELABEL(cpuapp_ipct) +#elif defined(NRF_RADIOCORE) +#define NRFX_CONFIG_IPCT_LOCAL_NODE DT_NODELABEL(cpurad_ipct) +#endif +#define NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num) \ + COND_CODE_1(IS_EMPTY(inst_num), \ + (NRFX_CONFIG_IPCT_LOCAL_NODE), \ + (DT_NODELABEL(_CONCAT(ipct, inst_num)))) + +#define NRFX_IPCTx_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_IPCT_MASK_DT(NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num)) + +#define NRFX_IPCTx_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_IPCT_MASK_DT(NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num)) + +#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_PROP(DT_NODELABEL(_CONCAT(ipct, inst_num)), owned_channels))) + +/* Variables names generation. */ +#define NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) +#define NRFX_IPCTx_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) \ + COND_CODE_1(IS_EMPTY(inst_num), \ + (NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(NRFX_CONFIG_IPCT_LOCAL_NODE)), \ + (NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(DT_NODELABEL(_CONCAT(ipct, inst_num))))) + +/* Variables entries generation. */ +#define NRFX_CONFIG_IPCT_CHANNELS_ENTRY(node_id) \ + static nrfx_atomic_t NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(node_id) \ + __attribute__((used)) = \ + NRFX_CONFIG_IPCT_MASK_DT(node_id); +#define NRFX_INTERCONNECT_IPCT_LOCAL_DEFINE \ + DT_FOREACH_STATUS_OKAY(nordic_nrf_ipct_local, NRFX_CONFIG_IPCT_CHANNELS_ENTRY) +#define NRFX_INTERCONNECT_IPCT_GLOBAL_DEFINE \ + DT_FOREACH_STATUS_OKAY(nordic_nrf_ipct_global, NRFX_CONFIG_IPCT_CHANNELS_ENTRY) +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_global) || ... */ + #include #if defined(NRF51) #include From 1b2d37287c09735402e92ac47c216dc65df34357 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 26 Jan 2021 15:43:08 +0100 Subject: [PATCH 0663/2300] [nrf noup] ci: set `ZEPHYR__KCONFIG` for NCS modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit sets `ZEPHYR__KCONFIG` variable for each Kconfig file discovered in `nrf/modules//Kconfig`. This is not meant as a permanent solution; we should do more careful consideration on the optimal approach forward that will allow compliance_check.py to be used downstream with custom module_ext_roots, and at the same time keep current flexibility for module glue code handling intact. Signed-off-by: Torsten Rasmussen Signed-off-by: Martí Bolívar (cherry picked from commit 7351aebe37781e121a19bc64af8159c6e6a5d715) --- scripts/ci/check_compliance.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 0a2da6bc9ca..d8b147f8ab0 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -314,6 +314,13 @@ def get_modules(self, modules_file): modules = [name for name in os.listdir(modules_dir) if os.path.exists(os.path.join(modules_dir, name, 'Kconfig'))] + nrf_modules_dir = ZEPHYR_BASE + '/../nrf/modules' + nrf_modules = [] + if os.path.exists(nrf_modules_dir): + nrf_modules = [name for name in os.listdir(nrf_modules_dir) if + os.path.exists(os.path.join(nrf_modules_dir, name, + 'Kconfig'))] + with open(modules_file, 'r') as fp_module_file: content = fp_module_file.read() @@ -323,6 +330,15 @@ def get_modules(self, modules_file): re.sub('[^a-zA-Z0-9]', '_', module).upper(), modules_dir + '/' + module + '/Kconfig' )) + for module in nrf_modules: + fp_module_file.write("ZEPHYR_{}_KCONFIG = {}\n".format( + re.sub('[^a-zA-Z0-9]', '_', module).upper(), + nrf_modules_dir + '/' + module + '/Kconfig' + )) + fp_module_file.write("NCS_{}_KCONFIG = {}\n".format( + re.sub('[^a-zA-Z0-9]', '_', module).upper(), + modules_dir + '/' + module + '/Kconfig' + )) fp_module_file.write(content) def get_kconfig_dts(self, kconfig_dts_file): From b9e3996b863f0a1f8d14f9b275f38fcdba40abc6 Mon Sep 17 00:00:00 2001 From: Piotr Golyzniak Date: Mon, 1 Aug 2022 13:06:01 +0200 Subject: [PATCH 0664/2300] [nrf noup] ci: scripts: add quarantine file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add scripts/quarantine.yaml file, which will be used in CI. Signed-off-by: Piotr Golyzniak Signed-off-by: Andrzej Głąbek Signed-off-by: Maciej Perkowski Signed-off-by: Robert Lubos (cherry picked from commit 0f53ec25dcb9dc3fef27bcd024690ec69f3e85db) --- scripts/quarantine.yaml | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 scripts/quarantine.yaml diff --git a/scripts/quarantine.yaml b/scripts/quarantine.yaml new file mode 100644 index 00000000000..20c4f9248ea --- /dev/null +++ b/scripts/quarantine.yaml @@ -0,0 +1,88 @@ +# The configurations resulting as a product of scenarios and platforms +# will be skipped if quarantine is used. More details here: +# https://docs.zephyrproject.org/latest/guides/test/twister.html#quarantine + +- scenarios: + - testing.ztest.busy_sim + - testing.ztest.busy_sim_nrf52840dk_pin + platforms: + - nrf52840dk_nrf52840 + +# Already reported, but will not be fixed (look at the discussion): +# https://github.com/zephyrproject-rtos/zephyr/issues/44947 +- scenarios: + - libraries.cmsis_dsp.matrix.unary_f64 + platforms: + - nrf5340dk_nrf5340_cpunet + - qemu_cortex_m3 + comment: "Flash overflows" + +# Already reported, but will not be fixed (look at the discussion): +# https://github.com/zephyrproject-rtos/zephyr/issues/44947 +- scenarios: + - libraries.cmsis_dsp.matrix.binary_f16 + - libraries.cmsis_dsp.matrix.binary_f16.fpu + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + comment: "Flash overflows" + +# Already reported, but will not be fixed (look at the discussion): +# https://github.com/zephyrproject-rtos/zephyr/issues/44947 +- scenarios: + - libraries.cmsis_dsp.matrix.binary_q15 + - libraries.cmsis_dsp.matrix.binary_q15.fpu + - libraries.cmsis_dsp.matrix.unary_f32 + - libraries.cmsis_dsp.matrix.unary_f32.fpu + - libraries.cmsis_dsp.matrix.unary_f64 + - libraries.cmsis_dsp.matrix.unary_f64.fpu + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + - nrf9160dk_nrf9160_ns + comment: "Flash overflows" + +# libsdl2-dev package should be added into docker image +- scenarios: + - sample.boards.nrf.nrf_led_matrix + - sample.display.lvgl.gui + platforms: + - native_posix + comment: "libsdl2-dev package not available" + +- scenarios: + - sample.net.sockets.echo_server.usbnet + - sample.net.sockets.echo_server.usbnet_composite + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + comment: "Ram/flash overflows, also in the upstream" + +- scenarios: + - sample.net.zperf.netusb_ecm + - sample.net.zperf.netusb_eem + - sample.net.zperf.netusb_rndis + platforms: + - nrf52833dk_nrf52833 + - nrf5340dk_nrf5340_cpuapp_ns + comment: "Ram/flash overflows, also in the upstream" + +- scenarios: + - net.mqtt.tls + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + - nrf9160dk_nrf9160_ns + comment: "Ram/flash overflows, also in the upstream" + +- scenarios: + - kernel.common.picolibc + - libraries.picolibc + - libraries.libc.picolibc.mem_alloc + - libraries.picolibc.sprintf_new + platforms: + - nrf52dk_nrf52832 + comment: "Ram overflows, also in the upstream" + +- scenarios: + - sample.psa_crypto + platforms: + - nrf5340dk_nrf5340_cpuapp_ns + - nrf9160dk_nrf9160_ns + comment: "Due to using sdk-zephyr manifest instead of nrf. Should be fixed after the change" From 0643f1e138ce460226b667d33b7aaace4fd0938a Mon Sep 17 00:00:00 2001 From: Maciej Perkowski Date: Fri, 28 Jan 2022 12:02:58 +0100 Subject: [PATCH 0665/2300] [nrf noup] ci: clang: parallel execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bring back parallel execution to the clang action. In the upstream they went to use a single dedicated powerful agent to run this. We need to keep this as we have to base on agents available in github's cloud. zephyr_runner is upstream's proprietary agent inaccessible outside of upstream's CI. Use ubuntu-latest instead. Signed-off-by: Maciej Perkowski Signed-off-by: Gerard Marull-Paretas Signed-off-by: Dominik Ermel Signed-off-by: Torsten Rasmussen Signed-off-by: Tomasz Moń Signed-off-by: Stephanos Ioannidis Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Dominik Ermel (cherry picked from commit 4d76b6a7403a5d3c14098d4d67e26e284e3c5757) --- .github/workflows/clang.yaml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index 0aa8d5cd690..34b4b8595a9 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -8,8 +8,7 @@ concurrency: jobs: clang-build: - if: github.repository_owner == 'zephyrproject-rtos' - runs-on: zephyr-runner-linux-x64-4xlarge + runs-on: ubuntu-latest container: image: ghcr.io/zephyrproject-rtos/ci:v0.26.5 options: '--entrypoint /bin/bash' @@ -19,11 +18,13 @@ jobs: fail-fast: false matrix: platform: ["native_posix"] + subset: [1, 2, 3, 4, 5] env: ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.3 LLVM_TOOLCHAIN_PATH: /usr/lib/llvm-16 COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} BASE_REF: ${{ github.base_ref }} + MATRIX_SIZE: 5 outputs: report_needed: ${{ steps.twister.outputs.report_needed }} steps: @@ -86,7 +87,7 @@ jobs: id: cache-ccache uses: zephyrproject-rtos/action-s3-cache@v1.2.0 with: - key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.platform }}-ccache + key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.subset }}-ccache path: /github/home/.cache/ccache aws-s3-bucket: ccache.zephyrproject.org aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }} @@ -99,6 +100,16 @@ jobs: test -d github/home/.cache/ccache && rm -rf /github/home/.cache/ccache && mv github/home/.cache/ccache /github/home/.cache/ccache ccache -M 10G -s + - name: Build test plan with Twister + id: twister_test_plan + run: | + export ZEPHYR_BASE=${PWD} + 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 -p native_posix -c origin/${BASE_REF}.. + + - name: Run Tests with Twister id: twister run: | @@ -112,7 +123,7 @@ jobs: 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 --inline-logs -M -N -v --load-tests testplan.json --retry-failed 2 --subset ${{matrix.subset}}/${MATRIX_SIZE} else # if nothing is run, skip reporting step echo "report_needed=0" >> $GITHUB_OUTPUT @@ -127,7 +138,7 @@ jobs: if: always() && steps.twister.outputs.report_needed != 0 uses: actions/upload-artifact@v3 with: - name: Unit Test Results (Subset ${{ matrix.platform }}) + name: Unit Test Results (Subset ${{ matrix.subset }}) path: twister-out/twister.xml clang-build-results: From 4cf7a19e8939c0f44293e431a11139d41e115328 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 30 Nov 2018 14:07:56 +0100 Subject: [PATCH 0666/2300] [nrf noup] ci: NCS-specific CI tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Necessary changes for NCS CI. - Add a Jenkinsfile - Add a commit-tags workflow: This enables sauce tag checking in sdk-zephyr - compliance.yml: Disable check for merge commits, since we have upmerges downstream. Also, since in the code we refer to Kconfig symbols that are defined in the sdk-nrf repository, the Kconfig checks (Kconfig, KconfigBasic and KconfigBasicNoModules) will not pass so exclude them. Also, disable any maintainers-related checks - scripts/gitlint: Extend the max commit line lengths for Gitlint to account for sauce tags Signed-off-by: Carles Cufi Signed-off-by: Dominik Ermel Signed-off-by: Martí Bolívar Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Krishna T Signed-off-by: Dominik Ermel Signed-off-by: Carles Cufi (cherry picked from commit 6b014316c607f99f927c6e05917ee73167e08f03) (cherry picked from commit d68a96e7be44ada31fe6e9a8d28e943298a6211f) --- .github/workflows/commit-tags.yml | 31 ++++++++++++++++++++++++++ .github/workflows/compliance.yml | 8 +++---- Jenkinsfile | 5 +++++ scripts/gitlint/zephyr_commit_rules.py | 4 ++-- 4 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/commit-tags.yml create mode 100644 Jenkinsfile diff --git a/.github/workflows/commit-tags.yml b/.github/workflows/commit-tags.yml new file mode 100644 index 00000000000..9e0323f9498 --- /dev/null +++ b/.github/workflows/commit-tags.yml @@ -0,0 +1,31 @@ +name: Commit tags + +on: pull_request + +jobs: + commit_tags: + runs-on: ubuntu-22.04 + name: Run commit tags checks on patch series (PR) + steps: + - name: Update PATH for west + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Checkout the code + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Install python dependencies + run: | + pip3 install setuptools + pip3 install wheel + pip3 install gitlint + + - name: Run the commit tags + uses: nrfconnect/action-commit-tags@main + with: + target: '.' + baserev: origin/${{ github.base_ref }} + revrange: 'none' diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index de1decb2cc6..036729418cb 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -38,8 +38,8 @@ jobs: git config --global user.name "Your Name" git remote -v # Ensure there's no merge commits in the PR - [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ - (echo "::error ::Merge commits not allowed, rebase instead";false) + #[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ + #(echo "::error ::Merge commits not allowed, rebase instead";false) git rebase origin/${BASE_REF} # debug git log --pretty=oneline | head -n 10 @@ -57,8 +57,8 @@ jobs: # debug ls -la git log --pretty=oneline | head -n 10 - ./scripts/ci/check_compliance.py --annotate -e KconfigBasic \ - -c origin/${BASE_REF}.. + ./scripts/ci/check_compliance.py --annotate -e KconfigBasic -e Kconfig \ + -e KconfigBasicNoModules -e ModulesMaintainers -c origin/${BASE_REF}.. - name: upload-results uses: actions/upload-artifact@v3 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000000..3b9cf002239 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,5 @@ +@Library("CI_LIB") _ + +def pipeline = new ncs.sdk_zephyr.Main() + +pipeline.run(JOB_NAME) diff --git a/scripts/gitlint/zephyr_commit_rules.py b/scripts/gitlint/zephyr_commit_rules.py index ea31c6737f3..d39c7997e26 100644 --- a/scripts/gitlint/zephyr_commit_rules.py +++ b/scripts/gitlint/zephyr_commit_rules.py @@ -78,7 +78,7 @@ class TitleMaxLengthRevert(LineRule): name = "title-max-length-no-revert" id = "UC5" target = CommitMessageTitle - options_spec = [IntOption('line-length', 75, "Max line length")] + options_spec = [IntOption('line-length', 120, "Max line length")] violation_message = "Commit title exceeds max length ({0}>{1})" def validate(self, line, _commit): @@ -103,7 +103,7 @@ class MaxLineLengthExceptions(LineRule): name = "max-line-length-with-exceptions" id = "UC4" target = CommitMessageBody - options_spec = [IntOption('line-length', 75, "Max line length")] + options_spec = [IntOption('line-length', 120, "Max line length")] violation_message = "Commit message body line exceeds max length ({0}>{1})" def validate(self, line, _commit): From dc1e8c4eff1b660a2e740fc067644e94b7f18c11 Mon Sep 17 00:00:00 2001 From: Sebastian Wezel Date: Tue, 15 Mar 2022 13:12:25 +0100 Subject: [PATCH 0667/2300] [nrf noup] ci: add .github/test-spec.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file is used for NCS-specific testing configuration based on modifications to files in this repository. Signed-off-by: Alperen Sener Signed-off-by: Elisabeth Solheim Klakken Signed-off-by: Mariusz Poslinski Signed-off-by: Markus Swarowsky Signed-off-by: Robert Lubos Signed-off-by: Sebastian Wezel Signed-off-by: Tomasz Tyzenhauz Signed-off-by: Fredrik Ås Signed-off-by: Michał Szablowski Signed-off-by: Tony Le Signed-off-by: Krishna T Signed-off-by: Dawid Przybylo Signed-off-by: Rubin Gerritsen Signed-off-by: Jørgen Kvalvaag Signed-off-by: Magne Værnes Signed-off-by: Lang Xie Signed-off-by: Alexander Svensen Signed-off-by: Jan Gałda Signed-off-by: Vladislav Litvinov Signed-off-by: Guojun Wang Signed-off-by: Piotr Kosycarz (cherry picked from commit 605f129e42d2a04086e819f3e446bdb4fd22b539) (cherry picked from commit 817446221498fe6e6f585768fe4f9136a18fc0f2) (cherry picked from commit d53a1c962551409a9db38d711f5e076804170d79) (cherry picked from commit 255ee9dbefa18142e395f4b8abfd4fd20a80ad53) (cherry picked from commit 5e158827055b624583817e226972f2f8e2c1f030) (cherry picked from commit 23b8a13a04d81fe92a185b15c60fdb10ac52578d) (cherry picked from commit 660313bbc996648d6a617a5c65c618b68b0c6686) (cherry picked from commit 14a865b41c6f51ba8786c7eae23a1a3ff70a3727) (cherry picked from commit ddedbc9e833fa5f326a7d3d7d1fd0a27349d6208) (cherry picked from commit caae0dffc7de62bbe7188c85b92ba83ac05b44c8) (cherry picked from commit fe461000fe30fd556bc9aca96314775e74c723e6) (cherry picked from commit 22735e0e29f6331a97202d2aa284377d0f6a998a) (cherry picked from commit 849719038d041e6b17149fce6e2e7625d6ba4598) (cherry picked from commit 81474ef240546a7d4ef381cd7fb28627b5f43dc5) (cherry picked from commit 7bb927f7c0cddc52a643678225fd5b50e63306fd) (cherry picked from commit 9568c08251ee2fa29520ebe998762b72ccec4ecd) --- .github/test-spec.yml | 297 ++++++++++++++++++++++++++++++++++++++++++ CODEOWNERS | 1 + 2 files changed, 298 insertions(+) create mode 100644 .github/test-spec.yml diff --git a/.github/test-spec.yml b/.github/test-spec.yml new file mode 100644 index 00000000000..d9dcf1280f1 --- /dev/null +++ b/.github/test-spec.yml @@ -0,0 +1,297 @@ +# This is the Jenkins ci variant of the .github/labler.yaml + +"CI-run-zephyr-twister": + - any: + - "!.github/**/*" + - "!doc/**/*" + - "!CODEOWNERS" + - "!LICENSE" + - "!**/*.rst" + - "!VERSION" + - "!submanifests/**/*" + - "!MAINTAINERS.yml" + - "!version.h.in" + - "!Jenkinsfile" + - "!**/*.md" + +"CI-iot-zephyr-lwm2m-test": + - "drivers/console/**/*" + - "drivers/flash/**/*" + - "subsys/dfu/boot/**/*" + - "subsys/net/ip/**/*" + - "subsys/net/lib/http/**/*" + - "subsys/net/lib/lwm2m//**/*" + - "subsys/net/**/*" + +"CI-iot-samples-test": + - "boards/arm/nrf9160dk_nrf9160/**/*" + - "dts/arm/nordic/nrf9160*" + - "include/net/**/*" + - "subsys/net/lib/**/*" + +"CI-iot-libraries-test": + - "boards/arm/nrf9160dk_nrf9160/**/*" + - "dts/arm/nordic/nrf9160*" + - "include/net/socket_ncs.h" + - "subsys/testsuite/ztest/**/*" + +"CI-lwm2m-test": null +# Not necessary to run tests on changes to this repo. + +"CI-boot-dfu-test": + - "subsys/mgmt/mcumgr/**/*" + - "subsys/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "include/dfu/**/*" + - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" + +"CI-tfm-test": + - "boards/arm/nrf5340dk_nrf5340/**/*" + - "boards/arm/nrf9160dk_nrf9160/**/*" + - "drivers/entropy/*" + - "dts/arm/nordic/nrf5340*" + - "dts/arm/nordic/nrf9160*" + - "modules/trusted-firmware-m/**/*" + - "samples/tfm_integration/**/*" + +"CI-ble-test": + - any: + - "drivers/bluetooth/**/*" + - any: + - "dts/arm/nordic/nrf5*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + - any: + - "include/zephyr/bluetooth/**/*" + - "!include/zephyr/bluetooth/mesh/**/*" + - "samples/bluetooth/hci_rpc/**/*" + +"CI-mesh-test": + - "subsys/bluetooth/mesh/**/*" + - "include/zephyr/bluetooth/mesh/**/*" + - "samples/bluetooth/mesh/**/*" + - "samples/bluetooth/mesh_demo/**/*" + - "samples/bluetooth/mesh_provisioner/**/*" + - "tests/bluetooth/mesh/**/*" + - "tests/bluetooth/mesh_shell/**/*" + +"CI-zigbee-test": + - "subsys/mgmt/mcumgr/**/*" + - "subsys/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "include/dfu/**/*" + +"CI-thingy91-test": + - "boards/arm/nrf9160dk_nrf9160/**/*" + - "arch/x86/core/**/*" + - "arch/x86/include/**/*" + - "drivers/console/**/*" + - "drivers/ethernet/**/*" + - "drivers/flash/**/*" + - "drivers/hwinfo/**/*" + - "drivers/interrupt_controller/**/*" + - "drivers/net/**/*" + - "drivers/serial/**/*" + - "drivers/timer/**/*" + - "include/**/*" + - "kernel/**/*" + - "lib/libc/common/source/stdlib/**/*" + - "lib/libc/newlib/**/*" + - "lib/libc/picolibc/**/*" + - "lib/os/**/*" + - "lib/posix/**/*" + - "misc/**/*" + - "modules/mbedtls/**/*" + - "soc/x86/ia32/**/*" + - "subsys/fs/fcb/**/*" + - "subsys/logging/**/*" + - "subsys/net/**/*" + - "subsys/random/**/*" + - "subsys/settings/include/**/*" + - "subsys/settings/src/**/*" + - "subsys/stats/**/*" + - "subsys/storage/flash_map/**/*" + - "subsys/storage/stream/**/*" + - "subsys/tracing/**/*" + +"CI-desktop-test": + - any: + - "**/*" + - "!samples/bluetooth/**/*" + - "!tests/bluetooth/**/*" + +"CI-crypto-test": + - "boards/arm/nrf52840dk_nrf52840/**/*" + - "boards/arm/nrf5340dk_nrf5340/**/*" + - "boards/arm/nrf9160dk_nrf9160/**/*" + - "drivers/entropy/*" + - "drivers/serial/**/*" + - "dts/arm/nordic/nrf52840*" + - "dts/arm/nordic/nrf5340*" + - "dts/arm/nordic/nrf9160*" + - "include/drivers/serial/**/*" + - "modules/mbedtls/**/*" + +"CI-fem-test": + - any: + - "**/*" + - "!samples/bluetooth/**/*" + - "!tests/bluetooth/**/*" + +"CI-rs-test": + - any: + - "**/*" + - "!samples/bluetooth/**/*" + - "!tests/bluetooth/**/*" + +"CI-thread-test": + - "include/zephyr/net/**/*" + - "modules/mbedtls/**/*" + - "modules/openthread/**/*" + - "samples/net/openthread/**/*" + - "soc/arm/nordic_nrf/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-nfc-test": + - any: + - "**/*" + - "!samples/bluetooth/**/*" + - "!tests/bluetooth/**/*" + +"CI-matter-test": + - "include/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "soc/arm/nordic_nrf/**/*" + - "subsys/dfu/**/*" + - "subsys/settings/**/*" + - "subsys/net/**/*" + - "subsys/mgmt/mcumgr/**/*" + - "drivers/net/**/*" + - "samples/bluetooth/hci_rpc/**/*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + +"CI-find-my-test": + - any: + - "**/*" + - "!samples/bluetooth/**/*" + - "!tests/bluetooth/**/*" + +"CI-gazell-test": + - any: + - "**/*" + - "!samples/bluetooth/**/*" + - "!tests/bluetooth/**/*" + +"CI-rpc-test": + - any: + - "**/*" + - "!samples/bluetooth/**/*" + - "!tests/bluetooth/**/*" + +"CI-modemshell-test": + - "include/net/**/*" + - "include/posix/**/*" + - "include/shell/**/*" + - "drivers/net/**/*" + - "drivers/serial/**/*" + - "drivers/wifi/**/*" + - "subsys/shell/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-positioning-test": + - "include/net/**/*" + - "include/posix/**/*" + - "drivers/net/**/*" + - "drivers/wifi/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-cloud-test": + - "include/zephyr/dfu/**/*" + - "include/zephyr/net/**/*" + - "include/zephyr/posix/**/*" + - "include/zephyr/settings/**/*" + - "drivers/led/**/*" + - "drivers/net/**/*" + - "drivers/sensor/**/*" + - "drivers/serial/**/*" + - "drivers/wifi/**/*" + - "lib/posix/**/*" + - "soc/arm/nordic_nrf/**/*" + - "subsys/dfu/**/*" + - "subsys/net/**/*" + - "subsys/settings/**/*" + +"CI-wifi": + - "subsys/net/l2/wifi/**/*" + - "subsys/net/l2/ethernet/**/*" + +"CI-sidewalk-test": + - "include/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "soc/arm/nordic_nrf/**/*" + - "subsys/dfu/**/*" + - "subsys/settings/**/*" + - "subsys/mgmt/mcumgr/**/*" + - "samples/bluetooth/hci_rpc/**/*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + +"CI-audio-test": + - "boards/arm/nrf5340_audio_dk_nrf5340/**/*" + - "drivers/flash/**/*" + - "drivers/spi/**/*" + - "drivers/gpio/**/*" + - "drivers/i2c/**/*" + - "drivers/watchdog/**/*" + - "include/dfu/**/*" + - "include/mgmt/mcumgr/**/*" + - "samples/bluetooth/hci_rpc/**/*" + - "soc/arm/nordic_nrf/**/*" + - "subsys/bluetooth/audio/**/*" + - "subsys/bluetooth/host/**/*" + - "subsys/dfu/**/*" + - "subsys/fs/**/*" + - "subsys/mgmt/mcumgr/**/*" + - "subsys/sd/**/*" + - "subsys/storage/**/*" + - "subsys/task_wdt/**/*" + - "subsys/usb/**/*" + - "subsys/zbus/**/*" + +"CI-pmic-samples-test": + - "samples/shields/npm1300_ek/**/*" + - "boards/shields/npm1300_ek/**/*" + - "**/**npm1300**/**" + - "drivers/regulator/regulator_common.c" + - "drivers/regulator/regulator_shell.c" + - "drivers/gpio/gpio_shell.c" + - "drivers/sensor/sensor_shell.c" + +"CI-test-low-level": + - "dts/**/*" + - "include/zephyr/**/*" + - "tests/arch/**/*" + - "arch/**/*" + - "tests/kernel/**/*" + - "kernel/**/*" + - "tests/drivers/**/*" + - "drivers/**/*" + - "samples/subsys/settings/**/*" + - "subsys/settings/**/*" + - "samples/subsys/logging/**/*" + - "subsys/logging/**/*" + - "samples/sensor/**/*" + - "samples/hello_world/**/*" + - "samples/synchronization/**/*" + - "samples/drivers/watchdog/**/*" + - "modules/hal_nordic/**/*" diff --git a/CODEOWNERS b/CODEOWNERS index 8872e7381c5..2c8b9db3961 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -18,6 +18,7 @@ # component or code. This file is going to be deprecated and currently only had # entries that are not covered by the MAINTAINERS file. +/.github/test-spec.yml @nrfconnect/ncs-test-leads /soc/arm/aspeed/ @aspeeddylan /soc/arm/atmel_sam/common/*_sam4l_*.c @nandojve /soc/arm/atmel_sam/sam3x/ @ioannisg From 2f2142f031254c1c1abc858be2b55afed1ca8b8f Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Wed, 27 Sep 2023 09:41:10 +0000 Subject: [PATCH 0668/2300] [nrf noup] test: schedule_api: Use Minimal C library There is no point to use PICOLIB here as it bloats the tests. Signed-off-by: Dominik Ermel (cherry picked from commit 350e687dd5c75ac574fbea06200b8f02b854a7c7) --- tests/kernel/sched/schedule_api/prj.conf | 1 + tests/kernel/sched/schedule_api/prj_dumb.conf | 1 + tests/kernel/sched/schedule_api/prj_multiq.conf | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/kernel/sched/schedule_api/prj.conf b/tests/kernel/sched/schedule_api/prj.conf index fe5125047e3..785e9a3987b 100644 --- a/tests/kernel/sched/schedule_api/prj.conf +++ b/tests/kernel/sched/schedule_api/prj.conf @@ -7,3 +7,4 @@ CONFIG_MAX_THREAD_BYTES=5 CONFIG_TEST_USERSPACE=y CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y +CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj_dumb.conf b/tests/kernel/sched/schedule_api/prj_dumb.conf index c0ddfbd7c3f..a1d0cf6dced 100644 --- a/tests/kernel/sched/schedule_api/prj_dumb.conf +++ b/tests/kernel/sched/schedule_api/prj_dumb.conf @@ -5,3 +5,4 @@ CONFIG_SCHED_DUMB=y CONFIG_MAX_THREAD_BYTES=5 CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y +CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj_multiq.conf b/tests/kernel/sched/schedule_api/prj_multiq.conf index 18d04dd8656..77b3a49fd34 100644 --- a/tests/kernel/sched/schedule_api/prj_multiq.conf +++ b/tests/kernel/sched/schedule_api/prj_multiq.conf @@ -5,3 +5,4 @@ CONFIG_SCHED_MULTIQ=y CONFIG_MAX_THREAD_BYTES=5 CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y +CONFIG_MINIMAL_LIBC=y From 3176db5094ef9d86f1d19b04e93f9fd482f157ec Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 1 Jun 2023 15:58:56 +0200 Subject: [PATCH 0669/2300] [nrf noup] tests: drivers: build_all: regulator: use old schema New Twister schema is not supported yet in sdk-zephyr, drop this patch once Twister is updated. Signed-off-by: Gerard Marull-Paretas Signed-off-by: Dominik Ermel (cherry picked from commit 8b234720cb043930a80ebf3aa00b18a82ed9d821) --- tests/drivers/build_all/regulator/testcase.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/drivers/build_all/regulator/testcase.yaml b/tests/drivers/build_all/regulator/testcase.yaml index 58fc0851981..8214a2ca33a 100644 --- a/tests/drivers/build_all/regulator/testcase.yaml +++ b/tests/drivers/build_all/regulator/testcase.yaml @@ -3,9 +3,7 @@ tests: drivers.regulator.build: - tags: - - drivers - - regulator + tags: drivers regulator build_only: true platform_allow: - native_posix From ea4c4bf9822b98315b516fabfbec521b7f43c9a9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 19 Jun 2023 12:19:05 +0200 Subject: [PATCH 0670/2300] [nrf noup] Revert "twister: Use natural sort when generating hardware map" This reverts commit c37deeb0c4602dc3eeb700a7dc3ed317283fff17. This is only a temporary change, until we align our CI. To be removed once natsort is avaialble in the NCS CI. Signed-off-by: Robert Lubos (cherry picked from commit 34f5012ee258e0d090581ed1caf7ba752e327cd5) --- scripts/pylib/twister/twisterlib/hardwaremap.py | 3 +-- scripts/requirements-run-test.txt | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index 5e90b7c84c6..a0ea7c59a8e 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -13,7 +13,6 @@ import scl import logging from pathlib import Path -from natsort import natsorted from twisterlib.environment import ZEPHYR_BASE @@ -322,7 +321,7 @@ def readlink(link): def save(self, hwm_file): # use existing map - self.detected = natsorted(self.detected, key=lambda x: x.serial or '') + self.detected.sort(key=lambda x: x.serial or '') if os.path.exists(hwm_file): with open(hwm_file, 'r') as yaml_file: hwm = yaml.load(yaml_file, Loader=SafeLoader) diff --git a/scripts/requirements-run-test.txt b/scripts/requirements-run-test.txt index 83692128110..3bb0b21c44e 100644 --- a/scripts/requirements-run-test.txt +++ b/scripts/requirements-run-test.txt @@ -7,7 +7,6 @@ pyocd>=0.35.0 # used by twister for board/hardware map tabulate -natsort # used by mcuboot cbor>=1.0.0 From 166519f5407eaa8d516d88be03d92a37b3bb7138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eivind=20J=C3=B8lsgard?= Date: Tue, 9 May 2023 12:10:13 +0200 Subject: [PATCH 0671/2300] [nrf noup] cmake: modules: Add ZEPHYR_NRF_MODULE_DIR to snippets root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nRF directory to snippets root to allow placing snippets in the sdk-nrf/snippets directory. CmakeLists.txt in nRF directory is handled after the snippets so that adding the directory in sdk-nrf will not work. Signed-off-by: Eivind Jølsgard (cherry picked from commit 16ac80df1b7210957d8c325573326ec6f3d0b931) --- cmake/modules/snippets.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/modules/snippets.cmake b/cmake/modules/snippets.cmake index 550d236a2f4..6f8950c5f64 100644 --- a/cmake/modules/snippets.cmake +++ b/cmake/modules/snippets.cmake @@ -59,6 +59,7 @@ function(zephyr_process_snippets) # Set SNIPPET_ROOT. list(APPEND SNIPPET_ROOT ${APPLICATION_SOURCE_DIR}) list(APPEND SNIPPET_ROOT ${ZEPHYR_BASE}) + list(APPEND SNIPPET_ROOT ${ZEPHYR_NRF_MODULE_DIR}) unset(real_snippet_root) foreach(snippet_dir ${SNIPPET_ROOT}) # The user might have put a symbolic link in here, for example. From f3e6dd51ab695f019fae548149059d20b7bf89a6 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 15 Dec 2023 09:35:22 +0000 Subject: [PATCH 0672/2300] [nrf noup] cmake: modules: kconfig: Add hide child/parent variable Adds a variable to Kconfig which, when set, will disable showing child/parent Kconfig values in builds (enabled when Sysbuild is used) Signed-off-by: Jamie McCrae (cherry picked from commit 85a31e7c746db6023bced4cc9c997431f119d007) --- cmake/modules/kconfig.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 2077dc926e7..51dd9a0bed0 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -149,6 +149,7 @@ set(COMMON_KCONFIG_ENV_SETTINGS TOOLCHAIN_KCONFIG_DIR=${TOOLCHAIN_KCONFIG_DIR} TOOLCHAIN_HAS_NEWLIB=${_local_TOOLCHAIN_HAS_NEWLIB} TOOLCHAIN_HAS_PICOLIBC=${_local_TOOLCHAIN_HAS_PICOLIBC} + HIDE_CHILD_PARENT_CONFIG=${SYSBUILD} EDT_PICKLE=${EDT_PICKLE} # Export all Zephyr modules to Kconfig ${ZEPHYR_KCONFIG_MODULES_DIR} From 9b45014201afd6d90a3a991c12282c8236dfba62 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 3 Mar 2022 15:28:16 +0100 Subject: [PATCH 0673/2300] [nrf noup] doc: remove Kconfig search Kconfig search is handled in a separate docset in NCS, so remove the page. This is a long-term noup patch. Signed-off-by: Gerard Marull-Paretas Signed-off-by: Krishna T (cherry picked from commit 69bfcfb11e2be0951163506b689daa881a21c441) --- MAINTAINERS.yml | 1 - doc/build/kconfig/setting.rst | 6 ++---- doc/develop/application/index.rst | 5 ++--- doc/kconfig.rst | 8 -------- 4 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 doc/kconfig.rst diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index a6d820aca82..c6f75fd234d 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -707,7 +707,6 @@ Documentation: - doc/images/Zephyr-Kite-in-tree.png - doc/index-tex.rst - doc/index.rst - - doc/kconfig.rst - doc/known-warnings.txt - doc/templates/sample.tmpl - doc/templates/board.tmpl diff --git a/doc/build/kconfig/setting.rst b/doc/build/kconfig/setting.rst index 57dd7828978..cc7658a1664 100644 --- a/doc/build/kconfig/setting.rst +++ b/doc/build/kconfig/setting.rst @@ -7,8 +7,7 @@ The :ref:`menuconfig and guiconfig interfaces ` can be used to test out configurations during application development. This page explains how to make settings permanent. -All Kconfig options can be searched in the :ref:`Kconfig search page -`. +All Kconfig options can be searched in the Kconfig search page. .. note:: @@ -115,8 +114,7 @@ Assignments in configuration files are only respected if the dependencies for the symbol are satisfied. A warning is printed otherwise. To figure out what the dependencies of a symbol are, use one of the :ref:`interactive configuration interfaces ` (you can jump directly to a symbol with -:kbd:`/`), or look up the symbol in the :ref:`Kconfig search page -`. +:kbd:`/`), or look up the symbol in the Kconfig search page. .. _initial-conf: diff --git a/doc/develop/application/index.rst b/doc/develop/application/index.rst index f2be0d8b551..2cd96b3252b 100644 --- a/doc/develop/application/index.rst +++ b/doc/develop/application/index.rst @@ -641,9 +641,8 @@ started. See :ref:`setting_configuration_values` for detailed documentation on setting Kconfig configuration values. The :ref:`initial-conf` section on the same page -explains how the initial configuration is derived. See :ref:`kconfig-search` -for a complete list of configuration options. -See :ref:`hardening` for security information related with Kconfig options. +explains how the initial configuration is derived. See :ref:`hardening` for +security information related with Kconfig options. The other pages in the :ref:`Kconfig section of the manual ` are also worth going through, especially if you planning to add new configuration diff --git a/doc/kconfig.rst b/doc/kconfig.rst deleted file mode 100644 index 1123de2adbd..00000000000 --- a/doc/kconfig.rst +++ /dev/null @@ -1,8 +0,0 @@ -:orphan: - -.. _kconfig-search: - -Kconfig Search -============== - -.. kconfig:search:: From ea83f6ccc7786349ddcf267af19a1b63e0fe950f Mon Sep 17 00:00:00 2001 From: Sigvart Hovland Date: Fri, 3 May 2019 14:21:52 +0200 Subject: [PATCH 0674/2300] [nrf noup] tree-wide: support NCS Partition Manager (PM) definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partition Manager (PM) is a component of the nRF Connect SDK (NCS) which uses yaml files to resolve flash partition placement with a holistic view of the entire device, including each firmware image present on the flash device, and various subsystems, such as settings and NFFS. When this NCS extension is used, various source files which would use partition information from devicetree in "vanilla" zephyr instead use defines generated by PM instead. This commit removes support for HEX_FILES_TO_MERGE, as it conflicts with PM. The settings subsystem pm.yml defines a partition 'settings_storage'. The nffs subsystem pm.yml defines 'nffs_storage'. Leverage label translation to avoid patching partition names. Refer to the NCS documentation page for this feature for more details. This is a long-running out of tree patch which has been worked on by several people. The following sign-offs are in alphabetical order by first name. Signed-off-by: Andrzej Głąbek Signed-off-by: Andrzej Puzdrowski Signed-off-by: Håkon Øye Amundsen Signed-off-by: Ioannis Glaropoulos Signed-off-by: Joakim Andersson Signed-off-by: Johann Fischer Signed-off-by: Martí Bolívar Signed-off-by: Ole Sæther Signed-off-by: Robert Lubos Signed-off-by: Sebastian Bøe Signed-off-by: Sigvart Hovland Signed-off-by: Thomas Stenersen Signed-off-by: Torsten Rasmussen Signed-off-by: Øyvind Rønningstad Signed-off-by: Trond Einar Snekvik Signed-off-by: Gerard Marull-Paretas Signed-off-by: Tomasz Moń Signed-off-by: Dominik Ermel (cherry picked from commit a7fb26837763ee7c21fb666fe2faa8c7503a17f1) --- arch/arm/core/mpu/arm_mpu_regions.c | 13 ++++++ cmake/modules/kernel.cmake | 4 ++ drivers/flash/soc_flash_nrf.c | 11 +++++ .../arch/arm/cortex_m/scripts/linker.ld | 46 +++++++++++++++++++ include/zephyr/storage/flash_map.h | 6 +++ lib/libc/common/source/stdlib/malloc.c | 18 +++++++- lib/os/Kconfig.heap | 2 +- subsys/fs/littlefs_fs.c | 7 ++- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 +++++++++++ 9 files changed, 130 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index 6af62f84078..cfe1230c907 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,6 +8,9 @@ #include #include +#if USE_PARTITION_MANAGER +#include +#endif static const struct arm_mpu_region mpu_regions[] = { /* Region 0 */ @@ -21,6 +24,14 @@ static const struct arm_mpu_region mpu_regions[] = { #endif /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", +#if USE_PARTITION_MANAGER + PM_SRAM_ADDRESS, +#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) + REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), +#else + REGION_RAM_ATTR(REGION_SRAM_SIZE)), +#endif +#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -28,6 +39,8 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif + +#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index a093d46691f..06e1642f362 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -243,3 +243,7 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() + +if(ZEPHYR_NRF_MODULE_DIR) + include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) +endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index cc840309264..b5a3fefa1e5 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,6 +37,11 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER +#include +#include +#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ + #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -166,6 +171,12 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS + if (addr < PM_APP_ADDRESS) { + return soc_secure_mem_read(data, (void *)addr, len); + } +#endif + nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 3160aa5d4ae..25a48d11252 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -26,6 +26,35 @@ #endif #define RAMABLE_REGION RAM +#if USE_PARTITION_MANAGER + +#include + +#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) +/* We are linking against S1, create symbol containing the flash ID of S0. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S0_ID; + +#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ + +#ifdef PM_S1_ID +/* We are linking against S0, create symbol containing the flash ID of S1. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S1_ID; +#endif /* PM_S1_ID */ + +#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ + +#define ROM_ADDR PM_ADDRESS +#define ROM_SIZE PM_SIZE + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -58,6 +87,23 @@ #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS #endif +#endif /* USE_PARTITION_MANAGER */ + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) +#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) +#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) +#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) +#endif + #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index 380e58691e9..cc4a246105d 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -271,6 +271,10 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); +#if USE_PARTITION_MANAGER +#include +#else + #define FLASH_AREA_LABEL_EXISTS(label) __DEPRECATED_MACRO \ DT_HAS_FIXED_PARTITION_LABEL(label) @@ -343,6 +347,8 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_DEVICE(label) \ DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))) +#endif /* USE_PARTITION_MANAGER */ + #ifdef __cplusplus } #endif diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index e3a5db6f7d5..2f469d673e4 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,6 +25,20 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); +#if USE_PARTITION_MANAGER + +#include + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + +#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) +#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS + +#endif /* USE_PARTITION_MANAGER */ + #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -106,8 +120,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ - ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ + ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/lib/os/Kconfig.heap b/lib/os/Kconfig.heap index b913d6100dc..f6e8d93ae50 100644 --- a/lib/os/Kconfig.heap +++ b/lib/os/Kconfig.heap @@ -51,7 +51,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index 3058f402d73..c4c75bb48c4 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1054,7 +1054,12 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ + .storage_dev = (void *) \ + COND_CODE_1(USE_PARTITION_MANAGER, \ + (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ + (FIXED_PARTITION_ID(littlefs_storage)), \ + (FIXED_PARTITION_ID(storage)))), \ + (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index a74e46b8520..9996e1d74d9 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,8 +13,35 @@ extern "C" { #endif +#if CONFIG_PARTITION_MANAGER_ENABLED + +#include "pm_config.h" + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) +#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE +#else +/* The current image is a child image in a different domain than the image + * which defined the required values. To reach the values of the parent domain + * we use the 'PM__' variant of the define. + */ +#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ + +#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ + +#else + +#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) +#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) + +#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From cdd75908b4c5e633242831ec30769ff0af77742c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Thu, 13 Jan 2022 11:37:18 +0100 Subject: [PATCH 0675/2300] [nrf noup] modules: tf-m: use of PSA_HAS_XXXX_SUPPORT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This allows configurations enabled by PSA_WANTS_ALG_XXXX to be used to control which TF-M module is enabled -If the TF-M image doesn't support e.g. the MAC APIs, then the MAC interface is not enabled Note: This functionality requires that nrf_security is enabled ref: NCSDK-11689 Make TF-M crypto module depend on PSA_WANT_GENERATE_RANDOM, same as all other crypto modules, which have PSA_HAS to group all PSA features that require the module. This makes TF-M by default exclude the RNG module when not needed. Signed-off-by: Frank Audun Kvamtrø Signed-off-by: Joakim Andersson (cherry picked from commit 77360dd3f121c37f9df9399ff2c5c0b09d50c8cc) (cherry picked from commit 92a5b80480bd6b1be9dabb5684162cef3067a85d) --- modules/trusted-firmware-m/Kconfig.tfm.crypto_modules | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules index 1d70a2c44d2..02d3580c22f 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules +++ b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules @@ -10,6 +10,7 @@ if TFM_PARTITION_CRYPTO config TFM_CRYPTO_RNG_MODULE_ENABLED bool "Random number generator crypto module" default y + depends on PSA_WANT_GENERATE_RANDOM && NRF_SECURITY help Enables the random number generator module within the crypto partition. Unset this option if 'psa_generate_random' is not used. @@ -17,6 +18,7 @@ config TFM_CRYPTO_RNG_MODULE_ENABLED config TFM_CRYPTO_KEY_MODULE_ENABLED bool "KEY crypto module" default y + depends on PSA_HAS_KEY_SUPPORT && NRF_SECURITY help Enables the KEY crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_key_management.c' @@ -25,6 +27,7 @@ config TFM_CRYPTO_KEY_MODULE_ENABLED config TFM_CRYPTO_AEAD_MODULE_ENABLED bool "AEAD crypto module" default y + depends on PSA_HAS_AEAD_SUPPORT && NRF_SECURITY help Enables the AEAD crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_aead.c' @@ -33,6 +36,7 @@ config TFM_CRYPTO_AEAD_MODULE_ENABLED config TFM_CRYPTO_MAC_MODULE_ENABLED bool "MAC crypto module" default y + depends on PSA_HAS_MAC_SUPPORT && NRF_SECURITY help Enables the MAC crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_mac.c' @@ -41,6 +45,7 @@ config TFM_CRYPTO_MAC_MODULE_ENABLED config TFM_CRYPTO_HASH_MODULE_ENABLED bool "HASH crypto module" default y + depends on PSA_HAS_HASH_SUPPORT && NRF_SECURITY help Enables the HASH crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_hash.c' @@ -49,6 +54,7 @@ config TFM_CRYPTO_HASH_MODULE_ENABLED config TFM_CRYPTO_CIPHER_MODULE_ENABLED bool "CIPHER crypto module" default y + depends on PSA_HAS_CIPHER_SUPPORT && NRF_SECURITY help Enables the CIPHER crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_cipher.c' @@ -57,6 +63,7 @@ config TFM_CRYPTO_CIPHER_MODULE_ENABLED config TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED bool "ASYM ENCRYPT crypto module" default y + depends on PSA_HAS_ASYM_ENCRYPT_SUPPORT && NRF_SECURITY help Enables the ASYM ENCRYPT crypto module within the crypto partition. Unset this option if the encrypt functionality provided by 'crypto_asymmetric.c' @@ -65,6 +72,7 @@ config TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED config TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED bool "ASYM SIGN crypto module" default y + depends on PSA_HAS_ASYM_SIGN_SUPPORT && NRF_SECURITY help Enables the ASYM SIGN crypto module within the crypto partition. Unset this option if the sign functionality provided by 'crypto_asymmetric.c' @@ -73,10 +81,12 @@ config TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED config TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED bool "KEY DERIVATION crypto module" default y + depends on (PSA_HAS_KEY_DERIVATION || PSA_HAS_KEY_AGREEMENT) && NRF_SECURITY help Enables the KEY_DERIVATION crypto module within the crypto partition. Unset this option if the functionality provided by 'crypto_key_derivation.c' is not used. + Note that key agreement is under key derivation in the current implementation. endif # TFM_PARTITION_CRYPTO From 5579010af5a57aafbd83bb9dcde69e8c9233c140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Tue, 30 Nov 2021 09:41:05 +0100 Subject: [PATCH 0676/2300] [nrf noup] modules: mbedtls: add PSA configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add all of the PSA specification defined algorithms and key types. This makes the configurations independent of what is supported by the specific implementation. Add configurations for internal logic to see if a feature is enabled by PSA_WANTS_XXX. ref: NCSDK-11689 ref: NCSDK-17840 ref: NCSDK-17840 ref: NCSDK-26057 Add PSA symbols for Oberon extension to the PSA specification. Mbed TLS has adopted the same naming, so while this is not part of the PSA specification it is fine to add it to the generic configuration for both implementations. Add config support for PBKDF2_HMAC. Add config support for PBKDF2_AES_CMAC_PRF_128 Signed-off-by: Frank Audun Kvamtrø Signed-off-by: Vidar Lillebø Signed-off-by: Sebastian Bøe Signed-off-by: Markus Swarowsky Signed-off-by: Joakim Andersson Signed-off-by: Maciej Baczmanski Signed-off-by: Georgios Vasilakis (cherry picked from commit 0a78b665e502695a7855178595c3c077ff2ce71c) (cherry picked from commit b850ab7cfc8161ba37194f9c7e1935051e3d206f) (cherry picked from commit 33121ff883e93385eb12dddbed7077e8dcbb968d) (cherry picked from commit 1fab667892451f21114f87cf48863c0dbdfb9507) (cherry picked from commit 0708dc8e65603cca2abe7799bffe765f97d00bb4) (cherry picked from commit 93ad09a7305328387936b68059b63f64efd44f60) (cherry picked from commit d284b1840048b55b3928465d501e8ed4a6d58097) (cherry picked from commit 746b326eb0caf9c2227e2a9e7aa3479dffea19ca) (cherry picked from commit 76b0463a5a4b8b44cb4c82e5906711d18ae439db) --- drivers/entropy/Kconfig.psa_crypto | 1 + modules/mbedtls/Kconfig | 5 +- modules/mbedtls/Kconfig.psa | 848 +++++++++++++++++++++++++++++ 3 files changed, 853 insertions(+), 1 deletion(-) create mode 100644 modules/mbedtls/Kconfig.psa diff --git a/drivers/entropy/Kconfig.psa_crypto b/drivers/entropy/Kconfig.psa_crypto index d06001225b0..18514a071d1 100644 --- a/drivers/entropy/Kconfig.psa_crypto +++ b/drivers/entropy/Kconfig.psa_crypto @@ -7,6 +7,7 @@ config ENTROPY_PSA_CRYPTO_RNG bool "PSA Crypto Random source Entropy driver" depends on DT_HAS_ZEPHYR_PSA_CRYPTO_RNG_ENABLED select ENTROPY_HAS_DRIVER + select PSA_WANT_GENERATE_RANDOM default y help Enable the PSA Crypto source Entropy driver. diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index 67277fb24c4..6e59709323e 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -5,6 +5,7 @@ config ZEPHYR_MBEDTLS_MODULE bool + config MBEDTLS_PROMPTLESS bool help @@ -13,7 +14,6 @@ config MBEDTLS_PROMPTLESS mbed TLS menu prompt and instead handle the selection of MBEDTLS from dependent sub-configurations and thus prevent stuck symbol behavior. - menuconfig MBEDTLS bool "mbed TLS Support" if !MBEDTLS_PROMPTLESS help @@ -233,3 +233,6 @@ config APP_LINK_WITH_MBEDTLS issues for 'app'. endif # MBEDTLS + +# Add PSA configurations +rsource "Kconfig.psa" diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa new file mode 100644 index 00000000000..b4d72801300 --- /dev/null +++ b/modules/mbedtls/Kconfig.psa @@ -0,0 +1,848 @@ +# +# Copyright (c) 2022 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 +# +menu "PSA RNG support" + +config PSA_WANT_GENERATE_RANDOM + bool + prompt "PSA RNG support" + help + Provide random number generator (RNG) support. + +config PSA_WANT_ALG_CTR_DRBG + bool + prompt "PSA RNG using CTR-DRBG as PRNG" + help + Provide random number generator (RNG) using CTR-DRBG as the + pseudo-random number generator (PRNG), seeded by a true random + number generator (TRNG). + +config PSA_WANT_ALG_HMAC_DRBG + bool + prompt "PSA RNG using HMAC-DRBG as PRNG" + help + Provide random number generator (RNG) using HMAC-DRBG as the + pseudo-random number generator (PRNG), seeded by a true random + number generator (TRNG). + +endmenu # RNG support + +menu "PSA key type support" + +config PSA_HAS_KEY_SUPPORT + bool + default y + depends on PSA_WANT_KEY_TYPE_DERIVE || \ + PSA_WANT_KEY_TYPE_HMAC || \ + PSA_WANT_KEY_TYPE_RAW_DATA || \ + PSA_WANT_KEY_TYPE_PASSWORD || \ + PSA_WANT_KEY_TYPE_PASSWORD_HASH || \ + PSA_WANT_KEY_TYPE_PEPPER || \ + PSA_WANT_KEY_TYPE_AES || \ + PSA_WANT_KEY_TYPE_ARIA || \ + PSA_WANT_KEY_TYPE_DES || \ + PSA_WANT_KEY_TYPE_CAMELLIA || \ + PSA_WANT_KEY_TYPE_SM4 || \ + PSA_WANT_KEY_TYPE_ARC4 || \ + PSA_WANT_KEY_TYPE_CHACHA20 || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR || \ + PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR || \ + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_DH_KEY_PAIR || \ + PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY + +config PSA_WANT_KEY_TYPE_DERIVE + bool "PSA derive key type support" + help + This key type is for high-entropy secrets only. + For low-entropy secrets, password key type should be used instead. + +config PSA_WANT_KEY_TYPE_RAW_DATA + bool "PSA raw data key type support" + help + A "key" of this type cannot be used for any cryptographic operation. + Applications can use this type to store arbitrary data in the keystore. + +config PSA_WANT_KEY_TYPE_HMAC + bool "PSA HMAC key type support" + help + HMAC key. + +config PSA_WANT_KEY_TYPE_PASSWORD + bool "PSA password key type support" + help + A low-entropy secret for password hashing or key derivation. + +config PSA_WANT_KEY_TYPE_PASSWORD_HASH + bool "PSA password hash key type support" + help + A secret value that can be used to verify a password hash. + +config PSA_WANT_KEY_TYPE_PEPPER + bool "PSA pepper key type support" + help + A secret value that can be used when computing a password hash. + +config PSA_WANT_KEY_TYPE_AES + bool "PSA AES key type support" + help + Key for cipher, AEAD or MAC algorithm based on the AES block cipher. + +config PSA_WANT_KEY_TYPE_ARIA + bool "PSA ARIA key type support" + +config PSA_WANT_KEY_TYPE_DES + bool "PSA DES key type support (weak)" + help + Warning: Single DES and 2-key 3DES are weak and strongly deprecated + and are only recommended for decrypting legacy data. + 3-key 3DES is weak and deprecated and is only recommended for use in + legacy protocols. + +config PSA_WANT_KEY_TYPE_CAMELLIA + bool "PSA CAMELLIA key type support" + +config PSA_WANT_KEY_TYPE_SM4 + bool "PSA SM4 key type support" + +config PSA_WANT_KEY_TYPE_ARC4 + bool "PSA ARC4 key type support (weak)" + help + Warning: The ARC4 cipher is weak and deprecated and is only + recommended for use in legacy protocols. + +config PSA_WANT_KEY_TYPE_CHACHA20 + bool "PSA ChaCha20 key type support" + default y + depends on PSA_WANT_ALG_CHACHA20_POLY1305 || \ + PSA_WANT_ALG_STREAM_CIPHER + help + Key for the ChaCha20 stream cipher or the ChaCha20-Poly1305 AEAD algorithm. + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR + bool "PSA ECC key pair support" + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + help + Elliptic curve key pair: both the private and public key. + +config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + bool "PSA ECC public key support" + help + Elliptic curve public key. + + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT + bool "PSA ECC import key pair support" + default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + help + Elliptic curve key pair: import for both the private and public key. + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT + bool "PSA ECC export key pair support" + default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + help + Elliptic curve key pair: export for both the private and public key. + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE + bool "PSA ECC generate key pair support" + default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + help + Elliptic curve key pair: generate for both the private and public key. + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE + bool + default y + depends on PSA_WANT_KEY_TYPE_ECC_KEY_PAIR + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR + bool "PSA RSA key pair type support" + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + help + RSA key pair: both the private and public key. + +config PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + bool "PSA RSA public key support" + help + RSA public key. + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT + bool "PSA RSA key pair import key" + default y if PSA_WANT_KEY_TYPE_RSA_KEY_PAIR + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + help + RSA key pair: import key for both the private and public key. + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT + bool "PSA RSA key pair export key" + default y if PSA_WANT_KEY_TYPE_RSA_KEY_PAIR + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + help + RSA key pair: export key for both the private and public key. + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE + bool "PSA RSA key pair generate key" + default y if PSA_WANT_KEY_TYPE_RSA_KEY_PAIR + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + help + RSA key pair: key generation for both the private and public key. + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE + +config PSA_WANT_KEY_TYPE_DH_KEY_PAIR + bool "PSA DH key pair type support" + select PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY + help + Finite-field Diffie-Hellman key pair: both the private key and public key. + +config PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY + bool "PSA DH public key support" + help + Finite-field Diffie-Hellman public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_IMPORT + bool "SPAKE2P key pair import support" + default y if PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + help + SPAKE2P key pair: import key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_EXPORT + bool "SPAKE2P key pair export support" + default y if PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + help + SPAKE2P key pair: export key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_DERIVE + bool "SPAKE2P key pair derive support" + default y if PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + help + SPAKE2P key pair: derive key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_DERIVE + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR + bool "SPAKE2P key pair support" + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + help + SPAKE2P key pair: both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + bool "SPAKE2P public key support" + help + SPAKE2P public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_IMPORT + bool "SRP key pair import support" + default y if PSA_WANT_KEY_TYPE_SRP_KEY_PAIR + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + help + SRP key pair: import key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT + bool "SRP key pair export support" + default y if PSA_WANT_KEY_TYPE_SRP_KEY_PAIR + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + help + SRP key pair: export key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_DERIVE + bool "SRP key pair derive support" + default y if PSA_WANT_KEY_TYPE_SRP_KEY_PAIR + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + help + SRP key pair: derive key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_DERIVE + +config PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + bool "SRP public key support" + help + SRP public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR + bool "SRP public key support" + help + SRP public key. + +endmenu # PSA Key type support + +menu "PSA AEAD support" + +config PSA_HAS_AEAD_SUPPORT + bool + default y + depends on PSA_WANT_ALG_CCM || \ + PSA_WANT_ALG_GCM || \ + PSA_WANT_ALG_CHACHA20_POLY1305 + help + Prompt-less configuration that states that AEAD is supported. + +config PSA_WANT_ALG_CCM + bool + prompt "PSA CCM support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_GCM + bool + prompt "PSA GCM support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CHACHA20_POLY1305 + bool + prompt "PSA ChaCha20-Poly1305 support" if !PSA_PROMPTLESS + +endmenu # PSA AEAD support + + +menu "PSA MAC support" + +config PSA_HAS_MAC_SUPPORT + bool + default y + depends on PSA_WANT_ALG_CBC_MAC || \ + PSA_WANT_ALG_CMAC || \ + PSA_WANT_ALG_HMAC + help + Prompt-less configuration that states that MAC is supported. + +config PSA_WANT_ALG_CBC_MAC + bool + prompt "PSA CBC-MAC support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CMAC + bool + prompt "PSA CMAC support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_HMAC + bool + prompt "PSA HMAC support" if !PSA_PROMPTLESS + +endmenu # PSA MAC support + + +menu "PSA Hash support" + +config PSA_HAS_HASH_SUPPORT + bool + default y + depends on PSA_WANT_ALG_SHA_1 || \ + PSA_WANT_ALG_SHA_224 || \ + PSA_WANT_ALG_SHA_256 || \ + PSA_WANT_ALG_SHA_384 || \ + PSA_WANT_ALG_SHA_512 || \ + PSA_WANT_ALG_SHA_512_224 || \ + PSA_WANT_ALG_SHA_512_256 || \ + PSA_WANT_ALG_SHA3_224 || \ + PSA_WANT_ALG_SHA3_256 || \ + PSA_WANT_ALG_SHA3_384 || \ + PSA_WANT_ALG_SHA3_512 || \ + PSA_WANT_ALG_SM3 || \ + PSA_WANT_ALG_SHAKE256_512 || \ + PSA_WANT_ALG_RIPEMD160 || \ + PSA_WANT_ALG_MD2 || \ + PSA_WANT_ALG_MD4 || \ + PSA_WANT_ALG_MD5 + help + Prompt-less configuration that states that hash is supported. + +config PSA_WANT_ALG_SHA_1 + bool + prompt "PSA SHA-1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The SHA-1 hash is weak and deprecated and is only recommended + for use in legacy protocols. + +config PSA_WANT_ALG_SHA_224 + bool + prompt "PSA SHA-224 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA_256 + bool + prompt "PSA SHA-256 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA_384 + bool + prompt "PSA SHA-384 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA_512 + bool + prompt "PSA SHA-512 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA_512_224 + bool + prompt "PSA SHA-512/224 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA_512_256 + bool + prompt "PSA SHA-512/256 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA3_224 + bool + prompt "PSA SHA3-224 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA3_256 + bool + prompt "PSA SHA3-256 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA3_384 + bool + prompt "PSA SHA3-384 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA3_512 + bool + prompt "PSA SHA3-512 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SM3 + bool + prompt "PSA SM3 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHAKE256_512 + bool + prompt "PSA SHAKE256 512 bits support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RIPEMD160 + bool + prompt "PSA RIPEMD-160 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_MD2 + bool + prompt "PSA MD2 support (weak)" if !PSA_PROMPTLESS + help + Warning: The MD2 hash is weak and deprecated and is only recommended + for use in legacy protocols. + +config PSA_WANT_ALG_MD4 + bool + prompt "PSA MD4 support (weak)" if !PSA_PROMPTLESS + help + Warning: The MD4 hash is weak and deprecated and is only recommended + for use in legacy protocols. + +config PSA_WANT_ALG_MD5 + bool + prompt "PSA MD5 support (weak)" if !PSA_PROMPTLESS + help + Warning: The MD5 hash is weak and deprecated and is only recommended + for use in legacy protocols. + +endmenu # PSA Hash support + +menu "PSA Cipher support" + +config PSA_HAS_CIPHER_SUPPORT + bool + default y + depends on PSA_WANT_ALG_ECB_NO_PADDING || \ + PSA_WANT_ALG_CBC_NO_PADDING || \ + PSA_WANT_ALG_CBC_PKCS7 || \ + PSA_WANT_ALG_CCM_STAR_NO_TAG || \ + PSA_WANT_ALG_CFB || \ + PSA_WANT_ALG_CTR || \ + PSA_WANT_ALG_OFB || \ + PSA_WANT_ALG_XTS || \ + PSA_WANT_ALG_STREAM_CIPHER + help + Prompt-less configuration that states that cipher is supported. + +config PSA_WANT_ALG_ECB_NO_PADDING + bool + prompt "PSA ECB block cipher mode support (with no padding)" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CBC_NO_PADDING + bool + prompt "PSA CBC block cipher mode support (with no padding)" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CBC_PKCS7 + bool + prompt "PSA CBC block cipher mode support (with PKCS#7 padding)" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CFB + bool + prompt "PSA stream cipher using CFB block cipher mode support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CTR + bool + prompt "PSA stream cipher using CTR block cipher mode support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_OFB + bool + prompt "PSA stream cipher using OFB block cipher mode support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_XTS + bool + prompt "PSA XTS block cipher mode support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CCM_STAR_NO_TAG + bool + prompt "PSA CCM* with no tag support" if !PSA_PROMPTLESS + help + Unauthenticated version of CCM. Uses the cipher API instead of the AEAD API. + +config PSA_WANT_ALG_STREAM_CIPHER + bool + prompt "PSA stream cipher support" if !PSA_PROMPTLESS + +endmenu # PSA Cipher Support + +menu "PSA Key agreement support" + +config PSA_HAS_KEY_AGREEMENT + bool + default y + depends on PSA_WANT_ALG_ECDH + depends on PSA_WANT_ALG_FFDH + help + Promt-less configuration that states that key agreement is supported. + +config PSA_WANT_ALG_ECDH + bool + prompt "PSA ECDH support" if !PSA_PROMPTLESS + + +config PSA_WANT_ALG_FFDH + bool + prompt "PSA FFDH support" if !PSA_PROMPTLESS + +endmenu # PSA Key agreement support + +menu "PSA Key derivation support" + +config PSA_HAS_KEY_DERIVATION + bool + default y + depends on PSA_WANT_ALG_HKDF || \ + PSA_WANT_ALG_HKDF_EXPAND || \ + PSA_WANT_ALG_HKDF_EXTRACT || \ + PSA_WANT_ALG_PBKDF2_HMAC || \ + PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 || \ + PSA_WANT_ALG_TLS12_PRF || \ + PSA_WANT_ALG_TLS12_PSK_TO_MS || \ + PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS + help + Prompt-less configuration that states that key derivation is supported. + +config PSA_WANT_ALG_HKDF + bool + prompt "PSA HKDF support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_HKDF_EXTRACT + bool + prompt "PSA HKDF extract support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_HKDF_EXPAND + bool + prompt "PSA HKDF expand support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_PBKDF2_HMAC + bool + prompt "PSA PBKDF2 HMAC support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 + bool + prompt "PSA PBKDF2-AES-CMAC-PRF-128 support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_CMAC + +config PSA_WANT_ALG_TLS12_PRF + bool + prompt "PSA PRF support (TLS1.2)" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_TLS12_PSK_TO_MS + bool + prompt "PSA TLS 1.2 PSK to MS support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS + bool + prompt "PSA TLS 1.2 EC J-PAKE to PMS support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_SHA_256 + +endmenu # PSA Key derivation support + + +menu "PSA Asymmetric support" + +config PSA_HAS_ASYM_ENCRYPT_SUPPORT + bool + default y + depends on PSA_WANT_ALG_RSA_OAEP || \ + PSA_WANT_ALG_RSA_PKCS1V15_CRYPT + help + Prompt-less configuration that states that asymmetric encryption + is supported. + + +config PSA_HAS_ASYM_SIGN_SUPPORT + bool + default y + depends on PSA_WANT_ALG_DETERMINISTIC_ECDSA || \ + PSA_WANT_ALG_ECDSA || \ + PSA_WANT_ALG_ECDSA_ANY || \ + PSA_WANT_ALG_PURE_EDDSA || \ + PSA_WANT_ALG_ED25519PH || \ + PSA_WANT_ALG_ED448PH || \ + PSA_WANT_ALG_RSA_PKCS1V15_SIGN || \ + PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW || \ + PSA_WANT_ALG_RSA_PSS || \ + PSA_WANT_ALG_RSA_PSS_ANY_SALT + help + Prompt-less configuration that states that asymmetric signing + is supported. + +config PSA_WANT_ALG_ECDSA + bool + prompt "PSA ECDSA support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_ECDSA_ANY + bool + prompt "PSA ECDSA support, without hashing" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_DETERMINISTIC_ECDSA + bool + prompt "PSA ECDSA support (deterministic mode)" if !PSA_PROMPTLESS + +menu "Elliptic Curve type support" + +config PSA_WANT_ECC_BRAINPOOL_P_R1_160 + bool + prompt "PSA ECC BrainpoolP160r1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 160-bit curve brainpoolP160r1 is weak and deprecated and + is only recommended for use in legacy protocols. + +config PSA_WANT_ECC_BRAINPOOL_P_R1_192 + bool + prompt "PSA ECC BrainpoolP192r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_224 + bool + prompt "PSA ECC BrainpoolP224r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_256 + bool + prompt "PSA ECC BrainpoolP256r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_320 + bool + prompt "PSA ECC BrainpoolP320r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_384 + bool + prompt "PSA ECC BrainpoolP384r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_512 + bool + prompt "PSA ECC BrainpoolP512r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_MONTGOMERY_255 + bool + prompt "PSA ECC Curve25519 (X25519) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_MONTGOMERY_448 + bool + prompt "PSA ECC Curve448 (X448) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_TWISTED_EDWARDS_255 + bool + prompt "PSA ECC Edwards25519 (Ed25519) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_TWISTED_EDWARDS_448 + bool + prompt "PSA ECC Edwards448 (Ed448) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_K1_192 + bool + prompt "PSA ECC secp192k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_K1_224 + bool + prompt "PSA ECC secp224k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_K1_256 + bool + prompt "PSA ECC secp256k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_192 + bool + prompt "PSA ECC secp192r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_224 + bool + prompt "PSA ECC secp224r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_256 + bool + prompt "PSA ECC secp256r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_384 + bool + prompt "PSA ECC secp384r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_521 + bool + prompt "PSA ECC secp521r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R2_160 + bool + prompt "PSA ECC secp160r2 support (weak)" if !PSA_PROMPTLESS + help + Warning: his family of curves is weak and deprecated. + +config PSA_WANT_ECC_SECT_K1_163 + bool + prompt "PSA ECC sect163k1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 163-bit curve sect163k1 is weak and deprecated and is + only recommended for use in legacy protocols. + +config PSA_WANT_ECC_SECT_K1_233 + bool + prompt "PSA ECC sect233k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_239 + bool + prompt "PSA ECC sect239k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_283 + bool + prompt "PSA ECC sect283k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_409 + bool + prompt "PSA ECC sect409k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_571 + bool + prompt "PSA ECC sect571k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_163 + bool + prompt "PSA ECC sect163r1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 163-bit curve sect163r1 is weak and deprecated and is + only recommended for use in legacy protocols. + +config PSA_WANT_ECC_SECT_R1_233 + bool + prompt "PSA ECC sect233r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_283 + bool + prompt "PSA ECC sect283r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_409 + bool + prompt "PSA ECC sect409r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_571 + bool + prompt "PSA ECC sect571r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R2_163 + bool + prompt "PSA ECC sect163r2 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 163-bit curve sect163r2 is weak and deprecated and is + only recommended for use in legacy protocols. + +config PSA_WANT_ECC_FRP_V1_256 + bool + prompt "PSA ECC FRP256v1 support" if !PSA_PROMPTLESS + +endmenu # Elliptic Curve type support + +config PSA_WANT_ALG_RSA_OAEP + bool + prompt "PSA RSA OAEP asymmetric encryption support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PKCS1V15_CRYPT + bool + prompt "PSA RSA PKCS#1 v1.5 asymmetric encryption support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PKCS1V15_SIGN + bool + prompt "PSA RSA PKCS#1 v1.5 message signature support, with hashing" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW + bool + prompt "PSA RSA raw PKCS#1 v1.5 message signature support, without hashing)" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PSS + bool + prompt "PSA RSA PSS message signature support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PSS_ANY_SALT + bool + prompt "PSA RSA PSS message signature support, any salt length" if !PSA_PROMPTLESS + +endmenu # PSA Asymmetric support + +config PSA_WANT_ALG_JPAKE + bool + prompt "PSA EC J-PAKE support" if !PSA_PROMPTLESS + select EXPERIMENTAL if !NET_L2_OPENTHREAD + +config PSA_WANT_ALG_SPAKE2P_HMAC + bool + prompt "PSA SPAKE2+ HMAC support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SPAKE2P_CMAC + bool + prompt "PSA SPAKE2+ CMAC support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SPAKE2P_MATTER + bool + prompt "PSA SPAKE2+ MATTER support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SRP_6 + bool + prompt "PSA SRP-6 support" if !PSA_PROMPTLESS + select EXPERIMENTAL + +config PSA_WANT_ALG_SRP_PASSWORD_HASH + bool + prompt "PSA SRP password hash support" if !PSA_PROMPTLESS + select EXPERIMENTAL + + +config PSA_WANT_ALG_PURE_EDDSA + bool + prompt "PSA PURE_EDDSA support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_ED25519PH + bool + prompt "PSA ED25519PH support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_ED448PH + bool + prompt "PSA ED448PH support" if !PSA_PROMPTLESS From 0028d0d7d8dd276db7182148cc886b4de2b39b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Sat, 29 Jan 2022 13:03:08 +0100 Subject: [PATCH 0677/2300] [nrf noup] modules: mbedtls: Allow MBEDTLS_BUILTIN to be deselected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Out-of-tree crypto subsystems need to deselect MBEDTLS_BUILTIN, but deselection is not supported. It is however supported to select a dependency in a ! expression. Signed-off-by: Sebastian Bøe (cherry picked from commit 746136896ba8cb66f41742690e1021e7e83c0997) --- modules/mbedtls/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index 6e59709323e..2a05ee28d36 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -27,6 +27,7 @@ choice MBEDTLS_IMPLEMENTATION config MBEDTLS_BUILTIN bool "Use Zephyr in-tree mbedTLS version" + depends on ! DISABLE_MBEDTLS_BUILTIN help Link with mbedTLS sources included with Zephyr distribution. Included mbedTLS version is well integrated with and supported @@ -40,6 +41,11 @@ config MBEDTLS_LIBRARY endchoice +# subsystems cannot deselect MBEDTLS_BUILTIN, but they can select +# DISABLE_MBEDTLS_BUILTIN. +config DISABLE_MBEDTLS_BUILTIN + bool + config CUSTOM_MBEDTLS_CFG_FILE bool "Custom mbed TLS configuration file" help From d8c96cfab37d3738dac933075780f6ca24593447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Mon, 31 Jan 2022 03:48:11 +0100 Subject: [PATCH 0678/2300] [nrf noup] modules: mbedtls: Disable configurations in Kconfig.tls-generic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This commit prevents legacy mbed TLS configurations from being in conflict with PSA Configurations while using nrf_security -Removing use of unsupported TLS protocols (TLS 1.0, 1.1) -Required configurations are duplicated inside nrf_security Kconfig -Ensured that mbedtls_platform_zeroize is not duplicated when CONFIG_NRF_CC3XX_PLATFORM is set ref: NCSDK-13503 Precompiled CC3xx libraries silently provide mbedtls_hardware_poll function (used internally by the library on initialization), which creates ambiguity with Zephyr-provided implementation. In result, the CC3xx entropy source is broken when CONFIG_MBEDTLS_ZEPHYR_ENTROPY is enabled. Workaround this, by disabling the Zephyr implementation if CC3xx is enabled, and let mbed TLS use the implementation from the CC library instead. Signed-off-by: Frank Audun Kvamtrø Signed-off-by: Andrzej Głąbek Signed-off-by: Dominik Ermel Signed-off-by: Robert Lubos Signed-off-by: Sebastian Bøe Signed-off-by: Markus Swarowsky (cherry picked from commit ca0298cc20b632388a8cf75e166dde4a09987847) (cherry picked from commit 357dfb7b0e76683231fca51f4634a852f3db48a2) --- modules/mbedtls/Kconfig.tls-generic | 31 +++++++++++++++++++++++++++++ modules/mbedtls/zephyr_init.c | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/modules/mbedtls/Kconfig.tls-generic b/modules/mbedtls/Kconfig.tls-generic index 3c0e17c0fe3..d629c1b1d2a 100644 --- a/modules/mbedtls/Kconfig.tls-generic +++ b/modules/mbedtls/Kconfig.tls-generic @@ -9,6 +9,8 @@ menu "TLS configuration" menu "Supported TLS version" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_TLS_VERSION_1_0 bool "Support for TLS 1.0" select MBEDTLS_CIPHER @@ -33,6 +35,8 @@ config MBEDTLS_DTLS bool "Support for DTLS" depends on MBEDTLS_TLS_VERSION_1_1 || MBEDTLS_TLS_VERSION_1_2 +endif + config MBEDTLS_SSL_EXPORT_KEYS bool "Support for exporting SSL key block and master secret" depends on MBEDTLS_TLS_VERSION_1_0 || MBEDTLS_TLS_VERSION_1_1 || MBEDTLS_TLS_VERSION_1_2 @@ -47,6 +51,8 @@ menu "Ciphersuite configuration" comment "Supported key exchange modes" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_KEY_EXCHANGE_ALL_ENABLED bool "All available ciphersuite modes" select MBEDTLS_KEY_EXCHANGE_PSK_ENABLED @@ -81,6 +87,8 @@ config MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED || \ MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED +endif + config MBEDTLS_PSK_MAX_LEN int "Max size of TLS pre-shared keys" default 32 @@ -88,6 +96,8 @@ config MBEDTLS_PSK_MAX_LEN help Max size of TLS pre-shared keys, in bytes. +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_KEY_EXCHANGE_RSA_ENABLED bool "RSA-only based ciphersuite modes" default y if !NET_L2_OPENTHREAD @@ -202,6 +212,7 @@ config MBEDTLS_ECP_NIST_OPTIM bool "NSIT curves optimization" endif +endif # !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) comment "Supported hash" @@ -226,6 +237,8 @@ config MBEDTLS_HASH_SHA512_ENABLED comment "Supported cipher modes" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_CIPHER_ALL_ENABLED bool "All available ciphers" select MBEDTLS_CIPHER_AES_ENABLED @@ -299,8 +312,12 @@ config MBEDTLS_CHACHAPOLY_AEAD_ENABLED bool "ChaCha20-Poly1305 AEAD algorithm" depends on MBEDTLS_CIPHER_CHACHA20_ENABLED || MBEDTLS_MAC_POLY1305_ENABLED +endif + comment "Supported message authentication methods" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_MAC_ALL_ENABLED bool "All available MAC methods" select MBEDTLS_MAC_MD4_ENABLED @@ -349,10 +366,14 @@ config MBEDTLS_MAC_CMAC_ENABLED bool "CMAC (Cipher-based Message Authentication Code) mode for block ciphers." depends on MBEDTLS_CIPHER_AES_ENABLED || MBEDTLS_CIPHER_DES_ENABLED +endif + endmenu comment "Random number generators" +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_CTR_DRBG_ENABLED bool "CTR_DRBG AES-256-based random generator" depends on MBEDTLS_CIPHER_AES_ENABLED @@ -362,14 +383,20 @@ config MBEDTLS_HMAC_DRBG_ENABLED bool "HMAC_DRBG random generator" select MBEDTLS_MD +endif + comment "Other configurations" config MBEDTLS_CIPHER bool "generic cipher layer." +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_MD bool "generic message digest layer." +endif + config MBEDTLS_GENPRIME_ENABLED bool "prime-number generation code." @@ -387,11 +414,15 @@ config MBEDTLS_HAVE_ASM of asymmetric cryptography, however this might have an impact on the code size. +if !(NRF_SECURITY || NORDIC_SECURITY_BACKEND) + config MBEDTLS_ENTROPY_ENABLED bool "MbedTLS generic entropy pool" depends on MBEDTLS_MAC_SHA256_ENABLED || MBEDTLS_MAC_SHA384_ENABLED || MBEDTLS_MAC_SHA512_ENABLED default y if MBEDTLS_ZEPHYR_ENTROPY +endif + config MBEDTLS_OPENTHREAD_OPTIMIZATIONS_ENABLED bool "MbedTLS optimizations for OpenThread" depends on NET_L2_OPENTHREAD diff --git a/modules/mbedtls/zephyr_init.c b/modules/mbedtls/zephyr_init.c index 28a6a40fdc5..49c9ffc8aff 100644 --- a/modules/mbedtls/zephyr_init.c +++ b/modules/mbedtls/zephyr_init.c @@ -47,7 +47,7 @@ static void init_heap(void) #define init_heap(...) #endif /* CONFIG_MBEDTLS_ENABLE_HEAP && MBEDTLS_MEMORY_BUFFER_ALLOC_C */ -#if defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY) +#if defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY) && !defined(CONFIG_NRF_CC3XX_PLATFORM) static const struct device *const entropy_dev = DEVICE_DT_GET_OR_NULL(DT_CHOSEN(zephyr_entropy)); From 2ab7243854cfb3d67293c3b2ef829ad1c7564d02 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Mon, 12 Feb 2024 14:30:23 +0100 Subject: [PATCH 0679/2300] [nrf noup] modules: mbedtls: Add include folders We moved the header files in sdk-mbedtls from the library folder to the include/library folder. This was done to avoid issues when building MbedTLS with the nrf_security module and the Oberon PSA core. The Oberon PSA core provides a subset of these header files and since they are included with quotes we cannot have them in the same directory. This change make the needed adaptions in CMake for the applications that don't use nrf_security. Signed-off-by: Georgios Vasilakis Signed-off-by: Markus Swarowsky (cherry picked from commit 962eb7320fdb76ffe265d8bab7330ad472cb6f28) --- modules/mbedtls/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 929ea17ecea..a6277f654b5 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -25,6 +25,8 @@ zephyr_interface_library_named(mbedTLS) # Add regular includes target_include_directories(mbedTLS INTERFACE ${ZEPHYR_CURRENT_MODULE_DIR}/include + ${ZEPHYR_CURRENT_MODULE_DIR}/include/library + ${ZEPHYR_CURRENT_MODULE_DIR}/library configs include ) From 4fa3cc9657abf7334c4e44257c57684db65a1b3f Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Mon, 16 Jan 2023 14:15:22 +0100 Subject: [PATCH 0680/2300] [nrf noup] dts: choose a crypto accelerator for entropy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a long-term noup patch because crypto driver support is NCS-only for both cryptocell and CRACEN. Set HAS_HW_NRF_CC3XX to be defined in NS build when cryptocell is accessed through the PSA API. We need to know which CC3XX features are available. Set PSA as the entropy source for 54L. PSA is the only NCS-supported interface to CRACEN. Signed-off-by: Georgios Vasilakis Signed-off-by: Joakim Andersson Signed-off-by: Dominik Ermel Signed-off-by: Sebastian Bøe (cherry picked from commit 499041d072580ae79d4fe967f0df52e60e43966b) (cherry picked from commit baa4ee7ebd5d885119d6d196d62c1ca1e6af5841) --- dts/arm/nordic/nrf52840.dtsi | 4 ++-- dts/arm/nordic/nrf5340_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf54l_common.dtsi | 6 ++++++ dts/arm/nordic/nrf91.dtsi | 3 ++- soc/common/nordic_nrf/Kconfig.peripherals | 6 ++++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 20c18cf3d84..8efe49a3c91 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -5,7 +5,7 @@ / { chosen { - zephyr,entropy = &rng; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -547,7 +547,7 @@ reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index e40f6241d91..d48f0ce62dc 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -33,7 +33,7 @@ }; chosen { - zephyr,entropy = &rng_hci; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -102,7 +102,7 @@ reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index 415f2471174..3214daeac84 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -25,6 +25,12 @@ chosen { zephyr,flash-controller = &rram_controller; + zephyr,entropy = &psa_rng; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; }; sw_pwm: sw-pwm { diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 66c80c73a44..e65ce04a004 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -28,6 +28,7 @@ }; chosen { + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -51,7 +52,7 @@ reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; ctrlap: ctrlap@50006000 { diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index ca24384cf8e..a6b62428626 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -13,10 +13,12 @@ config HAS_HW_NRF_BPROT def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_BPROT)) config HAS_HW_NRF_CC310 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_SERIES_NRF91X) config HAS_HW_NRF_CC312 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_NRF5340_CPUAPP) config HAS_HW_NRF_CCM def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_CCM)) From 7c54cf3093ebbeba15e58dff6431372184f7ed06 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 20 Nov 2020 14:44:03 +0100 Subject: [PATCH 0681/2300] [nrf noup] Bluetooth: update experimental for qualification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update Kconfig options for qualification: - Remove experimental on qualified feature. - Add experimental on unqualified feature. - BT_L2CAP_ECRED is not marked as experimental upstream and we qualify it downstream. Signed-off-by: Joakim Andersson Signed-off-by: Trond Einar Snekvik Signed-off-by: Martí Bolívar Signed-off-by: Robert Lubos Signed-off-by: Dominik Ermel Signed-off-by: Ingar Kulbrandstad Signed-off-by: Torsten Rasmussen Signed-off-by: Herman Berget Signed-off-by: Tomasz Moń (cherry picked from commit c88a4a6ae2ee15bc449ce00435dfa323ce4a179f) --- subsys/bluetooth/controller/Kconfig | 3 ++- subsys/bluetooth/host/Kconfig.l2cap | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index b8e0d78c2ce..a7b2c1a74f1 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -117,7 +117,8 @@ choice BT_LL_CHOICE Select the Bluetooth Link Layer to compile. config BT_LL_SW_SPLIT - bool "Software-based BLE Link Layer" + bool "Software-based BLE Link Layer [EXPERIMENTAL]" + select EXPERIMENTAL select ENTROPY_GENERATOR help Use Zephyr software BLE Link Layer ULL LLL split implementation. diff --git a/subsys/bluetooth/host/Kconfig.l2cap b/subsys/bluetooth/host/Kconfig.l2cap index acb948c425a..f8d602acd57 100644 --- a/subsys/bluetooth/host/Kconfig.l2cap +++ b/subsys/bluetooth/host/Kconfig.l2cap @@ -66,7 +66,7 @@ config BT_L2CAP_DYNAMIC_CHANNEL allowing the creation of dynamic L2CAP Channels. config BT_L2CAP_ECRED - bool "L2CAP Enhanced Credit Based Flow Control support" + bool "L2CAP Enhanced Credit Based Flow Control support [EXPERIMENTAL]" depends on BT_L2CAP_DYNAMIC_CHANNEL help This option enables support for LE Connection oriented Channels with From c202d38d216500057134a36bb6637dfaeb139440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Wed, 8 Mar 2023 12:17:09 +0100 Subject: [PATCH 0682/2300] [nrf noup] Bluetooth: Mesh: Fix adv randomness bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes issue where randomness can be removed for advertising sets that have to handle other adv types than the BT_MESH_FRIEND_ADV tag type. Signed-off-by: Anders Storrø Signed-off-by: Aleksandr Khromykh Signed-off-by: Dominik Ermel (cherry picked from commit 3afe29330d959ee78d57db509a7380f0e05b6bba) (cherry picked from commit 36710dee098619426dcadcecdb7f217c12d01910) --- subsys/bluetooth/mesh/adv_ext.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index a80a47760ea..2df2cbb4597 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -511,8 +511,10 @@ int bt_mesh_adv_enable(void) return err; } - if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { - err = set_adv_randomness(adv->instance->handle, 0); + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && + IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && + advs[i].tags == BT_MESH_ADV_TAG_BIT_FRIEND) { + err = set_adv_randomness(advs[i].instance->handle, 0); if (err) { LOG_ERR("Failed to set zero randomness: %d", err); } From 188c2707060bfc6b054971b899c01c4408d5296a Mon Sep 17 00:00:00 2001 From: Jan Tore Guggedal Date: Mon, 18 May 2020 20:50:13 +0200 Subject: [PATCH 0683/2300] [nrf noup] net: mqtt: Provide option to enable TLS session caching Provides an option to enable TLS session caching for an MQTT client's secure socket. Signed-off-by: Jan Tore Guggedal Signed-off-by: Robert Lubos Signed-off-by: Dominik Ermel Signed-off-by: Johann Fischer (cherry picked from commit 05e424a60315d7083c1b2c3391010b54bd42443a) --- include/zephyr/net/mqtt.h | 3 +++ subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index f1071af64f2..83ec02a5999 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -356,6 +356,9 @@ struct mqtt_sec_config { /** Indicates the list of security tags to be used for the session. */ const sec_tag_t *sec_tag_list; + /** Indicates the preference for enabling TLS session caching. */ + int session_cache; + /** Peer hostname for ceritificate verification. * May be NULL to skip hostname verification. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index c835656b6cf..363ff51afef 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -78,6 +78,16 @@ int mqtt_client_tls_connect(struct mqtt_client *client) } } + if (tls_config->session_cache == TLS_SESSION_CACHE_ENABLED) { + ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, + TLS_SESSION_CACHE, + &tls_config->session_cache, + sizeof(tls_config->session_cache)); + if (ret < 0) { + goto error; + } + } + if (tls_config->cert_nocopy != TLS_CERT_NOCOPY_NONE) { ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, TLS_CERT_NOCOPY, &tls_config->cert_nocopy, From b09985d98a322c19c5e777bdb1c043897c733e30 Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Thu, 10 Mar 2022 00:25:50 -0800 Subject: [PATCH 0684/2300] [nrf noup] net: mqtt: add native TLS support This commit adds an extra parameter in the configuration structure to configure native TLS support at runtime. Signed-off-by: Mirko Covizzi (cherry picked from commit 63940d988b3879983d2c36270e703422c5dd7d05) --- doc/connectivity/networking/api/mqtt.rst | 3 +++ include/zephyr/net/mqtt.h | 3 +++ subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/mqtt.rst b/doc/connectivity/networking/api/mqtt.rst index 973b61860e3..16ba69e1288 100644 --- a/doc/connectivity/networking/api/mqtt.rst +++ b/doc/connectivity/networking/api/mqtt.rst @@ -149,6 +149,7 @@ additional configuration information: tls_config->sec_tag_list = m_sec_tags; tls_config->sec_tag_count = ARRAY_SIZE(m_sec_tags); tls_config->hostname = MQTT_BROKER_HOSTNAME; + tls_config->set_native_tls = true; In this sample code, the ``m_sec_tags`` array holds a list of tags, referencing TLS credentials that the MQTT library should use for authentication. We do not specify @@ -161,6 +162,8 @@ Note, that TLS credentials referenced by the ``m_sec_tags`` array must be registered in the system first. For more information on how to do that, refer to :ref:`secure sockets documentation `. +Finally, ``set_native_tls`` can be optionally set to enable native TLS support instead of offloading TLS operations to the modem. + An example of how to use TLS with MQTT is also present in :zephyr:code-sample:`mqtt-publisher` sample application. diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index 83ec02a5999..906cd8f6be6 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -366,6 +366,9 @@ struct mqtt_sec_config { /** Indicates the preference for copying certificates to the heap. */ int cert_nocopy; + + /** Set socket to native TLS */ + bool set_native_tls; }; /** @brief MQTT transport type. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 363ff51afef..8e9cc87239a 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -22,10 +22,15 @@ int mqtt_client_tls_connect(struct mqtt_client *client) { const struct sockaddr *broker = client->broker; struct mqtt_sec_config *tls_config = &client->transport.tls.config; + int type = SOCK_STREAM; int ret; + if (tls_config->set_native_tls) { + type |= SOCK_NATIVE_TLS; + } + client->transport.tls.sock = zsock_socket(broker->sa_family, - SOCK_STREAM, IPPROTO_TLS_1_2); + type, IPPROTO_TLS_1_2); if (client->transport.tls.sock < 0) { return -errno; } From e46ed86ebcc5213df2a46f5ca9dee69eba46a14c Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Tue, 16 May 2023 02:19:42 +0530 Subject: [PATCH 0685/2300] [nrf noup] net: Increase connection manager stack size Connection manager L2 Wi-Fi calls internally invoke WPA supplicant calls which requires higher stack size. Update the default stack size for such cases. Marking this "nrf noup" since supplicant is not upstream yet. Signed-off-by: Ravi Dondaputi Signed-off-by: Dominik Ermel (cherry picked from commit a87c9bbd70a2baf0823a4e03e783375e243a4e11) --- subsys/net/conn_mgr/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/conn_mgr/Kconfig b/subsys/net/conn_mgr/Kconfig index e72e614d54c..05686a663eb 100644 --- a/subsys/net/conn_mgr/Kconfig +++ b/subsys/net/conn_mgr/Kconfig @@ -24,6 +24,7 @@ source "subsys/net/Kconfig.template.log_config.net" config NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE int "Size of the stack allocated for the conn_mgr_monitor thread" + default 8192 if WPA_SUPP default 512 help Sets the stack size which will be used by the connection manager for connectivity monitoring. From e6f8064b7e9cee8748cdc6a24d01ddbd9458afa1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 1 Oct 2018 10:27:32 +0200 Subject: [PATCH 0686/2300] [nrf noup] include: net: add NCS extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add some socket options and address family extensions to Zephyr headers, which will be useful for nRF Connect SDK. Add secure socket options: * Add CID socket options to NCS specific options. * Add TLS/DTLS tls ciphersuite chosen socket option to NCS specific options. * Add TLS/DTLS connection save/load socket options to NCS specific options. * Add TLS/DTLS handshake status socket option to NCS specific options. * Add SO_KEEPOPEN socket option. * Add SO_RAI socket option, deprecate the old ones. The "author" of this commit is a contact person; various people with s-o-b lines following here have contributed to the maintenance of this patch. Signed-off-by: Andreas Moltumyr Signed-off-by: Andrzej Głąbek Signed-off-by: Christopher Métrailler Signed-off-by: Emanuele Di Santo Signed-off-by: Glenn Ruben Bakke Signed-off-by: Håkon Alseth Signed-off-by: Ioannis Glaropoulos Signed-off-by: Jan Tore Guggedal Signed-off-by: Joakim Andersson Signed-off-by: Martí Bolívar Signed-off-by: Mirko Covizzi Signed-off-by: Petri Honkala Signed-off-by: Robert Lubos Signed-off-by: Tommi Mammela Signed-off-by: Trond Einar Snekvik Signed-off-by: Torsten Rasmussen Signed-off-by: Eivind Jølsgard Signed-off-by: Dominik Ermel (cherry picked from commit 3a641f9c4f14104c0f950b33b0b5d3731b431ec9) (cherry picked from commit 22f769089b5b1ae03ef0688deaf1637bca47e6ae) --- include/zephyr/net/socket.h | 1 + include/zephyr/net/socket_ncs.h | 202 ++++++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 include/zephyr/net/socket_ncs.h diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index 91f9193bbf8..f32753a7952 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #ifdef __cplusplus diff --git a/include/zephyr/net/socket_ncs.h b/include/zephyr/net/socket_ncs.h new file mode 100644 index 00000000000..0023cd9bd48 --- /dev/null +++ b/include/zephyr/net/socket_ncs.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2021 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ +#define ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ + +/** + * @file + * @brief NCS specific additions to the BSD sockets API definitions + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* When CONFIG_NET_SOCKETS_OFFLOAD is enabled, offloaded sockets take precedence + * when creating a new socket. Combine this flag with a socket type when + * creating a socket, to enforce native socket creation (e. g. SOCK_STREAM | SOCK_NATIVE). + * If it's desired to create a native TLS socket, but still offload the + * underlying TCP/UDP socket, use e. g. SOCK_STREAM | SOCK_NATIVE_TLS. + */ +#define SOCK_NATIVE 0x80000000 +#define SOCK_NATIVE_TLS 0x40000000 + +/* NCS specific TLS level socket options */ + +/** Socket option to set DTLS handshake timeout, specifically for nRF sockets. + * The option accepts an integer, indicating the total handshake timeout, + * including retransmissions, in seconds. + * Accepted values for the option are: 1, 3, 7, 15, 31, 63, 123. + */ +#define TLS_DTLS_HANDSHAKE_TIMEO 18 + +/** Socket option to save DTLS connection, specifically for nRF sockets. + */ +#define TLS_DTLS_CONN_SAVE 19 + +/** Socket option to load DTLS connection, specifically for nRF sockets. + */ +#define TLS_DTLS_CONN_LOAD 20 + +/** Socket option to get result of latest TLS/DTLS completed handshakes end status, + * specifically for nRF sockets. + * The option accepts an integer, indicating the setting. + * Accepted vaules for the option are: 0 and 1. + */ +#define TLS_DTLS_HANDSHAKE_STATUS 21 + +/* Valid values for TLS_SESSION_CACHE option */ +#define TLS_SESSION_CACHE_DISABLED 0 /**< Disable TLS session caching. */ +#define TLS_SESSION_CACHE_ENABLED 1 /**< Enable TLS session caching. */ + +/* Valid values for TLS_DTLS_HANDSHAKE_TIMEO option */ +#define TLS_DTLS_HANDSHAKE_TIMEO_NONE 0 /**< No timeout */ +#define TLS_DTLS_HANDSHAKE_TIMEO_1S 1 /**< 1 second */ +#define TLS_DTLS_HANDSHAKE_TIMEO_3S 3 /**< 1s + 2s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_7S 7 /**< 1s + 2s + 4s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_15S 15 /**< 1s + 2s + 4s + 8s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_31S 31 /**< 1s + 2s + 4s + 8s + 16s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_63S 63 /**< 1s + 2s + 4s + 8s + 16s + 32s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_123S 123 /**< 1s + 2s + 4s + 8s + 16s + 32s + 60s */ + +/* Valid values for TLS_DTLS_HANDSHAKE_STATUS option */ +#define TLS_DTLS_HANDSHAKE_STATUS_FULL 0 +#define TLS_DTLS_HANDSHAKE_STATUS_CACHED 1 + +/* NCS specific socket options */ + +/** sockopt: enable sending data as part of exceptional events */ +#define SO_EXCEPTIONAL_DATA 33 +/** sockopt: Keep socket open when its PDN connection is lost + * or the device is put into flight mode. + */ +#define SO_KEEPOPEN 34 +/** sockopt: bind to PDN */ +#define SO_BINDTOPDN 40 +/** sockopt: Release Assistance Indication feature: This will indicate that the + * application will not send any more data. + * + * @note This socket option requires the socket to be connected. + * + * @deprecated use @ref SO_RAI with value @ref RAI_NO_DATA instead. + */ +#define SO_RAI_NO_DATA 50 +/** sockopt: Release Assistance Indication feature: This will indicate that the + * next call to send/sendto will be the last one for some time. + * + * @deprecated use @ref SO_RAI with value @ref RAI_LAST instead. + */ +#define SO_RAI_LAST 51 +/** sockopt: Release Assistance Indication feature: This will indicate that + * after the next call to send/sendto, the application is expecting to receive + * one more data packet before this socket will not be used again for some time. + * + * @deprecated use @ref SO_RAI with value @ref RAI_ONE_RESP instead. + */ +#define SO_RAI_ONE_RESP 52 +/** sockopt: Release Assistance Indication feature: If a client application + * expects to use the socket more it can indicate that by setting this socket + * option before the next send call which will keep the network up longer. + * + * @deprecated use @ref SO_RAI with value @ref RAI_ONGOING instead. + */ +#define SO_RAI_ONGOING 53 +/** sockopt: Release Assistance Indication feature: If a server application + * expects to use the socket more it can indicate that by setting this socket + * option before the next send call. + * + * @deprecated use @ref SO_RAI with value @ref RAI_WAIT_MORE instead. + */ +#define SO_RAI_WAIT_MORE 54 + +/** sockopt: Release assistance indication (RAI). + * The option accepts an integer, indicating the type of RAI. + * Accepted values for the option are: @ref RAI_NO_DATA, @ref RAI_LAST, @ref RAI_ONE_RESP, + * @ref RAI_ONGOING, @ref RAI_WAIT_MORE. + */ +#define SO_RAI 61 + +/** Release assistance indication (RAI). + * Indicate that the application does not intend to send more data. + * This applies immediately and lets the modem exit connected mode more + * quickly. + * + * @note This requires the socket to be connected. + */ +#define RAI_NO_DATA 1 +/** Release assistance indication (RAI). + * Indicate that the application does not intend to send more data + * after the next call to send() or sendto(). + * This lets the modem exit connected mode more quickly after sending the data. + */ +#define RAI_LAST 2 +/** Release assistance indication (RAI). + * Indicate that the application is expecting to receive just one data packet + * after the next call to send() or sendto(). + * This lets the modem exit connected mode more quickly after having received the data. + */ +#define RAI_ONE_RESP 3 +/** Release assistance indication (RAI). + * Indicate that the socket is in active use by a client application. + * This lets the modem stay in connected mode longer. + */ +#define RAI_ONGOING 4 +/** Release assistance indication (RAI). + * Indicate that the socket is in active use by a server application. + * This lets the modem stay in connected mode longer. + */ +#define RAI_WAIT_MORE 5 + +/* NCS specific IPPROTO_ALL level socket options */ + +/** IPv4 and IPv6 protocol level (pseudo-val) for nRF sockets. */ +#define IPPROTO_ALL 512 +/** sockopt: disable all replies to unexpected traffics */ +#define SO_SILENCE_ALL 30 + +/* NCS specific IPPROTO_IP level socket options */ + +/** sockopt: enable IPv4 ICMP replies */ +#define SO_IP_ECHO_REPLY 31 + +/* NCS specific IPPROTO_IPV6 level socket options */ + +/** sockopt: enable IPv6 ICMP replies */ +#define SO_IPV6_ECHO_REPLY 32 + +/* NCS specific TCP level socket options */ + +/** sockopt: Configurable TCP server session timeout in minutes. + * Range is 0 to 135. 0 is no timeout and 135 is 2 h 15 min. Default is 0 (no timeout). + */ +#define SO_TCP_SRV_SESSTIMEO 55 + +/* NCS specific gettaddrinfo() flags */ + +/** Assume `service` contains a Packet Data Network (PDN) ID. + * When specified together with the AI_NUMERICSERV flag, + * `service` shall be formatted as follows: "port:pdn_id" + * where "port" is the port number and "pdn_id" is the PDN ID. + * Example: "8080:1", port 8080 PDN ID 1. + * Example: "42:0", port 42 PDN ID 0. + */ +#define AI_PDNSERV 0x1000 + +/* NCS specific send() and sendto() flags */ + +/** Request a blocking send operation until the request is acknowledged. + * When used in send() or sendto(), the request will not return until the + * send operation is completed by lower layers, or until the timeout, given by the SO_SNDTIMEO + * socket option, is reached. Valid timeout values are 1 to 600 seconds. + */ +#define MSG_WAITACK 0x200 + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ */ From 58d05502b3e1bb25e70d64f7b255cf0a387699fa Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 4 Dec 2023 15:27:08 +0100 Subject: [PATCH 0687/2300] [nrf noup] soc: arm: nRF53: Add SPU Flash/RAM alignment TF-M will uses SPU alignment during build time to make sure all partitions can be locked down with the SPU. So adding them for nRF53 Signed-off-by: Markus Swarowsky Signed-off-by: Dominik Ermel (cherry picked from commit 90826581f1ee32b99f1cafdffc2e634a495d8ee3) --- soc/arm/nordic_nrf/nrf53/Kconfig.soc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.soc b/soc/arm/nordic_nrf/nrf53/Kconfig.soc index 3ecf09ecd92..b3ca2661675 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.soc @@ -124,12 +124,26 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral +config NRF_SPU_FLASH_REGION_ALIGNMENT + hex + default 0x4000 + help + FLASH regions must be aligned to this value due to SPU HW + limitations. + config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 help RAM region size for the NRF_SPU peripheral +config NRF_SPU_RAM_REGION_ALIGNMENT + hex + default 0x2000 + help + RAM regions must be aligned to this value due to SPU HW + limitations. + config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 bool depends on NRF_SOC_SECURE_SUPPORTED From 95a3bde0a6269dbe41e22fc97d6259070d170d2c Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 4 Dec 2023 15:27:14 +0100 Subject: [PATCH 0688/2300] [nrf noup] soc: arm: nRF91: Add SPU Flash/RAM alignment TF-M will uses SPU alignment during build time to make sure all partitions can be locked down with the SPU. So adding them for nRF91 Signed-off-by: Markus Swarowsky Signed-off-by: Dominik Ermel (cherry picked from commit 83be41dde2e00776f02e583d8e6e55743b6c2ef7) --- soc/arm/nordic_nrf/nrf91/Kconfig.series | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/soc/arm/nordic_nrf/nrf91/Kconfig.series b/soc/arm/nordic_nrf/nrf91/Kconfig.series index 1be69c377e5..08d36e5b48c 100644 --- a/soc/arm/nordic_nrf/nrf91/Kconfig.series +++ b/soc/arm/nordic_nrf/nrf91/Kconfig.series @@ -27,9 +27,23 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral +config NRF_SPU_FLASH_REGION_ALIGNMENT + hex + default 0x8000 + help + FLASH regions must be aligned to this value due to SPU HW + limitations. + config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 help RAM region size for the NRF_SPU peripheral + +config NRF_SPU_RAM_REGION_ALIGNMENT + hex + default 0x2000 + help + RAM regions must be aligned to this value due to SPU HW + limitations. endif From 5b9d7df92cafb0e4b97430d61e3717055b46743a Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Mon, 14 Nov 2022 11:22:06 +0100 Subject: [PATCH 0689/2300] [nrf noup] boards: thingy53_nrf5340: Add common partition map Change introduces common static Partition Manager configuration. The tfm_nonsecure partition must be SPU region aligned. Ref: NCSDK-18033 Ref: NCSDK-19515 Signed-off-by: Marek Pieta Signed-off-by: Markus Swarowsky (cherry picked from commit cb04671ad6e0de80e4441e996cc29416af40caaa) --- .../pm_static_thingy53_nrf5340_cpuapp.yml | 55 ++++++++++++++ .../pm_static_thingy53_nrf5340_cpuapp_ns.yml | 73 +++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp.yml create mode 100644 boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp_ns.yml diff --git a/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp.yml b/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp.yml new file mode 100644 index 00000000000..7a48d51ec33 --- /dev/null +++ b/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp.yml @@ -0,0 +1,55 @@ +app: + address: 0x10200 + region: flash_primary + size: 0xdfe00 +mcuboot: + address: 0x0 + region: flash_primary + size: 0x10000 +mcuboot_pad: + address: 0x10000 + region: flash_primary + size: 0x200 +mcuboot_primary: + address: 0x10000 + orig_span: &id001 + - mcuboot_pad + - app + region: flash_primary + size: 0xe0000 + span: *id001 +mcuboot_primary_app: + address: 0x10200 + orig_span: &id002 + - app + region: flash_primary + size: 0xdfe00 + span: *id002 +settings_storage: + address: 0xf0000 + region: flash_primary + size: 0x10000 +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x00000 + size: 0xe0000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xe0000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x120000 + size: 0x6e0000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp_ns.yml b/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp_ns.yml new file mode 100644 index 00000000000..70ffe6d9c12 --- /dev/null +++ b/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp_ns.yml @@ -0,0 +1,73 @@ +mcuboot: + address: 0x0 + region: flash_primary + size: 0x10000 +mcuboot_pad: + address: 0x10000 + region: flash_primary + size: 0x200 +tfm_secure: + address: 0x10000 + size: 0xc000 + span: [mcuboot_pad, tfm] +tfm_nonsecure: + address: 0x1c000 + size: 0xd4000 + span: [app] +tfm: + address: 0x10200 + region: flash_primary + size: 0xbe00 +app: + address: 0x1c000 + region: flash_primary + size: 0xd4000 +mcuboot_primary: + address: 0x10000 + orig_span: &id001 + - mcuboot_pad + - tfm + - app + region: flash_primary + size: 0xe0000 + span: *id001 +mcuboot_primary_app: + address: 0x10200 + orig_span: &id002 + - tfm + - app + region: flash_primary + size: 0xdfe00 + span: *id002 +nonsecure_storage: + address: 0xf0000 + size: 0x10000 + span: [settings_storage] +settings_storage: + address: 0xf0000 + region: flash_primary + size: 0x10000 +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x00000 + size: 0xe0000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xe0000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x120000 + size: 0x6e0000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary From ef801f13ca0f4dd63cced39b527f6adb90c1eff0 Mon Sep 17 00:00:00 2001 From: Mateusz Kapala Date: Thu, 2 Feb 2023 11:04:23 +0100 Subject: [PATCH 0690/2300] [nrf noup] boards: arm: thingy53: Disable USB CDC added by MCUBoot Enabling USB CDC by default in Thingy:53 board configuration caused that there were two instances of USB CDC in MCUBoot. Change disables one instance which was added automatically by NCS if MCUBoot bootloader was built as a child image. Jira: NCSDK-18596 Signed-off-by: Mateusz Kapala Signed-off-by: Johann Fischer (cherry picked from commit 778b2a956086de2f6aec01f39651a25e3613cdae) (cherry picked from commit 6799c02cb60196ac26ebc1c1aeee54ca105f8e75) --- boards/arm/thingy53_nrf5340/Kconfig.defconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boards/arm/thingy53_nrf5340/Kconfig.defconfig b/boards/arm/thingy53_nrf5340/Kconfig.defconfig index 708d9a05d51..ee3621aedd5 100644 --- a/boards/arm/thingy53_nrf5340/Kconfig.defconfig +++ b/boards/arm/thingy53_nrf5340/Kconfig.defconfig @@ -135,6 +135,13 @@ endif # LOG endif # BOARD_SERIAL_BACKEND_CDC_ACM +# By default, a USB CDC ACM instance is already enabled in the board's DTS. +# It is not necessary for nRF Connect SDK to add another instance if MCUBoot +# bootloader is built as a child image. +config MCUBOOT_USB_SUPPORT + bool + default n + endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS if BOARD_THINGY53_NRF5340_CPUNET From b923938da11c598ad0c5d0b3a7eeacf3d771a166 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Mon, 28 Nov 2022 15:31:33 +0100 Subject: [PATCH 0691/2300] [nrf noup] boards: thingy53_nrf5340: Enable MCUboot by default Change enables MCUboot bootloader by default to allow programming samples and applications without external programmer (using MCUboot serial recovery). Change also enables network core to prevent build failures when building MCUboot with nRF53 multi image DFU. Jira: NCSDK-18263 Signed-off-by: Marek Pieta Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Johann Fischer Signed-off-by: Joakim Andersson (cherry picked from commit ff85910bf8ed1aac0571bca0e7f206782234efbb) --- boards/arm/thingy53_nrf5340/Kconfig.defconfig | 6 ++++++ boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi | 1 + 2 files changed, 7 insertions(+) diff --git a/boards/arm/thingy53_nrf5340/Kconfig.defconfig b/boards/arm/thingy53_nrf5340/Kconfig.defconfig index ee3621aedd5..45869075487 100644 --- a/boards/arm/thingy53_nrf5340/Kconfig.defconfig +++ b/boards/arm/thingy53_nrf5340/Kconfig.defconfig @@ -8,6 +8,12 @@ if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS config BOARD default "thingy53_nrf5340_cpuapp" +config BOOTLOADER_MCUBOOT + default y if !MCUBOOT + +config BOARD_ENABLE_CPUNET + default y if !MCUBOOT + # Code Partition: # # For the secure version of the board the firmware is linked at the beginning diff --git a/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi b/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi index 694a6960584..54efd588cf7 100644 --- a/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi +++ b/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi @@ -16,6 +16,7 @@ zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,ieee802154 = &ieee802154; + nordic,pm-ext-flash = &mx25r64; }; buttons { From 9377fa01e755a19c0aad584c55d5665e327a2db5 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Wed, 15 Nov 2023 12:55:40 +0100 Subject: [PATCH 0692/2300] [nrf noup] boards: arm: nrf9131ek: enable tfm This patch backports the nrf9131ek to a time before tfm was refactored. To be reverted when TF-M is updated. Signed-off-by: Maximilian Deubel Signed-off-by: Dominik Ermel (cherry picked from commit d0b22f5deb110cbe508a847faf79d4b7add5b4bf) --- boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig b/boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig index 0ece4f9a2ac..378a58fb6e3 100644 --- a/boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig +++ b/boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig @@ -8,6 +8,22 @@ if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS config BOARD default "nrf9131ek_nrf9131" + +# By default, if we build for a Non-Secure version of the board, +# enable building with TF-M as the Secure Execution Environment. +config BUILD_WITH_TFM + default y if BOARD_NRF9131EK_NRF9131_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 + # 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- From ed3f003836262e68e285879f07aff1cc0a13ab88 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Thu, 13 Jul 2023 13:42:10 +0000 Subject: [PATCH 0693/2300] [nrf noup] drivers/flashdisk: Add support for Partition Manager The commits adds support for generating flash disks from Partition Manager defined partitions. Signed-off-by: Dominik Ermel (cherry picked from commit 6fba504e5e4026e1b563013ac6e7858ca73ea260) --- drivers/disk/flashdisk.c | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/drivers/disk/flashdisk.c b/drivers/disk/flashdisk.c index 6336ad4dfd0..3e43716c2b3 100644 --- a/drivers/disk/flashdisk.c +++ b/drivers/disk/flashdisk.c @@ -420,6 +420,8 @@ static const struct disk_operations flash_disk_ops = { .ioctl = disk_flash_access_ioctl, }; +#ifndef USE_PARTITION_MANAGER +/* The non-Partition manager, DTS based generators below */ #define DT_DRV_COMPAT zephyr_flash_disk #define PARTITION_PHANDLE(n) DT_PHANDLE_BY_IDX(DT_DRV_INST(n), partition, 0) @@ -461,6 +463,82 @@ DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY) "Devicetree node " DT_NODE_PATH(DT_DRV_INST(n)) \ " has cache size which is not a multiple of its sector size"); DT_INST_FOREACH_STATUS_OKAY(VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE) +#else /* ifndef USE_PARTITION_MANAGER */ +/* Partition Manager based generators below */ + +/* Gets the PM_..._EXTRA_PARAM_##param value */ +#define PM_FLASH_DISK_ENTRY_EXTRA_PARAM(name, param) PM_##name##_EXTRA_PARAM_disk_##param + +/* Gets the PM_..._NAME value which is originally cased, as in yaml, partition name */ +#define PM_FLASH_DISK_ENTRY_PARTITION_NAME(name) PM_##name##_NAME + +/* Generates flashdiskN_cache variable name, where N is partition ID */ +#define PM_FLASH_DISK_CACHE_VARIABLE(n) UTIL_CAT(flashdisk, UTIL_CAT(FIXED_PARTITION_ID(n), _cache)) + +/* Generate cache buffers */ +#define CACHE_SIZE(n) (COND_CODE_1(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, read_only), (0), (1)) * \ + PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size)) +#define DEFINE_FLASHDISKS_CACHE(n) \ + static uint8_t __aligned(4) PM_FLASH_DISK_CACHE_VARIABLE(n)[CACHE_SIZE(n)]; + +PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE) + +/* Generated single Flash Disk device data from Partition Manager partition. + * Partition is required to have type set to disk in partition definitions: + * type: disk + * and following extra params can be provided: + * extra_params: { + * name = "", + * cache_size = , + * sector_size = , + * read_only = + * } + * where: + * is mandatory device name that will be used by Disk Access and FAT FS to mount device; + * is cache r/w cache size, which is mandatory if read_only = 0 or not present, + * and should be multiple of ; + * is mandatory device sector size information, usually should be erase page size, + * for flash devices, for example 4096 bytes; + * read_only is optional, if not present then assumed false; can be 0(false) or 1(true). + */ +#define DEFINE_FLASHDISKS_DEVICE(n) \ +{ \ + .info = { \ + .ops = &flash_disk_ops, \ + .name = STRINGIFY(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, name)), \ + }, \ + .area_id = FIXED_PARTITION_ID(n), \ + .offset = FIXED_PARTITION_OFFSET(n), \ + .cache = PM_FLASH_DISK_CACHE_VARIABLE(n), \ + .cache_size = sizeof(PM_FLASH_DISK_CACHE_VARIABLE(n)), \ + .size = FIXED_PARTITION_SIZE(n), \ + .sector_size = PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, sector_size), \ +}, + +/* The bellow used PM_FOREACH_TYPE_disk is generated by Partition Manager foreach + * loop macro. The lower case _disk is type name for which the macro has been generated; + * partition entry can have multiple types set and foreach macro will be generated + * for every type found across partition definitions. + */ +static struct flashdisk_data flash_disks[] = { + PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE) +}; + +#define VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY(n) \ + COND_CODE_1(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, read_only), \ + (/* cache-size is not used for read-only disks */), \ + (BUILD_ASSERT(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size) != 0, \ + "Flash disk partition " STRINGIFY(PM_FLASH_DISK_ENTRY_PARTITION_NAME(n))\ + " must have non-zero cache-size");)) +PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY) + +#define VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE(n) \ + BUILD_ASSERT(PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, cache_size) % \ + PM_FLASH_DISK_ENTRY_EXTRA_PARAM(n, sector_size) == 0, \ + "Devicetree node " STRINGIFY(PM_FLASH_DISK_ENTRY_PARTITION_NAME(n)) \ + " has cache size which is not a multiple of its sector size"); +PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_MULTIPLY_OF_SECTOR_SIZE) +#endif /* USE_PARTITION_MANAGER */ static int disk_flash_init(void) { From a7e1fd62df8c7dc3bd0b43404a0470e61fd613d1 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 5 May 2023 11:12:26 +0200 Subject: [PATCH 0694/2300] [nrf noup] mcumgr: img_mgmt: Fix check for chosen code partition The "zephyr-code-partition" chosen DTS node cannot be used when build uses Partition Manager. In that case, mcumgr must rely on the definitions provided by the Partition Manager. Jira: NCSDK-21381 Signed-off-by: Marek Pieta Signed-off-by: Dominik Ermel (cherry picked from commit acd88713225a8bbd89b78b71cba176404cda74c0) --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 300948d5c88..305cad41c44 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -33,6 +33,23 @@ #include #endif +#if USE_PARTITION_MANAGER +#include + +#ifdef PM_MCUBOOT_SECONDARY_PAD_SIZE +BUILD_ASSERT(PM_MCUBOOT_PAD_SIZE == PM_MCUBOOT_SECONDARY_PAD_SIZE); +#endif + +#if CONFIG_BUILD_WITH_TFM + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) +#else + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) +#endif + +#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ + (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET)) + +#else /* ! USE_PARTITION_MANAGER */ #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. @@ -40,6 +57,7 @@ #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ (FIXED_PARTITION_OFFSET(label) == CONFIG_FLASH_LOAD_OFFSET) +#endif /* USE_PARTITION_MANAGER */ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, "struct image_header not required size"); From adbf47ed20949e475a05372e670153027c376d4d Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Thu, 23 Jun 2022 14:10:01 +0000 Subject: [PATCH 0695/2300] [nrf noup] mgmt/mcumgr: Bootutil hooks to handle image-1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The commit adds bootutil hook, for nrf5340, to allow it handling the non-accessible image-1/primary slot. Signed-off-by: Andrzej Głąbek Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Johann Fischer Signed-off-by: Dominik Ermel (cherry picked from commit 041e804add1e154ea95da502842df792e603cda5) --- subsys/mgmt/mcumgr/CMakeLists.txt | 8 ++++++ subsys/mgmt/mcumgr/Kconfig | 1 + .../mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c | 27 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c diff --git a/subsys/mgmt/mcumgr/CMakeLists.txt b/subsys/mgmt/mcumgr/CMakeLists.txt index 39d4a4ca8ce..ad088eca067 100644 --- a/subsys/mgmt/mcumgr/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/CMakeLists.txt @@ -16,3 +16,11 @@ add_subdirectory(transport) add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client) zephyr_library_link_libraries(mgmt_mcumgr) + +if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS) + zephyr_include_directories( + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include + ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include + ) + zephyr_library_sources(bootutil_hooks/nrf53_hooks.c) +endif() diff --git a/subsys/mgmt/mcumgr/Kconfig b/subsys/mgmt/mcumgr/Kconfig index 49bd17f4669..1c6a3a2a516 100644 --- a/subsys/mgmt/mcumgr/Kconfig +++ b/subsys/mgmt/mcumgr/Kconfig @@ -6,6 +6,7 @@ menuconfig MCUMGR bool "mcumgr Support" depends on NET_BUF depends on ZCBOR + imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG) help This option enables the mcumgr management library. diff --git a/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c new file mode 100644 index 00000000000..9971a4e0843 --- /dev/null +++ b/subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include "bootutil/bootutil_public.h" + +int boot_read_swap_state_primary_slot_hook(int image_index, + struct boot_swap_state *state) +{ + if (image_index == 1) { + /* Pretend that primary slot of image 1 unpopulated */ + state->magic = BOOT_MAGIC_UNSET; + state->swap_type = BOOT_SWAP_TYPE_NONE; + state->image_num = image_index; + state->copy_done = BOOT_FLAG_UNSET; + state->image_ok = BOOT_FLAG_UNSET; + + /* Prevent bootutil from trying to obtain true info */ + return 0; + } + + return BOOT_HOOK_REGULAR; +} From 40a0c6ae3fe447a1ead841e9d5d3b5bf819d0f2a Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Thu, 28 Sep 2023 11:10:55 +0000 Subject: [PATCH 0696/2300] [nrf noup] mgmt/MCUmgr/grp/img: Move out label to make compiler happy Move it inside ifdef. Signed-off-by: Dominik Ermel (cherry picked from commit 16d6edb4367f02f14e63706ed22ff6901796ab6f) --- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 c54fbd4d0c6..edfe26e452f 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 @@ -290,13 +290,14 @@ int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type) return_slot = other_slot; } } +out: + #else if (rcs == 0 && rca == 0 && img_mgmt_vercmp(&aver, &over) < 0) { return_slot = other_slot; } #endif /* defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) */ -out: if (type != NULL) { *type = lt; } From 98ba1b4344de77479978d5bbc21e863553b3db15 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Mon, 25 Sep 2023 16:41:15 +0200 Subject: [PATCH 0697/2300] [nrf noup] settings: nvs: use dedicated lookup cache hash function Introduce NVS_LOOKUP_CACHE_FOR_SETTINGS Kconfig option that enables a dedicated hash function for the NVS lookup cache that takes advantage of the NVS ID allocation scheme used by the NVS settings backend. As such, this option should only be used if an application uses NVS via the settings layer. Signed-off-by: Damian Krolik (cherry picked from commit 59c0a7cb2c0dcdeea2794ee389e37a1b0e9da1be) --- subsys/fs/nvs/Kconfig | 9 +++++++++ subsys/fs/nvs/nvs.c | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/subsys/fs/nvs/Kconfig b/subsys/fs/nvs/Kconfig index de4f282ee98..df0329a7c41 100644 --- a/subsys/fs/nvs/Kconfig +++ b/subsys/fs/nvs/Kconfig @@ -27,6 +27,15 @@ config NVS_LOOKUP_CACHE_SIZE Number of entries in Non-volatile Storage lookup cache. It is recommended that it be a power of 2. +config NVS_LOOKUP_CACHE_FOR_SETTINGS + bool "Non-volatile Storage lookup cache optimized for settings" + depends on NVS_LOOKUP_CACHE + help + Use the lookup cache hash function that results in the least number of + collissions and, in turn, the best NVS performance provided that the NVS + is used as the settings backend only. This option should NOT be enabled + if the NVS is also written to directly, outside the settings layer. + module = NVS module-str = nvs source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/fs/nvs/nvs.c b/subsys/fs/nvs/nvs.c index 8c4575700a8..14a4db5e347 100644 --- a/subsys/fs/nvs/nvs.c +++ b/subsys/fs/nvs/nvs.c @@ -13,6 +13,11 @@ #include #include "nvs_priv.h" +#ifdef CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS +#include +#include +#endif + #include LOG_MODULE_REGISTER(fs_nvs, CONFIG_NVS_LOG_LEVEL); @@ -21,6 +26,45 @@ static int nvs_ate_valid(struct nvs_fs *fs, const struct nvs_ate *entry); #ifdef CONFIG_NVS_LOOKUP_CACHE +#ifdef CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS + +static inline size_t nvs_lookup_cache_pos(uint16_t id) +{ + /* + * 1. The NVS settings backend uses up to (NVS_NAME_ID_OFFSET - 1) NVS IDs to + store keys and equal number of NVS IDs to store values. + * 2. For each key-value pair, the value is stored at NVS ID greater by exactly + * NVS_NAME_ID_OFFSET than NVS ID that holds the key. + * 3. The backend tries to minimize the range of NVS IDs used to store keys. + * That is, NVS IDs are allocated sequentially, and freed NVS IDs are reused + * before allocating new ones. + * + * Therefore, to assure the least number of collisions in the lookup cache, + * the least significant bit of the hash indicates whether the given NVS ID + * represents a key or a value, and remaining bits of the hash are set to + * the ordinal number of the key-value pair. Consequently, the hash function + * provides the following mapping: + * + * 1st settings key => hash 0 + * 1st settings value => hash 1 + * 2nd settings key => hash 2 + * 2nd settings value => hash 3 + * ... + */ + BUILD_ASSERT(IS_POWER_OF_TWO(NVS_NAMECNT_ID), "NVS_NAMECNT_ID is not power of 2"); + BUILD_ASSERT(IS_POWER_OF_TWO(NVS_NAME_ID_OFFSET), "NVS_NAME_ID_OFFSET is not power of 2"); + + uint16_t key_value_bit; + uint16_t key_value_ord; + + key_value_bit = (id >> LOG2(NVS_NAME_ID_OFFSET)) & 1; + key_value_ord = id & (NVS_NAME_ID_OFFSET - 1); + + return ((key_value_ord << 1) | key_value_bit) % CONFIG_NVS_LOOKUP_CACHE_SIZE; +} + +#else /* CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS */ + static inline size_t nvs_lookup_cache_pos(uint16_t id) { uint16_t hash; @@ -36,6 +80,8 @@ static inline size_t nvs_lookup_cache_pos(uint16_t id) return hash % CONFIG_NVS_LOOKUP_CACHE_SIZE; } +#endif /* CONFIG_NVS_LOOKUP_CACHE_FOR_SETTINGS */ + static int nvs_lookup_cache_rebuild(struct nvs_fs *fs) { int rc; From c4d28e200a727cd62a550a1244f98fd72c6da915 Mon Sep 17 00:00:00 2001 From: Azizah Ibrahim Date: Wed, 7 Apr 2021 13:03:19 +0100 Subject: [PATCH 0698/2300] [nrf noup] samples: bluetooth: hci_pwr_ctrl: add dynamic control Enable dynamic power control in hci_pwr_ctrl sample for platforms using hci_rpmsg as controller Signed-off-by: Azizah Ibrahim Signed-off-by: Trond Einar Snekvik (cherry picked from commit 5f2514e36a2b5da0fb2a477bb92fec23d88519f2) --- samples/bluetooth/hci_pwr_ctrl/child_image/hci_rpmsg.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 samples/bluetooth/hci_pwr_ctrl/child_image/hci_rpmsg.conf diff --git a/samples/bluetooth/hci_pwr_ctrl/child_image/hci_rpmsg.conf b/samples/bluetooth/hci_pwr_ctrl/child_image/hci_rpmsg.conf new file mode 100644 index 00000000000..e6749ae6399 --- /dev/null +++ b/samples/bluetooth/hci_pwr_ctrl/child_image/hci_rpmsg.conf @@ -0,0 +1 @@ +CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y From 12293c23d28dcf3da77a1c904921a195a2d6c4e7 Mon Sep 17 00:00:00 2001 From: Kamil Piszczek Date: Mon, 20 Jun 2022 10:14:39 +0200 Subject: [PATCH 0699/2300] [nrf noup] samples: mgmt: mcumgr: add hci_rpmsg child image config Added a configuration file for the HCI RPMsg child image that is necessary for multi-core targets. Signed-off-by: Kamil Piszczek (cherry picked from commit 51f1731ef438b20bffa00c56c0fdd19fb8118a1a) --- .../mgmt/mcumgr/smp_svr/child_image/hci_rpmsg.conf | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/child_image/hci_rpmsg.conf diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/child_image/hci_rpmsg.conf b/samples/subsys/mgmt/mcumgr/smp_svr/child_image/hci_rpmsg.conf new file mode 100644 index 00000000000..98260877332 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/child_image/hci_rpmsg.conf @@ -0,0 +1,10 @@ +# +# Copyright (c) 2022 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_BT_MAX_CONN=2 +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=502 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 From 4da81eb8211ad5451ff618275b130b85b1400d51 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 13 Jul 2023 15:32:45 +0200 Subject: [PATCH 0700/2300] [nrf noup] samples: net: Add support for nRF700x Add support for nRF700x to selected networking samples, by providing appropriate overlay configuration files. Signed-off-by: Robert Lubos (cherry picked from commit 0539e2d67b72e5072e5bb04c4cec562c1fab5872) --- .../net/dhcpv4_client/overlay-nrf700x.conf | 14 ++++++++++ samples/net/dns_resolve/overlay-nrf700x.conf | 18 +++++++++++++ .../net/ipv4_autoconf/overlay-nrf700x.conf | 14 ++++++++++ .../net/mdns_responder/overlay-nrf700x.conf | 18 +++++++++++++ .../net/mqtt_publisher/overlay-nrf700x.conf | 19 ++++++++++++++ .../mqtt_sn_publisher/overlay-nrf700x.conf | 20 ++++++++++++++ .../sockets/coap_client/overlay-nrf700x.conf | 16 ++++++++++++ .../sockets/coap_server/overlay-nrf700x.conf | 26 +++++++++++++++++++ samples/net/sockets/echo/overlay-nrf700x.conf | 18 +++++++++++++ .../sockets/echo_async/overlay-nrf700x.conf | 18 +++++++++++++ .../sockets/echo_client/overlay-nrf700x.conf | 20 ++++++++++++++ .../sockets/echo_server/overlay-nrf700x.conf | 20 ++++++++++++++ .../net/sockets/http_get/overlay-nrf700x.conf | 18 +++++++++++++ .../sockets/sntp_client/overlay-nrf700x.conf | 18 +++++++++++++ samples/net/syslog_net/overlay-nrf700x.conf | 18 +++++++++++++ samples/net/telnet/overlay-nrf700x.conf | 18 +++++++++++++ 16 files changed, 293 insertions(+) create mode 100644 samples/net/dhcpv4_client/overlay-nrf700x.conf create mode 100644 samples/net/dns_resolve/overlay-nrf700x.conf create mode 100644 samples/net/ipv4_autoconf/overlay-nrf700x.conf create mode 100644 samples/net/mdns_responder/overlay-nrf700x.conf create mode 100644 samples/net/mqtt_publisher/overlay-nrf700x.conf create mode 100644 samples/net/mqtt_sn_publisher/overlay-nrf700x.conf create mode 100644 samples/net/sockets/coap_client/overlay-nrf700x.conf create mode 100644 samples/net/sockets/coap_server/overlay-nrf700x.conf create mode 100644 samples/net/sockets/echo/overlay-nrf700x.conf create mode 100644 samples/net/sockets/echo_async/overlay-nrf700x.conf create mode 100644 samples/net/sockets/echo_client/overlay-nrf700x.conf create mode 100644 samples/net/sockets/echo_server/overlay-nrf700x.conf create mode 100644 samples/net/sockets/http_get/overlay-nrf700x.conf create mode 100644 samples/net/sockets/sntp_client/overlay-nrf700x.conf create mode 100644 samples/net/syslog_net/overlay-nrf700x.conf create mode 100644 samples/net/telnet/overlay-nrf700x.conf diff --git a/samples/net/dhcpv4_client/overlay-nrf700x.conf b/samples/net/dhcpv4_client/overlay-nrf700x.conf new file mode 100644 index 00000000000..2d552e9c623 --- /dev/null +++ b/samples/net/dhcpv4_client/overlay-nrf700x.conf @@ -0,0 +1,14 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/dns_resolve/overlay-nrf700x.conf b/samples/net/dns_resolve/overlay-nrf700x.conf new file mode 100644 index 00000000000..aa59e5d5ea2 --- /dev/null +++ b/samples/net/dns_resolve/overlay-nrf700x.conf @@ -0,0 +1,18 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/ipv4_autoconf/overlay-nrf700x.conf b/samples/net/ipv4_autoconf/overlay-nrf700x.conf new file mode 100644 index 00000000000..2d552e9c623 --- /dev/null +++ b/samples/net/ipv4_autoconf/overlay-nrf700x.conf @@ -0,0 +1,14 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/mdns_responder/overlay-nrf700x.conf b/samples/net/mdns_responder/overlay-nrf700x.conf new file mode 100644 index 00000000000..aa59e5d5ea2 --- /dev/null +++ b/samples/net/mdns_responder/overlay-nrf700x.conf @@ -0,0 +1,18 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/mqtt_publisher/overlay-nrf700x.conf b/samples/net/mqtt_publisher/overlay-nrf700x.conf new file mode 100644 index 00000000000..a812c7896f6 --- /dev/null +++ b/samples/net/mqtt_publisher/overlay-nrf700x.conf @@ -0,0 +1,19 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_CONFIG_NEED_IPV4=y +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/mqtt_sn_publisher/overlay-nrf700x.conf b/samples/net/mqtt_sn_publisher/overlay-nrf700x.conf new file mode 100644 index 00000000000..cbc47b96572 --- /dev/null +++ b/samples/net/mqtt_sn_publisher/overlay-nrf700x.conf @@ -0,0 +1,20 @@ +CONFIG_POSIX_MAX_FDS=16 + +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/sockets/coap_client/overlay-nrf700x.conf b/samples/net/sockets/coap_client/overlay-nrf700x.conf new file mode 100644 index 00000000000..a0e436e3537 --- /dev/null +++ b/samples/net/sockets/coap_client/overlay-nrf700x.conf @@ -0,0 +1,16 @@ +CONFIG_HEAP_MEM_POOL_SIZE=153000 + +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/sockets/coap_server/overlay-nrf700x.conf b/samples/net/sockets/coap_server/overlay-nrf700x.conf new file mode 100644 index 00000000000..4817a4f73ba --- /dev/null +++ b/samples/net/sockets/coap_server/overlay-nrf700x.conf @@ -0,0 +1,26 @@ +CONFIG_HEAP_MEM_POOL_SIZE=153000 + +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# The sample can run either IPv4 or IPv6, not both +CONFIG_NET_IPV6=n +CONFIG_NET_CONFIG_NEED_IPV6=n +CONFIG_NET_IPV4=y +CONFIG_NET_CONFIG_NEED_IPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/sockets/echo/overlay-nrf700x.conf b/samples/net/sockets/echo/overlay-nrf700x.conf new file mode 100644 index 00000000000..aa59e5d5ea2 --- /dev/null +++ b/samples/net/sockets/echo/overlay-nrf700x.conf @@ -0,0 +1,18 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/sockets/echo_async/overlay-nrf700x.conf b/samples/net/sockets/echo_async/overlay-nrf700x.conf new file mode 100644 index 00000000000..aa59e5d5ea2 --- /dev/null +++ b/samples/net/sockets/echo_async/overlay-nrf700x.conf @@ -0,0 +1,18 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/sockets/echo_client/overlay-nrf700x.conf b/samples/net/sockets/echo_client/overlay-nrf700x.conf new file mode 100644 index 00000000000..cbc47b96572 --- /dev/null +++ b/samples/net/sockets/echo_client/overlay-nrf700x.conf @@ -0,0 +1,20 @@ +CONFIG_POSIX_MAX_FDS=16 + +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/sockets/echo_server/overlay-nrf700x.conf b/samples/net/sockets/echo_server/overlay-nrf700x.conf new file mode 100644 index 00000000000..cbc47b96572 --- /dev/null +++ b/samples/net/sockets/echo_server/overlay-nrf700x.conf @@ -0,0 +1,20 @@ +CONFIG_POSIX_MAX_FDS=16 + +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/sockets/http_get/overlay-nrf700x.conf b/samples/net/sockets/http_get/overlay-nrf700x.conf new file mode 100644 index 00000000000..aa59e5d5ea2 --- /dev/null +++ b/samples/net/sockets/http_get/overlay-nrf700x.conf @@ -0,0 +1,18 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/sockets/sntp_client/overlay-nrf700x.conf b/samples/net/sockets/sntp_client/overlay-nrf700x.conf new file mode 100644 index 00000000000..aa59e5d5ea2 --- /dev/null +++ b/samples/net/sockets/sntp_client/overlay-nrf700x.conf @@ -0,0 +1,18 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/syslog_net/overlay-nrf700x.conf b/samples/net/syslog_net/overlay-nrf700x.conf new file mode 100644 index 00000000000..aa59e5d5ea2 --- /dev/null +++ b/samples/net/syslog_net/overlay-nrf700x.conf @@ -0,0 +1,18 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" diff --git a/samples/net/telnet/overlay-nrf700x.conf b/samples/net/telnet/overlay-nrf700x.conf new file mode 100644 index 00000000000..aa59e5d5ea2 --- /dev/null +++ b/samples/net/telnet/overlay-nrf700x.conf @@ -0,0 +1,18 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WPA_SUPP=y +CONFIG_NET_L2_ETHERNET=y + +# DHCPv4 +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_DHCPV4=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" From a51c44b18ca74427898a79bca83d2c82a83c5d8c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 16 Oct 2023 08:40:38 +0100 Subject: [PATCH 0701/2300] [nrf noup] samples: bluetooth: hci_pow_ctrl: Migrate child image config Migrates child image configuration for this sample over to sysbuild Signed-off-by: Jamie McCrae (cherry picked from commit e806eda100b0d197eeb28be7716a0a4ed974cebf) --- samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf diff --git a/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf b/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf new file mode 100644 index 00000000000..e6749ae6399 --- /dev/null +++ b/samples/bluetooth/hci_pwr_ctrl/sysbuild/hci_rpmsg.conf @@ -0,0 +1 @@ +CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y From a1f4a61d439abbb2dee416ff22343b4e2d12618b Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 16 Oct 2023 08:41:27 +0100 Subject: [PATCH 0702/2300] [nrf noup] samples: mgmt: mcumgr smp_svr: Migrate child image config Migrates child image configuration for this sample over to sysbuild Signed-off-by: Jamie McCrae (cherry picked from commit cb74dbeb3cb753bade9864233eb27bf229298e77) --- .../subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf new file mode 100644 index 00000000000..98260877332 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/hci_rpmsg.conf @@ -0,0 +1,10 @@ +# +# Copyright (c) 2022 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_BT_MAX_CONN=2 +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=502 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 From a9197c94b2291579e818cb1b18e45fb86d7c90d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 1 Dec 2022 14:41:13 +0100 Subject: [PATCH 0703/2300] [nrf noup] samples&tests: Restore a few CONFIG_NEWLIB_LIBC_NANO=n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit 9dd570f8a2207a02c886480b0065cd5a0e3a2e94. Since in NCS, unlike in vanilla Zephyr, the nano variant of newlib is the default one, restore entries that disable the nano variant in one sample and one test that require the full newlib variant. This patch is supposed to be removed when picolibc becomes the default. Signed-off-by: Andrzej Głąbek Signed-off-by: Dominik Ermel (cherry picked from commit 275c2a7e51b4e1038d3052d3411d22aa48949360) --- tests/lib/newlib/heap_listener/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/lib/newlib/heap_listener/prj.conf b/tests/lib/newlib/heap_listener/prj.conf index e5a5dc6df4c..7282777ff1c 100644 --- a/tests/lib/newlib/heap_listener/prj.conf +++ b/tests/lib/newlib/heap_listener/prj.conf @@ -1,3 +1,4 @@ CONFIG_ZTEST=y CONFIG_NEWLIB_LIBC=y +CONFIG_NEWLIB_LIBC_NANO=n CONFIG_NEWLIB_LIBC_HEAP_LISTENER=y From c749f7ab56154c490ad4479e07e038756386b525 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 15 Dec 2023 07:57:14 +0000 Subject: [PATCH 0704/2300] [nrf noup] samples/tests: Disable PM for some sysbuild builds Disables partition manager when building some samples and tests which use sysbuild to prevent build issues Signed-off-by: Jamie McCrae (cherry picked from commit 53f7c555705ef394fbbf154770c6be493c23ded4) --- samples/boards/nrf/nrf53_sync_rtc/sysbuild.conf | 1 + samples/drivers/mbox/sysbuild.conf | 1 + samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf | 1 + samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf | 1 + samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf | 1 + samples/subsys/logging/multidomain/sysbuild.conf | 1 + tests/boot/mcuboot_recovery_retention/sysbuild.conf | 1 + tests/boot/test_mcuboot/sysbuild.conf | 1 + 8 files changed, 8 insertions(+) create mode 100644 samples/boards/nrf/nrf53_sync_rtc/sysbuild.conf create mode 100644 samples/drivers/mbox/sysbuild.conf create mode 100644 samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf create mode 100644 samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf create mode 100644 samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf create mode 100644 samples/subsys/logging/multidomain/sysbuild.conf diff --git a/samples/boards/nrf/nrf53_sync_rtc/sysbuild.conf b/samples/boards/nrf/nrf53_sync_rtc/sysbuild.conf new file mode 100644 index 00000000000..6408669a847 --- /dev/null +++ b/samples/boards/nrf/nrf53_sync_rtc/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/drivers/mbox/sysbuild.conf b/samples/drivers/mbox/sysbuild.conf new file mode 100644 index 00000000000..6408669a847 --- /dev/null +++ b/samples/drivers/mbox/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf b/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf new file mode 100644 index 00000000000..6408669a847 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/icmsg/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf b/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf new file mode 100644 index 00000000000..6408669a847 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf b/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf new file mode 100644 index 00000000000..6408669a847 --- /dev/null +++ b/samples/subsys/ipc/ipc_service/static_vrings/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/samples/subsys/logging/multidomain/sysbuild.conf b/samples/subsys/logging/multidomain/sysbuild.conf new file mode 100644 index 00000000000..6408669a847 --- /dev/null +++ b/samples/subsys/logging/multidomain/sysbuild.conf @@ -0,0 +1 @@ +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/boot/mcuboot_recovery_retention/sysbuild.conf b/tests/boot/mcuboot_recovery_retention/sysbuild.conf index 47f00ff3cff..3b5b3c96380 100644 --- a/tests/boot/mcuboot_recovery_retention/sysbuild.conf +++ b/tests/boot/mcuboot_recovery_retention/sysbuild.conf @@ -1 +1,2 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_PARTITION_MANAGER=n diff --git a/tests/boot/test_mcuboot/sysbuild.conf b/tests/boot/test_mcuboot/sysbuild.conf index 47f00ff3cff..3b5b3c96380 100644 --- a/tests/boot/test_mcuboot/sysbuild.conf +++ b/tests/boot/test_mcuboot/sysbuild.conf @@ -1 +1,2 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_PARTITION_MANAGER=n From d96769facecaba386b642d2c76c92c7694c81da0 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Fri, 19 Jan 2024 15:26:33 +0200 Subject: [PATCH 0705/2300] [nrf noup] samples: lwm2m_client: Add support for nRF91x and nRF700x Add support for nRF91x and nRF700x by providing overlay configuration files. Signed-off-by: Juha Ylinen (cherry picked from commit 6d99243f99bd081acf9865bcaf8f7d35b1293682) --- samples/net/lwm2m_client/overlay-nrf700x.conf | 68 +++++++++++++++++++ samples/net/lwm2m_client/overlay-nrf91x.conf | 53 +++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 samples/net/lwm2m_client/overlay-nrf700x.conf create mode 100644 samples/net/lwm2m_client/overlay-nrf91x.conf diff --git a/samples/net/lwm2m_client/overlay-nrf700x.conf b/samples/net/lwm2m_client/overlay-nrf700x.conf new file mode 100644 index 00000000000..2409886fe42 --- /dev/null +++ b/samples/net/lwm2m_client/overlay-nrf700x.conf @@ -0,0 +1,68 @@ +# General +CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_ENTROPY_GENERATOR=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 + +# Wi-Fi +CONFIG_WIFI=y +CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_MGMT_EXT=y +CONFIG_NRF_WIFI_IF_AUTO_START=n + +# Credentials +CONFIG_WIFI_CREDENTIALS=y +CONFIG_WIFI_CREDENTIALS_STATIC=y +CONFIG_WIFI_CREDENTIALS_STATIC_SSID="" +CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD="" + +# WPA +CONFIG_WPA_SUPP=y +CONFIG_WPA_SUPP_LOG_LEVEL_ERR=y + +CONFIG_NET_NATIVE=y +CONFIG_NET_L2_ETHERNET=y +CONFIG_NET_UDP=y +CONFIG_NET_SOCKETS=y +CONFIG_NET_SOCKETS_OFFLOAD=n +CONFIG_NET_BUF_RX_COUNT=18 +CONFIG_NET_BUF_TX_COUNT=18 +CONFIG_NET_DEFAULT_IF_WIFI=y + +# DNS +CONFIG_DNS_RESOLVER=y + +# DHCPv4 +CONFIG_NET_DHCPV4=y +CONFIG_NET_CONFIG_AUTO_INIT=n +CONFIG_NET_CONFIG_NEED_IPV6=n +CONFIG_NET_CONFIG_NEED_IPV4=n + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Zephyr NET Connection Manager Connectivity layer. +CONFIG_L2_WIFI_CONNECTIVITY=y +CONFIG_L2_WIFI_CONNECTIVITY_AUTO_DOWN=n +CONFIG_L2_WIFI_CONNECTIVITY_AUTO_CONNECT=n + +CONFIG_LWM2M_APP_ID="nrf700x" +CONFIG_LWM2M_APP_SERVER="coaps://leshan.eclipseprojects.io:5684" +CONFIG_LWM2M_DNS_SUPPORT=y + +# Enable DTLS support +CONFIG_LWM2M_DTLS_SUPPORT=y +CONFIG_LWM2M_TLS_SESSION_CACHING=y + +# TLS networking +CONFIG_NET_SOCKETS_ENABLE_DTLS=y +CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=4 +CONFIG_NET_SOCKETS_SOCKOPT_TLS=y + +# nRF Security +CONFIG_NRF_SECURITY=y + +# mbedTLS +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=120000 +CONFIG_MBEDTLS_RSA_C=y diff --git a/samples/net/lwm2m_client/overlay-nrf91x.conf b/samples/net/lwm2m_client/overlay-nrf91x.conf new file mode 100644 index 00000000000..9597791c10e --- /dev/null +++ b/samples/net/lwm2m_client/overlay-nrf91x.conf @@ -0,0 +1,53 @@ +# Configuration file for nRF91x +# This file is merged with prj.conf in the application folder, and options +# set here will take precedence if they are present in both files. + +# General +CONFIG_MAIN_STACK_SIZE=4096 + +CONFIG_NET_SOCKETS=y +CONFIG_NET_NATIVE=y +CONFIG_NET_SOCKETS_OFFLOAD=y + +CONFIG_NET_CONFIG_MY_IPV6_ADDR="" +CONFIG_NET_CONFIG_PEER_IPV6_ADDR="" +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_CONFIG_MY_IPV4_GW="" + +CONFIG_NET_CONFIG_NEED_IPV6=n +CONFIG_NET_CONFIG_NEED_IPV4=n +CONFIG_NET_CONFIG_AUTO_INIT=n + +# Modem related configurations +CONFIG_NRF_MODEM_LIB_NET_IF=y +CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_DOWN=n +CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_CONNECT=n +CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_START=n +CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC=y + +CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=n +CONFIG_NRF_MODEM_LIB_NET_IF_LOG_LEVEL_DBG=n + +# Disable Duplicate Address Detection (DAD) +# due to not being properly implemented for offloaded interfaces. +CONFIG_NET_IPV6_NBR_CACHE=n +CONFIG_NET_IPV6_MLD=n + +# Zephyr NET Connection Manager and Connectivity layer. +CONFIG_NET_CONNECTION_MANAGER=y +CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024 + +CONFIG_LWM2M_APP_ID="nrf91x" +CONFIG_LWM2M_APP_SERVER="coaps://leshan.eclipseprojects.io:5684" +CONFIG_LWM2M_DNS_SUPPORT=y + +## Enable DTLS support +CONFIG_LWM2M_DTLS_SUPPORT=y +CONFIG_LWM2M_TLS_SESSION_CACHING=y +CONFIG_LWM2M_DTLS_CID=y +CONFIG_TLS_CREDENTIALS=y + +## Crypto +CONFIG_OBERON_BACKEND=y +CONFIG_NORDIC_SECURITY_BACKEND=y +CONFIG_MBEDTLS_SHA256_C=y From e23b096e93631cba98704d093717d417a56c1b55 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Mon, 11 Mar 2024 14:35:23 +0100 Subject: [PATCH 0706/2300] [nrf noup] boards: arm: kconfig: ROM_START_OFFSET sets up default for builds with partition manager. Signed-off-by: Mateusz Michalek --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig index 3e47a0bb583..94b0fc7299d 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig @@ -10,7 +10,7 @@ config BT_CTLR default BT config ROM_START_OFFSET - hex + default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP From efbf382d11bde519e7b0fb8f15ee87080271be55 Mon Sep 17 00:00:00 2001 From: Ivan Iushkov Date: Mon, 4 Mar 2024 15:35:01 +0100 Subject: [PATCH 0707/2300] [nrf fromtree] modules: crypto: update tinycrypt revision update tinycrypt revision to fix warnings reported by ubsan Signed-off-by: Ivan Iushkov (cherry picked from commit 8f458bb51f1f3b47fbde4f8730687275dcee8a21) Signed-off-by: Ivan Iushkov --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 1de62a11029..5a5b20a9711 100644 --- a/west.yml +++ b/west.yml @@ -317,7 +317,7 @@ manifest: groups: - debug - name: tinycrypt - revision: 3e9a49d2672ec01435ffbf0d788db6d95ef28de0 + revision: 1012a3ebee18c15ede5efc8332ee2fc37817670f path: modules/crypto/tinycrypt groups: - crypto From daefd697e55896e075fd75c5e8c8e79c439b87b5 Mon Sep 17 00:00:00 2001 From: Ivan Iushkov Date: Thu, 7 Mar 2024 10:10:02 +0100 Subject: [PATCH 0708/2300] [nrf fromtree] Bluetooth: add missing initilization of sync_info member During manual testing with UBSAN enabled, it was found that bt_le_per_adv_sync_cb synced() callback in application sometimes gets unexpected different values in `sync_info.recv_enabled` field. The UBSAN output contained the following warnings message: runtime error: load of value 65, which is not a valid value for type '_Bool' It tunrned out that struct bt_le_per_adv_sync_synced_info sync_info inside bt_hci_le_past_received_common() contains uninitialized recv_enabled member. Set it to true by default to avoid possible issues. Signed-off-by: Ivan Iushkov (cherry picked from commit 76050859d41d031b78b737ef41640e1fb77f686a) Signed-off-by: Ivan Iushkov --- subsys/bluetooth/host/scan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index 0b61305e2c3..ceb4fd2428e 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -1246,6 +1246,7 @@ static void bt_hci_le_past_received_common(struct net_buf *buf) sync_info.addr = &per_adv_sync->addr; sync_info.sid = per_adv_sync->sid; sync_info.service_data = sys_le16_to_cpu(evt->service_data); + sync_info.recv_enabled = true; #if defined(CONFIG_BT_PER_ADV_SYNC_RSP) sync_info.num_subevents = per_adv_sync->num_subevents; From aa2eeb1a34df2d9abcdb46c9b85aafbf8fbc768f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Battrel?= Date: Thu, 7 Mar 2024 16:04:25 +0100 Subject: [PATCH 0709/2300] [nrf fromtree] Bluetooth: Shell: Add support for EAD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add new commands to manage the Encrypted Advertising Data feature. Overview of those new commands: - `bt encrypted-ad set-keys`: set key materials (session key and initialisation vector) used for encrypted and decryption of EAD; - `bt encrypted-ad add-ad`: store a given advertising data structure; - `bt encrypted-ad add-ead`: encrypt the given advertising data structres and store the generated AD structure; - `bt encrypted-ad commit-ad`: set the AD of the selected advertiser with the stored AD; - `bt encrypted-ad clear-ad`: remove all stored AD; - `bt encrypted-ad decrypt-scan`: decrypt data using the previously set key materials when receiving AD with type `0x31`. The documentation of the Bluetooth Shell has been updated to include those new commands. Signed-off-by: Théo Battrel (cherry picked from commit 4a55bc00f01eddcd723eb4670b74ced8da30791e) --- .../bluetooth/bluetooth-shell.rst | 84 +++++ subsys/bluetooth/shell/bt.c | 340 ++++++++++++++++++ tests/bluetooth/shell/prj.conf | 2 + 3 files changed, 426 insertions(+) diff --git a/doc/connectivity/bluetooth/bluetooth-shell.rst b/doc/connectivity/bluetooth/bluetooth-shell.rst index f639cb0b030..2b38f4c7b6f 100644 --- a/doc/connectivity/bluetooth/bluetooth-shell.rst +++ b/doc/connectivity/bluetooth/bluetooth-shell.rst @@ -228,6 +228,90 @@ Let's now have a look at some extended advertising features. To enable extended 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 ****************** diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index ac1d78c44df..3566e0f31b8 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -216,6 +217,30 @@ static struct bt_scan_filter { static const char scan_response_label[] = "[DEVICE]: "; static bool scan_verbose_output; +#if defined(CONFIG_BT_EAD) +static uint8_t bt_shell_ead_session_key[BT_EAD_KEY_SIZE] = {0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, + 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, + 0xCC, 0xCD, 0xCE, 0xCF}; +static uint8_t bt_shell_ead_iv[BT_EAD_IV_SIZE] = {0xFB, 0x56, 0xE1, 0xDA, 0xDC, 0x7E, 0xAD, 0xF5}; + +/* this is the number of ad struct allowed */ +#define BT_SHELL_EAD_MAX_AD 10 +static size_t bt_shell_ead_ad_len; + +#if defined(CONFIG_BT_CTLR_ADV_DATA_LEN_MAX) +/* this is the maximum total size of the ad data */ +#define BT_SHELL_EAD_DATA_MAX_SIZE CONFIG_BT_CTLR_ADV_DATA_LEN_MAX +#else +#define BT_SHELL_EAD_DATA_MAX_SIZE 31 +#endif +static size_t bt_shell_ead_data_size; +static uint8_t bt_shell_ead_data[BT_SHELL_EAD_DATA_MAX_SIZE] = {0}; + +int ead_update_ad(void); +#endif + +static bool bt_shell_ead_decrypt_scan; + /** * @brief Compares two strings without case sensitivy * @@ -385,6 +410,36 @@ static bool data_verbose_cb(struct bt_data *data, void *user_data) case BT_DATA_CSIS_RSI: print_data_set(3, data->data, data->data_len); break; + case BT_DATA_ENCRYPTED_AD_DATA: + shell_fprintf(ctx_shell, SHELL_INFO, "Encrypted Advertising Data: "); + print_data_set(1, data->data, data->data_len); + + if (bt_shell_ead_decrypt_scan) { +#if defined(CONFIG_BT_EAD) + shell_fprintf(ctx_shell, SHELL_INFO, "\n%*s[START DECRYPTED DATA]\n", + strlen(scan_response_label), ""); + + int ead_err; + struct net_buf_simple decrypted_buf; + size_t decrypted_data_size = BT_EAD_DECRYPTED_PAYLOAD_SIZE(data->data_len); + uint8_t decrypted_data[decrypted_data_size]; + + ead_err = bt_ead_decrypt(bt_shell_ead_session_key, bt_shell_ead_iv, + data->data, data->data_len, decrypted_data); + if (ead_err) { + shell_error(ctx_shell, "Error during decryption (err %d)", ead_err); + } + + net_buf_simple_init_with_data(&decrypted_buf, &decrypted_data[0], + decrypted_data_size); + + bt_data_parse(&decrypted_buf, &data_verbose_cb, user_data); + + shell_fprintf(ctx_shell, SHELL_INFO, "%*s[END DECRYPTED DATA]", + strlen(scan_response_label), ""); +#endif + } + break; default: print_data_set(1, data->data, data->data_len); } @@ -574,6 +629,13 @@ static bool adv_rpa_expired(struct bt_le_ext_adv *adv) adv_index, adv, keep_rpa ? "not expired" : "expired"); +#if defined(CONFIG_BT_EAD) + /* EAD must be updated each time the RPA is updated */ + if (!keep_rpa) { + ead_update_ad(); + } +#endif + return keep_rpa; } #endif /* defined(CONFIG_BT_PRIVACY) */ @@ -4111,6 +4173,267 @@ static int cmd_auth_oob_tk(const struct shell *sh, size_t argc, char *argv[]) #endif /* !defined(CONFIG_BT_SMP_SC_PAIR_ONLY) */ #endif /* CONFIG_BT_SMP) || CONFIG_BT_BREDR */ +#if defined(CONFIG_BT_EAD) +static int cmd_encrypted_ad_set_keys(const struct shell *sh, size_t argc, char *argv[]) +{ + size_t len; + + const char *session_key = argv[1]; + const char *iv = argv[2]; + + len = hex2bin(session_key, strlen(session_key), bt_shell_ead_session_key, BT_EAD_KEY_SIZE); + if (len != BT_EAD_KEY_SIZE) { + shell_error(sh, "Failed to set session key"); + return -ENOEXEC; + } + + len = hex2bin(iv, strlen(iv), bt_shell_ead_iv, BT_EAD_IV_SIZE); + if (len != BT_EAD_IV_SIZE) { + shell_error(sh, "Failed to set initialisation vector"); + return -ENOEXEC; + } + + shell_info(sh, "session key set to:"); + shell_hexdump(sh, bt_shell_ead_session_key, BT_EAD_KEY_SIZE); + shell_info(sh, "initialisation vector set to:"); + shell_hexdump(sh, bt_shell_ead_iv, BT_EAD_IV_SIZE); + + return 0; +} + +int encrypted_ad_store_ad(const struct shell *sh, uint8_t type, const uint8_t *data, + uint8_t data_len) +{ + /* data_len is the size of the data, add two bytes for the size of the type + * and the length that will be stored with the data + */ + uint8_t new_data_size = data_len + 2; + + if (bt_shell_ead_data_size + new_data_size > BT_SHELL_EAD_DATA_MAX_SIZE) { + shell_error(sh, "Failed to add data (trying to add %d but %d already used on %d)", + new_data_size, bt_shell_ead_data_size, BT_SHELL_EAD_DATA_MAX_SIZE); + return -ENOEXEC; + } + + /* the length is the size of the data + the size of the type */ + bt_shell_ead_data[bt_shell_ead_data_size] = data_len + 1; + bt_shell_ead_data[bt_shell_ead_data_size + 1] = type; + memcpy(&bt_shell_ead_data[bt_shell_ead_data_size + 2], data, data_len); + + bt_shell_ead_data_size += new_data_size; + bt_shell_ead_ad_len += 1; + + return 0; +} + +bool is_payload_valid_ad(uint8_t *payload, size_t payload_size) +{ + size_t idx = 0; + bool is_valid = true; + + uint8_t ad_len; + + while (idx < payload_size) { + ad_len = payload[idx]; + + if (payload_size <= ad_len) { + is_valid = false; + break; + } + + idx += ad_len + 1; + } + + if (idx != payload_size) { + is_valid = false; + } + + return is_valid; +} + +static int cmd_encrypted_ad_add_ead(const struct shell *sh, size_t argc, char *argv[]) +{ + size_t len; + + char *hex_payload = argv[1]; + size_t hex_payload_size = strlen(hex_payload); + + uint8_t payload[BT_SHELL_EAD_DATA_MAX_SIZE] = {0}; + uint8_t payload_size = hex_payload_size / 2 + hex_payload_size % 2; + + uint8_t ead_size = BT_EAD_ENCRYPTED_PAYLOAD_SIZE(payload_size); + + if (ead_size > BT_SHELL_EAD_DATA_MAX_SIZE) { + shell_error(sh, + "Failed to add data. Maximum AD size is %d, passed data size after " + "encryption is %d", + BT_SHELL_EAD_DATA_MAX_SIZE, ead_size); + return -ENOEXEC; + } + + len = hex2bin(hex_payload, hex_payload_size, payload, BT_SHELL_EAD_DATA_MAX_SIZE); + if (len != payload_size) { + shell_error(sh, "Failed to add data"); + return -ENOEXEC; + } + + /* check that the given advertising data structures are valid before encrypting them */ + if (!is_payload_valid_ad(payload, payload_size)) { + shell_error(sh, "Failed to add data. Advertising structure are malformed."); + return -ENOEXEC; + } + + /* store not-yet encrypted AD but claim the expected size of encrypted AD */ + return encrypted_ad_store_ad(sh, BT_DATA_ENCRYPTED_AD_DATA, payload, ead_size); +} + +static int cmd_encrypted_ad_add_ad(const struct shell *sh, size_t argc, char *argv[]) +{ + size_t len; + uint8_t ad_len; + uint8_t ad_type; + + char *hex_payload = argv[1]; + size_t hex_payload_size = strlen(hex_payload); + + uint8_t payload[BT_SHELL_EAD_DATA_MAX_SIZE] = {0}; + uint8_t payload_size = hex_payload_size / 2 + hex_payload_size % 2; + + len = hex2bin(hex_payload, hex_payload_size, payload, BT_SHELL_EAD_DATA_MAX_SIZE); + if (len != payload_size) { + shell_error(sh, "Failed to add data"); + return -ENOEXEC; + } + + /* the length received is the length of ad data + the length of the data + * type but `bt_data` struct `data_len` field is only the size of the + * data + */ + ad_len = payload[0] - 1; + ad_type = payload[1]; + + /* if the ad data is malformed or there is more than 1 ad data passed we + * fail + */ + if (len != ad_len + 2) { + shell_error(sh, + "Failed to add data. Data need to be formated as specified in the " + "Core Spec. Only one non-encrypted AD payload can be added at a time."); + return -ENOEXEC; + } + + return encrypted_ad_store_ad(sh, ad_type, payload, payload_size); +} + +static int cmd_encrypted_ad_clear_ad(const struct shell *sh, size_t argc, char *argv[]) +{ + memset(bt_shell_ead_data, 0, BT_SHELL_EAD_DATA_MAX_SIZE); + + bt_shell_ead_ad_len = 0; + bt_shell_ead_data_size = 0; + + shell_info(sh, "Advertising data has been cleared."); + + return 0; +} + +int ead_encrypt_ad(const uint8_t *payload, uint8_t payload_size, uint8_t *encrypted_payload) +{ + int err; + + err = bt_ead_encrypt(bt_shell_ead_session_key, bt_shell_ead_iv, payload, payload_size, + encrypted_payload); + if (err != 0) { + shell_error(ctx_shell, "Failed to encrypt AD."); + return -1; + } + + return 0; +} + +int ead_update_ad(void) +{ + int err; + size_t idx = 0; + struct bt_le_ext_adv *adv = adv_sets[selected_adv]; + + struct bt_data *ad; + size_t ad_structs_idx = 0; + struct bt_data ad_structs[BT_SHELL_EAD_MAX_AD] = {0}; + + size_t encrypted_data_buf_len = 0; + uint8_t encrypted_data_buf[BT_SHELL_EAD_DATA_MAX_SIZE] = {0}; + + while (idx < bt_shell_ead_data_size && ad_structs_idx < BT_SHELL_EAD_MAX_AD) { + ad = &ad_structs[ad_structs_idx]; + + /* the data_len from bt_data struct doesn't include the size of the type */ + ad->data_len = bt_shell_ead_data[idx] - 1; + + if (ad->data_len < 0) { + /* if the len is less than 0 that mean there is not even a type field */ + shell_error(ctx_shell, "Failed to update AD due to malformed AD."); + return -ENOEXEC; + } + + ad->type = bt_shell_ead_data[idx + 1]; + + if (ad->data_len > 0) { + if (ad->type == BT_DATA_ENCRYPTED_AD_DATA) { + /* for EAD the size used to store the non-encrypted data + * is the size of those data when encrypted + */ + ead_encrypt_ad(&bt_shell_ead_data[idx + 2], + BT_EAD_DECRYPTED_PAYLOAD_SIZE(ad->data_len), + &encrypted_data_buf[encrypted_data_buf_len]); + + ad->data = &encrypted_data_buf[encrypted_data_buf_len]; + encrypted_data_buf_len += ad->data_len; + } else { + ad->data = &bt_shell_ead_data[idx + 2]; + } + } + + ad_structs_idx += 1; + idx += ad->data_len + 2; + } + + err = bt_le_ext_adv_set_data(adv, ad_structs, bt_shell_ead_ad_len, NULL, 0); + if (err != 0) { + shell_error(ctx_shell, "Failed to set advertising data (err %d)", err); + return -ENOEXEC; + } + + shell_info(ctx_shell, "Advertising data for Advertiser[%d] %p updated.", selected_adv, adv); + + return 0; +} + +static int cmd_encrypted_ad_commit_ad(const struct shell *sh, size_t argc, char *argv[]) +{ + return ead_update_ad(); +} + +static int cmd_encrypted_ad_decrypt_scan(const struct shell *sh, size_t argc, char *argv[]) +{ + const char *action = argv[1]; + + if (strcmp(action, "on") == 0) { + bt_shell_ead_decrypt_scan = true; + shell_info(sh, "Received encrypted advertising data will now be decrypted using " + "provided key materials."); + } else if (strcmp(action, "off") == 0) { + bt_shell_ead_decrypt_scan = false; + shell_info(sh, "Received encrypted advertising data will now longer be decrypted."); + } else { + shell_error(sh, "Invalid option."); + return -ENOEXEC; + } + + return 0; +} +#endif + static int cmd_default_handler(const struct shell *sh, size_t argc, char **argv) { if (argc == 1) { @@ -4158,6 +4481,19 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_scan_filter_clear_cmds, ); #endif /* CONFIG_BT_OBSERVER */ +#if defined(CONFIG_BT_EAD) +SHELL_STATIC_SUBCMD_SET_CREATE( + bt_encrypted_ad_cmds, + SHELL_CMD_ARG(set-keys, NULL, " ", cmd_encrypted_ad_set_keys, 3, + 0), + SHELL_CMD_ARG(add-ead, NULL, "", cmd_encrypted_ad_add_ead, 2, 0), + SHELL_CMD_ARG(add-ad, NULL, "", cmd_encrypted_ad_add_ad, 2, 0), + SHELL_CMD(clear-ad, NULL, HELP_NONE, cmd_encrypted_ad_clear_ad), + SHELL_CMD(commit-ad, NULL, HELP_NONE, cmd_encrypted_ad_commit_ad), + SHELL_CMD_ARG(decrypt-scan, NULL, HELP_ONOFF, cmd_encrypted_ad_decrypt_scan, 2, 0), + SHELL_SUBCMD_SET_END); +#endif + SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, SHELL_CMD_ARG(init, NULL, "[no-settings-load], [sync]", cmd_init, 1, 2), @@ -4246,6 +4582,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, cmd_per_adv_sync_delete, 1, 1), SHELL_CMD_ARG(per-adv-sync-select, NULL, "[adv]", cmd_per_adv_sync_select, 1, 1), #endif /* defined(CONFIG_BT_PER_ADV_SYNC) */ +#if defined(CONFIG_BT_EAD) + SHELL_CMD(encrypted-ad, &bt_encrypted_ad_cmds, "Manage advertiser with encrypted data", + cmd_default_handler), +#endif /* CONFIG_BT_EAD */ #if defined(CONFIG_BT_CONN) #if defined(CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER) SHELL_CMD_ARG(past-subscribe, NULL, "[conn] [skip ] " diff --git a/tests/bluetooth/shell/prj.conf b/tests/bluetooth/shell/prj.conf index 168ccf62a7f..185167de1d1 100644 --- a/tests/bluetooth/shell/prj.conf +++ b/tests/bluetooth/shell/prj.conf @@ -46,6 +46,8 @@ CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_USER_DATA_LEN_UPDATE=y CONFIG_BT_AUTO_DATA_LEN_UPDATE=y +CONFIG_BT_EAD=y + CONFIG_BT_USER_PHY_UPDATE=y CONFIG_BT_AUTO_PHY_UPDATE=y From e9136301ebee6633b91ac35d21662b36c027e2eb Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Thu, 1 Feb 2024 14:42:56 +0100 Subject: [PATCH 0710/2300] [nrf fromtree] modules: hal_nordic: nrfx_glue add missing code for nrf_802154 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For use nRF 802.15.4 Radio Driver on nRF54L series there is necessary update for nrfx_glue.h file. It follows the pattern used for other nRF family members. Signed-off-by: Andrzej Kuroś (cherry picked from commit ed55e4abd6a092e22f41c22ee7bdc2bed9de511f) --- modules/hal_nordic/nrfx/nrfx_glue.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/hal_nordic/nrfx/nrfx_glue.h b/modules/hal_nordic/nrfx/nrfx_glue.h index 0edda440112..748c5eafd47 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.h +++ b/modules/hal_nordic/nrfx/nrfx_glue.h @@ -364,6 +364,10 @@ void nrfx_busy_wait(uint32_t usec_to_wait); #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 #else #error Unsupported chip family #endif From 869cf57a5f72df5e2974d8c87e2b7d4079bdb68e Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Mon, 5 Feb 2024 12:13:10 +0100 Subject: [PATCH 0711/2300] [nrf fromtree] drivers: ieee802154_nrf5: Use Radio IRQ number from DT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Used RADIO_IRQ number is based on information provided by DT rather than direct use of RADIO_IRQn. Signed-off-by: Andrzej Kuroś (cherry picked from commit 8e8d4af6c1b3edeb45cc4297a84264a99527b29e) --- drivers/ieee802154/ieee802154_nrf5.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 80435f06fba..cbf16c4f534 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -738,9 +738,8 @@ static void nrf5_irq_config(const struct device *dev) ARG_UNUSED(dev); #if !IS_ENABLED(CONFIG_IEEE802154_NRF5_EXT_IRQ_MGMT) - IRQ_CONNECT(RADIO_IRQn, NRF_802154_IRQ_PRIORITY, - nrf5_radio_irq, NULL, 0); - irq_enable(RADIO_IRQn); + IRQ_CONNECT(DT_IRQN(DT_NODELABEL(radio)), NRF_802154_IRQ_PRIORITY, nrf5_radio_irq, NULL, 0); + irq_enable(DT_IRQN(DT_NODELABEL(radio))); #endif } From cddd22498a8323a6c35f7f378bd907bdff070b2d Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Thu, 1 Feb 2024 14:42:27 +0100 Subject: [PATCH 0712/2300] [nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add ieee802154 status okay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set status = "okay" for ieee802154 device tree node to allow use of ieee802154 on the nrf54l15pdk_nrf54l15_cpuapp board. Signed-off-by: Andrzej Kuroś (cherry picked from commit 32da903ef8f079185b849c7c7c4f434f21453f53) --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index 9876e3996e8..c009f0bd544 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -129,6 +129,10 @@ status = "okay"; }; +&ieee802154 { + status = "okay"; +}; + &rram0 { partitions { compatible = "fixed-partitions"; From 3abe0f7f364787d02cabdaa5e3445d2e85febe57 Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Tue, 6 Feb 2024 14:41:35 +0100 Subject: [PATCH 0713/2300] [nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add temp status okay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set status = "okay" for temp device tree node to allow use of nRF 802.15.4 Radio Driver on the nrf54l15pdk_nrf54l15_cpuapp board. Signed-off-by: Andrzej Kuroś (cherry picked from commit 306d6c2290f5f86bf176e1dbe7036c0b19f27dd3) --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index c009f0bd544..c801ddc8dc5 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -133,6 +133,10 @@ status = "okay"; }; +&temp { + status = "okay"; +}; + &rram0 { partitions { compatible = "fixed-partitions"; From ecb16c791d10fdab4a41bd3dc790610dff5e9520 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 4 Mar 2024 13:24:11 +0100 Subject: [PATCH 0714/2300] [nrf noup] modules: mbedtls: Add PSA_WANT_ALG_SP800_108_COUNTER_XXX !fixup [nrf noup] modules: mbedtls: add PSA configurations Adding PSA_WANT_ALG_SP800_108_COUNTER_HMAC/CMAC that is part of PSA crypto spec 1.2 Signed-off-by: Markus Swarowsky --- modules/mbedtls/Kconfig.psa | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa index b4d72801300..f3353f9d011 100644 --- a/modules/mbedtls/Kconfig.psa +++ b/modules/mbedtls/Kconfig.psa @@ -572,6 +572,16 @@ config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 prompt "PSA PBKDF2-AES-CMAC-PRF-128 support" if !PSA_PROMPTLESS depends on PSA_WANT_ALG_CMAC +config PSA_WANT_ALG_SP800_108_COUNTER_HMAC + bool + prompt "Add PSA SP800-108r1 CTR HMAC KBKDF support" + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_SP800_108_COUNTER_CMAC + bool + prompt "Add PSA SP800-108r1 CTR CMAC KBKDF support" + depends on PSA_WANT_ALG_CMAC + config PSA_WANT_ALG_TLS12_PRF bool prompt "PSA PRF support (TLS1.2)" if !PSA_PROMPTLESS From 920b9fc774eb4490c23a0570a943866633b01d7d Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Thu, 29 Feb 2024 13:36:08 +0100 Subject: [PATCH 0715/2300] [nrf noup] modules: mbedtls: PSA: Add PSA_HAS_PAKE_SUPPORT !fixup [nrf noup] modules: mbedtls: add PSA configurations Add a Kconfig to collect all the PAKE algorithms. noup as this Kconfig file doesn't exist in upstream zephyr Ref: NCSDK-22416 Signed-off-by: Markus Swarowsky --- modules/mbedtls/Kconfig.psa | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa index f3353f9d011..bbd60a9e8d8 100644 --- a/modules/mbedtls/Kconfig.psa +++ b/modules/mbedtls/Kconfig.psa @@ -844,6 +844,17 @@ config PSA_WANT_ALG_SRP_PASSWORD_HASH prompt "PSA SRP password hash support" if !PSA_PROMPTLESS select EXPERIMENTAL +config PSA_HAS_PAKE_SUPPORT + bool + default y + depends on PSA_WANT_ALG_JPAKE || \ + PSA_WANT_ALG_SPAKE2P_HMAC || \ + PSA_WANT_ALG_SPAKE2P_CMAC || \ + PSA_WANT_ALG_SPAKE2P_MATTER || \ + PSA_WANT_ALG_SRP_6 || \ + PSA_WANT_ALG_SRP_PASSWORD_HASH + help + Prompt-less configuration that states that PAKE is supported. config PSA_WANT_ALG_PURE_EDDSA bool From b8f9cb9f9f4a7759e31ec0399b731258e9583a7a Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Thu, 29 Feb 2024 13:38:48 +0100 Subject: [PATCH 0716/2300] [nrf noup] modules: tfm: Add Kconfig for CRYPTO_PAKE_MODULE_ENABLED Add a Kconfig for th TFM_CRYPTO_PAKE_MODULE_ENABLED to support the PAKE APIs. noup as the PAKE support including the PAKE module doesn't exist yet in upstream TF-M as they depend on mbed TLS support for it Ref: NCSDK-22416 Signed-off-by: Markus Swarowsky --- modules/trusted-firmware-m/Kconfig.tfm.crypto_modules | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules index 02d3580c22f..9604319ca01 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules +++ b/modules/trusted-firmware-m/Kconfig.tfm.crypto_modules @@ -88,6 +88,17 @@ config TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED is not used. Note that key agreement is under key derivation in the current implementation. +config TFM_CRYPTO_PAKE_MODULE_ENABLED + bool "PAKE crypto module" + default y + depends on PSA_HAS_PAKE_SUPPORT + depends on NRF_SECURITY + depends on PSA_CRYPTO_DRIVER_OBERON || PSA_CRYPTO_DRIVER_CRACEN + help + Enables the PAKE crypto module within the crypto partition. + Unset this option if the functionality provided by 'crypto_pake.c' + is not used. + endif # TFM_PARTITION_CRYPTO endif # BUILD_WITH_TFM From 80d711560b74105b169c64da29d6099f198c7847 Mon Sep 17 00:00:00 2001 From: Guojun Wang Date: Tue, 19 Mar 2024 11:08:23 +0100 Subject: [PATCH 0717/2300] [nrf noup] test-spec: introduce specific ble-sample label Add CI-ble-samples-test label and test spec for ble sample CI. It has different test scope than BLE CI Signed-off-by: Guojun Wang --- .github/test-spec.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index d9dcf1280f1..a4776a433f3 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -68,6 +68,20 @@ - "!include/zephyr/bluetooth/mesh/**/*" - "samples/bluetooth/hci_rpc/**/*" +"CI-ble-samples-test": + - any: + - "drivers/bluetooth/**/*" + - any: + - "dts/arm/nordic/nrf5*" + - any: + - "subsys/bluetooth/**/*" + - "!subsys/bluetooth/mesh/**/*" + - "!subsys/bluetooth/audio/**/*" + - any: + - "include/zephyr/bluetooth/**/*" + - "!include/zephyr/bluetooth/mesh/**/*" + - "samples/bluetooth/**/*" + "CI-mesh-test": - "subsys/bluetooth/mesh/**/*" - "include/zephyr/bluetooth/mesh/**/*" From 78c194bb204eea873a29a9317f81fa081cfbabf1 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Tue, 19 Mar 2024 09:39:06 +0100 Subject: [PATCH 0718/2300] [nrf fromlist] dts: arm: nordic: nrf54l15 write block size write-block-size correction. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70412 Signed-off-by: Mateusz Michalek --- dts/arm/nordic/nrf54l_common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index 3214daeac84..c537554b05b 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -18,7 +18,7 @@ rram0: rram@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; - write-block-size = <1>; + write-block-size = <16>; }; }; }; From 6728aa6c7248173a5d5b05a8e26035246a537af6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:19 +0100 Subject: [PATCH 0719/2300] Revert "[nrf fromlist] dts: arm: nordic: nrf54l15 write block size" This reverts commit 78c194bb204eea873a29a9317f81fa081cfbabf1. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54l_common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index c537554b05b..3214daeac84 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -18,7 +18,7 @@ rram0: rram@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; - write-block-size = <16>; + write-block-size = <1>; }; }; }; From c0d125099c2adc58e94aab377323526a28839457 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:20 +0100 Subject: [PATCH 0720/2300] Revert "[nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add temp status okay" This reverts commit 3abe0f7f364787d02cabdaa5e3445d2e85febe57. Signed-off-by: Robert Lubos --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index c801ddc8dc5..c009f0bd544 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -133,10 +133,6 @@ status = "okay"; }; -&temp { - status = "okay"; -}; - &rram0 { partitions { compatible = "fixed-partitions"; From f307e917f26e6a7bc7408c50c89a961da3a552ef Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:20 +0100 Subject: [PATCH 0721/2300] Revert "[nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add ieee802154 status okay" This reverts commit cddd22498a8323a6c35f7f378bd907bdff070b2d. Signed-off-by: Robert Lubos --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index c009f0bd544..9876e3996e8 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -129,10 +129,6 @@ status = "okay"; }; -&ieee802154 { - status = "okay"; -}; - &rram0 { partitions { compatible = "fixed-partitions"; From 5293eca1f0692b915ed81d8750a12ac1ba2f8e19 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:20 +0100 Subject: [PATCH 0722/2300] Revert "[nrf noup] boards: arm: kconfig: ROM_START_OFFSET" This reverts commit e23b096e93631cba98704d093717d417a56c1b55. Signed-off-by: Robert Lubos --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig index 94b0fc7299d..3e47a0bb583 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig @@ -10,7 +10,7 @@ config BT_CTLR default BT config ROM_START_OFFSET - default 0 if PARTITION_MANAGER_ENABLED + hex default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP From 45c619d71df5884370ab5ab29464ffd25065ff59 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:20 +0100 Subject: [PATCH 0723/2300] Revert "[nrf noup] Bluetooth: Mesh: Fix adv randomness bug" This reverts commit c202d38d216500057134a36bb6637dfaeb139440. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/adv_ext.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 2df2cbb4597..a80a47760ea 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -511,10 +511,8 @@ int bt_mesh_adv_enable(void) return err; } - if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && - IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && - advs[i].tags == BT_MESH_ADV_TAG_BIT_FRIEND) { - err = set_adv_randomness(advs[i].instance->handle, 0); + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { + err = set_adv_randomness(adv->instance->handle, 0); if (err) { LOG_ERR("Failed to set zero randomness: %d", err); } From 95915c21b595536fe9a5c12e6570085f8245b8da Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:20 +0100 Subject: [PATCH 0724/2300] Revert "[nrf noup] dts: choose a crypto accelerator for entropy" This reverts commit 4fa3cc9657abf7334c4e44257c57684db65a1b3f. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf52840.dtsi | 4 ++-- dts/arm/nordic/nrf5340_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf54l_common.dtsi | 6 ------ dts/arm/nordic/nrf91.dtsi | 3 +-- soc/common/nordic_nrf/Kconfig.peripherals | 6 ++---- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 8efe49a3c91..20c18cf3d84 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -5,7 +5,7 @@ / { chosen { - zephyr,entropy = &cryptocell; + zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -547,7 +547,7 @@ reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index d48f0ce62dc..e40f6241d91 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -33,7 +33,7 @@ }; chosen { - zephyr,entropy = &cryptocell; + zephyr,entropy = &rng_hci; zephyr,flash-controller = &flash_controller; }; @@ -102,7 +102,7 @@ reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index 3214daeac84..415f2471174 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -25,12 +25,6 @@ chosen { zephyr,flash-controller = &rram_controller; - zephyr,entropy = &psa_rng; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; }; sw_pwm: sw-pwm { diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index e65ce04a004..66c80c73a44 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -28,7 +28,6 @@ }; chosen { - zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -52,7 +51,7 @@ reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; ctrlap: ctrlap@50006000 { diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index a6b62428626..ca24384cf8e 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -13,12 +13,10 @@ config HAS_HW_NRF_BPROT def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_BPROT)) config HAS_HW_NRF_CC310 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) || \ - ($(dt_nodelabel_enabled,psa_rng) && SOC_SERIES_NRF91X) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) config HAS_HW_NRF_CC312 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) || \ - ($(dt_nodelabel_enabled,psa_rng) && SOC_NRF5340_CPUAPP) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) config HAS_HW_NRF_CCM def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_CCM)) From a5acb94064e9c8c3438f82122ca28b72c0c63394 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:20 +0100 Subject: [PATCH 0725/2300] Revert "[nrf noup] tree-wide: support NCS Partition Manager (PM) definitions" This reverts commit ea83f6ccc7786349ddcf267af19a1b63e0fe950f. Signed-off-by: Robert Lubos --- arch/arm/core/mpu/arm_mpu_regions.c | 13 ------ cmake/modules/kernel.cmake | 4 -- drivers/flash/soc_flash_nrf.c | 11 ----- .../arch/arm/cortex_m/scripts/linker.ld | 46 ------------------- include/zephyr/storage/flash_map.h | 6 --- lib/libc/common/source/stdlib/malloc.c | 18 +------- lib/os/Kconfig.heap | 2 +- subsys/fs/littlefs_fs.c | 7 +-- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 ----------- 9 files changed, 4 insertions(+), 130 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index cfe1230c907..6af62f84078 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,9 +8,6 @@ #include #include -#if USE_PARTITION_MANAGER -#include -#endif static const struct arm_mpu_region mpu_regions[] = { /* Region 0 */ @@ -24,14 +21,6 @@ static const struct arm_mpu_region mpu_regions[] = { #endif /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", -#if USE_PARTITION_MANAGER - PM_SRAM_ADDRESS, -#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) - REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), -#else - REGION_RAM_ATTR(REGION_SRAM_SIZE)), -#endif -#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -39,8 +28,6 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif - -#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index 06e1642f362..a093d46691f 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -243,7 +243,3 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() - -if(ZEPHYR_NRF_MODULE_DIR) - include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) -endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index b5a3fefa1e5..cc840309264 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,11 +37,6 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER -#include -#include -#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ - #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -171,12 +166,6 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS - if (addr < PM_APP_ADDRESS) { - return soc_secure_mem_read(data, (void *)addr, len); - } -#endif - nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 25a48d11252..3160aa5d4ae 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -26,35 +26,6 @@ #endif #define RAMABLE_REGION RAM -#if USE_PARTITION_MANAGER - -#include - -#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) -/* We are linking against S1, create symbol containing the flash ID of S0. - * This is used when writing code operating on the "other" slot. - */ -_image_1_primary_slot_id = PM_S0_ID; - -#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ - -#ifdef PM_S1_ID -/* We are linking against S0, create symbol containing the flash ID of S1. - * This is used when writing code operating on the "other" slot. - */ -_image_1_primary_slot_id = PM_S1_ID; -#endif /* PM_S1_ID */ - -#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ - -#define ROM_ADDR PM_ADDRESS -#define ROM_SIZE PM_SIZE - -#define RAM_SIZE PM_SRAM_SIZE -#define RAM_ADDR PM_SRAM_ADDRESS - -#else /* ! USE_PARTITION_MANAGER */ - #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -87,23 +58,6 @@ _image_1_primary_slot_id = PM_S1_ID; #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS #endif -#endif /* USE_PARTITION_MANAGER */ - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) -#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) -#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) -#endif - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) -#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) -#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) -#endif - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) -#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) -#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) -#endif - #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index cc4a246105d..380e58691e9 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -271,10 +271,6 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); -#if USE_PARTITION_MANAGER -#include -#else - #define FLASH_AREA_LABEL_EXISTS(label) __DEPRECATED_MACRO \ DT_HAS_FIXED_PARTITION_LABEL(label) @@ -347,8 +343,6 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_DEVICE(label) \ DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))) -#endif /* USE_PARTITION_MANAGER */ - #ifdef __cplusplus } #endif diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index 2f469d673e4..e3a5db6f7d5 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,20 +25,6 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); -#if USE_PARTITION_MANAGER - -#include - -#define RAM_SIZE PM_SRAM_SIZE -#define RAM_ADDR PM_SRAM_ADDRESS - -#else /* ! USE_PARTITION_MANAGER */ - -#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) -#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS - -#endif /* USE_PARTITION_MANAGER */ - #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -120,8 +106,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ - ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ + ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/lib/os/Kconfig.heap b/lib/os/Kconfig.heap index f6e8d93ae50..b913d6100dc 100644 --- a/lib/os/Kconfig.heap +++ b/lib/os/Kconfig.heap @@ -51,7 +51,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index c4c75bb48c4..3058f402d73 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1054,12 +1054,7 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *) \ - COND_CODE_1(USE_PARTITION_MANAGER, \ - (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ - (FIXED_PARTITION_ID(littlefs_storage)), \ - (FIXED_PARTITION_ID(storage)))), \ - (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ + .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index 9996e1d74d9..a74e46b8520 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,35 +13,8 @@ extern "C" { #endif -#if CONFIG_PARTITION_MANAGER_ENABLED - -#include "pm_config.h" - -#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) - -#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) -#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS -#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE -#else -/* The current image is a child image in a different domain than the image - * which defined the required values. To reach the values of the parent domain - * we use the 'PM__' variant of the define. - */ -#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS -#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE -#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ - -#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) -#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ - -#else - -#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) -#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) - -#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From 1b6469b99fcd74ce13664668a9a918f98d349641 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:20 +0100 Subject: [PATCH 0726/2300] Revert "[nrf noup] ci: clang: parallel execution" This reverts commit 0643f1e138ce460226b667d33b7aaace4fd0938a. Signed-off-by: Robert Lubos --- .github/workflows/clang.yaml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index 34b4b8595a9..0aa8d5cd690 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -8,7 +8,8 @@ concurrency: jobs: clang-build: - runs-on: ubuntu-latest + if: github.repository_owner == 'zephyrproject-rtos' + runs-on: zephyr-runner-linux-x64-4xlarge container: image: ghcr.io/zephyrproject-rtos/ci:v0.26.5 options: '--entrypoint /bin/bash' @@ -18,13 +19,11 @@ jobs: fail-fast: false matrix: platform: ["native_posix"] - subset: [1, 2, 3, 4, 5] env: ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.3 LLVM_TOOLCHAIN_PATH: /usr/lib/llvm-16 COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} BASE_REF: ${{ github.base_ref }} - MATRIX_SIZE: 5 outputs: report_needed: ${{ steps.twister.outputs.report_needed }} steps: @@ -87,7 +86,7 @@ jobs: id: cache-ccache uses: zephyrproject-rtos/action-s3-cache@v1.2.0 with: - key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.subset }}-ccache + key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.platform }}-ccache path: /github/home/.cache/ccache aws-s3-bucket: ccache.zephyrproject.org aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }} @@ -100,16 +99,6 @@ jobs: test -d github/home/.cache/ccache && rm -rf /github/home/.cache/ccache && mv github/home/.cache/ccache /github/home/.cache/ccache ccache -M 10G -s - - name: Build test plan with Twister - id: twister_test_plan - run: | - export ZEPHYR_BASE=${PWD} - 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 -p native_posix -c origin/${BASE_REF}.. - - - name: Run Tests with Twister id: twister run: | @@ -123,7 +112,7 @@ jobs: if [ -s testplan.json ]; then echo "report_needed=1" >> $GITHUB_OUTPUT # Full twister but with options based on changes - ./scripts/twister --inline-logs -M -N -v --load-tests testplan.json --retry-failed 2 --subset ${{matrix.subset}}/${MATRIX_SIZE} + ./scripts/twister --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 @@ -138,7 +127,7 @@ jobs: if: always() && steps.twister.outputs.report_needed != 0 uses: actions/upload-artifact@v3 with: - name: Unit Test Results (Subset ${{ matrix.subset }}) + name: Unit Test Results (Subset ${{ matrix.platform }}) path: twister-out/twister.xml clang-build-results: From 2bfe3932a5831cddb59ab704266f1f44f46d6582 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:21 +0100 Subject: [PATCH 0727/2300] Revert "[nrf fromlist] modules: hal_nordic: Enable support for DPPI on nRF54H20" This reverts commit 413344936c729e7813173a121c4e2155b683a912. Signed-off-by: Robert Lubos --- drivers/timer/nrf_grtc_timer.c | 4 +- modules/hal_nordic/nrfx/CMakeLists.txt | 8 -- modules/hal_nordic/nrfx/nrfx_config.h | 121 ++----------------------- 3 files changed, 12 insertions(+), 121 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index c9e51db2469..8ac357864cc 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -21,8 +21,8 @@ #if !DT_NODE_HAS_PROP(GRTC_NODE, owned_channels) #error GRTC owned-channels DT property is not defined #endif -#define OWNED_CHANNELS_MASK NRFX_CONFIG_MASK_DT(GRTC_NODE, owned_channels) -#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_MASK_DT(GRTC_NODE, child_owned_channels) +#define OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(owned_channels) +#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels) #if ((OWNED_CHANNELS_MASK | CHILD_OWNED_CHANNELS_MASK) != OWNED_CHANNELS_MASK) #error GRTC child-owned-channels DT property must be a subset of owned-channels #endif diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 573cd5ecfd4..71d57814f36 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -158,14 +158,6 @@ if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) zephyr_library_sources(${NRFX_DIR}/soc/interconnect/dppic_ppib/nrfx_interconnect_dppic_ppib.c) endif() -if(CONFIG_SOC_SERIES_NRF54HX AND - (CONFIG_DT_HAS_NORDIC_NRF_DPPIC_LOCAL_ENABLED OR - CONFIG_DT_HAS_NORDIC_NRF_DPPIC_GLOBAL_ENABLED)) - zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib.c) - zephyr_library_sources(${NRFX_DIR}/soc/interconnect/apb/nrfx_interconnect_apb.c) - zephyr_library_sources(${NRFX_DIR}/soc/interconnect/ipct/nrfx_interconnect_ipct.c) -endif() - # Get the SVD file for the current SoC macro(mdk_svd_ifdef feature_toggle filename) if(${feature_toggle}) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 5c1a071f9bf..5ebc243541e 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -8,7 +8,6 @@ #define NRFX_CONFIG_H__ #include -#include /* * These are mappings of Kconfig options enabling nrfx drivers and particular @@ -757,127 +756,27 @@ #define NRF_PERIPH(P) P##_S #endif -#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) BIT(DT_PROP_BY_IDX(node_id, prop, idx)) -#define NRFX_CONFIG_MASK_DT(node_id, prop) \ - (COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \ - (DT_FOREACH_PROP_ELEM_SEP(node_id, prop, NRFX_CONFIG_BIT_DT, (|))), \ - (0))) - /* If the GRTC system timer driver is to be used, prepare definitions required * by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and * NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree. */ #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) +#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ + BIT(DT_PROP_BY_IDX(node_id, prop, idx)) +#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ + (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ + (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ + NRFX_CONFIG_BIT_DT, (|))), \ + (0))) + #define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ - (NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), owned_channels) & \ - ~NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), child_owned_channels)) + (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ + ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) #define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ -/* If global of local DPPIC peripherals are used, provide the following macro - * definitions required by the interconnect/apb layer: - * - NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) - * - NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) - * - NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE - * - NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE - * based on information from devicetree. - */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || \ - DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_local) -#ifndef NRFX_DPPI_ENABLED -#define NRFX_DPPI_ENABLED 1 -#endif -/* Source (publish) channels masks generation. */ -#define NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels) - -/* Sink (subscribe) channels masks generation. */ -#define NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels) - -#define NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) \ - UTIL_OR(DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels), \ - DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels)) - -/* Variables names generation. */ -#define NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) -#define NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(DT_NODELABEL(_CONCAT(dppic, inst_num))) - -/* Variables entries generation. */ -#define NRFX_CONFIG_DPPI_CHANNELS_ENTRY(node_id) \ - static nrfx_atomic_t NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) \ - __attribute__((used)) = \ - NRFX_CONFIG_MASK_DT(node_id, source_channels) | \ - NRFX_CONFIG_MASK_DT(node_id, sink_channels); -#define NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE \ - DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_global, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) -#define NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE \ - DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_local, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || ... */ - -/* If local or global DPPIC peripherals are used, provide the following macro - * definitions required by the interconnect/ipct layer: - * - NRFX_IPCTx_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_IPCTx_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_IPCT_PUB_OR_SUB_MASK(inst_num) - * - NRFX_IPCTx_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) - * - NRFX_INTERCONNECT_IPCT_GLOBAL_DEFINE - * - NRFX_INTERCONNECT_IPCT_LOCAL_DEFINE - * based on information from devicetree. - */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_global) || \ - DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_local) -/* Channels masks generation. */ -#define NRFX_CONFIG_IPCT_MASK_DT(node_id) \ - COND_CODE_1(DT_NODE_HAS_PROP(node_id, owned_channels), \ - (NRFX_CONFIG_MASK_DT(node_id, owned_channels)), \ - (COND_CODE_1(DT_NODE_HAS_COMPAT(node_id, nordic_nrf_ipct_local), \ - (BIT_MASK(DT_PROP(node_id, channels))), (0)))) - -#if defined(NRF_APPLICATION) -#define NRFX_CONFIG_IPCT_LOCAL_NODE DT_NODELABEL(cpuapp_ipct) -#elif defined(NRF_RADIOCORE) -#define NRFX_CONFIG_IPCT_LOCAL_NODE DT_NODELABEL(cpurad_ipct) -#endif -#define NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num) \ - COND_CODE_1(IS_EMPTY(inst_num), \ - (NRFX_CONFIG_IPCT_LOCAL_NODE), \ - (DT_NODELABEL(_CONCAT(ipct, inst_num)))) - -#define NRFX_IPCTx_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_IPCT_MASK_DT(NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num)) - -#define NRFX_IPCTx_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_IPCT_MASK_DT(NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num)) - -#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_PROP(DT_NODELABEL(_CONCAT(ipct, inst_num)), owned_channels))) - -/* Variables names generation. */ -#define NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) -#define NRFX_IPCTx_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) \ - COND_CODE_1(IS_EMPTY(inst_num), \ - (NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(NRFX_CONFIG_IPCT_LOCAL_NODE)), \ - (NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(DT_NODELABEL(_CONCAT(ipct, inst_num))))) - -/* Variables entries generation. */ -#define NRFX_CONFIG_IPCT_CHANNELS_ENTRY(node_id) \ - static nrfx_atomic_t NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(node_id) \ - __attribute__((used)) = \ - NRFX_CONFIG_IPCT_MASK_DT(node_id); -#define NRFX_INTERCONNECT_IPCT_LOCAL_DEFINE \ - DT_FOREACH_STATUS_OKAY(nordic_nrf_ipct_local, NRFX_CONFIG_IPCT_CHANNELS_ENTRY) -#define NRFX_INTERCONNECT_IPCT_GLOBAL_DEFINE \ - DT_FOREACH_STATUS_OKAY(nordic_nrf_ipct_global, NRFX_CONFIG_IPCT_CHANNELS_ENTRY) -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_global) || ... */ - #include #if defined(NRF51) #include From 23a6a488aafcd5dd9d50bb54718f23dfee97fa46 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:21 +0100 Subject: [PATCH 0728/2300] Revert "[nrf fromlist] manifest: Update hal_nordic revision" This reverts commit b3850e23340108a71cedb780a893138dac95fbf7. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 5a5b20a9711..532fcb74732 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 5470822384781624efb2fda28cbc6a895a227677 + revision: daf875285120be6b2825969b7a0abc3f415b248d path: modules/hal/nordic groups: - hal From 24b38c582956f5ca6a14a4c8bc09ce5e1f1c4a94 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:21 +0100 Subject: [PATCH 0729/2300] Revert "[nrf fromlist] soc: nordic_nrf: Add address validation entries for nRF54H/L dts nodes" This reverts commit 81c93e932666b923915e0fa87c6c430c8f288b78. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/validate_base_addresses.c | 76 -------------------- 1 file changed, 76 deletions(-) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 04c7a1ae3cd..28ec231b132 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -133,39 +133,17 @@ CHECK_DT_REG(cryptocell, NRF_CRYPTOCELL); CHECK_DT_REG(ctrlap, NRF_CTRLAP); CHECK_DT_REG(dcnf, NRF_DCNF); CHECK_DT_REG(dppic, NRF_DPPIC); -CHECK_DT_REG(dppic00, NRF_DPPIC00); -CHECK_DT_REG(dppic10, NRF_DPPIC10); -CHECK_DT_REG(dppic20, NRF_DPPIC20); -CHECK_DT_REG(dppic30, NRF_DPPIC30); -CHECK_DT_REG(dppic020, NRF_DPPIC020); -CHECK_DT_REG(dppic120, NRF_DPPIC120); -CHECK_DT_REG(dppic130, NRF_DPPIC130); -CHECK_DT_REG(dppic131, NRF_DPPIC131); -CHECK_DT_REG(dppic132, NRF_DPPIC132); -CHECK_DT_REG(dppic133, NRF_DPPIC133); -CHECK_DT_REG(dppic134, NRF_DPPIC134); -CHECK_DT_REG(dppic135, NRF_DPPIC135); -CHECK_DT_REG(dppic136, NRF_DPPIC136); CHECK_DT_REG(ecb, NRF_ECB); -CHECK_DT_REG(ecb020, NRF_ECB020); -CHECK_DT_REG(ecb030, NRF_ECB030); CHECK_DT_REG(egu0, NRF_EGU0); CHECK_DT_REG(egu1, NRF_EGU1); CHECK_DT_REG(egu2, NRF_EGU2); CHECK_DT_REG(egu3, NRF_EGU3); CHECK_DT_REG(egu4, NRF_EGU4); CHECK_DT_REG(egu5, NRF_EGU5); -CHECK_DT_REG(egu10, NRF_EGU10); -CHECK_DT_REG(egu20, NRF_EGU20); -CHECK_DT_REG(egu020, NRF_EGU020); CHECK_DT_REG(ficr, NRF_FICR); CHECK_DT_REG(flash_controller, NRF_NVMC); CHECK_DT_REG(gpio0, NRF_P0); CHECK_DT_REG(gpio1, NRF_P1); -CHECK_DT_REG(gpio2, NRF_P2); -CHECK_DT_REG(gpio6, NRF_P6); -CHECK_DT_REG(gpio7, NRF_P7); -CHECK_DT_REG(gpio9, NRF_P9); CHECK_DT_REG(gpiote, NRF_GPIOTE); CHECK_DT_REG(gpiote0, NRF_GPIOTE0); CHECK_DT_REG(gpiote1, NRF_GPIOTE1); @@ -177,25 +155,8 @@ CHECK_I2C_REG(i2c0, 0); CHECK_I2C_REG(i2c1, 1); CHECK_DT_REG(i2c2, NRF_TWIM2); CHECK_DT_REG(i2c3, NRF_TWIM3); -CHECK_DT_REG(i2c20, NRF_TWIM20); -CHECK_DT_REG(i2c21, NRF_TWIM21); -CHECK_DT_REG(i2c22, NRF_TWIM22); -CHECK_DT_REG(i2c30, NRF_TWIM30); -CHECK_DT_REG(i2c130, NRF_TWIM130); -CHECK_DT_REG(i2c131, NRF_TWIM131); -CHECK_DT_REG(i2c132, NRF_TWIM132); -CHECK_DT_REG(i2c133, NRF_TWIM133); -CHECK_DT_REG(i2c134, NRF_TWIM134); -CHECK_DT_REG(i2c135, NRF_TWIM135); -CHECK_DT_REG(i2c136, NRF_TWIM136); -CHECK_DT_REG(i2c137, NRF_TWIM137); CHECK_DT_REG(i2s0, NRF_I2S0); -CHECK_DT_REG(i2s20, NRF_I2S20); CHECK_DT_REG(ipc, NRF_IPC); -CHECK_DT_REG(cpuapp_ipct, NRF_IPCT); -CHECK_DT_REG(cpurad_ipct, NRF_IPCT); -CHECK_DT_REG(ipct120, NRF_IPCT120); -CHECK_DT_REG(ipct130, NRF_IPCT130); CHECK_DT_REG(kmu, NRF_KMU); CHECK_DT_REG(mutex, NRF_MUTEX); CHECK_DT_REG(mwu, NRF_MWU); @@ -212,40 +173,18 @@ CHECK_DT_REG(pwm3, NRF_PWM3); CHECK_DT_REG(qdec, NRF_QDEC0); /* this should be the same node as qdec0 */ CHECK_DT_REG(qdec0, NRF_QDEC0); CHECK_DT_REG(qdec1, NRF_QDEC1); -CHECK_DT_REG(qdec20, NRF_QDEC20); -CHECK_DT_REG(qdec21, NRF_QDEC21); -CHECK_DT_REG(qdec130, NRF_QDEC130); -CHECK_DT_REG(qdec131, NRF_QDEC131); CHECK_DT_REG(radio, NRF_RADIO); CHECK_DT_REG(regulators, NRF_REGULATORS); CHECK_DT_REG(reset, NRF_RESET); CHECK_DT_REG(rng, NRF_RNG); -CHECK_DT_REG(rtc, NRF_RTC); CHECK_DT_REG(rtc0, NRF_RTC0); CHECK_DT_REG(rtc1, NRF_RTC1); CHECK_DT_REG(rtc2, NRF_RTC2); -CHECK_DT_REG(rtc130, NRF_RTC130); -CHECK_DT_REG(rtc131, NRF_RTC131); CHECK_SPI_REG(spi0, 0); CHECK_SPI_REG(spi1, 1); CHECK_SPI_REG(spi2, 2); CHECK_DT_REG(spi3, NRF_SPIM3); CHECK_DT_REG(spi4, NRF_SPIM4); -CHECK_DT_REG(spi00, NRF_SPIM00); -CHECK_DT_REG(spi20, NRF_SPIM20); -CHECK_DT_REG(spi21, NRF_SPIM21); -CHECK_DT_REG(spi22, NRF_SPIM22); -CHECK_DT_REG(spi30, NRF_SPIM30); -CHECK_DT_REG(spi120, NRF_SPIM120); -CHECK_DT_REG(spi121, NRF_SPIM121); -CHECK_DT_REG(spi130, NRF_SPIM130); -CHECK_DT_REG(spi131, NRF_SPIM131); -CHECK_DT_REG(spi132, NRF_SPIM132); -CHECK_DT_REG(spi133, NRF_SPIM133); -CHECK_DT_REG(spi134, NRF_SPIM134); -CHECK_DT_REG(spi135, NRF_SPIM135); -CHECK_DT_REG(spi136, NRF_SPIM136); -CHECK_DT_REG(spi137, NRF_SPIM137); CHECK_DT_REG(spu, NRF_SPU); CHECK_DT_REG(swi0, NRF_SWI0); CHECK_DT_REG(swi1, NRF_SWI1); @@ -266,19 +205,6 @@ CHECK_DT_REG(timer21, NRF_TIMER21); CHECK_DT_REG(timer22, NRF_TIMER22); CHECK_DT_REG(timer23, NRF_TIMER23); CHECK_DT_REG(timer24, NRF_TIMER24); -CHECK_DT_REG(timer020, NRF_TIMER020); -CHECK_DT_REG(timer021, NRF_TIMER021); -CHECK_DT_REG(timer022, NRF_TIMER022); -CHECK_DT_REG(timer120, NRF_TIMER120); -CHECK_DT_REG(timer121, NRF_TIMER121); -CHECK_DT_REG(timer130, NRF_TIMER130); -CHECK_DT_REG(timer131, NRF_TIMER131); -CHECK_DT_REG(timer132, NRF_TIMER132); -CHECK_DT_REG(timer133, NRF_TIMER133); -CHECK_DT_REG(timer134, NRF_TIMER134); -CHECK_DT_REG(timer135, NRF_TIMER135); -CHECK_DT_REG(timer136, NRF_TIMER136); -CHECK_DT_REG(timer137, NRF_TIMER137); CHECK_UART_REG(uart0, 0); CHECK_DT_REG(uart1, NRF_UARTE1); CHECK_DT_REG(uart2, NRF_UARTE2); @@ -306,8 +232,6 @@ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); CHECK_DT_REG(wdt30, NRF_WDT30); CHECK_DT_REG(wdt31, NRF_WDT31); -CHECK_DT_REG(wdt131, NRF_WDT131); -CHECK_DT_REG(wdt132, NRF_WDT132); /* nRF51/nRF52-specific addresses */ #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) From f76d2c23e0bc001605cafaef17676ade58a03d18 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:21 +0100 Subject: [PATCH 0730/2300] Revert "[nrf fromlist] dts: nordic: Add missing ECB020 node in nRF54H20 EngA" This reverts commit 0ab98d9e8869f01eb3781ea231a92fac95c8a118. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 8552b9534eb..47aba0df253 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -210,13 +210,6 @@ interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; }; - ecb020: ecb@27000 { - compatible = "nordic,nrf-ecb"; - reg = <0x27000 0x1000>; - status = "disabled"; - interrupts = <39 NRF_DEFAULT_IRQ_PRIORITY>; - }; - timer020: timer@28000 { compatible = "nordic,nrf-timer"; reg = <0x28000 0x1000>; From 8c49c4bed7db8d6b8a6c83beef19a81575c93161 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:21 +0100 Subject: [PATCH 0731/2300] Revert "[nrf fromlist] dts: nordic: Add DPPIC and IPCT nodes to nRF54H20 EngA" This reverts commit 50e4aa2286986e8c66b7a5c713907f4195b9aeb5. Signed-off-by: Robert Lubos --- .../{misc => arm}/nordic,nrf-dppic.yaml | 0 .../{misc => arm}/nordic,nrf-ppi.yaml | 0 dts/bindings/ipc/nordic,nrf-ipct-common.yaml | 45 --------- dts/bindings/ipc/nordic,nrf-ipct-global.yaml | 17 ---- dts/bindings/ipc/nordic,nrf-ipct-local.yaml | 12 --- dts/bindings/{ipc => ipm}/nordic,nrf-ipc.yaml | 0 .../misc/nordic,nrf-dppic-global.yaml | 18 ---- dts/bindings/misc/nordic,nrf-dppic-links.yaml | 17 ---- dts/bindings/misc/nordic,nrf-dppic-local.yaml | 13 --- .../misc/nordic,split-channel-groups.yaml | 20 ---- dts/common/nordic/nrf54h20_enga.dtsi | 94 ------------------- 11 files changed, 236 deletions(-) rename dts/bindings/{misc => arm}/nordic,nrf-dppic.yaml (100%) rename dts/bindings/{misc => arm}/nordic,nrf-ppi.yaml (100%) delete mode 100644 dts/bindings/ipc/nordic,nrf-ipct-common.yaml delete mode 100644 dts/bindings/ipc/nordic,nrf-ipct-global.yaml delete mode 100644 dts/bindings/ipc/nordic,nrf-ipct-local.yaml rename dts/bindings/{ipc => ipm}/nordic,nrf-ipc.yaml (100%) delete mode 100644 dts/bindings/misc/nordic,nrf-dppic-global.yaml delete mode 100644 dts/bindings/misc/nordic,nrf-dppic-links.yaml delete mode 100644 dts/bindings/misc/nordic,nrf-dppic-local.yaml delete mode 100644 dts/bindings/misc/nordic,split-channel-groups.yaml diff --git a/dts/bindings/misc/nordic,nrf-dppic.yaml b/dts/bindings/arm/nordic,nrf-dppic.yaml similarity index 100% rename from dts/bindings/misc/nordic,nrf-dppic.yaml rename to dts/bindings/arm/nordic,nrf-dppic.yaml diff --git a/dts/bindings/misc/nordic,nrf-ppi.yaml b/dts/bindings/arm/nordic,nrf-ppi.yaml similarity index 100% rename from dts/bindings/misc/nordic,nrf-ppi.yaml rename to dts/bindings/arm/nordic,nrf-ppi.yaml diff --git a/dts/bindings/ipc/nordic,nrf-ipct-common.yaml b/dts/bindings/ipc/nordic,nrf-ipct-common.yaml deleted file mode 100644 index a75b63577c4..00000000000 --- a/dts/bindings/ipc/nordic,nrf-ipct-common.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic IPCT (Interprocessor Communication Transceiver) - -include: base.yaml - -properties: - reg: - required: true - - channels: - type: int - required: true - description: Number of channels implemented by the IPCT instance. - - source-channel-links: - type: array - description: | - Mapping of IPCT channels that are mapped between two IPCT instances on - separate domains, in which a channel on this IPCT node is considered - the source. This array is then comprised of a 3-integer-wide "unit" - that defines one connection of the mapping. The format of this unit - is . Units are sequential - in the array, therefore requiring the length of this property to be - a factor of 3. - - For example, if channel 2 is to be mapped to Radio Core (ID: 3) IPCT - channel 4, then the array "unit" would be <2 NRF_DOMAIN_ID_RADIOCORE 4> - or <2 3 4>. - - sink-channel-links: - type: array - description: | - Mapping of IPCT channels that are mapped between two IPCT instances on - separate domains, in which a channel on this IPCT node is considered - the sink. This array is then comprised of a 3-integer-wide "unit" - that defines one connection of the mapping. The format of this unit - is . Units are sequential - in the array, therefore requiring the length of this property to be - a factor of 3. - - For example, if channel 2 is to be mapped to Radio Core (ID: 3) IPCT - channel 4, then the array "unit" would be <2 NRF_DOMAIN_ID_RADIOCORE 4> - or <2 3 4>. diff --git a/dts/bindings/ipc/nordic,nrf-ipct-global.yaml b/dts/bindings/ipc/nordic,nrf-ipct-global.yaml deleted file mode 100644 index a1f7776d464..00000000000 --- a/dts/bindings/ipc/nordic,nrf-ipct-global.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic Global IPCT (Interprocessor Communication Transceiver) - -compatible: "nordic,nrf-ipct-global" - -include: ["nordic,nrf-ipct-common.yaml", "nordic,split-channels.yaml"] - -properties: - global-domain-id: - required: true - type: int - description: | - Global IPCT instances reside on specific buses within the Global Domain, - such as fast and slow, which have different IDs that do not match the - standard Global Domain ID presented in their address. diff --git a/dts/bindings/ipc/nordic,nrf-ipct-local.yaml b/dts/bindings/ipc/nordic,nrf-ipct-local.yaml deleted file mode 100644 index 9f055eb8b79..00000000000 --- a/dts/bindings/ipc/nordic,nrf-ipct-local.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic Local IPCT (Interprocessor Communication Transceiver) - -compatible: "nordic,nrf-ipct-local" - -include: "nordic,nrf-ipct-common.yaml" - -properties: - interrupts: - required: true diff --git a/dts/bindings/ipc/nordic,nrf-ipc.yaml b/dts/bindings/ipm/nordic,nrf-ipc.yaml similarity index 100% rename from dts/bindings/ipc/nordic,nrf-ipc.yaml rename to dts/bindings/ipm/nordic,nrf-ipc.yaml diff --git a/dts/bindings/misc/nordic,nrf-dppic-global.yaml b/dts/bindings/misc/nordic,nrf-dppic-global.yaml deleted file mode 100644 index 3257c519348..00000000000 --- a/dts/bindings/misc/nordic,nrf-dppic-global.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic Global DPPIC - (Distributed Programmable Peripheral Interconnect Controller) - - Updated DPPIC binding set for Nordic products that have global DPPIC instances - with inter-bridge functionality. These instances also have split-ownership - of its channels and channel groups. - -compatible: "nordic,nrf-dppic-global" - -include: - - "nordic,nrf-dppic.yaml" - - "nordic,nrf-dppic-links.yaml" - - "nordic,split-channels.yaml" - - "nordic,split-channel-groups.yaml" diff --git a/dts/bindings/misc/nordic,nrf-dppic-links.yaml b/dts/bindings/misc/nordic,nrf-dppic-links.yaml deleted file mode 100644 index db12ccb72cb..00000000000 --- a/dts/bindings/misc/nordic,nrf-dppic-links.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic DPPIC Channel Linking - -properties: - source-channels: - type: array - description: | - Channels that are linked to channels of DPPIC instances on separate - bridges as publishing sources. - - sink-channels: - type: array - description: | - Channels that are linked to channels of DPPIC instances on separate - bridges as subscribing sinks. diff --git a/dts/bindings/misc/nordic,nrf-dppic-local.yaml b/dts/bindings/misc/nordic,nrf-dppic-local.yaml deleted file mode 100644 index bea53bddec8..00000000000 --- a/dts/bindings/misc/nordic,nrf-dppic-local.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -description: | - Nordic Local DPPIC - (Distributed Programmable Peripheral Interconnect Controller) - - Updated DPPIC binding set for Nordic products that have local DPPIC instances - with inter-bridge functionality. - -compatible: "nordic,nrf-dppic-local" - -include: ["nordic,nrf-dppic.yaml", "nordic,nrf-dppic-links.yaml"] diff --git a/dts/bindings/misc/nordic,split-channel-groups.yaml b/dts/bindings/misc/nordic,split-channel-groups.yaml deleted file mode 100644 index 868bc5fecec..00000000000 --- a/dts/bindings/misc/nordic,split-channel-groups.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic Split Channel Groups - -properties: - owned-channel-groups: - type: array - description: | - List of channel groups of a split-ownership peripheral that are to be - owned for use by the compiled domain. - - nonsecure-channel-groups: - type: array - description: | - List of channel groups in a split-ownership, split-security peripheral - that are to be configured as nonsecure. In Trustzone systems, this - property is only evaluated for secure peripherals, as nonsecure channels - are implicitly specified through the owned-channels property. This - property is ignored in non-Trustzone systems. diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 47aba0df253..70c994ccd06 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -9,12 +9,6 @@ #include -/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ -#define NRF_DOMAIN_ID_APPLICATION 2 -#define NRF_DOMAIN_ID_RADIOCORE 3 -#define NRF_DOMAIN_ID_GLOBALFAST 12 -#define NRF_DOMAIN_ID_GLOBALSLOW 13 - /delete-node/ &sw_pwm; / { @@ -159,15 +153,6 @@ <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; nordic,ficr-names = "vsup", "coarse", "fine"; }; - - cpuapp_ipct: ipct@13000 { - compatible = "nordic,nrf-ipct-local"; - reg = <0x13000 0x1000>; - status = "disabled"; - channels = <4>; - interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, - <65 NRF_DEFAULT_IRQ_PRIORITY>; - }; }; cpurad_peripherals: peripheral@53000000 { @@ -188,21 +173,6 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; - dppic020: dppic@22000 { - compatible = "nordic,nrf-dppic-local"; - reg = <0x22000 0x1000>; - status = "disabled"; - }; - - cpurad_ipct: ipct@24000 { - compatible = "nordic,nrf-ipct-local"; - reg = <0x24000 0x1000>; - status = "disabled"; - channels = <8>; - interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, - <65 NRF_DEFAULT_IRQ_PRIORITY>; - }; - egu020: egu@25000 { compatible = "nordic,nrf-egu"; reg = <0x25000 0x1000>; @@ -297,20 +267,6 @@ #mbox-cells = <1>; }; - ipct120: ipct@8d1000 { - compatible = "nordic,nrf-ipct-global"; - reg = <0x8d1000 0x1000>; - status = "disabled"; - channels = <8>; - global-domain-id = <12>; - }; - - dppic120: dppic@8e1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x8e1000 0x1000>; - status = "disabled"; - }; - timer120: timer@8e2000 { compatible = "nordic,nrf-timer"; reg = <0x8e2000 0x1000>; @@ -388,20 +344,6 @@ }; }; - ipct130: ipct@921000 { - compatible = "nordic,nrf-ipct-global"; - reg = <0x921000 0x1000>; - status = "disabled"; - channels = <8>; - global-domain-id = <13>; - }; - - dppic130: dppic@922000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x922000 0x1000>; - status = "disabled"; - }; - rtc130: rtc@928000 { compatible = "nordic,nrf-rtc"; reg = <0x928000 0x1000>; @@ -507,12 +449,6 @@ port = <9>; }; - dppic131: dppic@981000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x981000 0x1000>; - status = "disabled"; - }; - comp: comparator@983000 { compatible = "nordic,nrf-comp"; reg = <0x983000 0x1000>; @@ -535,12 +471,6 @@ interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; }; - dppic132: dppic@991000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x991000 0x1000>; - status = "disabled"; - }; - qdec130: qdec@994000 { compatible = "nordic,nrf-qdec"; reg = <0x994000 0x1000>; @@ -562,12 +492,6 @@ cc-num = <16>; }; - dppic133: dppic@9a1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9a1000 0x1000>; - status = "disabled"; - }; - timer130: timer@9a2000 { compatible = "nordic,nrf-timer"; reg = <0x9a2000 0x1000>; @@ -644,12 +568,6 @@ interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; }; - dppic134: dppic@9b1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9b1000 0x1000>; - status = "disabled"; - }; - timer132: timer@9b2000 { compatible = "nordic,nrf-timer"; reg = <0x9b2000 0x1000>; @@ -726,12 +644,6 @@ interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; }; - dppic135: dppic@9c1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9c1000 0x1000>; - status = "disabled"; - }; - timer134: timer@9c2000 { compatible = "nordic,nrf-timer"; reg = <0x9c2000 0x1000>; @@ -808,12 +720,6 @@ interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; }; - dppic136: dppic@9d1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9d1000 0x1000>; - status = "disabled"; - }; - timer136: timer@9d2000 { compatible = "nordic,nrf-timer"; reg = <0x9d2000 0x1000>; From 706185c75d309394013e87862ddb4da8425bfbdc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:22 +0100 Subject: [PATCH 0732/2300] Revert "[nrf fromtree] manifest: update hal_nordic revision" This reverts commit 826a22820c6decf9daeebe0d60ecd07370840965. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 532fcb74732..b55d82805b9 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: daf875285120be6b2825969b7a0abc3f415b248d + revision: dce8519f7da37b0a745237679fd3f88250b495ff path: modules/hal/nordic groups: - hal From 55ba4ca803947b7c23c2d879da72c2fcbcc4b3e1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:22 +0100 Subject: [PATCH 0733/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: Add erase-block-size to mram1x" This reverts commit 04433a6c721c96b04f4c162e0c33ca7d4786d295. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 70c994ccd06..610fbd81587 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -96,7 +96,6 @@ mram1x: mram@e000000 { compatible = "nordic,mram"; reg = <0xe000000 DT_SIZE_K(2048)>; - erase-block-size = <4096>; write-block-size = <16>; }; From cb5fbd070e85e577c1ff4b6c36d2155bdb2e6c96 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:22 +0100 Subject: [PATCH 0734/2300] Revert "[nrf fromtree] drivers: flash: Add flash driver for MRAM" This reverts commit f57e95b2762782f390d731ab5dfbeaefe0feda3e. Signed-off-by: Robert Lubos --- drivers/flash/CMakeLists.txt | 1 - drivers/flash/Kconfig | 2 - drivers/flash/Kconfig.nrf_mram | 19 ---- drivers/flash/soc_flash_nrf_mram.c | 177 ----------------------------- 4 files changed, 199 deletions(-) delete mode 100644 drivers/flash/Kconfig.nrf_mram delete mode 100644 drivers/flash/soc_flash_nrf_mram.c diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index 7e8e5832afe..7426b43b089 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -119,4 +119,3 @@ 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_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) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index 7f882c517ac..03d4d07a193 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -162,6 +162,4 @@ source "drivers/flash/Kconfig.ambiq" source "drivers/flash/Kconfig.nrf_rram" -source "drivers/flash/Kconfig.nrf_mram" - endif # FLASH diff --git a/drivers/flash/Kconfig.nrf_mram b/drivers/flash/Kconfig.nrf_mram deleted file mode 100644 index 0ef65864a62..00000000000 --- a/drivers/flash/Kconfig.nrf_mram +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config SOC_FLASH_NRF_MRAM - bool "Nordic Semiconductor flash driver for MRAM" - default y - depends on DT_HAS_NORDIC_MRAM_ENABLED - select FLASH_HAS_DRIVER_ENABLED - select FLASH_HAS_PAGE_LAYOUT - imply MPU_ALLOW_FLASH_WRITE if ARM_MPU - help - Enables Nordic Semiconductor flash driver for MRAM in direct write mode. - - Note that MRAM words are auto-erased when written to, but writing to a - pre-erased area is faster. Hence, the erase API is not required, but - it can be used to amortize write performance for some use cases. diff --git a/drivers/flash/soc_flash_nrf_mram.c b/drivers/flash/soc_flash_nrf_mram.c deleted file mode 100644 index 9b33ee05d6f..00000000000 --- a/drivers/flash/soc_flash_nrf_mram.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#include -#include -#include - -LOG_MODULE_REGISTER(flash_nrf_mram, CONFIG_FLASH_LOG_LEVEL); - -#define DT_DRV_COMPAT nordic_mram - -#define MRAM_START DT_INST_REG_ADDR(0) -#define MRAM_SIZE DT_INST_REG_SIZE(0) - -#define MRAM_WORD_SIZE 16 -#define MRAM_WORD_MASK 0xf - -#define WRITE_BLOCK_SIZE DT_INST_PROP_OR(0, write_block_size, MRAM_WORD_SIZE) -#define ERASE_BLOCK_SIZE DT_INST_PROP_OR(0, erase_block_size, WRITE_BLOCK_SIZE) - -#define ERASE_VALUE 0xff - -BUILD_ASSERT(MRAM_START > 0, "nordic,mram: start address expected to be non-zero"); -BUILD_ASSERT((ERASE_BLOCK_SIZE % WRITE_BLOCK_SIZE) == 0, - "erase-block-size expected to be a multiple of write-block-size"); - -/** - * @param[in,out] offset Relative offset into memory, from the driver API. - * @param[in] len Number of bytes for the intended operation. - * @param[in] must_align Require MRAM word alignment, if applicable. - * - * @return Absolute address in MRAM, or NULL if @p offset or @p len are not - * within bounds or appropriately aligned. - */ -static uintptr_t validate_and_map_addr(off_t offset, size_t len, bool must_align) -{ - if (unlikely(offset < 0 || offset >= MRAM_SIZE || len > MRAM_SIZE - offset)) { - LOG_ERR("invalid offset: %ld:%zu", offset, len); - return 0; - } - - const uintptr_t addr = MRAM_START + offset; - - if (WRITE_BLOCK_SIZE > 1 && must_align && - unlikely((addr % WRITE_BLOCK_SIZE) != 0 || (len % WRITE_BLOCK_SIZE) != 0)) { - LOG_ERR("invalid alignment: %p:%zu", (void *)addr, len); - return 0; - } - - return addr; -} - -/** - * @param[in] addr_end Last modified MRAM address (not inclusive). - */ -static void commit_changes(uintptr_t addr_end) -{ - /* Barrier following our last write. */ - barrier_dmem_fence_full(); - - if ((WRITE_BLOCK_SIZE & MRAM_WORD_MASK) == 0 || (addr_end & MRAM_WORD_MASK) == 0) { - /* Our last operation was MRAM word-aligned, so we're done. - * Note: if WRITE_BLOCK_SIZE is a multiple of MRAM_WORD_SIZE, - * then this was already checked in validate_and_map_addr(). - */ - return; - } - - /* Get the most significant byte (MSB) of the last MRAM word we were modifying. - * Writing to this byte makes the MRAM controller commit other pending writes to that word. - */ - addr_end |= MRAM_WORD_MASK; - - /* Issue a dummy write, since we didn't have anything to write here. - * Doing this lets us finalize our changes before we exit the driver API. - */ - sys_write8(sys_read8(addr_end), addr_end); -} - -static int nrf_mram_read(const struct device *dev, off_t offset, void *data, size_t len) -{ - ARG_UNUSED(dev); - - const uintptr_t addr = validate_and_map_addr(offset, len, false); - - if (!addr) { - return -EINVAL; - } - - LOG_DBG("read: %p:%zu", (void *)addr, len); - - memcpy(data, (void *)addr, len); - - return 0; -} - -static int nrf_mram_write(const struct device *dev, off_t offset, const void *data, size_t len) -{ - ARG_UNUSED(dev); - - const uintptr_t addr = validate_and_map_addr(offset, len, true); - - if (!addr) { - return -EINVAL; - } - - LOG_DBG("write: %p:%zu", (void *)addr, len); - - memcpy((void *)addr, data, len); - commit_changes(addr + len); - - return 0; -} - -static int nrf_mram_erase(const struct device *dev, off_t offset, size_t size) -{ - ARG_UNUSED(dev); - - const uintptr_t addr = validate_and_map_addr(offset, size, true); - - if (!addr) { - return -EINVAL; - } - - LOG_DBG("erase: %p:%zu", (void *)addr, size); - - memset((void *)addr, ERASE_VALUE, size); - commit_changes(addr + size); - - return 0; -} - -static const struct flash_parameters *nrf_mram_get_parameters(const struct device *dev) -{ - ARG_UNUSED(dev); - - static const struct flash_parameters parameters = { - .write_block_size = WRITE_BLOCK_SIZE, - .erase_value = ERASE_VALUE, - }; - - return ¶meters; -} - -#if defined(CONFIG_FLASH_PAGE_LAYOUT) -static void nrf_mram_page_layout(const struct device *dev, const struct flash_pages_layout **layout, - size_t *layout_size) -{ - ARG_UNUSED(dev); - - static const struct flash_pages_layout pages_layout = { - .pages_count = (MRAM_SIZE) / (ERASE_BLOCK_SIZE), - .pages_size = ERASE_BLOCK_SIZE, - }; - - *layout = &pages_layout; - *layout_size = 1; -} -#endif - -static const struct flash_driver_api nrf_mram_api = { - .read = nrf_mram_read, - .write = nrf_mram_write, - .erase = nrf_mram_erase, - .get_parameters = nrf_mram_get_parameters, -#if defined(CONFIG_FLASH_PAGE_LAYOUT) - .page_layout = nrf_mram_page_layout, -#endif -}; - -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &nrf_mram_api); From dfb51eaf56d167b3ece6bcdad9dcdd0f3ce0d252 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:22 +0100 Subject: [PATCH 0735/2300] Revert "[nrf fromtree] drivers: modem_cellular: allow leaving out the chat_filter parameter" This reverts commit 01f4a78eca85ee7d902bd4e3c10566ff896fb4e5. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 15f10f11a52..276c9d38f7b 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1516,7 +1516,7 @@ static int modem_cellular_init(const struct device *dev) .delimiter = data->chat_delimiter, .delimiter_size = strlen(data->chat_delimiter), .filter = data->chat_filter, - .filter_size = data->chat_filter ? strlen(data->chat_filter) : 0, + .filter_size = strlen(data->chat_filter), .argv = data->chat_argv, .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, From e26febfd531dc585313df9ac6a3298aa33d75c82 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:22 +0100 Subject: [PATCH 0736/2300] Revert "[nrf fromtree] net: l2: wifi: wifi_utils: Resolve build warning with strncpy function" This reverts commit c82c6569ace538abf08f9dd8e469d3ae5a289597. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_utils.c b/subsys/net/l2/wifi/wifi_utils.c index 01c4bf1ea81..bd47205e4f9 100644 --- a/subsys/net/l2/wifi/wifi_utils.c +++ b/subsys/net/l2/wifi/wifi_utils.c @@ -241,7 +241,8 @@ int wifi_utils_parse_scan_bands(char *scan_bands_str, uint8_t *band_map) return -EINVAL; } - strncpy(parse_str, scan_bands_str, sizeof(parse_str)); + strncpy(parse_str, scan_bands_str, len); + parse_str[len] = '\0'; band_str = strtok_r(parse_str, ",", &ctx); From c79a638cee5a75e08416934783fa1719d7d609a7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:23 +0100 Subject: [PATCH 0737/2300] Revert "[nrf fromlist] modules: hal_nordic: Enforce nrf-regtool minimum version" This reverts commit 3eb95e74276b956f1eda8649e54a6fbd8f8a46b1. Signed-off-by: Robert Lubos --- 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 7f46997c697..c4a7134935c 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -11,7 +11,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.1.0 REQUIRED + find_package(nrf-regtool 5.1.0 COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From 5adb44c8f52c84fe0d7f55b46fe09f7568e2be11 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:23 +0100 Subject: [PATCH 0738/2300] Revert "[nrf fromlist] buildsystem: Enable LTO also for the application" This reverts commit 739b8f74740eccc2f320ac684d6b3934b2144fe3. Signed-off-by: Robert Lubos --- CMakeLists.txt | 2 +- lib/libc/newlib/CMakeLists.txt | 3 --- lib/libc/picolibc/CMakeLists.txt | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10196c43540..5bb1774d020 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,7 +214,7 @@ endif() zephyr_compile_options(${OPTIMIZATION_FLAG}) if(CONFIG_LTO) - zephyr_compile_options($) + add_compile_options($) add_link_options($) endif() diff --git a/lib/libc/newlib/CMakeLists.txt b/lib/libc/newlib/CMakeLists.txt index 35c6a9b6337..6556a3e814c 100644 --- a/lib/libc/newlib/CMakeLists.txt +++ b/lib/libc/newlib/CMakeLists.txt @@ -3,9 +3,6 @@ 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 normally uses -ffreestanding, which with current GNU toolchains # means that the flag macros used by newlib 3.x to signal # support for PRI.64 macros are not present. To make them available we diff --git a/lib/libc/picolibc/CMakeLists.txt b/lib/libc/picolibc/CMakeLists.txt index 719ff70f49d..232e4ba8fc1 100644 --- a/lib/libc/picolibc/CMakeLists.txt +++ b/lib/libc/picolibc/CMakeLists.txt @@ -3,9 +3,6 @@ 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 $) - # define __LINUX_ERRNO_EXTENSIONS__ so we get errno defines like -ESHUTDOWN # used by the network stack zephyr_compile_definitions(__LINUX_ERRNO_EXTENSIONS__) From bbb8eeca283989cb315ce463a86b2ed4a2bc5557 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:23 +0100 Subject: [PATCH 0739/2300] Revert "[nrf fromlist] linker: Set ROM offset for MCUboot with NRF54L" This reverts commit 1d331bf7e78fde7c98fe87cf385ebd5ff970196b. Signed-off-by: Robert Lubos --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig index 3e47a0bb583..532ea07c859 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig @@ -9,8 +9,4 @@ config BOARD config BT_CTLR default BT -config ROM_START_OFFSET - hex - default 0x800 if BOOTLOADER_MCUBOOT - endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP From 2edabc42fcb1497e40c4079390f8ade1d6264ea4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:23 +0100 Subject: [PATCH 0740/2300] Revert "[nrf fromlist] dts: arm: add uart-mcumgr choosen for 54L15" This reverts commit 54f6f538b691e3ec1dbcb7ec14466e07dedbf698. Signed-off-by: Robert Lubos --- boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index 9876e3996e8..f2703872899 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -16,7 +16,6 @@ chosen { zephyr,console = &uart20; zephyr,shell-uart = &uart20; - zephyr,uart-mcumgr = &uart20; zephyr,sram = &sram0; zephyr,flash = &rram0; zephyr,code-partition = &slot0_partition; From 79cfd18513404fb8a8cb7803c8ade7109101cb9e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:23 +0100 Subject: [PATCH 0741/2300] Revert "[nrf fromlist] dts: arm: nrf54l: Add nodes required by MCUboot" This reverts commit 229904255a65fc168fe04b07a62c70bd8f868023. Signed-off-by: Robert Lubos --- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index f2703872899..1e0245f6cc3 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -133,30 +133,13 @@ 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 { + slot0_partition: partition@0 { label = "image-0"; - reg = <0x10000 DT_SIZE_K(348)>; - }; - slot0_ns_partition: partition@67000 { - label = "image-0-nonsecure"; - reg = <0x67000 DT_SIZE_K(348)>; - }; - slot1_partition: partition@be000 { - label = "image-1"; - reg = <0xbe000 DT_SIZE_K(348)>; - }; - slot1_ns_partition: partition@115000 { - label = "image-1-nonsecure"; - reg = <0x115000 DT_SIZE_K(348)>; + reg = <0x0 DT_SIZE_K(64)>; }; - /* 32k from 0x16c000 to 0x173fff reserved for TF-M partitions */ - storage_partition: partition@174000 { + storage_partition: partition@f2000 { label = "storage"; - reg = <0x174000 DT_SIZE_K(36)>; + reg = <0xf2000 DT_SIZE_K(24)>; }; }; }; From 576b8a36fa724ef6580ef4a54a700b7badb5e919 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:23 +0100 Subject: [PATCH 0742/2300] Revert "[nrf fromlist] samples: drivers: mbox: add support for nRF BELLBOARD" This reverts commit 34e58efcd85ab0dae226d0be16c3224e5b1b584d. Signed-off-by: Robert Lubos --- ...nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf | 1 - ...54h20pdk_nrf54h20_cpuapp_bellboard.overlay | 8 -------- ...nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf | 1 - ...54h20pdk_nrf54h20_cpuppr_bellboard.overlay | 8 -------- samples/drivers/mbox/sample.yaml | 20 ------------------- 5 files changed, 38 deletions(-) delete mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf delete mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay delete mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf delete mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf deleted file mode 100644 index 0b6bc73d6bc..00000000000 --- a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_TX_ENABLED=n diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay deleted file mode 100644 index 5f0cfe2261d..00000000000 --- a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -mbox: &cpuapp_bellboard { - status = "okay"; -}; diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf deleted file mode 100644 index 4596bc3a757..00000000000 --- a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_RX_ENABLED=n diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay deleted file mode 100644 index 5f0cfe2261d..00000000000 --- a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -mbox: &cpuapp_bellboard { - status = "okay"; -}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index b386b9d2b4b..8c85a8d5150 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -44,26 +44,6 @@ tests: - "Ping \\(on channel 4\\)" - "Pong \\(on channel 4\\)" - sample.drivers.mbox.nrf54h20_bellboard: - platform_allow: - - nrf54h20pdk_nrf54h20_cpuapp - integration_platforms: - - nrf54h20pdk_nrf54h20_cpuapp - extra_args: - mbox_SNIPPET=nordic-ppr - mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf - mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay - remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf - remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay - sysbuild: true - harness: console - harness_config: - type: multi_line - ordered: false - regex: - - "Ping \\(on channel 0\\)" - - "Pong \\(on channel 0\\)" - sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp From d989e245300a8d164431aa2ddb621342367e3efb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:23 +0100 Subject: [PATCH 0743/2300] Revert "[nrf fromlist] samples: drivers: mbox: add support for nRF VEVIF" This reverts commit a66f3be42739460fc1da6cf14564b1b25e9e87cd. Signed-off-by: Robert Lubos --- samples/drivers/mbox/CMakeLists.txt | 3 +-- samples/drivers/mbox/Kconfig.sysbuild | 1 - .../nrf54h20pdk_nrf54h20_cpuapp_vevif.conf | 2 -- .../nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay | 8 ------- samples/drivers/mbox/remote/CMakeLists.txt | 3 +-- .../nrf54h20pdk_nrf54h20_cpuppr_vevif.conf | 2 -- .../nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay | 8 ------- samples/drivers/mbox/sample.yaml | 21 ------------------- 8 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf delete mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay delete mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf delete mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index c69621c2496..ec79db9deed 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -17,8 +17,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0") OR - ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuapp")) + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index aca48b8ead3..a17dd56ee55 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -14,4 +14,3 @@ string default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" - default "nrf54h20pdk_nrf54h20_cpuppr" if $(BOARD) = "nrf54h20pdk_nrf54h20_cpuapp" diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf deleted file mode 100644 index d8d66e9812d..00000000000 --- a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_RX_ENABLED=n -CONFIG_TX_CHANNEL_ID=4 diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay deleted file mode 100644 index ed631f04cc3..00000000000 --- a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -mbox: &cpuppr_vevif { - status = "okay"; -}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index cb024cb6112..2c7c8fff29e 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -15,8 +15,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1") OR - ("${BOARD}" STREQUAL "adp_xc7k_ae350") OR - ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuppr")) + ("${BOARD}" STREQUAL "adp_xc7k_ae350")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf deleted file mode 100644 index 19e03b75c63..00000000000 --- a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_TX_ENABLED=n -CONFIG_RX_CHANNEL_ID=4 diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay deleted file mode 100644 index ed631f04cc3..00000000000 --- a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -mbox: &cpuppr_vevif { - status = "okay"; -}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 8c85a8d5150..e38deda55d3 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -23,27 +23,6 @@ tests: - "Pong \\(on channel 0\\)" - "Ping \\(on channel 1\\)" - "Pong \\(on channel 1\\)" - - sample.drivers.mbox.nrf54h20_vevif: - platform_allow: - - nrf54h20pdk_nrf54h20_cpuapp - integration_platforms: - - nrf54h20pdk_nrf54h20_cpuapp - extra_args: - mbox_SNIPPET=nordic-ppr - mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf - mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay - remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf - remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay - sysbuild: true - harness: console - harness_config: - type: multi_line - ordered: false - regex: - - "Ping \\(on channel 4\\)" - - "Pong \\(on channel 4\\)" - sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp From 24cab3488d46583f4c6e5e50026e830ee6a0648e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:24 +0100 Subject: [PATCH 0744/2300] Revert "[nrf fromlist] boards: nrf54h20pdk: Add default IPC configuration" This reverts commit f256013e8ee1d18284e575bef6470f4e20a633e9. Signed-off-by: Robert Lubos --- .../nrf54h20pdk_nrf54h20-ipc_conf.dtsi | 36 ------------------- .../nrf54h20pdk_nrf54h20_cpuapp.dts | 29 --------------- .../nrf54h20pdk_nrf54h20_cpurad.dts | 24 ------------- .../nrf54h20pdk_nrf54h20_cpuppr.dts | 11 ------ 4 files changed, 100 deletions(-) delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi deleted file mode 100644 index 9c3d971b9bc..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - ipc { - cpusec_cpuapp_ipc: ipc-1-2 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpusec_bellboard 12>, - <&cpuapp_bellboard 0>; - }; - - cpusec_cpurad_ipc: ipc-1-3 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpusec_bellboard 18>, - <&cpurad_bellboard 0>; - }; - - cpuapp_cpurad_ipc: ipc-2-3 { - status = "disabled"; - mboxes = <&cpuapp_bellboard 18>, - <&cpurad_bellboard 12>; - }; - - cpuapp_cpuppr_ipc: ipc-2-13 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpuapp_bellboard 13>, - <&cpuppr_vevif 12>; - }; - }; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index b2db9e4b9b1..0251fbded25 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -8,11 +8,8 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" -/delete-node/ &cpusec_cpurad_ipc; - / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpuapp"; model = "Nordic nRF54H20 PDK nRF54H20 Application MCU"; @@ -96,32 +93,6 @@ status = "okay"; }; -&cpuapp_bellboard { - interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; - interrupt-names = "irq0"; - /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ - nordic,interrupt-mapping = <0x00042001 0>; -}; - -&cpusec_cpuapp_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpuapp_cpusec_ipc_shm>; - rx-region = <&cpusec_cpuapp_ipc_shm>; -}; - -&cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-initiator"; - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpurad_ipc_shm>; - rx-region = <&cpurad_cpuapp_ipc_shm>; -}; - -&cpuapp_cpuppr_ipc { - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpuppr_ipc_shm>; - rx-region = <&cpuppr_cpuapp_ipc_shm>; -}; - &cpuapp_dma_region { status = "okay"; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index 8d2629df62e..d639847e197 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -8,12 +8,8 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" -/delete-node/ &cpuapp_cpuppr_ipc; -/delete-node/ &cpusec_cpuapp_ipc; - / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpurad"; model = "Nordic nRF54H20 PDK nRF54H20 Radio MCU"; @@ -30,26 +26,6 @@ status = "okay"; }; -&cpurad_bellboard { - interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; - interrupt-names = "irq0"; - /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ - nordic,interrupt-mapping = <0x00001001 0>; -}; - -&cpusec_cpurad_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpusec_ipc_shm>; - rx-region = <&cpusec_cpurad_ipc_shm>; -}; - -&cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-follower"; - mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpuapp_ipc_shm>; - rx-region = <&cpuapp_cpurad_ipc_shm>; -}; - &cpurad_dma_region { status = "okay"; }; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts index f98abb9e44b..3c74e7c88d4 100644 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts @@ -8,13 +8,8 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" -/delete-node/ &cpuapp_cpurad_ipc; -/delete-node/ &cpusec_cpuapp_ipc; -/delete-node/ &cpusec_cpurad_ipc; - / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpuppr"; model = "Nordic nRF54H20 PDK nRF54H20 Peripheral Processor MCU"; @@ -29,12 +24,6 @@ }; }; -&cpuapp_cpuppr_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpuppr_cpuapp_ipc_shm>; - rx-region = <&cpuapp_cpuppr_ipc_shm>; -}; - &grtc { status = "okay"; owned-channels = <5>; From fefe81d372e214e99f6a1849909a4473f0318e01 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:24 +0100 Subject: [PATCH 0745/2300] Revert "[nrf fromlist] boards: nrf54h20pdk_nrf54h20: Update memory map" This reverts commit ccbbadfcea727cdd93d6a314f996896552313e60. Signed-off-by: Robert Lubos --- .../nrf54h20pdk_nrf54h20-memory_map.dtsi | 100 +----------------- .../nrf54h20pdk_nrf54h20_cpuapp.dts | 8 +- .../nrf54h20pdk_nrf54h20_cpurad.dts | 2 +- 3 files changed, 4 insertions(+), 106 deletions(-) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi index 560700b1756..cb5a4fe0b0c 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi @@ -6,96 +6,6 @@ / { reserved-memory { - cpuapp_ram0x_region: memory@2f000000 { - compatible = "nordic,owned-memory"; - reg = <0x2f000000 DT_SIZE_K(260)>; - status = "disabled"; - perm-read; - perm-write; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f000000 0x41000>; - - cpusec_cpuapp_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpuapp_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - - cpuapp_data: memory@1000 { - reg = <0x1000 DT_SIZE_K(256)>; - }; - }; - - cpurad_ram0x_region: memory@2f041000 { - compatible = "nordic,owned-memory"; - reg = <0x2f041000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f041000 0x1000>; - - cpusec_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpurad_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - }; - - cpuapp_cpurad_ram0x_region: memory@2f0bf000 { - compatible = "nordic,owned-memory"; - reg = <0x2f0bf000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f0bf000 0x1000>; - - cpuapp_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpurad_cpuapp_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - }; - - shared_ram20_region: memory@2f88f000 { - compatible = "nordic,owned-memory"; - reg = <0x2f88f000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f88f000 0x1000>; - - cpuapp_cpusys_ipc_shm: memory@ce0 { - reg = <0xce0 0x80>; - }; - - cpusys_cpuapp_ipc_shm: memory@d60 { - reg = <0xd60 0x80>; - }; - - cpurad_cpusys_ipc_shm: memory@e00 { - reg = <0xe00 0x80>; - }; - - cpusys_cpurad_ipc_shm: memory@e80 { - reg = <0xe80 0x80>; - }; - }; - cpuppr_ram3x_region: memory@2fc00000 { compatible = "nordic,owned-memory"; reg = <0x2fc00000 DT_SIZE_K(28)>; @@ -105,7 +15,7 @@ perm-execute; }; - shared_ram3x_region: memory@2fc07000 { + ram3x_dma_region: memory@2fc07000 { compatible = "nordic,owned-memory"; reg = <0x2fc07000 DT_SIZE_K(4)>; status = "disabled"; @@ -115,14 +25,6 @@ #size-cells = <1>; ranges = <0x0 0x2fc07000 0x1000>; - cpuapp_cpuppr_ipc_shm: memory@0 { - reg = <0x0 0x340>; - }; - - cpuppr_cpuapp_ipc_shm: memory@340 { - reg = <0x340 0x340>; - }; - cpuapp_dma_region: memory@680 { compatible = "zephyr,memory-region"; reg = <0x680 DT_SIZE_K(2)>; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 0251fbded25..8500d22a924 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -18,7 +18,7 @@ zephyr,console = &uart136; zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; - zephyr,sram = &cpuapp_data; + zephyr,sram = &cpuapp_ram0; }; aliases { @@ -85,11 +85,7 @@ }; }; -&cpuapp_ram0x_region { - status = "okay"; -}; - -&shared_ram3x_region { +&ram3x_dma_region { status = "okay"; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index d639847e197..a7d142b06c4 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -22,7 +22,7 @@ }; }; -&shared_ram3x_region { +&ram3x_dma_region { status = "okay"; }; From 944de9a5ffd67ee5ad8d8f7d55f82e86da1c06b3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:24 +0100 Subject: [PATCH 0746/2300] Revert "[nrf fromlist] dts: nordic: nrf54h20_enga: add PPR VEVIF nodes" This reverts commit eb64ac18ece7b8c7054c6a9710e3b9ca92f8acad. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 1 - dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 1 - dts/common/nordic/nrf54h20_enga.dtsi | 34 ---------------------- dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 1 - 4 files changed, 37 deletions(-) diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi index 7252b3d5a04..25585659968 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -9,7 +9,6 @@ cpu: &cpuapp {}; systick: &cpuapp_systick {}; nvic: &cpuapp_nvic {}; -cpuppr_vevif: &cpuppr_vevif_remote {}; /delete-node/ &cpuppr; /delete-node/ &cpurad; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi index d2aaa790349..e51ce316c3f 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -9,7 +9,6 @@ cpu: &cpurad {}; systick: &cpurad_systick {}; nvic: &cpurad_nvic {}; -cpuppr_vevif: &cpuppr_vevif_remote {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 610fbd81587..3a8a5759268 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -40,31 +40,6 @@ clock-frequency = ; riscv,isa = "rv32emc"; nordic,bus-width = <32>; - - cpuppr_vevif_local: mailbox { - compatible = "nordic,nrf-vevif-local"; - status = "disabled"; - interrupt-parent = <&cpuppr_clic>; - interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, - <1 NRF_DEFAULT_IRQ_PRIORITY>, - <2 NRF_DEFAULT_IRQ_PRIORITY>, - <3 NRF_DEFAULT_IRQ_PRIORITY>, - <4 NRF_DEFAULT_IRQ_PRIORITY>, - <5 NRF_DEFAULT_IRQ_PRIORITY>, - <6 NRF_DEFAULT_IRQ_PRIORITY>, - <7 NRF_DEFAULT_IRQ_PRIORITY>, - <8 NRF_DEFAULT_IRQ_PRIORITY>, - <9 NRF_DEFAULT_IRQ_PRIORITY>, - <10 NRF_DEFAULT_IRQ_PRIORITY>, - <11 NRF_DEFAULT_IRQ_PRIORITY>, - <12 NRF_DEFAULT_IRQ_PRIORITY>, - <13 NRF_DEFAULT_IRQ_PRIORITY>, - <14 NRF_DEFAULT_IRQ_PRIORITY>, - <15 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask = <0xfffffff0>; - }; }; }; @@ -324,15 +299,6 @@ #size-cells = <1>; ranges = <0x0 0x908000 0x4000>; - cpuppr_vevif_remote: mailbox@0 { - compatible = "nordic,nrf-vevif-remote"; - reg = <0x0 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask = <0xfffffff0>; - }; - cpuppr_clic: interrupt-controller@1000 { compatible = "nordic,nrf-clic"; reg = <0x1000 0x3000>; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi index 0af6618688f..dcefe95885c 100644 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -8,7 +8,6 @@ cpu: &cpuppr {}; clic: &cpuppr_clic {}; -cpuppr_vevif: &cpuppr_vevif_local {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; From c9f0fc043e5bfcfc6b276299a26b1b9ed97e187e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:24 +0100 Subject: [PATCH 0747/2300] Revert "[nrf fromlist] boards: arm: nrf9151dk: fix broken link" This reverts commit a75b8284e97e7fc868acd58041ec8c1ea01b7a7a. Signed-off-by: Robert Lubos --- boards/arm/nrf9151dk_nrf9151/doc/index.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/boards/arm/nrf9151dk_nrf9151/doc/index.rst b/boards/arm/nrf9151dk_nrf9151/doc/index.rst index 91e9b75ad9c..4c02e7ed372 100644 --- a/boards/arm/nrf9151dk_nrf9151/doc/index.rst +++ b/boards/arm/nrf9151dk_nrf9151/doc/index.rst @@ -26,7 +26,9 @@ Cortex-M33F CPU with ARMv8-M Security Extension and the following devices: * :abbr:`WDT (Watchdog Timer)` * :abbr:`IDAU (Implementation Defined Attribution Unit)` -More information about the board can be found at the `nRF9151 website`_. +More information about the board can be found at the +`nRF9151 DK website`_. The `Nordic Semiconductor Infocenter`_ +contains the processor's information and the datasheet. Hardware @@ -82,7 +84,8 @@ hardware features: .. _nrf9151dk_additional_hardware: Other hardware features have not been enabled yet for this board. -See the `nRF9151 website`_ for more information. +See `nRF9151 DK website`_ and `Nordic Semiconductor Infocenter`_ +for a complete list of nRF9151 DK board hardware features. Connections and IOs =================== @@ -195,6 +198,6 @@ References .. _IDAU: https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau -.. _nRF9151 website: https://www.nordicsemi.com/Products/nRF9151 +.. _nRF9151 DK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9151-DK .. _Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com .. _Trusted Firmware M: https://www.trustedfirmware.org/projects/tf-m/ From 1aedb9581cd7cd89a3cf4d79789b75b0e2fbc0b0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:24 +0100 Subject: [PATCH 0748/2300] Revert "[nrf fromlist] dts: nordic: nrf54h20_enga: add BELLBOARD nodes" This reverts commit eadc28bcec9158f7bc7caec1e1a24006df0c3a0b. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 12 ------------ dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 12 ------------ dts/common/nordic/nrf54h20_enga.dtsi | 18 ------------------ dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 12 ------------ 4 files changed, 54 deletions(-) diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi index 25585659968..f51528d5733 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -29,18 +29,6 @@ nvic: &cpuapp_nvic {}; ranges; }; -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-local"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - &gpiote130 { interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi index e51ce316c3f..cb2767381da 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -29,18 +29,6 @@ nvic: &cpurad_nvic {}; ranges; }; -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-local"; -}; - &gpiote130 { interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 3a8a5759268..5a9af57801c 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -223,24 +223,6 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; - cpusec_bellboard: mailbox@99000 { - reg = <0x99000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - cpuapp_bellboard: mailbox@9a000 { - reg = <0x9a000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - cpurad_bellboard: mailbox@9b000 { - reg = <0x9b000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - timer120: timer@8e2000 { compatible = "nordic,nrf-timer"; reg = <0x8e2000 0x1000>; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi index dcefe95885c..d42a815a4b2 100644 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -26,18 +26,6 @@ clic: &cpuppr_clic {}; }; }; -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - &gpiote130 { interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; }; From 2cd5c845edd3dfd322647cceda3b8460b9db20c4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:24 +0100 Subject: [PATCH 0749/2300] Revert "[nrf fromlist] samples: drivers: mbox: misc cleanups/enhancements" This reverts commit fdd4cbee5e08c04c725340774831a4d14d03841d. Signed-off-by: Robert Lubos --- samples/drivers/mbox/remote/src/main.c | 26 +++++++++++++------------- samples/drivers/mbox/src/main.c | 23 +++++++++++------------ 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index 1ca832a697c..31665951172 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -4,9 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include +#include #include #include -#include #if !defined(CONFIG_RX_ENABLED) && !defined(CONFIG_TX_ENABLED) #error "At least one of CONFIG_RX_ENABLED or CONFIG_TX_ENABLED must be set" @@ -22,25 +23,24 @@ static void callback(const struct device *dev, uint32_t channel, int main(void) { - int ret; - const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + const struct device *dev; - printk("Hello from REMOTE\n"); + printk("Hello from NET\n"); + + dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); #ifdef CONFIG_RX_ENABLED struct mbox_channel rx_channel; mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); - ret = mbox_register_callback(&rx_channel, callback, NULL); - if (ret < 0) { - printk("Could not register callback (%d)\n", ret); + if (mbox_register_callback(&rx_channel, callback, NULL)) { + printk("mbox_register_callback() error\n"); return 0; } - ret = mbox_set_enabled(&rx_channel, true); - if (ret < 0) { - printk("Could not enable RX channel %d (%d)\n", rx_channel.id, ret); + if (mbox_set_enabled(&rx_channel, 1)) { + printk("mbox_set_enable() error\n"); return 0; } #endif /* CONFIG_RX_ENABLED */ @@ -51,11 +51,11 @@ int main(void) mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { + printk("Ping (on channel %d)\n", tx_channel.id); - ret = mbox_send(&tx_channel, NULL); - if (ret < 0) { - printk("Could not send (%d)\n", ret); + if (mbox_send(&tx_channel, NULL) < 0) { + printk("mbox_send() error\n"); return 0; } diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index d4dd21d342f..cea34afb29a 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -4,9 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include +#include #include #include -#include #ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, @@ -18,25 +19,24 @@ static void callback(const struct device *dev, uint32_t channel, int main(void) { - int ret; - const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + const struct device *dev; printk("Hello from APP\n"); + dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + #ifdef CONFIG_RX_ENABLED struct mbox_channel rx_channel; mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); - ret = mbox_register_callback(&rx_channel, callback, NULL); - if (ret < 0) { - printk("Could not register callback (%d)\n", ret); + if (mbox_register_callback(&rx_channel, callback, NULL)) { + printk("mbox_register_callback() error\n"); return 0; } - ret = mbox_set_enabled(&rx_channel, true); - if (ret < 0) { - printk("Could not enable RX channel %d (%d)\n", rx_channel.id, ret); + if (mbox_set_enabled(&rx_channel, 1)) { + printk("mbox_set_enable() error\n"); return 0; } #endif /* CONFIG_RX_ENABLED */ @@ -51,9 +51,8 @@ int main(void) printk("Ping (on channel %d)\n", tx_channel.id); - ret = mbox_send(&tx_channel, NULL); - if (ret < 0) { - printk("Could not send (%d)\n", ret); + if (mbox_send(&tx_channel, NULL) < 0) { + printk("mbox_send() error\n"); return 0; } } From e23fb734d8cce36152f3988d692109d1c784b42c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:24 +0100 Subject: [PATCH 0750/2300] Revert "[nrf fromlist] samples: drivers: mbox: allow to enable RX/TX" This reverts commit e4189b3f9d2f1adc5abf801dca5f607b2a383abf. Signed-off-by: Robert Lubos --- samples/drivers/mbox/Kconfig | 13 ------------- samples/drivers/mbox/remote/Kconfig | 13 ------------- samples/drivers/mbox/remote/src/main.c | 20 +++----------------- samples/drivers/mbox/src/main.c | 15 +++------------ 4 files changed, 6 insertions(+), 55 deletions(-) diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig index 3af6e740bfc..79dd2d09689 100644 --- a/samples/drivers/mbox/Kconfig +++ b/samples/drivers/mbox/Kconfig @@ -10,28 +10,15 @@ config INCLUDE_REMOTE_DIR Include remote build header files. Can be used if primary image needs to be aware of size or base address of secondary image -config TX_ENABLED - bool "TX enabled" - default y - help - Enable TX - config TX_CHANNEL_ID int "Channel ID for TX" default 1 - depends on TX_ENABLED help Channel ID for TX -config RX_ENABLED - bool "RX enabled" - default y - help - Enable RX config RX_CHANNEL_ID int "Channel ID for RX" - depends on RX_ENABLED default 0 help Channel ID for RX diff --git a/samples/drivers/mbox/remote/Kconfig b/samples/drivers/mbox/remote/Kconfig index 7edb8574359..a8897e4aab0 100644 --- a/samples/drivers/mbox/remote/Kconfig +++ b/samples/drivers/mbox/remote/Kconfig @@ -3,28 +3,15 @@ source "Kconfig.zephyr" -config TX_ENABLED - bool "TX enabled" - default y - help - Enable TX - config TX_CHANNEL_ID int "Channel ID for TX" default 0 - depends on TX_ENABLED help Channel ID for TX -config RX_ENABLED - bool "RX enabled" - default y - help - Enable RX config RX_CHANNEL_ID int "Channel ID for RX" - depends on RX_ENABLED default 1 help Channel ID for RX diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index 31665951172..a256ed21daa 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -9,29 +9,23 @@ #include #include -#if !defined(CONFIG_RX_ENABLED) && !defined(CONFIG_TX_ENABLED) -#error "At least one of CONFIG_RX_ENABLED or CONFIG_TX_ENABLED must be set" -#endif - -#ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { printk("Pong (on channel %d)\n", channel); } -#endif /* CONFIG_RX_ENABLED */ int main(void) { + struct mbox_channel tx_channel; + struct mbox_channel rx_channel; const struct device *dev; printk("Hello from NET\n"); dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); -#ifdef CONFIG_RX_ENABLED - struct mbox_channel rx_channel; - + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { @@ -43,12 +37,6 @@ int main(void) printk("mbox_set_enable() error\n"); return 0; } -#endif /* CONFIG_RX_ENABLED */ - -#ifdef CONFIG_TX_ENABLED - struct mbox_channel tx_channel; - - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { @@ -61,7 +49,5 @@ int main(void) k_sleep(K_MSEC(3000)); } -#endif /* CONFIG_TX_ENABLED */ - return 0; } diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index cea34afb29a..bfe28443f95 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -9,25 +9,23 @@ #include #include -#ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { printk("Pong (on channel %d)\n", channel); } -#endif int main(void) { + struct mbox_channel tx_channel; + struct mbox_channel rx_channel; const struct device *dev; printk("Hello from APP\n"); dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); -#ifdef CONFIG_RX_ENABLED - struct mbox_channel rx_channel; - + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { @@ -39,12 +37,6 @@ int main(void) printk("mbox_set_enable() error\n"); return 0; } -#endif /* CONFIG_RX_ENABLED */ - -#ifdef CONFIG_TX_ENABLED - struct mbox_channel tx_channel; - - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { k_sleep(K_MSEC(2000)); @@ -56,6 +48,5 @@ int main(void) return 0; } } -#endif /* CONFIG_TX_ENABLED */ return 0; } From 64582e9fb2411187bb08bdb194b72fa059fce64e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:25 +0100 Subject: [PATCH 0751/2300] Revert "[nrf fromlist] samples: drivers: mbox: allow to configure RX/TX channels" This reverts commit 5529abcb2a92f4a7648001f0e846aca51e255381. Signed-off-by: Robert Lubos --- samples/drivers/mbox/Kconfig | 13 ------------- samples/drivers/mbox/remote/Kconfig | 17 ----------------- samples/drivers/mbox/remote/src/main.c | 7 +++++-- samples/drivers/mbox/src/main.c | 7 +++++-- 4 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 samples/drivers/mbox/remote/Kconfig diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig index 79dd2d09689..3837c49b6e9 100644 --- a/samples/drivers/mbox/Kconfig +++ b/samples/drivers/mbox/Kconfig @@ -9,16 +9,3 @@ config INCLUDE_REMOTE_DIR help Include remote build header files. Can be used if primary image needs to be aware of size or base address of secondary image - -config TX_CHANNEL_ID - int "Channel ID for TX" - default 1 - help - Channel ID for TX - - -config RX_CHANNEL_ID - int "Channel ID for RX" - default 0 - help - Channel ID for RX diff --git a/samples/drivers/mbox/remote/Kconfig b/samples/drivers/mbox/remote/Kconfig deleted file mode 100644 index a8897e4aab0..00000000000 --- a/samples/drivers/mbox/remote/Kconfig +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "Kconfig.zephyr" - -config TX_CHANNEL_ID - int "Channel ID for TX" - default 0 - help - Channel ID for TX - - -config RX_CHANNEL_ID - int "Channel ID for RX" - default 1 - help - Channel ID for RX diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index a256ed21daa..89039e3b277 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -9,6 +9,9 @@ #include #include +#define TX_ID (0) +#define RX_ID (1) + static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { @@ -25,8 +28,8 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); - mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); + mbox_init_channel(&tx_channel, dev, TX_ID); + mbox_init_channel(&rx_channel, dev, RX_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index bfe28443f95..d6c79729b4f 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -9,6 +9,9 @@ #include #include +#define TX_ID (1) +#define RX_ID (0) + static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { @@ -25,8 +28,8 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); - mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); + mbox_init_channel(&tx_channel, dev, TX_ID); + mbox_init_channel(&rx_channel, dev, RX_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); From 7bad1ddf091c00a73cfeb2f773218a5811f4db16 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:25 +0100 Subject: [PATCH 0752/2300] Revert "[nrf fromlist] drivers: misc: nordic_vpr_launcher: initialize earlier" This reverts commit 1bcad2f40ec7094f379848f45ac7e1810193f1ca. Signed-off-by: Robert Lubos --- drivers/misc/nordic_vpr_launcher/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/nordic_vpr_launcher/Kconfig b/drivers/misc/nordic_vpr_launcher/Kconfig index 6aeabcd251c..57605e505f2 100644 --- a/drivers/misc/nordic_vpr_launcher/Kconfig +++ b/drivers/misc/nordic_vpr_launcher/Kconfig @@ -17,7 +17,7 @@ source "subsys/logging/Kconfig.template.log_config" config NORDIC_VPR_LAUNCHER_INIT_PRIORITY int "Nordic VPR coprocessor launcher init priority" - default 0 + default KERNEL_INIT_PRIORITY_DEVICE help The init priority of the VPR coprocessor launcher. From 59e0eacc7b15e7af726a2d8b1e0b5af534ffebc2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:25 +0100 Subject: [PATCH 0753/2300] Revert "[nrf fromtree] modules: hal_nordic: require nrf-regtool 5.1.0" This reverts commit 41acdd4ac70f65f11654eaa594558562e15a8fee. Signed-off-by: Robert Lubos --- 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 c4a7134935c..6f5364ac8de 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -11,7 +11,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.1.0 + find_package(nrf-regtool 5.0.1 COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From 134e77d7f1b878a29b00a06d2fdf8422b1790603 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:25 +0100 Subject: [PATCH 0754/2300] Revert "[nrf fromtree] snippets: add snippet to boot Nordic PPR core from RAM" This reverts commit 9262b790d416b2a873310b68230886ad5ad127c4. Signed-off-by: Robert Lubos --- snippets/nordic-ppr-ram/README.rst | 11 ----------- .../boards/nrf54h20pdk_nrf54h20_cpuapp.overlay | 16 ---------------- snippets/nordic-ppr-ram/nordic-ppr-ram.overlay | 15 --------------- snippets/nordic-ppr-ram/snippet.yml | 8 -------- 4 files changed, 50 deletions(-) delete mode 100644 snippets/nordic-ppr-ram/README.rst delete mode 100644 snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay delete mode 100644 snippets/nordic-ppr-ram/nordic-ppr-ram.overlay delete mode 100644 snippets/nordic-ppr-ram/snippet.yml diff --git a/snippets/nordic-ppr-ram/README.rst b/snippets/nordic-ppr-ram/README.rst deleted file mode 100644 index 501e5073357..00000000000 --- a/snippets/nordic-ppr-ram/README.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. _nordic-ppr-ram: - -Nordic boot PPR snippet with execution from RAM (nordic-ppr-ram) -################################################################ - -Overview -******** - -This snippet allows users to build Zephyr with the capability to boot Nordic PPR -(Peripheral Processor) from another core. PPR code is executed from RAM. Note -that PPR image must be built with :kconfig:option:`CONFIG_XIP` disabled. diff --git a/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 5597c886b85..00000000000 --- a/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuppr_ram3x_region { - status = "okay"; -}; - -&cpuppr_vpr { - execution-memory = <&cpuppr_ram3x_region>; -}; - -&uart135 { - status = "reserved"; -}; diff --git a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay deleted file mode 100644 index e69c3a0d2bf..00000000000 --- a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -/* code is sourced from cpuppr code partition */ -&cpuppr_vpr { - status = "okay"; - source-memory = <&cpuppr_code_partition>; -}; - -/* code partition size must match RAM size */ -&cpuppr_code_partition { - reg = <0x126000 DT_SIZE_K(28)>; -}; diff --git a/snippets/nordic-ppr-ram/snippet.yml b/snippets/nordic-ppr-ram/snippet.yml deleted file mode 100644 index 0d6039af2e5..00000000000 --- a/snippets/nordic-ppr-ram/snippet.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: nordic-ppr-ram -append: - EXTRA_DTC_OVERLAY_FILE: nordic-ppr-ram.overlay - -boards: - nrf54h20pdk_nrf54h20_cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20pdk_nrf54h20_cpuapp.overlay From 95f556a98db592e921593295a852910ff4083848 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:25 +0100 Subject: [PATCH 0755/2300] Revert "[nrf fromtree] boards: nrf54h20pdk_nrf54h20: use XIP for PPR" This reverts commit 64e2ca95d6f82b8484eeed0abcfc95fb05c21d7b. Signed-off-by: Robert Lubos --- .../nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi | 2 +- .../arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts | 3 ++- .../nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi index cb5a4fe0b0c..00f28fad9f1 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi @@ -73,7 +73,7 @@ }; cpuppr_code_partition: partition@126000 { - reg = <0x126000 DT_SIZE_K(64)>; + reg = <0x126000 DT_SIZE_K(28)>; }; }; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 8500d22a924..5fb345ec808 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -98,7 +98,8 @@ }; &cpuppr_vpr { - execution-memory = <&cpuppr_code_partition>; + source-memory = <&cpuppr_code_partition>; + execution-memory = <&cpuppr_ram3x_region>; }; &gpiote130 { diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig index 112140693ef..fb3dca2266d 100644 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig @@ -6,7 +6,7 @@ CONFIG_SOC_NRF54H20=y CONFIG_SOC_NRF54H20_ENGA_CPUPPR=y CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUPPR=y -CONFIG_USE_DT_CODE_PARTITION=y +CONFIG_XIP=n CONFIG_SERIAL=y From 5bcc26c75f740346e207838f5a3dd732268288df Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:25 +0100 Subject: [PATCH 0756/2300] Revert "[nrf fromtree] soc: riscv: nordic_nrf: vpr: select HAS_FLASH_LOAD_OFFSET if XIP" This reverts commit 9f066cce9dffad3b6438287fca7117efc92ee319. Signed-off-by: Robert Lubos --- soc/riscv/nordic_nrf/common/vpr/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig index 3750716a713..40a7d199c0c 100644 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig @@ -14,6 +14,5 @@ config RISCV_CORE_NORDIC_VPR select RISCV_ISA_EXT_ZIFENCEI select RISCV_SOC_HAS_ISR_STACKING select RISCV_SOC_CONTEXT_SAVE - select HAS_FLASH_LOAD_OFFSET if XIP help Enable support for the RISC-V Nordic VPR core. From 6d86f2e53b94c397c0738aa7fc5e14add48ecc99 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:26 +0100 Subject: [PATCH 0757/2300] Revert "[nrf fromtree] drivers: misc: nordic_vpr_launcher: fix address handling" This reverts commit cd025655fbb8da11faf5e70c69fe95fbc8e2caa3. Signed-off-by: Robert Lubos --- drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c index 64d4969081b..161465ba02c 100644 --- a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c +++ b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c @@ -45,8 +45,8 @@ static int nordic_vpr_launcher_init(const struct device *dev) return 0; } -/* obtain VPR address either from memory or partition */ -#define VPR_ADDR(node_id) \ +/* obtain VPR source address either from memory or partition */ +#define VPR_SRC_ADDR(node_id) \ (DT_REG_ADDR(node_id) + \ COND_CODE_0(DT_FIXED_PARTITION_EXISTS(node_id), (0), (DT_REG_ADDR(DT_GPARENT(node_id))))) @@ -59,9 +59,9 @@ static int nordic_vpr_launcher_init(const struct device *dev) \ static const struct nordic_vpr_launcher_config config##inst = { \ .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ - .exec_addr = VPR_ADDR(DT_INST_PHANDLE(inst, execution_memory)), \ + .exec_addr = DT_REG_ADDR(DT_INST_PHANDLE(inst, execution_memory)), \ COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, source_memory), \ - (.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ + (.src_addr = VPR_SRC_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ .src_size = DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory)),), \ ())}; \ \ From fd04afc585161d392ce60c2bed9fc235c703075e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:26 +0100 Subject: [PATCH 0758/2300] Revert "[nrf fromtree] riscv: linker: Fallback to Kconfig when defining ROM region" This reverts commit 508e9098a1a7a00832a289223fd3ddcd1473009e. Signed-off-by: Robert Lubos --- include/zephyr/arch/riscv/common/linker.ld | 33 +++++----------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/include/zephyr/arch/riscv/common/linker.ld b/include/zephyr/arch/riscv/common/linker.ld index 3245012731d..e9ac6d32d86 100644 --- a/include/zephyr/arch/riscv/common/linker.ld +++ b/include/zephyr/arch/riscv/common/linker.ld @@ -35,43 +35,24 @@ #define ROM_END_OFFSET 0 #endif -#if defined(CONFIG_FLASH_LOAD_OFFSET) -#define FLASH_LOAD_OFFSET CONFIG_FLASH_LOAD_OFFSET -#else -#define FLASH_LOAD_OFFSET 0 -#endif - #ifdef CONFIG_XIP - -#if CONFIG_FLASH_LOAD_SIZE > 0 -#define ROM_SIZE (CONFIG_FLASH_LOAD_SIZE - ROM_END_OFFSET) -#endif - #if DT_NODE_HAS_COMPAT_STATUS(DT_CHOSEN(zephyr_flash), soc_nv_flash, okay) -#define ROM_BASE (DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) + FLASH_LOAD_OFFSET) -#ifndef ROM_SIZE +#ifdef CONFIG_FLASH_LOAD_OFFSET +#define ROM_BASE (DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) + \ + CONFIG_FLASH_LOAD_OFFSET) +#else /* !CONFIG_FLASH_LOAD_OFFSET */ +#define ROM_BASE DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) +#endif /* CONFIG_FLASH_LOAD_OFFSET */ #define ROM_SIZE (DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) - ROM_END_OFFSET) -#endif - #elif DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_flash), jedec_spi_nor) /* For jedec,spi-nor we expect the spi controller to memory map the flash * and for that mapping to be the second register property of the spi * controller. */ #define SPI_CTRL DT_PARENT(DT_CHOSEN(zephyr_flash)) -#define ROM_BASE (DT_REG_ADDR_BY_IDX(SPI_CTRL, 1) + FLASH_LOAD_OFFSET) -#ifndef ROM_SIZE +#define ROM_BASE DT_REG_ADDR_BY_IDX(SPI_CTRL, 1) #define ROM_SIZE (DT_REG_SIZE_BY_IDX(SPI_CTRL, 1) - ROM_END_OFFSET) #endif - -#else /* Use Kconfig to cover the remaining cases */ -#define ROM_BASE (CONFIG_FLASH_BASE_ADDRESS + FLASH_LOAD_OFFSET) -#ifndef ROM_SIZE -#define ROM_SIZE (CONFIG_FLASH_SIZE * 1024 - FLASH_LOAD_OFFSET - ROM_END_OFFSET) -#endif - -#endif /* DT_NODE_HAS_COMPAT_STATUS */ - #else /* CONFIG_XIP */ #define ROM_BASE CONFIG_SRAM_BASE_ADDRESS #define ROM_SIZE (KB(CONFIG_SRAM_SIZE) - ROM_END_OFFSET) From edfc03ebe9cdc59d6c57df64ad629a8aab6078c4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:26 +0100 Subject: [PATCH 0759/2300] Revert "[nrf fromtree] linker: Add flash end ROM offset" This reverts commit f5de370a5f27f6bb1f2f08a200157ff6610574a0. Signed-off-by: Robert Lubos --- cmake/linker_script/arm/linker.cmake | 4 ++-- include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld | 10 ++-------- include/zephyr/arch/arm/cortex_m/scripts/linker.ld | 10 ++-------- include/zephyr/arch/arm64/scripts/linker.ld | 10 ++-------- include/zephyr/arch/nios2/linker.ld | 7 +------ include/zephyr/arch/riscv/common/linker.ld | 12 +++--------- include/zephyr/arch/x86/memory.ld | 8 +------- 7 files changed, 13 insertions(+), 48 deletions(-) diff --git a/cmake/linker_script/arm/linker.cmake b/cmake/linker_script/arm/linker.cmake index 332d44b2435..3610260afaf 100644 --- a/cmake/linker_script/arm/linker.cmake +++ b/cmake/linker_script/arm/linker.cmake @@ -18,12 +18,12 @@ math(EXPR FLASH_ADDR if(CONFIG_FLASH_LOAD_SIZE GREATER 0) math(EXPR FLASH_SIZE - "(${CONFIG_FLASH_LOAD_SIZE} + 0) - (${CONFIG_ROM_END_OFFSET} + 0)" + "(${CONFIG_FLASH_LOAD_SIZE} + 0)" OUTPUT_FORMAT HEXADECIMAL ) else() math(EXPR FLASH_SIZE - "(${CONFIG_FLASH_SIZE} + 0) * 1024 - (${CONFIG_FLASH_LOAD_OFFSET} + 0) - (${CONFIG_ROM_END_OFFSET} + 0)" + "(${CONFIG_FLASH_SIZE} + 0) * 1024 - (${CONFIG_FLASH_LOAD_OFFSET} + 0)" OUTPUT_FORMAT HEXADECIMAL ) endif() 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 a28209c1b43..f8b117e9193 100644 --- a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld @@ -32,16 +32,10 @@ #define ROM_ADDR (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET) #endif -#if defined(CONFIG_ROM_END_OFFSET) -#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET -#else -#define ROM_END_OFFSET 0 -#endif - #if CONFIG_FLASH_LOAD_SIZE > 0 - #define ROM_SIZE (CONFIG_FLASH_LOAD_SIZE - ROM_END_OFFSET) + #define ROM_SIZE CONFIG_FLASH_LOAD_SIZE #else - #define ROM_SIZE (CONFIG_FLASH_SIZE*1K - CONFIG_FLASH_LOAD_OFFSET - ROM_END_OFFSET) + #define ROM_SIZE (CONFIG_FLASH_SIZE*1K - CONFIG_FLASH_LOAD_OFFSET) #endif #if defined(CONFIG_XIP) diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 3160aa5d4ae..4fcd99b5ac8 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -32,16 +32,10 @@ #define ROM_ADDR (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET) #endif -#if defined(CONFIG_ROM_END_OFFSET) -#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET -#else -#define ROM_END_OFFSET 0 -#endif - #if CONFIG_FLASH_LOAD_SIZE > 0 -#define ROM_SIZE (CONFIG_FLASH_LOAD_SIZE - ROM_END_OFFSET) +#define ROM_SIZE CONFIG_FLASH_LOAD_SIZE #else -#define ROM_SIZE (CONFIG_FLASH_SIZE * 1024 - CONFIG_FLASH_LOAD_OFFSET - ROM_END_OFFSET) +#define ROM_SIZE (CONFIG_FLASH_SIZE * 1024 - CONFIG_FLASH_LOAD_OFFSET) #endif #if defined(CONFIG_XIP) diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index 5a8e1404a98..ad7832f16ec 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -31,16 +31,10 @@ #define ROM_ADDR (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET) #endif -#if defined(CONFIG_ROM_END_OFFSET) -#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET -#else -#define ROM_END_OFFSET 0 -#endif - #if CONFIG_FLASH_LOAD_SIZE > 0 - #define ROM_SIZE (CONFIG_FLASH_LOAD_SIZE - ROM_END_OFFSET) + #define ROM_SIZE CONFIG_FLASH_LOAD_SIZE #else - #define ROM_SIZE (CONFIG_FLASH_SIZE * 1K - CONFIG_FLASH_LOAD_OFFSET - ROM_END_OFFSET) + #define ROM_SIZE (CONFIG_FLASH_SIZE * 1K - CONFIG_FLASH_LOAD_OFFSET) #endif #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K) diff --git a/include/zephyr/arch/nios2/linker.ld b/include/zephyr/arch/nios2/linker.ld index f7ba64088fc..6958533eaf6 100644 --- a/include/zephyr/arch/nios2/linker.ld +++ b/include/zephyr/arch/nios2/linker.ld @@ -39,11 +39,6 @@ * the exception vector is in RAM */ -#if defined(CONFIG_ROM_END_OFFSET) -#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET -#else -#define ROM_END_OFFSET 0 -#endif #ifdef CONFIG_XIP #define ROMABLE_REGION FLASH @@ -59,7 +54,7 @@ ASSERT(_RESET_VECTOR == _ROM_ADDR, "Reset vector not at beginning of ROM!") MEMORY { RESET (rx) : ORIGIN = _RESET_VECTOR, LENGTH = 0x20 - FLASH (rx) : ORIGIN = _RESET_VECTOR + 0x20 , LENGTH = (_ROM_SIZE - 0x20 - ROM_END_OFFSET) + FLASH (rx) : ORIGIN = _RESET_VECTOR + 0x20 , LENGTH = (_ROM_SIZE - 0x20) RAM (wx) : ORIGIN = _EXC_VECTOR, LENGTH = _RAM_SIZE - (_EXC_VECTOR - _RAM_ADDR) /* Used by and documented in include/linker/intlist.ld */ IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K diff --git a/include/zephyr/arch/riscv/common/linker.ld b/include/zephyr/arch/riscv/common/linker.ld index e9ac6d32d86..128f823c4df 100644 --- a/include/zephyr/arch/riscv/common/linker.ld +++ b/include/zephyr/arch/riscv/common/linker.ld @@ -29,12 +29,6 @@ #define _EXCEPTION_SECTION_NAME exceptions #define _RESET_SECTION_NAME reset -#if defined(CONFIG_ROM_END_OFFSET) -#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET -#else -#define ROM_END_OFFSET 0 -#endif - #ifdef CONFIG_XIP #if DT_NODE_HAS_COMPAT_STATUS(DT_CHOSEN(zephyr_flash), soc_nv_flash, okay) #ifdef CONFIG_FLASH_LOAD_OFFSET @@ -43,7 +37,7 @@ #else /* !CONFIG_FLASH_LOAD_OFFSET */ #define ROM_BASE DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) #endif /* CONFIG_FLASH_LOAD_OFFSET */ -#define ROM_SIZE (DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) - ROM_END_OFFSET) +#define ROM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) #elif DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_flash), jedec_spi_nor) /* For jedec,spi-nor we expect the spi controller to memory map the flash * and for that mapping to be the second register property of the spi @@ -51,11 +45,11 @@ */ #define SPI_CTRL DT_PARENT(DT_CHOSEN(zephyr_flash)) #define ROM_BASE DT_REG_ADDR_BY_IDX(SPI_CTRL, 1) -#define ROM_SIZE (DT_REG_SIZE_BY_IDX(SPI_CTRL, 1) - ROM_END_OFFSET) +#define ROM_SIZE DT_REG_SIZE_BY_IDX(SPI_CTRL, 1) #endif #else /* CONFIG_XIP */ #define ROM_BASE CONFIG_SRAM_BASE_ADDRESS -#define ROM_SIZE (KB(CONFIG_SRAM_SIZE) - ROM_END_OFFSET) +#define ROM_SIZE KB(CONFIG_SRAM_SIZE) #endif /* CONFIG_XIP */ #define RAM_BASE CONFIG_SRAM_BASE_ADDRESS diff --git a/include/zephyr/arch/x86/memory.ld b/include/zephyr/arch/x86/memory.ld index c9ede2b9d23..72b400dd079 100644 --- a/include/zephyr/arch/x86/memory.ld +++ b/include/zephyr/arch/x86/memory.ld @@ -50,18 +50,12 @@ /* "kernel RAM" for linker VMA allocations starts at the offset */ -#if defined(CONFIG_ROM_END_OFFSET) -#define ROM_END_OFFSET CONFIG_ROM_END_OFFSET -#else -#define ROM_END_OFFSET 0 -#endif - #ifdef CONFIG_XIP /* "ROM" is flash, we leave rodata and text there and just copy in data. * Board-level DTS must specify a flash region that doesn't overlap with * sram0, so that DT_PHYS_LOAD_ADDR is set. */ - #define FLASH_ROM_SIZE (DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) - ROM_END_OFFSET) + #define FLASH_ROM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) #define PHYS_LOAD_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) #else /* Physical RAM location where the kernel image is loaded */ From 7f00a9a7b42f0bfe39e1a4b9d55c6f8c0dbe2e93 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:26 +0100 Subject: [PATCH 0760/2300] Revert "[nrf fromtree] cmake: linker: arm: Fix missing flash load size use" This reverts commit 917c74752a2b6b4ea0bf7bc4f44396057e9b990c. Signed-off-by: Robert Lubos --- cmake/linker_script/arm/linker.cmake | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/cmake/linker_script/arm/linker.cmake b/cmake/linker_script/arm/linker.cmake index 3610260afaf..0c7310ab905 100644 --- a/cmake/linker_script/arm/linker.cmake +++ b/cmake/linker_script/arm/linker.cmake @@ -16,17 +16,10 @@ math(EXPR FLASH_ADDR OUTPUT_FORMAT HEXADECIMAL ) -if(CONFIG_FLASH_LOAD_SIZE GREATER 0) - math(EXPR FLASH_SIZE - "(${CONFIG_FLASH_LOAD_SIZE} + 0)" - OUTPUT_FORMAT HEXADECIMAL - ) -else() - math(EXPR FLASH_SIZE - "(${CONFIG_FLASH_SIZE} + 0) * 1024 - (${CONFIG_FLASH_LOAD_OFFSET} + 0)" - OUTPUT_FORMAT HEXADECIMAL - ) -endif() +math(EXPR FLASH_SIZE + "(${CONFIG_FLASH_SIZE} + 0) * 1024 - (${CONFIG_FLASH_LOAD_OFFSET} + 0)" + OUTPUT_FORMAT HEXADECIMAL +) set(RAM_ADDR ${CONFIG_SRAM_BASE_ADDRESS}) math(EXPR RAM_SIZE "(${CONFIG_SRAM_SIZE} + 0) * 1024" OUTPUT_FORMAT HEXADECIMAL) From cdfb9ccfde88206d2c812fb922b0306df35cdfaf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:26 +0100 Subject: [PATCH 0761/2300] Revert "[nrf fromtree] samples: drivers: mbox: remove mimxrt595_evk_cm33" This reverts commit 668b9c46299a1087d09ee0ca6f52c9758bc7bfb6. Signed-off-by: Robert Lubos --- samples/drivers/mbox/CMakeLists.txt | 1 + samples/drivers/mbox/Kconfig.sysbuild | 1 + samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf | 1 + samples/drivers/mbox/sample.yaml | 1 + 4 files changed, 4 insertions(+) create mode 100644 samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index ec79db9deed..ca6513822a8 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -17,6 +17,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR + ("${BOARD}" STREQUAL "mimxrt595_evk_cm33") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) message(STATUS "${BOARD} compile as Main in this sample") else() diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index a17dd56ee55..20903872c34 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -10,6 +10,7 @@ string default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" default "adp_xc7k_ae350" if $(BOARD) = "adp_xc7k_ae350" + default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "mimxrt595_evk_cm33" default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" diff --git a/samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf b/samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf new file mode 100644 index 00000000000..b01ff58e024 --- /dev/null +++ b/samples/drivers/mbox/boards/mimxrt595_evk_cm33.conf @@ -0,0 +1 @@ +CONFIG_MBOX_NXP_IMX_MU=y diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index e38deda55d3..d646b241e9e 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -8,6 +8,7 @@ tests: platform_allow: - nrf5340dk_nrf5340_cpuapp - adp_xc7k_ae350 + - mimxrt595_evk_cm33 - mimxrt1170_evkb_cm7 - mimxrt1170_evk_cm7 - mimxrt1160_evk_cm7 From ce7e2be33312ac59402e40afd5745574b5a3a473 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:26 +0100 Subject: [PATCH 0762/2300] Revert "[nrf fromtree] samples: tests: mbox: Add lpcpresso55s69 support" This reverts commit a80e82990c338fba8913c3d547377a405d517d7b. Signed-off-by: Robert Lubos --- samples/drivers/mbox/CMakeLists.txt | 5 +-- samples/drivers/mbox/Kconfig.sysbuild | 3 +- .../mbox/boards/lpcxpresso55s69_cpu0.conf | 3 -- .../mbox/boards/lpcxpresso55s69_cpu0.overlay | 29 ------------- samples/drivers/mbox/remote/CMakeLists.txt | 3 +- .../remote/boards/lpcxpresso55s69_cpu1.conf | 10 ----- .../boards/lpcxpresso55s69_cpu1.overlay | 43 ------------------- samples/drivers/mbox/sample.yaml | 1 - samples/drivers/mbox/sysbuild.cmake | 5 +-- samples/drivers/mbox_data/CMakeLists.txt | 3 +- samples/drivers/mbox_data/Kconfig.sysbuild | 1 - samples/drivers/mbox_data/README.rst | 11 +---- .../boards/lpcxpresso55s69_cpu0.conf | 3 -- .../boards/lpcxpresso55s69_cpu0.overlay | 29 ------------- .../drivers/mbox_data/remote/CMakeLists.txt | 3 +- .../remote/boards/lpcxpresso55s69_cpu1.conf | 3 -- .../boards/lpcxpresso55s69_cpu1.overlay | 29 ------------- samples/drivers/mbox_data/remote/src/main.c | 10 +---- samples/drivers/mbox_data/sample.yaml | 2 - samples/drivers/mbox_data/src/main.c | 10 +---- tests/drivers/mbox/mbox_data/CMakeLists.txt | 3 +- tests/drivers/mbox/mbox_data/Kconfig.sysbuild | 1 - .../boards/lpcxpresso55s69_cpu0.conf | 3 -- .../boards/lpcxpresso55s69_cpu0.overlay | 29 ------------- .../mbox/mbox_data/remote/CMakeLists.txt | 3 +- .../remote/boards/lpcxpresso55s69_cpu1.conf | 3 -- .../boards/lpcxpresso55s69_cpu1.overlay | 29 ------------- .../drivers/mbox/mbox_data/remote/src/main.c | 10 +---- tests/drivers/mbox/mbox_data/src/main.c | 19 ++------ tests/drivers/mbox/mbox_data/testcase.yaml | 2 - west.yml | 2 +- 31 files changed, 18 insertions(+), 292 deletions(-) delete mode 100644 samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.conf delete mode 100644 samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.overlay delete mode 100644 samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.conf delete mode 100644 samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.overlay delete mode 100644 samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.conf delete mode 100644 samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.overlay delete mode 100644 samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf delete mode 100644 samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay delete mode 100644 tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.conf delete mode 100644 tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.overlay delete mode 100644 tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf delete mode 100644 tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index ca6513822a8..4344f4f3ce9 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -1,6 +1,6 @@ # # Copyright (c) 2021 Carlo Caione -# Copyright 2023-2024 NXP +# Copyright 2023 NXP # # SPDX-License-Identifier: Apache-2.0 # @@ -17,8 +17,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt595_evk_cm33") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) + ("${BOARD}" STREQUAL "mimxrt595_evk_cm33")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 20903872c34..f472576df82 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -1,5 +1,5 @@ # Copyright 2023 Nordic Semiconductor ASA -# Copyright 2023-2024 NXP +# Copyright 2023 NXP # # SPDX-License-Identifier: Apache-2.0 @@ -14,4 +14,3 @@ string default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" - default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" diff --git a/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.conf b/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.conf deleted file mode 100644 index 5077d775881..00000000000 --- a/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_SECOND_CORE_MCUX=y -CONFIG_MBOX_NXP_MAILBOX=y -CONFIG_BUILD_OUTPUT_HEX=y diff --git a/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.overlay b/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.overlay deleted file mode 100644 index b5919c4fd72..00000000000 --- a/samples/drivers/mbox/boards/lpcxpresso55s69_cpu0.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,lpc-mailbox */ - /delete-node/ mailbox@8b000; - - /* Attach MBOX driver to Mailbox Unit */ - mbox:mailbox0@5008b000 { - compatible = "nxp,mbox-mailbox"; - reg = <0x5008b000 0xEC>; - interrupts = <31 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index 2c7c8fff29e..e7db9b8cadf 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -1,6 +1,6 @@ # # Copyright (c) 2021 Carlo Caione -# Copyright 2023-2024 NXP +# Copyright 2023 NXP # # SPDX-License-Identifier: Apache-2.0 # @@ -14,7 +14,6 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1") OR ("${BOARD}" STREQUAL "adp_xc7k_ae350")) message(STATUS "${BOARD} compile as remote in this sample") else() diff --git a/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.conf b/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.conf deleted file mode 100644 index b499f5da051..00000000000 --- a/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.conf +++ /dev/null @@ -1,10 +0,0 @@ -CONFIG_SECOND_CORE_MCUX=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_MBOX_NXP_MAILBOX=y - -# For purpose of sample enable UART Console on CPU1 -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y -CONFIG_SERIAL=y -CONFIG_UART_INTERRUPT_DRIVEN=y -CONFIG_CLOCK_CONTROL=y diff --git a/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.overlay b/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.overlay deleted file mode 100644 index 36e6f0ff267..00000000000 --- a/samples/drivers/mbox/remote/boards/lpcxpresso55s69_cpu1.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - zephyr,console = &flexcomm0; - zephyr,shell-uart = &flexcomm0; - }; - - soc { - /* Delete IPM Driver node nxp,lpc-mailbox */ - /delete-node/ mailbox@8b000; - - /* Attach MBOX driver to Mailbox Unit */ - mbox:mbox@5008b000 { - compatible = "nxp,mbox-mailbox"; - reg = <0x5008b000 0xEC>; - interrupts = <31 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; - -&flexcomm0 { - status = "okay"; -}; - -&dma0 { - status = "okay"; -}; - -&syscon { - status = "okay"; -}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index d646b241e9e..e8015cf7c25 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -12,7 +12,6 @@ tests: - mimxrt1170_evkb_cm7 - mimxrt1170_evk_cm7 - mimxrt1160_evk_cm7 - - lpcxpresso55s69_cpu0 integration_platforms: - nrf5340dk_nrf5340_cpuapp harness: console diff --git a/samples/drivers/mbox/sysbuild.cmake b/samples/drivers/mbox/sysbuild.cmake index 063f6157ddb..7a5d32d4c74 100644 --- a/samples/drivers/mbox/sysbuild.cmake +++ b/samples/drivers/mbox/sysbuild.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2023 Nordic Semiconductor ASA -# Copyright 2023-2024 NXP +# Copyright 2023 NXP # SPDX-License-Identifier: Apache-2.0 if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") @@ -22,8 +22,7 @@ native_simulator_set_final_executable(${DEFAULT_IMAGE}) if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR "${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR - "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" OR - "${BOARD}" STREQUAL "lpcxpresso55s69_cpu0" + "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" ) # For these NXP boards the main core application is dependent on # 'zephyr_image_info.h' generated by remote application. diff --git a/samples/drivers/mbox_data/CMakeLists.txt b/samples/drivers/mbox_data/CMakeLists.txt index a410ac3d214..a67552bf52e 100644 --- a/samples/drivers/mbox_data/CMakeLists.txt +++ b/samples/drivers/mbox_data/CMakeLists.txt @@ -11,8 +11,7 @@ set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox_data/Kconfig.sysbuild b/samples/drivers/mbox_data/Kconfig.sysbuild index 2ddab228177..e355713e714 100644 --- a/samples/drivers/mbox_data/Kconfig.sysbuild +++ b/samples/drivers/mbox_data/Kconfig.sysbuild @@ -9,4 +9,3 @@ string default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" - default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" diff --git a/samples/drivers/mbox_data/README.rst b/samples/drivers/mbox_data/README.rst index 1f8b1615f8e..3ead1ec3b87 100644 --- a/samples/drivers/mbox_data/README.rst +++ b/samples/drivers/mbox_data/README.rst @@ -10,7 +10,7 @@ Overview This sample demonstrates how to use the :ref:`MBOX API ` in data transfer mode. It can be used only with mbox driver which supports data transfer mode. -Sample will ping-pong up to 4 bytes of data between two cores via two mbox channels. +Sample will ping-pong 4 bytes of data between two cores via two mbox channels. After each core receives data, it increments it by one and sends it back to other core. Building and Running @@ -45,15 +45,6 @@ Building the application for mimxrt1170_evkb_cm7 :goals: debug :west-args: --sysbuild -Building the application for lpcxpresso55s69_cpu1 -================================================= - -.. zephyr-app-commands:: - :zephyr-app: samples/drivers/mbox_data/ - :board: lpcxpresso55s69_cpu1 - :goals: debug - :west-args: --sysbuild - Sample Output ============= diff --git a/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.conf b/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.conf deleted file mode 100644 index 5077d775881..00000000000 --- a/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_SECOND_CORE_MCUX=y -CONFIG_MBOX_NXP_MAILBOX=y -CONFIG_BUILD_OUTPUT_HEX=y diff --git a/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.overlay b/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.overlay deleted file mode 100644 index b5919c4fd72..00000000000 --- a/samples/drivers/mbox_data/boards/lpcxpresso55s69_cpu0.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,lpc-mailbox */ - /delete-node/ mailbox@8b000; - - /* Attach MBOX driver to Mailbox Unit */ - mbox:mailbox0@5008b000 { - compatible = "nxp,mbox-mailbox"; - reg = <0x5008b000 0xEC>; - interrupts = <31 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/samples/drivers/mbox_data/remote/CMakeLists.txt b/samples/drivers/mbox_data/remote/CMakeLists.txt index 47e1cae8628..31f6db9b641 100644 --- a/samples/drivers/mbox_data/remote/CMakeLists.txt +++ b/samples/drivers/mbox_data/remote/CMakeLists.txt @@ -9,8 +9,7 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1")) + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf b/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf deleted file mode 100644 index 14ed92ba8f4..00000000000 --- a/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_SECOND_CORE_MCUX=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_MBOX_NXP_MAILBOX=y diff --git a/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay b/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay deleted file mode 100644 index 96bd5aa1c3a..00000000000 --- a/samples/drivers/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,lpc-mailbox */ - /delete-node/ mailbox@8b000; - - /* Attach MBOX driver to Mailbox Unit */ - mbox:mbox@5008b000 { - compatible = "nxp,mbox-mailbox"; - reg = <0x5008b000 0xEC>; - interrupts = <31 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/samples/drivers/mbox_data/remote/src/main.c b/samples/drivers/mbox_data/remote/src/main.c index 0f3ad77a4d0..9fccf155c23 100644 --- a/samples/drivers/mbox_data/remote/src/main.c +++ b/samples/drivers/mbox_data/remote/src/main.c @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -42,13 +41,6 @@ int main(void) mbox_init_channel(&tx_channel, dev, TX_ID); mbox_init_channel(&rx_channel, dev, RX_ID); - const int max_transfer_size_bytes = mbox_mtu_get(dev); - /* Sample currently supports only transfer size up to 4 bytes */ - if ((max_transfer_size_bytes <= 0) || (max_transfer_size_bytes > 4)) { - printk("mbox_mtu_get() error\n"); - return 0; - } - if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); return 0; @@ -69,7 +61,7 @@ int main(void) message++; msg.data = &message; - msg.size = max_transfer_size_bytes; + msg.size = 4; printk("Server send (on channel %d) value: %d\n", tx_channel.id, message); if (mbox_send(&tx_channel, &msg) < 0) { diff --git a/samples/drivers/mbox_data/sample.yaml b/samples/drivers/mbox_data/sample.yaml index b4a1e23a9bc..5484233b2e8 100644 --- a/samples/drivers/mbox_data/sample.yaml +++ b/samples/drivers/mbox_data/sample.yaml @@ -9,10 +9,8 @@ tests: - mimxrt1170_evkb_cm7 - mimxrt1170_evk_cm7 - mimxrt1160_evk_cm7 - - lpcxpresso55s69_cpu0 integration_platforms: - mimxrt1160_evk_cm7 - - lpcxpresso55s69_cpu0 harness: console harness_config: type: multi_line diff --git a/samples/drivers/mbox_data/src/main.c b/samples/drivers/mbox_data/src/main.c index 85df24940c4..27c29b07554 100644 --- a/samples/drivers/mbox_data/src/main.c +++ b/samples/drivers/mbox_data/src/main.c @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -42,13 +41,6 @@ int main(void) mbox_init_channel(&tx_channel, dev, TX_ID); mbox_init_channel(&rx_channel, dev, RX_ID); - const int max_transfer_size_bytes = mbox_mtu_get(dev); - /* Sample currently supports only transfer size up to 4 bytes */ - if ((max_transfer_size_bytes < 0) || (max_transfer_size_bytes > 4)) { - printk("mbox_mtu_get() error\n"); - return 0; - } - if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); return 0; @@ -61,7 +53,7 @@ int main(void) while (message < 100) { msg.data = &message; - msg.size = max_transfer_size_bytes; + msg.size = 4; printk("Client send (on channel %d) value: %d\n", tx_channel.id, message); if (mbox_send(&tx_channel, &msg) < 0) { diff --git a/tests/drivers/mbox/mbox_data/CMakeLists.txt b/tests/drivers/mbox/mbox_data/CMakeLists.txt index a410ac3d214..a67552bf52e 100644 --- a/tests/drivers/mbox/mbox_data/CMakeLists.txt +++ b/tests/drivers/mbox/mbox_data/CMakeLists.txt @@ -11,8 +11,7 @@ set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/tests/drivers/mbox/mbox_data/Kconfig.sysbuild b/tests/drivers/mbox/mbox_data/Kconfig.sysbuild index 2ddab228177..e355713e714 100644 --- a/tests/drivers/mbox/mbox_data/Kconfig.sysbuild +++ b/tests/drivers/mbox/mbox_data/Kconfig.sysbuild @@ -9,4 +9,3 @@ string default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" - default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" diff --git a/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.conf b/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.conf deleted file mode 100644 index 5077d775881..00000000000 --- a/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_SECOND_CORE_MCUX=y -CONFIG_MBOX_NXP_MAILBOX=y -CONFIG_BUILD_OUTPUT_HEX=y diff --git a/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.overlay b/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.overlay deleted file mode 100644 index b5919c4fd72..00000000000 --- a/tests/drivers/mbox/mbox_data/boards/lpcxpresso55s69_cpu0.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,lpc-mailbox */ - /delete-node/ mailbox@8b000; - - /* Attach MBOX driver to Mailbox Unit */ - mbox:mailbox0@5008b000 { - compatible = "nxp,mbox-mailbox"; - reg = <0x5008b000 0xEC>; - interrupts = <31 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt b/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt index 47e1cae8628..31f6db9b641 100644 --- a/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt +++ b/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt @@ -9,8 +9,7 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1")) + ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf b/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf deleted file mode 100644 index 14ed92ba8f4..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_SECOND_CORE_MCUX=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_MBOX_NXP_MAILBOX=y diff --git a/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay b/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay deleted file mode 100644 index 96bd5aa1c3a..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/boards/lpcxpresso55s69_cpu1.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,lpc-mailbox */ - /delete-node/ mailbox@8b000; - - /* Attach MBOX driver to Mailbox Unit */ - mbox:mbox@5008b000 { - compatible = "nxp,mbox-mailbox"; - reg = <0x5008b000 0xEC>; - interrupts = <31 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/tests/drivers/mbox/mbox_data/remote/src/main.c b/tests/drivers/mbox/mbox_data/remote/src/main.c index d9eba4d3b7c..7bbc1c2efd0 100644 --- a/tests/drivers/mbox/mbox_data/remote/src/main.c +++ b/tests/drivers/mbox/mbox_data/remote/src/main.c @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -51,13 +50,6 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - const int max_transfer_size_bytes = mbox_mtu_get(dev); - /* Sample currently supports only transfer size up to 4 bytes */ - if ((max_transfer_size_bytes <= 0) || (max_transfer_size_bytes > 4)) { - printk("mbox_mtu_get() error\n"); - return 0; - } - for (int i_test_channel = 0; i_test_channel < CHANNELS_TO_TEST; i_test_channel++) { mbox_init_channel(&tx_channel, dev, TEST_CHANNELS[i_test_channel][TX_CHANNEL_INDEX]); @@ -85,7 +77,7 @@ int main(void) message++; msg.data = &message; - msg.size = max_transfer_size_bytes; + msg.size = 4; if (mbox_send(&tx_channel, &msg) < 0) { printk("mbox_send() error\n"); diff --git a/tests/drivers/mbox/mbox_data/src/main.c b/tests/drivers/mbox/mbox_data/src/main.c index 82cce00ae7f..1cdfb0ca43e 100644 --- a/tests/drivers/mbox/mbox_data/src/main.c +++ b/tests/drivers/mbox/mbox_data/src/main.c @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -21,7 +20,6 @@ static uint32_t g_mbox_expected_channel; static bool g_received_size_error; static size_t g_received_size; -static int g_max_transfer_size_bytes; static struct mbox_channel g_tx_channel; static struct mbox_channel g_rx_channel; @@ -67,14 +65,6 @@ static void mbox_data_tests_before(void *f) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - g_max_transfer_size_bytes = mbox_mtu_get(dev); - /* Test currently supports only transfer size up to 4 bytes */ - if ((g_max_transfer_size_bytes < 0) || (g_max_transfer_size_bytes > 4)) { - printk("mbox_mtu_get() error\n"); - zassert_false(1, "mbox invalid maximum transfer unit: %d", - g_max_transfer_size_bytes); - } - mbox_init_channel(&g_tx_channel, dev, TEST_CHANNELS[current_channel_index][TX_CHANNEL_INDEX]); mbox_init_channel(&g_rx_channel, dev, @@ -108,17 +98,14 @@ static void mbox_test(const uint32_t data) while (test_count < 100) { /* Main core prepare test data */ msg.data = &test_data; - msg.size = g_max_transfer_size_bytes; + msg.size = 4; /* Main core send test data */ ret_val = mbox_send(&g_tx_channel, &msg); zassert_false(ret_val < 0, "mbox failed to send. ret_val: %d", ret_val); - /* Expect next received data will be incremented by one. - * And based on Maximum Transfer Unit determine expected data. - * Currently supported MTU's are 1, 2, 3, and 4 bytes. - */ - g_mbox_expected_data = test_data & ~(0xFFFFFFFF << (g_max_transfer_size_bytes * 8)); + /* Expect next received data will be incremented by one */ + g_mbox_expected_data = test_data; g_mbox_expected_data++; k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); diff --git a/tests/drivers/mbox/mbox_data/testcase.yaml b/tests/drivers/mbox/mbox_data/testcase.yaml index 72aff63ac3a..d4890ff7c55 100644 --- a/tests/drivers/mbox/mbox_data/testcase.yaml +++ b/tests/drivers/mbox/mbox_data/testcase.yaml @@ -8,7 +8,5 @@ tests: - mimxrt1170_evkb_cm7 - mimxrt1170_evk_cm7 - mimxrt1160_evk_cm7 - - lpcxpresso55s69_cpu0 integration_platforms: - mimxrt1170_evkb_cm7 - - lpcxpresso55s69_cpu0 diff --git a/west.yml b/west.yml index b55d82805b9..34bf7aaae9f 100644 --- a/west.yml +++ b/west.yml @@ -193,7 +193,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 0463d6aa0de62761fb9ae56e3521c61b0e490374 + revision: 69046233b7a7fac3138ae4dd5bcf6158e82529bb path: modules/hal/nxp groups: - hal From fdad20085b66f7649a97f7d7735307abcce4dcfb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:26 +0100 Subject: [PATCH 0763/2300] Revert "[nrf fromtree] tests: mbox: Add test for mbox with data transfer" This reverts commit 881419f4f5dfc5bcd9402404112c1d09b16bd5d3. Signed-off-by: Robert Lubos --- tests/drivers/mbox/mbox_data/CMakeLists.txt | 29 --- tests/drivers/mbox/mbox_data/Kconfig | 11 -- tests/drivers/mbox/mbox_data/Kconfig.sysbuild | 11 -- .../mbox_data/boards/mimxrt1160_evk_cm7.conf | 3 - .../boards/mimxrt1160_evk_cm7.overlay | 29 --- .../mbox_data/boards/mimxrt1170_evk_cm7.conf | 3 - .../boards/mimxrt1170_evk_cm7.overlay | 29 --- .../mbox_data/boards/mimxrt1170_evkb_cm7.conf | 3 - .../boards/mimxrt1170_evkb_cm7.overlay | 29 --- tests/drivers/mbox/mbox_data/prj.conf | 3 - .../mbox/mbox_data/remote/CMakeLists.txt | 20 -- .../remote/boards/mimxrt1160_evk_cm4.conf | 4 - .../remote/boards/mimxrt1160_evk_cm4.overlay | 54 ----- .../remote/boards/mimxrt1170_evk_cm4.conf | 4 - .../remote/boards/mimxrt1170_evk_cm4.overlay | 54 ----- .../remote/boards/mimxrt1170_evkb_cm4.conf | 4 - .../remote/boards/mimxrt1170_evkb_cm4.overlay | 55 ------ tests/drivers/mbox/mbox_data/remote/prj.conf | 3 - .../drivers/mbox/mbox_data/remote/src/main.c | 91 --------- tests/drivers/mbox/mbox_data/src/main.c | 184 ------------------ tests/drivers/mbox/mbox_data/sysbuild.cmake | 28 --- tests/drivers/mbox/mbox_data/testcase.yaml | 12 -- 22 files changed, 663 deletions(-) delete mode 100644 tests/drivers/mbox/mbox_data/CMakeLists.txt delete mode 100644 tests/drivers/mbox/mbox_data/Kconfig delete mode 100644 tests/drivers/mbox/mbox_data/Kconfig.sysbuild delete mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.conf delete mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.overlay delete mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.conf delete mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.overlay delete mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.conf delete mode 100644 tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.overlay delete mode 100644 tests/drivers/mbox/mbox_data/prj.conf delete mode 100644 tests/drivers/mbox/mbox_data/remote/CMakeLists.txt delete mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf delete mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay delete mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf delete mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay delete mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf delete mode 100644 tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay delete mode 100644 tests/drivers/mbox/mbox_data/remote/prj.conf delete mode 100644 tests/drivers/mbox/mbox_data/remote/src/main.c delete mode 100644 tests/drivers/mbox/mbox_data/src/main.c delete mode 100644 tests/drivers/mbox/mbox_data/sysbuild.cmake delete mode 100644 tests/drivers/mbox/mbox_data/testcase.yaml diff --git a/tests/drivers/mbox/mbox_data/CMakeLists.txt b/tests/drivers/mbox/mbox_data/CMakeLists.txt deleted file mode 100644 index a67552bf52e..00000000000 --- a/tests/drivers/mbox/mbox_data/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 -# - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) - -set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) - -if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) - message(STATUS "${BOARD} compile as Main in this sample") -else() - message(FATAL_ERROR "${BOARD} is not supported for this sample") -endif() - -project(mbox_data_ipc) - -enable_language(C ASM) - -if(CONFIG_INCLUDE_REMOTE_DIR) - target_include_directories(zephyr_interface - INTERFACE ${REMOTE_ZEPHYR_DIR}/include/public) -endif() - -target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/mbox/mbox_data/Kconfig b/tests/drivers/mbox/mbox_data/Kconfig deleted file mode 100644 index ee3874c39f9..00000000000 --- a/tests/drivers/mbox/mbox_data/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 - -source "Kconfig.zephyr" - -config INCLUDE_REMOTE_DIR - bool "Include remote core header directory" - help - Include remote build header files. Can be used if primary image - needs to be aware of size or base address of secondary image diff --git a/tests/drivers/mbox/mbox_data/Kconfig.sysbuild b/tests/drivers/mbox/mbox_data/Kconfig.sysbuild deleted file mode 100644 index e355713e714..00000000000 --- a/tests/drivers/mbox/mbox_data/Kconfig.sysbuild +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 - -source "share/sysbuild/Kconfig" - -config REMOTE_BOARD -string - default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" - default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" - default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.conf b/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.conf deleted file mode 100644 index 583b4950360..00000000000 --- a/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_INCLUDE_REMOTE_DIR=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.overlay b/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.overlay deleted file mode 100644 index 870b9928faf..00000000000 --- a/tests/drivers/mbox/mbox_data/boards/mimxrt1160_evk_cm7.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c48000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c48000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c48000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.conf b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.conf deleted file mode 100644 index 583b4950360..00000000000 --- a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_INCLUDE_REMOTE_DIR=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.overlay b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.overlay deleted file mode 100644 index 870b9928faf..00000000000 --- a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evk_cm7.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c48000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c48000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c48000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.conf b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.conf deleted file mode 100644 index 0dfb100ed70..00000000000 --- a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_SECOND_CORE_MCUX=y -CONFIG_INCLUDE_REMOTE_DIR=y diff --git a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.overlay b/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.overlay deleted file mode 100644 index 870b9928faf..00000000000 --- a/tests/drivers/mbox/mbox_data/boards/mimxrt1170_evkb_cm7.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c48000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c48000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c48000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/tests/drivers/mbox/mbox_data/prj.conf b/tests/drivers/mbox/mbox_data/prj.conf deleted file mode 100644 index c4c2b474a7d..00000000000 --- a/tests/drivers/mbox/mbox_data/prj.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_PRINTK=y -CONFIG_MBOX=y -CONFIG_ZTEST=y diff --git a/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt b/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt deleted file mode 100644 index 31f6db9b641..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 -# - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) - -if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) - message(STATUS "${BOARD} compile as remote in this sample") -else() - message(FATAL_ERROR "${BOARD} is not supported for this sample") -endif() - -project(mbox_data_ipc_remote) - -target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf deleted file mode 100644 index 0d36a72aec6..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_BUILD_OUTPUT_INFO_HEADER=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay deleted file mode 100644 index 3f6115b9c58..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,flash = &ocram; - zephyr,console = &lpuart2; - zephyr,shell-uart = &lpuart2; - - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /delete-node/ gpt@400f0000; - - /* Replace GPT2 with another GPT kernel timer */ - gpt2_hw_timer:gpt@400f0000 { - compatible = "nxp,gpt-hw-timer"; - reg = <0x400f0000 0x4000>; - interrupts = <120 0>; - status = "okay"; - }; - - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c4c000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c4c000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c4c000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; - -/* Enable secondary LPUART */ -&lpuart2 { - status = "okay"; - current-speed = <115200>; -}; - -/* Disable primary GPT timer */ -&gpt_hw_timer { - status = "disabled"; -}; diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf deleted file mode 100644 index 0d36a72aec6..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_BUILD_OUTPUT_INFO_HEADER=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay deleted file mode 100644 index 3f6115b9c58..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,flash = &ocram; - zephyr,console = &lpuart2; - zephyr,shell-uart = &lpuart2; - - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /delete-node/ gpt@400f0000; - - /* Replace GPT2 with another GPT kernel timer */ - gpt2_hw_timer:gpt@400f0000 { - compatible = "nxp,gpt-hw-timer"; - reg = <0x400f0000 0x4000>; - interrupts = <120 0>; - status = "okay"; - }; - - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c4c000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c4c000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c4c000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; - -/* Enable secondary LPUART */ -&lpuart2 { - status = "okay"; - current-speed = <115200>; -}; - -/* Disable primary GPT timer */ -&gpt_hw_timer { - status = "disabled"; -}; diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf deleted file mode 100644 index 0d36a72aec6..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_BUILD_OUTPUT_INFO_HEADER=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay b/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay deleted file mode 100644 index e3576826702..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,flash = &ocram; - zephyr,console = &lpuart2; - zephyr,shell-uart = &lpuart2; - - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /delete-node/ gpt@400f0000; - - /* Replace GPT2 with another GPT kernel timer */ - gpt2_hw_timer:gpt@400f0000 { - compatible = "nxp,gpt-hw-timer"; - reg = <0x400f0000 0x4000>; - interrupts = <120 0>; - status = "okay"; - }; - - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c4c000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c4c000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c4c000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; - -}; - -/* Enable secondary LPUART */ -&lpuart2 { - status = "okay"; - current-speed = <115200>; -}; - -/* Disable primary GPT timer */ -&gpt_hw_timer { - status = "disabled"; -}; diff --git a/tests/drivers/mbox/mbox_data/remote/prj.conf b/tests/drivers/mbox/mbox_data/remote/prj.conf deleted file mode 100644 index f2859becbe9..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/prj.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_STDOUT_CONSOLE=n -CONFIG_MBOX=y -# CONFIG_NO_OPTIMIZATIONS=y diff --git a/tests/drivers/mbox/mbox_data/remote/src/main.c b/tests/drivers/mbox/mbox_data/remote/src/main.c deleted file mode 100644 index 7bbc1c2efd0..00000000000 --- a/tests/drivers/mbox/mbox_data/remote/src/main.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -static K_SEM_DEFINE(g_mbox_data_rx_sem, 0, 1); - -static uint32_t g_mbox_received_data; -static uint32_t g_mbox_received_channel; - -#define TX_ID0 (2) -#define RX_ID0 (3) -#define TX_ID1 (0) -#define RX_ID1 (1) -#define TX_ID2 (3) -#define RX_ID2 (2) -#define TX_ID3 (1) -#define RX_ID3 (0) - -#define CHANNELS_TO_TEST (4) -#define TX_CHANNEL_INDEX (0) -#define RX_CHANNEL_INDEX (1) -const static uint32_t TEST_CHANNELS[CHANNELS_TO_TEST][2] = { - {TX_ID0, RX_ID0}, {TX_ID1, RX_ID1}, {TX_ID2, RX_ID2}, {TX_ID3, RX_ID3}}; - -static void callback(const struct device *dev, uint32_t channel, void *user_data, - struct mbox_msg *data) -{ - if (data != NULL) { - memcpy(&g_mbox_received_data, data->data, data->size); - g_mbox_received_channel = channel; - } - - k_sem_give(&g_mbox_data_rx_sem); -} - -int main(void) -{ - struct mbox_channel tx_channel; - struct mbox_channel rx_channel; - const struct device *dev; - struct mbox_msg msg = {0}; - uint32_t message = 0; - - dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - - for (int i_test_channel = 0; i_test_channel < CHANNELS_TO_TEST; i_test_channel++) { - mbox_init_channel(&tx_channel, dev, - TEST_CHANNELS[i_test_channel][TX_CHANNEL_INDEX]); - mbox_init_channel(&rx_channel, dev, - TEST_CHANNELS[i_test_channel][RX_CHANNEL_INDEX]); - - if (mbox_register_callback(&rx_channel, callback, NULL)) { - printk("mbox_register_callback() error\n"); - return 0; - } - - if (mbox_set_enabled(&rx_channel, 1)) { - printk("mbox_set_enable() error\n"); - return 0; - } - - int test_count = 0; - - while (test_count < 100) { - test_count++; - - k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); - message = g_mbox_received_data; - - message++; - - msg.data = &message; - msg.size = 4; - - if (mbox_send(&tx_channel, &msg) < 0) { - printk("mbox_send() error\n"); - return 0; - } - } - - /* Disable current rx channel after channel loop */ - mbox_set_enabled(&rx_channel, 0); - } -} diff --git a/tests/drivers/mbox/mbox_data/src/main.c b/tests/drivers/mbox/mbox_data/src/main.c deleted file mode 100644 index 1cdfb0ca43e..00000000000 --- a/tests/drivers/mbox/mbox_data/src/main.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -#include - -static K_SEM_DEFINE(g_mbox_data_rx_sem, 0, 1); - -static uint32_t g_mbox_received_data; -static uint32_t g_mbox_expected_data; -static uint32_t g_mbox_received_channel; -static uint32_t g_mbox_expected_channel; - -static bool g_received_size_error; -static size_t g_received_size; - -static struct mbox_channel g_tx_channel; -static struct mbox_channel g_rx_channel; - -#define TX_ID0 (3) -#define RX_ID0 (2) -#define TX_ID1 (1) -#define RX_ID1 (0) -#define TX_ID2 (2) -#define RX_ID2 (3) -#define TX_ID3 (0) -#define RX_ID3 (1) - -#define CHANNELS_TO_TEST (4) -#define TX_CHANNEL_INDEX (0) -#define RX_CHANNEL_INDEX (1) -const static uint32_t TEST_CHANNELS[CHANNELS_TO_TEST][2] = { - {TX_ID0, RX_ID0}, {TX_ID1, RX_ID1}, {TX_ID2, RX_ID2}, {TX_ID3, RX_ID3}}; -static uint32_t current_channel_index; - -static void callback(const struct device *dev, uint32_t channel, void *user_data, - struct mbox_msg *data) -{ - /* Handle the case if received invalid size */ - if (data->size > sizeof(g_mbox_received_data)) { - g_received_size_error = true; - g_received_size = data->size; - } else { - memcpy(&g_mbox_received_data, data->data, data->size); - } - - g_mbox_received_channel = channel; - - k_sem_give(&g_mbox_data_rx_sem); -} - -static void mbox_data_tests_before(void *f) -{ - zassert_false(current_channel_index >= CHANNELS_TO_TEST, "Channel to test is out of range"); - - const struct device *dev; - int ret_val = 0; - - dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - - mbox_init_channel(&g_tx_channel, dev, - TEST_CHANNELS[current_channel_index][TX_CHANNEL_INDEX]); - mbox_init_channel(&g_rx_channel, dev, - TEST_CHANNELS[current_channel_index][RX_CHANNEL_INDEX]); - - ret_val = mbox_register_callback(&g_rx_channel, callback, NULL); - zassert_false(ret_val != 0, "mbox failed to register callback. ret_val", ret_val); - - ret_val = mbox_set_enabled(&g_rx_channel, 1); - zassert_false(ret_val != 0, "mbox failed to enable mbox. ret_val: %d", ret_val); -} - -static void mbox_data_tests_after(void *f) -{ - /* Disable channel after test end */ - int ret_val = mbox_set_enabled(&g_rx_channel, 0); - - zassert_false(ret_val != 0, "mbox failed to disable mbox. ret_val: %d", ret_val); - - /* Increment current channel index to its prepared for next test */ - current_channel_index++; -} - -static void mbox_test(const uint32_t data) -{ - struct mbox_msg msg = {0}; - uint32_t test_data = data; - int test_count = 0; - int ret_val = 0; - - while (test_count < 100) { - /* Main core prepare test data */ - msg.data = &test_data; - msg.size = 4; - - /* Main core send test data */ - ret_val = mbox_send(&g_tx_channel, &msg); - zassert_false(ret_val < 0, "mbox failed to send. ret_val: %d", ret_val); - - /* Expect next received data will be incremented by one */ - g_mbox_expected_data = test_data; - g_mbox_expected_data++; - - k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); - - if (g_received_size_error) { - zassert_false(1, "mbox received invalid size in callback: %d", - g_received_size); - } - - test_data = g_mbox_received_data; - - /* Main core check received data */ - zassert_equal(g_mbox_expected_data, test_data, - "Received test_data does not match!: Expected: %08X, Got: %08X", - g_mbox_expected_data, test_data); - - /* Expect reception of data on current RX channel */ - g_mbox_expected_channel = TEST_CHANNELS[current_channel_index][RX_CHANNEL_INDEX]; - zassert_equal(g_mbox_expected_channel, g_mbox_received_channel, - "Received channel does not match!: Expected: %d, Got: %d", - g_mbox_expected_channel, g_mbox_received_channel); - - /* Increment for next send */ - test_data++; - test_count++; - } -} - -/** - * @brief MBOX Data transfer by ping pong for first set of channels - * - * This test verifies that the data transfer via MBOX. - * Main core will transfer test data to remote core. - * Remote core will increment data by one and transfer it back to Main core. - * Main core will check that data it sent to remote core was incremented by one. - * Main core will again increment test data by one, send it to remote core and repeat 100 times. - */ -ZTEST(mbox_data_tests, test_ping_pong_1) -{ - mbox_test(0xADADADAD); -} - -/** - * @brief MBOX Data transfer by ping pong for second set of channels - * - * Description same as for test_ping_pong_1 - * - */ -ZTEST(mbox_data_tests, test_ping_pong_2) -{ - mbox_test(0xDADADADA); -} - -/** - * @brief MBOX Data transfer by ping pong for third set of channels - * - * Description same as for test_ping_pong_1 - * - */ -ZTEST(mbox_data_tests, test_ping_pong_3) -{ - mbox_test(0xADADADAD); -} - -/** - * @brief MBOX Data transfer by ping pong for forth set of channels - * - * Description same as for test_ping_pong_1 - * - */ -ZTEST(mbox_data_tests, test_ping_pong_4) -{ - mbox_test(0xDADADADA); -} - -ZTEST_SUITE(mbox_data_tests, NULL, NULL, mbox_data_tests_before, mbox_data_tests_after, NULL); diff --git a/tests/drivers/mbox/mbox_data/sysbuild.cmake b/tests/drivers/mbox/mbox_data/sysbuild.cmake deleted file mode 100644 index 5c536a6229a..00000000000 --- a/tests/drivers/mbox/mbox_data/sysbuild.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 - -if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") - message(FATAL_ERROR - "Target ${BOARD} not supported for this sample. " - "There is no remote board selected in Kconfig.sysbuild") -endif() - -set(REMOTE_APP remote) - -ExternalZephyrProject_Add( - APPLICATION ${REMOTE_APP} - SOURCE_DIR ${APP_DIR}/${REMOTE_APP} - BOARD ${SB_CONFIG_REMOTE_BOARD} -) - -if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR - "${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR - "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" - ) - # For these NXP boards the main core application is dependent on - # 'zephyr_image_info.h' generated by remote application. - - # Let's build the remote application first - add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) -endif() diff --git a/tests/drivers/mbox/mbox_data/testcase.yaml b/tests/drivers/mbox/mbox_data/testcase.yaml deleted file mode 100644 index d4890ff7c55..00000000000 --- a/tests/drivers/mbox/mbox_data/testcase.yaml +++ /dev/null @@ -1,12 +0,0 @@ -tests: - drivers.mbox_data: - tags: - - drivers - - mbox - sysbuild: true - platform_allow: - - mimxrt1170_evkb_cm7 - - mimxrt1170_evk_cm7 - - mimxrt1160_evk_cm7 - integration_platforms: - - mimxrt1170_evkb_cm7 From 96fc1bdcb198f65cb0ff9e5706c45a9f10dd94ff Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:27 +0100 Subject: [PATCH 0764/2300] Revert "[nrf fromtree] samples: mbox: Add mbox sample with data transfer" This reverts commit 4776a21ef6c2afa4a77d120f4402e63ffa4e2a01. Signed-off-by: Robert Lubos --- samples/drivers/mbox_data/CMakeLists.txt | 29 ------ samples/drivers/mbox_data/Kconfig | 11 --- samples/drivers/mbox_data/Kconfig.sysbuild | 11 --- samples/drivers/mbox_data/README.rst | 95 ------------------- .../mbox_data/boards/mimxrt1160_evk_cm7.conf | 3 - .../boards/mimxrt1160_evk_cm7.overlay | 29 ------ .../mbox_data/boards/mimxrt1170_evk_cm7.conf | 3 - .../boards/mimxrt1170_evk_cm7.overlay | 29 ------ .../mbox_data/boards/mimxrt1170_evkb_cm7.conf | 3 - .../boards/mimxrt1170_evkb_cm7.overlay | 29 ------ samples/drivers/mbox_data/prj.conf | 2 - .../drivers/mbox_data/remote/CMakeLists.txt | 20 ---- .../remote/boards/mimxrt1160_evk_cm4.conf | 4 - .../remote/boards/mimxrt1160_evk_cm4.overlay | 54 ----------- .../remote/boards/mimxrt1170_evk_cm4.conf | 4 - .../remote/boards/mimxrt1170_evk_cm4.overlay | 54 ----------- .../remote/boards/mimxrt1170_evkb_cm4.conf | 4 - .../remote/boards/mimxrt1170_evkb_cm4.overlay | 55 ----------- samples/drivers/mbox_data/remote/prj.conf | 2 - samples/drivers/mbox_data/remote/src/main.c | 75 --------------- samples/drivers/mbox_data/sample.yaml | 27 ------ samples/drivers/mbox_data/src/main.c | 74 --------------- samples/drivers/mbox_data/sysbuild.cmake | 28 ------ 23 files changed, 645 deletions(-) delete mode 100644 samples/drivers/mbox_data/CMakeLists.txt delete mode 100644 samples/drivers/mbox_data/Kconfig delete mode 100644 samples/drivers/mbox_data/Kconfig.sysbuild delete mode 100644 samples/drivers/mbox_data/README.rst delete mode 100644 samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.conf delete mode 100644 samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.overlay delete mode 100644 samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.conf delete mode 100644 samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.overlay delete mode 100644 samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.conf delete mode 100644 samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.overlay delete mode 100644 samples/drivers/mbox_data/prj.conf delete mode 100644 samples/drivers/mbox_data/remote/CMakeLists.txt delete mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf delete mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay delete mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf delete mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay delete mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf delete mode 100644 samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay delete mode 100644 samples/drivers/mbox_data/remote/prj.conf delete mode 100644 samples/drivers/mbox_data/remote/src/main.c delete mode 100644 samples/drivers/mbox_data/sample.yaml delete mode 100644 samples/drivers/mbox_data/src/main.c delete mode 100644 samples/drivers/mbox_data/sysbuild.cmake diff --git a/samples/drivers/mbox_data/CMakeLists.txt b/samples/drivers/mbox_data/CMakeLists.txt deleted file mode 100644 index a67552bf52e..00000000000 --- a/samples/drivers/mbox_data/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 -# - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) - -set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) - -if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7")) - message(STATUS "${BOARD} compile as Main in this sample") -else() - message(FATAL_ERROR "${BOARD} is not supported for this sample") -endif() - -project(mbox_data_ipc) - -enable_language(C ASM) - -if(CONFIG_INCLUDE_REMOTE_DIR) - target_include_directories(zephyr_interface - INTERFACE ${REMOTE_ZEPHYR_DIR}/include/public) -endif() - -target_sources(app PRIVATE src/main.c) diff --git a/samples/drivers/mbox_data/Kconfig b/samples/drivers/mbox_data/Kconfig deleted file mode 100644 index ee3874c39f9..00000000000 --- a/samples/drivers/mbox_data/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 - -source "Kconfig.zephyr" - -config INCLUDE_REMOTE_DIR - bool "Include remote core header directory" - help - Include remote build header files. Can be used if primary image - needs to be aware of size or base address of secondary image diff --git a/samples/drivers/mbox_data/Kconfig.sysbuild b/samples/drivers/mbox_data/Kconfig.sysbuild deleted file mode 100644 index e355713e714..00000000000 --- a/samples/drivers/mbox_data/Kconfig.sysbuild +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 - -source "share/sysbuild/Kconfig" - -config REMOTE_BOARD -string - default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" - default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" - default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" diff --git a/samples/drivers/mbox_data/README.rst b/samples/drivers/mbox_data/README.rst deleted file mode 100644 index 3ead1ec3b87..00000000000 --- a/samples/drivers/mbox_data/README.rst +++ /dev/null @@ -1,95 +0,0 @@ -.. zephyr:code-sample:: mbox_data - :name: MBOX Data - :relevant-api: mbox_interface - - Perform inter-processor mailbox communication using the MBOX API with data. - -Overview -******** - -This sample demonstrates how to use the :ref:`MBOX API ` in data transfer mode. -It can be used only with mbox driver which supports data transfer mode. - -Sample will ping-pong 4 bytes of data between two cores via two mbox channels. -After each core receives data, it increments it by one and sends it back to other core. - -Building and Running -******************** - -The sample can be built and executed on boards supporting MBOX with data transfer mode. - -Building the application for mimxrt1160_evk_cm7 -=============================================== - -.. zephyr-app-commands:: - :zephyr-app: samples/drivers/mbox_data/ - :board: mimxrt1160_evk_cm7 - :goals: debug - :west-args: --sysbuild - -Building the application for mimxrt1170_evk_cm7 -=============================================== - -.. zephyr-app-commands:: - :zephyr-app: samples/drivers/mbox_data/ - :board: mimxrt1170_evk_cm7 - :goals: debug - :west-args: --sysbuild - -Building the application for mimxrt1170_evkb_cm7 -================================================ - -.. zephyr-app-commands:: - :zephyr-app: samples/drivers/mbox_data/ - :board: mimxrt1170_evkb_cm7 - :goals: debug - :west-args: --sysbuild - -Sample Output -============= - -Open a serial terminal (minicom, putty, etc.) and connect the board with the -following settings: - -- Speed: 115200 -- Data: 8 bits -- Parity: None -- Stop bits: 1 - -Reset the board and the following message will appear on the corresponding -serial port, one is the main core another is the remote core: - -.. code-block:: console - - *** Booting Zephyr OS build zephyr-v3.5.0-4051-g12f4f4dc8679 *** - mbox_data Client demo started - Client send (on channel 3) value: 0 - Client received (on channel 2) value: 1 - Client send (on channel 3) value: 2 - Client received (on channel 2) value: 3 - Client send (on channel 3) value: 4 - ... - Client received (on channel 2) value: 95 - Client send (on channel 3) value: 96 - Client received (on channel 2) value: 97 - Client send (on channel 3) value: 98 - Client received (on channel 2) value: 99 - mbox_data Client demo ended - - -.. code-block:: console - - *** Booting Zephyr OS build zephyr-v3.5.0-4051-g12f4f4dc8679 *** - mbox_data Server demo started - Server receive (on channel 3) value: 0 - Server send (on channel 2) value: 1 - Server receive (on channel 3) value: 2 - Server send (on channel 2) value: 3 - Server receive (on channel 3) value: 4 - ... - Server send (on channel 2) value: 95 - Server receive (on channel 3) value: 96 - Server send (on channel 2) value: 97 - Server receive (on channel 3) value: 98 - Server send (on channel 2) value: 99 - mbox_data Server demo ended. diff --git a/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.conf b/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.conf deleted file mode 100644 index 583b4950360..00000000000 --- a/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_INCLUDE_REMOTE_DIR=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.overlay b/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.overlay deleted file mode 100644 index 870b9928faf..00000000000 --- a/samples/drivers/mbox_data/boards/mimxrt1160_evk_cm7.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c48000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c48000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c48000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.conf b/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.conf deleted file mode 100644 index 583b4950360..00000000000 --- a/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_INCLUDE_REMOTE_DIR=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.overlay b/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.overlay deleted file mode 100644 index 870b9928faf..00000000000 --- a/samples/drivers/mbox_data/boards/mimxrt1170_evk_cm7.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c48000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c48000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c48000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.conf b/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.conf deleted file mode 100644 index 0dfb100ed70..00000000000 --- a/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_SECOND_CORE_MCUX=y -CONFIG_INCLUDE_REMOTE_DIR=y diff --git a/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.overlay b/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.overlay deleted file mode 100644 index 870b9928faf..00000000000 --- a/samples/drivers/mbox_data/boards/mimxrt1170_evkb_cm7.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c48000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c48000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c48000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/samples/drivers/mbox_data/prj.conf b/samples/drivers/mbox_data/prj.conf deleted file mode 100644 index 293e2834f25..00000000000 --- a/samples/drivers/mbox_data/prj.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_PRINTK=y -CONFIG_MBOX=y diff --git a/samples/drivers/mbox_data/remote/CMakeLists.txt b/samples/drivers/mbox_data/remote/CMakeLists.txt deleted file mode 100644 index 31f6db9b641..00000000000 --- a/samples/drivers/mbox_data/remote/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 -# - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) - -if(("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4")) - message(STATUS "${BOARD} compile as remote in this sample") -else() - message(FATAL_ERROR "${BOARD} is not supported for this sample") -endif() - -project(mbox_data_ipc_remote) - -target_sources(app PRIVATE src/main.c) diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf b/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf deleted file mode 100644 index 0d36a72aec6..00000000000 --- a/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_BUILD_OUTPUT_INFO_HEADER=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay b/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay deleted file mode 100644 index 3f6115b9c58..00000000000 --- a/samples/drivers/mbox_data/remote/boards/mimxrt1160_evk_cm4.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,flash = &ocram; - zephyr,console = &lpuart2; - zephyr,shell-uart = &lpuart2; - - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /delete-node/ gpt@400f0000; - - /* Replace GPT2 with another GPT kernel timer */ - gpt2_hw_timer:gpt@400f0000 { - compatible = "nxp,gpt-hw-timer"; - reg = <0x400f0000 0x4000>; - interrupts = <120 0>; - status = "okay"; - }; - - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c4c000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c4c000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c4c000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; - -/* Enable secondary LPUART */ -&lpuart2 { - status = "okay"; - current-speed = <115200>; -}; - -/* Disable primary GPT timer */ -&gpt_hw_timer { - status = "disabled"; -}; diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf deleted file mode 100644 index 0d36a72aec6..00000000000 --- a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_BUILD_OUTPUT_INFO_HEADER=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay deleted file mode 100644 index 3f6115b9c58..00000000000 --- a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evk_cm4.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,flash = &ocram; - zephyr,console = &lpuart2; - zephyr,shell-uart = &lpuart2; - - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /delete-node/ gpt@400f0000; - - /* Replace GPT2 with another GPT kernel timer */ - gpt2_hw_timer:gpt@400f0000 { - compatible = "nxp,gpt-hw-timer"; - reg = <0x400f0000 0x4000>; - interrupts = <120 0>; - status = "okay"; - }; - - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c4c000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c4c000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c4c000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; - -/* Enable secondary LPUART */ -&lpuart2 { - status = "okay"; - current-speed = <115200>; -}; - -/* Disable primary GPT timer */ -&gpt_hw_timer { - status = "disabled"; -}; diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf deleted file mode 100644 index 0d36a72aec6..00000000000 --- a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_BUILD_OUTPUT_INFO_HEADER=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay b/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay deleted file mode 100644 index e3576826702..00000000000 --- a/samples/drivers/mbox_data/remote/boards/mimxrt1170_evkb_cm4.overlay +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,flash = &ocram; - zephyr,console = &lpuart2; - zephyr,shell-uart = &lpuart2; - - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /delete-node/ gpt@400f0000; - - /* Replace GPT2 with another GPT kernel timer */ - gpt2_hw_timer:gpt@400f0000 { - compatible = "nxp,gpt-hw-timer"; - reg = <0x400f0000 0x4000>; - interrupts = <120 0>; - status = "okay"; - }; - - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c4c000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c4c000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c4c000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; - -}; - -/* Enable secondary LPUART */ -&lpuart2 { - status = "okay"; - current-speed = <115200>; -}; - -/* Disable primary GPT timer */ -&gpt_hw_timer { - status = "disabled"; -}; diff --git a/samples/drivers/mbox_data/remote/prj.conf b/samples/drivers/mbox_data/remote/prj.conf deleted file mode 100644 index 473e4280601..00000000000 --- a/samples/drivers/mbox_data/remote/prj.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_STDOUT_CONSOLE=n -CONFIG_MBOX=y diff --git a/samples/drivers/mbox_data/remote/src/main.c b/samples/drivers/mbox_data/remote/src/main.c deleted file mode 100644 index 9fccf155c23..00000000000 --- a/samples/drivers/mbox_data/remote/src/main.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -static K_SEM_DEFINE(g_mbox_data_rx_sem, 0, 1); - -static uint32_t g_mbox_received_data; -static uint32_t g_mbox_received_channel; - -#define TX_ID (2) -#define RX_ID (3) - -static void callback(const struct device *dev, uint32_t channel, void *user_data, - struct mbox_msg *data) -{ - memcpy(&g_mbox_received_data, data->data, data->size); - g_mbox_received_channel = channel; - - k_sem_give(&g_mbox_data_rx_sem); -} - -int main(void) -{ - struct mbox_channel tx_channel; - struct mbox_channel rx_channel; - const struct device *dev; - struct mbox_msg msg = {0}; - uint32_t message = 0; - - printk("mbox_data Server demo started\n"); - - dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - - mbox_init_channel(&tx_channel, dev, TX_ID); - mbox_init_channel(&rx_channel, dev, RX_ID); - - if (mbox_register_callback(&rx_channel, callback, NULL)) { - printk("mbox_register_callback() error\n"); - return 0; - } - - if (mbox_set_enabled(&rx_channel, 1)) { - printk("mbox_set_enable() error\n"); - return 0; - } - - while (message < 99) { - k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); - message = g_mbox_received_data; - - printk("Server receive (on channel %d) value: %d\n", g_mbox_received_channel, - g_mbox_received_data); - - message++; - - msg.data = &message; - msg.size = 4; - - printk("Server send (on channel %d) value: %d\n", tx_channel.id, message); - if (mbox_send(&tx_channel, &msg) < 0) { - printk("mbox_send() error\n"); - return 0; - } - } - - printk("mbox_data Server demo ended.\n"); - return 0; -} diff --git a/samples/drivers/mbox_data/sample.yaml b/samples/drivers/mbox_data/sample.yaml deleted file mode 100644 index 5484233b2e8..00000000000 --- a/samples/drivers/mbox_data/sample.yaml +++ /dev/null @@ -1,27 +0,0 @@ -sample: - name: MBOX Data IPC sample -common: - sysbuild: true - tags: mbox -tests: - sample.drivers.mbox_data.real_hw: - platform_allow: - - mimxrt1170_evkb_cm7 - - mimxrt1170_evk_cm7 - - mimxrt1160_evk_cm7 - integration_platforms: - - mimxrt1160_evk_cm7 - harness: console - harness_config: - type: multi_line - ordered: false - regex: - - "Client received \\(on channel 2\\) value: 1" - - "Client send \\(on channel 3\\) value: 2" - - "Client received \\(on channel 2\\) value: 3" - - "Client send \\(on channel 3\\) value: 4" - - "Client received \\(on channel 2\\) value: 41" - - "Client send \\(on channel 3\\) value: 42" - - "Client received \\(on channel 2\\) value: 97" - - "Client send \\(on channel 3\\) value: 98" - - "Client received \\(on channel 2\\) value: 99" diff --git a/samples/drivers/mbox_data/src/main.c b/samples/drivers/mbox_data/src/main.c deleted file mode 100644 index 27c29b07554..00000000000 --- a/samples/drivers/mbox_data/src/main.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -static K_SEM_DEFINE(g_mbox_data_rx_sem, 0, 1); - -static uint32_t g_mbox_received_data; -static uint32_t g_mbox_received_channel; - -#define TX_ID (3) -#define RX_ID (2) - -static void callback(const struct device *dev, uint32_t channel, void *user_data, - struct mbox_msg *data) -{ - memcpy(&g_mbox_received_data, data->data, data->size); - g_mbox_received_channel = channel; - - k_sem_give(&g_mbox_data_rx_sem); -} - -int main(void) -{ - struct mbox_channel tx_channel; - struct mbox_channel rx_channel; - const struct device *dev; - struct mbox_msg msg = {0}; - uint32_t message = 0; - - printk("mbox_data Client demo started\n"); - - dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - - mbox_init_channel(&tx_channel, dev, TX_ID); - mbox_init_channel(&rx_channel, dev, RX_ID); - - if (mbox_register_callback(&rx_channel, callback, NULL)) { - printk("mbox_register_callback() error\n"); - return 0; - } - - if (mbox_set_enabled(&rx_channel, 1)) { - printk("mbox_set_enable() error\n"); - return 0; - } - - while (message < 100) { - msg.data = &message; - msg.size = 4; - - printk("Client send (on channel %d) value: %d\n", tx_channel.id, message); - if (mbox_send(&tx_channel, &msg) < 0) { - printk("mbox_send() error\n"); - return 0; - } - - k_sem_take(&g_mbox_data_rx_sem, K_FOREVER); - message = g_mbox_received_data; - - printk("Client received (on channel %d) value: %d\n", g_mbox_received_channel, - message); - message++; - } - - printk("mbox_data Client demo ended\n"); - return 0; -} diff --git a/samples/drivers/mbox_data/sysbuild.cmake b/samples/drivers/mbox_data/sysbuild.cmake deleted file mode 100644 index 5c536a6229a..00000000000 --- a/samples/drivers/mbox_data/sysbuild.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2024 NXP -# -# SPDX-License-Identifier: Apache-2.0 - -if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") - message(FATAL_ERROR - "Target ${BOARD} not supported for this sample. " - "There is no remote board selected in Kconfig.sysbuild") -endif() - -set(REMOTE_APP remote) - -ExternalZephyrProject_Add( - APPLICATION ${REMOTE_APP} - SOURCE_DIR ${APP_DIR}/${REMOTE_APP} - BOARD ${SB_CONFIG_REMOTE_BOARD} -) - -if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR - "${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR - "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" - ) - # For these NXP boards the main core application is dependent on - # 'zephyr_image_info.h' generated by remote application. - - # Let's build the remote application first - add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) -endif() From 32da039b6b072878fba635d79156f0e40c2088a9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:27 +0100 Subject: [PATCH 0765/2300] Revert "[nrf fromtree] samples: mbox: Add support for NXP RT boards" This reverts commit 46584250a7b9dcdb2dbad84175d6fee7ff489d26. Signed-off-by: Robert Lubos --- samples/drivers/mbox/CMakeLists.txt | 11 ----- samples/drivers/mbox/Kconfig | 11 ----- samples/drivers/mbox/Kconfig.sysbuild | 4 -- .../mbox/boards/mimxrt1160_evk_cm7.conf | 3 -- .../mbox/boards/mimxrt1160_evk_cm7.overlay | 29 ----------- .../mbox/boards/mimxrt1170_evk_cm7.conf | 3 -- .../mbox/boards/mimxrt1170_evk_cm7.overlay | 29 ----------- .../mbox/boards/mimxrt1170_evkb_cm7.conf | 3 -- .../mbox/boards/mimxrt1170_evkb_cm7.overlay | 29 ----------- samples/drivers/mbox/remote/CMakeLists.txt | 4 -- .../remote/boards/mimxrt1160_evk_cm4.conf | 4 -- .../remote/boards/mimxrt1160_evk_cm4.overlay | 48 ------------------ .../remote/boards/mimxrt1170_evk_cm4.conf | 4 -- .../remote/boards/mimxrt1170_evk_cm4.overlay | 48 ------------------ .../remote/boards/mimxrt1170_evkb_cm4.conf | 4 -- .../remote/boards/mimxrt1170_evkb_cm4.overlay | 49 ------------------- samples/drivers/mbox/sample.yaml | 13 +---- samples/drivers/mbox/sysbuild.cmake | 12 ----- 18 files changed, 1 insertion(+), 307 deletions(-) delete mode 100644 samples/drivers/mbox/Kconfig delete mode 100644 samples/drivers/mbox/boards/mimxrt1160_evk_cm7.conf delete mode 100644 samples/drivers/mbox/boards/mimxrt1160_evk_cm7.overlay delete mode 100644 samples/drivers/mbox/boards/mimxrt1170_evk_cm7.conf delete mode 100644 samples/drivers/mbox/boards/mimxrt1170_evk_cm7.overlay delete mode 100644 samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.conf delete mode 100644 samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.overlay delete mode 100644 samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.conf delete mode 100644 samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.overlay delete mode 100644 samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.conf delete mode 100644 samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.overlay delete mode 100644 samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.conf delete mode 100644 samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index 4344f4f3ce9..e65d44f0048 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -1,6 +1,5 @@ # # Copyright (c) 2021 Carlo Caione -# Copyright 2023 NXP # # SPDX-License-Identifier: Apache-2.0 # @@ -9,14 +8,9 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr) - if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "adp_xc7k_ae350") OR - ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt595_evk_cm33")) message(STATUS "${BOARD} compile as Main in this sample") else() @@ -27,9 +21,4 @@ project(mbox_ipc) enable_language(C ASM) -if(CONFIG_INCLUDE_REMOTE_DIR) - target_include_directories(zephyr_interface - INTERFACE ${REMOTE_ZEPHYR_DIR}/include/public) -endif() - target_sources(app PRIVATE src/main.c) diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig deleted file mode 100644 index 3837c49b6e9..00000000000 --- a/samples/drivers/mbox/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2023 NXP -# -# SPDX-License-Identifier: Apache-2.0 - -source "Kconfig.zephyr" - -config INCLUDE_REMOTE_DIR - bool "Include remote core header directory" - help - Include remote build header files. Can be used if primary image - needs to be aware of size or base address of secondary image diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index f472576df82..46ffe3e12ae 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -1,5 +1,4 @@ # Copyright 2023 Nordic Semiconductor ASA -# Copyright 2023 NXP # # SPDX-License-Identifier: Apache-2.0 @@ -11,6 +10,3 @@ string default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" default "adp_xc7k_ae350" if $(BOARD) = "adp_xc7k_ae350" default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "mimxrt595_evk_cm33" - default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7" - default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" - default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" diff --git a/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.conf b/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.conf deleted file mode 100644 index 583b4950360..00000000000 --- a/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_INCLUDE_REMOTE_DIR=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.overlay b/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.overlay deleted file mode 100644 index 942f67ba6a9..00000000000 --- a/samples/drivers/mbox/boards/mimxrt1160_evk_cm7.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2023 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c48000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c48000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c48000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.conf b/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.conf deleted file mode 100644 index 583b4950360..00000000000 --- a/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_INCLUDE_REMOTE_DIR=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.overlay b/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.overlay deleted file mode 100644 index 942f67ba6a9..00000000000 --- a/samples/drivers/mbox/boards/mimxrt1170_evk_cm7.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2023 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c48000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c48000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c48000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.conf b/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.conf deleted file mode 100644 index 0dfb100ed70..00000000000 --- a/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_SECOND_CORE_MCUX=y -CONFIG_INCLUDE_REMOTE_DIR=y diff --git a/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.overlay b/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.overlay deleted file mode 100644 index 942f67ba6a9..00000000000 --- a/samples/drivers/mbox/boards/mimxrt1170_evkb_cm7.overlay +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2023 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c48000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c48000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c48000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index e7db9b8cadf..3aee2d96482 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -1,6 +1,5 @@ # # Copyright (c) 2021 Carlo Caione -# Copyright 2023 NXP # # SPDX-License-Identifier: Apache-2.0 # @@ -11,9 +10,6 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpunet") OR - ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR - ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR ("${BOARD}" STREQUAL "adp_xc7k_ae350")) message(STATUS "${BOARD} compile as remote in this sample") else() diff --git a/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.conf b/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.conf deleted file mode 100644 index 0d36a72aec6..00000000000 --- a/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_BUILD_OUTPUT_INFO_HEADER=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.overlay b/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.overlay deleted file mode 100644 index cc05e9b96c1..00000000000 --- a/samples/drivers/mbox/remote/boards/mimxrt1160_evk_cm4.overlay +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2023 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,flash = &ocram; - zephyr,console = &lpuart1; - zephyr,shell-uart = &lpuart1; - - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /delete-node/ gpt@400f0000; - - /* Replace GPT2 with another GPT kernel timer */ - gpt2_hw_timer:gpt@400f0000 { - compatible = "nxp,gpt-hw-timer"; - reg = <0x400f0000 0x4000>; - interrupts = <120 0>; - status = "okay"; - }; - - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c4c000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c4c000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c4c000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; - -/* Disable primary GPT timer */ -&gpt_hw_timer { - status = "disabled"; -}; diff --git a/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.conf b/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.conf deleted file mode 100644 index 0d36a72aec6..00000000000 --- a/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_BUILD_OUTPUT_INFO_HEADER=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.overlay b/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.overlay deleted file mode 100644 index cc05e9b96c1..00000000000 --- a/samples/drivers/mbox/remote/boards/mimxrt1170_evk_cm4.overlay +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2023 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,flash = &ocram; - zephyr,console = &lpuart1; - zephyr,shell-uart = &lpuart1; - - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /delete-node/ gpt@400f0000; - - /* Replace GPT2 with another GPT kernel timer */ - gpt2_hw_timer:gpt@400f0000 { - compatible = "nxp,gpt-hw-timer"; - reg = <0x400f0000 0x4000>; - interrupts = <120 0>; - status = "okay"; - }; - - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c4c000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c4c000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c4c000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; -}; - -/* Disable primary GPT timer */ -&gpt_hw_timer { - status = "disabled"; -}; diff --git a/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.conf b/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.conf deleted file mode 100644 index 0d36a72aec6..00000000000 --- a/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_MBOX_NXP_IMX_MU=y -CONFIG_BUILD_OUTPUT_INFO_HEADER=y -CONFIG_BUILD_OUTPUT_HEX=y -CONFIG_SECOND_CORE_MCUX=y diff --git a/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.overlay b/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.overlay deleted file mode 100644 index 392141712a9..00000000000 --- a/samples/drivers/mbox/remote/boards/mimxrt1170_evkb_cm4.overlay +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2023 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,flash = &ocram; - zephyr,console = &lpuart1; - zephyr,shell-uart = &lpuart1; - - /* Delete ipc chosen property where old IPM mailbox driver bellow is - * configured. - */ - /delete-property/ zephyr,ipc; - }; - - soc { - /delete-node/ gpt@400f0000; - - /* Replace GPT2 with another GPT kernel timer */ - gpt2_hw_timer:gpt@400f0000 { - compatible = "nxp,gpt-hw-timer"; - reg = <0x400f0000 0x4000>; - interrupts = <120 0>; - status = "okay"; - }; - - /* Delete IPM Driver node nxp,imx-mu */ - /delete-node/ mailbox@40c4c000; - - /* Attach MBOX driver to MU Unit */ - mbox:mbox@40c4c000 { - compatible = "nxp,mbox-imx-mu"; - reg = <0x40c4c000 0x4000>; - interrupts = <118 0>; - rx-channels = <4>; - #mbox-cells = <1>; - status = "okay"; - }; - }; - -}; - -/* Disable primary GPT timer */ -&gpt_hw_timer { - status = "disabled"; -}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index e8015cf7c25..f7aa8953ea1 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -9,20 +9,9 @@ tests: - nrf5340dk_nrf5340_cpuapp - adp_xc7k_ae350 - mimxrt595_evk_cm33 - - mimxrt1170_evkb_cm7 - - mimxrt1170_evk_cm7 - - mimxrt1160_evk_cm7 integration_platforms: - nrf5340dk_nrf5340_cpuapp - harness: console - harness_config: - type: multi_line - ordered: false - regex: - - "Ping \\(on channel 0\\)" - - "Pong \\(on channel 0\\)" - - "Ping \\(on channel 1\\)" - - "Pong \\(on channel 1\\)" + harness: remote sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp diff --git a/samples/drivers/mbox/sysbuild.cmake b/samples/drivers/mbox/sysbuild.cmake index 7a5d32d4c74..a8dfb8ebdf4 100644 --- a/samples/drivers/mbox/sysbuild.cmake +++ b/samples/drivers/mbox/sysbuild.cmake @@ -1,5 +1,4 @@ # Copyright (c) 2023 Nordic Semiconductor ASA -# Copyright 2023 NXP # SPDX-License-Identifier: Apache-2.0 if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "") @@ -19,14 +18,3 @@ ExternalZephyrProject_Add( native_simulator_set_child_images(${DEFAULT_IMAGE} ${REMOTE_APP}) native_simulator_set_final_executable(${DEFAULT_IMAGE}) - -if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR - "${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR - "${BOARD}" STREQUAL "mimxrt1160_evk_cm7" - ) - # For these NXP boards the main core application is dependent on - # 'zephyr_image_info.h' generated by remote application. - - # Let's build the remote application first - add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) -endif() From baa3a63cb9fc91eb405523e8af4e8cedff04ab5b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:27 +0100 Subject: [PATCH 0766/2300] Revert "[nrf fromtree] net: shell: ensure the shell `sh` is valid before call shell_printf" This reverts commit 62370cc9697084993eb3830163b7e7c6bbc320dc. Signed-off-by: Robert Lubos --- subsys/net/lib/shell/net_shell_private.h | 50 +++++------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/subsys/net/lib/shell/net_shell_private.h b/subsys/net/lib/shell/net_shell_private.h index 076bfd63d33..8b5566022d9 100644 --- a/subsys/net/lib/shell/net_shell_private.h +++ b/subsys/net/lib/shell/net_shell_private.h @@ -8,50 +8,20 @@ #include #include -#define PR(fmt, ...) \ - do { \ - if (sh) { \ - shell_fprintf(sh, SHELL_NORMAL, fmt, ##__VA_ARGS__); \ - } else { \ - printk(fmt, ##__VA_ARGS__); \ - } \ - } while (false) +#define PR(fmt, ...) \ + shell_fprintf(sh, SHELL_NORMAL, fmt, ##__VA_ARGS__) -#define PR_SHELL(sh, fmt, ...) \ - do { \ - if (sh) { \ - shell_fprintf(sh, SHELL_NORMAL, fmt, ##__VA_ARGS__); \ - } else { \ - printk(fmt, ##__VA_ARGS__); \ - } \ - } while (false) +#define PR_SHELL(sh, fmt, ...) \ + shell_fprintf(sh, SHELL_NORMAL, fmt, ##__VA_ARGS__) -#define PR_ERROR(fmt, ...) \ - do { \ - if (sh) { \ - shell_fprintf(sh, SHELL_ERROR, fmt, ##__VA_ARGS__); \ - } else { \ - printk(fmt, ##__VA_ARGS__); \ - } \ - } while (false) +#define PR_ERROR(fmt, ...) \ + shell_fprintf(sh, SHELL_ERROR, fmt, ##__VA_ARGS__) -#define PR_INFO(fmt, ...) \ - do { \ - if (sh) { \ - shell_fprintf(sh, SHELL_INFO, fmt, ##__VA_ARGS__); \ - } else { \ - printk(fmt, ##__VA_ARGS__); \ - } \ - } while (false) +#define PR_INFO(fmt, ...) \ + shell_fprintf(sh, SHELL_INFO, fmt, ##__VA_ARGS__) -#define PR_WARNING(fmt, ...) \ - do { \ - if (sh) { \ - shell_fprintf(sh, SHELL_WARNING, fmt, ##__VA_ARGS__); \ - } else { \ - printk(fmt, ##__VA_ARGS__); \ - } \ - } while (false) +#define PR_WARNING(fmt, ...) \ + shell_fprintf(sh, SHELL_WARNING, fmt, ##__VA_ARGS__) #include "net_private.h" #include "../ip/ipv6.h" From 30f3d6e1c486ae660571a5f0db5ea94f79eecf95 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:27 +0100 Subject: [PATCH 0767/2300] Revert "[nrf fromtree] settings: nvs: Fix first write issue with cache" This reverts commit bbbabb2d31d8a1b3cea6b12520442a089a04e291. Signed-off-by: Robert Lubos --- .../settings/include/settings/settings_nvs.h | 2 -- subsys/settings/src/settings_nvs.c | 23 ------------------- 2 files changed, 25 deletions(-) diff --git a/subsys/settings/include/settings/settings_nvs.h b/subsys/settings/include/settings/settings_nvs.h index 6db576da631..ce34e192c24 100644 --- a/subsys/settings/include/settings/settings_nvs.h +++ b/subsys/settings/include/settings/settings_nvs.h @@ -45,8 +45,6 @@ struct settings_nvs { } cache[CONFIG_SETTINGS_NVS_NAME_CACHE_SIZE]; uint16_t cache_next; - uint16_t cache_total; - bool loaded; #endif }; diff --git a/subsys/settings/src/settings_nvs.c b/subsys/settings/src/settings_nvs.c index 6764c7587a3..c6efa6cb289 100644 --- a/subsys/settings/src/settings_nvs.c +++ b/subsys/settings/src/settings_nvs.c @@ -74,8 +74,6 @@ int settings_nvs_dst(struct settings_nvs *cf) } #if CONFIG_SETTINGS_NVS_NAME_CACHE -#define SETTINGS_NVS_CACHE_OVFL(cf) ((cf)->cache_total > ARRAY_SIZE((cf)->cache)) - static void settings_nvs_cache_add(struct settings_nvs *cf, const char *name, uint16_t name_id) { @@ -131,22 +129,12 @@ static int settings_nvs_load(struct settings_store *cs, ssize_t rc1, rc2; uint16_t name_id = NVS_NAMECNT_ID; -#if CONFIG_SETTINGS_NVS_NAME_CACHE - uint16_t cached = 0; - - cf->loaded = false; -#endif - name_id = cf->last_name_id + 1; while (1) { name_id--; if (name_id == NVS_NAMECNT_ID) { -#if CONFIG_SETTINGS_NVS_NAME_CACHE - cf->loaded = true; - cf->cache_total = cached; -#endif break; } @@ -198,7 +186,6 @@ static int settings_nvs_load(struct settings_store *cs, #if CONFIG_SETTINGS_NVS_NAME_CACHE settings_nvs_cache_add(cf, name, name_id); - cached++; #endif ret = settings_call_set_handler( @@ -244,13 +231,6 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, write_name_id = cf->last_name_id + 1; write_name = true; -#if CONFIG_SETTINGS_NVS_NAME_CACHE - /* We can skip reading NVS if we know that the cache wasn't overflowed. */ - if (cf->loaded && !SETTINGS_NVS_CACHE_OVFL(cf)) { - goto found; - } -#endif - while (1) { name_id--; if (name_id == NVS_NAMECNT_ID) { @@ -345,9 +325,6 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, #if CONFIG_SETTINGS_NVS_NAME_CACHE if (!name_in_cache) { settings_nvs_cache_add(cf, name, write_name_id); - if (cf->loaded && !SETTINGS_NVS_CACHE_OVFL(cf)) { - cf->cache_total++; - } } #endif From ace45501b26f60339144c62041788b9a7622725b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:27 +0100 Subject: [PATCH 0768/2300] Revert "[nrf fromtree] settings: NVS: add entry into cache after writing" This reverts commit 6ad928353c157b954ce3f8642846cba685c2a509. Signed-off-by: Robert Lubos --- subsys/settings/src/settings_nvs.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/subsys/settings/src/settings_nvs.c b/subsys/settings/src/settings_nvs.c index c6efa6cb289..f1e53bfad22 100644 --- a/subsys/settings/src/settings_nvs.c +++ b/subsys/settings/src/settings_nvs.c @@ -216,13 +216,10 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, delete = ((value == NULL) || (val_len == 0)); #if CONFIG_SETTINGS_NVS_NAME_CACHE - bool name_in_cache = false; - name_id = settings_nvs_cache_match(cf, name, rdname, sizeof(rdname)); if (name_id != NVS_NAMECNT_ID) { write_name_id = name_id; write_name = false; - name_in_cache = true; goto found; } #endif @@ -254,6 +251,9 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, } if (!delete) { +#if CONFIG_SETTINGS_NVS_NAME_CACHE + settings_nvs_cache_add(cf, name, name_id); +#endif write_name_id = name_id; write_name = false; } @@ -322,12 +322,6 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, } } -#if CONFIG_SETTINGS_NVS_NAME_CACHE - if (!name_in_cache) { - settings_nvs_cache_add(cf, name, write_name_id); - } -#endif - return 0; } From aeeda46dec8be0873897382c9477c41d27e98434 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:27 +0100 Subject: [PATCH 0769/2300] Revert "[nrf fromtree] settings: nvs: improve the name ID metadata handling on delete operation" This reverts commit 11bb9ac66c152d0dfea62d615b63b6bf4ac5399b. Signed-off-by: Robert Lubos --- subsys/settings/src/settings_nvs.c | 59 ++++++++++++------------------ 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/subsys/settings/src/settings_nvs.c b/subsys/settings/src/settings_nvs.c index f1e53bfad22..8e5bfbf3767 100644 --- a/subsys/settings/src/settings_nvs.c +++ b/subsys/settings/src/settings_nvs.c @@ -147,17 +147,6 @@ static int settings_nvs_load(struct settings_store *cs, &buf, sizeof(buf)); if ((rc1 <= 0) && (rc2 <= 0)) { - /* Settings largest ID in use is invalid due to - * reset, power failure or partition overflow. - * Decrement it and check the next ID in subsequent - * iteration. - */ - if (name_id == cf->last_name_id) { - cf->last_name_id--; - nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, - &cf->last_name_id, sizeof(uint16_t)); - } - continue; } @@ -167,15 +156,13 @@ static int settings_nvs_load(struct settings_store *cs, * or deleted. Clean dirty entries to make space for * future settings item. */ - nvs_delete(&cf->cf_nvs, name_id); - nvs_delete(&cf->cf_nvs, name_id + NVS_NAME_ID_OFFSET); - if (name_id == cf->last_name_id) { cf->last_name_id--; nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, &cf->last_name_id, sizeof(uint16_t)); } - + nvs_delete(&cf->cf_nvs, name_id); + nvs_delete(&cf->cf_nvs, name_id + NVS_NAME_ID_OFFSET); continue; } @@ -267,16 +254,6 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, return 0; } - rc = nvs_delete(&cf->cf_nvs, name_id); - if (rc >= 0) { - rc = nvs_delete(&cf->cf_nvs, name_id + - NVS_NAME_ID_OFFSET); - } - - if (rc < 0) { - return rc; - } - if (name_id == cf->last_name_id) { cf->last_name_id--; rc = nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, @@ -289,6 +266,17 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, } } + rc = nvs_delete(&cf->cf_nvs, name_id); + + if (rc >= 0) { + rc = nvs_delete(&cf->cf_nvs, name_id + + NVS_NAME_ID_OFFSET); + } + + if (rc < 0) { + return rc; + } + return 0; } @@ -297,16 +285,6 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, return -ENOMEM; } - /* update the last_name_id and write to flash if required*/ - if (write_name_id > cf->last_name_id) { - cf->last_name_id = write_name_id; - rc = nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, &cf->last_name_id, - sizeof(uint16_t)); - if (rc < 0) { - return rc; - } - } - /* write the value */ rc = nvs_write(&cf->cf_nvs, write_name_id + NVS_NAME_ID_OFFSET, value, val_len); @@ -322,6 +300,17 @@ static int settings_nvs_save(struct settings_store *cs, const char *name, } } + /* update the last_name_id and write to flash if required*/ + if (write_name_id > cf->last_name_id) { + cf->last_name_id = write_name_id; + rc = nvs_write(&cf->cf_nvs, NVS_NAMECNT_ID, &cf->last_name_id, + sizeof(uint16_t)); + } + + if (rc < 0) { + return rc; + } + return 0; } From 6b2156573c5ddd7a7931c0c6f63130f37a99d083 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:27 +0100 Subject: [PATCH 0770/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Enable CDP1 by default" This reverts commit 7055b6a7204cef31d00ff4fe5c20ae0c07520c87. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 3 +-- subsys/bluetooth/mesh/access.c | 14 +++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index ce845e995fd..e0b4761232c 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -712,7 +712,7 @@ config BT_MESH_MODEL_EXTENSIONS config BT_MESH_COMP_PAGE_1 bool "Support for Composition Data Page 1" - default y + depends on BT_MESH_MODEL_EXTENSIONS help Enable support for Composition Data Page 1. @@ -720,7 +720,6 @@ config BT_MESH_MODEL_EXTENSION_LIST_SIZE int "Model extensions list size" depends on BT_MESH_COMP_PAGE_1 range 0 255 - default 0 if !BT_MESH_MODEL_EXTENSIONS default 10 help This option specifies how many models relations can be saved. diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 328ec0dd281..4ff80333187 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -1066,13 +1066,13 @@ int bt_mesh_comp_register(const struct bt_mesh_comp *comp) err = 0; - if (MOD_REL_LIST_SIZE > 0) { + if (IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { memset(mod_rel_list, 0, sizeof(mod_rel_list)); } bt_mesh_model_foreach(mod_init, &err); - if (MOD_REL_LIST_SIZE > 0) { + if (IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { int i; MOD_REL_LIST_FOR_EACH(i) { @@ -1744,8 +1744,7 @@ static int mod_rel_register(const struct bt_mesh_model *base, return 0; } } - - LOG_ERR("CONFIG_BT_MESH_MODEL_EXTENSION_LIST_SIZE is too small"); + LOG_ERR("Failed to extend"); return -ENOMEM; } @@ -1785,11 +1784,8 @@ int bt_mesh_model_extend(const struct bt_mesh_model *extending_mod, } register_extension: - if (MOD_REL_LIST_SIZE > 0) { + if (IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { return mod_rel_register(base_mod, extending_mod, RELATION_TYPE_EXT); - } else if (IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { - LOG_ERR("CONFIG_BT_MESH_MODEL_EXTENSION_LIST_SIZE is too small"); - return -ENOMEM; } return 0; @@ -1801,7 +1797,7 @@ int bt_mesh_model_correspond(const struct bt_mesh_model *corresponding_mod, int i, err; uint8_t cor_id = 0; - if (MOD_REL_LIST_SIZE == 0) { + if (!IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) { return -ENOTSUP; } From 3ca3f9ce0d7b4815c2105433fdbd148d0fc933de Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:28 +0100 Subject: [PATCH 0771/2300] Revert "[nrf fromtree] Bluetooth: hci: Add hw variant definitions for nrf54H/L" This reverts commit 0182e10ddd32d556e14c3551ade651fbedefca35. Signed-off-by: Robert Lubos --- include/zephyr/bluetooth/hci_vs.h | 2 -- subsys/bluetooth/controller/hci/nordic/hci_vendor.h | 4 ---- subsys/bluetooth/host/hci_core.c | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/include/zephyr/bluetooth/hci_vs.h b/include/zephyr/bluetooth/hci_vs.h index 3561e20e9aa..aea92846e56 100644 --- a/include/zephyr/bluetooth/hci_vs.h +++ b/include/zephyr/bluetooth/hci_vs.h @@ -47,8 +47,6 @@ extern "C" { #define BT_HCI_VS_HW_VAR_NORDIC_NRF51X 0x0001 #define BT_HCI_VS_HW_VAR_NORDIC_NRF52X 0x0002 #define BT_HCI_VS_HW_VAR_NORDIC_NRF53X 0x0003 -#define BT_HCI_VS_HW_VAR_NORDIC_NRF54HX 0x0004 -#define BT_HCI_VS_HW_VAR_NORDIC_NRF54LX 0x0005 #define BT_HCI_VS_FW_VAR_STANDARD_CTLR 0x0001 #define BT_HCI_VS_FW_VAR_VS_CTLR 0x0002 diff --git a/subsys/bluetooth/controller/hci/nordic/hci_vendor.h b/subsys/bluetooth/controller/hci/nordic/hci_vendor.h index ecbe8968476..bea7004f9c9 100644 --- a/subsys/bluetooth/controller/hci/nordic/hci_vendor.h +++ b/subsys/bluetooth/controller/hci/nordic/hci_vendor.h @@ -12,10 +12,6 @@ #define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF52X #elif defined(CONFIG_SOC_COMPATIBLE_NRF53X) #define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF53X -#elif defined(CONFIG_SOC_SERIES_NRF54HX) -#define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF54HX -#elif defined(CONFIG_SOC_SERIES_NRF54LX) -#define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF54LX #endif #else #define BT_HCI_VS_HW_PLAT 0 diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 9b72e5548bc..dbb79f3ecdd 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -3558,7 +3558,7 @@ static const char *vs_hw_platform(uint16_t platform) static const char *vs_hw_variant(uint16_t platform, uint16_t variant) { static const char * const nordic_str[] = { - "reserved", "nRF51x", "nRF52x", "nRF53x", "nRF54Hx", "nRF54Lx" + "reserved", "nRF51x", "nRF52x", "nRF53x" }; if (platform != BT_HCI_VS_HW_PLAT_NORDIC) { From 5bf3df3d8ae68aecb6eb1c6acc296c4352cab614 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:28 +0100 Subject: [PATCH 0772/2300] Revert "[nrf fromtree] net: sockets: Do not start service thread if too little resources" This reverts commit 9b48bc1e5e648560b46ef2fca342290736bffecc. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/sockets_service.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index 89b653d31e5..4c9270af116 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -195,12 +195,11 @@ static void socket_service_thread(void) } if ((count + 1) > ARRAY_SIZE(ctx.events)) { - NET_ERR("You have %d services to monitor but " - "%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); - goto fail; + NET_WARN("You have %d services to monitor but " + "%zd poll entries configured.", + count + 1, ARRAY_SIZE(ctx.events)); + NET_WARN("Consider increasing value of %s to %d", + "CONFIG_NET_SOCKETS_POLL_MAX", count + 1); } NET_DBG("Monitoring %d socket entries", count); From 509d4cd62ae5c0dff08cbf322c1772249a06597b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:28 +0100 Subject: [PATCH 0773/2300] Revert "[nrf fromtree] net: socket: Start service thread from initialization function" This reverts commit 0098cf342ce11b201cf172b7b8f100f2f2761ce0. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/sockets_service.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index 4c9270af116..19efef93add 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -277,23 +277,15 @@ static void socket_service_thread(void) k_condvar_broadcast(&wait_start); } +K_THREAD_DEFINE(socket_service_monitor, CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE, + socket_service_thread, NULL, NULL, NULL, + CLAMP(CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO, + K_HIGHEST_APPLICATION_THREAD_PRIO, + K_LOWEST_APPLICATION_THREAD_PRIO), 0, 0); + static int init_socket_service(void) { - k_tid_t ssm; - static struct k_thread service_thread; - - static K_THREAD_STACK_DEFINE(service_thread_stack, - CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE); - - ssm = k_thread_create(&service_thread, - service_thread_stack, - K_THREAD_STACK_SIZEOF(service_thread_stack), - (k_thread_entry_t)socket_service_thread, NULL, NULL, NULL, - CLAMP(CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO, - K_HIGHEST_APPLICATION_THREAD_PRIO, - K_LOWEST_APPLICATION_THREAD_PRIO), 0, K_NO_WAIT); - - k_thread_name_set(ssm, "net_socket_service"); + k_thread_name_set(socket_service_monitor, "net_socket_service"); return 0; } From beacc3af5c0b2aab634d932261b8b23a825b6cab Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:28 +0100 Subject: [PATCH 0774/2300] Revert "[nrf fromtree] net: socket: Change the printf modifier to print size_t correctly" This reverts commit 519263ac0f85ffeb2fe44715fdec88fd39a7a0ef. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/sockets_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index 19efef93add..2863de005ea 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -196,7 +196,7 @@ static void socket_service_thread(void) if ((count + 1) > ARRAY_SIZE(ctx.events)) { NET_WARN("You have %d services to monitor but " - "%zd poll entries configured.", + "%d poll entries configured.", count + 1, ARRAY_SIZE(ctx.events)); NET_WARN("Consider increasing value of %s to %d", "CONFIG_NET_SOCKETS_POLL_MAX", count + 1); From 929186f0bfbdf18d5f102a847cbbe025df609772 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:28 +0100 Subject: [PATCH 0775/2300] Revert "[nrf fromtree] net: socket: Allow user to tweak service dispatcher thread priority" This reverts commit 0c5f35d9ccc2b9aadfe492fbb3f75c8de485e749. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/Kconfig | 21 --------------------- subsys/net/lib/sockets/sockets_service.c | 4 +--- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 4d6c091b749..35750dd3583 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -86,27 +86,6 @@ config NET_SOCKETS_SERVICE system needs as multiple services can be activated at the same time depending on network configuration. -config NET_SOCKETS_SERVICE_THREAD_PRIO - int "Priority of the socket service dispatcher thread" - default NUM_PREEMPT_PRIORITIES - 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. - - 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" default 2400 if NET_DHCPV4_SERVER diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index 2863de005ea..d253ece629c 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -279,9 +279,7 @@ static void socket_service_thread(void) K_THREAD_DEFINE(socket_service_monitor, CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE, socket_service_thread, NULL, NULL, NULL, - CLAMP(CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO, - K_HIGHEST_APPLICATION_THREAD_PRIO, - K_LOWEST_APPLICATION_THREAD_PRIO), 0, 0); + K_LOWEST_APPLICATION_THREAD_PRIO, 0, 0); static int init_socket_service(void) { From 67a6596a49541e5f5d331c317ca8c7af6adb22e4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:28 +0100 Subject: [PATCH 0776/2300] Revert "[nrf fromtree] soc: nordic_nrf: add missing GRTC Kconfig option" This reverts commit 5a0c50e3d8f3e3117e5cc3bef201a528d1b9464d. Signed-off-by: Robert Lubos --- soc/common/nordic_nrf/Kconfig.peripherals | 3 --- 1 file changed, 3 deletions(-) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index ca24384cf8e..01b53bbe651 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -90,9 +90,6 @@ config HAS_HW_NRF_GPIOTE130 config HAS_HW_NRF_GPIOTE131 def_bool $(dt_nodelabel_enabled_with_compat,gpiote131,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) -config HAS_HW_NRF_GRTC - def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GRTC)) - config HAS_HW_NRF_I2S0 def_bool $(dt_nodelabel_enabled_with_compat,i2s0,$(DT_COMPAT_NORDIC_NRF_I2S)) From 1ddd200c5c694016cd2c880ffe0415c1e19c94a3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:28 +0100 Subject: [PATCH 0777/2300] Revert "[nrf fromtree] soc: nordic_nrf: add support for WDT131-132" This reverts commit dc6303cddd22998b0cccf8bedac9907389397fb7. Signed-off-by: Robert Lubos --- soc/common/nordic_nrf/Kconfig.peripherals | 6 ------ 1 file changed, 6 deletions(-) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 01b53bbe651..aa0d753d89a 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -536,9 +536,3 @@ config HAS_HW_NRF_WDT31 config HAS_HW_NRF_WDT130 def_bool $(dt_nodelabel_enabled_with_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) - -config HAS_HW_NRF_WDT131 - def_bool $(dt_nodelabel_enabled_with_compat,wdt131,$(DT_COMPAT_NORDIC_NRF_WDT)) - -config HAS_HW_NRF_WDT132 - def_bool $(dt_nodelabel_enabled_with_compat,wdt132,$(DT_COMPAT_NORDIC_NRF_WDT)) From 6bc07b23f26d84c5346a9cc24ea8c856b2c595c1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:29 +0100 Subject: [PATCH 0778/2300] Revert "[nrf fromtree] modules: hal_nordic: add support for WDT131-132" This reverts commit be9797d28cacc5ed663d3a650d7dc406c2f5d35f. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/Kconfig | 10 ---------- modules/hal_nordic/nrfx/nrfx_config.h | 6 ------ 2 files changed, 16 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index a511af42e17..88b19159730 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -815,16 +815,6 @@ config NRFX_WDT130 depends on $(dt_nodelabel_has_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) select NRFX_WDT -config NRFX_WDT131 - bool "WDT131 driver instance" - depends on $(dt_nodelabel_has_compat,wdt131,$(DT_COMPAT_NORDIC_NRF_WDT)) - select NRFX_WDT - -config NRFX_WDT132 - bool "WDT132 driver instance" - depends on $(dt_nodelabel_has_compat,wdt132,$(DT_COMPAT_NORDIC_NRF_WDT)) - select NRFX_WDT - menu "Peripheral Resource Sharing module" config NRFX_PRS diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 5ebc243541e..5ec7b137703 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -722,12 +722,6 @@ #ifdef CONFIG_NRFX_WDT130 #define NRFX_WDT130_ENABLED 1 #endif -#ifdef CONFIG_NRFX_WDT131 -#define NRFX_WDT131_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_WDT132 -#define NRFX_WDT132_ENABLED 1 -#endif #ifdef CONFIG_NRF52_ANOMALY_109_WORKAROUND #define NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 From d0540c11c9ebb83f1649ca12f20a6f32c6bfa04e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:29 +0100 Subject: [PATCH 0779/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add WDT nodes" This reverts commit a291c2c5daf019a8244db64f32937d28e1c2bea7. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 5a9af57801c..980546bcf00 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -311,20 +311,6 @@ prescaler = <1>; }; - wdt131: watchdog@92b000 { - compatible = "nordic,nrf-wdt"; - reg = <0x92b000 0x1000>; - status = "disabled"; - interrupts = <299 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - wdt132: watchdog@92c000 { - compatible = "nordic,nrf-wdt"; - reg = <0x92c000 0x1000>; - status = "disabled"; - interrupts = <300 NRF_DEFAULT_IRQ_PRIORITY>; - }; - gpiote130: gpiote@934000 { compatible = "nordic,nrf-gpiote"; reg = <0x934000 0x1000>; From 8d2e62d5f9f657af170a1c117c11ad7b832813a1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:29 +0100 Subject: [PATCH 0780/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add ECB node" This reverts commit a56e671dcce77b16052e796e76f68f9481a8f55f. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 980546bcf00..b08a8ee6cb3 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -209,13 +209,6 @@ status = "disabled"; }; }; - - ecb030: ecb@3b000 { - compatible = "nordic,nrf-ecb"; - reg = <0x3b000 0x1000>; - interrupts = <59 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; }; global_peripherals: peripheral@5f000000 { From a8ebf93acc32bda53fcfa7bb28556848c2fddb2b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:29 +0100 Subject: [PATCH 0781/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add RADIO node" This reverts commit 215516af6ea4c45e5f603ca581181517bbc5ad6b. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index b08a8ee6cb3..e3010a1de58 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -193,22 +193,6 @@ interrupts = <43 NRF_DEFAULT_IRQ_PRIORITY>; prescaler = <1>; }; - - radio: radio@2c000 { - compatible = "nordic,nrf-radio"; - reg = <0x2c000 0x1000>; - status = "disabled"; - ble-2mbps-supported; - ble-coded-phy-supported; - dfe-supported; - ieee802154-supported; - interrupts = <44 NRF_DEFAULT_IRQ_PRIORITY>; - - cpurad_ieee802154: ieee802154 { - compatible = "nordic,nrf-ieee802154"; - status = "disabled"; - }; - }; }; global_peripherals: peripheral@5f000000 { From a1eb2e323d639962883ab67153a913fc937f6c3f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:29 +0100 Subject: [PATCH 0782/2300] Revert "[nrf fromtree] soc: nordic_nrf: add support for EGU020" This reverts commit 4ee03da12222ec8398dce056f3c2fbbccd595f66. Signed-off-by: Robert Lubos --- soc/common/nordic_nrf/Kconfig.peripherals | 3 --- 1 file changed, 3 deletions(-) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index aa0d753d89a..14f598ecf85 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -63,9 +63,6 @@ config HAS_HW_NRF_EGU4 config HAS_HW_NRF_EGU5 def_bool $(dt_nodelabel_enabled_with_compat,egu5,$(DT_COMPAT_NORDIC_NRF_EGU)) -config HAS_HW_NRF_EGU020 - def_bool $(dt_nodelabel_enabled_with_compat,egu020,$(DT_COMPAT_NORDIC_NRF_EGU)) - config HAS_HW_NRF_GPIO0 def_bool $(dt_nodelabel_enabled_with_compat,gpio0,$(DT_COMPAT_NORDIC_NRF_GPIO)) From a03a6861e6b1b755f7462a7c7e200a65682eecd0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:29 +0100 Subject: [PATCH 0783/2300] Revert "[nrf fromtree] modules: hal_nordic: add support for EGU020" This reverts commit b16a3284fb92e0ea7692f4153b2ca3fe7cc973d6. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/Kconfig | 5 ----- modules/hal_nordic/nrfx/nrfx_config.h | 3 --- 2 files changed, 8 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 88b19159730..34dbb43f3d4 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -62,11 +62,6 @@ config NRFX_EGU5 depends on $(dt_nodelabel_has_compat,egu5,$(DT_COMPAT_NORDIC_NRF_EGU)) select NRFX_EGU -config NRFX_EGU020 - bool "EGU020 driver instance" - depends on $(dt_nodelabel_has_compat,egu020,$(DT_COMPAT_NORDIC_NRF_EGU)) - select NRFX_EGU - config NRFX_GPIOTE bool diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 5ec7b137703..0f52cd17cf2 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -108,9 +108,6 @@ #ifdef CONFIG_NRFX_EGU5 #define NRFX_EGU5_ENABLED 1 #endif -#ifdef CONFIG_NRFX_EGU020 -#define NRFX_EGU020_ENABLED 1 -#endif #ifdef CONFIG_NRFX_GRTC #define NRFX_GRTC_ENABLED 1 From c3d58fd89ece1535442ebd1a2726eb97a057586c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:30 +0100 Subject: [PATCH 0784/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add EGU node" This reverts commit 1d7d7b612c461345b2048b0c29b9c636d174ebb8. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index e3010a1de58..d6208a3f2d7 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -147,13 +147,6 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; - egu020: egu@25000 { - compatible = "nordic,nrf-egu"; - reg = <0x25000 0x1000>; - status = "disabled"; - interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; - }; - timer020: timer@28000 { compatible = "nordic,nrf-timer"; reg = <0x28000 0x1000>; From 4ca81bd95232d707959a34c3cdeeb70ad2f68f3b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:30 +0100 Subject: [PATCH 0785/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add COMP node" This reverts commit 9e55d5d70d1da36474f89eee4188f64d507bd47d. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 8 -------- 1 file changed, 8 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index d6208a3f2d7..6999a52278e 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -352,14 +352,6 @@ port = <9>; }; - comp: comparator@983000 { - compatible = "nordic,nrf-comp"; - reg = <0x983000 0x1000>; - status = "disabled"; - interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; - #io-channel-cells = <1>; - }; - temp: temperature-sensor@984000 { compatible = "nordic,nrf-temp"; reg = <0x984000 0x1000>; From f1f3413c56512d34ae2c6d71327ad898f5c08638 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:30 +0100 Subject: [PATCH 0786/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add TEMP node" This reverts commit d2d65a04e2bf586af62cf4f040bd48affdbc297e. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 6999a52278e..817c346e066 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -352,13 +352,6 @@ port = <9>; }; - temp: temperature-sensor@984000 { - compatible = "nordic,nrf-temp"; - reg = <0x984000 0x1000>; - interrupts = <388 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - nfct: nfct@985000 { compatible = "nordic,nrf-nfct"; reg = <0x985000 0x1000>; From a8a6df44124838eec827b9809601f1541cd089fa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:30 +0100 Subject: [PATCH 0787/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add NFCT node" This reverts commit 935914974f94a19c836c45c52d01c917df27808d. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 817c346e066..0e586962b0f 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -352,13 +352,6 @@ port = <9>; }; - nfct: nfct@985000 { - compatible = "nordic,nrf-nfct"; - reg = <0x985000 0x1000>; - status = "disabled"; - interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; - }; - qdec130: qdec@994000 { compatible = "nordic,nrf-qdec"; reg = <0x994000 0x1000>; From 365f6d571dffd965bc4289852656170b4ffba0f1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:30 +0100 Subject: [PATCH 0788/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add QDEC nodes" This reverts commit 2d7891968fba4d088dd1cbea747898e7f7142cc4. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 0e586962b0f..20ec8466ee5 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -352,20 +352,6 @@ port = <9>; }; - qdec130: qdec@994000 { - compatible = "nordic,nrf-qdec"; - reg = <0x994000 0x1000>; - status = "disabled"; - interrupts = <404 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - qdec131: qdec@995000 { - compatible = "nordic,nrf-qdec"; - reg = <0x995000 0x1000>; - status = "disabled"; - interrupts = <405 NRF_DEFAULT_IRQ_PRIORITY>; - }; - grtc: grtc@99c000 { compatible = "nordic,nrf-grtc"; reg = <0x99c000 0x1000>; From af4e3f6fc42bf45f7f14ba81aa3a80d142d047d0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:31 +0100 Subject: [PATCH 0789/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add TWIM nodes" This reverts commit 83dc3594722ad3671914dd09ea262fbcbbc198df. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 80 ---------------------------- 1 file changed, 80 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 20ec8466ee5..b762c5c7f91 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -379,16 +379,6 @@ prescaler = <0>; }; - i2c130: i2c@9a5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9a5000 0x1000>; - status = "disabled"; - interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - spi130: spi@9a5000 { compatible = "nordic,nrf-spim"; reg = <0x9a5000 0x1000>; @@ -407,16 +397,6 @@ interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; }; - i2c131: i2c@9a6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9a6000 0x1000>; - status = "disabled"; - interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - spi131: spi@9a6000 { compatible = "nordic,nrf-spim"; reg = <0x9a6000 0x1000>; @@ -455,16 +435,6 @@ prescaler = <0>; }; - i2c132: i2c@9b5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9b5000 0x1000>; - status = "disabled"; - interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - spi132: spi@9b5000 { compatible = "nordic,nrf-spim"; reg = <0x9b5000 0x1000>; @@ -483,16 +453,6 @@ interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; }; - i2c133: i2c@9b6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9b6000 0x1000>; - status = "disabled"; - interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - spi133: spi@9b6000 { compatible = "nordic,nrf-spim"; reg = <0x9b6000 0x1000>; @@ -531,16 +491,6 @@ prescaler = <0>; }; - i2c134: i2c@9c5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9c5000 0x1000>; - status = "disabled"; - interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - spi134: spi@9c5000 { compatible = "nordic,nrf-spim"; reg = <0x9c5000 0x1000>; @@ -559,16 +509,6 @@ interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; }; - i2c135: i2c@9c6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9c6000 0x1000>; - status = "disabled"; - interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - spi135: spi@9c6000 { compatible = "nordic,nrf-spim"; reg = <0x9c6000 0x1000>; @@ -607,16 +547,6 @@ prescaler = <0>; }; - i2c136: i2c@9d5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9d5000 0x1000>; - status = "disabled"; - interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - spi136: spi@9d5000 { compatible = "nordic,nrf-spim"; reg = <0x9d5000 0x1000>; @@ -635,16 +565,6 @@ interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; }; - i2c137: i2c@9d6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9d6000 0x1000>; - status = "disabled"; - interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - spi137: spi@9d6000 { compatible = "nordic,nrf-spim"; reg = <0x9d6000 0x1000>; From eefec1f857513497660fce0b891fefa8b8377122 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:31 +0100 Subject: [PATCH 0790/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add SPIM nodes" This reverts commit 339554ab6db1839cdf95d3aa7d4a6c0425daccd1. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 110 --------------------------- 1 file changed, 110 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index b762c5c7f91..b8341c257e2 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -220,28 +220,6 @@ interrupts = <229 NRF_DEFAULT_IRQ_PRIORITY>; }; - spi120: spi@8e6000 { - compatible = "nordic,nrf-spim"; - reg = <0x8e6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi121: spi@8e7000 { - compatible = "nordic,nrf-spim"; - reg = <0x8e7000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <231 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - cpuppr_vpr: vpr@908000 { compatible = "nordic,nrf-vpr-coprocessor"; reg = <0x908000 0x1000>; @@ -379,17 +357,6 @@ prescaler = <0>; }; - spi130: spi@9a5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9a5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - uart130: uart@9a5000 { compatible = "nordic,nrf-uarte"; reg = <0x9a5000 0x1000>; @@ -397,17 +364,6 @@ interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; }; - spi131: spi@9a6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9a6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - uart131: uart@9a6000 { compatible = "nordic,nrf-uarte"; reg = <0x9a6000 0x1000>; @@ -435,17 +391,6 @@ prescaler = <0>; }; - spi132: spi@9b5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9b5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - uart132: uart@9b5000 { compatible = "nordic,nrf-uarte"; reg = <0x9b5000 0x1000>; @@ -453,17 +398,6 @@ interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; }; - spi133: spi@9b6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9b6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - uart133: uart@9b6000 { compatible = "nordic,nrf-uarte"; reg = <0x9b6000 0x1000>; @@ -491,17 +425,6 @@ prescaler = <0>; }; - spi134: spi@9c5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9c5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - uart134: uart@9c5000 { compatible = "nordic,nrf-uarte"; reg = <0x9c5000 0x1000>; @@ -509,17 +432,6 @@ interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; }; - spi135: spi@9c6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9c6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - uart135: uart@9c6000 { compatible = "nordic,nrf-uarte"; reg = <0x9c6000 0x1000>; @@ -547,17 +459,6 @@ prescaler = <0>; }; - spi136: spi@9d5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9d5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - uart136: uart@9d5000 { compatible = "nordic,nrf-uarte"; reg = <0x9d5000 0x1000>; @@ -565,17 +466,6 @@ interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; }; - spi137: spi@9d6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9d6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - uart137: uart@9d6000 { compatible = "nordic,nrf-uarte"; reg = <0x9d6000 0x1000>; From ac787f0c918fa7c92989d590b27a6812ab9db172 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:31 +0100 Subject: [PATCH 0791/2300] Revert "[nrf fromtree] soc: nordic_nrf: add support for RTC130-131" This reverts commit 1f88cf5ce952ac1aca94f4dc7febc6c3ab160e96. Signed-off-by: Robert Lubos --- soc/common/nordic_nrf/Kconfig.peripherals | 6 ------ 1 file changed, 6 deletions(-) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 14f598ecf85..6ebf0702cda 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -195,12 +195,6 @@ config HAS_HW_NRF_RTC1 config HAS_HW_NRF_RTC2 def_bool $(dt_nodelabel_enabled_with_compat,rtc2,$(DT_COMPAT_NORDIC_NRF_RTC)) -config HAS_HW_NRF_RTC130 - def_bool $(dt_nodelabel_enabled_with_compat,rtc130,$(DT_COMPAT_NORDIC_NRF_RTC)) - -config HAS_HW_NRF_RTC131 - def_bool $(dt_nodelabel_enabled_with_compat,rtc131,$(DT_COMPAT_NORDIC_NRF_RTC)) - config HAS_HW_NRF_SAADC def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_SAADC)) From 8e6b892ac6eaf62e92aa87c598aafbdd6cfb0551 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:31 +0100 Subject: [PATCH 0792/2300] Revert "[nrf fromtree] modules: hal_nordic: add support for RTC130-131" This reverts commit cf099e417174d0f1e7183c6f69cca742d9a0d7b2. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/Kconfig | 10 ---------- modules/hal_nordic/nrfx/nrfx_config.h | 6 ------ 2 files changed, 16 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 34dbb43f3d4..784a2087139 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -238,16 +238,6 @@ config NRFX_RTC2 depends on $(dt_nodelabel_has_compat,rtc2,$(DT_COMPAT_NORDIC_NRF_RTC)) select NRFX_RTC -config NRFX_RTC130 - bool "RTC130 driver instance" - depends on $(dt_nodelabel_has_compat,rtc130,$(DT_COMPAT_NORDIC_NRF_RTC)) - select NRFX_RTC - -config NRFX_RTC131 - bool "RTC131 driver instance" - depends on $(dt_nodelabel_has_compat,rtc131,$(DT_COMPAT_NORDIC_NRF_RTC)) - select NRFX_RTC - config NRFX_SAADC bool "SAADC driver" depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_SAADC)) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 0f52cd17cf2..20facba229c 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -299,12 +299,6 @@ #ifdef CONFIG_NRFX_RTC2 #define NRFX_RTC2_ENABLED 1 #endif -#ifdef CONFIG_NRFX_RTC130 -#define NRFX_RTC130_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_RTC131 -#define NRFX_RTC131_ENABLED 1 -#endif #ifdef CONFIG_NRFX_SAADC #define NRFX_SAADC_ENABLED 1 From 6949952f1924799677185646cefbaca3e011b5d1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:31 +0100 Subject: [PATCH 0793/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add RTC nodes" This reverts commit 619fb93a32561dba8ca579b8a59fc696758e9a1a. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 30 ---------------------------- 1 file changed, 30 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index b8341c257e2..6d27042cb6b 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -176,16 +176,6 @@ max-bit-width = <32>; prescaler = <0>; }; - - rtc: rtc@2b000 { - compatible = "nordic,nrf-rtc"; - reg = <0x2b000 0x1000>; - status = "disabled"; - cc-num = <4>; - clock-frequency = <32768>; - interrupts = <43 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <1>; - }; }; global_peripherals: peripheral@5f000000 { @@ -239,26 +229,6 @@ }; }; - rtc130: rtc@928000 { - compatible = "nordic,nrf-rtc"; - reg = <0x928000 0x1000>; - status = "disabled"; - cc-num = <4>; - clock-frequency = <32768>; - interrupts = <296 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <1>; - }; - - rtc131: rtc@929000 { - compatible = "nordic,nrf-rtc"; - reg = <0x929000 0x1000>; - status = "disabled"; - cc-num = <4>; - clock-frequency = <32768>; - interrupts = <297 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <1>; - }; - gpiote130: gpiote@934000 { compatible = "nordic,nrf-gpiote"; reg = <0x934000 0x1000>; From c7582214a06dc0756f532caa19cb77a912253dc4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:31 +0100 Subject: [PATCH 0794/2300] Revert "[nrf fromtree] soc: nordic_nrf: add support for TIMER020-022|120-121|130-137" This reverts commit 82d956cc9c6621b9bd6947b6e7543e268cb670ce. Signed-off-by: Robert Lubos --- soc/common/nordic_nrf/Kconfig.peripherals | 39 ----------------------- 1 file changed, 39 deletions(-) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 6ebf0702cda..da1c5f473c7 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -339,45 +339,6 @@ config HAS_HW_NRF_TIMER23 config HAS_HW_NRF_TIMER24 def_bool $(dt_nodelabel_enabled_with_compat,timer24,$(DT_COMPAT_NORDIC_NRF_TIMER)) -config HAS_HW_NRF_TIMER020 - def_bool $(dt_nodelabel_enabled_with_compat,timer020,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER021 - def_bool $(dt_nodelabel_enabled_with_compat,timer021,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER022 - def_bool $(dt_nodelabel_enabled_with_compat,timer022,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER120 - def_bool $(dt_nodelabel_enabled_with_compat,timer120,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER121 - def_bool $(dt_nodelabel_enabled_with_compat,timer121,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER130 - def_bool $(dt_nodelabel_enabled_with_compat,timer130,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER131 - def_bool $(dt_nodelabel_enabled_with_compat,timer131,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER132 - def_bool $(dt_nodelabel_enabled_with_compat,timer132,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER133 - def_bool $(dt_nodelabel_enabled_with_compat,timer133,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER134 - def_bool $(dt_nodelabel_enabled_with_compat,timer134,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER135 - def_bool $(dt_nodelabel_enabled_with_compat,timer135,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER136 - def_bool $(dt_nodelabel_enabled_with_compat,timer136,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER137 - def_bool $(dt_nodelabel_enabled_with_compat,timer137,$(DT_COMPAT_NORDIC_NRF_TIMER)) - config HAS_HW_NRF_TWI0 def_bool $(dt_nodelabel_enabled_with_compat,i2c0,$(DT_COMPAT_NORDIC_NRF_TWI)) From 02cd03b05740ffa97aadcbd8579c65fec507aae1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:32 +0100 Subject: [PATCH 0795/2300] Revert "[nrf fromtree] modules: hal_nordic: add support for TIMER020-022|120-121|130-137" This reverts commit 58fb3f4103462dfa2af1e3ee69dc6a6833e130a2. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/Kconfig | 65 --------------------------- modules/hal_nordic/nrfx/nrfx_config.h | 39 ---------------- 2 files changed, 104 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 784a2087139..ee1bd76b52f 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -457,71 +457,6 @@ config NRFX_TIMER24 depends on $(dt_nodelabel_has_compat,timer24,$(DT_COMPAT_NORDIC_NRF_TIMER)) select NRFX_TIMER -config NRFX_TIMER020 - bool "TIMER020 driver instance" - depends on $(dt_nodelabel_has_compat,timer020,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER021 - bool "TIMER021 driver instance" - depends on $(dt_nodelabel_has_compat,timer021,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER022 - bool "TIMER022 driver instance" - depends on $(dt_nodelabel_has_compat,timer022,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER120 - bool "TIMER120 driver instance" - depends on $(dt_nodelabel_has_compat,timer120,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER121 - bool "TIMER121 driver instance" - depends on $(dt_nodelabel_has_compat,timer121,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER130 - bool "TIMER130 driver instance" - depends on $(dt_nodelabel_has_compat,timer130,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER131 - bool "TIMER131 driver instance" - depends on $(dt_nodelabel_has_compat,timer131,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER132 - bool "TIMER132 driver instance" - depends on $(dt_nodelabel_has_compat,timer132,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER133 - bool "TIMER133 driver instance" - depends on $(dt_nodelabel_has_compat,timer133,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER134 - bool "TIMER134 driver instance" - depends on $(dt_nodelabel_has_compat,timer134,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER135 - bool "TIMER135 driver instance" - depends on $(dt_nodelabel_has_compat,timer135,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER136 - bool "TIMER136 driver instance" - depends on $(dt_nodelabel_has_compat,timer136,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER137 - bool "TIMER137 driver instance" - depends on $(dt_nodelabel_has_compat,timer137,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - config NRFX_TWI bool diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 20facba229c..26d662be39d 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -472,45 +472,6 @@ #ifdef CONFIG_NRFX_TIMER24 #define NRFX_TIMER24_ENABLED 1 #endif -#ifdef CONFIG_NRFX_TIMER020 -#define NRFX_TIMER020_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER021 -#define NRFX_TIMER021_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER022 -#define NRFX_TIMER022_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER120 -#define NRFX_TIMER120_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER121 -#define NRFX_TIMER121_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER130 -#define NRFX_TIMER130_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER131 -#define NRFX_TIMER131_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER132 -#define NRFX_TIMER132_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER133 -#define NRFX_TIMER133_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER134 -#define NRFX_TIMER134_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER135 -#define NRFX_TIMER135_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER136 -#define NRFX_TIMER136_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER137 -#define NRFX_TIMER137_ENABLED 1 -#endif #ifdef CONFIG_NRFX_TWI #define NRFX_TWI_ENABLED 1 From b67e035fe4757ba70020350bf999d7af2023e4de Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:32 +0100 Subject: [PATCH 0796/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add TIMER nodes" This reverts commit a012a955eb2da44bf3a5625e81641118b3c9f7f7. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 130 --------------------------- 1 file changed, 130 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 6d27042cb6b..97dcb222746 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -146,36 +146,6 @@ <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1>; nordic,ficr-names = "vsup", "coarse", "fine"; }; - - timer020: timer@28000 { - compatible = "nordic,nrf-timer"; - reg = <0x28000 0x1000>; - status = "disabled"; - cc-num = <8>; - interrupts = <40 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer021: timer@29000 { - compatible = "nordic,nrf-timer"; - reg = <0x29000 0x1000>; - status = "disabled"; - cc-num = <8>; - interrupts = <41 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer022: timer@2a000 { - compatible = "nordic,nrf-timer"; - reg = <0x2a000 0x1000>; - status = "disabled"; - cc-num = <8>; - interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; }; global_peripherals: peripheral@5f000000 { @@ -183,26 +153,6 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; - timer120: timer@8e2000 { - compatible = "nordic,nrf-timer"; - reg = <0x8e2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer121: timer@8e3000 { - compatible = "nordic,nrf-timer"; - reg = <0x8e3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - uart120: uart@8e5000 { compatible = "nordic,nrf-uarte"; reg = <0x8e5000 0x1000>; @@ -307,26 +257,6 @@ cc-num = <16>; }; - timer130: timer@9a2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9a2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <418 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer131: timer@9a3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9a3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <419 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - uart130: uart@9a5000 { compatible = "nordic,nrf-uarte"; reg = <0x9a5000 0x1000>; @@ -341,26 +271,6 @@ interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; }; - timer132: timer@9b2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9b2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <434 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer133: timer@9b3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9b3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <435 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - uart132: uart@9b5000 { compatible = "nordic,nrf-uarte"; reg = <0x9b5000 0x1000>; @@ -375,26 +285,6 @@ interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; }; - timer134: timer@9c2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9c2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <450 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer135: timer@9c3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9c3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <451 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - uart134: uart@9c5000 { compatible = "nordic,nrf-uarte"; reg = <0x9c5000 0x1000>; @@ -409,26 +299,6 @@ interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; }; - timer136: timer@9d2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9d2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <466 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer137: timer@9d3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9d3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <467 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - uart136: uart@9d5000 { compatible = "nordic,nrf-uarte"; reg = <0x9d5000 0x1000>; From 2495b2e63e833173c172e60bd6841107e1743ef2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:32 +0100 Subject: [PATCH 0797/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: add missing UARTE nodes" This reverts commit af8bea679e79366f22a12ee33b5c6adf6773a4ce. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 49 ---------------------------- 1 file changed, 49 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 97dcb222746..af751c4344b 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -153,13 +153,6 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; - uart120: uart@8e5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x8e5000 0x1000>; - status = "disabled"; - interrupts = <229 NRF_DEFAULT_IRQ_PRIORITY>; - }; - cpuppr_vpr: vpr@908000 { compatible = "nordic,nrf-vpr-coprocessor"; reg = <0x908000 0x1000>; @@ -257,41 +250,6 @@ cc-num = <16>; }; - uart130: uart@9a5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9a5000 0x1000>; - status = "disabled"; - interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - uart131: uart@9a6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9a6000 0x1000>; - status = "disabled"; - interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - uart132: uart@9b5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9b5000 0x1000>; - status = "disabled"; - interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - uart133: uart@9b6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9b6000 0x1000>; - status = "disabled"; - interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - uart134: uart@9c5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9c5000 0x1000>; - status = "disabled"; - interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; - }; - uart135: uart@9c6000 { compatible = "nordic,nrf-uarte"; reg = <0x9c6000 0x1000>; @@ -305,13 +263,6 @@ status = "disabled"; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; }; - - uart137: uart@9d6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9d6000 0x1000>; - status = "disabled"; - interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; - }; }; }; From d718e8d02cdfb70bb743e380b6d24b7c1c9293d3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:32 +0100 Subject: [PATCH 0798/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: current-speed needs to be set by boards" This reverts commit 7c98778bba3b954f42139e03127798deaf926c34. Signed-off-by: Robert Lubos --- boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts | 2 -- boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts | 2 -- .../riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts | 2 -- dts/common/nordic/nrf54h20_enga.dtsi | 2 ++ 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 5fb345ec808..359c1f84307 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -123,7 +123,6 @@ }; &uart135 { - current-speed = <115200>; pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; @@ -132,7 +131,6 @@ &uart136 { status = "okay"; memory-regions = <&cpuapp_dma_region>; - current-speed = <115200>; pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index a7d142b06c4..02213d88645 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -46,14 +46,12 @@ &uart135 { status = "okay"; memory-regions = <&cpurad_dma_region>; - current-speed = <115200>; pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; }; &uart136 { - current-speed = <115200>; pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts index 3c74e7c88d4..83aface6f5c 100644 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts @@ -31,14 +31,12 @@ &uart135 { status = "okay"; - current-speed = <115200>; pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; }; &uart136 { - current-speed = <115200>; pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index af751c4344b..1b8f7b6f9e8 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -254,6 +254,7 @@ compatible = "nordic,nrf-uarte"; reg = <0x9c6000 0x1000>; status = "disabled"; + current-speed = <115200>; interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; }; @@ -261,6 +262,7 @@ compatible = "nordic,nrf-uarte"; reg = <0x9d5000 0x1000>; status = "disabled"; + current-speed = <115200>; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; }; }; From efe5210967d612931bdf55c7b8ed9b042583a654 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:32 +0100 Subject: [PATCH 0799/2300] Revert "[nrf fromtree] arch: arm, arm64: Remove zephyr prefix from linker includes" This reverts commit d23be97ec577386d4dc69bd8a4dc4d30bc93ce32. Signed-off-by: Robert Lubos --- arch/arm/core/swi_tables.ld | 2 +- arch/arm/core/vector_table.ld | 2 +- arch/arm64/core/swi_tables.ld | 2 +- include/zephyr/arch/arm64/scripts/linker.ld | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/swi_tables.ld b/arch/arm/core/swi_tables.ld index a5dd3eaf652..a06e851e52e 100644 --- a/arch/arm/core/swi_tables.ld +++ b/arch/arm/core/swi_tables.ld @@ -4,5 +4,5 @@ * SPDX-License-Identifier: Apache-2.0 */ #if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) -INCLUDE isr_tables_swi.ld +INCLUDE zephyr/isr_tables_swi.ld #endif diff --git a/arch/arm/core/vector_table.ld b/arch/arm/core/vector_table.ld index 463e389de9f..a5af58fe6de 100644 --- a/arch/arm/core/vector_table.ld +++ b/arch/arm/core/vector_table.ld @@ -52,7 +52,7 @@ KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) #if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) -INCLUDE isr_tables_vt.ld +INCLUDE zephyr/isr_tables_vt.ld #else KEEP(*(.vectors)) #endif diff --git a/arch/arm64/core/swi_tables.ld b/arch/arm64/core/swi_tables.ld index a5dd3eaf652..a06e851e52e 100644 --- a/arch/arm64/core/swi_tables.ld +++ b/arch/arm64/core/swi_tables.ld @@ -4,5 +4,5 @@ * SPDX-License-Identifier: Apache-2.0 */ #if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) -INCLUDE isr_tables_swi.ld +INCLUDE zephyr/isr_tables_swi.ld #endif diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index ad7832f16ec..18f973e7968 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -106,7 +106,7 @@ SECTIONS KEEP(*(".exc_vector_table.*")) #if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) - INCLUDE isr_tables_vt.ld + INCLUDE zephyr/isr_tables_vt.ld #else KEEP(*(.vectors)) #endif From 339c108497079e2ae6ec8c843aa02adbe37c8aa3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:33 +0100 Subject: [PATCH 0800/2300] Revert "[nrf fromtree] arch: arm, arm64: Disable swi_tables.ld file when not required" This reverts commit 04ddd1e43a1a1fe278a8bab4ca5ab68e773a5622. Signed-off-by: Robert Lubos --- arch/arm/core/swi_tables.ld | 2 +- arch/arm/core/vector_table.ld | 2 +- arch/arm64/core/swi_tables.ld | 2 +- include/zephyr/arch/arm64/scripts/linker.ld | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/swi_tables.ld b/arch/arm/core/swi_tables.ld index a06e851e52e..c6ca94604dd 100644 --- a/arch/arm/core/swi_tables.ld +++ b/arch/arm/core/swi_tables.ld @@ -3,6 +3,6 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) +#if LINKER_ZEPHYR_FINAL INCLUDE zephyr/isr_tables_swi.ld #endif diff --git a/arch/arm/core/vector_table.ld b/arch/arm/core/vector_table.ld index a5af58fe6de..58210afdcbc 100644 --- a/arch/arm/core/vector_table.ld +++ b/arch/arm/core/vector_table.ld @@ -51,7 +51,7 @@ _vector_start = .; KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) -#if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) +#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION INCLUDE zephyr/isr_tables_vt.ld #else KEEP(*(.vectors)) diff --git a/arch/arm64/core/swi_tables.ld b/arch/arm64/core/swi_tables.ld index a06e851e52e..c6ca94604dd 100644 --- a/arch/arm64/core/swi_tables.ld +++ b/arch/arm64/core/swi_tables.ld @@ -3,6 +3,6 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) +#if LINKER_ZEPHYR_FINAL INCLUDE zephyr/isr_tables_swi.ld #endif diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index 18f973e7968..beea11a68dd 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -105,7 +105,7 @@ SECTIONS KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) -#if LINKER_ZEPHYR_FINAL && defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION) +#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION INCLUDE zephyr/isr_tables_vt.ld #else KEEP(*(.vectors)) From fddfa8585e90380353e4bd5a71ca62bf01f4003a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:33 +0100 Subject: [PATCH 0801/2300] Revert "[nrf fromtree] tests: kernel: common: Enable tests with LTO" This reverts commit 5c4ccc6c38edb3220a44b5b849c8d6ca86700f4d. Signed-off-by: Robert Lubos --- tests/kernel/common/testcase.yaml | 7 ------- tests/kernel/interrupt/testcase.yaml | 20 -------------------- 2 files changed, 27 deletions(-) diff --git a/tests/kernel/common/testcase.yaml b/tests/kernel/common/testcase.yaml index ae9c39c8fb5..721d4bb9c3d 100644 --- a/tests/kernel/common/testcase.yaml +++ b/tests/kernel/common/testcase.yaml @@ -43,10 +43,3 @@ tests: tags: picolibc extra_configs: - CONFIG_PICOLIBC=y - kernel.common.lto: - filter: CONFIG_ISR_TABLES_LOCAL_DECLARATION_SUPPORTED - tags: lto - extra_configs: - - CONFIG_TEST_USERSPACE=n - - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y - - CONFIG_LTO=y diff --git a/tests/kernel/interrupt/testcase.yaml b/tests/kernel/interrupt/testcase.yaml index 47cbba93e0d..cbe58c65e47 100644 --- a/tests/kernel/interrupt/testcase.yaml +++ b/tests/kernel/interrupt/testcase.yaml @@ -52,23 +52,3 @@ tests: extra_configs: - CONFIG_SHARED_INTERRUPTS=y filter: not CONFIG_TRUSTED_EXECUTION_NONSECURE - arch.shared_interrupt.lto: - # excluded because of failures during test_prevent_interruption - platform_exclude: qemu_cortex_m0 - arch_exclude: - # same as above, #22956 - - nios2 - # test needs 2 working interrupt lines - - xtensa - # TODO: make test work on this arch - - mips - tags: - - kernel - - interrupt - - lto - extra_configs: - - CONFIG_SHARED_INTERRUPTS=y - - CONFIG_TEST_USERSPACE=n - - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y - - CONFIG_LTO=y - filter: not CONFIG_TRUSTED_EXECUTION_NONSECURE and CONFIG_ISR_TABLES_LOCAL_DECLARATION_SUPPORTED From 62b2bff5829fb6f75259987a109a25ebf786cc09 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:33 +0100 Subject: [PATCH 0802/2300] Revert "[nrf fromtree] buildsystem: Add an option to enable LTO" This reverts commit ca5928595dbad03be6029132d9e2efb579a05f6a. Signed-off-by: Robert Lubos --- CMakeLists.txt | 9 --------- Kconfig.zephyr | 7 ------- cmake/bintools/gnu/target.cmake | 9 ++------- cmake/compiler/gcc/compiler_flags.cmake | 3 --- cmake/linker/ld/linker_flags.cmake | 2 -- 5 files changed, 2 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bb1774d020..4292e06e211 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,11 +213,6 @@ endif() # Apply the final optimization flag(s) zephyr_compile_options(${OPTIMIZATION_FLAG}) -if(CONFIG_LTO) - add_compile_options($) - add_link_options($) -endif() - # @Intent: Obtain compiler specific flags related to C++ that are not influenced by kconfig zephyr_compile_options($<$:$>) @@ -808,10 +803,6 @@ target_include_directories(${OFFSETS_LIB} PRIVATE kernel/include ${ARCH_DIR}/${ARCH}/include ) - -# Make sure that LTO will never be enabled when compiling offsets.c -set_source_files_properties(${OFFSETS_C_PATH} PROPERTIES COMPILE_OPTIONS $) - target_link_libraries(${OFFSETS_LIB} zephyr_interface) add_dependencies(zephyr_interface ${SYSCALL_LIST_H_TARGET} diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 848ce58da7e..c484898206b 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -417,13 +417,6 @@ config NO_OPTIMIZATIONS default stack sizes in order to avoid stack overflows. endchoice -config LTO - bool "Link Time Optimization [EXPERIMENTAL]" - depends on !(GEN_ISR_TABLES || GEN_IRQ_VECTOR_TABLE) || ISR_TABLES_LOCAL_DECLARATION - select EXPERIMENTAL - help - This option enables Link Time Optimization. - config COMPILER_WARNINGS_AS_ERRORS bool "Treat warnings as errors" help diff --git a/cmake/bintools/gnu/target.cmake b/cmake/bintools/gnu/target.cmake index 612f6de79b2..86c66b4825c 100644 --- a/cmake/bintools/gnu/target.cmake +++ b/cmake/bintools/gnu/target.cmake @@ -5,13 +5,8 @@ find_program(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) find_program(CMAKE_OBJDUMP ${CROSS_COMPILE}objdump PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) find_program(CMAKE_AS ${CROSS_COMPILE}as PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) -if(CONFIG_LTO) - find_program(CMAKE_AR ${CROSS_COMPILE}gcc-ar PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) - find_program(CMAKE_RANLIB ${CROSS_COMPILE}gcc-ranlib PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) -else() - find_program(CMAKE_AR ${CROSS_COMPILE}ar PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) - find_program(CMAKE_RANLIB ${CROSS_COMPILE}ranlib PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) -endif() +find_program(CMAKE_AR ${CROSS_COMPILE}ar PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) +find_program(CMAKE_RANLIB ${CROSS_COMPILE}ranlib PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) find_program(CMAKE_READELF ${CROSS_COMPILE}readelf PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) find_program(CMAKE_NM ${CROSS_COMPILE}nm PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) find_program(CMAKE_STRIP ${CROSS_COMPILE}strip PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 8e79d32387f..5b1dbde49c6 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -21,9 +21,6 @@ endif() set_compiler_property(PROPERTY optimization_speed -O2) set_compiler_property(PROPERTY optimization_size -Os) -set_compiler_property(PROPERTY optimization_lto -flto) -set_compiler_property(PROPERTY prohibit_lto -fno-lto) - ####################################################### # This section covers flags related to warning levels # ####################################################### diff --git a/cmake/linker/ld/linker_flags.cmake b/cmake/linker/ld/linker_flags.cmake index 5660b410760..8209f4dfbdc 100644 --- a/cmake/linker/ld/linker_flags.cmake +++ b/cmake/linker/ld/linker_flags.cmake @@ -12,8 +12,6 @@ endif() set_property(TARGET linker PROPERTY partial_linking "-r") -set_property(TARGET linker PROPERTY lto_arguments -flto -fno-ipa-sra -ffunction-sections -fdata-sections) - # Some linker flags might not be purely ld specific, but a combination of # linker and compiler, such as: # --coverage for clang From 8320a49e2411c0e33f1c886449296a7bb678f140 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:33 +0100 Subject: [PATCH 0803/2300] Revert "[nrf fromtree] tests: kernel: gen_isr_table: Add tests for local ISR tables declaration" This reverts commit a95608573993b93c657a2a34067335476715faa1. Signed-off-by: Robert Lubos --- tests/kernel/gen_isr_table/testcase.yaml | 27 +++--------------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/tests/kernel/gen_isr_table/testcase.yaml b/tests/kernel/gen_isr_table/testcase.yaml index eb8babe3635..4ee3ad00ac9 100644 --- a/tests/kernel/gen_isr_table/testcase.yaml +++ b/tests/kernel/gen_isr_table/testcase.yaml @@ -4,12 +4,12 @@ common: - interrupt - isr_table tests: - arch.interrupt.gen_isr_table.arm_baseline: &arm-baseline + arch.interrupt.gen_isr_table.arm_baseline: platform_allow: qemu_cortex_m3 filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE extra_configs: - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - arch.interrupt.gen_isr_table.arm_baseline.linker_generator: &arm-baseline-linker-generator + arch.interrupt.gen_isr_table.arm_baseline.linker_generator: platform_allow: qemu_cortex_m3 filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE tags: @@ -17,7 +17,7 @@ tests: extra_configs: - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - CONFIG_CMAKE_LINKER_GENERATOR=y - arch.interrupt.gen_isr_table.arm_mainline: &arm-mainline + arch.interrupt.gen_isr_table.arm_mainline: platform_allow: qemu_cortex_m3 platform_exclude: - stmf103_mini @@ -40,27 +40,6 @@ tests: - CONFIG_GEN_ISR_TABLES=n - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y build_only: true - - arch.interrupt.gen_isr_table_local.arm_baseline: - <<: *arm-baseline - filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE and not CONFIG_USERSPACE - extra_configs: - - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y - arch.interrupt.gen_isr_table_local.arm_baseline.linker_generator: - <<: *arm-baseline-linker-generator - filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE and not CONFIG_USERSPACE - extra_configs: - - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - - CONFIG_CMAKE_LINKER_GENERATOR=y - - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y - arch.interrupt.gen_isr_table_local.arm_mainline: - <<: *arm-mainline - filter: CONFIG_GEN_ISR_TABLES and CONFIG_ARMV6_M_ARMV8_M_BASELINE and not CONFIG_USERSPACE - extra_configs: - - CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y - arch.interrupt.gen_isr_table.arc: arch_allow: arc filter: CONFIG_RGF_NUM_BANKS > 1 From 839e18e1e5042ddf4acb54d60c8424535ec02733 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:33 +0100 Subject: [PATCH 0804/2300] Revert "[nrf fromtree] bluetooth: nordic: lll: Use direct ISR when applicable" This reverts commit 8d49b362415999b0cc373b2003a6d111bc68ac23. Signed-off-by: Robert Lubos --- subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index cde5f5befc9..db8f25a374c 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -191,13 +191,8 @@ int lll_init(void) radio_nrf5_isr, IRQ_CONNECT_FLAGS); IRQ_CONNECT(RTC0_IRQn, CONFIG_BT_CTLR_ULL_HIGH_PRIO, rtc0_nrf5_isr, NULL, 0); -#if defined(CONFIG_BT_CTLR_ZLI) - IRQ_DIRECT_CONNECT(HAL_SWI_RADIO_IRQ, CONFIG_BT_CTLR_LLL_PRIO, - swi_lll_nrf5_isr, IRQ_CONNECT_FLAGS); -#else IRQ_CONNECT(HAL_SWI_RADIO_IRQ, CONFIG_BT_CTLR_LLL_PRIO, swi_lll_nrf5_isr, NULL, IRQ_CONNECT_FLAGS); -#endif #if defined(CONFIG_BT_CTLR_LOW_LAT) || \ (CONFIG_BT_CTLR_ULL_HIGH_PRIO != CONFIG_BT_CTLR_ULL_LOW_PRIO) IRQ_CONNECT(HAL_SWI_JOB_IRQ, CONFIG_BT_CTLR_ULL_LOW_PRIO, From ee073712ff21d46be34db9c1e79c25917b3b428e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:33 +0100 Subject: [PATCH 0805/2300] Revert "[nrf fromtree] arch: arm: Upgrade IDT_LIST memory section size" This reverts commit 2ceeebc0cc27840431bc4601d98c30c4832e106f. Signed-off-by: Robert Lubos --- include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld | 2 +- include/zephyr/arch/arm/cortex_m/scripts/linker.ld | 2 +- include/zephyr/arch/arm64/scripts/linker.ld | 2 +- 3 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 f8b117e9193..a27dd55a8cf 100644 --- a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld @@ -81,7 +81,7 @@ MEMORY RAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE LINKER_DT_REGIONS() /* Used by and documented in include/linker/intlist.ld */ - IDT_LIST (wx) : ORIGIN = 0xFFFF8000, LENGTH = 32K + IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K } ENTRY(CONFIG_KERNEL_ENTRY) diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 4fcd99b5ac8..13c2747f5a3 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -86,7 +86,7 @@ MEMORY #endif LINKER_DT_REGIONS() /* Used by and documented in include/linker/intlist.ld */ - IDT_LIST (wx) : ORIGIN = 0xFFFF7FFF, LENGTH = 32K + IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K } ENTRY(CONFIG_KERNEL_ENTRY) diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index beea11a68dd..d2a0d32d581 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -61,7 +61,7 @@ MEMORY FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE RAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE /* Used by and documented in include/linker/intlist.ld */ - IDT_LIST (wx) : ORIGIN = 0xFFFF8000, LENGTH = 32K + IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K } ENTRY(CONFIG_KERNEL_ENTRY) From 784b5c08832368f45cdacb8dca60718b6d51a0ed Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:34 +0100 Subject: [PATCH 0806/2300] Revert "[nrf fromtree] arch: arm: Update to support local ISR declaration" This reverts commit 7dfe1310ee332d9ab1c54590b47c0a6f92504c5f. Signed-off-by: Robert Lubos --- arch/arm/core/CMakeLists.txt | 8 -------- arch/arm/core/swi_tables.ld | 8 -------- arch/arm/core/vector_table.ld | 4 ---- arch/arm64/core/CMakeLists.txt | 8 -------- arch/arm64/core/swi_tables.ld | 8 -------- arch/common/CMakeLists.txt | 5 ----- include/zephyr/arch/arm64/scripts/linker.ld | 5 +---- include/zephyr/linker/irq-vector-table-section.ld | 2 -- include/zephyr/linker/isr-local-drop-unused.ld | 9 --------- 9 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 arch/arm/core/swi_tables.ld delete mode 100644 arch/arm64/core/swi_tables.ld delete mode 100644 include/zephyr/linker/isr-local-drop-unused.ld diff --git a/arch/arm/core/CMakeLists.txt b/arch/arm/core/CMakeLists.txt index 680e21fdb59..1b4fa58eae5 100644 --- a/arch/arm/core/CMakeLists.txt +++ b/arch/arm/core/CMakeLists.txt @@ -34,11 +34,3 @@ else() zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors vector_table.ld) zephyr_linker_sources(ROM_START SORT_KEY 0x1vectors cortex_m/vector_table_pad.ld) endif() - -if(CONFIG_GEN_SW_ISR_TABLE) - if(CONFIG_DYNAMIC_INTERRUPTS) - zephyr_linker_sources(RWDATA swi_tables.ld) - else() - zephyr_linker_sources(RODATA swi_tables.ld) - endif() -endif() diff --git a/arch/arm/core/swi_tables.ld b/arch/arm/core/swi_tables.ld deleted file mode 100644 index c6ca94604dd..00000000000 --- a/arch/arm/core/swi_tables.ld +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ -#if LINKER_ZEPHYR_FINAL -INCLUDE zephyr/isr_tables_swi.ld -#endif diff --git a/arch/arm/core/vector_table.ld b/arch/arm/core/vector_table.ld index 58210afdcbc..615067dbf74 100644 --- a/arch/arm/core/vector_table.ld +++ b/arch/arm/core/vector_table.ld @@ -51,10 +51,6 @@ _vector_start = .; KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) -#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION -INCLUDE zephyr/isr_tables_vt.ld -#else KEEP(*(.vectors)) -#endif _vector_end = .; diff --git a/arch/arm64/core/CMakeLists.txt b/arch/arm64/core/CMakeLists.txt index 05e4be8c0ea..1804556c1a7 100644 --- a/arch/arm64/core/CMakeLists.txt +++ b/arch/arm64/core/CMakeLists.txt @@ -55,11 +55,3 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU") endif() add_subdirectory_ifdef(CONFIG_XEN xen) - -if(CONFIG_GEN_SW_ISR_TABLE) - if(CONFIG_DYNAMIC_INTERRUPTS) - zephyr_linker_sources(RWDATA swi_tables.ld) - else() - zephyr_linker_sources(RODATA swi_tables.ld) - endif() -endif() diff --git a/arch/arm64/core/swi_tables.ld b/arch/arm64/core/swi_tables.ld deleted file mode 100644 index c6ca94604dd..00000000000 --- a/arch/arm64/core/swi_tables.ld +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ -#if LINKER_ZEPHYR_FINAL -INCLUDE zephyr/isr_tables_swi.ld -#endif diff --git a/arch/common/CMakeLists.txt b/arch/common/CMakeLists.txt index 409c378f620..1a89ba9c13a 100644 --- a/arch/common/CMakeLists.txt +++ b/arch/common/CMakeLists.txt @@ -39,11 +39,6 @@ zephyr_linker_sources_ifdef(CONFIG_GEN_ISR_TABLES ${ZEPHYR_BASE}/include/zephyr/linker/intlist.ld ) -zephyr_linker_sources_ifdef(CONFIG_ISR_TABLES_LOCAL_DECLARATION - SECTIONS - ${ZEPHYR_BASE}/include/zephyr/linker/isr-local-drop-unused.ld -) - zephyr_linker_sources_ifdef(CONFIG_GEN_IRQ_VECTOR_TABLE ROM_START SORT_KEY 0x0vectors diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index d2a0d32d581..fa08b730304 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -105,11 +105,8 @@ SECTIONS KEEP(*(.exc_vector_table)) KEEP(*(".exc_vector_table.*")) -#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION - INCLUDE zephyr/isr_tables_vt.ld -#else KEEP(*(.vectors)) -#endif + _vector_end = .; *(.text) diff --git a/include/zephyr/linker/irq-vector-table-section.ld b/include/zephyr/linker/irq-vector-table-section.ld index 141eee4d28d..17c483db98f 100644 --- a/include/zephyr/linker/irq-vector-table-section.ld +++ b/include/zephyr/linker/irq-vector-table-section.ld @@ -1,9 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ -#if !(LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION) . = ALIGN(CONFIG_ARCH_IRQ_VECTOR_TABLE_ALIGN); KEEP(*(_IRQ_VECTOR_TABLE_SECTION_SYMS)) -#endif /* * Some ARM platforms require this symbol to be placed after the IRQ vector diff --git a/include/zephyr/linker/isr-local-drop-unused.ld b/include/zephyr/linker/isr-local-drop-unused.ld deleted file mode 100644 index 9b6e1272413..00000000000 --- a/include/zephyr/linker/isr-local-drop-unused.ld +++ /dev/null @@ -1,9 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#if LINKER_ZEPHYR_FINAL && CONFIG_ISR_TABLES_LOCAL_DECLARATION -/DISCARD/ : -{ - KEEP(*(.vectors)) - KEEP(*(_IRQ_VECTOR_TABLE_SECTION_SYMS)) -} -#endif From 4436ed591009fc68c4faa32905097e8e0b7dafd1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:34 +0100 Subject: [PATCH 0807/2300] Revert "[nrf fromtree] arch: irq: Use Z_ISR_DECLARE_DIRECT for direct ISR declaration." This reverts commit 89f5e4bee9a5f13cabc58371cc466ec08091a867. Signed-off-by: Robert Lubos --- include/zephyr/arch/arc/v2/irq.h | 2 +- include/zephyr/arch/arm/irq.h | 2 +- include/zephyr/arch/riscv/irq.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/zephyr/arch/arc/v2/irq.h b/include/zephyr/arch/arc/v2/irq.h index 45b9d138857..e0b42549597 100644 --- a/include/zephyr/arch/arc/v2/irq.h +++ b/include/zephyr/arch/arc/v2/irq.h @@ -77,7 +77,7 @@ extern void z_irq_priority_set(unsigned int irq, unsigned int prio, */ #define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \ { \ - Z_ISR_DECLARE_DIRECT(irq_p, ISR_FLAG_DIRECT, isr_p); \ + Z_ISR_DECLARE(irq_p, ISR_FLAG_DIRECT, isr_p, NULL); \ BUILD_ASSERT(priority_p || !IS_ENABLED(CONFIG_ARC_FIRQ) || \ (IS_ENABLED(CONFIG_ARC_FIRQ_STACK) && \ !IS_ENABLED(CONFIG_ARC_STACK_CHECKING)), \ diff --git a/include/zephyr/arch/arm/irq.h b/include/zephyr/arch/arm/irq.h index 143b8e54179..357c91a83ae 100644 --- a/include/zephyr/arch/arm/irq.h +++ b/include/zephyr/arch/arm/irq.h @@ -127,7 +127,7 @@ extern void z_arm_interrupt_init(void); BUILD_ASSERT(IS_ENABLED(CONFIG_ZERO_LATENCY_IRQS) || !(flags_p & IRQ_ZERO_LATENCY), \ "ZLI interrupt registered but feature is disabled"); \ _CHECK_PRIO(priority_p, flags_p) \ - Z_ISR_DECLARE_DIRECT(irq_p, ISR_FLAG_DIRECT, isr_p); \ + Z_ISR_DECLARE(irq_p, ISR_FLAG_DIRECT, isr_p, NULL); \ z_arm_irq_priority_set(irq_p, priority_p, flags_p); \ } diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index d067ccfca23..fa4b3989f05 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -69,8 +69,8 @@ extern void z_riscv_irq_priority_set(unsigned int irq, #define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \ { \ - Z_ISR_DECLARE_DIRECT(irq_p + CONFIG_RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET, \ - ISR_FLAG_DIRECT, isr_p); \ + Z_ISR_DECLARE(irq_p + CONFIG_RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET, \ + ISR_FLAG_DIRECT, isr_p, NULL); \ } #define ARCH_ISR_DIRECT_HEADER() arch_isr_direct_header() From 590ec3c2ba964e5f80ba5c67130546a379d896d9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:34 +0100 Subject: [PATCH 0808/2300] Revert "[nrf fromtree] doc: kernel: interrupts: Description of the local isr declaration" This reverts commit 8d2e8b57a06bad6e49ff2245216f264e780544c3. Signed-off-by: Robert Lubos --- doc/kernel/services/interrupts.rst | 120 +---------------------------- 1 file changed, 3 insertions(+), 117 deletions(-) diff --git a/doc/kernel/services/interrupts.rst b/doc/kernel/services/interrupts.rst index 7af101a40d1..44f0805edb0 100644 --- a/doc/kernel/services/interrupts.rst +++ b/doc/kernel/services/interrupts.rst @@ -457,38 +457,6 @@ Interrupt tables are set up at build time using some special build tools. The details laid out here apply to all architectures except x86, which are covered in the `x86 Details`_ section below. -The invocation of :c:macro:`IRQ_CONNECT` will declare an instance of -struct _isr_list wich is placed in a special .intList section. -This section is placed in compiled code on precompilation stages only. -It is meant to be used by Zephyr script to generate interrupt tables -and is removed from the final build. -The script implements different parsers to process the data from .intList section -and produce the required output. - -The default parser generates C arrays filled with arguments and interrupt -handlers in a form of addresses directly taken from .intList section entries. -It works with all the architectures and compillers (with the exception mentioned above). -The limitation of this parser is the fact that after the arrays are generated -it is expected for the code not to relocate. -Any relocation on this stage may lead to the situation where the entry in the interrupt array -is no longer pointing to the function that was expected. -It means that this parser, being more compatible is limiting us from using Link Time Optimization. - -The local isr declaration parser uses different approach to construct -the same arrays at binnary level. -All the entries to the arrays are declared and defined locally, -directly in the file where :c:macro:`IRQ_CONNECT` is used. -They are placed in a section with the unique, synthetized name. -The name of the section is then placed in .intList section and it is used to create linker script -to properly place the created entry in the right place in the memory. -This parser is now limited to the supported architectures and toolchains but in reward it keeps -the information about object relations for linker thus allowing the Link Time Optimization. - -Implementation using C arrays ------------------------------ - -This is the default configuration available for all Zephyr supported architectures. - Any invocation of :c:macro:`IRQ_CONNECT` will declare an instance of struct _isr_list which is placed in a special .intList section: @@ -532,7 +500,7 @@ do not support the notion of interrupt priority, in which case the priority argument is ignored. Vector Table -~~~~~~~~~~~~ +------------ A vector table is generated when :kconfig:option:`CONFIG_GEN_IRQ_VECTOR_TABLE` is enabled. This data structure is used natively by the CPU and is simply an array of function pointers, where each element n corresponds to the IRQ handler @@ -559,7 +527,7 @@ CONFIG_GEN_IRQ_START_VECTOR needs to be set to properly offset the indices in the table. SW ISR Table -~~~~~~~~~~~~ +------------ This is an array of struct _isr_table_entry: .. code-block:: c @@ -574,7 +542,7 @@ argument and execute it. The active IRQ line is looked up in an interrupt controller register and used to index this table. Shared SW ISR Table -~~~~~~~~~~~~~~~~~~~ +------------------- This is an array of struct z_shared_isr_table_entry: @@ -590,88 +558,6 @@ lines. Whenever an interrupt line becomes shared, c:func:`z_shared_isr` will replace the currently registered ISR in _sw_isr_table. This special ISR will iterate through the list of registered clients and invoke the ISRs. -Implementation using linker script ----------------------------------- - -This way of prepare and parse .isrList section to implement interrupt vectors arrays -is called local isr declaration. -The name comes from the fact that all the entries to the arrays that would create -interrupt vectors are created locally in place of invocation of :c:macro:`IRQ_CONNECT` macro. -Then automatically generated linker scripts are used to place it in the right place in the memory. - -This option requires enabling by the choose of :kconfig:option:`ISR_TABLES_LOCAL_DECLARATION`. -If this configuration is supported by the used architecture and toolchaing the -:kconfig:option:`ISR_TABLES_LOCAL_DECLARATION_SUPPORTED` is set. -See defails of this option for the information about currently supported configurations. - -Any invocation of :c:macro:`IRQ_CONNECT` or `IRQ_DIRECT_CONNECT` will declare an instance of struct -_isr_list_sname which is placde in a special .intList section: - -.. code-block:: c - - struct _isr_list_sname { - /** IRQ line number */ - int32_t irq; - /** Flags for this IRQ, see ISR_FLAG_* definitions */ - int32_t flags; - /** The section name */ - const char sname[]; - }; - -Note that the section name is placed in flexible array member. -It means that the size of the initialized structure will warry depending on the -structure name length. -The whole entry is used by the script during the build of the application -and has all the information needed for proper interrupt placement. - -Beside of the _isr_list_sname the :c:macro:`IRQ_CONNECT` macro generates an entry -that would be the part of the interrupt array: - -.. code-block:: c - - struct _isr_table_entry { - const void *arg; - void (*isr)(const void *); - }; - -This array is placed in a section with the name saved in _isr_list_sname structure. - -The values created by :c:macro:`IRQ_DIRECT_CONNECT` macro depends on the architecture. -It can be changed to variable that points to a interrupt handler: - -.. code-block:: c - - static uintptr_t = ((uintptr_t)func); - -Or to actuall naked function that implements a jump to the interrupt handler: - -.. code-block:: c - - static void (void) - { - __asm(ARCH_IRQ_VECTOR_JUMP_CODE(func)); - } - -Simillar like for :c:macro:`IRQ_CONNECT`, the created variable or function is placed -in a section, saved in _isr_list_sname section. - -Files generated by the script -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The interrupt tables generator script creates 3 files: -isr_tables.c, isr_tables_swi.ld, and isr_tables_vt.ld. - -The isr_tables.c will contain all the structures for interrupts, direct interrupts and -shared interrupts (if enabled). This file implements only all the structures that -are not implemented by the application, leaving a comment where the interrupt -not implemented here can be found. - -Then two linker files are used. The isr_tables_vt.ld file is included in place -where the interrupt vectors are required to be placed in the selected architecture. -The isr_tables_swi.ld file describes the placement of the software interrupt table -elements. The separated file is required as it might be placed in writable on nonwritable -section, depending on the current configuration. - x86 Details ----------- From 8a40ccc51d7af9089edd6ac4e452984c0307613e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:34 +0100 Subject: [PATCH 0809/2300] Revert "[nrf fromtree] arch: sw_isr_table: Implement local interrupt table entry creation" This reverts commit bc839026a8eeee96ee311fc6278860a6d94bc2da. Signed-off-by: Robert Lubos --- arch/Kconfig | 23 ------- include/zephyr/sw_isr_table.h | 114 ---------------------------------- 2 files changed, 137 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 5c0ad5f49d9..5e3b96f414d 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -391,29 +391,6 @@ config NOCACHE_MEMORY menu "Interrupt Configuration" -config ISR_TABLES_LOCAL_DECLARATION_SUPPORTED - bool - default y - # Userspace is currently not supported - depends on !USERSPACE - # List of currently supported architectures - depends on ARM || ARM64 - # List of currently supported toolchains - depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr" || "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "gnuarmemb" - -config ISR_TABLES_LOCAL_DECLARATION - bool "ISR tables created locally and placed by linker [EXPERIMENTAL]" - depends on ISR_TABLES_LOCAL_DECLARATION_SUPPORTED - select EXPERIMENTAL - help - Enable new scheme of interrupt tables generation. - This is totally different generator that would create tables entries locally - where the IRQ_CONNECT macro is called and then use the linker script to position it - in the right place in memory. - The most important advantage of such approach is that the generated interrupt tables - are LTO compatible. - The drawback is that the support on the architecture port is required. - config DYNAMIC_INTERRUPTS bool "Installation of IRQs at runtime" help diff --git a/include/zephyr/sw_isr_table.h b/include/zephyr/sw_isr_table.h index 7b1bfddb2cb..fc094b887ba 100644 --- a/include/zephyr/sw_isr_table.h +++ b/include/zephyr/sw_isr_table.h @@ -18,7 +18,6 @@ #include #include #include -#include #ifdef __cplusplus extern "C" { @@ -57,9 +56,6 @@ struct _irq_parent_entry { * uses it to create the IRQ vector table and the _sw_isr_table. * * More discussion in include/linker/intlist.ld - * - * This is a version used when CONFIG_ISR_TABLES_LOCAL_DECLARATION is disabled. - * See _isr_list_sname used otherwise. */ struct _isr_list { /** IRQ line number */ @@ -72,24 +68,6 @@ struct _isr_list { const void *param; }; -/* - * Data structure created in a special binary .intlist section for each - * configured interrupt. gen_isr_tables.py pulls this out of the binary and - * uses it to create linker script chunks that would place interrupt table entries - * in the right place in the memory. - * - * This is a version used when CONFIG_ISR_TABLES_LOCAL_DECLARATION is enabled. - * See _isr_list used otherwise. - */ -struct _isr_list_sname { - /** IRQ line number */ - int32_t irq; - /** Flags for this IRQ, see ISR_FLAG_* definitions */ - int32_t flags; - /** The section name */ - const char sname[]; -}; - #ifdef CONFIG_SHARED_INTERRUPTS struct z_shared_isr_table_entry { struct _isr_table_entry clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; @@ -107,90 +85,6 @@ extern struct z_shared_isr_table_entry z_shared_sw_isr_table[]; #define _MK_ISR_NAME(x, y) __MK_ISR_NAME(x, y) #define __MK_ISR_NAME(x, y) __isr_ ## x ## _irq_ ## y - -#if IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) - -#define _MK_ISR_ELEMENT_NAME(func, id) __MK_ISR_ELEMENT_NAME(func, id) -#define __MK_ISR_ELEMENT_NAME(func, id) __isr_table_entry_ ## func ## _irq_ ## id - -#define _MK_IRQ_ELEMENT_NAME(func, id) __MK_ISR_ELEMENT_NAME(func, id) -#define __MK_IRQ_ELEMENT_NAME(func, id) __irq_table_entry_ ## func ## _irq_ ## id - -#define _MK_ISR_SECTION_NAME(prefix, file, counter) \ - "." Z_STRINGIFY(prefix)"."file"." Z_STRINGIFY(counter) - -#define _MK_ISR_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(irq, __FILE__, counter) -#define _MK_IRQ_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(isr, __FILE__, counter) - -/* Separated macro to create ISR table entry only. - * Used by Z_ISR_DECLARE and ISR tables generation script. - */ -#define _Z_ISR_TABLE_ENTRY(irq, func, param, sect) \ - static Z_DECL_ALIGN(struct _isr_table_entry) \ - __attribute__((section(sect))) \ - __used _MK_ISR_ELEMENT_NAME(func, __COUNTER__) = { \ - .arg = (const void *)(param), \ - .isr = (void (*)(const void *))(void *)(func) \ - } - -#define Z_ISR_DECLARE_C(irq, flags, func, param, counter) \ - _Z_ISR_DECLARE_C(irq, flags, func, param, counter) - -#define _Z_ISR_DECLARE_C(irq, flags, func, param, counter) \ - _Z_ISR_TABLE_ENTRY(irq, func, param, _MK_ISR_ELEMENT_SECTION(counter)); \ - static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \ - __used _MK_ISR_NAME(func, counter) = \ - {irq, flags, _MK_ISR_ELEMENT_SECTION(counter)} - -/* Create an entry for _isr_table to be then placed by the linker. - * An instance of struct _isr_list which gets put in the .intList - * section is created with the name of the section where _isr_table entry is placed to be then - * used by isr generation script to create linker script chunk. - */ -#define Z_ISR_DECLARE(irq, flags, func, param) \ - BUILD_ASSERT(((flags) & ISR_FLAG_DIRECT) == 0, "Use Z_ISR_DECLARE_DIRECT macro"); \ - Z_ISR_DECLARE_C(irq, flags, func, param, __COUNTER__) - - -/* Separated macro to create ISR Direct table entry only. - * Used by Z_ISR_DECLARE_DIRECT and ISR tables generation script. - */ -#define _Z_ISR_DIRECT_TABLE_ENTRY(irq, func, sect) \ - COND_CODE_1(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS, ( \ - static Z_DECL_ALIGN(uintptr_t) \ - __attribute__((section(sect))) \ - __used _MK_IRQ_ELEMENT_NAME(func, __COUNTER__) = ((uintptr_t)(func)); \ - ), ( \ - static void __attribute__((section(sect))) __attribute__((naked)) \ - __used _MK_IRQ_ELEMENT_NAME(func, __COUNTER__)(void) { \ - __asm(ARCH_IRQ_VECTOR_JUMP_CODE(func)); \ - } \ - )) - -#define Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) \ - _Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) - -#define _Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) \ - _Z_ISR_DIRECT_TABLE_ENTRY(irq, func, _MK_IRQ_ELEMENT_SECTION(counter)); \ - static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \ - __used _MK_ISR_NAME(func, counter) = { \ - irq, \ - ISR_FLAG_DIRECT | (flags), \ - _MK_IRQ_ELEMENT_SECTION(counter)} - -/* Create an entry to irq table and place it in specific section which name is then placed - * in an instance of struct _isr_list to be then used by the isr generation script to create - * the linker script chunks. - */ -#define Z_ISR_DECLARE_DIRECT(irq, flags, func) \ - BUILD_ASSERT(IS_ENABLED(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS) || \ - IS_ENABLED(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE), \ - "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set"); \ - Z_ISR_DECLARE_DIRECT_C(irq, flags, func, __COUNTER__) - - -#else /* IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) */ - /* Create an instance of struct _isr_list which gets put in the .intList * section. This gets consumed by gen_isr_tables.py which creates the vector * and/or SW ISR tables. @@ -200,14 +94,6 @@ extern struct z_shared_isr_table_entry z_shared_sw_isr_table[]; __used _MK_ISR_NAME(func, __COUNTER__) = \ {irq, flags, (void *)&func, (const void *)param} -/* The version of the Z_ISR_DECLARE that should be used for direct ISR declaration. - * It is here for the API match the version with CONFIG_ISR_TABLES_LOCAL_DECLARATION enabled. - */ -#define Z_ISR_DECLARE_DIRECT(irq, flags, func) \ - Z_ISR_DECLARE(irq, ISR_FLAG_DIRECT | (flags), func, NULL) - -#endif - #define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR) #ifdef CONFIG_DYNAMIC_INTERRUPTS From 01fe23bf212b780a28c4bfacbd7643dac0136e7d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:34 +0100 Subject: [PATCH 0810/2300] Revert "[nrf fromtree] scripts: build: gen_isr_tables: Implement local ISR generation" This reverts commit c994131159644b58dbaa1985643c799e703b07e3. Signed-off-by: Robert Lubos --- CMakeLists.txt | 3 +- arch/common/isr_tables.c | 12 - scripts/build/gen_isr_tables.py | 332 +++++++++++++--- .../build/gen_isr_tables_parser_carrays.py | 292 -------------- scripts/build/gen_isr_tables_parser_local.py | 375 ------------------ 5 files changed, 288 insertions(+), 726 deletions(-) delete mode 100644 scripts/build/gen_isr_tables_parser_carrays.py delete mode 100644 scripts/build/gen_isr_tables_parser_local.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 4292e06e211..97bcd98d0d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1226,11 +1226,10 @@ if(CONFIG_GEN_ISR_TABLES) # isr_tables.c is generated from ${ZEPHYR_LINK_STAGE_EXECUTABLE} by # gen_isr_tables.py add_custom_command( - OUTPUT isr_tables.c isr_tables_vt.ld isr_tables_swi.ld + OUTPUT isr_tables.c COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/gen_isr_tables.py --output-source isr_tables.c - --linker-output-files isr_tables_vt.ld isr_tables_swi.ld --kernel $ --intlist-section .intList --intlist-section intList diff --git a/arch/common/isr_tables.c b/arch/common/isr_tables.c index 050597b7b1d..9677c92683d 100644 --- a/arch/common/isr_tables.c +++ b/arch/common/isr_tables.c @@ -15,11 +15,6 @@ struct int_list_header { uint32_t table_size; uint32_t offset; -#if IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) - uint32_t swi_table_entry_size; - uint32_t shared_isr_table_entry_size; - uint32_t shared_isr_client_num_offset; -#endif /* IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) */ }; /* These values are not included in the resulting binary, but instead form the @@ -29,13 +24,6 @@ struct int_list_header { Z_GENERIC_SECTION(.irq_info) __used struct int_list_header _iheader = { .table_size = IRQ_TABLE_SIZE, .offset = CONFIG_GEN_IRQ_START_VECTOR, -#if IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) - .swi_table_entry_size = sizeof(struct _isr_table_entry), -#if IS_ENABLED(CONFIG_SHARED_INTERRUPTS) - .shared_isr_table_entry_size = sizeof(struct z_shared_isr_table_entry), - .shared_isr_client_num_offset = offsetof(struct z_shared_isr_table_entry, client_num), -#endif /* IS_ENABLED(CONFIG_SHARED_INTERRUPTS) */ -#endif /* IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) */ }; /* These are placeholder tables. They will be replaced by the real tables diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 84812d708e8..3032d1e30c9 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -8,9 +8,9 @@ # import argparse +import struct import sys import os -import importlib from elftools.elf.elffile import ELFFile from elftools.elf.sections import SymbolTableSection @@ -44,13 +44,10 @@ class gen_isr_config: """ # Constants __ISR_FLAG_DIRECT = 1 << 0 - __swt_spurious_handler = "z_irq_spurious" - __swt_shared_handler = "z_shared_isr" + __swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" + __swt_shared_handler = "((uintptr_t)&z_shared_isr)" __vt_spurious_handler = "z_irq_spurious" __vt_irq_handler = "_isr_wrapper" - __shared_array_name = "z_shared_sw_isr_table" - __sw_isr_array_name = "_sw_isr_table" - __irq_vector_array_name = "_irq_vector_table" @staticmethod def __bm(bits): @@ -143,18 +140,6 @@ def swt_shared_handler(self): def vt_default_handler(self): return self.__vt_default_handler - @property - def shared_array_name(self): - return self.__shared_array_name - - @property - def sw_isr_array_name(self): - return self.__sw_isr_array_name - - @property - def irq_vector_array_name(self): - return self.__irq_vector_array_name - @property def int_bits(self): return self.__int_bits @@ -248,6 +233,289 @@ def check_64b(self): return self.check_sym("CONFIG_64BIT") +class gen_isr_parser: + source_header = """ +/* AUTO-GENERATED by gen_isr_tables.py, do not edit! */ + +#include +#include +#include +#include + +typedef void (* ISR)(const void *); +""" + + source_assembly_header = """ +#ifndef ARCH_IRQ_VECTOR_JUMP_CODE +#error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" +#endif +""" + + def __init__(self, intlist_data, config, log): + """Initialize the parser. + + The function prepares parser to work. + Parameters: + - intlist_data: The binnary data from intlist section + - config: The configuration object + - log: The logging object, has to have error and debug methods + """ + self.__config = config + self.__log = log + intlist = self.__read_intlist(intlist_data) + self.__vt, self.__swt, self.__nv = self.__parse_intlist(intlist) + + def __read_intlist(self, intlist_data): + """read a binary file containing the contents of the kernel's .intList + section. This is an instance of a header created by + include/zephyr/linker/intlist.ld: + + struct { + uint32_t num_vectors; <- typically CONFIG_NUM_IRQS + struct _isr_list isrs[]; <- Usually of smaller size than num_vectors + } + + Followed by instances of struct _isr_list created by IRQ_CONNECT() + calls: + + struct _isr_list { + /** IRQ line number */ + int32_t irq; + /** Flags for this IRQ, see ISR_FLAG_* definitions */ + int32_t flags; + /** ISR to call */ + void *func; + /** Parameter for non-direct IRQs */ + const void *param; + }; + """ + intlist = {} + prefix = self.__config.endian_prefix() + + # Extract header and the rest of the data + intlist_header_fmt = prefix + "II" + header_sz = struct.calcsize(intlist_header_fmt) + header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) + self.__log.debug(str(header_raw)) + + intlist["num_vectors"] = header_raw[0] + intlist["offset"] = header_raw[1] + intdata = intlist_data[header_sz:] + + # Extract information about interrupts + if self.__config.check_64b(): + intlist_entry_fmt = prefix + "iiQQ" + else: + intlist_entry_fmt = prefix + "iiII" + + intlist["interrupts"] = [i for i in + struct.iter_unpack(intlist_entry_fmt, intdata)] + + self.__log.debug("Configured interrupt routing") + self.__log.debug("handler irq flags param") + self.__log.debug("--------------------------") + + for irq in intlist["interrupts"]: + self.__log.debug("{0:<10} {1:<3} {2:<3} {3}".format( + hex(irq[2]), irq[0], irq[1], hex(irq[3]))) + + return intlist + + def __parse_intlist(self, intlist): + """All the intlist data are parsed into swt and vt arrays. + + The vt array is prepared for hardware interrupt table. + Every entry in the selected position would contain None or the name of the function pointer + (address or string). + + The swt is a little more complex. At every position it would contain an array of parameter and + function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. + If empty array is placed on selected position - it means that the application does not implement + this interrupt. + + Parameters: + - intlist: The preprocessed list of intlist section content (see read_intlist) + + Return: + vt, swt - parsed vt and swt arrays (see function description above) + """ + nvec = intlist["num_vectors"] + offset = intlist["offset"] + + if nvec > pow(2, 15): + raise ValueError('nvec is too large, check endianness.') + + self.__log.debug('offset is ' + str(offset)) + self.__log.debug('num_vectors is ' + str(nvec)) + + # Set default entries in both tables + if not(self.__config.args.sw_isr_table or self.__config.args.vector_table): + self.__log.error("one or both of -s or -V needs to be specified on command line") + if self.__config.args.vector_table: + vt = [None for i in range(nvec)] + else: + vt = None + if self.__config.args.sw_isr_table: + swt = [[] for i in range(nvec)] + else: + swt = None + + # Process intlist and write to the tables created + for irq, flags, func, param in intlist["interrupts"]: + if not vt: + error("Direct Interrupt %d declared with parameter 0x%x " + "but no vector table in use" + % (irq, param)) + if self.__config.test_isr_direct(flags): + if param != 0: + self.__log.error("Direct irq %d declared, but has non-NULL parameter" + % irq) + if not 0 <= irq - offset < len(vt): + self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % + (irq - offset, offset, len(vt) - 1)) + vt[irq - offset] = func + else: + # Regular interrupt + if not swt: + self.__log.error("Regular Interrupt %d declared with parameter 0x%x " + "but no SW ISR_TABLE in use" + % (irq, param)) + + table_index = self.__config.get_swt_table_index(offset, irq) + + if not 0 <= table_index < len(swt): + self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % + (table_index, offset, len(swt) - 1)) + if self.__config.check_shared_interrupts(): + lst = swt[table_index] + if (param, func) in lst: + self.__log.error("Attempting to register the same ISR/arg pair twice.") + if len(lst) >= self.__config.get_sym("CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"): + self.__log.error(f"Reached shared interrupt client limit. Maybe increase" + + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") + else: + if len(swt[table_index]) > 0: + self.__log.error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" + + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" + + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" + ) + swt[table_index].append((param, func)) + + return vt, swt, nvec + + def __write_code_irq_vector_table(self, fp): + fp.write(self.source_assembly_header) + + fp.write("void __irq_vector_table __attribute__((naked)) _irq_vector_table(void) {\n") + for i in range(self.__nv): + func = self.__vt[i] + + if func is None: + func = self.__config.vt_default_handler + + if isinstance(func, int): + func_as_string = self.__config.get_sym_from_addr(func) + else: + func_as_string = func + + fp.write("\t__asm(ARCH_IRQ_VECTOR_JUMP_CODE({}));\n".format(func_as_string)) + fp.write("}\n") + + def __write_address_irq_vector_table(self, fp): + fp.write("uintptr_t __irq_vector_table _irq_vector_table[%d] = {\n" % self.__nv) + for i in range(self.__nv): + func = self.__vt[i] + + if func is None: + func = self.__config.vt_default_handler + + if isinstance(func, int): + fp.write("\t{},\n".format(func)) + else: + fp.write("\t((uintptr_t)&{}),\n".format(func)) + + fp.write("};\n") + + def __write_shared_table(self, fp): + fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" + " z_shared_sw_isr_table[%d] = {\n" % self.__nv) + + for i in range(self.__nv): + if self.__swt[i] is None: + client_num = 0 + client_list = None + else: + client_num = len(self.__swt[i]) + client_list = self.__swt[i] + + if client_num <= 1: + fp.write("\t{ },\n") + else: + fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") + for j in range(0, client_num): + routine = client_list[j][1] + arg = client_list[j][0] + + fp.write(f"{{ .isr = (ISR){ hex(routine) if isinstance(routine, int) else routine }, " + f".arg = (const void *){hex(arg)} }},") + + fp.write(" },\n},\n") + + fp.write("};\n") + + def write_source(self, fp): + fp.write(self.source_header) + + if self.__config.check_shared_interrupts(): + self.__write_shared_table(fp) + + if self.__vt: + if self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS"): + self.__write_address_irq_vector_table(fp) + elif self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE"): + self.__write_code_irq_vector_table(fp) + else: + self.__log.error("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set") + + if not self.__swt: + return + + fp.write("struct _isr_table_entry __sw_isr_table _sw_isr_table[%d] = {\n" + % self.__nv) + + level2_offset = self.__config.get_irq_baseoffset(2) + level3_offset = self.__config.get_irq_baseoffset(3) + + for i in range(self.__nv): + if len(self.__swt[i]) == 0: + # Not used interrupt + param = "0x0" + func = self.__config.swt_spurious_handler + elif len(self.__swt[i]) == 1: + # Single interrupt + param = "{0:#x}".format(self.__swt[i][0][0]) + func = self.__swt[i][0][1] + else: + # Shared interrupt + param = "&z_shared_sw_isr_table[{0}]".format(i) + func = self.__config.swt_shared_handler + + if isinstance(func, int): + func_as_string = "{0:#x}".format(func) + else: + func_as_string = func + + if level2_offset is not None and i == level2_offset: + fp.write("\t/* Level 2 interrupts start here (offset: {}) */\n". + format(level2_offset)) + if level3_offset is not None and i == level3_offset: + fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". + format(level3_offset)) + + fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) + fp.write("};\n") + + def get_symbols(obj): for section in obj.iter_sections(): if isinstance(section, SymbolTableSection): @@ -286,12 +554,6 @@ def parse_args(): help="Print additional debugging information") parser.add_argument("-o", "--output-source", required=True, help="Output source file") - parser.add_argument("-l", "--linker-output-files", - nargs=2, - metavar=("vector_table_link", "software_interrupt_link"), - help="Output linker files. " - "Used only if CONFIG_ISR_TABLES_LOCAL_DECLARATION is enabled. " - "In other case empty file would be generated.") parser.add_argument("-k", "--kernel", required=True, help="Zephyr kernel image") parser.add_argument("-s", "--sw-isr-table", action="store_true", @@ -314,31 +576,11 @@ def main(): config = gen_isr_config(args, get_symbols(kernel), log) intlist_data = read_intList_sect(kernel, config.get_intlist_snames()) - if config.check_sym("CONFIG_ISR_TABLES_LOCAL_DECLARATION"): - sys.stdout.write( - "Warning: The EXPERIMENTAL ISR_TABLES_LOCAL_DECLARATION feature selected\n") - parser_module = importlib.import_module('gen_isr_tables_parser_local') - parser = parser_module.gen_isr_parser(intlist_data, config, log) - else: - parser_module = importlib.import_module('gen_isr_tables_parser_carrays') - parser = parser_module.gen_isr_parser(intlist_data, config, log) + parser = gen_isr_parser(intlist_data, config, log) with open(args.output_source, "w") as fp: parser.write_source(fp) - if args.linker_output_files is not None: - with open(args.linker_output_files[0], "w") as fp_vt, \ - open(args.linker_output_files[1], "w") as fp_swi: - if hasattr(parser, 'write_linker_vt'): - parser.write_linker_vt(fp_vt) - else: - log.debug("Chosen parser does not support vector table linker file") - fp_vt.write('/* Empty */\n') - if hasattr(parser, 'write_linker_swi'): - parser.write_linker_swi(fp_swi) - else: - log.debug("Chosen parser does not support software interrupt linker file") - fp_swi.write('/* Empty */\n') if __name__ == "__main__": main() diff --git a/scripts/build/gen_isr_tables_parser_carrays.py b/scripts/build/gen_isr_tables_parser_carrays.py deleted file mode 100644 index e13ef19c1f8..00000000000 --- a/scripts/build/gen_isr_tables_parser_carrays.py +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2017 Intel Corporation -# Copyright (c) 2018 Foundries.io -# Copyright (c) 2023 Nordic Semiconductor NA -# -# SPDX-License-Identifier: Apache-2.0 -# - -import struct - -class gen_isr_parser: - source_header = """ -/* AUTO-GENERATED by gen_isr_tables.py, do not edit! */ - -#include -#include -#include -#include - -typedef void (* ISR)(const void *); -""" - - source_assembly_header = """ -#ifndef ARCH_IRQ_VECTOR_JUMP_CODE -#error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" -#endif -""" - - def __init__(self, intlist_data, config, log): - """Initialize the parser. - - The function prepares parser to work. - Parameters: - - intlist_data: The binnary data from intlist section - - config: The configuration object - - log: The logging object, has to have error and debug methods - """ - self.__config = config - self.__log = log - intlist = self.__read_intlist(intlist_data) - self.__vt, self.__swt, self.__nv = self.__parse_intlist(intlist) - - def __read_intlist(self, intlist_data): - """read a binary file containing the contents of the kernel's .intList - section. This is an instance of a header created by - include/zephyr/linker/intlist.ld: - - struct { - uint32_t num_vectors; <- typically CONFIG_NUM_IRQS - struct _isr_list isrs[]; <- Usually of smaller size than num_vectors - } - - Followed by instances of struct _isr_list created by IRQ_CONNECT() - calls: - - struct _isr_list { - /** IRQ line number */ - int32_t irq; - /** Flags for this IRQ, see ISR_FLAG_* definitions */ - int32_t flags; - /** ISR to call */ - void *func; - /** Parameter for non-direct IRQs */ - const void *param; - }; - """ - intlist = {} - prefix = self.__config.endian_prefix() - - # Extract header and the rest of the data - intlist_header_fmt = prefix + "II" - header_sz = struct.calcsize(intlist_header_fmt) - header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) - self.__log.debug(str(header_raw)) - - intlist["num_vectors"] = header_raw[0] - intlist["offset"] = header_raw[1] - intdata = intlist_data[header_sz:] - - # Extract information about interrupts - if self.__config.check_64b(): - intlist_entry_fmt = prefix + "iiQQ" - else: - intlist_entry_fmt = prefix + "iiII" - - intlist["interrupts"] = [i for i in - struct.iter_unpack(intlist_entry_fmt, intdata)] - - self.__log.debug("Configured interrupt routing") - self.__log.debug("handler irq flags param") - self.__log.debug("--------------------------") - - for irq in intlist["interrupts"]: - self.__log.debug("{0:<10} {1:<3} {2:<3} {3}".format( - hex(irq[2]), irq[0], irq[1], hex(irq[3]))) - - return intlist - - def __parse_intlist(self, intlist): - """All the intlist data are parsed into swt and vt arrays. - - The vt array is prepared for hardware interrupt table. - Every entry in the selected position would contain None or the name of the function pointer - (address or string). - - The swt is a little more complex. At every position it would contain an array of parameter and - function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. - If empty array is placed on selected position - it means that the application does not implement - this interrupt. - - Parameters: - - intlist: The preprocessed list of intlist section content (see read_intlist) - - Return: - vt, swt - parsed vt and swt arrays (see function description above) - """ - nvec = intlist["num_vectors"] - offset = intlist["offset"] - - if nvec > pow(2, 15): - raise ValueError('nvec is too large, check endianness.') - - self.__log.debug('offset is ' + str(offset)) - self.__log.debug('num_vectors is ' + str(nvec)) - - # Set default entries in both tables - if not(self.__config.args.sw_isr_table or self.__config.args.vector_table): - self.__log.error("one or both of -s or -V needs to be specified on command line") - if self.__config.args.vector_table: - vt = [None for i in range(nvec)] - else: - vt = None - if self.__config.args.sw_isr_table: - swt = [[] for i in range(nvec)] - else: - swt = None - - # Process intlist and write to the tables created - for irq, flags, func, param in intlist["interrupts"]: - if self.__config.test_isr_direct(flags): - if not vt: - self.__log.error("Direct Interrupt %d declared with parameter 0x%x " - "but no vector table in use" - % (irq, param)) - if param != 0: - self.__log.error("Direct irq %d declared, but has non-NULL parameter" - % irq) - if not 0 <= irq - offset < len(vt): - self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" - % (irq - offset, offset, len(vt) - 1)) - vt[irq - offset] = func - else: - # Regular interrupt - if not swt: - self.__log.error("Regular Interrupt %d declared with parameter 0x%x " - "but no SW ISR_TABLE in use" - % (irq, param)) - - table_index = self.__config.get_swt_table_index(offset, irq) - - if not 0 <= table_index < len(swt): - self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % - (table_index, offset, len(swt) - 1)) - if self.__config.check_shared_interrupts(): - lst = swt[table_index] - if (param, func) in lst: - self.__log.error("Attempting to register the same ISR/arg pair twice.") - if len(lst) >= self.__config.get_sym("CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"): - self.__log.error(f"Reached shared interrupt client limit. Maybe increase" - + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") - else: - if len(swt[table_index]) > 0: - self.__log.error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" - + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" - + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" - ) - swt[table_index].append((param, func)) - - return vt, swt, nvec - - def __write_code_irq_vector_table(self, fp): - fp.write(self.source_assembly_header) - - fp.write("void __irq_vector_table __attribute__((naked)) _irq_vector_table(void) {\n") - for i in range(self.__nv): - func = self.__vt[i] - - if func is None: - func = self.__config.vt_default_handler - - if isinstance(func, int): - func_as_string = self.__config.get_sym_from_addr(func) - else: - func_as_string = func - - fp.write("\t__asm(ARCH_IRQ_VECTOR_JUMP_CODE({}));\n".format(func_as_string)) - fp.write("}\n") - - def __write_address_irq_vector_table(self, fp): - fp.write("uintptr_t __irq_vector_table _irq_vector_table[%d] = {\n" % self.__nv) - for i in range(self.__nv): - func = self.__vt[i] - - if func is None: - func = self.__config.vt_default_handler - - if isinstance(func, int): - fp.write("\t{},\n".format(func)) - else: - fp.write("\t((uintptr_t)&{}),\n".format(func)) - - fp.write("};\n") - - def __write_shared_table(self, fp): - fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" - " z_shared_sw_isr_table[%d] = {\n" % self.__nv) - - for i in range(self.__nv): - if self.__swt[i] is None: - client_num = 0 - client_list = None - else: - client_num = len(self.__swt[i]) - client_list = self.__swt[i] - - if client_num <= 1: - fp.write("\t{ },\n") - else: - fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") - for j in range(0, client_num): - routine = client_list[j][1] - arg = client_list[j][0] - - fp.write(f"{{ .isr = (ISR){ hex(routine) if isinstance(routine, int) else routine }, " - f".arg = (const void *){hex(arg)} }},") - - fp.write(" },\n},\n") - - fp.write("};\n") - - def write_source(self, fp): - fp.write(self.source_header) - - if self.__config.check_shared_interrupts(): - self.__write_shared_table(fp) - - if self.__vt: - if self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS"): - self.__write_address_irq_vector_table(fp) - elif self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE"): - self.__write_code_irq_vector_table(fp) - else: - self.__log.error("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set") - - if not self.__swt: - return - - fp.write("struct _isr_table_entry __sw_isr_table _sw_isr_table[%d] = {\n" - % self.__nv) - - level2_offset = self.__config.get_irq_baseoffset(2) - level3_offset = self.__config.get_irq_baseoffset(3) - - for i in range(self.__nv): - if len(self.__swt[i]) == 0: - # Not used interrupt - param = "0x0" - func = self.__config.swt_spurious_handler - elif len(self.__swt[i]) == 1: - # Single interrupt - param = "{0:#x}".format(self.__swt[i][0][0]) - func = self.__swt[i][0][1] - else: - # Shared interrupt - param = "&z_shared_sw_isr_table[{0}]".format(i) - func = self.__config.swt_shared_handler - - if isinstance(func, int): - func_as_string = "{0:#x}".format(func) - else: - func_as_string = func - - if level2_offset is not None and i == level2_offset: - fp.write("\t/* Level 2 interrupts start here (offset: {}) */\n". - format(level2_offset)) - if level3_offset is not None and i == level3_offset: - fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". - format(level3_offset)) - - fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) - fp.write("};\n") diff --git a/scripts/build/gen_isr_tables_parser_local.py b/scripts/build/gen_isr_tables_parser_local.py deleted file mode 100644 index 91bd4a65471..00000000000 --- a/scripts/build/gen_isr_tables_parser_local.py +++ /dev/null @@ -1,375 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2017 Intel Corporation -# Copyright (c) 2018 Foundries.io -# Copyright (c) 2023 Nordic Semiconductor NA -# -# SPDX-License-Identifier: Apache-2.0 -# - -import struct - -class gen_isr_parser: - source_header = """ -/* AUTO-GENERATED by gen_isr_tables.py, do not edit! */ - -#include -#include -#include -#include - -""" - - shared_isr_table_header = """ - -/* For this parser to work, we have to be sure that shared interrupts table entry - * and the normal isr table entry have exactly the same layout - */ -BUILD_ASSERT(sizeof(struct _isr_table_entry) - == - sizeof(struct z_shared_isr_table_entry), - "Shared ISR and ISR table entries layout do not match"); -BUILD_ASSERT(offsetof(struct _isr_table_entry, arg) - == - offsetof(struct z_shared_isr_table_entry, arg), - "Shared ISR and ISR table entries layout do not match"); -BUILD_ASSERT(offsetof(struct _isr_table_entry, isr) - == - offsetof(struct z_shared_isr_table_entry, isr), - "Shared ISR and ISR table entries layout do not match"); - -""" - - def __init__(self, intlist_data, config, log): - """Initialize the parser. - - The function prepares parser to work. - Parameters: - - intlist_data: The binnary data from intlist section - - config: The configuration object - - log: The logging object, has to have error and debug methods - """ - self.__config = config - self.__log = log - intlist = self.__read_intlist(intlist_data) - self.__vt, self.__swt, self.__nv, header = self.__parse_intlist(intlist) - self.__swi_table_entry_size = header["swi_table_entry_size"] - self.__shared_isr_table_entry_size = header["shared_isr_table_entry_size"] - self.__shared_isr_client_num_offset = header["shared_isr_client_num_offset"] - - def __read_intlist(self, intlist_data): - """read an intList section from the elf file. - This is version 2 of a header created by include/zephyr/linker/intlist.ld: - - struct { - uint32_t num_vectors; <- typically CONFIG_NUM_IRQS - uint8_t stream[]; <- the stream with the interrupt data - }; - - The stream is contained from variable length records in a form: - - struct _isr_list_sname { - /** IRQ line number */ - int32_t irq; - /** Flags for this IRQ, see ISR_FLAG_* definitions */ - int32_t flags; - /** The section name */ - const char sname[]; - }; - - The flexible array member here (sname) contains the name of the section where the structure - with interrupt data is located. - It is always Null-terminated string thus we have to search through the input data for the - structure end. - - """ - intlist = {} - prefix = self.__config.endian_prefix() - - # Extract header and the rest of the data - intlist_header_fmt = prefix + "IIIII" - header_sz = struct.calcsize(intlist_header_fmt) - header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) - self.__log.debug(str(header_raw)) - - intlist["num_vectors"] = header_raw[0] - intlist["offset"] = header_raw[1] - intlist["swi_table_entry_size"] = header_raw[2] - intlist["shared_isr_table_entry_size"] = header_raw[3] - intlist["shared_isr_client_num_offset"] = header_raw[4] - - intdata = intlist_data[header_sz:] - - # Extract information about interrupts - intlist_entry_fmt = prefix + "ii" - entry_sz = struct.calcsize(intlist_entry_fmt) - intlist["interrupts"] = [] - - while len(intdata) > entry_sz: - entry_raw = struct.unpack_from(intlist_entry_fmt, intdata, 0) - intdata = intdata[entry_sz:] - null_idx = intdata.find(0) - if null_idx < 0: - self.__log.error("Cannot find sname null termination at IRQ{}".format(entry_raw[0])) - bname = intdata[:null_idx] - # Next structure starts with 4B alignment - next_idx = null_idx + 1 - next_idx = (next_idx + 3) & ~3 - intdata = intdata[next_idx:] - sname = bname.decode() - intlist["interrupts"].append([entry_raw[0], entry_raw[1], sname]) - self.__log.debug("Unpacked IRQ{}, flags: {}, sname: \"{}\"\n".format( - entry_raw[0], entry_raw[1], sname)) - - # If any data left at the end - it has to be all the way 0 - this is just a check - if (len(intdata) and not all([d == 0 for d in intdata])): - self.__log.error("Non-zero data found at the end of the intList data.\n") - - self.__log.debug("Configured interrupt routing with linker") - self.__log.debug("irq flags sname") - self.__log.debug("--------------------------") - - for irq in intlist["interrupts"]: - self.__log.debug("{0:<3} {1:<5} {2}".format( - hex(irq[0]), irq[1], irq[2])) - - return intlist - - def __parse_intlist(self, intlist): - """All the intlist data are parsed into swt and vt arrays. - - The vt array is prepared for hardware interrupt table. - Every entry in the selected position would contain None or the name of the function pointer - (address or string). - - The swt is a little more complex. At every position it would contain an array of parameter and - function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. - If empty array is placed on selected position - it means that the application does not implement - this interrupt. - - Parameters: - - intlist: The preprocessed list of intlist section content (see read_intlist) - - Return: - vt, swt - parsed vt and swt arrays (see function description above) - """ - nvec = intlist["num_vectors"] - offset = intlist["offset"] - header = { - "swi_table_entry_size": intlist["swi_table_entry_size"], - "shared_isr_table_entry_size": intlist["shared_isr_table_entry_size"], - "shared_isr_client_num_offset": intlist["shared_isr_client_num_offset"] - } - - if nvec > pow(2, 15): - raise ValueError('nvec is too large, check endianness.') - - self.__log.debug('offset is ' + str(offset)) - self.__log.debug('num_vectors is ' + str(nvec)) - - # Set default entries in both tables - if not(self.__config.args.sw_isr_table or self.__config.args.vector_table): - self.__log.error("one or both of -s or -V needs to be specified on command line") - if self.__config.args.vector_table: - vt = [None for i in range(nvec)] - else: - vt = None - if self.__config.args.sw_isr_table: - swt = [[] for i in range(nvec)] - else: - swt = None - - # Process intlist and write to the tables created - for irq, flags, sname in intlist["interrupts"]: - if self.__config.test_isr_direct(flags): - if not 0 <= irq - offset < len(vt): - self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % - (irq - offset, offset, len(vt) - 1)) - vt[irq - offset] = sname - else: - # Regular interrupt - if not swt: - self.__log.error("Regular Interrupt %d declared with section name %s " - "but no SW ISR_TABLE in use" - % (irq, sname)) - - table_index = self.__config.get_swt_table_index(offset, irq) - - if not 0 <= table_index < len(swt): - self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % - (table_index, offset, len(swt) - 1)) - # Check if the given section name does not repeat outside of current interrupt - for i in range(nvec): - if i == irq: - continue - if sname in swt[i]: - self.__log.error(("Attempting to register the same section name \"{}\"for" + - "different interrupts: {} and {}").format(sname, i, irq)) - if self.__config.check_shared_interrupts(): - lst = swt[table_index] - if len(lst) >= self.__config.get_sym("CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"): - self.__log.error(f"Reached shared interrupt client limit. Maybe increase" - + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") - else: - if len(swt[table_index]) > 0: - self.__log.error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" - + f"\nExisting section {swt[table_index]}, new section {sname}" - + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" - ) - swt[table_index].append(sname) - - return vt, swt, nvec, header - - @staticmethod - def __irq_spurious_section(irq): - return '.irq_spurious.0x{:x}'.format(irq) - - @staticmethod - def __isr_generated_section(irq): - return '.isr_generated.0x{:x}'.format(irq) - - @staticmethod - def __shared_entry_section(irq, ent): - return '.isr_shared.0x{:x}_0x{:x}'.format(irq, ent) - - @staticmethod - def __shared_client_num_section(irq): - return '.isr_shared.0x{:x}_client_num'.format(irq) - - def __isr_spurious_entry(self, irq): - return '_Z_ISR_TABLE_ENTRY({irq}, {func}, NULL, "{sect}");'.format( - irq = irq, - func = self.__config.swt_spurious_handler, - sect = self.__isr_generated_section(irq) - ) - - def __isr_shared_entry(self, irq): - return '_Z_ISR_TABLE_ENTRY({irq}, {func}, {arg}, "{sect}");'.format( - irq = irq, - arg = '&{}[{}]'.format(self.__config.shared_array_name, irq), - func = self.__config.swt_shared_handler, - sect = self.__isr_generated_section(irq) - ) - - def __irq_spurious_entry(self, irq): - return '_Z_ISR_DIRECT_TABLE_ENTRY({irq}, {func}, "{sect}");'.format( - irq = irq, - func = self.__config.vt_default_handler, - sect = self.__irq_spurious_section(irq) - ) - - def __write_isr_handlers(self, fp): - for i in range(self.__nv): - if len(self.__swt[i]) <= 0: - fp.write(self.__isr_spurious_entry(i) + '\n') - elif len(self.__swt[i]) > 1: - # Connect to shared handlers - fp.write(self.__isr_shared_entry(i) + '\n') - else: - fp.write('/* ISR: {} implemented in app in "{}" section. */\n'.format( - i, self.__swt[i][0])) - - def __write_irq_handlers(self, fp): - for i in range(self.__nv): - if self.__vt[i] is None: - fp.write(self.__irq_spurious_entry(i) + '\n') - else: - fp.write('/* ISR: {} implemented in app. */\n'.format(i)) - - def __write_shared_handlers(self, fp): - fp.write("extern struct z_shared_isr_table_entry " - "{}[{}];\n".format(self.__config.shared_array_name, self.__nv)) - - shared_cnt = self.__config.get_sym('CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS') - for i in range(self.__nv): - swt_len = len(self.__swt[i]) - for j in range(shared_cnt): - if (swt_len <= 1) or (swt_len <= j): - # Add all unused entry - fp.write('static Z_DECL_ALIGN(struct _isr_table_entry)\n' + - '\tZ_GENERIC_SECTION({})\n'.format(self.__shared_entry_section(i, j)) + - '\t__used isr_shared_empty_entry_0x{:x}_0x{:x} = {{\n'.format(i, j) + - '\t\t.arg = (const void *)NULL,\n' + - '\t\t.isr = (void (*)(const void *))(void *)0\n' + - '};\n' - ) - else: - # Add information about entry implemented by application - fp.write('/* Shared isr {} entry {} implemented in "{}" section*/\n'.format( - i, j, self.__swt[i][j])) - - # Add information about clients count - fp.write(('static size_t Z_GENERIC_SECTION({}) __used\n' + - 'isr_shared_client_num_0x{:x} = {};\n\n').format( - self.__shared_client_num_section(i), - i, - 0 if swt_len < 2 else swt_len) - ) - - def write_source(self, fp): - fp.write(self.source_header) - - if self.__vt: - self.__write_irq_handlers(fp) - - if not self.__swt: - return - - if self.__config.check_shared_interrupts(): - self.__write_shared_handlers(fp) - - self.__write_isr_handlers(fp) - - def __write_linker_irq(self, fp): - fp.write('{} = .;\n'.format(self.__config.irq_vector_array_name)) - for i in range(self.__nv): - if self.__vt[i] is None: - sname = self.__irq_spurious_section(i) - else: - sname = self.__vt[i] - fp.write('KEEP(*("{}"))\n'.format(sname)) - - def __write_linker_shared(self, fp): - fp.write(". = ALIGN({});\n".format(self.__shared_isr_table_entry_size)) - fp.write('{} = .;\n'.format(self.__config.shared_array_name)) - shared_cnt = self.__config.get_sym('CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS') - client_num_pads = self.__shared_isr_client_num_offset - \ - shared_cnt * self.__swi_table_entry_size - if client_num_pads < 0: - self.__log.error("Invalid __shared_isr_client_num_offset header value") - for i in range(self.__nv): - swt_len = len(self.__swt[i]) - # Add all entries - for j in range(shared_cnt): - if (swt_len <= 1) or (swt_len <= j): - fp.write('KEEP(*("{}"))\n'.format(self.__shared_entry_section(i, j))) - else: - sname = self.__swt[i][j] - if (j != 0) and (sname in self.__swt[i][0:j]): - fp.write('/* Repetition of "{}" section */\n'.format(sname)) - else: - fp.write('KEEP(*("{}"))\n'.format(sname)) - fp.write('. = . + {};\n'.format(client_num_pads)) - fp.write('KEEP(*("{}"))\n'.format(self.__shared_client_num_section(i))) - fp.write(". = ALIGN({});\n".format(self.__shared_isr_table_entry_size)) - - def __write_linker_isr(self, fp): - fp.write(". = ALIGN({});\n".format(self.__swi_table_entry_size)) - fp.write('{} = .;\n'.format(self.__config.sw_isr_array_name)) - for i in range(self.__nv): - if (len(self.__swt[i])) == 1: - sname = self.__swt[i][0] - else: - sname = self.__isr_generated_section(i) - fp.write('KEEP(*("{}"))\n'.format(sname)) - - def write_linker_vt(self, fp): - if self.__vt: - self.__write_linker_irq(fp) - - def write_linker_swi(self, fp): - if self.__swt: - self.__write_linker_isr(fp) - - if self.__config.check_shared_interrupts(): - self.__write_linker_shared(fp) From e71c4bb1bea140d36ae47cee81c675c736c0dca0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:34 +0100 Subject: [PATCH 0811/2300] Revert "[nrf fromtree] arch: sw_isr_table: Update shared interrupts structures" This reverts commit d5e421e235ed1a1d69e5e31e893f3409a392e91b. Signed-off-by: Robert Lubos --- arch/common/shared_irq.c | 12 ++++++------ doc/kernel/services/interrupts.rst | 11 ++++++++++- include/zephyr/sw_isr_table.h | 7 ++++++- tests/kernel/interrupt/src/test_shared_irq.h | 2 +- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/arch/common/shared_irq.c b/arch/common/shared_irq.c index a05e78002ce..68641cb2bb0 100644 --- a/arch/common/shared_irq.c +++ b/arch/common/shared_irq.c @@ -20,7 +20,7 @@ void z_shared_isr(const void *data) { size_t i; const struct z_shared_isr_table_entry *entry; - const struct _isr_table_entry *client; + const struct z_shared_isr_client *client; entry = data; @@ -42,7 +42,7 @@ void z_isr_install(unsigned int irq, void (*routine)(const void *), { struct z_shared_isr_table_entry *shared_entry; struct _isr_table_entry *entry; - struct _isr_table_entry *client; + struct z_shared_isr_client *client; unsigned int table_idx; int i; k_spinlock_key_t key; @@ -103,10 +103,10 @@ void z_isr_install(unsigned int irq, void (*routine)(const void *), k_spin_unlock(&lock, key); } -static void swap_client_data(struct _isr_table_entry *a, - struct _isr_table_entry *b) +static void swap_client_data(struct z_shared_isr_client *a, + struct z_shared_isr_client *b) { - struct _isr_table_entry tmp; + struct z_shared_isr_client tmp; tmp.arg = a->arg; tmp.isr = a->isr; @@ -162,7 +162,7 @@ int z_isr_uninstall(unsigned int irq, { struct z_shared_isr_table_entry *shared_entry; struct _isr_table_entry *entry; - struct _isr_table_entry *client; + struct z_shared_isr_client *client; unsigned int table_idx; size_t i; k_spinlock_key_t key; diff --git a/doc/kernel/services/interrupts.rst b/doc/kernel/services/interrupts.rst index 44f0805edb0..849e614a562 100644 --- a/doc/kernel/services/interrupts.rst +++ b/doc/kernel/services/interrupts.rst @@ -549,7 +549,7 @@ This is an array of struct z_shared_isr_table_entry: .. code-block:: c struct z_shared_isr_table_entry { - struct _isr_table_entry clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; + struct z_shared_isr_client clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; size_t client_num; }; @@ -558,6 +558,15 @@ lines. Whenever an interrupt line becomes shared, c:func:`z_shared_isr` will replace the currently registered ISR in _sw_isr_table. This special ISR will iterate through the list of registered clients and invoke the ISRs. +The definition for struct z_shared_isr_client is as follows: + +.. code-block:: c + + struct z_shared_isr_client { + void (*isr)(const void *arg); + const void *arg; + }; + x86 Details ----------- diff --git a/include/zephyr/sw_isr_table.h b/include/zephyr/sw_isr_table.h index fc094b887ba..f43efafad49 100644 --- a/include/zephyr/sw_isr_table.h +++ b/include/zephyr/sw_isr_table.h @@ -69,8 +69,13 @@ struct _isr_list { }; #ifdef CONFIG_SHARED_INTERRUPTS +struct z_shared_isr_client { + void (*isr)(const void *arg); + const void *arg; +}; + struct z_shared_isr_table_entry { - struct _isr_table_entry clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; + struct z_shared_isr_client clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS]; size_t client_num; }; diff --git a/tests/kernel/interrupt/src/test_shared_irq.h b/tests/kernel/interrupt/src/test_shared_irq.h index 5ddd50a16e1..fd3c4c4a624 100644 --- a/tests/kernel/interrupt/src/test_shared_irq.h +++ b/tests/kernel/interrupt/src/test_shared_irq.h @@ -41,7 +41,7 @@ static inline bool client_exists_at_index(void (*routine)(const void *arg), { size_t i; struct z_shared_isr_table_entry *shared_entry; - struct _isr_table_entry *client; + struct z_shared_isr_client *client; shared_entry = &z_shared_sw_isr_table[irq]; From 9371163f8490bcffebc0c1343404a750fae07196 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:35 +0100 Subject: [PATCH 0812/2300] Revert "[nrf fromtree] scripts: gen_isr_tables: Break code into classes" This reverts commit a56a957bcb8758dce90bedc8ebae5c2816d271ff. Signed-off-by: Robert Lubos --- scripts/build/gen_isr_tables.py | 826 ++++++++++++++------------------ 1 file changed, 370 insertions(+), 456 deletions(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 3032d1e30c9..41fc20957a6 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -14,227 +14,142 @@ from elftools.elf.elffile import ELFFile from elftools.elf.sections import SymbolTableSection +ISR_FLAG_DIRECT = 1 << 0 + +# The below few hardware independent magic numbers represent various +# levels of interrupts in a multi-level interrupt system. +# 0x000000FF - represents the 1st level (i.e. the interrupts +# that directly go to the processor). +# 0x0000FF00 - represents the 2nd level (i.e. the interrupts funnel +# into 1 line which then goes into the 1st level) +# 0x00FF0000 - represents the 3rd level (i.e. the interrupts funnel +# into 1 line which then goes into the 2nd level) +INTERRUPT_LVL_BITMASK = [0x000000FF, 0x0000FF00, 0x00FF0000] + +INTERRUPT_BITS = [8, 8, 8] + +swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" +swt_shared_handler = "((uintptr_t)&z_shared_isr)" +vt_spurious_handler = "z_irq_spurious" +vt_irq_handler = "_isr_wrapper" +vt_default_handler = None + + +def debug(text): + if args.debug: + sys.stdout.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") + +def error(text): + sys.exit(os.path.basename(sys.argv[0]) + ": error: " + text + "\n") + +def endian_prefix(): + if args.big_endian: + return ">" + else: + return "<" + +def read_intlist(intlist_data, syms): + """read a binary file containing the contents of the kernel's .intList + section. This is an instance of a header created by + include/zephyr/linker/intlist.ld: + + struct { + uint32_t num_vectors; <- typically CONFIG_NUM_IRQS + struct _isr_list isrs[]; <- Usually of smaller size than num_vectors + } + + Followed by instances of struct _isr_list created by IRQ_CONNECT() + calls: + + struct _isr_list { + /** IRQ line number */ + int32_t irq; + /** Flags for this IRQ, see ISR_FLAG_* definitions */ + int32_t flags; + /** ISR to call */ + void *func; + /** Parameter for non-direct IRQs */ + const void *param; + }; + """ + intlist = {} + prefix = endian_prefix() -class gen_isr_log: + # Extract header and the rest of the data + intlist_header_fmt = prefix + "II" + header_sz = struct.calcsize(intlist_header_fmt) + header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) + debug(str(header_raw)) - def __init__(self, debug = False): - self.__debug = debug + intlist["num_vectors"] = header_raw[0] + intlist["offset"] = header_raw[1] + intdata = intlist_data[header_sz:] - def debug(self, text): - """Print debug message if debugging is enabled. + # Extract information about interrupts + if "CONFIG_64BIT" in syms: + intlist_entry_fmt = prefix + "iiQQ" + else: + intlist_entry_fmt = prefix + "iiII" - Note - this function requires config global variable to be initialized. - """ - if self.__debug: - sys.stdout.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") + intlist["interrupts"] = [i for i in + struct.iter_unpack(intlist_entry_fmt, intdata)] - @staticmethod - def error(text): - sys.exit(os.path.basename(sys.argv[0]) + ": error: " + text + "\n") + debug("Configured interrupt routing") + debug("handler irq flags param") + debug("--------------------------") - def set_debug(self, state): - self.__debug = state + for irq in intlist["interrupts"]: + debug("{0:<10} {1:<3} {2:<3} {3}".format( + hex(irq[2]), irq[0], irq[1], hex(irq[3]))) + return intlist -log = gen_isr_log() +source_assembly_header = """ +#ifndef ARCH_IRQ_VECTOR_JUMP_CODE +#error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" +#endif +""" +def get_symbol_from_addr(syms, addr): + for key, value in syms.items(): + if addr == value: + return key + return None -class gen_isr_config: - """All the constants and configuration gathered in single class for readability. - """ - # Constants - __ISR_FLAG_DIRECT = 1 << 0 - __swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" - __swt_shared_handler = "((uintptr_t)&z_shared_isr)" - __vt_spurious_handler = "z_irq_spurious" - __vt_irq_handler = "_isr_wrapper" - - @staticmethod - def __bm(bits): - return (1 << bits) - 1 - - def __init__(self, args, syms, log): - """Initialize the configuration object. - - The configuration object initialization takes only arguments as a parameter. - This is done to allow debug function work as soon as possible. - """ - # Store the arguments required for work - self.__args = args - self.__syms = syms - self.__log = log - - # Select the default interrupt vector handler - if self.args.sw_isr_table: - self.__vt_default_handler = self.__vt_irq_handler - else: - self.__vt_default_handler = self.__vt_spurious_handler - # Calculate interrupt bits - self.__int_bits = [8, 8, 8] - # The below few hardware independent magic numbers represent various - # levels of interrupts in a multi-level interrupt system. - # 0x000000FF - represents the 1st level (i.e. the interrupts - # that directly go to the processor). - # 0x0000FF00 - represents the 2nd level (i.e. the interrupts funnel - # into 1 line which then goes into the 1st level) - # 0x00FF0000 - represents the 3rd level (i.e. the interrupts funnel - # into 1 line which then goes into the 2nd level) - self.__int_lvl_masks = [0x000000FF, 0x0000FF00, 0x00FF0000] - - self.__irq2_baseoffset = None - self.__irq3_baseoffset = None - self.__irq2_offsets = None - self.__irq3_offsets = None - - if self.check_multi_level_interrupts(): - self.__max_irq_per = self.get_sym("CONFIG_MAX_IRQ_PER_AGGREGATOR") - - self.__int_bits[0] = self.get_sym("CONFIG_1ST_LEVEL_INTERRUPT_BITS") - self.__int_bits[1] = self.get_sym("CONFIG_2ND_LEVEL_INTERRUPT_BITS") - self.__int_bits[2] = self.get_sym("CONFIG_3RD_LEVEL_INTERRUPT_BITS") - - if sum(self.int_bits) > 32: - raise ValueError("Too many interrupt bits") - - self.__int_lvl_masks[0] = self.__bm(self.int_bits[0]) - self.__int_lvl_masks[1] = self.__bm(self.int_bits[1]) << self.int_bits[0] - self.__int_lvl_masks[2] = self.__bm(self.int_bits[2]) << (self.int_bits[0] + self.int_bits[1]) - - self.__log.debug("Level Bits Bitmask") - self.__log.debug("----------------------------") - for i in range(3): - bitmask_str = "0x" + format(self.__int_lvl_masks[i], '08X') - self.__log.debug(f"{i + 1:>5} {self.__int_bits[i]:>7} {bitmask_str:>14}") - - if self.check_sym("CONFIG_2ND_LEVEL_INTERRUPTS"): - num_aggregators = self.get_sym("CONFIG_NUM_2ND_LEVEL_AGGREGATORS") - self.__irq2_baseoffset = self.get_sym("CONFIG_2ND_LVL_ISR_TBL_OFFSET") - self.__irq2_offsets = [self.get_sym('CONFIG_2ND_LVL_INTR_{}_OFFSET'. - format(str(i).zfill(2))) for i in - range(num_aggregators)] - - self.__log.debug('2nd level offsets: {}'.format(self.__irq2_offsets)) - - if self.check_sym("CONFIG_3RD_LEVEL_INTERRUPTS"): - num_aggregators = self.get_sym("CONFIG_NUM_3RD_LEVEL_AGGREGATORS") - self.__irq3_baseoffset = self.get_sym("CONFIG_3RD_LVL_ISR_TBL_OFFSET") - self.__irq3_offsets = [self.get_sym('CONFIG_3RD_LVL_INTR_{}_OFFSET'. - format(str(i).zfill(2))) for i in - range(num_aggregators)] - - self.__log.debug('3rd level offsets: {}'.format(self.__irq3_offsets)) - - @property - def args(self): - return self.__args - - @property - def swt_spurious_handler(self): - return self.__swt_spurious_handler - - @property - def swt_shared_handler(self): - return self.__swt_shared_handler - - @property - def vt_default_handler(self): - return self.__vt_default_handler - - @property - def int_bits(self): - return self.__int_bits - - @property - def int_lvl_masks(self): - return self.__int_lvl_masks - - def endian_prefix(self): - if self.args.big_endian: - return ">" +def write_code_irq_vector_table(fp, vt, nv, syms): + fp.write(source_assembly_header) + + fp.write("void __irq_vector_table __attribute__((naked)) _irq_vector_table(void) {\n") + for i in range(nv): + func = vt[i] + + if func is None: + func = vt_default_handler + + if isinstance(func, int): + func_as_string = get_symbol_from_addr(syms, func) else: - return "<" - - def get_irq_baseoffset(self, lvl): - if lvl == 2: - return self.__irq2_baseoffset - if lvl == 3: - return self.__irq3_baseoffset - self.__log.error("Unsupported irq level: {}".format(lvl)) - - def get_irq_index(self, irq, lvl): - if lvl == 2: - offsets = self.__irq2_offsets - elif lvl == 3: - offsets = self.__irq3_offsets + func_as_string = func + + fp.write("\t__asm(ARCH_IRQ_VECTOR_JUMP_CODE({}));\n".format(func_as_string)) + fp.write("}\n") + +def write_address_irq_vector_table(fp, vt, nv): + fp.write("uintptr_t __irq_vector_table _irq_vector_table[%d] = {\n" % nv) + for i in range(nv): + func = vt[i] + + if func is None: + func = vt_default_handler + + if isinstance(func, int): + fp.write("\t{},\n".format(func)) else: - self.__log.error("Unsupported irq level: {}".format(lvl)) - try: - return offsets.index(irq) - except ValueError: - self.__log.error("IRQ {} not present in parent offsets ({}). ". - format(irq, offsets) + - " Recheck interrupt configuration.") - - def get_swt_table_index(self, offset, irq): - if not self.check_multi_level_interrupts(): - return irq - offset - # Calculate index for multi level interrupts - self.__log.debug('IRQ = ' + hex(irq)) - irq3 = (irq & self.int_lvl_masks[2]) >> (self.int_bits[0] + self.int_bits[1]) - irq2 = (irq & self.int_lvl_masks[1]) >> (self.int_bits[0]) - irq1 = irq & self.int_lvl_masks[0] - # Figure out third level interrupt position - if irq3: - list_index = self.get_irq_index(irq2, 3) - irq3_pos = self.get_irq_baseoffset(3) + self.__max_irq_per * list_index + irq3 - 1 - self.__log.debug('IRQ_level = 3') - self.__log.debug('IRQ_Indx = ' + str(irq3)) - self.__log.debug('IRQ_Pos = ' + str(irq3_pos)) - return irq3_pos - offset - # Figure out second level interrupt position - if irq2: - list_index = self.get_irq_index(irq1, 2) - irq2_pos = self.get_irq_baseoffset(2) + self.__max_irq_per * list_index + irq2 - 1 - self.__log.debug('IRQ_level = 2') - self.__log.debug('IRQ_Indx = ' + str(irq2)) - self.__log.debug('IRQ_Pos = ' + str(irq2_pos)) - return irq2_pos - offset - # Figure out first level interrupt position - self.__log.debug('IRQ_level = 1') - self.__log.debug('IRQ_Indx = ' + str(irq1)) - self.__log.debug('IRQ_Pos = ' + str(irq1)) - return irq1 - offset - - def get_intlist_snames(self): - return self.args.intlist_section - - def test_isr_direct(self, flags): - return flags & self.__ISR_FLAG_DIRECT - - def get_sym_from_addr(self, addr): - for key, value in self.__syms.items(): - if addr == value: - return key - return None - - def get_sym(self, name): - return self.__syms.get(name) - - def check_sym(self, name): - return name in self.__syms - - def check_multi_level_interrupts(self): - return self.check_sym("CONFIG_MULTI_LEVEL_INTERRUPTS") - - def check_shared_interrupts(self): - return self.check_sym("CONFIG_SHARED_INTERRUPTS") - - def check_64b(self): - return self.check_sym("CONFIG_64BIT") - - -class gen_isr_parser: - source_header = """ + fp.write("\t((uintptr_t)&{}),\n".format(func)) + + fp.write("};\n") + +source_header = """ /* AUTO-GENERATED by gen_isr_tables.py, do not edit! */ #include @@ -245,276 +160,270 @@ class gen_isr_parser: typedef void (* ISR)(const void *); """ - source_assembly_header = """ -#ifndef ARCH_IRQ_VECTOR_JUMP_CODE -#error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" -#endif -""" +def write_shared_table(fp, swt, nv): + fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" + " z_shared_sw_isr_table[%d] = {\n" % nv) - def __init__(self, intlist_data, config, log): - """Initialize the parser. - - The function prepares parser to work. - Parameters: - - intlist_data: The binnary data from intlist section - - config: The configuration object - - log: The logging object, has to have error and debug methods - """ - self.__config = config - self.__log = log - intlist = self.__read_intlist(intlist_data) - self.__vt, self.__swt, self.__nv = self.__parse_intlist(intlist) - - def __read_intlist(self, intlist_data): - """read a binary file containing the contents of the kernel's .intList - section. This is an instance of a header created by - include/zephyr/linker/intlist.ld: - - struct { - uint32_t num_vectors; <- typically CONFIG_NUM_IRQS - struct _isr_list isrs[]; <- Usually of smaller size than num_vectors - } - - Followed by instances of struct _isr_list created by IRQ_CONNECT() - calls: - - struct _isr_list { - /** IRQ line number */ - int32_t irq; - /** Flags for this IRQ, see ISR_FLAG_* definitions */ - int32_t flags; - /** ISR to call */ - void *func; - /** Parameter for non-direct IRQs */ - const void *param; - }; - """ - intlist = {} - prefix = self.__config.endian_prefix() - - # Extract header and the rest of the data - intlist_header_fmt = prefix + "II" - header_sz = struct.calcsize(intlist_header_fmt) - header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) - self.__log.debug(str(header_raw)) - - intlist["num_vectors"] = header_raw[0] - intlist["offset"] = header_raw[1] - intdata = intlist_data[header_sz:] - - # Extract information about interrupts - if self.__config.check_64b(): - intlist_entry_fmt = prefix + "iiQQ" + for i in range(nv): + if swt[i] is None: + client_num = 0 + client_list = None else: - intlist_entry_fmt = prefix + "iiII" + client_num = len(swt[i]) + client_list = swt[i] - intlist["interrupts"] = [i for i in - struct.iter_unpack(intlist_entry_fmt, intdata)] - - self.__log.debug("Configured interrupt routing") - self.__log.debug("handler irq flags param") - self.__log.debug("--------------------------") - - for irq in intlist["interrupts"]: - self.__log.debug("{0:<10} {1:<3} {2:<3} {3}".format( - hex(irq[2]), irq[0], irq[1], hex(irq[3]))) - - return intlist - - def __parse_intlist(self, intlist): - """All the intlist data are parsed into swt and vt arrays. + if client_num <= 1: + fp.write("\t{ },\n") + else: + fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") + for j in range(0, client_num): + routine = client_list[j][1] + arg = client_list[j][0] - The vt array is prepared for hardware interrupt table. - Every entry in the selected position would contain None or the name of the function pointer - (address or string). + fp.write(f"{{ .isr = (ISR){ hex(routine) if isinstance(routine, int) else routine }, " + f".arg = (const void *){hex(arg)} }},") - The swt is a little more complex. At every position it would contain an array of parameter and - function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. - If empty array is placed on selected position - it means that the application does not implement - this interrupt. + fp.write(" },\n},\n") - Parameters: - - intlist: The preprocessed list of intlist section content (see read_intlist) + fp.write("};\n") - Return: - vt, swt - parsed vt and swt arrays (see function description above) - """ - nvec = intlist["num_vectors"] - offset = intlist["offset"] +def write_source_file(fp, vt, swt, intlist, syms): + fp.write(source_header) - if nvec > pow(2, 15): - raise ValueError('nvec is too large, check endianness.') + nv = intlist["num_vectors"] - self.__log.debug('offset is ' + str(offset)) - self.__log.debug('num_vectors is ' + str(nvec)) + if "CONFIG_SHARED_INTERRUPTS" in syms: + write_shared_table(fp, swt, nv) - # Set default entries in both tables - if not(self.__config.args.sw_isr_table or self.__config.args.vector_table): - self.__log.error("one or both of -s or -V needs to be specified on command line") - if self.__config.args.vector_table: - vt = [None for i in range(nvec)] + if vt: + if "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS" in syms: + write_address_irq_vector_table(fp, vt, nv) + elif "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE" in syms: + write_code_irq_vector_table(fp, vt, nv, syms) else: - vt = None - if self.__config.args.sw_isr_table: - swt = [[] for i in range(nvec)] + error("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set") + + if not swt: + return + + fp.write("struct _isr_table_entry __sw_isr_table _sw_isr_table[%d] = {\n" + % nv) + + level2_offset = syms.get("CONFIG_2ND_LVL_ISR_TBL_OFFSET") + level3_offset = syms.get("CONFIG_3RD_LVL_ISR_TBL_OFFSET") + + for i in range(nv): + if len(swt[i]) == 0: + # Not used interrupt + param = "0x0" + func = swt_spurious_handler + elif len(swt[i]) == 1: + # Single interrupt + param = "{0:#x}".format(swt[i][0][0]) + func = swt[i][0][1] else: - swt = None + # Shared interrupt + param = "&z_shared_sw_isr_table[{0}]".format(i) + func = swt_shared_handler - # Process intlist and write to the tables created - for irq, flags, func, param in intlist["interrupts"]: - if not vt: - error("Direct Interrupt %d declared with parameter 0x%x " - "but no vector table in use" - % (irq, param)) - if self.__config.test_isr_direct(flags): - if param != 0: - self.__log.error("Direct irq %d declared, but has non-NULL parameter" - % irq) - if not 0 <= irq - offset < len(vt): - self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % - (irq - offset, offset, len(vt) - 1)) - vt[irq - offset] = func - else: - # Regular interrupt - if not swt: - self.__log.error("Regular Interrupt %d declared with parameter 0x%x " - "but no SW ISR_TABLE in use" - % (irq, param)) - - table_index = self.__config.get_swt_table_index(offset, irq) - - if not 0 <= table_index < len(swt): - self.__log.error("IRQ %d (offset=%d) exceeds the maximum of %d" % - (table_index, offset, len(swt) - 1)) - if self.__config.check_shared_interrupts(): - lst = swt[table_index] - if (param, func) in lst: - self.__log.error("Attempting to register the same ISR/arg pair twice.") - if len(lst) >= self.__config.get_sym("CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"): - self.__log.error(f"Reached shared interrupt client limit. Maybe increase" - + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") - else: - if len(swt[table_index]) > 0: - self.__log.error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" - + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" - + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" - ) - swt[table_index].append((param, func)) + if isinstance(func, int): + func_as_string = "{0:#x}".format(func) + else: + func_as_string = func - return vt, swt, nvec + if level2_offset is not None and i == level2_offset: + fp.write("\t/* Level 2 interrupts start here (offset: {}) */\n". + format(level2_offset)) + if level3_offset is not None and i == level3_offset: + fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". + format(level3_offset)) - def __write_code_irq_vector_table(self, fp): - fp.write(self.source_assembly_header) + fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) + fp.write("};\n") - fp.write("void __irq_vector_table __attribute__((naked)) _irq_vector_table(void) {\n") - for i in range(self.__nv): - func = self.__vt[i] +def getindex(irq, irq_aggregator_pos): + try: + return irq_aggregator_pos.index(irq) + except ValueError: + error("IRQ {} not present in parent offsets ({}). ". + format(irq, irq_aggregator_pos) + + " Recheck interrupt configuration.") - if func is None: - func = self.__config.vt_default_handler +def bit_mask(bits): + return (1 << bits) - 1 - if isinstance(func, int): - func_as_string = self.__config.get_sym_from_addr(func) - else: - func_as_string = func +def update_masks(syms): - fp.write("\t__asm(ARCH_IRQ_VECTOR_JUMP_CODE({}));\n".format(func_as_string)) - fp.write("}\n") + if "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: + max_irq_per = syms["CONFIG_MAX_IRQ_PER_AGGREGATOR"] - def __write_address_irq_vector_table(self, fp): - fp.write("uintptr_t __irq_vector_table _irq_vector_table[%d] = {\n" % self.__nv) - for i in range(self.__nv): - func = self.__vt[i] + INTERRUPT_BITS[0] = syms["CONFIG_1ST_LEVEL_INTERRUPT_BITS"] + INTERRUPT_BITS[1] = syms["CONFIG_2ND_LEVEL_INTERRUPT_BITS"] + INTERRUPT_BITS[2] = syms["CONFIG_3RD_LEVEL_INTERRUPT_BITS"] - if func is None: - func = self.__config.vt_default_handler + if sum(INTERRUPT_BITS) > 32: + raise ValueError("Too many interrupt bits") - if isinstance(func, int): - fp.write("\t{},\n".format(func)) - else: - fp.write("\t((uintptr_t)&{}),\n".format(func)) + INTERRUPT_LVL_BITMASK[0] = bit_mask(INTERRUPT_BITS[0]) + INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] + INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] - fp.write("};\n") + debug("Level Bits Bitmask") + debug("----------------------------") + for i in range(3): + bitmask_str = "0x" + format(INTERRUPT_LVL_BITMASK[i], '08X') + debug(f"{i + 1:>5} {INTERRUPT_BITS[i]:>7} {bitmask_str:>14}") - def __write_shared_table(self, fp): - fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" - " z_shared_sw_isr_table[%d] = {\n" % self.__nv) +def update_vt_default_handler(): + """Update the vt default handler based on parsed arguments. - for i in range(self.__nv): - if self.__swt[i] is None: - client_num = 0 - client_list = None - else: - client_num = len(self.__swt[i]) - client_list = self.__swt[i] + The default vt handler would be different depending on the fact if we have sw_isr_table. + If we have it - the default handler would lead to common handler. + If we do not - the default handler would be spurious handler - if client_num <= 1: - fp.write("\t{ },\n") - else: - fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") - for j in range(0, client_num): - routine = client_list[j][1] - arg = client_list[j][0] + The result is writen into vt_default_handler variable. + """ + global vt_default_handler - fp.write(f"{{ .isr = (ISR){ hex(routine) if isinstance(routine, int) else routine }, " - f".arg = (const void *){hex(arg)} }},") + if args.sw_isr_table: + vt_default_handler = vt_irq_handler + else: + vt_default_handler = vt_spurious_handler - fp.write(" },\n},\n") +def parse_intlist(intlist, syms): + """All the intlist data are parsed into swt and vt arrays. - fp.write("};\n") + The vt array is prepared for hardware interrupt table. + Every entry in the selected position would contain None or the name of the function pointer + (address or string). - def write_source(self, fp): - fp.write(self.source_header) + The swt is a little more complex. At every position it would contain an array of parameter and + function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. + If empty array is placed on selected position - it means that the application does not implement + this interrupt. - if self.__config.check_shared_interrupts(): - self.__write_shared_table(fp) + Parameters: + - intlist: The preprocessed list of intlist section content (see read_intlist) + - syms: Symbols - if self.__vt: - if self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS"): - self.__write_address_irq_vector_table(fp) - elif self.__config.check_sym("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE"): - self.__write_code_irq_vector_table(fp) - else: - self.__log.error("CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set") - - if not self.__swt: - return - - fp.write("struct _isr_table_entry __sw_isr_table _sw_isr_table[%d] = {\n" - % self.__nv) - - level2_offset = self.__config.get_irq_baseoffset(2) - level3_offset = self.__config.get_irq_baseoffset(3) - - for i in range(self.__nv): - if len(self.__swt[i]) == 0: - # Not used interrupt - param = "0x0" - func = self.__config.swt_spurious_handler - elif len(self.__swt[i]) == 1: - # Single interrupt - param = "{0:#x}".format(self.__swt[i][0][0]) - func = self.__swt[i][0][1] + Return: + vt, swt - parsed vt and swt arrays (see function description above) + """ + nvec = intlist["num_vectors"] + offset = intlist["offset"] + + if nvec > pow(2, 15): + raise ValueError('nvec is too large, check endianness.') + + debug('offset is ' + str(offset)) + debug('num_vectors is ' + str(nvec)) + + # Set default entries in both tables + if not(args.sw_isr_table or args.vector_table): + error("one or both of -s or -V needs to be specified on command line") + if args.vector_table: + vt = [None for i in range(nvec)] + else: + vt = None + if args.sw_isr_table: + swt = [[] for i in range(nvec)] + else: + swt = None + + # Gather info about multi level interrupts if enabled + if "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: + max_irq_per = syms["CONFIG_MAX_IRQ_PER_AGGREGATOR"] + + if "CONFIG_2ND_LEVEL_INTERRUPTS" in syms: + num_aggregators = syms["CONFIG_NUM_2ND_LEVEL_AGGREGATORS"] + irq2_baseoffset = syms["CONFIG_2ND_LVL_ISR_TBL_OFFSET"] + list_2nd_lvl_offsets = [syms['CONFIG_2ND_LVL_INTR_{}_OFFSET'. + format(str(i).zfill(2))] for i in + range(num_aggregators)] + + debug('2nd level offsets: {}'.format(list_2nd_lvl_offsets)) + + if "CONFIG_3RD_LEVEL_INTERRUPTS" in syms: + num_aggregators = syms["CONFIG_NUM_3RD_LEVEL_AGGREGATORS"] + irq3_baseoffset = syms["CONFIG_3RD_LVL_ISR_TBL_OFFSET"] + list_3rd_lvl_offsets = [syms['CONFIG_3RD_LVL_INTR_{}_OFFSET'. + format(str(i).zfill(2))] for i in + range(num_aggregators)] + + debug('3rd level offsets: {}'.format(list_3rd_lvl_offsets)) + # Process intlist and write to the tables created + for irq, flags, func, param in intlist["interrupts"]: + if flags & ISR_FLAG_DIRECT: + if not vt: + error("Direct Interrupt %d declared with parameter 0x%x " + "but no vector table in use" + % (irq, param)) + if param != 0: + error("Direct irq %d declared, but has non-NULL parameter" + % irq) + if not 0 <= irq - offset < len(vt): + error("IRQ %d (offset=%d) exceeds the maximum of %d" % + (irq - offset, offset, len(vt) - 1)) + vt[irq - offset] = func + else: + # Regular interrupt + if not swt: + error("Regular Interrupt %d declared with parameter 0x%x " + "but no SW ISR_TABLE in use" + % (irq, param)) + + if not "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: + table_index = irq - offset else: - # Shared interrupt - param = "&z_shared_sw_isr_table[{0}]".format(i) - func = self.__config.swt_shared_handler - - if isinstance(func, int): - func_as_string = "{0:#x}".format(func) + # Figure out third level interrupt position + debug('IRQ = ' + hex(irq)) + irq3 = (irq & INTERRUPT_LVL_BITMASK[2]) >> (INTERRUPT_BITS[0] + INTERRUPT_BITS[1]) + irq2 = (irq & INTERRUPT_LVL_BITMASK[1]) >> (INTERRUPT_BITS[0]) + irq1 = irq & INTERRUPT_LVL_BITMASK[0] + + if irq3: + list_index = getindex(irq2, list_3rd_lvl_offsets) + irq3_pos = irq3_baseoffset + max_irq_per*list_index + irq3 - 1 + debug('IRQ_level = 3') + debug('IRQ_Indx = ' + str(irq3)) + debug('IRQ_Pos = ' + str(irq3_pos)) + table_index = irq3_pos - offset + + # Figure out second level interrupt position + elif irq2: + list_index = getindex(irq1, list_2nd_lvl_offsets) + irq2_pos = irq2_baseoffset + max_irq_per*list_index + irq2 - 1 + debug('IRQ_level = 2') + debug('IRQ_Indx = ' + str(irq2)) + debug('IRQ_Pos = ' + str(irq2_pos)) + table_index = irq2_pos - offset + + # Figure out first level interrupt position + else: + debug('IRQ_level = 1') + debug('IRQ_Indx = ' + str(irq1)) + debug('IRQ_Pos = ' + str(irq1)) + table_index = irq1 - offset + + if not 0 <= table_index < len(swt): + error("IRQ %d (offset=%d) exceeds the maximum of %d" % + (table_index, offset, len(swt) - 1)) + if "CONFIG_SHARED_INTERRUPTS" in syms: + lst = swt[table_index] + if (param, func) in lst: + error("Attempting to register the same ISR/arg pair twice.") + if len(lst) >= syms["CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"]: + error(f"Reached shared interrupt client limit. Maybe increase" + + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") else: - func_as_string = func - - if level2_offset is not None and i == level2_offset: - fp.write("\t/* Level 2 interrupts start here (offset: {}) */\n". - format(level2_offset)) - if level3_offset is not None and i == level3_offset: - fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". - format(level3_offset)) - - fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) - fp.write("};\n") + if len(swt[table_index]) > 0: + error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" + + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" + + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" + ) + swt[table_index].append((param, func)) + return vt, swt def get_symbols(obj): for section in obj.iter_sections(): @@ -522,7 +431,7 @@ def get_symbols(obj): return {sym.name: sym.entry.st_value for sym in section.iter_symbols()} - log.error("Could not find symbol table") + error("Could not find symbol table") def read_intList_sect(elfobj, snames): """ @@ -533,17 +442,19 @@ def read_intList_sect(elfobj, snames): for sname in snames: intList_sect = elfobj.get_section_by_name(sname) if intList_sect is not None: - log.debug("Found intlist section: \"{}\"".format(sname)) + debug("Found intlist section: \"{}\"".format(sname)) break if intList_sect is None: - log.error("Cannot find the intlist section!") + error("Cannot find the intlist section!") intdata = intList_sect.data() return intdata def parse_args(): + global args + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False) @@ -564,23 +475,26 @@ def parse_args(): help="The name of the section to search for the interrupt data. " "This is accumulative argument. The first section found would be used.") - return parser.parse_args() + args = parser.parse_args() def main(): - args = parse_args() - # Configure logging as soon as possible - log.set_debug(args.debug) + """ + All the input data are parsed to vt + """ + parse_args() with open(args.kernel, "rb") as fp: kernel = ELFFile(fp) - config = gen_isr_config(args, get_symbols(kernel), log) - intlist_data = read_intList_sect(kernel, config.get_intlist_snames()) + syms = get_symbols(kernel) + intlist_data = read_intList_sect(kernel, args.intlist_section) + intlist = read_intlist(intlist_data, syms) - parser = gen_isr_parser(intlist_data, config, log) + update_masks(syms) + update_vt_default_handler() + vt, swt = parse_intlist(intlist, syms) with open(args.output_source, "w") as fp: - parser.write_source(fp) - + write_source_file(fp, vt, swt, intlist, syms) if __name__ == "__main__": main() From d0ab22138410cc38e9b2e9ea884e46b28989a8e7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:35 +0100 Subject: [PATCH 0813/2300] Revert "[nrf fromtree] scripts: gen_isr_tables: Code cleanup" This reverts commit d069b2c6aceb2e0c4a4a67df70185c04654c3c39. Signed-off-by: Robert Lubos --- scripts/build/gen_isr_tables.py | 364 ++++++++++++++------------------ 1 file changed, 157 insertions(+), 207 deletions(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 41fc20957a6..e257074e55b 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -2,7 +2,6 @@ # # Copyright (c) 2017 Intel Corporation # Copyright (c) 2018 Foundries.io -# Copyright (c) 2023 Nordic Semiconductor NA # # SPDX-License-Identifier: Apache-2.0 # @@ -28,13 +27,6 @@ INTERRUPT_BITS = [8, 8, 8] -swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" -swt_shared_handler = "((uintptr_t)&z_shared_isr)" -vt_spurious_handler = "z_irq_spurious" -vt_irq_handler = "_isr_wrapper" -vt_default_handler = None - - def debug(text): if args.debug: sys.stdout.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") @@ -48,7 +40,7 @@ def endian_prefix(): else: return "<" -def read_intlist(intlist_data, syms): +def read_intlist(elfobj, syms, snames): """read a binary file containing the contents of the kernel's .intList section. This is an instance of a header created by include/zephyr/linker/intlist.ld: @@ -72,25 +64,37 @@ def read_intlist(intlist_data, syms): const void *param; }; """ + intList_sect = None intlist = {} + prefix = endian_prefix() - # Extract header and the rest of the data intlist_header_fmt = prefix + "II" - header_sz = struct.calcsize(intlist_header_fmt) - header_raw = struct.unpack_from(intlist_header_fmt, intlist_data, 0) - debug(str(header_raw)) - - intlist["num_vectors"] = header_raw[0] - intlist["offset"] = header_raw[1] - intdata = intlist_data[header_sz:] - - # Extract information about interrupts if "CONFIG_64BIT" in syms: intlist_entry_fmt = prefix + "iiQQ" else: intlist_entry_fmt = prefix + "iiII" + for sname in snames: + intList_sect = elfobj.get_section_by_name(sname) + if intList_sect is not None: + debug("Found intlist section: \"{}\"".format(sname)) + break + + if intList_sect is None: + error("Cannot find the intlist section!") + + intdata = intList_sect.data() + + header_sz = struct.calcsize(intlist_header_fmt) + header = struct.unpack_from(intlist_header_fmt, intdata, 0) + intdata = intdata[header_sz:] + + debug(str(header)) + + intlist["num_vectors"] = header[0] + intlist["offset"] = header[1] + intlist["interrupts"] = [i for i in struct.iter_unpack(intlist_entry_fmt, intdata)] @@ -104,6 +108,32 @@ def read_intlist(intlist_data, syms): return intlist + +def parse_args(): + global args + + parser = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False) + + parser.add_argument("-e", "--big-endian", action="store_true", + help="Target encodes data in big-endian format (little endian is " + "the default)") + parser.add_argument("-d", "--debug", action="store_true", + help="Print additional debugging information") + parser.add_argument("-o", "--output-source", required=True, + help="Output source file") + parser.add_argument("-k", "--kernel", required=True, + help="Zephyr kernel image") + parser.add_argument("-s", "--sw-isr-table", action="store_true", + help="Generate SW ISR table") + parser.add_argument("-V", "--vector-table", action="store_true", + help="Generate vector table") + parser.add_argument("-i", "--intlist-section", action="append", required=True, + help="The name of the section to search for the interrupt data. " + "This is accumulative argument. The first section found would be used.") + + args = parser.parse_args() + source_assembly_header = """ #ifndef ARCH_IRQ_VECTOR_JUMP_CODE #error "ARCH_IRQ_VECTOR_JUMP_CODE not defined" @@ -123,9 +153,6 @@ def write_code_irq_vector_table(fp, vt, nv, syms): for i in range(nv): func = vt[i] - if func is None: - func = vt_default_handler - if isinstance(func, int): func_as_string = get_symbol_from_addr(syms, func) else: @@ -139,13 +166,10 @@ def write_address_irq_vector_table(fp, vt, nv): for i in range(nv): func = vt[i] - if func is None: - func = vt_default_handler - if isinstance(func, int): - fp.write("\t{},\n".format(func)) + fp.write("\t{},\n".format(vt[i])) else: - fp.write("\t((uintptr_t)&{}),\n".format(func)) + fp.write("\t((uintptr_t)&{}),\n".format(vt[i])) fp.write("};\n") @@ -160,19 +184,15 @@ def write_address_irq_vector_table(fp, vt, nv): typedef void (* ISR)(const void *); """ -def write_shared_table(fp, swt, nv): +def write_shared_table(fp, shared, nv): fp.write("struct z_shared_isr_table_entry __shared_sw_isr_table" " z_shared_sw_isr_table[%d] = {\n" % nv) for i in range(nv): - if swt[i] is None: - client_num = 0 - client_list = None - else: - client_num = len(swt[i]) - client_list = swt[i] + client_num = shared[i][1] + client_list = shared[i][0] - if client_num <= 1: + if not client_num: fp.write("\t{ },\n") else: fp.write(f"\t{{ .client_num = {client_num}, .clients = {{ ") @@ -187,13 +207,13 @@ def write_shared_table(fp, swt, nv): fp.write("};\n") -def write_source_file(fp, vt, swt, intlist, syms): +def write_source_file(fp, vt, swt, intlist, syms, shared): fp.write(source_header) nv = intlist["num_vectors"] if "CONFIG_SHARED_INTERRUPTS" in syms: - write_shared_table(fp, swt, nv) + write_shared_table(fp, shared, nv) if vt: if "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS" in syms: @@ -213,19 +233,11 @@ def write_source_file(fp, vt, swt, intlist, syms): level3_offset = syms.get("CONFIG_3RD_LVL_ISR_TBL_OFFSET") for i in range(nv): - if len(swt[i]) == 0: - # Not used interrupt - param = "0x0" - func = swt_spurious_handler - elif len(swt[i]) == 1: - # Single interrupt - param = "{0:#x}".format(swt[i][0][0]) - func = swt[i][0][1] - else: - # Shared interrupt - param = "&z_shared_sw_isr_table[{0}]".format(i) - func = swt_shared_handler + param = "{0:#x}".format(swt[i][0]) + func = swt[i][1] + if isinstance (func, str) and "z_shared_isr" in func: + param = "&z_shared_sw_isr_table[{0}]".format(i) if isinstance(func, int): func_as_string = "{0:#x}".format(func) else: @@ -241,6 +253,14 @@ def write_source_file(fp, vt, swt, intlist, syms): fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) fp.write("};\n") +def get_symbols(obj): + for section in obj.iter_sections(): + if isinstance(section, SymbolTableSection): + return {sym.name: sym.entry.st_value + for sym in section.iter_symbols()} + + error("Could not find symbol table") + def getindex(irq, irq_aggregator_pos): try: return irq_aggregator_pos.index(irq) @@ -250,9 +270,32 @@ def getindex(irq, irq_aggregator_pos): " Recheck interrupt configuration.") def bit_mask(bits): - return (1 << bits) - 1 + mask = 0 + for _ in range(0, bits): + mask = (mask << 1) | 1 + return mask + +def update_masks(): + if sum(INTERRUPT_BITS) > 32: + raise ValueError("Too many interrupt bits") + + INTERRUPT_LVL_BITMASK[0] = bit_mask(INTERRUPT_BITS[0]) + INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] + INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] -def update_masks(syms): + debug("Level Bits Bitmask") + debug("----------------------------") + for i in range(3): + bitmask_str = "0x" + format(INTERRUPT_LVL_BITMASK[i], '08X') + debug(f"{i + 1:>5} {INTERRUPT_BITS[i]:>7} {bitmask_str:>14}") + +def main(): + parse_args() + + with open(args.kernel, "rb") as fp: + kernel = ELFFile(fp) + syms = get_symbols(kernel) + intlist = read_intlist(kernel, syms, args.intlist_section) if "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: max_irq_per = syms["CONFIG_MAX_IRQ_PER_AGGREGATOR"] @@ -260,98 +303,59 @@ def update_masks(syms): INTERRUPT_BITS[0] = syms["CONFIG_1ST_LEVEL_INTERRUPT_BITS"] INTERRUPT_BITS[1] = syms["CONFIG_2ND_LEVEL_INTERRUPT_BITS"] INTERRUPT_BITS[2] = syms["CONFIG_3RD_LEVEL_INTERRUPT_BITS"] + update_masks() - if sum(INTERRUPT_BITS) > 32: - raise ValueError("Too many interrupt bits") - - INTERRUPT_LVL_BITMASK[0] = bit_mask(INTERRUPT_BITS[0]) - INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] - INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] - - debug("Level Bits Bitmask") - debug("----------------------------") - for i in range(3): - bitmask_str = "0x" + format(INTERRUPT_LVL_BITMASK[i], '08X') - debug(f"{i + 1:>5} {INTERRUPT_BITS[i]:>7} {bitmask_str:>14}") - -def update_vt_default_handler(): - """Update the vt default handler based on parsed arguments. - - The default vt handler would be different depending on the fact if we have sw_isr_table. - If we have it - the default handler would lead to common handler. - If we do not - the default handler would be spurious handler - - The result is writen into vt_default_handler variable. - """ - global vt_default_handler - - if args.sw_isr_table: - vt_default_handler = vt_irq_handler - else: - vt_default_handler = vt_spurious_handler - -def parse_intlist(intlist, syms): - """All the intlist data are parsed into swt and vt arrays. + if "CONFIG_2ND_LEVEL_INTERRUPTS" in syms: + num_aggregators = syms["CONFIG_NUM_2ND_LEVEL_AGGREGATORS"] + irq2_baseoffset = syms["CONFIG_2ND_LVL_ISR_TBL_OFFSET"] + list_2nd_lvl_offsets = [syms['CONFIG_2ND_LVL_INTR_{}_OFFSET'. + format(str(i).zfill(2))] for i in + range(num_aggregators)] - The vt array is prepared for hardware interrupt table. - Every entry in the selected position would contain None or the name of the function pointer - (address or string). + debug('2nd level offsets: {}'.format(list_2nd_lvl_offsets)) - The swt is a little more complex. At every position it would contain an array of parameter and - function pointer pairs. If CONFIG_SHARED_INTERRUPTS is enabled there may be more than 1 entry. - If empty array is placed on selected position - it means that the application does not implement - this interrupt. + if "CONFIG_3RD_LEVEL_INTERRUPTS" in syms: + num_aggregators = syms["CONFIG_NUM_3RD_LEVEL_AGGREGATORS"] + irq3_baseoffset = syms["CONFIG_3RD_LVL_ISR_TBL_OFFSET"] + list_3rd_lvl_offsets = [syms['CONFIG_3RD_LVL_INTR_{}_OFFSET'. + format(str(i).zfill(2))] for i in + range(num_aggregators)] - Parameters: - - intlist: The preprocessed list of intlist section content (see read_intlist) - - syms: Symbols + debug('3rd level offsets: {}'.format(list_3rd_lvl_offsets)) - Return: - vt, swt - parsed vt and swt arrays (see function description above) - """ nvec = intlist["num_vectors"] offset = intlist["offset"] if nvec > pow(2, 15): raise ValueError('nvec is too large, check endianness.') + swt_spurious_handler = "((uintptr_t)&z_irq_spurious)" + swt_shared_handler = "((uintptr_t)&z_shared_isr)" + vt_spurious_handler = "z_irq_spurious" + vt_irq_handler = "_isr_wrapper" + debug('offset is ' + str(offset)) debug('num_vectors is ' + str(nvec)) # Set default entries in both tables - if not(args.sw_isr_table or args.vector_table): - error("one or both of -s or -V needs to be specified on command line") - if args.vector_table: - vt = [None for i in range(nvec)] - else: - vt = None if args.sw_isr_table: - swt = [[] for i in range(nvec)] + # All vectors just jump to the common vt_irq_handler. If some entries + # are used for direct interrupts, they will be replaced later. + if args.vector_table: + vt = [vt_irq_handler for i in range(nvec)] + else: + vt = None + # Default to spurious interrupt handler. Configured interrupts + # will replace these entries. + swt = [(0, swt_spurious_handler) for i in range(nvec)] + shared = [([], 0) for i in range(nvec)] else: + if args.vector_table: + vt = [vt_spurious_handler for i in range(nvec)] + else: + error("one or both of -s or -V needs to be specified on command line") swt = None - # Gather info about multi level interrupts if enabled - if "CONFIG_MULTI_LEVEL_INTERRUPTS" in syms: - max_irq_per = syms["CONFIG_MAX_IRQ_PER_AGGREGATOR"] - - if "CONFIG_2ND_LEVEL_INTERRUPTS" in syms: - num_aggregators = syms["CONFIG_NUM_2ND_LEVEL_AGGREGATORS"] - irq2_baseoffset = syms["CONFIG_2ND_LVL_ISR_TBL_OFFSET"] - list_2nd_lvl_offsets = [syms['CONFIG_2ND_LVL_INTR_{}_OFFSET'. - format(str(i).zfill(2))] for i in - range(num_aggregators)] - - debug('2nd level offsets: {}'.format(list_2nd_lvl_offsets)) - - if "CONFIG_3RD_LEVEL_INTERRUPTS" in syms: - num_aggregators = syms["CONFIG_NUM_3RD_LEVEL_AGGREGATORS"] - irq3_baseoffset = syms["CONFIG_3RD_LVL_ISR_TBL_OFFSET"] - list_3rd_lvl_offsets = [syms['CONFIG_3RD_LVL_INTR_{}_OFFSET'. - format(str(i).zfill(2))] for i in - range(num_aggregators)] - - debug('3rd level offsets: {}'.format(list_3rd_lvl_offsets)) - # Process intlist and write to the tables created for irq, flags, func, param in intlist["interrupts"]: if flags & ISR_FLAG_DIRECT: if not vt: @@ -377,12 +381,13 @@ def parse_intlist(intlist, syms): else: # Figure out third level interrupt position debug('IRQ = ' + hex(irq)) - irq3 = (irq & INTERRUPT_LVL_BITMASK[2]) >> (INTERRUPT_BITS[0] + INTERRUPT_BITS[1]) - irq2 = (irq & INTERRUPT_LVL_BITMASK[1]) >> (INTERRUPT_BITS[0]) + irq3 = (irq & INTERRUPT_LVL_BITMASK[2]) >> INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + irq2 = (irq & INTERRUPT_LVL_BITMASK[1]) >> INTERRUPT_BITS[0] irq1 = irq & INTERRUPT_LVL_BITMASK[0] if irq3: - list_index = getindex(irq2, list_3rd_lvl_offsets) + irq_parent = irq2 + list_index = getindex(irq_parent, list_3rd_lvl_offsets) irq3_pos = irq3_baseoffset + max_irq_per*list_index + irq3 - 1 debug('IRQ_level = 3') debug('IRQ_Indx = ' + str(irq3)) @@ -391,7 +396,8 @@ def parse_intlist(intlist, syms): # Figure out second level interrupt position elif irq2: - list_index = getindex(irq1, list_2nd_lvl_offsets) + irq_parent = irq1 + list_index = getindex(irq_parent, list_2nd_lvl_offsets) irq2_pos = irq2_baseoffset + max_irq_per*list_index + irq2 - 1 debug('IRQ_level = 2') debug('IRQ_Indx = ' + str(irq2)) @@ -409,92 +415,36 @@ def parse_intlist(intlist, syms): error("IRQ %d (offset=%d) exceeds the maximum of %d" % (table_index, offset, len(swt) - 1)) if "CONFIG_SHARED_INTERRUPTS" in syms: - lst = swt[table_index] - if (param, func) in lst: - error("Attempting to register the same ISR/arg pair twice.") - if len(lst) >= syms["CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"]: - error(f"Reached shared interrupt client limit. Maybe increase" + if swt[table_index] != (0, swt_spurious_handler): + # check client limit + if syms["CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS"] == shared[table_index][1]: + error(f"Reached shared interrupt client limit. Maybe increase" + f" CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS?") + lst = shared[table_index][0] + delta_size = 1 + if not shared[table_index][1]: + lst.append(swt[table_index]) + # note: the argument will be fixed when writing the ISR table + # to isr_table.c + swt[table_index] = (0, swt_shared_handler) + delta_size += 1 + if (param, func) in lst: + error("Attempting to register the same ISR/arg pair twice.") + lst.append((param, func)) + shared[table_index] = (lst, shared[table_index][1] + delta_size) + else: + swt[table_index] = (param, func) else: - if len(swt[table_index]) > 0: + if swt[table_index] != (0, swt_spurious_handler): error(f"multiple registrations at table_index {table_index} for irq {irq} (0x{irq:x})" - + f"\nExisting handler 0x{swt[table_index][0][1]:x}, new handler 0x{func:x}" + + f"\nExisting handler 0x{swt[table_index][1]:x}, new handler 0x{func:x}" + "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?" ) - swt[table_index].append((param, func)) - - return vt, swt - -def get_symbols(obj): - for section in obj.iter_sections(): - if isinstance(section, SymbolTableSection): - return {sym.name: sym.entry.st_value - for sym in section.iter_symbols()} - - error("Could not find symbol table") - -def read_intList_sect(elfobj, snames): - """ - Load the raw intList section data in a form of byte array. - """ - intList_sect = None - - for sname in snames: - intList_sect = elfobj.get_section_by_name(sname) - if intList_sect is not None: - debug("Found intlist section: \"{}\"".format(sname)) - break - - if intList_sect is None: - error("Cannot find the intlist section!") - - intdata = intList_sect.data() - - return intdata - -def parse_args(): - global args - - parser = argparse.ArgumentParser(description=__doc__, - formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False) - - parser.add_argument("-e", "--big-endian", action="store_true", - help="Target encodes data in big-endian format (little endian is " - "the default)") - parser.add_argument("-d", "--debug", action="store_true", - help="Print additional debugging information") - parser.add_argument("-o", "--output-source", required=True, - help="Output source file") - parser.add_argument("-k", "--kernel", required=True, - help="Zephyr kernel image") - parser.add_argument("-s", "--sw-isr-table", action="store_true", - help="Generate SW ISR table") - parser.add_argument("-V", "--vector-table", action="store_true", - help="Generate vector table") - parser.add_argument("-i", "--intlist-section", action="append", required=True, - help="The name of the section to search for the interrupt data. " - "This is accumulative argument. The first section found would be used.") - - args = parser.parse_args() - -def main(): - """ - All the input data are parsed to vt - """ - parse_args() - - with open(args.kernel, "rb") as fp: - kernel = ELFFile(fp) - syms = get_symbols(kernel) - intlist_data = read_intList_sect(kernel, args.intlist_section) - intlist = read_intlist(intlist_data, syms) - - update_masks(syms) - update_vt_default_handler() - vt, swt = parse_intlist(intlist, syms) + else: + swt[table_index] = (param, func) with open(args.output_source, "w") as fp: - write_source_file(fp, vt, swt, intlist, syms) + write_source_file(fp, vt, swt, intlist, syms, shared) if __name__ == "__main__": main() From 7b4e2d6b1b3665c9ad7948fe8e15c6f7cded3098 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:35 +0100 Subject: [PATCH 0814/2300] Revert "[nrf fromtree] gen_isr_tables: print index number at the end of each entry as comment" This reverts commit 47a43022ce367989556267254a05e5703ce37486. Signed-off-by: Robert Lubos --- scripts/build/gen_isr_tables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index e257074e55b..08ab9cc148c 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -250,7 +250,7 @@ def write_source_file(fp, vt, swt, intlist, syms, shared): fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". format(level3_offset)) - fp.write("\t{{(const void *){0}, (ISR){1}}}, /* {2} */\n".format(param, func_as_string, i)) + fp.write("\t{{(const void *){0}, (ISR){1}}},\n".format(param, func_as_string)) fp.write("};\n") def get_symbols(obj): From a10b2ed7de911c734bd808f6dd4d7fd951a7b62b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:35 +0100 Subject: [PATCH 0815/2300] Revert "[nrf fromtree] gen_isr_tables: Add meaningful error message" This reverts commit 7a2e82c778c059f10ae7044ef02170dcc9cd64d0. Signed-off-by: Robert Lubos --- scripts/build/gen_isr_tables.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 08ab9cc148c..13c9d79b0b3 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -358,10 +358,6 @@ def main(): for irq, flags, func, param in intlist["interrupts"]: if flags & ISR_FLAG_DIRECT: - if not vt: - error("Direct Interrupt %d declared with parameter 0x%x " - "but no vector table in use" - % (irq, param)) if param != 0: error("Direct irq %d declared, but has non-NULL parameter" % irq) From e030cd2e774c33087dd549b3becd5a704742e486 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:35 +0100 Subject: [PATCH 0816/2300] Revert "[nrf fromtree] scripts: build: gen_isr_tables: add some debug prints" This reverts commit 248e21e30665506b362698afd2eee7645c59489e. Signed-off-by: Robert Lubos --- scripts/build/gen_isr_tables.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 13c9d79b0b3..ea14b0ebf52 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -283,12 +283,6 @@ def update_masks(): INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] - debug("Level Bits Bitmask") - debug("----------------------------") - for i in range(3): - bitmask_str = "0x" + format(INTERRUPT_LVL_BITMASK[i], '08X') - debug(f"{i + 1:>5} {INTERRUPT_BITS[i]:>7} {bitmask_str:>14}") - def main(): parse_args() From 3008c7104fd070f6ed345c7ffe921ef853f72c20 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:35 +0100 Subject: [PATCH 0817/2300] Revert "[nrf fromtree] scripts: build: gen_isr_tables: change naming of bitmask variables" This reverts commit 88399d57216261cedb33c776303544a67f806150. Signed-off-by: Robert Lubos --- scripts/build/gen_isr_tables.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index ea14b0ebf52..314b56604ec 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -23,7 +23,9 @@ # into 1 line which then goes into the 1st level) # 0x00FF0000 - represents the 3rd level (i.e. the interrupts funnel # into 1 line which then goes into the 2nd level) -INTERRUPT_LVL_BITMASK = [0x000000FF, 0x0000FF00, 0x00FF0000] +FIRST_LVL_INTERRUPTS = 0x000000FF +SECND_LVL_INTERRUPTS = 0x0000FF00 +THIRD_LVL_INTERRUPTS = 0x00FF0000 INTERRUPT_BITS = [8, 8, 8] @@ -276,12 +278,16 @@ def bit_mask(bits): return mask def update_masks(): + global FIRST_LVL_INTERRUPTS + global SECND_LVL_INTERRUPTS + global THIRD_LVL_INTERRUPTS + if sum(INTERRUPT_BITS) > 32: raise ValueError("Too many interrupt bits") - INTERRUPT_LVL_BITMASK[0] = bit_mask(INTERRUPT_BITS[0]) - INTERRUPT_LVL_BITMASK[1] = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] - INTERRUPT_LVL_BITMASK[2] = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + FIRST_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[0]) + SECND_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] + THIRD_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] def main(): parse_args() @@ -371,9 +377,9 @@ def main(): else: # Figure out third level interrupt position debug('IRQ = ' + hex(irq)) - irq3 = (irq & INTERRUPT_LVL_BITMASK[2]) >> INTERRUPT_BITS[0] + INTERRUPT_BITS[1] - irq2 = (irq & INTERRUPT_LVL_BITMASK[1]) >> INTERRUPT_BITS[0] - irq1 = irq & INTERRUPT_LVL_BITMASK[0] + irq3 = (irq & THIRD_LVL_INTERRUPTS) >> INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + irq2 = (irq & SECND_LVL_INTERRUPTS) >> INTERRUPT_BITS[0] + irq1 = irq & FIRST_LVL_INTERRUPTS if irq3: irq_parent = irq2 From 8ea71c6750785d4c9c5230f15aaf131fbab51050 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:36 +0100 Subject: [PATCH 0818/2300] Revert "[nrf fromtree] scripts: build: gen_isr_tables: fix calculation of THIRD_LVL_INTERRUPTS" This reverts commit d483add5e73420f429a55e33ba79c5cdda6517bc. Signed-off-by: Robert Lubos --- scripts/build/gen_isr_tables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/gen_isr_tables.py b/scripts/build/gen_isr_tables.py index 314b56604ec..cd329f85551 100755 --- a/scripts/build/gen_isr_tables.py +++ b/scripts/build/gen_isr_tables.py @@ -287,7 +287,7 @@ def update_masks(): FIRST_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[0]) SECND_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[1]) << INTERRUPT_BITS[0] - THIRD_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[1] + THIRD_LVL_INTERRUPTS = bit_mask(INTERRUPT_BITS[2]) << INTERRUPT_BITS[0] + INTERRUPT_BITS[2] def main(): parse_args() From 2a8138c9973d69431982fc1cc98e1733cb32633e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:36 +0100 Subject: [PATCH 0819/2300] Revert "[nrf fromtree] arch: isr_tables: Add __used attribute to int_list_header" This reverts commit 9188dc281d339b082eb3948e8a7f023e8e44949b. Signed-off-by: Robert Lubos --- arch/common/isr_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/common/isr_tables.c b/arch/common/isr_tables.c index 9677c92683d..0311f81f252 100644 --- a/arch/common/isr_tables.c +++ b/arch/common/isr_tables.c @@ -21,7 +21,7 @@ struct int_list_header { * header of the initList section, which is used by gen_isr_tables.py to create * the vector and sw isr tables, */ -Z_GENERIC_SECTION(.irq_info) __used struct int_list_header _iheader = { +Z_GENERIC_SECTION(.irq_info) struct int_list_header _iheader = { .table_size = IRQ_TABLE_SIZE, .offset = CONFIG_GEN_IRQ_START_VECTOR, }; From d094587fa5f137d7c90b4794d4419a1d19049a59 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:36 +0100 Subject: [PATCH 0820/2300] Revert "[nrf fromtree] drivers: mfd: npm6001: set SWREADY" This reverts commit da9587f700ed05af1c6be0adaae6b8e0be6c0f10. Signed-off-by: Robert Lubos --- drivers/mfd/mfd_npm6001.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/mfd/mfd_npm6001.c b/drivers/mfd/mfd_npm6001.c index b03b10b4cba..1a077791816 100644 --- a/drivers/mfd/mfd_npm6001.c +++ b/drivers/mfd/mfd_npm6001.c @@ -11,7 +11,6 @@ #include /* nPM6001 registers */ -#define NPM6001_SWREADY 0x01U #define NPM6001_BUCK3SELDAC 0x44U #define NPM6001_BUCKMODEPADCONF 0x4EU #define NPM6001_PADDRIVESTRENGTH 0x53U @@ -61,12 +60,6 @@ static int mfd_npm6001_init(const struct device *dev) return ret; } - /* Enable switching to hysteresis mode */ - ret = i2c_reg_write_byte_dt(&config->i2c, NPM6001_SWREADY, 1U); - if (ret < 0) { - return ret; - } - return 0; } From eecc0b3c50584e66e49526907d667f576008fa55 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:36 +0100 Subject: [PATCH 0821/2300] Revert "[nrf fromtree] Bluetooth: Controller: Add nRF54x Tx Power Kconfig" This reverts commit 5dd0a61b52fc95e575484ff85015f12b96e1a436. Signed-off-by: Robert Lubos --- subsys/bluetooth/controller/Kconfig | 72 +++++-------------- .../nordic/hal/nrf5/radio/radio_nrf5_txp.h | 18 +---- 2 files changed, 17 insertions(+), 73 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index a7b2c1a74f1..91f4f08c15c 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -256,126 +256,92 @@ choice BT_CTLR_TX_PWR The value set here represents the actual default power level fed to the antenna. -config BT_CTLR_TX_PWR_PLUS_10 - bool "+10 dBm" - depends on SOC_SERIES_NRF54HX - -config BT_CTLR_TX_PWR_PLUS_9 - bool "+9 dBm" - depends on SOC_SERIES_NRF54HX - config BT_CTLR_TX_PWR_PLUS_8 bool "+8 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH config BT_CTLR_TX_PWR_PLUS_7 bool "+7 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH config BT_CTLR_TX_PWR_PLUS_6 bool "+6 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH config BT_CTLR_TX_PWR_PLUS_5 bool "+5 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH config BT_CTLR_TX_PWR_PLUS_4 bool "+4 dBm" - depends on SOC_SERIES_NRF51X || SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on SOC_SERIES_NRF51X || SOC_COMPATIBLE_NRF52X config BT_CTLR_TX_PWR_PLUS_3 bool "+3 dBm" - depends on SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF53X config BT_CTLR_TX_PWR_PLUS_2 bool "+2 dBm" - depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on HAS_HW_NRF_RADIO_TX_PWR_HIGH || SOC_SERIES_NRF53X config BT_CTLR_TX_PWR_PLUS_1 bool "+1 dBm" - depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on SOC_SERIES_NRF53X config BT_CTLR_TX_PWR_0 bool "0 dBm" config BT_CTLR_TX_PWR_MINUS_1 bool "-1 dBm" - depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on SOC_SERIES_NRF53X config BT_CTLR_TX_PWR_MINUS_2 bool "-2 dBm" - depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX + depends on SOC_SERIES_NRF53X config BT_CTLR_TX_PWR_MINUS_3 bool "-3 dBm" - depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54LX + depends on SOC_SERIES_NRF53X config BT_CTLR_TX_PWR_MINUS_4 bool "-4 dBm" config BT_CTLR_TX_PWR_MINUS_5 bool "-5 dBm" - depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54LX + depends on SOC_SERIES_NRF53X config BT_CTLR_TX_PWR_MINUS_6 bool "-6 dBm" - depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54LX + depends on SOC_SERIES_NRF53X config BT_CTLR_TX_PWR_MINUS_7 bool "-7 dBm" - depends on SOC_SERIES_NRF53X || SOC_SERIES_NRF54LX + depends on SOC_SERIES_NRF53X config BT_CTLR_TX_PWR_MINUS_8 bool "-8 dBm" -config BT_CTLR_TX_PWR_MINUS_9 - bool "-9 dBm" - depends on SOC_SERIES_NRF54LX - -config BT_CTLR_TX_PWR_MINUS_10 - bool "-10 dBm" - depends on SOC_SERIES_NRF54LX - config BT_CTLR_TX_PWR_MINUS_12 bool "-12 dBm" -config BT_CTLR_TX_PWR_MINUS_14 - bool "-14 dBm" - depends on SOC_SERIES_NRF54LX - config BT_CTLR_TX_PWR_MINUS_16 bool "-16 dBm" config BT_CTLR_TX_PWR_MINUS_20 bool "-20 dBm" -config BT_CTLR_TX_PWR_MINUS_26 - bool "-26 dBm" - depends on SOC_SERIES_NRF54LX - config BT_CTLR_TX_PWR_MINUS_30 bool "-30 dBm" - depends on SOC_SERIES_NRF51X || SOC_SERIES_NRF54HX + depends on SOC_SERIES_NRF51X config BT_CTLR_TX_PWR_MINUS_40 bool "-40 dBm" - depends on SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX || SOC_SERIES_NRF54LX - -config BT_CTLR_TX_PWR_MINUS_46 - bool "-46 dBm" - depends on SOC_SERIES_NRF54LX - -config BT_CTLR_TX_PWR_MINUS_70 - bool "-70 dBm" - depends on SOC_SERIES_NRF54HX + depends on SOC_COMPATIBLE_NRF52X || SOC_SERIES_NRF53X endchoice config BT_CTLR_TX_PWR_DBM int - default 10 if BT_CTLR_TX_PWR_PLUS_10 - default 9 if BT_CTLR_TX_PWR_PLUS_9 default 8 if BT_CTLR_TX_PWR_PLUS_8 default 7 if BT_CTLR_TX_PWR_PLUS_7 default 6 if BT_CTLR_TX_PWR_PLUS_6 @@ -393,17 +359,11 @@ config BT_CTLR_TX_PWR_DBM default -6 if BT_CTLR_TX_PWR_MINUS_6 default -7 if BT_CTLR_TX_PWR_MINUS_7 default -8 if BT_CTLR_TX_PWR_MINUS_8 - default -9 if BT_CTLR_TX_PWR_MINUS_9 - default -10 if BT_CTLR_TX_PWR_MINUS_10 default -12 if BT_CTLR_TX_PWR_MINUS_12 - default -14 if BT_CTLR_TX_PWR_MINUS_14 default -16 if BT_CTLR_TX_PWR_MINUS_16 default -20 if BT_CTLR_TX_PWR_MINUS_20 - default -26 if BT_CTLR_TX_PWR_MINUS_26 default -30 if BT_CTLR_TX_PWR_MINUS_30 default -40 if BT_CTLR_TX_PWR_MINUS_40 - default -46 if BT_CTLR_TX_PWR_MINUS_46 - default -70 if BT_CTLR_TX_PWR_MINUS_70 config BT_CTLR_TX_PWR_ANTENNA int "Set TX power (dBm)" diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_txp.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_txp.h index c3bb09fd1b3..2eb772f20cc 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_txp.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_txp.h @@ -4,11 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#if defined(CONFIG_BT_CTLR_TX_PWR_PLUS_10) -#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos10dBm -#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_9) -#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos9dBm -#elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_8) +#if defined(CONFIG_BT_CTLR_TX_PWR_PLUS_8) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos8dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_PLUS_7) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Pos7dBm @@ -42,26 +38,14 @@ #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg7dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_8) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg8dBm -#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_9) -#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg9dBm -#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_10) -#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg10dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_12) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg12dBm -#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_14) -#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg14dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_16) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg16dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_20) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg20dBm -#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_26) -#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg26dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_30) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg30dBm #elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_40) #define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg40dBm -#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_46) -#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg46dBm -#elif defined(CONFIG_BT_CTLR_TX_PWR_MINUS_70) -#define RADIO_TXP_DEFAULT RADIO_TXPOWER_TXPOWER_Neg70dBm #endif From 808c1d87aa83a6a656027bff7df9bd01b554cb63 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:36 +0100 Subject: [PATCH 0822/2300] Revert "[nrf fromtree] mcuboot: Use tweak version string" This reverts commit 40bb150723ecf33df58615ae99a34c149afb784f. Signed-off-by: Robert Lubos --- modules/Kconfig.mcuboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index 4849b456f22..8df4bde8829 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -103,7 +103,7 @@ config MCUBOOT_ENCRYPTION_KEY_FILE config MCUBOOT_IMGTOOL_SIGN_VERSION string "Version to pass to imgtool when signing" - default "$(APP_VERSION_TWEAK_STRING)" if "$(VERSION_MAJOR)" != "" + default "$(VERSION_MAJOR).$(VERSION_MINOR).$(PATCHLEVEL)+$(VERSION_TWEAK)" if "$(VERSION_MAJOR)" != "" default "0.0.0+0" help When signing with imgtool then this setting will be passed as version From 5a438f8de12b7839caf962e4ae73f0aac0fbd14c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:37 +0100 Subject: [PATCH 0823/2300] Revert "[nrf fromtree] version: cmake: kconfig: introduce extra _VERSION__STRING" This reverts commit 9627c2c522be40e732066312a4cd2ae20821c856. Signed-off-by: Robert Lubos --- cmake/modules/kconfig.cmake | 2 - cmake/modules/version.cmake | 14 +-- doc/build/version/index.rst | 174 +++++++++++++++--------------------- version.h.in | 16 ++-- 4 files changed, 83 insertions(+), 123 deletions(-) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 51dd9a0bed0..1a78b3ebd02 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -133,8 +133,6 @@ set(COMMON_KCONFIG_ENV_SETTINGS srctree=${ZEPHYR_BASE} KERNELVERSION=${KERNELVERSION} APPVERSION=${APP_VERSION_STRING} - APP_VERSION_EXTENDED_STRING=${APP_VERSION_EXTENDED_STRING} - APP_VERSION_TWEAK_STRING=${APP_VERSION_TWEAK_STRING} CONFIG_=${KCONFIG_NAMESPACE}_ KCONFIG_CONFIG=${DOTCONFIG} # Set environment variables so that Kconfig can prune Kconfig source diff --git a/cmake/modules/version.cmake b/cmake/modules/version.cmake index 4c80c5fcdc9..49d172871e7 100644 --- a/cmake/modules/version.cmake +++ b/cmake/modules/version.cmake @@ -11,10 +11,8 @@ # # Outputs with examples:: # -# PROJECT_VERSION 1.14.99.07 -# KERNEL_VERSION_STRING "1.14.99-extraver" -# KERNEL_VERSION_EXTENDED_STRING "1.14.99-extraver+7" -# KERNEL_VERSION_TWEAK_STRING "1.14.99+7" +# PROJECT_VERSION 1.14.99.07 +# KERNEL_VERSION_STRING "1.14.99-extraver" # # KERNEL_VERSION_MAJOR 1 # KERNEL_VERSION_MINOR 14 @@ -64,9 +62,9 @@ foreach(type file IN ZIP_LISTS VERSION_TYPE VERSION_FILE) string(REGEX MATCH "EXTRAVERSION = ([a-z0-9]*)" _ ${ver}) set(${type}_VERSION_EXTRA ${CMAKE_MATCH_1}) - # Temporary convenience variables + # Temporary convenience variable set(${type}_VERSION_WITHOUT_TWEAK ${${type}_VERSION_MAJOR}.${${type}_VERSION_MINOR}.${${type}_PATCHLEVEL}) - set(${type}_VERSION_WITH_TWEAK ${${type}_VERSION_MAJOR}.${${type}_VERSION_MINOR}.${${type}_PATCHLEVEL}+${${type}_VERSION_TWEAK}) + set(MAJOR ${${type}_VERSION_MAJOR}) # Temporary convenience variable set(MINOR ${${type}_VERSION_MINOR}) # Temporary convenience variable @@ -84,8 +82,6 @@ foreach(type file IN ZIP_LISTS VERSION_TYPE VERSION_FILE) else() set(${type}_VERSION_STRING "${${type}_VERSION_WITHOUT_TWEAK}") endif() - set(${type}_VERSION_TWEAK_STRING "${${type}_VERSION_WITH_TWEAK}") - set(${type}_VERSION_EXTENDED_STRING "${${type}_VERSION_STRING}+${${type}_VERSION_TWEAK}") if(type STREQUAL KERNEL) set(PROJECT_VERSION_MAJOR ${${type}_VERSION_MAJOR}) @@ -122,7 +118,5 @@ foreach(type file IN ZIP_LISTS VERSION_TYPE VERSION_FILE) unset(MAJOR) unset(MINOR) unset(PATCH) - unset(TWEAK) unset(${type}_VERSION_WITHOUT_TWEAK) - unset(${type}_VERSION_WITH_TWEAK) endforeach() diff --git a/doc/build/version/index.rst b/doc/build/version/index.rst index 2106a65e169..ef702c7ac2c 100644 --- a/doc/build/version/index.rst +++ b/doc/build/version/index.rst @@ -73,120 +73,87 @@ To use the version information in application code, the version file must be inc fields can be freely used. The include file name is :file:`app_version.h` (no path is needed), the following defines are available: -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| Define | Type | Field(s) | Example | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APPVERSION | Numerical | ``VERSION_MAJOR`` (left shifted by 24 bits), |br| | 0x1020304 | -| | | ``VERSION_MINOR`` (left shifted by 16 bits), |br| | | -| | | ``PATCHLEVEL`` (left shifted by 8 bits), |br| | | -| | | ``VERSION_TWEAK`` | | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_NUMBER | Numerical | ``VERSION_MAJOR`` (left shifted by 16 bits), |br| | 0x10203 | -| | | ``VERSION_MINOR`` (left shifted by 8 bits), |br| | | -| | | ``PATCHLEVEL`` | | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_MAJOR | Numerical | ``VERSION_MAJOR`` | 1 | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_MINOR | Numerical | ``VERSION_MINOR`` | 2 | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3-unstable" | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``EXTRAVERSION`` |br| | | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_EXTENDED_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3-unstable+4" | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``EXTRAVERSION`` |br| | | -| | | ``VERSION_TWEAK`` |br| | | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_TWEAK_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3+4" | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``VERSION_TWEAK`` |br| | | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_BUILD_VERSION | String (unquoted) | None (value of ``git describe --abbrev=12 --always`` | v3.3.0-18-g2c85d9224fca | -| | | from application repository) | | -+-----------------------------+-------------------+------------------------------------------------------+-------------------------+ ++--------------------+-------------------+------------------------------------------------------+-------------------------+ +| Define | Type | Field(s) | Example | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ +| APPVERSION | Numerical | ``VERSION_MAJOR`` (left shifted by 24 bits), |br| | 0x1020304 | +| | | ``VERSION_MINOR`` (left shifted by 16 bits), |br| | | +| | | ``PATCHLEVEL`` (left shifted by 8 bits), |br| | | +| | | ``VERSION_TWEAK`` | | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_NUMBER | Numerical | ``VERSION_MAJOR`` (left shifted by 16 bits), |br| | 0x10203 | +| | | ``VERSION_MINOR`` (left shifted by 8 bits), |br| | | +| | | ``PATCHLEVEL`` | | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_MAJOR | Numerical | ``VERSION_MAJOR`` | 1 | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_MINOR | Numerical | ``VERSION_MINOR`` | 2 | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_VERSION_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3-unstable" | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``EXTRAVERSION`` |br| | | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ +| APP_BUILD_VERSION | String (unquoted) | None (value of ``git describe --abbrev=12 --always`` | v3.3.0-18-g2c85d9224fca | +| | | from application repository) | | ++--------------------+-------------------+------------------------------------------------------+-------------------------+ Use in Kconfig ============== The following variables are available for usage in Kconfig files: -+--------------------------------+-----------+--------------------------+------------------+ -| Variable | Type | Field(s) | Example | -+--------------------------------+-----------+--------------------------+------------------+ -| $(VERSION_MAJOR) | Numerical | ``VERSION_MAJOR`` | 1 | -+--------------------------------+-----------+--------------------------+------------------+ -| $(VERSION_MINOR) | Numerical | ``VERSION_MINOR`` | 2 | -+--------------------------------+-----------+--------------------------+------------------+ -| $(PATCHLEVEL) | Numerical | ``PATCHLEVEL`` | 3 | -+--------------------------------+-----------+--------------------------+------------------+ -| $(VERSION_TWEAK) | Numerical | ``VERSION_TWEAK`` | 4 | -+--------------------------------+-----------+--------------------------+------------------+ -| $(APPVERSION) | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``EXTRAVERSION`` | | -+--------------------------------+-----------+--------------------------+------------------+ -| $(APP_VERSION_EXTENDED_STRING) | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable+4 | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``EXTRAVERSION``, |br| | | -| | | ``VERSION_TWEAK`` | | -+--------------------------------+-----------+--------------------------+------------------+ -| $(APP_VERSION_TWEAK_STRING) | String | ``VERSION_MAJOR``, |br| | 1.2.3+4 | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``VERSION_TWEAK`` | | -+--------------------------------+-----------+--------------------------+------------------+ ++------------------+-----------+-------------------------+----------------+ +| Variable | Type | Field(s) | Example | ++------------------+-----------+-------------------------+----------------+ +| $(VERSION_MAJOR) | Numerical | ``VERSION_MAJOR`` | 1 | ++------------------+-----------+-------------------------+----------------+ +| $(VERSION_MINOR) | Numerical | ``VERSION_MINOR`` | 2 | ++------------------+-----------+-------------------------+----------------+ +| $(PATCHLEVEL) | Numerical | ``PATCHLEVEL`` | 3 | ++------------------+-----------+-------------------------+----------------+ +| $(VERSION_TWEAK) | Numerical | ``VERSION_TWEAK`` | 4 | ++------------------+-----------+-------------------------+----------------+ +| $(APPVERSION) | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``EXTRAVERSION`` | | ++------------------+-----------+-------------------------+----------------+ Use in CMake ============ The following variable are available for usage in CMake files: -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| Variable | Type | Field(s) | Example | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| APPVERSION | Numerical (hex) | ``VERSION_MAJOR`` (left shifted by 24 bits), |br| | 0x1020304 | -| | | ``VERSION_MINOR`` (left shifted by 16 bits), |br| | | -| | | ``PATCHLEVEL`` (left shifted by 8 bits), |br| | | -| | | ``VERSION_TWEAK`` | | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| APP_VERSION_NUMBER | Numerical (hex) | ``VERSION_MAJOR`` (left shifted by 16 bits), |br| | 0x10203 | -| | | ``VERSION_MINOR`` (left shifted by 8 bits), |br| | | -| | | ``PATCHLEVEL`` | | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| APP_VERSION_MAJOR | Numerical | ``VERSION_MAJOR`` | 1 | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| APP_VERSION_MINOR | Numerical | ``VERSION_MINOR`` | 2 | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| APP_VERSION_STRING | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``EXTRAVERSION`` | | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| APP_VERSION_EXTENDED_STRING | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable+4 | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``EXTRAVERSION``, |br| | | -| | | ``VERSION_TWEAK`` | | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ -| APP_VERSION_TWEAK_STRING | String | ``VERSION_MAJOR``, |br| | 1.2.3+4 | -| | | ``VERSION_MINOR``, |br| | | -| | | ``PATCHLEVEL``, |br| | | -| | | ``VERSION_TWEAK`` | | -+-----------------------------+-----------------+---------------------------------------------------+------------------+ ++--------------------+-----------------+---------------------------------------------------+----------------+ +| Variable | Type | Field(s) | Example | ++--------------------+-----------------+---------------------------------------------------+----------------+ +| APPVERSION | Numerical (hex) | ``VERSION_MAJOR`` (left shifted by 24 bits), |br| | 0x1020304 | +| | | ``VERSION_MINOR`` (left shifted by 16 bits), |br| | | +| | | ``PATCHLEVEL`` (left shifted by 8 bits), |br| | | +| | | ``VERSION_TWEAK`` | | ++--------------------+-----------------+---------------------------------------------------+----------------+ +| APP_VERSION_NUMBER | Numerical (hex) | ``VERSION_MAJOR`` (left shifted by 16 bits), |br| | 0x10203 | +| | | ``VERSION_MINOR`` (left shifted by 8 bits), |br| | | +| | | ``PATCHLEVEL`` | | ++--------------------+-----------------+---------------------------------------------------+----------------+ +| APP_VERSION_MAJOR | Numerical | ``VERSION_MAJOR`` | 1 | ++--------------------+-----------------+---------------------------------------------------+----------------+ +| APP_VERSION_MINOR | Numerical | ``VERSION_MINOR`` | 2 | ++--------------------+-----------------+---------------------------------------------------+----------------+ +| APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | ++--------------------+-----------------+---------------------------------------------------+----------------+ +| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | ++--------------------+-----------------+---------------------------------------------------+----------------+ +| APP_VERSION_STRING | String | ``VERSION_MAJOR``, |br| | 1.2.3-unstable | +| | | ``VERSION_MINOR``, |br| | | +| | | ``PATCHLEVEL``, |br| | | +| | | ``EXTRAVERSION`` | | ++--------------------+-----------------+---------------------------------------------------+----------------+ Use in MCUboot-supported applications ===================================== @@ -194,3 +161,6 @@ Use in MCUboot-supported applications No additional configuration needs to be done to the target application so long as it is configured to support MCUboot and a signed image is generated, the version information will be automatically included in the image data. + +The format used for signing is ``VERSION_MAJOR`` . ``VERSION_MINOR`` . ``PATCHLEVEL``, the tweak +version field is not currently used. diff --git a/version.h.in b/version.h.in index bfb2eb3edb7..476d97eabbb 100644 --- a/version.h.in +++ b/version.h.in @@ -9,15 +9,13 @@ #cmakedefine ZEPHYR_VERSION_CODE @ZEPHYR_VERSION_CODE@ #cmakedefine ZEPHYR_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#define @VERSION_TYPE@VERSION @@VERSION_TYPE@VERSION@ -#define @VERSION_TYPE@_VERSION_NUMBER @@VERSION_TYPE@_VERSION_NUMBER@ -#define @VERSION_TYPE@_VERSION_MAJOR @@VERSION_TYPE@_VERSION_MAJOR@ -#define @VERSION_TYPE@_VERSION_MINOR @@VERSION_TYPE@_VERSION_MINOR@ -#define @VERSION_TYPE@_PATCHLEVEL @@VERSION_TYPE@_PATCHLEVEL@ -#define @VERSION_TYPE@_TWEAK @@VERSION_TYPE@_VERSION_TWEAK@ -#define @VERSION_TYPE@_VERSION_STRING "@@VERSION_TYPE@_VERSION_STRING@" -#define @VERSION_TYPE@_VERSION_EXTENDED_STRING "@@VERSION_TYPE@_VERSION_EXTENDED_STRING@" -#define @VERSION_TYPE@_VERSION_TWEAK_STRING "@@VERSION_TYPE@_VERSION_TWEAK_STRING@" +#define @VERSION_TYPE@VERSION @@VERSION_TYPE@VERSION@ +#define @VERSION_TYPE@_VERSION_NUMBER @@VERSION_TYPE@_VERSION_NUMBER@ +#define @VERSION_TYPE@_VERSION_MAJOR @@VERSION_TYPE@_VERSION_MAJOR@ +#define @VERSION_TYPE@_VERSION_MINOR @@VERSION_TYPE@_VERSION_MINOR@ +#define @VERSION_TYPE@_PATCHLEVEL @@VERSION_TYPE@_PATCHLEVEL@ +#define @VERSION_TYPE@_TWEAK @@VERSION_TYPE@_VERSION_TWEAK@ +#define @VERSION_TYPE@_VERSION_STRING "@@VERSION_TYPE@_VERSION_STRING@" #define @BUILD_VERSION_NAME@ @@BUILD_VERSION_NAME@@ @@VERSION_TYPE@_VERSION_CUSTOMIZATION@ From 83fbfc2c1d36c6d3ad2009850a9ce457a4784dd6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:37 +0100 Subject: [PATCH 0824/2300] Revert "[nrf fromtree] version: export tweak version in version.h" This reverts commit d0b1f82b4d856f2425ea250a683822d8e4ff90dd. Signed-off-by: Robert Lubos --- doc/build/version/index.rst | 2 -- version.h.in | 1 - 2 files changed, 3 deletions(-) diff --git a/doc/build/version/index.rst b/doc/build/version/index.rst index ef702c7ac2c..8d169a85bf5 100644 --- a/doc/build/version/index.rst +++ b/doc/build/version/index.rst @@ -91,8 +91,6 @@ following defines are available: +--------------------+-------------------+------------------------------------------------------+-------------------------+ | APP_PATCHLEVEL | Numerical | ``PATCHLEVEL`` | 3 | +--------------------+-------------------+------------------------------------------------------+-------------------------+ -| APP_VERSION_TWEAK | Numerical | ``VERSION_TWEAK`` | 4 | -+--------------------+-------------------+------------------------------------------------------+-------------------------+ | APP_VERSION_STRING | String (quoted) | ``VERSION_MAJOR``, |br| | "1.2.3-unstable" | | | | ``VERSION_MINOR``, |br| | | | | | ``PATCHLEVEL``, |br| | | diff --git a/version.h.in b/version.h.in index 476d97eabbb..c60fb721804 100644 --- a/version.h.in +++ b/version.h.in @@ -14,7 +14,6 @@ #define @VERSION_TYPE@_VERSION_MAJOR @@VERSION_TYPE@_VERSION_MAJOR@ #define @VERSION_TYPE@_VERSION_MINOR @@VERSION_TYPE@_VERSION_MINOR@ #define @VERSION_TYPE@_PATCHLEVEL @@VERSION_TYPE@_PATCHLEVEL@ -#define @VERSION_TYPE@_TWEAK @@VERSION_TYPE@_VERSION_TWEAK@ #define @VERSION_TYPE@_VERSION_STRING "@@VERSION_TYPE@_VERSION_STRING@" #define @BUILD_VERSION_NAME@ @@BUILD_VERSION_NAME@@ From 7b7aa499909ebe4d3ecdf0920e56c17271a044ed Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:37 +0100 Subject: [PATCH 0825/2300] Revert "[nrf fromlist] drivers: sensor: adxl367: fix trigger support" This reverts commit 9cd72adc187f9901b6d6c783dbf6971ea4c42fdc. Signed-off-by: Robert Lubos --- drivers/sensor/adxl367/adxl367_trigger.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/sensor/adxl367/adxl367_trigger.c b/drivers/sensor/adxl367/adxl367_trigger.c index 534bd07324e..4e86d466343 100644 --- a/drivers/sensor/adxl367/adxl367_trigger.c +++ b/drivers/sensor/adxl367/adxl367_trigger.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT adi_adxl367 - #include #include #include From 12d7558dbf3e1f79f3a40b5a94c53e65000007dd Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:37 +0100 Subject: [PATCH 0826/2300] Revert "[nrf fromlist] drivers: modem_cellular: fine tune nRF91's shutdown_time" This reverts commit 4c36459d673f2d4bda0dc7a031862dae947aacd0. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 276c9d38f7b..ed4e998fec3 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -2219,7 +2219,7 @@ MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, .power_pulse_duration_ms = 100, \ .reset_pulse_duration_ms = 100, \ .startup_time_ms = 2000, \ - .shutdown_time_ms = 10000, \ + .shutdown_time_ms = 3000, \ .init_chat_script = &nordic_nrf91_slm_init_chat_script, \ .dial_chat_script = &nordic_nrf91_slm_dial_chat_script, \ .periodic_chat_script = &nordic_nrf91_slm_periodic_chat_script, \ From 5434801bcb03d1a9abf1ad20e6d9f6bbb0d40cc1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:37 +0100 Subject: [PATCH 0827/2300] Revert "[nrf fromlist] drivers: flash: rram singlethreading support" This reverts commit bbe2567a9ba81c2fdba57f324d39ce22fe633a25. Signed-off-by: Robert Lubos --- drivers/flash/soc_flash_nrf_rram.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 4930eb31697..369ff61c556 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -30,16 +30,10 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define WRITE_BLOCK_SIZE_FROM_DT DT_PROP(RRAM, write_block_size) #define ERASE_VALUE 0xFF -#ifdef CONFIG_MULTITHREADING static struct k_sem sem_lock; #define SYNC_INIT() k_sem_init(&sem_lock, 1, 1) #define SYNC_LOCK() k_sem_take(&sem_lock, K_FOREVER) #define SYNC_UNLOCK() k_sem_give(&sem_lock) -#else -#define SYNC_INIT() -#define SYNC_LOCK() -#define SYNC_UNLOCK() -#endif /* CONFIG_MULTITHREADING */ #if CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE > 0 #define WRITE_BUFFER_ENABLE 1 From bbec279fd94e051ef39f0e82bc7ece3df80d466c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:37 +0100 Subject: [PATCH 0828/2300] Revert "[nrf fromlist] drivers: flash: rram: minor driver code changes" This reverts commit 33b35ded3b3b641005eea1edc71cd4da523090bb. Signed-off-by: Robert Lubos --- drivers/flash/soc_flash_nrf_rram.c | 75 ++++++++++++++---------------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 369ff61c556..44ce514cda8 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -24,11 +24,12 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define RRAM_START DT_REG_ADDR(RRAM) #define RRAM_SIZE DT_REG_SIZE(RRAM) +#define RRAM_WORD_SIZE 4 + #define PAGE_SIZE DT_PROP(RRAM, erase_block_size) #define PAGE_COUNT ((RRAM_SIZE) / (PAGE_SIZE)) -#define WRITE_BLOCK_SIZE_FROM_DT DT_PROP(RRAM, write_block_size) -#define ERASE_VALUE 0xFF +#define ERASE_VALUE 0xFF static struct k_sem sem_lock; #define SYNC_INIT() k_sem_init(&sem_lock, 1, 1) @@ -36,20 +37,13 @@ static struct k_sem sem_lock; #define SYNC_UNLOCK() k_sem_give(&sem_lock) #if CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE > 0 -#define WRITE_BUFFER_ENABLE 1 -#define WRITE_BUFFER_SIZE CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE -#define WRITE_LINE_SIZE 16 /* In bytes, one line is 128 bits. */ -#define WRITE_BUFFER_MAX_SIZE (WRITE_BUFFER_SIZE * WRITE_LINE_SIZE) -BUILD_ASSERT((PAGE_SIZE % (WRITE_LINE_SIZE) == 0), "erase-block-size must be a multiple of 16"); -BUILD_ASSERT((WRITE_BLOCK_SIZE_FROM_DT % (WRITE_LINE_SIZE) == 0), - "if NRF_RRAM_WRITE_BUFFER_SIZE > 0, then write-block-size must be a multiple of 16"); +#define WRITE_BUFFER_ENABLE 1 +#define WRITE_BUFFER_SIZE CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE +#define WRITE_LINE_SIZE 16 /* In bytes, one line is 128 bits. */ #else -#define WRITE_BUFFER_ENABLE 0 -#define WRITE_BUFFER_SIZE 0 -#define WRITE_LINE_SIZE WRITE_BLOCK_SIZE_FROM_DT -#define WRITE_BUFFER_MAX_SIZE 16 /* In bytes, one line is 128 bits. */ -BUILD_ASSERT((PAGE_SIZE % (WRITE_LINE_SIZE) == 0), - "erase-block-size must be a multiple of write-block-size"); +#define WRITE_BUFFER_ENABLE 0 +#define WRITE_BUFFER_SIZE 0 +#define WRITE_LINE_SIZE RRAM_WORD_SIZE #endif #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE @@ -66,6 +60,12 @@ BUILD_ASSERT((PAGE_SIZE % (WRITE_LINE_SIZE) == 0), #define FLASH_SLOT_WRITE 8000 /* longest write takes 7107 us */ #endif +#if WRITE_BUFFER_ENABLE +#define RRAM_MAX_WRITE_BUFFER (WRITE_BUFFER_SIZE * WRITE_LINE_SIZE) +#else +#define RRAM_MAX_WRITE_BUFFER (WRITE_LINE_SIZE * 32) +#endif + static int write_op(void *context); /* instance of flash_op_handler_t */ static int write_synchronously(off_t addr, const void *data, size_t len); @@ -86,7 +86,7 @@ static void commit_changes(size_t len) return; } - if ((len % (WRITE_BUFFER_MAX_SIZE)) == 0) { + if ((len % (WRITE_LINE_SIZE * WRITE_BUFFER_SIZE)) == 0) { /* Our last operation was buffer size-aligned, so we're done. */ return; } @@ -144,7 +144,7 @@ static int write_op(void *context) } while (w_ctx->len > 0) { - len = (w_ctx->len > WRITE_BUFFER_MAX_SIZE) ? WRITE_BUFFER_MAX_SIZE : w_ctx->len; + len = (RRAM_MAX_WRITE_BUFFER < w_ctx->len) ? RRAM_MAX_WRITE_BUFFER : w_ctx->len; rram_write(w_ctx->flash_addr, (const void *)w_ctx->data_addr, len); @@ -181,7 +181,7 @@ static int write_synchronously(off_t addr, const void *data, size_t len) #endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ -static int nrf_write(off_t addr, const void *data, size_t len) +static int flash_nrf_write(off_t addr, const void *data, size_t len) { int ret = 0; @@ -212,7 +212,7 @@ static int nrf_write(off_t addr, const void *data, size_t len) return ret; } -static int nrf_rram_read(const struct device *dev, off_t addr, void *data, size_t len) +static int flash_nrf_rram_read(const struct device *dev, off_t addr, void *data, size_t len) { ARG_UNUSED(dev); @@ -226,25 +226,21 @@ static int nrf_rram_read(const struct device *dev, off_t addr, void *data, size_ return 0; } -static int nrf_rram_write(const struct device *dev, off_t addr, const void *data, size_t len) +static int flash_nrf_rram_write(const struct device *dev, off_t addr, const void *data, size_t len) { ARG_UNUSED(dev); - if (data == NULL) { - return -EINVAL; - } - - return nrf_write(addr, data, len); + return flash_nrf_write(addr, data, len); } -static int nrf_rram_erase(const struct device *dev, off_t addr, size_t len) +static int flash_nrf_rram_erase(const struct device *dev, off_t addr, size_t len) { ARG_UNUSED(dev); - return nrf_write(addr, NULL, len); + return flash_nrf_write(addr, NULL, len); } -static const struct flash_parameters *nrf_rram_get_parameters(const struct device *dev) +static const struct flash_parameters *flash_nrf_rram_get_parameters(const struct device *dev) { ARG_UNUSED(dev); @@ -257,8 +253,9 @@ static const struct flash_parameters *nrf_rram_get_parameters(const struct devic } #if defined(CONFIG_FLASH_PAGE_LAYOUT) -static void nrf_rram_page_layout(const struct device *dev, const struct flash_pages_layout **layout, - size_t *layout_size) +static void flash_nrf_rram_page_layout(const struct device *dev, + const struct flash_pages_layout **layout, + size_t *layout_size) { ARG_UNUSED(dev); @@ -272,17 +269,17 @@ static void nrf_rram_page_layout(const struct device *dev, const struct flash_pa } #endif -static const struct flash_driver_api nrf_rram_api = { - .read = nrf_rram_read, - .write = nrf_rram_write, - .erase = nrf_rram_erase, - .get_parameters = nrf_rram_get_parameters, +static const struct flash_driver_api flash_nrf_rram_api = { + .read = flash_nrf_rram_read, + .write = flash_nrf_rram_write, + .erase = flash_nrf_rram_erase, + .get_parameters = flash_nrf_rram_get_parameters, #if defined(CONFIG_FLASH_PAGE_LAYOUT) - .page_layout = nrf_rram_page_layout, + .page_layout = flash_nrf_rram_page_layout, #endif }; -static int nrf_rram_init(const struct device *dev) +static int flash_nrf_rram_init(const struct device *dev) { ARG_UNUSED(dev); @@ -303,5 +300,5 @@ static int nrf_rram_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, nrf_rram_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &nrf_rram_api); +DEVICE_DT_INST_DEFINE(0, flash_nrf_rram_init, NULL, NULL, NULL, POST_KERNEL, + CONFIG_FLASH_INIT_PRIORITY, &flash_nrf_rram_api); From c76d202e4f9896b74cdfa72b295674f2078e922d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:38 +0100 Subject: [PATCH 0829/2300] Revert "[nrf fromlist] drivers: flash: rram: Make rram flash timeout multiplier user selectable" This reverts commit 76a054d357f7a288d8135757b63d654ffc8113d2. Signed-off-by: Robert Lubos --- drivers/flash/Kconfig.nrf_rram | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index 68efde1ab30..3ec7005acde 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -57,13 +57,8 @@ config SOC_FLASH_NRF_RADIO_SYNC_NONE endchoice config SOC_FLASH_NRF_TIMEOUT_MULTIPLIER - int "Multiplier for flash operation timeouts [x0.1]" + int depends on !SOC_FLASH_NRF_RADIO_SYNC_NONE default 1 - help - This is a multiplier that will be divided by 10 that is applied - to the flash erase and write operations timeout. The base for - the multiplication would allow erasing all nRF flash pages in - blocking mode. endif # SOC_FLASH_NRF_RRAM From 92ff4f520882ee76ad08e84ceec5a5dbcaf47242 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:38 +0100 Subject: [PATCH 0830/2300] Revert "[nrf fromlist] drivers/flash/rram: set to use up to 512 B burst writes by default" This reverts commit 936f88282e0d6f6c6317c2ad6a57209ab397ed21. Signed-off-by: Robert Lubos --- drivers/flash/Kconfig.nrf_rram | 1 - drivers/flash/soc_flash_nrf_rram.c | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index 3ec7005acde..f6e3ccc6416 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -21,7 +21,6 @@ if SOC_FLASH_NRF_RRAM config NRF_RRAM_WRITE_BUFFER_SIZE int "Internal write-buffer size" - default 32 if !SOC_FLASH_NRF_RADIO_SYNC_NONE default 0 range 0 32 help diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 44ce514cda8..8c97285319f 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -47,18 +47,7 @@ static struct k_sem sem_lock; #endif #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE - -#if (WRITE_BUFFER_SIZE < 2) -#define FLASH_SLOT_WRITE 500 -#elif (WRITE_BUFFER_SIZE < 4) -#define FLASH_SLOT_WRITE 1000 -#elif (WRITE_BUFFER_SIZE < 9) -#define FLASH_SLOT_WRITE 2000 -#elif (WRITE_BUFFER_SIZE < 17) -#define FLASH_SLOT_WRITE 4000 -#else -#define FLASH_SLOT_WRITE 8000 /* longest write takes 7107 us */ -#endif +#define FLASH_SLOT_WRITE 5000 #if WRITE_BUFFER_ENABLE #define RRAM_MAX_WRITE_BUFFER (WRITE_BUFFER_SIZE * WRITE_LINE_SIZE) From 4824ae0b069c02b5adc97ca574a113d391678000 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:38 +0100 Subject: [PATCH 0831/2300] Revert "[nrf fromlist] drivers/flash: fix nRF RRAM write-length issue while MPSL in use" This reverts commit 679b781fe5f78da22f81995a1734cb372b6252e7. Signed-off-by: Robert Lubos --- drivers/flash/soc_flash_nrf_rram.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 8c97285319f..64780fc3013 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -133,11 +133,14 @@ static int write_op(void *context) } while (w_ctx->len > 0) { - len = (RRAM_MAX_WRITE_BUFFER < w_ctx->len) ? RRAM_MAX_WRITE_BUFFER : w_ctx->len; + if (RRAM_MAX_WRITE_BUFFER < w_ctx->len) { + len = (RRAM_MAX_WRITE_BUFFER < w_ctx->len) ? RRAM_MAX_WRITE_BUFFER + : w_ctx->len; + } rram_write(w_ctx->flash_addr, (const void *)w_ctx->data_addr, len); - shift_write_context(len, w_ctx); + shift_write_context(sizeof(uint32_t), w_ctx); if (w_ctx->len > 0) { i++; From aaf21ffd38902f8d00b1737e36f67046c7bec25f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:38 +0100 Subject: [PATCH 0832/2300] Revert "[nrf fromlist] drivers/flash: add radio synchronization to RRAM" This reverts commit 16dbfa6172d366029f48d9f33c014ed5f4a3ed2a. Signed-off-by: Robert Lubos --- drivers/flash/Kconfig.nrf_rram | 25 ----- drivers/flash/soc_flash_nrf_rram.c | 142 +++-------------------------- 2 files changed, 13 insertions(+), 154 deletions(-) diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram index f6e3ccc6416..6d100dabab6 100644 --- a/drivers/flash/Kconfig.nrf_rram +++ b/drivers/flash/Kconfig.nrf_rram @@ -35,29 +35,4 @@ config NRF_RRAM_READYNEXT_TIMEOUT_VALUE help Set 0 to disable ready next timeout counter. -choice SOC_FLASH_NRF_RADIO_SYNC_CHOICE - prompt "Nordic nRFx flash driver synchronization" - default SOC_FLASH_NRF_RADIO_SYNC_TICKER if BT_LL_SW_SPLIT - default SOC_FLASH_NRF_RADIO_SYNC_NONE - help - synchronization between flash memory driver and radio. - -config SOC_FLASH_NRF_RADIO_SYNC_TICKER - bool "Nordic nRFx flash driver synchronized with radio" - depends on BT_LL_SW_SPLIT - help - Enable synchronization between flash memory driver and radio using - BLE LL controller ticker API. - -config SOC_FLASH_NRF_RADIO_SYNC_NONE - bool "none" - help - disable synchronization between flash memory driver and radio. -endchoice - -config SOC_FLASH_NRF_TIMEOUT_MULTIPLIER - int - depends on !SOC_FLASH_NRF_RADIO_SYNC_NONE - default 1 - endif # SOC_FLASH_NRF_RRAM diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 64780fc3013..76a855b9787 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -15,8 +15,6 @@ #include #include -#include - LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define RRAM DT_INST(0, soc_nv_flash) @@ -31,11 +29,6 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define ERASE_VALUE 0xFF -static struct k_sem sem_lock; -#define SYNC_INIT() k_sem_init(&sem_lock, 1, 1) -#define SYNC_LOCK() k_sem_take(&sem_lock, K_FOREVER) -#define SYNC_UNLOCK() k_sem_give(&sem_lock) - #if CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE > 0 #define WRITE_BUFFER_ENABLE 1 #define WRITE_BUFFER_SIZE CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE @@ -46,20 +39,6 @@ static struct k_sem sem_lock; #define WRITE_LINE_SIZE RRAM_WORD_SIZE #endif -#ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE -#define FLASH_SLOT_WRITE 5000 - -#if WRITE_BUFFER_ENABLE -#define RRAM_MAX_WRITE_BUFFER (WRITE_BUFFER_SIZE * WRITE_LINE_SIZE) -#else -#define RRAM_MAX_WRITE_BUFFER (WRITE_LINE_SIZE * 32) -#endif - -static int write_op(void *context); /* instance of flash_op_handler_t */ -static int write_synchronously(off_t addr, const void *data, size_t len); - -#endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ - static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start, size_t boundary_size) { @@ -86,8 +65,17 @@ static void commit_changes(size_t len) } #endif -static void rram_write(off_t addr, const void *data, size_t len) +static int rram_write(const struct device *dev, off_t addr, const void *data, size_t len) { + ARG_UNUSED(dev); + + if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { + return -EINVAL; + } + addr += RRAM_START; + + LOG_DBG("Write: %p:%zu", (void *)addr, len); + nrf_rramc_config_t config = {.mode_write = true, .write_buff_size = WRITE_BUFFER_SIZE}; nrf_rramc_config_set(NRF_RRAMC, &config); @@ -106,102 +94,8 @@ static void rram_write(off_t addr, const void *data, size_t len) config.mode_write = false; nrf_rramc_config_set(NRF_RRAMC, &config); -} - -#ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE -static void shift_write_context(uint32_t shift, struct flash_context *w_ctx) -{ - w_ctx->flash_addr += shift; - - /* NULL data_addr => erase emulation request*/ - if (w_ctx->data_addr) { - w_ctx->data_addr += shift; - } - - w_ctx->len -= shift; -} - -static int write_op(void *context) -{ - struct flash_context *w_ctx = context; - size_t len; - - uint32_t i = 0U; - - if (w_ctx->enable_time_limit) { - nrf_flash_sync_get_timestamp_begin(); - } - - while (w_ctx->len > 0) { - if (RRAM_MAX_WRITE_BUFFER < w_ctx->len) { - len = (RRAM_MAX_WRITE_BUFFER < w_ctx->len) ? RRAM_MAX_WRITE_BUFFER - : w_ctx->len; - } - - rram_write(w_ctx->flash_addr, (const void *)w_ctx->data_addr, len); - - shift_write_context(sizeof(uint32_t), w_ctx); - - if (w_ctx->len > 0) { - i++; - if (w_ctx->enable_time_limit) { - if (nrf_flash_sync_check_time_limit(i)) { - return FLASH_OP_ONGOING; - } - } - } - } - - return FLASH_OP_DONE; -} - -static int write_synchronously(off_t addr, const void *data, size_t len) -{ - struct flash_context context = { - .data_addr = (uint32_t)data, - .flash_addr = addr, - .len = len, - .enable_time_limit = 1 /* enable time limit */ - }; - - struct flash_op_desc flash_op_desc = {.handler = write_op, .context = &context}; - - nrf_flash_sync_set_context(FLASH_SLOT_WRITE); - return nrf_flash_sync_exe(&flash_op_desc); -} - -#endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ - -static int flash_nrf_write(off_t addr, const void *data, size_t len) -{ - int ret = 0; - - if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { - return -EINVAL; - } - addr += RRAM_START; - - if (!len) { - return 0; - } - - LOG_DBG("Write: %p:%zu", (void *)addr, len); - - SYNC_LOCK(); - -#ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE - if (nrf_flash_sync_is_required()) { - ret = write_synchronously(addr, data, len); - } else -#endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ - { - rram_write(addr, data, len); - } - - SYNC_UNLOCK(); - - return ret; + return 0; } static int flash_nrf_rram_read(const struct device *dev, off_t addr, void *data, size_t len) @@ -220,16 +114,12 @@ static int flash_nrf_rram_read(const struct device *dev, off_t addr, void *data, static int flash_nrf_rram_write(const struct device *dev, off_t addr, const void *data, size_t len) { - ARG_UNUSED(dev); - - return flash_nrf_write(addr, data, len); + return rram_write(dev, addr, data, len); } static int flash_nrf_rram_erase(const struct device *dev, off_t addr, size_t len) { - ARG_UNUSED(dev); - - return flash_nrf_write(addr, NULL, len); + return rram_write(dev, addr, NULL, len); } static const struct flash_parameters *flash_nrf_rram_get_parameters(const struct device *dev) @@ -275,12 +165,6 @@ static int flash_nrf_rram_init(const struct device *dev) { ARG_UNUSED(dev); - SYNC_INIT(); - -#ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE - nrf_flash_sync_init(); -#endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ - #if CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE > 0 nrf_rramc_ready_next_timeout_t params = { .value = CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE, From ea441e3852075ef10174c56a82650de0cd212d4d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:38 +0100 Subject: [PATCH 0833/2300] Revert "[nrf fromlist] drivers: Add flash driver for RRAM" This reverts commit 5423e96da2a404ec57296ecf432e0bca32a28236. Signed-off-by: Robert Lubos --- drivers/flash/CMakeLists.txt | 1 - drivers/flash/Kconfig | 2 - drivers/flash/Kconfig.nrf_rram | 38 ---- drivers/flash/soc_flash_nrf_rram.c | 180 ------------------ .../nordic,rram-controller.yaml | 16 -- 5 files changed, 237 deletions(-) delete mode 100644 drivers/flash/Kconfig.nrf_rram delete mode 100644 drivers/flash/soc_flash_nrf_rram.c delete mode 100644 dts/bindings/flash_controller/nordic,rram-controller.yaml diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index 7426b43b089..4a02268a2b4 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -118,4 +118,3 @@ 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_SOC_FLASH_NUMAKER soc_flash_numaker.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_RRAM soc_flash_nrf_rram.c) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index 03d4d07a193..698190e7780 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -160,6 +160,4 @@ source "drivers/flash/Kconfig.andes" source "drivers/flash/Kconfig.ambiq" -source "drivers/flash/Kconfig.nrf_rram" - endif # FLASH diff --git a/drivers/flash/Kconfig.nrf_rram b/drivers/flash/Kconfig.nrf_rram deleted file mode 100644 index 6d100dabab6..00000000000 --- a/drivers/flash/Kconfig.nrf_rram +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -menuconfig SOC_FLASH_NRF_RRAM - bool "Nordic Semiconductor flash driver for nRF RRAM" - default y - depends on DT_HAS_NORDIC_RRAM_CONTROLLER_ENABLED - select FLASH_HAS_DRIVER_ENABLED - select FLASH_HAS_PAGE_LAYOUT - select FLASH_NRF_FORCE_ALT - select MPU_ALLOW_FLASH_WRITE if ARM_MPU - help - Enables Nordic Semiconductor flash driver for nRF RRAM controllers. - The entire contiguous block of RRAM gets logically divided into pages, - but partial erase is always supported. - -if SOC_FLASH_NRF_RRAM - -config NRF_RRAM_WRITE_BUFFER_SIZE - int "Internal write-buffer size" - default 0 - range 0 32 - help - Number of 128-bit words. - Maximum buffer size can be configured to the value of 32 (128-bit words). - Set 0 to disable write-buffer. - -config NRF_RRAM_READYNEXT_TIMEOUT_VALUE - int "Preload timeout value for waiting for a next write in RRAMC clock cycles" - default 128 - range 0 4095 - help - Set 0 to disable ready next timeout counter. - -endif # SOC_FLASH_NRF_RRAM diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c deleted file mode 100644 index 76a855b9787..00000000000 --- a/drivers/flash/soc_flash_nrf_rram.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT nordic_rram_controller - -#include -#include -#include -#include -#include -#include -#include -#include - -LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); - -#define RRAM DT_INST(0, soc_nv_flash) - -#define RRAM_START DT_REG_ADDR(RRAM) -#define RRAM_SIZE DT_REG_SIZE(RRAM) - -#define RRAM_WORD_SIZE 4 - -#define PAGE_SIZE DT_PROP(RRAM, erase_block_size) -#define PAGE_COUNT ((RRAM_SIZE) / (PAGE_SIZE)) - -#define ERASE_VALUE 0xFF - -#if CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE > 0 -#define WRITE_BUFFER_ENABLE 1 -#define WRITE_BUFFER_SIZE CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE -#define WRITE_LINE_SIZE 16 /* In bytes, one line is 128 bits. */ -#else -#define WRITE_BUFFER_ENABLE 0 -#define WRITE_BUFFER_SIZE 0 -#define WRITE_LINE_SIZE RRAM_WORD_SIZE -#endif - -static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start, - size_t boundary_size) -{ - return (addr >= boundary_start && (addr < (boundary_start + boundary_size)) && - (len <= (boundary_start + boundary_size - addr))); -} - -#if WRITE_BUFFER_ENABLE -static void commit_changes(size_t len) -{ - if (nrf_rramc_empty_buffer_check(NRF_RRAMC)) { - /* The internal write-buffer has been committed to RRAM and is now empty. */ - return; - } - - if ((len % (WRITE_LINE_SIZE * WRITE_BUFFER_SIZE)) == 0) { - /* Our last operation was buffer size-aligned, so we're done. */ - return; - } - - nrf_rramc_task_trigger(NRF_RRAMC, NRF_RRAMC_TASK_COMMIT_WRITEBUF); - - barrier_dmem_fence_full(); -} -#endif - -static int rram_write(const struct device *dev, off_t addr, const void *data, size_t len) -{ - ARG_UNUSED(dev); - - if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { - return -EINVAL; - } - addr += RRAM_START; - - LOG_DBG("Write: %p:%zu", (void *)addr, len); - - nrf_rramc_config_t config = {.mode_write = true, .write_buff_size = WRITE_BUFFER_SIZE}; - - nrf_rramc_config_set(NRF_RRAMC, &config); - - if (data) { - memcpy((void *)addr, data, len); - } else { - memset((void *)addr, ERASE_VALUE, len); - } - - barrier_dmem_fence_full(); /* Barrier following our last write. */ - -#if WRITE_BUFFER_ENABLE - commit_changes(len); -#endif - - config.mode_write = false; - nrf_rramc_config_set(NRF_RRAMC, &config); - - return 0; -} - -static int flash_nrf_rram_read(const struct device *dev, off_t addr, void *data, size_t len) -{ - ARG_UNUSED(dev); - - if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { - return -EINVAL; - } - addr += RRAM_START; - - memcpy(data, (void *)addr, len); - - return 0; -} - -static int flash_nrf_rram_write(const struct device *dev, off_t addr, const void *data, size_t len) -{ - return rram_write(dev, addr, data, len); -} - -static int flash_nrf_rram_erase(const struct device *dev, off_t addr, size_t len) -{ - return rram_write(dev, addr, NULL, len); -} - -static const struct flash_parameters *flash_nrf_rram_get_parameters(const struct device *dev) -{ - ARG_UNUSED(dev); - - static const struct flash_parameters parameters = { - .write_block_size = WRITE_LINE_SIZE, - .erase_value = ERASE_VALUE, - }; - - return ¶meters; -} - -#if defined(CONFIG_FLASH_PAGE_LAYOUT) -static void flash_nrf_rram_page_layout(const struct device *dev, - const struct flash_pages_layout **layout, - size_t *layout_size) -{ - ARG_UNUSED(dev); - - static const struct flash_pages_layout pages_layout = { - .pages_count = PAGE_COUNT, - .pages_size = PAGE_SIZE, - }; - - *layout = &pages_layout; - *layout_size = 1; -} -#endif - -static const struct flash_driver_api flash_nrf_rram_api = { - .read = flash_nrf_rram_read, - .write = flash_nrf_rram_write, - .erase = flash_nrf_rram_erase, - .get_parameters = flash_nrf_rram_get_parameters, -#if defined(CONFIG_FLASH_PAGE_LAYOUT) - .page_layout = flash_nrf_rram_page_layout, -#endif -}; - -static int flash_nrf_rram_init(const struct device *dev) -{ - ARG_UNUSED(dev); - -#if CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE > 0 - nrf_rramc_ready_next_timeout_t params = { - .value = CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE, - .enable = true, - }; - nrf_rramc_ready_next_timeout_set(NRF_RRAMC, ¶ms); -#endif - - return 0; -} - -DEVICE_DT_INST_DEFINE(0, flash_nrf_rram_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_nrf_rram_api); diff --git a/dts/bindings/flash_controller/nordic,rram-controller.yaml b/dts/bindings/flash_controller/nordic,rram-controller.yaml deleted file mode 100644 index be764127f09..00000000000 --- a/dts/bindings/flash_controller/nordic,rram-controller.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-4-Clause -# - -description: | - Nordic RRAMC (Resistive random access memory controller) - - The resistive random access memory controller (RRAMC) is used for writing - the internal RRAM memory, the secure information configuration registers (SICR), - and the user information configuration registers (UICR). - -compatible: "nordic,rram-controller" - -include: base.yaml From dc25ec5fd4b03e9ee341ee71cb91181db9c7893c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:38 +0100 Subject: [PATCH 0834/2300] Revert "[nrf fromtree] lwm2m: Regenerate zcbor files" This reverts commit 227f00280cd44bbd05fd2918189f318ab41507a0. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch | 10 +++++----- subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch b/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch index 41bb3f0a5d4..81ec06bab8b 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch @@ -5,7 +5,7 @@ index c12f477cce..f41b81275d 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 @@ -47,7 +47,7 @@ index a36f8782c6..b913fb78e9 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 @@ -72,7 +72,7 @@ index 94926c531f..5521917853 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 @@ -120,7 +120,7 @@ index df2f0ac6a1..8fa1eedb2b 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 @@ -145,7 +145,7 @@ index 77649036ef..f0a2958072 100644 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c index 28b0265b9cc..3906d476cac 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h index 4e1fdeb66a2..b47b79de615 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c index 14ec7431e5b..9cf4f3457c6 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h index fc08ead18d4..49ce5c55159 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh index cf293d7b579..448a9020862 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_regenerate.sh @@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0 git add -A git commit -s -m"pre-patch" -git apply --reject lwm2m_senml_cbor.patch +git apply lwm2m_senml_cbor.patch clang-format -i \ lwm2m_senml_cbor_decode.c lwm2m_senml_cbor_decode.h \ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h index dbb5a368551..4c41385ba4b 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.1 + * Generated using zcbor version 0.8.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ From d7519ab09791d8658d423475a5442cdf5f829899 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:39 +0100 Subject: [PATCH 0835/2300] Revert "[nrf fromtree] west.yml: Update zcbor from 0.8.0 to 0.8.1" This reverts commit a0cbbed81a09dfb959a2272639f144c99de92a2f. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 34bf7aaae9f..22edd55964a 100644 --- a/west.yml +++ b/west.yml @@ -335,7 +335,7 @@ manifest: revision: 150f4eb2955eaf36ac0f9519d4f4f58d5ade5740 path: modules/lib/uoscore-uedhoc - name: zcbor - revision: d3093b5684f62268c7f27f8a5079f166772619de + revision: dbe20afd00b3ddd6956f4b47f5df202bb49a8707 path: modules/lib/zcbor self: From 1c9d6223750fb16d6acc635495684e2fc8ea3598 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:39 +0100 Subject: [PATCH 0836/2300] Revert "[nrf fromtree] tests: mgmt: Adapt to API changes in zcbor 0.8.0" This reverts commit 05cc67b8108002ad8a1978eca3b89db830299fbd. Signed-off-by: Robert Lubos --- .../cb_notifications/src/smp_test_util.c | 2 +- .../mcumgr/fs_mgmt_hash_supported/src/main.c | 2 +- .../mcumgr/mcumgr_client/src/img_gr_stub.c | 11 ++--- .../mgmt/mcumgr/mcumgr_client/src/main.c | 4 +- .../mcumgr/mcumgr_client/src/os_gr_stub.c | 3 +- .../mgmt/mcumgr/os_mgmt_datetime/src/main.c | 44 +++++++++---------- .../os_mgmt_datetime/src/smp_test_util.c | 6 +-- .../mgmt/mcumgr/os_mgmt_info/src/build_date.c | 4 +- .../mgmt/mcumgr/os_mgmt_info/src/limited.c | 6 +-- .../mgmt/mcumgr/os_mgmt_info/src/main.c | 44 +++++++++---------- .../mcumgr/os_mgmt_info/src/smp_test_util.c | 2 +- .../mgmt/mcumgr/settings_mgmt/src/main.c | 14 +++--- .../mcumgr/settings_mgmt/src/smp_test_util.c | 18 ++++---- .../subsys/mgmt/mcumgr/smp_version/src/main.c | 6 +-- .../mcumgr/smp_version/src/smp_test_util.c | 2 +- .../subsys/mgmt/mcumgr/zcbor_bulk/src/main.c | 22 +++++----- 16 files changed, 93 insertions(+), 97 deletions(-) diff --git a/tests/subsys/mgmt/mcumgr/cb_notifications/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/cb_notifications/src/smp_test_util.c index 270f232af77..a20f948f30b 100644 --- a/tests/subsys/mgmt/mcumgr/cb_notifications/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/cb_notifications/src/smp_test_util.c @@ -29,7 +29,7 @@ bool create_mcumgr_format_packet(zcbor_state_t *zse, uint8_t *buffer, uint8_t *o ok = zcbor_map_start_encode(zse, 2) && zcbor_tstr_put_lit(zse, "d") && - zcbor_tstr_put_lit(zse, "some test data") && + zcbor_tstr_put_term(zse, "some test data") && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/fs_mgmt_hash_supported/src/main.c b/tests/subsys/mgmt/mcumgr/fs_mgmt_hash_supported/src/main.c index 30575172a84..a5cafef589d 100644 --- a/tests/subsys/mgmt/mcumgr/fs_mgmt_hash_supported/src/main.c +++ b/tests/subsys/mgmt/mcumgr/fs_mgmt_hash_supported/src/main.c @@ -97,7 +97,7 @@ ZTEST(fs_mgmt_hash_supported, test_supported) /* Search expected type array for this type and update details */ zcbor_new_decode_state(state, 10, &nb->data[sizeof(struct smp_hdr)], - (nb->len - sizeof(struct smp_hdr)), 1, NULL, 0); + (nb->len - sizeof(struct smp_hdr)), 1); ok = zcbor_map_start_decode(state); diff --git a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/img_gr_stub.c b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/img_gr_stub.c index 9b12fd7b2b0..aea03935fe6 100644 --- a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/img_gr_stub.c +++ b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/img_gr_stub.c @@ -120,10 +120,9 @@ void img_read_response(int count) zcbor_tstr_put_lit(zse, "slot") && zcbor_uint32_put(zse, image_dummy_info[i].slot_num) && zcbor_tstr_put_lit(zse, "version") && - zcbor_tstr_put_term(zse, image_dummy_info[i].version, - sizeof(image_dummy_info[i].version)) && + zcbor_tstr_put_term(zse, image_dummy_info[i].version) && - zcbor_tstr_put_lit(zse, "hash") && + zcbor_tstr_put_term(zse, "hash") && zcbor_bstr_encode_ptr(zse, image_dummy_info[i].hash, IMG_MGMT_DATA_SHA_LEN) && ZCBOR_ENCODE_FLAG(zse, "bootable", image_dummy_info[i].flags.bootable) && ZCBOR_ENCODE_FLAG(zse, "pending", image_dummy_info[i].flags.pending) && @@ -181,8 +180,7 @@ void img_state_write_verify(struct net_buf *nb) ZCBOR_MAP_DECODE_KEY_DECODER("hash", zcbor_bstr_decode, &hash) }; - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1, - NULL, 0); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1); decoded = 0; /* Init buffer values */ @@ -233,8 +231,7 @@ void img_upload_init_verify(struct net_buf *nb) ZCBOR_MAP_DECODE_KEY_DECODER("sha", zcbor_bstr_decode, &sha) }; - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1, - NULL, 0); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1); decoded = 0; /* Init buffer values */ diff --git a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/main.c b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/main.c index c724c72c2cc..bf70f178fe7 100644 --- a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/main.c +++ b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/main.c @@ -225,12 +225,12 @@ ZTEST(mcumgr_client, test_os_echo) smp_stub_set_rx_data_verify(NULL); smp_client_send_status_stub(MGMT_ERR_EOK); /* Test timeout */ - rc = os_mgmt_client_echo(&os_client, os_echo_test, sizeof(os_echo_test)); + rc = os_mgmt_client_echo(&os_client, os_echo_test); zassert_equal(MGMT_ERR_ETIMEOUT, rc, "Expected to receive %d response %d", MGMT_ERR_ETIMEOUT, rc); /* Test successfully operation */ smp_stub_set_rx_data_verify(os_echo_verify); - rc = os_mgmt_client_echo(&os_client, os_echo_test, sizeof(os_echo_test)); + rc = os_mgmt_client_echo(&os_client, os_echo_test); zassert_equal(MGMT_ERR_EOK, rc, "Expected to receive %d response %d", MGMT_ERR_EOK, rc); } diff --git a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/os_gr_stub.c b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/os_gr_stub.c index c7196874556..888f00dba38 100644 --- a/tests/subsys/mgmt/mcumgr/mcumgr_client/src/os_gr_stub.c +++ b/tests/subsys/mgmt/mcumgr/mcumgr_client/src/os_gr_stub.c @@ -81,8 +81,7 @@ void os_echo_verify(struct net_buf *nb) ZCBOR_MAP_DECODE_KEY_DECODER("d", zcbor_tstr_decode, &echo_data) }; - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1, - NULL, 0); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data + sizeof(struct smp_hdr), nb->len, 1); echo_data.len = 0; rc = zcbor_map_decode_bulk(zsd, list_res_decode, ARRAY_SIZE(list_res_decode), &decoded); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/main.c b/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/main.c index 05adb1d6de4..c387c3b4812 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/main.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/main.c @@ -191,7 +191,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_get_not_set_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -253,7 +253,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_get_not_set_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -318,7 +318,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -365,7 +365,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -428,7 +428,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -475,7 +475,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -538,7 +538,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_3) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -585,7 +585,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v1_3) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -648,7 +648,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -695,7 +695,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -760,7 +760,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -807,7 +807,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -872,7 +872,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_3) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -919,7 +919,7 @@ ZTEST(os_mgmt_datetime_not_set, test_datetime_set_invalid_v2_3) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -984,7 +984,7 @@ ZTEST(os_mgmt_datetime_set, test_datetime_set_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1030,7 +1030,7 @@ ZTEST(os_mgmt_datetime_set, test_datetime_set_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1098,7 +1098,7 @@ ZTEST(os_mgmt_datetime_set, test_datetime_set_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1144,7 +1144,7 @@ ZTEST(os_mgmt_datetime_set, test_datetime_set_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1225,7 +1225,7 @@ ZTEST(os_mgmt_datetime_hook, test_datetime_set_valid_hook_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1287,7 +1287,7 @@ ZTEST(os_mgmt_datetime_hook, test_datetime_set_valid_hook_v1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1357,7 +1357,7 @@ ZTEST(os_mgmt_datetime_hook, test_datetime_set_valid_hook_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -1418,7 +1418,7 @@ ZTEST(os_mgmt_datetime_hook, test_datetime_set_valid_hook_v2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/smp_test_util.c index d2b969999cd..927089c3ee3 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_datetime/src/smp_test_util.c @@ -49,9 +49,9 @@ bool create_mcumgr_datetime_set_packet_str(zcbor_state_t *zse, bool version2, co uint8_t *buffer, uint8_t *output_buffer, uint16_t *buffer_size) { - bool ok = zcbor_map_start_encode(zse, 2) && - zcbor_tstr_put_lit(zse, "datetime") && - zcbor_tstr_put_term(zse, data, CONFIG_ZCBOR_MAX_STR_LEN) && + bool ok = zcbor_map_start_encode(zse, 2) && + zcbor_tstr_put_lit(zse, "datetime") && + zcbor_tstr_put_term(zse, data) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/build_date.c b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/build_date.c index 5674e338dfa..4af977895c3 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/build_date.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/build_date.c @@ -121,7 +121,7 @@ ZTEST(os_mgmt_info_build_date, test_info_build_date_1_build_date) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -197,7 +197,7 @@ ZTEST(os_mgmt_info_build_date, test_info_build_date_2_all) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/limited.c b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/limited.c index 613402e1624..f8899734351 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/limited.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/limited.c @@ -81,7 +81,7 @@ ZTEST(os_mgmt_info_limited, test_info_1_kernel_name) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -147,7 +147,7 @@ ZTEST(os_mgmt_info_limited, test_info_2_all) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); /* Ensure only an error is received */ ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -155,7 +155,7 @@ ZTEST(os_mgmt_info_limited, test_info_2_all) zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/main.c b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/main.c index 6e8cc61098d..8ffc2a354b8 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/main.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/main.c @@ -338,7 +338,7 @@ ZTEST(os_mgmt_info, test_info_2_kernel_name) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -399,7 +399,7 @@ ZTEST(os_mgmt_info, test_info_3_node_name) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -461,7 +461,7 @@ ZTEST(os_mgmt_info, test_info_4_kernel_release) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -523,7 +523,7 @@ ZTEST(os_mgmt_info, test_info_5_kernel_version) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -584,7 +584,7 @@ ZTEST(os_mgmt_info, test_info_6_machine) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -645,7 +645,7 @@ ZTEST(os_mgmt_info, test_info_7_processor) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -706,7 +706,7 @@ ZTEST(os_mgmt_info, test_info_8_platform) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -778,7 +778,7 @@ ZTEST(os_mgmt_info, test_info_9_os) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -839,7 +839,7 @@ ZTEST(os_mgmt_info, test_info_10_all) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -914,7 +914,7 @@ ZTEST(os_mgmt_info, test_info_11_multi_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -979,7 +979,7 @@ ZTEST(os_mgmt_info, test_info_12_multi_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1051,7 +1051,7 @@ ZTEST(os_mgmt_info, test_info_13_invalid_1) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); /* Ensure only an error is received */ ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1059,7 +1059,7 @@ ZTEST(os_mgmt_info, test_info_13_invalid_1) zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); @@ -1122,7 +1122,7 @@ ZTEST(os_mgmt_info, test_info_14_invalid_2) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); /* Ensure only an error is received */ ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1130,7 +1130,7 @@ ZTEST(os_mgmt_info, test_info_14_invalid_2) zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); @@ -1199,7 +1199,7 @@ ZTEST(os_mgmt_info_custom_os, test_info_os_custom) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1260,7 +1260,7 @@ ZTEST(os_mgmt_info_custom_os_disabled, test_info_os_custom_disabled) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1333,7 +1333,7 @@ ZTEST(os_mgmt_info_custom_cmd, test_info_cmd_custom) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; @@ -1399,14 +1399,14 @@ ZTEST(os_mgmt_info_custom_cmd_disabled, test_info_cmd_custom_disabled) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); @@ -1468,14 +1468,14 @@ ZTEST(os_mgmt_info_custom_cmd_disabled_verify, test_info_cmd_custom_disabled) /* Process received data by removing header */ (void)net_buf_pull(nb, sizeof(struct smp_hdr)); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); zassert_equal(decoded, 0, "Expected to receive 0 decoded zcbor element\n"); - zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 3, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, error_decode, ARRAY_SIZE(error_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful\n"); diff --git a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/smp_test_util.c index b76ac1ad623..c1dcded0ff6 100644 --- a/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/os_mgmt_info/src/smp_test_util.c @@ -31,7 +31,7 @@ bool create_mcumgr_format_packet(zcbor_state_t *zse, const uint8_t *format, uint ok = zcbor_map_start_encode(zse, 2) && zcbor_tstr_put_lit(zse, "format") && - zcbor_tstr_put_term(zse, format, CONFIG_ZCBOR_MAX_STR_LEN) && + zcbor_tstr_put_term(zse, format) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c b/tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c index 869a4f750d9..745fa333790 100644 --- a/tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c +++ b/tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c @@ -487,7 +487,7 @@ ZTEST(settings_mgmt, test_set_read) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -590,7 +590,7 @@ ZTEST(settings_mgmt, test_read_max_size) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 2, "Expected to receive 2 decoded zcbor elements"); @@ -745,7 +745,7 @@ ZTEST(settings_mgmt, test_set_disallowed) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); @@ -875,7 +875,7 @@ ZTEST(settings_mgmt, test_set_disallowed) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); @@ -1147,7 +1147,7 @@ ZTEST(settings_mgmt, test_delete) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); @@ -1274,7 +1274,7 @@ ZTEST(settings_mgmt, test_delete) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); @@ -1519,7 +1519,7 @@ ZTEST(settings_mgmt, test_delete) zassert_equal(smp_header->nh_version, 1, "SMP header version mismatch"); /* Get the response value to compare */ - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); zassert_equal(decoded, 1, "Expected to receive 1 decoded zcbor element"); diff --git a/tests/subsys/mgmt/mcumgr/settings_mgmt/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/settings_mgmt/src/smp_test_util.c index dcabd0d08c3..63b91151797 100644 --- a/tests/subsys/mgmt/mcumgr/settings_mgmt/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/settings_mgmt/src/smp_test_util.c @@ -31,7 +31,7 @@ bool create_settings_mgmt_read_packet(zcbor_state_t *zse, uint8_t *buffer, uint8 ok = zcbor_map_start_encode(zse, 2) && zcbor_tstr_put_lit(zse, "name") && - zcbor_tstr_put_term(zse, name, CONFIG_ZCBOR_MAX_STR_LEN) && + zcbor_tstr_put_term(zse, name) && (max_size == 0 || (zcbor_tstr_put_lit(zse, "max_size") && zcbor_uint32_put(zse, max_size))) && zcbor_map_end_encode(zse, 2); @@ -51,11 +51,11 @@ bool create_settings_mgmt_write_packet(zcbor_state_t *zse, uint8_t *buffer, uint { bool ok; - ok = zcbor_map_start_encode(zse, 2) && - zcbor_tstr_put_lit(zse, "name") && - zcbor_tstr_put_term(zse, name, CONFIG_ZCBOR_MAX_STR_LEN) && - zcbor_tstr_put_lit(zse, "val") && - zcbor_bstr_encode_ptr(zse, val, val_size) && + ok = zcbor_map_start_encode(zse, 2) && + zcbor_tstr_put_lit(zse, "name") && + zcbor_tstr_put_term(zse, name) && + zcbor_tstr_put_lit(zse, "val") && + zcbor_bstr_encode_ptr(zse, val, val_size) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); @@ -72,9 +72,9 @@ bool create_settings_mgmt_delete_packet(zcbor_state_t *zse, uint8_t *buffer, { bool ok; - ok = zcbor_map_start_encode(zse, 2) && - zcbor_tstr_put_lit(zse, "name") && - zcbor_tstr_put_term(zse, name, CONFIG_ZCBOR_MAX_STR_LEN) && + ok = zcbor_map_start_encode(zse, 2) && + zcbor_tstr_put_lit(zse, "name") && + zcbor_tstr_put_term(zse, name) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/smp_version/src/main.c b/tests/subsys/mgmt/mcumgr/smp_version/src/main.c index ed596ae964e..8676678336e 100644 --- a/tests/subsys/mgmt/mcumgr/smp_version/src/main.c +++ b/tests/subsys/mgmt/mcumgr/smp_version/src/main.c @@ -155,7 +155,7 @@ ZTEST(smp_version, test_legacy_command) zassert_equal(smp_header->nh_version, LEGACY_VERSION, "Expected response header version mismatch"); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -242,7 +242,7 @@ ZTEST(smp_version, test_current_command) zassert_equal(smp_header->nh_version, CURRENT_VERSION, "Expected response header version mismatch"); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); @@ -328,7 +328,7 @@ ZTEST(smp_version, test_new_command) zassert_equal(smp_header->nh_version, CURRENT_VERSION, "Expected response header version mismatch"); - zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, output_decode, ARRAY_SIZE(output_decode), &decoded) == 0; zassert_true(ok, "Expected decode to be successful"); diff --git a/tests/subsys/mgmt/mcumgr/smp_version/src/smp_test_util.c b/tests/subsys/mgmt/mcumgr/smp_version/src/smp_test_util.c index 96d97a6b6fa..e93ad69ff2a 100644 --- a/tests/subsys/mgmt/mcumgr/smp_version/src/smp_test_util.c +++ b/tests/subsys/mgmt/mcumgr/smp_version/src/smp_test_util.c @@ -32,7 +32,7 @@ bool create_mcumgr_format_packet(zcbor_state_t *zse, const uint8_t *format, uint ok = zcbor_map_start_encode(zse, 2) && zcbor_tstr_put_lit(zse, "format") && - zcbor_tstr_put_term(zse, format, CONFIG_ZCBOR_MAX_STR_LEN) && + zcbor_tstr_put_term(zse, format) && zcbor_map_end_encode(zse, 2); *buffer_size = (zse->payload_mut - buffer); diff --git a/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c b/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c index b1d3d79b30a..e50dc8fe51f 100644 --- a/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c +++ b/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c @@ -60,7 +60,7 @@ ZTEST(zcbor_bulk, test_correct) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -101,7 +101,7 @@ ZTEST(zcbor_bulk, test_correct_out_of_order) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -140,7 +140,7 @@ ZTEST(zcbor_bulk, test_not_map) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -175,7 +175,7 @@ ZTEST(zcbor_bulk, test_bad_type) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -211,7 +211,7 @@ ZTEST(zcbor_bulk, test_bad_type_2) zcbor_tstr_put_lit(zsd, "bool val") && zcbor_true_put(zsd) && zcbor_map_end_encode(zsd, 10); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -252,7 +252,7 @@ ZTEST(zcbor_bulk, test_bad_type_encoded) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -287,7 +287,7 @@ ZTEST(zcbor_bulk, test_duplicate) zcbor_tstr_put_lit(zsd, "hello") && zcbor_tstr_put_lit(zsd, "world") && zcbor_map_end_encode(zsd, 10); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -366,7 +366,7 @@ ZTEST(zcbor_bulk, test_map_in_map_correct) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -445,7 +445,7 @@ ZTEST(zcbor_bulk, test_map_in_map_bad) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -486,7 +486,7 @@ ZTEST(zcbor_bulk, test_key_found) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); @@ -528,7 +528,7 @@ ZTEST(zcbor_bulk, test_reset) zassert_true(ok, "Expected to be successful in encoding test pattern"); - zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1, NULL, 0); + zcbor_new_decode_state(zsd, 4, buffer, ARRAY_SIZE(buffer), 1); int rc = zcbor_map_decode_bulk(zsd, dm, ARRAY_SIZE(dm), &decoded); From 7b4025da316782fa5e915d480774da5d82ad9af2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:39 +0100 Subject: [PATCH 0837/2300] Revert "[nrf fromtree] mgmt: Adapt to API changes in zcbor 0.8.0" This reverts commit 775a4d3e42971fbf491f0b941ad0522378547a17. Signed-off-by: Robert Lubos --- include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h | 3 +-- subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c | 2 +- subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 4 ++-- .../mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c | 6 +++--- subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 2 +- .../mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c | 7 +++---- subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig | 9 +++------ subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c | 5 ++--- subsys/mgmt/mcumgr/smp/src/smp.c | 4 ++-- 9 files changed, 18 insertions(+), 24 deletions(-) diff --git a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h index ba63c136f50..0b12ccdb684 100644 --- a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h +++ b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt_client.h @@ -45,12 +45,11 @@ void os_mgmt_client_init(struct os_mgmt_client *client, struct smp_client_object * * @param client OS mgmt client object * @param echo_string Echo string - * @param max_len Max length of @p echo_string * * @return 0 on success. * @return @ref mcumgr_err_t code on failure. */ -int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string, size_t max_len); +int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string); /** * @brief Send SMP Reset command. diff --git a/subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c b/subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c index ae75aea9140..3458c3d6f8b 100644 --- a/subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/fs_mgmt/src/fs_mgmt.c @@ -783,7 +783,7 @@ static int fs_mgmt_file_hash_checksum(struct smp_streamer *ctxt) } ok &= zcbor_tstr_put_lit(zse, "type") && - zcbor_tstr_put_term(zse, type_arr, sizeof(type_arr)); + zcbor_tstr_put_term(zse, type_arr); if (off != 0) { ok &= zcbor_tstr_put_lit(zse, "off") && 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 edfe26e452f..61515c14655 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 @@ -443,11 +443,11 @@ static bool img_mgmt_state_encode_slot(zcbor_state_t *zse, uint32_t slot, int st ok = zcbor_tstr_put_lit(zse, "<\?\?\?>"); } else { vers_str[sizeof(vers_str) - 1] = '\0'; - ok = zcbor_tstr_put_term(zse, vers_str, sizeof(vers_str)); + ok = zcbor_tstr_put_term(zse, vers_str); } } - ok = ok && zcbor_tstr_put_lit(zse, "hash") && + ok = ok && zcbor_tstr_put_term(zse, "hash") && zcbor_bstr_encode(zse, &zhash) && ZCBOR_ENCODE_FLAG(zse, "bootable", !(flags & IMAGE_F_NON_BOOTABLE)) && ZCBOR_ENCODE_FLAG(zse, "pending", state_flags & REPORT_SLOT_PENDING) && diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c b/subsys/mgmt/mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c index b8cbc38b275..9ab8ee02dcd 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt_client/src/img_mgmt_client.c @@ -74,7 +74,7 @@ static int image_state_res_fn(struct net_buf *nb, void *user_data) goto out; } - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1); ok = zcbor_map_start_decode(zsd); if (!ok) { @@ -201,7 +201,7 @@ static int image_upload_res_fn(struct net_buf *nb, void *user_data) goto end; } - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1); rc = zcbor_map_decode_bulk(zsd, upload_res_decode, ARRAY_SIZE(upload_res_decode), &decoded); if (rc || image_upload_buf->image_upload_offset == SIZE_MAX) { @@ -233,7 +233,7 @@ static int erase_res_fn(struct net_buf *nb, void *user_data) goto end; } - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1); rc = zcbor_map_decode_bulk(zsd, upload_res_decode, ARRAY_SIZE(upload_res_decode), &decoded); if (rc) { diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index d5244cb07d8..13de45f02a9 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -207,7 +207,7 @@ os_mgmt_taskstat_encode_thread_name(zcbor_state_t *zse, int idx, snprintf(thread_name, sizeof(thread_name) - 1, "%d", idx); thread_name[sizeof(thread_name) - 1] = 0; - return zcbor_tstr_put_term(zse, thread_name, sizeof(thread_name)); + return zcbor_tstr_put_term(zse, thread_name); } #endif diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c b/subsys/mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c index 0bd174d1c97..2bd804494c4 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt_client/src/os_mgmt_client.c @@ -104,7 +104,7 @@ static int echo_res_fn(struct net_buf *nb, void *user_data) } /* Init ZCOR decoder state */ - zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1, NULL, 0); + zcbor_new_decode_state(zsd, ARRAY_SIZE(zsd), nb->data, nb->len, 1); ok = zcbor_map_decode_bulk(zsd, echo_response, ARRAY_SIZE(echo_response), &decoded) == 0; @@ -119,7 +119,7 @@ static int echo_res_fn(struct net_buf *nb, void *user_data) return rc; } -int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string, size_t max_len) +int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string) { struct net_buf *nb; int rc; @@ -138,8 +138,7 @@ int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string, zcbor_new_encode_state(zse, ARRAY_SIZE(zse), nb->data + nb->len, net_buf_tailroom(nb), 0); ok = zcbor_map_start_encode(zse, 2) && - zcbor_tstr_put_lit(zse, "d") && - zcbor_tstr_put_term(zse, echo_string, max_len) && + zcbor_tstr_put_lit(zse, "d") && zcbor_tstr_put_term(zse, echo_string) && zcbor_map_end_encode(zse, 2); if (!ok) { diff --git a/subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig index 1ab882c33ee..757d290d10d 100644 --- a/subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/stat_mgmt/Kconfig @@ -28,12 +28,9 @@ config MCUMGR_GRP_STAT_MAX_NAME_LEN depends on MCUMGR_GRP_STAT help Limits the maximum stat group name length in MCUmgr requests, in bytes. - For stat group names. a buffer of this size gets allocated on the stack - during handling of all stat read commands. If a stat group's name - exceeds this limit, it will be impossible to retrieve its values with - a stat show command. - For stat names s_name and snm_name, this is the maximum length when - encoding the name to cbor. + A buffer of this size gets allocated on the stack during handling of all + stat read commands. If a stat group's name exceeds this limit, it will + be impossible to retrieve its values with a stat show command. module = MCUMGR_GRP_STAT module-str = mcumgr_grp_stat 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 29e546bdb86..4740073cf01 100644 --- a/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c @@ -110,7 +110,7 @@ stat_mgmt_foreach_entry(zcbor_state_t *zse, const char *group_name, stat_mgmt_fo static int stat_mgmt_cb_encode(zcbor_state_t *zse, struct stat_mgmt_entry *entry) { - bool ok = zcbor_tstr_put_term(zse, entry->name, CONFIG_MCUMGR_GRP_STAT_MAX_NAME_LEN) && + bool ok = zcbor_tstr_put_term(zse, entry->name) && zcbor_uint32_put(zse, entry->value); return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; @@ -215,8 +215,7 @@ stat_mgmt_list(struct smp_streamer *ctxt) do { cur = stats_group_get_next(cur); if (cur != NULL) { - ok = zcbor_tstr_put_term(zse, cur->s_name, - CONFIG_MCUMGR_GRP_STAT_MAX_NAME_LEN); + ok = zcbor_tstr_put_term(zse, cur->s_name); } } while (ok && cur != NULL); diff --git a/subsys/mgmt/mcumgr/smp/src/smp.c b/subsys/mgmt/mcumgr/smp/src/smp.c index 902979d9faf..a97beebddaa 100644 --- a/subsys/mgmt/mcumgr/smp/src/smp.c +++ b/subsys/mgmt/mcumgr/smp/src/smp.c @@ -53,7 +53,7 @@ static void cbor_nb_reader_init(struct cbor_nb_reader *cnr, struct net_buf *nb) { cnr->nb = nb; zcbor_new_decode_state(cnr->zs, ARRAY_SIZE(cnr->zs), nb->data, - nb->len, 1, NULL, 0); + nb->len, 1); } static void cbor_nb_writer_init(struct cbor_nb_writer *cnw, struct net_buf *nb) @@ -125,7 +125,7 @@ static int smp_build_err_rsp(struct smp_streamer *streamer, const struct smp_hdr #ifdef CONFIG_MCUMGR_SMP_VERBOSE_ERR_RESPONSE if (ok && rc_rsn != NULL) { ok = zcbor_tstr_put_lit(zsp, "rsn") && - zcbor_tstr_put_term(zsp, rc_rsn, CONFIG_ZCBOR_MAX_STR_LEN); + zcbor_tstr_put_term(zsp, rc_rsn); } #else ARG_UNUSED(rc_rsn); From 0f18edb8f5a11f8148c9d543582853662cb988dc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:39 +0100 Subject: [PATCH 0838/2300] Revert "[nrf fromtree] lwm2m: Adapt to zcbor 0.8.0" This reverts commit 8520d89fba3a7a5bea13c71e5caee5a3611c511f. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_rw_cbor.c | 22 +- subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c | 144 +++++----- subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch | 218 ++++++++++----- .../net/lib/lwm2m/lwm2m_senml_cbor_decode.c | 220 +++++++-------- .../net/lib/lwm2m/lwm2m_senml_cbor_decode.h | 2 +- .../net/lib/lwm2m/lwm2m_senml_cbor_encode.c | 254 ++++++++---------- .../net/lib/lwm2m/lwm2m_senml_cbor_encode.h | 2 +- subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h | 116 ++++---- 8 files changed, 513 insertions(+), 465 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_rw_cbor.c b/subsys/net/lib/lwm2m/lwm2m_rw_cbor.c index 3b35d579569..daa37d3b4ba 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rw_cbor.c +++ b/subsys/net/lib/lwm2m/lwm2m_rw_cbor.c @@ -66,7 +66,7 @@ static int put_time(struct lwm2m_output_context *out, struct lwm2m_obj_path *pat ZCBOR_STATE_E(states, 0, CPKT_BUF_W_PTR(out->out_cpkt), CPKT_BUF_W_SIZE(out->out_cpkt), 1); /* Are tags required? V1.1 leaves this unspecified but some servers require tags */ - ret = zcbor_tag_put(states, ZCBOR_TAG_TIME_TSTR); + ret = zcbor_tag_encode(states, ZCBOR_TAG_TIME_TSTR); if (!ret) { LOG_ERR("unable to encode date/time string tag"); @@ -77,7 +77,7 @@ static int put_time(struct lwm2m_output_context *out, struct lwm2m_obj_path *pat out->out_cpkt->offset += tag_sz; - ret = zcbor_tstr_put_term(states, time_str, sizeof(time_str)); + ret = zcbor_tstr_put_term(states, time_str); if (!ret) { LOG_ERR("unable to encode date/time string"); return -ENOMEM; @@ -232,7 +232,7 @@ static int put_objlnk(struct lwm2m_output_context *out, struct lwm2m_obj_path *p static int get_s64(struct lwm2m_input_context *in, int64_t *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); if (!zcbor_int64_decode(states, value)) { LOG_WRN("unable to decode a 64-bit integer value"); @@ -248,7 +248,7 @@ static int get_s64(struct lwm2m_input_context *in, int64_t *value) static int get_s32(struct lwm2m_input_context *in, int32_t *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); if (!zcbor_int32_decode(states, value)) { LOG_WRN("unable to decode a 32-bit integer value, err: %d", @@ -265,7 +265,7 @@ static int get_s32(struct lwm2m_input_context *in, int32_t *value) static int get_float(struct lwm2m_input_context *in, double *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); if (!zcbor_float_decode(states, value)) { LOG_ERR("unable to decode a floating-point value"); @@ -284,7 +284,7 @@ static int get_string(struct lwm2m_input_context *in, uint8_t *value, size_t buf struct zcbor_string hndl; int len; - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); if (!zcbor_tstr_decode(states, &hndl)) { LOG_WRN("unable to decode a string"); @@ -313,7 +313,7 @@ static int get_time_string(struct lwm2m_input_context *in, int64_t *value) char time_str[sizeof("4294967295")] = { 0 }; struct zcbor_string hndl = { .value = time_str, .len = sizeof(time_str) - 1 }; - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); if (!zcbor_tstr_decode(states, &hndl)) { return -EBADMSG; @@ -331,7 +331,7 @@ static int get_time_string(struct lwm2m_input_context *in, int64_t *value) */ static int get_time_numerical(struct lwm2m_input_context *in, int64_t *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); if (!zcbor_int64_decode(states, value)) { LOG_WRN("unable to decode seconds since Epoch"); @@ -350,7 +350,7 @@ static int get_time(struct lwm2m_input_context *in, time_t *value) bool success; int64_t temp64; - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); success = zcbor_tag_decode(states, &tag); @@ -400,7 +400,7 @@ static int get_time(struct lwm2m_input_context *in, time_t *value) static int get_bool(struct lwm2m_input_context *in, bool *value) { - ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); + ZCBOR_STATE_D(states, 0, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); if (!zcbor_bool_decode(states, value)) { LOG_WRN("unable to decode a boolean value"); @@ -420,7 +420,7 @@ static int get_opaque(struct lwm2m_input_context *in, uint8_t *value, size_t buf struct zcbor_string_fragment hndl = { 0 }; int ret; - ZCBOR_STATE_D(states, 1, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1, 0); + ZCBOR_STATE_D(states, 1, ICTX_BUF_R_PTR(in), ICTX_BUF_R_LEFT_SZ(in), 1); /* Get the CBOR header only on first read. */ if (opaque->remaining == 0) { diff --git a/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c b/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c index 6c20024bbde..dd963aa0583 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c +++ b/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c @@ -81,12 +81,12 @@ K_MUTEX_DEFINE(fd_mtx); #define GET_CBOR_FD_NAME(fd) ((fd)->names[(fd)->name_cnt]) /* Get the current record */ #define GET_CBOR_FD_REC(fd) \ - &((fd)->input.lwm2m_senml_record_m[(fd)->input.lwm2m_senml_record_m_count]) + &((fd)->input._lwm2m_senml__record[(fd)->input._lwm2m_senml__record_count]) /* Get a record */ -#define GET_IN_FD_REC_I(fd, i) &((fd)->dcd.lwm2m_senml_record_m[i]) +#define GET_IN_FD_REC_I(fd, i) &((fd)->dcd._lwm2m_senml__record[i]) /* Consume the current record */ #define CONSUME_CBOR_FD_REC(fd) \ - &((fd)->input.lwm2m_senml_record_m[(fd)->input.lwm2m_senml_record_m_count++]) + &((fd)->input._lwm2m_senml__record[(fd)->input._lwm2m_senml__record_count++]) /* Get CBOR output formatter data */ #define LWM2M_OFD_CBOR(octx) ((struct cbor_out_fmt_data *)engine_get_out_user_data(octx)) @@ -131,7 +131,7 @@ static int fmt_range_check(struct cbor_out_fmt_data *fd) { if (fd->name_cnt >= CONFIG_LWM2M_RW_SENML_CBOR_RECORDS || fd->objlnk_cnt >= CONFIG_LWM2M_RW_SENML_CBOR_RECORDS || - fd->input.lwm2m_senml_record_m_count >= CONFIG_LWM2M_RW_SENML_CBOR_RECORDS) { + fd->input._lwm2m_senml__record_count >= CONFIG_LWM2M_RW_SENML_CBOR_RECORDS) { LOG_ERR("CONFIG_LWM2M_RW_SENML_CBOR_RECORDS too small"); return -ENOMEM; } @@ -161,9 +161,9 @@ static int put_basename(struct lwm2m_output_context *out, struct lwm2m_obj_path /* Tell CBOR encoder where to find the name */ struct record *record = GET_CBOR_FD_REC(fd); - record->record_bn.record_bn.value = basename; - record->record_bn.record_bn.len = len; - record->record_bn_present = 1; + record->_record_bn._record_bn.value = basename; + record->_record_bn._record_bn.len = len; + record->_record_bn_present = 1; if ((len < sizeof("/0/0") - 1) || (len >= SENML_MAX_NAME_SIZE)) { __ASSERT_NO_MSG(false); @@ -190,7 +190,7 @@ static int put_end(struct lwm2m_output_context *out, struct lwm2m_obj_path *path size_t len; struct lwm2m_senml *input = &(LWM2M_OFD_CBOR(out)->input); - if (!input->lwm2m_senml_record_m_count) { + if (!input->_lwm2m_senml__record_count) { len = put_empty_array(out); return len; @@ -258,9 +258,9 @@ static int put_begin_r(struct lwm2m_output_context *out, struct lwm2m_obj_path * /* Tell CBOR encoder where to find the name */ struct record *record = GET_CBOR_FD_REC(fd); - record->record_n.record_n.value = name; - record->record_n.record_n.len = len; - record->record_n_present = 1; + record->_record_n._record_n.value = name; + record->_record_n._record_n.len = len; + record->_record_n_present = 1; /* Makes possible to use same slot for storing r/ri name combination. * No need to increase the name count if an existing name has been used @@ -287,12 +287,12 @@ static int put_data_timestamp(struct lwm2m_output_context *out, time_t value) out_record = GET_CBOR_FD_REC(fd); if (fd->basetime) { - out_record->record_t.record_t = value - fd->basetime; - out_record->record_t_present = 1; + out_record->_record_t._record_t = value - fd->basetime; + out_record->_record_t_present = 1; } else { fd->basetime = value; - out_record->record_bt.record_bt = value; - out_record->record_bt_present = 1; + out_record->_record_bt._record_bt = value; + out_record->_record_bt_present = 1; } return 0; @@ -332,9 +332,9 @@ static int put_begin_ri(struct lwm2m_output_context *out, struct lwm2m_obj_path } /* Tell CBOR encoder where to find the name */ - record->record_n.record_n.value = name; - record->record_n.record_n.len = len; - record->record_n_present = 1; + record->_record_n._record_n.value = name; + record->_record_n._record_n.len = len; + record->_record_n_present = 1; /* No need to increase the name count if an existing name has been used */ if (name == GET_CBOR_FD_NAME(fd)) { @@ -353,7 +353,7 @@ static int put_name_nth_ri(struct lwm2m_output_context *out, struct lwm2m_obj_pa /* With the first ri the resource name (and ri name) are already in place*/ if (path->res_inst_id > 0) { ret = put_begin_ri(out, path); - } else if (record && record->record_t_present) { + } else if (record && record->_record_t_present) { /* Name need to be add for each time serialized record */ ret = put_begin_r(out, path); } @@ -372,9 +372,9 @@ static int put_value(struct lwm2m_output_context *out, struct lwm2m_obj_path *pa struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->record_union.record_union_choice = union_vi_c; - record->record_union.union_vi = value; - record->record_union_present = 1; + record->_record_union._record_union_choice = _union_vi; + record->_record_union._union_vi = value; + record->_record_union_present = 1; return 0; } @@ -410,9 +410,9 @@ static int put_time(struct lwm2m_output_context *out, struct lwm2m_obj_path *pat struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->record_union.record_union_choice = union_vi_c; - record->record_union.union_vi = (int64_t)value; - record->record_union_present = 1; + record->_record_union._record_union_choice = _union_vi; + record->_record_union._union_vi = (int64_t)value; + record->_record_union_present = 1; return 0; } @@ -428,9 +428,9 @@ static int put_float(struct lwm2m_output_context *out, struct lwm2m_obj_path *pa struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->record_union.record_union_choice = union_vf_c; - record->record_union.union_vf = *value; - record->record_union_present = 1; + record->_record_union._record_union_choice = _union_vf; + record->_record_union._union_vf = *value; + record->_record_union_present = 1; return 0; } @@ -447,10 +447,10 @@ static int put_string(struct lwm2m_output_context *out, struct lwm2m_obj_path *p struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->record_union.record_union_choice = union_vs_c; - record->record_union.union_vs.value = buf; - record->record_union.union_vs.len = buflen; - record->record_union_present = 1; + record->_record_union._record_union_choice = _union_vs; + record->_record_union._union_vs.value = buf; + record->_record_union._union_vs.len = buflen; + record->_record_union_present = 1; return 0; } @@ -466,9 +466,9 @@ static int put_bool(struct lwm2m_output_context *out, struct lwm2m_obj_path *pat struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->record_union.record_union_choice = union_vb_c; - record->record_union.union_vb = value; - record->record_union_present = 1; + record->_record_union._record_union_choice = _union_vb; + record->_record_union._union_vb = value; + record->_record_union_present = 1; return 0; } @@ -485,10 +485,10 @@ static int put_opaque(struct lwm2m_output_context *out, struct lwm2m_obj_path *p struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->record_union.record_union_choice = union_vd_c; - record->record_union.union_vd.value = buf; - record->record_union.union_vd.len = buflen; - record->record_union_present = 1; + record->_record_union._record_union_choice = _union_vd; + record->_record_union._union_vd.value = buf; + record->_record_union._union_vd.len = buflen; + record->_record_union_present = 1; return 0; } @@ -522,10 +522,10 @@ static int put_objlnk(struct lwm2m_output_context *out, struct lwm2m_obj_path *p struct record *record = CONSUME_CBOR_FD_REC(LWM2M_OFD_CBOR(out)); /* Write the value */ - record->record_union.record_union_choice = union_vlo_c; - record->record_union.union_vlo.value = objlink_buf; - record->record_union.union_vlo.len = objlnk_len; - record->record_union_present = 1; + record->_record_union._record_union_choice = _union_vlo; + record->_record_union._union_vlo.value = objlink_buf; + record->_record_union._union_vlo.len = objlnk_len; + record->_record_union_present = 1; fd->objlnk_cnt++; @@ -548,14 +548,14 @@ static int get_opaque(struct lwm2m_input_context *in, return -EINVAL; } - opaque->len = fd->current->record_union.union_vd.len; + opaque->len = fd->current->_record_union._union_vd.len; if (buflen < opaque->len) { LOG_DBG("Write opaque failed, no buffer space"); return -ENOMEM; } - dest = memcpy(value, fd->current->record_union.union_vd.value, opaque->len); + dest = memcpy(value, fd->current->_record_union._union_vd.value, opaque->len); *last_block = true; } else { LOG_DBG("Blockwise transfer not supported with SenML CBOR"); @@ -574,7 +574,7 @@ static int get_s32(struct lwm2m_input_context *in, int32_t *value) return -EINVAL; } - *value = fd->current->record_union.union_vi; + *value = fd->current->_record_union._union_vi; fd->current = NULL; return 0; @@ -589,7 +589,7 @@ static int get_s64(struct lwm2m_input_context *in, int64_t *value) return -EINVAL; } - *value = fd->current->record_union.union_vi; + *value = fd->current->_record_union._union_vi; fd->current = NULL; return 0; @@ -615,7 +615,7 @@ static int get_float(struct lwm2m_input_context *in, double *value) return -EINVAL; } - *value = fd->current->record_union.union_vf; + *value = fd->current->_record_union._union_vf; fd->current = NULL; return 0; @@ -631,9 +631,9 @@ static int get_string(struct lwm2m_input_context *in, uint8_t *buf, size_t bufle return -EINVAL; } - len = MIN(buflen-1, fd->current->record_union.union_vs.len); + len = MIN(buflen-1, fd->current->_record_union._union_vs.len); - memcpy(buf, fd->current->record_union.union_vs.value, len); + memcpy(buf, fd->current->_record_union._union_vs.value, len); buf[len] = '\0'; fd->current = NULL; @@ -698,7 +698,7 @@ static int get_bool(struct lwm2m_input_context *in, bool *value) return -EINVAL; } - *value = fd->current->record_union.union_vb; + *value = fd->current->_record_union._union_vb; fd->current = NULL; return 0; @@ -727,9 +727,9 @@ static int do_write_op_item(struct lwm2m_message *msg, struct record *rec) } /* If there's no name then the basename forms the path */ - if (rec->record_n_present) { - len = MIN(sizeof(name) - 1, rec->record_n.record_n.len); - snprintk(name, len + 1, "%s", rec->record_n.record_n.value); + if (rec->_record_n_present) { + len = MIN(sizeof(name) - 1, rec->_record_n._record_n.len); + snprintk(name, len + 1, "%s", rec->_record_n._record_n.value); } /* Form fully qualified path name */ @@ -853,29 +853,29 @@ static uint8_t parse_composite_read_paths(struct lwm2m_message *msg, msg->in.offset += isize; - for (int idx = 0; idx < fd->dcd.lwm2m_senml_record_m_count; idx++) { + for (int idx = 0; idx < fd->dcd._lwm2m_senml__record_count; idx++) { /* Where to find the basenames and names */ struct record *record = GET_IN_FD_REC_I(fd, idx); /* Set null terminated effective basename */ - if (record->record_bn_present) { - len = MIN(sizeof(basename)-1, record->record_bn.record_bn.len); - snprintk(basename, len + 1, "%s", record->record_bn.record_bn.value); + if (record->_record_bn_present) { + len = MIN(sizeof(basename)-1, record->_record_bn._record_bn.len); + snprintk(basename, len + 1, "%s", record->_record_bn._record_bn.value); basename[len] = '\0'; } /* Best effort with read, skip if no proper name is available */ - if (!record->record_n_present) { + if (!record->_record_n_present) { if (strcmp(basename, "") == 0) { continue; } } /* Set null terminated name */ - if (record->record_n_present) { - len = MIN(sizeof(name)-1, record->record_n.record_n.len); - snprintk(name, len + 1, "%s", record->record_n.record_n.value); + if (record->_record_n_present) { + len = MIN(sizeof(name)-1, record->_record_n._record_n.len); + snprintk(name, len + 1, "%s", record->_record_n._record_n.value); name[len] = '\0'; } @@ -979,30 +979,30 @@ int do_write_op_senml_cbor(struct lwm2m_message *msg) msg->in.offset += decoded_sz; - for (int idx = 0; idx < fd->dcd.lwm2m_senml_record_m_count; idx++) { + for (int idx = 0; idx < fd->dcd._lwm2m_senml__record_count; idx++) { - struct record *rec = &fd->dcd.lwm2m_senml_record_m[idx]; + struct record *rec = &fd->dcd._lwm2m_senml__record[idx]; /* Basename applies for current and succeeding records */ - if (rec->record_bn_present) { + if (rec->_record_bn_present) { int len = MIN(sizeof(fd->basename) - 1, - rec->record_bn.record_bn.len); + rec->_record_bn._record_bn.len); - snprintk(fd->basename, len + 1, "%s", rec->record_bn.record_bn.value); + snprintk(fd->basename, len + 1, "%s", rec->_record_bn._record_bn.value); goto write; } /* Keys' lexicographic order differ from the default */ - for (int jdx = 0; jdx < rec->record_key_value_pair_m_count; jdx++) { + for (int jdx = 0; jdx < rec->_record__key_value_pair_count; jdx++) { struct key_value_pair *kvp = - &(rec->record_key_value_pair_m[jdx].record_key_value_pair_m); + &(rec->_record__key_value_pair[jdx]._record__key_value_pair); - if (kvp->key_value_pair_key == lwm2m_senml_cbor_key_bn) { + if (kvp->_key_value_pair_key == lwm2m_senml_cbor_key_bn) { int len = MIN(sizeof(fd->basename) - 1, - kvp->key_value_pair.value_tstr.len); + kvp->_key_value_pair._value_tstr.len); snprintk(fd->basename, len + 1, "%s", - kvp->key_value_pair.value_tstr.value); + kvp->_key_value_pair._value_tstr.value); break; } } diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch b/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch index 81ec06bab8b..48b984aafac 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor.patch @@ -1,59 +1,94 @@ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c -index c12f477cce..f41b81275d 100644 +index f97f0ebb2d..1c1233d616 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -16,10 +16,6 @@ +@@ -15,9 +15,6 @@ + #include "zcbor_decode.h" #include "lwm2m_senml_cbor_decode.h" - #include "zcbor_print.h" -#if DEFAULT_MAX_QTY != 99 -#error "The type file was generated with a different default_max_qty than this file" -#endif -- + static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *result); static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *result); - static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *result); -@@ -209,7 +205,7 @@ static bool decode_record( - && zcbor_present_decode(&((*result).record_n_present), (zcbor_decoder_t *)decode_repeated_record_n, state, (&(*result).record_n)) - && zcbor_present_decode(&((*result).record_t_present), (zcbor_decoder_t *)decode_repeated_record_t, state, (&(*result).record_t)) - && zcbor_present_decode(&((*result).record_union_present), (zcbor_decoder_t *)decode_repeated_record_union, state, (&(*result).record_union)) -- && zcbor_multi_decode(0, 5, &(*result).record_key_value_pair_m_count, (zcbor_decoder_t *)decode_repeated_record_key_value_pair_m, state, (&(*result).record_key_value_pair_m), sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); -+ && zcbor_multi_decode(0, ZCBOR_ARRAY_SIZE(result->record_key_value_pair_m), &(*result).record_key_value_pair_m_count, (zcbor_decoder_t *)decode_repeated_record_key_value_pair_m, state, (&(*result).record_key_value_pair_m), sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); - - if (!tmp_result) { - zcbor_trace_file(state); -@@ -226,7 +222,7 @@ static bool decode_lwm2m_senml( +@@ -52,7 +49,7 @@ static bool decode_repeated_record_bt( + + bool tmp_result = ((((zcbor_int32_expect(state, (-3)))) + && (zcbor_int64_decode(state, (&(*result)._record_bt))) +- && ((((*result)._record_bt >= -9223372036854775807LL) ++ && ((((*result)._record_bt >= INT64_MIN) + && ((*result)._record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); + + if (!tmp_result) +@@ -82,7 +79,7 @@ static bool decode_repeated_record_t( + + bool tmp_result = ((((zcbor_uint32_expect(state, (6)))) + && (zcbor_int64_decode(state, (&(*result)._record_t))) +- && ((((*result)._record_t >= -9223372036854775807LL) ++ && ((((*result)._record_t >= INT64_MIN) + && ((*result)._record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); + + if (!tmp_result) +@@ -100,7 +97,7 @@ static bool decode_repeated_record_union( + + bool tmp_result = (((zcbor_union_start_code(state) && (int_res = (((((zcbor_uint32_expect_union(state, (2)))) + && (zcbor_int64_decode(state, (&(*result)._union_vi))) +- && ((((*result)._union_vi >= -9223372036854775807LL) ++ && ((((*result)._union_vi >= INT64_MIN) + && ((*result)._union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && (((*result)._record_union_choice = _union_vi), true)) + || ((((zcbor_uint32_expect_union(state, (2)))) + && (zcbor_float_decode(state, (&(*result)._union_vf)))) && (((*result)._record_union_choice = _union_vf), true)) +@@ -128,7 +125,7 @@ static bool decode_value( + bool tmp_result = (((zcbor_union_start_code(state) && (int_res = ((((zcbor_tstr_decode(state, (&(*result)._value_tstr)))) && (((*result)._value_choice = _value_tstr), true)) + || (((zcbor_bstr_decode(state, (&(*result)._value_bstr)))) && (((*result)._value_choice = _value_bstr), true)) + || (((zcbor_int64_decode(state, (&(*result)._value_int))) +- && ((((*result)._value_int >= -9223372036854775807LL) ++ && ((((*result)._value_int >= INT64_MIN) + && ((*result)._value_int <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && (((*result)._value_choice = _value_int), true)) + || (((zcbor_float_decode(state, (&(*result)._value_float)))) && (((*result)._value_choice = _value_float), true)) + || (((zcbor_bool_decode(state, (&(*result)._value_bool)))) && (((*result)._value_choice = _value_bool), true))), zcbor_union_end_code(state), int_res)))); +@@ -176,7 +173,7 @@ static bool decode_record( + && zcbor_present_decode(&((*result)._record_n_present), (zcbor_decoder_t *)decode_repeated_record_n, state, (&(*result)._record_n)) + && zcbor_present_decode(&((*result)._record_t_present), (zcbor_decoder_t *)decode_repeated_record_t, state, (&(*result)._record_t)) + && zcbor_present_decode(&((*result)._record_union_present), (zcbor_decoder_t *)decode_repeated_record_union, state, (&(*result)._record_union)) +- && zcbor_multi_decode(0, 5, &(*result)._record__key_value_pair_count, (zcbor_decoder_t *)decode_repeated_record__key_value_pair, state, (&(*result)._record__key_value_pair), sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); ++ && zcbor_multi_decode(0, ZCBOR_ARRAY_SIZE(result->_record__key_value_pair), &(*result)._record__key_value_pair_count, (zcbor_decoder_t *)decode_repeated_record__key_value_pair, state, (&(*result)._record__key_value_pair), sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); + + if (!tmp_result) + zcbor_trace(); +@@ -189,7 +186,7 @@ static bool decode_lwm2m_senml( { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); -- bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(1, 99, &(*result).lwm2m_senml_record_m_count, (zcbor_decoder_t *)decode_record, state, (&(*result).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); -+ bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(1, ZCBOR_ARRAY_SIZE(result->lwm2m_senml_record_m), &(*result).lwm2m_senml_record_m_count, (zcbor_decoder_t *)decode_record, state, (&(*result).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); +- bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(1, 99, &(*result)._lwm2m_senml__record_count, (zcbor_decoder_t *)decode_record, state, (&(*result)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); ++ bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode(1, ZCBOR_ARRAY_SIZE(result->_lwm2m_senml__record), &(*result)._lwm2m_senml__record_count, (zcbor_decoder_t *)decode_record, state, (&(*result)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); - if (!tmp_result) { - zcbor_trace_file(state); + if (!tmp_result) + zcbor_trace(); diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h -index a36f8782c6..b913fb78e9 100644 +index cb5d5c9695..7db7ed0591 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -21,11 +21,6 @@ +@@ -21,10 +21,6 @@ extern "C" { #endif @@ -61,26 +96,25 @@ index a36f8782c6..b913fb78e9 100644 -#error "The type file was generated with a different default_max_qty than this file" -#endif - -- + int cbor_decode_lwm2m_senml( - const uint8_t *payload, size_t payload_len, - struct lwm2m_senml *result, + const uint8_t *payload, size_t payload_len, diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c -index 94926c531f..5521917853 100644 +index 982cfca6c3..afdc6a32f7 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -16,10 +16,6 @@ +@@ -15,10 +15,6 @@ + #include "zcbor_encode.h" #include "lwm2m_senml_cbor_encode.h" - #include "zcbor_print.h" -#if DEFAULT_MAX_QTY != 99 -#error "The type file was generated with a different default_max_qty than this file" @@ -89,44 +123,80 @@ index 94926c531f..5521917853 100644 static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_bn *input); static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_bt *input); static bool encode_repeated_record_n(zcbor_state_t *state, const struct record_n *input); -@@ -204,12 +200,12 @@ static bool encode_record( +@@ -51,7 +47,7 @@ static bool encode_repeated_record_bt( + zcbor_print("%s\r\n", __func__); + + bool tmp_result = ((((zcbor_int32_put(state, (-3)))) +- && ((((*input)._record_bt >= -9223372036854775807LL) ++ && ((((*input)._record_bt >= INT64_MIN) + && ((*input)._record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) + && (zcbor_int64_encode(state, (&(*input)._record_bt))))); + +@@ -81,7 +77,7 @@ static bool encode_repeated_record_t( + zcbor_print("%s\r\n", __func__); + + bool tmp_result = ((((zcbor_uint32_put(state, (6)))) +- && ((((*input)._record_t >= -9223372036854775807LL) ++ && ((((*input)._record_t >= INT64_MIN) + && ((*input)._record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) + && (zcbor_int64_encode(state, (&(*input)._record_t))))); + +@@ -98,7 +94,7 @@ static bool encode_repeated_record_union( + struct zcbor_string tmp_str; + + bool tmp_result = (((((*input)._record_union_choice == _union_vi) ? (((zcbor_uint32_put(state, (2)))) +- && ((((*input)._union_vi >= -9223372036854775807LL) ++ && ((((*input)._union_vi >= INT64_MIN) + && ((*input)._union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) + && (zcbor_int64_encode(state, (&(*input)._union_vi)))) + : (((*input)._record_union_choice == _union_vf) ? (((zcbor_uint32_put(state, (2)))) +@@ -126,7 +122,7 @@ static bool encode_value( + + bool tmp_result = (((((*input)._value_choice == _value_tstr) ? ((zcbor_tstr_encode(state, (&(*input)._value_tstr)))) + : (((*input)._value_choice == _value_bstr) ? ((zcbor_bstr_encode(state, (&(*input)._value_bstr)))) +- : (((*input)._value_choice == _value_int) ? (((((*input)._value_int >= -9223372036854775807LL) ++ : (((*input)._value_choice == _value_int) ? (((((*input)._value_int >= INT64_MIN) + && ((*input)._value_int <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) + && (zcbor_int64_encode(state, (&(*input)._value_int)))) + : (((*input)._value_choice == _value_float) ? ((zcbor_float64_encode(state, (&(*input)._value_float)))) +@@ -171,12 +167,12 @@ static bool encode_record( { - zcbor_log("%s\r\n", __func__); - -- bool tmp_result = (((zcbor_map_start_encode(state, 10) && (((!(*input).record_bn_present || encode_repeated_record_bn(state, (&(*input).record_bn))) -+ bool tmp_result = (((zcbor_map_start_encode(state, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m)) && (((!(*input).record_bn_present || encode_repeated_record_bn(state, (&(*input).record_bn))) - && (!(*input).record_bt_present || encode_repeated_record_bt(state, (&(*input).record_bt))) - && (!(*input).record_n_present || encode_repeated_record_n(state, (&(*input).record_n))) - && (!(*input).record_t_present || encode_repeated_record_t(state, (&(*input).record_t))) - && (!(*input).record_union_present || encode_repeated_record_union(state, (&(*input).record_union))) -- && zcbor_multi_encode_minmax(0, 5, &(*input).record_key_value_pair_m_count, (zcbor_encoder_t *)encode_repeated_record_key_value_pair_m, state, (&(*input).record_key_value_pair_m), sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, 10)))); -+ && zcbor_multi_encode_minmax(0, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m), &(*input).record_key_value_pair_m_count, (zcbor_encoder_t *)encode_repeated_record_key_value_pair_m, state, (&(*input).record_key_value_pair_m), sizeof(struct record_key_value_pair_m))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m))))); - - if (!tmp_result) { - zcbor_trace_file(state); -@@ -226,7 +222,7 @@ static bool encode_lwm2m_senml( + zcbor_print("%s\r\n", __func__); + +- bool tmp_result = (((zcbor_map_start_encode(state, 10) && ((zcbor_present_encode(&((*input)._record_bn_present), (zcbor_encoder_t *)encode_repeated_record_bn, state, (&(*input)._record_bn)) ++ bool tmp_result = (((zcbor_map_start_encode(state, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair)) && ((zcbor_present_encode(&((*input)._record_bn_present), (zcbor_encoder_t *)encode_repeated_record_bn, state, (&(*input)._record_bn)) + && zcbor_present_encode(&((*input)._record_bt_present), (zcbor_encoder_t *)encode_repeated_record_bt, state, (&(*input)._record_bt)) + && zcbor_present_encode(&((*input)._record_n_present), (zcbor_encoder_t *)encode_repeated_record_n, state, (&(*input)._record_n)) + && zcbor_present_encode(&((*input)._record_t_present), (zcbor_encoder_t *)encode_repeated_record_t, state, (&(*input)._record_t)) + && zcbor_present_encode(&((*input)._record_union_present), (zcbor_encoder_t *)encode_repeated_record_union, state, (&(*input)._record_union)) +- && zcbor_multi_encode_minmax(0, 5, &(*input)._record__key_value_pair_count, (zcbor_encoder_t *)encode_repeated_record__key_value_pair, state, (&(*input)._record__key_value_pair), sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, 10)))); ++ && zcbor_multi_encode_minmax(0, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair), &(*input)._record__key_value_pair_count, (zcbor_encoder_t *)encode_repeated_record__key_value_pair, state, (&(*input)._record__key_value_pair), sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_map_end_encode(state, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair))))); + + if (!tmp_result) + zcbor_trace(); +@@ -189,7 +185,7 @@ static bool encode_lwm2m_senml( { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); -- bool tmp_result = (((zcbor_list_start_encode(state, 99) && ((zcbor_multi_encode_minmax(1, 99, &(*input).lwm2m_senml_record_m_count, (zcbor_encoder_t *)encode_record, state, (&(*input).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 99)))); -+ bool tmp_result = (((zcbor_list_start_encode(state, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m)) && ((zcbor_multi_encode_minmax(1, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m), &(*input).lwm2m_senml_record_m_count, (zcbor_encoder_t *)encode_record, state, (&(*input).lwm2m_senml_record_m), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m))))); +- bool tmp_result = (((zcbor_list_start_encode(state, 99) && ((zcbor_multi_encode_minmax(1, 99, &(*input)._lwm2m_senml__record_count, (zcbor_encoder_t *)encode_record, state, (&(*input)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, 99)))); ++ bool tmp_result = (((zcbor_list_start_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record)) && ((zcbor_multi_encode_minmax(1, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record), &(*input)._lwm2m_senml__record_count, (zcbor_encoder_t *)encode_record, state, (&(*input)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && zcbor_list_end_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record))))); - if (!tmp_result) { - zcbor_trace_file(state); + if (!tmp_result) + zcbor_trace(); diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h -index df2f0ac6a1..8fa1eedb2b 100644 +index b6c54afde5..cbc32e540c 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -21,11 +21,6 @@ +@@ -21,10 +21,6 @@ extern "C" { #endif @@ -134,36 +204,26 @@ index df2f0ac6a1..8fa1eedb2b 100644 -#error "The type file was generated with a different default_max_qty than this file" -#endif - -- + int cbor_encode_lwm2m_senml( - uint8_t *payload, size_t payload_len, - const struct lwm2m_senml *input, + uint8_t *payload, size_t payload_len, diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h -index 77649036ef..f0a2958072 100644 +index e12f33636e..f709086a5c 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 - * https://github.com/NordicSemiconductor/zcbor + * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ -@@ -20,14 +20,18 @@ +@@ -20,6 +20,18 @@ extern "C" { #endif --/** Which value for --default-max-qty this file was created with. -- * -- * The define is used in the other generated file to do a build-time -- * compatibility check. -- * -- * See `zcbor --help` for more information about --default-max-qty -- */ --#define DEFAULT_MAX_QTY 99 -+ +enum lwm2m_senml_cbor_key { + lwm2m_senml_cbor_key_bn = -2, + lwm2m_senml_cbor_key_bt = -3, @@ -175,15 +235,25 @@ index 77649036ef..f0a2958072 100644 + lwm2m_senml_cbor_key_vb = 4, + lwm2m_senml_cbor_key_vd = 8, +}; ++ + /** Which value for --default-max-qty this file was created with. + * + * The define is used in the other generated file to do a build-time +@@ -27,7 +39,7 @@ extern "C" { + * + * See `zcbor --help` for more information about --default-max-qty + */ +-#define DEFAULT_MAX_QTY 99 ++#define DEFAULT_MAX_QTY CONFIG_LWM2M_RW_SENML_CBOR_RECORDS struct record_bn { - struct zcbor_string record_bn; -@@ -118,7 +122,7 @@ struct record { + struct zcbor_string _record_bn; +@@ -118,7 +130,7 @@ struct record { }; struct lwm2m_senml { -- struct record lwm2m_senml_record_m[99]; -+ struct record lwm2m_senml_record_m[CONFIG_LWM2M_RW_SENML_CBOR_RECORDS]; - size_t lwm2m_senml_record_m_count; +- struct record _lwm2m_senml__record[99]; ++ struct record _lwm2m_senml__record[DEFAULT_MAX_QTY]; + size_t _lwm2m_senml__record_count; }; diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c index 3906d476cac..a75aee02120 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ @@ -14,32 +14,28 @@ #include #include "zcbor_decode.h" #include "lwm2m_senml_cbor_decode.h" -#include "zcbor_print.h" static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *result); static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *result); static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *result); static bool decode_repeated_record_t(zcbor_state_t *state, struct record_t *result); -static bool decode_repeated_record_union(zcbor_state_t *state, struct record_union_r *result); -static bool decode_value(zcbor_state_t *state, struct value_r *result); +static bool decode_repeated_record_union(zcbor_state_t *state, struct record_union_ *result); +static bool decode_value(zcbor_state_t *state, struct value_ *result); static bool decode_key_value_pair(zcbor_state_t *state, struct key_value_pair *result); -static bool decode_repeated_record_key_value_pair_m(zcbor_state_t *state, - struct record_key_value_pair_m *result); +static bool decode_repeated_record__key_value_pair(zcbor_state_t *state, + struct record__key_value_pair *result); static bool decode_record(zcbor_state_t *state, struct record *result); static bool decode_lwm2m_senml(zcbor_state_t *state, struct lwm2m_senml *result); static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = ((((zcbor_int32_expect(state, (-2)))) && - (zcbor_tstr_decode(state, (&(*result).record_bn))))); + (zcbor_tstr_decode(state, (&(*result)._record_bn))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -47,19 +43,16 @@ static bool decode_repeated_record_bn(zcbor_state_t *state, struct record_bn *re static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = ((((zcbor_int32_expect(state, (-3)))) && - (zcbor_int64_decode(state, (&(*result).record_bt))) && - ((((*result).record_bt >= INT64_MIN) && ((*result).record_bt <= INT64_MAX)) || + (zcbor_int64_decode(state, (&(*result)._record_bt))) && + ((((*result)._record_bt >= INT64_MIN) && ((*result)._record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -67,16 +60,13 @@ static bool decode_repeated_record_bt(zcbor_state_t *state, struct record_bt *re static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = ((((zcbor_uint32_expect(state, (0)))) && - (zcbor_tstr_decode(state, (&(*result).record_n))))); + (zcbor_tstr_decode(state, (&(*result)._record_n))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -84,94 +74,86 @@ static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *resu static bool decode_repeated_record_t(zcbor_state_t *state, struct record_t *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = ((((zcbor_uint32_expect(state, (6)))) && - (zcbor_int64_decode(state, (&(*result).record_t))) && - ((((*result).record_t >= INT64_MIN) && ((*result).record_t <= INT64_MAX)) || + (zcbor_int64_decode(state, (&(*result)._record_t))) && + ((((*result)._record_t >= INT64_MIN) && ((*result)._record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; } -static bool decode_repeated_record_union(zcbor_state_t *state, struct record_union_r *result) +static bool decode_repeated_record_union(zcbor_state_t *state, struct record_union_ *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); struct zcbor_string tmp_str; bool int_res; bool tmp_result = (((zcbor_union_start_code(state) && (int_res = (((((zcbor_uint32_expect_union(state, (2)))) && - (zcbor_int64_decode(state, (&(*result).union_vi))) && - ((((*result).union_vi >= INT64_MIN) && - ((*result).union_vi <= INT64_MAX)) || + (zcbor_int64_decode(state, (&(*result)._union_vi))) && + ((((*result)._union_vi >= INT64_MIN) && + ((*result)._union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && - (((*result).record_union_choice = union_vi_c), true)) || + (((*result)._record_union_choice = _union_vi), true)) || ((((zcbor_uint32_expect_union(state, (2)))) && - (zcbor_float_decode(state, (&(*result).union_vf)))) && - (((*result).record_union_choice = union_vf_c), true)) || + (zcbor_float_decode(state, (&(*result)._union_vf)))) && + (((*result)._record_union_choice = _union_vf), true)) || ((((zcbor_uint32_expect_union(state, (3)))) && - (zcbor_tstr_decode(state, (&(*result).union_vs)))) && - (((*result).record_union_choice = union_vs_c), true)) || + (zcbor_tstr_decode(state, (&(*result)._union_vs)))) && + (((*result)._record_union_choice = _union_vs), true)) || ((((zcbor_uint32_expect_union(state, (4)))) && - (zcbor_bool_decode(state, (&(*result).union_vb)))) && - (((*result).record_union_choice = union_vb_c), true)) || + (zcbor_bool_decode(state, (&(*result)._union_vb)))) && + (((*result)._record_union_choice = _union_vb), true)) || ((((zcbor_uint32_expect_union(state, (8)))) && - (zcbor_bstr_decode(state, (&(*result).union_vd)))) && - (((*result).record_union_choice = union_vd_c), true)) || + (zcbor_bstr_decode(state, (&(*result)._union_vd)))) && + (((*result)._record_union_choice = _union_vd), true)) || (zcbor_union_elem_code(state) && ((((zcbor_tstr_expect( state, ((tmp_str.value = (uint8_t *)"vlo", tmp_str.len = sizeof("vlo") - 1, &tmp_str))))) && - (zcbor_tstr_decode(state, (&(*result).union_vlo)))) && - (((*result).record_union_choice = union_vlo_c), true)))), + (zcbor_tstr_decode(state, (&(*result)._union_vlo)))) && + (((*result)._record_union_choice = _union_vlo), true)))), zcbor_union_end_code(state), int_res)))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; } -static bool decode_value(zcbor_state_t *state, struct value_r *result) +static bool decode_value(zcbor_state_t *state, struct value_ *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool int_res; - bool tmp_result = (((zcbor_union_start_code(state) && - (int_res = ((((zcbor_tstr_decode(state, (&(*result).value_tstr)))) && - (((*result).value_choice = value_tstr_c), true)) || - (((zcbor_bstr_decode(state, (&(*result).value_bstr)))) && - (((*result).value_choice = value_bstr_c), true)) || - (((zcbor_int64_decode(state, (&(*result).value_int))) && - ((((*result).value_int >= INT64_MIN) && - ((*result).value_int <= INT64_MAX)) || - (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && - (((*result).value_choice = value_int_c), true)) || - (((zcbor_float_decode(state, (&(*result).value_float)))) && - (((*result).value_choice = value_float_c), true)) || - (((zcbor_bool_decode(state, (&(*result).value_bool)))) && - (((*result).value_choice = value_bool_c), true))), - zcbor_union_end_code(state), int_res)))); + bool tmp_result = + (((zcbor_union_start_code(state) && + (int_res = ((((zcbor_tstr_decode(state, (&(*result)._value_tstr)))) && + (((*result)._value_choice = _value_tstr), true)) || + (((zcbor_bstr_decode(state, (&(*result)._value_bstr)))) && + (((*result)._value_choice = _value_bstr), true)) || + (((zcbor_int64_decode(state, (&(*result)._value_int))) && + ((((*result)._value_int >= INT64_MIN) && + ((*result)._value_int <= INT64_MAX)) || + (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) && + (((*result)._value_choice = _value_int), true)) || + (((zcbor_float_decode(state, (&(*result)._value_float)))) && + (((*result)._value_choice = _value_float), true)) || + (((zcbor_bool_decode(state, (&(*result)._value_bool)))) && + (((*result)._value_choice = _value_bool), true))), + zcbor_union_end_code(state), int_res)))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -179,33 +161,27 @@ static bool decode_value(zcbor_state_t *state, struct value_r *result) static bool decode_key_value_pair(zcbor_state_t *state, struct key_value_pair *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); - bool tmp_result = ((((zcbor_int32_decode(state, (&(*result).key_value_pair_key)))) && - (decode_value(state, (&(*result).key_value_pair))))); + bool tmp_result = ((((zcbor_int32_decode(state, (&(*result)._key_value_pair_key)))) && + (decode_value(state, (&(*result)._key_value_pair))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; } -static bool decode_repeated_record_key_value_pair_m(zcbor_state_t *state, - struct record_key_value_pair_m *result) +static bool decode_repeated_record__key_value_pair(zcbor_state_t *state, + struct record__key_value_pair *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); - bool tmp_result = (((decode_key_value_pair(state, (&(*result).record_key_value_pair_m))))); + bool tmp_result = (((decode_key_value_pair(state, (&(*result)._record__key_value_pair))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -213,38 +189,35 @@ static bool decode_repeated_record_key_value_pair_m(zcbor_state_t *state, static bool decode_record(zcbor_state_t *state, struct record *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = (((zcbor_map_start_decode(state) && - ((zcbor_present_decode(&((*result).record_bn_present), + ((zcbor_present_decode(&((*result)._record_bn_present), (zcbor_decoder_t *)decode_repeated_record_bn, state, - (&(*result).record_bn)) && - zcbor_present_decode(&((*result).record_bt_present), + (&(*result)._record_bn)) && + zcbor_present_decode(&((*result)._record_bt_present), (zcbor_decoder_t *)decode_repeated_record_bt, state, - (&(*result).record_bt)) && - zcbor_present_decode(&((*result).record_n_present), + (&(*result)._record_bt)) && + zcbor_present_decode(&((*result)._record_n_present), (zcbor_decoder_t *)decode_repeated_record_n, state, - (&(*result).record_n)) && - zcbor_present_decode(&((*result).record_t_present), + (&(*result)._record_n)) && + zcbor_present_decode(&((*result)._record_t_present), (zcbor_decoder_t *)decode_repeated_record_t, state, - (&(*result).record_t)) && - zcbor_present_decode(&((*result).record_union_present), + (&(*result)._record_t)) && + zcbor_present_decode(&((*result)._record_union_present), (zcbor_decoder_t *)decode_repeated_record_union, state, - (&(*result).record_union)) && - zcbor_multi_decode(0, ZCBOR_ARRAY_SIZE(result->record_key_value_pair_m), - &(*result).record_key_value_pair_m_count, - (zcbor_decoder_t *)decode_repeated_record_key_value_pair_m, - state, (&(*result).record_key_value_pair_m), - sizeof(struct record_key_value_pair_m))) || + (&(*result)._record_union)) && + zcbor_multi_decode(0, ZCBOR_ARRAY_SIZE(result->_record__key_value_pair), + &(*result)._record__key_value_pair_count, + (zcbor_decoder_t *)decode_repeated_record__key_value_pair, + state, (&(*result)._record__key_value_pair), + sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state)))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -252,22 +225,19 @@ static bool decode_record(zcbor_state_t *state, struct record *result) static bool decode_lwm2m_senml(zcbor_state_t *state, struct lwm2m_senml *result) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = (((zcbor_list_start_decode(state) && ((zcbor_multi_decode( - 1, ZCBOR_ARRAY_SIZE(result->lwm2m_senml_record_m), - &(*result).lwm2m_senml_record_m_count, (zcbor_decoder_t *)decode_record, - state, (&(*result).lwm2m_senml_record_m), sizeof(struct record))) || + 1, ZCBOR_ARRAY_SIZE(result->_lwm2m_senml__record), + &(*result)._lwm2m_senml__record_count, (zcbor_decoder_t *)decode_record, + state, (&(*result)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state)))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -278,7 +248,19 @@ int cbor_decode_lwm2m_senml(const uint8_t *payload, size_t payload_len, struct l { zcbor_state_t states[5]; - return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states, - (zcbor_decoder_t *)decode_lwm2m_senml, - sizeof(states) / sizeof(zcbor_state_t), 1); + zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 1); + + bool ret = decode_lwm2m_senml(states, result); + + if (ret && (payload_len_out != NULL)) { + *payload_len_out = MIN(payload_len, (size_t)states[0].payload - (size_t)payload); + } + + if (!ret) { + int err = zcbor_pop_error(states); + + zcbor_print("Return error: %d\r\n", err); + return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err; + } + return ZCBOR_SUCCESS; } diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h index b47b79de615..a8ae779b6a1 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_decode.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c index 9cf4f3457c6..74c9310941b 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ @@ -14,32 +14,28 @@ #include #include "zcbor_encode.h" #include "lwm2m_senml_cbor_encode.h" -#include "zcbor_print.h" static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_bn *input); static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_bt *input); static bool encode_repeated_record_n(zcbor_state_t *state, const struct record_n *input); static bool encode_repeated_record_t(zcbor_state_t *state, const struct record_t *input); -static bool encode_repeated_record_union(zcbor_state_t *state, const struct record_union_r *input); -static bool encode_value(zcbor_state_t *state, const struct value_r *input); +static bool encode_repeated_record_union(zcbor_state_t *state, const struct record_union_ *input); +static bool encode_value(zcbor_state_t *state, const struct value_ *input); static bool encode_key_value_pair(zcbor_state_t *state, const struct key_value_pair *input); -static bool encode_repeated_record_key_value_pair_m(zcbor_state_t *state, - const struct record_key_value_pair_m *input); +static bool encode_repeated_record__key_value_pair(zcbor_state_t *state, + const struct record__key_value_pair *input); static bool encode_record(zcbor_state_t *state, const struct record *input); static bool encode_lwm2m_senml(zcbor_state_t *state, const struct lwm2m_senml *input); static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_bn *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = ((((zcbor_int32_put(state, (-2)))) && - (zcbor_tstr_encode(state, (&(*input).record_bn))))); + (zcbor_tstr_encode(state, (&(*input)._record_bn))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -47,19 +43,16 @@ static bool encode_repeated_record_bn(zcbor_state_t *state, const struct record_ static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_bt *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = ((((zcbor_int32_put(state, (-3)))) && - ((((*input).record_bt >= INT64_MIN) && ((*input).record_bt <= INT64_MAX)) || + ((((*input)._record_bt >= INT64_MIN) && ((*input)._record_bt <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) && - (zcbor_int64_encode(state, (&(*input).record_bt))))); + (zcbor_int64_encode(state, (&(*input)._record_bt))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -67,16 +60,13 @@ static bool encode_repeated_record_bt(zcbor_state_t *state, const struct record_ static bool encode_repeated_record_n(zcbor_state_t *state, const struct record_n *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = ((((zcbor_uint32_put(state, (0)))) && - (zcbor_tstr_encode(state, (&(*input).record_n))))); + (zcbor_tstr_encode(state, (&(*input)._record_n))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -84,98 +74,81 @@ static bool encode_repeated_record_n(zcbor_state_t *state, const struct record_n static bool encode_repeated_record_t(zcbor_state_t *state, const struct record_t *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = ((((zcbor_uint32_put(state, (6)))) && - ((((*input).record_t >= INT64_MIN) && ((*input).record_t <= INT64_MAX)) || + ((((*input)._record_t >= INT64_MIN) && ((*input)._record_t <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) && - (zcbor_int64_encode(state, (&(*input).record_t))))); + (zcbor_int64_encode(state, (&(*input)._record_t))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; } -static bool encode_repeated_record_union(zcbor_state_t *state, const struct record_union_r *input) +static bool encode_repeated_record_union(zcbor_state_t *state, const struct record_union_ *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); struct zcbor_string tmp_str; bool tmp_result = ((( - ((*input).record_union_choice == union_vi_c) + ((*input)._record_union_choice == _union_vi) ? (((zcbor_uint32_put(state, (2)))) && - ((((*input).union_vi >= INT64_MIN) && - ((*input).union_vi <= INT64_MAX)) || + ((((*input)._union_vi >= INT64_MIN) && + ((*input)._union_vi <= INT64_MAX)) || (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) && - (zcbor_int64_encode(state, (&(*input).union_vi)))) - : (((*input).record_union_choice == union_vf_c) - ? (((zcbor_uint32_put(state, (2)))) && - (zcbor_float64_encode(state, (&(*input).union_vf)))) - : (((*input).record_union_choice == union_vs_c) - ? (((zcbor_uint32_put(state, (3)))) && - (zcbor_tstr_encode(state, (&(*input).union_vs)))) - : (((*input).record_union_choice == union_vb_c) - ? (((zcbor_uint32_put(state, (4)))) && - (zcbor_bool_encode(state, (&(*input).union_vb)))) - : (((*input).record_union_choice == union_vd_c) - ? (((zcbor_uint32_put(state, (8)))) && - (zcbor_bstr_encode(state, (&(*input).union_vd)))) - : (((*input).record_union_choice == union_vlo_c) - ? (((zcbor_tstr_encode( - state, - ((tmp_str.value = (uint8_t *)"vlo", - tmp_str.len = sizeof("vlo") - 1, - &tmp_str))))) && - (zcbor_tstr_encode( - state, - (&(*input).union_vlo)))) - : false)))))))); + (zcbor_int64_encode(state, (&(*input)._union_vi)))) + : (((*input)._record_union_choice == _union_vf) + ? (((zcbor_uint32_put(state, (2)))) && + (zcbor_float64_encode(state, (&(*input)._union_vf)))) + : (((*input)._record_union_choice == _union_vs) + ? (((zcbor_uint32_put(state, (3)))) && + (zcbor_tstr_encode(state, (&(*input)._union_vs)))) + : (((*input)._record_union_choice == _union_vb) + ? (((zcbor_uint32_put(state, (4)))) && + (zcbor_bool_encode(state, (&(*input)._union_vb)))) + : (((*input)._record_union_choice == _union_vd) + ? (((zcbor_uint32_put(state, (8)))) && + (zcbor_bstr_encode(state, (&(*input)._union_vd)))) + : (((*input)._record_union_choice == _union_vlo) + ? (((zcbor_tstr_encode(state, ((tmp_str.value = (uint8_t *)"vlo", + tmp_str.len = sizeof("vlo") - 1, + &tmp_str))))) && + (zcbor_tstr_encode(state, (&(*input)._union_vlo)))) + : false)))))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; } -static bool encode_value(zcbor_state_t *state, const struct value_r *input) +static bool encode_value(zcbor_state_t *state, const struct value_ *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = ((( - ((*input).value_choice == value_tstr_c) - ? ((zcbor_tstr_encode(state, (&(*input).value_tstr)))) - : (((*input).value_choice == value_bstr_c) - ? ((zcbor_bstr_encode(state, (&(*input).value_bstr)))) - : (((*input).value_choice == value_int_c) - ? (((((*input).value_int >= INT64_MIN) && - ((*input).value_int <= INT64_MAX)) || - (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), - false)) && - (zcbor_int64_encode(state, (&(*input).value_int)))) - : (((*input).value_choice == value_float_c) - ? ((zcbor_float64_encode( - state, (&(*input).value_float)))) - : (((*input).value_choice == value_bool_c) - ? ((zcbor_bool_encode( - state, - (&(*input).value_bool)))) - : false))))))); + ((*input)._value_choice == _value_tstr) + ? ((zcbor_tstr_encode(state, (&(*input)._value_tstr)))) + : (((*input)._value_choice == _value_bstr) + ? ((zcbor_bstr_encode(state, (&(*input)._value_bstr)))) + : (((*input)._value_choice == _value_int) + ? (((((*input)._value_int >= INT64_MIN) && + ((*input)._value_int <= INT64_MAX)) || + (zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) && + (zcbor_int64_encode(state, (&(*input)._value_int)))) + : (((*input)._value_choice == _value_float) + ? ((zcbor_float64_encode(state, (&(*input)._value_float)))) + : (((*input)._value_choice == _value_bool) + ? ((zcbor_bool_encode(state, (&(*input)._value_bool)))) + : false))))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -183,33 +156,27 @@ static bool encode_value(zcbor_state_t *state, const struct value_r *input) static bool encode_key_value_pair(zcbor_state_t *state, const struct key_value_pair *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); - bool tmp_result = ((((zcbor_int32_encode(state, (&(*input).key_value_pair_key)))) && - (encode_value(state, (&(*input).key_value_pair))))); + bool tmp_result = ((((zcbor_int32_encode(state, (&(*input)._key_value_pair_key)))) && + (encode_value(state, (&(*input)._key_value_pair))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; } -static bool encode_repeated_record_key_value_pair_m(zcbor_state_t *state, - const struct record_key_value_pair_m *input) +static bool encode_repeated_record__key_value_pair(zcbor_state_t *state, + const struct record__key_value_pair *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); - bool tmp_result = (((encode_key_value_pair(state, (&(*input).record_key_value_pair_m))))); + bool tmp_result = (((encode_key_value_pair(state, (&(*input)._record__key_value_pair))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -217,34 +184,36 @@ static bool encode_repeated_record_key_value_pair_m(zcbor_state_t *state, static bool encode_record(zcbor_state_t *state, const struct record *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = (( - (zcbor_map_start_encode(state, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m)) && - (((!(*input).record_bn_present || - encode_repeated_record_bn(state, (&(*input).record_bn))) && - (!(*input).record_bt_present || - encode_repeated_record_bt(state, (&(*input).record_bt))) && - (!(*input).record_n_present || - encode_repeated_record_n(state, (&(*input).record_n))) && - (!(*input).record_t_present || - encode_repeated_record_t(state, (&(*input).record_t))) && - (!(*input).record_union_present || - encode_repeated_record_union(state, (&(*input).record_union))) && + (zcbor_map_start_encode(state, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair)) && + ((zcbor_present_encode(&((*input)._record_bn_present), + (zcbor_encoder_t *)encode_repeated_record_bn, state, + (&(*input)._record_bn)) && + zcbor_present_encode(&((*input)._record_bt_present), + (zcbor_encoder_t *)encode_repeated_record_bt, state, + (&(*input)._record_bt)) && + zcbor_present_encode(&((*input)._record_n_present), + (zcbor_encoder_t *)encode_repeated_record_n, state, + (&(*input)._record_n)) && + zcbor_present_encode(&((*input)._record_t_present), + (zcbor_encoder_t *)encode_repeated_record_t, state, + (&(*input)._record_t)) && + zcbor_present_encode(&((*input)._record_union_present), + (zcbor_encoder_t *)encode_repeated_record_union, state, + (&(*input)._record_union)) && zcbor_multi_encode_minmax( - 0, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m), - &(*input).record_key_value_pair_m_count, - (zcbor_encoder_t *)encode_repeated_record_key_value_pair_m, state, - (&(*input).record_key_value_pair_m), - sizeof(struct record_key_value_pair_m))) || + 0, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair), + &(*input)._record__key_value_pair_count, + (zcbor_encoder_t *)encode_repeated_record__key_value_pair, state, + (&(*input)._record__key_value_pair), + sizeof(struct record__key_value_pair))) || (zcbor_list_map_end_force_encode(state), false)) && - zcbor_map_end_encode(state, ZCBOR_ARRAY_SIZE(input->record_key_value_pair_m))))); + zcbor_map_end_encode(state, ZCBOR_ARRAY_SIZE(input->_record__key_value_pair))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -252,22 +221,19 @@ static bool encode_record(zcbor_state_t *state, const struct record *input) static bool encode_lwm2m_senml(zcbor_state_t *state, const struct lwm2m_senml *input) { - zcbor_log("%s\r\n", __func__); + zcbor_print("%s\r\n", __func__); bool tmp_result = - (((zcbor_list_start_encode(state, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m)) && + (((zcbor_list_start_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record)) && ((zcbor_multi_encode_minmax( - 1, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m), - &(*input).lwm2m_senml_record_m_count, (zcbor_encoder_t *)encode_record, - state, (&(*input).lwm2m_senml_record_m), sizeof(struct record))) || + 1, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record), + &(*input)._lwm2m_senml__record_count, (zcbor_encoder_t *)encode_record, + state, (&(*input)._lwm2m_senml__record), sizeof(struct record))) || (zcbor_list_map_end_force_encode(state), false)) && - zcbor_list_end_encode(state, ZCBOR_ARRAY_SIZE(input->lwm2m_senml_record_m))))); + zcbor_list_end_encode(state, ZCBOR_ARRAY_SIZE(input->_lwm2m_senml__record))))); if (!tmp_result) { - zcbor_trace_file(state); - zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state))); - } else { - zcbor_log("%s success\r\n", __func__); + zcbor_trace(); } return tmp_result; @@ -278,7 +244,19 @@ int cbor_encode_lwm2m_senml(uint8_t *payload, size_t payload_len, const struct l { zcbor_state_t states[5]; - return zcbor_entry_function(payload, payload_len, (void *)input, payload_len_out, states, - (zcbor_decoder_t *)encode_lwm2m_senml, - sizeof(states) / sizeof(zcbor_state_t), 1); + zcbor_new_state(states, sizeof(states) / sizeof(zcbor_state_t), payload, payload_len, 1); + + bool ret = encode_lwm2m_senml(states, input); + + if (ret && (payload_len_out != NULL)) { + *payload_len_out = MIN(payload_len, (size_t)states[0].payload - (size_t)payload); + } + + if (!ret) { + int err = zcbor_pop_error(states); + + zcbor_print("Return error: %d\r\n", err); + return (err == ZCBOR_SUCCESS) ? ZCBOR_ERR_UNKNOWN : err; + } + return ZCBOR_SUCCESS; } diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h index 49ce5c55159..05d2664c2a0 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_encode.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ diff --git a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h index 4c41385ba4b..f1b86bb60b0 100644 --- a/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h +++ b/subsys/net/lib/lwm2m/lwm2m_senml_cbor_types.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 * - * Generated using zcbor version 0.8.0 + * Generated using zcbor version 0.7.0 * https://github.com/zephyrproject-rtos/zcbor * Generated with a --default-max-qty of 99 */ @@ -32,97 +32,115 @@ enum lwm2m_senml_cbor_key { lwm2m_senml_cbor_key_vd = 8, }; +/** Which value for --default-max-qty this file was created with. + * + * The define is used in the other generated file to do a build-time + * compatibility check. + * + * See `zcbor --help` for more information about --default-max-qty + */ +#define DEFAULT_MAX_QTY CONFIG_LWM2M_RW_SENML_CBOR_RECORDS + struct record_bn { - struct zcbor_string record_bn; + struct zcbor_string _record_bn; }; struct record_bt { - int64_t record_bt; + int64_t _record_bt; }; struct record_n { - struct zcbor_string record_n; + struct zcbor_string _record_n; }; struct record_t { - int64_t record_t; + int64_t _record_t; }; -struct record_union_r { +/* The union members and enum members have the same names. + * This is intentional so we need to ignore -Wshadow to avoid + * compiler complaining about them. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" + +struct record_union_ { union { struct { - int64_t union_vi; + int64_t _union_vi; }; struct { - double union_vf; + double _union_vf; }; struct { - struct zcbor_string union_vs; + struct zcbor_string _union_vs; }; struct { - bool union_vb; + bool _union_vb; }; struct { - struct zcbor_string union_vd; + struct zcbor_string _union_vd; }; struct { - struct zcbor_string union_vlo; + struct zcbor_string _union_vlo; }; }; enum { - union_vi_c, - union_vf_c, - union_vs_c, - union_vb_c, - union_vd_c, - union_vlo_c, - } record_union_choice; + _union_vi, + _union_vf, + _union_vs, + _union_vb, + _union_vd, + _union_vlo, + } _record_union_choice; }; -struct value_r { +struct value_ { union { - struct zcbor_string value_tstr; - struct zcbor_string value_bstr; - int64_t value_int; - double value_float; - bool value_bool; + struct zcbor_string _value_tstr; + struct zcbor_string _value_bstr; + int64_t _value_int; + double _value_float; + bool _value_bool; }; enum { - value_tstr_c, - value_bstr_c, - value_int_c, - value_float_c, - value_bool_c, - } value_choice; + _value_tstr, + _value_bstr, + _value_int, + _value_float, + _value_bool, + } _value_choice; }; +#pragma GCC diagnostic pop + struct key_value_pair { - int32_t key_value_pair_key; - struct value_r key_value_pair; + int32_t _key_value_pair_key; + struct value_ _key_value_pair; }; -struct record_key_value_pair_m { - struct key_value_pair record_key_value_pair_m; +struct record__key_value_pair { + struct key_value_pair _record__key_value_pair; }; struct record { - struct record_bn record_bn; - bool record_bn_present; - struct record_bt record_bt; - bool record_bt_present; - struct record_n record_n; - bool record_n_present; - struct record_t record_t; - bool record_t_present; - struct record_union_r record_union; - bool record_union_present; - struct record_key_value_pair_m record_key_value_pair_m[5]; - size_t record_key_value_pair_m_count; + struct record_bn _record_bn; + bool _record_bn_present; + struct record_bt _record_bt; + bool _record_bt_present; + struct record_n _record_n; + bool _record_n_present; + struct record_t _record_t; + bool _record_t_present; + struct record_union_ _record_union; + bool _record_union_present; + struct record__key_value_pair _record__key_value_pair[5]; + size_t _record__key_value_pair_count; }; struct lwm2m_senml { - struct record lwm2m_senml_record_m[CONFIG_LWM2M_RW_SENML_CBOR_RECORDS]; - size_t lwm2m_senml_record_m_count; + struct record _lwm2m_senml__record[DEFAULT_MAX_QTY]; + size_t _lwm2m_senml__record_count; }; #ifdef __cplusplus From 23edd0c3f704d4b72b3d3264548f2b57c45cbeea Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:39 +0100 Subject: [PATCH 0839/2300] Revert "[nrf fromtree] modules: zcbor: Add config CONFIG_ZCBOR_MAX_STR_LEN" This reverts commit c9adead115725cbf5246ac7ad0bb4a01a5bb751e. Signed-off-by: Robert Lubos --- modules/zcbor/Kconfig | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/zcbor/Kconfig b/modules/zcbor/Kconfig index 655fb2ed2a8..1b3fd15d5e3 100644 --- a/modules/zcbor/Kconfig +++ b/modules/zcbor/Kconfig @@ -33,11 +33,4 @@ config ZCBOR_ASSERT config ZCBOR_BIG_ENDIAN def_bool BIG_ENDIAN -config ZCBOR_MAX_STR_LEN - int "Default max length when calling zcbor_tstr_put_term()" - default 256 - help - This can be manually used if no other value is readily available, but - using this is discouraged. - endif # ZCBOR From b2dca275d883cad9f4a1d990172968858399596c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:40 +0100 Subject: [PATCH 0840/2300] Revert "[nrf fromtree] scripts: requirements-extra.txt: Update zcbor" This reverts commit e17704a05e5ec815839d5fbe3c19b708974e508a. Signed-off-by: Robert Lubos --- scripts/requirements-extras.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/requirements-extras.txt b/scripts/requirements-extras.txt index 99fa4f16cf4..f210f069de9 100644 --- a/scripts/requirements-extras.txt +++ b/scripts/requirements-extras.txt @@ -32,4 +32,4 @@ PyGithub graphviz # used to generate CBOR encoders and decoders, e.g. lwm2m_senml_cbor. -zcbor>=0.8.0 +zcbor>=0.6.0 From b836eef32b7a260a8d952ad9b7e7a3b23c86fd2b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:40 +0100 Subject: [PATCH 0841/2300] Revert "[nrf fromtree] west.yml: Update zcbor to 0.8.0" This reverts commit 48b1c47eb18490ef99f6a4e191390e0885fdc172. Signed-off-by: Robert Lubos --- west.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/west.yml b/west.yml index 22edd55964a..1c1e42f7325 100644 --- a/west.yml +++ b/west.yml @@ -282,7 +282,7 @@ manifest: groups: - crypto - name: mcuboot - revision: f09e205b1e4a8d2bc3f50dffa7960d6ccd14df59 + revision: 0c0470e294dcfb52aab92299356a5f3caa0aa52b path: bootloader/mcuboot - name: mipi-sys-t path: modules/debug/mipi-sys-t @@ -332,10 +332,10 @@ manifest: groups: - tee - name: uoscore-uedhoc - revision: 150f4eb2955eaf36ac0f9519d4f4f58d5ade5740 + revision: 5024d8c98b3864c6698f0195a53e19c484bc8cd3 path: modules/lib/uoscore-uedhoc - name: zcbor - revision: dbe20afd00b3ddd6956f4b47f5df202bb49a8707 + revision: 67fd8bb88d3136738661fa8bb5f9989103f4599e path: modules/lib/zcbor self: From 347dfe667b4562cb546b8bf9bf14a5a3fdec4646 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:40 +0100 Subject: [PATCH 0842/2300] Revert "[nrf fromtree] west.yml: Update uoscore-edhoc" This reverts commit 4ad91289b1da1e485404ef9fbf02992f1e22d22b. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 1c1e42f7325..417e33849e3 100644 --- a/west.yml +++ b/west.yml @@ -332,7 +332,7 @@ manifest: groups: - tee - name: uoscore-uedhoc - revision: 5024d8c98b3864c6698f0195a53e19c484bc8cd3 + revision: 5fe2cb613bd7e4590bd1b00c2adf181ac0229379 path: modules/lib/uoscore-uedhoc - name: zcbor revision: 67fd8bb88d3136738661fa8bb5f9989103f4599e From dc000d5b0dc62b86670fc1f285fa727b83bf3006 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:40 +0100 Subject: [PATCH 0843/2300] Revert "[nrf fromlist] samples: bluetooth: iso: Extend sample documentation" This reverts commit 05038fd841144545c89a2ceea928e7fecd66c122. Signed-off-by: Robert Lubos --- samples/bluetooth/central_iso/README.rst | 31 +++---------- samples/bluetooth/peripheral_iso/README.rst | 48 ++------------------- 2 files changed, 11 insertions(+), 68 deletions(-) diff --git a/samples/bluetooth/central_iso/README.rst b/samples/bluetooth/central_iso/README.rst index 13e6f56d778..4965ea96b3b 100644 --- a/samples/bluetooth/central_iso/README.rst +++ b/samples/bluetooth/central_iso/README.rst @@ -6,12 +6,12 @@ Bluetooth: Central ISO Overview ******** -This sample demonstrates how to use an isochronous channel as a central. -The sample scans for a peripheral, establishes a connection, and sets up a connected isochronous channel to it. -Once the isochronous channel is connected, isochronous data is transferred to the peer device every 10 milliseconds. -It is recommended to run this sample together with the :ref:`Bluetooth: Peripheral ISO ` sample. +Application demonstrating a connected isochronous channel functional as the +central role, by scanning for peripheral devices and establishing a connection +to the first one with a strong enough signal. +The application then attempts to setup a connected isochronous channel and +starts sending data. -To run the sample with an encrypted isochronous channel, enable :kconfig:option:`CONFIG_BT_SMP`. Requirements ************ @@ -19,28 +19,11 @@ Requirements * BlueZ running on the host, or * A board with Bluetooth Low Energy 5.2 support * A Bluetooth Controller and board that supports setting - :kconfig:option:`CONFIG_BT_CTLR_CENTRAL_ISO`. + CONFIG_BT_CTLR_CENTRAL_ISO=y Building and Running ******************** This sample can be found under :zephyr_file:`samples/bluetooth/central_iso` in the Zephyr tree. -1. Start the application. - In the terminal window, check that it is scanning for other devices. - - Bluetooth initialized - Scanning successfully started - Device found: D3:3A:5D:F5:73:33 (random) (RSSI -78) - Device found: 70:7B:F4:2B:76:AD (random) (RSSI -68) - Device found: 65:CF:20:0D:CB:9D (random) (RSSI -82) - -2. Observe that the device connects. - - Connected: 65:CF:20:0D:CB:9D (random) - -3. Observe that the ISO channel is connected - - ISO Channel 0x200048f8 connected - -See :ref:`bluetooth samples section ` for more details. +See :ref:`bluetooth samples section ` for details. diff --git a/samples/bluetooth/peripheral_iso/README.rst b/samples/bluetooth/peripheral_iso/README.rst index d877cf3a98f..4d5d8c1b576 100644 --- a/samples/bluetooth/peripheral_iso/README.rst +++ b/samples/bluetooth/peripheral_iso/README.rst @@ -6,10 +6,9 @@ Bluetooth: Peripheral ISO Overview ******** -This sample demonstrates how to use isochronous channels as a peripheral. -The sample starts advertising, waits for a central to connect to it and set up an isochronous channel. -Once the isochronous channel is set up, received isochronous data is printed out. -It is recommended to run this sample together with the :ref:`Bluetooth: Central ISO ` sample. +Similar to the :ref:`Peripheral ` sample, except that this application enables +support for connected isochronous (ISO) channels. + Requirements ************ @@ -24,43 +23,4 @@ Building and Running This sample can be found under :zephyr_file:`samples/bluetooth/peripheral_iso` in the Zephyr tree. -1. Start the application. - In the terminal window, check that it is advertising. - - Bluetooth initialized - Advertising successfully started - -2. Observe that the central device connects and sets up an isochronous channel. - - Connected E8:DC:8D:B3:47:69 (random) - Incoming request from 0x20002260 - ISO Channel 0x20000698 connected - -3. Observe that incoming data is printed. - - Incoming data channel 0x20000698 len 1 - 00 - Incoming data channel 0x20000698 len 2 - 0001 - Incoming data channel 0x20000698 len 3 - 000102 - Incoming data channel 0x20000698 len 4 - 00010203 - Incoming data channel 0x20000698 len 5 - 0001020304 - Incoming data channel 0x20000698 len 6 - 000102030405 - Incoming data channel 0x20000698 len 7 - 000102...040506 - Incoming data channel 0x20000698 len 8 - 000102...050607 - Incoming data channel 0x20000698 len 9 - 000102...060708 - Incoming data channel 0x20000698 len 10 - 000102...070809 - Incoming data channel 0x20000698 len 11 - 000102...08090a - Incoming data channel 0x20000698 len 12 - 000102...090a0b - -See :ref:`bluetooth samples section ` for more details. +See :ref:`bluetooth samples section ` for details. From 7ba5a5149641635539148e6ee9b4e1998bd6e2b2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:40 +0100 Subject: [PATCH 0844/2300] Revert "[nrf fromlist] samples: bluetooth: central_iso: Remove the CONFIG_BT_SMP=y" This reverts commit c87c561053fc7afb91568b5c9255efba9ff186c2. Signed-off-by: Robert Lubos --- samples/bluetooth/central_iso/prj.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/samples/bluetooth/central_iso/prj.conf b/samples/bluetooth/central_iso/prj.conf index 81264161a5c..ab5a202401f 100644 --- a/samples/bluetooth/central_iso/prj.conf +++ b/samples/bluetooth/central_iso/prj.conf @@ -1,3 +1,11 @@ CONFIG_BT=y CONFIG_LOG=y CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_SMP=y + +CONFIG_BT_KEYS_OVERWRITE_OLDEST=y +CONFIG_BT_SETTINGS=y +CONFIG_FLASH=y +CONFIG_FLASH_MAP=y +CONFIG_NVS=y +CONFIG_SETTINGS=y From 4eb9582bfa1437aa6879304e3326bc1fcc8f7207 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:41 +0100 Subject: [PATCH 0845/2300] Revert "[nrf fromlist] samples: Bluetooth: Only connect to devices with rssi below -50" This reverts commit fd85f70a2ee59ced961574b84f6dea1952dc4b72. Signed-off-by: Robert Lubos --- samples/bluetooth/central/src/main.c | 2 +- samples/bluetooth/central_gatt_write/src/central_gatt_write.c | 2 +- samples/bluetooth/central_iso/src/main.c | 2 +- samples/bluetooth/central_multilink/src/central_multilink.c | 2 +- samples/bluetooth/mtu_update/central/src/central_mtu_update.c | 2 +- samples/bluetooth/unicast_audio_client/src/main.c | 2 +- .../unicast_audio_client/tests_scripts/unicast_client.sh | 2 +- .../bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh | 2 +- tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh | 2 +- tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/bluetooth/central/src/main.c b/samples/bluetooth/central/src/main.c index e6305ea70b6..0c88f647539 100644 --- a/samples/bluetooth/central/src/main.c +++ b/samples/bluetooth/central/src/main.c @@ -43,7 +43,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -50) { + if (rssi < -70) { return; } diff --git a/samples/bluetooth/central_gatt_write/src/central_gatt_write.c b/samples/bluetooth/central_gatt_write/src/central_gatt_write.c index fada73d9d94..385877ec280 100644 --- a/samples/bluetooth/central_gatt_write/src/central_gatt_write.c +++ b/samples/bluetooth/central_gatt_write/src/central_gatt_write.c @@ -35,7 +35,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, } /* connect only to devices in close proximity */ - if (rssi < -50) { + if (rssi < -70) { return; } diff --git a/samples/bluetooth/central_iso/src/main.c b/samples/bluetooth/central_iso/src/main.c index 20c848cb121..a0062fcfa73 100644 --- a/samples/bluetooth/central_iso/src/main.c +++ b/samples/bluetooth/central_iso/src/main.c @@ -99,7 +99,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -50) { + if (rssi < -70) { return; } diff --git a/samples/bluetooth/central_multilink/src/central_multilink.c b/samples/bluetooth/central_multilink/src/central_multilink.c index 197021efe97..ea9afbb977c 100644 --- a/samples/bluetooth/central_multilink/src/central_multilink.c +++ b/samples/bluetooth/central_multilink/src/central_multilink.c @@ -70,7 +70,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -50) { + if (rssi < -70) { return; } diff --git a/samples/bluetooth/mtu_update/central/src/central_mtu_update.c b/samples/bluetooth/mtu_update/central/src/central_mtu_update.c index 9db4b507d3c..046446882dc 100644 --- a/samples/bluetooth/mtu_update/central/src/central_mtu_update.c +++ b/samples/bluetooth/mtu_update/central/src/central_mtu_update.c @@ -131,7 +131,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -50) { + if (rssi < -70) { return; } diff --git a/samples/bluetooth/unicast_audio_client/src/main.c b/samples/bluetooth/unicast_audio_client/src/main.c index 974d4f825f8..3953bee99f0 100644 --- a/samples/bluetooth/unicast_audio_client/src/main.c +++ b/samples/bluetooth/unicast_audio_client/src/main.c @@ -480,7 +480,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, printk("Device found: %s (RSSI %d)\n", addr_str, rssi); /* connect only to devices in close proximity */ - if (rssi < -50) { + if (rssi < -70) { return; } diff --git a/tests/bsim/bluetooth/audio_samples/unicast_audio_client/tests_scripts/unicast_client.sh b/tests/bsim/bluetooth/audio_samples/unicast_audio_client/tests_scripts/unicast_client.sh index 6387b68af7f..cc92cda1328 100755 --- a/tests/bsim/bluetooth/audio_samples/unicast_audio_client/tests_scripts/unicast_client.sh +++ b/tests/bsim/bluetooth/audio_samples/unicast_audio_client/tests_scripts/unicast_client.sh @@ -24,6 +24,6 @@ Execute ./bs_${BOARD}_tests_bsim_bluetooth_audio_samples_unicast_audio_client_pr -testid=unicast_client Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=20e6 $@ -argschannel -at=40 + -D=2 -sim_length=20e6 $@ wait_for_background_jobs #Wait for all programs in background and return != 0 if any fails diff --git a/tests/bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh b/tests/bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh index 255f6f4f9fa..087aa9385d4 100755 --- a/tests/bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh +++ b/tests/bsim/bluetooth/host/att/mtu_update/test_scripts/run_test.sh @@ -21,6 +21,6 @@ Execute "$peripheral_exe" \ -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -RealEncryption=1 Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=60e6 $@ -argschannel -at=40 + -D=2 -sim_length=60e6 $@ wait_for_background_jobs diff --git a/tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh b/tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh index cfbac8c313f..1bdd2874916 100755 --- a/tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh +++ b/tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh @@ -18,6 +18,6 @@ Execute ./bs_${BOARD}_tests_bsim_bluetooth_ll_multiple_id_prj_conf\ -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=4500e6 $@ -argschannel -at=40 + -D=2 -sim_length=4500e6 $@ wait_for_background_jobs 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 64a3dabac3b..df82f924fb8 100755 --- a/tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh +++ b/tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh @@ -17,6 +17,6 @@ Execute ./bs_${BOARD}_tests_bsim_bluetooth_ll_throughput_prj_conf\ -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=60e6 $@ -argschannel -at=40 + -D=2 -sim_length=60e6 $@ wait_for_background_jobs From b521af9bd828023c2ef0e3b8667c3972355083de Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:41 +0100 Subject: [PATCH 0846/2300] Revert "[nrf fromlist] drivers: modem_cellular: add nRF91 series (w/ SLM)" This reverts commit 5d4b1d296970c3bd05f84a4586a74b0a7f679382. Signed-off-by: Robert Lubos --- drivers/modem/Kconfig.cellular | 3 +- drivers/modem/modem_cellular.c | 67 ------------------- dts/bindings/modem/nordic,nrf91-slm.yaml | 9 --- .../boards/nrf9160dk_nrf9160_ns.conf | 16 ----- .../boards/nrf9160dk_nrf9160_ns.overlay | 34 ---------- tests/drivers/build_all/modem/uart.dtsi | 6 -- 6 files changed, 1 insertion(+), 134 deletions(-) delete mode 100644 dts/bindings/modem/nordic,nrf91-slm.yaml delete mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf delete mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index aacf4449d28..599a8a61138 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -15,8 +15,7 @@ config MODEM_CELLULAR depends on (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ DT_HAS_U_BLOX_SARA_R5_ENABLED || DT_HAS_SWIR_HL7800_ENABLED || \ - DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED || \ - DT_HAS_NORDIC_NRF91_SLM_ENABLED) + DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED) help This driver uses the generic 3gpp AT commands, along with the standard protocols CMUX and PPP, to configure diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index ed4e998fec3..63430d45c1a 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1933,41 +1933,6 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, modem_cellular_chat_callback_handler, 4); #endif -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf91_slm) -MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_init_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP_MULT("AT", allow_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT#XCMUX=1", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_init_chat_script, nordic_nrf91_slm_init_chat_script_cmds, - abort_matches, modem_cellular_chat_callback_handler, 10); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_dial_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT#XCMUX=2", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_dial_chat_script, nordic_nrf91_slm_dial_chat_script_cmds, - dial_abort_matches, modem_cellular_chat_callback_handler, 10); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_periodic_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, - nordic_nrf91_slm_periodic_chat_script_cmds, abort_matches, - modem_cellular_chat_callback_handler, 4); -#endif - #define MODEM_CELLULAR_INST_NAME(name, inst) \ _CONCAT(_CONCAT(_CONCAT(name, _), DT_DRV_COMPAT), inst) @@ -2204,34 +2169,6 @@ MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ &modem_cellular_api); -#define MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 1500); \ - \ - static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r\n", \ - .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ - }; \ - \ - static struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \ - .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ - .power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \ - .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_reset_gpios, {}), \ - .power_pulse_duration_ms = 100, \ - .reset_pulse_duration_ms = 100, \ - .startup_time_ms = 2000, \ - .shutdown_time_ms = 3000, \ - .init_chat_script = &nordic_nrf91_slm_init_chat_script, \ - .dial_chat_script = &nordic_nrf91_slm_dial_chat_script, \ - .periodic_chat_script = &nordic_nrf91_slm_periodic_chat_script, \ - }; \ - \ - PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ - \ - DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ - &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); - #define DT_DRV_COMPAT quectel_bg95 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_QUECTEL_BG95) #undef DT_DRV_COMPAT @@ -2263,7 +2200,3 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #define DT_DRV_COMPAT telit_me910g1 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) #undef DT_DRV_COMPAT - -#define DT_DRV_COMPAT nordic_nrf91_slm -DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM) -#undef DT_DRV_COMPAT diff --git a/dts/bindings/modem/nordic,nrf91-slm.yaml b/dts/bindings/modem/nordic,nrf91-slm.yaml deleted file mode 100644 index 3f06696197d..00000000000 --- a/dts/bindings/modem/nordic,nrf91-slm.yaml +++ /dev/null @@ -1,9 +0,0 @@ -description: Nordic nRF91 series running the Serial LTE Modem application - -compatible: "nordic,nrf91-slm" - -include: uart-device.yaml - -properties: - mdm-power-gpios: - type: phandle-array diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf deleted file mode 100644 index 441a5395ca1..00000000000 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf +++ /dev/null @@ -1,16 +0,0 @@ -CONFIG_UART_ASYNC_API=y - -# Align with the Serial LTE Modem (SLM) application. -CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE=1500 -CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=1500 - -# Allow large UART TXs to go through @115200. -CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS=200 - -# Prevent sockets getting offloaded to the modem. -CONFIG_NET_SOCKETS_OFFLOAD=n - -# Print logs and printk() output on uart0. -CONFIG_LOG=y -CONFIG_LOG_BACKEND_UART=y -CONFIG_MODEM_LOG_LEVEL_DBG=y diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay deleted file mode 100644 index 44ce80601a1..00000000000 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay +++ /dev/null @@ -1,34 +0,0 @@ -/ { - aliases { - modem = &modem; - }; -}; - -&uart1 { - compatible = "nordic,nrf-uarte"; - current-speed = <115200>; - hw-flow-control; - status = "okay"; - - pinctrl-0 = <&uart1_default_alt>; - - modem: modem { - compatible = "nordic,nrf91-slm"; - status = "okay"; - mdm-power-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; - }; -}; - -&pinctrl { - uart1_default_alt: uart1_default_alt { - group1 { - psels = ; - bias-pull-up; - }; - group2 { - psels = , - , - ; - }; - }; -}; diff --git a/tests/drivers/build_all/modem/uart.dtsi b/tests/drivers/build_all/modem/uart.dtsi index 08da2c325d3..3d649a2ff60 100644 --- a/tests/drivers/build_all/modem/uart.dtsi +++ b/tests/drivers/build_all/modem/uart.dtsi @@ -70,9 +70,3 @@ test_telit_me910g1: telit_me910g1 { test_esp_at: esp_at { compatible = "espressif,esp-at"; }; - -test_nordic_nrf91_slm: nordic_nrf91_slm { - compatible = "nordic,nrf91-slm"; - - mdm-power-gpios = <&test_gpio 0 0>; -}; From c57151fadf6f6eead810b75ab66ec626c5fe9b3b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:41 +0100 Subject: [PATCH 0847/2300] Revert "[nrf fromlist] drivers: modem_cellular: make the buffer sizes configurable" This reverts commit d2822f2f951966ef9042935ec75b094df853e6b6. Signed-off-by: Robert Lubos --- drivers/modem/Kconfig.cellular | 14 -------------- drivers/modem/modem_cellular.c | 15 +++++++-------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 599a8a61138..0460cda8d96 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -36,18 +36,4 @@ config MODEM_CELLULAR_PERIODIC_SCRIPT_MS int "Periodic script interval in milliseconds" default 2000 -config MODEM_CELLULAR_UART_BUFFER_SIZES - int "The UART receive and transmit buffer sizes in bytes." - default 512 - -config MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE - int "The maximum CMUX frame size in bytes." - default 128 - help - This value affects the size of buffers used to receive and transmit CMUX frames. - -config MODEM_CELLULAR_CHAT_BUFFER_SIZES - int "The size of the buffers used for the chat scripts in bytes." - default 128 - endif diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 63430d45c1a..35b05602a74 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -79,24 +79,23 @@ struct modem_cellular_data { /* UART backend */ struct modem_pipe *uart_pipe; struct modem_backend_uart uart_backend; - uint8_t uart_backend_receive_buf[CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES]; - uint8_t uart_backend_transmit_buf[CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES]; + uint8_t uart_backend_receive_buf[512]; + uint8_t uart_backend_transmit_buf[512]; /* CMUX */ struct modem_cmux cmux; - uint8_t cmux_receive_buf[CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; - uint8_t cmux_transmit_buf[2 * CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; + uint8_t cmux_receive_buf[128]; + uint8_t cmux_transmit_buf[256]; struct modem_cmux_dlci dlci1; struct modem_cmux_dlci dlci2; struct modem_pipe *dlci1_pipe; struct modem_pipe *dlci2_pipe; - uint8_t dlci1_receive_buf[CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; - /* DLCI 2 is only used for chat scripts. */ - uint8_t dlci2_receive_buf[CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES]; + uint8_t dlci1_receive_buf[128]; + uint8_t dlci2_receive_buf[256]; /* Modem chat */ struct modem_chat chat; - uint8_t chat_receive_buf[CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES]; + uint8_t chat_receive_buf[128]; uint8_t *chat_delimiter; uint8_t *chat_filter; uint8_t *chat_argv[32]; From 39fada231c1869643198c86323d93eb1671956f4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:41 +0100 Subject: [PATCH 0848/2300] Revert "[nrf fromlist] drivers: modem_cellular: allow variable length chat delimiter and filter" This reverts commit 4974702e2bcc03fd5a938b12d5bad628b4ab95b5. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 35b05602a74..f5e099cd08c 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -96,8 +96,8 @@ struct modem_cellular_data { /* Modem chat */ struct modem_chat chat; uint8_t chat_receive_buf[128]; - uint8_t *chat_delimiter; - uint8_t *chat_filter; + uint8_t chat_delimiter[1]; + uint8_t chat_filter[1]; uint8_t *chat_argv[32]; /* Status */ @@ -424,9 +424,9 @@ MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); MODEM_CHAT_MATCH_DEFINE(cesq_match, "+CESQ: ", ",", modem_cellular_chat_on_cesq); -MODEM_CHAT_MATCH_DEFINE(cimi_match __maybe_unused, "", "", modem_cellular_chat_on_imsi); -MODEM_CHAT_MATCH_DEFINE(cgmi_match __maybe_unused, "", "", modem_cellular_chat_on_cgmi); -MODEM_CHAT_MATCH_DEFINE(cgmr_match __maybe_unused, "", "", modem_cellular_chat_on_cgmr); +MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); +MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); +MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); MODEM_CHAT_MATCHES_DEFINE(unsol_matches, MODEM_CHAT_MATCH("+CREG: ", ",", modem_cellular_chat_on_cxreg), @@ -1513,9 +1513,9 @@ static int modem_cellular_init(const struct device *dev) .receive_buf = data->chat_receive_buf, .receive_buf_size = ARRAY_SIZE(data->chat_receive_buf), .delimiter = data->chat_delimiter, - .delimiter_size = strlen(data->chat_delimiter), + .delimiter_size = ARRAY_SIZE(data->chat_delimiter), .filter = data->chat_filter, - .filter_size = strlen(data->chat_filter), + .filter_size = ARRAY_SIZE(data->chat_filter), .argv = data->chat_argv, .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, @@ -1939,8 +1939,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -1968,8 +1968,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -1997,8 +1997,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2026,8 +2026,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2055,8 +2055,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2084,8 +2084,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2114,8 +2114,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2143,8 +2143,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ From 352bab9e7a710a9a4645fcfcdb66d1eac5cf95d8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:41 +0100 Subject: [PATCH 0849/2300] Revert "[nrf fromlist] modem: pipe: add warning to synchronous pipe open/close functions" This reverts commit 9bc3b8295d15e46e6139f93339ad8613eca48b2c. Signed-off-by: Robert Lubos --- include/zephyr/modem/pipe.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/zephyr/modem/pipe.h b/include/zephyr/modem/pipe.h index 60e877e44a3..70a37302273 100644 --- a/include/zephyr/modem/pipe.h +++ b/include/zephyr/modem/pipe.h @@ -98,10 +98,6 @@ void modem_pipe_init(struct modem_pipe *pipe, void *data, struct modem_pipe_api * * @retval 0 if pipe was successfully opened or was already open * @retval -errno code otherwise - * - * @warning Be cautious when using this synchronous version of the call. - * It may block the calling thread, which in the case of the system workqueue - * can result in a deadlock until this call times out waiting for the pipe to be open. */ int modem_pipe_open(struct modem_pipe *pipe); @@ -174,10 +170,6 @@ void modem_pipe_release(struct modem_pipe *pipe); * * @retval 0 if pipe open was called closed or pipe was already closed * @retval -errno code otherwise - * - * @warning Be cautious when using this synchronous version of the call. - * It may block the calling thread, which in the case of the system workqueue - * can result in a deadlock until this call times out waiting for the pipe to be closed. */ int modem_pipe_close(struct modem_pipe *pipe); From 02f45a8dcc8915867b0b6bc71d34dbc3b95aaa92 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:42 +0100 Subject: [PATCH 0850/2300] Revert "[nrf fromlist] modem: chat: fix init assert" This reverts commit 869e3ec68265cf28170f8ca7ac916a9d63a5053f. Signed-off-by: Robert Lubos --- subsys/modem/modem_chat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index c689ff2e0ab..b2d63b05e9e 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -708,7 +708,7 @@ int modem_chat_init(struct modem_chat *chat, const struct modem_chat_config *con __ASSERT_NO_MSG(config->argv_size > 0); __ASSERT_NO_MSG(config->delimiter != NULL); __ASSERT_NO_MSG(config->delimiter_size > 0); - __ASSERT_NO_MSG(!((config->filter == NULL) && (config->filter_size > 0))); + __ASSERT_NO_MSG(!((config->filter == NULL) && (config->filter > 0))); __ASSERT_NO_MSG(!((config->unsol_matches == NULL) && (config->unsol_matches_size > 0))); memset(chat, 0x00, sizeof(*chat)); From aa8ec1019b215a1e6bc9d04f1b2f7286aa3266e7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:42 +0100 Subject: [PATCH 0851/2300] Revert "[nrf fromlist] modem: cmux: improve handling of receive buffer overrun" This reverts commit 872b195fb56cdadf2360dda2bc8e2ddffab50694. Signed-off-by: Robert Lubos --- subsys/modem/modem_cmux.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 67190934c45..6f9f10c04a6 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -221,7 +221,7 @@ static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, uint16_t buf_idx; space = ring_buf_space_get(&cmux->transmit_rb) - MODEM_CMUX_FRAME_SIZE_MAX; - data_len = MIN(space, frame->data_len); + data_len = (space < frame->data_len) ? space : frame->data_len; /* SOF */ buf[0] = 0xF9; @@ -746,27 +746,28 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by case MODEM_CMUX_RECEIVE_STATE_DATA: /* Copy byte to data */ - if (cmux->receive_buf_len < cmux->receive_buf_size) { - cmux->receive_buf[cmux->receive_buf_len] = byte; - } + cmux->receive_buf[cmux->receive_buf_len] = byte; cmux->receive_buf_len++; /* Check if datalen reached */ if (cmux->frame.data_len == cmux->receive_buf_len) { /* Await FCS */ cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_FCS; + break; } - break; + /* Check if receive buffer overrun */ + if (cmux->receive_buf_len == cmux->receive_buf_size) { + LOG_WRN("Receive buf overrun"); - case MODEM_CMUX_RECEIVE_STATE_FCS: - if (cmux->receive_buf_len > cmux->receive_buf_size) { - LOG_WRN("Receive buffer overrun (%u > %u)", - cmux->receive_buf_len, cmux->receive_buf_size); - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_DROP; + /* Drop frame */ + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_EOF; break; } + break; + + case MODEM_CMUX_RECEIVE_STATE_FCS: /* Compute FCS */ if (cmux->frame.type == MODEM_CMUX_FRAME_TYPE_UIH) { fcs = 0xFF - crc8(cmux->frame_header, cmux->frame_header_len, From b192d79604348727517aa386fe1164a5583fb4ac Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:42 +0100 Subject: [PATCH 0852/2300] Revert "[nrf fromlist] modem: backend: uart_async: improve logging on UART_TX_ABORTED" This reverts commit f0b9e3368ade6b8b16c1ee485f86065d91ae329c. Signed-off-by: Robert Lubos --- .../modem/backends/modem_backend_uart_async.c | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 0fa3684780e..6bfd3eb5f15 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -12,15 +12,12 @@ LOG_MODULE_DECLARE(modem_backend_uart, CONFIG_MODEM_MODULES_LOG_LEVEL); #include #include -enum { - MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT, - MODEM_BACKEND_UART_ASYNC_STATE_RECEIVING_BIT, - MODEM_BACKEND_UART_ASYNC_STATE_RX_BUF0_USED_BIT, - MODEM_BACKEND_UART_ASYNC_STATE_RX_BUF1_USED_BIT, - MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT, -}; +#define MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT (0) +#define MODEM_BACKEND_UART_ASYNC_STATE_RECEIVING_BIT (1) +#define MODEM_BACKEND_UART_ASYNC_STATE_RX_BUF0_USED_BIT (2) +#define MODEM_BACKEND_UART_ASYNC_STATE_RX_BUF1_USED_BIT (3) -static bool modem_backend_uart_async_is_uart_stopped(struct modem_backend_uart *backend) +static bool modem_backend_uart_async_is_closed(struct modem_backend_uart *backend) { if (!atomic_test_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT) && @@ -36,12 +33,6 @@ static bool modem_backend_uart_async_is_uart_stopped(struct modem_backend_uart * return false; } -static bool modem_backend_uart_async_is_open(struct modem_backend_uart *backend) -{ - return atomic_test_bit(&backend->async.state, - MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); -} - static void modem_backend_uart_async_event_handler(const struct device *dev, struct uart_event *evt, void *user_data) { @@ -58,9 +49,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, break; case UART_TX_ABORTED: - if (modem_backend_uart_async_is_open(backend)) { - LOG_WRN("Transmit aborted (%zu sent)", evt->data.tx.len); - } + LOG_WRN("Transmit aborted"); atomic_clear_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT); k_work_submit(&backend->transmit_idle_work); @@ -136,7 +125,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, break; } - if (modem_backend_uart_async_is_uart_stopped(backend)) { + if (modem_backend_uart_async_is_closed(backend)) { k_work_submit(&backend->async.rx_disabled_work); } } @@ -167,8 +156,6 @@ static int modem_backend_uart_async_open(void *data) atomic_set_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_RECEIVING_BIT); - atomic_set_bit(&backend->async.state, - MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); modem_pipe_notify_opened(&backend->pipe); return 0; @@ -231,7 +218,6 @@ static int modem_backend_uart_async_close(void *data) { struct modem_backend_uart *backend = (struct modem_backend_uart *)data; - atomic_clear_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_OPEN_BIT); uart_tx_abort(backend->uart); uart_rx_disable(backend->uart); return 0; From b0284c29ca77cce25842eaa7a5ff43d3ffaae163 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:43 +0100 Subject: [PATCH 0853/2300] Revert "[nrf fromlist] modem: ppp: fix receiving of successive frames when one 0x7E is omitted" This reverts commit ca3e68ec22fb62428c42ab539ba821b6086c4611. Signed-off-by: Robert Lubos --- subsys/modem/modem_ppp.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/subsys/modem/modem_ppp.c b/subsys/modem/modem_ppp.c index 91085317d99..dffa4f68dbf 100644 --- a/subsys/modem/modem_ppp.c +++ b/subsys/modem/modem_ppp.c @@ -192,45 +192,40 @@ static uint8_t modem_ppp_wrap_net_pkt_byte(struct modem_ppp *ppp) return 0; } -static bool modem_ppp_is_byte_expected(uint8_t byte, uint8_t expected_byte) -{ - if (byte == expected_byte) { - return true; - } - LOG_DBG("Dropping byte 0x%02hhx because 0x%02hhx was expected.", byte, expected_byte); - return false; -} - static void modem_ppp_process_received_byte(struct modem_ppp *ppp, uint8_t byte) { switch (ppp->receive_state) { case MODEM_PPP_RECEIVE_STATE_HDR_SOF: - if (modem_ppp_is_byte_expected(byte, MODEM_PPP_CODE_DELIMITER)) { + if (byte == MODEM_PPP_CODE_DELIMITER) { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_FF; } + break; case MODEM_PPP_RECEIVE_STATE_HDR_FF: if (byte == MODEM_PPP_CODE_DELIMITER) { break; } - if (modem_ppp_is_byte_expected(byte, 0xFF)) { + + if (byte == 0xFF) { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_7D; } else { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_SOF; } + break; case MODEM_PPP_RECEIVE_STATE_HDR_7D: - if (modem_ppp_is_byte_expected(byte, MODEM_PPP_CODE_ESCAPE)) { + if (byte == MODEM_PPP_CODE_ESCAPE) { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_23; } else { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_SOF; } + break; case MODEM_PPP_RECEIVE_STATE_HDR_23: - if (modem_ppp_is_byte_expected(byte, 0x23)) { + if (byte == 0x23) { ppp->rx_pkt = net_pkt_rx_alloc_with_buffer(ppp->iface, CONFIG_MODEM_PPP_NET_BUF_FRAG_SIZE, AF_UNSPEC, 0, K_NO_WAIT); @@ -243,6 +238,7 @@ static void modem_ppp_process_received_byte(struct modem_ppp *ppp, uint8_t byte) LOG_DBG("Receiving PPP frame"); ppp->receive_state = MODEM_PPP_RECEIVE_STATE_WRITING; net_pkt_cursor_init(ppp->rx_pkt); + } else { ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_SOF; } @@ -251,10 +247,11 @@ static void modem_ppp_process_received_byte(struct modem_ppp *ppp, uint8_t byte) case MODEM_PPP_RECEIVE_STATE_WRITING: if (byte == MODEM_PPP_CODE_DELIMITER) { - LOG_DBG("Received PPP frame (len %zu)", net_pkt_get_len(ppp->rx_pkt)); + LOG_DBG("Received PPP frame"); /* Remove FCS */ net_pkt_remove_tail(ppp->rx_pkt, MODEM_PPP_FRAME_TAIL_SIZE); + net_pkt_cursor_init(ppp->rx_pkt); net_pkt_set_ppp(ppp->rx_pkt, true); if (net_recv_data(ppp->iface, ppp->rx_pkt) < 0) { @@ -263,8 +260,7 @@ static void modem_ppp_process_received_byte(struct modem_ppp *ppp, uint8_t byte) } ppp->rx_pkt = NULL; - /* Skip SOF because the delimiter may be omitted for successive frames. */ - ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_FF; + ppp->receive_state = MODEM_PPP_RECEIVE_STATE_HDR_SOF; break; } From 93696fd06dd4db60d3741f652aa1636f01bcb13c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:43 +0100 Subject: [PATCH 0854/2300] Revert "[nrf fromlist] modem: ppp: fix crash when attaching to a pipe" This reverts commit 83ed9b883c2113d8c3c1c27e7853da7ef2da3a61. Signed-off-by: Robert Lubos --- subsys/modem/modem_ppp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/subsys/modem/modem_ppp.c b/subsys/modem/modem_ppp.c index dffa4f68dbf..1d47542f24a 100644 --- a/subsys/modem/modem_ppp.c +++ b/subsys/modem/modem_ppp.c @@ -319,7 +319,6 @@ static void modem_ppp_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_eve k_work_submit(&ppp->process_work); break; - case MODEM_PIPE_EVENT_OPENED: case MODEM_PIPE_EVENT_TRANSMIT_IDLE: k_work_submit(&ppp->send_work); break; @@ -468,14 +467,12 @@ const struct ppp_api modem_ppp_ppp_api = { int modem_ppp_attach(struct modem_ppp *ppp, struct modem_pipe *pipe) { - if (atomic_test_bit(&ppp->state, MODEM_PPP_STATE_ATTACHED_BIT) == true) { + if (atomic_test_and_set_bit(&ppp->state, MODEM_PPP_STATE_ATTACHED_BIT) == true) { return 0; } - ppp->pipe = pipe; modem_pipe_attach(pipe, modem_ppp_pipe_callback, ppp); - - atomic_set_bit(&ppp->state, MODEM_PPP_STATE_ATTACHED_BIT); + ppp->pipe = pipe; return 0; } From 8d292ff2862aec4a2d52aeae17986650a2769942 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:43 +0100 Subject: [PATCH 0855/2300] Revert "[nrf fromlist] modem: backends: use CONFIG_MODEM_MODULES_LOG_LEVEL" This reverts commit 5ef64362bb7a9003b01f1cd9d753b38871b9437f. Signed-off-by: Robert Lubos --- subsys/modem/backends/modem_backend_tty.c | 2 +- subsys/modem/backends/modem_backend_uart.c | 2 +- subsys/modem/backends/modem_backend_uart_async.c | 2 +- subsys/modem/backends/modem_backend_uart_isr.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/modem/backends/modem_backend_tty.c b/subsys/modem/backends/modem_backend_tty.c index e511150ae9d..8375183be48 100644 --- a/subsys/modem/backends/modem_backend_tty.c +++ b/subsys/modem/backends/modem_backend_tty.c @@ -7,7 +7,7 @@ #include #include -LOG_MODULE_REGISTER(modem_backend_tty, CONFIG_MODEM_MODULES_LOG_LEVEL); +LOG_MODULE_REGISTER(modem_backend_tty); #include #include diff --git a/subsys/modem/backends/modem_backend_uart.c b/subsys/modem/backends/modem_backend_uart.c index b77a7331899..a8348b0b8a0 100644 --- a/subsys/modem/backends/modem_backend_uart.c +++ b/subsys/modem/backends/modem_backend_uart.c @@ -10,7 +10,7 @@ #include #include -LOG_MODULE_REGISTER(modem_backend_uart, CONFIG_MODEM_MODULES_LOG_LEVEL); +LOG_MODULE_REGISTER(modem_backend_uart); #include diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 6bfd3eb5f15..317eb945a5a 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -7,7 +7,7 @@ #include "modem_backend_uart_async.h" #include -LOG_MODULE_DECLARE(modem_backend_uart, CONFIG_MODEM_MODULES_LOG_LEVEL); +LOG_MODULE_DECLARE(modem_backend_uart); #include #include diff --git a/subsys/modem/backends/modem_backend_uart_isr.c b/subsys/modem/backends/modem_backend_uart_isr.c index 9eed7913496..8a7075e3519 100644 --- a/subsys/modem/backends/modem_backend_uart_isr.c +++ b/subsys/modem/backends/modem_backend_uart_isr.c @@ -7,7 +7,7 @@ #include "modem_backend_uart_isr.h" #include -LOG_MODULE_DECLARE(modem_backend_uart, CONFIG_MODEM_MODULES_LOG_LEVEL); +LOG_MODULE_DECLARE(modem_backend_uart); #include From c351d113e0ed34afb4880a3063943ff9f6e3729d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:43 +0100 Subject: [PATCH 0856/2300] Revert "[nrf fromlist] modem: small improvements" This reverts commit 291a41f6011ed51845c4515669fa2f49c05d4a24. Signed-off-by: Robert Lubos --- include/zephyr/modem/pipe.h | 20 +++++++-------- .../modem/backends/modem_backend_uart_async.c | 5 ++-- subsys/modem/modem_cmux.c | 25 +++++++------------ 3 files changed, 20 insertions(+), 30 deletions(-) diff --git a/include/zephyr/modem/pipe.h b/include/zephyr/modem/pipe.h index 70a37302273..a741a94a34c 100644 --- a/include/zephyr/modem/pipe.h +++ b/include/zephyr/modem/pipe.h @@ -130,27 +130,25 @@ void modem_pipe_attach(struct modem_pipe *pipe, modem_pipe_api_callback callback * @brief Transmit data through pipe * * @param pipe Pipe to transmit through - * @param buf Data to transmit - * @param size Number of bytes to transmit + * @param buf Destination for reveived data + * @param size Capacity of destination for recevied data * - * @retval Number of bytes placed in pipe - * @retval -EPERM if pipe is closed - * @retval -errno code on error + * @return Number of bytes placed in pipe * * @warning This call must be non-blocking */ int modem_pipe_transmit(struct modem_pipe *pipe, const uint8_t *buf, size_t size); /** - * @brief Receive data through pipe + * @brief Reveive data through pipe * * @param pipe Pipe to receive from - * @param buf Destination for received data; must not be already in use in a modem module. - * @param size Capacity of destination for received data + * @param buf Destination for reveived data + * @param size Capacity of destination for recevied data * - * @retval Number of bytes received from pipe - * @retval -EPERM if pipe is closed - * @retval -errno code on error + * @return Number of bytes received from pipe if any + * @return -EPERM if pipe is closed + * @return -errno code on error * * @warning This call must be non-blocking */ diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 317eb945a5a..63d5a219a72 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -186,9 +186,8 @@ static int modem_backend_uart_async_transmit(void *data, const uint8_t *buf, siz ret = uart_tx(backend->uart, backend->async.transmit_buf, bytes_to_transmit, CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS * 1000L); - if (ret != 0) { - LOG_ERR("Failed to %s %u bytes. (%d)", - "start async transmit for", bytes_to_transmit, ret); + if (ret < 0) { + LOG_WRN("Failed to start async transmit"); return ret; } diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 6f9f10c04a6..16dc60b7219 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -564,8 +564,7 @@ static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) written = ring_buf_put(&dlci->receive_rb, cmux->frame.data, cmux->frame.data_len); k_mutex_unlock(&dlci->receive_rb_lock); if (written != cmux->frame.data_len) { - LOG_WRN("DLCI %u receive buffer overrun (dropped %u out of %u bytes)", - dlci->dlci_address, cmux->frame.data_len - written, cmux->frame.data_len); + LOG_WRN("DLCI %u receive buffer overrun", dlci->dlci_address); } modem_pipe_notify_receive_ready(&dlci->pipe); } @@ -607,15 +606,16 @@ static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) { struct modem_cmux_dlci *dlci; - modem_cmux_log_received_frame(&cmux->frame); - dlci = modem_cmux_find_dlci(cmux); + if (dlci == NULL) { - LOG_WRN("Ignoring frame intended for unconfigured DLCI %u.", - cmux->frame.dlci_address); + LOG_WRN("Could not find DLCI: %u", cmux->frame.dlci_address); + return; } + modem_cmux_log_received_frame(&cmux->frame); + switch (cmux->frame.type) { case MODEM_CMUX_FRAME_TYPE_UA: modem_cmux_on_dlci_frame_ua(dlci); @@ -643,9 +643,10 @@ static void modem_cmux_on_frame(struct modem_cmux *cmux) { if (cmux->frame.dlci_address == 0) { modem_cmux_on_control_frame(cmux); - } else { - modem_cmux_on_dlci_frame(cmux); + return; } + + modem_cmux_on_dlci_frame(cmux); } static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t byte) @@ -829,9 +830,6 @@ static void modem_cmux_receive_handler(struct k_work *item) /* Receive data from pipe */ ret = modem_pipe_receive(cmux->pipe, buf, sizeof(buf)); if (ret < 1) { - if (ret < 0) { - LOG_ERR("Pipe receiving error: %d", ret); - } return; } @@ -878,17 +876,12 @@ static void modem_cmux_transmit_handler(struct k_work *item) ret = modem_pipe_transmit(cmux->pipe, reserved, reserved_size); if (ret < 0) { ring_buf_get_finish(&cmux->transmit_rb, 0); - if (ret != -EPERM) { - LOG_ERR("Failed to %s %u bytes. (%d)", - "transmit", reserved_size, ret); - } break; } ring_buf_get_finish(&cmux->transmit_rb, (uint32_t)ret); if (ret < reserved_size) { - LOG_DBG("Transmitted only %u out of %u bytes at once.", ret, reserved_size); break; } } From 67cdf9adcc661e81ee331ea6b4e4c12688d1f1e2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:43 +0100 Subject: [PATCH 0857/2300] Revert "[nrf fromtree] modem: modem_cellular: CID 338067" This reverts commit 562cc0177d92a3618c71501214ae94f91001bd73. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index f5e099cd08c..36596c6447e 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -370,7 +370,7 @@ static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, ui { struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; - strncpy(data->imsi, argv[1], sizeof(data->imsi) - 1); + strncpy(data->imsi, (char *)argv[1], sizeof(data->imsi)); } static bool modem_cellular_is_registered(struct modem_cellular_data *data) From 53b60116fa47074cc9bbe09ccc7ea676b80ae2f7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:44 +0100 Subject: [PATCH 0858/2300] Revert "[nrf fromtree] modem: modem_cellular: CID 338073" This reverts commit 710a0c8998004460f13ffff8fbd5f850b8fb7e09. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 36596c6447e..6ef6d125ea9 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -301,7 +301,7 @@ static void modem_cellular_chat_on_imei(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->imei, argv[1], sizeof(data->imei) - 1); + strncpy(data->imei, argv[1], sizeof(data->imei)); } static void modem_cellular_chat_on_cgmm(struct modem_chat *chat, char **argv, uint16_t argc, From 6f5fb1e612b9de1daf93376b64fdf533d8b05f28 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:44 +0100 Subject: [PATCH 0859/2300] Revert "[nrf fromtree] modem: modem_cellular: CID 338115" This reverts commit 478f0d19ff5930779035b1dbf9dc9583d7da4f42. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 6ef6d125ea9..c3912c119c3 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -313,7 +313,7 @@ static void modem_cellular_chat_on_cgmm(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->model_id, argv[1], sizeof(data->model_id) - 1); + strncpy(data->model_id, argv[1], sizeof(data->model_id)); } static void modem_cellular_chat_on_cgmi(struct modem_chat *chat, char **argv, uint16_t argc, From ce4913f2931ed2d657f424eb071f07beef2588de Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:44 +0100 Subject: [PATCH 0860/2300] Revert "[nrf fromtree] modem: modem_cellular: CID 338140" This reverts commit aa9fe5ba2885c649babf062ce4103b4647c5232b. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index c3912c119c3..217f2b3ff2d 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -325,7 +325,7 @@ static void modem_cellular_chat_on_cgmi(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->manufacturer, argv[1], sizeof(data->manufacturer) - 1); + strncpy(data->manufacturer, argv[1], sizeof(data->manufacturer)); } static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, uint16_t argc, From 20a58d894222b91b2540e4ea4884fbc799238a83 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:44 +0100 Subject: [PATCH 0861/2300] Revert "[nrf fromtree] modem: modem_cellular: CID 338164" This reverts commit b05aac4d00caf876d2378ec7c417135bddbd65cf. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 217f2b3ff2d..996a1e838c4 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -337,7 +337,7 @@ static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->fw_version, argv[1], sizeof(data->fw_version) - 1); + strncpy(data->fw_version, argv[1], sizeof(data->fw_version)); } static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uint16_t argc, From 0a4975ee12067b946f483c9adf2408289262efa3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:45 +0100 Subject: [PATCH 0862/2300] Revert "[nrf fromtree] modem: change log level of events prints to debug" This reverts commit 1561f544e4e97598c5727409aa838f1bd0a62d3f. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 996a1e838c4..8aca855f55b 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -445,13 +445,13 @@ MODEM_CHAT_MATCHES_DEFINE(dial_abort_matches, static void modem_cellular_log_state_changed(enum modem_cellular_state last_state, enum modem_cellular_state new_state) { - LOG_DBG("switch from %s to %s", modem_cellular_state_str(last_state), + LOG_INF("switch from %s to %s", modem_cellular_state_str(last_state), modem_cellular_state_str(new_state)); } static void modem_cellular_log_event(enum modem_cellular_event evt) { - LOG_DBG("event %s", modem_cellular_event_str(evt)); + LOG_INF("event %s", modem_cellular_event_str(evt)); } static void modem_cellular_start_timer(struct modem_cellular_data *data, k_timeout_t timeout) From b56393f2e4ccb249b8a76e9bc956ec016d0a63ba Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:45 +0100 Subject: [PATCH 0863/2300] Revert "[nrf fromtree] tests: build_all: modem: test compilation with connectivity" This reverts commit cc0433b81c54c58c658187f0d9b5eb0f180d80c0. Signed-off-by: Robert Lubos --- tests/drivers/build_all/modem/modem_esp_at.conf | 2 -- tests/drivers/build_all/modem/src/main.c | 12 ------------ 2 files changed, 14 deletions(-) diff --git a/tests/drivers/build_all/modem/modem_esp_at.conf b/tests/drivers/build_all/modem/modem_esp_at.conf index e24bee337af..6ba79c82653 100644 --- a/tests/drivers/build_all/modem/modem_esp_at.conf +++ b/tests/drivers/build_all/modem/modem_esp_at.conf @@ -5,5 +5,3 @@ CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y CONFIG_NET_IPV4=y CONFIG_WIFI=y -CONFIG_NET_CONNECTION_MANAGER=y -CONFIG_NET_CONNECTION_MANAGER_CONNECTIVITY_WIFI_MGMT=y diff --git a/tests/drivers/build_all/modem/src/main.c b/tests/drivers/build_all/modem/src/main.c index 527f64e3f1e..90b910a7799 100644 --- a/tests/drivers/build_all/modem/src/main.c +++ b/tests/drivers/build_all/modem/src/main.c @@ -8,15 +8,3 @@ int main(void) { return 0; } - -#ifdef CONFIG_CONNECTIVITY_WIFI_MGMT_APPLICATION - -#include -#include - -/* Bind L2 connectity APIs. */ -static struct conn_mgr_conn_api conn_api = { 0 }; - -CONN_MGR_CONN_DEFINE(CONNECTIVITY_WIFI_MGMT, &conn_api); - -#endif /* CONFIG_CONNECTIVITY_WIFI_MGMT_APPLICATION */ From db71c28ea7ae4665cff54d6de7362b7381ccf36f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:45 +0100 Subject: [PATCH 0864/2300] Revert "[nrf fromtree] drivers: gnss: lcx7g: Add Kconfigs for configurable buffers" This reverts commit a3e53fb2841a3518c48ecdae188fdb1ed7069db4. Signed-off-by: Robert Lubos --- drivers/gnss/Kconfig.quectel_lcx6g | 20 -------------------- drivers/gnss/gnss_quectel_lcx6g.c | 6 +++--- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/gnss/Kconfig.quectel_lcx6g b/drivers/gnss/Kconfig.quectel_lcx6g index 3036f76d05b..6736015aed7 100644 --- a/drivers/gnss/Kconfig.quectel_lcx6g +++ b/drivers/gnss/Kconfig.quectel_lcx6g @@ -15,23 +15,3 @@ config GNSS_QUECTEL_LCX6G select GNSS_NMEA0183_MATCH help Enable quectel LCX6G series GNSS modem driver. - -if GNSS_QUECTEL_LCX6G - -config GNSS_QUECTEL_LCX6G_UART_RX_BUF_SIZE - int "Size of UART backend receive buffer" - default 256 - -config GNSS_QUECTEL_LCX6G_UART_TX_BUF_SIZE - int "Size of UART backend transmit buffer" - default 64 - -if GNSS_SATELLITES - -config GNSS_QUECTEL_LCX6G_SAT_ARRAY_SIZE - int "Size of GNSS satellites array" - default 24 - -endif # GNSS_SATELLITES - -endif # GNSS_QUECTEL_LCX6G diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 09fa8fd8e4a..ee15a573ffe 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -44,14 +44,14 @@ struct quectel_lcx6g_config { struct quectel_lcx6g_data { struct gnss_nmea0183_match_data match_data; #if CONFIG_GNSS_SATELLITES - struct gnss_satellite satellites[CONFIG_GNSS_QUECTEL_LCX6G_SAT_ARRAY_SIZE]; + struct gnss_satellite satellites[24]; #endif /* UART backend */ struct modem_pipe *uart_pipe; struct modem_backend_uart uart_backend; - uint8_t uart_backend_receive_buf[CONFIG_GNSS_QUECTEL_LCX6G_UART_RX_BUF_SIZE]; - uint8_t uart_backend_transmit_buf[CONFIG_GNSS_QUECTEL_LCX6G_UART_TX_BUF_SIZE]; + uint8_t uart_backend_receive_buf[128]; + uint8_t uart_backend_transmit_buf[64]; /* Modem chat */ struct modem_chat chat; From 9513b94bfaaf034f0e834ed2d6a442ba6f7e7b7c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:45 +0100 Subject: [PATCH 0865/2300] Revert "[nrf fromtree] drivers: gnss: lcx7g: Close pipe on suspend" This reverts commit 2d52fd091371773527579ea5846dd28939512e9d. Signed-off-by: Robert Lubos --- drivers/gnss/gnss_quectel_lcx6g.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index ee15a573ffe..30919f963ac 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -242,11 +242,11 @@ static int quectel_lcx6g_suspend(const struct device *dev) ret = modem_chat_run_script(&data->chat, &suspend_script); if (ret < 0) { LOG_ERR("Failed to suspend GNSS"); - } else { - LOG_INF("Suspended"); + modem_pipe_close(data->uart_pipe); + return ret; } - modem_pipe_close(data->uart_pipe); + LOG_INF("Suspended"); return ret; } From fa47c85f51478df882e52a0a81f1db543668a0d1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:46 +0100 Subject: [PATCH 0866/2300] Revert "[nrf fromtree] drivers: gnss: lcx7g: Refactor power management" This reverts commit 258622482edef3bb2621a991df26cbcd785a2490. Signed-off-by: Robert Lubos --- drivers/gnss/gnss_quectel_lcx6g.c | 91 ++++++++----------------------- 1 file changed, 24 insertions(+), 67 deletions(-) diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 30919f963ac..8ab3b26a6d9 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -22,18 +22,20 @@ #include LOG_MODULE_REGISTER(quectel_lcx6g, CONFIG_GNSS_LOG_LEVEL); -#define QUECTEL_LCX6G_PM_TIMEOUT_MS 500U -#define QUECTEL_LCX6G_SCRIPT_TIMEOUT_S 10U +#define QUECTEL_LCX6G_STARTUP_DELAY (K_MSEC(300U)) +#define QUECTEL_LCX6G_STATE_CHANGE_DELAY_MSEC (300LL) +#define QUECTEL_LCX6G_PAIR_TIMEOUT (K_SECONDS(11)) +#define QUECTEL_LCX6G_SCRIPT_TIMEOUT_S (10U) -#define QUECTEL_LCX6G_PAIR_NAV_MODE_STATIONARY 4 -#define QUECTEL_LCX6G_PAIR_NAV_MODE_FITNESS 1 -#define QUECTEL_LCX6G_PAIR_NAV_MODE_NORMAL 0 -#define QUECTEL_LCX6G_PAIR_NAV_MODE_DRONE 5 +#define QUECTEL_LCX6G_PAIR_NAV_MODE_STATIONARY (4) +#define QUECTEL_LCX6G_PAIR_NAV_MODE_FITNESS (1) +#define QUECTEL_LCX6G_PAIR_NAV_MODE_NORMAL (0) +#define QUECTEL_LCX6G_PAIR_NAV_MODE_DRONE (5) -#define QUECTEL_LCX6G_PAIR_PPS_MODE_DISABLED 0 -#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED 4 -#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED_AFTER_LOCK 1 -#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED_WHILE_LOCKED 2 +#define QUECTEL_LCX6G_PAIR_PPS_MODE_DISABLED (0) +#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED (4) +#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED_AFTER_LOCK (1) +#define QUECTEL_LCX6G_PAIR_PPS_MODE_ENABLED_WHILE_LOCKED (2) struct quectel_lcx6g_config { const struct device *uart; @@ -75,7 +77,6 @@ struct quectel_lcx6g_data { }; struct k_spinlock lock; - k_timeout_t pm_timeout; }; #define MODEM_CHAT_SCRIPT_NO_ABORT_DEFINE(_sym, _script_chats, _callback, _timeout) \ @@ -172,60 +173,33 @@ static int quectel_lcx6g_configure_pps(const struct device *dev) return modem_chat_run_script(&data->chat, &data->dynamic_script); } -static void quectel_lcx6g_pm_changed(const struct device *dev) -{ - struct quectel_lcx6g_data *data = dev->data; - uint32_t pm_ready_at_ms; - - pm_ready_at_ms = k_uptime_get() + QUECTEL_LCX6G_PM_TIMEOUT_MS; - data->pm_timeout = K_TIMEOUT_ABS_MS(pm_ready_at_ms); -} - -static void quectel_lcx6g_await_pm_ready(const struct device *dev) -{ - struct quectel_lcx6g_data *data = dev->data; - - LOG_INF("Waiting until PM ready"); - k_sleep(data->pm_timeout); -} - static int quectel_lcx6g_resume(const struct device *dev) { struct quectel_lcx6g_data *data = dev->data; int ret; - LOG_INF("Resuming"); - - quectel_lcx6g_await_pm_ready(dev); - ret = modem_pipe_open(data->uart_pipe); if (ret < 0) { - LOG_ERR("Failed to open pipe"); return ret; } ret = modem_chat_attach(&data->chat, data->uart_pipe); if (ret < 0) { - LOG_ERR("Failed to attach chat"); modem_pipe_close(data->uart_pipe); return ret; } ret = modem_chat_run_script(&data->chat, &resume_script); if (ret < 0) { - LOG_ERR("Failed to initialize GNSS"); modem_pipe_close(data->uart_pipe); return ret; } ret = quectel_lcx6g_configure_pps(dev); if (ret < 0) { - LOG_ERR("Failed to configure PPS"); modem_pipe_close(data->uart_pipe); - return ret; } - LOG_INF("Resumed"); return ret; } @@ -235,32 +209,18 @@ static int quectel_lcx6g_suspend(const struct device *dev) struct quectel_lcx6g_data *data = dev->data; int ret; - LOG_INF("Suspending"); - - quectel_lcx6g_await_pm_ready(dev); - ret = modem_chat_run_script(&data->chat, &suspend_script); if (ret < 0) { - LOG_ERR("Failed to suspend GNSS"); modem_pipe_close(data->uart_pipe); - return ret; } - LOG_INF("Suspended"); return ret; } -static void quectel_lcx6g_turn_on(const struct device *dev) -{ - LOG_INF("Powered on"); -} - static int quectel_lcx6g_turn_off(const struct device *dev) { struct quectel_lcx6g_data *data = dev->data; - LOG_INF("Powered off"); - return modem_pipe_close(data->uart_pipe); } @@ -282,7 +242,6 @@ static int quectel_lcx6g_pm_action(const struct device *dev, enum pm_device_acti break; case PM_DEVICE_ACTION_TURN_ON: - quectel_lcx6g_turn_on(dev); ret = 0; break; @@ -294,8 +253,6 @@ static int quectel_lcx6g_pm_action(const struct device *dev, enum pm_device_acti break; } - quectel_lcx6g_pm_changed(dev); - k_spin_unlock(&data->lock, key); return ret; } @@ -760,6 +717,7 @@ static int quectel_lcx6g_init(const struct device *dev) { int ret; + LOG_INF("Initializing Quectel LCX6G"); ret = quectel_lcx6g_init_nmea0183_match(dev); if (ret < 0) { return ret; @@ -774,19 +732,18 @@ static int quectel_lcx6g_init(const struct device *dev) quectel_lcx6g_init_dynamic_script(dev); - quectel_lcx6g_pm_changed(dev); - - if (pm_device_is_powered(dev)) { - ret = quectel_lcx6g_resume(dev); - if (ret < 0) { - return ret; - } - quectel_lcx6g_pm_changed(dev); - } else { - pm_device_init_off(dev); +#ifdef CONFIG_PM_DEVICE_RUNTIME + pm_device_init_suspended(dev); +#else + LOG_INF("Resuming Quectel LCX6G"); + ret = quectel_lcx6g_resume(dev); + if (ret < 0) { + LOG_ERR("Failed to resume Quectel LCX6G"); + return ret; } - - return pm_device_runtime_enable(dev); +#endif + LOG_INF("Quectel LCX6G initialized"); + return 0; } #define LCX6G_INST_NAME(inst, name) \ From 600c660004da7b1b6c9c3db5b241ce17fa9d3600 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:46 +0100 Subject: [PATCH 0867/2300] Revert "[nrf fromtree] drivers: gnss: lcx6g: Remove left over from testing" This reverts commit f4fcf95f5bc120a63eb3a85d1bb5a38ebef0748f. Signed-off-by: Robert Lubos --- drivers/gnss/gnss_quectel_lcx6g.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 8ab3b26a6d9..9c706e237a3 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -195,6 +195,8 @@ static int quectel_lcx6g_resume(const struct device *dev) return ret; } + k_msleep(1000); + ret = quectel_lcx6g_configure_pps(dev); if (ret < 0) { modem_pipe_close(data->uart_pipe); From 5b44005ef0e6dfbd9160850a08cf12e4383710a1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:46 +0100 Subject: [PATCH 0868/2300] Revert "[nrf fromtree] tests modem/backends/tty: Define _XOPEN_SOURCE" This reverts commit 9bd8e18d1bffa65deb2c676630961ec859addb9d. Signed-off-by: Robert Lubos --- tests/subsys/modem/backends/tty/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/subsys/modem/backends/tty/CMakeLists.txt b/tests/subsys/modem/backends/tty/CMakeLists.txt index 44597d8ae95..e692be0de90 100644 --- a/tests/subsys/modem/backends/tty/CMakeLists.txt +++ b/tests/subsys/modem/backends/tty/CMakeLists.txt @@ -6,4 +6,3 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(modem_backend_tty_test) target_sources(app PRIVATE src/main.c) -target_compile_definitions(app PRIVATE _XOPEN_SOURCE=600) From 330136f5852e9e4f28287ce522da174e648c2131 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:46 +0100 Subject: [PATCH 0869/2300] Revert "[nrf fromtree] modem: chat: Implement TRANSMIT_IDLE event" This reverts commit cfe7d6d9f94f535412a4616a528a4cfb823a641c. Signed-off-by: Robert Lubos --- include/zephyr/modem/chat.h | 4 +- subsys/modem/modem_chat.c | 153 ++++++++++++++++++++---------------- 2 files changed, 86 insertions(+), 71 deletions(-) diff --git a/include/zephyr/modem/chat.h b/include/zephyr/modem/chat.h index 28a2bc6bf9f..7079cb8c61d 100644 --- a/include/zephyr/modem/chat.h +++ b/include/zephyr/modem/chat.h @@ -240,8 +240,8 @@ struct modem_chat { struct k_sem script_stopped_sem; /* Script sending */ - enum modem_chat_script_send_state script_send_state; - uint16_t script_send_pos; + uint16_t script_send_request_pos; + uint16_t script_send_delimiter_pos; struct k_work script_send_work; struct k_work_delayable script_send_timeout_work; diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index b2d63b05e9e..99cf9bdbfa6 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -110,16 +110,13 @@ static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_scri k_sem_give(&chat->script_stopped_sem); } -static void modem_chat_set_script_send_state(struct modem_chat *chat, - enum modem_chat_script_send_state state) -{ - chat->script_send_pos = 0; - chat->script_send_state = state; -} - static void modem_chat_script_send(struct modem_chat *chat) { - modem_chat_set_script_send_state(chat, MODEM_CHAT_SCRIPT_SEND_STATE_REQUEST); + /* Initialize script send work */ + chat->script_send_request_pos = 0; + chat->script_send_delimiter_pos = 0; + + /* Schedule script send work */ k_work_submit(&chat->script_send_work); } @@ -222,58 +219,91 @@ static void modem_chat_script_abort_handler(struct k_work *item) modem_chat_script_stop(chat, MODEM_CHAT_SCRIPT_RESULT_ABORT); } -static bool modem_chat_script_chat_is_no_response(struct modem_chat *chat) +static bool modem_chat_script_send_request(struct modem_chat *chat) { const struct modem_chat_script_chat *script_chat = &chat->script->script_chats[chat->script_chat_it]; - return (script_chat->response_matches_size == 0) ? true : false; -} + uint8_t *script_chat_request_start; + uint16_t script_chat_request_remaining; + int ret; -static uint16_t modem_chat_script_chat_get_send_timeout(struct modem_chat *chat) -{ - const struct modem_chat_script_chat *script_chat = - &chat->script->script_chats[chat->script_chat_it]; + /* Validate data to send */ + if (script_chat->request_size == chat->script_send_request_pos) { + return true; + } - return script_chat->timeout; + script_chat_request_start = (uint8_t *)&script_chat->request[chat->script_send_request_pos]; + script_chat_request_remaining = script_chat->request_size - chat->script_send_request_pos; + + /* Send data through pipe */ + ret = modem_pipe_transmit(chat->pipe, script_chat_request_start, + script_chat_request_remaining); + + /* Validate transmit successful */ + if (ret < 1) { + return false; + } + + /* Update script send position */ + chat->script_send_request_pos += (uint16_t)ret; + + /* Check if data remains */ + if (chat->script_send_request_pos < script_chat->request_size) { + return false; + } + + return true; } -/* Returns true when request part has been sent */ -static bool modem_chat_send_script_request_part(struct modem_chat *chat) +static bool modem_chat_script_send_delimiter(struct modem_chat *chat) { - const struct modem_chat_script_chat *script_chat = - &chat->script->script_chats[chat->script_chat_it]; - - uint8_t *request_part; - uint16_t request_size; - uint16_t request_part_size; + uint8_t *script_chat_delimiter_start; + uint8_t script_chat_delimiter_remaining; int ret; - switch (chat->script_send_state) { - case MODEM_CHAT_SCRIPT_SEND_STATE_REQUEST: - request_part = (uint8_t *)(&script_chat->request[chat->script_send_pos]); - request_size = script_chat->request_size; - break; + /* Validate data to send */ + if (chat->delimiter_size == chat->script_send_delimiter_pos) { + return true; + } - case MODEM_CHAT_SCRIPT_SEND_STATE_DELIMITER: - request_part = (uint8_t *)(&chat->delimiter[chat->script_send_pos]); - request_size = chat->delimiter_size; - break; + script_chat_delimiter_start = (uint8_t *)&chat->delimiter[chat->script_send_delimiter_pos]; + script_chat_delimiter_remaining = chat->delimiter_size - chat->script_send_delimiter_pos; - default: + /* Send data through pipe */ + ret = modem_pipe_transmit(chat->pipe, script_chat_delimiter_start, + script_chat_delimiter_remaining); + + /* Validate transmit successful */ + if (ret < 1) { return false; } - request_part_size = request_size - chat->script_send_pos; - ret = modem_pipe_transmit(chat->pipe, request_part, request_part_size); - if (ret < 1) { + /* Update script send position */ + chat->script_send_delimiter_pos += (uint8_t)ret; + + /* Check if data remains */ + if (chat->script_send_delimiter_pos < chat->delimiter_size) { return false; } - chat->script_send_pos += (uint16_t)ret; + return true; +} + +static bool modem_chat_script_chat_is_no_response(struct modem_chat *chat) +{ + const struct modem_chat_script_chat *script_chat = + &chat->script->script_chats[chat->script_chat_it]; + + return (script_chat->response_matches_size == 0) ? true : false; +} - /* Return true if all data was sent */ - return request_size <= chat->script_send_pos; +static uint16_t modem_chat_script_chat_get_send_timeout(struct modem_chat *chat) +{ + const struct modem_chat_script_chat *script_chat = + &chat->script->script_chats[chat->script_chat_it]; + + return script_chat->timeout; } static void modem_chat_script_send_handler(struct k_work *item) @@ -281,33 +311,27 @@ static void modem_chat_script_send_handler(struct k_work *item) struct modem_chat *chat = CONTAINER_OF(item, struct modem_chat, script_send_work); uint16_t timeout; + /* Validate script running */ if (chat->script == NULL) { return; } - switch (chat->script_send_state) { - case MODEM_CHAT_SCRIPT_SEND_STATE_IDLE: + /* Send request */ + if (modem_chat_script_send_request(chat) == false) { + k_work_submit(&chat->script_send_work); return; + } - case MODEM_CHAT_SCRIPT_SEND_STATE_REQUEST: - if (!modem_chat_send_script_request_part(chat)) { - return; - } - - modem_chat_set_script_send_state(chat, MODEM_CHAT_SCRIPT_SEND_STATE_DELIMITER); - __fallthrough; - - case MODEM_CHAT_SCRIPT_SEND_STATE_DELIMITER: - if (!modem_chat_send_script_request_part(chat)) { - return; - } - - modem_chat_set_script_send_state(chat, MODEM_CHAT_SCRIPT_SEND_STATE_IDLE); - break; + /* Send delimiter */ + if (modem_chat_script_send_delimiter(chat) == false) { + k_work_submit(&chat->script_send_work); + return; } + /* Check if script command is no response */ if (modem_chat_script_chat_is_no_response(chat)) { timeout = modem_chat_script_chat_get_send_timeout(chat); + if (timeout == 0) { modem_chat_script_next(chat, false); } else { @@ -684,17 +708,8 @@ static void modem_chat_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_ev { struct modem_chat *chat = (struct modem_chat *)user_data; - switch (event) { - case MODEM_PIPE_EVENT_RECEIVE_READY: + if (event == MODEM_PIPE_EVENT_RECEIVE_READY) { k_work_submit(&chat->receive_work); - break; - - case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - k_work_submit(&chat->script_send_work); - break; - - default: - break; } } @@ -825,8 +840,8 @@ void modem_chat_release(struct modem_chat *chat) atomic_set(&chat->script_state, 0); chat->script_result = MODEM_CHAT_SCRIPT_RESULT_ABORT; k_sem_reset(&chat->script_stopped_sem); - chat->script_send_state = MODEM_CHAT_SCRIPT_SEND_STATE_IDLE; - chat->script_send_pos = 0; + chat->script_send_request_pos = 0; + chat->script_send_delimiter_pos = 0; chat->parse_match = NULL; chat->parse_match_len = 0; chat->parse_arg_len = 0; From 0ddb1313daa5cd01a0f63b9f06bf76e6460cb34d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:46 +0100 Subject: [PATCH 0870/2300] Revert "[nrf fromtree] modem: chat: remove receive and transmit timeouts" This reverts commit 606f754cf2a1c71cdd25a1028be3f5cebfc84590. Signed-off-by: Robert Lubos --- drivers/gnss/gnss_nmea_generic.c | 1 + drivers/gnss/gnss_quectel_lcx6g.c | 1 + drivers/modem/modem_cellular.c | 1 + include/zephyr/modem/chat.h | 7 ++++-- subsys/modem/modem_chat.c | 27 +++++++++++++----------- tests/subsys/modem/modem_chat/src/main.c | 1 + 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/gnss/gnss_nmea_generic.c b/drivers/gnss/gnss_nmea_generic.c index 2f23f4d7353..6d9adfb6990 100644 --- a/drivers/gnss/gnss_nmea_generic.c +++ b/drivers/gnss/gnss_nmea_generic.c @@ -127,6 +127,7 @@ static int gnss_nmea_generic_init_chat(const struct device *dev) .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, .unsol_matches_size = ARRAY_SIZE(unsol_matches), + .process_timeout = K_MSEC(2), }; return modem_chat_init(&data->chat, &chat_config); diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 9c706e237a3..61d39140a9a 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -686,6 +686,7 @@ static int quectel_lcx6g_init_chat(const struct device *dev) .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, .unsol_matches_size = ARRAY_SIZE(unsol_matches), + .process_timeout = K_MSEC(2), }; return modem_chat_init(&data->chat, &chat_config); diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 8aca855f55b..d1f3a69c94e 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1520,6 +1520,7 @@ static int modem_cellular_init(const struct device *dev) .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, .unsol_matches_size = ARRAY_SIZE(unsol_matches), + .process_timeout = K_MSEC(2), }; modem_chat_init(&data->chat, &chat_config); diff --git a/include/zephyr/modem/chat.h b/include/zephyr/modem/chat.h index 7079cb8c61d..d46ffc7c24a 100644 --- a/include/zephyr/modem/chat.h +++ b/include/zephyr/modem/chat.h @@ -242,7 +242,7 @@ struct modem_chat { /* Script sending */ uint16_t script_send_request_pos; uint16_t script_send_delimiter_pos; - struct k_work script_send_work; + struct k_work_delayable script_send_work; struct k_work_delayable script_send_timeout_work; /* Match parsing */ @@ -252,7 +252,8 @@ struct modem_chat { uint16_t parse_match_type; /* Process received data */ - struct k_work receive_work; + struct k_work_delayable process_work; + k_timeout_t process_timeout; }; /** @@ -281,6 +282,8 @@ struct modem_chat_config { const struct modem_chat_match *unsol_matches; /** Elements in array of unsolicited matches */ uint16_t unsol_matches_size; + /** Delay from receive ready event to pipe receive occurs */ + k_timeout_t process_timeout; }; /** diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index 99cf9bdbfa6..f3857bcfbc3 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -97,7 +97,7 @@ static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_scri /* Cancel work */ k_work_cancel_delayable(&chat->script_timeout_work); - k_work_cancel(&chat->script_send_work); + k_work_cancel_delayable(&chat->script_send_work); k_work_cancel_delayable(&chat->script_send_timeout_work); /* Clear script running state */ @@ -117,7 +117,7 @@ static void modem_chat_script_send(struct modem_chat *chat) chat->script_send_delimiter_pos = 0; /* Schedule script send work */ - k_work_submit(&chat->script_send_work); + k_work_schedule(&chat->script_send_work, K_NO_WAIT); } static void modem_chat_script_set_response_matches(struct modem_chat *chat) @@ -308,7 +308,8 @@ static uint16_t modem_chat_script_chat_get_send_timeout(struct modem_chat *chat) static void modem_chat_script_send_handler(struct k_work *item) { - struct modem_chat *chat = CONTAINER_OF(item, struct modem_chat, script_send_work); + struct k_work_delayable *dwork = k_work_delayable_from_work(item); + struct modem_chat *chat = CONTAINER_OF(dwork, struct modem_chat, script_send_work); uint16_t timeout; /* Validate script running */ @@ -318,13 +319,13 @@ static void modem_chat_script_send_handler(struct k_work *item) /* Send request */ if (modem_chat_script_send_request(chat) == false) { - k_work_submit(&chat->script_send_work); + k_work_schedule(&chat->script_send_work, chat->process_timeout); return; } /* Send delimiter */ if (modem_chat_script_send_delimiter(chat) == false) { - k_work_submit(&chat->script_send_work); + k_work_schedule(&chat->script_send_work, chat->process_timeout); return; } @@ -686,7 +687,8 @@ static void modem_chat_process_bytes(struct modem_chat *chat) static void modem_chat_process_handler(struct k_work *item) { - struct modem_chat *chat = CONTAINER_OF(item, struct modem_chat, receive_work); + struct k_work_delayable *dwork = k_work_delayable_from_work(item); + struct modem_chat *chat = CONTAINER_OF(dwork, struct modem_chat, process_work); int ret; /* Fill work buffer */ @@ -700,7 +702,7 @@ static void modem_chat_process_handler(struct k_work *item) /* Process data */ modem_chat_process_bytes(chat); - k_work_submit(&chat->receive_work); + k_work_schedule(&chat->process_work, K_NO_WAIT); } static void modem_chat_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_event event, @@ -709,7 +711,7 @@ static void modem_chat_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_ev struct modem_chat *chat = (struct modem_chat *)user_data; if (event == MODEM_PIPE_EVENT_RECEIVE_READY) { - k_work_submit(&chat->receive_work); + k_work_schedule(&chat->process_work, chat->process_timeout); } } @@ -739,13 +741,14 @@ int modem_chat_init(struct modem_chat *chat, const struct modem_chat_config *con chat->filter_size = config->filter_size; chat->matches[MODEM_CHAT_MATCHES_INDEX_UNSOL] = config->unsol_matches; chat->matches_size[MODEM_CHAT_MATCHES_INDEX_UNSOL] = config->unsol_matches_size; + chat->process_timeout = config->process_timeout; atomic_set(&chat->script_state, 0); k_sem_init(&chat->script_stopped_sem, 0, 1); - k_work_init(&chat->receive_work, modem_chat_process_handler); + k_work_init_delayable(&chat->process_work, modem_chat_process_handler); k_work_init(&chat->script_run_work, modem_chat_script_run_handler); k_work_init_delayable(&chat->script_timeout_work, modem_chat_script_timeout_handler); k_work_init(&chat->script_abort_work, modem_chat_script_abort_handler); - k_work_init(&chat->script_send_work, modem_chat_script_send_handler); + k_work_init_delayable(&chat->script_send_work, modem_chat_script_send_handler); k_work_init_delayable(&chat->script_send_timeout_work, modem_chat_script_send_timeout_handler); @@ -828,8 +831,8 @@ void modem_chat_release(struct modem_chat *chat) k_work_cancel_sync(&chat->script_run_work, &sync); k_work_cancel_sync(&chat->script_abort_work, &sync); - k_work_cancel_sync(&chat->receive_work, &sync); - k_work_cancel_sync(&chat->script_send_work, &sync); + k_work_cancel_delayable_sync(&chat->process_work, &sync); + k_work_cancel_delayable_sync(&chat->script_send_work, &sync); chat->pipe = NULL; chat->receive_buf_len = 0; diff --git a/tests/subsys/modem/modem_chat/src/main.c b/tests/subsys/modem/modem_chat/src/main.c index f9a37ecc6cc..3f1ef57754d 100644 --- a/tests/subsys/modem/modem_chat/src/main.c +++ b/tests/subsys/modem/modem_chat/src/main.c @@ -254,6 +254,7 @@ static void *test_modem_chat_setup(void) .argv_size = ARRAY_SIZE(cmd_argv), .unsol_matches = unsol_matches, .unsol_matches_size = ARRAY_SIZE(unsol_matches), + .process_timeout = K_MSEC(2), }; zassert(modem_chat_init(&cmd, &cmd_config) == 0, "Failed to init modem CMD"); From 0b68d2142fbecff6fdd6b098c28d34236d99b79a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:47 +0100 Subject: [PATCH 0871/2300] Revert "[nrf fromtree] drivers: gnss: quectel_lcx6g: fix compilation error when CONFIG_PM_DEVICE=y" This reverts commit 2dc90d9e7d6d3aff63d1c325d910368b3ba15ea8. Signed-off-by: Robert Lubos --- drivers/gnss/gnss_quectel_lcx6g.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 61d39140a9a..f7b29b4640d 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -211,7 +211,7 @@ static int quectel_lcx6g_suspend(const struct device *dev) struct quectel_lcx6g_data *data = dev->data; int ret; - ret = modem_chat_run_script(&data->chat, &suspend_script); + ret = modem_chat_run_script_run(&data->chat, &suspend_script); if (ret < 0) { modem_pipe_close(data->uart_pipe); } From fb24411c40147ee395a3b3a2ce2b897a7d3cfc8c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:47 +0100 Subject: [PATCH 0872/2300] Revert "[nrf fromtree] tests: build_all: modem: Remove net tag and clean up" This reverts commit c37b0b9efdb50868f21ec62e9d15ebd3fe24dbf7. Signed-off-by: Robert Lubos --- .../modem/{modem_hl7800.conf => modem.conf} | 6 +- .../build_all/modem/modem_cellular.conf | 6 +- .../drivers/build_all/modem/modem_esp_at.conf | 5 +- tests/drivers/build_all/modem/modem_gsm.conf | 5 +- .../build_all/modem/modem_gsm_mux.conf | 11 -- .../build_all/modem/modem_quectel_bg9x.conf | 6 +- .../build_all/modem/modem_simcom_sim7080.conf | 7 +- .../build_all/modem/modem_ublox_sara.conf | 6 +- tests/drivers/build_all/modem/prj.conf | 3 + tests/drivers/build_all/modem/testcase.yaml | 137 ++++++++++-------- 10 files changed, 104 insertions(+), 88 deletions(-) rename tests/drivers/build_all/modem/{modem_hl7800.conf => modem.conf} (79%) delete mode 100644 tests/drivers/build_all/modem/modem_gsm_mux.conf create mode 100644 tests/drivers/build_all/modem/prj.conf diff --git a/tests/drivers/build_all/modem/modem_hl7800.conf b/tests/drivers/build_all/modem/modem.conf similarity index 79% rename from tests/drivers/build_all/modem/modem_hl7800.conf rename to tests/drivers/build_all/modem/modem.conf index 5cc44bb71ea..0143f6fcd7f 100644 --- a/tests/drivers/build_all/modem/modem_hl7800.conf +++ b/tests/drivers/build_all/modem/modem.conf @@ -1,8 +1,10 @@ -CONFIG_GPIO=y +CONFIG_TEST=y +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_TEST_USERSPACE=y CONFIG_SERIAL=y -CONFIG_MODEM=y CONFIG_NETWORKING=y CONFIG_NET_IPV4=y +CONFIG_MODEM=y CONFIG_MODEM_HL7800=y CONFIG_MODEM_HL7800_FW_UPDATE=y CONFIG_MODEM_HL7800_SET_APN_NAME_ON_STARTUP=y diff --git a/tests/drivers/build_all/modem/modem_cellular.conf b/tests/drivers/build_all/modem/modem_cellular.conf index 4582216f772..3366fcf32d4 100644 --- a/tests/drivers/build_all/modem/modem_cellular.conf +++ b/tests/drivers/build_all/modem/modem_cellular.conf @@ -1,8 +1,10 @@ -CONFIG_GPIO=y +CONFIG_TEST=y +CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_SERIAL=y -CONFIG_MODEM=y CONFIG_NETWORKING=y CONFIG_NET_L2_PPP=y +CONFIG_MODEM=y CONFIG_PM_DEVICE=y CONFIG_MODEM_CELLULAR=y CONFIG_UART_ASYNC_API=y +CONFIG_GPIO=y diff --git a/tests/drivers/build_all/modem/modem_esp_at.conf b/tests/drivers/build_all/modem/modem_esp_at.conf index 6ba79c82653..01d4b62ba50 100644 --- a/tests/drivers/build_all/modem/modem_esp_at.conf +++ b/tests/drivers/build_all/modem/modem_esp_at.conf @@ -1,6 +1,7 @@ -CONFIG_GPIO=y +CONFIG_TEST=y +CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_SERIAL=y -CONFIG_MODEM=y +CONFIG_GPIO=y CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y CONFIG_NET_IPV4=y diff --git a/tests/drivers/build_all/modem/modem_gsm.conf b/tests/drivers/build_all/modem/modem_gsm.conf index dd5b37afb9e..a7c4e492bc3 100644 --- a/tests/drivers/build_all/modem/modem_gsm.conf +++ b/tests/drivers/build_all/modem/modem_gsm.conf @@ -1,9 +1,10 @@ -CONFIG_GPIO=y +CONFIG_TEST=y +CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_SERIAL=y -CONFIG_MODEM=y CONFIG_NETWORKING=y CONFIG_NET_IPV4=y CONFIG_NET_DRIVERS=y CONFIG_NET_PPP=y CONFIG_NET_L2_PPP=y +CONFIG_MODEM=y CONFIG_MODEM_GSM_PPP=y diff --git a/tests/drivers/build_all/modem/modem_gsm_mux.conf b/tests/drivers/build_all/modem/modem_gsm_mux.conf deleted file mode 100644 index 952ace2466d..00000000000 --- a/tests/drivers/build_all/modem/modem_gsm_mux.conf +++ /dev/null @@ -1,11 +0,0 @@ -CONFIG_GPIO=y -CONFIG_SERIAL=y -CONFIG_MODEM=y -CONFIG_NETWORKING=y -CONFIG_NET_IPV4=y -CONFIG_NET_DRIVERS=y -CONFIG_NET_PPP=y -CONFIG_NET_L2_PPP=y -CONFIG_MODEM_GSM_PPP=y -CONFIG_GSM_MUX=y -CONFIG_UART_MUX=y diff --git a/tests/drivers/build_all/modem/modem_quectel_bg9x.conf b/tests/drivers/build_all/modem/modem_quectel_bg9x.conf index f868a0ef77a..9fb71bbe412 100644 --- a/tests/drivers/build_all/modem/modem_quectel_bg9x.conf +++ b/tests/drivers/build_all/modem/modem_quectel_bg9x.conf @@ -1,7 +1,9 @@ -CONFIG_GPIO=y +CONFIG_TEST=y +CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_SERIAL=y -CONFIG_MODEM=y +CONFIG_GPIO=y CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y +CONFIG_MODEM=y CONFIG_MODEM_QUECTEL_BG9X=y CONFIG_MODEM_QUECTEL_BG9X_APN="hologram" diff --git a/tests/drivers/build_all/modem/modem_simcom_sim7080.conf b/tests/drivers/build_all/modem/modem_simcom_sim7080.conf index b6f1530f8a2..dc4645a2455 100644 --- a/tests/drivers/build_all/modem/modem_simcom_sim7080.conf +++ b/tests/drivers/build_all/modem/modem_simcom_sim7080.conf @@ -1,7 +1,8 @@ -CONFIG_GPIO=y +CONFIG_TEST=y +CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_SERIAL=y -CONFIG_MODEM=y -CONFIG_NETWORKING=y CONFIG_GPIO=y +CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y +CONFIG_MODEM=y CONFIG_MODEM_SIM7080=y diff --git a/tests/drivers/build_all/modem/modem_ublox_sara.conf b/tests/drivers/build_all/modem/modem_ublox_sara.conf index 8cef947f051..21e61c8ec54 100644 --- a/tests/drivers/build_all/modem/modem_ublox_sara.conf +++ b/tests/drivers/build_all/modem/modem_ublox_sara.conf @@ -1,6 +1,8 @@ -CONFIG_GPIO=y +CONFIG_TEST=y +CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_SERIAL=y -CONFIG_MODEM=y +CONFIG_GPIO=y CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y +CONFIG_MODEM=y CONFIG_MODEM_UBLOX_SARA=y diff --git a/tests/drivers/build_all/modem/prj.conf b/tests/drivers/build_all/modem/prj.conf new file mode 100644 index 00000000000..bb5ccbec1ba --- /dev/null +++ b/tests/drivers/build_all/modem/prj.conf @@ -0,0 +1,3 @@ +CONFIG_TEST=y +CONFIG_TEST_USERSPACE=y +CONFIG_SERIAL=y diff --git a/tests/drivers/build_all/modem/testcase.yaml b/tests/drivers/build_all/modem/testcase.yaml index 303e0ee44e8..25c338b9fda 100644 --- a/tests/drivers/build_all/modem/testcase.yaml +++ b/tests/drivers/build_all/modem/testcase.yaml @@ -1,73 +1,86 @@ common: build_only: true - platform_allow: - - native_sim - - native_sim_64 - - qemu_x86 - - qemu_x86_64 - + tags: + - drivers + - net + - modem tests: - drivers.modem.modem_hl7800.interrupt_driven.build: - extra_args: CONF_FILE=modem_hl7800.conf - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=y - drivers.modem.modem_hl7800.async.build: - extra_args: CONF_FILE=modem_hl7800.conf - extra_configs: - - CONFIG_UART_ASYNC_API=y - drivers.modem.modem_ublox_sara.interrupt_driven.build: - extra_args: CONF_FILE=modem_ublox_sara.conf - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=y - drivers.modem.modem_ublox_sara.async.build: + drivers.modem.build: + extra_args: CONF_FILE=modem.conf + platform_exclude: + - serpente + - particle_boron + - rak5010_nrf52840 + - litex_vexriscv + - ip_k66f + min_ram: 68 + min_flash: 115 + drivers.modem.ublox_sara.build: extra_args: CONF_FILE=modem_ublox_sara.conf - extra_configs: - - CONFIG_UART_ASYNC_API=y - drivers.modem.modem_quectel_bg9x.interrupt_driven.build: - extra_args: CONF_FILE=modem_quectel_bg9x.conf - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=y - drivers.modem.modem_quectel_bg9x.async.build: + platform_exclude: + - serpente + - pinnacle_100_dvk + - litex_vexriscv + - ip_k66f + - mg100 + drivers.modem.simcom_sim7080.build: + extra_args: CONF_FILE=modem_simcom_sim7080.conf + platform_exclude: + - serpente + - pinnacle_100_dvk + - litex_vexriscv + - ip_k66f + - mg100 + drivers.modem.quectel_bg9x.build: extra_args: CONF_FILE=modem_quectel_bg9x.conf - extra_configs: - - CONFIG_UART_ASYNC_API=y - drivers.modem.modem_gsm.interrupt_driven.build: + platform_exclude: + - serpente + - pinnacle_100_dvk + - litex_vexriscv + - ip_k66f + - mg100 + min_ram: 36 + drivers.modem.gsm.build: extra_args: CONF_FILE=modem_gsm.conf - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=y - drivers.modem.modem_gsm.async.build: + platform_exclude: + - serpente + - particle_boron + - rak5010_nrf52840 + - litex_vexriscv + - ip_k66f + min_ram: 36 + drivers.modem.gsm_mux.build: extra_args: CONF_FILE=modem_gsm.conf - extra_configs: - - CONFIG_UART_ASYNC_API=y - drivers.modem.modem_gsm_mux.interrupt_driven.build: - extra_args: CONF_FILE=modem_gsm_mux.conf - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=y - drivers.modem.modem_gsm_mux.async.build: - extra_args: CONF_FILE=modem_gsm_mux.conf - extra_configs: - - CONFIG_UART_ASYNC_API=y - drivers.modem.modem_esp_at.interrupt_driven.build: + platform_exclude: + - serpente + - particle_boron + - rak5010_nrf52840 + - litex_vexriscv + - ip_k66f + min_ram: 36 + extra_configs: + - CONFIG_GSM_MUX=y + - CONFIG_UART_MUX=y + drivers.modem.esp_at.build: extra_args: CONF_FILE=modem_esp_at.conf - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=y - drivers.modem.modem_esp_at.async.build: + platform_exclude: + - ip_k66f + - cy8cproto_062_4343w + filter: CONFIG_SERIAL + min_ram: 36 + drivers.modem.esp_at.async.build: extra_args: CONF_FILE=modem_esp_at.conf + filter: CONFIG_SERIAL and CONFIG_QEMU_TARGET + min_ram: 36 extra_configs: - - CONFIG_UART_ASYNC_API=y - drivers.modem.modem_cellular.interrupt_driven.build: - extra_args: CONF_FILE=modem_cellular.conf - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=y - drivers.modem.modem_cellular.async.build: + - CONFIG_MODEM_IFACE_UART_ASYNC=y + drivers.modem.modem_cellular.build: extra_args: CONF_FILE=modem_cellular.conf - extra_configs: - - CONFIG_UART_ASYNC_API=y - drivers.modem.modem_simcom_sim7080.interrupt_driven.build: - extra_args: CONF_FILE=modem_simcom_sim7080.conf - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=y - drivers.modem.modem_simcom_sim7080.async.build: - extra_args: CONF_FILE=modem_simcom_sim7080.conf - extra_configs: - - CONFIG_UART_ASYNC_API=y + platform_allow: + - native_posix_64 + - native_posix + - native_sim_64 + - native_sim + - qemu_x86 + - qemu_x86_64 + min_ram: 36 From 2b6e9aeb06d0a83af7c1d5ca45c75883bf5837c8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:47 +0100 Subject: [PATCH 0873/2300] Revert "[nrf fromtree] modem: ppp: Implement TRANSMIT_IDLE event" This reverts commit b661d7209958ea0fbdd93f886459a22b65d0fb5f. Signed-off-by: Robert Lubos --- subsys/modem/modem_ppp.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/subsys/modem/modem_ppp.c b/subsys/modem/modem_ppp.c index 1d47542f24a..476926f4db3 100644 --- a/subsys/modem/modem_ppp.c +++ b/subsys/modem/modem_ppp.c @@ -314,17 +314,8 @@ static void modem_ppp_pipe_callback(struct modem_pipe *pipe, enum modem_pipe_eve { struct modem_ppp *ppp = (struct modem_ppp *)user_data; - switch (event) { - case MODEM_PIPE_EVENT_RECEIVE_READY: + if (event == MODEM_PIPE_EVENT_RECEIVE_READY) { k_work_submit(&ppp->process_work); - break; - - case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - k_work_submit(&ppp->send_work); - break; - - default: - break; } } @@ -360,20 +351,22 @@ static void modem_ppp_send_handler(struct k_work *item) } } - while (!ring_buf_is_empty(&ppp->transmit_rb)) { - reserved_size = ring_buf_get_claim(&ppp->transmit_rb, &reserved, UINT32_MAX); - - ret = modem_pipe_transmit(ppp->pipe, reserved, reserved_size); - if (ret < 0) { - ring_buf_get_finish(&ppp->transmit_rb, 0); - break; - } + reserved_size = ring_buf_get_claim(&ppp->transmit_rb, &reserved, UINT32_MAX); + if (reserved_size == 0) { + ring_buf_get_finish(&ppp->transmit_rb, 0); + return; + } + ret = modem_pipe_transmit(ppp->pipe, reserved, reserved_size); + if (ret < 0) { + ring_buf_get_finish(&ppp->transmit_rb, 0); + } else { ring_buf_get_finish(&ppp->transmit_rb, (uint32_t)ret); + } - if (ret < reserved_size) { - break; - } + /* Resubmit send work if data remains */ + if ((ring_buf_is_empty(&ppp->transmit_rb) == false) || (ppp->tx_pkt != NULL)) { + k_work_submit(&ppp->send_work); } } From 65749ec2466696a21e986b5d608e3c589d6396b5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:47 +0100 Subject: [PATCH 0874/2300] Revert "[nrf fromtree] drivers: gnss: match: Change RMC/GGA sync from timeout to UTC" This reverts commit cff74b2b5589b5774894eae3a91e04da0d3c8bfa. Signed-off-by: Robert Lubos --- drivers/gnss/gnss_nmea0183_match.c | 58 ++++++++++++------------ drivers/gnss/gnss_nmea0183_match.h | 10 ++-- drivers/gnss/gnss_nmea_generic.c | 4 ++ drivers/gnss/gnss_quectel_lcx6g.c | 1 + dts/bindings/gnss/gnss-nmea-generic.yaml | 10 ++++ 5 files changed, 52 insertions(+), 31 deletions(-) diff --git a/drivers/gnss/gnss_nmea0183_match.c b/drivers/gnss/gnss_nmea0183_match.c index cd82c552ee4..2b971937c8d 100644 --- a/drivers/gnss/gnss_nmea0183_match.c +++ b/drivers/gnss/gnss_nmea0183_match.c @@ -10,22 +10,16 @@ #include -#include "gnss_parse.h" #include "gnss_nmea0183.h" #include "gnss_nmea0183_match.h" -static int gnss_nmea0183_match_parse_utc(char **argv, uint16_t argc, uint32_t *utc) +static bool gnss_nmea0183_match_timed_out(struct gnss_nmea0183_match_data *data) { - int64_t i64; + int64_t delta; - if ((gnss_parse_dec_to_milli(argv[1], &i64) < 0) || - (i64 < 0) || - (i64 > UINT32_MAX)) { - return -EINVAL; - } - - *utc = (uint32_t)i64; - return 0; + delta = k_uptime_delta(&data->timestamp); + data->timestamp = k_uptime_get(); + return ((uint16_t)delta) > data->timeout_ms; } #if CONFIG_GNSS_SATELLITES @@ -36,15 +30,10 @@ static void gnss_nmea0183_match_reset_gsv(struct gnss_nmea0183_match_data *data) } #endif -static void gnss_nmea0183_match_publish(struct gnss_nmea0183_match_data *data) +static void gnss_nmea0183_match_reset(struct gnss_nmea0183_match_data *data) { - if ((data->gga_utc == 0) || (data->rmc_utc == 0)) { - return; - } - - if (data->gga_utc == data->rmc_utc) { - gnss_publish_data(data->gnss, &data->data); - } + data->gga_received = false; + data->rmc_received = false; } void gnss_nmea0183_match_gga_callback(struct modem_chat *chat, char **argv, uint16_t argc, @@ -52,15 +41,19 @@ void gnss_nmea0183_match_gga_callback(struct modem_chat *chat, char **argv, uint { struct gnss_nmea0183_match_data *data = user_data; - if (gnss_nmea0183_parse_gga((const char **)argv, argc, &data->data) < 0) { - return; + if (gnss_nmea0183_match_timed_out(data)) { + gnss_nmea0183_match_reset(data); } - if (gnss_nmea0183_match_parse_utc(argv, argc, &data->gga_utc) < 0) { + if (gnss_nmea0183_parse_gga((const char **)argv, argc, &data->data) < 0) { return; } - gnss_nmea0183_match_publish(data); + data->gga_received = true; + + if (data->gga_received && data->rmc_received) { + gnss_publish_data(data->gnss, &data->data); + } } void gnss_nmea0183_match_rmc_callback(struct modem_chat *chat, char **argv, uint16_t argc, @@ -68,15 +61,19 @@ void gnss_nmea0183_match_rmc_callback(struct modem_chat *chat, char **argv, uint { struct gnss_nmea0183_match_data *data = user_data; - if (gnss_nmea0183_parse_rmc((const char **)argv, argc, &data->data) < 0) { - return; + if (gnss_nmea0183_match_timed_out(data)) { + gnss_nmea0183_match_reset(data); } - if (gnss_nmea0183_match_parse_utc(argv, argc, &data->rmc_utc) < 0) { + if (gnss_nmea0183_parse_rmc((const char **)argv, argc, &data->data) < 0) { return; } - gnss_nmea0183_match_publish(data); + data->rmc_received = true; + + if (data->gga_received && data->rmc_received) { + gnss_publish_data(data->gnss, &data->data); + } } #if CONFIG_GNSS_SATELLITES @@ -87,6 +84,10 @@ void gnss_nmea0183_match_gsv_callback(struct modem_chat *chat, char **argv, uint struct gnss_nmea0183_gsv_header header; int ret; + if (gnss_nmea0183_match_timed_out(data)) { + gnss_nmea0183_match_reset(data); + } + if (gnss_nmea0183_parse_gsv_header((const char **)argv, argc, &header) < 0) { return; } @@ -123,7 +124,7 @@ int gnss_nmea0183_match_init(struct gnss_nmea0183_match_data *data, const struct gnss_nmea0183_match_config *config) { __ASSERT(data != NULL, "data argument must be provided"); - __ASSERT(config != NULL, "config argument must be provided"); + __ASSERT(config != NULL, "data argument must be provided"); memset(data, 0, sizeof(struct gnss_nmea0183_match_data)); data->gnss = config->gnss; @@ -131,5 +132,6 @@ int gnss_nmea0183_match_init(struct gnss_nmea0183_match_data *data, data->satellites = config->satellites; data->satellites_size = config->satellites_size; #endif + data->timeout_ms = config->timeout_ms; return 0; } diff --git a/drivers/gnss/gnss_nmea0183_match.h b/drivers/gnss/gnss_nmea0183_match.h index 28ed395320b..65104e1dc8a 100644 --- a/drivers/gnss/gnss_nmea0183_match.h +++ b/drivers/gnss/gnss_nmea0183_match.h @@ -49,9 +49,11 @@ struct gnss_nmea0183_match_data { uint16_t satellites_size; uint16_t satellites_length; #endif - uint32_t gga_utc; - uint32_t rmc_utc; - uint8_t gsv_message_number; + int64_t timestamp; + uint16_t timeout_ms; + uint8_t gga_received : 1; + uint8_t rmc_received : 1; + uint8_t gsv_message_number : 6; }; /** GNSS NMEA0183 match configuration structure */ @@ -64,6 +66,8 @@ struct gnss_nmea0183_match_config { /** Number of elements in buffer for parsed satellites */ uint16_t satellites_size; #endif + /** The maximum time from the first to the last NMEA0183 message of a fix */ + uint16_t timeout_ms; }; /** diff --git a/drivers/gnss/gnss_nmea_generic.c b/drivers/gnss/gnss_nmea_generic.c index 6d9adfb6990..0e7611ba495 100644 --- a/drivers/gnss/gnss_nmea_generic.c +++ b/drivers/gnss/gnss_nmea_generic.c @@ -29,6 +29,7 @@ LOG_MODULE_REGISTER(gnss_nmea_generic, CONFIG_GNSS_LOG_LEVEL); struct gnss_nmea_generic_config { const struct device *uart; + uint16_t nmea_timeout_ms; }; struct gnss_nmea_generic_data { @@ -82,6 +83,7 @@ static struct gnss_driver_api gnss_api = { static int gnss_nmea_generic_init_nmea0183_match(const struct device *dev) { + const struct gnss_nmea_generic_config *cfg = dev->config; struct gnss_nmea_generic_data *data = dev->data; const struct gnss_nmea0183_match_config match_config = { @@ -90,6 +92,7 @@ static int gnss_nmea_generic_init_nmea0183_match(const struct device *dev) .satellites = data->satellites, .satellites_size = ARRAY_SIZE(data->satellites), #endif + .timeout_ms = cfg->nmea_timeout_ms, }; return gnss_nmea0183_match_init(&data->match_data, &match_config); @@ -160,6 +163,7 @@ static int gnss_nmea_generic_init(const struct device *dev) #define GNSS_NMEA_GENERIC(inst) \ static struct gnss_nmea_generic_config gnss_nmea_generic_cfg_##inst = { \ .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ + .nmea_timeout_ms = DT_INST_PROP(inst, nmea_timeout_ms), \ }; \ \ static struct gnss_nmea_generic_data gnss_nmea_generic_data_##inst; \ diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index f7b29b4640d..9565d46cdfb 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -649,6 +649,7 @@ static int quectel_lcx6g_init_nmea0183_match(const struct device *dev) .satellites = data->satellites, .satellites_size = ARRAY_SIZE(data->satellites), #endif + .timeout_ms = 50, }; return gnss_nmea0183_match_init(&data->match_data, &config); diff --git a/dts/bindings/gnss/gnss-nmea-generic.yaml b/dts/bindings/gnss/gnss-nmea-generic.yaml index a3887995e10..4be7bde1186 100644 --- a/dts/bindings/gnss/gnss-nmea-generic.yaml +++ b/dts/bindings/gnss/gnss-nmea-generic.yaml @@ -20,3 +20,13 @@ compatible: "gnss-nmea-generic" include: - uart-device.yaml + +properties: + nmea-timeout-ms: + type: int + default: 500 + description: | + Synchronization timeout for NMEA sentences. The NMEA parser is expecting + to receive a GGA and RMC sentences within this time frame to publish a + location data. Set accordingly to the UART datarate and location + reporting frequency. Defaults to 500ms if unspecified. From 977d5d115dc967c30384e4ab8b0db11665fedc35 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:47 +0100 Subject: [PATCH 0875/2300] Revert "[nrf fromtree] tests: modem: cmux: Implement TRANSMIT_IDLE into test suite" This reverts commit e8bc50ebf26d3d46a1fdd988a7b5fd4bd3badbeb. Signed-off-by: Robert Lubos --- subsys/modem/modem_cmux.c | 2 +- tests/subsys/modem/modem_cmux/src/main.c | 61 ++++-------------------- 2 files changed, 10 insertions(+), 53 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 16dc60b7219..13a153b8533 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -881,7 +881,7 @@ static void modem_cmux_transmit_handler(struct k_work *item) ring_buf_get_finish(&cmux->transmit_rb, (uint32_t)ret); - if (ret < reserved_size) { + if (ret == 0) { break; } } diff --git a/tests/subsys/modem/modem_cmux/src/main.c b/tests/subsys/modem/modem_cmux/src/main.c index b08cf26b5af..d601eeb1446 100644 --- a/tests/subsys/modem/modem_cmux/src/main.c +++ b/tests/subsys/modem/modem_cmux/src/main.c @@ -17,16 +17,12 @@ /*************************************************************************************************/ /* Definitions */ /*************************************************************************************************/ -#define EVENT_CMUX_CONNECTED BIT(0) -#define EVENT_CMUX_DLCI1_OPEN BIT(1) -#define EVENT_CMUX_DLCI2_OPEN BIT(2) -#define EVENT_CMUX_DLCI1_RECEIVE_READY BIT(3) -#define EVENT_CMUX_DLCI1_TRANSMIT_IDLE BIT(4) -#define EVENT_CMUX_DLCI2_RECEIVE_READY BIT(5) -#define EVENT_CMUX_DLCI2_TRANSMIT_IDLE BIT(6) -#define EVENT_CMUX_DLCI1_CLOSED BIT(7) -#define EVENT_CMUX_DLCI2_CLOSED BIT(8) -#define EVENT_CMUX_DISCONNECTED BIT(9) +#define EVENT_CMUX_CONNECTED BIT(0) +#define EVENT_CMUX_DLCI1_OPEN BIT(1) +#define EVENT_CMUX_DLCI2_OPEN BIT(2) +#define EVENT_CMUX_DLCI1_CLOSED BIT(3) +#define EVENT_CMUX_DLCI2_CLOSED BIT(4) +#define EVENT_CMUX_DISCONNECTED BIT(5) /*************************************************************************************************/ /* Instances */ @@ -63,14 +59,6 @@ static void test_modem_dlci1_pipe_callback(struct modem_pipe *pipe, enum modem_p k_event_post(&cmux_event, EVENT_CMUX_DLCI1_OPEN); break; - case MODEM_PIPE_EVENT_RECEIVE_READY: - k_event_post(&cmux_event, EVENT_CMUX_DLCI1_RECEIVE_READY); - break; - - case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - k_event_post(&cmux_event, EVENT_CMUX_DLCI1_TRANSMIT_IDLE); - break; - case MODEM_PIPE_EVENT_CLOSED: k_event_post(&cmux_event, EVENT_CMUX_DLCI1_CLOSED); break; @@ -88,14 +76,6 @@ static void test_modem_dlci2_pipe_callback(struct modem_pipe *pipe, enum modem_p k_event_post(&cmux_event, EVENT_CMUX_DLCI2_OPEN); break; - case MODEM_PIPE_EVENT_RECEIVE_READY: - k_event_post(&cmux_event, EVENT_CMUX_DLCI2_RECEIVE_READY); - break; - - case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - k_event_post(&cmux_event, EVENT_CMUX_DLCI2_TRANSMIT_IDLE); - break; - case MODEM_PIPE_EVENT_CLOSED: k_event_post(&cmux_event, EVENT_CMUX_DLCI2_CLOSED); break; @@ -320,7 +300,6 @@ static void test_modem_cmux_before(void *f) ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_at) { int ret; - uint32_t events; modem_backend_mock_put(&bus_mock, cmux_frame_dlci2_at_cgdcont, sizeof(cmux_frame_dlci2_at_cgdcont)); @@ -330,10 +309,6 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_at) 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)), @@ -352,7 +327,6 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_at) ZTEST(modem_cmux, test_modem_cmux_receive_dlci1_at) { int ret; - uint32_t events; modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_at, sizeof(cmux_frame_dlci1_at_at)); modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_newline, @@ -360,10 +334,6 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci1_at) k_msleep(100); - events = k_event_test(&cmux_event, EVENT_CMUX_DLCI1_RECEIVE_READY); - zassert_equal(events, EVENT_CMUX_DLCI1_RECEIVE_READY, - "Receive ready event not received for DLCI1 pipe"); - ret = modem_pipe_receive(dlci1_pipe, buffer1, sizeof(buffer1)); zassert_true(ret == (sizeof(cmux_frame_data_dlci1_at_at) + sizeof(cmux_frame_data_dlci1_at_newline)), @@ -382,17 +352,12 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci1_at) ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_ppp) { int ret; - uint32_t events; modem_backend_mock_put(&bus_mock, cmux_frame_dlci2_ppp_52, sizeof(cmux_frame_dlci2_ppp_52)); modem_backend_mock_put(&bus_mock, cmux_frame_dlci2_ppp_18, sizeof(cmux_frame_dlci2_ppp_18)); 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_ppp_52) + sizeof(cmux_frame_data_dlci2_ppp_18)), @@ -411,25 +376,17 @@ ZTEST(modem_cmux, test_modem_cmux_receive_dlci2_ppp) ZTEST(modem_cmux, test_modem_cmux_transmit_dlci2_ppp) { int ret; - uint32_t events; ret = modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_ppp_52, sizeof(cmux_frame_data_dlci2_ppp_52)); - zassert_true(ret == sizeof(cmux_frame_data_dlci2_ppp_52), "Failed to send DLCI2 PPP 52"); - - events = k_event_wait(&cmux_event, EVENT_CMUX_DLCI2_TRANSMIT_IDLE, false, K_MSEC(200)); - zassert_equal(events, EVENT_CMUX_DLCI2_TRANSMIT_IDLE, - "Transmit idle event not received for DLCI2 pipe"); - - k_event_clear(&cmux_event, EVENT_CMUX_DLCI2_TRANSMIT_IDLE); + zassert_true(ret == sizeof(cmux_frame_data_dlci2_ppp_52), "Failed to send DLCI2 PPP 52"); ret = modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_ppp_18, sizeof(cmux_frame_data_dlci2_ppp_18)); + zassert_true(ret == sizeof(cmux_frame_data_dlci2_ppp_18), "Failed to send DLCI2 PPP 18"); - events = k_event_wait(&cmux_event, EVENT_CMUX_DLCI2_TRANSMIT_IDLE, false, K_MSEC(200)); - zassert_equal(events, EVENT_CMUX_DLCI2_TRANSMIT_IDLE, - "Transmit idle event not received for DLCI2 pipe"); + k_msleep(100); ret = modem_backend_mock_get(&bus_mock, buffer2, sizeof(buffer2)); zassert_true(ret == (sizeof(cmux_frame_dlci2_ppp_52) + sizeof(cmux_frame_dlci2_ppp_18)), From 2696601c876e11c5320f6519a4d4d45494feff19 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:48 +0100 Subject: [PATCH 0876/2300] Revert "[nrf fromtree] modem: cmux: Implement TRANSMIT_IDLE event" This reverts commit b8288d540647a5f137aa21546c3ccf97be5e5b3a. Signed-off-by: Robert Lubos --- subsys/modem/modem_cmux.c | 58 +++++++++++---------------------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 13a153b8533..dc7c3915566 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -197,17 +197,8 @@ static void modem_cmux_bus_callback(struct modem_pipe *pipe, enum modem_pipe_eve { struct modem_cmux *cmux = (struct modem_cmux *)user_data; - switch (event) { - case MODEM_PIPE_EVENT_RECEIVE_READY: + if (event == MODEM_PIPE_EVENT_RECEIVE_READY) { k_work_schedule(&cmux->receive_work, K_NO_WAIT); - break; - - case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - k_work_schedule(&cmux->transmit_work, K_NO_WAIT); - break; - - default: - break; } } @@ -842,17 +833,6 @@ static void modem_cmux_receive_handler(struct k_work *item) k_work_schedule(&cmux->receive_work, K_NO_WAIT); } -static void modem_cmux_dlci_notify_transmit_idle(struct modem_cmux *cmux) -{ - sys_snode_t *node; - struct modem_cmux_dlci *dlci; - - SYS_SLIST_FOR_EACH_NODE(&cmux->dlcis, node) { - dlci = (struct modem_cmux_dlci *)node; - modem_pipe_notify_transmit_idle(&dlci->pipe); - } -} - static void modem_cmux_transmit_handler(struct k_work *item) { struct k_work_delayable *dwork = k_work_delayable_from_work(item); @@ -860,37 +840,31 @@ static void modem_cmux_transmit_handler(struct k_work *item) uint8_t *reserved; uint32_t reserved_size; int ret; - bool transmit_rb_empty; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); - while (true) { - transmit_rb_empty = ring_buf_is_empty(&cmux->transmit_rb); + /* Reserve data to transmit from transmit ring buffer */ + reserved_size = ring_buf_get_claim(&cmux->transmit_rb, &reserved, UINT32_MAX); - if (transmit_rb_empty) { - break; - } - - reserved_size = ring_buf_get_claim(&cmux->transmit_rb, &reserved, UINT32_MAX); + /* Transmit reserved data */ + ret = modem_pipe_transmit(cmux->pipe, reserved, reserved_size); + if (ret < 1) { + ring_buf_get_finish(&cmux->transmit_rb, 0); + k_mutex_unlock(&cmux->transmit_rb_lock); + k_work_schedule(&cmux->transmit_work, K_NO_WAIT); - ret = modem_pipe_transmit(cmux->pipe, reserved, reserved_size); - if (ret < 0) { - ring_buf_get_finish(&cmux->transmit_rb, 0); - break; - } + return; + } - ring_buf_get_finish(&cmux->transmit_rb, (uint32_t)ret); + /* Release remaining reserved data */ + ring_buf_get_finish(&cmux->transmit_rb, ret); - if (ret == 0) { - break; - } + /* Resubmit transmit work if data remains */ + if (ring_buf_is_empty(&cmux->transmit_rb) == false) { + k_work_schedule(&cmux->transmit_work, K_NO_WAIT); } k_mutex_unlock(&cmux->transmit_rb_lock); - - if (transmit_rb_empty) { - modem_cmux_dlci_notify_transmit_idle(cmux); - } } static void modem_cmux_connect_handler(struct k_work *item) From d8f1440680bad8eaed296f9c42c9b72da0a74de6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:48 +0100 Subject: [PATCH 0877/2300] Revert "[nrf fromtree] modem_cellular: add RSRP & RSRQ to U-blox SARA-R5 modem" This reverts commit b83915af7ad091c908e4ebd31e7424981d4619b8. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 78 +++------------------------------- 1 file changed, 6 insertions(+), 72 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index d1f3a69c94e..16530edde6c 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -33,16 +33,6 @@ LOG_MODULE_REGISTER(modem_cellular, CONFIG_MODEM_LOG_LEVEL); #define MODEM_CELLULAR_DATA_MANUFACTURER_LEN (64) #define MODEM_CELLULAR_DATA_FW_VERSION_LEN (64) -/* Magic constants */ -#define CSQ_RSSI_UNKNOWN (99) -#define CESQ_RSRP_UNKNOWN (255) -#define CESQ_RSRQ_UNKNOWN (255) - -/* Magic numbers to units conversions */ -#define CSQ_RSSI_TO_DB(v) (-113 + (2 * (rssi))) -#define CESQ_RSRP_TO_DB(v) (-140 + (v)) -#define CESQ_RSRQ_TO_DB(v) (-20 + ((v) / 2)) - enum modem_cellular_state { MODEM_CELLULAR_STATE_IDLE = 0, MODEM_CELLULAR_STATE_RESET_PULSE, @@ -105,8 +95,6 @@ struct modem_cellular_data { uint8_t registration_status_gprs; uint8_t registration_status_lte; uint8_t rssi; - uint8_t rsrp; - uint8_t rsrq; uint8_t imei[MODEM_CELLULAR_DATA_IMEI_LEN]; uint8_t model_id[MODEM_CELLULAR_DATA_MODEL_ID_LEN]; uint8_t imsi[MODEM_CELLULAR_DATA_IMSI_LEN]; @@ -352,19 +340,6 @@ static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uin data->rssi = (uint8_t)atoi(argv[1]); } -static void modem_cellular_chat_on_cesq(struct modem_chat *chat, char **argv, uint16_t argc, - void *user_data) -{ - struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; - - if (argc != 7) { - return; - } - - data->rsrq = (uint8_t)atoi(argv[5]); - data->rsrp = (uint8_t)atoi(argv[6]); -} - static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, uint16_t argc, void *user_data) { @@ -423,7 +398,6 @@ MODEM_CHAT_MATCHES_DEFINE(allow_match, MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); -MODEM_CHAT_MATCH_DEFINE(cesq_match, "+CESQ: ", ",", modem_cellular_chat_on_cesq); MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); @@ -1279,44 +1253,11 @@ static inline int modem_cellular_csq_parse_rssi(uint8_t rssi, int16_t *value) * - ber is an integer from 0 to 7 that describes the error rate, it can also * be 99 for an unknown error rate */ - if (rssi == CSQ_RSSI_UNKNOWN) { - return -EINVAL; - } - - *value = (int16_t)CSQ_RSSI_TO_DB(rssi); - return 0; -} - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(get_signal_cesq_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CESQ", cesq_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(get_signal_cesq_chat_script, get_signal_cesq_chat_script_cmds, - abort_matches, modem_cellular_chat_callback_handler, 2); - -/* AT+CESQ returns a response +CESQ: ,,,,, where: - * - rsrq is a integer from 0 to 34 whose values describes the Reference Signal Receive - * Quality between -20 dB for 0 and -3 dB for 34 (0.5 dB steps), or unknown for 255 - * - rsrp is an integer from 0 to 97 that describes the Reference Signal Receive Power - * between -140 dBm for 0 and -44 dBm for 97 (1 dBm steps), or unknown for 255 - */ -static inline int modem_cellular_cesq_parse_rsrp(uint8_t rsrp, int16_t *value) -{ - if (rsrp == CESQ_RSRP_UNKNOWN) { - return -EINVAL; - } - - *value = (int16_t)CESQ_RSRP_TO_DB(rsrp); - return 0; -} - -static inline int modem_cellular_cesq_parse_rsrq(uint8_t rsrq, int16_t *value) -{ - if (rsrq == CESQ_RSRQ_UNKNOWN) { + if (rssi == 99) { return -EINVAL; } - *value = (int16_t)CESQ_RSRQ_TO_DB(rsrq); + *value = (int16_t)(-113 + (2 * rssi)); return 0; } @@ -1340,7 +1281,8 @@ static int modem_cellular_get_signal(const struct device *dev, case CELLULAR_SIGNAL_RSRP: case CELLULAR_SIGNAL_RSRQ: - ret = modem_chat_run_script(&data->chat, &get_signal_cesq_chat_script); + /* TODO: Run CESQ script */ + ret = -ENOTSUP; break; default: @@ -1360,11 +1302,9 @@ static int modem_cellular_get_signal(const struct device *dev, break; case CELLULAR_SIGNAL_RSRP: - ret = modem_cellular_cesq_parse_rsrp(data->rsrp, value); - break; - case CELLULAR_SIGNAL_RSRQ: - ret = modem_cellular_cesq_parse_rsrq(data->rsrq, value); + /* TODO: Validate and set values */ + ret = -ENODATA; break; default: @@ -1804,12 +1744,6 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(u_blox_sara_r5_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMUX=0,0,5,127", ok_match)); MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r5_init_chat_script, u_blox_sara_r5_init_chat_script_cmds, From 45eb536b4205c6a3892c2eab2c80cd50abcefc0e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:48 +0100 Subject: [PATCH 0878/2300] Revert "[nrf fromtree] tests: modem: pipe: mock: Implement TRANSMIT_IDLE event" This reverts commit 469bad7589b2ff3beda485c49b2e79b833c1402b. Signed-off-by: Robert Lubos --- tests/subsys/modem/mock/modem_backend_mock.c | 24 ++++++-------------- tests/subsys/modem/mock/modem_backend_mock.h | 10 ++++++-- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/subsys/modem/mock/modem_backend_mock.c b/tests/subsys/modem/mock/modem_backend_mock.c index 5b7b47c0eb4..0a12fc43674 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.c +++ b/tests/subsys/modem/mock/modem_backend_mock.c @@ -47,8 +47,7 @@ static int modem_backend_mock_transmit(void *data, const uint8_t *buf, size_t si struct modem_backend_mock *t_mock = mock->bridge; ret = ring_buf_put(&t_mock->rx_rb, buf, size); - k_work_submit(&t_mock->receive_ready_work); - k_work_submit(&mock->transmit_idle_work); + k_work_submit(&t_mock->received_work_item.work); return ret; } @@ -60,7 +59,6 @@ static int modem_backend_mock_transmit(void *data, const uint8_t *buf, size_t si mock->transaction = NULL; } - k_work_submit(&mock->transmit_idle_work); return ret; } @@ -87,22 +85,14 @@ struct modem_pipe_api modem_backend_mock_api = { .close = modem_backend_mock_close, }; -static void modem_backend_mock_receive_ready_handler(struct k_work *item) +static void modem_backend_mock_received_handler(struct k_work *item) { - struct modem_backend_mock *mock = - CONTAINER_OF(item, struct modem_backend_mock, receive_ready_work); + struct modem_backend_mock_work *mock_work_item = (struct modem_backend_mock_work *)item; + struct modem_backend_mock *mock = mock_work_item->mock; modem_pipe_notify_receive_ready(&mock->pipe); } -static void modem_backend_mock_transmit_idle_handler(struct k_work *item) -{ - struct modem_backend_mock *mock = - CONTAINER_OF(item, struct modem_backend_mock, transmit_idle_work); - - modem_pipe_notify_transmit_idle(&mock->pipe); -} - struct modem_pipe *modem_backend_mock_init(struct modem_backend_mock *mock, const struct modem_backend_mock_config *config) { @@ -110,8 +100,8 @@ struct modem_pipe *modem_backend_mock_init(struct modem_backend_mock *mock, ring_buf_init(&mock->rx_rb, config->rx_buf_size, config->rx_buf); ring_buf_init(&mock->tx_rb, config->tx_buf_size, config->tx_buf); - k_work_init(&mock->receive_ready_work, modem_backend_mock_receive_ready_handler); - k_work_init(&mock->transmit_idle_work, modem_backend_mock_transmit_idle_handler); + mock->received_work_item.mock = mock; + k_work_init(&mock->received_work_item.work, modem_backend_mock_received_handler); mock->limit = config->limit; modem_pipe_init(&mock->pipe, mock, &modem_backend_mock_api); return &mock->pipe; @@ -140,7 +130,7 @@ void modem_backend_mock_put(struct modem_backend_mock *mock, const uint8_t *buf, __ASSERT(ring_buf_put(&mock->rx_rb, buf, size) == size, "Mock buffer capacity exceeded"); - k_work_submit(&mock->receive_ready_work); + k_work_submit(&mock->received_work_item.work); } void modem_backend_mock_prime(struct modem_backend_mock *mock, diff --git a/tests/subsys/modem/mock/modem_backend_mock.h b/tests/subsys/modem/mock/modem_backend_mock.h index 56a5b585cb1..7d9ad11bf41 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.h +++ b/tests/subsys/modem/mock/modem_backend_mock.h @@ -11,6 +11,13 @@ #ifndef ZEPHYR_DRIVERS_MODEM_MODEM_PIPE_MOCK #define ZEPHYR_DRIVERS_MODEM_MODEM_PIPE_MOCK +struct modem_backend_mock; + +struct modem_backend_mock_work { + struct k_work work; + struct modem_backend_mock *mock; +}; + struct modem_backend_mock_transaction { /* Get data which will trigger put */ const uint8_t *get; @@ -27,8 +34,7 @@ struct modem_backend_mock { struct ring_buf rx_rb; struct ring_buf tx_rb; - struct k_work receive_ready_work; - struct k_work transmit_idle_work; + struct modem_backend_mock_work received_work_item; const struct modem_backend_mock_transaction *transaction; size_t transaction_match_cnt; From 2e345c057fe295b8987e0a1c69e6bbf0afe02931 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:48 +0100 Subject: [PATCH 0879/2300] Revert "[nrf fromtree] modem: chat: Start waiting for response after request is sent" This reverts commit 861bf0c87539580efd0bd6ca575cd37aea151f78. Signed-off-by: Robert Lubos --- subsys/modem/modem_chat.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index f3857bcfbc3..7cf7692c514 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -95,10 +95,8 @@ static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_scri chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = NULL; chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = 0; - /* Cancel work */ + /* Cancel timeout work */ k_work_cancel_delayable(&chat->script_timeout_work); - k_work_cancel_delayable(&chat->script_send_work); - k_work_cancel_delayable(&chat->script_send_timeout_work); /* Clear script running state */ atomic_clear_bit(&chat->script_state, MODEM_CHAT_SCRIPT_STATE_RUNNING_BIT); @@ -120,21 +118,6 @@ static void modem_chat_script_send(struct modem_chat *chat) k_work_schedule(&chat->script_send_work, K_NO_WAIT); } -static void modem_chat_script_set_response_matches(struct modem_chat *chat) -{ - const struct modem_chat_script_chat *script_chat = - &chat->script->script_chats[chat->script_chat_it]; - - chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = script_chat->response_matches; - chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = script_chat->response_matches_size; -} - -static void modem_chat_script_clear_response_matches(struct modem_chat *chat) -{ - chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = NULL; - chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = 0; -} - static void modem_chat_script_next(struct modem_chat *chat, bool initial) { const struct modem_chat_script_chat *script_chat; @@ -159,13 +142,14 @@ static void modem_chat_script_next(struct modem_chat *chat, bool initial) script_chat = &chat->script->script_chats[chat->script_chat_it]; - /* Check if request must be sent */ + /* Set response command handlers */ + chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = script_chat->response_matches; + chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = script_chat->response_matches_size; + + /* Check if work must be sent */ if (script_chat->request_size > 0) { LOG_DBG("sending: %.*s", script_chat->request_size, script_chat->request); - modem_chat_script_clear_response_matches(chat); modem_chat_script_send(chat); - } else { - modem_chat_script_set_response_matches(chat); } } @@ -338,8 +322,6 @@ static void modem_chat_script_send_handler(struct k_work *item) } else { k_work_schedule(&chat->script_send_timeout_work, K_MSEC(timeout)); } - } else { - modem_chat_script_set_response_matches(chat); } } From e4f33c2c375320e78a5f7cf0e56037574fc4f2aa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:48 +0100 Subject: [PATCH 0880/2300] Revert "[nrf fromtree] modem: modem_cmux: optimize modem_cmux_transmit_frame to save ROM" This reverts commit 646e31ea443402f9360c7deb1faf13c107d7a2c5. Signed-off-by: Robert Lubos --- subsys/modem/modem_cmux.c | 46 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index dc7c3915566..472d1a7149a 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -205,55 +205,57 @@ static void modem_cmux_bus_callback(struct modem_pipe *pipe, enum modem_pipe_eve static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, const struct modem_cmux_frame *frame) { - uint8_t buf[MODEM_CMUX_FRAME_SIZE_MAX]; + uint8_t byte; uint8_t fcs; uint16_t space; uint16_t data_len; - uint16_t buf_idx; space = ring_buf_space_get(&cmux->transmit_rb) - MODEM_CMUX_FRAME_SIZE_MAX; data_len = (space < frame->data_len) ? space : frame->data_len; /* SOF */ - buf[0] = 0xF9; + byte = 0xF9; + ring_buf_put(&cmux->transmit_rb, &byte, 1); /* DLCI Address (Max 63) */ - buf[1] = 0x01 | (frame->cr << 1) | (frame->dlci_address << 2); + byte = 0x01 | (frame->cr << 1) | (frame->dlci_address << 2); + fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, MODEM_CMUX_FCS_INIT_VALUE, true); + ring_buf_put(&cmux->transmit_rb, &byte, 1); /* Frame type and poll/final */ - buf[2] = frame->type | (frame->pf << 4); + byte = frame->type | (frame->pf << 4); + fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); + ring_buf_put(&cmux->transmit_rb, &byte, 1); /* Data length */ if (data_len > 127) { - buf[3] = data_len << 1; - buf[4] = data_len >> 7; - buf_idx = 5; + byte = data_len << 1; + fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); + ring_buf_put(&cmux->transmit_rb, &byte, 1); + byte = data_len >> 7; + ring_buf_put(&cmux->transmit_rb, &byte, 1); } else { - buf[3] = 0x01 | (data_len << 1); - buf_idx = 4; + byte = 0x01 | (data_len << 1); + ring_buf_put(&cmux->transmit_rb, &byte, 1); } - /* 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 final */ if (frame->type == MODEM_CMUX_FRAME_TYPE_UIH) { - fcs = 0xFF - fcs; + fcs = 0xFF - crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); } else { + fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); fcs = 0xFF - crc8(frame->data, data_len, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); } - /* Frame header */ - ring_buf_put(&cmux->transmit_rb, buf, buf_idx); - /* Data */ ring_buf_put(&cmux->transmit_rb, frame->data, data_len); - /* FCS and EOF will be put on the same call */ - buf[0] = fcs; - buf[1] = 0xF9; - ring_buf_put(&cmux->transmit_rb, buf, 2); + /* FCS */ + ring_buf_put(&cmux->transmit_rb, &fcs, 1); + + /* EOF */ + byte = 0xF9; + ring_buf_put(&cmux->transmit_rb, &byte, 1); k_work_schedule(&cmux->transmit_work, K_NO_WAIT); return data_len; } From a50ad850fdd7f8c10ead92b138da1b085962f1b0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:48 +0100 Subject: [PATCH 0881/2300] Revert "[nrf fromtree] modem: pipe: Add test suite" This reverts commit 2e69f96276887085af2a0f248d8341c33aaa0fb4. Signed-off-by: Robert Lubos --- tests/subsys/modem/modem_pipe/CMakeLists.txt | 8 - tests/subsys/modem/modem_pipe/prj.conf | 8 - tests/subsys/modem/modem_pipe/src/main.c | 401 ------------------- tests/subsys/modem/modem_pipe/testcase.yaml | 8 - 4 files changed, 425 deletions(-) delete mode 100644 tests/subsys/modem/modem_pipe/CMakeLists.txt delete mode 100644 tests/subsys/modem/modem_pipe/prj.conf delete mode 100644 tests/subsys/modem/modem_pipe/src/main.c delete mode 100644 tests/subsys/modem/modem_pipe/testcase.yaml diff --git a/tests/subsys/modem/modem_pipe/CMakeLists.txt b/tests/subsys/modem/modem_pipe/CMakeLists.txt deleted file mode 100644 index 9d160a67720..00000000000 --- a/tests/subsys/modem/modem_pipe/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023 Trackunit Corporation -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(modem_pipe_test) - -target_sources(app PRIVATE src/main.c) diff --git a/tests/subsys/modem/modem_pipe/prj.conf b/tests/subsys/modem/modem_pipe/prj.conf deleted file mode 100644 index ab3228738b9..00000000000 --- a/tests/subsys/modem/modem_pipe/prj.conf +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023 Trackunit Corporation -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_NO_OPTIMIZATIONS=y -CONFIG_MODEM_MODULES=y -CONFIG_MODEM_PIPE=y -CONFIG_EVENTS=y -CONFIG_ZTEST=y diff --git a/tests/subsys/modem/modem_pipe/src/main.c b/tests/subsys/modem/modem_pipe/src/main.c deleted file mode 100644 index 07cc93decfe..00000000000 --- a/tests/subsys/modem/modem_pipe/src/main.c +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright (c) 2023 Trackunit Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/*************************************************************************************************/ -/* Dependencies */ -/*************************************************************************************************/ -#include -#include -#include -#include -#include - -#define TEST_MODEM_PIPE_EVENT_OPENED_BIT 0 -#define TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT 1 -#define TEST_MODEM_PIPE_EVENT_RECEIVE_READY_BIT 2 -#define TEST_MODEM_PIPE_EVENT_CLOSED_BIT 3 -#define TEST_MODEM_PIPE_NOTIFY_TIMEOUT K_MSEC(10) -#define TEST_MODEM_PIPE_WAIT_TIMEOUT K_MSEC(20) - -/*************************************************************************************************/ -/* Fake modem_pipe backend */ -/*************************************************************************************************/ -struct modem_backend_fake { - struct modem_pipe pipe; - - struct k_work_delayable opened_dwork; - struct k_work_delayable transmit_idle_dwork; - struct k_work_delayable closed_dwork; - - const uint8_t *transmit_buffer; - size_t transmit_buffer_size; - - uint8_t *receive_buffer; - size_t receive_buffer_size; - - uint8_t synchronous : 1; - uint8_t open_called : 1; - uint8_t transmit_called : 1; - uint8_t receive_called : 1; - uint8_t close_called : 1; -}; - -static void modem_backend_fake_opened_handler(struct k_work *item) -{ - struct k_work_delayable *dwork = k_work_delayable_from_work(item); - struct modem_backend_fake *backend = - CONTAINER_OF(dwork, struct modem_backend_fake, opened_dwork); - - modem_pipe_notify_opened(&backend->pipe); -} - -static int modem_backend_fake_open(void *data) -{ - struct modem_backend_fake *backend = data; - - backend->open_called = true; - - if (backend->synchronous) { - modem_pipe_notify_opened(&backend->pipe); - } else { - k_work_schedule(&backend->opened_dwork, TEST_MODEM_PIPE_NOTIFY_TIMEOUT); - } - - return 0; -} - -static void modem_backend_fake_transmit_idle_handler(struct k_work *item) -{ - struct k_work_delayable *dwork = k_work_delayable_from_work(item); - struct modem_backend_fake *backend = - CONTAINER_OF(dwork, struct modem_backend_fake, transmit_idle_dwork); - - modem_pipe_notify_transmit_idle(&backend->pipe); -} - -static int modem_backend_fake_transmit(void *data, const uint8_t *buf, size_t size) -{ - struct modem_backend_fake *backend = data; - - backend->transmit_called = true; - backend->transmit_buffer = buf; - backend->transmit_buffer_size = size; - - if (backend->synchronous) { - modem_pipe_notify_transmit_idle(&backend->pipe); - } else { - k_work_schedule(&backend->transmit_idle_dwork, TEST_MODEM_PIPE_NOTIFY_TIMEOUT); - } - - return size; -} - -static int modem_backend_fake_receive(void *data, uint8_t *buf, size_t size) -{ - struct modem_backend_fake *backend = data; - - backend->receive_called = true; - backend->receive_buffer = buf; - backend->receive_buffer_size = size; - return size; -} - -static void modem_backend_fake_closed_handler(struct k_work *item) -{ - struct k_work_delayable *dwork = k_work_delayable_from_work(item); - struct modem_backend_fake *backend = - CONTAINER_OF(dwork, struct modem_backend_fake, closed_dwork); - - modem_pipe_notify_closed(&backend->pipe); -} - -static int modem_backend_fake_close(void *data) -{ - struct modem_backend_fake *backend = data; - - backend->close_called = true; - - if (backend->synchronous) { - modem_pipe_notify_closed(&backend->pipe); - } else { - k_work_schedule(&backend->closed_dwork, TEST_MODEM_PIPE_NOTIFY_TIMEOUT); - } - - return 0; -} - -static struct modem_pipe_api modem_backend_fake_api = { - .open = modem_backend_fake_open, - .transmit = modem_backend_fake_transmit, - .receive = modem_backend_fake_receive, - .close = modem_backend_fake_close, -}; - -static struct modem_pipe *modem_backend_fake_init(struct modem_backend_fake *backend) -{ - k_work_init_delayable(&backend->opened_dwork, - modem_backend_fake_opened_handler); - k_work_init_delayable(&backend->transmit_idle_dwork, - modem_backend_fake_transmit_idle_handler); - k_work_init_delayable(&backend->closed_dwork, - modem_backend_fake_closed_handler); - - modem_pipe_init(&backend->pipe, backend, &modem_backend_fake_api); - return &backend->pipe; -} - -static void modem_backend_fake_reset(struct modem_backend_fake *backend) -{ - backend->transmit_buffer = NULL; - backend->transmit_buffer_size = 0; - backend->receive_buffer = NULL; - backend->transmit_buffer_size = 0; - backend->open_called = false; - backend->transmit_called = false; - backend->receive_called = false; - backend->close_called = false; -} - -static void modem_backend_fake_set_sync(struct modem_backend_fake *backend, bool sync) -{ - backend->synchronous = sync; -} - -/*************************************************************************************************/ -/* Instances */ -/*************************************************************************************************/ -static struct modem_backend_fake test_backend; -static struct modem_pipe *test_pipe; -static uint32_t test_user_data; -static atomic_t test_state; -static uint8_t test_buffer[4]; -static size_t test_buffer_size = sizeof(test_buffer); - -/*************************************************************************************************/ -/* Callbacks */ -/*************************************************************************************************/ -static void modem_pipe_fake_handler(struct modem_pipe *pipe, enum modem_pipe_event event, - void *user_data) -{ - __ASSERT(pipe == test_pipe, "Incorrect pipe provided with callback"); - __ASSERT(user_data == (void *)&test_user_data, "Incorrect user data ptr"); - - switch (event) { - case MODEM_PIPE_EVENT_OPENED: - atomic_set_bit(&test_state, TEST_MODEM_PIPE_EVENT_OPENED_BIT); - break; - - case MODEM_PIPE_EVENT_RECEIVE_READY: - atomic_set_bit(&test_state, TEST_MODEM_PIPE_EVENT_RECEIVE_READY_BIT); - break; - - case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - atomic_set_bit(&test_state, TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT); - break; - - case MODEM_PIPE_EVENT_CLOSED: - atomic_set_bit(&test_state, TEST_MODEM_PIPE_EVENT_CLOSED_BIT); - break; - } -} - -static void test_reset(void) -{ - modem_backend_fake_reset(&test_backend); - atomic_set(&test_state, 0); -} - -static void *modem_backend_fake_setup(void) -{ - test_pipe = modem_backend_fake_init(&test_backend); - return NULL; -} - -static void modem_backend_fake_before(void *f) -{ - modem_backend_fake_set_sync(&test_backend, false); - modem_pipe_attach(test_pipe, modem_pipe_fake_handler, &test_user_data); - test_reset(); -} - -static void modem_backend_fake_after(void *f) -{ - __ASSERT(modem_pipe_close(test_pipe) == 0, "Failed to close pipe"); - modem_pipe_release(test_pipe); -} - -/* Opening pipe shall raise events OPENED and TRANSMIT_IDLE */ -static void test_pipe_open(void) -{ - zassert_ok(modem_pipe_open(test_pipe), "Failed to open pipe"); - zassert_true(test_backend.open_called, "open was not called"); - zassert_equal(atomic_get(&test_state), - BIT(TEST_MODEM_PIPE_EVENT_OPENED_BIT) | - BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT), - "Unexpected state %u", atomic_get(&test_state)); -} - -/* Re-opening pipe shall have no effect */ -static void test_pipe_reopen(void) -{ - zassert_ok(modem_pipe_open(test_pipe), "Failed to re-open pipe"); - zassert_false(test_backend.open_called, "open was called"); - zassert_equal(atomic_get(&test_state), 0, - "Unexpected state %u", atomic_get(&test_state)); -} - -/* Closing pipe shall raise event CLOSED */ -static void test_pipe_close(void) -{ - zassert_ok(modem_pipe_close(test_pipe), "Failed to close pipe"); - zassert_true(test_backend.close_called, "close was not called"); - zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_CLOSED_BIT), - "Unexpected state %u", atomic_get(&test_state)); -} - -/* Re-closing pipe shall have no effect */ -static void test_pipe_reclose(void) -{ - zassert_ok(modem_pipe_close(test_pipe), "Failed to re-close pipe"); - zassert_false(test_backend.close_called, "close was called"); - zassert_equal(atomic_get(&test_state), 0, - "Unexpected state %u", atomic_get(&test_state)); -} - -static void test_pipe_async_transmit(void) -{ - zassert_equal(modem_pipe_transmit(test_pipe, test_buffer, test_buffer_size), - test_buffer_size, "Failed to transmit"); - zassert_true(test_backend.transmit_called, "transmit was not called"); - zassert_equal(test_backend.transmit_buffer, test_buffer, "Incorrect buffer"); - zassert_equal(test_backend.transmit_buffer_size, test_buffer_size, - "Incorrect buffer size"); - zassert_equal(atomic_get(&test_state), 0, "Unexpected state %u", - atomic_get(&test_state)); - k_sleep(TEST_MODEM_PIPE_WAIT_TIMEOUT); - zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT), - "Unexpected state %u", atomic_get(&test_state)); -} - -static void test_pipe_sync_transmit(void) -{ - zassert_equal(modem_pipe_transmit(test_pipe, test_buffer, test_buffer_size), - test_buffer_size, "Failed to transmit"); - zassert_true(test_backend.transmit_called, "transmit was not called"); - zassert_equal(test_backend.transmit_buffer, test_buffer, "Incorrect buffer"); - zassert_equal(test_backend.transmit_buffer_size, test_buffer_size, - "Incorrect buffer size"); - zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT), - "Unexpected state %u", atomic_get(&test_state)); -} - -static void test_pipe_attach_receive_not_ready_transmit_idle(void) -{ - modem_pipe_attach(test_pipe, modem_pipe_fake_handler, &test_user_data); - zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT), - "Unexpected state %u", atomic_get(&test_state)); -} - -static void test_pipe_attach_receive_ready_transmit_idle(void) -{ - modem_pipe_attach(test_pipe, modem_pipe_fake_handler, &test_user_data); - zassert_equal(atomic_get(&test_state), - BIT(TEST_MODEM_PIPE_EVENT_TRANSMIT_IDLE_BIT) | - BIT(TEST_MODEM_PIPE_EVENT_RECEIVE_READY_BIT), - "Unexpected state %u", atomic_get(&test_state)); -} - -static void test_pipe_receive(void) -{ - zassert_equal(modem_pipe_receive(test_pipe, test_buffer, test_buffer_size), - test_buffer_size, "Failed to receive"); - zassert_true(test_backend.receive_called, "receive was not called"); - zassert_equal(test_backend.receive_buffer, test_buffer, "Incorrect buffer"); - zassert_equal(test_backend.receive_buffer_size, test_buffer_size, - "Incorrect buffer size"); - zassert_equal(atomic_get(&test_state), 0, "Unexpected state %u", - atomic_get(&test_state)); -} - -static void test_pipe_notify_receive_ready(void) -{ - modem_pipe_notify_receive_ready(test_pipe); - zassert_equal(atomic_get(&test_state), BIT(TEST_MODEM_PIPE_EVENT_RECEIVE_READY_BIT), - "Unexpected state %u", atomic_get(&test_state)); -} - -ZTEST(modem_pipe, test_async_open_close) -{ - test_pipe_open(); - test_reset(); - test_pipe_reopen(); - test_reset(); - test_pipe_close(); - test_reset(); - test_pipe_reclose(); -} - -ZTEST(modem_pipe, test_sync_open_close) -{ - modem_backend_fake_set_sync(&test_backend, true); - test_pipe_open(); - test_reset(); - test_pipe_reopen(); - test_reset(); - test_pipe_close(); - test_reset(); - test_pipe_reclose(); -} - -ZTEST(modem_pipe, test_async_transmit) -{ - test_pipe_open(); - test_reset(); - test_pipe_async_transmit(); -} - -ZTEST(modem_pipe, test_sync_transmit) -{ - modem_backend_fake_set_sync(&test_backend, true); - test_pipe_open(); - test_reset(); - test_pipe_sync_transmit(); -} - -ZTEST(modem_pipe, test_attach) -{ - test_pipe_open(); - - /* - * Attaching pipe shall reinvoke TRANSMIT IDLE, but not RECEIVE READY as - * receive is not ready. - */ - test_reset(); - test_pipe_attach_receive_not_ready_transmit_idle(); - - /* - * Notify receive ready and expect receive ready to be re-invoked every - * time the pipe is attached to. - */ - test_reset(); - test_pipe_notify_receive_ready(); - test_reset(); - test_pipe_attach_receive_ready_transmit_idle(); - test_reset(); - test_pipe_attach_receive_ready_transmit_idle(); - - /* - * Receiving data from the pipe shall clear the receive ready state, stopping - * the invocation of receive ready on attach. - */ - test_reset(); - test_pipe_receive(); - test_reset(); - test_pipe_attach_receive_not_ready_transmit_idle(); -} - -ZTEST_SUITE(modem_pipe, NULL, modem_backend_fake_setup, modem_backend_fake_before, - modem_backend_fake_after, NULL); diff --git a/tests/subsys/modem/modem_pipe/testcase.yaml b/tests/subsys/modem/modem_pipe/testcase.yaml deleted file mode 100644 index 39a8c8e6c2c..00000000000 --- a/tests/subsys/modem/modem_pipe/testcase.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023 Trackunit Corporation -# SPDX-License-Identifier: Apache-2.0 - -tests: - modem.modem_pipe: - tags: modem_pipe - harness: ztest - platform_allow: native_sim From b6bcd95e39438b9c44528932d775db4d6f8862ad Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:49 +0100 Subject: [PATCH 0882/2300] Revert "[nrf fromtree] modem: backend: tty: Implement transmit idle event" This reverts commit ffc3c8c6aa24c0b459bfc7b5d725b9699cff7680. Signed-off-by: Robert Lubos --- subsys/modem/backends/modem_backend_tty.c | 5 +---- tests/subsys/modem/backends/tty/src/main.c | 18 +----------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/subsys/modem/backends/modem_backend_tty.c b/subsys/modem/backends/modem_backend_tty.c index 8375183be48..b8864fc3d91 100644 --- a/subsys/modem/backends/modem_backend_tty.c +++ b/subsys/modem/backends/modem_backend_tty.c @@ -73,11 +73,8 @@ static int modem_backend_tty_open(void *data) static int modem_backend_tty_transmit(void *data, const uint8_t *buf, size_t size) { struct modem_backend_tty *backend = (struct modem_backend_tty *)data; - int ret; - ret = write(backend->tty_fd, buf, size); - modem_pipe_notify_transmit_idle(&backend->pipe); - return ret; + return write(backend->tty_fd, buf, size); } static int modem_backend_tty_receive(void *data, uint8_t *buf, size_t size) diff --git a/tests/subsys/modem/backends/tty/src/main.c b/tests/subsys/modem/backends/tty/src/main.c index 96ebdb2763d..49a1841486a 100644 --- a/tests/subsys/modem/backends/tty/src/main.c +++ b/tests/subsys/modem/backends/tty/src/main.c @@ -22,8 +22,7 @@ #define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_OPENED_BIT (0) #define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_RRDY_BIT (1) -#define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT (2) -#define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_CLOSED_BIT (3) +#define TEST_MODEM_BACKEND_TTY_PIPE_EVENT_CLOSED_BIT (2) #define TEST_MODEM_BACKEND_TTY_OP_DELAY (K_MSEC(1000)) @@ -73,10 +72,6 @@ static void modem_pipe_callback_handler(struct modem_pipe *pipe, enum modem_pipe atomic_set_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_RRDY_BIT); break; - case MODEM_PIPE_EVENT_TRANSMIT_IDLE: - atomic_set_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT); - break; - case MODEM_PIPE_EVENT_CLOSED: atomic_set_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_CLOSED_BIT); break; @@ -127,13 +122,9 @@ static void test_modem_backend_tty_teardown(void *f) /*************************************************************************************************/ ZTEST(modem_backend_tty_suite, test_close_open) { - bool result; - zassert_ok(modem_pipe_close(tty_pipe), "Failed to close pipe"); zassert_ok(modem_pipe_close(tty_pipe), "Pipe should already be closed"); zassert_ok(modem_pipe_open(tty_pipe), "Failed to open pipe"); - result = atomic_test_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT); - zassert_true(result, "Transmit idle event should be set"); zassert_ok(modem_pipe_open(tty_pipe), "Pipe should already be open"); } @@ -181,19 +172,12 @@ ZTEST(modem_backend_tty_suite, test_transmit) { int ret; char msg[] = "Test me buddy 2"; - bool result; - - result = atomic_test_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT); - zassert_false(result, "Transmit idle event should not be set"); ret = modem_pipe_transmit(tty_pipe, msg, sizeof(msg)); zassert_true(ret == sizeof(msg), "Failed to transmit using pipe"); k_sleep(TEST_MODEM_BACKEND_TTY_OP_DELAY); - result = atomic_test_bit(&tty_pipe_events, TEST_MODEM_BACKEND_TTY_PIPE_EVENT_TIDLE_BIT); - zassert_true(result, "Transmit idle event should be set"); - ret = read(primary_fd, buffer1, sizeof(buffer1)); zassert_true(ret == sizeof(msg), "Read incorrect number of bytes"); ret = memcmp(msg, buffer1, sizeof(msg)); From 3fdbf87ace7d94dfe77435b61aa8ebbe70c13ad0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:49 +0100 Subject: [PATCH 0883/2300] Revert "[nrf fromtree] modem: backend: uart: Implement transmit idle event" This reverts commit 1f341f90c8a86acce58659780d8378cd93408ef1. Signed-off-by: Robert Lubos --- include/zephyr/modem/backend/uart.h | 1 - subsys/modem/backends/modem_backend_uart.c | 9 --------- subsys/modem/backends/modem_backend_uart_async.c | 2 -- subsys/modem/backends/modem_backend_uart_isr.c | 1 - 4 files changed, 13 deletions(-) diff --git a/include/zephyr/modem/backend/uart.h b/include/zephyr/modem/backend/uart.h index 5f9f99370a0..0ddef4df734 100644 --- a/include/zephyr/modem/backend/uart.h +++ b/include/zephyr/modem/backend/uart.h @@ -43,7 +43,6 @@ struct modem_backend_uart { const struct device *uart; struct modem_pipe pipe; struct k_work receive_ready_work; - struct k_work transmit_idle_work; union { struct modem_backend_uart_isr isr; diff --git a/subsys/modem/backends/modem_backend_uart.c b/subsys/modem/backends/modem_backend_uart.c index a8348b0b8a0..b4b0b81c291 100644 --- a/subsys/modem/backends/modem_backend_uart.c +++ b/subsys/modem/backends/modem_backend_uart.c @@ -22,14 +22,6 @@ static void modem_backend_uart_receive_ready_handler(struct k_work *item) modem_pipe_notify_receive_ready(&backend->pipe); } -static void modem_backend_uart_transmit_idle_handler(struct k_work *item) -{ - struct modem_backend_uart *backend = - CONTAINER_OF(item, struct modem_backend_uart, transmit_idle_work); - - modem_pipe_notify_transmit_idle(&backend->pipe); -} - struct modem_pipe *modem_backend_uart_init(struct modem_backend_uart *backend, const struct modem_backend_uart_config *config) { @@ -43,7 +35,6 @@ struct modem_pipe *modem_backend_uart_init(struct modem_backend_uart *backend, memset(backend, 0x00, sizeof(*backend)); backend->uart = config->uart; k_work_init(&backend->receive_ready_work, modem_backend_uart_receive_ready_handler); - k_work_init(&backend->transmit_idle_work, modem_backend_uart_transmit_idle_handler); #ifdef CONFIG_MODEM_BACKEND_UART_ASYNC if (modem_backend_uart_async_is_supported(backend)) { diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 63d5a219a72..6e7481d4e7d 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -44,7 +44,6 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, case UART_TX_DONE: atomic_clear_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT); - k_work_submit(&backend->transmit_idle_work); break; @@ -52,7 +51,6 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, LOG_WRN("Transmit aborted"); atomic_clear_bit(&backend->async.state, MODEM_BACKEND_UART_ASYNC_STATE_TRANSMITTING_BIT); - k_work_submit(&backend->transmit_idle_work); break; diff --git a/subsys/modem/backends/modem_backend_uart_isr.c b/subsys/modem/backends/modem_backend_uart_isr.c index 8a7075e3519..7c88cb4673c 100644 --- a/subsys/modem/backends/modem_backend_uart_isr.c +++ b/subsys/modem/backends/modem_backend_uart_isr.c @@ -56,7 +56,6 @@ static void modem_backend_uart_isr_irq_handler_transmit_ready(struct modem_backe if (ring_buf_is_empty(&backend->isr.transmit_rb) == true) { uart_irq_tx_disable(backend->uart); - k_work_submit(&backend->transmit_idle_work); return; } From 92719380c07cb0fac0106d6c2c3a315167230fc7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:49 +0100 Subject: [PATCH 0884/2300] Revert "[nrf fromtree] modem: pipe: Add TRANSMIT_IDLE event" This reverts commit 893ce44e201f4a678129a5d9174163af6f969851. Signed-off-by: Robert Lubos --- include/zephyr/modem/pipe.h | 13 +------------ subsys/modem/modem_pipe.c | 21 --------------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/include/zephyr/modem/pipe.h b/include/zephyr/modem/pipe.h index a741a94a34c..abf8d74918e 100644 --- a/include/zephyr/modem/pipe.h +++ b/include/zephyr/modem/pipe.h @@ -25,7 +25,6 @@ extern "C" { enum modem_pipe_event { MODEM_PIPE_EVENT_OPENED = 0, MODEM_PIPE_EVENT_RECEIVE_READY, - MODEM_PIPE_EVENT_TRANSMIT_IDLE, MODEM_PIPE_EVENT_CLOSED, }; @@ -74,8 +73,7 @@ struct modem_pipe { enum modem_pipe_state state; struct k_mutex lock; struct k_condvar condvar; - uint8_t receive_ready_pending : 1; - uint8_t transmit_idle_pending : 1; + bool receive_ready_pending; }; /** @@ -215,15 +213,6 @@ void modem_pipe_notify_closed(struct modem_pipe *pipe); */ void modem_pipe_notify_receive_ready(struct modem_pipe *pipe); -/** - * @brief Notify user of pipe that pipe has no more data to transmit - * - * @param pipe Pipe instance - * - * @note Invoked from instance which initialized the pipe instance - */ -void modem_pipe_notify_transmit_idle(struct modem_pipe *pipe); - /** * @endcond */ diff --git a/subsys/modem/modem_pipe.c b/subsys/modem/modem_pipe.c index b0088fdefed..01bdac50d3a 100644 --- a/subsys/modem/modem_pipe.c +++ b/subsys/modem/modem_pipe.c @@ -21,7 +21,6 @@ void modem_pipe_init(struct modem_pipe *pipe, void *data, struct modem_pipe_api pipe->user_data = NULL; pipe->state = MODEM_PIPE_STATE_CLOSED; pipe->receive_ready_pending = false; - pipe->transmit_idle_pending = true; k_mutex_init(&pipe->lock); k_condvar_init(&pipe->condvar); @@ -83,10 +82,6 @@ void modem_pipe_attach(struct modem_pipe *pipe, modem_pipe_api_callback callback pipe->callback(pipe, MODEM_PIPE_EVENT_RECEIVE_READY, pipe->user_data); } - if (pipe->transmit_idle_pending && (pipe->callback != NULL)) { - pipe->callback(pipe, MODEM_PIPE_EVENT_TRANSMIT_IDLE, pipe->user_data); - } - k_mutex_unlock(&pipe->lock); } @@ -102,7 +97,6 @@ int modem_pipe_transmit(struct modem_pipe *pipe, const uint8_t *buf, size_t size } ret = pipe->api->transmit(pipe->data, buf, size); - pipe->transmit_idle_pending = false; k_mutex_unlock(&pipe->lock); return ret; } @@ -185,7 +179,6 @@ void modem_pipe_notify_opened(struct modem_pipe *pipe) if (pipe->callback != NULL) { pipe->callback(pipe, MODEM_PIPE_EVENT_OPENED, pipe->user_data); - pipe->callback(pipe, MODEM_PIPE_EVENT_TRANSMIT_IDLE, pipe->user_data); } k_condvar_signal(&pipe->condvar); @@ -197,7 +190,6 @@ void modem_pipe_notify_closed(struct modem_pipe *pipe) k_mutex_lock(&pipe->lock, K_FOREVER); pipe->state = MODEM_PIPE_STATE_CLOSED; pipe->receive_ready_pending = false; - pipe->transmit_idle_pending = true; if (pipe->callback != NULL) { pipe->callback(pipe, MODEM_PIPE_EVENT_CLOSED, pipe->user_data); @@ -219,16 +211,3 @@ void modem_pipe_notify_receive_ready(struct modem_pipe *pipe) k_mutex_unlock(&pipe->lock); } - -void modem_pipe_notify_transmit_idle(struct modem_pipe *pipe) -{ - k_mutex_lock(&pipe->lock, K_FOREVER); - - pipe->transmit_idle_pending = true; - - if (pipe->callback != NULL) { - pipe->callback(pipe, MODEM_PIPE_EVENT_TRANSMIT_IDLE, pipe->user_data); - } - - k_mutex_unlock(&pipe->lock); -} From ea0a0f9417c37bfb7fa9c2df0814beda2bd3f2aa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:49 +0100 Subject: [PATCH 0885/2300] Revert "[nrf fromtree] tests: subsys: modem: cmux: Update resync unit test" This reverts commit ada67f53d9507ec3726100258c91674b109f3b27. Signed-off-by: Robert Lubos --- tests/subsys/modem/modem_cmux/src/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/subsys/modem/modem_cmux/src/main.c b/tests/subsys/modem/modem_cmux/src/main.c index d601eeb1446..9df6837efc5 100644 --- a/tests/subsys/modem/modem_cmux/src/main.c +++ b/tests/subsys/modem/modem_cmux/src/main.c @@ -144,6 +144,8 @@ static uint8_t cmux_frame_data_dlci1_at_newline[] = {0x0D, 0x0A}; /*************************************************************************************************/ static uint8_t cmux_frame_dlci1_at_at_desync[] = {0x41, 0x54, 0x30, 0xF9}; +static uint8_t cmux_frame_resync[] = {0xF9, 0xF9, 0xF9}; + /*************************************************************************************************/ /* DLCI2 PPP CMUX frames */ /*************************************************************************************************/ @@ -399,6 +401,15 @@ ZTEST(modem_cmux, test_modem_cmux_resync) modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_at_desync, sizeof(cmux_frame_dlci1_at_at_desync)); + + k_msleep(100); + + ret = modem_backend_mock_get(&bus_mock, buffer1, sizeof(buffer1)); + zassert_true(ret == sizeof(cmux_frame_resync), "Expected resync flags to be sent to bus"); + zassert_true(memcmp(buffer1, cmux_frame_resync, sizeof(cmux_frame_resync)) == 0, + "Expected resync flags to be sent to bus"); + + modem_backend_mock_put(&bus_mock, cmux_frame_resync, sizeof(cmux_frame_resync)); modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_at, sizeof(cmux_frame_dlci1_at_at)); modem_backend_mock_put(&bus_mock, cmux_frame_dlci1_at_newline, sizeof(cmux_frame_dlci1_at_newline)); From 9e3b625248c5d0ef2cc6682615241032f5408acf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:49 +0100 Subject: [PATCH 0886/2300] Revert "[nrf fromtree] modem: cmux: Simplify resync mechanism" This reverts commit 6045ceaffde8a2f0b4395a56fb6742724c45ff75. Signed-off-by: Robert Lubos --- include/zephyr/modem/cmux.h | 5 +++- subsys/modem/modem_cmux.c | 46 ++++++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/include/zephyr/modem/cmux.h b/include/zephyr/modem/cmux.h index 58959d6136b..4562cb544d9 100644 --- a/include/zephyr/modem/cmux.h +++ b/include/zephyr/modem/cmux.h @@ -63,7 +63,10 @@ enum modem_cmux_state { enum modem_cmux_receive_state { MODEM_CMUX_RECEIVE_STATE_SOF = 0, - MODEM_CMUX_RECEIVE_STATE_RESYNC, + MODEM_CMUX_RECEIVE_STATE_RESYNC_0, + MODEM_CMUX_RECEIVE_STATE_RESYNC_1, + MODEM_CMUX_RECEIVE_STATE_RESYNC_2, + MODEM_CMUX_RECEIVE_STATE_RESYNC_3, MODEM_CMUX_RECEIVE_STATE_ADDRESS, MODEM_CMUX_RECEIVE_STATE_ADDRESS_CONT, MODEM_CMUX_RECEIVE_STATE_CONTROL, diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 472d1a7149a..258f969c498 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -642,6 +642,13 @@ static void modem_cmux_on_frame(struct modem_cmux *cmux) modem_cmux_on_dlci_frame(cmux); } +static void modem_cmux_transmit_resync(struct modem_cmux *cmux) +{ + static const uint8_t resync[3] = {0xF9, 0xF9, 0xF9}; + + modem_pipe_transmit(cmux->pipe, resync, sizeof(resync)); +} + static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t byte) { uint8_t fcs; @@ -649,22 +656,45 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by switch (cmux->receive_state) { case MODEM_CMUX_RECEIVE_STATE_SOF: if (byte == 0xF9) { - cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC; + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_ADDRESS; break; } + modem_cmux_transmit_resync(cmux); + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; break; - case MODEM_CMUX_RECEIVE_STATE_RESYNC: - /* - * Allow any number of consequtive flags (0xF9). - * 0xF9 could also be a valid address field for DLCI 62. - */ + case MODEM_CMUX_RECEIVE_STATE_RESYNC_0: if (byte == 0xF9) { - break; + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_1; + } + + break; + + case MODEM_CMUX_RECEIVE_STATE_RESYNC_1: + if (byte == 0xF9) { + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_2; + } else { + modem_cmux_transmit_resync(cmux); + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; } - __fallthrough; + break; + + case MODEM_CMUX_RECEIVE_STATE_RESYNC_2: + if (byte == 0xF9) { + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_3; + } else { + modem_cmux_transmit_resync(cmux); + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; + } + + break; + + case MODEM_CMUX_RECEIVE_STATE_RESYNC_3: + if (byte == 0xF9) { + break; + } case MODEM_CMUX_RECEIVE_STATE_ADDRESS: /* Initialize */ From cd2fdc9fdfbb08a497234076e8de2b21616dec00 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:49 +0100 Subject: [PATCH 0887/2300] Revert "[nrf fromtree] modem: cmux: Add DLCI receive buffer overrun LOG WRN" This reverts commit 1509eb594e237e9b9856a569c6fee088bbd63308. Signed-off-by: Robert Lubos --- subsys/modem/modem_cmux.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 258f969c498..7f40fa6e95d 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -546,7 +546,6 @@ static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci) static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) { struct modem_cmux *cmux = dlci->cmux; - uint32_t written; if (dlci->state != MODEM_CMUX_DLCI_STATE_OPEN) { LOG_DBG("Unexpected UIH frame"); @@ -554,11 +553,8 @@ static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) } k_mutex_lock(&dlci->receive_rb_lock, K_FOREVER); - written = ring_buf_put(&dlci->receive_rb, cmux->frame.data, cmux->frame.data_len); + ring_buf_put(&dlci->receive_rb, cmux->frame.data, cmux->frame.data_len); k_mutex_unlock(&dlci->receive_rb_lock); - if (written != cmux->frame.data_len) { - LOG_WRN("DLCI %u receive buffer overrun", dlci->dlci_address); - } modem_pipe_notify_receive_ready(&dlci->pipe); } From a890e50d50a923c993278f68c124ac4501d48500 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:50 +0100 Subject: [PATCH 0888/2300] Revert "[nrf fromtree] modem: cmux: Patch resync mechanism" This reverts commit 9caac0b72dd741c2a071b9090401c97a61403cfd. Signed-off-by: Robert Lubos --- subsys/modem/modem_cmux.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 7f40fa6e95d..3ace00d6583 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -638,16 +638,10 @@ static void modem_cmux_on_frame(struct modem_cmux *cmux) modem_cmux_on_dlci_frame(cmux); } -static void modem_cmux_transmit_resync(struct modem_cmux *cmux) -{ - static const uint8_t resync[3] = {0xF9, 0xF9, 0xF9}; - - modem_pipe_transmit(cmux->pipe, resync, sizeof(resync)); -} - static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t byte) { uint8_t fcs; + static const uint8_t resync[3] = {0xF9, 0xF9, 0xF9}; switch (cmux->receive_state) { case MODEM_CMUX_RECEIVE_STATE_SOF: @@ -656,7 +650,10 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by break; } - modem_cmux_transmit_resync(cmux); + /* Send resync flags */ + modem_pipe_transmit(cmux->pipe, resync, sizeof(resync)); + + /* Await resync flags */ cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; break; @@ -671,7 +668,6 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by if (byte == 0xF9) { cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_2; } else { - modem_cmux_transmit_resync(cmux); cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; } @@ -681,7 +677,6 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by if (byte == 0xF9) { cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_3; } else { - modem_cmux_transmit_resync(cmux); cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_RESYNC_0; } From 61b3c94c04df5b12e286f141470e24ba732bad85 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:50 +0100 Subject: [PATCH 0889/2300] Revert "[nrf fromtree] modem: chat: Patch invalid dereference" This reverts commit fdc36654de16308a06e44ce7ca09c1b5411e5a7c. Signed-off-by: Robert Lubos --- subsys/modem/modem_chat.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/subsys/modem/modem_chat.c b/subsys/modem/modem_chat.c index 7cf7692c514..0ab1175f980 100644 --- a/subsys/modem/modem_chat.c +++ b/subsys/modem/modem_chat.c @@ -60,7 +60,7 @@ static void modem_chat_log_received_command(struct modem_chat *chat) static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_script_result result) { - if ((chat == NULL) || (chat->script == NULL)) { + if (!chat || !chat->script) { return; } @@ -78,14 +78,6 @@ static void modem_chat_script_stop(struct modem_chat *chat, enum modem_chat_scri chat->script->callback(chat, result, chat->user_data); } - /* Clear parse_match in case it is stored in the script being stopped */ - if ((chat->parse_match != NULL) && - ((chat->parse_match_type == MODEM_CHAT_MATCHES_INDEX_ABORT) || - (chat->parse_match_type == MODEM_CHAT_MATCHES_INDEX_RESPONSE))) { - chat->parse_match = NULL; - chat->parse_match_len = 0; - } - /* Clear reference to script */ chat->script = NULL; @@ -830,8 +822,4 @@ void modem_chat_release(struct modem_chat *chat) chat->parse_match = NULL; chat->parse_match_len = 0; chat->parse_arg_len = 0; - chat->matches[MODEM_CHAT_MATCHES_INDEX_ABORT] = NULL; - chat->matches_size[MODEM_CHAT_MATCHES_INDEX_ABORT] = 0; - chat->matches[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = NULL; - chat->matches_size[MODEM_CHAT_MATCHES_INDEX_RESPONSE] = 0; } From d241d3e50063bd0a6235ac04099933d628839607 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:50 +0100 Subject: [PATCH 0890/2300] Revert "[nrf fromtree] modem: modem_cellular.c: Remove non standard QCCID handler" This reverts commit 71d91e386a3e6080ea42c82bbbebc6adb2ae29ad. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 16530edde6c..78958bdec2c 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -348,6 +348,14 @@ static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, ui strncpy(data->imsi, (char *)argv[1], sizeof(data->imsi)); } +static void modem_cellular_chat_on_iccid(struct modem_chat *chat, char **argv, uint16_t argc, + void *user_data) +{ + struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; + + strncpy(data->iccid, (char *)argv[1], sizeof(data->iccid)); +} + static bool modem_cellular_is_registered(struct modem_cellular_data *data) { return (data->registration_status_gsm == 1) @@ -399,6 +407,7 @@ MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); +MODEM_CHAT_MATCH_DEFINE(ccid_match, "+QCCID: ", "", modem_cellular_chat_on_iccid); MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); @@ -1329,6 +1338,9 @@ static int modem_cellular_get_modem_info(const struct device *dev, case CELLULAR_MODEM_INFO_SIM_IMSI: strncpy(info, &data->imsi[0], MIN(size, sizeof(data->imsi))); break; + case CELLULAR_MODEM_INFO_SIM_ICCID: + strncpy(info, &data->iccid[0], MIN(size, sizeof(data->iccid))); + break; case CELLULAR_MODEM_INFO_MANUFACTURER: strncpy(info, &data->manufacturer[0], MIN(size, sizeof(data->manufacturer))); break; @@ -1510,6 +1522,8 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+QCCID", ccid_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127", 300)); MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_init_chat_script, quectel_bg95_init_chat_script_cmds, @@ -1557,6 +1571,8 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE( MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+QCCID", ccid_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127,10,3,30,10,2", 100)); MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_init_chat_script, quectel_eg25_g_init_chat_script_cmds, From 48813806e8dfeb99a233f9e551436f045ad083cc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:50 +0100 Subject: [PATCH 0891/2300] Revert "[nrf fromtree] modem: modem_cellular: Rework cellular_get_signal implementation" This reverts commit 2f55e3c3f6a9c45ef6149f296154254169d9a1f0. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 107 +++++++++++++++------------------ 1 file changed, 49 insertions(+), 58 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 78958bdec2c..ea39cecabaf 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -94,7 +94,7 @@ struct modem_cellular_data { uint8_t registration_status_gsm; uint8_t registration_status_gprs; uint8_t registration_status_lte; - uint8_t rssi; + int8_t rssi; uint8_t imei[MODEM_CELLULAR_DATA_IMEI_LEN]; uint8_t model_id[MODEM_CELLULAR_DATA_MODEL_ID_LEN]; uint8_t imsi[MODEM_CELLULAR_DATA_IMSI_LEN]; @@ -131,6 +131,7 @@ struct modem_cellular_config { const struct modem_chat_script *init_chat_script; const struct modem_chat_script *dial_chat_script; const struct modem_chat_script *periodic_chat_script; + const struct modem_chat_script *get_signal_chat_script; }; static const char *modem_cellular_state_str(enum modem_cellular_state state) @@ -331,13 +332,28 @@ static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, ui static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uint16_t argc, void *user_data) { + uint8_t rssi; + + /* AT+CSQ returns a response +CSQ: , where: + * - rssi is a integer from 0 to 31 whose values describes a signal strength + * between -113 dBm for 0 and -51dbM for 31 or unknown for 99 + * - ber is an integer from 0 to 7 that describes the error rate, it can also + * be 99 for an unknown error rate + */ struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; if (argc != 3) { return; } - data->rssi = (uint8_t)atoi(argv[1]); + /* Read rssi */ + rssi = atoi(argv[1]); + + if (rssi == 99) { + return; + } + + data->rssi = (-113 + (2 * rssi)); } static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, uint16_t argc, @@ -1247,78 +1263,36 @@ static void modem_cellular_cmux_handler(struct modem_cmux *cmux, enum modem_cmux } } -MODEM_CHAT_SCRIPT_CMDS_DEFINE(get_signal_csq_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(get_signal_csq_chat_script, get_signal_csq_chat_script_cmds, - abort_matches, modem_cellular_chat_callback_handler, 2); - -static inline int modem_cellular_csq_parse_rssi(uint8_t rssi, int16_t *value) -{ - /* AT+CSQ returns a response +CSQ: , where: - * - rssi is a integer from 0 to 31 whose values describes a signal strength - * between -113 dBm for 0 and -51dbM for 31 or unknown for 99 - * - ber is an integer from 0 to 7 that describes the error rate, it can also - * be 99 for an unknown error rate - */ - if (rssi == 99) { - return -EINVAL; - } - - *value = (int16_t)(-113 + (2 * rssi)); - return 0; -} - static int modem_cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, int16_t *value) { - int ret = -ENOTSUP; + int ret; struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; + const struct modem_cellular_config *config = (struct modem_cellular_config *)dev->config; + + if (config->get_signal_chat_script == NULL) { + return -ENOTSUP; + } if ((data->state != MODEM_CELLULAR_STATE_AWAIT_REGISTERED) && (data->state != MODEM_CELLULAR_STATE_CARRIER_ON)) { return -ENODATA; } - /* Run chat script */ - switch (type) { - case CELLULAR_SIGNAL_RSSI: - ret = modem_chat_run_script(&data->chat, &get_signal_csq_chat_script); - break; - - case CELLULAR_SIGNAL_RSRP: - case CELLULAR_SIGNAL_RSRQ: - /* TODO: Run CESQ script */ - ret = -ENOTSUP; - break; - - default: - ret = -ENOTSUP; - break; - } - - /* Verify chat script ran successfully */ - if (ret < 0) { + ret = modem_chat_run_script(&data->chat, config->get_signal_chat_script); + if (ret != 0) { return ret; } - /* Parse received value */ switch (type) { - case CELLULAR_SIGNAL_RSSI: - ret = modem_cellular_csq_parse_rssi(data->rssi, value); - break; - + case CELLULAR_SIGNAL_RSSI: { + *value = data->rssi; + } break; case CELLULAR_SIGNAL_RSRP: + return -ENOTSUP; case CELLULAR_SIGNAL_RSRQ: - /* TODO: Validate and set values */ - ret = -ENODATA; - break; - - default: - ret = -ENOTSUP; - break; + return -ENOTSUP; } return ret; @@ -1543,11 +1517,19 @@ MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_dial_chat_script, quectel_bg95_dial_chat_s MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match)); + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_periodic_chat_script, quectel_bg95_periodic_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 4); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_get_signal_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); + +MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_get_signal_chat_script, + quectel_bg95_get_signal_chat_script_cmds, abort_matches, + modem_cellular_chat_callback_handler, 4); #endif #if DT_HAS_COMPAT_STATUS_OKAY(quectel_eg25_g) @@ -1598,6 +1580,13 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_periodic_chat_script, quectel_eg25_g_periodic_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 4); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_get_signal_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); + +MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_get_signal_chat_script, + quectel_eg25_g_get_signal_chat_script_cmds, abort_matches, + modem_cellular_chat_callback_handler, 4); #endif #if DT_HAS_COMPAT_STATUS_OKAY(zephyr_gsm_ppp) @@ -1906,6 +1895,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, .init_chat_script = &quectel_bg95_init_chat_script, \ .dial_chat_script = &quectel_bg95_dial_chat_script, \ .periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \ + .get_signal_chat_script = &_CONCAT(DT_DRV_COMPAT, _get_signal_chat_script), \ }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ @@ -1935,6 +1925,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, .init_chat_script = &quectel_eg25_g_init_chat_script, \ .dial_chat_script = &quectel_eg25_g_dial_chat_script, \ .periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \ + .get_signal_chat_script = &_CONCAT(DT_DRV_COMPAT, _get_signal_chat_script), \ }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ From d759d6428b1178c1b0aee78d67d267d23026b2eb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:50 +0100 Subject: [PATCH 0892/2300] Revert "[nrf fromtree] modem: modem_cellular: Update driver to implement cellular API" This reverts commit 9dff19acc067785738a8c3b06adf29f22f46ccee. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 165 ++++++++++++++---------------- include/zephyr/drivers/cellular.h | 46 ++++++--- 2 files changed, 107 insertions(+), 104 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index ea39cecabaf..ad1bb920cd5 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1263,80 +1263,6 @@ static void modem_cellular_cmux_handler(struct modem_cmux *cmux, enum modem_cmux } } -static int modem_cellular_get_signal(const struct device *dev, - const enum cellular_signal_type type, - int16_t *value) -{ - int ret; - struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; - const struct modem_cellular_config *config = (struct modem_cellular_config *)dev->config; - - if (config->get_signal_chat_script == NULL) { - return -ENOTSUP; - } - - if ((data->state != MODEM_CELLULAR_STATE_AWAIT_REGISTERED) && - (data->state != MODEM_CELLULAR_STATE_CARRIER_ON)) { - return -ENODATA; - } - - ret = modem_chat_run_script(&data->chat, config->get_signal_chat_script); - if (ret != 0) { - return ret; - } - - switch (type) { - case CELLULAR_SIGNAL_RSSI: { - *value = data->rssi; - } break; - case CELLULAR_SIGNAL_RSRP: - return -ENOTSUP; - case CELLULAR_SIGNAL_RSRQ: - return -ENOTSUP; - } - - return ret; -} - -static int modem_cellular_get_modem_info(const struct device *dev, - enum cellular_modem_info_type type, - char *info, size_t size) -{ - int ret = 0; - struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; - - switch (type) { - case CELLULAR_MODEM_INFO_IMEI: - strncpy(info, &data->imei[0], MIN(size, sizeof(data->imei))); - break; - case CELLULAR_MODEM_INFO_SIM_IMSI: - strncpy(info, &data->imsi[0], MIN(size, sizeof(data->imsi))); - break; - case CELLULAR_MODEM_INFO_SIM_ICCID: - strncpy(info, &data->iccid[0], MIN(size, sizeof(data->iccid))); - break; - case CELLULAR_MODEM_INFO_MANUFACTURER: - strncpy(info, &data->manufacturer[0], MIN(size, sizeof(data->manufacturer))); - break; - case CELLULAR_MODEM_INFO_FW_VERSION: - strncpy(info, &data->fw_version[0], MIN(size, sizeof(data->fw_version))); - break; - case CELLULAR_MODEM_INFO_MODEL_ID: - strncpy(info, &data->model_id[0], MIN(size, sizeof(data->model_id))); - break; - default: - ret = -ENODATA; - break; - } - - return ret; -} - -const static struct cellular_driver_api modem_cellular_api = { - .get_signal = modem_cellular_get_signal, - .get_modem_info = modem_cellular_get_modem_info, -}; - #ifdef CONFIG_PM_DEVICE static int modem_cellular_pm_action(const struct device *dev, enum pm_device_action action) { @@ -1902,8 +1828,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); #define MODEM_CELLULAR_DEVICE_QUECTEL_EG25_G(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -1932,8 +1857,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); #define MODEM_CELLULAR_DEVICE_GSM_PPP(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -1961,8 +1885,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); #define MODEM_CELLULAR_DEVICE_SIMCOM_SIM7080(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -1990,8 +1913,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); #define MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R4(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -2019,8 +1941,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); #define MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R5(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -2049,8 +1970,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); #define MODEM_CELLULAR_DEVICE_SWIR_HL7800(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -2078,8 +1998,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); #define MODEM_CELLULAR_DEVICE_TELIT_ME910G1(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -2107,8 +2026,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, \ DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); #define DT_DRV_COMPAT quectel_bg95 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_QUECTEL_BG95) @@ -2141,3 +2059,70 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #define DT_DRV_COMPAT telit_me910g1 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) #undef DT_DRV_COMPAT + +int cellular_get_modem_info(const struct device *dev, enum cellular_modem_info_type type, + char *info, size_t size) +{ + int ret = 0; + struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; + + switch (type) { + case CELLULAR_MODEM_INFO_IMEI: + strncpy(info, &data->imei[0], MIN(size, sizeof(data->imei))); + break; + case CELLULAR_MODEM_INFO_SIM_IMSI: + strncpy(info, &data->imsi[0], MIN(size, sizeof(data->imsi))); + break; + case CELLULAR_MODEM_INFO_SIM_ICCID: + strncpy(info, &data->iccid[0], MIN(size, sizeof(data->iccid))); + break; + case CELLULAR_MODEM_INFO_MANUFACTURER: + strncpy(info, &data->manufacturer[0], MIN(size, sizeof(data->manufacturer))); + break; + case CELLULAR_MODEM_INFO_FW_VERSION: + strncpy(info, &data->fw_version[0], MIN(size, sizeof(data->fw_version))); + break; + case CELLULAR_MODEM_INFO_MODEL_ID: + strncpy(info, &data->model_id[0], MIN(size, sizeof(data->model_id))); + break; + default: + ret = -ENODATA; + break; + } + + return ret; +} + +int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, + int16_t *value) +{ + int ret; + struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; + const struct modem_cellular_config *config = (struct modem_cellular_config *)dev->config; + + if (config->get_signal_chat_script == NULL) { + return -ENOTSUP; + } + + if ((data->state != MODEM_CELLULAR_STATE_AWAIT_REGISTERED) && + (data->state != MODEM_CELLULAR_STATE_CARRIER_ON)) { + return -ENODATA; + } + + ret = modem_chat_run_script(&data->chat, config->get_signal_chat_script); + if (ret != 0) { + return ret; + } + + switch (type) { + case CELLULAR_SIGNAL_RSSI: { + *value = data->rssi; + } break; + case CELLULAR_SIGNAL_RSRP: + return -ENOTSUP; + case CELLULAR_SIGNAL_RSRQ: + return -ENOTSUP; + } + + return ret; +} diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h index fba05e6e440..b4202d81b0a 100644 --- a/include/zephyr/drivers/cellular.h +++ b/include/zephyr/drivers/cellular.h @@ -124,13 +124,17 @@ __subsystem struct cellular_driver_api { * @retval -ENOTSUP if API is not supported by cellular network device. * @retval Negative errno-code otherwise. */ -static inline int cellular_configure_networks(const struct device *dev, - const struct cellular_network *networks, uint8_t size) +__syscall int cellular_configure_networks(const struct device *dev, + const struct cellular_network *networks, uint8_t size); + +static inline int z_impl_cellular_configure_networks(const struct device *dev, + const struct cellular_network *networks, + uint8_t size) { const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; if (api->configure_networks == NULL) { - return -ENOSYS; + return -ENOTSUP; } return api->configure_networks(dev, networks, size); @@ -147,14 +151,18 @@ static inline int cellular_configure_networks(const struct device *dev, * @retval -ENOTSUP if API is not supported by cellular network device. * @retval Negative errno-code otherwise. */ -static inline int cellular_get_supported_networks(const struct device *dev, - const struct cellular_network **networks, - uint8_t *size) +__syscall int cellular_get_supported_networks(const struct device *dev, + const struct cellular_network **networks, + uint8_t *size); + +static inline int z_impl_cellular_get_supported_networks(const struct device *dev, + const struct cellular_network **networks, + uint8_t *size) { const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; if (api->get_supported_networks == NULL) { - return -ENOSYS; + return -ENOTSUP; } return api->get_supported_networks(dev, networks, size); @@ -172,13 +180,17 @@ static inline int cellular_get_supported_networks(const struct device *dev, * @retval -ENODATA if device is not in a state where signal can be polled * @retval Negative errno-code otherwise. */ -static inline int cellular_get_signal(const struct device *dev, - const enum cellular_signal_type type, int16_t *value) +__syscall int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, + int16_t *value); + +static inline int z_impl_cellular_get_signal(const struct device *dev, + const enum cellular_signal_type type, + int16_t *value) { const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; if (api->get_signal == NULL) { - return -ENOSYS; + return -ENOTSUP; } return api->get_signal(dev, type, value); @@ -197,14 +209,18 @@ static inline int cellular_get_signal(const struct device *dev, * @retval -ENODATA if modem does not provide info requested * @retval Negative errno-code from chat module otherwise. */ -static inline int cellular_get_modem_info(const struct device *dev, - const enum cellular_modem_info_type type, char *info, - size_t size) +__syscall int cellular_get_modem_info(const struct device *dev, + const enum cellular_modem_info_type type, + char *info, size_t size); + +static inline int z_impl_cellular_get_modem_info(const struct device *dev, + const enum cellular_modem_info_type type, + char *info, size_t size) { const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; if (api->get_modem_info == NULL) { - return -ENOSYS; + return -ENOTSUP; } return api->get_modem_info(dev, type, info, size); @@ -218,4 +234,6 @@ static inline int cellular_get_modem_info(const struct device *dev, * @} */ +#include + #endif /* ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ */ From ec5cb4458a3342b25a57e59f037640778644f6ea Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:50 +0100 Subject: [PATCH 0893/2300] Revert "[nrf fromtree] modem: cellular: Restructure cellular API to fit device driver model" This reverts commit bbd5d79029cad3c5173b52d2e0aed81a0e098947. Signed-off-by: Robert Lubos --- include/zephyr/drivers/cellular.h | 100 +++--------------------------- 1 file changed, 8 insertions(+), 92 deletions(-) diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h index b4202d81b0a..445cd83857c 100644 --- a/include/zephyr/drivers/cellular.h +++ b/include/zephyr/drivers/cellular.h @@ -53,7 +53,6 @@ struct cellular_network { uint16_t size; }; -/** Cellular signal type */ enum cellular_signal_type { CELLULAR_SIGNAL_RSSI, CELLULAR_SIGNAL_RSRP, @@ -76,33 +75,6 @@ enum cellular_modem_info_type { CELLULAR_MODEM_INFO_SIM_ICCID, }; -/** API for configuring networks */ -typedef int (*cellular_api_configure_networks)(const struct device *dev, - const struct cellular_network *networks, - uint8_t size); - -/** API for getting supported networks */ -typedef int (*cellular_api_get_supported_networks)(const struct device *dev, - const struct cellular_network **networks, - uint8_t *size); - -/** API for getting network signal strength */ -typedef int (*cellular_api_get_signal)(const struct device *dev, - const enum cellular_signal_type type, int16_t *value); - -/** API for getting modem information */ -typedef int (*cellular_api_get_modem_info)(const struct device *dev, - const enum cellular_modem_info_type type, - char *info, size_t size); - -/** Cellular driver API */ -__subsystem struct cellular_driver_api { - cellular_api_configure_networks configure_networks; - cellular_api_get_supported_networks get_supported_networks; - cellular_api_get_signal get_signal; - cellular_api_get_modem_info get_modem_info; -}; - /** * @brief Configure cellular networks for the device * @@ -124,21 +96,8 @@ __subsystem struct cellular_driver_api { * @retval -ENOTSUP if API is not supported by cellular network device. * @retval Negative errno-code otherwise. */ -__syscall int cellular_configure_networks(const struct device *dev, - const struct cellular_network *networks, uint8_t size); - -static inline int z_impl_cellular_configure_networks(const struct device *dev, - const struct cellular_network *networks, - uint8_t size) -{ - const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; - - if (api->configure_networks == NULL) { - return -ENOTSUP; - } - - return api->configure_networks(dev, networks, size); -} +int cellular_configure_networks(const struct device *dev, const struct cellular_network *networks, + uint8_t size); /** * @brief Get supported cellular networks for the device @@ -151,22 +110,8 @@ static inline int z_impl_cellular_configure_networks(const struct device *dev, * @retval -ENOTSUP if API is not supported by cellular network device. * @retval Negative errno-code otherwise. */ -__syscall int cellular_get_supported_networks(const struct device *dev, - const struct cellular_network **networks, - uint8_t *size); - -static inline int z_impl_cellular_get_supported_networks(const struct device *dev, - const struct cellular_network **networks, - uint8_t *size) -{ - const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; - - if (api->get_supported_networks == NULL) { - return -ENOTSUP; - } - - return api->get_supported_networks(dev, networks, size); -} +int cellular_get_supported_networks(const struct device *dev, + const struct cellular_network **networks, uint8_t *size); /** * @brief Get signal for the device @@ -180,21 +125,8 @@ static inline int z_impl_cellular_get_supported_networks(const struct device *de * @retval -ENODATA if device is not in a state where signal can be polled * @retval Negative errno-code otherwise. */ -__syscall int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, - int16_t *value); - -static inline int z_impl_cellular_get_signal(const struct device *dev, - const enum cellular_signal_type type, - int16_t *value) -{ - const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; - - if (api->get_signal == NULL) { - return -ENOTSUP; - } - - return api->get_signal(dev, type, value); -} +int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, + int16_t *value); /** * @brief Get modem info for the device @@ -209,22 +141,8 @@ static inline int z_impl_cellular_get_signal(const struct device *dev, * @retval -ENODATA if modem does not provide info requested * @retval Negative errno-code from chat module otherwise. */ -__syscall int cellular_get_modem_info(const struct device *dev, - const enum cellular_modem_info_type type, - char *info, size_t size); - -static inline int z_impl_cellular_get_modem_info(const struct device *dev, - const enum cellular_modem_info_type type, - char *info, size_t size) -{ - const struct cellular_driver_api *api = (const struct cellular_driver_api *)dev->api; - - if (api->get_modem_info == NULL) { - return -ENOTSUP; - } - - return api->get_modem_info(dev, type, info, size); -} +int cellular_get_modem_info(const struct device *dev, const enum cellular_modem_info_type type, + char *info, size_t size); #ifdef __cplusplus } @@ -234,6 +152,4 @@ static inline int z_impl_cellular_get_modem_info(const struct device *dev, * @} */ -#include - #endif /* ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ */ From 23605b4ef92fdae3a5a099e61ce215cf34d213b6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:51 +0100 Subject: [PATCH 0894/2300] Revert "[nrf fromtree] modem: cmux: fix frame data length encoding" This reverts commit f915b63c0b96da804f1908b704adcfaec7b14128. Signed-off-by: Robert Lubos --- subsys/modem/modem_cmux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 3ace00d6583..29ff41c1ca7 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -232,7 +232,7 @@ static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, byte = data_len << 1; fcs = crc8(&byte, 1, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); ring_buf_put(&cmux->transmit_rb, &byte, 1); - byte = data_len >> 7; + byte = 0x01 | (data_len >> 7); ring_buf_put(&cmux->transmit_rb, &byte, 1); } else { byte = 0x01 | (data_len << 1); From 84da7ad335611d7ab1ce80721dcbc6ea0e0764be Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:51 +0100 Subject: [PATCH 0895/2300] Revert "[nrf fromtree] drivers: cellular: add ldenefle to copyright" This reverts commit 9616cdb230e580641c8393fd2627f24b865f9d7e. Signed-off-by: Robert Lubos --- include/zephyr/drivers/cellular.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h index 445cd83857c..83135967123 100644 --- a/include/zephyr/drivers/cellular.h +++ b/include/zephyr/drivers/cellular.h @@ -1,6 +1,5 @@ /* * Copyright (c) 2023 Bjarki Arge Andreasen - * Copyright (c) 2023 Lucas Denefle * * SPDX-License-Identifier: Apache-2.0 */ From 37585d9263a6df1d6fb57615e796ba712b4d1928 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:51 +0100 Subject: [PATCH 0896/2300] Revert "[nrf fromtree] drivers: modem: remove dependency of modem_socket" This reverts commit 37e944781bdab749c2efa637b3caf5ecaf8bac8f. Signed-off-by: Robert Lubos --- drivers/modem/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/modem/Kconfig b/drivers/modem/Kconfig index 02e3557918f..c233d5db821 100644 --- a/drivers/modem/Kconfig +++ b/drivers/modem/Kconfig @@ -142,8 +142,6 @@ config MODEM_CMD_HANDLER_MAX_PARAM_COUNT of the match_buf (match_buf_len) field as it needs to be large enough to hold a single line of data (ending with /r). -endif # MODEM_CONTEXT - config MODEM_SOCKET bool "Generic modem socket support layer" help @@ -167,6 +165,8 @@ config MODEM_SOCKET_PACKET_COUNT these values are organized into "packets". This setting limits the maximum number of packet sizes the socket can keep track of. +endif # MODEM_CONTEXT + config MODEM_SHELL bool "Modem shell utilities" select SHELL From 6d73ea59b5518105bbf4407c91bc58d95e720700 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:51 +0100 Subject: [PATCH 0897/2300] Revert "[nrf fromtree] drivers: cellular: add signal and modem_info API" This reverts commit 0b0496425c9ad0d54ed049515b57aed757f71f5e. Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 231 ++++-------------------------- include/zephyr/drivers/cellular.h | 53 ------- 2 files changed, 25 insertions(+), 259 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index ad1bb920cd5..a038da1805e 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -26,13 +25,6 @@ LOG_MODULE_REGISTER(modem_cellular, CONFIG_MODEM_LOG_LEVEL); #define MODEM_CELLULAR_PERIODIC_SCRIPT_TIMEOUT \ K_MSEC(CONFIG_MODEM_CELLULAR_PERIODIC_SCRIPT_MS) -#define MODEM_CELLULAR_DATA_IMEI_LEN (15) -#define MODEM_CELLULAR_DATA_MODEL_ID_LEN (64) -#define MODEM_CELLULAR_DATA_IMSI_LEN (22) -#define MODEM_CELLULAR_DATA_ICCID_LEN (22) -#define MODEM_CELLULAR_DATA_MANUFACTURER_LEN (64) -#define MODEM_CELLULAR_DATA_FW_VERSION_LEN (64) - enum modem_cellular_state { MODEM_CELLULAR_STATE_IDLE = 0, MODEM_CELLULAR_STATE_RESET_PULSE, @@ -91,16 +83,11 @@ struct modem_cellular_data { uint8_t *chat_argv[32]; /* Status */ + uint8_t imei[15]; + uint8_t hwinfo[64]; uint8_t registration_status_gsm; uint8_t registration_status_gprs; uint8_t registration_status_lte; - int8_t rssi; - uint8_t imei[MODEM_CELLULAR_DATA_IMEI_LEN]; - uint8_t model_id[MODEM_CELLULAR_DATA_MODEL_ID_LEN]; - uint8_t imsi[MODEM_CELLULAR_DATA_IMSI_LEN]; - uint8_t iccid[MODEM_CELLULAR_DATA_ICCID_LEN]; - uint8_t manufacturer[MODEM_CELLULAR_DATA_MANUFACTURER_LEN]; - uint8_t fw_version[MODEM_CELLULAR_DATA_FW_VERSION_LEN]; /* PPP */ struct modem_ppp *ppp; @@ -131,7 +118,6 @@ struct modem_cellular_config { const struct modem_chat_script *init_chat_script; const struct modem_chat_script *dial_chat_script; const struct modem_chat_script *periodic_chat_script; - const struct modem_chat_script *get_signal_chat_script; }; static const char *modem_cellular_state_str(enum modem_cellular_state state) @@ -290,34 +276,16 @@ static void modem_cellular_chat_on_imei(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->imei, argv[1], sizeof(data->imei)); -} - -static void modem_cellular_chat_on_cgmm(struct modem_chat *chat, char **argv, uint16_t argc, - void *user_data) -{ - struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; - - if (argc != 2) { + if (strlen(argv[1]) != 15) { return; } - strncpy(data->model_id, argv[1], sizeof(data->model_id)); -} - -static void modem_cellular_chat_on_cgmi(struct modem_chat *chat, char **argv, uint16_t argc, - void *user_data) -{ - struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; - - if (argc != 2) { - return; + for (uint8_t i = 0; i < 15; i++) { + data->imei[i] = argv[1][i] - '0'; } - - strncpy(data->manufacturer, argv[1], sizeof(data->manufacturer)); } -static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, uint16_t argc, +static void modem_cellular_chat_on_cgmm(struct modem_chat *chat, char **argv, uint16_t argc, void *user_data) { struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; @@ -326,50 +294,7 @@ static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, ui return; } - strncpy(data->fw_version, argv[1], sizeof(data->fw_version)); -} - -static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uint16_t argc, - void *user_data) -{ - uint8_t rssi; - - /* AT+CSQ returns a response +CSQ: , where: - * - rssi is a integer from 0 to 31 whose values describes a signal strength - * between -113 dBm for 0 and -51dbM for 31 or unknown for 99 - * - ber is an integer from 0 to 7 that describes the error rate, it can also - * be 99 for an unknown error rate - */ - struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; - - if (argc != 3) { - return; - } - - /* Read rssi */ - rssi = atoi(argv[1]); - - if (rssi == 99) { - return; - } - - data->rssi = (-113 + (2 * rssi)); -} - -static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, uint16_t argc, - void *user_data) -{ - struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; - - strncpy(data->imsi, (char *)argv[1], sizeof(data->imsi)); -} - -static void modem_cellular_chat_on_iccid(struct modem_chat *chat, char **argv, uint16_t argc, - void *user_data) -{ - struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; - - strncpy(data->iccid, (char *)argv[1], sizeof(data->iccid)); + strncpy(data->hwinfo, argv[1], sizeof(data->hwinfo) - 1); } static bool modem_cellular_is_registered(struct modem_cellular_data *data) @@ -421,11 +346,6 @@ MODEM_CHAT_MATCHES_DEFINE(allow_match, MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); -MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); -MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); -MODEM_CHAT_MATCH_DEFINE(ccid_match, "+QCCID: ", "", modem_cellular_chat_on_iccid); -MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); -MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); MODEM_CHAT_MATCHES_DEFINE(unsol_matches, MODEM_CHAT_MATCH("+CREG: ", ",", modem_cellular_chat_on_cxreg), @@ -1416,14 +1336,6 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+QCCID", ccid_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127", 300)); MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_init_chat_script, quectel_bg95_init_chat_script_cmds, @@ -1443,45 +1355,29 @@ MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_dial_chat_script, quectel_bg95_dial_chat_s MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match)); MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_periodic_chat_script, quectel_bg95_periodic_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 4); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_bg95_get_signal_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); - -MODEM_CHAT_SCRIPT_DEFINE(quectel_bg95_get_signal_chat_script, - quectel_bg95_get_signal_chat_script_cmds, abort_matches, - modem_cellular_chat_callback_handler, 4); #endif #if DT_HAS_COMPAT_STATUS_OKAY(quectel_eg25_g) -MODEM_CHAT_SCRIPT_CMDS_DEFINE( - quectel_eg25_g_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("ATE0", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CIMI", cimi_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+QCCID", ccid_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127,10,3,30,10,2", 100)); +MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_init_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("ATE0", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), + MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127,10,3,30,10,2", + 100)); MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_init_chat_script, quectel_eg25_g_init_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 10); @@ -1500,19 +1396,11 @@ MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_dial_chat_script, quectel_eg25_g_dial_ch MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match)); MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_periodic_chat_script, quectel_eg25_g_periodic_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 4); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(quectel_eg25_g_get_signal_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CSQ", csq_match)); - -MODEM_CHAT_SCRIPT_DEFINE(quectel_eg25_g_get_signal_chat_script, - quectel_eg25_g_get_signal_chat_script_cmds, abort_matches, - modem_cellular_chat_callback_handler, 4); #endif #if DT_HAS_COMPAT_STATUS_OKAY(zephyr_gsm_ppp) @@ -1820,8 +1708,7 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, .shutdown_time_ms = 5000, \ .init_chat_script = &quectel_bg95_init_chat_script, \ .dial_chat_script = &quectel_bg95_dial_chat_script, \ - .periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \ - .get_signal_chat_script = &_CONCAT(DT_DRV_COMPAT, _get_signal_chat_script), \ + .periodic_chat_script = &quectel_bg95_periodic_chat_script, \ }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ @@ -1850,7 +1737,6 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, .init_chat_script = &quectel_eg25_g_init_chat_script, \ .dial_chat_script = &quectel_eg25_g_dial_chat_script, \ .periodic_chat_script = &_CONCAT(DT_DRV_COMPAT, _periodic_chat_script), \ - .get_signal_chat_script = &_CONCAT(DT_DRV_COMPAT, _get_signal_chat_script), \ }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ @@ -2059,70 +1945,3 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #define DT_DRV_COMPAT telit_me910g1 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) #undef DT_DRV_COMPAT - -int cellular_get_modem_info(const struct device *dev, enum cellular_modem_info_type type, - char *info, size_t size) -{ - int ret = 0; - struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; - - switch (type) { - case CELLULAR_MODEM_INFO_IMEI: - strncpy(info, &data->imei[0], MIN(size, sizeof(data->imei))); - break; - case CELLULAR_MODEM_INFO_SIM_IMSI: - strncpy(info, &data->imsi[0], MIN(size, sizeof(data->imsi))); - break; - case CELLULAR_MODEM_INFO_SIM_ICCID: - strncpy(info, &data->iccid[0], MIN(size, sizeof(data->iccid))); - break; - case CELLULAR_MODEM_INFO_MANUFACTURER: - strncpy(info, &data->manufacturer[0], MIN(size, sizeof(data->manufacturer))); - break; - case CELLULAR_MODEM_INFO_FW_VERSION: - strncpy(info, &data->fw_version[0], MIN(size, sizeof(data->fw_version))); - break; - case CELLULAR_MODEM_INFO_MODEL_ID: - strncpy(info, &data->model_id[0], MIN(size, sizeof(data->model_id))); - break; - default: - ret = -ENODATA; - break; - } - - return ret; -} - -int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, - int16_t *value) -{ - int ret; - struct modem_cellular_data *data = (struct modem_cellular_data *)dev->data; - const struct modem_cellular_config *config = (struct modem_cellular_config *)dev->config; - - if (config->get_signal_chat_script == NULL) { - return -ENOTSUP; - } - - if ((data->state != MODEM_CELLULAR_STATE_AWAIT_REGISTERED) && - (data->state != MODEM_CELLULAR_STATE_CARRIER_ON)) { - return -ENODATA; - } - - ret = modem_chat_run_script(&data->chat, config->get_signal_chat_script); - if (ret != 0) { - return ret; - } - - switch (type) { - case CELLULAR_SIGNAL_RSSI: { - *value = data->rssi; - } break; - case CELLULAR_SIGNAL_RSRP: - return -ENOTSUP; - case CELLULAR_SIGNAL_RSRQ: - return -ENOTSUP; - } - - return ret; -} diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h index 83135967123..303e5237e84 100644 --- a/include/zephyr/drivers/cellular.h +++ b/include/zephyr/drivers/cellular.h @@ -52,28 +52,6 @@ struct cellular_network { uint16_t size; }; -enum cellular_signal_type { - CELLULAR_SIGNAL_RSSI, - CELLULAR_SIGNAL_RSRP, - CELLULAR_SIGNAL_RSRQ, -}; - -/** Cellular modem info type */ -enum cellular_modem_info_type { - /** International Mobile Equipment Identity */ - CELLULAR_MODEM_INFO_IMEI, - /** Modem model ID */ - CELLULAR_MODEM_INFO_MODEL_ID, - /** Modem manufacturer */ - CELLULAR_MODEM_INFO_MANUFACTURER, - /** Modem fw version */ - CELLULAR_MODEM_INFO_FW_VERSION, - /** International Mobile Subscriber Identity */ - CELLULAR_MODEM_INFO_SIM_IMSI, - /** Integrated Circuit Card Identification Number (SIM) */ - CELLULAR_MODEM_INFO_SIM_ICCID, -}; - /** * @brief Configure cellular networks for the device * @@ -112,37 +90,6 @@ int cellular_configure_networks(const struct device *dev, const struct cellular_ int cellular_get_supported_networks(const struct device *dev, const struct cellular_network **networks, uint8_t *size); -/** - * @brief Get signal for the device - * - * @param dev Cellular network device instance - * @param type Type of the signal information requested - * @param value Signal strength destination (one of RSSI, RSRP, RSRQ) - * - * @retval 0 if successful. - * @retval -ENOTSUP if API is not supported by cellular network device. - * @retval -ENODATA if device is not in a state where signal can be polled - * @retval Negative errno-code otherwise. - */ -int cellular_get_signal(const struct device *dev, const enum cellular_signal_type type, - int16_t *value); - -/** - * @brief Get modem info for the device - * - * @param dev Cellular network device instance - * @param type Type of the modem info requested - * @param info Info string destination - * @param size Info string size - * - * @retval 0 if successful. - * @retval -ENOTSUP if API is not supported by cellular network device. - * @retval -ENODATA if modem does not provide info requested - * @retval Negative errno-code from chat module otherwise. - */ -int cellular_get_modem_info(const struct device *dev, const enum cellular_modem_info_type type, - char *info, size_t size); - #ifdef __cplusplus } #endif From 426b28f8076d7bb132ea5a47f93cb38f7bfd1195 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:51 +0100 Subject: [PATCH 0898/2300] Revert "[nrf fromtree] drivers: Add cellular API for network configuration" This reverts commit 137218cc886efde3c94113de636ba6b4dc112b18. Signed-off-by: Robert Lubos --- include/zephyr/drivers/cellular.h | 101 ------------------------------ 1 file changed, 101 deletions(-) delete mode 100644 include/zephyr/drivers/cellular.h diff --git a/include/zephyr/drivers/cellular.h b/include/zephyr/drivers/cellular.h deleted file mode 100644 index 303e5237e84..00000000000 --- a/include/zephyr/drivers/cellular.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2023 Bjarki Arge Andreasen - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file drivers/cellular.h - * @brief Public cellular network API - */ - -#ifndef ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ -#define ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ - -/** - * @brief Cellular interface - * @defgroup cellular_interface Cellular Interface - * @ingroup io_interfaces - * @{ - */ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** Cellular access technologies */ -enum cellular_access_technology { - CELLULAR_ACCESS_TECHNOLOGY_GSM = 0, - CELLULAR_ACCESS_TECHNOLOGY_GPRS, - CELLULAR_ACCESS_TECHNOLOGY_UMTS, - CELLULAR_ACCESS_TECHNOLOGY_EDGE, - CELLULAR_ACCESS_TECHNOLOGY_LTE, - CELLULAR_ACCESS_TECHNOLOGY_LTE_CAT_M1, - CELLULAR_ACCESS_TECHNOLOGY_LTE_CAT_M2, - CELLULAR_ACCESS_TECHNOLOGY_NB_IOT, -}; - -/** Cellular network structure */ -struct cellular_network { - /** Cellular access technology */ - enum cellular_access_technology technology; - /** - * List of bands, as defined by the specified cellular access technology, - * to enables. All supported bands are enabled if none are provided. - */ - uint16_t *bands; - /** Size of bands */ - uint16_t size; -}; - -/** - * @brief Configure cellular networks for the device - * - * @details Cellular network devices support at least one cellular access technology. - * Each cellular access technology defines a set of bands, of which the cellular device - * will support all or a subset of. - * - * The cellular device can only use one cellular network technology at a time. It must - * exclusively use the cellular network configurations provided, and will prioritize - * the cellular network configurations in the order they are provided in case there are - * multiple (the first cellular network configuration has the highest priority). - * - * @param dev Cellular network device instance. - * @param networks List of cellular network configurations to apply. - * @param size Size of list of cellular network configurations. - * - * @retval 0 if successful. - * @retval -EINVAL if any provided cellular network configuration is invalid or unsupported. - * @retval -ENOTSUP if API is not supported by cellular network device. - * @retval Negative errno-code otherwise. - */ -int cellular_configure_networks(const struct device *dev, const struct cellular_network *networks, - uint8_t size); - -/** - * @brief Get supported cellular networks for the device - * - * @param dev Cellular network device instance - * @param networks Pointer to list of supported cellular network configurations. - * @param size Size of list of cellular network configurations. - * - * @retval 0 if successful. - * @retval -ENOTSUP if API is not supported by cellular network device. - * @retval Negative errno-code otherwise. - */ -int cellular_get_supported_networks(const struct device *dev, - const struct cellular_network **networks, uint8_t *size); - -#ifdef __cplusplus -} -#endif - -/** - * @} - */ - -#endif /* ZEPHYR_INCLUDE_DRIVERS_CELLULAR_H_ */ From 5b37c9b54623f6faf31344ed83d4db8efb485489 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:51 +0100 Subject: [PATCH 0899/2300] Revert "[nrf fromtree] tests: mode: Modem CMUX DTE / DCE test" This reverts commit 40502447e65525c42c7772d945c5389fc11f6508. Signed-off-by: Robert Lubos --- .../modem/modem_cmux_pair/CMakeLists.txt | 9 - tests/subsys/modem/modem_cmux_pair/prj.conf | 9 - tests/subsys/modem/modem_cmux_pair/src/main.c | 596 ------------------ .../modem/modem_cmux_pair/testcase.yaml | 8 - 4 files changed, 622 deletions(-) delete mode 100644 tests/subsys/modem/modem_cmux_pair/CMakeLists.txt delete mode 100644 tests/subsys/modem/modem_cmux_pair/prj.conf delete mode 100644 tests/subsys/modem/modem_cmux_pair/src/main.c delete mode 100644 tests/subsys/modem/modem_cmux_pair/testcase.yaml diff --git a/tests/subsys/modem/modem_cmux_pair/CMakeLists.txt b/tests/subsys/modem/modem_cmux_pair/CMakeLists.txt deleted file mode 100644 index 00efcc5695b..00000000000 --- a/tests/subsys/modem/modem_cmux_pair/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 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(modem_cmux_pair_test) - -target_sources(app PRIVATE src/main.c ../mock/modem_backend_mock.c) -target_include_directories(app PRIVATE ../mock) diff --git a/tests/subsys/modem/modem_cmux_pair/prj.conf b/tests/subsys/modem/modem_cmux_pair/prj.conf deleted file mode 100644 index bf21fcb42ac..00000000000 --- a/tests/subsys/modem/modem_cmux_pair/prj.conf +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_NO_OPTIMIZATIONS=y - -CONFIG_MODEM_MODULES=y -CONFIG_MODEM_CMUX=y - -CONFIG_ZTEST=y diff --git a/tests/subsys/modem/modem_cmux_pair/src/main.c b/tests/subsys/modem/modem_cmux_pair/src/main.c deleted file mode 100644 index 6c38fd7e98b..00000000000 --- a/tests/subsys/modem/modem_cmux_pair/src/main.c +++ /dev/null @@ -1,596 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include -#include - -/* CMUX state flags */ -#define EVENT_CMUX_CONNECTED BIT(0) -#define EVENT_CMUX_DLCI1_OPEN BIT(1) -#define EVENT_CMUX_DLCI2_OPEN BIT(2) -#define EVENT_CMUX_DLCI1_CLOSED BIT(3) -#define EVENT_CMUX_DLCI2_CLOSED BIT(4) -#define EVENT_CMUX_DISCONNECTED BIT(5) -#define EVENT_CMUX_DLCI1_RX_DATA BIT(6) -#define EVENT_CMUX_DLCI2_RX_DATA BIT(7) - -/* CMUX DTE variables */ -static struct modem_cmux cmux_dte; -static uint8_t cmux_receive_buf[127]; -static uint8_t cmux_transmit_buf[149]; -static struct modem_cmux_dlci dlci1; -static struct modem_cmux_dlci dlci2; -static struct modem_pipe *dlci1_pipe; -static struct modem_pipe *dlci2_pipe; - -/* CMUX DCE variables */ -static struct modem_cmux cmux_dce; -static uint8_t cmux_receive_buf_dce[127]; -static uint8_t cmux_transmit_buf_dce[149]; -static struct modem_cmux_dlci dlci1_dce; -static struct modem_cmux_dlci dlci2_dce; -static struct modem_pipe *dlci1_pipe_dce; -static struct modem_pipe *dlci2_pipe_dce; - -/* DTE & DCE Event */ -static struct k_event cmux_event_dte; -static struct k_event cmux_event_dce; - -/* Backend MOCK */ -static struct modem_backend_mock bus_mock_dte; -static struct modem_backend_mock bus_mock_dce; -static uint8_t bus_mock_rx_buf[2048]; -static uint8_t bus_mock_tx_buf[2048]; -static uint8_t bus_mock_rx_buf_dce[2048]; -static uint8_t bus_mock_tx_buf_dce[2048]; -static struct modem_pipe *bus_mock_pipe; -static struct modem_pipe *bus_mock_pipe_dce; - -static uint8_t dlci1_receive_buf[127]; -static uint8_t dlci2_receive_buf[127]; -static uint8_t dlci1_receive_buf_dce[127]; -static uint8_t dlci2_receive_buf_dce[127]; - -static uint8_t buffer1[2048]; -static uint8_t buffer2[2048]; - -static void test_dlci1_pipe_cb(struct modem_pipe *pipe, enum modem_pipe_event event, - void *user_data) -{ - switch (event) { - case MODEM_PIPE_EVENT_OPENED: - k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI1_OPEN); - break; - - case MODEM_PIPE_EVENT_CLOSED: - k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI1_CLOSED); - break; - - case MODEM_PIPE_EVENT_RECEIVE_READY: - k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI1_RX_DATA); - break; - - default: - break; - } -} - -static void test_dlci2_pipe_cb(struct modem_pipe *pipe, enum modem_pipe_event event, - void *user_data) -{ - switch (event) { - case MODEM_PIPE_EVENT_OPENED: - k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI2_OPEN); - break; - - case MODEM_PIPE_EVENT_CLOSED: - k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI2_CLOSED); - break; - case MODEM_PIPE_EVENT_RECEIVE_READY: - k_event_post(&cmux_event_dte, EVENT_CMUX_DLCI2_RX_DATA); - break; - - default: - break; - } -} - -static void test_dlci1_pipe_cb_dce(struct modem_pipe *pipe, enum modem_pipe_event event, - void *user_data) -{ - switch (event) { - case MODEM_PIPE_EVENT_OPENED: - k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI1_OPEN); - break; - - case MODEM_PIPE_EVENT_CLOSED: - k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI1_CLOSED); - break; - - case MODEM_PIPE_EVENT_RECEIVE_READY: - k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI1_RX_DATA); - break; - - default: - break; - } -} - -static void test_dlci2_pipe_cb_dce(struct modem_pipe *pipe, enum modem_pipe_event event, - void *user_data) -{ - switch (event) { - case MODEM_PIPE_EVENT_OPENED: - k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI2_OPEN); - break; - - case MODEM_PIPE_EVENT_CLOSED: - k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI2_CLOSED); - break; - case MODEM_PIPE_EVENT_RECEIVE_READY: - k_event_post(&cmux_event_dce, EVENT_CMUX_DLCI2_RX_DATA); - break; - - default: - break; - } -} - -/*************************************************************************************************/ -/* DLCI2 AT CMUX frames */ -/*************************************************************************************************/ -static uint8_t cmux_frame_data_dlci2_at_cgdcont[] = { - 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}; - -static uint8_t cmux_frame_data_dlci2_at_newline[] = {0x0D, 0x0A}; - -/*************************************************************************************************/ -/* DLCI1 AT CMUX frames */ -/*************************************************************************************************/ -static uint8_t cmux_frame_data_dlci1_at_at[] = {0x41, 0x54}; - -static uint8_t cmux_frame_data_dlci1_at_newline[] = {0x0D, 0x0A}; - -/*************************************************************************************************/ -/* DLCI2 PPP CMUX frames */ -/*************************************************************************************************/ -static uint8_t cmux_frame_data_dlci2_ppp_52[] = { - 0x7E, 0xFF, 0x7D, 0x23, 0xC0, 0x21, 0x7D, 0x21, 0x7D, 0x20, 0x7D, 0x20, 0x7D, - 0x38, 0x7D, 0x22, 0x7D, 0x26, 0x7D, 0x20, 0x7D, 0x20, 0x7D, 0x20, 0x7D, 0x20, - 0x7D, 0x23, 0x7D, 0x24, 0xC0, 0x23, 0x7D, 0x25, 0x7D, 0x26, 0x53, 0x96, 0x7D, - 0x38, 0xAA, 0x7D, 0x27, 0x7D, 0x22, 0x7D, 0x28, 0x7D, 0x22, 0xD5, 0xA8, 0x7E}; - -static uint8_t cmux_frame_data_dlci2_ppp_18[] = {0x7E, 0xFF, 0x7D, 0x23, 0xC0, 0x21, - 0x7D, 0x22, 0x7D, 0x21, 0x7D, 0x20, - 0x7D, 0x24, 0x7D, 0x3C, 0x90, 0x7E}; - -static void test_cmux_ctrl_cb(struct modem_cmux *cmux, enum modem_cmux_event event, void *user_data) -{ - if (event == MODEM_CMUX_EVENT_CONNECTED) { - k_event_post(&cmux_event_dte, EVENT_CMUX_CONNECTED); - return; - } - - if (event == MODEM_CMUX_EVENT_DISCONNECTED) { - k_event_post(&cmux_event_dte, EVENT_CMUX_DISCONNECTED); - return; - } -} - -static void test_cmux_ctrl_cb_dce(struct modem_cmux *cmux, enum modem_cmux_event event, - void *user_data) -{ - if (event == MODEM_CMUX_EVENT_CONNECTED) { - k_event_post(&cmux_event_dce, EVENT_CMUX_CONNECTED); - return; - } - - if (event == MODEM_CMUX_EVENT_DISCONNECTED) { - k_event_post(&cmux_event_dce, EVENT_CMUX_DISCONNECTED); - return; - } -} - -static void cmux_dte_init(void) -{ - struct modem_cmux_dlci_config dlci1_config = { - .dlci_address = 1, - .receive_buf = dlci1_receive_buf, - .receive_buf_size = sizeof(dlci1_receive_buf), - }; - - struct modem_cmux_dlci_config dlci2_config = { - .dlci_address = 2, - .receive_buf = dlci2_receive_buf, - .receive_buf_size = sizeof(dlci2_receive_buf), - }; - - struct modem_cmux_config cmux_config = { - .callback = test_cmux_ctrl_cb, - .user_data = NULL, - .receive_buf = cmux_receive_buf, - .receive_buf_size = sizeof(cmux_receive_buf), - .transmit_buf = cmux_transmit_buf, - .transmit_buf_size = ARRAY_SIZE(cmux_transmit_buf), - }; - - const struct modem_backend_mock_config bus_mock_config = { - .rx_buf = bus_mock_rx_buf, - .rx_buf_size = sizeof(bus_mock_rx_buf), - .tx_buf = bus_mock_tx_buf, - .tx_buf_size = sizeof(bus_mock_tx_buf), - .limit = 32, - }; - - modem_cmux_init(&cmux_dte, &cmux_config); - dlci1_pipe = modem_cmux_dlci_init(&cmux_dte, &dlci1, &dlci1_config); - dlci2_pipe = modem_cmux_dlci_init(&cmux_dte, &dlci2, &dlci2_config); - /* Init Backend DTE */ - bus_mock_pipe = modem_backend_mock_init(&bus_mock_dte, &bus_mock_config); - __ASSERT_NO_MSG(modem_pipe_open(bus_mock_pipe) == 0); - __ASSERT_NO_MSG(modem_cmux_attach(&cmux_dte, bus_mock_pipe) == 0); - modem_pipe_attach(dlci1_pipe, test_dlci1_pipe_cb, NULL); - modem_pipe_attach(dlci2_pipe, test_dlci2_pipe_cb, NULL); -} - -static void cmux_dce_init(void) -{ - struct modem_cmux_dlci_config dlci1_config = { - .dlci_address = 1, - .receive_buf = dlci1_receive_buf_dce, - .receive_buf_size = sizeof(dlci1_receive_buf_dce), - }; - - struct modem_cmux_dlci_config dlci2_config = { - .dlci_address = 2, - .receive_buf = dlci2_receive_buf_dce, - .receive_buf_size = sizeof(dlci2_receive_buf_dce), - }; - - struct modem_cmux_config cmux_config_dce = { - .callback = test_cmux_ctrl_cb_dce, - .user_data = NULL, - .receive_buf = cmux_receive_buf_dce, - .receive_buf_size = sizeof(cmux_receive_buf_dce), - .transmit_buf = cmux_transmit_buf_dce, - .transmit_buf_size = ARRAY_SIZE(cmux_transmit_buf_dce), - }; - - const struct modem_backend_mock_config bus_mock_config = { - .rx_buf = bus_mock_rx_buf_dce, - .rx_buf_size = sizeof(bus_mock_rx_buf_dce), - .tx_buf = bus_mock_tx_buf_dce, - .tx_buf_size = sizeof(bus_mock_tx_buf_dce), - .limit = 32, - }; - - modem_cmux_init(&cmux_dce, &cmux_config_dce); - dlci1_pipe_dce = modem_cmux_dlci_init(&cmux_dce, &dlci1_dce, &dlci1_config); - dlci2_pipe_dce = modem_cmux_dlci_init(&cmux_dce, &dlci2_dce, &dlci2_config); - /* Init Backend DCE */ - bus_mock_pipe_dce = modem_backend_mock_init(&bus_mock_dce, &bus_mock_config); - __ASSERT_NO_MSG(modem_pipe_open(bus_mock_pipe_dce) == 0); - __ASSERT_NO_MSG(modem_cmux_attach(&cmux_dce, bus_mock_pipe_dce) == 0); - modem_pipe_attach(dlci1_pipe_dce, test_dlci1_pipe_cb_dce, NULL); - modem_pipe_attach(dlci2_pipe_dce, test_dlci2_pipe_cb_dce, NULL); -} - -static void *test_setup(void) -{ - uint32_t events; - - /* Init Event mask's */ - k_event_init(&cmux_event_dte); - k_event_init(&cmux_event_dce); - - /* Init CMUX, Pipe and Backend instances */ - cmux_dte_init(); - cmux_dce_init(); - - /* Create MOCK bridge */ - modem_backend_mock_bridge(&bus_mock_dte, &bus_mock_dce); - - /* Connect CMUX by DTE */ - __ASSERT_NO_MSG(modem_cmux_connect_async(&cmux_dte) == 0); - events = k_event_wait(&cmux_event_dte, EVENT_CMUX_CONNECTED, false, K_MSEC(100)); - __ASSERT_NO_MSG((events & EVENT_CMUX_CONNECTED)); - events = k_event_wait(&cmux_event_dce, EVENT_CMUX_CONNECTED, false, K_MSEC(100)); - __ASSERT_NO_MSG((events & EVENT_CMUX_CONNECTED)); - - /* Open DLCI channels init by DTE */ - __ASSERT_NO_MSG(modem_pipe_open_async(dlci1_pipe) == 0); - events = k_event_wait(&cmux_event_dte, EVENT_CMUX_DLCI1_OPEN, false, K_MSEC(100)); - __ASSERT_NO_MSG((events & EVENT_CMUX_DLCI1_OPEN)); - events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI1_OPEN, false, K_MSEC(100)); - __ASSERT_NO_MSG((events & EVENT_CMUX_DLCI1_OPEN)); - - __ASSERT_NO_MSG(modem_pipe_open_async(dlci2_pipe) == 0); - events = k_event_wait(&cmux_event_dte, EVENT_CMUX_DLCI2_OPEN, false, K_MSEC(100)); - __ASSERT_NO_MSG((events & EVENT_CMUX_DLCI2_OPEN)); - events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI2_OPEN, false, K_MSEC(100)); - __ASSERT_NO_MSG((events & EVENT_CMUX_DLCI2_OPEN)); - - return NULL; -} - -static void test_before(void *f) -{ - /* Reset events */ - k_event_clear(&cmux_event_dte, UINT32_MAX); - k_event_clear(&cmux_event_dce, UINT32_MAX); - - /* Reset mock pipes */ - modem_backend_mock_reset(&bus_mock_dte); - modem_backend_mock_reset(&bus_mock_dce); -} - -ZTEST(modem_cmux_pair, test_modem_cmux_dce_receive_dlci2_at) -{ - int ret; - uint32_t events; - - modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_at_cgdcont, - sizeof(cmux_frame_data_dlci2_at_cgdcont)); - - modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_at_newline, - sizeof(cmux_frame_data_dlci2_at_newline)); - - k_msleep(100); - - events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI2_RX_DATA, false, K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DLCI2_RX_DATA), "DLCI2 dce not rx data"); - - ret = modem_pipe_receive(dlci2_pipe_dce, 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(modem_cmux_pair, test_modem_cmux_dce_receive_dlci1_at) -{ - int ret; - uint32_t events; - - modem_pipe_transmit(dlci1_pipe, cmux_frame_data_dlci1_at_at, - sizeof(cmux_frame_data_dlci1_at_at)); - modem_pipe_transmit(dlci1_pipe, cmux_frame_data_dlci1_at_newline, - sizeof(cmux_frame_data_dlci1_at_newline)); - - k_msleep(100); - - events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI1_RX_DATA, false, K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DLCI1_RX_DATA), "DLCI1 dce not rx data"); - - ret = modem_pipe_receive(dlci1_pipe_dce, buffer1, sizeof(buffer1)); - zassert_true(ret == (sizeof(cmux_frame_data_dlci1_at_at) + - sizeof(cmux_frame_data_dlci1_at_newline)), - "Incorrect number of bytes received"); - - zassert_true(memcmp(buffer1, cmux_frame_data_dlci1_at_at, - sizeof(cmux_frame_data_dlci1_at_at)) == 0, - "Incorrect data received"); - - zassert_true(memcmp(&buffer1[sizeof(cmux_frame_data_dlci1_at_at)], - cmux_frame_data_dlci1_at_newline, - sizeof(cmux_frame_data_dlci1_at_newline)) == 0, - "Incorrect data received"); -} - -ZTEST(modem_cmux_pair, test_modem_cmux_dce_receive_dlci2_ppp) -{ - int ret; - - uint32_t events; - - modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_ppp_52, - sizeof(cmux_frame_data_dlci2_ppp_52)); - modem_pipe_transmit(dlci2_pipe, cmux_frame_data_dlci2_ppp_18, - sizeof(cmux_frame_data_dlci2_ppp_18)); - - k_msleep(100); - - events = k_event_wait(&cmux_event_dce, EVENT_CMUX_DLCI2_RX_DATA, false, K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DLCI2_RX_DATA), "DLCI2 dce not rx data"); - - ret = modem_pipe_receive(dlci2_pipe_dce, buffer2, sizeof(buffer2)); - zassert_true(ret == (sizeof(cmux_frame_data_dlci2_ppp_52) + - sizeof(cmux_frame_data_dlci2_ppp_18)), - "Incorrect number of bytes received"); - - zassert_true(memcmp(buffer2, cmux_frame_data_dlci2_ppp_52, - sizeof(cmux_frame_data_dlci2_ppp_52)) == 0, - "Incorrect data received"); - - zassert_true(memcmp(&buffer2[sizeof(cmux_frame_data_dlci2_ppp_52)], - cmux_frame_data_dlci2_ppp_18, - sizeof(cmux_frame_data_dlci2_ppp_18)) == 0, - "Incorrect data received"); -} - -ZTEST(modem_cmux_pair, test_modem_cmux_dce_transmit_dlci2_ppp) -{ - int ret; - uint32_t events; - - ret = modem_pipe_transmit(dlci2_pipe_dce, cmux_frame_data_dlci2_ppp_52, - sizeof(cmux_frame_data_dlci2_ppp_52)); - - zassert_true(ret == sizeof(cmux_frame_data_dlci2_ppp_52), "Failed to send DLCI2 PPP 52 %d", - ret); - ret = modem_pipe_transmit(dlci2_pipe_dce, cmux_frame_data_dlci2_ppp_18, - sizeof(cmux_frame_data_dlci2_ppp_18)); - - zassert_true(ret == sizeof(cmux_frame_data_dlci2_ppp_18), "Failed to send DLCI2 PPP 18"); - - k_msleep(100); - - events = k_event_wait(&cmux_event_dte, EVENT_CMUX_DLCI2_RX_DATA, false, K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DLCI2_RX_DATA), "DLCI2 dce not rx data"); - - ret = modem_pipe_receive(dlci2_pipe, buffer2, sizeof(buffer2)); - zassert_true(ret == (sizeof(cmux_frame_data_dlci2_ppp_52) + - sizeof(cmux_frame_data_dlci2_ppp_18)), - "Incorrect number of bytes received"); - - zassert_true(memcmp(buffer2, cmux_frame_data_dlci2_ppp_52, - sizeof(cmux_frame_data_dlci2_ppp_52)) == 0, - "Incorrect data received"); - - zassert_true(memcmp(&buffer2[sizeof(cmux_frame_data_dlci2_ppp_52)], - cmux_frame_data_dlci2_ppp_18, - sizeof(cmux_frame_data_dlci2_ppp_18)) == 0, - "Incorrect data received"); -} - -ZTEST(modem_cmux_pair, test_modem_cmux_dlci1_close_open) -{ - uint32_t events; - - /* Close DLCI1 */ - zassert_true(modem_pipe_close_async(dlci1_pipe) == 0, "Failed to close DLCI1 pipe"); - k_msleep(100); - events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DLCI1_CLOSED), false, K_MSEC(100)); - - zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "DLCI1 not closed as expected"); - events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DLCI1_CLOSED), false, K_MSEC(100)); - - zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "DLCI1 not closed as expected"); - - /* Open DLCI1 */ - zassert_true(modem_pipe_open_async(dlci1_pipe) == 0, "Failed to open DLCI1 pipe"); - - k_msleep(100); - - events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DLCI1_OPEN), false, K_MSEC(100)); - - zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DLCI1 not opened as expected"); - events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DLCI1_OPEN), false, K_MSEC(100)); - - zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DLCI1 not opened as expected"); -} - -ZTEST(modem_cmux_pair, test_modem_cmux_disconnect_connect) -{ - uint32_t events; - - /* Disconnect CMUX */ - zassert_true(modem_pipe_close_async(dlci1_pipe) == 0, "Failed to close DLCI1"); - zassert_true(modem_pipe_close_async(dlci2_pipe) == 0, "Failed to close DLCI2"); - k_msleep(100); - - events = k_event_wait_all(&cmux_event_dte, - (EVENT_CMUX_DLCI1_CLOSED | EVENT_CMUX_DLCI2_CLOSED), false, - K_MSEC(100)); - - zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "Failed to close DLCI1"); - zassert_true((events & EVENT_CMUX_DLCI2_CLOSED), "Failed to close DLCI2"); - - /* Discard CMUX DLCI DISC commands */ - modem_backend_mock_reset(&bus_mock_dte); - zassert_true(modem_cmux_disconnect_async(&cmux_dte) == 0, "Failed to disconnect CMUX"); - - k_msleep(100); - - events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DISCONNECTED), false, K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DISCONNECTED), "Failed to disconnect CMUX"); - - /* Reconnect CMUX */ - zassert_true(modem_cmux_connect_async(&cmux_dte) == 0, "Failed to connect CMUX"); - - k_msleep(100); - - events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_CONNECTED), false, K_MSEC(100)); - zassert_true((events & EVENT_CMUX_CONNECTED), "Failed to connect CMUX"); - - /* Open DLCI1 */ - zassert_true(modem_pipe_open_async(dlci1_pipe) == 0, "Failed to open DLCI1 pipe"); - - k_msleep(100); - - events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DLCI1_OPEN), false, K_MSEC(100)); - - zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DLCI1 not opened as expected"); - - /* Open DLCI2 */ - zassert_true(modem_pipe_open_async(dlci2_pipe) == 0, "Failed to open DLCI2 pipe"); - - k_msleep(100); - - events = k_event_wait_all(&cmux_event_dte, (EVENT_CMUX_DLCI2_OPEN), false, K_MSEC(100)); - - zassert_true((events & EVENT_CMUX_DLCI2_OPEN), "DLCI1 not opened as expected"); -} - -ZTEST(modem_cmux_pair, test_modem_cmux_disconnect_connect_sync) -{ - uint32_t events; - - zassert_true(modem_pipe_close(dlci1_pipe) == 0, "Failed to close DLCI1"); - zassert_true(modem_pipe_close(dlci2_pipe) == 0, "Failed to close DLCI2"); - events = k_event_wait_all(&cmux_event_dce, - (EVENT_CMUX_DLCI1_CLOSED | EVENT_CMUX_DLCI2_CLOSED), false, - K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "DCE DLCI1 not closed as expected"); - zassert_true((events & EVENT_CMUX_DLCI2_CLOSED), "DCE DLCI2 not closed as expected"); - - zassert_true(modem_cmux_disconnect(&cmux_dte) == 0, "Failed to disconnect CMUX"); - zassert_true(modem_cmux_disconnect(&cmux_dte) == -EALREADY, - "Should already be disconnected"); - zassert_true(modem_cmux_disconnect(&cmux_dce) == -EALREADY, - "Should already be disconnected"); - - k_msleep(100); - - zassert_true(modem_cmux_connect(&cmux_dte) == 0, "Failed to connect CMUX"); - zassert_true(modem_cmux_connect(&cmux_dte) == -EALREADY, "Should already be connected"); - zassert_true(modem_cmux_connect(&cmux_dce) == -EALREADY, "Should already be connected"); - - zassert_true(modem_pipe_open(dlci1_pipe) == 0, "Failed to open DLCI1 pipe"); - zassert_true(modem_pipe_open(dlci2_pipe) == 0, "Failed to open DLCI2 pipe"); - events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DLCI1_OPEN | EVENT_CMUX_DLCI2_OPEN), - false, K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DCE DLCI1 not open as expected"); - zassert_true((events & EVENT_CMUX_DLCI2_OPEN), "DCE DLCI2 not open as expected"); -} - -ZTEST(modem_cmux_pair, test_modem_cmux_dlci_close_open_sync) -{ - uint32_t events; - - zassert_true(modem_pipe_close(dlci1_pipe) == 0, "Failed to close DLCI1"); - zassert_true(modem_pipe_close(dlci2_pipe) == 0, "Failed to close DLCI2"); - - events = k_event_wait_all(&cmux_event_dce, - (EVENT_CMUX_DLCI1_CLOSED | EVENT_CMUX_DLCI2_CLOSED), false, - K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DLCI1_CLOSED), "DCE DLCI1 not closed as expected"); - zassert_true((events & EVENT_CMUX_DLCI2_CLOSED), "DCE DLCI2 not closed as expected"); - - zassert_true(modem_pipe_open(dlci1_pipe) == 0, "Failed to open DLCI1 pipe"); - zassert_true(modem_pipe_open(dlci2_pipe) == 0, "Failed to open DLCI2 pipe"); - /* Verify DCE side channels are open also */ - events = k_event_wait_all(&cmux_event_dce, (EVENT_CMUX_DLCI1_OPEN | EVENT_CMUX_DLCI2_OPEN), - false, K_MSEC(100)); - zassert_true((events & EVENT_CMUX_DLCI1_OPEN), "DCE DLCI1 not open as expected"); - zassert_true((events & EVENT_CMUX_DLCI2_OPEN), "DCE DLCI2 not open as expected"); -} - -ZTEST_SUITE(modem_cmux_pair, NULL, test_setup, test_before, NULL, NULL); diff --git a/tests/subsys/modem/modem_cmux_pair/testcase.yaml b/tests/subsys/modem/modem_cmux_pair/testcase.yaml deleted file mode 100644 index 9d0cdf33420..00000000000 --- a/tests/subsys/modem/modem_cmux_pair/testcase.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -tests: - modem.modem_cmux_pair: - tags: modem_cmux - harness: ztest - platform_allow: native_sim From f795078441ecbb16070ed2172daaaa56a5008651 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:51 +0100 Subject: [PATCH 0900/2300] Revert "[nrf fromtree] tests: modem: Modem backend mock update" This reverts commit 29100cdf5e779741fe79a50980a6e1a2761c208e. Signed-off-by: Robert Lubos --- tests/subsys/modem/mock/modem_backend_mock.c | 15 --------------- tests/subsys/modem/mock/modem_backend_mock.h | 5 ----- 2 files changed, 20 deletions(-) diff --git a/tests/subsys/modem/mock/modem_backend_mock.c b/tests/subsys/modem/mock/modem_backend_mock.c index 0a12fc43674..55c5679f35f 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.c +++ b/tests/subsys/modem/mock/modem_backend_mock.c @@ -42,15 +42,6 @@ static int modem_backend_mock_transmit(void *data, const uint8_t *buf, size_t si int ret; size = (mock->limit < size) ? mock->limit : size; - - if (mock->bridge) { - struct modem_backend_mock *t_mock = mock->bridge; - - ret = ring_buf_put(&t_mock->rx_rb, buf, size); - k_work_submit(&t_mock->received_work_item.work); - return ret; - } - ret = ring_buf_put(&mock->tx_rb, buf, size); if (modem_backend_mock_update(mock, buf, size)) { modem_backend_mock_put(mock, mock->transaction->put, @@ -139,9 +130,3 @@ void modem_backend_mock_prime(struct modem_backend_mock *mock, mock->transaction = transaction; mock->transaction_match_cnt = 0; } - -void modem_backend_mock_bridge(struct modem_backend_mock *mock_a, struct modem_backend_mock *mock_b) -{ - mock_a->bridge = mock_b; - mock_b->bridge = mock_a; -} diff --git a/tests/subsys/modem/mock/modem_backend_mock.h b/tests/subsys/modem/mock/modem_backend_mock.h index 7d9ad11bf41..1c221963aa8 100644 --- a/tests/subsys/modem/mock/modem_backend_mock.h +++ b/tests/subsys/modem/mock/modem_backend_mock.h @@ -41,8 +41,6 @@ struct modem_backend_mock { /* Max allowed read/write size */ size_t limit; - /* Mock Brige pair */ - struct modem_backend_mock *bridge; }; struct modem_backend_mock_config { @@ -65,7 +63,4 @@ void modem_backend_mock_put(struct modem_backend_mock *mock, const uint8_t *buf, void modem_backend_mock_prime(struct modem_backend_mock *mock, const struct modem_backend_mock_transaction *transaction); -void modem_backend_mock_bridge(struct modem_backend_mock *mock_a, - struct modem_backend_mock *mock_b); - #endif /* ZEPHYR_DRIVERS_MODEM_MODEM_PIPE_MOCK */ From aeaa6b91f276382c8a75fc7386cc708b32b343fa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:52 +0100 Subject: [PATCH 0901/2300] Revert "[nrf fromtree] modem: modem_cmux: Support modem CMUX DCE role" This reverts commit 3fff3690e37cf319a6612617dc68e24fb82e6286. Signed-off-by: Robert Lubos --- subsys/modem/modem_cmux.c | 108 ++++---------------------------------- 1 file changed, 9 insertions(+), 99 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 29ff41c1ca7..9c95e124fc2 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -340,11 +340,9 @@ static void modem_cmux_acknowledge_received_frame(struct modem_cmux *cmux) } } -static void modem_cmux_on_msc_command(struct modem_cmux *cmux, struct modem_cmux_command *command) +static void modem_cmux_on_msc_command(struct modem_cmux *cmux) { - if (command->type.cr) { - modem_cmux_acknowledge_received_frame(cmux); - } + modem_cmux_acknowledge_received_frame(cmux); } static void modem_cmux_on_fcon_command(struct modem_cmux *cmux) @@ -363,27 +361,17 @@ static void modem_cmux_on_fcoff_command(struct modem_cmux *cmux) modem_cmux_acknowledge_received_frame(cmux); } -static void modem_cmux_on_cld_command(struct modem_cmux *cmux, struct modem_cmux_command *command) +static void modem_cmux_on_cld_command(struct modem_cmux *cmux) { - if (command->type.cr) { - modem_cmux_acknowledge_received_frame(cmux); - } - - if (cmux->state != MODEM_CMUX_STATE_DISCONNECTING && - cmux->state != MODEM_CMUX_STATE_CONNECTED) { + if (cmux->state != MODEM_CMUX_STATE_DISCONNECTING) { LOG_WRN("Unexpected close down"); - return; - } - - if (cmux->state == MODEM_CMUX_STATE_DISCONNECTING) { - k_work_cancel_delayable(&cmux->disconnect_work); } cmux->state = MODEM_CMUX_STATE_DISCONNECTED; k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); cmux->flow_control_on = false; k_mutex_unlock(&cmux->transmit_rb_lock); - + k_work_cancel_delayable(&cmux->disconnect_work); modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_DISCONNECTED); k_event_clear(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); k_event_post(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); @@ -393,6 +381,7 @@ static void modem_cmux_on_control_frame_ua(struct modem_cmux *cmux) { if (cmux->state != MODEM_CMUX_STATE_CONNECTING) { LOG_DBG("Unexpected UA frame"); + return; } @@ -425,11 +414,11 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) switch (command->type.value) { case MODEM_CMUX_COMMAND_CLD: - modem_cmux_on_cld_command(cmux, command); + modem_cmux_on_cld_command(cmux); break; case MODEM_CMUX_COMMAND_MSC: - modem_cmux_on_msc_command(cmux, command); + modem_cmux_on_msc_command(cmux); break; case MODEM_CMUX_COMMAND_FCON: @@ -446,40 +435,6 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) } } -static void modem_cmux_connect_response_transmit(struct modem_cmux *cmux) -{ - struct modem_cmux_frame frame = { - .dlci_address = cmux->frame.dlci_address, - .cr = cmux->frame.cr, - .pf = cmux->frame.pf, - .type = MODEM_CMUX_FRAME_TYPE_UA, - .data = NULL, - .data_len = 0, - }; - - LOG_DBG("SABM/DISC request state send ack"); - modem_cmux_transmit_cmd_frame(cmux, &frame); -} - -static void modem_cmux_on_control_frame_sabm(struct modem_cmux *cmux) -{ - modem_cmux_connect_response_transmit(cmux); - - if ((cmux->state == MODEM_CMUX_STATE_CONNECTED) || - (cmux->state == MODEM_CMUX_STATE_DISCONNECTING)) { - LOG_DBG("Connect request not accepted"); - return; - } - - cmux->state = MODEM_CMUX_STATE_CONNECTED; - k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); - cmux->flow_control_on = true; - k_mutex_unlock(&cmux->transmit_rb_lock); - modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_CONNECTED); - k_event_clear(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); - k_event_post(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); -} - static void modem_cmux_on_control_frame(struct modem_cmux *cmux) { modem_cmux_log_received_frame(&cmux->frame); @@ -493,10 +448,6 @@ static void modem_cmux_on_control_frame(struct modem_cmux *cmux) modem_cmux_on_control_frame_uih(cmux); break; - case MODEM_CMUX_FRAME_TYPE_SABM: - modem_cmux_on_control_frame_sabm(cmux); - break; - default: LOG_WRN("Unknown %s frame type", "control"); break; @@ -558,39 +509,6 @@ static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci) modem_pipe_notify_receive_ready(&dlci->pipe); } -static void modem_cmux_on_dlci_frame_sabm(struct modem_cmux_dlci *dlci) -{ - struct modem_cmux *cmux = dlci->cmux; - - modem_cmux_connect_response_transmit(cmux); - - if (dlci->state == MODEM_CMUX_DLCI_STATE_OPEN) { - LOG_DBG("Unexpected SABM frame"); - return; - } - - dlci->state = MODEM_CMUX_DLCI_STATE_OPEN; - modem_pipe_notify_opened(&dlci->pipe); - k_mutex_lock(&dlci->receive_rb_lock, K_FOREVER); - ring_buf_reset(&dlci->receive_rb); - k_mutex_unlock(&dlci->receive_rb_lock); -} - -static void modem_cmux_on_dlci_frame_disc(struct modem_cmux_dlci *dlci) -{ - struct modem_cmux *cmux = dlci->cmux; - - modem_cmux_connect_response_transmit(cmux); - - if (dlci->state != MODEM_CMUX_DLCI_STATE_OPEN) { - LOG_DBG("Unexpected Disc frame"); - return; - } - - dlci->state = MODEM_CMUX_DLCI_STATE_CLOSED; - modem_pipe_notify_closed(&dlci->pipe); -} - static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) { struct modem_cmux_dlci *dlci; @@ -614,14 +532,6 @@ static void modem_cmux_on_dlci_frame(struct modem_cmux *cmux) modem_cmux_on_dlci_frame_uih(dlci); break; - case MODEM_CMUX_FRAME_TYPE_SABM: - modem_cmux_on_dlci_frame_sabm(dlci); - break; - - case MODEM_CMUX_FRAME_TYPE_DISC: - modem_cmux_on_dlci_frame_disc(dlci); - break; - default: LOG_WRN("Unknown %s frame type", "DLCI"); break; @@ -1086,7 +996,6 @@ void modem_cmux_init(struct modem_cmux *cmux, const struct modem_cmux_config *co k_work_init_delayable(&cmux->connect_work, modem_cmux_connect_handler); k_work_init_delayable(&cmux->disconnect_work, modem_cmux_disconnect_handler); k_event_init(&cmux->event); - k_event_clear(&cmux->event, MODEM_CMUX_EVENT_CONNECTED_BIT); k_event_post(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT); } @@ -1162,6 +1071,7 @@ int modem_cmux_disconnect(struct modem_cmux *cmux) if (ret < 0) { return ret; } + if (k_event_wait(&cmux->event, MODEM_CMUX_EVENT_DISCONNECTED_BIT, false, MODEM_CMUX_T2_TIMEOUT) == 0) { return -EAGAIN; From 3ce11bc6ffbb8d09e16a1890d483ae3eaaef0f5c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:52 +0100 Subject: [PATCH 0902/2300] Revert "[nrf fromtree] modem: modem_cellular: add U-blox SARA-R5 as modem" This reverts commit 3bf8c4be2645df0ea54c419aa6a6567400edb7c6. Signed-off-by: Robert Lubos --- drivers/modem/Kconfig.cellular | 4 +- drivers/modem/modem_cellular.c | 84 -------------------------- dts/bindings/modem/u-blox,sara-r5.yaml | 15 ----- 3 files changed, 2 insertions(+), 101 deletions(-) delete mode 100644 dts/bindings/modem/u-blox,sara-r5.yaml diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 0460cda8d96..72e6a74acbb 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -14,8 +14,8 @@ config MODEM_CELLULAR select NET_L2_PPP_PAP depends on (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ - DT_HAS_U_BLOX_SARA_R5_ENABLED || DT_HAS_SWIR_HL7800_ENABLED || \ - DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED) + DT_HAS_SWIR_HL7800_ENABLED || DT_HAS_TELIT_ME910G1_ENABLED || \ + DT_HAS_QUECTEL_EG25_G_ENABLED) help This driver uses the generic 3gpp AT commands, along with the standard protocols CMUX and PPP, to configure diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index a038da1805e..c3b97f0b618 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -114,7 +114,6 @@ struct modem_cellular_config { const uint16_t reset_pulse_duration_ms; const uint16_t startup_time_ms; const uint16_t shutdown_time_ms; - const bool autostarts; const struct modem_chat_script *init_chat_script; const struct modem_chat_script *dial_chat_script; const struct modem_chat_script *periodic_chat_script; @@ -445,11 +444,6 @@ static void modem_cellular_idle_event_handler(struct modem_cellular_data *data, switch (evt) { case MODEM_CELLULAR_EVENT_RESUME: - if (config->autostarts) { - modem_cellular_enter_state(data, MODEM_CELLULAR_STATE_AWAIT_POWER_ON); - break; - } - if (modem_cellular_gpio_is_enabled(&config->power_gpio)) { modem_cellular_enter_state(data, MODEM_CELLULAR_STATE_POWER_ON_PULSE); break; @@ -1544,51 +1538,6 @@ MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r4_periodic_chat_script, modem_cellular_chat_callback_handler, 4); #endif -#if DT_HAS_COMPAT_STATUS_OKAY(u_blox_sara_r5) -MODEM_CHAT_SCRIPT_CMDS_DEFINE(u_blox_sara_r5_init_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), - MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), - MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), - MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), - MODEM_CHAT_SCRIPT_CMD_RESP("ATE0", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMUX=0,0,5,127", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r5_init_chat_script, u_blox_sara_r5_init_chat_script_cmds, - abort_matches, modem_cellular_chat_callback_handler, 10); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(u_blox_sara_r5_dial_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP_MULT("AT+CGACT=0,1", allow_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGDCONT=1,\"IP\"," - "\""CONFIG_MODEM_CELLULAR_APN"\"", - ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP_NONE("ATD*99***1#", 0),); - -MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r5_dial_chat_script, u_blox_sara_r5_dial_chat_script_cmds, - dial_abort_matches, modem_cellular_chat_callback_handler, 10); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(u_blox_sara_r5_periodic_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(u_blox_sara_r5_periodic_chat_script, - u_blox_sara_r5_periodic_chat_script_cmds, abort_matches, - modem_cellular_chat_callback_handler, 4); -#endif - #if DT_HAS_COMPAT_STATUS_OKAY(swir_hl7800) MODEM_CHAT_SCRIPT_CMDS_DEFINE(swir_hl7800_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), @@ -1829,35 +1778,6 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, &MODEM_CELLULAR_INST_NAME(data, inst), \ &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); -#define MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R5(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ - \ - static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ - .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ - }; \ - \ - static struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \ - .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ - .power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \ - .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_reset_gpios, {}), \ - .autostarts = true, \ - .power_pulse_duration_ms = 1500, \ - .reset_pulse_duration_ms = 100, \ - .startup_time_ms = 1500, \ - .shutdown_time_ms = 13000, \ - .init_chat_script = &u_blox_sara_r5_init_chat_script, \ - .dial_chat_script = &u_blox_sara_r5_dial_chat_script, \ - .periodic_chat_script = &u_blox_sara_r5_periodic_chat_script, \ - }; \ - \ - PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ - \ - DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ - &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, NULL); - #define MODEM_CELLULAR_DEVICE_SWIR_HL7800(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ @@ -1934,10 +1854,6 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SIMCOM_SIM7080) DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R4) #undef DT_DRV_COMPAT -#define DT_DRV_COMPAT u_blox_sara_r5 -DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_U_BLOX_SARA_R5) -#undef DT_DRV_COMPAT - #define DT_DRV_COMPAT swir_hl7800 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #undef DT_DRV_COMPAT diff --git a/dts/bindings/modem/u-blox,sara-r5.yaml b/dts/bindings/modem/u-blox,sara-r5.yaml deleted file mode 100644 index af6c3318fd0..00000000000 --- a/dts/bindings/modem/u-blox,sara-r5.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2023 Emil Lindqvist -# SPDX-License-Identifier: Apache-2.0 - -description: u-blox SARA-R5 modem - -compatible: "u-blox,sara-r5" - -include: uart-device.yaml - -properties: - mdm-power-gpios: - type: phandle-array - - mdm-reset-gpios: - type: phandle-array From f0f630a36973101d9d3b70eb26c010b6d9064146 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:52 +0100 Subject: [PATCH 0903/2300] Revert "[nrf fromtree] modem: modem_cellular: add PAP authentication support" This reverts commit 4233f880fb46f071cbaf8a2b1f0882bad0e935cb. Signed-off-by: Robert Lubos --- drivers/modem/Kconfig.cellular | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 72e6a74acbb..7817fb599e3 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -11,7 +11,6 @@ config MODEM_CELLULAR select MODEM_BACKEND_UART select RING_BUFFER select NET_L2_PPP_OPTION_MRU - select NET_L2_PPP_PAP depends on (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ DT_HAS_SWIR_HL7800_ENABLED || DT_HAS_TELIT_ME910G1_ENABLED || \ From 974594366491add8025436b5562f3b5f6cab436c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:52 +0100 Subject: [PATCH 0904/2300] Revert "[nrf fromtree] drivers: gnss: move gnss_publish.h in include/" This reverts commit 93177c9f7aec917ad674d9a0cf03775a63fa4614. Signed-off-by: Robert Lubos --- MAINTAINERS.yml | 1 - drivers/gnss/gnss_nmea0183_match.c | 2 +- drivers/gnss/gnss_nmea_generic.c | 2 +- drivers/gnss/gnss_publish.c | 2 +- {include/zephyr/drivers => drivers}/gnss/gnss_publish.h | 0 drivers/gnss/gnss_quectel_lcx6g.c | 2 +- 6 files changed, 4 insertions(+), 5 deletions(-) rename {include/zephyr/drivers => drivers}/gnss/gnss_publish.h (100%) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index c6f75fd234d..5e3fb9a9a2e 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1099,7 +1099,6 @@ Release Notes: - doc/hardware/peripherals/gnss.rst - drivers/gnss/ - include/zephyr/drivers/gnss.h - - include/zephyr/drivers/gnss/ - tests/drivers/build_all/gnss/ - tests/drivers/gnss/ labels: diff --git a/drivers/gnss/gnss_nmea0183_match.c b/drivers/gnss/gnss_nmea0183_match.c index 2b971937c8d..3fe3b159fdb 100644 --- a/drivers/gnss/gnss_nmea0183_match.c +++ b/drivers/gnss/gnss_nmea0183_match.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include #include #include @@ -12,6 +11,7 @@ #include "gnss_nmea0183.h" #include "gnss_nmea0183_match.h" +#include "gnss_publish.h" static bool gnss_nmea0183_match_timed_out(struct gnss_nmea0183_match_data *data) { diff --git a/drivers/gnss/gnss_nmea_generic.c b/drivers/gnss/gnss_nmea_generic.c index 0e7611ba495..d24ee2b034d 100644 --- a/drivers/gnss/gnss_nmea_generic.c +++ b/drivers/gnss/gnss_nmea_generic.c @@ -7,13 +7,13 @@ */ #include -#include #include #include #include #include #include +#include "gnss_publish.h" #include "gnss_nmea0183.h" #include "gnss_nmea0183_match.h" #include "gnss_parse.h" diff --git a/drivers/gnss/gnss_publish.c b/drivers/gnss/gnss_publish.c index 7ddfa5e09fe..98e3a2e5e19 100644 --- a/drivers/gnss/gnss_publish.c +++ b/drivers/gnss/gnss_publish.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include +#include "gnss_publish.h" #include #include diff --git a/include/zephyr/drivers/gnss/gnss_publish.h b/drivers/gnss/gnss_publish.h similarity index 100% rename from include/zephyr/drivers/gnss/gnss_publish.h rename to drivers/gnss/gnss_publish.h diff --git a/drivers/gnss/gnss_quectel_lcx6g.c b/drivers/gnss/gnss_quectel_lcx6g.c index 9565d46cdfb..0ca7f5203ac 100644 --- a/drivers/gnss/gnss_quectel_lcx6g.c +++ b/drivers/gnss/gnss_quectel_lcx6g.c @@ -6,7 +6,6 @@ */ #include -#include #include #include #include @@ -15,6 +14,7 @@ #include #include +#include "gnss_publish.h" #include "gnss_nmea0183.h" #include "gnss_nmea0183_match.h" #include "gnss_parse.h" From 300971b192798cf6076dca9bf700dd494bfc468e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:52 +0100 Subject: [PATCH 0905/2300] Revert "[nrf fromtree] drivers: gnss: use absolute values for signed fractionals" This reverts commit 097ff270ecf4454484fc9506b747cbb52aae6e5a. Signed-off-by: Robert Lubos --- drivers/gnss/gnss_dump.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/gnss/gnss_dump.c b/drivers/gnss/gnss_dump.c index f87b64a4946..1946d65ea2e 100644 --- a/drivers/gnss/gnss_dump.c +++ b/drivers/gnss/gnss_dump.c @@ -5,7 +5,6 @@ */ #include "gnss_dump.h" -#include #include #include @@ -95,22 +94,20 @@ int gnss_dump_info(char *str, uint16_t strsize, const struct gnss_info *info) int gnss_dump_nav_data(char *str, uint16_t strsize, const struct navigation_data *nav_data) { int ret; - const char *fmt = "navigation_data: {latitude: %s%lli.%09lli, longitude : %s%lli.%09lli, " - "bearing %u.%03u, speed %u.%03u, altitude: %s%i.%03i}"; - char *lat_sign = nav_data->latitude < 0 ? "-" : ""; - char *lon_sign = nav_data->longitude < 0 ? "-" : ""; - char *alt_sign = nav_data->altitude < 0 ? "-" : ""; - - ret = snprintk(str, strsize, fmt, - lat_sign, - llabs(nav_data->latitude) / 1000000000, - llabs(nav_data->latitude) % 1000000000, - lon_sign, - llabs(nav_data->longitude) / 1000000000, - llabs(nav_data->longitude) % 1000000000, - nav_data->bearing / 1000, nav_data->bearing % 1000, - nav_data->speed / 1000, nav_data->speed % 1000, - alt_sign, abs(nav_data->altitude) / 1000, abs(nav_data->altitude) % 1000); + int32_t altitude_int; + int32_t altitude_fraction; + const char *fmt = "navigation_data: {latitude: %lli.%lli, longitude : %lli.%lli, " + "bearing %u.%u, speed %u.%u, altitude: %i.%i}"; + + altitude_int = nav_data->altitude / 1000; + altitude_fraction = nav_data->altitude % 1000; + altitude_fraction = (altitude_fraction < 0) ? -altitude_fraction : altitude_fraction; + + ret = snprintk(str, strsize, fmt, nav_data->latitude / 1000000000, + nav_data->latitude % 1000000000, nav_data->longitude / 1000000000, + nav_data->longitude % 1000000000, nav_data->bearing / 1000, + nav_data->bearing % 1000, nav_data->speed / 1000, nav_data->speed % 1000, + altitude_int, altitude_fraction); return (strsize < ret) ? -ENOMEM : 0; } From 6d1800b434208b95fdebf28a81f6cf8fbfa6f36b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:53 +0100 Subject: [PATCH 0906/2300] Revert "[nrf fromtree] test: add a gnss build_all test" This reverts commit daaa3f6b31239069d0a26144b085883a81a4ce7a. Signed-off-by: Robert Lubos --- MAINTAINERS.yml | 1 - tests/drivers/build_all/gnss/CMakeLists.txt | 8 -------- tests/drivers/build_all/gnss/app.overlay | 22 --------------------- tests/drivers/build_all/gnss/prj.conf | 3 --- tests/drivers/build_all/gnss/src/main.c | 10 ---------- tests/drivers/build_all/gnss/testcase.yaml | 8 -------- 6 files changed, 52 deletions(-) delete mode 100644 tests/drivers/build_all/gnss/CMakeLists.txt delete mode 100644 tests/drivers/build_all/gnss/app.overlay delete mode 100644 tests/drivers/build_all/gnss/prj.conf delete mode 100644 tests/drivers/build_all/gnss/src/main.c delete mode 100644 tests/drivers/build_all/gnss/testcase.yaml diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 5e3fb9a9a2e..d7623c89137 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1099,7 +1099,6 @@ Release Notes: - doc/hardware/peripherals/gnss.rst - drivers/gnss/ - include/zephyr/drivers/gnss.h - - tests/drivers/build_all/gnss/ - tests/drivers/gnss/ labels: - "area: GNSS" diff --git a/tests/drivers/build_all/gnss/CMakeLists.txt b/tests/drivers/build_all/gnss/CMakeLists.txt deleted file mode 100644 index 518596a02f7..00000000000 --- a/tests/drivers/build_all/gnss/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# 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/drivers/build_all/gnss/app.overlay b/tests/drivers/build_all/gnss/app.overlay deleted file mode 100644 index 1d43fa61525..00000000000 --- a/tests/drivers/build_all/gnss/app.overlay +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2023 Google LLC - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - test { - #address-cells = <1>; - #size-cells = <1>; - - test_uart: uart@0 { - compatible = "vnd,serial"; - reg = <0x0 0x1000>; - status = "okay"; - - gnss: gnss-nmea-generic { - compatible = "gnss-nmea-generic"; - }; - }; - }; -}; diff --git a/tests/drivers/build_all/gnss/prj.conf b/tests/drivers/build_all/gnss/prj.conf deleted file mode 100644 index 945eb0df717..00000000000 --- a/tests/drivers/build_all/gnss/prj.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_SERIAL=y -CONFIG_UART_INTERRUPT_DRIVEN=y -CONFIG_GNSS=y diff --git a/tests/drivers/build_all/gnss/src/main.c b/tests/drivers/build_all/gnss/src/main.c deleted file mode 100644 index ccbdca6d36b..00000000000 --- a/tests/drivers/build_all/gnss/src/main.c +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2023 Google LLC - * - * SPDX-License-Identifier: Apache-2.0 - */ - -int main(void) -{ - return 0; -} diff --git a/tests/drivers/build_all/gnss/testcase.yaml b/tests/drivers/build_all/gnss/testcase.yaml deleted file mode 100644 index faaec12c745..00000000000 --- a/tests/drivers/build_all/gnss/testcase.yaml +++ /dev/null @@ -1,8 +0,0 @@ -common: - tags: - - drivers - - gnss - build_only: true - platform_allow: native_sim -tests: - drivers.gnss.default: {} From 47d34af49b8df647eff5cab5b0eff01acc33e7e5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:53 +0100 Subject: [PATCH 0907/2300] Revert "[nrf fromtree] drivers: gnss: add a generic NMEA GNSS driver" This reverts commit bdf52e223ddb44bf585d24924548452f899da9e8. Signed-off-by: Robert Lubos --- drivers/gnss/CMakeLists.txt | 1 - drivers/gnss/Kconfig | 1 - drivers/gnss/Kconfig.generic | 26 ---- drivers/gnss/gnss_nmea_generic.c | 176 ----------------------- dts/bindings/gnss/gnss-nmea-generic.yaml | 32 ----- 5 files changed, 236 deletions(-) delete mode 100644 drivers/gnss/Kconfig.generic delete mode 100644 drivers/gnss/gnss_nmea_generic.c delete mode 100644 dts/bindings/gnss/gnss-nmea-generic.yaml diff --git a/drivers/gnss/CMakeLists.txt b/drivers/gnss/CMakeLists.txt index cfa5c6ed210..6c24df4903e 100644 --- a/drivers/gnss/CMakeLists.txt +++ b/drivers/gnss/CMakeLists.txt @@ -7,5 +7,4 @@ zephyr_library_sources_ifdef(CONFIG_GNSS_DUMP gnss_dump.c) zephyr_library_sources_ifdef(CONFIG_GNSS_PARSE gnss_parse.c) zephyr_library_sources_ifdef(CONFIG_GNSS_NMEA0183 gnss_nmea0183.c) zephyr_library_sources_ifdef(CONFIG_GNSS_NMEA0183_MATCH gnss_nmea0183_match.c) -zephyr_library_sources_ifdef(CONFIG_GNSS_NMEA_GENERIC gnss_nmea_generic.c) zephyr_library_sources_ifdef(CONFIG_GNSS_QUECTEL_LCX6G gnss_quectel_lcx6g.c) diff --git a/drivers/gnss/Kconfig b/drivers/gnss/Kconfig index 2ff552940a3..5bdc0f530d8 100644 --- a/drivers/gnss/Kconfig +++ b/drivers/gnss/Kconfig @@ -64,7 +64,6 @@ module = GNSS module-str = gnss source "subsys/logging/Kconfig.template.log_config" -rsource "Kconfig.generic" rsource "Kconfig.quectel_lcx6g" endif diff --git a/drivers/gnss/Kconfig.generic b/drivers/gnss/Kconfig.generic deleted file mode 100644 index 47fbd4a7c6c..00000000000 --- a/drivers/gnss/Kconfig.generic +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2023 Google LLC -# SPDX-License-Identifier: Apache-2.0 - -config GNSS_NMEA_GENERIC - bool "Generic GNSS NMEA device" - default y - depends on GNSS - depends on DT_HAS_GNSS_NMEA_GENERIC_ENABLED - select MODEM_MODULES - select MODEM_BACKEND_UART - select MODEM_CHAT - select GNSS_PARSE - select GNSS_NMEA0183 - select GNSS_NMEA0183_MATCH - help - Generic NMEA based GNSS device. - -config GNSS_NMEA_GENERIC_SATELLITES_COUNT - int "Maximum satellite count" - depends on GNSS_SATELLITES - default 24 - help - Maximum number of satellite that the driver that can be decoded from - the GNSS device. This does not affect the number of devices that the - device is actually tracking, just how many of those can be reported - in the satellites callback. diff --git a/drivers/gnss/gnss_nmea_generic.c b/drivers/gnss/gnss_nmea_generic.c deleted file mode 100644 index d24ee2b034d..00000000000 --- a/drivers/gnss/gnss_nmea_generic.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2023 Trackunit Corporation - * Copyright (c) 2023 Bjarki Arge Andreasen - * Copyright 2023 Google LLC - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include - -#include "gnss_publish.h" -#include "gnss_nmea0183.h" -#include "gnss_nmea0183_match.h" -#include "gnss_parse.h" - -#include -LOG_MODULE_REGISTER(gnss_nmea_generic, CONFIG_GNSS_LOG_LEVEL); - -#define DT_DRV_COMPAT gnss_nmea_generic - -#define UART_RECV_BUF_SZ 128 -#define CHAT_RECV_BUF_SZ 256 -#define CHAT_ARGV_SZ 32 - -struct gnss_nmea_generic_config { - const struct device *uart; - uint16_t nmea_timeout_ms; -}; - -struct gnss_nmea_generic_data { - struct gnss_nmea0183_match_data match_data; -#if CONFIG_GNSS_SATELLITES - struct gnss_satellite satellites[CONFIG_GNSS_NMEA_GENERIC_SATELLITES_COUNT]; -#endif - - /* UART backend */ - struct modem_pipe *uart_pipe; - struct modem_backend_uart uart_backend; - uint8_t uart_backend_receive_buf[UART_RECV_BUF_SZ]; - - /* Modem chat */ - struct modem_chat chat; - uint8_t chat_receive_buf[CHAT_RECV_BUF_SZ]; - uint8_t *chat_argv[CHAT_ARGV_SZ]; - - struct k_spinlock lock; -}; - -MODEM_CHAT_MATCHES_DEFINE(unsol_matches, - MODEM_CHAT_MATCH_WILDCARD("$??GGA,", ",*", gnss_nmea0183_match_gga_callback), - MODEM_CHAT_MATCH_WILDCARD("$??RMC,", ",*", gnss_nmea0183_match_rmc_callback), -#if CONFIG_GNSS_SATELLITES - MODEM_CHAT_MATCH_WILDCARD("$??GSV,", ",*", gnss_nmea0183_match_gsv_callback), -#endif -); - -static int gnss_nmea_generic_resume(const struct device *dev) -{ - struct gnss_nmea_generic_data *data = dev->data; - int ret; - - ret = modem_pipe_open(data->uart_pipe); - if (ret < 0) { - return ret; - } - - ret = modem_chat_attach(&data->chat, data->uart_pipe); - if (ret < 0) { - modem_pipe_close(data->uart_pipe); - return ret; - } - - return ret; -} - -static struct gnss_driver_api gnss_api = { -}; - -static int gnss_nmea_generic_init_nmea0183_match(const struct device *dev) -{ - const struct gnss_nmea_generic_config *cfg = dev->config; - struct gnss_nmea_generic_data *data = dev->data; - - const struct gnss_nmea0183_match_config match_config = { - .gnss = dev, -#if CONFIG_GNSS_SATELLITES - .satellites = data->satellites, - .satellites_size = ARRAY_SIZE(data->satellites), -#endif - .timeout_ms = cfg->nmea_timeout_ms, - }; - - return gnss_nmea0183_match_init(&data->match_data, &match_config); -} - -static void gnss_nmea_generic_init_pipe(const struct device *dev) -{ - const struct gnss_nmea_generic_config *cfg = dev->config; - struct gnss_nmea_generic_data *data = dev->data; - - const struct modem_backend_uart_config uart_backend_config = { - .uart = cfg->uart, - .receive_buf = data->uart_backend_receive_buf, - .receive_buf_size = sizeof(data->uart_backend_receive_buf), - }; - - data->uart_pipe = modem_backend_uart_init(&data->uart_backend, &uart_backend_config); -} - -static uint8_t gnss_nmea_generic_char_delimiter[] = {'\r', '\n'}; - -static int gnss_nmea_generic_init_chat(const struct device *dev) -{ - struct gnss_nmea_generic_data *data = dev->data; - - const struct modem_chat_config chat_config = { - .user_data = data, - .receive_buf = data->chat_receive_buf, - .receive_buf_size = sizeof(data->chat_receive_buf), - .delimiter = gnss_nmea_generic_char_delimiter, - .delimiter_size = ARRAY_SIZE(gnss_nmea_generic_char_delimiter), - .filter = NULL, - .filter_size = 0, - .argv = data->chat_argv, - .argv_size = ARRAY_SIZE(data->chat_argv), - .unsol_matches = unsol_matches, - .unsol_matches_size = ARRAY_SIZE(unsol_matches), - .process_timeout = K_MSEC(2), - }; - - return modem_chat_init(&data->chat, &chat_config); -} - -static int gnss_nmea_generic_init(const struct device *dev) -{ - int ret; - - ret = gnss_nmea_generic_init_nmea0183_match(dev); - if (ret < 0) { - return ret; - } - - gnss_nmea_generic_init_pipe(dev); - - ret = gnss_nmea_generic_init_chat(dev); - if (ret < 0) { - return ret; - } - - ret = gnss_nmea_generic_resume(dev); - if (ret < 0) { - return ret; - } - - return 0; -} - -#define GNSS_NMEA_GENERIC(inst) \ - static struct gnss_nmea_generic_config gnss_nmea_generic_cfg_##inst = { \ - .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ - .nmea_timeout_ms = DT_INST_PROP(inst, nmea_timeout_ms), \ - }; \ - \ - static struct gnss_nmea_generic_data gnss_nmea_generic_data_##inst; \ - \ - DEVICE_DT_INST_DEFINE(inst, gnss_nmea_generic_init, NULL, \ - &gnss_nmea_generic_data_##inst, \ - &gnss_nmea_generic_cfg_##inst, \ - POST_KERNEL, CONFIG_GNSS_INIT_PRIORITY, &gnss_api); - -DT_INST_FOREACH_STATUS_OKAY(GNSS_NMEA_GENERIC) diff --git a/dts/bindings/gnss/gnss-nmea-generic.yaml b/dts/bindings/gnss/gnss-nmea-generic.yaml deleted file mode 100644 index 4be7bde1186..00000000000 --- a/dts/bindings/gnss/gnss-nmea-generic.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2023 Google LLC -# SPDX-License-Identifier: Apache-2.0 - -description: | - Generic GNSS NMEA receiver - - Implement a generic NMEA based GNSS device. - - Example configuration: - - &uart0 { - current-speed = <9600>; - ... - gnss: gnss-nmea-generic { - compatible = "gnss-nmea-generic"; - }; - }; - -compatible: "gnss-nmea-generic" - -include: - - uart-device.yaml - -properties: - nmea-timeout-ms: - type: int - default: 500 - description: | - Synchronization timeout for NMEA sentences. The NMEA parser is expecting - to receive a GGA and RMC sentences within this time frame to publish a - location data. Set accordingly to the UART datarate and location - reporting frequency. Defaults to 500ms if unspecified. From a68828246da5dd7fb2ffe411d17f9efb098548fa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:53 +0100 Subject: [PATCH 0908/2300] Revert "[nrf fromtree] tests/drivers/build_all/*: Switch to native_sim" This reverts commit d01d7ceb658714724564975893f37bc055fb6a9f. Signed-off-by: Robert Lubos --- .../adc/boards/{native_sim.overlay => native_posix.overlay} | 0 .../boards/{native_sim_64.overlay => native_posix_64.overlay} | 2 +- tests/drivers/build_all/adc/testcase.yaml | 4 ++-- tests/drivers/build_all/charger/testcase.yaml | 4 +--- tests/drivers/build_all/dac/testcase.yaml | 4 +--- tests/drivers/build_all/fpga/testcase.yaml | 4 +--- tests/drivers/build_all/ieee802154/testcase.yaml | 4 +--- tests/drivers/build_all/input/testcase.yaml | 4 +--- tests/drivers/build_all/mfd/testcase.yaml | 4 +--- tests/drivers/build_all/modem/testcase.yaml | 2 -- tests/drivers/build_all/regulator/testcase.yaml | 4 +--- tests/drivers/build_all/video/testcase.yaml | 4 +--- 12 files changed, 11 insertions(+), 29 deletions(-) rename tests/drivers/build_all/adc/boards/{native_sim.overlay => native_posix.overlay} (100%) rename tests/drivers/build_all/adc/boards/{native_sim_64.overlay => native_posix_64.overlay} (74%) diff --git a/tests/drivers/build_all/adc/boards/native_sim.overlay b/tests/drivers/build_all/adc/boards/native_posix.overlay similarity index 100% rename from tests/drivers/build_all/adc/boards/native_sim.overlay rename to tests/drivers/build_all/adc/boards/native_posix.overlay diff --git a/tests/drivers/build_all/adc/boards/native_sim_64.overlay b/tests/drivers/build_all/adc/boards/native_posix_64.overlay similarity index 74% rename from tests/drivers/build_all/adc/boards/native_sim_64.overlay rename to tests/drivers/build_all/adc/boards/native_posix_64.overlay index 16e56822d5f..b5655714d89 100644 --- a/tests/drivers/build_all/adc/boards/native_sim_64.overlay +++ b/tests/drivers/build_all/adc/boards/native_posix_64.overlay @@ -3,4 +3,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "native_sim.overlay" +#include "native_posix.overlay" diff --git a/tests/drivers/build_all/adc/testcase.yaml b/tests/drivers/build_all/adc/testcase.yaml index 3b8995e1769..a8102364b60 100644 --- a/tests/drivers/build_all/adc/testcase.yaml +++ b/tests/drivers/build_all/adc/testcase.yaml @@ -7,8 +7,8 @@ tests: drivers.adc.build: # will cover I2C, SPI, and emul based drivers platform_allow: - - native_sim - - native_sim_64 + - native_posix + - native_posix_64 extra_args: "CONFIG_GPIO=y" drivers.adc.cc32xx.build: platform_allow: cc3220sf_launchxl diff --git a/tests/drivers/build_all/charger/testcase.yaml b/tests/drivers/build_all/charger/testcase.yaml index 0a29ccc7b39..f2005d9f238 100644 --- a/tests/drivers/build_all/charger/testcase.yaml +++ b/tests/drivers/build_all/charger/testcase.yaml @@ -7,6 +7,4 @@ tests: - drivers - charger build_only: true - platform_allow: - - native_posix - - native_sim + platform_allow: native_posix diff --git a/tests/drivers/build_all/dac/testcase.yaml b/tests/drivers/build_all/dac/testcase.yaml index a298ded77b4..12252b8661f 100644 --- a/tests/drivers/build_all/dac/testcase.yaml +++ b/tests/drivers/build_all/dac/testcase.yaml @@ -6,9 +6,7 @@ common: tests: drivers.dac.build: # will cover I2C, SPI based drivers - platform_allow: - - native_posix - - native_sim + platform_allow: native_posix extra_args: "CONFIG_GPIO=y" drivers.dac.mcux.build: platform_allow: frdm_k22f diff --git a/tests/drivers/build_all/fpga/testcase.yaml b/tests/drivers/build_all/fpga/testcase.yaml index ad0d3e8123e..33cccf76dde 100644 --- a/tests/drivers/build_all/fpga/testcase.yaml +++ b/tests/drivers/build_all/fpga/testcase.yaml @@ -2,9 +2,7 @@ common: tags: - drivers - sensors - platform_allow: - - native_posix - - native_sim + platform_allow: native_posix build_only: true tests: drivers.fpga.build: diff --git a/tests/drivers/build_all/ieee802154/testcase.yaml b/tests/drivers/build_all/ieee802154/testcase.yaml index 399f3fac3cf..fd9fb07e062 100644 --- a/tests/drivers/build_all/ieee802154/testcase.yaml +++ b/tests/drivers/build_all/ieee802154/testcase.yaml @@ -5,9 +5,7 @@ common: build_only: true tests: ieee802154.build.external: - platform_allow: - - native_posix - - native_sim + platform_allow: native_posix ieee802154.build.cc13xx_cc26xx: platform_allow: cc1352r_sensortag ieee802154.build.kw41z: diff --git a/tests/drivers/build_all/input/testcase.yaml b/tests/drivers/build_all/input/testcase.yaml index 80a60399464..32fe44b883f 100644 --- a/tests/drivers/build_all/input/testcase.yaml +++ b/tests/drivers/build_all/input/testcase.yaml @@ -3,9 +3,7 @@ common: - drivers - input build_only: true - platform_allow: - - native_posix - - native_sim + platform_allow: native_posix tests: drivers.input.default: {} diff --git a/tests/drivers/build_all/mfd/testcase.yaml b/tests/drivers/build_all/mfd/testcase.yaml index 126fdb40e55..80864481bdf 100644 --- a/tests/drivers/build_all/mfd/testcase.yaml +++ b/tests/drivers/build_all/mfd/testcase.yaml @@ -5,6 +5,4 @@ common: - mfd tests: drivers.mfd.build: - platform_allow: - - native_posix - - native_sim + platform_allow: native_posix diff --git a/tests/drivers/build_all/modem/testcase.yaml b/tests/drivers/build_all/modem/testcase.yaml index 25c338b9fda..89abfbd79df 100644 --- a/tests/drivers/build_all/modem/testcase.yaml +++ b/tests/drivers/build_all/modem/testcase.yaml @@ -79,8 +79,6 @@ tests: platform_allow: - native_posix_64 - native_posix - - native_sim_64 - - native_sim - qemu_x86 - qemu_x86_64 min_ram: 36 diff --git a/tests/drivers/build_all/regulator/testcase.yaml b/tests/drivers/build_all/regulator/testcase.yaml index 8214a2ca33a..c5dbda1913f 100644 --- a/tests/drivers/build_all/regulator/testcase.yaml +++ b/tests/drivers/build_all/regulator/testcase.yaml @@ -5,6 +5,4 @@ tests: drivers.regulator.build: tags: drivers regulator build_only: true - platform_allow: - - native_posix - - native_sim + platform_allow: native_posix diff --git a/tests/drivers/build_all/video/testcase.yaml b/tests/drivers/build_all/video/testcase.yaml index 08dd430da73..22595c7be54 100644 --- a/tests/drivers/build_all/video/testcase.yaml +++ b/tests/drivers/build_all/video/testcase.yaml @@ -5,9 +5,7 @@ common: - video tests: drivers.video.build: - platform_allow: - - native_posix - - native_sim + platform_allow: native_posix min_ram: 32 depends_on: - gpio From 85537fb33419b5d6b1e515af505dfcd3650bdcbd Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:53 +0100 Subject: [PATCH 0909/2300] Revert "[nrf fromtree] tests/subsys/modem/*: Switch to native_sim" This reverts commit 49d76e4330ad5a064e33d510fc49a8bec377d4b5. Signed-off-by: Robert Lubos --- tests/subsys/modem/backends/tty/testcase.yaml | 6 +----- tests/subsys/modem/modem_chat/testcase.yaml | 6 +----- tests/subsys/modem/modem_cmux/testcase.yaml | 6 +----- tests/subsys/modem/modem_ppp/testcase.yaml | 6 +----- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/tests/subsys/modem/backends/tty/testcase.yaml b/tests/subsys/modem/backends/tty/testcase.yaml index 28d3c3d4aa2..11f78b1d641 100644 --- a/tests/subsys/modem/backends/tty/testcase.yaml +++ b/tests/subsys/modem/backends/tty/testcase.yaml @@ -5,8 +5,4 @@ tests: modem.backends.tty: tags: modem_backend_tty harness: ztest - platform_allow: - - native_posix - - native_sim - integration_platforms: - - native_sim + platform_allow: native_posix diff --git a/tests/subsys/modem/modem_chat/testcase.yaml b/tests/subsys/modem/modem_chat/testcase.yaml index 2b8723428ea..8716d7f0d17 100644 --- a/tests/subsys/modem/modem_chat/testcase.yaml +++ b/tests/subsys/modem/modem_chat/testcase.yaml @@ -5,8 +5,4 @@ tests: modem.modem_chat: tags: modem_chat harness: ztest - platform_allow: - - native_posix - - native_sim - integration_platforms: - - native_sim + platform_allow: native_posix diff --git a/tests/subsys/modem/modem_cmux/testcase.yaml b/tests/subsys/modem/modem_cmux/testcase.yaml index fd89a3f5656..c7d1f53a085 100644 --- a/tests/subsys/modem/modem_cmux/testcase.yaml +++ b/tests/subsys/modem/modem_cmux/testcase.yaml @@ -5,8 +5,4 @@ tests: modem.modem_cmux: tags: modem_cmux harness: ztest - platform_allow: - - native_posix - - native_sim - integration_platforms: - - native_sim + platform_allow: native_posix diff --git a/tests/subsys/modem/modem_ppp/testcase.yaml b/tests/subsys/modem/modem_ppp/testcase.yaml index 7e0937ea144..0b3fef701f3 100644 --- a/tests/subsys/modem/modem_ppp/testcase.yaml +++ b/tests/subsys/modem/modem_ppp/testcase.yaml @@ -5,8 +5,4 @@ tests: modem.modem_ppp: tags: modem_ppp harness: ztest - platform_allow: - - native_posix - - native_sim - integration_platforms: - - native_sim + platform_allow: native_posix From a21efae923869049bacdb64f6641972b62d6738d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:53 +0100 Subject: [PATCH 0910/2300] Revert "[nrf fromtree] net: l2: wifi: Fix Print of SSID in WIFI scan result" This reverts commit b3ab0a74995528fd39328c0e41a9bf7ec8b7055c. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 71f3cec7c10..304f1748bfe 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -107,7 +107,6 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) (const struct wifi_scan_result *)cb->info; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; const struct shell *sh = context.sh; - uint8_t ssid_print[WIFI_SSID_MAX_LEN + 1]; context.scan_result++; @@ -116,11 +115,8 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) "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'; - PR("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", - context.scan_result, ssid_print, entry->ssid_length, entry->channel, + context.scan_result, entry->ssid, entry->ssid_length, entry->channel, wifi_band_txt(entry->band), entry->rssi, wifi_security_txt(entry->security), From d95f92eff7fa17d613635e8132b2bfd48c82da0e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:53 +0100 Subject: [PATCH 0911/2300] Revert "[nrf fromtree] wifi: shell: replace print(...) with PR(...)" This reverts commit 09d53a0fc0039662a8785ae16dee4d34a55a432a. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 193 ++++++++++++++++++-------------- 1 file changed, 107 insertions(+), 86 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 304f1748bfe..bfaa35c9a71 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -75,6 +75,15 @@ struct wifi_ap_sta_node { }; static struct wifi_ap_sta_node sta_list[CONFIG_WIFI_SHELL_MAX_AP_STA]; +#define print(sh, level, fmt, ...) \ + do { \ + if (sh) { \ + shell_fprintf(sh, level, fmt, ##__VA_ARGS__); \ + } else { \ + printk(fmt, ##__VA_ARGS__); \ + } \ + } while (false) + static bool parse_number(const struct shell *sh, long *param, char *str, long min, long max) { char *endptr; @@ -89,12 +98,12 @@ static bool parse_number(const struct shell *sh, long *param, char *str, long mi } if (*endptr != '\0') { - PR_ERROR("Invalid number: %s", str_tmp); + print(sh, SHELL_ERROR, "Invalid number: %s", str_tmp); return false; } if ((num) < (min) || (num) > (max)) { - PR_WARNING("Value out of range: %s, (%ld-%ld)", str_tmp, min, max); + print(sh, SHELL_WARNING, "Value out of range: %s, (%ld-%ld)", str_tmp, min, max); return false; } *param = num; @@ -106,25 +115,26 @@ static void handle_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")]; - const struct shell *sh = context.sh; context.scan_result++; if (context.scan_result == 1U) { - PR("\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n", - "Num", "SSID", "(len)", "Chan (Band)", "RSSI", "Security", "BSSID", "MFP"); - } - - PR("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", - context.scan_result, entry->ssid, 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)); + print(context.sh, SHELL_NORMAL, + "\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n", + "Num", "SSID", "(len)", "Chan (Band)", "RSSI", "Security", "BSSID", "MFP"); + } + + print(context.sh, SHELL_NORMAL, + "%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", + context.scan_result, entry->ssid, 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 int wifi_freq_to_channel(int frequency) @@ -178,27 +188,28 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) context.scan_result++; if (context.scan_result == 1U) { - PR("\n%-4s | %-13s | %-4s | %-15s | %-15s | %-32s\n", - "Num", "Channel (Band)", "RSSI", "BSSID", "Frame length", "Frame Body"); + print(sh, SHELL_NORMAL, + "\n%-4s | %-13s | %-4s | %-15s | %-15s | %-32s\n", + "Num", "Channel (Band)", "RSSI", "BSSID", "Frame length", "Frame Body"); } rssi = raw->rssi; channel = wifi_freq_to_channel(raw->frequency); band = wifi_freq_to_band(raw->frequency); - PR("%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", - context.scan_result, - channel, - wifi_band_txt(band), - rssi, - net_sprint_ll_addr_buf(raw->data + 10, WIFI_MAC_ADDR_LEN, mac_string_buf, - sizeof(mac_string_buf)), raw->frame_length); + print(sh, SHELL_NORMAL, "%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", + context.scan_result, + channel, + wifi_band_txt(band), + rssi, + net_sprint_ll_addr_buf(raw->data + 10, WIFI_MAC_ADDR_LEN, mac_string_buf, + sizeof(mac_string_buf)), raw->frame_length); for (i = 0; i < 32; i++) { - PR("%02X ", *(raw->data + i)); + print(sh, SHELL_NORMAL, "%02X ", *(raw->data + i)); } - PR("\n"); + print(sh, SHELL_NORMAL, "\n"); } #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ @@ -209,9 +220,10 @@ static void handle_wifi_scan_done(struct net_mgmt_event_callback *cb) const struct shell *sh = context.sh; if (status->status) { - PR_WARNING("Scan request failed (%d)\n", status->status); + print(sh, SHELL_WARNING, + "Scan request failed (%d)\n", status->status); } else { - PR("Scan request done\n"); + print(sh, SHELL_NORMAL, "Scan request done\n"); } context.scan_result = 0U; @@ -221,12 +233,12 @@ static void handle_wifi_connect_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *) cb->info; - const struct shell *sh = context.sh; if (status->status) { - PR_WARNING("Connection request failed (%d)\n", status->status); + print(context.sh, SHELL_WARNING, + "Connection request failed (%d)\n", status->status); } else { - PR("Connected\n"); + print(context.sh, SHELL_NORMAL, "Connected\n"); } context.connecting = false; @@ -236,17 +248,16 @@ static void handle_wifi_disconnect_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *) cb->info; - const struct shell *sh = context.sh; if (context.disconnecting) { - if (status->status) { - PR_WARNING("Disconnection request failed (%d)\n", status->status); - } else { - PR("Disconnection request done (%d)\n", status->status); - } + print(context.sh, + status->status ? SHELL_WARNING : SHELL_NORMAL, + "Disconnection request %s (%d)\n", + status->status ? "failed" : "done", + status->status); context.disconnecting = false; } else { - PR("Disconnected\n"); + print(context.sh, SHELL_NORMAL, "Disconnected\n"); } } @@ -258,25 +269,25 @@ static void print_twt_params(uint8_t dialog_token, uint8_t flow_id, { const struct shell *sh = context.sh; - PR("TWT Dialog token: %d\n", + print(sh, SHELL_NORMAL, "TWT Dialog token: %d\n", dialog_token); - PR("TWT flow ID: %d\n", + print(sh, SHELL_NORMAL, "TWT flow ID: %d\n", flow_id); - PR("TWT negotiation type: %s\n", + print(sh, SHELL_NORMAL, "TWT negotiation type: %s\n", wifi_twt_negotiation_type_txt(negotiation_type)); - PR("TWT responder: %s\n", + print(sh, SHELL_NORMAL, "TWT responder: %s\n", responder ? "true" : "false"); - PR("TWT implicit: %s\n", + print(sh, SHELL_NORMAL, "TWT implicit: %s\n", implicit ? "true" : "false"); - PR("TWT announce: %s\n", + print(sh, SHELL_NORMAL, "TWT announce: %s\n", announce ? "true" : "false"); - PR("TWT trigger: %s\n", + print(sh, SHELL_NORMAL, "TWT trigger: %s\n", trigger ? "true" : "false"); - PR("TWT wake interval: %d us\n", + print(sh, SHELL_NORMAL, "TWT wake interval: %d us\n", twt_wake_interval); - PR("TWT interval: %lld us\n", + print(sh, SHELL_NORMAL, "TWT interval: %lld us\n", twt_interval); - PR("========================\n"); + print(sh, SHELL_NORMAL, "========================\n"); } static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) @@ -287,19 +298,19 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) if (resp->operation == WIFI_TWT_TEARDOWN) { if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { - PR("TWT teardown succeeded for flow ID %d\n", + print(sh, SHELL_NORMAL, "TWT teardown succeeded for flow ID %d\n", resp->flow_id); } else { - PR("TWT teardown failed for flow ID %d\n", + print(sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", resp->flow_id); } return; } if (resp->resp_status == WIFI_TWT_RESP_RECEIVED) { - PR("TWT response: %s\n", + print(sh, SHELL_NORMAL, "TWT response: %s\n", wifi_twt_setup_cmd_txt(resp->setup_cmd)); - PR("== TWT negotiated parameters ==\n"); + print(sh, SHELL_NORMAL, "== TWT negotiated parameters ==\n"); print_twt_params(resp->dialog_token, resp->flow_id, resp->negotiation_type, @@ -310,7 +321,7 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) resp->setup.twt_wake_interval, resp->setup.twt_interval); } else { - PR("TWT response timed out\n"); + print(sh, SHELL_NORMAL, "TWT response timed out\n"); } } @@ -321,9 +332,10 @@ static void handle_wifi_ap_enable_result(struct net_mgmt_event_callback *cb) const struct shell *sh = context.sh; if (status->status) { - PR_WARNING("AP enable request failed (%d)\n", status->status); + print(sh, SHELL_WARNING, + "AP enable request failed (%d)\n", status->status); } else { - PR("AP enabled\n"); + print(sh, SHELL_NORMAL, "AP enabled\n"); } } @@ -334,9 +346,10 @@ static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) const struct shell *sh = context.sh; if (status->status) { - PR_WARNING("AP disable request failed (%d)\n", status->status); + print(sh, SHELL_WARNING, + "AP disable request failed (%d)\n", status->status); } else { - PR("AP disabled\n"); + print(sh, SHELL_NORMAL, "AP disabled\n"); } k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); @@ -352,9 +365,9 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; int i; - PR("Station connected: %s\n", - net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, - mac_string_buf, sizeof(mac_string_buf))); + print(sh, SHELL_NORMAL, "Station connected: %s\n", + net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, + mac_string_buf, sizeof(mac_string_buf))); k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); for (i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { @@ -365,8 +378,8 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) } } if (i == CONFIG_WIFI_SHELL_MAX_AP_STA) { - PR_WARNING("No space to store station info: " - "Increase CONFIG_WIFI_SHELL_MAX_AP_STA\n"); + print(sh, SHELL_WARNING, "No space to store station info: " + "Increase CONFIG_WIFI_SHELL_MAX_AP_STA\n"); } k_mutex_unlock(&wifi_ap_sta_list_lock); } @@ -378,9 +391,9 @@ static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) const struct shell *sh = context.sh; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - PR("Station disconnected: %s\n", - net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, - mac_string_buf, sizeof(mac_string_buf))); + print(sh, SHELL_NORMAL, "Station disconnected: %s\n", + net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, + mac_string_buf, sizeof(mac_string_buf))); k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); for (int i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { @@ -455,8 +468,9 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->ssid = argv[0]; params->ssid_length = strlen(params->ssid); if (params->ssid_length > WIFI_SSID_MAX_LEN) { - PR_WARNING("SSID too long (max %d characters)\n", - WIFI_SSID_MAX_LEN); + print(sh, SHELL_WARNING, + "SSID too long (max %d characters)\n", + WIFI_SSID_MAX_LEN); return -EINVAL; } @@ -472,10 +486,11 @@ static int __wifi_args_to_params(size_t argc, char *argv[], size_t offset = 0; if (*endptr != '\0') { - PR_ERROR("Failed to parse channel: %s: endp: %s, err: %s\n", - argv[idx], - endptr, - strerror(errno)); + print(sh, SHELL_ERROR, + "Failed to parse channel: %s: endp: %s, err: %s\n", + argv[idx], + endptr, + strerror(errno)); return -EINVAL; } @@ -493,13 +508,15 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->band = WIFI_FREQ_BAND_6_GHZ; break; default: - PR_ERROR("Invalid band: %ld\n", channel); + print(sh, SHELL_ERROR, + "Invalid band: %ld\n", channel); return -EINVAL; } } } else { if (channel < 0) { - PR_ERROR("Invalid channel: %ld\n", channel); + print(sh, SHELL_ERROR, + "Invalid channel: %ld\n", channel); return -EINVAL; } } @@ -512,9 +529,10 @@ static int __wifi_args_to_params(size_t argc, char *argv[], band ? "," : "", wifi_band_txt(all_bands[band])); if (offset >= sizeof(bands_str)) { - PR_ERROR("Failed to parse channel: %s: " - "band string too long\n", - argv[idx]); + print(sh, SHELL_ERROR, + "Failed to parse channel: %s: " + "band string too long\n", + argv[idx]); return -EINVAL; } @@ -526,9 +544,10 @@ static int __wifi_args_to_params(size_t argc, char *argv[], } if (!found) { - PR_ERROR("Invalid channel: %ld, checked bands: %s\n", - channel, - bands_str); + print(sh, SHELL_ERROR, + "Invalid channel: %ld, checked bands: %s\n", + channel, + bands_str); return -EINVAL; } @@ -561,8 +580,9 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (security == WIFI_SECURITY_TYPE_NONE || security == WIFI_SECURITY_TYPE_WPA_PSK) { - PR_ERROR("MFP not supported for security type %s\n", - wifi_security_txt(security)); + print(sh, SHELL_ERROR, + "MFP not supported for security type %s\n", + wifi_security_txt(security)); return -EINVAL; } @@ -578,9 +598,10 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->psk_length > WIFI_PSK_MAX_LEN) || (params->security == WIFI_SECURITY_TYPE_SAE && params->psk_length > WIFI_SAE_PSWD_MAX_LEN)) { - PR_ERROR("Invalid PSK length (%d) for security type %s\n", - params->psk_length, - wifi_security_txt(params->security)); + print(sh, SHELL_ERROR, + "Invalid PSK length (%d) for security type %s\n", + params->psk_length, + wifi_security_txt(params->security)); return -EINVAL; } } From d3b6c718cf9080c19e7bb36f6d0a6573d1b3eab3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:54 +0100 Subject: [PATCH 0912/2300] Revert "[nrf fromtree] wifi: shell: refactor to use PR(...) from "net_shell_private.h"" This reverts commit 7f820a70b55baadec6f90e3f58be0986110ec395. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/CMakeLists.txt | 3 - subsys/net/l2/wifi/wifi_shell.c | 486 ++++++++++++++++-------------- 2 files changed, 265 insertions(+), 224 deletions(-) diff --git a/subsys/net/l2/wifi/CMakeLists.txt b/subsys/net/l2/wifi/CMakeLists.txt index aaf825599f0..445eb56c0a7 100644 --- a/subsys/net/l2/wifi/CMakeLists.txt +++ b/subsys/net/l2/wifi/CMakeLists.txt @@ -2,9 +2,6 @@ zephyr_library() zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/ip) -zephyr_library_include_directories_ifdef( - CONFIG_NET_L2_WIFI_SHELL ${ZEPHYR_BASE}/subsys/net/lib/shell - ) zephyr_library_compile_definitions_ifdef( CONFIG_NEWLIB_LIBC __LINUX_ERRNO_EXTENSIONS__ ) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index bfaa35c9a71..a181315d8c1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -27,13 +27,13 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #include #include -#include "net_shell_private.h" +#include "net_private.h" #define WIFI_SHELL_MODULE "wifi" #define WIFI_SHELL_MGMT_EVENTS_COMMON (NET_EVENT_WIFI_SCAN_DONE |\ NET_EVENT_WIFI_CONNECT_RESULT |\ - NET_EVENT_WIFI_DISCONNECT_RESULT |\ + NET_EVENT_WIFI_DISCONNECT_RESULT | \ NET_EVENT_WIFI_TWT |\ NET_EVENT_WIFI_RAW_SCAN_RESULT |\ NET_EVENT_WIFI_AP_ENABLE_RESULT |\ @@ -57,9 +57,9 @@ static struct { union { struct { - uint8_t connecting: 1; - uint8_t disconnecting: 1; - uint8_t _unused: 6; + uint8_t connecting : 1; + uint8_t disconnecting : 1; + uint8_t _unused : 6; }; uint8_t all; }; @@ -163,9 +163,9 @@ static enum wifi_frequency_bands wifi_freq_to_band(int frequency) { enum wifi_frequency_bands band = WIFI_FREQ_BAND_2_4_GHZ; - if ((frequency >= 2401) && (frequency <= 2495)) { + if ((frequency >= 2401) && (frequency <= 2495)) { band = WIFI_FREQ_BAND_2_4_GHZ; - } else if ((frequency >= 5170) && (frequency <= 5895)) { + } else if ((frequency >= 5170) && (frequency <= 5895)) { band = WIFI_FREQ_BAND_5_GHZ; } else { band = WIFI_FREQ_BAND_6_GHZ; @@ -452,8 +452,8 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, } static int __wifi_args_to_params(size_t argc, char *argv[], - struct wifi_connect_req_params *params, - enum wifi_iface_mode iface_mode) + struct wifi_connect_req_params *params, + enum wifi_iface_mode iface_mode) { char *endptr; int idx = 1; @@ -508,14 +508,14 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->band = WIFI_FREQ_BAND_6_GHZ; break; default: - print(sh, SHELL_ERROR, + print(context.sh, SHELL_ERROR, "Invalid band: %ld\n", channel); return -EINVAL; } } } else { if (channel < 0) { - print(sh, SHELL_ERROR, + print(context.sh, SHELL_ERROR, "Invalid channel: %ld\n", channel); return -EINVAL; } @@ -524,10 +524,10 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (channel > 0) { for (band = 0; band < ARRAY_SIZE(all_bands); band++) { offset += snprintf(bands_str + offset, - sizeof(bands_str) - offset, - "%s%s", - band ? "," : "", - wifi_band_txt(all_bands[band])); + sizeof(bands_str) - offset, + "%s%s", + band ? "," : "", + wifi_band_txt(all_bands[band])); if (offset >= sizeof(bands_str)) { print(sh, SHELL_ERROR, "Failed to parse channel: %s: " @@ -546,8 +546,8 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (!found) { print(sh, SHELL_ERROR, "Invalid channel: %ld, checked bands: %s\n", - channel, - bands_str); + channel, + bands_str); return -EINVAL; } @@ -606,6 +606,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], } } + return 0; } @@ -625,13 +626,14 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, if (net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, &cnx_params, sizeof(struct wifi_connect_req_params))) { - PR_WARNING("Connection request failed\n"); + shell_fprintf(sh, SHELL_WARNING, + "Connection request failed\n"); context.connecting = false; return -ENOEXEC; } - PR("Connection requested\n"); + shell_fprintf(sh, SHELL_NORMAL, "Connection requested\n"); return 0; } @@ -651,18 +653,23 @@ static int cmd_wifi_disconnect(const struct shell *sh, size_t argc, context.disconnecting = false; if (status == -EALREADY) { - PR_INFO("Already disconnected\n"); + shell_fprintf(sh, SHELL_INFO, + "Already disconnected\n"); } else { - PR_WARNING("Disconnect request failed\n"); + shell_fprintf(sh, SHELL_WARNING, + "Disconnect request failed\n"); return -ENOEXEC; } } else { - PR("Disconnect requested\n"); + shell_fprintf(sh, SHELL_NORMAL, + "Disconnect requested\n"); } return 0; } + + static int wifi_scan_args_to_params(const struct shell *sh, size_t argc, char *argv[], @@ -695,7 +702,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, } else if (!strncasecmp(optarg, "active", 6)) { params->scan_type = WIFI_SCAN_TYPE_ACTIVE; } else { - PR_ERROR("Invalid scan type %s\n", optarg); + shell_fprintf(sh, SHELL_ERROR, "Invalid scan type %s\n", optarg); return -ENOEXEC; } @@ -703,7 +710,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, break; case 'b': if (wifi_utils_parse_scan_bands(optarg, ¶ms->bands)) { - PR_ERROR("Invalid band value(s)\n"); + shell_fprintf(sh, SHELL_ERROR, "Invalid band value(s)\n"); return -ENOEXEC; } @@ -713,7 +720,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, val = atoi(optarg); if ((val < 5) || (val > 1000)) { - PR_ERROR("Invalid dwell_time_active val\n"); + shell_fprintf(sh, SHELL_ERROR, "Invalid dwell_time_active val\n"); return -ENOEXEC; } @@ -724,7 +731,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, val = atoi(optarg); if ((val < 10) || (val > 1000)) { - PR_ERROR("Invalid dwell_time_passive val\n"); + shell_fprintf(sh, SHELL_ERROR, "Invalid dwell_time_passive val\n"); return -ENOEXEC; } @@ -735,7 +742,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, if (wifi_utils_parse_scan_ssids(optarg, params->ssids, ARRAY_SIZE(params->ssids))) { - PR_ERROR("Invalid SSID(s)\n"); + shell_fprintf(sh, SHELL_ERROR, "Invalid SSID(s)\n"); return -ENOEXEC; } @@ -745,7 +752,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, val = atoi(optarg); if ((val < 0) || (val > 65535)) { - PR_ERROR("Invalid max_bss val\n"); + shell_fprintf(sh, SHELL_ERROR, "Invalid max_bss val\n"); return -ENOEXEC; } @@ -756,7 +763,9 @@ static int wifi_scan_args_to_params(const struct shell *sh, if (wifi_utils_parse_scan_chan(optarg, params->band_chan, ARRAY_SIZE(params->band_chan))) { - PR_ERROR("Invalid band or channel value(s)\n"); + shell_fprintf(sh, + SHELL_ERROR, + "Invalid band or channel value(s)\n"); return -ENOEXEC; } @@ -769,8 +778,8 @@ static int wifi_scan_args_to_params(const struct shell *sh, break; case '?': default: - PR_ERROR("Invalid option or option usage: %s\n", - argv[opt_index + 1]); + shell_fprintf(sh, SHELL_ERROR, "Invalid option or option usage: %s\n", + argv[opt_index + 1]); return -ENOEXEC; } } @@ -794,23 +803,23 @@ static int cmd_wifi_scan(const struct shell *sh, size_t argc, char *argv[]) shell_help(sh); return -ENOEXEC; } else if (!opt_num) { - PR_WARNING("No valid option(s) found\n"); + shell_fprintf(sh, SHELL_WARNING, "No valid option(s) found\n"); do_scan = false; } } if (do_scan) { if (net_mgmt(NET_REQUEST_WIFI_SCAN, iface, ¶ms, sizeof(params))) { - PR_WARNING("Scan request failed\n"); + shell_fprintf(sh, SHELL_WARNING, "Scan request failed\n"); return -ENOEXEC; } - PR("Scan requested\n"); + shell_fprintf(sh, SHELL_NORMAL, "Scan requested\n"); return 0; } - PR_WARNING("Scan not initiated\n"); + shell_fprintf(sh, SHELL_WARNING, "Scan not initiated\n"); return -ENOEXEC; } @@ -822,37 +831,43 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) context.sh = sh; if (net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, iface, &status, - sizeof(struct wifi_iface_status))) { - PR_WARNING("Status request failed\n"); + sizeof(struct wifi_iface_status))) { + shell_fprintf(sh, SHELL_WARNING, "Status request failed\n"); return -ENOEXEC; } - PR("Status: successful\n"); - PR("==================\n"); - PR("State: %s\n", wifi_state_txt(status.state)); + shell_fprintf(sh, SHELL_NORMAL, "Status: successful\n"); + shell_fprintf(sh, SHELL_NORMAL, "==================\n"); + shell_fprintf(sh, SHELL_NORMAL, "State: %s\n", wifi_state_txt(status.state)); if (status.state >= WIFI_STATE_ASSOCIATED) { uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - 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, + shell_fprintf(sh, SHELL_NORMAL, "Interface Mode: %s\n", + wifi_mode_txt(status.iface_mode)); + shell_fprintf(sh, SHELL_NORMAL, "Link Mode: %s\n", + wifi_link_mode_txt(status.link_mode)); + shell_fprintf(sh, SHELL_NORMAL, "SSID: %.32s\n", status.ssid); + shell_fprintf(sh, SHELL_NORMAL, "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)); + sizeof(mac_string_buf)) + ); + shell_fprintf(sh, SHELL_NORMAL, "Band: %s\n", + wifi_band_txt(status.band)); + shell_fprintf(sh, SHELL_NORMAL, "Channel: %d\n", status.channel); + shell_fprintf(sh, SHELL_NORMAL, "Security: %s\n", + wifi_security_txt(status.security)); + shell_fprintf(sh, SHELL_NORMAL, "MFP: %s\n", + wifi_mfp_txt(status.mfp)); if (status.iface_mode == WIFI_MODE_INFRA) { - PR("RSSI: %d\n", status.rssi); + shell_fprintf(sh, SHELL_NORMAL, "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"); + shell_fprintf(sh, SHELL_NORMAL, "Beacon Interval: %d\n", status.beacon_interval); + shell_fprintf(sh, SHELL_NORMAL, "DTIM: %d\n", status.dtim_period); + shell_fprintf(sh, SHELL_NORMAL, "TWT: %s\n", + status.twt_capable ? "Supported" : "Not supported"); } return 0; @@ -861,23 +876,24 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) #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, - const struct shell *sh) + const struct shell *sh) { - PR("Statistics for Wi-Fi interface %p [%d]\n", iface, - net_if_get_by_iface(iface)); - - PR("Bytes received : %u\n", data->bytes.received); - PR("Bytes sent : %u\n", data->bytes.sent); - PR("Packets received : %u\n", data->pkts.rx); - PR("Packets sent : %u\n", data->pkts.tx); - PR("Receive errors : %u\n", data->errors.rx); - PR("Send errors : %u\n", data->errors.tx); - PR("Bcast received : %u\n", data->broadcast.rx); - PR("Bcast sent : %u\n", data->broadcast.tx); - PR("Mcast received : %u\n", data->multicast.rx); - PR("Mcast sent : %u\n", data->multicast.tx); - PR("Beacons received : %u\n", data->sta_mgmt.beacons_rx); - PR("Beacons missed : %u\n", data->sta_mgmt.beacons_miss); + shell_fprintf(sh, SHELL_NORMAL, "Statistics for Wi-Fi interface %p [%d]\n", iface, + net_if_get_by_iface(iface)); + + shell_fprintf(sh, SHELL_NORMAL, "Bytes received : %u\n", data->bytes.received); + shell_fprintf(sh, SHELL_NORMAL, "Bytes sent : %u\n", data->bytes.sent); + shell_fprintf(sh, SHELL_NORMAL, "Packets received : %u\n", data->pkts.rx); + shell_fprintf(sh, SHELL_NORMAL, "Packets sent : %u\n", data->pkts.tx); + shell_fprintf(sh, SHELL_NORMAL, "Receive errors : %u\n", data->errors.rx); + shell_fprintf(sh, SHELL_NORMAL, "Send errors : %u\n", data->errors.tx); + shell_fprintf(sh, SHELL_NORMAL, "Bcast received : %u\n", data->broadcast.rx); + shell_fprintf(sh, SHELL_NORMAL, "Bcast sent : %u\n", data->broadcast.tx); + shell_fprintf(sh, SHELL_NORMAL, "Mcast received : %u\n", data->multicast.rx); + shell_fprintf(sh, SHELL_NORMAL, "Mcast sent : %u\n", data->multicast.tx); + shell_fprintf(sh, SHELL_NORMAL, "Beacons received : %u\n", data->sta_mgmt.beacons_rx); + shell_fprintf(sh, SHELL_NORMAL, "Beacons missed : %u\n", + data->sta_mgmt.beacons_miss); } #endif /* CONFIG_NET_STATISTICS_WIFI && CONFIG_NET_STATISTICS_USER_API */ @@ -898,7 +914,7 @@ static int cmd_wifi_stats(const struct shell *sh, size_t argc, char *argv[]) ARG_UNUSED(argc); ARG_UNUSED(argv); - PR_INFO("Set %s to enable %s support.\n", + shell_fprintf(sh, SHELL_INFO, "Set %s to enable %s support.\n", "CONFIG_NET_STATISTICS_WIFI and CONFIG_NET_STATISTICS_USER_API", "statistics"); #endif /* CONFIG_NET_STATISTICS_WIFI && CONFIG_NET_STATISTICS_USER_API */ @@ -914,7 +930,7 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) context.sh = sh; if (argc > 2) { - PR_WARNING("Invalid number of arguments\n"); + shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); return -ENOEXEC; } @@ -923,32 +939,33 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) if (net_mgmt(NET_REQUEST_WIFI_PS_CONFIG, iface, &config, sizeof(config))) { - PR_WARNING("Failed to get PS config\n"); + shell_fprintf(sh, SHELL_WARNING, "Failed to get PS config\n"); return -ENOEXEC; } - PR("PS status: %s\n", - wifi_ps_txt(config.ps_params.enabled)); + shell_fprintf(sh, SHELL_NORMAL, "PS status: %s\n", + wifi_ps_txt(config.ps_params.enabled)); if (config.ps_params.enabled) { - PR("PS mode: %s\n", - wifi_ps_mode_txt(config.ps_params.mode)); + shell_fprintf(sh, SHELL_NORMAL, "PS mode: %s\n", + wifi_ps_mode_txt(config.ps_params.mode)); } - PR("PS listen_interval: %d\n", - config.ps_params.listen_interval); + shell_fprintf(sh, SHELL_NORMAL, "PS listen_interval: %d\n", + config.ps_params.listen_interval); - PR("PS wake up mode: %s\n", - config.ps_params.wakeup_mode ? "Listen interval" : "DTIM"); + shell_fprintf(sh, SHELL_NORMAL, "PS wake up mode: %s\n", + config.ps_params.wakeup_mode ? "Listen interval" : "DTIM"); if (config.ps_params.timeout_ms) { - PR("PS timeout: %d ms\n", - config.ps_params.timeout_ms); + shell_fprintf(sh, SHELL_NORMAL, "PS timeout: %d ms\n", + config.ps_params.timeout_ms); } else { - PR("PS timeout: disabled\n"); + shell_fprintf(sh, SHELL_NORMAL, "PS timeout: disabled\n"); } + if (config.num_twt_flows == 0) { - PR("No TWT flows\n"); + shell_fprintf(sh, SHELL_NORMAL, "No TWT flows\n"); } else { for (int i = 0; i < config.num_twt_flows; i++) { print_twt_params( @@ -961,8 +978,9 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) config.twt_flows[i].trigger, config.twt_flows[i].twt_wake_interval, config.twt_flows[i].twt_interval); - PR("TWT Wake ahead duration : %d us\n", - config.twt_flows[i].twt_wake_ahead_duration); + shell_fprintf(sh, SHELL_NORMAL, + "TWT Wake ahead duration : %d us\n", + config.twt_flows[i].twt_wake_ahead_duration); } } return 0; @@ -973,20 +991,21 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) } else if (!strncasecmp(argv[1], "off", 3)) { params.enabled = WIFI_PS_DISABLED; } else { - PR_WARNING("Invalid argument\n"); + shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n"); return -ENOEXEC; } params.type = WIFI_PS_PARAM_STATE; if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { - PR_WARNING("PS %s failed. Reason: %s\n", - params.enabled ? "enable" : "disable", - wifi_ps_get_config_err_code_str(params.fail_reason)); + shell_fprintf(sh, SHELL_WARNING, + "PS %s failed. Reason: %s\n", + params.enabled ? "enable" : "disable", + wifi_ps_get_config_err_code_str(params.fail_reason)); return -ENOEXEC; } - PR("%s\n", wifi_ps_txt(params.enabled)); + shell_fprintf(sh, SHELL_NORMAL, "%s\n", wifi_ps_txt(params.enabled)); return 0; } @@ -1003,20 +1022,20 @@ static int cmd_wifi_ps_mode(const struct shell *sh, size_t argc, char *argv[]) } else if (!strncasecmp(argv[1], "WMM", 3)) { params.mode = WIFI_PS_MODE_WMM; } else { - PR_WARNING("Invalid PS mode\n"); + shell_fprintf(sh, SHELL_WARNING, "Invalid PS mode\n"); return -ENOEXEC; } params.type = WIFI_PS_PARAM_MODE; if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { - PR_WARNING("%s failed Reason : %s\n", - wifi_ps_mode_txt(params.mode), - wifi_ps_get_config_err_code_str(params.fail_reason)); + shell_fprintf(sh, SHELL_WARNING, "%s failed Reason : %s\n", + wifi_ps_mode_txt(params.mode), + wifi_ps_get_config_err_code_str(params.fail_reason)); return -ENOEXEC; } - PR("%s\n", wifi_ps_mode_txt(params.mode)); + shell_fprintf(sh, SHELL_NORMAL, "%s\n", wifi_ps_mode_txt(params.mode)); return 0; } @@ -1041,22 +1060,23 @@ static int cmd_wifi_ps_timeout(const struct shell *sh, size_t argc, char *argv[] params.type = WIFI_PS_PARAM_TIMEOUT; if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { - PR_WARNING("Setting PS timeout failed. Reason : %s\n", - wifi_ps_get_config_err_code_str(params.fail_reason)); + shell_fprintf(sh, SHELL_WARNING, + "Setting PS timeout failed. Reason : %s\n", + wifi_ps_get_config_err_code_str(params.fail_reason)); return -ENOEXEC; } if (params.timeout_ms) { - PR("PS timeout: %d ms\n", params.timeout_ms); + shell_fprintf(sh, SHELL_NORMAL, "PS timeout: %d ms\n", params.timeout_ms); } else { - PR("PS timeout: disabled\n"); + shell_fprintf(sh, SHELL_NORMAL, "PS timeout: disabled\n"); } return 0; } static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc, - char *argv[]) + char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); struct wifi_twt_params params = { 0 }; @@ -1087,21 +1107,22 @@ static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc, params.setup.twt_interval = (uint64_t)value; if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { - PR_WARNING("%s with %s failed, reason : %s\n", - wifi_twt_operation_txt(params.operation), - wifi_twt_negotiation_type_txt(params.negotiation_type), - wifi_twt_get_err_code_str(params.fail_reason)); + shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n", + wifi_twt_operation_txt(params.operation), + wifi_twt_negotiation_type_txt(params.negotiation_type), + wifi_twt_get_err_code_str(params.fail_reason)); return -ENOEXEC; } - PR("TWT operation %s with dg: %d, flow_id: %d requested\n", - wifi_twt_operation_txt(params.operation), - params.dialog_token, params.flow_id); + shell_fprintf(sh, SHELL_NORMAL, "TWT operation %s with dg: %d, flow_id: %d requested\n", + wifi_twt_operation_txt(params.operation), + params.dialog_token, params.flow_id); return 0; } + static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, char *argv[]) { @@ -1172,23 +1193,23 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, params.setup.twt_wake_ahead_duration = (uint32_t)value; if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { - PR_WARNING("%s with %s failed. reason : %s\n", - wifi_twt_operation_txt(params.operation), - wifi_twt_negotiation_type_txt(params.negotiation_type), - wifi_twt_get_err_code_str(params.fail_reason)); + shell_fprintf(sh, SHELL_WARNING, "%s with %s failed. reason : %s\n", + wifi_twt_operation_txt(params.operation), + wifi_twt_negotiation_type_txt(params.negotiation_type), + wifi_twt_get_err_code_str(params.fail_reason)); return -ENOEXEC; } - PR("TWT operation %s with dg: %d, flow_id: %d requested\n", - wifi_twt_operation_txt(params.operation), - params.dialog_token, params.flow_id); + shell_fprintf(sh, SHELL_NORMAL, "TWT operation %s with dg: %d, flow_id: %d requested\n", + wifi_twt_operation_txt(params.operation), + params.dialog_token, params.flow_id); return 0; } static int cmd_wifi_twt_teardown(const struct shell *sh, size_t argc, - char *argv[]) + char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); struct wifi_twt_params params = { 0 }; @@ -1222,23 +1243,23 @@ static int cmd_wifi_twt_teardown(const struct shell *sh, size_t argc, params.flow_id = (uint8_t)value; if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { - PR_WARNING("%s with %s failed, reason : %s\n", - wifi_twt_operation_txt(params.operation), - wifi_twt_negotiation_type_txt(params.negotiation_type), - wifi_twt_get_err_code_str(params.fail_reason)); + shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n", + wifi_twt_operation_txt(params.operation), + wifi_twt_negotiation_type_txt(params.negotiation_type), + wifi_twt_get_err_code_str(params.fail_reason)); return -ENOEXEC; } - PR("TWT operation %s with dg: %d, flow_id: %d success\n", - wifi_twt_operation_txt(params.operation), - params.dialog_token, params.flow_id); + shell_fprintf(sh, SHELL_NORMAL, "TWT operation %s with dg: %d, flow_id: %d success\n", + wifi_twt_operation_txt(params.operation), + params.dialog_token, params.flow_id); return 0; } static int cmd_wifi_twt_teardown_all(const struct shell *sh, size_t argc, - char *argv[]) + char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); struct wifi_twt_params params = { 0 }; @@ -1249,16 +1270,16 @@ static int cmd_wifi_twt_teardown_all(const struct shell *sh, size_t argc, params.teardown.teardown_all = 1; if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { - PR_WARNING("%s with %s failed, reason : %s\n", - wifi_twt_operation_txt(params.operation), - wifi_twt_negotiation_type_txt(params.negotiation_type), - wifi_twt_get_err_code_str(params.fail_reason)); + shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n", + wifi_twt_operation_txt(params.operation), + wifi_twt_negotiation_type_txt(params.negotiation_type), + wifi_twt_get_err_code_str(params.fail_reason)); return -ENOEXEC; } - PR("TWT operation %s all flows success\n", - wifi_twt_operation_txt(params.operation)); + shell_fprintf(sh, SHELL_NORMAL, "TWT operation %s all flows success\n", + wifi_twt_operation_txt(params.operation)); return 0; } @@ -1279,13 +1300,13 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, k_mutex_init(&wifi_ap_sta_list_lock); ret = net_mgmt(NET_REQUEST_WIFI_AP_ENABLE, iface, &cnx_params, - sizeof(struct wifi_connect_req_params)); + sizeof(struct wifi_connect_req_params)); if (ret) { - PR_WARNING("AP mode enable failed: %s\n", strerror(-ret)); + shell_fprintf(sh, SHELL_WARNING, "AP mode enable failed: %s\n", strerror(-ret)); return -ENOEXEC; } - PR("AP mode enable requested\n"); + shell_fprintf(sh, SHELL_NORMAL, "AP mode enable requested\n"); return 0; } @@ -1298,11 +1319,11 @@ static int cmd_wifi_ap_disable(const struct shell *sh, size_t argc, ret = net_mgmt(NET_REQUEST_WIFI_AP_DISABLE, iface, NULL, 0); if (ret) { - PR_WARNING("AP mode disable failed: %s\n", strerror(-ret)); + shell_fprintf(sh, SHELL_WARNING, "AP mode disable failed: %s\n", strerror(-ret)); return -ENOEXEC; } - PR("AP mode disable requested\n"); + shell_fprintf(sh, SHELL_NORMAL, "AP mode disable requested\n"); return 0; } @@ -1314,8 +1335,8 @@ static int cmd_wifi_ap_stations(const struct shell *sh, size_t argc, ARG_UNUSED(argv); ARG_UNUSED(argc); - PR("AP stations:\n"); - PR("============\n"); + shell_fprintf(sh, SHELL_NORMAL, "AP stations:\n"); + shell_fprintf(sh, SHELL_NORMAL, "============\n"); k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); for (int i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { @@ -1328,21 +1349,21 @@ static int cmd_wifi_ap_stations(const struct shell *sh, size_t argc, sta = &sta_list[i].sta_info; - PR("Station %zu:\n", id++); - PR("==========\n"); - PR("MAC: %s\n", - net_sprint_ll_addr_buf(sta->mac, - WIFI_MAC_ADDR_LEN, - mac_string_buf, - sizeof(mac_string_buf))); - PR("Link mode: %s\n", - wifi_link_mode_txt(sta->link_mode)); - PR("TWT: %s\n", - sta->twt_capable ? "Supported" : "Not supported"); + shell_fprintf(sh, SHELL_NORMAL, "Station %zu:\n", id++); + shell_fprintf(sh, SHELL_NORMAL, "==========\n"); + shell_fprintf(sh, SHELL_NORMAL, "MAC: %s\n", + net_sprint_ll_addr_buf(sta->mac, + WIFI_MAC_ADDR_LEN, + mac_string_buf, + sizeof(mac_string_buf))); + shell_fprintf(sh, SHELL_NORMAL, "Link mode: %s\n", + wifi_link_mode_txt(sta->link_mode)); + shell_fprintf(sh, SHELL_NORMAL, "TWT: %s\n", + sta->twt_capable ? "Supported" : "Not supported"); } if (id == 1) { - PR("No stations connected\n"); + shell_fprintf(sh, SHELL_NORMAL, "No stations connected\n"); } k_mutex_unlock(&wifi_ap_sta_list_lock); @@ -1363,18 +1384,18 @@ static int cmd_wifi_ap_sta_disconnect(const struct shell *sh, size_t argc, } if (net_bytes_from_str(mac, sizeof(mac), argv[1]) < 0) { - PR_WARNING("Invalid MAC address\n"); + shell_fprintf(sh, SHELL_WARNING, "Invalid MAC address\n"); return -ENOEXEC; } ret = net_mgmt(NET_REQUEST_WIFI_AP_STA_DISCONNECT, iface, mac, sizeof(mac)); if (ret) { - PR_WARNING("AP station disconnect failed: %s\n", - strerror(-ret)); + shell_fprintf(sh, SHELL_WARNING, "AP station disconnect failed: %s\n", + strerror(-ret)); return -ENOEXEC; } - PR("AP station disconnect requested\n"); + shell_fprintf(sh, SHELL_NORMAL, "AP station disconnect requested\n"); return 0; } @@ -1391,7 +1412,8 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, } else if (argc >= 2 && argc <= 3) { regd.oper = WIFI_MGMT_SET; if (strlen(argv[1]) != 2) { - PR_WARNING("Invalid reg domain: Length should be two letters/digits\n"); + shell_fprintf(sh, SHELL_WARNING, + "Invalid reg domain: Length should be two letters/digits\n"); return -ENOEXEC; } @@ -1399,7 +1421,8 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, if (((argv[1][0] < 'A' || argv[1][0] > 'Z') || (argv[1][1] < 'A' || argv[1][1] > 'Z')) && (argv[1][0] != '0' || argv[1][1] != '0')) { - PR_WARNING("Invalid reg domain %c%c\n", argv[1][0], argv[1][1]); + shell_fprintf(sh, SHELL_WARNING, "Invalid reg domain %c%c\n", argv[1][0], + argv[1][1]); return -ENOEXEC; } regd.country_code[0] = argv[1][0]; @@ -1409,7 +1432,7 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, if (strncmp(argv[2], "-f", 2) == 0) { regd.force = true; } else { - PR_WARNING("Invalid option %s\n", argv[2]); + shell_fprintf(sh, SHELL_WARNING, "Invalid option %s\n", argv[2]); return -ENOEXEC; } } @@ -1421,28 +1444,30 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, ret = net_mgmt(NET_REQUEST_WIFI_REG_DOMAIN, iface, ®d, sizeof(regd)); if (ret) { - PR_WARNING("Cannot %s Regulatory domain: %d\n", - regd.oper == WIFI_MGMT_GET ? "get" : "set", ret); + shell_fprintf(sh, SHELL_WARNING, "Cannot %s Regulatory domain: %d\n", + regd.oper == WIFI_MGMT_GET ? "get" : "set", ret); return -ENOEXEC; } if (regd.oper == WIFI_MGMT_GET) { - PR("Wi-Fi Regulatory domain is: %c%c\n", - regd.country_code[0], regd.country_code[1]); - PR("\t
\t\t" - "\t\t\n"); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Regulatory domain is: %c%c\n", + regd.country_code[0], regd.country_code[1]); + shell_fprintf(sh, SHELL_NORMAL, + "\t
\t\t" + "\t\t\n"); for (chan_idx = 0; chan_idx < regd.num_channels; chan_idx++) { - PR(" %d\t\t\t\%d\t\t\t\%s\t\t\t%d\t\t\t%s\t\t\t\t%s\n", - wifi_freq_to_channel(chan_info[chan_idx].center_frequency), - chan_info[chan_idx].center_frequency, - chan_info[chan_idx].supported ? "y" : "n", - chan_info[chan_idx].max_power, - chan_info[chan_idx].passive_only ? "y" : "n", - chan_info[chan_idx].dfs ? "y" : "n"); + shell_fprintf(sh, SHELL_NORMAL, + " %d\t\t\t\%d\t\t\t\%s\t\t\t%d\t\t\t%s\t\t\t\t%s\n", + wifi_freq_to_channel(chan_info[chan_idx].center_frequency), + chan_info[chan_idx].center_frequency, + chan_info[chan_idx].supported ? "y" : "n", + chan_info[chan_idx].max_power, + chan_info[chan_idx].passive_only ? "y" : "n", + chan_info[chan_idx].dfs ? "y" : "n"); } } else { - PR("Wi-Fi Regulatory domain set to: %c%c\n", - regd.country_code[0], regd.country_code[1]); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Regulatory domain set to: %c%c\n", + regd.country_code[0], regd.country_code[1]); } return 0; @@ -1468,17 +1493,21 @@ static int cmd_wifi_listen_interval(const struct shell *sh, size_t argc, char *a if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { if (params.fail_reason == 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)); + shell_fprintf(sh, SHELL_WARNING, + "Setting listen interval failed. Reason :%s\n", + wifi_ps_get_config_err_code_str(params.fail_reason)); + shell_fprintf(sh, SHELL_WARNING, + "Hardware support valid range : 3 - 65535\n"); + } else { + shell_fprintf(sh, SHELL_WARNING, + "Setting listen interval failed. Reason :%s\n", + wifi_ps_get_config_err_code_str(params.fail_reason)); } return -ENOEXEC; } - PR("Listen interval %hu\n", params.listen_interval); + shell_fprintf(sh, SHELL_NORMAL, + "Listen interval %hu\n", params.listen_interval); return 0; } @@ -1495,21 +1524,24 @@ static int cmd_wifi_ps_wakeup_mode(const struct shell *sh, size_t argc, char *ar } else if (!strncasecmp(argv[1], "listen_interval", 15)) { params.wakeup_mode = WIFI_PS_WAKEUP_MODE_LISTEN_INTERVAL; } else { - PR_WARNING("Invalid argument\n"); - PR_INFO("Valid argument : / \n"); + shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n"); + shell_fprintf(sh, SHELL_INFO, + "Valid argument : / \n"); return -ENOEXEC; } params.type = WIFI_PS_PARAM_WAKEUP_MODE; if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) { - PR_WARNING("Setting PS wake up mode to %s failed..Reason :%s\n", - params.wakeup_mode ? "Listen interval" : "DTIM interval", - wifi_ps_get_config_err_code_str(params.fail_reason)); + shell_fprintf(sh, SHELL_WARNING, + "Setting PS wake up mode to %s failed..Reason :%s\n", + params.wakeup_mode ? "Listen interval" : "DTIM interval", + wifi_ps_get_config_err_code_str(params.fail_reason)); return -ENOEXEC; } - PR("%s\n", wifi_ps_wakeup_mode_txt(params.wakeup_mode)); + shell_fprintf(sh, SHELL_NORMAL, "%s\n", + wifi_ps_wakeup_mode_txt(params.wakeup_mode)); return 0; } @@ -1572,7 +1604,7 @@ static int cmd_wifi_mode(const struct shell *sh, size_t argc, char *argv[]) mode_info.oper = WIFI_MGMT_SET; parse_mode_args_to_params(sh, argc, argv, &mode_info, &do_mode_oper); } else { - PR_ERROR("Invalid number of arguments\n"); + shell_fprintf(sh, SHELL_ERROR, "Invalid number of arguments\n"); return -EINVAL; } @@ -1583,15 +1615,17 @@ static int cmd_wifi_mode(const struct shell *sh, size_t argc, char *argv[]) if (mode_info.if_index == 0) { iface = net_if_get_first_wifi(); if (iface == NULL) { - PR_ERROR("Cannot find the default wifi interface\n"); + shell_fprintf(sh, SHELL_ERROR, + "Cannot find the default wifi interface\n"); return -ENOEXEC; } mode_info.if_index = net_if_get_by_iface(iface); } else { iface = net_if_get_by_index(mode_info.if_index); if (iface == NULL) { - PR_ERROR("Cannot find interface for if_index %d\n", - mode_info.if_index); + shell_fprintf(sh, SHELL_ERROR, + "Cannot find interface for if_index %d\n", + mode_info.if_index); return -ENOEXEC; } } @@ -1599,15 +1633,16 @@ static int cmd_wifi_mode(const struct shell *sh, size_t argc, char *argv[]) ret = net_mgmt(NET_REQUEST_WIFI_MODE, iface, &mode_info, sizeof(mode_info)); if (ret) { - PR_ERROR("mode %s operation failed with reason %d\n", - mode_info.oper == WIFI_MGMT_GET ? "get" : "set", ret); + shell_fprintf(sh, SHELL_ERROR, "mode %s operation failed with reason %d\n", + mode_info.oper == WIFI_MGMT_GET ? "get" : "set", ret); return -ENOEXEC; } if (mode_info.oper == WIFI_MGMT_GET) { - PR("Wi-Fi current mode is %x\n", mode_info.mode); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi current mode is %x\n", + mode_info.mode); } else { - PR("Wi-Fi mode set to %x\n", mode_info.mode); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi mode set to %x\n", mode_info.mode); } } return 0; @@ -1626,7 +1661,7 @@ void parse_channel_args_to_params(const struct shell *sh, int argc, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; - while ((opt = getopt_long(argc, argv, "i:c:gh", long_options, &option_index)) != -1) { + while ((opt = getopt_long(argc, argv, "i:c:gh", long_options, &option_index)) != -1) { switch (opt) { case 'c': channel->channel = (uint16_t)atoi(optarg); @@ -1669,15 +1704,17 @@ static int cmd_wifi_channel(const struct shell *sh, size_t argc, char *argv[]) if (channel_info.if_index == 0) { iface = net_if_get_first_wifi(); if (iface == NULL) { - PR_ERROR("Cannot find the default wifi interface\n"); + shell_fprintf(sh, SHELL_ERROR, + "Cannot find the default wifi interface\n"); return -ENOEXEC; } channel_info.if_index = net_if_get_by_iface(iface); } else { iface = net_if_get_by_index(channel_info.if_index); if (iface == NULL) { - PR_ERROR("Cannot find interface for if_index %d\n", - channel_info.if_index); + shell_fprintf(sh, SHELL_ERROR, + "Cannot find interface for if_index %d\n", + channel_info.if_index); return -ENOEXEC; } } @@ -1685,24 +1722,28 @@ static int cmd_wifi_channel(const struct shell *sh, size_t argc, char *argv[]) if (channel_info.oper == WIFI_MGMT_SET) { if ((channel_info.channel < WIFI_CHANNEL_MIN) || (channel_info.channel > WIFI_CHANNEL_MAX)) { - PR_ERROR("Invalid channel number. Range is (1-233)\n"); + shell_fprintf(sh, SHELL_ERROR, + "Invalid channel number. Range is (1-233)\n"); return -ENOEXEC; } } - ret = net_mgmt(NET_REQUEST_WIFI_CHANNEL, iface, &channel_info, - sizeof(channel_info)); + ret = net_mgmt(NET_REQUEST_WIFI_CHANNEL, iface, + &channel_info, sizeof(channel_info)); if (ret) { - PR_ERROR("channel %s operation failed with reason %d\n", - channel_info.oper == WIFI_MGMT_GET ? "get" : "set", ret); + shell_fprintf(sh, SHELL_ERROR, + "channel %s operation failed with reason %d\n", + channel_info.oper == WIFI_MGMT_GET ? "get" : "set", ret); return -ENOEXEC; } if (channel_info.oper == WIFI_MGMT_GET) { - PR("Wi-Fi current channel is: %d\n", channel_info.channel); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi current channel is: %d\n", + channel_info.channel); } else { - PR("Wi-Fi channel set to %d\n", channel_info.channel); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi channel set to %d\n", + channel_info.channel); } } return 0; @@ -1725,7 +1766,7 @@ void parse_filter_args_to_params(const struct shell *sh, int argc, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; - while ((opt = getopt_long(argc, argv, "i:b:amcdgh", long_options, &option_index)) != -1) { + while ((opt = getopt_long(argc, argv, "i:b:amcdgh", long_options, &option_index)) != -1) { switch (opt) { case 'a': filter->filter |= WIFI_PACKET_FILTER_ALL; @@ -1780,34 +1821,37 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg if (packet_filter.if_index == 0) { iface = net_if_get_first_wifi(); if (iface == NULL) { - PR_ERROR("Cannot find the default wifi interface\n"); + shell_fprintf(sh, SHELL_ERROR, + "Cannot find the default wifi interface\n"); return -ENOEXEC; } packet_filter.if_index = net_if_get_by_iface(iface); } else { iface = net_if_get_by_index(packet_filter.if_index); if (iface == NULL) { - PR_ERROR("Cannot find interface for if_index %d\n", - packet_filter.if_index); + shell_fprintf(sh, SHELL_ERROR, + "Cannot find interface for if_index %d\n", + packet_filter.if_index); return -ENOEXEC; } } - ret = net_mgmt(NET_REQUEST_WIFI_PACKET_FILTER, iface, &packet_filter, - sizeof(packet_filter)); + ret = net_mgmt(NET_REQUEST_WIFI_PACKET_FILTER, iface, + &packet_filter, sizeof(packet_filter)); if (ret) { - PR_ERROR("Wi-Fi packet filter %s operation failed with reason %d\n", - packet_filter.oper == WIFI_MGMT_GET ? "get" : "set", ret); + shell_fprintf(sh, SHELL_ERROR, + "Wi-Fi packet filter %s operation failed with reason %d\n", + packet_filter.oper == WIFI_MGMT_GET ? "get" : "set", ret); return -ENOEXEC; } if (packet_filter.oper == WIFI_MGMT_GET) { - PR("Wi-Fi current mode packet filter is %d\n", - packet_filter.filter); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi current mode packet filter is %d\n", + packet_filter.filter); } else { - PR("Wi-Fi mode packet filter set to %d\n", - packet_filter.filter); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi mode packet filter set to %d\n", + packet_filter.filter); } } return 0; @@ -1819,17 +1863,17 @@ static int cmd_wifi_version(const struct shell *sh, size_t argc, char *argv[]) struct wifi_version version = {0}; if (argc > 1) { - PR_WARNING("Invalid number of arguments\n"); + shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); return -ENOEXEC; } if (net_mgmt(NET_REQUEST_WIFI_VERSION, iface, &version, sizeof(version))) { - PR_WARNING("Failed to get Wi-Fi versions\n"); + shell_fprintf(sh, SHELL_WARNING, "Failed to get Wi-Fi versions\n"); return -ENOEXEC; } - PR("Wi-Fi Driver Version: %s\n", version.drv_version); - PR("Wi-Fi Firmware Version: %s\n", version.fw_version); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Driver Version: %s\n", version.drv_version); + shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Firmware Version: %s\n", version.fw_version); return 0; } From 8ad8b492136341d77646c7714102117d4f1a9d0f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:54 +0100 Subject: [PATCH 0913/2300] Revert "[nrf fromtree] wifi: shell: move "scan_result" variable into context struct" This reverts commit 99f8db6805a7b18a29b3f0825df0733091f52385. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index a181315d8c1..1bda0e1610d 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -52,7 +52,6 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); static struct { const struct shell *sh; - uint32_t scan_result; union { struct { @@ -65,6 +64,8 @@ static struct { }; } context; +static uint32_t scan_result; + static struct net_mgmt_event_callback wifi_shell_mgmt_cb; static struct wifi_reg_chan_info chan_info[MAX_REG_CHAN_NUM]; @@ -116,9 +117,9 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) (const struct wifi_scan_result *)cb->info; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - context.scan_result++; + scan_result++; - if (context.scan_result == 1U) { + if (scan_result == 1U) { print(context.sh, SHELL_NORMAL, "\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n", "Num", "SSID", "(len)", "Chan (Band)", "RSSI", "Security", "BSSID", "MFP"); @@ -126,7 +127,7 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) print(context.sh, SHELL_NORMAL, "%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", - context.scan_result, entry->ssid, entry->ssid_length, entry->channel, + scan_result, entry->ssid, entry->ssid_length, entry->channel, wifi_band_txt(entry->band), entry->rssi, wifi_security_txt(entry->security), @@ -185,9 +186,9 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; const struct shell *sh = context.sh; - context.scan_result++; + scan_result++; - if (context.scan_result == 1U) { + if (scan_result == 1U) { print(sh, SHELL_NORMAL, "\n%-4s | %-13s | %-4s | %-15s | %-15s | %-32s\n", "Num", "Channel (Band)", "RSSI", "BSSID", "Frame length", "Frame Body"); @@ -198,7 +199,7 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) band = wifi_freq_to_band(raw->frequency); print(sh, SHELL_NORMAL, "%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", - context.scan_result, + scan_result, channel, wifi_band_txt(band), rssi, @@ -226,7 +227,7 @@ static void handle_wifi_scan_done(struct net_mgmt_event_callback *cb) print(sh, SHELL_NORMAL, "Scan request done\n"); } - context.scan_result = 0U; + scan_result = 0U; } static void handle_wifi_connect_result(struct net_mgmt_event_callback *cb) @@ -2057,7 +2058,7 @@ static int wifi_shell_init(void) context.sh = NULL; context.all = 0U; - context.scan_result = 0U; + scan_result = 0U; net_mgmt_init_event_callback(&wifi_shell_mgmt_cb, wifi_mgmt_event_handler, From f95854de0bb579ff8f2622e20802ce3f8571d171 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:54 +0100 Subject: [PATCH 0914/2300] Revert "[nrf fromtree] wifi: shell: introduce local 'sh' variable" This reverts commit f8bfd5b161edec8dccf8c89e402b3125e8cb9fbf. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 80 +++++++++++++++------------------ 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1bda0e1610d..829f0dc96da 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -184,12 +184,11 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) int rssi; int i = 0; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - const struct shell *sh = context.sh; scan_result++; if (scan_result == 1U) { - print(sh, SHELL_NORMAL, + print(context.sh, SHELL_NORMAL, "\n%-4s | %-13s | %-4s | %-15s | %-15s | %-32s\n", "Num", "Channel (Band)", "RSSI", "BSSID", "Frame length", "Frame Body"); } @@ -198,7 +197,7 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) channel = wifi_freq_to_channel(raw->frequency); band = wifi_freq_to_band(raw->frequency); - print(sh, SHELL_NORMAL, "%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", + print(context.sh, SHELL_NORMAL, "%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", scan_result, channel, wifi_band_txt(band), @@ -207,10 +206,10 @@ static void handle_wifi_raw_scan_result(struct net_mgmt_event_callback *cb) sizeof(mac_string_buf)), raw->frame_length); for (i = 0; i < 32; i++) { - print(sh, SHELL_NORMAL, "%02X ", *(raw->data + i)); + print(context.sh, SHELL_NORMAL, "%02X ", *(raw->data + i)); } - print(sh, SHELL_NORMAL, "\n"); + print(context.sh, SHELL_NORMAL, "\n"); } #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ @@ -218,13 +217,12 @@ static void handle_wifi_scan_done(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *)cb->info; - const struct shell *sh = context.sh; if (status->status) { - print(sh, SHELL_WARNING, + print(context.sh, SHELL_WARNING, "Scan request failed (%d)\n", status->status); } else { - print(sh, SHELL_NORMAL, "Scan request done\n"); + print(context.sh, SHELL_NORMAL, "Scan request done\n"); } scan_result = 0U; @@ -268,50 +266,47 @@ static void print_twt_params(uint8_t dialog_token, uint8_t flow_id, bool trigger, uint32_t twt_wake_interval, uint64_t twt_interval) { - const struct shell *sh = context.sh; - - print(sh, SHELL_NORMAL, "TWT Dialog token: %d\n", + print(context.sh, SHELL_NORMAL, "TWT Dialog token: %d\n", dialog_token); - print(sh, SHELL_NORMAL, "TWT flow ID: %d\n", + print(context.sh, SHELL_NORMAL, "TWT flow ID: %d\n", flow_id); - print(sh, SHELL_NORMAL, "TWT negotiation type: %s\n", + print(context.sh, SHELL_NORMAL, "TWT negotiation type: %s\n", wifi_twt_negotiation_type_txt(negotiation_type)); - print(sh, SHELL_NORMAL, "TWT responder: %s\n", + print(context.sh, SHELL_NORMAL, "TWT responder: %s\n", responder ? "true" : "false"); - print(sh, SHELL_NORMAL, "TWT implicit: %s\n", + print(context.sh, SHELL_NORMAL, "TWT implicit: %s\n", implicit ? "true" : "false"); - print(sh, SHELL_NORMAL, "TWT announce: %s\n", + print(context.sh, SHELL_NORMAL, "TWT announce: %s\n", announce ? "true" : "false"); - print(sh, SHELL_NORMAL, "TWT trigger: %s\n", + print(context.sh, SHELL_NORMAL, "TWT trigger: %s\n", trigger ? "true" : "false"); - print(sh, SHELL_NORMAL, "TWT wake interval: %d us\n", + print(context.sh, SHELL_NORMAL, "TWT wake interval: %d us\n", twt_wake_interval); - print(sh, SHELL_NORMAL, "TWT interval: %lld us\n", + print(context.sh, SHELL_NORMAL, "TWT interval: %lld us\n", twt_interval); - print(sh, SHELL_NORMAL, "========================\n"); + print(context.sh, SHELL_NORMAL, "========================\n"); } static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) { const struct wifi_twt_params *resp = (const struct wifi_twt_params *)cb->info; - const struct shell *sh = context.sh; if (resp->operation == WIFI_TWT_TEARDOWN) { if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { - print(sh, SHELL_NORMAL, "TWT teardown succeeded for flow ID %d\n", + print(context.sh, SHELL_NORMAL, "TWT teardown succeeded for flow ID %d\n", resp->flow_id); } else { - print(sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", + print(context.sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", resp->flow_id); } return; } if (resp->resp_status == WIFI_TWT_RESP_RECEIVED) { - print(sh, SHELL_NORMAL, "TWT response: %s\n", + print(context.sh, SHELL_NORMAL, "TWT response: %s\n", wifi_twt_setup_cmd_txt(resp->setup_cmd)); - print(sh, SHELL_NORMAL, "== TWT negotiated parameters ==\n"); + print(context.sh, SHELL_NORMAL, "== TWT negotiated parameters ==\n"); print_twt_params(resp->dialog_token, resp->flow_id, resp->negotiation_type, @@ -322,7 +317,7 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) resp->setup.twt_wake_interval, resp->setup.twt_interval); } else { - print(sh, SHELL_NORMAL, "TWT response timed out\n"); + print(context.sh, SHELL_NORMAL, "TWT response timed out\n"); } } @@ -330,13 +325,12 @@ static void handle_wifi_ap_enable_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *)cb->info; - const struct shell *sh = context.sh; if (status->status) { - print(sh, SHELL_WARNING, + print(context.sh, SHELL_WARNING, "AP enable request failed (%d)\n", status->status); } else { - print(sh, SHELL_NORMAL, "AP enabled\n"); + print(context.sh, SHELL_NORMAL, "AP enabled\n"); } } @@ -344,13 +338,12 @@ static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *)cb->info; - const struct shell *sh = context.sh; if (status->status) { - print(sh, SHELL_WARNING, + print(context.sh, SHELL_WARNING, "AP disable request failed (%d)\n", status->status); } else { - print(sh, SHELL_NORMAL, "AP disabled\n"); + print(context.sh, SHELL_NORMAL, "AP disabled\n"); } k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); @@ -362,11 +355,10 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) { const struct wifi_ap_sta_info *sta_info = (const struct wifi_ap_sta_info *)cb->info; - const struct shell *sh = context.sh; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; int i; - print(sh, SHELL_NORMAL, "Station connected: %s\n", + print(context.sh, SHELL_NORMAL, "Station connected: %s\n", net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, mac_string_buf, sizeof(mac_string_buf))); @@ -379,7 +371,7 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) } } if (i == CONFIG_WIFI_SHELL_MAX_AP_STA) { - print(sh, SHELL_WARNING, "No space to store station info: " + print(context.sh, SHELL_WARNING, "No space to store station info: " "Increase CONFIG_WIFI_SHELL_MAX_AP_STA\n"); } k_mutex_unlock(&wifi_ap_sta_list_lock); @@ -389,10 +381,9 @@ static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) { const struct wifi_ap_sta_info *sta_info = (const struct wifi_ap_sta_info *)cb->info; - const struct shell *sh = context.sh; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - print(sh, SHELL_NORMAL, "Station disconnected: %s\n", + print(context.sh, SHELL_NORMAL, "Station disconnected: %s\n", net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, mac_string_buf, sizeof(mac_string_buf))); @@ -458,7 +449,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], { char *endptr; int idx = 1; - const struct shell *sh = context.sh; /* Defaults */ params->band = WIFI_FREQ_BAND_UNKNOWN; @@ -469,7 +459,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->ssid = argv[0]; params->ssid_length = strlen(params->ssid); if (params->ssid_length > WIFI_SSID_MAX_LEN) { - print(sh, SHELL_WARNING, + print(context.sh, SHELL_WARNING, "SSID too long (max %d characters)\n", WIFI_SSID_MAX_LEN); return -EINVAL; @@ -487,7 +477,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], size_t offset = 0; if (*endptr != '\0') { - print(sh, SHELL_ERROR, + print(context.sh, SHELL_ERROR, "Failed to parse channel: %s: endp: %s, err: %s\n", argv[idx], endptr, @@ -530,7 +520,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], band ? "," : "", wifi_band_txt(all_bands[band])); if (offset >= sizeof(bands_str)) { - print(sh, SHELL_ERROR, + print(context.sh, SHELL_ERROR, "Failed to parse channel: %s: " "band string too long\n", argv[idx]); @@ -545,7 +535,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], } if (!found) { - print(sh, SHELL_ERROR, + print(context.sh, SHELL_ERROR, "Invalid channel: %ld, checked bands: %s\n", channel, bands_str); @@ -581,7 +571,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (security == WIFI_SECURITY_TYPE_NONE || security == WIFI_SECURITY_TYPE_WPA_PSK) { - print(sh, SHELL_ERROR, + print(context.sh, SHELL_ERROR, "MFP not supported for security type %s\n", wifi_security_txt(security)); return -EINVAL; @@ -599,7 +589,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->psk_length > WIFI_PSK_MAX_LEN) || (params->security == WIFI_SECURITY_TYPE_SAE && params->psk_length > WIFI_SAE_PSWD_MAX_LEN)) { - print(sh, SHELL_ERROR, + print(context.sh, SHELL_ERROR, "Invalid PSK length (%d) for security type %s\n", params->psk_length, wifi_security_txt(params->security)); @@ -979,7 +969,7 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) config.twt_flows[i].trigger, config.twt_flows[i].twt_wake_interval, config.twt_flows[i].twt_interval); - shell_fprintf(sh, SHELL_NORMAL, + shell_fprintf(context.sh, SHELL_NORMAL, "TWT Wake ahead duration : %d us\n", config.twt_flows[i].twt_wake_ahead_duration); } From 37747cd0b25ec6c549b76b02b62b769e5b46fd44 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:54 +0100 Subject: [PATCH 0915/2300] Revert "[nrf fromtree] net: wifi: add wifi driver version API" This reverts commit f72c03ef68974e0a3c5fce8f958b323491a04c93. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 28 ---------------------------- subsys/net/l2/wifi/wifi_mgmt.c | 16 ---------------- subsys/net/l2/wifi/wifi_shell.c | 24 ------------------------ 3 files changed, 68 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index c287db650cb..982184a103b 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -83,8 +83,6 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_CHANNEL, /** Disconnect a STA from AP */ NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT, - /** Get Wi-Fi driver and Firmware versions */ - NET_REQUEST_WIFI_CMD_VERSION, NET_REQUEST_WIFI_CMD_MAX }; @@ -167,11 +165,6 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT); -#define NET_REQUEST_WIFI_VERSION \ - (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_VERSION) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION); - /** Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -243,14 +236,6 @@ enum net_event_wifi_cmd { #define NET_EVENT_WIFI_AP_STA_DISCONNECTED \ (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED) -/** Wi-Fi version */ -struct wifi_version { - /** Driver version */ - const char *drv_version; - /** Firmware version */ - const char *fw_version; -}; - /** * @brief Wi-Fi structure to uniquely identify a band-channel pair */ @@ -839,19 +824,6 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*channel)(const struct device *dev, struct wifi_channel_info *channel); - /** Get Version of WiFi driver and Firmware - * - * The driver that implements the get_version function must not use stack to allocate the - * version information pointers that are returned as params struct members. - * The version pointer parameters should point to a static memory either in ROM (preferred) - * or in RAM. - * - * @param dev Pointer to the device structure for the driver instance - * @param params Version parameters - * - * @return 0 if ok, < 0 if error - */ - int (*get_version)(const struct device *dev, struct wifi_version *params); }; /** Wi-Fi management offload API */ diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index bc844016fa5..2cfe8e25d89 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -703,22 +703,6 @@ static int wifi_channel(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL, wifi_channel); -static int wifi_get_version(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_version *ver_params = data; - - if (wifi_mgmt_api == NULL || wifi_mgmt_api->get_version == NULL) { - return -ENOTSUP; - } - - return wifi_mgmt_api->get_version(dev, ver_params); -} - -NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION, wifi_get_version); - #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface, struct wifi_raw_scan_result *raw_scan_result) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 829f0dc96da..823f389decb 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1848,27 +1848,6 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg return 0; } -static int cmd_wifi_version(const struct shell *sh, size_t argc, char *argv[]) -{ - struct net_if *iface = net_if_get_first_wifi(); - struct wifi_version version = {0}; - - if (argc > 1) { - shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); - return -ENOEXEC; - } - - if (net_mgmt(NET_REQUEST_WIFI_VERSION, iface, &version, sizeof(version))) { - shell_fprintf(sh, SHELL_WARNING, "Failed to get Wi-Fi versions\n"); - return -ENOEXEC; - } - - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Driver Version: %s\n", version.drv_version); - shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Firmware Version: %s\n", version.fw_version); - - return 0; -} - SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, SHELL_CMD_ARG(disable, NULL, "Disable Access Point mode.\n", @@ -1922,9 +1901,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, ); 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, "Connect to a Wi-Fi AP\n" From e9ba79ec0f3b1416a45272ee051937cb626d2a09 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:54 +0100 Subject: [PATCH 0916/2300] Revert "[nrf fromtree] wifi: shell: Remove duplicate argument count checks" This reverts commit 26c470e997954297bd4c9c74f9cf79b615656118. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 46 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 823f389decb..2b131d4e0fb 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -450,6 +450,12 @@ static int __wifi_args_to_params(size_t argc, char *argv[], char *endptr; int idx = 1; + if (argc < 1) { + print(context.sh, SHELL_WARNING, + "SSID not specified\n"); + return -EINVAL; + } + /* Defaults */ params->band = WIFI_FREQ_BAND_UNKNOWN; params->channel = WIFI_CHANNEL_ANY; @@ -1076,6 +1082,12 @@ static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc, context.sh = sh; + if (argc != 3) { + shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); + shell_help(sh); + return -ENOEXEC; + } + /* Sensible defaults */ params.operation = WIFI_TWT_SETUP; params.negotiation_type = WIFI_TWT_INDIVIDUAL; @@ -1124,6 +1136,12 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, context.sh = sh; + if (argc != 12) { + shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); + shell_help(sh); + return -ENOEXEC; + } + params.operation = WIFI_TWT_SETUP; if (!parse_number(sh, &value, argv[idx++], WIFI_TWT_INDIVIDUAL, @@ -1209,6 +1227,12 @@ static int cmd_wifi_twt_teardown(const struct shell *sh, size_t argc, context.sh = sh; int idx = 1; + if (argc != 5) { + shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); + shell_help(sh); + return -ENOEXEC; + } + params.operation = WIFI_TWT_TEARDOWN; if (!parse_number(sh, &value, argv[idx++], WIFI_TWT_INDIVIDUAL, @@ -1681,8 +1705,13 @@ static int cmd_wifi_channel(const struct shell *sh, size_t argc, char *argv[]) int ret; bool do_channel_oper = true; - channel_info.oper = WIFI_MGMT_SET; - parse_channel_args_to_params(sh, argc, argv, &channel_info, &do_channel_oper); + if (argc > 1) { + channel_info.oper = WIFI_MGMT_SET; + parse_channel_args_to_params(sh, argc, argv, &channel_info, &do_channel_oper); + } else { + shell_fprintf(sh, SHELL_ERROR, "Invalid number of arguments\n"); + return -EINVAL; + } if (do_channel_oper) { /* @@ -1798,8 +1827,13 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg int ret; bool do_filter_oper = true; - packet_filter.oper = WIFI_MGMT_SET; - parse_filter_args_to_params(sh, argc, argv, &packet_filter, &do_filter_oper); + if (argc > 1) { + packet_filter.oper = WIFI_MGMT_SET; + parse_filter_args_to_params(sh, argc, argv, &packet_filter, &do_filter_oper); + } else { + shell_fprintf(sh, SHELL_ERROR, "Invalid number of arguments\n"); + return -EINVAL; + } if (do_filter_oper) { /* @@ -1981,7 +2015,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "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), + 1, 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" @@ -1995,7 +2029,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "Set operation example for interface index 1 (setting channel 5)\n" "wifi -i1 -c5.\n", cmd_wifi_channel, - 2, 4), + 1, 4), SHELL_CMD_ARG(ps_timeout, NULL, " - PS inactivity timer(in ms).\n", From b2fe17f8a487dcbec3e2385e1250db5d67566642 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:54 +0100 Subject: [PATCH 0917/2300] Revert "[nrf fromtree] drivers: serial: nrfx_uarte: Fix misbehavior due to preemption" This reverts commit d45b0926081aa2b936c3123606800d1e3a49b4d2. Signed-off-by: Robert Lubos --- drivers/serial/uart_nrfx_uarte.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 6e1ecfadfd8..3a62057a47a 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -1043,11 +1043,9 @@ static void rx_timeout(struct k_timer *timer) (data->async->rx_timeout_left < data->async->rx_timeout_slab)) { /* rx_timeout us elapsed since last receiving */ - if (data->async->rx_buf != NULL) { - notify_uart_rx_rdy(dev, len); - data->async->rx_offset += len; - data->async->rx_total_user_byte_cnt += len; - } + notify_uart_rx_rdy(dev, len); + data->async->rx_offset += len; + data->async->rx_total_user_byte_cnt += len; } else { data->async->rx_timeout_left -= data->async->rx_timeout_slab; From 054725fa478492d5c3e870bfd2de91383e89fbfa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:55 +0100 Subject: [PATCH 0918/2300] Revert "[nrf fromtree] drivers: serial: Fix async to interrupt driven adaptation layer" This reverts commit 9eef3ac843217fe6d3990f30a96ede465bd87330. Signed-off-by: Robert Lubos --- drivers/serial/uart_async_to_irq.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/serial/uart_async_to_irq.c b/drivers/serial/uart_async_to_irq.c index e18536449f3..209e8d4f205 100644 --- a/drivers/serial/uart_async_to_irq.c +++ b/drivers/serial/uart_async_to_irq.c @@ -105,15 +105,12 @@ static void on_rx_buf_req(const struct device *dev, static void on_rx_dis(const struct device *dev, struct uart_async_to_irq_data *data) { if (data->flags & A2I_RX_ENABLE) { - int err; + data->rx.pending_buf_req = 0; - err = try_rx_enable(dev, data); - if (err == 0) { - data->rx.pending_buf_req = 0; - } + int err = try_rx_enable(dev, data); LOG_INST_DBG(get_config(dev)->log, "Reenabling RX from RX_DISABLED (err:%d)", err); - __ASSERT((err >= 0) || (err == -EBUSY), "err: %d", err); + __ASSERT_NO_MSG(err >= 0); return; } From daad07142ea331ca1d13f72f1aab804628d336b5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:55 +0100 Subject: [PATCH 0919/2300] Revert "[nrf fromtree] drivers: spi: nrfx: Deactivate CS from thread context" This reverts commit 6a311c3a569a9cbe6069638d4521683b712f2eb6. Signed-off-by: Robert Lubos --- drivers/spi/spi_nrfx_spi.c | 4 ++-- drivers/spi/spi_nrfx_spim.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi_nrfx_spi.c b/drivers/spi/spi_nrfx_spi.c index 752132fb248..04d7853d11d 100644 --- a/drivers/spi/spi_nrfx_spi.c +++ b/drivers/spi/spi_nrfx_spi.c @@ -161,6 +161,8 @@ static void finish_transaction(const struct device *dev, int error) struct spi_nrfx_data *dev_data = dev->data; struct spi_context *ctx = &dev_data->ctx; + spi_context_cs_control(ctx, false); + LOG_DBG("Transaction finished with status %d", error); spi_context_complete(ctx, dev, error); @@ -275,8 +277,6 @@ static int transceive(const struct device *dev, /* Clean up the driver state. */ k_sem_reset(&dev_data->ctx.sync); } - - spi_context_cs_control(&dev_data->ctx, false); } spi_context_release(&dev_data->ctx, error); diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 08012b389c5..95b737d6cf5 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -294,6 +294,8 @@ static void finish_transaction(const struct device *dev, int error) struct spi_nrfx_data *dev_data = dev->data; struct spi_context *ctx = &dev_data->ctx; + spi_context_cs_control(ctx, false); + LOG_DBG("Transaction finished with status %d", error); spi_context_complete(ctx, dev, error); @@ -468,8 +470,6 @@ static int transceive(const struct device *dev, anomaly_58_workaround_clear(dev_data); #endif } - - spi_context_cs_control(&dev_data->ctx, false); } spi_context_release(&dev_data->ctx, error); From 6ee7a6db72b9c352c7c3a7986c9094f4eab29d99 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:55 +0100 Subject: [PATCH 0920/2300] Revert "[nrf fromtree] soc: nrf53: fix building anomaly 168 workaround" This reverts commit a9b738e897ccb0dae74c46aef788ba09c5e0d78f. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h b/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h index c02c9451419..dcb0c73d068 100644 --- a/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h +++ b/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h @@ -13,12 +13,12 @@ #if defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM) #define SOC_ON_EXIT_CPU_IDLE \ - .rept 26; \ + .rept 26 \ nop; \ .endr #elif defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND) #define SOC_ON_EXIT_CPU_IDLE \ - .rept 8; \ + .rept 8 \ nop; \ .endr #endif From 577d6ce72a4247a5fb7199f6469e450152fd2fbe Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:55 +0100 Subject: [PATCH 0921/2300] Revert "[nrf fromtree] soc: nrf53: Add implementation of workaround for anomaly 168" This reverts commit e2e36fe60e49524f445170a0ddd04a5c8e7743fd. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/nrf53/Kconfig.soc | 22 +--------------------- soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h | 10 ++-------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.soc b/soc/arm/nordic_nrf/nrf53/Kconfig.soc index b3ca2661675..f72ae5ab004 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.soc @@ -12,14 +12,13 @@ config SOC_NRF5340_CPUAPP select HAS_POWEROFF select SOC_COMPATIBLE_NRF5340_CPUAPP imply SOC_NRF53_RTC_PRETICK - imply SOC_NRF53_ANOMALY_168_WORKAROUND config SOC_NRF5340_CPUNET bool + select ARM_ON_EXIT_CPU_IDLE select SOC_COMPATIBLE_NRF5340_CPUNET imply SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED imply SOC_NRF53_RTC_PRETICK if !WDT_NRFX - imply SOC_NRF53_ANOMALY_168_WORKAROUND choice prompt "nRF53x MCU Selection" @@ -80,25 +79,6 @@ config SOC_NRF53_RTC_PRETICK_IPC_CH_TO_NET endif -config SOC_NRF53_ANOMALY_168_WORKAROUND - bool "Workaround for nRF5340 anomaly 168" - select ARM_ON_EXIT_CPU_IDLE - help - Indicates that the workaround for the anomaly 168 that affects - the nRF5340 SoC should be applied. - The workaround involves execution of 8 NOP instructions when the CPU - exist its idle state (when the WFI/WFE instruction returns) and it is - enabled by default for both the application and network core. - -config SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM - bool "Extend the workaround to execution at 128 MHz from RAM" - depends on SOC_NRF53_ANOMALY_168_WORKAROUND && SOC_NRF5340_CPUAPP - help - Indicates that the anomaly 168 workaround is to be extended to cover - also a specific case when the WFI/WFE instruction is executed at 128 - MHz from RAM. Then, 26 instead of 8 NOP instructions needs to be - executed after WFI/WFE. This extension is not enabled by default. - if SOC_NRF5340_CPUAPP config SOC_DCDC_NRF53X_APP diff --git a/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h b/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h index dcb0c73d068..b6cd92ca092 100644 --- a/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h +++ b/soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h @@ -11,16 +11,10 @@ #if defined(_ASMLANGUAGE) -#if defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM) #define SOC_ON_EXIT_CPU_IDLE \ - .rept 26 \ nop; \ - .endr -#elif defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND) -#define SOC_ON_EXIT_CPU_IDLE \ - .rept 8 \ nop; \ - .endr -#endif + nop; \ + nop; #endif /* _ASMLANGUAGE */ From 479c38d66ebc5e72fd0eec5bf8f0375e9640c751 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:55 +0100 Subject: [PATCH 0922/2300] Revert "[nrf fromtree] drivers: spi: nrfx: Update doc for RAM_BUFFER_SIZE Kconfig symbol" This reverts commit 47bd797f34aba9775720545aca1afa01e49901cb. Signed-off-by: Robert Lubos --- drivers/spi/Kconfig.nrfx | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/spi/Kconfig.nrfx b/drivers/spi/Kconfig.nrfx index 0ee1c03065b..611bad822b2 100644 --- a/drivers/spi/Kconfig.nrfx +++ b/drivers/spi/Kconfig.nrfx @@ -75,20 +75,14 @@ config SPI_NRFX_RAM_BUFFER_SIZE default 8 depends on SPI_NRFX_SPIM help - Because of using EasyDMA, SPIM peripherals cannot use transmit and - receive buffers from all memory locations. They are restricted to - buffers located in certain RAM memories only. Therefore, each SPIM - driver instance needs to use an intermediate local RAM buffer, - to transfer data in chunks not exceeding the size of that buffer, - and to copy those chunks between the local buffer and the one - specified in the transfer request if the latter is not accessible - by EasyDMA. - - This option specifies the size in bytes of such local RAM buffers - for both TX and RX paths. A size of 0 means that this feature should - be disabled and the driver user must take care of not making transfer - requests with buffers not accessible by EasyDMA since such transfers - will fail. + SPIM peripherals cannot transmit data directly from flash. Therefore, + a buffer in RAM needs to be provided for each instance of SPI driver + using SPIM peripheral, so that the driver can copy there a chunk of + data from flash and transmit it. + The size is specified in bytes. A size of 0 means that this feature + should be disabled, and the application must then take care of not + supplying buffers located in flash to the driver, otherwise such + transfers will fail. config SPI_NRFX_WAKE_TIMEOUT_US int "Maximum time to wait for SPI slave to wake up" From d22351fda3638d1c3913df54566c6955357899d5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:56 +0100 Subject: [PATCH 0923/2300] Revert "[nrf fromtree] drivers: spi: spi_nrfx_spim: Add support for RX buffer from RAM region" This reverts commit d4c49ce4ec8411c4fb09f5117773ab4d7ffabd32. Signed-off-by: Robert Lubos --- drivers/spi/spi_nrfx_spim.c | 45 ++++++++----------------------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 95b737d6cf5..8a325097caa 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -41,9 +41,8 @@ struct spi_nrfx_data { size_t chunk_len; bool busy; bool initialized; -#ifdef SPI_BUFFER_IN_RAM - uint8_t *tx_buffer; - uint8_t *rx_buffer; +#if SPI_BUFFER_IN_RAM + uint8_t *buffer; #endif #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 bool anomaly_58_workaround_active; @@ -315,40 +314,27 @@ static void transfer_next_chunk(const struct device *dev) nrfx_spim_xfer_desc_t xfer; nrfx_err_t result; const uint8_t *tx_buf = ctx->tx_buf; - uint8_t *rx_buf = ctx->rx_buf; if (chunk_len > dev_config->max_chunk_len) { chunk_len = dev_config->max_chunk_len; } -#ifdef SPI_BUFFER_IN_RAM +#if (CONFIG_SPI_NRFX_RAM_BUFFER_SIZE > 0) if (spi_context_tx_buf_on(ctx) && !nrf_dma_accessible_check(&dev_config->spim.p_reg, tx_buf)) { - if (chunk_len > CONFIG_SPI_NRFX_RAM_BUFFER_SIZE) { chunk_len = CONFIG_SPI_NRFX_RAM_BUFFER_SIZE; } - memcpy(dev_data->tx_buffer, tx_buf, chunk_len); - tx_buf = dev_data->tx_buffer; - } - - if (spi_context_rx_buf_on(ctx) && - !nrf_dma_accessible_check(&dev_config->spim.p_reg, rx_buf)) { - - if (chunk_len > CONFIG_SPI_NRFX_RAM_BUFFER_SIZE) { - chunk_len = CONFIG_SPI_NRFX_RAM_BUFFER_SIZE; - } - - rx_buf = dev_data->rx_buffer; + memcpy(dev_data->buffer, tx_buf, chunk_len); + tx_buf = dev_data->buffer; } #endif - dev_data->chunk_len = chunk_len; xfer.p_tx_buffer = tx_buf; xfer.tx_length = spi_context_tx_buf_on(ctx) ? chunk_len : 0; - xfer.p_rx_buffer = rx_buf; + xfer.p_rx_buffer = ctx->rx_buf; xfer.rx_length = spi_context_rx_buf_on(ctx) ? chunk_len : 0; #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 @@ -392,15 +378,6 @@ static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context) #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 anomaly_58_workaround_clear(dev_data); -#endif -#ifdef SPI_BUFFER_IN_RAM - if (spi_context_rx_buf_on(&dev_data->ctx) && - p_event->xfer_desc.p_rx_buffer != NULL && - p_event->xfer_desc.p_rx_buffer != dev_data->ctx.rx_buf) { - (void)memcpy(dev_data->ctx.rx_buf, - dev_data->rx_buffer, - dev_data->chunk_len); - } #endif spi_context_update_tx(&dev_data->ctx, 1, dev_data->chunk_len); spi_context_update_rx(&dev_data->ctx, 1, dev_data->chunk_len); @@ -629,10 +606,7 @@ static int spi_nrfx_init(const struct device *dev) nrfx_isr, nrfx_spim_##idx##_irq_handler, 0); \ } \ IF_ENABLED(SPI_BUFFER_IN_RAM, \ - (static uint8_t spim_##idx##_tx_buffer \ - [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ - SPIM_MEMORY_SECTION(idx); \ - static uint8_t spim_##idx##_rx_buffer \ + (static uint8_t spim_##idx##_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ SPIM_MEMORY_SECTION(idx);)) \ static struct spi_nrfx_data spi_##idx##_data = { \ @@ -640,8 +614,7 @@ static int spi_nrfx_init(const struct device *dev) SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(SPIM(idx), ctx) \ IF_ENABLED(SPI_BUFFER_IN_RAM, \ - (.tx_buffer = spim_##idx##_tx_buffer, \ - .rx_buffer = spim_##idx##_rx_buffer,)) \ + (.buffer = spim_##idx##_buffer,)) \ .dev = DEVICE_DT_GET(SPIM(idx)), \ .busy = false, \ }; \ @@ -670,7 +643,7 @@ static int spi_nrfx_init(const struct device *dev) WAKE_PIN_NOT_USED), \ .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ }; \ - BUILD_ASSERT(!SPIM_HAS_PROP(idx, wake_gpios) || \ + BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIM(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ "WAKE line must be configured as active high"); \ PM_DEVICE_DT_DEFINE(SPIM(idx), spim_nrfx_pm_action); \ From ac0f7c89b87890fbfe5ad2d042e4d6c10c68dd14 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:56 +0100 Subject: [PATCH 0924/2300] Revert "[nrf fromtree] drivers: spi: nrfx: add dependency to PPI for PAN 58 on nRF52832" This reverts commit 1a180f541af22e30fdf8d3f125019c554816bcf6. Signed-off-by: Robert Lubos --- drivers/spi/Kconfig.nrfx | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/spi/Kconfig.nrfx b/drivers/spi/Kconfig.nrfx index 611bad822b2..c185efa9f8f 100644 --- a/drivers/spi/Kconfig.nrfx +++ b/drivers/spi/Kconfig.nrfx @@ -54,7 +54,6 @@ config SPI_NRFX_SPIS config SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 depends on SOC_NRF52832 - select NRFX_PPI bool "Allow enabling the SPIM driver despite PAN 58" help Allow enabling the nRF SPI Master with EasyDMA, despite From 8ec68707a89894bdde890070830875762bc79a36 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:56 +0100 Subject: [PATCH 0925/2300] Revert "[nrf fromtree] drivers: spim: Move the length check to beginning" This reverts commit 323863c7e343de0a8a7bd94844f72480bd3336fa. Signed-off-by: Robert Lubos --- drivers/spi/spi_nrfx_spim.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 8a325097caa..acd99264099 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -314,11 +314,6 @@ static void transfer_next_chunk(const struct device *dev) nrfx_spim_xfer_desc_t xfer; nrfx_err_t result; const uint8_t *tx_buf = ctx->tx_buf; - - if (chunk_len > dev_config->max_chunk_len) { - chunk_len = dev_config->max_chunk_len; - } - #if (CONFIG_SPI_NRFX_RAM_BUFFER_SIZE > 0) if (spi_context_tx_buf_on(ctx) && !nrf_dma_accessible_check(&dev_config->spim.p_reg, tx_buf)) { @@ -330,6 +325,10 @@ static void transfer_next_chunk(const struct device *dev) tx_buf = dev_data->buffer; } #endif + if (chunk_len > dev_config->max_chunk_len) { + chunk_len = dev_config->max_chunk_len; + } + dev_data->chunk_len = chunk_len; xfer.p_tx_buffer = tx_buf; From 2c553487497638fd470cf0b007b9ce1ac9942d22 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:56 +0100 Subject: [PATCH 0926/2300] Revert "[nrf fromtree] drivers: spi: spi_nrfx_spim: Use generic macro for RAM address check" This reverts commit 5f313a2b654efea6a3a2750c1f6cc545e091c5d2. Signed-off-by: Robert Lubos --- drivers/spi/spi_nrfx_spim.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index acd99264099..20aae46b8db 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -315,8 +315,7 @@ static void transfer_next_chunk(const struct device *dev) nrfx_err_t result; const uint8_t *tx_buf = ctx->tx_buf; #if (CONFIG_SPI_NRFX_RAM_BUFFER_SIZE > 0) - if (spi_context_tx_buf_on(ctx) && - !nrf_dma_accessible_check(&dev_config->spim.p_reg, tx_buf)) { + if (spi_context_tx_buf_on(ctx) && !nrfx_is_in_ram(tx_buf)) { if (chunk_len > CONFIG_SPI_NRFX_RAM_BUFFER_SIZE) { chunk_len = CONFIG_SPI_NRFX_RAM_BUFFER_SIZE; } From 7d9a673aaa3d66a151ee2968d5e52f96795e772c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:56 +0100 Subject: [PATCH 0927/2300] Revert "[nrf fromtree] drivers: spi: spi_nrfx_spim: Add additional symbol check for frequency" This reverts commit 850cfff1420e2ff48ec0c2a69f8bbbbf2f6d7fc0. Signed-off-by: Robert Lubos --- drivers/spi/spi_nrfx_spim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 20aae46b8db..2b7407ed56c 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -71,9 +71,9 @@ static inline uint32_t get_nrf_spim_frequency(uint32_t frequency) { /* Get the highest supported frequency not exceeding the requested one. */ - if (frequency >= MHZ(32) && (NRF_SPIM_HAS_32_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) { + if (frequency >= MHZ(32) && NRF_SPIM_HAS_32_MHZ_FREQ) { return MHZ(32); - } else if (frequency >= MHZ(16) && (NRF_SPIM_HAS_16_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) { + } else if (frequency >= MHZ(16) && NRF_SPIM_HAS_16_MHZ_FREQ) { return MHZ(16); } else if (frequency >= MHZ(8)) { return MHZ(8); From 4e35a0447bcfaf298282773339729a1e0041ca10 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:56 +0100 Subject: [PATCH 0928/2300] Revert "[nrf fromtree] drivers: spi: spi_nrfx_spim: Include nrf_clock.h only for nRF5340" This reverts commit c2e86baa6025ec8ee91dbb49d942bd2007549137. Signed-off-by: Robert Lubos --- drivers/spi/spi_nrfx_spim.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 2b7407ed56c..fb89f096cca 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -11,10 +11,8 @@ #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 #include #endif -#ifdef CONFIG_SOC_NRF5340_CPUAPP -#include -#endif #include +#include #include #include From ac79302f71f424f937dfa4e590c50d2b2ab429f8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:57 +0100 Subject: [PATCH 0929/2300] Revert "[nrf fromtree] drivers: i2s_nrfx: Generate master clock if pin is connected" This reverts commit 233af099c57352b72e84121bd23db88a82575701. Signed-off-by: Robert Lubos --- drivers/i2s/i2s_nrfx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/i2s/i2s_nrfx.c b/drivers/i2s/i2s_nrfx.c index 3c5af08e592..e1b3684c4f7 100644 --- a/drivers/i2s/i2s_nrfx.c +++ b/drivers/i2s/i2s_nrfx.c @@ -501,8 +501,7 @@ static int i2s_nrfx_configure(const struct device *dev, enum i2s_dir dir, * the MCK output is used), find a suitable clock configuration for it. */ if (nrfx_cfg.mode == NRF_I2S_MODE_MASTER || - (nrf_i2s_mck_pin_get(drv_cfg->i2s.p_reg) & I2S_PSEL_MCK_CONNECT_Msk) - == I2S_PSEL_MCK_CONNECT_Connected << I2S_PSEL_MCK_CONNECT_Pos) { + nrfx_cfg.mck_pin != NRF_I2S_PIN_NOT_CONNECTED) { find_suitable_clock(drv_cfg, &nrfx_cfg, i2s_cfg); /* Unless the PCLK32M source is used with the HFINT oscillator * (which is always available without any additional actions), From 73c34fe469c8bdd3e1b8a3642bc4aeb7c0669edf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:57 +0100 Subject: [PATCH 0930/2300] Revert "[nrf fromtree] Bluetooth: Correct `bt_att_create_rsp_pdu` reservation when EATT is enabled" This reverts commit 4c805d97081938cfb673fb9f9253e6be671fa1e8. Signed-off-by: Robert Lubos --- subsys/bluetooth/host/att.c | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 4e7e5b4880c..8b03990e84a 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -3007,40 +3007,13 @@ struct net_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, size_t len) struct net_buf *bt_att_create_rsp_pdu(struct bt_att_chan *chan, uint8_t op, size_t len) { - size_t headroom; - struct bt_att_hdr *hdr; - struct bt_att_tx_meta_data *data; - struct net_buf *buf; - - ARG_UNUSED(len); - - buf = bt_l2cap_create_pdu_timeout(NULL, 0, BT_ATT_TIMEOUT); - if (!buf) { - LOG_ERR("Unable to allocate buffer for op 0x%02x", op); - return NULL; - } - - headroom = BT_L2CAP_BUF_SIZE(0); - - if (bt_att_is_enhanced(chan)) { - headroom += BT_L2CAP_SDU_HDR_SIZE; - } - - net_buf_reserve(buf, headroom); - - data = tx_meta_data_alloc(BT_ATT_TIMEOUT); - if (!data) { - LOG_WRN("Unable to allocate ATT TX meta"); - net_buf_unref(buf); + if (len + sizeof(op) > bt_att_mtu(chan)) { + LOG_WRN("ATT channel %p MTU too small for RSP (%u < %u)", + chan, bt_att_mtu(chan), len + sizeof(op)); return NULL; } - data->att_chan = chan; - bt_att_tx_meta_data(buf) = data; - - hdr = net_buf_add(buf, sizeof(*hdr)); - hdr->code = op; - return buf; + return bt_att_chan_create_pdu(chan, op, len); } static void att_reset(struct bt_att *att) From e23a9b441b1875fbcf4cfb20c5a1d5e478d36713 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:57 +0100 Subject: [PATCH 0931/2300] Revert "[nrf fromtree] ipc: Drain pending work items before deregistering endpoint" This reverts commit fde57a95792a240114b209d6ed1d80bd7b5538e5. Signed-off-by: Robert Lubos --- subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c | 8 -------- 1 file changed, 8 deletions(-) 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 5478ece7ee3..dcbff7b360c 100644 --- a/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c +++ b/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c @@ -456,7 +456,6 @@ static int deregister_ept(const struct device *instance, void *token) { struct backend_data_t *data = instance->data; struct ipc_rpmsg_ept *rpmsg_ept; - static struct k_work_sync sync; /* Instance is not ready */ if (atomic_get(&data->state) != STATE_INITED) { @@ -470,13 +469,6 @@ static int deregister_ept(const struct device *instance, void *token) return -ENOENT; } - /* Drain pending work items before tearing down channel. - * - * Note: `k_work_flush` Faults on Cortex-M33 with "illegal use of EPSR" - * if `sync` is not declared static. - */ - k_work_flush(&data->mbox_work, &sync); - rpmsg_destroy_ept(&rpmsg_ept->ep); memset(rpmsg_ept, 0, sizeof(struct ipc_rpmsg_ept)); From ad7a145e3b4ea42095b75599eb8c93c38eba50c3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:57 +0100 Subject: [PATCH 0932/2300] Revert "[nrf fromlist] modules: hal_nordic: nrfx: Fix DPPI support for nRF54L15" This reverts commit 15669d37378a22dcdc5bc80db0b79fcb21f3a8ea. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 71d57814f36..ffd2e9aebc1 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -155,7 +155,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_C if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) 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() # Get the SVD file for the current SoC From 27fbf7b4ecbca734578e9ecd2974ddfbc2e37d09 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:57 +0100 Subject: [PATCH 0933/2300] Revert "[nrf fromtree] modules: tf-m: Rename crypto modules to ENABLED" This reverts commit b3039fd008b0edbafb2a74a79c004ea2b27eb59d. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 2bba4a45c6d..ea057498d2d 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -152,8 +152,11 @@ if (CONFIG_BUILD_WITH_TFM) foreach(module ${TFM_CRYPTO_MODULES}) if (CONFIG_TFM_${module}_ENABLED) # list(APPEND TFM_ENABLED_CRYPTO_MODULES_ARG ${module}) - list(APPEND TFM_CMAKE_ARGS -D${module}_ENABLED=True) + set(val "FALSE") + else() + set(val "TRUE") endif() + list(APPEND TFM_CMAKE_ARGS -D${module}_DISABLED=${val}) endforeach() set(TFM_BINARY_DIR ${CMAKE_BINARY_DIR}/tfm) From 58177b3f073ad37c81356bac4eac4a03371dcc31 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:58 +0100 Subject: [PATCH 0934/2300] Revert "[nrf fromtree] modules: tf-m: Remove QCBOR path from build" This reverts commit b97054511cb55b0693729c1777b7b986b1f06d1f. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index ea057498d2d..1fcffaa49b4 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -229,6 +229,14 @@ if (CONFIG_BUILD_WITH_TFM) string(REPLACE "toolchain" "toolchain_ns" TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_FILE}) + if (CONFIG_TFM_QCBOR_PATH STREQUAL "DOWNLOAD") + # Change CMake cache type to string to avoid QCBOR_PATH=/absolute/path/DOWNLOAD being set. + set(QCBOR_PATH_TYPE ":STRING") + endif() + # Always set QCBOR_PATH, this will make sure that we don't automatically download this + # dependency in the TF-M build system and it will fail when set to an invalid value. + list(APPEND TFM_CMAKE_ARGS -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH}) + if(CONFIG_BOARD_LPCXPRESSO55S69_CPU0) # Supply path to NXP HAL sources used for TF-M build set(TFM_PLATFORM_NXP_HAL_FILE_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/platform/ext/target/nxp/) From e88233e03345cdcff1394807acc6f880fbaa059d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:58 +0100 Subject: [PATCH 0935/2300] Revert "[nrf fromtree] modules: tf-m: Remove TFM_TEST_REPO_PATH" This reverts commit f7724b256c93e00bb8fb91bb1d2ed950ea925fd9. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 1fcffaa49b4..a9036495add 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -161,6 +161,7 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_BINARY_DIR ${CMAKE_BINARY_DIR}/tfm) + set(TFM_TEST_REPO_PATH ${ZEPHYR_CURRENT_MODULE_DIR}/../tf-m-tests) set(PSA_ARCH_TESTS_PATH ${ZEPHYR_CURRENT_MODULE_DIR}/../psa-arch-tests) set(TFM_INTERFACE_SOURCE_DIR ${TFM_BINARY_DIR}/api_ns/interface/src) @@ -279,6 +280,7 @@ if (CONFIG_BUILD_WITH_TFM) ${TFM_CMAKE_ARGS} $> -DMBEDCRYPTO_PATH=$>,$,${ZEPHYR_MBEDTLS_MODULE_DIR}> + -DTFM_TEST_REPO_PATH=${TFM_TEST_REPO_PATH} -DPSA_ARCH_TESTS_PATH=${PSA_ARCH_TESTS_PATH} ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR} WORKING_DIRECTORY ${TFM_BINARY_DIR} From 3767754c0d48434629cb77ee201770ef17b19d5a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:58 +0100 Subject: [PATCH 0936/2300] Revert "[nrf fromtree] tfm: Provide properties for selected TF-M toolchain for NS application" This reverts commit e3cc28b9892cd71952994f48026ab9a01232beb8. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/CMakeLists.txt | 7 ------- samples/tfm_integration/tfm_regression_test/CMakeLists.txt | 7 +------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index a9036495add..2ee282905e6 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -228,8 +228,6 @@ if (CONFIG_BUILD_WITH_TFM) message(FATAL_ERROR "Unsupported ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT}") endif() - string(REPLACE "toolchain" "toolchain_ns" TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_FILE}) - if (CONFIG_TFM_QCBOR_PATH STREQUAL "DOWNLOAD") # Change CMake cache type to string to avoid QCBOR_PATH=/absolute/path/DOWNLOAD being set. set(QCBOR_PATH_TYPE ":STRING") @@ -319,11 +317,6 @@ if (CONFIG_BUILD_WITH_TFM) # This is the root of all TFM build artifacts. set_target_properties(tfm PROPERTIES TFM_BINARY_DIR ${TFM_BINARY_DIR}) - # Set TFM toolchain properties on 'tfm' - set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_NS_FILE}) - set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_PREFIX ${TFM_TOOLCHAIN_PREFIX}) - set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_PATH ${TFM_TOOLCHAIN_PATH}) - # Set BL2 (MCUboot) executable file paths as target properties on 'tfm' # These files are produced by the TFM build system. if(CONFIG_TFM_BL2) diff --git a/samples/tfm_integration/tfm_regression_test/CMakeLists.txt b/samples/tfm_integration/tfm_regression_test/CMakeLists.txt index b86eebc4a81..571bf986206 100644 --- a/samples/tfm_integration/tfm_regression_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_regression_test/CMakeLists.txt @@ -17,10 +17,6 @@ get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE) get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE) get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE) -get_target_property(TFM_TOOLCHAIN_PATH tfm TFM_TOOLCHAIN_PATH) -get_target_property(TFM_TOOLCHAIN_PREFIX tfm TFM_TOOLCHAIN_PREFIX) -get_target_property(TFM_TOOLCHAIN_NS_FILE tfm TFM_TOOLCHAIN_NS_FILE) - set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests) set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_reg/test/secure_regression") @@ -47,8 +43,7 @@ ExternalProject_Add(tfm_regression_test_app -S ${TFM_TEST_REPO_PATH}/tests_reg -B ${PROJECT_BINARY_DIR}/tfm_ns -DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns - -DTFM_TOOLCHAIN_FILE=cmake/${TFM_TOOLCHAIN_NS_FILE} - -DCROSS_COMPILE=${TFM_TOOLCHAIN_PATH}/${TFM_TOOLCHAIN_PREFIX} + -DTFM_TOOLCHAIN_FILE=cmake/toolchain_ns_GNUARM.cmake -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH} -DCMAKE_BUILD_TYPE=RelWithDebInfo BUILD_COMMAND ${CMAKE_COMMAND} --build . From 3abef7a82e7418c3bb83ef267c0e9ec60d51b255 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:58 +0100 Subject: [PATCH 0937/2300] Revert "[nrf fromtree] samples: tfm_psa_test: Adapt to TF-M split build" This reverts commit bd990cb227e36bb366fd22ffd44fd7398d85caa4. Signed-off-by: Robert Lubos --- .../nordic_nrf/nrf5340_cpuapp/CMakeLists.txt | 5 - .../nordic_nrf/nrf9120/CMakeLists.txt | 4 - .../nordic_nrf/nrf9160/CMakeLists.txt | 4 - .../tfm_psa_test/CMakeLists.txt | 99 +------------------ samples/tfm_integration/tfm_psa_test/prj.conf | 2 - .../tfm_integration/tfm_psa_test/src/main.c | 12 ++- 6 files changed, 12 insertions(+), 114 deletions(-) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt index b74620fe2d5..35338d542d7 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt @@ -16,8 +16,3 @@ install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake install(FILES config.cmake DESTINATION ${INSTALL_PLATFORM_NS_DIR}) - -install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf5340dk_nrf5340_cpuapp/tests - - DESTINATION ${INSTALL_PLATFORM_NS_DIR} -) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt index 64fff7cdb86..fe2c161200d 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt @@ -19,7 +19,3 @@ install(FILES ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordi install(FILES config.cmake DESTINATION ${INSTALL_PLATFORM_NS_DIR}) - -install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf9161dk_nrf9161/tests - - DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt index aa2ef831031..ba840c6c8d1 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt @@ -19,7 +19,3 @@ install(FILES ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordi install(FILES config.cmake DESTINATION ${INSTALL_PLATFORM_NS_DIR}) - -install(DIRECTORY ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/nrf9160dk_nrf9160/tests - - DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt index 0d11c021627..7692ea3dfd1 100644 --- a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt @@ -8,103 +8,10 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(tfm_psa_arch_test) +project(tfm_psa_storage_test) target_sources(app PRIVATE src/main.c) -get_target_property(TFM_BINARY_DIR tfm TFM_BINARY_DIR) -get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE) -get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE) -get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE) - -get_target_property(TFM_TOOLCHAIN_PATH tfm TFM_TOOLCHAIN_PATH) -get_target_property(TFM_TOOLCHAIN_PREFIX tfm TFM_TOOLCHAIN_PREFIX) -get_target_property(TFM_TOOLCHAIN_NS_FILE tfm TFM_TOOLCHAIN_NS_FILE) - -set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests) -set(TFM_PSA_ARCHTEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../psa-arch-tests) - -if (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION AND CONFIG_TFM_QCBOR_PATH STREQUAL "") -# TODO: Remove this when QCBOR licensing issues w/t_cose have been resolved, -# or only allow it when 'QCBOR_PATH' is set to a local path where QCBOR has -# been manually downloaded by the user before starting the build. -message(FATAL_ERROR "CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION is not available " - "with TF-M 2.0.0 due to licensing issues with a dependent library. This " - "restriction will be removed once licensing issues have been resolved." - ) -endif() - - -set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_psa_arch/spe/partitions") -set(PSA_ARCH_TESTS_CONFIG_FILE "${TFM_TEST_REPO_PATH}/tests_psa_arch/spe/config/config_test_psa_api.cmake") -if (CONFIG_TFM_PSA_TEST_CRYPTO) -set(TFM_PSA_TEST_SUITE CRYPTO) -elseif (CONFIG_TFM_PSA_TEST_PROTECTED_STORAGE) -set(TFM_PSA_TEST_SUITE PROTECTED_STORAGE) -elseif (CONFIG_TFM_PSA_TEST_INTERNAL_TRUSTED_STORAGE) -set(TFM_PSA_TEST_SUITE INTERNAL_TRUSTED_STORAGE) -elseif (CONFIG_TFM_PSA_TEST_STORAGE) -set(TFM_PSA_TEST_SUITE STORAGE) -elseif (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION) -set(TFM_PSA_TEST_SUITE INITIAL_ATTESTATION) -endif() - -if (NOT DEFINED TFM_PSA_TEST_SUITE) - message(FATAL_ERROR "Please define witch test suite to run: - CONFIG_TFM_PSA_TEST_CRYPTO - CONFIG_TFM_PSA_TEST_PROTECTED_STORAGE - CONFIG_TFM_PSA_TEST_STORAGE - CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION") -endif() -set(TEST_PSA_API "${TFM_PSA_TEST_SUITE}") - -set_property(TARGET zephyr_property_target - APPEND PROPERTY TFM_CMAKE_OPTIONS - -DPSA_ARCH_TESTS_PATH=${TFM_PSA_ARCHTEST_REPO_PATH} -) - -set_property(TARGET zephyr_property_target - APPEND PROPERTY TFM_CMAKE_OPTIONS - -DCONFIG_TFM_TEST_DIR=${TFM_TEST_DIR} +target_include_directories(app PRIVATE + $/api_ns/interface/include ) - -set_property(TARGET zephyr_property_target - APPEND PROPERTY TFM_CMAKE_OPTIONS - -DCONFIG_PSA_ARCH_TESTS_CONFIG_FILE=${PSA_ARCH_TESTS_CONFIG_FILE} -) - -set_property(TARGET zephyr_property_target - APPEND PROPERTY TFM_CMAKE_OPTIONS - -DTEST_PSA_API=${TEST_PSA_API} -) - -include(ExternalProject) - -ExternalProject_Add(tfm_psa_arch_test_app - SOURCE_DIR ${TFM_TEST_REPO_PATH}/tests_psa_arch - BINARY_DIR ${PROJECT_BINARY_DIR}/tfm_ns - CONFIGURE_COMMAND - ${CMAKE_COMMAND} - -G ${CMAKE_GENERATOR} - -S ${TFM_TEST_REPO_PATH}/tests_psa_arch - -B ${PROJECT_BINARY_DIR}/tfm_ns - -DCROSS_COMPILE=${TFM_TOOLCHAIN_PATH}/${TFM_TOOLCHAIN_PREFIX} - -DPSA_TOOLCHAIN_FILE=${TFM_BINARY_DIR}/api_ns/cmake/${TFM_TOOLCHAIN_NS_FILE} - -DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns - -DTFM_TOOLCHAIN_FILE=cmake/${TFM_TOOLCHAIN_NS_FILE} - -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH} - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DTEST_PSA_API=${TEST_PSA_API} - BUILD_COMMAND ${CMAKE_COMMAND} --build . - INSTALL_COMMAND "" - BUILD_ALWAYS True - USES_TERMINAL_BUILD True - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tfm_ns - DEPENDS tfm - BUILD_BYPRODUCTS - ${TFM_NS_HEX_FILE} - ${TFM_NS_BIN_FILE} - ${TFM_NS_SIGNED_BIN_FILE} -) - -add_dependencies(app tfm_psa_arch_test_app) diff --git a/samples/tfm_integration/tfm_psa_test/prj.conf b/samples/tfm_integration/tfm_psa_test/prj.conf index bab1254229d..aa35a6c27db 100644 --- a/samples/tfm_integration/tfm_psa_test/prj.conf +++ b/samples/tfm_integration/tfm_psa_test/prj.conf @@ -6,9 +6,7 @@ CONFIG_BUILD_WITH_TFM=y CONFIG_TFM_PROFILE_TYPE_NOT_SET=y -CONFIG_TFM_USE_NS_APP=y CONFIG_QEMU_ICOUNT_SHIFT=1 - # Needed for CRYPTO and INITIAL_ATTESTATION CONFIG_MAIN_STACK_SIZE=4096 diff --git a/samples/tfm_integration/tfm_psa_test/src/main.c b/samples/tfm_integration/tfm_psa_test/src/main.c index 9d2809fe269..232fc505cfd 100644 --- a/samples/tfm_integration/tfm_psa_test/src/main.c +++ b/samples/tfm_integration/tfm_psa_test/src/main.c @@ -1,15 +1,21 @@ /* - * Copyright (c) 2023 Nordic Semiconductor ASA. + * Copyright (c) 2021 Nordic Semiconductor ASA. * * SPDX-License-Identifier: Apache-2.0 */ #include +/* Run the PSA test suite */ +void psa_test(void); + int main(void) { - printk("Should not be printed, expected TF-M's NS application to be run instead.\n"); - k_panic(); +#ifdef CONFIG_TFM_PSA_TEST_NONE + #error "No PSA test suite set. Use Kconfig to enable a test suite.\n" +#else + psa_test(); +#endif for (;;) { } From f07db2d4fa9b90f253fc6ad8f38d4e6f9b67d2f9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:58 +0100 Subject: [PATCH 0938/2300] Revert "[nrf fromtree] modules: tf-m: Remove building of PSA arch tests" This reverts commit db37b46039dcc4ec1106bc68c4a1bc3495fc0284. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/CMakeLists.txt | 61 +++++++++++++++++++ .../src/zephyr_tfm_psa_test.c | 19 ++++++ 2 files changed, 80 insertions(+) create mode 100644 modules/trusted-firmware-m/src/zephyr_tfm_psa_test.c diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 2ee282905e6..dc9827db830 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -65,6 +65,20 @@ if (CONFIG_BUILD_WITH_TFM) if (CONFIG_TFM_PROFILE) list(APPEND TFM_CMAKE_ARGS -DTFM_PROFILE=${CONFIG_TFM_PROFILE}) endif() + if (CONFIG_TFM_PSA_TEST_CRYPTO) + set(TFM_PSA_TEST_SUITE CRYPTO) + elseif (CONFIG_TFM_PSA_TEST_PROTECTED_STORAGE) + set(TFM_PSA_TEST_SUITE PROTECTED_STORAGE) + elseif (CONFIG_TFM_PSA_TEST_INTERNAL_TRUSTED_STORAGE) + set(TFM_PSA_TEST_SUITE INTERNAL_TRUSTED_STORAGE) + elseif (CONFIG_TFM_PSA_TEST_STORAGE) + set(TFM_PSA_TEST_SUITE STORAGE) + elseif (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION) + set(TFM_PSA_TEST_SUITE INITIAL_ATTESTATION) + endif() + if (DEFINED TFM_PSA_TEST_SUITE) + list(APPEND TFM_CMAKE_ARGS -DTEST_PSA_API=${TFM_PSA_TEST_SUITE}) + endif() if (CONFIG_TFM_CMAKE_BUILD_TYPE_RELEASE) set(TFM_CMAKE_BUILD_TYPE "Release") elseif (CONFIG_TFM_CMAKE_BUILD_TYPE_MINSIZEREL) @@ -168,6 +182,17 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_INTERFACE_INCLUDE_DIR ${TFM_BINARY_DIR}/api_ns/interface/include) set(TFM_INTERFACE_LIB_DIR ${TFM_BINARY_DIR}/api_ns/interface/lib) + if (TFM_PSA_TEST_SUITE) + set(PSA_TEST_VAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/val/val_nspe.a) + set(PSA_TEST_PAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/platform/pal_nspe.a) + set(COMBINE_DIR_STORAGE storage) + set(COMBINE_DIR_PROTECTED_STORAGE storage) + set(COMBINE_DIR_INTERNAL_TRUSTED_STORAGE storage) + set(COMBINE_DIR_CRYPTO crypto) + set(COMBINE_DIR_INITIAL_ATTESTATION initial_attestation) + set(PSA_TEST_COMBINE_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/dev_apis/${COMBINE_DIR_${TFM_PSA_TEST_SUITE}}/test_combine.a) + endif() + if(CONFIG_TFM_BL2) set(BL2_ELF_FILE ${TFM_BINARY_DIR}/bin/bl2.elf) set(BL2_BIN_FILE ${TFM_BINARY_DIR}/bin/bl2.bin) @@ -228,6 +253,26 @@ if (CONFIG_BUILD_WITH_TFM) message(FATAL_ERROR "Unsupported ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT}") endif() + if (CONFIG_TFM_PARTITION_INITIAL_ATTESTATION AND CONFIG_TFM_QCBOR_PATH STREQUAL "") + # TODO: Remove this when QCBOR licensing issues w/t_cose have been resolved, + # or only allow it when 'QCBOR_PATH' is set to a local path where QCBOR has + # been manually downloaded by the user before starting the build. + message(FATAL_ERROR "CONFIG_TFM_PARTITION_INITIAL_ATTESTATION is not available " + "with TF-M 1.7.0 due to licensing issues with a dependent library. This " + "restriction will be removed once licensing issues have been resolved." + ) + endif() + + if (CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION AND CONFIG_TFM_QCBOR_PATH STREQUAL "") + # TODO: Remove this when QCBOR licensing issues w/t_cose have been resolved, + # or only allow it when 'QCBOR_PATH' is set to a local path where QCBOR has + # been manually downloaded by the user before starting the build. + message(FATAL_ERROR "CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION is not available " + "with TF-M 1.7.0 due to licensing issues with a dependent library. This " + "restriction will be removed once licensing issues have been resolved." + ) + endif() + if (CONFIG_TFM_QCBOR_PATH STREQUAL "DOWNLOAD") # Change CMake cache type to string to avoid QCBOR_PATH=/absolute/path/DOWNLOAD being set. set(QCBOR_PATH_TYPE ":STRING") @@ -251,6 +296,13 @@ if (CONFIG_BUILD_WITH_TFM) list(APPEND TFM_CMAKE_ARGS -DMCUBOOT_DATA_SHARING=ON) endif() + if(TFM_PSA_TEST_SUITE) + list(APPEND TFM_CMAKE_ARGS + -DPSA_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/psa/GNUARM.cmake + -DTOOLCHAIN=INHERIT + ) + endif() + if(CONFIG_FPU AND CONFIG_FP_HARDABI) list(APPEND TFM_CMAKE_ARGS -DCONFIG_TFM_ENABLE_FP=ON) # Note: This is not a cmake option in TF-M. @@ -353,6 +405,15 @@ if (CONFIG_BUILD_WITH_TFM) if (CONFIG_TFM_PARTITION_PLATFORM AND NOT CONFIG_TFM_PARTITION_PLATFORM_CUSTOM_REBOOT) zephyr_library_sources(src/reboot.c) endif() + zephyr_library_sources_ifndef(CONFIG_TFM_PSA_TEST_NONE src/zephyr_tfm_psa_test.c) + + if (TFM_PSA_TEST_SUITE) + zephyr_library_link_libraries( + ${PSA_TEST_VAL_FILE} + ${PSA_TEST_PAL_FILE} + ${PSA_TEST_COMBINE_FILE} + ) + endif() zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_platform_api.c) zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PROTECTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_ps_api.c) diff --git a/modules/trusted-firmware-m/src/zephyr_tfm_psa_test.c b/modules/trusted-firmware-m/src/zephyr_tfm_psa_test.c new file mode 100644 index 00000000000..d7d68f9db67 --- /dev/null +++ b/modules/trusted-firmware-m/src/zephyr_tfm_psa_test.c @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/** + * \brief This symbol is the entry point provided by the PSA API compliance + * test libraries + */ +extern void val_entry(void); + + +void psa_test(void) +{ + val_entry(); +} From b68078b06f6f2e89e8fe218a0f0bb8fe9a45c252 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:59 +0100 Subject: [PATCH 0939/2300] Revert "[nrf fromtree] tfm: Update TF-M regression tests sample to build NS app" This reverts commit a0e4f8af32167219a886966a68667d99917da355. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/CMakeLists.txt | 2 - .../tfm_regression_test/CMakeLists.txt | 48 ------------------- 2 files changed, 50 deletions(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index dc9827db830..26109bef223 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -40,11 +40,9 @@ if (CONFIG_BUILD_WITH_TFM) endif() if (CONFIG_TFM_REGRESSION_S) list(APPEND TFM_CMAKE_ARGS -DTEST_S=ON) - list(APPEND TFM_CMAKE_ARGS -DTFM_S_REG_TEST:BOOL=ON) endif() if (CONFIG_TFM_REGRESSION_NS) list(APPEND TFM_CMAKE_ARGS -DTEST_NS=ON) - list(APPEND TFM_CMAKE_ARGS -DTFM_NS_REG_TEST:BOOL=ON) endif() if (CONFIG_TFM_BL2) list(APPEND TFM_CMAKE_ARGS -DBL2=TRUE) diff --git a/samples/tfm_integration/tfm_regression_test/CMakeLists.txt b/samples/tfm_integration/tfm_regression_test/CMakeLists.txt index 571bf986206..5f34b1c0b26 100644 --- a/samples/tfm_integration/tfm_regression_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_regression_test/CMakeLists.txt @@ -11,51 +11,3 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(tfm_regression_test) target_sources(app PRIVATE src/main.c) - -get_target_property(TFM_BINARY_DIR tfm TFM_BINARY_DIR) -get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE) -get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE) -get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE) - -set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests) - -set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_reg/test/secure_regression") -set(TFM_TEST_CONFIG_FILE "${TFM_TEST_REPO_PATH}/tests_reg/test/config/config.cmake") - -set_property(TARGET zephyr_property_target - APPEND PROPERTY TFM_CMAKE_OPTIONS - -DCONFIG_TFM_TEST_DIR=${TFM_TEST_DIR} -) - -set_property(TARGET zephyr_property_target - APPEND PROPERTY TFM_CMAKE_OPTIONS - -DCONFIG_TFM_TEST_CONFIG_FILE=${TFM_TEST_CONFIG_FILE} -) - -include(ExternalProject) - -ExternalProject_Add(tfm_regression_test_app - SOURCE_DIR ${TFM_TEST_REPO_PATH}/tests_reg - BINARY_DIR ${PROJECT_BINARY_DIR}/tfm_ns - CONFIGURE_COMMAND - ${CMAKE_COMMAND} - -G ${CMAKE_GENERATOR} - -S ${TFM_TEST_REPO_PATH}/tests_reg - -B ${PROJECT_BINARY_DIR}/tfm_ns - -DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns - -DTFM_TOOLCHAIN_FILE=cmake/toolchain_ns_GNUARM.cmake - -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH} - -DCMAKE_BUILD_TYPE=RelWithDebInfo - BUILD_COMMAND ${CMAKE_COMMAND} --build . - INSTALL_COMMAND "" - BUILD_ALWAYS True - USES_TERMINAL_BUILD True - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tfm_ns - DEPENDS tfm - BUILD_BYPRODUCTS - ${TFM_NS_HEX_FILE} - ${TFM_NS_BIN_FILE} - ${TFM_NS_SIGNED_BIN_FILE} -) - -add_dependencies(app tfm_regression_test_app) From 12b8effdd58e9d8cae7df72ac1047407ada0b848 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:59 +0100 Subject: [PATCH 0940/2300] Revert "[nrf fromtree] tfm: Remove TFM_BUILD_NS and update TFM_USE_NS_APP for NS build folder" This reverts commit 7d8018a4e804dc3ae700e8a7bdfff55b44fe3420. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/CMakeLists.txt | 41 ++++++++++++++----- modules/trusted-firmware-m/Kconfig.tfm | 11 +++++ samples/tfm_integration/tfm_psa_test/prj.conf | 1 + .../tfm_regression_test/prj.conf | 1 + 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 26109bef223..8cc546883d0 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -51,6 +51,11 @@ if (CONFIG_BUILD_WITH_TFM) else() list(APPEND TFM_CMAKE_ARGS -DBL2=FALSE) endif() + if (CONFIG_TFM_BUILD_NS) + list(APPEND TFM_CMAKE_ARGS -DNS=TRUE) + else() + list(APPEND TFM_CMAKE_ARGS -DNS=FALSE) + endif() if (CONFIG_TFM_ISOLATION_LEVEL) list(APPEND TFM_CMAKE_ARGS -DTFM_ISOLATION_LEVEL=${CONFIG_TFM_ISOLATION_LEVEL}) endif() @@ -180,6 +185,9 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_INTERFACE_INCLUDE_DIR ${TFM_BINARY_DIR}/api_ns/interface/include) set(TFM_INTERFACE_LIB_DIR ${TFM_BINARY_DIR}/api_ns/interface/lib) + set(TFM_API_NS_PATH ${TFM_BINARY_DIR}/tf-m-tests/app/libtfm_api_ns.a) + set(PLATFORM_NS_FILE ${TFM_BINARY_DIR}/platform/ns/libplatform_ns.a) + if (TFM_PSA_TEST_SUITE) set(PSA_TEST_VAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/val/val_nspe.a) set(PSA_TEST_PAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/platform/pal_nspe.a) @@ -200,22 +208,27 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_S_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_s.bin) set(TFM_S_HEX_FILE ${TFM_BINARY_DIR}/bin/tfm_s.hex) set(TFM_NS_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_ns.bin) - set(TFM_NS_HEX_FILE ${CMAKE_BINARY_DIR}/tfm_ns/bin/tfm_ns.hex) + set(TFM_NS_HEX_FILE ${TFM_BINARY_DIR}/bin/tfm_ns.hex) set(TFM_S_SIGNED_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_s_signed.bin) set(TFM_NS_SIGNED_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_ns_signed.bin) set(TFM_S_NS_SIGNED_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_s_ns_signed.bin) set(BUILD_BYPRODUCTS + ${TFM_API_NS_PATH} ${PSA_TEST_VAL_FILE} ${PSA_TEST_PAL_FILE} ${PSA_TEST_COMBINE_FILE} + ${PLATFORM_NS_FILE} ${BL2_ELF_FILE} ${BL2_BIN_FILE} ${BL2_HEX_FILE} ${TFM_S_ELF_FILE} ${TFM_S_BIN_FILE} ${TFM_S_HEX_FILE} + ${TFM_NS_BIN_FILE} + ${TFM_NS_HEX_FILE} ${TFM_S_SIGNED_BIN_FILE} + ${TFM_NS_SIGNED_BIN_FILE} ${TFM_S_NS_SIGNED_BIN_FILE} ${TFM_INTERFACE_LIB_DIR}/s_veneers.o @@ -413,17 +426,25 @@ if (CONFIG_BUILD_WITH_TFM) ) endif() - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_platform_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PROTECTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_ps_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_its_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_CRYPTO ${TFM_INTERFACE_SOURCE_DIR}/tfm_crypto_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INITIAL_ATTESTATION ${TFM_INTERFACE_SOURCE_DIR}/tfm_attest_api.c) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_FIRMWARE_UPDATE ${TFM_INTERFACE_SOURCE_DIR}/tfm_fwu_api.c) + if(NOT CONFIG_TFM_BUILD_NS) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_platform_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PROTECTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_ps_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_its_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_CRYPTO ${TFM_INTERFACE_SOURCE_DIR}/tfm_crypto_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INITIAL_ATTESTATION ${TFM_INTERFACE_SOURCE_DIR}/tfm_attest_api.c) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_FIRMWARE_UPDATE ${TFM_INTERFACE_SOURCE_DIR}/tfm_fwu_api.c) + + zephyr_library_sources(${TFM_INTERFACE_SOURCE_DIR}/tfm_tz_psa_ns_api.c) - zephyr_library_sources(${TFM_INTERFACE_SOURCE_DIR}/tfm_tz_psa_ns_api.c) + if(CONFIG_SOC_FAMILY_NRF) + zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_ioctl_core_ns_api.c) + endif() - if(CONFIG_SOC_FAMILY_NRF) - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_ioctl_core_ns_api.c) + else() + zephyr_library_link_libraries( + ${PLATFORM_NS_FILE} + ${TFM_API_NS_PATH} + ) endif() target_include_directories(tfm_api PRIVATE diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index f8285da53d6..a0d71328540 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -226,8 +226,19 @@ config TFM_BL2 TFM is designed to run with MCUboot in a certain configuration. This config adds MCUboot to the build - built via TFM's build system. +config TFM_BUILD_NS + bool "Build the TF-M Non-Secure application and libraries" + help + Instruct the TF-M build system to build the TF-M Non-Secure + application and libraries. + + This option is intended for testing purposes only, since this is the + easiest way to build the TF-M regression tests application and test + support libraries in the zephyr build system. + config TFM_USE_NS_APP bool "Use the TF-M Non-Secure application" + depends on TFM_BUILD_NS help The TF-M build system can produce multiple executable files. The main one is the TF-M secure firmware. Optionally the TF-M diff --git a/samples/tfm_integration/tfm_psa_test/prj.conf b/samples/tfm_integration/tfm_psa_test/prj.conf index aa35a6c27db..3ceca574528 100644 --- a/samples/tfm_integration/tfm_psa_test/prj.conf +++ b/samples/tfm_integration/tfm_psa_test/prj.conf @@ -5,6 +5,7 @@ # CONFIG_BUILD_WITH_TFM=y +CONFIG_TFM_BUILD_NS=y CONFIG_TFM_PROFILE_TYPE_NOT_SET=y CONFIG_QEMU_ICOUNT_SHIFT=1 diff --git a/samples/tfm_integration/tfm_regression_test/prj.conf b/samples/tfm_integration/tfm_regression_test/prj.conf index 0a6573f811c..6817a7f717b 100644 --- a/samples/tfm_integration/tfm_regression_test/prj.conf +++ b/samples/tfm_integration/tfm_regression_test/prj.conf @@ -6,6 +6,7 @@ CONFIG_BUILD_WITH_TFM=y CONFIG_TFM_PROFILE_TYPE_NOT_SET=y +CONFIG_TFM_BUILD_NS=y CONFIG_TFM_USE_NS_APP=y CONFIG_TFM_REGRESSION_S=y CONFIG_TFM_REGRESSION_NS=y From 8065544280ae2091d96383c215e6b0c239f96898 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:59 +0100 Subject: [PATCH 0941/2300] Revert "[nrf fromtree] tfm: Add NS build support for zephyr out-of-tree nordic_nrf platform." This reverts commit fe824020252f125b473d48bfe1912add573ce286. Signed-off-by: Robert Lubos --- .../nordic_nrf/CMakeLists.txt | 16 +++---- .../nordic_nrf/nrf5340_cpuapp/CMakeLists.txt | 8 +--- .../nordic_nrf/nrf5340_cpuapp/config.cmake | 3 +- .../nordic_nrf/nrf5340_cpuapp/cpuarch.cmake | 4 +- .../nrf5340_cpuapp/ns/cpuarch_ns.cmake | 10 ---- .../nordic_nrf/nrf9120/CMakeLists.txt | 11 +---- .../nordic_nrf/nrf9120/config.cmake | 3 +- .../nordic_nrf/nrf9120/cpuarch.cmake | 3 +- .../nordic_nrf/nrf9120/ns/cpuarch_ns.cmake | 10 ---- .../nordic_nrf/nrf9160/CMakeLists.txt | 11 +---- .../nordic_nrf/nrf9160/config.cmake | 3 +- .../nordic_nrf/nrf9160/cpuarch.cmake | 4 +- .../nordic_nrf/nrf9160/ns/cpuarch_ns.cmake | 10 ---- .../nordic_nrf/ns/CMakeLists.txt | 46 ------------------- 14 files changed, 15 insertions(+), 127 deletions(-) delete mode 100644 modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/ns/cpuarch_ns.cmake delete mode 100644 modules/trusted-firmware-m/nordic_nrf/nrf9120/ns/cpuarch_ns.cmake delete mode 100644 modules/trusted-firmware-m/nordic_nrf/nrf9160/ns/cpuarch_ns.cmake delete mode 100644 modules/trusted-firmware-m/nordic_nrf/ns/CMakeLists.txt diff --git a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt index d75b34a8109..39aa2199b47 100644 --- a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt @@ -46,18 +46,14 @@ if(BL2) ) endif() -target_sources(tfm_spm - PRIVATE - src/tfm_hal_platform.c -) - if (TFM_PARTITION_PLATFORM) install(FILES include/tfm_ioctl_api.h - include/device_cfg.h - include/RTE_Device.h - include/tfm_ioctl_api.h DESTINATION ${INSTALL_INTERFACE_INC_DIR}) endif() -install(FILES ns/CMakeLists.txt - DESTINATION ${INSTALL_PLATFORM_NS_DIR}) +#========================= tfm_spm ============================================# + +target_sources(tfm_spm + PRIVATE + src/tfm_hal_platform.c +) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt index 35338d542d7..279ea385996 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/CMakeLists.txt @@ -5,14 +5,8 @@ # set(NRF_BOARD_SELECTED True) +set(NRF_SOC_VARIANT nrf5340) add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf5340 nrf5340) add_subdirectory(.. common) - -install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake - DESTINATION ${INSTALL_PLATFORM_NS_DIR} - RENAME cpuarch.cmake) - -install(FILES config.cmake - DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/config.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/config.cmake index ae50a4846dd..b3e5d74181c 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/config.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/config.cmake @@ -4,6 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 # -set(NRF_SOC_VARIANT nrf5340 CACHE STRING "nRF SoC Variant") - +set(PLATFORM_PATH platform/ext/target/nordic_nrf/) include(${PLATFORM_PATH}/common/nrf5340/config.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake index f19d7f43c67..903b23e4cc6 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake @@ -4,6 +4,4 @@ # SPDX-License-Identifier: Apache-2.0 # -set(PLATFORM_PATH platform/ext/target/nordic_nrf) - -include(${PLATFORM_PATH}/common/nrf5340/cpuarch.cmake) +include(platform/ext/target/nordic_nrf/common/nrf5340/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/ns/cpuarch_ns.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/ns/cpuarch_ns.cmake deleted file mode 100644 index 077e88bd37b..00000000000 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/ns/cpuarch_ns.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# -# Copyright (c) 2023, Nordic Semiconductor ASA. -# -# SPDX-License-Identifier: Apache-2.0 -# - -set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR}) - -include(${CMAKE_CURRENT_LIST_DIR}/common/nrf5340/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt index fe2c161200d..a84c6fd9fd5 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/CMakeLists.txt @@ -5,17 +5,8 @@ # set(NRF_BOARD_SELECTED True) +set(NRF_SOC_VARIANT nrf91) add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf91 nrf91) add_subdirectory(.. common) - -install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake - DESTINATION ${INSTALL_PLATFORM_NS_DIR} - RENAME cpuarch.cmake) - -install(FILES ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf9120/cpuarch.cmake - DESTINATION ${INSTALL_PLATFORM_NS_DIR}/common/nrf9120) - -install(FILES config.cmake - DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/config.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9120/config.cmake index e858eda3a27..3f58e7b89eb 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/config.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/config.cmake @@ -4,6 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 # -set(NRF_SOC_VARIANT nrf91 CACHE STRING "nRF SoC Variant") - +set(PLATFORM_PATH platform/ext/target/nordic_nrf/) include(${PLATFORM_PATH}/common/nrf91/config.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake index 9f0886c7a51..b34a8ddab1a 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake @@ -3,6 +3,5 @@ # # SPDX-License-Identifier: Apache-2.0 # -set(PLATFORM_PATH platform/ext/target/nordic_nrf) -include(${PLATFORM_PATH}/common/nrf9120/cpuarch.cmake) +include(platform/ext/target/nordic_nrf/common/nrf9120/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/ns/cpuarch_ns.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9120/ns/cpuarch_ns.cmake deleted file mode 100644 index c53d684d7e8..00000000000 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/ns/cpuarch_ns.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# -# Copyright (c) 2023, Nordic Semiconductor ASA. -# -# SPDX-License-Identifier: Apache-2.0 -# - -set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR}) - -include(${CMAKE_CURRENT_LIST_DIR}/common/nrf9120/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt index ba840c6c8d1..a84c6fd9fd5 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/CMakeLists.txt @@ -5,17 +5,8 @@ # set(NRF_BOARD_SELECTED True) +set(NRF_SOC_VARIANT nrf91) add_subdirectory(${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf91 nrf91) add_subdirectory(.. common) - -install(FILES ${CMAKE_CURRENT_LIST_DIR}/ns/cpuarch_ns.cmake - DESTINATION ${INSTALL_PLATFORM_NS_DIR} - RENAME cpuarch.cmake) - -install(FILES ${Trusted\ Firmware\ M_SOURCE_DIR}/platform/ext/target/nordic_nrf/common/nrf9160/cpuarch.cmake - DESTINATION ${INSTALL_PLATFORM_NS_DIR}/common/nrf9160) - -install(FILES config.cmake - DESTINATION ${INSTALL_PLATFORM_NS_DIR}) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/config.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9160/config.cmake index e858eda3a27..3f58e7b89eb 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/config.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/config.cmake @@ -4,6 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 # -set(NRF_SOC_VARIANT nrf91 CACHE STRING "nRF SoC Variant") - +set(PLATFORM_PATH platform/ext/target/nordic_nrf/) include(${PLATFORM_PATH}/common/nrf91/config.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake index f728014d3f7..228252f0147 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake @@ -4,6 +4,4 @@ # SPDX-License-Identifier: Apache-2.0 # -set(PLATFORM_PATH platform/ext/target/nordic_nrf) - -include(${PLATFORM_PATH}/common/nrf9160/cpuarch.cmake) +include(platform/ext/target/nordic_nrf/common/nrf9160/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/ns/cpuarch_ns.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9160/ns/cpuarch_ns.cmake deleted file mode 100644 index 902e7fe7ef4..00000000000 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/ns/cpuarch_ns.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# -# Copyright (c) 2023, Nordic Semiconductor ASA. -# -# SPDX-License-Identifier: Apache-2.0 -# - -set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(PLATFORM_PATH ${CMAKE_CURRENT_LIST_DIR}) - -include(${CMAKE_CURRENT_LIST_DIR}/common/nrf9160/cpuarch.cmake) diff --git a/modules/trusted-firmware-m/nordic_nrf/ns/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/ns/CMakeLists.txt deleted file mode 100644 index 5bb8cb5bd94..00000000000 --- a/modules/trusted-firmware-m/nordic_nrf/ns/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (c) 2023, Nordic Semiconductor ASA. -# -# SPDX-License-Identifier: Apache-2.0 -# - -cmake_policy(SET CMP0076 NEW) -set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(NRF_BOARD_SELECTED True) - -add_library(platform_ns STATIC) - -set(partition_includes - ${CMAKE_CURRENT_LIST_DIR}/common/${NRF_SOC_VARIANT}/partition - ${CMAKE_BINARY_DIR}/../zephyr/include/generated -) - -set(board_includes - ${CMAKE_BINARY_DIR}/../zephyr/misc/generated/syscalls_links/include - ${ZEPHYR_BASE}/include -) - -target_include_directories(platform_region_defs - INTERFACE - ${partition_includes} -) - -target_include_directories(platform_ns - PUBLIC - ${partition_includes} - ${board_includes} -) - -# Get the value of HAL_NORDIC_PATH -include(${CMAKE_CURRENT_LIST_DIR}/common/core/config_nordic_nrf_spe.cmake) -add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common/${NRF_SOC_VARIANT} ${NRF_SOC_VARIANT}) - -target_include_directories(platform_ns - PUBLIC - ${CMAKE_CURRENT_LIST_DIR} -) - -target_link_libraries(platform_ns - PUBLIC - platform_region_defs -) From e582ba0f63f293044b843a8b1dc32b99dc2b5159 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:26:59 +0100 Subject: [PATCH 0942/2300] Revert "[nrf fromtree] sample: tfm_secure_partition: Change tfm_partition_defs to tfm_config" This reverts commit da4a15ae8e6cff0844ca7a89227c836ed4bcc09d. Signed-off-by: Robert Lubos --- .../tfm_secure_partition/dummy_partition/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/tfm_integration/tfm_secure_partition/dummy_partition/CMakeLists.txt b/samples/tfm_integration/tfm_secure_partition/dummy_partition/CMakeLists.txt index 013332ccb1a..0e335a73028 100644 --- a/samples/tfm_integration/tfm_secure_partition/dummy_partition/CMakeLists.txt +++ b/samples/tfm_integration/tfm_secure_partition/dummy_partition/CMakeLists.txt @@ -50,7 +50,7 @@ target_link_libraries(tfm_partitions tfm_app_rot_partition_dp ) -target_compile_definitions(tfm_config +target_compile_definitions(tfm_partition_defs INTERFACE TFM_PARTITION_DUMMY_PARTITION ) From 8e365eb62acb047f30b984ae8e0be29b9d8e6a0a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:00 +0100 Subject: [PATCH 0943/2300] Revert "[nrf fromtree] modules: mbedtls: Use TF-M PSA API headers" This reverts commit 164d0097036e585e2915c591e502f50f9af9c3e2. Signed-off-by: Robert Lubos --- modules/mbedtls/CMakeLists.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index a6277f654b5..027445d7728 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -16,12 +16,6 @@ zephyr_interface_library_named(mbedTLS) MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}" ) - if (CONFIG_BUILD_WITH_TFM) - target_include_directories(mbedTLS INTERFACE - $/api_ns/interface/include - ) - endif() - # Add regular includes target_include_directories(mbedTLS INTERFACE ${ZEPHYR_CURRENT_MODULE_DIR}/include @@ -115,7 +109,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 @@ -127,6 +121,11 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_se.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_storage.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_its_file.c + ) + endif() + + if (NOT CONFIG_BUILD_WITH_TFM) + list(APPEND crypto_source ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_client.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_slot_management.c From 1cf1e709bb9f3861f50b451ae073642d8b2d41a1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:00 +0100 Subject: [PATCH 0944/2300] Revert "[nrf fromtree] modules: mbedtls: Add a mbedtls_ms_time implementation" This reverts commit 7b5026086ab20eddc6841571eed779cb29ff404c. Signed-off-by: Robert Lubos --- modules/mbedtls/configs/config-mini-tls1_1.h | 1 - modules/mbedtls/configs/config-no-entropy.h | 1 - modules/mbedtls/configs/config-suite-b.h | 1 - modules/mbedtls/configs/config-tls-generic.h | 1 - modules/mbedtls/zephyr_init.c | 8 -------- tests/subsys/jwt/src/tls_config/user-tls-conf.h | 1 - 6 files changed, 13 deletions(-) diff --git a/modules/mbedtls/configs/config-mini-tls1_1.h b/modules/mbedtls/configs/config-mini-tls1_1.h index da8bf795c1d..2bce8647caf 100644 --- a/modules/mbedtls/configs/config-mini-tls1_1.h +++ b/modules/mbedtls/configs/config-mini-tls1_1.h @@ -59,7 +59,6 @@ /* System support */ #define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_TIME -#define MBEDTLS_PLATFORM_MS_TIME_ALT /* mbed TLS feature support */ #define MBEDTLS_CIPHER_MODE_CBC diff --git a/modules/mbedtls/configs/config-no-entropy.h b/modules/mbedtls/configs/config-no-entropy.h index b3406a394b4..b5295bf1fb7 100644 --- a/modules/mbedtls/configs/config-no-entropy.h +++ b/modules/mbedtls/configs/config-no-entropy.h @@ -62,7 +62,6 @@ /* System support */ #define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_TIME -#define MBEDTLS_PLATFORM_MS_TIME_ALT /* mbed TLS feature support */ #define MBEDTLS_CIPHER_MODE_CBC diff --git a/modules/mbedtls/configs/config-suite-b.h b/modules/mbedtls/configs/config-suite-b.h index 7468f763358..6f2cc963bd1 100644 --- a/modules/mbedtls/configs/config-suite-b.h +++ b/modules/mbedtls/configs/config-suite-b.h @@ -66,7 +66,6 @@ /* System support */ #define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_TIME -#define MBEDTLS_PLATFORM_MS_TIME_ALT /* mbed TLS feature support */ #define MBEDTLS_ECP_DP_SECP256R1_ENABLED diff --git a/modules/mbedtls/configs/config-tls-generic.h b/modules/mbedtls/configs/config-tls-generic.h index 2d1b53c54fd..7cf85731c85 100644 --- a/modules/mbedtls/configs/config-tls-generic.h +++ b/modules/mbedtls/configs/config-tls-generic.h @@ -37,7 +37,6 @@ #if defined(CONFIG_MBEDTLS_HAVE_TIME_DATE) #define MBEDTLS_HAVE_TIME #define MBEDTLS_HAVE_TIME_DATE -#define MBEDTLS_PLATFORM_MS_TIME_ALT #endif #if defined(CONFIG_MBEDTLS_TEST) diff --git a/modules/mbedtls/zephyr_init.c b/modules/mbedtls/zephyr_init.c index 49c9ffc8aff..3329c3b9c8d 100644 --- a/modules/mbedtls/zephyr_init.c +++ b/modules/mbedtls/zephyr_init.c @@ -15,8 +15,6 @@ #include #include #include -#include - #include @@ -109,9 +107,3 @@ int mbedtls_init(void) { return _mbedtls_init(); } - -/* TLS 1.3 ticket lifetime needs a timing interface */ -mbedtls_ms_time_t mbedtls_ms_time(void) -{ - return (mbedtls_ms_time_t)k_uptime_get(); -} diff --git a/tests/subsys/jwt/src/tls_config/user-tls-conf.h b/tests/subsys/jwt/src/tls_config/user-tls-conf.h index 0d95ee80ac0..035f2b062ec 100644 --- a/tests/subsys/jwt/src/tls_config/user-tls-conf.h +++ b/tests/subsys/jwt/src/tls_config/user-tls-conf.h @@ -3,4 +3,3 @@ #define MBEDTLS_HAVE_TIME #define MBEDTLS_HAVE_TIME_DATE #define MBEDTLS_PLATFORM_TIME_ALT -#define MBEDTLS_PLATFORM_MS_TIME_ALT From e221070048bdc0fc87289332450efc8fa7de9478 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:01 +0100 Subject: [PATCH 0945/2300] Revert "[nrf fromtree] modules: mbedtls: Rename of psa_crypto_driver_wrappers" This reverts commit 2b3fd1b23c501c88de7d5d6ac83d8ab5df2dada6. Signed-off-by: Robert Lubos --- modules/mbedtls/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 027445d7728..6870c89d0ec 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -113,7 +113,7 @@ zephyr_interface_library_named(mbedTLS) list(APPEND crypto_source ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_aead.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_cipher.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_driver_wrappers_no_static.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_driver_wrappers.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_ecp.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_hash.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_mac.c From b3edc19516c05dcca38ef7757d734402c5eb202f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:01 +0100 Subject: [PATCH 0946/2300] Revert "[nrf fromtree] tfm: nordic_nrf: Remove include of tfm_api.h, update install path" This reverts commit 65ac0c2cf0d221ec2dae01e3e73bd3510a217099. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt | 2 +- modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h | 1 + samples/tfm_integration/tfm_ipc/src/main.c | 1 + .../tfm_secure_partition/dummy_partition/dummy_partition.c | 1 + .../tfm_integration/tfm_secure_partition/src/dummy_partition.h | 2 ++ 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt index 39aa2199b47..d5bc57ac5d9 100644 --- a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt @@ -48,7 +48,7 @@ endif() if (TFM_PARTITION_PLATFORM) install(FILES include/tfm_ioctl_api.h - DESTINATION ${INSTALL_INTERFACE_INC_DIR}) + DESTINATION ${TFM_INSTALL_PATH}/interface/include) endif() #========================= tfm_spm ============================================# diff --git a/modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h b/modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h index 3fade10525a..c6c36ee927f 100644 --- a/modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h +++ b/modules/trusted-firmware-m/nordic_nrf/include/tfm_ioctl_api.h @@ -9,6 +9,7 @@ #include #include +#include #include /* Include core IOCTL services */ diff --git a/samples/tfm_integration/tfm_ipc/src/main.c b/samples/tfm_integration/tfm_ipc/src/main.c index 133c7203b0e..7179705cbe3 100644 --- a/samples/tfm_integration/tfm_ipc/src/main.c +++ b/samples/tfm_integration/tfm_ipc/src/main.c @@ -7,6 +7,7 @@ #include #include +#include "tfm_api.h" #include "tfm_ns_interface.h" #ifdef TFM_PSA_API #include "psa_manifest/sid.h" diff --git a/samples/tfm_integration/tfm_secure_partition/dummy_partition/dummy_partition.c b/samples/tfm_integration/tfm_secure_partition/dummy_partition/dummy_partition.c index d618868ddbf..6519723058c 100644 --- a/samples/tfm_integration/tfm_secure_partition/dummy_partition/dummy_partition.c +++ b/samples/tfm_integration/tfm_secure_partition/dummy_partition/dummy_partition.c @@ -7,6 +7,7 @@ #include #include #include +#include "tfm_api.h" #include "psa/service.h" #include "psa_manifest/tfm_dummy_partition.h" diff --git a/samples/tfm_integration/tfm_secure_partition/src/dummy_partition.h b/samples/tfm_integration/tfm_secure_partition/src/dummy_partition.h index 7ca52b3c5c4..b31ce897d27 100644 --- a/samples/tfm_integration/tfm_secure_partition/src/dummy_partition.h +++ b/samples/tfm_integration/tfm_secure_partition/src/dummy_partition.h @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "tfm_api.h" + psa_status_t dp_secret_digest(uint32_t secret_index, void *p_digest, size_t digest_size); From ee9c638bf87a4a5604f7c333a375a92792760bf1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:01 +0100 Subject: [PATCH 0947/2300] Revert "[nrf fromtree] tfm: Use PSA error codes instead of TFM error codes" This reverts commit 2206bbd3ff665e51caaceef002a779fa8ea39998. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/interface/interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/trusted-firmware-m/interface/interface.c b/modules/trusted-firmware-m/interface/interface.c index d949a9dc027..ad0ed1abdfe 100644 --- a/modules/trusted-firmware-m/interface/interface.c +++ b/modules/trusted-firmware-m/interface/interface.c @@ -35,7 +35,7 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn, if (!is_pre_kernel) { /* TF-M request protected by NS lock */ if (k_mutex_lock(&tfm_mutex, K_FOREVER) != 0) { - return (int32_t)PSA_ERROR_GENERIC_ERROR; + return (int32_t)TFM_ERROR_GENERIC; } #if !defined(CONFIG_ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS) @@ -79,7 +79,7 @@ uint32_t tfm_ns_interface_init(void) * The static K_MUTEX_DEFINE handles mutex initialization, * so this function may be implemented as no-op. */ - return PSA_SUCCESS; + return TFM_SUCCESS; } @@ -90,7 +90,7 @@ uint32_t tfm_ns_interface_init(void) static int ns_interface_init(void) { - __ASSERT(tfm_ns_interface_init() == PSA_SUCCESS, + __ASSERT(tfm_ns_interface_init() == TFM_SUCCESS, "TF-M NS interface init failed"); return 0; From 9996784e08241a0aea80f5f5af46a4c9e47b4e41 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:01 +0100 Subject: [PATCH 0948/2300] Revert "[nrf fromtree] modules: Update source, lib and include path for TF-M interface files" This reverts commit d5ee84cee2e8c1edab5fe61cedad9e87614e8b90. Signed-off-by: Robert Lubos --- boards/arm/b_u585i_iot02a/CMakeLists.txt | 2 +- boards/arm/b_u585i_iot02a/doc/index.rst | 4 +-- boards/arm/nucleo_l552ze_q/CMakeLists.txt | 2 +- .../nucleo_l552ze_q/doc/nucleol552ze_q.rst | 2 +- boards/arm/nucleo_u575zi_q/doc/index.rst | 2 +- boards/arm/nucleo_u5a5zj_q/CMakeLists.txt | 2 +- boards/arm/nucleo_u5a5zj_q/doc/index.rst | 2 +- boards/arm/stm32l562e_dk/CMakeLists.txt | 2 +- boards/arm/stm32l562e_dk/doc/index.rst | 2 +- modules/trusted-firmware-m/CMakeLists.txt | 25 +++++++++++-------- 10 files changed, 24 insertions(+), 21 deletions(-) diff --git a/boards/arm/b_u585i_iot02a/CMakeLists.txt b/boards/arm/b_u585i_iot02a/CMakeLists.txt index f6ca91f1a73..dde73804665 100644 --- a/boards/arm/b_u585i_iot02a/CMakeLists.txt +++ b/boards/arm/b_u585i_iot02a/CMakeLists.txt @@ -10,6 +10,6 @@ endif() if(CONFIG_BUILD_WITH_TFM) set_property(GLOBAL APPEND PROPERTY extra_post_build_commands #Execute post build script postbuild.sh - COMMAND $/api_ns/postbuild.sh ${COMPILER_FULL_PATH} + COMMAND $/postbuild.sh ${COMPILER_FULL_PATH} ) endif() diff --git a/boards/arm/b_u585i_iot02a/doc/index.rst b/boards/arm/b_u585i_iot02a/doc/index.rst index 5512a95f16d..3c794b4de79 100644 --- a/boards/arm/b_u585i_iot02a/doc/index.rst +++ b/boards/arm/b_u585i_iot02a/doc/index.rst @@ -346,14 +346,14 @@ can be generated using ``b_u585i_iot02a_ns`` as build target. $ west build -b b_u585i_iot02a_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. .. code-block:: bash - $ build/tfm/api_ns/regression.sh + $ build/tfm/regression.sh Finally, to flash the board, run: diff --git a/boards/arm/nucleo_l552ze_q/CMakeLists.txt b/boards/arm/nucleo_l552ze_q/CMakeLists.txt index 260ecca2707..d170d283e99 100644 --- a/boards/arm/nucleo_l552ze_q/CMakeLists.txt +++ b/boards/arm/nucleo_l552ze_q/CMakeLists.txt @@ -10,6 +10,6 @@ endif() if (CONFIG_BUILD_WITH_TFM) set_property(GLOBAL APPEND PROPERTY extra_post_build_commands #Execute post build script postbuild.sh - COMMAND $/api_ns/postbuild.sh ${COMPILER_FULL_PATH} + COMMAND $/postbuild.sh ${COMPILER_FULL_PATH} ) endif() diff --git a/boards/arm/nucleo_l552ze_q/doc/nucleol552ze_q.rst b/boards/arm/nucleo_l552ze_q/doc/nucleol552ze_q.rst index fbf77de1c44..51675477af4 100644 --- a/boards/arm/nucleo_l552ze_q/doc/nucleol552ze_q.rst +++ b/boards/arm/nucleo_l552ze_q/doc/nucleol552ze_q.rst @@ -338,7 +338,7 @@ can be generated using ``nucleo_l552ze_q_ns`` as build target. $ west build -b nucleo_l552ze_q_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. diff --git a/boards/arm/nucleo_u575zi_q/doc/index.rst b/boards/arm/nucleo_u575zi_q/doc/index.rst index e7035dd497a..0de2c364ecf 100644 --- a/boards/arm/nucleo_u575zi_q/doc/index.rst +++ b/boards/arm/nucleo_u575zi_q/doc/index.rst @@ -308,7 +308,7 @@ can be generated using ``nucleo_u575zi_q_ns`` as build target. $ west build -b nucleo_u575zi_q_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. diff --git a/boards/arm/nucleo_u5a5zj_q/CMakeLists.txt b/boards/arm/nucleo_u5a5zj_q/CMakeLists.txt index 7c2da293e20..c79a4b7b4e7 100644 --- a/boards/arm/nucleo_u5a5zj_q/CMakeLists.txt +++ b/boards/arm/nucleo_u5a5zj_q/CMakeLists.txt @@ -9,6 +9,6 @@ endif() if(CONFIG_BUILD_WITH_TFM) set_property(GLOBAL APPEND PROPERTY extra_post_build_commands #Execute post build script postbuild.sh - COMMAND $/api_ns/postbuild.sh ${COMPILER_FULL_PATH} + COMMAND $/postbuild.sh ${COMPILER_FULL_PATH} ) endif() diff --git a/boards/arm/nucleo_u5a5zj_q/doc/index.rst b/boards/arm/nucleo_u5a5zj_q/doc/index.rst index 154dbd32579..f877be5c168 100644 --- a/boards/arm/nucleo_u5a5zj_q/doc/index.rst +++ b/boards/arm/nucleo_u5a5zj_q/doc/index.rst @@ -342,7 +342,7 @@ can be generated using ``nucleo_u5a5zj_q_ns`` as build target. $ west build -b nucleo_u5a5zj_q_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. diff --git a/boards/arm/stm32l562e_dk/CMakeLists.txt b/boards/arm/stm32l562e_dk/CMakeLists.txt index f6ca91f1a73..dde73804665 100644 --- a/boards/arm/stm32l562e_dk/CMakeLists.txt +++ b/boards/arm/stm32l562e_dk/CMakeLists.txt @@ -10,6 +10,6 @@ endif() if(CONFIG_BUILD_WITH_TFM) set_property(GLOBAL APPEND PROPERTY extra_post_build_commands #Execute post build script postbuild.sh - COMMAND $/api_ns/postbuild.sh ${COMPILER_FULL_PATH} + COMMAND $/postbuild.sh ${COMPILER_FULL_PATH} ) endif() diff --git a/boards/arm/stm32l562e_dk/doc/index.rst b/boards/arm/stm32l562e_dk/doc/index.rst index 0eb2aa7630c..5a4f5845617 100644 --- a/boards/arm/stm32l562e_dk/doc/index.rst +++ b/boards/arm/stm32l562e_dk/doc/index.rst @@ -340,7 +340,7 @@ can be generated using ``stm32l562e_dk_ns`` as build target. $ west build -b stm32l562e_dk_ns path/to/source/directory -Note: When building the ``*_ns`` image with TF-M, ``build/tfm/api_ns/postbuild.sh`` bash script +Note: When building the ``*_ns`` image with TF-M, ``build/tfm/postbuild.sh`` bash script is run automatically in a post-build step to make some required flash layout changes. Once the build is completed, run the following script to initialize the option bytes. diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 8cc546883d0..ad1109d849b 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -181,12 +181,11 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_TEST_REPO_PATH ${ZEPHYR_CURRENT_MODULE_DIR}/../tf-m-tests) set(PSA_ARCH_TESTS_PATH ${ZEPHYR_CURRENT_MODULE_DIR}/../psa-arch-tests) - set(TFM_INTERFACE_SOURCE_DIR ${TFM_BINARY_DIR}/api_ns/interface/src) - set(TFM_INTERFACE_INCLUDE_DIR ${TFM_BINARY_DIR}/api_ns/interface/include) - set(TFM_INTERFACE_LIB_DIR ${TFM_BINARY_DIR}/api_ns/interface/lib) - + set(VENEERS_FILE ${TFM_BINARY_DIR}/secure_fw/s_veneers.o) set(TFM_API_NS_PATH ${TFM_BINARY_DIR}/tf-m-tests/app/libtfm_api_ns.a) set(PLATFORM_NS_FILE ${TFM_BINARY_DIR}/platform/ns/libplatform_ns.a) + set(TFM_GENERATED_INCLUDES ${TFM_BINARY_DIR}/generated/interface/include) + set(TFM_INTERFACE_SOURCE_DIR ${TFM_BINARY_DIR}/install/interface/src) if (TFM_PSA_TEST_SUITE) set(PSA_TEST_VAL_FILE ${TFM_BINARY_DIR}/tf-m-tests/app/psa_api_tests/val/val_nspe.a) @@ -214,7 +213,9 @@ if (CONFIG_BUILD_WITH_TFM) set(TFM_S_NS_SIGNED_BIN_FILE ${TFM_BINARY_DIR}/bin/tfm_s_ns_signed.bin) set(BUILD_BYPRODUCTS + ${VENEERS_FILE} ${TFM_API_NS_PATH} + ${TFM_GENERATED_INCLUDES}/psa_manifest/sid.h ${PSA_TEST_VAL_FILE} ${PSA_TEST_PAL_FILE} ${PSA_TEST_COMBINE_FILE} @@ -231,15 +232,13 @@ if (CONFIG_BUILD_WITH_TFM) ${TFM_NS_SIGNED_BIN_FILE} ${TFM_S_NS_SIGNED_BIN_FILE} - ${TFM_INTERFACE_LIB_DIR}/s_veneers.o - ${TFM_INTERFACE_SOURCE_DIR}/tfm_attest_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_crypto_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_fwu_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_its_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_platform_api.c ${TFM_INTERFACE_SOURCE_DIR}/tfm_ps_api.c - ${TFM_INTERFACE_SOURCE_DIR}/tfm_tz_psa_ns_api.c + ${TFM_INTERFACE_SOURCE_DIR}/tfm_psa_ns_api.c # Specific to nordic_nrf platform ${TFM_INTERFACE_SOURCE_DIR}/tfm_ioctl_core_ns_api.c @@ -434,7 +433,7 @@ if (CONFIG_BUILD_WITH_TFM) zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INITIAL_ATTESTATION ${TFM_INTERFACE_SOURCE_DIR}/tfm_attest_api.c) zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_FIRMWARE_UPDATE ${TFM_INTERFACE_SOURCE_DIR}/tfm_fwu_api.c) - zephyr_library_sources(${TFM_INTERFACE_SOURCE_DIR}/tfm_tz_psa_ns_api.c) + zephyr_library_sources(${TFM_INTERFACE_SOURCE_DIR}/tfm_psa_ns_api.c) if(CONFIG_SOC_FAMILY_NRF) zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_ioctl_core_ns_api.c) @@ -447,13 +446,17 @@ if (CONFIG_BUILD_WITH_TFM) ) endif() + zephyr_include_directories( + ${TFM_GENERATED_INCLUDES} + ) + target_include_directories(tfm_api PRIVATE - ${TFM_INTERFACE_INCLUDE_DIR} - ${TFM_INTERFACE_INCLUDE_DIR}/crypto_keys + ${TFM_BINARY_DIR}/install/interface/include + ${TFM_BINARY_DIR}/install/interface/include/crypto_keys ) zephyr_library_link_libraries( - ${TFM_INTERFACE_LIB_DIR}/s_veneers.o + ${VENEERS_FILE} ) # To ensure that generated include files are created before they are used. From 82e4ef172b03fd0ec4ee08a996d87cbb179e0f6e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:01 +0100 Subject: [PATCH 0949/2300] Revert "[nrf fromtree] modules: tf-m: Remove platform_ns target" This reverts commit d86c7d352fc09a985b251bd195eddde1baf761f5. Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt index d5bc57ac5d9..41dca2f15a9 100644 --- a/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic_nrf/CMakeLists.txt @@ -36,6 +36,14 @@ target_include_directories(platform_s ${board_includes} ) +target_include_directories(platform_ns + PUBLIC + include + include/util + ${partition_includes} + ${board_includes} +) + if(BL2) target_include_directories(platform_bl2 PUBLIC From 5de441ab89417b682e214157640df03e09f9137a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:02 +0100 Subject: [PATCH 0950/2300] Revert "[nrf fromtree] tf-m: Change NS include path for TF-M 2.0.0" This reverts commit 71edd6a837497042963764244b241650349e688e. Signed-off-by: Robert Lubos --- boards/arm/bl5340_dvk/CMakeLists.txt | 2 +- boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt | 2 +- boards/arm/nrf5340dk_nrf5340/CMakeLists.txt | 2 +- drivers/entropy/CMakeLists.txt | 2 +- modules/uoscore-uedhoc/CMakeLists.txt | 2 +- samples/bluetooth/mesh/CMakeLists.txt | 2 +- samples/bluetooth/mesh_demo/CMakeLists.txt | 2 +- samples/bluetooth/mesh_provisioner/CMakeLists.txt | 2 +- samples/drivers/counter/alarm/CMakeLists.txt | 2 +- samples/subsys/usb/mass/CMakeLists.txt | 2 +- samples/tfm_integration/psa_crypto/CMakeLists.txt | 2 +- .../tfm_integration/psa_protected_storage/CMakeLists.txt | 2 +- samples/tfm_integration/tfm_ipc/CMakeLists.txt | 2 +- samples/tfm_integration/tfm_psa_test/CMakeLists.txt | 2 +- samples/tfm_integration/tfm_secure_partition/CMakeLists.txt | 2 +- soc/arm/nordic_nrf/common/CMakeLists.txt | 2 +- subsys/bluetooth/mesh/CMakeLists.txt | 2 +- subsys/net/lib/tls_credentials/CMakeLists.txt | 6 ------ tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt | 2 +- 19 files changed, 18 insertions(+), 24 deletions(-) diff --git a/boards/arm/bl5340_dvk/CMakeLists.txt b/boards/arm/bl5340_dvk/CMakeLists.txt index 863c8bb599e..541334195dd 100644 --- a/boards/arm/bl5340_dvk/CMakeLists.txt +++ b/boards/arm/bl5340_dvk/CMakeLists.txt @@ -9,7 +9,7 @@ zephyr_library_sources(bl5340_dvk_cpunet_reset.c) if (CONFIG_BUILD_WITH_TFM) zephyr_library_include_directories( - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt b/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt index fa1c1ba14d9..c950fd91724 100644 --- a/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt +++ b/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt @@ -8,7 +8,7 @@ if ((CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF5340_AUDIO_ if (CONFIG_BUILD_WITH_TFM) zephyr_library_include_directories( - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/boards/arm/nrf5340dk_nrf5340/CMakeLists.txt b/boards/arm/nrf5340dk_nrf5340/CMakeLists.txt index 5128462d70c..8ba3238c40b 100644 --- a/boards/arm/nrf5340dk_nrf5340/CMakeLists.txt +++ b/boards/arm/nrf5340dk_nrf5340/CMakeLists.txt @@ -8,7 +8,7 @@ zephyr_library_sources(nrf5340_cpunet_reset.c) if (CONFIG_BUILD_WITH_TFM) zephyr_library_include_directories( - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 7ca87d60944..99184f3b1e5 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -28,6 +28,6 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypt if (CONFIG_BUILD_WITH_TFM) target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/modules/uoscore-uedhoc/CMakeLists.txt b/modules/uoscore-uedhoc/CMakeLists.txt index aaf842e392c..e23ad7da2e6 100644 --- a/modules/uoscore-uedhoc/CMakeLists.txt +++ b/modules/uoscore-uedhoc/CMakeLists.txt @@ -29,7 +29,7 @@ if (CONFIG_UOSCORE OR CONFIG_UEDHOC) if (CONFIG_BUILD_WITH_TFM) zephyr_library_include_directories( - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/samples/bluetooth/mesh/CMakeLists.txt b/samples/bluetooth/mesh/CMakeLists.txt index 74734eb84b4..6ee28b12d48 100644 --- a/samples/bluetooth/mesh/CMakeLists.txt +++ b/samples/bluetooth/mesh/CMakeLists.txt @@ -16,6 +16,6 @@ endif() if (CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/samples/bluetooth/mesh_demo/CMakeLists.txt b/samples/bluetooth/mesh_demo/CMakeLists.txt index f5d347ab373..07736d6c12e 100644 --- a/samples/bluetooth/mesh_demo/CMakeLists.txt +++ b/samples/bluetooth/mesh_demo/CMakeLists.txt @@ -15,6 +15,6 @@ endif() if (CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/samples/bluetooth/mesh_provisioner/CMakeLists.txt b/samples/bluetooth/mesh_provisioner/CMakeLists.txt index aefe3628ba8..7b22bd0fe14 100644 --- a/samples/bluetooth/mesh_provisioner/CMakeLists.txt +++ b/samples/bluetooth/mesh_provisioner/CMakeLists.txt @@ -10,6 +10,6 @@ target_sources(app PRIVATE src/main.c) if (CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/samples/drivers/counter/alarm/CMakeLists.txt b/samples/drivers/counter/alarm/CMakeLists.txt index 747c2b27ebd..eadc9e99e67 100644 --- a/samples/drivers/counter/alarm/CMakeLists.txt +++ b/samples/drivers/counter/alarm/CMakeLists.txt @@ -9,6 +9,6 @@ target_sources(app PRIVATE ${app_sources}) if(CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/samples/subsys/usb/mass/CMakeLists.txt b/samples/subsys/usb/mass/CMakeLists.txt index 2ac19d9b016..ef71596104d 100644 --- a/samples/subsys/usb/mass/CMakeLists.txt +++ b/samples/subsys/usb/mass/CMakeLists.txt @@ -15,6 +15,6 @@ target_sources(app PRIVATE ${app_sources}) if(CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/samples/tfm_integration/psa_crypto/CMakeLists.txt b/samples/tfm_integration/psa_crypto/CMakeLists.txt index f8ef1eca23f..17339b470b8 100644 --- a/samples/tfm_integration/psa_crypto/CMakeLists.txt +++ b/samples/tfm_integration/psa_crypto/CMakeLists.txt @@ -16,7 +16,7 @@ target_sources(app PRIVATE src/util_app_log.c) target_sources(app PRIVATE src/util_sformat.c) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) # In TF-M, default value of CRYPTO_ENGINE_BUF_SIZE is 0x2080. It causes diff --git a/samples/tfm_integration/psa_protected_storage/CMakeLists.txt b/samples/tfm_integration/psa_protected_storage/CMakeLists.txt index dfb0169eda6..bbb8a2041fd 100644 --- a/samples/tfm_integration/psa_protected_storage/CMakeLists.txt +++ b/samples/tfm_integration/psa_protected_storage/CMakeLists.txt @@ -13,5 +13,5 @@ project(protected_storage) target_sources(app PRIVATE src/main.c) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) diff --git a/samples/tfm_integration/tfm_ipc/CMakeLists.txt b/samples/tfm_integration/tfm_ipc/CMakeLists.txt index 896af7bfbda..f11b67af843 100644 --- a/samples/tfm_integration/tfm_ipc/CMakeLists.txt +++ b/samples/tfm_integration/tfm_ipc/CMakeLists.txt @@ -9,5 +9,5 @@ project(tfm_ipc) target_sources(app PRIVATE src/main.c) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) diff --git a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt index 7692ea3dfd1..9dcbf12ae64 100644 --- a/samples/tfm_integration/tfm_psa_test/CMakeLists.txt +++ b/samples/tfm_integration/tfm_psa_test/CMakeLists.txt @@ -13,5 +13,5 @@ project(tfm_psa_storage_test) target_sources(app PRIVATE src/main.c) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) diff --git a/samples/tfm_integration/tfm_secure_partition/CMakeLists.txt b/samples/tfm_integration/tfm_secure_partition/CMakeLists.txt index beadae9230a..69901f73928 100644 --- a/samples/tfm_integration/tfm_secure_partition/CMakeLists.txt +++ b/samples/tfm_integration/tfm_secure_partition/CMakeLists.txt @@ -28,7 +28,7 @@ target_sources(app PRIVATE ) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) target_compile_definitions(app diff --git a/soc/arm/nordic_nrf/common/CMakeLists.txt b/soc/arm/nordic_nrf/common/CMakeLists.txt index ea05f3d369e..c894615a700 100644 --- a/soc/arm/nordic_nrf/common/CMakeLists.txt +++ b/soc/arm/nordic_nrf/common/CMakeLists.txt @@ -11,6 +11,6 @@ set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/li if (CONFIG_TFM_PARTITION_PLATFORM) zephyr_library_sources(soc_secure.c) zephyr_library_include_directories( - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/subsys/bluetooth/mesh/CMakeLists.txt b/subsys/bluetooth/mesh/CMakeLists.txt index c628fb6d9db..5d4f41ce7f7 100644 --- a/subsys/bluetooth/mesh/CMakeLists.txt +++ b/subsys/bluetooth/mesh/CMakeLists.txt @@ -129,6 +129,6 @@ zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) if (CONFIG_BUILD_WITH_TFM) target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE - $/api_ns/interface/include + $/install/interface/include ) endif() diff --git a/subsys/net/lib/tls_credentials/CMakeLists.txt b/subsys/net/lib/tls_credentials/CMakeLists.txt index 5a80bed58a6..490a558953d 100644 --- a/subsys/net/lib/tls_credentials/CMakeLists.txt +++ b/subsys/net/lib/tls_credentials/CMakeLists.txt @@ -15,9 +15,3 @@ zephyr_library_sources_ifdef(CONFIG_TLS_CREDENTIALS_SHELL ) zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) - -if (CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE AND CONFIG_BUILD_WITH_TFM) - target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE - $/api_ns/interface/include - ) -endif() diff --git a/tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt b/tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt index 10ee1786e16..93e91deafcb 100644 --- a/tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt +++ b/tests/arch/arm/arm_thread_swap_tz/CMakeLists.txt @@ -14,6 +14,6 @@ target_sources(app PRIVATE ${app_sources}) if (CONFIG_BUILD_WITH_TFM) target_include_directories(app PRIVATE - $/api_ns/interface/include + $/install/interface/include ) endif() From 9493a05f009663077b9c0cdd811323922f492cb0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:02 +0100 Subject: [PATCH 0951/2300] Revert "[nrf fromtree] modules: tf-m: nrf9160: Change to cpuarch.cmake" This reverts commit 98d15e727b63d98a9d3711365ef67f59fb711746. Signed-off-by: Robert Lubos --- .../nordic_nrf/nrf9160/{cpuarch.cmake => preload.cmake} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename modules/trusted-firmware-m/nordic_nrf/nrf9160/{cpuarch.cmake => preload.cmake} (60%) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9160/preload.cmake similarity index 60% rename from modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake rename to modules/trusted-firmware-m/nordic_nrf/nrf9160/preload.cmake index 228252f0147..364480a6f7f 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9160/cpuarch.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9160/preload.cmake @@ -4,4 +4,4 @@ # SPDX-License-Identifier: Apache-2.0 # -include(platform/ext/target/nordic_nrf/common/nrf9160/cpuarch.cmake) +include(platform/ext/target/nordic_nrf/common/nrf9160/preload.cmake) From c14a44fd75f73f011917d7f1d786be7609d4fc99 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:02 +0100 Subject: [PATCH 0952/2300] Revert "[nrf fromtree] modules: tf-m: nrf9120: Change to cpuarch.cmake" This reverts commit becddd8298096e6a4c499c02c380af581c5d3f97. Signed-off-by: Robert Lubos --- .../nordic_nrf/nrf9120/{cpuarch.cmake => preload.cmake} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename modules/trusted-firmware-m/nordic_nrf/nrf9120/{cpuarch.cmake => preload.cmake} (60%) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf9120/preload.cmake similarity index 60% rename from modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake rename to modules/trusted-firmware-m/nordic_nrf/nrf9120/preload.cmake index b34a8ddab1a..4b3c6ee79ab 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf9120/cpuarch.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf9120/preload.cmake @@ -4,4 +4,4 @@ # SPDX-License-Identifier: Apache-2.0 # -include(platform/ext/target/nordic_nrf/common/nrf9120/cpuarch.cmake) +include(platform/ext/target/nordic_nrf/common/nrf9120/preload.cmake) From 790edad1c03f170fe9b517bad65f11239164f984 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:02 +0100 Subject: [PATCH 0953/2300] Revert "[nrf fromtree] modules: tf-m: nrf5340_cpuapp: Change to cpuarch.cmake" This reverts commit c41f1a4235ad69941f61e32ec78929911955b61a. Signed-off-by: Robert Lubos --- .../nordic_nrf/nrf5340_cpuapp/{cpuarch.cmake => preload.cmake} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/{cpuarch.cmake => preload.cmake} (60%) diff --git a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/preload.cmake similarity index 60% rename from modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake rename to modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/preload.cmake index 903b23e4cc6..d9bd226eb65 100644 --- a/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/cpuarch.cmake +++ b/modules/trusted-firmware-m/nordic_nrf/nrf5340_cpuapp/preload.cmake @@ -4,4 +4,4 @@ # SPDX-License-Identifier: Apache-2.0 # -include(platform/ext/target/nordic_nrf/common/nrf5340/cpuarch.cmake) +include(platform/ext/target/nordic_nrf/common/nrf5340/preload.cmake) From 27cf0065c9a452409b9398d3d554a980132bf410 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:03 +0100 Subject: [PATCH 0954/2300] Revert "[nrf fromtree] modules: mbedtls: Adapt source list to 3.5.0" This reverts commit a1f89bdc9bdf9d239e451c68d94a690ac425373b. Signed-off-by: Robert Lubos --- modules/mbedtls/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 6870c89d0ec..26397887ae8 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -55,13 +55,13 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecdh.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecdsa.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecjpake.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp_curves_new.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp_curves.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy_poll.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/error.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/gcm.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/hash_info.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/hkdf.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/hmac_drbg.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/lmots.c From 78e0d596d077e9f7bc320b77bb78d4e44626109c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:03 +0100 Subject: [PATCH 0955/2300] Revert "[nrf fromtree] modules: mbedtls: Sort base src" This reverts commit ae9e596dc543cd85f963e130381ce0465067ec5c. Signed-off-by: Robert Lubos --- modules/mbedtls/CMakeLists.txt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 26397887ae8..10b95d27a9c 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -30,24 +30,30 @@ zephyr_interface_library_named(mbedTLS) # Base mbed TLS files list(APPEND mbedtls_base_src - ${ZEPHYR_CURRENT_MODULE_DIR}/library/aes.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/aesni.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/aria.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/asn1parse.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/asn1write.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/base64.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum_core.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum_mod_raw.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum_mod.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/bignum_mod_raw.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/nist_kw.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/oid.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/padlock.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/platform.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/platform_util.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/version.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/constant_time.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/aes.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/aesni.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/aria.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/camellia.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ccm.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/chacha20.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/chachapoly.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/cipher_wrap.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/cipher.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/cipher_wrap.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/cmac.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/constant_time.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ctr_drbg.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/debug.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/des.c @@ -55,10 +61,10 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecdh.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecdsa.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecjpake.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp_curves.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy_poll.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/ecp_curves.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/entropy_poll.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/error.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/gcm.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/hash_info.c @@ -66,16 +72,11 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/hmac_drbg.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/lmots.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/lms.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/md.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/md5.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/md.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/memory_buffer_alloc.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/mps_reader.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/mps_trace.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/nist_kw.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/oid.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/padlock.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/platform_util.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/platform.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/poly1305.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_util.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/ripemd160.c @@ -87,7 +88,6 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/threading.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/timing.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/version_features.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/version.c zephyr_init.c ) From a68de5c48534d1b05e22eee2112029b0e163d3cc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:03 +0100 Subject: [PATCH 0956/2300] Revert "[nrf fromtree] manifest: TF-M v2.0.0 update" This reverts commit 6c976412d1091fe29dc186e92d3efeb932ec99f2. Signed-off-by: Robert Lubos --- submanifests/optional.yaml | 4 ++-- west.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index 00b0408c454..54b3d77c0cb 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -28,7 +28,7 @@ manifest: groups: - optional - name: psa-arch-tests - revision: 2cadb02a72eacda7042505dcbdd492371e8ce024 + revision: 6a17330e0dfb5f319730f974d5b05f7b7f04757b path: modules/tee/tf-m/psa-arch-tests remote: upstream groups: @@ -40,7 +40,7 @@ manifest: groups: - optional - name: tf-m-tests - revision: 08a3158f0623a4205608a52d880b17ae394e31d2 + revision: a878426da78fbd1486dfc29d6c6b82be4ee79e72 path: modules/tee/tf-m/tf-m-tests remote: upstream groups: diff --git a/west.yml b/west.yml index 417e33849e3..ffb998f98ab 100644 --- a/west.yml +++ b/west.yml @@ -277,7 +277,7 @@ manifest: revision: 7c61a4cec26402d20c845c95dcad0e39dcd319f8 path: modules/lib/gui/lvgl - name: mbedtls - revision: 66ed2279d6222056af172c188eaf4dcfed481032 + revision: 7053083b0cff8462464e3cbb826e87852fc03da6 path: modules/crypto/mbedtls groups: - crypto @@ -322,7 +322,7 @@ manifest: groups: - crypto - name: trusted-firmware-m - revision: 58d0b5367f0fada9dbaddad1e08e302aeb044863 + revision: 33c0f47bcb19721a5c33e6fe1eee9225d00bb5bc path: modules/tee/tf-m/trusted-firmware-m groups: - tee From 3e9015b6fee146d1e6282d014ee4acd0baca5039 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:03 +0100 Subject: [PATCH 0957/2300] Revert "[nrf fromtree] net: zperf: Fix session leak" This reverts commit 7df557f01329d51a85b96fae45b3c6049e8d9cbe. Signed-off-by: Robert Lubos --- subsys/net/lib/zperf/zperf_session.c | 23 +++++------------------ subsys/net/lib/zperf/zperf_session.h | 2 -- subsys/net/lib/zperf/zperf_tcp_receiver.c | 2 -- subsys/net/lib/zperf/zperf_udp_receiver.c | 2 -- 4 files changed, 5 insertions(+), 24 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_session.c b/subsys/net/lib/zperf/zperf_session.c index 6fff4abf9cc..3b72367e179 100644 --- a/subsys/net/lib/zperf/zperf_session.c +++ b/subsys/net/lib/zperf/zperf_session.c @@ -102,27 +102,14 @@ void zperf_reset_session_stats(struct session *session) session->last_transit_time = 0; } -void zperf_session_reset(enum session_proto proto) -{ - int i, j; - - if (proto >= SESSION_PROTO_END) { - return; - } - - i = (int)proto; - - for (j = 0; j < SESSION_MAX; j++) { - sessions[i][j].state = STATE_NULL; - zperf_reset_session_stats(&(sessions[i][j])); - } -} - void zperf_session_init(void) { - int i; + int i, j; for (i = 0; i < SESSION_PROTO_END; i++) { - zperf_session_reset(i); + for (j = 0; j < SESSION_MAX; j++) { + sessions[i][j].state = STATE_NULL; + zperf_reset_session_stats(&(sessions[i][j])); + } } } diff --git a/subsys/net/lib/zperf/zperf_session.h b/subsys/net/lib/zperf/zperf_session.h index f01bc66b71a..ea28dec2c60 100644 --- a/subsys/net/lib/zperf/zperf_session.h +++ b/subsys/net/lib/zperf/zperf_session.h @@ -58,7 +58,5 @@ struct session *get_session(const struct sockaddr *addr, enum session_proto proto); void zperf_session_init(void); void zperf_reset_session_stats(struct session *session); -/* Reset all sessions for a given protocol. */ -void zperf_session_reset(enum session_proto proto); #endif /* __ZPERF_SESSION_H */ diff --git a/subsys/net/lib/zperf/zperf_tcp_receiver.c b/subsys/net/lib/zperf/zperf_tcp_receiver.c index 3efd3ff630b..09624dd07b7 100644 --- a/subsys/net/lib/zperf/zperf_tcp_receiver.c +++ b/subsys/net/lib/zperf/zperf_tcp_receiver.c @@ -117,8 +117,6 @@ static void tcp_receiver_cleanup(void) tcp_server_running = false; tcp_session_cb = NULL; - - zperf_session_reset(SESSION_TCP); } static int tcp_recv_data(struct net_socket_service_event *pev) diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index ae1ac063300..64f489ed8dc 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -240,8 +240,6 @@ static void udp_receiver_cleanup(void) udp_server_running = false; udp_session_cb = NULL; - - zperf_session_reset(SESSION_UDP); } static int udp_recv_data(struct net_socket_service_event *pev) From a79909cd931c18d0d9fd61a37fc39c38e0ed5399 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:03 +0100 Subject: [PATCH 0958/2300] Revert "[nrf fromtree] net: zperf: Fix TCP receiver start/stop operation" This reverts commit 40c0461b6ef606eb8230b2ab6ed26500c9a068c0. Signed-off-by: Robert Lubos --- subsys/net/lib/zperf/zperf_tcp_receiver.c | 73 ++++++++++------------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_tcp_receiver.c b/subsys/net/lib/zperf/zperf_tcp_receiver.c index 09624dd07b7..c782124e36b 100644 --- a/subsys/net/lib/zperf/zperf_tcp_receiver.c +++ b/subsys/net/lib/zperf/zperf_tcp_receiver.c @@ -33,8 +33,10 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); static zperf_callback tcp_session_cb; static void *tcp_user_data; static bool tcp_server_running; +static bool tcp_server_stop; static uint16_t tcp_server_port; static struct sockaddr tcp_server_addr; +static K_SEM_DEFINE(tcp_server_run, 0, 1); static struct zsock_pollfd fds[SOCK_ID_MAX]; static struct sockaddr sock_addr[SOCK_ID_MAX]; @@ -101,46 +103,26 @@ static void tcp_session_error_report(void) } } -static void tcp_receiver_cleanup(void) -{ - int i; - - (void)net_socket_service_unregister(&svc_tcp); - - for (i = 0; i < ARRAY_SIZE(fds); i++) { - if (fds[i].fd >= 0) { - zsock_close(fds[i].fd); - fds[i].fd = -1; - memset(&sock_addr[i], 0, sizeof(struct sockaddr)); - } - } - - tcp_server_running = false; - tcp_session_cb = NULL; -} - static int tcp_recv_data(struct net_socket_service_event *pev) { static uint8_t buf[TCP_RECEIVER_BUF_SIZE]; int i, ret = 0; - int family, sock, sock_error; + int family, sock; struct sockaddr addr_incoming_conn; socklen_t optlen = sizeof(int); socklen_t addrlen = sizeof(struct sockaddr); - if (!tcp_server_running) { - return -ENOENT; + if (tcp_server_stop) { + ret = -ENOENT; + goto cleanup; } if ((pev->event.revents & ZSOCK_POLLERR) || (pev->event.revents & ZSOCK_POLLNVAL)) { (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, SO_DOMAIN, &family, &optlen); - (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, - SO_ERROR, &sock_error, &optlen); - NET_ERR("TCP receiver IPv%d socket error (%d)", - family == AF_INET ? 4 : 6, sock_error); - ret = -sock_error; + NET_ERR("TCP receiver IPv%d socket error", + family == AF_INET ? 4 : 6); goto error; } @@ -158,11 +140,10 @@ static int tcp_recv_data(struct net_socket_service_event *pev) &addr_incoming_conn, &addrlen); if (sock < 0) { - ret = -errno; (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, SO_DOMAIN, &family, &optlen); - NET_ERR("TCP receiver IPv%d accept error (%d)", - family == AF_INET ? 4 : 6, ret); + NET_ERR("TCP receiver IPv%d accept error", + family == AF_INET ? 4 : 6); goto error; } @@ -226,6 +207,17 @@ static int tcp_recv_data(struct net_socket_service_event *pev) error: tcp_session_error_report(); +cleanup: + for (i = 0; i < ARRAY_SIZE(fds); i++) { + if (fds[i].fd >= 0) { + zsock_close(fds[i].fd); + fds[i].fd = -1; + memset(&sock_addr[i], 0, sizeof(struct sockaddr)); + } + } + + (void)net_socket_service_unregister(&svc_tcp); + return ret; } @@ -237,7 +229,7 @@ static void tcp_svc_handler(struct k_work *work) ret = tcp_recv_data(pev); if (ret < 0) { - tcp_receiver_cleanup(); + (void)net_socket_service_unregister(&svc_tcp); } } @@ -273,7 +265,7 @@ static int tcp_bind_listen_connection(struct zsock_pollfd *pollfd, return ret; } -static int zperf_tcp_receiver_init(void) +static void zperf_tcp_receiver_init(void) { int ret; @@ -288,7 +280,6 @@ static int zperf_tcp_receiver_init(void) fds[SOCK_ID_IPV4_LISTEN].fd = zsock_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fds[SOCK_ID_IPV4_LISTEN].fd < 0) { - ret = -errno; NET_ERR("Cannot create IPv4 network socket."); goto error; } @@ -334,7 +325,6 @@ static int zperf_tcp_receiver_init(void) fds[SOCK_ID_IPV6_LISTEN].fd = zsock_socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); if (fds[SOCK_ID_IPV6_LISTEN].fd < 0) { - ret = -errno; NET_ERR("Cannot create IPv6 network socket."); goto error; } @@ -384,14 +374,12 @@ static int zperf_tcp_receiver_init(void) } error: - return ret; + return; } int zperf_tcp_download(const struct zperf_download_params *param, zperf_callback callback, void *user_data) { - int ret; - if (param == NULL || callback == NULL) { return -EINVAL; } @@ -403,15 +391,13 @@ int zperf_tcp_download(const struct zperf_download_params *param, tcp_session_cb = callback; tcp_user_data = user_data; tcp_server_port = param->port; + tcp_server_running = true; + tcp_server_stop = false; memcpy(&tcp_server_addr, ¶m->addr, sizeof(struct sockaddr)); - ret = zperf_tcp_receiver_init(); - if (ret < 0) { - tcp_receiver_cleanup(); - return ret; - } + zperf_tcp_receiver_init(); - tcp_server_running = true; + k_sem_give(&tcp_server_run); return 0; } @@ -422,7 +408,8 @@ int zperf_tcp_download_stop(void) return -EALREADY; } - tcp_receiver_cleanup(); + tcp_server_stop = true; + tcp_session_cb = NULL; return 0; } From 6c7b4ea01992f744f6bfb1d5c8c21736d8936091 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:04 +0100 Subject: [PATCH 0959/2300] Revert "[nrf fromtree] net: zperf: Fix UDP receiver start/stop operation" This reverts commit 8759556a08276c1a35423b9ec0c95a6320721cb4. Signed-off-by: Robert Lubos --- subsys/net/lib/zperf/zperf_udp_receiver.c | 72 +++++++++-------------- 1 file changed, 29 insertions(+), 43 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index 64f489ed8dc..ba44590c621 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -36,8 +36,10 @@ static struct sockaddr_in *in4_addr_my; static zperf_callback udp_session_cb; static void *udp_user_data; static bool udp_server_running; +static bool udp_server_stop; static uint16_t udp_server_port; static struct sockaddr udp_server_addr; +static K_SEM_DEFINE(udp_server_run, 0, 1); struct zsock_pollfd fds[SOCK_ID_MAX] = { 0 }; @@ -225,45 +227,26 @@ static void udp_received(int sock, const struct sockaddr *addr, uint8_t *data, } } -static void udp_receiver_cleanup(void) -{ - int i; - - (void)net_socket_service_unregister(&svc_udp); - - for (i = 0; i < ARRAY_SIZE(fds); i++) { - if (fds[i].fd >= 0) { - zsock_close(fds[i].fd); - fds[i].fd = -1; - } - } - - udp_server_running = false; - udp_session_cb = NULL; -} - static int udp_recv_data(struct net_socket_service_event *pev) { static uint8_t buf[UDP_RECEIVER_BUF_SIZE]; - int ret = 0; - int family, sock_error; + int i, ret = 0; + int family; struct sockaddr addr; socklen_t optlen = sizeof(int); socklen_t addrlen = sizeof(addr); - if (!udp_server_running) { - return -ENOENT; + if (udp_server_stop) { + ret = -ENOENT; + goto cleanup; } if ((pev->event.revents & ZSOCK_POLLERR) || (pev->event.revents & ZSOCK_POLLNVAL)) { (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, SO_DOMAIN, &family, &optlen); - (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, - SO_ERROR, &sock_error, &optlen); - NET_ERR("UDP receiver IPv%d socket error (%d)", - family == AF_INET ? 4 : 6, sock_error); - ret = -sock_error; + NET_ERR("UDP receiver IPv%d socket error", + family == AF_INET ? 4 : 6); goto error; } @@ -274,11 +257,10 @@ static int udp_recv_data(struct net_socket_service_event *pev) ret = zsock_recvfrom(pev->event.fd, buf, sizeof(buf), 0, &addr, &addrlen); if (ret < 0) { - ret = -errno; (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, SO_DOMAIN, &family, &optlen); NET_ERR("recv failed on IPv%d socket (%d)", - family == AF_INET ? 4 : 6, -ret); + family == AF_INET ? 4 : 6, errno); goto error; } @@ -291,6 +273,16 @@ static int udp_recv_data(struct net_socket_service_event *pev) udp_session_cb(ZPERF_SESSION_ERROR, NULL, udp_user_data); } +cleanup: + for (i = 0; i < ARRAY_SIZE(fds); i++) { + if (fds[i].fd >= 0) { + zsock_close(fds[i].fd); + fds[i].fd = -1; + } + } + + (void)net_socket_service_unregister(&svc_udp); + return ret; } @@ -302,11 +294,11 @@ static void udp_svc_handler(struct k_work *work) ret = udp_recv_data(pev); if (ret < 0) { - udp_receiver_cleanup(); + (void)net_socket_service_unregister(&svc_udp); } } -static int zperf_udp_receiver_init(void) +static void zperf_udp_receiver_init(void) { int ret; @@ -322,7 +314,6 @@ static int zperf_udp_receiver_init(void) fds[SOCK_ID_IPV4].fd = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fds[SOCK_ID_IPV4].fd < 0) { - ret = -errno; NET_ERR("Cannot create IPv4 network socket."); goto error; } @@ -371,7 +362,6 @@ static int zperf_udp_receiver_init(void) fds[SOCK_ID_IPV6].fd = zsock_socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (fds[SOCK_ID_IPV6].fd < 0) { - ret = -errno; NET_ERR("Cannot create IPv4 network socket."); goto error; } @@ -424,15 +414,12 @@ static int zperf_udp_receiver_init(void) } error: - - return ret; + return; } int zperf_udp_download(const struct zperf_download_params *param, zperf_callback callback, void *user_data) { - int ret; - if (param == NULL || callback == NULL) { return -EINVAL; } @@ -444,15 +431,13 @@ int zperf_udp_download(const struct zperf_download_params *param, udp_session_cb = callback; udp_user_data = user_data; udp_server_port = param->port; + udp_server_running = true; + udp_server_stop = false; memcpy(&udp_server_addr, ¶m->addr, sizeof(struct sockaddr)); - ret = zperf_udp_receiver_init(); - if (ret < 0) { - udp_receiver_cleanup(); - return ret; - } + zperf_udp_receiver_init(); - udp_server_running = true; + k_sem_give(&udp_server_run); return 0; } @@ -463,7 +448,8 @@ int zperf_udp_download_stop(void) return -EALREADY; } - udp_receiver_cleanup(); + udp_server_stop = true; + udp_session_cb = NULL; return 0; } From 6ca1574ae0c179a6eda8363d942c5164784a7b0b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:04 +0100 Subject: [PATCH 0960/2300] Revert "[nrf fromtree] net: zperf: fix the calculation ratio between mbps, kbps and bps" This reverts commit 65535b8ddb0c9aaabb912d1af5fb3d2a215d0492. Signed-off-by: Robert Lubos --- subsys/net/lib/zperf/zperf_shell.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_shell.c b/subsys/net/lib/zperf/zperf_shell.c index 2c30c1e33e3..444cf125c31 100644 --- a/subsys/net/lib/zperf/zperf_shell.c +++ b/subsys/net/lib/zperf/zperf_shell.c @@ -76,9 +76,9 @@ static struct in_addr shell_ipv4; const uint32_t TIME_US[] = { 60 * 1000 * 1000, 1000 * 1000, 1000, 0 }; const char *TIME_US_UNIT[] = { "m", "s", "ms", "us" }; -const uint32_t KBPS[] = { 1000, 0 }; +const uint32_t KBPS[] = { 1024, 0 }; const char *KBPS_UNIT[] = { "Mbps", "Kbps" }; -const uint32_t K[] = { 1000 * 1000, 1000, 0 }; +const uint32_t K[] = { 1024 * 1024, 1024, 0 }; const char *K_UNIT[] = { "M", "K", "" }; static void print_number(const struct shell *sh, uint32_t value, @@ -308,7 +308,7 @@ static void udp_session_cb(enum zperf_status status, rate_in_kbps = (uint32_t) (((uint64_t)result->total_len * 8ULL * (uint64_t)USEC_PER_SEC) / - ((uint64_t)result->time_in_us * 1000ULL)); + ((uint64_t)result->time_in_us * 1024ULL)); } else { rate_in_kbps = 0U; } @@ -408,7 +408,7 @@ static void shell_udp_upload_print_stats(const struct shell *sh, rate_in_kbps = (uint32_t) (((uint64_t)results->total_len * (uint64_t)8 * (uint64_t)USEC_PER_SEC) / - ((uint64_t)results->time_in_us * 1000U)); + ((uint64_t)results->time_in_us * 1024U)); } else { rate_in_kbps = 0U; } @@ -418,7 +418,7 @@ static void shell_udp_upload_print_stats(const struct shell *sh, (((uint64_t)results->nb_packets_sent * (uint64_t)results->packet_size * (uint64_t)8 * (uint64_t)USEC_PER_SEC) / - ((uint64_t)results->client_time_in_us * 1000U)); + ((uint64_t)results->client_time_in_us * 1024U)); } else { client_rate_in_kbps = 0U; } @@ -474,7 +474,7 @@ static void shell_tcp_upload_print_stats(const struct shell *sh, (((uint64_t)results->nb_packets_sent * (uint64_t)results->packet_size * (uint64_t)8 * (uint64_t)USEC_PER_SEC) / - ((uint64_t)results->client_time_in_us * 1000U)); + ((uint64_t)results->client_time_in_us * 1024U)); } else { client_rate_in_kbps = 0U; } @@ -884,7 +884,7 @@ static int shell_cmd_upload(const struct shell *sh, size_t argc, if (argc > 5) { param.rate_kbps = - (parse_number(argv[start + 5], K, K_UNIT) + 999) / 1000; + (parse_number(argv[start + 5], K, K_UNIT) + 1023) / 1024; } else { param.rate_kbps = 10U; } @@ -1035,7 +1035,7 @@ static int shell_cmd_upload2(const struct shell *sh, size_t argc, if (argc > 4) { param.rate_kbps = - (parse_number(argv[start + 4], K, K_UNIT) + 999) / 1000; + (parse_number(argv[start + 4], K, K_UNIT) + 1023) / 1024; } else { param.rate_kbps = 10U; } @@ -1108,7 +1108,7 @@ static void tcp_session_cb(enum zperf_status status, rate_in_kbps = (uint32_t) (((uint64_t)result->total_len * 8ULL * (uint64_t)USEC_PER_SEC) / - ((uint64_t)result->time_in_us * 1000ULL)); + ((uint64_t)result->time_in_us * 1024ULL)); } else { rate_in_kbps = 0U; } From 24f44171b751b76958eabc5841ab1ab5ba66fc85 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:04 +0100 Subject: [PATCH 0961/2300] Revert "[nrf fromtree] net: zperf: Convert UDP receiver to use socket services" This reverts commit de4a8e3562b5d27910bf302df3cf914e0439f6b3. Signed-off-by: Robert Lubos --- subsys/net/lib/zperf/zperf_common.c | 1 + subsys/net/lib/zperf/zperf_internal.h | 1 + subsys/net/lib/zperf/zperf_udp_receiver.c | 177 +++++++++++----------- 3 files changed, 93 insertions(+), 86 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_common.c b/subsys/net/lib/zperf/zperf_common.c index 89224b691ca..3a2674dc05c 100644 --- a/subsys/net/lib/zperf/zperf_common.c +++ b/subsys/net/lib/zperf/zperf_common.c @@ -222,6 +222,7 @@ static int zperf_init(void) zperf_udp_uploader_init(); zperf_tcp_uploader_init(); + zperf_udp_receiver_init(); zperf_session_init(); diff --git a/subsys/net/lib/zperf/zperf_internal.h b/subsys/net/lib/zperf/zperf_internal.h index b8cdb84cbbf..6fdb545cdd2 100644 --- a/subsys/net/lib/zperf/zperf_internal.h +++ b/subsys/net/lib/zperf/zperf_internal.h @@ -103,6 +103,7 @@ uint32_t zperf_packet_duration(uint32_t packet_size, uint32_t rate_in_kbps); void zperf_async_work_submit(struct k_work *work); void zperf_udp_uploader_init(void); void zperf_tcp_uploader_init(void); +void zperf_udp_receiver_init(void); void zperf_shell_init(void); diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index ba44590c621..75a0b35b234 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -13,7 +13,6 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); #include #include -#include #include #include "zperf_internal.h" @@ -26,6 +25,14 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); static struct sockaddr_in6 *in6_addr_my; static struct sockaddr_in *in4_addr_my; +#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE) +#define UDP_RECEIVER_THREAD_PRIORITY K_PRIO_COOP(8) +#else +#define UDP_RECEIVER_THREAD_PRIORITY K_PRIO_PREEMPT(8) +#endif + +#define UDP_RECEIVER_STACK_SIZE 2048 + #define SOCK_ID_IPV4 0 #define SOCK_ID_IPV6 1 #define SOCK_ID_MAX 2 @@ -33,6 +40,9 @@ static struct sockaddr_in *in4_addr_my; #define UDP_RECEIVER_BUF_SIZE 1500 #define POLL_TIMEOUT_MS 100 +static K_THREAD_STACK_DEFINE(udp_receiver_stack_area, UDP_RECEIVER_STACK_SIZE); +static struct k_thread udp_receiver_thread_data; + static zperf_callback udp_session_cb; static void *udp_user_data; static bool udp_server_running; @@ -41,13 +51,6 @@ static uint16_t udp_server_port; static struct sockaddr udp_server_addr; static K_SEM_DEFINE(udp_server_run, 0, 1); -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, - SOCK_ID_MAX); - static inline void build_reply(struct zperf_udp_datagram *hdr, struct zperf_server_hdr *stat, uint8_t *buf) @@ -227,79 +230,10 @@ static void udp_received(int sock, const struct sockaddr *addr, uint8_t *data, } } -static int udp_recv_data(struct net_socket_service_event *pev) +static void udp_server_session(void) { static uint8_t buf[UDP_RECEIVER_BUF_SIZE]; - int i, ret = 0; - int family; - struct sockaddr addr; - socklen_t optlen = sizeof(int); - socklen_t addrlen = sizeof(addr); - - if (udp_server_stop) { - ret = -ENOENT; - goto cleanup; - } - - if ((pev->event.revents & ZSOCK_POLLERR) || - (pev->event.revents & ZSOCK_POLLNVAL)) { - (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, - SO_DOMAIN, &family, &optlen); - NET_ERR("UDP receiver IPv%d socket error", - family == AF_INET ? 4 : 6); - goto error; - } - - if (!(pev->event.revents & ZSOCK_POLLIN)) { - return 0; - } - - ret = zsock_recvfrom(pev->event.fd, buf, sizeof(buf), 0, - &addr, &addrlen); - if (ret < 0) { - (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, - SO_DOMAIN, &family, &optlen); - NET_ERR("recv failed on IPv%d socket (%d)", - family == AF_INET ? 4 : 6, errno); - goto error; - } - - udp_received(pev->event.fd, &addr, buf, ret); - - return ret; - -error: - if (udp_session_cb != NULL) { - udp_session_cb(ZPERF_SESSION_ERROR, NULL, udp_user_data); - } - -cleanup: - for (i = 0; i < ARRAY_SIZE(fds); i++) { - if (fds[i].fd >= 0) { - zsock_close(fds[i].fd); - fds[i].fd = -1; - } - } - - (void)net_socket_service_unregister(&svc_udp); - - return ret; -} - -static void udp_svc_handler(struct k_work *work) -{ - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); - int ret; - - ret = udp_recv_data(pev); - if (ret < 0) { - (void)net_socket_service_unregister(&svc_udp); - } -} - -static void zperf_udp_receiver_init(void) -{ + struct zsock_pollfd fds[SOCK_ID_MAX] = { 0 }; int ret; for (int i = 0; i < ARRAY_SIZE(fds); i++) { @@ -407,14 +341,87 @@ static void zperf_udp_receiver_init(void) NET_INFO("Listening on port %d", udp_server_port); - ret = net_socket_service_register(&svc_udp, fds, - ARRAY_SIZE(fds), NULL); - if (ret < 0) { - LOG_ERR("Cannot register socket service handler (%d)", ret); + while (true) { + ret = zsock_poll(fds, ARRAY_SIZE(fds), POLL_TIMEOUT_MS); + if (ret < 0) { + NET_ERR("UDP receiver poll error (%d)", errno); + goto error; + } + + if (udp_server_stop) { + goto cleanup; + } + + if (ret == 0) { + continue; + } + + for (int i = 0; i < ARRAY_SIZE(fds); i++) { + struct sockaddr addr; + socklen_t addrlen = sizeof(addr); + + if ((fds[i].revents & ZSOCK_POLLERR) || + (fds[i].revents & ZSOCK_POLLNVAL)) { + NET_ERR("UDP receiver IPv%d socket error", + (i == SOCK_ID_IPV4) ? 4 : 6); + goto error; + } + + if (!(fds[i].revents & ZSOCK_POLLIN)) { + continue; + } + + ret = zsock_recvfrom(fds[i].fd, buf, sizeof(buf), 0, + &addr, &addrlen); + if (ret < 0) { + NET_ERR("recv failed on IPv%d socket (%d)", + (i == SOCK_ID_IPV4) ? 4 : 6, errno); + goto error; + } + + udp_received(fds[i].fd, &addr, buf, ret); + } } error: - return; + if (udp_session_cb != NULL) { + udp_session_cb(ZPERF_SESSION_ERROR, NULL, udp_user_data); + } + +cleanup: + for (int i = 0; i < ARRAY_SIZE(fds); i++) { + if (fds[i].fd >= 0) { + zsock_close(fds[i].fd); + } + } +} + +static void udp_receiver_thread(void *ptr1, void *ptr2, void *ptr3) +{ + ARG_UNUSED(ptr1); + ARG_UNUSED(ptr2); + ARG_UNUSED(ptr3); + + while (true) { + k_sem_take(&udp_server_run, K_FOREVER); + + udp_server_session(); + + udp_server_running = false; + } +} + +void zperf_udp_receiver_init(void) +{ + k_thread_create(&udp_receiver_thread_data, + udp_receiver_stack_area, + K_THREAD_STACK_SIZEOF(udp_receiver_stack_area), + udp_receiver_thread, + NULL, NULL, NULL, + UDP_RECEIVER_THREAD_PRIORITY, + IS_ENABLED(CONFIG_USERSPACE) ? K_USER | + K_INHERIT_PERMS : 0, + K_NO_WAIT); } int zperf_udp_download(const struct zperf_download_params *param, @@ -435,8 +442,6 @@ int zperf_udp_download(const struct zperf_download_params *param, udp_server_stop = false; memcpy(&udp_server_addr, ¶m->addr, sizeof(struct sockaddr)); - zperf_udp_receiver_init(); - k_sem_give(&udp_server_run); return 0; From f10c11a0a9c6df0deaef6bb501184899cf8d42b1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:04 +0100 Subject: [PATCH 0962/2300] Revert "[nrf fromtree] net: zperf: Convert TCP receiver to use socket services" This reverts commit 439aad97defd163c6134996bdb5e6fa8f2987ea4. Signed-off-by: Robert Lubos --- subsys/net/lib/zperf/Kconfig | 1 - subsys/net/lib/zperf/zperf_common.c | 1 + subsys/net/lib/zperf/zperf_internal.h | 1 + subsys/net/lib/zperf/zperf_tcp_receiver.c | 302 +++++++++++----------- 4 files changed, 148 insertions(+), 157 deletions(-) diff --git a/subsys/net/lib/zperf/Kconfig b/subsys/net/lib/zperf/Kconfig index 0cb637f376e..204144a805b 100644 --- a/subsys/net/lib/zperf/Kconfig +++ b/subsys/net/lib/zperf/Kconfig @@ -5,7 +5,6 @@ menuconfig NET_ZPERF bool "zperf shell utility" select NET_CONTEXT_RCVTIMEO if NET_NATIVE_UDP - select NET_SOCKETS_SERVICE help This option enables zperf shell utility, which allows to generate network traffic and evaluate network bandwidth. diff --git a/subsys/net/lib/zperf/zperf_common.c b/subsys/net/lib/zperf/zperf_common.c index 3a2674dc05c..4bc675ed45e 100644 --- a/subsys/net/lib/zperf/zperf_common.c +++ b/subsys/net/lib/zperf/zperf_common.c @@ -223,6 +223,7 @@ static int zperf_init(void) zperf_udp_uploader_init(); zperf_tcp_uploader_init(); zperf_udp_receiver_init(); + zperf_tcp_receiver_init(); zperf_session_init(); diff --git a/subsys/net/lib/zperf/zperf_internal.h b/subsys/net/lib/zperf/zperf_internal.h index 6fdb545cdd2..592424a9446 100644 --- a/subsys/net/lib/zperf/zperf_internal.h +++ b/subsys/net/lib/zperf/zperf_internal.h @@ -104,6 +104,7 @@ void zperf_async_work_submit(struct k_work *work); void zperf_udp_uploader_init(void); void zperf_tcp_uploader_init(void); void zperf_udp_receiver_init(void); +void zperf_tcp_receiver_init(void); void zperf_shell_init(void); diff --git a/subsys/net/lib/zperf/zperf_tcp_receiver.c b/subsys/net/lib/zperf/zperf_tcp_receiver.c index c782124e36b..344d34fe98c 100644 --- a/subsys/net/lib/zperf/zperf_tcp_receiver.c +++ b/subsys/net/lib/zperf/zperf_tcp_receiver.c @@ -14,7 +14,6 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); #include #include -#include #include #include "zperf_internal.h" @@ -24,11 +23,23 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); #define NET_LOG_ENABLED 1 #include "net_private.h" +#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE) +#define TCP_RECEIVER_THREAD_PRIORITY K_PRIO_COOP(8) +#else +#define TCP_RECEIVER_THREAD_PRIORITY K_PRIO_PREEMPT(8) +#endif + +#define TCP_RECEIVER_STACK_SIZE 2048 + #define SOCK_ID_IPV4_LISTEN 0 #define SOCK_ID_IPV6_LISTEN 1 #define SOCK_ID_MAX (CONFIG_NET_ZPERF_MAX_SESSIONS + 2) #define TCP_RECEIVER_BUF_SIZE 1500 +#define POLL_TIMEOUT_MS 100 + +static K_THREAD_STACK_DEFINE(tcp_receiver_stack_area, TCP_RECEIVER_STACK_SIZE); +static struct k_thread tcp_receiver_thread_data; static zperf_callback tcp_session_cb; static void *tcp_user_data; @@ -38,14 +49,6 @@ static uint16_t tcp_server_port; static struct sockaddr tcp_server_addr; static K_SEM_DEFINE(tcp_server_run, 0, 1); -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); - -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_tcp, NULL, tcp_svc_handler, - SOCK_ID_MAX); - static void tcp_received(const struct sockaddr *addr, size_t datalen) { struct session *session; @@ -96,143 +99,6 @@ static void tcp_received(const struct sockaddr *addr, size_t datalen) } } -static void tcp_session_error_report(void) -{ - if (tcp_session_cb != NULL) { - tcp_session_cb(ZPERF_SESSION_ERROR, NULL, tcp_user_data); - } -} - -static int tcp_recv_data(struct net_socket_service_event *pev) -{ - static uint8_t buf[TCP_RECEIVER_BUF_SIZE]; - int i, ret = 0; - int family, sock; - struct sockaddr addr_incoming_conn; - socklen_t optlen = sizeof(int); - socklen_t addrlen = sizeof(struct sockaddr); - - if (tcp_server_stop) { - ret = -ENOENT; - goto cleanup; - } - - if ((pev->event.revents & ZSOCK_POLLERR) || - (pev->event.revents & ZSOCK_POLLNVAL)) { - (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, - SO_DOMAIN, &family, &optlen); - NET_ERR("TCP receiver IPv%d socket error", - family == AF_INET ? 4 : 6); - goto error; - } - - if (!(pev->event.revents & ZSOCK_POLLIN)) { - return 0; - } - - /* What is the index to first accepted socket */ - i = SOCK_ID_IPV6_LISTEN + 1; - - /* Check first if we need to accept a connection */ - if (fds[SOCK_ID_IPV4_LISTEN].fd == pev->event.fd || - fds[SOCK_ID_IPV6_LISTEN].fd == pev->event.fd) { - sock = zsock_accept(pev->event.fd, - &addr_incoming_conn, - &addrlen); - if (sock < 0) { - (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, - SO_DOMAIN, &family, &optlen); - NET_ERR("TCP receiver IPv%d accept error", - family == AF_INET ? 4 : 6); - goto error; - } - - for (; i < SOCK_ID_MAX; i++) { - if (fds[i].fd < 0) { - break; - } - } - - if (i == SOCK_ID_MAX) { - /* Too many connections. */ - NET_ERR("Dropping TCP connection, reached maximum limit."); - zsock_close(sock); - } else { - fds[i].fd = sock; - fds[i].events = ZSOCK_POLLIN; - memcpy(&sock_addr[i], &addr_incoming_conn, addrlen); - - (void)net_socket_service_register(&svc_tcp, fds, - ARRAY_SIZE(fds), - NULL); - } - - } else { - ret = zsock_recv(pev->event.fd, buf, sizeof(buf), 0); - if (ret < 0) { - (void)zsock_getsockopt(pev->event.fd, SOL_SOCKET, - SO_DOMAIN, &family, &optlen); - NET_ERR("recv failed on IPv%d socket (%d)", - family == AF_INET ? 4 : 6, - errno); - tcp_session_error_report(); - /* This will close the zperf session */ - ret = 0; - } - - for (; i < SOCK_ID_MAX; i++) { - if (fds[i].fd == pev->event.fd) { - break; - } - } - - if (i == SOCK_ID_MAX) { - NET_ERR("Descriptor %d not found.", pev->event.fd); - } else { - tcp_received(&sock_addr[i], ret); - if (ret == 0) { - zsock_close(fds[i].fd); - fds[i].fd = -1; - memset(&sock_addr[i], 0, sizeof(struct sockaddr)); - - (void)net_socket_service_register(&svc_tcp, fds, - ARRAY_SIZE(fds), - NULL); - } - } - } - - return ret; - -error: - tcp_session_error_report(); - -cleanup: - for (i = 0; i < ARRAY_SIZE(fds); i++) { - if (fds[i].fd >= 0) { - zsock_close(fds[i].fd); - fds[i].fd = -1; - memset(&sock_addr[i], 0, sizeof(struct sockaddr)); - } - } - - (void)net_socket_service_unregister(&svc_tcp); - - return ret; -} - -static void tcp_svc_handler(struct k_work *work) -{ - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); - int ret; - - ret = tcp_recv_data(pev); - if (ret < 0) { - (void)net_socket_service_unregister(&svc_tcp); - } -} - static int tcp_bind_listen_connection(struct zsock_pollfd *pollfd, struct sockaddr *address) { @@ -248,14 +114,14 @@ static int tcp_bind_listen_connection(struct zsock_pollfd *pollfd, ret = zsock_bind(pollfd->fd, address, sizeof(*address)); if (ret < 0) { NET_ERR("Cannot bind IPv%d TCP port %d (%d)", - address->sa_family == AF_INET ? 4 : 6, port, errno); + (address->sa_family == AF_INET ? 4 : 6), port, errno); goto out; } ret = zsock_listen(pollfd->fd, 1); if (ret < 0) { NET_ERR("Cannot listen IPv%d TCP (%d)", - address->sa_family == AF_INET ? 4 : 6, errno); + (address->sa_family == AF_INET ? 4 : 6), errno); goto out; } @@ -265,8 +131,18 @@ static int tcp_bind_listen_connection(struct zsock_pollfd *pollfd, return ret; } -static void zperf_tcp_receiver_init(void) +static void tcp_session_error_report(void) { + if (tcp_session_cb != NULL) { + tcp_session_cb(ZPERF_SESSION_ERROR, NULL, tcp_user_data); + } +} + +static void tcp_server_session(void) +{ + static uint8_t buf[TCP_RECEIVER_BUF_SIZE]; + static struct zsock_pollfd fds[SOCK_ID_MAX]; + static struct sockaddr sock_addr[SOCK_ID_MAX]; int ret; for (int i = 0; i < ARRAY_SIZE(fds); i++) { @@ -367,14 +243,130 @@ static void zperf_tcp_receiver_init(void) NET_INFO("Listening on port %d", tcp_server_port); - ret = net_socket_service_register(&svc_tcp, fds, - ARRAY_SIZE(fds), NULL); - if (ret < 0) { - LOG_ERR("Cannot register socket service handler (%d)", ret); + while (true) { + ret = zsock_poll(fds, ARRAY_SIZE(fds), POLL_TIMEOUT_MS); + if (ret < 0) { + NET_ERR("TCP receiver poll error (%d)", errno); + goto error; + } + + if (tcp_server_stop) { + goto cleanup; + } + + if (ret == 0) { + continue; + } + + for (int i = 0; i < ARRAY_SIZE(fds); i++) { + if ((fds[i].revents & ZSOCK_POLLERR) || + (fds[i].revents & ZSOCK_POLLNVAL)) { + NET_ERR("TCP receiver IPv%d socket error", + (sock_addr[i].sa_family == AF_INET + ? 4 : 6)); + goto error; + } + + if (!(fds[i].revents & ZSOCK_POLLIN)) { + continue; + } + + if ((i >= SOCK_ID_IPV4_LISTEN) && (i <= SOCK_ID_IPV6_LISTEN)) { + int j = SOCK_ID_IPV6_LISTEN + 1; + struct sockaddr addr_incoming_conn; + socklen_t addrlen = sizeof(struct sockaddr); + int sock = zsock_accept(fds[i].fd, + &addr_incoming_conn, + &addrlen); + + if (sock < 0) { + NET_ERR("TCP receiver IPv%d accept error", + (sock_addr[i].sa_family == AF_INET + ? 4 : 6)); + goto error; + } + + for (; j < SOCK_ID_MAX; j++) { + if (fds[j].fd < 0) { + break; + } + } + + if (j == SOCK_ID_MAX) { + /* Too many connections. */ + NET_ERR("Dropping TCP connection, reached maximum limit."); + zsock_close(sock); + } else { + fds[j].fd = sock; + fds[j].events = ZSOCK_POLLIN; + memcpy(&sock_addr[j], + &addr_incoming_conn, + addrlen); + } + } else if ((i > SOCK_ID_IPV6_LISTEN) && (i < SOCK_ID_MAX)) { + ret = zsock_recv(fds[i].fd, buf, sizeof(buf), 0); + if (ret < 0) { + NET_ERR("recv failed on IPv%d socket (%d)", + (sock_addr[i].sa_family == AF_INET + ? 4 : 6), + errno); + tcp_session_error_report(); + /* This will close the zperf session */ + ret = 0; + } + + tcp_received(&sock_addr[i], ret); + + if (ret == 0) { + zsock_close(fds[i].fd); + fds[i].fd = -1; + memset(&sock_addr[i], 0, + sizeof(struct sockaddr)); + } + } else { + goto error; + } + } } error: - return; + tcp_session_error_report(); + +cleanup: + for (int i = 0; i < ARRAY_SIZE(fds); i++) { + if (fds[i].fd >= 0) { + zsock_close(fds[i].fd); + memset(&sock_addr[i], 0, sizeof(struct sockaddr)); + } + } +} + +void tcp_receiver_thread(void *ptr1, void *ptr2, void *ptr3) +{ + ARG_UNUSED(ptr1); + ARG_UNUSED(ptr2); + ARG_UNUSED(ptr3); + + while (true) { + k_sem_take(&tcp_server_run, K_FOREVER); + + tcp_server_session(); + + tcp_server_running = false; + } +} + +void zperf_tcp_receiver_init(void) +{ + k_thread_create(&tcp_receiver_thread_data, + tcp_receiver_stack_area, + K_THREAD_STACK_SIZEOF(tcp_receiver_stack_area), + tcp_receiver_thread, + NULL, NULL, NULL, + TCP_RECEIVER_THREAD_PRIORITY, + IS_ENABLED(CONFIG_USERSPACE) ? K_USER | + K_INHERIT_PERMS : 0, + K_NO_WAIT); } int zperf_tcp_download(const struct zperf_download_params *param, @@ -395,8 +387,6 @@ int zperf_tcp_download(const struct zperf_download_params *param, tcp_server_stop = false; memcpy(&tcp_server_addr, ¶m->addr, sizeof(struct sockaddr)); - zperf_tcp_receiver_init(); - k_sem_give(&tcp_server_run); return 0; From 7eb0063b5def512cbc10f348345c78b4004cafbc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:05 +0100 Subject: [PATCH 0963/2300] Revert "[nrf fromlist] net: dhcpv4_server: Apply range limits for Kconfig options" This reverts commit 9cd4f43a9b97cf696aff6405ede6c8f551aad4d5. Signed-off-by: Robert Lubos --- subsys/net/lib/dhcpv4/Kconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig index 34125b6066c..c8ca410d39c 100644 --- a/subsys/net/lib/dhcpv4/Kconfig +++ b/subsys/net/lib/dhcpv4/Kconfig @@ -37,7 +37,6 @@ config NET_DHCPV4_SERVER_ADDR_COUNT config NET_DHCPV4_SERVER_ADDR_LEASE_TIME int "Lease time for IPv4 addresses assigned by the server (seconds)" - range 0 4294967295 default 86400 help Lease time in seconds for IPv4 addresses assigned by the server. @@ -46,7 +45,6 @@ config NET_DHCPV4_SERVER_ADDR_LEASE_TIME config NET_DHCPV4_SERVER_ADDR_DECLINE_TIME int "The time IPv4 addresses remains blocked after conflict detection (seconds)" - range 0 4294967295 default 86400 help In case IPv4 address becomes blocked (either because of receiving @@ -58,7 +56,6 @@ config NET_DHCPV4_SERVER_ADDR_DECLINE_TIME config NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT int "Timeout for ICMP probes sent by the server (miliseconds)" - range 0 60000 default 1000 help DHCPv4 server will probe the offered IP address (send ICMP echo From cbab30b5ada943ef70d5842991c1bf2c591b81d6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:05 +0100 Subject: [PATCH 0964/2300] Revert "[nrf fromlist] net: dhcpv4_server: Improve declined addresses management" This reverts commit 7acbc8f4aca49662f04d3f7f8cf405a1cd3828da. Signed-off-by: Robert Lubos --- subsys/net/lib/dhcpv4/Kconfig | 11 --------- subsys/net/lib/dhcpv4/dhcpv4_server.c | 34 ++------------------------- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig index c8ca410d39c..8ae65344f31 100644 --- a/subsys/net/lib/dhcpv4/Kconfig +++ b/subsys/net/lib/dhcpv4/Kconfig @@ -43,17 +43,6 @@ config NET_DHCPV4_SERVER_ADDR_LEASE_TIME The lease time determines when the IPv4 address lease expires if the client does not renew it. -config NET_DHCPV4_SERVER_ADDR_DECLINE_TIME - int "The time IPv4 addresses remains blocked after conflict detection (seconds)" - default 86400 - help - In case IPv4 address becomes blocked (either because of receiving - Decline message or due to ICMP probe detecting conflict), the address - can no longer be assigned. This timeout specifies how long the address - remains in the Declined state. - Note, that the server may try to reuse the oldest declined address in - case it runs out of free addresses to assign. - config NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT int "Timeout for ICMP probes sent by the server (miliseconds)" default 1000 diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c index fdaab75c950..e683fdf5f0e 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4_server.c +++ b/subsys/net/lib/dhcpv4/dhcpv4_server.c @@ -33,7 +33,6 @@ LOG_MODULE_REGISTER(net_dhcpv4_server, CONFIG_NET_DHCPV4_SERVER_LOG_LEVEL); #define ADDRESS_RESERVED_TIMEOUT K_SECONDS(5) #define ADDRESS_PROBE_TIMEOUT K_MSEC(CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT) -#define ADDRESS_DECLINED_TIMEOUT K_SECONDS(CONFIG_NET_DHCPV4_SERVER_ADDR_DECLINE_TIME) #if (CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT > 0) #define DHCPV4_SERVER_ICMP_PROBE 1 @@ -81,8 +80,7 @@ static void dhcpv4_server_timeout_recalc(struct dhcpv4_server_ctx *ctx) struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; if (slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED || - slot->state == DHCPV4_SERVER_ADDR_DECLINED) { + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) { if (sys_timepoint_cmp(slot->expiry, next) < 0) { next = slot->expiry; } @@ -740,7 +738,6 @@ static int echo_reply_handler(struct net_icmp_ctx *icmp_ctx, net_sprint_ipv4_addr(&probe_ctx->slot->addr)); probe_ctx->slot->state = DHCPV4_SERVER_ADDR_DECLINED; - probe_ctx->slot->expiry = sys_timepoint_calc(ADDRESS_DECLINED_TIMEOUT); /* Try to find next free address */ for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { @@ -936,27 +933,6 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, } } - /* In case no free address slot was found, as a last resort, try to - * reuse the oldest declined entry, if present. - */ - if (selected == NULL) { - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (slot->state != DHCPV4_SERVER_ADDR_DECLINED) { - continue; - } - - /* Find first to expire (oldest) entry. */ - if ((selected == NULL) || - (sys_timepoint_cmp(slot->expiry, - selected->expiry) < 0)) { - selected = slot; - probe = true; - } - } - } - if (selected == NULL) { LOG_ERR("No free address found in address pool"); } else { @@ -1214,8 +1190,7 @@ static void dhcpv4_handle_decline(struct dhcpv4_server_ctx *ctx, (slot->state == DHCPV4_SERVER_ADDR_RESERVED || slot->state == DHCPV4_SERVER_ADDR_ALLOCATED)) { slot->state = DHCPV4_SERVER_ADDR_DECLINED; - slot->expiry = - sys_timepoint_calc(ADDRESS_DECLINED_TIMEOUT); + slot->expiry = sys_timepoint_calc(K_FOREVER); dhcpv4_server_timeout_recalc(ctx); break; } @@ -1305,11 +1280,6 @@ static void dhcpv4_server_timeout(struct k_work *work) slot->state = DHCPV4_SERVER_ADDR_FREE; } } - - if (slot->state == DHCPV4_SERVER_ADDR_DECLINED && - sys_timepoint_expired(slot->expiry)) { - slot->state = DHCPV4_SERVER_ADDR_FREE; - } } dhcpv4_server_timeout_recalc(ctx); From 77dddcb9de54de38b09cbc6f614d58f457b2e3ff Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:05 +0100 Subject: [PATCH 0965/2300] Revert "[nrf fromtree] net: dhcpv4_server: Implement ICMP probing of offered addresses" This reverts commit 552225970ec2a7253cce0f818056465925f5fab1. Signed-off-by: Robert Lubos --- subsys/net/lib/dhcpv4/Kconfig | 8 - subsys/net/lib/dhcpv4/dhcpv4_server.c | 251 ++------------------------ 2 files changed, 18 insertions(+), 241 deletions(-) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig index 8ae65344f31..801d536a5a1 100644 --- a/subsys/net/lib/dhcpv4/Kconfig +++ b/subsys/net/lib/dhcpv4/Kconfig @@ -43,12 +43,4 @@ config NET_DHCPV4_SERVER_ADDR_LEASE_TIME The lease time determines when the IPv4 address lease expires if the client does not renew it. -config NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT - int "Timeout for ICMP probes sent by the server (miliseconds)" - default 1000 - help - DHCPv4 server will probe the offered IP address (send ICMP echo - request) and wait for the time specific by this config before offering - the address. If set to 0, ICMP probing will be disabled. - endif # NET_DHCPV4_SERVER diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c index e683fdf5f0e..5940c8ca207 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4_server.c +++ b/subsys/net/lib/dhcpv4/dhcpv4_server.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -32,29 +31,10 @@ LOG_MODULE_REGISTER(net_dhcpv4_server, CONFIG_NET_DHCPV4_SERVER_LOG_LEVEL); #define DHCPV4_OPTIONS_CLIENT_ID_MIN_SIZE 2 #define ADDRESS_RESERVED_TIMEOUT K_SECONDS(5) -#define ADDRESS_PROBE_TIMEOUT K_MSEC(CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT) - -#if (CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT > 0) -#define DHCPV4_SERVER_ICMP_PROBE 1 -#endif /* RFC 1497 [17] */ static const uint8_t magic_cookie[4] = { 0x63, 0x82, 0x53, 0x63 }; -#define DHCPV4_MAX_PARAMETERS_REQUEST_LEN 16 - -struct dhcpv4_parameter_request_list { - uint8_t list[DHCPV4_MAX_PARAMETERS_REQUEST_LEN]; - uint8_t count; -}; - -struct dhcpv4_server_probe_ctx { - struct net_icmp_ctx icmp_ctx; - struct dhcp_msg discovery; - struct dhcpv4_parameter_request_list params; - struct dhcpv4_addr_slot *slot; -}; - struct dhcpv4_server_ctx { struct net_if *iface; int sock; @@ -62,15 +42,19 @@ struct dhcpv4_server_ctx { struct dhcpv4_addr_slot addr_pool[CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT]; struct in_addr server_addr; struct in_addr netmask; -#if defined(DHCPV4_SERVER_ICMP_PROBE) - struct dhcpv4_server_probe_ctx probe_ctx; -#endif }; static struct dhcpv4_server_ctx server_ctx[CONFIG_NET_DHCPV4_SERVER_INSTANCES]; static struct zsock_pollfd fds[CONFIG_NET_DHCPV4_SERVER_INSTANCES]; static K_MUTEX_DEFINE(server_lock); +#define DHCPV4_MAX_PARAMETERS_REQUEST_LEN 16 + +struct dhcpv4_parameter_request_list { + uint8_t list[DHCPV4_MAX_PARAMETERS_REQUEST_LEN]; + uint8_t count; +}; + static void dhcpv4_server_timeout_recalc(struct dhcpv4_server_ctx *ctx) { k_timepoint_t next = sys_timepoint_calc(K_FOREVER); @@ -683,167 +667,6 @@ static uint32_t dhcpv4_get_lease_time(uint8_t *options, uint8_t optlen) return CONFIG_NET_DHCPV4_SERVER_ADDR_LEASE_TIME; } -#if defined(DHCPV4_SERVER_ICMP_PROBE) -static int dhcpv4_probe_address(struct dhcpv4_server_ctx *ctx, - struct dhcpv4_addr_slot *slot) -{ - struct sockaddr_in dest_addr = { - .sin_family = AF_INET, - .sin_addr = slot->addr, - }; - int ret; - - ret = net_icmp_send_echo_request(&ctx->probe_ctx.icmp_ctx, ctx->iface, - (struct sockaddr *)&dest_addr, - NULL, ctx); - if (ret < 0) { - LOG_ERR("Failed to send ICMP probe"); - } - - return ret; -} - -static int echo_reply_handler(struct net_icmp_ctx *icmp_ctx, - struct net_pkt *pkt, - struct net_icmp_ip_hdr *ip_hdr, - struct net_icmp_hdr *icmp_hdr, - void *user_data) -{ - struct dhcpv4_server_ctx *ctx = user_data; - struct dhcpv4_server_probe_ctx *probe_ctx = &ctx->probe_ctx; - struct dhcpv4_addr_slot *new_slot = NULL; - struct in_addr peer_addr; - - ARG_UNUSED(icmp_ctx); - ARG_UNUSED(pkt); - ARG_UNUSED(ip_hdr); - ARG_UNUSED(icmp_hdr); - - k_mutex_lock(&server_lock, K_FOREVER); - - if (probe_ctx->slot == NULL) { - goto out; - } - - if (ip_hdr->family != AF_INET) { - goto out; - } - - net_ipv4_addr_copy_raw((uint8_t *)&peer_addr, ip_hdr->ipv4->src); - if (!net_ipv4_addr_cmp(&peer_addr, &probe_ctx->slot->addr)) { - goto out; - } - - LOG_DBG("Got ICMP probe response, blocking address %s", - net_sprint_ipv4_addr(&probe_ctx->slot->addr)); - - probe_ctx->slot->state = DHCPV4_SERVER_ADDR_DECLINED; - - /* Try to find next free address */ - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (slot->state == DHCPV4_SERVER_ADDR_FREE) { - new_slot = slot; - break; - } - } - - if (new_slot == NULL) { - LOG_DBG("No more free addresses to assign, ICMP probing stopped"); - probe_ctx->slot = NULL; - dhcpv4_server_timeout_recalc(ctx); - goto out; - } - - if (dhcpv4_probe_address(ctx, new_slot) < 0) { - probe_ctx->slot = NULL; - dhcpv4_server_timeout_recalc(ctx); - goto out; - } - - new_slot->state = DHCPV4_SERVER_ADDR_RESERVED; - new_slot->expiry = sys_timepoint_calc(ADDRESS_PROBE_TIMEOUT); - new_slot->client_id.len = probe_ctx->slot->client_id.len; - memcpy(new_slot->client_id.buf, probe_ctx->slot->client_id.buf, - new_slot->client_id.len); - new_slot->lease_time = probe_ctx->slot->lease_time; - - probe_ctx->slot = new_slot; - - dhcpv4_server_timeout_recalc(ctx); - -out: - k_mutex_unlock(&server_lock); - - return 0; -} - -static int dhcpv4_server_probing_init(struct dhcpv4_server_ctx *ctx) -{ - return net_icmp_init_ctx(&ctx->probe_ctx.icmp_ctx, - NET_ICMPV4_ECHO_REPLY, 0, - echo_reply_handler); -} - -static void dhcpv4_server_probing_deinit(struct dhcpv4_server_ctx *ctx) -{ - (void)net_icmp_cleanup_ctx(&ctx->probe_ctx.icmp_ctx); -} - -static int dhcpv4_server_probe_setup(struct dhcpv4_server_ctx *ctx, - struct dhcpv4_addr_slot *slot, - struct dhcp_msg *msg, - struct dhcpv4_parameter_request_list *params) -{ - int ret; - - if (ctx->probe_ctx.slot != NULL) { - return -EBUSY; - } - - ret = dhcpv4_probe_address(ctx, slot); - if (ret < 0) { - return ret; - } - - ctx->probe_ctx.slot = slot; - ctx->probe_ctx.discovery = *msg; - ctx->probe_ctx.params = *params; - - return 0; -} - -static void dhcpv4_server_probe_timeout(struct dhcpv4_server_ctx *ctx, - struct dhcpv4_addr_slot *slot) -{ - /* Probe timer expired, send offer. */ - ctx->probe_ctx.slot = NULL; - - (void)net_arp_clear_pending(ctx->iface, &slot->addr); - - if (dhcpv4_send_offer(ctx, &ctx->probe_ctx.discovery, &slot->addr, - slot->lease_time, &ctx->probe_ctx.params) < 0) { - slot->state = DHCPV4_SERVER_ADDR_FREE; - return; - } - - slot->expiry = sys_timepoint_calc(ADDRESS_RESERVED_TIMEOUT); -} - -static bool dhcpv4_server_is_slot_probed(struct dhcpv4_server_ctx *ctx, - struct dhcpv4_addr_slot *slot) -{ - return (ctx->probe_ctx.slot == slot); -} -#else /* defined(DHCPV4_SERVER_ICMP_PROBE) */ -#define dhcpv4_server_probing_init(...) (0) -#define dhcpv4_server_probing_deinit(...) -#define dhcpv4_server_probe_setup(...) (-ENOTSUP) -#define dhcpv4_server_probe_timeout(...) -#define dhcpv4_server_is_slot_probed(...) (false) -#endif /* defined(DHCPV4_SERVER_ICMP_PROBE) */ - static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, struct dhcp_msg *msg, uint8_t *options, uint8_t optlen) @@ -851,7 +674,6 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, struct dhcpv4_parameter_request_list params = { 0 }; struct dhcpv4_addr_slot *selected = NULL; struct dhcpv4_client_id client_id; - bool probe = false; int ret; ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); @@ -874,12 +696,6 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, slot->client_id.len == client_id.len && memcmp(slot->client_id.buf, client_id.buf, client_id.len) == 0) { - if (slot->state == DHCPV4_SERVER_ADDR_RESERVED && - dhcpv4_server_is_slot_probed(ctx, slot)) { - LOG_DBG("ICMP probing in progress, ignore Discovery"); - return; - } - /* Got match in current bindings. */ selected = slot; break; @@ -904,7 +720,6 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, slot->state == DHCPV4_SERVER_ADDR_FREE) { /* Requested address is free. */ selected = slot; - probe = true; break; } } @@ -927,7 +742,6 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, if (slot->state == DHCPV4_SERVER_ADDR_FREE) { /* Requested address is free. */ selected = slot; - probe = true; break; } } @@ -938,26 +752,9 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, } else { uint32_t lease_time = dhcpv4_get_lease_time(options, optlen); - if (IS_ENABLED(DHCPV4_SERVER_ICMP_PROBE) && probe) { - if (dhcpv4_server_probe_setup(ctx, selected, - msg, ¶ms) < 0) { - /* Probing context already in use or failed to - * send probe, ignore Discovery for now and wait - * for retransmission. - */ - return; - } - - selected->expiry = - sys_timepoint_calc(ADDRESS_PROBE_TIMEOUT); - } else { - if (dhcpv4_send_offer(ctx, msg, &selected->addr, - lease_time, ¶ms) < 0) { - return; - } - - selected->expiry = - sys_timepoint_calc(ADDRESS_RESERVED_TIMEOUT); + if (dhcpv4_send_offer(ctx, msg, &selected->addr, lease_time, + ¶ms) < 0) { + return; } LOG_DBG("DHCPv4 processing Discover - reserved %s", @@ -967,6 +764,7 @@ static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, selected->client_id.len = client_id.len; memcpy(selected->client_id.buf, client_id.buf, client_id.len); selected->lease_time = lease_time; + selected->expiry = sys_timepoint_calc(ADDRESS_RESERVED_TIMEOUT); dhcpv4_server_timeout_recalc(ctx); } } @@ -1263,18 +1061,15 @@ static void dhcpv4_server_timeout(struct k_work *work) struct dhcpv4_server_ctx *ctx = CONTAINER_OF(dwork, struct dhcpv4_server_ctx, timeout_work); + k_mutex_lock(&server_lock, K_FOREVER); for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - if ((slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) && - sys_timepoint_expired(slot->expiry)) { - if (slot->state == DHCPV4_SERVER_ADDR_RESERVED && - dhcpv4_server_is_slot_probed(ctx, slot)) { - dhcpv4_server_probe_timeout(ctx, slot); - } else { + if (slot->state == DHCPV4_SERVER_ADDR_RESERVED || + slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) { + if (sys_timepoint_expired(slot->expiry)) { LOG_DBG("Address %s expired", net_sprint_ipv4_addr(&slot->addr)); slot->state = DHCPV4_SERVER_ADDR_FREE; @@ -1515,28 +1310,19 @@ int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr) &server_ctx[slot].addr_pool[i].addr)); } - ret = dhcpv4_server_probing_init(&server_ctx[slot]); - if (ret < 0) { - LOG_ERR("Failed to register probe handler, %d", ret); - goto cleanup; - } - ret = net_socket_service_register(&dhcpv4_server, fds, ARRAY_SIZE(fds), NULL); if (ret < 0) { LOG_ERR("Failed to register socket service, %d", ret); - dhcpv4_server_probing_deinit(&server_ctx[slot]); - goto cleanup; + memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); + fds[slot].fd = -1; + goto error; } k_mutex_unlock(&server_lock); return 0; -cleanup: - memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); - fds[slot].fd = -1; - error: if (sock >= 0) { (void)zsock_close(sock); @@ -1575,7 +1361,6 @@ int net_dhcpv4_server_stop(struct net_if *iface) fds[slot].fd = -1; (void)zsock_close(server_ctx[slot].sock); - dhcpv4_server_probing_deinit(&server_ctx[slot]); k_work_cancel_delayable_sync(&server_ctx[slot].timeout_work, &sync); memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); From ece8068b8a7570fad978efd207eae5ef7834b5a4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:05 +0100 Subject: [PATCH 0966/2300] Revert "[nrf fromtree] net: dhcpv4_server: Improve address pool range validation" This reverts commit db2ba28ebcef019afa8dd68f35ee4042e2e6874a. Signed-off-by: Robert Lubos --- subsys/net/lib/dhcpv4/dhcpv4_server.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c index 5940c8ca207..714d036ddde 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4_server.c +++ b/subsys/net/lib/dhcpv4/dhcpv4_server.c @@ -1224,13 +1224,6 @@ int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr) return -EINVAL; } - if ((htonl(server_addr->s_addr) >= htonl(base_addr->s_addr)) && - (htonl(server_addr->s_addr) < - htonl(base_addr->s_addr) + CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT)) { - LOG_ERR("Address pool overlaps with server address."); - return -EINVAL; - } - netmask = net_if_ipv4_get_netmask(iface); if (net_ipv4_is_addr_unspecified(&netmask)) { LOG_ERR("Failed to obtain subnet mask."); From 65da9b6e877523e6060df96705a9dce85d795f82 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:06 +0100 Subject: [PATCH 0967/2300] Revert "[nrf fromtree] Bluetooth: Shell: Fix cmd_chan_map" This reverts commit 2acdac654a6f288a5a888dd6a9cad84baf8880e2. Signed-off-by: Robert Lubos --- subsys/bluetooth/shell/bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index 3566e0f31b8..42c9f55455b 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -4626,7 +4626,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, SHELL_CMD_ARG(phy-update, NULL, " [rx_phy] [s2] [s8]", cmd_conn_phy_update, 2, 3), #endif -#if defined(CONFIG_BT_CENTRAL) || defined(CONFIG_BT_BROADCASTER) +#if defined(CONFIG_BT_CENTRAL) SHELL_CMD_ARG(channel-map, NULL, " (36-0)", cmd_chan_map, 2, 1), #endif /* CONFIG_BT_CENTRAL */ From fcf3f0859dbc25784e1457d907bd4593a645424f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:06 +0100 Subject: [PATCH 0968/2300] Revert "[nrf fromtree] Bluetooth: Host: Fix bt_le_set_chan_map" This reverts commit 4722e1323c926b1c03a96a0538ae80f41f71b180. Signed-off-by: Robert Lubos --- subsys/bluetooth/host/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index dbb79f3ecdd..ee1c822d9f9 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -4326,7 +4326,7 @@ int bt_le_set_chan_map(uint8_t chan_map[5]) struct bt_hci_cp_le_set_host_chan_classif *cp; struct net_buf *buf; - if (!(IS_ENABLED(CONFIG_BT_CENTRAL) || IS_ENABLED(CONFIG_BT_BROADCASTER))) { + if (!IS_ENABLED(CONFIG_BT_CENTRAL)) { return -ENOTSUP; } From 7d7e84b68cfcc6f06cb89f28e86b9f96dc88cb7f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:06 +0100 Subject: [PATCH 0969/2300] Revert "[nrf fromtree] Bluetooth: BAP: Fix uninitialized variable in source_reconfig" This reverts commit 4cc9561f155f892adfe05c9bba8b7f5e0d8304bf. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/bap_broadcast_source.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index 2167366c7e1..132578470d7 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -788,7 +788,7 @@ int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, for (size_t i = 0U; i < subgroup_param->params_count; i++) { struct bt_bap_stream *subgroup_stream; struct bt_bap_stream *param_stream; - bool stream_in_subgroup = false; + bool stream_in_subgroup; param_stream = subgroup_param->params[i].stream; From e16c35251c8f46277a539bcdbc4814b7afdb2cba Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:07 +0100 Subject: [PATCH 0970/2300] Revert "[nrf fromtree] Bluetooth: Audio: Fix len check in ltv_set_val" This reverts commit 2441a763cc74b4e45074a937c10ab9c28e8329ef. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/codec.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/audio/codec.c b/subsys/bluetooth/audio/codec.c index 3f5f2b56629..e376b71d1c3 100644 --- a/subsys/bluetooth/audio/codec.c +++ b/subsys/bluetooth/audio/codec.c @@ -142,8 +142,6 @@ static bool parse_cb(struct bt_data *data, void *user_data) static int ltv_set_val(struct net_buf_simple *buf, uint8_t type, const uint8_t *data, size_t data_len) { - size_t new_buf_len; - for (uint16_t i = 0U; i < buf->len;) { uint8_t *len = &buf->data[i++]; const uint8_t data_type = buf->data[i++]; @@ -209,12 +207,11 @@ static int ltv_set_val(struct net_buf_simple *buf, uint8_t type, const uint8_t * } /* If we reach here, we did not find the data in the buffer, so we simply add it */ - new_buf_len = buf->len + 1 /* len */ + sizeof(type) + data_len; - if (new_buf_len <= buf->size) { - net_buf_simple_add_u8(buf, data_len + sizeof(type)); /* len */ - net_buf_simple_add_u8(buf, type); /* type */ + if ((buf->len + data_len) <= buf->size) { + net_buf_simple_add_u8(buf, data_len + sizeof(type)); + net_buf_simple_add_u8(buf, type); if (data_len > 0) { - net_buf_simple_add_mem(buf, data, data_len); /* value */ + net_buf_simple_add_mem(buf, data, data_len); } } else { LOG_DBG("Cannot fit data_len %zu in codec_cfg with len %u and size %u", data_len, From efbcdde7bf804b3dfeadd68dd1e0b5d5da5fa67a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:07 +0100 Subject: [PATCH 0971/2300] Revert "[nrf fromtree] bluetooth: audio: broadcast: Fix missing update of meta_len" This reverts commit 4124a4d34649008d4a3ee544dcfa655938e7ebcb. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/bap_broadcast_source.c | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index 132578470d7..61ef7a1fe29 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -938,7 +938,6 @@ int bt_bap_broadcast_source_update_metadata(struct bt_bap_broadcast_source *sour SYS_SLIST_FOR_EACH_CONTAINER(&source->subgroups, subgroup, _node) { memset(subgroup->codec_cfg->meta, 0, sizeof(subgroup->codec_cfg->meta)); memcpy(subgroup->codec_cfg->meta, meta, meta_len); - subgroup->codec_cfg->meta_len = meta_len; } return 0; From b77dca8428fb7c2b8512a656ced3544bf79762a8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:07 +0100 Subject: [PATCH 0972/2300] Revert "[nrf fromtree] Bluetooth: audio: ascs: Remove spurious error message" This reverts commit b811f777a615a200a3898d1d94e64148f2b05df8. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/ascs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/audio/ascs.c b/subsys/bluetooth/audio/ascs.c index 4127b1a4ce4..1709bc452d8 100644 --- a/subsys/bluetooth/audio/ascs.c +++ b/subsys/bluetooth/audio/ascs.c @@ -945,6 +945,7 @@ static void ascs_iso_disconnected(struct bt_iso_chan *chan, uint8_t reason) struct bt_bap_iso *iso = CONTAINER_OF(chan, struct bt_bap_iso, chan); if (iso->rx.ep == NULL && iso->tx.ep == NULL) { + LOG_ERR("iso %p not bound with ep", chan); return; } From c3b09a08bde582cb006762c3445e42e6a12bb301 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:07 +0100 Subject: [PATCH 0973/2300] Revert "[nrf fromtree] Bluetooth: Audio: Moved seq_num check" This reverts commit 5f4b62a955eea0da96801ac6470e0f7caeaa2ec7. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/bap_stream.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index fd38a90371c..d6df9524e14 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -245,7 +245,6 @@ static bool bt_bap_stream_can_send(const struct bt_bap_stream *stream) int bt_bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf, uint16_t seq_num, uint32_t ts) { - int ret; struct bt_bap_ep *ep; if (stream == NULL || stream->ep == NULL) { @@ -266,12 +265,6 @@ int bt_bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf, return -EBADMSG; } - ret = bt_iso_chan_send(bt_bap_stream_iso_chan_get(stream), - buf, seq_num, ts); - if (ret) { - return ret; - } - #if defined(CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM) if (stream->_prev_seq_num != 0U && seq_num != 0U && (stream->_prev_seq_num + 1U) != seq_num) { @@ -284,7 +277,8 @@ int bt_bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf, /* TODO: Add checks for broadcast sink */ - return ret; + return bt_iso_chan_send(bt_bap_stream_iso_chan_get(stream), + buf, seq_num, ts); } int bt_bap_stream_get_tx_sync(struct bt_bap_stream *stream, struct bt_iso_tx_info *info) From 38afab81f7cd724056b49fd3d1452a423c5573f7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:07 +0100 Subject: [PATCH 0974/2300] Revert "[nrf fromtree] Bluetooth: Audio: Fix off-by-one error in codec.c:ltv_set_val" This reverts commit fa8d07affb466ab51369f327aab02bfc09421aff. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/codec.c | 4 +- tests/bluetooth/audio/codec/src/main.c | 111 +------------------------ 2 files changed, 3 insertions(+), 112 deletions(-) diff --git a/subsys/bluetooth/audio/codec.c b/subsys/bluetooth/audio/codec.c index e376b71d1c3..38b1ef7d22b 100644 --- a/subsys/bluetooth/audio/codec.c +++ b/subsys/bluetooth/audio/codec.c @@ -162,8 +162,8 @@ static int ltv_set_val(struct net_buf_simple *buf, uint8_t type, const uint8_t * if (value + value_len == buf->data + buf->len) { data_len_to_move = 0U; } else { - old_next_data_start = value + value_len; - new_next_data_start = value + data_len; + old_next_data_start = value + value_len + 1; + new_next_data_start = value + data_len + 1; data_len_to_move = buf->len - (old_next_data_start - buf->data); } diff --git a/tests/bluetooth/audio/codec/src/main.c b/tests/bluetooth/audio/codec/src/main.c index 3b909e4582f..386ef40e7f7 100644 --- a/tests/bluetooth/audio/codec/src/main.c +++ b/tests/bluetooth/audio/codec/src/main.c @@ -57,26 +57,6 @@ ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_get_freq) zassert_equal(ret, 0x03, "unexpected return value %d", ret); } -ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_set_val_new) -{ - struct bt_bap_lc3_preset preset = BT_BAP_LC3_UNICAST_PRESET_16_2_1( - BT_AUDIO_LOCATION_FRONT_LEFT, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED); - const uint8_t frame_blocks = 0x02; - int ret; - - /* Frame blocks are not part of the preset, so we can use that to test adding a new type to - * the config - */ - ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(&preset.codec_cfg, false); - zassert_equal(ret, -ENODATA, "Unexpected return value %d", ret); - - ret = bt_audio_codec_cfg_set_frame_blocks_per_sdu(&preset.codec_cfg, frame_blocks); - zassert_true(ret > 0, "Unexpected return value %d", ret); - - ret = bt_audio_codec_cfg_get_frame_blocks_per_sdu(&preset.codec_cfg, false); - zassert_equal(ret, frame_blocks, "Unexpected return value %d", ret); -} - ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_set_freq) { struct bt_bap_lc3_preset preset = BT_BAP_LC3_UNICAST_PRESET_16_2_1( @@ -391,7 +371,7 @@ ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_get_ccid_list) zassert_mem_equal(expected_data, ccid_list, ARRAY_SIZE(expected_data)); } -ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list_shorter) +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list) { const uint8_t expected_data[] = {0x05, 0x10, 0x15}; const uint8_t new_expected_data[] = {0x25, 0x30}; @@ -414,95 +394,6 @@ ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list_shorter zassert_mem_equal(new_expected_data, ccid_list, ARRAY_SIZE(new_expected_data)); } -ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list_longer) -{ - const uint8_t expected_data[] = {0x05, 0x10, 0x15}; - const uint8_t new_expected_data[] = {0x25, 0x30, 0x35, 0x40}; - 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_CCID_LIST, 0x05, 0x10, 0x15)}); - const uint8_t *ccid_list; - int ret; - - ret = bt_audio_codec_cfg_meta_get_ccid_list(&codec_cfg, &ccid_list); - zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); - zassert_mem_equal(expected_data, ccid_list, ARRAY_SIZE(expected_data)); - - ret = bt_audio_codec_cfg_meta_set_ccid_list(&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_ccid_list(&codec_cfg, &ccid_list); - zassert_equal(ret, ARRAY_SIZE(new_expected_data), "Unexpected return value %d", ret); - zassert_mem_equal(new_expected_data, ccid_list, ARRAY_SIZE(new_expected_data)); -} - -/* Providing multiple BT_AUDIO_CODEC_DATA to BT_AUDIO_CODEC_CFG without packing it in a macro - * cause compile issue, so define a macro to denote 2 types of data for the ccid_list_first tests - */ -#define DOUBLE_CFG_DATA \ - { \ - BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_CCID_LIST, 0x05, 0x10, 0x15), \ - BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_PARENTAL_RATING, \ - BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE) \ - } - -ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list_first_shorter) -{ - const uint8_t expected_data[] = {0x05, 0x10, 0x15}; - const uint8_t new_expected_data[] = {0x25, 0x30}; - struct bt_audio_codec_cfg codec_cfg = - BT_AUDIO_CODEC_CFG(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, {}, DOUBLE_CFG_DATA); - const uint8_t *ccid_list; - int ret; - - ret = bt_audio_codec_cfg_meta_get_ccid_list(&codec_cfg, &ccid_list); - zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); - zassert_mem_equal(expected_data, ccid_list, ARRAY_SIZE(expected_data)); - - ret = bt_audio_codec_cfg_meta_get_parental_rating(&codec_cfg); - zassert_equal(ret, 0x07, "Unexpected return value %d", ret); - - ret = bt_audio_codec_cfg_meta_set_ccid_list(&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_ccid_list(&codec_cfg, &ccid_list); - zassert_equal(ret, ARRAY_SIZE(new_expected_data), "Unexpected return value %d", ret); - zassert_mem_equal(new_expected_data, ccid_list, ARRAY_SIZE(new_expected_data)); - - ret = bt_audio_codec_cfg_meta_get_parental_rating(&codec_cfg); - zassert_equal(ret, 0x07, "Unexpected return value %d", ret); -} - -ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_ccid_list_first_longer) -{ - const uint8_t expected_data[] = {0x05, 0x10, 0x15}; - const uint8_t new_expected_data[] = {0x25, 0x30, 0x35, 0x40}; - struct bt_audio_codec_cfg codec_cfg = - BT_AUDIO_CODEC_CFG(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, {}, DOUBLE_CFG_DATA); - const uint8_t *ccid_list; - int ret; - - ret = bt_audio_codec_cfg_meta_get_ccid_list(&codec_cfg, &ccid_list); - zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); - zassert_mem_equal(expected_data, ccid_list, ARRAY_SIZE(expected_data)); - - ret = bt_audio_codec_cfg_meta_get_parental_rating(&codec_cfg); - zassert_equal(ret, 0x07, "Unexpected return value %d", ret); - - ret = bt_audio_codec_cfg_meta_set_ccid_list(&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_ccid_list(&codec_cfg, &ccid_list); - zassert_equal(ret, ARRAY_SIZE(new_expected_data), "Unexpected return value %d", ret); - zassert_mem_equal(new_expected_data, ccid_list, ARRAY_SIZE(new_expected_data)); - - ret = bt_audio_codec_cfg_meta_get_parental_rating(&codec_cfg); - zassert_equal(ret, 0x07, "Unexpected return value %d", ret); -} - ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_get_parental_rating) { const struct bt_audio_codec_cfg codec_cfg = From f53a30f1b97cdcf849f5f04edc4814a7e9c6ec9c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:08 +0100 Subject: [PATCH 0975/2300] Revert "[nrf fromtree] Bluetooth: BAP: Add missing reset of client on disconnected" This reverts commit 9f098f8a51736bbb000d7ecf3e49df9caefceb67. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/bap_unicast_client.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 7cbde2464c2..45523e003d4 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -2055,7 +2055,6 @@ static void unicast_client_reset(struct bt_bap_ep *ep, uint8_t reason) static void unicast_client_ep_reset(struct bt_conn *conn, uint8_t reason) { - struct unicast_client *client; uint8_t index; LOG_DBG("conn %p", conn); @@ -2077,11 +2076,6 @@ static void unicast_client_ep_reset(struct bt_conn *conn, uint8_t reason) unicast_client_reset(ep, reason); } #endif /* CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0 */ - - client = &uni_cli_insts[index]; - client->busy = false; - client->dir = 0U; - reset_att_buf(client); } static void bt_audio_codec_qos_to_cig_param(struct bt_iso_cig_param *cig_param, From 493d3bde1e5024c383d25016fcf488ab2a42e391 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:08 +0100 Subject: [PATCH 0976/2300] Revert "[nrf fromtree] Bluetooth: BAP: client: Add support for source ASEs disconnects" This reverts commit 8e3387de2f54ec21db9782e3967d30da3f09a132. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/bap_unicast_client.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 45523e003d4..36938129773 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -1016,8 +1016,6 @@ static void unicast_client_ep_set_status(struct bt_bap_ep *ep, struct net_buf_si case BT_BAP_EP_STATE_CODEC_CONFIGURED: /* or 0x02 (QoS Configured) */ case BT_BAP_EP_STATE_QOS_CONFIGURED: - /* or 0x04 (Streaming) if there is a disconnect */ - case BT_BAP_EP_STATE_STREAMING: /* or 0x05 (Disabling) */ case BT_BAP_EP_STATE_DISABLING: break; From 93571773809897f6271a598233c0cd12fc78f290 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:08 +0100 Subject: [PATCH 0977/2300] Revert "[nrf fromtree] Bluetooth: BAP: Stop broadcast sink from removing receive state" This reverts commit e0f4b70201e7f7e1bbe16600e51e263cef32c3bb. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/bap_broadcast_sink.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subsys/bluetooth/audio/bap_broadcast_sink.c b/subsys/bluetooth/audio/bap_broadcast_sink.c index ceafaf6389c..aa4bc08f761 100644 --- a/subsys/bluetooth/audio/bap_broadcast_sink.c +++ b/subsys/bluetooth/audio/bap_broadcast_sink.c @@ -798,6 +798,17 @@ static void broadcast_sink_cleanup_streams(struct bt_bap_broadcast_sink *sink) static void broadcast_sink_cleanup(struct bt_bap_broadcast_sink *sink) { + if (atomic_test_bit(sink->flags, + BT_BAP_BROADCAST_SINK_FLAG_SRC_ID_VALID)) { + int err; + + err = bt_bap_scan_delegator_rem_src(sink->bass_src_id); + if (err != 0) { + /* This is likely due to the receive state been removed */ + LOG_DBG("Could not remove Receive State for sink %p: %d", sink, err); + } + } + if (sink->stream_count > 0U) { broadcast_sink_cleanup_streams(sink); } From 198a886580950319c92ca6ea53093dd41fcbd306 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:08 +0100 Subject: [PATCH 0978/2300] Revert "[nrf fromtree] Bluetooth: BAP: Do not send PA term request on local remove" This reverts commit 73f47f2b91f132357c60a7ff6b1a1fb81d5fdf52. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/bap_scan_delegator.c | 5 ++--- tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c | 7 ------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/subsys/bluetooth/audio/bap_scan_delegator.c b/subsys/bluetooth/audio/bap_scan_delegator.c index 41f77391a68..3cef96bd1b8 100644 --- a/subsys/bluetooth/audio/bap_scan_delegator.c +++ b/subsys/bluetooth/audio/bap_scan_delegator.c @@ -863,9 +863,8 @@ static int scan_delegator_rem_src(struct bt_conn *conn, state = &internal_state->state; - /* If conn == NULL then it's a local operation and we do not need to ask the application */ - if (conn != NULL && (state->pa_sync_state == BT_BAP_PA_STATE_INFO_REQ || - state->pa_sync_state == BT_BAP_PA_STATE_SYNCED)) { + if (state->pa_sync_state == BT_BAP_PA_STATE_INFO_REQ || + state->pa_sync_state == BT_BAP_PA_STATE_SYNCED) { int err; /* Terminate PA sync */ 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 81d3ed7ec2b..8827a06bc93 100644 --- a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c @@ -616,13 +616,6 @@ static void remove_all_sources(void) printk("[%zu]: Source removed with id %u\n", i, state->src_id); - - printk("Terminating PA sync\n"); - err = pa_sync_term(state); - if (err) { - FAIL("[%zu]: PA sync term failed (err %d)\n", err); - return; - } } } } From 2fa24a1eed4c41355121e6d9b8518081369cd4e6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:08 +0100 Subject: [PATCH 0979/2300] Revert "[nrf fromtree] Bluetooth: BAP: Broadcast source enabling state transition fix" This reverts commit 79340c129a3137bf25177546147aabd2c8beda03. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/bap_broadcast_source.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index 61ef7a1fe29..33fd1f0e17d 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -86,7 +86,7 @@ static void broadcast_source_set_ep_state(struct bt_bap_ep *ep, uint8_t state) } break; case BT_BAP_EP_STATE_ENABLING: - if (state != BT_BAP_EP_STATE_STREAMING && state != BT_BAP_EP_STATE_QOS_CONFIGURED) { + if (state != BT_BAP_EP_STATE_STREAMING) { LOG_DBG("Invalid broadcast sync endpoint state transition"); return; } From be15b17bea77b972296e2e1216702eaabf45e6f1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:09 +0100 Subject: [PATCH 0980/2300] Revert "[nrf fromtree] Bluetooth: CAP: Fix uninitialized values in broadcast start" This reverts commit 975eb2134eeb6b788469db1764fb7b3b1e1a82bb. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/cap_initiator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/audio/cap_initiator.c b/subsys/bluetooth/audio/cap_initiator.c index 3b8ee2fc3f2..46b39afcb41 100644 --- a/subsys/bluetooth/audio/cap_initiator.c +++ b/subsys/bluetooth/audio/cap_initiator.c @@ -192,7 +192,7 @@ int bt_cap_initiator_broadcast_audio_create( bap_subgroup_params[CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT]; struct bt_bap_broadcast_source_stream_param bap_stream_params[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT]; - struct bt_bap_broadcast_source_param bap_create_param = {0}; + struct bt_bap_broadcast_source_param bap_create_param; CHECKIF(param == NULL) { LOG_DBG("param is NULL"); From 9a9c61bd555df9ad25317e75c1bcf97bf63962a8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:09 +0100 Subject: [PATCH 0981/2300] Revert "[nrf fromtree] manifest: Update hal_nordic revision" This reverts commit c162a6a69e37aa1960a070e2d29bdd1b10fbd73e. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index ffb998f98ab..96878a3ae41 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: dce8519f7da37b0a745237679fd3f88250b495ff + revision: b55cfbbf0221d709560c2e438beef66842ada272 path: modules/hal/nordic groups: - hal From 39abd1938a60c4d3cea924ec1b385c83675cae8d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:09 +0100 Subject: [PATCH 0982/2300] Revert "[nrf fromtree] tests: lwm2m: Update lwm2m_engine tests" This reverts commit 0d290712960e737ce061e60df08d9e700f04dd82. Signed-off-by: Robert Lubos --- tests/net/lib/lwm2m/lwm2m_engine/src/main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c index 7078fbebe6d..5d80f5d1049 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c @@ -260,13 +260,11 @@ ZTEST(lwm2m_engine, test_push_queued_buffers) int ret; struct lwm2m_ctx ctx; struct lwm2m_message msg; - struct coap_pending pending; (void)memset(&ctx, 0x0, sizeof(ctx)); sys_slist_init(&ctx.queued_messages); msg.ctx = &ctx; - msg.pending = &pending; sys_slist_append(&ctx.queued_messages, &msg.node); ret = lwm2m_push_queued_buffers(&ctx); zassert_equal(ret, 0); @@ -393,7 +391,6 @@ ZTEST(lwm2m_engine, test_socket_send) int ret; struct lwm2m_ctx ctx; struct lwm2m_message msg; - struct coap_pending pending; (void)memset(&ctx, 0x0, sizeof(ctx)); @@ -401,7 +398,6 @@ ZTEST(lwm2m_engine, test_socket_send) ctx.sock_fd = -1; sys_slist_init(&ctx.queued_messages); msg.ctx = &ctx; - msg.pending = &pending; msg.type = COAP_TYPE_CON; sys_slist_append(&ctx.queued_messages, &msg.node); From 9b732f274db413e35791c8421d5ba5af3d893ec2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:09 +0100 Subject: [PATCH 0983/2300] Revert "[nrf fromtree] net: lwm2m: Use CID_SUPPORTED instead of CID_ENABLED" This reverts commit 57675c7ac0d0e2e6eeccc9e27bbcea4087463f91. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 55f23f77692..bad54c521d7 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -1060,7 +1060,7 @@ int lwm2m_set_default_sockopt(struct lwm2m_ctx *ctx) } if (IS_ENABLED(CONFIG_LWM2M_DTLS_CID)) { /* Enable CID */ - int cid = TLS_DTLS_CID_SUPPORTED; + int cid = TLS_DTLS_CID_ENABLED; ret = zsock_setsockopt(ctx->sock_fd, SOL_TLS, TLS_DTLS_CID, &cid, sizeof(cid)); From 3d6f26d0db9a226cb807b9b3d154b68d6f552665 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:10 +0100 Subject: [PATCH 0984/2300] Revert "[nrf fromtree] net: lwm2m: Fix segfault on failed bootstrap" This reverts commit 3e68a136083e3c959549307a145b41747b5348bb. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index bad54c521d7..60ea1bdb794 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -645,7 +645,7 @@ static int64_t check_notifications(struct lwm2m_ctx *ctx, const int64_t timestam */ static void hint_socket_state(struct lwm2m_ctx *ctx, struct lwm2m_message *ongoing_tx) { - if (!ctx || !ctx->set_socket_state) { + if (!ctx->set_socket_state) { return; } From 9b25b58c6637cc03c332380e453618629d9828c8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:10 +0100 Subject: [PATCH 0985/2300] Revert "[nrf fromtree] net: lwm2m: Allow send operations when sleeping" This reverts commit ebe182e21cae4b4cf0739c691cb9f371a2aef284. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/Kconfig | 7 ------- subsys/net/lib/lwm2m/lwm2m_engine.c | 1 - subsys/net/lib/lwm2m/lwm2m_message_handling.c | 7 ------- subsys/net/lib/lwm2m/lwm2m_rd_client.c | 7 +------ 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/subsys/net/lib/lwm2m/Kconfig b/subsys/net/lib/lwm2m/Kconfig index 33a093308df..1e5a7ac8f6a 100644 --- a/subsys/net/lib/lwm2m/Kconfig +++ b/subsys/net/lib/lwm2m/Kconfig @@ -110,13 +110,6 @@ config LWM2M_QUEUE_MODE_UPTIME defaults to 93 seconds, see RFC 7252), it does not forbid other values though. -config LWM2M_QUEUE_MODE_NO_MSG_BUFFERING - bool "Disable buffering notifications and messages on queue mode" - select EXPERIMENTAL - help - Messages are sent right away instead of waiting for next registration update. - This might not be supported on all servers. - config LWM2M_TLS_SESSION_CACHING bool "TLS session caching" help diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 60ea1bdb794..e08bb4ca17e 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -244,7 +244,6 @@ int lwm2m_push_queued_buffers(struct lwm2m_ctx *client_ctx) break; } msg = SYS_SLIST_CONTAINER(msg_node, msg, node); - msg->pending->t0 = k_uptime_get(); sys_slist_append(&msg->ctx->pending_sends, &msg->node); } #endif diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 19a2e1ccdd0..480c64372e8 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -726,13 +726,6 @@ int lwm2m_information_interface_send(struct lwm2m_message *msg) return ret; } - if (IS_ENABLED(CONFIG_LWM2M_QUEUE_MODE_NO_MSG_BUFFERING)) { - sys_slist_append(&msg->ctx->pending_sends, &msg->node); - lwm2m_engine_wake_up(); - lwm2m_engine_connection_resume(msg->ctx); - return 0; - } - if (msg->ctx->buffer_client_messages) { sys_slist_append(&msg->ctx->queued_messages, &msg->node); lwm2m_engine_wake_up(); diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.c b/subsys/net/lib/lwm2m/lwm2m_rd_client.c index 22ce51e5248..95b576cb1c6 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.c +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.c @@ -1726,12 +1726,7 @@ int lwm2m_rd_client_connection_resume(struct lwm2m_ctx *client_ctx) IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_LISTEN_AT_IDLE)) || !IS_ENABLED(CONFIG_LWM2M_DTLS_SUPPORT)) { client.engine_state = ENGINE_REGISTRATION_DONE; - if (IS_ENABLED(CONFIG_LWM2M_QUEUE_MODE_NO_MSG_BUFFERING)) { - /* Force online for a short period */ - engine_update_tx_time(); - } else { - client.trigger_update = true; - } + client.trigger_update = true; } else { client.engine_state = ENGINE_DO_REGISTRATION; } From 9bc47d2d60783ebc4389119a6922116b0c5b485e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:10 +0100 Subject: [PATCH 0986/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Disable randomization on Link Close in RPR server" This reverts commit 0ec3ab3bb6212be934d6ce0d91fde2442ff2b139. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/rpr_srv.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/subsys/bluetooth/mesh/rpr_srv.c b/subsys/bluetooth/mesh/rpr_srv.c index ac3fd190880..e97df35f28f 100644 --- a/subsys/bluetooth/mesh/rpr_srv.c +++ b/subsys/bluetooth/mesh/rpr_srv.c @@ -968,12 +968,6 @@ static int handle_link_close(const struct bt_mesh_model *mod, struct bt_mesh_msg * which will be used in the link report when the link is fully closed. */ - /* Disable randomization for the Remote Provisioning Link Status message to avoid reordering - * of it with the Remote Provisioning Link Report message that shall be sent in a sequence - * when closing an active link (see section 4.4.5.5.3.3 of MshPRTv1.1). - */ - ctx->rnd_delay = false; - link_status_send(ctx, BT_MESH_RPR_SUCCESS); link_close(BT_MESH_RPR_ERR_LINK_CLOSED_BY_CLIENT, reason); From c7f07abff6e26017e1bc3a7d80e1ca6626bd2aa9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:10 +0100 Subject: [PATCH 0987/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Disable randomization in DFD model for canceling update" This reverts commit 3d12d97604944eca3fe781ed9b02695eec2307b0. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/dfd_srv.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/subsys/bluetooth/mesh/dfd_srv.c b/subsys/bluetooth/mesh/dfd_srv.c index e765f2d5d7b..54184acd9b8 100644 --- a/subsys/bluetooth/mesh/dfd_srv.c +++ b/subsys/bluetooth/mesh/dfd_srv.c @@ -1148,14 +1148,6 @@ enum bt_mesh_dfd_status bt_mesh_dfd_srv_cancel(struct bt_mesh_dfd_srv *srv, return BT_MESH_DFD_ERR_INTERNAL; } - if (prev_phase == BT_MESH_DFD_PHASE_APPLYING_UPDATE && ctx) { - /* Disable randomization for the Firmware Distribution State message to avoid - * reordering when Firmware Distribution Server sends 2 messages in a row when - * cancelling the update (see section 6.2.3.10 of MshDFUv1.0). - */ - ctx->rnd_delay = false; - } - if (ctx != NULL) { status_rsp(srv, ctx, BT_MESH_DFD_SUCCESS); } From ed2cf7829684e4b0814fd6d5c6b48c405023fe4d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:11 +0100 Subject: [PATCH 0988/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Warn if trying to send adv while suspended" This reverts commit ea43799e039973838c673a0225422e842afba5a6. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/adv.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index d9b191120d1..d51f0946b85 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -257,10 +257,6 @@ void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, LOG_DBG("type 0x%02x len %u: %s", adv->ctx.type, adv->b.len, bt_hex(adv->b.data, adv->b.len)); - if (atomic_test_bit(bt_mesh.flags, BT_MESH_SUSPENDED)) { - LOG_WRN("Sending advertisement while suspended"); - } - adv->ctx.cb = cb; adv->ctx.cb_data = cb_data; adv->ctx.busy = 1U; From 531791bbf27479b46244401156296a70cef17675 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:11 +0100 Subject: [PATCH 0989/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Fix solicitation PDU tx dep on proxy" This reverts commit 0ec9f7cef89c90428f2d92531bec7bcce74c236b. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/adv_ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index a80a47760ea..c195671ebcb 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -317,13 +317,13 @@ static void send_pending_adv(struct k_work *work) } } - if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && - !bt_mesh_sol_send()) { + if (!IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER) || + !(ext_adv->tags & BT_MESH_ADV_TAG_BIT_PROXY)) { return; } - if (!IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER) || - !(ext_adv->tags & BT_MESH_ADV_TAG_BIT_PROXY)) { + if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && + !bt_mesh_sol_send()) { return; } From fdc7ac17429f9efd036f86e8a2206dec784a16bd Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:11 +0100 Subject: [PATCH 0990/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Reset solicitation settings before calling reset cb" This reverts commit 753f3c21ef9ced4b4c1da3dde07def93e373f820. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 77ca15b2d61..1b80233cec1 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -401,10 +401,6 @@ void bt_mesh_reset(void) bt_mesh_comp_unprovision(); - if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION)) { - bt_mesh_sol_reset(); - } - if (IS_ENABLED(CONFIG_BT_SETTINGS)) { bt_mesh_settings_store_pending(); } @@ -412,6 +408,10 @@ void bt_mesh_reset(void) if (IS_ENABLED(CONFIG_BT_MESH_PROV)) { bt_mesh_prov_reset(); } + + if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION)) { + bt_mesh_sol_reset(); + } } bool bt_mesh_is_provisioned(void) From f2bd4da0e82adfec5c412f50099cfc233bed433b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:11 +0100 Subject: [PATCH 0991/2300] Revert "[nrf fromtree] Bluetooth: Mesh: fix SRPL always accepting sol pdus with sseq 0" This reverts commit e91d83a89cd29f3234831c961b2e568d0b1df4b4. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/solicitation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/solicitation.c b/subsys/bluetooth/mesh/solicitation.c index a2872daecb0..642abfd87f1 100644 --- a/subsys/bluetooth/mesh/solicitation.c +++ b/subsys/bluetooth/mesh/solicitation.c @@ -65,7 +65,7 @@ static int srpl_entry_save(struct bt_mesh_subnet *sub, uint32_t sseq, uint16_t s entry = srpl_find_by_addr(ssrc); if (entry) { - if (entry->sseq >= sseq) { + if (entry->sseq >= sseq && sseq != 0) { LOG_WRN("Higher or equal SSEQ already saved for this SSRC"); return -EALREADY; } From 7d0a613146cff24748bf25d85bf0264efb977f89 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:11 +0100 Subject: [PATCH 0992/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Send provisioning PDUs with randomized delay" This reverts commit ae1cfd686cc6c72bee6e37052ed0ec1434a83732. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/pb_adv.c | 224 ++++++++------------------------- 1 file changed, 50 insertions(+), 174 deletions(-) diff --git a/subsys/bluetooth/mesh/pb_adv.c b/subsys/bluetooth/mesh/pb_adv.c index c5c56b1e5b0..f723ff48c14 100644 --- a/subsys/bluetooth/mesh/pb_adv.c +++ b/subsys/bluetooth/mesh/pb_adv.c @@ -67,8 +67,6 @@ enum { ADV_LINK_INVALID, /* Error occurred during provisioning */ ADV_ACK_PENDING, /* An acknowledgment is being sent */ ADV_PROVISIONER, /* The link was opened as provisioner */ - ADV_LINK_ACK_SENDING, /* Link Ack tx was scheduled but not finished. */ - ADV_SENDING, /* Sending any PDU */ ADV_NUM_FLAGS, }; @@ -102,30 +100,15 @@ struct pb_adv { /* Transaction timeout in seconds */ uint8_t timeout; - /* Pending outgoing adv(s) (Link Open, Gen Trans Start and Gen Trans Cont) */ + /* Pending outgoing adv(s) */ struct bt_mesh_adv *adv[3]; - /* Index of the next adv to be sent */ - int next; - prov_bearer_send_complete_t cb; void *cb_data; /* Retransmit timer */ struct k_work_delayable retransmit; - - /* Unacked adv buffers (Link Ack, Link Close and Gen Trans Ack). Array size is - * hardcoded to 2 allowing to send Gen Trans Ack and Link Close at the same time. - */ - struct unacked_adv_ctx { - struct bt_mesh_adv *adv; - prov_bearer_send_complete_t cb; - void *cb_data; - } unacked[2]; - - /* Last sent unacked[] buffer */ - int last_unacked; } tx; /* Protocol timeout */ @@ -149,124 +132,28 @@ static void link_close(struct prov_rx *rx, struct net_buf_simple *buf); static void prov_link_close(enum prov_bearer_link_status status); static void close_link(enum prov_bearer_link_status status); -static void tx_work_handler(struct k_work *work); -static K_WORK_DELAYABLE_DEFINE(tx_work, tx_work_handler); - -static void tx_schedule(void) +static void buf_sent(int err, void *user_data) { - uint16_t random_delay; + enum prov_bearer_link_status reason = (enum prov_bearer_link_status)(int)user_data; - if (atomic_test_bit(link.flags, ADV_SENDING)) { - LOG_DBG("Another tx is in progress"); + if (atomic_test_and_clear_bit(link.flags, ADV_LINK_CLOSING)) { + close_link(reason); return; } - - (void)bt_rand(&random_delay, sizeof(random_delay)); - random_delay = 20 + (random_delay % 30); - - LOG_DBG("Next PDU delayed by %ums", random_delay); - - (void)k_work_schedule(&tx_work, K_MSEC(random_delay)); -} - -static int send_unacked(struct bt_mesh_adv *adv, prov_bearer_send_complete_t cb, - void *cb_data) -{ - for (int i = 0; i < ARRAY_SIZE(link.tx.unacked); i++) { - if (link.tx.unacked[i].adv != NULL) { - continue; - } - - link.tx.unacked[i].adv = adv; - link.tx.unacked[i].cb = cb; - link.tx.unacked[i].cb_data = cb_data; - - tx_schedule(); - - return 0; - } - - LOG_WRN("No memory to send unacked PDU: %s", bt_hex(adv->b.data, adv->b.len)); - return -ENOMEM; -} - -static void send_reliable(void) -{ - /* Dropping next tx adv index to start transmission from the first adv buffer. */ - link.tx.next = 0; - - tx_schedule(); -} - -static void delayed_adv_send_end(int err, void *user_data) -{ - bool unacked = (bool)user_data; - struct unacked_adv_ctx *unacked_adv = &link.tx.unacked[link.tx.last_unacked]; - - if (unacked && unacked_adv->adv != NULL) { - if (unacked_adv->cb) { - unacked_adv->cb(err, unacked_adv->cb_data); - } - - bt_mesh_adv_unref(unacked_adv->adv); - unacked_adv->adv = NULL; - } - - atomic_clear_bit(link.flags, ADV_SENDING); - tx_schedule(); } -static void delayed_adv_send_start(uint16_t duration, int err, void *user_data) +static void buf_start(uint16_t duration, int err, void *user_data) { if (err) { - delayed_adv_send_end(err, user_data); + buf_sent(err, user_data); } } -static const struct bt_mesh_send_cb delayed_adv_send_cb = { - .start = delayed_adv_send_start, - .end = delayed_adv_send_end, +static struct bt_mesh_send_cb buf_sent_cb = { + .start = buf_start, + .end = buf_sent, }; -static void tx_work_handler(struct k_work *work) -{ - int i; - - /* Send Link Ack, Link Close and Gen Trans Ack first. */ - for (i = 0; i < ARRAY_SIZE(link.tx.unacked); i++) { - int idx = (i + link.tx.last_unacked) % ARRAY_SIZE(link.tx.unacked); - struct unacked_adv_ctx *unacked = &link.tx.unacked[idx]; - - if (!unacked->adv) { - continue; - } - - atomic_set_bit(link.flags, ADV_SENDING); - bt_mesh_adv_send(unacked->adv, &delayed_adv_send_cb, (void *)true); - - link.tx.last_unacked = idx; - - return; - } - - /* Send Trans Start, Trans Cont and Link Open */ - if (link.tx.next >= ARRAY_SIZE(link.tx.adv) || link.tx.adv[link.tx.next] == NULL) { - LOG_DBG("All PDUs were sent"); - return; - } - - atomic_set_bit(link.flags, ADV_SENDING); - bt_mesh_adv_send(link.tx.adv[link.tx.next], &delayed_adv_send_cb, (void *)false); - - link.tx.next++; - - if (link.tx.next == ARRAY_SIZE(link.tx.adv) || link.tx.adv[link.tx.next] == NULL) { - /* All ack-able PDUs are sent. Now we can run the retransmit timer. */ - LOG_DBG("Starting retransmit timer"); - k_work_reschedule(&link.tx.retransmit, RETRANSMIT_TIMEOUT); - } -} - static uint8_t last_seg(uint16_t len) { if (len <= START_PAYLOAD_MAX) { @@ -281,11 +168,9 @@ static uint8_t last_seg(uint16_t len) static void free_segments(void) { int i; - bool canceled = false; for (i = 0; i < ARRAY_SIZE(link.tx.adv); i++) { struct bt_mesh_adv *adv = link.tx.adv[i]; - int err; if (!adv) { break; @@ -295,23 +180,14 @@ static void free_segments(void) /* Terminate active adv */ if (adv->ctx.busy == 0U) { - err = bt_mesh_adv_terminate(adv); - if (err == 0) { - canceled = true; - } + bt_mesh_adv_terminate(adv); } else { /* Mark as canceled */ adv->ctx.busy = 0U; - canceled = true; } bt_mesh_adv_unref(adv); } - - if (canceled) { - atomic_clear_bit(link.flags, ADV_SENDING); - tx_schedule(); - } } static uint8_t next_transaction_id(uint8_t id) @@ -392,7 +268,7 @@ static struct bt_mesh_adv *adv_create(uint8_t retransmits) return adv; } -static void ack_complete(int err, void *user_data) +static void ack_complete(uint16_t duration, int err, void *user_data) { LOG_DBG("xact 0x%x complete", (uint8_t)link.tx.pending_ack); atomic_clear_bit(link.flags, ADV_ACK_PENDING); @@ -447,9 +323,12 @@ static void protocol_timeout(struct k_work *work) static void gen_prov_ack_send(uint8_t xact_id) { + static const struct bt_mesh_send_cb cb = { + .start = ack_complete, + }; + const struct bt_mesh_send_cb *complete; struct bt_mesh_adv *adv; bool pending = atomic_test_and_set_bit(link.flags, ADV_ACK_PENDING); - int err; LOG_DBG("xact_id 0x%x", xact_id); @@ -464,18 +343,19 @@ static void gen_prov_ack_send(uint8_t xact_id) return; } - if (!pending) { + if (pending) { + complete = NULL; + } else { link.tx.pending_ack = xact_id; + complete = &cb; } net_buf_simple_add_be32(&adv->b, link.id); net_buf_simple_add_u8(&adv->b, xact_id); net_buf_simple_add_u8(&adv->b, GPC_ACK); - err = send_unacked(adv, pending ? NULL : ack_complete, NULL); - if (err) { - atomic_clear_bit(link.flags, ADV_ACK_PENDING); - } + bt_mesh_adv_send(adv, complete, NULL); + bt_mesh_adv_unref(adv); } static void gen_prov_cont(struct prov_rx *rx, struct net_buf_simple *buf) @@ -711,6 +591,29 @@ static void gen_prov_recv(struct prov_rx *rx, struct net_buf_simple *buf) * TX ******************************************************************************/ +static void send_reliable(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(link.tx.adv); i++) { + struct bt_mesh_adv *adv = link.tx.adv[i]; + + if (!adv) { + break; + } + + if (adv->ctx.busy) { + continue; + } + + LOG_DBG("%u bytes: %s", adv->b.len, bt_hex(adv->b.data, adv->b.len)); + + bt_mesh_adv_send(adv, NULL, NULL); + } + + k_work_reschedule(&link.tx.retransmit, RETRANSMIT_TIMEOUT); +} + static void prov_retransmit(struct k_work *work) { LOG_DBG(""); @@ -766,22 +669,8 @@ static int bearer_ctl_send(struct bt_mesh_adv *adv) return 0; } -static void buf_sent(int err, void *user_data) -{ - enum prov_bearer_link_status reason = (enum prov_bearer_link_status)(int)user_data; - - atomic_clear_bit(link.flags, ADV_LINK_ACK_SENDING); - - if (atomic_test_and_clear_bit(link.flags, ADV_LINK_CLOSING)) { - close_link(reason); - return; - } -} - static int bearer_ctl_send_unacked(struct bt_mesh_adv *adv, void *user_data) { - int err; - if (!adv) { return -ENOMEM; } @@ -789,12 +678,10 @@ static int bearer_ctl_send_unacked(struct bt_mesh_adv *adv, void *user_data) prov_clear_tx(); k_work_reschedule(&link.prot_timer, bt_mesh_prov_protocol_timeout_get()); - err = send_unacked(adv, &buf_sent, user_data); - if (err) { - bt_mesh_adv_unref(adv); - } + bt_mesh_adv_send(adv, &buf_sent_cb, user_data); + bt_mesh_adv_unref(adv); - return err; + return 0; } static int prov_send_adv(struct net_buf_simple *msg, @@ -885,13 +772,8 @@ static void link_open(struct prov_rx *rx, struct net_buf_simple *buf) return; } - if (atomic_test_bit(link.flags, ADV_LINK_ACK_SENDING)) { - LOG_DBG("Still sending Link Ack"); - return; - } - + LOG_DBG("Resending link ack"); /* Ignore errors, message will be attempted again if we keep receiving link open: */ - atomic_set_bit(link.flags, ADV_LINK_ACK_SENDING); (void)bearer_ctl_send_unacked( ctl_adv_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), (void *)PROV_BEARER_LINK_STATUS_SUCCESS); @@ -907,7 +789,6 @@ static void link_open(struct prov_rx *rx, struct net_buf_simple *buf) atomic_set_bit(link.flags, ADV_LINK_ACTIVE); net_buf_simple_reset(link.rx.buf); - atomic_set_bit(link.flags, ADV_LINK_ACK_SENDING); err = bearer_ctl_send_unacked( ctl_adv_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), (void *)PROV_BEARER_LINK_STATUS_SUCCESS); @@ -1042,8 +923,6 @@ static int prov_link_accept(const struct prov_bearer_cb *cb, void *cb_data) static void prov_link_close(enum prov_bearer_link_status status) { - int err; - if (atomic_test_and_set_bit(link.flags, ADV_LINK_CLOSING)) { return; } @@ -1055,12 +934,9 @@ static void prov_link_close(enum prov_bearer_link_status status) */ link.tx.timeout = CLOSING_TIMEOUT; /* Ignore errors, the link will time out eventually if this doesn't get sent */ - err = bearer_ctl_send_unacked( + bearer_ctl_send_unacked( ctl_adv_create(LINK_CLOSE, &status, 1, RETRANSMITS_LINK_CLOSE), (void *)status); - if (err) { - close_link(status); - } } void bt_mesh_pb_adv_init(void) From 5513f20d6ea25a847798d2200559f75bf8bcf0d8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:12 +0100 Subject: [PATCH 0993/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Add error code for bt_mesh_adv_terminate" This reverts commit 300cc7f19a4f615d087fe470e918af58e50e18d9. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/adv.h | 2 +- subsys/bluetooth/mesh/adv_ext.c | 10 ++++------ subsys/bluetooth/mesh/adv_legacy.c | 4 +--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/subsys/bluetooth/mesh/adv.h b/subsys/bluetooth/mesh/adv.h index 6595badc9f9..e79d082862a 100644 --- a/subsys/bluetooth/mesh/adv.h +++ b/subsys/bluetooth/mesh/adv.h @@ -101,7 +101,7 @@ void bt_mesh_adv_local_ready(void); void bt_mesh_adv_relay_ready(void); -int bt_mesh_adv_terminate(struct bt_mesh_adv *adv); +void bt_mesh_adv_terminate(struct bt_mesh_adv *adv); void bt_mesh_adv_friend_ready(void); diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index c195671ebcb..1cac272f7c3 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -395,7 +395,7 @@ void bt_mesh_adv_friend_ready(void) } } -int bt_mesh_adv_terminate(struct bt_mesh_adv *adv) +void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) { int err; @@ -407,13 +407,13 @@ int bt_mesh_adv_terminate(struct bt_mesh_adv *adv) } if (!atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { - return 0; + return; } err = bt_le_ext_adv_stop(ext_adv->instance); if (err) { LOG_ERR("Failed to stop adv %d", err); - return err; + return; } /* Do not call `cb:end`, since this user action */ @@ -423,10 +423,8 @@ int bt_mesh_adv_terminate(struct bt_mesh_adv *adv) k_work_submit(&ext_adv->work); - return 0; + return; } - - return -EINVAL; } void bt_mesh_adv_init(void) diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index 867c91bbf8e..135f444b9b4 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -214,11 +214,9 @@ void bt_mesh_adv_gatt_update(void) bt_mesh_adv_get_cancel(); } -int bt_mesh_adv_terminate(struct bt_mesh_adv *adv) +void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) { ARG_UNUSED(adv); - - return 0; } void bt_mesh_adv_init(void) From 8513017cd13216d04c557164a3b8fd4cdd881e45 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:12 +0100 Subject: [PATCH 0994/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Call bt_mesh_send_cb.end cb by the end of adv" This reverts commit f069c9f4cd6bbb7dbc3b174edb2569b53979ce76. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/adv.c | 4 +++- subsys/bluetooth/mesh/adv.h | 1 - subsys/bluetooth/mesh/adv_ext.c | 5 ----- subsys/bluetooth/mesh/adv_legacy.c | 4 ---- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index d51f0946b85..00e2a4aa7bb 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -76,7 +76,7 @@ void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv_ctx * } } -void bt_mesh_adv_send_end(int err, struct bt_mesh_adv_ctx const *ctx) +static void bt_mesh_adv_send_end(int err, struct bt_mesh_adv_ctx const *ctx) { if (ctx->started && ctx->cb && ctx->cb->end) { ctx->cb->end(err, ctx->cb_data); @@ -136,6 +136,7 @@ void bt_mesh_adv_unref(struct bt_mesh_adv *adv) } struct k_mem_slab *slab = &local_adv_pool; + struct bt_mesh_adv_ctx ctx = adv->ctx; #if defined(CONFIG_BT_MESH_RELAY) if (adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) { @@ -150,6 +151,7 @@ void bt_mesh_adv_unref(struct bt_mesh_adv *adv) #endif k_mem_slab_free(slab, (void *)adv); + bt_mesh_adv_send_end(0, &ctx); } struct bt_mesh_adv *bt_mesh_adv_create(enum bt_mesh_adv_type type, diff --git a/subsys/bluetooth/mesh/adv.h b/subsys/bluetooth/mesh/adv.h index e79d082862a..0c936a1aa52 100644 --- a/subsys/bluetooth/mesh/adv.h +++ b/subsys/bluetooth/mesh/adv.h @@ -76,7 +76,6 @@ struct bt_mesh_adv *bt_mesh_adv_create(enum bt_mesh_adv_type type, void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, void *cb_data); -void bt_mesh_adv_send_end(int err, struct bt_mesh_adv_ctx const *ctx); struct bt_mesh_adv *bt_mesh_adv_get(k_timeout_t timeout); diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 1cac272f7c3..8f4f05a34cf 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -284,12 +284,7 @@ static void send_pending_adv(struct k_work *work) atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); if (ext_adv->adv) { - struct bt_mesh_adv_ctx ctx = ext_adv->adv->ctx; - - ext_adv->adv->ctx.started = 0; bt_mesh_adv_unref(ext_adv->adv); - bt_mesh_adv_send_end(0, &ctx); - ext_adv->adv = NULL; } diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index 135f444b9b4..d4003e497bb 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -182,11 +182,7 @@ static void adv_thread(void *p1, void *p2, void *p3) adv_send(adv); } - struct bt_mesh_adv_ctx ctx = adv->ctx; - - adv->ctx.started = 0; bt_mesh_adv_unref(adv); - bt_mesh_adv_send_end(0, &ctx); /* Give other threads a chance to run */ k_yield(); From 7a265509509b654dce9d110341677b3f2c4eefc7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:12 +0100 Subject: [PATCH 0995/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Add artificial beacon delay" This reverts commit d5528269c830cc62de3da0e5962d16182334f9e0. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/beacon.c | 78 +++++---------------- tests/bsim/bluetooth/mesh/src/test_beacon.c | 22 +++--- 2 files changed, 24 insertions(+), 76 deletions(-) diff --git a/subsys/bluetooth/mesh/beacon.c b/subsys/bluetooth/mesh/beacon.c index cdd5862330e..6eb2c9be3a7 100644 --- a/subsys/bluetooth/mesh/beacon.c +++ b/subsys/bluetooth/mesh/beacon.c @@ -40,8 +40,6 @@ LOG_MODULE_REGISTER(bt_mesh_beacon); #define PROV_XMIT BT_MESH_TRANSMIT(0, 20) static struct k_work_delayable beacon_timer; -static struct bt_mesh_subnet *beacon_send_sub_curr; - #if defined(CONFIG_BT_MESH_PRIV_BEACONS) static struct { /** @@ -113,26 +111,13 @@ void bt_mesh_beacon_cache_clear(struct bt_mesh_subnet *sub) #endif } -static void beacon_start(uint16_t duration, int err, void *user_data) -{ - if (err) { - LOG_ERR("Failed to send beacon: err %d", err); - if (beacon_send_sub_curr) { - k_work_reschedule(&beacon_timer, K_NO_WAIT); - } - } -} - static void beacon_complete(int err, void *user_data) { struct bt_mesh_beacon *beacon = user_data; LOG_DBG("err %d", err); - beacon->sent = k_uptime_get_32(); - if (beacon_send_sub_curr) { - k_work_reschedule(&beacon_timer, K_MSEC(20)); - } + beacon->sent = k_uptime_get_32(); } static int secure_beacon_create(struct bt_mesh_subnet *sub, @@ -262,12 +247,11 @@ static bool secure_beacon_is_running(void) atomic_test_bit(bt_mesh.flags, BT_MESH_IVU_INITIATOR); } -static int net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *beacon, - int (*beacon_create)(struct bt_mesh_subnet *sub, - struct net_buf_simple *buf)) +static bool net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *beacon, + void *cb_data, int (*beacon_create)(struct bt_mesh_subnet *sub, + struct net_buf_simple *buf)) { static const struct bt_mesh_send_cb send_cb = { - .start = beacon_start, .end = beacon_complete, }; uint32_t now = k_uptime_get_32(); @@ -283,14 +267,14 @@ static int net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *be if (time_diff < (600 * MSEC_PER_SEC) && (time_diff < BEACON_THRESHOLD(beacon) || time_since_last_recv < (10 * MSEC_PER_SEC))) { - return -ENOMSG; + return false; } adv = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, PROV_XMIT, K_NO_WAIT); if (!adv) { LOG_ERR("Unable to allocate beacon adv"); - return -ENOMEM; /* Bail out */ + return true; /* Bail out */ } err = beacon_create(sub, &adv->b); @@ -300,12 +284,12 @@ static int net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *be bt_mesh_adv_unref(adv); - return err; + return err != 0; } -static int net_beacon_for_subnet_send(struct bt_mesh_subnet *sub) +static bool net_beacon_for_subnet_send(struct bt_mesh_subnet *sub, void *cb_data) { - int err = -ENOMSG; + bool res = true; struct { struct bt_mesh_beacon *beacon; @@ -331,14 +315,14 @@ static int net_beacon_for_subnet_send(struct bt_mesh_subnet *sub) continue; } - err = net_beacon_send(sub, beacons[i].beacon, beacons[i].create_fn); - if (err < 0) { + res = net_beacon_send(sub, beacons[i].beacon, cb_data, beacons[i].create_fn); + if (res) { /* Bail out */ break; } } - return err; + return res; } static int unprovisioned_beacon_send(void) @@ -465,30 +449,6 @@ static bool net_beacon_is_running(void) (bt_mesh_priv_beacon_get() == BT_MESH_FEATURE_ENABLED); } -static bool beacons_send_next(void) -{ - int err; - struct bt_mesh_subnet *sub_first = bt_mesh_subnet_next(NULL); - struct bt_mesh_subnet *sub_next; - - do { - sub_next = bt_mesh_subnet_next(beacon_send_sub_curr); - if (sub_next == sub_first && beacon_send_sub_curr != NULL) { - beacon_send_sub_curr = NULL; - return false; - } - - beacon_send_sub_curr = sub_next; - err = net_beacon_for_subnet_send(beacon_send_sub_curr); - if (err < 0 && (err != -ENOMSG)) { - LOG_ERR("Failed to advertise subnet %d: err %d", - beacon_send_sub_curr->net_idx, err); - } - } while (err); - - return true; -} - static void beacon_send(struct k_work *work) { LOG_DBG(""); @@ -498,14 +458,10 @@ static void beacon_send(struct k_work *work) return; } - if (!beacon_send_sub_curr) { - update_beacon_observation(); - } - - if (!beacons_send_next()) { - k_work_schedule(&beacon_timer, PROVISIONED_INTERVAL); - } + update_beacon_observation(); + (void)bt_mesh_subnet_find(net_beacon_for_subnet_send, NULL); + k_work_schedule(&beacon_timer, PROVISIONED_INTERVAL); return; } @@ -517,6 +473,7 @@ static void beacon_send(struct k_work *work) k_work_schedule(&beacon_timer, K_SECONDS(CONFIG_BT_MESH_UNPROV_BEACON_INT)); } + } static bool auth_match(struct bt_mesh_subnet_keys *keys, @@ -800,7 +757,6 @@ void bt_mesh_beacon_ivu_initiator(bool enable) * still have to implement an early exit mechanism, so we might as well * just use this every time. */ - beacon_send_sub_curr = NULL; k_work_schedule(&beacon_timer, K_NO_WAIT); } @@ -823,13 +779,11 @@ void bt_mesh_beacon_enable(void) bt_mesh_subnet_foreach(subnet_beacon_enable); } - beacon_send_sub_curr = NULL; k_work_reschedule(&beacon_timer, K_NO_WAIT); } void bt_mesh_beacon_disable(void) { /* If this fails, we'll do an early exit in the work handler. */ - beacon_send_sub_curr = NULL; (void)k_work_cancel_delayable(&beacon_timer); } diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index 869dbd4965f..7a74123cb0f 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -507,11 +507,8 @@ static void corrupted_beacon_test(const uint8_t *offsets, } /* Now the beacon payload is valid and it shall trigger IV Update on the node. It shall also - * increase the beacon interval. We delay the outgoing beacon for a couple of seconds to - * avoid near perfect syncing with the beacon interval cycle of the device we just received - * a beacon from. + * increase the beacon interval. */ - k_sleep(K_SECONDS(3)); send_beacon(buf); /* The beacon interval shall be changed and the node shall skip transmission of the next @@ -1368,7 +1365,7 @@ static void test_tx_priv_interleave(void) struct bt_mesh_subnet *sub; - bt_mesh_test_cfg_set(NULL, WAIT_TIME); + bt_mesh_test_cfg_set(NULL, BEACON_INTERVAL_WAIT_TIME); bt_mesh_device_setup(&prov, &prb_comp); provision(&tx_cfg); @@ -1401,8 +1398,6 @@ static void test_tx_priv_interleave(void) k_sleep(K_SECONDS(BEACON_INTERVAL + 5)); toggle_priv_beacon(tx_cfg.addr, 0); - /* Small delay to let beacons complete before subnet update is applied */ - k_sleep(K_MSEC(20)); status = bt_mesh_subnet_update(BT_MESH_KEY_PRIMARY, net_key_new); ASSERT_TRUE(status == STATUS_SUCCESS); @@ -1428,7 +1423,7 @@ static void test_rx_priv_interleave(void) int err; bool same_random = false; - bt_mesh_test_cfg_set(&rx_cfg, WAIT_TIME); + bt_mesh_test_cfg_set(&rx_cfg, BEACON_INTERVAL_WAIT_TIME); bt_mesh_crypto_init(); k_sem_init(&observer_sem, 0, 1); @@ -1903,10 +1898,9 @@ static void proxy_adv_confirm_evt(struct expected_proxy_adv_evt *exp_evts, uint8 for (int i = 0; i < cnt; i++) { if (exp_evts[i].evt_cnt) { - LOG_ERR("Missing %d expected %s idx %d events in period %llums-%llums", + LOG_ERR("Missing %d expected %s events in period %llums-%llums", exp_evts[i].evt_cnt, proxy_adv_str[exp_evts[i].evt_type], - exp_evts[i].net_idx, exp_evts[i].time.after, - exp_evts[i].time.before); + exp_evts[i].time.after, exp_evts[i].time.before); missing_evts = true; } } @@ -2035,13 +2029,13 @@ static void test_rx_proxy_adv_multi_subnet_coex(void) * is advertised by this subnet, and that the two others * continues to advertise NET_ID. */ - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 16, + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 17, .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, - {.evt_type = BEACON_TYPE_NODE_ID, .net_idx = 1, .evt_cnt = 16, + {.evt_type = BEACON_TYPE_NODE_ID, .net_idx = 1, .evt_cnt = 17, .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 16, + {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 17, .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, From ed5f6449bd2d1849510c2a80181ef7477591169f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:12 +0100 Subject: [PATCH 0996/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move beacons Kconfiguration under separate submenu" This reverts commit bb085651454d2de9be468854ea97927420568802. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index e0b4761232c..63d10e8f6d4 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1160,6 +1160,12 @@ config BT_MESH_LARGE_COMP_DATA_CLI help Enable support for the Large Composition Data Client model. +config BT_MESH_PRIV_BEACONS + bool "Support for private beacons" + default y + help + Enable support for private beacons. + if BT_MESH_PRIV_BEACONS config BT_MESH_PRIV_BEACON_SRV @@ -1382,8 +1388,6 @@ config BT_MESH_PSA_KEY_ID_USER_MIN_OFFSET endif # BT_MESH_USES_MBEDTLS_PSA || BT_MESH_USES_TFM_PSA -menu "Beacons" - config BT_MESH_BEACON_ENABLED bool "Secure network beacon enabled" default y @@ -1391,14 +1395,6 @@ config BT_MESH_BEACON_ENABLED Controls whether the Secure network beacon feature is enabled by default. Can be changed through runtime configuration. -config BT_MESH_PRIV_BEACONS - bool "Support for private beacons" - default y - help - Enable support for private beacons. - -endmenu # Beacons - menu "IV Index & Sequence number" config BT_MESH_IV_UPDATE_TEST From 384cd951d68aa377960d799cd6b54b2de230ad1e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:12 +0100 Subject: [PATCH 0997/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move Solicitation Kconfig options" This reverts commit 95d9d5faa20d9e85ec0405fce9daa1feb4d37b91. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 63d10e8f6d4..89e905f4f0c 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1299,24 +1299,6 @@ config BT_MESH_PROXY_CLIENT i.e. the ability to act as a proxy between a Mesh GATT Service and a Mesh network. -config BT_MESH_SOLICITATION - bool - -config BT_MESH_PROXY_SOLICITATION - bool "Proxy solicitation feature" - select BT_MESH_SOLICITATION - help - This option enables support for sending Solicitation PDUs. - -config BT_MESH_SOL_ADV_XMIT - int "Solicitation PDU retransmission count" - depends on BT_MESH_PROXY_SOLICITATION - range 0 10 - default 2 - help - How many times Solicitation PDU advertisements will be repeated. 0 means that there will be - 1 transmission without retransmissions. - endmenu # Proxy choice BT_MESH_CRYPTO_LIB @@ -1635,6 +1617,24 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +config BT_MESH_SOLICITATION + bool + +config BT_MESH_PROXY_SOLICITATION + bool "Proxy solicitation feature" + select BT_MESH_SOLICITATION + help + This option enables support for sending Solicitation PDUs. + +config BT_MESH_SOL_ADV_XMIT + int "Solicitation PDU retransmission count" + depends on BT_MESH_PROXY_SOLICITATION + range 0 10 + default 2 + help + How many times Solicitation PDU advertisements will be repeated. 0 means that there will be + 1 transmission without retransmissions. + menu "Capabilities" config BT_MESH_SUBNET_COUNT From e592925eb640bde997ed56785c002801cac34d60 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:13 +0100 Subject: [PATCH 0998/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move OdProxy models Kconfig options" This reverts commit 0492d2b2738f04ee3fe14bbc2d0083f0ed536d4e. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 110 +++++++++++++++++----------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 89e905f4f0c..8c84465c6a0 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1180,61 +1180,6 @@ config BT_MESH_PRIV_BEACON_CLI endif # BT_MESH_PRIV_BEACONS -config BT_MESH_OD_PRIV_PROXY_CLI - bool "Support for On-Demand Private Proxy Client model" - help - On-Demand Private Proxy Client allows to configure and check the state - of On-Demand Private Proxy Servers. The state determines if the peers will - advertise the Private Network Identity type after receiving a Solicitation PDU. - - -config BT_MESH_OD_PRIV_PROXY_CLI_TIMEOUT - int "Solicitation PDU RPL Configuration Client model timeout in milliseconds" - default 5000 - depends on BT_MESH_OD_PRIV_PROXY_CLI - help - This timeout controls how long the On-Demand Private Proxy Client waits - for a response message to arrive. This value can be changed at runtime - using @ref bt_mesh_od_priv_proxy_cli_timeout_set. - -config BT_MESH_OD_PRIV_PROXY_SRV - bool "Support for On-Demand Private Proxy Server model" - depends on BT_MESH_PRIV_BEACON_SRV - select BT_MESH_SOLICITATION - help - The On-Demand Private Proxy Server is used to support configuration of - advertising with Private Network Identity type of a node. - When enabled, the Solicitation PDU RPL Configuration Server model is also enabled. - -config BT_MESH_PROXY_SRPL_SIZE - int "Size of solicitation replay protection list (SRPL)" - depends on BT_MESH_OD_PRIV_PROXY_SRV - default 10 - range 1 255 - help - Size of SRPL. The list is used to determine if a received Solicitation PDU - is valid. It is valid when the SSRC field value of the received Solicitation PDU - is stored in the SRPL and the SSEQ field value is bigger than the corresponding - stored SSEQ value, or if the SSRC was not stored in the RPL and the SRPL still has - space for new entries. - -config BT_MESH_SOL_PDU_RPL_CLI - bool "Support for Solicitation PDU RPL Configuration Client model" - help - The Solicitation PDU RPL Configuration Client is used to support the - functionality of removing addresses from the solicitation replay - protection list (SRPL) of a node that supports the Solicitation - PDU RPL Configuration Server model. - -config BT_MESH_SOL_PDU_RPL_CLI_TIMEOUT - int "Solicitation PDU RPL Configuration Client model timeout in milliseconds" - default 5000 - depends on BT_MESH_SOL_PDU_RPL_CLI - help - This timeout controls how long Solicitation PDU RPL Configuration Client waits - for a response message to arrive. This value can be changed at runtime - using @ref bt_mesh_sol_pdu_rpl_cli_timeout_set. - endmenu # Models menu "Proxy" @@ -1635,6 +1580,61 @@ config BT_MESH_SOL_ADV_XMIT How many times Solicitation PDU advertisements will be repeated. 0 means that there will be 1 transmission without retransmissions. +config BT_MESH_OD_PRIV_PROXY_CLI + bool "Support for On-Demand Private Proxy Client model" + help + On-Demand Private Proxy Client allows to configure and check the state + of On-Demand Private Proxy Servers. The state determines if the peers will + advertise the Private Network Identity type after receiving a Solicitation PDU. + + +config BT_MESH_OD_PRIV_PROXY_CLI_TIMEOUT + int "Solicitation PDU RPL Configuration Client model timeout in milliseconds" + default 5000 + depends on BT_MESH_OD_PRIV_PROXY_CLI + help + This timeout controls how long the On-Demand Private Proxy Client waits + for a response message to arrive. This value can be changed at runtime + using @ref bt_mesh_od_priv_proxy_cli_timeout_set. + +config BT_MESH_OD_PRIV_PROXY_SRV + bool "Support for On-Demand Private Proxy Server model" + depends on BT_MESH_PRIV_BEACON_SRV + select BT_MESH_SOLICITATION + help + The On-Demand Private Proxy Server is used to support configuration of + advertising with Private Network Identity type of a node. + When enabled, the Solicitation PDU RPL Configuration Server model is also enabled. + +config BT_MESH_PROXY_SRPL_SIZE + int "Size of solicitation replay protection list (SRPL)" + depends on BT_MESH_OD_PRIV_PROXY_SRV + default 10 + range 1 255 + help + Size of SRPL. The list is used to determine if a received Solicitation PDU + is valid. It is valid when the SSRC field value of the received Solicitation PDU + is stored in the SRPL and the SSEQ field value is bigger than the corresponding + stored SSEQ value, or if the SSRC was not stored in the RPL and the SRPL still has + space for new entries. + +config BT_MESH_SOL_PDU_RPL_CLI + bool "Support for Solicitation PDU RPL Configuration Client model" + help + The Solicitation PDU RPL Configuration Client is used to support the + functionality of removing addresses from the solicitation replay + protection list (SRPL) of a node that supports the Solicitation + PDU RPL Configuration Server model. + +config BT_MESH_SOL_PDU_RPL_CLI_TIMEOUT + int "Solicitation PDU RPL Configuration Client model timeout in milliseconds" + default 5000 + depends on BT_MESH_SOL_PDU_RPL_CLI + help + This timeout controls how long Solicitation PDU RPL Configuration Client waits + for a response message to arrive. This value can be changed at runtime + using @ref bt_mesh_sol_pdu_rpl_cli_timeout_set. + menu "Capabilities" config BT_MESH_SUBNET_COUNT From f89ed2ae050a7f3db8fe37f96490980cec25987a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:13 +0100 Subject: [PATCH 0999/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move PRB models Kconfig options" This reverts commit 80aa4a1031ec04cc66d55e0719bc762fa6affefe. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 8c84465c6a0..96dc0153794 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1160,26 +1160,6 @@ config BT_MESH_LARGE_COMP_DATA_CLI help Enable support for the Large Composition Data Client model. -config BT_MESH_PRIV_BEACONS - bool "Support for private beacons" - default y - help - Enable support for private beacons. - -if BT_MESH_PRIV_BEACONS - -config BT_MESH_PRIV_BEACON_SRV - bool "Support for Private Beacon Server Model" - help - Enable support for the Private Beacon Server model. - -config BT_MESH_PRIV_BEACON_CLI - bool "Support for Private Beacon Client Model" - help - Enable support for the Private Beacon Client model. - -endif # BT_MESH_PRIV_BEACONS - endmenu # Models menu "Proxy" @@ -1562,6 +1542,26 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +config BT_MESH_PRIV_BEACONS + bool "Support for private beacons" + default y + help + Enable support for private beacons. + +if BT_MESH_PRIV_BEACONS + +config BT_MESH_PRIV_BEACON_SRV + bool "Support for Private Beacon Server Model" + help + Enable support for the Private Beacon Server model. + +config BT_MESH_PRIV_BEACON_CLI + bool "Support for Private Beacon Client Model" + help + Enable support for the Private Beacon Client model. + +endif # BT_MESH_PRIV_BEACONS + config BT_MESH_SOLICITATION bool From 6bcfb51a1dd3bfb85d453b64eb1f24c3fe34f70d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:13 +0100 Subject: [PATCH 1000/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move LCD models Kconfig options" This reverts commit 410a6425c3a758b483b57072df5f212514010347. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 96dc0153794..7f405a0b97d 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1144,22 +1144,6 @@ config BT_MESH_LARGE_COMP_DATA_SRV help Enable support for the Large Composition Data Server model. -if BT_MESH_LARGE_COMP_DATA_SRV - -config BT_MESH_MODELS_METADATA_PAGE_LEN - int "Maximum length of the Models Metadata Page" - default 150 - help - This value is the combined total metadata length for - all models on the device. - -endif # BT_MESH_LARGE_COMP_DATA_SRV - -config BT_MESH_LARGE_COMP_DATA_CLI - bool "Support for Large Composition Data Client model" - help - Enable support for the Large Composition Data Client model. - endmenu # Models menu "Proxy" @@ -1542,6 +1526,22 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +if BT_MESH_LARGE_COMP_DATA_SRV + +config BT_MESH_MODELS_METADATA_PAGE_LEN + int "Maximum length of the Models Metadata Page" + default 150 + help + This value is the combined total metadata length for + all models on the device. + +endif # BT_MESH_LARGE_COMP_DATA_SRV + +config BT_MESH_LARGE_COMP_DATA_CLI + bool "Support for Large Composition Data Client model" + help + Enable support for the Large Composition Data Client model. + config BT_MESH_PRIV_BEACONS bool "Support for private beacons" default y From 6b6a68b384e537271ac27901cf33cb9a6dea281b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:13 +0100 Subject: [PATCH 1001/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move OpAgg models Kconfig options" This reverts commit 77b440e6f3dcab982c1c1b466985bd385f3bf348. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 64 +++++++++++++++++------------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 7f405a0b97d..28316764852 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1112,38 +1112,6 @@ config BT_MESH_SAR_CFG_CLI help Enable support for the SAR configuration client model. -config BT_MESH_OP_AGG - bool - -config BT_MESH_OP_AGG_SRV - bool "Support for Opcode Aggregator Server Model" - select BT_MESH_OP_AGG - help - Enable support for the Opcode Aggregator Server model. - -config BT_MESH_OP_AGG_CLI - bool "Support for Opcode Aggregator Client Model" - select BT_MESH_OP_AGG - help - Enable support for the Opcode Aggregator Client model. - -if BT_MESH_OP_AGG_CLI - -config BT_MESH_OP_AGG_CLI_TIMEOUT - int "Opcodes Aggregator Client model timeout in milliseconds" - default 10000 - help - This timeout controls how long Opcodes Aggregator Client waits - for a response message to arrive. This value can be changed at - runtime using @ref bt_mesh_op_agg_cli_timeout_set. - -endif # BT_MESH_OP_AGG_CLI - -config BT_MESH_LARGE_COMP_DATA_SRV - bool "Support for Large Composition Data Server Model" - help - Enable support for the Large Composition Data Server model. - endmenu # Models menu "Proxy" @@ -1526,6 +1494,38 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +config BT_MESH_OP_AGG + bool + +config BT_MESH_OP_AGG_SRV + bool "Support for Opcode Aggregator Server Model" + select BT_MESH_OP_AGG + help + Enable support for the Opcode Aggregator Server model. + +config BT_MESH_OP_AGG_CLI + bool "Support for Opcode Aggregator Client Model" + select BT_MESH_OP_AGG + help + Enable support for the Opcode Aggregator Client model. + +if BT_MESH_OP_AGG_CLI + +config BT_MESH_OP_AGG_CLI_TIMEOUT + int "Opcodes Aggregator Client model timeout in milliseconds" + default 10000 + help + This timeout controls how long Opcodes Aggregator Client waits + for a response message to arrive. This value can be changed at + runtime using @ref bt_mesh_op_agg_cli_timeout_set. + +endif # BT_MESH_OP_AGG_CLI + +config BT_MESH_LARGE_COMP_DATA_SRV + bool "Support for Large Composition Data Server Model" + help + Enable support for the Large Composition Data Server model. + if BT_MESH_LARGE_COMP_DATA_SRV config BT_MESH_MODELS_METADATA_PAGE_LEN From 8d05c85135c8a679959aedc41c507c615cfa4a9d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:13 +0100 Subject: [PATCH 1002/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move SAR models Kconfig options" This reverts commit 39fb5c567cdfbb368f45bca8352215cffaf77f8f. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 28316764852..95a7d468f83 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1097,21 +1097,6 @@ config BT_MESH_RPR_SRV_AD_DATA_MAX endmenu # Remote Provisioning configuration -config BT_MESH_SAR_CFG - bool - -config BT_MESH_SAR_CFG_SRV - bool "Support for SAR Configuration Server model" - select BT_MESH_SAR_CFG - help - Enable support for the SAR configuration server model. - -config BT_MESH_SAR_CFG_CLI - bool "Support for SAR Configuration Client Model" - select BT_MESH_SAR_CFG - help - Enable support for the SAR configuration client model. - endmenu # Models menu "Proxy" @@ -1494,6 +1479,21 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +config BT_MESH_SAR_CFG + bool + +config BT_MESH_SAR_CFG_SRV + bool "Support for SAR Configuration Server model" + select BT_MESH_SAR_CFG + help + Enable support for the SAR configuration server model. + +config BT_MESH_SAR_CFG_CLI + bool "Support for SAR Configuration Client Model" + select BT_MESH_SAR_CFG + help + Enable support for the SAR configuration client model. + config BT_MESH_OP_AGG bool From 6766b37e1a229ad0629a1cc5508b50c0c6ef2478 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:14 +0100 Subject: [PATCH 1003/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move RPR models Kconfig options" This reverts commit a1a2fcd3ed1fdcb2de195e67b207b6f43a0df050. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 95 +++++++++++++++++------------------ 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 95a7d468f83..a86bb076839 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1049,54 +1049,6 @@ config BT_MESH_DFD_SRV_OOB_UPLOAD endif -config BT_MESH_RPR_SRV - bool "Support for Remote Provisioning Server model" - help - The Remote Provisioning Server is the proxy for a provisioning - process, allowing provisioners to tunnel their provisioning - messages through the mesh to the Remote Provisioning Server, which - communicates directly with the unprovisioned node. - -config BT_MESH_RPR_CLI - bool "Support for Remote Provisioning Client model" - depends on BT_MESH_PROVISIONER - help - The Remote Provisioning Client is instantiated on the provisioner - node, and allows provisioning of new devices through the mesh network - by tunnelling provisioning messages to a Remote Provisioning Server. - -menu "Remote Provisioning configuration" - visible if BT_MESH_RPR_SRV || BT_MESH_RPR_CLI - -config BT_MESH_RPR_AD_TYPES_MAX - int "Max AD types in extended scanning" - default 1 - range 1 16 - help - During extended scanning, the Remote Provisioning Server can include - a set of AD types in the scan reports, collected from the - unprovisioned device's advertisement data. This option controls - the highest number of AD types a single server can scan for, and a - Client can request. - -config BT_MESH_RPR_SRV_SCANNED_ITEMS_MAX - int "Max scannable unprovisioned devices for Remote Provisioning Server" - default 4 - range 4 255 - help - Max number of unique unprovisioned devices a single Remote - Provisioning Server can hold. - -config BT_MESH_RPR_SRV_AD_DATA_MAX - int "Max additional advertisement data to report" - default 31 - range 3 255 - help - Buffer size for the additional advertisement data reported during - extended scanning. - -endmenu # Remote Provisioning configuration - endmenu # Models menu "Proxy" @@ -1479,6 +1431,53 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +config BT_MESH_RPR_SRV + bool "Support for Remote Provisioning Server model" + help + The Remote Provisioning Server is the proxy for a provisioning + process, allowing provisioners to tunnel their provisioning + messages through the mesh to the Remote Provisioning Server, which + communicates directly with the unprovisioned node. + +config BT_MESH_RPR_CLI + bool "Support for Remote Provisioning Client model" + depends on BT_MESH_PROVISIONER + help + The Remote Provisioning Client is instantiated on the provisioner + node, and allows provisioning of new devices through the mesh network + by tunnelling provisioning messages to a Remote Provisioning Server. + +menu "Remote Provisioning configuration" + visible if BT_MESH_RPR_SRV || BT_MESH_RPR_CLI + +config BT_MESH_RPR_AD_TYPES_MAX + int "Max AD types in extended scanning" + default 1 + range 1 16 + help + During extended scanning, the Remote Provisioning Server can include + a set of AD types in the scan reports, collected from the + unprovisioned device's advertisement data. This option controls + the highest number of AD types a single server can scan for, and a + Client can request. + +config BT_MESH_RPR_SRV_SCANNED_ITEMS_MAX + int "Max scannable unprovisioned devices for Remote Provisioning Server" + default 4 + range 4 255 + help + Max number of unique unprovisioned devices a single Remote + Provisioning Server can hold. + +config BT_MESH_RPR_SRV_AD_DATA_MAX + int "Max additional advertisement data to report" + default 31 + range 3 255 + help + Buffer size for the additional advertisement data reported during + extended scanning. +endmenu + config BT_MESH_SAR_CFG bool From 57b89e8834857bda21794d112bd863430ae7bd82 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:14 +0100 Subject: [PATCH 1004/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move DFU models Kconfig options" This reverts commit 260c2c0331280bae8c1db7331b848f7e3f9a4c02. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 190 +++++++++++++++++----------------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index a86bb076839..55cea1faa65 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -954,101 +954,6 @@ config BT_MESH_DFU_CLI help Enable the Firmware Update Client model. -menu "Firmware Update model configuration" - visible if BT_MESH_DFU_SRV || BT_MESH_DFU_CLI - -config BT_MESH_DFU_FWID_MAXLEN - int "DFU FWID max length" - default 16 - range 0 106 - help - This value defines the maximum length of an image's firmware ID. - -config BT_MESH_DFU_METADATA_MAXLEN - int "DFU metadata max length" - default 32 - range 18 255 if BT_MESH_DFU_METADATA - range 0 255 - help - This value defines the maximum length of an image's metadata. - -config BT_MESH_DFU_METADATA - bool "Support for the default metadata format" - help - This option adds a set of functions that can be used to encode and decode a firmware - metadata using the format defined in the Bluetooth Mesh DFU subsystem. - -config BT_MESH_DFU_URI_MAXLEN - int "DFU URI max length" - default 32 - range 0 255 - help - This value defines the maximum length of an image's URI, not including - a string terminator. - -endmenu # Firmware Update model configuration - -menuconfig BT_MESH_DFU_SLOTS - bool "Firmware image slot manager" - default y if BT_MESH_DFU_CLI - help - Enable the DFU image slot manager, for managing firmware distribution slots - for the Firmware Update Client model. - -if BT_MESH_DFU_SLOTS - -config BT_MESH_DFU_SLOT_CNT - int "Number of firmware image slots" - default 1 - range 1 32767 - help - This value defines the number of firmware slots the DFU image slot manager - can keep simultaneously. - -endif - -menuconfig BT_MESH_DFD_SRV - bool "Support for Firmware Distribution Server model" - depends on BT_MESH_BLOB_SRV - depends on BT_MESH_DFU_CLI - help - Enable the Firmware Distribution Server model. - -if BT_MESH_DFD_SRV - -config BT_MESH_DFD_SRV_SLOT_MAX_SIZE - int "Largest DFU image that can be stored" - default BT_MESH_BLOB_SIZE_MAX - range 0 BT_MESH_BLOB_SIZE_MAX - help - This value defines the largest DFU image a single slot can store. - -config BT_MESH_DFD_SRV_SLOT_SPACE - int "Total DFU image storage space" - default BT_MESH_DFD_SRV_SLOT_MAX_SIZE - range 0 4294967295 - help - This value defines the total storage space dedicated to storing DFU - images on the Firmware Distribution Server. - -config BT_MESH_DFD_SRV_TARGETS_MAX - int "Maximum Target node count" - default 8 - range 1 65535 - help - This value defines the maximum number of Target nodes the Firmware - Distribution Server can target simultaneously. - -config BT_MESH_DFD_SRV_OOB_UPLOAD - bool "Support for DFU image OOB upload" - help - This enables support for OOB upload of firmware images for - distribution. This makes several callbacks and use of the init - macro BT_MESH_DFD_SRV_INIT_OOB mandatory. See the API documentation - for bt_mesh_dfd_srv_cb for details about the mandatory callbacks. - -endif - endmenu # Models menu "Proxy" @@ -1431,6 +1336,101 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +menu "Firmware Update model configuration" + visible if BT_MESH_DFU_SRV || BT_MESH_DFU_CLI + +config BT_MESH_DFU_FWID_MAXLEN + int "DFU FWID max length" + default 16 + range 0 106 + help + This value defines the maximum length of an image's firmware ID. + +config BT_MESH_DFU_METADATA_MAXLEN + int "DFU metadata max length" + default 32 + range 18 255 if BT_MESH_DFU_METADATA + range 0 255 + help + This value defines the maximum length of an image's metadata. + +config BT_MESH_DFU_METADATA + bool "Support for the default metadata format" + help + This option adds a set of functions that can be used to encode and decode a firmware + metadata using the format defined in the Bluetooth Mesh DFU subsystem. + +config BT_MESH_DFU_URI_MAXLEN + int "DFU URI max length" + default 32 + range 0 255 + help + This value defines the maximum length of an image's URI, not including + a string terminator. + +endmenu + +menuconfig BT_MESH_DFU_SLOTS + bool "Firmware image slot manager" + default y if BT_MESH_DFU_CLI + help + Enable the DFU image slot manager, for managing firmware distribution slots + for the Firmware Update Client model. + +if BT_MESH_DFU_SLOTS + +config BT_MESH_DFU_SLOT_CNT + int "Number of firmware image slots" + default 1 + range 1 32767 + help + This value defines the number of firmware slots the DFU image slot manager + can keep simultaneously. + +endif + +menuconfig BT_MESH_DFD_SRV + bool "Support for Firmware Distribution Server model" + depends on BT_MESH_BLOB_SRV + depends on BT_MESH_DFU_CLI + help + Enable the Firmware Distribution Server model. + +if BT_MESH_DFD_SRV + +config BT_MESH_DFD_SRV_SLOT_MAX_SIZE + int "Largest DFU image that can be stored" + default BT_MESH_BLOB_SIZE_MAX + range 0 BT_MESH_BLOB_SIZE_MAX + help + This value defines the largest DFU image a single slot can store. + +config BT_MESH_DFD_SRV_SLOT_SPACE + int "Total DFU image storage space" + default BT_MESH_DFD_SRV_SLOT_MAX_SIZE + range 0 4294967295 + help + This value defines the total storage space dedicated to storing DFU + images on the Firmware Distribution Server. + +config BT_MESH_DFD_SRV_TARGETS_MAX + int "Maximum Target node count" + default 8 + range 1 65535 + help + This value defines the maximum number of Target nodes the Firmware + Distribution Server can target simultaneously. + +config BT_MESH_DFD_SRV_OOB_UPLOAD + bool "Support for DFU image OOB upload" + help + This enables support for OOB upload of firmware images for + distribution. This makes several callbacks and use of the init + macro BT_MESH_DFD_SRV_INIT_OOB mandatory. See the API documentation + for bt_mesh_dfd_srv_cb for details about the mandatory callbacks. + +endif + config BT_MESH_RPR_SRV bool "Support for Remote Provisioning Server model" help From a5b4db58a6bc1b81cc7a89d3eacdc4c70b02465a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:14 +0100 Subject: [PATCH 1005/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move MBT models Kconfig options" This reverts commit 30ef569abe584721c9b0f739a969361adc79c607. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 210 +++++++++++++++++----------------- 1 file changed, 105 insertions(+), 105 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 55cea1faa65..8cf91f60221 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -849,111 +849,6 @@ config BT_MESH_HEALTH_CLI_TIMEOUT endif # BT_MESH_HEALTH_CLI -menuconfig BT_MESH_BLOB_SRV - bool "Support for BLOB Transfer Server model" - help - Enable the Binary Large Object (BLOB) Transfer Server model. - -if BT_MESH_BLOB_SRV - -config BT_MESH_BLOB_SRV_PULL_REQ_COUNT - int "Number of chunks to request for each pull" - default 4 - range 1 16 - help - In Pull mode (Pull BLOB Transfer Mode), the BLOB Transfer Server - requests a fixed number of chunks from the Client. Use this option to - control the chunk count in the request. If the BLOB Transfer Server - is instantiated on a Low Power node, the pull request count will be - trimmed to not overflow the Friend queue. - -config BT_MESH_BLOB_SIZE_MAX - int "Largest BLOB size in bytes" - default 524288 - range 1 3257617792 - help - The maximum object size a BLOB Transfer Server can receive. - -config BT_MESH_BLOB_BLOCK_SIZE_MIN - int "Minimum block size" - default 4096 - range 64 1048576 # 2^6 - 2^20 - help - Minimum acceptable block size in a BLOB transfer. The transfer block - size will be some number that is a power of two, and is between block - size min and block size max. If no such number exists, a compile - time warning will be issued. - -config BT_MESH_BLOB_BLOCK_SIZE_MAX - int "Maximum block size" - default 4096 - range BT_MESH_BLOB_BLOCK_SIZE_MIN 1048576 - help - Maximum acceptable block size in a BLOB transfer. The transfer block - size will be some number that is a power of two, and is between block - size min and block size max. If no such number exists, a compile - time warning will be issued. - -config BT_MESH_BLOB_REPORT_TIMEOUT - int "Partial Block Report interval in Pull mode" - default 10 - range 1 31 - help - The timer value that Pull BLOB Transfer Server uses to report missed chunks. - -endif # BT_MESH_BLOB_SRV - -menuconfig BT_MESH_BLOB_CLI - bool "Support for BLOB Transfer Client model" - help - Enable the Binary Large Object (BLOB) Transfer Client model. - -if BT_MESH_BLOB_CLI - -config BT_MESH_BLOB_CLI_BLOCK_RETRIES - int "Number of retries per block" - default 5 - help - Controls the number of times the client will attempt to resend missing - chunks to the BLOB receivers for every block. - -endif - -menu "BLOB models common configuration" - visible if BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI - -config BT_MESH_BLOB_CHUNK_COUNT_MAX - int "Maximum chunk count per block" - default 256 - range 1 2992 - help - A BLOB transfer contains several blocks. Each block is made up of - several chunks. This option controls the maximum chunk count per - block. - -endmenu - -config BT_MESH_BLOB_IO_FLASH - bool "BLOB flash stream" - default y - depends on BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI - depends on FLASH_MAP - help - Enable the BLOB flash stream for reading and writing BLOBs directly to - and from flash. - -config BT_MESH_DFU_SRV - bool "Support for Firmware Update Server model" - depends on BT_MESH_BLOB_SRV - help - Enable the Firmware Update Server model. - -config BT_MESH_DFU_CLI - bool "Support for Firmware Update Client model" - depends on BT_MESH_BLOB_CLI - help - Enable the Firmware Update Client model. - endmenu # Models menu "Proxy" @@ -1336,6 +1231,111 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +menuconfig BT_MESH_BLOB_SRV + bool "Support for BLOB Transfer Server model" + help + Enable the Binary Large Object (BLOB) Transfer Server model. + +if BT_MESH_BLOB_SRV + +config BT_MESH_BLOB_SRV_PULL_REQ_COUNT + int "Number of chunks to request for each pull" + default 4 + range 1 16 + help + In Pull mode (Pull BLOB Transfer Mode), the BLOB Transfer Server + requests a fixed number of chunks from the Client. Use this option to + control the chunk count in the request. If the BLOB Transfer Server + is instantiated on a Low Power node, the pull request count will be + trimmed to not overflow the Friend queue. + +config BT_MESH_BLOB_SIZE_MAX + int "Largest BLOB size in bytes" + default 524288 + range 1 3257617792 + help + The maximum object size a BLOB Transfer Server can receive. + +config BT_MESH_BLOB_BLOCK_SIZE_MIN + int "Minimum block size" + default 4096 + range 64 1048576 # 2^6 - 2^20 + help + Minimum acceptable block size in a BLOB transfer. The transfer block + size will be some number that is a power of two, and is between block + size min and block size max. If no such number exists, a compile + time warning will be issued. + +config BT_MESH_BLOB_BLOCK_SIZE_MAX + int "Maximum block size" + default 4096 + range BT_MESH_BLOB_BLOCK_SIZE_MIN 1048576 + help + Maximum acceptable block size in a BLOB transfer. The transfer block + size will be some number that is a power of two, and is between block + size min and block size max. If no such number exists, a compile + time warning will be issued. + +config BT_MESH_BLOB_REPORT_TIMEOUT + int "Partial Block Report interval in Pull mode" + default 10 + range 1 31 + help + The timer value that Pull BLOB Transfer Server uses to report missed chunks. + +endif # BT_MESH_BLOB_SRV + +menuconfig BT_MESH_BLOB_CLI + bool "Support for BLOB Transfer Client model" + help + Enable the Binary Large Object (BLOB) Transfer Client model. + +if BT_MESH_BLOB_CLI + +config BT_MESH_BLOB_CLI_BLOCK_RETRIES + int "Number of retries per block" + default 5 + help + Controls the number of times the client will attempt to resend missing + chunks to the BLOB receivers for every block. + +endif + +menu "BLOB models common configuration" + visible if BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI + +config BT_MESH_BLOB_CHUNK_COUNT_MAX + int "Maximum chunk count per block" + default 256 + range 1 2992 + help + A BLOB transfer contains several blocks. Each block is made up of + several chunks. This option controls the maximum chunk count per + block. + +endmenu + +config BT_MESH_BLOB_IO_FLASH + bool "BLOB flash stream" + default y + depends on BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI + depends on FLASH_MAP + help + Enable the BLOB flash stream for reading and writing BLOBs directly to + and from flash. + +config BT_MESH_DFU_SRV + bool "Support for Firmware Update Server model" + depends on BT_MESH_BLOB_SRV + help + Enable the Firmware Update Server model. + +config BT_MESH_DFU_CLI + bool "Support for Firmware Update Client model" + depends on BT_MESH_BLOB_CLI + help + Enable the Firmware Update Client model. + menu "Firmware Update model configuration" visible if BT_MESH_DFU_SRV || BT_MESH_DFU_CLI From e3e5b0a36959c9d2939b066a1b538e0c0b8af419 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:14 +0100 Subject: [PATCH 1006/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move CDP 1.1 Kconfig options" This reverts commit 967a3049d9b2633901a91b411f0eb3e6d6a1d1b1. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 62 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 8cf91f60221..df16e0696af 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -710,37 +710,6 @@ config BT_MESH_MODEL_EXTENSIONS Enable support for the model extension concept, allowing the Access layer to know about mesh model relationships. -config BT_MESH_COMP_PAGE_1 - bool "Support for Composition Data Page 1" - depends on BT_MESH_MODEL_EXTENSIONS - help - Enable support for Composition Data Page 1. - -config BT_MESH_MODEL_EXTENSION_LIST_SIZE - int "Model extensions list size" - depends on BT_MESH_COMP_PAGE_1 - range 0 255 - default 10 - help - This option specifies how many models relations can be saved. - Equals to the number of `bt_mesh_model_extend` and `bt_mesh_model_correspond` calls. - This information is used to construct Composition Data Page 1. - -config BT_MESH_COMP_PAGE_2 - bool "Support for Composition Data Page 2" - help - Enable support for Composition Data Page 2. - -config BT_MESH_COMP_PST_BUF_SIZE - int "Composition Data Page persistence buffer size" - default 100 - help - Stack allocated buffer used to temporarily hold Composition - Data Pages during flash operations. Should reflect the size - of the largest Composition Data Page present in the application. - Note that this buffer should still be large enough to restore previously stored - pages after a performed device firmware update. - config BT_MESH_LABEL_NO_RECOVER bool "[DEPRECATED] Don't recover Label UUIDs from groups address subscription list" select DEPRECATED @@ -1561,6 +1530,37 @@ config BT_MESH_PRIV_BEACON_CLI endif # BT_MESH_PRIV_BEACONS +config BT_MESH_COMP_PST_BUF_SIZE + int "Composition Data Page persistence buffer size" + default 100 + help + Stack allocated buffer used to temporarily hold Composition + Data Pages during flash operations. Should reflect the size + of the largest Composition Data Page present in the application. + Note that this buffer should still be large enough to restore previously stored + pages after a performed device firmware update. + +config BT_MESH_COMP_PAGE_1 + bool "Support for Composition Data Page 1" + depends on BT_MESH_MODEL_EXTENSIONS + help + Enable support for Composition Data Page 1. + +config BT_MESH_COMP_PAGE_2 + bool "Support for Composition Data Page 2" + help + Enable support for Composition Data Page 2. + +config BT_MESH_MODEL_EXTENSION_LIST_SIZE + int "Model extensions list size" + depends on BT_MESH_COMP_PAGE_1 + range 0 255 + default 10 + help + This option specifies how many models relations can be saved. + Equals to the number of `bt_mesh_model_extend` and `bt_mesh_model_correspond` calls. + This information is used to construct Composition Data Page 1. + config BT_MESH_SOLICITATION bool From 3bb195f71b1c6867fa957f210210544551e64257 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:15 +0100 Subject: [PATCH 1007/2300] =?UTF-8?q?Revert=20"[nrf=20fromtree]=C2=A0Bluet?= =?UTF-8?q?ooth:=20Mesh:=20Move=20provisioning=201.1=20Kconfig=20options"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 703022a82847bf827f43c5edd0b8a47252822c0f. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index df16e0696af..d3c3397a63d 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -289,24 +289,6 @@ config BT_MESH_PROV_OOB_PUBLIC_KEY help Enable this option if public key is to be exchanged via Out of Band (OOB) technology. -config BT_MESH_ECDH_P256_CMAC_AES128_AES_CCM - bool "Support CMAC AES128 for OOB authentication" - depends on BT_MESH_PROV - default y - help - Enable this option to support CMAC AES128 for OOB authentication. - -config BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM - bool "Support HMAC SHA256 for OOB authentication" - depends on BT_MESH_PROV - default y - help - Enable this option to support HMAC SHA256 for OOB authentication. - -config BT_MESH_OOB_AUTH_REQUIRED - bool "OOB authentication mandates to use HMAC SHA256" - depends on BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM - config BT_MESH_PROVISIONER bool "Provisioner support" depends on BT_MESH_CDB @@ -1200,6 +1182,24 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +config BT_MESH_ECDH_P256_CMAC_AES128_AES_CCM + bool "Support CMAC AES128 for OOB authentication" + depends on BT_MESH_PROV + default y + help + Enable this option to support CMAC AES128 for OOB authentication. + +config BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM + bool "Support HMAC SHA256 for OOB authentication" + depends on BT_MESH_PROV + default y + help + Enable this option to support HMAC SHA256 for OOB authentication. + +config BT_MESH_OOB_AUTH_REQUIRED + bool "OOB authentication mandates to use HMAC SHA256" + depends on BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM + menuconfig BT_MESH_BLOB_SRV bool "Support for BLOB Transfer Server model" help From df711b23ebc1ad92f42e6a485c486f9f2b697298 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:15 +0100 Subject: [PATCH 1008/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Move mesh-1.1 transport sar configuration" This reverts commit 9a7f6aa37a26123cf818475d86042b74d680b8c8. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 244 +++++++++++++++++----------------- 1 file changed, 124 insertions(+), 120 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index d3c3397a63d..0f38a2e3ba0 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -512,126 +512,6 @@ config BT_MESH_TX_SEG_MAX which leaves 56 bytes for application layer data using a 4-byte MIC and 52 bytes using an 8-byte MIC. -config BT_MESH_SAR_TX_SEG_INT_STEP - hex "Interval between sending two consecutive segments" - range 0x00 0x0F - default 0x05 - help - This value controls the interval between sending two consecutive - segments in a segmented message. The interval is measured in - milliseconds and calculated using the following formula: - (CONFIG_BT_MESH_SAR_TX_SEG_INT_STEP + 1) * 10 ms. - -config BT_MESH_SAR_TX_UNICAST_RETRANS_COUNT - hex "Maximum number of retransmissions to unicast address" - range 0x00 0x0F - default 0x02 - help - This value controls the maximum number of retransmissions of a - segmented message to a unicast address before giving up the transfer. - -config BT_MESH_SAR_TX_UNICAST_RETRANS_WITHOUT_PROG_COUNT - hex "Maximum number of retransmissions without progress to a unicast address" - range 0x00 0x0F - default 0x02 - help - This value defines the maximum number of retransmissions of a - segmented message to a unicast address that the stack will send if no - acknowledgment was received during timeout, or if an - acknowledgment with already confirmed segments was received. - -config BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP - hex "Retransmissions interval step of missing segments to unicast address" - range 0x00 0x0F - default 0x07 - help - This value controls the interval step used for delaying the - retransmissions of unacknowledged segments of a segmented message to - a unicast address. The interval step is measured in milliseconds and - calculated using the following formula: - (CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP + 1) * 25 ms. - -config BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC - hex "Retransmissions interval increment of missing segments to unicast address" - range 0x00 0x0F - default 0x01 - help - This value controls the interval increment used for delaying the - retransmissions of unacknowledged segments of a segmented message to - a unicast address. The increment is measured in milliseconds and - calculated using the following formula: - (CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC + 1) * 25 ms. - -config BT_MESH_SAR_TX_MULTICAST_RETRANS_COUNT - hex "Total number of retransmissions to multicast address" - range 0x00 0x0F - default 0x02 - help - This value controls the total number of retransmissions of a segmented - message to a multicast address. - -config BT_MESH_SAR_TX_MULTICAST_RETRANS_INT - hex "Interval between retransmissions to multicast address" - range 0x00 0x0F - default 0x09 - help - This value controls the interval between retransmissions of all - segments in a segmented message to a multicast address. The - interval is measured in milliseconds and calculated using the - following formula: - (CONFIG_BT_MESH_SAR_TX_MULTICAST_RETRANS_INT + 1) * 25 ms. - -config BT_MESH_SAR_RX_SEG_THRESHOLD - hex "Acknowledgments retransmission threshold" - range 0x00 0x1F - default 0x03 - help - This value defines a threshold in number of segments of a segmented - message for acknowledgment retransmissions. When the number of - segments of a segmented message is above this threshold, the stack - will additionally retransmit every acknowledgment message the - number of times given by value of CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT. - -config BT_MESH_SAR_RX_ACK_DELAY_INC - hex "Acknowledgment delay increment" - range 0x00 0x07 - default 0x01 - help - This value controls the delay increment of an interval used for - delaying the transmission of an acknowledgment message after - receiving a new segment. The increment is measured in segments - and calculated using the following formula: - CONFIG_BT_MESH_SAR_RX_ACK_DELAY_INC + 1.5. - -config BT_MESH_SAR_RX_SEG_INT_STEP - hex "Segments reception interval step" - range 0x00 0x0F - default 0x05 - help - This value defines the segments reception interval step used for - delaying the transmission of an acknowledgment message after - receiving a new segmnet. The interval is measured in milliseconds - and calculated using the following formula: - (CONFIG_BT_MESH_SAR_RX_SEG_INT_STEP + 1) * 10 ms - -config BT_MESH_SAR_RX_DISCARD_TIMEOUT - hex "Discard timeout for reception of a segmented message" - range 0x00 0x0F - default 0x01 - help - This value defines the time since the last successfully received - segment before giving up the reception of a segmented message. - -config BT_MESH_SAR_RX_ACK_RETRANS_COUNT - hex "Total number of acknowledgment message retransmission" - range 0x00 0x03 - default 0x00 - help - This value defines the total number of retranmissions of an - acknowledgment message that the stack will additionally send when the - size of segments in a segmented message is above the - CONFIG_BT_MESH_SAR_RX_SEG_THRESHOLD value. - endmenu # Transport SAR configuration config BT_MESH_DEFAULT_TTL @@ -1634,6 +1514,130 @@ config BT_MESH_SOL_PDU_RPL_CLI_TIMEOUT for a response message to arrive. This value can be changed at runtime using @ref bt_mesh_sol_pdu_rpl_cli_timeout_set. +menu "Transport SAR configuration" + +config BT_MESH_SAR_TX_SEG_INT_STEP + hex "Interval between sending two consecutive segments" + range 0x00 0x0F + default 0x05 + help + This value controls the interval between sending two consecutive + segments in a segmented message. The interval is measured in + milliseconds and calculated using the following formula: + (CONFIG_BT_MESH_SAR_TX_SEG_INT_STEP + 1) * 10 ms. + +config BT_MESH_SAR_TX_UNICAST_RETRANS_COUNT + hex "Maximum number of retransmissions to unicast address" + range 0x00 0x0F + default 0x02 + help + This value controls the maximum number of retransmissions of a + segmented message to a unicast address before giving up the transfer. + +config BT_MESH_SAR_TX_UNICAST_RETRANS_WITHOUT_PROG_COUNT + hex "Maximum number of retransmissions without progress to a unicast address" + range 0x00 0x0F + default 0x02 + help + This value defines the maximum number of retransmissions of a + segmented message to a unicast address that the stack will send if no + acknowledgment was received during timeout, or if an + acknowledgment with already confirmed segments was received. + +config BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP + hex "Retransmissions interval step of missing segments to unicast address" + range 0x00 0x0F + default 0x07 + help + This value controls the interval step used for delaying the + retransmissions of unacknowledged segments of a segmented message to + a unicast address. The interval step is measured in milliseconds and + calculated using the following formula: + (CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP + 1) * 25 ms. + +config BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC + hex "Retransmissions interval increment of missing segments to unicast address" + range 0x00 0x0F + default 0x01 + help + This value controls the interval increment used for delaying the + retransmissions of unacknowledged segments of a segmented message to + a unicast address. The increment is measured in milliseconds and + calculated using the following formula: + (CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC + 1) * 25 ms. + +config BT_MESH_SAR_TX_MULTICAST_RETRANS_COUNT + hex "Total number of retransmissions to multicast address" + range 0x00 0x0F + default 0x02 + help + This value controls the total number of retransmissions of a segmented + message to a multicast address. + +config BT_MESH_SAR_TX_MULTICAST_RETRANS_INT + hex "Interval between retransmissions to multicast address" + range 0x00 0x0F + default 0x09 + help + This value controls the interval between retransmissions of all + segments in a segmented message to a multicast address. The + interval is measured in milliseconds and calculated using the + following formula: + (CONFIG_BT_MESH_SAR_TX_MULTICAST_RETRANS_INT + 1) * 25 ms. + +config BT_MESH_SAR_RX_SEG_THRESHOLD + hex "Acknowledgments retransmission threshold" + range 0x00 0x1F + default 0x03 + help + This value defines a threshold in number of segments of a segmented + message for acknowledgment retransmissions. When the number of + segments of a segmented message is above this threshold, the stack + will additionally retransmit every acknowledgment message the + number of times given by value of CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT. + +config BT_MESH_SAR_RX_ACK_DELAY_INC + hex "Acknowledgment delay increment" + range 0x00 0x07 + default 0x01 + help + This value controls the delay increment of an interval used for + delaying the transmission of an acknowledgment message after + receiving a new segment. The increment is measured in segments + and calculated using the following formula: + CONFIG_BT_MESH_SAR_RX_ACK_DELAY_INC + 1.5. + +config BT_MESH_SAR_RX_SEG_INT_STEP + hex "Segments reception interval step" + range 0x00 0x0F + default 0x05 + help + This value defines the segments reception interval step used for + delaying the transmission of an acknowledgment message after + receiving a new segmnet. The interval is measured in milliseconds + and calculated using the following formula: + (CONFIG_BT_MESH_SAR_RX_SEG_INT_STEP + 1) * 10 ms + +config BT_MESH_SAR_RX_DISCARD_TIMEOUT + hex "Discard timeout for reception of a segmented message" + range 0x00 0x0F + default 0x01 + help + This value defines the time since the last successfully received + segment before giving up the reception of a segmented message. + +config BT_MESH_SAR_RX_ACK_RETRANS_COUNT + hex "Total number of acknowledgment message retransmission" + range 0x00 0x03 + default 0x00 + help + This value defines the total number of retranmissions of an + acknowledgment message that the stack will additionally send when the + size of segments in a segmented message is above the + CONFIG_BT_MESH_SAR_RX_SEG_THRESHOLD value. + +endmenu + menu "Capabilities" config BT_MESH_SUBNET_COUNT From 47f31968dad46bf6ddb82a6fb390721e1cc0fefa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:15 +0100 Subject: [PATCH 1009/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Drop explicit support for Bluetooth Mesh 1.0.1" This reverts commit 2f87aac6b97873a65ee636d74597e32be407a900. Signed-off-by: Robert Lubos --- doc/connectivity/bluetooth/api/mesh.rst | 5 +- .../bluetooth/api/mesh/access.rst | 9 + .../bluetooth/api/mesh/sar_cfg.rst | 56 +- doc/releases/migration-guide-3.6.rst | 19 - doc/releases/release-notes-3.6.rst | 1 - include/zephyr/bluetooth/mesh/main.h | 4 + subsys/bluetooth/mesh/CMakeLists.txt | 7 +- subsys/bluetooth/mesh/Kconfig | 62 +- subsys/bluetooth/mesh/access.c | 3 +- subsys/bluetooth/mesh/beacon.c | 6 + subsys/bluetooth/mesh/net.c | 5 + subsys/bluetooth/mesh/subnet.h | 2 + subsys/bluetooth/mesh/transport_legacy.c | 1656 +++++++++++++++++ tests/bluetooth/mesh/blob_io_flash/prj.conf | 1 + .../mesh_shell/proxy_solicitation.conf | 1 + tests/bluetooth/tester/overlay-mesh-v1d1.conf | 30 + tests/bluetooth/tester/overlay-mesh.conf | 29 - tests/bluetooth/tester/testcase.yaml | 10 + tests/bsim/bluetooth/mesh/CMakeLists.txt | 45 +- tests/bsim/bluetooth/mesh/compile.sh | 21 +- tests/bsim/bluetooth/mesh/overlay_pst.conf | 3 + tests/bsim/bluetooth/mesh/prj.conf | 28 +- tests/bsim/bluetooth/mesh/prj_mesh1d1.conf | 73 + tests/bsim/bluetooth/mesh/src/main.c | 17 +- tests/bsim/bluetooth/mesh/src/test_beacon.c | 17 +- .../bsim/bluetooth/mesh/src/test_provision.c | 4 + .../bluetooth/mesh/src/test_replay_cache.c | 4 + .../bsim/bluetooth/mesh/src/test_transport.c | 2 + .../tests_scripts/access/access_cancel.sh | 5 + .../tests_scripts/access/access_ext_sub.sh | 5 + .../access/access_ext_sub_cap.sh | 4 + .../tests_scripts/access/access_period.sh | 5 + .../access/access_period_delayable.sh | 5 + .../tests_scripts/access/access_transmit.sh | 5 + .../access/access_transmit_delayable.sh | 5 + .../tests_scripts/advertiser/proxy_mixin.sh | 5 + .../tests_scripts/advertiser/random_order.sh | 4 + .../tests_scripts/advertiser/reverse_order.sh | 4 + .../tests_scripts/advertiser/send_order.sh | 4 + .../tests_scripts/advertiser/tx_cb_multi.sh | 4 + .../tests_scripts/advertiser/tx_cb_single.sh | 4 + .../mesh/tests_scripts/beacon/beacon_cache.sh | 6 + .../tests_scripts/beacon/beacon_interval.sh | 6 + .../mesh/tests_scripts/beacon/invalid.sh | 6 + .../mesh/tests_scripts/beacon/iv_update.sh | 6 + .../mesh/tests_scripts/beacon/key_refresh.sh | 6 + .../mesh/tests_scripts/beacon/kr_old_key.sh | 6 + .../tests_scripts/beacon/multiple_netkeys.sh | 6 + .../blob_mdls/blob_cli_broadcast_basic.sh | 2 + .../blob_mdls/blob_cli_broadcast_trans.sh | 2 + .../blob_mdls/blob_cli_broadcast_unicast.sh | 2 + .../blob_cli_broadcast_unicast_seq.sh | 2 + .../blob_mdls/blob_cli_caps_all_rsp.sh | 2 + .../blob_mdls/blob_cli_caps_cancelled.sh | 2 + .../blob_mdls/blob_cli_caps_no_rsp.sh | 2 + .../blob_mdls/blob_cli_caps_partial_rsp.sh | 2 + .../blob_mdls/blob_cli_friend.sh | 2 + .../blob_mdls/blob_cli_no_rsp_block.sh | 2 + .../blob_mdls/blob_cli_no_rsp_xfer.sh | 2 + .../blob_mdls/blob_cli_persistent_transfer.sh | 2 + .../blob_cli_persistent_transfer_pull.sh | 2 + .../blob_mdls/blob_cli_trans_complete_pull.sh | 2 + .../blob_mdls/blob_cli_trans_complete_push.sh | 2 + .../blob_mdls/blob_cli_trans_resume_pull.sh | 2 + .../blob_mdls/blob_cli_trans_resume_push.sh | 2 + .../blob_mdls/blob_srv_persistence.sh | 12 + .../comp_data/cdp1_encode_decode.sh | 2 + .../dfu/dfu_cli_all_targets_lost_on_apply.sh | 2 + .../dfu_cli_all_targets_lost_on_caps_get.sh | 2 + .../dfu_cli_all_targets_lost_on_metadata.sh | 2 + .../dfu_cli_all_targets_lost_on_update_get.sh | 2 + .../dfu/dfu_cli_all_targets_lost_on_verify.sh | 2 + .../dfu/dfu_cli_persistent_transfer.sh | 2 + .../tests_scripts/dfu/dfu_dist_self_update.sh | 2 + .../dfu/dfu_dist_self_update_mult_targets.sh | 2 + .../mesh/tests_scripts/dfu/dfu_mixed.sh | 2 + .../mesh/tests_scripts/dfu/dfu_mixed_fail.sh | 2 + .../mesh/tests_scripts/dfu/dfu_slot.sh | 2 + .../tests_scripts/dfu/dfu_slot_idempotency.sh | 2 + .../tests_scripts/dfu/dfu_slot_reservation.sh | 2 + .../tests_scripts/dfu/dfu_srv_persistence.sh | 14 + .../tests_scripts/friendship/establish.sh | 6 + .../friendship/establish_multi.sh | 10 + .../tests_scripts/friendship/lpn_disable.sh | 6 + .../tests_scripts/friendship/lpn_loopback.sh | 6 + .../friendship/lpn_terminate_cb.sh | 6 + .../mesh/tests_scripts/friendship/msg_frnd.sh | 6 + .../tests_scripts/friendship/msg_group.sh | 7 + .../mesh/tests_scripts/friendship/msg_mesh.sh | 7 + .../friendship/msg_mesh_low_lat.sh | 8 + .../friendship/msg_va_collision.sh | 6 + .../mesh/tests_scripts/friendship/overflow.sh | 6 + .../mesh/tests_scripts/friendship/poll.sh | 6 + .../tests_scripts/friendship/re-establish.sh | 6 + .../tests_scripts/heartbeat/sub_cb_api_all.sh | 7 + .../heartbeat/sub_cb_api_unicast.sh | 7 + .../tests_scripts/iv_index/iv_deferring.sh | 4 + .../tests_scripts/iv_index/iv_recovery.sh | 4 + .../mesh/tests_scripts/iv_index/iv_update.sh | 4 + .../large_comp_data/get_comp0_data_split.sh | 2 + .../get_comp0_data_split_dfu.sh | 2 + .../large_comp_data/get_comp128_data_split.sh | 2 + .../get_comp128_data_split_dfu.sh | 2 + .../large_comp_data/get_comp129_data_split.sh | 2 + .../get_comp129_data_split_dfu.sh | 2 + .../large_comp_data/get_comp130_data_split.sh | 2 + .../get_comp130_data_split_dfu.sh | 2 + .../large_comp_data/get_comp1_data_split.sh | 2 + .../get_comp1_data_split_dfu.sh | 2 + .../large_comp_data/get_comp2_data_split.sh | 2 + .../get_comp2_data_split_dfu.sh | 2 + .../large_comp_data/get_comp_data_max_sdu.sh | 2 + .../large_comp_data/get_metadata_max_sdu.sh | 2 + .../large_comp_data/get_metadata_split.sh | 2 + .../op_agg/full_status_msg_list.sh | 2 + .../mesh/tests_scripts/op_agg/loopback.sh | 2 + .../mesh/tests_scripts/op_agg/model_coex.sh | 2 + .../mesh/tests_scripts/persistence/access.sh | 35 + .../mesh/tests_scripts/persistence/cfg.sh | 24 + .../tests_scripts/persistence/provisioning.sh | 10 + .../persistence/reprovisioning.sh | 14 + .../priv_beacon/priv_beacon_adv.sh | 2 + .../priv_beacon/priv_beacon_cache.sh | 2 + .../priv_beacon/priv_beacon_interleave.sh | 2 + .../priv_beacon/priv_beacon_invalid.sh | 2 + .../priv_beacon/priv_beacon_ivu.sh | 2 + .../priv_beacon_ivu_long_interval.sh | 2 + .../priv_beacon/priv_beacon_kr.sh | 2 + .../priv_beacon_kr_long_interval.sh | 2 + .../priv_beacon/priv_proxy_gatt.sh | 2 + .../priv_beacon/priv_proxy_net_id.sh | 2 + .../priv_beacon/priv_proxy_net_id_multi.sh | 2 + .../priv_beacon/priv_proxy_node_id.sh | 2 + .../proxy_adv_multi_subnet_coex.sh | 2 + .../provision/ivu_flag_one_duration.sh | 4 + .../provision/ivu_flag_zero_duration.sh | 4 + .../tests_scripts/provision/pb_adv_multi.sh | 8 + .../tests_scripts/provision/pb_adv_no_oob.sh | 6 + .../provision/pb_adv_oob_auth_ib_pk.sh | 5 + .../pb_adv_oob_auth_ignore_oob_pk.sh | 5 + .../provision/pb_adv_oob_auth_oob_pk.sh | 5 + .../provision/pb_adv_reprovision.sh | 6 + .../pb_remote_client_server_same_dev.sh | 2 + .../provision/pb_remote_nppi_robustness.sh | 2 + .../provision/pb_remote_parallel.sh | 2 + .../provision/pb_remote_pst_ncrp.sh | 6 + .../provision/pb_remote_reprovision.sh | 2 + .../provision/pb_remote_timeout.sh | 2 + .../replay_cache/replay_attack.sh | 14 + .../tests_scripts/replay_cache/rpl_frag.sh | 13 + .../sar/sar_cfg_persistent_storage.sh | 2 + .../tests_scripts/sar/slow_transfer_test.sh | 2 + .../mesh/tests_scripts/sar/stress_test.sh | 2 + .../tests_scripts/scanner/invalid_ad_type.sh | 6 + .../scanner/wrong_packet_length.sh | 6 + .../suspend/gatt_suspend_disable_resume.sh | 31 - .../suspend/gatt_suspend_resume.sh | 31 - .../suspend/suspend_disable_resume.sh | 28 - .../tests_scripts/suspend/suspend_resume.sh | 27 - .../mesh/tests_scripts/transport/fixed.sh | 4 + .../mesh/tests_scripts/transport/group.sh | 4 + .../mesh/tests_scripts/transport/loopback.sh | 4 + .../tests_scripts/transport/loopback_group.sh | 4 + .../transport/loopback_group_low_lat.sh | 5 + .../mesh/tests_scripts/transport/seg_block.sh | 4 + .../tests_scripts/transport/seg_concurrent.sh | 4 + .../mesh/tests_scripts/transport/seg_fail.sh | 4 + .../mesh/tests_scripts/transport/seg_ivu.sh | 4 + .../mesh/tests_scripts/transport/unicast.sh | 4 + .../transport/unicast_low_lat.sh | 5 + .../tests_scripts/transport/unknown_app.sh | 4 + .../mesh/tests_scripts/transport/va.sh | 4 + .../tests_scripts/transport/va_collision.sh | 4 + 173 files changed, 2609 insertions(+), 236 deletions(-) create mode 100644 subsys/bluetooth/mesh/transport_legacy.c create mode 100644 tests/bluetooth/tester/overlay-mesh-v1d1.conf create mode 100644 tests/bsim/bluetooth/mesh/prj_mesh1d1.conf delete mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_disable_resume.sh delete mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_resume.sh delete mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_disable_resume.sh delete mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_resume.sh diff --git a/doc/connectivity/bluetooth/api/mesh.rst b/doc/connectivity/bluetooth/api/mesh.rst index 358ba3dc62e..f234ff7cedc 100644 --- a/doc/connectivity/bluetooth/api/mesh.rst +++ b/doc/connectivity/bluetooth/api/mesh.rst @@ -5,7 +5,10 @@ Bluetooth Mesh Profile The Bluetooth Mesh profile adds secure wireless multi-hop communication for Bluetooth Low Energy. This module implements the -`Bluetooth Mesh Protocol Specification v1.1 `_. +`Bluetooth Mesh Profile Specification v1.0.1 `_. + +Implementation of the `Bluetooth Mesh Protocol Specification v1.1 `_ +is in experimental state. Read more about Bluetooth Mesh on the `Bluetooth SIG Website `_. diff --git a/doc/connectivity/bluetooth/api/mesh/access.rst b/doc/connectivity/bluetooth/api/mesh/access.rst index 7af8ca7ec68..cb02028b697 100644 --- a/doc/connectivity/bluetooth/api/mesh/access.rst +++ b/doc/connectivity/bluetooth/api/mesh/access.rst @@ -168,6 +168,15 @@ needs to be stored. Composition Data ================ +.. note:: + + The implementation of the Bluetooth Mesh Protocol Specification version 1.1 + is currently in an experimental state. For Bluetooth Mesh Profile Specification + version 1.0.1, only Composition Data Page 0 is supported. Users that are developing + for Bluetooth Mesh Profile Specification version 1.0.1 may therefore disregard all + parts of the following section mentioning the :ref:`bluetooth_mesh_lcd_srv` + model and Composition Data Pages 1, 2, 128, 129 and 130. + The Composition Data provides information about a mesh device. A device's Composition Data holds information about the elements on the device, the models that it supports, and other features. The Composition diff --git a/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst b/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst index 76bd0330a98..4f3354945c9 100644 --- a/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst +++ b/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst @@ -43,8 +43,36 @@ Keep this in mind when defining the size of the buffers. SAR does not impose extra overhead on the access layer payload per segment. +Intervals, timers and retransmission counters +********************************************* + +The current stable stack implementation allows you to configure the following SAR behavior. + +When sending a segmented message to a unicast address, the unacknowledged segments are repeated +the :kconfig:option:`CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT` number of times before the transmission +is considered as failed. The same option configures a number of retransmissions to a group or +virtual address, but the transmission always succeedes after retransmitting all segments the +configured number of times. + +The timeout between each retransmission to a unicast address is configured by the Kconfig option +:kconfig:option:`CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST`. The timeout between each +retransmission to a group or a virtual address is configured by the Kconfig option +:kconfig:option:`CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP`. + +The time before sending a Segment Acknowledgment message is controlled by the Kconfig options +:kconfig:option:`CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT`, +:kconfig:option:`CONFIG_BT_MESH_SEG_ACK_PER_HOP_TIMEOUT` and +:kconfig:option:`CONFIG_BT_MESH_SEG_ACK_PER_SEGMENT_TIMEOUT`, and is defined as: + +.. math:: + \begin{aligned} + \max(&\mathtt{CONFIG\_BT\_MESH\_SEG\_ACK\_BASE\_TIMEOUT} \\ + &+ \text{TTL} \times \mathtt{CONFIG\_BT\_MESH\_SEG\_ACK\_PER\_HOP\_TIMEOUT} \\ + &+ \text{number of un-acked segments} \times \mathtt{CONFIG\_BT\_MESH\_SEG\_ACK\_PER\_SEGMENT\_TIMEOUT} , 400) + \end{aligned} + Segmentation and reassembly (SAR) Configuration models -****************************************************** +====================================================== With Bluetooth Mesh Protocol Specification version 1.1, it became possible to configure SAR behavior, such as intervals, timers and retransmission counters, over a mesh network using SAR @@ -111,7 +139,7 @@ of the `SAR Acknowledgment Retransmissions Count`_ state. .. _bt_mesh_sar_cfg_states: SAR states -********** +========== There are two states defined related to segmentation and reassembly: @@ -140,7 +168,7 @@ the following states: * SAR Receiver Segment Interval Step SAR Segment Interval Step -========================= +------------------------- SAR Segment Interval Step state holds a value that controls the interval between transmissions of segments of a segmented message. The interval is measured in milliseconds. @@ -154,7 +182,7 @@ value. Segment transmission interval is then calculated using the following form SAR Unicast Retransmissions Count -================================= +--------------------------------- SAR Unicast Retransmissions Count holds a value that defines the maximum number of retransmissions of a segmented message to a unicast destination. Use the @@ -162,7 +190,7 @@ of a segmented message to a unicast destination. Use the value for this state. SAR Unicast Retransmissions Without Progress Count -================================================== +-------------------------------------------------- This state holds a value that defines the maximum number of retransmissions of a segmented message to a unicast address that will be sent if no acknowledgment was received during the timeout, or if @@ -171,7 +199,7 @@ an acknowledgment with already confirmed segments was received. Use the Kconfig of retransmissions. SAR Unicast Retransmissions Interval Step -========================================= +----------------------------------------- The value of this state controls the interval step used for delaying the retransmissions of unacknowledged segments of a segmented message to a unicast address. The interval step is measured @@ -186,7 +214,7 @@ default value. This value is then used to calculate the interval step using the SAR Unicast Retransmissions Interval Increment -============================================== +---------------------------------------------- SAR Unicast Retransmissions Interval Increment holds a value that controls the interval increment used for delaying the retransmissions of unacknowledged segments of a segmented message to a unicast @@ -202,7 +230,7 @@ formula: SAR Multicast Retransmissions Count -=================================== +----------------------------------- The state holds a value that controls the total number of retransmissions of a segmented message to a multicast address. Use the Kconfig option @@ -210,7 +238,7 @@ a multicast address. Use the Kconfig option retransmissions. SAR Multicast Retransmissions Interval Step -=========================================== +------------------------------------------- This state holds a value that controls the interval between retransmissions of all segments in a segmented message to a multicast address. The interval is measured in milliseconds. @@ -224,7 +252,7 @@ default value that is used to calculate the interval using the following formula SAR Discard Timeout -=================== +------------------- The value of this state defines the time in seconds that the lower transport layer waits after receiving segments of a segmented message before discarding that segmented message. Use the Kconfig @@ -237,7 +265,7 @@ timeout will be calculated using the following formula: SAR Acknowledgment Delay Increment -================================== +---------------------------------- This state holds a value that controls the delay increment of an interval used for delaying the transmission of an acknowledgment message after receiving a new segment. The increment is measured @@ -248,7 +276,7 @@ value. The increment value is calculated to be :math:`\verb|CONFIG_BT_MESH_SAR_RX_ACK_DELAY_INC| + 1.5`. SAR Segments Threshold -====================== +---------------------- SAR Segments Threshold state holds a value that defines a threshold in number of segments of a segmented message for acknowledgment retransmissions. Use the Kconfig option @@ -259,7 +287,7 @@ additionally retransmit every acknowledgment message the number of times given b :kconfig:option:`CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT`. SAR Acknowledgment Retransmissions Count -======================================== +---------------------------------------- The SAR Acknowledgment Retransmissions Count state controls the number of retransmissions of Segment Acknowledgment messages sent by the lower transport layer. It gives the total number of @@ -272,7 +300,7 @@ value for this state. The maximum number of transmissions of a Segment Acknowle :math:`\verb|CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT| + 1`. SAR Receiver Segment Interval Step -================================== +---------------------------------- The SAR Receiver Segment Interval Step defines the segments reception interval step used for delaying the transmission of an acknowledgment message after receiving a new segment. The interval diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index 8428e2a4645..c4cb37eaf94 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -135,25 +135,6 @@ Bluetooth * Deprecated :kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE`. This option is replaced by new option :kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` to be aligned with Mesh Protocol Specification v1.1, section 5.4. (:github:`64252`) - * Removed the ``CONFIG_BT_MESH_V1d1`` Kconfig option. - * Removed the ``CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT``, - ``CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST``, - ``CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP``, ``CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT``, - ``CONFIG_BT_MESH_SEG_ACK_PER_HOP_TIMEOUT``, ``BT_MESH_SEG_ACK_PER_SEGMENT_TIMEOUT`` - Kconfig options. They are superseded by the - :kconfig:option:`CONFIG_BT_MESH_SAR_TX_SEG_INT_STEP`, - :kconfig:option:`CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_COUNT`, - :kconfig:option:`CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_WITHOUT_PROG_COUNT`, - :kconfig:option:`CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_STEP`, - :kconfig:option:`CONFIG_BT_MESH_SAR_TX_UNICAST_RETRANS_INT_INC`, - :kconfig:option:`CONFIG_BT_MESH_SAR_TX_MULTICAST_RETRANS_COUNT`, - :kconfig:option:`CONFIG_BT_MESH_SAR_TX_MULTICAST_RETRANS_INT`, - :kconfig:option:`CONFIG_BT_MESH_SAR_RX_SEG_THRESHOLD`, - :kconfig:option:`CONFIG_BT_MESH_SAR_RX_ACK_DELAY_INC`, - :kconfig:option:`CONFIG_BT_MESH_SAR_RX_SEG_INT_STEP`, - :kconfig:option:`CONFIG_BT_MESH_SAR_RX_DISCARD_TIMEOUT`, - :kconfig:option:`CONFIG_BT_MESH_SAR_RX_ACK_RETRANS_COUNT` Kconfig options. - LoRaWAN ======= diff --git a/doc/releases/release-notes-3.6.rst b/doc/releases/release-notes-3.6.rst index 31dcb4c8dcd..f4d813432b1 100644 --- a/doc/releases/release-notes-3.6.rst +++ b/doc/releases/release-notes-3.6.rst @@ -56,7 +56,6 @@ Bluetooth the transmitted responses on the Access layer. The functionality is enabled by the :kconfig:option:`CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG` Kconfig option. - * The Bluetooth Mesh Protocol 1.1 is now supported by default. * Controller diff --git a/include/zephyr/bluetooth/mesh/main.h b/include/zephyr/bluetooth/mesh/main.h index 1622ccebbd8..a213e8ce22c 100644 --- a/include/zephyr/bluetooth/mesh/main.h +++ b/include/zephyr/bluetooth/mesh/main.h @@ -783,6 +783,7 @@ struct bt_mesh_snb { uint64_t auth_val; }; +#if defined(CONFIG_BT_MESH_V1d1) struct bt_mesh_prb { /** Random */ uint8_t random[13]; @@ -796,6 +797,7 @@ struct bt_mesh_prb { /** Authentication tag */ uint64_t auth_tag; }; +#endif /** Beacon callback functions. */ struct bt_mesh_beacon_cb { @@ -808,6 +810,7 @@ struct bt_mesh_beacon_cb { */ void (*snb_received)(const struct bt_mesh_snb *snb); +#if defined(CONFIG_BT_MESH_V1d1) /** @brief Private Beacon received. * * This callback notifies the application that Private Beacon @@ -816,6 +819,7 @@ struct bt_mesh_beacon_cb { * @param prb Structure describing received Private Beacon */ void (*priv_received)(const struct bt_mesh_prb *prb); +#endif }; /** diff --git a/subsys/bluetooth/mesh/CMakeLists.txt b/subsys/bluetooth/mesh/CMakeLists.txt index 5d4f41ce7f7..fe4444b28ab 100644 --- a/subsys/bluetooth/mesh/CMakeLists.txt +++ b/subsys/bluetooth/mesh/CMakeLists.txt @@ -18,9 +18,14 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH cfg_srv.c health_srv.c va.c - transport.c ) +if (CONFIG_BT_MESH_V1d1) + zephyr_library_sources(transport.c) +else() + zephyr_library_sources(transport_legacy.c) +endif() + zephyr_library_sources_ifdef(CONFIG_BT_MESH_ADV_LEGACY adv_legacy.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_ADV_EXT adv_ext.c) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 0f38a2e3ba0..555aac45bc0 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -512,6 +512,56 @@ config BT_MESH_TX_SEG_MAX which leaves 56 bytes for application layer data using a 4-byte MIC and 52 bytes using an 8-byte MIC. +if !BT_MESH_V1d1 + +config BT_MESH_TX_SEG_RETRANS_COUNT + int "Transport message segment retransmit attempts" + default 4 + range 1 8 + help + Maximum number of transport message segment retransmit attempts + for outgoing segment message. + +config BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST + int "Transport message segment retransmit interval for unicast messages" + default 400 + range 200 500 + help + Maximum time of retransmit segment message to unicast address. + +config BT_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP + int "Transport message segment retransmit interval for group messages" + default 50 + range 20 200 + help + Maximum time of retransmit segment message to group address. + +config BT_MESH_SEG_ACK_BASE_TIMEOUT + int "SegAck transmission base timeout" + default 150 + range 150 400 + help + Defines a base timeout for the acknowledgment timer used to delay + transmission of the Segmented Acknowledgment message. + +config BT_MESH_SEG_ACK_PER_HOP_TIMEOUT + int "SegAck transmission timeout per hop" + default 50 + range 50 250 + help + Defines an additional per-hop timeout for the acknowledgment timer + used to delay transmission of the Segmented Acknowledgment message. + +config BT_MESH_SEG_ACK_PER_SEGMENT_TIMEOUT + int "SegAck transmission timeout per segment not yet received" + default 0 + range 0 100 + help + Defines an additional timeout for the acknowledgment timer for every + segment not yet received. + +endif # !BT_MESH_V1d1 + endmenu # Transport SAR configuration config BT_MESH_DEFAULT_TTL @@ -1062,13 +1112,21 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND +menuconfig BT_MESH_V1d1 + bool "Bluetooth Mesh v1.1 support" + help + This option enables Bluetooth Mesh v1.1 support. Bluetooth Mesh v1.1 + is backward compatible with v1.0.1. + config BT_MESH_ECDH_P256_CMAC_AES128_AES_CCM - bool "Support CMAC AES128 for OOB authentication" + bool "Support CMAC AES128 for OOB authentication" if BT_MESH_V1d1 depends on BT_MESH_PROV default y help Enable this option to support CMAC AES128 for OOB authentication. +if BT_MESH_V1d1 + config BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM bool "Support HMAC SHA256 for OOB authentication" depends on BT_MESH_PROV @@ -1638,6 +1696,8 @@ config BT_MESH_SAR_RX_ACK_RETRANS_COUNT endmenu +endif # BT_MESH_V1d1 + menu "Capabilities" config BT_MESH_SUBNET_COUNT diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 4ff80333187..23fbb8e82c2 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -2380,6 +2380,7 @@ size_t bt_mesh_comp_page_size(uint8_t page) int bt_mesh_comp_store(void) { +#if IS_ENABLED(CONFIG_BT_MESH_V1d1) NET_BUF_SIMPLE_DEFINE(buf, CONFIG_BT_MESH_COMP_PST_BUF_SIZE); int err; @@ -2409,7 +2410,7 @@ int bt_mesh_comp_store(void) LOG_DBG("Stored CDP%d", comp_data_pages[i].page); } - +#endif return 0; } diff --git a/subsys/bluetooth/mesh/beacon.c b/subsys/bluetooth/mesh/beacon.c index 6eb2c9be3a7..ef337f9f510 100644 --- a/subsys/bluetooth/mesh/beacon.c +++ b/subsys/bluetooth/mesh/beacon.c @@ -528,6 +528,7 @@ static bool secure_beacon_authenticate(struct bt_mesh_subnet *sub, void *cb_data return false; } +#if defined(CONFIG_BT_MESH_V1d1) static bool priv_beacon_decrypt(struct bt_mesh_subnet *sub, void *cb_data) { struct beacon_params *params = cb_data; @@ -566,6 +567,7 @@ static bool priv_beacon_decrypt(struct bt_mesh_subnet *sub, void *cb_data) return false; } +#endif static void net_beacon_register(struct bt_mesh_beacon *beacon, bool priv) { @@ -656,6 +658,7 @@ static void secure_beacon_recv(struct net_buf_simple *buf) net_beacon_resolve(¶ms, secure_beacon_authenticate); } +#if defined(CONFIG_BT_MESH_V1d1) static void private_beacon_recv(struct net_buf_simple *buf) { struct beacon_params params; @@ -672,6 +675,7 @@ static void private_beacon_recv(struct net_buf_simple *buf) net_beacon_resolve(¶ms, priv_beacon_decrypt); } +#endif void bt_mesh_beacon_recv(struct net_buf_simple *buf) { @@ -695,7 +699,9 @@ void bt_mesh_beacon_recv(struct net_buf_simple *buf) secure_beacon_recv(buf); break; case BEACON_TYPE_PRIVATE: +#if defined(CONFIG_BT_MESH_V1d1) private_beacon_recv(buf); +#endif break; default: LOG_WRN("Unknown beacon type 0x%02x", type); diff --git a/subsys/bluetooth/mesh/net.c b/subsys/bluetooth/mesh/net.c index 07c6f1aa18a..943a5e83c23 100644 --- a/subsys/bluetooth/mesh/net.c +++ b/subsys/bluetooth/mesh/net.c @@ -35,7 +35,10 @@ #include "prov.h" #include "cfg.h" #include "statistic.h" + +#ifdef CONFIG_BT_MESH_V1d1 #include "sar_cfg_internal.h" +#endif #define LOG_LEVEL CONFIG_BT_MESH_NET_LOG_LEVEL #include @@ -81,8 +84,10 @@ static uint16_t msg_cache_next; /* Singleton network context (the implementation only supports one) */ struct bt_mesh_net bt_mesh = { .local_queue = SYS_SLIST_STATIC_INIT(&bt_mesh.local_queue), +#ifdef CONFIG_BT_MESH_V1d1 .sar_tx = BT_MESH_SAR_TX_INIT, .sar_rx = BT_MESH_SAR_RX_INIT, +#endif #if defined(CONFIG_BT_MESH_PRIV_BEACONS) .priv_beacon_int = 0x3c, diff --git a/subsys/bluetooth/mesh/subnet.h b/subsys/bluetooth/mesh/subnet.h index e04f9855b66..f19b1d2abea 100644 --- a/subsys/bluetooth/mesh/subnet.h +++ b/subsys/bluetooth/mesh/subnet.h @@ -76,7 +76,9 @@ struct bt_mesh_subnet { struct bt_mesh_key identity; /* IdentityKey */ #endif struct bt_mesh_key beacon; /* BeaconKey */ +#if defined(CONFIG_BT_MESH_V1d1) struct bt_mesh_key priv_beacon; /* PrivateBeaconKey */ +#endif } keys[2]; #if defined(CONFIG_BT_MESH_PROXY_SOLICITATION) bool sol_tx; diff --git a/subsys/bluetooth/mesh/transport_legacy.c b/subsys/bluetooth/mesh/transport_legacy.c new file mode 100644 index 00000000000..1a826db4ac4 --- /dev/null +++ b/subsys/bluetooth/mesh/transport_legacy.c @@ -0,0 +1,1656 @@ +/* + * Copyright (c) 2017 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "common/bt_str.h" + +#include "host/testing.h" + +#include "crypto.h" +#include "mesh.h" +#include "net.h" +#include "app_keys.h" +#include "lpn.h" +#include "rpl.h" +#include "friend.h" +#include "access.h" +#include "foundation.h" +#include "settings.h" +#include "heartbeat.h" +#include "transport.h" +#include "va.h" + +#define LOG_LEVEL CONFIG_BT_MESH_TRANS_LOG_LEVEL +#include +LOG_MODULE_REGISTER(bt_mesh_transport); + +#define AID_MASK ((uint8_t)(BIT_MASK(6))) + +#define SEG(data) ((data)[0] >> 7) +#define AKF(data) (((data)[0] >> 6) & 0x01) +#define AID(data) ((data)[0] & AID_MASK) +#define ASZMIC(data) (((data)[1] >> 7) & 1) + +#define APP_MIC_LEN(aszmic) ((aszmic) ? BT_MESH_MIC_LONG : BT_MESH_MIC_SHORT) + +#define UNSEG_HDR(akf, aid) ((akf << 6) | (aid & AID_MASK)) +#define SEG_HDR(akf, aid) (UNSEG_HDR(akf, aid) | 0x80) + +#define BLOCK_COMPLETE(seg_n) (uint32_t)(((uint64_t)1 << (seg_n + 1)) - 1) + +#define SEQ_AUTH(iv_index, seq) (((uint64_t)iv_index) << 24 | (uint64_t)seq) + +/* Number of retransmit attempts (after the initial transmit) per segment */ +#define SEG_RETRANSMIT_ATTEMPTS CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT + +/* "This timer shall be set to a minimum of 200 + 50 * TTL milliseconds.". + * We use 400 since 300 is a common send duration for standard HCI, and we + * need to have a timeout that's bigger than that. + */ +#define SEG_RETRANSMIT_TIMEOUT_UNICAST(tx) \ + (CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST + 50 * (tx)->ttl) + +/* When sending to a group, the messages are not acknowledged, and there's no + * reason to delay the repetitions significantly. Delaying by more than 0 ms + * to avoid flooding the network. + */ +#define SEG_RETRANSMIT_TIMEOUT_GROUP CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP + +#define SEG_RETRANSMIT_TIMEOUT(tx) \ + (BT_MESH_ADDR_IS_UNICAST(tx->dst) ? \ + SEG_RETRANSMIT_TIMEOUT_UNICAST(tx) : \ + SEG_RETRANSMIT_TIMEOUT_GROUP) +/* How long to wait for available buffers before giving up */ +#define BUF_TIMEOUT K_NO_WAIT + +static struct seg_tx { + struct bt_mesh_subnet *sub; + void *seg[BT_MESH_TX_SEG_MAX]; + uint64_t seq_auth; + uint16_t src; + uint16_t dst; + uint16_t ack_src; + uint16_t len; + uint8_t hdr; + uint8_t xmit; + uint8_t seg_n; /* Last segment index */ + uint8_t seg_o; /* Segment being sent */ + uint8_t nack_count; /* Number of unacked segs */ + uint8_t attempts; /* Remaining tx attempts */ + uint8_t ttl; /* Transmitted TTL value */ + uint8_t blocked:1, /* Blocked by ongoing tx */ + ctl:1, /* Control packet */ + aszmic:1, /* MIC size */ + started:1, /* Start cb called */ + friend_cred:1, /* Using Friend credentials */ + seg_send_started:1; /* Used to check if seg_send_start cb is called */ + const struct bt_mesh_send_cb *cb; + void *cb_data; + struct k_work_delayable retransmit; /* Retransmit timer */ +} seg_tx[CONFIG_BT_MESH_TX_SEG_MSG_COUNT]; + +static struct seg_rx { + struct bt_mesh_subnet *sub; + void *seg[BT_MESH_RX_SEG_MAX]; + uint64_t seq_auth; + uint16_t src; + uint16_t dst; + uint16_t len; + uint8_t hdr; + uint8_t seg_n:5, + ctl:1, + in_use:1, + obo:1; + uint8_t ttl; + uint32_t block; + uint32_t last; + struct k_work_delayable ack; +} seg_rx[CONFIG_BT_MESH_RX_SEG_MSG_COUNT]; + +K_MEM_SLAB_DEFINE(segs, BT_MESH_APP_SEG_SDU_MAX, CONFIG_BT_MESH_SEG_BUFS, 4); + +static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, + const struct bt_mesh_send_cb *cb, void *cb_data, + const uint8_t *ctl_op) +{ + struct bt_mesh_adv *adv; + + adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + tx->xmit, BUF_TIMEOUT); + if (!adv) { + LOG_ERR("Out of network advs"); + return -ENOBUFS; + } + + net_buf_simple_reserve(&adv->b, BT_MESH_NET_HDR_LEN); + + if (ctl_op) { + net_buf_simple_add_u8(&adv->b, TRANS_CTL_HDR(*ctl_op, 0)); + } else if (BT_MESH_IS_DEV_KEY(tx->ctx->app_idx)) { + net_buf_simple_add_u8(&adv->b, UNSEG_HDR(0, 0)); + } else { + net_buf_simple_add_u8(&adv->b, UNSEG_HDR(1, tx->aid)); + } + + net_buf_simple_add_mem(&adv->b, sdu->data, sdu->len); + + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { + if (!bt_mesh_friend_queue_has_space(tx->sub->net_idx, + tx->src, tx->ctx->addr, + NULL, 1)) { + if (BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { + LOG_ERR("Not enough space in Friend Queue"); + bt_mesh_adv_unref(adv); + return -ENOBUFS; + } + + LOG_WRN("No space in Friend Queue"); + goto send; + } + + if (bt_mesh_friend_enqueue_tx(tx, BT_MESH_FRIEND_PDU_SINGLE, + NULL, 1, &adv->b) && + BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { + /* PDUs for a specific Friend should only go + * out through the Friend Queue. + */ + bt_mesh_adv_unref(adv); + send_cb_finalize(cb, cb_data); + return 0; + } + } + +send: + return bt_mesh_net_send(tx, adv, cb, cb_data); +} + +static inline uint8_t seg_len(bool ctl) +{ + if (ctl) { + return BT_MESH_CTL_SEG_SDU_MAX; + } else { + return BT_MESH_APP_SEG_SDU_MAX; + } +} + +bool bt_mesh_tx_in_progress(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(seg_tx); i++) { + if (seg_tx[i].nack_count) { + return true; + } + } + + return false; +} + +static void seg_tx_done(struct seg_tx *tx, uint8_t seg_idx) +{ + k_mem_slab_free(&segs, (void *)tx->seg[seg_idx]); + tx->seg[seg_idx] = NULL; + tx->nack_count--; +} + +static bool seg_tx_blocks(struct seg_tx *tx, uint16_t src, uint16_t dst) +{ + return (tx->src == src) && (tx->dst == dst); +} + +static void seg_tx_unblock_check(struct seg_tx *tx) +{ + struct seg_tx *blocked = NULL; + int i; + + /* Unblock the first blocked tx with the same params. */ + for (i = 0; i < ARRAY_SIZE(seg_tx); ++i) { + if (&seg_tx[i] != tx && + seg_tx[i].blocked && + seg_tx_blocks(tx, seg_tx[i].src, seg_tx[i].dst) && + (!blocked || seg_tx[i].seq_auth < blocked->seq_auth)) { + blocked = &seg_tx[i]; + } + } + + if (blocked) { + LOG_DBG("Unblocked 0x%04x", (uint16_t)(blocked->seq_auth & TRANS_SEQ_ZERO_MASK)); + blocked->blocked = false; + k_work_reschedule(&blocked->retransmit, K_NO_WAIT); + } +} + +static void seg_tx_reset(struct seg_tx *tx) +{ + int i; + + /* If this call fails, the handler will exit early, as nack_count is 0. */ + (void)k_work_cancel_delayable(&tx->retransmit); + + tx->cb = NULL; + tx->cb_data = NULL; + tx->seq_auth = 0U; + tx->sub = NULL; + tx->src = BT_MESH_ADDR_UNASSIGNED; + tx->dst = BT_MESH_ADDR_UNASSIGNED; + tx->ack_src = BT_MESH_ADDR_UNASSIGNED; + tx->blocked = false; + + for (i = 0; i <= tx->seg_n && tx->nack_count; i++) { + if (!tx->seg[i]) { + continue; + } + + seg_tx_done(tx, i); + } + + tx->nack_count = 0; + tx->seg_send_started = 0; + + if (atomic_test_and_clear_bit(bt_mesh.flags, BT_MESH_IVU_PENDING)) { + LOG_DBG("Proceeding with pending IV Update"); + /* bt_mesh_net_iv_update() will re-enable the flag if this + * wasn't the only transfer. + */ + bt_mesh_net_iv_update(bt_mesh.iv_index, false); + } +} + +static inline void seg_tx_complete(struct seg_tx *tx, int err) +{ + const struct bt_mesh_send_cb *cb = tx->cb; + void *cb_data = tx->cb_data; + + seg_tx_unblock_check(tx); + + seg_tx_reset(tx); + + if (cb && cb->end) { + cb->end(err, cb_data); + } +} + +static void schedule_retransmit(struct seg_tx *tx) +{ + if (!tx->nack_count) { + return; + } + + LOG_DBG(""); + + /* If we haven't gone through all the segments for this attempt yet, + * (likely because of a buffer allocation failure or because we + * called this from inside bt_mesh_net_send), we should continue the + * retransmit immediately, as we just freed up a tx buffer. + */ + k_work_reschedule(&tx->retransmit, K_NO_WAIT); +} + +static void seg_send_start(uint16_t duration, int err, void *user_data) +{ + struct seg_tx *tx = user_data; + + if (!tx->started && tx->cb && tx->cb->start) { + tx->cb->start(duration, err, tx->cb_data); + tx->started = 1U; + } + + tx->seg_send_started = 1U; + + /* If there's an error in transmitting the 'sent' callback will never + * be called. Make sure that we kick the retransmit timer also in this + * case since otherwise we risk the transmission of becoming stale. + */ + if (err) { + schedule_retransmit(tx); + } +} + +static void seg_sent(int err, void *user_data) +{ + struct seg_tx *tx = user_data; + + if (!tx->seg_send_started) { + return; + } + + schedule_retransmit(tx); +} + +static const struct bt_mesh_send_cb seg_sent_cb = { + .start = seg_send_start, + .end = seg_sent, +}; + +static void seg_tx_buf_build(struct seg_tx *tx, uint8_t seg_o, + struct net_buf_simple *buf) +{ + uint16_t seq_zero = tx->seq_auth & TRANS_SEQ_ZERO_MASK; + uint8_t len = MIN(seg_len(tx->ctl), tx->len - (seg_len(tx->ctl) * seg_o)); + + net_buf_simple_add_u8(buf, tx->hdr); + net_buf_simple_add_u8(buf, (tx->aszmic << 7) | seq_zero >> 6); + net_buf_simple_add_u8(buf, (((seq_zero & 0x3f) << 2) | (seg_o >> 3))); + net_buf_simple_add_u8(buf, ((seg_o & 0x07) << 5) | tx->seg_n); + net_buf_simple_add_mem(buf, tx->seg[seg_o], len); +} + +static void seg_tx_send_unacked(struct seg_tx *tx) +{ + if (!tx->nack_count) { + return; + } + + struct bt_mesh_msg_ctx ctx = { + .net_idx = tx->sub->net_idx, + /* App idx only used by network to detect control messages: */ + .app_idx = (tx->ctl ? BT_MESH_KEY_UNUSED : 0), + .addr = tx->dst, + .send_rel = true, + .send_ttl = tx->ttl, + }; + struct bt_mesh_net_tx net_tx = { + .sub = tx->sub, + .ctx = &ctx, + .src = tx->src, + .xmit = tx->xmit, + .friend_cred = tx->friend_cred, + .aid = tx->hdr & AID_MASK, + }; + + if (!tx->attempts) { + if (BT_MESH_ADDR_IS_UNICAST(tx->dst)) { + LOG_ERR("Ran out of retransmit attempts"); + seg_tx_complete(tx, -ETIMEDOUT); + } else { + /* Segmented sending to groups doesn't have acks, so + * running out of attempts is the expected behavior. + */ + seg_tx_complete(tx, 0); + } + + return; + } + + LOG_DBG("SeqZero: 0x%04x Attempts: %u", (uint16_t)(tx->seq_auth & TRANS_SEQ_ZERO_MASK), + tx->attempts); + + while (tx->seg_o <= tx->seg_n) { + struct bt_mesh_adv *seg; + int err; + + if (!tx->seg[tx->seg_o]) { + /* Move on to the next segment */ + tx->seg_o++; + continue; + } + + seg = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + tx->xmit, BUF_TIMEOUT); + if (!seg) { + LOG_DBG("Allocating segment failed"); + goto end; + } + + net_buf_simple_reserve(&seg->b, BT_MESH_NET_HDR_LEN); + seg_tx_buf_build(tx, tx->seg_o, &seg->b); + + LOG_DBG("Sending %u/%u", tx->seg_o, tx->seg_n); + + err = bt_mesh_net_send(&net_tx, seg, &seg_sent_cb, tx); + if (err) { + LOG_DBG("Sending segment failed"); + goto end; + } + + /* Move on to the next segment */ + tx->seg_o++; + + return; + } + + tx->seg_o = 0U; + tx->attempts--; + +end: + if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER) && + bt_mesh_lpn_established() && !bt_mesh_has_addr(ctx.addr)) { + bt_mesh_lpn_poll(); + } + + k_work_reschedule(&tx->retransmit, K_MSEC(SEG_RETRANSMIT_TIMEOUT(tx))); +} + +static void seg_retransmit(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct seg_tx *tx = CONTAINER_OF(dwork, struct seg_tx, retransmit); + + seg_tx_send_unacked(tx); +} + +static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu, + const struct bt_mesh_send_cb *cb, void *cb_data, + uint8_t *ctl_op) +{ + bool blocked = false; + struct seg_tx *tx; + uint8_t seg_o; + int i; + + LOG_DBG("src 0x%04x dst 0x%04x app_idx 0x%04x aszmic %u sdu_len %u", net_tx->src, + net_tx->ctx->addr, net_tx->ctx->app_idx, net_tx->aszmic, sdu->len); + + for (tx = NULL, i = 0; i < ARRAY_SIZE(seg_tx); i++) { + if (seg_tx[i].nack_count) { + blocked |= seg_tx_blocks(&seg_tx[i], net_tx->src, + net_tx->ctx->addr); + } else if (!tx) { + tx = &seg_tx[i]; + } + } + + if (!tx) { + LOG_ERR("No multi-segment message contexts available"); + return -EBUSY; + } + + if (ctl_op) { + tx->hdr = TRANS_CTL_HDR(*ctl_op, 1); + } else if (BT_MESH_IS_DEV_KEY(net_tx->ctx->app_idx)) { + tx->hdr = SEG_HDR(0, 0); + } else { + tx->hdr = SEG_HDR(1, net_tx->aid); + } + + tx->src = net_tx->src; + tx->dst = net_tx->ctx->addr; + tx->seg_n = (sdu->len - 1) / seg_len(!!ctl_op); + tx->seg_o = 0; + tx->len = sdu->len; + tx->nack_count = tx->seg_n + 1; + tx->seq_auth = SEQ_AUTH(BT_MESH_NET_IVI_TX, bt_mesh.seq); + tx->sub = net_tx->sub; + tx->cb = cb; + tx->cb_data = cb_data; + tx->attempts = SEG_RETRANSMIT_ATTEMPTS; + tx->xmit = net_tx->xmit; + tx->aszmic = net_tx->aszmic; + tx->friend_cred = net_tx->friend_cred; + tx->blocked = blocked; + tx->started = 0; + tx->seg_send_started = 0; + tx->ctl = !!ctl_op; + tx->ttl = net_tx->ctx->send_ttl; + + LOG_DBG("SeqZero 0x%04x (segs: %u)", (uint16_t)(tx->seq_auth & TRANS_SEQ_ZERO_MASK), + tx->nack_count); + + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && + !bt_mesh_friend_queue_has_space(tx->sub->net_idx, net_tx->src, + tx->dst, &tx->seq_auth, + tx->seg_n + 1) && + BT_MESH_ADDR_IS_UNICAST(tx->dst)) { + LOG_ERR("Not enough space in Friend Queue for %u segments", tx->seg_n + 1); + seg_tx_reset(tx); + return -ENOBUFS; + } + + for (seg_o = 0U; sdu->len; seg_o++) { + void *buf; + uint16_t len; + int err; + + err = k_mem_slab_alloc(&segs, &buf, BUF_TIMEOUT); + if (err) { + LOG_ERR("Out of segment buffers"); + seg_tx_reset(tx); + return -ENOBUFS; + } + + len = MIN(sdu->len, seg_len(!!ctl_op)); + memcpy(buf, net_buf_simple_pull_mem(sdu, len), len); + + LOG_DBG("seg %u: %s", seg_o, bt_hex(buf, len)); + + tx->seg[seg_o] = buf; + + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { + enum bt_mesh_friend_pdu_type type; + + NET_BUF_SIMPLE_DEFINE(seg, 16); + seg_tx_buf_build(tx, seg_o, &seg); + + if (seg_o == tx->seg_n) { + type = BT_MESH_FRIEND_PDU_COMPLETE; + } else { + type = BT_MESH_FRIEND_PDU_PARTIAL; + } + + if (bt_mesh_friend_enqueue_tx( + net_tx, type, ctl_op ? NULL : &tx->seq_auth, + tx->seg_n + 1, &seg) && + BT_MESH_ADDR_IS_UNICAST(net_tx->ctx->addr)) { + /* PDUs for a specific Friend should only go + * out through the Friend Queue. + */ + k_mem_slab_free(&segs, buf); + tx->seg[seg_o] = NULL; + } + + } + + } + + /* This can happen if segments only went into the Friend Queue */ + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && !tx->seg[0]) { + seg_tx_reset(tx); + + /* If there was a callback notify sending immediately since + * there's no other way to track this (at least currently) + * with the Friend Queue. + */ + send_cb_finalize(cb, cb_data); + return 0; + } + + if (blocked) { + /* Move the sequence number, so we don't end up creating + * another segmented transmission with the same SeqZero while + * this one is blocked. + */ + bt_mesh_next_seq(); + LOG_DBG("Blocked."); + return 0; + } + + seg_tx_send_unacked(tx); + + return 0; +} + +static int trans_encrypt(const struct bt_mesh_net_tx *tx, const struct bt_mesh_key *key, + struct net_buf_simple *msg) +{ + struct bt_mesh_app_crypto_ctx crypto = { + .dev_key = BT_MESH_IS_DEV_KEY(tx->ctx->app_idx), + .aszmic = tx->aszmic, + .src = tx->src, + .dst = tx->ctx->addr, + .seq_num = bt_mesh.seq, + .iv_index = BT_MESH_NET_IVI_TX, + }; + + if (BT_MESH_ADDR_IS_VIRTUAL(tx->ctx->addr)) { + crypto.ad = tx->ctx->uuid; + if (crypto.ad == NULL) { + return -ENOENT; + } + } + + return bt_mesh_app_encrypt(key, &crypto, msg); +} + +int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg, + const struct bt_mesh_send_cb *cb, void *cb_data) +{ + const struct bt_mesh_key *key; + uint8_t aid; + int err; + + if (msg->len < 1) { + LOG_ERR("Zero-length SDU not allowed"); + return -EINVAL; + } + + if (msg->len > BT_MESH_TX_SDU_MAX - BT_MESH_MIC_SHORT) { + LOG_ERR("Message too big: %u", msg->len); + return -EMSGSIZE; + } + + if (net_buf_simple_tailroom(msg) < BT_MESH_MIC_SHORT) { + LOG_ERR("Insufficient tailroom for Transport MIC"); + return -EINVAL; + } + + if (tx->ctx->send_ttl == BT_MESH_TTL_DEFAULT) { + tx->ctx->send_ttl = bt_mesh_default_ttl_get(); + } else if (tx->ctx->send_ttl > BT_MESH_TTL_MAX) { + LOG_ERR("TTL too large (max 127)"); + return -EINVAL; + } + + if (msg->len > BT_MESH_SDU_UNSEG_MAX) { + tx->ctx->send_rel = true; + } + + if (tx->ctx->addr == BT_MESH_ADDR_UNASSIGNED || + (!BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr) && + BT_MESH_IS_DEV_KEY(tx->ctx->app_idx))) { + LOG_ERR("Invalid destination address"); + return -EINVAL; + } + + err = bt_mesh_keys_resolve(tx->ctx, &tx->sub, &key, &aid); + if (err) { + return err; + } + + LOG_DBG("net_idx 0x%04x app_idx 0x%04x dst 0x%04x", tx->sub->net_idx, tx->ctx->app_idx, + tx->ctx->addr); + LOG_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len)); + + tx->xmit = bt_mesh_net_transmit_get(); + tx->aid = aid; + + if (!tx->ctx->send_rel || net_buf_simple_tailroom(msg) < 8) { + tx->aszmic = 0U; + } else { + tx->aszmic = 1U; + } + + err = trans_encrypt(tx, key, msg); + if (err) { + return err; + } + + if (tx->ctx->send_rel) { + err = send_seg(tx, msg, cb, cb_data, NULL); + } else { + err = send_unseg(tx, msg, cb, cb_data, NULL); + } + + return err; +} + +static void seg_rx_assemble(struct seg_rx *rx, struct net_buf_simple *buf, + uint8_t aszmic) +{ + int i; + + net_buf_simple_reset(buf); + + for (i = 0; i <= rx->seg_n; i++) { + net_buf_simple_add_mem(buf, rx->seg[i], + MIN(seg_len(rx->ctl), + rx->len - (i * seg_len(rx->ctl)))); + } + + /* Adjust the length to not contain the MIC at the end */ + if (!rx->ctl) { + buf->len -= APP_MIC_LEN(aszmic); + } +} + +struct decrypt_ctx { + struct bt_mesh_app_crypto_ctx crypto; + struct net_buf_simple *buf; + struct net_buf_simple *sdu; + struct seg_rx *seg; +}; + +static int sdu_try_decrypt(struct bt_mesh_net_rx *rx, const struct bt_mesh_key *key, + void *cb_data) +{ + struct decrypt_ctx *ctx = cb_data; + int err; + + ctx->crypto.ad = NULL; + + do { + if (ctx->seg) { + seg_rx_assemble(ctx->seg, ctx->buf, ctx->crypto.aszmic); + } + + if (BT_MESH_ADDR_IS_VIRTUAL(rx->ctx.recv_dst)) { + ctx->crypto.ad = bt_mesh_va_uuid_get(rx->ctx.recv_dst, ctx->crypto.ad, + NULL); + + if (!ctx->crypto.ad) { + return -ENOENT; + } + } + + net_buf_simple_reset(ctx->sdu); + + err = bt_mesh_app_decrypt(key, &ctx->crypto, ctx->buf, ctx->sdu); + } while (err && ctx->crypto.ad != NULL); + + if (!err && BT_MESH_ADDR_IS_VIRTUAL(rx->ctx.recv_dst)) { + rx->ctx.uuid = ctx->crypto.ad; + } + + return err; +} + +static int sdu_recv(struct bt_mesh_net_rx *rx, uint8_t hdr, uint8_t aszmic, + struct net_buf_simple *buf, struct net_buf_simple *sdu, + struct seg_rx *seg) +{ + struct decrypt_ctx ctx = { + .crypto = { + .dev_key = !AKF(&hdr), + .aszmic = aszmic, + .src = rx->ctx.addr, + .dst = rx->ctx.recv_dst, + .seq_num = seg ? (seg->seq_auth & 0xffffff) : rx->seq, + .iv_index = BT_MESH_NET_IVI_RX(rx), + }, + .buf = buf, + .sdu = sdu, + .seg = seg, + }; + + LOG_DBG("AKF %u AID 0x%02x", !ctx.crypto.dev_key, AID(&hdr)); + + if (!rx->local_match) { + return 0; + } + + rx->ctx.app_idx = bt_mesh_app_key_find(ctx.crypto.dev_key, AID(&hdr), + rx, sdu_try_decrypt, &ctx); + if (rx->ctx.app_idx == BT_MESH_KEY_UNUSED) { + LOG_DBG("No matching AppKey"); + return 0; + } + + LOG_DBG("Decrypted (AppIdx: 0x%03x)", rx->ctx.app_idx); + + bt_mesh_model_recv(&rx->ctx, sdu); + + return 0; +} + +static struct seg_tx *seg_tx_lookup(uint16_t seq_zero, uint8_t obo, uint16_t addr) +{ + struct seg_tx *tx; + int i; + + for (i = 0; i < ARRAY_SIZE(seg_tx); i++) { + tx = &seg_tx[i]; + + if ((tx->seq_auth & TRANS_SEQ_ZERO_MASK) != seq_zero) { + continue; + } + + if (tx->dst == addr) { + return tx; + } + + /* If the expected remote address doesn't match, + * but the OBO flag is set and this is the first + * acknowledgment, assume it's a Friend that's + * responding and therefore accept the message. + */ + if (obo && (tx->nack_count == tx->seg_n + 1 || tx->ack_src == addr)) { + tx->ack_src = addr; + return tx; + } + } + + return NULL; +} + +static int trans_ack(struct bt_mesh_net_rx *rx, uint8_t hdr, + struct net_buf_simple *buf, uint64_t *seq_auth) +{ + struct seg_tx *tx; + unsigned int bit; + uint32_t ack; + uint16_t seq_zero; + uint8_t obo; + + if (buf->len < 6) { + LOG_ERR("Too short ack message"); + return -EINVAL; + } + + seq_zero = net_buf_simple_pull_be16(buf); + obo = seq_zero >> 15; + seq_zero = (seq_zero >> 2) & TRANS_SEQ_ZERO_MASK; + + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && rx->friend_match) { + LOG_DBG("Ack for LPN 0x%04x of this Friend", rx->ctx.recv_dst); + /* Best effort - we don't have enough info for true SeqAuth */ + *seq_auth = SEQ_AUTH(BT_MESH_NET_IVI_RX(rx), seq_zero); + return 0; + } + + ack = net_buf_simple_pull_be32(buf); + + LOG_DBG("OBO %u seq_zero 0x%04x ack 0x%08x", obo, seq_zero, ack); + + tx = seg_tx_lookup(seq_zero, obo, rx->ctx.addr); + if (!tx) { + LOG_WRN("No matching TX context for ack"); + return -EINVAL; + } + + if (!BT_MESH_ADDR_IS_UNICAST(tx->dst)) { + LOG_ERR("Received ack for group seg"); + return -EINVAL; + } + + *seq_auth = tx->seq_auth; + + if (!ack) { + LOG_WRN("SDU canceled"); + seg_tx_complete(tx, -ECANCELED); + return 0; + } + + if (find_msb_set(ack) - 1 > tx->seg_n) { + LOG_ERR("Too large segment number in ack"); + return -EINVAL; + } + + while ((bit = find_lsb_set(ack))) { + if (tx->seg[bit - 1]) { + LOG_DBG("seg %u/%u acked", bit - 1, tx->seg_n); + seg_tx_done(tx, bit - 1); + } + + ack &= ~BIT(bit - 1); + } + + if (tx->nack_count) { + /* According to MshPRFv1.0.1: 3.5.3.3, we should reset the retransmit timer and + * retransmit immediately when receiving a valid ack message. Don't reset the + * retransmit timer if we didn't finish sending segments. + */ + if (tx->seg_o == 0) { + k_work_reschedule(&tx->retransmit, K_NO_WAIT); + } + } else { + LOG_DBG("SDU TX complete"); + seg_tx_complete(tx, 0); + } + + return 0; +} + +static int ctl_recv(struct bt_mesh_net_rx *rx, uint8_t hdr, + struct net_buf_simple *buf, uint64_t *seq_auth) +{ + uint8_t ctl_op = TRANS_CTL_OP(&hdr); + + LOG_DBG("OpCode 0x%02x len %u", ctl_op, buf->len); + + switch (ctl_op) { + case TRANS_CTL_OP_ACK: + return trans_ack(rx, hdr, buf, seq_auth); + case TRANS_CTL_OP_HEARTBEAT: + return bt_mesh_hb_recv(rx, buf); + } + + /* Only acks and heartbeats may need processing without local_match */ + if (!rx->local_match) { + return 0; + } + + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && !bt_mesh_lpn_established()) { + switch (ctl_op) { + case TRANS_CTL_OP_FRIEND_POLL: + return bt_mesh_friend_poll(rx, buf); + case TRANS_CTL_OP_FRIEND_REQ: + return bt_mesh_friend_req(rx, buf); + case TRANS_CTL_OP_FRIEND_CLEAR: + return bt_mesh_friend_clear(rx, buf); + case TRANS_CTL_OP_FRIEND_CLEAR_CFM: + return bt_mesh_friend_clear_cfm(rx, buf); + case TRANS_CTL_OP_FRIEND_SUB_ADD: + return bt_mesh_friend_sub_add(rx, buf); + case TRANS_CTL_OP_FRIEND_SUB_REM: + return bt_mesh_friend_sub_rem(rx, buf); + } + } + +#if defined(CONFIG_BT_MESH_LOW_POWER) + if (ctl_op == TRANS_CTL_OP_FRIEND_OFFER) { + return bt_mesh_lpn_friend_offer(rx, buf); + } + + if (rx->ctx.addr == bt_mesh.lpn.frnd) { + if (ctl_op == TRANS_CTL_OP_FRIEND_CLEAR_CFM) { + return bt_mesh_lpn_friend_clear_cfm(rx, buf); + } + + if (!rx->friend_cred) { + LOG_WRN("Message from friend with wrong credentials"); + return -EINVAL; + } + + switch (ctl_op) { + case TRANS_CTL_OP_FRIEND_UPDATE: + return bt_mesh_lpn_friend_update(rx, buf); + case TRANS_CTL_OP_FRIEND_SUB_CFM: + return bt_mesh_lpn_friend_sub_cfm(rx, buf); + } + } +#endif /* CONFIG_BT_MESH_LOW_POWER */ + + LOG_WRN("Unhandled TransOpCode 0x%02x", ctl_op); + + return -ENOENT; +} + +static int trans_unseg(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx, + uint64_t *seq_auth) +{ + NET_BUF_SIMPLE_DEFINE_STATIC(sdu, BT_MESH_SDU_UNSEG_MAX); + uint8_t hdr; + + LOG_DBG("AFK %u AID 0x%02x", AKF(buf->data), AID(buf->data)); + + if (buf->len < 1) { + LOG_ERR("Too small unsegmented PDU"); + return -EINVAL; + } + + if (bt_mesh_rpl_check(rx, NULL)) { + LOG_WRN("Replay: src 0x%04x dst 0x%04x seq 0x%06x", rx->ctx.addr, rx->ctx.recv_dst, + rx->seq); + return -EINVAL; + } + + hdr = net_buf_simple_pull_u8(buf); + + if (rx->ctl) { + return ctl_recv(rx, hdr, buf, seq_auth); + } + + if (buf->len < 1 + APP_MIC_LEN(0)) { + LOG_ERR("Too short SDU + MIC"); + return -EINVAL; + } + + /* Adjust the length to not contain the MIC at the end */ + buf->len -= APP_MIC_LEN(0); + + return sdu_recv(rx, hdr, 0, buf, &sdu, NULL); +} + +static inline int32_t ack_timeout(struct seg_rx *rx) +{ + int32_t to; + uint8_t ttl; + + if (rx->ttl == BT_MESH_TTL_DEFAULT) { + ttl = bt_mesh_default_ttl_get(); + } else { + ttl = rx->ttl; + } + + /* The acknowledgment timer shall be set to a minimum of + * 150 + 50 * TTL milliseconds. + */ + to = CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT + + (ttl * (int32_t)CONFIG_BT_MESH_SEG_ACK_PER_HOP_TIMEOUT); + + /* Add timeout for evenry not yet received segment. */ + to += ((rx->seg_n + 1) - POPCOUNT(rx->block)) * + (int32_t)CONFIG_BT_MESH_SEG_ACK_PER_SEGMENT_TIMEOUT; + + /* Make sure we don't send more frequently than the duration for + * each packet (default is 400ms). + */ + return MAX(to, 400); +} + +int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data, + size_t data_len, + const struct bt_mesh_send_cb *cb, void *cb_data) +{ + struct net_buf_simple buf; + + if (tx->ctx->send_ttl == BT_MESH_TTL_DEFAULT) { + tx->ctx->send_ttl = bt_mesh_default_ttl_get(); + } else if (tx->ctx->send_ttl > BT_MESH_TTL_MAX) { + LOG_ERR("TTL too large (max 127)"); + return -EINVAL; + } + + net_buf_simple_init_with_data(&buf, data, data_len); + + if (data_len > BT_MESH_SDU_UNSEG_MAX) { + tx->ctx->send_rel = true; + } + + tx->ctx->app_idx = BT_MESH_KEY_UNUSED; + + if (tx->ctx->addr == BT_MESH_ADDR_UNASSIGNED || + BT_MESH_ADDR_IS_VIRTUAL(tx->ctx->addr)) { + LOG_ERR("Invalid destination address"); + return -EINVAL; + } + + LOG_DBG("src 0x%04x dst 0x%04x ttl 0x%02x ctl 0x%02x", tx->src, tx->ctx->addr, + tx->ctx->send_ttl, ctl_op); + LOG_DBG("len %zu: %s", data_len, bt_hex(data, data_len)); + + if (tx->ctx->send_rel) { + return send_seg(tx, &buf, cb, cb_data, &ctl_op); + } else { + return send_unseg(tx, &buf, cb, cb_data, &ctl_op); + } +} + +static int send_ack(struct bt_mesh_subnet *sub, uint16_t src, uint16_t dst, + uint8_t ttl, uint64_t *seq_auth, uint32_t block, uint8_t obo) +{ + struct bt_mesh_msg_ctx ctx = { + .net_idx = sub->net_idx, + .app_idx = BT_MESH_KEY_UNUSED, + .addr = dst, + .send_ttl = ttl, + }; + struct bt_mesh_net_tx tx = { + .sub = sub, + .ctx = &ctx, + .src = obo ? bt_mesh_primary_addr() : src, + .xmit = bt_mesh_net_transmit_get(), + }; + uint16_t seq_zero = *seq_auth & TRANS_SEQ_ZERO_MASK; + uint8_t buf[6]; + + LOG_DBG("SeqZero 0x%04x Block 0x%08x OBO %u", seq_zero, block, obo); + + if (bt_mesh_lpn_established() && !bt_mesh_has_addr(ctx.addr)) { + LOG_WRN("Not sending ack when LPN is enabled"); + return 0; + } + + /* This can happen if the segmented message was destined for a group + * or virtual address. + */ + if (!BT_MESH_ADDR_IS_UNICAST(src)) { + LOG_DBG("Not sending ack for non-unicast address"); + return 0; + } + + sys_put_be16(((seq_zero << 2) & 0x7ffc) | (obo << 15), buf); + sys_put_be32(block, &buf[2]); + + return bt_mesh_ctl_send(&tx, TRANS_CTL_OP_ACK, buf, sizeof(buf), + NULL, NULL); +} + +static void seg_rx_reset(struct seg_rx *rx, bool full_reset) +{ + int i; + + LOG_DBG("rx %p", rx); + + /* If this fails, the handler will exit early on the next execution, as + * it checks rx->in_use. + */ + (void)k_work_cancel_delayable(&rx->ack); + + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && rx->obo && + rx->block != BLOCK_COMPLETE(rx->seg_n)) { + LOG_WRN("Clearing incomplete buffers from Friend queue"); + bt_mesh_friend_clear_incomplete(rx->sub, rx->src, rx->dst, + &rx->seq_auth); + } + + for (i = 0; i <= rx->seg_n; i++) { + if (!rx->seg[i]) { + continue; + } + + k_mem_slab_free(&segs, rx->seg[i]); + rx->seg[i] = NULL; + } + + rx->in_use = 0U; + + /* We don't always reset these values since we need to be able to + * send an ack if we receive a segment after we've already received + * the full SDU. + */ + if (full_reset) { + rx->seq_auth = 0U; + rx->sub = NULL; + rx->src = BT_MESH_ADDR_UNASSIGNED; + rx->dst = BT_MESH_ADDR_UNASSIGNED; + } +} + +static void seg_ack(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct seg_rx *rx = CONTAINER_OF(dwork, struct seg_rx, ack); + int32_t timeout; + + if (!rx->in_use || rx->block == BLOCK_COMPLETE(rx->seg_n)) { + /* Cancellation of this timer may have failed. If it fails as + * part of seg_reset, in_use will be false. + * If it fails as part of the processing of a fully received + * SDU, the ack is already being sent from the receive handler, + * and the timer based ack sending can be ignored. + */ + return; + } + + LOG_DBG("rx %p", rx); + + if (k_uptime_get_32() - rx->last > (60 * MSEC_PER_SEC)) { + LOG_WRN("Incomplete timer expired"); + seg_rx_reset(rx, false); + + if (IS_ENABLED(CONFIG_BT_TESTING)) { + bt_test_mesh_trans_incomp_timer_exp(); + } + + return; + } + + send_ack(rx->sub, rx->dst, rx->src, rx->ttl, &rx->seq_auth, + rx->block, rx->obo); + + timeout = ack_timeout(rx); + k_work_schedule(&rx->ack, K_MSEC(timeout)); +} + +static inline bool sdu_len_is_ok(bool ctl, uint8_t seg_n) +{ + return (seg_n < BT_MESH_RX_SEG_MAX); +} + +static struct seg_rx *seg_rx_find(struct bt_mesh_net_rx *net_rx, + const uint64_t *seq_auth) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(seg_rx); i++) { + struct seg_rx *rx = &seg_rx[i]; + + if (rx->src != net_rx->ctx.addr || + rx->dst != net_rx->ctx.recv_dst) { + continue; + } + + /* Return newer RX context in addition to an exact match, so + * the calling function can properly discard an old SeqAuth. + */ + if (rx->seq_auth >= *seq_auth) { + return rx; + } + + if (rx->in_use) { + LOG_WRN("Duplicate SDU from src 0x%04x", net_rx->ctx.addr); + + /* Clear out the old context since the sender + * has apparently started sending a new SDU. + */ + seg_rx_reset(rx, true); + + /* Return non-match so caller can re-allocate */ + return NULL; + } + } + + return NULL; +} + +static bool seg_rx_is_valid(struct seg_rx *rx, struct bt_mesh_net_rx *net_rx, + const uint8_t *hdr, uint8_t seg_n) +{ + if (rx->hdr != *hdr || rx->seg_n != seg_n) { + LOG_ERR("Invalid segment for ongoing session"); + return false; + } + + if (rx->src != net_rx->ctx.addr || rx->dst != net_rx->ctx.recv_dst) { + LOG_ERR("Invalid source or destination for segment"); + return false; + } + + if (rx->ctl != net_rx->ctl) { + LOG_ERR("Inconsistent CTL in segment"); + return false; + } + + return true; +} + +static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx, + const uint8_t *hdr, const uint64_t *seq_auth, + uint8_t seg_n) +{ + int i; + + /* No race condition on this check, as this function only executes in + * the collaborative Bluetooth rx thread: + */ + if (k_mem_slab_num_free_get(&segs) < 1) { + LOG_WRN("Not enough segments for incoming message"); + return NULL; + } + + for (i = 0; i < ARRAY_SIZE(seg_rx); i++) { + struct seg_rx *rx = &seg_rx[i]; + + if (rx->in_use) { + continue; + } + + rx->in_use = 1U; + rx->sub = net_rx->sub; + rx->ctl = net_rx->ctl; + rx->seq_auth = *seq_auth; + rx->seg_n = seg_n; + rx->hdr = *hdr; + rx->ttl = net_rx->ctx.send_ttl; + rx->src = net_rx->ctx.addr; + rx->dst = net_rx->ctx.recv_dst; + rx->block = 0U; + + LOG_DBG("New RX context. Block Complete 0x%08x", BLOCK_COMPLETE(seg_n)); + + return rx; + } + + return NULL; +} + +static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx, + enum bt_mesh_friend_pdu_type *pdu_type, uint64_t *seq_auth, + uint8_t *seg_count) +{ + struct bt_mesh_rpl *rpl = NULL; + struct seg_rx *rx; + uint8_t *hdr = buf->data; + uint16_t seq_zero; + uint32_t auth_seqnum; + uint8_t seg_n; + uint8_t seg_o; + int err; + + if (buf->len < 5) { + LOG_ERR("Too short segmented message (len %u)", buf->len); + return -EINVAL; + } + + if (bt_mesh_rpl_check(net_rx, &rpl)) { + LOG_WRN("Replay: src 0x%04x dst 0x%04x seq 0x%06x", net_rx->ctx.addr, + net_rx->ctx.recv_dst, net_rx->seq); + return -EINVAL; + } + + LOG_DBG("ASZMIC %u AKF %u AID 0x%02x", ASZMIC(hdr), AKF(hdr), AID(hdr)); + + net_buf_simple_pull(buf, 1); + + seq_zero = net_buf_simple_pull_be16(buf); + seg_o = (seq_zero & 0x03) << 3; + seq_zero = (seq_zero >> 2) & TRANS_SEQ_ZERO_MASK; + seg_n = net_buf_simple_pull_u8(buf); + seg_o |= seg_n >> 5; + seg_n &= 0x1f; + + LOG_DBG("SeqZero 0x%04x SegO %u SegN %u", seq_zero, seg_o, seg_n); + + if (seg_o > seg_n) { + LOG_ERR("SegO greater than SegN (%u > %u)", seg_o, seg_n); + return -EINVAL; + } + + /* According to MshPRFv1.0.1: + * "The SeqAuth is composed of the IV Index and the sequence number + * (SEQ) of the first segment" + * + * Therefore we need to calculate very first SEQ in order to find + * seqAuth. We can calculate as below: + * + * SEQ(0) = SEQ(n) - (delta between seqZero and SEQ(n) by looking into + * 14 least significant bits of SEQ(n)) + * + * Mentioned delta shall be >= 0, if it is not then seq_auth will + * be broken and it will be verified by the code below. + */ + *seq_auth = SEQ_AUTH(BT_MESH_NET_IVI_RX(net_rx), + (net_rx->seq - + ((((net_rx->seq & BIT_MASK(14)) - seq_zero)) & + BIT_MASK(13)))); + auth_seqnum = *seq_auth & BIT_MASK(24); + *seg_count = seg_n + 1; + + /* Look for old RX sessions */ + rx = seg_rx_find(net_rx, seq_auth); + if (rx) { + /* Discard old SeqAuth packet */ + if (rx->seq_auth > *seq_auth) { + LOG_WRN("Ignoring old SeqAuth"); + return -EINVAL; + } + + if (!seg_rx_is_valid(rx, net_rx, hdr, seg_n)) { + return -EINVAL; + } + + if (rx->in_use) { + LOG_DBG("Existing RX context. Block 0x%08x", rx->block); + goto found_rx; + } + + if (rx->block == BLOCK_COMPLETE(rx->seg_n)) { + LOG_DBG("Got segment for already complete SDU"); + + send_ack(net_rx->sub, net_rx->ctx.recv_dst, + net_rx->ctx.addr, net_rx->ctx.send_ttl, + seq_auth, rx->block, rx->obo); + + if (rpl) { + bt_mesh_rpl_update(rpl, net_rx); + } + + return -EALREADY; + } + + /* We ignore instead of sending block ack 0 since the + * ack timer is always smaller than the incomplete + * timer, i.e. the sender is misbehaving. + */ + LOG_WRN("Got segment for canceled SDU"); + return -EINVAL; + } + + /* Bail out early if we're not ready to receive such a large SDU */ + if (!sdu_len_is_ok(net_rx->ctl, seg_n)) { + LOG_ERR("Too big incoming SDU length"); + send_ack(net_rx->sub, net_rx->ctx.recv_dst, net_rx->ctx.addr, + net_rx->ctx.send_ttl, seq_auth, 0, + net_rx->friend_match); + return -EMSGSIZE; + } + + /* Verify early that there will be space in the Friend Queue(s) in + * case this message is destined to an LPN of ours. + */ + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && + net_rx->friend_match && !net_rx->local_match && + !bt_mesh_friend_queue_has_space(net_rx->sub->net_idx, + net_rx->ctx.addr, + net_rx->ctx.recv_dst, seq_auth, + *seg_count)) { + LOG_ERR("No space in Friend Queue for %u segments", *seg_count); + send_ack(net_rx->sub, net_rx->ctx.recv_dst, net_rx->ctx.addr, + net_rx->ctx.send_ttl, seq_auth, 0, + net_rx->friend_match); + return -ENOBUFS; + } + + /* Keep track of the received SeqAuth values received from this address + * and discard segmented messages that are not newer, as described in + * MshPRFv1.0.1: 3.5.3.4. + * + * The logic on the first segmented receive is a bit special, since the + * initial value of rpl->seg is 0, which would normally fail the + * comparison check with auth_seqnum: + * - If this is the first time we receive from this source, rpl->src + * will be 0, and we can skip this check. + * - If this is the first time we receive from this source on the new IV + * index, rpl->old_iv will be set, and the check is also skipped. + * - If this is the first segmented message on the new IV index, but we + * have received an unsegmented message already, the unsegmented + * message will have reset rpl->seg to 0, and this message's SeqAuth + * cannot be zero. + */ + if (rpl && rpl->src && auth_seqnum <= rpl->seg && + (!rpl->old_iv || net_rx->old_iv)) { + LOG_WRN("Ignoring old SeqAuth 0x%06x", auth_seqnum); + return -EALREADY; + } + + /* Look for free slot for a new RX session */ + rx = seg_rx_alloc(net_rx, hdr, seq_auth, seg_n); + if (!rx) { + /* Warn but don't cancel since the existing slots will + * eventually be freed up and we'll be able to process + * this one. + */ + LOG_WRN("No free slots for new incoming segmented messages"); + return -ENOMEM; + } + + rx->obo = net_rx->friend_match; + +found_rx: + if (BIT(seg_o) & rx->block) { + LOG_DBG("Received already received fragment"); + return -EALREADY; + } + + /* All segments, except the last one, must either have 8 bytes of + * payload (for 64bit Net MIC) or 12 bytes of payload (for 32bit + * Net MIC). + */ + if (seg_o == seg_n) { + /* Set the expected final buffer length */ + rx->len = seg_n * seg_len(rx->ctl) + buf->len; + LOG_DBG("Target len %u * %u + %u = %u", seg_n, seg_len(rx->ctl), buf->len, rx->len); + + if (rx->len > BT_MESH_RX_SDU_MAX) { + LOG_ERR("Too large SDU len"); + send_ack(net_rx->sub, net_rx->ctx.recv_dst, + net_rx->ctx.addr, net_rx->ctx.send_ttl, + seq_auth, 0, rx->obo); + seg_rx_reset(rx, true); + return -EMSGSIZE; + } + } else { + if (buf->len != seg_len(rx->ctl)) { + LOG_ERR("Incorrect segment size for message type"); + return -EINVAL; + } + } + + /* Reset the Incomplete Timer */ + rx->last = k_uptime_get_32(); + + if (!bt_mesh_lpn_established()) { + int32_t timeout = ack_timeout(rx); + /* Should only start ack timer if it isn't running already: */ + k_work_schedule(&rx->ack, K_MSEC(timeout)); + } + + /* Allocated segment here */ + err = k_mem_slab_alloc(&segs, &rx->seg[seg_o], K_NO_WAIT); + if (err) { + LOG_WRN("Unable allocate buffer for Seg %u", seg_o); + return -ENOBUFS; + } + + memcpy(rx->seg[seg_o], buf->data, buf->len); + + LOG_DBG("Received %u/%u", seg_o, seg_n); + + /* Mark segment as received */ + rx->block |= BIT(seg_o); + + if (rx->block != BLOCK_COMPLETE(seg_n)) { + *pdu_type = BT_MESH_FRIEND_PDU_PARTIAL; + return 0; + } + + LOG_DBG("Complete SDU"); + + if (rpl) { + bt_mesh_rpl_update(rpl, net_rx); + /* Update the seg, unless it has already been surpassed: + * This needs to happen after rpl_update to ensure that the IV + * update reset logic inside rpl_update doesn't overwrite the + * change. + */ + rpl->seg = MAX(rpl->seg, auth_seqnum); + } + + *pdu_type = BT_MESH_FRIEND_PDU_COMPLETE; + + /* If this fails, the work handler will either exit early because the + * block is fully received, or rx->in_use is false. + */ + (void)k_work_cancel_delayable(&rx->ack); + send_ack(net_rx->sub, net_rx->ctx.recv_dst, net_rx->ctx.addr, + net_rx->ctx.send_ttl, seq_auth, rx->block, rx->obo); + + if (net_rx->ctl) { + NET_BUF_SIMPLE_DEFINE(sdu, BT_MESH_RX_CTL_MAX); + seg_rx_assemble(rx, &sdu, 0U); + err = ctl_recv(net_rx, *hdr, &sdu, seq_auth); + } else if (rx->len < 1 + APP_MIC_LEN(ASZMIC(hdr))) { + LOG_ERR("Too short SDU + MIC"); + err = -EINVAL; + } else { + NET_BUF_SIMPLE_DEFINE_STATIC(seg_buf, BT_MESH_RX_SDU_MAX); + struct net_buf_simple sdu; + + /* Decrypting in place to avoid creating two assembly buffers. + * We'll reassemble the buffer from the segments before each + * decryption attempt. + */ + net_buf_simple_init(&seg_buf, 0); + net_buf_simple_init_with_data( + &sdu, seg_buf.data, rx->len - APP_MIC_LEN(ASZMIC(hdr))); + + err = sdu_recv(net_rx, *hdr, ASZMIC(hdr), &seg_buf, &sdu, rx); + } + + seg_rx_reset(rx, false); + + return err; +} + +int bt_mesh_trans_recv(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx) +{ + uint64_t seq_auth = TRANS_SEQ_AUTH_NVAL; + enum bt_mesh_friend_pdu_type pdu_type = BT_MESH_FRIEND_PDU_SINGLE; + struct net_buf_simple_state state; + uint8_t seg_count = 0; + int err; + + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { + rx->friend_match = bt_mesh_friend_match(rx->sub->net_idx, + rx->ctx.recv_dst); + } else { + rx->friend_match = false; + } + + LOG_DBG("src 0x%04x dst 0x%04x seq 0x%08x friend_match %u", rx->ctx.addr, rx->ctx.recv_dst, + rx->seq, rx->friend_match); + + /* Remove network headers */ + net_buf_simple_pull(buf, BT_MESH_NET_HDR_LEN); + + LOG_DBG("Payload %s", bt_hex(buf->data, buf->len)); + + if (IS_ENABLED(CONFIG_BT_TESTING)) { + bt_test_mesh_net_recv(rx->ctx.recv_ttl, rx->ctl, rx->ctx.addr, + rx->ctx.recv_dst, buf->data, buf->len); + } + + /* If LPN mode is enabled messages are only accepted when we've + * requested the Friend to send them. The messages must also + * be encrypted using the Friend Credentials. + */ + if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER) && + bt_mesh_lpn_established() && rx->net_if == BT_MESH_NET_IF_ADV && + (!bt_mesh_lpn_waiting_update() || !rx->friend_cred)) { + LOG_WRN("Ignoring unexpected message in Low Power mode"); + return -EAGAIN; + } + + /* Save the app-level state so the buffer can later be placed in + * the Friend Queue. + */ + net_buf_simple_save(buf, &state); + + if (SEG(buf->data)) { + /* Segmented messages must match a local element or an + * LPN of this Friend. + */ + if (!rx->local_match && !rx->friend_match) { + return 0; + } + + err = trans_seg(buf, rx, &pdu_type, &seq_auth, &seg_count); + } else { + seg_count = 1; + err = trans_unseg(buf, rx, &seq_auth); + } + + /* Notify LPN state machine so a Friend Poll will be sent. */ + if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) { + bt_mesh_lpn_msg_received(rx); + } + + net_buf_simple_restore(buf, &state); + + if (IS_ENABLED(CONFIG_BT_MESH_FRIEND) && rx->friend_match && !err) { + if (seq_auth == TRANS_SEQ_AUTH_NVAL) { + bt_mesh_friend_enqueue_rx(rx, pdu_type, NULL, + seg_count, buf); + } else { + bt_mesh_friend_enqueue_rx(rx, pdu_type, &seq_auth, + seg_count, buf); + } + } + + return err; +} + +void bt_mesh_rx_reset(void) +{ + int i; + + LOG_DBG(""); + + for (i = 0; i < ARRAY_SIZE(seg_rx); i++) { + seg_rx_reset(&seg_rx[i], true); + } +} + +void bt_mesh_trans_reset(void) +{ + int i; + + bt_mesh_rx_reset(); + + LOG_DBG(""); + + for (i = 0; i < ARRAY_SIZE(seg_tx); i++) { + seg_tx_reset(&seg_tx[i]); + } + + bt_mesh_rpl_clear(); + bt_mesh_va_clear(); +} + +void bt_mesh_trans_init(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(seg_tx); i++) { + k_work_init_delayable(&seg_tx[i].retransmit, seg_retransmit); + } + + for (i = 0; i < ARRAY_SIZE(seg_rx); i++) { + k_work_init_delayable(&seg_rx[i].ack, seg_ack); + } +} diff --git a/tests/bluetooth/mesh/blob_io_flash/prj.conf b/tests/bluetooth/mesh/blob_io_flash/prj.conf index 1e7864aa05d..2a0e98421fa 100644 --- a/tests/bluetooth/mesh/blob_io_flash/prj.conf +++ b/tests/bluetooth/mesh/blob_io_flash/prj.conf @@ -15,6 +15,7 @@ CONFIG_BT_NO_DRIVER=y CONFIG_BT_OBSERVER=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_MESH=y +CONFIG_BT_MESH_V1d1=y CONFIG_BT_MESH_BLOB_SRV=y CONFIG_BT_MESH_BLOB_CLI=y CONFIG_BT_MESH_BLOB_IO_FLASH=y diff --git a/tests/bluetooth/mesh_shell/proxy_solicitation.conf b/tests/bluetooth/mesh_shell/proxy_solicitation.conf index 51e50c07a01..f900d743516 100644 --- a/tests/bluetooth/mesh_shell/proxy_solicitation.conf +++ b/tests/bluetooth/mesh_shell/proxy_solicitation.conf @@ -1,3 +1,4 @@ +CONFIG_BT_MESH_V1d1=y CONFIG_BT_CENTRAL=y CONFIG_BT_MESH_PROXY_CLIENT=y CONFIG_BT_MESH_PROXY_SOLICITATION=y diff --git a/tests/bluetooth/tester/overlay-mesh-v1d1.conf b/tests/bluetooth/tester/overlay-mesh-v1d1.conf new file mode 100644 index 00000000000..52045ce34df --- /dev/null +++ b/tests/bluetooth/tester/overlay-mesh-v1d1.conf @@ -0,0 +1,30 @@ +CONFIG_ENTROPY_GENERATOR=y + +CONFIG_BT_MESH_V1d1=y +CONFIG_BT_MESH_OP_AGG_CLI=y +CONFIG_BT_MESH_OP_AGG_SRV=y +# PTS requires more key slots. +# First one is implicitly taken by Device Key. +CONFIG_BT_MESH_MODEL_KEY_COUNT=3 +CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y +CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y +CONFIG_BT_MESH_SAR_CFG_SRV=y +CONFIG_BT_MESH_SAR_CFG_CLI=y +CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 +CONFIG_BT_MESH_RPR_SRV=y +CONFIG_BT_MESH_RPR_CLI=y +CONFIG_BT_MESH_RPR_AD_TYPES_MAX=2 +CONFIG_BT_MESH_BLOB_CLI=y +CONFIG_BT_MESH_DFU_CLI=y +CONFIG_BT_MESH_BLOB_SRV=y +CONFIG_BT_MESH_DFU_SRV=y +CONFIG_BT_MESH_DFD_SRV=y +CONFIG_BT_MESH_DFU_SLOT_CNT=2 +CONFIG_BT_MESH_PRIV_BEACONS=y +CONFIG_BT_MESH_PRIV_BEACON_SRV=y +CONFIG_BT_MESH_PRIV_BEACON_CLI=y +CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y +CONFIG_BT_MESH_MODEL_EXTENSIONS=y +CONFIG_BT_MESH_COMP_PAGE_1=y +CONFIG_BT_MESH_COMP_PAGE_2=y +CONFIG_SETTINGS=y diff --git a/tests/bluetooth/tester/overlay-mesh.conf b/tests/bluetooth/tester/overlay-mesh.conf index 9fded71f792..840af06c1c0 100644 --- a/tests/bluetooth/tester/overlay-mesh.conf +++ b/tests/bluetooth/tester/overlay-mesh.conf @@ -1,5 +1,3 @@ -CONFIG_ENTROPY_GENERATOR=y - CONFIG_BT_MESH=y CONFIG_BT_MESH_RELAY=y CONFIG_BT_MESH_PB_ADV=y @@ -25,30 +23,3 @@ CONFIG_BT_MESH_CDB_NODE_COUNT=3 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y CONFIG_BT_MESH_MSG_CACHE_SIZE=10 CONFIG_BT_MESH_PROXY_CLIENT=y -CONFIG_BT_MESH_OP_AGG_CLI=y -CONFIG_BT_MESH_OP_AGG_SRV=y -# PTS requires more key slots. -# First one is implicitly taken by Device Key. -CONFIG_BT_MESH_MODEL_KEY_COUNT=3 -CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y -CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y -CONFIG_BT_MESH_SAR_CFG_SRV=y -CONFIG_BT_MESH_SAR_CFG_CLI=y -CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 -CONFIG_BT_MESH_RPR_SRV=y -CONFIG_BT_MESH_RPR_CLI=y -CONFIG_BT_MESH_RPR_AD_TYPES_MAX=2 -CONFIG_BT_MESH_BLOB_CLI=y -CONFIG_BT_MESH_DFU_CLI=y -CONFIG_BT_MESH_BLOB_SRV=y -CONFIG_BT_MESH_DFU_SRV=y -CONFIG_BT_MESH_DFD_SRV=y -CONFIG_BT_MESH_DFU_SLOT_CNT=2 -CONFIG_BT_MESH_PRIV_BEACONS=y -CONFIG_BT_MESH_PRIV_BEACON_SRV=y -CONFIG_BT_MESH_PRIV_BEACON_CLI=y -CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y -CONFIG_BT_MESH_MODEL_EXTENSIONS=y -CONFIG_BT_MESH_COMP_PAGE_1=y -CONFIG_BT_MESH_COMP_PAGE_2=y -CONFIG_SETTINGS=y diff --git a/tests/bluetooth/tester/testcase.yaml b/tests/bluetooth/tester/testcase.yaml index 37c7ab3193d..8c36291b30f 100644 --- a/tests/bluetooth/tester/testcase.yaml +++ b/tests/bluetooth/tester/testcase.yaml @@ -28,3 +28,13 @@ tests: extra_args: OVERLAY_CONFIG="overlay-mesh.conf" tags: bluetooth harness: bluetooth + bluetooth.general.tester_mesh_v1d1: + build_only: true + platform_allow: + - qemu_x86 + - native_posix + - native_sim + - nrf52840dk_nrf52840 + extra_args: OVERLAY_CONFIG="overlay-mesh.conf;overlay-mesh-v1d1.conf" + tags: bluetooth + harness: bluetooth diff --git a/tests/bsim/bluetooth/mesh/CMakeLists.txt b/tests/bsim/bluetooth/mesh/CMakeLists.txt index 17bcb3f208f..44c72dd9cbb 100644 --- a/tests/bsim/bluetooth/mesh/CMakeLists.txt +++ b/tests/bsim/bluetooth/mesh/CMakeLists.txt @@ -9,21 +9,30 @@ target_sources(app PRIVATE src/main.c src/mesh_test.c src/friendship_common.c - src/gatt_common.c - src/dfu_blob_common.c ) +if(CONFIG_BT_MESH_V1d1) + target_sources(app PRIVATE + src/dfu_blob_common.c + ) +endif() + if(CONFIG_SETTINGS) target_sources(app PRIVATE src/test_persistence.c src/test_replay_cache.c src/test_provision.c - src/test_dfu.c - src/test_blob.c - src/test_sar.c - src/test_lcd.c -) + ) + + if(CONFIG_BT_MESH_V1d1) + target_sources(app PRIVATE + src/test_dfu.c + src/test_blob.c + src/test_sar.c + src/test_lcd.c + ) + endif() if(CONFIG_BT_MESH_USES_MBEDTLS_PSA) target_sources(app PRIVATE @@ -36,10 +45,14 @@ elseif(CONFIG_BT_MESH_GATT_PROXY) target_sources(app PRIVATE src/test_advertiser.c - src/test_suspend.c - src/test_beacon.c ) + if(CONFIG_BT_MESH_V1d1) + target_sources(app PRIVATE + src/test_beacon.c + ) + endif() + elseif(CONFIG_BT_CTLR_LOW_LAT) target_sources(app PRIVATE @@ -59,13 +72,17 @@ else() src/test_access.c src/test_iv_index.c src/test_advertiser.c - src/test_suspend.c - src/test_blob.c - src/test_op_agg.c - src/test_sar.c - src/test_cdp1.c ) + if(CONFIG_BT_MESH_V1d1) + target_sources(app PRIVATE + src/test_blob.c + src/test_op_agg.c + src/test_sar.c + src/test_cdp1.c + ) + endif() + endif() zephyr_include_directories( diff --git a/tests/bsim/bluetooth/mesh/compile.sh b/tests/bsim/bluetooth/mesh/compile.sh index 06557ef0ebb..de9b4bd6af0 100755 --- a/tests/bsim/bluetooth/mesh/compile.sh +++ b/tests/bsim/bluetooth/mesh/compile.sh @@ -18,13 +18,22 @@ mkdir -p ${WORK_DIR} source ${ZEPHYR_BASE}/tests/bsim/compile.source app=tests/bsim/bluetooth/mesh compile +app=tests/bsim/bluetooth/mesh conf_overlay=overlay_low_lat.conf compile 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_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_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_file=prj_mesh1d1.conf compile +app=tests/bsim/bluetooth/mesh \ + conf_file=prj_mesh1d1.conf conf_overlay=overlay_pst.conf compile +app=tests/bsim/bluetooth/mesh \ + conf_file=prj_mesh1d1.conf conf_overlay=overlay_gatt.conf compile +app=tests/bsim/bluetooth/mesh \ + conf_file=prj_mesh1d1.conf conf_overlay=overlay_low_lat.conf compile +app=tests/bsim/bluetooth/mesh conf_file=prj_mesh1d1.conf conf_overlay=overlay_psa.conf compile +app=tests/bsim/bluetooth/mesh \ + conf_file=prj_mesh1d1.conf conf_overlay="overlay_pst.conf;overlay_psa.conf" compile +app=tests/bsim/bluetooth/mesh \ + conf_file=prj_mesh1d1.conf conf_overlay="overlay_gatt.conf;overlay_psa.conf" compile +app=tests/bsim/bluetooth/mesh \ + conf_file=prj_mesh1d1.conf conf_overlay="overlay_low_lat.conf;overlay_psa.conf" compile wait_for_background_jobs diff --git a/tests/bsim/bluetooth/mesh/overlay_pst.conf b/tests/bsim/bluetooth/mesh/overlay_pst.conf index e02c0ec2b93..6730b9ee233 100644 --- a/tests/bsim/bluetooth/mesh/overlay_pst.conf +++ b/tests/bsim/bluetooth/mesh/overlay_pst.conf @@ -18,4 +18,7 @@ CONFIG_BT_MESH_SUBNET_COUNT=2 CONFIG_BT_MESH_SEQ_STORE_RATE=1 CONFIG_BT_MESH_RPL_STORE_TIMEOUT=1 CONFIG_BT_MESH_STORE_TIMEOUT=1 +CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT=1 +CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST=200 +CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT=400 CONFIG_BT_MESH_COMP_PST_BUF_SIZE=600 diff --git a/tests/bsim/bluetooth/mesh/prj.conf b/tests/bsim/bluetooth/mesh/prj.conf index 1c343bb512f..e9c719de6d7 100644 --- a/tests/bsim/bluetooth/mesh/prj.conf +++ b/tests/bsim/bluetooth/mesh/prj.conf @@ -19,12 +19,11 @@ CONFIG_BT_CTLR_PRIVACY=n CONFIG_BT_MESH=y CONFIG_BT_MESH_LOG_LEVEL_DBG=y CONFIG_BT_MESH_RELAY=y -CONFIG_BT_MESH_ADV_BUF_COUNT=64 +CONFIG_BT_MESH_ADV_BUF_COUNT=32 CONFIG_BT_MESH_TX_SEG_MAX=32 CONFIG_BT_MESH_RX_SEG_MAX=32 CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 CONFIG_BT_MESH_RX_SEG_MSG_COUNT=10 -CONFIG_BT_MESH_SEG_BUFS=100 CONFIG_BT_MESH_CFG_CLI=y CONFIG_BT_MESH_MODEL_GROUP_COUNT=3 CONFIG_BT_MESH_LOW_POWER=y @@ -44,29 +43,4 @@ CONFIG_BT_MESH_CDB_NODE_COUNT=4 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y CONFIG_BT_MESH_MODEL_EXTENSIONS=y CONFIG_BT_MESH_SUBNET_COUNT=5 -CONFIG_BT_MESH_SAR_CFG_CLI=y -CONFIG_BT_MESH_SAR_CFG_SRV=y -CONFIG_BT_MESH_BLOB_SRV=y -CONFIG_BT_MESH_BLOB_CLI=y -CONFIG_BT_MESH_BLOB_BLOCK_SIZE_MIN=256 -CONFIG_BT_MESH_RPR_CLI=y -CONFIG_BT_MESH_RPR_SRV=y -CONFIG_BT_MESH_OP_AGG_CLI=y -CONFIG_BT_MESH_OP_AGG_SRV=y -CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y -CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y -CONFIG_BT_MESH_DFU_SRV=y -CONFIG_BT_MESH_DFU_CLI=y -CONFIG_BT_MESH_DFD_SRV=y -CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD=y -CONFIG_BT_MESH_DFU_SLOT_CNT=4 -CONFIG_BT_MESH_PRIV_BEACON_SRV=y -CONFIG_BT_MESH_PRIV_BEACON_CLI=y -CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y -CONFIG_BT_MESH_OD_PRIV_PROXY_CLI=y -CONFIG_BT_MESH_COMP_PAGE_1=y -CONFIG_BT_MESH_COMP_PAGE_2=y CONFIG_BT_TESTING=y - -# Needed for RPR tests due to huge amount of retransmitted messages -CONFIG_BT_MESH_MSG_CACHE_SIZE=64 diff --git a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf new file mode 100644 index 00000000000..fd0c953226b --- /dev/null +++ b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf @@ -0,0 +1,73 @@ +CONFIG_LOG_MODE_IMMEDIATE=y +CONFIG_ASSERT=y +CONFIG_SYS_CLOCK_TICKS_PER_SEC=32768 + +# Bluetooth configuration +CONFIG_BT=y +CONFIG_LOG=y +CONFIG_BT_PRIVACY=n +CONFIG_BT_COMPANY_ID=0x0059 +CONFIG_BT_DEVICE_NAME="Mesh test" +CONFIG_BT_OBSERVER=y +CONFIG_BT_BROADCASTER=y + +# Disable unused Bluetooth features +CONFIG_BT_CTLR_DUP_FILTER_LEN=0 +CONFIG_BT_CTLR_PRIVACY=n + +# Bluetooth Mesh configuration +CONFIG_BT_MESH=y +CONFIG_BT_MESH_V1d1=y +CONFIG_BT_MESH_LOG_LEVEL_DBG=y +CONFIG_BT_MESH_RELAY=y +CONFIG_BT_MESH_ADV_BUF_COUNT=64 +CONFIG_BT_MESH_TX_SEG_MAX=32 +CONFIG_BT_MESH_RX_SEG_MAX=32 +CONFIG_BT_MESH_TX_SEG_MSG_COUNT=10 +CONFIG_BT_MESH_RX_SEG_MSG_COUNT=10 +CONFIG_BT_MESH_SEG_BUFS=100 +CONFIG_BT_MESH_CFG_CLI=y +CONFIG_BT_MESH_MODEL_GROUP_COUNT=3 +CONFIG_BT_MESH_LOW_POWER=y +CONFIG_BT_MESH_LPN_AUTO=n +CONFIG_BT_MESH_FRIEND=y +CONFIG_BT_MESH_FRIEND_ENABLED=n +CONFIG_BT_MESH_FRIEND_LPN_COUNT=5 +CONFIG_BT_MESH_APP_KEY_COUNT=2 +CONFIG_BT_MESH_MODEL_KEY_COUNT=2 +CONFIG_BT_MESH_LABEL_COUNT=3 +CONFIG_BT_MESH_IV_UPDATE_TEST=y +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_PROV_OOB_PUBLIC_KEY=y +CONFIG_BT_MESH_MODEL_EXTENSIONS=y +CONFIG_BT_MESH_SUBNET_COUNT=5 +CONFIG_BT_MESH_SAR_CFG_CLI=y +CONFIG_BT_MESH_SAR_CFG_SRV=y +CONFIG_BT_MESH_BLOB_SRV=y +CONFIG_BT_MESH_BLOB_CLI=y +CONFIG_BT_MESH_BLOB_BLOCK_SIZE_MIN=256 +CONFIG_BT_MESH_RPR_CLI=y +CONFIG_BT_MESH_RPR_SRV=y +CONFIG_BT_MESH_OP_AGG_CLI=y +CONFIG_BT_MESH_OP_AGG_SRV=y +CONFIG_BT_MESH_LARGE_COMP_DATA_CLI=y +CONFIG_BT_MESH_LARGE_COMP_DATA_SRV=y +CONFIG_BT_MESH_DFU_SRV=y +CONFIG_BT_MESH_DFU_CLI=y +CONFIG_BT_MESH_DFD_SRV=y +CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD=y +CONFIG_BT_MESH_DFU_SLOT_CNT=4 +CONFIG_BT_MESH_PRIV_BEACON_SRV=y +CONFIG_BT_MESH_PRIV_BEACON_CLI=y +CONFIG_BT_MESH_OD_PRIV_PROXY_SRV=y +CONFIG_BT_MESH_OD_PRIV_PROXY_CLI=y +CONFIG_BT_MESH_COMP_PAGE_1=y +CONFIG_BT_MESH_COMP_PAGE_2=y +CONFIG_BT_TESTING=y + +# Needed for RPR tests due to huge amount of retransmitted messages +CONFIG_BT_MESH_MSG_CACHE_SIZE=64 diff --git a/tests/bsim/bluetooth/mesh/src/main.c b/tests/bsim/bluetooth/mesh/src/main.c index a3dfb59373f..127e52faa49 100644 --- a/tests/bsim/bluetooth/mesh/src/main.c +++ b/tests/bsim/bluetooth/mesh/src/main.c @@ -11,14 +11,18 @@ extern struct bst_test_list *test_persistence_install(struct bst_test_list *tests); extern struct bst_test_list *test_rpc_install(struct bst_test_list *tests); extern struct bst_test_list *test_provision_pst_install(struct bst_test_list *tests); +#if defined(CONFIG_BT_MESH_V1d1) extern struct bst_test_list *test_dfu_install(struct bst_test_list *test); extern struct bst_test_list *test_blob_pst_install(struct bst_test_list *test); extern struct bst_test_list *test_lcd_install(struct bst_test_list *test); extern struct bst_test_list *test_sar_pst_install(struct bst_test_list *test); +#endif /* defined(CONFIG_BT_MESH_V1d1) */ #elif defined(CONFIG_BT_MESH_GATT_PROXY) extern struct bst_test_list *test_adv_install(struct bst_test_list *test); -extern struct bst_test_list *test_suspend_install(struct bst_test_list *test); +#if defined(CONFIG_BT_MESH_V1d1) extern struct bst_test_list *test_beacon_install(struct bst_test_list *tests); +#endif /* defined(CONFIG_BT_MESH_V1d1) */ + #elif defined(CONFIG_BT_CTLR_LOW_LAT) extern struct bst_test_list *test_transport_install(struct bst_test_list *tests); extern struct bst_test_list *test_friendship_install(struct bst_test_list *tests); @@ -32,26 +36,30 @@ extern struct bst_test_list *test_heartbeat_install(struct bst_test_list *test); extern struct bst_test_list *test_access_install(struct bst_test_list *test); extern struct bst_test_list *test_ivi_install(struct bst_test_list *test); extern struct bst_test_list *test_adv_install(struct bst_test_list *test); -extern struct bst_test_list *test_suspend_install(struct bst_test_list *test); +#if defined(CONFIG_BT_MESH_V1d1) extern struct bst_test_list *test_blob_install(struct bst_test_list *test); extern struct bst_test_list *test_op_agg_install(struct bst_test_list *test); extern struct bst_test_list *test_sar_install(struct bst_test_list *test); extern struct bst_test_list *test_cdp1_install(struct bst_test_list *test); +#endif /* defined(CONFIG_BT_MESH_V1d1) */ #endif bst_test_install_t test_installers[] = { #if defined(CONFIG_SETTINGS) test_persistence_install, test_rpc_install, +#if defined(CONFIG_BT_MESH_V1d1) test_provision_pst_install, test_dfu_install, test_blob_pst_install, test_lcd_install, test_sar_pst_install, +#endif /* defined(CONFIG_BT_MESH_V1d1) */ #elif defined(CONFIG_BT_MESH_GATT_PROXY) test_adv_install, - test_suspend_install, +#if defined(CONFIG_BT_MESH_V1d1) test_beacon_install, +#endif /* defined(CONFIG_BT_MESH_V1d1) */ #elif defined(CONFIG_BT_CTLR_LOW_LAT) test_transport_install, test_friendship_install, @@ -65,11 +73,12 @@ bst_test_install_t test_installers[] = { test_access_install, test_ivi_install, test_adv_install, - test_suspend_install, +#if defined(CONFIG_BT_MESH_V1d1) test_blob_install, test_op_agg_install, test_sar_install, test_cdp1_install, +#endif /* defined(CONFIG_BT_MESH_V1d1) */ #endif NULL }; diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index 7a74123cb0f..e5f7d515da7 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -27,7 +27,9 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL_INF); #define BEACON_INTERVAL 10 /*seconds*/ #define BEACON_TYPE_SECURE 0x01 +#if CONFIG_BT_MESH_V1d1 #define BEACON_TYPE_PRIVATE 0x02 +#endif static uint8_t test_net_key_2[16] = { 0xca, 0x11, 0xab, 0x1e }; static struct { @@ -69,6 +71,7 @@ BT_MESH_BEACON_CB_DEFINE(snb) = { /* Setting for scanner defining what beacon is expected next, SNB as default */ static uint8_t expected_beacon = BEACON_TYPE_SECURE; +#if CONFIG_BT_MESH_V1d1 static struct bt_mesh_cfg_cli cfg_cli; static struct bt_mesh_priv_beacon_cli priv_beacon_cli; @@ -96,6 +99,7 @@ static uint8_t last_random[13]; static bt_addr_le_t last_beacon_adv_addr; static struct bt_mesh_key priv_beacon_key; +#endif /* CONFIG_BT_MESH_V1d1 */ static int random_interval; @@ -326,11 +330,13 @@ static struct k_sem observer_sem; static struct { uint8_t flags; uint32_t iv_index; +#if CONFIG_BT_MESH_V1d1 uint8_t random[13]; uint64_t pp_hash; uint64_t pp_random; uint64_t net_id; bt_addr_le_t adv_addr; +#endif bool (*process_cb)(const uint8_t *net_id, void *ctx); void *user_ctx; } beacon; @@ -358,6 +364,7 @@ static void beacon_scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_ty net_id = net_buf_simple_pull_mem(buf, 8); beacon.iv_index = net_buf_simple_pull_be32(buf); } +#if CONFIG_BT_MESH_V1d1 else if (expected_beacon == BEACON_TYPE_PRIVATE) { uint8_t private_beacon_data[5]; @@ -370,7 +377,7 @@ static void beacon_scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_ty beacon.flags = private_beacon_data[0]; beacon.iv_index = sys_get_be32(&private_beacon_data[1]); } - +#endif if (!beacon.process_cb || beacon.process_cb(net_id, beacon.user_ctx)) { k_sem_give(&observer_sem); } @@ -1057,6 +1064,8 @@ static void test_tx_beacon_cache(void) PASS(); } +#if CONFIG_BT_MESH_V1d1 + typedef void (*priv_beacon_cb)(const struct bt_mesh_prb *prb); static priv_beacon_cb priv_beacon_cb_ptr; @@ -2187,6 +2196,8 @@ static void test_rx_priv_gatt_proxy(void) #endif +#endif /* CONFIG_BT_MESH_V1d1 */ + #define TEST_CASE(role, name, description) \ { \ .test_id = "beacon_" #role "_" #name, \ @@ -2205,6 +2216,7 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(tx, multiple_netkeys, "Beacon: multiple Net Keys"), TEST_CASE(tx, secure_beacon_interval, "Beacon: send secure beacons"), TEST_CASE(tx, beacon_cache, "Beacon: advertise duplicate SNBs"), +#if CONFIG_BT_MESH_V1d1 TEST_CASE(tx, priv_on_iv_update, "Private Beacon: send on IV update"), TEST_CASE(tx, priv_on_key_refresh, "Private Beacon: send on Key Refresh"), TEST_CASE(tx, priv_adv, "Private Beacon: advertise Private Beacons"), @@ -2218,6 +2230,7 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(tx, priv_gatt_proxy, "Private Proxy: Send Private Beacons over GATT"), TEST_CASE(tx, proxy_adv_multi_subnet_coex, "Proxy Adv: Multi subnet coex proxy adv"), TEST_CASE(tx, proxy_adv_solicit_trigger, "Proxy Adv: Trigger Solicitation"), +#endif #endif TEST_CASE(rx, on_iv_update, "Beacon: receive with IV update flag"), @@ -2227,6 +2240,7 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(rx, multiple_netkeys, "Beacon: multiple Net Keys"), TEST_CASE(rx, secure_beacon_interval, "Beacon: receive and send secure beacons"), TEST_CASE(rx, beacon_cache, "Beacon: receive duplicate SNBs"), +#if CONFIG_BT_MESH_V1d1 TEST_CASE(rx, priv_adv, "Private Beacon: verify random regeneration"), TEST_CASE(rx, priv_invalid, "Private Beacon: receive invalid beacons"), TEST_CASE(rx, priv_interleave, "Private Beacon: interleaved with SNB"), @@ -2237,6 +2251,7 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(rx, priv_multi_net_id, "Private Proxy: scan for multiple Net ID"), TEST_CASE(rx, priv_gatt_proxy, "Private Proxy: Receive Private Beacons over GATT"), TEST_CASE(rx, proxy_adv_multi_subnet_coex, "Proxy Adv: Multi subnet coex proxy adv"), +#endif #endif BSTEST_END_MARKER }; diff --git a/tests/bsim/bluetooth/mesh/src/test_provision.c b/tests/bsim/bluetooth/mesh/src/test_provision.c index 789de47837b..3d0e8010c75 100644 --- a/tests/bsim/bluetooth/mesh/src/test_provision.c +++ b/tests/bsim/bluetooth/mesh/src/test_provision.c @@ -52,9 +52,11 @@ enum test_flags { static uint8_t static_key1[] = {0x6E, 0x6F, 0x72, 0x64, 0x69, 0x63, 0x5F, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x5F, 0x31}; static uint8_t static_key2[] = {0x6E, 0x6F, 0x72, 0x64, 0x69, 0x63, 0x5F}; +#if IS_ENABLED(CONFIG_BT_MESH_V1d1) static uint8_t static_key3[] = {0x45, 0x6E, 0x68, 0x61, 0x6E, 0x63, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6F, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x69, 0x6E, 0x67, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x20, 0x4F, 0x4F, 0x42}; +#endif static uint8_t private_key_be[32]; static uint8_t public_key_be[64]; @@ -70,7 +72,9 @@ static struct oob_auth_test_vector_s { {NULL, 0, 0, 0, 0, 0}, {static_key1, sizeof(static_key1), 0, 0, 0, 0}, {static_key2, sizeof(static_key2), 0, 0, 0, 0}, +#if IS_ENABLED(CONFIG_BT_MESH_V1d1) {static_key3, sizeof(static_key3), 0, 0, 0, 0}, +#endif {NULL, 0, 3, BT_MESH_BLINK, 0, 0}, {NULL, 0, 5, BT_MESH_BEEP, 0, 0}, {NULL, 0, 6, BT_MESH_VIBRATE, 0, 0}, diff --git a/tests/bsim/bluetooth/mesh/src/test_replay_cache.c b/tests/bsim/bluetooth/mesh/src/test_replay_cache.c index 57d605fb97a..68dc52a7b5d 100644 --- a/tests/bsim/bluetooth/mesh/src/test_replay_cache.c +++ b/tests/bsim/bluetooth/mesh/src/test_replay_cache.c @@ -78,6 +78,7 @@ static void rx_ended(uint8_t *data, size_t len) static void tx_sar_conf(void) { +#ifdef CONFIG_BT_MESH_V1d1 /* Reconfigure SAR Transmitter state so that the transport layer doesn't * retransmit. */ @@ -96,10 +97,12 @@ static void tx_sar_conf(void) #else bt_mesh.sar_tx = tx_set; #endif +#endif } static void rx_sar_conf(void) { +#ifdef CONFIG_BT_MESH_V1d1 /* Reconfigure SAR Receiver state so that the transport layer does * generate Segmented Acks as rarely as possible. */ @@ -116,6 +119,7 @@ static void rx_sar_conf(void) #else bt_mesh.sar_rx = rx_set; #endif +#endif } static void test_tx_immediate_replay_attack(void) diff --git a/tests/bsim/bluetooth/mesh/src/test_transport.c b/tests/bsim/bluetooth/mesh/src/test_transport.c index 309681ceafe..05026f6dcf7 100644 --- a/tests/bsim/bluetooth/mesh/src/test_transport.c +++ b/tests/bsim/bluetooth/mesh/src/test_transport.c @@ -94,6 +94,7 @@ static void async_send_end(int err, void *data) static void rx_sar_conf(void) { +#ifdef CONFIG_BT_MESH_V1d1 /* Reconfigure SAR Receiver state so that the transport layer does * generate Segmented Acks as rarely as possible. */ @@ -110,6 +111,7 @@ static void rx_sar_conf(void) #else bt_mesh.sar_rx = rx_set; #endif +#endif } static const struct bt_mesh_send_cb async_send_cb = { diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_cancel.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_cancel.sh index 85b76062b60..6a56a084c60 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_cancel.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_cancel.sh @@ -7,6 +7,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_publication_cancel \ access_tx_cancel access_rx_cancel +conf=prj_mesh1d1_conf +RunTest mesh_access_publication_cancel_1d1 \ + access_tx_cancel access_rx_cancel + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_publication_cancel_psa \ access_tx_cancel access_rx_cancel diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub.sh index 66caf516bb2..862291b4c76 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub.sh @@ -7,6 +7,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_extended_model_subs \ access_tx_ext_model access_sub_ext_model +conf=prj_mesh1d1_conf +RunTest mesh_access_extended_model_subs_1d1 \ + access_tx_ext_model access_sub_ext_model + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_extended_model_subs_psa \ access_tx_ext_model access_sub_ext_model diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub_cap.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub_cap.sh index 91576f34aa0..2a4f9ccc247 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub_cap.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_ext_sub_cap.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_extended_model_subs_cap access_sub_capacity_ext_model +conf=prj_mesh1d1_conf +RunTest mesh_access_extended_model_subs_cap_1d1 access_sub_capacity_ext_model + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_extended_model_subs_cap_psa access_sub_capacity_ext_model diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period.sh index f2e72085ac7..d2bb07c6de7 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period.sh @@ -7,6 +7,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_per_pub \ access_tx_period access_rx_period +conf=prj_mesh1d1_conf +RunTest mesh_access_per_pub_1d1 \ + access_tx_period access_rx_period + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_per_pub_psa \ access_tx_period access_rx_period diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh index 0148026fc6f..5ecd4a061de 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh @@ -7,6 +7,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_pub_period_delayable_retr \ access_tx_period_delayable access_rx_period_delayable +conf=prj_mesh1d1_conf +RunTest mesh_access_pub_period_delayable_retr_1d1 \ + access_tx_period_delayable access_rx_period_delayable + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_pub_period_delayable_retr_psa \ access_tx_period_delayable access_rx_period_delayable diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit.sh index 0a0ec47da15..c2f4a27ddbd 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit.sh @@ -7,6 +7,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_pub_retr \ access_tx_transmit access_rx_transmit +conf=prj_mesh1d1_conf +RunTest mesh_access_pub_retr_1d1 \ + access_tx_transmit access_rx_transmit + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_pub_retr_psa \ access_tx_period access_rx_period diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh index 2dba89f2d76..0e966288db0 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh @@ -7,6 +7,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_access_pub_transmit_delayable_retr \ access_tx_transmit_delayable access_rx_transmit_delayable +conf=prj_mesh1d1_conf +RunTest mesh_access_pub_transmit_delayable_retr_1d1 \ + access_tx_transmit_delayable access_rx_transmit_delayable + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_pub_transmit_delayable_retr_psa \ access_tx_transmit_delayable access_rx_transmit_delayable 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 6c49d03fe9f..86255277277 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,10 @@ 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 +conf=prj_mesh1d1_conf +overlay=overlay_gatt_conf +RunTest mesh_adv_proxy_mixin_1d1 adv_tx_proxy_mixin adv_rx_proxy_mixin + +conf=prj_mesh1d1_conf 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 a171ffd60f3..8cfe0f9366a 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,9 @@ 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 +conf=prj_mesh1d1_conf +RunTest mesh_adv_random_order_1d1 adv_tx_random_order adv_rx_random_order + +conf=prj_mesh1d1_conf 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 2b047138109..96b30394f12 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,9 @@ 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 +conf=prj_mesh1d1_conf +RunTest mesh_adv_reverse_order_1d1 adv_tx_reverse_order adv_rx_receive_order + +conf=prj_mesh1d1_conf 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 a9e8d1ea861..e208bf54579 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,9 @@ 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 +conf=prj_mesh1d1_conf +RunTest mesh_adv_send_order_1d1 adv_tx_send_order adv_rx_receive_order + +conf=prj_mesh1d1_conf 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 4ca2838ddf9..28827c872f8 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,9 @@ 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 +conf=prj_mesh1d1_conf +RunTest mesh_adv_tx_cb_multi_1d1 adv_tx_cb_multi + +conf=prj_mesh1d1_conf 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 a2b1ad0e961..edf4ba0996b 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,9 @@ 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 +conf=prj_mesh1d1_conf +RunTest mesh_adv_tx_cb_single_1d1 adv_tx_cb_single adv_rx_xmit + +conf=prj_mesh1d1_conf 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/beacon/beacon_cache.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_cache.sh index ab43e2b74db..c0f741e9aae 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_cache.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_cache.sh @@ -15,6 +15,12 @@ RunTest mesh_beacon_cache \ beacon_tx_beacon_cache \ beacon_rx_beacon_cache +conf=prj_mesh1d1_conf +RunTest mesh_beacon_cache \ + beacon_tx_beacon_cache \ + beacon_rx_beacon_cache + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_cache \ beacon_tx_beacon_cache \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_interval.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_interval.sh index a671c90d668..ec70eb2f02c 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_interval.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/beacon_interval.sh @@ -22,6 +22,12 @@ RunTest mesh_beacon_interval \ beacon_tx_secure_beacon_interval \ beacon_rx_secure_beacon_interval +conf=prj_mesh1d1_conf +RunTest mesh_beacon_interval_1d1 \ + beacon_tx_secure_beacon_interval \ + beacon_rx_secure_beacon_interval + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_interval_psa \ beacon_tx_secure_beacon_interval \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/invalid.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/invalid.sh index 96d5b0a0f6b..ccce8c3a1f5 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/invalid.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/invalid.sh @@ -8,6 +8,12 @@ RunTest mesh_beacon_invalid \ beacon_tx_invalid \ beacon_rx_invalid +conf=prj_mesh1d1_conf +RunTest mesh_beacon_invalid_1d1 \ + beacon_tx_invalid \ + beacon_rx_invalid + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_invalid_psa \ beacon_tx_invalid \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/iv_update.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/iv_update.sh index d719aef86bc..64225fd9cf5 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/iv_update.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/iv_update.sh @@ -8,6 +8,12 @@ RunTest mesh_beacon_on_iv_update \ beacon_tx_on_iv_update \ beacon_rx_on_iv_update +conf=prj_mesh1d1_conf +RunTest mesh_beacon_on_iv_update_1d1 \ + beacon_tx_on_iv_update \ + beacon_rx_on_iv_update + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_on_iv_update_psa \ beacon_tx_on_iv_update \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/key_refresh.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/key_refresh.sh index 9223d7d1d29..00f82704718 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/key_refresh.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/key_refresh.sh @@ -8,6 +8,12 @@ RunTest mesh_beacon_on_key_refresh \ beacon_tx_on_key_refresh \ beacon_rx_on_key_refresh +conf=prj_mesh1d1_conf +RunTest mesh_beacon_on_key_refresh_1d1 \ + beacon_tx_on_key_refresh \ + beacon_rx_on_key_refresh + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_on_key_refresh_psa \ beacon_tx_on_key_refresh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/kr_old_key.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/kr_old_key.sh index ecd83e415a9..3d6b151a068 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/kr_old_key.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/kr_old_key.sh @@ -8,6 +8,12 @@ RunTest mesh_beacon_kr_old_key \ beacon_tx_kr_old_key \ beacon_rx_kr_old_key +conf=prj_mesh1d1_conf +RunTest mesh_beacon_kr_old_key_1d1 \ + beacon_tx_kr_old_key \ + beacon_rx_kr_old_key + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_kr_old_key_psa \ beacon_tx_kr_old_key \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/multiple_netkeys.sh b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/multiple_netkeys.sh index a8c154f5204..677e4227669 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/beacon/multiple_netkeys.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/beacon/multiple_netkeys.sh @@ -8,6 +8,12 @@ RunTest mesh_beacon_multiple_netkeys \ beacon_tx_multiple_netkeys \ beacon_rx_multiple_netkeys +conf=prj_mesh1d1_conf +RunTest mesh_beacon_multiple_netkeys_1d1 \ + beacon_tx_multiple_netkeys \ + beacon_rx_multiple_netkeys + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_beacon_multiple_netkeys_psa \ beacon_tx_multiple_netkeys \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_basic.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_basic.sh index d8665ac4cfd..6f1ec61ad27 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_basic.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_basic.sh @@ -4,7 +4,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh +conf=prj_mesh1d1_conf RunTest blob_broadcast_basic blob_cli_broadcast_basic +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_broadcast_basic_psa blob_cli_broadcast_basic diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_trans.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_trans.sh index 25198e70a38..d5d0f60d1ce 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_trans.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_trans.sh @@ -4,7 +4,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh +conf=prj_mesh1d1_conf RunTest blob_broadcast_trans blob_cli_broadcast_trans +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_broadcast_trans_psa blob_cli_broadcast_trans diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast.sh index 654753e2188..ee86ce33cfa 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast.sh @@ -4,7 +4,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh +conf=prj_mesh1d1_conf RunTest blob_broadcast_unicast blob_cli_broadcast_unicast +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_broadcast_unicast_psa blob_cli_broadcast_unicast diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast_seq.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast_seq.sh index cb569fdc3b4..c356122145c 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast_seq.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_broadcast_unicast_seq.sh @@ -4,7 +4,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh +conf=prj_mesh1d1_conf RunTest blob_broadcast_unicast_seq blob_cli_broadcast_unicast_seq +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_broadcast_unicast_seq_psa blob_cli_broadcast_unicast_seq diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_all_rsp.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_all_rsp.sh index d7f54a34d22..bc2aa351987 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_all_rsp.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_all_rsp.sh @@ -5,9 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf RunTest blob_caps_all_rsp \ blob_cli_caps_all_rsp blob_srv_caps_standard blob_srv_caps_standard +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_caps_all_rsp_psa \ blob_cli_caps_all_rsp blob_srv_caps_standard blob_srv_caps_standard diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_cancelled.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_cancelled.sh index e287dcbd9fc..3e1bd343a70 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_cancelled.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_cancelled.sh @@ -5,9 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance seqence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf RunTest blob_caps_cancelled \ blob_cli_caps_cancelled blob_srv_caps_standard +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_caps_cancelled_psa \ blob_cli_caps_cancelled blob_srv_caps_standard diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_no_rsp.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_no_rsp.sh index e5ee44b5a08..e53864f8be4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_no_rsp.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_no_rsp.sh @@ -5,9 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf RunTest blob_caps_no_rsp \ blob_cli_caps_no_rsp blob_srv_caps_no_rsp blob_srv_caps_no_rsp +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_caps_no_rsp_psa \ blob_cli_caps_no_rsp blob_srv_caps_no_rsp blob_srv_caps_no_rsp diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_partial_rsp.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_partial_rsp.sh index 2da51b0e37e..9a1675bd279 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_partial_rsp.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_caps_partial_rsp.sh @@ -5,9 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf RunTest blob_caps_partial_rsp \ blob_cli_caps_partial_rsp blob_srv_caps_standard blob_srv_caps_no_rsp +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_caps_partial_rsp_psa \ blob_cli_caps_partial_rsp blob_srv_caps_standard blob_srv_caps_no_rsp diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_friend.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_friend.sh index 0e82cf8df11..1c2bde7a109 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_friend.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_friend.sh @@ -7,6 +7,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Establish multiple different friendships concurrently. Perform BLOB transfer with BLOB Client # on friend node and BLOB Server on LPNs. # Note: The number of LPNs must match CONFIG_BT_MESH_FRIEND_LPN_COUNT. +conf=prj_mesh1d1_conf RunTest blob_transfer_lpn \ blob_cli_friend_pull \ blob_srv_lpn_pull \ @@ -15,6 +16,7 @@ RunTest blob_transfer_lpn \ blob_srv_lpn_pull \ blob_srv_lpn_pull +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_transfer_lpn_psa \ blob_cli_friend_pull \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_block.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_block.sh index a30a54f79ff..73728d1f141 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_block.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_block.sh @@ -4,11 +4,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh +conf=prj_mesh1d1_conf RunTest blob_no_rsp_block_get \ blob_cli_fail_on_no_rsp \ blob_srv_fail_on_block_get \ blob_srv_fail_on_block_get -- -argstest msg-fail-type=0 +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_no_rsp_block_get_psa \ blob_cli_fail_on_no_rsp \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_xfer.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_xfer.sh index 4ecc650aa8f..4137deba007 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_xfer.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_no_rsp_xfer.sh @@ -4,11 +4,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh +conf=prj_mesh1d1_conf RunTest blob_no_rsp_xfer_get \ blob_cli_fail_on_no_rsp \ blob_srv_fail_on_xfer_get \ blob_srv_fail_on_xfer_get -- -argstest msg-fail-type=1 +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_no_rsp_xfer_get_psa \ blob_cli_fail_on_no_rsp \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer.sh index a7cfdac206d..e5bb421af14 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer.sh @@ -5,6 +5,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf RunTest blob_fail \ blob_cli_fail_on_persistency \ blob_srv_fail_on_block_start\ @@ -12,6 +13,7 @@ RunTest blob_fail \ blob_srv_fail_on_xfer_get \ blob_srv_fail_on_nothing +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_fail_psa \ blob_cli_fail_on_persistency \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer_pull.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer_pull.sh index 11bafde8fbc..8ead73c4ec7 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer_pull.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_persistent_transfer_pull.sh @@ -5,11 +5,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Client continues BLOB Transfer after one target timed out while sending chunks. +conf=prj_mesh1d1_conf RunTest blob_pst_pull \ blob_cli_trans_persistency_pull \ blob_srv_trans_persistency_pull \ blob_srv_trans_persistency_pull +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_pst_pull_psa \ blob_cli_trans_persistency_pull \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_pull.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_pull.sh index 2e89819bb1f..fdb1a8020e1 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_pull.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_pull.sh @@ -5,11 +5,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Transfer completes successfully in Pull mode +conf=prj_mesh1d1_conf RunTest blob_success_pull blob_cli_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ -- -argstest use-pull-mode=1 +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_success_pull_psa blob_cli_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_push.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_push.sh index 9695d1bb941..5345eab11e8 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_push.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_complete_push.sh @@ -5,10 +5,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Transfer completes successfully in Push mode +conf=prj_mesh1d1_conf RunTest blob_success_push blob_cli_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_success_push_psa blob_cli_trans_complete \ blob_srv_trans_complete blob_srv_trans_complete \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_pull.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_pull.sh index 4459c4419b4..5b05446694b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_pull.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_pull.sh @@ -5,9 +5,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Client can resume a suspended BLOB Transfer in Pull mode +conf=prj_mesh1d1_conf RunTest blob_resume_pull \ blob_cli_trans_resume blob_srv_trans_resume -- -argstest use-pull-mode=1 +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_resume_pull_psa \ blob_cli_trans_resume blob_srv_trans_resume -- -argstest use-pull-mode=1 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_push.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_push.sh index 2bbc627b05c..01150c8b0eb 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_push.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_cli_trans_resume_push.sh @@ -5,7 +5,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that BLOB Client can resume a suspended BLOB Transfer in Push mode +conf=prj_mesh1d1_conf RunTest blob_resume_push blob_cli_trans_resume blob_srv_trans_resume +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest blob_resume_push_psa blob_cli_trans_resume blob_srv_trans_resume diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh index 9973a82dc49..8c59c82da6f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh @@ -10,53 +10,65 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Tests with -flash_rm clean up stored settings after them # to run tests with -flash_erase correctly. # Test cases are designed to be run using single target. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=1 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop blob_srv_stop -- -argstest expected-phase=2 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop blob_srv_stop -- -argstest expected-phase=3 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 # Test reaching suspended state and continuation after reboot on new procedure. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=5 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash blob_recover_phase \ blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 # The same test but with PSA crypto +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop blob_srv_stop -- -argstest expected-phase=2 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop blob_srv_stop -- -argstest expected-phase=3 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 # Test reaching suspended state and continuation after reboot on new procedure. +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=5 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash blob_recover_phase_psa \ blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/comp_data/cdp1_encode_decode.sh b/tests/bsim/bluetooth/mesh/tests_scripts/comp_data/cdp1_encode_decode.sh index d2a3c5de696..e4f99e80d5d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/comp_data/cdp1_encode_decode.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/comp_data/cdp1_encode_decode.sh @@ -13,9 +13,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 0. Provisioning and setup. # 1. Configuration client requests the node's CDP1. # 2. The received CDP1 is compared to a hardcoded version. +conf=prj_mesh1d1_conf RunTest mesh_cdp1_test \ cdp1_node_data_comparison +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_cdp1_test_psa \ cdp1_node_data_comparison diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_apply.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_apply.sh index 4f87fb10fef..f612119bdee 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_apply.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_apply.sh @@ -8,6 +8,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # callback is called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_apply \ dfu_cli_all_targets_lost_on_apply \ @@ -16,6 +17,7 @@ RunTest dfu_all_tgts_lost_on_apply \ dfu_target_fail_on_apply \ -- -argstest targets=3 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_apply_psa \ dfu_cli_all_targets_lost_on_apply \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_caps_get.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_caps_get.sh index 572445e4779..36dcf8f24ae 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_caps_get.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_caps_get.sh @@ -8,6 +8,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # and `ended` callback is called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_caps_get \ dfu_cli_all_targets_lost_on_caps_get \ @@ -16,6 +17,7 @@ RunTest dfu_all_tgts_lost_on_caps_get \ dfu_target_fail_on_caps_get \ -- -argstest targets=3 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_caps_get_psa \ dfu_cli_all_targets_lost_on_caps_get \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_metadata.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_metadata.sh index e4fbe146dcd..eacb921a214 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_metadata.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_metadata.sh @@ -8,6 +8,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_metadata \ dfu_cli_all_targets_lost_on_metadata \ @@ -16,6 +17,7 @@ RunTest dfu_all_tgts_lost_on_metadata \ dfu_target_fail_on_metadata \ -- -argstest targets=3 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_metadata_psa \ dfu_cli_all_targets_lost_on_metadata \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_update_get.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_update_get.sh index 7b96161eccd..f6c53482834 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_update_get.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_update_get.sh @@ -8,6 +8,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Firmware Update Get message and `ended` callback is called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_update_get \ dfu_cli_all_targets_lost_on_update_get \ @@ -16,6 +17,7 @@ RunTest dfu_all_tgts_lost_on_update_get \ dfu_target_fail_on_update_get \ -- -argstest targets=3 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_update_get_psa \ dfu_cli_all_targets_lost_on_update_get \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_verify.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_verify.sh index 5daedaca71d..929ab93b81e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_verify.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_verify.sh @@ -8,6 +8,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # callback is called when all targets are lost at this step. # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_all_tgts_lost_on_verify \ dfu_cli_all_targets_lost_on_verify \ @@ -16,6 +17,7 @@ RunTest dfu_all_tgts_lost_on_verify \ dfu_target_fail_on_verify \ -- -argstest targets=3 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_all_tgts_lost_on_verify_psa \ dfu_cli_all_targets_lost_on_verify \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_persistent_transfer.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_persistent_transfer.sh index 2ff4a696639..bcc98df48b5 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_persistent_transfer.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_persistent_transfer.sh @@ -5,6 +5,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # The test instance sequence must stay as it is due to addressing scheme +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_persistency \ dfu_cli_fail_on_persistency \ @@ -15,6 +16,7 @@ RunTest dfu_persistency \ dfu_target_fail_on_apply \ dfu_target_fail_on_nothing +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_persistency_psa \ dfu_cli_fail_on_persistency \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update.sh index 5c00349f24e..64f33013e74 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update.sh @@ -4,8 +4,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_self_update dfu_dist_dfu_self_update -- -argstest targets=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_self_update_psa dfu_dist_dfu_self_update -- -argstest targets=1 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update_mult_targets.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update_mult_targets.sh index 42087f1ad13..af7acb10723 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update_mult_targets.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_dist_self_update_mult_targets.sh @@ -4,10 +4,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_self_update_no_change \ dfu_dist_dfu_self_update dfu_target_dfu_no_change -- -argstest targets=2 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_self_update_no_change_psa \ dfu_dist_dfu_self_update dfu_target_dfu_no_change -- -argstest targets=2 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed.sh index 1c5ff82d8fb..bcac2cbba5b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed.sh @@ -5,10 +5,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test DFU with all variants of firmware effect +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_mixed dfu_dist_dfu dfu_target_dfu_unprov dfu_target_dfu_no_change \ dfu_target_dfu_new_comp_rpr dfu_target_dfu_new_comp_no_rpr -- -argstest targets=4 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_mixed_psa dfu_dist_dfu dfu_target_dfu_unprov dfu_target_dfu_no_change \ dfu_target_dfu_new_comp_rpr dfu_target_dfu_new_comp_no_rpr -- -argstest targets=4 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed_fail.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed_fail.sh index 3382e458b2e..c5f67e2521e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed_fail.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_mixed_fail.sh @@ -5,11 +5,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test that confirm step fails with all variants of firmware effect +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_mixed_fail dfu_dist_dfu dfu_target_dfu_unprov dfu_target_dfu_no_change \ dfu_target_dfu_new_comp_rpr dfu_target_dfu_new_comp_no_rpr -- -argstest targets=4 \ fail-confirm=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_mixed_fail_psa dfu_dist_dfu dfu_target_dfu_unprov dfu_target_dfu_no_change \ dfu_target_dfu_new_comp_rpr dfu_target_dfu_new_comp_no_rpr -- -argstest targets=4 \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh index 587908c6497..c187d8cfbff 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot.sh @@ -11,6 +11,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # and verifies they do not exist. # - Fourth test is rebooted device that verifies if removing all slots also removed them # from storage. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_slot dfu_dist_dfu_slot_create -flash_erase @@ -20,6 +21,7 @@ RunTestFlash dfu_slot dfu_dist_dfu_slot_delete_all RunTestFlash dfu_slot dfu_dist_dfu_slot_check_delete_all -flash_rm +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_slot_psa dfu_dist_dfu_slot_create -flash_erase diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_idempotency.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_idempotency.sh index abce47dba13..3f18f1a2651 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_idempotency.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_idempotency.sh @@ -5,8 +5,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test DFU Slot API. This test tests that the APIs are idempotent. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_slot_idempotency dfu_dist_dfu_slot_idempotency +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_slot_idempotency_psa dfu_dist_dfu_slot_idempotency diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_reservation.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_reservation.sh index 0ce234116b2..ddd7d0123f5 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_reservation.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_slot_reservation.sh @@ -5,8 +5,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test DFU Slot API. This test tests slot reservation APIs. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest dfu_slot_reservation dfu_dist_dfu_slot_reservation +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest dfu_slot_reservation_psa dfu_dist_dfu_slot_reservation diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh index b18a949b43d..6ed7099c987 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_srv_persistence.sh @@ -13,27 +13,32 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # image index were loaded correctly. # Test cases are designed to be run using single target. `dfu_cli_stop` test case in recovery part # plays dummy role, and is there to keep order of settings files being loaded. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ -- -argstest recover=0 expected-phase=2 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=3 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=4 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=6 # Use phase `BT_MESH_DFU_PHASE_APPLY_SUCCESS` as marker to bring whole procedure to an end +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ @@ -41,38 +46,45 @@ RunTestFlash dfu_dist_recover_phase \ # To test recovery from Verify Fail begin new distribution that will end there, # reboot devices and continue to Applying. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ -- -argstest recover=0 expected-phase=5 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash dfu_dist_recover_phase \ dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ -- -argstest recover=1 expected-phase=6 # The same test but with PSA crypto +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ -- -argstest recover=0 expected-phase=2 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=3 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=4 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop dfu_target_dfu_stop \ -- -argstest recover=1 expected-phase=6 # Use phase `BT_MESH_DFU_PHASE_APPLY_SUCCESS` as marker to bring whole procedure to an end +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ @@ -80,11 +92,13 @@ RunTestFlash dfu_dist_recover_phase_psa \ # To test recovery from Verify Fail begin new distribution that will end there, # reboot devices and continue to Applying. +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop -flash_erase dfu_target_dfu_stop -flash_erase \ -- -argstest recover=0 expected-phase=5 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash dfu_dist_recover_phase_psa \ dfu_cli_stop -flash_rm dfu_target_dfu_stop -flash_rm \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish.sh index d1082fa9f29..b89ad3af2c7 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish.sh @@ -9,6 +9,12 @@ RunTest mesh_friendship_est \ friendship_friend_est \ friendship_lpn_est +conf=prj_mesh1d1_conf +RunTest mesh_friendship_est_1d1 \ + friendship_friend_est \ + friendship_lpn_est + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_est_psa \ friendship_friend_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish_multi.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish_multi.sh index 32e4752123d..725ddae596e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish_multi.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/establish_multi.sh @@ -14,6 +14,16 @@ RunTest mesh_friendship_est_multi \ friendship_lpn_est \ friendship_lpn_est +conf=prj_mesh1d1_conf +RunTest mesh_friendship_est_multi_1d1 \ + friendship_friend_est_multi \ + friendship_lpn_est \ + friendship_lpn_est \ + friendship_lpn_est \ + friendship_lpn_est \ + friendship_lpn_est + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_est_multi_psa \ friendship_friend_est_multi \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_disable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_disable.sh index f8e24e51a3b..be22829d615 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_disable.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_disable.sh @@ -16,6 +16,12 @@ RunTest mesh_lpn_disable_check \ friendship_friend_no_est \ friendship_lpn_disable +conf=prj_mesh1d1_conf +RunTest mesh_lpn_disable_check_1d1 \ + friendship_friend_no_est \ + friendship_lpn_disable + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_lpn_disable_check_psa \ friendship_friend_no_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_loopback.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_loopback.sh index 7c42d7912ff..676b6b81ccc 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_loopback.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_loopback.sh @@ -9,6 +9,12 @@ RunTest mesh_friendship_lpn_loopback \ friendship_lpn_loopback \ friendship_friend_est +conf=prj_mesh1d1_conf +RunTest mesh_friendship_lpn_loopback_1d1 \ + friendship_lpn_loopback \ + friendship_friend_est + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_lpn_loopback_psa \ friendship_lpn_loopback \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_terminate_cb.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_terminate_cb.sh index e51fec31dd2..75163076af4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_terminate_cb.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/lpn_terminate_cb.sh @@ -14,6 +14,12 @@ RunTest mesh_lpn_terminate_cb_check \ friendship_friend_est \ friendship_lpn_term_cb_check +conf=prj_mesh1d1_conf +RunTest mesh_lpn_terminate_cb_check_1d1 \ + friendship_friend_est \ + friendship_lpn_term_cb_check + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_lpn_terminate_cb_check_psa \ friendship_friend_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_frnd.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_frnd.sh index 2329ed289eb..94d6224da5b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_frnd.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_frnd.sh @@ -9,6 +9,12 @@ RunTest mesh_friendship_msg_frnd \ friendship_friend_msg \ friendship_lpn_msg_frnd +conf=prj_mesh1d1_conf +RunTest mesh_friendship_msg_frnd_1d1 \ + friendship_friend_msg \ + friendship_lpn_msg_frnd + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_msg_frnd_psa \ friendship_friend_msg \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_group.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_group.sh index d6de655ba5b..6e7287b00ff 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_group.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_group.sh @@ -10,6 +10,13 @@ RunTest mesh_friendship_msg_group \ friendship_other_group \ friendship_friend_group +conf=prj_mesh1d1_conf +RunTest mesh_friendship_msg_group_1d1 \ + friendship_lpn_group \ + friendship_other_group \ + friendship_friend_group + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_msg_group_psa \ friendship_lpn_group \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh.sh index f05261bb258..072e427d72a 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh.sh @@ -10,6 +10,13 @@ RunTest mesh_friendship_msg_mesh \ friendship_other_msg \ friendship_friend_est +conf=prj_mesh1d1_conf +RunTest mesh_friendship_msg_mesh_1d1 \ + friendship_lpn_msg_mesh \ + friendship_other_msg \ + friendship_friend_est + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_msg_mesh_psa \ friendship_lpn_msg_mesh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh_low_lat.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh_low_lat.sh index 3352d5812e6..d659281e4e9 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh_low_lat.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_mesh_low_lat.sh @@ -11,6 +11,14 @@ RunTest mesh_friendship_msg_mesh_low_lat \ friendship_other_msg \ friendship_friend_est +conf=prj_mesh1d1_conf +overlay=overlay_low_lat_conf +RunTest mesh_friendship_msg_mesh_low_lat_1d1 \ + friendship_lpn_msg_mesh \ + friendship_other_msg \ + friendship_friend_est + +conf=prj_mesh1d1_conf overlay="overlay_low_lat_conf_overlay_psa_conf" RunTest mesh_friendship_msg_mesh_low_lat_psa \ friendship_lpn_msg_mesh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_va_collision.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_va_collision.sh index 3ec9cd29162..360095d2e5f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_va_collision.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/msg_va_collision.sh @@ -24,6 +24,12 @@ RunTest mesh_friendship_msg_va_collision \ friendship_lpn_va_collision \ friendship_friend_va_collision +conf=prj_mesh1d1_conf +RunTest mesh_friendship_msg_va_collision_1d1 \ + friendship_lpn_va_collision \ + friendship_friend_va_collision + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_msg_va_collision_psa \ friendship_lpn_va_collision \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/overflow.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/overflow.sh index 90398fb4d8a..d717be60292 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/overflow.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/overflow.sh @@ -9,6 +9,12 @@ RunTest mesh_friendship_overflow \ friendship_friend_overflow \ friendship_lpn_overflow +conf=prj_mesh1d1_conf +RunTest mesh_friendship_overflow_1d1 \ + friendship_friend_overflow \ + friendship_lpn_overflow + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_overflow_psa \ friendship_friend_overflow \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/poll.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/poll.sh index 328050ba39e..90e744a7001 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/poll.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/poll.sh @@ -9,6 +9,12 @@ RunTest mesh_friendship_poll \ friendship_friend_est \ friendship_lpn_poll +conf=prj_mesh1d1_conf +RunTest mesh_friendship_poll_1d1 \ + friendship_friend_est \ + friendship_lpn_poll + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_poll_psa \ friendship_friend_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/re-establish.sh b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/re-establish.sh index 27b3e07e5f6..10abb4413ea 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/friendship/re-establish.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/friendship/re-establish.sh @@ -9,6 +9,12 @@ RunTest mesh_friendship_re_est \ friendship_friend_est \ friendship_lpn_re_est +conf=prj_mesh1d1_conf +RunTest mesh_friendship_re_est_1d1 \ + friendship_friend_est \ + friendship_lpn_re_est + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_friendship_re_est_psa \ friendship_friend_est \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_all.sh b/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_all.sh index 5bef1473a07..eef25d08cf2 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_all.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_all.sh @@ -10,6 +10,13 @@ RunTest mesh_heartbeat_sub_cb_api_all \ heartbeat_publish_all \ heartbeat_subscribe_all +conf=prj_mesh1d1_conf +RunTest mesh_heartbeat_sub_cb_api_all_1d1 \ + heartbeat_publish_all \ + heartbeat_publish_all \ + heartbeat_subscribe_all + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_heartbeat_sub_cb_api_all_psa \ heartbeat_publish_all \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_unicast.sh b/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_unicast.sh index 93b1e2ffe9f..fc0660e5676 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_unicast.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/heartbeat/sub_cb_api_unicast.sh @@ -10,6 +10,13 @@ RunTest mesh_heartbeat_sub_cb_api_unicast \ heartbeat_publish_unicast \ heartbeat_subscribe_unicast +conf=prj_mesh1d1_conf +RunTest mesh_heartbeat_sub_cb_api_unicast_1d1 \ + heartbeat_publish_unicast \ + heartbeat_publish_unicast \ + heartbeat_subscribe_unicast + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_heartbeat_sub_cb_api_unicast_psa \ heartbeat_publish_unicast \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_deferring.sh b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_deferring.sh index 6696b28ae00..cdf39dac438 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_deferring.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_deferring.sh @@ -7,5 +7,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test deferring of the IV index update procedure RunTest mesh_ivi_deferring ivi_ivu_deferring +conf=prj_mesh1d1_conf +RunTest mesh_ivi_deferring_1d1 ivi_ivu_deferring + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_ivi_deferring_psa ivi_ivu_deferring diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_recovery.sh b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_recovery.sh index a827f9b3abf..39514bf39e6 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_recovery.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_recovery.sh @@ -7,5 +7,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test IV index recovery procedure RunTest mesh_ivi_recovery ivi_ivu_recovery +conf=prj_mesh1d1_conf +RunTest mesh_ivi_recovery_1d1 ivi_ivu_recovery + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_ivi_recovery_psa ivi_ivu_recovery diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_update.sh b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_update.sh index f2f652012b8..ee2b6b20000 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_update.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/iv_index/iv_update.sh @@ -7,5 +7,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test IV index update procedure RunTest mesh_ivi_update ivi_ivu_normal +conf=prj_mesh1d1_conf +RunTest mesh_ivi_update_1d1 ivi_ivu_normal + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_ivi_update_psa ivi_ivu_normal diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split.sh index dcaba598a57..d65326b3d7f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split.sh @@ -19,10 +19,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp0_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=0 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp0_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=0 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split_dfu.sh index 004a5224961..6a65a2492ed 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp0_data_split_dfu.sh @@ -20,11 +20,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp0_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=0 comp-changed-mode=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp0_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split.sh index f88db1b7391..77d4a1737a5 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split.sh @@ -19,10 +19,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp128_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=128 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp128_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=128 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split_dfu.sh index 084125c79a4..9abdfd00dd7 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp128_data_split_dfu.sh @@ -20,11 +20,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp128_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=128 comp-changed-mode=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp128_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split.sh index ab46d32048f..fba1760cb36 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split.sh @@ -19,10 +19,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp129_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=129 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp129_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=129 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split_dfu.sh index 179c052e0ef..282c3425c81 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp129_data_split_dfu.sh @@ -20,11 +20,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp129_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=129 comp-changed-mode=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp129_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split.sh index eb25353581b..e3e8f2bad85 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split.sh @@ -19,10 +19,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp130_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=130 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp130_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=130 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split_dfu.sh index a667f53abc8..5daf32c54c0 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp130_data_split_dfu.sh @@ -20,11 +20,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp130_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=130 comp-changed-mode=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp130_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split.sh index 06312cf558b..bc24a9c9bf9 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split.sh @@ -19,10 +19,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp1_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp1_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=1 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split_dfu.sh index 61f19ea3dcc..59383bb18f1 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp1_data_split_dfu.sh @@ -20,11 +20,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp1_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=1 comp-changed-mode=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp1_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split.sh index 3da45434ee1..53def43d5a0 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split.sh @@ -19,10 +19,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp2_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=2 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp2_data_split \ lcd_srv_comp_data_status_respond lcd_cli_split_comp_data_request -- -argstest page=2 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split_dfu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split_dfu.sh index 8ad929f1374..f314f00d6ef 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split_dfu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp2_data_split_dfu.sh @@ -20,11 +20,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # comp data with correspending bytes in local comp data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local comp data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_comp2_data_split_dfu \ lcd_srv_comp_data_status_respond \ lcd_cli_split_comp_data_request -- -argstest page=2 comp-changed-mode=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_comp2_data_split_dfu \ lcd_srv_comp_data_status_respond \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp_data_max_sdu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp_data_max_sdu.sh index 71a692fa22c..b050037ccf0 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp_data_max_sdu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_comp_data_max_sdu.sh @@ -14,10 +14,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 3. When server status arrive, remove status field data and compare received # comp data with local comp data and assure that the received message length # is 378 bytes (380 bytes access payload). +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_max_access_payload \ lcd_cli_max_sdu_comp_data_request lcd_srv_comp_data_status_respond +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_max_access_payload_psa \ lcd_cli_max_sdu_comp_data_request lcd_srv_comp_data_status_respond diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_max_sdu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_max_sdu.sh index ef0f5712526..9b0be5ea20f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_max_sdu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_max_sdu.sh @@ -15,10 +15,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # is 378 bytes (380 bytes access payload). # 4. Remove status field data and compare received metadata with # local metadata data. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_max_metadata_access_payload \ lcd_cli_max_sdu_metadata_request lcd_srv_metadata_status_respond +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_max_metadata_access_payload_psa \ lcd_cli_max_sdu_metadata_request lcd_srv_metadata_status_respond diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_split.sh b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_split.sh index 38e43f88601..0e29e7d4219 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_split.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/large_comp_data/get_metadata_split.sh @@ -18,10 +18,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # received metadata with corresponding bytes in local data. # 6. Client merges the two samples and checks that the collected data is # correctly merged, continuous, and matches its local metadata. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTest mesh_lcd_test_split_metadata \ lcd_cli_split_metadata_request lcd_srv_metadata_status_respond +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_lcd_test_split_metadata_psa \ lcd_cli_split_metadata_request lcd_srv_metadata_status_respond diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/full_status_msg_list.sh b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/full_status_msg_list.sh index 7a226017470..fb60110ad7b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/full_status_msg_list.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/full_status_msg_list.sh @@ -22,9 +22,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 6. The client keeps track of the number of received status messages. When X messages have been # received, the client pass if the sequence of received status messages corresponds to the order # in which the messages were sent, or the test fails. +conf=prj_mesh1d1_conf RunTest mesh_op_agg_test_max_access_payload \ op_agg_cli_max_len_sequence_msg_send op_agg_srv_max_len_status_msg_send +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_op_agg_test_max_access_payload_psa \ op_agg_cli_max_len_sequence_msg_send op_agg_srv_max_len_status_msg_send diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh index 7d2c7eec7d2..3a4720bdaf4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/loopback.sh @@ -12,9 +12,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 2. The device starts sending the sequence on loopback. # 3. The device verifies that the sequence is correctly received by the server model. # 4. The device confirms that the client model received all status messages. +conf=prj_mesh1d1_conf RunTest mesh_op_agg_model_coex_loopback \ op_agg_dut_model_coex_loopback +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_op_agg_model_coex_loopback \ op_agg_dut_model_coex_loopback diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/model_coex.sh b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/model_coex.sh index 928abd666f9..08fcdf9f41e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/model_coex.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/op_agg/model_coex.sh @@ -21,9 +21,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # aggregated sequence from the DUT device is correctly received. # 5. Finally, the DUT device waits and confirms that it received all status messages # related to its own aggregated sequence from the cli device. +conf=prj_mesh1d1_conf RunTest mesh_op_agg_model_coex \ op_agg_tester_model_coex op_agg_dut_model_coex +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_op_agg_model_coex \ op_agg_tester_model_coex op_agg_dut_model_coex diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh index cf9ec54faec..0392430adba 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/access.sh @@ -31,25 +31,60 @@ overlay=overlay_pst_conf RunTestFlash mesh_pst_access_data_check persistence_access_data_load -flash_rm \ -- -argstest access-cfg=not-configured +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_save -flash_erase + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_load \ + -- -argstest access-cfg=configured + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_sub_overwrite \ + -- -argstest access-cfg=configured + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_load \ + -- -argstest access-cfg=new-subs + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_remove \ + -- -argstest access-cfg=new-subs + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_access_data_check_1d1 persistence_access_data_load -flash_rm \ + -- -argstest access-cfg=not-configured + +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_save -flash_erase +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_load \ -- -argstest access-cfg=configured +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_sub_overwrite \ -- -argstest access-cfg=configured +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_load \ -- -argstest access-cfg=new-subs +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_remove \ -- -argstest access-cfg=new-subs +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_access_data_check_psa persistence_access_data_load -flash_rm \ -- -argstest access-cfg=not-configured diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh index f9655ef7462..bb3074905a9 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/cfg.sh @@ -24,18 +24,42 @@ overlay=overlay_pst_conf RunTestFlash mesh_pst_cfg_check persistence_cfg_load -flash_rm \ -- -argstest stack-cfg=1 +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_save -flash_erase \ + -- -argstest stack-cfg=0 + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_load -flash_rm \ + -- -argstest stack-cfg=0 + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_save -flash_erase \ + -- -argstest stack-cfg=1 + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_cfg_check_1d1 persistence_cfg_load -flash_rm \ + -- -argstest stack-cfg=1 + +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_save -flash_erase \ -- -argstest stack-cfg=0 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_load -flash_rm \ -- -argstest stack-cfg=0 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_save -flash_erase \ -- -argstest stack-cfg=1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_cfg_check_psa persistence_cfg_load -flash_rm \ -- -argstest stack-cfg=1 diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh index 8dc7baa3e9d..f1e0591ef13 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/provisioning.sh @@ -16,8 +16,18 @@ RunTestFlash mesh_pst_prov_data_check persistence_provisioning_data_save -flash_ overlay=overlay_pst_conf RunTestFlash mesh_pst_prov_data_check persistence_provisioning_data_load -flash_rm +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_prov_data_check_1d1 persistence_provisioning_data_save -flash_erase + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTestFlash mesh_pst_prov_data_check_1d1 persistence_provisioning_data_load -flash_rm + +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_prov_data_check_psa persistence_provisioning_data_save -flash_erase +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_pst_prov_data_check_psa persistence_provisioning_data_load -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh index 511c04f766f..922b4c8a513 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/persistence/reprovisioning.sh @@ -20,11 +20,25 @@ RunTest mesh_pst_repr persistence_reprovisioning_device \ -flash=../results/mesh_pst_repr/flash.bin -flash_rm \ persistence_reprovisioning_provisioner +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTest mesh_pst_repr_1d1 persistence_reprovisioning_device \ + -flash=../results/mesh_pst_repr_1d1/flash.bin -flash_erase \ + persistence_reprovisioning_provisioner + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTest mesh_pst_repr_1d1 persistence_reprovisioning_device \ + -flash=../results/mesh_pst_repr_1d1/flash.bin -flash_rm \ + persistence_reprovisioning_provisioner + +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_pst_repr_psa persistence_reprovisioning_device \ -flash=../results/mesh_pst_repr_psa/flash.bin -flash_erase \ persistence_reprovisioning_provisioner +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_pst_repr_psa persistence_reprovisioning_device \ -flash=../results/mesh_pst_repr_psa/flash.bin -flash_rm \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_adv.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_adv.sh index 36c322a54da..48724dd7fbd 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_adv.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_adv.sh @@ -6,7 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising on node supporting relay feature. # Test Random value changes for different Random intervals (10s, 0 - on every beacon, 30s). +conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_adv beacon_rx_priv_adv beacon_tx_priv_adv +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_adv_psa beacon_rx_priv_adv beacon_tx_priv_adv diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_cache.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_cache.sh index 46a460c7ec7..0cb5cdaea0a 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_cache.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_cache.sh @@ -12,10 +12,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 2. TX device sends a secondary private beacons to the RX device, marking the end of the test. # 3. RX device verifies that only one of the two identical beacons was processed. +conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_cache \ beacon_tx_priv_beacon_cache \ beacon_rx_priv_beacon_cache +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_cache \ beacon_tx_priv_beacon_cache \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_interleave.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_interleave.sh index cda94a89d93..6d574a72c73 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_interleave.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_interleave.sh @@ -15,7 +15,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # - PRB is disabled, SNB enabled: second SNB is advertised # - KR is initiated, third SNB is advertised with new flags (IVU + KR) # - PRB is enabled, SNB is disabled. Third PRB is advertised +conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_interleave beacon_rx_priv_interleave beacon_tx_priv_interleave +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_interleave_psa beacon_rx_priv_interleave beacon_tx_priv_interleave diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_invalid.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_invalid.sh index 028ba0eabff..b1983284a51 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_invalid.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_invalid.sh @@ -5,7 +5,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test if Private Beacons with invalid data do not affect device +conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_invalid beacon_rx_priv_invalid beacon_tx_priv_invalid +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_invalid_psa beacon_rx_priv_invalid beacon_tx_priv_invalid diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu.sh index 32232573305..bb9a591fcb0 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu.sh @@ -5,11 +5,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising during IV Update procedure +conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_on_iv_update \ beacon_rx_on_iv_update \ beacon_tx_priv_on_iv_update \ -- -argstest rand-int=1 +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_on_iv_update_psa \ beacon_rx_on_iv_update \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu_long_interval.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu_long_interval.sh index d44ba297a0e..ad0d11dbc96 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu_long_interval.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_ivu_long_interval.sh @@ -7,11 +7,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising during IV Update procedure, with long Random Interval set. # Random value is expected to change before Random Interval is reached due to # Flags field change. +conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_on_iv_update_long_interval \ beacon_rx_on_iv_update \ beacon_tx_priv_on_iv_update \ -- -argstest rand-int=3 +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_on_iv_update_long_interval_psa \ beacon_rx_on_iv_update \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr.sh index 59fe95658c2..eaf6338684f 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr.sh @@ -5,11 +5,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising during Key Refresh procedure +conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_on_key_refresh \ beacon_rx_on_key_refresh \ beacon_tx_priv_on_key_refresh \ -- -argstest rand-int=1 +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_on_key_refresh_psa \ beacon_rx_on_key_refresh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr_long_interval.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr_long_interval.sh index b0ec45b3f1d..cc5722e4432 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr_long_interval.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_beacon_kr_long_interval.sh @@ -7,11 +7,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test Private Beacon advertising during Key Refresh procedure, with long Random Interval set. # Random value is expected to change before Random Interval is reached due to # Flags field change. +conf=prj_mesh1d1_conf RunTest mesh_priv_beacon_on_key_refresh_long_interval \ beacon_rx_on_key_refresh \ beacon_tx_priv_on_key_refresh \ -- -argstest rand-int=3 +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_priv_beacon_on_key_refresh_long_interval_psa \ beacon_rx_on_key_refresh \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_gatt.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_gatt.sh index 8080b6ec70f..a1b9ea7d8d6 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_gatt.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_gatt.sh @@ -17,11 +17,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. Both TX and RX device verifies that the IV index has been updated. # This proves that the RX device (Proxy CLI) successfully received # a Private beacon over the GATT connection +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest mesh_priv_proxy_gatt_priv_beacon \ beacon_tx_priv_gatt_proxy \ beacon_rx_priv_gatt_proxy +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest mesh_priv_proxy_gatt_priv_beacon \ beacon_tx_priv_gatt_proxy \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id.sh index a431cdd9f6b..02fcf03c001 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id.sh @@ -18,11 +18,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 5. Test passes if the random field of the two Private Net ID advertisements # are NOT equal. +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest mesh_priv_proxy_net_id \ beacon_tx_priv_net_id \ beacon_rx_priv_net_id +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest mesh_priv_proxy_net_id \ beacon_tx_priv_net_id \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id_multi.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id_multi.sh index cffb5adbeb0..9d89b5af36c 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id_multi.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_net_id_multi.sh @@ -15,11 +15,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # advertisemen from each of the networks within the given time # limit. +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest mesh_priv_proxy_net_id_multi \ beacon_tx_priv_multi_net_id \ beacon_rx_priv_multi_net_id +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest mesh_priv_proxy_net_id_multi \ beacon_tx_priv_multi_net_id \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_node_id.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_node_id.sh index 2557c9c1506..2aff351bd78 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_node_id.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/priv_proxy_node_id.sh @@ -23,11 +23,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 5. Test passes if the random field of the two Private Node ID advertisements # are NOT equal. +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest mesh_priv_proxy_node_id \ beacon_tx_priv_node_id \ beacon_rx_priv_node_id +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest mesh_priv_proxy_node_id \ beacon_tx_priv_node_id \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh index 0a3b5771bfd..42863a13458 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh @@ -43,12 +43,14 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # to the adv medium again. +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf RunTest proxy_adv_multi_subnet_coex \ beacon_tx_proxy_adv_multi_subnet_coex \ beacon_rx_proxy_adv_multi_subnet_coex \ beacon_tx_proxy_adv_solicit_trigger +conf=prj_mesh1d1_conf overlay=overlay_gatt_conf_overlay_psa_conf RunTest proxy_adv_multi_subnet_coex \ beacon_tx_proxy_adv_multi_subnet_coex \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_one_duration.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_one_duration.sh index 36c996269cf..168c2620212 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_one_duration.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_one_duration.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_iv_update_one_duration prov_provisioner_iv_update_flag_one +conf=prj_mesh1d1_conf +RunTest mesh_prov_iv_update_one_duration_1d1 prov_provisioner_iv_update_flag_one + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_iv_update_one_duration_psa prov_provisioner_iv_update_flag_one diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_zero_duration.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_zero_duration.sh index cb3294950f8..07165b31c1d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_zero_duration.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/ivu_flag_zero_duration.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_iv_update_zero_duration prov_provisioner_iv_update_flag_zero +conf=prj_mesh1d1_conf +RunTest mesh_prov_iv_update_zero_duration_1d1 prov_provisioner_iv_update_flag_zero + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_iv_update_zero_duration_psa prov_provisioner_iv_update_flag_zero diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_multi.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_multi.sh index 61bbbcc1a27..7d8dfbe6388 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_multi.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_multi.sh @@ -13,6 +13,14 @@ RunTest mesh_prov_pb_adv_multi \ prov_device_pb_adv_no_oob \ prov_device_pb_adv_no_oob +conf=prj_mesh1d1_conf +RunTest mesh_prov_pb_adv_multi_1d1 \ + prov_provisioner_pb_adv_multi \ + prov_device_pb_adv_no_oob \ + prov_device_pb_adv_no_oob \ + prov_device_pb_adv_no_oob + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_multi_psa \ prov_provisioner_pb_adv_multi \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_no_oob.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_no_oob.sh index 91bde356f2b..bfcb8540ae1 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_no_oob.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_no_oob.sh @@ -8,6 +8,12 @@ RunTest mesh_prov_pb_adv_on_oob \ prov_device_pb_adv_no_oob \ prov_provisioner_pb_adv_no_oob +conf=prj_mesh1d1_conf +RunTest mesh_prov_pb_adv_on_oob_1d1 \ + prov_device_pb_adv_no_oob \ + prov_provisioner_pb_adv_no_oob + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_on_oob_psa \ prov_device_pb_adv_no_oob \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ib_pk.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ib_pk.sh index ef8e07f7c80..22d197a0adc 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ib_pk.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ib_pk.sh @@ -8,6 +8,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_pb_adv_oob_auth \ prov_device_pb_adv_oob_auth prov_provisioner_pb_adv_oob_auth +conf=prj_mesh1d1_conf +RunTest mesh_prov_pb_adv_oob_auth_1d1 \ + prov_device_pb_adv_oob_auth prov_provisioner_pb_adv_oob_auth + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_oob_auth_psa \ prov_device_pb_adv_oob_auth prov_provisioner_pb_adv_oob_auth diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ignore_oob_pk.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ignore_oob_pk.sh index 8df3c6a4bf6..5459997e547 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ignore_oob_pk.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_ignore_oob_pk.sh @@ -9,6 +9,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_pb_adv_device_w_oob_pk_prvnr_wt_pk \ prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_auth_no_oob_public_key +conf=prj_mesh1d1_conf +RunTest mesh_prov_pb_adv_device_w_oob_pk_prvnr_wt_pk_1d1 \ + prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_auth_no_oob_public_key + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_device_w_oob_pk_prvnr_wt_pk_psa \ prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_auth_no_oob_public_key diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_oob_pk.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_oob_pk.sh index d24e5afccd4..b8ab3a5d899 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_oob_pk.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_oob_auth_oob_pk.sh @@ -8,6 +8,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_prov_pb_adv_oob_public_key \ prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_public_key +conf=prj_mesh1d1_conf +RunTest mesh_prov_pb_adv_oob_public_key_1d1 \ + prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_public_key + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_oob_public_key_psa \ prov_device_pb_adv_oob_public_key prov_provisioner_pb_adv_oob_public_key diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_reprovision.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_reprovision.sh index 0e3b84e3138..9c70514a093 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_reprovision.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_adv_reprovision.sh @@ -8,6 +8,12 @@ RunTest mesh_prov_pb_adv_repr \ prov_device_pb_adv_reprovision \ prov_provisioner_pb_adv_reprovision +conf=prj_mesh1d1_conf +RunTest mesh_prov_pb_adv_repr_1d1 \ + prov_device_pb_adv_reprovision \ + prov_provisioner_pb_adv_reprovision + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_adv_repr_psa \ prov_device_pb_adv_reprovision \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_client_server_same_dev.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_client_server_same_dev.sh index 9175a9ac015..33de74370e1 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_client_server_same_dev.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_client_server_same_dev.sh @@ -20,10 +20,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # composition refresh procedure on it self with local RPR client and server. # 7. The first device (prov_device_pb_remote_client_server_same_dev) execute # address refresh procedure on it self with local RPR client and server. +conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_client_server_same_dev \ prov_device_pb_remote_client_server_same_dev \ prov_device_pb_remote_server_same_dev +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_client_server_same_dev \ prov_device_pb_remote_client_server_same_dev \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_nppi_robustness.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_nppi_robustness.sh index a59cf04aef4..d707fdb6d6c 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_nppi_robustness.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_nppi_robustness.sh @@ -13,11 +13,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. Execute composition refresh procedure 3 times for the third device. # 5. Execute address refresh procedure 3 times for the third device. # (Step 3-5 is executed without sending a node reset message) +conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_nppi_robustness \ prov_provisioner_pb_remote_client_nppi_robustness \ prov_device_pb_remote_server_unproved \ prov_device_pb_remote_server_nppi_robustness +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_nppi_robustness_psa \ prov_provisioner_pb_remote_client_nppi_robustness \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_parallel.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_parallel.sh index 6ecb3292193..2c3394381cd 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_parallel.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_parallel.sh @@ -11,12 +11,14 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. The provisioner scans for an unprovisioned device idx 3 through the node with RPR server; # 5. The provisioner checks scanning and provisioning succeeded; # 6. The provisioner provisions an unprovisioned device idx 3 through the node with RPR server; +conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_parallel \ prov_provisioner_pb_remote_client_parallel \ prov_device_pb_remote_server_unproved \ prov_device_pb_adv_no_oob \ prov_device_pb_adv_no_oob +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_parallel_psa \ prov_provisioner_pb_remote_client_parallel \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh index 2bba5147d8f..ed5f619b310 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_pst_ncrp.sh @@ -31,6 +31,7 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # - verify that the device is not re-provisioned again. # Step 1 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_provisioner_pb_remote_client_ncrp_provision -flash_erase \ @@ -38,6 +39,7 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_device_pb_remote_server_ncrp_prepare -flash_erase # Step 2 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_provisioner_pb_remote_client_ncrp \ @@ -45,6 +47,7 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_device_pb_remote_server_ncrp # Step 3 +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash mesh_prov_pst_pb_remote_ncrp \ prov_provisioner_pb_remote_client_ncrp_second_time -flash_rm \ @@ -53,6 +56,7 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp \ # The same test but with PSA crypto # Step 1 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_provisioner_pb_remote_client_ncrp_provision -flash_erase \ @@ -60,6 +64,7 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_device_pb_remote_server_ncrp_prepare -flash_erase # Step 2 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_provisioner_pb_remote_client_ncrp \ @@ -67,6 +72,7 @@ RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_device_pb_remote_server_ncrp # Step 3 +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash mesh_prov_pst_pb_remote_ncrp_psa \ prov_provisioner_pb_remote_client_ncrp_second_time -flash_rm \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_reprovision.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_reprovision.sh index 1a2ae89d655..a49cbcd7ca9 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_reprovision.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_reprovision.sh @@ -12,11 +12,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 5. The provisioner configures the health server on the recently provisioned device and sends Node # Reset; # 6. Repeat steps 3-5 multiple times. +conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_reprovision \ prov_provisioner_pb_remote_client_reprovision \ prov_device_pb_remote_server_unproved \ prov_device_pb_adv_reprovision +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_reprovision_psa \ prov_provisioner_pb_remote_client_reprovision \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_timeout.sh b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_timeout.sh index 7feba542c44..8ef61c2666b 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_timeout.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/provision/pb_remote_timeout.sh @@ -24,11 +24,13 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 11. 3rd device opens provisioning link. # 12. 2nd device stops communicating with either devices. # 13. After 60s RPR timeout is reached on 1st device. RPR Client closes provisioning link. +conf=prj_mesh1d1_conf RunTest mesh_prov_pb_remote_provisioning_timeout \ prov_provisioner_pb_remote_client_provision_timeout \ prov_device_pb_remote_server_unproved_unresponsive \ prov_device_unresponsive +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_prov_pb_remote_provisioning_timeout_psa \ prov_provisioner_pb_remote_client_provision_timeout \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh index d09e014bd0e..50387776dfb 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/replay_attack.sh @@ -14,11 +14,25 @@ RunTest mesh_replay_attack \ rpc_tx_power_replay_attack \ rpc_rx_power_replay_attack -flash=../results/mesh_replay_attack/flash.bin -flash_rm +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTest mesh_replay_attack_1d1 \ + rpc_tx_immediate_replay_attack \ + rpc_rx_immediate_replay_attack -flash=../results/mesh_replay_attack_1d1/flash.bin -flash_erase + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTest mesh_replay_attack_1d1 \ + rpc_tx_power_replay_attack \ + rpc_rx_power_replay_attack -flash=../results/mesh_replay_attack_1d1/flash.bin -flash_rm + +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_attack_psa \ rpc_tx_immediate_replay_attack \ rpc_rx_immediate_replay_attack -flash=../results/mesh_replay_attack_psa/flash.bin -flash_erase +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_attack_psa \ rpc_tx_power_replay_attack \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh index 7212b567a24..8c7a7866eb3 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/replay_cache/rpl_frag.sh @@ -21,11 +21,24 @@ overlay=overlay_pst_conf RunTest mesh_replay_fragmentation \ rpc_rx_reboot_after_defrag -flash=../results/mesh_replay_fragmentation/flash.bin -flash_rm +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTest mesh_replay_fragmentation_1d1 \ + rpc_rx_rpl_frag -flash=../results/mesh_replay_fragmentation_1d1/flash.bin -flash_erase \ + rpc_tx_rpl_frag + +conf=prj_mesh1d1_conf +overlay=overlay_pst_conf +RunTest mesh_replay_fragmentation_1d1 \ + rpc_rx_reboot_after_defrag -flash=../results/mesh_replay_fragmentation_1d1/flash.bin -flash_rm + +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_fragmentation_psa \ rpc_rx_rpl_frag -flash=../results/mesh_replay_fragmentation_psa/flash.bin -flash_erase \ rpc_tx_rpl_frag +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTest mesh_replay_fragmentation_psa \ rpc_rx_reboot_after_defrag -flash=../results/mesh_replay_fragmentation_psa/flash.bin -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh b/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh index 0e67d5ab4d5..dc27c4dceda 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/sar/sar_cfg_persistent_storage.sh @@ -8,10 +8,12 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Tests must be added in sequence. # First test sets SAR TX/RX configuration. # Second test restores it from flash and checks if configuration persisted. +conf=prj_mesh1d1_conf overlay=overlay_pst_conf RunTestFlash sar_persistence sar_srv_cfg_store -flash_erase RunTestFlash sar_persistence sar_srv_cfg_restore -flash_rm +conf=prj_mesh1d1_conf overlay="overlay_pst_conf_overlay_psa_conf" RunTestFlash sar_persistence_psa sar_srv_cfg_store -flash_erase RunTestFlash sar_persistence_psa sar_srv_cfg_restore -flash_rm diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/sar/slow_transfer_test.sh b/tests/bsim/bluetooth/mesh/tests_scripts/sar/slow_transfer_test.sh index db8f8f9dc21..a022c23c3f4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/sar/slow_transfer_test.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/sar/slow_transfer_test.sh @@ -14,9 +14,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. The Client sends a Get-message with a maximum length SDU, targeting the server. # 5. The Server responds with a maximum length SDU Status-message. # 6. The test passes when the Client successfully receives the Status response. +conf=prj_mesh1d1_conf RunTest sar_slow_test \ sar_cli_max_len_sdu_slow_send sar_srv_max_len_sdu_slow_receive +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest sar_slow_test_psa \ sar_cli_max_len_sdu_slow_send sar_srv_max_len_sdu_slow_receive diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/sar/stress_test.sh b/tests/bsim/bluetooth/mesh/tests_scripts/sar/stress_test.sh index 34b05446702..89707adf031 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/sar/stress_test.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/sar/stress_test.sh @@ -13,9 +13,11 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # 4. The Client sends a Get-message with a maximum length SDU, targeting the server. # 5. The Server responds with a maximum length SDU Status-message. # 6. The test passes when the Client successfully receives the Status response. +conf=prj_mesh1d1_conf RunTest sar_test \ sar_cli_max_len_sdu_send sar_srv_max_len_sdu_receive +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest sar_test_psa \ sar_cli_max_len_sdu_send sar_srv_max_len_sdu_receive diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/scanner/invalid_ad_type.sh b/tests/bsim/bluetooth/mesh/tests_scripts/scanner/invalid_ad_type.sh index c46088c5a15..9199ac69da8 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/scanner/invalid_ad_type.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/scanner/invalid_ad_type.sh @@ -8,6 +8,12 @@ RunTest mesh_scanner_invalid_ad_type \ scanner_tx_invalid_ad_type \ scanner_rx_invalid_packet +conf=prj_mesh1d1_conf +RunTest mesh_scanner_invalid_ad_type_1d1 \ + scanner_tx_invalid_ad_type \ + scanner_rx_invalid_packet + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_scanner_invalid_ad_type_psa \ scanner_tx_invalid_ad_type \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/scanner/wrong_packet_length.sh b/tests/bsim/bluetooth/mesh/tests_scripts/scanner/wrong_packet_length.sh index 80f8cacca83..8f0919058ed 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/scanner/wrong_packet_length.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/scanner/wrong_packet_length.sh @@ -8,6 +8,12 @@ RunTest mesh_scanner_wrong_packet_length \ scanner_tx_wrong_packet_length \ scanner_rx_invalid_packet +conf=prj_mesh1d1_conf +RunTest mesh_scanner_wrong_packet_length_1d1 \ + scanner_tx_wrong_packet_length \ + scanner_rx_invalid_packet + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_scanner_wrong_packet_length_psa \ scanner_tx_wrong_packet_length \ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_disable_resume.sh b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_disable_resume.sh deleted file mode 100755 index 711f92f4007..00000000000 --- a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_disable_resume.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh - -# Test that GATT advertisement is stopped when suspending Mesh and disabling -# Bluetooth, and that it is started again when Bluetooth is re-enabled and Mesh is resumed. -# -# Test procedure: -# 0. DUT (Device 0) initializes the Mesh stack, and starts provisioning procedure using -# bt_mesh_prov_enable(BT_MESH_PROV_GATT). -# 1. Tester (Device 1) observes PB-GATT advs, and will fail the test if the expected -# amount of advs is not received. -# 2. DUT is provisioned, and Tester observes GATT proxy advs. -# 3. DUT notifies the Tester that it will be suspended, and Tester observes for advs after a -# brief delay. Receiving an adv while DUT is suspended will cause the test to fail. -# 4. After a delay, the DUT resumes and notifies the Tester, which checks that the -# advertising resumes. - -overlay=overlay_gatt_conf -RunTest mesh_gatt_suspend_disable_resume \ - suspend_dut_gatt_suspend_disable_resume suspend_tester_gatt - -overlay="overlay_gatt_conf_overlay_low_lat_conf" -RunTest mesh_gatt_suspend_disable_resume_low_lat \ - suspend_dut_gatt_suspend_disable_resume suspend_tester_gatt - -overlay="overlay_gatt_conf_overlay_psa_conf" -RunTest mesh_gatt_suspend_disable_resume_psa \ - suspend_dut_gatt_suspend_disable_resume suspend_tester_gatt diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_resume.sh b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_resume.sh deleted file mode 100755 index f0e4fb23502..00000000000 --- a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/gatt_suspend_resume.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh - -# Test that GATT advertisement is stopped when suspending Mesh, and that it is started again -# when Mesh is resumed. -# -# Test procedure: -# 0. DUT (Device 0) initializes the Mesh stack, and starts provisioning procedure using -# bt_mesh_prov_enable(BT_MESH_PROV_GATT). -# 1. Tester (Device 1) observes PB-GATT advs, and will fail the test if the expected -# amount of advs is not received. -# 2. DUT is provisioned, and Tester observes GATT proxy advs. -# 3. DUT notifies the Tester that it will be suspended, and Tester observes for advs after a -# brief delay. Receiving an adv while DUT is suspended will cause the test to fail. -# 4. After a delay, the DUT resumes and notifies the Tester, which checks that the -# advertising resumes. - -overlay=overlay_gatt_conf -RunTest mesh_gatt_suspend_resume \ - suspend_dut_gatt_suspend_resume suspend_tester_gatt - -overlay="overlay_gatt_conf_overlay_low_lat_conf" -RunTest mesh_gatt_suspend_resume_low_lat \ - suspend_dut_gatt_suspend_resume suspend_tester_gatt - -overlay="overlay_gatt_conf_overlay_psa_conf" -RunTest mesh_gatt_suspend_resume_psa \ - suspend_dut_gatt_suspend_resume suspend_tester_gatt diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_disable_resume.sh b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_disable_resume.sh deleted file mode 100755 index bfe42e15c16..00000000000 --- a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_disable_resume.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh - -# Test that periodic publication is stopped when suspending Mesh and disabling -# Bluetooth, and that it is started again when Bluetooth is re-enabled and Mesh is resumed. -# The test will fail under two conditions; if no publication is received while -# Mesh is enabled, or if a publication is received while Mesh is suspended. -# -# Test procedure: -# 0. Provisioning and setup. -# 1. Start publication. -# 2. Suspend Mesh and disable Bluetooth, checking that publication stops. -# 3. Enable Bluetooth and resume Mesh a specified time after suspension. -# Check that publication resumes. - -RunTest mesh_suspend_disable_resume \ - suspend_dut_suspend_disable_resume suspend_tester_pub - -overlay=overlay_low_lat_conf -RunTest mesh_suspend_disable_resume_low_lat \ - suspend_dut_suspend_disable_resume suspend_tester_pub - -overlay=overlay_psa_conf -RunTest mesh_suspend_disable_resume_psa \ - suspend_dut_suspend_disable_resume suspend_tester_pub diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_resume.sh b/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_resume.sh deleted file mode 100755 index 31d151201a8..00000000000 --- a/tests/bsim/bluetooth/mesh/tests_scripts/suspend/suspend_resume.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh - -# Test that periodic publication is stopped when suspending Mesh, and that it -# is started again when Mesh is resumed. The test will fail under two -# conditions; if no publication is received while Mesh is enabled, -# or if a publication is received while Mesh is suspended. -# -# Test procedure: -# 0. Provisioning and setup. -# 1. Start publication. -# 2. Suspend Mesh, checking that publication stops. -# 3. Resume Mesh a specified time after suspension. Check that publication resumes. - -RunTest mesh_suspend_resume \ - suspend_dut_suspend_resume suspend_tester_pub - -overlay=overlay_low_lat_conf -RunTest mesh_suspend_resume_low_lat \ - suspend_dut_suspend_resume suspend_tester_pub - -overlay=overlay_psa_conf -RunTest mesh_suspend_resume_psa \ - suspend_dut_suspend_resume suspend_tester_pub diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/fixed.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/fixed.sh index f4d0cfc0cac..d4b86d2f98a 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/fixed.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/fixed.sh @@ -15,5 +15,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # model; RunTest mesh_transport_fixed transport_tx_fixed transport_rx_fixed +conf=prj_mesh1d1_conf +RunTest mesh_transport_fixed_1d1 transport_tx_fixed transport_rx_fixed + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_fixed_1d1 transport_tx_fixed transport_rx_fixed diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/group.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/group.sh index 7b7c6a559fc..d85d7cf8604 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/group.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/group.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_group transport_tx_group transport_rx_group +conf=prj_mesh1d1_conf +RunTest mesh_transport_group_1d1 transport_tx_group transport_rx_group + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_group_psa transport_tx_group transport_rx_group diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback.sh index e2812efda23..9cc1fb33041 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest transport_loopback transport_tx_loopback transport_rx_none +conf=prj_mesh1d1_conf +RunTest transport_loopback_1d1 transport_tx_loopback transport_rx_none + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest transport_loopback_psa transport_tx_loopback transport_rx_none diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group.sh index 38b6c8dd906..3be2bb24367 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_loopback_group transport_tx_loopback_group transport_rx_group +conf=prj_mesh1d1_conf +RunTest mesh_transport_loopback_group_1d1 transport_tx_loopback_group transport_rx_group + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_loopback_group_psa transport_tx_loopback_group transport_rx_group diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group_low_lat.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group_low_lat.sh index 3972edd3034..63829e012a5 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group_low_lat.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/loopback_group_low_lat.sh @@ -7,5 +7,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh overlay=overlay_low_lat_conf RunTest mesh_transport_loopback_group_low_lat transport_tx_loopback_group transport_rx_group +conf=prj_mesh1d1_conf +overlay=overlay_low_lat_conf +RunTest mesh_transport_loopback_group_low_lat_1d1 transport_tx_loopback_group transport_rx_group + +conf=prj_mesh1d1_conf overlay="overlay_low_lat_conf_overlay_psa_conf" RunTest mesh_transport_loopback_group_low_lat_psa transport_tx_loopback_group transport_rx_group diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_block.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_block.sh index 788d3eeebdf..21a56f37478 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_block.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_block.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_seg_block transport_tx_seg_block transport_rx_seg_block +conf=prj_mesh1d1_conf +RunTest mesh_transport_seg_block_1d1 transport_tx_seg_block transport_rx_seg_block + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_seg_block_psa transport_tx_seg_block transport_rx_seg_block diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_concurrent.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_concurrent.sh index d07c90c8d22..40ba38aae12 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_concurrent.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_concurrent.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_seg_concurrent transport_tx_seg_concurrent transport_rx_seg_concurrent +conf=prj_mesh1d1_conf +RunTest mesh_transport_seg_concurrent_1d1 transport_tx_seg_concurrent transport_rx_seg_concurrent + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_seg_concurrent_psa transport_tx_seg_concurrent transport_rx_seg_concurrent diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_fail.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_fail.sh index 72639370b93..ca650ede1f4 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_fail.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_fail.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_seg_fail transport_tx_seg_fail +conf=prj_mesh1d1_conf +RunTest mesh_transport_seg_fail_1d1 transport_tx_seg_fail + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_seg_fail_psa transport_tx_seg_fail diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_ivu.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_ivu.sh index 0ef30273341..9268e42029e 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_ivu.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/seg_ivu.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_seg_ivu transport_tx_seg_ivu transport_rx_seg_ivu +conf=prj_mesh1d1_conf +RunTest mesh_transport_seg_ivu_1d1 transport_tx_seg_ivu transport_rx_seg_ivu + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_seg_ivu_psa transport_tx_seg_ivu transport_rx_seg_ivu diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast.sh index c91397f4f4b..a107a86146c 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_unicast transport_tx_unicast transport_rx_unicast +conf=prj_mesh1d1_conf +RunTest mesh_transport_unicast_1d1 transport_tx_unicast transport_rx_unicast + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_unicast_psa transport_tx_unicast transport_rx_unicast diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast_low_lat.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast_low_lat.sh index 981347a3385..cbfc8ea5ce7 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast_low_lat.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unicast_low_lat.sh @@ -7,5 +7,10 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh overlay=overlay_low_lat_conf RunTest mesh_transport_unicast_low_lat transport_tx_unicast transport_rx_unicast +conf=prj_mesh1d1_conf +overlay=overlay_low_lat_conf +RunTest mesh_transport_unicast_low_lat_1d1 transport_tx_unicast transport_rx_unicast + +conf=prj_mesh1d1_conf overlay="overlay_low_lat_conf_overlay_psa_conf" RunTest mesh_transport_unicast_low_lat_psa transport_tx_unicast transport_rx_unicast diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unknown_app.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unknown_app.sh index 6f077ee0c8b..2a1b2741b60 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/unknown_app.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/unknown_app.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_unknown_app transport_tx_unknown_app transport_rx_none +conf=prj_mesh1d1_conf +RunTest mesh_transport_unknown_app_1d1 transport_tx_unknown_app transport_rx_none + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_unknown_app_psa transport_tx_unknown_app transport_rx_none diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/va.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/va.sh index 4336a2aa042..698bd164485 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/va.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/va.sh @@ -6,5 +6,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh RunTest mesh_transport_va transport_tx_va transport_rx_va +conf=prj_mesh1d1_conf +RunTest mesh_transport_va_1d1 transport_tx_va transport_rx_va + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_va_psa transport_tx_va transport_rx_va diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/transport/va_collision.sh b/tests/bsim/bluetooth/mesh/tests_scripts/transport/va_collision.sh index dbcc3c64bc7..631c43790ef 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/transport/va_collision.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/transport/va_collision.sh @@ -7,5 +7,9 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # Test transmission to virtual addresses with collision RunTest mesh_transport_va_collision transport_tx_va_collision transport_rx_va_collision +conf=prj_mesh1d1_conf +RunTest mesh_transport_va_collision_1d1 transport_tx_va_collision transport_rx_va_collision + +conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_transport_va_collision_psa transport_tx_va_collision transport_rx_va_collision From ccc8b4d2afb70cc3d5d2611947f975ebad2d7ede Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:16 +0100 Subject: [PATCH 1010/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Fix processing SegAcks to wrong destination" This reverts commit f4266dc3891c1de97205800397260c516748e8e8. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/transport.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/subsys/bluetooth/mesh/transport.c b/subsys/bluetooth/mesh/transport.c index a0364dceb25..47e8492a901 100644 --- a/subsys/bluetooth/mesh/transport.c +++ b/subsys/bluetooth/mesh/transport.c @@ -869,8 +869,6 @@ static int trans_ack(struct bt_mesh_net_rx *rx, uint8_t hdr, /* Best effort - we don't have enough info for true SeqAuth */ *seq_auth = SEQ_AUTH(BT_MESH_NET_IVI_RX(rx), seq_zero); return 0; - } else if (!rx->local_match) { - return 0; } ack = net_buf_simple_pull_be32(buf); @@ -971,7 +969,7 @@ static int ctl_recv(struct bt_mesh_net_rx *rx, uint8_t hdr, return bt_mesh_hb_recv(rx, buf); } - /* Only acks for friendship and heartbeats may need processing without local_match */ + /* Only acks and heartbeats may need processing without local_match */ if (!rx->local_match) { return 0; } From c091086283a34384fada15624d0a73ac7df11aef Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:16 +0100 Subject: [PATCH 1011/2300] Revert "[nrf fromtree] Bluetooth: fixing null-pointer dereference in l2cap channel destroyer" This reverts commit 8766adfd46d141fde0a6bba5c309de96e4275758. Signed-off-by: Robert Lubos --- subsys/bluetooth/host/l2cap.c | 4 +--- subsys/bluetooth/host/l2cap_br.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index b8faa1efcae..e6fbe2144f8 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -977,9 +977,7 @@ static void l2cap_chan_destroy(struct bt_l2cap_chan *chan) * In the case where we are in the context of executing the rtx_work * item, we don't sync as it will deadlock the workqueue. */ - struct k_work_q *rtx_work_queue = le_chan->rtx_work.queue; - - if (rtx_work_queue == NULL || k_current_get() != &rtx_work_queue->thread) { + if (k_current_get() != &le_chan->rtx_work.queue->thread) { k_work_cancel_delayable_sync(&le_chan->rtx_work, &le_chan->rtx_sync); } else { k_work_cancel_delayable(&le_chan->rtx_work); diff --git a/subsys/bluetooth/host/l2cap_br.c b/subsys/bluetooth/host/l2cap_br.c index 3a33ff293c6..e9a10ff8d72 100644 --- a/subsys/bluetooth/host/l2cap_br.c +++ b/subsys/bluetooth/host/l2cap_br.c @@ -165,9 +165,7 @@ static void l2cap_br_chan_destroy(struct bt_l2cap_chan *chan) * In the case where we are in the context of executing the rtx_work * item, we don't sync as it will deadlock the workqueue. */ - struct k_work_q *rtx_work_queue = br_chan->rtx_work.queue; - - if (rtx_work_queue == NULL || k_current_get() != &rtx_work_queue->thread) { + if (k_current_get() != &br_chan->rtx_work.queue->thread) { k_work_cancel_delayable_sync(&br_chan->rtx_work, &br_chan->rtx_sync); } else { k_work_cancel_delayable(&br_chan->rtx_work); From 5d2dfbe1a24597f88e2f3f875c772a1c3e774a0e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:16 +0100 Subject: [PATCH 1012/2300] Revert "[nrf fromtree] Bluetooth: fixing UBSAN warnings related to Codec Configuration" This reverts commit c127c41548dcb59716d7bf5e7ac90b0139f399a5. Signed-off-by: Robert Lubos --- subsys/bluetooth/host/iso.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index 05b5cc2f613..4d6366ead67 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -233,10 +233,9 @@ static int hci_le_setup_iso_data_path(const struct bt_conn *iso, uint8_t dir, cp->codec_id.vs_codec_id = sys_cpu_to_le16(path->vid); sys_put_le24(path->delay, cp->controller_delay); cp->codec_config_len = path->cc_len; - cc = net_buf_add(buf, path->cc_len); - if (path->cc_len) { - memcpy(cc, path->cc, path->cc_len); - } + cc = net_buf_add(buf, cp->codec_config_len); + memcpy(cc, path->cc, cp->codec_config_len); + err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_SETUP_ISO_PATH, buf, &rsp); if (err) { return err; From b5a7b6a300d2409bfd77ebee56b523f6e03e4ab6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:16 +0100 Subject: [PATCH 1013/2300] Revert "[nrf fromtree] Bluetooth: Fixing UBSAN warning in CTE field parsing in adv.c/scan.c" This reverts commit e2190a79a2eee5eca843baa1c302482edd9df656. Signed-off-by: Robert Lubos --- subsys/bluetooth/host/adv.c | 2 +- subsys/bluetooth/host/hci_core.c | 16 ---------------- subsys/bluetooth/host/hci_core.h | 9 +-------- subsys/bluetooth/host/scan.c | 2 +- 4 files changed, 3 insertions(+), 26 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 7a312d5e05c..734c835a841 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -2064,7 +2064,7 @@ void bt_hci_le_per_adv_response_report(struct net_buf *buf) response = net_buf_pull_mem(buf, sizeof(struct bt_hci_evt_le_per_adv_response)); info.tx_power = response->tx_power; info.rssi = response->rssi; - info.cte_type = bt_get_df_cte_type(response->cte_type); + info.cte_type = BIT(response->cte_type); info.response_slot = response->response_slot; if (buf->len < response->data_length) { diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index ee1c822d9f9..b37cd45e1ae 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -422,22 +422,6 @@ uint8_t bt_get_phy(uint8_t hci_phy) } } -int bt_get_df_cte_type(uint8_t hci_cte_type) -{ - switch (hci_cte_type) { - case BT_HCI_LE_AOA_CTE: - return BT_DF_CTE_TYPE_AOA; - case BT_HCI_LE_AOD_CTE_1US: - return BT_DF_CTE_TYPE_AOD_1US; - case BT_HCI_LE_AOD_CTE_2US: - return BT_DF_CTE_TYPE_AOD_2US; - case BT_HCI_LE_NO_CTE: - return BT_DF_CTE_TYPE_NONE; - default: - return BT_DF_CTE_TYPE_NONE; - } -} - #if defined(CONFIG_BT_CONN_TX) static void hci_num_completed_packets(struct net_buf *buf) { diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index 1a3c06414a0..ce4fc5a9b63 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -434,14 +434,7 @@ int bt_le_set_data_len(struct bt_conn *conn, uint16_t tx_octets, uint16_t tx_tim int bt_le_set_phy(struct bt_conn *conn, uint8_t all_phys, uint8_t pref_tx_phy, uint8_t pref_rx_phy, uint8_t phy_opts); uint8_t bt_get_phy(uint8_t hci_phy); -/** - * @brief Convert CTE type value from HCI format to @ref bt_df_cte_type format. - * - * @param hci_cte_type CTE type in an HCI format. - * - * @return CTE type (@ref bt_df_cte_type). - */ -int bt_get_df_cte_type(uint8_t hci_cte_type); + int bt_le_scan_update(bool fast_scan); int bt_le_create_conn(const struct bt_conn *conn); diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index ceb4fd2428e..2d71b2fbc2c 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -825,7 +825,7 @@ static void bt_hci_le_per_adv_report_common(struct net_buf *buf) info.tx_power = evt->tx_power; info.rssi = evt->rssi; - info.cte_type = bt_get_df_cte_type(evt->cte_type); + info.cte_type = BIT(evt->cte_type); info.addr = &per_adv_sync->addr; info.sid = per_adv_sync->sid; From 7d2e609532d84606aab4b6e7fd818b100f014ab0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:17 +0100 Subject: [PATCH 1014/2300] Revert "[nrf fromtree] manifest: Update nrf hw models to latest" This reverts commit e134f7688d2799b6ff4ff117ca57cdc7ff506edd. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 96878a3ae41..8f3c4216a94 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 52d0b4b7b7431d8da6222cc3b17a8afdcb099baf + revision: d17c9d749c817d2522468fa3c0eee3705feb8951 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From 7a6314717a0289384dca17aaab564a5e96081474 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:17 +0100 Subject: [PATCH 1015/2300] Revert "[nrf fromtree] manifest: Update nrf hw models to latest" This reverts commit 8e313aec37fc48a873d2ee9f7d5bbc60b212f258. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 8f3c4216a94..740a1fabd5a 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: d17c9d749c817d2522468fa3c0eee3705feb8951 + revision: 6b6ae3652c92c95edd945dce6ad9ef9892aab89b path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From 04a8a2dfde5b60c480711c4e985125e1787db015 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:17 +0100 Subject: [PATCH 1016/2300] Revert "[nrf fromtree] manifest: Update nrf hw models to latest" This reverts commit c8e120fae407f3c0090311cc41e202a50ac4654a. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 740a1fabd5a..c80fcd3fd8d 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 6b6ae3652c92c95edd945dce6ad9ef9892aab89b + revision: a08acc7d3a853f890df2bf82167c02ab2153ffe7 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From b3a23330970a76a26e5a3ff0827664f1d440be3f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:17 +0100 Subject: [PATCH 1017/2300] Revert "[nrf fromtree] manifest: Update nrf hw models to latest" This reverts commit dd49bf3b9fe2e1fdba53f193ffb06516ad35d42c. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c80fcd3fd8d..305e2ef629d 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: a08acc7d3a853f890df2bf82167c02ab2153ffe7 + revision: c744f2c762aad79e59bd7e99002f2fcab0a2f288 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From df35a0398bb23b86e721735b980411971f8526e7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:17 +0100 Subject: [PATCH 1018/2300] Revert "[nrf fromtree] manifest: Update nrf hw models to latest" This reverts commit 87ef222d3dd2c530db087b06014718fbdb6c7aa7. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 305e2ef629d..3cfa07c2742 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: c744f2c762aad79e59bd7e99002f2fcab0a2f288 + revision: 9b985ea6bc237b6ae06f48eb228f2ac7f6e3b96b path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From 432ba5abacb2e5ff08357947dff491ad32da90be Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:18 +0100 Subject: [PATCH 1019/2300] Revert "[nrf fromtree] Bluetooth: Host: Send status for terminated directed adv" This reverts commit 2040c6caced995ad85abf9d5cbfb8cb73ccfc8c8. Signed-off-by: Robert Lubos --- subsys/bluetooth/host/adv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 734c835a841..7134e6fa89a 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -2185,10 +2185,11 @@ void bt_hci_le_adv_set_terminated(struct net_buf *buf) if (evt->status && IS_ENABLED(CONFIG_BT_PERIPHERAL) && atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { - /* This will call connected callback for high duty cycle + /* Only set status for legacy advertising API. + * This will call connected callback for high duty cycle * directed advertiser timeout. */ - le_adv_stop_free_conn(adv, evt->status); + le_adv_stop_free_conn(adv, adv == bt_dev.adv ? evt->status : 0); } if (IS_ENABLED(CONFIG_BT_CONN) && !evt->status) { From 240ea70b54f8aab955282bffda8d6e0492aae094 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:18 +0100 Subject: [PATCH 1020/2300] Revert "[nrf fromtree] dts: arm: nordic: nrf54l15: add missing easydma-maxcnt-bits" This reverts commit 948e41321b8fd3659d7b9f172ffa8d4e581969e3. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index 485d85829a4..786c21ab215 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -106,7 +106,6 @@ i2c20: i2c@c6000 { reg = <0xc6000 0x1000>; clock-frequency = ; interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; status = "disabled"; }; @@ -141,7 +140,6 @@ i2c21: i2c@c7000 { reg = <0xc7000 0x1000>; clock-frequency = ; interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; status = "disabled"; }; @@ -176,7 +174,6 @@ i2c22: i2c@c8000 { reg = <0xc8000 0x1000>; clock-frequency = ; interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; status = "disabled"; }; @@ -347,7 +344,6 @@ i2c30: i2c@104000 { reg = <0x104000 0x1000>; clock-frequency = ; interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; status = "disabled"; }; From 3688c7a254eb625913d1e6f3a2016630b97ee4f2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:18 +0100 Subject: [PATCH 1021/2300] Revert "[nrf fromtree] drivers: console: uart_mux: fix incorrect usage of configuration API" This reverts commit f43242374bdbf87608a0e5db7ecc68c07c3859d4. Signed-off-by: Robert Lubos --- drivers/console/uart_mux.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/console/uart_mux.c b/drivers/console/uart_mux.c index 8ade93ef0bb..ca445a1f5b7 100644 --- a/drivers/console/uart_mux.c +++ b/drivers/console/uart_mux.c @@ -481,6 +481,24 @@ static int uart_mux_err_check(const struct device *dev) return -ENOTSUP; } +static int uart_mux_configure(const struct device *dev, + const struct uart_config *cfg) +{ + ARG_UNUSED(dev); + ARG_UNUSED(cfg); + + return -ENOTSUP; +} + +static int uart_mux_config_get(const struct device *dev, + struct uart_config *cfg) +{ + ARG_UNUSED(dev); + ARG_UNUSED(cfg); + + return -ENOTSUP; +} + static int uart_mux_fifo_fill(const struct device *dev, const uint8_t *tx_data, int len) { @@ -696,6 +714,8 @@ static struct uart_mux_driver_api uart_mux_driver_api = { .uart_api.poll_in = uart_mux_poll_in, .uart_api.poll_out = uart_mux_poll_out, .uart_api.err_check = uart_mux_err_check, + .uart_api.configure = uart_mux_configure, + .uart_api.config_get = uart_mux_config_get, .uart_api.fifo_fill = uart_mux_fifo_fill, .uart_api.fifo_read = uart_mux_fifo_read, .uart_api.irq_tx_enable = uart_mux_irq_tx_enable, From 6e9ad3fda8f97586e2e46d7e512071cc3aa48496 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:19 +0100 Subject: [PATCH 1022/2300] Revert "[nrf fromtree] boards: riscv: add nrf54h20pdk_nrf54h20_cpuppr" This reverts commit 55252ae8194208dbfbe81545f703b4344d249767. Signed-off-by: Robert Lubos --- .../riscv/nrf54h20pdk_nrf54h20/Kconfig.board | 6 --- .../nrf54h20pdk_nrf54h20/Kconfig.defconfig | 6 --- boards/riscv/nrf54h20pdk_nrf54h20/board.cmake | 3 -- .../nrf54h20pdk_nrf54h20_cpuppr.dts | 43 ------------------- .../nrf54h20pdk_nrf54h20_cpuppr.yaml | 13 ------ .../nrf54h20pdk_nrf54h20_cpuppr_defconfig | 14 ------ .../nrf54h20pdk_nrf54h20/pre_dt_board.cmake | 7 --- 7 files changed, 92 deletions(-) delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/board.cmake delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board deleted file mode 100644 index 9bbbba60dd4..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_NRF54H20PDK_NRF54H20_CPUPPR - bool "nRF54H20 PDK nRF54H20 PPR MCU" - depends on SOC_NRF54H20_ENGA_CPUPPR diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig deleted file mode 100644 index 256976d6519..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD - default "nrf54h20pdk_nrf54h20_cpuppr" - depends on BOARD_NRF54H20PDK_NRF54H20_CPUPPR diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake b/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake deleted file mode 100644 index 4c63f1dd05e..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts deleted file mode 100644 index 83aface6f5c..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" - -/ { - compatible = "nordic,nrf54h20pdk_nrf54h20-cpuppr"; - model = "Nordic nRF54H20 PDK nRF54H20 Peripheral Processor MCU"; - #address-cells = <1>; - #size-cells = <1>; - - chosen { - zephyr,console = &uart135; - zephyr,code-partition = &cpuppr_code_partition; - zephyr,flash = &mram1x; - zephyr,sram = &cpuppr_ram3x_region; - }; -}; - -&grtc { - status = "okay"; - owned-channels = <5>; -}; - -&uart135 { - status = "okay"; - pinctrl-0 = <&uart135_default>; - pinctrl-1 = <&uart135_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart136 { - pinctrl-0 = <&uart136_default>; - pinctrl-1 = <&uart136_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml deleted file mode 100644 index 274be865c36..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20pdk_nrf54h20_cpuppr -name: nRF54H20-PDK-nRF54H20-PPR -type: mcu -arch: riscv -toolchain: - - zephyr -ram: 28 -flash: 28 -supported: - - gpio diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig deleted file mode 100644 index fb3dca2266d..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_ENGA_CPUPPR=y -CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUPPR=y - -CONFIG_XIP=n - -CONFIG_SERIAL=y - -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake b/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake deleted file mode 100644 index 5e0fecebdc8..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Allow common DTS files to be included from the other board directory. -# To be removed after HWMv2 (#51831), once both directories can be merged into one. -string(REGEX REPLACE "/riscv/(.*$)" "/arm/\\1" BOARD_DIR_ARM "${BOARD_DIR}") -list(APPEND DTS_EXTRA_CPPFLAGS -isystem "${BOARD_DIR_ARM}") From 0efb07a7ff445d59d1c3927872b8f1c36867ffb5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:19 +0100 Subject: [PATCH 1023/2300] Revert "[nrf fromtree] soc: riscv: nordic_nrf: nrf54h: introduce PPR support" This reverts commit 89295660dfe2cdfe636b9bf3329a4dac4853f2ac. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/CMakeLists.txt | 3 --- soc/riscv/nordic_nrf/CMakeLists.txt | 1 - soc/riscv/nordic_nrf/Kconfig | 3 --- soc/riscv/nordic_nrf/Kconfig.defconfig | 8 -------- soc/riscv/nordic_nrf/Kconfig.soc | 4 ---- soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt | 6 ------ .../Kconfig.defconfig.nrf54h20_enga_cpuppr | 15 --------------- .../nrf54h/Kconfig.defconfig.series | 19 ------------------- soc/riscv/nordic_nrf/nrf54h/Kconfig.series | 10 ---------- soc/riscv/nordic_nrf/nrf54h/Kconfig.soc | 19 ------------------- soc/riscv/nordic_nrf/nrf54h/align.ld | 10 ---------- 11 files changed, 98 deletions(-) delete mode 100644 soc/riscv/nordic_nrf/Kconfig.soc delete mode 100644 soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt delete mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr delete mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.series delete mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.series delete mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.soc delete mode 100644 soc/riscv/nordic_nrf/nrf54h/align.ld diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index ffd2e9aebc1..cd8392e118f 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -40,8 +40,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP NRF54H20_ENGA_X NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD NRF54H20_ENGA_XXAA NRF_RADIOCORE) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR NRF54H20_ENGA_XXAA - NRF_PPR) zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_LOCK ENABLE_APPROTECT) @@ -175,7 +173,6 @@ mdk_svd_ifdef(CONFIG_SOC_NRF52840 nrf52840.svd) mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUAPP nrf5340_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUNET nrf5340_network.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP nrf54h20_enga_application.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR nrf54h20_enga_ppr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD nrf54h20_enga_radiocore.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9120 nrf9120.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9160 nrf9160.svd) diff --git a/soc/riscv/nordic_nrf/CMakeLists.txt b/soc/riscv/nordic_nrf/CMakeLists.txt index 6a5b10545ff..91bd222e147 100644 --- a/soc/riscv/nordic_nrf/CMakeLists.txt +++ b/soc/riscv/nordic_nrf/CMakeLists.txt @@ -2,4 +2,3 @@ # SPDX-License-Identifier: Apache-2.0 add_subdirectory(common) -add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/nordic_nrf/Kconfig b/soc/riscv/nordic_nrf/Kconfig index a39db4671d5..3f17bea1756 100644 --- a/soc/riscv/nordic_nrf/Kconfig +++ b/soc/riscv/nordic_nrf/Kconfig @@ -12,7 +12,4 @@ config SOC_FAMILY source "soc/riscv/nordic_nrf/common/Kconfig" -source "soc/common/nordic_nrf/Kconfig.peripherals" -source "soc/riscv/nordic_nrf/*/Kconfig.soc" - endif # SOC_FAMILY_NRF diff --git a/soc/riscv/nordic_nrf/Kconfig.defconfig b/soc/riscv/nordic_nrf/Kconfig.defconfig index cc3ec954985..a6d85ac846a 100644 --- a/soc/riscv/nordic_nrf/Kconfig.defconfig +++ b/soc/riscv/nordic_nrf/Kconfig.defconfig @@ -3,14 +3,6 @@ if SOC_FAMILY_NRF -source "soc/riscv/nordic_nrf/*/Kconfig.defconfig.series" source "soc/riscv/nordic_nrf/common/Kconfig.defconfig" -config BUILD_OUTPUT_HEX - default y - -config SYS_CLOCK_HW_CYCLES_PER_SEC - default 1000000 if NRF_GRTC_TIMER - default 32768 if NRF_RTC_TIMER - endif # SOC_FAMILY_NRF diff --git a/soc/riscv/nordic_nrf/Kconfig.soc b/soc/riscv/nordic_nrf/Kconfig.soc deleted file mode 100644 index 593d6f91769..00000000000 --- a/soc/riscv/nordic_nrf/Kconfig.soc +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/nordic_nrf/*/Kconfig.series" diff --git a/soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt b/soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt deleted file mode 100644 index 5b37b3a54d8..00000000000 --- a/soc/riscv/nordic_nrf/nrf54h/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -# 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) diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr deleted file mode 100644 index a36d24c72ae..00000000000 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54H20_ENGA_CPUPPR - -config SOC - default "nrf54h20_enga_cpuppr" - -config NUM_IRQS - default 496 - -config SYS_CLOCK_TICKS_PER_SEC - default 1000 - -endif # SOC_NRF54H20_ENGA_CPUPPR diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.series b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.series deleted file mode 100644 index 0f827fbe96b..00000000000 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.series +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_SERIES_NRF54HX - -rsource "Kconfig.defconfig.nrf54h*" - -config SOC_SERIES - default "nrf54h" - -DT_CHOSEN_Z_SRAM = zephyr,sram -DT_CHOSEN_Z_CODE = zephyr,code-partition - -config BUILD_OUTPUT_ADJUST_LMA - depends on !XIP - default "$(dt_chosen_partition_addr_hex,$(DT_CHOSEN_Z_CODE)) - \ - $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_SRAM))" - -endif # SOC_SERIES_NRF54HX diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.series b/soc/riscv/nordic_nrf/nrf54h/Kconfig.series deleted file mode 100644 index acb85b5623a..00000000000 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.series +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_NRF54HX - bool "Nordic Semiconductor nRF54H series MCU" - select SOC_FAMILY_NRF - select HAS_NRFX - select HAS_NORDIC_DRIVERS - help - Enable support for nRF54H MCU series diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc deleted file mode 100644 index 17a6dd667c6..00000000000 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_NRF54H20 - bool "nRF54H20" - depends on SOC_SERIES_NRF54HX - -if SOC_NRF54H20 - -choice - prompt "nRF54Hx MCU Selection" - -config SOC_NRF54H20_ENGA_CPUPPR - bool "nRF54H20 ENGA CPUPPR" - select RISCV - -endchoice - -endif # SOC_NRF54H20 diff --git a/soc/riscv/nordic_nrf/nrf54h/align.ld b/soc/riscv/nordic_nrf/nrf54h/align.ld deleted file mode 100644 index 0905aa7f7bc..00000000000 --- a/soc/riscv/nordic_nrf/nrf54h/align.ld +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA. - * SPDX-License-Identifier: Apache-2.0 - */ - -SECTION_PROLOGUE(.align16,,) -{ - . = (ALIGN(16) > 0 ? ALIGN(16) : 16) - 1; - BYTE(0); -} GROUP_LINK_IN(ROMABLE_REGION) From 91e1d13aab273a193a161569c3083834b23a5d47 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:19 +0100 Subject: [PATCH 1024/2300] Revert "[nrf fromtree] soc: riscv: nordic_nrf: add initial support for VPR core" This reverts commit d44f8b501ab80a0d45df8c05cf30cde3155929c5. Signed-off-by: Robert Lubos --- soc/riscv/nordic_nrf/CMakeLists.txt | 4 - soc/riscv/nordic_nrf/Kconfig | 15 --- soc/riscv/nordic_nrf/Kconfig.defconfig | 8 -- soc/riscv/nordic_nrf/common/CMakeLists.txt | 4 - soc/riscv/nordic_nrf/common/Kconfig | 4 - soc/riscv/nordic_nrf/common/Kconfig.defconfig | 8 -- .../nordic_nrf/common/vpr/CMakeLists.txt | 9 -- soc/riscv/nordic_nrf/common/vpr/Kconfig | 18 --- .../nordic_nrf/common/vpr/Kconfig.defconfig | 27 ---- soc/riscv/nordic_nrf/common/vpr/soc_context.h | 12 -- soc/riscv/nordic_nrf/common/vpr/soc_irq.S | 30 ----- soc/riscv/nordic_nrf/common/vpr/soc_irq.c | 26 ---- .../nordic_nrf/common/vpr/soc_isr_stacking.h | 118 ------------------ soc/riscv/nordic_nrf/common/vpr/soc_offsets.h | 11 -- soc/riscv/nordic_nrf/common/vpr/vector.S | 28 ----- 15 files changed, 322 deletions(-) delete mode 100644 soc/riscv/nordic_nrf/CMakeLists.txt delete mode 100644 soc/riscv/nordic_nrf/Kconfig delete mode 100644 soc/riscv/nordic_nrf/Kconfig.defconfig delete mode 100644 soc/riscv/nordic_nrf/common/CMakeLists.txt delete mode 100644 soc/riscv/nordic_nrf/common/Kconfig delete mode 100644 soc/riscv/nordic_nrf/common/Kconfig.defconfig delete mode 100644 soc/riscv/nordic_nrf/common/vpr/CMakeLists.txt delete mode 100644 soc/riscv/nordic_nrf/common/vpr/Kconfig delete mode 100644 soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig delete mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_context.h delete mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_irq.S delete mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_irq.c delete mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_isr_stacking.h delete mode 100644 soc/riscv/nordic_nrf/common/vpr/soc_offsets.h delete mode 100644 soc/riscv/nordic_nrf/common/vpr/vector.S diff --git a/soc/riscv/nordic_nrf/CMakeLists.txt b/soc/riscv/nordic_nrf/CMakeLists.txt deleted file mode 100644 index 91bd222e147..00000000000 --- a/soc/riscv/nordic_nrf/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory(common) diff --git a/soc/riscv/nordic_nrf/Kconfig b/soc/riscv/nordic_nrf/Kconfig deleted file mode 100644 index 3f17bea1756..00000000000 --- a/soc/riscv/nordic_nrf/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_NRF - bool - -if SOC_FAMILY_NRF - -config SOC_FAMILY - string - default "nordic_nrf" - -source "soc/riscv/nordic_nrf/common/Kconfig" - -endif # SOC_FAMILY_NRF diff --git a/soc/riscv/nordic_nrf/Kconfig.defconfig b/soc/riscv/nordic_nrf/Kconfig.defconfig deleted file mode 100644 index a6d85ac846a..00000000000 --- a/soc/riscv/nordic_nrf/Kconfig.defconfig +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_FAMILY_NRF - -source "soc/riscv/nordic_nrf/common/Kconfig.defconfig" - -endif # SOC_FAMILY_NRF diff --git a/soc/riscv/nordic_nrf/common/CMakeLists.txt b/soc/riscv/nordic_nrf/common/CMakeLists.txt deleted file mode 100644 index 806a295ea22..00000000000 --- a/soc/riscv/nordic_nrf/common/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory_ifdef(CONFIG_RISCV_CORE_NORDIC_VPR vpr) diff --git a/soc/riscv/nordic_nrf/common/Kconfig b/soc/riscv/nordic_nrf/common/Kconfig deleted file mode 100644 index 610689ecc6d..00000000000 --- a/soc/riscv/nordic_nrf/common/Kconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/nordic_nrf/common/vpr/Kconfig" diff --git a/soc/riscv/nordic_nrf/common/Kconfig.defconfig b/soc/riscv/nordic_nrf/common/Kconfig.defconfig deleted file mode 100644 index 9beb943edb8..00000000000 --- a/soc/riscv/nordic_nrf/common/Kconfig.defconfig +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if RISCV_CORE_NORDIC_VPR - -source "soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig" - -endif # RISCV_CORE_NORDIC_VPR diff --git a/soc/riscv/nordic_nrf/common/vpr/CMakeLists.txt b/soc/riscv/nordic_nrf/common/vpr/CMakeLists.txt deleted file mode 100644 index e0331bb8e0b..00000000000 --- a/soc/riscv/nordic_nrf/common/vpr/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -zephyr_include_directories(.) - -zephyr_library() -zephyr_library_sources(soc_irq.S soc_irq.c vector.S) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig deleted file mode 100644 index 40a7d199c0c..00000000000 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config RISCV_CORE_NORDIC_VPR - bool "RISC-V Nordic VPR core" - default y - depends on DT_HAS_NORDIC_VPR_ENABLED - depends on RISCV - select ATOMIC_OPERATIONS_C - select RISCV_ISA_RV32E - select RISCV_ISA_EXT_M - select RISCV_ISA_EXT_C - select RISCV_ISA_EXT_ZICSR - select RISCV_ISA_EXT_ZIFENCEI - select RISCV_SOC_HAS_ISR_STACKING - select RISCV_SOC_CONTEXT_SAVE - help - Enable support for the RISC-V Nordic VPR core. diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig deleted file mode 100644 index f0014455b3a..00000000000 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CPU_PATH := $(dt_nodelabel_path,cpu) -CPU_ID := $(dt_node_reg_addr_int,$(CPU_PATH)) - -config RV_BOOT_HART - default $(CPU_ID) - -config RISCV_MCAUSE_EXCEPTION_MASK - default 0xFFF - -config RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET - default 16 - -config GEN_IRQ_VECTOR_TABLE - default y - -choice IRQ_VECTOR_TABLE_TYPE - default IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS -endchoice - -config ARCH_SW_ISR_TABLE_ALIGN - default 64 - -config RISCV_ALWAYS_SWITCH_THROUGH_ECALL - default y if MULTITHREADING diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_context.h b/soc/riscv/nordic_nrf/common/vpr/soc_context.h deleted file mode 100644 index 8cd0d1e5094..00000000000 --- a/soc/riscv/nordic_nrf/common/vpr/soc_context.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (C) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ -#define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ - -#define SOC_ESF_MEMBERS unsigned long minttresh -#define SOC_ESF_INIT 0 - -#endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ */ diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_irq.S b/soc/riscv/nordic_nrf/common/vpr/soc_irq.S deleted file mode 100644 index 0e9db48d9b4..00000000000 --- a/soc/riscv/nordic_nrf/common/vpr/soc_irq.S +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -/* Exports */ -GTEXT(__soc_handle_irq) -GTEXT(__soc_save_context) -GTEXT(__soc_restore_context) - -/* - * No need to clear anything, pending bit is cleared by HW. - */ -SECTION_FUNC(exception.other, __soc_handle_irq) - ret - -SECTION_FUNC(exception.other, __soc_save_context) - csrr t0, 0x347 - sw t0, __soc_esf_t_minttresh_OFFSET(a0) - - ret - -SECTION_FUNC(exception.other, __soc_restore_context) - lw t0, __soc_esf_t_minttresh_OFFSET(a0) - csrw 0x347, t0 - - ret diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_irq.c b/soc/riscv/nordic_nrf/common/vpr/soc_irq.c deleted file mode 100644 index 88655f6efa0..00000000000 --- a/soc/riscv/nordic_nrf/common/vpr/soc_irq.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -void arch_irq_enable(unsigned int irq) -{ - nrf_vpr_clic_int_enable_set(NRF_VPRCLIC, irq, true); -} - -void arch_irq_disable(unsigned int irq) -{ - nrf_vpr_clic_int_enable_set(NRF_VPRCLIC, irq, false); -} - -void arch_irq_priority_set(unsigned int irq, unsigned int prio) -{ - nrf_vpr_clic_int_priority_set(NRF_VPRCLIC, irq, prio); -} - -int arch_irq_is_enabled(unsigned int irq) -{ - return nrf_vpr_clic_int_enable_check(NRF_VPRCLIC, irq); -} diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_isr_stacking.h b/soc/riscv/nordic_nrf/common/vpr/soc_isr_stacking.h deleted file mode 100644 index d5b139111d0..00000000000 --- a/soc/riscv/nordic_nrf/common/vpr/soc_isr_stacking.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_ISR_STACKING_H_ -#define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_ISR_STACKING_H_ - -#include - -#if !defined(_ASMLANGUAGE) - -#include - -#define VPR_CPU DT_INST(0, nordic_vpr) - -#if DT_PROP(VPR_CPU, nordic_bus_width) == 64 - -#define SOC_ISR_STACKING_ESF_DECLARE \ - struct __esf { \ - unsigned long s0; \ - unsigned long mstatus; \ - unsigned long tp; \ - struct soc_esf soc_context; \ - \ - unsigned long t2; \ - unsigned long ra; \ - unsigned long t0; \ - unsigned long t1; \ - unsigned long a4; \ - unsigned long a5; \ - unsigned long a2; \ - unsigned long a3; \ - unsigned long a0; \ - unsigned long a1; \ - unsigned long mepc; \ - unsigned long _mcause; \ - } __aligned(16); - -#else /* DT_PROP(VPR_CPU, nordic_bus_width) == 32 */ - -#define SOC_ISR_STACKING_ESF_DECLARE \ - struct __esf { \ - unsigned long s0; \ - unsigned long mstatus; \ - unsigned long tp; \ - struct soc_esf soc_context; \ - \ - unsigned long ra; \ - unsigned long t2; \ - unsigned long t1; \ - unsigned long t0; \ - unsigned long a5; \ - unsigned long a4; \ - unsigned long a3; \ - unsigned long a2; \ - unsigned long a1; \ - unsigned long a0; \ - unsigned long mepc; \ - unsigned long _mcause; \ - } __aligned(16); - -#endif /* DT_PROP(VPR_CPU, nordic_bus_width) == 64 */ - -#else /* _ASMLANGUAGE */ - -/* - * Size of the HW managed part of the ESF: - * sizeof(_mcause) + sizeof(_mepc) - */ -#define ESF_HW_SIZEOF (0x8) - -/* - * Size of the SW managed part of the ESF in case of exception - */ -#define ESF_SW_EXC_SIZEOF (__z_arch_esf_t_SIZEOF - ESF_HW_SIZEOF) - -/* - * Size of the SW managed part of the ESF in case of interrupt - * sizeof(__padding) + ... + sizeof(soc_context) - */ -#define ESF_SW_IRQ_SIZEOF (0x10) - -#define SOC_ISR_SW_STACKING \ - csrw mscratch, t0; \ - \ - csrr t0, mcause; \ - srli t0, t0, RISCV_MCAUSE_IRQ_POS; \ - bnez t0, stacking_is_interrupt; \ - \ - csrrw t0, mscratch, zero; \ - \ - addi sp, sp, -ESF_SW_EXC_SIZEOF; \ - DO_CALLER_SAVED(sr); \ - j stacking_keep_going; \ - \ -stacking_is_interrupt: \ - addi sp, sp, -ESF_SW_IRQ_SIZEOF; \ - \ -stacking_keep_going: - -#define SOC_ISR_SW_UNSTACKING \ - csrr t0, mcause; \ - srli t0, t0, RISCV_MCAUSE_IRQ_POS; \ - bnez t0, unstacking_is_interrupt; \ - \ - DO_CALLER_SAVED(lr); \ - addi sp, sp, ESF_SW_EXC_SIZEOF; \ - j unstacking_keep_going; \ - \ -unstacking_is_interrupt: \ - addi sp, sp, ESF_SW_IRQ_SIZEOF; \ - \ -unstacking_keep_going: - -#endif /* _ASMLANGUAGE */ - -#endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_ISR_STACKING_H_ */ diff --git a/soc/riscv/nordic_nrf/common/vpr/soc_offsets.h b/soc/riscv/nordic_nrf/common/vpr/soc_offsets.h deleted file mode 100644 index 92d91044e1a..00000000000 --- a/soc/riscv/nordic_nrf/common/vpr/soc_offsets.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (C) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ -#define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ - -#define GEN_SOC_OFFSET_SYMS() GEN_OFFSET_SYM(soc_esf_t, minttresh) - -#endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ */ diff --git a/soc/riscv/nordic_nrf/common/vpr/vector.S b/soc/riscv/nordic_nrf/common/vpr/vector.S deleted file mode 100644 index b8c6d97170c..00000000000 --- a/soc/riscv/nordic_nrf/common/vpr/vector.S +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -/* Imports */ -GTEXT(__initialize) - -/* Exports */ -GTEXT(__start) - -SECTION_FUNC(vectors, __start) - /* Set mtvec.base (mtvec.mode is RO, no need to mask it). */ - la t0, _isr_wrapper - csrw mtvec, t0 - - /* Set mtvt. */ - la t0, _irq_vector_table - csrw 0x307, t0 - - /* Enable mstatus.mie */ - li t0, 0x1888 - csrw mstatus, t0 - - /* Call into Zephyr initialization. */ - tail __initialize From 9b7e8e9a7aff8f4416959b1d670aa657170a0406 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:20 +0100 Subject: [PATCH 1025/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: move Kconfig.peripherals to common folder" This reverts commit 7f033c323335c24f582ae93abafe156b43d1e223. Signed-off-by: Robert Lubos --- boards/posix/nrf_bsim/Kconfig | 2 +- soc/arm/nordic_nrf/Kconfig | 2 +- soc/{common => arm}/nordic_nrf/Kconfig.peripherals | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename soc/{common => arm}/nordic_nrf/Kconfig.peripherals (100%) diff --git a/boards/posix/nrf_bsim/Kconfig b/boards/posix/nrf_bsim/Kconfig index d85b497f671..7d67c44d284 100644 --- a/boards/posix/nrf_bsim/Kconfig +++ b/boards/posix/nrf_bsim/Kconfig @@ -6,7 +6,7 @@ if SOC_SERIES_BSIM_NRFXX # used by Nordic SoCs, so to make the symbols defined in this file available for # the simulated nrf5x_bsim boards, which use the POSIX architecture, the file # must be read also from here. -source "soc/common/nordic_nrf/Kconfig.peripherals" +source "soc/arm/nordic_nrf/Kconfig.peripherals" endif # SOC_SERIES_BSIM_NRFXX diff --git a/soc/arm/nordic_nrf/Kconfig b/soc/arm/nordic_nrf/Kconfig index ba0c9d4b164..69d83ae5e9b 100644 --- a/soc/arm/nordic_nrf/Kconfig +++ b/soc/arm/nordic_nrf/Kconfig @@ -13,7 +13,7 @@ config SOC_FAMILY string default "nordic_nrf" -source "soc/common/nordic_nrf/Kconfig.peripherals" +source "soc/arm/nordic_nrf/Kconfig.peripherals" source "soc/arm/nordic_nrf/*/Kconfig.soc" config NRF_SOC_SECURE_SUPPORTED diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals similarity index 100% rename from soc/common/nordic_nrf/Kconfig.peripherals rename to soc/arm/nordic_nrf/Kconfig.peripherals From 8e9fdde8ae2d908b7e8f461755b7a9f05dee9d53 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:20 +0100 Subject: [PATCH 1026/2300] Revert "[nrf fromtree] soc: common: nordic_nrf: move pinctrl_soc.h to a common dir" This reverts commit be2aca2863cf038f0669d5c790ba085e958795f9. Signed-off-by: Robert Lubos --- boards/posix/nrf_bsim/soc/pinctrl_soc.h | 2 +- soc/CMakeLists.txt | 2 -- .../nordic_nrf => arm/nordic_nrf/common}/pinctrl_soc.h | 0 soc/common/CMakeLists.txt | 4 ---- soc/common/nordic_nrf/CMakeLists.txt | 4 ---- 5 files changed, 1 insertion(+), 11 deletions(-) rename soc/{common/nordic_nrf => arm/nordic_nrf/common}/pinctrl_soc.h (100%) delete mode 100644 soc/common/CMakeLists.txt delete mode 100644 soc/common/nordic_nrf/CMakeLists.txt diff --git a/boards/posix/nrf_bsim/soc/pinctrl_soc.h b/boards/posix/nrf_bsim/soc/pinctrl_soc.h index f0be0443d5b..08252b57fee 100644 --- a/boards/posix/nrf_bsim/soc/pinctrl_soc.h +++ b/boards/posix/nrf_bsim/soc/pinctrl_soc.h @@ -8,6 +8,6 @@ #define BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H /* We reuse the real SOC's header: */ -#include "../soc/common/nordic_nrf/pinctrl_soc.h" +#include "../soc/arm/nordic_nrf/common/pinctrl_soc.h" #endif /* BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H */ diff --git a/soc/CMakeLists.txt b/soc/CMakeLists.txt index d55bd63f496..6706168281e 100644 --- a/soc/CMakeLists.txt +++ b/soc/CMakeLists.txt @@ -9,8 +9,6 @@ if(_SOC_IS_IN_TREE) endif() unset(_SOC_IS_IN_TREE) -add_subdirectory(common) - if(EXISTS ${SOC_DIR}/${ARCH}/CMakeLists.txt) add_subdirectory(${SOC_DIR}/${ARCH} soc/${ARCH}) else() diff --git a/soc/common/nordic_nrf/pinctrl_soc.h b/soc/arm/nordic_nrf/common/pinctrl_soc.h similarity index 100% rename from soc/common/nordic_nrf/pinctrl_soc.h rename to soc/arm/nordic_nrf/common/pinctrl_soc.h diff --git a/soc/common/CMakeLists.txt b/soc/common/CMakeLists.txt deleted file mode 100644 index d9abad218cd..00000000000 --- a/soc/common/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory_ifdef(CONFIG_SOC_FAMILY_NRF nordic_nrf) diff --git a/soc/common/nordic_nrf/CMakeLists.txt b/soc/common/nordic_nrf/CMakeLists.txt deleted file mode 100644 index 6f397a07fab..00000000000 --- a/soc/common/nordic_nrf/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -zephyr_include_directories(.) From ebd6f0ef075be7061caa94a4e5fc3e8bdc4148e7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:20 +0100 Subject: [PATCH 1027/2300] Revert "[nrf fromtree] scripts: kconfig: functions: add dt_chosen_partition_addr_int|hex" This reverts commit a6dabe9cd93f37002e2b147a57df0f0c608dd4c8. Signed-off-by: Robert Lubos --- scripts/kconfig/kconfigfunctions.py | 44 ----------------------------- 1 file changed, 44 deletions(-) diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py index 754a312ebb7..621ec3cb3a8 100644 --- a/scripts/kconfig/kconfigfunctions.py +++ b/scripts/kconfig/kconfigfunctions.py @@ -309,48 +309,6 @@ def dt_chosen_reg(kconf, name, chosen, index=0, unit=None): return hex(_dt_chosen_reg_addr(kconf, chosen, index, unit)) -def _dt_chosen_partition_addr(kconf, chosen, index=0, unit=None): - """ - This function takes a 'chosen' property and treats that property as a path - to an EDT node. If it finds an EDT node, it will look to see if that - node has a register, and if that node has a grandparent that has a register - at the given 'index'. The addition of both addresses will be returned, if - not, we return 0. - - The function will divide the value based on 'unit': - None No division - 'k' or 'K' divide by 1024 (1 << 10) - 'm' or 'M' divide by 1,048,576 (1 << 20) - 'g' or 'G' divide by 1,073,741,824 (1 << 30) - 'kb' or 'Kb' divide by 8192 (1 << 13) - 'mb' or 'Mb' divide by 8,388,608 (1 << 23) - 'gb' or 'Gb' divide by 8,589,934,592 (1 << 33) - """ - if doc_mode or edt is None: - return 0 - - node = edt.chosen_node(chosen) - if not node: - return 0 - - p_node = node.parent - if not p_node: - return 0 - - return _node_reg_addr(p_node.parent, index, unit) + _node_reg_addr(node, 0, unit) - - -def dt_chosen_partition_addr(kconf, name, chosen, index=0, unit=None): - """ - This function just routes to the proper function and converts - the result to either a string int or string hex value. - """ - if name == "dt_chosen_partition_addr_int": - return str(_dt_chosen_partition_addr(kconf, chosen, index, unit)) - if name == "dt_chosen_partition_addr_hex": - return hex(_dt_chosen_partition_addr(kconf, chosen, index, unit)) - - def _dt_node_reg_addr(kconf, path, index=0, unit=None): """ This function takes a 'path' and looks for an EDT node at that path. If it @@ -848,7 +806,5 @@ def shields_list_contains(kconf, _, shield): "dt_node_parent": (dt_node_parent, 1, 1), "dt_nodelabel_array_prop_has_val": (dt_nodelabel_array_prop_has_val, 3, 3), "dt_gpio_hogs_enabled": (dt_gpio_hogs_enabled, 0, 0), - "dt_chosen_partition_addr_int": (dt_chosen_partition_addr, 1, 3), - "dt_chosen_partition_addr_hex": (dt_chosen_partition_addr, 1, 3), "shields_list_contains": (shields_list_contains, 1, 1), } From 17d335a1049572856bbd056db68db3f998a6ac39 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:21 +0100 Subject: [PATCH 1028/2300] Revert "[nrf fromtree] modules: hal_nordic: add configuration for nRF54H PPR core" This reverts commit bf40cc299b5133b6d259fa72f6a460bc5550e5d8. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/nrfx_config.h | 2 - .../nrfx/nrfx_config_nrf54h20_enga_ppr.h | 1855 ----------------- modules/hal_nordic/nrfx/nrfx_glue.h | 23 +- 3 files changed, 3 insertions(+), 1877 deletions(-) delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 26d662be39d..be2f5599f78 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -748,8 +748,6 @@ #include #elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_RADIOCORE) #include -#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_PPR) - #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) #include #elif defined(NRF54L15_ENGA_XXAA) && defined(NRF_APPLICATION) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h deleted file mode 100644 index 369fe18a81f..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h +++ /dev/null @@ -1,1855 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54H20_ENGA_PPR_H__ -#define NRFX_CONFIG_NRF54H20_ENGA_PPR_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 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_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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 -#endif - -/** - * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e -#endif - -/** - * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 -#endif - -/** - * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 -#endif - -/** - * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 -#endif - -/** - * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 -#endif - -/** - * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df -#endif - -/** - * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf -#endif - -/** - * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e -#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 1 -#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_GPIOTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GPIOTE130_ENABLED -#define NRFX_GPIOTE130_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_NUM_OF_CC_CHANNELS - * - * Integer value. - */ -#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS -#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 2 -#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 0x000000c0 -#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_I2S130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S130_ENABLED -#define NRFX_I2S130_ENABLED 0 -#endif - -/** - * @brief NRFX_I2S131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S131_ENABLED -#define NRFX_I2S131_ENABLED 0 -#endif - -/** - * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#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_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_PRS_BOX_6_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_6_ENABLED -#define NRFX_PRS_BOX_6_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_7_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_7_ENABLED -#define NRFX_PRS_BOX_7_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_8_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_8_ENABLED -#define NRFX_PRS_BOX_8_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_9_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_9_ENABLED -#define NRFX_PRS_BOX_9_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_PWM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM120_ENABLED -#define NRFX_PWM120_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM130_ENABLED -#define NRFX_PWM130_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM131_ENABLED -#define NRFX_PWM131_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM132_ENABLED -#define NRFX_PWM132_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM133_ENABLED -#define NRFX_PWM133_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_QDEC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC130_ENABLED -#define NRFX_QDEC130_ENABLED 0 -#endif - -/** - * @brief NRFX_QDEC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC131_ENABLED -#define NRFX_QDEC131_ENABLED 0 -#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_RTC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC130_ENABLED -#define NRFX_RTC130_ENABLED 0 -#endif - -/** - * @brief NRFX_RTC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC131_ENABLED -#define NRFX_RTC131_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_SPIM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM120_ENABLED -#define NRFX_SPIM120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM121_ENABLED -#define NRFX_SPIM121_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM130_ENABLED -#define NRFX_SPIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM131_ENABLED -#define NRFX_SPIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM132_ENABLED -#define NRFX_SPIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM133_ENABLED -#define NRFX_SPIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM134_ENABLED -#define NRFX_SPIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM135_ENABLED -#define NRFX_SPIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM136_ENABLED -#define NRFX_SPIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM137_ENABLED -#define NRFX_SPIM137_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_SPIS120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS120_ENABLED -#define NRFX_SPIS120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS130_ENABLED -#define NRFX_SPIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS131_ENABLED -#define NRFX_SPIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS132_ENABLED -#define NRFX_SPIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS133_ENABLED -#define NRFX_SPIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS134_ENABLED -#define NRFX_SPIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS135_ENABLED -#define NRFX_SPIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS136_ENABLED -#define NRFX_SPIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS137_ENABLED -#define NRFX_SPIS137_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_TIMER120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER120_ENABLED -#define NRFX_TIMER120_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER121_ENABLED -#define NRFX_TIMER121_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER130_ENABLED -#define NRFX_TIMER130_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER131_ENABLED -#define NRFX_TIMER131_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER132_ENABLED -#define NRFX_TIMER132_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER133_ENABLED -#define NRFX_TIMER133_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER134_ENABLED -#define NRFX_TIMER134_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER135_ENABLED -#define NRFX_TIMER135_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER136_ENABLED -#define NRFX_TIMER136_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER137_ENABLED -#define NRFX_TIMER137_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_TWIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM130_ENABLED -#define NRFX_TWIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM131_ENABLED -#define NRFX_TWIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM132_ENABLED -#define NRFX_TWIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM133_ENABLED -#define NRFX_TWIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM134_ENABLED -#define NRFX_TWIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM135_ENABLED -#define NRFX_TWIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM136_ENABLED -#define NRFX_TWIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM137_ENABLED -#define NRFX_TWIM137_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_TWIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS130_ENABLED -#define NRFX_TWIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS131_ENABLED -#define NRFX_TWIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS132_ENABLED -#define NRFX_TWIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS133_ENABLED -#define NRFX_TWIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS134_ENABLED -#define NRFX_TWIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS135_ENABLED -#define NRFX_TWIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS136_ENABLED -#define NRFX_TWIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS137_ENABLED -#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE120_ENABLED -#define NRFX_UARTE120_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE130_ENABLED -#define NRFX_UARTE130_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE131_ENABLED -#define NRFX_UARTE131_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE132_ENABLED -#define NRFX_UARTE132_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE133_ENABLED -#define NRFX_UARTE133_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE134_ENABLED -#define NRFX_UARTE134_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE135_ENABLED -#define NRFX_UARTE135_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE136_ENABLED -#define NRFX_UARTE136_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE137_ENABLED -#define NRFX_UARTE137_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_WDT131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT131_ENABLED -#define NRFX_WDT131_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT132_ENABLED -#define NRFX_WDT132_ENABLED 0 -#endif - -#endif /* NRFX_CONFIG_NRF54H20_ENGA_PPR_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_glue.h b/modules/hal_nordic/nrfx/nrfx_glue.h index 748c5eafd47..c521461fe6b 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.h +++ b/modules/hal_nordic/nrfx/nrfx_glue.h @@ -42,11 +42,6 @@ extern "C" { #define NRFX_ASSERT(expression) __ASSERT_NO_MSG(expression) #endif -#if defined(CONFIG_RISCV) -/* included here due to dependency on NRFX_ASSERT definition */ -#include -#endif - /** * @brief Macro for placing a compile time assertion. * @@ -96,22 +91,14 @@ extern "C" { * * @param irq_number IRQ number. */ -#if defined(CONFIG_RISCV) -#define NRFX_IRQ_PENDING_SET(irq_number) nrf_vpr_clic_int_pending_set(NRF_VPRCLIC, irq_number) -#else -#define NRFX_IRQ_PENDING_SET(irq_number) NVIC_SetPendingIRQ(irq_number) -#endif +#define NRFX_IRQ_PENDING_SET(irq_number) NVIC_SetPendingIRQ(irq_number) /** * @brief Macro for clearing the pending status of a specific IRQ. * * @param irq_number IRQ number. */ -#if defined(CONFIG_RISCV) -#define NRFX_IRQ_PENDING_CLEAR(irq_number) nrf_vpr_clic_int_pending_clear(NRF_VPRCLIC, irq_number) -#else -#define NRFX_IRQ_PENDING_CLEAR(irq_number) NVIC_ClearPendingIRQ(irq_number) -#endif +#define NRFX_IRQ_PENDING_CLEAR(irq_number) NVIC_ClearPendingIRQ(irq_number) /** * @brief Macro for checking the pending status of a specific IRQ. @@ -119,11 +106,7 @@ extern "C" { * @retval true If the IRQ is pending. * @retval false Otherwise. */ -#if defined(CONFIG_RISCV) -#define NRFX_IRQ_IS_PENDING(irq_number) nrf_vpr_clic_int_pending_check(NRF_VPRCLIC, irq_number) -#else -#define NRFX_IRQ_IS_PENDING(irq_number) (NVIC_GetPendingIRQ(irq_number) == 1) -#endif +#define NRFX_IRQ_IS_PENDING(irq_number) (NVIC_GetPendingIRQ(irq_number) == 1) /** @brief Macro for entering into a critical section. */ #define NRFX_CRITICAL_SECTION_ENTER() { unsigned int irq_lock_key = irq_lock(); From fe0ce35ce540b3713a4eed4beb1ab573deb249c7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:21 +0100 Subject: [PATCH 1029/2300] Revert "[nrf fromtree] drivers: serial: nrfx_uarte2: drop soc.h" This reverts commit 7240cdfea4bca4bdeb85b1036e1972f036d2d8db. Signed-off-by: Robert Lubos --- drivers/serial/uart_nrfx_uarte2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index bfc770f1399..c27f33c7284 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include From 3ee75405c50f50fdaa5016a948966d4192bca835 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:21 +0100 Subject: [PATCH 1030/2300] Revert "[nrf fromtree] snippets: add nordic-ppr" This reverts commit 075318b3cb8ddbb0cbcc8f0fe31099bdb5e04164. Signed-off-by: Robert Lubos --- snippets/nordic-ppr/README.rst | 10 ---------- .../boards/nrf54h20pdk_nrf54h20_cpuapp.overlay | 12 ------------ snippets/nordic-ppr/nordic-ppr.overlay | 8 -------- snippets/nordic-ppr/snippet.yml | 8 -------- 4 files changed, 38 deletions(-) delete mode 100644 snippets/nordic-ppr/README.rst delete mode 100644 snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay delete mode 100644 snippets/nordic-ppr/nordic-ppr.overlay delete mode 100644 snippets/nordic-ppr/snippet.yml diff --git a/snippets/nordic-ppr/README.rst b/snippets/nordic-ppr/README.rst deleted file mode 100644 index 36eb74d193f..00000000000 --- a/snippets/nordic-ppr/README.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. _nordic-ppr: - -Nordic PPR snippet (nordic-ppr) -############################### - -Overview -******** - -This snippet allows users to build Zephyr with the capability to boot Nordic PPR -(Peripheral Processor) from another core. diff --git a/snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 75128f42a13..00000000000 --- a/snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuppr_ram3x_region { - status = "okay"; -}; - -&uart135 { - status = "reserved"; -}; diff --git a/snippets/nordic-ppr/nordic-ppr.overlay b/snippets/nordic-ppr/nordic-ppr.overlay deleted file mode 100644 index e33885fc10d..00000000000 --- a/snippets/nordic-ppr/nordic-ppr.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuppr_vpr { - status = "okay"; -}; diff --git a/snippets/nordic-ppr/snippet.yml b/snippets/nordic-ppr/snippet.yml deleted file mode 100644 index 9e1f20bb757..00000000000 --- a/snippets/nordic-ppr/snippet.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: nordic-ppr -append: - EXTRA_DTC_OVERLAY_FILE: nordic-ppr.overlay - -boards: - nrf54h20pdk_nrf54h20_cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20pdk_nrf54h20_cpuapp.overlay From 5b85251d25709acfb78f89f8c4c89d6b2512cd35 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:21 +0100 Subject: [PATCH 1031/2300] Revert "[nrf fromtree] drivers: misc: nordic_vpr_launcher: initial version" This reverts commit de79ed64536275b9f6f5841c41c1b4fb82f2a2e7. Signed-off-by: Robert Lubos --- drivers/misc/CMakeLists.txt | 1 - drivers/misc/Kconfig | 1 - .../misc/nordic_vpr_launcher/CMakeLists.txt | 5 -- drivers/misc/nordic_vpr_launcher/Kconfig | 24 ------- .../nordic_vpr_launcher/nordic_vpr_launcher.c | 71 ------------------- 5 files changed, 102 deletions(-) delete mode 100644 drivers/misc/nordic_vpr_launcher/CMakeLists.txt delete mode 100644 drivers/misc/nordic_vpr_launcher/Kconfig delete mode 100644 drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c diff --git a/drivers/misc/CMakeLists.txt b/drivers/misc/CMakeLists.txt index c23bdb185de..6c4ec2384d9 100644 --- a/drivers/misc/CMakeLists.txt +++ b/drivers/misc/CMakeLists.txt @@ -7,4 +7,3 @@ add_subdirectory_ifdef(CONFIG_PIO_RPI_PICO pio_rpi_pico) add_subdirectory_ifdef(CONFIG_NXP_S32_EMIOS nxp_s32_emios) add_subdirectory_ifdef(CONFIG_TIMEAWARE_GPIO timeaware_gpio) add_subdirectory_ifdef(CONFIG_DEVMUX devmux) -add_subdirectory_ifdef(CONFIG_NORDIC_VPR_LAUNCHER nordic_vpr_launcher) diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 3511b8b6fd4..52c77b4c7ec 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -11,6 +11,5 @@ source "drivers/misc/pio_rpi_pico/Kconfig" source "drivers/misc/nxp_s32_emios/Kconfig" source "drivers/misc/timeaware_gpio/Kconfig" source "drivers/misc/devmux/Kconfig" -source "drivers/misc/nordic_vpr_launcher/Kconfig" endmenu diff --git a/drivers/misc/nordic_vpr_launcher/CMakeLists.txt b/drivers/misc/nordic_vpr_launcher/CMakeLists.txt deleted file mode 100644 index 70c84e84217..00000000000 --- a/drivers/misc/nordic_vpr_launcher/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() -zephyr_library_sources(nordic_vpr_launcher.c) diff --git a/drivers/misc/nordic_vpr_launcher/Kconfig b/drivers/misc/nordic_vpr_launcher/Kconfig deleted file mode 100644 index 57605e505f2..00000000000 --- a/drivers/misc/nordic_vpr_launcher/Kconfig +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config NORDIC_VPR_LAUNCHER - bool "Nordic VPR coprocessor launcher" - default y - depends on DT_HAS_NORDIC_NRF_VPR_COPROCESSOR_ENABLED - help - When enabled, the VPR coprocessors will be automatically launched - during system initialization. - -if NORDIC_VPR_LAUNCHER - -module = NORDIC_VPR_LAUNCHER -module-str = Nordic VPR Launcher -source "subsys/logging/Kconfig.template.log_config" - -config NORDIC_VPR_LAUNCHER_INIT_PRIORITY - int "Nordic VPR coprocessor launcher init priority" - default KERNEL_INIT_PRIORITY_DEVICE - help - The init priority of the VPR coprocessor launcher. - -endif # NORDIC_VPR_LAUNCHER diff --git a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c deleted file mode 100644 index 161465ba02c..00000000000 --- a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT nordic_nrf_vpr_coprocessor - -#include - -#include -#include -#include -#include -#include - -#include - -LOG_MODULE_REGISTER(nordic_vpr_launcher, CONFIG_NORDIC_VPR_LAUNCHER_LOG_LEVEL); - -struct nordic_vpr_launcher_config { - NRF_VPR_Type *vpr; - uintptr_t exec_addr; -#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory) - uintptr_t src_addr; - size_t src_size; -#endif -}; - -static int nordic_vpr_launcher_init(const struct device *dev) -{ - const struct nordic_vpr_launcher_config *config = dev->config; - -#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory) - if (config->src_size > 0U) { - LOG_DBG("Loading VPR (%p) from %p to %p (%zu bytes)", config->vpr, - (void *)config->src_addr, (void *)config->exec_addr, config->src_size); - memcpy((void *)config->exec_addr, (void *)config->src_addr, config->src_size); - } -#endif - - LOG_DBG("Launching VPR (%p) from %p", config->vpr, (void *)config->exec_addr); - nrf_vpr_initpc_set(config->vpr, config->exec_addr); - nrf_vpr_cpurun_set(config->vpr, true); - - return 0; -} - -/* obtain VPR source address either from memory or partition */ -#define VPR_SRC_ADDR(node_id) \ - (DT_REG_ADDR(node_id) + \ - COND_CODE_0(DT_FIXED_PARTITION_EXISTS(node_id), (0), (DT_REG_ADDR(DT_GPARENT(node_id))))) - -#define NORDIC_VPR_LAUNCHER_DEFINE(inst) \ - COND_CODE_1(DT_NODE_HAS_PROP(inst, source_memory), \ - (BUILD_ASSERT((DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)) == \ - DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory))), \ - "Source/execution memory sizes mismatch");), \ - ()) \ - \ - static const struct nordic_vpr_launcher_config config##inst = { \ - .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ - .exec_addr = DT_REG_ADDR(DT_INST_PHANDLE(inst, execution_memory)), \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, source_memory), \ - (.src_addr = VPR_SRC_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ - .src_size = DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory)),), \ - ())}; \ - \ - DEVICE_DT_INST_DEFINE(inst, nordic_vpr_launcher_init, NULL, NULL, &config##inst, \ - POST_KERNEL, CONFIG_NORDIC_VPR_LAUNCHER_INIT_PRIORITY, NULL); - -DT_INST_FOREACH_STATUS_OKAY(NORDIC_VPR_LAUNCHER_DEFINE) From 2c66b80eb9efd4537697c1d350e082626fab8c54 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:22 +0100 Subject: [PATCH 1032/2300] Revert "[nrf fromtree] device: add braces around dev/dev_rw initializer" This reverts commit f678f1e09b39345ba8e48d1bf69afa564fa4b849. Signed-off-by: Robert Lubos --- include/zephyr/device.h | 5 +---- include/zephyr/init.h | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/zephyr/device.h b/include/zephyr/device.h index c55958924ff..77c0537ffdf 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -974,10 +974,7 @@ static inline bool z_impl_device_is_ready(const struct device *dev) Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \ .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \ (init_fn_)}, \ - { \ - COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \ - &DEVICE_NAME_GET(dev_id), \ - }, \ + .dev = &DEVICE_NAME_GET(dev_id), \ } /** diff --git a/include/zephyr/init.h b/include/zephyr/init.h index 78ec454f27c..7882b207b8d 100644 --- a/include/zephyr/init.h +++ b/include/zephyr/init.h @@ -205,7 +205,10 @@ struct init_entry { #define SYS_INIT_NAMED(name, init_fn_, level, prio) \ static const Z_DECL_ALIGN(struct init_entry) \ Z_INIT_ENTRY_SECTION(level, prio, 0) __used __noasan \ - Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}} + Z_INIT_ENTRY_NAME(name) = { \ + .init_fn = {.sys = (init_fn_)}, \ + .dev = NULL, \ + } /** @} */ From ee5ef97719f1f30491875e40a2866a7455cda8fb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:22 +0100 Subject: [PATCH 1033/2300] Revert "[nrf fromtree] tests: drivers: console: add console_switching test" This reverts commit 7cd3905c5307dfd7581afc681ab8cf2a36e9ca83. Signed-off-by: Robert Lubos --- .../drivers/console_switching/CMakeLists.txt | 9 -- .../boards/qemu_riscv64.overlay | 39 ------ tests/drivers/console_switching/prj.conf | 9 -- tests/drivers/console_switching/src/main.c | 124 ------------------ tests/drivers/console_switching/testcase.yaml | 16 --- 5 files changed, 197 deletions(-) delete mode 100644 tests/drivers/console_switching/CMakeLists.txt delete mode 100644 tests/drivers/console_switching/boards/qemu_riscv64.overlay delete mode 100644 tests/drivers/console_switching/prj.conf delete mode 100644 tests/drivers/console_switching/src/main.c delete mode 100644 tests/drivers/console_switching/testcase.yaml diff --git a/tests/drivers/console_switching/CMakeLists.txt b/tests/drivers/console_switching/CMakeLists.txt deleted file mode 100644 index 3ba70cc081e..00000000000 --- a/tests/drivers/console_switching/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(uart_console_switching) - -target_sources(app PRIVATE - src/main.c - ) diff --git a/tests/drivers/console_switching/boards/qemu_riscv64.overlay b/tests/drivers/console_switching/boards/qemu_riscv64.overlay deleted file mode 100644 index 47bd7945189..00000000000 --- a/tests/drivers/console_switching/boards/qemu_riscv64.overlay +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2023, Meta - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,console = &devmux0; - zephyr,shell_uart = &devmux0; - }; - - euart0: uart_emul0 { - compatible = "zephyr,uart-emul"; - current-speed = <0>; - status = "okay"; - }; - - euart1: uart_emul1 { - compatible = "zephyr,uart-emul"; - current-speed = <0>; - status = "okay"; - }; - - devmux0: dev_mux_0 { - compatible = "zephyr,devmux"; - devices = <&uart0 &euart0 &euart1>; - zephyr,mutable; - status = "okay"; - }; - - devmux1: dev_mux_1 { - compatible = "zephyr,devmux"; - devices = <&uart0 &euart0 &euart1>; - zephyr,mutable; - selected = <2>; - status = "okay"; - }; -}; diff --git a/tests/drivers/console_switching/prj.conf b/tests/drivers/console_switching/prj.conf deleted file mode 100644 index fcdd67928c4..00000000000 --- a/tests/drivers/console_switching/prj.conf +++ /dev/null @@ -1,9 +0,0 @@ -CONFIG_ZTEST=y -CONFIG_ZTEST_NEW_API=y -CONFIG_SERIAL=y -CONFIG_CONSOLE=y -CONFIG_CONSOLE_SUBSYS=y -CONFIG_CONSOLE_GETLINE=y -CONFIG_DEVICE_MUTABLE=y -CONFIG_DEVMUX=y -CONFIG_UART_EMUL=y diff --git a/tests/drivers/console_switching/src/main.c b/tests/drivers/console_switching/src/main.c deleted file mode 100644 index 95cde150c9b..00000000000 --- a/tests/drivers/console_switching/src/main.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2023, Meta - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -#define BUF_SIZE 32 - -/* array of const struct device* */ -#define PHANDLE_TO_DEVICE(node_id, prop, idx) DEVICE_DT_GET(DT_PHANDLE_BY_IDX(node_id, prop, idx)) -static const struct device *devs[] = { - DT_FOREACH_PROP_ELEM_SEP(DT_NODELABEL(devmux0), devices, PHANDLE_TO_DEVICE, (,))}; - -/* array of names, e.g. "euart0" */ -#define PHANDLE_TO_NAME(node_id, prop, idx) DT_NODE_FULL_NAME(DT_PHANDLE_BY_IDX(node_id, prop, idx)) -static const char *const name[] = { - DT_FOREACH_PROP_ELEM_SEP(DT_NODELABEL(devmux0), devices, PHANDLE_TO_NAME, (,))}; - -/* array of greetings, e.g. "Hello, euart0!" */ -#define PHANDLE_TO_TEXT(node_id, prop, idx) \ - "Hello, " DT_NODE_FULL_NAME(DT_PHANDLE_BY_IDX(node_id, prop, idx)) "!" -static const char *const text[] = { - DT_FOREACH_PROP_ELEM_SEP(DT_NODELABEL(devmux0), devices, PHANDLE_TO_TEXT, (,))}; - -ZTEST(console_switching, test_write) -{ - size_t normal_uart = DT_PROP(DT_NODELABEL(devmux0), selected); - struct device *const devmux_dev = DEVICE_DT_GET(DT_NODELABEL(devmux0)); - - /* for each uart_emul device */ - for (size_t i = 0, j = 0, N = ARRAY_SIZE(devs); i < 2 * N; i++, j++, j %= N) { - if (j == normal_uart) { - /* skip testing non-emul uart */ - continue; - } - - int ret[4]; - char buf[BUF_SIZE] = {0}; - - /* write text[j] to dev[j] */ - ret[0] = devmux_select_set(devmux_dev, j); - printk("%s", text[j]); - ret[1] = uart_emul_get_tx_data(devs[j], buf, ARRAY_SIZE(buf)); - ret[2] = devmux_select_set(devmux_dev, normal_uart); - - zassert_ok(ret[0], "Failed to select devmux %zu", j); - zassert_ok(ret[2], "Switching back to selection %zu failed", normal_uart); - - /* verify that text[j] was written to dev[j] */ - TC_PRINT("wrote '%s' to %s\n", buf, name[j]); - - zassert_equal(ret[1], strlen(text[j]), "Only wrote %zu/%zu bytes of '%s'", - ret[1], strlen(text[j]), text[j]); - zassert_equal(0, strcmp(text[j], buf), "Strings '%s' and '%s' do not match", - text[j], buf); - } -} - -ZTEST(console_switching, test_read) -{ - size_t normal_uart = DT_PROP(DT_NODELABEL(devmux0), selected); - struct device *const devmux_dev = DEVICE_DT_GET(DT_NODELABEL(devmux0)); - - /* for each uart_emul device */ - for (size_t i = 0, j = 0, N = ARRAY_SIZE(devs); i < 2 * N; i++, j++, j %= N) { - if (j == normal_uart) { - /* skip testing non-emul uart */ - continue; - } - - int ret[4]; - char buf[BUF_SIZE] = {0}; - - /* read text[j] from dev[j] */ - ret[0] = devmux_select_set(devmux_dev, j); - console_getline_init(); - ret[1] = uart_emul_put_rx_data(devs[j], (uint8_t *)text[j], strlen(text[j])); - ret[3] = uart_emul_put_rx_data(devs[j], "\n", 1); - snprintf(buf, BUF_SIZE, "%s", console_getline()); - ret[2] = devmux_select_set(devmux_dev, normal_uart); - - zassert_ok(ret[0], "Failed to select devmux %zu", j); - zassert_ok(ret[2], "Switching back to selection %zu failed", normal_uart); - - /* verify that text[j] was written to dev[j] */ - TC_PRINT("read '%s' from %s\n", buf, name[j]); - - zassert_equal(ret[1], strlen(text[j]), "Only put %zu/%zu bytes of '%s'", - ret[1], strlen(text[j]), text[j]); - zassert_equal(0, strcmp(text[j], buf), "Strings '%s' and '%s' do not match", - text[j], buf); - } -} - -static void *setup(void) -{ - size_t selected = DT_PROP(DT_NODELABEL(devmux1), selected); - struct device *const devmux_dev = DEVICE_DT_GET(DT_NODELABEL(devmux1)); - - /* ensure that non-default initial selection via DT works */ - zassert_equal(devmux_select_get(devmux_dev), selected); - - return NULL; -} - -static void before(void *arg) -{ - struct device *const devmux_dev = DEVICE_DT_GET(DT_NODELABEL(devmux0)); - - zassert_ok(devmux_select_set(devmux_dev, 0)); - zassert_ok(devmux_select_get(devmux_dev)); - - for (size_t i = 1; i < ARRAY_SIZE(devs); ++i) { - uart_emul_flush_tx_data(devs[i]); - } -} - -ZTEST_SUITE(console_switching, NULL, setup, before, NULL, NULL); diff --git a/tests/drivers/console_switching/testcase.yaml b/tests/drivers/console_switching/testcase.yaml deleted file mode 100644 index 0d24b5e596e..00000000000 --- a/tests/drivers/console_switching/testcase.yaml +++ /dev/null @@ -1,16 +0,0 @@ -common: - tags: - - drivers - - console - - emul - platform_allow: - - qemu_riscv64 - integration_platforms: - - qemu_riscv64 - -tests: - drivers.console_switching: {} - drivers.console_switching.user: - tags: userspace - extra_configs: - - CONFIG_USERSPACE=y From d4ed1969fd2e918515366d40dab76256debf0f7e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:22 +0100 Subject: [PATCH 1034/2300] Revert "[nrf fromtree] drivers: misc: devmux: a device multiplexer pseudo-device" This reverts commit a096f3cdf48389826ee52933922b10cdecbb65f3. Signed-off-by: Robert Lubos --- drivers/misc/CMakeLists.txt | 1 - drivers/misc/Kconfig | 1 - drivers/misc/devmux/CMakeLists.txt | 10 -- drivers/misc/devmux/Kconfig | 23 --- drivers/misc/devmux/devmux.c | 179 -------------------- dts/bindings/misc/zephyr,devmux.yaml | 33 ---- include/zephyr/drivers/misc/devmux/devmux.h | 90 ---------- 7 files changed, 337 deletions(-) delete mode 100644 drivers/misc/devmux/CMakeLists.txt delete mode 100644 drivers/misc/devmux/Kconfig delete mode 100644 drivers/misc/devmux/devmux.c delete mode 100644 dts/bindings/misc/zephyr,devmux.yaml delete mode 100644 include/zephyr/drivers/misc/devmux/devmux.h diff --git a/drivers/misc/CMakeLists.txt b/drivers/misc/CMakeLists.txt index 6c4ec2384d9..863f839184e 100644 --- a/drivers/misc/CMakeLists.txt +++ b/drivers/misc/CMakeLists.txt @@ -6,4 +6,3 @@ add_subdirectory_ifdef(CONFIG_GROVE_LCD_RGB grove_lcd_rgb) add_subdirectory_ifdef(CONFIG_PIO_RPI_PICO pio_rpi_pico) add_subdirectory_ifdef(CONFIG_NXP_S32_EMIOS nxp_s32_emios) add_subdirectory_ifdef(CONFIG_TIMEAWARE_GPIO timeaware_gpio) -add_subdirectory_ifdef(CONFIG_DEVMUX devmux) diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 52c77b4c7ec..66d83fc693d 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -10,6 +10,5 @@ source "drivers/misc/grove_lcd_rgb/Kconfig" source "drivers/misc/pio_rpi_pico/Kconfig" source "drivers/misc/nxp_s32_emios/Kconfig" source "drivers/misc/timeaware_gpio/Kconfig" -source "drivers/misc/devmux/Kconfig" endmenu diff --git a/drivers/misc/devmux/CMakeLists.txt b/drivers/misc/devmux/CMakeLists.txt deleted file mode 100644 index 94f74ea57ce..00000000000 --- a/drivers/misc/devmux/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2023, Meta -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() - -zephyr_syscall_header( - ${ZEPHYR_BASE}/include/zephyr/drivers/misc/devmux/devmux.h -) - -zephyr_library_sources(devmux.c) diff --git a/drivers/misc/devmux/Kconfig b/drivers/misc/devmux/Kconfig deleted file mode 100644 index 4f848b4e06c..00000000000 --- a/drivers/misc/devmux/Kconfig +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2023, Meta -# SPDX-License-Identifier: Apache-2.0 - -config DEVMUX - bool "Device Multiplexer (devmux) [EXPERIMENTAL]" - depends on DT_HAS_ZEPHYR_DEVMUX_ENABLED - depends on DEVICE_MUTABLE - select EXPERIMENTAL - help - Devmux is a pseudo-device that operates as a device switch. It allows - software to select the data, config, and api from a number of linked - devices. - -if DEVMUX - -config DEVMUX_INIT_PRIORITY - int "Devmux init priority" - default 51 - help - Init priority for the devmux driver. It must be - greater than the priority of the initially selected muxed device. - -endif diff --git a/drivers/misc/devmux/devmux.c b/drivers/misc/devmux/devmux.c deleted file mode 100644 index 653236f903d..00000000000 --- a/drivers/misc/devmux/devmux.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2023, Meta - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT zephyr_devmux - -#include -#include -#include -#include - -struct devmux_config { - const struct device **devs; - const size_t n_devs; -}; - -struct devmux_data { - struct k_spinlock lock; - size_t selected; -}; - -/* The number of devmux devices */ -#define N DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) - -static const struct device *devmux_devices[N]; -static const struct devmux_config *devmux_configs[N]; -static struct devmux_data *devmux_datas[N]; - -static bool devmux_device_is_valid(const struct device *dev) -{ - for (size_t i = 0; i < N; ++i) { - if (dev == devmux_devices[i]) { - return true; - } - } - - return false; -} - -static size_t devmux_inst_get(const struct device *dev) -{ - for (size_t i = 0; i < N; i++) { - if (dev == devmux_devices[i]) { - return i; - } - } - - return SIZE_MAX; -} - -const struct devmux_config *devmux_config_get(const struct device *dev) -{ - for (size_t i = 0; i < N; i++) { - if (dev == devmux_devices[i]) { - return devmux_configs[i]; - } - } - - return NULL; -} - -struct devmux_data *devmux_data_get(const struct device *dev) -{ - for (size_t i = 0; i < N; i++) { - if (dev == devmux_devices[i]) { - return devmux_datas[i]; - } - } - - return NULL; -} - -ssize_t z_impl_devmux_select_get(const struct device *dev) -{ - ssize_t index; - struct devmux_data *const data = devmux_data_get(dev); - - if (!devmux_device_is_valid(dev)) { - return -EINVAL; - } - - K_SPINLOCK(&data->lock) - { - index = data->selected; - } - - return index; -} - -#ifdef CONFIG_USERSPACE -ssize_t z_vrfy_devmux_select_get(const struct device *dev) -{ - return z_impl_devmux_select_get(dev); -} -#include -#endif - -int z_impl_devmux_select_set(struct device *dev, size_t index) -{ - struct devmux_data *const data = devmux_data_get(dev); - const struct devmux_config *config = devmux_config_get(dev); - - if (!devmux_device_is_valid(dev) || index >= config->n_devs) { - return -EINVAL; - } - - if (!device_is_ready(config->devs[index])) { - return -ENODEV; - } - - K_SPINLOCK(&data->lock) - { - *dev = *config->devs[index]; - data->selected = index; - } - - return 0; -} - -#ifdef CONFIG_USERSPACE -int z_vrfy_devmux_select_set(struct device *dev, size_t index) -{ - return z_impl_devmux_select_set(dev, index); -} -#include -#endif - -static int devmux_init(struct device *const dev) -{ - size_t inst = devmux_inst_get(dev); - struct devmux_data *const data = dev->data; - const struct devmux_config *config = dev->config; - size_t sel = data->selected; - - devmux_configs[inst] = config; - devmux_datas[inst] = data; - - if (!device_is_ready(config->devs[sel])) { - return -ENODEV; - } - - *dev = *config->devs[sel]; - - return 0; -} - -#define DEVMUX_PHANDLE_TO_DEVICE(node_id, prop, idx) \ - DEVICE_DT_GET(DT_PHANDLE_BY_IDX(node_id, prop, idx)) - -#define DEVMUX_PHANDLE_DEVICES(_n) \ - DT_INST_FOREACH_PROP_ELEM_SEP(_n, devices, DEVMUX_PHANDLE_TO_DEVICE, (,)) - -#define DEVMUX_SELECTED(_n) DT_INST_PROP(_n, selected) - -#define DEVMUX_DEFINE(_n) \ - BUILD_ASSERT(DT_INST_PROP_OR(_n, zephyr_mutable, 0), \ - "devmux nodes must contain the 'zephyr,mutable' property"); \ - BUILD_ASSERT(DT_INST_PROP_LEN(_n, devices) > 0, "devices array must have non-zero size"); \ - BUILD_ASSERT(DEVMUX_SELECTED(_n) >= 0, "selected must be > 0"); \ - BUILD_ASSERT(DEVMUX_SELECTED(_n) < DT_INST_PROP_LEN(_n, devices), \ - "selected must be within bounds of devices phandle array"); \ - static const struct device *demux_devs_##_n[] = {DEVMUX_PHANDLE_DEVICES(_n)}; \ - static const struct devmux_config devmux_config_##_n = { \ - .devs = demux_devs_##_n, \ - .n_devs = DT_INST_PROP_LEN(_n, devices), \ - }; \ - static struct devmux_data devmux_data_##_n = { \ - .selected = DEVMUX_SELECTED(_n), \ - }; \ - \ - DEVICE_DT_INST_DEFINE(_n, devmux_init, NULL, &devmux_data_##_n, &devmux_config_##_n, \ - PRE_KERNEL_1, CONFIG_DEVMUX_INIT_PRIORITY, NULL); - -DT_INST_FOREACH_STATUS_OKAY(DEVMUX_DEFINE) - -#define DEVMUX_DEVICE_GET(_n) DEVICE_DT_INST_GET(_n), -static const struct device *devmux_devices[] = {DT_INST_FOREACH_STATUS_OKAY(DEVMUX_DEVICE_GET)}; diff --git a/dts/bindings/misc/zephyr,devmux.yaml b/dts/bindings/misc/zephyr,devmux.yaml deleted file mode 100644 index 744daaca120..00000000000 --- a/dts/bindings/misc/zephyr,devmux.yaml +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2023, Meta -# SPDX-License-Identifier: Apache-2.0 - -description: Generic Device Multiplexer - -compatible: "zephyr,devmux" - -include: [base.yaml, mutable.yaml] - -properties: - - devices: - type: phandles - required: true - description: | - Devices to be multiplexed. - - selected: - type: int - default: 0 - description: | - Initial multiplexer selection. - - This must be in the range [0, N-1], where N is the length of the - 'devices' phandle list. - - If unspecified, the default selection is zero in order to ensure that - the multiplexer is ready for use (i.e. one of the [0, N-1] multiplexed - devices is selected). Zero is, necessarily, the only possible valid - default value since the phandle list must have length >= 1. - - Note: Specifying a value of 'selected' outside the range [0, N-1] - results in a compile-time error. diff --git a/include/zephyr/drivers/misc/devmux/devmux.h b/include/zephyr/drivers/misc/devmux/devmux.h deleted file mode 100644 index 1772d719d96..00000000000 --- a/include/zephyr/drivers/misc/devmux/devmux.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2023, Meta - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief Public APIs for the Device Multiplexer driver - */ - -#ifndef INCLUDE_ZEPHYR_DRIVERS_MISC_DEVMUX_H_ -#define INCLUDE_ZEPHYR_DRIVERS_MISC_DEVMUX_H_ - -#include - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Devmux Driver APIs - * @defgroup demux_interface Devmux Driver APIs - * @ingroup misc_interfaces - * - * @details - * Devmux operates as a device multiplexer, forwarding the characteristics of - * the selected device. - * - * ``` - * +----------+ +----------+ - * | devmux | | devmux | - * | | | | - * dev0 | | dev0 | | - * +----------> \ | +----------> | - * | \ | | | - * dev1 | \ | dev0 dev1 | | dev2 - * +----------> O +----------> +----------> O +----------> - * | | | / | - * dev2 | | dev2 | / | - * +----------> | +----------> / | - * | | | | - * | | | | - * | | | | - * +-----^----+ +-----^----+ - * | | - * select == 0 | select == 2 | - * +--------------+ +---------------+ - * ``` - * @{ - */ - -/** - * @brief Get the current selection of a devmux device. - * - * Return the index of the currently selected device. - * - * @param dev the devmux device - * @return The index (>= 0) of the currently active multiplexed device on success - * @retval -EINVAL If @p dev is invalid - */ -__syscall ssize_t devmux_select_get(const struct device *dev); - -/** - * @brief Set the selection of a devmux device. - * - * Select the device at @p index. - * - * @param[in] dev the devmux device - * @param index the index representing the desired selection - * @retval 0 On success - * @retval -EINVAL If @p dev is invalid - * @retval -ENODEV If the multiplexed device at @p index is not ready - */ -__syscall int devmux_select_set(struct device *dev, size_t index); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#include - -#endif /* INCLUDE_ZEPHYR_DRIVERS_MISC_DEVMUX_H_ */ From e1b213986195e8a68752ada36bde4cb78e80e78b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:22 +0100 Subject: [PATCH 1035/2300] Revert "[nrf fromtree] device: support for mutable devices" This reverts commit 1b794d8227078d95098b12e695d29e44fb6cd538. Signed-off-by: Robert Lubos --- cmake/linker_script/common/common-ram.cmake | 4 --- dts/bindings/base/mutable.yaml | 13 ------- include/zephyr/device.h | 40 +++++++++------------ include/zephyr/init.h | 18 +--------- include/zephyr/linker/common-ram.ld | 4 --- kernel/Kconfig | 7 ---- 6 files changed, 18 insertions(+), 68 deletions(-) delete mode 100644 dts/bindings/base/mutable.yaml diff --git a/cmake/linker_script/common/common-ram.cmake b/cmake/linker_script/common/common-ram.cmake index 7e639043bce..a116977ce8c 100644 --- a/cmake/linker_script/common/common-ram.cmake +++ b/cmake/linker_script/common/common-ram.cmake @@ -128,7 +128,3 @@ if(CONFIG_USB_HOST_STACK) zephyr_iterable_section(NAME usbh_contex GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) zephyr_iterable_section(NAME usbh_class_data GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) endif() - -if(CONFIG_DEVICE_MUTABLE) - zephyr_iterable_section(NAME device_mutable GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) -endif() diff --git a/dts/bindings/base/mutable.yaml b/dts/bindings/base/mutable.yaml deleted file mode 100644 index 0e2d1cad3b0..00000000000 --- a/dts/bindings/base/mutable.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2023, Meta -# SPDX-License-Identifier: Apache-2.0 - -# Properties for Mutable devices - -properties: - zephyr,mutable: - type: boolean - description: | - True iff the device structure may be mutated. - - Inherit this binding for devices that are runtime-modifiable, in-place. - This places the device structure into SRAM rather than Flash. diff --git a/include/zephyr/device.h b/include/zephyr/device.h index 77c0537ffdf..630a059c155 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -41,10 +41,6 @@ extern "C" { */ #define Z_DEVICE_DEPS_ENDS INT16_MAX -/** @brief Determine if a DT node is mutable */ -#define Z_DEVICE_IS_MUTABLE(node_id) \ - COND_CODE_1(IS_ENABLED(CONFIG_DEVICE_MUTABLE), (DT_PROP(node_id, zephyr_mutable)), (0)) - /** @endcond */ /** @@ -928,13 +924,12 @@ static inline bool z_impl_device_is_ready(const struct device *dev) * @param api Reference to device API. * @param ... Optional dependencies, manually specified. */ -#define Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, prio, api, state, \ - deps) \ - COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \ - COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), (const)) \ - STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE( \ - device, COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (device_mutable), (device)), \ - Z_DEVICE_SECTION_NAME(level, prio), DEVICE_NAME_GET(dev_id)) = \ +#define Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, \ + prio, api, state, deps) \ + COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \ + const STRUCT_SECTION_ITERABLE_NAMED(device, \ + Z_DEVICE_SECTION_NAME(level, prio), \ + DEVICE_NAME_GET(dev_id)) = \ Z_DEVICE_INIT(name, pm, data, config, api, state, deps) /* deprecated device initialization levels */ @@ -966,15 +961,15 @@ static inline bool z_impl_device_is_ready(const struct device *dev) * @param level Initialization level. * @param prio Initialization priority. */ -#define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_, level, prio) \ - Z_DEVICE_LEVEL_CHECK_DEPRECATED_LEVEL(level) \ - \ - static const Z_DECL_ALIGN(struct init_entry) __used __noasan Z_INIT_ENTRY_SECTION( \ - level, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \ - Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \ - .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \ - (init_fn_)}, \ - .dev = &DEVICE_NAME_GET(dev_id), \ +#define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_, level, prio) \ + Z_DEVICE_LEVEL_CHECK_DEPRECATED_LEVEL(level) \ + \ + static const Z_DECL_ALIGN(struct init_entry) __used __noasan \ + Z_INIT_ENTRY_SECTION(level, prio, \ + Z_DEVICE_INIT_SUB_PRIO(node_id)) \ + Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \ + .init_fn = {.dev = (init_fn_)}, \ + .dev = &DEVICE_NAME_GET(dev_id), \ } /** @@ -1020,9 +1015,8 @@ static inline bool z_impl_device_is_ready(const struct device *dev) * don't have a corresponding @ref device allocated. There's no way to figure * that out until after we've built the zephyr image, though. */ -#define Z_MAYBE_DEVICE_DECLARE_INTERNAL(node_id) \ - extern COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (), \ - (const)) struct device DEVICE_DT_NAME_GET(node_id); +#define Z_MAYBE_DEVICE_DECLARE_INTERNAL(node_id) \ + extern const struct device DEVICE_DT_NAME_GET(node_id); DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_DEVICE_DECLARE_INTERNAL) diff --git a/include/zephyr/init.h b/include/zephyr/init.h index 7882b207b8d..9b0d2993d62 100644 --- a/include/zephyr/init.h +++ b/include/zephyr/init.h @@ -73,17 +73,6 @@ union init_function { * @retval -errno If device initialization fails. */ int (*dev)(const struct device *dev); -#ifdef CONFIG_DEVICE_MUTABLE - /** - * Device initialization function (rw). - * - * @param dev Device instance. - * - * @retval 0 On success - * @retval -errno If device initialization fails. - */ - int (*dev_rw)(struct device *dev); -#endif }; /** @@ -107,12 +96,7 @@ struct init_entry { * If the init entry belongs to a device, this fields stores a * reference to it, otherwise it is set to NULL. */ - union { - const struct device *dev; -#ifdef CONFIG_DEVICE_MUTABLE - struct device *dev_rw; -#endif - }; + const struct device *dev; }; /** @cond INTERNAL_HIDDEN */ diff --git a/include/zephyr/linker/common-ram.ld b/include/zephyr/linker/common-ram.ld index 7bb6e55f1c1..c03351abf98 100644 --- a/include/zephyr/linker/common-ram.ld +++ b/include/zephyr/linker/common-ram.ld @@ -137,10 +137,6 @@ ITERABLE_SECTION_RAM(zbus_channel_observation_mask, 1) #endif /* CONFIG_ZBUS */ -#if defined(CONFIG_DEVICE_MUTABLE) - ITERABLE_SECTION_RAM(device_mutable, 4) -#endif - #ifdef CONFIG_USERSPACE _static_kernel_objects_end = .; #endif diff --git a/kernel/Kconfig b/kernel/Kconfig index d5e737e7655..6280e80a400 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -1260,13 +1260,6 @@ config DEVICE_DEPS_DYNAMIC Option that makes it possible to manipulate device dependencies at runtime. -config DEVICE_MUTABLE - bool "Mutable devices [EXPERIMENTAL]" - select EXPERIMENTAL - help - Support mutable devices. Mutable devices are instantiated in SRAM - instead of Flash and are runtime modifiable in kernel mode. - endmenu rsource "Kconfig.vm" From 940e2c39e4302371b978c9380aea7436a1d9903b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:22 +0100 Subject: [PATCH 1036/2300] Revert "[nrf fromtree] tests: misc: iterable_sections: add named alternate tests" This reverts commit 7e355ff16bdd1e6c2430611eb6a01de02f87f632. Signed-off-by: Robert Lubos --- tests/misc/iterable_sections/CMakeLists.txt | 2 -- tests/misc/iterable_sections/sections-ram.ld | 1 - tests/misc/iterable_sections/sections-rom.ld | 1 - tests/misc/iterable_sections/src/main.c | 24 -------------------- 4 files changed, 28 deletions(-) diff --git a/tests/misc/iterable_sections/CMakeLists.txt b/tests/misc/iterable_sections/CMakeLists.txt index 1a187eace6d..24472eb8574 100644 --- a/tests/misc/iterable_sections/CMakeLists.txt +++ b/tests/misc/iterable_sections/CMakeLists.txt @@ -12,11 +12,9 @@ zephyr_iterable_section(NAME test_ram GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} zephyr_iterable_section(NAME test_ram2 GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) zephyr_iterable_section(NAME test_ram_named GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) zephyr_iterable_section(NAME test_ram_numeric NUMERIC GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) -zephyr_iterable_section(NAME ramn_alt GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 4) zephyr_linker_sources(SECTIONS sections-rom.ld) zephyr_iterable_section(NAME test_rom KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) zephyr_iterable_section(NAME test_rom2 KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) zephyr_iterable_section(NAME test_rom_named KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) zephyr_iterable_section(NAME test_rom_numeric NUMERIC KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) -zephyr_iterable_section(NAME romn_alt KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) diff --git a/tests/misc/iterable_sections/sections-ram.ld b/tests/misc/iterable_sections/sections-ram.ld index 96454fb282d..c7c86a8d97c 100644 --- a/tests/misc/iterable_sections/sections-ram.ld +++ b/tests/misc/iterable_sections/sections-ram.ld @@ -4,4 +4,3 @@ ITERABLE_SECTION_RAM(test_ram, 4) ITERABLE_SECTION_RAM(test_ram2, 4) ITERABLE_SECTION_RAM(test_ram_named, 4) ITERABLE_SECTION_RAM_NUMERIC(test_ram_numeric, 4) -ITERABLE_SECTION_RAM(ramn_alt, 4) diff --git a/tests/misc/iterable_sections/sections-rom.ld b/tests/misc/iterable_sections/sections-rom.ld index 525c480c7bf..c837cbfbc4b 100644 --- a/tests/misc/iterable_sections/sections-rom.ld +++ b/tests/misc/iterable_sections/sections-rom.ld @@ -4,4 +4,3 @@ ITERABLE_SECTION_ROM(test_rom, 4) ITERABLE_SECTION_ROM(test_rom2, 4) ITERABLE_SECTION_ROM(test_rom_named, 4) ITERABLE_SECTION_ROM_NUMERIC(test_rom_numeric, 4) -ITERABLE_SECTION_ROM(romn_alt, 4) diff --git a/tests/misc/iterable_sections/src/main.c b/tests/misc/iterable_sections/src/main.c index a2dde51bd23..e5d697b8a80 100644 --- a/tests/misc/iterable_sections/src/main.c +++ b/tests/misc/iterable_sections/src/main.c @@ -44,12 +44,6 @@ const STRUCT_SECTION_ITERABLE(test_ram_numeric, ramn_10) = {0x03}; const STRUCT_SECTION_ITERABLE(test_ram_numeric, ramn_11) = {0x04}; const STRUCT_SECTION_ITERABLE(test_ram_numeric, ramn_3) = {0x02}; -#define NAMED_ALT_EXPECT 0x4273 - -/* alternate naming */ -const STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(test_ram_named, ramn_alt, R, ramn_42) = {0x42}; -const STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(test_ram_named, ramn_alt, W, ramn_73) = {0x73}; - /** * * @brief Test iterable in read write section. @@ -95,13 +89,6 @@ ZTEST(iterable_sections, test_ram) } zassert_equal(out, RAM_EXPECT, "Check value incorrect (got: 0x%x)", out); - - out = 0; - STRUCT_SECTION_FOREACH_ALTERNATE(ramn_alt, test_ram_named, t) { - out = (out << 8) | t->i; - } - - zassert_equal(out, NAMED_ALT_EXPECT, "Check value incorrect (got: 0x%x)", out); } struct test_rom { @@ -139,10 +126,6 @@ const STRUCT_SECTION_ITERABLE(test_rom_numeric, romn_10) = {0x30}; const STRUCT_SECTION_ITERABLE(test_rom_numeric, romn_11) = {0x40}; const STRUCT_SECTION_ITERABLE(test_rom_numeric, romn_3) = {0x20}; -/* alternate naming */ -const STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(test_rom_named, romn_alt, R, romn_73) = {0x73}; -const STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(test_rom_named, romn_alt, O, romn_42) = {0x42}; - /** * * @brief Test iterable in read only section. @@ -178,13 +161,6 @@ ZTEST(iterable_sections, test_rom) } zassert_equal(out, ROM_EXPECT, "Check value incorrect (got: 0x%x)", out); - - out = 0; - STRUCT_SECTION_FOREACH_ALTERNATE(romn_alt, test_rom_named, t) { - out = (out << 8) | t->i; - } - - zassert_equal(out, NAMED_ALT_EXPECT, "Check value incorrect (got: 0x%x)", out); } ZTEST_SUITE(iterable_sections, NULL, NULL, NULL, NULL, NULL); From 86f9bce621ff6c0fbca0e3846bc0acb7936bbcb0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:23 +0100 Subject: [PATCH 1037/2300] Revert "[nrf fromtree] iterable_sections: define iterable_named_alternate variant" This reverts commit 1b90f1e9bcc1972f870514e01911164948679d50. Signed-off-by: Robert Lubos --- include/zephyr/sys/iterable_sections.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/zephyr/sys/iterable_sections.h b/include/zephyr/sys/iterable_sections.h index 3ec4af5e9a0..fe1976363ca 100644 --- a/include/zephyr/sys/iterable_sections.h +++ b/include/zephyr/sys/iterable_sections.h @@ -234,16 +234,6 @@ extern "C" { #define STRUCT_SECTION_ITERABLE_NAMED(struct_type, name, varname) \ TYPE_SECTION_ITERABLE(struct struct_type, varname, struct_type, name) -/** - * @brief Defines a new element for an iterable section with a custom name, - * placed in a custom section. - * - * The name can be used to customize how iterable section entries are sorted. - * @see STRUCT_SECTION_ITERABLE_NAMED() - */ -#define STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(struct_type, secname, name, varname) \ - TYPE_SECTION_ITERABLE(struct struct_type, varname, secname, name) - /** * @brief Iterate over a specified iterable section (alternate). * From 96e633d91e4d43ed32edb40ca8366ec88893c6ca Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:23 +0100 Subject: [PATCH 1038/2300] Revert "[nrf fromtree] tests: lib: cpp: Exclude cpp98 test on nRF54H20" This reverts commit 6450e4a56d0ad90639f90e5e87d77649aee10bab. Signed-off-by: Robert Lubos --- tests/lib/cpp/cxx/testcase.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/lib/cpp/cxx/testcase.yaml b/tests/lib/cpp/cxx/testcase.yaml index d1a7235a84c..cbdaacf714c 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -34,11 +34,8 @@ tests: # -std=c++98) cpp.main.cpp98: arch_exclude: posix - # Exclude nRF54L15 and nRF54H20 as Nordic HAL is not compatible with C++98. - platform_exclude: - - nrf54l15pdk_nrf54l15_cpuapp - - nrf54h20pdk_nrf54h20_cpuapp - - nrf54h20pdk_nrf54h20_cpurad + # Exclude nRF54L15 as its HAL is not compatible with C++98. + platform_exclude: nrf54l15pdk_nrf54l15_cpuapp build_only: true extra_configs: - CONFIG_STD_CPP98=y From ff7c69a8b43169ab82e84a83ba2f6c9ea953cbd8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:23 +0100 Subject: [PATCH 1039/2300] Revert "[nrf fromtree] boards: arm: Add initial support for nRF54H20 PDK" This reverts commit 5ebe3f7244f6e5c6fe3c00d3c40aa946f63e8c7a. Signed-off-by: Robert Lubos --- boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board | 10 -- .../nrf54h20pdk_nrf54h20/Kconfig.defconfig | 14 -- boards/arm/nrf54h20pdk_nrf54h20/board.cmake | 3 - .../doc/img/nrf54h20pdk_nrf54h20.webp | Bin 27232 -> 0 bytes boards/arm/nrf54h20pdk_nrf54h20/doc/index.rst | 148 ------------------ .../nrf54h20pdk_nrf54h20-memory_map.dtsi | 79 ---------- .../nrf54h20pdk_nrf54h20-pinctrl.dtsi | 53 ------- .../nrf54h20pdk_nrf54h20_cpuapp.dts | 137 ---------------- .../nrf54h20pdk_nrf54h20_cpuapp.yaml | 15 -- .../nrf54h20pdk_nrf54h20_cpuapp_defconfig | 33 ---- .../nrf54h20pdk_nrf54h20_cpurad.dts | 58 ------- .../nrf54h20pdk_nrf54h20_cpurad.yaml | 15 -- .../nrf54h20pdk_nrf54h20_cpurad_defconfig | 30 ---- 13 files changed, 595 deletions(-) delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/board.cmake delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/doc/index.rst delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig diff --git a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board deleted file mode 100644 index b76cfce6800..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_NRF54H20PDK_NRF54H20_CPUAPP - bool "nRF54H20 PDK nRF54H20 Application MCU" - depends on SOC_NRF54H20_ENGA_CPUAPP - -config BOARD_NRF54H20PDK_NRF54H20_CPURAD - bool "nRF54H20 PDK nRF54H20 Radio MCU" - depends on SOC_NRF54H20_ENGA_CPURAD diff --git a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig deleted file mode 100644 index 954276ec829..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD - default "nrf54h20pdk_nrf54h20_cpuapp" if BOARD_NRF54H20PDK_NRF54H20_CPUAPP - default "nrf54h20pdk_nrf54h20_cpurad" if BOARD_NRF54H20PDK_NRF54H20_CPURAD - -if BOARD_NRF54H20PDK_NRF54H20_CPUAPP || BOARD_NRF54H20PDK_NRF54H20_CPURAD - -# Data cache is disabled due to a HW issue in the EngA SoC revision. -config DCACHE - default n - -endif # BOARD_NRF54H20PDK_NRF54H20_CPUAPP || BOARD_NRF54H20PDK_NRF54H20_CPURAD diff --git a/boards/arm/nrf54h20pdk_nrf54h20/board.cmake b/boards/arm/nrf54h20pdk_nrf54h20/board.cmake deleted file mode 100644 index 4c63f1dd05e..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/board.cmake +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp b/boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp deleted file mode 100644 index bcda6b0732b3acefe24e83332692e8ae898d47b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27232 zcmV(sK<&R$Nk&FkY5)LNMM6+kP&il$000000001Q0stKW09H^qAmnKP05D|%odGIv z0v-WAkv^G7C8MIFs<#_f`^Tyu{XVb1!~f~^1^a#KxBm0?$KBueKTr?yzxRD)|MGwT|LO39{#*Y? z|NsC01K+xSonO6Q4IkwH^m@#H=j+tz7wmud-%B0?{y+QA?r)yHJUxT_SMGoKKW`kl z_1&qL&c6bG5BukzfAhb|en2ZGY47uKWM|&)k22Kj|Op|7*S3zsvvi{~yuM z*Z#sCHT^9R#aYszQ6T%hXv25?9kP{cS8-sRRn~HZN_VFXGV_7VrZsBY0)EkU@d%ZP zDO{TD=THao;x*IxY4#c%C(_1A-lkL*4UEJII+fEPN{Tm_c_=izGlI;`lSSSfQ&t9l zr!I}oC4w&O?eX&8`wfx=cGKmU^0F!HK1YUGbmK>s5-#N>dX$p2G$E`oDFWY!)i+## zd~+uIv%gtK<6x(}ETEzWU-?>~k@tVdC6*nRFigE{`(T}MwKtOqR%7*Jtn+!K>=}cb zbyvmBmyR(sqMS!NVOh7e3k|ou*deS&v`)jorS3@ymUpRq1A$;uo)9%LD^< zh=}Us5mBoS+gPPc*@)d!vMnORyv7#TFtjumnwldw|J8g^k}rN8I9I*5DbpyQ`|mW( zD+G^|`+*4Ja?x^ts{$+3v)S2UM7^`AiNaS;hd9;seAUMqr+9D-8iCaJ_ij5YqzeYm zI=hf_SF}=<&P~E_P4XzSt$8bfx~@R`qEzV$K)U)jmsdPI=-Kbr&3$RqA{CHeX%vWE}L zq}8~4%$5>tvzCXYthxOrQlB!E9>%Pmj!kqXJhftBHWw@-rTspQU5+AM(!&Gu^m?H8R+r9W|7OPb$( zYDC_gB~1y#f%h}(abst_&Om9KRYgE%lnRKl(gCV(4Cj+GXI6+P>vOLZSr~r-@iJ*Z{Y+qy3{$w(C-Ucc4h zv9!P&vpEx0kT__~G=X4!;tK#)8*>t-N>>N`?NPs_X%-or-`*+KI4Y3$!)&tPBEAx4 zYatLe>3vUy6~2>cH6@kvW&ZSF$7@@ev{kO-PLQl?{=crSVuUvGUW^Th(=(JgBjeZ0 z;)88URvX0eAKkhTubh_R^qf$wc_SZF*vuky=$h&e)nkc+_IS0l7^SZGP1IpCWnjyB zpawTHE%E)vx@Q+{4nc;Kwm|5M8gK0az z71Ld7vyjEYF=th7=^J$&EJ~Ed1a%(NV#SMvy}v3i79?kpY76T{5W3iL)1Jq2c%`v( zwk`3GjAO|q{2?cl+T{OnW?fT>qO6++?{`kSH!jMqAXzvyBaLUQjxE#F8&xIy^Y)D# zC@H_5Z{&b#;#I~3fJGDAvH1)$@!vy}4A~h3`!;s&=@h0_pMF84pZ@O*J@Tz)N%6N! zROKOkZ8eLWk*l!(13)c>wWQ!|(NS9G-1q23b0tK3-a)c<2;XUB=Pe$ZeR*7QkqH^7 z*VrmOSjt3)60pVtn9Tui({4DuO&TOo$XthUv*tuzA=r|m=BOPPcRbvBR;h%~n@%OU zLIMVSbvOIQK@!2KqR>g9`Ddud83VY3NS;%GqCwTJs-_9=5dwV&0Y6teSdh;9vyyGi z0=We0p!o*?js{=;5aV2%J`T^dIlsLu@a|?-@nam-0ES{-*s|Jr{zhoat=OeHF}7%34UQ6FI8SaIA1OAW~jJ9Pc;uW32%OwwPOVSw9Cr^O%soLQel;5n--6nirp9 z_|-k_VQmU7)DR*DJG8X>JjF$(d)vp%HKfV%*q2&9gpxUXjVMeL?e}W#C+igTu|z&j z7mPj*8p6t40Pxb!^~=p``t}Q_585gJeE}`m*@f!{-w3WIbjC`9Gvuf(BmUN+U=`;THq{Xavb@z$ zyZ^aK1}HInId#{m!&1i3&B*+IeEIeE%h;vMdJ0JsNLcEIhu?uKomXy6*VR8giG2jT zu|f+Z*=f7AN#%9b!j&RzE94h;U#LzF^S%Cpz@^t;iScjLPA1wvGq!1RmBO0wQ;|BS zWx%qB8MI5O$#Y@Kw(&7T-YkCP>Yq@Nr}C9YC(0>|Z6O%Osa-y&Raic5Qt*Ni64Ru1 zwMJC=YisyI%9*fZ#2*3(i;<#9ib1D!3|Bu19y7YXimF65wrKsuLK$yqh+5UI-UVnk zH0+}t>U!R}UJ__UE@xzz7%gov`WDi3hmbnH_zsp$vo~gn#rG$5gWzgwWAuRTdKKw{ zMduHokK=vhZ2B|Kh^d?ijGOxst1#hv4&(oNzqCQY?r^N;I0Z6I6cJH!4yjMgb{F1z z%C7w(JwiMdJ=B2MnvEVE2||zzWM)m*t!vfJjOj6-G_^;j!{YmaPy_1|+(zBs z*i81H?~5W*Qkb90GH7oS|Kc&nasWqVdoSK-3}i;#s#5br%W=WRF2T{rOHB05zB0=+ z0V_yxt$G99+O3$HHl=+rq{cRojAO`4%X{MN23V!fR}9LzUnAn73ne> zPgOXA{**J8^y7&^SWH?|S@Jgtm91Ui%qHsvUMu6^GC{b7&peXC#aGSe0pJeC6A3T? z{`8#BZ5?p7{dSb@IVt~BaRa`7lxF99Dm8<73C;^CAnL|g-t?8qX%ORlH<@gsgebT@ zN<`mk-QVA{cC0S!-FWh%SJ)p#@m-2vv-1nVce?2Ns)WFdzt_*3!gojBHQk<*mylRW zYr}$X4s=OUV9txH^r>|74HP7eR9dt4f#ftC+yCP83)Zzx+nCdRxazNs1R=rv_K*9# zAQe4r(=SCI$O%4e3te9%Y51uh8I~Q;X&-No^U0Jy_W}Q}UDhN9dEotk6Vo*}_CI0| zX36tA-3SzaxiFf}xBX9L<&@;-?qwL*?mWKlKp!W5_W#lg&QS!i-`Tt$FbX#dH z;`^{4jTMsXRE)fiz`|xHcDLrMv!b@f&^dyxhw*8e#?O_AZZwHozPbR*lB6pp5x;el z8AXZd<;6O1{1kR))iMwn62g&*x8>8L6dfvKs)F0k(2!F)^fMV5Sq<)0lfhK88)-P2 z!?Q_Uqh|)v1;47?OkIDg@ zaSj4MQaO%ZKAq{RQF{iI3j*xNEtvbd@Wx5^`!sE-b&rT zsQz`zy4f1s;zaIaWk#MKcvLFk{w>bmdN9a6m1i@%PUp3>l-WG05DD#8QL3>;=3YQ! zen{XB`5-d}G52gZ`DaspS#{{5#am0f-SFQ5M-|F!Nqyt^|2;?tlyAV#IZ*-AI4gyn zIyIHu#E3WS-eMIT2#Ij~@KsX|Wm5cFlh8~;vN1f4&-lfzOzrvtV1SfD6}S!~gnwnG zPURmT{w*F~N>ehBA8Wi+p5cw*!=m#i&ab4WHJIYk+%wlmyaL;TIoPH;u{5LjiN~&} zkes=zmF~|9&kN`)jMNkVF;pXd%RKdXlMe`k+KGJLE%X)OcZ)qtzOf&-pn*EjiJnU( z0dsC4`Xh^FnPnkyK$TGk!mg?f0AEPXHIk}ok=`MYW&3ik-VH~GB_?`*adTL00z-0u z`D(CtB0^<3$afjF;UD)3@crO2tnbx855onX!q13kp5|6vCD zcDzPoPEmcfin7a1WJ}l$ACGUg7qe&&GG;zi%OTD85h_7Z+meLOerw&cA*=9?odO(E zL()JqK~(Z{J50(|rqdr;r9Rp8BM8Cm)dM0Cs7MMN(E|g0YJKPOem~P zD-nQ4nfM2hE99CazCnnN51GO%itIW6$g)7vd_l%uPFNNw*BL)Py5$K%dCe(n%DGWl za27H9|B@tCeQZr%FL#tTCD)Gl20tS=7);1Kk=wggPNb}f zk*`&NF;Sd5ih3l#l=<^zI64rO$bqe_HAErlLcU5s)JORWPv0mCrVRp%;r3$twB^3B zdux$6{KHOkH(=u^O|-%t&m46{O50M_(&*dec+h$=VaUl(blK*L47HSVN>{MZJ-O0Z?!UZ2VNK5)kjilN+q28AX z9kVtbgu)9}(iT(Rvgj8vZ@?U~_gCb)!0mQn$xu2QF_-US?aEG~MB^IJK$67L;LiyR zQ22quWB~v`7Kx%aV6M{TvBaI}0d}#`e}e^K-d859f0+k7HJ(YYfdz-g_$Gm|8u~M< z?W$>?4q&)yh4B4cnIggu(O$=XgEhXJ1)*urcplQLiv^?yzc+;_8w;O&)lS_J+Ib^J zY~PWbh2}h*<%Ew?Kg1-mp<>pOlK~q~?E!yQ^AYfxYVTFw8CHyG zfX^kR9u>}l`LYfwF!rS;h#Yx1uraqn{u}+-+&Gf|ov$Fx=FcUey#YD%IVu0n!Xz0gwsT5acjwL0klt@REZ-Q?jgYYDVtzNe^y}Z$bvy?SnZ2xiJ)7;P z>`v(zw?j!<8)4Dq>%9jSX6dbV7jT^oUIQu0Q?Qsv)j3H)n~RYbDAP*#nQbGOvOriw zI@pP)EN*xT?}$VwYtgpW?q%v>nv)ui2!>N1wtRN$ftd&ccxzV_7A0g-ba4QV@nZdc z*}c2S;{1)ZdSOaPyPFOE7{8Z)jzTf=;L8IIRfxeA)^yH&1CJ?z9EC%81a6u?z2sT2 zyEYiM48bul<7V-?W(RjVX))jSPcDt@rNI&K2pQYtM5YE;O;Mp9N{QwA ztZI_~nuQ!*v_{30cGph$-=^9^+xB~|Ea9EqmpQ8$v)~T^x_RQw*@Qg>wpf4Scgy5Qm-iJo$#K7 zI?SQ9IhY{Zi^@I`w5dbATKNd@ZTz+9MdB_*kmy6N&yEhd{HS(yr9L)MJF}$P^V zxNmr&l`9X{spN=;|K&h7>|%KVcfLJ|TOIV9U&!hOU036Gm*AoNZ|>Xgc$65Oedseq z3!4KcigwSe_Oi^tZ{@sTQ|3*x5iUTpnUwC$JbpUVhldI*hoer zj_*FnL;EMUO}NkH0CFGw3R=b3FkOTWMYWdLl?dozvU`K{_~ie+IJcRlpjUnWuRwU5 z{4SRbS5uyc9bGps=Py1Mzo#2aPHl1lAw2uA=lEpukj~H(89kPPZrlIXTB(Ko;I-%{18 zPOpR-j8sxZ$V5gG*y221Wt19=6_X>HS5@wj11nX9HH8{dfTVDxu0D6t$S;j@^jvCW z!olT+(Zvn-?*8sRIJixwOMm%>+96cQ$r&7p2HN3sEpiIa)n1p_LQUN#@x)N5ng3-> zHSWNB?9c&8*GpMZrs#J7olsbbGN)>(`ZT7kY;LKuJJ5jp5rIY|%f#-~=NWQYm)~li zqg;bftvGJ@Vr?Ybr`ymNO#J2xUE4dS^s`D`nyEqdV=D`et7hMS%INSqQFv{Q0{ zM+bU3YxhPx!|Tn~pW`!Fs&*qV7aqo~+(b%Pt zJr~{_6hzg)aU;sF`i^$O zKe5zwh*!h$jo%8YO=HA6Y0qMChzNf;Z*G}8TQ&++YQgwW#IpWCd|v4z6u#)tHr`;9 z3Z~d-7JrO!{HK0q%pzIlzA6?-v@LA{-8CglV`Vzxv5GV=nnxE6d|DoUnUaKEEQWQo zCsHo_lfAe1o5&w@O25m;6@4=lkYh#91(jZS5~OE8WiL=3zYE+!C7{>=5F4XtJS*W3 z)wDCMtrnaif)d1w+p?o)!?@|#+^)*koobI{Nv_~nIbpz#C3!*7)?5L^{s$^-{A5mh z-X9kl-RD*8l&zLsB}sjS>XgGfWh%I;MKOxoBMIu2tD8osePcxJa-|c|vnPlBtqDj0 z4tGz(mV;Yq)Yu&b$bl0sqAT;HF_;7VkmJ^H-0$YW&-0>wEMtzzqKh%IO}j2Zc+em5 z>GauvL;0{kdnpPw9&dQLh*xFG57}we?|-t`raj;6)U-k>K%VH1V;|YbSL%quLB(J+ zklCSUN8=)_@%vFO7PAL?5}ZXKavcOs@3Cb=l;_hL;}*LJb7u+f1r6dS_Dk}`j$C44 zm(F;3wUhkMk?W^PjX>ApHU{%t1%mkD9u_RcUy-gZqlWDXT9z{yrO@ksgVaKQ`Gs=j zj9qr-;Aov`Kfo{;6+%47ZTn#x(pP%ZeI-nFdp7C)-t87)PmH&Umalwgg@rxr36<`Y z;k7gayCe->lHn2eIBDq_>^ zlFJngySy4vFeM7%*XkwF@AHW+JG0AV1yJk7?B}|HR0P>lJ6ZHIjK?|~=u!wR zZQo^uxH6SY!2R}_Yr?#6h(L#2f*t zP_+=a#R&1tm8AZFr_(g;Gv#M+RsW#|kV$fx^91Ofd6$~MC8tx^6ITU&lMONq!qZCM zTn+M-ZX}@P5a*H<=5H_UV%_BTf<=lW=^=B3c`7?r#&$v?x#{f3UV8wCf($Y-PKyDP z^r7FzxO=k7K)r0RmkX(W^sp0n{5S6X7*F*NxqGkZd(Pz2KS`lk^z7VPo6BQtk{DWqm&yGZi{ zV)#}3Fr=3Yao*l6Gup{6PGLQz;j@hdduqGRIBPMHlC^GwJTB}jV65Tlw0;RcibHe1 z<{oh*+!ItduzbCNz#DcXnl(73^^3LhQ^vBeV_hO+?GJ7A&AY9SOEVBLo6XIN{MNjo zv1X%5ZGzz8&hso|plf{X&@ifuUwMG+FTbbvDG6Ka1_?xJdx6xrQ!>pqRG*Umej&n=AO?86T(8%U8=Lih19_GgXyCOV zV-P`;y+d{(ylfaGtAB5I{vB&-3H=@lle)VoCL3w@-H?0MuspM%+xHVsBunIze8dvo zSR+w6bY^Jm=d#*|NulZc$GZNwS_cn$5+nry=JJ=CSiCMUX~+Rxq?8xfx^f)#k1^n{ zu8p+pxnRL#^GvmUvBTE^Ab@M@AIA$14ZVdWRS0ZqHT+h8#$8bpVIrQ#hx0M9 z9-OlvAcJaeria$VW;ujxk(NokEOVe%FC#onSD85yP*(eHb*gUI{tZsevZ_lPS2toO zgCdJFww-RrvHDpFhz&hysu3|3#)bnC>_%p?H>P6KB*vGHht8Tk`?Wd_fZVvvEW-;h z!Ep588D?(~g-Q6;IWW$_?R_D${2;R@t*C{dP%U z0@9Up(bA7EkNd!W`IU>kD*^-2CCx2M(;| zp4XV#eeeI%(Eir%o8W|J^J_&Kje0eDh8>_n5k*}^6odIY7m-ADyx9S?D#fj^-`eDd z{6!(Ftp;a{K_eIXtb$sR0Fx2&7KcQ-Iup@|{Z#`W3p zpJH@4g^C1S&-SsxuD5oy>cBfXjf)1;k0L11`}epol(tlO;5Mt)@|`VFi-c%tzoWE-Zp>fKB=T^3XJ>qt8XK_25APWndGefr#C_;$(~jMXS% z-8@*u+_~`JN+~<)#mkY<2Tr;aLU*8gs48ZL$B*mW%;xg#7ud+JY+Y@>a4JVR6&R$S zqpgzfW9}Un-bHGKm+V(dzoZ<+?Ig<5OM#KyAdCTv_pVB^<#BxgrMjC@`!=OlyV}=& zA~Q`j>78q}E4ggkM5mUz^dm?Wue`sKL0fsd-n`BrF#$m)&yCN@B^cmm(NRB;NarC> z*T^M-i6k7*7Q&@?QfxQXJPj{Ef>0hHD%HBhNF;Sr-2_>SL3ry7t?*#*(C3Rk_YAB0`?&@i{RVFeI^U;0}4j0Ej;7UO(2XgZM`1 zQ^3xNA3YLg)grUg2jMMUw49ViK@kWR-?x*!Q3LVqJzk@`awvM_7?)&#Jq0p7$e4t) z_gU7$La{k}pgvT0J9uM9>LySuXo=N2m{MigR2!dWh1*-3Ib)uUX{8qCV}XU&^gx4) zh|&5f+jGsp9-#kDXcq^g>D|>OD)_3d#p;X7O}dEE7_i!u@1WpY=G9Wc(xEXAm(64L zAWvVH2>Twg98`B+q1qAqwHaf>xqp~y(KQ^^dGJ+OXehr<_dU-JP!fsGOBnQdtHlo2 z9y-QPF%vqHCypnIl@wzVk_MfSSN+ zJN(`Vd@J6)A3{TW$K|vW22`l6~2ZA2Y{nIJQVHA2AVguRVjTDAg^C(J!3s}Z8 z+7iX2X%m13LpNl3aBn{})%z!|61O%gwb|z?u#>>F#GfYL$aX}IBxQ$!zQ0@jG0lcf zm4tMh{EXJ*Ii;$`IWpI z<1epa3{=CAlD#c3Siq4$`LAgyS|tzcPUNTPd+<%Rges7^6A598WL7X(0R>=@~j zHV|xmX1P&VDm1w9pyFk`;0L@y!R0mhh}Mqh)IZO3Bw5+Wv;1F{iDZw7eHrrr9aXce zwIBfE>(0Zkn4Id&)=j^hD;oS1W5@i#E50&$v%P(1I&lM$;)#h*#g*dTQ1;HPYKsOh zwA_o>Y~cI`(YU3xy@DojtK~LQr!Kb$Wr^D34Fis#f_F6WfYCGxY(xe7k6EdJL?a4< zV)%h_0MSRz`XDOY6wZb%1S${Drg771P~Jgor3nW49tSx;&!EYWH`7e)N+H;m_!mmC=V|Kq^B1ZRk_L#dh7_3Ov32?U@e!*w1APB+>Ggzsxa z$~|qq+yt}STSQm6TB4tXQ#RJk41+yRLR}^fZ%vJH7-a?NJyqZ=nZlh|(V{lCG(y5PG!Pz0ga)V1U2k}^6+a4xX0kn;!u(QD^`6n5>p&N z)q6tik+t{#1_`+g_FXCL+9SQW$m(vd=rQfzIL;NgybvI?5`@_zYM%w~?|b@GUBT(!~m;WRo#C6hHQ@X5w;I6g0)%e>M$ zS%Xq6o|x7$CY-Ag6yG)_I0O)1ya6z4EPX@Ug=xAKjY@%}O&u3gGhcQdPq7;Z!5Y*U zUo0B_J*P~0B}Het-iixTjHExMlobl@sL=xTUB(^HgkDm?n;?x#%r+f_nLCqGjM$$%n7tl7+o=Rh2926#KzsQ?hzP*?lS= zSvblAU`b#I1hfhu-&$6i#xThk|8N19{FTPkm)S|Kn)S&|!}gzvUHzWdf-TFI2^O@> zbaV}Oh7u9XJ1u8J+(bl#aep=SWk6|(oOQ2RMaX`6xC@#8Wh{ybI|xMT3FQWp9LBP! zwsu9`3A5UEnpV~ppRE=EVD?zIqD zi=Q1Q;L#7YWMw3_X9i1%rv7hfncX&QM8mghyaJ|WeNy>?0&fIP9Gqo}CSncZ$+xny zF&g(Z4inYGAyDA`Jh!TmPRW~PrxxIZ8)GzN@||=7denUduMA!{UweGLZ6M;6jX`u(m}n?BPw zp7(PmFOx)V4TB`uaFJWS$UZN)?*8%BY;H`gI$S`lGaR=yF!QkYq63|^-n>}T*SAD7 z`<9y3T@bW4IjEDb6v}92r`VUn3ItlC(XBdV^CoY0=K2bbku6~EPCLfFW0$CWInUmf z(xyNQd;lokaOPboaAVxivIvsdIrhte>?i}^DqE}(qq7;Ly{%KkZkn^Noml*ky11ML z@B58I(o=+YVZ}%Ti6(jGZ@?Iiy?zy~vW7&5CGWnu77mqqUP-@^Ef`Oe4nD561t4|J)>WTAWeAtxreKDRxuJ+Li*jhkCHNB7(1R4wDks#UI z4n5`(w72#LU_lB;h|Goev4&qbM^j~);~m?QZEEZ~6EAPR>QSgR`ozV~1Lw3qvT6u$ z5}S2O3V7OB8=-H&qge5Oc?7?$bEq?{4Z*&T9xJFlt27`o#tmiz@S9#%`f9v^)s-A z+s4|lxHkzN&tg~)#11dEg!@)IW}{Z%?=I|fBdsX2CTdeeY`99`5AcXmCLbWt6(5D6 z4-9vYK`Sf5X+;pnd(6=NnA*JO;%*NE)E_RCur9eh$C3t z7qZqw0gYxC>Lo_r^-y`#`!hgB#FXX_US&+-2*(WcTMnb#@bPv5 z{$)|wnK1^LQ+8S(MAsXRo5H)Q%H<6HD9AY?>opn2Zy_}CYScPg(4Xg#&Xe9KcL{1NGuB1;vHP0~Xsrcf;2Bdy(6XC#9 zkqn?K7ya`(gRsA4rvDn$`bL_68;zWHg1JHxp0ah+klacJWegH_K50JPt53X$1k|-D zluJYDq4YCiOUA_3VV5Dz1D`V60dufOonH&d7n`*qxdDHllg>30(YoDY(PR>NHROcTCTpB= zpJsVS+ip#<3L>7pUv_F79pimKgXloIqb8ZrTid9cUCY#sL!MwXe>nwvxmFu}=~QYo z21m#^fvTSIkE3k0(EWh2z)r4kry>2qnxxn_1XlMB`QFHX%&m^zFHq0=&gMu(W8dwn zTXi>8g>4hH^us-YVQ$H2XM19sLKO?qt=**zf|mXG_L$?O{C-C1CQgGN*6r6k&DNmE z;clq2ay>Rf!e;S=$YS_sDQKKrX9?$E&DoX(|F?Lxdk{X;v!IUZRdz!43qh)a`?qdt z@W75Zj_SY(7DDxjICf_KC-P)?qUoQs6E0!svimPIhj4l}pu7C5{nc+yIip2LQ3&k$cAcasX=T@eu(HkcL|fS)k@W**pITdy zzfi`hS8>e|2O=`wtc>J(;}PYx%_PC4I}HV8_~|LOrvqiLCY*Lra+qOXV1_OwB|Rk2 zA7{QPX}Tydhu*-m$_MzozD_n?lMy&pR(o??LgD~*t;L&AZ4<6A>oLzr+QkDX^YkXh zx~ohy!XhTJOuV8w#{t&*$_vkn^_#*NKj~gFv};1{0=3i(3DMD|nz21uM@6?UMf~9x zU78U0YYw~>IkDSLpC|{K*dtY(;67-@qn0T*KWRF;{Un*pcw!0Zu1U7nv-3bRo&tJh zM9f5G755j-*J79?jqNy0>5AMiL{GbVrNRq|ViXXBubfA^_h-M{P(V|*n-N;4q0qE{ znJUS{G-TLkRiML=KZV@RPR7q-s(w+(C=nx7aRX%cPdQ?B>%tg65bCQ zQ~rZHt7f3$>~nZj7!e#^RZ+RY88C)9;DNTC)t>?->AX{mMsom5PTKwV_qxm5k1)n; zZ@x(`hFwA$IwS%UwdHAMx@4ifSpM(vn89$zZtz)dXcpY7OhDz75GZzXxNy$53c!)q z9wqSQj_KYl3du=I6W#1%?0jvOl(lITW@eYjg>JK;&ytMJWa;^!rQ3#wvDs`wc*&$d*D9GI# z90SSv=^Mb4yloqYSi~^8<7Y|bDAFG0i+=|d&fBSS>8#W|UC{M#5Fp1Z+ZM&wtNtoc zK1k6UqwL+k7Zzs-O^n#55#jcKvx=k*478(y zhj)soOt9XzVBKr)l)o5J=S^wSPz{3Sex=N@B{^pyOwsfWF~o#^V6ho`f@%TLNn&LVz5X_xBOR%vEcPyO*L)!$E0Hms(mL}e40XNIwUUD>b;h0u;FidkK5p3J z4{OxfJQoh~(OEM~XEz?n@(?Z*UYgo0(GPr61hX6gwf=oWIZ^Wj%ij{tsz52bfxm8# zc7vBT;r|AVwoTmdzfi2X<`3t>*s!y^wN5bQ4u*PL=KB7^TFg=NYPt&MS~x827~-9D zXLA4LA;jcbeTFv7@JsXanQ|79pHv&iygfJKx52Q`Sh7~MW&F-vz*~w;+3{nUxxDfb z6=F)ED4I~YG{~t57E?%pX)isUME_Fo+m``xL;YsH$IISb?qJ38++q+!6YJDQ5z4IC zfWwXRdAY5>Nm!%@_9;fF38O&w(<}en7-TIkZu+X_NMH18XB+T}_rgyqEcc`(A9G!k z@3<;=6FXoKWDB;@M#+7){{m?+xEquLM!4j`p4TYJK3K?v%o7&Vf}PEp4M-0fFw79G z6zooEEf;#+?Of3EecMDwbbNT+i8y}pFr5M7?F5BeG2=xq_Qy%%wokBji1RA{h;=L) z7M@mMqaX3GskS(sBrc!RSWCLuS=!Z?OQ;7lC%4nldVHk%i$&`n4TO)O6+}-t1rjC4 zqX&p81bB@PYAUn*yMO)S!u!BLdNYbS<8Df^FJP$#7qG^>wx{X7(J&l@XsTUkHMWs89Xt;ro5?DUn}>$e6m$2@&Shlk-7~D7O52Pt0WR;ZeE1M1 zdiEkgY@PIr=Z#Z%16k+2kjCuDF{6n~7!XHCH-f16=jnPCs=`@p{Tqdf{)O6(ZLtho zpKvnbU31JRS9TY5UrmA~%1OVMnL@S@1q<=&hjH2s4>n`hAPW@x(Yw)k-=Cw3p+N26 zAoN=kQH*7*P&FcktczYONK3}EWJjOdD#juacZ{3!Zu?z&qxr~nJSZ0nLMJ;s^8XtD z2bkw~=r`r`%SyE~o*{FOeMJd-9s;d3@RJ?nx z7_v=Bx-N3F`m6y~`o^LQ)`Qc{(Sti8LQXJdq(g5JUrSX;8R#(EP2h0kZae zoHp82VkRbYl&&WM0Ze=Z7^T3dg!RxfO;BcR*p`DF*bXPBrrag9QaJWE!mmJ|xTDC} z*|qb{y2F+|&2~xe8eIgI{5$NcSfN^O1+MO98A<6S%YUfK*s&KObA}QZ!Lz;kuHj+f4ROmzt%2_q86P z#6~TUWXpkoC{#pv?}6TFF%CcDXSndS8aL-lILAMVe}+wJxXjpv?s}V%vJZ}V-VGWe zGqAEAML>@s6JHrAIaNo#&_-s(7DGtDj(L}z`iJ-2lqU{8zJII~Rx?|qF4B*^wmSNZ zZAGQv^fE6|t3*42BD3gI)snVAs0c?vW|f@cxtRA}$ydnpn2Y~Ur-{#rZk%F%!7jt{l}`O>35J|iqNAZNlcluqoV=p0xg&@ zhCp6{>;#2T)nhZOzU-cOnzSo|A1;HD&;@&fufFrb?>UGmqUF5UR36Jizs%$%qyWo_ zAKcqX>Pk^KM5~=q<4L*ze@DwF=?nb1T?@A{^NT`J#q>Ja;U`CY0pNO0pS1=-Tv);g z>_%Ibv{=-ZE??}$6K)m3%0LYUBU+Q@^$a$JqZWy6>p6`AQ6R!6ErEHk-C-6R1fJyV zehqbBSr_i;G^%vn6fq<=+2fa|Wy}Pd-83OXZXL!V@CcaFrpbNws@NL(I7Iw;p#Fx$ zR1j_E(;TNrAI=j(eBH@N;mkuryzmi9vV}q|`tj%J?(a1c09LMj*xWmkJ+VDLghPUMe33bcyrHV>v~-7f-3h!?}*#v z3ZX|VwP{1Wj@U1WO^Pk1eV3sA;L?=hZx%r9Nz>VJV7cIy_W(oRIRLA;Md>vFoNM{T4Q2HM_Ev$s~Qsn;f)1QRc%`F|0De| zdiJt3VHpLE7ulbz%!uu4Sgt_(@Ubu1>>_p{MHCrbE+8A}i6tO?2hqIE%2y;Qp~ea= zPBDYLj9C8-k&+#JsD3jqw;D#+bR-5lf-ylU!ZlmJgjx#wRzDz=SLOWSN>{er^z$Y2 znm&&h!|iUU<+R2Jo_FPU8Vs<2*$Ks03J7LWjjil`myqIs&tkQ*hxz>R+Z zXhXT~I3qfhfzFsx&<<9KxEO*4IAyFyZJT*C&8Qj#`6`Np>qGb>wIIpIEOo41)*hc# z#3$E;$`i^4tHv`ojq3Ygl!dVQ5Th*7O`JG3w);!_a}fb&LVFnV0;UL8uDBukf}t}@ zvD;g>yN>nm@N>OAo0Dcx8ix7r>9j~%UCSj7j5A}5SIiiTMzwkFt~2mHP#xLgmA7m2 zZv7quKC7VtOOyr&*50y}u5S`M#ufQ@V?i$=@QW;`00DNylEcp@a7 zlW9Ye9+XS`Zv%P3pvZyndTxW0iLG6R89t-*{SnK22J?@W6V^@wG(7SxD`{ptS#M8; zO(QF63*MC)u~C*$OI-;L$O+ns@R} zjxlumh^oaIisFFx@rGkOkF=_4I~aE&hDQGJc~k-)ML5_GUK%-ZFn0vu|zDFC0-D716cj5Mn_9mPJeua&XwE<2lvDH+su*IpyJfp~7e#)O`r1}7l zR~+0?PV`&o9(z*+1|D=Gt;kmSf5$|YH!~P{D)}XQdD?n7mH}7lTv^G_5_j%v=#vk* zBF%;D;V75cfAKDa9Ky6!e;X-#V(;`gBGWTVmuW!nIR?lBF^mH!)IXtNZ{Vq`{zYbl zn67J_{2;e`5MXy%^{)fSN}v->DYg);7|f3Cd%aubw5DDi^t$soO(#;2d}-qS zUUPB(^*Ls`Mg-1*NfFnj()QA{=bSxo-*U0!%f(;c0Qcq(!t~a@0$?pH1_A?}Kge9t zBq)CZw=-T@jyP&#$2HxiBx7y1x+;Oio1di}WAR=?)T9(`hJorx3=1 z7h)lfH-xn-iL)9#%NAk*R8d0~fj6@L1m-YVX~Okyw7Qz!<-$0QO>UvYIieb@0dxpd z3P2w~Vc=~>MJDrxm?$uXp*fo~H8b5x-Tf`l7K3pwL1uO8^06I& zr7^W#yxbE%<0qzTYvY*J%y^ec@2>#0k+sP;YA?**O?!YN7y%G^TT}~-?+w=1Y)g+x zl^(ObODmd`iO>2A#$}ZB;5hzC1@_*UsVQ=HC#xreFjdOYTkG}dH;9Wl_|r!-n);k) zdWkLr?5L#OzDachyqkyzJo=wmxEbQxTR{HA2xYhUHTtsseb28TBXABd0TBE4Z%>KF z_oau~64jMT045a0H(x>}CX1}QT1`&GA1@2(mHQ;tzGonsHOvmttIXw10(Y+~G-m!% zKM;TlN^D|PkhG|!7;K2FyPl32xU#2kIn*R66lGwpHz7(wvZIuU;1x5IAef3zL(;-Y zo>=#`W{nJwq`{6Y&x_#Z1=mj-%Qk|YAY6l5r4w4V4v1TowrcJ*Qndr>T5N)yrw0jD zOC+p2#2HOA4jB|Z zhdm48o#{AvZOyFTWY?lew4nm>KX>LZ-rD^4hwRun_twdfnzfWJ-S8TWIJzgt#g2B1 z9wWd`t&NkXp=W7D&2Ep>Zloz+?sCU%T|V{dxk19JCINQ1QtFP!kbQ8}aqm#ZBp zieN@o8_x00u{=hYLF1aYofoY?S*_hGkvDYA?Ydw?F zFty4U5M>{R4HjvB=!OA~V%We)d8A4LT#0NULxQBsdMm{q4uNr6gtmv2jwaV7ns^t3 zWy8eFrACDyM-;sHX|Cv$ucuaY%I8nTPMq7?5#{)Y4mnwS){AmHXi$+|c>4|jiqv99nP*F3 zUp@>CXq6ohTQ@YGSF63yF|4`0802!vC5J5C@d5*9?rw@Ob8}_V)#gl89+5(g*fL7Uvj{_Rb_Wh8b-C4&ttd$RU92|M z`x?1U0HjeZgtwLm%&@lh-jP3=7EsO8bOP~?dmOm9S^nXT3O!NCn(;M-b|E^aY0ttb zkf`j?|G~S6ofwdSg1KbqmrTAjPbv6di(LdzBKyz6YCg8e!l%MxDyF}+YZ*S1)UztlpmHtS^Dgnb`gM~B)#DaCvu|z)J^GGl zN|mk*V=2GiqgJN-y*i8T@yN(XG5aqmT$ z9Bd`2{i?A^%Sumzb^BR-GV!}j^PLp*a}PVxc}u&USN9Q;nh>=SgE=d@HB$DKu2${$ zk`Az?(a)hZ6iY2RP9PJl9&~>q3H#oBsG6sGXBf zrC0fy|1K8*iM^36jvumMY()?6d`+d&-*36B?I%cuK-&h#UIBW;VQL`5ZcU>rU9cW z*UiHi6b>u@?B%69tETpE*_O~cUDdnDrVuP#KJ~}G+Nta($jMO&3x*_a;`D5 z%z&}*DeREg_I4mnU)AI8WzH60o3mbk6M^M%s28gjPEx3F-wt0TKPc-4z2C2Pny!OEfM& z{SqE_U}pl6M6~>xDA`L3w^zI+f@L_t5$~D9w?_!_H7f02atl)z%FP4#KKjnzC6lk?tR0o+L#=Fho(0*#x zIXgLyWaLB4pw^^MA;1?fPfX&+(oXf0uvwQpDej}5qk1S|i^?EDTAo;jnC;tgC8I{( z#N!9U&9zorsq0?v&wqNLjfARkZ{1pfq?X#L%3;8{BJDYJ$<;qKm^`NTiN-{%rQE*J z{IkJBH;qK711NdHc9=US$9G}OWHp*-J75*S1du`!A?y|wux8W(#i>FSEC>@yNH|1W z!8ItEC0m=cet?Xc)AZIN zv5kJc?$oviQn(pvZQ~QTPb&4jo1Isa>;s=~-RP#c+PRu74$ja8S9FqXZU=6wctfGF z=shij1v(~$$Oe{L5-_pGi`3m*^=+Ggo?1a`pOs{>K3v^2lkbuDw>>v^_0{FBPEMUF z>&V!I3*2H|ZHFASFh~StF&@X2jwPxY=Fq1N{URvcvY|>bQP}bT4OL&RclvmwPHcec zl%CkPrM|0NML@I9^;toXy-@Y-Fx5bHMZ`*9}qf0CP#WanRIwy;clK0ar zz*iB@mna^3H}5A=sP6E*Zmq)t+9G&3`XTx~s%O*Ip#_cje#y~h2&Wv~SJp0Gu;C?g z5heJF61IlamdA9}2RuS(vJ2Pu$ccFpl3rlYRXAE_Tj;zQeWhg49W(2ovlo}oLeJ0d zkBE-I`Quq1*S9J;5J=wHL?y^HtDiLO;km04X2t>=G3Vr(0giKT$b{3~qG}k46hp!3 zsxMeaZh7Rc!xte^$vQfxC_VquvJjgU4uBGtxFhVf5qzi=KG)W!Cyp0t_pPVnaG**q zuiEpw6A)$MC~_$0ssP@@vd9s{i?f;9QjD~!x%7|ik$SJ7;EV>)^_g^+s&09dSGvhl z>#^+RGyUxhfLk`W@4D7mX~1NGlh2Y5wwQxs3Xi2-!EmEaUq&$i30C{wk)XPasx0rS zeCU*p98z2iPZNmFpu%S*QWobJ9j;^4z~RpN!^`58&}oc<>5X?HdV0Kx>(lU|>twx{dpG_!lO*)|b9#M}JUF9W$bqy3 z<-a^P8-6xV#_3p_LUoFg$P$=xoGa*OFsr3E;%k$Wzk=85*3_ofO+xULrv};7ZHc1k zwyCg>-xG2QRov$Z_nQ=FWo*xVs5(;+@#r7?T8AZ?9pOu6K4Kk?S1%a+EiNx&lk!+CqNkPcT+`dB+>5tZT%j<Ts91u>cHElNLL|>t6`nD|0Rv8%PcD2c`DYb8(B% zY-9UDfm9ElY-;D~)<(jJ0Ol4WuKfHbcp8g8A$^f*fVp^mxEoH8KBum5C3dI49x|Jj zn~p@x@v{^&^I8!i^ad-TnWrxziWzJt17Ogd9u8fIZAKo7Cy$9|Z86u4{Sgl=aZjh4 zlNaN-c9mda0Pd_@Z(X%4uU7}5-1UsEDxnD9_LlSPhI(<((puQ}jL#mBC4Lo?0XNpn z-o86n31O|#=G?fR74$kX5=tmgHuOK2Hir4bh6R};+2e%nnSEmP4tUvQ#g0s$6@C9% z!u5sbjgGaU4P>V_YLsg&7BubdB*KD^8q^So6snGX4fkrFfej0h5x@~<@gQGiPy+ci z%X<4ytF*0@qgKp3LjiJnEhquQM_~?RbW<;VK)U`OCbMn1G}+mMS`ygia~|xIRDS=WJCP%QbID3>v?9dgeiB<||5XsEQO*%C zcM1e&E4So84(^V@Jgs0jaYK#u@y(;drdt82Jtja02hE}3V-=$&p({*$XIkrt_%2Wb zYjKeekiKbukWGq^jnCZgI?im_3zmw$x3(E>zokza(B2g&LD#iMC&NP`$p{v%$`J1#DW_Xr3o&P%tK^J~8Il^(Qw>*b(Yp zT*$ob*Ktqy=%yml9q8|70Rj<&UsbExmeaumwc?0+)V`?BPN%(Mpv0j)xW+zozg}0M zzO0=J%JfH)u5CV|qJ9_Y0GJG3SAP|G;Syg><_CRt9S$2iphYK$+mtMctHcXQ1qIq>Y4I`>*C?w_n7>U$TRlr__7*X_C zH1l!bX)36_RG;PWhL0Q=5@uXW8|kZIim=eG+Emg$WGJh`B8J{-9qt~CsXFF9w8bJ0 zCSIs#K491h=t%(ysg1sC*jz>}c4En32nz=RsO&6b%RriWN9TXy|1)85U#S(ESfB8L z&CFGd@xp%9G33B&f1K-`rXDoFj&XU5?WEoeXj$59s2b?s8k z=ONT{_VuiGefx=}rt*Y(f?l@F3&cEu^3V7Than9xgPw`MaG{L5OVem0n-@LgDl2RC za1pNG{>vhVXQ=)$+d__=0+8O{z4*Us>l+g5;Te zs69Z(V6Y<5zUX%@u)f>!g+9$a!OR|))Ura04`=mt586Vl#L!PQdK*eMTYn6V1{nrI z0FY2t==EJMnsJl&Vdy(R|D3#42R12!xy|~(!hm(cjvcxH00CtDLD$Ewt3g^?SG12F zvtpb+3{g+Ngx8F(Qi|p{A-PT{sQ%p(7kHj%DT$*t-2V#k3#oZQN;=u_7Q@0`r2pH+gBz6swQ~Z)rFiO5 zU4!mZzCea@G1^Mfo^g5J#!)Lb6(4<-pJsd_sXZM+bMRyHInfe(}L$G#B$f2X7_gc_Wz0`M<12xCR2Gv(16fTri z971@n)%{~VN`w!%sr?HB8pTc%8T==Uh4I6>duX-OAOg}Dnpa`8#OBWHmWj_DsY35{ zhjGb*E#Rsb13IXTQ*adl=;?M03<&zZxtU`5d2~U0Oa1z(#gIYk<`;tRa`Ule!sN4r z-YvQ-u?sAX#s+=o2Qiwx`iBSm?uFrbP3~TN*U^HH-jO)`!R}y)P`Ilvo{e)wk+K5pd%-K(93?AAO7Q z{ z+M6JA(CqeEuOlDfwL(kgn=SjBU|0u6GpB;=KoI)7a%JT$I(Hm7n4x@Oh<6vhh^%J< zTsG9iRI(qfKYj;RC6aMLCuLwik8}~)T&iN=Bo86|TT>>>KLY{`gEkuBSbM1B531rc z0NYj$tId{AsPJoKU`14Guj(t#volrwiSxfxZGpT*q^O0b_LhjIHR1JD+qMfuH&JTSSQojJrHiG- zCj1N=f;DMSnoQ^eK|vOzWQ000FF7&vMTpszA;c068v<=z9s z2HG(PJG@EvGpmchb)3Rr)GcH%Rh>xd{!GzoNr||tin>vbA4sL=AUraA_ecZPpHSr^ zlf8f+WskMrRSZY-)=-yRaN6L?}^NO_c|&5by>CG49#YHdi#~K zrt0M#kWz7e?2bxGG!mjWCkVStvcjP6rct?5maE*{NTpeqpQ>`8m-R;Z${_i^TuOGf8op*_Xr3m9XU>R7;k0blj!ShlR+>0C{7$U@ zV*h|pLKs#I&oDq8*p%N$h9kQFDNB=sCkt&JpJT`Q-zmc(9y+>9mb{D#%OJ`i{kSnY3AN}7<{AQ>7pQ#`V{x!3N z5jF_@Ooc-)i9Zcos9b1iOMvIuM-r1Qi20*1U9a`|vem!M$Bszxg%k92usgs`37ZPN znvdz$(BvwdUPuhUWY(~^SYPp~W`9lJ$-;3!LUXLGRa<=<7j6$((N=lasIg)eu2VIN zZM8)R>S_e@IJ6sX@~;uOe9);@w>*}DJdGFKi|GdUTq6pCv%E#H=>JxS1F`6O?S9yu%fV9Scd^B4jY zQlC9RJ&yco)#-rO2CZ%aG{3L#&W8o{)uoeD7v-(zuUh{qZkV8RzWTy^DW2i6QLch9 zZ233BnnbmSsn8ryvrJeZyVNNP&|efR*Y6$Vo^w>Azwi5S>*YXNpdMj6idRx-=fPF7 zhhDZ?+q;btDEbA??Ft{4iKrgi7E!o`q&{y8wH*Q4MgFTO_*_T{C42!o&5Oj*Zo>Kc zt5hS%`xP#-9v~Z7KxCOxqQQy;Z+m?#oLRi+7y*O1X zfry2HyWl934q2eFwa({}fA{ZwxSUP|W;~}AKRCM8@Ga^3w zRRE|_8+O{*S<9{6H}|@4-8Dn;24Y)gF$DY-fJE7w- zHM<$yRPfS@5c?PBg#6w}%~2wuP0e-D^sk`}QL2vpf`ek4Eb7U$$jqeTr-cYcvS+<4 zw;bQcfa&IK zd+q7XvyG#{M$P8KF#A3+SIDLLKr6gz>7dBj^)W>6VGuW)5le!P#%zX#^lGQ1*!plw zq|TmchIo!8l3SG}7!;JRz4`48xeE*}#G-SnN{m$zc7N|MZ8cNd_tVBkiGylMXhiIS%3e5n` zB#_QM!SN-4SK#0%DA;TGb_XIr=v$Jx%y9_wg(*9nW9-#UK^}7{0hIMB`hgdD-=zNm zl_{;M(x%>yqq~Ofy29$o=AAB5^U|1I3T6=ww?PpCg`96t1PL?B{G?Ej625gBf6BIO z;!4)12ltK3?OI7|Dzy}aF{K{-I zR?cAUNk-8!XXH{04dWemXTjZ~6W)Gl%ko*p=)}yvb_@SJ67?OBuS0$M#L9+*k3FS%>eT59X{iROEPwz(W}#q&0x|i+Q2WK!?c}N= z1_fm9ss0kFlo_Fr1i~fpT&e2H9bYI^JXin}De#O5Jd!fmgAGurA8#|HLdiS1_B?bM zB^UYiD?)UR)TNX@7VDtzmjkupr87f0CqFpI!&z}}r+q$p0J5!KQLgS9A=(|}YP1H< zT;`oU!h-;AVe@c^ud8Ip|+$il}po#6??=%)lCdSuIU99aF%)bbURj9QEL}QZm z*B#rxPO{zk&t&rIFnc^uv%Rk6e9y9B+!wo!KvA$ew4%gOevJHwI@VhVGx_{#_&rh$fhM%XWEB)DstnVvI|iA3ZfYcl`2 zB*e|guVf*^w^RrHw(VIRWv-Wkm@15n;ttbzh0Wzc$hnRZT^Y1oF&{ zIE8?g!4VXGP>l*d)vy6H!$o4=B85hx3T4)sMk!V36nZbXI>s-oJo<5?D%^2I^EwHt zJypczl#$yr(D3~B+${+gKg`v9Iz|=BJi=Fs{RCc1m3jRA#gcy*x^YN{0cagH(OU*{ zCXE37GF>(K;kdq*jSsxGfehKv40er;kcIETft%^*RoCtSmjlC{w;d~IALp%U0AiD; z<#6rltA44gB^hzVMqL)B%GK-FXO0&YoyMko?Y38L=SisWc`82q9KQ- zMV=op;`9nI9wk)f+fo$Y}yDrlVJ>U|d>MTZW}zl&22fUfHzuM~087f(u>CGxAI z+#J`lfLg9>o&wLoyl(j{-qR`ez<4j&?Kdav!^%I*P&(Tq~QjVq4q z>Jat5kt0PeNGns@TyUb}R2UQh00004%9rC15?<5O4Wtg1P7}FxP0xXs8C-P!`RLLuM z+AD#+U)aw-9GQ8t4wpAM>^O4smyH+E{P5C4c{*UqQO8&Iu|LO85}^)F;u%bracM|?d_`q16RwtytCw`t__27Uc-=G@$` ziNMu15-b?jZu6;`C%feZpNXvDKNCgVO%h;@oC(gFB;l%(qa#LY`Zy|_16<~^j@8r} zvmms3KN^>|YAzqBtn34I>ps1;)bG%?q6kd|rW79|(sShsy%G6#be=~tfjt*y4;h(2 zzR!InryGgEy#TIHS3(*pK6BEDhXB~VE?~mk46&?=5%d<3gjk6ni$f1dM^cU?A^FGP zzoY@aSAKXV-dUBh%oQ`K5967$&EybidTzApYc&qRD1A?PWeA|SM2peYR2j04$B(c? z^u1Z8D5|^%a+CM;Vahun2|cRqV1nK`5; - status = "disabled"; - perm-read; - perm-write; - perm-execute; - }; - - ram3x_dma_region: memory@2fc07000 { - compatible = "nordic,owned-memory"; - reg = <0x2fc07000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2fc07000 0x1000>; - - cpuapp_dma_region: memory@680 { - compatible = "zephyr,memory-region"; - reg = <0x680 DT_SIZE_K(2)>; - status = "disabled"; - #memory-region-cells = <0>; - zephyr,memory-region = "DMA_RAM3x_APP"; - }; - - cpurad_dma_region: memory@e80 { - compatible = "zephyr,memory-region"; - reg = <0xe80 0x80>; - status = "disabled"; - #memory-region-cells = <0>; - zephyr,memory-region = "DMA_RAM3x_RAD"; - }; - }; - }; -}; - -&mram1x { - cpurad_rx_partitions: cpurad-rx-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - perm-read; - perm-execute; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - - cpurad_slot0_partition: partition@66000 { - reg = <0x66000 DT_SIZE_K(256)>; - }; - }; - - cpuapp_rx_partitions: cpuapp-rx-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - perm-read; - perm-execute; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_slot0_partition: partition@a6000 { - reg = <0xa6000 DT_SIZE_K(512)>; - }; - - cpuppr_code_partition: partition@126000 { - reg = <0x126000 DT_SIZE_K(28)>; - }; - }; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi deleted file mode 100644 index d3b79120322..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - /omit-if-no-ref/ uart135_default: uart135_default { - group1 { - psels = , - ; - }; - - group2 { - bias-pull-up; - psels = , - ; - }; - }; - - /omit-if-no-ref/ uart135_sleep: uart135_sleep { - group1 { - low-power-enable; - psels = , - , - , - ; - }; - }; - - /omit-if-no-ref/ uart136_default: uart136_default { - group1 { - psels = , - ; - }; - - group2 { - bias-pull-up; - psels = , - ; - }; - }; - - /omit-if-no-ref/ uart136_sleep: uart136_sleep { - group1 { - low-power-enable; - psels = , - , - , - ; - }; - }; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts deleted file mode 100644 index 359c1f84307..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" - -/ { - compatible = "nordic,nrf54h20pdk_nrf54h20-cpuapp"; - model = "Nordic nRF54H20 PDK nRF54H20 Application MCU"; - - chosen { - zephyr,console = &uart136; - zephyr,code-partition = &cpuapp_slot0_partition; - zephyr,flash = &mram1x; - zephyr,sram = &cpuapp_ram0; - }; - - aliases { - led0 = &led0; - led1 = &led1; - led2 = &led2; - led3 = &led3; - sw0 = &button0; - sw1 = &button1; - sw2 = &button2; - sw3 = &button3; - }; - - buttons { - compatible = "gpio-keys"; - - button0: button_0 { - gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 0"; - zephyr,code = ; - }; - - button1: button_1 { - gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - zephyr,code = ; - }; - - button2: button_2 { - gpios = <&gpio0 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - zephyr,code = ; - }; - - button3: button_3 { - gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 3"; - zephyr,code = ; - }; - }; - - leds { - compatible = "gpio-leds"; - - led0: led_0 { - gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - - led1: led_1 { - gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - - led2: led_2 { - gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; - label = "Green LED 2"; - }; - - led3: led_3 { - gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; - label = "Green LED 3"; - }; - }; -}; - -&ram3x_dma_region { - status = "okay"; -}; - -&cpuapp_dma_region { - status = "okay"; -}; - -&cpuapp_rx_partitions { - status = "okay"; -}; - -&cpuppr_vpr { - source-memory = <&cpuppr_code_partition>; - execution-memory = <&cpuppr_ram3x_region>; -}; - -&gpiote130 { - status = "okay"; - owned-channels = <0 1 2 3 4 5 6 7>; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio9 { - status = "okay"; -}; - -&grtc { - status = "okay"; - child-owned-channels = <5 6>; - nonsecure-channels = <5 6>; - owned-channels = <4 5 6>; -}; - -&uart135 { - pinctrl-0 = <&uart135_default>; - pinctrl-1 = <&uart135_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart136 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart136_default>; - pinctrl-1 = <&uart136_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml deleted file mode 100644 index a364c2863d3..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20pdk_nrf54h20_cpuapp -name: nRF54H20-PDK-nRF54H20-Application -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 32 -flash: 368 -supported: - - gpio diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig deleted file mode 100644 index 1f7ef38a7fc..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_ENGA_CPUAPP=y -CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUAPP=y - -CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# Enable GPIO -CONFIG_GPIO=y - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts deleted file mode 100644 index 02213d88645..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" - -/ { - compatible = "nordic,nrf54h20pdk_nrf54h20-cpurad"; - model = "Nordic nRF54H20 PDK nRF54H20 Radio MCU"; - - chosen { - zephyr,console = &uart135; - zephyr,code-partition = &cpurad_slot0_partition; - zephyr,flash = &mram1x; - zephyr,sram = &cpurad_ram0; - }; -}; - -&ram3x_dma_region { - status = "okay"; -}; - -&cpurad_dma_region { - status = "okay"; -}; - -&cpurad_rx_partitions { - status = "okay"; -}; - -&grtc { - status = "okay"; - child-owned-channels = <8 9 10 11 12>; - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, - <108 NRF_DEFAULT_IRQ_PRIORITY>; - nonsecure-channels = <8 9 10 11 12>; - owned-channels = <7 8 9 10 11 12 13 14>; -}; - -&uart135 { - status = "okay"; - memory-regions = <&cpurad_dma_region>; - pinctrl-0 = <&uart135_default>; - pinctrl-1 = <&uart135_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart136 { - pinctrl-0 = <&uart136_default>; - pinctrl-1 = <&uart136_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml deleted file mode 100644 index d1c8548d07d..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20pdk_nrf54h20_cpurad -name: nRF54H20-PDK-nRF54H20-Radio -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 32 -flash: 368 -supported: - - gpio diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig deleted file mode 100644 index 254d8656e61..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_ENGA_CPURAD=y -CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPURAD=y - -CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y From c51a04f50d28190570d1a999590cb428f8694c03 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:23 +0100 Subject: [PATCH 1040/2300] Revert "[nrf fromtree] scripts: west: runners: nrfjprog: add basic support for nRF54H series" This reverts commit 7d9a021c8e97912863848f1b6143c2a637c4f2c7. Signed-off-by: Robert Lubos --- scripts/west_commands/runners/nrf_common.py | 63 ++++++--------------- scripts/west_commands/runners/nrfjprog.py | 6 +- 2 files changed, 18 insertions(+), 51 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 76662c72ea9..93871d831ee 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -24,26 +24,11 @@ ErrNotAvailableBecauseProtection = 24 ErrVerify = 25 -UICR_RANGES = { - 'NRF53_FAMILY': { - '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), - } -} - class NrfBinaryRunner(ZephyrBinaryRunner): '''Runner front-end base class for nrf tools.''' def __init__(self, cfg, family, softreset, dev_id, erase=False, - reset=True, tool_opt=[], force=False, recover=False, - erase_all_uicrs=False): + reset=True, tool_opt=[], force=False, recover=False): super().__init__(cfg) self.hex_ = cfg.hex_file if family and not family.endswith('_FAMILY'): @@ -55,7 +40,6 @@ def __init__(self, cfg, family, softreset, dev_id, erase=False, self.reset = bool(reset) self.force = force self.recover = bool(recover) - self.erase_all_uicrs = bool(erase_all_uicrs) self.tool_opt = [] for opts in [shlex.split(opt) for opt in tool_opt]: @@ -75,8 +59,7 @@ def dev_id_help(cls) -> str: @classmethod def do_add_parser(cls, parser): parser.add_argument('--nrf-family', - choices=['NRF51', 'NRF52', 'NRF53', 'NRF54L', - 'NRF54H', 'NRF91'], + choices=['NRF51', 'NRF52', 'NRF53', 'NRF54L', 'NRF91'], help='''MCU family; still accepted for compatibility only''') parser.add_argument('--softreset', required=False, @@ -92,11 +75,6 @@ def do_add_parser(cls, parser): help='''erase all user available non-volatile memory and disable read back protection before flashing (erases flash for both cores on nRF53)''') - parser.add_argument('--erase-all-uicrs', required=False, - action='store_true', - help='''Erase all UICR registers before flashing - (nRF54H only). When not set, only UICR registers - present in the hex file will be erased.''') parser.set_defaults(reset=True) @@ -185,8 +163,6 @@ def ensure_family(self): self.family = 'NRF53_FAMILY' elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF54LX'): self.family = 'NRF54L_FAMILY' - elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF54HX'): - self.family = 'NRF54H_FAMILY' elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF91X'): self.family = 'NRF91_FAMILY' else: @@ -198,15 +174,21 @@ def hex_refers_region(self, region_start, region_end): return True return False - def hex_get_uicrs(self): - hex_uicrs = {} + def hex_has_uicr_content(self): + # A map from SoCs which need this check to their UICR address + # ranges. If self.family isn't in here, do nothing. + uicr_ranges = { + 'NRF53_FAMILY': ((0x00FF8000, 0x00FF8800), + (0x01FF8000, 0x01FF8800)), + 'NRF91_FAMILY': ((0x00FF8000, 0x00FF8800),), + } - if self.family in UICR_RANGES: - for uicr_core, uicr_range in UICR_RANGES[self.family].items(): - if self.hex_refers_region(*uicr_range): - hex_uicrs[uicr_core] = uicr_range + if self.family not in uicr_ranges: + return - return hex_uicrs + for region_start, region_end in uicr_ranges[self.family]: + if self.hex_refers_region(region_start, region_end): + return True def flush(self, force=False): try: @@ -231,7 +213,7 @@ def flush(self, force=False): # 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 # a warning here will hopefully enhance UX. - if self.hex_get_uicrs(): + if self.hex_has_uicr_content(): self.logger.warning( 'The hex file contains data placed in the UICR, which ' 'may require a full erase before reprogramming. Run ' @@ -284,24 +266,11 @@ def program_hex(self): if self.family == 'NRF53_FAMILY': # nRF53 requires special treatment due to the extra coprocessor. self.program_hex_nrf53(erase_arg, qspi_erase_opt) - elif self.family == 'NRF54H_FAMILY': - self.program_hex_nrf54h() else: self.op_program(self.hex_, erase_arg, qspi_erase_opt, defer=True) self.flush(force=False) - def program_hex_nrf54h(self): - if self.erase_all_uicrs: - uicrs = UICR_RANGES['NRF54H_FAMILY'] - else: - uicrs = self.hex_get_uicrs() - - for uicr_core, range in uicrs.items(): - self.exec_op('erasepage', defer=True, core=uicr_core, page=range[0]) - - self.op_program(self.hex_, 'NO_ERASE', None, defer=True) - def program_hex_nrf53(self, erase_arg, qspi_erase_opt): # program_hex() helper for nRF53. diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index 723080d56c3..c1eebd32914 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -32,8 +32,7 @@ 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, - erase_all_uicrs=args.erase_all_uicrs) + recover=args.recover) def do_get_boards(self): snrs = self.check_output(['nrfjprog', '--ids']) @@ -47,8 +46,7 @@ def do_exec_op(self, op, force=False): # Translate the op families = {'NRF51_FAMILY': 'NRF51', 'NRF52_FAMILY': 'NRF52', - 'NRF53_FAMILY': 'NRF53', 'NRF54L_FAMILY': 'NRF54L', - 'NRF54H_FAMILY': 'NRF54H', 'NRF91_FAMILY': 'NRF91'} + 'NRF53_FAMILY': 'NRF53', 'NRF54L_FAMILY': 'NRF54L', 'NRF91_FAMILY': 'NRF91'} cores = {'NRFDL_DEVICE_CORE_APPLICATION': 'CP_APPLICATION', 'NRFDL_DEVICE_CORE_NETWORK': 'CP_NETWORK'} From eaec19e08d08a6eee29942cc828e647fb84e0946 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:23 +0100 Subject: [PATCH 1041/2300] Revert "[nrf fromtree] scripts: west: runners: nrfjprog: add erasepage op" This reverts commit 16bcdf444079df595651e9bcc37ffe02abea6a36. Signed-off-by: Robert Lubos --- scripts/west_commands/runners/nrfjprog.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index c1eebd32914..15f147a4d87 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -87,9 +87,6 @@ def do_exec_op(self, op, force=False): cmd.append('--reset') if _op['option'] == 'RESET_PIN': cmd.append('--pinreset') - elif op_type == 'erasepage': - cmd.append('--erasepage') - cmd.append(f"0x{_op['page']:08x}") else: raise RuntimeError(f'Invalid operation: {op_type}') From 1dd5d4dbc16272eb34fa0c18bcc987c480259369 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:24 +0100 Subject: [PATCH 1042/2300] Revert "[nrf fromtree] scripts: west: runners: nrfjprog: add option to not erase" This reverts commit 81faa51ddcf11ff19448eff9a41f596c9f681388. Signed-off-by: Robert Lubos --- scripts/west_commands/runners/nrfjprog.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index 15f147a4d87..a28681ae6a5 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -69,8 +69,6 @@ def do_exec_op(self, op, force=False): cmd.append('--sectorerase') elif erase == 'ERASE_PAGES_INCLUDING_UICR': cmd.append('--sectoranduicrerase') - elif erase == 'NO_ERASE': - pass else: raise RuntimeError(f'Invalid erase mode: {erase}') From 6d466da45f508845921deabe6987fc7c955b4f4b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:24 +0100 Subject: [PATCH 1043/2300] Revert "[nrf fromtree] dts: nordic: Include input-event-codes.h from nrf_common.dtsi" This reverts commit 6b7d48c1d361406f740a5c3b70b8d289ef6fd488. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf_common.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/dts/common/nordic/nrf_common.dtsi b/dts/common/nordic/nrf_common.dtsi index cb2df6bcccd..f09557b23de 100644 --- a/dts/common/nordic/nrf_common.dtsi +++ b/dts/common/nordic/nrf_common.dtsi @@ -8,7 +8,6 @@ #include #include #include -#include #include #include From 58e41c990c6e085137e1169bde70fc78d47f533d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:24 +0100 Subject: [PATCH 1044/2300] Revert "[nrf fromtree] tests: arm_irq_vector_table: Add special handling for nRF54H20" This reverts commit 0364029a589ca098d56b772a46ad40cef58b35e5. Signed-off-by: Robert Lubos --- .../arm/arm_irq_vector_table/src/arm_irq_vector_table.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c index 61679107103..f18c30dac9a 100644 --- a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c +++ b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c @@ -27,9 +27,6 @@ #elif defined(CONFIG_SOC_SERIES_NRF54LX) /* For nRF54L Series, use SWI00-02 interrupt lines. */ #define _ISR_OFFSET SWI00_IRQn -#elif defined(CONFIG_SOC_SERIES_NRF54HX) -/* For nRF54H Series, use BELLBOARD_0-2 interrupt lines. */ -#define _ISR_OFFSET BELLBOARD_0_IRQn #else /* For other nRF targets, use TIMER0-2 interrupt lines. */ #define _ISR_OFFSET TIMER0_IRQn @@ -144,8 +141,6 @@ typedef void (*vth)(void); /* Vector Table Handler */ void nrfx_power_clock_irq_handler(void); #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) #define POWER_CLOCK_IRQ_NUM POWER_CLOCK_IRQn -#elif defined(CONFIG_SOC_SERIES_NRF54HX) -#define POWER_CLOCK_IRQ_NUM -1 /* not needed */ #else #define POWER_CLOCK_IRQ_NUM CLOCK_POWER_IRQn #endif @@ -154,7 +149,7 @@ void nrfx_power_clock_irq_handler(void); void timer0_nrf_isr(void); #define TIMER_IRQ_HANDLER timer0_nrf_isr #define TIMER_IRQ_NUM TIMER0_IRQn -#elif defined(CONFIG_SOC_SERIES_NRF54LX) || defined(CONFIG_SOC_SERIES_NRF54HX) +#elif defined(CONFIG_SOC_SERIES_NRF54LX) void nrfx_grtc_irq_handler(void); #define TIMER_IRQ_HANDLER nrfx_grtc_irq_handler #define TIMER_IRQ_NUM GRTC_0_IRQn @@ -167,9 +162,7 @@ void rtc_nrf_isr(void); #define IRQ_VECTOR_TABLE_SIZE (MAX(POWER_CLOCK_IRQ_NUM, MAX(TIMER_IRQ_NUM, _ISR_OFFSET + 2)) + 1) vth __irq_vector_table _irq_vector_table[IRQ_VECTOR_TABLE_SIZE] = { -#if (POWER_CLOCK_IRQ_NUM != -1) [POWER_CLOCK_IRQ_NUM] = nrfx_power_clock_irq_handler, -#endif [TIMER_IRQ_NUM] = TIMER_IRQ_HANDLER, [_ISR_OFFSET] = isr0, isr1, isr2, }; From c8b7fde387914ddd5fd78bd26cc18820ee5bd75a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:24 +0100 Subject: [PATCH 1045/2300] Revert "[nrf fromtree] drivers: timer: nrf_grtc_timer: Add dependency on nRF clock control" This reverts commit 2fccbac518783d064515bd0c0f8334595e18b42c. Signed-off-by: Robert Lubos --- drivers/timer/nrf_grtc_timer.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 8ac357864cc..a706c04bae0 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -7,9 +7,7 @@ #include #include #include -#if defined(CONFIG_CLOCK_CONTROL_NRF) #include -#endif #include #include #include @@ -523,7 +521,6 @@ static int sys_clock_driver_init(void) system_timeout_set(CYC_PER_TICK); } -#if defined(CONFIG_CLOCK_CONTROL_NRF) static const enum nrf_lfclk_start_mode mode = IS_ENABLED(CONFIG_SYSTEM_CLOCK_NO_WAIT) ? CLOCK_CONTROL_NRF_LF_START_NOWAIT @@ -532,7 +529,6 @@ static int sys_clock_driver_init(void) : CLOCK_CONTROL_NRF_LF_START_STABLE); z_nrf_clock_control_lf_on(mode); -#endif return 0; } From 5c8aed218cabafcd9343690f93b296ef62c0f06c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:25 +0100 Subject: [PATCH 1046/2300] Revert "[nrf fromtree] drivers: serial: nrfx: Allow new UARTE instances to be used" This reverts commit a902aa39e7ee0ec5b73556436a331232c59b21ea. Signed-off-by: Robert Lubos --- drivers/serial/Kconfig.nrfx | 45 -------------------- modules/hal_nordic/nrfx/Kconfig | 45 -------------------- modules/hal_nordic/nrfx/nrfx_config.h | 27 ------------ soc/arm/nordic_nrf/Kconfig.peripherals | 27 ------------ soc/arm/nordic_nrf/validate_base_addresses.c | 9 ---- 5 files changed, 153 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 158731404e6..4ea38e7b996 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -90,51 +90,6 @@ nrfx_uart_num = 30 rsource "Kconfig.nrfx_uart_instance" endif -if HAS_HW_NRF_UARTE120 -nrfx_uart_num = 120 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE130 -nrfx_uart_num = 130 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE131 -nrfx_uart_num = 131 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE132 -nrfx_uart_num = 132 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE133 -nrfx_uart_num = 133 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE134 -nrfx_uart_num = 134 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE135 -nrfx_uart_num = 135 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE136 -nrfx_uart_num = 136 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE137 -nrfx_uart_num = 137 -rsource "Kconfig.nrfx_uart_instance" -endif - config NRFX_TIMER0 default y depends on UART_0_NRF_HW_ASYNC_TIMER = 0 \ diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index ee1bd76b52f..d4efbb7cac8 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -637,51 +637,6 @@ config NRFX_UARTE30 depends on $(dt_nodelabel_has_compat,uart30,$(DT_COMPAT_NORDIC_NRF_UARTE)) select NRFX_UARTE -config NRFX_UARTE120 - bool "UARTE120 driver instance" - depends on $(dt_nodelabel_has_compat,uart120,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE130 - bool "UARTE130 driver instance" - depends on $(dt_nodelabel_has_compat,uart130,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE131 - bool "UARTE131 driver instance" - depends on $(dt_nodelabel_has_compat,uart131,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE132 - bool "UARTE132 driver instance" - depends on $(dt_nodelabel_has_compat,uart132,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE133 - bool "UARTE133 driver instance" - depends on $(dt_nodelabel_has_compat,uart133,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE134 - bool "UARTE134 driver instance" - depends on $(dt_nodelabel_has_compat,uart134,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE135 - bool "UARTE135 driver instance" - depends on $(dt_nodelabel_has_compat,uart135,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE136 - bool "UARTE136 driver instance" - depends on $(dt_nodelabel_has_compat,uart136,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE137 - bool "UARTE137 driver instance" - depends on $(dt_nodelabel_has_compat,uart137,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - config NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG bool "UARTE GPIO configuration support" depends on NRFX_UARTE diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index be2f5599f78..215eff5bfcd 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -606,33 +606,6 @@ #ifdef CONFIG_NRFX_UARTE30 #define NRFX_UARTE30_ENABLED 1 #endif -#ifdef CONFIG_NRFX_UARTE120 -#define NRFX_UARTE120_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE130 -#define NRFX_UARTE130_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE131 -#define NRFX_UARTE131_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE132 -#define NRFX_UARTE132_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE133 -#define NRFX_UARTE133_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE134 -#define NRFX_UARTE134_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE135 -#define NRFX_UARTE135_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE136 -#define NRFX_UARTE136_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE137 -#define NRFX_UARTE137_ENABLED 1 -#endif #ifdef CONFIG_NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG #define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 1 #endif diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index da1c5f473c7..5eeff856c96 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -438,33 +438,6 @@ config HAS_HW_NRF_UARTE22 config HAS_HW_NRF_UARTE30 def_bool $(dt_nodelabel_enabled_with_compat,uart30,$(DT_COMPAT_NORDIC_NRF_UARTE)) -config HAS_HW_NRF_UARTE120 - def_bool $(dt_nodelabel_enabled_with_compat,uart120,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE130 - def_bool $(dt_nodelabel_enabled_with_compat,uart130,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE131 - def_bool $(dt_nodelabel_enabled_with_compat,uart131,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE132 - def_bool $(dt_nodelabel_enabled_with_compat,uart132,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE133 - def_bool $(dt_nodelabel_enabled_with_compat,uart133,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE134 - def_bool $(dt_nodelabel_enabled_with_compat,uart134,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE135 - def_bool $(dt_nodelabel_enabled_with_compat,uart135,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE136 - def_bool $(dt_nodelabel_enabled_with_compat,uart136,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE137 - def_bool $(dt_nodelabel_enabled_with_compat,uart137,$(DT_COMPAT_NORDIC_NRF_UARTE)) - config HAS_HW_NRF_USBD def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_USBD)) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 28ec231b132..9daa820efa9 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -214,15 +214,6 @@ CHECK_DT_REG(uart20, NRF_UARTE20); CHECK_DT_REG(uart21, NRF_UARTE21); CHECK_DT_REG(uart22, NRF_UARTE22); CHECK_DT_REG(uart30, NRF_UARTE30); -CHECK_DT_REG(uart120, NRF_UARTE120); -CHECK_DT_REG(uart130, NRF_UARTE130); -CHECK_DT_REG(uart131, NRF_UARTE131); -CHECK_DT_REG(uart132, NRF_UARTE132); -CHECK_DT_REG(uart133, NRF_UARTE133); -CHECK_DT_REG(uart134, NRF_UARTE134); -CHECK_DT_REG(uart135, NRF_UARTE135); -CHECK_DT_REG(uart136, NRF_UARTE136); -CHECK_DT_REG(uart137, NRF_UARTE137); CHECK_DT_REG(uicr, NRF_UICR); CHECK_DT_REG(usbd, NRF_USBD); CHECK_DT_REG(usbreg, NRF_USBREGULATOR); From 7397569110f06dabb3ffbecf8c4f8ff578fd3be5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:25 +0100 Subject: [PATCH 1047/2300] Revert "[nrf fromtree] drivers: serial: Kconfig.nrfx: Filter out options unsupported on nRF54H20" This reverts commit 025cef148ce7682a9906f19626fc29dfe4642ea2. Signed-off-by: Robert Lubos --- drivers/serial/Kconfig.nrfx | 3 ++- drivers/serial/Kconfig.nrfx_uart_instance | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 4ea38e7b996..8995b6b9fbf 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -31,7 +31,8 @@ config UART_NRFX_UARTE config UART_NRFX_UARTE_LEGACY_SHIM bool "Legacy UARTE shim" depends on UART_NRFX_UARTE - depends on !SOC_SERIES_NRF54LX && !SOC_SERIES_NRF54HX + # NRF54L15 need new UARTE driver + depends on !SOC_SERIES_NRF54LX # New shim takes more ROM. Until it is fixed use legacy shim. default y diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index 9e992ca9737..718631a4d09 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -23,7 +23,6 @@ config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT depends on !SOC_SERIES_NRF54LX 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 help From 747c0505d2ef29b6792bfadf3eb35b9fae0a32c0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:25 +0100 Subject: [PATCH 1048/2300] Revert "[nrf fromtree] modules: hal_nordic: Integrate nrf-regtool" This reverts commit e9b2875acd83fe9a21811994aaa31bed30019610. Signed-off-by: Robert Lubos --- modules/hal_nordic/CMakeLists.txt | 16 ------- modules/hal_nordic/Kconfig | 1 - modules/hal_nordic/Kconfig.nrf_regtool | 36 -------------- .../nrf-regtool/nrf-regtoolConfig.cmake | 48 ------------------- .../nrf-regtoolConfigVersion.cmake | 32 ------------- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 3 -- .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 3 -- 7 files changed, 139 deletions(-) delete mode 100644 modules/hal_nordic/Kconfig.nrf_regtool delete mode 100644 modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake delete mode 100644 modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index 6f5364ac8de..693400aba76 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -6,19 +6,3 @@ if (CONFIG_NRF_802154_RADIO_DRIVER OR CONFIG_NRF_802154_SERIALIZATION) endif (CONFIG_NRF_802154_RADIO_DRIVER OR CONFIG_NRF_802154_SERIALIZATION) add_subdirectory_ifdef(CONFIG_HAS_NRFX nrfx) - -if(CONFIG_NRF_REGTOOL_GENERATE_UICR) - list(APPEND nrf_regtool_components GENERATE:UICR) -endif() -if(DEFINED nrf_regtool_components) - find_package(nrf-regtool 5.0.1 - COMPONENTS ${nrf_regtool_components} - PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool - NO_CMAKE_PATH - NO_CMAKE_ENVIRONMENT_PATH - NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_PACKAGE_REGISTRY - NO_CMAKE_SYSTEM_PATH - NO_CMAKE_SYSTEM_PACKAGE_REGISTRY - ) -endif() diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index c9cc93e9329..6f77bbea427 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -236,4 +236,3 @@ endif # NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION endmenu # HAS_NORDIC_DRIVERS rsource "nrfx/Kconfig" -rsource "Kconfig.nrf_regtool" diff --git a/modules/hal_nordic/Kconfig.nrf_regtool b/modules/hal_nordic/Kconfig.nrf_regtool deleted file mode 100644 index 81659bcf0bb..00000000000 --- a/modules/hal_nordic/Kconfig.nrf_regtool +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -menu "nrf-regtool options" - depends on SOC_SERIES_NRF54HX - -config NRF_REGTOOL_GENERATE_UICR - bool "Generate UICR" - help - Generate a UICR hex based on devicetree contents using nrf-regtool. - CPU domains that require UICR allocation aren't bootable without it - being programmed alongside the firmware. - -config NRF_REGTOOL_VERBOSITY - int "Verbosity level of console output" - range 0 3 - default 0 - help - Level of verbose output that nrf-regtool will print to the console. - - 0. Only critical information and warnings. - 1. Print a pretty, human-readable representation of a peripheral's - configuration. This is recommended for inspecting register values. - 2. Print extra details for debugging purposes, such as memory maps of - the peripheral configurations, but in a less readable format. - 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 deleted file mode 100644 index d057c735e3f..00000000000 --- a/modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# 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) - - # 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 ${NRF_REGTOOL} ${verbosity} generate - --peripheral ${peripheral} - --svd-file ${SOC_SVD_FILE} - --dts-file ${ZEPHYR_DTS} - ${bindings_dirs} - --output-file ${generated_hex_file} - ${extra_args} - WORKING_DIRECTORY ${APPLICATION_SOURCE_DIR} - 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() - - -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(operation STREQUAL "GENERATE") - nrf_regtool_generate_hex_from_dts(${peripheral}) - else() - message(FATAL_ERROR "Unrecognized package component: \"${component}\"") - endif() -endforeach() diff --git a/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake b/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake deleted file mode 100644 index e147d1b0532..00000000000 --- a/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -find_program(NRF_REGTOOL nrf-regtool) - -if(NRF_REGTOOL) - execute_process( - COMMAND ${NRF_REGTOOL} --version - OUTPUT_VARIABLE version - RESULT_VARIABLE result - ) - - if(result EQUAL 0 AND version MATCHES "version ([0-9]+[.][0-9]+[.][0-9]+)") - set(PACKAGE_VERSION ${CMAKE_MATCH_1}) - if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION) - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION) - set(PACKAGE_VERSION_EXACT TRUE) - endif() - - message(STATUS - "Found nrf-regtool (found suitable version \"${PACKAGE_VERSION}\", " - "minimum required is \"${PACKAGE_FIND_VERSION}\")" - ) - return() - endif() - endif() -endif() - -# We only get here if we don't pass the version check. -set(PACKAGE_VERSION_UNSUITABLE TRUE) -set(NRF_REGTOOL NRF_REGTOOL-NOTFOUND CACHE INTERNAL "Path to a program") diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index d90f87c0b89..eb56b8c369e 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -11,7 +11,4 @@ config SOC config NUM_IRQS default 471 -config NRF_REGTOOL_GENERATE_UICR - default y - endif # SOC_NRF54H20_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad index 6aae8c3a105..f63b9437775 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -11,7 +11,4 @@ config SOC config NUM_IRQS default 471 -config NRF_REGTOOL_GENERATE_UICR - default y - endif # SOC_NRF54H20_ENGA_CPURAD From ff35ae5da5641bf67f2551348bed7b112d3bd68b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:25 +0100 Subject: [PATCH 1049/2300] Revert "[nrf fromtree] modules: hal_nordic: Set SOC_SVD_FILE" This reverts commit 18f843fab8fa0fbbb8b302b40369974a78f731ae. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/CMakeLists.txt | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index cd8392e118f..f2ddea1a23a 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -154,25 +154,3 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_C if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib_lumos.c) endif() - -# Get the SVD file for the current SoC -macro(mdk_svd_ifdef feature_toggle filename) - if(${feature_toggle}) - set(SOC_SVD_FILE ${MDK_DIR}/${filename} CACHE FILEPATH "Path to a CMSIS-SVD file") - endif() -endmacro() - -mdk_svd_ifdef(CONFIG_SOC_SERIES_NRF51X nrf51.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF52805 nrf52805.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF52810 nrf52810.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF52811 nrf52811.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF52820 nrf52820.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF52832 nrf52.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF52833 nrf52833.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF52840 nrf52840.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUAPP nrf5340_application.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUNET nrf5340_network.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP nrf54h20_enga_application.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD nrf54h20_enga_radiocore.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF9120 nrf9120.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF9160 nrf9160.svd) From 84a151999e0795d0408f9c1c76354716c8ad2a4e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:26 +0100 Subject: [PATCH 1050/2300] Revert "[nrf fromtree] soc: nordic: Add initial support for nRF54H20 EngA" This reverts commit 3e755b05f407d5bbfcdac976c7e19cefa498d864. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/CMakeLists.txt | 6 - modules/hal_nordic/nrfx/nrfx_config.h | 4 - .../nrfx_config_nrf54h20_enga_application.h | 1935 ---------------- .../nrfx_config_nrf54h20_enga_radiocore.h | 2016 ----------------- soc/arm/nordic_nrf/Kconfig | 1 - soc/arm/nordic_nrf/Kconfig.defconfig | 2 +- soc/arm/nordic_nrf/nrf54h/CMakeLists.txt | 7 - .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 14 - .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 14 - .../nrf54h/Kconfig.defconfig.series | 16 - soc/arm/nordic_nrf/nrf54h/Kconfig.series | 16 - soc/arm/nordic_nrf/nrf54h/Kconfig.soc | 37 - soc/arm/nordic_nrf/nrf54h/align.ld | 10 - soc/arm/nordic_nrf/nrf54h/soc.c | 104 - soc/arm/nordic_nrf/nrf54h/soc.h | 12 - 15 files changed, 1 insertion(+), 4193 deletions(-) delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h delete mode 100644 soc/arm/nordic_nrf/nrf54h/CMakeLists.txt delete mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp delete mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad delete mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.series delete mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.series delete mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.soc delete mode 100644 soc/arm/nordic_nrf/nrf54h/align.ld delete mode 100644 soc/arm/nordic_nrf/nrf54h/soc.c delete mode 100644 soc/arm/nordic_nrf/nrf54h/soc.h diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index f2ddea1a23a..20740683a44 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -36,11 +36,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_ENGA_CPUAPP NRF_APPLICATION zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP NRF54H20_ENGA_XXAA - NRF_APPLICATION) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD NRF54H20_ENGA_XXAA - NRF_RADIOCORE) - zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_LOCK ENABLE_APPROTECT) zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_USER_HANDLING @@ -71,7 +66,6 @@ zephyr_library_sources_ifdef(CONFIG_SOC_NRF52833 ${MDK_DIR}/system_nrf5283 zephyr_library_sources_ifdef(CONFIG_SOC_NRF52840 ${MDK_DIR}/system_nrf52840.c) 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) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF91X ${MDK_DIR}/system_nrf91.c) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 215eff5bfcd..d315fd2622c 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -717,10 +717,6 @@ #include #elif defined(NRF5340_XXAA_NETWORK) #include -#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_APPLICATION) - #include -#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_RADIOCORE) - #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) #include #elif defined(NRF54L15_ENGA_XXAA) && defined(NRF_APPLICATION) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h deleted file mode 100644 index e6c79341b9a..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h +++ /dev/null @@ -1,1935 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54H20_ENGA_APPLICATION_H__ -#define NRFX_CONFIG_NRF54H20_ENGA_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_BELLBOARD_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD_ENABLED -#define NRFX_BELLBOARD_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY - * - * Integer value. Minimum: 0. Maximum: 7. - */ -#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY -#endif - -/** - * @brief NRFX_BELLBOARD0_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD0_ENABLED -#define NRFX_BELLBOARD0_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD1_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD1_ENABLED -#define NRFX_BELLBOARD1_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD2_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD2_ENABLED -#define NRFX_BELLBOARD2_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD3_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD3_ENABLED -#define NRFX_BELLBOARD3_ENABLED 0 -#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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 -#endif - -/** - * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e -#endif - -/** - * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 -#endif - -/** - * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 -#endif - -/** - * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 -#endif - -/** - * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f -#endif - -/** - * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 -#endif - -/** - * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df -#endif - -/** - * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf -#endif - -/** - * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e -#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 1 -#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_GPIOTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GPIOTE130_ENABLED -#define NRFX_GPIOTE130_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_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: 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_I2S130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S130_ENABLED -#define NRFX_I2S130_ENABLED 0 -#endif - -/** - * @brief NRFX_I2S131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S131_ENABLED -#define NRFX_I2S131_ENABLED 0 -#endif - -/** - * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#endif - -/** - * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#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_MVDMA_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA_ENABLED -#define NRFX_MVDMA_ENABLED 0 -#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_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_PRS_BOX_6_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_6_ENABLED -#define NRFX_PRS_BOX_6_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_7_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_7_ENABLED -#define NRFX_PRS_BOX_7_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_8_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_8_ENABLED -#define NRFX_PRS_BOX_8_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_9_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_9_ENABLED -#define NRFX_PRS_BOX_9_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_PWM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM120_ENABLED -#define NRFX_PWM120_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM130_ENABLED -#define NRFX_PWM130_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM131_ENABLED -#define NRFX_PWM131_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM132_ENABLED -#define NRFX_PWM132_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM133_ENABLED -#define NRFX_PWM133_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_QDEC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC130_ENABLED -#define NRFX_QDEC130_ENABLED 0 -#endif - -/** - * @brief NRFX_QDEC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC131_ENABLED -#define NRFX_QDEC131_ENABLED 0 -#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_RTC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC130_ENABLED -#define NRFX_RTC130_ENABLED 0 -#endif - -/** - * @brief NRFX_RTC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC131_ENABLED -#define NRFX_RTC131_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_SPIM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM120_ENABLED -#define NRFX_SPIM120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM121_ENABLED -#define NRFX_SPIM121_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM130_ENABLED -#define NRFX_SPIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM131_ENABLED -#define NRFX_SPIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM132_ENABLED -#define NRFX_SPIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM133_ENABLED -#define NRFX_SPIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM134_ENABLED -#define NRFX_SPIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM135_ENABLED -#define NRFX_SPIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM136_ENABLED -#define NRFX_SPIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM137_ENABLED -#define NRFX_SPIM137_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_SPIS120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS120_ENABLED -#define NRFX_SPIS120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS130_ENABLED -#define NRFX_SPIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS131_ENABLED -#define NRFX_SPIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS132_ENABLED -#define NRFX_SPIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS133_ENABLED -#define NRFX_SPIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS134_ENABLED -#define NRFX_SPIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS135_ENABLED -#define NRFX_SPIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS136_ENABLED -#define NRFX_SPIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS137_ENABLED -#define NRFX_SPIS137_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_TIMER120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER120_ENABLED -#define NRFX_TIMER120_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER121_ENABLED -#define NRFX_TIMER121_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER130_ENABLED -#define NRFX_TIMER130_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER131_ENABLED -#define NRFX_TIMER131_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER132_ENABLED -#define NRFX_TIMER132_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER133_ENABLED -#define NRFX_TIMER133_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER134_ENABLED -#define NRFX_TIMER134_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER135_ENABLED -#define NRFX_TIMER135_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER136_ENABLED -#define NRFX_TIMER136_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER137_ENABLED -#define NRFX_TIMER137_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_TWIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM130_ENABLED -#define NRFX_TWIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM131_ENABLED -#define NRFX_TWIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM132_ENABLED -#define NRFX_TWIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM133_ENABLED -#define NRFX_TWIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM134_ENABLED -#define NRFX_TWIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM135_ENABLED -#define NRFX_TWIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM136_ENABLED -#define NRFX_TWIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM137_ENABLED -#define NRFX_TWIM137_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_TWIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS130_ENABLED -#define NRFX_TWIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS131_ENABLED -#define NRFX_TWIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS132_ENABLED -#define NRFX_TWIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS133_ENABLED -#define NRFX_TWIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS134_ENABLED -#define NRFX_TWIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS135_ENABLED -#define NRFX_TWIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS136_ENABLED -#define NRFX_TWIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS137_ENABLED -#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE120_ENABLED -#define NRFX_UARTE120_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE130_ENABLED -#define NRFX_UARTE130_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE131_ENABLED -#define NRFX_UARTE131_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE132_ENABLED -#define NRFX_UARTE132_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE133_ENABLED -#define NRFX_UARTE133_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE134_ENABLED -#define NRFX_UARTE134_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE135_ENABLED -#define NRFX_UARTE135_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE136_ENABLED -#define NRFX_UARTE136_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE137_ENABLED -#define NRFX_UARTE137_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_WDT010_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT010_ENABLED -#define NRFX_WDT010_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT011_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT011_ENABLED -#define NRFX_WDT011_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT131_ENABLED -#define NRFX_WDT131_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT132_ENABLED -#define NRFX_WDT132_ENABLED 0 -#endif - -#endif /* NRFX_CONFIG_NRF54H20_ENGA_APPLICATION_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h deleted file mode 100644 index 7b9a1c4b733..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h +++ /dev/null @@ -1,2016 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_H__ -#define NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_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_BELLBOARD_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD_ENABLED -#define NRFX_BELLBOARD_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY - * - * Integer value. Minimum: 0. Maximum: 7. - */ -#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY -#endif - -/** - * @brief NRFX_BELLBOARD0_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD0_ENABLED -#define NRFX_BELLBOARD0_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD1_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD1_ENABLED -#define NRFX_BELLBOARD1_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD2_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD2_ENABLED -#define NRFX_BELLBOARD2_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD3_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD3_ENABLED -#define NRFX_BELLBOARD3_ENABLED 0 -#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_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#endif - -/** - * @brief NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#endif - -/** - * @brief NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 -#endif - -/** - * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e -#endif - -/** - * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 -#endif - -/** - * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 -#endif - -/** - * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 -#endif - -/** - * @brief NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f -#endif - -/** - * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 -#endif - -/** - * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df -#endif - -/** - * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf -#endif - -/** - * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e -#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_EGU020_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_EGU020_ENABLED -#define NRFX_EGU020_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 1 -#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_GPIOTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GPIOTE130_ENABLED -#define NRFX_GPIOTE130_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_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 0x00000f00 -#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_I2S130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S130_ENABLED -#define NRFX_I2S130_ENABLED 0 -#endif - -/** - * @brief NRFX_I2S131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S131_ENABLED -#define NRFX_I2S131_ENABLED 0 -#endif - -/** - * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 -#endif - -/** - * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000c0 -#endif - -/** - * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#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_MVDMA_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA_ENABLED -#define NRFX_MVDMA_ENABLED 0 -#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_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_PRS_BOX_6_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_6_ENABLED -#define NRFX_PRS_BOX_6_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_7_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_7_ENABLED -#define NRFX_PRS_BOX_7_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_8_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_8_ENABLED -#define NRFX_PRS_BOX_8_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_9_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_9_ENABLED -#define NRFX_PRS_BOX_9_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_PWM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM120_ENABLED -#define NRFX_PWM120_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM130_ENABLED -#define NRFX_PWM130_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM131_ENABLED -#define NRFX_PWM131_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM132_ENABLED -#define NRFX_PWM132_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM133_ENABLED -#define NRFX_PWM133_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_QDEC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC130_ENABLED -#define NRFX_QDEC130_ENABLED 0 -#endif - -/** - * @brief NRFX_QDEC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC131_ENABLED -#define NRFX_QDEC131_ENABLED 0 -#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_RTC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC130_ENABLED -#define NRFX_RTC130_ENABLED 0 -#endif - -/** - * @brief NRFX_RTC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC131_ENABLED -#define NRFX_RTC131_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_SPIM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM120_ENABLED -#define NRFX_SPIM120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM121_ENABLED -#define NRFX_SPIM121_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM130_ENABLED -#define NRFX_SPIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM131_ENABLED -#define NRFX_SPIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM132_ENABLED -#define NRFX_SPIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM133_ENABLED -#define NRFX_SPIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM134_ENABLED -#define NRFX_SPIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM135_ENABLED -#define NRFX_SPIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM136_ENABLED -#define NRFX_SPIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM137_ENABLED -#define NRFX_SPIM137_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_SPIS120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS120_ENABLED -#define NRFX_SPIS120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS130_ENABLED -#define NRFX_SPIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS131_ENABLED -#define NRFX_SPIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS132_ENABLED -#define NRFX_SPIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS133_ENABLED -#define NRFX_SPIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS134_ENABLED -#define NRFX_SPIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS135_ENABLED -#define NRFX_SPIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS136_ENABLED -#define NRFX_SPIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS137_ENABLED -#define NRFX_SPIS137_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_TIMER020_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER020_ENABLED -#define NRFX_TIMER020_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER021_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER021_ENABLED -#define NRFX_TIMER021_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER022_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER022_ENABLED -#define NRFX_TIMER022_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER120_ENABLED -#define NRFX_TIMER120_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER121_ENABLED -#define NRFX_TIMER121_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER130_ENABLED -#define NRFX_TIMER130_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER131_ENABLED -#define NRFX_TIMER131_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER132_ENABLED -#define NRFX_TIMER132_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER133_ENABLED -#define NRFX_TIMER133_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER134_ENABLED -#define NRFX_TIMER134_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER135_ENABLED -#define NRFX_TIMER135_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER136_ENABLED -#define NRFX_TIMER136_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER137_ENABLED -#define NRFX_TIMER137_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_TWIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM130_ENABLED -#define NRFX_TWIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM131_ENABLED -#define NRFX_TWIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM132_ENABLED -#define NRFX_TWIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM133_ENABLED -#define NRFX_TWIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM134_ENABLED -#define NRFX_TWIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM135_ENABLED -#define NRFX_TWIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM136_ENABLED -#define NRFX_TWIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM137_ENABLED -#define NRFX_TWIM137_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_TWIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS130_ENABLED -#define NRFX_TWIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS131_ENABLED -#define NRFX_TWIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS132_ENABLED -#define NRFX_TWIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS133_ENABLED -#define NRFX_TWIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS134_ENABLED -#define NRFX_TWIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS135_ENABLED -#define NRFX_TWIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS136_ENABLED -#define NRFX_TWIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS137_ENABLED -#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE120_ENABLED -#define NRFX_UARTE120_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE130_ENABLED -#define NRFX_UARTE130_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE131_ENABLED -#define NRFX_UARTE131_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE132_ENABLED -#define NRFX_UARTE132_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE133_ENABLED -#define NRFX_UARTE133_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE134_ENABLED -#define NRFX_UARTE134_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE135_ENABLED -#define NRFX_UARTE135_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE136_ENABLED -#define NRFX_UARTE136_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE137_ENABLED -#define NRFX_UARTE137_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_WDT010_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT010_ENABLED -#define NRFX_WDT010_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT011_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT011_ENABLED -#define NRFX_WDT011_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT131_ENABLED -#define NRFX_WDT131_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT132_ENABLED -#define NRFX_WDT132_ENABLED 0 -#endif - -#endif /* NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_H__ */ diff --git a/soc/arm/nordic_nrf/Kconfig b/soc/arm/nordic_nrf/Kconfig index 69d83ae5e9b..0372492cd7d 100644 --- a/soc/arm/nordic_nrf/Kconfig +++ b/soc/arm/nordic_nrf/Kconfig @@ -18,7 +18,6 @@ source "soc/arm/nordic_nrf/*/Kconfig.soc" config NRF_SOC_SECURE_SUPPORTED def_bool !TRUSTED_EXECUTION_NONSECURE || (BUILD_WITH_TFM && TFM_PARTITION_PLATFORM) - depends on !SOC_SERIES_NRF54HX help Hidden function to indicate that that the soc_secure functions are available. diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index ad3c97443ff..879217a92fe 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -11,7 +11,7 @@ source "soc/arm/nordic_nrf/*/Kconfig.defconfig.series" if SYS_CLOCK_EXISTS config CLOCK_CONTROL - default y if !SOC_SERIES_NRF54HX + default y endif # SYS_CLOCK_EXISTS diff --git a/soc/arm/nordic_nrf/nrf54h/CMakeLists.txt b/soc/arm/nordic_nrf/nrf54h/CMakeLists.txt deleted file mode 100644 index 8b4df42fa55..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library_sources(soc.c) - -# 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) diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp deleted file mode 100644 index eb56b8c369e..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ /dev/null @@ -1,14 +0,0 @@ -# Nordic Semiconductor nRF54H20 Application MCU - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54H20_ENGA_CPUAPP - -config SOC - default "nrf54h20_enga_cpuapp" - -config NUM_IRQS - default 471 - -endif # SOC_NRF54H20_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad deleted file mode 100644 index f63b9437775..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ /dev/null @@ -1,14 +0,0 @@ -# Nordic Semiconductor nRF54H20 Radio MCU - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54H20_ENGA_CPURAD - -config SOC - default "nrf54h20_enga_cpurad" - -config NUM_IRQS - default 471 - -endif # SOC_NRF54H20_ENGA_CPURAD diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.series deleted file mode 100644 index ddc902d213e..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.series +++ /dev/null @@ -1,16 +0,0 @@ -# Nordic Semiconductor nRF54H MCU line - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_SERIES_NRF54HX - -rsource "Kconfig.defconfig.nrf54h*" - -config SOC_SERIES - default "nrf54h" - -config CACHE_NRF_CACHE - default y if EXTERNAL_CACHE - -endif # SOC_SERIES_NRF54HX diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.series b/soc/arm/nordic_nrf/nrf54h/Kconfig.series deleted file mode 100644 index 0b896f477ac..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.series +++ /dev/null @@ -1,16 +0,0 @@ -# Nordic Semiconductor nRF54H MCU line - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_NRF54HX - bool "Nordic Semiconductor nRF54H series MCU" - select ARM - select ARMV8_M_DSP - select CPU_CORTEX_M33 - select SOC_FAMILY_NRF - select HAS_NRFX - select HAS_NORDIC_DRIVERS - select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE - help - Enable support for nRF54H MCU series diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc deleted file mode 100644 index 9c065e79eaf..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc +++ /dev/null @@ -1,37 +0,0 @@ -# Nordic Semiconductor nRF54H MCU line - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_NRF54H20 - bool "nRF54H20" - depends on SOC_SERIES_NRF54HX - -if SOC_NRF54H20 - -choice - prompt "nRF54H20 MCU Selection" - -config SOC_NRF54H20_ENGA_CPUAPP - bool "nRF54H20 ENGA CPUAPP" - select CPU_HAS_ARM_MPU - select CPU_HAS_ARM_SAU - select CPU_HAS_DCACHE - select CPU_HAS_ICACHE - select CPU_HAS_FPU - -config SOC_NRF54H20_ENGA_CPURAD - bool "nRF54H20 ENGA CPURAD" - select CPU_HAS_ARM_MPU - select CPU_HAS_ARM_SAU - select CPU_HAS_DCACHE - select CPU_HAS_ICACHE - select CPU_HAS_FPU - -endchoice - -config NRF_ENABLE_ICACHE - bool "Instruction cache (I-Cache)" - default y - -endif # SOC_NRF54H20 diff --git a/soc/arm/nordic_nrf/nrf54h/align.ld b/soc/arm/nordic_nrf/nrf54h/align.ld deleted file mode 100644 index 0905aa7f7bc..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/align.ld +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA. - * SPDX-License-Identifier: Apache-2.0 - */ - -SECTION_PROLOGUE(.align16,,) -{ - . = (ALIGN(16) > 0 ? ALIGN(16) : 16) - 1; - BYTE(0); -} GROUP_LINK_IN(ROMABLE_REGION) diff --git a/soc/arm/nordic_nrf/nrf54h/soc.c b/soc/arm/nordic_nrf/nrf54h/soc.c deleted file mode 100644 index 9fefd414152..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/soc.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); - -#if defined(NRF_APPLICATION) -#define HSFLL_NODE DT_NODELABEL(cpuapp_hsfll) -#elif defined(NRF_RADIOCORE) -#define HSFLL_NODE DT_NODELABEL(cpurad_hsfll) -#endif - -#define FICR_ADDR_GET(node_id, name) \ - DT_REG_ADDR(DT_PHANDLE_BY_NAME(node_id, nordic_ficrs, name)) + \ - DT_PHA_BY_NAME(node_id, nordic_ficrs, name, offset) - -static void power_domain_init(void) -{ - /* - * Set: - * - LRCCONF010.POWERON.MAIN: 1 - * - LRCCONF010.POWERON.ACT: 1 - * - LRCCONF010.RETAIN.MAIN: 1 - * - LRCCONF010.RETAIN.ACT: 1 - * - * This is done here at boot so that when the idle routine will hit - * WFI the power domain will be correctly retained. - */ - - nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, true); - nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, true); - - nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, true); - nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, true); - -#if defined(CONFIG_SOC_NRF54H20_ENGA_CPUAPP) - nrf_lrcconf_poweron_force_set(NRF_LRCCONF000, NRF_LRCCONF_POWER_DOMAIN_0, true); -#endif -} - -static int trim_hsfll(void) -{ - NRF_HSFLL_Type *hsfll = (NRF_HSFLL_Type *)DT_REG_ADDR(HSFLL_NODE); - nrf_hsfll_trim_t trim = { - .vsup = sys_read32(FICR_ADDR_GET(HSFLL_NODE, vsup)), - .coarse = sys_read32(FICR_ADDR_GET(HSFLL_NODE, coarse)), - .fine = sys_read32(FICR_ADDR_GET(HSFLL_NODE, fine)) - }; - - LOG_DBG("Trim: HSFLL VSUP: 0x%.8x", trim.vsup); - LOG_DBG("Trim: HSFLL COARSE: 0x%.8x", trim.coarse); - LOG_DBG("Trim: HSFLL FINE: 0x%.8x", trim.fine); - - nrf_hsfll_clkctrl_mult_set(hsfll, - DT_PROP(HSFLL_NODE, clock_frequency) / - DT_PROP(DT_CLOCKS_CTLR(HSFLL_NODE), clock_frequency)); - nrf_hsfll_trim_set(hsfll, &trim); - - nrf_hsfll_task_trigger(hsfll, NRF_HSFLL_TASK_FREQ_CHANGE); -#if defined(CONFIG_SOC_NRF54H20_ENGA_CPUAPP) || defined(CONFIG_SOC_NRF54H20_ENGA_CPURAD) - /* In this HW revision, HSFLL task frequency change needs to be - * triggered additional time to take effect. - */ - nrf_hsfll_task_trigger(hsfll, NRF_HSFLL_TASK_FREQ_CHANGE); -#endif - - LOG_DBG("NRF_HSFLL->TRIM.VSUP = %d", hsfll->TRIM.VSUP); - LOG_DBG("NRF_HSFLL->TRIM.COARSE = %d", hsfll->TRIM.COARSE); - LOG_DBG("NRF_HSFLL->TRIM.FINE = %d", hsfll->TRIM.FINE); - - return 0; -} - -static int nordicsemi_nrf54h_init(void) -{ -#if defined(CONFIG_NRF_ENABLE_ICACHE) - sys_cache_instr_enable(); -#endif - - power_domain_init(); - - trim_hsfll(); - - return 0; -} - -void arch_busy_wait(uint32_t time_us) -{ - nrfx_coredep_delay_us(time_us); -} - -SYS_INIT(nordicsemi_nrf54h_init, PRE_KERNEL_1, 0); diff --git a/soc/arm/nordic_nrf/nrf54h/soc.h b/soc/arm/nordic_nrf/nrf54h/soc.h deleted file mode 100644 index 9a44ab24982..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/soc.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef SOC_ARM_NORDIC_NRF_NRF54H_SOC_H_ -#define SOC_ARM_NORDIC_NRF_NRF54H_SOC_H_ - -#include - -#endif /* SOC_ARM_NORDIC_NRF_NRF54H_SOC_H_ */ From d4f5330a20b0a637056bcd04686c671670417611 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:26 +0100 Subject: [PATCH 1051/2300] Revert "[nrf fromtree] modules: hal_nordic: Use common nrfx_config section for GRTC" This reverts commit 23bd29072f8c16ef0ce26bee318a97d0dd34bc79. Signed-off-by: Robert Lubos --- drivers/timer/nrf_grtc_timer.c | 14 +------ modules/hal_nordic/nrfx/nrfx_config.h | 21 ---------- .../nrfx_config_nrf54l15_enga_application.h | 38 +++++++++++++------ 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index a706c04bae0..dc6ac410905 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -13,18 +13,6 @@ #include #include -#define GRTC_NODE DT_NODELABEL(grtc) - -/* Ensure that GRTC properties in devicetree are defined correctly. */ -#if !DT_NODE_HAS_PROP(GRTC_NODE, owned_channels) -#error GRTC owned-channels DT property is not defined -#endif -#define OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(owned_channels) -#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels) -#if ((OWNED_CHANNELS_MASK | CHILD_OWNED_CHANNELS_MASK) != OWNED_CHANNELS_MASK) -#error GRTC child-owned-channels DT property must be a subset of owned-channels -#endif - #define CHAN_COUNT NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS #define EXT_CHAN_COUNT (CHAN_COUNT - 1) /* The reset value of waketime is 1, which doesn't seem to work. @@ -34,6 +22,8 @@ #define WAKETIME (4) #define TIMEOUT (WAKETIME + 1) +#define GRTC_NODE DT_NODELABEL(grtc) + #ifndef GRTC_SYSCOUNTERL_VALUE_Msk #define GRTC_SYSCOUNTERL_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERL_VALUE_Msk #endif diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index d315fd2622c..543329b4a30 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -675,27 +675,6 @@ #define NRF_PERIPH(P) P##_S #endif -/* If the GRTC system timer driver is to be used, prepare definitions required - * by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and - * NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree. - */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) -#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ - BIT(DT_PROP_BY_IDX(node_id, prop, idx)) -#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ - (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ - (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ - NRFX_CONFIG_BIT_DT, (|))), \ - (0))) - -#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ - (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ - ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) -#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ - (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ - DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ - #include #if defined(NRF51) #include 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 a694a07955d..46b0aa0eff7 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h @@ -249,21 +249,37 @@ #define NRFX_GRTC_ENABLED 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 11 -#endif - /** * @brief GRTC CC channels ownership mask. */ #ifndef NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK -#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK 0x000007ff -#endif +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) +#if DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), owned_channels) +#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ + BIT(DT_PROP_BY_IDX(node_id, prop, idx)) +#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ + (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ + (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ + NRFX_CONFIG_BIT_DT, (|))), \ + (0))) + +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ + (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ + ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ + (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ + DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) + +#if ((NRFX_CONFIG_GRTC_MASK_DT(owned_channels) | \ + NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) != NRFX_CONFIG_GRTC_MASK_DT(owned_channels)) +#error "`child-owned-channels` property must be a subset of `owned-channels` property" +#endif +#else +#error "property `owned-channels` does not exist" +#endif /* DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), owned_channels) */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ + +#endif /* NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK */ /** * @brief NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY From 4cc89779e14f85f50f1651c79d4c7df80aa5460a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:26 +0100 Subject: [PATCH 1052/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx_glue: Include cmsis_core_m_defaults.h" This reverts commit 39d25074c235a69b5c9d756f9285d4ed93d32609. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/nrfx_glue.h | 7 ------- soc/arm/nordic_nrf/nrf54l/soc.h | 2 ++ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/modules/hal_nordic/nrfx/nrfx_glue.h b/modules/hal_nordic/nrfx/nrfx_glue.h index c521461fe6b..5d0dd360623 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.h +++ b/modules/hal_nordic/nrfx/nrfx_glue.h @@ -7,13 +7,6 @@ #ifndef NRFX_GLUE_H__ #define NRFX_GLUE_H__ -#if defined(CONFIG_CPU_CORTEX_M) -/* Workaround for missing __ICACHE_PRESENT and __DCACHE_PRESENT symbols in MDK - * SoC definitions. To be removed when this is fixed. - */ -#include -#endif - #include #include #include diff --git a/soc/arm/nordic_nrf/nrf54l/soc.h b/soc/arm/nordic_nrf/nrf54l/soc.h index b775fa9d0f3..721e9336989 100644 --- a/soc/arm/nordic_nrf/nrf54l/soc.h +++ b/soc/arm/nordic_nrf/nrf54l/soc.h @@ -11,6 +11,8 @@ #ifndef _NORDICSEMI_NRF54L_SOC_H_ #define _NORDICSEMI_NRF54L_SOC_H_ +#define __ICACHE_PRESENT 1 + #include #define FLASH_PAGE_ERASE_MAX_TIME_US 8000UL From 916a32f3e9512c515704599d320ac4af65950a24 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:26 +0100 Subject: [PATCH 1053/2300] Revert "[nrf fromtree] dts: Add initial support for nRF54H20 EngA SoC" This reverts commit 1c3ff0d3e866ff8e99072980ff661a193b607372. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 38 --- dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 38 --- dts/common/nordic/nrf54h20_enga.dtsi | 310 --------------------- dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 35 --- 4 files changed, 421 deletions(-) delete mode 100644 dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi delete mode 100644 dts/arm/nordic/nrf54h20_enga_cpurad.dtsi delete mode 100644 dts/common/nordic/nrf54h20_enga.dtsi delete mode 100644 dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi deleted file mode 100644 index f51528d5733..00000000000 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuapp {}; -systick: &cpuapp_systick {}; -nvic: &cpuapp_nvic {}; - -/delete-node/ &cpuppr; -/delete-node/ &cpurad; -/delete-node/ &cpurad_peripherals; -/delete-node/ &cpurad_ppb; -/delete-node/ &cpurad_ram0; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuapp_nvic>; - ranges; - }; -}; - -&cpuapp_ppb { - compatible = "simple-bus"; - ranges; -}; - -&gpiote130 { - interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&grtc { - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; -}; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi deleted file mode 100644 index cb2767381da..00000000000 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpurad {}; -systick: &cpurad_systick {}; -nvic: &cpurad_nvic {}; - -/delete-node/ &cpuapp; -/delete-node/ &cpuapp_peripherals; -/delete-node/ &cpuapp_ppb; -/delete-node/ &cpuapp_ram0; -/delete-node/ &cpuppr; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpurad_nvic>; - ranges; - }; -}; - -&cpurad_ppb { - compatible = "simple-bus"; - ranges; -}; - -&gpiote130 { - interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&grtc { - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; -}; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi deleted file mode 100644 index 1b8f7b6f9e8..00000000000 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#include - -/delete-node/ &sw_pwm; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpuapp: cpu@2 { - compatible = "arm,cortex-m33"; - reg = <2>; - device_type = "cpu"; - clock-frequency = ; - }; - - cpurad: cpu@3 { - compatible = "arm,cortex-m33"; - reg = <3>; - device_type = "cpu"; - clock-frequency = ; - }; - - cpuppr: cpu@d { - compatible = "nordic,vpr"; - reg = <13>; - device_type = "cpu"; - clock-frequency = ; - riscv,isa = "rv32emc"; - nordic,bus-width = <32>; - }; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - - cpurad_uicr_ext: memory@e1ff000 { - reg = <0xe1ff000 DT_SIZE_K(2)>; - }; - - cpuapp_uicr_ext: memory@e1ff800 { - reg = <0xe1ff800 DT_SIZE_K(2)>; - }; - }; - - clocks { - fll16m: fll16m { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - }; - - soc { - #address-cells = <1>; - #size-cells = <1>; - - mram1x: mram@e000000 { - compatible = "nordic,mram"; - reg = <0xe000000 DT_SIZE_K(2048)>; - write-block-size = <16>; - }; - - cpuapp_uicr: uicr@fff8000 { - 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 { - compatible = "nordic,nrf-ficr"; - reg = <0xfffe000 DT_SIZE_K(2)>; - #nordic,ficr-cells = <1>; - }; - - cpuapp_ram0: sram@22000000 { - compatible = "mmio-sram"; - reg = <0x22000000 DT_SIZE_K(32)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x22000000 0x8000>; - }; - - cpurad_ram0: sram@23000000 { - compatible = "mmio-sram"; - reg = <0x23000000 DT_SIZE_K(64)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x23000000 0x10000>; - }; - - cpuapp_peripherals: peripheral@52000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x52000000 0x1000000>; - - cpuapp_hsfll: clock@d000 { - compatible = "nordic,nrf-hsfll"; - #clock-cells = <0>; - reg = <0xd000 0x1000>; - clocks = <&fll16m>; - clock-frequency = ; - nordic,ficrs = - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; - nordic,ficr-names = "vsup", "coarse", "fine"; - }; - }; - - cpurad_peripherals: peripheral@53000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x53000000 0x1000000>; - - cpurad_hsfll: clock@d000 { - compatible = "nordic,nrf-hsfll"; - #clock-cells = <0>; - reg = <0xd000 0x1000>; - clocks = <&fll16m>; - clock-frequency = ; - nordic,ficrs = - <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP>, - <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1>, - <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1>; - nordic,ficr-names = "vsup", "coarse", "fine"; - }; - }; - - global_peripherals: peripheral@5f000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x5f000000 0x1000000>; - - cpuppr_vpr: vpr@908000 { - compatible = "nordic,nrf-vpr-coprocessor"; - reg = <0x908000 0x1000>; - status = "disabled"; - cpu = <13>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x908000 0x4000>; - - cpuppr_clic: interrupt-controller@1000 { - compatible = "nordic,nrf-clic"; - reg = <0x1000 0x3000>; - status = "disabled"; - #interrupt-cells = <2>; - interrupt-controller; - #address-cells = <1>; - }; - }; - - gpiote130: gpiote@934000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x934000 0x1000>; - status = "disabled"; - instance = <130>; - }; - - gpio0: gpio@938000 { - compatible = "nordic,nrf-gpio"; - reg = <0x938000 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <12>; - port = <0>; - }; - - gpio1: gpio@938200 { - compatible = "nordic,nrf-gpio"; - reg = <0x938200 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <12>; - port = <1>; - }; - - gpio2: gpio@938400 { - compatible = "nordic,nrf-gpio"; - reg = <0x938400 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <12>; - port = <2>; - }; - - gpio6: gpio@938c00 { - compatible = "nordic,nrf-gpio"; - reg = <0x938c00 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - ngpios = <14>; - port = <6>; - }; - - gpio7: gpio@938e00 { - compatible = "nordic,nrf-gpio"; - reg = <0x938e00 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - ngpios = <8>; - port = <7>; - }; - - gpio9: gpio@939200 { - compatible = "nordic,nrf-gpio"; - reg = <0x939200 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <6>; - port = <9>; - }; - - grtc: grtc@99c000 { - compatible = "nordic,nrf-grtc"; - reg = <0x99c000 0x1000>; - status = "disabled"; - cc-num = <16>; - }; - - uart135: uart@9c6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9c6000 0x1000>; - status = "disabled"; - current-speed = <115200>; - interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - uart136: uart@9d5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9d5000 0x1000>; - status = "disabled"; - current-speed = <115200>; - interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; - }; - }; - }; - - cpuapp_ppb: cpuapp-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - - cpuapp_nvic: interrupt-controller@e000e100 { - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - #interrupt-cells = <2>; - interrupt-controller; - #address-cells = <1>; - }; - }; - - cpurad_ppb: cpurad-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpurad_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - - cpurad_nvic: interrupt-controller@e000e100 { - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - #interrupt-cells = <2>; - interrupt-controller; - #address-cells = <1>; - }; - }; -}; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi deleted file mode 100644 index d42a815a4b2..00000000000 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuppr {}; -clic: &cpuppr_clic {}; - -/delete-node/ &cpuapp; -/delete-node/ &cpuapp_peripherals; -/delete-node/ &cpuapp_ppb; -/delete-node/ &cpuapp_ram0; -/delete-node/ &cpurad; -/delete-node/ &cpurad_peripherals; -/delete-node/ &cpurad_ppb; -/delete-node/ &cpurad_ram0; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuppr_clic>; - ranges; - }; -}; - -&gpiote130 { - interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&grtc { - interrupts = <108 NRF_DEFAULT_IRQ_PRIORITY>; -}; From f2aeb837659f7664204d1caa930cb09385e1e9ed Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:26 +0100 Subject: [PATCH 1054/2300] Revert "[nrf fromtree] dts: Add and extend Nordic bindings needed for nRF54H20" This reverts commit da8b5b2e9bda4482b0b8ef95f5c6e05d27c653c9. Signed-off-by: Robert Lubos --- dts/bindings/arm/nordic,nrf-uicr-v2.yaml | 26 ------ dts/bindings/clock/nordic,nrf-hfxo.yaml | 2 +- dts/bindings/clock/nordic,nrf-hsfll.yaml | 65 -------------- dts/bindings/clock/nordic,nrf-lfxo.yaml | 2 +- dts/bindings/cpu/nordic,vpr.yaml | 18 ---- dts/bindings/gpio/nordic,nrf-gpiote.yaml | 4 +- .../interrupt-controller/nordic,nrf-clic.yaml | 19 ---- dts/bindings/mtd/nordic,mram.yaml | 12 --- dts/bindings/mtd/nordic,owned-partitions.yaml | 89 ------------------- .../reserved-memory/nordic,owned-memory.yaml | 46 ---------- .../riscv/nordic,nrf-vpr-coprocessor.yaml | 29 ------ 11 files changed, 3 insertions(+), 309 deletions(-) delete mode 100644 dts/bindings/arm/nordic,nrf-uicr-v2.yaml delete mode 100644 dts/bindings/clock/nordic,nrf-hsfll.yaml delete mode 100644 dts/bindings/cpu/nordic,vpr.yaml delete mode 100644 dts/bindings/interrupt-controller/nordic,nrf-clic.yaml delete mode 100644 dts/bindings/mtd/nordic,mram.yaml delete mode 100644 dts/bindings/mtd/nordic,owned-partitions.yaml delete mode 100644 dts/bindings/reserved-memory/nordic,owned-memory.yaml delete mode 100644 dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml diff --git a/dts/bindings/arm/nordic,nrf-uicr-v2.yaml b/dts/bindings/arm/nordic,nrf-uicr-v2.yaml deleted file mode 100644 index f509fdf4061..00000000000 --- a/dts/bindings/arm/nordic,nrf-uicr-v2.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic UICR v2 (User Information Configuration Registers) - -compatible: "nordic,nrf-uicr-v2" - -include: base.yaml - -properties: - reg: - required: true - - domain: - type: int - required: true - 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/bindings/clock/nordic,nrf-hfxo.yaml b/dts/bindings/clock/nordic,nrf-hfxo.yaml index cd82e1c34d3..dc99c67e5cc 100644 --- a/dts/bindings/clock/nordic,nrf-hfxo.yaml +++ b/dts/bindings/clock/nordic,nrf-hfxo.yaml @@ -5,7 +5,7 @@ description: Nordic nRF high-frequency crystal oscillator compatible: "nordic,nrf-hfxo" -include: fixed-clock.yaml +include: [fixed-clock.yaml] properties: clock-frequency: diff --git a/dts/bindings/clock/nordic,nrf-hsfll.yaml b/dts/bindings/clock/nordic,nrf-hsfll.yaml deleted file mode 100644 index 3614d80870f..00000000000 --- a/dts/bindings/clock/nordic,nrf-hsfll.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic nRF HSFLL - - The HSFLL mixed-mode IP generates several clock frequencies in the range from - 64 MHz to 400 MHz (in steps of 16 MHz). - - Usage example: - - hsfll: clock@deadbeef { - compatible = "nordic,nrf-hsfll"; - reg = <0xdeadbeef 0x1000>; - clocks = <&fll16m>; - clock-frequency = ; - nordic,ficrs = <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; - nordic,ficr-names = "vsup", "coarse", "fine"; - }; - - Required FICR entries are for VSUP, COARSE and FINE trim values. - -compatible: "nordic,nrf-hsfll" - -include: [base.yaml, fixed-clock.yaml, nordic-nrf-ficr-client.yaml] - -properties: - reg: - required: true - - clocks: - required: true - - clock-frequency: - enum: - - 64000000 - - 80000000 - - 96000000 - - 112000000 - - 128000000 - - 144000000 - - 160000000 - - 176000000 - - 192000000 - - 208000000 - - 224000000 - - 240000000 - - 256000000 - - 272000000 - - 288000000 - - 304000000 - - 320000000 - - 336000000 - - 352000000 - - 368000000 - - 384000000 - - 400000000 - - nordic,ficrs: - required: true - - nordic,ficr-names: - required: true diff --git a/dts/bindings/clock/nordic,nrf-lfxo.yaml b/dts/bindings/clock/nordic,nrf-lfxo.yaml index 328c374769c..f0090ff4a81 100644 --- a/dts/bindings/clock/nordic,nrf-lfxo.yaml +++ b/dts/bindings/clock/nordic,nrf-lfxo.yaml @@ -5,7 +5,7 @@ description: Nordic nRF low-frequency crystal oscillator compatible: "nordic,nrf-lfxo" -include: fixed-clock.yaml +include: [fixed-clock.yaml] properties: clock-frequency: diff --git a/dts/bindings/cpu/nordic,vpr.yaml b/dts/bindings/cpu/nordic,vpr.yaml deleted file mode 100644 index 11146f89c51..00000000000 --- a/dts/bindings/cpu/nordic,vpr.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic Semiconductor RISC-V VPR CPU - -compatible: "nordic,vpr" - -include: riscv,cpus.yaml - -properties: - nordic,bus-width: - type: int - enum: - - 32 - - 64 - required: true - description: - Bus width of the CPU. diff --git a/dts/bindings/gpio/nordic,nrf-gpiote.yaml b/dts/bindings/gpio/nordic,nrf-gpiote.yaml index 4bb09574e9b..cefc3385afe 100644 --- a/dts/bindings/gpio/nordic,nrf-gpiote.yaml +++ b/dts/bindings/gpio/nordic,nrf-gpiote.yaml @@ -5,9 +5,7 @@ description: NRF5 GPIOTE node compatible: "nordic,nrf-gpiote" -include: - - base.yaml - - nordic,split-channels.yaml +include: base.yaml properties: reg: diff --git a/dts/bindings/interrupt-controller/nordic,nrf-clic.yaml b/dts/bindings/interrupt-controller/nordic,nrf-clic.yaml deleted file mode 100644 index f570e668ea5..00000000000 --- a/dts/bindings/interrupt-controller/nordic,nrf-clic.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic VPR CLIC - -compatible: "nordic,nrf-clic" - -include: [interrupt-controller.yaml, base.yaml] - -properties: - reg: - required: true - - "#interrupt-cells": - const: 2 - -interrupt-cells: - - irq - - priority diff --git a/dts/bindings/mtd/nordic,mram.yaml b/dts/bindings/mtd/nordic,mram.yaml deleted file mode 100644 index dac7d14305d..00000000000 --- a/dts/bindings/mtd/nordic,mram.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic MRAM - -compatible: nordic,mram - -include: soc-nv-flash.yaml - -properties: - reg: - required: true diff --git a/dts/bindings/mtd/nordic,owned-partitions.yaml b/dts/bindings/mtd/nordic,owned-partitions.yaml deleted file mode 100644 index bf42c13346a..00000000000 --- a/dts/bindings/mtd/nordic,owned-partitions.yaml +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic Owned Partitions - - Memory partition table with permission attributes common to its partitions. - This is a special case of the Nordic Owned Memory binding. - - Every compatible node is expected to be a child of a memory node, where the - listed partitions belong. - - A single memory node can contain multiple partition tables, each with a - different set of permissions. For each such table, the smallest memory region - spanning the contained partitions will be recorded in the UICR. These regions - are allowed to contain gaps between the partitions, but this is discouraged. - - Example: - - mram1x: mram@e000000 { - compatible = "nordic,mram"; - reg = <0xe000000 0x200000>; - ... - - rx-partitions { - compatible = "nordic,owned-partitions"; - perm-read; - perm-execute; - #address-cells = <1>; - #size-cells = <1>; - - slot0_partition: partition@c0000 { - label = "image-0"; - reg = <0xc0000 0x40000>; - }; - }; - - rw-partitions { - compatible = "nordic,owned-partitions"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - - slot1_partition: partition@100000 { - label = "image-1"; - reg = <0x100000 0x50000>; - }; - storage_partition: partition@150000 { - label = "storage"; - reg = <0x150000 0x6000>; - }; - }; - }; - - From this example, two memory regions will be inferred: - - - 0x0E0C0000--0x0E100000, with read & execute permissions, containing the - partition labeled "image-0". - - 0x0E100000--0x0E156000, with read & write permissions, containing the - partitions labeled "image-1" and "storage". - -compatible: "nordic,owned-partitions" - -include: - - name: nordic,owned-memory.yaml - property-blocklist: - - reg - -properties: - "#address-cells": - required: true - - "#size-cells": - required: true - -child-binding: - description: | - Partitions in the table are defined as subnodes. Each partition must have a - size and an offset relative to the base address of the parent memory node. - - include: - - name: base.yaml - property-blocklist: - - compatible - - properties: - reg: - required: true diff --git a/dts/bindings/reserved-memory/nordic,owned-memory.yaml b/dts/bindings/reserved-memory/nordic,owned-memory.yaml deleted file mode 100644 index 9b13c965ac8..00000000000 --- a/dts/bindings/reserved-memory/nordic,owned-memory.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic Owned Memory - - Memory region with permission attributes. Each enabled region of this kind - 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. - -compatible: "nordic,owned-memory" - -include: base.yaml - -properties: - reg: - required: true - - owner-id: - type: int - description: | - Owner ID of the domain that will own this memory region. If not defined, - the ownership will default to the domain being compiled. - - Note: owner ID is not the same as domain ID; see the product specification - for details. - - perm-read: - type: boolean - description: Owner has read access to the region. - - perm-write: - type: boolean - description: Owner has write access to the region. - - perm-execute: - type: boolean - description: Owner can execute code from the region. - - perm-secure: - type: boolean - description: Owner has secure-only access to the region. - - non-secure-callable: - type: boolean - description: Memory region is used for non-secure-callable code. diff --git a/dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml b/dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml deleted file mode 100644 index 6be94dce25d..00000000000 --- a/dts/bindings/riscv/nordic,nrf-vpr-coprocessor.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -compatible: "nordic,nrf-vpr-coprocessor" - -description: | - VPR coprocessor - - VPR is a RISC-V CPU implementation. VPR instances are exposed to other CPUs as - peripherals. - -include: base.yaml - -properties: - cpu: - type: int - description: | - Processor ID of the VPR core. - - execution-memory: - type: phandle - required: true - description: | - Memory area from which the VPR core will execute. - - source-memory: - type: phandle - description: | - Memory area or partition from which the VPR code will be loaded. From 77a06ee18d64b66057c5c33f68e8ebb6389081cf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:27 +0100 Subject: [PATCH 1055/2300] Revert "[nrf fromtree] dt-bindings: misc: add nordic,nrf-ficr helper definitions" This reverts commit 687f04d8c0064fac013570ae5bfbaf7538cb2672. Signed-off-by: Robert Lubos --- .../misc/nordic-nrf-ficr-nrf54h20-enga.h | 96 ------------------- 1 file changed, 96 deletions(-) delete mode 100644 include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h diff --git a/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h b/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h deleted file mode 100644 index 60b788a3516..00000000000 --- a/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/* autogenerated using Nordic HAL utils/gen_offsets.py script */ - -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ - -#define NRF_FICR_BLE_ADDRTYPE 0x00CU -#define NRF_FICR_BLE_ADDR_0 0x010U -#define NRF_FICR_BLE_ADDR_1 0x014U -#define NRF_FICR_BLE_ER_0 0x018U -#define NRF_FICR_BLE_ER_1 0x01CU -#define NRF_FICR_BLE_ER_2 0x020U -#define NRF_FICR_BLE_ER_3 0x024U -#define NRF_FICR_BLE_IR_0 0x028U -#define NRF_FICR_BLE_IR_1 0x02CU -#define NRF_FICR_BLE_IR_2 0x030U -#define NRF_FICR_BLE_IR_3 0x034U -#define NRF_FICR_NFC_TAGHEADER_0 0x040U -#define NRF_FICR_NFC_TAGHEADER_1 0x044U -#define NRF_FICR_NFC_TAGHEADER_2 0x048U -#define NRF_FICR_NFC_TAGHEADER_3 0x04CU -#define NRF_FICR_INFO_CONFIGID 0x050U -#define NRF_FICR_INFO_PART 0x054U -#define NRF_FICR_INFO_VARIANT 0x058U -#define NRF_FICR_INFO_PACKAGE 0x05CU -#define NRF_FICR_INFO_RAM 0x060U -#define NRF_FICR_INFO_MRAM 0x064U -#define NRF_FICR_INFO_CODEPAGESIZE 0x068U -#define NRF_FICR_INFO_CODESIZE 0x06CU -#define NRF_FICR_INFO_DEVICETYPE 0x070U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALVREF 0x384U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_0 0x388U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_1 0x38CU -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_2 0x390U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALOFFSET 0x394U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_0 0x398U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_1 0x39CU -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_2 0x3A0U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_3 0x3A4U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_4 0x3A8U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_5 0x3ACU -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALIREF 0x3B0U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALVREFTC 0x3B4U -#define NRF_FICR_TRIM_GLOBAL_NFCT_BIASCFG 0x3BCU -#define NRF_FICR_TRIM_GLOBAL_CANPLL_TRIM_CTUNE 0x3C0U -#define NRF_FICR_TRIM_GLOBAL_COMP_REFTRIM 0x3D0U -#define NRF_FICR_TRIM_GLOBAL_COMP_RCALTRIM 0x3D4U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP 0x3D8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0 0x3DCU -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_1 0x3E0U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_2 0x3E4U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_3 0x3E8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_4 0x3ECU -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_5 0x3F0U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0 0x3F4U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_1 0x3F8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_2 0x3FCU -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_3 0x400U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_4 0x404U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_5 0x408U -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_0_TRIM 0x40CU -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_1_TRIM 0x410U -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_2_TRIM 0x414U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP 0x418U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_0 0x41CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1 0x420U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_2 0x424U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_3 0x428U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_4 0x42CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_5 0x430U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_0 0x434U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1 0x438U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_2 0x43CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_3 0x440U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_4 0x444U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_5 0x448U -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_0_TRIM 0x44CU -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_1_TRIM 0x450U -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_2_TRIM 0x454U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL0 0x458U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL1 0x45CU -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL2 0x460U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_RXCTRL 0x464U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_OVRRXTRIMCODE 0x468U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_RXAGC_CALIBRATION 0x46CU -#define NRF_FICR_TRIM_RADIOCORE_RADIO_PVTTOT 0x470U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_KDTC 0x474U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_TXHFGAIN 0x478U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_PVTTOFIX 0x47CU -#define NRF_FICR_TRIM_RADIOCORE_RADIO_LOOPGAIN 0x480U - -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ */ From 94f970613d1f724b7b0323ee1852bf5a86ce0401 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:27 +0100 Subject: [PATCH 1056/2300] Revert "[nrf fromtree] dts: Move nrf_common.dtsi to the common directory" This reverts commit f01b9b89d0f9244f4804632f8df617a5767cc493. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf51822.dtsi | 2 +- dts/arm/nordic/nrf52805.dtsi | 7 +------ dts/arm/nordic/nrf52810.dtsi | 7 +------ dts/arm/nordic/nrf52811.dtsi | 7 +------ dts/arm/nordic/nrf52820.dtsi | 7 +------ dts/arm/nordic/nrf52832.dtsi | 7 +------ dts/arm/nordic/nrf52833.dtsi | 7 +------ dts/arm/nordic/nrf52840.dtsi | 7 +------ dts/arm/nordic/nrf5340_cpuapp.dtsi | 7 +------ dts/arm/nordic/nrf5340_cpuappns.dtsi | 7 +------ dts/arm/nordic/nrf5340_cpunet.dtsi | 7 +------ dts/arm/nordic/nrf54l_common.dtsi | 2 +- dts/arm/nordic/nrf91.dtsi | 7 +------ dts/arm/nordic/nrf91ns.dtsi | 7 +------ dts/{common => arm}/nordic/nrf_common.dtsi | 8 ++++++++ 15 files changed, 22 insertions(+), 74 deletions(-) rename dts/{common => arm}/nordic/nrf_common.dtsi (86%) diff --git a/dts/arm/nordic/nrf51822.dtsi b/dts/arm/nordic/nrf51822.dtsi index b64de1d4985..499140a0fb8 100644 --- a/dts/arm/nordic/nrf51822.dtsi +++ b/dts/arm/nordic/nrf51822.dtsi @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ #include -#include +#include "nrf_common.dtsi" / { chosen { diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index c5a184d5e28..c8839897f3c 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -5,7 +5,7 @@ */ #include -#include +#include "nrf_common.dtsi" / { chosen { @@ -321,8 +321,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 1ca4a9ea378..cd2543ce511 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ #include -#include +#include "nrf_common.dtsi" / { chosen { @@ -347,8 +347,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 63b85676587..4034b4958e7 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -5,7 +5,7 @@ */ #include -#include +#include "nrf_common.dtsi" / { chosen { @@ -382,8 +382,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index f93e449b0b2..c702cd45227 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -5,7 +5,7 @@ */ #include -#include +#include "nrf_common.dtsi" / { @@ -399,8 +399,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index ed5a21b9935..d3fb288f449 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ #include -#include +#include "nrf_common.dtsi" / { chosen { @@ -475,8 +475,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 5ac9cb2d2f8..9ba7a85ad4a 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -5,7 +5,7 @@ */ #include -#include +#include "nrf_common.dtsi" / { chosen { @@ -543,8 +543,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 20c18cf3d84..ae7a0b58ae9 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ #include -#include +#include "nrf_common.dtsi" / { chosen { @@ -555,8 +555,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index e40f6241d91..02b115b3cfe 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -5,7 +5,7 @@ */ #include -#include +#include "nrf_common.dtsi" / { cpus { @@ -115,8 +115,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf5340_cpuappns.dtsi b/dts/arm/nordic/nrf5340_cpuappns.dtsi index 6df1be54b34..aa97c337067 100644 --- a/dts/arm/nordic/nrf5340_cpuappns.dtsi +++ b/dts/arm/nordic/nrf5340_cpuappns.dtsi @@ -7,7 +7,7 @@ /* .dtsi header for nRF5340 CPUAPP (Application MCU), Non-Secure domain */ #include -#include +#include "nrf_common.dtsi" / { cpus { @@ -77,8 +77,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index 8a95b3e9985..ae819dfb64f 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -5,7 +5,7 @@ */ #include -#include +#include "nrf_common.dtsi" / { chosen { @@ -351,8 +351,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index 415f2471174..4fb7768bd3f 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -5,7 +5,7 @@ */ #include -#include +#include "nrf_common.dtsi" / { soc { diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 66c80c73a44..05a69b47583 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -5,7 +5,7 @@ */ #include -#include +#include "nrf_common.dtsi" / { cpus { @@ -107,8 +107,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf91ns.dtsi b/dts/arm/nordic/nrf91ns.dtsi index c692873981b..23af6ebe37f 100644 --- a/dts/arm/nordic/nrf91ns.dtsi +++ b/dts/arm/nordic/nrf91ns.dtsi @@ -5,7 +5,7 @@ */ #include -#include +#include "nrf_common.dtsi" / { cpus { @@ -69,8 +69,3 @@ &nvic { arm,num-irq-priority-bits = <3>; }; - -&systick { - /* Use RTC for system clock, instead of SysTick. */ - status = "disabled"; -}; diff --git a/dts/common/nordic/nrf_common.dtsi b/dts/arm/nordic/nrf_common.dtsi similarity index 86% rename from dts/common/nordic/nrf_common.dtsi rename to dts/arm/nordic/nrf_common.dtsi index f09557b23de..8aec8dd0c89 100644 --- a/dts/common/nordic/nrf_common.dtsi +++ b/dts/arm/nordic/nrf_common.dtsi @@ -43,3 +43,11 @@ #pwm-cells = <3>; }; }; + +&systick { + /* + * Nordic SoCs rely by default on the RTC for system clock + * implementation, so the SysTick node is not to be enabled. + */ + status = "disabled"; +}; From 313cdafbe626e1ead63ec0642449ebdb79aba5d1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:27 +0100 Subject: [PATCH 1057/2300] Revert "[nrf fromtree] arch: riscv: remode redundant soc.h includes" This reverts commit d72b6870ae4df3f14ae028588efd5457e105785d. Signed-off-by: Robert Lubos --- include/zephyr/arch/riscv/arch.h | 1 + include/zephyr/arch/riscv/common/linker.ld | 1 + include/zephyr/arch/riscv/irq.h | 1 + 3 files changed, 3 insertions(+) diff --git a/include/zephyr/arch/riscv/arch.h b/include/zephyr/arch/riscv/arch.h index bbde28bdfbe..1ab509c162e 100644 --- a/include/zephyr/arch/riscv/arch.h +++ b/include/zephyr/arch/riscv/arch.h @@ -26,6 +26,7 @@ #endif /* CONFIG_USERSPACE */ #include #include +#include #include #include #include diff --git a/include/zephyr/arch/riscv/common/linker.ld b/include/zephyr/arch/riscv/common/linker.ld index 128f823c4df..eb5c4782441 100644 --- a/include/zephyr/arch/riscv/common/linker.ld +++ b/include/zephyr/arch/riscv/common/linker.ld @@ -11,6 +11,7 @@ * Generic Linker script for the riscv platform */ +#include #include #include diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index fa4b3989f05..c0db9a6687d 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -22,6 +22,7 @@ extern "C" { #include #include #include +#include #endif /* !_ASMLANGUAGE */ /* Exceptions 0-15 (MCAUSE interrupt=0) */ From 5f0b638ce5b79fe521c54549cd263ad3eab29867 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:27 +0100 Subject: [PATCH 1058/2300] Revert "[nrf fromtree] boards nrf5*_bsim: Provide more common headers" This reverts commit ed497d5f8be311b09d0b2179ede71815abf699ac. Signed-off-by: Robert Lubos --- boards/posix/nrf_bsim/board_soc.h | 1 - boards/posix/nrf_bsim/soc/pinctrl_soc.h | 13 ------------- boards/posix/nrf_bsim/soc/soc_nrf_common.h | 13 ------------- 3 files changed, 27 deletions(-) delete mode 100644 boards/posix/nrf_bsim/soc/pinctrl_soc.h delete mode 100644 boards/posix/nrf_bsim/soc/soc_nrf_common.h diff --git a/boards/posix/nrf_bsim/board_soc.h b/boards/posix/nrf_bsim/board_soc.h index d75a187aa61..1b7e7a85c0c 100644 --- a/boards/posix/nrf_bsim/board_soc.h +++ b/boards/posix/nrf_bsim/board_soc.h @@ -29,7 +29,6 @@ #include #include #include "cmsis.h" -#include "soc_nrf_common.h" #if defined(CONFIG_BOARD_NRF52_BSIM) #define OFFLOAD_SW_IRQ SWI0_EGU0_IRQn diff --git a/boards/posix/nrf_bsim/soc/pinctrl_soc.h b/boards/posix/nrf_bsim/soc/pinctrl_soc.h deleted file mode 100644 index 08252b57fee..00000000000 --- a/boards/posix/nrf_bsim/soc/pinctrl_soc.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H -#define BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H - -/* We reuse the real SOC's header: */ -#include "../soc/arm/nordic_nrf/common/pinctrl_soc.h" - -#endif /* BOARDS_POSIX_NRF_BSIM_SOC_PINCTRL_SOC_H */ diff --git a/boards/posix/nrf_bsim/soc/soc_nrf_common.h b/boards/posix/nrf_bsim/soc/soc_nrf_common.h deleted file mode 100644 index a77778de653..00000000000 --- a/boards/posix/nrf_bsim/soc/soc_nrf_common.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef BOARDS_POSIX_NRF_BSIM_SOC_SOC_NRF_COMMON_H -#define BOARDS_POSIX_NRF_BSIM_SOC_SOC_NRF_COMMON_H - -/* We reuse the real SOC's header: */ -#include "../soc/arm/nordic_nrf/common/soc_nrf_common.h" - -#endif /* BOARDS_POSIX_NRF_BSIM_SOC_SOC_NRF_COMMON_H */ From c7064394a9723e7adfcb2825a3ab35101948b4aa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:27 +0100 Subject: [PATCH 1059/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: Clean up and unify a bit cmake code" This reverts commit 291839a90ad8e8564176ca1baa067fd112c24aef. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/CMakeLists.txt | 4 +--- soc/arm/nordic_nrf/common/CMakeLists.txt | 5 +---- soc/arm/nordic_nrf/nrf51/CMakeLists.txt | 13 ++++++++++++- soc/arm/nordic_nrf/nrf52/CMakeLists.txt | 13 ++++++++++++- soc/arm/nordic_nrf/nrf53/CMakeLists.txt | 10 ++++++++-- soc/arm/nordic_nrf/nrf54l/CMakeLists.txt | 4 +++- soc/arm/nordic_nrf/nrf91/CMakeLists.txt | 6 +++++- 7 files changed, 42 insertions(+), 13 deletions(-) diff --git a/soc/arm/nordic_nrf/CMakeLists.txt b/soc/arm/nordic_nrf/CMakeLists.txt index bd7725404b8..3b097d73569 100644 --- a/soc/arm/nordic_nrf/CMakeLists.txt +++ b/soc/arm/nordic_nrf/CMakeLists.txt @@ -1,11 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_library() - add_subdirectory(${SOC_SERIES}) add_subdirectory(common) -zephyr_library_sources( +zephyr_sources( validate_base_addresses.c validate_enabled_instances.c ) diff --git a/soc/arm/nordic_nrf/common/CMakeLists.txt b/soc/arm/nordic_nrf/common/CMakeLists.txt index c894615a700..eb074dd0548 100644 --- a/soc/arm/nordic_nrf/common/CMakeLists.txt +++ b/soc/arm/nordic_nrf/common/CMakeLists.txt @@ -3,13 +3,10 @@ zephyr_library_sources_ifdef(CONFIG_SOC_FAMILY_NRF soc_nrf_common.S) zephyr_library_sources_ifdef(CONFIG_POWEROFF poweroff.c) - zephyr_include_directories(.) -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") - if (CONFIG_TFM_PARTITION_PLATFORM) - zephyr_library_sources(soc_secure.c) + zephyr_sources(soc_secure.c) zephyr_library_include_directories( $/install/interface/include ) diff --git a/soc/arm/nordic_nrf/nrf51/CMakeLists.txt b/soc/arm/nordic_nrf/nrf51/CMakeLists.txt index 35d47fb252b..44d139e422a 100644 --- a/soc/arm/nordic_nrf/nrf51/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf51/CMakeLists.txt @@ -1,3 +1,14 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_library_sources(soc.c) +zephyr_library() + +zephyr_library_sources( + soc.c + ) + +zephyr_library_include_directories( + ${ZEPHYR_BASE}/kernel/include + ${ZEPHYR_BASE}/arch/arm/include + ) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/arm/nordic_nrf/nrf52/CMakeLists.txt b/soc/arm/nordic_nrf/nrf52/CMakeLists.txt index 1b7d4d5257a..04e255a3eb1 100644 --- a/soc/arm/nordic_nrf/nrf52/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf52/CMakeLists.txt @@ -1,6 +1,15 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_library_sources(soc.c) +zephyr_library() + +zephyr_library_sources( + soc.c + ) + +zephyr_library_include_directories( + ${ZEPHYR_BASE}/kernel/include + ${ZEPHYR_BASE}/arch/arm/include + ) if(CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 AND CONFIG_SPI_NRFX_SPIM) message(WARNING "Both SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 and an NRF SPIM driver are enabled, therefore PAN 58 will apply if RXD.MAXCNT == 1 and TXD.MAXCNT <= 1") @@ -13,3 +22,5 @@ if(CONFIG_SOC_NRF52832) endif() endif() endif() + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/arm/nordic_nrf/nrf53/CMakeLists.txt b/soc/arm/nordic_nrf/nrf53/CMakeLists.txt index be275df68f5..b4e82f52c28 100644 --- a/soc/arm/nordic_nrf/nrf53/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf53/CMakeLists.txt @@ -1,8 +1,12 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_library_sources(soc.c) +zephyr_sources( + soc.c + ) -zephyr_library_sources_ifdef(CONFIG_NRF53_SYNC_RTC sync_rtc.c) +zephyr_library_sources_ifdef(CONFIG_NRF53_SYNC_RTC + sync_rtc.c + ) if (CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED AND NOT CONFIG_SYS_CLOCK_EXISTS) @@ -15,3 +19,5 @@ if (CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED AND At your own risk, you can suppress this warning by setting CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED=n.") endif() + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt b/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt index 33036acce8f..914aad289ef 100644 --- a/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt @@ -1,10 +1,12 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -zephyr_library_sources( +zephyr_sources( soc.c ../validate_rram_partitions.c) +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") + if (CONFIG_ELV_GRTC_LFXO_ALLOWED) message(WARNING "WARNING! ELV mode feature is EXPERIMENTAL and may brick your device!") endif() diff --git a/soc/arm/nordic_nrf/nrf91/CMakeLists.txt b/soc/arm/nordic_nrf/nrf91/CMakeLists.txt index 35d47fb252b..7424bb9f7b9 100644 --- a/soc/arm/nordic_nrf/nrf91/CMakeLists.txt +++ b/soc/arm/nordic_nrf/nrf91/CMakeLists.txt @@ -1,3 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_library_sources(soc.c) +zephyr_sources( + soc.c + ) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") From 5f60079333e3fe568065f269ca58824a7fb8e8b5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:28 +0100 Subject: [PATCH 1060/2300] Revert "[nrf fromtree] scripts: west: runners: nrf: fix UICR check" This reverts commit eeff1d08217eb50208903e5f7de58ab9146e8e1c. Signed-off-by: Robert Lubos --- scripts/west_commands/runners/nrf_common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 93871d831ee..788021c6191 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -178,9 +178,9 @@ def hex_has_uicr_content(self): # A map from SoCs which need this check to their UICR address # ranges. If self.family isn't in here, do nothing. uicr_ranges = { - 'NRF53_FAMILY': ((0x00FF8000, 0x00FF8800), - (0x01FF8000, 0x01FF8800)), - 'NRF91_FAMILY': ((0x00FF8000, 0x00FF8800),), + 'NRF53': ((0x00FF8000, 0x00FF8800), + (0x01FF8000, 0x01FF8800)), + 'NRF91': ((0x00FF8000, 0x00FF8800),), } if self.family not in uicr_ranges: From 559206f87c07f3fd671712b577264303e40818dc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:28 +0100 Subject: [PATCH 1061/2300] Revert "[nrf fromtree] dts: bindings: misc: add nordic-nrf-ficr-client" This reverts commit e01d3bcd33bea6d95fe5c015b6460594bc7ac5a5. Signed-off-by: Robert Lubos --- dts/bindings/misc/nordic-nrf-ficr-client.yaml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 dts/bindings/misc/nordic-nrf-ficr-client.yaml diff --git a/dts/bindings/misc/nordic-nrf-ficr-client.yaml b/dts/bindings/misc/nordic-nrf-ficr-client.yaml deleted file mode 100644 index 06a1e727f3f..00000000000 --- a/dts/bindings/misc/nordic-nrf-ficr-client.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -properties: - nordic,ficrs: - type: phandle-array - description: | - FICR entries, e.g. <&ficr OFFSET>. Available offsets (or FICR entries) are - available at . - - nordic,ficr-names: - type: string-array - description: | - Names of each nordic,ficrs entry. From 686634fc123694d913b304ea52b9d6e3bfdeb3d8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:28 +0100 Subject: [PATCH 1062/2300] Revert "[nrf fromtree] dts: bindings: arm: nordic,nrf-ficr: add #nordic,ficr-cells" This reverts commit 3963e0f14c72a90daa268f813b2a4cd95cd2374e. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf51822.dtsi | 1 - dts/arm/nordic/nrf52805.dtsi | 1 - dts/arm/nordic/nrf52810.dtsi | 1 - dts/arm/nordic/nrf52811.dtsi | 1 - dts/arm/nordic/nrf52820.dtsi | 1 - dts/arm/nordic/nrf52832.dtsi | 1 - dts/arm/nordic/nrf52833.dtsi | 1 - dts/arm/nordic/nrf52840.dtsi | 1 - dts/arm/nordic/nrf5340_cpuapp.dtsi | 1 - dts/arm/nordic/nrf5340_cpunet.dtsi | 1 - dts/arm/nordic/nrf54l15_cpuapp.dtsi | 1 - dts/arm/nordic/nrf91.dtsi | 1 - dts/bindings/misc/nordic,nrf-ficr.yaml | 8 -------- 13 files changed, 20 deletions(-) diff --git a/dts/arm/nordic/nrf51822.dtsi b/dts/arm/nordic/nrf51822.dtsi index 499140a0fb8..020711a7e7f 100644 --- a/dts/arm/nordic/nrf51822.dtsi +++ b/dts/arm/nordic/nrf51822.dtsi @@ -24,7 +24,6 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index c8839897f3c..a54e8eca9c6 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -28,7 +28,6 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index cd2543ce511..ce5a2bce779 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -32,7 +32,6 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 4034b4958e7..9c9a3fa6b77 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -36,7 +36,6 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index c702cd45227..c210a7c23aa 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -37,7 +37,6 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index d3fb288f449..2e1fd68946b 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -32,7 +32,6 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 9ba7a85ad4a..d55f0f6df9e 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -36,7 +36,6 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index ae7a0b58ae9..e833835198b 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -32,7 +32,6 @@ ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; reg = <0x10000000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index 02b115b3cfe..bc6b5316519 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -41,7 +41,6 @@ ficr: ficr@ff0000 { compatible = "nordic,nrf-ficr"; reg = <0xff0000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index ae819dfb64f..d930cf603c0 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -35,7 +35,6 @@ ficr: ficr@1ff0000 { compatible = "nordic,nrf-ficr"; reg = <0x01ff0000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/arm/nordic/nrf54l15_cpuapp.dtsi b/dts/arm/nordic/nrf54l15_cpuapp.dtsi index df4ccc52294..7e90c8b1213 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp.dtsi @@ -51,7 +51,6 @@ ficr: ficr@ffc000 { compatible = "nordic,nrf-ficr"; reg = <0xffc000 0x1000>; - #nordic,ficr-cells = <1>; }; sram0: memory@20000000 { diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 05a69b47583..a9f067a7e5a 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -92,7 +92,6 @@ ficr: ficr@ff0000 { compatible = "nordic,nrf-ficr"; reg = <0xff0000 0x1000>; - #nordic,ficr-cells = <1>; status = "okay"; }; diff --git a/dts/bindings/misc/nordic,nrf-ficr.yaml b/dts/bindings/misc/nordic,nrf-ficr.yaml index ca199c24f07..bea0762573e 100644 --- a/dts/bindings/misc/nordic,nrf-ficr.yaml +++ b/dts/bindings/misc/nordic,nrf-ficr.yaml @@ -7,11 +7,3 @@ include: base.yaml properties: reg: required: true - - "#nordic,ficr-cells": - type: int - required: true - const: 1 - -nordic,ficr-cells: - - offset From 6d615d2ec70ca72e0e8031427e765027004b54b9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:28 +0100 Subject: [PATCH 1063/2300] Revert "[nrf fromtree] dts: bindings: nordic,nrf-ficr: move to misc folder" This reverts commit 9cac0ccffcdd0955503bec03bda595411b28721e. Signed-off-by: Robert Lubos --- dts/bindings/{misc => arm}/nordic,nrf-ficr.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dts/bindings/{misc => arm}/nordic,nrf-ficr.yaml (100%) diff --git a/dts/bindings/misc/nordic,nrf-ficr.yaml b/dts/bindings/arm/nordic,nrf-ficr.yaml similarity index 100% rename from dts/bindings/misc/nordic,nrf-ficr.yaml rename to dts/bindings/arm/nordic,nrf-ficr.yaml From 6b2f4e5b07f6b891a5c8df7f38a3f9dd82b0d97d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:28 +0100 Subject: [PATCH 1064/2300] Revert "[nrf fromtree] arch: riscv: make __soc_is_irq optional" This reverts commit 9133757d0ba41da4fff94e85a0289ecd23d1ff8b. Signed-off-by: Robert Lubos --- arch/riscv/Kconfig | 7 ------ arch/riscv/core/isr.S | 13 +++------- include/zephyr/arch/riscv/irq.h | 6 ++--- soc/riscv/common/riscv-privileged/soc_irq.S | 27 +++++++++++++++++++++ soc/riscv/espressif_esp32/esp32c3/soc_irq.S | 6 +++++ soc/riscv/ite_ec/common/soc_irq.S | 18 ++++++++++++++ soc/riscv/openisa_rv32m1/soc_irq.S | 10 ++++++++ 7 files changed, 66 insertions(+), 21 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index a816d1c5501..708c529f237 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -165,13 +165,6 @@ config RISCV_HAS_CLIC help Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). -config RISCV_SOC_EXCEPTION_FROM_IRQ - bool - help - Option selected by SoCs that require a custom mechanism to check if - an exception is the result of an interrupt or not. If selected, - __soc_is_irq() needs to be implemented by the SoC. - config RISCV_SOC_INTERRUPT_INIT bool "SOC-based interrupt initialization" help diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index 982e6777b36..558d2a41fbe 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -51,9 +51,7 @@ /* imports */ GDATA(_sw_isr_table) -#ifdef CONFIG_RISCV_SOC_EXCEPTION_FROM_IRQ GTEXT(__soc_is_irq) -#endif GTEXT(__soc_handle_irq) GTEXT(_Fault) #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE @@ -93,8 +91,7 @@ GTEXT(_isr_wrapper) * what standard behavior is defined). Hence, the arch level code expects * the following functions to be provided at the SOC level: * - * - __soc_is_irq (optional): decide if we're handling an interrupt or an - exception + * - __soc_is_irq: decide if we're handling an interrupt or an exception * - __soc_handle_irq: handle SoC-specific details for a pending IRQ * (e.g. clear a pending bit in a SoC-specific register) * @@ -287,14 +284,10 @@ no_fp: /* increment _current->arch.exception_depth */ * function (that needs to be implemented by each SOC). The result is * returned via register a0 (1: interrupt, 0 exception) */ -#ifdef CONFIG_RISCV_SOC_EXCEPTION_FROM_IRQ jal ra, __soc_is_irq + + /* If a0 != 0, jump to is_interrupt */ bnez a0, is_interrupt -#else - csrr t0, mcause - srli t0, t0, RISCV_MCAUSE_IRQ_POS - bnez t0, is_interrupt -#endif /* * If the exception is the result of an ECALL, check whether to diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index c0db9a6687d..84d3a4949a9 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -40,11 +40,9 @@ extern "C" { #define RISCV_IRQ_MEXT 11 #ifdef CONFIG_64BIT -#define RISCV_MCAUSE_IRQ_POS 63U -#define RISCV_MCAUSE_IRQ_BIT BIT64(RISCV_MCAUSE_IRQ_POS) +#define RISCV_MCAUSE_IRQ_BIT (1 << 63) #else -#define RISCV_MCAUSE_IRQ_POS 31U -#define RISCV_MCAUSE_IRQ_BIT BIT(RISCV_MCAUSE_IRQ_POS) +#define RISCV_MCAUSE_IRQ_BIT (1 << 31) #endif #ifndef _ASMLANGUAGE diff --git a/soc/riscv/common/riscv-privileged/soc_irq.S b/soc/riscv/common/riscv-privileged/soc_irq.S index acf7e724aea..377edbf600d 100644 --- a/soc/riscv/common/riscv-privileged/soc_irq.S +++ b/soc/riscv/common/riscv-privileged/soc_irq.S @@ -32,3 +32,30 @@ SECTION_FUNC(exception.other, __soc_handle_irq) /* Return */ ret + +/* + * __soc_is_irq is defined as .weak to allow re-implementation by + * SOCs that do not truly follow the riscv privilege specification. + */ +WTEXT(__soc_is_irq) + +/* + * SOC-specific function to determine if the exception is the result of a + * an interrupt or an exception + * return 1 (interrupt) or 0 (exception) + * + */ +SECTION_FUNC(exception.other, __soc_is_irq) + /* Read mcause and check if interrupt bit is set */ + csrr t0, mcause + li t1, RISCV_MCAUSE_IRQ_BIT + and t0, t0, t1 + + /* If interrupt bit is not set, return with 0 */ + addi a0, x0, 0 + beqz t0, not_interrupt + addi a0, a0, 1 + +not_interrupt: + /* return */ + ret diff --git a/soc/riscv/espressif_esp32/esp32c3/soc_irq.S b/soc/riscv/espressif_esp32/esp32c3/soc_irq.S index 6ce11ae6a81..c1ad164c153 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc_irq.S +++ b/soc/riscv/espressif_esp32/esp32c3/soc_irq.S @@ -7,9 +7,15 @@ #include /* Exports */ +GTEXT(__soc_is_irq) GTEXT(__soc_handle_irq) GTEXT(soc_intr_get_next_source) +SECTION_FUNC(exception.other, __soc_is_irq) + csrr a0, mcause + srli a0, a0, 31 + ret + SECTION_FUNC(exception.other, __soc_handle_irq) addi sp, sp,-4 sw ra, 0x00(sp) diff --git a/soc/riscv/ite_ec/common/soc_irq.S b/soc/riscv/ite_ec/common/soc_irq.S index ceb0f3afecb..a412ca6a796 100644 --- a/soc/riscv/ite_ec/common/soc_irq.S +++ b/soc/riscv/ite_ec/common/soc_irq.S @@ -25,3 +25,21 @@ GTEXT(__soc_handle_irq) */ SECTION_FUNC(exception.other, __soc_handle_irq) j get_irq + +/* + * __soc_is_irq is defined as .weak to allow re-implementation by + * SOCs that does not truely follow the riscv privilege specification. + */ +WTEXT(__soc_is_irq) + +/* + * SOC-specific function to determine if the exception is the result of a + * an interrupt or an exception + * return 1 (interrupt) or 0 (exception) + * + */ +SECTION_FUNC(exception.other, __soc_is_irq) + /* Read mcause and check if interrupt bit (bit 31) is set */ + csrr a0, mcause + srli a0, a0, 31 + ret diff --git a/soc/riscv/openisa_rv32m1/soc_irq.S b/soc/riscv/openisa_rv32m1/soc_irq.S index d3059d2bd28..23222ea2c70 100644 --- a/soc/riscv/openisa_rv32m1/soc_irq.S +++ b/soc/riscv/openisa_rv32m1/soc_irq.S @@ -10,12 +10,22 @@ #include /* Exports */ +GTEXT(__soc_is_irq) GTEXT(__soc_handle_irq) #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE GTEXT(__soc_save_context) GTEXT(__soc_restore_context) #endif +/* + * Whether we're in an IRQ is bog-standard RISC-V on this SoC: + * yes if the top mcause bit is set, otherwise no. + */ +SECTION_FUNC(exception.other, __soc_is_irq) + csrr a0, mcause + srli a0, a0, 31 + ret + /* * With a0 == irq_num, this is equivalent to: * From 10e4079a8a0acc6a1c9c052e547595c6fdf7b25d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:28 +0100 Subject: [PATCH 1065/2300] Revert "[nrf fromtree] arch: riscv: add RISCV_HAS_(C|P)LIC from soc/riscv" This reverts commit 617448b1b2f856a53a593876da364d803ff548a5. Signed-off-by: Robert Lubos --- arch/riscv/Kconfig | 12 ------------ soc/riscv/common/riscv-privileged/Kconfig | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 708c529f237..1c5defbacaf 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -153,18 +153,6 @@ config RISCV_SOC_OFFSETS in offsets.h. The last one should not end in a semicolon. See gen_offset.h for more details. -config RISCV_HAS_PLIC - bool - depends on RISCV_PRIVILEGED - help - Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). - -config RISCV_HAS_CLIC - bool - depends on RISCV_PRIVILEGED - help - Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). - config RISCV_SOC_INTERRUPT_INIT bool "SOC-based interrupt initialization" help diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index 10c2e37712b..016919c4661 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -4,6 +4,18 @@ # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 +config RISCV_HAS_PLIC + bool + depends on RISCV_PRIVILEGED + help + Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). + +config RISCV_HAS_CLIC + bool + depends on RISCV_PRIVILEGED + help + Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). + config RISCV_VECTORED_MODE bool "Should the SOC use vectored mode" depends on RISCV_PRIVILEGED From 725c1e3bca89699bb4e68e1545a6cdabb60deab5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:29 +0100 Subject: [PATCH 1066/2300] Revert "[nrf fromtree] soc: riscv: make RISCV_HAS_(C|P)LIC promptless" This reverts commit 7a554229571ac87580d1007b10f55955050a4d6f. Signed-off-by: Robert Lubos --- soc/riscv/andes_v5/ae350/Kconfig.defconfig.series | 3 +++ soc/riscv/andes_v5/ae350/Kconfig.series | 1 - soc/riscv/common/riscv-privileged/Kconfig | 4 ++-- soc/riscv/efinix_sapphire/Kconfig.defconfig | 4 ++++ soc/riscv/efinix_sapphire/Kconfig.soc | 1 - soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 | 3 +++ soc/riscv/litex_vexriscv/Kconfig.defconfig | 3 +++ soc/riscv/microchip_miv/miv/Kconfig.defconfig.series | 3 +++ soc/riscv/microchip_miv/miv/Kconfig.series | 1 - soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series | 3 +++ soc/riscv/microchip_miv/polarfire/Kconfig.series | 1 - soc/riscv/opentitan/Kconfig.defconfig | 3 +++ soc/riscv/opentitan/Kconfig.soc | 1 - soc/riscv/renode_virt/Kconfig.defconfig | 3 +++ soc/riscv/renode_virt/Kconfig.soc | 1 - soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series | 3 +++ soc/riscv/sifive_freedom/e300/Kconfig.series | 1 - soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series | 3 +++ soc/riscv/sifive_freedom/u500/Kconfig.series | 1 - soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series | 3 +++ soc/riscv/sifive_freedom/u700/Kconfig.series | 1 - soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series | 3 +++ soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series | 1 - soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series | 4 ++++ soc/riscv/telink_tlsr/tlsr951x/Kconfig.series | 1 - soc/riscv/virt/Kconfig.defconfig | 3 +++ soc/riscv/virt/Kconfig.soc | 1 - 27 files changed, 46 insertions(+), 14 deletions(-) diff --git a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series index 7b9bbc3eadb..699e54e66b8 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series +++ b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series @@ -24,6 +24,9 @@ config RISCV_GENERIC_TOOLCHAIN config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/andes_v5/ae350/Kconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.series index c2e9b40bfb7..ebf68f7a3aa 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.series +++ b/soc/riscv/andes_v5/ae350/Kconfig.series @@ -5,7 +5,6 @@ config SOC_SERIES_ANDES_AE350 bool "Andes V5 AE350 SoC Series Implementation" select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC select SOC_FAMILY_ANDES_V5 help Enable support for Andes V5 AE350 SoC Series diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index 016919c4661..a4a8da0bf1f 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -5,13 +5,13 @@ # SPDX-License-Identifier: Apache-2.0 config RISCV_HAS_PLIC - bool + bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" depends on RISCV_PRIVILEGED help Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). config RISCV_HAS_CLIC - bool + bool "Does the SOC provide support for a Core-Local Interrupt Controller (CLIC)" depends on RISCV_PRIVILEGED help Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). diff --git a/soc/riscv/efinix_sapphire/Kconfig.defconfig b/soc/riscv/efinix_sapphire/Kconfig.defconfig index 95a33b4ab82..08e2c851a21 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.defconfig +++ b/soc/riscv/efinix_sapphire/Kconfig.defconfig @@ -13,6 +13,10 @@ config RISCV_SOC_INTERRUPT_INIT bool default y +config RISCV_HAS_PLIC + bool + default y + config NUM_IRQS int default 36 diff --git a/soc/riscv/efinix_sapphire/Kconfig.soc b/soc/riscv/efinix_sapphire/Kconfig.soc index 4bad3b5cb79..bf57d9cc541 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.soc +++ b/soc/riscv/efinix_sapphire/Kconfig.soc @@ -12,4 +12,3 @@ config SOC_EFINIX_SAPPHIRE select RISCV_ISA_EXT_ZIFENCEI select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 index 94af3ff773c..0da92e80e36 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 @@ -23,6 +23,9 @@ config RISCV_SOC_INTERRUPT_INIT config RISCV_GP default y +config RISCV_HAS_PLIC + default n + config NUM_IRQS default 87 if NUCLEI_ECLIC default 16 if !NUCLEI_ECLIC diff --git a/soc/riscv/litex_vexriscv/Kconfig.defconfig b/soc/riscv/litex_vexriscv/Kconfig.defconfig index 0088420459f..f3e4c7cc79c 100644 --- a/soc/riscv/litex_vexriscv/Kconfig.defconfig +++ b/soc/riscv/litex_vexriscv/Kconfig.defconfig @@ -9,6 +9,9 @@ config SOC config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 +config RISCV_HAS_PLIC + bool + config NUM_IRQS default 12 diff --git a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series index 35f4365b02b..fc5aaa7c186 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series @@ -11,6 +11,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/microchip_miv/miv/Kconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.series index 9f348619624..2989876c0e0 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.series @@ -8,6 +8,5 @@ config SOC_SERIES_MIV select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC help Enable support for Microchip Mi-V diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series index 5a3f113c13e..f41ae867153 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series @@ -14,6 +14,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.series index 59ec4dbdd7a..9001efc2858 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.series @@ -8,6 +8,5 @@ config SOC_SERIES_POLARFIRE select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC help Enable support for Microchip RISCV 64bit diff --git a/soc/riscv/opentitan/Kconfig.defconfig b/soc/riscv/opentitan/Kconfig.defconfig index 19a72fc70bd..4ec6bffc4e7 100644 --- a/soc/riscv/opentitan/Kconfig.defconfig +++ b/soc/riscv/opentitan/Kconfig.defconfig @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/opentitan/Kconfig.soc b/soc/riscv/opentitan/Kconfig.soc index c76cfe013b1..8270fde110d 100644 --- a/soc/riscv/opentitan/Kconfig.soc +++ b/soc/riscv/opentitan/Kconfig.soc @@ -16,7 +16,6 @@ config SOC_OPENTITAN select RISCV_ISA_EXT_ZBS select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. select RISCV_VECTORED_MODE select GEN_IRQ_VECTOR_TABLE diff --git a/soc/riscv/renode_virt/Kconfig.defconfig b/soc/riscv/renode_virt/Kconfig.defconfig index fab59719595..5d2cd649b0b 100644 --- a/soc/riscv/renode_virt/Kconfig.defconfig +++ b/soc/riscv/renode_virt/Kconfig.defconfig @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/renode_virt/Kconfig.soc b/soc/riscv/renode_virt/Kconfig.soc index ba42c40c28d..5aae660880a 100644 --- a/soc/riscv/renode_virt/Kconfig.soc +++ b/soc/riscv/renode_virt/Kconfig.soc @@ -13,4 +13,3 @@ config SOC_RISCV32_VIRTUAL_RENODE select RISCV_ISA_EXT_C select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI - select RISCV_HAS_PLIC diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series index eaa43e68e70..661fe4ba1eb 100644 --- a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.series index 81634da000d..47ae89e6d4c 100644 --- a/soc/riscv/sifive_freedom/e300/Kconfig.series +++ b/soc/riscv/sifive_freedom/e300/Kconfig.series @@ -7,7 +7,6 @@ config SOC_SERIES_SIFIVE_FREEDOM_E300 bool "SiFive Freedom E300 SOC implementation" select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom FE300 SOC diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series index d306b60252a..3db750cb1a6 100644 --- a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.series index 7335a1a5293..a576dfbc6f7 100644 --- a/soc/riscv/sifive_freedom/u500/Kconfig.series +++ b/soc/riscv/sifive_freedom/u500/Kconfig.series @@ -7,7 +7,6 @@ config SOC_SERIES_SIFIVE_FREEDOM_U500 bool "SiFive Freedom U500 SOC implementation" select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom U500 SOC diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series index a0e730d608f..83165d58870 100644 --- a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.series index 04bdc1fb9b2..613844703c7 100644 --- a/soc/riscv/sifive_freedom/u700/Kconfig.series +++ b/soc/riscv/sifive_freedom/u700/Kconfig.series @@ -7,7 +7,6 @@ config SOC_SERIES_SIFIVE_FREEDOM_U700 bool "SiFive Freedom SOC U700 implementation" select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom U700 SOC diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series index 0f058cb6c25..2dc45e1f347 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series index f392a5d1f97..19cedcefe27 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series @@ -5,6 +5,5 @@ config SOC_SERIES_STARFIVE_JH71XX bool "Starfive JH71XX series" select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC help Enable support for Starfive JH71XX SoC Series. diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series index 2b72ad9960c..5b62959858e 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series @@ -15,6 +15,10 @@ config RISCV_SOC_INTERRUPT_INIT bool default y +config RISCV_HAS_PLIC + bool + default y + config RISCV_GP bool default y diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series index 5d5fc3226e5..5ad3053725e 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series @@ -11,7 +11,6 @@ config SOC_SERIES_TELINK_TLSR951X select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI select RISCV_PRIVILEGED - select RISCV_HAS_PLIC select HAS_TELINK_DRIVERS select ATOMIC_OPERATIONS_BUILTIN select CPU_HAS_FPU diff --git a/soc/riscv/virt/Kconfig.defconfig b/soc/riscv/virt/Kconfig.defconfig index bed5ff8bec7..e0982bc185b 100644 --- a/soc/riscv/virt/Kconfig.defconfig +++ b/soc/riscv/virt/Kconfig.defconfig @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_PLIC + default y + config RISCV_GP default y diff --git a/soc/riscv/virt/Kconfig.soc b/soc/riscv/virt/Kconfig.soc index 59e553a9d7b..9a9168f5a8c 100644 --- a/soc/riscv/virt/Kconfig.soc +++ b/soc/riscv/virt/Kconfig.soc @@ -10,4 +10,3 @@ config SOC_RISCV_VIRT select RISCV_ISA_EXT_C select RISCV select RISCV_PRIVILEGED - select RISCV_HAS_PLIC From 1a38e74dd767e14d6e3b55b6d2d20c3895901d16 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:29 +0100 Subject: [PATCH 1067/2300] Revert "[nrf fromtree] arch: riscv: smp: define MSIP_BASE" This reverts commit b4a4909af17a9d021dd96bb85a0ba5beb06e8154. Signed-off-by: Robert Lubos --- arch/riscv/core/smp.c | 3 +-- soc/riscv/microchip_miv/polarfire/soc.h | 3 +++ soc/riscv/virt/soc.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 99f67f57ecc..928edb63d8f 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -79,8 +79,7 @@ void z_riscv_secondary_cpu_init(int hartid) #ifdef CONFIG_SMP -#define MSIP_BASE 0x2000000UL -#define MSIP(hartid) ((volatile uint32_t *)MSIP_BASE)[hartid] +#define MSIP(hartid) ((volatile uint32_t *)RISCV_MSIP_BASE)[hartid] static atomic_val_t cpu_pending_ipi[CONFIG_MP_MAX_NUM_CPUS]; #define IPI_SCHED 0 diff --git a/soc/riscv/microchip_miv/polarfire/soc.h b/soc/riscv/microchip_miv/polarfire/soc.h index 3bcb9569c6e..f12bea7d533 100644 --- a/soc/riscv/microchip_miv/polarfire/soc.h +++ b/soc/riscv/microchip_miv/polarfire/soc.h @@ -8,4 +8,7 @@ #include + +#define RISCV_MSIP_BASE 0x02000000 + #endif /* __RISCV64_MPFS_SOC_H_ */ diff --git a/soc/riscv/virt/soc.h b/soc/riscv/virt/soc.h index 8aa4238010c..d821c4653e6 100644 --- a/soc/riscv/virt/soc.h +++ b/soc/riscv/virt/soc.h @@ -8,5 +8,6 @@ #define __RISCV_VIRT_SOC_H_ #define SIFIVE_SYSCON_TEST 0x00100000 +#define RISCV_MSIP_BASE 0x02000000 #endif From 46300e83d54622c2743cc6c3e694445a57c114ac Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:29 +0100 Subject: [PATCH 1068/2300] Revert "[nrf fromtree] arch: riscv: offsets: fix header race condition" This reverts commit f6c7f112e82a082efaa0ce5e6e30d2139ebf3c54. Signed-off-by: Robert Lubos --- arch/riscv/core/offsets/offsets.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/riscv/core/offsets/offsets.c b/arch/riscv/core/offsets/offsets.c index 96982341b1a..7730138a376 100644 --- a/arch/riscv/core/offsets/offsets.c +++ b/arch/riscv/core/offsets/offsets.c @@ -16,6 +16,7 @@ #include #include #include +#include #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE #include @@ -24,8 +25,6 @@ #include #endif -#include - /* struct _callee_saved member offsets */ GEN_OFFSET_SYM(_callee_saved_t, sp); GEN_OFFSET_SYM(_callee_saved_t, ra); From 47d90509253927c6ece1b53ef9440bafd5bf9afc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:29 +0100 Subject: [PATCH 1069/2300] Revert "[nrf fromtree] soc: riscv: riscv-privileged: drop soc_common.h" This reverts commit 41d4309b38d1a53e5ce4e6b8b7802091c9434572. Signed-off-by: Robert Lubos --- soc/riscv/andes_v5/ae350/soc.h | 2 ++ .../common/riscv-privileged/soc_common.h | 22 +++++++++++++++++++ soc/riscv/efinix_sapphire/soc.h | 1 + soc/riscv/gd_gd32/gd32vf103/soc.h | 2 ++ soc/riscv/intel_niosv/niosv/soc.h | 1 + soc/riscv/litex_vexriscv/soc.h | 1 + soc/riscv/microchip_miv/miv/soc.h | 2 ++ soc/riscv/microchip_miv/polarfire/soc.h | 1 + soc/riscv/neorv32/soc.h | 2 ++ soc/riscv/opentitan/soc.h | 1 + soc/riscv/renode_virt/soc.h | 2 ++ soc/riscv/sifive_freedom/e300/soc.h | 2 ++ soc/riscv/sifive_freedom/u500/soc.h | 2 ++ soc/riscv/sifive_freedom/u700/soc.h | 2 ++ soc/riscv/starfive_jh71xx/jh71xx/soc.h | 2 ++ soc/riscv/telink_tlsr/tlsr951x/soc.h | 2 ++ soc/riscv/virt/soc.h | 2 ++ 17 files changed, 49 insertions(+) create mode 100644 soc/riscv/common/riscv-privileged/soc_common.h diff --git a/soc/riscv/andes_v5/ae350/soc.h b/soc/riscv/andes_v5/ae350/soc.h index fd3a9e63c0d..95ea7486fd3 100644 --- a/soc/riscv/andes_v5/ae350/soc.h +++ b/soc/riscv/andes_v5/ae350/soc.h @@ -11,6 +11,8 @@ #ifndef __RISCV_ANDES_AE350_SOC_H_ #define __RISCV_ANDES_AE350_SOC_H_ +#include + /* Include CSRs available for Andes V5 SoCs */ #include "soc_v5.h" diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h new file mode 100644 index 00000000000..f8f1c13cb59 --- /dev/null +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017 Jean-Paul Etienne + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file configuration macros for riscv SOCs supporting the riscv + * privileged architecture specification + */ + +#ifndef __SOC_COMMON_H_ +#define __SOC_COMMON_H_ + +#ifndef _ASMLANGUAGE + +#include +#include + +#endif /* !_ASMLANGUAGE */ + +#endif /* __SOC_COMMON_H_ */ diff --git a/soc/riscv/efinix_sapphire/soc.h b/soc/riscv/efinix_sapphire/soc.h index 5530af16729..1d566e2f293 100644 --- a/soc/riscv/efinix_sapphire/soc.h +++ b/soc/riscv/efinix_sapphire/soc.h @@ -7,6 +7,7 @@ #ifndef __RISCV32_EFINIX_SAPPHIRE_SOC_H_ #define __RISCV32_EFINIX_SAPPHIRE_SOC_H_ +#include "soc_common.h" #include #include diff --git a/soc/riscv/gd_gd32/gd32vf103/soc.h b/soc/riscv/gd_gd32/gd32vf103/soc.h index ad2add6fa80..14cdd6b733c 100644 --- a/soc/riscv/gd_gd32/gd32vf103/soc.h +++ b/soc/riscv/gd_gd32/gd32vf103/soc.h @@ -11,4 +11,6 @@ #ifndef RISCV_GD32VF103_SOC_H_ #define RISCV_GD32VF103_SOC_H_ +#include + #endif /* RISCV_GD32VF103_SOC_H */ diff --git a/soc/riscv/intel_niosv/niosv/soc.h b/soc/riscv/intel_niosv/niosv/soc.h index 87458c91dff..8c10fec4540 100644 --- a/soc/riscv/intel_niosv/niosv/soc.h +++ b/soc/riscv/intel_niosv/niosv/soc.h @@ -7,6 +7,7 @@ #ifndef RISCV_INTEL_FPGA_NIOSV_H #define RISCV_INTEL_FPGA_NIOSV_H +#include #include #endif /* RISCV_INTEL_FPGA_NIOSV_H */ diff --git a/soc/riscv/litex_vexriscv/soc.h b/soc/riscv/litex_vexriscv/soc.h index 4334be4ec1c..b3521b51e8e 100644 --- a/soc/riscv/litex_vexriscv/soc.h +++ b/soc/riscv/litex_vexriscv/soc.h @@ -7,6 +7,7 @@ #ifndef __RISCV32_LITEX_VEXRISCV_SOC_H_ #define __RISCV32_LITEX_VEXRISCV_SOC_H_ +#include "../common/riscv-privileged/soc_common.h" #include #include diff --git a/soc/riscv/microchip_miv/miv/soc.h b/soc/riscv/microchip_miv/miv/soc.h index c5827ceed21..1608c9e6773 100644 --- a/soc/riscv/microchip_miv/miv/soc.h +++ b/soc/riscv/microchip_miv/miv/soc.h @@ -4,6 +4,8 @@ #ifndef __RISCV32_MIV_SOC_H_ #define __RISCV32_MIV_SOC_H_ +#include + /* UART Configuration */ #define MIV_UART_0_LINECFG 0x1 diff --git a/soc/riscv/microchip_miv/polarfire/soc.h b/soc/riscv/microchip_miv/polarfire/soc.h index f12bea7d533..d6a7d2d2e37 100644 --- a/soc/riscv/microchip_miv/polarfire/soc.h +++ b/soc/riscv/microchip_miv/polarfire/soc.h @@ -6,6 +6,7 @@ #ifndef __RISCV64_MPFS_SOC_H_ #define __RISCV64_MPFS_SOC_H_ +#include #include diff --git a/soc/riscv/neorv32/soc.h b/soc/riscv/neorv32/soc.h index a97daa0fc15..a1e721923a4 100644 --- a/soc/riscv/neorv32/soc.h +++ b/soc/riscv/neorv32/soc.h @@ -7,6 +7,8 @@ #ifndef RISCV_NEORV32_SOC_H #define RISCV_NEORV32_SOC_H +#include + /* System information (SYSINFO) register offsets */ #define NEORV32_SYSINFO_CLK 0x00U #define NEORV32_SYSINFO_CPU 0x04U diff --git a/soc/riscv/opentitan/soc.h b/soc/riscv/opentitan/soc.h index c7f75beb877..13bb5c43b54 100644 --- a/soc/riscv/opentitan/soc.h +++ b/soc/riscv/opentitan/soc.h @@ -7,6 +7,7 @@ #ifndef __RISCV_OPENTITAN_SOC_H_ #define __RISCV_OPENTITAN_SOC_H_ +#include #include /* OpenTitan power management regs. */ diff --git a/soc/riscv/renode_virt/soc.h b/soc/riscv/renode_virt/soc.h index 3edef49c88c..c82e16f1613 100644 --- a/soc/riscv/renode_virt/soc.h +++ b/soc/riscv/renode_virt/soc.h @@ -7,4 +7,6 @@ #ifndef __RISCV32_RENODE_SOC_H_ #define __RISCV32_RENODE_SOC_H_ +#include + #endif /* __RISCV32_RENODE_SOC_H_ */ diff --git a/soc/riscv/sifive_freedom/e300/soc.h b/soc/riscv/sifive_freedom/e300/soc.h index 3c29efb2a71..c83f5f322b6 100644 --- a/soc/riscv/sifive_freedom/e300/soc.h +++ b/soc/riscv/sifive_freedom/e300/soc.h @@ -11,6 +11,8 @@ #ifndef __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ #define __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ +#include + /* PINMUX MAX PINS */ #define SIFIVE_PINMUX_PINS 32 diff --git a/soc/riscv/sifive_freedom/u500/soc.h b/soc/riscv/sifive_freedom/u500/soc.h index 1e18850787b..ed367950278 100644 --- a/soc/riscv/sifive_freedom/u500/soc.h +++ b/soc/riscv/sifive_freedom/u500/soc.h @@ -11,6 +11,8 @@ #ifndef __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ #define __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ +#include + /* Clock controller. */ #define PRCI_BASE_ADDR 0x10000000 diff --git a/soc/riscv/sifive_freedom/u700/soc.h b/soc/riscv/sifive_freedom/u700/soc.h index 2f15ba3b1cb..91aac61afdd 100644 --- a/soc/riscv/sifive_freedom/u700/soc.h +++ b/soc/riscv/sifive_freedom/u700/soc.h @@ -11,6 +11,8 @@ #ifndef __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ #define __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ +#include + /* Clock controller. */ #define PRCI_BASE_ADDR 0x10000000 diff --git a/soc/riscv/starfive_jh71xx/jh71xx/soc.h b/soc/riscv/starfive_jh71xx/jh71xx/soc.h index df3559c96e3..796f07201d9 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/soc.h +++ b/soc/riscv/starfive_jh71xx/jh71xx/soc.h @@ -7,4 +7,6 @@ #ifndef __RISCV_VIRT_SOC_H_ #define __RISCV_VIRT_SOC_H_ +#include + #endif diff --git a/soc/riscv/telink_tlsr/tlsr951x/soc.h b/soc/riscv/telink_tlsr/tlsr951x/soc.h index 6acfd63dd02..a46b4c620c7 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/soc.h +++ b/soc/riscv/telink_tlsr/tlsr951x/soc.h @@ -7,4 +7,6 @@ #ifndef RISCV_TELINK_B91_SOC_H #define RISCV_TELINK_B91_SOC_H +#include + #endif /* RISCV_TELINK_B91_SOC_H */ diff --git a/soc/riscv/virt/soc.h b/soc/riscv/virt/soc.h index d821c4653e6..8fd5e2108ce 100644 --- a/soc/riscv/virt/soc.h +++ b/soc/riscv/virt/soc.h @@ -7,6 +7,8 @@ #ifndef __RISCV_VIRT_SOC_H_ #define __RISCV_VIRT_SOC_H_ +#include + #define SIFIVE_SYSCON_TEST 0x00100000 #define RISCV_MSIP_BASE 0x02000000 From 0782428f7fb68bd1610dde8d86460151f6c181fa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:29 +0100 Subject: [PATCH 1070/2300] Revert "[nrf fromtree] drivers: serial: b91: add missing RISC-V PLIC header" This reverts commit 147c18e1bb9510a1b7e6c7b6298afc78bc4dafb5. Signed-off-by: Robert Lubos --- drivers/serial/uart_b91.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/serial/uart_b91.c b/drivers/serial/uart_b91.c index e2502f4fd9b..cb2d7ebd190 100644 --- a/drivers/serial/uart_b91.c +++ b/drivers/serial/uart_b91.c @@ -11,7 +11,6 @@ #include #include #include -#include /* Driver dts compatibility: telink,b91_uart */ From fbd4d7300729204ac5218da1ff3d5a11f0e74c69 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:29 +0100 Subject: [PATCH 1071/2300] Revert "[nrf fromtree] drivers: ieee802154: b91: add missing PLIC include" This reverts commit 271464a0a50e53e480aa3c4d70d863a85c4ad2d0. Signed-off-by: Robert Lubos --- drivers/ieee802154/ieee802154_b91.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_b91.c b/drivers/ieee802154/ieee802154_b91.c index 0897b2b54df..0557c533944 100644 --- a/drivers/ieee802154/ieee802154_b91.c +++ b/drivers/ieee802154/ieee802154_b91.c @@ -26,8 +26,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #endif -#include - #include "ieee802154_b91.h" From 8bffb3ce6d5e4a0575d656fff74376123db2225e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:30 +0100 Subject: [PATCH 1072/2300] Revert "[nrf fromtree] drivers: gpio: b91: add missing PLIC header" This reverts commit e8427bf4c91e952f5a072ee0698fe05c7bc19bf3. Signed-off-by: Robert Lubos --- drivers/gpio/gpio_b91.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpio/gpio_b91.c b/drivers/gpio/gpio_b91.c index 4c4c14dc909..bc73f9db9f5 100644 --- a/drivers/gpio/gpio_b91.c +++ b/drivers/gpio/gpio_b91.c @@ -10,7 +10,6 @@ #include #include #include -#include /* Driver dts compatibility: telink,b91_gpio */ From eaf9eec5617da8e895368f4f7daa88bc85d2c8b8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:30 +0100 Subject: [PATCH 1073/2300] Revert "[nrf fromtree] drivers: gpio: sifive: add missing PLIC header" This reverts commit 9f10a81663e9425e7b6f801d249972deba314895. Signed-off-by: Robert Lubos --- drivers/gpio/gpio_sifive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio_sifive.c b/drivers/gpio/gpio_sifive.c index a412fdd1528..77703f25707 100644 --- a/drivers/gpio/gpio_sifive.c +++ b/drivers/gpio/gpio_sifive.c @@ -18,7 +18,7 @@ #include #include #include -#include + #include typedef void (*sifive_cfg_func_t)(void); From 858667dfdda1af826947261c18c42ad7d8f536fe Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:30 +0100 Subject: [PATCH 1074/2300] Revert "[nrf fromtree] arch: riscv: irq_manage: add missing PLIC header" This reverts commit 9d511877a9a0d3aaa2be3c481f20a3a8da86eceb. Signed-off-by: Robert Lubos --- arch/riscv/core/irq_manage.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/riscv/core/irq_manage.c b/arch/riscv/core/irq_manage.c index f95b099a4da..f3e0cc09ab1 100644 --- a/arch/riscv/core/irq_manage.c +++ b/arch/riscv/core/irq_manage.c @@ -10,10 +10,6 @@ #include #include -#ifdef CONFIG_RISCV_HAS_PLIC -#include -#endif - LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); FUNC_NORETURN void z_irq_spurious(const void *unused) From a48760ed44934709994309a1c7b2c3561c08664d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:30 +0100 Subject: [PATCH 1075/2300] Revert "[nrf fromtree] arch: riscv: define local soc_interrupt_init prototypes" This reverts commit 6646e3c8fba80d55325e13ad106c05349388e7da. Signed-off-by: Robert Lubos --- arch/riscv/core/prep_c.c | 4 ---- arch/riscv/core/smp.c | 4 ---- soc/riscv/common/riscv-privileged/soc_common.h | 4 ++++ soc/riscv/ite_ec/it8xxx2/soc.h | 4 ++++ soc/riscv/openisa_rv32m1/soc.h | 2 ++ 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/riscv/core/prep_c.c b/arch/riscv/core/prep_c.c index b486b4949d8..8b9b118b24c 100644 --- a/arch/riscv/core/prep_c.c +++ b/arch/riscv/core/prep_c.c @@ -20,10 +20,6 @@ #include #include -#if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) -void soc_interrupt_init(void); -#endif - /** * * @brief Prepare to and run C code diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 928edb63d8f..b0c2b98de81 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -23,10 +23,6 @@ volatile void *riscv_cpu_sp; extern void __start(void); -#if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) -void soc_interrupt_init(void); -#endif - void arch_start_cpu(int cpu_num, k_thread_stack_t *stack, int sz, arch_cpustart_t fn, void *arg) { diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index f8f1c13cb59..bf9600ab880 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -17,6 +17,10 @@ #include #include +#if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) +void soc_interrupt_init(void); +#endif + #endif /* !_ASMLANGUAGE */ #endif /* __SOC_COMMON_H_ */ diff --git a/soc/riscv/ite_ec/it8xxx2/soc.h b/soc/riscv/ite_ec/it8xxx2/soc.h index ea9d30d11fc..bc790768369 100644 --- a/soc/riscv/ite_ec/it8xxx2/soc.h +++ b/soc/riscv/ite_ec/it8xxx2/soc.h @@ -25,4 +25,8 @@ COND_CODE_1(DT_NODE_EXISTS(DT_INST(1, ite_it8xxx2_usbpd)), (2), (1)) */ #define SOC_USBPD_ITE_ACTIVE_PORT_COUNT DT_NUM_INST_STATUS_OKAY(ite_it8xxx2_usbpd) +#ifndef _ASMLANGUAGE +void soc_interrupt_init(void); +#endif + #endif /* __RISCV_ITE_SOC_H_ */ diff --git a/soc/riscv/openisa_rv32m1/soc.h b/soc/riscv/openisa_rv32m1/soc.h index 75011d36283..1b2643d0b66 100644 --- a/soc/riscv/openisa_rv32m1/soc.h +++ b/soc/riscv/openisa_rv32m1/soc.h @@ -94,6 +94,8 @@ static inline uint32_t rv32m1_intmux_line(unsigned int irq) return ((irq >> 8) & 0xff) - 1; } +void soc_interrupt_init(void); + #endif /* !_ASMLANGUAGE */ #if defined(CONFIG_SOC_OPENISA_RV32M1_RI5CY) From c0539e43cc6d3dcabbdac33f331a86fff7a03597 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:30 +0100 Subject: [PATCH 1076/2300] Revert "[nrf fromtree] arch: riscv: define RISC_IRQ_MSOFT/MEXT" This reverts commit e6aa4dd59d7caa7da23df5582c6e6ec625f47b2e. Signed-off-by: Robert Lubos --- arch/riscv/core/irq_manage.c | 2 +- arch/riscv/core/smp.c | 7 +++---- drivers/interrupt_controller/intc_swerv_pic.c | 5 ++--- drivers/interrupt_controller/intc_vexriscv_litex.c | 5 ++--- drivers/mbox/mbox_andes_plic_sw.c | 4 ++-- include/zephyr/arch/riscv/irq.h | 7 ------- soc/riscv/common/riscv-privileged/soc_common.h | 4 ++++ soc/riscv/espressif_esp32/esp32c3/soc.h | 5 +++++ 8 files changed, 19 insertions(+), 20 deletions(-) diff --git a/arch/riscv/core/irq_manage.c b/arch/riscv/core/irq_manage.c index f3e0cc09ab1..6ed5781c731 100644 --- a/arch/riscv/core/irq_manage.c +++ b/arch/riscv/core/irq_manage.c @@ -24,7 +24,7 @@ FUNC_NORETURN void z_irq_spurious(const void *unused) LOG_ERR("Spurious interrupt detected! IRQ: %ld", mcause); #if defined(CONFIG_RISCV_HAS_PLIC) - if (mcause == RISCV_IRQ_MEXT) { + if (mcause == RISCV_MACHINE_EXT_IRQ) { unsigned int save_irq = riscv_plic_get_irq(); const struct device *save_dev = riscv_plic_get_dev(); diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index b0c2b98de81..4e9cdb55f48 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -9,7 +9,6 @@ #include #include #include -#include #include volatile struct { @@ -68,7 +67,7 @@ void z_riscv_secondary_cpu_init(int hartid) z_riscv_pmp_init(); #endif #ifdef CONFIG_SMP - irq_enable(RISCV_IRQ_MSOFT); + irq_enable(RISCV_MACHINE_SOFT_IRQ); #endif riscv_cpu_init[cpu_num].fn(riscv_cpu_init[cpu_num].arg); } @@ -155,8 +154,8 @@ void arch_spin_relax(void) int arch_smp_init(void) { - IRQ_CONNECT(RISCV_IRQ_MSOFT, 0, sched_ipi_handler, NULL, 0); - irq_enable(RISCV_IRQ_MSOFT); + IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 0, sched_ipi_handler, NULL, 0); + irq_enable(RISCV_MACHINE_SOFT_IRQ); return 0; } diff --git a/drivers/interrupt_controller/intc_swerv_pic.c b/drivers/interrupt_controller/intc_swerv_pic.c index 96eb248d27c..5c52ab49614 100644 --- a/drivers/interrupt_controller/intc_swerv_pic.c +++ b/drivers/interrupt_controller/intc_swerv_pic.c @@ -15,7 +15,6 @@ #include #include #include -#include #define SWERV_PIC_MAX_NUM CONFIG_NUM_IRQS #define SWERV_PIC_MAX_ID (SWERV_PIC_MAX_NUM + RISCV_MAX_GENERIC_IRQ) @@ -177,14 +176,14 @@ static int swerv_pic_init(const struct device *dev) __asm__ swerv_pic_writecsr(meicurpl, 0); /* Setup IRQ handler for SweRV PIC driver */ - IRQ_CONNECT(RISCV_IRQ_MEXT, + IRQ_CONNECT(RISCV_MACHINE_EXT_IRQ, 0, swerv_pic_irq_handler, NULL, 0); /* Enable IRQ for SweRV PIC driver */ - irq_enable(RISCV_IRQ_MEXT); + irq_enable(RISCV_MACHINE_EXT_IRQ); return 0; } diff --git a/drivers/interrupt_controller/intc_vexriscv_litex.c b/drivers/interrupt_controller/intc_vexriscv_litex.c index 2d5d2233ab2..efec4d2478e 100644 --- a/drivers/interrupt_controller/intc_vexriscv_litex.c +++ b/drivers/interrupt_controller/intc_vexriscv_litex.c @@ -11,7 +11,6 @@ #include #include #include -#include #define IRQ_MASK DT_INST_REG_ADDR_BY_NAME(0, irq_mask) #define IRQ_PENDING DT_INST_REG_ADDR_BY_NAME(0, irq_pending) @@ -123,9 +122,9 @@ int arch_irq_is_enabled(unsigned int irq) static int vexriscv_litex_irq_init(const struct device *dev) { __asm__ volatile ("csrrs x0, mie, %0" - :: "r"(1 << RISCV_IRQ_MEXT)); + :: "r"(1 << RISCV_MACHINE_EXT_IRQ)); vexriscv_litex_irq_setie(1); - IRQ_CONNECT(RISCV_IRQ_MEXT, 0, vexriscv_litex_irq_handler, + IRQ_CONNECT(RISCV_MACHINE_EXT_IRQ, 0, vexriscv_litex_irq_handler, NULL, 0); return 0; diff --git a/drivers/mbox/mbox_andes_plic_sw.c b/drivers/mbox/mbox_andes_plic_sw.c index e2c287ae216..bc01da73a30 100644 --- a/drivers/mbox/mbox_andes_plic_sw.c +++ b/drivers/mbox/mbox_andes_plic_sw.c @@ -199,11 +199,11 @@ static void andes_plic_sw_irq_handler(const struct device *dev) static int mbox_andes_init(const struct device *dev) { /* Setup IRQ handler for PLIC SW driver */ - IRQ_CONNECT(RISCV_IRQ_MSOFT, 1, + IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 1, andes_plic_sw_irq_handler, DEVICE_DT_INST_GET(0), 0); #ifndef CONFIG_SMP - irq_enable(RISCV_IRQ_MSOFT); + irq_enable(RISCV_MACHINE_SOFT_IRQ); #endif return 0; } diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index 84d3a4949a9..d4dfd54d92a 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -32,13 +32,6 @@ extern "C" { /** Environment Call from M-mode */ #define RISCV_EXC_ECALLM 11 -/* IRQs 0-15 (MCAUSE interrupt=1) */ - -/** Machine Software Interrupt */ -#define RISCV_IRQ_MSOFT 3 -/** Machine External Interrupt */ -#define RISCV_IRQ_MEXT 11 - #ifdef CONFIG_64BIT #define RISCV_MCAUSE_IRQ_BIT (1 << 63) #else diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index bf9600ab880..01a6b783850 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -12,6 +12,10 @@ #ifndef __SOC_COMMON_H_ #define __SOC_COMMON_H_ +/* IRQ numbers */ +#define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ +#define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ + #ifndef _ASMLANGUAGE #include diff --git a/soc/riscv/espressif_esp32/esp32c3/soc.h b/soc/riscv/espressif_esp32/esp32c3/soc.h index 68fb6fdb1ce..8076f2ae045 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc.h +++ b/soc/riscv/espressif_esp32/esp32c3/soc.h @@ -16,6 +16,11 @@ #include "esp32c3/clk.h" #endif +/* IRQ numbers */ +#define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ +#define RISCV_MACHINE_TIMER_IRQ 7 /* Machine Timer Interrupt */ +#define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ + #ifndef _ASMLANGUAGE void __esp_platform_start(void); From 96d0617237d099c038833a0294c302a8bb47774a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:30 +0100 Subject: [PATCH 1077/2300] Revert "[nrf fromtree] arch: riscv: use CONFIG_RISCV_MCAUSE_EXCEPTION_MASK" This reverts commit 1f4a165509b0e2aabd6a52d03469ab6a12722997. Signed-off-by: Robert Lubos --- arch/riscv/core/fatal.c | 2 +- arch/riscv/core/irq_manage.c | 2 +- arch/riscv/core/isr.S | 4 ++-- include/zephyr/arch/riscv/irq.h | 2 +- soc/riscv/common/riscv-privileged/soc_common.h | 3 +++ soc/riscv/espressif_esp32/esp32c3/soc.h | 3 +++ soc/riscv/ite_ec/common/soc_common.h | 5 +++++ soc/riscv/openisa_rv32m1/Kconfig.defconfig | 3 --- soc/riscv/openisa_rv32m1/soc_ri5cy.h | 15 +++++++++++++++ soc/riscv/openisa_rv32m1/soc_zero_riscy.h | 15 +++++++++++++++ 10 files changed, 46 insertions(+), 8 deletions(-) diff --git a/arch/riscv/core/fatal.c b/arch/riscv/core/fatal.c index 6e8831f1026..171497ff0ca 100644 --- a/arch/riscv/core/fatal.c +++ b/arch/riscv/core/fatal.c @@ -167,7 +167,7 @@ void _Fault(z_arch_esf_t *esf) __asm__ volatile("csrr %0, mtval" : "=r" (mtval)); #endif - mcause &= CONFIG_RISCV_MCAUSE_EXCEPTION_MASK; + mcause &= SOC_MCAUSE_EXP_MASK; LOG_ERR(""); LOG_ERR(" mcause: %ld, %s", mcause, cause_str(mcause)); #ifndef CONFIG_SOC_OPENISA_RV32M1_RISCV32 diff --git a/arch/riscv/core/irq_manage.c b/arch/riscv/core/irq_manage.c index 6ed5781c731..e0ef1374bf1 100644 --- a/arch/riscv/core/irq_manage.c +++ b/arch/riscv/core/irq_manage.c @@ -20,7 +20,7 @@ FUNC_NORETURN void z_irq_spurious(const void *unused) mcause = csr_read(mcause); - mcause &= CONFIG_RISCV_MCAUSE_EXCEPTION_MASK; + mcause &= SOC_MCAUSE_EXP_MASK; LOG_ERR("Spurious interrupt detected! IRQ: %ld", mcause); #if defined(CONFIG_RISCV_HAS_PLIC) diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index 558d2a41fbe..a4db1ff053b 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -295,7 +295,7 @@ no_fp: /* increment _current->arch.exception_depth */ * to report the exception. */ csrr t0, mcause - li t2, CONFIG_RISCV_MCAUSE_EXCEPTION_MASK + li t2, SOC_MCAUSE_EXP_MASK and t0, t0, t2 /* @@ -528,7 +528,7 @@ on_irq_stack: /* Get IRQ causing interrupt */ csrr a0, mcause - li t0, CONFIG_RISCV_MCAUSE_EXCEPTION_MASK + li t0, SOC_MCAUSE_EXP_MASK and a0, a0, t0 /* diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index d4dfd54d92a..f0b1f88642d 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -91,7 +91,7 @@ static inline void arch_isr_direct_footer(int swap) /* Get the IRQ number */ __asm__ volatile("csrr %0, mcause" : "=r" (mcause)); - mcause &= CONFIG_RISCV_MCAUSE_EXCEPTION_MASK; + mcause &= SOC_MCAUSE_EXP_MASK; /* Clear the pending IRQ */ __soc_handle_irq(mcause); diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index 01a6b783850..6e75d4acf06 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -16,6 +16,9 @@ #define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ +/* Exception code Mask */ +#define SOC_MCAUSE_EXP_MASK CONFIG_RISCV_MCAUSE_EXCEPTION_MASK + #ifndef _ASMLANGUAGE #include diff --git a/soc/riscv/espressif_esp32/esp32c3/soc.h b/soc/riscv/espressif_esp32/esp32c3/soc.h index 8076f2ae045..6f6c9263da2 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc.h +++ b/soc/riscv/espressif_esp32/esp32c3/soc.h @@ -21,6 +21,9 @@ #define RISCV_MACHINE_TIMER_IRQ 7 /* Machine Timer Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ +/* Exception code Mask */ +#define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF + #ifndef _ASMLANGUAGE void __esp_platform_start(void); diff --git a/soc/riscv/ite_ec/common/soc_common.h b/soc/riscv/ite_ec/common/soc_common.h index b7e0cdd5e55..b50f16df0fb 100644 --- a/soc/riscv/ite_ec/common/soc_common.h +++ b/soc/riscv/ite_ec/common/soc_common.h @@ -14,6 +14,11 @@ #include "chip_chipregs.h" +/* SOC-specific MCAUSE bitfields */ + +/* Exception code Mask */ +#define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF + #ifndef _ASMLANGUAGE #ifdef CONFIG_HAS_ITE_INTC diff --git a/soc/riscv/openisa_rv32m1/Kconfig.defconfig b/soc/riscv/openisa_rv32m1/Kconfig.defconfig index 52d652a061e..3976c9940c5 100644 --- a/soc/riscv/openisa_rv32m1/Kconfig.defconfig +++ b/soc/riscv/openisa_rv32m1/Kconfig.defconfig @@ -33,9 +33,6 @@ config RISCV_SOC_OFFSETS config RISCV_SOC_INTERRUPT_INIT default y -config RISCV_MCAUSE_EXCEPTION_MASK - default 0x1F - # We need to disable the watchdog out of reset, as it's enabled by # default. Use the WDOG_INIT hook for doing that. config WDOG_INIT diff --git a/soc/riscv/openisa_rv32m1/soc_ri5cy.h b/soc/riscv/openisa_rv32m1/soc_ri5cy.h index d9158935e08..12a001defba 100644 --- a/soc/riscv/openisa_rv32m1/soc_ri5cy.h +++ b/soc/riscv/openisa_rv32m1/soc_ri5cy.h @@ -40,4 +40,19 @@ #define RI5CY_PRIVLV 0xC10 #define RI5CY_MHARTID 0xF14 +/* + * Map from SoC-specific configuration to generic Zephyr macros. + * + * These are expected by the code in arch/, and must be provided for + * the kernel to work (or even build at all). + * + * Some of these may also apply to ZERO-RISCY; needs investigation. + */ + +/* + * Exception code mask. Use of the bottom five bits is a subset of + * what the standard allocates (which is XLEN-1 bits). + */ +#define SOC_MCAUSE_EXP_MASK 0x1F + #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_RI5CY_H_ */ diff --git a/soc/riscv/openisa_rv32m1/soc_zero_riscy.h b/soc/riscv/openisa_rv32m1/soc_zero_riscy.h index 43cd144823a..4453b3665f6 100644 --- a/soc/riscv/openisa_rv32m1/soc_zero_riscy.h +++ b/soc/riscv/openisa_rv32m1/soc_zero_riscy.h @@ -28,4 +28,19 @@ #define ZERO_RISCY_PCMR 0x7A1U #define ZERO_RISCY_MHARTID 0xF14U +/* + * Map from SoC-specific configuration to generic Zephyr macros. + * + * These are expected by the code in arch/, and must be provided for + * the kernel to work (or even build at all). + * + * Some of these may also apply to ZERO-RISCY; needs investigation. + */ + +/* + * Exception code mask. Use of the bottom five bits is a subset of + * what the standard allocates (which is XLEN-1 bits). + */ +#define SOC_MCAUSE_EXP_MASK 0x1F + #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_ZERO_RISCY_H_ */ From cf84bacffeafc9f63c621daf9fa460318b826f48 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:31 +0100 Subject: [PATCH 1078/2300] Revert "[nrf fromtree] arch: riscv: remove SOC from RISCV_SOC_MCAUSE_EXCEPTION_MASK" This reverts commit a6c91c4d1060a6da084010a500840c32d48f95ea. Signed-off-by: Robert Lubos --- arch/riscv/Kconfig | 2 +- soc/riscv/common/riscv-privileged/soc_common.h | 2 +- soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 1c5defbacaf..60d33b18071 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -159,7 +159,7 @@ config RISCV_SOC_INTERRUPT_INIT Enable SOC-based interrupt initialization (call soc_interrupt_init, within _IntLibInit when enabled) -config RISCV_MCAUSE_EXCEPTION_MASK +config RISCV_SOC_MCAUSE_EXCEPTION_MASK hex default 0x7FFFFFFFFFFFFFFF if 64BIT default 0x7FFFFFFF diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index 6e75d4acf06..8b993c8a946 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -17,7 +17,7 @@ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ /* Exception code Mask */ -#define SOC_MCAUSE_EXP_MASK CONFIG_RISCV_MCAUSE_EXCEPTION_MASK +#define SOC_MCAUSE_EXP_MASK CONFIG_RISCV_SOC_MCAUSE_EXCEPTION_MASK #ifndef _ASMLANGUAGE diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 index 0da92e80e36..ade07b45635 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 @@ -14,7 +14,7 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC # The CPU frequency is set to the maximum value of 108MHz by default. default 27000000 -config RISCV_MCAUSE_EXCEPTION_MASK +config RISCV_SOC_MCAUSE_EXCEPTION_MASK default 0xFFF config RISCV_SOC_INTERRUPT_INIT From dc80b33c07c0ac4464b969a490d47e2343647503 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:31 +0100 Subject: [PATCH 1079/2300] Revert "[nrf fromtree] soc: riscv: gd32vf103: simplify MCAUSE exception mask handling" This reverts commit dbe994dd4b9f951731ae8c35db419d08295c6e4d. Signed-off-by: Robert Lubos --- dts/bindings/cpu/nuclei,bumblebee.yaml | 6 ++++++ dts/riscv/gigadevice/gd32vf103.dtsi | 1 + soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dts/bindings/cpu/nuclei,bumblebee.yaml b/dts/bindings/cpu/nuclei,bumblebee.yaml index 96eebcd0fb8..8c9dfc7d35d 100644 --- a/dts/bindings/cpu/nuclei,bumblebee.yaml +++ b/dts/bindings/cpu/nuclei,bumblebee.yaml @@ -6,3 +6,9 @@ description: Nuclei Bumblebee RISC-V Core compatible: "nuclei,bumblebee" include: riscv,cpus.yaml + +properties: + mcause-exception-mask: + type: int + required: true + description: Specify the bits to use for exception code in mcause register. diff --git a/dts/riscv/gigadevice/gd32vf103.dtsi b/dts/riscv/gigadevice/gd32vf103.dtsi index b52aee61fbc..c9f37db5180 100644 --- a/dts/riscv/gigadevice/gd32vf103.dtsi +++ b/dts/riscv/gigadevice/gd32vf103.dtsi @@ -23,6 +23,7 @@ cpu: cpu@0 { clock-frequency = ; + mcause-exception-mask = <0x7ff>; compatible = "nuclei,bumblebee"; riscv,isa = "rv32imac_zicsr_zifencei"; reg = <0>; diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 index ade07b45635..4d65e4c43cd 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 @@ -15,7 +15,7 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC default 27000000 config RISCV_SOC_MCAUSE_EXCEPTION_MASK - default 0xFFF + default $(dt_node_int_prop_hex,/cpus/cpu@0,mcause-exception-mask) config RISCV_SOC_INTERRUPT_INIT default y From 89a7e051e03c7c4d0ed20d294e64a012ae8eb839 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:31 +0100 Subject: [PATCH 1080/2300] Revert "[nrf fromtree] soc: riscv: cleanup usage/definition of MCAUSE IRQ flag" This reverts commit b9720babe23ddcaf4b497c7a1798ae752b653241. Signed-off-by: Robert Lubos --- include/zephyr/arch/riscv/irq.h | 6 ------ soc/riscv/common/riscv-privileged/soc_common.h | 9 +++++++++ soc/riscv/common/riscv-privileged/soc_irq.S | 4 ++-- soc/riscv/espressif_esp32/esp32c3/soc.h | 3 +++ soc/riscv/ite_ec/common/soc_common.h | 3 +++ 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index f0b1f88642d..2e3e813872e 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -32,12 +32,6 @@ extern "C" { /** Environment Call from M-mode */ #define RISCV_EXC_ECALLM 11 -#ifdef CONFIG_64BIT -#define RISCV_MCAUSE_IRQ_BIT (1 << 63) -#else -#define RISCV_MCAUSE_IRQ_BIT (1 << 31) -#endif - #ifndef _ASMLANGUAGE extern void arch_irq_enable(unsigned int irq); diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index 8b993c8a946..27eed85c684 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -16,6 +16,15 @@ #define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ +/* SOC-specific MCAUSE bitfields */ +#ifdef CONFIG_64BIT +/* Interrupt Mask */ +#define SOC_MCAUSE_IRQ_MASK (1 << 63) +#else +/* Interrupt Mask */ +#define SOC_MCAUSE_IRQ_MASK (1 << 31) +#endif + /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK CONFIG_RISCV_SOC_MCAUSE_EXCEPTION_MASK diff --git a/soc/riscv/common/riscv-privileged/soc_irq.S b/soc/riscv/common/riscv-privileged/soc_irq.S index 377edbf600d..73fc24431d5 100644 --- a/soc/riscv/common/riscv-privileged/soc_irq.S +++ b/soc/riscv/common/riscv-privileged/soc_irq.S @@ -12,7 +12,7 @@ #include #include #include -#include +#include /* * __soc_handle_irq is defined as .weak to allow re-implementation by @@ -48,7 +48,7 @@ WTEXT(__soc_is_irq) SECTION_FUNC(exception.other, __soc_is_irq) /* Read mcause and check if interrupt bit is set */ csrr t0, mcause - li t1, RISCV_MCAUSE_IRQ_BIT + li t1, SOC_MCAUSE_IRQ_MASK and t0, t0, t1 /* If interrupt bit is not set, return with 0 */ diff --git a/soc/riscv/espressif_esp32/esp32c3/soc.h b/soc/riscv/espressif_esp32/esp32c3/soc.h index 6f6c9263da2..4d8904c5b2a 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc.h +++ b/soc/riscv/espressif_esp32/esp32c3/soc.h @@ -21,6 +21,9 @@ #define RISCV_MACHINE_TIMER_IRQ 7 /* Machine Timer Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ +/* Interrupt Mask */ +#define SOC_MCAUSE_IRQ_MASK (1 << 31) + /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF diff --git a/soc/riscv/ite_ec/common/soc_common.h b/soc/riscv/ite_ec/common/soc_common.h index b50f16df0fb..0504118199a 100644 --- a/soc/riscv/ite_ec/common/soc_common.h +++ b/soc/riscv/ite_ec/common/soc_common.h @@ -16,6 +16,9 @@ /* SOC-specific MCAUSE bitfields */ +/* Interrupt Mask. 1 (interrupt) or 0 (exception) */ +#define SOC_MCAUSE_IRQ_MASK BIT(31) + /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF From 56f43ff21a9bce5493f9eaa566ecb4164f188b98 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:31 +0100 Subject: [PATCH 1081/2300] Revert "[nrf fromtree] arch: riscv: define some RISC-V exception codes" This reverts commit 869bb72f1c9efe630e7631d5a14b0ec49beb2427. Signed-off-by: Robert Lubos --- arch/riscv/core/isr.S | 9 ++++----- include/zephyr/arch/riscv/irq.h | 15 +++------------ soc/riscv/common/riscv-privileged/soc_common.h | 4 ++++ soc/riscv/espressif_esp32/esp32c3/soc.h | 5 ++++- soc/riscv/ite_ec/common/soc_common.h | 3 +++ soc/riscv/openisa_rv32m1/soc_ri5cy.h | 2 ++ soc/riscv/openisa_rv32m1/soc_zero_riscy.h | 3 +++ 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index a4db1ff053b..c36679ae6db 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -14,7 +14,6 @@ #include #include #include -#include #include #include "asm_macros.inc" @@ -299,18 +298,18 @@ no_fp: /* increment _current->arch.exception_depth */ and t0, t0, t2 /* - * If mcause == RISCV_EXC_ECALLM, handle system call from + * If mcause == SOC_MCAUSE_ECALL_EXP, handle system call from * kernel thread. */ - li t1, RISCV_EXC_ECALLM + li t1, SOC_MCAUSE_ECALL_EXP beq t0, t1, is_kernel_syscall #ifdef CONFIG_USERSPACE /* - * If mcause == RISCV_EXC_ECALLU, handle system call + * If mcause == SOC_MCAUSE_USER_ECALL_EXP, handle system call * for user mode thread. */ - li t1, RISCV_EXC_ECALLU + li t1, SOC_MCAUSE_USER_ECALL_EXP beq t0, t1, is_user_syscall #endif /* CONFIG_USERSPACE */ diff --git a/include/zephyr/arch/riscv/irq.h b/include/zephyr/arch/riscv/irq.h index 2e3e813872e..77c0d4057aa 100644 --- a/include/zephyr/arch/riscv/irq.h +++ b/include/zephyr/arch/riscv/irq.h @@ -14,25 +14,16 @@ #ifndef ZEPHYR_INCLUDE_ARCH_RISCV_IRQ_H_ #define ZEPHYR_INCLUDE_ARCH_RISCV_IRQ_H_ +#ifndef _ASMLANGUAGE + #ifdef __cplusplus extern "C" { #endif -#ifndef _ASMLANGUAGE #include #include #include #include -#endif /* !_ASMLANGUAGE */ - -/* Exceptions 0-15 (MCAUSE interrupt=0) */ - -/* Environment Call from U-mode */ -#define RISCV_EXC_ECALLU 8 -/** Environment Call from M-mode */ -#define RISCV_EXC_ECALLM 11 - -#ifndef _ASMLANGUAGE extern void arch_irq_enable(unsigned int irq); extern void arch_irq_disable(unsigned int irq); @@ -111,10 +102,10 @@ static inline void arch_isr_direct_footer(int swap) } \ static inline int name##_body(void) -#endif /* _ASMLANGUAGE */ #ifdef __cplusplus } #endif +#endif /* _ASMLANGUAGE */ #endif /* ZEPHYR_INCLUDE_ARCH_RISCV_IRQ_H_ */ diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/common/riscv-privileged/soc_common.h index 27eed85c684..79f458924c6 100644 --- a/soc/riscv/common/riscv-privileged/soc_common.h +++ b/soc/riscv/common/riscv-privileged/soc_common.h @@ -16,6 +16,10 @@ #define RISCV_MACHINE_SOFT_IRQ 3 /* Machine Software Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ +/* ECALL Exception numbers */ +#define SOC_MCAUSE_ECALL_EXP 11 /* Machine ECALL instruction */ +#define SOC_MCAUSE_USER_ECALL_EXP 8 /* User ECALL instruction */ + /* SOC-specific MCAUSE bitfields */ #ifdef CONFIG_64BIT /* Interrupt Mask */ diff --git a/soc/riscv/espressif_esp32/esp32c3/soc.h b/soc/riscv/espressif_esp32/esp32c3/soc.h index 4d8904c5b2a..a3709819abc 100644 --- a/soc/riscv/espressif_esp32/esp32c3/soc.h +++ b/soc/riscv/espressif_esp32/esp32c3/soc.h @@ -21,9 +21,12 @@ #define RISCV_MACHINE_TIMER_IRQ 7 /* Machine Timer Interrupt */ #define RISCV_MACHINE_EXT_IRQ 11 /* Machine External Interrupt */ +/* ECALL Exception numbers */ +#define SOC_MCAUSE_ECALL_EXP 11 /* Machine ECALL instruction */ +#define SOC_MCAUSE_USER_ECALL_EXP 8 /* User ECALL instruction */ + /* Interrupt Mask */ #define SOC_MCAUSE_IRQ_MASK (1 << 31) - /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF diff --git a/soc/riscv/ite_ec/common/soc_common.h b/soc/riscv/ite_ec/common/soc_common.h index 0504118199a..5b981783164 100644 --- a/soc/riscv/ite_ec/common/soc_common.h +++ b/soc/riscv/ite_ec/common/soc_common.h @@ -22,6 +22,9 @@ /* Exception code Mask */ #define SOC_MCAUSE_EXP_MASK 0x7FFFFFFF +/* Exception code of environment call from M-mode */ +#define SOC_MCAUSE_ECALL_EXP 11 + #ifndef _ASMLANGUAGE #ifdef CONFIG_HAS_ITE_INTC diff --git a/soc/riscv/openisa_rv32m1/soc_ri5cy.h b/soc/riscv/openisa_rv32m1/soc_ri5cy.h index 12a001defba..27ebcbe6f35 100644 --- a/soc/riscv/openisa_rv32m1/soc_ri5cy.h +++ b/soc/riscv/openisa_rv32m1/soc_ri5cy.h @@ -55,4 +55,6 @@ */ #define SOC_MCAUSE_EXP_MASK 0x1F +/* The ecall exception number. This is a standard value. */ +#define SOC_MCAUSE_ECALL_EXP 11 #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_RI5CY_H_ */ diff --git a/soc/riscv/openisa_rv32m1/soc_zero_riscy.h b/soc/riscv/openisa_rv32m1/soc_zero_riscy.h index 4453b3665f6..d5fa48297f7 100644 --- a/soc/riscv/openisa_rv32m1/soc_zero_riscy.h +++ b/soc/riscv/openisa_rv32m1/soc_zero_riscy.h @@ -43,4 +43,7 @@ */ #define SOC_MCAUSE_EXP_MASK 0x1F +/* The ecall exception number. This is a standard value. */ +#define SOC_MCAUSE_ECALL_EXP 11 + #endif /* SOC_RISCV32_OPENISA_RV32M1_SOC_ZERO_RISCY_H_ */ From 4fd48b4a58d75a48df9b17fa9a1bcf3d4081d8b1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:31 +0100 Subject: [PATCH 1082/2300] Revert "[nrf fromtree] arch: ipi_handler -> sched_ipi_handler" This reverts commit 3ed0f6c4367ce2b4e274dadaad55df5633e6f989. Signed-off-by: Robert Lubos --- arch/riscv/core/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 4e9cdb55f48..3294f9006f3 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -104,7 +104,7 @@ void z_riscv_flush_fpu_ipi(unsigned int cpu) } #endif -static void sched_ipi_handler(const void *unused) +static void ipi_handler(const void *unused) { ARG_UNUSED(unused); @@ -154,7 +154,7 @@ void arch_spin_relax(void) int arch_smp_init(void) { - IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 0, sched_ipi_handler, NULL, 0); + IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 0, ipi_handler, NULL, 0); irq_enable(RISCV_MACHINE_SOFT_IRQ); return 0; From 8a76dc7dc168e422942fee128379b3ea63da832f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:32 +0100 Subject: [PATCH 1083/2300] Revert "[nrf fromtree] arch: introduce arch_smp_init" This reverts commit 4c1b24d100f760ad9fecf9f3c5ace2831222eb3e. Signed-off-by: Robert Lubos --- arch/arc/core/arc_smp.c | 5 +++-- arch/arm/core/cortex_a_r/smp.c | 4 ++-- arch/arm64/core/prep_c.c | 1 - arch/arm64/core/smp.c | 4 ++-- arch/riscv/core/smp.c | 5 +++-- arch/x86/core/intel64/irq.c | 6 +----- arch/x86/core/prep_c.c | 2 +- include/zephyr/sys/arch_interface.h | 3 --- 8 files changed, 12 insertions(+), 18 deletions(-) diff --git a/arch/arc/core/arc_smp.c b/arch/arc/core/arc_smp.c index 1aa61be53f0..9fb43c41152 100644 --- a/arch/arc/core/arc_smp.c +++ b/arch/arc/core/arc_smp.c @@ -145,7 +145,7 @@ void arch_sched_ipi(void) } } -int arch_smp_init(void) +static int arc_smp_init(void) { struct arc_connect_bcr bcr; @@ -188,5 +188,6 @@ int arch_smp_init(void) return 0; } -SYS_INIT(arch_smp_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); + +SYS_INIT(arc_smp_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #endif diff --git a/arch/arm/core/cortex_a_r/smp.c b/arch/arm/core/cortex_a_r/smp.c index c17f2fa048f..2aeb36c1735 100644 --- a/arch/arm/core/cortex_a_r/smp.c +++ b/arch/arm/core/cortex_a_r/smp.c @@ -245,7 +245,7 @@ void arch_sched_ipi(void) broadcast_ipi(SGI_SCHED_IPI); } -int arch_smp_init(void) +static int arm_smp_init(void) { cpu_map[0] = MPIDR_TO_CORE(GET_MPIDR()); @@ -259,6 +259,6 @@ int arch_smp_init(void) return 0; } -SYS_INIT(arch_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(arm_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #endif diff --git a/arch/arm64/core/prep_c.c b/arch/arm64/core/prep_c.c index 510476d2ef7..c12d5e7d1c4 100644 --- a/arch/arm64/core/prep_c.c +++ b/arch/arm64/core/prep_c.c @@ -69,7 +69,6 @@ void z_arm64_prep_c(void) CODE_UNREACHABLE; } - #if CONFIG_MP_MAX_NUM_CPUS > 1 extern FUNC_NORETURN void z_arm64_secondary_start(void); void z_arm64_secondary_prep_c(void) diff --git a/arch/arm64/core/smp.c b/arch/arm64/core/smp.c index 043e07eb305..e67032eb2a4 100644 --- a/arch/arm64/core/smp.c +++ b/arch/arm64/core/smp.c @@ -279,7 +279,7 @@ void arch_spin_relax(void) } #endif -int arch_smp_init(void) +static int arm64_smp_init(void) { cpu_map[0] = MPIDR_TO_CORE(GET_MPIDR()); @@ -302,6 +302,6 @@ int arch_smp_init(void) return 0; } -SYS_INIT(arch_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(arm64_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #endif diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 3294f9006f3..6154450e58d 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -151,7 +151,7 @@ void arch_spin_relax(void) } #endif -int arch_smp_init(void) +static int riscv_smp_init(void) { IRQ_CONNECT(RISCV_MACHINE_SOFT_IRQ, 0, ipi_handler, NULL, 0); @@ -159,5 +159,6 @@ int arch_smp_init(void) return 0; } -SYS_INIT(arch_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); + +SYS_INIT(riscv_smp_init, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); #endif /* CONFIG_SMP */ diff --git a/arch/x86/core/intel64/irq.c b/arch/x86/core/intel64/irq.c index 09b1961585c..a7304271746 100644 --- a/arch/x86/core/intel64/irq.c +++ b/arch/x86/core/intel64/irq.c @@ -14,7 +14,6 @@ #include #include #include -#include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); @@ -155,7 +154,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter) #if defined(CONFIG_SMP) -int arch_smp_init(void) +void z_x86_ipi_setup(void) { /* * z_sched_ipi() doesn't have the same signature as a typical ISR, so @@ -167,11 +166,8 @@ int arch_smp_init(void) /* TLB shootdown handling */ x86_irq_funcs[CONFIG_TLB_IPI_VECTOR - IV_IRQS] = z_x86_tlb_ipi; - return 0; } -SYS_INIT(arch_smp_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); - /* * it is not clear exactly how/where/why to abstract this, as it * assumes the use of a local APIC (but there's no other mechanism). diff --git a/arch/x86/core/prep_c.c b/arch/x86/core/prep_c.c index 8f7618495a9..ee095efe33d 100644 --- a/arch/x86/core/prep_c.c +++ b/arch/x86/core/prep_c.c @@ -74,7 +74,7 @@ FUNC_NORETURN void z_x86_prep_c(void *arg) #endif #if defined(CONFIG_SMP) - arch_smp_init(); + z_x86_ipi_setup(); #endif z_cstart(); diff --git a/include/zephyr/sys/arch_interface.h b/include/zephyr/sys/arch_interface.h index 722bacd76d5..e694bce55cc 100644 --- a/include/zephyr/sys/arch_interface.h +++ b/include/zephyr/sys/arch_interface.h @@ -495,9 +495,6 @@ static inline uint32_t arch_proc_id(void); */ void arch_sched_ipi(void); - -int arch_smp_init(void); - #endif /* CONFIG_SMP */ /** From 8853cd380fc4f3ec21a65161466160bf75e232c6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:32 +0100 Subject: [PATCH 1084/2300] Revert "[nrf fromtree] arch: riscv: drop RISCV_HAS_CPU_IDLE" This reverts commit 8b1b13b3d575e286ebcd9722870a88df41c38a46. Signed-off-by: Robert Lubos --- arch/riscv/Kconfig | 5 +++++ soc/riscv/andes_v5/ae350/Kconfig.defconfig.series | 3 +++ soc/riscv/efinix_sapphire/Kconfig.defconfig | 4 ++++ soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 | 3 +++ soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series | 3 +++ soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series | 3 +++ soc/riscv/litex_vexriscv/Kconfig.defconfig | 3 +++ soc/riscv/microchip_miv/miv/Kconfig.defconfig.series | 3 +++ soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series | 3 +++ soc/riscv/neorv32/Kconfig.defconfig | 3 +++ soc/riscv/opentitan/Kconfig.defconfig | 3 +++ soc/riscv/renode_virt/Kconfig.defconfig | 3 +++ soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series | 3 +++ soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series | 3 +++ soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series | 3 +++ soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series | 3 +++ soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series | 4 ++++ soc/riscv/virt/Kconfig.defconfig | 3 +++ tests/kernel/context/src/main.c | 7 ++++--- 19 files changed, 62 insertions(+), 3 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 60d33b18071..80249670d09 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -174,6 +174,11 @@ config RISCV_GENERIC_TOOLCHAIN Allow SOCs that have custom extended riscv ISA to still compile with generic riscv32 toolchain. +config RISCV_HAS_CPU_IDLE + bool "Does SOC has CPU IDLE instruction" + help + Does SOC has CPU IDLE instruction + config GEN_ISR_TABLES default y diff --git a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series index 699e54e66b8..7bd679e5f45 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series +++ b/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series @@ -24,6 +24,9 @@ config RISCV_GENERIC_TOOLCHAIN config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/soc/riscv/efinix_sapphire/Kconfig.defconfig b/soc/riscv/efinix_sapphire/Kconfig.defconfig index 08e2c851a21..7018c0f11fb 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.defconfig +++ b/soc/riscv/efinix_sapphire/Kconfig.defconfig @@ -9,6 +9,10 @@ config SOC config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 +config RISCV_HAS_CPU_IDLE + bool + default y + config RISCV_SOC_INTERRUPT_INIT bool default y diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 index 4d65e4c43cd..1e93f2703b2 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 @@ -20,6 +20,9 @@ config RISCV_SOC_MCAUSE_EXCEPTION_MASK config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_GP default y diff --git a/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series b/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series index 15e98314c89..8e8ea255202 100644 --- a/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series +++ b/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config NUM_IRQS # Platform interrupts IRQs index start from index 16 default 32 +config RISCV_HAS_CPU_IDLE + default y + config RISCV_GP default y diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series index 0ed7358b631..7c5bc0ee897 100644 --- a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series +++ b/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series @@ -22,6 +22,9 @@ config UART_NS16550_WA_ISR_REENABLE_INTERRUPT default y depends on UART_NS16550 +config RISCV_HAS_CPU_IDLE + default y + config FLASH_INIT_PRIORITY default 0 diff --git a/soc/riscv/litex_vexriscv/Kconfig.defconfig b/soc/riscv/litex_vexriscv/Kconfig.defconfig index f3e4c7cc79c..3efdf200ee7 100644 --- a/soc/riscv/litex_vexriscv/Kconfig.defconfig +++ b/soc/riscv/litex_vexriscv/Kconfig.defconfig @@ -9,6 +9,9 @@ config SOC config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 +config RISCV_HAS_CPU_IDLE + bool + config RISCV_HAS_PLIC bool diff --git a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series index fc5aaa7c186..ef161321a5b 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series @@ -11,6 +11,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series index f41ae867153..0e5629927ae 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series @@ -14,6 +14,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/soc/riscv/neorv32/Kconfig.defconfig b/soc/riscv/neorv32/Kconfig.defconfig index bc37ea74727..86aed551f5d 100644 --- a/soc/riscv/neorv32/Kconfig.defconfig +++ b/soc/riscv/neorv32/Kconfig.defconfig @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config NUM_IRQS default 32 +config RISCV_HAS_CPU_IDLE + default y + config RISCV_GP default y diff --git a/soc/riscv/opentitan/Kconfig.defconfig b/soc/riscv/opentitan/Kconfig.defconfig index 4ec6bffc4e7..cc27b7ffd6b 100644 --- a/soc/riscv/opentitan/Kconfig.defconfig +++ b/soc/riscv/opentitan/Kconfig.defconfig @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/soc/riscv/renode_virt/Kconfig.defconfig b/soc/riscv/renode_virt/Kconfig.defconfig index 5d2cd649b0b..89e226edbb1 100644 --- a/soc/riscv/renode_virt/Kconfig.defconfig +++ b/soc/riscv/renode_virt/Kconfig.defconfig @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series index 661fe4ba1eb..b2f16e5261d 100644 --- a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series index 3db750cb1a6..d6b94678686 100644 --- a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series index 83165d58870..347ac14b551 100644 --- a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series +++ b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series index 2dc45e1f347..77436b593e1 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series index 5b62959858e..23a78c9f0da 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series @@ -15,6 +15,10 @@ config RISCV_SOC_INTERRUPT_INIT bool default y +config RISCV_HAS_CPU_IDLE + bool + default y + config RISCV_HAS_PLIC bool default y diff --git a/soc/riscv/virt/Kconfig.defconfig b/soc/riscv/virt/Kconfig.defconfig index e0982bc185b..9773586e922 100644 --- a/soc/riscv/virt/Kconfig.defconfig +++ b/soc/riscv/virt/Kconfig.defconfig @@ -12,6 +12,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_SOC_INTERRUPT_INIT default y +config RISCV_HAS_CPU_IDLE + default y + config RISCV_HAS_PLIC default y diff --git a/tests/kernel/context/src/main.c b/tests/kernel/context/src/main.c index a138e012280..2e3ad1a36c9 100644 --- a/tests/kernel/context/src/main.c +++ b/tests/kernel/context/src/main.c @@ -72,10 +72,11 @@ extern const int32_t z_sys_timer_irq_for_test; #endif -/* Cortex-M1 and Nios II do have a power saving instruction, so k_cpu_idle() - * returns immediately +/* Cortex-M1, Nios II, and RISCV without CONFIG_RISCV_HAS_CPU_IDLE + * do have a power saving instruction, so k_cpu_idle() returns immediately */ -#if !defined(CONFIG_CPU_CORTEX_M1) && !defined(CONFIG_NIOS2) +#if !defined(CONFIG_CPU_CORTEX_M1) && !defined(CONFIG_NIOS2) && \ + (!defined(CONFIG_RISCV) || defined(CONFIG_RISCV_HAS_CPU_IDLE)) #define HAS_POWERSAVE_INSTRUCTION #endif From 8f1eb2710019d2f3980b758ffc1d5e42d63f6993 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:32 +0100 Subject: [PATCH 1085/2300] Revert "[nrf fromtree] soc: riscv: riscv-privileged: remove redundant idle implementation" This reverts commit a71821dcc658aefe42a6628fd5b3dfbc4f0b5e8c. Signed-off-by: Robert Lubos --- soc/riscv/common/riscv-privileged/idle.c | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 soc/riscv/common/riscv-privileged/idle.c diff --git a/soc/riscv/common/riscv-privileged/idle.c b/soc/riscv/common/riscv-privileged/idle.c new file mode 100644 index 00000000000..e61ce72b280 --- /dev/null +++ b/soc/riscv/common/riscv-privileged/idle.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017 Jean-Paul Etienne + * Contributors: 2018 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include + +static ALWAYS_INLINE void riscv_idle(unsigned int key) +{ + sys_trace_idle(); + /* unlock interrupts */ + irq_unlock(key); + + /* Wait for interrupt */ + __asm__ volatile("wfi"); +} + +/** + * @brief Power save idle routine + * + * This function will be called by the kernel idle loop or possibly within + * an implementation of _pm_save_idle in the kernel when the + * '_pm_save_flag' variable is non-zero. + */ +void arch_cpu_idle(void) +{ + riscv_idle(MSTATUS_IEN); +} + +/** + * @brief Atomically re-enable interrupts and enter low power mode + * + * INTERNAL + * The requirements for arch_cpu_atomic_idle() are as follows: + * 1) The enablement of interrupts and entering a low-power mode needs to be + * atomic, i.e. there should be no period of time where interrupts are + * enabled before the processor enters a low-power mode. See the comments + * in k_lifo_get(), for example, of the race condition that + * occurs if this requirement is not met. + * + * 2) After waking up from the low-power mode, the interrupt lockout state + * must be restored as indicated in the 'imask' input parameter. + */ +void arch_cpu_atomic_idle(unsigned int key) +{ + riscv_idle(key); +} From af01227c891dd8e1ff9fec34afe2ba4a68a98cf6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:32 +0100 Subject: [PATCH 1086/2300] Revert "[nrf fromtree] soc: riscv: espressif_esp32: use arch idle" This reverts commit 263d40bf3444039a1279db342beb9eb589ccfde8. Signed-off-by: Robert Lubos --- .../espressif_esp32/esp32c3/CMakeLists.txt | 1 + soc/riscv/espressif_esp32/esp32c3/idle.c | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 soc/riscv/espressif_esp32/esp32c3/idle.c diff --git a/soc/riscv/espressif_esp32/esp32c3/CMakeLists.txt b/soc/riscv/espressif_esp32/esp32c3/CMakeLists.txt index d6772eacbfc..e97f71751ef 100644 --- a/soc/riscv/espressif_esp32/esp32c3/CMakeLists.txt +++ b/soc/riscv/espressif_esp32/esp32c3/CMakeLists.txt @@ -1,6 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_sources( + idle.c vectors.S soc_irq.S soc_irq.c diff --git a/soc/riscv/espressif_esp32/esp32c3/idle.c b/soc/riscv/espressif_esp32/esp32c3/idle.c new file mode 100644 index 00000000000..1bfb2832187 --- /dev/null +++ b/soc/riscv/espressif_esp32/esp32c3/idle.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +/** + * @brief Power save idle routine + * + * This function will be called by the kernel idle loop or possibly within + * an implementation of _pm_save_idle in the kernel when the + * '_pm_save_flag' variable is non-zero. + */ +void arch_cpu_idle(void) +{ + /* curiously it arrives here with the interrupts masked + * so umask it before wait for an event + */ + arch_irq_unlock(MSTATUS_IEN); + + /* Wait for interrupt */ + __asm__ volatile("wfi"); +} From bcd0576b7c34e1c3d5d72073adbd15f04cbe3d10 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:32 +0100 Subject: [PATCH 1087/2300] Revert "[nrf fromtree] arch: riscv: idle: trace idle and call wfi" This reverts commit f07659bdbf3d6b790d58e2b895e2c55f163ed979. Signed-off-by: Robert Lubos --- arch/riscv/core/cpu_idle.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/riscv/core/cpu_idle.c b/arch/riscv/core/cpu_idle.c index 0d8e4fedeb2..0c7f5f3dac7 100644 --- a/arch/riscv/core/cpu_idle.c +++ b/arch/riscv/core/cpu_idle.c @@ -5,18 +5,24 @@ */ #include -#include + +/* + * In RISC-V there is no conventional way to handle CPU power save. + * Each RISC-V SOC handles it in its own way. + * Hence, by default, arch_cpu_idle and arch_cpu_atomic_idle functions just + * unlock interrupts and return to the caller, without issuing any CPU power + * saving instruction. + * + * Nonetheless, define the default arch_cpu_idle and arch_cpu_atomic_idle + * functions as weak functions, so that they can be replaced at the SOC-level. + */ void __weak arch_cpu_idle(void) { - sys_trace_idle(); irq_unlock(MSTATUS_IEN); - __asm__ volatile("wfi"); } void __weak arch_cpu_atomic_idle(unsigned int key) { - sys_trace_idle(); irq_unlock(key); - __asm__ volatile("wfi"); } From 2847dfa33e92402f6a5227c91af1629c24162e46 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:33 +0100 Subject: [PATCH 1088/2300] Revert "[nrf fromtree] soc: riscv: privileged: efinix-sapphire: Enable CONFIG_RISCV_HAS_CPU_IDLE" This reverts commit 39e621b7d51023bf0a43f401e81eea19e024f390. Signed-off-by: Robert Lubos --- soc/riscv/efinix_sapphire/Kconfig.defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/soc/riscv/efinix_sapphire/Kconfig.defconfig b/soc/riscv/efinix_sapphire/Kconfig.defconfig index 7018c0f11fb..5424bca7baf 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.defconfig +++ b/soc/riscv/efinix_sapphire/Kconfig.defconfig @@ -11,7 +11,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config RISCV_HAS_CPU_IDLE bool - default y config RISCV_SOC_INTERRUPT_INIT bool From 2c62dea520e0eed6bf5d0c72f56d4257f9bc1e29 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:33 +0100 Subject: [PATCH 1089/2300] Revert "[nrf fromtree] soc: riscv: drop RISCV_PRIVILEGED_STANDALONE" This reverts commit d89a3dcfeddd95e4803e86289ac2df9d55957593. Signed-off-by: Robert Lubos --- soc/riscv/andes_v5/ae350/Kconfig.series | 1 + soc/riscv/common/riscv-privileged/Kconfig | 7 +++++++ soc/riscv/efinix_sapphire/Kconfig.soc | 1 + soc/riscv/gd_gd32/gd32vf103/Kconfig.series | 1 + soc/riscv/intel_niosv/niosv/Kconfig.series | 1 + soc/riscv/microchip_miv/miv/Kconfig.series | 1 + soc/riscv/microchip_miv/polarfire/Kconfig.series | 1 + soc/riscv/neorv32/Kconfig.soc | 1 + soc/riscv/opentitan/Kconfig.soc | 1 + soc/riscv/renode_virt/Kconfig.soc | 1 + soc/riscv/sifive_freedom/e300/Kconfig.series | 1 + soc/riscv/sifive_freedom/u500/Kconfig.series | 1 + soc/riscv/sifive_freedom/u700/Kconfig.series | 1 + soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series | 1 + soc/riscv/telink_tlsr/tlsr951x/Kconfig.series | 1 + soc/riscv/virt/Kconfig.soc | 1 + 16 files changed, 22 insertions(+) diff --git a/soc/riscv/andes_v5/ae350/Kconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.series index ebf68f7a3aa..4eb9557f92f 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.series +++ b/soc/riscv/andes_v5/ae350/Kconfig.series @@ -5,6 +5,7 @@ config SOC_SERIES_ANDES_AE350 bool "Andes V5 AE350 SoC Series Implementation" select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_ANDES_V5 help Enable support for Andes V5 AE350 SoC Series diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index a4a8da0bf1f..de064842604 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -4,6 +4,13 @@ # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 +config RISCV_PRIVILEGED_STANDALONE + bool + +config SOC_FAMILY + string + default "riscv-privileged" if RISCV_PRIVILEGED && !RISCV_PRIVILEGED_STANDALONE + config RISCV_HAS_PLIC bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" depends on RISCV_PRIVILEGED diff --git a/soc/riscv/efinix_sapphire/Kconfig.soc b/soc/riscv/efinix_sapphire/Kconfig.soc index bf57d9cc541..2cc5f3ba361 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.soc +++ b/soc/riscv/efinix_sapphire/Kconfig.soc @@ -12,3 +12,4 @@ config SOC_EFINIX_SAPPHIRE select RISCV_ISA_EXT_ZIFENCEI select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.series b/soc/riscv/gd_gd32/gd32vf103/Kconfig.series index e50567e0798..b0b86db7c02 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.series +++ b/soc/riscv/gd_gd32/gd32vf103/Kconfig.series @@ -16,5 +16,6 @@ config SOC_SERIES_GD32VF103 select HAS_GD32_HAL select RISCV_HAS_CLIC select SOC_FAMILY_GD32 + select RISCV_PRIVILEGED_STANDALONE help Enable support for GigaDevice GD32VF1 series SoC diff --git a/soc/riscv/intel_niosv/niosv/Kconfig.series b/soc/riscv/intel_niosv/niosv/Kconfig.series index 9d7aa492692..b8edc073916 100644 --- a/soc/riscv/intel_niosv/niosv/Kconfig.series +++ b/soc/riscv/intel_niosv/niosv/Kconfig.series @@ -5,6 +5,7 @@ config SOC_SERIES_NIOSV bool "INTEL FPGA NIOSV" select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_INTEL_NIOSV help Enable support for the INTEL FPGA NIOSV. diff --git a/soc/riscv/microchip_miv/miv/Kconfig.series b/soc/riscv/microchip_miv/miv/Kconfig.series index 2989876c0e0..20430e6d0f9 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.series +++ b/soc/riscv/microchip_miv/miv/Kconfig.series @@ -8,5 +8,6 @@ config SOC_SERIES_MIV select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE help Enable support for Microchip Mi-V diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.series b/soc/riscv/microchip_miv/polarfire/Kconfig.series index 9001efc2858..4bbceaee745 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.series +++ b/soc/riscv/microchip_miv/polarfire/Kconfig.series @@ -8,5 +8,6 @@ config SOC_SERIES_POLARFIRE select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE help Enable support for Microchip RISCV 64bit diff --git a/soc/riscv/neorv32/Kconfig.soc b/soc/riscv/neorv32/Kconfig.soc index 3155d1b7c31..f07bba96574 100644 --- a/soc/riscv/neorv32/Kconfig.soc +++ b/soc/riscv/neorv32/Kconfig.soc @@ -10,6 +10,7 @@ config SOC_NEORV32 select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE help Enable support for the NEORV32 Processor (SoC). diff --git a/soc/riscv/opentitan/Kconfig.soc b/soc/riscv/opentitan/Kconfig.soc index 8270fde110d..b482afce469 100644 --- a/soc/riscv/opentitan/Kconfig.soc +++ b/soc/riscv/opentitan/Kconfig.soc @@ -19,3 +19,4 @@ config SOC_OPENTITAN # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. select RISCV_VECTORED_MODE select GEN_IRQ_VECTOR_TABLE + select RISCV_PRIVILEGED_STANDALONE diff --git a/soc/riscv/renode_virt/Kconfig.soc b/soc/riscv/renode_virt/Kconfig.soc index 5aae660880a..3e8af25099f 100644 --- a/soc/riscv/renode_virt/Kconfig.soc +++ b/soc/riscv/renode_virt/Kconfig.soc @@ -5,6 +5,7 @@ config SOC_RISCV32_VIRTUAL_RENODE bool "Renode RISCV32 Virtual system implementation" select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR select RISCV_ISA_RV32I diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.series index 47ae89e6d4c..066f8909d53 100644 --- a/soc/riscv/sifive_freedom/e300/Kconfig.series +++ b/soc/riscv/sifive_freedom/e300/Kconfig.series @@ -7,6 +7,7 @@ config SOC_SERIES_SIFIVE_FREEDOM_E300 bool "SiFive Freedom E300 SOC implementation" select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom FE300 SOC diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.series index a576dfbc6f7..963a265f383 100644 --- a/soc/riscv/sifive_freedom/u500/Kconfig.series +++ b/soc/riscv/sifive_freedom/u500/Kconfig.series @@ -7,6 +7,7 @@ config SOC_SERIES_SIFIVE_FREEDOM_U500 bool "SiFive Freedom U500 SOC implementation" select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom U500 SOC diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.series index 613844703c7..b4ca38697f8 100644 --- a/soc/riscv/sifive_freedom/u700/Kconfig.series +++ b/soc/riscv/sifive_freedom/u700/Kconfig.series @@ -7,6 +7,7 @@ config SOC_SERIES_SIFIVE_FREEDOM_U700 bool "SiFive Freedom SOC U700 implementation" select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE select SOC_FAMILY_SIFIVE_FREEDOM help Enable support for SiFive Freedom U700 SOC diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series index 19cedcefe27..d70cff1c63d 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series +++ b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series @@ -5,5 +5,6 @@ config SOC_SERIES_STARFIVE_JH71XX bool "Starfive JH71XX series" select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE help Enable support for Starfive JH71XX SoC Series. diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series index 5ad3053725e..e074a53e11b 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series +++ b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series @@ -16,5 +16,6 @@ config SOC_SERIES_TELINK_TLSR951X select CPU_HAS_FPU select INCLUDE_RESET_VECTOR select SOC_FAMILY_TELINK_TLSR + select RISCV_PRIVILEGED_STANDALONE help Enable support for Telink TLSR951X diff --git a/soc/riscv/virt/Kconfig.soc b/soc/riscv/virt/Kconfig.soc index 9a9168f5a8c..fb615005b0a 100644 --- a/soc/riscv/virt/Kconfig.soc +++ b/soc/riscv/virt/Kconfig.soc @@ -10,3 +10,4 @@ config SOC_RISCV_VIRT select RISCV_ISA_EXT_C select RISCV select RISCV_PRIVILEGED + select RISCV_PRIVILEGED_STANDALONE From 0742b1842760cc4812dfef2a7424e482a007d250 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:33 +0100 Subject: [PATCH 1090/2300] Revert "[nrf fromtree] soc: riscv: renove_virt: reorganize SoC folder" This reverts commit 6054e60839979c9146a7b9fad70d496d93a74cf4. Signed-off-by: Robert Lubos --- boards/riscv/riscv32_virtual/riscv32_virtual_defconfig | 1 + .../{ => riscv-privileged}/renode_virt/CMakeLists.txt | 0 .../renode_virt/Kconfig.defconfig.series} | 6 +++--- soc/riscv/riscv-privileged/renode_virt/Kconfig.series | 9 +++++++++ soc/riscv/{ => riscv-privileged}/renode_virt/Kconfig.soc | 9 ++++++--- soc/riscv/{ => riscv-privileged}/renode_virt/soc.h | 0 6 files changed, 19 insertions(+), 6 deletions(-) rename soc/riscv/{ => riscv-privileged}/renode_virt/CMakeLists.txt (100%) rename soc/riscv/{renode_virt/Kconfig.defconfig => riscv-privileged/renode_virt/Kconfig.defconfig.series} (86%) create mode 100644 soc/riscv/riscv-privileged/renode_virt/Kconfig.series rename soc/riscv/{ => riscv-privileged}/renode_virt/Kconfig.soc (75%) rename soc/riscv/{ => riscv-privileged}/renode_virt/soc.h (100%) diff --git a/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig b/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig index 4dcad0a7ea1..a905f99da2e 100644 --- a/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig +++ b/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig @@ -1,6 +1,7 @@ # Copyright (c) 2023 Meta # SPDX-License-Identifier: Apache-2.0 +CONFIG_SOC_SERIES_RISCV32_VIRTUAL_RENODE=y CONFIG_SOC_RISCV32_VIRTUAL_RENODE=y CONFIG_BOARD_RISCV32_VIRTUAL=y CONFIG_CONSOLE=y diff --git a/soc/riscv/renode_virt/CMakeLists.txt b/soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt similarity index 100% rename from soc/riscv/renode_virt/CMakeLists.txt rename to soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt diff --git a/soc/riscv/renode_virt/Kconfig.defconfig b/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series similarity index 86% rename from soc/riscv/renode_virt/Kconfig.defconfig rename to soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series index 89e226edbb1..09adc3d00e8 100644 --- a/soc/riscv/renode_virt/Kconfig.defconfig +++ b/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series @@ -1,9 +1,9 @@ # Copyright (c) 2023 Meta # SPDX-License-Identifier: Apache-2.0 -if SOC_RISCV32_VIRTUAL_RENODE +if SOC_SERIES_RISCV32_VIRTUAL_RENODE -config SOC +config SOC_SERIES default "renode_virt" config SYS_CLOCK_HW_CYCLES_PER_SEC @@ -45,4 +45,4 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 2058 -endif # SOC_RISCV32_VIRTUAL_RENODE +endif # SOC_SERIES_RISCV32_VIRTUAL_RENODE diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.series b/soc/riscv/riscv-privileged/renode_virt/Kconfig.series new file mode 100644 index 00000000000..22e27cf38b4 --- /dev/null +++ b/soc/riscv/riscv-privileged/renode_virt/Kconfig.series @@ -0,0 +1,9 @@ +# Copyright (c) 2023 Meta +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_RISCV32_VIRTUAL_RENODE + bool "Renode RISC-V32 Virtual SoC implementation" + select RISCV + select SOC_FAMILY_RISCV_PRIVILEGED + help + Enable support for Renode RISC-V Virtual diff --git a/soc/riscv/renode_virt/Kconfig.soc b/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc similarity index 75% rename from soc/riscv/renode_virt/Kconfig.soc rename to soc/riscv/riscv-privileged/renode_virt/Kconfig.soc index 3e8af25099f..d123e797229 100644 --- a/soc/riscv/renode_virt/Kconfig.soc +++ b/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc @@ -1,11 +1,12 @@ # Copyright (c) 2023 Meta # SPDX-License-Identifier: Apache-2.0 +choice + prompt "Renode RISCV32 Virtual system implementation" + depends on SOC_SERIES_RISCV32_VIRTUAL_RENODE + config SOC_RISCV32_VIRTUAL_RENODE bool "Renode RISCV32 Virtual system implementation" - select RISCV - select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR select RISCV_ISA_RV32I @@ -14,3 +15,5 @@ config SOC_RISCV32_VIRTUAL_RENODE select RISCV_ISA_EXT_C select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI + +endchoice diff --git a/soc/riscv/renode_virt/soc.h b/soc/riscv/riscv-privileged/renode_virt/soc.h similarity index 100% rename from soc/riscv/renode_virt/soc.h rename to soc/riscv/riscv-privileged/renode_virt/soc.h From b4f469e3879a986ed05abe5de68c05f9358b8496 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:33 +0100 Subject: [PATCH 1091/2300] Revert "[nrf fromtree] soc: riscv: niosv: reorganize SoC folder" This reverts commit 1f276b7c1baa3aaa51c0c7387846d14798ad7eaf. Signed-off-by: Robert Lubos --- soc/riscv/intel_niosv/Kconfig | 15 --------------- soc/riscv/intel_niosv/Kconfig.defconfig | 4 ---- soc/riscv/intel_niosv/Kconfig.soc | 4 ---- .../CMakeLists.txt | 1 - soc/riscv/riscv-privileged/Kconfig | 4 ++++ soc/riscv/riscv-privileged/Kconfig.defconfig | 6 ++++++ soc/riscv/riscv-privileged/Kconfig.soc | 6 ++++++ .../niosv/CMakeLists.txt | 0 .../niosv/Kconfig.defconfig.series | 2 +- .../niosv/Kconfig.series | 2 -- .../niosv/Kconfig.soc | 0 .../niosv/linker.ld | 0 .../{intel_niosv => riscv-privileged}/niosv/soc.h | 0 13 files changed, 17 insertions(+), 27 deletions(-) delete mode 100644 soc/riscv/intel_niosv/Kconfig delete mode 100644 soc/riscv/intel_niosv/Kconfig.defconfig delete mode 100644 soc/riscv/intel_niosv/Kconfig.soc rename soc/riscv/{intel_niosv => riscv-privileged}/CMakeLists.txt (62%) create mode 100644 soc/riscv/riscv-privileged/Kconfig create mode 100644 soc/riscv/riscv-privileged/Kconfig.defconfig create mode 100644 soc/riscv/riscv-privileged/Kconfig.soc rename soc/riscv/{intel_niosv => riscv-privileged}/niosv/CMakeLists.txt (100%) rename soc/riscv/{intel_niosv => riscv-privileged}/niosv/Kconfig.defconfig.series (94%) rename soc/riscv/{intel_niosv => riscv-privileged}/niosv/Kconfig.series (76%) rename soc/riscv/{intel_niosv => riscv-privileged}/niosv/Kconfig.soc (100%) rename soc/riscv/{intel_niosv => riscv-privileged}/niosv/linker.ld (100%) rename soc/riscv/{intel_niosv => riscv-privileged}/niosv/soc.h (100%) diff --git a/soc/riscv/intel_niosv/Kconfig b/soc/riscv/intel_niosv/Kconfig deleted file mode 100644 index b841d19c922..00000000000 --- a/soc/riscv/intel_niosv/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_INTEL_NIOSV - bool - -if SOC_FAMILY_INTEL_NIOSV - -config SOC_FAMILY - string - default "intel_niosv" - -source "soc/riscv/intel_niosv/*/Kconfig.soc" - -endif # SOC_FAMILY_INTEL_NIOSV diff --git a/soc/riscv/intel_niosv/Kconfig.defconfig b/soc/riscv/intel_niosv/Kconfig.defconfig deleted file mode 100644 index 2afa0f7e0e6..00000000000 --- a/soc/riscv/intel_niosv/Kconfig.defconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/intel_niosv/*/Kconfig.defconfig.series" diff --git a/soc/riscv/intel_niosv/Kconfig.soc b/soc/riscv/intel_niosv/Kconfig.soc deleted file mode 100644 index 8567429c61f..00000000000 --- a/soc/riscv/intel_niosv/Kconfig.soc +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/intel_niosv/*/Kconfig.series" diff --git a/soc/riscv/intel_niosv/CMakeLists.txt b/soc/riscv/riscv-privileged/CMakeLists.txt similarity index 62% rename from soc/riscv/intel_niosv/CMakeLists.txt rename to soc/riscv/riscv-privileged/CMakeLists.txt index 69b2926358e..226f3bd626f 100644 --- a/soc/riscv/intel_niosv/CMakeLists.txt +++ b/soc/riscv/riscv-privileged/CMakeLists.txt @@ -1,4 +1,3 @@ -# Copyright (c) 2024 Nordic Semiconductor # SPDX-License-Identifier: Apache-2.0 add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/riscv-privileged/Kconfig b/soc/riscv/riscv-privileged/Kconfig new file mode 100644 index 00000000000..b0700dd3440 --- /dev/null +++ b/soc/riscv/riscv-privileged/Kconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/riscv-privileged/*/Kconfig.soc" diff --git a/soc/riscv/riscv-privileged/Kconfig.defconfig b/soc/riscv/riscv-privileged/Kconfig.defconfig new file mode 100644 index 00000000000..6793d72a385 --- /dev/null +++ b/soc/riscv/riscv-privileged/Kconfig.defconfig @@ -0,0 +1,6 @@ +# riscv SOC family supporting the riscv privileged architecture spec + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/riscv-privileged/*/Kconfig.defconfig.series" diff --git a/soc/riscv/riscv-privileged/Kconfig.soc b/soc/riscv/riscv-privileged/Kconfig.soc new file mode 100644 index 00000000000..14d141223e0 --- /dev/null +++ b/soc/riscv/riscv-privileged/Kconfig.soc @@ -0,0 +1,6 @@ +# riscv SOC series supporting the riscv privileged architecture spec + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +source "soc/riscv/riscv-privileged/*/Kconfig.series" diff --git a/soc/riscv/intel_niosv/niosv/CMakeLists.txt b/soc/riscv/riscv-privileged/niosv/CMakeLists.txt similarity index 100% rename from soc/riscv/intel_niosv/niosv/CMakeLists.txt rename to soc/riscv/riscv-privileged/niosv/CMakeLists.txt diff --git a/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/niosv/Kconfig.defconfig.series similarity index 94% rename from soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series rename to soc/riscv/riscv-privileged/niosv/Kconfig.defconfig.series index 8e8ea255202..532a67959d2 100644 --- a/soc/riscv/intel_niosv/niosv/Kconfig.defconfig.series +++ b/soc/riscv/riscv-privileged/niosv/Kconfig.defconfig.series @@ -21,4 +21,4 @@ config RISCV_GP config RISCV_SOC_INTERRUPT_INIT default y -endif # SOC_NIOSV +endif # SOC_SERIES_NIOSV diff --git a/soc/riscv/intel_niosv/niosv/Kconfig.series b/soc/riscv/riscv-privileged/niosv/Kconfig.series similarity index 76% rename from soc/riscv/intel_niosv/niosv/Kconfig.series rename to soc/riscv/riscv-privileged/niosv/Kconfig.series index b8edc073916..104f5a48352 100644 --- a/soc/riscv/intel_niosv/niosv/Kconfig.series +++ b/soc/riscv/riscv-privileged/niosv/Kconfig.series @@ -5,7 +5,5 @@ config SOC_SERIES_NIOSV bool "INTEL FPGA NIOSV" select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE - select SOC_FAMILY_INTEL_NIOSV help Enable support for the INTEL FPGA NIOSV. diff --git a/soc/riscv/intel_niosv/niosv/Kconfig.soc b/soc/riscv/riscv-privileged/niosv/Kconfig.soc similarity index 100% rename from soc/riscv/intel_niosv/niosv/Kconfig.soc rename to soc/riscv/riscv-privileged/niosv/Kconfig.soc diff --git a/soc/riscv/intel_niosv/niosv/linker.ld b/soc/riscv/riscv-privileged/niosv/linker.ld similarity index 100% rename from soc/riscv/intel_niosv/niosv/linker.ld rename to soc/riscv/riscv-privileged/niosv/linker.ld diff --git a/soc/riscv/intel_niosv/niosv/soc.h b/soc/riscv/riscv-privileged/niosv/soc.h similarity index 100% rename from soc/riscv/intel_niosv/niosv/soc.h rename to soc/riscv/riscv-privileged/niosv/soc.h From ebbd4a97be9fd39d69b529e1c03b230cbf1e9529 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:33 +0100 Subject: [PATCH 1092/2300] Revert "[nrf fromtree] soc: riscv: opentitan: reorganize SoC folder" This reverts commit 388121ddb79fa3e5038831de965abfd7ba93fac5. Signed-off-by: Robert Lubos --- boards/riscv/opentitan_earlgrey/Kconfig.board | 2 +- .../opentitan_earlgrey_defconfig | 3 ++- .../opentitan/CMakeLists.txt | 0 .../opentitan/Kconfig.defconfig.series} | 6 +++--- .../riscv-privileged/opentitan/Kconfig.series | 12 ++++++++++++ .../{ => riscv-privileged}/opentitan/Kconfig.soc | 14 +++++++------- .../{ => riscv-privileged}/opentitan/rom_header.S | 0 .../{ => riscv-privileged}/opentitan/rom_header.ld | 0 soc/riscv/{ => riscv-privileged}/opentitan/soc.c | 0 soc/riscv/{ => riscv-privileged}/opentitan/soc.h | 0 10 files changed, 25 insertions(+), 12 deletions(-) rename soc/riscv/{ => riscv-privileged}/opentitan/CMakeLists.txt (100%) rename soc/riscv/{opentitan/Kconfig.defconfig => riscv-privileged/opentitan/Kconfig.defconfig.series} (83%) create mode 100644 soc/riscv/riscv-privileged/opentitan/Kconfig.series rename soc/riscv/{ => riscv-privileged}/opentitan/Kconfig.soc (63%) rename soc/riscv/{ => riscv-privileged}/opentitan/rom_header.S (100%) rename soc/riscv/{ => riscv-privileged}/opentitan/rom_header.ld (100%) rename soc/riscv/{ => riscv-privileged}/opentitan/soc.c (100%) rename soc/riscv/{ => riscv-privileged}/opentitan/soc.h (100%) diff --git a/boards/riscv/opentitan_earlgrey/Kconfig.board b/boards/riscv/opentitan_earlgrey/Kconfig.board index 544c02b1b2a..ec7f735b442 100644 --- a/boards/riscv/opentitan_earlgrey/Kconfig.board +++ b/boards/riscv/opentitan_earlgrey/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_OPENTITAN_EARLGREY bool "OpenTitan Earl Grey Target" - depends on SOC_OPENTITAN + depends on SOC_RISCV_OPENTITAN diff --git a/boards/riscv/opentitan_earlgrey/opentitan_earlgrey_defconfig b/boards/riscv/opentitan_earlgrey/opentitan_earlgrey_defconfig index 886e439b88a..79299c3892f 100644 --- a/boards/riscv/opentitan_earlgrey/opentitan_earlgrey_defconfig +++ b/boards/riscv/opentitan_earlgrey/opentitan_earlgrey_defconfig @@ -1,7 +1,8 @@ # Copyright (c) 2023 by Rivos Inc. # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_OPENTITAN=y +CONFIG_SOC_SERIES_RISCV_OPENTITAN=y +CONFIG_SOC_RISCV_OPENTITAN=y CONFIG_BOARD_OPENTITAN_EARLGREY=y CONFIG_XIP=y CONFIG_SERIAL=y diff --git a/soc/riscv/opentitan/CMakeLists.txt b/soc/riscv/riscv-privileged/opentitan/CMakeLists.txt similarity index 100% rename from soc/riscv/opentitan/CMakeLists.txt rename to soc/riscv/riscv-privileged/opentitan/CMakeLists.txt diff --git a/soc/riscv/opentitan/Kconfig.defconfig b/soc/riscv/riscv-privileged/opentitan/Kconfig.defconfig.series similarity index 83% rename from soc/riscv/opentitan/Kconfig.defconfig rename to soc/riscv/riscv-privileged/opentitan/Kconfig.defconfig.series index cc27b7ffd6b..c9e7f8396a0 100644 --- a/soc/riscv/opentitan/Kconfig.defconfig +++ b/soc/riscv/riscv-privileged/opentitan/Kconfig.defconfig.series @@ -1,9 +1,9 @@ # Copyright (c) 2023 Rivos Inc. # SPDX-License-Identifier: Apache-2.0 -if SOC_OPENTITAN +if SOC_SERIES_RISCV_OPENTITAN -config SOC +config SOC_SERIES default "opentitan" config SYS_CLOCK_HW_CYCLES_PER_SEC @@ -30,4 +30,4 @@ config 2ND_LVL_INTR_00_OFFSET config NUM_IRQS default 217 -endif # SOC_OPENTITAN +endif # SOC_SERIES_RISCV_OPENTITAN diff --git a/soc/riscv/riscv-privileged/opentitan/Kconfig.series b/soc/riscv/riscv-privileged/opentitan/Kconfig.series new file mode 100644 index 00000000000..b516e6d8092 --- /dev/null +++ b/soc/riscv/riscv-privileged/opentitan/Kconfig.series @@ -0,0 +1,12 @@ +# Copyright (c) 2023 Rivos Inc. +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_RISCV_OPENTITAN + bool "OpenTitan implementation" + select RISCV + select RISCV_PRIVILEGED + # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. + select RISCV_VECTORED_MODE + select GEN_IRQ_VECTOR_TABLE + help + Enable support for OpenTitan diff --git a/soc/riscv/opentitan/Kconfig.soc b/soc/riscv/riscv-privileged/opentitan/Kconfig.soc similarity index 63% rename from soc/riscv/opentitan/Kconfig.soc rename to soc/riscv/riscv-privileged/opentitan/Kconfig.soc index b482afce469..098b1844e52 100644 --- a/soc/riscv/opentitan/Kconfig.soc +++ b/soc/riscv/riscv-privileged/opentitan/Kconfig.soc @@ -1,7 +1,11 @@ # Copyright (c) 2023 Rivos Inc. # SPDX-License-Identifier: Apache-2.0 -config SOC_OPENTITAN +choice + prompt "OpenTitan implementation" + depends on SOC_SERIES_RISCV_OPENTITAN + +config SOC_RISCV_OPENTITAN bool "OpenTitan implementation" select ATOMIC_OPERATIONS_C select INCLUDE_RESET_VECTOR @@ -14,9 +18,5 @@ config SOC_OPENTITAN select RISCV_ISA_EXT_ZBB select RISCV_ISA_EXT_ZBC select RISCV_ISA_EXT_ZBS - select RISCV - select RISCV_PRIVILEGED - # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. - select RISCV_VECTORED_MODE - select GEN_IRQ_VECTOR_TABLE - select RISCV_PRIVILEGED_STANDALONE + +endchoice diff --git a/soc/riscv/opentitan/rom_header.S b/soc/riscv/riscv-privileged/opentitan/rom_header.S similarity index 100% rename from soc/riscv/opentitan/rom_header.S rename to soc/riscv/riscv-privileged/opentitan/rom_header.S diff --git a/soc/riscv/opentitan/rom_header.ld b/soc/riscv/riscv-privileged/opentitan/rom_header.ld similarity index 100% rename from soc/riscv/opentitan/rom_header.ld rename to soc/riscv/riscv-privileged/opentitan/rom_header.ld diff --git a/soc/riscv/opentitan/soc.c b/soc/riscv/riscv-privileged/opentitan/soc.c similarity index 100% rename from soc/riscv/opentitan/soc.c rename to soc/riscv/riscv-privileged/opentitan/soc.c diff --git a/soc/riscv/opentitan/soc.h b/soc/riscv/riscv-privileged/opentitan/soc.h similarity index 100% rename from soc/riscv/opentitan/soc.h rename to soc/riscv/riscv-privileged/opentitan/soc.h From cf8f0debd92eda72c42a095778454d7a8bfe1254 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:34 +0100 Subject: [PATCH 1093/2300] Revert "[nrf fromtree] soc: riscv: sifive-freedom: reorganize SoC folder" This reverts commit 46b0dae15b5bbfb362e147ac45ce1ba899afb2ba. Signed-off-by: Robert Lubos --- boards/riscv/hifive1/Kconfig.board | 2 +- boards/riscv/hifive1/hifive1_defconfig | 4 +- boards/riscv/hifive1_revb/Kconfig.board | 2 +- .../riscv/hifive1_revb/hifive1_revb_defconfig | 4 +- boards/riscv/hifive_unleashed/Kconfig.board | 2 +- .../hifive_unleashed_defconfig | 4 +- boards/riscv/hifive_unmatched/Kconfig.board | 2 +- .../hifive_unmatched_defconfig | 4 +- boards/riscv/qemu_riscv32/Kconfig.board | 2 +- .../qemu_riscv32/qemu_riscv32_xip_defconfig | 4 +- .../sparkfun_red_v_things_plus/Kconfig.board | 2 +- .../sparkfun_red_v_things_plus_defconfig | 4 +- .../sifive-freedom/CMakeLists.txt | 8 ++++ .../sifive-freedom}/Kconfig.defconfig.series | 9 ++-- .../sifive-freedom/Kconfig.series | 11 +++++ .../sifive-freedom/Kconfig.soc | 44 +++++++++++++++++++ .../sifive-freedom/fe310_clock.c} | 2 +- .../sifive-freedom/fe310_prci.h} | 0 .../sifive-freedom/fu540_clock.c} | 2 +- .../sifive-freedom/fu540_prci.h} | 0 .../sifive-freedom/fu740_clock.c} | 2 +- .../sifive-freedom/fu740_prci.h} | 0 .../sifive-freedom}/pinctrl_soc.h | 0 .../sifive-freedom}/soc.h | 27 ++++++++++-- soc/riscv/sifive_freedom/CMakeLists.txt | 5 --- soc/riscv/sifive_freedom/Kconfig | 15 ------- soc/riscv/sifive_freedom/Kconfig.defconfig | 4 -- soc/riscv/sifive_freedom/Kconfig.soc | 4 -- .../sifive_freedom/common/CMakeLists.txt | 3 -- soc/riscv/sifive_freedom/e300/CMakeLists.txt | 5 --- .../e300/Kconfig.defconfig.e340 | 5 --- soc/riscv/sifive_freedom/e300/Kconfig.series | 13 ------ soc/riscv/sifive_freedom/e300/Kconfig.soc | 20 --------- soc/riscv/sifive_freedom/u500/CMakeLists.txt | 5 --- .../u500/Kconfig.defconfig.series | 38 ---------------- .../u500/Kconfig.defconfig.u540 | 5 --- soc/riscv/sifive_freedom/u500/Kconfig.series | 13 ------ soc/riscv/sifive_freedom/u500/Kconfig.soc | 22 ---------- soc/riscv/sifive_freedom/u500/soc.h | 32 -------------- soc/riscv/sifive_freedom/u700/CMakeLists.txt | 5 --- .../u700/Kconfig.defconfig.series | 38 ---------------- .../u700/Kconfig.defconfig.u740 | 5 --- soc/riscv/sifive_freedom/u700/Kconfig.series | 13 ------ soc/riscv/sifive_freedom/u700/Kconfig.soc | 22 ---------- soc/riscv/sifive_freedom/u700/soc.h | 26 ----------- 45 files changed, 111 insertions(+), 328 deletions(-) create mode 100644 soc/riscv/riscv-privileged/sifive-freedom/CMakeLists.txt rename soc/riscv/{sifive_freedom/e300 => riscv-privileged/sifive-freedom}/Kconfig.defconfig.series (65%) create mode 100644 soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series create mode 100644 soc/riscv/riscv-privileged/sifive-freedom/Kconfig.soc rename soc/riscv/{sifive_freedom/e300/clock.c => riscv-privileged/sifive-freedom/fe310_clock.c} (98%) rename soc/riscv/{sifive_freedom/e300/prci.h => riscv-privileged/sifive-freedom/fe310_prci.h} (100%) rename soc/riscv/{sifive_freedom/u500/clock.c => riscv-privileged/sifive-freedom/fu540_clock.c} (97%) rename soc/riscv/{sifive_freedom/u500/prci.h => riscv-privileged/sifive-freedom/fu540_prci.h} (100%) rename soc/riscv/{sifive_freedom/u700/clock.c => riscv-privileged/sifive-freedom/fu740_clock.c} (99%) rename soc/riscv/{sifive_freedom/u700/prci.h => riscv-privileged/sifive-freedom/fu740_prci.h} (100%) rename soc/riscv/{sifive_freedom/common => riscv-privileged/sifive-freedom}/pinctrl_soc.h (100%) rename soc/riscv/{sifive_freedom/e300 => riscv-privileged/sifive-freedom}/soc.h (52%) delete mode 100644 soc/riscv/sifive_freedom/CMakeLists.txt delete mode 100644 soc/riscv/sifive_freedom/Kconfig delete mode 100644 soc/riscv/sifive_freedom/Kconfig.defconfig delete mode 100644 soc/riscv/sifive_freedom/Kconfig.soc delete mode 100644 soc/riscv/sifive_freedom/common/CMakeLists.txt delete mode 100644 soc/riscv/sifive_freedom/e300/CMakeLists.txt delete mode 100644 soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e340 delete mode 100644 soc/riscv/sifive_freedom/e300/Kconfig.series delete mode 100644 soc/riscv/sifive_freedom/e300/Kconfig.soc delete mode 100644 soc/riscv/sifive_freedom/u500/CMakeLists.txt delete mode 100644 soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series delete mode 100644 soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u540 delete mode 100644 soc/riscv/sifive_freedom/u500/Kconfig.series delete mode 100644 soc/riscv/sifive_freedom/u500/Kconfig.soc delete mode 100644 soc/riscv/sifive_freedom/u500/soc.h delete mode 100644 soc/riscv/sifive_freedom/u700/CMakeLists.txt delete mode 100644 soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series delete mode 100644 soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u740 delete mode 100644 soc/riscv/sifive_freedom/u700/Kconfig.series delete mode 100644 soc/riscv/sifive_freedom/u700/Kconfig.soc delete mode 100644 soc/riscv/sifive_freedom/u700/soc.h diff --git a/boards/riscv/hifive1/Kconfig.board b/boards/riscv/hifive1/Kconfig.board index d2f40472f24..b5b32649441 100644 --- a/boards/riscv/hifive1/Kconfig.board +++ b/boards/riscv/hifive1/Kconfig.board @@ -2,4 +2,4 @@ config BOARD_HIFIVE1 bool "HiFive1 target" - depends on SOC_SIFIVE_FREEDOM_E340 + depends on SOC_RISCV_SIFIVE_FREEDOM diff --git a/boards/riscv/hifive1/hifive1_defconfig b/boards/riscv/hifive1/hifive1_defconfig index 8e4e8e21c1a..d37ded2bb25 100644 --- a/boards/riscv/hifive1/hifive1_defconfig +++ b/boards/riscv/hifive1/hifive1_defconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_SIFIVE_FREEDOM_E300=y -CONFIG_SOC_SIFIVE_FREEDOM_E340=y +CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_RISCV_SIFIVE_FREEDOM=y CONFIG_BOARD_HIFIVE1=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/riscv/hifive1_revb/Kconfig.board b/boards/riscv/hifive1_revb/Kconfig.board index b0bf1edd156..d4c5b99ce72 100644 --- a/boards/riscv/hifive1_revb/Kconfig.board +++ b/boards/riscv/hifive1_revb/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_HIFIVE1_REVB bool "HiFive1 Rev B target" - depends on SOC_SIFIVE_FREEDOM_E340 + depends on SOC_RISCV_SIFIVE_FREEDOM diff --git a/boards/riscv/hifive1_revb/hifive1_revb_defconfig b/boards/riscv/hifive1_revb/hifive1_revb_defconfig index b2119eecae9..4f691bd9435 100644 --- a/boards/riscv/hifive1_revb/hifive1_revb_defconfig +++ b/boards/riscv/hifive1_revb/hifive1_revb_defconfig @@ -1,5 +1,5 @@ -CONFIG_SOC_SERIES_SIFIVE_FREEDOM_E300=y -CONFIG_SOC_SIFIVE_FREEDOM_E340=y +CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_RISCV_SIFIVE_FREEDOM=y CONFIG_BOARD_HIFIVE1_REVB=y CONFIG_GPIO=y CONFIG_PINCTRL=y diff --git a/boards/riscv/hifive_unleashed/Kconfig.board b/boards/riscv/hifive_unleashed/Kconfig.board index f6c623e9928..4766e0ea792 100644 --- a/boards/riscv/hifive_unleashed/Kconfig.board +++ b/boards/riscv/hifive_unleashed/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_HIFIVE_UNLEASHED bool "HiFive Unleashed target" - depends on SOC_SIFIVE_FREEDOM_U540 + depends on SOC_RISCV_SIFIVE_FU540 diff --git a/boards/riscv/hifive_unleashed/hifive_unleashed_defconfig b/boards/riscv/hifive_unleashed/hifive_unleashed_defconfig index 51d324d457d..15c9e60d552 100644 --- a/boards/riscv/hifive_unleashed/hifive_unleashed_defconfig +++ b/boards/riscv/hifive_unleashed/hifive_unleashed_defconfig @@ -1,5 +1,5 @@ -CONFIG_SOC_SERIES_SIFIVE_FREEDOM_U500=y -CONFIG_SOC_SIFIVE_FREEDOM_U540=y +CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_RISCV_SIFIVE_FU540=y CONFIG_BOARD_HIFIVE_UNLEASHED=y CONFIG_CONSOLE=y CONFIG_GPIO=y diff --git a/boards/riscv/hifive_unmatched/Kconfig.board b/boards/riscv/hifive_unmatched/Kconfig.board index bb303cc3aac..cf6ac1c8392 100644 --- a/boards/riscv/hifive_unmatched/Kconfig.board +++ b/boards/riscv/hifive_unmatched/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_HIFIVE_UNMATCHED bool "HiFive Unmatched target" - depends on SOC_SIFIVE_FREEDOM_U740 + depends on SOC_RISCV_SIFIVE_FU740 diff --git a/boards/riscv/hifive_unmatched/hifive_unmatched_defconfig b/boards/riscv/hifive_unmatched/hifive_unmatched_defconfig index be13ed10358..654fdc1bf2a 100644 --- a/boards/riscv/hifive_unmatched/hifive_unmatched_defconfig +++ b/boards/riscv/hifive_unmatched/hifive_unmatched_defconfig @@ -1,5 +1,5 @@ -CONFIG_SOC_SERIES_SIFIVE_FREEDOM_U700=y -CONFIG_SOC_SIFIVE_FREEDOM_U740=y +CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_RISCV_SIFIVE_FU740=y CONFIG_BOARD_HIFIVE_UNMATCHED=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/riscv/qemu_riscv32/Kconfig.board b/boards/riscv/qemu_riscv32/Kconfig.board index 7c94b59455c..989fa13b453 100644 --- a/boards/riscv/qemu_riscv32/Kconfig.board +++ b/boards/riscv/qemu_riscv32/Kconfig.board @@ -22,7 +22,7 @@ config BOARD_QEMU_RISCV32_SMP config BOARD_QEMU_RISCV32_XIP bool "QEMU RISCV32 XIP target" - depends on SOC_SIFIVE_FREEDOM_E340 + depends on SOC_RISCV_SIFIVE_FREEDOM select QEMU_TARGET select HAS_COVERAGE_SUPPORT select CPU_HAS_FPU diff --git a/boards/riscv/qemu_riscv32/qemu_riscv32_xip_defconfig b/boards/riscv/qemu_riscv32/qemu_riscv32_xip_defconfig index 948fa909a08..2cd0b2cbecb 100644 --- a/boards/riscv/qemu_riscv32/qemu_riscv32_xip_defconfig +++ b/boards/riscv/qemu_riscv32/qemu_riscv32_xip_defconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_SIFIVE_FREEDOM_E300=y -CONFIG_SOC_SIFIVE_FREEDOM_E340=y +CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_RISCV_SIFIVE_FREEDOM=y CONFIG_BOARD_QEMU_RISCV32_XIP=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/riscv/sparkfun_red_v_things_plus/Kconfig.board b/boards/riscv/sparkfun_red_v_things_plus/Kconfig.board index cc9e7b4f935..34f852dc0ec 100644 --- a/boards/riscv/sparkfun_red_v_things_plus/Kconfig.board +++ b/boards/riscv/sparkfun_red_v_things_plus/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_SPARKFUN_RED_V_THINGS_PLUS bool "SparkFun RED-V Things Plus board" - depends on SOC_SIFIVE_FREEDOM_E340 + depends on SOC_RISCV_SIFIVE_FREEDOM diff --git a/boards/riscv/sparkfun_red_v_things_plus/sparkfun_red_v_things_plus_defconfig b/boards/riscv/sparkfun_red_v_things_plus/sparkfun_red_v_things_plus_defconfig index 8cf24ffbe09..de3d18bcfde 100644 --- a/boards/riscv/sparkfun_red_v_things_plus/sparkfun_red_v_things_plus_defconfig +++ b/boards/riscv/sparkfun_red_v_things_plus/sparkfun_red_v_things_plus_defconfig @@ -1,8 +1,8 @@ # Copyright (c) 2022 TOKITA Hiroshi # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_SIFIVE_FREEDOM_E300=y -CONFIG_SOC_SIFIVE_FREEDOM_E340=y +CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y +CONFIG_SOC_RISCV_SIFIVE_FREEDOM=y CONFIG_BOARD_SPARKFUN_RED_V_THINGS_PLUS=y CONFIG_GPIO=y CONFIG_PINCTRL=y diff --git a/soc/riscv/riscv-privileged/sifive-freedom/CMakeLists.txt b/soc/riscv/riscv-privileged/sifive-freedom/CMakeLists.txt new file mode 100644 index 00000000000..ff4cc56d739 --- /dev/null +++ b/soc/riscv/riscv-privileged/sifive-freedom/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources() +zephyr_sources_ifdef(CONFIG_SOC_RISCV_SIFIVE_FREEDOM fe310_clock.c) +zephyr_sources_ifdef(CONFIG_SOC_RISCV_SIFIVE_FU540 fu540_clock.c) +zephyr_sources_ifdef(CONFIG_SOC_RISCV_SIFIVE_FU740 fu740_clock.c) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.defconfig.series similarity index 65% rename from soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series rename to soc/riscv/riscv-privileged/sifive-freedom/Kconfig.defconfig.series index b2f16e5261d..0c3cd541773 100644 --- a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.series +++ b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.defconfig.series @@ -1,10 +1,9 @@ -# Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_SIFIVE_FREEDOM_E300 +if SOC_SERIES_RISCV_SIFIVE_FREEDOM config SOC_SERIES - default "e300" + default "sifive-freedom" config SYS_CLOCK_HW_CYCLES_PER_SEC default 32768 @@ -33,6 +32,4 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 64 -source "soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e*" - -endif # SOC_SERIES_SIFIVE_FREEDOM_E300 +endif # SOC_SERIES_RISCV_SIFIVE_FREEDOM diff --git a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series new file mode 100644 index 00000000000..a24b4812c28 --- /dev/null +++ b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series @@ -0,0 +1,11 @@ +# RISCV_SIFIVE_FREEDOM SOC implementation + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_RISCV_SIFIVE_FREEDOM + bool "SiFive Freedom SOC implementation" + select RISCV + select RISCV_PRIVILEGED + help + Enable support for SiFive Freedom SOC diff --git a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.soc b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.soc new file mode 100644 index 00000000000..7840f8a09ba --- /dev/null +++ b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.soc @@ -0,0 +1,44 @@ +# RISCV_SIFIVE_FREEDOM SOC configuration options + +# Copyright (c) 2017 Jean-Paul Etienne +# SPDX-License-Identifier: Apache-2.0 + +choice + prompt "SiFive Freedom SOC implementation" + depends on SOC_SERIES_RISCV_SIFIVE_FREEDOM + +config SOC_RISCV_SIFIVE_FREEDOM + bool "SiFive Freedom SOC implementation" + select ATOMIC_OPERATIONS_C + select INCLUDE_RESET_VECTOR + select RISCV_ISA_RV32I + select RISCV_ISA_EXT_M + select RISCV_ISA_EXT_A + select RISCV_ISA_EXT_ZICSR + select RISCV_ISA_EXT_ZIFENCEI + +config SOC_RISCV_SIFIVE_FU540 + bool "SiFive Freedom U540 SOC implementation" + select ATOMIC_OPERATIONS_C + select INCLUDE_RESET_VECTOR + select 64BIT + select RISCV_ISA_RV64I + select RISCV_ISA_EXT_M + select RISCV_ISA_EXT_A + select RISCV_ISA_EXT_C + select RISCV_ISA_EXT_ZICSR + select RISCV_ISA_EXT_ZIFENCEI + +config SOC_RISCV_SIFIVE_FU740 + bool "SiFive Freedom U740 SOC implementation" + select ATOMIC_OPERATIONS_C + select INCLUDE_RESET_VECTOR + select 64BIT + select RISCV_ISA_RV64I + select RISCV_ISA_EXT_M + select RISCV_ISA_EXT_A + select RISCV_ISA_EXT_C + select RISCV_ISA_EXT_ZICSR + select RISCV_ISA_EXT_ZIFENCEI + +endchoice diff --git a/soc/riscv/sifive_freedom/e300/clock.c b/soc/riscv/riscv-privileged/sifive-freedom/fe310_clock.c similarity index 98% rename from soc/riscv/sifive_freedom/e300/clock.c rename to soc/riscv/riscv-privileged/sifive-freedom/fe310_clock.c index 8fde8121db9..0b642f3e8b2 100644 --- a/soc/riscv/sifive_freedom/e300/clock.c +++ b/soc/riscv/riscv-privileged/sifive-freedom/fe310_clock.c @@ -7,7 +7,7 @@ #include #include -#include "prci.h" +#include "fe310_prci.h" #define CORECLK_HZ (DT_PROP(DT_NODELABEL(coreclk), clock_frequency)) BUILD_ASSERT(DT_PROP(DT_NODELABEL(tlclk), clock_div) == 1, diff --git a/soc/riscv/sifive_freedom/e300/prci.h b/soc/riscv/riscv-privileged/sifive-freedom/fe310_prci.h similarity index 100% rename from soc/riscv/sifive_freedom/e300/prci.h rename to soc/riscv/riscv-privileged/sifive-freedom/fe310_prci.h diff --git a/soc/riscv/sifive_freedom/u500/clock.c b/soc/riscv/riscv-privileged/sifive-freedom/fu540_clock.c similarity index 97% rename from soc/riscv/sifive_freedom/u500/clock.c rename to soc/riscv/riscv-privileged/sifive-freedom/fu540_clock.c index 87929892f77..bc68a502f59 100644 --- a/soc/riscv/sifive_freedom/u500/clock.c +++ b/soc/riscv/riscv-privileged/sifive-freedom/fu540_clock.c @@ -7,7 +7,7 @@ #include #include #include -#include "prci.h" +#include "fu540_prci.h" BUILD_ASSERT(MHZ(1000) == DT_PROP(DT_NODELABEL(coreclk), clock_frequency), "Unsupported CORECLK frequency"); diff --git a/soc/riscv/sifive_freedom/u500/prci.h b/soc/riscv/riscv-privileged/sifive-freedom/fu540_prci.h similarity index 100% rename from soc/riscv/sifive_freedom/u500/prci.h rename to soc/riscv/riscv-privileged/sifive-freedom/fu540_prci.h diff --git a/soc/riscv/sifive_freedom/u700/clock.c b/soc/riscv/riscv-privileged/sifive-freedom/fu740_clock.c similarity index 99% rename from soc/riscv/sifive_freedom/u700/clock.c rename to soc/riscv/riscv-privileged/sifive-freedom/fu740_clock.c index 5c3fa567343..e6bbee93689 100644 --- a/soc/riscv/sifive_freedom/u700/clock.c +++ b/soc/riscv/riscv-privileged/sifive-freedom/fu740_clock.c @@ -8,7 +8,7 @@ #include #include -#include "prci.h" +#include "fu740_prci.h" BUILD_ASSERT(MHZ(1000) == DT_PROP(DT_NODELABEL(coreclk), clock_frequency), "Unsupported CORECLK frequency"); diff --git a/soc/riscv/sifive_freedom/u700/prci.h b/soc/riscv/riscv-privileged/sifive-freedom/fu740_prci.h similarity index 100% rename from soc/riscv/sifive_freedom/u700/prci.h rename to soc/riscv/riscv-privileged/sifive-freedom/fu740_prci.h diff --git a/soc/riscv/sifive_freedom/common/pinctrl_soc.h b/soc/riscv/riscv-privileged/sifive-freedom/pinctrl_soc.h similarity index 100% rename from soc/riscv/sifive_freedom/common/pinctrl_soc.h rename to soc/riscv/riscv-privileged/sifive-freedom/pinctrl_soc.h diff --git a/soc/riscv/sifive_freedom/e300/soc.h b/soc/riscv/riscv-privileged/sifive-freedom/soc.h similarity index 52% rename from soc/riscv/sifive_freedom/e300/soc.h rename to soc/riscv/riscv-privileged/sifive-freedom/soc.h index c83f5f322b6..958891a9d6a 100644 --- a/soc/riscv/sifive_freedom/e300/soc.h +++ b/soc/riscv/riscv-privileged/sifive-freedom/soc.h @@ -8,17 +8,30 @@ * @file SoC configuration macros for the SiFive Freedom processor */ -#ifndef __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ -#define __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ +#ifndef __RISCV_SIFIVE_FREEDOM_SOC_H_ +#define __RISCV_SIFIVE_FREEDOM_SOC_H_ #include +#if defined(CONFIG_SOC_RISCV_SIFIVE_FREEDOM) /* PINMUX MAX PINS */ #define SIFIVE_PINMUX_PINS 32 /* Clock controller. */ #define PRCI_BASE_ADDR 0x10008000 +#elif defined(CONFIG_SOC_RISCV_SIFIVE_FU540) || defined(CONFIG_SOC_RISCV_SIFIVE_FU740) + +/* Clock controller. */ +#define PRCI_BASE_ADDR 0x10000000 + +/* PINMUX MAX PINS */ +#define SIFIVE_PINMUX_PINS 16 + +#endif + +#if defined(CONFIG_SOC_RISCV_SIFIVE_FREEDOM) || defined(CONFIG_SOC_RISCV_SIFIVE_FU540) + /* * On FE310 and FU540, peripherals such as SPI, UART, I2C and PWM are clocked * by TLCLK, which is derived from CORECLK. @@ -29,4 +42,12 @@ #define SIFIVE_PERIPHERAL_CLOCK_FREQUENCY \ (SIFIVE_TLCLK_BASE_FREQUENCY / SIFIVE_TLCLK_DIVIDER) -#endif /* __RISCV_SIFIVE_FREEDOM_FE300_SOC_H_ */ +#elif defined(CONFIG_SOC_RISCV_SIFIVE_FU740) + +/* On FU740, peripherals are clocked by PCLK. */ +#define SIFIVE_PERIPHERAL_CLOCK_FREQUENCY \ + DT_PROP(DT_NODELABEL(pclk), clock_frequency) + +#endif + +#endif /* __RISCV_SIFIVE_FREEDOM_SOC_H_ */ diff --git a/soc/riscv/sifive_freedom/CMakeLists.txt b/soc/riscv/sifive_freedom/CMakeLists.txt deleted file mode 100644 index 6a5b10545ff..00000000000 --- a/soc/riscv/sifive_freedom/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory(common) -add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/sifive_freedom/Kconfig b/soc/riscv/sifive_freedom/Kconfig deleted file mode 100644 index 0fed11158af..00000000000 --- a/soc/riscv/sifive_freedom/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_SIFIVE_FREEDOM - bool - -if SOC_FAMILY_SIFIVE_FREEDOM - -config SOC_FAMILY - string - default "sifive_freedom" - -source "soc/riscv/sifive_freedom/*/Kconfig.soc" - -endif # SOC_FAMILY_SIFIVE_FREEDOM diff --git a/soc/riscv/sifive_freedom/Kconfig.defconfig b/soc/riscv/sifive_freedom/Kconfig.defconfig deleted file mode 100644 index 5adf8fc437e..00000000000 --- a/soc/riscv/sifive_freedom/Kconfig.defconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/sifive_freedom/*/Kconfig.defconfig.series" diff --git a/soc/riscv/sifive_freedom/Kconfig.soc b/soc/riscv/sifive_freedom/Kconfig.soc deleted file mode 100644 index 54274defd91..00000000000 --- a/soc/riscv/sifive_freedom/Kconfig.soc +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/sifive_freedom/*/Kconfig.series" diff --git a/soc/riscv/sifive_freedom/common/CMakeLists.txt b/soc/riscv/sifive_freedom/common/CMakeLists.txt deleted file mode 100644 index f75aec6b311..00000000000 --- a/soc/riscv/sifive_freedom/common/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -zephyr_include_directories(.) diff --git a/soc/riscv/sifive_freedom/e300/CMakeLists.txt b/soc/riscv/sifive_freedom/e300/CMakeLists.txt deleted file mode 100644 index baf01a6b047..00000000000 --- a/soc/riscv/sifive_freedom/e300/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -zephyr_sources(clock.c) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e340 b/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e340 deleted file mode 100644 index cb0131f1427..00000000000 --- a/soc/riscv/sifive_freedom/e300/Kconfig.defconfig.e340 +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -config SOC - default "e340" if SOC_SIFIVE_FREEDOM_E340 diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.series b/soc/riscv/sifive_freedom/e300/Kconfig.series deleted file mode 100644 index 066f8909d53..00000000000 --- a/soc/riscv/sifive_freedom/e300/Kconfig.series +++ /dev/null @@ -1,13 +0,0 @@ -# RISCV_SIFIVE_FREEDOM SOC implementation - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_SIFIVE_FREEDOM_E300 - bool "SiFive Freedom E300 SOC implementation" - select RISCV - select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE - select SOC_FAMILY_SIFIVE_FREEDOM - help - Enable support for SiFive Freedom FE300 SOC diff --git a/soc/riscv/sifive_freedom/e300/Kconfig.soc b/soc/riscv/sifive_freedom/e300/Kconfig.soc deleted file mode 100644 index e53b84c0890..00000000000 --- a/soc/riscv/sifive_freedom/e300/Kconfig.soc +++ /dev/null @@ -1,20 +0,0 @@ -# RISCV_SIFIVE_FREEDOM SOC configuration options - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -choice - prompt "SiFive Freedom SOC implementation" - depends on SOC_SERIES_SIFIVE_FREEDOM_E300 - -config SOC_SIFIVE_FREEDOM_E340 - bool "SiFive Freedom SOC implementation" - select ATOMIC_OPERATIONS_C - select INCLUDE_RESET_VECTOR - select RISCV_ISA_RV32I - select RISCV_ISA_EXT_M - select RISCV_ISA_EXT_A - select RISCV_ISA_EXT_ZICSR - select RISCV_ISA_EXT_ZIFENCEI - -endchoice diff --git a/soc/riscv/sifive_freedom/u500/CMakeLists.txt b/soc/riscv/sifive_freedom/u500/CMakeLists.txt deleted file mode 100644 index baf01a6b047..00000000000 --- a/soc/riscv/sifive_freedom/u500/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -zephyr_sources(clock.c) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series deleted file mode 100644 index d6b94678686..00000000000 --- a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.series +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -if SOC_SERIES_SIFIVE_FREEDOM_U500 - -config SOC_SERIES - default "u500" - -config SYS_CLOCK_HW_CYCLES_PER_SEC - default 32768 - -config RISCV_SOC_INTERRUPT_INIT - default y - -config RISCV_HAS_CPU_IDLE - default y - -config RISCV_HAS_PLIC - default y - -config RISCV_GP - default y - -config 2ND_LVL_ISR_TBL_OFFSET - default 12 - -config 2ND_LVL_INTR_00_OFFSET - default 11 - -config MAX_IRQ_PER_AGGREGATOR - default 52 - -config NUM_IRQS - default 64 - -source "soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u*" - -endif # SOC_SERIES_SIFIVE_FREEDOM_U500 diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u540 b/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u540 deleted file mode 100644 index f559f5914b3..00000000000 --- a/soc/riscv/sifive_freedom/u500/Kconfig.defconfig.u540 +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -config SOC - default "u540" if SOC_SIFIVE_FREEDOM_U540 diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.series b/soc/riscv/sifive_freedom/u500/Kconfig.series deleted file mode 100644 index 963a265f383..00000000000 --- a/soc/riscv/sifive_freedom/u500/Kconfig.series +++ /dev/null @@ -1,13 +0,0 @@ -# RISCV_SIFIVE_FREEDOM SOC implementation - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_SIFIVE_FREEDOM_U500 - bool "SiFive Freedom U500 SOC implementation" - select RISCV - select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE - select SOC_FAMILY_SIFIVE_FREEDOM - help - Enable support for SiFive Freedom U500 SOC diff --git a/soc/riscv/sifive_freedom/u500/Kconfig.soc b/soc/riscv/sifive_freedom/u500/Kconfig.soc deleted file mode 100644 index 0a88ccf8cc1..00000000000 --- a/soc/riscv/sifive_freedom/u500/Kconfig.soc +++ /dev/null @@ -1,22 +0,0 @@ -# RISCV_SIFIVE_FREEDOM SOC configuration options - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -choice - prompt "SiFive Freedom SOC implementation" - depends on SOC_SERIES_SIFIVE_FREEDOM_U500 - -config SOC_SIFIVE_FREEDOM_U540 - bool "SiFive Freedom U540 SOC implementation" - select ATOMIC_OPERATIONS_C - select INCLUDE_RESET_VECTOR - select 64BIT - select RISCV_ISA_RV64I - select RISCV_ISA_EXT_M - select RISCV_ISA_EXT_A - select RISCV_ISA_EXT_C - select RISCV_ISA_EXT_ZICSR - select RISCV_ISA_EXT_ZIFENCEI - -endchoice diff --git a/soc/riscv/sifive_freedom/u500/soc.h b/soc/riscv/sifive_freedom/u500/soc.h deleted file mode 100644 index ed367950278..00000000000 --- a/soc/riscv/sifive_freedom/u500/soc.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2017 Jean-Paul Etienne - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file SoC configuration macros for the SiFive Freedom processor - */ - -#ifndef __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ -#define __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ - -#include - -/* Clock controller. */ -#define PRCI_BASE_ADDR 0x10000000 - -/* PINMUX MAX PINS */ -#define SIFIVE_PINMUX_PINS 16 - -/* - * On FE310 and FU540, peripherals such as SPI, UART, I2C and PWM are clocked - * by TLCLK, which is derived from CORECLK. - */ -#define SIFIVE_TLCLK_BASE_FREQUENCY \ - DT_PROP_BY_PHANDLE_IDX(DT_NODELABEL(tlclk), clocks, 0, clock_frequency) -#define SIFIVE_TLCLK_DIVIDER DT_PROP(DT_NODELABEL(tlclk), clock_div) -#define SIFIVE_PERIPHERAL_CLOCK_FREQUENCY \ - (SIFIVE_TLCLK_BASE_FREQUENCY / SIFIVE_TLCLK_DIVIDER) - -#endif /* __RISCV_SIFIVE_FREEDOM_U500_SOC_H_ */ diff --git a/soc/riscv/sifive_freedom/u700/CMakeLists.txt b/soc/riscv/sifive_freedom/u700/CMakeLists.txt deleted file mode 100644 index baf01a6b047..00000000000 --- a/soc/riscv/sifive_freedom/u700/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -zephyr_sources(clock.c) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series deleted file mode 100644 index 347ac14b551..00000000000 --- a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.series +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -if SOC_SERIES_SIFIVE_FREEDOM_U700 - -config SOC_SERIES - default "u700" - -config SYS_CLOCK_HW_CYCLES_PER_SEC - default 32768 - -config RISCV_SOC_INTERRUPT_INIT - default y - -config RISCV_HAS_CPU_IDLE - default y - -config RISCV_HAS_PLIC - default y - -config RISCV_GP - default y - -config 2ND_LVL_ISR_TBL_OFFSET - default 12 - -config 2ND_LVL_INTR_00_OFFSET - default 11 - -config MAX_IRQ_PER_AGGREGATOR - default 52 - -config NUM_IRQS - default 64 - -source "soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u*" - -endif # SOC_SERIES_SIFIVE_FREEDOM_U700 diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u740 b/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u740 deleted file mode 100644 index ca935f772eb..00000000000 --- a/soc/riscv/sifive_freedom/u700/Kconfig.defconfig.u740 +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -config SOC - default "u740" if SOC_SIFIVE_FREEDOM_U740 diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.series b/soc/riscv/sifive_freedom/u700/Kconfig.series deleted file mode 100644 index b4ca38697f8..00000000000 --- a/soc/riscv/sifive_freedom/u700/Kconfig.series +++ /dev/null @@ -1,13 +0,0 @@ -# RISCV_SIFIVE_FREEDOM SOC implementation - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_SIFIVE_FREEDOM_U700 - bool "SiFive Freedom SOC U700 implementation" - select RISCV - select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE - select SOC_FAMILY_SIFIVE_FREEDOM - help - Enable support for SiFive Freedom U700 SOC diff --git a/soc/riscv/sifive_freedom/u700/Kconfig.soc b/soc/riscv/sifive_freedom/u700/Kconfig.soc deleted file mode 100644 index 1eec9b4bb17..00000000000 --- a/soc/riscv/sifive_freedom/u700/Kconfig.soc +++ /dev/null @@ -1,22 +0,0 @@ -# RISCV_SIFIVE_FREEDOM SOC configuration options - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -choice - prompt "SiFive Freedom SOC implementation" - depends on SOC_SERIES_SIFIVE_FREEDOM_U700 - -config SOC_SIFIVE_FREEDOM_U740 - bool "SiFive Freedom U740 SOC implementation" - select ATOMIC_OPERATIONS_C - select INCLUDE_RESET_VECTOR - select 64BIT - select RISCV_ISA_RV64I - select RISCV_ISA_EXT_M - select RISCV_ISA_EXT_A - select RISCV_ISA_EXT_C - select RISCV_ISA_EXT_ZICSR - select RISCV_ISA_EXT_ZIFENCEI - -endchoice diff --git a/soc/riscv/sifive_freedom/u700/soc.h b/soc/riscv/sifive_freedom/u700/soc.h deleted file mode 100644 index 91aac61afdd..00000000000 --- a/soc/riscv/sifive_freedom/u700/soc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2017 Jean-Paul Etienne - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file SoC configuration macros for the SiFive Freedom processor - */ - -#ifndef __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ -#define __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ - -#include - -/* Clock controller. */ -#define PRCI_BASE_ADDR 0x10000000 - -/* PINMUX MAX PINS */ -#define SIFIVE_PINMUX_PINS 16 - -/* On FU740, peripherals are clocked by PCLK. */ -#define SIFIVE_PERIPHERAL_CLOCK_FREQUENCY \ - DT_PROP(DT_NODELABEL(pclk), clock_frequency) - -#endif /* __RISCV_SIFIVE_FREEDOM_U700_SOC_H_ */ From 9af17d28265faf59445db5962dcbddfc16ceb518 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:34 +0100 Subject: [PATCH 1094/2300] Revert "[nrf fromtree] soc: riscv: miv/mpfs: reorganize SoC folder" This reverts commit 2934a5522545b141506929c7e5a3916ac5dd52b7. Signed-off-by: Robert Lubos --- boards/riscv/beaglev_fire/Kconfig.board | 2 +- boards/riscv/beaglev_fire/beaglev_fire_defconfig | 4 ++-- boards/riscv/m2gl025_miv/Kconfig.board | 2 +- boards/riscv/m2gl025_miv/m2gl025_miv_defconfig | 4 ++-- boards/riscv/mpfs_icicle/Kconfig.board | 2 +- boards/riscv/mpfs_icicle/mpfs_icicle_defconfig | 4 ++-- soc/riscv/microchip_miv/CMakeLists.txt | 4 ---- soc/riscv/microchip_miv/Kconfig | 15 --------------- soc/riscv/microchip_miv/Kconfig.defconfig | 4 ---- soc/riscv/microchip_miv/Kconfig.soc | 4 ---- .../miv/CMakeLists.txt | 0 .../miv/Kconfig.defconfig.series | 4 ++-- .../miv/Kconfig.series | 4 +--- .../miv/Kconfig.soc | 4 ++-- .../{microchip_miv => riscv-privileged}/miv/soc.h | 0 .../mpfs}/CMakeLists.txt | 0 .../mpfs}/Kconfig.defconfig.series | 6 +++--- .../mpfs}/Kconfig.series | 4 +--- .../mpfs}/Kconfig.soc | 6 +++--- .../polarfire => riscv-privileged/mpfs}/soc.h | 0 20 files changed, 21 insertions(+), 52 deletions(-) delete mode 100644 soc/riscv/microchip_miv/CMakeLists.txt delete mode 100644 soc/riscv/microchip_miv/Kconfig delete mode 100644 soc/riscv/microchip_miv/Kconfig.defconfig delete mode 100644 soc/riscv/microchip_miv/Kconfig.soc rename soc/riscv/{microchip_miv => riscv-privileged}/miv/CMakeLists.txt (100%) rename soc/riscv/{microchip_miv => riscv-privileged}/miv/Kconfig.defconfig.series (88%) rename soc/riscv/{microchip_miv => riscv-privileged}/miv/Kconfig.series (72%) rename soc/riscv/{microchip_miv => riscv-privileged}/miv/Kconfig.soc (88%) rename soc/riscv/{microchip_miv => riscv-privileged}/miv/soc.h (100%) rename soc/riscv/{microchip_miv/polarfire => riscv-privileged/mpfs}/CMakeLists.txt (100%) rename soc/riscv/{microchip_miv/polarfire => riscv-privileged/mpfs}/Kconfig.defconfig.series (89%) rename soc/riscv/{microchip_miv/polarfire => riscv-privileged/mpfs}/Kconfig.series (71%) rename soc/riscv/{microchip_miv/polarfire => riscv-privileged/mpfs}/Kconfig.soc (89%) rename soc/riscv/{microchip_miv/polarfire => riscv-privileged/mpfs}/soc.h (100%) diff --git a/boards/riscv/beaglev_fire/Kconfig.board b/boards/riscv/beaglev_fire/Kconfig.board index 55b59d4ac92..1984bb05c09 100644 --- a/boards/riscv/beaglev_fire/Kconfig.board +++ b/boards/riscv/beaglev_fire/Kconfig.board @@ -3,7 +3,7 @@ config BOARD_BEAGLEV_FIRE bool "Beagleboard BeagleV-Fire" - depends on SOC_POLARFIRE + depends on SOC_MPFS select 64BIT select SCHED_IPI_SUPPORTED select CPU_HAS_FPU_DOUBLE_PRECISION diff --git a/boards/riscv/beaglev_fire/beaglev_fire_defconfig b/boards/riscv/beaglev_fire/beaglev_fire_defconfig index 3b264d6c288..a60ed8c1691 100644 --- a/boards/riscv/beaglev_fire/beaglev_fire_defconfig +++ b/boards/riscv/beaglev_fire/beaglev_fire_defconfig @@ -1,8 +1,8 @@ # Copyright (c) 2023 Microchip Technology Inc # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_POLARFIRE=y -CONFIG_SOC_POLARFIRE=y +CONFIG_SOC_SERIES_RISCV64_MIV=y +CONFIG_SOC_MPFS=y CONFIG_MPFS_HAL=n CONFIG_BASE64=y CONFIG_INCLUDE_RESET_VECTOR=y diff --git a/boards/riscv/m2gl025_miv/Kconfig.board b/boards/riscv/m2gl025_miv/Kconfig.board index 9f81fad406f..51c2f9d8de3 100644 --- a/boards/riscv/m2gl025_miv/Kconfig.board +++ b/boards/riscv/m2gl025_miv/Kconfig.board @@ -2,4 +2,4 @@ config BOARD_M2GL025_MIV bool "Microchip M2GL025 IGLOO2 dev board with Mi-V CPU" - depends on SOC_MIV + depends on SOC_RISCV32_MIV diff --git a/boards/riscv/m2gl025_miv/m2gl025_miv_defconfig b/boards/riscv/m2gl025_miv/m2gl025_miv_defconfig index e33765680d5..8c944a10a74 100644 --- a/boards/riscv/m2gl025_miv/m2gl025_miv_defconfig +++ b/boards/riscv/m2gl025_miv/m2gl025_miv_defconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_MIV=y -CONFIG_SOC_MIV=y +CONFIG_SOC_SERIES_RISCV32_MIV=y +CONFIG_SOC_RISCV32_MIV=y CONFIG_BOARD_M2GL025_MIV=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/riscv/mpfs_icicle/Kconfig.board b/boards/riscv/mpfs_icicle/Kconfig.board index e772b82d7f5..297f4ce4bc7 100644 --- a/boards/riscv/mpfs_icicle/Kconfig.board +++ b/boards/riscv/mpfs_icicle/Kconfig.board @@ -3,7 +3,7 @@ config BOARD_MPFS_ICICLE bool "Microchip PolarFire SoC ICICLE kit" - depends on SOC_POLARFIRE + depends on SOC_MPFS select 64BIT select SCHED_IPI_SUPPORTED select CPU_HAS_FPU_DOUBLE_PRECISION diff --git a/boards/riscv/mpfs_icicle/mpfs_icicle_defconfig b/boards/riscv/mpfs_icicle/mpfs_icicle_defconfig index 00b44f7a6d5..5c41649cb3e 100644 --- a/boards/riscv/mpfs_icicle/mpfs_icicle_defconfig +++ b/boards/riscv/mpfs_icicle/mpfs_icicle_defconfig @@ -1,8 +1,8 @@ # Copyright (c) 2020-2021 Microchip Technology Inc # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_POLARFIRE=y -CONFIG_SOC_POLARFIRE=y +CONFIG_SOC_SERIES_RISCV64_MIV=y +CONFIG_SOC_MPFS=y CONFIG_MPFS_HAL=n CONFIG_BASE64=y CONFIG_INCLUDE_RESET_VECTOR=y diff --git a/soc/riscv/microchip_miv/CMakeLists.txt b/soc/riscv/microchip_miv/CMakeLists.txt deleted file mode 100644 index 69b2926358e..00000000000 --- a/soc/riscv/microchip_miv/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/microchip_miv/Kconfig b/soc/riscv/microchip_miv/Kconfig deleted file mode 100644 index 46616636aa1..00000000000 --- a/soc/riscv/microchip_miv/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_MICROCHIP_MIV - bool - -if SOC_FAMILY_MICROCHIP_MIV - -config SOC_FAMILY - string - default "microchip_miv" - -source "soc/riscv/microchip_miv/*/Kconfig.soc" - -endif # SOC_FAMILY_MICROCHIP_MIV diff --git a/soc/riscv/microchip_miv/Kconfig.defconfig b/soc/riscv/microchip_miv/Kconfig.defconfig deleted file mode 100644 index 2fe508bddba..00000000000 --- a/soc/riscv/microchip_miv/Kconfig.defconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/microchip_miv/*/Kconfig.defconfig.series" diff --git a/soc/riscv/microchip_miv/Kconfig.soc b/soc/riscv/microchip_miv/Kconfig.soc deleted file mode 100644 index 8677f1ba448..00000000000 --- a/soc/riscv/microchip_miv/Kconfig.soc +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/microchip_miv/*/Kconfig.series" diff --git a/soc/riscv/microchip_miv/miv/CMakeLists.txt b/soc/riscv/riscv-privileged/miv/CMakeLists.txt similarity index 100% rename from soc/riscv/microchip_miv/miv/CMakeLists.txt rename to soc/riscv/riscv-privileged/miv/CMakeLists.txt diff --git a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/miv/Kconfig.defconfig.series similarity index 88% rename from soc/riscv/microchip_miv/miv/Kconfig.defconfig.series rename to soc/riscv/riscv-privileged/miv/Kconfig.defconfig.series index ef161321a5b..81b224ed397 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.defconfig.series +++ b/soc/riscv/riscv-privileged/miv/Kconfig.defconfig.series @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_MIV +if SOC_SERIES_RISCV32_MIV config SOC_SERIES default "miv" @@ -32,4 +32,4 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 42 -endif # SOC_SERIES_MIV +endif # SOC_SERIES_RISCV32_MIV diff --git a/soc/riscv/microchip_miv/miv/Kconfig.series b/soc/riscv/riscv-privileged/miv/Kconfig.series similarity index 72% rename from soc/riscv/microchip_miv/miv/Kconfig.series rename to soc/riscv/riscv-privileged/miv/Kconfig.series index 20430e6d0f9..017de686a94 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.series +++ b/soc/riscv/riscv-privileged/miv/Kconfig.series @@ -3,11 +3,9 @@ # Copyright (c) 2018 Antmicro # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_MIV +config SOC_SERIES_RISCV32_MIV bool "Microchip Mi-V implementation" - select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE help Enable support for Microchip Mi-V diff --git a/soc/riscv/microchip_miv/miv/Kconfig.soc b/soc/riscv/riscv-privileged/miv/Kconfig.soc similarity index 88% rename from soc/riscv/microchip_miv/miv/Kconfig.soc rename to soc/riscv/riscv-privileged/miv/Kconfig.soc index 0a48c2e0524..189abb6879c 100644 --- a/soc/riscv/microchip_miv/miv/Kconfig.soc +++ b/soc/riscv/riscv-privileged/miv/Kconfig.soc @@ -5,9 +5,9 @@ choice prompt "Microchip Mi-V system implementation" - depends on SOC_SERIES_MIV + depends on SOC_SERIES_RISCV32_MIV -config SOC_MIV +config SOC_RISCV32_MIV bool "Microchip Mi-V system implementation" select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR diff --git a/soc/riscv/microchip_miv/miv/soc.h b/soc/riscv/riscv-privileged/miv/soc.h similarity index 100% rename from soc/riscv/microchip_miv/miv/soc.h rename to soc/riscv/riscv-privileged/miv/soc.h diff --git a/soc/riscv/microchip_miv/polarfire/CMakeLists.txt b/soc/riscv/riscv-privileged/mpfs/CMakeLists.txt similarity index 100% rename from soc/riscv/microchip_miv/polarfire/CMakeLists.txt rename to soc/riscv/riscv-privileged/mpfs/CMakeLists.txt diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/mpfs/Kconfig.defconfig.series similarity index 89% rename from soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series rename to soc/riscv/riscv-privileged/mpfs/Kconfig.defconfig.series index 0e5629927ae..fb9f6d2d3af 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.defconfig.series +++ b/soc/riscv/riscv-privileged/mpfs/Kconfig.defconfig.series @@ -1,10 +1,10 @@ # Copyright (c) 2020-2021 Microchip Technology Inc # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_POLARFIRE +if SOC_SERIES_RISCV64_MIV config SOC_SERIES - default "polarfire" + default "mpfs" # MPFS should be configured so that the mtimer clock is 1MHz independent of the CPU clock... @@ -38,4 +38,4 @@ config NUM_IRQS # config NO_OPTIMIZATIONS # default y -endif # SOC_SERIES_POLARFIRE +endif # SOC_SERIES_RISCV64_MIV diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.series b/soc/riscv/riscv-privileged/mpfs/Kconfig.series similarity index 71% rename from soc/riscv/microchip_miv/polarfire/Kconfig.series rename to soc/riscv/riscv-privileged/mpfs/Kconfig.series index 4bbceaee745..3b30cd15365 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.series +++ b/soc/riscv/riscv-privileged/mpfs/Kconfig.series @@ -3,11 +3,9 @@ # Copyright (c) 2018 Antmicro # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_POLARFIRE +config SOC_SERIES_RISCV64_MIV bool "Microchip RV64 implementation" - select SOC_FAMILY_MICROCHIP_MIV select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE help Enable support for Microchip RISCV 64bit diff --git a/soc/riscv/microchip_miv/polarfire/Kconfig.soc b/soc/riscv/riscv-privileged/mpfs/Kconfig.soc similarity index 89% rename from soc/riscv/microchip_miv/polarfire/Kconfig.soc rename to soc/riscv/riscv-privileged/mpfs/Kconfig.soc index 101e8b4d029..7f20dc703c2 100644 --- a/soc/riscv/microchip_miv/polarfire/Kconfig.soc +++ b/soc/riscv/riscv-privileged/mpfs/Kconfig.soc @@ -5,9 +5,9 @@ choice prompt "Microchip Polarfire SOC implementation" - depends on SOC_SERIES_POLARFIRE + depends on SOC_SERIES_RISCV64_MIV -config SOC_POLARFIRE +config SOC_MPFS bool "Microchip MPFS system implementation" select ATOMIC_OPERATIONS_BUILTIN select RISCV_GP @@ -25,6 +25,6 @@ config SOC_POLARFIRE endchoice config MPFS_HAL - depends on SOC_POLARFIRE + depends on SOC_MPFS bool "Microchip Polarfire SOC hardware abstracton layer" select HAS_MPFS_HAL diff --git a/soc/riscv/microchip_miv/polarfire/soc.h b/soc/riscv/riscv-privileged/mpfs/soc.h similarity index 100% rename from soc/riscv/microchip_miv/polarfire/soc.h rename to soc/riscv/riscv-privileged/mpfs/soc.h From ba0e0888455600b98e1e127c936a46db0be58356 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:34 +0100 Subject: [PATCH 1095/2300] Revert "[nrf fromtree] soc: riscv: efinix-sapphire: reorganize SoC folder" This reverts commit 3b27f84a0d1f6c122cb762a72bac2ead7ffd9323. Signed-off-by: Robert Lubos --- boards/riscv/titanium_ti60_f225/Kconfig.board | 2 +- .../titanium_ti60_f225/titanium_ti60_f225_defconfig | 2 +- .../efinix-sapphire}/CMakeLists.txt | 0 .../efinix-sapphire/Kconfig.defconfig.series} | 8 ++++---- .../riscv-privileged/efinix-sapphire/Kconfig.series | 9 +++++++++ .../efinix-sapphire}/Kconfig.soc | 11 +++++++---- .../efinix-sapphire}/soc.h | 0 7 files changed, 22 insertions(+), 10 deletions(-) rename soc/riscv/{efinix_sapphire => riscv-privileged/efinix-sapphire}/CMakeLists.txt (100%) rename soc/riscv/{efinix_sapphire/Kconfig.defconfig => riscv-privileged/efinix-sapphire/Kconfig.defconfig.series} (74%) create mode 100644 soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series rename soc/riscv/{efinix_sapphire => riscv-privileged/efinix-sapphire}/Kconfig.soc (72%) rename soc/riscv/{efinix_sapphire => riscv-privileged/efinix-sapphire}/soc.h (100%) diff --git a/boards/riscv/titanium_ti60_f225/Kconfig.board b/boards/riscv/titanium_ti60_f225/Kconfig.board index bac70816b20..d6ed41ffc79 100644 --- a/boards/riscv/titanium_ti60_f225/Kconfig.board +++ b/boards/riscv/titanium_ti60_f225/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_TITANIUM_TI60_F225 bool "Board with Efinix Sapphire riscv SoC" - depends on SOC_EFINIX_SAPPHIRE + depends on SOC_SERIES_EFINIX_SAPPHIRE diff --git a/boards/riscv/titanium_ti60_f225/titanium_ti60_f225_defconfig b/boards/riscv/titanium_ti60_f225/titanium_ti60_f225_defconfig index 0608a8e8953..096980b864e 100644 --- a/boards/riscv/titanium_ti60_f225/titanium_ti60_f225_defconfig +++ b/boards/riscv/titanium_ti60_f225/titanium_ti60_f225_defconfig @@ -1,7 +1,7 @@ # Copyright (c) 2023 Efinix Inc. # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_EFINIX_SAPPHIRE=y +CONFIG_SOC_SERIES_EFINIX_SAPPHIRE=y CONFIG_BOARD_TITANIUM_TI60_F225=y CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/soc/riscv/efinix_sapphire/CMakeLists.txt b/soc/riscv/riscv-privileged/efinix-sapphire/CMakeLists.txt similarity index 100% rename from soc/riscv/efinix_sapphire/CMakeLists.txt rename to soc/riscv/riscv-privileged/efinix-sapphire/CMakeLists.txt diff --git a/soc/riscv/efinix_sapphire/Kconfig.defconfig b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.defconfig.series similarity index 74% rename from soc/riscv/efinix_sapphire/Kconfig.defconfig rename to soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.defconfig.series index 5424bca7baf..233428931a3 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.defconfig +++ b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.defconfig.series @@ -1,10 +1,10 @@ # Copyright (c) 2023 Efinix Inc. # SPDX-License-Identifier: Apache-2.0 -if SOC_EFINIX_SAPPHIRE +if SOC_SERIES_EFINIX_SAPPHIRE -config SOC - default "efinix_sapphire" +config SOC_SERIES + default "efinix-sapphire" config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 @@ -27,4 +27,4 @@ config NUM_IRQS config 2ND_LVL_INTR_00_OFFSET default 11 -endif # SOC_EFINIX_SAPPHIRE +endif # SOC_SERIES_EFINIX_SAPPHIRE diff --git a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series new file mode 100644 index 00000000000..421d81a7e33 --- /dev/null +++ b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series @@ -0,0 +1,9 @@ +# Copyright (c) 2023 Efinix Inc. +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_EFINIX_SAPPHIRE + bool "Efinix Sapphire SOC implementation" + select RISCV + select RISCV_PRIVILEGED + help + Enable support for Efinix Sapphire SOC implementation diff --git a/soc/riscv/efinix_sapphire/Kconfig.soc b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.soc similarity index 72% rename from soc/riscv/efinix_sapphire/Kconfig.soc rename to soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.soc index 2cc5f3ba361..dba8491b8bd 100644 --- a/soc/riscv/efinix_sapphire/Kconfig.soc +++ b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.soc @@ -1,7 +1,11 @@ # Copyright (c) 2023 Efinix Inc. # SPDX-License-Identifier: Apache-2.0 -config SOC_EFINIX_SAPPHIRE +choice + prompt "Efinix SoC selection" + depends on SOC_SERIES_EFINIX_SAPPHIRE + +config SOC_RISCV32_EFINIX_SAPPHIRE bool "Efinix Sapphire VexRiscv system implementation" select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR @@ -10,6 +14,5 @@ config SOC_EFINIX_SAPPHIRE select RISCV_ISA_EXT_A select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI - select RISCV - select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE + +endchoice diff --git a/soc/riscv/efinix_sapphire/soc.h b/soc/riscv/riscv-privileged/efinix-sapphire/soc.h similarity index 100% rename from soc/riscv/efinix_sapphire/soc.h rename to soc/riscv/riscv-privileged/efinix-sapphire/soc.h From ad2439648777d663674c9585d37b495d4dac8468 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:34 +0100 Subject: [PATCH 1096/2300] Revert "[nrf fromtree] soc: riscv: virt: reorganize SoC folder" This reverts commit 07f0ae103e5e1f6b4e405a8b1300cbcdfe2a8328. Signed-off-by: Robert Lubos --- boards/riscv/qemu_riscv32/qemu_riscv32_defconfig | 1 + boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig | 1 + boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig | 1 + boards/riscv/qemu_riscv64/qemu_riscv64_defconfig | 1 + boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig | 1 + soc/riscv/{ => riscv-privileged}/virt/CMakeLists.txt | 0 .../virt/Kconfig.defconfig.series} | 4 ++-- soc/riscv/riscv-privileged/virt/Kconfig.series | 7 +++++++ soc/riscv/{ => riscv-privileged}/virt/Kconfig.soc | 9 ++++++--- soc/riscv/{ => riscv-privileged}/virt/soc.c | 0 soc/riscv/{ => riscv-privileged}/virt/soc.h | 0 11 files changed, 20 insertions(+), 5 deletions(-) rename soc/riscv/{ => riscv-privileged}/virt/CMakeLists.txt (100%) rename soc/riscv/{virt/Kconfig.defconfig => riscv-privileged/virt/Kconfig.defconfig.series} (91%) create mode 100644 soc/riscv/riscv-privileged/virt/Kconfig.series rename soc/riscv/{ => riscv-privileged}/virt/Kconfig.soc (75%) rename soc/riscv/{ => riscv-privileged}/virt/soc.c (100%) rename soc/riscv/{ => riscv-privileged}/virt/soc.h (100%) diff --git a/boards/riscv/qemu_riscv32/qemu_riscv32_defconfig b/boards/riscv/qemu_riscv32/qemu_riscv32_defconfig index 946e679a6e8..f50d82dcb76 100644 --- a/boards/riscv/qemu_riscv32/qemu_riscv32_defconfig +++ b/boards/riscv/qemu_riscv32/qemu_riscv32_defconfig @@ -1,5 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 +CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV32=y CONFIG_CONSOLE=y diff --git a/boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig b/boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig index 90f87ef6b98..eef7d03e356 100644 --- a/boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig +++ b/boards/riscv/qemu_riscv32/qemu_riscv32_smp_defconfig @@ -1,5 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 +CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV32_SMP=y CONFIG_CONSOLE=y diff --git a/boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig b/boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig index 1f1c46acb10..ef4d6273cfb 100644 --- a/boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig +++ b/boards/riscv/qemu_riscv32e/qemu_riscv32e_defconfig @@ -1,5 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 +CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV32E=y CONFIG_CONSOLE=y diff --git a/boards/riscv/qemu_riscv64/qemu_riscv64_defconfig b/boards/riscv/qemu_riscv64/qemu_riscv64_defconfig index 6bfc46ac907..6f51da3c592 100644 --- a/boards/riscv/qemu_riscv64/qemu_riscv64_defconfig +++ b/boards/riscv/qemu_riscv64/qemu_riscv64_defconfig @@ -1,5 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 +CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV64=y CONFIG_PRIVILEGED_STACK_SIZE=2048 diff --git a/boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig b/boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig index 265d84a1ded..78b5b74de9a 100644 --- a/boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig +++ b/boards/riscv/qemu_riscv64/qemu_riscv64_smp_defconfig @@ -1,5 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 +CONFIG_SOC_SERIES_RISCV_VIRT=y CONFIG_SOC_RISCV_VIRT=y CONFIG_BOARD_QEMU_RISCV64_SMP=y CONFIG_PRIVILEGED_STACK_SIZE=2048 diff --git a/soc/riscv/virt/CMakeLists.txt b/soc/riscv/riscv-privileged/virt/CMakeLists.txt similarity index 100% rename from soc/riscv/virt/CMakeLists.txt rename to soc/riscv/riscv-privileged/virt/CMakeLists.txt diff --git a/soc/riscv/virt/Kconfig.defconfig b/soc/riscv/riscv-privileged/virt/Kconfig.defconfig.series similarity index 91% rename from soc/riscv/virt/Kconfig.defconfig rename to soc/riscv/riscv-privileged/virt/Kconfig.defconfig.series index 9773586e922..231d4519d67 100644 --- a/soc/riscv/virt/Kconfig.defconfig +++ b/soc/riscv/riscv-privileged/virt/Kconfig.defconfig.series @@ -1,9 +1,9 @@ # Copyright (c) 2020 Cobham Gaisler AB # SPDX-License-Identifier: Apache-2.0 -if SOC_RISCV_VIRT +if SOC_SERIES_RISCV_VIRT -config SOC +config SOC_SERIES default "virt" config SYS_CLOCK_HW_CYCLES_PER_SEC diff --git a/soc/riscv/riscv-privileged/virt/Kconfig.series b/soc/riscv/riscv-privileged/virt/Kconfig.series new file mode 100644 index 00000000000..44ec681a308 --- /dev/null +++ b/soc/riscv/riscv-privileged/virt/Kconfig.series @@ -0,0 +1,7 @@ +# Copyright (c) 2020 Cobham Gaisler AB +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_RISCV_VIRT + bool "QEMU RISC-V VirtIO Board" + select RISCV + select RISCV_PRIVILEGED diff --git a/soc/riscv/virt/Kconfig.soc b/soc/riscv/riscv-privileged/virt/Kconfig.soc similarity index 75% rename from soc/riscv/virt/Kconfig.soc rename to soc/riscv/riscv-privileged/virt/Kconfig.soc index fb615005b0a..35a2853eb50 100644 --- a/soc/riscv/virt/Kconfig.soc +++ b/soc/riscv/riscv-privileged/virt/Kconfig.soc @@ -1,6 +1,10 @@ # Copyright (c) 2020 Cobham Gaisler AB # SPDX-License-Identifier: Apache-2.0 +choice + prompt "QEMU RISC-V VirtIO Board" + depends on SOC_SERIES_RISCV_VIRT + config SOC_RISCV_VIRT bool "QEMU RISC-V VirtIO Board" select ATOMIC_OPERATIONS_BUILTIN @@ -8,6 +12,5 @@ config SOC_RISCV_VIRT select RISCV_ISA_EXT_M select RISCV_ISA_EXT_A select RISCV_ISA_EXT_C - select RISCV - select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE + +endchoice diff --git a/soc/riscv/virt/soc.c b/soc/riscv/riscv-privileged/virt/soc.c similarity index 100% rename from soc/riscv/virt/soc.c rename to soc/riscv/riscv-privileged/virt/soc.c diff --git a/soc/riscv/virt/soc.h b/soc/riscv/riscv-privileged/virt/soc.h similarity index 100% rename from soc/riscv/virt/soc.h rename to soc/riscv/riscv-privileged/virt/soc.h From 8cbc9a3549c5e0bfe198ff6e869551544d3326f0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:34 +0100 Subject: [PATCH 1097/2300] Revert "[nrf fromtree] soc: riscv: neorv32: reorganize SoC folder" This reverts commit cd7e000c74a7f4356b7960308f13d1ebea0b6381. Signed-off-by: Robert Lubos --- boards/riscv/neorv32/Kconfig.board | 2 +- boards/riscv/neorv32/neorv32_defconfig | 2 +- .../neorv32/CMakeLists.txt | 0 .../neorv32/Kconfig.defconfig.series} | 6 ++-- .../neorv32/Kconfig.series} | 27 +--------------- .../riscv-privileged/neorv32/Kconfig.soc | 32 +++++++++++++++++++ .../{ => riscv-privileged}/neorv32/linker.ld | 0 .../{ => riscv-privileged}/neorv32/reset.S | 0 .../{ => riscv-privileged}/neorv32/soc.c | 0 .../{ => riscv-privileged}/neorv32/soc.h | 0 .../{ => riscv-privileged}/neorv32/soc_irq.S | 0 11 files changed, 38 insertions(+), 31 deletions(-) rename soc/riscv/{ => riscv-privileged}/neorv32/CMakeLists.txt (100%) rename soc/riscv/{neorv32/Kconfig.defconfig => riscv-privileged/neorv32/Kconfig.defconfig.series} (88%) rename soc/riscv/{neorv32/Kconfig.soc => riscv-privileged/neorv32/Kconfig.series} (56%) create mode 100644 soc/riscv/riscv-privileged/neorv32/Kconfig.soc rename soc/riscv/{ => riscv-privileged}/neorv32/linker.ld (100%) rename soc/riscv/{ => riscv-privileged}/neorv32/reset.S (100%) rename soc/riscv/{ => riscv-privileged}/neorv32/soc.c (100%) rename soc/riscv/{ => riscv-privileged}/neorv32/soc.h (100%) rename soc/riscv/{ => riscv-privileged}/neorv32/soc_irq.S (100%) diff --git a/boards/riscv/neorv32/Kconfig.board b/boards/riscv/neorv32/Kconfig.board index 6d85ebb2e40..eee37f4a8c3 100644 --- a/boards/riscv/neorv32/Kconfig.board +++ b/boards/riscv/neorv32/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_NEORV32 bool "NEORV32 Processor (SoC)" - depends on SOC_NEORV32 + depends on SOC_SERIES_NEORV32 diff --git a/boards/riscv/neorv32/neorv32_defconfig b/boards/riscv/neorv32/neorv32_defconfig index 7dc8a74ffff..17e9b8038ce 100644 --- a/boards/riscv/neorv32/neorv32_defconfig +++ b/boards/riscv/neorv32/neorv32_defconfig @@ -1,7 +1,7 @@ # Copyright (c) 2021 Henrik Brix Andersen # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_NEORV32=y +CONFIG_SOC_SERIES_NEORV32=y CONFIG_SOC_NEORV32_ISA_C=y CONFIG_BOARD_NEORV32=y CONFIG_SERIAL=y diff --git a/soc/riscv/neorv32/CMakeLists.txt b/soc/riscv/riscv-privileged/neorv32/CMakeLists.txt similarity index 100% rename from soc/riscv/neorv32/CMakeLists.txt rename to soc/riscv/riscv-privileged/neorv32/CMakeLists.txt diff --git a/soc/riscv/neorv32/Kconfig.defconfig b/soc/riscv/riscv-privileged/neorv32/Kconfig.defconfig.series similarity index 88% rename from soc/riscv/neorv32/Kconfig.defconfig rename to soc/riscv/riscv-privileged/neorv32/Kconfig.defconfig.series index 86aed551f5d..11bd7ef7d33 100644 --- a/soc/riscv/neorv32/Kconfig.defconfig +++ b/soc/riscv/riscv-privileged/neorv32/Kconfig.defconfig.series @@ -1,9 +1,9 @@ # Copyright (c) 2021 Henrik Brix Andersen # SPDX-License-Identifier: Apache-2.0 -if SOC_NEORV32 +if SOC_SERIES_NEORV32 -config SOC +config SOC_SERIES default "neorv32" config SYS_CLOCK_HW_CYCLES_PER_SEC @@ -29,4 +29,4 @@ config ENTROPY_INIT_PRIORITY default 55 depends on ENTROPY_GENERATOR -endif # SOC_NEORV32 +endif # SOC_SERIES_NEORV32 diff --git a/soc/riscv/neorv32/Kconfig.soc b/soc/riscv/riscv-privileged/neorv32/Kconfig.series similarity index 56% rename from soc/riscv/neorv32/Kconfig.soc rename to soc/riscv/riscv-privileged/neorv32/Kconfig.series index f07bba96574..0f8f9ca8fd4 100644 --- a/soc/riscv/neorv32/Kconfig.soc +++ b/soc/riscv/riscv-privileged/neorv32/Kconfig.series @@ -1,7 +1,7 @@ # Copyright (c) 2021 Henrik Brix Andersen # SPDX-License-Identifier: Apache-2.0 -config SOC_NEORV32 +config SOC_SERIES_NEORV32 bool "NEORV32 Processor" select RISCV select RISCV_ISA_RV32I @@ -10,7 +10,6 @@ config SOC_NEORV32 select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE help Enable support for the NEORV32 Processor (SoC). @@ -25,27 +24,3 @@ config SOC_NEORV32 - E (Embedded, only 16 integer registers) - Zbb (Basic Bit Manipulation) - Zfinx (Floating Point in Integer Registers) - -if SOC_NEORV32 - -config SOC_NEORV32_V1_8_6 - bool "v1.8.6" - # NEORV32 RISC-V ISA A extension implements only LR/SC, not AMO - select ATOMIC_OPERATIONS_C - -config SOC_NEORV32_VERSION - hex - default 0x01080600 if SOC_NEORV32_V1_8_6 - help - The targeted NEORV32 version as BCD-coded number. The format is - identical to that of the NEORV32 Machine implementation ID (mimpid) - register. - -config SOC_NEORV32_ISA_C - bool "RISC-V ISA Extension \"C\"" - select RISCV_ISA_EXT_C - help - Enable this if the NEORV32 CPU implementation supports the RISC-V ISA - "C" extension (Compressed Instructions). - -endif # SOC_NEORV32 diff --git a/soc/riscv/riscv-privileged/neorv32/Kconfig.soc b/soc/riscv/riscv-privileged/neorv32/Kconfig.soc new file mode 100644 index 00000000000..93c9da8cc3d --- /dev/null +++ b/soc/riscv/riscv-privileged/neorv32/Kconfig.soc @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +choice + prompt "NEORV32 Version" + depends on SOC_SERIES_NEORV32 + +config SOC_NEORV32_V1_8_6 + bool "v1.8.6" + # NEORV32 RISC-V ISA A extension implements only LR/SC, not AMO + select ATOMIC_OPERATIONS_C + +endchoice + +if SOC_SERIES_NEORV32 + +config SOC_NEORV32_VERSION + hex + default 0x01080600 if SOC_NEORV32_V1_8_6 + help + The targeted NEORV32 version as BCD-coded number. The format is + identical to that of the NEORV32 Machine implementation ID (mimpid) + register. + +config SOC_NEORV32_ISA_C + bool "RISC-V ISA Extension \"C\"" + select RISCV_ISA_EXT_C + help + Enable this if the NEORV32 CPU implementation supports the RISC-V ISA + "C" extension (Compressed Instructions). + +endif # SOC_SERIES_NEORV32 diff --git a/soc/riscv/neorv32/linker.ld b/soc/riscv/riscv-privileged/neorv32/linker.ld similarity index 100% rename from soc/riscv/neorv32/linker.ld rename to soc/riscv/riscv-privileged/neorv32/linker.ld diff --git a/soc/riscv/neorv32/reset.S b/soc/riscv/riscv-privileged/neorv32/reset.S similarity index 100% rename from soc/riscv/neorv32/reset.S rename to soc/riscv/riscv-privileged/neorv32/reset.S diff --git a/soc/riscv/neorv32/soc.c b/soc/riscv/riscv-privileged/neorv32/soc.c similarity index 100% rename from soc/riscv/neorv32/soc.c rename to soc/riscv/riscv-privileged/neorv32/soc.c diff --git a/soc/riscv/neorv32/soc.h b/soc/riscv/riscv-privileged/neorv32/soc.h similarity index 100% rename from soc/riscv/neorv32/soc.h rename to soc/riscv/riscv-privileged/neorv32/soc.h diff --git a/soc/riscv/neorv32/soc_irq.S b/soc/riscv/riscv-privileged/neorv32/soc_irq.S similarity index 100% rename from soc/riscv/neorv32/soc_irq.S rename to soc/riscv/riscv-privileged/neorv32/soc_irq.S From 4e5cbe2f240a32f8976aa1dee364ce92e755d519 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:35 +0100 Subject: [PATCH 1098/2300] Revert "[nrf fromtree] soc: riscv: s/litex-vexriscv/litex_vexriscv" This reverts commit 953a23809ec29ae6f4785d941467c840864bd6a3. Signed-off-by: Robert Lubos --- soc/riscv/{litex_vexriscv => litex-vexriscv}/CMakeLists.txt | 0 soc/riscv/{litex_vexriscv => litex-vexriscv}/Kconfig.defconfig | 2 +- soc/riscv/{litex_vexriscv => litex-vexriscv}/Kconfig.soc | 0 soc/riscv/{litex_vexriscv => litex-vexriscv}/soc.h | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename soc/riscv/{litex_vexriscv => litex-vexriscv}/CMakeLists.txt (100%) rename soc/riscv/{litex_vexriscv => litex-vexriscv}/Kconfig.defconfig (92%) rename soc/riscv/{litex_vexriscv => litex-vexriscv}/Kconfig.soc (100%) rename soc/riscv/{litex_vexriscv => litex-vexriscv}/soc.h (100%) diff --git a/soc/riscv/litex_vexriscv/CMakeLists.txt b/soc/riscv/litex-vexriscv/CMakeLists.txt similarity index 100% rename from soc/riscv/litex_vexriscv/CMakeLists.txt rename to soc/riscv/litex-vexriscv/CMakeLists.txt diff --git a/soc/riscv/litex_vexriscv/Kconfig.defconfig b/soc/riscv/litex-vexriscv/Kconfig.defconfig similarity index 92% rename from soc/riscv/litex_vexriscv/Kconfig.defconfig rename to soc/riscv/litex-vexriscv/Kconfig.defconfig index 3efdf200ee7..9447948b567 100644 --- a/soc/riscv/litex_vexriscv/Kconfig.defconfig +++ b/soc/riscv/litex-vexriscv/Kconfig.defconfig @@ -4,7 +4,7 @@ if SOC_RISCV32_LITEX_VEXRISCV config SOC - default "litex_vexriscv" + default "litex-vexriscv" config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 diff --git a/soc/riscv/litex_vexriscv/Kconfig.soc b/soc/riscv/litex-vexriscv/Kconfig.soc similarity index 100% rename from soc/riscv/litex_vexriscv/Kconfig.soc rename to soc/riscv/litex-vexriscv/Kconfig.soc diff --git a/soc/riscv/litex_vexriscv/soc.h b/soc/riscv/litex-vexriscv/soc.h similarity index 100% rename from soc/riscv/litex_vexriscv/soc.h rename to soc/riscv/litex-vexriscv/soc.h From 6740ff21892288a0e2d5f8bb8e9e6bb9f37b85de Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:35 +0100 Subject: [PATCH 1099/2300] Revert "[nrf fromtree] soc: riscv: ite: reorganize SoC folder" This reverts commit d6d4a4e5914ffbff3e49883bc3936249b6cfaf74. Signed-off-by: Robert Lubos --- MAINTAINERS.yml | 2 +- boards/riscv/it82xx2_evb/it82xx2_evb_defconfig | 2 +- boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig | 2 +- soc/riscv/ite_ec/Kconfig | 17 ----------------- soc/riscv/{ite_ec => riscv-ite}/CMakeLists.txt | 0 soc/riscv/riscv-ite/Kconfig | 14 ++++++++++++++ .../{ite_ec => riscv-ite}/Kconfig.defconfig | 2 +- soc/riscv/{ite_ec => riscv-ite}/Kconfig.soc | 2 +- .../{ite_ec => riscv-ite}/common/CMakeLists.txt | 0 .../{ite_ec => riscv-ite}/common/check_regs.c | 0 .../common/chip_chipregs.h | 0 .../{ite_ec => riscv-ite}/common/pinctrl_soc.h | 0 soc/riscv/{ite_ec => riscv-ite}/common/policy.c | 0 soc/riscv/{ite_ec => riscv-ite}/common/power.c | 0 .../{ite_ec => riscv-ite}/common/soc_common.h | 0 .../common/soc_common_irq.c | 0 soc/riscv/{ite_ec => riscv-ite}/common/soc_dt.h | 0 .../{ite_ec => riscv-ite}/common/soc_espi.h | 0 .../{ite_ec => riscv-ite}/common/soc_irq.S | 0 soc/riscv/{ite_ec => riscv-ite}/common/vector.S | 0 .../it8xxx2/CMakeLists.txt | 0 .../it8xxx2/Kconfig.defconfig.it81202bx | 0 .../it8xxx2/Kconfig.defconfig.it81202cx | 0 .../it8xxx2/Kconfig.defconfig.it81302bx | 0 .../it8xxx2/Kconfig.defconfig.it81302cx | 0 .../it8xxx2/Kconfig.defconfig.it82002aw | 0 .../it8xxx2/Kconfig.defconfig.it82202ax | 0 .../it8xxx2/Kconfig.defconfig.it82302ax | 0 .../it8xxx2/Kconfig.defconfig.series | 6 +++--- .../it8xxx2/Kconfig.series | 4 ++-- .../{ite_ec => riscv-ite}/it8xxx2/Kconfig.soc | 2 +- .../it8xxx2/__arithmetic.S | 0 soc/riscv/{ite_ec => riscv-ite}/it8xxx2/ilm.c | 0 soc/riscv/{ite_ec => riscv-ite}/it8xxx2/ilm.h | 0 .../{ite_ec => riscv-ite}/it8xxx2/linker.ld | 0 soc/riscv/{ite_ec => riscv-ite}/it8xxx2/soc.c | 0 soc/riscv/{ite_ec => riscv-ite}/it8xxx2/soc.h | 0 .../gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt | 4 ++-- .../gpio_ite_it8xxx2_v2/include/chip_chipregs.h | 2 +- 39 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 soc/riscv/ite_ec/Kconfig rename soc/riscv/{ite_ec => riscv-ite}/CMakeLists.txt (100%) create mode 100644 soc/riscv/riscv-ite/Kconfig rename soc/riscv/{ite_ec => riscv-ite}/Kconfig.defconfig (63%) rename soc/riscv/{ite_ec => riscv-ite}/Kconfig.soc (68%) rename soc/riscv/{ite_ec => riscv-ite}/common/CMakeLists.txt (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/check_regs.c (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/chip_chipregs.h (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/pinctrl_soc.h (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/policy.c (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/power.c (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/soc_common.h (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/soc_common_irq.c (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/soc_dt.h (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/soc_espi.h (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/soc_irq.S (100%) rename soc/riscv/{ite_ec => riscv-ite}/common/vector.S (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/CMakeLists.txt (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.defconfig.it81202bx (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.defconfig.it81202cx (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.defconfig.it81302bx (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.defconfig.it81302cx (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.defconfig.it82002aw (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.defconfig.it82202ax (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.defconfig.it82302ax (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.defconfig.series (87%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.series (86%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/Kconfig.soc (99%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/__arithmetic.S (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/ilm.c (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/ilm.h (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/linker.ld (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/soc.c (100%) rename soc/riscv/{ite_ec => riscv-ite}/it8xxx2/soc.h (100%) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index d7623c89137..255f6cefa2c 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -2850,7 +2850,7 @@ ITE Platforms: - drivers/*/*it8xxx2*.c - dts/bindings/*/*ite* - dts/riscv/ite/ - - soc/riscv/ite_ec/ + - soc/riscv/riscv-ite/ labels: - "platform: ITE" diff --git a/boards/riscv/it82xx2_evb/it82xx2_evb_defconfig b/boards/riscv/it82xx2_evb/it82xx2_evb_defconfig index 6866e3f633b..f082e4a7bad 100644 --- a/boards/riscv/it82xx2_evb/it82xx2_evb_defconfig +++ b/boards/riscv/it82xx2_evb/it82xx2_evb_defconfig @@ -1,7 +1,7 @@ # Copyright (c) 2023 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_ITE_IT8XXX2=y +CONFIG_SOC_SERIES_RISCV32_IT8XXX2=y CONFIG_SOC_IT8XXX2=y CONFIG_SOC_IT82202_AX=y CONFIG_BOARD_IT82XX2_EVB=y diff --git a/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig b/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig index 38a44d6f8f3..21967527f8e 100644 --- a/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig +++ b/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig @@ -1,7 +1,7 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_ITE_IT8XXX2=y +CONFIG_SOC_SERIES_RISCV32_IT8XXX2=y CONFIG_SOC_IT8XXX2=y CONFIG_BOARD_IT8XXX2_EVB=y CONFIG_BOOT_DELAY=1 diff --git a/soc/riscv/ite_ec/Kconfig b/soc/riscv/ite_ec/Kconfig deleted file mode 100644 index 54628029a4e..00000000000 --- a/soc/riscv/ite_ec/Kconfig +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2020 ITE Corporation. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_ITE_EC - bool - help - ITE Embedded Controller SoC family - -if SOC_FAMILY_ITE_EC - -config SOC_FAMILY - string - default "ite_ec" - -source "soc/riscv/ite_ec/*/Kconfig.soc" - -endif # SOC_FAMILY_ITE_EC diff --git a/soc/riscv/ite_ec/CMakeLists.txt b/soc/riscv/riscv-ite/CMakeLists.txt similarity index 100% rename from soc/riscv/ite_ec/CMakeLists.txt rename to soc/riscv/riscv-ite/CMakeLists.txt diff --git a/soc/riscv/riscv-ite/Kconfig b/soc/riscv/riscv-ite/Kconfig new file mode 100644 index 00000000000..f25c53d1ffb --- /dev/null +++ b/soc/riscv/riscv-ite/Kconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2020 ITE Corporation. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FAMILY_RISCV_ITE + bool + help + omit prompt to signify a "hidden" option + +config SOC_FAMILY + string + default "riscv-ite" + depends on SOC_FAMILY_RISCV_ITE + +source "soc/riscv/riscv-ite/*/Kconfig.soc" diff --git a/soc/riscv/ite_ec/Kconfig.defconfig b/soc/riscv/riscv-ite/Kconfig.defconfig similarity index 63% rename from soc/riscv/ite_ec/Kconfig.defconfig rename to soc/riscv/riscv-ite/Kconfig.defconfig index 8994f47abd9..ae18beac098 100644 --- a/soc/riscv/ite_ec/Kconfig.defconfig +++ b/soc/riscv/riscv-ite/Kconfig.defconfig @@ -1,4 +1,4 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -source "soc/riscv/ite_ec/*/Kconfig.defconfig.series" +source "soc/riscv/riscv-ite/*/Kconfig.defconfig.series" diff --git a/soc/riscv/ite_ec/Kconfig.soc b/soc/riscv/riscv-ite/Kconfig.soc similarity index 68% rename from soc/riscv/ite_ec/Kconfig.soc rename to soc/riscv/riscv-ite/Kconfig.soc index 13f951c0466..925edb1543c 100644 --- a/soc/riscv/ite_ec/Kconfig.soc +++ b/soc/riscv/riscv-ite/Kconfig.soc @@ -1,4 +1,4 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -source "soc/riscv/ite_ec/*/Kconfig.series" +source "soc/riscv/riscv-ite/*/Kconfig.series" diff --git a/soc/riscv/ite_ec/common/CMakeLists.txt b/soc/riscv/riscv-ite/common/CMakeLists.txt similarity index 100% rename from soc/riscv/ite_ec/common/CMakeLists.txt rename to soc/riscv/riscv-ite/common/CMakeLists.txt diff --git a/soc/riscv/ite_ec/common/check_regs.c b/soc/riscv/riscv-ite/common/check_regs.c similarity index 100% rename from soc/riscv/ite_ec/common/check_regs.c rename to soc/riscv/riscv-ite/common/check_regs.c diff --git a/soc/riscv/ite_ec/common/chip_chipregs.h b/soc/riscv/riscv-ite/common/chip_chipregs.h similarity index 100% rename from soc/riscv/ite_ec/common/chip_chipregs.h rename to soc/riscv/riscv-ite/common/chip_chipregs.h diff --git a/soc/riscv/ite_ec/common/pinctrl_soc.h b/soc/riscv/riscv-ite/common/pinctrl_soc.h similarity index 100% rename from soc/riscv/ite_ec/common/pinctrl_soc.h rename to soc/riscv/riscv-ite/common/pinctrl_soc.h diff --git a/soc/riscv/ite_ec/common/policy.c b/soc/riscv/riscv-ite/common/policy.c similarity index 100% rename from soc/riscv/ite_ec/common/policy.c rename to soc/riscv/riscv-ite/common/policy.c diff --git a/soc/riscv/ite_ec/common/power.c b/soc/riscv/riscv-ite/common/power.c similarity index 100% rename from soc/riscv/ite_ec/common/power.c rename to soc/riscv/riscv-ite/common/power.c diff --git a/soc/riscv/ite_ec/common/soc_common.h b/soc/riscv/riscv-ite/common/soc_common.h similarity index 100% rename from soc/riscv/ite_ec/common/soc_common.h rename to soc/riscv/riscv-ite/common/soc_common.h diff --git a/soc/riscv/ite_ec/common/soc_common_irq.c b/soc/riscv/riscv-ite/common/soc_common_irq.c similarity index 100% rename from soc/riscv/ite_ec/common/soc_common_irq.c rename to soc/riscv/riscv-ite/common/soc_common_irq.c diff --git a/soc/riscv/ite_ec/common/soc_dt.h b/soc/riscv/riscv-ite/common/soc_dt.h similarity index 100% rename from soc/riscv/ite_ec/common/soc_dt.h rename to soc/riscv/riscv-ite/common/soc_dt.h diff --git a/soc/riscv/ite_ec/common/soc_espi.h b/soc/riscv/riscv-ite/common/soc_espi.h similarity index 100% rename from soc/riscv/ite_ec/common/soc_espi.h rename to soc/riscv/riscv-ite/common/soc_espi.h diff --git a/soc/riscv/ite_ec/common/soc_irq.S b/soc/riscv/riscv-ite/common/soc_irq.S similarity index 100% rename from soc/riscv/ite_ec/common/soc_irq.S rename to soc/riscv/riscv-ite/common/soc_irq.S diff --git a/soc/riscv/ite_ec/common/vector.S b/soc/riscv/riscv-ite/common/vector.S similarity index 100% rename from soc/riscv/ite_ec/common/vector.S rename to soc/riscv/riscv-ite/common/vector.S diff --git a/soc/riscv/ite_ec/it8xxx2/CMakeLists.txt b/soc/riscv/riscv-ite/it8xxx2/CMakeLists.txt similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/CMakeLists.txt rename to soc/riscv/riscv-ite/it8xxx2/CMakeLists.txt diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81202bx b/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81202bx similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81202bx rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81202bx diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81202cx b/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81202cx similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81202cx rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81202cx diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81302bx b/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81302bx similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81302bx rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81302bx diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81302cx b/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81302cx similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it81302cx rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it81302cx diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82002aw b/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82002aw similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82002aw rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82002aw diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82202ax b/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82202ax similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82202ax rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82202ax diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82302ax b/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82302ax similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it82302ax rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it82302ax diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series b/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.series similarity index 87% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.series index 7c5bc0ee897..4e6b7c18cca 100644 --- a/soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.series +++ b/soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.series @@ -1,7 +1,7 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_ITE_IT8XXX2 +if SOC_SERIES_RISCV32_IT8XXX2 config SOC_SERIES default "it8xxx2" @@ -57,6 +57,6 @@ config GEN_SW_ISR_TABLE config RISCV_SOC_INTERRUPT_INIT default y -source "soc/riscv/ite_ec/it8xxx2/Kconfig.defconfig.it8*" +source "soc/riscv/riscv-ite/it8xxx2/Kconfig.defconfig.it8*" -endif # SOC_SERIES_ITE_IT8XXX2 +endif # SOC_SERIES_RISCV32_IT8XXX2 diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.series b/soc/riscv/riscv-ite/it8xxx2/Kconfig.series similarity index 86% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.series rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.series index 265bf855f12..ebed0fcd120 100644 --- a/soc/riscv/ite_ec/it8xxx2/Kconfig.series +++ b/soc/riscv/riscv-ite/it8xxx2/Kconfig.series @@ -1,13 +1,13 @@ # Copyright (c) 2020 ITE Corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_ITE_IT8XXX2 +config SOC_SERIES_RISCV32_IT8XXX2 bool "ITE IT8XXX2 implementation" #depends on RISCV # RV32IAFC is an uncommon configuration which is not supported by # default in most toolchains, causing link-time errors. select CPU_HAS_FPU if "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "zephyr" || RISCV_ISA_EXT_M - select SOC_FAMILY_ITE_EC + select SOC_FAMILY_RISCV_ITE select HAS_PM help Enable support for ITE IT8XXX2 diff --git a/soc/riscv/ite_ec/it8xxx2/Kconfig.soc b/soc/riscv/riscv-ite/it8xxx2/Kconfig.soc similarity index 99% rename from soc/riscv/ite_ec/it8xxx2/Kconfig.soc rename to soc/riscv/riscv-ite/it8xxx2/Kconfig.soc index 800a2a9dafd..38525449f89 100644 --- a/soc/riscv/ite_ec/it8xxx2/Kconfig.soc +++ b/soc/riscv/riscv-ite/it8xxx2/Kconfig.soc @@ -3,7 +3,7 @@ choice prompt "ITE IT8XXX2 system implementation" -depends on SOC_SERIES_ITE_IT8XXX2 +depends on SOC_SERIES_RISCV32_IT8XXX2 config SOC_IT8XXX2 bool "ITE IT8XXX2 system implementation" diff --git a/soc/riscv/ite_ec/it8xxx2/__arithmetic.S b/soc/riscv/riscv-ite/it8xxx2/__arithmetic.S similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/__arithmetic.S rename to soc/riscv/riscv-ite/it8xxx2/__arithmetic.S diff --git a/soc/riscv/ite_ec/it8xxx2/ilm.c b/soc/riscv/riscv-ite/it8xxx2/ilm.c similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/ilm.c rename to soc/riscv/riscv-ite/it8xxx2/ilm.c diff --git a/soc/riscv/ite_ec/it8xxx2/ilm.h b/soc/riscv/riscv-ite/it8xxx2/ilm.h similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/ilm.h rename to soc/riscv/riscv-ite/it8xxx2/ilm.h diff --git a/soc/riscv/ite_ec/it8xxx2/linker.ld b/soc/riscv/riscv-ite/it8xxx2/linker.ld similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/linker.ld rename to soc/riscv/riscv-ite/it8xxx2/linker.ld diff --git a/soc/riscv/ite_ec/it8xxx2/soc.c b/soc/riscv/riscv-ite/it8xxx2/soc.c similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/soc.c rename to soc/riscv/riscv-ite/it8xxx2/soc.c diff --git a/soc/riscv/ite_ec/it8xxx2/soc.h b/soc/riscv/riscv-ite/it8xxx2/soc.h similarity index 100% rename from soc/riscv/ite_ec/it8xxx2/soc.h rename to soc/riscv/riscv-ite/it8xxx2/soc.h diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt index 1079605a2b4..bf01055ffc3 100644 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt @@ -13,8 +13,8 @@ target_include_directories(app PRIVATE zephyr_include_directories( include - ${ZEPHYR_BASE}/soc/riscv/ite_ec/common - ${ZEPHYR_BASE}/soc/riscv/ite_ec/it8xxx2 + ${ZEPHYR_BASE}/soc/riscv/riscv-ite/common + ${ZEPHYR_BASE}/soc/riscv/riscv-ite/it8xxx2 ) target_sources(app diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h index d3c1f7c827e..3372a845aa9 100644 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include <../soc/riscv/ite_ec/common/chip_chipregs.h> +#include <../soc/riscv/riscv-ite/common/chip_chipregs.h> /* * Macros for emulated hardware registers access. From 58c6cbc4789d47a789910b47825f2a74781b0496 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:35 +0100 Subject: [PATCH 1100/2300] Revert "[nrf fromtree] soc: riscv: andes_v5: reorganize SoC folder" This reverts commit afb3219d6e3d6e9109b6c54f68f2ee9fb2af3f1c. Signed-off-by: Robert Lubos --- boards/riscv/adp_xc7k_ae350/Kconfig.board | 2 +- .../riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig | 4 ++-- drivers/hwinfo/Kconfig | 2 +- soc/riscv/andes_v5/CMakeLists.txt | 4 ---- soc/riscv/andes_v5/Kconfig | 15 --------------- soc/riscv/andes_v5/Kconfig.defconfig | 4 ---- soc/riscv/andes_v5/Kconfig.soc | 4 ---- soc/riscv/andes_v5/ae350/Kconfig.series | 11 ----------- .../andes_v5}/CMakeLists.txt | 6 +++--- .../andes_v5}/Kconfig.defconfig.ae350 | 4 ++-- .../andes_v5}/Kconfig.defconfig.series | 8 ++++---- .../riscv-privileged/andes_v5/Kconfig.series | 9 +++++++++ .../andes_v5}/Kconfig.soc | 8 ++++---- .../andes_v5/ae350/linker.ld | 0 .../{ => riscv-privileged}/andes_v5/ae350/soc.h | 0 .../andes_v5}/common_linker/execit.ld | 0 .../andes_v5}/common_linker/init.ld | 0 .../andes_v5}/common_linker/ram_start_nonzero.ld | 0 .../andes_v5}/l2_cache.c | 0 .../ae350 => riscv-privileged/andes_v5}/pma.c | 0 .../andes_v5}/soc_context.h | 0 .../ae350 => riscv-privileged/andes_v5}/soc_irq.S | 0 .../andes_v5}/soc_offsets.h | 0 .../ae350 => riscv-privileged/andes_v5}/soc_v5.h | 0 .../ae350 => riscv-privileged/andes_v5}/start.S | 0 25 files changed, 26 insertions(+), 55 deletions(-) delete mode 100644 soc/riscv/andes_v5/CMakeLists.txt delete mode 100644 soc/riscv/andes_v5/Kconfig delete mode 100644 soc/riscv/andes_v5/Kconfig.defconfig delete mode 100644 soc/riscv/andes_v5/Kconfig.soc delete mode 100644 soc/riscv/andes_v5/ae350/Kconfig.series rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/CMakeLists.txt (82%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/Kconfig.defconfig.ae350 (88%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/Kconfig.defconfig.series (83%) create mode 100644 soc/riscv/riscv-privileged/andes_v5/Kconfig.series rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/Kconfig.soc (95%) rename soc/riscv/{ => riscv-privileged}/andes_v5/ae350/linker.ld (100%) rename soc/riscv/{ => riscv-privileged}/andes_v5/ae350/soc.h (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/common_linker/execit.ld (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/common_linker/init.ld (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/common_linker/ram_start_nonzero.ld (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/l2_cache.c (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/pma.c (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/soc_context.h (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/soc_irq.S (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/soc_offsets.h (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/soc_v5.h (100%) rename soc/riscv/{andes_v5/ae350 => riscv-privileged/andes_v5}/start.S (100%) diff --git a/boards/riscv/adp_xc7k_ae350/Kconfig.board b/boards/riscv/adp_xc7k_ae350/Kconfig.board index 5b58e01fbfd..085eb9696a8 100644 --- a/boards/riscv/adp_xc7k_ae350/Kconfig.board +++ b/boards/riscv/adp_xc7k_ae350/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_ADP_XC7K_AE350 bool "Andes ADP-XC7K AE350 Platform" - depends on SOC_ANDES_AE350 + depends on SOC_RISCV_ANDES_AE350 diff --git a/boards/riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig b/boards/riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig index edbe7118c64..3f7f1f727c6 100644 --- a/boards/riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig +++ b/boards/riscv/adp_xc7k_ae350/adp_xc7k_ae350_defconfig @@ -1,5 +1,5 @@ -CONFIG_SOC_SERIES_ANDES_AE350=y -CONFIG_SOC_ANDES_AE350=y +CONFIG_SOC_SERIES_RISCV_ANDES_V5=y +CONFIG_SOC_RISCV_ANDES_AE350=y CONFIG_BOARD_ADP_XC7K_AE350=y CONFIG_XIP=n CONFIG_CONSOLE=y diff --git a/drivers/hwinfo/Kconfig b/drivers/hwinfo/Kconfig index 4bf9e462318..7c4cc7f0805 100644 --- a/drivers/hwinfo/Kconfig +++ b/drivers/hwinfo/Kconfig @@ -181,7 +181,7 @@ config HWINFO_GECKO config HWINFO_ANDES bool "Andes system ID" default y - depends on SOC_FAMILY_ANDES_V5 + depends on SOC_SERIES_RISCV_ANDES_V5 help Enable Andes hwinfo driver diff --git a/soc/riscv/andes_v5/CMakeLists.txt b/soc/riscv/andes_v5/CMakeLists.txt deleted file mode 100644 index 69b2926358e..00000000000 --- a/soc/riscv/andes_v5/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/andes_v5/Kconfig b/soc/riscv/andes_v5/Kconfig deleted file mode 100644 index f3c78ab7f81..00000000000 --- a/soc/riscv/andes_v5/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_ANDES_V5 - bool - -if SOC_FAMILY_ANDES_V5 - -config SOC_FAMILY - string - default "andes_v5" - -source "soc/riscv/andes_v5/*/Kconfig.soc" - -endif # SOC_FAMILY_ANDES_V5 diff --git a/soc/riscv/andes_v5/Kconfig.defconfig b/soc/riscv/andes_v5/Kconfig.defconfig deleted file mode 100644 index 6213f28d2cb..00000000000 --- a/soc/riscv/andes_v5/Kconfig.defconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/andes_v5/*/Kconfig.defconfig.series" diff --git a/soc/riscv/andes_v5/Kconfig.soc b/soc/riscv/andes_v5/Kconfig.soc deleted file mode 100644 index 9efb4781934..00000000000 --- a/soc/riscv/andes_v5/Kconfig.soc +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/andes_v5/*/Kconfig.series" diff --git a/soc/riscv/andes_v5/ae350/Kconfig.series b/soc/riscv/andes_v5/ae350/Kconfig.series deleted file mode 100644 index 4eb9557f92f..00000000000 --- a/soc/riscv/andes_v5/ae350/Kconfig.series +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2021 Andes Technology Corporation -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_ANDES_AE350 - bool "Andes V5 AE350 SoC Series Implementation" - select RISCV - select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE - select SOC_FAMILY_ANDES_V5 - help - Enable support for Andes V5 AE350 SoC Series diff --git a/soc/riscv/andes_v5/ae350/CMakeLists.txt b/soc/riscv/riscv-privileged/andes_v5/CMakeLists.txt similarity index 82% rename from soc/riscv/andes_v5/ae350/CMakeLists.txt rename to soc/riscv/riscv-privileged/andes_v5/CMakeLists.txt index b8eac026dfb..21268312347 100644 --- a/soc/riscv/andes_v5/ae350/CMakeLists.txt +++ b/soc/riscv/riscv-privileged/andes_v5/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_include_directories(.) +zephyr_include_directories(${CONFIG_SOC}) zephyr_sources( start.S @@ -24,6 +24,6 @@ if(CONFIG_SOC_ANDES_V5_EXECIT) zephyr_ld_options(-Wl,--mexecit) endif() -if(CONFIG_SOC_ANDES_AE350) - set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "") +if(CONFIG_SOC_RISCV_ANDES_AE350) + set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/ae350/linker.ld CACHE INTERNAL "") endif() diff --git a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.ae350 b/soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.ae350 similarity index 88% rename from soc/riscv/andes_v5/ae350/Kconfig.defconfig.ae350 rename to soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.ae350 index fee73684b71..5d652057a38 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.ae350 +++ b/soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.ae350 @@ -1,7 +1,7 @@ # Copyright (c) 2021 Andes Technology Corporation # SPDX-License-Identifier: Apache-2.0 -if SOC_ANDES_AE350 +if SOC_RISCV_ANDES_AE350 config SOC default "ae350" @@ -25,4 +25,4 @@ config MP_MAX_NUM_CPUS default 1 range 1 8 -endif # SOC_ANDES_AE350 +endif # SOC_RISCV_ANDES_AE350 diff --git a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.series similarity index 83% rename from soc/riscv/andes_v5/ae350/Kconfig.defconfig.series rename to soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.series index 7bd679e5f45..c6436807825 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.defconfig.series +++ b/soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.series @@ -1,15 +1,15 @@ # Copyright (c) 2021 Andes Technology Corporation # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_ANDES_AE350 +if SOC_SERIES_RISCV_ANDES_V5 # Kconfig picks the first default with a satisfied condition. # SoC defaults should be parsed before SoC Series defaults, because SoCs usually # overrides SoC Series values. -source "soc/riscv/andes_v5/ae350/Kconfig.defconfig.ae*" +source "soc/riscv/riscv-privileged/andes_v5/Kconfig.defconfig.ae*" config SOC_SERIES - default "ae350" + default "andes_v5" config SYS_CLOCK_HW_CYCLES_PER_SEC default 60000000 @@ -45,4 +45,4 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 64 -endif # SOC_SERIES_ANDES_AE350 +endif # SOC_SERIES_RISCV_ANDES_V5 diff --git a/soc/riscv/riscv-privileged/andes_v5/Kconfig.series b/soc/riscv/riscv-privileged/andes_v5/Kconfig.series new file mode 100644 index 00000000000..a85c521492b --- /dev/null +++ b/soc/riscv/riscv-privileged/andes_v5/Kconfig.series @@ -0,0 +1,9 @@ +# Copyright (c) 2021 Andes Technology Corporation +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_RISCV_ANDES_V5 + bool "Andes V5 SoC Series Implementation" + select RISCV + select RISCV_PRIVILEGED + help + Enable support for Andes V5 SoC Series diff --git a/soc/riscv/andes_v5/ae350/Kconfig.soc b/soc/riscv/riscv-privileged/andes_v5/Kconfig.soc similarity index 95% rename from soc/riscv/andes_v5/ae350/Kconfig.soc rename to soc/riscv/riscv-privileged/andes_v5/Kconfig.soc index 1731cc08f51..19f215e2c5a 100644 --- a/soc/riscv/andes_v5/ae350/Kconfig.soc +++ b/soc/riscv/riscv-privileged/andes_v5/Kconfig.soc @@ -3,9 +3,9 @@ choice prompt "Andes V5 SoC Selection" -depends on SOC_SERIES_ANDES_AE350 +depends on SOC_SERIES_RISCV_ANDES_V5 -config SOC_ANDES_AE350 +config SOC_RISCV_ANDES_AE350 bool "Andes AE350 SoC implementation" select ATOMIC_OPERATIONS_BUILTIN select INCLUDE_RESET_VECTOR @@ -18,7 +18,7 @@ config SOC_ANDES_AE350 endchoice -if SOC_SERIES_ANDES_AE350 +if SOC_SERIES_RISCV_ANDES_V5 choice prompt "Base CPU ISA options" @@ -121,4 +121,4 @@ config SOC_ANDES_V5_IOCP between cache and external non-caching master, such as DMA controller. -endif # SOC_SERIES_ANDES_AE350 +endif # SOC_SERIES_RISCV_ANDES_V5 diff --git a/soc/riscv/andes_v5/ae350/linker.ld b/soc/riscv/riscv-privileged/andes_v5/ae350/linker.ld similarity index 100% rename from soc/riscv/andes_v5/ae350/linker.ld rename to soc/riscv/riscv-privileged/andes_v5/ae350/linker.ld diff --git a/soc/riscv/andes_v5/ae350/soc.h b/soc/riscv/riscv-privileged/andes_v5/ae350/soc.h similarity index 100% rename from soc/riscv/andes_v5/ae350/soc.h rename to soc/riscv/riscv-privileged/andes_v5/ae350/soc.h diff --git a/soc/riscv/andes_v5/ae350/common_linker/execit.ld b/soc/riscv/riscv-privileged/andes_v5/common_linker/execit.ld similarity index 100% rename from soc/riscv/andes_v5/ae350/common_linker/execit.ld rename to soc/riscv/riscv-privileged/andes_v5/common_linker/execit.ld diff --git a/soc/riscv/andes_v5/ae350/common_linker/init.ld b/soc/riscv/riscv-privileged/andes_v5/common_linker/init.ld similarity index 100% rename from soc/riscv/andes_v5/ae350/common_linker/init.ld rename to soc/riscv/riscv-privileged/andes_v5/common_linker/init.ld diff --git a/soc/riscv/andes_v5/ae350/common_linker/ram_start_nonzero.ld b/soc/riscv/riscv-privileged/andes_v5/common_linker/ram_start_nonzero.ld similarity index 100% rename from soc/riscv/andes_v5/ae350/common_linker/ram_start_nonzero.ld rename to soc/riscv/riscv-privileged/andes_v5/common_linker/ram_start_nonzero.ld diff --git a/soc/riscv/andes_v5/ae350/l2_cache.c b/soc/riscv/riscv-privileged/andes_v5/l2_cache.c similarity index 100% rename from soc/riscv/andes_v5/ae350/l2_cache.c rename to soc/riscv/riscv-privileged/andes_v5/l2_cache.c diff --git a/soc/riscv/andes_v5/ae350/pma.c b/soc/riscv/riscv-privileged/andes_v5/pma.c similarity index 100% rename from soc/riscv/andes_v5/ae350/pma.c rename to soc/riscv/riscv-privileged/andes_v5/pma.c diff --git a/soc/riscv/andes_v5/ae350/soc_context.h b/soc/riscv/riscv-privileged/andes_v5/soc_context.h similarity index 100% rename from soc/riscv/andes_v5/ae350/soc_context.h rename to soc/riscv/riscv-privileged/andes_v5/soc_context.h diff --git a/soc/riscv/andes_v5/ae350/soc_irq.S b/soc/riscv/riscv-privileged/andes_v5/soc_irq.S similarity index 100% rename from soc/riscv/andes_v5/ae350/soc_irq.S rename to soc/riscv/riscv-privileged/andes_v5/soc_irq.S diff --git a/soc/riscv/andes_v5/ae350/soc_offsets.h b/soc/riscv/riscv-privileged/andes_v5/soc_offsets.h similarity index 100% rename from soc/riscv/andes_v5/ae350/soc_offsets.h rename to soc/riscv/riscv-privileged/andes_v5/soc_offsets.h diff --git a/soc/riscv/andes_v5/ae350/soc_v5.h b/soc/riscv/riscv-privileged/andes_v5/soc_v5.h similarity index 100% rename from soc/riscv/andes_v5/ae350/soc_v5.h rename to soc/riscv/riscv-privileged/andes_v5/soc_v5.h diff --git a/soc/riscv/andes_v5/ae350/start.S b/soc/riscv/riscv-privileged/andes_v5/start.S similarity index 100% rename from soc/riscv/andes_v5/ae350/start.S rename to soc/riscv/riscv-privileged/andes_v5/start.S From 719b1ef221f3ec0241b01b2d9f11e0a775d421fa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:35 +0100 Subject: [PATCH 1101/2300] Revert "[nrf fromtree] soc: riscv: starfive_jh71xx: reorganize SoC folder" This reverts commit 8a47d8208036745fbaf399f2c8d7f6d6fa9234f2. Signed-off-by: Robert Lubos --- .../starfive_jh71xx}/CMakeLists.txt | 0 .../starfive_jh71xx}/Kconfig.defconfig.series | 4 +--- .../starfive_jh71xx}/Kconfig.series | 1 - .../starfive_jh71xx}/Kconfig.soc | 0 .../starfive_jh71xx}/soc.h | 0 soc/riscv/starfive_jh71xx/CMakeLists.txt | 4 ---- soc/riscv/starfive_jh71xx/Kconfig | 15 --------------- soc/riscv/starfive_jh71xx/Kconfig.defconfig | 4 ---- soc/riscv/starfive_jh71xx/Kconfig.soc | 4 ---- .../jh71xx/Kconfig.defconfig.jh7100 | 5 ----- 10 files changed, 1 insertion(+), 36 deletions(-) rename soc/riscv/{starfive_jh71xx/jh71xx => riscv-privileged/starfive_jh71xx}/CMakeLists.txt (100%) rename soc/riscv/{starfive_jh71xx/jh71xx => riscv-privileged/starfive_jh71xx}/Kconfig.defconfig.series (84%) rename soc/riscv/{starfive_jh71xx/jh71xx => riscv-privileged/starfive_jh71xx}/Kconfig.series (88%) rename soc/riscv/{starfive_jh71xx/jh71xx => riscv-privileged/starfive_jh71xx}/Kconfig.soc (100%) rename soc/riscv/{starfive_jh71xx/jh71xx => riscv-privileged/starfive_jh71xx}/soc.h (100%) delete mode 100644 soc/riscv/starfive_jh71xx/CMakeLists.txt delete mode 100644 soc/riscv/starfive_jh71xx/Kconfig delete mode 100644 soc/riscv/starfive_jh71xx/Kconfig.defconfig delete mode 100644 soc/riscv/starfive_jh71xx/Kconfig.soc delete mode 100644 soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh7100 diff --git a/soc/riscv/starfive_jh71xx/jh71xx/CMakeLists.txt b/soc/riscv/riscv-privileged/starfive_jh71xx/CMakeLists.txt similarity index 100% rename from soc/riscv/starfive_jh71xx/jh71xx/CMakeLists.txt rename to soc/riscv/riscv-privileged/starfive_jh71xx/CMakeLists.txt diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.defconfig.series similarity index 84% rename from soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series rename to soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.defconfig.series index 77436b593e1..c488c614b7d 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.series +++ b/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.defconfig.series @@ -4,7 +4,7 @@ if SOC_SERIES_STARFIVE_JH71XX config SOC_SERIES - default "jh71xx" + default "starfive_jh71xx" config SYS_CLOCK_HW_CYCLES_PER_SEC default 6250000 @@ -30,6 +30,4 @@ config 2ND_LVL_INTR_00_OFFSET config NUM_IRQS default 139 -source "soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh71*" - endif diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series b/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series similarity index 88% rename from soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series rename to soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series index d70cff1c63d..19cedcefe27 100644 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.series +++ b/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series @@ -5,6 +5,5 @@ config SOC_SERIES_STARFIVE_JH71XX bool "Starfive JH71XX series" select RISCV select RISCV_PRIVILEGED - select RISCV_PRIVILEGED_STANDALONE help Enable support for Starfive JH71XX SoC Series. diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.soc b/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.soc similarity index 100% rename from soc/riscv/starfive_jh71xx/jh71xx/Kconfig.soc rename to soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.soc diff --git a/soc/riscv/starfive_jh71xx/jh71xx/soc.h b/soc/riscv/riscv-privileged/starfive_jh71xx/soc.h similarity index 100% rename from soc/riscv/starfive_jh71xx/jh71xx/soc.h rename to soc/riscv/riscv-privileged/starfive_jh71xx/soc.h diff --git a/soc/riscv/starfive_jh71xx/CMakeLists.txt b/soc/riscv/starfive_jh71xx/CMakeLists.txt deleted file mode 100644 index 69b2926358e..00000000000 --- a/soc/riscv/starfive_jh71xx/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/starfive_jh71xx/Kconfig b/soc/riscv/starfive_jh71xx/Kconfig deleted file mode 100644 index 65694c07eff..00000000000 --- a/soc/riscv/starfive_jh71xx/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_STARFIVE_JH71XX - bool - -if SOC_FAMILY_STARFIVE_JH71XX - -config SOC_FAMILY - string - default "starfive_jh71xx" - -source "soc/riscv/starfive_jh71xx/*/Kconfig.soc" - -endif # SOC_FAMILY_STARFIVE_JH71XX diff --git a/soc/riscv/starfive_jh71xx/Kconfig.defconfig b/soc/riscv/starfive_jh71xx/Kconfig.defconfig deleted file mode 100644 index b399e38b340..00000000000 --- a/soc/riscv/starfive_jh71xx/Kconfig.defconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/starfive_jh71xx/*/Kconfig.defconfig.series" diff --git a/soc/riscv/starfive_jh71xx/Kconfig.soc b/soc/riscv/starfive_jh71xx/Kconfig.soc deleted file mode 100644 index 1ff54faa970..00000000000 --- a/soc/riscv/starfive_jh71xx/Kconfig.soc +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/starfive_jh71xx/*/Kconfig.series" diff --git a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh7100 b/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh7100 deleted file mode 100644 index 6f38d61dd4e..00000000000 --- a/soc/riscv/starfive_jh71xx/jh71xx/Kconfig.defconfig.jh7100 +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC - default "jh7100" if SOC_JH7100 From 4076d2363a4c979270636f48a76655223cf78cb1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:36 +0100 Subject: [PATCH 1102/2300] Revert "[nrf fromtree] soc: riscv: gd32vf103: reorganize SoC folder" This reverts commit e161f49c59086ac9525cf95270944e03d799d06a. Signed-off-by: Robert Lubos --- MAINTAINERS.yml | 2 +- soc/riscv/gd_gd32/CMakeLists.txt | 4 ---- soc/riscv/gd_gd32/Kconfig | 15 --------------- soc/riscv/gd_gd32/Kconfig.defconfig | 4 ---- soc/riscv/gd_gd32/Kconfig.soc | 4 ---- .../gd32vf103/CMakeLists.txt | 0 .../gd32vf103/Kconfig.defconfig.gd32vf103 | 0 .../gd32vf103/Kconfig.defconfig.series | 2 +- .../gd32vf103/Kconfig.series | 3 +-- .../gd32vf103/Kconfig.soc | 0 .../gd32vf103/entry.S | 0 .../gd32vf103/gd32_regs.h | 0 .../gd32vf103/nuclei_csr.h | 0 .../gd32vf103/pinctrl_soc.h | 0 .../{gd_gd32 => riscv-privileged}/gd32vf103/soc.c | 0 .../{gd_gd32 => riscv-privileged}/gd32vf103/soc.h | 0 16 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 soc/riscv/gd_gd32/CMakeLists.txt delete mode 100644 soc/riscv/gd_gd32/Kconfig delete mode 100644 soc/riscv/gd_gd32/Kconfig.defconfig delete mode 100644 soc/riscv/gd_gd32/Kconfig.soc rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/CMakeLists.txt (100%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/Kconfig.defconfig.gd32vf103 (100%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/Kconfig.defconfig.series (72%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/Kconfig.series (89%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/Kconfig.soc (100%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/entry.S (100%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/gd32_regs.h (100%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/nuclei_csr.h (100%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/pinctrl_soc.h (100%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/soc.c (100%) rename soc/riscv/{gd_gd32 => riscv-privileged}/gd32vf103/soc.h (100%) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 255f6cefa2c..a36838cd65d 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -2472,7 +2472,7 @@ GD32 Platforms: - dts/*/gigadevice/ - dts/bindings/*/*gd32* - soc/arm/gigadevice/ - - soc/riscv/gd_gd32/ + - soc/riscv/riscv-privileged/gd32vf103/ - scripts/west_commands/*/*gd32* labels: - "platform: GD32" diff --git a/soc/riscv/gd_gd32/CMakeLists.txt b/soc/riscv/gd_gd32/CMakeLists.txt deleted file mode 100644 index 69b2926358e..00000000000 --- a/soc/riscv/gd_gd32/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/gd_gd32/Kconfig b/soc/riscv/gd_gd32/Kconfig deleted file mode 100644 index 46f2dd0b1d6..00000000000 --- a/soc/riscv/gd_gd32/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_GD32 - bool - -if SOC_FAMILY_GD32 - -config SOC_FAMILY - string - default "gd_gd32" - -source "soc/riscv/gd_gd32/*/Kconfig.soc" - -endif # SOC_FAMILY_GIGADEVICE_GD32 diff --git a/soc/riscv/gd_gd32/Kconfig.defconfig b/soc/riscv/gd_gd32/Kconfig.defconfig deleted file mode 100644 index 2be284db7ea..00000000000 --- a/soc/riscv/gd_gd32/Kconfig.defconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/gd_gd32/*/Kconfig.defconfig.series" diff --git a/soc/riscv/gd_gd32/Kconfig.soc b/soc/riscv/gd_gd32/Kconfig.soc deleted file mode 100644 index 09d7d5d627e..00000000000 --- a/soc/riscv/gd_gd32/Kconfig.soc +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/gd_gd32/*/Kconfig.series" diff --git a/soc/riscv/gd_gd32/gd32vf103/CMakeLists.txt b/soc/riscv/riscv-privileged/gd32vf103/CMakeLists.txt similarity index 100% rename from soc/riscv/gd_gd32/gd32vf103/CMakeLists.txt rename to soc/riscv/riscv-privileged/gd32vf103/CMakeLists.txt diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.gd32vf103 similarity index 100% rename from soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103 rename to soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.gd32vf103 diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.series similarity index 72% rename from soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.series rename to soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.series index 17ab7a87c39..061b53b2514 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.series +++ b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.series @@ -3,7 +3,7 @@ if SOC_SERIES_GD32VF103 -source "soc/riscv/gd_gd32/gd32vf103/Kconfig.defconfig.gd32vf103*" +source "soc/riscv/riscv-privileged/gd32vf103/Kconfig.defconfig.gd32vf103*" config SOC_SERIES default "gd32vf103" diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.series b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series similarity index 89% rename from soc/riscv/gd_gd32/gd32vf103/Kconfig.series rename to soc/riscv/riscv-privileged/gd32vf103/Kconfig.series index b0b86db7c02..79bb3690743 100644 --- a/soc/riscv/gd_gd32/gd32vf103/Kconfig.series +++ b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series @@ -15,7 +15,6 @@ config SOC_SERIES_GD32VF103 select GD32_HAS_IRC_40K select HAS_GD32_HAL select RISCV_HAS_CLIC - select SOC_FAMILY_GD32 - select RISCV_PRIVILEGED_STANDALONE + help Enable support for GigaDevice GD32VF1 series SoC diff --git a/soc/riscv/gd_gd32/gd32vf103/Kconfig.soc b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.soc similarity index 100% rename from soc/riscv/gd_gd32/gd32vf103/Kconfig.soc rename to soc/riscv/riscv-privileged/gd32vf103/Kconfig.soc diff --git a/soc/riscv/gd_gd32/gd32vf103/entry.S b/soc/riscv/riscv-privileged/gd32vf103/entry.S similarity index 100% rename from soc/riscv/gd_gd32/gd32vf103/entry.S rename to soc/riscv/riscv-privileged/gd32vf103/entry.S diff --git a/soc/riscv/gd_gd32/gd32vf103/gd32_regs.h b/soc/riscv/riscv-privileged/gd32vf103/gd32_regs.h similarity index 100% rename from soc/riscv/gd_gd32/gd32vf103/gd32_regs.h rename to soc/riscv/riscv-privileged/gd32vf103/gd32_regs.h diff --git a/soc/riscv/gd_gd32/gd32vf103/nuclei_csr.h b/soc/riscv/riscv-privileged/gd32vf103/nuclei_csr.h similarity index 100% rename from soc/riscv/gd_gd32/gd32vf103/nuclei_csr.h rename to soc/riscv/riscv-privileged/gd32vf103/nuclei_csr.h diff --git a/soc/riscv/gd_gd32/gd32vf103/pinctrl_soc.h b/soc/riscv/riscv-privileged/gd32vf103/pinctrl_soc.h similarity index 100% rename from soc/riscv/gd_gd32/gd32vf103/pinctrl_soc.h rename to soc/riscv/riscv-privileged/gd32vf103/pinctrl_soc.h diff --git a/soc/riscv/gd_gd32/gd32vf103/soc.c b/soc/riscv/riscv-privileged/gd32vf103/soc.c similarity index 100% rename from soc/riscv/gd_gd32/gd32vf103/soc.c rename to soc/riscv/riscv-privileged/gd32vf103/soc.c diff --git a/soc/riscv/gd_gd32/gd32vf103/soc.h b/soc/riscv/riscv-privileged/gd32vf103/soc.h similarity index 100% rename from soc/riscv/gd_gd32/gd32vf103/soc.h rename to soc/riscv/riscv-privileged/gd32vf103/soc.h From 21dbddf9fb7ca3255a22be52dff7dba18deba2c7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:36 +0100 Subject: [PATCH 1103/2300] Revert "[nrf fromtree] soc: riscv: telink_b91: reorganize SoC folder" This reverts commit 1270903d32f0a4598f2169b4ce83f9cf39947f65. Signed-off-by: Robert Lubos --- boards/riscv/tlsr9518adk80d/Kconfig.board | 2 +- .../tlsr9518adk80d/tlsr9518adk80d_defconfig | 4 +- .../telink_b91}/CMakeLists.txt | 0 .../telink_b91}/Kconfig.defconfig.series | 8 ++-- .../telink_b91}/Kconfig.series | 11 ++--- .../riscv-privileged/telink_b91/Kconfig.soc | 40 +++++++++++++++++++ .../telink_b91}/init.ld | 0 .../telink_b91}/linker.ld | 0 .../telink_b91}/pinctrl_soc.h | 0 .../telink_b91}/soc.c | 0 .../telink_b91}/soc.h | 0 .../telink_b91}/soc_context.h | 0 .../telink_b91}/soc_irq.S | 0 .../telink_b91}/soc_offsets.h | 0 .../telink_b91}/start.S | 0 soc/riscv/telink_tlsr/CMakeLists.txt | 4 -- soc/riscv/telink_tlsr/Kconfig | 15 ------- soc/riscv/telink_tlsr/Kconfig.defconfig | 4 -- soc/riscv/telink_tlsr/Kconfig.soc | 4 -- .../tlsr951x/Kconfig.defconfig.tlsr9518 | 5 --- soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc | 23 ----------- 21 files changed, 49 insertions(+), 71 deletions(-) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/CMakeLists.txt (100%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/Kconfig.defconfig.series (81%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/Kconfig.series (55%) create mode 100644 soc/riscv/riscv-privileged/telink_b91/Kconfig.soc rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/init.ld (100%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/linker.ld (100%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/pinctrl_soc.h (100%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/soc.c (100%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/soc.h (100%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/soc_context.h (100%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/soc_irq.S (100%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/soc_offsets.h (100%) rename soc/riscv/{telink_tlsr/tlsr951x => riscv-privileged/telink_b91}/start.S (100%) delete mode 100644 soc/riscv/telink_tlsr/CMakeLists.txt delete mode 100644 soc/riscv/telink_tlsr/Kconfig delete mode 100644 soc/riscv/telink_tlsr/Kconfig.defconfig delete mode 100644 soc/riscv/telink_tlsr/Kconfig.soc delete mode 100644 soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr9518 delete mode 100644 soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc diff --git a/boards/riscv/tlsr9518adk80d/Kconfig.board b/boards/riscv/tlsr9518adk80d/Kconfig.board index 971b34dc13b..bd36cb0e481 100644 --- a/boards/riscv/tlsr9518adk80d/Kconfig.board +++ b/boards/riscv/tlsr9518adk80d/Kconfig.board @@ -3,4 +3,4 @@ config BOARD_TLSR9518ADK80D bool "Telink B91 Platform" - depends on SOC_TELINK_TLSR9518 + depends on SOC_RISCV_TELINK_B91 diff --git a/boards/riscv/tlsr9518adk80d/tlsr9518adk80d_defconfig b/boards/riscv/tlsr9518adk80d/tlsr9518adk80d_defconfig index c4cfdfea718..fe5cfbe8c2e 100644 --- a/boards/riscv/tlsr9518adk80d/tlsr9518adk80d_defconfig +++ b/boards/riscv/tlsr9518adk80d/tlsr9518adk80d_defconfig @@ -1,8 +1,8 @@ # Copyright (c) 2021 Telink Semiconductor # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_SERIES_TELINK_TLSR951X=y -CONFIG_SOC_TELINK_TLSR9518=y +CONFIG_SOC_SERIES_RISCV_TELINK_B91=y +CONFIG_SOC_RISCV_TELINK_B91=y CONFIG_BOARD_TLSR9518ADK80D=y CONFIG_GPIO=y CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 diff --git a/soc/riscv/telink_tlsr/tlsr951x/CMakeLists.txt b/soc/riscv/riscv-privileged/telink_b91/CMakeLists.txt similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/CMakeLists.txt rename to soc/riscv/riscv-privileged/telink_b91/CMakeLists.txt diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/telink_b91/Kconfig.defconfig.series similarity index 81% rename from soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series rename to soc/riscv/riscv-privileged/telink_b91/Kconfig.defconfig.series index 23a78c9f0da..986b6240750 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.series +++ b/soc/riscv/riscv-privileged/telink_b91/Kconfig.defconfig.series @@ -1,11 +1,11 @@ # Copyright (c) 2021 Telink Semiconductor # SPDX-License-Identifier: Apache-2.0 -if SOC_SERIES_TELINK_TLSR951X +if SOC_SERIES_RISCV_TELINK_B91 config SOC_SERIES string - default "tlsr951x" + default "telink_b91" config SYS_CLOCK_HW_CYCLES_PER_SEC int @@ -56,6 +56,4 @@ config 2ND_LVL_INTR_00_OFFSET config HAS_FLASH_LOAD_OFFSET default y if BOOTLOADER_MCUBOOT -source "soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr*" - -endif # SOC_SERIES_TELINK_TLSR951X +endif # SOC_SERIES_RISCV_TELINK_B91 diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series b/soc/riscv/riscv-privileged/telink_b91/Kconfig.series similarity index 55% rename from soc/riscv/telink_tlsr/tlsr951x/Kconfig.series rename to soc/riscv/riscv-privileged/telink_b91/Kconfig.series index e074a53e11b..cce6011ce68 100644 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.series +++ b/soc/riscv/riscv-privileged/telink_b91/Kconfig.series @@ -1,8 +1,8 @@ # Copyright (c) 2021 Telink Semiconductor # SPDX-License-Identifier: Apache-2.0 -config SOC_SERIES_TELINK_TLSR951X - bool "Telink TLSR951X" +config SOC_SERIES_RISCV_TELINK_B91 + bool "Telink B91 SoC Implementation" select RISCV select RISCV_ISA_RV32I select RISCV_ISA_EXT_M @@ -12,10 +12,5 @@ config SOC_SERIES_TELINK_TLSR951X select RISCV_ISA_EXT_ZIFENCEI select RISCV_PRIVILEGED select HAS_TELINK_DRIVERS - select ATOMIC_OPERATIONS_BUILTIN - select CPU_HAS_FPU - select INCLUDE_RESET_VECTOR - select SOC_FAMILY_TELINK_TLSR - select RISCV_PRIVILEGED_STANDALONE help - Enable support for Telink TLSR951X + Enable support for Telink B91 SoC diff --git a/soc/riscv/riscv-privileged/telink_b91/Kconfig.soc b/soc/riscv/riscv-privileged/telink_b91/Kconfig.soc new file mode 100644 index 00000000000..3f4f96c332e --- /dev/null +++ b/soc/riscv/riscv-privileged/telink_b91/Kconfig.soc @@ -0,0 +1,40 @@ +# Copyright (c) 2021 Telink Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +choice +prompt "CPU Architecture of SoC" +depends on SOC_SERIES_RISCV_TELINK_B91 + +config B91_CPU_RISCV32 + bool "RISCV32 CPU Architecture" + select RISCV_ISA_RV32I + select RISCV_ISA_EXT_M + select RISCV_ISA_EXT_A + select RISCV_ISA_EXT_C + select RISCV_ISA_EXT_ZICSR + select RISCV_ISA_EXT_ZIFENCEI + +endchoice + +config TELINK_B91_HWDSP + bool "Support Hardware DSP" + select RISCV_SOC_CONTEXT_SAVE + depends on SOC_SERIES_RISCV_TELINK_B91 + +config TELINK_B91_PFT_ARCH + bool "Support performance throttling" + default y + select RISCV_SOC_CONTEXT_SAVE + depends on SOC_SERIES_RISCV_TELINK_B91 + +choice +prompt "Telink B91 SoC implementation" +depends on SOC_SERIES_RISCV_TELINK_B91 + +config SOC_RISCV_TELINK_B91 + bool "Telink B91 SoC implementation" + select ATOMIC_OPERATIONS_BUILTIN + select CPU_HAS_FPU + select INCLUDE_RESET_VECTOR + +endchoice diff --git a/soc/riscv/telink_tlsr/tlsr951x/init.ld b/soc/riscv/riscv-privileged/telink_b91/init.ld similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/init.ld rename to soc/riscv/riscv-privileged/telink_b91/init.ld diff --git a/soc/riscv/telink_tlsr/tlsr951x/linker.ld b/soc/riscv/riscv-privileged/telink_b91/linker.ld similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/linker.ld rename to soc/riscv/riscv-privileged/telink_b91/linker.ld diff --git a/soc/riscv/telink_tlsr/tlsr951x/pinctrl_soc.h b/soc/riscv/riscv-privileged/telink_b91/pinctrl_soc.h similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/pinctrl_soc.h rename to soc/riscv/riscv-privileged/telink_b91/pinctrl_soc.h diff --git a/soc/riscv/telink_tlsr/tlsr951x/soc.c b/soc/riscv/riscv-privileged/telink_b91/soc.c similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/soc.c rename to soc/riscv/riscv-privileged/telink_b91/soc.c diff --git a/soc/riscv/telink_tlsr/tlsr951x/soc.h b/soc/riscv/riscv-privileged/telink_b91/soc.h similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/soc.h rename to soc/riscv/riscv-privileged/telink_b91/soc.h diff --git a/soc/riscv/telink_tlsr/tlsr951x/soc_context.h b/soc/riscv/riscv-privileged/telink_b91/soc_context.h similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/soc_context.h rename to soc/riscv/riscv-privileged/telink_b91/soc_context.h diff --git a/soc/riscv/telink_tlsr/tlsr951x/soc_irq.S b/soc/riscv/riscv-privileged/telink_b91/soc_irq.S similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/soc_irq.S rename to soc/riscv/riscv-privileged/telink_b91/soc_irq.S diff --git a/soc/riscv/telink_tlsr/tlsr951x/soc_offsets.h b/soc/riscv/riscv-privileged/telink_b91/soc_offsets.h similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/soc_offsets.h rename to soc/riscv/riscv-privileged/telink_b91/soc_offsets.h diff --git a/soc/riscv/telink_tlsr/tlsr951x/start.S b/soc/riscv/riscv-privileged/telink_b91/start.S similarity index 100% rename from soc/riscv/telink_tlsr/tlsr951x/start.S rename to soc/riscv/riscv-privileged/telink_b91/start.S diff --git a/soc/riscv/telink_tlsr/CMakeLists.txt b/soc/riscv/telink_tlsr/CMakeLists.txt deleted file mode 100644 index 69b2926358e..00000000000 --- a/soc/riscv/telink_tlsr/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/telink_tlsr/Kconfig b/soc/riscv/telink_tlsr/Kconfig deleted file mode 100644 index 144751311ba..00000000000 --- a/soc/riscv/telink_tlsr/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_TELINK_TLSR - bool - -if SOC_FAMILY_TELINK_TLSR - -config SOC_FAMILY - string - default "telink_tlsr" - -source "soc/riscv/telink_tlsr/*/Kconfig.soc" - -endif # SOC_FAMILY_TELINK_TLSR diff --git a/soc/riscv/telink_tlsr/Kconfig.defconfig b/soc/riscv/telink_tlsr/Kconfig.defconfig deleted file mode 100644 index 04a888381fa..00000000000 --- a/soc/riscv/telink_tlsr/Kconfig.defconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/telink_tlsr/*/Kconfig.defconfig.series" diff --git a/soc/riscv/telink_tlsr/Kconfig.soc b/soc/riscv/telink_tlsr/Kconfig.soc deleted file mode 100644 index db09c69d1f4..00000000000 --- a/soc/riscv/telink_tlsr/Kconfig.soc +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "soc/riscv/telink_tlsr/*/Kconfig.series" diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr9518 b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr9518 deleted file mode 100644 index 4ffdebdaf6b..00000000000 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.defconfig.tlsr9518 +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC - default "tlsr9518" if SOC_TELINK_TLSR9518 diff --git a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc b/soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc deleted file mode 100644 index 2abc12cc58c..00000000000 --- a/soc/riscv/telink_tlsr/tlsr951x/Kconfig.soc +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2021 Telink Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -if SOC_SERIES_TELINK_TLSR951X - -choice - prompt "Telink TLSR951X SoC implementation" - -config SOC_TELINK_TLSR9518 - bool "Telink TLSR9518" - -endchoice - -config TELINK_B91_HWDSP - bool "Support Hardware DSP" - select RISCV_SOC_CONTEXT_SAVE - -config TELINK_B91_PFT_ARCH - bool "Support performance throttling" - default y - select RISCV_SOC_CONTEXT_SAVE - -endif # SOC_SERIES_TELINK_TLSR951X From 16824bab524048b9dff473d1d2a2ff6979474eea Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:36 +0100 Subject: [PATCH 1104/2300] Revert "[nrf fromtree] soc: riscv: introduce temporary RISCV_PRIVILEGED_STANDALONE" This reverts commit 5effef88cfdc66a9c0e8253ab961d48540dc9828. Signed-off-by: Robert Lubos --- soc/riscv/common/riscv-privileged/Kconfig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index de064842604..526dea4bbfb 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -4,12 +4,9 @@ # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 -config RISCV_PRIVILEGED_STANDALONE - bool - config SOC_FAMILY string - default "riscv-privileged" if RISCV_PRIVILEGED && !RISCV_PRIVILEGED_STANDALONE + default "riscv-privileged" if RISCV_PRIVILEGED config RISCV_HAS_PLIC bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" From aa225b7e526e690d6cc154da9268e102a42b7926 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:36 +0100 Subject: [PATCH 1105/2300] Revert "[nrf fromtree] arch: riscv: introduce RISCV_PRIVILEGED" This reverts commit 61f8380f5404337122b30dbb0ea0172c0222f4e9. Signed-off-by: Robert Lubos --- arch/riscv/Kconfig | 8 +------- drivers/interrupt_controller/intc_plic.c | 4 ++-- include/zephyr/arch/riscv/arch.h | 2 +- soc/riscv/common/CMakeLists.txt | 2 +- soc/riscv/common/riscv-privileged/Kconfig | 17 +++++++++++++---- .../riscv-privileged/andes_v5/Kconfig.series | 2 +- .../efinix-sapphire/Kconfig.series | 2 +- .../riscv-privileged/gd32vf103/Kconfig.series | 2 +- soc/riscv/riscv-privileged/miv/Kconfig.series | 2 +- soc/riscv/riscv-privileged/mpfs/Kconfig.series | 2 +- .../riscv-privileged/neorv32/Kconfig.series | 2 +- soc/riscv/riscv-privileged/niosv/Kconfig.series | 2 +- .../riscv-privileged/opentitan/Kconfig.series | 2 +- .../sifive-freedom/Kconfig.series | 2 +- .../starfive_jh71xx/Kconfig.series | 2 +- .../riscv-privileged/telink_b91/Kconfig.series | 2 +- soc/riscv/riscv-privileged/virt/Kconfig.series | 2 +- tests/kernel/gen_isr_table/testcase.yaml | 8 ++++---- 18 files changed, 34 insertions(+), 31 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 80249670d09..a1cefcbdf43 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -47,12 +47,6 @@ config INCLUDE_RESET_VECTOR Include the reset vector stub, which initializes the stack and prepares for running C code. -config RISCV_PRIVILEGED - bool - select ARCH_HAS_RAMFUNC_SUPPORT if XIP - help - Option selected by SoCs implementing the RISC-V privileged ISA. - config RISCV_SOC_HAS_ISR_STACKING bool depends on !USERSPACE @@ -339,7 +333,7 @@ config RISCV_TRAP_HANDLER_ALIGNMENT The minimum alignment is 4 bytes according to the Spec. config GEN_IRQ_VECTOR_TABLE - select RISCV_VECTORED_MODE if RISCV_PRIVILEGED + select RISCV_VECTORED_MODE if SOC_FAMILY_RISCV_PRIVILEGED config ARCH_HAS_SINGLE_THREAD_SUPPORT default y if !SMP diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index 211a6f11041..51ce1769396 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -135,7 +135,7 @@ static int riscv_plic_is_edge_irq(const struct device *dev, uint32_t local_irq) * @brief Enable a riscv PLIC-specific interrupt line * * This routine enables a RISCV PLIC-specific interrupt line. - * riscv_plic_irq_enable is called by RISCV_PRIVILEGED + * riscv_plic_irq_enable is called by SOC_FAMILY_RISCV_PRIVILEGED * arch_irq_enable function to enable external interrupts for * IRQS level == 2, whenever CONFIG_RISCV_HAS_PLIC variable is set. * @@ -161,7 +161,7 @@ void riscv_plic_irq_enable(uint32_t irq) * @brief Disable a riscv PLIC-specific interrupt line * * This routine disables a RISCV PLIC-specific interrupt line. - * riscv_plic_irq_disable is called by RISCV_PRIVILEGED + * riscv_plic_irq_disable is called by SOC_FAMILY_RISCV_PRIVILEGED * arch_irq_disable function to disable external interrupts, for * IRQS level == 2, whenever CONFIG_RISCV_HAS_PLIC variable is set. * diff --git a/include/zephyr/arch/riscv/arch.h b/include/zephyr/arch/riscv/arch.h index 1ab509c162e..99bccb74a08 100644 --- a/include/zephyr/arch/riscv/arch.h +++ b/include/zephyr/arch/riscv/arch.h @@ -300,7 +300,7 @@ static inline uint64_t arch_k_cycle_get_64(void) #endif /*_ASMLANGUAGE */ -#if defined(CONFIG_RISCV_PRIVILEGED) +#if defined(CONFIG_SOC_FAMILY_RISCV_PRIVILEGED) #include #endif diff --git a/soc/riscv/common/CMakeLists.txt b/soc/riscv/common/CMakeLists.txt index 91ef5c975b9..9102b32a45f 100644 --- a/soc/riscv/common/CMakeLists.txt +++ b/soc/riscv/common/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory_ifdef(CONFIG_RISCV_PRIVILEGED riscv-privileged) +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_RISCV_PRIVILEGED riscv-privileged) diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig index 526dea4bbfb..6bc12b46c5a 100644 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ b/soc/riscv/common/riscv-privileged/Kconfig @@ -4,24 +4,33 @@ # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 +config SOC_FAMILY_RISCV_PRIVILEGE + bool + select DEPRECATED + +config SOC_FAMILY_RISCV_PRIVILEGED + bool + select ARCH_HAS_RAMFUNC_SUPPORT if XIP + config SOC_FAMILY string - default "riscv-privileged" if RISCV_PRIVILEGED + default "riscv-privileged" + depends on SOC_FAMILY_RISCV_PRIVILEGED config RISCV_HAS_PLIC bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" - depends on RISCV_PRIVILEGED + depends on SOC_FAMILY_RISCV_PRIVILEGED help Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). config RISCV_HAS_CLIC bool "Does the SOC provide support for a Core-Local Interrupt Controller (CLIC)" - depends on RISCV_PRIVILEGED + depends on SOC_FAMILY_RISCV_PRIVILEGED help Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). config RISCV_VECTORED_MODE bool "Should the SOC use vectored mode" - depends on RISCV_PRIVILEGED + depends on SOC_FAMILY_RISCV_PRIVILEGED help Should the SOC use vectored mode. diff --git a/soc/riscv/riscv-privileged/andes_v5/Kconfig.series b/soc/riscv/riscv-privileged/andes_v5/Kconfig.series index a85c521492b..9a99711b04c 100644 --- a/soc/riscv/riscv-privileged/andes_v5/Kconfig.series +++ b/soc/riscv/riscv-privileged/andes_v5/Kconfig.series @@ -4,6 +4,6 @@ config SOC_SERIES_RISCV_ANDES_V5 bool "Andes V5 SoC Series Implementation" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED help Enable support for Andes V5 SoC Series diff --git a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series index 421d81a7e33..8505cf1318a 100644 --- a/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series +++ b/soc/riscv/riscv-privileged/efinix-sapphire/Kconfig.series @@ -4,6 +4,6 @@ config SOC_SERIES_EFINIX_SAPPHIRE bool "Efinix Sapphire SOC implementation" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED help Enable support for Efinix Sapphire SOC implementation diff --git a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series index 79bb3690743..3922bf19bdd 100644 --- a/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series +++ b/soc/riscv/riscv-privileged/gd32vf103/Kconfig.series @@ -6,7 +6,7 @@ config SOC_SERIES_GD32VF103 bool "GigaDevice GD32VF103 series SoC implementation" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED select ATOMIC_OPERATIONS_C select INCLUDE_RESET_VECTOR select BUILD_OUTPUT_HEX diff --git a/soc/riscv/riscv-privileged/miv/Kconfig.series b/soc/riscv/riscv-privileged/miv/Kconfig.series index 017de686a94..00a6f129f9f 100644 --- a/soc/riscv/riscv-privileged/miv/Kconfig.series +++ b/soc/riscv/riscv-privileged/miv/Kconfig.series @@ -6,6 +6,6 @@ config SOC_SERIES_RISCV32_MIV bool "Microchip Mi-V implementation" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED help Enable support for Microchip Mi-V diff --git a/soc/riscv/riscv-privileged/mpfs/Kconfig.series b/soc/riscv/riscv-privileged/mpfs/Kconfig.series index 3b30cd15365..ca37731f192 100644 --- a/soc/riscv/riscv-privileged/mpfs/Kconfig.series +++ b/soc/riscv/riscv-privileged/mpfs/Kconfig.series @@ -6,6 +6,6 @@ config SOC_SERIES_RISCV64_MIV bool "Microchip RV64 implementation" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED help Enable support for Microchip RISCV 64bit diff --git a/soc/riscv/riscv-privileged/neorv32/Kconfig.series b/soc/riscv/riscv-privileged/neorv32/Kconfig.series index 0f8f9ca8fd4..98c7f34024d 100644 --- a/soc/riscv/riscv-privileged/neorv32/Kconfig.series +++ b/soc/riscv/riscv-privileged/neorv32/Kconfig.series @@ -9,7 +9,7 @@ config SOC_SERIES_NEORV32 select RISCV_ISA_EXT_A select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED help Enable support for the NEORV32 Processor (SoC). diff --git a/soc/riscv/riscv-privileged/niosv/Kconfig.series b/soc/riscv/riscv-privileged/niosv/Kconfig.series index 104f5a48352..7de17cf2db0 100644 --- a/soc/riscv/riscv-privileged/niosv/Kconfig.series +++ b/soc/riscv/riscv-privileged/niosv/Kconfig.series @@ -4,6 +4,6 @@ config SOC_SERIES_NIOSV bool "INTEL FPGA NIOSV" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED help Enable support for the INTEL FPGA NIOSV. diff --git a/soc/riscv/riscv-privileged/opentitan/Kconfig.series b/soc/riscv/riscv-privileged/opentitan/Kconfig.series index b516e6d8092..f8bbc2840fe 100644 --- a/soc/riscv/riscv-privileged/opentitan/Kconfig.series +++ b/soc/riscv/riscv-privileged/opentitan/Kconfig.series @@ -4,7 +4,7 @@ config SOC_SERIES_RISCV_OPENTITAN bool "OpenTitan implementation" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED # OpenTitan Ibex core mtvec mode is read-only / forced to vectored mode. select RISCV_VECTORED_MODE select GEN_IRQ_VECTOR_TABLE diff --git a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series index a24b4812c28..523f6a4ffe9 100644 --- a/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series +++ b/soc/riscv/riscv-privileged/sifive-freedom/Kconfig.series @@ -6,6 +6,6 @@ config SOC_SERIES_RISCV_SIFIVE_FREEDOM bool "SiFive Freedom SOC implementation" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED help Enable support for SiFive Freedom SOC diff --git a/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series b/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series index 19cedcefe27..b360f78b77b 100644 --- a/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series +++ b/soc/riscv/riscv-privileged/starfive_jh71xx/Kconfig.series @@ -4,6 +4,6 @@ config SOC_SERIES_STARFIVE_JH71XX bool "Starfive JH71XX series" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED help Enable support for Starfive JH71XX SoC Series. diff --git a/soc/riscv/riscv-privileged/telink_b91/Kconfig.series b/soc/riscv/riscv-privileged/telink_b91/Kconfig.series index cce6011ce68..a966dfe447b 100644 --- a/soc/riscv/riscv-privileged/telink_b91/Kconfig.series +++ b/soc/riscv/riscv-privileged/telink_b91/Kconfig.series @@ -10,7 +10,7 @@ config SOC_SERIES_RISCV_TELINK_B91 select RISCV_ISA_EXT_C select RISCV_ISA_EXT_ZICSR select RISCV_ISA_EXT_ZIFENCEI - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED select HAS_TELINK_DRIVERS help Enable support for Telink B91 SoC diff --git a/soc/riscv/riscv-privileged/virt/Kconfig.series b/soc/riscv/riscv-privileged/virt/Kconfig.series index 44ec681a308..e9846764f6b 100644 --- a/soc/riscv/riscv-privileged/virt/Kconfig.series +++ b/soc/riscv/riscv-privileged/virt/Kconfig.series @@ -4,4 +4,4 @@ config SOC_SERIES_RISCV_VIRT bool "QEMU RISC-V VirtIO Board" select RISCV - select RISCV_PRIVILEGED + select SOC_FAMILY_RISCV_PRIVILEGED diff --git a/tests/kernel/gen_isr_table/testcase.yaml b/tests/kernel/gen_isr_table/testcase.yaml index 4ee3ad00ac9..cd8c95e2584 100644 --- a/tests/kernel/gen_isr_table/testcase.yaml +++ b/tests/kernel/gen_isr_table/testcase.yaml @@ -53,7 +53,7 @@ tests: platform_exclude: - m2gl025_miv - adp_xc7k_ae350 - filter: CONFIG_RISCV_PRIVILEGED + filter: CONFIG_SOC_FAMILY_RISCV_PRIVILEGED extra_configs: - CONFIG_GEN_IRQ_VECTOR_TABLE=y arch.interrupt.gen_isr_table.riscv_no_direct: @@ -61,18 +61,18 @@ tests: arch_allow: - riscv32 - riscv64 - filter: CONFIG_RISCV_PRIVILEGED + filter: CONFIG_SOC_FAMILY_RISCV_PRIVILEGED extra_configs: - CONFIG_GEN_IRQ_VECTOR_TABLE=n arch.interrupt.gen_isr_table.bit_shift_2nd_level: platform_allow: qemu_riscv32 - filter: CONFIG_RISCV_PRIVILEGED + filter: CONFIG_SOC_FAMILY_RISCV_PRIVILEGED extra_configs: - CONFIG_1ST_LEVEL_INTERRUPT_BITS=10 - CONFIG_2ND_LEVEL_INTERRUPT_BITS=10 arch.interrupt.gen_isr_table.bit_shift_3rd_level: platform_allow: qemu_riscv32 - filter: CONFIG_RISCV_PRIVILEGED + filter: CONFIG_SOC_FAMILY_RISCV_PRIVILEGED extra_configs: - CONFIG_MULTI_LEVEL_INTERRUPTS=y - CONFIG_2ND_LEVEL_INTERRUPTS=y From 21df61e6891c528654c1b4a5a41ae3a1e7fd9bb9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:37 +0100 Subject: [PATCH 1106/2300] Revert "[nrf fromtree] soc: riscv: gd32vf103: move nuclei CSR header" This reverts commit 24df39abb916d27254b8fcc80c3bc8583705750b. Signed-off-by: Robert Lubos --- .../gd32vf103 => common/riscv-privileged/nuclei}/nuclei_csr.h | 0 soc/riscv/riscv-privileged/gd32vf103/entry.S | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) rename soc/riscv/{riscv-privileged/gd32vf103 => common/riscv-privileged/nuclei}/nuclei_csr.h (100%) diff --git a/soc/riscv/riscv-privileged/gd32vf103/nuclei_csr.h b/soc/riscv/common/riscv-privileged/nuclei/nuclei_csr.h similarity index 100% rename from soc/riscv/riscv-privileged/gd32vf103/nuclei_csr.h rename to soc/riscv/common/riscv-privileged/nuclei/nuclei_csr.h diff --git a/soc/riscv/riscv-privileged/gd32vf103/entry.S b/soc/riscv/riscv-privileged/gd32vf103/entry.S index 41cc6cc686b..5f8af0d691f 100644 --- a/soc/riscv/riscv-privileged/gd32vf103/entry.S +++ b/soc/riscv/riscv-privileged/gd32vf103/entry.S @@ -4,10 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "nuclei_csr.h" - #include #include +#include GTEXT(__nuclei_start) SECTION_FUNC(vectors, __nuclei_start) From 3a706ae09ec017af293bdba8e58d46b42679352c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:37 +0100 Subject: [PATCH 1107/2300] Revert "[nrf fromtree] soc: riscv: move privileged code to common folder" This reverts commit 773b977cc015ee925707dff71c1118e64754b79c. Signed-off-by: Robert Lubos --- soc/riscv/CMakeLists.txt | 2 -- soc/riscv/common/CMakeLists.txt | 1 - soc/riscv/common/Kconfig | 4 --- soc/riscv/common/riscv-privileged/Kconfig | 36 ------------------- soc/riscv/litex-vexriscv/CMakeLists.txt | 4 +-- soc/riscv/litex-vexriscv/soc.h | 2 +- soc/riscv/riscv-privileged/CMakeLists.txt | 1 + soc/riscv/riscv-privileged/Kconfig | 34 ++++++++++++++++++ .../common}/CMakeLists.txt | 0 .../common}/idle.c | 0 .../common}/nuclei/nuclei_csr.h | 0 .../common}/soc_common.h | 0 .../common}/soc_common_irq.c | 0 .../common}/soc_irq.S | 0 .../common}/vector.S | 0 15 files changed, 38 insertions(+), 46 deletions(-) delete mode 100644 soc/riscv/common/CMakeLists.txt delete mode 100644 soc/riscv/common/Kconfig delete mode 100644 soc/riscv/common/riscv-privileged/Kconfig rename soc/riscv/{common/riscv-privileged => riscv-privileged/common}/CMakeLists.txt (100%) rename soc/riscv/{common/riscv-privileged => riscv-privileged/common}/idle.c (100%) rename soc/riscv/{common/riscv-privileged => riscv-privileged/common}/nuclei/nuclei_csr.h (100%) rename soc/riscv/{common/riscv-privileged => riscv-privileged/common}/soc_common.h (100%) rename soc/riscv/{common/riscv-privileged => riscv-privileged/common}/soc_common_irq.c (100%) rename soc/riscv/{common/riscv-privileged => riscv-privileged/common}/soc_irq.S (100%) rename soc/riscv/{common/riscv-privileged => riscv-privileged/common}/vector.S (100%) diff --git a/soc/riscv/CMakeLists.txt b/soc/riscv/CMakeLists.txt index 79d115704b2..b826da926ca 100644 --- a/soc/riscv/CMakeLists.txt +++ b/soc/riscv/CMakeLists.txt @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -add_subdirectory(common) - if(SOC_FAMILY) add_subdirectory(${SOC_FAMILY}) else() diff --git a/soc/riscv/common/CMakeLists.txt b/soc/riscv/common/CMakeLists.txt deleted file mode 100644 index 9102b32a45f..00000000000 --- a/soc/riscv/common/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory_ifdef(CONFIG_SOC_FAMILY_RISCV_PRIVILEGED riscv-privileged) diff --git a/soc/riscv/common/Kconfig b/soc/riscv/common/Kconfig deleted file mode 100644 index 91f2c5cf80a..00000000000 --- a/soc/riscv/common/Kconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 -# -source "soc/riscv/common/riscv-privileged/Kconfig" diff --git a/soc/riscv/common/riscv-privileged/Kconfig b/soc/riscv/common/riscv-privileged/Kconfig deleted file mode 100644 index 6bc12b46c5a..00000000000 --- a/soc/riscv/common/riscv-privileged/Kconfig +++ /dev/null @@ -1,36 +0,0 @@ -# Configuration options for riscv SOCs supporting the riscv privileged -# architecture specification - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FAMILY_RISCV_PRIVILEGE - bool - select DEPRECATED - -config SOC_FAMILY_RISCV_PRIVILEGED - bool - select ARCH_HAS_RAMFUNC_SUPPORT if XIP - -config SOC_FAMILY - string - default "riscv-privileged" - depends on SOC_FAMILY_RISCV_PRIVILEGED - -config RISCV_HAS_PLIC - bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" - depends on SOC_FAMILY_RISCV_PRIVILEGED - help - Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). - -config RISCV_HAS_CLIC - bool "Does the SOC provide support for a Core-Local Interrupt Controller (CLIC)" - depends on SOC_FAMILY_RISCV_PRIVILEGED - help - Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). - -config RISCV_VECTORED_MODE - bool "Should the SOC use vectored mode" - depends on SOC_FAMILY_RISCV_PRIVILEGED - help - Should the SOC use vectored mode. diff --git a/soc/riscv/litex-vexriscv/CMakeLists.txt b/soc/riscv/litex-vexriscv/CMakeLists.txt index 98386f6b57a..9d100ea0e2a 100644 --- a/soc/riscv/litex-vexriscv/CMakeLists.txt +++ b/soc/riscv/litex-vexriscv/CMakeLists.txt @@ -5,8 +5,8 @@ # zephyr_sources( - ../common/riscv-privileged/soc_irq.S - ../common/riscv-privileged/vector.S + ../riscv-privileged/common/soc_irq.S + ../riscv-privileged/common/vector.S ) set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/litex-vexriscv/soc.h b/soc/riscv/litex-vexriscv/soc.h index b3521b51e8e..b738deec771 100644 --- a/soc/riscv/litex-vexriscv/soc.h +++ b/soc/riscv/litex-vexriscv/soc.h @@ -7,7 +7,7 @@ #ifndef __RISCV32_LITEX_VEXRISCV_SOC_H_ #define __RISCV32_LITEX_VEXRISCV_SOC_H_ -#include "../common/riscv-privileged/soc_common.h" +#include "../riscv-privileged/common/soc_common.h" #include #include diff --git a/soc/riscv/riscv-privileged/CMakeLists.txt b/soc/riscv/riscv-privileged/CMakeLists.txt index 226f3bd626f..c5f97039eb7 100644 --- a/soc/riscv/riscv-privileged/CMakeLists.txt +++ b/soc/riscv/riscv-privileged/CMakeLists.txt @@ -1,3 +1,4 @@ # SPDX-License-Identifier: Apache-2.0 +add_subdirectory(common) add_subdirectory(${SOC_SERIES}) diff --git a/soc/riscv/riscv-privileged/Kconfig b/soc/riscv/riscv-privileged/Kconfig index b0700dd3440..abbeeac242b 100644 --- a/soc/riscv/riscv-privileged/Kconfig +++ b/soc/riscv/riscv-privileged/Kconfig @@ -1,4 +1,38 @@ +# Configuration options for riscv SOCs supporting the riscv privileged +# architecture specification + # Copyright (c) 2017 Jean-Paul Etienne # SPDX-License-Identifier: Apache-2.0 +config SOC_FAMILY_RISCV_PRIVILEGE + bool + select DEPRECATED + +config SOC_FAMILY_RISCV_PRIVILEGED + bool + select ARCH_HAS_RAMFUNC_SUPPORT if XIP + +config SOC_FAMILY + string + default "riscv-privileged" + depends on SOC_FAMILY_RISCV_PRIVILEGED + +config RISCV_HAS_PLIC + bool "Does the SOC provide support for a Platform Level Interrupt Controller (PLIC)" + depends on SOC_FAMILY_RISCV_PRIVILEGED + help + Does the SOC provide support for a Platform Level Interrupt Controller (PLIC). + +config RISCV_HAS_CLIC + bool "Does the SOC provide support for a Core-Local Interrupt Controller (CLIC)" + depends on SOC_FAMILY_RISCV_PRIVILEGED + help + Does the SOC provide support for a Core-Local Interrupt Controller (CLIC). + +config RISCV_VECTORED_MODE + bool "Should the SOC use vectored mode" + depends on SOC_FAMILY_RISCV_PRIVILEGED + help + Should the SOC use vectored mode. + source "soc/riscv/riscv-privileged/*/Kconfig.soc" diff --git a/soc/riscv/common/riscv-privileged/CMakeLists.txt b/soc/riscv/riscv-privileged/common/CMakeLists.txt similarity index 100% rename from soc/riscv/common/riscv-privileged/CMakeLists.txt rename to soc/riscv/riscv-privileged/common/CMakeLists.txt diff --git a/soc/riscv/common/riscv-privileged/idle.c b/soc/riscv/riscv-privileged/common/idle.c similarity index 100% rename from soc/riscv/common/riscv-privileged/idle.c rename to soc/riscv/riscv-privileged/common/idle.c diff --git a/soc/riscv/common/riscv-privileged/nuclei/nuclei_csr.h b/soc/riscv/riscv-privileged/common/nuclei/nuclei_csr.h similarity index 100% rename from soc/riscv/common/riscv-privileged/nuclei/nuclei_csr.h rename to soc/riscv/riscv-privileged/common/nuclei/nuclei_csr.h diff --git a/soc/riscv/common/riscv-privileged/soc_common.h b/soc/riscv/riscv-privileged/common/soc_common.h similarity index 100% rename from soc/riscv/common/riscv-privileged/soc_common.h rename to soc/riscv/riscv-privileged/common/soc_common.h diff --git a/soc/riscv/common/riscv-privileged/soc_common_irq.c b/soc/riscv/riscv-privileged/common/soc_common_irq.c similarity index 100% rename from soc/riscv/common/riscv-privileged/soc_common_irq.c rename to soc/riscv/riscv-privileged/common/soc_common_irq.c diff --git a/soc/riscv/common/riscv-privileged/soc_irq.S b/soc/riscv/riscv-privileged/common/soc_irq.S similarity index 100% rename from soc/riscv/common/riscv-privileged/soc_irq.S rename to soc/riscv/riscv-privileged/common/soc_irq.S diff --git a/soc/riscv/common/riscv-privileged/vector.S b/soc/riscv/riscv-privileged/common/vector.S similarity index 100% rename from soc/riscv/common/riscv-privileged/vector.S rename to soc/riscv/riscv-privileged/common/vector.S From 2f636f7672b969b77c2e1442a80111519d702569 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:37 +0100 Subject: [PATCH 1108/2300] Revert "[nrf fromtree] boards: riscv: add RISCV32 Virtual board made with Renode" This reverts commit b05c04cd83d4a35c5ad2370536aa95f5d2f25cb0. Signed-off-by: Robert Lubos --- boards/riscv/riscv32_virtual/Kconfig.board | 6 -- .../riscv/riscv32_virtual/Kconfig.defconfig | 6 -- boards/riscv/riscv32_virtual/board.cmake | 6 -- boards/riscv/riscv32_virtual/doc/index.rst | 56 ------------------- .../riscv/riscv32_virtual/riscv32_virtual.dts | 25 --------- .../riscv32_virtual/riscv32_virtual.yaml | 16 ------ .../riscv32_virtual/riscv32_virtual_defconfig | 14 ----- .../support/riscv32_virtual.repl | 33 ----------- .../support/riscv32_virtual.resc | 17 ------ 9 files changed, 179 deletions(-) delete mode 100644 boards/riscv/riscv32_virtual/Kconfig.board delete mode 100644 boards/riscv/riscv32_virtual/Kconfig.defconfig delete mode 100644 boards/riscv/riscv32_virtual/board.cmake delete mode 100644 boards/riscv/riscv32_virtual/doc/index.rst delete mode 100644 boards/riscv/riscv32_virtual/riscv32_virtual.dts delete mode 100644 boards/riscv/riscv32_virtual/riscv32_virtual.yaml delete mode 100644 boards/riscv/riscv32_virtual/riscv32_virtual_defconfig delete mode 100644 boards/riscv/riscv32_virtual/support/riscv32_virtual.repl delete mode 100644 boards/riscv/riscv32_virtual/support/riscv32_virtual.resc diff --git a/boards/riscv/riscv32_virtual/Kconfig.board b/boards/riscv/riscv32_virtual/Kconfig.board deleted file mode 100644 index c8722acb384..00000000000 --- a/boards/riscv/riscv32_virtual/Kconfig.board +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2023 Meta -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_RISCV32_VIRTUAL - bool "riscv32_virtual" - depends on SOC_RISCV32_VIRTUAL_RENODE diff --git a/boards/riscv/riscv32_virtual/Kconfig.defconfig b/boards/riscv/riscv32_virtual/Kconfig.defconfig deleted file mode 100644 index 840b10fd594..00000000000 --- a/boards/riscv/riscv32_virtual/Kconfig.defconfig +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2023 Meta -# SPDX-License-Identifier: Apache-2.0 - -config BOARD - default "riscv32_virtual" - depends on BOARD_RISCV32_VIRTUAL diff --git a/boards/riscv/riscv32_virtual/board.cmake b/boards/riscv/riscv32_virtual/board.cmake deleted file mode 100644 index cc177a69ce9..00000000000 --- a/boards/riscv/riscv32_virtual/board.cmake +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2023 Meta -# SPDX-License-Identifier: Apache-2.0 - -set(SUPPORTED_EMU_PLATFORMS renode) -set(RENODE_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/support/riscv32_virtual.resc) -set(RENODE_UART sysbus.uart0) diff --git a/boards/riscv/riscv32_virtual/doc/index.rst b/boards/riscv/riscv32_virtual/doc/index.rst deleted file mode 100644 index a53384f5331..00000000000 --- a/boards/riscv/riscv32_virtual/doc/index.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _riscv32-virtual: - -RISCV32 Virtual -############### - -Overview -******** - -The RISCV32 Virtual board is a virtual platform made with Renode as an alternative to QEMU. -Contrary to QEMU, the peripherals of this platform can be easily configured by editing the -``riscv32_virtual.repl`` script and the devicetree files accordingly, this allows certain hardware -configurations that only exist in proprietary boards/SoCs to be tested in upstream CI. - -Programming and debugging -************************* - -Building -======== - -Applications for the ``riscv32_virtual`` board configuration can be built as usual -(see :ref:`build_an_application`): - -.. zephyr-app-commands:: - :board: riscv32_virtual - :goals: build - -Flashing -======== - -While this board is emulated and you can't "flash" it, you can use this -configuration to run basic Zephyr applications and kernel tests in the Renode -emulated environment. For example, with the :zephyr:code-sample:`synchronization` sample: - -.. zephyr-app-commands:: - :zephyr-app: samples/synchronization - :host-os: unix - :board: riscv32_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 zephyr-v3.5.0-1511-g56f73bde0fb0 *** - thread_a: Hello World from cpu 0 on riscv32_virtual! - thread_b: Hello World from cpu 0 on riscv32_virtual! - thread_a: Hello World from cpu 0 on riscv32_virtual! - thread_b: Hello World from cpu 0 on riscv32_virtual! - -Exit Renode by pressing :kbd:`CTRL+C`. - -Debugging -========= - -Refer to the detailed overview about :ref:`application_debugging`. diff --git a/boards/riscv/riscv32_virtual/riscv32_virtual.dts b/boards/riscv/riscv32_virtual/riscv32_virtual.dts deleted file mode 100644 index 326b9757518..00000000000 --- a/boards/riscv/riscv32_virtual/riscv32_virtual.dts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2023 Meta - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include - -/ { - model = "Renode RISCV32 Virtual target"; - compatible = "renode,riscv32-virtual"; - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,flash = &flash0; - zephyr,sram = &sram0; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/boards/riscv/riscv32_virtual/riscv32_virtual.yaml b/boards/riscv/riscv32_virtual/riscv32_virtual.yaml deleted file mode 100644 index 11cefb035df..00000000000 --- a/boards/riscv/riscv32_virtual/riscv32_virtual.yaml +++ /dev/null @@ -1,16 +0,0 @@ -identifier: riscv32_virtual -name: Renode RISC-V 32-bit Virtual Board -type: mcu -arch: riscv32 -toolchain: - - zephyr -ram: 4096 -flash: 4096 -simulation: renode -simulation_exec: renode -testing: - ignore_tags: - - net - - bluetooth -supported: - - uart diff --git a/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig b/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig deleted file mode 100644 index a905f99da2e..00000000000 --- a/boards/riscv/riscv32_virtual/riscv32_virtual_defconfig +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2023 Meta -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_RISCV32_VIRTUAL_RENODE=y -CONFIG_SOC_RISCV32_VIRTUAL_RENODE=y -CONFIG_BOARD_RISCV32_VIRTUAL=y -CONFIG_CONSOLE=y -CONFIG_SERIAL=y -CONFIG_UART_CONSOLE=y -CONFIG_GPIO=n -CONFIG_XIP=y - -# Workaround for incorrect SYS_CLOCK_HW_CYCLES_PER_SEC -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 diff --git a/boards/riscv/riscv32_virtual/support/riscv32_virtual.repl b/boards/riscv/riscv32_virtual/support/riscv32_virtual.repl deleted file mode 100644 index e0df808631b..00000000000 --- a/boards/riscv/riscv32_virtual/support/riscv32_virtual.repl +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2023 Meta -// SPDX-License-Identifier: Apache-2.0 - -flash: Memory.MappedMemory @ sysbus 0x80000000 - size: 0x400000 - -ddr: Memory.MappedMemory @ sysbus 0x80400000 - size: 0x400000 - -uart0: UART.NS16550 @ sysbus 0x10000000 - IRQ -> plic0@10 - -uart1: UART.NS16550 @ sysbus 0x10000100 - IRQ -> plic1@10 - -cpu: CPU.RiscV32 @ sysbus - cpuType: "rv32imac_zicsr_zifencei" - privilegeArchitecture: PrivilegeArchitecture.Priv1_10 - timeProvider: clint - -plic0: IRQControllers.PlatformLevelInterruptController @ sysbus 0x0C000000 - 0 -> cpu@11 - numberOfSources: 1023 - numberOfContexts: 1 - -plic1: IRQControllers.PlatformLevelInterruptController @ sysbus 0x08000000 - 0 -> cpu@4 - numberOfSources: 1023 - numberOfContexts: 1 - -clint: IRQControllers.CoreLevelInterruptor @ sysbus 0x02000000 - [0,1] -> cpu@[3,7] - frequency: 4000000 diff --git a/boards/riscv/riscv32_virtual/support/riscv32_virtual.resc b/boards/riscv/riscv32_virtual/support/riscv32_virtual.resc deleted file mode 100644 index 87e327287b6..00000000000 --- a/boards/riscv/riscv32_virtual/support/riscv32_virtual.resc +++ /dev/null @@ -1,17 +0,0 @@ -:name: RISCV32-Virtual -:description: This script is prepared to run Zephyr on a Renode RISCV32 board. - -$name?="RISCV32-Virtual" - -using sysbus -mach create $name -machine LoadPlatformDescription $ORIGIN/riscv32_virtual.repl - -showAnalyzer uart0 -cpu PerformanceInMips 4 - -macro reset -""" - sysbus LoadELF $bin -""" -runMacro $reset From 46db76a81f671adfc4ba80bef20a06000b1c6eae Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:37 +0100 Subject: [PATCH 1109/2300] Revert "[nrf fromtree] soc: riscv: add support for Renode Virt RISCV32 SoC" This reverts commit b6bc79d215cda84b4441836c9b96939ef1b662f5. Signed-off-by: Robert Lubos --- .../renode_virt/CMakeLists.txt | 6 --- .../renode_virt/Kconfig.defconfig.series | 48 ------------------- .../renode_virt/Kconfig.series | 9 ---- .../riscv-privileged/renode_virt/Kconfig.soc | 19 -------- soc/riscv/riscv-privileged/renode_virt/soc.h | 12 ----- 5 files changed, 94 deletions(-) delete mode 100644 soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt delete mode 100644 soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series delete mode 100644 soc/riscv/riscv-privileged/renode_virt/Kconfig.series delete mode 100644 soc/riscv/riscv-privileged/renode_virt/Kconfig.soc delete mode 100644 soc/riscv/riscv-privileged/renode_virt/soc.h diff --git a/soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt b/soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt deleted file mode 100644 index 56d36b84ec8..00000000000 --- a/soc/riscv/riscv-privileged/renode_virt/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2023 Meta -# SPDX-License-Identifier: Apache-2.0 - -zephyr_sources() - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series b/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series deleted file mode 100644 index 09adc3d00e8..00000000000 --- a/soc/riscv/riscv-privileged/renode_virt/Kconfig.defconfig.series +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2023 Meta -# SPDX-License-Identifier: Apache-2.0 - -if SOC_SERIES_RISCV32_VIRTUAL_RENODE - -config SOC_SERIES - default "renode_virt" - -config SYS_CLOCK_HW_CYCLES_PER_SEC - default 4000000 - -config RISCV_SOC_INTERRUPT_INIT - default y - -config RISCV_HAS_CPU_IDLE - default y - -config RISCV_HAS_PLIC - default y - -config RISCV_GP - default y - -config 1ST_LEVEL_INTERRUPT_BITS - default 4 - -config NUM_2ND_LEVEL_AGGREGATORS - default 2 - -config 2ND_LEVEL_INTERRUPT_BITS - default 11 - -config 2ND_LVL_ISR_TBL_OFFSET - default 12 - -config 2ND_LVL_INTR_00_OFFSET - default 11 - -config 2ND_LVL_INTR_01_OFFSET - default 4 - -config MAX_IRQ_PER_AGGREGATOR - default 1023 - -config NUM_IRQS - default 2058 - -endif # SOC_SERIES_RISCV32_VIRTUAL_RENODE diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.series b/soc/riscv/riscv-privileged/renode_virt/Kconfig.series deleted file mode 100644 index 22e27cf38b4..00000000000 --- a/soc/riscv/riscv-privileged/renode_virt/Kconfig.series +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Meta -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_RISCV32_VIRTUAL_RENODE - bool "Renode RISC-V32 Virtual SoC implementation" - select RISCV - select SOC_FAMILY_RISCV_PRIVILEGED - help - Enable support for Renode RISC-V Virtual diff --git a/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc b/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc deleted file mode 100644 index d123e797229..00000000000 --- a/soc/riscv/riscv-privileged/renode_virt/Kconfig.soc +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2023 Meta -# SPDX-License-Identifier: Apache-2.0 - -choice - prompt "Renode RISCV32 Virtual system implementation" - depends on SOC_SERIES_RISCV32_VIRTUAL_RENODE - -config SOC_RISCV32_VIRTUAL_RENODE - bool "Renode RISCV32 Virtual system implementation" - select ATOMIC_OPERATIONS_BUILTIN - select INCLUDE_RESET_VECTOR - select RISCV_ISA_RV32I - select RISCV_ISA_EXT_M - select RISCV_ISA_EXT_A - select RISCV_ISA_EXT_C - select RISCV_ISA_EXT_ZICSR - select RISCV_ISA_EXT_ZIFENCEI - -endchoice diff --git a/soc/riscv/riscv-privileged/renode_virt/soc.h b/soc/riscv/riscv-privileged/renode_virt/soc.h deleted file mode 100644 index c82e16f1613..00000000000 --- a/soc/riscv/riscv-privileged/renode_virt/soc.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) 2023 Meta - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __RISCV32_RENODE_SOC_H_ -#define __RISCV32_RENODE_SOC_H_ - -#include - -#endif /* __RISCV32_RENODE_SOC_H_ */ From e0b87b6a20ace6afbbdc21898bcaf83b06509263 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:38 +0100 Subject: [PATCH 1110/2300] Revert "[nrf fromtree] boards: riscv: introduce support for Beagleboard BeagleV-Fire" This reverts commit 4a96d149452c8328e11af32e784254af730aa8d2. Signed-off-by: Robert Lubos --- boards/riscv/beaglev_fire/Kconfig.board | 9 -- boards/riscv/beaglev_fire/Kconfig.defconfig | 6 -- boards/riscv/beaglev_fire/beaglev_fire.dts | 33 ------- boards/riscv/beaglev_fire/beaglev_fire.yaml | 12 --- .../riscv/beaglev_fire/beaglev_fire_defconfig | 18 ---- .../BeagleV-Fire-Front-Annotated-768x432.webp | Bin 42568 -> 0 bytes .../beaglev_fire/doc/img/board-booting.png | Bin 16583 -> 0 bytes boards/riscv/beaglev_fire/doc/index.rst | 85 ------------------ 8 files changed, 163 deletions(-) delete mode 100644 boards/riscv/beaglev_fire/Kconfig.board delete mode 100644 boards/riscv/beaglev_fire/Kconfig.defconfig delete mode 100644 boards/riscv/beaglev_fire/beaglev_fire.dts delete mode 100644 boards/riscv/beaglev_fire/beaglev_fire.yaml delete mode 100644 boards/riscv/beaglev_fire/beaglev_fire_defconfig delete mode 100644 boards/riscv/beaglev_fire/doc/img/BeagleV-Fire-Front-Annotated-768x432.webp delete mode 100644 boards/riscv/beaglev_fire/doc/img/board-booting.png delete mode 100644 boards/riscv/beaglev_fire/doc/index.rst diff --git a/boards/riscv/beaglev_fire/Kconfig.board b/boards/riscv/beaglev_fire/Kconfig.board deleted file mode 100644 index 1984bb05c09..00000000000 --- a/boards/riscv/beaglev_fire/Kconfig.board +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Microchip Technology Inc -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_BEAGLEV_FIRE - bool "Beagleboard BeagleV-Fire" - depends on SOC_MPFS - select 64BIT - select SCHED_IPI_SUPPORTED - select CPU_HAS_FPU_DOUBLE_PRECISION diff --git a/boards/riscv/beaglev_fire/Kconfig.defconfig b/boards/riscv/beaglev_fire/Kconfig.defconfig deleted file mode 100644 index df89660bcb6..00000000000 --- a/boards/riscv/beaglev_fire/Kconfig.defconfig +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2023 Microchip Technology Inc -# SPDX-License-Identifier: Apache-2.0 - -config BOARD - default "beaglev_fire" - depends on BOARD_BEAGLEV_FIRE diff --git a/boards/riscv/beaglev_fire/beaglev_fire.dts b/boards/riscv/beaglev_fire/beaglev_fire.dts deleted file mode 100644 index df956f5c8f2..00000000000 --- a/boards/riscv/beaglev_fire/beaglev_fire.dts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2023 Microchip Technology Inc - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; -#include -#include -#include - -/ { - model = "BeagleV-Fire"; - compatible = "beagle,beaglev-fire", "microchip,mpfs"; - aliases { - }; - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,sram = &sram1; - }; -}; - -&uart0 { - status = "okay"; - current-speed = <115200>; - clock-frequency = <150000000>; -}; - -&gpio2 { - status = "okay"; -}; diff --git a/boards/riscv/beaglev_fire/beaglev_fire.yaml b/boards/riscv/beaglev_fire/beaglev_fire.yaml deleted file mode 100644 index 64d34b454f8..00000000000 --- a/boards/riscv/beaglev_fire/beaglev_fire.yaml +++ /dev/null @@ -1,12 +0,0 @@ -identifier: beaglev_fire -name: Beagleboard BeagleV-Fire -type: mcu -arch: riscv64 -toolchain: - - zephyr -ram: 3840 -testing: - ignore_tags: - - net - - bluetooth -vendor: beagle diff --git a/boards/riscv/beaglev_fire/beaglev_fire_defconfig b/boards/riscv/beaglev_fire/beaglev_fire_defconfig deleted file mode 100644 index a60ed8c1691..00000000000 --- a/boards/riscv/beaglev_fire/beaglev_fire_defconfig +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2023 Microchip Technology Inc -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_RISCV64_MIV=y -CONFIG_SOC_MPFS=y -CONFIG_MPFS_HAL=n -CONFIG_BASE64=y -CONFIG_INCLUDE_RESET_VECTOR=y -CONFIG_BOARD_BEAGLEV_FIRE=y -CONFIG_CONSOLE=y -CONFIG_SERIAL=y -CONFIG_UART_CONSOLE=y -CONFIG_RISCV_SOC_INTERRUPT_INIT=y -CONFIG_RISCV_HAS_PLIC=y -CONFIG_XIP=n -CONFIG_INIT_STACKS=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 -CONFIG_FPU=n diff --git a/boards/riscv/beaglev_fire/doc/img/BeagleV-Fire-Front-Annotated-768x432.webp b/boards/riscv/beaglev_fire/doc/img/BeagleV-Fire-Front-Annotated-768x432.webp deleted file mode 100644 index a4ba6b0d98e9e985397ab938b9c56f50fd3111f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 42568 zcmV)mK%T!+Nk&FMrT_p}MM6+kP&gnorT_qt1OlA_DgXnp0X|6}jYOiNArv{Ss3-)4 zrtTLU=9eHlT(jQWeoL`FQS_(iKfQk4f0Fls0|L}e~|D)KK#Q(_hpXYD- zzv6!@K4^ca|FQmS{RhH->VM?F?*Ezn_WA_=rTw4&$M|pZ-wD6z{^9$${@MRG@{{0K z^k49Q`+v!P|NOoGuKl+6RsF;Lf9;?A?~qUHKjgpi`&xhF|NriX{!{+H|Nn7s=>O~g z{(A6!=6o>!b^oLLkN=0^)BShi>QA|N1UN`xXC_{U@ov%)aM-Q~S61&-VY~e{g>0|0Vwi{9pO+ z+P_ZzF#m)8SNCuIugFK{Kg@r?e{}u3{~h~*_6_tO_&>@2xbUIdKihxT|0(Pd>vz&W z+W&fv_k;C+^B?p7#D4010RJuioBoIVFYTB3pa1{!KJEXD z|14i8qAUUCEH`vTfE?&-fZVhzDEp!;0p=_>V`#`O9Y>1|-4S39F=4x+ zEC4I(3K0>TXv2`=vGu(S8e)!nF=~diB=_-2S|@2*H}W<^uH9t3a{cSk_t4-%zq!`2A``jRv80YLn)m5aZZRUw~5 z(H}gMq_78=u-(xV%-==rp!nyqcc-id%v|cbK-Gn*JESMIBrLysSD;P!-OdSxv49GO zb^~o2vi6UbTxSOmsE1-e^!*wZCOA4Hl)04^BENV)D&TCC%$=s9HZ$jvbd~_~78|-8 zK*$RiOXSi2eBz|SW)&amLgeuwaCvnnXx{^cjQOIAoF~lezc}jRww&Fm6^)z`QtB-; z6p7`oFvJZxFPmvR74KACw}qfmWFjKkU{?fmf(MHY-4S39F=4tA6O$qWSN0DCGi>Uk40er`AsUBymYH##kNPG)UJ+yh~=ZYGq0Uh90f)awyq>>M;GPUGDBWqQld@JG&kmr`>%Y2skBx6kTi?;n)50Iq8y zpe`L#U!C8HKZxvVNNnVg1J%6|BOCazFH2*h)F-O&POl`{6+d+X%Lx_aKu{f{ox{(U zC192hy(YlFI?wef_RlIo8-#3^N%Rt4(bcL+ZJu$nulGZ7B#&0h9ly$JbD!2Zy0~4| zvRNp3Fsai(=UD|uiw)foU=J}Tx3EhO3y;t`GoN}2tH83yMKx+By(z!_GR~M=!lPAW zz88(LIWyz_(2d=Si)i`ZAQY(#s`5oMwziO!X?0JFBq}3?8ih+9laSsklyV4p2cX9< zDI^VjBJo8d3hy%|OQZ16=Er+$iML7NJ_;NnJB>S! znB=>Dx_U?~JD9ND(G~#f6V}qF>{b(z{7R&|hu5~!_-q2lY)Zu;m@2^d`NC7~g`BSb zl-NlBo%+lr-wrGlt`E5kjG>ip9~;0^s&V^@GT-qztH`8U_DWGPZfIBMsx3VY@a)<86-)I z7>ONq9Wc(M+3buqWB4XicA!7Z>0OgU&tIog{qFL}4II(%bIq$w5Q$4h$wV+`G~!}FG&gX-lPbHu{sAesrc_-gnACW-g-TqyKt4S*qT+EZ zbyGs-1>=E!+XTGy=WE9YPo7E9;AeSZJJoR|x~5bbXBRw!w+jyF=|?buZh2D_q&7K# zGHUSJlU#*cLP0h0CUlf~!Uh**;DHEeZe|9>Ij|%$rpZFxGp~ui>cC48VI_y0IjdI2 zsgG5o6~4b+-7Di;*7M?_S%JVDzM=S2=zJrnw=L``v$J$i=R*=-E-TurSJx^rzd&>6 zb)P(sxmW4KUwt!Ru0)dgvbuy3vR(tH(L>fj{+U!4oC0ek+EbLXfQRAJSFxMuDpp^8 zKFrH!P&#g2G0b z@H?eh%dDqc=A~s0h%lpIH+}tU^uj}tw67P}gN^SX0vvANgS3F~^<{w(mrvsfg^>8T zf(cnu2R9RYmnR`(lz2bWrmW&7l0X8rQUcQP1EaiGVbrnJP6x$ zL?$HUo|U=MX=Vx)O)R@*xr@%XzIR#k!&B}PkUl zLkOWpw*a&%N0U?50&8**0AzY2w@lK1P2nek8{`0aBmy*Wc|SUh;}lQNBS zr1W#->!F7oN;dR)7UF?gtK!};1@rAv*XN&ctEPP7dG7%I5LmdJ1lDZu{Bpx#e3xhu zy?dK0WuA{Ne1BC&5Fak!$@YM+-uY3sTt<5+Le;5{x+F6Avb(w)#9qG>e8VRxh@=&g z^XZunS>`|mBp!+&2?xlF)$>rJKRSBiecHTL@>z6ErW3*RI3e89H4Ee&< z*KqK~dV5_FU=J#@x2+`Y+R;+Dx&p29w}^4=vLTk^nb*J>wSO&~7DY{3gT8Rpa2nt_ zv2{Q^;fHo8uPz`fAo3+|ce_Z8A99lU(<~FcLL29C%j-Wb15|c&#Jr^Mn>OASIpK1) z`c<#fVqtv4OV}YY`-78>&mp+5D+x>1OIpb-DH&Xv%+6RYclg2}- zAorl;YwHr(uw~=kE%1@L*H&l-P&u9}B_*H=wx;tx1N|`wxUr$O{Ql1%x{ZDIUe3J>Po40~_R$ z6j7x5lNG<{IidN<-qd;7r&%X!K0Q`G$Uj`Lq8^78yUmAqXm6x$v-CwE|I`g8&&wYRE~(g9DjDr^DBmjgPiGsDziZt^u%%iuWG}|jjv)$uFI`90+b)_pJ_gCq z-q884$~c)DHdIr{Yxkk)+4Ny?7Cl@tC`G?mV8R^|{uPTU(pUq`SZ?gKIa`il-7aBBo25$)^qwqKO5Gu@I*W~1Z-FEoN$PC1%K-;rnrxrx<%Y=X>_d?-NPwJ zkYjT`UlXVEgdM2=rYZj*`+Uc6C^*ATT=MReIIpJ+UQkRjipscK$-s$zG3l0ns$jRc z#h}cF-;5)JI*v<=xzc}r${Z*Zn5%I{}|H7NdZ^#j-x$-gfQwXh^z35yW}P4DRL(@PU&>iI^amg3NeEo?+V|Y)_n3!*GLmL zLj)DCsc@j#Tjd1N<&mqab2*%c(T@b&l6o#3&rGNk+UMt6o}H6e@E!~>*GSg!Oc4|; zY}T0o91+}L-7*=bksp_CCSe9))3Reu2yMBi7`-=A=iKTmZX>$-U-v$aFsW)O%(tKh zsZj7(7E?)TIA(rEo`m_15M^W8(%qZqs`jbWAP+T&CH#-^^|!sT#04w?<}5dKMSwh@ zO-l$zf;W)HP4DFI*8x0;q}qKJtc-Jq3=NKkM12uaDbUvhGX%~NI>Pn6C0Zf_IoJyD zzTq+U*`6`?y@79ZzhEsGdG5OR)ByU|&}mi{A=Vt;7V8pVJ- z#fI*PwB~I2c`RLs(8MA3v@4%E)|g#fdLIwhOpDETiQ2x;=9KYN2O4?yd~VqngX4bCEtbTl^v{8 zsZWJ(;AQwv-xe|I;^YHN%+wYy8ORda4{KebCo}6@7A%NBspIRudMhqeSRNU%G z%d{^9^FR=%q5C(39bfPmEGugV~>pMO~J@ytw?%hj^p&@heMGf9mxLeN3^6PPn zyY0}Vs)0TkiaM{-{;GaBwkMRQE^_#j zZNNs@(EJE`V$>K+;|M)H)UI=JlJoKo2w|wB--{v!Ff}Db4uen<9&Mm18kT@0Cju#t zGfTm~m0q9Pn%PX5A_*OuVZuiF(PbU8+mC2FM*#+YxI1G!)t!`crsqte`-~XB25KRzK&|p_PK>uL3VClKVib5O zn3SO43gu8L=+a)HcSYB(!x~#tq@n1edN2ii!8XAFNtlafvrJKyt6rgc#px4Ew59z& zWC(gexoRfFkCI3?YGRgz`ThBfmpE3njrpQ`SzO$`2ty3VH#PxH0)T-y)pT5rzN0Q- z|L%?w-p5{18x@>;YU`mwqCkK;r3>o1^C{NoG2V-J;3HeWkBn&@+|a)nWWmVc+?%^+ z&1r8or>`@-Iqsw*P2Jdj)c$-95j=270#%)+$M;Iuxzsp;ss6JpM6bL?Gt<*ENd@53 zo}ZS@3j=I3`#Kri#?81dEXrZesUM#3&#A=z*}Y@%cX7M@aH1PsU8K`Ib88c>QxkiV zVr{u?WvMdRGtKE;`6BA3a1$pAGZPvi703jS8~ zW!q&iJnfK8i%{cZS6j_U42S)>_JLDu;Bf4t-kI>!CmBFd%mixU`T}o{-etEiU~trq z*H!&8?%bUQ)78vY>x+Y!Y$nd4Bzc)UfPURqUzoi#FLANW+oJ-~b!DQS2sj|&^`RV_ zde?^%YT1895!u_gfA(*wg3C?%Dx+Z`{1oni-yQQTa3?7pO@n-y>fMgJozgd~T7l^B zu#)hCUbJ`kaBff>(FNrE2raozZa?v@C=gNCmtQ#@31(XRqGbnGS{c;UmhM)0IOJ|D zmh4wbQd69+6^zBG>khqm7NBNDv2fI0ZfTV)09`~=f?7}c?#38@QLMSU3PW2}k%fL+ z#=TNZRHEI7i1H6e#+n(`lhlzwlmHCIO12KS#Q!GaqMc>3Ie>Kf_)x*Psmx+$}yOiOyGR3Za$i5Fu zY@kBWw-ojop+3A@GtG_UQ3ntCn4H!;;>l_Hn)nu~_9voutgCIlB0EE=2*rB#>YYUU z;ncZ4O9*n+DU>i$l#0H8BuV6RA90UJxcf*7hqAuoWWub!auj$^WV#-ztq5$xZH+g7 zXioS|$3{<#4qQA@k52Ontu}&XWg!Ei6T1v3o&<-NZ5LW#>6i)`HMjD6saqZ6&1~Vt zd@p5g1luaAkSIvPYJm--r#F2@yWYh28#l0M?4{h$sL_IrbmEtPR!51ArYr&(g@q)2 zJe63-@$Xzl8vMPLs$LRv^<<;pYnFm?mGHj|ZTb;PP~O7#^LTkQaHoRw4t%n* zr*Cqu?cM|l?dhFqiUW*~#z(1U@ezU=%nXwSg4jZV78T1H&VBZqTqy>9Jybp4eN#rT zz2fR(I`7S}(_B##yVHAbML;-*N+EZ^_(1R~tP$mSVV{wTV0pgL_JMrk ze1W`efCZj?A!=MO#P`E@JF@hyS#i-`VNgF)o#NcnfqVufqWRf(+t|IUEe|u9^f7#g z81c1%bJ^?plcYBE@#%z`N+T}kdv23$sUY-nlugD3WR-ul1bjCtXjJv`IDW_rL=nCc z*w6?NN_Q5_py4W#Zq>hb%%66oLuIrSLw^4=cdj}e*vinU96LCMz?W*VG$E|Bhi7Ot z^~_>Ri$jxvLK1&@@(_w2mS16jYzyJz!qk)gpgkg3;y&mx)eF`Xl2@Z^UinAx|{=(PR z5-@;xAWX1p`o%2c5Va^IcI@>dJ)Y@+>p@_iKMe@UYeaIHVHURsa}UI&s+XUOk#d9W@0JoWAYP`~qMHo+>fO0`J%b z{7u8@E!b>yCyXq`8Y`}58TB}(@}fHAJrj-`-$G|Mo5tD8_h8ORo}2>kY`m(J57Y=M zgyNXNK&GcfBR0A!ia+hOa6t?LdmSe@d@Jc6n|Ok~(HJlilXS*@>-S2jK*8&8RBoHg zUZ3yaKzu++zF@UbG+p1pA91g>x`LY9MU=x~8_DkUO>Ol-mj{-4C&0FGFS~_h%zUHA zCqG+V;J4i6=}j7wIgpCvHK2Og%U_c%1EqH!?_)qN_#cM;l|a};%G#8`M1*&)bJl6( zYI?nd0Uwqdk!CaSRyINoN|CyHA9#=n>@|rL?@a()gi$VmPS0h-%a$m~2J@$TsQsA} z2>6jWDWgwzJs19xAIJBRm$l9X{!iLYWHT0`(2jvyiUeaw8tvq&Y zg&V9PP#hw%(-qjz?mj6Bbhp<@o5yJfcWNXxXp1byCbU@Ybq#mR^I@W8tj#gR=i0yp zC^L;ZT4wA?C(4K7&kpzOcnmMaTsL>1HXjDmbpeS#ah0u7LQY|Qot~gz+ z6}>ZX1Aoqs=9bl%gilEdnzb%130w78)ED2b^-X0E;sD0|yys)}`yfTo50;Zoj3gJG z#xUmPN*$Lx$Yt^#3Wy8B*~-q+7H!Pynv^DY_U;C4e>?%M1%Vl?eswYjSjm^7-sr(z zq_;4qFu@zTk4{WBeb)G}Z^LqDA@yo^QQ=i7gORMO=N4-bSC|F?RU$9puw9&kW#705 zzB|A(HPm-UrJK4?llKA!?yn*m_YdL6@VR|zHUStw_RCgR&HolkkkiN}N(7yMgo(c&RZ#UdE-2D-fqi;_~J-hhlHUOv!+9RkAJ}^iZkZcD>>f zQ)wke-(dDsK4m^KgV5Pz@rwJq<`&x3s8s5+$$VuhwhkDjElXWODxrON;_-~*`V}+K zf+mHy&Egm5Qv<7H=A zzT%~4==p&_%&#IQiQbRlwC+c17$|&fpou1}0io3bn8O8hOHmlsRXyzP@|%xIG+vr zpT@{FQmQSd3A)@0aM)do55fqa#FK*l?-D1#O)l*Hb=LrM4s_PH_o^Hq=omZuX(h~J z_s>O6o+Hi`qF#XC!FR=kpcs_h>b5*~CJ|C|oG9~aDjb{ymzFdkh}F2BcyB{puecPr z1B@8HugVKT}j7MOFQRy*NOrXJGx={|aBa$RR+A$ZA2RFb6EOsP z+2L5dPy)SS*<_U?)1RX|dKHO)*=cgtj+^RAk7-*t*ne{wYSn_UdHEiO4oDfQ*?vxL zVgS&bgDL9LTFU82@}Pfril$pg?*bJ7v?!s2J&`kHajm%ZXqeURQ6<_stUJF^!^{WE zQ)KU_N~m7$|Lp#mui>(F#U}9^hg&5bK2pYKPM-*wq)e=o?#HmZ0QiW(w<8I1R-~TJ z0DtftaozD`XcenmxDxB``DrFl6MSss9fsphQK+G0G(y2}mvq`YNAz^9N|>vC&iipL zF$T0*=MuSP-sfD&`o>?oP}VRxLX~Qb5#&3L(lqQR-i1Nji(&LM4r%PbErNdKZ>>Ne zvK~hz$bcJk*NS|438quY&Ll`ttlsXWYwG0;8*^W4O-5w<6A2r*qOX})W2u4+k z%-pmM6xaPfVZ}{RmA!s4;@eAQ zaPY5;Av5fsi-)|BLvgZ0oYp+Vgwj|DDVP!p98)OBiN@@3;`v7R^%}rj zW79mxI~*f7I+sf>!8=kVp*9~%y_X_3tSbUjF-w2H%@L=nk3R*c+R=vE)wn}`nA~JF z3{CWL;t&RAN=h6l>DD1w=$Xe9kPG%8xeI5{YYT2Ar_dvka#alyu3}>f6AGF5gEzv4 zH}BCAc493N{HkYs^&>8~p7I&!qycPnN#jI0B2KmkwPH0Hf9aq*!eF==1R z=2VOswoO=5Ynwe_Flqve-N^Ic@IqA4O(k{aKd)kmg%CsZr*DYh<;*?;byO{DxC>-k zp1zsOj8JfLJt`gVuj9DrwV*wxGu<(-2V&f9)9z7B<&%I^3Yq~)?)N@;^)*l#J7H@Q0|H&OQP$i@6*UOb1elQi{~!orbKYAM4%>TeU+&<%V(Fr z$urKH7$|_7q0Sn)kl5sMt;)p#HS~fMgM)Lpe|7efR~Geu?uAt0H>({B^aSs_FtlxYl;_tYWO}h^BmsG+Sl3u|_{A#UV=aN;E_@h&G5V0uGv)dN_P2!3Adyrd@mJPAd|Co>f6gAaL`#pgwz?2s7ZEwIwf~dP*J|r}CK#H70kr_Wy=%5#dUNDbrhwa2p;aF8w zrM@9KmKL7nSmLwX48eTjww2$Qh)_!NS{8a9Z>*h@g6(Z1hY)!`oA z=Ikz|2Jr6-t;9prXu(GA*T?UJIT;_%x2NiyAA714KKA9*n!za`Dek*H3U^;`-qJ6i z>GT#Ym{fA4NQM8|0kO4NtF$Sk-L45N^ro6m;2fSRyd7{@p1zJ`UWo25;~uQxjgZN+ zMJ;E9-BBl~bQ7ncb%G2Xkz>Kc5_E`#ck=V={9aad17lejB#ZRI5abNHB-OtdUkHQ? z=nsGA-_D6qPt8GtAB7Y*L)@4*mw&Pk@Jny%0dvZ0j%epgLvxVhI&uEJ3=h$ z64%T@r=HVId0D*XRuAA0(AwN%G#u088T@WbkC$m2j`(wkHdO7fCp{Y@hFi|exrP$N zx6?I={N4u|OYSw=u^3bsiuVAH(h8EnBybib6QzJwJh@+a6qZ+wbGos(M^3#-Uzw(7 zjHCnRg?*KO(#ak?=AzmxN9r&>UXRR>5#=(U@c$2jn$sZ2y7Fhjb$bm*DUuVB|1t|)VjBfu->Vh{=!mJeuQCrSn?rf@H8G}qmyLgw?j z)z4>HpeZVx@rSFQiJkZtw8=eev@{EI9pW;)y}?D8mFtA7)E={p0ZSwlA!|>Omz6qk zl(OmiM3CYYr+IYkN?MAgryn1byUnl1O@|F;!&>2bbt+qnS3oPkT0rGN7VMXmv}?&? zInW?S!x{&rW-)BMf9N|B9~!t|{V_w{dDyMNYv8giXc%!lIlJeC4}WPQawjW-$7gAj z)#F7X_JFq-m%u0QySh-Qg=WSQ!hs`~AKYB+Fqgv+@^JI>JKQzegyUjrIm>b&2CytS zV*K^V7`BKqd}8f6zxuJ5FXBq={`nuLQXKZhg=a8`6iTYW+Zexw^0Wa5PSk^&DW_j3 ztJl5XBug#8c+)6%&0{g0f&p|(v+)OUf%G-%PDjmY?~5y!htZ&T092wXymVChjLoFu zVfv7esCgHz=iP?aPdaO7<{KY2V5uAFkeq1VdpkD`;n1HsS@ukE{6MQf({~ifX~E&Q zWsiN%C{QjjU^m{>T2t$CZ1{*6U1Rtb{27j)E-q;<3CZS zH7jq*Kl>D0x>SKt$X+}JY<0SCVA=WG0a*3)Y*$GZ0<_mVw6tNH94)1{OnFNXA?|Lk z*ZC`aS+QE{plv7`<(3I;1S+6jeBTP4fe6R(>VjIi-CEnxj7;9`A)B?CSJ}aiFwi2u z%n;f{-o%&yPt<%$*8@Iz=A^0xfTxK{X{ck&95z`Ul2Vi>*fIFF`ae1g_QZRLb{bLBa>aPzTcZ1=0o&q-!sZ zjA`}Nz`4|FAkK2xh1dZwDd1pb#xnAvvyyIAOG`qv7z?vU4EI@!cv4mAU=r==c_7k*vocQi=PIDJ@Hwa}~C@RzVSOB`C6 zfrfk5HepH$Yb}>ahgMQB4$#98Jss`(2}=r$AnRIV%+^7AF+?Qlzv=@RkV2LUz&NZ= z80~$EmZz7qP0fxgMR#fTMN%8O6=q5JJ)t;ucPcS*c!9CD4<5?!44V)I^jvWyag&8t zZx&w&Bf3U*Bt_T<)6-w=sF95X@a28j@TUcW6g-hrkq&z{FK?q(8YCZRo}beZSWpSE z@iW}QVPA#(+W+2(wd(K3X*cni%HyeOQk=KyeZsKJeMJ$Jw$fNR!3Zp-Rg=Iud!Rv9 zHnu1BGO;T~C%y1ExbI7Qqo*q;-17b_Hpsy&?zTKo$;8+^*i)L`+=mv^(&Ym1w~EL^ ze_s~vO|-Hr`XZLUe7CeM#xS|CrT|+CHGiC8*0aDCBJB5W8JOut6-!p78)SGnEM7n6 z>52?(WpP(@<|PNV^YZ~n_bcLLKEZJ3ti-bu#zb4egy2PP0`&Zs+3H7^0K88ix#RJi zq*UM`Je$vj%UqX@ z9&xXxihJjj#Hh=A{@m0@Joe^Gy#BEnK1a$}*WdL}0FI@`$RO^Cg8XK`E)OCbf!)cs~ z?0aSf?`3b{JNH!yIizO75psYP9)(^QXmk%o5e>)PfVe5J$*iclydlkpV=8fEK7;3f zQn)D{ngJc9vJTGa@^+?(q~?s~R&6in14xQW;l*_{iwmeaMZvrq6oG~`dlOGtk5|9P zn}v{ka{iCp?~KViBstuG_vzGQI_sh_bxItCa#=ELaYY=zvBnZy41E#I9pGm9a!Nkn z192TE4m&U=hcK)sNVluaAbg@x^kLKa8Nkb*ZUw=nUU_g$!}J_*(Pe+-MJ|&pd`4R2 z`c@7mR7znqZ*azc>G22|IKY^T!l-B>Uw7j+oHUeAY3f(N)JLmz8(@@UV>F}fh>BBi zaeiwN50>97Ki@9qP1&w;s}mHi5*npyzX9!24U>LdefIfi}|p(Si^l@ z)f1_jl2=fmEZj;<7~T$nlg+M8xi)1I3`z_=74ezmu2+g94i3!ua>ZhSiVREFeCtwo zM|-8qo2#Kqq*QqL@1K^C^{Xh9A-X{6PGqB3!kYHnJA2|X^U%Y5VZG9d)=YEIsWo;L z$RNFNR!7q5oz@}cF|4lw(QsMpwTQDhvt-W{`YIZDlqoo1O9?<_!BF7v=zn z;EUW06F66hDsL^Y1gn$}g%9R{4;Z4ey8XAmDwlBAl+C22k6L^+BEe5A?6)hG9#-bb24wf=s{G}o6pLR7N0DedY?SY5ZWmqeEphm?* z{=fkd(nm377~cq?rBqn~$PC0pP#naaa^OAX7y7_=2xGiGle)!4U(G0hAKXhQ)3pUBTRNW>3_!~9s4-OT~EmL z^o<3(yiI~_KQK72jJ?8Q@aWCnpB>0dfiO=#wEbO3zd6(g+C4MGrwzBdVl>_`Ni*1K z4!HuPtnXjVEmg_?mf7i3FMHrk#C@beHRc!v4b3B~F|V~4Xr00$2=;Uq%jJUi&2Fp9 zeZcv@Md+kK*A1BWLEu)yO}n0>Gbbe&y@S-S3Q{)DN;=nq#DA$!$;sD}%j87#y*|}F z6_&Ezhmm(N$vzNK$TrhIGZhf)bI|N_c~B?Dc5dH04W+!~FiBmj*&{n(0V4A!7|w*E zIclE=gYA~^89Rhc&0E4RIdGREt5J_G_pwCoV z*>#nBJ}-yG_|A=u*$57I2h#oTnR zWizfiv|VY+g?q3t%CCU^V7Fy`PyHb50zg3NnM>63TnM&A?&4IW`q(DN!hvrDh>10R zhfpv`OPz=$_SiiN?!u}XAtaw&_Tv%~ZBA6+c#X1e6m=Sx;WR)bNH;*uB&Sok^{;f; zm397I(5ouWN$gg}9oEQBd;=~b-D=X^otXvKRE;B|gc7Z@Npd8P<&bk731T)&6W{X? z828e(Ya8Dl@?aq{B2&(?W8yp=$F`u zGT2R$e-konAPzl06$Px7ABnJus+?u&FlNZ(@=msNb&+7ds^n}at)T<{H z*86}592uuc>jK(-$XVz^ z-7*5*6vh=`FKM^gVS5@;Na?f6A8OtuXO|){IryMf>om{i@n=fy|2$Iy(A|8q%0QSX zHNZI^7gC9{Q}koINj|pz2tQ>WrSKIjD{t0aInXe-k{g3>aS7=#Y!F<)B8M~tiTUbR zkg`6MYy&uKzr2m04Gb01Cg&1!^9^8?9<1+6+1Eq4laO#h1oTm>h)YP|Jq|a(2E;uX zz$cin`(lEwznw(20F3Sra?p}cYdf#mvv$U%Yo1%GE@FCfSs(lIX+@XU#q1X`4Ldx5 z3MhkZP}CZb9}A)l5hu90$I;nLdW##42DVC}hV4wX?mJU$#VjG4{b&p1^-))=Nx??% zoj~bH@O)SE!KDn}F;7nn9wYmbVhv^GzHMt8|2gT`jsO4y z_x06u`HP2u9e9RwGy;PAO=7TOxF`hRJliA`t5&K2B>$$!y8UaB(w9?&Ac;g0rxc&J zWx3oo67(s(L@W`FHZwHW%<0MPdRX8xKqx9VPI=n~zmrUdNs_~4^sYJRS>`QC%=0fp zxW;@R>vljyzc}q^Mcuo$zy9=MxAVJRlJ?aeP|jtVec1m3VpJ|8H)P2BR{PwnJXB1d z0wf@~%lb>k*>3~un_wZ{$WS`OFMcQHzpoPzI4~RHIRqnJtsn>ktroR?;~)VLFG46v z1yV^#m-|}Kh>O-B9$W55soxKipz1|j-!R6$BNL6yb*S`~G{66OIU;lqoi+8iZ zXb@Ye<|#fQLUFN9k&xD8V1t!c*`J&&4{V*a3C}O~76Cyx?yw|wQO9A~*-6LtfQPONqn+0i9qVq?6h zdW`}*$w%pcWSBh&f{h=O_0M8}uZtdT|Axh63}L!)Zl=ujIuA#-vk7#5PI6N46&!T^ zMwn&WtTl6=V3xEt;UyV04znYINO)k`8)KhL)f#9lM1n^}+>Nd)!}4a@+D7uzO8-Ex z$~=BgwBT6tm0Cr!*u>nbM%pc>s!oL{=Oq1@q8^E#j@1fP)02ncF>)OB#}l~TM>{4> zCSsK+-}Nv@q>h+Oex5+L+y_tuiHT-}?aCWF#FaDiM<~AVmhqYjjbwsSa*~R6?r^T~ zC_`Se8FrL9aDr-tQu%R6yegPT8pp;BHZ0cEAjR`dW)zECN5F3lyMff$1bQWM7Nn&n zhzIxgyUfpdW1lbNAbnLQuB7QZ9CW_WSpo`=K%N(+od0Kf3=uR|W(NnKIe3!|uT<3; zCJCRi2Z?r+(Va>T1JYr8G{g#aq&`Wfp97YL1@hcpwXYJRLWJ2DBf{&gb9)&PGGI*# z7Ef@n@)apVSD0?Z$6_&s|GYT7EA6Jbo;q4`VyVp$f*R+13@8j$*SY*7l#=S)_qyL- zkL<1m-39*lZEB{XX#ITv2EfGk+z2f&dO?b-7kyHc$PRX)FP;O`qYj+wbOdzj>`gTH zg2H;{mK*7II z(ix}{$MrjK$}BVBo7DJ<67&c&AlGhs66qq7wG4?zo>aQAa%9AeFy2C}M#Zu6TwciO zi~-{d%L%45u;8NnOo?X*!f;8ssNnjmIfLv8)J$;b)k*N!9X42U=GamT4fp@Bhu2BJ zU9n31Q>RUnkzk1^hqNpFlMtLkSFk@(ynwDk2ID_+$tg9~fha%!?qj8!PIRRHWIi$xjx9=TFHE35D&_JM@GZ;ULW>&Bwpazgjv zQf*3kb0|f-kdx$v9nKYu0|Rs?c6U{LDHIlf%Mfjj*v2h77&atG^dFt>8-X!(zeVO0l&&&9Y{@Ifk+Mx60y-A z;^yhZZ$-PE!JM=7S`(DNHmj zboPER(8!w3Ki{-2vJH^dG@Whb621|pcQT`6x9|Kn75*$at>@Q>*b6Udc@yyU%IIi{9>lpc*NC{9tJ<+R~r8? zljRwNy*JhqT!`W989B$Xl_946(zg3jDM0*N^}D}qx>u78ayX-#EHP*K_U`$p|Co%dUqB2O+`cH+nU*UKMjfDG>LIlHK zv40&<6f8r4R<{ht|3d=u+r#hx}I%5t$|Q+8dS#U8Yy-g7^{}f2e=68{6UZHq8VJO7z4y? zW}5(F!y|h^@%QJ>U+~Z4h1Da0@I^NHc)s%fC9BE^H90&M{RWS^M6#1HmF`1|J~#?d zY(+T-qLfoW!8kwu4_>X?BcGekJ7@UnC1Ni__OrYra$Z zSR?f4Gzy@O>!NajXphsV5Nl;2e79FOYo-{W`0`)enP7T>^4w}Snkv>iP(!=XjjYrR|;GAiwb$MzOU zF1K=@R`ElyH$8gOyH!SYVC|bLqK*3VK^G>!y!d}SH7fV#q!)@%?LZ`WtFnOzBUF~O z>FYtu@D0G5IOG|RO^SEmd`U7-1r8y<^!xn&%rj?S} zoI(!fnoZ9o^S(A6uO~)TJxz56^qYECk{f!D9P0_$rcxel6#=}RmUS`FwG>>Ps568= zEWHozuLb^Pa+tO7j{~}_(!Q4dgSr6)FH?%r-YJvHyqv9pW@&dae?DMa_4n2wNPT3S z)T&AL#Q=^)YB1p@uJ--7{~4!2`B_rf)L+-pWn+n<1NRqriXkioCC(GD%S9r2n? zlrBNNI*BdOm=J*g`!-ddu+RNzgJr=ib_ADC$33vl%!+gu_6f&gcp9xM$*SB8p9pTo z%B~#P05d?$zq0-S0X7t6|KL1D4+IR8hV+#hVEo-j;0vl7hBBGWY8s#lMMUmUt_Oy>`|4h zGxyWNDpmPbc-y$0?W4sCA@VZNDNHpt;9*HH>KAGav(W=+kvE$oZtBRQ^Iyc2S*K7< z!>^?|g5Sa2(*px54@`-K|KRFxV5y~^UZE$Di^+?r5x^xlDOgklrDCELF(Bg%mb3m1 zZ2`PJ8%D`br@>Sy1{|-Jz57!0bd`5!Vv3)wMH@G!p__5oY43;6m7LV`PhI4N??ZDljKc0B4hr>NO+tIo+<|XEg8SRhCV#6RS zM7c%zk!q}9%`}(=29w2iPml~aitlw-_Y^ZZfoBY;XGP~hH7tOc6dfb9C|n{CjyKVn z4(O7@r$qS3b3Kl;gCyOxB`-h4(VrIt=}(c^M^mdClGY@#^jQodkmAsOK?RYV)%(2! zZ4mGwzrrCP6f@O)PI~CD1`3v71U4nd4O{~MiU2D;$cS-BOUaJ^7)H8~WYs7&ttO>I z8Slz)H~r0W+z9BM8t|Vi^#SXh-2z#ErbeWvK&CZ+Zi_KZOT~XHophC$v#C>5D?%() zYlA2zFf`ONSOfT|#uJhOwJMU%`dokJI^25>KH6ATbVPwh>1^CBf({9za-2$H!;H4={r zsC;JL6|!bFA3N9zBElD$wwp;`D5Jp(#6-FM!yNTACQOU)_W9`x3-OKS z4Dvy@Ie=TO(XcjlEtvBmAlQCkMp*2hT=kjSBV(J=AklJ<$sY&%-LPCM0wiv4d$ zJhI$!__9qn|WQz&aL(pwRqa$aj>iZ6JX(l8Ng${p?&KJ23>>q2Xyh8&AJBjFS zs|&3=_J~Nf*>tdm@sEwXRpCbGoHGMhflbySH?^fqqBMfG^h%}~UN!H^w@ON2)n4v7 zTEYHD(=B}sL2s#42kp)@08DFC>E&NLx6$v9-}4|9Zt?DiLV7dbM?JRn>*D0&8Dt$! zwpv#dIO-^Jh%cQNP-95AODZ9cM=x*Zg3F09$bTnzlm44cJ*=tecO3U&OK(FfROeILE-uinl0X+f^Ny&IFo{bxG*R(Y?Aq4M_`X)@J&^uyat6X98yho0 zdW4aEwX8wiELjN`+VK{A8N%mFzI6(v+spUrCf_vCb?6*Wmerg*^wz*_TinT{Lp+m+ zPbPkywpNzWl%=sS1{`jCg}{CZ-w6qxbI|_^4EF)bbZnbt+fwW5w-xL(KM`!-=uA(^ zCBM2HIS^4ArKYJE3+YVo<6KvOhPX#l4&oJau^oEk_)-B1xN`1mAb35!roO=)&DxAf z*zFe+VA`@Lu#^LvCc?|S4C8VFAL3WK1_9YDl3Xh-!gk726eXVFGh2RBEof_U)DxMZ zT1a*RejQ@JDN-*_QB3;fp(TPEtd>& z`HblPQ(q{3tZIH3V(Ofu+FRr8Ai56{x&_6d=B6Gv*k^z=t!x!WS`TsS4$2)}AU&ou zZ0>wOrC>}QP%)UBJrXY_c1#Y~Gm0lIw&_(0$!a>`?L@@|nVg;oA}PGR)-E1Y!U$&` z%V@l@39lC=hGZ1|MQVv0L~pTOr|VBaQ@Om;-^Aivb5|RH4(qa>bN9^Vefc8XVCfVDbsELNsI8Q(ImwTG%p6(-@3P zz|ot*`N$s?ir~5EDOnZEXTd!ssl10+!J3S|nIkDxoSpe_en*w(06TEXQX`ws`l%Z6 z$GeOHfG1MEkwu;{F{RtbeG8H-Bde)z5Zop~6a7|c-oV3``J{)Kuw9xVUoyUImydIE zbOGyGa`R^Yd;2DuX;Tf|`AgyWweB=4c8w4oKsH5p|xdcCRiq6 zb1yx5#T>v!+ZdzLw=ar~Yrj^qYx?+XDbzL6KD7GWZ8pkrpgz1=w^(y0eL-G30Cf-7U_@$IcD)reV&*QjPj2ZE3=25d%^-woj(9Uj^ z=%2J@_~eJ4PB%L`T0Kw}^%{QSCsu3?jl(6>bRT(Lb*&Sw&~eB-P^XU6Sp)+JP%EjO zu}xOn!z5wc`OE&p0C+em|`|ybDa3R<2xrYX0L=RWH~U?V9O%v=lqL?-Y82D_l2)r?}(J z8v@+yxnNx}8>@7IH2`+7FY15(IYYC(>gXeCa@)I%h|zR4%W)(8yScu1DlwYF>LQ#1 z`sS!wH1QRWi)J%mmN0i2Kg698Fw|Y2@?uTH1O$IxMqkco(!yiL^dTM+t%DOj zO*v#F2~BG$%d#hHa7WgwPx z?#B6JYcl#>PCp2jPg78UqHZCYP650#Vo?@r#tlrd>l4|22`@&-4-AC4 z_W6J;ZV!%#$zisXt$$qbD7?0gtiCc~Hij}Vwg^UJcP(-rt+t7PNVw{U^)c2Rk`#@0 z`h5Zxi}RB+K&t=s6#DLj(K+WE@dC$jl5O7qe&)_8Vzz5xIqxY&qy_Ebaoifp1cn_d zX}sxc^U9v^-Kl`2MG~(^>dmnhYUhkWLq|WuMC~mUtIPH#x!D)<{L_)-x+vCzn9V*j z?HveUeyN;v5dKYmzo7P(>n9|<%xRbLJkS&&xVYSYRhb5`YcID4)zj& z+d6^*VKBZ#Nv~5?dy~QbcIld9!oB_6yKsR0Q|R2iIa?5fi7vJ#lK+)eny<+x?s;$~ zva?r6{y)pMg3CI7nHu9Qj9Yz$1z#PrW|IIKpJcg-d6(UZY0VJQe^f7|9EX^1mh+I3 zD-}L16H_$dHRgMR%!J@O)9uMWc*R0V%HjF}LuRfTrH%g@`0b_+JLUTM*PoRqm)Mf$pg+B zj6txh=nrAB{wK;pxtyya`@nMF?NO9alx1-ia)juGWW2cJkmTE})mjnUN^Am(D+5Lt zJe2T9Pl;V|5An+}fSprfE@!{!YQd>}#X%N3!=;}HVp_#{+Ezv8U(l*RG# z=2spnrwu^6I6=l;1w6H35R ziP8G=Lu!NHSN-`{XRAap4`<+IQ;ofUdt4Rd?PrU^@;#kUWdO1;CQ%67`gC~KI5psT zELIm1&7`uVbA#W8hnno?QV-?)z#fi6Kt32wN^H5k+R%>6-daKxLGH5R`!HAmml{02 z59#X!uQ(hFg{|vd$yC`8z075;nSv-+t$%rG;c>`%g;9y5XJ?=&yzU>Irl$xUe$k zv0eS6>G6|x1tBR$B8@w{Rx!waX@3lqlY?*_ZuAu`fWGyPg^#3-Iz7Qlc|PWRW*?RQbSYS&foA zE4&vXX-~vM!aJrUnK2gS(l^!?AttSDm;xV=YUxo!{p>=*fZYPH0IwzLA!SCK&q;9p z3f1+LY!SH5_7)eOW-C?$Yi4@i`Iya10nI3Ve5J(%9llX}pNID6h^oJmouT7owCln# zW9Iv(C{R0j3C=sy943C?@lG)JGPLO>63z_nwTU!GU@8gao2$TF2{-#nrMT^j`IfbU zCX|WfZ&Wr%S=Zee0o!PUE3}gk<;`pJ1be1Qh*B4aPkxgBXjkHl33&%1;oY`*2GEDU zGyWjivV6E;6Xv<1wis`o3hcXKg7(rOiTb3br^4d9+v>G2z})yNemcS))5K{>7RK}^ zHm|~*axE2aFkl`LBNCahGoR{9R^Z7R1D>pnX&_iqG$V?F)a$p0vCUm7b7oJ@(XGY`732o3&n-bY32t{W5GNt;gHIqd-u`I9nTc= zY8zkl+bptn z9mESZZLzPd{xLXeJ(@4%SwiBey@HM|%H(BL?1 z7NhDw-k)SMJ<5?^6Tb^89mcu{52UcE^l7J6}&5Cy`hA-k9nEpQ%;X985d6bw8Ryp;d!gua^JF$*~OV50z z2HUTH=ApKIWc`rO$U(ic=Hi(X&)w+llKW{dWc{*#Hw#0w09S9*!2Ix4;j%mifMXOAy5x zd2wMo(?}b)LDK^#)4<8=JF+rg7POM&dvq{yqBe*w@6J5JJoz>XxLo5kVF$ zDJ+9i=2>Sva!E!%-Opc6LhMkzKmY(ig2+P$<>gdzGC(B{KyLF(BdAXuo9c|Ye35$9CSNqsJYbv~+ z#DNy359PfMzi*|Zs05(fM`iy!`dEFC?dm{U?1yyLPe(@bO)87PF>ErSmPt<3<(m%&guh}82z@0)Y0 z!MKi`$!qX(^T}wYaAZ#C(AJ^VXXA*&>nLRb4Zf`%l}~rk;2oB7X|XY!07D_!R*3eO zSD2lEkz2=}`#Qv2E#flk?c1=6;jP)1Ff&9@6p_g8?z?=9M1qZ;%n9eN^qrCB9GNok z`rS2NjxqfW1!|%YI!OL1c0V53n1e%dIP065c2JTQ15B|V+Zp;792-s{?kvZ z5R~}x0sio>hP6DGw?(imB(hmM=2?E0*Ooy^rWC^j3CbyMr-|pNRzf=c7A&fbJmZ>x zgsnw4jp~xdVAUb=2y$eyyDx}S!x;)M7UNR|f?cRxIR@0rej`#GRukO&BKHcsX znZVK|C>2@aoS3Uc5)C*la+j&0nfAM<(H#606(|t7#ATmW9)uKz)6>#M% zuD9laPZEeANIGJmgO+?$bX`GILDt%Wq=!Y1M<2?^(tDKys6*EQtN!i4*A^j90ceH= z;WhTc6*kTfQm$2gE|GBQjTK*`Iiu07QdLjb;AdjrF*ze&Xp93f%N`)4qBmxz9-^vMNNX- z0BCi{?0tgj*U)&}f_D8GVQAkOP8YB_4mHQs6*vG9$=*7sjtmeD52QCQ%xl-^XG$7M zHRZP9qw@@~B5!}ZkK<4yzK>RY97XLZSb)T0P_O7X9j{I@Ei4i%620hc(>7+L{qFjM z@~ORq^YIq29@HSSkqkBbb`b*de(9`jW!UX6lO6++WF*nI`&Rxr?&E&bwa$DeO%=9K zD>zXV(ME_N&=(#uvS{_G9&ckG!hbvJ-r?ymXzS;-dori)2+-{jNUwL#;^l(hek|ua?R8yO7;nwcz8r@ za|Y$z6~5-4V{GWuj=6b%0l-+9XiHytu3Oa*4;6_X-2&c((hSO(DY=8A2s3d2U!zJ3v{H(Gx>^*Q zt{skdZE4OmP>=A)03QMC3|;oPIXCY9N(NKxr-bWGjNXkwIbFWm3^jkmI;!hHeBGA50-c;Hg)+96&@oe_ z_-DyLQ*0`sq%_H}93I@TYYqmnlzMutJ_Sj0A6sN}T9NhG<;b<4I->fXECen^h{=gZ zNWC;Istza#oP#5yGl~*fC0(-KCvXV`$V4$C$PmgP*S)_=xk*a5u$97^uvB4Dfc6F* zo5h)0qv&%qszwEBU@L$@8Ze9HoF^$nvk1;Q(z(lh z?ij7rvegGG>Co*ho<2ch*MF7L=*5+5#LPbg%EqqEJ`T$usC7eIy{CUI(J5j{VKd6V z8}h!zkLMN`Rv`Y(1R^O)HsM>SdZs>wG)17x7e!N4`d(9_f4rNqX{IV-qqy^Rz^e6agoHFiA?igS$ejvbF^nC7sBBi78wS)lpI! zWR`;_m^l*E)}$ANQt1M*%2_e_WG6+Fiz2=Sd;=Wp+Q8#V7*~ox>PJMpXI-o%eBd*@mSOaLr5xITSDX5*U+XCTpcxGaVBO(#a`79)?9 zSY(Z+IT{e2q?A(3$1SIghjyJMD~Zpi^)Ac|#KZ1AwS=H~aki*=kX9ad(kX%Ng;NeO z5H(eWHmYKON#w5%;kdUPey}=~!)0b>mpB{rlVwSLkmoV>YZ&&6)2gxfcU7J!&| zzamSK8^7p-_4`U4#aMcCelUpzT1v1-@gm*ZA*C?>%waKki>3j#<)L==vCNcbMZIN+ zysa!sR``U<_t?sU>&ts+R?m|3Mcd1x>H8-5xoA>g1N&f(p?bT?AwV?&es(%@B|o-#4%0wnu>6=t1F^;8Kl4`8XoKjZ>Y z9=CYg4^iB=MB95p1yZ*+5)y803^lWLOky5j9~Lm%Lo@Ry|~x2g|0u z?aP=`#<<_o9NjNY1%V+@3D_ANSNS(@{b@aR8Vzk=PItBBYQAJ)BH=?qWETZ#a&4c2 zMee_qC!nRh^NHhV{UY;`KvrZKumLc=@J9HnV`qO4%2JU`wsB59|L(!uxtT|&pny|i zIB+ImGlKQpo0wk_6?u%3+G;Io;Eb-SvhDZlut(2-~AYeXC_{;Ab=& z#MMjes~|$!3XA)ghp|um9yI37{e_gMs}+^Ep7-2Y{_@If=aAC|-GvjzmD#c!4~h5a z;+=J{6lnS4I|lTzsLd3mDnWv*(5_;m?D3ww^aQsQA8JQ=$Z7EK9F}9c=C*ua zRL?-E+5L?Zh@H@O`ik6!x|pn&1}H&B1l>JND4G&k%PW~k8=7T|Ql1bbBL0f%Om5Vk zVl+6HCjmJ|T5125Hn$V)n~dtP8?un~vh|VrKaPV}n`n;@SbX_3kPPR$guqA&C6b}W zmR0fk=mVmEOx)o}iR8SxNtF~u9L9cYM`>^@Sk^ck%rp$f z3&-MhaRrkNfzh1OAx?800UhL{@Y4VOu!Do0iOZ=ffyf{2;qJIhE0G<1zfIprwWRlO zDdwn8N3)9mU*YfB0&Ti_jkEBvK&)XV;p~tq_P~Y=;BB@`oK1 z{<-BRb-iqB$|em`A5f&*1yh1Pr%Ku~iD+QoO-+ecamL051H}`XVcIOK8uisbZP1-K zAT@yUxG7(1p^=itN09-ee3&>1tytG&Vc9))EQ51hQCXd^4}CbUu%X0UpALI!klGF! zoVKC| zb&Hv}n+ZIlk&1u|I64yrF-=PU@CAq~?(c}ZUQOdvH5l1=M#ikMtsuj|*-`WjFe$q~ zD!pM0@y~O@&W$L(s`WtDy-orwq8fF-^+61qN(2Ez)vbeL#2kI1s(pV(CD{>)o0-c~ z_;PcUccx4Vkmb}EqW|&vY_h%ML@cSIr;qD&{@;w~l;B_x4O3hVV>pX*CLt7T+gAGH zq0FFuA_Y*x+Nt0P2Q284**A?9cHKBo*^Y_i4bfyX)3N1Fu}Z{hZ5$-J?sUEHx|LyP z`*TcXMUcLU!&Qd#7`GzuvYi9j{kzQo3Ifr4K-U=Ocz|RV8rfx_}kGEf7P4ToRc+R;{EF9qjGD%0`%mXhH@8Iyaz(|}m452`7;wYCLubqQGL zQ85Ww^sagL4fb-c7L0)v{?8f9fi+) zug=X@%U+U_+%o@rjlxWj9NAF-Y0VMDgjr<7_&ImmM*3`L$KLrOxr5FkDGGdam3hSqctJ7T*&NNdlTe@dh7sdf*=nxh4PK+X(FlZ)Y~Mm^K{k;_qnv-NZvu zH_4n-mAGon%570<3CUDlm=!js{U{;Unaws2XpGK+7(s zayTN82-1+B+sWWq!E-039+^Os9ofEi1n?dzJgn8RVsT?r@f*vI!d%{HrS%<@hno_0Daks z8dEUA5StHisF|ZGaE@a?H!x6Q-*aY)3-3q0u#dKOH!+A3yq)1X9#hUZl z6_#xp&R&)DQS}taa`3chn<5>Qb0en6YQn@q6@xxf&>1zw788 zm81edM#2nY4szy}(%e=A^_$N>W!J_3d%;5IH5=KIBdVdgJl?5q`CaB>m-5%DbDZjl zJb!;P!X0oOsLAmileZAA8e#SiTRW> z;U-HPQdi?1kl0i&(FWOeXA!EAMbQS!1*lF&FdoyKEF3cegX;pd_?ho`>$hdF7V}gC zB)@0%XT5v-$(x#LIDsV*KB$2*B{)I!rz)$V{G;Q+V&M_dYHH&erRgnyH>GvF(A}!@ zE?K7HN_l+oOC@4y}lD$bvq8nfqrH4xyJ_L?{tFGq<}!6gAaMz3M8-i1GU`LO~LV$gG7 zHb^EvGIwB(bz*v5m>(9!3Xrdwf89Pp5-~oDeJ~lInJvgNIsmGqM41U^5C-gDKMgCCsbc;ME{&$ctTOWpM99Tl zVjVZ;J9*FfsAMwEabisXa?A~>q4xa|>!n_QL|tEQrsXG>MF)ett3y3^nHnStHE}SeNrTtQIj*gq3~HDRmXZf&Gn(CR#tF$KTO%HcvM}z}J23_?MMl$p=dopW*CQ36Ugp;c16yWh9xbBn55(rM@l5V+5 zcNL*_caF*yk(Q;K2V|DR%1p7#SGdi~5urb>SG$=_o?Es2SfoOEw-~dgQ{+3=oCFO| zXY}}CTN9U0^#DZ-q>rae2>6hWGjS5ilNMuEuno(7w$lbG*=)K%MQK!CP*)Y&6FPqkG&~)sBJPUQi;!IN%!b`Z-2hHXd?f<@{ z&jZ?7r)cvhyuf>y+-)~7&L}#a`F+rt)lH=)dMkRhuK>ROdcJou?cg5ZuLSeH1!M#d zDeX{1f=xQW%RdtdFt>HhOAV*{RvCMi#vunSw`%l<*QBKz0{5 zI!}mXJ2J435LWX++~=aGI5|_E*2h&aluU$#5mT>IAixI2 z2`k8i=H)In2>-FZbhEzaFNjy1WA!~fwi)|RthHh7qtLEgv@e&dpKnGlZshce?DLa3O zC_ig1*izO#D9i=qf}4Rc_mykF!v%peaT3@U4b}=c_S_q97dhbAJ{~MP*uPFWVOu6dThi4Obut|+ld{?ttTvcnYX@dR9MI}Y+6}@JQ9~Mb-~er~+!OAC zvU%Mowc5*ynTwb>&Hr0B&EH8M;?fB?osx8Xzt4CsJ~uVto+E&D5V9GbL6&jGq5Z=4 z^I36gS$R(jaBA+AUjI}@LOafI$HSe_t#H^dH^9vK>EOCx^V+jwc?ve4uJrlzsx`Cf@f3q)@PKT=8XMsl*LOq<`5)HiJcD zgC>tMefMh_O|h(As!~?&%#TwU++n3YY6)?*(PbjU8bN+KY_IzBW=o`R{aQF(%L!@p zl9abfl~SrK*)&!aVY7zek)3vG?ZMIkfd-^bR0fDoecG167r{2=qN<0}7;fW!@s5GI z*oux+_xjk50ijWaks7hGX zcy2gGd>Ez6bKg9xgK%ns(!3gi;9%mKfR$ z*Gn*P_cMv(irS_w`=aPD)Y*^#2pR}s&c`jRlA;M=spUj58ZVB@PKU)QqcO1kU_5Z^ zafy5`CL}AHS`PSoo69A=v$s0XM|ePF`$zX>kTq$(WVg?v=-E{jF3B_^~D!M2V| zORis2SDLzGEoHQ~P76LvVI;7H#IpdH=d}1HlUrbS;Kz)q;(VOY{`MK3HI~`7++rh{ zo*V(mG)^UUDw>d1F73^s_=@(3rgn7-YbyEyN&r>6Rd|;R`iyni>OHWb4_=_xj#{_r+~ zz2DVT8T4<8qjc?7g6}L^nDN)7v~VyRBGqFQPXv#2H>c3yv(5YKKv>A1+i}qBAv+xv{;{m-T7RsZtNlIHw+mKM!~le+bz@tl)aFThI3Nz z#q95t*q4*&h*PC&|3Yla9aG^Cghee=%|Iw%O&R)x35 z99+328f9*8oQu{UO$WM91YD1wauPb&wzFXv3Hsv!?_cNGX$p!auHqdrFQxv_KE z^C^$O*Bku=b$@Ui)4qYTSsPLs|yyiKA79-?fQhR=2azG(i6{3zo-tGug` zDc;~$W}r5&?(%TZE*l6j0B1dfA~|Toq8O@1*{|Xwe{+4~`CYSzLbl&DAs*?C7yOh; zuSPzu%66TOn|mIXHR|%V>CB)*?Nd* zfQD}aE3_33FeM=VTqGHi*3YUAFkt*M6=MjR9?K&?DMB-=Da_PSHTx8UgrFsaTP zyo+R>w=TT7?~EZx&Fs14Mr(;b?)&p@%ms|S&eb#sk(%;NeGX;jSpds^atC9FcHN$0 z-|)zsNr`kyps;6f3b*fZuhc(#3#d({wNufb9^bLb%kHj#7D$7NT)En)b@g;gO+>p) zkj3_1Z~{aRic|m{L7eYHA~Fp25}}+RJDVyt@>9@X`{P@g#;YR8#*3|Y?Sp=bG^RKv=7a zsRU+@d3R%CS+-kohGb`KZ%{`WBqsNO1TP6lEKg)#wdy=74-2hu^!{jAjs`47VoghR zdh==|)yB7$B$Y~?ck!MbaQEn$l~juuTXgBMWf){Z@IQgzsTAa^e7w1kuI0 zHU_t`D}*M3tD6vnKm8LVr2dMN(_5>0WIBR!qY=j^M&tb&~>Ut>UTb4;Z zMCt3H2$dibWTM%mZ@&^saJKnNUw`&RMuc-Ezpv$*=0a5j+t(hpjIinLfJtB+z@gUI zVOHS8YJ{pfO#RpN{S}oxeyi%MDO>@MK@?Ec9u8FWaB_7AA+Y~`X1X^~iA3#R!Q)^| zeT_k;R@CyE2#A8zdQ-tOhtjezlCL~~Bx{ip|^YFb88 zkabqz-Q66BfqP+krPD&4-+4Yz0(}Zzp!?ieQ` zO^GP^87Y^d+l{#(M`RK7aAzYsE*gfjQQY|5mUVU6Dp+~6$QJGj1sPTL)+~545l&+= zoO|&*j@8Gs^QGpu?C0dU5F*w9dDB(vQ4?3aBCb|oh}ws*c#}UoRvxSTweKBbwY5yw zCPm)i+cy+g$ecLqvM|+DH91YnYGrAjSMDsx^f+2SvW-k{CszATg-DTc608tw@DIoX zq%83yjWn)__cvIM{6@5_)wJK|l(kUztwkdvP$U)Q>@n$@J`UG4jM0yMzQTvE z?Nyq5)TsiS|KN*E+q-^H;LfHX6hHKve9fn@x|v$#pVhJVV1@{P&EhIu;VI2_Mo@xQ zK6(F*tWTH(l9h*R-Oqm(u`aXg(x!9e1F<4!bk%~rPp?Opgb!9FEgXRx{@1>?ziPG$a zNP2>HP|>WH>K}wKT8cf6{hB<@_B({I%<1>yZhF3oLIzDZu_iBIc{xi|V(aA~bIxct zJTYr|V)U8YX~d=H_jHz3Ws0ksOLTShA$I6OX{+48T+X``{;-H!M@a?5EUUZPtv}1b zHQH?7L!aTOmN@Crd>gM{Rk0)-mEa(Ky#u)Oc-mEQh!{b=3+H05#-DfN!NlpJ1vuVL^9l+** zaSL=c&=MWeoy!MxK;v{^@ zt&CrP;P4Ifus&Xl(kko6=?A)>dHab$boUE!e~wc&XS%7H}%(zT{>c2e2O zo)1+75OeHERkz(JIj*Xg4WOT33V7(DnDgwz8P$K}aMY!mhr$ex%^cAR0k3J2*b`|1zT3x7D?=PYp)?W;iYW}B^oN=<4xu^DH$Tlv-co(l-*Un zPoG+mkNQ9ML#twN474c%KY%eHG5kcaId^a)xF(7&#ZBAo-i9DilCgOFt|5$if86lS zT?cMF;8~E&JY@i80jR&;ShU}YCwY?a)fKnNodiDLNlTH&Cp;P zQ6dflEIW;Og~@ytO^pzx#ozxBa7`od6i`f|a?7&SNwsO1WQ?bi6iOnyl@30=EAI-Q z0FfsnjXOU>~#$)mJSiG*l0%FE&E2$gf)Sg6|nLxM9`NhPJp#{jlj znt*N$6K^4v?lkC(x~)Ohh1O;(|mec<2-cN25(5C-AqPvb99l$$na4t9O_QG(|(j zeIi}=ySL`P6ljyW5$oa5Nhb+59OB@Qy!CD>@MmC1jlRbFt)`OkvZL?-m3_VAXtTe4 znFffE)ypCMjmn-pNI;${spGlml>^CQD8moSqreOzO8 z(HjJ{$*Jk_IONOC{;}TC=<|1n@2nZLZ>1{9aESF3O-qbun2mL|g2()&kZ6>!*1(Rv zi3dK)Nfey{t37|~!`7P4vEueWV}^nTa|b2d<_<;&P*O~c=6)f@(W~iC_;*(FU_nd% zzY{7dt#`kD4?5x^sF!69iP0lln7D1H+^A{|n*wkl|plUk?1n^OgsVK@sCnWxs??kz9m=uDHWb6!*z`x?pf!i=hWCy zEPQT=Eh~2hmDuqUCv7Nkhg4bqqL{!;GdK*g%%;IGz!h{djfHR3!esFbxa!4{Fx)2F zgLtW-F|;!}CiRssfF~y72f*>pnoBf5W05Uu$owG;A{3ae5R^AK$JpLJa&4ws4eF(P zObz{ua{)BV7dTf?LzNPPfX)u6PjumCiAQN(fNJDFRmv|zU0YDK)0!vYnSwZJr)&A&zT|vFS!FEiL;n2|7m>F9XxN%!__)T3?4ZQ@ecG|WD)Bi)KR(O5O|!FqlCyY>Q3jS6TzOU z6+MX3nL{!wk}-0@R#SC4r@wx1-5fbZ!N$tCj&4ns5s^PdH^2Y(JS>|BJtWkY2D8(I z#ol{&GO+ANrGhaVymxh-2$`;Pw5rY}wOu_}I%dxlEqLE_#SC&$-U`)V z_SEAI;N^#OD33DOH=$!S`$>j1#vI59GO-+FK2srstD=fxFErkpbgLqmdHLLkGUG#L z9uuuv3_Dus_J(){!z=lDsQ)qhM`>q8Pr@c31xyTbc-vE93)UKs z%c0Z?>|9ZO?ZpjqfL$MJ$&P|s$oDW~Zy6gE%}u5w2~W+;j1Xkgfmd&&)kCZ?G4HJW zvhpg>LMfk*qux+Ul<8ceiqBU$C?>b7;4g2mlphE6;iXxQ%1xh%tlm(Glpx2Qe^Z=Mqk}&LExXM)p%mM z=P^Jl?V&$`Rk9S6d_n(W-HQx(yporU042a`@;tJz8(2a*$WQ6Tho6dtVn$jXRl|wN z)xXr)4EhupB9v<5KtlutH;sWf@2S7U)@lw)UOWf>SrL^*-9H~pj9JADq)}`OpF~`) zBCXn03-U1Asa_nx;~x%3~+tk;@C!}v5qme8Ba zBlM8b!{GgUsES?6)6a18Z}PGfWz19{-!{JEu|X$fKlE#-V0E|Hu{#ymrm}S)1T`{I=EExx&&73zB1i)erB3@1rriKAaq`#IU+egc! zfc zYDp@8F6bg=&BNbdA=v{CJ-W#`g?^So`f&Gq)Ekx1#G-6z!LHTYrj!PRqXT4Sf%*6- zBMqq~9sarZ`2%@5bIDWW&XEGJfdZ69ZX2^BHc>_G7v{A{Gs{Wy{zwVtKPZcXb?lf; zQ{_C+1_<`|B<^I=vY2+E-mdnshJO{Jz!2Ch)7wisYo!D^*(F4rhNk~_J_Q{imx&Sk zN)Fe3Bz2*=1-~))es@|#60b+p?ZDT6kM&#~L)AYQ8(|^lHTxvg#w4B0h}vz5PtXw( zN}*(VpXq7pfAT|IBY&hdt3I3l9I5*uhE2;qfc>Q&YZc@Q0!J85j$k}s`cP}sauvT$_?1sPqj2{YA&`MqPaNJw0)-n<<-vSV# zn^lQ*KuP^!Z-QB!h|fnqip7j^7>P_Xdc#C5bngpHC~f1SLy_nc9V=#>7YSuuge4}> zj+WXsRU$zO_yquj1}l?02S-kPJ&#EJf_;Pw$ z3vG)lb0B0Oo+CYFf>HZ;^PnKchMuq$3TGke>7mglbNN|$MlU_`XR1auw{LfkFvB? zyQgJ2#Gh%kwsexenFE>%qMX=UBMc&k-WD_+y!LS9TTCU#ufhmP|3>oeEiBK92)*=| zu6TX19NOz%RxCFgr12Jav6T986zrEYGrDs-q653$B$Oi6zwk+CQv*K}M1_^iYZ(eL z{+j6W9k95>d1O)P^`lo)fly&5a8@h*E5sDK8s~Pksb3(eDooBpC}*8Qm!#n(De0Ak zQs-e&xKH0~;!p6_O}otxP4TR!2cMj?s(}z>PV5GO+5BsGpbuJl_BSWQG$#Zzelm7q z%?K1$)glsPq}ZE_o+d37zp17`E9alPN_ttryg7YgHP2EzO2l&OGV)@;hRlcr$6P_v+52ocrGd`a&QK- z)Cv%+9g?RL>-;nhiOq66u80oQa>X>9asBg0M2g`-gfTalDla1aYQR;r(AmAf(mScc zcNPqRkQ}~zn#i0JO%+j$0j0IQi=eXjh>FX(%c^YK7N4de01`0j@938c57#bHn#po* z9wm3`Y8v&l@~(>(iyI43b#M4n=jX&$sF5%4e~$;EdK^@SN<;x-E254Q46UKY>_8AD z<^(B7u#5xowzy@Qx`P=hi>#MmJBKLk?#?)D2tG(n1ldw_WlVdyX^kz z7*NT~2El3wgAMqQA)sD-&;_>n3@etDH2~^fZ;6TXQd^CELUR=%>xDlMR;&EG7p|6G z>TE1aLCEsR9Y?~kZxv;=-Cm*K?J8MhvL{zVSK@}j-nM6Qu8nBp@;YX04qTch3QnYh z?6*GbK$*)-d!#t_WZDK0a^F8tGQt9P6f#wpms^m#60Y|Xx;7gTXsJR{?Nv`10|o;iB6Z!*SHV-ZB{~E5?!r0+^-) zGn^L#^=@|Ce>iILNTvVIpYBVT>4qF3Jml~{G`h@wB7>Yo^kS6Y3Z&r|r#%8&8$`ov zT2`!h^+3fh$_lkS`c1`+f$mis8n1K{*lH=DZzcwpC++q!cviKS1%=YaA;&)w@sO+L zYa#s;arJNiEE8i0po=?%r@eFH)mDy}pYMPIUe6dF@>=uy5iX5p(Zj9SN9^30i1`wJ z>JhgSlB){s2>_TL-sUGOj{6N-Twc-XZTL4nn4GqodsfPwl=&rgUEDt+K9)5cK>G-F zL%i){66-mQ3}>j|w&!XY?FM2Cc2h`JR`ed(6QC)irZRbkaOYM|cIRcU6`eWn4?p@-EGxM}jtUEsj45L>W`GYE9|(P7RSn}w@~?zFCXCihcHPf` z^J3{+v{9Sw_|5*>NX{D3ovDSf>mYEAYoXiSn?L6WhoVcN)VX!K$&w7@ z9Vt1A6?LcdzuiM*>*{Vp`Scr;*z7W9lYMCzHGq!P!wKkdl>wh%|6?c!o@+eX4Y*CT zuitAHy11w*7vo$el%YOVw!=k>js>CdzJZcI$*R&;UN0Mqns17!s6$iXDu63~nv4&J;!UTvxFf(@g$I=_v zDV?!cqd!&p(k+i9xF!BM6@va-V8Q>s8A8VcHlgPn(7j^-im!N)2_~Qui7<)kMVj{` zmi0HLfLl6NFBiZAAtw-_gD}2K_6J24Mfo{xRwREtzJ9b2gr(1ZdFLY&Zt&qaE~#}} zMeO-hVjF(A9)EmxD;+a*M?u5mg#x5GxOYBtAU%{4rr7w3$G> z3uyysUcq@sWk_rwC9x+uh?ZL4Gj(B>-taC}6yDy~62&`LlXy(FIcxdu^I=-TWha(% z0Y9v++WVYLfk5VAI!gSw(kefnUTn;0?XPJKpr3<3ZN?P$Ml>BP+F&SM#mTSENa5*p zzdz+)sBx2Ynvgd579isvZ{N!0w33bik!@jvILIiPGe%R5FHs01S744}0sd zFGih?<04cdcHAXOMKX|zlTF35jH=P=ac zZbUnc9f?%BL0{Q4TWs(v-67iwB_kUzqTcppG*a*daM&fp^~(=+ke@3>SGs|s$Ce!m zk-9E1BH#}TTT1LnmM{w0hk<$EaRUq?ZmXX2e3#N5mZX($q}VpMm1fCz)N^FeXOj(f zAXZ8mxSr1@Z|2k8NcPH55cJHqb!e#!ohj(fxzvf0mk}sPwbWVBv+Lm8q&A}@1H^Zy zWT2phkF>nr4>qsR^^yb`%`b}kTY=n!xaJwtT#aVbnQovP8pL;F)8lsIAOH!V@&aJ_ zUN^bk!gsqK?{OPm0yw#+t7A|w;J?XWeA9Hza5uy0q`4vO}pvJ2urFu;3MicWe zuA5K;38l*F->_M;CI$DR);l$;n(X48XFZd+Q1XZEBUFOALdGl2MNe=&r-o`}_=`?M zhv5rP5$|dDB)9S}ZW{s9KcDvjiW;p3HIAObs&4!)jIGea>oQHCdTkTYA?m$Biu^3; z_$~A;Lui-&?U>h%Kdk1km}VbfVl09>D>bxCHKH0cvQeM` zKDUpOw3%kliNi?zZ$Toas#bW-fqFBLE=KnL+OYsb31~};eF}iAT0@ZE9zMQqbrD|FV~<$?97}WZw7e5jw8dk7**4xLLBGGCdssez&w|+)p$;L5 z#)*{XKSVsEZSvpyv`M$O!iCX4=i5Xu)UUE#E4ri314aJmd%b?KYh2&={5{s`b?GQ* zi5c>iS}Nb%{@sTL;m(73RHX@C;cr@A1?LYzvV+`!3P0k^1{+t>k_A9D4Qu6Iy2U&W zQS`WYP88Ib?qUG|4q*i~_H8|6Y()*Ye`yV{4HXZ%SGJ5leTv4N`Vzz3K9^>j?m|wF z!to2R6WPFL(&~p6A2v&3W=$kG)&D{lqn%?WSL#&vJKJi{E{k4=J=^}JO*igTJoZ@7s`MtoJ1Y08KoLhPWY)}Sa51Y~{h%H~ zxRa8vcqN3HX)1W4R1yG+5>H$!mzkb=`U+=1#MK5-Lu4g)#T-QI>39`ztkPtDu62GD zqx_jahPnD!FV@Vl0<6-_Q4?b-o=o?h)scKGv~2#p^moV*T%_+fIG-tWy+7oIxL=(-Om}BFQ5&^z;U|*rEnQQ6 zPt~u5b;uj2a)Xd|I6rT$N2&jzoVPXfp*x^HzP)A}^y60g#v4))W z*6CDR&(i+G29m_RTyG7Td0%}~+c-l|IORMJXd_9waypWaz%a3&uvFVv zNiK-6vaXUPEOgAU3`l8zgolI6g57^D%vv`h&}H;Ax9)-WAk-cDvV=zzL6dlz#`HlK zDcn6M0&(YsrY06po#&$JI0jxdi}`>Sx}kipV8A-ac!;ExmUX@=M(fn{rUQ;@_g~f9 zox~p^B=~2!^zcim0{;zHF1x2_ji;{q^B+H4s}e*yM9((&Z@ifvd$N(V9Z0@9PlTE5 zSrzFe*O!ZW!WE*-Pk4GBSM%DTPxkc#ercDf}EDYl|Yxg^7k`2^+onn(aHb=KZAwi(9a7SGM)`=X@?onUGN^ zK#hdq{NLGo zSFbt|krax;B$(mue@qlP0rnVA;4Swq?UqD}e#h_UAn_#OYaPtmGV^^_epbGuiQCyc z<+fn8?@(+Z8I;g~;!BH4ZbgQ} zc8w@nlz!TDO9RQU{PFB4&k}I$ADR;d;v;JAtl~Q+c<*!VGjhT+{y%ySgQH2Pn5#pox$DiO)1S$>N#fvQHzCCt6)(L(3 zk0yBSyXRM^%CJ)-GGR;Uncu6Y`KGlmaAkp=-c3IR@yXTT&^-Z{Zma59ou?z?Qmdo< z52~tPviy_17EVONv8*VXDX@?%st8{;?lH{gm12qfyJqHn&LulkZToC?aB>`ag!tat4g9wbb5N^&HiLxsLy+_Blr=;pq-|!&8U>h!e zAWqn>d+!+W<(6s+>y!WhV<{-1{FLTVyv$$l0EWPb8OVh;E3!+ixpZH0C>n{0_$IXB z+aTvPO#RAm9LxXHC**zw`M+q^v;0$j6s9ekElLX5u>$8cd$F1Di~=s)k{5LszJt1Z zk_^W?l*KCqF?$KVIGy$b8e@RO_TNgVBCN7v&~I*#S+bB;NXiZwa!frP>gXMD*UY;D01h~6tG*^f-QFzafAB2fZod+PhwZ+D(lRMi@~9{-r)sXrDL5w zI9uTkj~K9T$eYYW5M%R4eBSI}%K23CLKB3)L%mZ){VJGE{P-p9`)L)}@TF8E_p`ZL zNpsMOIrADyH| z>Vi5{Z}NlWVBf)SitW(=LyrAY3J6;N#qBvaEFn%qodbz*WI`fF&b z#X3fmrDZk3E7Yfbj0y8gdu@8k^6i8B8Jb}G0F_5(sp~uw8nTQ2x^oG;CYV$ev3R2dUHbRjfHJlc|+Ivbt;hhbd>li6b#0` ztXzD*0gsi?BFwqyYSF~SM-wnH*4c07i)mQb8iaBoDK!jXu~Z>a@cFJ(7O1Wk(+wO~4b7(O?qhcB*!VMqeFjhNp+i~y_+px6`xCus zT}WMWF9LNzw2n_&b&!#McQ~8k1LXiKj=COL*J=G~W0s?eJP(^~tnk^tk6l1uV@GCKrNTZ5GER+rpOXGwiC`!nP#-m1`C>Cw5Y zH{td|gX|*aXtZsS`2LuqZ{ssgP&yC&!_FdhI!nJ(a|dqylNa^R|F{lD;$*Ecz3JIo z2)>&FJ>B^Q)MP%9qTpctFxJh-ffw-(`>>u|=Z-QLTyCYR5CwbWX}z32bhVXwu51 za|9q++o=;4pNT;&aB^<$<0HhO@CWI_o-XM%z{*uf>Z4r<8ztuK7o@e$X23BuQXLq2 zr`Wg_cJ_43)jUByW39AL-2(4Ehly#ElA_lmQ7!G`s6zX!f$^K(A8~y6Vu6aJ<)`rg zCL)IJrp8O>{MS1gsnUMg1lUD?eYOE?rv6H!#Iyv{sES0x@mSbJL{$D;6mAAJ?9VU_ ztux7=B>aa}kqM{j?n3=|i}cQAc$aRA3g?^{vd(M*mptCgZ(BL-0QkkcUxN7UYFI`# z0kuXWu|1X1Uug03mDP6IVG!gPe#Z=;*!D%-i7`d#< z*yigl^ku`FB_^N*qgl;e+RWHCd8&-Wg}rytnu%))n6U*6ODeZa@%t~x&HT7@oCiP$ z;zB47WmX=-W-q*R&5CDjG!pck7kGFX3A}SXX{=gW#-dVsi`JA_d~s6-X$su{aVcUR zmPT45Sp!m|K-IA1KX5PvuZvnWglAL{UKW9)SQ6&k^#`Ec02&BPRWT_5; zTWO{67gd`mJ%3O}-m+4Xh&s->nJrR7Jp)9sq>~8+ZZn4{<rLV9{KfRM?3HlHbsi#r7tWonzZWEBoN)raT+yLX zLIT%tqt*WZ zEs-L+P0SCz5@Scdn_vu*H;O+~yqB@_hL}WfX%_f<%aJ6)L%?F|tP}wPNRz|5LG8`GJ(R$zl2>Ry*x`+BPo2;a*;>g|?3`YPbZ_duTBCK=Tl8Yxo ze5`8s1J>%fLL-`zJp+ymQxQ;!X4!8$C}r>Ry=QebZHw1;@8r|Pajc!Gxx{C}<%4zX zXs?marhy`NdHl~s>ODiI)P!T-TvJoJ=AKmU?~B~5d;cK)CSifne0x_qae_PQgO+8!dVw5p0`P;wY3G|&v zSyt=A{l{jDX@<3MKxRVPCyoj74B^S(bTIPD{4(cIAI@k8WHe>-hg*uZgCkG|*Nw@x z6XEZ?7*&>CTQ#N7e?RA}m%@nwP_QZ=(LUSLm7@FQd^G06CsyDj-eu<<26PF{;Vt=T zp`b9Od}ea+!sVOt5lb$#bX`$V#~v|95jl~@tDGO`_4l3~W zHe9S^!M!`kX;^6Xv*2)}g0*Ir;YojFxC~hhB_;WubAiDy&*}M~00N+TU`eqVqpTwy zp@iGnG!G@Im#UKpwY=PaUK3@+lUem=5|%+?Jd#QDNdH?3S%Y2BH`Lfudk$s0omz&5 zXv()%p0{m8`VuxwhudcKpW{kQW$s$2VS)v zBAexo!ZH(m3ELqtCLg<~8bTB46_g{_LM?pKD^56dtoDi{B?LoHOc>|W0t&JG50Bs- z3L=2DM^vsC1pb%23h*UT#p;d5=4t>JIs8ReArwdZzJqofP8Mk4vte6k_8_PkGL_j% zfb_(Vq&U0*DlB#A&NT$2yOv_J0!S6a3^@s4iMZz65QP(SmQKKuqJ`VoyM($JB>Bg z!XRz&Qr>#SXfv%N{X^tSXd9Z z?%H*a@7?{r2c%fI`}5?ZqMLrYkxF8g$rE0UhPjV2>N?rD- z?+6_9KHvROSjovH`YNt(X=Q12WmsIyhQf;*@Mj8GSl%55rgnc@SSxam<^HzbJi?Fs z+xU$8lK7v$E$TO{|MnOCtoh*YC!etLAOCIaU`Z4FZH)i(js9=r`~Cl~+~~9HEQPnq zYf^ZCpjW&QRcFvlN!HP6>nN@cwH?gq;A$oClhsg{jl%lMD1FMp6nv@8@yr)Ist4qi zPst&rbr)LO>9uKdv5sgRrNU}g&))vr0$ngX5tr#Zj9?NC!SMA-{M=mO~H(sXOZFF=&+MDQaBd@&lwY2}3 zuTR}9dVtmQ`(RNJnq0y-@8&IHK8%1ly87(i!pkZtR7Gu$v%youQ2WQz#k1?y(fHo; z4s342YeNS2i)j+W?q#u`oc8d79MR#_QE?DRm{8a2f@{T>v*ehT!e{*FMAeHOxqu## zMw;bLaCV|bm7&jpeVNDe?MY9k+cyk6*Tb14ed`Y*0L>B00gSTAx5vK|W77DZ>iSmN ze4MM%G>%o&S)MyNi!HrXULW=G$e81N6BoD8@zK#b*B73U?ibbsm~9BotElRVA5x2I z^FwT4a{R_5^c*a|Ac2R4$(1Yxhd-VC9SE>KT<`?Z}_)M^&aLKKNkXsm{LjK8!yFG5 zhf+XA83MDV=pgb&SCpXHAG#%hRzOH4&63ZNjc$U*#A}Jqf{zU;3=0%xEp4|Jg}?nY z@JtuZPY~e%n$I6EU+$~RGnJpKja20X|H~tNl#SvEPj>V^N0b zoa=Reg=ScS5cSnWye;_ITh|QOYf9Fjyx? z^IN?O|JoV1d}F1B4y$CfE_abB$b#X*Ut%w68Lz@5?N(?ZN~qW$#u;ssGy3(B&qt

L|hW3iC1Md|@mzDQAsw%U5E<2FI>MDxn%tOPw~z2uD1vhYZiC#2)G2Vyk5> zgK`o87H14NA2j>I^HKe}Q1GJeYe;TJP6FyYznTwd zRlv?|Zb`h<+158|GqIWMxYZJ*ZU=^~6zSFDpWzrMDL*Kz3|I%!ym(S}O9MV<-@!j~ z)71)qhUPaSVzUG01%w>N88zkGmE{NzbxNb zRY9I`aev7hrO*#sGo|~#-*TFmij7=dPvopb0d&fwZ{r%s0Cv|H{o^Mkv(Cb4jD$Rd z0SqBu_1{C~!KtGoecXoZI8+V4%V*@_SZ~yfaOH$c)V~@T)>s}jGIc-V?9km1>Nxk4 z$k0jAFFwaIDvTDXb-jLKx?NCrX9?ENBj&vdX!E(X9|ytb2$Y5{+kGzpKWuwP@NETSugan+}yZB>SccT(za1Fo=t}??_)%r1eBo5l}SV%b^Ur`e+A|kUFUo z&3`MOOiMzrY1C)VVg9AwtAS&4<&a9aYbpdftJ0;3i3#v4P-zgh%;nXnG`g{b3pRQ*@s;JKTvn=Dz}Hrf8~{N5*931W zKM>+E2-LcIo_%t!&V1MtV?Quf}t!b#R_j&=X!)vgqRh(9Q#y3_KxOR_GabOa_tvMTO+PlihIE)RbA= zDUtdpwV*|b8H|=p<7p$5L2`ZOMnir?G8cu)Qgl$eai7Pk7=n3Zee9BOx+#${@?&Fs zo{)ZffXO)Q9KE#xe6n5T=ET9c!P-Y{K@NMUaJde7mwt!WTVaOXG6y!#6Z-8W7KE&R zHgrB6fzF1O=KR%5oW*C$IvR|DZu%I)oqRI$OyBnu}IIS+^(^;wDomh z-A@R?KWh~(E4hw|klGqHa;=|eH_gND1>Jt%?g}3?t;{w~8ZUHPBh59OBflgatz4|PyO=%DVTFTMo2H=*o~FyFO}Bg}>1-D^hAjY7NNqmswXKJM*elG*vEa$~brMqqJK zg!NeebDZ)|*~(314l~UuR~@gh)nh~vyB8S0e2;83rZLAnRCM}rr_d{O@eaap{!~}$ zb}Zuhx_wIW(^c}5uSULEDin8?f?gRI>GW?thd%-glAHhu)&R@O#C!89m4{UZz83|P zTx&Lg2(`JmiR1)P(#G@7Ilx;a=Gt~KKYqwOhAkwy%kKp zk)%^DCHugXBHAZuEXe%zPnq6u|C#mva3ov7Qim-X1FQNdj#9)g+ZcIjAH!9zKl}k+ zso}3KJ=L?Qk#f^yCeU%OO~aIc@Emdc#28)?8646HaGu6#A( zz`t{aLEv=Ka3yBCdk4(`+(oCyS?E|WGa+peEjNNI|Im1d#hEV^OqWL#28t)$tVQu@ z-M7+?>SZ9Ey0{QfQW?-nr!o}EIqo?((leFetS3s+Athx7-v{Erf^Lw<+dga7^1aNq zW(YqGYS99a@ydGEHiPy9D+Pd*elyU*eQ(N@M#6F+MSmjv_|=x}l&ONddx&)YYrdKF z2l{E0U<)g<*fKj+ABrbzKE0`1ygVXYo4RlByrDsu%b8#xbSaTRl4Erg%`$dc4BSd> z@|=;RJEVb|YPuXxPW>zz$HxH_-R{9tSV4OoE9`I2U};kj z;oGSj>dQ9&--{*Y9gX#)Y4b=zs5(t+snd$;$`7CKm=o=g)=xJcnS%T_JqJ-?8f5$A zyrGkeeHz7x-6L2-g5_b8b%Og-T+h`jmfKwaeu1jN?~e|w#KyIGATvBOje8kCO$wpKt&?xBejl9V0l+C-gameGfT^w? ztCeTg5s|ZNbw-6`{?jXl-0)v3BD7-*G=?9A@{Rx9L692x(n!OHdSJQ z0z$8TetRb&S!aFG9>W4JI+K;n&QMT9Zeed%leJX+YQf7qb1tFu^*;zUBU-%zx#2vD|wRi?p+C9&45*`9`g^Xq!Ze;%EFmS_ek_GTf zo?bqY3F7unS_~f%V|i#Gn8^>F(f6>wRxsxhAxx5q9`1$Zv|XR7eDDtx?hIs*<`ki` z-7e_{&)@FIaVMtCUp?~M%;Bsx1l#V0upsSlV7F^QljHM!WS8;U4-L|S&7%j}+dmy| zn2(V;fx6NkL>v6@m5#SxUZv%SiC*WWU5*q7cH3z@5wvrIJ0nqr8AzH9d;(WspoASp zyh_9UiT2vfMEKr$bo^%uZj9Ze$H_?xXAzsRLRg?r`FSm_ zfNDAE`n~%$2fM-0*FqyB&H!Iqou(z7YGI1^M@HxQRK;hdHCR#YLk@Os>g#66hYZ;+ zb5U2pLgO$|wXdp8hhq&+Q&U+)iR#pG)|C3f&LDCBjV`XhXA$AywLA5waUr_I)2C^r zyqm>Tb-tWmNM4v#D}9M?%QDF`ilENFZifSo;=SPpSs6 zpIu$A8BqYY#b2)NP^N)^hjRbeFW1B&v@n?~?iaD8&x6Cy4;EF81v}H)c?e+W7Ra+2XKnP~~;UPG^dF6Ss2{ zN01-FuKw01Q6rQlr{orMiGkVSI_}yVc^+5U-{_xmjlf|ZS93Kq_qXlsFXemN5uYz+ zUYzh`0X3FC?e`pNN^VYqprm2j$p>RKO{P+m2MmRk&!plqF6=gj-YuiPL8E|NPxTWk zw?1PK=g&I6o*nU(7mIM%nxpKe6gp}AR;uv{ZVyHy)HrZS59=sGp5s+GDx%O*K=ox* zd)`}F|I=a^b5J8+uHA^Szi_GT1SYPuwZZ3bTJ@cx#87c@jv? zmouXi)!r>n${uxQozUab(N9Cy&m?aTLn9dlS}z^7ENKGr`IueLE>-7*uM4jgEZxGx zWo`UrH-`EiIs^tPuKl*|ON{sQgyk!Q7^%Lc2txM{lsd7iL(fxw)|jk>6k|fXWx2{a- zM(l@$E7B*#<2QRP=j-s=i+)#$adRNzxrXE)ndjThI z{tAFf>F-NvSqN+%vpy!q)qYSyNRUUGGjH-k&!}RM)64{YtgX3;dEZDX6MCz6y28 zlL*}MEN{B;t`m*fqkIj4E!T6le_;A4C0ZlY4oOs;X_X7Z#*U7^nvIl#leCHTNJ)M= z_LX!MjG-i>Ox!k+kuen^)Vein+zbpEn}SwAd8fVl8Z(~+Szu_9-aK)o=4s}?0)`kZG|5K~jvWaM|7V^;Dx}l@DBo9>_76u1y z%e?K>%aimNY?sQydMM1%*vw@Os3inKP+QIoRP1R%JeOUmBh8Vqq&B9{I#Vtn7xJ`t>$gt`1@O-_^$O*o#er)oLImcBKWgacPq$PT- zn|iyU)=|i@#Jp{!LJzd)PS=!8C7cNaJ*T_S`*boIo?bFc5<#v9*h8Rb;DfCh4L+vjq(0l_=9G zhyQkj;MY2(T*OzHU_umT=_BK|A~JR}=m{96q0m!c27qp~5#A+*Bn?p0>B%!Y9bj=B zn%k6KKCK$PQ0czWT*o~Bj9Ug(>;K_?`V+jyu%Fn9p^bGkTUm6=Gn*6M?n-4cbH)x7 zrmIZJvgxjU7Nok*cN+Jo_;x`+4dlTLWWGBzW+t1Q-tU>(AP#mQuJ$IkQc<}d8h&;l zx;a#BL!Hd`ddfRuxgko>NQ9n(vrjRrgimr=KNAe;Q65N(7?fV-eKmPC+_~B=7=V-dkxSWi~&O-!xY$mM(ki zKln)!Shu!qN?0UY0}xBA%g9mjVRoNHeook)V<&$#p1{Ev){YiJJh>1bV|X6iLljH< z6zOr;hoiQKcc|^SzBIHME#R1GhV%wEcpCR}zk?I2_T#$)j*L8iyBJof2dZvV1hC9+ z0|=%Z$jN~(YhNa(W!gl={&?nJTPAx=k}DC*0T2!Fp^A?x7uU@Qnn9t6HG6VQ1dq;1 zZ!hl4Ki^&M9jiwiXH;QFi?*EZ?+&T6Bx?y~0%ys`Dm?zFdr0(2S<0L~?-pBioV~N% zY!(3o4w^}EN7yUO!hM%)6>}s595F56$}?^VwV3~U($58ftcS*xu*?rHh$&gEuEM+f z)&_T#p2pouxY}8o(h@PeBMDs7Dfo_1;Mc8m+eBp6q~_;wn$N*hm?5-i @7=|-LM zr3>l$nLK54R*`B(PBE| zek=+r{Tr_clL<#%Oj=}e7WFJWZJD_fWr6Wj___@< z;NKUm9F7*w16l)0GlcFO&qBk4Qg13FQ=U4OzqZZv+?9 z_>^PY%G8KPN_F177JVTn@CrPru@&b-E5fo`QOAhjaa z6turndnzQc3C|HG;2Z6WSufN;RV0=0b=q(0K6ae8ygALg@g2B3`T6s?oz5V8Xan+{ zi<`+Zr<*gA9(+?f(vx8qUlH;+KJT=A7KByepomurC+0ROSsNyoMnmZ$BC zvPDN5hH6lKYTBS%i&Vwzkdic;2t0w0XKt*4UOe3Fr=F5LT6qf?-yUch*Y+x!=Ok5&N=+m)vG_NCI%Qh{D984=0yVV4jC&QmDICb(@;tBk*#_|2V z9V+b5DS`KjiUC)eRbih?lX3+-pO@|f0HswlW=GR}X?1dmQ+snOEjwe$wNBT8A0yfx zcdd6LL2Pm}d+3^Kbq93ybt!b4&}Xf35!ZXHyvwPgnnp77CtspbhwsDwNK6Ee{ZvUk zhk}3CfK{%CiG7jv=_L`_$>sWM!v0#pbn#-ncw&dBEkZN3e%`r zPU9}%9R=l|Zs@Jw=AnGvpS3z8F<0aIVkaHxZq{gUiFl#8-}$iX+bwR~L2~4I*0rlU zG_ge4`+R#W>u7@qNSF624+^T*P4FY})%)i#R1IAd;_Ah>Ay0u zSgF~I7?zL`6=bVZYdKxon_e|!JR#@Z&Kj-ec4X?EYlByU{1#j-FH&H$sp!}CjkV02 zlDRYUn>Jpd^-kiLeG5s#HQK`^|GLVKFm~Ye^{T(GD&#kaqnSlLu(2WN+L=i&hGmq}Pz4?Xx-q}=+FT=`yh&DWmzy(S zWYsF%cu?a?1cRAiXg(7O1Kt<&cK08yWzY@4$dRxWx-4x+Fnaif3B;#m?9b|(MdznP zWo0==1aUPnhp@jItv;OP*g|}Qk`czDk9XVam0N6{kh*m%&(382^&^yP>u{-lQYEc= z$2=n-H%NMPs(CTmCNDHOpf;g((|F_>l$mx2?~M?cZW+*8-faXCZW?zSriCK%d+(6V z<%y#>6HC*QvpE8Z-pDV!oJa3W+*-B9(-zxW4X9k7KcSet%ST?hxsXhfbs60}oKvEp z4`{{$Ftlb=$Dr(Tjjj;DpLs~X2eF1Noo5J@S*!XYy%og0W!2mxIXH`5jS>}i@ug&pP^=K6>MI?K`G`z1~b!wb~>8*XTRLff1;!`FrXAs+ou=Mx$c>O`fvwl zo@Gi%9SQ8MXBYXsdlyH@=cZ)t0@sH2jfNLiI&!4ZatX=;4Sh#z4}T<7nGTbAnV6ZGndoibeMtqdb1aNwj_g--`fE^O-QYrb~pAi>zZ!UN4Uc*%#3|@1#;_bZj%#1 z+c~I$>3-)iyU(sP%Tfnx-B?IU^f^C(o4*Vofa$PCx4E1h z3No}i1Rf({RbAXm${R72CiflgkQg2$Dc}?B@>p9XcY*D-!-846JZQmuI}_}-i%~QBOJMJQ}xEPwC}Too_-Y67WQR-@yv|$`rrqLLUXlI z>)tpzyS#||bOlne%G2VpjBqRH0@&K`Q-!m!bW)3+{@P%pZ2;|RmSk8_)4#jE8s6gu zo4r`}wSj2`ww6Bc~H zpO9WHE(|hYE!e$Yh0`wkk9SyoRI`f{)uS0RC)Tz1(l{_XIZMoGjtqO8S!`E%4+fu^ zuf2+qEvqg5diUlaAlRhHF|OHlD9h?Df2-R08sI(G{Y1Oh^GU-QPT*LYBC(sL24|K4 zO92{aK6sF+6E&FpZ+7tnUO{X*8H|Hu`F7F7u}#Vwggl;jRM@d3g4wNQNC0^ZfhQk7 z2~wky*C>fSoEYzE3>^C6sJ+1#yLBSRH6m2ep1wzYRiWdT9~e+^4VUxrS>34}wAX&r ze0==jD)$jVgpU$I8~AoL%tPqw77pC_0&co|I^EFW?QGW6IVhG!KgnLrb!P&N<3IkG z0R3cxto7vQgZQ;$4a4snJ<-=$1p~GQ}2X@>JP_bPVOmfsvmLb@k*ix z(8!YvBf!R#lvE|SET*HdI3t**a8T73b?oYP⋙=X0LB2ORQzinB28xAnvHAh*hpb zP%7K#9E|Bsxi2={c7g4*Z=CP&W2IaX3Y!hO=lFhi!^z5}h{d`D(gR^my)K5epO#Ce zIR1gH1n78by{as%x;Be@m!p)1CpMNUOu^F`x5|?Z=&GahX?f^rfW%=MGs42=h7Sw$ z4)KltSkIdx(tpu&2m6p49HMWK^$!PL;Cy@wMtfGWbJte+;T@srXBM_&8df>A<9w0f z=WpN6cS>2pW&RMIp5C#e#tCPbe;9{ZF6QGCQ2e;WSeg(qgvQ<4!5*4w2>$8hZPmUz zCW__l_}bRv(a7}m%ht%TahU|RZ|?}JeO)A~u4=|XDv)Lb@qTI{=vK6~Nb zk*YWe*2bJ*6mu0e_dz$D9aQbUraHw-C`SaIRJC|k_(PFD_vf~lzY&Y(@vPo;RjULf(;gT|A6TZzzAoknds+zmKNR|I{QA+TCSX@Ihe;Ho?`<$=r zmXPA=v*XycgRGb=jFN%l>;cs(9xtT%=<3gqSh{p<+ki@sBnz3WxsS54jFI>9($KGV zCvx_;$IRnKHY##+!~Z4s_@3bMNO6ntA$GrJ>5qjdux#rdW_9cqA;N+Ln(A>>@&hx- z)C2t_Z#l&z|J?aaN-|mG>qt>kY@E}z$WE>;Nbbt%kXO{Dyj`TOk_N?%hUSYs% zgT)*M{=MI_=t2^tVB?BG+lD?o-PRwTBh+=!IbV44-*g{aJ%MOLoy(KIk|{50*W3`1 z+#T*kln_1Cb11DjD_t&ib@uCvr*m(5@JO8oahPAiBzlnvWLYCp2Q7Z&QnF^k2F?he zC_|>aYD=g6dX*n_1TzRN&B|~5G?;Q)E|bx;y%+_oBx`<)Gq_mYx$+ELi|O=~*ON&t zNB)SQgkjxQlObW9D!MFQx$Zr-$*7(Z!)inMkb`+R{W!?p$ zCW{Ll2B_kwr!6n1WHM4vE+HQ;Vm+C9%|5A7xLdBD5&_`<^+<2ds2i>t!a1Q~YKynY zcF_)TsD?1BhhgLV5(Ig^uJhbMOiv(#Uo)>%1V$~`iac>=bQfMl3)FmayZq$dz{}21 z@ITQUo*H@_s`L&LUvM2AjS2#dL^yOsBw4iQTD*UVr1(hx(Gb>P@o1@{k~9h?#dWlD zki{(jHlWql`Fd0DA<^f%$7s2Pi*F1lvp2uq4%bN;Wc**#+A@sry5Fjc()-Q2C7nmd zof5m;dRmHKJC}q&^%Q5P@N0r7-G#8U^`T*NL*(=cW4;Z5-p}?yOpj${A>_gW zds8KgNO;JMt6&OoyY}!{_>)_|?n(2R92M49gKYOZo{4LN#za!Js6++y+p>M}tL^xy z%=7I!3~342{}vi_C>DeCmc8t)1`>weMTh^;2BMr|beH>B=;<@uv+$VX;LB4`lQ=rU z>u4kkCY{f*XGH$YGk}u36Z19q8N+MZ=YOQZuG6CVO;J&}201(xKO^t*iw;)>(4#YT zJ@s0GAwij(o`>6*O@}uO!ivglbTqS86Xy_k&F0@JHTGtZ_y+WUJ9%sajHZmvK+EA# z$@i;8Mf^BpWy*>^Z1_l<5dp!rpyk=9(m$y&%p(m5T~i~>M4C!0WCNd}{={qB1w5#|Ri+y?!x-MzOw&%B zg%;oWt%^pD8u51&n})@83({U6byYO-bS0tdL*YRuQuaFs>rsCF95*zTLqEBDt+u|Zmrv^*HzG=W4VM*qZ=!W7uO1WmlFMKSFQg^ zF3OPO{`Daqx`Dd)^NtxM%^BrklY=@rRI3gp+r*97W0~WS_*Ej@%Ehyy$wGRgpNdN; z2_ivt%m++D`U`sccNDY)6#759NB%n*6D<=St`WC%bqF9kl^x|O&38;m(|Y|X&1n6pmIr7@BwJ>PF#`_=}FRG3B;@!YtMbweDj%@-iLiyWO8lu8{=dZVtBK zs@5wo3Y1RN;f^`D&frk)9sX7> z1y9bPC8ao-j)z-BuIlYqx5+b&IP}e8#Dn1e%3tHIhbHH$AwPB=eBx zQ9s|74u;WdY0%=uhR1av-&Bow4k>X1?LWV1`Stk>lzXcianKcXN!0kKZK`~w2^JBR+)~-#SLbW=3-&s;g~+a0JwEx zm`X=as3Ji}pBLBjmzw=OSUHTo?xre})nF~pr2Y6!j%2CtZqGSU6e*44i8Dum6!;yi%*FrP#5eBf zLw5uU9ni*IF|n;D)q&r683yCBO9GqEO$7=xTrdI>!ow338?L9G%~ZQcD8yd%4*Qa%|CqSUABpEj@p%q0lbGiR(eEM z)$wk1g9ZnBb}1CtDQF}okLXnogvoQDecol{FoZ+M=jO8SqGtaa zCDCXz^)(!438I;6cUc6-5IL3;ZRmLU{+Zl3uYjmU_I5faSs$^Fl8&V4>Ciby&rFqr zsb-u%fDIC@9kosCg6{TPFzOtIEra*qU|3`G1!dhD$Tp2zuGfaAH&wm5n#~azH~+%C zh9TMPO`iRIss)3)myvf>2G+11`-qGs(!e?h z0&k9UogY<0w(SK1PMTQ`^ExZN`t5KU8v;!guN)U%`-*xv#f5TJBaB-~{U7JK^2Y_u zKT2uk-(6`b4otXo#eOPA7LxOfAYym$>sjPC`l9yskLL!P4P{@Ay}kMU$G(O`+Ka+X zVYkQKtyyo+LN7TXLSMHtCqhO|8(s zE~JU)$jsVc`_T>3|!GS^E>Lid$mQ)h|* zcNQ|gXAE3I*ApG-#KonvTVdK!E3-jA+}?-z%r<fNM8XL` z^IxL`-YzXTj6a;IQ>w>$@?>}7oyJNq58WT_jNki4|6TC!$w^eOZq3-{|9Es#^}P3| zS7W<7QN#CB^7_`VTmI)U?5pas8;8iaT%hfyimH>uJsHYt!`-C4iC7Vpv5g(kq(9dj zr`}bnI1v3`9h_KqxV-*$_4L{H9RI>@^?!C!dj5*wZ{&{oPX)}+2US8k=Y)8sc6VPW zuL@kmR@dK+M;lDt@aJw=ZypW4Ac<%tD4PgwN24mTDgJ)yt^Z!<|53qAdq(^sm?y%5w~ zP%233R`nH<^Ut(3Jt}REe-n&2JwtR~wIKuNKXEE}8Tu-8q~t$#G~+%P0`)a|@>pj` zbD#CDKHd7AWEsJvPHoGD24-db8Y*hs4{6w!u>MV(7kj-byB75`#C;F^9vw{@c`#>; z=eFFY>M$>OzP;M5zobcunr_)<(eB>sy>&gdtAfzUMh{nb-2S5T1)04I>2q27x8Ue| zCeLXm9FKBCzmzuHi`RE^%TZ(}tiu*y&e~1Vuvmk&LCcRXIN zkkA;$%XaKtmes?0X1=CZyL`4^8E0Jx_zOx7#r??kK%Z79!%2d*fWL z3hJId1PQ4Cn+}Ct!a=IT!nfVy6BY0cLV}56_w8JxhZw=16GbbJtX38UY=SZs2|>L$ z!xYnHow$-)5j*qq0W5@m2oRCU*hi>&My31ZM2<7tR-BEW@;6akCfg+mzpIaLh5uR~ zC^#MQyDQ<*-C5{*mJ+l$+zwr-v)RXvk@ugI9o>*a3)=7X(z`0!8!TRm3h-NAA+xqX zel%hD2@v<+5E|SU1huEOrbevf^p=~XPgC8rwevu@1W+xgth|GZ%V6TW;~Ki)8$&xi z(39EI_`ii=Kil>XpUSCbB0d26p4f*4nv&$p8@$&M>Ng)e=25`3oVbOEI>Hc8f`54F zcJ*}V$NKM4&7|Iu8geq2;&bzVoxP*)9UuQp(35@eqPGlLI@)yp0a>?fL`(R0VS0OY z=;nt9=8T8--Z7^4;M%(mmF#OK?Gon{Jlk7{G@|e1XM#jh&w28v*3YDjyxC>m$B4I6 zi_l{(Qu<#cV)IuzD&8q*24pw(6t7zDG$s_Mx+KrTc6vdD{NEAAbDQm}9&i6%cOKNj zbcAOqs~;_wtMqMoEIUUV*f^M+r>r9{vfGp1SuaUjTG@>x#$PdV!LK<&apcjU4w9q* z`}w;?%;f2M?|N=wzUEVw2HI{KxWnA-H)1q+B%HTC4ff*Xx*jig9vpQSTYPuWYVMWR zr11K$-_V&^B#x}PP``K;F(0Sx6pCqbk**=RbPHOUq4tZT^mDyVzU358Lebm4f3Buh z^gM#Xe)l1_VnA5Hd6;Hh$zlgdp&heb>F|1@_D91F8?tDUp$X&Wo*dFdV`gI@?HDsXeK6Ud?IYuJo>XU+IQ#dnnBiHS8>-9%1WHAO z^z>$|tp~EiPuFm}=sC##MVv-CC_c#!3jgshbF}O$z1cmH_9bCF2zx2NzKDLn9j-%-i zBHa0a{C@Cr_bJ<*^SajFqBW&ik^*{krTS*$3#>F&fpmz5{ zqjBJmlVGLpC+0X8zsnCD|LV4#Xr(~&+bK;S^J56*z-DpmW_ZCH2(j;5Z*O@1n@Yod zP$113+bY}{73h3ERHj=Q5>~>*aT-S>&Q35}6Kg8(Ra-J=I^SMIOGQ zV+lb7%%QcEW03Um*^*I=yWg*+@$ra_GS6$ zsjOv@*1*{+X@rjSoo%xV(A3^}H8}Rn9MAXa&JH?lSFIui-=d)I$*<~v98r3p^>k=f zi}j21lgW(bb~Q6=voU7tgZ43Fj&#%`N20JvjZr_Z|Yo+B=-`YvBLr`0`@cM>QxIkS8GGLvBW_i zp$UZbtyoyUmm&WqJ}u949B&3Wzywj}igD)vb>H#E=2ygYgB=~1!WCMs1wT%@v2n@o z7Es$?9!nd^Zu{^aqMH~KngmnvjyqaY1ICKF(QFvPL~4_a_-7CObuT-_DYIal^H4@jV!{3h(lHa7S@dnN7?b zmcFJ#4kB$;U3;6jxIAsObZ?-KF7vD%gnubJZ0$GzveS-#ThwWB%nDdd*j?uXr04n{ zF8iTChw8~-i~y{6Kt<`COBt``wn1V-NVCA0U+e3i(ibW zzahSyWPg0O!cfBT;~m~9vQRHO7q2LUAGt&7xIvD;p(rcMeiR=~C;hjMTeFJ%zF#Lc z4r&~4Mua#xHk_>uGka5GmS06JtE*S8d2v^Rem7x`E2N`>;G*6Ss#jY!mO(mqRp132 z1-uf5Bb)kvI((P&S2xm9?-}^s+ToFP{ny9*4EpE4>%oJ0h0gv$D_EtH^;0{p*McprRw|9z_6>nGV01Ap|ZB&RN0E&cw>{{T@Zh8O?< diff --git a/boards/riscv/beaglev_fire/doc/index.rst b/boards/riscv/beaglev_fire/doc/index.rst deleted file mode 100644 index 88808145c9b..00000000000 --- a/boards/riscv/beaglev_fire/doc/index.rst +++ /dev/null @@ -1,85 +0,0 @@ -.. _beaglev_fire: - -BeagleV®-Fire -############# - -Overview -******** - -BeagleV®-Fire is a revolutionary single-board computer (SBC) powered by the Microchip’s -PolarFire® MPFS025T 5x core RISC-V System on Chip (SoC) with FPGA fabric. BeagleV®-Fire opens up new -horizons for developers, tinkerers, and the open-source community to explore the vast potential of -RISC-V architecture and FPGA technology. It has the same P8 & P9 cape header pins as BeagleBone -Black allowing you to stack your favorite BeagleBone cape on top to expand it’s capability. -Built around the powerful and energy-efficient RISC-V instruction set architecture (ISA) along with -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 -======== - -Applications for the ``beaglev_fire`` board configuration can be built as usual: - -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: beaglev_fire - :goals: build - -Debugging -========= - -In order to upload the application to the device, you'll need OpenOCD and GDB -with RISC-V support. -You can get them as a part of SoftConsole SDK. -Download and installation instructions can be found on -`Microchip's SoftConsole website -`_. - -You will also require a Debugger such as Microchip's FlashPro5/6. - -Connect to BeagleV-Fire UART debug port using a 3.3v USB to UART bridge. -Now you can run ``tio `` in a terminal window to access the UART debug port connection. Once you -are connected properly you can press the Reset button which will show you a progress bar like: - -.. image:: img/board-booting.png - :align: center - :alt: beaglev_fire - -Once you see that progress bar on your screen you can start pressing any button (0-9/a-z) which -will interrupt the Hart Software Services from booting its payload. - -With the necessary tools installed, you can connect to the board using OpenOCD. -from a different terminal, run: - -.. code-block:: bash - - /openocd/bin/openocd --file \ - /openocd/share/openocd/scripts/board/microsemi-riscv.cfg - - -Leave it running, and in a different terminal, use GDB to upload the binary to -the board. You can use the RISC-V GDB from the Zephyr SDK. -launch GDB: - -.. code-block:: bash - - /riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gdb - - - -Here is the GDB terminal command to connect to the device -and load the binary: - -.. code-block:: bash - - set arch riscv:rv64 - set mem inaccessible-by-default off - file - target extended-remote localhost:3333 - load - break main - continue From 5386a90142db1cd514ba63cbb67cec671136d792 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:38 +0100 Subject: [PATCH 1111/2300] Revert "[nrf fromtree] tests: Add unittest for gpio_ite_it8xxx2_v2" This reverts commit 332c3a32ebde869df10a5166b09892a010bdd043. Signed-off-by: Robert Lubos --- .../gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt | 23 - .../drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig | 12 - .../boards/native_sim.overlay | 45 -- .../include/chip_chipregs.h | 20 - .../include/zephyr/arch/cpu.h | 16 - .../drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf | 9 - .../gpio/gpio_ite_it8xxx2_v2/src/main.c | 460 ------------------ .../gpio/gpio_ite_it8xxx2_v2/testcase.yaml | 14 - 8 files changed, 599 deletions(-) delete mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt delete mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig delete mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/boards/native_sim.overlay delete mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h delete mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/zephyr/arch/cpu.h delete mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf delete mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c delete mode 100644 tests/drivers/gpio/gpio_ite_it8xxx2_v2/testcase.yaml diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt deleted file mode 100644 index bf01055ffc3..00000000000 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2023 The ChromiumOS Authors -# -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(gpio_ite_it8xxx2_v2) - -target_include_directories(app PRIVATE - include -) - -zephyr_include_directories( - include - ${ZEPHYR_BASE}/soc/riscv/riscv-ite/common - ${ZEPHYR_BASE}/soc/riscv/riscv-ite/it8xxx2 -) - -target_sources(app - PRIVATE - src/main.c -) diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig deleted file mode 100644 index bb5e43e8e20..00000000000 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2023 The ChromiumOS Authors -# -# SPDX-License-Identifier: Apache-2.0 - -source "Kconfig.zephyr" - -config SOC_IT8XXX2_GPIO_GROUP_K_L_DEFAULT_PULL_DOWN - bool - default n -config HAS_ITE_INTC - bool - default y diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/boards/native_sim.overlay b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/boards/native_sim.overlay deleted file mode 100644 index 7f22c83ffb1..00000000000 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/boards/native_sim.overlay +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2023 The ChromiumOS Authors - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -/ { - intc: interrupt-controller@f03f00 { - compatible = "vnd,intc"; - #address-cells = <0>; - #interrupt-cells = <2>; - interrupt-controller; - reg = <0x00f03f00 0x0100>; - }; - - gpioa: gpio@f01601 { - compatible = "ite,it8xxx2-gpio-v2"; - reg = <0x00f01601 1 /* GPDR (set) */ - 0x00f01618 1 /* GPDMR (get) */ - 0x00f01630 1 /* GPOTR */ - 0x00f01648 1 /* P18SCR */ - 0x00f01660 8>; /* GPCR */ - ngpios = <8>; - gpio-controller; - interrupts = <9 IRQ_TYPE_LEVEL_HIGH - 2 IRQ_TYPE_LEVEL_HIGH - 3 IRQ_TYPE_LEVEL_HIGH - 4 IRQ_TYPE_LEVEL_HIGH - 5 IRQ_TYPE_LEVEL_HIGH - 6 IRQ_TYPE_LEVEL_HIGH - 7 IRQ_TYPE_LEVEL_HIGH - 8 IRQ_TYPE_LEVEL_HIGH>; - interrupt-parent = <&intc>; - wuc-base = <0xf01b20 0xf01b20 0xf01b20 0xf01b1c - 0xf01b1c 0xf01b1c 0xf01b1c 0xf01b24>; - wuc-mask = ; - has-volt-sel = <1 1 1 1 1 1 1 1>; - #gpio-cells = <2>; - }; -}; diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h deleted file mode 100644 index 3372a845aa9..00000000000 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/chip_chipregs.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2023 The ChromiumOS Authors - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include <../soc/riscv/riscv-ite/common/chip_chipregs.h> - -/* - * Macros for emulated hardware registers access. - */ -#undef ECREG -#undef ECREG_u16 -#undef ECREG_u32 -#define ECREG(x) (*((volatile unsigned char *)fake_ecreg((intptr_t)x))) -#define ECREG_u16(x) (*((volatile unsigned short *)fake_ecreg((intptr_t)x))) -#define ECREG_u32(x) (*((volatile unsigned long *)fake_ecreg((intptr_t)x))) - -unsigned int *fake_ecreg(intptr_t r); -uint8_t ite_intc_get_irq_num(void); diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/zephyr/arch/cpu.h b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/zephyr/arch/cpu.h deleted file mode 100644 index ab921224676..00000000000 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/include/zephyr/arch/cpu.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2023 The ChromiumOS Authors - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -int arch_irq_connect_dynamic(unsigned int irq, unsigned int priority, - void (*routine)(const void *parameter), - const void *parameter, uint32_t flags); -int arch_irq_disconnect_dynamic(unsigned int irq, unsigned int priority, - void (*routine)(const void *parameter), - const void *parameter, uint32_t flags); -typedef struct z_thread_stack_element k_thread_stack_t; diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf deleted file mode 100644 index cf7d90e583c..00000000000 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/prj.conf +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2023 The ChromiumOS Authors -# -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_ZTEST=y -CONFIG_GPIO_ITE_IT8XXX2_V2=y -CONFIG_GPIO=y -CONFIG_DYNAMIC_INTERRUPTS=y -CONFIG_GPIO_GET_CONFIG=y diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c deleted file mode 100644 index 4272fbe42f9..00000000000 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - * Copyright 2023 The ChromiumOS Authors - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -#define MY_GPIO DT_NODELABEL(gpioa) - -const struct device *const gpio_dev = DEVICE_DT_GET(MY_GPIO); -static struct { - uint8_t fake; - uint8_t gpdmr; - uint8_t gpdr; - uint8_t gpotr; - uint8_t p18scr; - uint8_t wuemr, wuesr, wubemr; - uint8_t gpcr[DT_REG_SIZE_BY_IDX(MY_GPIO, 4)]; - bool clear_gpcr_before_read; -} registers; -static int callback_called; -static struct gpio_callback callback_struct; - -/* These values must match what is set in the dts overlay. */ -#define TEST_PIN 1 -#define TEST_IRQ DT_IRQ_BY_IDX(MY_GPIO, TEST_PIN, irq) -#define TEST_MASK DT_PROP_BY_IDX(MY_GPIO, wuc_mask, TEST_PIN) - -DEFINE_FFF_GLOBALS; - -uint8_t ite_intc_get_irq_num(void) -{ - return posix_get_current_irq(); -} - -unsigned int *fake_ecreg(intptr_t r) -{ - switch (r) { - case DT_REG_ADDR_BY_IDX(MY_GPIO, 0): /* GPDR */ - return (unsigned int *)®isters.gpdr; - case DT_REG_ADDR_BY_IDX(MY_GPIO, 1): /* GPDMR */ - return (unsigned int *)®isters.gpdmr; - case DT_REG_ADDR_BY_IDX(MY_GPIO, 2): /* GPOTR */ - return (unsigned int *)®isters.gpotr; - case DT_REG_ADDR_BY_IDX(MY_GPIO, 3): /* P18SCR */ - return (unsigned int *)®isters.p18scr; - case DT_PROP_BY_IDX(MY_GPIO, wuc_base, TEST_PIN): - return (unsigned int *)®isters.wuemr; - case DT_PROP_BY_IDX(MY_GPIO, wuc_base, TEST_PIN) + 1: - return (unsigned int *)®isters.wuesr; - case DT_PROP_BY_IDX(MY_GPIO, wuc_base, TEST_PIN) + 3: - return (unsigned int *)®isters.wubemr; - } - if (r >= DT_REG_ADDR_BY_IDX(MY_GPIO, 4) && - r < DT_REG_ADDR_BY_IDX(MY_GPIO, 4) + DT_REG_SIZE_BY_IDX(MY_GPIO, 4)) { - if (registers.clear_gpcr_before_read) { - registers.gpcr[r - DT_REG_ADDR_BY_IDX(MY_GPIO, 4)] = 0; - } - return (unsigned int *)®isters.gpcr[r - DT_REG_ADDR_BY_IDX(MY_GPIO, 4)]; - } - zassert_unreachable("Register access: %x", r); - return (unsigned int *)®isters.fake; -} - -static void callback(const struct device *port, struct gpio_callback *cb, gpio_port_pins_t pins) -{ - callback_called++; - zexpect_equal(pins, BIT(TEST_PIN)); -} - -static void before_test(void *fixture) -{ - callback_called = 0; - memset(®isters, 0, sizeof(registers)); -} - -static void after_test(void *fixture) -{ - if (callback_struct.handler != NULL) { - zassert_ok(gpio_remove_callback(gpio_dev, &callback_struct)); - } - callback_struct.handler = NULL; -} - -ZTEST_SUITE(gpio_ite_it8xxx2_v2, NULL, NULL, before_test, after_test, NULL); - -ZTEST(gpio_ite_it8xxx2_v2, test_get_active_high) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - registers.gpdmr = (uint8_t)~BIT(TEST_PIN); - zassert_false(gpio_pin_get(gpio_dev, TEST_PIN)); - registers.gpdmr = BIT(TEST_PIN); - zassert_true(gpio_pin_get(gpio_dev, TEST_PIN)); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_get_active_low) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_LOW)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - registers.gpdmr = (uint8_t)~BIT(TEST_PIN); - zassert_true(gpio_pin_get(gpio_dev, TEST_PIN)); - registers.gpdmr = BIT(TEST_PIN); - zassert_false(gpio_pin_get(gpio_dev, TEST_PIN)); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_edge_rising) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); - zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); - zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_ACTIVE)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); - zexpect_equal(registers.wuemr, 0, "wuemr=%x", registers.wuemr); - zexpect_equal(registers.wuesr, TEST_MASK, "wuesr=%x", registers.wuesr); - registers.wuesr = 0; - - registers.gpdmr = BIT(TEST_PIN); - /* Mock the hardware interrupt. */ - posix_sw_set_pending_IRQ(TEST_IRQ); - k_sleep(K_MSEC(100)); - zassert_equal(callback_called, 1, "callback_called=%d", callback_called); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_enable_disable) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); - zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); - zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_ACTIVE)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); - zexpect_equal(registers.wuemr, 0, "wuemr=%x", registers.wuemr); - zexpect_equal(registers.wuesr, TEST_MASK, "wuesr=%x", registers.wuesr); - registers.wuesr = 0; - - registers.gpdmr = BIT(TEST_PIN); - /* Mock the hardware interrupt. */ - posix_sw_set_pending_IRQ(TEST_IRQ); - k_sleep(K_MSEC(100)); - zassert_equal(callback_called, 1, "callback_called=%d", callback_called); - registers.gpdmr = 0; - - zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_MODE_DISABLED)); - registers.gpdmr = BIT(TEST_PIN); - /* Mock the hardware interrupt, should be ignored */ - posix_sw_set_pending_IRQ(TEST_IRQ); - k_sleep(K_MSEC(100)); - zassert_equal(callback_called, 1, "callback_called=%d", callback_called); - /* Clear the missed interrupt */ - posix_sw_clear_pending_IRQ(TEST_IRQ); - registers.gpdmr = 0; - - zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_ACTIVE)); - registers.gpdmr = BIT(TEST_PIN); - /* Mock the hardware interrupt */ - posix_sw_set_pending_IRQ(TEST_IRQ); - k_sleep(K_MSEC(100)); - zassert_equal(callback_called, 2, "callback_called=%d", callback_called); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_edge_falling) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); - zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); - zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_INACTIVE)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); - zexpect_equal(registers.wuemr, TEST_MASK, "wuemr=%x", registers.wuemr); - zexpect_equal(registers.wuesr, TEST_MASK, "wuesr=%x", registers.wuesr); - registers.wuesr = 0; - - registers.gpdmr = (uint8_t)~BIT(TEST_PIN); - /* Mock the hardware interrupt. */ - posix_sw_set_pending_IRQ(TEST_IRQ); - k_sleep(K_MSEC(100)); - zassert_equal(callback_called, 1, "callback_called=%d", callback_called); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_edge_both) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); - zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); - zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_BOTH)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - zexpect_equal(registers.wubemr, TEST_MASK, "wubemr=%x", registers.wubemr); - zexpect_equal(registers.wuemr, TEST_MASK, "wuemr=%x", registers.wuemr); - zexpect_equal(registers.wuesr, TEST_MASK, "wuesr=%x", registers.wuesr); - registers.wuesr = 0; - - registers.gpdmr = BIT(TEST_PIN); - /* Mock the hardware interrupt. */ - posix_sw_set_pending_IRQ(TEST_IRQ); - k_sleep(K_MSEC(100)); - zassert_equal(callback_called, 1, "callback_called=%d", callback_called); - registers.gpdmr &= ~BIT(TEST_PIN); - /* Mock the hardware interrupt. */ - posix_sw_set_pending_IRQ(TEST_IRQ); - k_sleep(K_MSEC(100)); - zassert_equal(callback_called, 2, "callback_called=%d", callback_called); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_level_active) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - zassert_equal(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_LEVEL_ACTIVE), - -ENOTSUP); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); - zexpect_equal(registers.wuemr, 0, "wuemr=%x", registers.wuemr); - zexpect_equal(registers.wuesr, 0, "wuesr=%x", registers.wuesr); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_level_inactive) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - zassert_equal(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_LEVEL_INACTIVE), - -ENOTSUP); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - zexpect_equal(registers.wubemr, 0, "wubemr=%x", registers.wubemr); - zexpect_equal(registers.wuemr, 0, "wuemr=%x", registers.wuemr); - zexpect_equal(registers.wuesr, 0, "wuesr=%x", registers.wuesr); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_set_active_high) -{ - gpio_flags_t flags; - - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_OUTPUT_INACTIVE | GPIO_ACTIVE_HIGH)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_OUTPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - - zexpect_equal(registers.gpdr, 0, "gpdr=%x", registers.gpdr); - zassert_ok(gpio_pin_set(gpio_dev, TEST_PIN, true)); - zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); - zassert_ok(gpio_pin_set(gpio_dev, TEST_PIN, false)); - zexpect_equal(registers.gpdr, 0, "gpdr=%x", registers.gpdr); - zassert_ok(gpio_port_toggle_bits(gpio_dev, BIT(TEST_PIN))); - zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); - registers.gpdr = 0; - zassert_ok(gpio_port_set_masked(gpio_dev, BIT(TEST_PIN), 255)); - zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); - registers.gpdr = 255; - zassert_ok(gpio_port_set_masked(gpio_dev, BIT(TEST_PIN), 0)); - zexpect_equal(registers.gpdr, (uint8_t)~BIT(TEST_PIN), "gpdr=%x", registers.gpdr); - - registers.gpdr = BIT(TEST_PIN); - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_OUTPUT_HIGH, "flags=%x", flags); - registers.gpdr = 0; - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_OUTPUT_LOW, "flags=%x", flags); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_set_active_low) -{ - gpio_flags_t flags; - - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_OUTPUT_INACTIVE | GPIO_ACTIVE_LOW)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_OUTPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - - zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); - zassert_ok(gpio_pin_set(gpio_dev, TEST_PIN, true)); - zexpect_equal(registers.gpdr, 0, "gpdr=%x", registers.gpdr); - zassert_ok(gpio_pin_set(gpio_dev, TEST_PIN, false)); - zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); - zassert_ok(gpio_port_toggle_bits(gpio_dev, BIT(TEST_PIN))); - zexpect_equal(registers.gpdr, 0, "gpdr=%x", registers.gpdr); - registers.gpdr = 255; - zassert_ok(gpio_port_set_masked(gpio_dev, BIT(TEST_PIN), 255)); - zexpect_equal(registers.gpdr, (uint8_t)~BIT(TEST_PIN), "gpdr=%x", registers.gpdr); - registers.gpdr = 0; - zassert_ok(gpio_port_set_masked(gpio_dev, BIT(TEST_PIN), 0)); - zexpect_equal(registers.gpdr, BIT(TEST_PIN), "gpdr=%x", registers.gpdr); - - registers.gpdr = 0; - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_OUTPUT_LOW, "flags=%x", flags); - registers.gpdr = BIT(TEST_PIN); - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_OUTPUT_HIGH, "flags=%x", flags); -} - -/* The next few tests just verify that the registers are set as expected on configure. */ - -ZTEST(gpio_ite_it8xxx2_v2, test_open_source) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_equal(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_OPEN_SOURCE), -ENOTSUP); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], 0, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_open_drain_output) -{ - gpio_flags_t flags; - - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_OUTPUT | GPIO_OPEN_DRAIN)); - zexpect_equal(registers.gpotr, BIT(TEST_PIN), "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_OUTPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_OUTPUT_LOW | GPIO_OPEN_DRAIN, "flags=%x", flags); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_pull_up_input) -{ - gpio_flags_t flags; - - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_PULL_UP)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], - GPCR_PORT_PIN_MODE_INPUT | GPCR_PORT_PIN_MODE_PULLUP, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_INPUT | GPIO_PULL_UP, "flags=%x", flags); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_pull_down_input) -{ - gpio_flags_t flags; - - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_PULL_DOWN)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], - GPCR_PORT_PIN_MODE_INPUT | GPCR_PORT_PIN_MODE_PULLDOWN, "gpcr[%d]=%x", - TEST_PIN, registers.gpcr[TEST_PIN]); - - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_INPUT | GPIO_PULL_DOWN, "flags=%x", flags); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_disconnected_tristate_supported) -{ - gpio_flags_t flags; - - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_DISCONNECTED)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_TRISTATE, "gpcr[%d]=%x", - TEST_PIN, registers.gpcr[TEST_PIN]); - - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_PULL_UP | GPIO_PULL_DOWN | GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_3P3, - "flags=%x", flags); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_disconnected_tristate_unsupported) -{ - registers.clear_gpcr_before_read = true; - zassert_true(device_is_ready(gpio_dev)); - zassert_equal(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_DISCONNECTED), -ENOTSUP); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_input_1P8V) -{ - gpio_flags_t flags; - - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_1P8)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, BIT(TEST_PIN)); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_1P8, "flags=%x", flags); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_input_3P3V) -{ - gpio_flags_t flags; - - zassert_true(device_is_ready(gpio_dev)); - zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_3P3)); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], GPCR_PORT_PIN_MODE_INPUT, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); - - zassert_ok(gpio_pin_get_config(gpio_dev, TEST_PIN, &flags)); - zexpect_equal(flags, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_3P3, "flags=%x", flags); -} - -ZTEST(gpio_ite_it8xxx2_v2, test_input_5V) -{ - zassert_true(device_is_ready(gpio_dev)); - zassert_equal(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | IT8XXX2_GPIO_VOLTAGE_5P0), - -EINVAL); - zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); - zexpect_equal(registers.p18scr, 0); - zexpect_equal(registers.gpcr[TEST_PIN], 0, "gpcr[%d]=%x", TEST_PIN, - registers.gpcr[TEST_PIN]); -} diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/testcase.yaml b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/testcase.yaml deleted file mode 100644 index 67cc43b474b..00000000000 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/testcase.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2023 The ChromiumOS Authors -# -# SPDX-License-Identifier: Apache-2.0 - -tests: - gpio.gpio_ite_it8xxx2_v2: - tags: - - drivers - - gpio - depends_on: gpio - platform_allow: - - native_sim - integration_platforms: - - native_sim From 5533303187e21bfd987093c564be232d4eb391bb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:38 +0100 Subject: [PATCH 1112/2300] Revert "[nrf fromtree] tests: lib: cpp: exclude nRF54L15" This reverts commit af627187895ac36af25032bf592b4a0d419bdb1d. Signed-off-by: Robert Lubos --- tests/lib/cpp/cxx/testcase.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/lib/cpp/cxx/testcase.yaml b/tests/lib/cpp/cxx/testcase.yaml index cbdaacf714c..77d1b06dbb2 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -34,8 +34,6 @@ tests: # -std=c++98) cpp.main.cpp98: arch_exclude: posix - # Exclude nRF54L15 as its HAL is not compatible with C++98. - platform_exclude: nrf54l15pdk_nrf54l15_cpuapp build_only: true extra_configs: - CONFIG_STD_CPP98=y From 255c4caa71f66d9b240ef05ade31fdfece0d6d3f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:38 +0100 Subject: [PATCH 1113/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: align soc_secure.h to nRF54L" This reverts commit f3757a85b149a78b9b7d2d6cb12467c800dd981a. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/common/soc_secure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/arm/nordic_nrf/common/soc_secure.h b/soc/arm/nordic_nrf/common/soc_secure.h index d38d66ab488..948f38547aa 100644 --- a/soc/arm/nordic_nrf/common/soc_secure.h +++ b/soc/arm/nordic_nrf/common/soc_secure.h @@ -59,7 +59,7 @@ static inline void soc_secure_gpio_pin_mcu_select(uint32_t pin_number, #if defined(CONFIG_SOC_HFXO_CAP_INTERNAL) static inline uint32_t soc_secure_read_xosc32mtrim(void) { - return NRF_FICR->XOSC32MTRIM; + return NRF_FICR_S->XOSC32MTRIM; } #endif /* defined(CONFIG_SOC_HFXO_CAP_INTERNAL) */ From 90115aa013c1f8661730902ff1543308f4095c02 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:38 +0100 Subject: [PATCH 1114/2300] Revert "[nrf fromtree] drivers: hwinfo: update to be aligned to nRF54L15" This reverts commit d051c5a5b7d39cb5f650be1995fcdef719f17694. Signed-off-by: Robert Lubos --- drivers/hwinfo/hwinfo_nrf.c | 60 +++++++------------------------------ 1 file changed, 11 insertions(+), 49 deletions(-) diff --git a/drivers/hwinfo/hwinfo_nrf.c b/drivers/hwinfo/hwinfo_nrf.c index 4375cf05b2f..2a79f1d0c0d 100644 --- a/drivers/hwinfo/hwinfo_nrf.c +++ b/drivers/hwinfo/hwinfo_nrf.c @@ -58,56 +58,22 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause) if (reason & NRFX_RESET_REASON_DIF_MASK) { flags |= RESET_DEBUG; } - if (reason & NRFX_RESET_REASON_SREQ_MASK) { - flags |= RESET_SOFTWARE; - } -#if NRFX_RESET_REASON_HAS_CTRLAP +#if !NRF_POWER_HAS_RESETREAS if (reason & NRFX_RESET_REASON_CTRLAP_MASK) { flags |= RESET_DEBUG; } -#endif -#if NRFX_RESET_REASON_HAS_LPCOMP - if (reason & NRFX_RESET_REASON_LPCOMP_MASK) { - flags |= RESET_LOW_POWER_WAKE; - } -#endif -#if NRFX_RESET_REASON_HAS_NFC - if (reason & NRFX_RESET_REASON_NFC_MASK) { - flags |= RESET_LOW_POWER_WAKE; - } -#endif -#if NRFX_RESET_REASON_HAS_VBUS - if (reason & NRFX_RESET_REASON_VBUS_MASK) { - flags |= RESET_POR; - } -#endif -#if NRFX_RESET_REASON_HAS_CTRLAPSOFT - if (reason & NRFX_RESET_REASON_CTRLAPSOFT_MASK) { - flags |= RESET_DEBUG; - } -#endif -#if NRFX_RESET_REASON_HAS_CTRLAPHARD - if (reason & NRFX_RESET_REASON_CTRLAPHARD_MASK) { - flags |= RESET_DEBUG; - } -#endif -#if NRFX_RESET_REASON_HAS_CTRLAPPIN - if (reason & NRFX_RESET_REASON_CTRLAPPIN_MASK) { - flags |= RESET_DEBUG; + if (reason & NRFX_RESET_REASON_DOG0_MASK) { + flags |= RESET_WATCHDOG; } -#endif -#if !NRF_POWER_HAS_RESETREAS if (reason & NRFX_RESET_REASON_DOG1_MASK) { flags |= RESET_WATCHDOG; } -#endif -#if NRFX_RESET_REASON_HAS_GRTC - if (reason & NRFX_RESET_REASON_GRTC_MASK) { - flags |= RESET_CLOCK; + if (reason & NRFX_RESETREAS_SREQ_MASK) { + flags |= RESET_SOFTWARE; } -#endif -#if NRFX_RESET_REASON_HAS_NETWORK + +#if NRF_RESET_HAS_NETWORK if (reason & NRFX_RESET_REASON_LSREQ_MASK) { flags |= RESET_SOFTWARE; } @@ -121,14 +87,10 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause) flags |= RESET_DEBUG; } #endif -#if defined(NRFX_RESET_REASON_TAMPC_MASK) - if (reason & NRFX_RESET_REASON_TAMPC_MASK) { - flags |= RESET_SECURITY; - } -#endif -#if defined(NRFX_RESET_REASON_SECTAMPER_MASK) - if (reason & NRFX_RESET_REASON_SECTAMPER_MASK) { - flags |= RESET_SECURITY; + +#else + if (reason & NRFX_RESET_REASON_SREQ_MASK) { + flags |= RESET_SOFTWARE; } #endif From 679fa07729144b7cf27d9523dd5211ec4c143aab Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:38 +0100 Subject: [PATCH 1115/2300] Revert "[nrf fromtree] samples: add overlay files for nRF54L15" This reverts commit 1aa018c7d6e57b52eb98a732a2c2d02a639443c2. Signed-off-by: Robert Lubos --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 8 ---- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 43 ------------------- 2 files changed, 51 deletions(-) delete mode 100644 samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 samples/sensor/qdec/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 66157d79fb3..00000000000 --- a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt30 { - status = "okay"; -}; diff --git a/samples/sensor/qdec/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/samples/sensor/qdec/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 3d872a2071b..00000000000 --- a/samples/sensor/qdec/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 = <120>; - led-pre = <500>; -}; From db33fd9337a44607aa6940e85a47a3c8ed8e1f0e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:39 +0100 Subject: [PATCH 1116/2300] Revert "[nrf fromtree] tests: drivers: add overlay files for nRF54L15" This reverts commit 0aceeeb549ad60a4906be93c6878d8fc2146b0fd. Signed-off-by: Robert Lubos --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 21 --------- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 30 ------------ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 30 ------------ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 46 ------------------- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 36 --------------- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 43 ----------------- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 36 --------------- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 9 ---- 8 files changed, 251 deletions(-) delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/i2s/i2s_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/i2s/i2s_speed/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_pm/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 97702240047..00000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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"; -}; diff --git a/tests/drivers/i2s/i2s_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/i2s/i2s_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 8b82825a0f2..00000000000 --- a/tests/drivers/i2s/i2s_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/i2s/i2s_speed/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 8b82825a0f2..00000000000 --- a/tests/drivers/i2s/i2s_speed/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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/spi/spi_loopback/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index f2e84b72f9b..00000000000 --- a/tests/drivers/spi/spi_loopback/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi00_default: spi00_default { - group1 { - psels = , - , - ; - }; - }; - - spi00_sleep: spi00_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; -}; - -&spi00 { - status = "okay"; - pinctrl-0 = <&spi00_default>; - pinctrl-1 = <&spi00_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 = ; - }; -}; - -&gpio2 { - status = "okay"; -}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 033aab401ac..00000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -/ { - chosen { - zephyr,console = &uart20; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 945b8628e7a..00000000000 --- a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; - -counter_dev: &timer00 { - status = "okay"; -}; - -&grtc { - interrupts = <228 2>; -}; diff --git a/tests/drivers/uart/uart_pm/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 033aab401ac..00000000000 --- a/tests/drivers/uart/uart_pm/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -/ { - chosen { - zephyr,console = &uart20; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index aa2789dd45e..00000000000 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt30 { - status = "okay"; -}; From bb6741cd621a1a5bea99ade0d756024337599e3c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:39 +0100 Subject: [PATCH 1117/2300] Revert "[nrf fromtree] tests: arch: arm: arm: align tests to nRF54L15" This reverts commit c4ab770ca4f55518376ebe2424cc46969cf43cb8. Signed-off-by: Robert Lubos --- .../src/arm_irq_vector_table.c | 120 +++++++++++++----- 1 file changed, 85 insertions(+), 35 deletions(-) diff --git a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c index f18c30dac9a..7d793066109 100644 --- a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c +++ b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c @@ -16,22 +16,66 @@ */ #define _ISR_OFFSET 0 -#if defined(CONFIG_SOC_FAMILY_NRF) +#if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) +/* The customized solution for nRF51X-based and nRF52X-based + * platforms requires that the POWER_CLOCK_IRQn line equals 0. + */ +BUILD_ASSERT(POWER_CLOCK_IRQn == 0, + "POWER_CLOCK_IRQn != 0. Consider rework manual vector table."); + +/* The customized solution for nRF51X-based and nRF52X-based + * platforms requires that the RTC1 IRQ line equals 17. + */ +BUILD_ASSERT(RTC1_IRQn == 17, + "RTC1_IRQn != 17. Consider rework manual vector table."); + #undef _ISR_OFFSET -#if defined(CONFIG_BOARD_QEMU_CORTEX_M0) -/* For the nRF51-based QEMU Cortex-M0 platform, the first set of consecutive - * implemented interrupts that can be used by this test starts right after - * the TIMER0 IRQ line, which is used by the system timer. - */ -#define _ISR_OFFSET (TIMER0_IRQn + 1) -#elif defined(CONFIG_SOC_SERIES_NRF54LX) -/* For nRF54L Series, use SWI00-02 interrupt lines. */ -#define _ISR_OFFSET SWI00_IRQn +#if !defined(CONFIG_BOARD_QEMU_CORTEX_M0) +/* Interrupt line 0 is used by POWER_CLOCK */ +#define _ISR_OFFSET 1 #else -/* For other nRF targets, use TIMER0-2 interrupt lines. */ -#define _ISR_OFFSET TIMER0_IRQn +/* The customized solution for nRF51-based QEMU Cortex-M0 platform + * requires that the TIMER0 IRQ line equals 8. + */ +BUILD_ASSERT(TIMER0_IRQn == 8, + "TIMER0_IRQn != 8. Consider rework manual vector table."); +/* Interrupt lines 9-11 is the first set of consecutive interrupts implemented + * in QEMU Cortex M0. + */ +#define _ISR_OFFSET 9 + #endif -#endif /* CONFIG_SOC_FAMILY_NRF */ + +#elif defined(CONFIG_SOC_SERIES_NRF53X) || defined(CONFIG_SOC_SERIES_NRF91X) +/* The customized solution for nRF91X-based and nRF53X-based + * platforms requires that the POWER_CLOCK_IRQn line equals 5. + */ +BUILD_ASSERT(CLOCK_POWER_IRQn == 5, + "POWER_CLOCK_IRQn != 5." + "Consider rework manual vector table."); + +#if !defined(CONFIG_SOC_NRF5340_CPUNET) +/* The customized solution for nRF91X-based platforms + * requires that the RTC1 IRQ line equals 21. + */ +BUILD_ASSERT(RTC1_IRQn == 21, + "RTC1_IRQn != 21. Consider rework manual vector table."); + +#else /* CONFIG_SOC_NRF5340_CPUNET */ +/* The customized solution for nRF5340_CPUNET + * requires that the RTC1 IRQ line equals 22. + */ +BUILD_ASSERT(RTC1_IRQn == 22, + "RTC1_IRQn != 22. Consider rework manual vector table."); +#endif +#undef _ISR_OFFSET +/* Interrupt lines 8-10 is the first set of consecutive interrupts implemented + * in nRF9160 SOC. + */ +#define _ISR_OFFSET 8 + +#endif /* CONFIG_SOC_SERIES_NRF52X */ + struct k_sem sem[3]; @@ -138,34 +182,40 @@ typedef void (*vth)(void); /* Vector Table Handler */ * * Note: qemu_cortex_m0 uses TIMER0 to implement system timer. */ +void rtc_nrf_isr(void); void nrfx_power_clock_irq_handler(void); #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) -#define POWER_CLOCK_IRQ_NUM POWER_CLOCK_IRQn -#else -#define POWER_CLOCK_IRQ_NUM CLOCK_POWER_IRQn -#endif - #if defined(CONFIG_BOARD_QEMU_CORTEX_M0) void timer0_nrf_isr(void); -#define TIMER_IRQ_HANDLER timer0_nrf_isr -#define TIMER_IRQ_NUM TIMER0_IRQn -#elif defined(CONFIG_SOC_SERIES_NRF54LX) -void nrfx_grtc_irq_handler(void); -#define TIMER_IRQ_HANDLER nrfx_grtc_irq_handler -#define TIMER_IRQ_NUM GRTC_0_IRQn +vth __irq_vector_table _irq_vector_table[] = { + nrfx_power_clock_irq_handler, 0, 0, 0, 0, 0, 0, 0, + timer0_nrf_isr, isr0, isr1, isr2 +}; #else -void rtc_nrf_isr(void); -#define TIMER_IRQ_HANDLER rtc_nrf_isr -#define TIMER_IRQ_NUM RTC1_IRQn -#endif - -#define IRQ_VECTOR_TABLE_SIZE (MAX(POWER_CLOCK_IRQ_NUM, MAX(TIMER_IRQ_NUM, _ISR_OFFSET + 2)) + 1) - -vth __irq_vector_table _irq_vector_table[IRQ_VECTOR_TABLE_SIZE] = { - [POWER_CLOCK_IRQ_NUM] = nrfx_power_clock_irq_handler, - [TIMER_IRQ_NUM] = TIMER_IRQ_HANDLER, - [_ISR_OFFSET] = isr0, isr1, isr2, +vth __irq_vector_table _irq_vector_table[] = { + nrfx_power_clock_irq_handler, + isr0, isr1, isr2, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + rtc_nrf_isr +}; +#endif /* CONFIG_BOARD_QEMU_CORTEX_M0 */ +#elif defined(CONFIG_SOC_SERIES_NRF53X) || defined(CONFIG_SOC_SERIES_NRF91X) +#ifndef CONFIG_SOC_NRF5340_CPUNET +vth __irq_vector_table _irq_vector_table[] = { + 0, 0, 0, 0, 0, nrfx_power_clock_irq_handler, 0, 0, + isr0, isr1, isr2, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + rtc_nrf_isr }; +#else +vth __irq_vector_table _irq_vector_table[] = { + 0, 0, 0, 0, 0, nrfx_power_clock_irq_handler, 0, 0, + isr0, isr1, isr2, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + rtc_nrf_isr +}; +#endif +#endif #elif defined(CONFIG_SOC_SERIES_CC13X2_CC26X2) || defined(CONFIG_SOC_SERIES_CC13X2X7_CC26X2X7) /* TI CC13x2/CC26x2 based platforms also employ a Hardware RTC peripheral * to implement the Kernel system timer, instead of the ARM Cortex-M From 018c635e74ab3d4ed5e70df7ee4165cd96050dd1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:39 +0100 Subject: [PATCH 1118/2300] Revert "[nrf fromtree] scripts: west_commands: runners: nrf_common: add support for nRF54L" This reverts commit e141bc55f6860d2aee9242ffeae3b44d1a7062d8. Signed-off-by: Robert Lubos --- scripts/west_commands/runners/nrf_common.py | 4 +--- scripts/west_commands/runners/nrfjprog.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 788021c6191..2ff51d7e85d 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -59,7 +59,7 @@ def dev_id_help(cls) -> str: @classmethod def do_add_parser(cls, parser): parser.add_argument('--nrf-family', - choices=['NRF51', 'NRF52', 'NRF53', 'NRF54L', 'NRF91'], + choices=['NRF51', 'NRF52', 'NRF53', 'NRF91'], help='''MCU family; still accepted for compatibility only''') parser.add_argument('--softreset', required=False, @@ -161,8 +161,6 @@ def ensure_family(self): self.family = 'NRF52_FAMILY' elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF53X'): self.family = 'NRF53_FAMILY' - elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF54LX'): - self.family = 'NRF54L_FAMILY' elif self.build_conf.getboolean('CONFIG_SOC_SERIES_NRF91X'): self.family = 'NRF91_FAMILY' else: diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index a28681ae6a5..8762ce0e740 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -46,7 +46,7 @@ def do_exec_op(self, op, force=False): # Translate the op families = {'NRF51_FAMILY': 'NRF51', 'NRF52_FAMILY': 'NRF52', - 'NRF53_FAMILY': 'NRF53', 'NRF54L_FAMILY': 'NRF54L', 'NRF91_FAMILY': 'NRF91'} + 'NRF53_FAMILY': 'NRF53', 'NRF91_FAMILY': 'NRF91'} cores = {'NRFDL_DEVICE_CORE_APPLICATION': 'CP_APPLICATION', 'NRFDL_DEVICE_CORE_NETWORK': 'CP_NETWORK'} From d9ec2079b402569251308de81e8c57baede297de Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:39 +0100 Subject: [PATCH 1119/2300] Revert "[nrf fromtree] drivers: cache: add Nordic cache driver" This reverts commit f4ded0b8a67fa86a820716f4322980ea00a08beb. Signed-off-by: Robert Lubos --- drivers/cache/CMakeLists.txt | 1 - drivers/cache/Kconfig | 1 - drivers/cache/Kconfig.nrf | 9 - drivers/cache/cache_nrf.c | 390 ----------------------------------- 4 files changed, 401 deletions(-) delete mode 100644 drivers/cache/Kconfig.nrf delete mode 100644 drivers/cache/cache_nrf.c diff --git a/drivers/cache/CMakeLists.txt b/drivers/cache/CMakeLists.txt index 23cb11afb6a..47c790f0a89 100644 --- a/drivers/cache/CMakeLists.txt +++ b/drivers/cache/CMakeLists.txt @@ -7,4 +7,3 @@ zephyr_library_property(ALLOW_EMPTY TRUE) zephyr_library_sources_ifdef(CONFIG_CACHE_ASPEED cache_aspeed.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE cache_handlers.c) -zephyr_library_sources_ifdef(CONFIG_CACHE_NRF_CACHE cache_nrf.c) diff --git a/drivers/cache/Kconfig b/drivers/cache/Kconfig index 4dcb64f488a..834cc49e181 100644 --- a/drivers/cache/Kconfig +++ b/drivers/cache/Kconfig @@ -19,6 +19,5 @@ source "subsys/logging/Kconfig.template.log_config" comment "Device Drivers" source "drivers/cache/Kconfig.aspeed" -source "drivers/cache/Kconfig.nrf" endif # CACHE diff --git a/drivers/cache/Kconfig.nrf b/drivers/cache/Kconfig.nrf deleted file mode 100644 index 820445db432..00000000000 --- a/drivers/cache/Kconfig.nrf +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2024 Carlo Caione -# SPDX-License-Identifier: Apache-2.0 - -config CACHE_NRF_CACHE - bool "nRF cache driver" - select CACHE_HAS_DRIVER - depends on HAS_NRFX && CACHE_MANAGEMENT - help - Enable support for the nRF cache driver. diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c deleted file mode 100644 index 63d76a47d6e..00000000000 --- a/drivers/cache/cache_nrf.c +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include -#include - -LOG_MODULE_REGISTER(cache_nrfx, CONFIG_CACHE_LOG_LEVEL); - -#if !defined(NRF_ICACHE) && defined(NRF_CACHE) -#define NRF_ICACHE NRF_CACHE -#endif - -#define CACHE_LINE_SIZE 32 -#define CACHE_BUSY_RETRY_INTERVAL_US 10 - -static struct k_spinlock lock; - -enum k_nrf_cache_op { - /* - * Sequentially loop through all dirty lines and write those data units to - * memory. - * - * This is FLUSH in Zephyr nomenclature. - */ - K_NRF_CACHE_CLEAN, - - /* - * Mark all lines as invalid, ignoring any dirty data. - * - * This is INVALIDATE in Zephyr nomenclature. - */ - K_NRF_CACHE_INVD, - - /* - * Clean followed by invalidate - * - * This is FLUSH_AND_INVALIDATE in Zephyr nomenclature. - */ - K_NRF_CACHE_FLUSH, -}; - -static inline bool is_cache_busy(NRF_CACHE_Type *cache) -{ -#if NRF_CACHE_HAS_STATUS - return nrf_cache_busy_check(cache); -#else - return false; -#endif -} - -static inline void wait_for_cache(NRF_CACHE_Type *cache) -{ - while (is_cache_busy(cache)) { - k_busy_wait(CACHE_BUSY_RETRY_INTERVAL_US); - } -} - -static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) -{ - /* - * We really do not want to invalidate the whole cache. - */ - if (op == K_NRF_CACHE_INVD) { - return -ENOTSUP; - } - - k_spinlock_key_t key = k_spin_lock(&lock); - - /* - * Invalidating the whole cache is dangerous. For good measure - * disable the cache. - */ - nrf_cache_disable(cache); - - wait_for_cache(cache); - - switch (op) { - -#if NRF_CACHE_HAS_TASK_CLEAN - case K_NRF_CACHE_CLEAN: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANCACHE); - break; -#endif - - case K_NRF_CACHE_INVD: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATECACHE); - break; - -#if NRF_CACHE_HAS_TASK_FLUSH - case K_NRF_CACHE_FLUSH: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHCACHE); - break; -#endif - - default: - break; - } - - wait_for_cache(cache); - - nrf_cache_enable(cache); - - k_spin_unlock(&lock, key); - - return 0; -} - -static inline void _cache_line(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, uintptr_t line_addr) -{ - wait_for_cache(cache); - - nrf_cache_lineaddr_set(cache, line_addr); - - switch (op) { - -#if NRF_CACHE_HAS_TASK_CLEAN - case K_NRF_CACHE_CLEAN: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANLINE); - break; -#endif - - case K_NRF_CACHE_INVD: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATELINE); - break; - -#if NRF_CACHE_HAS_TASK_FLUSH - case K_NRF_CACHE_FLUSH: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHLINE); - break; -#endif - - default: - break; - } - - wait_for_cache(cache); -} - -static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, void *addr, - size_t size) -{ - uintptr_t line_addr = (uintptr_t)addr; - uintptr_t end_addr = line_addr + size; - - /* - * Align address to line size - */ - line_addr &= ~(CACHE_LINE_SIZE - 1); - - do { - k_spinlock_key_t key = k_spin_lock(&lock); - - _cache_line(cache, op, line_addr); - - k_spin_unlock(&lock, key); - - line_addr += CACHE_LINE_SIZE; - - } while (line_addr < end_addr); - - return 0; -} - -static inline int _cache_checks(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, void *addr, - size_t size, bool is_range) -{ - /* Check if the cache is enabled */ - if (!(cache->ENABLE & CACHE_ENABLE_ENABLE_Enabled)) { - return -EAGAIN; - } - - if (!is_range) { - return _cache_all(cache, op); - } - - /* Check for invalid address or size */ - if ((!addr) || (!size)) { - return -EINVAL; - } - - return _cache_range(cache, op, addr, size); -} - -#if defined(NRF_DCACHE) && NRF_CACHE_HAS_TASKS - -void cache_data_enable(void) -{ - nrf_cache_enable(NRF_DCACHE); -} - -void cache_data_disable(void) -{ - nrf_cache_disable(NRF_DCACHE); -} - -int cache_data_flush_all(void) -{ -#if NRF_CACHE_HAS_TASK_CLEAN - return _cache_checks(NRF_DCACHE, K_NRF_CACHE_CLEAN, NULL, 0, false); -#else - return -ENOTSUP; -#endif -} - -int cache_data_invd_all(void) -{ - return _cache_checks(NRF_DCACHE, K_NRF_CACHE_INVD, NULL, 0, false); -} - -int cache_data_flush_and_invd_all(void) -{ -#if NRF_CACHE_HAS_TASK_FLUSH - return _cache_checks(NRF_DCACHE, K_NRF_CACHE_FLUSH, NULL, 0, false); -#else - return -ENOTSUP; -#endif -} - -int cache_data_flush_range(void *addr, size_t size) -{ -#if NRF_CACHE_HAS_TASK_CLEAN - return _cache_checks(NRF_DCACHE, K_NRF_CACHE_CLEAN, addr, size, true); -#else - return -ENOTSUP; -#endif -} - -int cache_data_invd_range(void *addr, size_t size) -{ - return _cache_checks(NRF_DCACHE, K_NRF_CACHE_INVD, addr, size, true); -} - -int cache_data_flush_and_invd_range(void *addr, size_t size) -{ -#if NRF_CACHE_HAS_TASK_FLUSH - return _cache_checks(NRF_DCACHE, K_NRF_CACHE_FLUSH, addr, size, true); -#else - return -ENOTSUP; -#endif -} - -#else - -void cache_data_enable(void) -{ - /* Nothing */ -} - -void cache_data_disable(void) -{ - /* Nothing */ -} - -int cache_data_flush_all(void) -{ - return -ENOTSUP; -} - -int cache_data_invd_all(void) -{ - return -ENOTSUP; -} - -int cache_data_flush_and_invd_all(void) -{ - return -ENOTSUP; -} - -int cache_data_flush_range(void *addr, size_t size) -{ - return -ENOTSUP; -} - -int cache_data_invd_range(void *addr, size_t size) -{ - return -ENOTSUP; -} - -int cache_data_flush_and_invd_range(void *addr, size_t size) -{ - return -ENOTSUP; -} - -#endif /* NRF_DCACHE */ - -#if defined(NRF_ICACHE) && NRF_CACHE_HAS_TASKS - -void cache_instr_enable(void) -{ - nrf_cache_enable(NRF_ICACHE); -} - -void cache_instr_disable(void) -{ - nrf_cache_disable(NRF_ICACHE); -} - -int cache_instr_flush_all(void) -{ -#if NRF_CACHE_HAS_TASK_CLEAN - return _cache_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN, NULL, 0, false); -#else - return -ENOTSUP; -#endif -} - -int cache_instr_invd_all(void) -{ - return _cache_checks(NRF_ICACHE, K_NRF_CACHE_INVD, NULL, 0, false); -} - -int cache_instr_flush_and_invd_all(void) -{ -#if NRF_CACHE_HAS_TASK_FLUSH - return _cache_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH, NULL, 0, false); -#else - return -ENOTSUP; -#endif -} - -int cache_instr_flush_range(void *addr, size_t size) -{ -#if NRF_CACHE_HAS_TASK_CLEAN - return _cache_checks(NRF_ICACHE, K_NRF_CACHE_CLEAN, addr, size, true); -#else - return -ENOTSUP; -#endif -} - -int cache_instr_invd_range(void *addr, size_t size) -{ - return _cache_checks(NRF_ICACHE, K_NRF_CACHE_INVD, addr, size, true); -} - -int cache_instr_flush_and_invd_range(void *addr, size_t size) -{ -#if NRF_CACHE_HAS_TASK_FLUSH - return _cache_checks(NRF_ICACHE, K_NRF_CACHE_FLUSH, addr, size, true); -#else - return -ENOTSUP; -#endif -} - -#else - -void cache_instr_enable(void) -{ - /* Nothing */ -} - -void cache_instr_disable(void) -{ - /* Nothing */ -} - -int cache_instr_flush_all(void) -{ - return -ENOTSUP; -} - -int cache_instr_invd_all(void) -{ - return -ENOTSUP; -} - -int cache_instr_flush_and_invd_all(void) -{ - return -ENOTSUP; -} - -int cache_instr_flush_range(void *addr, size_t size) -{ - return -ENOTSUP; -} - -int cache_instr_invd_range(void *addr, size_t size) -{ - return -ENOTSUP; -} - -int cache_instr_flush_and_invd_range(void *addr, size_t size) -{ - return -ENOTSUP; -} - -#endif /* NRF_ICACHE */ From 5cd9582cdcf3adc85ad7dce76e1665f19ff3f0bc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:39 +0100 Subject: [PATCH 1120/2300] Revert "[nrf fromtree] boards: arm: add Nordic nrf54l15dk_nrf54l15" This reverts commit 9dc7ca71bea83594f529f7e9f28aed035052e35f. Signed-off-by: Robert Lubos --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board | 6 - .../nrf54l15pdk_nrf54l15/Kconfig.defconfig | 12 -- boards/arm/nrf54l15pdk_nrf54l15/board.cmake | 4 - .../doc/img/nrf54l15pdk_nrf54l15.webp | Bin 35746 -> 0 bytes boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst | 134 ---------------- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 36 ----- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 149 ------------------ .../nrf54l15pdk_nrf54l15_cpuapp.yaml | 19 --- .../nrf54l15pdk_nrf54l15_cpuapp_defconfig | 32 ---- .../arm/nrf54l15pdk_nrf54l15/revision.cmake | 9 -- 10 files changed, 401 deletions(-) delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/board.cmake delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/doc/img/nrf54l15pdk_nrf54l15.webp delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_defconfig delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/revision.cmake diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board deleted file mode 100644 index d95fe51009f..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.board +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_NRF54L15PDK_NRF54L15_CPUAPP - bool "nRF54L15 PDK nRF54L15 Application MCU" - depends on SOC_NRF54L15_ENGA_CPUAPP diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig deleted file mode 100644 index 532ea07c859..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_NRF54L15PDK_NRF54L15_CPUAPP - -config BOARD - default "nrf54l15pdk_nrf54l15_cpuapp" - -config BT_CTLR - default BT - -endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP diff --git a/boards/arm/nrf54l15pdk_nrf54l15/board.cmake b/boards/arm/nrf54l15pdk_nrf54l15/board.cmake deleted file mode 100644 index 378b7bcdb57..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/board.cmake +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/doc/img/nrf54l15pdk_nrf54l15.webp b/boards/arm/nrf54l15pdk_nrf54l15/doc/img/nrf54l15pdk_nrf54l15.webp deleted file mode 100644 index 80fb2060a0772776c3ba1a4e092ba7c28f13bbd7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35746 zcmZshLz6Cy4ur?HZQJ%4+qP}nwr!oUZQC}_*yek`A8@nks%%n~MdwMivXr=Zb_@`Z zhM0(=x*``*{C~P(1vn3wW(cGPSm3X0feZy1MHyAA&cOmYwA?nnnpP_aZXpd2bOX*) zJBGr$#hc*#XQ;D6OfKq`@OM3!kKpvzTtM%n}~`iv^bgjsbv|%b%-v3ji!2V-52+ z001yV1pIFOko^P$z<=)6DZ>G=0PHW9U)tq>iQkBC!FPpS#=E@(Y>R736~>&O!aa@B=8E z^8Nze=au`V0nh-MZ_WY4C&rtCH^AT*_wVtm&a}xb;f>%cAnzUY*W+gy!1y^oTVGyq z+y5QV0C2m+y#)OBU-f|olm&!5-v9uB;e)q3MgZWq0CB&EaKM*jUF765 zL064Pv9%g$y=%KSx7jwKM=P=_QM%)JG+KM@sSLkDvMo^V~ncloY;(XC8 zr~6_NZGEUC*c5R{K42-8ITK}Ads{)-+qLMRO--V#bK(iYZ~}8&i_Cnb%E$NgHD3`^ z;C@s4V&?5zAs-k$-#>TdT7+ph;Df^Y&L#B3#tZAP*|Vr{q72b(FO_5tWMCZ?bTtg zchU6ZG*`kA2F2_=STI+8Mae8}!dQHSK~qEwe&l_=^H!wdwjVP;J(@qInn9zrclk!x zhW(=RTrpi}v1F`7M_n&i;7Ft+GE=sGkEX4X@bwjwdHfzpw1f0|*+>3BkGyML2Yn@o zsp1o4*-&4Ob3>MC2bQ4fYg%`4-OQS9F7lbwhfg+HpO0MVVhL<%fS9k0tMAdH>wpm3 z15m>oT#vgJ8tTAut;?P@BMrCpZD%){`H<7V$C-?-6%hQW!8N+3Qs01W>|Mi?3}`cr zN=dpeLIkGjvu9*J|7jv}f35<<>f`qHu2+>B=MBgDEwJ*-c+zZ>S)CRHjV6_fZrf1^ z1j#A+dB)fr;zYh$fDm$^eu~TSGOuu2jwjHM}}3dVmX#ozr6w36w9}lM4~I zKv)cVyvr#+@Dk!gi8#+pgyWzP1;ZWyp{44#T8&|ArP9lV5LHfuTQRh8yBc^SX!VG% zzw2K?&g**uK0+qpEv)+z*|=w!Y4nXg*Xy?E)RubQYGx{z>2>PZrswnN_L_Rky+ZFx ze#hME-z$Gw(iaGv^Iiz~DG@%{Ee>yk$D$XDqDHX;+$u8eLmb(dW38R$E-Ps&94RsF#-Ir!%2{=%%T^H5wv z)l7XbZm=kwL>T-?l*>N6cNw{4#_YS*xEcekh!|tL!uf7NEZm1J+5ISFTOz|{L!ZVV zaC}VrIdx}X#wSno6>J)c&$sX!&*4oP*CjLeUQlQw=$-qe=HEjejZxuqyEBW@M%6))@IEfC zV2OGvT861RTLeWR7vCX35kePuaU8H=yD?9l*K9eh0AkaV{XLKs+Z4J8QeO_lryTG%Zi86s^;|b`04L6Au*S4Z8C?6MEppm=?=X- zX3~1kAnkEyrxm0 zA3q~0t^+=*!pIdj2q%n9!u<HH4E+#aK!7m(jK9SI%QkTVknqzZ3jxWuN%|9q zXV5m9iNl-89>s6rc9W2sy>wo(LJ)_)?`&G^E3bY9}%; z1*N;-2wh?Sm$-gcRkc}NkDa@nAU~o?nEY(iv*YatVpLAD5xQu&w#~8ZH~V}>ndaeI z5p`rxHVg`|L6z!Z!%D*zeS=lxTqQKFFTR07vAorc+1BsO|C=~UK#*3Vt5H%1Y*=b! zg)G<|mpyF%a%dxK;&|e7|w8Hw=cP3 zli;6#Z{s88SCeejfW6c)FZ@WgN5fu8ChJ)X-W)~{`ZHr$c=n*d_imW9yxXD%GI+<0 zTgKo|7|5xrGvU$)?IIa{ zO?cdQ>6)N;+J-bbeh_G(l_RirXpeO=xLUEj|n5;m`%)h6~V z^{ej8`aOC1NH4MEaPm|lcjPo75_RAybTGa1kI$hMD3S<+rD!xx@gixClRb z!2>h-fGSN>EhGJVFn+n|p@u1rMFS??VuGsD`R8{ty13hcHEACDJ!2FdVDEd=f*(1j zGY(X|l5MewDdpoF%OnP8@z`dHVMq%&xIjlq=o5=dc8O7zTm);V=C+6?%;OBvqEZ>{2 zxwf@b**hqT%3An8>_s}oHv<%!7X{=7EdAH;4j3V#SohjVQtDjfCK6If65HPPdgF%$ z>_PH91hmCbXVVMSUl?X=`FqLtcD##iemBe*52aXn67HndsE-$4#zO9>0v=THG{%Bsw8OAv&k5S5IeggwCM@(I{ij%AZ;JW9h> zKFtz@lDT|Ukf?H>^CY;y13TSKTjq5bOJ zOgsou&*?DS;z(nif2u$lS+cujP^w5!jN{qK?w22<=YH|PFj@C=i|uw{trsVbEpeaM znzc@nYJy@B#P7iR$0@9P*)Ku+n7Pol`pYO10sh4{>`FrlO08PsK%A5sO5L`G$Lr;& z$V6sHdtor_-*+XoOcL+x8kvGlQ_Xe5z027l%{ER0FF{xy0@8u3f)1kMi*xFdW&|^G z+-n$&)B+v>A&VhxgH1%+YPkW&XlN22cRcOQTG;~|#)Ld2q{UydKaWI^5TI)r=HW^nCTkWp^IF!I5-^r8SmWFR345eWfP7h{{8Nt4hu@;^xVaBv6iGPu3Y zDytWSpZ|#Uzj^XbV6_b6k~KQrnt9`j3@oAwm0+yB#l>tzM&%=`8MKOVzrr3)xnFJs zGQbv?&ld_Q6-JfT3pg)2V%5Lv8TDnKWTy1=hD1{t{M)_jlej15=KoSqM)V*5$2{;Pq>xZf1X?)PCMXGT9UY*IR((hr zoYwRl@kV1ar8~vU*4R!-ujoaE|pfjEn_c zPhpHFP}SVpImT~@{o`C=0^vx#ZtV}S*m~!xnvHbk4h$2E`b)w9`hGS)!A7J%&czw!d{kj3jwl*YyuUZn7KGPXb`Eu^Q-jQ$ls>=xCL_F?Lm-Q^$SKm zzKh#Sn9#i`-%Me<&y+EJitA(d!n=nT`o@J>-b{ z6 zB@I2(IgIi)i4GlyJToZ=A=Ks3mTkDwQr<)V7H6e5yr;G;h<`lW|9INrE7s1oRKYC! z+O*Y_DcvVJZ^RKM5TTzx?OW%uHWLWQLvyr^YIGafVr~u=pP>Flb%h=F zWDd1Nj~3Cg6n3lqNa@DpZ3RQ+_MQ7~7Hrb?|Dt)1-A+753!CTBLX%0QDIZOk5^z2P zmQM&p!abKKDFHHU=HU7?X8TdmHGJ?>V8^t_{UA_s=LoFsjKjJv5i|Xzhv*d#QZ-tXT$PX%VS3q)xOUJkp>7NcmL=7hn0dpMD_h|@_7oFCY z2&%E8b)uQcYYPa%4mrYqD?ibHa6*vpeIs&Py2StBtA9Fl=Bil2%SNK%Y|FO&Z0dy6 zICCgk=3!ArR@1RygI3;~PfCH%+2~;`{VBhzaqaB06uQe{CYai2(4vtSLQ63eJaplr z4x#JyRL%^j8($z>rUa$JfHk^Q zANj;w_ld~Gr@(4bX!82j z{1L}@Z1`VI$ycsZwc@7T_7Z zk9>BR#caz_WNi2E8YUEHz5vK~w!(6{!$cugtPC$(h{#*2+&+&~9~EL`pmvvosF&2c z{#_Qxf;P5;ShTGV$7WswgwX&YeLX-rSJ}Y>q}d%-++p;(kfe6unGvUqc)jO>>b1jn zFsE>pC9$9Iyr}kXl~1#20v^mfQJ-&c0)08?tU!Xs8NyF<`|c`z!3KN6rJ_X=!}HZ% z!^z<3C65;=l1to1E9y29db8|ZEI9%Yi9`O!t4G5DtKA=?p!n$AFp&}*0n0v{@qcDt zFpI=B$Hv)c?^{tm*~r)fwv$}kOv_fBI9fF9N{fqTz}gbc6|3jNVhxDkVo%az6<=$9I&K28SA-zb%#B&3;uUpJQ@bXY zN5HQ1?M$6dn}zUEM-$d@YOojL<#vCzD_}+G_2%U7k=Bvi{YzbYLt9HtI+p~g`q=gWPFSUNb#yJAXTu4l{l)Hku*? zCJ+>$W)g;jd-4uYV7rnfjNMqtX^!?s{Et%fwoXwz7?(20tp@anX#pWm9 z;t8-%^1b5C@~xwMlVXQ1a$7we-4M;qR6 z&_4VDdh^v0Y~mK@HY5tJv|$aAP2p@~#&z9Gx*Wz{i{18E)5q{#_EWL6iobx$D z?SQ?skyzpKw}F=JH~NvC`NcpnjQgQ~daY$;YMj8Lw%M?~@Kj?8z2wQJpG%5LZeN&h z>H7O5T|;>1w!U<=yv7eqo0|ZyUtYCH-^5ixvfw!%QtyX_y$WeZo=lwj{E?qSu{Q}X z;~D;+=b-~8%C>&DI;DFAz3Po%5i#H?^2{SDzHTslMyICKGj-Sy2>;VoV2XKabf&Z) zUjq+Atc5(twr%ZzWqSzJYKRyeV`sg-Tfu7o@;(g2v-s|KZkAG#=(5IsFI9~_tC(A8 z4daiJ%n6qMatwq_73G;faLEiR1kq}MHl$DsfT{s#)6nOj^NF5Pd?HKi#py{`U$MUv8qQc)6Ebc}X zs9;ik6HapWC!qT*hlZGe=*)G9+U@P;ccSgqlHMLbz$F77VDavG6(M zI#lMNr;H$z?z^ve#BghfXm}GNn0zz53mH6|lcH zhxyT>D#LR}MPn+0!Kr_tTTGE5RP7(aI`SYtB;;#j8JU8GZ9mS-K}TllHO4W#@SuDK z1@j8z%zdHy->lA_RzWSTPOdjGb)ze0o0)&KAUL!=Lh+Tt>b{Kn#CZe1c}T0@EcCXHH% zjHh=!|L<`J^-&uxd51di!^~hUn#+o2@U4xYw&F#fh-(}Xy=5ynK&a$VZ&c5=&+&u- z{(OC8x?6PCfk8?VZ~Z1Q4;7)B;fQ*XU=n+s!C?EG9dpA(a=rP$%Dx_)&0{N2zp>zeKTF~IgQHCC zFtEWHt%|xa?ei!h%RuJJCU0g^e1}JZxIh?e(#;1V$gzi2=E(NeO|Xb&5LKaMu?;UW z_!T*N&AtzIA^d$jQ+<=pND}`eZ5UvaiZIH`F4k=Z&c=hRU2863OJUaP|jYmwx&lQc_$s6x1Ch9~k zXiA+^FNUDFT`#?Zd+t6JpxwePr|W$_I;}b*t`4272Z{q9E|mp#MppPF)N6djXv96$ z%d_x^rWA*i4d;3NL&_u+!i4+|9J$c|Hh6R6G05Su#~TSPBJf7yJl42E8iGZW{u%!% zACF>Rhl4y8NasM{RMCjt&C!=4bHmFwnbjbNYX%SR>QGyC05FXL56@SgbtHsMr5XTkNZp;(3*wgS>)a=&g z>ac3?R>e_qwNbPiq(%G;?h%i!K8h9@lxmx~xm|VmNof?j&yu%TWx_9ZQtX|-VIw2t zHPT!jdS3LKX5+GM<2Aue11w|0hlgFuP$5xrMy!$8M3W#|FLs>3sot$# zZq>5Tg9+fZH0SE`GHI+ydhJ*y|o47}b{dG^k_J%BeZ^9xljU{A(pi*UVqCh5F>Oz#N(Y!*%M z#D(!QwSf&E5G-7}Qe%x$N>0`i0WGMKjf$%nRdeQ~fz0Jg7y6Mu2E|{Ch0W%#w$$FB z6yk?&(kvbvv^a=thvVSV5Mo@gG$T%ZafUHkfh?lB<%EmLt-D%G~@c8;3&?BRds=~0ad+b z^hjUl<*na9iH>kc-{snPO(uB>>yhjb1I%FsM}>qXj)kMer)a|;DZaIk0_p3ay`y;(|C+6lp96Gs_R z=mbm$qJ@TNTe`2?E-Z^be+dC#-_oY?7@n&C&~{Y7X%N#g-GhM*RJceV;2iKe9<~*tP4%PX9yJq>*+|j`fIhV9tM9BO z-RS0diuqqTk=`o}aVsP8dKhI{S?B~UVyoFhp^mh2!H0n%#$j$Nd6^?u@V=6v^vMy|gVRAGBKv3)wOTT zf)lAvh^?79=cgCF86;d#K40AQ!?Nqu#*#%}wewLejHUikR@bxP$V zr&#ft22Yz+%{vLkr3DfVJdgu8NyT3P1o)xj7F^b9HOO`ooi#iMs{TIuO<`T#l^(*eRvZgAi-7_k+7d2?Ov`;dz+1j#o7 z60f$;U>ObOlO&GdK~C4p7;y%^7+N5rNa}_d*Q-GEh?bXrC(q|lq2&Cfl_)q*=Ohd| z=(Zi_O(qnU+s1F4Lwga(S=yg;)6`k$dt0Jl6w3amD4uv7k2s!e~2yr9VbtYq@aMBBV};Xn$#?SQm*D8kH4Vcz==hy@q3l zi>zcTw}7Hd7)^~^K`pM0p_?Abh+c@vN(c7ky;A;d+Ub;>S(iy#hSv+bzdOfj_SYv* zBHhA5Vs{tX%^z=Rhj7cXq0vNbx{j`4Vp<_W#~zSsczTAwG3xtLVGnhwS1)5s4PGsF z<<}1`qKc0pi705+E=Z;-IQE_zJ>E7Iy4_a@S5U zyeWA~M1@Zy>N=)ayHG83Ji}ZAjdt+%)+THIF#7rXzH=LQewRMZhtyot4`|jEr75F3=o>`r*E2apWZrvCZ3ogd%a>tsgnEU@O;TZbA2=Lb^cQF~}d}k}8 z8dv$C)q>JHt}A^wq-rX88jHfS1cpXR>@M6QN+MrRl}(g$Gf?4jjS;v>jYwV5DCxs{FKrG(OGfMjn-TjwxL^M)lV}^3RQJ2^% zX8422b-^g-QLVXJ06x9~U>{_PQx-?{V<1OM0BO8d^73q3HwZPXVCUjU)rSVMVhXtbw7YiE+YcAw6xH370#7OU*l1MdG+mLTrG*v z@P3klVWEpi5v^GdL=eM%VM2U0{WKoxC=o2Rq#=VU?B6=6m!u9h0u?kRTA=wwT?;C_ zrnihr1P0TzBm$9G!*;Fa0ION{N z%@roMFWg&gzs;x%=S2^7jK05Qa}6`dr*9@RR6gS{kC2-1$hRfm7?mq1fWO9N@Rmf@ z4Hq3Gb@J8fHyI5nR$EtcQ4j^-%ChN<2jKPQ7SmC5rE#uxnr3j4xt|KL-xv1mHQ3DW zW)y`qi^brZ#1?8KK3S>pIZjMON2^*Yu_G^s4!pJeU;BLAAImCrxeqC)pp0t#@4*O} zlES_H2a2ZBX35GWw!NO5i<40F{XqoGS%K8%B#;$0pTNhpOAOtj79N)>2O|adhued3 zKTb296HGl!{dE%S>bx73wE6WV?76@J6GgAQs_vx>2r}*pdwE_Jwwb5$p=r`w87sZ` zp2F{XB6&KJ5jL_yPu!x`t71&p307d-*dcyWDg%w1)c(~Qp6vA=0nAzuIJ?fFZgaSwpc4C)2}lps1mS%O8**XQpahUAGbB1L&yG1RP8#nX z1~g~{2HN=+s}%sLL-=xCaY(*hz5GnL7Yn}^c zIdkRNCCem-&bE|o!f86zo9yU5Uew>>Boxd-tIY2!+ryM=O7+=)2wK9DEdaZWz}p}} z8?00fHx94^bJrEjg<^pQbI)3F-jn~b0z8w}s|_1)rl;vZ@mD+I9dR%@RLitFe&6Rs zsu;~%B0$^S`$6EOxV;9YFErjyAPXzW(fuQ0%GSU%UE5?+w}siX zBxk4Oa3@2wbf^AB2|jJy8f<&u-DSmv!0{X8x=oZ>f@D zd9`3>w`ur*;ks|A?3Levy#wM8%9MOm@~X*ea)sm>N=-k^Pyp?0|5{FnX- zF?u99dyhgv%-sn*ev`nZnEGR{_=sAD}mCBZh5 z(W}x>!;q^F9Ug^OlooQepdt;nO(l=v?01$#kEIesYcG$@v+8X3x3#=`3$>`%LlT%C(3XCbYO4?l5xd=81)d&dCaFh?C=hAXySMCQNLpYkSaQ^u{{B{N6%##v(El)cV3hwY=SaL@d-)b!+>O zb_YGk`%Ro+AYJ+lBL`@Kvw)L)5{$2GKs#s6fy2mAlJAoW^ke!qj19Jr2qwk2a`>jt zb2{!OSaU&;7&uew65Ks49a8a~juzb5QrKY|GrG0Z_ZOO5N#*_75kqRE?N!963DE&NqSN1Y4LiPP4)6#$xl|Y3+rGVK9;o z8eN=oU)lCIzeTtR;62gC6n~2w|5wltRUsCbS?Z9XeoMk+!lH||7lIly=ptR@` zDo`Y+#tJ@9jJJNJj;f%RXN` z+DT#C#OxRH6@c~Y64i*@97q-lsqts={lRf$jDf1m7bJZ)WPqkfR=_?+F~|*vWF<32~=>e0j7)e#PPF=fUYLY?t5W za3tb>Nxuk35+n^>V>c%vxxAqrVr=&l#O;GWGLM#s<<(xfB*EwV&nx5s;33cpR} zoYWr(gWiazF7Ru%DI=_E$5)U2qv)jZ2)eF20R1aMZWOP_BSJGTR#JFocQjcVGkfR3MAXawp3x5t{S)Rst?PPWT772A3Mr-@M!bPEwiC zU#e_lNO@w7EkKO`JqdgMi!oEPj^8f9wit9ew`bxvCB#bCe1ku;F%|;7=Po7-m4gn& zOB>I=-qjO37WLq)aGXqBijpP2*1N(KNREElmDHh1k{TX>6xY=2O-B^|l``Z%7D4jm zjQv&99p~`5Yd}iRz9~<{?rKiCDfxO$1 zoV4@^*^iL9o5ItpNHOV|Tt6&ff+SJlGA(Q1v!%6M`ZzmLR;aEv+t%@_mJs%fKXqes zRrhPDR~L_DecqNc4er)@&XXjv)`MDbk-x&{Eb8N~i^Zf<=5_#j>s05V?Fp*4cZUA~ z(Y&k`<)^7ibubpoXdoaj#5MKO(A3e`h3f1^soE@RXT&fSmo$yh#_6Cm5sqsDUNwvI zP6*)N-J8G~tj%V%%ny(E*sS^6U5r`o$|xnD6#skX?tHK>kA8O@Kc=XgjAJg)3?&|* z^Cufm+)}MIZ>)MCJJRmadw0qJmSR5hR3`89&2?XX3@o$Z-?hk6@O+&~Ek6pSv0wX) zKFq#=AY&fCaS~tLXC?tnQXPEG{V3tjLDpVWua;52yi2Z{tnmbPc^amc1-6DqUWXs= zM!1!`i1^|xnfNMWoiaUj(3U&SXUKGsBmrgjStW8md$Tc)RfNU1w_n*O&r%){e78|CT`fka;cniEx^6Q-SEq)2lrKx-b$bfQ7w z@`RRjgkJw_!Vd`mY{}phFi`ckMVz#I51a-3ENr+X?30u7Wi|)P6HsIDmOrT2@f!jE zy;N;*AKpxzO)CTb3(?e7XX&1jTla;NczY`SHxd;3aw!_a=M=$`Hc|x3lMD<$wxCcI zHh>B7*|e{!LLy50ZR1@FHa)A_XtUt3?|saI9tmzM_6)RQ7Ba_yQ;Wkhy5oLoGW=R7 z{7G;`-Q%7VRKgJf4N@ilLxzIVXC4wXX@0wnT$SCtu6oGG$}#Mn6`Ztj?y!)jK<)lC zn_%NntTl((0;kkTD?|?AU}e9c%E%9<6{{#m_6FC#k*x-h&MRvRCaA!B@J81oSeYk3 z_pjG}TqM2Pdzj2W9TS9qVl=`5zlsEk@Y>0Wci#SuOvVP%GJkon1}f7KH>{4CD%XF( zvR_$C)-qR_s89ZPGB~v*-aF&l_*sQO6z&2k2uB9PC6sg^wxU#Vo@aMNg(hy-yGd0) z>3b=AZq#%lo3cslE9qzFYws&1)->Bh(L z_fHjo1-W|5EGbOpsMBB)N)B!S#9Lr?mk?F_v;Oek6iERr>zVRyl1rJCJXV>~FqPM< z_7iF|4NIzoW0oMnMz}K%OABbK0dq2rltl8ei^G1@(9Z|&vo2c^sD9;~V{~>N>3Dnh z*oyft_eiW zG4ePsh!D*^gk3LT`oeNJxI-bn#46JxI7V{S(f#+8f2cDe*L>xF6EqA2iApy904mW( zWD$nzk!|8TV|8o#jJGD)OoYkU8I2U2WDFZKfjUIqphRg&{uONgi{V{>^A_#K(4_uU zC>u!bi#CI#M`e-#3obx7$GPNTT}_Y{FcTagyl!`rth{j1v;y^4)ik)lsI^E=&9_VFd>%kA)) zxiMi0ft567X%_soo(4PP2P{4URfk=iL|1n|2E#v|wRTpht8s(eryG2j#qdHfRqQm2 zu#1~N1OQX6X{NB`FfNf3b+Lpp{s`4tjS@<^Jnft>YsX*8QhqaJTv)zC zdd~NtxI^TTUY8@ZBc{w6l>~U>q4M zaKO)l9|Jjqaj_u9Up)`)^C`G1JdrGP!EWUg`!F{h(w>di5OI67?a9AJkS~M|XQ&W6 z$(+h<`Ccei(UKn=7(t=`#gLj`!m=AVAOR{HLytf2?ng~^5T(bK!5o~xu0yT&hNYzJ-8nZ%RfnH@hs-NSIdj{Ii;09qZ=?v^*`Yp~Rv zkL8^^e$b$HDeeKCgi9c+lH3VCa!6H)f`SqUT@Y`z23+GI>J;-I$8w_knBc6F3*xNX zJ={iDd!ZLA=hG|4?Do9iolEEfA{}WdbYWq#`V$?$g)0DSWy1+U7HC{gb{jV24LtvZ z@|+M8@)oahC5g^4@(D&I6){d-@`lMH)r}&+_r{yMk<(1|`+^MLDNklw2h2lGg1k5D z+;o?UCZ+m(bQ6a*#p3O^{Fm1bn5jEO2ddL1a`P=z#~+Mhg{dzx_k63i6cvSxW1Kyf z>@cc`@h3Aat4fO|3{F*;(xjcl=iSG$kLF}ACf~c-lvEC@_lc+0YI6o=#Xf_V&z~A?Ak=~u zN;e}_bh;EL_m=Q(O%YT`V=h$<{+Nnrl!%&17PQsH&l}!Q+>4>$@Ad5zn;2!MwI{-x z^^`HyjDMvwQ5CS4^MM7{9lyYnp>ZCHPYJ7Bs$6UB3`FvP0#V=%npxQ~&^Kgn)sTB4psoTX0uj0xO-XK=tfr9w zgiWJG@~nrpnREnOAewK`LPACOG8n+ajEraS7Z4E&w$+oH87UX@Aqu zO0EkE8u`Y-Vu)FdkNy*dl$Ct_*ebTb@=mydl0Y3o(wc$mDtx?=6-axB`E2on<-H?Y zf!z5uO;(QFHobnNkEwWWet`4d-9iP*S%D*jG`Q$NA`eA@UZ@X#n=GVnbbry2uy-#~ z@>m2OiACNwSa&adQa!U7%07#>1B8l|6Gp4nXw-N;$M~N2`lkfA5f@lQ9XJuXMXI6&TP2W(lTwD7RJC2EXn{*1?<5N>@&qWC9BXt z+`k%9YjBjpbPXp-J*Ivr;n-ea1S;?>lk;VcYh!~0w{BZH*x6ikhhJd9+DV^?HkV<5 z`p4C=p zE2+lYorDQKxl)z`+{&xU(_dT}2SwF#+#;-BLFVR(h0?N1Hd78h?P0+rAHvP`UW-+;oa>a`rMFK;fa3h@Wz-NOG_ivj@5z14B7c0kaPCq*t zeydUjBow8A&WagVab4ai;}wD^{sulQ70|#3{$etWBZV(vq_^R@s!u55OOWp+C(Vx| zue&zT2@~wIa@Yc4!E*T5r2cFV99eTJ-s&7+WI*LmLe;yHf47hEBG0;fi2f~B84*Z5e?b+Ullpm? z+!&k)q3CNp^7M~IGj$lYFHN{qs9QgRf)ZF!Ym!`etS(!>Z~2@ujF$cq8>KksU_9PTaY-^?$s@hF zgaQ9e=Q)LRj#LSG+*mX&{6_!qJT&nFPycz@+q5xgWxLsX@qyWnil#B&^W^$G>LsvL0N zACI`5Qn}JfrrzdJ@=0+;6&_4?G;w>{1$61l@X=^L=Q(&$8Y)xn_4Hq*f*u=N!Y7~p zAOX83O5&5c8^)|_vL1ZwI^`jvf0WvsBk7>^X31?TvZI-l(FIdAaD?&oeM81QY^<3$ znNIK^L52e}unL@5>NLPRx7^x#gXp1-(jkcl&22yf)H9v3*wryO4d#ef?9fl6DHy_e zHb(;Cmwtu6=J}cj)Whl>uYsR6G-;9Yotc+4NGw4aILb#Ns})(C&KPVb$_G)|XXy!- zt6mlxBag98GKExeJVQe4=j5Z?sdaK^Bq1Eua+pa%eL%W%6~zK7T94*zg)|oh!v0hra28=}@1F-TN&z1%+JDeIc0c$y=~?N{X>qp`~*Oefc>MBcrX zN@7?8Y`nmcCjD~fh*rrr3r~pEYxj@G)L_0fh`OIZ7V$qGna3o0&F-t2epIl7XS`~yin3}m#s zSELe{*zHf^Wfat~(w@3$%2{OHi<tuxxxK2^w z6kXKi66Sv2+smDGIJ(ioz#jpIt(U0U6+0D$?eMIvn1K(qi3R?ExzWl?ghOoN(4+{w zl@gCO4wem{8;8!;<5O*fPo+bL`Y@)D9NkCf3&nW9v<`wH!@VN*1ZN0P7~*?UvQz|> zCk-X1#gPzC2J?q)!q3sGCf2?IPtg7kBS750a|?`vNLTr`Fy~ zV6DnGGTdyVqGBL23w8P7e?$?GrA7nXSZ!Yi*1|;LozC(;(Fw=5LFpV+(QsU2gTe+Z z?b9&Bt+Lp0RN(;y7v5w3k0u7NoBmf)7QmXpMlu9<7g4}~7;p9j<2C0gxQvIhU`;Rt zP&D*QMMNsC;)%DPZ7u7G%!#3YSFB(w zC*v%z%!tT%gK)H!Wz(P(D~DG_#n_|Zc6SEYs`P&1GGowRrp^0EmnGc;zJ3V@FvK?( z+#sJ!S$`pAVF3NcV2RJ3hHt<-Ilb<__2(MZ@yu%& zC0{eA{x}?J;yiavfX3r%d4?*uN;Lu0WkT<|AH{B~66RBTp&zZ^50LS-ais)aBAa=z zymOsgd@Bn!LAB$hG4VXmK@Wn&KJLGLb~vtrMBnb1f3p17s}ecRlY){L5&?sp(_>iq zjKgYj^Fh9x2}5ZvUi(TvFk$Jp)0FP3ofhwj&O6KS^=Od(=K0JFZNgiiagc*8iPV#f zsFr7(SnN0`I28=7kzG#xfEpL7Yv!PmQ6}qSbtS&i*}5BRSLuJx+9H$Rh8`(E-NyPX zsmK6#m76J|jX73|;tsu$ zE-%~n+Ymx?Wguz;Tq{!|9fX9%7fK2Av)Ln`JMlakTW#0&? zAYG4R_SS{k0YLIj|83GSb8jL2%HJ>Hk#QR&@J2ArJ6CM9B4t0zf~)aFJW zF~e|;f>p_CdwV|k(qQ+i)?0Tt$%aZ323bB&xh=JCiCZD0V3?1xAcAn3_&9y+(q9ZW zNGyGX@kuhDD^@sLD6*^7mO!=r{2=AxKatIj}2db97Cw%LMW$4t= zUtDpdB7p^39`hQY_oUPXovf40J5bQBIashcM${#CW35B-s9)Yh5XuAWTq5BBL4r%m zK@6uVRXh3J7ALF{xU@>>>Zcaw2A@%G^Ip0+_?S~z;h*6|O0F^q%EJ)ahL}FWlHfxp zPkOoPX>2Oj^Vco=YY~+Ub{UJQxN(}qH!-%bIgh2S?EnRAefc0p2c={aZfSMs^Pcnl z=$`)Go0M?JMj^Q|te*Wp3s}O6XNlw0CUzz45sa@`O4sL_Z+v}u*IMc;&a=xZh(!V! z0CVfDaqizU$sk~;|KBW`R19s!A`-OPBhp)x5uo_Ns4}M8py0LTx%tgPU0~wIOF6_1 ze?9Upiq&YKAHt<2n*Z-hyi44ikE`;Bj`}$HVQRZmx3i(?gg$?`C>Q6)Hx%i; zl>5{t{eW*wc?o1~QmY9|0$tfl^`1jb9%+CBnVh0qWEPzzUUL#9^Y{yg8#&3s`>drf zZJPB?xu#)Nt3zb*)6re6yjm)6KdZ3LwaMk0*XHnHNldz0ExR(OT|^s>b+n%ymo`rP zs;NUi?D2&n{JA!Y?_$TUu#pYRoe_hP8snip1o$r5`%VwfnJWY(cWdK9_G(Q6$PF;x zUVh_Kyzd&rIM!eb^Xn*DXeYtB=+=H|Os_r-D#>+&vxEU!cjbOnapZ(lvp(1UGu;c8 ze5w??^f`4J;J;}SZ4AC=i6hPya^Vvr?rdkg7{uVkrWf zz=Gc)_fNo|pJ#;XZn$3K5=bN7Z~(MQpQV|IwDnNCG;*=m04muF|K0Ru`yfVsYhCBm zL$CBC#%tBLu5hPOWJ#?IEX@<>Om(~gl(t|`NKTOB9}RTw{%9qB|HylcA;&HI4J~qD zyLK0oP;MT@MGv8rPyteQ(~-xD{G$FR-j#KXC&AH?6!>3}7xdPN0DI6nS?Wu6X0cfr z5H*Rbw8hd}Mpd;DL;?(ns28@#@cZZEi>#2lrQ&}^lmxRjgy5&DVr;l+#LFgY|ayy|4R6?rGHHkZxj;XQuZVnQ<0_0|o@kgDQFjd1{?(6 zImVj!lejd8)**b4?r~P{CqT?;#YX2o6fd1?{5Bg5n3gBZdsw1 z`JR1?HxWB3pf4UslY0*&H7aT5+Jx^p~?H|yp>3rw4 ziTdYw{wRK&u6rw^8j&6a74gK}zKm<{%CUI1%STvrttM^i&*L_vX6S`>Nls-C>sW-L zkgR2P@L^mR0CU6Ho*FNs3v5hl+R1!I0nn3U^OpZx4wLG~R63q^;oLjt zMch-g;EU70OAa!tL#|MVa~}C)De3ucN$28zrJEikx_eBWD=}iS>;tsYmy5z2JD9gF zL{1I-Ua(qCtUy#=h=oIj=>Qn()~zBMB-Eimj;=QXQL-PE`F2F@7y-HKU zVGTmKy_Kwd=;91t>10WaU|)O!RN$jg{{k5-u#7km*J=rqL%~UZVs!vADz;k2WUf1h z-sNf`A96N}b*$&`GaK|E32enJyc+R3S9W?$#Xol9VO!e%gmbM&f;_ykeBz$UA!ydT zq-c3pBf1uPXlEzI=-Es~{yjTAQ+ zW@Xxd$-tiNsmcp5h3^Hs zAnc>6YMExyb&h-flah5I(z#!Lt~(xpoX<1v(P06C0oVGoWb21OkJ*?kY%fMQ)?`E8 zuCxuBnpdw2NKnDo_&lvL)i753?}cE8-m zsYUE#$sFVugOyM`hW=Q%Gg(ICR~ulOQkICBc^;6#j=z7tOvHT`ZZ^Qt8S!V5lTw(D z110|0vy2f~^o5YR!X0vjr18ke4ppMF;gQz9{RS|4=(gt+EBKU%4IZMSDpxM!4Z4`M zsXhX7B_ku+h%2lOh+QdErt(#xk)rH-NgRFcf}{KS`ch@%pFmfHnba zeJkp)cbw;|u>k8#F_&%97d%&V;nyC1uEj_sS}G%$t&Q8eRj!wIS44lM=DIGTDBJQi zS-HCc1P!<{+Z%jz^&H8YoJ5{eLs13%nI^DCJK8J35*`(?qXbvvll$y&p_3K!22w|n zy_(IQq%*NaJKLabsN~JL9b`xX_N!=ZIV;k7<9!+wS1kVj=w0ByuPVLBF4}T+DplNc z@c@8r)>BcRxjy>nkuP+&M+8xkrHA@Li~wq=C;I2LyXgF6OxYpqe^)qyTB}tq)mo>jp51bx}R*u6KiKhKA<2=2C+K_-aRKFZ^R)EP&r0PdZ z(HvB2>yDL6%{biZKS5UIuK26l!&9j`UsHQI+%K$or;b}i)88_o8CB&ZPSBG)B^hpBZ?un*c+7ko4} z>d&S;DHnefh{mRCrz4p`nYS&nNIQxKdY--q$M6OyQdE>1&5p?l!NXexeR5T=68t!e z%_MGjk_;COisEq%A62myn||Ze`ni0_JkOUS%C`=Nypb5c(M=3$F;|by{7>Qz`Mjj| zXD~4)Nh}dE*dP-uj4D z`gn|K1)31*}GjWg8x2t$Svh1Haj=_M{V!@)sko z;ip69V;%_0uo{QWw690BQKz(U@^+ zQOPO)AJ!c63v2K?;oK*OD?Y}XD^^qdc3+=+H7d4ONX9c^d;un&{T$GJeOsFGGzYDB zQfE^TDk3M&Up0_(jYNAtqsiW(BbZ|bHgmhq2tnpS_ z+}LggatC@TF5TJpku@m$Oi>mRXy8^59V8^yyB3EtARDK+qgqI9^gAN!ro(&uRHAnJ zSVKv+pWV)lt%k#10Ex{hg>m@;3eRC=t1+Min>-4AL$Z?hGFDQYU6KW~DTw7(oK}h%ODD0Ab^ds-9k3D+q%TeDZ zoewN9@R_#SkgS$Ib!V<5wGY#Cx*9oi-vj`!y_?Lb#!<%84 zk~^ClC-HtQud}B48)CF8CWO!aAUFw_KxGJ79hK|)N?V%9GUAsPC*uo0a5C2%7maN# zYZKZ_x8cBn{E4Jy#O-*4HgL!QM!-~xbY&J&@_UpPeZ}7S(S$kSsr9WLVZ8!wyT!ot zm=6r~rqgUz2_$z`0pYvQhy`Tw{jy}WNW<=phXNALBvRw|EUY8pXa zc2GC|BR`dGeS279=lGbpY9*!YST$96lMhWr^Rein&381pU>vsY@m&KsMv|bfX-|nf z4IE5{{-*n8*LuzySJlt%M&2ZrPXE?KZTA6;v|eDGV#5@vRgGH|d|L2vzq!$$G|evd zAANLC!W}%`UQsgxq9PpLY~7H3UZm;k^eaEv`#LF1=MdFspW}#luaauS?CS#KbR=wI z$lgO#s=<`Yn~X|dtEQ!uTU8>eh!At!05#FQ~Q2x%?}1d3j# zmw(V5P^8TQF_@g|u?>(W3Q-Z2fRVFmmZ2i#` zCLGH&lEMzbs-M`tLPwt(`UIDolmIsYkY|=KD2GRn=kU@g`%!>@3QhVv>QEfz^Yu?0 z6<&iS7+Yw_aQXo{Na;t*&@M}Uu>Tu?TkTBy*F8lvPLs=r2@CfZ`rdD%nMMsrjkti{ z)XBd!q7$t;ig!$WDZj;2q5zTOCO?_aJa;Ap*I+04yq7lO%okJnGBN-m2#|$4&iOZW z2?(l?;&c~5utXT~z1CPavc+0Z8%(!FdMNa~v8+b| zhfUnKcIj3v8`z=}Gl3Wh%}ZP>)$J@(O19?pJ0r&IZUM3#RRz}BW?w&^nX*nI2Z7f) z)Tn6}b(v_Hc01}qm+H#mGMp7waABErTzz zJ_o(fyaJWscX}O1_Qxw)PN`bdY>aH*)%R1OonluEw3$nRlJ=n3;h)>z*IL@IVc-Bz zY4clL04q$H(}~%Kz}mF}X_=d4gRf3xMa_)soj%Tke-*#cvKE7POR5?&jk%*x;+f}^ z?~_%0ASAwiB*~Le(=uK6nc@$9=ZzOfi_(h@rcmv?z04@z+zk>C&EB!Ap`x^X)BsuB zNsa+SjREOzmj%yRQJ($;?Sx2UApQE0H*M^BkCcBblNe-#26PpbZOKaFJ zo8dNPRr|ObE;pF8$Go@nEgze`{m-Mo{OjM81~7^XnZq3*?Q@xt(`($Myr7MmCiJT^ zFYaZYg8_8WFN|m&Lq#OfLL%Ov{NSd-9i#?MX~Rdj7_MH<19B|)b&yf~MDGQEU#(&0 zaW_SVHxGUMAynQG(&onHlXtZusJ(P>wa*1;HF2Ekoz!M9ITkIaV9%e-S+;dsfWrB8 z6kOXLMubFNuLs<|^Pc&}0XpMd4-Yu7>vS&s>UTq9O)~A8LEvq?SW0BVD+o+k(=}=w zJpf=%6?#;ToVS-r56;&nWFZMeCW3K(+YU$Y`H})RV})_+5+xyx_beoqg-CNw+buJ( zoxE3OM`5`Ho06Qv8Dkc(Pm-4xC8b}obroBF0uTm;#YAI5G{`x}1#!J;$!K)SSr5@o z8BU>yJ?d4y;hKJAvuG7rHfcfRCrZZp{aht98CO%RFOAEkd>V_}{UWwH65v`cnU>y! z#+IzNq~{8a#aF?HENp+R5-wI9x%>sGxsCl@7qPu7p%U|bTfI+1x`wm|d{ChLF+YvZ zNlXL^)iU}{bgRLsk4tpgZIEAf4?$X-zBK5MgM_}K+R`Kl^eHpRucICSu5Xw z>Ae=X4@h9qWl!59-VHVxZ0CD|@+s;n+XU!(p1v?V9Uk5V0*1Owz`hg30|rmmm z4*G$Q(17%b%^9MH5QfAMC!!UZ@5GVF=c1thV`9oq<2*iO^s}x#nn#r)Wv&L=u^7c1 znROXgVBMPM+wjz5>*W_21Tp7s1L47eVA%JKx@XfSAWv|nx)=gdNi&L>d%MY{Vb#xZ0B|)%j zOY8$FzEyCU>=7Khgz8y2d};)X+0tr@XQAAfv8DUlYieEuBwjsWo;wZfWiKqq<5t*` zH~Q=Jz>z3i0 z_+xL1>z(Pbso`n_&DeB2(K{Pny5sPsyQ8l3=sf4C+u}sWK)0cTQII=;5yq}_RW`*V zFj}Q;YY;Rg>=QNmjfP5jZSB@XfZ>D5_6W4u`mMSWbJ%8CmYa{v{B6*D=DVTKFFJnK zA@nVEim>f~V_}2k?T=Ts$g%6#@a-{_$`4q7-8%iNYKSQ`O9#427(O+`QHH*sCD3~^ zUy;L~6s`a=#MK-AC)j6_j*6lFaE!!G$?H5Ajxr$^Peoy=Q3&x?;;6W9HMfO>N0s=+ z5E!o}RdJkL)wCkX#Q*8@tmG|^Gr?y|D!9ZTOh_(~91{Y1Nnc{cG;TCNlUPH{6suodkzFNrbD#guM!dWqExmhCHOYLQ zg+iO3_l!q|{B_l4c(5j75{!A5Tv3g#J zhAs3I<$cQ9)!QTQSc}K8W2!fsl_7Li5$xw({uS{j!;TR4Cds0yPWFG3f9o{uHX_ZO z{A_P|8B^^jpY?&Gd%1cet<7hozj}ABak_pOpa*u{PiesqC;jYkpYQnRh=2HNhRV{u zmD&8Vq7qT})5i7UEfwM~55pk&c&|Qb?2W-36u7BfEKj?H5!@%=M+i@3%{q3v)8am2 zCKF!JL&|V{=u?=i$4o>o`}B%}#{Y@skFbny)8cRP21lS3P=eAm3znL?d0b$w9mDJM zGFRyBzmAQ;@$EcwG*5+fzl>$!H}Bp#4gvs!fo!?2BVBFZQD30fD^{+s@KVxq8P_qn$S}K*9pK3g(H${?Azsbq>+o^@v*UK1bv_%tj#v868k;HEyC0i~sZ|zy@;-+$Fa$!2G=GtB zmrCdJ|Dc(sbbMD^ZdGg9xBhJB$f~`CCeMU$i~!nrmpFTg+>m~O7fIe2PiD;`io)h2 z8Ck4ia#O8oM14B6o~v1Id3sG99&F^bN(XO z|CDZk^IVyx6rlKjAw&#(993>+Vff%(@~(r-+Y?xCLJF_wrNe3bGz2Z}rgSc=ylwO% zLwn*LLMm9FurkHkr|@#wPLrvSOmfhtugqq1XorBL9bS2xpzUQ4N5V1_cFKkeb<9d6 zICy73>FO1L*Zs`bl`Ykc)o=I>Sv^y^8#i1-zLpq!Q}n*i8z&=98m#VPobW*JL0m*a zch{dlbalNk#-UYt3eOCs;z0MNN3EuP)t8@oYUW#!-e4SadZ|YjPNhB0CnQNDJn8!@ z@RXz1{)O7T=cpRHSxBZ3{#nHyn_(lDX$;hQt}aNVz7p&vKqWq z)oJt~Sue4qfmv5Dc@|>-YCmBG=M)e1qO}oFsGuZZzw9@Ytt;UQG6Tyt2We8Vh7`SlBeyxyH%W zn0YaqS}Fd9Cj3l0k{`Ra-*%`MOs+ko)_zuFoc-jr*9~qu_JuumU@*ZoOT@_$)ent8 zxe9oMM^{Z%B)i_?-C;7~d=^&P!Vw`yf1gqH>)Q=$RA>#ToSLp{Te7YXBc2i+= zR;s>wZnnW*nnsHTI+hpl8kudTUy(o2%)umX;JcwnUq@2i*(@*m*Cses48-_k<2 zI7MlM%xK4-`mk-42aeX*w);edE!EZO&gV;mSK<7_z=;ir`D zs%ChvuvMGy0Kn9miz}NIl^dfFN4F0%LCCqp8qAr`*CjNTph|+MPeEKHFJK*&_aVH* z_Oo&Q6vc@{R_Y@`j zkS)&DH{)dYehQ0Sf7}YkgVjm&=+>Zzv;Q!LO=get@8Et-zT*n!RLz2WSsaBX8$*)UGXeB1`&a}*hwKN{J5wBZJY1oqf!3gtrUP-Orl1xaY9JZT!uG?kwl}B6pt}U^uva}G z35qYx@b=)KF|!h6F3sylmXP^5EoD#_T4uTdS}b2PnY4QHx`+stpzQteY+FF^Fr$7n z&Ap6H5a`G;829Cr1H>c_qVv!XRh0dPJMQAZx~8cGR?VBxHmUaxzibQzv_K?kho7 z5TF$#2Tit}vd5oZf-|T>wy$}Kodo18u9m0#@U~E%IB}4BPp7dhJo-qR@{=Y@^ocIa zfY?@GRJ;BmxHYYy;`gf6(^GFjX?EQkj}Wxs2vzxm4e5R-qoWuFoCiFX#~9&V)v$k#xs{GRiY34$q6!K~j~c^hl2oQ(V-wB; z!XuzNyav0hjeV7vo+t{aWeJcKmzRVnZs&7(%VH0H^bFWs$PhfaPk7RNd|u4aFOK_R z(UC5x*A^P?z?Jn-zPMWo)iVC)=0_%qX|u2VW=$ixVmq_I7!FW<-}jhw`SG{~=9b`B zJBjNKX`V8Sbh0K5$}%uGOmLdojn+KfiJ^LN-kA$F5UcDvD`v|GSU{9<4jiM*sY6v; zzOxrypxjbfh0on*Mp;~mR%bsP^)~mwGZSMu_u6FX4~2HGd+YFttnt05IZ;5A|HM_I zh!0s3qkTL1@+$*gNM$C)n|}<|rPW(N*;u|uS=9DeHM_Im&{d1xtZmha%zt-5j@$=! zZ2~z5!{lAL>t8Uq z+@FjkiObqBI2tGc#>XnIf4^p|!cFHX&P@Gp_&GYllNqeN|9n9C>$OTHSTl&2dNG=+ z!YV}Tx0LX>7ANGn&?aRV%+n2Df^Q*GY_e16g7H0jyRXPxuU{+HOy3r~|`=%&7a*0)!#U*%)%@-;z zKH(|=R||!^m3?d&UH~FlnYxofdGj>C8h3%;Puv}n=ot9`Te4q02xQ&`FEa`oq z2>N~B7~AW)7QT}*uD9?pZC4MR&xr~lg~QKqcTdWYc&OA5-JQ#cVz+5o>F-Mqe;H~E zh*0J9^_|b^97UXzrrh<>j(4@|cuR&s2Y}@bT!9}o>E@`)E597x^Bf>g+Kd5RjNXJ}@i>zvYiDC^68zwhKv!aw|y0?7N6!5BZDnIzAMt zJE~r=*8lqFpsTpn%l`|1>8`bWy552KgH2;yddj=LmLRPq#dUax+Z=0>$w59SP1lF_ zG>^0GY!I|&J8*vU#%49Ust(5CoO3f)T_=pn$aCouBSb8tgGi$uLHh2Ye)N>?dIRAJ z{0YVjUNfcu-lOBZ${(Z95%%W__J$K>`0Sx>40@$(-4Sq+W-QTLdW+zo)>na^?CVe< zd3)UQR1{|EmM&63tP9dH0>0r#{I}Q$^{1N*R2G|iS^X-*iDdmPji~b6a(yg<@~W~z zinDJ=^5wpcdevSN$w{<7)p&L2O4aFFdfywAy!enYka+LZM)mtyzAr#D?^Y~7U2`K8 zFr8RN84X+Y>Fps&K1hHQh-953b!cssubC*5sbYf^e3#?f{^z|##L#HI}hPnDtX4N-iw#L6exaSMUs_)T&JMIp_b)^drMthTO6p=)DwF_G?ffbW?Se z9L0L|nPB*J&kGWNuvS#18W*q)7(rf*JdGILA6@*-&> z%Vg&e%OjGTX9zC2Y4(2x+#{IZ^3f?+f>cT21Cvt}Dd!0e2ry?gr5hcu!*QH$q<)Kv zM)rHzA0*n>pJ9h*!}%qjtt9>57mla|!on3VOE3h7#FjmN%o~~bL0LQ#%rv}m!YdqOGrIgP%&O!ahB0{&FPll*a)FQf5B*soq zZ7XQv-@o%2Hb!QAQ)@%d;lk|_oMm`)GOu_epu?A#b8Wbaj z&x^ve=1|5O!}z|tX3@-?p_Gikws%dqUo`R#uVv(sGS&lFHYZ@cP|57MpjsjQd}pX-eI z|1Sd`jGXBSnQuuRr++0SU#g%p-ZM1uRUkAP`UMNhEhwL_1P@|94BqwBSP=R$0DhN8 zh)KY5b2?JY2g84QhiKHNNe0zJB}#^skv?N2u3$Vcte~vMmF){0jbcL!KXf3UsFNE) zWR<5a_w_hqkZ5vN)@DJ@IP;+lz$FH#gfaGJfZp`MaUbvb`R9u>$6QS!{DSX$k^wR{ zC64p{ZsE8@j^X1ovF*WtI7}hXz7^ouOq%*4gAL1v4^mWNGLubF#*tvy_0gXGnk?m> zNUibw*P#)w#85cjdn>}Y<8&!V>;$LiU!#++N~{}n+{&MhrpmF((nKnof$lIrtQ|Ww z^?^R@%A^};q*W?OWN9K+w?Yn2nK@1w^D2teaZlQPa4f@4h{8eWs~X~__4F&`RWX^9 zGFlcP0bIToxrNo+Vm_w|g&}V^8mM$UV!M@pOs^lJ$ZN@ko-`U)Z>C>M;I%NqI;CVk zlUj)mU}TWT?8Xi!cM#7HHT;?@=S$~in7q^a1|pTz3}Z1^=X2Gjp)FmKCU&F%EMNmg zcjB3orHNz+Sn*(ydkqUG{4Gh$;y5YLa<@n#Q#GBHLbZ1M51s$QV5(_Mzk=NKyUJ9R z`d6QejNl_`0x1zKfAv>dG3E&SCuMf?(FFI21YRVNZkE^~{h*;hTPa}T9b)m(V-vb}{D&UpiWu#Y0X| z578>Q()z`|bK6qMRBKlr%-2ip45m(S3Dcqw8UQp?ihLn39k1I_kj-l7yrv72Iz=gk zhS6&{p`+tO`+OfFdy!ELs4W+7UmR58#`CLjSq9VIKd@`GEEcYBY4bzrO34fuI=Tf{ z#?|}3F~g4@dVK+$WTA4<_`YKb|8>uY_ z$Nl9q+(01|w3U~8eaJmYKn4z(5JKI}ab2s5fTMey*mqfW|nzQaj{_+Rs1D=2in9+ts1>88a?Zbf)8X7JAIju!b~GI7KU^&> z(T8TTw;sAGTDL$d@p>cPr(7nuEJnOQ-J{fe3ASt8Q!Mt1S6;8T_hH~#sA9Sl#h_Tl zD+UpjoH1=I*v@03*~P|K@rbvY-qv?{G@?el>`yg9jGYpkcmVfVECwLtK(5v<_RBEi z3#|}zk$?md2`^y2cAtFdS_ve-Djh#1~%&(-AC`P z(|O}&LlDr0Q?35KR&E6D;RYT~**7d|n~hw(Fh_JpFW=MN-KnGC0`s0dg`K2#%a5O; z*(zyeamV2$CvCUINrtWfOgW#^5Ccd4qrQNafT#Zw-JFX+fM$QzrXZ5_P((9AIIdq> zAcbF0Xd(q;?osWR1LQ1V^(=gsiUG|zOihnO9B0QeZ@vD3fCn*S2&o-(ULS+G$8^5T zY=kNO+fG8P4X2agJIN{0z`=}k%SB*oKU5>j-Lflrhb>^{u&HhY9wa(U5`-Edjj=ru zUGHVgHvpxG*TT#T5fAp&4D~A5(;=;2rj^SY?(1+TGox09aLq&tx!NH7A|PUBQsg86 z-?o{$68%r~jE|Nozs8a$p~M1dV<#el=NLN{*wYqEHbZ-=Nea|M;n~$4Ma6u;6?iJI$4Dmk$gVN?n z$J|~cV|;~K*wArSfQT7jbNZTc1y5JW=S4p-3&{c*XXQMwp6rl?Swi3TlMYggfEz7{ zJ%6kt@&@G-EKAd8ws}LJv&>^+20uqEV~FB%&8xcM3$We=K6V-kx{P@UT`?N4ZzLOs zh@+!{pBW}<{yb4$R9?->U^?Ag;s2H-0OAqy<^{QB$SA^5za2I0jTX3~SF-@u^e*js z)S7Lvv}@1trZbrfcSs_%*&7P7N(-ftUwki#^DmX%l?r{!L62d5?&S{#Xy1J~!tA<> z7OvK(Qjc!z&EWDwPsbu%H1mW|sF9fq$mu`1#E%fr!nRllJ$S#s2KZy{GUjt>rD||? z23AYwym5_Pv<0M-?d9ZqFY(YEREv|&>ywm?_mcCxUTlzf{><)_oJ@bb>ZmzMe#HNq zPP;=7za9A%oMp^?bC+BfHTsdt8$(HRAg0ft7m$UaQ{wB26g1Ia)wxXNIJWF|4cCI9 z6wCD+ke87muIVugb2!g9*&j!CxAN*3Pp6?>+q`igan?sf8HV|V{~I3{1YvN|ntFW7 zMAn{>;(y$*oitG9ChgrpR^ri#_6JqMFhOOM!pG%s2qU@8y>|WWFx}{jP^@*Uzx00J~YhUmpAQFVJK5%%L3#21votrlq&h zTH}S8q^sJffGY^B5gZmk)h0&Q=D_~iP%R5uJO1o4tSYH7G#gNi7sZ4IO(DBU_yN0^FWQTd878XD0+s8 z`ratf6!$1$PL0UYyq)bEG0xQ6Wy*c?*9g0!V90=J^qw&!TWGURRLMn%4YO?QVVr1t z?Hl40vqgQx0wZxz@ZaU|cAYiRH?&aU`bs4rc%AJE$c3W!7W{ZUYGK;t2UW-qLt!h3 zeb1Jd^#b=9a}%*;=!VioVMc38$6~^sw?cbHZ;)d=6P&A_suYfNvCBtKOXA_n7 z-^ihcQ2i<>>b#Eg0o7HMWC1apR*+sNk2Nq&jwbP4ILDt z;aG&%)fRk*wvRRNP!z#%SD&G{`QORQj_r?AKIw1Va&>u&@9vVO501%$0Zo%&I?0jW zSD+GROnLvS*!84`bw8ND;alF}IytsGjix ze%lsoVLZZDkU@=kYlK8r9U9!%YZ`XRMOtV!cOotk>ROL!#r$v9jKh8=!qPrOm5t~d?2+(BS=Od}Td4dG#A4B%gx03SRmsZfVDtjtsWgM} zi=2aK0t#)}NGL`M?US^iYMKw_&>+@CiBzzFZ?`dh>e+hHPC}q*35xySZDHb^LeIV`{XrAr7KG%)fE=_|z zs3>1i|AhcUQ5}yovwgP)Y&{pWN4NC@SXb=O**+OCRx(o*zY?GObx$K_5kDFibalUY`^N zNyz6LBQn%mJ@%3uTjcdL@N*nGV^lW;M!y&Y>nV&3V_&WDWmE{(d{SU_#3J6a-uU7~ zz)(pq&0Nyf`B;{mOwJA)C#`rIo+)_DuC`;50*>#nY7tr5kMni+) zLAoN0-1lA7FNdr*w9}F=6cL3OQ%WehZsR>Rs3r zL<|JsOrT18t)250Z44hP^gbtX<6R-XA=!U+`S#ya@Bf&-wtY_3LT7dXoMaO`WMLv) zD*2irK_pD~q5YNd{)f!n=!UC_iv)xTvv3`SK4L~92?4$)$R@4?AC9ix18*#w)AVp* zL>3v|W9V#&g6{&>&Y@}Oed%NDNeAJ)6w0zQHJzqOS8|a~1!oiYZRZ%>-8qNGbtw^( zOii3Od)>;tXh+V*eVA5~UmBPPs9~n5F(^FVF(vr&Q5_?AMoE6Wa>Lm0Y0(sPk9lJ3 zdNs9QcNNdrt*qijq@eQ4>f%s11@@?;YZrU|76=f}Ia5N}w`~swA}+OfJV&5O$QsG) z0*Mnkv(uMMpPUnQ;XzM44PVJI+79eLnCw=GLSU5E0Vt2^B?Qe7f{MVIC1e3od{lsv z$YWju3{a?;mzoKip6H_zDe@Qip>xq$P6&(7hBB3>Tq|R9zp=P2VQ1r8buBSg0lM2t zP@S5J9^>0heI63Y!o93p;d)cjydksGZsqGV+T{px*9{FLwKDT-+fy8!h`hwW>0)9w zw+~pSMLHnQw~M{Rs^@%ps|SZ$_#~UF&Nck#7R-$k7sjq8;?|U2eOm4i8gU8ZnXVg4; zb_or~vuU<#m9U?i+#^B{xN(~iPF1P(_a;gSXi(8dD_TDo_#5sZ^bT<&jFf+bO6DUn ze+pqvb+279=VzVIPMCJP$f?@a;g@LZD-XW44ERt(9rL(MGy3!fx|DQP$whRq-^s&b zl&qAL0;5k-$21}+-q077AaE)jJQFpnrQJy>m5HE@d!;t|$`Kpg_N99bx590U?0g<` z5z{-g-yRT&4{%KkdG@>na=7}eeE960PnC%%B^$3Bw)Xw; z$QO&k^DP*A`!=17Oa}-xP;3cnXyne`AUA0B-E_P__s?+5D<@+F`~pxQ5cCRFtyK>X z9dg%zzfocjp1XX$&=>ZJ{=tJMO(ziQKO@x-j~+x~y;Ey2SY%XRf8>T_CY;0_&3xB4HMjyl9>tV=w~F1fG;=YK%H!q5k8H&z;j|HjfS#fBxYOouo-fIVT)p7X}W^Iv2Z{#`O3>uJCf~b?zx1L zLq>VK>?U~#{9S8(C*+U;F$>Q0*cf@UAOJ52to|ybTj0Ab`{%OCv^+{$p~5%@Zrf>P z9z0VE_=fM2K}6PS>^NX6loxjFL@9fVYew`bm#+GIh=EE10Ld^*=1I-xO<&Ng?Y2Y< zo`y#eX&O1c!roqp_$cSf!1{4XWnPNu&i^T@QG3&Ti>{bG0yfysGZfTe^>LL=Y1sCY zD|xMgKFN387irPu0QttZI}6l^B?!?u5wt`_zs!S`xu#!Hc&r4W)@qy&B^YC8(#vq? z*B1!7m#M*`1rmTJL@Z&Vs=GX;z}_pnv#0>-#7^+{J1(SZ9!Tg1EYG;9J;%W)JUc78 zEr!iRe9wNO%8!B#XVy{#ARP!lm(QWO^8sj5-GT`8O8;}MS;h0>rz%3gXw0(br0MgJGBkl;**j;-;LkU zt6Nz!hob;gb>zZX-3Sa%8{-Iu46X{~;Cxz}O>*L%|KZL8i zz>jTL`Z=LXU(zRXSy`bl6@8%C9kUl^mkjHW$9QY;vzzfh=k!a?;!+YIO4s&R0oNJ> zbADBi*ktG)OxnDMtYw1C@`)km6R+kNHxavm*rnj8QdjfNV#f9HkT)Z@7F;ywkrwW% zN<^K5n?)C^gn{igBc72Grh#r26~`1rDrK7UXfNR+y!b=mG0iqWtBtjoSD7Dh-59Vw z+vCR$C+=lrHz{=(JTY9mDIK;yKen-8D=FXQ54t9vZD=Rj$)r?o`67AohrLR2R>ui% zG|*Fla^A1DtYwQ!YS$KeCPl%ZmGXVJ;`87zmHhXB0!Nf!!Z4*%FanvflAx&5nCORx z$UYHAa~#6Vx7^z72{Q#bZ6ti^4QU;IJp0-&riL~v&L|_RUj{b^_(-UnZfSa>c_Yp3BM^U@p--Q05B;q0I>@hWpS0wN?7le;m>LnY}HOWyIrDJd(1dz7yFrZxBKfwQ+2(UT{0Dc6{OVr$Z?P~63;!pct|m}L z@%|;@YpY2V-LX|QRZxGF^V!Qwlr^wF=}3*^fXsD>EA5~=lVLEMla?nqToBdAKVqKJ z4+9o8_%7~Yw;slL82F2t%>K^JBgiJ=mx87RtV|6MBL~y#rnh_lrEH{?vf-0*vP}_5 za&w-^hq*2ZAU*j40%jWjX1#^0qs^l30}^ju{7&ld6eoU8Y|y*-1X%9q8XM)B7t7X( zxY)R=3)B+Y!0!zhMHfZaf;K9AU33NAOK}w_V~2CaOeD|MUg^v3%QTnCfofJWuzNo@ zLm+zEu2H@m$RidKGlq)WDv->|d%pn(gvv>HjeTrK|F?Z!G^#k_^yG~b&#fNC8Kd`7 zn-5R0wKJ@8QumgYQMTdxh|aR`3(%4EYE%4@b4|M0bJI&(7jZ89QM zowJ07SfAxY;3cRXUlcub zLP6DIY%#xDEiMs|PaOOEGK}&C@H%b&>udM=()JU@{W0i~Ezvt4=fBAEIdG%fNrL2# zg+4Q-aLk<0Wy@UU_x-rWlI9-M>Ux5A(DeS1-qgn6(!O#|t zTYafoTw%VMXQUUUiEiL7Si0=&yXa9kc6d9^jSjad3`%-Yf8zg@?Q} z>dsjM@BaLG<%k!HD>u_p(by+2~pnsdP%xbc!BARz6dIcTYx`kEpco_r7&6T$1 z{kyv^*JcPD5AmA`T@>d&Cbsq~@-{6`00GyTchvb_6kk?I;<()2R6Pm{x{w-RmIb>+ zXy^?6w{UF|n3nrQSN_Ije@~e0htJTM>cs?7l$s z&FW5U;WQf(W9A_vgax`qAk=eH9uU}T+Y<3WpC1ZgCq70ep<3M7Vbtbi?jW`=4nklI z$vHMhA{bT|V=pv-;>-xyynSLiMsiGOl`f;+N}2kH3P)};lIz_isVwHenI zh|H;@#b0!g0r9Q2i;XzBh6V>*cW0?#dbjy>Y$&>*F@+5$^26vN0{r?cQ*z<3`z!uEd9| z5oOS9aI8IMJkiq-nA0A6B68Hx1z~egUYPhYT#VXk3^pL3;vd_2_#=3g5D~3@!geGp zVp4-_SYmd?zY{It1=BWK1Z*M9o@-x;Xtf>Y!YSOS;k{7o>*+>$3V?-XKa=DNx#QS~ zz1LcfeP7ZD@zYP4NGQtM=-U@ZA7X+O+|)V#v`@qrjpHS6(05y8c2>ns6!NM7MlC2@ zh{}psQhZNd6!Mj{R%NDFqLg`Y?ho`(+0pCCp?lhdhJ_2=6&q!G7xNZZLb^Z{1d z$S4F~B8-49n}iz+t6Buj1To3+oB2Ml9HK)xr`7aqV!vv3YJGE~zj0A;?*J8_Gr$wa zd&|${Iw&AuVCE&vHT&&V+R%VtjRM%~&*XVb=G=VvVuDP{hUaLu;42<;f0ZhsU7vhn zz5oZ|SPiH-`$4BRX_AHP;MEw~lytqy#)K4U4+Fh*Q!FKfs-|r;+W$%tM}n*`M<66t zv&NM%u@v3TNb#aAelSu6N}vD$00000 c0000000000000000000000000000000Kr;4x&QzG diff --git a/boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst b/boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst deleted file mode 100644 index fa896f98398..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/doc/index.rst +++ /dev/null @@ -1,134 +0,0 @@ -.. _nrf54l15pdk_nrf54l15: - -nRF54L15 PDK -############ - -Overview -******** - -The nRF54L15 Preview Development Kit hardware provides -support for the Nordic Semiconductor nRF54L15 Arm Cortex-M33 CPU and -the following devices: - -* :abbr:`SAADC (Successive Approximation Analog to Digital Converter)` -* CLOCK -* RRAM -* :abbr:`GPIO (General Purpose Input Output)` -* :abbr:`TWIM (I2C-compatible two-wire interface master with EasyDMA)` -* :abbr:`MPU (Memory Protection Unit)` -* :abbr:`NVIC (Nested Vectored Interrupt Controller)` -* :abbr:`PWM (Pulse Width Modulation)` -* :abbr:`GRTC (Global real-time counter)` -* Segger RTT (RTT Console) -* :abbr:`SPI (Serial Peripheral Interface)` -* :abbr:`UARTE (Universal asynchronous receiver-transmitter)` -* :abbr:`WDT (Watchdog Timer)` - -.. figure:: img/nrf54l15pdk_nrf54l15.webp - :align: center - :alt: nRF54L15 PDK - - nRF54L15 PDK (Credit: Nordic Semiconductor) - -Hardware -******** - -nRF54L15 PDK has two crystal oscillators: - -* High-frequency 32 MHz crystal oscillator (HFXO) -* Low-frequency 32.768 kHz crystal oscillator (LFXO) - -The crystal oscillators can be configured to use either -internal or external capacitors. - -Supported Features -================== - -The nrf54l15pdk_nrf54l15 board configuration supports the following -hardware features: - -+-----------+------------+----------------------+ -| Interface | Controller | Driver/Component | -+===========+============+======================+ -| SAADC | on-chip | adc | -+-----------+------------+----------------------+ -| CLOCK | on-chip | clock_control | -+-----------+------------+----------------------+ -| RRAM | on-chip | flash | -+-----------+------------+----------------------+ -| GPIO | on-chip | gpio | -+-----------+------------+----------------------+ -| TWIM | on-chip | i2c | -+-----------+------------+----------------------+ -| MPU | on-chip | arch/arm | -+-----------+------------+----------------------+ -| NVIC | on-chip | arch/arm | -+-----------+------------+----------------------+ -| PWM | on-chip | pwm | -+-----------+------------+----------------------+ -| GRTC | on-chip | counter | -+-----------+------------+----------------------+ -| RTT | Segger | console | -+-----------+------------+----------------------+ -| SPI(M/S) | on-chip | spi | -+-----------+------------+----------------------+ -| SPU | on-chip | system protection | -+-----------+------------+----------------------+ -| UARTE | on-chip | serial | -+-----------+------------+----------------------+ -| WDT | on-chip | watchdog | -+-----------+------------+----------------------+ - -Other hardware features have not been enabled yet for this board. - -Programming and Debugging -************************* - -Applications for the ``nrf54l15pdk_nrf54l15_cpuapp`` board 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 -======== - -As an example, this section shows how to build and flash the :ref:`hello_world` -application. - -.. warning:: - - When programming the device, you might get an error similar to the following message:: - - ERROR: The operation attempted is unavailable due to readback protection in - ERROR: your device. Please use --recover to unlock the device. - - This error occurs when readback protection is enabled. - To disable the readback protection, you must *recover* your device. - - Enter the following command to recover the core:: - - west flash --recover - - The ``--recover`` command erases the flash memory and then writes a small binary into - the recovered flash memory. - This binary prevents the readback protection from enabling itself again after a pin - reset or power cycle. - -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`. - -To build and program the sample to the nRF54L15 PDK, complete the following steps: - -First, connect the nRF54L15 PDK to you computer using the IMCU USB port on the PDK. -Next, build the sample by running the following command: - -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: nrf54l15pdk_nrf54l15_cpuapp - :goals: build flash - -Testing the LEDs and buttons in the nRF54L15 PDK -************************************************ - -Test the nRF54L15 PDK with a :zephyr:code-sample:`blinky` sample. diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi deleted file mode 100644 index 02b02bc8171..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart20_default: uart20_default { - group1 { - psels = , - ; - }; - }; - - uart20_sleep: uart20_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart30_default: uart30_default { - group1 { - psels = , - ; - }; - }; - - uart30_sleep: uart30_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts deleted file mode 100644 index 1e0245f6cc3..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; -#include -#include "nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi" -#include - -/ { - model = "Nordic nRF54L15 PDK nRF54L15 Application MCU"; - compatible = "nordic,nrf54l15pdk_nrf54l15-cpuapp"; - - chosen { - zephyr,console = &uart20; - zephyr,shell-uart = &uart20; - zephyr,sram = &sram0; - zephyr,flash = &rram0; - zephyr,code-partition = &slot0_partition; - zephyr,ieee802154 = &ieee802154; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - led1: led_1 { - gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - led2: led_2 { - gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; - label = "Green LED 2"; - }; - led3: led_3 { - gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; - label = "Green LED 3"; - }; - }; - - buttons { - compatible = "gpio-keys"; - button0: button_0 { - gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 0"; - zephyr,code = ; - }; - button1: button_1 { - gpios = <&gpio1 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - zephyr,code = ; - }; - button2: button_2 { - gpios = <&gpio2 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - zephyr,code = ; - }; - button3: button_3 { - gpios = <&gpio2 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 3"; - zephyr,code = ; - }; - }; - - aliases { - led0 = &led0; - led1 = &led1; - led2 = &led2; - led3 = &led3; - watchdog0 = &wdt30; - sw0 = &button0; - sw1 = &button1; - sw2 = &button2; - sw3 = &button3; - }; -}; - -&lfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15500>; -}; - -&hfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15000>; -}; - -&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"; -}; - -&grtc { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&rram0 { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - slot0_partition: partition@0 { - label = "image-0"; - reg = <0x0 DT_SIZE_K(64)>; - }; - storage_partition: partition@f2000 { - label = "storage"; - reg = <0xf2000 DT_SIZE_K(24)>; - }; - }; -}; - -&clock { - status = "okay"; -}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml deleted file mode 100644 index de5ce29d162..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54l15pdk_nrf54l15_cpuapp -name: nRF54l15-PDK-nRF54l15-Application -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 256 -flash: 1536 -supported: - - gpio - - i2c - - spi - - watchdog - - i2s diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_defconfig b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_defconfig deleted file mode 100644 index bc74c3eeb33..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_defconfig +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54LX=y -CONFIG_SOC_NRF54L15_ENGA_CPUAPP=y -CONFIG_BOARD_NRF54L15PDK_NRF54L15_CPUAPP=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 - -CONFIG_UART_CONSOLE=y -CONFIG_CONSOLE=y -CONFIG_SERIAL=y - -# Enable GPIO -CONFIG_GPIO=y - -CONFIG_SOC_NRF_FORCE_CONSTLAT=y - -# Start SYSCOUNTER on driver init -CONFIG_NRF_GRTC_START_SYSCOUNTER=y diff --git a/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake b/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake deleted file mode 100644 index 4fe5b260db3..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -board_check_revision(FORMAT MAJOR.MINOR.PATCH - VALID_REVISIONS 0.2.0 - DEFAULT_REVISION 0.2.0) From 412fbd59a5c82d5b019cb2a532d1bf0a4449966c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:39 +0100 Subject: [PATCH 1121/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx: add support for nRF54L15 SOC" This reverts commit 034fc6c356a788687b2da7ea7adeb355c19329ef. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/CMakeLists.txt | 13 - modules/hal_nordic/nrfx/nrfx_config.h | 2 - .../nrfx_config_nrf54l15_enga_application.h | 1538 ----------------- 3 files changed, 1553 deletions(-) delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 20740683a44..2e809c52b79 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -66,7 +66,6 @@ zephyr_library_sources_ifdef(CONFIG_SOC_NRF52833 ${MDK_DIR}/system_nrf5283 zephyr_library_sources_ifdef(CONFIG_SOC_NRF52840 ${MDK_DIR}/system_nrf52840.c) 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_NRF54LX ${MDK_DIR}/system_nrf54l.c) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF91X ${MDK_DIR}/system_nrf91.c) zephyr_library_sources(nrfx_glue.c) @@ -136,15 +135,3 @@ if(DEFINED uicr_path) zephyr_library_compile_definitions(CONFIG_GPIO_AS_PINRESET) endif() endif() - -if(CONFIG_SOC_NRF54L15) - 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}") -endif() - -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_CLOCK_CONFIGURATION) - -if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) - zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib_lumos.c) -endif() diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 543329b4a30..5d5746e2c88 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -698,8 +698,6 @@ #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) #include -#elif defined(NRF54L15_ENGA_XXAA) && defined(NRF_APPLICATION) - #include #else #error "Unknown device." #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 deleted file mode 100644 index 46b0aa0eff7..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h +++ /dev/null @@ -1,1538 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54L15_APPLICATION_H__ -#define NRFX_CONFIG_NRF54L15_APPLICATION_H__ - -#ifndef NRFX_CONFIG_H__ -#error "This file should not be included directly. Include nrfx_config.h instead." -#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 0 -#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 0 -#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 0 -#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 0 -#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 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 - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_DPPI_CONFIG_LOG_LEVEL -#define NRFX_DPPI_CONFIG_LOG_LEVEL 0 -#endif - -/** - * @brief NRFX_EGU_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_EGU_ENABLED -#define NRFX_EGU_ENABLED 0 -#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_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 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_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 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 0 -#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 0 -#endif - -/** - * @brief NRFX_GRTC_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_GRTC_ENABLED -#define NRFX_GRTC_ENABLED 0 -#endif - -/** - * @brief GRTC CC channels ownership mask. - */ -#ifndef NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) -#if DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), owned_channels) -#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ - BIT(DT_PROP_BY_IDX(node_id, prop, idx)) -#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ - (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ - (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ - NRFX_CONFIG_BIT_DT, (|))), \ - (0))) - -#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ - (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ - ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) -#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ - (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ - DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) - -#if ((NRFX_CONFIG_GRTC_MASK_DT(owned_channels) | \ - NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) != NRFX_CONFIG_GRTC_MASK_DT(owned_channels)) -#error "`child-owned-channels` property must be a subset of `owned-channels` property" -#endif -#else -#error "property `owned-channels` does not exist" -#endif /* DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), owned_channels) */ -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ - -#endif /* NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK */ - -/** - * @brief NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY 0 -#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 0 -#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 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 0 -#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 0 -#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 0 -#endif - -/** - * @brief NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID - * - * Boolean. Accepted values 0 and 1. - */ -#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 0 -#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 0 -#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 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 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_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_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 0 -#endif - -/** - * @brief NRFX_PWM_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_PWM_ENABLED -#define NRFX_PWM_ENABLED 0 -#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_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 0 -#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 0 -#endif - -/** - * @brief NRFX_QDEC_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_QDEC_ENABLED -#define NRFX_QDEC_ENABLED 0 -#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_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 0 -#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 0 -#endif - -/** - * @brief NRFX_RTC_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_RTC_ENABLED -#define NRFX_RTC_ENABLED 0 -#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_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 0 -#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 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 0 -#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 0 -#endif - -/** - * @brief NRFX_SPI_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPI_ENABLED -#define NRFX_SPI_ENABLED 0 -#endif - -/** - * @brief NRFX_SPI00_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPI00_ENABLED -#define NRFX_SPI00_ENABLED 0 -#endif - -/** - * @brief NRFX_SPI20_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPI20_ENABLED -#define NRFX_SPI20_ENABLED 0 -#endif - -/** - * @brief NRFX_SPI21_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPI21_ENABLED -#define NRFX_SPI21_ENABLED 0 -#endif - -/** - * @brief NRFX_SPI22_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPI22_ENABLED -#define NRFX_SPI22_ENABLED 0 -#endif - -/** - * @brief NRFX_SPI30_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPI30_ENABLED -#define NRFX_SPI30_ENABLED 0 -#endif - -/** - * @brief NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY - * - * Integer value. Minimum: 0 Maximum: 7 - */ -#ifndef NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY 0 -#endif - -/** - * @brief NRFX_SPI_CONFIG_LOG_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPI_CONFIG_LOG_ENABLED -#define NRFX_SPI_CONFIG_LOG_ENABLED 0 -#endif - -/** - * @brief NRFX_SPI_CONFIG_LOG_LEVEL - * - * Integer value. - * Supported values: - * - Off = 0 - * - Error = 1 - * - Warning = 2 - * - Info = 3 - * - Debug = 4 - */ -#ifndef NRFX_SPI_CONFIG_LOG_LEVEL -#define NRFX_SPI_CONFIG_LOG_LEVEL 0 -#endif - -/** - * @brief NRFX_SPIM_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPIM_ENABLED -#define NRFX_SPIM_ENABLED 0 -#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_SPIM_EXTENDED_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPIM_EXTENDED_ENABLED -#define NRFX_SPIM_EXTENDED_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 0 -#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 0 -#endif - -/** - * @brief NRFX_SPIS_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_SPIS_ENABLED -#define NRFX_SPIS_ENABLED 0 -#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_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 0 -#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 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 0 -#endif - -/** - * @brief NRFX_TIMER_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_TIMER_ENABLED -#define NRFX_TIMER_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_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 0 -#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 0 -#endif - -/** - * @brief NRFX_TWIM_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_TWIM_ENABLED -#define NRFX_TWIM_ENABLED 0 -#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_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 0 -#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 0 -#endif - -/** - * @brief NRFX_TWIS_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_TWIS_ENABLED -#define NRFX_TWIS_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS00_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_TWIS00_ENABLED -#define NRFX_TWIS00_ENABLED 0 -#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_TWIS_ASSUME_INIT_AFTER_RESET_ONLY - * - * 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 - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_TWIS_NO_SYNC_MODE -#define NRFX_TWIS_NO_SYNC_MODE 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 0 -#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_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 0 -#endif - -/** - * @brief NRFX_UARTE_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_UARTE_ENABLED -#define NRFX_UARTE_ENABLED 0 -#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_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 0 -#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 0 -#endif - -/** - * @brief NRFX_WDT_ENABLED - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_WDT_ENABLED -#define NRFX_WDT_ENABLED 0 -#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 - -/** - * @brief NRFX_WDT_CONFIG_NO_IRQ - * - * Boolean. Accepted values 0 and 1. - */ -#ifndef NRFX_WDT_CONFIG_NO_IRQ -#define NRFX_WDT_CONFIG_NO_IRQ 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 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 0 -#endif - -#endif /* NRFX_CONFIG_NRF54L15_APPLICATION_H__ */ From 70348ab878921b6c1ebbf6efae79a47adfa0ed0a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:40 +0100 Subject: [PATCH 1122/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: add support for Nordic nrf54l family" This reverts commit bbb278ef8621d17fe48a18ba487b3647efc0fbb9. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/nrf54l/CMakeLists.txt | 12 -- .../Kconfig.defconfig.nrf54l15_enga_cpuapp | 18 --- .../nrf54l/Kconfig.defconfig.series | 19 --- soc/arm/nordic_nrf/nrf54l/Kconfig.series | 13 -- soc/arm/nordic_nrf/nrf54l/Kconfig.soc | 70 --------- soc/arm/nordic_nrf/nrf54l/soc.c | 136 ------------------ soc/arm/nordic_nrf/nrf54l/soc.h | 21 --- 7 files changed, 289 deletions(-) delete mode 100644 soc/arm/nordic_nrf/nrf54l/CMakeLists.txt delete mode 100644 soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuapp delete mode 100644 soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.series delete mode 100644 soc/arm/nordic_nrf/nrf54l/Kconfig.series delete mode 100644 soc/arm/nordic_nrf/nrf54l/Kconfig.soc delete mode 100644 soc/arm/nordic_nrf/nrf54l/soc.c delete mode 100644 soc/arm/nordic_nrf/nrf54l/soc.h diff --git a/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt b/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt deleted file mode 100644 index 914aad289ef..00000000000 --- a/soc/arm/nordic_nrf/nrf54l/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -zephyr_sources( - soc.c - ../validate_rram_partitions.c) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") - -if (CONFIG_ELV_GRTC_LFXO_ALLOWED) - message(WARNING "WARNING! ELV mode feature is EXPERIMENTAL and may brick your device!") -endif() diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuapp b/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuapp deleted file mode 100644 index d19df604c02..00000000000 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuapp +++ /dev/null @@ -1,18 +0,0 @@ -# Nordic Semiconductor nRF54L15 MCU - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54L15_ENGA_CPUAPP - -config SOC - string - default "nrf54l15_cpuapp" - -config NUM_IRQS - default 271 - -config IEEE802154_NRF5 - default IEEE802154 - -endif # SOC_NRF54L15_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.series deleted file mode 100644 index 6c0a5bc606d..00000000000 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.defconfig.series +++ /dev/null @@ -1,19 +0,0 @@ -# Nordic Semiconductor nRF54L MCU line - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_SERIES_NRF54LX - -rsource "Kconfig.defconfig.nrf54l*" - -config SOC_SERIES - default "nrf54l" - -config CORTEX_M_SYSTICK - default !NRF_GRTC_TIMER - -config CACHE_NRF_CACHE - default y if EXTERNAL_CACHE - -endif # SOC_SERIES_NRF54LX diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.series b/soc/arm/nordic_nrf/nrf54l/Kconfig.series deleted file mode 100644 index a9367a0bf36..00000000000 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.series +++ /dev/null @@ -1,13 +0,0 @@ -# Nordic Semiconductor nRF54L MCU line - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_NRF54LX - bool "Nordic Semiconductor nRF54L series MCU" - select HAS_NRFX - select HAS_NORDIC_DRIVERS - select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE - select SOC_FAMILY_NRF - help - Enable support for nRF54L MCU series diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc deleted file mode 100644 index c42c8cfc9b3..00000000000 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc +++ /dev/null @@ -1,70 +0,0 @@ -# Nordic Semiconductor nRF54 MCU line - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_SERIES_NRF54LX - -config SOC_NRF54L15 - bool "NRF54L15" - -config SOC_NRF54L15_ENGA - bool "NRF54L15 ENGA" - select SOC_NRF54L15 - -config SOC_NRF54L15_ENGA_CPUAPP - bool "NRF54L15 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_NRF54L15_ENGA - -config SOC_NRF54LX_SKIP_CLOCK_CONFIG - bool "Skip clock frequency configuration in system initialization" - help - With this option, the CPU clock frequency is not set during system initialization. - The CPU runs with the default, hardware-selected frequency. - -config SOC_NRF_FORCE_CONSTLAT - bool "Force constant-latency mode" - help - In constant latency mode the CPU wakeup latency and the PPI task response - will be constant and kept at a minimum. This is secured by forcing a set - 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_VREG_MAIN_DCDC - bool "NRF54L DC/DC converter." - help - To enable, an inductor must be connected to the DC/DC converter pin. - -config SOC_NRF54L_NORMAL_VOLTAGE_MODE - bool "NRF54L Normal Voltage Mode." - -config SOC_NRF54L_GLITCHDET_WORKAROUND - bool "Workaround that disables glitch detector" - default y - help - Temporary workaround - disabling glitch detector to limit power consumption. - -if NRF_GRTC_TIMER - -config ELV_GRTC_LFXO_ALLOWED - bool - depends on NRF_GRTC_SLEEP_ALLOWED - select EXPERIMENTAL - help - This feature allows using ELV mode when GRTC operates with the LFXO as - a low-frequency clock source. The LFXO is automatically activated when - preparing to system-off. - WARNING! This feature is EXPERIMENTAL and may brick your device! - -endif # NRF_GRTC_TIMER - -endif # SOC_SERIES_NRF54LX diff --git a/soc/arm/nordic_nrf/nrf54l/soc.c b/soc/arm/nordic_nrf/nrf54l/soc.c deleted file mode 100644 index a7b286fa048..00000000000 --- a/soc/arm/nordic_nrf/nrf54l/soc.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief System/hardware module for Nordic Semiconductor nRF54L family processor - * - * This module provides routines to initialize and support board-level hardware - * for the Nordic Semiconductor nRF54L family processor. - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); - -#define LFXO_NODE DT_NODELABEL(lfxo) -#define HFXO_NODE DT_NODELABEL(hfxo) - -static int nordicsemi_nrf54l_init(void) -{ - /* Update the SystemCoreClock global variable with current core clock - * retrieved from hardware state. - */ - SystemCoreClockUpdate(); - - /* Enable ICACHE */ - sys_cache_instr_enable(); - - if (IS_ENABLED(CONFIG_SOC_NRF54L_GLITCHDET_WORKAROUND)) { - nrf_glitchdet_enable_set(NRF_GLITCHDET, false); - } - -#if DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, internal) - uint32_t xosc32ktrim = NRF_FICR->XOSC32KTRIM; - - uint32_t offset_k = - (xosc32ktrim & FICR_XOSC32KTRIM_OFFSET_Msk) >> FICR_XOSC32KTRIM_OFFSET_Pos; - - uint32_t slope_field_k = - (xosc32ktrim & FICR_XOSC32KTRIM_SLOPE_Msk) >> FICR_XOSC32KTRIM_SLOPE_Pos; - uint32_t slope_mask_k = FICR_XOSC32KTRIM_SLOPE_Msk >> FICR_XOSC32KTRIM_SLOPE_Pos; - uint32_t slope_sign_k = (slope_mask_k - (slope_mask_k >> 1)); - int32_t slope_k = (int32_t)(slope_field_k ^ slope_sign_k) - (int32_t)slope_sign_k; - - /* As specified in the nRF54L15 PS: - * CAPVALUE = round( (CAPACITANCE - 4) * (FICR->XOSC32KTRIM.SLOPE + 0.765625 * 2^9)/(2^9) - * + FICR->XOSC32KTRIM.OFFSET/(2^6) ); - * where CAPACITANCE is the desired capacitor value in pF, holding any - * value between 4 pF and 18 pF in 0.5 pF steps. - */ - uint32_t mid_val = - (((DT_PROP(LFXO_NODE, load_capacitance_femtofarad) * 2UL) / 1000UL - 8UL) * - (uint32_t)(slope_k + 392)) + (offset_k << 4UL); - uint32_t capvalue_k = mid_val >> 10UL; - - /* Round. */ - if ((mid_val % 1024UL) >= 512UL) { - capvalue_k++; - } - nrf_oscillators_lfxo_cap_set(NRF_OSCILLATORS, (nrf_oscillators_lfxo_cap_t)capvalue_k); -#elif DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, external) - nrf_oscillators_lfxo_cap_set(NRF_OSCILLATORS, (nrf_oscillators_lfxo_cap_t)0); -#endif - -#if DT_ENUM_HAS_VALUE(HFXO_NODE, load_capacitors, internal) - uint32_t xosc32mtrim = NRF_FICR->XOSC32MTRIM; - /* The SLOPE field is in the two's complement form, hence this special - * handling. Ideally, it would result in just one SBFX instruction for - * extracting the slope value, at least gcc is capable of producing such - * output, but since the compiler apparently tries first to optimize - * additions and subtractions, it generates slightly less than optimal - * code. - */ - uint32_t slope_field = - (xosc32mtrim & FICR_XOSC32MTRIM_SLOPE_Msk) >> FICR_XOSC32MTRIM_SLOPE_Pos; - uint32_t slope_mask = FICR_XOSC32MTRIM_SLOPE_Msk >> FICR_XOSC32MTRIM_SLOPE_Pos; - uint32_t slope_sign = (slope_mask - (slope_mask >> 1)); - int32_t slope_m = (int32_t)(slope_field ^ slope_sign) - (int32_t)slope_sign; - uint32_t offset_m = - (xosc32mtrim & FICR_XOSC32MTRIM_OFFSET_Msk) >> FICR_XOSC32MTRIM_OFFSET_Pos; - /* As specified in the nRF54L15 PS: - * CAPVALUE = (((CAPACITANCE-5.5)*(FICR->XOSC32MTRIM.SLOPE+791)) + - * FICR->XOSC32MTRIM.OFFSET<<2)>>8; - * where CAPACITANCE is the desired total load capacitance value in pF, - * holding any value between 4.0 pF and 17.0 pF in 0.25 pF steps. - */ - uint32_t capvalue = - (((((DT_PROP(HFXO_NODE, load_capacitance_femtofarad) * 4UL) / 1000UL) - 22UL) * - (uint32_t)(slope_m + 791) / 4UL) + (offset_m << 2UL)) >> 8UL; - - nrf_oscillators_hfxo_cap_set(NRF_OSCILLATORS, true, capvalue); -#elif DT_ENUM_HAS_VALUE(HFXO_NODE, load_capacitors, external) - nrf_oscillators_hfxo_cap_set(NRF_OSCILLATORS, false, 0); -#endif - - if (IS_ENABLED(CONFIG_SOC_NRF_FORCE_CONSTLAT)) { - nrf_power_task_trigger(NRF_POWER, NRF_POWER_TASK_CONSTLAT); - } - - if (IS_ENABLED(CONFIG_SOC_NRF54L_VREG_MAIN_DCDC)) { - nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_MAIN, true); - } - - 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 */ - - return 0; -} - -void arch_busy_wait(uint32_t time_us) -{ - nrfx_coredep_delay_us(time_us); -} - -SYS_INIT(nordicsemi_nrf54l_init, PRE_KERNEL_1, 0); diff --git a/soc/arm/nordic_nrf/nrf54l/soc.h b/soc/arm/nordic_nrf/nrf54l/soc.h deleted file mode 100644 index 721e9336989..00000000000 --- a/soc/arm/nordic_nrf/nrf54l/soc.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file SoC configuration macros for the Nordic Semiconductor NRF54L family processors. - */ - -#ifndef _NORDICSEMI_NRF54L_SOC_H_ -#define _NORDICSEMI_NRF54L_SOC_H_ - -#define __ICACHE_PRESENT 1 - -#include - -#define FLASH_PAGE_ERASE_MAX_TIME_US 8000UL -#define FLASH_PAGE_MAX_CNT 381UL - -#endif /* _NORDICSEMI_NRF54L_SOC_H_ */ From f6c1dae8807218d9d8096e791a60edff729e96b3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:40 +0100 Subject: [PATCH 1123/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: add source code for validating rram partitions" This reverts commit d9d6d3c83a37b9cb42b700f0bda2d651c7cb08c4. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/validate_rram_partitions.c | 97 ------------------- 1 file changed, 97 deletions(-) delete mode 100644 soc/arm/nordic_nrf/validate_rram_partitions.c diff --git a/soc/arm/nordic_nrf/validate_rram_partitions.c b/soc/arm/nordic_nrf/validate_rram_partitions.c deleted file mode 100644 index f35d9cf73f3..00000000000 --- a/soc/arm/nordic_nrf/validate_rram_partitions.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#define PAIR__(f, sep, arg_first, ...) FOR_EACH_FIXED_ARG(f, sep, arg_first, __VA_ARGS__) -#define PAIR_(f, sep, args_to_expand) PAIR__(f, sep, args_to_expand) -#define PAIR(n, f, sep, ...) PAIR_(f, sep, GET_ARGS_LESS_N(n, __VA_ARGS__)) - -/** - * @brief Call a macro on every unique pair of the given variadic arguments. - * - * For example, FOR_EACH_PAIR(f, (,), 1, 2, 3, 4) should expand to: - * - * f(2, 1) , f(3, 1) , f(4, 1) , f(3, 2) , f(4, 2) , f(4, 3) - * - * @param f Macro to call. Must accept two arguments. - * @param sep Separator between macro calls. Must be in parentheses. - * - * @see FOR_EACH - */ -#define FOR_EACH_PAIR(f, sep, ...) \ - LISTIFY(NUM_VA_ARGS_LESS_1(__VA_ARGS__), PAIR, sep, f, sep, __VA_ARGS__) - -/** - * @brief Get a node's non-secure register block start address. - * - * @param node_id Node identifier. - */ -#define REG_ADDR_NS(node_id) (DT_REG_ADDR(node_id) & 0xEFFFFFFFUL) - -/** - * @brief Get a node's non-secure register block end address. - * - * @param node_id Node identifier. - */ -#define REG_END_NS(node_id) (REG_ADDR_NS(node_id) + DT_REG_SIZE(node_id)) - -/* clang-format off */ - -#define RRAM_BASE REG_ADDR_NS(DT_NODELABEL(rram0)) -#define RRAM_CONTROLLER DT_NODELABEL(rram_controller) - -#if !DT_NODE_EXISTS(RRAM_CONTROLLER) -#error "Missing \"rram-controller\" node" -#endif - -#define CHECK_RRAM_NODE_COMPATIBLE(node_id) \ - BUILD_ASSERT(DT_NODE_HAS_COMPAT(node_id, soc_nv_flash), \ - "Missing compatible \"soc-nv-flash\" from " DT_NODE_FULL_NAME(node_id) \ - " (required for all children of " DT_NODE_PATH(RRAM_CONTROLLER) ")") - -#define CHECK_RRAM_PARTITION_WITHIN_PARENT(node_id) \ - BUILD_ASSERT(RRAM_BASE + REG_ADDR_NS(node_id) >= REG_ADDR_NS(DT_GPARENT(node_id)) && \ - RRAM_BASE + REG_END_NS(node_id) <= REG_END_NS(DT_GPARENT(node_id)), \ - DT_NODE_FULL_NAME(node_id) " is not fully contained within its parent " \ - DT_NODE_PATH(DT_GPARENT(node_id))) - -#define CHECK_NODES_NON_OVERLAPPING(node_id_1, node_id_2) \ - BUILD_ASSERT(REG_ADDR_NS(node_id_1) >= REG_END_NS(node_id_2) || \ - REG_ADDR_NS(node_id_2) >= REG_END_NS(node_id_1), \ - DT_NODE_PATH(node_id_1) " and " DT_NODE_PATH(node_id_2) " are overlapping") - -/* Retrieve all RRAM nodes that are children of "rram-controller". */ -#define COMMA(x) x, -#define RRAM_NODES_LIST LIST_DROP_EMPTY(DT_FOREACH_CHILD(RRAM_CONTROLLER, COMMA)) - -#if !IS_EMPTY(RRAM_NODES_LIST) - -/* Check that every RRAM node matches the "soc-nv-flash" compatible. */ -FOR_EACH(CHECK_RRAM_NODE_COMPATIBLE, (;), RRAM_NODES_LIST); - -/* Check that no two RRAM nodes are overlapping. */ -FOR_EACH_PAIR(CHECK_NODES_NON_OVERLAPPING, (;), RRAM_NODES_LIST); - -#endif - -/* Retrieve all RRAM partitions by looking for "fixed-partitions" compatibles in each RRAM node. */ -#define PARTITION_(x) \ - COND_CODE_1(DT_NODE_HAS_COMPAT(x, fixed_partitions), (DT_FOREACH_CHILD(x, COMMA)), ()) -#define PARTITION(x, ...) DT_FOREACH_CHILD_STATUS_OKAY(x, PARTITION_) -#define RRAM_PARTITION_LIST LIST_DROP_EMPTY(DT_FOREACH_CHILD_VARGS(RRAM_CONTROLLER, PARTITION)) - -#if !IS_EMPTY(RRAM_PARTITION_LIST) - -/* Check that every RRAM partition is within the bounds of its parent RRAM node. */ -FOR_EACH(CHECK_RRAM_PARTITION_WITHIN_PARENT, (;), RRAM_PARTITION_LIST); - -/* Check that no two RRAM partitions are overlapping. */ -FOR_EACH_PAIR(CHECK_NODES_NON_OVERLAPPING, (;), RRAM_PARTITION_LIST); - -#endif From aebe7930e487365fe58176a23effdffcb90fb53b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:40 +0100 Subject: [PATCH 1124/2300] Revert "[nrf fromtree] dts: arm: nordic: add support for Nordic nRF54L15" This reverts commit 983999dbeafb0339bdbe105a4cbc37b31c928f61. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54l15_cpuapp.dtsi | 90 ---- .../nordic/nrf54l15_cpuapp_peripherals.dtsi | 412 ------------------ dts/arm/nordic/nrf54l_common.dtsi | 33 -- 3 files changed, 535 deletions(-) delete mode 100644 dts/arm/nordic/nrf54l15_cpuapp.dtsi delete mode 100644 dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi delete mode 100644 dts/arm/nordic/nrf54l_common.dtsi diff --git a/dts/arm/nordic/nrf54l15_cpuapp.dtsi b/dts/arm/nordic/nrf54l15_cpuapp.dtsi deleted file mode 100644 index 7e90c8b1213..00000000000 --- a/dts/arm/nordic/nrf54l15_cpuapp.dtsi +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -/ { - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu: cpu@0 { - clock-frequency = ; - device_type = "cpu"; - compatible = "arm,cortex-m33f"; - reg = <0>; - #address-cells = <1>; - #size-cells = <1>; - itm: itm@e0000000 { - compatible = "arm,armv8m-itm"; - reg = <0xe0000000 0x1000>; - swo-ref-frequency = ; - }; - }; - }; - - 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 { - uicr: uicr@ffd000 { - compatible = "nordic,nrf-uicr"; - reg = <0xffd000 0x1000>; - }; - - ficr: ficr@ffc000 { - compatible = "nordic,nrf-ficr"; - reg = <0xffc000 0x1000>; - }; - - sram0: memory@20000000 { - compatible = "mmio-sram"; - reg = <0x20000000 DT_SIZE_K(256)>; - }; - - peripheral@50000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x50000000 0x10000000>; - - /* Common nRF54L15 peripheral description */ - #include "nrf54l15_cpuapp_peripherals.dtsi" - }; - }; -}; - -&nvic { - arm,num-irq-priority-bits = <3>; -}; - -&rram_controller { - rram0: rram@0 { - /* - * "1524 KB non-volatile memory (RRAM) and 256 KB RAM" - * -- Product Specification - * NB: 1524 = 1.5 * 1024 - 12 - */ - reg = <0x0 DT_SIZE_K(1524)>; - }; -}; - -/* Disable by default to use GRTC */ -&systick { - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi deleted file mode 100644 index 786c21ab215..00000000000 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ /dev/null @@ -1,412 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -dppic00: dppic@42000 { - compatible = "nordic,nrf-dppic"; - reg = <0x42000 0x808>; - 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>; - status = "disabled"; -}; - -uart00: uart@4a000 { - compatible = "nordic,nrf-uarte"; - reg = <0x4a000 0x1000>; - interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; - 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>; - prescaler = <0>; -}; - -dppic10: dppic@82000 { - compatible = "nordic,nrf-dppic"; - reg = <0x82000 0x808>; - 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>; - 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; - - ieee802154: ieee802154 { - compatible = "nordic,nrf-ieee802154"; - status = "disabled"; - }; -}; - -dppic20: dppic@c2000 { - compatible = "nordic,nrf-dppic"; - reg = <0xc2000 0x808>; - status = "disabled"; -}; - -i2c20: i2c@c6000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - clock-frequency = ; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -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>; - status = "disabled"; -}; - -uart20: uart@c6000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -i2c21: i2c@c7000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - clock-frequency = ; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -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>; - status = "disabled"; -}; - -uart21: uart@c7000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -i2c22: i2c@c8000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc8000 0x1000>; - clock-frequency = ; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -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>; - status = "disabled"; -}; - -uart22: uart@c8000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -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>; -}; - -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>; - interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; - 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>; - owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -dppic30: dppic@102000 { - compatible = "nordic,nrf-dppic"; - reg = <0x102000 0x808>; - status = "disabled"; -}; - -i2c30: i2c@104000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - clock-frequency = ; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -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>; - status = "disabled"; -}; - -uart30: uart@104000 { - compatible = "nordic,nrf-uarte"; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -wdt30: watchdog@108000 { - compatible = "nordic,nrf-wdt"; - reg = <0x108000 0x620>; - interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; - -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>; - interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - instance = <30>; -}; - -clock: clock@10e000 { - compatible = "nordic,nrf-clock"; - reg = <0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; -}; diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi deleted file mode 100644 index 4fb7768bd3f..00000000000 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include "nrf_common.dtsi" - -/ { - soc { - rram_controller: rram-controller@5004b000 { - compatible = "nordic,rram-controller"; - reg = <0x5004b000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - interrupts = <75 NRF_DEFAULT_IRQ_PRIORITY>; - rram0: rram@0 { - compatible = "soc-nv-flash"; - erase-block-size = <4096>; - write-block-size = <1>; - }; - }; - }; - - chosen { - zephyr,flash-controller = &rram_controller; - }; - - sw_pwm: sw-pwm { - generator = <&timer21>; - }; -}; From 09280482663d07b9fefa6672cfbef46ce2f4a5be Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:40 +0100 Subject: [PATCH 1125/2300] Revert "[nrf fromtree] dts: bindings: clock: add nordic,nrf-hfxo:" This reverts commit 65373fec37eaf992d9d25b8049a4574bc39c933c. Signed-off-by: Robert Lubos --- dts/bindings/clock/nordic,nrf-hfxo.yaml | 82 ------------------------- 1 file changed, 82 deletions(-) delete mode 100644 dts/bindings/clock/nordic,nrf-hfxo.yaml diff --git a/dts/bindings/clock/nordic,nrf-hfxo.yaml b/dts/bindings/clock/nordic,nrf-hfxo.yaml deleted file mode 100644 index dc99c67e5cc..00000000000 --- a/dts/bindings/clock/nordic,nrf-hfxo.yaml +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic nRF high-frequency crystal oscillator - -compatible: "nordic,nrf-hfxo" - -include: [fixed-clock.yaml] - -properties: - clock-frequency: - const: 32000000 - - load-capacitors: - type: string - enum: - - "internal" - - "external" - description: | - Type of load capacitors connected to the crystal. If not specified, - adjustments may still happen when the device trimming happens during - system initialization. - - load-capacitance-femtofarad: - type: int - enum: - - 4000 - - 4250 - - 4500 - - 4750 - - 5000 - - 5250 - - 5500 - - 5750 - - 6000 - - 6250 - - 6500 - - 6750 - - 7000 - - 7250 - - 7500 - - 7750 - - 8000 - - 8250 - - 8500 - - 8750 - - 9000 - - 9250 - - 9500 - - 9750 - - 10000 - - 10250 - - 10500 - - 10750 - - 11000 - - 11250 - - 11500 - - 11750 - - 12000 - - 12250 - - 12500 - - 12750 - - 13000 - - 13250 - - 13500 - - 13750 - - 14000 - - 14250 - - 14500 - - 14750 - - 15000 - - 15250 - - 15500 - - 15750 - - 16000 - - 16250 - - 16500 - - 16750 - - 17000 - description: | - Load capacitance in femtofarads. This property is only used when - load-capacitors is set to "internal". From 67cd9f959b9b9861b9254aefa35b581ff2b33343 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:40 +0100 Subject: [PATCH 1126/2300] Revert "[nrf fromtree] dts: bindings: clock: add nordic,nrf-lfxo" This reverts commit 57458404af37b3703ba7e1725b04090727178619. Signed-off-by: Robert Lubos --- dts/bindings/clock/nordic,nrf-lfxo.yaml | 58 ------------------------- 1 file changed, 58 deletions(-) delete mode 100644 dts/bindings/clock/nordic,nrf-lfxo.yaml diff --git a/dts/bindings/clock/nordic,nrf-lfxo.yaml b/dts/bindings/clock/nordic,nrf-lfxo.yaml deleted file mode 100644 index f0090ff4a81..00000000000 --- a/dts/bindings/clock/nordic,nrf-lfxo.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic nRF low-frequency crystal oscillator - -compatible: "nordic,nrf-lfxo" - -include: [fixed-clock.yaml] - -properties: - clock-frequency: - const: 32768 - - load-capacitors: - type: string - enum: - - "internal" - - "external" - description: | - Type of load capacitors connected to the crystal. If not specified, - adjustments may still happen when the device trimming happens during - system initialization. - - load-capacitance-femtofarad: - type: int - enum: - - 4000 - - 4500 - - 5000 - - 5500 - - 6000 - - 6500 - - 7000 - - 7500 - - 8000 - - 8500 - - 9000 - - 9500 - - 10000 - - 10500 - - 11000 - - 11500 - - 12000 - - 12500 - - 13000 - - 13500 - - 14000 - - 14500 - - 15000 - - 15500 - - 16000 - - 16500 - - 17000 - - 17500 - - 18000 - description: | - Load capacitance in femtofarads. This property is only used when - load-capacitors is set to "internal". From 9e5e39b6333fd6ea0669c37dafdfec8ba6775c88 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:40 +0100 Subject: [PATCH 1127/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: add nRF54L15 peripherals instances" This reverts commit e230752c19114850668375e03f7dd8e025d09d8c. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/Kconfig.peripherals | 36 -------------------- soc/arm/nordic_nrf/validate_base_addresses.c | 14 -------- 2 files changed, 50 deletions(-) diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index 5eeff856c96..9e637f2661e 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -318,27 +318,6 @@ config HAS_HW_NRF_TIMER3 config HAS_HW_NRF_TIMER4 def_bool $(dt_nodelabel_enabled_with_compat,timer4,$(DT_COMPAT_NORDIC_NRF_TIMER)) -config HAS_HW_NRF_TIMER00 - def_bool $(dt_nodelabel_enabled_with_compat,timer00,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER10 - def_bool $(dt_nodelabel_enabled_with_compat,timer10,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER20 - def_bool $(dt_nodelabel_enabled_with_compat,timer20,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER21 - def_bool $(dt_nodelabel_enabled_with_compat,timer21,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER22 - def_bool $(dt_nodelabel_enabled_with_compat,timer22,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER23 - def_bool $(dt_nodelabel_enabled_with_compat,timer23,$(DT_COMPAT_NORDIC_NRF_TIMER)) - -config HAS_HW_NRF_TIMER24 - def_bool $(dt_nodelabel_enabled_with_compat,timer24,$(DT_COMPAT_NORDIC_NRF_TIMER)) - config HAS_HW_NRF_TWI0 def_bool $(dt_nodelabel_enabled_with_compat,i2c0,$(DT_COMPAT_NORDIC_NRF_TWI)) @@ -423,21 +402,6 @@ config HAS_HW_NRF_UARTE2 config HAS_HW_NRF_UARTE3 def_bool $(dt_nodelabel_enabled_with_compat,uart3,$(DT_COMPAT_NORDIC_NRF_UARTE)) -config HAS_HW_NRF_UARTE00 - def_bool $(dt_nodelabel_enabled_with_compat,uart00,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE20 - def_bool $(dt_nodelabel_enabled_with_compat,uart20,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE21 - def_bool $(dt_nodelabel_enabled_with_compat,uart21,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE22 - def_bool $(dt_nodelabel_enabled_with_compat,uart22,$(DT_COMPAT_NORDIC_NRF_UARTE)) - -config HAS_HW_NRF_UARTE30 - def_bool $(dt_nodelabel_enabled_with_compat,uart30,$(DT_COMPAT_NORDIC_NRF_UARTE)) - config HAS_HW_NRF_USBD def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_USBD)) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 9daa820efa9..ee440c3252c 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -198,22 +198,10 @@ CHECK_DT_REG(timer1, NRF_TIMER1); CHECK_DT_REG(timer2, NRF_TIMER2); CHECK_DT_REG(timer3, NRF_TIMER3); CHECK_DT_REG(timer4, NRF_TIMER4); -CHECK_DT_REG(timer00, NRF_TIMER00); -CHECK_DT_REG(timer10, NRF_TIMER10); -CHECK_DT_REG(timer20, NRF_TIMER20); -CHECK_DT_REG(timer21, NRF_TIMER21); -CHECK_DT_REG(timer22, NRF_TIMER22); -CHECK_DT_REG(timer23, NRF_TIMER23); -CHECK_DT_REG(timer24, NRF_TIMER24); CHECK_UART_REG(uart0, 0); CHECK_DT_REG(uart1, NRF_UARTE1); CHECK_DT_REG(uart2, NRF_UARTE2); CHECK_DT_REG(uart3, NRF_UARTE3); -CHECK_DT_REG(uart00, NRF_UARTE00); -CHECK_DT_REG(uart20, NRF_UARTE20); -CHECK_DT_REG(uart21, NRF_UARTE21); -CHECK_DT_REG(uart22, NRF_UARTE22); -CHECK_DT_REG(uart30, NRF_UARTE30); CHECK_DT_REG(uicr, NRF_UICR); CHECK_DT_REG(usbd, NRF_USBD); CHECK_DT_REG(usbreg, NRF_USBREGULATOR); @@ -221,8 +209,6 @@ CHECK_DT_REG(vmc, NRF_VMC); CHECK_DT_REG(wdt, NRF_WDT0); /* this should be the same node as wdt0 */ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); -CHECK_DT_REG(wdt30, NRF_WDT30); -CHECK_DT_REG(wdt31, NRF_WDT31); /* nRF51/nRF52-specific addresses */ #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) From 2dc5d2829ba41f53315e9685a9a7e06bc09bd1c1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:41 +0100 Subject: [PATCH 1128/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx: add nRF54L15 peripherals instances" This reverts commit 7cd3a07e7b6ae7c6341397f82fc708138e049de7. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/Kconfig | 60 --------------------------- modules/hal_nordic/nrfx/nrfx_config.h | 36 ---------------- 2 files changed, 96 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index d4efbb7cac8..bdca4016ee3 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -422,41 +422,6 @@ config NRFX_TIMER4 depends on $(dt_nodelabel_has_compat,timer4,$(DT_COMPAT_NORDIC_NRF_TIMER)) select NRFX_TIMER -config NRFX_TIMER00 - bool "TIMER00 driver instance" - depends on $(dt_nodelabel_has_compat,timer00,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER10 - bool "TIMER10 driver instance" - depends on $(dt_nodelabel_has_compat,timer10,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER20 - bool "TIMER20 driver instance" - depends on $(dt_nodelabel_has_compat,timer20,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER21 - bool "TIMER21 driver instance" - depends on $(dt_nodelabel_has_compat,timer21,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER22 - bool "TIMER22 driver instance" - depends on $(dt_nodelabel_has_compat,timer22,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER23 - bool "TIMER23 driver instance" - depends on $(dt_nodelabel_has_compat,timer23,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - -config NRFX_TIMER24 - bool "TIMER24 driver instance" - depends on $(dt_nodelabel_has_compat,timer24,$(DT_COMPAT_NORDIC_NRF_TIMER)) - select NRFX_TIMER - config NRFX_TWI bool @@ -612,31 +577,6 @@ config NRFX_UARTE3 depends on $(dt_nodelabel_has_compat,uart3,$(DT_COMPAT_NORDIC_NRF_UARTE)) select NRFX_UARTE -config NRFX_UARTE00 - bool "UARTE00 driver instance" - depends on $(dt_nodelabel_has_compat,uart00,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE20 - bool "UARTE20 driver instance" - depends on $(dt_nodelabel_has_compat,uart20,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE21 - bool "UARTE21 driver instance" - depends on $(dt_nodelabel_has_compat,uart21,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE22 - bool "UARTE22 driver instance" - depends on $(dt_nodelabel_has_compat,uart22,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - -config NRFX_UARTE30 - bool "UARTE30 driver instance" - depends on $(dt_nodelabel_has_compat,uart30,$(DT_COMPAT_NORDIC_NRF_UARTE)) - select NRFX_UARTE - config NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG bool "UARTE GPIO configuration support" depends on NRFX_UARTE diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 5d5746e2c88..451101c8f4b 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -451,27 +451,6 @@ #ifdef CONFIG_NRFX_TIMER4 #define NRFX_TIMER4_ENABLED 1 #endif -#ifdef CONFIG_NRFX_TIMER00 -#define NRFX_TIMER00_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER10 -#define NRFX_TIMER10_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER20 -#define NRFX_TIMER20_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER21 -#define NRFX_TIMER21_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER22 -#define NRFX_TIMER22_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER23 -#define NRFX_TIMER23_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TIMER24 -#define NRFX_TIMER24_ENABLED 1 -#endif #ifdef CONFIG_NRFX_TWI #define NRFX_TWI_ENABLED 1 @@ -591,21 +570,6 @@ #ifdef CONFIG_NRFX_UARTE3 #define NRFX_UARTE3_ENABLED 1 #endif -#ifdef CONFIG_NRFX_UARTE00 -#define NRFX_UARTE00_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE20 -#define NRFX_UARTE20_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE21 -#define NRFX_UARTE21_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE22 -#define NRFX_UARTE22_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_UARTE30 -#define NRFX_UARTE30_ENABLED 1 -#endif #ifdef CONFIG_NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG #define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 1 #endif From d69076922653271d9fff9af3966dc31740e7190d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:41 +0100 Subject: [PATCH 1129/2300] Revert "[nrf fromtree] drivers: timer: add GRTC driver" This reverts commit 4e2b9ca49e420a4e2f125553004bf4d0dd53e97a. Signed-off-by: Robert Lubos --- drivers/timer/CMakeLists.txt | 1 - drivers/timer/Kconfig | 1 - drivers/timer/Kconfig.nrf_grtc | 48 -- drivers/timer/Kconfig.nrf_xrtc | 4 +- drivers/timer/nrf_grtc_timer.c | 566 ------------------ include/zephyr/drivers/timer/nrf_grtc_timer.h | 202 ------- 6 files changed, 2 insertions(+), 820 deletions(-) delete mode 100644 drivers/timer/Kconfig.nrf_grtc delete mode 100644 drivers/timer/nrf_grtc_timer.c delete mode 100644 include/zephyr/drivers/timer/nrf_grtc_timer.h diff --git a/drivers/timer/CMakeLists.txt b/drivers/timer/CMakeLists.txt index 36534e4716f..47a10b358c1 100644 --- a/drivers/timer/CMakeLists.txt +++ b/drivers/timer/CMakeLists.txt @@ -24,7 +24,6 @@ zephyr_library_sources_ifdef(CONFIG_MCUX_GPT_TIMER mcux_gpt_timer.c) zephyr_library_sources_ifdef(CONFIG_MIPS_CP0_TIMER mips_cp0_timer.c) zephyr_library_sources_ifdef(CONFIG_NATIVE_POSIX_TIMER native_posix_timer.c) zephyr_library_sources_ifdef(CONFIG_NPCX_ITIM_TIMER npcx_itim_timer.c) -zephyr_library_sources_ifdef(CONFIG_NRF_GRTC_TIMER nrf_grtc_timer.c) zephyr_library_sources_ifdef(CONFIG_NRF_RTC_TIMER nrf_rtc_timer.c) zephyr_library_sources_ifdef(CONFIG_RCAR_CMT_TIMER rcar_cmt_timer.c) zephyr_library_sources_ifdef(CONFIG_RISCV_MACHINE_TIMER riscv_machine_timer.c) diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index f20442dd2c5..b7e01eb5811 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -84,7 +84,6 @@ source "drivers/timer/Kconfig.mips_cp0" source "drivers/timer/Kconfig.native_posix" source "drivers/timer/Kconfig.npcx_itim" source "drivers/timer/Kconfig.nrf_rtc" -source "drivers/timer/Kconfig.nrf_grtc" source "drivers/timer/Kconfig.nrf_xrtc" source "drivers/timer/Kconfig.rcar_cmt" source "drivers/timer/Kconfig.riscv_machine" diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc deleted file mode 100644 index 442c524fd19..00000000000 --- a/drivers/timer/Kconfig.nrf_grtc +++ /dev/null @@ -1,48 +0,0 @@ -# Timer driver configuration options -# Copyright (c) 2024 Nordic Semiconductor ASA - -menuconfig NRF_GRTC_TIMER - bool "nRF GRTC Timer" - default y if DT_HAS_NORDIC_NRF_GRTC_ENABLED - select TICKLESS_CAPABLE - select TIMER_HAS_64BIT_CYCLE_COUNTER - select NRFX_GRTC - help - This module implements a kernel device driver for the nRF Global Real - Time Counter NRF_GRTC and provides the standard "system clock driver" - interfaces. - -if NRF_GRTC_TIMER - -config NRF_GRTC_SLEEP_ALLOWED - def_bool y - depends on POWEROFF - help - This feature allows GRTC SYSCOUNTER to go to sleep state. - -config NRF_GRTC_TIMER_APP_DEFINED_INIT - bool "Application defines GRTC initialization" - help - Application defines the initialization procedure and time of the GRTC - drivers, rather than leaving it up to SYS_INIT. - -config NRF_GRTC_START_SYSCOUNTER - bool "Start SYSCOUNTER on driver init" - select NRF_GRTC_TIMER_CLOCK_MANAGEMENT - help - Start the SYSCOUNTER when initializing the GRTC. This should only be - handled by one processor in the system. - -config NRF_GRTC_TIMER_CLOCK_MANAGEMENT - bool - help - Compile additional driver code for enabling management functionality of - the GRTC. Usually this is only needed by the processor that is starting - the SYSCOUNTER, but can be shared by multiple processors in the system. - -config NRF_GRTC_SLEEP_MINIMUM_LATENCY - int - default 1000 - depends on NRF_GRTC_SLEEP_ALLOWED - -endif # NRF_GRTC_TIMER diff --git a/drivers/timer/Kconfig.nrf_xrtc b/drivers/timer/Kconfig.nrf_xrtc index f9fa25a1c30..56efbc3a298 100644 --- a/drivers/timer/Kconfig.nrf_xrtc +++ b/drivers/timer/Kconfig.nrf_xrtc @@ -3,7 +3,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if NRF_RTC_TIMER || NRF_GRTC_TIMER +if NRF_RTC_TIMER choice prompt "Clock startup policy" default SYSTEM_CLOCK_WAIT_FOR_STABILITY @@ -35,4 +35,4 @@ config SYSTEM_CLOCK_WAIT_FOR_STABILITY driver initialization. endchoice -endif # NRF_RTC_TIMER || NRF_GRTC_TIMER +endif # NRF_RTC_TIMER diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c deleted file mode 100644 index dc6ac410905..00000000000 --- a/drivers/timer/nrf_grtc_timer.c +++ /dev/null @@ -1,566 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define CHAN_COUNT NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS -#define EXT_CHAN_COUNT (CHAN_COUNT - 1) -/* The reset value of waketime is 1, which doesn't seem to work. - * It's being looked into, but for the time being use 4. - * Timeout must always be higher than waketime, so setting that to 5. - */ -#define WAKETIME (4) -#define TIMEOUT (WAKETIME + 1) - -#define GRTC_NODE DT_NODELABEL(grtc) - -#ifndef GRTC_SYSCOUNTERL_VALUE_Msk -#define GRTC_SYSCOUNTERL_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERL_VALUE_Msk -#endif - -#ifndef GRTC_SYSCOUNTERH_VALUE_Msk -#define GRTC_SYSCOUNTERH_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERH_VALUE_Msk -#endif - -#define MAX_CC_LATCH_WAIT_TIME_US 77 - -#define CYC_PER_TICK \ - ((uint64_t)sys_clock_hw_cycles_per_sec() / (uint64_t)CONFIG_SYS_CLOCK_TICKS_PER_SEC) - -#define COUNTER_SPAN (GRTC_SYSCOUNTERL_VALUE_Msk | ((uint64_t)GRTC_SYSCOUNTERH_VALUE_Msk << 32)) -#define MAX_TICKS \ - (((COUNTER_SPAN / CYC_PER_TICK) > INT_MAX) ? INT_MAX : (COUNTER_SPAN / CYC_PER_TICK)) - -#define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) - -/* The maximum SYSCOUNTERVALID settling time equals 1x32k cycles + 20x1MHz cycles. */ -#define GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US 51 - -#if defined(CONFIG_TEST) -const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); -#endif - -static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_context); - -static struct k_spinlock lock; -static uint64_t last_count; -static atomic_t int_mask; -static uint8_t ext_channels_allocated; -static nrfx_grtc_channel_t system_clock_channel_data = { - .handler = sys_clock_timeout_handler, - .p_context = NULL, - .channel = (uint8_t)-1, -}; - -#define IS_CHANNEL_ALLOWED_ASSERT(chan) \ - __ASSERT_NO_MSG((NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK & (1UL << (chan))) && \ - ((chan) != system_clock_channel_data.channel)) - -static inline void grtc_active_set(void) -{ -#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) - nrfy_grtc_sys_counter_active_set(NRF_GRTC, true); - while (!nrfy_grtc_sys_conter_ready_check(NRF_GRTC)) { - } -#else - nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, true); - k_busy_wait(GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US); -#endif -} - -static inline void grtc_wakeup(void) -{ - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - grtc_active_set(); - } -} - -static inline void grtc_sleep(void) -{ - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { -#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) - nrfy_grtc_sys_counter_active_set(NRF_GRTC, false); -#else - nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, false); -#endif - } -} - -static inline uint64_t counter_sub(uint64_t a, uint64_t b) -{ - return (a - b); -} - -static inline uint64_t counter(void) -{ - uint64_t now; - - grtc_wakeup(); - nrfx_grtc_syscounter_get(&now); - grtc_sleep(); - return now; -} - -static inline uint64_t get_comparator(uint32_t chan) -{ - uint64_t cc; - nrfx_err_t result; - - result = nrfx_grtc_syscounter_cc_value_read(chan, &cc); - if (result != NRFX_SUCCESS) { - if (result != NRFX_ERROR_INVALID_PARAM) { - return -EAGAIN; - } - return -EPERM; - } - return cc; -} - -static void system_timeout_set(uint64_t value) -{ - if (value <= NRF_GRTC_SYSCOUNTER_CCADD_MASK) { - grtc_wakeup(); - nrfx_grtc_syscounter_cc_relative_set(&system_clock_channel_data, value, true, - NRFX_GRTC_CC_RELATIVE_SYSCOUNTER); - grtc_sleep(); - } else { - nrfx_grtc_syscounter_cc_absolute_set(&system_clock_channel_data, value + counter(), - true); - } -} - -static bool compare_int_lock(int32_t chan) -{ - atomic_val_t prev = atomic_and(&int_mask, ~BIT(chan)); - - nrfx_grtc_syscounter_cc_int_disable(chan); - - return prev & BIT(chan); -} - -static void compare_int_unlock(int32_t chan, bool key) -{ - if (key) { - atomic_or(&int_mask, BIT(chan)); - nrfx_grtc_syscounter_cc_int_enable(chan); - } -} - -static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_context) -{ - ARG_UNUSED(id); - ARG_UNUSED(p_context); - uint64_t dticks; - uint64_t now = counter(); - - if (unlikely(now < cc_val)) { - return; - } - if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { - /* protection is not needed because we are in the GRTC interrupt - * so it won't get preempted by the interrupt. - */ - system_timeout_set(CYC_PER_TICK); - } - - dticks = counter_sub(now, last_count) / CYC_PER_TICK; - - last_count += dticks * CYC_PER_TICK; - sys_clock_announce(IS_ENABLED(CONFIG_TICKLESS_KERNEL) ? (int32_t)dticks : (dticks > 0)); -} - -int32_t z_nrf_grtc_timer_chan_alloc(void) -{ - uint8_t chan; - nrfx_err_t err_code; - - /* Prevent allocating all available channels - one must be left for system purposes. */ - if (ext_channels_allocated >= EXT_CHAN_COUNT) { - return -ENOMEM; - } - err_code = nrfx_grtc_channel_alloc(&chan); - if (err_code != NRFX_SUCCESS) { - return -ENOMEM; - } - ext_channels_allocated++; - return (int32_t)chan; -} - -void z_nrf_grtc_timer_chan_free(int32_t chan) -{ - IS_CHANNEL_ALLOWED_ASSERT(chan); - nrfx_err_t err_code = nrfx_grtc_channel_free(chan); - - if (err_code == NRFX_SUCCESS) { - ext_channels_allocated--; - } -} - -bool z_nrf_grtc_timer_compare_evt_check(int32_t chan) -{ - IS_CHANNEL_ALLOWED_ASSERT(chan); - - uint32_t event_address = nrfx_grtc_event_compare_address_get(chan); - - return *(volatile uint32_t *)event_address != 0; -} - -uint32_t z_nrf_grtc_timer_compare_evt_address_get(int32_t chan) -{ - IS_CHANNEL_ALLOWED_ASSERT(chan); - - return nrfx_grtc_event_compare_address_get(chan); -} - -uint32_t z_nrf_grtc_timer_capture_task_address_get(int32_t chan) -{ - IS_CHANNEL_ALLOWED_ASSERT(chan); - - return nrfx_grtc_capture_task_address_get(chan); -} - -uint64_t z_nrf_grtc_timer_read(void) -{ - return counter(); -} - -bool z_nrf_grtc_timer_compare_int_lock(int32_t chan) -{ - IS_CHANNEL_ALLOWED_ASSERT(chan); - - return compare_int_lock(chan); -} - -void z_nrf_grtc_timer_compare_int_unlock(int32_t chan, bool key) -{ - IS_CHANNEL_ALLOWED_ASSERT(chan); - - compare_int_unlock(chan, key); -} - -uint64_t z_nrf_grtc_timer_compare_read(int32_t chan) -{ - IS_CHANNEL_ALLOWED_ASSERT(chan); - - return get_comparator(chan); -} - -static int compare_set_nolocks(int32_t chan, uint64_t target_time, - z_nrf_grtc_timer_compare_handler_t handler, void *user_data) -{ - nrfx_err_t result; - - __ASSERT_NO_MSG(target_time < COUNTER_SPAN); - nrfx_grtc_channel_t user_channel_data = { - .handler = handler, - .p_context = user_data, - .channel = chan, - }; - result = nrfx_grtc_syscounter_cc_absolute_set(&user_channel_data, target_time, true); - if (result != NRFX_SUCCESS) { - return -EPERM; - } - return 0; -} - -static int compare_set(int32_t chan, uint64_t target_time, - z_nrf_grtc_timer_compare_handler_t handler, void *user_data) -{ - bool key = compare_int_lock(chan); - int ret = compare_set_nolocks(chan, target_time, handler, user_data); - - compare_int_unlock(chan, key); - - return ret; -} - -int z_nrf_grtc_timer_set(int32_t chan, uint64_t target_time, - z_nrf_grtc_timer_compare_handler_t handler, void *user_data) -{ - IS_CHANNEL_ALLOWED_ASSERT(chan); - - return compare_set(chan, target_time, (nrfx_grtc_cc_handler_t)handler, user_data); -} - -void z_nrf_grtc_timer_abort(int32_t chan) -{ - IS_CHANNEL_ALLOWED_ASSERT(chan); - - bool key = compare_int_lock(chan); - (void)nrfx_grtc_syscounter_cc_disable(chan); - compare_int_unlock(chan, key); -} - -uint64_t z_nrf_grtc_timer_get_ticks(k_timeout_t t) -{ - uint64_t curr_time; - int64_t curr_tick; - int64_t result; - int64_t abs_ticks; - - curr_time = counter(); - curr_tick = sys_clock_tick_get(); - - abs_ticks = Z_TICK_ABS(t.ticks); - if (abs_ticks < 0) { - /* relative timeout */ - return (t.ticks > (int64_t)COUNTER_SPAN) ? -EINVAL : (curr_time + t.ticks); - } - - /* absolute timeout */ - result = abs_ticks - curr_tick; - - if (result > (int64_t)COUNTER_SPAN) { - return -EINVAL; - } - - return curr_time + result; -} - -int z_nrf_grtc_timer_capture_prepare(int32_t chan) -{ - nrfx_grtc_channel_t user_channel_data = { - .handler = NULL, - .p_context = NULL, - .channel = chan, - }; - nrfx_err_t result; - - IS_CHANNEL_ALLOWED_ASSERT(chan); - - /* Set the CC value to mark channel as not triggered and also to enable it - * (makes CCEN=1). COUNTER_SPAN is used so as not to fire an event unnecessarily - * - it can be assumed that such a large value will never be reached. - */ - result = nrfx_grtc_syscounter_cc_absolute_set(&user_channel_data, COUNTER_SPAN, false); - - if (result != NRFX_SUCCESS) { - return -EPERM; - } - - return 0; -} - -int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) -{ - /* TODO: The implementation should probably go to nrfx_grtc and this - * should be just a wrapper for some nrfx_grtc_syscounter_capture_read. - */ - - uint64_t capt_time; - - IS_CHANNEL_ALLOWED_ASSERT(chan); - - /* TODO: Use `nrfy_grtc_sys_counter_enable_check` when available (NRFX-2480) */ - if (NRF_GRTC->CC[chan].CCEN == GRTC_CC_CCEN_ACTIVE_Enable) { - /* If the channel is enabled (.CCEN), it means that there was no capture - * triggering event. - */ - return -EBUSY; - } - - capt_time = nrfy_grtc_sys_counter_cc_get(NRF_GRTC, chan); - - __ASSERT_NO_MSG(capt_time < COUNTER_SPAN); - - *captured_time = capt_time; - - return 0; -} - -#if defined(CONFIG_NRF_GRTC_SLEEP_ALLOWED) -int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) -{ - nrfx_err_t err_code; - static uint8_t systemoff_channel; - uint64_t now = counter(); - /* Minimum time that ensures valid execution of system-off procedure. */ - uint32_t minimum_latency_us = nrfy_grtc_waketime_get(NRF_GRTC) + - nrfy_grtc_timeout_get(NRF_GRTC) + - CONFIG_NRF_GRTC_SLEEP_MINIMUM_LATENCY; - uint32_t chan; - int ret; - - if (minimum_latency_us > wake_time_us) { - return -EINVAL; - } - k_spinlock_key_t key = k_spin_lock(&lock); - - err_code = nrfx_grtc_channel_alloc(&systemoff_channel); - if (err_code != NRFX_SUCCESS) { - k_spin_unlock(&lock, key); - return -ENOMEM; - } - (void)nrfx_grtc_syscounter_cc_int_disable(systemoff_channel); - ret = compare_set(systemoff_channel, now + wake_time_us, NULL, NULL); - if (ret < 0) { - k_spin_unlock(&lock, key); - return ret; - } - - for (uint32_t grtc_chan_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; - grtc_chan_mask > 0; grtc_chan_mask &= ~BIT(chan)) { - /* Clear all GRTC channels except the systemoff_channel. */ - chan = u32_count_trailing_zeros(grtc_chan_mask); - if (chan != systemoff_channel) { - nrfx_grtc_syscounter_cc_disable(chan); - } - } - - /* Make sure that wake_time_us was not triggered yet. */ - if (nrfy_grtc_sys_counter_compare_event_check(NRF_GRTC, systemoff_channel)) { - k_spin_unlock(&lock, key); - return -EINVAL; - } - - /* This mechanism ensures that stored CC value is latched. */ - uint32_t wait_time = - 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 NRF_GRTC_HAS_CLKSEL - nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFXO); -#endif - k_spin_unlock(&lock, key); - return 0; -} -#endif /* CONFIG_NRF_GRTC_SLEEP_ALLOWED */ - -uint32_t sys_clock_cycle_get_32(void) -{ - k_spinlock_key_t key = k_spin_lock(&lock); - uint32_t ret = (uint32_t)counter(); - - k_spin_unlock(&lock, key); - return ret; -} - -uint64_t sys_clock_cycle_get_64(void) -{ - k_spinlock_key_t key = k_spin_lock(&lock); - uint64_t ret = counter(); - - k_spin_unlock(&lock, key); - return ret; -} - -uint32_t sys_clock_elapsed(void) -{ - if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { - return 0; - } - - return (uint32_t)(counter_sub(counter(), last_count) / CYC_PER_TICK); -} - -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. */ - nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFCLK); -#endif - -#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) - /* SYSCOUNTER needs to be turned off before initialization. */ - nrfy_grtc_sys_counter_set(NRF_GRTC, false); - nrfy_grtc_timeout_set(NRF_GRTC, TIMEOUT); - nrfy_grtc_waketime_set(NRF_GRTC, WAKETIME); -#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - - IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_grtc_irq_handler, 0, 0); - - err_code = nrfx_grtc_init(0); - if (err_code != NRFX_SUCCESS) { - return -EPERM; - } - -#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) - err_code = nrfx_grtc_syscounter_start(true, &system_clock_channel_data.channel); - if (err_code != NRFX_SUCCESS) { - return err_code == NRFX_ERROR_NO_MEM ? -ENOMEM : -EPERM; - } - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - nrfy_grtc_sys_counter_auto_mode_set(NRF_GRTC, false); - } -#else - err_code = nrfx_grtc_channel_alloc(&system_clock_channel_data.channel); - if (err_code != NRFX_SUCCESS) { - return -ENOMEM; - } -#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - - if (!IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - grtc_active_set(); - } - - int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; - if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { - system_timeout_set(CYC_PER_TICK); - } - - static const enum nrf_lfclk_start_mode mode = - IS_ENABLED(CONFIG_SYSTEM_CLOCK_NO_WAIT) - ? CLOCK_CONTROL_NRF_LF_START_NOWAIT - : (IS_ENABLED(CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY) - ? CLOCK_CONTROL_NRF_LF_START_AVAILABLE - : CLOCK_CONTROL_NRF_LF_START_STABLE); - - z_nrf_clock_control_lf_on(mode); - - return 0; -} - -void sys_clock_set_timeout(int32_t ticks, bool idle) -{ - ARG_UNUSED(idle); - uint64_t cyc, off, now; - - if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { - return; - } - - ticks = (ticks == K_TICKS_FOREVER) ? MAX_TICKS : MIN(MAX_TICKS, MAX(ticks - 1, 0)); - - now = counter(); - - /* Round up to the next tick boundary */ - off = (now - last_count) + (CYC_PER_TICK - 1); - off = (off / CYC_PER_TICK) * CYC_PER_TICK; - - /* Get the offset with respect to now */ - off -= (now - last_count); - - /* Add the offset to get to the next tick boundary */ - cyc = (uint64_t)ticks * CYC_PER_TICK + off; - - /* Due to elapsed time the calculation above might produce a - * duration that laps the counter. Don't let it. - */ - if (cyc > MAX_CYCLES) { - cyc = MAX_CYCLES; - } - - system_timeout_set(cyc == 0 ? 1 : cyc); -} - -#if defined(CONFIG_NRF_GRTC_TIMER_APP_DEFINED_INIT) -int nrf_grtc_timer_clock_driver_init(void) -{ - return sys_clock_driver_init(); -} -#else -SYS_INIT(sys_clock_driver_init, PRE_KERNEL_2, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY); -#endif diff --git a/include/zephyr/drivers/timer/nrf_grtc_timer.h b/include/zephyr/drivers/timer/nrf_grtc_timer.h deleted file mode 100644 index 172a904fdef..00000000000 --- a/include/zephyr/drivers/timer/nrf_grtc_timer.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_DRIVERS_TIMER_NRF_GRTC_TIMER_H -#define ZEPHYR_INCLUDE_DRIVERS_TIMER_NRF_GRTC_TIMER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @brief GRTC timer compare event handler. - * - * Called from GRTC ISR context when processing a compare event. - * - * @param id Compare channel ID. - * - * @param expire_time An actual absolute expiration time set for a compare - * channel. It can differ from the requested target time - * and the difference can be used to determine whether the - * time set was delayed. - * - * @param user_data Pointer to a user context data. - */ -typedef void (*z_nrf_grtc_timer_compare_handler_t)(int32_t id, uint64_t expire_time, - void *user_data); - -/** @brief Allocate GRTC capture/compare channel. - * - * @retval >=0 Non-negative indicates allocated channel ID. - * @retval -ENOMEM if channel cannot be allocated. - */ -int32_t z_nrf_grtc_timer_chan_alloc(void); - -/** @brief Free GRTC capture/compare channel. - * - * @param chan Previously allocated channel ID. - */ -void z_nrf_grtc_timer_chan_free(int32_t chan); - -/** @brief Read current absolute time. - * - * @return Current absolute time. - */ -uint64_t z_nrf_grtc_timer_read(void); - -/** @brief Check COMPARE event state. - * - * @param chan Channel ID. - * - * @retval true The event has been generated. - * @retval false The event has not been generated. - */ -bool z_nrf_grtc_timer_compare_evt_check(int32_t chan); - -/** @brief Get COMPARE event register address. - * - * Address can be used for DPPIC. - * - * @param chan Channel ID. - * - * @return Register address. - */ -uint32_t z_nrf_grtc_timer_compare_evt_address_get(int32_t chan); - -/** @brief Get CAPTURE task register address. - * - * Address can be used for DPPIC. - * - * @param chan Channel ID. - * - * @return Register address. - */ -uint32_t z_nrf_grtc_timer_capture_task_address_get(int32_t chan); - -/** @brief Safely disable compare event interrupt. - * - * Function returns key indicating whether interrupt was already disabled. - * - * @param chan Channel ID. - * - * @return key passed to z_nrf_grtc_timer_compare_int_unlock(). - */ -bool z_nrf_grtc_timer_compare_int_lock(int32_t chan); - -/** @brief Safely enable compare event interrupt. - * - * Event interrupt is conditionally enabled based on @p key. - * - * @param chan Channel ID. - * - * @param key Key returned by z_nrf_grtc_timer_compare_int_lock(). - */ -void z_nrf_grtc_timer_compare_int_unlock(int32_t chan, bool key); - -/** @brief Read compare register value. - * - * @param chan Channel ID. - * - * @retval >=0 Positive is a Value set in the compare register - * @retval -EAGAIN if compare for given channel is not set. - * @retval -EPERM if either channel is unavailable or SYSCOUNTER is not running. - */ -uint64_t z_nrf_grtc_timer_compare_read(int32_t chan); - -/** @brief Set compare channel to given value. - * - * @param chan Channel ID. - * - * @param target_time Absolute target time in ticks. - * - * @param handler User function called in the context of the GRTC interrupt. - * - * @param user_data Data passed to the handler. - * - * @retval 0 if the compare channel was set successfully. - * @retval -EPERM if either channel is unavailable or SYSCOUNTER is not running. - */ -int z_nrf_grtc_timer_set(int32_t chan, uint64_t target_time, - z_nrf_grtc_timer_compare_handler_t handler, void *user_data); - -/** @brief Abort a timer requested with z_nrf_grtc_timer_set(). - * - * If an abort operation is performed too late it is still possible for an event - * to fire. The user can detect a spurious event by comparing absolute time - * provided in callback and a result of z_nrf_grtc_timer_read(). During this - * operation interrupt from that compare channel is disabled. Other interrupts - * are not locked during this operation. - * - * @param chan Channel ID between 1 and CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT. - */ -void z_nrf_grtc_timer_abort(int32_t chan); - -/** @brief Convert system clock time to GRTC ticks. - * - * @p t can be absolute or relative. - * - * @retval >=0 Positive value represents @p t in GRTC tick value. - * @retval -EINVAL if @p t is out of range. - */ -uint64_t z_nrf_grtc_timer_get_ticks(k_timeout_t t); - -/** @brief Prepare channel for timestamp capture. - * - * Use z_nrf_grtc_timer_capture_task_address_get() to determine the register - * address that is used to trigger capture. - * - * @note Capture and compare are mutually exclusive features - they cannot be - * used simultaneously on the same GRTC channel. - * - * @param chan Channel ID. - * - * @retval 0 if the channel was successfully prepared. - * @retval -EPERM if either channel is unavailable or SYSCOUNTER is not running. - */ -int z_nrf_grtc_timer_capture_prepare(int32_t chan); - -/** @brief Read timestamp value captured on the channel. - * - * The @p chan must be prepared using z_nrf_grtc_timer_capture_prepare(). - * - * @param chan Channel ID. - * - * @param captured_time Pointer to store the value. - * - * @retval 0 if the timestamp was successfully caught and read. - * @retval -EBUSY if capturing has not been triggered. - */ -int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time); - -/** @brief Prepare GRTC as a source of wake up event and set the wake up time. - * - * @note Calling this function should be immediately followed by low-power mode enter - * (if it executed successfully). - * - * @param wake_time_us Relative wake up time in microseconds. - * - * @retval 0 if wake up time was successfully set. - * @retval -EPERM if the SYSCOUNTER is not running. - * @retval -ENOMEM if no available GRTC channels were found. - * @retval -EINVAL if @p wake_time_us is too low. - */ -int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us); - -/** - * @brief Initialize the GRTC clock timer driver from an application- - * defined function. - * - * @retval 0 on success. - * @retval -errno Negative error code on failure. - */ -int nrf_grtc_timer_clock_driver_init(void); - -#ifdef __cplusplus -} -#endif - -#endif /* ZEPHYR_INCLUDE_DRIVERS_TIMER_NRF_GRTC_TIMER_H */ From 3728f332ea73d19690110682eec4be489fee7978 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:41 +0100 Subject: [PATCH 1130/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: add support for nRF54L15 GRTC instance" This reverts commit b53542af11c5e7f97894b6f04b0571e41e23f0ce. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/Kconfig.defconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index 879217a92fe..c20df806186 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -16,12 +16,10 @@ config CLOCK_CONTROL endif # SYS_CLOCK_EXISTS config SYS_CLOCK_HW_CYCLES_PER_SEC - default 1000000 if NRF_GRTC_TIMER default 32768 config SYS_CLOCK_TICKS_PER_SEC default 128 if !TICKLESS_KERNEL - default 10000 if NRF_GRTC_TIMER default 32768 config ARCH_HAS_CUSTOM_BUSY_WAIT From 7718e646afaede979d41bbee1839abce65406e08 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:41 +0100 Subject: [PATCH 1131/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx: add nRF54L15 GRTC instance" This reverts commit 0e6ab260105aa75ee2c8a0d6f573b1e5daaa9485. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/CMakeLists.txt | 7 ------- modules/hal_nordic/nrfx/Kconfig | 4 ---- modules/hal_nordic/nrfx/Kconfig.logging | 4 ---- modules/hal_nordic/nrfx/nrfx_config.h | 7 ------- 4 files changed, 22 deletions(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 2e809c52b79..69afbcc9c51 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -31,8 +31,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUAPP NRF5340_XXAA_APP zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP NRF5340_XXAA_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUNET NRF5340_XXAA_NETWORK) zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET NRF5340_XXAA_NETWORK) -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_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) @@ -81,7 +79,6 @@ zephyr_library_sources_ifdef(CONFIG_NRFX_COMP ${SRC_DIR}/nrfx_comp.c) zephyr_library_sources_ifdef(CONFIG_NRFX_DPPI ${SRC_DIR}/nrfx_dppi.c) zephyr_library_sources_ifdef(CONFIG_NRFX_EGU ${SRC_DIR}/nrfx_egu.c) zephyr_library_sources_ifdef(CONFIG_NRFX_GPIOTE ${SRC_DIR}/nrfx_gpiote.c) -zephyr_library_sources_ifdef(CONFIG_NRFX_GRTC ${SRC_DIR}/nrfx_grtc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_I2S ${SRC_DIR}/nrfx_i2s.c) zephyr_library_sources_ifdef(CONFIG_NRFX_IPC ${SRC_DIR}/nrfx_ipc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_LPCOMP ${SRC_DIR}/nrfx_lpcomp.c) @@ -114,10 +111,6 @@ if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM) zephyr_library_sources(${SRC_DIR}/nrfx_twi_twim.c) endif() -if (CONFIG_NRF_GRTC_TIMER AND CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) - zephyr_library_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) -endif() - # Inject HAL "CONFIG_NFCT_PINS_AS_GPIOS" definition if user requests to # configure the NFCT pins as GPIOS. Do the same with "CONFIG_GPIO_AS_PINRESET" # to configure the reset GPIO as nRESET. This way, the HAL will take care of diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index bdca4016ee3..b4c00040ee1 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -103,10 +103,6 @@ config NRFX_GPIOTE_NUM_OF_EVT_HANDLERS Specifies number of handlers that can be registered to nrfx_gpiote driver by the user. -config NRFX_GRTC - bool "GRTC driver" - depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_GRTC)) - config NRFX_I2S bool diff --git a/modules/hal_nordic/nrfx/Kconfig.logging b/modules/hal_nordic/nrfx/Kconfig.logging index b24d683d3de..7f7b785e70c 100644 --- a/modules/hal_nordic/nrfx/Kconfig.logging +++ b/modules/hal_nordic/nrfx/Kconfig.logging @@ -28,10 +28,6 @@ config NRFX_GPIOTE_LOG bool "GPIOTE driver logging" depends on NRFX_GPIOTE -config NRFX_GRTC_LOG - bool "GRTC driver logging" - depends on NRFX_GRTC - config NRFX_I2S_LOG bool "I2S driver logging" depends on NRFX_I2S diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 451101c8f4b..ac930b13639 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -109,13 +109,6 @@ #define NRFX_EGU5_ENABLED 1 #endif -#ifdef CONFIG_NRFX_GRTC -#define NRFX_GRTC_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_GRTC_LOG -#define NRFX_GRTC_CONFIG_LOG_ENABLED 1 -#endif - #ifdef CONFIG_NRFX_GPIOTE #define NRFX_GPIOTE_ENABLED 1 #endif From 155ed76e9b477b1562227de9516a7edf2cd6e29a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:41 +0100 Subject: [PATCH 1132/2300] Revert "[nrf fromtree] dts: binding: add binding for GRTC" This reverts commit e66c7848b2e3363a5ef1c231417c60f41e0358cd. Signed-off-by: Robert Lubos --- dts/bindings/misc/nordic,split-channels.yaml | 44 -------------------- dts/bindings/timer/nordic,nrf-grtc.yaml | 25 ----------- 2 files changed, 69 deletions(-) delete mode 100644 dts/bindings/misc/nordic,split-channels.yaml delete mode 100644 dts/bindings/timer/nordic,nrf-grtc.yaml diff --git a/dts/bindings/misc/nordic,split-channels.yaml b/dts/bindings/misc/nordic,split-channels.yaml deleted file mode 100644 index a875dc12d7f..00000000000 --- a/dts/bindings/misc/nordic,split-channels.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -description: | - Nordic Split Channels - - Some of Nordic's peripherals support split ownership feature that allows to - be used by independent owners. As an example the configuration of the - Global Real Time Counter (GRTC) is shown below: - owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - child-owned-channels = <7 8 9 10 11>; - - Which means that channels 0-11 will be assigned to the particular CPU. - Other CPUs cannot use those and another set must be defined for them. - In addition, `child-owned-channels` property allows to use channels - 7-11 only by child subprocessor. If the CPU you're configuring has no - subprocessor(s) assigned, the `child-owned-channels` property - should not be defined. - -properties: - owned-channels: - type: array - description: | - List of channels in a split-ownership peripheral that are to be owned - for use by the compiled CPU. - - nonsecure-channels: - type: array - description: | - List of channels in a split-ownership, split-security peripheral that - are to be configured as nonsecure. In Trustzone systems, this property - is only evaluated for secure peripherals, as nonsecure channels are - implicitly specified through the owned-channels property. This property - is ignored in non-Trustzone systems. - - child-owned-channels: - type: array - description: | - List of channels in a split-ownership peripheral that are officially - owned by the compiled CPU but intended to be used by its child - subprocessor(s). diff --git a/dts/bindings/timer/nordic,nrf-grtc.yaml b/dts/bindings/timer/nordic,nrf-grtc.yaml deleted file mode 100644 index e78e57df97e..00000000000 --- a/dts/bindings/timer/nordic,nrf-grtc.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -description: Nordic GRTC (Global RTC) - -compatible: "nordic,nrf-grtc" - -include: - - "base.yaml" - - "nordic,split-channels.yaml" - -properties: - reg: - required: true - - interrupts: - required: true - - cc-num: - description: Number of capture/compare channels - type: int - required: true From ff1f229e1c2928502c718299b3cee66d9eac3971 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:42 +0100 Subject: [PATCH 1133/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: move NRF_RTC_TIMER not to be selected as default" This reverts commit 063b8a11583a917bddfe1170061428ca48a20820. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/Kconfig.defconfig | 5 ++++- soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series | 4 ---- soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series | 4 ---- soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series | 4 ---- soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series | 4 ---- 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index c20df806186..858c60d1d88 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -7,12 +7,15 @@ if SOC_FAMILY_NRF source "soc/arm/nordic_nrf/*/Kconfig.defconfig.series" -# If the kernel has timer support, enable clock control +# If the kernel has timer support, enable both clock control and timer if SYS_CLOCK_EXISTS config CLOCK_CONTROL default y +config NRF_RTC_TIMER + default y + endif # SYS_CLOCK_EXISTS config SYS_CLOCK_HW_CYCLES_PER_SEC diff --git a/soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series index a4053bf7fed..8c0bc74c02f 100644 --- a/soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series +++ b/soc/arm/nordic_nrf/nrf51/Kconfig.defconfig.series @@ -14,8 +14,4 @@ config SOC_SERIES config NUM_IRQS default 26 -# If the kernel has timer support, enable the timer -config NRF_RTC_TIMER - default y if SYS_CLOCK_EXISTS - endif # SOC_SERIES_NRF51X diff --git a/soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series index 2e89a5130a6..4a7edf2aa95 100644 --- a/soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series +++ b/soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.series @@ -10,8 +10,4 @@ source "soc/arm/nordic_nrf/nrf52/Kconfig.defconfig.nrf52*" config SOC_SERIES default "nrf52" -# If the kernel has timer support, enable the timer -config NRF_RTC_TIMER - default y if SYS_CLOCK_EXISTS - endif # SOC_SERIES_NRF52X diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series index 7e5660cf514..2857d5dd25d 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.series @@ -10,8 +10,4 @@ source "soc/arm/nordic_nrf/nrf53/Kconfig.defconfig.nrf53*" config SOC_SERIES default "nrf53" -# If the kernel has timer support, enable the timer -config NRF_RTC_TIMER - default y if SYS_CLOCK_EXISTS - endif # SOC_SERIES_NRF53X diff --git a/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series b/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series index 6d6cccab999..9612555a4c8 100644 --- a/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series +++ b/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series @@ -10,8 +10,4 @@ source "soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf91*" config SOC_SERIES default "nrf91" -# If the kernel has timer support, enable the timer -config NRF_RTC_TIMER - default y if SYS_CLOCK_EXISTS - endif # SOC_SERIES_NRF91X From 64415e5b8da59e4ac0e0ed535c82c4db71b9991c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:42 +0100 Subject: [PATCH 1134/2300] Revert "[nrf fromtree] drivers: timer: move SYSTEM_CLOCK_WAIT to Kconfig.nrf_xrtc" This reverts commit eaac5216f64fe7f14dbea98d7e7d34e4855ef7e1. Signed-off-by: Robert Lubos --- drivers/timer/Kconfig | 1 - drivers/timer/Kconfig.nrf_rtc | 32 ++++++++++++++++++++++++++++ drivers/timer/Kconfig.nrf_xrtc | 38 ---------------------------------- 3 files changed, 32 insertions(+), 39 deletions(-) delete mode 100644 drivers/timer/Kconfig.nrf_xrtc diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index b7e01eb5811..8a88e731986 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -84,7 +84,6 @@ source "drivers/timer/Kconfig.mips_cp0" source "drivers/timer/Kconfig.native_posix" source "drivers/timer/Kconfig.npcx_itim" source "drivers/timer/Kconfig.nrf_rtc" -source "drivers/timer/Kconfig.nrf_xrtc" source "drivers/timer/Kconfig.rcar_cmt" source "drivers/timer/Kconfig.riscv_machine" source "drivers/timer/Kconfig.rv32m1_lptmr" diff --git a/drivers/timer/Kconfig.nrf_rtc b/drivers/timer/Kconfig.nrf_rtc index 729dc8d362a..baa917282bc 100644 --- a/drivers/timer/Kconfig.nrf_rtc +++ b/drivers/timer/Kconfig.nrf_rtc @@ -42,4 +42,36 @@ config NRF_RTC_TIMER_TRIGGER_OVERFLOW When enabled, a function can be used to trigger RTC overflow and effectively shift time into the future. +choice + prompt "Clock startup policy" + default SYSTEM_CLOCK_WAIT_FOR_STABILITY + +config SYSTEM_CLOCK_NO_WAIT + bool "No wait" + help + System clock source is initiated but does not wait for clock readiness. + When this option is picked, system clock may not be ready when code relying + on kernel API is executed. Requested timeouts will be prolonged by the + remaining startup time. + +config SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY + bool "Wait for availability" + help + System clock source initialization waits until clock is available. In some + systems, clock initially runs from less accurate source which has faster + startup time and then seamlessly switches to the target clock source when + it is ready. When this option is picked, system clock is available after + system clock driver initialization but it may be less accurate. Option is + equivalent to waiting for stability if clock source does not have + intermediate state. + +config SYSTEM_CLOCK_WAIT_FOR_STABILITY + bool "Wait for stability" + help + System clock source initialization waits until clock is stable. When this + option is picked, system clock is available and stable after system clock + driver initialization. + +endchoice + endif # NRF_RTC_TIMER diff --git a/drivers/timer/Kconfig.nrf_xrtc b/drivers/timer/Kconfig.nrf_xrtc deleted file mode 100644 index 56efbc3a298..00000000000 --- a/drivers/timer/Kconfig.nrf_xrtc +++ /dev/null @@ -1,38 +0,0 @@ -# Common RTC configuration - -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if NRF_RTC_TIMER -choice - prompt "Clock startup policy" - default SYSTEM_CLOCK_WAIT_FOR_STABILITY - -config SYSTEM_CLOCK_NO_WAIT - bool "No wait" - help - System clock source is initiated but does not wait for clock readiness. - When this option is picked, system clock may not be ready when code relying - on kernel API is executed. Requested timeouts will be prolonged by the - remaining startup time. - -config SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY - bool "Wait for availability" - help - System clock source initialization waits until clock is available. In some - systems, clock initially runs from less accurate source which has faster - startup time and then seamlessly switches to the target clock source when - it is ready. When this option is picked, system clock is available after - system clock driver initialization but it may be less accurate. Option is - equivalent to waiting for stability if clock source does not have - intermediate state. - -config SYSTEM_CLOCK_WAIT_FOR_STABILITY - bool "Wait for stability" - help - System clock source initialization waits until clock is stable. When this - option is picked, system clock is available and stable after system clock - driver initialization. - -endchoice -endif # NRF_RTC_TIMER From fd85db8da66550b0d7146848bf92d86c8e6179ee Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:42 +0100 Subject: [PATCH 1135/2300] Revert "[nrf fromtree] drivers: serial: align to nRF54L15" This reverts commit ce1761d97282e30d93430324f10075e6273fe524. Signed-off-by: Robert Lubos --- drivers/serial/Kconfig.nrfx | 27 ----------------------- drivers/serial/Kconfig.nrfx_uart_instance | 1 - 2 files changed, 28 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 8995b6b9fbf..21a657fbaf4 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 - # NRF54L15 need new UARTE driver - depends on !SOC_SERIES_NRF54LX # New shim takes more ROM. Until it is fixed use legacy shim. default y @@ -66,31 +64,6 @@ nrfx_uart_num = 3 rsource "Kconfig.nrfx_uart_instance" endif -if HAS_HW_NRF_UARTE00 -nrfx_uart_num = 00 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE20 -nrfx_uart_num = 20 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE21 -nrfx_uart_num = 21 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE22 -nrfx_uart_num = 22 -rsource "Kconfig.nrfx_uart_instance" -endif - -if HAS_HW_NRF_UARTE30 -nrfx_uart_num = 30 -rsource "Kconfig.nrfx_uart_instance" -endif - config NRFX_TIMER0 default y depends on UART_0_NRF_HW_ASYNC_TIMER = 0 \ diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index 718631a4d09..76f74caa038 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -20,7 +20,6 @@ config UART_$(nrfx_uart_num)_ASYNC config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT bool "Efficient poll out on port $(nrfx_uart_num)" - depends on !SOC_SERIES_NRF54LX default y depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) select NRFX_PPI if HAS_HW_NRF_PPI From 266b5cdf331dae3412cae50caeb73583eb13754a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:42 +0100 Subject: [PATCH 1136/2300] Revert "[nrf fromtree] drivers: serial: nrfx_uarte: Use legacy shim by default" This reverts commit f84e3a8375361c8186131e8ecebee67458c6eafa. Signed-off-by: Robert Lubos --- drivers/serial/Kconfig.nrfx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 21a657fbaf4..5709ca2d23a 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -31,8 +31,9 @@ config UART_NRFX_UARTE config UART_NRFX_UARTE_LEGACY_SHIM bool "Legacy UARTE shim" depends on UART_NRFX_UARTE - # New shim takes more ROM. Until it is fixed use legacy shim. - default y + # New shim takes more ROM. Until it is fixed use legacy shim in memory + # constraint case. + default y if MCUBOOT config UART_ASYNC_TX_CACHE_SIZE int "TX cache buffer size" From 1314a49ed02dceea6859b1afcd75cc66f53ae5a1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:42 +0100 Subject: [PATCH 1137/2300] Revert "[nrf fromtree] boards: posix: nrf_bsim: Use legacy UART shim" This reverts commit 50163d00c2c15ec0a0a27f82fd5f205cd1f7f6be. Signed-off-by: Robert Lubos --- boards/posix/nrf_bsim/Kconfig.defconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/boards/posix/nrf_bsim/Kconfig.defconfig b/boards/posix/nrf_bsim/Kconfig.defconfig index 0ee4c6ee2c1..6993048248c 100644 --- a/boards/posix/nrf_bsim/Kconfig.defconfig +++ b/boards/posix/nrf_bsim/Kconfig.defconfig @@ -93,7 +93,4 @@ config UART_CONSOLE endif # CONSOLE -config UART_NRFX_UARTE_LEGACY_SHIM - default y - endif # SOC_SERIES_BSIM_NRFXX From 4b8a600b93d7aed717e2f3c31de740979a5d1b1f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:42 +0100 Subject: [PATCH 1138/2300] Revert "[nrf fromtree] tests: drivers: uart: uart_pm: Use legacy nrf driver" This reverts commit 73c93a7bc212fb516d9afaa275e4de944eaf109e. Signed-off-by: Robert Lubos --- tests/drivers/uart/uart_pm/testcase.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 4d71ed881cd..efb76ecf2c1 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -13,14 +13,12 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=n - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.no_rxpin: extra_configs: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=n - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" drivers.uart.pm.enhanced_poll: @@ -28,7 +26,6 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.int_driven: extra_configs: @@ -36,7 +33,6 @@ tests: - CONFIG_UART_0_INTERRUPT_DRIVEN=y - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=n - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.int_driven.enhanced_poll: extra_configs: @@ -44,7 +40,6 @@ tests: - CONFIG_UART_0_INTERRUPT_DRIVEN=y - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.async: extra_configs: @@ -55,7 +50,6 @@ tests: - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.pm.async.enhanced_poll: extra_configs: @@ -66,4 +60,3 @@ tests: - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y From 4342972d9c8c444ba15a46928f83970812c68b7e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:43 +0100 Subject: [PATCH 1139/2300] Revert "[nrf fromtree] tests: drivers: uart: async_api: Add configuration for legacy nrf driver" This reverts commit 6e8622909e117c96432c691251027d614189e152. Signed-off-by: Robert Lubos --- tests/drivers/uart/uart_async_api/testcase.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/testcase.yaml b/tests/drivers/uart/uart_async_api/testcase.yaml index 3c5f2d5583e..e9914d48d99 100644 --- a/tests/drivers/uart/uart_async_api/testcase.yaml +++ b/tests/drivers/uart/uart_async_api/testcase.yaml @@ -13,7 +13,6 @@ tests: harness_config: fixture: gpio_loopback depends_on: gpio - tags: bsim_skip_CI drivers.uart.wide: filter: CONFIG_UART_CONSOLE and CONFIG_SERIAL_SUPPORT_ASYNC and not CONFIG_UART_MCUX_LPUART harness: ztest @@ -26,15 +25,6 @@ tests: platform_allow: nucleo_h743zi integration_platforms: - nucleo_h743zi - drivers.uart.async_api.nrf_uarte_legacy: - platform_allow: nrf52840dk_nrf52840 nrf52_bsim - filter: CONFIG_SERIAL_SUPPORT_ASYNC - harness: ztest - harness_config: - fixture: gpio_loopback - depends_on: gpio - extra_configs: - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y drivers.uart.async_api.nrf_uart: filter: CONFIG_UART_CONSOLE and CONFIG_SERIAL_SUPPORT_ASYNC harness: ztest From aa58b24bda5469e4c9a6de2c3c0e5f21b5c24acc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:43 +0100 Subject: [PATCH 1140/2300] Revert "[nrf fromtree] tests: drivers: uart: uart_mix_fifo_poll: Align the the new nrfx driver" This reverts commit 8dce4e1e13e41d6b79698002c7cc03fff4c5006c. Signed-off-by: Robert Lubos --- .../uart/uart_mix_fifo_poll/testcase.yaml | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index c2196c1058d..65848e6603e 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -18,22 +18,22 @@ tests: - CONFIG_UART_INTERRUPT_DRIVEN=n - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=n - tags: bsim_skip_CI drivers.uart.uart_mix_poll_fifo: extra_configs: - CONFIG_UART_INTERRUPT_DRIVEN=y - CONFIG_UART_0_INTERRUPT_DRIVEN=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n - tags: bsim_skip_CI drivers.uart.uart_mix_poll_async_api: extra_configs: - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 + - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n - tags: bsim_skip_CI drivers.uart.uart_mix_poll_async_api_const: extra_args: TEST_CONST_BUFFER=1 @@ -41,9 +41,22 @@ tests: - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 + - CONFIG_NRFX_TIMER2=y + - CONFIG_UART_0_ENHANCED_POLL_OUT=n + - CONFIG_UART_ASYNC_TX_CACHE_SIZE=2 + + drivers.uart.uart_mix_poll_async_api_low_power: + extra_configs: + - CONFIG_UART_ASYNC_API=y + - CONFIG_UART_0_INTERRUPT_DRIVEN=n + - CONFIG_UART_0_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC=y + - CONFIG_UART_0_NRF_ASYNC_LOW_POWER=y + - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 + - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=n - - CONFIG_UART_0_TX_CACHE_SIZE=2 - tags: bsim_skip_CI # We skip a few tests to save CI time, as they give little extra coverage drivers.uart.uart_mix_poll_with_ppi: extra_configs: @@ -62,29 +75,18 @@ tests: - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC=y + - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 + - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y - drivers.uart.legacy.uart_mix_poll: - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=n - - CONFIG_UART_ASYNC_API=n - - CONFIG_UART_0_ENHANCED_POLL_OUT=n - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y - - drivers.uart.legacy.uart_mix_poll_fifo: - extra_configs: - - CONFIG_UART_INTERRUPT_DRIVEN=y - - CONFIG_UART_0_INTERRUPT_DRIVEN=y - - CONFIG_UART_0_ENHANCED_POLL_OUT=n - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y - - drivers.uart.legacy.uart_mix_poll_async_api: + drivers.uart.uart_mix_poll_async_api_with_ppi_low_power: extra_configs: - CONFIG_UART_ASYNC_API=y - CONFIG_UART_0_INTERRUPT_DRIVEN=n - CONFIG_UART_0_ASYNC=y - - CONFIG_UART_0_ENHANCED_POLL_OUT=n - CONFIG_UART_0_NRF_HW_ASYNC=y + - CONFIG_UART_0_NRF_ASYNC_LOW_POWER=y - CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - CONFIG_NRFX_TIMER2=y - - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y + - CONFIG_UART_0_ENHANCED_POLL_OUT=y From 9cbe75ace829b70d066553e144d82117f3c0a6bb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:43 +0100 Subject: [PATCH 1141/2300] Revert "[nrf fromtree] drivers: serial: nrfx: Add new shim based on nrfx_uarte" This reverts commit 001323e059c1ace212cc6ae42dd627b381759e4d. Signed-off-by: Robert Lubos --- drivers/serial/CMakeLists.txt | 8 +- drivers/serial/Kconfig.nrfx | 11 +- drivers/serial/Kconfig.nrfx_uart_instance | 45 +- drivers/serial/uart_nrfx_uarte2.c | 1030 --------------------- 4 files changed, 3 insertions(+), 1091 deletions(-) delete mode 100644 drivers/serial/uart_nrfx_uarte2.c diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt index 67e02e0c261..2cd79e12f64 100644 --- a/drivers/serial/CMakeLists.txt +++ b/drivers/serial/CMakeLists.txt @@ -26,13 +26,7 @@ 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_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_NRFX_UARTE uart_nrfx_uarte.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) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 5709ca2d23a..53553e3d06e 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -25,20 +25,11 @@ config UART_NRFX_UART config UART_NRFX_UARTE def_bool y depends on DT_HAS_NORDIC_NRF_UARTE_ENABLED - imply NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM - imply NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM - -config UART_NRFX_UARTE_LEGACY_SHIM - bool "Legacy UARTE shim" - depends on UART_NRFX_UARTE - # New shim takes more ROM. Until it is fixed use legacy shim in memory - # constraint case. - default y if MCUBOOT config UART_ASYNC_TX_CACHE_SIZE int "TX cache buffer size" depends on UART_ASYNC_API - depends on UART_NRFX_UARTE_LEGACY_SHIM + depends on UART_NRFX_UARTE default 8 help For UARTE, TX cache buffer is used when provided TX buffer is not located diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index 76f74caa038..39e774e2544 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -6,7 +6,6 @@ config UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN bool "Interrupt support on port $(nrfx_uart_num)" depends on UART_INTERRUPT_DRIVEN - select UART_ASYNC_TO_INT_DRIVEN_API if !UART_NRFX_UARTE_LEGACY_SHIM default y help This option enables UART interrupt support on port $(nrfx_uart_num). @@ -28,9 +27,6 @@ config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT When enabled, polling out does not trigger interrupt which stops TX. Feature uses a PPI channel. -config NRFX_UARTE$(nrfx_uart_num) - def_bool y if HAS_HW_NRF_UARTE$(nrfx_uart_num) && !UART_NRFX_UARTE_LEGACY_SHIM - config UART_$(nrfx_uart_num)_NRF_PARITY_BIT bool "Parity bit" help @@ -38,8 +34,7 @@ config UART_$(nrfx_uart_num)_NRF_PARITY_BIT config UART_$(nrfx_uart_num)_NRF_TX_BUFFER_SIZE int "Size of RAM buffer" - depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) - depends on UART_NRFX_UARTE_LEGACY_SHIM + depends on UART_INTERRUPT_DRIVEN range 1 65535 default 32 help @@ -51,7 +46,6 @@ config UART_$(nrfx_uart_num)_NRF_HW_ASYNC bool "Use hardware RX byte counting" depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) depends on UART_ASYNC_API - depends on UART_NRFX_UARTE_LEGACY_SHIM select NRFX_PPI if HAS_HW_NRF_PPI select NRFX_DPPI if HAS_HW_NRF_DPPIC help @@ -64,7 +58,6 @@ config UART_$(nrfx_uart_num)_NRF_ASYNC_LOW_POWER bool "Low power mode" depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) depends on UART_ASYNC_API - depends on UART_NRFX_UARTE_LEGACY_SHIM 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 @@ -74,42 +67,6 @@ config UART_$(nrfx_uart_num)_NRF_HW_ASYNC_TIMER int "Timer instance" depends on UART_$(nrfx_uart_num)_NRF_HW_ASYNC -config UART_$(nrfx_uart_num)_TX_CACHE_SIZE - int "TX cache buffer size" - depends on !UART_NRFX_UARTE_LEGACY_SHIM - default 8 - help - For UARTE, TX cache buffer is used when provided TX buffer is not located - in memory which can be used by the EasyDMA. - -config UART_$(nrfx_uart_num)_RX_CACHE_SIZE - int "RX cache buffer size" - depends on !UART_NRFX_UARTE_LEGACY_SHIM - default 32 if $(dt_nodelabel_has_compat,ram3x,$(DT_COMPAT_MMIO_SRAM)) - default 5 - range 5 255 - help - For UARTE, RX cache buffer is used when provided RX buffer is not located - in memory which can be used by the EasyDMA. It is also used to store - flushed data. - -config UART_$(nrfx_uart_num)_A2I_RX_SIZE - depends on !UART_NRFX_UARTE_LEGACY_SHIM - int "Asynchronous to interrupt driven adaptation layer RX buffer size" - default 64 if UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN - default 0 - help - Amount of space dedicated for RX. It is divided into chunks with some - amount of that space used for control data. - -config UART_$(nrfx_uart_num)_A2I_RX_BUF_COUNT - depends on !UART_NRFX_UARTE_LEGACY_SHIM - int "Asynchronous to interrupt driven adaptation layer RX buffer count" - default 8 if UART_$(nrfx_uart_num)_INTERRUPT_DRIVEN - default 0 - help - Number of chunks into RX space is divided. - config UART_$(nrfx_uart_num)_GPIO_MANAGEMENT bool "GPIO management on port $(nrfx_uart_num)" depends on PM_DEVICE diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c deleted file mode 100644 index c27f33c7284..00000000000 --- a/drivers/serial/uart_nrfx_uarte2.c +++ /dev/null @@ -1,1030 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @brief Driver for Nordic Semiconductor nRF UARTE - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define LOG_MODULE_NAME uarte -LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_UART_LOG_LEVEL); - -#define INSTANCE_INT_DRIVEN(periph, prefix, i, _) \ - IS_ENABLED(CONFIG_UART_##prefix##i##_INTERRUPT_DRIVEN) - -#define INSTANCE_ASYNC(periph, prefix, i, _) \ - IS_ENABLED(CONFIG_UART_##prefix##i##_ASYNC) - -#define INSTANCE_POLLING(periph, prefix, id, _) \ - UTIL_AND(CONFIG_HAS_HW_NRF_UARTE##prefix##id, \ - UTIL_AND(COND_CODE_1(CONFIG_UART_##prefix##id##_INTERRUPT_DRIVEN, (0), (1)), \ - COND_CODE_1(CONFIG_UART_##prefix##id##_ASYNC, (0), (1)))) - -#define INSTANCE_ENHANCED_POLL_OUT(periph, prefix, i, _) \ - IS_ENABLED(CONFIG_UART_##prefix##i##_ENHANCED_POLL_OUT) - -/* Macro determining if any instance is using interrupt driven API. */ -#if (NRFX_FOREACH_ENABLED(UARTE, INSTANCE_INT_DRIVEN, (+), (0), _)) -#define UARTE_ANY_INTERRUPT_DRIVEN 1 -#else -#define UARTE_ANY_INTERRUPT_DRIVEN 0 -#endif - -/* Macro determining if any instance is enabled and using ASYNC API. */ -#if (NRFX_FOREACH_ENABLED(UARTE, INSTANCE_ASYNC, (+), (0), _)) -#define UARTE_ANY_ASYNC 1 -#else -#define UARTE_ANY_ASYNC 0 -#endif - -/* Macro determining if any instance is using only polling API. */ -#if (NRFX_FOREACH_ENABLED(UARTE, INSTANCE_POLLING, (+), (0), _)) -#define UARTE_ANY_POLLING 1 -#else -#define UARTE_ANY_POLLING 0 -#endif - -/* Macro determining if any instance is using interrupt driven API. */ -#if (NRFX_FOREACH_ENABLED(UARTE, INSTANCE_ENHANCED_POLL_OUT, (+), (0), _)) -#define UARTE_ENHANCED_POLL_OUT 1 -#else -#define UARTE_ENHANCED_POLL_OUT 0 -#endif - -#if UARTE_ANY_INTERRUPT_DRIVEN || UARTE_ANY_ASYNC -#define UARTE_INT_ASYNC 1 -#else -#define UARTE_INT_ASYNC 0 -#endif - -#if defined(UARTE_CONFIG_PARITYTYPE_Msk) -#define UARTE_ODD_PARITY_ALLOWED 1 -#else -#define UARTE_ODD_PARITY_ALLOWED 0 -#endif - -/* - * RX timeout is divided into time slabs, this define tells how many divisions - * should be made. More divisions - higher timeout accuracy and processor usage. - */ -#define RX_TIMEOUT_DIV 5 - -/* Macro for converting numerical baudrate to register value. It is convenient - * to use this approach because for constant input it can calculate nrf setting - * at compile time. - */ -#define NRF_BAUDRATE(baudrate) ((baudrate) == 300 ? 0x00014000 :\ - (baudrate) == 600 ? 0x00027000 : \ - (baudrate) == 1200 ? NRF_UARTE_BAUDRATE_1200 : \ - (baudrate) == 2400 ? NRF_UARTE_BAUDRATE_2400 : \ - (baudrate) == 4800 ? NRF_UARTE_BAUDRATE_4800 : \ - (baudrate) == 9600 ? NRF_UARTE_BAUDRATE_9600 : \ - (baudrate) == 14400 ? NRF_UARTE_BAUDRATE_14400 : \ - (baudrate) == 19200 ? NRF_UARTE_BAUDRATE_19200 : \ - (baudrate) == 28800 ? NRF_UARTE_BAUDRATE_28800 : \ - (baudrate) == 31250 ? NRF_UARTE_BAUDRATE_31250 : \ - (baudrate) == 38400 ? NRF_UARTE_BAUDRATE_38400 : \ - (baudrate) == 56000 ? NRF_UARTE_BAUDRATE_56000 : \ - (baudrate) == 57600 ? NRF_UARTE_BAUDRATE_57600 : \ - (baudrate) == 76800 ? NRF_UARTE_BAUDRATE_76800 : \ - (baudrate) == 115200 ? NRF_UARTE_BAUDRATE_115200 : \ - (baudrate) == 230400 ? NRF_UARTE_BAUDRATE_230400 : \ - (baudrate) == 250000 ? NRF_UARTE_BAUDRATE_250000 : \ - (baudrate) == 460800 ? NRF_UARTE_BAUDRATE_460800 : \ - (baudrate) == 921600 ? NRF_UARTE_BAUDRATE_921600 : \ - (baudrate) == 1000000 ? NRF_UARTE_BAUDRATE_1000000 : 0) - -#define UARTE_DATA_FLAG_TRAMPOLINE BIT(0) -#define UARTE_DATA_FLAG_RX_ENABLED BIT(1) - -struct uarte_async_data { - uart_callback_t user_callback; - void *user_data; - - struct k_timer tx_timer; - struct k_timer rx_timer; - - k_timeout_t rx_timeout; - - /* Keeps the most recent error mask. */ - uint32_t err; - - uint8_t idle_cnt; -}; - -/* Device data structure */ -struct uarte_nrfx_data { - struct uart_async_to_irq_data *a2i_data; -#if CONFIG_UART_USE_RUNTIME_CONFIGURE - struct uart_config uart_config; -#endif - struct uarte_async_data *async; - atomic_t flags; - uint8_t rx_byte; -}; -BUILD_ASSERT(offsetof(struct uarte_nrfx_data, a2i_data) == 0); - -/* If set then pins are managed when going to low power mode. */ -#define UARTE_CFG_FLAG_GPIO_MGMT BIT(0) - -/* If set then receiver is not used. */ -#define UARTE_CFG_FLAG_NO_RX BIT(1) - -/* If set then instance is using interrupt driven API. */ -#define UARTE_CFG_FLAG_INTERRUPT_DRIVEN_API BIT(2) - -/** - * @brief Structure for UARTE configuration. - */ -struct uarte_nrfx_config { - const struct uart_async_to_irq_config *a2i_config; - nrfx_uarte_t nrfx_dev; - nrfx_uarte_config_t nrfx_config; - const struct pinctrl_dev_config *pcfg; - uint32_t flags; - - LOG_INSTANCE_PTR_DECLARE(log); -}; -BUILD_ASSERT(offsetof(struct uarte_nrfx_config, a2i_config) == 0); - -#define UARTE_ERROR_FROM_MASK(mask) \ - ((mask) & NRF_UARTE_ERROR_OVERRUN_MASK ? UART_ERROR_OVERRUN \ - : (mask) & NRF_UARTE_ERROR_PARITY_MASK ? UART_ERROR_PARITY \ - : (mask) & NRF_UARTE_ERROR_FRAMING_MASK ? UART_ERROR_FRAMING \ - : (mask) & NRF_UARTE_ERROR_BREAK_MASK ? UART_BREAK \ - : 0) - -/* Determine if the device has interrupt driven API enabled. */ -#define IS_INT_DRIVEN_API(dev) \ - (UARTE_ANY_INTERRUPT_DRIVEN && \ - (((const struct uarte_nrfx_config *)dev->config)->flags & \ - UARTE_CFG_FLAG_INTERRUPT_DRIVEN_API)) - -/* Determine if the device supports only polling API. */ -#define IS_POLLING_API(dev) \ - (!UARTE_INT_ASYNC || (((struct uarte_nrfx_data *)dev->data)->async == NULL)) - -/* Determine if the device supports asynchronous API. */ -#define IS_ASYNC_API(dev) (!IS_INT_DRIVEN_API(dev) && !IS_POLLING_API(dev)) - -static inline const nrfx_uarte_t *get_nrfx_dev(const struct device *dev) -{ - const struct uarte_nrfx_config *config = dev->config; - - return &config->nrfx_dev; -} - -static int callback_set(const struct device *dev, uart_callback_t callback, void *user_data) -{ - struct uarte_nrfx_data *data = dev->data; - - data->async->user_callback = callback; - data->async->user_data = user_data; - - return 0; -} - -#if UARTE_ANY_ASYNC -static int api_callback_set(const struct device *dev, uart_callback_t callback, void *user_data) -{ - if (!IS_ASYNC_API(dev)) { - return -ENOTSUP; - } - - return callback_set(dev, callback, user_data); -} -#endif - -static void on_tx_done(const struct device *dev, const nrfx_uarte_event_t *event) -{ - struct uarte_nrfx_data *data = dev->data; - struct uart_event evt = { - .type = (event->data.tx.flags & NRFX_UARTE_TX_DONE_ABORTED) ? - UART_TX_ABORTED : UART_TX_DONE, - .data.tx.buf = event->data.tx.p_buffer, - .data.tx.len = event->data.tx.length - }; - bool hwfc; - -#if CONFIG_UART_USE_RUNTIME_CONFIGURE - hwfc = data->uart_config.flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS; -#else - const struct uarte_nrfx_config *config = dev->config; - - hwfc = config->nrfx_config.config.hwfc == NRF_UARTE_HWFC_ENABLED; -#endif - - if (hwfc) { - k_timer_stop(&data->async->tx_timer); - } - data->async->user_callback(dev, &evt, data->async->user_data); -} - -static void on_rx_done(const struct device *dev, const nrfx_uarte_event_t *event) -{ - struct uarte_nrfx_data *data = dev->data; - struct uart_event evt; - - if (event->data.rx.length) { - if (data->async->err) { - evt.type = UART_RX_STOPPED; - evt.data.rx_stop.reason = UARTE_ERROR_FROM_MASK(data->async->err); - evt.data.rx_stop.data.buf = event->data.rx.p_buffer; - evt.data.rx_stop.data.len = event->data.rx.length; - /* Keep error code for uart_err_check(). */ - if (!IS_INT_DRIVEN_API(dev)) { - data->async->err = 0; - } - } else { - evt.type = UART_RX_RDY, - evt.data.rx.buf = event->data.rx.p_buffer, - evt.data.rx.len = event->data.rx.length, - evt.data.rx.offset = 0; - } - data->async->user_callback(dev, &evt, data->async->user_data); - } - - evt.type = UART_RX_BUF_RELEASED; - evt.data.rx_buf.buf = event->data.rx.p_buffer; - - data->async->user_callback(dev, &evt, data->async->user_data); -} - -static void start_rx_timer(struct uarte_nrfx_data *data) -{ - struct uarte_async_data *adata = data->async; - - k_timer_start(&adata->rx_timer, adata->rx_timeout, K_NO_WAIT); -} - -static void on_rx_byte(const struct device *dev) -{ - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_data *adata = data->async; - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - - nrfx_uarte_rxdrdy_disable(nrfx_dev); - adata->idle_cnt = RX_TIMEOUT_DIV; - start_rx_timer(data); -} - -static void on_rx_buf_req(const struct device *dev) -{ - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_data *adata = data->async; - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - - struct uart_event evt = { - .type = UART_RX_BUF_REQUEST - }; - - /* If counter reached zero that indicates that timeout was reached and - * reception of one buffer was terminated to restart another transfer. - */ - if (!K_TIMEOUT_EQ(adata->rx_timeout, K_NO_WAIT)) { - /* Read and clear any pending new data information. */ - nrfx_uarte_rx_new_data_check(nrfx_dev); - nrfx_uarte_rxdrdy_enable(nrfx_dev); - } - data->async->user_callback(dev, &evt, data->async->user_data); -} - -static void on_rx_disabled(const struct device *dev, struct uarte_nrfx_data *data) -{ - struct uart_event evt = { - .type = UART_RX_DISABLED - }; - - atomic_and(&data->flags, ~UARTE_DATA_FLAG_RX_ENABLED); - k_timer_stop(&data->async->rx_timer); - - data->async->user_callback(dev, &evt, data->async->user_data); -} - -static void trigger_handler(const struct device *dev) -{ - struct uarte_nrfx_data *data = dev->data; - - if (UARTE_ANY_INTERRUPT_DRIVEN && - atomic_and(&data->flags, ~UARTE_DATA_FLAG_TRAMPOLINE) & - UARTE_DATA_FLAG_TRAMPOLINE) { - uart_async_to_irq_trampoline_cb(dev); - } -} - -static void evt_handler(nrfx_uarte_event_t const *event, void *context) -{ - const struct device *dev = context; - struct uarte_nrfx_data *data = dev->data; - - switch (event->type) { - case NRFX_UARTE_EVT_TX_DONE: - on_tx_done(dev, event); - break; - case NRFX_UARTE_EVT_RX_DONE: - on_rx_done(dev, event); - break; - case NRFX_UARTE_EVT_RX_BYTE: - on_rx_byte(dev); - break; - case NRFX_UARTE_EVT_ERROR: - data->async->err = event->data.error.error_mask; - break; - case NRFX_UARTE_EVT_RX_BUF_REQUEST: - on_rx_buf_req(dev); - break; - case NRFX_UARTE_EVT_RX_DISABLED: - on_rx_disabled(dev, data); - break; - case NRFX_UARTE_EVT_RX_BUF_TOO_LATE: - /* No support */ - break; - case NRFX_UARTE_EVT_TRIGGER: - trigger_handler(dev); - break; - default: - __ASSERT_NO_MSG(0); - } -} - -static int api_tx(const struct device *dev, const uint8_t *buf, size_t len, int32_t timeout) -{ - struct uarte_nrfx_data *data = dev->data; - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - nrfx_err_t err; - bool hwfc; - -#if CONFIG_UART_USE_RUNTIME_CONFIGURE - hwfc = data->uart_config.flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS; -#else - const struct uarte_nrfx_config *config = dev->config; - - hwfc = config->nrfx_config.config.hwfc == NRF_UARTE_HWFC_ENABLED; -#endif - - err = nrfx_uarte_tx(nrfx_dev, buf, len, 0); - if (err != NRFX_SUCCESS) { - return (err == NRFX_ERROR_BUSY) ? -EBUSY : -EIO; - } - - if (hwfc && timeout != SYS_FOREVER_US) { - k_timer_start(&data->async->tx_timer, K_USEC(timeout), K_NO_WAIT); - } - - return 0; -} - -static int api_tx_abort(const struct device *dev) -{ - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - nrfx_err_t err; - - err = nrfx_uarte_tx_abort(nrfx_dev, false); - return (err == NRFX_SUCCESS) ? 0 : -EFAULT; -} - -static void tx_timeout_handler(struct k_timer *timer) -{ - const struct device *dev = k_timer_user_data_get(timer); - - (void)api_tx_abort(dev); -} - -static void rx_timeout_handler(struct k_timer *timer) -{ - const struct device *dev = (const struct device *)k_timer_user_data_get(timer); - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_data *adata = data->async; - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - - if (nrfx_uarte_rx_new_data_check(nrfx_dev)) { - adata->idle_cnt = RX_TIMEOUT_DIV - 1; - } else { - adata->idle_cnt--; - if (adata->idle_cnt == 0) { - (void)nrfx_uarte_rx_abort(nrfx_dev, false, false); - return; - } - } - - start_rx_timer(data); -} - -/* Determine if RX FIFO content shall be kept when device is being disabled. - * When flow-control is used then we expect to keep RX FIFO content since HWFC - * enforces lossless communication. However, when HWFC is not used (by any instance - * then RX FIFO handling feature is disabled in the nrfx_uarte to save space. - * It is based on assumption that without HWFC it is expected that some data may - * be lost and there are means to prevent that (keeping receiver always opened by - * provided reception buffers on time). - */ -static inline uint32_t get_keep_fifo_content_flag(const struct device *dev) -{ -#if CONFIG_UART_USE_RUNTIME_CONFIGURE - struct uarte_nrfx_data *data = dev->data; - - if (data->uart_config.flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS) { - return NRFX_UARTE_RX_ENABLE_KEEP_FIFO_CONTENT; - } -#else - const struct uarte_nrfx_config *config = dev->config; - - if (config->nrfx_config.config.hwfc == NRF_UARTE_HWFC_ENABLED) { - return NRFX_UARTE_RX_ENABLE_KEEP_FIFO_CONTENT; - } -#endif - - return 0; -} - -static int api_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int32_t timeout) -{ - nrfx_err_t err; - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - struct uarte_async_data *adata = data->async; - uint32_t flags = NRFX_UARTE_RX_ENABLE_CONT | - get_keep_fifo_content_flag(dev) | - (IS_ASYNC_API(dev) ? NRFX_UARTE_RX_ENABLE_STOP_ON_END : 0); - - if (cfg->flags & UARTE_CFG_FLAG_NO_RX) { - return -ENOTSUP; - } - - if (timeout != SYS_FOREVER_US) { - adata->idle_cnt = RX_TIMEOUT_DIV + 1; - adata->rx_timeout = K_USEC(timeout / RX_TIMEOUT_DIV); - } else { - adata->rx_timeout = K_NO_WAIT; - } - - err = nrfx_uarte_rx_buffer_set(nrfx_dev, buf, len); - if (err != NRFX_SUCCESS) { - return -EIO; - } - - err = nrfx_uarte_rx_enable(nrfx_dev, flags); - if (err != NRFX_SUCCESS) { - return (err == NRFX_ERROR_BUSY) ? -EBUSY : -EIO; - } - - atomic_or(&data->flags, UARTE_DATA_FLAG_RX_ENABLED); - - return 0; -} - -static int api_rx_buf_rsp(const struct device *dev, uint8_t *buf, size_t len) -{ - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - struct uarte_nrfx_data *data = dev->data; - nrfx_err_t err; - - if (!(data->flags & UARTE_DATA_FLAG_RX_ENABLED)) { - return -EACCES; - } - - err = nrfx_uarte_rx_buffer_set(nrfx_dev, buf, len); - switch (err) { - case NRFX_SUCCESS: - return 0; - case NRFX_ERROR_BUSY: - return -EBUSY; - default: - return -EIO; - } -} - -static int api_rx_disable(const struct device *dev) -{ - struct uarte_nrfx_data *data = dev->data; - - k_timer_stop(&data->async->rx_timer); - - return (nrfx_uarte_rx_abort(get_nrfx_dev(dev), true, false) == NRFX_SUCCESS) ? 0 : -EFAULT; -} - -static int api_poll_in(const struct device *dev, unsigned char *c) -{ - const struct uarte_nrfx_config *cfg = dev->config; - const nrfx_uarte_t *instance = &cfg->nrfx_dev; - nrfx_err_t err; - - if (IS_INT_DRIVEN_API(dev)) { - return uart_fifo_read(dev, c, 1) == 0 ? -1 : 0; - } - - if (IS_ASYNC_API(dev)) { - return -EBUSY; - } - - err = nrfx_uarte_rx_ready(instance, NULL); - if (err == NRFX_SUCCESS) { - uint8_t *rx_byte = cfg->nrfx_config.rx_cache.p_buffer; - - *c = *rx_byte; - err = nrfx_uarte_rx_buffer_set(instance, rx_byte, 1); - __ASSERT_NO_MSG(err == NRFX_SUCCESS); - - return 0; - } - - return -1; -} - -static void api_poll_out(const struct device *dev, unsigned char out_char) -{ - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - nrfx_err_t err; - - do { - /* When runtime PM is used we cannot use early return because then - * we have no information when UART is actually done with the - * transmission. It reduces UART performance however, polling in - * general is not power efficient and should be avoided in low - * power applications. - */ - err = nrfx_uarte_tx(nrfx_dev, &out_char, 1, NRFX_UARTE_TX_EARLY_RETURN); - __ASSERT(err != NRFX_ERROR_INVALID_ADDR, "Invalid address of the buffer"); - - if (err == NRFX_ERROR_BUSY && - IS_ENABLED(CONFIG_MULTITHREADING) && k_is_preempt_thread()) { - k_msleep(1); - } - Z_SPIN_DELAY(3); - } while (err == NRFX_ERROR_BUSY); -} - -#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE -/** - * @brief Set the baud rate - * - * This routine set the given baud rate for the UARTE. - * - * @param dev UARTE device struct - * @param baudrate Baud rate - * - * @return 0 on success or error code - */ -static int baudrate_set(NRF_UARTE_Type *uarte, uint32_t baudrate) -{ - nrf_uarte_baudrate_t nrf_baudrate = NRF_BAUDRATE(baudrate); - - if (baudrate == 0) { - return -EINVAL; - } - - nrfy_uarte_baudrate_set(uarte, nrf_baudrate); - - return 0; -} - -static int uarte_nrfx_configure(const struct device *dev, - const struct uart_config *cfg) -{ - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - struct uarte_nrfx_data *data = dev->data; - nrf_uarte_config_t uarte_cfg; - -#if defined(UARTE_CONFIG_STOP_Msk) - switch (cfg->stop_bits) { - case UART_CFG_STOP_BITS_1: - uarte_cfg.stop = NRF_UARTE_STOP_ONE; - break; - case UART_CFG_STOP_BITS_2: - uarte_cfg.stop = NRF_UARTE_STOP_TWO; - break; - default: - return -ENOTSUP; - } -#else - if (cfg->stop_bits != UART_CFG_STOP_BITS_1) { - return -ENOTSUP; - } -#endif - - if (cfg->data_bits != UART_CFG_DATA_BITS_8) { - return -ENOTSUP; - } - - switch (cfg->flow_ctrl) { - case UART_CFG_FLOW_CTRL_NONE: - uarte_cfg.hwfc = NRF_UARTE_HWFC_DISABLED; - break; - case UART_CFG_FLOW_CTRL_RTS_CTS: - uarte_cfg.hwfc = NRF_UARTE_HWFC_ENABLED; - break; - default: - return -ENOTSUP; - } - -#if defined(UARTE_CONFIG_PARITYTYPE_Msk) - uarte_cfg.paritytype = NRF_UARTE_PARITYTYPE_EVEN; -#endif - switch (cfg->parity) { - case UART_CFG_PARITY_NONE: - uarte_cfg.parity = NRF_UARTE_PARITY_EXCLUDED; - break; - case UART_CFG_PARITY_EVEN: - uarte_cfg.parity = NRF_UARTE_PARITY_INCLUDED; - break; -#if defined(UARTE_CONFIG_PARITYTYPE_Msk) - case UART_CFG_PARITY_ODD: - uarte_cfg.parity = NRF_UARTE_PARITY_INCLUDED; - uarte_cfg.paritytype = NRF_UARTE_PARITYTYPE_ODD; - break; -#endif - default: - return -ENOTSUP; - } - - if (baudrate_set(nrfx_dev->p_reg, cfg->baudrate) != 0) { - return -ENOTSUP; - } - - nrfy_uarte_configure(nrfx_dev->p_reg, &uarte_cfg); - - data->uart_config = *cfg; - - return 0; -} - -static int uarte_nrfx_config_get(const struct device *dev, - struct uart_config *cfg) -{ - struct uarte_nrfx_data *data = dev->data; - - *cfg = data->uart_config; - return 0; -} -#endif /* CONFIG_UART_USE_RUNTIME_CONFIGURE */ - -#if UARTE_ANY_POLLING || UARTE_ANY_INTERRUPT_DRIVEN -static int api_err_check(const struct device *dev) -{ - if (IS_POLLING_API(dev)) { - const struct uarte_nrfx_config *cfg = dev->config; - const nrfx_uarte_t *instance = &cfg->nrfx_dev; - uint32_t mask = nrfx_uarte_errorsrc_get(instance); - - return mask; - } - - struct uarte_nrfx_data *data = dev->data; - uint32_t rv = data->async->err; - - data->async->err = 0; - - return rv; -} -#endif - -static const struct uart_async_to_irq_async_api a2i_api = { - .callback_set = callback_set, - .tx = api_tx, - .tx_abort = api_tx_abort, - .rx_enable = api_rx_enable, - .rx_buf_rsp = api_rx_buf_rsp, - .rx_disable = api_rx_disable, -}; - -static const struct uart_driver_api uart_nrfx_uarte_driver_api = { - .poll_in = api_poll_in, - .poll_out = api_poll_out, -#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE - .configure = uarte_nrfx_configure, - .config_get = uarte_nrfx_config_get, -#endif /* CONFIG_UART_USE_RUNTIME_CONFIGURE */ -#if UARTE_ANY_POLLING || UARTE_ANY_INTERRUPT_DRIVEN - .err_check = api_err_check, -#endif -#if UARTE_ANY_ASYNC - .callback_set = api_callback_set, - .tx = api_tx, - .tx_abort = api_tx_abort, - .rx_enable = api_rx_enable, - .rx_buf_rsp = api_rx_buf_rsp, - .rx_disable = api_rx_disable, -#endif /* UARTE_ANY_ASYNC */ -#if UARTE_ANY_INTERRUPT_DRIVEN - UART_ASYNC_TO_IRQ_API_INIT(), -#endif /* UARTE_ANY_INTERRUPT_DRIVEN */ -}; - -static int endtx_stoptx_ppi_init(NRF_UARTE_Type *uarte) -{ - nrfx_err_t ret; - uint8_t ch; - - ret = nrfx_gppi_channel_alloc(&ch); - if (ret != NRFX_SUCCESS) { - LOG_ERR("Failed to allocate PPI Channel"); - return -EIO; - } - - nrfx_gppi_channel_endpoints_setup(ch, - nrfy_uarte_event_address_get(uarte, NRF_UARTE_EVENT_ENDTX), - nrfy_uarte_task_address_get(uarte, NRF_UARTE_TASK_STOPTX)); - nrfx_gppi_channels_enable(BIT(ch)); - - return 0; -} - -static int start_rx(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; - - if (IS_INT_DRIVEN_API(dev)) { - return uart_async_to_irq_rx_enable(dev); - } - - __ASSERT_NO_MSG(IS_POLLING_API(dev)); - - nrfx_err_t err; - const nrfx_uarte_t *instance = &cfg->nrfx_dev; - uint8_t *rx_byte = cfg->nrfx_config.rx_cache.p_buffer; - - err = nrfx_uarte_rx_buffer_set(instance, rx_byte, 1); - __ASSERT_NO_MSG(err == NRFX_SUCCESS); - - err = nrfx_uarte_rx_enable(instance, 0); - __ASSERT_NO_MSG(err == NRFX_SUCCESS || err == NRFX_ERROR_BUSY); - - (void)err; - - return 0; -} - -static void async_to_irq_trampoline(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - uint32_t prev = atomic_or(&data->flags, UARTE_DATA_FLAG_TRAMPOLINE); - - if (!(prev & UARTE_DATA_FLAG_TRAMPOLINE)) { - nrfx_uarte_int_trigger(&cfg->nrfx_dev); - } -} - -static int uarte_nrfx_init(const struct device *dev) -{ - int err; - nrfx_err_t nerr; - const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - const struct uarte_nrfx_config *cfg = dev->config; - struct uarte_nrfx_data *data = dev->data; - - err = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); - if (err < 0) { - return err; - } - - if (UARTE_ENHANCED_POLL_OUT && cfg->nrfx_config.tx_stop_on_end) { - err = endtx_stoptx_ppi_init(nrfx_dev->p_reg); - if (err < 0) { - return err; - } - } - - if (UARTE_ANY_INTERRUPT_DRIVEN) { - if (cfg->a2i_config) { - err = uart_async_to_irq_init(data->a2i_data, cfg->a2i_config); - if (err < 0) { - return err; - } - } - } - - if (IS_ENABLED(UARTE_INT_ASYNC) && data->async) { - k_timer_init(&data->async->rx_timer, rx_timeout_handler, NULL); - k_timer_user_data_set(&data->async->rx_timer, (void *)dev); - k_timer_init(&data->async->tx_timer, tx_timeout_handler, NULL); - k_timer_user_data_set(&data->async->tx_timer, (void *)dev); - } - - nerr = nrfx_uarte_init(nrfx_dev, &cfg->nrfx_config, - IS_ENABLED(UARTE_INT_ASYNC) ? - (IS_POLLING_API(dev) ? NULL : evt_handler) : NULL); - if (nerr == NRFX_SUCCESS && !IS_ASYNC_API(dev) && !(cfg->flags & UARTE_CFG_FLAG_NO_RX)) { - err = start_rx(dev); - } - - switch (nerr) { - case NRFX_ERROR_INVALID_STATE: - return -EBUSY; - case NRFX_ERROR_BUSY: - return -EACCES; - case NRFX_ERROR_INVALID_PARAM: - return -EINVAL; - default: - return 0; - } -} - -#ifdef CONFIG_PM_DEVICE -static int stop_rx(const struct device *dev) -{ - const struct uarte_nrfx_config *cfg = dev->config; - - if (IS_INT_DRIVEN_API(dev)) { - return uart_async_to_irq_rx_disable(dev); - } - - __ASSERT_NO_MSG(IS_POLLING_API(dev)); - nrfx_err_t err; - const nrfx_uarte_t *instance = &cfg->nrfx_dev; - - err = nrfx_uarte_rx_abort(instance, true, true); - __ASSERT_NO_MSG(err == NRFX_SUCCESS); - - return 0; -} - -static int uarte_nrfx_pm_action(const struct device *dev, - enum pm_device_action action) -{ - const struct uarte_nrfx_config *cfg = dev->config; - int ret; - - switch (action) { - case PM_DEVICE_ACTION_RESUME: - if (cfg->flags & UARTE_CFG_FLAG_GPIO_MGMT) { - ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); - if (ret < 0) { - return ret; - } - } - if (!IS_ASYNC_API(dev) && !(cfg->flags & UARTE_CFG_FLAG_NO_RX)) { - return start_rx(dev); - } - - break; - case PM_DEVICE_ACTION_SUSPEND: - if (!IS_ASYNC_API(dev) && !(cfg->flags & UARTE_CFG_FLAG_NO_RX)) { - stop_rx(dev); - } - - if (cfg->flags & UARTE_CFG_FLAG_GPIO_MGMT) { - ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP); - if (ret < 0) { - return ret; - } - } - - break; - default: - return -ENOTSUP; - } - - return 0; -} -#endif - -#if defined(UARTE_CONFIG_STOP_Msk) -#define UARTE_HAS_STOP_CONFIG 1 -#endif - -#define UARTE(idx) DT_NODELABEL(uart##idx) -#define UARTE_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(UARTE(idx), prop) -#define UARTE_PROP(idx, prop) DT_PROP(UARTE(idx), prop) - -/* Macro returning initial log level. Logs are off for UART used for console. */ -#define GET_INIT_LOG_LEVEL(idx) \ - COND_CODE_1(DT_HAS_CHOSEN(zephyr_console), \ - (DT_SAME_NODE(UARTE(idx), \ - DT_CHOSEN(zephyr_console)) ? \ - LOG_LEVEL_NONE : CONFIG_UART_LOG_LEVEL), \ - (CONFIG_UART_LOG_LEVEL)) - -/* Macro puts buffers in dedicated section if device tree property is set. */ -#define UARTE_MEMORY_SECTION(idx) \ - COND_CODE_1(UARTE_HAS_PROP(idx, memory_regions), \ - (__attribute__((__section__(LINKER_DT_NODE_REGION_NAME( \ - DT_PHANDLE(UARTE(idx), memory_regions)))))), \ - ()) - -#define UART_NRF_UARTE_DEVICE(idx) \ - LOG_INSTANCE_REGISTER(LOG_MODULE_NAME, idx, GET_INIT_LOG_LEVEL(idx)); \ - static uint8_t uarte##idx##_tx_cache[CONFIG_UART_##idx##_TX_CACHE_SIZE] \ - UARTE_MEMORY_SECTION(idx) __aligned(4); \ - static uint8_t uarte##idx##_rx_cache[CONFIG_UART_##idx##_RX_CACHE_SIZE] \ - UARTE_MEMORY_SECTION(idx) __aligned(4); \ - static nrfx_uarte_rx_cache_t uarte##idx##_rx_cache_scratch; \ - IF_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN, \ - (static uint8_t a2i_rx_buf##idx[CONFIG_UART_##idx##_A2I_RX_SIZE];)) \ - PINCTRL_DT_DEFINE(UARTE(idx)); \ - static const struct uart_async_to_irq_config uarte_a2i_config_##idx = \ - UART_ASYNC_TO_IRQ_API_CONFIG_INITIALIZER(&a2i_api, \ - async_to_irq_trampoline, \ - UARTE_PROP(idx, current_speed), \ - uarte##idx##_tx_cache, \ - /* nrfx_uarte driver is using the last byte in the */ \ - /* cache buffer for keeping a byte that is currently*/\ - /* polled out so it cannot be used as a cache buffer*/\ - /* by the adaptation layer. */ \ - sizeof(uarte##idx##_tx_cache) - 1, \ - COND_CODE_1(CONFIG_UART_##idx##_INTERRUPT_DRIVEN, \ - (a2i_rx_buf##idx), (NULL)), \ - COND_CODE_1(CONFIG_UART_##idx##_INTERRUPT_DRIVEN, \ - (sizeof(a2i_rx_buf##idx)), (0)), \ - CONFIG_UART_##idx##_A2I_RX_BUF_COUNT, \ - LOG_INSTANCE_PTR(LOG_MODULE_NAME, idx)); \ - static const struct uarte_nrfx_config uarte_config_##idx = { \ - .a2i_config = IS_ENABLED(CONFIG_UART_##idx## _INTERRUPT_DRIVEN) ? \ - &uarte_a2i_config_##idx : NULL, \ - .nrfx_dev = NRFX_UARTE_INSTANCE(idx), \ - .nrfx_config = { \ - .p_context = (void *)DEVICE_DT_GET(UARTE(idx)), \ - .tx_cache = { \ - .p_buffer = uarte##idx##_tx_cache, \ - .length = CONFIG_UART_##idx##_TX_CACHE_SIZE \ - }, \ - .rx_cache = { \ - .p_buffer = uarte##idx##_rx_cache, \ - .length = CONFIG_UART_##idx##_RX_CACHE_SIZE \ - }, \ - .p_rx_cache_scratch = &uarte##idx##_rx_cache_scratch, \ - .baudrate = NRF_BAUDRATE(UARTE_PROP(idx, current_speed)), \ - .interrupt_priority = DT_IRQ(UARTE(idx), priority), \ - .config = { \ - .hwfc = (UARTE_PROP(idx, hw_flow_control) == \ - UART_CFG_FLOW_CTRL_RTS_CTS) ? \ - NRF_UARTE_HWFC_ENABLED : NRF_UARTE_HWFC_DISABLED, \ - .parity = IS_ENABLED(CONFIG_UART_##idx##_NRF_PARITY_BIT) ? \ - NRF_UARTE_PARITY_INCLUDED : NRF_UARTE_PARITY_EXCLUDED, \ - IF_ENABLED(UARTE_HAS_STOP_CONFIG, (.stop = NRF_UARTE_STOP_ONE,))\ - IF_ENABLED(UARTE_ODD_PARITY_ALLOWED, \ - (.paritytype = NRF_UARTE_PARITYTYPE_EVEN,)) \ - }, \ - .tx_stop_on_end = IS_ENABLED(CONFIG_UART_##idx##_ENHANCED_POLL_OUT), \ - .skip_psel_cfg = true, \ - .skip_gpio_cfg = true, \ - }, \ - .pcfg = PINCTRL_DT_DEV_CONFIG_GET(UARTE(idx)), \ - .flags = (UARTE_PROP(idx, disable_rx) ? UARTE_CFG_FLAG_NO_RX : 0) | \ - (IS_ENABLED(CONFIG_UART_##idx##_GPIO_MANAGEMENT) ? \ - UARTE_CFG_FLAG_GPIO_MGMT : 0) | \ - (IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN) ? \ - UARTE_CFG_FLAG_INTERRUPT_DRIVEN_API : 0), \ - LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \ - }; \ - static struct uart_async_to_irq_data uarte_a2i_data_##idx; \ - static struct uarte_async_data uarte_async_##idx; \ - static struct uarte_nrfx_data uarte_data_##idx = { \ - .a2i_data = IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN) ? \ - &uarte_a2i_data_##idx : NULL, \ - IF_ENABLED(CONFIG_UART_USE_RUNTIME_CONFIGURE, \ - (.uart_config = { \ - .baudrate = UARTE_PROP(idx, current_speed), \ - .parity = IS_ENABLED(CONFIG_UART_##idx##_NRF_PARITY_BIT) ? \ - UART_CFG_PARITY_EVEN : UART_CFG_PARITY_NONE, \ - .stop_bits = UART_CFG_STOP_BITS_1, \ - .data_bits = UART_CFG_DATA_BITS_8, \ - .flow_ctrl = UARTE_PROP(idx, hw_flow_control) ? \ - UART_CFG_FLOW_CTRL_RTS_CTS : UART_CFG_FLOW_CTRL_NONE, \ - },)) \ - .async = (IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN) || \ - IS_ENABLED(CONFIG_UART_##idx##_ASYNC)) ? &uarte_async_##idx : NULL \ - }; \ - static int uarte_init_##idx(const struct device *dev) \ - { \ - COND_CODE_1(INSTANCE_POLLING(_, /*empty*/, idx, _), (), \ - ( \ - IRQ_CONNECT(DT_IRQN(UARTE(idx)), DT_IRQ(UARTE(idx), priority), \ - nrfx_isr, nrfx_uarte_##idx##_irq_handler, 0); \ - irq_enable(DT_IRQN(UARTE(idx))); \ - ) \ - ) \ - return uarte_nrfx_init(dev); \ - } \ - PM_DEVICE_DT_DEFINE(UARTE(idx), uarte_nrfx_pm_action); \ - DEVICE_DT_DEFINE(UARTE(idx), \ - uarte_init_##idx, \ - PM_DEVICE_DT_GET(UARTE(idx)), \ - &uarte_data_##idx, \ - &uarte_config_##idx, \ - PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &uart_nrfx_uarte_driver_api) - -/* Macro creates device instance if it is enabled in devicetree. */ -#define UARTE_DEVICE(periph, prefix, id, _) \ - IF_ENABLED(CONFIG_HAS_HW_NRF_UARTE##prefix##id, (UART_NRF_UARTE_DEVICE(prefix##id);)) - -/* Macro iterates over nrfx_uarte instances enabled in the nrfx_config.h. */ -NRFX_FOREACH_ENABLED(UARTE, UARTE_DEVICE, (), (), _) From 4102077117840ce9fa7f21717c8dbc609c9d1308 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:43 +0100 Subject: [PATCH 1142/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx: Add new UARTE options to Kconfig" This reverts commit 941a2567971d04944957bd2928ab7a118b18eb4a. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/Kconfig | 21 --------------------- modules/hal_nordic/nrfx/nrfx_config.h | 12 ------------ 2 files changed, 33 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index b4c00040ee1..a92aa93d9a2 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -573,27 +573,6 @@ config NRFX_UARTE3 depends on $(dt_nodelabel_has_compat,uart3,$(DT_COMPAT_NORDIC_NRF_UARTE)) select NRFX_UARTE -config NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG - bool "UARTE GPIO configuration support" - depends on NRFX_UARTE - -config NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG - bool "UARTE PSEL configuration support" - depends on NRFX_UARTE - -config NRFX_UARTE_CONFIG_TX_LINK - bool "UARTE TX transfer linking support" - depends on NRFX_UARTE - -config NRFX_UARTE_CONFIG_RX_CACHE_ENABLED - bool "UARTE RX caching support" - default y if $(dt_nodelabel_has_compat,ram3x,$(DT_COMPAT_MMIO_SRAM)) - depends on NRFX_UARTE - help - Feature might be enabled on platforms which has limitations regarding addresses - to which receiver can write data. If enabled then internal driver buffers - (cache buffers) are used for DMA transfers and data is copied to the user buffer. - config NRFX_USBREG bool "USBREG driver" depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_USBREG)) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index ac930b13639..57417644c32 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -563,18 +563,6 @@ #ifdef CONFIG_NRFX_UARTE3 #define NRFX_UARTE3_ENABLED 1 #endif -#ifdef CONFIG_NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG -#define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 1 -#endif -#ifdef CONFIG_NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG -#define NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG 1 -#endif -#ifdef CONFIG_NRFX_UARTE_CONFIG_TX_LINK -#define NRFX_UARTE_CONFIG_TX_LINK 1 -#endif -#ifdef CONFIG_NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 1 -#endif #ifdef CONFIG_NRFX_USBREG #define NRFX_USBREG_ENABLED 1 From 7bc9d11b37a328a1e6ca3b94649282a3db0c7b95 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:44 +0100 Subject: [PATCH 1143/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: Disable UART runtime configuration" This reverts commit 5cacd04c6195cd46daf81b9c9aedea267f3945dc. Signed-off-by: Robert Lubos --- doc/releases/migration-guide-3.6.rst | 4 ---- soc/arm/nordic_nrf/Kconfig.defconfig | 3 --- 2 files changed, 7 deletions(-) diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index c4cb37eaf94..eeac0a89b75 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -55,10 +55,6 @@ Device Drivers and Device Tree (:github:`62994`) -* Runtime configuration is now disabled by default for Nordic UART drivers. The motivation for the - change is that this feature is rarely used and disabling it significantly reduces the memory - footprint. - Power Management ================ diff --git a/soc/arm/nordic_nrf/Kconfig.defconfig b/soc/arm/nordic_nrf/Kconfig.defconfig index 858c60d1d88..3eedcf350c6 100644 --- a/soc/arm/nordic_nrf/Kconfig.defconfig +++ b/soc/arm/nordic_nrf/Kconfig.defconfig @@ -40,7 +40,4 @@ config GPIO default y depends on SPI -config UART_USE_RUNTIME_CONFIGURE - default n - endif # SOC_FAMILY_NRF From 62d1a5ab7878b20b1a243d7744e1e400a5eb77ee Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:44 +0100 Subject: [PATCH 1144/2300] Revert "[nrf fromtree] drivers: serial: Add async to interrupt driven adaptation" This reverts commit 06b8a5648cd644eb054a1df3165611f4eeb88359. Signed-off-by: Robert Lubos --- drivers/serial/CMakeLists.txt | 1 - drivers/serial/Kconfig | 15 - drivers/serial/uart_async_to_irq.c | 377 ------------------ .../zephyr/drivers/serial/uart_async_to_irq.h | 285 ------------- 4 files changed, 678 deletions(-) delete mode 100644 drivers/serial/uart_async_to_irq.c delete mode 100644 include/zephyr/drivers/serial/uart_async_to_irq.h diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt index 2cd79e12f64..bfc38603864 100644 --- a/drivers/serial/CMakeLists.txt +++ b/drivers/serial/CMakeLists.txt @@ -93,4 +93,3 @@ endif() 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 2d097932cf4..5eb183c9a3e 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -133,21 +133,6 @@ config UART_ASYNC_RX_HELPER is delayed. Module implements zero-copy approach with multiple reception buffers. -config UART_ASYNC_TO_INT_DRIVEN_API - bool - select UART_ASYNC_RX_HELPER - help - Asynchronous to Interrupt driven adaptation layer. When enabled device - which implements only asynchronous API can be used with interrupt driven - API implemented by the generic adaptation layer. - -config UART_ASYNC_TO_INT_DRIVEN_RX_TIMEOUT - int "Receiver timeout (in bauds)" - depends on UART_ASYNC_TO_INT_DRIVEN_API - default 100 - help - Receiver inactivity timeout. It is used to calculate timeout in microseconds. - comment "Serial Drivers" source "drivers/serial/Kconfig.b91" diff --git a/drivers/serial/uart_async_to_irq.c b/drivers/serial/uart_async_to_irq.c deleted file mode 100644 index 209e8d4f205..00000000000 --- a/drivers/serial/uart_async_to_irq.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include -LOG_MODULE_REGISTER(UART_ASYNC_TO_IRQ_LOG_NAME, CONFIG_UART_LOG_LEVEL); - -/* Internal state flags. */ - -/* RX interrupt enabled. */ -#define A2I_RX_IRQ_ENABLED BIT(0) - -/* TX interrupt enabled. */ -#define A2I_TX_IRQ_ENABLED BIT(1) - -/* Error interrupt enabled. */ -#define A2I_ERR_IRQ_ENABLED BIT(2) - -/* Receiver to be kept enabled. */ -#define A2I_RX_ENABLE BIT(3) - -/* TX busy. */ -#define A2I_TX_BUSY BIT(4) - -static struct uart_async_to_irq_data *get_data(const struct device *dev) -{ - struct uart_async_to_irq_data **data = dev->data; - - return *data; -} - -static const struct uart_async_to_irq_config *get_config(const struct device *dev) -{ - const struct uart_async_to_irq_config * const *config = dev->config; - - return *config; -} - -/* Function calculates RX timeout based on baudrate. */ -static uint32_t get_rx_timeout(const struct device *dev) -{ - struct uart_config cfg; - int err; - uint32_t baudrate; - - err = uart_config_get(dev, &cfg); - if (err == 0) { - baudrate = cfg.baudrate; - } else { - baudrate = get_config(dev)->baudrate; - } - - uint32_t us = (CONFIG_UART_ASYNC_TO_INT_DRIVEN_RX_TIMEOUT * 1000000) / baudrate; - - return us; -} - -static int rx_enable(const struct device *dev, - struct uart_async_to_irq_data *data, - uint8_t *buf, - size_t len) -{ - int err; - const struct uart_async_to_irq_config *config = get_config(dev); - - err = config->api->rx_enable(dev, buf, len, get_rx_timeout(dev)); - - return err; -} - -static int try_rx_enable(const struct device *dev, struct uart_async_to_irq_data *data) -{ - uint8_t *buf = uart_async_rx_buf_req(&data->rx.async_rx); - size_t len = uart_async_rx_get_buf_len(&data->rx.async_rx); - - if (buf == NULL) { - return -EBUSY; - } - - return rx_enable(dev, data, buf, len); -} - -static void on_rx_buf_req(const struct device *dev, - const struct uart_async_to_irq_config *config, - struct uart_async_to_irq_data *data) -{ - struct uart_async_rx *async_rx = &data->rx.async_rx; - uint8_t *buf = uart_async_rx_buf_req(async_rx); - size_t len = uart_async_rx_get_buf_len(async_rx); - - if (buf) { - int err = config->api->rx_buf_rsp(dev, buf, len); - - if (err < 0) { - uart_async_rx_on_buf_rel(async_rx, buf); - } - } else { - atomic_inc(&data->rx.pending_buf_req); - } -} - -static void on_rx_dis(const struct device *dev, struct uart_async_to_irq_data *data) -{ - if (data->flags & A2I_RX_ENABLE) { - data->rx.pending_buf_req = 0; - - int err = try_rx_enable(dev, data); - - LOG_INST_DBG(get_config(dev)->log, "Reenabling RX from RX_DISABLED (err:%d)", err); - __ASSERT_NO_MSG(err >= 0); - return; - } - - k_sem_give(&data->rx.sem); -} - -static void uart_async_to_irq_callback(const struct device *dev, - struct uart_event *evt, - void *user_data) -{ - struct uart_async_to_irq_data *data = (struct uart_async_to_irq_data *)user_data; - const struct uart_async_to_irq_config *config = get_config(dev); - bool call_handler = false; - - switch (evt->type) { - case UART_TX_DONE: - atomic_and(&data->flags, ~A2I_TX_BUSY); - call_handler = data->flags & A2I_TX_IRQ_ENABLED; - break; - case UART_RX_RDY: - uart_async_rx_on_rdy(&data->rx.async_rx, evt->data.rx.buf, evt->data.rx.len); - call_handler = data->flags & A2I_RX_IRQ_ENABLED; - break; - case UART_RX_BUF_REQUEST: - on_rx_buf_req(dev, config, data); - break; - case UART_RX_BUF_RELEASED: - uart_async_rx_on_buf_rel(&data->rx.async_rx, evt->data.rx_buf.buf); - break; - case UART_RX_STOPPED: - call_handler = data->flags & A2I_ERR_IRQ_ENABLED; - break; - case UART_RX_DISABLED: - on_rx_dis(dev, data); - break; - default: - break; - } - - if (data->callback && call_handler) { - atomic_inc(&data->irq_req); - config->trampoline(dev); - } -} - -int z_uart_async_to_irq_fifo_fill(const struct device *dev, const uint8_t *buf, int len) -{ - struct uart_async_to_irq_data *data = get_data(dev); - const struct uart_async_to_irq_config *config = get_config(dev); - int err; - - len = MIN(len, data->tx.len); - if (atomic_or(&data->flags, A2I_TX_BUSY) & A2I_TX_BUSY) { - return 0; - } - - memcpy(data->tx.buf, buf, len); - - err = config->api->tx(dev, data->tx.buf, len, SYS_FOREVER_US); - if (err < 0) { - atomic_and(&data->flags, ~A2I_TX_BUSY); - return 0; - } - - return len; -} - -/** Interrupt driven FIFO read function */ -int z_uart_async_to_irq_fifo_read(const struct device *dev, - uint8_t *buf, - const int len) -{ - struct uart_async_to_irq_data *data = get_data(dev); - const struct uart_async_to_irq_config *config = get_config(dev); - struct uart_async_rx *async_rx = &data->rx.async_rx; - size_t claim_len; - uint8_t *claim_buf; - - claim_len = uart_async_rx_data_claim(async_rx, &claim_buf, len); - if (claim_len == 0) { - return 0; - } - - memcpy(buf, claim_buf, claim_len); - uart_async_rx_data_consume(async_rx, claim_len); - - if (data->rx.pending_buf_req) { - buf = uart_async_rx_buf_req(async_rx); - if (buf) { - int err; - size_t rx_len = uart_async_rx_get_buf_len(async_rx); - - atomic_dec(&data->rx.pending_buf_req); - err = config->api->rx_buf_rsp(dev, buf, rx_len); - if (err < 0) { - if (err == -EACCES) { - data->rx.pending_buf_req = 0; - err = rx_enable(dev, data, buf, rx_len); - } - if (err < 0) { - return err; - } - } - } - } - - return (int)claim_len; -} - -static void dir_disable(const struct device *dev, uint32_t flag) -{ - struct uart_async_to_irq_data *data = get_data(dev); - - atomic_and(&data->flags, ~flag); -} - -static void dir_enable(const struct device *dev, uint32_t flag) -{ - struct uart_async_to_irq_data *data = get_data(dev); - - atomic_or(&data->flags, flag); - - atomic_inc(&data->irq_req); - get_config(dev)->trampoline(dev); -} - -/** Interrupt driven transfer enabling function */ -void z_uart_async_to_irq_irq_tx_enable(const struct device *dev) -{ - dir_enable(dev, A2I_TX_IRQ_ENABLED); -} - -/** Interrupt driven transfer disabling function */ -void z_uart_async_to_irq_irq_tx_disable(const struct device *dev) -{ - dir_disable(dev, A2I_TX_IRQ_ENABLED); -} - -/** Interrupt driven transfer ready function */ -int z_uart_async_to_irq_irq_tx_ready(const struct device *dev) -{ - struct uart_async_to_irq_data *data = get_data(dev); - - return (data->flags & A2I_TX_IRQ_ENABLED) && !(data->flags & A2I_TX_BUSY); -} - -/** Interrupt driven receiver enabling function */ -void z_uart_async_to_irq_irq_rx_enable(const struct device *dev) -{ - dir_enable(dev, A2I_RX_IRQ_ENABLED); -} - -/** Interrupt driven receiver disabling function */ -void z_uart_async_to_irq_irq_rx_disable(const struct device *dev) -{ - dir_disable(dev, A2I_RX_IRQ_ENABLED); -} - -/** 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); -} - -/** Interrupt driven receiver ready function */ -int z_uart_async_to_irq_irq_rx_ready(const struct device *dev) -{ - struct uart_async_to_irq_data *data = get_data(dev); - - return (data->flags & A2I_RX_IRQ_ENABLED) && (data->rx.async_rx.pending_bytes > 0); -} - -/** Interrupt driven error enabling function */ -void z_uart_async_to_irq_irq_err_enable(const struct device *dev) -{ - dir_enable(dev, A2I_ERR_IRQ_ENABLED); -} - -/** Interrupt driven error disabling function */ -void z_uart_async_to_irq_irq_err_disable(const struct device *dev) -{ - dir_disable(dev, A2I_ERR_IRQ_ENABLED); -} - -/** Interrupt driven pending status function */ -int z_uart_async_to_irq_irq_is_pending(const struct device *dev) -{ - return z_uart_async_to_irq_irq_tx_ready(dev) || z_uart_async_to_irq_irq_rx_ready(dev); -} - -/** Interrupt driven interrupt update function */ -int z_uart_async_to_irq_irq_update(const struct device *dev) -{ - return 1; -} - -/** Set the irq callback function */ -void z_uart_async_to_irq_irq_callback_set(const struct device *dev, - uart_irq_callback_user_data_t cb, - void *user_data) -{ - struct uart_async_to_irq_data *data = get_data(dev); - - data->callback = cb; - data->user_data = user_data; -} - -int uart_async_to_irq_rx_enable(const struct device *dev) -{ - struct uart_async_to_irq_data *data = get_data(dev); - const struct uart_async_to_irq_config *config = get_config(dev); - int err; - - err = config->api->callback_set(dev, uart_async_to_irq_callback, data); - if (err < 0) { - return err; - } - - uart_async_rx_reset(&data->rx.async_rx); - - err = try_rx_enable(dev, data); - if (err == 0) { - atomic_or(&data->flags, A2I_RX_ENABLE); - } - - return err; -} - -int uart_async_to_irq_rx_disable(const struct device *dev) -{ - struct uart_async_to_irq_data *data = get_data(dev); - const struct uart_async_to_irq_config *config = get_config(dev); - int err; - - if (atomic_and(&data->flags, ~A2I_RX_ENABLE) & A2I_RX_ENABLE) { - err = config->api->rx_disable(dev); - if (err < 0) { - return err; - } - k_sem_take(&data->rx.sem, K_FOREVER); - } - - return 0; -} - -void uart_async_to_irq_trampoline_cb(const struct device *dev) -{ - struct uart_async_to_irq_data *data = get_data(dev); - - do { - data->callback(dev, data->user_data); - } while (atomic_dec(&data->irq_req) > 1); -} - -int uart_async_to_irq_init(struct uart_async_to_irq_data *data, - const struct uart_async_to_irq_config *config) -{ - data->tx.buf = config->tx_buf; - data->tx.len = config->tx_len; - - k_sem_init(&data->rx.sem, 0, 1); - - return uart_async_rx_init(&data->rx.async_rx, &config->async_rx); -} diff --git a/include/zephyr/drivers/serial/uart_async_to_irq.h b/include/zephyr/drivers/serial/uart_async_to_irq.h deleted file mode 100644 index d5116dee2c0..00000000000 --- a/include/zephyr/drivers/serial/uart_async_to_irq.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_DRIVERS_SERIAL_UART_ASYNC_TO_IRQ_H_ -#define ZEPHYR_DRIVERS_SERIAL_UART_ASYNC_TO_IRQ_H_ - -#include -#include -#include -#include -#include - -/** - * @brief UART Asynchronous to Interrupt driven API adaptation layer - * @ingroup uart_interface - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward declarations. */ - -/** @brief Data structure used by the adaptation layer. - * - * Pointer to that data must be the first element of the UART device data structure. - */ -struct uart_async_to_irq_data; - -/** @brief Configuration structure used by the adaptation layer. - * - * Pointer to this data must be the first element of the UART device configuration structure. - */ -struct uart_async_to_irq_config; - -/* @brief Function that triggers trampoline to the interrupt context. - * - * This context is used to call user UART interrupt handler. It is to used to - * fulfill the requirement that UART interrupt driven API shall be called from - * the UART interrupt. Trampoline context shall have the same priority as UART. - * - * One option may be to use k_timer configured to expire immediately. - */ -typedef void (*uart_async_to_irq_trampoline)(const struct device *dev); - -/** @brief Callback to be called from trampoline context. - * - * @param dev UART device. - */ -void uart_async_to_irq_trampoline_cb(const struct device *dev); - -/** @brief Interrupt driven API initializer. - * - * It should be used in the initialization of the UART API structure in the - * driver to provide interrupt driven API functions. - */ -#define UART_ASYNC_TO_IRQ_API_INIT() \ - .fifo_fill = z_uart_async_to_irq_fifo_fill, \ - .fifo_read = z_uart_async_to_irq_fifo_read, \ - .irq_tx_enable = z_uart_async_to_irq_irq_tx_enable, \ - .irq_tx_disable = z_uart_async_to_irq_irq_tx_disable, \ - .irq_tx_ready = z_uart_async_to_irq_irq_tx_ready, \ - .irq_rx_enable = z_uart_async_to_irq_irq_rx_enable, \ - .irq_rx_disable = z_uart_async_to_irq_irq_rx_disable, \ - .irq_tx_complete = z_uart_async_to_irq_irq_tx_complete,\ - .irq_rx_ready = z_uart_async_to_irq_irq_rx_ready, \ - .irq_err_enable = z_uart_async_to_irq_irq_err_enable, \ - .irq_err_disable = z_uart_async_to_irq_irq_err_disable,\ - .irq_is_pending = z_uart_async_to_irq_irq_is_pending, \ - .irq_update = z_uart_async_to_irq_irq_update, \ - .irq_callback_set = z_uart_async_to_irq_irq_callback_set - -/** @brief Configuration structure initializer. - * - * @param _api Structure with UART asynchronous API. - * @param _trampoline Function that trampolines to the interrupt context. - * @param _baudrate UART baudrate. - * @param _tx_buf TX buffer. - * @param _tx_len TX buffer length. - * @param _rx_buf RX buffer. - * @param _rx_len RX buffer length. - * @param _rx_cnt Number of chunks into which RX buffer is divided. - * @param _log Logging instance, if not provided (empty) then default is used. - */ -#define UART_ASYNC_TO_IRQ_API_CONFIG_INITIALIZER(_api, _trampoline, _baudrate, _tx_buf, \ - _tx_len, _rx_buf, _rx_len, _rx_cnt, _log) \ - { \ - .tx_buf = _tx_buf, \ - .tx_len = _tx_len, \ - .async_rx = { \ - .buffer = _rx_buf, \ - .length = _rx_len, \ - .buf_cnt = _rx_cnt \ - }, \ - .api = _api, \ - .trampoline = _trampoline, \ - .baudrate = _baudrate, \ - LOG_OBJECT_PTR_INIT(log, \ - COND_CODE_1(IS_EMPTY(_log), \ - (LOG_OBJECT_PTR(UART_ASYNC_TO_IRQ_LOG_NAME)), \ - (_log) \ - ) \ - ) \ - } - -/** @brief Initialize the adaptation layer. - * - * @param data Data associated with the given adaptation layer instance. - * @param config Configuration structure. Must be persistent. - * - * @retval 0 On successful initialization. - */ -int uart_async_to_irq_init(struct uart_async_to_irq_data *data, - const struct uart_async_to_irq_config *config); - -/* @brief Enable RX for interrupt driven API. - * - * @param dev UART device. Device must support asynchronous API. - * - * @retval 0 on successful operation. - * @retval -EINVAL if adaption layer has wrong configuration. - * @retval negative value Error reported by the UART API. - */ -int uart_async_to_irq_rx_enable(const struct device *dev); - -/* @brief Disable RX for interrupt driven API. - * - * @param dev UART device. Device must support asynchronous API. - * - * @retval 0 on successful operation. - * @retval -EINVAL if adaption layer has wrong configuration. - * @retval negative value Error reported by the UART API. - */ -int uart_async_to_irq_rx_disable(const struct device *dev); - -/* Starting from here API is internal only. */ - -/** @cond INTERNAL_HIDDEN - * @brief Structure used by the adaptation layer. - */ -struct uart_async_to_irq_config { - /** Pointer to the TX buffer. */ - uint8_t *tx_buf; - - /** TX buffer length. */ - size_t tx_len; - - /** UART Asynchronous RX helper configuration. */ - struct uart_async_rx_config async_rx; - - /** Async API used by the a2i layer. */ - const struct uart_async_to_irq_async_api *api; - - /** Trampoline callback. */ - uart_async_to_irq_trampoline trampoline; - - /** Initial baudrate. */ - uint32_t baudrate; - - /** Instance logging handler. */ - LOG_INSTANCE_PTR_DECLARE(log); -}; - -/** @brief Asynchronous API used by the adaptation layer. */ -struct uart_async_to_irq_async_api { - int (*callback_set)(const struct device *dev, - uart_callback_t callback, - void *user_data); - - int (*tx)(const struct device *dev, const uint8_t *buf, size_t len, - int32_t timeout); - int (*tx_abort)(const struct device *dev); - - int (*rx_enable)(const struct device *dev, uint8_t *buf, size_t len, - int32_t timeout); - int (*rx_buf_rsp)(const struct device *dev, uint8_t *buf, size_t len); - int (*rx_disable)(const struct device *dev); -}; - -/** @brief Structure holding receiver data. */ -struct uart_async_to_irq_rx_data { - /** Asynchronous RX helper data. */ - struct uart_async_rx async_rx; - - /** Semaphore for pending on RX disable. */ - struct k_sem sem; - - /** Number of pending buffer requests which weren't handled because lack of free buffers. */ - atomic_t pending_buf_req; -}; - -/** @brief Structure holding transmitter data. */ -struct uart_async_to_irq_tx_data { - /** TX buffer. */ - uint8_t *buf; - - /** Length of the buffer. */ - size_t len; -}; - -/** @briref Data associated with the asynchronous to the interrupt driven API adaptation layer. */ -struct uart_async_to_irq_data { - /** User callback for interrupt driven API. */ - uart_irq_callback_user_data_t callback; - - /** User data. */ - void *user_data; - - /** Interrupt request counter. */ - atomic_t irq_req; - - /** RX specific data. */ - struct uart_async_to_irq_rx_data rx; - - /** TX specific data. */ - struct uart_async_to_irq_tx_data tx; - - /** Spinlock. */ - struct k_spinlock lock; - - /** Internally used flags for holding the state of the a2i layer. */ - atomic_t flags; -}; - -/** Interrupt driven FIFO fill function. */ -int z_uart_async_to_irq_fifo_fill(const struct device *dev, - const uint8_t *buf, - int len); - -/** Interrupt driven FIFO read function. */ -int z_uart_async_to_irq_fifo_read(const struct device *dev, - uint8_t *buf, - const int len); - -/** Interrupt driven transfer enabling function. */ -void z_uart_async_to_irq_irq_tx_enable(const struct device *dev); - -/** Interrupt driven transfer disabling function */ -void z_uart_async_to_irq_irq_tx_disable(const struct device *dev); - -/** Interrupt driven transfer ready function */ -int z_uart_async_to_irq_irq_tx_ready(const struct device *dev); - -/** Interrupt driven receiver enabling function */ -void z_uart_async_to_irq_irq_rx_enable(const struct device *dev); - -/** Interrupt driven receiver disabling function */ -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); - -/** Interrupt driven receiver ready function */ -int z_uart_async_to_irq_irq_rx_ready(const struct device *dev); - -/** Interrupt driven error enabling function */ -void z_uart_async_to_irq_irq_err_enable(const struct device *dev); - -/** Interrupt driven error disabling function */ -void z_uart_async_to_irq_irq_err_disable(const struct device *dev); - -/** Interrupt driven pending status function */ -int z_uart_async_to_irq_irq_is_pending(const struct device *dev); - -/** Interrupt driven interrupt update function */ -int z_uart_async_to_irq_irq_update(const struct device *dev); - -/** Set the irq callback function */ -void z_uart_async_to_irq_irq_callback_set(const struct device *dev, - uart_irq_callback_user_data_t cb, - void *user_data); - -/** @endcond */ - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#endif /* ZEPHYR_DRIVERS_SERIAL_UART_ASYNC_TO_IRQ_H_ */ From fb292a96917dc20850602a973c3e5a0170310b2b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:44 +0100 Subject: [PATCH 1145/2300] Revert "[nrf fromtree] manifest: hal_nordic: update revision to have nrfx 3.3.0 release" This reverts commit 3723866343b95bd394978d1cfc6b386b465c2296. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 3cfa07c2742..301482839cb 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: b55cfbbf0221d709560c2e438beef66842ada272 + revision: 3786c55424d4d64c62dd25219de31618cef26fdf path: modules/hal/nordic groups: - hal From 250e9474ddfa5d6187cc3b7954d1d993d68fcf55 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:44 +0100 Subject: [PATCH 1146/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx: update API version to 3.2.0" This reverts commit 28ce3be0aee14149702f8eecb09ac0faef063a91. Signed-off-by: Robert Lubos --- drivers/adc/adc_nrfx_saadc.c | 4 +- drivers/display/display_nrf_led_matrix.c | 22 +- drivers/gpio/Kconfig.nrfx | 7 +- drivers/gpio/gpio_nrfx.c | 229 ++++++++----------- drivers/pwm/pwm_nrf_sw.c | 20 +- drivers/spi/spi_nrfx_common.c | 31 +-- drivers/spi/spi_nrfx_common.h | 11 +- drivers/spi/spi_nrfx_spi.c | 7 +- drivers/spi/spi_nrfx_spim.c | 20 +- drivers/watchdog/wdt_nrfx.c | 16 +- modules/hal_nordic/nrfx/nrfx_config.h | 6 + modules/hal_nordic/nrfx/nrfx_config_common.h | 2 +- samples/boards/nrf/nrfx/Kconfig | 10 - samples/boards/nrf/nrfx/prj.conf | 1 + samples/boards/nrf/nrfx/src/main.c | 51 ++--- 15 files changed, 167 insertions(+), 270 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 6d1973ca0aa..72a20f47fc9 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -170,7 +170,7 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx, if (!repeat) { nrf_saadc_buffer_pointer_set( NRF_SAADC, - (uint16_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + + nrf_saadc_buffer_pointer_get(NRF_SAADC) + nrf_saadc_amount_get(NRF_SAADC)); } } @@ -256,7 +256,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, { size_t needed_buffer_size; - needed_buffer_size = active_channels * sizeof(uint16_t); + needed_buffer_size = active_channels * sizeof(nrf_saadc_value_t); if (sequence->options) { needed_buffer_size *= (1 + sequence->options->extra_samplings); } diff --git a/drivers/display/display_nrf_led_matrix.c b/drivers/display/display_nrf_led_matrix.c index e27fb76a92a..dd36126a7ce 100644 --- a/drivers/display/display_nrf_led_matrix.c +++ b/drivers/display/display_nrf_led_matrix.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #ifdef PWM_PRESENT #include @@ -90,8 +89,6 @@ struct display_drv_config { NRF_TIMER_Type *timer; #if USE_PWM NRF_PWM_Type *pwm; -#else - nrfx_gpiote_t gpiote; #endif uint8_t rows[ROW_COUNT]; uint8_t cols[COL_COUNT]; @@ -343,7 +340,7 @@ static void prepare_pixel_pulse(const struct device *dev, /* First timer channel is used for timing the period of pulses. */ nrf_timer_cc_set(dev_config->timer, 1 + channel_idx, pulse); - dev_config->gpiote.p_reg->CONFIG[dev_data->gpiote_ch[channel_idx]] = gpiote_cfg; + NRF_GPIOTE->CONFIG[dev_data->gpiote_ch[channel_idx]] = gpiote_cfg; #endif /* USE_PWM */ } @@ -373,7 +370,7 @@ static void timer_irq_handler(void *arg) } #else for (int i = 0; i < GROUP_SIZE; ++i) { - dev_config->gpiote.p_reg->CONFIG[dev_data->gpiote_ch[i]] = 0; + NRF_GPIOTE->CONFIG[dev_data->gpiote_ch[i]] = 0; } #endif @@ -469,7 +466,7 @@ static int instance_init(const struct device *dev) return -ENOMEM; } - err = nrfx_gpiote_channel_alloc(&dev_config->gpiote, gpiote_ch); + err = nrfx_gpiote_channel_alloc(gpiote_ch); if (err != NRFX_SUCCESS) { LOG_ERR("Failed to allocate GPIOTE channel."); /* Do not bother with freeing resources allocated @@ -482,7 +479,7 @@ static int instance_init(const struct device *dev) nrf_ppi_channel_endpoint_setup(NRF_PPI, ppi_ch, nrf_timer_event_address_get(dev_config->timer, nrf_timer_compare_event_get(1 + i)), - nrf_gpiote_event_address_get(dev_config->gpiote.p_reg, + nrf_gpiote_event_address_get(NRF_GPIOTE, nrf_gpiote_out_task_get(*gpiote_ch))); nrf_ppi_channel_enable(NRF_PPI, ppi_ch); } @@ -533,14 +530,6 @@ static struct display_drv_data instance_data = { .blanking = true, }; -#if !USE_PWM -#define CHECK_GPIOTE_INST(node_id, prop, idx) \ - BUILD_ASSERT(NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, idx) == \ - NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, 0), \ - "All column GPIOs must use the same GPIOTE instance"); -DT_FOREACH_PROP_ELEM(MATRIX_NODE, col_gpios, CHECK_GPIOTE_INST) -#endif - #define GET_PIN_INFO(node_id, pha, idx) \ (DT_GPIO_PIN_BY_IDX(node_id, pha, idx) | \ (DT_PROP_BY_PHANDLE_IDX(node_id, pha, idx, port) << 5) | \ @@ -557,9 +546,6 @@ static const struct display_drv_config instance_config = { .timer = (NRF_TIMER_Type *)DT_REG_ADDR(TIMER_NODE), #if USE_PWM .pwm = (NRF_PWM_Type *)DT_REG_ADDR(PWM_NODE), -#else - .gpiote = NRFX_GPIOTE_INSTANCE( - NRF_DT_GPIOTE_INST_BY_IDX(MATRIX_NODE, col_gpios, 0)), #endif .rows = { DT_FOREACH_PROP_ELEM(MATRIX_NODE, row_gpios, GET_PIN_INFO) }, .cols = { DT_FOREACH_PROP_ELEM(MATRIX_NODE, col_gpios, GET_PIN_INFO) }, diff --git a/drivers/gpio/Kconfig.nrfx b/drivers/gpio/Kconfig.nrfx index 760a45204fd..356c43cb5fa 100644 --- a/drivers/gpio/Kconfig.nrfx +++ b/drivers/gpio/Kconfig.nrfx @@ -5,12 +5,7 @@ menuconfig GPIO_NRFX bool "nRF GPIO driver" default y depends on DT_HAS_NORDIC_NRF_GPIO_ENABLED - select NRFX_GPIOTE0 if HAS_HW_NRF_GPIOTE0 - select NRFX_GPIOTE1 if HAS_HW_NRF_GPIOTE1 - select NRFX_GPIOTE20 if HAS_HW_NRF_GPIOTE20 - select NRFX_GPIOTE30 if HAS_HW_NRF_GPIOTE30 - select NRFX_GPIOTE130 if HAS_HW_NRF_GPIOTE130 - select NRFX_GPIOTE131 if HAS_HW_NRF_GPIOTE131 + select NRFX_GPIOTE help Enable GPIO driver for nRF line of MCUs. diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index d89c964cc90..0aa282dda37 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: Apache-2.0 */ - #define DT_DRV_COMPAT nordic_nrf_gpio #include @@ -26,7 +25,6 @@ struct gpio_nrfx_cfg { NRF_GPIO_Type *port; uint32_t edge_sense; uint8_t port_num; - nrfx_gpiote_t gpiote; }; static inline struct gpio_nrfx_data *get_port_data(const struct device *port) @@ -39,139 +37,131 @@ static inline const struct gpio_nrfx_cfg *get_port_cfg(const struct device *port return port->config; } -static bool has_gpiote(const struct gpio_nrfx_cfg *cfg) -{ - return cfg->gpiote.p_reg != NULL; -} - -static nrf_gpio_pin_pull_t get_pull(gpio_flags_t flags) -{ - if (flags & GPIO_PULL_UP) { - return NRF_GPIO_PIN_PULLUP; - } else if (flags & GPIO_PULL_DOWN) { - return NRF_GPIO_PIN_PULLDOWN; - } - - return NRF_GPIO_PIN_NOPULL; -} - -static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, - gpio_flags_t flags) +static int get_drive(gpio_flags_t flags, nrf_gpio_pin_drive_t *drive) { - nrfx_err_t err = NRFX_SUCCESS; - uint8_t ch; - bool free_ch = false; - const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); - nrfx_gpiote_pin_t abs_pin = NRF_GPIO_PIN_MAP(cfg->port_num, pin); - nrf_gpio_pin_pull_t pull = get_pull(flags); - nrf_gpio_pin_drive_t drive; - switch (flags & (NRF_GPIO_DRIVE_MSK | GPIO_OPEN_DRAIN)) { case NRF_GPIO_DRIVE_S0S1: - drive = NRF_GPIO_PIN_S0S1; + *drive = NRF_GPIO_PIN_S0S1; break; case NRF_GPIO_DRIVE_S0H1: - drive = NRF_GPIO_PIN_S0H1; + *drive = NRF_GPIO_PIN_S0H1; break; case NRF_GPIO_DRIVE_H0S1: - drive = NRF_GPIO_PIN_H0S1; + *drive = NRF_GPIO_PIN_H0S1; break; case NRF_GPIO_DRIVE_H0H1: - drive = NRF_GPIO_PIN_H0H1; + *drive = NRF_GPIO_PIN_H0H1; break; case NRF_GPIO_DRIVE_S0 | GPIO_OPEN_DRAIN: - drive = NRF_GPIO_PIN_S0D1; + *drive = NRF_GPIO_PIN_S0D1; break; case NRF_GPIO_DRIVE_H0 | GPIO_OPEN_DRAIN: - drive = NRF_GPIO_PIN_H0D1; + *drive = NRF_GPIO_PIN_H0D1; break; case NRF_GPIO_DRIVE_S1 | GPIO_OPEN_SOURCE: - drive = NRF_GPIO_PIN_D0S1; + *drive = NRF_GPIO_PIN_D0S1; break; case NRF_GPIO_DRIVE_H1 | GPIO_OPEN_SOURCE: - drive = NRF_GPIO_PIN_D0H1; + *drive = NRF_GPIO_PIN_D0H1; break; default: return -EINVAL; } - if (flags & GPIO_OUTPUT_INIT_HIGH) { - nrf_gpio_port_out_set(cfg->port, BIT(pin)); - } else if (flags & GPIO_OUTPUT_INIT_LOW) { - nrf_gpio_port_out_clear(cfg->port, BIT(pin)); + return 0; +} + +static nrf_gpio_pin_pull_t get_pull(gpio_flags_t flags) +{ + if (flags & GPIO_PULL_UP) { + return NRF_GPIO_PIN_PULLUP; + } else if (flags & GPIO_PULL_DOWN) { + return NRF_GPIO_PIN_PULLDOWN; } - if (!has_gpiote(cfg)) { - nrf_gpio_pin_dir_t dir = (flags & GPIO_OUTPUT) - ? NRF_GPIO_PIN_DIR_OUTPUT - : NRF_GPIO_PIN_DIR_INPUT; - nrf_gpio_pin_input_t input = (flags & GPIO_INPUT) - ? NRF_GPIO_PIN_INPUT_CONNECT - : NRF_GPIO_PIN_INPUT_DISCONNECT; + return NRF_GPIO_PIN_NOPULL; +} - nrf_gpio_reconfigure(abs_pin, &dir, &input, &pull, &drive, NULL); - return 0; - } +static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, + gpio_flags_t flags) +{ + nrfx_err_t err = NRFX_SUCCESS; + uint8_t ch; + bool free_ch = false; + const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); + nrfx_gpiote_pin_t abs_pin = NRF_GPIO_PIN_MAP(cfg->port_num, pin); /* Get the GPIOTE channel associated with this pin, if any. It needs * to be freed when the pin is reconfigured or disconnected. */ if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT)) { - err = nrfx_gpiote_channel_get(&cfg->gpiote, abs_pin, &ch); + err = nrfx_gpiote_channel_get(abs_pin, &ch); free_ch = (err == NRFX_SUCCESS); } if ((flags & (GPIO_INPUT | GPIO_OUTPUT)) == GPIO_DISCONNECTED) { /* Ignore the error code. The pin may not have been used. */ - (void)nrfx_gpiote_pin_uninit(&cfg->gpiote, abs_pin); - } else { - /* Remove previously configured trigger when pin is reconfigured. */ - if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT)) { - nrfx_gpiote_trigger_config_t trigger_config = { - .trigger = NRFX_GPIOTE_TRIGGER_NONE, - }; - nrfx_gpiote_input_pin_config_t input_pin_config = { - .p_trigger_config = &trigger_config, - }; - - err = nrfx_gpiote_input_configure(&cfg->gpiote, - abs_pin, &input_pin_config); - if (err != NRFX_SUCCESS) { - return -EINVAL; - } - } + (void)nrfx_gpiote_pin_uninit(abs_pin); - if (flags & GPIO_OUTPUT) { - nrfx_gpiote_output_config_t output_config = { - .drive = drive, - .input_connect = (flags & GPIO_INPUT) - ? NRF_GPIO_PIN_INPUT_CONNECT - : NRF_GPIO_PIN_INPUT_DISCONNECT, - .pull = pull, - }; - - err = nrfx_gpiote_output_configure(&cfg->gpiote, - abs_pin, &output_config, NULL); - } else { - nrfx_gpiote_input_pin_config_t input_pin_config = { - .p_pull_config = &pull, - }; - - err = nrfx_gpiote_input_configure(&cfg->gpiote, - abs_pin, &input_pin_config); + if (free_ch) { + err = nrfx_gpiote_channel_free(ch); + __ASSERT_NO_MSG(err == NRFX_SUCCESS); } + return 0; + } + + if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT)) { + nrfx_gpiote_trigger_config_t trigger_config = { + .trigger = NRFX_GPIOTE_TRIGGER_NONE + }; + + /* Remove previously configured trigger when pin is reconfigured. */ + err = nrfx_gpiote_input_configure(abs_pin, NULL, &trigger_config, NULL); if (err != NRFX_SUCCESS) { return -EINVAL; } + + if (free_ch) { + err = nrfx_gpiote_channel_free(ch); + __ASSERT_NO_MSG(err == NRFX_SUCCESS); + } } - if (IS_ENABLED(CONFIG_GPIO_NRFX_INTERRUPT) && free_ch) { - err = nrfx_gpiote_channel_free(&cfg->gpiote, ch); - __ASSERT_NO_MSG(err == NRFX_SUCCESS); + if (flags & GPIO_OUTPUT) { + nrf_gpio_pin_drive_t drive; + int rv = get_drive(flags, &drive); + + if (rv != 0) { + return rv; + } + + nrfx_gpiote_output_config_t output_config = { + .drive = drive, + .input_connect = (flags & GPIO_INPUT) ? + NRF_GPIO_PIN_INPUT_CONNECT : + NRF_GPIO_PIN_INPUT_DISCONNECT, + .pull = get_pull(flags) + }; + + + if (flags & GPIO_OUTPUT_INIT_HIGH) { + nrf_gpio_port_out_set(cfg->port, BIT(pin)); + } else if (flags & GPIO_OUTPUT_INIT_LOW) { + nrf_gpio_port_out_clear(cfg->port, BIT(pin)); + } + + err = nrfx_gpiote_output_configure(abs_pin, &output_config, NULL); + return (err != NRFX_SUCCESS) ? -EINVAL : 0; } - return 0; + nrfx_gpiote_input_config_t input_config = { + .pull = get_pull(flags) + }; + + err = nrfx_gpiote_input_configure(abs_pin, &input_config, NULL, NULL); + + return (err != NRFX_SUCCESS) ? -EINVAL : 0; } static int gpio_nrfx_port_get_raw(const struct device *port, @@ -252,17 +242,12 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, enum gpio_int_mode mode, enum gpio_int_trig trig) { - const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); - uint32_t abs_pin = NRF_GPIO_PIN_MAP(cfg->port_num, pin); + uint32_t abs_pin = NRF_GPIO_PIN_MAP(get_port_cfg(port)->port_num, pin); nrfx_err_t err; uint8_t ch; - if (!has_gpiote(cfg)) { - return -ENOTSUP; - } - if (mode == GPIO_INT_MODE_DISABLED) { - nrfx_gpiote_trigger_disable(&cfg->gpiote, abs_pin); + nrfx_gpiote_trigger_disable(abs_pin); return 0; } @@ -270,19 +255,16 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, nrfx_gpiote_trigger_config_t trigger_config = { .trigger = get_trigger(mode, trig), }; - nrfx_gpiote_input_pin_config_t input_pin_config = { - .p_trigger_config = &trigger_config, - }; /* If edge mode is to be used and pin is not configured to use sense for * edge use IN event. */ - if (!(BIT(pin) & cfg->edge_sense) && + if (!(BIT(pin) & get_port_cfg(port)->edge_sense) && (mode == GPIO_INT_MODE_EDGE) && (nrf_gpio_pin_dir_get(abs_pin) == NRF_GPIO_PIN_DIR_INPUT)) { - err = nrfx_gpiote_channel_get(&cfg->gpiote, abs_pin, &ch); + err = nrfx_gpiote_channel_get(abs_pin, &ch); if (err == NRFX_ERROR_INVALID_PARAM) { - err = nrfx_gpiote_channel_alloc(&cfg->gpiote, &ch); + err = nrfx_gpiote_channel_alloc(&ch); if (err != NRFX_SUCCESS) { return -ENOMEM; } @@ -291,12 +273,12 @@ static int gpio_nrfx_pin_interrupt_configure(const struct device *port, trigger_config.p_in_channel = &ch; } - err = nrfx_gpiote_input_configure(&cfg->gpiote, abs_pin, &input_pin_config); + err = nrfx_gpiote_input_configure(abs_pin, NULL, &trigger_config, NULL); if (err != NRFX_SUCCESS) { return -EINVAL; } - nrfx_gpiote_trigger_enable(&cfg->gpiote, abs_pin, true); + nrfx_gpiote_trigger_enable(abs_pin, true); return 0; } @@ -385,31 +367,26 @@ static void nrfx_gpio_handler(nrfx_gpiote_pin_t abs_pin, } #endif /* CONFIG_GPIO_NRFX_INTERRUPT */ -#define GPIOTE_IRQ_HANDLER_CONNECT(node_id) \ - IRQ_CONNECT(DT_IRQN(node_id), DT_IRQ(node_id, priority), nrfx_isr, \ - NRFX_CONCAT(nrfx_gpiote_, DT_PROP(node_id, instance), _irq_handler), 0); +#define GPIOTE_NODE DT_INST(0, nordic_nrf_gpiote) static int gpio_nrfx_init(const struct device *port) { - const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); nrfx_err_t err; - if (!has_gpiote(cfg)) { - return 0; - } - - if (nrfx_gpiote_init_check(&cfg->gpiote)) { + if (nrfx_gpiote_is_init()) { return 0; } - err = nrfx_gpiote_init(&cfg->gpiote, 0 /*not used*/); + err = nrfx_gpiote_init(0/*not used*/); if (err != NRFX_SUCCESS) { return -EIO; } #ifdef CONFIG_GPIO_NRFX_INTERRUPT - nrfx_gpiote_global_callback_set(&cfg->gpiote, nrfx_gpio_handler, NULL); - DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_IRQ_HANDLER_CONNECT); + nrfx_gpiote_global_callback_set(nrfx_gpio_handler, NULL); + + IRQ_CONNECT(DT_IRQN(GPIOTE_NODE), DT_IRQ(GPIOTE_NODE, priority), + nrfx_isr, nrfx_gpiote_irq_handler, 0); #endif /* CONFIG_GPIO_NRFX_INTERRUPT */ return 0; @@ -431,27 +408,12 @@ static const struct gpio_driver_api gpio_nrfx_drv_api_funcs = { #endif }; -#define GPIOTE_PHANDLE(id) DT_INST_PHANDLE(id, gpiote_instance) -#define GPIOTE_INST(id) DT_PROP(GPIOTE_PHANDLE(id), instance) - -#define GPIOTE_INSTANCE(id) \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(id, gpiote_instance), \ - (NRFX_GPIOTE_INSTANCE(GPIOTE_INST(id))), \ - ({ .p_reg = NULL })) - /* Device instantiation is done with node labels because 'port_num' is * the peripheral number by SoC numbering. We therefore cannot use * DT_INST APIs here without wider changes. */ -#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), \ - "Please enable GPIOTE instance for used GPIO port!")), \ - ()) - #define GPIO_NRF_DEVICE(id) \ - GPIOTE_CHECK(id); \ static const struct gpio_nrfx_cfg gpio_nrfx_p##id##_cfg = { \ .common = { \ .port_pin_mask = \ @@ -459,8 +421,7 @@ static const struct gpio_driver_api gpio_nrfx_drv_api_funcs = { }, \ .port = _CONCAT(NRF_P, DT_INST_PROP(id, port)), \ .port_num = DT_INST_PROP(id, port), \ - .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0), \ - .gpiote = GPIOTE_INSTANCE(id), \ + .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0) \ }; \ \ static struct gpio_nrfx_data gpio_nrfx_p##id##_data; \ diff --git a/drivers/pwm/pwm_nrf_sw.c b/drivers/pwm/pwm_nrf_sw.c index 2b9a22a38f0..f367bb59899 100644 --- a/drivers/pwm/pwm_nrf_sw.c +++ b/drivers/pwm/pwm_nrf_sw.c @@ -62,7 +62,6 @@ struct pwm_config { NRF_RTC_Type *rtc; NRF_TIMER_Type *timer; }; - nrfx_gpiote_t gpiote[PWM_0_MAP_SIZE]; uint8_t psel_ch[PWM_0_MAP_SIZE]; uint8_t initially_inverted; uint8_t map_size; @@ -124,7 +123,6 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, const struct pwm_config *config = dev->config; NRF_TIMER_Type *timer = pwm_config_timer(config); NRF_RTC_Type *rtc = pwm_config_rtc(config); - NRF_GPIOTE_Type *gpiote; struct pwm_data *data = dev->data; uint32_t ppi_mask; uint8_t active_level; @@ -163,7 +161,6 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, } } - gpiote = config->gpiote[channel].p_reg; psel_ch = config->psel_ch[channel]; gpiote_ch = data->gpiote_ch[channel]; ppi_chs = data->ppi_ch[channel]; @@ -189,7 +186,7 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, : active_level); /* clear GPIOTE config */ - nrf_gpiote_te_default(gpiote, gpiote_ch); + nrf_gpiote_te_default(NRF_GPIOTE, gpiote_ch); /* No PWM generation for this channel. */ data->pulse_cycles[channel] = 0U; @@ -238,7 +235,7 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, } /* Configure GPIOTE - toggle task with proper initial output value. */ - gpiote->CONFIG[gpiote_ch] = + NRF_GPIOTE->CONFIG[gpiote_ch] = (GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos) | ((uint32_t)psel_ch << 8) | (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos) | @@ -259,9 +256,9 @@ static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel, pulse_end_task = period_end_task = nrf_gpiote_out_task_get(gpiote_ch); #endif uint32_t pulse_end_task_address = - nrf_gpiote_task_address_get(gpiote, pulse_end_task); + nrf_gpiote_task_address_get(NRF_GPIOTE, pulse_end_task); uint32_t period_end_task_address = - nrf_gpiote_task_address_get(gpiote, period_end_task); + nrf_gpiote_task_address_get(NRF_GPIOTE, period_end_task); if (USE_RTC) { uint32_t clear_task_address = @@ -362,8 +359,7 @@ static int pwm_nrf_sw_init(const struct device *dev) } } - err = nrfx_gpiote_channel_alloc(&config->gpiote[i], - &data->gpiote_ch[i]); + err = nrfx_gpiote_channel_alloc(&data->gpiote_ch[i]); if (err != NRFX_SUCCESS) { /* Do not free allocated resource. It is a fatal condition, * system requires reconfiguration. @@ -406,14 +402,8 @@ static int pwm_nrf_sw_init(const struct device *dev) ((DT_GPIO_FLAGS_BY_IDX(_node_id, _prop, _idx) & GPIO_ACTIVE_LOW) \ ? BIT(_idx) : 0) | -#define GPIOTE_AND_COMMA(_node_id, _prop, _idx) \ - NRFX_GPIOTE_INSTANCE(NRF_DT_GPIOTE_INST_BY_IDX(_node_id, _prop, _idx)), - static const struct pwm_config pwm_nrf_sw_0_config = { COND_CODE_1(USE_RTC, (.rtc), (.timer)) = GENERATOR_ADDR, - .gpiote = { - DT_INST_FOREACH_PROP_ELEM(0, channel_gpios, GPIOTE_AND_COMMA) - }, .psel_ch = { DT_INST_FOREACH_PROP_ELEM(0, channel_gpios, PSEL_AND_COMMA) }, diff --git a/drivers/spi/spi_nrfx_common.c b/drivers/spi/spi_nrfx_common.c index 04a11c2367a..1ef233cfab3 100644 --- a/drivers/spi/spi_nrfx_common.c +++ b/drivers/spi/spi_nrfx_common.c @@ -6,39 +6,40 @@ #include "spi_nrfx_common.h" #include +#include -int spi_nrfx_wake_init(const nrfx_gpiote_t *gpiote, uint32_t wake_pin) +int spi_nrfx_wake_init(uint32_t wake_pin) { - nrf_gpio_pin_pull_t pull_config = NRF_GPIO_PIN_PULLDOWN; + nrfx_gpiote_input_config_t input_config = { + .pull = NRF_GPIO_PIN_PULLDOWN, + }; uint8_t ch; nrfx_gpiote_trigger_config_t trigger_config = { .trigger = NRFX_GPIOTE_TRIGGER_HITOLO, .p_in_channel = &ch, }; - nrfx_gpiote_input_pin_config_t input_config = { - .p_pull_config = &pull_config, - .p_trigger_config = &trigger_config, - .p_handler_config = NULL, - }; nrfx_err_t res; - res = nrfx_gpiote_channel_alloc(gpiote, &ch); + res = nrfx_gpiote_channel_alloc(&ch); if (res != NRFX_SUCCESS) { return -ENODEV; } - res = nrfx_gpiote_input_configure(gpiote, wake_pin, &input_config); + res = nrfx_gpiote_input_configure(wake_pin, + &input_config, + &trigger_config, + NULL); if (res != NRFX_SUCCESS) { - nrfx_gpiote_channel_free(gpiote, ch); + nrfx_gpiote_channel_free(ch); return -EIO; } return 0; } -int spi_nrfx_wake_request(const nrfx_gpiote_t *gpiote, uint32_t wake_pin) +int spi_nrfx_wake_request(uint32_t wake_pin) { - nrf_gpiote_event_t trigger_event = nrfx_gpiote_in_event_get(gpiote, wake_pin); + nrf_gpiote_event_t trigger_event = nrfx_gpiote_in_event_get(wake_pin); uint32_t start_cycles; uint32_t max_wait_cycles = DIV_ROUND_UP(CONFIG_SPI_NRFX_WAKE_TIMEOUT_US * @@ -50,7 +51,7 @@ int spi_nrfx_wake_request(const nrfx_gpiote_t *gpiote, uint32_t wake_pin) * The expected time to wait is quite short so it is not worth paying * the overhead of context switching to handle the interrupt. */ - nrfx_gpiote_trigger_enable(gpiote, wake_pin, false); + nrfx_gpiote_trigger_enable(wake_pin, false); /* Enable pull-up on the WAKE line. After the slave device sees the * WAKE line going high, it will force the line to go low. This will * be caught by the enabled trigger and the loop below waits for that. @@ -58,7 +59,7 @@ int spi_nrfx_wake_request(const nrfx_gpiote_t *gpiote, uint32_t wake_pin) nrf_gpio_cfg_input(wake_pin, NRF_GPIO_PIN_PULLUP); start_cycles = k_cycle_get_32(); - while (!nrf_gpiote_event_check(gpiote->p_reg, trigger_event)) { + while (!nrf_gpiote_event_check(NRF_GPIOTE, trigger_event)) { uint32_t elapsed_cycles = k_cycle_get_32() - start_cycles; if (elapsed_cycles >= max_wait_cycles) { @@ -67,7 +68,7 @@ int spi_nrfx_wake_request(const nrfx_gpiote_t *gpiote, uint32_t wake_pin) } } - nrfx_gpiote_trigger_disable(gpiote, wake_pin); + nrfx_gpiote_trigger_disable(wake_pin); nrf_gpio_cfg_input(wake_pin, NRF_GPIO_PIN_PULLDOWN); return err; diff --git a/drivers/spi/spi_nrfx_common.h b/drivers/spi/spi_nrfx_common.h index 0cf17e2a035..515ed5c6f1f 100644 --- a/drivers/spi/spi_nrfx_common.h +++ b/drivers/spi/spi_nrfx_common.h @@ -8,17 +8,10 @@ #define ZEPHYR_DRIVERS_SPI_NRFX_COMMON_H_ #include -#include #define WAKE_PIN_NOT_USED UINT32_MAX -#define WAKE_GPIOTE_INSTANCE(node_id) \ - COND_CODE_1(DT_NODE_HAS_PROP(node_id, wake_gpios), \ - (NRFX_GPIOTE_INSTANCE( \ - NRF_DT_GPIOTE_INST(node_id, wake_gpios))), \ - ({0})) - -int spi_nrfx_wake_init(const nrfx_gpiote_t *gpiote, uint32_t wake_pin); -int spi_nrfx_wake_request(const nrfx_gpiote_t *gpiote, uint32_t wake_pin); +int spi_nrfx_wake_init(uint32_t wake_pin); +int spi_nrfx_wake_request(uint32_t wake_pin); #endif /* ZEPHYR_DRIVERS_SPI_NRFX_COMMON_H_ */ diff --git a/drivers/spi/spi_nrfx_spi.c b/drivers/spi/spi_nrfx_spi.c index 04d7853d11d..fd1dc5d933c 100644 --- a/drivers/spi/spi_nrfx_spi.c +++ b/drivers/spi/spi_nrfx_spi.c @@ -31,7 +31,6 @@ struct spi_nrfx_config { void (*irq_connect)(void); const struct pinctrl_dev_config *pcfg; uint32_t wake_pin; - nrfx_gpiote_t wake_gpiote; }; static void event_handler(const nrfx_spi_evt_t *p_event, void *p_context); @@ -238,8 +237,7 @@ static int transceive(const struct device *dev, dev_data->busy = true; if (dev_config->wake_pin != WAKE_PIN_NOT_USED) { - error = spi_nrfx_wake_request(&dev_config->wake_gpiote, - dev_config->wake_pin); + error = spi_nrfx_wake_request(dev_config->wake_pin); if (error == -ETIMEDOUT) { LOG_WRN("Waiting for WAKE acknowledgment timed out"); /* If timeout occurs, try to perform the transfer @@ -383,7 +381,7 @@ static int spi_nrfx_init(const struct device *dev) } if (dev_config->wake_pin != WAKE_PIN_NOT_USED) { - err = spi_nrfx_wake_init(&dev_config->wake_gpiote, dev_config->wake_pin); + err = spi_nrfx_wake_init(dev_config->wake_pin); if (err == -ENODEV) { LOG_ERR("Failed to allocate GPIOTE channel for WAKE"); return err; @@ -446,7 +444,6 @@ static int spi_nrfx_init(const struct device *dev) .pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPI(idx)), \ .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPI(idx), wake_gpios, \ WAKE_PIN_NOT_USED), \ - .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPI(idx)), \ }; \ BUILD_ASSERT(!DT_NODE_HAS_PROP(SPI(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPI(idx), wake_gpios) & GPIO_ACTIVE_LOW), \ diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index fb89f096cca..8b187f54c52 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -9,6 +9,7 @@ #include #include #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 +#include #include #endif #include @@ -60,7 +61,6 @@ struct spi_nrfx_config { bool anomaly_58_workaround; #endif uint32_t wake_pin; - nrfx_gpiote_t wake_gpiote; }; static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context); @@ -204,8 +204,6 @@ static int configure(const struct device *dev, } #ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 -static const nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE(0); - /* * Brief Workaround for transmitting 1 byte with SPIM. * @@ -225,15 +223,15 @@ static void anomaly_58_workaround_setup(const struct device *dev) NRF_SPIM_Type *spim = dev_config->spim.p_reg; uint32_t ppi_ch = dev_data->ppi_ch; uint32_t gpiote_ch = dev_data->gpiote_ch; - uint32_t eep = (uint32_t)&gpiote.p_reg->EVENTS_IN[gpiote_ch]; + uint32_t eep = (uint32_t)&NRF_GPIOTE->EVENTS_IN[gpiote_ch]; uint32_t tep = (uint32_t)&spim->TASKS_STOP; dev_data->anomaly_58_workaround_active = true; /* Create an event when SCK toggles */ - nrf_gpiote_event_configure(gpiote.p_reg, gpiote_ch, spim->PSEL.SCK, + nrf_gpiote_event_configure(NRF_GPIOTE, gpiote_ch, spim->PSEL.SCK, GPIOTE_CONFIG_POLARITY_Toggle); - nrf_gpiote_event_enable(gpiote.p_reg, gpiote_ch); + nrf_gpiote_event_enable(NRF_GPIOTE, gpiote_ch); /* Stop the spim instance when SCK toggles */ nrf_ppi_channel_endpoint_setup(NRF_PPI, ppi_ch, eep, tep); @@ -252,7 +250,7 @@ static void anomaly_58_workaround_clear(struct spi_nrfx_data *dev_data) if (dev_data->anomaly_58_workaround_active) { nrf_ppi_channel_disable(NRF_PPI, ppi_ch); - nrf_gpiote_task_disable(gpiote.p_reg, gpiote_ch); + nrf_gpiote_task_disable(NRF_GPIOTE, gpiote_ch); dev_data->anomaly_58_workaround_active = false; } @@ -273,7 +271,7 @@ static int anomaly_58_workaround_init(const struct device *dev) return -ENODEV; } - err_code = nrfx_gpiote_channel_alloc(&gpiote, &dev_data->gpiote_ch); + err_code = nrfx_gpiote_channel_alloc(&dev_data->gpiote_ch); if (err_code != NRFX_SUCCESS) { LOG_ERR("Failed to allocate GPIOTE channel"); return -ENODEV; @@ -401,8 +399,7 @@ static int transceive(const struct device *dev, dev_data->busy = true; if (dev_config->wake_pin != WAKE_PIN_NOT_USED) { - error = spi_nrfx_wake_request(&dev_config->wake_gpiote, - dev_config->wake_pin); + error = spi_nrfx_wake_request(dev_config->wake_pin); if (error == -ETIMEDOUT) { LOG_WRN("Waiting for WAKE acknowledgment timed out"); /* If timeout occurs, try to perform the transfer @@ -550,7 +547,7 @@ static int spi_nrfx_init(const struct device *dev) } if (dev_config->wake_pin != WAKE_PIN_NOT_USED) { - err = spi_nrfx_wake_init(&dev_config->wake_gpiote, dev_config->wake_pin); + err = spi_nrfx_wake_init(dev_config->wake_pin); if (err == -ENODEV) { LOG_ERR("Failed to allocate GPIOTE channel for WAKE"); return err; @@ -637,7 +634,6 @@ static int spi_nrfx_init(const struct device *dev) ()) \ .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPIM(idx), wake_gpios, \ WAKE_PIN_NOT_USED), \ - .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \ }; \ BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIM(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ diff --git a/drivers/watchdog/wdt_nrfx.c b/drivers/watchdog/wdt_nrfx.c index 8967d1e162b..363a1174e91 100644 --- a/drivers/watchdog/wdt_nrfx.c +++ b/drivers/watchdog/wdt_nrfx.c @@ -145,12 +145,8 @@ static const struct wdt_driver_api wdt_nrfx_driver_api = { .feed = wdt_nrf_feed, }; -static void wdt_event_handler(const struct device *dev, nrf_wdt_event_t event_type, - uint32_t requests, void *p_context) +static void wdt_event_handler(const struct device *dev, uint32_t requests) { - (void)event_type; - (void)p_context; - struct wdt_nrfx_data *data = dev->data; while (requests) { @@ -166,12 +162,9 @@ static void wdt_event_handler(const struct device *dev, nrf_wdt_event_t event_ty #define WDT(idx) DT_NODELABEL(wdt##idx) #define WDT_NRFX_WDT_DEVICE(idx) \ - static void wdt_##idx##_event_handler(nrf_wdt_event_t event_type, \ - uint32_t requests, \ - void *p_context) \ + static void wdt_##idx##_event_handler(uint32_t requests) \ { \ - wdt_event_handler(DEVICE_DT_GET(WDT(idx)), event_type, \ - requests, p_context); \ + wdt_event_handler(DEVICE_DT_GET(WDT(idx)), requests); \ } \ static int wdt_##idx##_init(const struct device *dev) \ { \ @@ -181,8 +174,7 @@ static void wdt_event_handler(const struct device *dev, nrf_wdt_event_t event_ty nrfx_isr, nrfx_wdt_##idx##_irq_handler, 0); \ err_code = nrfx_wdt_init(&config->wdt, \ NULL, \ - wdt_##idx##_event_handler, \ - NULL); \ + wdt_##idx##_event_handler); \ if (err_code != NRFX_SUCCESS) { \ return -EBUSY; \ } \ diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 57417644c32..72617325684 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -9,6 +9,12 @@ #include +/* + * NRFX API version 2.10 flag. + * When the flag is set NRFX API is compatible with the newest NRFX release. + */ +#define NRFX_CONFIG_API_VER_2_10 1 + /* * These are mappings of Kconfig options enabling nrfx drivers and particular * peripheral instances to the corresponding symbols used inside of nrfx. diff --git a/modules/hal_nordic/nrfx/nrfx_config_common.h b/modules/hal_nordic/nrfx/nrfx_config_common.h index 28a3a15b0de..8c0a58713a0 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 2 +#define NRFX_CONFIG_API_VER_MINOR 0 #endif /** @brief Symbol specifying micro version of the nrfx API to be used. */ diff --git a/samples/boards/nrf/nrfx/Kconfig b/samples/boards/nrf/nrfx/Kconfig index 09076c9da49..0d54067202a 100644 --- a/samples/boards/nrf/nrfx/Kconfig +++ b/samples/boards/nrf/nrfx/Kconfig @@ -7,14 +7,4 @@ config NRFX_DPPI config NRFX_PPI default HAS_HW_NRF_PPI -config NRFX_GPIOTE0 - default y if SOC_SERIES_NRF51X || \ - SOC_SERIES_NRF52X || \ - (SOC_SERIES_NRF53X && !TRUSTED_EXECUTION_NONSECURE) || \ - (SOC_SERIES_NRF91X && !TRUSTED_EXECUTION_NONSECURE) - -config NRFX_GPIOTE1 - default y if (SOC_SERIES_NRF53X && TRUSTED_EXECUTION_NONSECURE) || \ - (SOC_SERIES_NRF91X && TRUSTED_EXECUTION_NONSECURE) - source "Kconfig.zephyr" diff --git a/samples/boards/nrf/nrfx/prj.conf b/samples/boards/nrf/nrfx/prj.conf index d4f0c29699f..32cbfc3279c 100644 --- a/samples/boards/nrf/nrfx/prj.conf +++ b/samples/boards/nrf/nrfx/prj.conf @@ -1,3 +1,4 @@ CONFIG_GPIO=n +CONFIG_NRFX_GPIOTE=y CONFIG_LOG=y CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100 diff --git a/samples/boards/nrf/nrfx/src/main.c b/samples/boards/nrf/nrfx/src/main.c index 0643b1c0911..615b800545e 100644 --- a/samples/boards/nrf/nrfx/src/main.c +++ b/samples/boards/nrf/nrfx/src/main.c @@ -21,15 +21,6 @@ LOG_MODULE_REGISTER(nrfx_sample, LOG_LEVEL_INF); #define INPUT_PIN DT_GPIO_PIN(DT_ALIAS(sw0), gpios) #define OUTPUT_PIN DT_GPIO_PIN(DT_ALIAS(led0), gpios) -#define GPIOTE_INST NRF_DT_GPIOTE_INST(DT_ALIAS(sw0), gpios) -#define GPIOTE_NODE DT_NODELABEL(_CONCAT(gpiote, GPIOTE_INST)) - -BUILD_ASSERT(NRF_DT_GPIOTE_INST(DT_ALIAS(led0), gpios) == GPIOTE_INST, - "Both sw0 and led0 GPIOs must use the same GPIOTE instance"); -BUILD_ASSERT(IS_ENABLED(_CONCAT(CONFIG_, _CONCAT(NRFX_GPIOTE, GPIOTE_INST))), - "NRFX_GPIOTE" STRINGIFY(GPIOTE_INST) " must be enabled in Kconfig"); - - static void button_handler(nrfx_gpiote_pin_t pin, nrfx_gpiote_trigger_t trigger, void *context) @@ -44,28 +35,28 @@ int main(void) nrfx_err_t err; uint8_t in_channel, out_channel; uint8_t ppi_channel; - const nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE(GPIOTE_INST); - /* Connect GPIOTE instance IRQ to irq handler */ - IRQ_CONNECT(DT_IRQN(GPIOTE_NODE), DT_IRQ(GPIOTE_NODE, priority), nrfx_isr, - NRFX_CONCAT(nrfx_gpiote_, GPIOTE_INST, _irq_handler), 0); + /* Connect GPIOTE_0 IRQ to nrfx_gpiote_irq_handler */ + IRQ_CONNECT(DT_IRQN(DT_NODELABEL(gpiote)), + DT_IRQ(DT_NODELABEL(gpiote), priority), + nrfx_isr, nrfx_gpiote_irq_handler, 0); /* Initialize GPIOTE (the interrupt priority passed as the parameter * here is ignored, see nrfx_glue.h). */ - err = nrfx_gpiote_init(&gpiote, 0); + err = nrfx_gpiote_init(0); if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_gpiote_init error: 0x%08X", err); return 0; } - err = nrfx_gpiote_channel_alloc(&gpiote, &in_channel); + err = nrfx_gpiote_channel_alloc(&in_channel); if (err != NRFX_SUCCESS) { LOG_ERR("Failed to allocate in_channel, error: 0x%08X", err); return 0; } - err = nrfx_gpiote_channel_alloc(&gpiote, &out_channel); + err = nrfx_gpiote_channel_alloc(&out_channel); if (err != NRFX_SUCCESS) { LOG_ERR("Failed to allocate out_channel, error: 0x%08X", err); return 0; @@ -74,22 +65,20 @@ int main(void) /* Initialize input pin to generate event on high to low transition * (falling edge) and call button_handler() */ - static const nrf_gpio_pin_pull_t pull_config = NRF_GPIO_PIN_PULLUP; - nrfx_gpiote_trigger_config_t trigger_config = { + static const nrfx_gpiote_input_config_t input_config = { + .pull = NRF_GPIO_PIN_PULLUP, + }; + const nrfx_gpiote_trigger_config_t trigger_config = { .trigger = NRFX_GPIOTE_TRIGGER_HITOLO, .p_in_channel = &in_channel, }; static const nrfx_gpiote_handler_config_t handler_config = { .handler = button_handler, }; - nrfx_gpiote_input_pin_config_t input_config = { - .p_pull_config = &pull_config, - .p_trigger_config = &trigger_config, - .p_handler_config = &handler_config - }; - - err = nrfx_gpiote_input_configure(&gpiote, INPUT_PIN, &input_config); - + err = nrfx_gpiote_input_configure(INPUT_PIN, + &input_config, + &trigger_config, + &handler_config); if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_gpiote_input_configure error: 0x%08X", err); return 0; @@ -108,7 +97,7 @@ int main(void) .polarity = NRF_GPIOTE_POLARITY_TOGGLE, .init_val = 1, }; - err = nrfx_gpiote_output_configure(&gpiote, OUTPUT_PIN, + err = nrfx_gpiote_output_configure(OUTPUT_PIN, &output_config, &task_config); if (err != NRFX_SUCCESS) { @@ -116,8 +105,8 @@ int main(void) return 0; } - nrfx_gpiote_trigger_enable(&gpiote, INPUT_PIN, true); - nrfx_gpiote_out_task_enable(&gpiote, OUTPUT_PIN); + nrfx_gpiote_trigger_enable(INPUT_PIN, true); + nrfx_gpiote_out_task_enable(OUTPUT_PIN); LOG_INF("nrfx_gpiote initialized"); @@ -133,8 +122,8 @@ int main(void) * the button is pressed, the LED pin will be toggled. */ nrfx_gppi_channel_endpoints_setup(ppi_channel, - nrfx_gpiote_in_event_address_get(&gpiote, INPUT_PIN), - nrfx_gpiote_out_task_address_get(&gpiote, OUTPUT_PIN)); + nrfx_gpiote_in_event_address_get(INPUT_PIN), + nrfx_gpiote_out_task_address_get(OUTPUT_PIN)); /* Enable the channel. */ nrfx_gppi_channels_enable(BIT(ppi_channel)); From f4ea5876137065880e22cd5fbae498eb92bc330f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:44 +0100 Subject: [PATCH 1147/2300] Revert "[nrf fromtree] boards: arm: set gpiote status to okay as default" This reverts commit d8b0858b088646fb0a613b6aa2c079eb1b6a98f9. Signed-off-by: Robert Lubos --- .../arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi | 4 ---- boards/arm/bl654_usb/bl654_usb.dts | 4 ---- 2 files changed, 8 deletions(-) diff --git a/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi b/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi index 3d31ede313f..200db7f94c7 100644 --- a/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi +++ b/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi @@ -189,10 +189,6 @@ arduino_spi: &spi2 { status = "okay"; }; -&gpiote { - status = "okay"; -}; - &pwm0 { status = "okay"; pinctrl-0 = <&pwm0_default>; diff --git a/boards/arm/bl654_usb/bl654_usb.dts b/boards/arm/bl654_usb/bl654_usb.dts index fa814f4b80e..80600290dbf 100644 --- a/boards/arm/bl654_usb/bl654_usb.dts +++ b/boards/arm/bl654_usb/bl654_usb.dts @@ -59,10 +59,6 @@ status = "okay"; }; -&gpiote { - status = "okay"; -}; - &pwm0 { status = "okay"; pinctrl-0 = <&pwm0_default>; From c319551092bf02f06c48625470b2d9945f7d5c82 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:45 +0100 Subject: [PATCH 1148/2300] Revert "[nrf fromtree] boards: arm: nrf5340_audio_dk_cpunet_reset: switch to HAL" This reverts commit c6943ed3204609d5fa6a8de67e529ba163395240. Signed-off-by: Robert Lubos --- .../nrf5340_audio_dk_cpunet_reset.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c index f9082e6ca40..4368ca303fc 100644 --- a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c @@ -10,7 +10,8 @@ #include #include -#include + +#include LOG_MODULE_REGISTER(nrf5340_audio_dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -24,11 +25,11 @@ static int core_config(void) { nrf_gpiote_latency_t latency; - latency = nrf_gpiote_latency_get(NRF_GPIOTE); + latency = nrfx_gpiote_latency_get(); if (latency != NRF_GPIOTE_LATENCY_LOWPOWER) { LOG_DBG("Setting gpiote latency to low power"); - nrf_gpiote_latency_set(NRF_GPIOTE, NRF_GPIOTE_LATENCY_LOWPOWER); + nrfx_gpiote_latency_set(NRF_GPIOTE_LATENCY_LOWPOWER); } return 0; From fd8e728015d811c4e1eed81c62b5559290b3a470 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:45 +0100 Subject: [PATCH 1149/2300] Revert "[nrf fromtree] drivers: watchdog: wdt_nrfx: Add support for new instances" This reverts commit dcbf88db3aac10d699a263508c338fd7ec5775b8. Signed-off-by: Robert Lubos --- drivers/watchdog/Kconfig.nrfx | 4 ---- drivers/watchdog/wdt_nrfx.c | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/drivers/watchdog/Kconfig.nrfx b/drivers/watchdog/Kconfig.nrfx index 2967fe86489..52cf45dc068 100644 --- a/drivers/watchdog/Kconfig.nrfx +++ b/drivers/watchdog/Kconfig.nrfx @@ -9,9 +9,5 @@ config WDT_NRFX depends on DT_HAS_NORDIC_NRF_WDT_ENABLED select NRFX_WDT0 if HAS_HW_NRF_WDT0 select NRFX_WDT1 if HAS_HW_NRF_WDT1 - select NRFX_WDT30 if HAS_HW_NRF_WDT30 - select NRFX_WDT31 if HAS_HW_NRF_WDT31 - select NRFX_WDT130 if HAS_HW_NRF_WDT130 - help Enable support for nrfx WDT driver for nRF MCU series. diff --git a/drivers/watchdog/wdt_nrfx.c b/drivers/watchdog/wdt_nrfx.c index 363a1174e91..98fcb713b81 100644 --- a/drivers/watchdog/wdt_nrfx.c +++ b/drivers/watchdog/wdt_nrfx.c @@ -202,15 +202,3 @@ WDT_NRFX_WDT_DEVICE(0); #ifdef CONFIG_HAS_HW_NRF_WDT1 WDT_NRFX_WDT_DEVICE(1); #endif - -#ifdef CONFIG_HAS_HW_NRF_WDT30 -WDT_NRFX_WDT_DEVICE(30); -#endif - -#ifdef CONFIG_HAS_HW_NRF_WDT31 -WDT_NRFX_WDT_DEVICE(31); -#endif - -#ifdef CONFIG_HAS_HW_NRF_WDT130 -WDT_NRFX_WDT_DEVICE(130); -#endif From c163b14ffa182f9a9a4965c17fca2d02ad298e5c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:45 +0100 Subject: [PATCH 1150/2300] Revert "[nrf fromtree] soc: arm: fix missing configs & defines" This reverts commit 806ea8be182a72e934a03ab11d08d7b85b66be93. Signed-off-by: Robert Lubos --- soc/arm/ambiq/apollo4x/Kconfig.series | 1 - soc/arm/arm/designstart/soc.h | 3 ++- soc/arm/arm/musca_s1/Kconfig.soc | 2 -- soc/arm/aspeed/ast10x0/soc.h | 2 -- soc/arm/atmel_sam0/samc21/Kconfig.series | 1 - soc/arm/bcm_vk/valkyrie/soc.h | 2 -- soc/arm/bcm_vk/viper/soc.h | 4 +--- soc/arm/cypress/Kconfig | 3 --- soc/arm/gigadevice/gd32a50x/Kconfig.series | 1 - soc/arm/gigadevice/gd32e50x/Kconfig.series | 1 - soc/arm/gigadevice/gd32l23x/Kconfig.series | 1 - soc/arm/microchip_mec/mec1501/Kconfig.series | 1 - soc/arm/microchip_mec/mec172x/soc.h | 2 -- soc/arm/nuvoton_npcx/npcx4/soc.h | 4 +++- soc/arm/nuvoton_npcx/npcx7/soc.h | 4 +++- soc/arm/nuvoton_npcx/npcx9/soc.h | 4 +++- soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series | 1 - soc/arm/nxp_imx/mcimx7_m4/Kconfig.series | 1 - soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series | 1 - soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series | 1 - soc/arm/nxp_imx/rt/Kconfig.soc | 4 ---- soc/arm/nxp_kinetis/kl2x/Kconfig.series | 1 - soc/arm/nxp_kinetis/kwx/Kconfig.series | 1 - soc/arm/nxp_lpc/lpc11u6x/soc.h | 1 - soc/arm/nxp_lpc/lpc51u68/Kconfig.series | 1 - soc/arm/nxp_lpc/lpc51u68/soc.h | 2 -- soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc | 1 - soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc | 1 - soc/arm/nxp_s32/s32k3/soc.h | 1 - soc/arm/quicklogic_eos_s3/Kconfig.soc | 1 - soc/arm/renesas_ra/common/ra_common_soc.h | 2 -- soc/arm/renesas_smartbond/da1469x/Kconfig.series | 1 - soc/arm/rpi_pico/rp2/soc.h | 4 +++- soc/arm/silabs_exx32/efm32hg/Kconfig.series | 1 - soc/arm/silabs_exx32/efr32mg21/Kconfig.series | 1 - soc/arm/st_stm32/stm32mp1/Kconfig.series | 1 - soc/arm/ti_k3/am62x_m4/soc.h | 2 -- soc/arm/ti_lm3s6965/soc.h | 1 - soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h | 4 ---- soc/arm/ti_simplelink/cc32xx/soc.h | 4 ---- soc/arm/ti_simplelink/msp432p4xx/Kconfig.series | 1 - 41 files changed, 15 insertions(+), 61 deletions(-) diff --git a/soc/arm/ambiq/apollo4x/Kconfig.series b/soc/arm/ambiq/apollo4x/Kconfig.series index a9e72567206..b7982d3609e 100644 --- a/soc/arm/ambiq/apollo4x/Kconfig.series +++ b/soc/arm/ambiq/apollo4x/Kconfig.series @@ -10,7 +10,6 @@ config SOC_SERIES_APOLLO4X select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_DWT select CPU_HAS_FPU - select CPU_HAS_ARM_MPU select SOC_FAMILY_AMBIQ select HAS_SWO select AMBIQ_HAL diff --git a/soc/arm/arm/designstart/soc.h b/soc/arm/arm/designstart/soc.h index a9bcdb4e9cd..ec58467f923 100644 --- a/soc/arm/arm/designstart/soc.h +++ b/soc/arm/arm/designstart/soc.h @@ -7,6 +7,7 @@ #ifndef _SOC_H_ #define _SOC_H_ -#include + +#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU #endif /* _SOC_H_ */ diff --git a/soc/arm/arm/musca_s1/Kconfig.soc b/soc/arm/arm/musca_s1/Kconfig.soc index 0c0763fae2a..9bf02614308 100644 --- a/soc/arm/arm/musca_s1/Kconfig.soc +++ b/soc/arm/arm/musca_s1/Kconfig.soc @@ -11,7 +11,5 @@ config SOC_V2M_MUSCA_S1 select CPU_HAS_ARM_SAU select CPU_HAS_ARM_MPU select CPU_CORTEX_M_HAS_DWT - select CPU_HAS_FPU - select ARMV8_M_DSP endchoice diff --git a/soc/arm/aspeed/ast10x0/soc.h b/soc/arm/aspeed/ast10x0/soc.h index be1cced5da2..f45df84c128 100644 --- a/soc/arm/aspeed/ast10x0/soc.h +++ b/soc/arm/aspeed/ast10x0/soc.h @@ -25,6 +25,4 @@ void aspeed_print_sysrst_info(void); -#include - #endif /* ZEPHYR_SOC_ARM_ASPEED_AST10X0_SOC_H_*/ diff --git a/soc/arm/atmel_sam0/samc21/Kconfig.series b/soc/arm/atmel_sam0/samc21/Kconfig.series index acb83679e18..044a7aea229 100644 --- a/soc/arm/atmel_sam0/samc21/Kconfig.series +++ b/soc/arm/atmel_sam0/samc21/Kconfig.series @@ -10,7 +10,6 @@ config SOC_SERIES_SAMC21 select CPU_CORTEX_M0PLUS select CPU_CORTEX_M_HAS_SYSTICK select CPU_CORTEX_M_HAS_VTOR - select CPU_HAS_ARM_MPU select SOC_FAMILY_SAM0 select PLATFORM_SPECIFIC_INIT select ASF diff --git a/soc/arm/bcm_vk/valkyrie/soc.h b/soc/arm/bcm_vk/valkyrie/soc.h index c3e21a89581..26863fbfea0 100644 --- a/soc/arm/bcm_vk/valkyrie/soc.h +++ b/soc/arm/bcm_vk/valkyrie/soc.h @@ -292,6 +292,4 @@ typedef enum IRQn { #define PCIE0_PERST_FE_INTR BIT(1) #define PCIE0_PERST_INB_FE_INTR BIT(3) -#include - #endif diff --git a/soc/arm/bcm_vk/viper/soc.h b/soc/arm/bcm_vk/viper/soc.h index 06bf59fb24d..6695e92ef5c 100644 --- a/soc/arm/bcm_vk/viper/soc.h +++ b/soc/arm/bcm_vk/viper/soc.h @@ -9,10 +9,10 @@ #include #include -#include #ifndef _ASMLANGUAGE + /* Interrupt Number Definition */ typedef enum IRQn { /* CORTEX-M7 Processor Exceptions Numbers */ @@ -301,6 +301,4 @@ typedef enum IRQn { #define LS_ICFG_PMON_LITE_SW_RESETN 0x482f0120 #define PCIE_PMON_LITE_SW_RESETN BIT(0) -#include - #endif diff --git a/soc/arm/cypress/Kconfig b/soc/arm/cypress/Kconfig index cb76ccb1090..352c66b4e76 100644 --- a/soc/arm/cypress/Kconfig +++ b/soc/arm/cypress/Kconfig @@ -12,15 +12,12 @@ config SOC_PSOC6_M0 select CPU_CORTEX_M0PLUS select CPU_CORTEX_M_HAS_SYSTICK select CPU_CORTEX_M_HAS_VTOR - select CPU_HAS_ARM_MPU config SOC_PSOC6_M4 bool "SOC_PSOC6_M4" select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_DWT select CPU_CORTEX_M_HAS_SYSTICK - select CPU_HAS_ARM_MPU - select CPU_HAS_FPU endchoice diff --git a/soc/arm/gigadevice/gd32a50x/Kconfig.series b/soc/arm/gigadevice/gd32a50x/Kconfig.series index 2488c643727..96fc8c1d0af 100644 --- a/soc/arm/gigadevice/gd32a50x/Kconfig.series +++ b/soc/arm/gigadevice/gd32a50x/Kconfig.series @@ -6,7 +6,6 @@ config SOC_SERIES_GD32A50X select ARM select CPU_HAS_ARM_MPU select CPU_HAS_FPU - select ARMV8_M_DSP select CPU_CORTEX_M33 select SOC_FAMILY_GD32_ARM select GD32_HAS_AF_PINMUX diff --git a/soc/arm/gigadevice/gd32e50x/Kconfig.series b/soc/arm/gigadevice/gd32e50x/Kconfig.series index 546ca456793..8bc3f71118e 100644 --- a/soc/arm/gigadevice/gd32e50x/Kconfig.series +++ b/soc/arm/gigadevice/gd32e50x/Kconfig.series @@ -7,7 +7,6 @@ config SOC_SERIES_GD32E50X select CPU_HAS_ARM_MPU select CPU_HAS_FPU select CPU_CORTEX_M33 - select ARMV8_M_DSP select SOC_FAMILY_GD32_ARM select GD32_HAS_AFIO_PINMUX select GD32_HAS_IRC_40K diff --git a/soc/arm/gigadevice/gd32l23x/Kconfig.series b/soc/arm/gigadevice/gd32l23x/Kconfig.series index d6125ca4152..5bdb0dba7d3 100644 --- a/soc/arm/gigadevice/gd32l23x/Kconfig.series +++ b/soc/arm/gigadevice/gd32l23x/Kconfig.series @@ -6,7 +6,6 @@ config SOC_SERIES_GD32L23X select ARM select CPU_CORTEX_M23 select CPU_CORTEX_M_HAS_SYSTICK - select CPU_CORTEX_M_HAS_VTOR select SOC_FAMILY_GD32_ARM select GD32_HAS_AF_PINMUX select GD32_HAS_IRC_32K diff --git a/soc/arm/microchip_mec/mec1501/Kconfig.series b/soc/arm/microchip_mec/mec1501/Kconfig.series index 92dc6f3f8f9..d3b679bb557 100644 --- a/soc/arm/microchip_mec/mec1501/Kconfig.series +++ b/soc/arm/microchip_mec/mec1501/Kconfig.series @@ -8,7 +8,6 @@ config SOC_SERIES_MEC1501X select ARM select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_DWT - select CPU_HAS_ARM_MPU select SOC_FAMILY_MEC select HAS_PM help diff --git a/soc/arm/microchip_mec/mec172x/soc.h b/soc/arm/microchip_mec/mec172x/soc.h index 19afc4e920a..3bf4f533fdb 100644 --- a/soc/arm/microchip_mec/mec172x/soc.h +++ b/soc/arm/microchip_mec/mec172x/soc.h @@ -242,8 +242,6 @@ typedef enum { MAX_IRQn } IRQn_Type; -#include - #include /* chip specific register defines */ diff --git a/soc/arm/nuvoton_npcx/npcx4/soc.h b/soc/arm/nuvoton_npcx/npcx4/soc.h index 9c780ca034a..a9d4e88424b 100644 --- a/soc/arm/nuvoton_npcx/npcx4/soc.h +++ b/soc/arm/nuvoton_npcx/npcx4/soc.h @@ -7,7 +7,9 @@ #ifndef _NUVOTON_NPCX_SOC_H_ #define _NUVOTON_NPCX_SOC_H_ -#include +/* CMSIS required definitions */ +#define __FPU_PRESENT CONFIG_CPU_HAS_FPU +#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU /* NPCX4 SCFG multi-registers */ #define NPCX_DEVALT_OFFSET(n) (0x010 + n) diff --git a/soc/arm/nuvoton_npcx/npcx7/soc.h b/soc/arm/nuvoton_npcx/npcx7/soc.h index 9b523ce1b8f..7099552cec3 100644 --- a/soc/arm/nuvoton_npcx/npcx7/soc.h +++ b/soc/arm/nuvoton_npcx/npcx7/soc.h @@ -7,7 +7,9 @@ #ifndef _NUVOTON_NPCX_SOC_H_ #define _NUVOTON_NPCX_SOC_H_ -#include +/* CMSIS required definitions */ +#define __FPU_PRESENT CONFIG_CPU_HAS_FPU +#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU /* NPCX7 SCFG multi-registers offset */ #define NPCX_DEVALT_OFFSET(n) (0x010 + n) diff --git a/soc/arm/nuvoton_npcx/npcx9/soc.h b/soc/arm/nuvoton_npcx/npcx9/soc.h index 2ce745650fb..6b6c3f30a44 100644 --- a/soc/arm/nuvoton_npcx/npcx9/soc.h +++ b/soc/arm/nuvoton_npcx/npcx9/soc.h @@ -7,7 +7,9 @@ #ifndef _NUVOTON_NPCX_SOC_H_ #define _NUVOTON_NPCX_SOC_H_ -#include +/* CMSIS required definitions */ +#define __FPU_PRESENT CONFIG_CPU_HAS_FPU +#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU /* NPCX9 SCFG multi-registers */ #define NPCX_DEVALT_OFFSET(n) (0x010 + n) diff --git a/soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series b/soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series index 7279ac8596e..ac0428eff53 100644 --- a/soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series +++ b/soc/arm/nxp_imx/mcimx6x_m4/Kconfig.series @@ -11,7 +11,6 @@ config SOC_SERIES_IMX_6X_M4 select HAS_IMX_HAL select SOC_FAMILY_IMX select CPU_HAS_FPU - select CPU_HAS_ARM_MPU select CLOCK_CONTROL help Enable support for M4 core of i.MX 6SoloX MCU series diff --git a/soc/arm/nxp_imx/mcimx7_m4/Kconfig.series b/soc/arm/nxp_imx/mcimx7_m4/Kconfig.series index e7ae54bcbda..be0065cb373 100644 --- a/soc/arm/nxp_imx/mcimx7_m4/Kconfig.series +++ b/soc/arm/nxp_imx/mcimx7_m4/Kconfig.series @@ -11,6 +11,5 @@ config SOC_SERIES_IMX7_M4 select SOC_FAMILY_IMX select CLOCK_CONTROL select CPU_HAS_FPU - select CPU_HAS_ARM_MPU help Enable support for i.MX7 M4 MCU series diff --git a/soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series b/soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series index f860a7fbd26..dddb12d1b70 100644 --- a/soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series +++ b/soc/arm/nxp_imx/mimx8mm6_m4/Kconfig.series @@ -9,6 +9,5 @@ config SOC_SERIES_IMX8MM_M4 select CPU_CORTEX_M4 select SOC_FAMILY_IMX select CPU_HAS_FPU - select CPU_HAS_ARM_MPU help Enable support for i.MX8MM M4 MCU series diff --git a/soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series b/soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series index 3933037c3a0..c4b16d3fb5c 100644 --- a/soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series +++ b/soc/arm/nxp_imx/mimx8mq6_m4/Kconfig.series @@ -9,6 +9,5 @@ config SOC_SERIES_IMX8MQ_M4 select CPU_CORTEX_M4 select SOC_FAMILY_IMX select CPU_HAS_FPU - select CPU_HAS_ARM_MPU help Enable support for i.MX8MQ M4 MCU series diff --git a/soc/arm/nxp_imx/rt/Kconfig.soc b/soc/arm/nxp_imx/rt/Kconfig.soc index 96dcd14dc86..0058993e825 100644 --- a/soc/arm/nxp_imx/rt/Kconfig.soc +++ b/soc/arm/nxp_imx/rt/Kconfig.soc @@ -21,7 +21,6 @@ config SOC_MIMXRT1011 select HAS_MCUX_LPUART select HAS_MCUX_GPT select HAS_MCUX_TRNG - select CPU_HAS_FPU select CPU_HAS_ARM_MPU select INIT_ENET_PLL select HAS_MCUX_USB_EHCI @@ -46,7 +45,6 @@ config SOC_MIMXRT1015 select HAS_MCUX_LPUART select HAS_MCUX_GPT select HAS_MCUX_TRNG - select CPU_HAS_FPU select CPU_HAS_FPU_DOUBLE_PRECISION select CPU_HAS_ARM_MPU select INIT_ENET_PLL @@ -370,7 +368,6 @@ config SOC_MIMXRT1176_CM4 select HAS_MCUX_FLEXSPI select HAS_MCUX_LPUART select HAS_MCUX_GPT - select CPU_HAS_FPU select CPU_HAS_ARM_MPU select INIT_ARM_PLL select INIT_ENET_PLL if NET_L2_ETHERNET && ETH_DRIVER @@ -438,7 +435,6 @@ config SOC_MIMXRT1166_CM4 select HAS_MCUX_FLEXSPI select HAS_MCUX_GPT select CPU_HAS_ARM_MPU - select CPU_HAS_FPU select INIT_ARM_PLL select INIT_ENET_PLL if NET_L2_ETHERNET && ETH_DRIVER select INIT_VIDEO_PLL diff --git a/soc/arm/nxp_kinetis/kl2x/Kconfig.series b/soc/arm/nxp_kinetis/kl2x/Kconfig.series index 3c606c7db27..53558c81648 100644 --- a/soc/arm/nxp_kinetis/kl2x/Kconfig.series +++ b/soc/arm/nxp_kinetis/kl2x/Kconfig.series @@ -9,7 +9,6 @@ config SOC_SERIES_KINETIS_KL2X select CPU_CORTEX_M0PLUS select SOC_FAMILY_KINETIS select CPU_CORTEX_M_HAS_SYSTICK - select CPU_CORTEX_M_HAS_VTOR select CLOCK_CONTROL select PLATFORM_SPECIFIC_INIT help diff --git a/soc/arm/nxp_kinetis/kwx/Kconfig.series b/soc/arm/nxp_kinetis/kwx/Kconfig.series index 36ba7b54c21..4b00dd997a9 100644 --- a/soc/arm/nxp_kinetis/kwx/Kconfig.series +++ b/soc/arm/nxp_kinetis/kwx/Kconfig.series @@ -8,7 +8,6 @@ config SOC_SERIES_KINETIS_KWX select ARM select SOC_FAMILY_KINETIS select CPU_CORTEX_M_HAS_SYSTICK - select CPU_CORTEX_M_HAS_VTOR select CLOCK_CONTROL select PLATFORM_SPECIFIC_INIT help diff --git a/soc/arm/nxp_lpc/lpc11u6x/soc.h b/soc/arm/nxp_lpc/lpc11u6x/soc.h index ec0abb4faf1..fd7ffbd5400 100644 --- a/soc/arm/nxp_lpc/lpc11u6x/soc.h +++ b/soc/arm/nxp_lpc/lpc11u6x/soc.h @@ -19,7 +19,6 @@ #ifndef _ASMLANGUAGE #include -#include #endif /* !_ASMLANGUAGE */ diff --git a/soc/arm/nxp_lpc/lpc51u68/Kconfig.series b/soc/arm/nxp_lpc/lpc51u68/Kconfig.series index 8b1a9dd18b1..6995de0917a 100644 --- a/soc/arm/nxp_lpc/lpc51u68/Kconfig.series +++ b/soc/arm/nxp_lpc/lpc51u68/Kconfig.series @@ -13,7 +13,6 @@ config SOC_SERIES_LPC51U68 select HAS_MCUX_SCTIMER select SOC_FAMILY_LPC select CPU_CORTEX_M_HAS_SYSTICK - select CPU_CORTEX_M_HAS_VTOR select PLATFORM_SPECIFIC_INIT help Enable support for LPC LPC51U68 MCU Series diff --git a/soc/arm/nxp_lpc/lpc51u68/soc.h b/soc/arm/nxp_lpc/lpc51u68/soc.h index 9135c3fed71..45355fb148e 100644 --- a/soc/arm/nxp_lpc/lpc51u68/soc.h +++ b/soc/arm/nxp_lpc/lpc51u68/soc.h @@ -10,8 +10,6 @@ #ifndef _ASMLANGUAGE #include -#include - #endif /* !_ASMLANGUAGE*/ #define IOCON_PIO_DIGITAL_EN 0x80u diff --git a/soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc b/soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc index e71bc8f451e..099dc832d5b 100644 --- a/soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc +++ b/soc/arm/nxp_lpc/lpc54xxx/Kconfig.soc @@ -12,7 +12,6 @@ config SOC_LPC54114_M4 select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_DWT select CPU_HAS_ARM_MPU - select CPU_HAS_FPU select PLATFORM_SPECIFIC_INIT select CLOCK_CONTROL select HAS_MCUX_IAP_LEGACY diff --git a/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc b/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc index a80374f2d81..c0341a8e9c5 100644 --- a/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc +++ b/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc @@ -35,7 +35,6 @@ config SOC_LPC55S16 config SOC_LPC55S28 bool "SOC_LPC55S28 M33" select CPU_CORTEX_M33 - select CPU_HAS_ARM_SAU select CPU_HAS_ARM_MPU select CPU_HAS_FPU select ARMV8_M_DSP diff --git a/soc/arm/nxp_s32/s32k3/soc.h b/soc/arm/nxp_s32/s32k3/soc.h index 9e273ac6816..bbc53e18023 100644 --- a/soc/arm/nxp_s32/s32k3/soc.h +++ b/soc/arm/nxp_s32/s32k3/soc.h @@ -8,7 +8,6 @@ #define _NXP_S32_S32K_SOC_H_ #include -#include #if defined(CONFIG_CMSIS_RTOS_V2) /* diff --git a/soc/arm/quicklogic_eos_s3/Kconfig.soc b/soc/arm/quicklogic_eos_s3/Kconfig.soc index e555933430b..cb5fd170870 100644 --- a/soc/arm/quicklogic_eos_s3/Kconfig.soc +++ b/soc/arm/quicklogic_eos_s3/Kconfig.soc @@ -7,5 +7,4 @@ config SOC_EOS_S3 select CPU_CORTEX_M4 select CPU_CORTEX_M_HAS_SYSTICK select CPU_HAS_ARM_MPU - select CPU_HAS_FPU select EOS_S3_HAL diff --git a/soc/arm/renesas_ra/common/ra_common_soc.h b/soc/arm/renesas_ra/common/ra_common_soc.h index f76c4c26fc0..60559793743 100644 --- a/soc/arm/renesas_ra/common/ra_common_soc.h +++ b/soc/arm/renesas_ra/common/ra_common_soc.h @@ -11,8 +11,6 @@ extern "C" { #endif -#include - #ifdef __cplusplus } #endif diff --git a/soc/arm/renesas_smartbond/da1469x/Kconfig.series b/soc/arm/renesas_smartbond/da1469x/Kconfig.series index c3672a9ecaf..a3a9e569460 100644 --- a/soc/arm/renesas_smartbond/da1469x/Kconfig.series +++ b/soc/arm/renesas_smartbond/da1469x/Kconfig.series @@ -8,7 +8,6 @@ config SOC_SERIES_DA1469X select CPU_HAS_FPU select CPU_HAS_ARM_MPU select CPU_CORTEX_M_HAS_SYSTICK - select ARMV8_M_DSP select SOC_FAMILY_SMARTBOND select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select CLOCK_CONTROL diff --git a/soc/arm/rpi_pico/rp2/soc.h b/soc/arm/rpi_pico/rp2/soc.h index 0eef4cf92a2..b38d2edf461 100644 --- a/soc/arm/rpi_pico/rp2/soc.h +++ b/soc/arm/rpi_pico/rp2/soc.h @@ -12,6 +12,8 @@ #ifndef _RPI_PICO_RP2040_SOC_H_ #define _RPI_PICO_RP2040_SOC_H_ -#include + +#define __VTOR_PRESENT CONFIG_CPU_CORTEX_M_HAS_VTOR +#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU #endif /* _RPI_PICO_RP2040_SOC_H_ */ diff --git a/soc/arm/silabs_exx32/efm32hg/Kconfig.series b/soc/arm/silabs_exx32/efm32hg/Kconfig.series index d17c24fbcdb..33793b5386d 100644 --- a/soc/arm/silabs_exx32/efm32hg/Kconfig.series +++ b/soc/arm/silabs_exx32/efm32hg/Kconfig.series @@ -9,7 +9,6 @@ config SOC_SERIES_EFM32HG select CPU_CORTEX_M0PLUS select SOC_FAMILY_EXX32 select CPU_CORTEX_M_HAS_SYSTICK - select CPU_CORTEX_M_HAS_VTOR select HAS_SILABS_GECKO select SOC_GECKO_CMU select SOC_GECKO_GPIO diff --git a/soc/arm/silabs_exx32/efr32mg21/Kconfig.series b/soc/arm/silabs_exx32/efr32mg21/Kconfig.series index 731658d29e3..146493469e8 100644 --- a/soc/arm/silabs_exx32/efr32mg21/Kconfig.series +++ b/soc/arm/silabs_exx32/efr32mg21/Kconfig.series @@ -11,7 +11,6 @@ config SOC_SERIES_EFR32MG21 select ARMV8_M_DSP select CPU_HAS_FPU select CPU_HAS_ARM_MPU - select CPU_HAS_ARM_SAU select SOC_FAMILY_EXX32 select SOC_GECKO_HAS_RADIO select SOC_GECKO_SERIES2 diff --git a/soc/arm/st_stm32/stm32mp1/Kconfig.series b/soc/arm/st_stm32/stm32mp1/Kconfig.series index c1576a7ee17..0c6580e84cc 100644 --- a/soc/arm/st_stm32/stm32mp1/Kconfig.series +++ b/soc/arm/st_stm32/stm32mp1/Kconfig.series @@ -11,7 +11,6 @@ config SOC_SERIES_STM32MP1X select SOC_FAMILY_STM32 select HAS_STM32CUBE select CPU_HAS_ARM_MPU - select CPU_HAS_FPU select OPENAMP_RSC_TABLE if RAM_CONSOLE help Enable support for STM32MP1 MPU series diff --git a/soc/arm/ti_k3/am62x_m4/soc.h b/soc/arm/ti_k3/am62x_m4/soc.h index 2fd6537b984..01ff4b07080 100644 --- a/soc/arm/ti_k3/am62x_m4/soc.h +++ b/soc/arm/ti_k3/am62x_m4/soc.h @@ -7,8 +7,6 @@ #ifndef __SOC_H_ #define __SOC_H_ -#include - #include #endif /* __SOC_H */ diff --git a/soc/arm/ti_lm3s6965/soc.h b/soc/arm/ti_lm3s6965/soc.h index 3c353b1a79b..bef939013ba 100644 --- a/soc/arm/ti_lm3s6965/soc.h +++ b/soc/arm/ti_lm3s6965/soc.h @@ -15,7 +15,6 @@ #ifndef _BOARD__H_ #define _BOARD__H_ -#include #include /* default system clock */ diff --git a/soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h b/soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h index fdc9214732c..a1d3504b986 100644 --- a/soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h +++ b/soc/arm/ti_simplelink/cc13x2_cc26x2/soc.h @@ -7,8 +7,6 @@ #ifndef TI_SIMPLELINK_CC13X2_CC26X2_SOC_H_ #define TI_SIMPLELINK_CC13X2_CC26X2_SOC_H_ -#include - /* CMSIS required values */ typedef enum { Reset_IRQn = -15, @@ -29,6 +27,4 @@ typedef enum { #define __Vendor_SysTickConfig 0 #define __FPU_PRESENT 1 -#include - #endif /* TI_SIMPLELINK_CC13X2_CC26X2_SOC_H_ */ diff --git a/soc/arm/ti_simplelink/cc32xx/soc.h b/soc/arm/ti_simplelink/cc32xx/soc.h index e18dfce626a..9c841e0e4b0 100644 --- a/soc/arm/ti_simplelink/cc32xx/soc.h +++ b/soc/arm/ti_simplelink/cc32xx/soc.h @@ -7,8 +7,6 @@ #ifndef TI_SIMPLELINK_CC32XX_SOC_H_ #define TI_SIMPLELINK_CC32XX_SOC_H_ -#include - #include #include @@ -40,6 +38,4 @@ typedef enum { #define __NVIC_PRIO_BITS NUM_IRQ_PRIO_BITS #define __Vendor_SysTickConfig 0 /* Default to standard SysTick */ -#include - #endif /* TI_SIMPLELINK_CC32XX_SOC_H_ */ diff --git a/soc/arm/ti_simplelink/msp432p4xx/Kconfig.series b/soc/arm/ti_simplelink/msp432p4xx/Kconfig.series index 8af48672ed2..6bb0043ff90 100644 --- a/soc/arm/ti_simplelink/msp432p4xx/Kconfig.series +++ b/soc/arm/ti_simplelink/msp432p4xx/Kconfig.series @@ -11,6 +11,5 @@ config SOC_SERIES_MSP432P4XX select DYNAMIC_INTERRUPTS select SOC_FAMILY_TISIMPLELINK select CPU_HAS_FPU - select CPU_HAS_ARM_MPU help Enable support for TI SimpleLink MSP432P4XX. From d5d9006c4e633f2146d2f1dc7330547b08e63297 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:45 +0100 Subject: [PATCH 1151/2300] Revert "[nrf fromtree] modules: cmsis: Add consistency checks" This reverts commit 3b90e755e9adf33e7f03866ec7f7cb9a374274ba. Signed-off-by: Robert Lubos --- modules/cmsis/Kconfig | 7 ------ modules/cmsis/cmsis_core_m.h | 49 ------------------------------------ 2 files changed, 56 deletions(-) diff --git a/modules/cmsis/Kconfig b/modules/cmsis/Kconfig index eff0be6f40c..4b5a8ee2855 100644 --- a/modules/cmsis/Kconfig +++ b/modules/cmsis/Kconfig @@ -21,11 +21,4 @@ config HAS_CMSIS_CORE_R config HAS_CMSIS_CORE_M bool -config CMSIS_M_CHECK_DEVICE_DEFINES - bool "Check device defines" - default n - depends on HAS_CMSIS_CORE_M - help - This options enables the validation of CMSIS configuration flags. - endif diff --git a/modules/cmsis/cmsis_core_m.h b/modules/cmsis/cmsis_core_m.h index e7382633945..dc468ada364 100644 --- a/modules/cmsis/cmsis_core_m.h +++ b/modules/cmsis/cmsis_core_m.h @@ -15,57 +15,8 @@ #ifndef ZEPHYR_MODULES_CMSIS_CMSIS_M_H_ #define ZEPHYR_MODULES_CMSIS_CMSIS_M_H_ -#if defined(CONFIG_CMSIS_M_CHECK_DEVICE_DEFINES) && CONFIG_CMSIS_M_CHECK_DEVICE_DEFINES == 1U -#define __CHECK_DEVICE_DEFINES 1U -#endif - #include #include -#if __NVIC_PRIO_BITS != NUM_IRQ_PRIO_BITS -#error "NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value" -#endif - -#if __MPU_PRESENT != CONFIG_CPU_HAS_ARM_MPU -#error "__MPU_PRESENT and CONFIG_CPU_HAS_ARM_MPU are not set to the same value" -#endif - -#if __FPU_PRESENT != CONFIG_CPU_HAS_FPU -#error "__FPU_PRESENT and CONFIG_CPU_HAS_FPU are not set to the same value" -#endif - - -/* VTOR is only optional on armv6-m and armv8-m baseline. __VTOR_PRESENT is often - * left undefined on platform where it is not optional. - */ -#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) && \ - (__VTOR_PRESENT != CONFIG_CPU_CORTEX_M_HAS_VTOR) -#error "__VTOR_PRESENT and CONFIG_CPU_CORTEX_M_HAS_VTOR are not set to the same value." -#endif - -/* Some platform’s sdk incorrectly define __DSP_PRESENT for Cortex-M4 & Cortex-M7 - * DSP extension. __ARM_FEATURE_DSP is set by the compiler for these. So ignore - * __DSP_PRESENT discrepancy when __ARM_FEATURE_DSP is defined. - */ -#if !defined(__ARM_FEATURE_DSP) && (__DSP_PRESENT != CONFIG_ARMV8_M_DSP) -#error "__DSP_PRESENT and CONFIG_ARMV8_M_DSP are not set to the same value" -#endif - -#if __ICACHE_PRESENT != CONFIG_CPU_HAS_ICACHE -#error "__ICACHE_PRESENT and CONFIG_CPU_HAS_ICACHE are not set to the same value" -#endif - -#if __DCACHE_PRESENT != CONFIG_CPU_HAS_DCACHE -#error "__DCACHE_PRESENT and CONFIG_CPU_HAS_DCACHE are not set to the same value" -#endif - -#if __MVE_PRESENT != CONFIG_ARMV8_1_M_MVEI -#error "__MVE_PRESENT and CONFIG_ARMV8_1_M_MVEI are not set to the same value" -#endif - -#if __SAUREGION_PRESENT != CONFIG_CPU_HAS_ARM_SAU -#error "__SAUREGION_PRESENT and CONFIG_CPU_HAS_ARM_SAU are not set to the same value" -#endif - #endif /* ZEPHYR_MODULES_CMSIS_CMSIS_M_H_ */ From 7f921de578b53f24cdba78cb4a0d73e6134e3154 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:45 +0100 Subject: [PATCH 1152/2300] Revert "[nrf fromtree] arch: arm: cortex_m: add config for PMU" This reverts commit 5e42f2db2d3fbb1c37cc1c044151952f4b85ba5b. Signed-off-by: Robert Lubos --- arch/arm/core/cortex_m/Kconfig | 15 +-------------- soc/arm/arm/mps3/Kconfig.soc | 5 ----- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/arch/arm/core/cortex_m/Kconfig b/arch/arm/core/cortex_m/Kconfig index 61dd3dbba3c..95e05604783 100644 --- a/arch/arm/core/cortex_m/Kconfig +++ b/arch/arm/core/cortex_m/Kconfig @@ -283,20 +283,7 @@ config ARMV8_1_M_MVEF supporting the M-Profile Vector Extension (MVE) floating-point instruction set. -config ARMV8_1_M_PMU - bool - help - This option is enabled when the CPU implements ARMv8-M Performance - Monitoring Unit (PMU). - -config ARMV8_M_PMU_EVENTCNT - int "Number of event counters in the Performance Monitoring Unit" - depends on ARMV8_1_M_PMU - range 2 8 - help - The number of event counters implemented. - -menu "ARM Cortex-M0/M0+/M1/M3/M4/M7/M23/M33/M55 options" +menu "ARM Cortex-M0/M0+/M1/M3/M4/M7/M23/M33 options" depends on ARMV6_M_ARMV8_M_BASELINE || ARMV7_M_ARMV8_M_MAINLINE config GEN_ISR_TABLES diff --git a/soc/arm/arm/mps3/Kconfig.soc b/soc/arm/arm/mps3/Kconfig.soc index ae577fa549b..86970e288cc 100644 --- a/soc/arm/arm/mps3/Kconfig.soc +++ b/soc/arm/arm/mps3/Kconfig.soc @@ -14,10 +14,5 @@ config SOC_MPS3_AN547 select ARMV8_M_DSP select ARMV8_1_M_MVEI select ARMV8_1_M_MVEF - select ARMV8_1_M_PMU endchoice - -config ARMV8_1_M_PMU_EVENTCNT - int - default 8 if SOC_MPS3_AN547 From af1705eec37fcf4a33eba8dab295a6275a171ab2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:45 +0100 Subject: [PATCH 1153/2300] Revert "[nrf fromtree] modules: cmsis: Move cortex_m default configuration to its own file" This reverts commit 4124c8175711fd79f92bc34fe479c95462c62c35. Signed-off-by: Robert Lubos --- modules/cmsis/cmsis_core_m.h | 88 +++++++++++++++- modules/cmsis/cmsis_core_m_defaults.h | 142 -------------------------- soc/arm/arm/mps2/soc.h | 10 +- soc/arm/arm/mps3/soc.h | 15 ++- 4 files changed, 110 insertions(+), 145 deletions(-) delete mode 100644 modules/cmsis/cmsis_core_m_defaults.h diff --git a/modules/cmsis/cmsis_core_m.h b/modules/cmsis/cmsis_core_m.h index dc468ada364..880ff614b5b 100644 --- a/modules/cmsis/cmsis_core_m.h +++ b/modules/cmsis/cmsis_core_m.h @@ -1,6 +1,5 @@ /* * Copyright (c) 2017 Nordic Semiconductor ASA - * Copyright (c) 2023 Arm Limited * * SPDX-License-Identifier: Apache-2.0 */ @@ -19,4 +18,91 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + +/* Fill in CMSIS required values for non-CMSIS compliant SoCs. + * Use __NVIC_PRIO_BITS as it is required and simple to check, but + * ultimately all SoCs will define their own CMSIS types and constants. + */ +#ifndef __NVIC_PRIO_BITS +typedef enum { + Reset_IRQn = -15, + NonMaskableInt_IRQn = -14, + HardFault_IRQn = -13, +#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) + MemoryManagement_IRQn = -12, + BusFault_IRQn = -11, + UsageFault_IRQn = -10, +#if defined(CONFIG_ARM_SECURE_FIRMWARE) + SecureFault_IRQn = -9, +#endif /* CONFIG_ARM_SECURE_FIRMWARE */ +#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ + SVCall_IRQn = -5, + DebugMonitor_IRQn = -4, + PendSV_IRQn = -2, + SysTick_IRQn = -1, + Max_IRQn = CONFIG_NUM_IRQS, +} IRQn_Type; + +#if defined(CONFIG_CPU_CORTEX_M0) +#define __CM0_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M0PLUS) +#define __CM0PLUS_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M1) +#define __CM1_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M3) +#define __CM3_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M4) +#define __CM4_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M7) +#define __CM7_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M23) +#define __CM23_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M33) +#define __CM33_REV 0 +#elif defined(CONFIG_CPU_CORTEX_M55) +#define __CM55_REV 0 +#else +#error "Unknown Cortex-M device" +#endif + +#ifndef __MPU_PRESENT +#define __MPU_PRESENT 0U +#endif +#define __NVIC_PRIO_BITS NUM_IRQ_PRIO_BITS +#define __Vendor_SysTickConfig 0 /* Default to standard SysTick */ +#endif /* __NVIC_PRIO_BITS */ + +#if __NVIC_PRIO_BITS != NUM_IRQ_PRIO_BITS +#error "NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value" +#endif + +#ifdef __cplusplus +} +#endif + +#if defined(CONFIG_CPU_CORTEX_M0) +#include +#elif defined(CONFIG_CPU_CORTEX_M0PLUS) +#include +#elif defined(CONFIG_CPU_CORTEX_M1) +#include +#elif defined(CONFIG_CPU_CORTEX_M3) +#include +#elif defined(CONFIG_CPU_CORTEX_M4) +#include +#elif defined(CONFIG_CPU_CORTEX_M7) +#include +#elif defined(CONFIG_CPU_CORTEX_M23) +#include +#elif defined(CONFIG_CPU_CORTEX_M33) +#include +#elif defined(CONFIG_CPU_CORTEX_M55) +#include +#else +#error "Unknown Cortex-M device" +#endif + #endif /* ZEPHYR_MODULES_CMSIS_CMSIS_M_H_ */ diff --git a/modules/cmsis/cmsis_core_m_defaults.h b/modules/cmsis/cmsis_core_m_defaults.h deleted file mode 100644 index bef62665493..00000000000 --- a/modules/cmsis/cmsis_core_m_defaults.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2017 Nordic Semiconductor ASA - * Copyright (c) 2023 Arm Limited - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief CMSIS interface file - * - * This header populates the default values required to configure the - * ARM CMSIS Core headers. - */ - -#ifndef ZEPHYR_MODULES_CMSIS_CMSIS_M_DEFAULTS_H_ -#define ZEPHYR_MODULES_CMSIS_CMSIS_M_DEFAULTS_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Fill in CMSIS required values for non-CMSIS compliant SoCs. - * Use __NVIC_PRIO_BITS as it is required and simple to check, but - * ultimately all SoCs will define their own CMSIS types and constants. - */ -#ifndef __NVIC_PRIO_BITS -typedef enum { - Reset_IRQn = -15, - NonMaskableInt_IRQn = -14, - HardFault_IRQn = -13, -#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) - MemoryManagement_IRQn = -12, - BusFault_IRQn = -11, - UsageFault_IRQn = -10, -#if defined(CONFIG_ARM_SECURE_FIRMWARE) - SecureFault_IRQn = -9, -#endif /* CONFIG_ARM_SECURE_FIRMWARE */ -#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ - SVCall_IRQn = -5, - DebugMonitor_IRQn = -4, - PendSV_IRQn = -2, - SysTick_IRQn = -1, - Max_IRQn = CONFIG_NUM_IRQS, -} IRQn_Type; - -#if defined(CONFIG_CPU_CORTEX_M0) -#define __CM0_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M0PLUS) -#define __CM0PLUS_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M1) -#define __CM1_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M3) -#define __CM3_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M4) -#define __CM4_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M7) -#define __CM7_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M23) -#define __CM23_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M33) -#define __CM33_REV 0 -#elif defined(CONFIG_CPU_CORTEX_M55) -#define __CM55_REV 0 -#else -#error "Unknown Cortex-M device" -#endif - -#define __NVIC_PRIO_BITS NUM_IRQ_PRIO_BITS -#define __Vendor_SysTickConfig 0 /* Default to standard SysTick */ -#endif /* __NVIC_PRIO_BITS */ - -#ifndef __MPU_PRESENT -#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU -#endif - -#ifndef __FPU_PRESENT -#define __FPU_PRESENT CONFIG_CPU_HAS_FPU -#endif - -#ifndef __FPU_DP -#define __FPU_DP CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION -#endif - -#ifndef __VTOR_PRESENT -#define __VTOR_PRESENT CONFIG_CPU_CORTEX_M_HAS_VTOR -#endif - -#ifndef __DSP_PRESENT -#define __DSP_PRESENT CONFIG_ARMV8_M_DSP -#endif - -#ifndef __ICACHE_PRESENT -#define __ICACHE_PRESENT CONFIG_CPU_HAS_ICACHE -#endif - -#ifndef __DCACHE_PRESENT -#define __DCACHE_PRESENT CONFIG_CPU_HAS_DCACHE -#endif - -#ifndef __MVE_PRESENT -#define __MVE_PRESENT CONFIG_ARMV8_1_M_MVEI -#endif - -#ifndef __SAUREGION_PRESENT -#define __SAUREGION_PRESENT CONFIG_CPU_HAS_ARM_SAU -#endif - -#ifndef __PMU_PRESENT -#define __PMU_PRESENT CONFIG_ARMV8_1_M_PMU -#define __PMU_NUM_EVENTCNT CONFIG_ARMV8_1_M_PMU_EVENTCNT -#endif - -#ifdef __cplusplus -} -#endif - -#if defined(CONFIG_CPU_CORTEX_M0) -#include -#elif defined(CONFIG_CPU_CORTEX_M0PLUS) -#include -#elif defined(CONFIG_CPU_CORTEX_M1) -#include -#elif defined(CONFIG_CPU_CORTEX_M3) -#include -#elif defined(CONFIG_CPU_CORTEX_M4) -#include -#elif defined(CONFIG_CPU_CORTEX_M7) -#include -#elif defined(CONFIG_CPU_CORTEX_M23) -#include -#elif defined(CONFIG_CPU_CORTEX_M33) -#include -#elif defined(CONFIG_CPU_CORTEX_M55) -#include -#else -#error "Unknown Cortex-M device" -#endif - -#endif /* ZEPHYR_MODULES_CMSIS_CMSIS_M_DEFAULTS_H_ */ diff --git a/soc/arm/arm/mps2/soc.h b/soc/arm/arm/mps2/soc.h index 822c7ee01bd..594d3d084c1 100644 --- a/soc/arm/arm/mps2/soc.h +++ b/soc/arm/arm/mps2/soc.h @@ -7,7 +7,15 @@ #ifndef _SOC_H_ #define _SOC_H_ -#include +#define __MPU_PRESENT 1 + +#if defined(CONFIG_SOC_MPS2_AN521) +#define __SAUREGION_PRESENT CONFIG_CPU_HAS_ARM_SAU +#define __FPU_PRESENT CONFIG_CPU_HAS_FPU +#define __DSP_PRESENT CONFIG_ARMV8_M_DSP + +#endif + #include extern void wakeup_cpu1(void); diff --git a/soc/arm/arm/mps3/soc.h b/soc/arm/arm/mps3/soc.h index c3a59da1c0d..6a325074cf2 100644 --- a/soc/arm/arm/mps3/soc.h +++ b/soc/arm/arm/mps3/soc.h @@ -7,6 +7,19 @@ #ifndef _SOC_H_ #define _SOC_H_ -#include +#define __MPU_PRESENT 1 + +#if defined(CONFIG_SOC_MPS3_AN547) +#define __SAUREGION_PRESENT 1U /* SAU regions present */ +#define __FPU_PRESENT CONFIG_CPU_HAS_FPU +#define __DSP_PRESENT 1U /* DSP extension present */ +#define __MVE_PRESENT 1U /* MVE extensions present */ +#define __MVE_FP 1U /* MVE floating point present */ +#define __ICACHE_PRESENT 1U /* ICACHE present */ +#define __DCACHE_PRESENT 1U /* DCACHE present */ +#define __PMU_PRESENT 1U /* PMU present */ +#define __PMU_NUM_EVENTCNT 8U /* PMU Event Counters */ +#endif + #endif /* _SOC_H_ */ From 9e104a226996a3d680fff03c8fc99338b8374988 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:46 +0100 Subject: [PATCH 1154/2300] Revert "[nrf fromtree] dts: arm: add new gpiote instances definition" This reverts commit 04b12701d770ecbeefb3116dafa5649182fbf7da. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf51822.dtsi | 4 +- dts/arm/nordic/nrf52805.dtsi | 4 +- dts/arm/nordic/nrf52810.dtsi | 4 +- dts/arm/nordic/nrf52811.dtsi | 4 +- dts/arm/nordic/nrf52820.dtsi | 4 +- dts/arm/nordic/nrf52832.dtsi | 4 +- dts/arm/nordic/nrf52833.dtsi | 5 +- dts/arm/nordic/nrf52840.dtsi | 5 +- dts/arm/nordic/nrf5340_cpuapp.dtsi | 17 +++---- .../nordic/nrf5340_cpuapp_peripherals.dtsi | 2 - .../nordic/nrf5340_cpuapp_peripherals_ns.dtsi | 20 ++++++++ dts/arm/nordic/nrf5340_cpuappns.dtsi | 22 ++++----- dts/arm/nordic/nrf5340_cpunet.dtsi | 5 +- dts/arm/nordic/nrf91.dtsi | 17 +------ dts/arm/nordic/nrf91_peripherals.dtsi | 1 - dts/arm/nordic/nrf91ns.dtsi | 9 +--- dts/bindings/gpio/nordic,nrf-gpio.yaml | 5 -- dts/bindings/gpio/nordic,nrf-gpiote.yaml | 12 ----- modules/hal_nordic/nrfx/Kconfig | 33 +------------ modules/hal_nordic/nrfx/nrfx_config.h | 21 +++------ .../nrfx/nrfx_config_nrf5340_application.h | 11 +++-- modules/hal_nordic/nrfx/nrfx_config_nrf91.h | 10 ++-- soc/arm/nordic_nrf/Kconfig.peripherals | 19 +------- soc/arm/nordic_nrf/common/soc_nrf_common.h | 46 ------------------- soc/arm/nordic_nrf/validate_base_addresses.c | 10 ---- 25 files changed, 73 insertions(+), 221 deletions(-) create mode 100644 dts/arm/nordic/nrf5340_cpuapp_peripherals_ns.dtsi diff --git a/dts/arm/nordic/nrf51822.dtsi b/dts/arm/nordic/nrf51822.dtsi index 020711a7e7f..222ccd4854c 100644 --- a/dts/arm/nordic/nrf51822.dtsi +++ b/dts/arm/nordic/nrf51822.dtsi @@ -131,12 +131,11 @@ status = "disabled"; }; - gpiote: gpiote0: gpiote@40006000 { + gpiote: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; - instance = <0>; }; adc: adc@40007000 { @@ -317,7 +316,6 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index a54e8eca9c6..dd7845588e7 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -132,12 +132,11 @@ status = "disabled"; }; - gpiote: gpiote0: gpiote@40006000 { + gpiote: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; - instance = <0>; }; adc: adc@40007000 { @@ -312,7 +311,6 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index ce5a2bce779..82f5afb99f6 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -136,12 +136,11 @@ status = "disabled"; }; - gpiote: gpiote0: gpiote@40006000 { + gpiote: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; - instance = <0>; }; adc: adc@40007000 { @@ -338,7 +337,6 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 9c9a3fa6b77..9e03d5edb32 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -167,12 +167,11 @@ status = "disabled"; }; - gpiote: gpiote0: gpiote@40006000 { + gpiote: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; - instance = <0>; }; adc: adc@40007000 { @@ -373,7 +372,6 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index c210a7c23aa..71ff85afbeb 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -180,12 +180,11 @@ status = "disabled"; }; - gpiote: gpiote0: gpiote@40006000 { + gpiote: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; - instance = <0>; }; timer0: timer@40008000 { @@ -390,7 +389,6 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 2e1fd68946b..69de3aa591a 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -179,12 +179,11 @@ status = "okay"; }; - gpiote: gpiote0: gpiote@40006000 { + gpiote: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; - instance = <0>; }; adc: adc@40007000 { @@ -466,7 +465,6 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index d55f0f6df9e..8003649385c 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -186,12 +186,11 @@ status = "okay"; }; - gpiote: gpiote0: gpiote@40006000 { + gpiote: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; - instance = <0>; }; adc: adc@40007000 { @@ -522,7 +521,6 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; gpio1: gpio@50000300 { @@ -534,7 +532,6 @@ ngpios = <10>; status = "disabled"; port = <1>; - gpiote-instance = <&gpiote>; }; }; }; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index e833835198b..24710e8e0ff 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -181,12 +181,11 @@ status = "okay"; }; - gpiote: gpiote0: gpiote@40006000 { + gpiote: gpiote@40006000 { compatible = "nordic,nrf-gpiote"; reg = <0x40006000 0x1000>; interrupts = <6 5>; status = "disabled"; - instance = <0>; }; adc: adc@40007000 { @@ -526,7 +525,6 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; gpio1: gpio@50000300 { @@ -538,7 +536,6 @@ ngpios = <16>; status = "disabled"; port = <1>; - gpiote-instance = <&gpiote>; }; cryptocell: crypto@5002a000 { diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index bc6b5316519..77762990e13 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -84,16 +84,6 @@ reg = <0x5000d000 0x1000>; interrupts = <13 5>; status = "disabled"; - instance = <0>; - }; - - /* Additional Non-Secure GPIOTE instance */ - gpiote1: gpiote@4002f000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x4002f000 0x1000>; - interrupts = <47 5>; - status = "disabled"; - instance = <1>; }; cryptocell: crypto@50844000 { @@ -114,3 +104,10 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +/* + * Include the non-secure peripherals file here since + * it expects to be at the root level. This provides + * a node for GPIOTE1. + */ +#include "nrf5340_cpuapp_peripherals_ns.dtsi" diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index afb839fcef4..e7aa0309f70 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -526,7 +526,6 @@ gpio0: gpio@842500 { #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; gpio1: gpio@842800 { @@ -537,7 +536,6 @@ gpio1: gpio@842800 { ngpios = <16>; status = "disabled"; port = <1>; - gpiote-instance = <&gpiote>; }; ieee802154: ieee802154 { diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals_ns.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals_ns.dtsi new file mode 100644 index 00000000000..5cfe561e613 --- /dev/null +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals_ns.dtsi @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2019 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * GPIOTE1 is always accessible as a non-secure peripheral. + */ + +/ { + soc { + gpiote1: gpiote@4002f000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x4002f000 0x1000>; + interrupts = <47 5>; + status = "disabled"; + }; + }; +}; diff --git a/dts/arm/nordic/nrf5340_cpuappns.dtsi b/dts/arm/nordic/nrf5340_cpuappns.dtsi index aa97c337067..b5278745e5d 100644 --- a/dts/arm/nordic/nrf5340_cpuappns.dtsi +++ b/dts/arm/nordic/nrf5340_cpuappns.dtsi @@ -48,19 +48,6 @@ */ #include "nrf5340_cpuapp_peripherals.dtsi" }; - - /* - * GPIOTE1 is always accessible as a non-secure peripheral, - * so we give it the 'gpiote' label for use when building - * code for this target. - */ - gpiote: gpiote1: gpiote@4002f000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x4002f000 0x1000>; - interrupts = <47 5>; - status = "disabled"; - instance = <1>; - }; }; /* Default IPC description */ @@ -77,3 +64,12 @@ &nvic { arm,num-irq-priority-bits = <3>; }; + +/* + * Include the non-secure peripherals file here since + * it expects to be at the root level, adding a 'gpiote' label + * for the GPIOTE1 peripheral defined in that file which is + * always accessible as a non-secure peripheral. + */ +#include "nrf5340_cpuapp_peripherals_ns.dtsi" +gpiote: &gpiote1 {}; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index d930cf603c0..c1e8371d410 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -108,12 +108,11 @@ status = "okay"; }; - gpiote: gpiote0: gpiote@4100a000 { + gpiote: gpiote@4100a000 { compatible = "nordic,nrf-gpiote"; reg = <0x4100a000 0x1000>; interrupts = <10 5>; status = "disabled"; - instance = <0>; }; wdt: wdt0: watchdog@4100b000 { @@ -319,7 +318,6 @@ #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; gpio1: gpio@418c0800 { @@ -330,7 +328,6 @@ ngpios = <16>; status = "disabled"; port = <1>; - gpiote-instance = <&gpiote>; }; }; diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index a9f067a7e5a..46024011166 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -60,26 +60,11 @@ status = "okay"; }; - /* - * GPIOTE0 is always accessible as a secure peripheral, - * so we give it the 'gpiote' label for use when building - * code for this target. - */ - gpiote: gpiote0: gpiote@5000d000 { + gpiote: gpiote@5000d000 { compatible = "nordic,nrf-gpiote"; reg = <0x5000d000 0x1000>; interrupts = <13 5>; status = "disabled"; - instance = <0>; - }; - - /* Additional Non-Secure GPIOTE instance */ - gpiote1: gpiote@40031000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x40031000 0x1000>; - interrupts = <49 5>; - status = "disabled"; - instance = <1>; }; spu: spu@50003000 { diff --git a/dts/arm/nordic/nrf91_peripherals.dtsi b/dts/arm/nordic/nrf91_peripherals.dtsi index 12e61743bfe..2e437eb082d 100644 --- a/dts/arm/nordic/nrf91_peripherals.dtsi +++ b/dts/arm/nordic/nrf91_peripherals.dtsi @@ -313,7 +313,6 @@ gpio0: gpio@842500 { #gpio-cells = <2>; status = "disabled"; port = <0>; - gpiote-instance = <&gpiote>; }; rtc0: rtc@14000 { diff --git a/dts/arm/nordic/nrf91ns.dtsi b/dts/arm/nordic/nrf91ns.dtsi index 23af6ebe37f..910f45ec706 100644 --- a/dts/arm/nordic/nrf91ns.dtsi +++ b/dts/arm/nordic/nrf91ns.dtsi @@ -46,17 +46,12 @@ #include "nrf91_peripherals.dtsi" }; - /* - * GPIOTE1 is always accessible as a non-secure peripheral, - * so we give it the 'gpiote' label for use when building - * code for this target. - */ - gpiote: gpiote1: gpiote@40031000 { + /* Additional Non-Secure peripherals */ + gpiote: gpiote@40031000 { compatible = "nordic,nrf-gpiote"; reg = <0x40031000 0x1000>; interrupts = <49 5>; status = "disabled"; - instance = <1>; }; }; diff --git a/dts/bindings/gpio/nordic,nrf-gpio.yaml b/dts/bindings/gpio/nordic,nrf-gpio.yaml index 097a99d8fa9..550acd1a865 100644 --- a/dts/bindings/gpio/nordic,nrf-gpio.yaml +++ b/dts/bindings/gpio/nordic,nrf-gpio.yaml @@ -11,11 +11,6 @@ properties: reg: required: true - gpiote-instance: - type: phandle - description: | - GPIOTE instance that can be used with this GPIO port. - "#gpio-cells": const: 2 diff --git a/dts/bindings/gpio/nordic,nrf-gpiote.yaml b/dts/bindings/gpio/nordic,nrf-gpiote.yaml index cefc3385afe..49ddba3595b 100644 --- a/dts/bindings/gpio/nordic,nrf-gpiote.yaml +++ b/dts/bindings/gpio/nordic,nrf-gpiote.yaml @@ -13,15 +13,3 @@ properties: interrupts: required: true - - instance: - type: int - required: true - description: | - The GPIOTE instance number. GPIOTE instance GPIOTE0 has: - - instance = <0>; - - And GPIOTE1 has: - - instance = <1>; diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index a92aa93d9a2..c4bfcc2d60e 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -63,37 +63,8 @@ config NRFX_EGU5 select NRFX_EGU config NRFX_GPIOTE - bool - -config NRFX_GPIOTE0 - bool "GPIOTE0 driver instance" - depends on $(dt_nodelabel_has_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - select NRFX_GPIOTE - -config NRFX_GPIOTE1 - bool "GPIOTE1 driver instance" - depends on $(dt_nodelabel_has_compat,gpiote1,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - select NRFX_GPIOTE - -config NRFX_GPIOTE20 - bool "NRFX_GPIOTE20 driver instance" - depends on $(dt_nodelabel_has_compat,gpiote20,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - select NRFX_GPIOTE - -config NRFX_GPIOTE30 - bool "NRFX_GPIOTE30 driver instance" - depends on $(dt_nodelabel_has_compat,gpiote30,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - select NRFX_GPIOTE - -config NRFX_GPIOTE130 - bool "NRFX_GPIOTE130 driver instance" - depends on $(dt_nodelabel_has_compat,gpiote130,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - select NRFX_GPIOTE - -config NRFX_GPIOTE131 - bool "NRFX_GPIOTE131 driver instance" - depends on $(dt_nodelabel_has_compat,gpiote131,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - select NRFX_GPIOTE + bool "GPIOTE driver" + depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) config NRFX_GPIOTE_NUM_OF_EVT_HANDLERS int "Number of event handlers" diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 72617325684..a285d1c86db 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -117,24 +117,15 @@ #ifdef CONFIG_NRFX_GPIOTE #define NRFX_GPIOTE_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_GPIOTE0 -#define NRFX_GPIOTE0_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_GPIOTE1 +#if (defined(CONFIG_SOC_SERIES_NRF91X) || defined(CONFIG_SOC_SERIES_NRF53X)) \ + && defined(NRF_TRUSTZONE_NONSECURE) #define NRFX_GPIOTE1_ENABLED 1 +#else +#define NRFX_GPIOTE0_ENABLED 1 #endif -#ifdef CONFIG_NRFX_GPIOTE20 -#define NRFX_GPIOTE20_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_GPIOTE30 -#define NRFX_GPIOTE30_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_GPIOTE130 -#define NRFX_GPIOTE130_ENABLED 1 #endif -#ifdef CONFIG_NRFX_GPIOTE131 -#define NRFX_GPIOTE131_ENABLED 1 +#ifdef CONFIG_NRFX_GPIOTE_LOG +#define NRFX_GPIOTE_CONFIG_LOG_ENABLED 1 #endif #ifdef CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h index 18bcc40b2ac..4a42f92ca98 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h @@ -83,7 +83,6 @@ * between secure and non-secure mapping. */ #if defined(NRF_TRUSTZONE_NONSECURE) -#define NRF_GPIOTE NRF_GPIOTE1 #define NRF_GPIOTE1 NRF_GPIOTE1_NS #else #define NRF_CACHE NRF_CACHE_S @@ -92,14 +91,20 @@ #define NRF_CRYPTOCELL NRF_CRYPTOCELL_S #define NRF_CTI NRF_CTI_S #define NRF_FICR NRF_FICR_S -#define NRF_GPIOTE NRF_GPIOTE0 #define NRF_GPIOTE0 NRF_GPIOTE0_S -#define NRF_GPIOTE1 NRF_GPIOTE1_NS #define NRF_SPU NRF_SPU_S #define NRF_TAD NRF_TAD_S #define NRF_UICR NRF_UICR_S #endif +/* Fixups for the GPIOTE driver. */ +#if defined(NRF_TRUSTZONE_NONSECURE) +#define NRF_GPIOTE NRF_GPIOTE1 +#else +#define NRF_GPIOTE NRF_GPIOTE0 +#endif + + /** * @brief NRFX_DEFAULT_IRQ_PRIORITY * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf91.h b/modules/hal_nordic/nrfx/nrfx_config_nrf91.h index c6029a18628..873be583a35 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf91.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf91.h @@ -67,21 +67,25 @@ * between secure and non-secure mapping. */ #if defined(NRF_TRUSTZONE_NONSECURE) -#define NRF_GPIOTE NRF_GPIOTE1 #define NRF_GPIOTE1 NRF_GPIOTE1_NS #else #define NRF_CC_HOST_RGF NRF_CC_HOST_RGF_S #define NRF_CRYPTOCELL NRF_CRYPTOCELL_S #define NRF_CTRL_AP_PERI NRF_CTRL_AP_PERI_S #define NRF_FICR NRF_FICR_S -#define NRF_GPIOTE NRF_GPIOTE0 #define NRF_GPIOTE0 NRF_GPIOTE0_S -#define NRF_GPIOTE1 NRF_GPIOTE1_NS #define NRF_SPU NRF_SPU_S #define NRF_TAD NRF_TAD_S #define NRF_UICR NRF_UICR_S #endif +/* Fixups for the GPIOTE driver. */ +#if defined(NRF_TRUSTZONE_NONSECURE) +#define NRF_GPIOTE NRF_GPIOTE1 +#else +#define NRF_GPIOTE NRF_GPIOTE0 +#endif + /** * @brief NRFX_DEFAULT_IRQ_PRIORITY * diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index 9e637f2661e..55f44ccbc21 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -69,23 +69,8 @@ config HAS_HW_NRF_GPIO0 config HAS_HW_NRF_GPIO1 def_bool $(dt_nodelabel_enabled_with_compat,gpio1,$(DT_COMPAT_NORDIC_NRF_GPIO)) -config HAS_HW_NRF_GPIOTE0 - def_bool $(dt_nodelabel_enabled_with_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - -config HAS_HW_NRF_GPIOTE1 - def_bool $(dt_nodelabel_enabled_with_compat,gpiote1,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - -config HAS_HW_NRF_GPIOTE20 - def_bool $(dt_nodelabel_enabled_with_compat,gpiote20,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - -config HAS_HW_NRF_GPIOTE30 - def_bool $(dt_nodelabel_enabled_with_compat,gpiote30,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - -config HAS_HW_NRF_GPIOTE130 - def_bool $(dt_nodelabel_enabled_with_compat,gpiote130,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) - -config HAS_HW_NRF_GPIOTE131 - def_bool $(dt_nodelabel_enabled_with_compat,gpiote131,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) +config HAS_HW_NRF_GPIOTE + def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) config HAS_HW_NRF_I2S0 def_bool $(dt_nodelabel_enabled_with_compat,i2s0,$(DT_COMPAT_NORDIC_NRF_I2S)) diff --git a/soc/arm/nordic_nrf/common/soc_nrf_common.h b/soc/arm/nordic_nrf/common/soc_nrf_common.h index 1e5e603967b..4c00d7c0237 100644 --- a/soc/arm/nordic_nrf/common/soc_nrf_common.h +++ b/soc/arm/nordic_nrf/common/soc_nrf_common.h @@ -149,52 +149,6 @@ (NRF_DT_GPIOS_TO_PSEL(node_id, prop)), \ (default_value)) -/** - * @brief Convert a devicetree GPIO phandle+specifier to GPIOTE instance number. - * - * Some of nRF SoCs may have more instances of GPIOTE. - * To handle this, we use the "gpiote-instance" property of the GPIO node. - * - * This macro converts a devicetree GPIO phandle array value - * "<&gpioX pin ...>" to a GPIOTE instance number. - * - * Examples: - * - * &gpiote0 { - * instance = <0>; - * }; - * - * &gpiote20 { - * instance = <20>; - * }; - * - * &gpio0 { - * gpiote-instance = <&gpiote0>; - * } - * - * &gpio1 { - * gpiote-instance = <&gpiote20>; - * } - * - * foo: my-node { - * tx-gpios = <&gpio0 4 ...>; - * rx-gpios = <&gpio0 5 ...>, <&gpio1 5 ...>; - * }; - * - * NRF_DT_GPIOTE_INST_BY_IDX(DT_NODELABEL(foo), tx_gpios, 0) // = 0 - * NRF_DT_GPIOTE_INST_BY_IDX(DT_NODELABEL(foo), rx_gpios, 1) // = 20 - */ -#define NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, idx) \ - DT_PROP(DT_PHANDLE(DT_GPIO_CTLR_BY_IDX(node_id, prop, idx), \ - gpiote_instance), \ - instance) - -/** - * @brief Equivalent to NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, 0) - */ -#define NRF_DT_GPIOTE_INST(node_id, prop) \ - NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, 0) - /** * Error out the build if 'prop' is set on node 'node_id' and * DT_GPIO_CTLR(node_id, prop) is not an SoC GPIO controller, diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index ee440c3252c..58aaa5a7513 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -16,10 +16,6 @@ #define NRF_CTRLAP NRF_CTRL_AP_PERI #endif -#if !defined(NRF_GPIOTE0) && defined(NRF_GPIOTE) -#define NRF_GPIOTE0 NRF_GPIOTE -#endif - #if !defined(NRF_I2S0) && defined(NRF_I2S) #define NRF_I2S0 NRF_I2S #endif @@ -145,12 +141,6 @@ CHECK_DT_REG(flash_controller, NRF_NVMC); CHECK_DT_REG(gpio0, NRF_P0); CHECK_DT_REG(gpio1, NRF_P1); CHECK_DT_REG(gpiote, NRF_GPIOTE); -CHECK_DT_REG(gpiote0, NRF_GPIOTE0); -CHECK_DT_REG(gpiote1, NRF_GPIOTE1); -CHECK_DT_REG(gpiote20, NRF_GPIOTE20); -CHECK_DT_REG(gpiote30, NRF_GPIOTE30); -CHECK_DT_REG(gpiote130, NRF_GPIOTE130); -CHECK_DT_REG(gpiote131, NRF_GPIOTE131); CHECK_I2C_REG(i2c0, 0); CHECK_I2C_REG(i2c1, 1); CHECK_DT_REG(i2c2, NRF_TWIM2); From 49779d6c568e2ff9a5cce21c8336adda1172b4f5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:46 +0100 Subject: [PATCH 1155/2300] Revert "[nrf fromtree] modules: hal_nordic: watchdog: Add Kconfig symbols for new WDT instances" This reverts commit 3f30758c5daba7664ae0f5f6d49763535c4a6909. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/Kconfig | 15 --------------- modules/hal_nordic/nrfx/nrfx_config.h | 9 --------- soc/arm/nordic_nrf/Kconfig.peripherals | 9 --------- 3 files changed, 33 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index c4bfcc2d60e..5dcda73c9be 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -561,21 +561,6 @@ config NRFX_WDT1 depends on $(dt_nodelabel_has_compat,wdt1,$(DT_COMPAT_NORDIC_NRF_WDT)) select NRFX_WDT -config NRFX_WDT30 - bool "WDT30 driver instance" - depends on $(dt_nodelabel_has_compat,wdt30,$(DT_COMPAT_NORDIC_NRF_WDT)) - select NRFX_WDT - -config NRFX_WDT31 - bool "WDT31 driver instance" - depends on $(dt_nodelabel_has_compat,wdt31,$(DT_COMPAT_NORDIC_NRF_WDT)) - select NRFX_WDT - -config NRFX_WDT130 - bool "WDT130 driver instance" - depends on $(dt_nodelabel_has_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) - select NRFX_WDT - menu "Peripheral Resource Sharing module" config NRFX_PRS diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index a285d1c86db..b5b09b96078 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -580,15 +580,6 @@ #ifdef CONFIG_NRFX_WDT1 #define NRFX_WDT1_ENABLED 1 #endif -#ifdef CONFIG_NRFX_WDT30 -#define NRFX_WDT30_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_WDT31 -#define NRFX_WDT31_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_WDT130 -#define NRFX_WDT130_ENABLED 1 -#endif #ifdef CONFIG_NRF52_ANOMALY_109_WORKAROUND #define NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index 55f44ccbc21..3aacc35a08a 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -401,12 +401,3 @@ config HAS_HW_NRF_WDT0 config HAS_HW_NRF_WDT1 def_bool $(dt_nodelabel_enabled_with_compat,wdt1,$(DT_COMPAT_NORDIC_NRF_WDT)) - -config HAS_HW_NRF_WDT30 - def_bool $(dt_nodelabel_enabled_with_compat,wdt30,$(DT_COMPAT_NORDIC_NRF_WDT)) - -config HAS_HW_NRF_WDT31 - def_bool $(dt_nodelabel_enabled_with_compat,wdt31,$(DT_COMPAT_NORDIC_NRF_WDT)) - -config HAS_HW_NRF_WDT130 - def_bool $(dt_nodelabel_enabled_with_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) From 80632f41496742098dc51e18036620c899412540 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:46 +0100 Subject: [PATCH 1156/2300] Revert "[nrf fromtree] drivers: pinctrl_nrf: Fix pin drive configuration" This reverts commit 7607bf679ea95d560b2e99016dd552d0433cd790. Signed-off-by: Robert Lubos --- drivers/pinctrl/pinctrl_nrf.c | 48 +++++++------------ .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 3 +- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 12ee1d52294..c2ac538c93b 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -13,24 +13,19 @@ BUILD_ASSERT(((NRF_PULL_NONE == NRF_GPIO_PIN_NOPULL) && (NRF_PULL_UP == NRF_GPIO_PIN_PULLUP)), "nRF pinctrl pull settings do not match HAL values"); -#if defined(GPIO_PIN_CNF_DRIVE_E0E1) || defined(GPIO_PIN_CNF_DRIVE0_E0) -#define NRF_DRIVE_COUNT (NRF_DRIVE_E0E1 + 1) -#else -#define NRF_DRIVE_COUNT (NRF_DRIVE_H0D1 + 1) -#endif -static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { - [NRF_DRIVE_S0S1] = NRF_GPIO_PIN_S0S1, - [NRF_DRIVE_H0S1] = NRF_GPIO_PIN_H0S1, - [NRF_DRIVE_S0H1] = NRF_GPIO_PIN_S0H1, - [NRF_DRIVE_H0H1] = NRF_GPIO_PIN_H0H1, - [NRF_DRIVE_D0S1] = NRF_GPIO_PIN_D0S1, - [NRF_DRIVE_D0H1] = NRF_GPIO_PIN_D0H1, - [NRF_DRIVE_S0D1] = NRF_GPIO_PIN_S0D1, - [NRF_DRIVE_H0D1] = NRF_GPIO_PIN_H0D1, -#if defined(GPIO_PIN_CNF_DRIVE_E0E1) || defined(GPIO_PIN_CNF_DRIVE0_E0) - [NRF_DRIVE_E0E1] = NRF_GPIO_PIN_E0E1, -#endif -}; +BUILD_ASSERT(((NRF_DRIVE_S0S1 == NRF_GPIO_PIN_S0S1) && + (NRF_DRIVE_H0S1 == NRF_GPIO_PIN_H0S1) && + (NRF_DRIVE_S0H1 == NRF_GPIO_PIN_S0H1) && + (NRF_DRIVE_H0H1 == NRF_GPIO_PIN_H0H1) && + (NRF_DRIVE_D0S1 == NRF_GPIO_PIN_D0S1) && + (NRF_DRIVE_D0H1 == NRF_GPIO_PIN_D0H1) && + (NRF_DRIVE_S0D1 == NRF_GPIO_PIN_S0D1) && + (NRF_DRIVE_H0D1 == NRF_GPIO_PIN_H0D1) && +#if defined(GPIO_PIN_CNF_DRIVE_E0E1) + (NRF_DRIVE_E0E1 == NRF_GPIO_PIN_E0E1) && +#endif /* defined(GPIO_PIN_CNF_DRIVE_E0E1) */ + (1U)), + "nRF pinctrl drive settings do not match HAL values"); /* value to indicate pin level doesn't need initialization */ #define NO_WRITE UINT32_MAX @@ -91,19 +86,12 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) { for (uint8_t i = 0U; i < pin_cnt; i++) { - nrf_gpio_pin_drive_t drive; - uint8_t drive_idx = NRF_GET_DRIVE(pins[i]); + nrf_gpio_pin_drive_t drive = NRF_GET_DRIVE(pins[i]); uint32_t psel = NRF_GET_PIN(pins[i]); uint32_t write = NO_WRITE; nrf_gpio_pin_dir_t dir; nrf_gpio_pin_input_t input; - if (drive_idx < ARRAY_SIZE(drive_modes)) { - drive = drive_modes[drive_idx]; - } else { - return -EINVAL; - } - if (psel == NRF_PIN_DISCONNECTED) { psel = PSEL_DISCONNECTED; } @@ -177,22 +165,22 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, #if defined(NRF_PSEL_TWIM) case NRF_FUN_TWIM_SCL: NRF_PSEL_TWIM(reg, SCL) = psel; - if (drive == NRF_GPIO_PIN_S0S1) { + if (drive == NRF_DRIVE_S0S1) { /* Override the default drive setting with one * suitable for TWI/TWIM peripherals (S0D1). * This drive cannot be used always so that * users are able to select e.g. H0D1 or E0E1 * in devicetree. */ - drive = NRF_GPIO_PIN_S0D1; + drive = NRF_DRIVE_S0D1; } dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; break; case NRF_FUN_TWIM_SDA: NRF_PSEL_TWIM(reg, SDA) = psel; - if (drive == NRF_GPIO_PIN_S0S1) { - drive = NRF_GPIO_PIN_S0D1; + if (drive == NRF_DRIVE_S0S1) { + drive = NRF_DRIVE_S0D1; } dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 9d7f8c2312f..b2dcd7ae6c9 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -131,6 +131,7 @@ /** * @name nRF pinctrl output drive. + * @note Values match nrf_gpio_pin_drive_t constants. * @{ */ @@ -151,7 +152,7 @@ /** High drive '0', disconnect '1'. */ #define NRF_DRIVE_H0D1 7U /** Extra high drive '0', extra high drive '1'. */ -#define NRF_DRIVE_E0E1 8U +#define NRF_DRIVE_E0E1 11U /** @} */ From 3349ae2de26ceb6ff1879cf64a342d831f8893b5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:46 +0100 Subject: [PATCH 1157/2300] Revert "[nrf fromtree] drivers: qspi: added operation timeout" This reverts commit a48a5f40d14d07fd6d097057c6ff241d0167c6dd. Signed-off-by: Robert Lubos --- drivers/flash/Kconfig.nordic_qspi_nor | 9 --------- drivers/flash/nrf_qspi_nor.c | 1 - 2 files changed, 10 deletions(-) diff --git a/drivers/flash/Kconfig.nordic_qspi_nor b/drivers/flash/Kconfig.nordic_qspi_nor index ff652f60822..aac9830835a 100644 --- a/drivers/flash/Kconfig.nordic_qspi_nor +++ b/drivers/flash/Kconfig.nordic_qspi_nor @@ -50,13 +50,4 @@ config NORDIC_QSPI_NOR_XIP QSPI NOR flash chip is executed until the driver has been setup. This will also disable power management for the QSPI NOR flash chip. -config NORDIC_QSPI_NOR_TIMEOUT_MS - int "Timeout for QSPI operations (ms)" - default 500 - help - The QSPI peripheral operation timeout in milliseconds. - Primarily intended for long running operations such as - a flash sector erase. The 500 ms default allows for - most typical NOR flash chips to erase a sector. - endif # NORDIC_QSPI_NOR diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index c0e8c397d8e..0e9d4181418 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -1386,7 +1386,6 @@ static const struct qspi_nor_config qspi_nor_dev_config = { .sck_delay = DT_INST_PROP(0, sck_delay), .spi_mode = INST_0_SPI_MODE, }, - .nrfx_cfg.timeout = CONFIG_NORDIC_QSPI_NOR_TIMEOUT_MS, .size = INST_0_BYTES, .id = DT_INST_PROP(0, jedec_id), From 6e8cf5c46c5ee6c469d94b18b581ac18197a957d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:46 +0100 Subject: [PATCH 1158/2300] Revert "[nrf fromtree] net: shell: Early wake up for TWT power save" This reverts commit a972da7bb50b86e68b0a7efd274077cdba3946e4. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 9 --------- subsys/net/l2/wifi/wifi_shell.c | 15 +++------------ 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 982184a103b..bd8cba81d28 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -498,12 +498,6 @@ struct wifi_twt_params { bool announce; /** Wake up time */ uint32_t twt_wake_interval; - /* Wake ahead notification is sent earlier than - * TWT Service period (SP) start based on this duration. - * This should give applications ample time to - * prepare the data before TWT SP starts. - */ - uint32_t twt_wake_ahead_duration; } setup; /** Teardown specific parameters */ struct { @@ -520,7 +514,6 @@ struct wifi_twt_params { #define WIFI_MAX_TWT_INTERVAL_US (LONG_MAX - 1) /* 256 (u8) * 1TU */ #define WIFI_MAX_TWT_WAKE_INTERVAL_US 262144 -#define WIFI_MAX_TWT_WAKE_AHEAD_DURATION_US (LONG_MAX - 1) /** Wi-Fi TWT flow information */ struct wifi_twt_flow_info { @@ -542,8 +535,6 @@ struct wifi_twt_flow_info { bool announce; /** Wake up time */ uint32_t twt_wake_interval; - /* wake ahead duration */ - uint32_t twt_wake_ahead_duration; }; /** Wi-Fi power save configuration */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 2b131d4e0fb..7428a2a79e5 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -975,9 +975,6 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) config.twt_flows[i].trigger, config.twt_flows[i].twt_wake_interval, config.twt_flows[i].twt_interval); - shell_fprintf(context.sh, SHELL_NORMAL, - "TWT Wake ahead duration : %d us\n", - config.twt_flows[i].twt_wake_ahead_duration); } } return 0; @@ -1136,7 +1133,7 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, context.sh = sh; - if (argc != 12) { + if (argc != 11) { shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); shell_help(sh); return -ENOEXEC; @@ -1196,11 +1193,6 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, } params.setup.twt_interval = (uint64_t)value; - if (!parse_number(sh, &value, argv[idx++], 0, WIFI_MAX_TWT_WAKE_AHEAD_DURATION_US)) { - return -EINVAL; - } - params.setup.twt_wake_ahead_duration = (uint32_t)value; - if (net_mgmt(NET_REQUEST_WIFI_TWT, iface, ¶ms, sizeof(params))) { shell_fprintf(sh, SHELL_WARNING, "%s with %s failed. reason : %s\n", wifi_twt_operation_txt(params.operation), @@ -1918,10 +1910,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, "\n" "\n" " " - " .\n" - ": 0us-2^31us>\n", + " .\n", cmd_wifi_twt_setup, - 12, 0), + 11, 0), SHELL_CMD_ARG(teardown, NULL, " Teardown a TWT flow:\n" "\n" "\n" From 1e0362f20a82e3d6005666e16af7a7fe88b8dad1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:47 +0100 Subject: [PATCH 1159/2300] Revert "[nrf fromtree] Bluetooth: BAP: Update log for unicast iso recv without endpoint" This reverts commit 23ae71a580a8c1b56867f2c9ce002a6af6a0b2fd. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/ascs.c | 3 +-- subsys/bluetooth/audio/bap_unicast_client.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/audio/ascs.c b/subsys/bluetooth/audio/ascs.c index 1709bc452d8..6df91e5f43e 100644 --- a/subsys/bluetooth/audio/ascs.c +++ b/subsys/bluetooth/audio/ascs.c @@ -766,8 +766,7 @@ static void ascs_iso_recv(struct bt_iso_chan *chan, * host as HCI ISO data packets, which we should just ignore */ if ((info->flags & BT_ISO_FLAGS_VALID) != 0) { - LOG_DBG("Valid ISO packet of len %zu received for iso %p not bound with ep", - net_buf_frags_len(buf), chan); + LOG_ERR("iso %p not bound with ep", chan); } return; diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 36938129773..b6de9b61a66 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -231,8 +231,7 @@ static void unicast_client_ep_iso_recv(struct bt_iso_chan *chan, * host as HCI ISO data packets, which we should just ignore */ if ((info->flags & BT_ISO_FLAGS_VALID) != 0) { - LOG_DBG("Valid ISO packet of len %zu received for iso %p not bound with ep", - net_buf_frags_len(buf), chan); + LOG_ERR("iso %p not bound with ep", chan); } return; From add96051e2da0cb9e62229b741feb7b1252fddc4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:47 +0100 Subject: [PATCH 1160/2300] Revert "[nrf fromlist] wifi: shell: Add band support for STA" This reverts commit e0c92c46df4350dff6d4820ce29140a3ca0fdac1. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 53 +++++++++------------------------ 1 file changed, 14 insertions(+), 39 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 7428a2a79e5..d70e48024b7 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -473,14 +473,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], /* Channel (optional: STA, mandatory: AP) */ if ((idx < argc) && (strlen(argv[idx]) <= 3)) { - uint8_t band; long channel = strtol(argv[idx], &endptr, 10); - const uint8_t all_bands[] = {WIFI_FREQ_BAND_2_4_GHZ, - WIFI_FREQ_BAND_5_GHZ, - WIFI_FREQ_BAND_6_GHZ}; - bool found = false; - char bands_str[MAX_BANDS_STR_LEN] = {0}; - size_t offset = 0; if (*endptr != '\0') { print(context.sh, SHELL_ERROR, @@ -491,40 +484,23 @@ static int __wifi_args_to_params(size_t argc, char *argv[], return -EINVAL; } - if (iface_mode == WIFI_MODE_INFRA) { - if (channel < 0) { - /* Negative channel means band */ - switch (-channel) { - case 2: - params->band = WIFI_FREQ_BAND_2_4_GHZ; - break; - case 5: - params->band = WIFI_FREQ_BAND_5_GHZ; - break; - case 6: - params->band = WIFI_FREQ_BAND_6_GHZ; - break; - default: - print(context.sh, SHELL_ERROR, - "Invalid band: %ld\n", channel); - return -EINVAL; - } - } + if (iface_mode == WIFI_MODE_INFRA && channel == 0) { + params->channel = WIFI_CHANNEL_ANY; } else { - if (channel < 0) { - print(context.sh, SHELL_ERROR, - "Invalid channel: %ld\n", channel); - return -EINVAL; - } - } - - if (channel > 0) { - for (band = 0; band < ARRAY_SIZE(all_bands); band++) { + const uint8_t bands[] = {WIFI_FREQ_BAND_2_4_GHZ, + WIFI_FREQ_BAND_5_GHZ, + WIFI_FREQ_BAND_6_GHZ}; + uint8_t band; + bool found = false; + char bands_str[MAX_BANDS_STR_LEN] = {0}; + size_t offset = 0; + + for (band = 0; band < ARRAY_SIZE(bands); band++) { offset += snprintf(bands_str + offset, sizeof(bands_str) - offset, "%s%s", band ? "," : "", - wifi_band_txt(all_bands[band])); + wifi_band_txt(bands[band])); if (offset >= sizeof(bands_str)) { print(context.sh, SHELL_ERROR, "Failed to parse channel: %s: " @@ -533,7 +509,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], return -EINVAL; } - if (wifi_utils_validate_chan(all_bands[band], + if (wifi_utils_validate_chan(bands[band], channel)) { found = true; break; @@ -1930,8 +1906,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD_ARG(connect, NULL, "Connect to a Wi-Fi AP\n" "\"\"\n" - "[channel number/band: > 0:Channel, 0:any channel,\n" - "< 0:band (-2:2.4GHz, -5:5GHz, -6:6GHz]\n" + "[channel number: 0 means all]\n" "[PSK: valid only for secure SSIDs]\n" "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" From 007eaf2d3f18d4d2a0e15a78faec2e600f4cc869 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:47 +0100 Subject: [PATCH 1161/2300] Revert "[nrf fromtree] Bluetooth: Mesh: enable access responses randomization" This reverts commit a6a56ef4246671b04bf89cd61cb57948eada25a1. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 15 ++------------- subsys/bluetooth/mesh/access.c | 10 ++-------- tests/bsim/bluetooth/mesh/src/test_access.c | 11 +++-------- tests/bsim/bluetooth/mesh/src/test_persistence.c | 6 ++++++ tests/bsim/bluetooth/mesh/src/test_provision.c | 10 ++++++++++ .../access/access_transmit_delayable.sh | 2 +- .../priv_beacon/proxy_adv_multi_subnet_coex.sh | 4 ---- 7 files changed, 24 insertions(+), 34 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 555aac45bc0..af6af8c44dc 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -639,7 +639,6 @@ config BT_MESH_LABEL_NO_RECOVER menuconfig BT_MESH_ACCESS_DELAYABLE_MSG bool "Access layer tx delayable message" - default y help Enable following of the message transmitting recommendations, the Access layer specification. The recommendations are optional. @@ -648,16 +647,6 @@ menuconfig BT_MESH_ACCESS_DELAYABLE_MSG if BT_MESH_ACCESS_DELAYABLE_MSG -config BT_MESH_ACCESS_DELAYABLE_MSG_CTX_ENABLED - bool "The delayable message in the notification message context" - default y - help - Controls whether the delayable message feature is enabled by default in - the message context of the opcode notifications. This allows the server part of any - model to not bother about additional context configuration to enable the delayable message. - Note that if this is disabled then all foundation models stop using the delayable message - functionality. - config BT_MESH_ACCESS_DELAYABLE_MSG_COUNT int "Number of simultaneously delayed messages" default 4 @@ -668,14 +657,14 @@ config BT_MESH_ACCESS_DELAYABLE_MSG_COUNT config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE int "Maximum delayable message storage chunk" - default 10 + default 20 help Size of memory that Access layer uses to split model message to. It allocates a sufficient number of these chunks from the pool to store the full model payload. config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT int "Maximum number of available chunks" - default 40 + default 20 help The maximum number of available chunks the Access layer allocates to store model payload. It is recommended to keep chunk size equal to the reasonable small value to prevent diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 23fbb8e82c2..c3ef6a40554 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -922,7 +922,7 @@ static void mod_publish(struct k_work *work) return; } - LOG_DBG("timestamp: %u", k_uptime_get_32()); + LOG_DBG("%u", k_uptime_get_32()); if (pub->count) { pub->count--; @@ -1504,10 +1504,6 @@ static int element_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple return ACCESS_STATUS_MESSAGE_NOT_UNDERSTOOD; } - if (IS_ENABLED(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CTX_ENABLED)) { - ctx->rnd_delay = true; - } - net_buf_simple_save(buf, &state); err = op->func(model, ctx, buf); net_buf_simple_restore(buf, &state); @@ -1582,9 +1578,7 @@ int bt_mesh_model_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx } #if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG - /* No sense to use delayable message for unicast loopback. */ - if (ctx->rnd_delay && - !(bt_mesh_has_addr(ctx->addr) && BT_MESH_ADDR_IS_UNICAST(ctx->addr))) { + if (ctx->rnd_delay) { return bt_mesh_delayable_msg_manage(ctx, msg, bt_mesh_model_elem(model)->rt->addr, cb, cb_data); } diff --git a/tests/bsim/bluetooth/mesh/src/test_access.c b/tests/bsim/bluetooth/mesh/src/test_access.c index 6967aa6d71c..5cb7d2e28e1 100644 --- a/tests/bsim/bluetooth/mesh/src/test_access.c +++ b/tests/bsim/bluetooth/mesh/src/test_access.c @@ -102,15 +102,11 @@ static bool publish_allow; static int model1_update(const struct bt_mesh_model *model) { - if (!publish_allow) { - return -1; - } - model->pub->msg->data[1]++; + LOG_DBG("New pub: n: %d t: %d", model->pub->msg->data[1], k_uptime_get_32()); - k_sem_give(&publish_sem); - return 0; + return publish_allow ? k_sem_give(&publish_sem), 0 : -1; } static int test_msgf_handler(const struct bt_mesh_model *model, @@ -608,8 +604,7 @@ static void recv_delayable_check(int32_t interval, uint8_t count) LOG_DBG("Recv time: %d delta: %d boundaries: %d/%d", (int32_t)timestamp, time_delta, lower_boundary, upper_boundary); - ASSERT_IN_RANGE(time_delta, lower_boundary - RX_JITTER_MAX, - upper_boundary + RX_JITTER_MAX); + ASSERT_IN_RANGE(time_delta, lower_boundary, upper_boundary + RX_JITTER_MAX); } } diff --git a/tests/bsim/bluetooth/mesh/src/test_persistence.c b/tests/bsim/bluetooth/mesh/src/test_persistence.c index 4bf1f9faa93..ec7d838d26a 100644 --- a/tests/bsim/bluetooth/mesh/src/test_persistence.c +++ b/tests/bsim/bluetooth/mesh/src/test_persistence.c @@ -455,6 +455,12 @@ static void provisioner_setup(void) FAIL("Failed to add test_netkey (err: %d, status: %d)", err, status); } + err = bt_mesh_cfg_cli_net_transmit_set(test_netkey_idx, TEST_PROV_ADDR, + BT_MESH_TRANSMIT(3, 50), &status); + if (err || status != BT_MESH_TRANSMIT(3, 50)) { + FAIL("Net transmit set failed (err %d, transmit %x)", err, status); + } + provisioner_ready = true; } diff --git a/tests/bsim/bluetooth/mesh/src/test_provision.c b/tests/bsim/bluetooth/mesh/src/test_provision.c index 3d0e8010c75..2bff871b187 100644 --- a/tests/bsim/bluetooth/mesh/src/test_provision.c +++ b/tests/bsim/bluetooth/mesh/src/test_provision.c @@ -1205,6 +1205,7 @@ static void test_provisioner_pb_remote_client_nppi_robustness(void) uint16_t pb_remote_server_addr; uint8_t status; struct bt_mesh_cdb_node *node; + int err; provisioner_pb_remote_client_setup(); @@ -1218,6 +1219,15 @@ static void test_provisioner_pb_remote_client_nppi_robustness(void) .ttl = 3, }; + /* Set Network Transmit Count state on the remote client greater than on the remote server + * to increase probability of reception responses. + */ + err = bt_mesh_cfg_cli_net_transmit_set(0, current_dev_addr, BT_MESH_TRANSMIT(3, 50), + &status); + if (err || status != BT_MESH_TRANSMIT(3, 50)) { + FAIL("Net transmit set failed (err %d, transmit %x)", err, status); + } + ASSERT_OK(provision_remote(&srv, 2, &srv.addr)); /* Check device key by adding appkey. */ diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh index 0e966288db0..1622ac49f06 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh @@ -14,4 +14,4 @@ RunTest mesh_access_pub_transmit_delayable_retr_1d1 \ conf=prj_mesh1d1_conf overlay=overlay_psa_conf RunTest mesh_access_pub_transmit_delayable_retr_psa \ - access_tx_transmit_delayable access_rx_transmit_delayable + access_tx_period_delayable access_rx_period_delayable diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh index 42863a13458..aa96ee325d8 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh @@ -22,10 +22,6 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # window. The Mesh Protocol specification does not specify exactly the # timing for Proxy ADV messages. -# Note 3: The proxy transmitting device mandates emitting of the secure -# network beacons. This allows to check that proxy goes back to normal -# behavior after the device advertises the secure network beacons. - # Test procedure: # 1. (0-20 seconds) A single subnet is active on the TX device with GATT # Proxy enabled. RX device verifies that the single subnet has exclusive From f8b758f1d942dc300e9a61f91cbeee30716e56a7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:47 +0100 Subject: [PATCH 1162/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Fix dereferencing before null pointer check" This reverts commit b8110a76319fa80642c5487f6abc4757ea9a6b40. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/delayable_msg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/subsys/bluetooth/mesh/delayable_msg.c b/subsys/bluetooth/mesh/delayable_msg.c index a1a247bb9c9..5fa43205d63 100644 --- a/subsys/bluetooth/mesh/delayable_msg.c +++ b/subsys/bluetooth/mesh/delayable_msg.c @@ -167,15 +167,13 @@ static bool push_msg_from_delayable_msgs(void) sys_snode_t *node; struct delayable_msg_chunk *chunk; struct delayable_msg_ctx *msg = peek_pending_msg(); - uint16_t len; + uint16_t len = msg->len; int err; if (!msg) { return false; } - len = msg->len; - NET_BUF_SIMPLE_DEFINE(buf, BT_MESH_TX_SDU_MAX); SYS_SLIST_FOR_EACH_NODE(&msg->chunks, node) { From 17076565ab71394d4909e164a8f935fee5cbe21f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:47 +0100 Subject: [PATCH 1163/2300] Revert "[nrf fromtree] net: openthread: upmerge to `7761b81`" This reverts commit 69d2df6d19be8abacadfe9db098036dc9e2e3e49. Signed-off-by: Robert Lubos --- drivers/ieee802154/ieee802154_nrf5.c | 6 ------ include/zephyr/net/ieee802154_radio.h | 9 --------- modules/openthread/platform/radio.c | 16 ---------------- west.yml | 2 +- 4 files changed, 1 insertion(+), 32 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index cbf16c4f534..385db51f2d4 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -897,12 +897,6 @@ static int nrf5_configure(const struct device *dev, uint8_t element_id; bool valid_vendor_specific_ie = false; - if (config->ack_ie.purge_ie) { - nrf_802154_ack_data_remove_all(false, NRF_802154_ACK_DATA_IE); - nrf_802154_ack_data_remove_all(true, NRF_802154_ACK_DATA_IE); - break; - } - if (config->ack_ie.short_addr == IEEE802154_BROADCAST_ADDRESS || config->ack_ie.ext_addr == NULL) { return -ENOTSUP; diff --git a/include/zephyr/net/ieee802154_radio.h b/include/zephyr/net/ieee802154_radio.h index 259d67b4321..de0cf89da4c 100644 --- a/include/zephyr/net/ieee802154_radio.h +++ b/include/zephyr/net/ieee802154_radio.h @@ -1241,15 +1241,6 @@ struct ieee802154_config { * in CPU byte order */ uint16_t short_addr; - - /** - * Flag for purging enh ACK header IEs. - * When flag is set to true, driver should remove all existing - * header IEs, and all other entries in config should be ignored. - * This means that purging current header IEs and - * configuring a new one in the same call is not allowed. - */ - bool purge_ie; } ack_ie; }; }; diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index d405539bcc0..c0df98367af 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1294,22 +1294,6 @@ otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShort return result ? OT_ERROR_FAILED : OT_ERROR_NONE; } -otError otPlatRadioResetCsl(otInstance *aInstance) -{ - struct ieee802154_config config = { 0 }; - int result; - - result = radio_api->configure(radio_dev, IEEE802154_CONFIG_CSL_PERIOD, &config); - if (result) { - return OT_ERROR_FAILED; - } - - config.ack_ie.purge_ie = true; - result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); - - return result ? OT_ERROR_FAILED : OT_ERROR_NONE; -} - void otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTime) { ARG_UNUSED(aInstance); diff --git a/west.yml b/west.yml index 301482839cb..5b660892783 100644 --- a/west.yml +++ b/west.yml @@ -301,7 +301,7 @@ manifest: revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 path: modules/lib/open-amp - name: openthread - revision: 7761b81d23b10b3d5ee21b8504c67535cde10896 + revision: 00076aff3ae571db7c90509ec9dc293457098c35 path: modules/lib/openthread - name: percepio path: modules/debug/percepio From 3b1776d90b41de17a9284601cefc4ee6bf482f09 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:48 +0100 Subject: [PATCH 1164/2300] Revert "[nrf fromtree] drivers: ieee802154: fix handling of `struct ieee802154_config`" This reverts commit f13234ced630404dbf4cb3eec5059a4cbfcc4fdb. Signed-off-by: Robert Lubos --- modules/openthread/platform/radio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index c0df98367af..a26c66d875d 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1255,7 +1255,10 @@ void otPlatRadioSetMacFrameCounterIfLarger(otInstance *aInstance, uint32_t aMacF otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShortAddress aShortAddr, const otExtAddress *aExtAddr) { - struct ieee802154_config config = { 0 }; + struct ieee802154_config config = { + .ack_ie.short_addr = aShortAddr, + .ack_ie.ext_addr = aExtAddr->m8, + }; int result; ARG_UNUSED(aInstance); @@ -1268,8 +1271,6 @@ otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShort if (result) { return OT_ERROR_FAILED; } - config.ack_ie.short_addr = aShortAddr; - config.ack_ie.ext_addr = aExtAddr != NULL ? aExtAddr->m8 : NULL; /* Configure the CSL IE. */ if (aCslPeriod > 0) { From 50d596463581a27a7a265fa22328dd5caf8d6776 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:48 +0100 Subject: [PATCH 1165/2300] Revert "[nrf fromtree] drivers: ieee802154: fix ACK header IE implementation" This reverts commit b8954741257946674b21f10697585f7da4e355dc. Signed-off-by: Robert Lubos --- drivers/ieee802154/ieee802154_nrf5.c | 38 ++++++++++++++-------------- modules/openthread/platform/radio.c | 13 ++++++---- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 385db51f2d4..f6a69307846 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -895,38 +895,35 @@ static int nrf5_configure(const struct device *dev, uint8_t ext_addr_le[EXTENDED_ADDRESS_SIZE]; uint8_t short_addr_le[SHORT_ADDRESS_SIZE]; uint8_t element_id; - bool valid_vendor_specific_ie = false; if (config->ack_ie.short_addr == IEEE802154_BROADCAST_ADDRESS || config->ack_ie.ext_addr == NULL) { return -ENOTSUP; } - sys_put_le16(config->ack_ie.short_addr, short_addr_le); - sys_memcpy_swap(ext_addr_le, config->ack_ie.ext_addr, EXTENDED_ADDRESS_SIZE); + element_id = ieee802154_header_ie_get_element_id(config->ack_ie.header_ie); - 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); - 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); + if (element_id != IEEE802154_HEADER_IE_ELEMENT_ID_CSL_IE && + (!IS_ENABLED(CONFIG_NET_L2_OPENTHREAD) || + element_id != IEEE802154_HEADER_IE_ELEMENT_ID_VENDOR_SPECIFIC_IE)) { + return -ENOTSUP; + } #if defined(CONFIG_NET_L2_OPENTHREAD) - uint8_t vendor_oui_le[IEEE802154_OPENTHREAD_VENDOR_OUI_LEN] = - IEEE802154_OPENTHREAD_THREAD_IE_VENDOR_OUI; + uint8_t vendor_oui_le[IEEE802154_OPENTHREAD_VENDOR_OUI_LEN] = + IEEE802154_OPENTHREAD_THREAD_IE_VENDOR_OUI; - if (element_id == IEEE802154_HEADER_IE_ELEMENT_ID_VENDOR_SPECIFIC_IE && - memcmp(config->ack_ie.header_ie->content.vendor_specific.vendor_oui, - vendor_oui_le, sizeof(vendor_oui_le)) == 0) { - valid_vendor_specific_ie = true; - } + if (element_id == IEEE802154_HEADER_IE_ELEMENT_ID_VENDOR_SPECIFIC_IE && + memcmp(config->ack_ie.header_ie->content.vendor_specific.vendor_oui, + vendor_oui_le, sizeof(vendor_oui_le))) { + return -ENOTSUP; + } #endif - if (element_id != IEEE802154_HEADER_IE_ELEMENT_ID_CSL_IE && - !valid_vendor_specific_ie) { - return -ENOTSUP; - } + sys_put_le16(config->ack_ie.short_addr, short_addr_le); + sys_memcpy_swap(ext_addr_le, config->ack_ie.ext_addr, EXTENDED_ADDRESS_SIZE); + if (config->ack_ie.header_ie && config->ack_ie.header_ie->length > 0) { 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, @@ -935,6 +932,9 @@ static int nrf5_configure(const struct device *dev, config->ack_ie.header_ie->length + IEEE802154_HEADER_IE_HEADER_LENGTH, NRF_802154_ACK_DATA_IE); + } else { + 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); } } break; diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index a26c66d875d..cec73e3ef6f 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1348,7 +1348,7 @@ uint8_t otPlatRadioGetCslUncertainty(otInstance *aInstance) * | IE_VENDOR_THREAD_ACK_PROBING_ID | LINK_METRIC_TOKEN | LINK_METRIC_TOKEN| * |---------------------------------|-------------------|------------------| */ -static void set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, uint8_t *ie_header) +static uint8_t set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, uint8_t *ie_header) { /* Vendor-specific IE identifier */ const uint8_t ie_vendor_id = 0x00; @@ -1362,6 +1362,7 @@ static void set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, uint8 const uint8_t ie_vendor_thread_margin_token = 0x02; /* Thread Vendor-specific ACK Probing IE LQI value placeholder */ const uint8_t ie_vendor_thread_lqi_token = 0x03; + const uint8_t ie_header_size = 2; const uint8_t oui_size = 3; const uint8_t sub_type = 1; const uint8_t id_offset = 7; @@ -1379,8 +1380,7 @@ static void set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, uint8 __ASSERT(ie_header, "Invalid argument"); if (link_metrics_data_len == 0) { - ie_header[0] = 0; - return; + return 0; } /* Set Element ID */ @@ -1415,6 +1415,8 @@ static void set_vendor_ie_header_lm(bool lqi, bool link_margin, bool rssi, uint8 if (rssi) { ie_header[link_metrics_idx++] = ie_vendor_thread_rssi_token; } + + return ie_header_size + content_len; } otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics aLinkMetrics, @@ -1426,12 +1428,13 @@ otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics a .ack_ie.ext_addr = aExtAddress->m8, }; uint8_t header_ie_buf[OT_ACK_IE_MAX_SIZE]; + uint16_t header_ie_len; int result; ARG_UNUSED(aInstance); - set_vendor_ie_header_lm(aLinkMetrics.mLqi, aLinkMetrics.mLinkMargin, - aLinkMetrics.mRssi, header_ie_buf); + header_ie_len = set_vendor_ie_header_lm(aLinkMetrics.mLqi, aLinkMetrics.mLinkMargin, + aLinkMetrics.mRssi, header_ie_buf); config.ack_ie.header_ie = (struct ieee802154_header_ie *)header_ie_buf; result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); From bf659c788a5710c8ea4ee9ab63ec318452de8e3e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:48 +0100 Subject: [PATCH 1166/2300] Revert "[nrf fromtree] net: wifi_shell: Remove TX-Injection and Promisc mode" This reverts commit 50e4e100d027724505a049264607ac2dac76d2b0. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d70e48024b7..5a3d7e632a7 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1539,6 +1539,8 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, static struct option long_options[] = {{"if-index", optional_argument, 0, 'i'}, {"sta", no_argument, 0, 's'}, {"monitor", no_argument, 0, 'm'}, + {"tx-injection", no_argument, 0, 't'}, + {"promiscuous", no_argument, 0, 'p'}, {"ap", no_argument, 0, 'a'}, {"softap", no_argument, 0, 'k'}, {"get", no_argument, 0, 'g'}, @@ -1553,6 +1555,12 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, case 'm': mode->mode |= WIFI_MONITOR_MODE; break; + case 't': + mode->mode |= WIFI_TX_INJECTION_MODE; + break; + case 'p': + mode->mode |= WIFI_PROMISCUOUS_MODE; + break; case 'a': mode->mode |= WIFI_AP_MODE; break; @@ -1954,6 +1962,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-i, --if-index ] : Interface index\n" "[-s, --sta] : Station mode\n" "[-m, --monitor] : Monitor mode\n" + "[-p, --promiscuous] : Promiscuous mode\n" + "[-t, --tx-injection] : TX-Injection mode\n" "[-a, --ap] : AP mode\n" "[-k, --softap] : Softap mode\n" "[-h, --help] : Help\n" From e8505769cbd66a8eca6c55c349120591783b316e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:48 +0100 Subject: [PATCH 1167/2300] Revert "[nrf fromtree] net: l2: ethernet: bring in TX-Injection mode to l2 ethernet" This reverts commit fafa7e12081d7e748599fb82a0f9fa6bc9e742fb. Signed-off-by: Robert Lubos --- include/zephyr/net/ethernet.h | 16 ---------------- include/zephyr/net/ethernet_mgmt.h | 13 ------------- subsys/net/l2/ethernet/ethernet.c | 14 -------------- subsys/net/l2/ethernet/ethernet_mgmt.c | 26 -------------------------- 4 files changed, 69 deletions(-) diff --git a/include/zephyr/net/ethernet.h b/include/zephyr/net/ethernet.h index faa6cf7fc0b..181503140a7 100644 --- a/include/zephyr/net/ethernet.h +++ b/include/zephyr/net/ethernet.h @@ -179,9 +179,6 @@ enum ethernet_hw_caps { /** TXTIME supported */ ETHERNET_TXTIME = BIT(19), - - /** TX-Injection supported */ - ETHERNET_TXINJECTION_MODE = BIT(20), }; /** @cond INTERNAL_HIDDEN */ @@ -200,7 +197,6 @@ enum ethernet_config_type { ETHERNET_CONFIG_TYPE_FILTER, ETHERNET_CONFIG_TYPE_PORTS_NUM, ETHERNET_CONFIG_TYPE_T1S_PARAM, - ETHERNET_CONFIG_TYPE_TXINJECTION_MODE, }; enum ethernet_qav_param_type { @@ -446,7 +442,6 @@ struct ethernet_config { bool auto_negotiation; bool full_duplex; bool promisc_mode; - bool txinjection_mode; struct { bool link_10bt; @@ -1034,17 +1029,6 @@ void net_eth_carrier_off(struct net_if *iface); */ int net_eth_promisc_mode(struct net_if *iface, bool enable); -/** - * @brief Set TX-Injection mode either ON or OFF. - * - * @param iface Network interface - * - * @param enable on (true) or off (false) - * - * @return 0 if mode set or unset was successful, <0 otherwise. - */ -int net_eth_txinjection_mode(struct net_if *iface, bool enable); - /** * @brief Return PTP clock that is tied to this ethernet network interface. * diff --git a/include/zephyr/net/ethernet_mgmt.h b/include/zephyr/net/ethernet_mgmt.h index 18039e9f3aa..32a38f2df88 100644 --- a/include/zephyr/net/ethernet_mgmt.h +++ b/include/zephyr/net/ethernet_mgmt.h @@ -52,8 +52,6 @@ enum net_request_ethernet_cmd { NET_REQUEST_ETHERNET_CMD_GET_QBU_PARAM, NET_REQUEST_ETHERNET_CMD_GET_TXTIME_PARAM, NET_REQUEST_ETHERNET_CMD_SET_T1S_PARAM, - NET_REQUEST_ETHERNET_CMD_SET_TXINJECTION_MODE, - NET_REQUEST_ETHERNET_CMD_GET_TXINJECTION_MODE, }; #define NET_REQUEST_ETHERNET_SET_AUTO_NEGOTIATION \ @@ -136,16 +134,6 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXTIME_PARAM); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_T1S_PARAM); -#define NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE \ - (_NET_ETHERNET_BASE | NET_REQUEST_ETHERNET_CMD_SET_TXINJECTION_MODE) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE); - -#define NET_REQUEST_ETHERNET_GET_TXINJECTION_MODE \ - (_NET_ETHERNET_BASE | NET_REQUEST_ETHERNET_CMD_GET_TXINJECTION_MODE) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXINJECTION_MODE); - struct net_eth_addr; struct ethernet_qav_param; struct ethernet_qbv_param; @@ -157,7 +145,6 @@ struct ethernet_req_params { bool auto_negotiation; bool full_duplex; bool promisc_mode; - bool txinjection_mode; struct { bool link_10bt; diff --git a/subsys/net/l2/ethernet/ethernet.c b/subsys/net/l2/ethernet/ethernet.c index 8e73e8bcd43..2be3c5f2820 100644 --- a/subsys/net/l2/ethernet/ethernet.c +++ b/subsys/net/l2/ethernet/ethernet.c @@ -1197,20 +1197,6 @@ int net_eth_promisc_mode(struct net_if *iface, bool enable) } #endif/* CONFIG_NET_PROMISCUOUS_MODE */ -int net_eth_txinjection_mode(struct net_if *iface, bool enable) -{ - struct ethernet_req_params params; - - if (!(net_eth_get_hw_capabilities(iface) & ETHERNET_TXINJECTION_MODE)) { - return -ENOTSUP; - } - - params.txinjection_mode = enable; - - return net_mgmt(NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE, iface, - ¶ms, sizeof(struct ethernet_req_params)); -} - void ethernet_init(struct net_if *iface) { struct ethernet_context *ctx = net_if_l2_data(iface); diff --git a/subsys/net/l2/ethernet/ethernet_mgmt.c b/subsys/net/l2/ethernet/ethernet_mgmt.c index 899aa7a9516..3e957e52c1e 100644 --- a/subsys/net/l2/ethernet/ethernet_mgmt.c +++ b/subsys/net/l2/ethernet/ethernet_mgmt.c @@ -200,13 +200,6 @@ static int ethernet_set_config(uint32_t mgmt_request, memcpy(&config.t1s_param, ¶ms->t1s_param, sizeof(struct ethernet_t1s_param)); type = ETHERNET_CONFIG_TYPE_T1S_PARAM; - } else if (mgmt_request == NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE) { - if (!is_hw_caps_supported(dev, ETHERNET_TXINJECTION_MODE)) { - return -ENOTSUP; - } - - config.txinjection_mode = params->txinjection_mode; - type = ETHERNET_CONFIG_TYPE_TXINJECTION_MODE; } else { return -EINVAL; } @@ -244,9 +237,6 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_PROMISC_MODE, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_T1S_PARAM, ethernet_set_config); -NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE, - ethernet_set_config); - static int ethernet_get_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) @@ -440,19 +430,6 @@ static int ethernet_get_config(uint32_t mgmt_request, config.txtime_param.enable_txtime; break; } - } else if (mgmt_request == NET_REQUEST_ETHERNET_GET_TXINJECTION_MODE) { - if (!is_hw_caps_supported(dev, ETHERNET_TXINJECTION_MODE)) { - return -ENOTSUP; - } - - type = ETHERNET_CONFIG_TYPE_TXINJECTION_MODE; - - ret = api->get_config(dev, type, &config); - if (ret) { - return ret; - } - - params->txinjection_mode = config.txinjection_mode; } else { return -EINVAL; } @@ -478,9 +455,6 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_QBU_PARAM, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXTIME_PARAM, ethernet_get_config); -NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXINJECTION_MODE, - ethernet_get_config); - void ethernet_mgmt_raise_carrier_on_event(struct net_if *iface) { net_mgmt_event_notify(NET_EVENT_ETHERNET_CARRIER_ON, iface); From 056abefe7f3d44fb57691cc091e9cb82eac4b74e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:48 +0100 Subject: [PATCH 1168/2300] Revert "[nrf fromtree] net: ethernet: Add support for setting T1S PLCA parameters" This reverts commit 91c42f316a459d1c56d777dbf4cfef41ca961878. Signed-off-by: Robert Lubos --- include/zephyr/net/ethernet.h | 48 -------------------------- include/zephyr/net/ethernet_mgmt.h | 7 ---- subsys/net/l2/ethernet/ethernet_mgmt.c | 11 ------ 3 files changed, 66 deletions(-) diff --git a/include/zephyr/net/ethernet.h b/include/zephyr/net/ethernet.h index 181503140a7..a47ec767a60 100644 --- a/include/zephyr/net/ethernet.h +++ b/include/zephyr/net/ethernet.h @@ -196,7 +196,6 @@ enum ethernet_config_type { ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM, ETHERNET_CONFIG_TYPE_FILTER, ETHERNET_CONFIG_TYPE_PORTS_NUM, - ETHERNET_CONFIG_TYPE_T1S_PARAM, }; enum ethernet_qav_param_type { @@ -207,53 +206,7 @@ enum ethernet_qav_param_type { ETHERNET_QAV_PARAM_TYPE_STATUS, }; -enum ethernet_t1s_param_type { - ETHERNET_T1S_PARAM_TYPE_PLCA_CONFIG, -}; - /** @endcond */ -struct ethernet_t1s_param { - /** Type of T1S parameter */ - enum ethernet_t1s_param_type type; - union { - /* PLCA is the Physical Layer (PHY) Collision - * Avoidance technique employed with multidrop - * 10Base-T1S standard. - * - * The PLCA parameters are described in standard [1] - * as registers in memory map 4 (MMS = 4) (point 9.6). - * - * IDVER (PLCA ID Version) - * CTRL0 (PLCA Control 0) - * CTRL1 (PLCA Control 1) - * STATUS (PLCA Status) - * TOTMR (PLCA TO Control) - * BURST (PLCA Burst Control) - * - * Those registers are implemented by each OA TC6 - * compliant vendor (like for e.g. LAN865x - e.g. [2]). - * - * Documents: - * [1] - "OPEN Alliance 10BASE-T1x MAC-PHY Serial - * Interface" (ver. 1.1) - * [2] - "DS60001734C" - LAN865x data sheet - */ - struct { - /** T1S PLCA enabled */ - bool enable; - /** T1S PLCA node id range: 0 to 254 */ - uint8_t node_id; - /** T1S PLCA node count range: 1 to 255 */ - uint8_t node_count; - /** T1S PLCA burst count range: 0x0 to 0xFF */ - uint8_t burst_count; - /** T1S PLCA burst timer */ - uint8_t burst_timer; - /** T1S PLCA TO value */ - uint8_t to_timer; - } plca; - }; -}; struct ethernet_qav_param { /** ID of the priority queue to use */ @@ -451,7 +404,6 @@ struct ethernet_config { struct net_eth_addr mac_address; - struct ethernet_t1s_param t1s_param; struct ethernet_qav_param qav_param; struct ethernet_qbv_param qbv_param; struct ethernet_qbu_param qbu_param; diff --git a/include/zephyr/net/ethernet_mgmt.h b/include/zephyr/net/ethernet_mgmt.h index 32a38f2df88..9d95fa7a42e 100644 --- a/include/zephyr/net/ethernet_mgmt.h +++ b/include/zephyr/net/ethernet_mgmt.h @@ -51,7 +51,6 @@ enum net_request_ethernet_cmd { NET_REQUEST_ETHERNET_CMD_GET_QBV_PARAM, NET_REQUEST_ETHERNET_CMD_GET_QBU_PARAM, NET_REQUEST_ETHERNET_CMD_GET_TXTIME_PARAM, - NET_REQUEST_ETHERNET_CMD_SET_T1S_PARAM, }; #define NET_REQUEST_ETHERNET_SET_AUTO_NEGOTIATION \ @@ -129,11 +128,6 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_QBU_PARAM); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_GET_TXTIME_PARAM); -#define NET_REQUEST_ETHERNET_SET_T1S_PARAM \ - (_NET_ETHERNET_BASE | NET_REQUEST_ETHERNET_CMD_SET_T1S_PARAM) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_T1S_PARAM); - struct net_eth_addr; struct ethernet_qav_param; struct ethernet_qbv_param; @@ -158,7 +152,6 @@ struct ethernet_req_params { struct ethernet_qbv_param qbv_param; struct ethernet_qbu_param qbu_param; struct ethernet_txtime_param txtime_param; - struct ethernet_t1s_param t1s_param; int priority_queues_num; int ports_num; diff --git a/subsys/net/l2/ethernet/ethernet_mgmt.c b/subsys/net/l2/ethernet/ethernet_mgmt.c index 3e957e52c1e..e7fcae8ac99 100644 --- a/subsys/net/l2/ethernet/ethernet_mgmt.c +++ b/subsys/net/l2/ethernet/ethernet_mgmt.c @@ -192,14 +192,6 @@ static int ethernet_set_config(uint32_t mgmt_request, config.promisc_mode = params->promisc_mode; type = ETHERNET_CONFIG_TYPE_PROMISC_MODE; - } else if (mgmt_request == NET_REQUEST_ETHERNET_SET_T1S_PARAM) { - if (net_if_is_up(iface)) { - return -EACCES; - } - - memcpy(&config.t1s_param, ¶ms->t1s_param, - sizeof(struct ethernet_t1s_param)); - type = ETHERNET_CONFIG_TYPE_T1S_PARAM; } else { return -EINVAL; } @@ -234,9 +226,6 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_TXTIME_PARAM, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_PROMISC_MODE, ethernet_set_config); -NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_T1S_PARAM, - ethernet_set_config); - static int ethernet_get_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) From 332b731268f223ff0ca40b59d8c079b44ec21914 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:48 +0100 Subject: [PATCH 1169/2300] Revert "[nrf fromlist] wifi: shell: ap: Add a command to disconnect a station" This reverts commit 3a813989cee3728a64d67ca887b78fa814a304f4. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 5a3d7e632a7..70b4f96d861 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1353,34 +1353,6 @@ static int cmd_wifi_ap_stations(const struct shell *sh, size_t argc, return 0; } -static int cmd_wifi_ap_sta_disconnect(const struct shell *sh, size_t argc, - char *argv[]) -{ - struct net_if *iface = net_if_get_first_wifi(); - uint8_t mac[6]; - int ret; - - if (argc != 2) { - shell_fprintf(sh, SHELL_WARNING, "Invalid number of arguments\n"); - shell_help(sh); - return -ENOEXEC; - } - - if (net_bytes_from_str(mac, sizeof(mac), argv[1]) < 0) { - shell_fprintf(sh, SHELL_WARNING, "Invalid MAC address\n"); - return -ENOEXEC; - } - - ret = net_mgmt(NET_REQUEST_WIFI_AP_STA_DISCONNECT, iface, mac, sizeof(mac)); - if (ret) { - shell_fprintf(sh, SHELL_WARNING, "AP station disconnect failed: %s\n", - strerror(-ret)); - return -ENOEXEC; - } - - shell_fprintf(sh, SHELL_NORMAL, "AP station disconnect requested\n"); - return 0; -} static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, char *argv[]) @@ -1877,11 +1849,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, "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), SHELL_SUBCMD_SET_END ); From 66344bcd729a0a8ca63b575003347f0a46fb7fdf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:49 +0100 Subject: [PATCH 1170/2300] Revert "[nrf fromlist] wifi: ap: Add support to disconnect a STA" This reverts commit f02cd371e12572110f6ffb517ac05ce180143b5c. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 15 --------------- subsys/net/l2/wifi/wifi_mgmt.c | 24 ------------------------ 2 files changed, 39 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index bd8cba81d28..0c64cab3c01 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -81,8 +81,6 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_PACKET_FILTER, /** Set or get Wi-Fi channel for Monitor or TX-Injection mode */ NET_REQUEST_WIFI_CMD_CHANNEL, - /** Disconnect a STA from AP */ - NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT, NET_REQUEST_WIFI_CMD_MAX }; @@ -160,11 +158,6 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PACKET_FILTER); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL); -#define NET_REQUEST_WIFI_AP_STA_DISCONNECT \ - (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT); - /** Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -733,14 +726,6 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*ap_disable)(const struct device *dev); - /** Disconnect a STA from AP - * - * @param dev Pointer to the device structure for the driver instance. - * @param mac MAC address of the STA to disconnect - * - * @return 0 if ok, < 0 if error - */ - int (*ap_sta_disconnect)(const struct device *dev, const uint8_t *mac); /** Get interface status * * @param dev Pointer to the device structure for the driver instance. diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 2cfe8e25d89..6e0cb761dbf 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -410,30 +410,6 @@ static int wifi_ap_disable(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_DISABLE, wifi_ap_disable); -static int wifi_ap_sta_disconnect(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); - uint8_t *mac = data; - - if (dev == NULL) { - return -ENODEV; - } - - if (wifi_mgmt_api == NULL || wifi_mgmt_api->ap_sta_disconnect == NULL) { - return -ENOTSUP; - } - - if (!data || len != sizeof(uint8_t) * WIFI_MAC_ADDR_LEN) { - return -EINVAL; - } - - return wifi_mgmt_api->ap_sta_disconnect(dev, mac); -} - -NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT, wifi_ap_sta_disconnect); - static int wifi_iface_status(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { From 83dee12e895db5a15c0df0dd2837981d3636651b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:49 +0100 Subject: [PATCH 1171/2300] Revert "[nrf fromtree] Bluetooth: BAP: Fix issue with setting invalid iso data path" This reverts commit a58c9b5190197c036a192bec02acf1ae98d9c682. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/ascs.c | 6 ++- subsys/bluetooth/audio/bap_broadcast_sink.c | 2 +- subsys/bluetooth/audio/bap_broadcast_source.c | 4 +- subsys/bluetooth/audio/bap_iso.c | 48 ++++--------------- subsys/bluetooth/audio/bap_iso.h | 1 - subsys/bluetooth/audio/bap_stream.c | 22 +++++++++ subsys/bluetooth/audio/bap_stream.h | 2 + subsys/bluetooth/audio/bap_unicast_client.c | 13 ++++- 8 files changed, 52 insertions(+), 46 deletions(-) diff --git a/subsys/bluetooth/audio/ascs.c b/subsys/bluetooth/audio/ascs.c index 6df91e5f43e..116071d4c0f 100644 --- a/subsys/bluetooth/audio/ascs.c +++ b/subsys/bluetooth/audio/ascs.c @@ -1820,7 +1820,11 @@ static int ase_stream_qos(struct bt_bap_stream *stream, struct bt_audio_codec_qo * we have the ISO <-> EP coupling completed (due to setting * the CIS ID in the QoS procedure). */ - bt_bap_iso_configure_data_path(ep, stream->codec_cfg); + if (ep->dir == BT_AUDIO_DIR_SINK) { + bt_audio_codec_cfg_to_iso_path(&ep->iso->rx.path, stream->codec_cfg); + } else { + bt_audio_codec_cfg_to_iso_path(&ep->iso->tx.path, stream->codec_cfg); + } ep->cig_id = cig_id; ep->cis_id = cis_id; diff --git a/subsys/bluetooth/audio/bap_broadcast_sink.c b/subsys/bluetooth/audio/bap_broadcast_sink.c index aa4bc08f761..4d2134455b8 100644 --- a/subsys/bluetooth/audio/bap_broadcast_sink.c +++ b/subsys/bluetooth/audio/bap_broadcast_sink.c @@ -764,7 +764,7 @@ static int bt_bap_broadcast_sink_setup_stream(struct bt_bap_broadcast_sink *sink bt_bap_iso_bind_ep(iso, ep); bt_audio_codec_qos_to_iso_qos(iso->chan.qos->rx, &sink->codec_qos); - bt_bap_iso_configure_data_path(ep, codec_cfg); + bt_audio_codec_cfg_to_iso_path(iso->chan.qos->rx->path, codec_cfg); bt_bap_iso_unref(iso); diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index 33fd1f0e17d..8978e2816cb 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -288,7 +288,7 @@ static int broadcast_source_setup_stream(uint8_t index, struct bt_bap_stream *st bt_bap_iso_bind_ep(iso, ep); bt_audio_codec_qos_to_iso_qos(iso->chan.qos->tx, qos); - bt_bap_iso_configure_data_path(ep, codec_cfg); + bt_audio_codec_cfg_to_iso_path(iso->chan.qos->tx->path, codec_cfg); #if defined(CONFIG_BT_ISO_TEST_PARAMS) iso->chan.qos->num_subevents = qos->num_subevents; #endif /* CONFIG_BT_ISO_TEST_PARAMS */ @@ -878,7 +878,7 @@ int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, iso_qos = stream->ep->iso->chan.qos->tx; bt_bap_stream_attach(NULL, stream, stream->ep, codec_cfg); - bt_bap_iso_configure_data_path(stream->ep, codec_cfg); + bt_audio_codec_cfg_to_iso_path(iso_qos->path, codec_cfg); } } diff --git a/subsys/bluetooth/audio/bap_iso.c b/subsys/bluetooth/audio/bap_iso.c index 3fa2059ea94..cb68a8032f5 100644 --- a/subsys/bluetooth/audio/bap_iso.c +++ b/subsys/bluetooth/audio/bap_iso.c @@ -129,12 +129,19 @@ void bt_bap_iso_init(struct bt_bap_iso *iso, struct bt_iso_chan_ops *ops) iso->chan.ops = ops; iso->chan.qos = &iso->qos; - /* Setup the QoS for both Tx and Rx + /* Setup points for both Tx and Rx * This is due to the limitation in the ISO API where pointers like - * the `qos->tx` shall be initialized before the CIS is created + * the `qos->tx` shall be initialized before the CIS is connected if + * ever want to use it for TX, and ditto for RX. They cannot be + * initialized after the CIS has been connected */ iso->chan.qos->rx = &iso->rx.qos; + iso->chan.qos->rx->path = &iso->rx.path; + iso->chan.qos->rx->path->cc = iso->rx.cc; + iso->chan.qos->tx = &iso->tx.qos; + iso->chan.qos->tx->path = &iso->tx.path; + iso->chan.qos->tx->path->cc = iso->tx.cc; } static struct bt_bap_iso_dir *bap_iso_get_iso_dir(bool unicast_client, struct bt_bap_iso *iso, @@ -157,43 +164,6 @@ static struct bt_bap_iso_dir *bap_iso_get_iso_dir(bool unicast_client, struct bt } } -void bt_bap_iso_configure_data_path(struct bt_bap_ep *ep, struct bt_audio_codec_cfg *codec_cfg) -{ - struct bt_bap_iso *bap_iso = ep->iso; - struct bt_iso_chan_qos *qos = bap_iso->chan.qos; - const bool is_unicast_client = - IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT) && bt_bap_ep_is_unicast_client(ep); - struct bt_bap_iso_dir *iso_dir = bap_iso_get_iso_dir(is_unicast_client, bap_iso, ep->dir); - struct bt_iso_chan_path *path = &iso_dir->path; - - /* Setup the data path objects */ - if (iso_dir == &bap_iso->rx) { - qos->rx->path = path; - } else { - qos->tx->path = path; - } - - /* Configure the data path to either use the controller for transcoding, or set the path to - * be transparant to indicate that the transcoding happens somewhere else - */ - path->pid = codec_cfg->path_id; - - if (codec_cfg->ctlr_transcode) { - path->format = codec_cfg->id; - path->cid = codec_cfg->cid; - path->vid = codec_cfg->vid; - path->delay = 0; - path->cc_len = codec_cfg->data_len; - path->cc = codec_cfg->data; - } else { - path->format = BT_HCI_CODING_FORMAT_TRANSPARENT; - path->cid = 0; - path->vid = 0; - path->delay = 0; - path->cc_len = 0; - path->cc = NULL; - } -} static bool is_unicast_client_ep(struct bt_bap_ep *ep) { return IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT) && bt_bap_ep_is_unicast_client(ep); diff --git a/subsys/bluetooth/audio/bap_iso.h b/subsys/bluetooth/audio/bap_iso.h index 4384182d697..d3b27f3823a 100644 --- a/subsys/bluetooth/audio/bap_iso.h +++ b/subsys/bluetooth/audio/bap_iso.h @@ -41,7 +41,6 @@ void bt_bap_iso_foreach(bt_bap_iso_func_t func, void *user_data); struct bt_bap_iso *bt_bap_iso_find(bt_bap_iso_func_t func, void *user_data); void bt_bap_iso_init(struct bt_bap_iso *iso, struct bt_iso_chan_ops *ops); void bt_bap_iso_bind_ep(struct bt_bap_iso *iso, struct bt_bap_ep *ep); -void bt_bap_iso_configure_data_path(struct bt_bap_ep *ep, struct bt_audio_codec_cfg *codec_cfg); void bt_bap_iso_unbind_ep(struct bt_bap_iso *iso, struct bt_bap_ep *ep); struct bt_bap_ep *bt_bap_iso_get_ep(bool unicast_client, struct bt_bap_iso *iso, enum bt_audio_dir dir); diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index d6df9524e14..6dae679ddef 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -31,6 +31,28 @@ LOG_MODULE_REGISTER(bt_bap_stream, CONFIG_BT_BAP_STREAM_LOG_LEVEL); +void bt_audio_codec_cfg_to_iso_path(struct bt_iso_chan_path *path, + struct bt_audio_codec_cfg *codec_cfg) +{ + path->pid = codec_cfg->path_id; + + if (codec_cfg->ctlr_transcode) { + path->format = codec_cfg->id; + path->cid = codec_cfg->cid; + path->vid = codec_cfg->vid; + path->delay = 0; + path->cc_len = codec_cfg->data_len; + path->cc = codec_cfg->data; + } else { + path->format = BT_HCI_CODING_FORMAT_TRANSPARENT; + path->cid = 0; + path->vid = 0; + path->delay = 0; + path->cc_len = 0; + path->cc = NULL; + } +} + #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, diff --git a/subsys/bluetooth/audio/bap_stream.h b/subsys/bluetooth/audio/bap_stream.h index d16cf2cfcc9..67e8c0470df 100644 --- a/subsys/bluetooth/audio/bap_stream.h +++ b/subsys/bluetooth/audio/bap_stream.h @@ -17,6 +17,8 @@ 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_cfg_to_iso_path(struct bt_iso_chan_path *path, + 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); diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index b6de9b61a66..933db93ec72 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -774,8 +774,17 @@ static void unicast_client_ep_qos_state(struct bt_bap_ep *ep, struct net_buf_sim * we have the ISO <-> EP coupling completed (due to setting * the CIS ID in the QoS procedure). */ - - bt_bap_iso_configure_data_path(ep, stream->codec_cfg); + if (ep->dir == BT_AUDIO_DIR_SOURCE) { + /* If the endpoint is a source, then we need to + * configure our RX parameters + */ + bt_audio_codec_cfg_to_iso_path(&ep->iso->rx.path, stream->codec_cfg); + } else { + /* If the endpoint is a sink, then we need to + * configure our TX parameters + */ + bt_audio_codec_cfg_to_iso_path(&ep->iso->tx.path, stream->codec_cfg); + } } /* Notify upper layer */ From e64fe90a8bfaf25f412134e6881f14e878102633 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:49 +0100 Subject: [PATCH 1172/2300] Revert "[nrf fromtree] Bluetooth: BAP: Add support for transparent coding format" This reverts commit 60eeedf060525bfa5a18816f61f762caa3d5fcae. Signed-off-by: Robert Lubos --- include/zephyr/bluetooth/audio/audio.h | 14 -------------- subsys/bluetooth/audio/bap_stream.c | 22 ++++++---------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/include/zephyr/bluetooth/audio/audio.h b/include/zephyr/bluetooth/audio/audio.h index 03f451a3c8b..17bac991f18 100644 --- a/include/zephyr/bluetooth/audio/audio.h +++ b/include/zephyr/bluetooth/audio/audio.h @@ -209,7 +209,6 @@ enum bt_audio_metadata_type { ((struct bt_audio_codec_cfg){ \ /* Use HCI data path as default, can be overwritten by application */ \ .path_id = BT_ISO_DATA_PATH_HCI, \ - .ctlr_transcode = false, \ .id = _id, \ .cid = _cid, \ .vid = _vid, \ @@ -232,7 +231,6 @@ enum bt_audio_metadata_type { ((struct bt_audio_codec_cap){ \ /* Use HCI data path as default, can be overwritten by application */ \ .path_id = BT_ISO_DATA_PATH_HCI, \ - .ctlr_transcode = false, \ .id = (_id), \ .cid = (_cid), \ .vid = (_vid), \ @@ -318,12 +316,6 @@ struct bt_audio_codec_cap { * vendor specific ID. */ uint8_t path_id; - /** Whether or not the local controller should transcode - * - * This effectively sets the coding format for the ISO data path to @ref - * BT_HCI_CODING_FORMAT_TRANSPARENT if false, else uses the @ref bt_audio_codec_cfg.id. - */ - bool ctlr_transcode; /** Codec ID */ uint8_t id; /** Codec Company ID */ @@ -352,12 +344,6 @@ struct bt_audio_codec_cfg { * vendor specific ID. */ uint8_t path_id; - /** Whether or not the local controller should transcode - * - * This effectively sets the coding format for the ISO data path to @ref - * BT_HCI_CODING_FORMAT_TRANSPARENT if false, else uses the @ref bt_audio_codec_cfg.id. - */ - bool ctlr_transcode; /** Codec ID */ uint8_t id; /** Codec Company ID */ diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index 6dae679ddef..23e5bb8564b 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -35,22 +35,12 @@ void bt_audio_codec_cfg_to_iso_path(struct bt_iso_chan_path *path, struct bt_audio_codec_cfg *codec_cfg) { path->pid = codec_cfg->path_id; - - if (codec_cfg->ctlr_transcode) { - path->format = codec_cfg->id; - path->cid = codec_cfg->cid; - path->vid = codec_cfg->vid; - path->delay = 0; - path->cc_len = codec_cfg->data_len; - path->cc = codec_cfg->data; - } else { - path->format = BT_HCI_CODING_FORMAT_TRANSPARENT; - path->cid = 0; - path->vid = 0; - path->delay = 0; - path->cc_len = 0; - path->cc = NULL; - } + path->format = codec_cfg->id; + path->cid = codec_cfg->cid; + path->vid = codec_cfg->vid; + path->delay = 0; /* TODO: Add to bt_audio_codec_cfg? Use presentation delay? */ + path->cc_len = codec_cfg->data_len; + path->cc = codec_cfg->data; } #if defined(CONFIG_BT_BAP_UNICAST_CLIENT) || defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || \ From 4f9db168d6d81380c41d4c680fab31e9bcbd12b5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:49 +0100 Subject: [PATCH 1173/2300] Revert "[nrf fromtree] net: openthread: Fix key import in case of ECDSA." This reverts commit 4f28fcb0b54b504e076b9ef715f5cdf232f5d411. Signed-off-by: Robert Lubos --- modules/openthread/platform/crypto_psa.c | 114 ++++++++++++----------- 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/modules/openthread/platform/crypto_psa.c b/modules/openthread/platform/crypto_psa.c index c818c5695a3..55018254154 100644 --- a/modules/openthread/platform/crypto_psa.c +++ b/modules/openthread/platform/crypto_psa.c @@ -16,7 +16,6 @@ #if defined(CONFIG_OPENTHREAD_ECDSA) #include -#include #endif static otError psaToOtError(psa_status_t aStatus) @@ -63,7 +62,7 @@ static psa_algorithm_t toPsaAlgorithm(otCryptoKeyAlgorithm aAlgorithm) * There is currently no constant like PSA_ALG_NONE, but 0 is used * to indicate an unknown algorithm. */ - return (psa_algorithm_t)0; + return (psa_algorithm_t) 0; } } @@ -97,9 +96,11 @@ static psa_key_usage_t toPsaKeyUsage(int aUsage) static bool checkKeyUsage(int aUsage) { /* Check if only supported flags have been passed */ - int supported_flags = OT_CRYPTO_KEY_USAGE_EXPORT | OT_CRYPTO_KEY_USAGE_ENCRYPT | - OT_CRYPTO_KEY_USAGE_DECRYPT | OT_CRYPTO_KEY_USAGE_SIGN_HASH | - OT_CRYPTO_KEY_USAGE_VERIFY_HASH; + int supported_flags = OT_CRYPTO_KEY_USAGE_EXPORT | + OT_CRYPTO_KEY_USAGE_ENCRYPT | + OT_CRYPTO_KEY_USAGE_DECRYPT | + OT_CRYPTO_KEY_USAGE_SIGN_HASH | + OT_CRYPTO_KEY_USAGE_VERIFY_HASH; return (aUsage & ~supported_flags) == 0; } @@ -120,57 +121,26 @@ void otPlatCryptoInit(void) * PSA with emulated TFM, Settings have to be initialized at the end of otPlatCryptoInit(), * to be available before storing Network Key. */ - __ASSERT_EVAL((void)settings_subsys_init(), int err = settings_subsys_init(), !err, - "Failed to initialize settings"); + __ASSERT_EVAL((void) settings_subsys_init(), int err = settings_subsys_init(), + !err, "Failed to initialize settings"); #endif } -otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, - otCryptoKeyAlgorithm aKeyAlgorithm, int aKeyUsage, - otCryptoKeyStorage aKeyPersistence, const uint8_t *aKey, +otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, + otCryptoKeyType aKeyType, + otCryptoKeyAlgorithm aKeyAlgorithm, + int aKeyUsage, + otCryptoKeyStorage aKeyPersistence, + const uint8_t *aKey, size_t aKeyLen) { -#if defined(CONFIG_OPENTHREAD_ECDSA) - int version; - size_t len; - unsigned char *p = (unsigned char *)aKey; - unsigned char *end; -#endif - psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; - psa_status_t status = 0; + psa_status_t status; if (aKeyRef == NULL || aKey == NULL || !checkKeyUsage(aKeyUsage)) { return OT_ERROR_INVALID_ARGS; } -#if defined(CONFIG_OPENTHREAD_ECDSA) - /* Check if key is ECDSA pair and extract private key from it since PSA expects it. */ - if (aKeyType == OT_CRYPTO_KEY_TYPE_ECDSA) { - - end = p + aKeyLen; - status = mbedtls_asn1_get_tag(&p, end, &len, - MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); - if (status != 0) { - return OT_ERROR_FAILED; - } - - end = p + len; - status = mbedtls_asn1_get_int(&p, end, &version); - if (status != 0) { - return OT_ERROR_FAILED; - } - - status = mbedtls_asn1_get_tag(&p, end, &len, MBEDTLS_ASN1_OCTET_STRING); - if (status != 0 || len != 32) { - return OT_ERROR_FAILED; - } - - aKey = p; - aKeyLen = len; - } -#endif - psa_set_key_type(&attributes, toPsaKeyType(aKeyType)); psa_set_key_algorithm(&attributes, toPsaAlgorithm(aKeyAlgorithm)); psa_set_key_usage_flags(&attributes, toPsaKeyUsage(aKeyUsage)); @@ -191,7 +161,9 @@ otError otPlatCryptoImportKey(otCryptoKeyRef *aKeyRef, otCryptoKeyType aKeyType, return psaToOtError(status); } -otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, uint8_t *aBuffer, size_t aBufferLen, +otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, + uint8_t *aBuffer, + size_t aBufferLen, size_t *aKeyLen) { if (aBuffer == NULL) { @@ -259,7 +231,8 @@ otError otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey return psaToOtError(status); } -otError otPlatCryptoHmacSha256Update(otCryptoContext *aContext, const void *aBuf, +otError otPlatCryptoHmacSha256Update(otCryptoContext *aContext, + const void *aBuf, uint16_t aBufLength) { psa_mac_operation_t *operation; @@ -270,7 +243,7 @@ otError otPlatCryptoHmacSha256Update(otCryptoContext *aContext, const void *aBuf operation = aContext->mContext; - return psaToOtError(psa_mac_update(operation, (const uint8_t *)aBuf, aBufLength)); + return psaToOtError(psa_mac_update(operation, (const uint8_t *) aBuf, aBufLength)); } otError otPlatCryptoHmacSha256Finish(otCryptoContext *aContext, uint8_t *aBuf, size_t aBufLength) @@ -296,7 +269,7 @@ otError otPlatCryptoAesInit(otCryptoContext *aContext) } key_ref = aContext->mContext; - *key_ref = (psa_key_id_t)0; /* In TF-M 1.5.0 this can be replaced with PSA_KEY_ID_NULL */ + *key_ref = (psa_key_id_t) 0; /* In TF-M 1.5.0 this can be replaced with PSA_KEY_ID_NULL */ return OT_ERROR_NONE; } @@ -327,8 +300,13 @@ otError otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, } key_ref = aContext->mContext; - status = psa_cipher_encrypt(*key_ref, PSA_ALG_ECB_NO_PADDING, aInput, block_size, aOutput, - block_size, &cipher_length); + status = psa_cipher_encrypt(*key_ref, + PSA_ALG_ECB_NO_PADDING, + aInput, + block_size, + aOutput, + block_size, + &cipher_length); return psaToOtError(status); } @@ -388,7 +366,7 @@ otError otPlatCryptoSha256Update(otCryptoContext *aContext, const void *aBuf, ui operation = aContext->mContext; - return psaToOtError(psa_hash_update(operation, (const uint8_t *)aBuf, aBufLength)); + return psaToOtError(psa_hash_update(operation, (const uint8_t *) aBuf, aBufLength)); } otError otPlatCryptoSha256Finish(otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize) @@ -452,6 +430,38 @@ otError otPlatCryptoEcdsaGenerateKey(otPlatCryptoEcdsaKeyPair *aKeyPair) return psaToOtError(status); } +otError otPlatCryptoEcdsaGetPublicKey(const otPlatCryptoEcdsaKeyPair *aKeyPair, + otPlatCryptoEcdsaPublicKey *aPublicKey) +{ + psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; + psa_key_id_t key_id = 0; + psa_status_t status; + size_t exported_length; + uint8_t buffer[1 + OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE]; + + psa_set_key_algorithm(&attributes, PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256)); + psa_set_key_type(&attributes, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)); + psa_set_key_bits(&attributes, 256); + + status = psa_import_key(&attributes, aKeyPair->mDerBytes, aKeyPair->mDerLength, &key_id); + if (status != PSA_SUCCESS) { + goto out; + } + + status = psa_export_public_key(key_id, buffer, sizeof(buffer), &exported_length); + if (status != PSA_SUCCESS) { + goto out; + } + __ASSERT_NO_MSG(exported_length == sizeof(buffer)); + memcpy(aPublicKey->m8, buffer + 1, OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE); + +out: + psa_reset_key_attributes(&attributes); + psa_destroy_key(key_id); + + return psaToOtError(status); +} + otError otPlatCryptoEcdsaSign(const otPlatCryptoEcdsaKeyPair *aKeyPair, const otPlatCryptoSha256Hash *aHash, otPlatCryptoEcdsaSignature *aSignature) From 2b4c363725c7b39c9a3ea24e98c83a9194d1fce3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:49 +0100 Subject: [PATCH 1174/2300] Revert "[nrf fromtree] net: openthread: Regular openthread upmerge to `00076af`" This reverts commit 60f94c3dad65ef9a568233553e795eb76f1e9e25. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 5b660892783..6249674c9c1 100644 --- a/west.yml +++ b/west.yml @@ -301,7 +301,7 @@ manifest: revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 path: modules/lib/open-amp - name: openthread - revision: 00076aff3ae571db7c90509ec9dc293457098c35 + revision: 4ed44bc7d58d9a98c6cca13a50d38129045ab3df path: modules/lib/openthread - name: percepio path: modules/debug/percepio From ba169d4f406f6ba4174e74421319eb3f42ef02e0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:49 +0100 Subject: [PATCH 1175/2300] Revert "[nrf fromtree] net: mgmt: Print correct TWT teardown status message" This reverts commit 9503b994dd3822e823be3f1ad3771bf56b696e47. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 70b4f96d861..44f507f6e02 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -294,7 +294,7 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) if (resp->operation == WIFI_TWT_TEARDOWN) { if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { - print(context.sh, SHELL_NORMAL, "TWT teardown succeeded for flow ID %d\n", + print(context.sh, SHELL_NORMAL, "TWT teardown received for flow ID %d\n", resp->flow_id); } else { print(context.sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", From cdf22df1c512c676f3880f995a74b4a7408b6d28 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:50 +0100 Subject: [PATCH 1176/2300] Revert "[nrf fromtree] net: mgmt: Update app of TWT teardown status" This reverts commit 390cdf37088f4081263ec3512f86841c233a2546. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi.h | 8 -------- include/zephyr/net/wifi_mgmt.h | 2 -- subsys/net/l2/wifi/wifi_shell.c | 9 ++------- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index c49d6ad0f66..5c7d5b493fa 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -345,14 +345,6 @@ enum wifi_twt_fail_reason { WIFI_TWT_FAIL_FLOW_ALREADY_EXISTS, }; -/** Wi-Fi Target Wake Time (TWT) teradown status. */ -enum wifi_twt_teardown_status { - /** TWT teardown success */ - WIFI_TWT_TEARDOWN_SUCCESS = 0, - /** TWT teardown failure */ - WIFI_TWT_TEARDOWN_FAILED, -}; - /** @cond INTERNAL_HIDDEN */ static const char * const wifi_twt_err_code_tbl[] = { [WIFI_TWT_FAIL_UNSPECIFIED] = "Unspecified", diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 0c64cab3c01..f6ae631a830 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -470,8 +470,6 @@ struct wifi_twt_params { enum wifi_twt_setup_cmd setup_cmd; /** TWT setup response status, see enum wifi_twt_setup_resp_status */ enum wifi_twt_setup_resp_status resp_status; - /** TWT teardown cmd status, see enum wifi_twt_teardown_status */ - enum wifi_twt_teardown_status teardown_status; /** Dialog token, used to map requests to responses */ uint8_t dialog_token; /** Flow ID, used to map setup with teardown */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 44f507f6e02..1f13ae864ae 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -293,13 +293,8 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) (const struct wifi_twt_params *)cb->info; if (resp->operation == WIFI_TWT_TEARDOWN) { - if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { - print(context.sh, SHELL_NORMAL, "TWT teardown received for flow ID %d\n", - resp->flow_id); - } else { - print(context.sh, SHELL_NORMAL, "TWT teardown failed for flow ID %d\n", - resp->flow_id); - } + print(context.sh, SHELL_NORMAL, "TWT teardown received for flow ID %d\n", + resp->flow_id); return; } From 9e61708f41970e5f3acf93e1d8fb3c95a0e37fb1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:50 +0100 Subject: [PATCH 1177/2300] Revert "[nrf fromtree] tests: bsim: bluetooth: host: gatt: add authorization callback API test" This reverts commit 3f97d3e782d5ff3e42aa9d8d8fe043eb8ba1e8d2. Signed-off-by: Robert Lubos --- tests/bsim/bluetooth/host/compile.sh | 1 - .../host/gatt/authorization/CMakeLists.txt | 14 - .../host/gatt/authorization/prj.conf | 7 - .../host/gatt/authorization/src/common.c | 20 - .../host/gatt/authorization/src/common.h | 73 ---- .../gatt/authorization/src/gatt_client_test.c | 341 ---------------- .../gatt/authorization/src/gatt_server_test.c | 370 ------------------ .../host/gatt/authorization/src/main.c | 22 -- .../gatt/authorization/test_scripts/gatt.sh | 22 -- 9 files changed, 870 deletions(-) delete mode 100644 tests/bsim/bluetooth/host/gatt/authorization/CMakeLists.txt delete mode 100644 tests/bsim/bluetooth/host/gatt/authorization/prj.conf delete mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/common.c delete mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/common.h delete mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/gatt_client_test.c delete mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c delete mode 100644 tests/bsim/bluetooth/host/gatt/authorization/src/main.c delete mode 100755 tests/bsim/bluetooth/host/gatt/authorization/test_scripts/gatt.sh diff --git a/tests/bsim/bluetooth/host/compile.sh b/tests/bsim/bluetooth/host/compile.sh index 098c983d75f..ff42fd27adf 100755 --- a/tests/bsim/bluetooth/host/compile.sh +++ b/tests/bsim/bluetooth/host/compile.sh @@ -41,7 +41,6 @@ app=tests/bsim/bluetooth/host/att/sequential/dut compile app=tests/bsim/bluetooth/host/att/sequential/tester compile app=tests/bsim/bluetooth/host/att/long_read compile -app=tests/bsim/bluetooth/host/gatt/authorization compile app=tests/bsim/bluetooth/host/gatt/caching compile app=tests/bsim/bluetooth/host/gatt/general compile app=tests/bsim/bluetooth/host/gatt/notify compile diff --git a/tests/bsim/bluetooth/host/gatt/authorization/CMakeLists.txt b/tests/bsim/bluetooth/host/gatt/authorization/CMakeLists.txt deleted file mode 100644 index acb0dd45947..00000000000 --- a/tests/bsim/bluetooth/host/gatt/authorization/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(bsim_test_gatt_authorization) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources} ) - -zephyr_include_directories( - ${BSIM_COMPONENTS_PATH}/libUtilv1/src/ - ${BSIM_COMPONENTS_PATH}/libPhyComv1/src/ - ) diff --git a/tests/bsim/bluetooth/host/gatt/authorization/prj.conf b/tests/bsim/bluetooth/host/gatt/authorization/prj.conf deleted file mode 100644 index 9cba554afef..00000000000 --- a/tests/bsim/bluetooth/host/gatt/authorization/prj.conf +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG_BT=y -CONFIG_BT_DEVICE_NAME="GATT tester" -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=y -CONFIG_BT_GATT_CLIENT=y -CONFIG_BT_GATT_AUTHORIZATION_CUSTOM=y -CONFIG_BT_ATT_PREPARE_COUNT=3 diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/common.c b/tests/bsim/bluetooth/host/gatt/authorization/src/common.c deleted file mode 100644 index adff2dd05ef..00000000000 --- a/tests/bsim/bluetooth/host/gatt/authorization/src/common.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "common.h" - -void test_tick(bs_time_t HW_device_time) -{ - if (bst_result != Passed) { - FAIL("test failed (not passed after %i seconds)\n", WAIT_TIME); - } -} - -void test_init(void) -{ - bst_ticker_set_next_tick_absolute(WAIT_TIME); - bst_result = In_progress; -} diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/common.h b/tests/bsim/bluetooth/host/gatt/authorization/src/common.h deleted file mode 100644 index 339919dfe88..00000000000 --- a/tests/bsim/bluetooth/host/gatt/authorization/src/common.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Common functions and helpers for BSIM GATT tests - * - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#include "bs_types.h" -#include "bs_tracing.h" -#include "time_machine.h" -#include "bstests.h" - -#include -#include -#include - -#include -#include -#include -#include -#include - -extern enum bst_result_t bst_result; - -#define WAIT_TIME (30 * 1e6) /*seconds*/ - -#define CREATE_FLAG(flag) static atomic_t flag = (atomic_t)false -#define SET_FLAG(flag) (void)atomic_set(&flag, (atomic_t)true) -#define UNSET_FLAG(flag) (void)atomic_set(&flag, (atomic_t)false) -#define WAIT_FOR_FLAG(flag) \ - while (!(bool)atomic_get(&flag)) { \ - (void)k_sleep(K_MSEC(1)); \ - } - -#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) - -#define CHRC_SIZE 10 - -#define TEST_SERVICE_UUID \ - BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00) - -#define TEST_UNHANDLED_CHRC_UUID \ - BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFD, 0x00) - -#define TEST_UNAUTHORIZED_CHRC_UUID \ - BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFE, 0x00) - -#define TEST_AUTHORIZED_CHRC_UUID \ - BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0x00) - -#define TEST_CP_CHRC_UUID \ - BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, \ - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xF0, 0x00) - -void test_tick(bs_time_t HW_device_time); -void test_init(void); diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_client_test.c b/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_client_test.c deleted file mode 100644 index 9c60c5b57b2..00000000000 --- a/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_client_test.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#include "common.h" - -CREATE_FLAG(flag_is_connected); -CREATE_FLAG(flag_discover_complete); -CREATE_FLAG(flag_write_complete); -CREATE_FLAG(flag_read_complete); - -static struct bt_conn *g_conn; -static uint16_t unhandled_chrc_handle; -static uint16_t unauthorized_chrc_handle; -static uint16_t authorized_chrc_handle; -static uint16_t cp_chrc_handle; -static const struct bt_uuid *test_svc_uuid = TEST_SERVICE_UUID; - -#define ARRAY_ITEM(i, _) i -static uint8_t chrc_data[] = { LISTIFY(CHRC_SIZE, ARRAY_ITEM, (,)) }; /* 1, 2, 3 ... */ - -static void connected(struct bt_conn *conn, uint8_t err) -{ - char addr[BT_ADDR_LE_STR_LEN]; - - bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - - if (err != 0) { - FAIL("Failed to connect to %s (%u)\n", addr, err); - return; - } - - printk("Connected to %s\n", addr); - - __ASSERT_NO_MSG(g_conn == conn); - - SET_FLAG(flag_is_connected); -} - -static void disconnected(struct bt_conn *conn, uint8_t reason) -{ - char addr[BT_ADDR_LE_STR_LEN]; - - if (conn != g_conn) { - return; - } - - bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - - printk("Disconnected: %s (reason 0x%02x)\n", addr, reason); - - bt_conn_unref(g_conn); - - g_conn = NULL; - UNSET_FLAG(flag_is_connected); -} - -BT_CONN_CB_DEFINE(conn_callbacks) = { - .connected = connected, - .disconnected = disconnected, -}; - -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]; - int err; - - if (g_conn != NULL) { - return; - } - - /* We're only interested in connectable events */ - if (type != BT_HCI_ADV_IND && type != BT_HCI_ADV_DIRECT_IND) { - return; - } - - bt_addr_le_to_str(addr, addr_str, sizeof(addr_str)); - printk("Device found: %s (RSSI %d)\n", addr_str, rssi); - - printk("Stopping scan\n"); - err = bt_le_scan_stop(); - if (err != 0) { - FAIL("Could not stop scan: %d"); - return; - } - - err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, - BT_LE_CONN_PARAM_DEFAULT, &g_conn); - if (err != 0) { - FAIL("Could not connect to peer: %d", err); - } -} - -static uint8_t discover_func(struct bt_conn *conn, - const struct bt_gatt_attr *attr, - struct bt_gatt_discover_params *params) -{ - int err; - - if (attr == NULL) { - if (unhandled_chrc_handle == 0 || - unauthorized_chrc_handle == 0 || - authorized_chrc_handle == 0) { - FAIL("Did not discover required characterstics"); - } - - (void)memset(params, 0, sizeof(*params)); - - SET_FLAG(flag_discover_complete); - - return BT_GATT_ITER_STOP; - } - - printk("[ATTRIBUTE] handle %u\n", attr->handle); - - if (params->type == BT_GATT_DISCOVER_PRIMARY && - bt_uuid_cmp(params->uuid, TEST_SERVICE_UUID) == 0) { - printk("Found test service\n"); - params->uuid = NULL; - params->start_handle = attr->handle + 1; - params->type = BT_GATT_DISCOVER_CHARACTERISTIC; - - err = bt_gatt_discover(conn, params); - if (err != 0) { - FAIL("Discover failed (err %d)\n", err); - } - - return BT_GATT_ITER_STOP; - } else if (params->type == BT_GATT_DISCOVER_CHARACTERISTIC) { - struct bt_gatt_chrc *chrc = (struct bt_gatt_chrc *)attr->user_data; - - if (bt_uuid_cmp(chrc->uuid, TEST_UNHANDLED_CHRC_UUID) == 0) { - printk("Found unhandled chrc\n"); - unhandled_chrc_handle = chrc->value_handle; - } else if (bt_uuid_cmp(chrc->uuid, TEST_UNAUTHORIZED_CHRC_UUID) == 0) { - printk("Found unauthorized\n"); - unauthorized_chrc_handle = chrc->value_handle; - } else if (bt_uuid_cmp(chrc->uuid, TEST_AUTHORIZED_CHRC_UUID) == 0) { - printk("Found authorized chrc\n"); - authorized_chrc_handle = chrc->value_handle; - } else if (bt_uuid_cmp(chrc->uuid, TEST_CP_CHRC_UUID) == 0) { - printk("Found CP chrc\n"); - cp_chrc_handle = chrc->value_handle; - } - } - - return BT_GATT_ITER_CONTINUE; -} - -static void gatt_discover(void) -{ - static struct bt_gatt_discover_params discover_params; - int err; - - printk("Discovering services and characteristics\n"); - - discover_params.uuid = test_svc_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_PRIMARY; - - err = bt_gatt_discover(g_conn, &discover_params); - if (err != 0) { - FAIL("Discover failed(err %d)\n", err); - } - - WAIT_FOR_FLAG(flag_discover_complete); - printk("Discover complete\n"); -} - -static void gatt_write_cb(struct bt_conn *conn, uint8_t err, - struct bt_gatt_write_params *params) -{ - if ((err != BT_ATT_ERR_SUCCESS) && (params->handle != unauthorized_chrc_handle)) { - FAIL("Write failed on authorized characteristics: 0x%02X\n", err); - } - - if ((err != BT_ATT_ERR_AUTHORIZATION) && (params->handle == unauthorized_chrc_handle)) { - FAIL("Write failed on unauthorized characteristics: 0x%02X\n", err); - } - - (void)memset(params, 0, sizeof(*params)); - - SET_FLAG(flag_write_complete); -} - -static void gatt_write(uint16_t handle) -{ - static struct bt_gatt_write_params write_params; - int err; - - printk("Writing to chrc\n"); - - write_params.data = chrc_data; - write_params.length = sizeof(chrc_data); - write_params.func = gatt_write_cb; - write_params.handle = handle; - - UNSET_FLAG(flag_write_complete); - - err = bt_gatt_write(g_conn, &write_params); - if (err != 0) { - FAIL("bt_gatt_write failed: %d\n", err); - } - - WAIT_FOR_FLAG(flag_write_complete); - printk("success\n"); -} - -static void gatt_cp_write(void) -{ - static struct bt_gatt_write_params write_params; - int err; - uint8_t cp_write_data[] = {0x00}; - - printk("Writing to CP chrc\n"); - - write_params.data = cp_write_data; - write_params.length = sizeof(cp_write_data); - write_params.func = gatt_write_cb; - write_params.handle = cp_chrc_handle; - - UNSET_FLAG(flag_write_complete); - - err = bt_gatt_write(g_conn, &write_params); - if (err != 0) { - FAIL("bt_gatt_write failed: %d\n", err); - } - - WAIT_FOR_FLAG(flag_write_complete); - printk("success\n"); -} - -static uint8_t gatt_read_cb(struct bt_conn *conn, uint8_t err, - struct bt_gatt_read_params *params, - const void *data, uint16_t length) -{ - if ((err != BT_ATT_ERR_SUCCESS) && - (params->single.handle != unauthorized_chrc_handle)) { - FAIL("Read failed on authorized characteristics: 0x%02X\n", err); - - if ((length != CHRC_SIZE) || (memcmp(data, chrc_data, length) != 0)) { - FAIL("chrc data different than expected", err); - } - } - - if ((err != BT_ATT_ERR_AUTHORIZATION) && - (params->single.handle == unauthorized_chrc_handle)) { - FAIL("Read failed on unauthorized characteristics: 0x%02X\n", err); - } - - (void)memset(params, 0, sizeof(*params)); - - SET_FLAG(flag_read_complete); - - return 0; -} - -static void gatt_read(uint16_t handle) -{ - static struct bt_gatt_read_params read_params; - int err; - - printk("Reading chrc\n"); - - read_params.func = gatt_read_cb; - read_params.handle_count = 1; - read_params.single.handle = handle; - read_params.single.offset = 0; - - UNSET_FLAG(flag_read_complete); - - err = bt_gatt_read(g_conn, &read_params); - if (err != 0) { - FAIL("bt_gatt_read failed: %d\n", err); - } - - WAIT_FOR_FLAG(flag_read_complete); - printk("success\n"); -} - -static void gatt_interact(uint16_t handle) -{ - gatt_write(handle); - gatt_read(handle); - gatt_cp_write(); -} - -static void test_main(void) -{ - int err; - - err = bt_enable(NULL); - if (err != 0) { - FAIL("Bluetooth discover failed (err %d)\n", err); - } - - err = bt_le_scan_start(BT_LE_SCAN_PASSIVE, device_found); - if (err != 0) { - FAIL("Scanning failed to start (err %d)\n", err); - } - - printk("Scanning successfully started\n"); - - WAIT_FOR_FLAG(flag_is_connected); - - gatt_discover(); - - printk("Interacting with the unhandled characteristic\n"); - gatt_interact(unhandled_chrc_handle); - - printk("Interacting with the unauthorized characteristic\n"); - gatt_interact(unauthorized_chrc_handle); - - printk("Interacting with the authorized characteristic\n"); - gatt_interact(authorized_chrc_handle); - - PASS("GATT client Passed\n"); -} - -static const struct bst_test_instance test_vcs[] = { - { - .test_id = "gatt_client", - .test_post_init_f = test_init, - .test_tick_f = test_tick, - .test_main_f = test_main - }, - BSTEST_END_MARKER -}; - -struct bst_test_list *test_gatt_client_install(struct bst_test_list *tests) -{ - return bst_add_tests(tests, test_vcs); -} 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 deleted file mode 100644 index d5dd5e0e0a7..00000000000 --- a/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "common.h" - -extern enum bst_result_t bst_result; - -CREATE_FLAG(flag_is_chrc_ctx_validated); - -static struct bt_conn *g_conn; - -static void connected(struct bt_conn *conn, uint8_t err) -{ - char addr[BT_ADDR_LE_STR_LEN]; - - bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - - if (err != 0) { - FAIL("Failed to connect to %s (%u)\n", addr, err); - return; - } - - printk("Connected to %s\n", addr); - - g_conn = bt_conn_ref(conn); -} - -static void disconnected(struct bt_conn *conn, uint8_t reason) -{ - char addr[BT_ADDR_LE_STR_LEN]; - - if (conn != g_conn) { - return; - } - - bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - - printk("Disconnected: %s (reason 0x%02x)\n", addr, reason); - - bt_conn_unref(g_conn); - - g_conn = NULL; -} - -BT_CONN_CB_DEFINE(conn_callbacks) = { - .connected = connected, - .disconnected = disconnected, -}; - -struct test_chrc_ctx { - uint16_t auth_read_cnt; - uint16_t read_cnt; - uint16_t auth_write_cnt; - uint16_t write_cnt; - uint8_t data[CHRC_SIZE]; -}; - -static ssize_t read_test_chrc(struct test_chrc_ctx *chrc_ctx, - struct bt_conn *conn, - const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset) -{ - chrc_ctx->read_cnt++; - - return bt_gatt_attr_read(conn, attr, buf, len, offset, - (void *)chrc_ctx->data, - sizeof(chrc_ctx->data)); -} - -static ssize_t write_test_chrc(struct test_chrc_ctx *chrc_ctx, - const void *buf, uint16_t len, - uint16_t offset, uint8_t flags) -{ - chrc_ctx->write_cnt++; - - if (len != sizeof(chrc_ctx->data)) { - printk("Invalid chrc length\n"); - return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); - } - - if (offset != 0) { - printk("Invalid chrc offset and length\n"); - return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); - } - - if (flags != 0) { - FAIL("Invalid flags %u\n", flags); - return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); - } - - (void)memcpy(chrc_ctx->data, buf, len); - - return len; -} - -static struct test_chrc_ctx unhandled_chrc_ctx; - -static ssize_t read_test_unhandled_chrc(struct bt_conn *conn, - const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset) -{ - return read_test_chrc(&unhandled_chrc_ctx, conn, attr, buf, len, offset); -} - -static ssize_t write_test_unhandled_chrc(struct bt_conn *conn, - const struct bt_gatt_attr *attr, - const void *buf, uint16_t len, - uint16_t offset, uint8_t flags) -{ - printk("unhandled chrc len %u offset %u\n", len, offset); - - return write_test_chrc(&unhandled_chrc_ctx, buf, len, offset, flags); -} - -static struct test_chrc_ctx unauthorized_chrc_ctx; - -static ssize_t read_test_unauthorized_chrc(struct bt_conn *conn, - const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset) -{ - return read_test_chrc(&unauthorized_chrc_ctx, conn, attr, buf, len, offset); -} - -static ssize_t write_test_unauthorized_chrc(struct bt_conn *conn, - const struct bt_gatt_attr *attr, - const void *buf, uint16_t len, - uint16_t offset, uint8_t flags) -{ - printk("unauthorized chrc len %u offset %u\n", len, offset); - - return write_test_chrc(&unauthorized_chrc_ctx, buf, len, offset, flags); -} - -static struct test_chrc_ctx authorized_chrc_ctx; - -static ssize_t read_test_authorized_chrc(struct bt_conn *conn, - const struct bt_gatt_attr *attr, - void *buf, uint16_t len, uint16_t offset) -{ - return read_test_chrc(&authorized_chrc_ctx, conn, attr, buf, len, offset); -} - -static ssize_t write_test_authorized_chrc(struct bt_conn *conn, - const struct bt_gatt_attr *attr, - const void *buf, uint16_t len, - uint16_t offset, uint8_t flags) -{ - printk("authorized chrc len %u offset %u\n", len, offset); - - return write_test_chrc(&authorized_chrc_ctx, buf, len, offset, flags); -} - -static const struct test_chrc_ctx zeroed_chrc_ctx; - -static bool unhandled_chrc_operation_validate(void) -{ - if (memcmp(&unauthorized_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { - return false; - } - - if (memcmp(&authorized_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { - return false; - } - - if ((unhandled_chrc_ctx.read_cnt != 1) && (unhandled_chrc_ctx.write_cnt != 1)) { - return false; - } - - if ((unhandled_chrc_ctx.auth_read_cnt != 0) && - (unhandled_chrc_ctx.auth_write_cnt != 0)) { - return false; - } - - return true; -} - -static bool unauthorized_chrc_operation_validate(void) -{ - if (memcmp(&unhandled_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { - return false; - } - - if (memcmp(&authorized_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { - return false; - } - - if ((unauthorized_chrc_ctx.read_cnt != 0) && (unauthorized_chrc_ctx.write_cnt != 0)) { - return false; - } - - if ((unauthorized_chrc_ctx.auth_read_cnt != 1) && - (unauthorized_chrc_ctx.auth_write_cnt != 1)) { - return false; - } - - return true; -} - -static bool authorized_chrc_operation_validate(void) -{ - if (memcmp(&unhandled_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { - return false; - } - - if (memcmp(&unauthorized_chrc_ctx, &zeroed_chrc_ctx, sizeof(zeroed_chrc_ctx)) != 0) { - return false; - } - - if ((authorized_chrc_ctx.read_cnt != 1) && (authorized_chrc_ctx.write_cnt != 1)) { - return false; - } - - if ((authorized_chrc_ctx.auth_read_cnt != 1) && - (authorized_chrc_ctx.auth_write_cnt != 1)) { - return false; - } - - return true; -} - -static ssize_t write_cp_chrc(struct bt_conn *conn, - const struct bt_gatt_attr *attr, - const void *buf, uint16_t len, - uint16_t offset, uint8_t flags) -{ - static uint16_t cp_write_cnt; - bool pass; - char *log_str; - - if (cp_write_cnt == 0) { - pass = unhandled_chrc_operation_validate(); - log_str = "unhandled"; - } else if (cp_write_cnt == 1) { - pass = unauthorized_chrc_operation_validate(); - log_str = "unauthorized"; - } else if (cp_write_cnt == 2) { - pass = authorized_chrc_operation_validate(); - log_str = "authorized"; - } else { - FAIL("Invalid value of CP write counter %u\n", cp_write_cnt); - return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); - } - - if (pass) { - printk("Correct context for %s chrc\n", log_str); - } else { - FAIL("Invalid context for %s chrc\n", log_str); - return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); - } - - memset(&unhandled_chrc_ctx, 0, sizeof(unhandled_chrc_ctx)); - memset(&unauthorized_chrc_ctx, 0, sizeof(unauthorized_chrc_ctx)); - memset(&authorized_chrc_ctx, 0, sizeof(authorized_chrc_ctx)); - - cp_write_cnt++; - - if (cp_write_cnt == 3) { - SET_FLAG(flag_is_chrc_ctx_validated); - } - - return len; -} - -BT_GATT_SERVICE_DEFINE(test_svc, - BT_GATT_PRIMARY_SERVICE(TEST_SERVICE_UUID), - BT_GATT_CHARACTERISTIC(TEST_UNHANDLED_CHRC_UUID, - BT_GATT_CHRC_WRITE | BT_GATT_CHRC_READ, - BT_GATT_PERM_WRITE | BT_GATT_PERM_READ, - read_test_unhandled_chrc, - write_test_unhandled_chrc, NULL), - BT_GATT_CHARACTERISTIC(TEST_UNAUTHORIZED_CHRC_UUID, - BT_GATT_CHRC_WRITE | BT_GATT_CHRC_READ, - BT_GATT_PERM_WRITE | BT_GATT_PERM_READ, - read_test_unauthorized_chrc, - write_test_unauthorized_chrc, NULL), - BT_GATT_CHARACTERISTIC(TEST_AUTHORIZED_CHRC_UUID, - BT_GATT_CHRC_WRITE | BT_GATT_CHRC_READ, - BT_GATT_PERM_WRITE | BT_GATT_PERM_READ, - read_test_authorized_chrc, - write_test_authorized_chrc, NULL), - BT_GATT_CHARACTERISTIC(TEST_CP_CHRC_UUID, - BT_GATT_CHRC_WRITE, - BT_GATT_PERM_WRITE, - NULL, write_cp_chrc, NULL), -); - -static bool gatt_read_operation_authorize(struct bt_conn *conn, - const struct bt_gatt_attr *attr) -{ - if (bt_uuid_cmp(attr->uuid, TEST_UNAUTHORIZED_CHRC_UUID) == 0) { - unauthorized_chrc_ctx.auth_read_cnt++; - return false; - } else if (bt_uuid_cmp(attr->uuid, TEST_AUTHORIZED_CHRC_UUID) == 0) { - authorized_chrc_ctx.auth_read_cnt++; - return true; - } else { - return true; - } -} - -static bool gatt_write_operation_authorize(struct bt_conn *conn, - const struct bt_gatt_attr *attr) -{ - if (bt_uuid_cmp(attr->uuid, TEST_UNAUTHORIZED_CHRC_UUID) == 0) { - unauthorized_chrc_ctx.auth_write_cnt++; - return false; - } else if (bt_uuid_cmp(attr->uuid, TEST_AUTHORIZED_CHRC_UUID) == 0) { - authorized_chrc_ctx.auth_write_cnt++; - return true; - } else { - return true; - } -} - -static const struct bt_gatt_authorization_cb gatt_authorization_callbacks = { - .read_operation_authorize = gatt_read_operation_authorize, - .write_operation_authorize = gatt_write_operation_authorize, -}; - -static void test_main(void) -{ - int err; - const struct bt_data ad[] = { - BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)) - }; - - err = bt_gatt_authorization_cb_register(&gatt_authorization_callbacks); - if (err) { - FAIL("Registering GATT authorization callbacks failed (err %d)\n", err); - return; - } - - err = bt_enable(NULL); - if (err != 0) { - FAIL("Bluetooth init failed (err %d)\n", err); - return; - } - - printk("Bluetooth initialized\n"); - - err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0); - if (err != 0) { - FAIL("Advertising failed to start (err %d)\n", err); - return; - } - - printk("Advertising successfully started\n"); - - WAIT_FOR_FLAG(flag_is_chrc_ctx_validated); - - PASS("GATT server passed\n"); -} - -static const struct bst_test_instance test_gatt_server[] = { - { - .test_id = "gatt_server", - .test_post_init_f = test_init, - .test_tick_f = test_tick, - .test_main_f = test_main - }, - BSTEST_END_MARKER -}; - -struct bst_test_list *test_gatt_server_install(struct bst_test_list *tests) -{ - return bst_add_tests(tests, test_gatt_server); -} diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/main.c b/tests/bsim/bluetooth/host/gatt/authorization/src/main.c deleted file mode 100644 index a95f0285e75..00000000000 --- a/tests/bsim/bluetooth/host/gatt/authorization/src/main.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "bstests.h" - -extern struct bst_test_list *test_gatt_server_install(struct bst_test_list *tests); -extern struct bst_test_list *test_gatt_client_install(struct bst_test_list *tests); - -bst_test_install_t test_installers[] = { - test_gatt_server_install, - test_gatt_client_install, - NULL -}; - -int main(void) -{ - bst_main(); - return 0; -} diff --git a/tests/bsim/bluetooth/host/gatt/authorization/test_scripts/gatt.sh b/tests/bsim/bluetooth/host/gatt/authorization/test_scripts/gatt.sh deleted file mode 100755 index edad0eb86c9..00000000000 --- a/tests/bsim/bluetooth/host/gatt/authorization/test_scripts/gatt.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source ${ZEPHYR_BASE}/tests/bsim/sh_common.source - -simulation_id="gatt_authorization" -verbosity_level=2 -EXECUTE_TIMEOUT=120 - -cd ${BSIM_OUT_PATH}/bin - -Execute ./bs_${BOARD}_tests_bsim_bluetooth_host_gatt_authorization_prj_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=gatt_client - -Execute ./bs_${BOARD}_tests_bsim_bluetooth_host_gatt_authorization_prj_conf \ - -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=gatt_server - -Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ - -D=2 -sim_length=60e6 $@ - -wait_for_background_jobs From 9ea9eddd219c159bdd556635284982aa58417847 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:50 +0100 Subject: [PATCH 1178/2300] Revert "[nrf fromtree] bluetooth: gatt: add authorization callback API for gatt operations" This reverts commit c8c1661aa423e9e173bb9ff1eca1c978c8ca70e6. Signed-off-by: Robert Lubos --- include/zephyr/bluetooth/gatt.h | 51 ------------------ subsys/bluetooth/host/Kconfig.gatt | 9 ---- subsys/bluetooth/host/att.c | 83 ------------------------------ 3 files changed, 143 deletions(-) diff --git a/include/zephyr/bluetooth/gatt.h b/include/zephyr/bluetooth/gatt.h index eb38f765afb..c53422648f0 100644 --- a/include/zephyr/bluetooth/gatt.h +++ b/include/zephyr/bluetooth/gatt.h @@ -235,37 +235,6 @@ struct bt_gatt_cb { sys_snode_t node; }; -/** @brief GATT authorization callback structure. */ -struct bt_gatt_authorization_cb { - /** @brief Authorize the GATT read operation. - * - * This callback allows the application to authorize the GATT - * read operation for the attribute that is being read. - * - * @param conn Connection object. - * @param attr The attribute that is being read. - * - * @retval true Authorize the operation and allow it to execute. - * @retval false Reject the operation and prevent it from executing. - */ - bool (*read_operation_authorize)(struct bt_conn *conn, - const struct bt_gatt_attr *attr); - - /** @brief Authorize the GATT write operation. - * - * This callback allows the application to authorize the GATT - * write operation for the attribute that is being written. - * - * @param conn Connection object. - * @param attr The attribute that is being written. - * - * @retval true Authorize the operation and allow it to execute. - * @retval false Reject the operation and prevent it from executing. - */ - bool (*write_operation_authorize)(struct bt_conn *conn, - const struct bt_gatt_attr *attr); -}; - /** Characteristic Properties Bit field values */ /** @@ -408,26 +377,6 @@ struct bt_gatt_cpf { */ void bt_gatt_cb_register(struct bt_gatt_cb *cb); -/** @brief Register GATT authorization callbacks. - * - * Register callbacks to perform application-specific authorization of GATT - * operations on all registered GATT attributes. The callback structure must - * remain valid throughout the entire duration of the Bluetooth subsys - * activity. - * - * The @kconfig{CONFIG_BT_GATT_AUTHORIZATION_CUSTOM} Kconfig must be enabled - * to make this API functional. - * - * This API allows the user to register only one callback structure - * concurrently. Passing NULL unregisters the previous set of callbacks - * and makes it possible to register a new one. - * - * @param cb Callback struct. - * - * @return Zero on success or negative error code otherwise - */ -int bt_gatt_authorization_cb_register(const struct bt_gatt_authorization_cb *cb); - /** @brief Register GATT service. * * Register GATT service. Applications can make use of diff --git a/subsys/bluetooth/host/Kconfig.gatt b/subsys/bluetooth/host/Kconfig.gatt index a2364bbe557..9209368f943 100644 --- a/subsys/bluetooth/host/Kconfig.gatt +++ b/subsys/bluetooth/host/Kconfig.gatt @@ -276,13 +276,4 @@ config DEVICE_NAME_GATT_WRITABLE_AUTHEN endif #BT_DEVICE_NAME_GATT_WRITABLE -config BT_GATT_AUTHORIZATION_CUSTOM - bool "Custom authorization of GATT operations [EXPERIMENTAL]" - select EXPERIMENTAL - help - This option allows the user to define application-specific - authorization logic for GATT operations that can be registered - with the bt_gatt_authorization_cb_register API. See the API - documentation for more details. - endmenu diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 8b03990e84a..4974055acc3 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -115,11 +115,6 @@ static uint16_t bt_att_mtu(struct bt_att_chan *chan) return MIN(chan->chan.rx.mtu, chan->chan.tx.mtu); } -/* Descriptor of application-specific authorization callbacks that are used - * with the CONFIG_BT_GATT_AUTHORIZATION_CUSTOM Kconfig enabled. - */ -const static struct bt_gatt_authorization_cb *authorization_cb; - /* ATT connection specific data */ struct bt_att { struct bt_conn *conn; @@ -1294,20 +1289,6 @@ struct read_type_data { typedef bool (*attr_read_cb)(struct net_buf *buf, ssize_t read, void *user_data); -static bool attr_read_authorize(struct bt_conn *conn, - const struct bt_gatt_attr *attr) -{ - if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { - return true; - } - - if (!authorization_cb || !authorization_cb->read_operation_authorize) { - return true; - } - - return authorization_cb->read_operation_authorize(conn, attr); -} - static bool attr_read_type_cb(struct net_buf *frag, ssize_t read, void *user_data) { @@ -1417,12 +1398,6 @@ static uint8_t read_type_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } - /* Check the attribute authorization logic */ - if (!attr_read_authorize(conn, attr)) { - data->err = BT_ATT_ERR_AUTHORIZATION; - return BT_GATT_ITER_STOP; - } - /* * If any attribute is founded in handle range it means that error * should be changed from pre-set: attr not found error to no error. @@ -1551,12 +1526,6 @@ static uint8_t read_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } - /* Check the attribute authorization logic */ - if (!attr_read_authorize(conn, attr)) { - data->err = BT_ATT_ERR_AUTHORIZATION; - return BT_GATT_ITER_STOP; - } - /* Read attribute value and store in the buffer */ ret = att_chan_read(chan, attr, data->buf, data->offset, NULL, NULL); if (ret < 0) { @@ -1724,12 +1693,6 @@ static uint8_t read_vl_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } - /* Check the attribute authorization logic */ - if (!attr_read_authorize(conn, attr)) { - data->err = BT_ATT_ERR_AUTHORIZATION; - return BT_GATT_ITER_STOP; - } - /* The Length Value Tuple List may be truncated within the first two * octets of a tuple due to the size limits of the current ATT_MTU. */ @@ -1977,20 +1940,6 @@ struct write_data { uint8_t err; }; -static bool attr_write_authorize(struct bt_conn *conn, - const struct bt_gatt_attr *attr) -{ - if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { - return true; - } - - if (!authorization_cb || !authorization_cb->write_operation_authorize) { - return true; - } - - return authorization_cb->write_operation_authorize(conn, attr); -} - static uint8_t write_cb(const struct bt_gatt_attr *attr, uint16_t handle, void *user_data) { @@ -2007,12 +1956,6 @@ static uint8_t write_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } - /* Check the attribute authorization logic */ - if (!attr_write_authorize(data->conn, attr)) { - data->err = BT_ATT_ERR_AUTHORIZATION; - return BT_GATT_ITER_STOP; - } - /* Set command flag if not a request */ if (!data->req) { flags |= BT_GATT_WRITE_FLAG_CMD; @@ -2126,12 +2069,6 @@ static uint8_t prep_write_cb(const struct bt_gatt_attr *attr, uint16_t handle, return BT_GATT_ITER_STOP; } - /* Check the attribute authorization logic */ - if (!attr_write_authorize(data->conn, attr)) { - data->err = BT_ATT_ERR_AUTHORIZATION; - return BT_GATT_ITER_STOP; - } - /* Check if attribute requires handler to accept the data */ if (!(attr->perm & BT_GATT_PERM_PREPARE_WRITE)) { goto append; @@ -4065,23 +4002,3 @@ bool bt_att_chan_opt_valid(struct bt_conn *conn, enum bt_att_chan_opt chan_opt) return true; } - -int bt_gatt_authorization_cb_register(const struct bt_gatt_authorization_cb *cb) -{ - if (!IS_ENABLED(CONFIG_BT_GATT_AUTHORIZATION_CUSTOM)) { - return -ENOSYS; - } - - if (!cb) { - authorization_cb = NULL; - return 0; - } - - if (authorization_cb) { - return -EALREADY; - } - - authorization_cb = cb; - - return 0; -} From f3a0b924f27a579ca79f25e718ad9b0b10877bd5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:50 +0100 Subject: [PATCH 1179/2300] Revert "[nrf fromtree] net: shell: Implement DHCPv4 server shell commands" This reverts commit 1a61ddeef64be45e7eaba5eb12fb0f88a410e935. Signed-off-by: Robert Lubos --- subsys/net/lib/shell/CMakeLists.txt | 1 - subsys/net/lib/shell/dhcpv4.c | 215 ---------------------------- 2 files changed, 216 deletions(-) delete mode 100644 subsys/net/lib/shell/dhcpv4.c diff --git a/subsys/net/lib/shell/CMakeLists.txt b/subsys/net/lib/shell/CMakeLists.txt index 5cfb5c269b4..2c5c0757505 100644 --- a/subsys/net/lib/shell/CMakeLists.txt +++ b/subsys/net/lib/shell/CMakeLists.txt @@ -10,7 +10,6 @@ zephyr_library_sources(allocs.c) zephyr_library_sources(arp.c) zephyr_library_sources(capture.c) zephyr_library_sources(conn.c) -zephyr_library_sources(dhcpv4.c) zephyr_library_sources(dns.c) zephyr_library_sources(events.c) zephyr_library_sources(gptp.c) diff --git a/subsys/net/lib/shell/dhcpv4.c b/subsys/net/lib/shell/dhcpv4.c deleted file mode 100644 index a59b9c45edb..00000000000 --- a/subsys/net/lib/shell/dhcpv4.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -LOG_MODULE_DECLARE(net_shell); - -#include -#include -#include - -#include "net_shell_private.h" - -static int cmd_net_dhcpv4_server_start(const struct shell *sh, size_t argc, char *argv[]) -{ -#if defined(CONFIG_NET_DHCPV4_SERVER) - struct net_if *iface = NULL; - struct in_addr base_addr; - int idx, ret; - - idx = get_iface_idx(sh, argv[1]); - if (idx < 0) { - return -ENOEXEC; - } - - iface = net_if_get_by_index(idx); - if (!iface) { - PR_WARNING("No such interface in index %d\n", idx); - return -ENOEXEC; - } - - if (net_addr_pton(AF_INET, argv[2], &base_addr)) { - PR_ERROR("Invalid address: %s\n", argv[2]); - return -EINVAL; - } - - ret = net_dhcpv4_server_start(iface, &base_addr); - if (ret == -EALREADY) { - PR_WARNING("DHCPv4 server already running on interface %d\n", idx); - } else if (ret < 0) { - PR_ERROR("DHCPv4 server failed to start on interface %d, error %d\n", - idx, -ret); - } else { - PR("DHCPv4 server started on interface %d\n", idx); - } -#else /* CONFIG_NET_DHCPV4_SERVER */ - PR_INFO("Set %s to enable %s support.\n", - "CONFIG_NET_DHCPV4_SERVER", "DHCPv4 server"); -#endif /* CONFIG_NET_DHCPV4_SERVER */ - return 0; -} - -static int cmd_net_dhcpv4_server_stop(const struct shell *sh, size_t argc, char *argv[]) -{ -#if defined(CONFIG_NET_DHCPV4_SERVER) - struct net_if *iface = NULL; - int idx, ret; - - idx = get_iface_idx(sh, argv[1]); - if (idx < 0) { - return -ENOEXEC; - } - - iface = net_if_get_by_index(idx); - if (!iface) { - PR_WARNING("No such interface in index %d\n", idx); - return -ENOEXEC; - } - - ret = net_dhcpv4_server_stop(iface); - if (ret == -ENOENT) { - PR_WARNING("DHCPv4 server is not running on interface %d\n", idx); - } else if (ret < 0) { - PR_ERROR("DHCPv4 server failed to stop on interface %d, error %d\n", - idx, -ret); - } else { - PR("DHCPv4 server stopped on interface %d\n", idx); - } -#else /* CONFIG_NET_DHCPV4_SERVER */ - PR_INFO("Set %s to enable %s support.\n", - "CONFIG_NET_DHCPV4_SERVER", "DHCPv4 server"); -#endif /* CONFIG_NET_DHCPV4_SERVER */ - return 0; -} - -#if defined(CONFIG_NET_DHCPV4_SERVER) -static const char *dhcpv4_addr_state_to_str(enum dhcpv4_server_addr_state state) -{ - switch (state) { - case DHCPV4_SERVER_ADDR_FREE: - return "FREE"; - case DHCPV4_SERVER_ADDR_RESERVED: - return "RESERVED"; - case DHCPV4_SERVER_ADDR_ALLOCATED: - return "ALLOCATED"; - case DHCPV4_SERVER_ADDR_DECLINED: - return "DECLINED"; - } - - return ""; -} - -static uint32_t timepoint_to_s(k_timepoint_t timepoint) -{ - k_timeout_t timeout = sys_timepoint_timeout(timepoint); - - if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { - return 0; - } - - if (K_TIMEOUT_EQ(timeout, K_FOREVER)) { - return UINT32_MAX; - } - - return k_ticks_to_ms_floor64(timeout.ticks) / 1000; -} - -static void dhcpv4_lease_cb(struct net_if *iface, - struct dhcpv4_addr_slot *lease, - void *user_data) -{ - struct net_shell_user_data *data = user_data; - const struct shell *sh = data->sh; - int *count = data->user_data; - char expiry_str[] = "4294967295"; /* Lease time is uint32_t, so take - * theoretical max. - */ - char iface_name[IFNAMSIZ] = ""; - - if (*count == 0) { - PR(" Iface Address\t State\tExpiry (sec)\n"); - } - - (*count)++; - - (void)net_if_get_name(iface, iface_name, sizeof(iface_name)); - - if (lease->state == DHCPV4_SERVER_ADDR_DECLINED) { - snprintk(expiry_str, sizeof(expiry_str) - 1, "infinite"); - } else { - snprintk(expiry_str, sizeof(expiry_str) - 1, "%u", - timepoint_to_s(lease->expiry)); - } - - PR("%2d. %6s %15s\t%9s\t%12s\n", - *count, iface_name, net_sprint_ipv4_addr(&lease->addr), - dhcpv4_addr_state_to_str(lease->state), expiry_str); -} -#endif /* CONFIG_NET_DHCPV4_SERVER */ - -static int cmd_net_dhcpv4_server_status(const struct shell *sh, size_t argc, char *argv[]) -{ -#if defined(CONFIG_NET_DHCPV4_SERVER) - struct net_shell_user_data user_data; - struct net_if *iface = NULL; - int idx = 0, ret; - int count = 0; - - if (argc > 1) { - idx = get_iface_idx(sh, argv[1]); - if (idx < 0) { - return -ENOEXEC; - } - - iface = net_if_get_by_index(idx); - if (!iface) { - PR_WARNING("No such interface in index %d\n", idx); - return -ENOEXEC; - } - } - - user_data.sh = sh; - user_data.user_data = &count; - - ret = net_dhcpv4_server_foreach_lease(iface, dhcpv4_lease_cb, &user_data); - if (ret == -ENOENT) { - PR_WARNING("DHCPv4 server is not running on interface %d\n", idx); - } else if (count == 0) { - PR("DHCPv4 server - no addresses assigned\n"); - } -#else /* CONFIG_NET_DHCPV4_SERVER */ - PR_INFO("Set %s to enable %s support.\n", - "CONFIG_NET_DHCPV4_SERVER", "DHCPv4 server"); -#endif /* CONFIG_NET_DHCPV4_SERVER */ - return 0; -} - -SHELL_STATIC_SUBCMD_SET_CREATE(net_cmd_dhcpv4_server, - SHELL_CMD_ARG(start, NULL, "Start the DHCPv4 server operation on the interface.\n" - "'net dhcpv4 server start '\n" - " is the network interface index.\n" - " is the first address for the address pool.", - cmd_net_dhcpv4_server_start, 3, 0), - SHELL_CMD_ARG(stop, NULL, "Stop the DHCPv4 server operation on the interface.\n" - "'net dhcpv4 server stop '\n" - " is the network interface index.", - cmd_net_dhcpv4_server_stop, 2, 0), - SHELL_CMD_ARG(status, NULL, "Print the DHCPv4 server status on the interface.\n" - "'net dhcpv4 server status '\n" - " is the network interface index. Optional.", - cmd_net_dhcpv4_server_status, 1, 1), - SHELL_SUBCMD_SET_END -); - -SHELL_STATIC_SUBCMD_SET_CREATE(net_cmd_dhcpv4, - SHELL_CMD(server, &net_cmd_dhcpv4_server, - "DHCPv4 server service management.", - NULL), - SHELL_SUBCMD_SET_END -); - -SHELL_SUBCMD_ADD((net), dhcpv4, &net_cmd_dhcpv4, "Manage DHPCv4 services.", - NULL, 1, 0); From 2eb2cb3cc82a638bf847021bad67a550f3224106 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:50 +0100 Subject: [PATCH 1180/2300] Revert "[nrf fromtree] net: socket_services: Increase default stack size for DHCPv4 server" This reverts commit e707475bbfbbdc6c2a6b88b98db54a46b38ac221. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 35750dd3583..40d86b9498f 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -88,7 +88,6 @@ config NET_SOCKETS_SERVICE config NET_SOCKETS_SERVICE_STACK_SIZE int "Stack size for the thread handling socket services" - default 2400 if NET_DHCPV4_SERVER default 1200 depends on NET_SOCKETS_SERVICE help From 54c547853e768f0b64db8bf7abe35fb5f6744513 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:50 +0100 Subject: [PATCH 1181/2300] Revert "[nrf fromtree] net: dhcpv4: Implement DHCPv4 server" This reverts commit ba44512f525c8657eb65c5aa205ee04fdc704086. Signed-off-by: Robert Lubos --- include/zephyr/net/dhcpv4_server.h | 118 -- subsys/net/ip/dhcpv4.h | 11 - subsys/net/ip/net_core.c | 2 - subsys/net/lib/CMakeLists.txt | 1 - subsys/net/lib/Kconfig | 2 - subsys/net/lib/dhcpv4/CMakeLists.txt | 11 - subsys/net/lib/dhcpv4/Kconfig | 46 - subsys/net/lib/dhcpv4/dhcpv4_server.c | 1439 ------------------------- 8 files changed, 1630 deletions(-) delete mode 100644 include/zephyr/net/dhcpv4_server.h delete mode 100644 subsys/net/lib/dhcpv4/CMakeLists.txt delete mode 100644 subsys/net/lib/dhcpv4/Kconfig delete mode 100644 subsys/net/lib/dhcpv4/dhcpv4_server.c diff --git a/include/zephyr/net/dhcpv4_server.h b/include/zephyr/net/dhcpv4_server.h deleted file mode 100644 index 18c4af114cd..00000000000 --- a/include/zephyr/net/dhcpv4_server.h +++ /dev/null @@ -1,118 +0,0 @@ -/** @file - * @brief DHCPv4 Server API - */ - -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_ -#define ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief DHCPv4 server - * @defgroup dhcpv4_server DHCPv4 server - * @ingroup networking - * @{ - */ - -/** @cond INTERNAL_HIDDEN */ - -struct net_if; - -#define DHCPV4_CLIENT_ID_MAX_SIZE 20 - -enum dhcpv4_server_addr_state { - DHCPV4_SERVER_ADDR_FREE, - DHCPV4_SERVER_ADDR_RESERVED, - DHCPV4_SERVER_ADDR_ALLOCATED, - DHCPV4_SERVER_ADDR_DECLINED, -}; - -struct dhcpv4_client_id { - uint8_t buf[DHCPV4_CLIENT_ID_MAX_SIZE]; - uint8_t len; -}; - -struct dhcpv4_addr_slot { - enum dhcpv4_server_addr_state state; - struct dhcpv4_client_id client_id; - struct in_addr addr; - uint32_t lease_time; - k_timepoint_t expiry; -}; - -/** @endcond */ - -/** - * @brief Start DHCPv4 server instance on an iface - * - * @details Start DHCPv4 server on a given interface. The server will start - * listening for DHCPv4 Discover/Request messages on the interface and assign - * IPv4 addresses from the configured address pool accordingly. - * - * @param iface A valid pointer on an interface - * @param base_addr First IPv4 address from the DHCPv4 address pool. The number - * of addresses in the pool is configured statically with Kconfig - * (CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT). - * - * @return 0 on success, a negative error code otherwise. - */ -int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr); - -/** - * @brief Stop DHCPv4 server instance on an iface - * - * @details Stop DHCPv4 server on a given interface. DHCPv4 requests will no - * longer be handled on the interface, and all of the allocations are cleared. - * - * @param iface A valid pointer on an interface - * - * @return 0 on success, a negative error code otherwise. - */ -int net_dhcpv4_server_stop(struct net_if *iface); - -/** - * @typedef net_dhcpv4_lease_cb_t - * @brief Callback used while iterating over active DHCPv4 address leases - * - * @param iface Pointer to the network interface - * @param lease Pointer to the DHPCv4 address lease slot - * @param user_data A valid pointer to user data or NULL - */ -typedef void (*net_dhcpv4_lease_cb_t)(struct net_if *iface, - struct dhcpv4_addr_slot *lease, - void *user_data); - -/** - * @brief Iterate over all DHCPv4 address leases on a given network interface - * and call callback for each lease. In case no network interface is provided - * (NULL interface pointer), will iterate over all interfaces running DHCPv4 - * server instance. - * - * @param iface Pointer to the network interface, can be NULL - * @param cb User-supplied callback function to call - * @param user_data User specified data - */ -int net_dhcpv4_server_foreach_lease(struct net_if *iface, - net_dhcpv4_lease_cb_t cb, - void *user_data); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_ */ diff --git a/subsys/net/ip/dhcpv4.h b/subsys/net/ip/dhcpv4.h index 712d361ac80..a274e3a6aea 100644 --- a/subsys/net/ip/dhcpv4.h +++ b/subsys/net/ip/dhcpv4.h @@ -62,7 +62,6 @@ struct dhcp_msg { #define DHCPV4_OPTIONS_REQ_LIST 55 #define DHCPV4_OPTIONS_RENEWAL 58 #define DHCPV4_OPTIONS_REBINDING 59 -#define DHCPV4_OPTIONS_CLIENT_ID 61 #define DHCPV4_OPTIONS_END 255 /* Useful size macros */ @@ -143,14 +142,4 @@ static inline bool net_dhcpv4_accept_unicast(struct net_pkt *pkt) #endif /* CONFIG_NET_DHCPV4 && CONFIG_NET_DHCPV4_ACCEPT_UNICAST */ -#if defined(CONFIG_NET_DHCPV4_SERVER) - -void net_dhcpv4_server_init(void); - -#else - -#define net_dhcpv4_server_init() - -#endif /* CONFIG_NET_DHCPV4_SERVER */ - #endif /* __INTERNAL_DHCPV4_H */ diff --git a/subsys/net/ip/net_core.c b/subsys/net/ip/net_core.c index 3187b40a66b..baa8cd695c5 100644 --- a/subsys/net/ip/net_core.c +++ b/subsys/net/ip/net_core.c @@ -495,8 +495,6 @@ static inline int services_init(void) return status; } - net_dhcpv4_server_init(); - dns_init_resolver(); websocket_init(); diff --git a/subsys/net/lib/CMakeLists.txt b/subsys/net/lib/CMakeLists.txt index e3319f6cd8d..5e4eae7e028 100644 --- a/subsys/net/lib/CMakeLists.txt +++ b/subsys/net/lib/CMakeLists.txt @@ -15,7 +15,6 @@ add_subdirectory_ifdef(CONFIG_NET_CAPTURE capture) add_subdirectory_ifdef(CONFIG_NET_ZPERF zperf) add_subdirectory_ifdef(CONFIG_NET_SHELL shell) add_subdirectory_ifdef(CONFIG_NET_TRICKLE trickle) -add_subdirectory_ifdef(CONFIG_NET_DHCPV4_SERVER dhcpv4) if (CONFIG_DNS_RESOLVER OR CONFIG_MDNS_RESPONDER diff --git a/subsys/net/lib/Kconfig b/subsys/net/lib/Kconfig index 6cfa0445241..b70105d5f9b 100644 --- a/subsys/net/lib/Kconfig +++ b/subsys/net/lib/Kconfig @@ -39,8 +39,6 @@ menu "Network additional services" source "subsys/net/lib/capture/Kconfig" -source "subsys/net/lib/dhcpv4/Kconfig" - source "subsys/net/lib/trickle/Kconfig" source "subsys/net/lib/zperf/Kconfig" diff --git a/subsys/net/lib/dhcpv4/CMakeLists.txt b/subsys/net/lib/dhcpv4/CMakeLists.txt deleted file mode 100644 index 348b6c99bb7..00000000000 --- a/subsys/net/lib/dhcpv4/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() - -zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/ip) - -zephyr_library_sources( - dhcpv4_server.c - ) diff --git a/subsys/net/lib/dhcpv4/Kconfig b/subsys/net/lib/dhcpv4/Kconfig deleted file mode 100644 index 801d536a5a1..00000000000 --- a/subsys/net/lib/dhcpv4/Kconfig +++ /dev/null @@ -1,46 +0,0 @@ -# DHCPv4 server implementation for Zephyr - -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 - -config NET_DHCPV4_SERVER - bool "DHCPv4 server" - depends on NET_IPV4 && NET_UDP - select NET_SOCKETS - select NET_SOCKETS_SERVICE - -if NET_DHCPV4_SERVER - -module = NET_DHCPV4_SERVER -module-dep = NET_LOG -module-str = Log level for DHCPv4 server -module-help = Enables DHCPv4 server output debug messages -source "subsys/net/Kconfig.template.log_config.net" - -config NET_DHCPV4_SERVER_INSTANCES - int "Maximum number of DHCPv4 server instances" - default 1 - help - Maximum number of DHCPv4 server instances supported by the system. - Each network interface that wants to act as a DHCPv4 server requires - a separate instance. - -config NET_DHCPV4_SERVER_ADDR_COUNT - int "Number of IPv4 addresses that can be assigned by the server" - default 4 - help - Maximum number of IPv4 addresses that can be assigned by the DHCPv4 - server instance. The base IPv4 address in the address pool is provided - at runtime, during server initialization. Consecutive addresses in the - pool have the lowest address octet incremented. - -config NET_DHCPV4_SERVER_ADDR_LEASE_TIME - int "Lease time for IPv4 addresses assigned by the server (seconds)" - default 86400 - help - Lease time in seconds for IPv4 addresses assigned by the server. - The lease time determines when the IPv4 address lease expires if the - client does not renew it. - -endif # NET_DHCPV4_SERVER diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c deleted file mode 100644 index 714d036ddde..00000000000 --- a/subsys/net/lib/dhcpv4/dhcpv4_server.c +++ /dev/null @@ -1,1439 +0,0 @@ -/** @file - * @brief DHCPv4 server implementation - */ - -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -LOG_MODULE_REGISTER(net_dhcpv4_server, CONFIG_NET_DHCPV4_SERVER_LOG_LEVEL); - -#include "dhcpv4.h" -#include "net_private.h" -#include "../../l2/ethernet/arp.h" - -#define DHCPV4_OPTIONS_MSG_TYPE_SIZE 3 -#define DHCPV4_OPTIONS_IP_LEASE_TIME_SIZE 6 -#define DHCPV4_OPTIONS_SERVER_ID_SIZE 6 -#define DHCPV4_OPTIONS_SUBNET_MASK_SIZE 6 -#define DHCPV4_OPTIONS_CLIENT_ID_MIN_SIZE 2 - -#define ADDRESS_RESERVED_TIMEOUT K_SECONDS(5) - -/* RFC 1497 [17] */ -static const uint8_t magic_cookie[4] = { 0x63, 0x82, 0x53, 0x63 }; - -struct dhcpv4_server_ctx { - struct net_if *iface; - int sock; - struct k_work_delayable timeout_work; - struct dhcpv4_addr_slot addr_pool[CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT]; - struct in_addr server_addr; - struct in_addr netmask; -}; - -static struct dhcpv4_server_ctx server_ctx[CONFIG_NET_DHCPV4_SERVER_INSTANCES]; -static struct zsock_pollfd fds[CONFIG_NET_DHCPV4_SERVER_INSTANCES]; -static K_MUTEX_DEFINE(server_lock); - -#define DHCPV4_MAX_PARAMETERS_REQUEST_LEN 16 - -struct dhcpv4_parameter_request_list { - uint8_t list[DHCPV4_MAX_PARAMETERS_REQUEST_LEN]; - uint8_t count; -}; - -static void dhcpv4_server_timeout_recalc(struct dhcpv4_server_ctx *ctx) -{ - k_timepoint_t next = sys_timepoint_calc(K_FOREVER); - k_timeout_t timeout; - - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) { - if (sys_timepoint_cmp(slot->expiry, next) < 0) { - next = slot->expiry; - } - } - } - - timeout = sys_timepoint_timeout(next); - - if (K_TIMEOUT_EQ(timeout, K_FOREVER)) { - LOG_DBG("No more addresses, canceling timer"); - k_work_cancel_delayable(&ctx->timeout_work); - } else { - k_work_reschedule(&ctx->timeout_work, timeout); - } -} - -/* Option parsing. */ - -static uint8_t *dhcpv4_find_option(uint8_t *data, size_t datalen, - uint8_t *optlen, uint8_t opt_code) -{ - uint8_t *opt = NULL; - - while (datalen > 0) { - uint8_t code; - uint8_t len; - - code = *data; - - /* Two special cases (fixed sized options) */ - if (code == 0) { - data++; - datalen--; - continue; - } - - if (code == DHCPV4_OPTIONS_END) { - break; - } - - /* Length field should now follow. */ - if (datalen < 2) { - break; - } - - len = *(data + 1); - - if (datalen < len + 2) { - break; - } - - if (code == opt_code) { - /* Found the option. */ - opt = data + 2; - *optlen = len; - break; - } - - data += len + 2; - datalen -= len + 2; - } - - return opt; -} - -static int dhcpv4_find_message_type_option(uint8_t *data, size_t datalen, - uint8_t *msgtype) -{ - uint8_t *opt; - uint8_t optlen; - - opt = dhcpv4_find_option(data, datalen, &optlen, - DHCPV4_OPTIONS_MSG_TYPE); - if (opt == NULL) { - return -ENOENT; - } - - if (optlen != 1) { - return -EINVAL; - } - - *msgtype = *opt; - - return 0; -} - -static int dhcpv4_find_server_id_option(uint8_t *data, size_t datalen, - struct in_addr *server_id) -{ - uint8_t *opt; - uint8_t optlen; - - opt = dhcpv4_find_option(data, datalen, &optlen, - DHCPV4_OPTIONS_SERVER_ID); - if (opt == NULL) { - return -ENOENT; - } - - if (optlen != sizeof(struct in_addr)) { - return -EINVAL; - } - - memcpy(server_id, opt, sizeof(struct in_addr)); - - return 0; -} - -static int dhcpv4_find_client_id_option(uint8_t *data, size_t datalen, - uint8_t *client_id, uint8_t *len) -{ - uint8_t *opt; - uint8_t optlen; - - opt = dhcpv4_find_option(data, datalen, &optlen, - DHCPV4_OPTIONS_CLIENT_ID); - if (opt == NULL) { - return -ENOENT; - } - - if (optlen < DHCPV4_OPTIONS_CLIENT_ID_MIN_SIZE) { - return -EINVAL; - } - - if (optlen > *len) { - LOG_ERR("Not enough memory for DHCPv4 client identifier."); - return -ENOMEM; - } - - memcpy(client_id, opt, optlen); - *len = optlen; - - return 0; -} - -static int dhcpv4_find_requested_ip_option(uint8_t *data, size_t datalen, - struct in_addr *requested_ip) -{ - uint8_t *opt; - uint8_t optlen; - - opt = dhcpv4_find_option(data, datalen, &optlen, - DHCPV4_OPTIONS_REQ_IPADDR); - if (opt == NULL) { - return -ENOENT; - } - - if (optlen != sizeof(struct in_addr)) { - return -EINVAL; - } - - memcpy(requested_ip, opt, sizeof(struct in_addr)); - - return 0; -} - -static int dhcpv4_find_ip_lease_time_option(uint8_t *data, size_t datalen, - uint32_t *lease_time) -{ - uint8_t *opt; - uint8_t optlen; - - opt = dhcpv4_find_option(data, datalen, &optlen, - DHCPV4_OPTIONS_LEASE_TIME); - if (opt == NULL) { - return -ENOENT; - } - - if (optlen != sizeof(uint32_t)) { - return -EINVAL; - } - - *lease_time = sys_get_be32(opt); - - return 0; -} - -static int dhcpv4_find_parameter_request_list_option( - uint8_t *data, size_t datalen, - struct dhcpv4_parameter_request_list *params) -{ - uint8_t *opt; - uint8_t optlen; - - opt = dhcpv4_find_option(data, datalen, &optlen, - DHCPV4_OPTIONS_REQ_LIST); - if (opt == NULL) { - return -ENOENT; - } - - if (optlen > sizeof(params->list)) { - /* Best effort here, copy as much as we can. */ - optlen = sizeof(params->list); - } - - memcpy(params->list, opt, optlen); - params->count = optlen; - - return 0; -} - -/* Option encoding. */ - -static uint8_t *dhcpv4_encode_magic_cookie(uint8_t *buf, size_t *buflen) -{ - if (buf == NULL || *buflen < SIZE_OF_MAGIC_COOKIE) { - return NULL; - } - - memcpy(buf, magic_cookie, SIZE_OF_MAGIC_COOKIE); - - *buflen -= SIZE_OF_MAGIC_COOKIE; - - return buf + SIZE_OF_MAGIC_COOKIE; -} - -static uint8_t *dhcpv4_encode_ip_lease_time_option(uint8_t *buf, size_t *buflen, - uint32_t lease_time) -{ - if (buf == NULL || *buflen < DHCPV4_OPTIONS_IP_LEASE_TIME_SIZE) { - return NULL; - } - - buf[0] = DHCPV4_OPTIONS_LEASE_TIME; - buf[1] = sizeof(lease_time); - sys_put_be32(lease_time, &buf[2]); - - *buflen -= DHCPV4_OPTIONS_IP_LEASE_TIME_SIZE; - - return buf + DHCPV4_OPTIONS_IP_LEASE_TIME_SIZE; -} - -static uint8_t *dhcpv4_encode_message_type_option(uint8_t *buf, size_t *buflen, - uint8_t msgtype) -{ - if (buf == NULL || *buflen < DHCPV4_OPTIONS_MSG_TYPE_SIZE) { - return NULL; - } - - buf[0] = DHCPV4_OPTIONS_MSG_TYPE; - buf[1] = 1; - buf[2] = msgtype; - - *buflen -= DHCPV4_OPTIONS_MSG_TYPE_SIZE; - - return buf + DHCPV4_OPTIONS_MSG_TYPE_SIZE; -} - -static uint8_t *dhcpv4_encode_server_id_option(uint8_t *buf, size_t *buflen, - struct in_addr *server_id) -{ - if (buf == NULL || *buflen < DHCPV4_OPTIONS_SERVER_ID_SIZE) { - return NULL; - } - - buf[0] = DHCPV4_OPTIONS_SERVER_ID; - buf[1] = sizeof(struct in_addr); - memcpy(&buf[2], server_id->s4_addr, sizeof(struct in_addr)); - - *buflen -= DHCPV4_OPTIONS_SERVER_ID_SIZE; - - return buf + DHCPV4_OPTIONS_SERVER_ID_SIZE; -} - -static uint8_t *dhcpv4_encode_subnet_mask_option(uint8_t *buf, size_t *buflen, - struct in_addr *mask) -{ - if (buf == NULL || *buflen < DHCPV4_OPTIONS_SUBNET_MASK_SIZE) { - return NULL; - } - - buf[0] = DHCPV4_OPTIONS_SUBNET_MASK; - buf[1] = sizeof(struct in_addr); - memcpy(&buf[2], mask->s4_addr, sizeof(struct in_addr)); - - *buflen -= DHCPV4_OPTIONS_SUBNET_MASK_SIZE; - - return buf + DHCPV4_OPTIONS_SUBNET_MASK_SIZE; -} - -static uint8_t *dhcpv4_encode_end_option(uint8_t *buf, size_t *buflen) -{ - if (buf == NULL || *buflen < 1) { - return NULL; - } - - buf[0] = DHCPV4_OPTIONS_END; - - *buflen -= 1; - - return buf + 1; -} - -/* Response handlers. */ - -static uint8_t *dhcpv4_encode_header(uint8_t *buf, size_t *buflen, - struct dhcp_msg *msg, - struct in_addr *yiaddr) -{ - struct dhcp_msg *reply_msg = (struct dhcp_msg *)buf; - - if (buf == NULL || *buflen < sizeof(struct dhcp_msg)) { - return NULL; - } - - reply_msg->op = DHCPV4_MSG_BOOT_REPLY; - reply_msg->htype = msg->htype; - reply_msg->hlen = msg->hlen; - reply_msg->hops = 0; - reply_msg->xid = msg->xid; - reply_msg->secs = 0; - reply_msg->flags = msg->flags; - memcpy(reply_msg->ciaddr, msg->ciaddr, sizeof(reply_msg->ciaddr)); - if (yiaddr != NULL) { - memcpy(reply_msg->yiaddr, yiaddr, sizeof(struct in_addr)); - } else { - memset(reply_msg->yiaddr, 0, sizeof(reply_msg->ciaddr)); - } - memset(reply_msg->siaddr, 0, sizeof(reply_msg->siaddr)); - memcpy(reply_msg->giaddr, msg->giaddr, sizeof(reply_msg->giaddr)); - memcpy(reply_msg->chaddr, msg->chaddr, sizeof(reply_msg->chaddr)); - - *buflen -= sizeof(struct dhcp_msg); - - return buf + sizeof(struct dhcp_msg); -} - -static uint8_t *dhcpv4_encode_string(uint8_t *buf, size_t *buflen, char *str, - size_t max_len) -{ - if (buf == NULL || *buflen < max_len) { - return NULL; - } - - memset(buf, 0, max_len); - - if (str == NULL) { - goto out; - } - - strncpy(buf, str, max_len - 1); - - out: - *buflen -= max_len; - - return buf + max_len; -} - -static uint8_t *dhcpv4_encode_sname(uint8_t *buf, size_t *buflen, char *sname) -{ - return dhcpv4_encode_string(buf, buflen, sname, SIZE_OF_SNAME); -} - -static uint8_t *dhcpv4_encode_file(uint8_t *buf, size_t *buflen, char *file) -{ - return dhcpv4_encode_string(buf, buflen, file, SIZE_OF_FILE); -} - -static uint8_t *dhcpv4_encode_requested_params( - uint8_t *buf, size_t *buflen, - struct dhcpv4_server_ctx *ctx, - struct dhcpv4_parameter_request_list *params) -{ - for (uint8_t i = 0; i < params->count; i++) { - switch (params->list[i]) { - case DHCPV4_OPTIONS_SUBNET_MASK: - buf = dhcpv4_encode_subnet_mask_option( - buf, buflen, &ctx->netmask); - if (buf == NULL) { - goto out; - } - break; - - /* Others - just ignore. */ - default: - break; - } - } - -out: - return buf; -} - -static int dhcpv4_send(struct dhcpv4_server_ctx *ctx, enum net_dhcpv4_msg_type type, - uint8_t *reply, size_t len, struct dhcp_msg *msg, - struct in_addr *yiaddr) -{ - struct sockaddr_in dst_addr = { - .sin_family = AF_INET, - .sin_port = htons(DHCPV4_CLIENT_PORT), - }; - struct in_addr giaddr; /* Relay agent address */ - struct in_addr ciaddr; /* Client address */ - int ret; - - memcpy(&giaddr, msg->giaddr, sizeof(giaddr)); - memcpy(&ciaddr, msg->ciaddr, sizeof(ciaddr)); - - /* Select destination address as described in ch. 4.1. */ - if (!net_ipv4_is_addr_unspecified(&giaddr)) { - /* If the 'giaddr' field in a DHCP message from a client is - * non-zero, the server sends any return messages to the - * 'DHCP server' port on the BOOTP relay agent whose address - * appears in 'giaddr'. - */ - dst_addr.sin_addr = giaddr; - dst_addr.sin_port = htons(DHCPV4_SERVER_PORT); - } else if (type == NET_DHCPV4_MSG_TYPE_NAK) { - /* In all cases, when 'giaddr' is zero, the server broadcasts - * any DHCPNAK messages to 0xffffffff. - */ - dst_addr.sin_addr = *net_ipv4_broadcast_address(); - } else if (!net_ipv4_is_addr_unspecified(&ciaddr)) { - /* If the 'giaddr' field is zero and the 'ciaddr' field is - * nonzero, then the server unicasts DHCPOFFER and DHCPACK - * messages to the address in 'ciaddr'. - */ - dst_addr.sin_addr = ciaddr; - } else if (ntohs(msg->flags) & DHCPV4_MSG_BROADCAST) { - /* If 'giaddr' is zero and 'ciaddr' is zero, and the broadcast - * bit is set, then the server broadcasts DHCPOFFER and DHCPACK - * messages to 0xffffffff. - */ - dst_addr.sin_addr = *net_ipv4_broadcast_address(); - } else if (yiaddr != NULL) { - /* If the broadcast bit is not set and 'giaddr' is zero and - * 'ciaddr' is zero, then the server unicasts DHCPOFFER and - * DHCPACK messages to the client's hardware address and 'yiaddr' - * address. - */ - struct net_eth_addr hwaddr; - - memcpy(&hwaddr, msg->chaddr, sizeof(hwaddr)); - net_arp_update(ctx->iface, yiaddr, &hwaddr, false, true); - dst_addr.sin_addr = *yiaddr; - } else { - NET_ERR("Unspecified destination address."); - return -EDESTADDRREQ; - } - - ret = zsock_sendto(ctx->sock, reply, len, 0, (struct sockaddr *)&dst_addr, - sizeof(dst_addr)); - if (ret < 0) { - return -errno; - } - - return 0; -} - -static int dhcpv4_send_offer(struct dhcpv4_server_ctx *ctx, struct dhcp_msg *msg, - struct in_addr *addr, uint32_t lease_time, - struct dhcpv4_parameter_request_list *params) -{ - uint8_t reply[NET_IPV4_MTU]; - uint8_t *buf = reply; - size_t buflen = sizeof(reply); - size_t reply_len = 0; - int ret; - - buf = dhcpv4_encode_header(buf, &buflen, msg, addr); - buf = dhcpv4_encode_sname(buf, &buflen, NULL); - buf = dhcpv4_encode_file(buf, &buflen, NULL); - buf = dhcpv4_encode_magic_cookie(buf, &buflen); - buf = dhcpv4_encode_ip_lease_time_option(buf, &buflen, lease_time); - buf = dhcpv4_encode_message_type_option(buf, &buflen, - NET_DHCPV4_MSG_TYPE_OFFER); - buf = dhcpv4_encode_server_id_option(buf, &buflen, &ctx->server_addr); - buf = dhcpv4_encode_requested_params(buf, &buflen, ctx, params); - buf = dhcpv4_encode_end_option(buf, &buflen); - - if (buf == NULL) { - LOG_ERR("Failed to encode %s message", "Offer"); - return -ENOMEM; - } - - reply_len = sizeof(reply) - buflen; - - ret = dhcpv4_send(ctx, NET_DHCPV4_MSG_TYPE_OFFER, reply, reply_len, - msg, addr); - if (ret < 0) { - LOG_ERR("Failed to send %s message, %d", "Offer", ret); - return ret; - } - - return 0; -} - -static int dhcpv4_send_ack(struct dhcpv4_server_ctx *ctx, struct dhcp_msg *msg, - struct in_addr *addr, uint32_t lease_time, - struct dhcpv4_parameter_request_list *params, - bool inform) -{ - uint8_t reply[NET_IPV4_MTU]; - uint8_t *buf = reply; - size_t buflen = sizeof(reply); - size_t reply_len = 0; - int ret; - - buf = dhcpv4_encode_header(buf, &buflen, msg, inform ? NULL : addr); - buf = dhcpv4_encode_sname(buf, &buflen, NULL); - buf = dhcpv4_encode_file(buf, &buflen, NULL); - buf = dhcpv4_encode_magic_cookie(buf, &buflen); - if (!inform) { - buf = dhcpv4_encode_ip_lease_time_option(buf, &buflen, lease_time); - } - buf = dhcpv4_encode_message_type_option(buf, &buflen, - NET_DHCPV4_MSG_TYPE_ACK); - buf = dhcpv4_encode_server_id_option(buf, &buflen, &ctx->server_addr); - buf = dhcpv4_encode_requested_params(buf, &buflen, ctx, params); - buf = dhcpv4_encode_end_option(buf, &buflen); - - if (buf == NULL) { - LOG_ERR("Failed to encode %s message", "ACK"); - return -ENOMEM; - } - - reply_len = sizeof(reply) - buflen; - - ret = dhcpv4_send(ctx, NET_DHCPV4_MSG_TYPE_ACK, reply, reply_len, msg, - addr); - if (ret < 0) { - LOG_ERR("Failed to send %s message, %d", "ACK", ret); - return ret; - } - - return 0; -} - -static int dhcpv4_send_nak(struct dhcpv4_server_ctx *ctx, struct dhcp_msg *msg) -{ - uint8_t reply[NET_IPV4_MTU]; - uint8_t *buf = reply; - size_t buflen = sizeof(reply); - size_t reply_len = 0; - int ret; - - buf = dhcpv4_encode_header(buf, &buflen, msg, NULL); - buf = dhcpv4_encode_sname(buf, &buflen, NULL); - buf = dhcpv4_encode_file(buf, &buflen, NULL); - buf = dhcpv4_encode_magic_cookie(buf, &buflen); - buf = dhcpv4_encode_message_type_option(buf, &buflen, - NET_DHCPV4_MSG_TYPE_NAK); - buf = dhcpv4_encode_server_id_option(buf, &buflen, &ctx->server_addr); - buf = dhcpv4_encode_end_option(buf, &buflen); - - if (buf == NULL) { - LOG_ERR("Failed to encode %s message", "NAK"); - return -ENOMEM; - } - - reply_len = sizeof(reply) - buflen; - - ret = dhcpv4_send(ctx, NET_DHCPV4_MSG_TYPE_NAK, reply, reply_len, msg, - NULL); - if (ret < 0) { - LOG_ERR("Failed to send %s message, %d", "NAK", ret); - return ret; - } - - return 0; -} - -/* Message handlers. */ - -static int dhcpv4_get_client_id(struct dhcp_msg *msg, uint8_t *options, - uint8_t optlen, struct dhcpv4_client_id *client_id) -{ - int ret; - - client_id->len = sizeof(client_id->buf); - - ret = dhcpv4_find_client_id_option(options, optlen, client_id->buf, - &client_id->len); - if (ret == 0) { - return 0; - } - - /* No Client Id option or too long to use, fallback to hardware address. */ - if (msg->hlen > sizeof(msg->chaddr)) { - LOG_ERR("Malformed chaddr length."); - return -EINVAL; - } - - client_id->buf[0] = msg->htype; - client_id->buf[1] = msg->hlen; - memcpy(client_id->buf + 2, msg->chaddr, msg->hlen); - client_id->len = msg->hlen + 2; - - return 0; -} - -static uint32_t dhcpv4_get_lease_time(uint8_t *options, uint8_t optlen) -{ - uint32_t lease_time; - - if (dhcpv4_find_ip_lease_time_option(options, optlen, - &lease_time) == 0) { - return lease_time; - } - - return CONFIG_NET_DHCPV4_SERVER_ADDR_LEASE_TIME; -} - -static void dhcpv4_handle_discover(struct dhcpv4_server_ctx *ctx, - struct dhcp_msg *msg, uint8_t *options, - uint8_t optlen) -{ - struct dhcpv4_parameter_request_list params = { 0 }; - struct dhcpv4_addr_slot *selected = NULL; - struct dhcpv4_client_id client_id; - int ret; - - ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); - if (ret < 0) { - return; - } - - (void)dhcpv4_find_parameter_request_list_option(options, optlen, ¶ms); - - /* Address pool and address selection algorithm as - * described in 4.3.1 - */ - - /* 1. Check for current bindings */ - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if ((slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) && - slot->client_id.len == client_id.len && - memcmp(slot->client_id.buf, client_id.buf, - client_id.len) == 0) { - /* Got match in current bindings. */ - selected = slot; - break; - } - } - - /* 2. Skipped, for now expired/released entries are forgotten. */ - - /* 3. Check Requested IP Address option. */ - if (selected == NULL) { - struct in_addr requested_ip; - - ret = dhcpv4_find_requested_ip_option(options, optlen, - &requested_ip); - if (ret == 0) { - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = - &ctx->addr_pool[i]; - - if (net_ipv4_addr_cmp(&slot->addr, - &requested_ip) && - slot->state == DHCPV4_SERVER_ADDR_FREE) { - /* Requested address is free. */ - selected = slot; - break; - } - } - } - } - - /* 4. Allocate new address from pool, if available. */ - if (selected == NULL) { - struct in_addr giaddr; - - memcpy(&giaddr, msg->giaddr, sizeof(giaddr)); - if (!net_ipv4_is_addr_unspecified(&giaddr)) { - /* Only addresses in local subnet supproted for now. */ - return; - } - - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (slot->state == DHCPV4_SERVER_ADDR_FREE) { - /* Requested address is free. */ - selected = slot; - break; - } - } - } - - if (selected == NULL) { - LOG_ERR("No free address found in address pool"); - } else { - uint32_t lease_time = dhcpv4_get_lease_time(options, optlen); - - if (dhcpv4_send_offer(ctx, msg, &selected->addr, lease_time, - ¶ms) < 0) { - return; - } - - LOG_DBG("DHCPv4 processing Discover - reserved %s", - net_sprint_ipv4_addr(&selected->addr)); - - selected->state = DHCPV4_SERVER_ADDR_RESERVED; - selected->client_id.len = client_id.len; - memcpy(selected->client_id.buf, client_id.buf, client_id.len); - selected->lease_time = lease_time; - selected->expiry = sys_timepoint_calc(ADDRESS_RESERVED_TIMEOUT); - dhcpv4_server_timeout_recalc(ctx); - } -} - -static void dhcpv4_handle_request(struct dhcpv4_server_ctx *ctx, - struct dhcp_msg *msg, uint8_t *options, - uint8_t optlen) -{ - struct dhcpv4_parameter_request_list params = { 0 }; - struct dhcpv4_addr_slot *selected = NULL; - struct dhcpv4_client_id client_id; - struct in_addr requested_ip, server_id, ciaddr, giaddr; - int ret; - - memcpy(&ciaddr, msg->ciaddr, sizeof(ciaddr)); - memcpy(&giaddr, msg->giaddr, sizeof(giaddr)); - - if (!net_ipv4_is_addr_unspecified(&giaddr)) { - /* Only addresses in local subnet supported for now. */ - return; - } - - ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); - if (ret < 0) { - /* Failed to obtain Client ID, ignore. */ - return; - } - - (void)dhcpv4_find_parameter_request_list_option(options, optlen, ¶ms); - - ret = dhcpv4_find_server_id_option(options, optlen, &server_id); - if (ret == 0) { - /* Server ID present, Request generated during SELECTING. */ - if (!net_ipv4_addr_cmp(&ctx->server_addr, &server_id)) { - /* Not for us, ignore. */ - return; - } - - ret = dhcpv4_find_requested_ip_option(options, optlen, - &requested_ip); - if (ret < 0) { - /* Requested IP missing, ignore. */ - return; - } - - if (!net_ipv4_is_addr_unspecified(&ciaddr)) { - /* ciaddr MUST be zero */ - return; - } - - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (net_ipv4_addr_cmp(&slot->addr, &requested_ip) && - slot->client_id.len == client_id.len && - memcmp(slot->client_id.buf, client_id.buf, - client_id.len) == 0 && - slot->state == DHCPV4_SERVER_ADDR_RESERVED) { - selected = slot; - break; - } - } - - if (selected == NULL) { - LOG_ERR("No valid slot found for DHCPv4 Request"); - } else { - uint32_t lease_time = dhcpv4_get_lease_time(options, optlen); - - if (dhcpv4_send_ack(ctx, msg, &selected->addr, lease_time, - ¶ms, false) < 0) { - return; - } - - LOG_DBG("DHCPv4 processing Request - allocated %s", - net_sprint_ipv4_addr(&selected->addr)); - - selected->lease_time = lease_time; - selected->expiry = sys_timepoint_calc( - K_SECONDS(lease_time)); - selected->state = DHCPV4_SERVER_ADDR_ALLOCATED; - dhcpv4_server_timeout_recalc(ctx); - } - - return; - } - - /* No server ID option - check requested address. */ - ret = dhcpv4_find_requested_ip_option(options, optlen, &requested_ip); - if (ret == 0) { - /* Requested IP present, Request generated during INIT-REBOOT. */ - if (!net_ipv4_is_addr_unspecified(&ciaddr)) { - /* ciaddr MUST be zero */ - return; - } - - if (!net_if_ipv4_addr_mask_cmp(ctx->iface, &requested_ip)) { - /* Wrong subnet. */ - dhcpv4_send_nak(ctx, msg); - } - - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (slot->client_id.len == client_id.len && - memcmp(slot->client_id.buf, client_id.buf, - client_id.len) == 0 && - (slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED)) { - selected = slot; - break; - } - } - - if (selected != NULL) { - if (net_ipv4_addr_cmp(&selected->addr, &requested_ip)) { - uint32_t lease_time = dhcpv4_get_lease_time( - options, optlen); - - if (dhcpv4_send_ack(ctx, msg, &selected->addr, - lease_time, ¶ms, - false) < 0) { - return; - } - - selected->lease_time = lease_time; - selected->expiry = sys_timepoint_calc( - K_SECONDS(lease_time)); - dhcpv4_server_timeout_recalc(ctx); - } else { - dhcpv4_send_nak(ctx, msg); - } - } - - /* No notion of the client, remain silent. */ - return; - } - - /* Neither server ID or requested IP set, Request generated during - * RENEWING or REBINDING. - */ - - if (!net_if_ipv4_addr_mask_cmp(ctx->iface, &ciaddr)) { - /* Wrong subnet. */ - dhcpv4_send_nak(ctx, msg); - } - - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (net_ipv4_addr_cmp(&slot->addr, &ciaddr)) { - selected = slot; - break; - } - } - - if (selected != NULL) { - if (selected->state == DHCPV4_SERVER_ADDR_ALLOCATED && - selected->client_id.len == client_id.len && - memcmp(selected->client_id.buf, client_id.buf, - client_id.len) == 0) { - uint32_t lease_time = dhcpv4_get_lease_time( - options, optlen); - - if (dhcpv4_send_ack(ctx, msg, &ciaddr, lease_time, - ¶ms, false) < 0) { - return; - } - - selected->lease_time = lease_time; - selected->expiry = sys_timepoint_calc( - K_SECONDS(lease_time)); - dhcpv4_server_timeout_recalc(ctx); - } else { - dhcpv4_send_nak(ctx, msg); - } - } -} - -static void dhcpv4_handle_decline(struct dhcpv4_server_ctx *ctx, - struct dhcp_msg *msg, uint8_t *options, - uint8_t optlen) -{ - struct dhcpv4_client_id client_id; - struct in_addr requested_ip, server_id; - int ret; - - ret = dhcpv4_find_server_id_option(options, optlen, &server_id); - if (ret < 0) { - /* No server ID, ignore. */ - return; - } - - if (!net_ipv4_addr_cmp(&ctx->server_addr, &server_id)) { - /* Not for us, ignore. */ - return; - } - - ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); - if (ret < 0) { - /* Failed to obtain Client ID, ignore. */ - return; - } - - ret = dhcpv4_find_requested_ip_option(options, optlen, - &requested_ip); - if (ret < 0) { - /* Requested IP missing, ignore. */ - return; - } - - LOG_ERR("Received DHCPv4 Decline for %s (address already in use)", - net_sprint_ipv4_addr(&requested_ip)); - - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (net_ipv4_addr_cmp(&slot->addr, &requested_ip) && - slot->client_id.len == client_id.len && - memcmp(slot->client_id.buf, client_id.buf, - client_id.len) == 0 && - (slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED)) { - slot->state = DHCPV4_SERVER_ADDR_DECLINED; - slot->expiry = sys_timepoint_calc(K_FOREVER); - dhcpv4_server_timeout_recalc(ctx); - break; - } - } -} - -static void dhcpv4_handle_release(struct dhcpv4_server_ctx *ctx, - struct dhcp_msg *msg, uint8_t *options, - uint8_t optlen) -{ - struct dhcpv4_client_id client_id; - struct in_addr ciaddr, server_id; - int ret; - - ret = dhcpv4_find_server_id_option(options, optlen, &server_id); - if (ret < 0) { - /* No server ID, ignore. */ - return; - } - - if (!net_ipv4_addr_cmp(&ctx->server_addr, &server_id)) { - /* Not for us, ignore. */ - return; - } - - ret = dhcpv4_get_client_id(msg, options, optlen, &client_id); - if (ret < 0) { - /* Failed to obtain Client ID, ignore. */ - return; - } - - memcpy(&ciaddr, msg->ciaddr, sizeof(ciaddr)); - - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (net_ipv4_addr_cmp(&slot->addr, &ciaddr) && - slot->client_id.len == client_id.len && - memcmp(slot->client_id.buf, client_id.buf, - client_id.len) == 0 && - (slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED)) { - LOG_DBG("DHCPv4 processing Release - %s", - net_sprint_ipv4_addr(&slot->addr)); - - slot->state = DHCPV4_SERVER_ADDR_FREE; - slot->expiry = sys_timepoint_calc(K_FOREVER); - dhcpv4_server_timeout_recalc(ctx); - break; - } - } -} - -static void dhcpv4_handle_inform(struct dhcpv4_server_ctx *ctx, - struct dhcp_msg *msg, uint8_t *options, - uint8_t optlen) -{ - struct dhcpv4_parameter_request_list params = { 0 }; - - (void)dhcpv4_find_parameter_request_list_option(options, optlen, ¶ms); - (void)dhcpv4_send_ack(ctx, msg, (struct in_addr *)msg->ciaddr, 0, - ¶ms, true); -} - -/* Server core. */ - -static void dhcpv4_server_timeout(struct k_work *work) -{ - struct k_work_delayable *dwork = k_work_delayable_from_work(work); - struct dhcpv4_server_ctx *ctx = - CONTAINER_OF(dwork, struct dhcpv4_server_ctx, timeout_work); - - - k_mutex_lock(&server_lock, K_FOREVER); - - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *slot = &ctx->addr_pool[i]; - - if (slot->state == DHCPV4_SERVER_ADDR_RESERVED || - slot->state == DHCPV4_SERVER_ADDR_ALLOCATED) { - if (sys_timepoint_expired(slot->expiry)) { - LOG_DBG("Address %s expired", - net_sprint_ipv4_addr(&slot->addr)); - slot->state = DHCPV4_SERVER_ADDR_FREE; - } - } - } - - dhcpv4_server_timeout_recalc(ctx); - - k_mutex_unlock(&server_lock); -} - -static void dhcpv4_process_data(struct dhcpv4_server_ctx *ctx, uint8_t *data, - size_t datalen) -{ - struct dhcp_msg *msg; - uint8_t msgtype; - int ret; - - if (datalen < sizeof(struct dhcp_msg)) { - LOG_DBG("DHCPv4 server malformed message"); - return; - } - - msg = (struct dhcp_msg *)data; - - if (msg->op != DHCPV4_MSG_BOOT_REQUEST) { - /* Silently drop messages other than BOOTREQUEST */ - return; - } - - data += sizeof(struct dhcp_msg); - datalen -= sizeof(struct dhcp_msg); - - /* Skip server hostname/filename/option cookie */ - if (datalen < (SIZE_OF_SNAME + SIZE_OF_FILE + SIZE_OF_MAGIC_COOKIE)) { - return; - } - - data += SIZE_OF_SNAME + SIZE_OF_FILE + SIZE_OF_MAGIC_COOKIE; - datalen -= SIZE_OF_SNAME + SIZE_OF_FILE + SIZE_OF_MAGIC_COOKIE; - - /* Search options for DHCP message type. */ - ret = dhcpv4_find_message_type_option(data, datalen, &msgtype); - if (ret < 0) { - LOG_ERR("No message type option"); - return; - } - - k_mutex_lock(&server_lock, K_FOREVER); - - switch (msgtype) { - case NET_DHCPV4_MSG_TYPE_DISCOVER: - dhcpv4_handle_discover(ctx, msg, data, datalen); - break; - case NET_DHCPV4_MSG_TYPE_REQUEST: - dhcpv4_handle_request(ctx, msg, data, datalen); - break; - case NET_DHCPV4_MSG_TYPE_DECLINE: - dhcpv4_handle_decline(ctx, msg, data, datalen); - break; - case NET_DHCPV4_MSG_TYPE_RELEASE: - dhcpv4_handle_release(ctx, msg, data, datalen); - break; - case NET_DHCPV4_MSG_TYPE_INFORM: - dhcpv4_handle_inform(ctx, msg, data, datalen); - break; - - case NET_DHCPV4_MSG_TYPE_OFFER: - case NET_DHCPV4_MSG_TYPE_ACK: - case NET_DHCPV4_MSG_TYPE_NAK: - default: - /* Ignore server initiated and unknown message types. */ - break; - } - - k_mutex_unlock(&server_lock); -} - -static void dhcpv4_server_cb(struct k_work *work) -{ - 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; - - for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { - if (server_ctx[i].sock == evt->event.fd) { - ctx = &server_ctx[i]; - break; - } - } - - if (ctx == NULL) { - LOG_ERR("No DHCPv4 server context found for given FD."); - return; - } - - if (evt->event.revents & ZSOCK_POLLERR) { - LOG_ERR("DHCPv4 server poll revents error"); - net_dhcpv4_server_stop(ctx->iface); - return; - } - - if (!(evt->event.revents & ZSOCK_POLLIN)) { - return; - } - - ret = zsock_recvfrom(evt->event.fd, recv_buf, sizeof(recv_buf), - ZSOCK_MSG_DONTWAIT, NULL, 0); - if (ret < 0) { - if (errno == EAGAIN) { - return; - } - - LOG_ERR("DHCPv4 server recv error, %d", errno); - net_dhcpv4_server_stop(ctx->iface); - return; - } - - dhcpv4_process_data(ctx, recv_buf, ret); -} - -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(dhcpv4_server, NULL, dhcpv4_server_cb, - CONFIG_NET_DHCPV4_SERVER_INSTANCES); - -int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr) -{ - struct sockaddr_in addr = { - .sin_family = AF_INET, - .sin_addr = INADDR_ANY_INIT, - .sin_port = htons(DHCPV4_SERVER_PORT), - }; - struct ifreq ifreq = { 0 }; - int ret, sock = -1, slot = -1; - const struct in_addr *server_addr; - struct in_addr netmask; - - if (iface == NULL || base_addr == NULL) { - return -EINVAL; - } - - if (!net_if_ipv4_addr_mask_cmp(iface, base_addr)) { - LOG_ERR("Address pool does not belong to the interface subnet."); - return -EINVAL; - } - - server_addr = net_if_ipv4_select_src_addr(iface, base_addr); - if (server_addr == NULL) { - LOG_ERR("Failed to obtain a valid server address."); - return -EINVAL; - } - - netmask = net_if_ipv4_get_netmask(iface); - if (net_ipv4_is_addr_unspecified(&netmask)) { - LOG_ERR("Failed to obtain subnet mask."); - return -EINVAL; - } - - k_mutex_lock(&server_lock, K_FOREVER); - - for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { - if (server_ctx[i].iface != NULL) { - if (server_ctx[i].iface == iface) { - LOG_ERR("DHCPv4 server instance already running."); - ret = -EALREADY; - goto error; - } - } else { - if (slot < 0) { - slot = i; - } - } - } - - if (slot < 0) { - LOG_ERR("No free DHCPv4 server intance."); - ret = -ENOMEM; - goto error; - } - - ret = net_if_get_name(iface, ifreq.ifr_name, sizeof(ifreq.ifr_name)); - if (ret < 0) { - LOG_ERR("Failed to obtain interface name."); - goto error; - } - - sock = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (sock < 0) { - ret = errno; - LOG_ERR("Failed to create DHCPv4 server socket, %d", ret); - goto error; - } - - ret = zsock_setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, &ifreq, - sizeof(ifreq)); - if (ret < 0) { - ret = errno; - LOG_ERR("Failed to bind DHCPv4 server socket with interface, %d", - ret); - goto error; - } - - ret = zsock_bind(sock, (struct sockaddr *)&addr, sizeof(addr)); - if (ret < 0) { - ret = errno; - LOG_ERR("Failed to bind DHCPv4 server socket, %d", ret); - goto error; - } - - fds[slot].fd = sock; - fds[slot].events = ZSOCK_POLLIN; - - server_ctx[slot].iface = iface; - server_ctx[slot].sock = sock; - server_ctx[slot].server_addr = *server_addr; - server_ctx[slot].netmask = netmask; - - k_work_init_delayable(&server_ctx[slot].timeout_work, - dhcpv4_server_timeout); - - LOG_DBG("Started DHCPv4 server, address pool:"); - for (int i = 0; i < ARRAY_SIZE(server_ctx[slot].addr_pool); i++) { - server_ctx[slot].addr_pool[i].state = DHCPV4_SERVER_ADDR_FREE; - server_ctx[slot].addr_pool[i].addr.s_addr = - htonl(ntohl(base_addr->s_addr) + i); - - LOG_DBG("\t%2d: %s", i, - net_sprint_ipv4_addr( - &server_ctx[slot].addr_pool[i].addr)); - } - - ret = net_socket_service_register(&dhcpv4_server, fds, ARRAY_SIZE(fds), - NULL); - if (ret < 0) { - LOG_ERR("Failed to register socket service, %d", ret); - memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); - fds[slot].fd = -1; - goto error; - } - - k_mutex_unlock(&server_lock); - - return 0; - -error: - if (sock >= 0) { - (void)zsock_close(sock); - } - - k_mutex_unlock(&server_lock); - - return ret; -} - -int net_dhcpv4_server_stop(struct net_if *iface) -{ - struct k_work_sync sync; - int slot = -1; - int ret = 0; - bool service_stop = true; - - if (iface == NULL) { - return -EINVAL; - } - - k_mutex_lock(&server_lock, K_FOREVER); - - for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { - if (server_ctx[i].iface == iface) { - slot = i; - break; - } - } - - if (slot < 0) { - ret = -ENOENT; - goto out; - } - - fds[slot].fd = -1; - (void)zsock_close(server_ctx[slot].sock); - - k_work_cancel_delayable_sync(&server_ctx[slot].timeout_work, &sync); - - memset(&server_ctx[slot], 0, sizeof(server_ctx[slot])); - - for (int i = 0; i < ARRAY_SIZE(fds); i++) { - if (fds[i].fd >= 0) { - service_stop = false; - break; - } - } - - if (service_stop) { - ret = net_socket_service_unregister(&dhcpv4_server); - } else { - ret = net_socket_service_register(&dhcpv4_server, fds, - ARRAY_SIZE(fds), NULL); - } - -out: - k_mutex_unlock(&server_lock); - - return ret; -} - -static void dhcpv4_server_foreach_lease_on_ctx(struct dhcpv4_server_ctx *ctx, - net_dhcpv4_lease_cb_t cb, - void *user_data) -{ - for (int i = 0; i < ARRAY_SIZE(ctx->addr_pool); i++) { - struct dhcpv4_addr_slot *addr = &ctx->addr_pool[i]; - - if (addr->state != DHCPV4_SERVER_ADDR_FREE) { - cb(ctx->iface, addr, user_data); - } - } -} - -int net_dhcpv4_server_foreach_lease(struct net_if *iface, - net_dhcpv4_lease_cb_t cb, - void *user_data) -{ - int slot = -1; - int ret = 0; - - k_mutex_lock(&server_lock, K_FOREVER); - - if (iface == NULL) { - for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { - if (server_ctx[i].iface != NULL) { - dhcpv4_server_foreach_lease_on_ctx( - &server_ctx[i], cb, user_data); - } - } - - return 0; - } - - for (int i = 0; i < ARRAY_SIZE(server_ctx); i++) { - if (server_ctx[i].iface == iface) { - slot = i; - break; - } - } - - if (slot < 0) { - ret = -ENOENT; - goto out; - } - - dhcpv4_server_foreach_lease_on_ctx(&server_ctx[slot], cb, user_data); - -out: - k_mutex_unlock(&server_lock); - - return ret; -} - -void net_dhcpv4_server_init(void) -{ - for (int i = 0; i < ARRAY_SIZE(fds); i++) { - fds[i].fd = -1; - } -} From c939769882b57ebe5acde346e8267c988ff2c23a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:51 +0100 Subject: [PATCH 1182/2300] Revert "[nrf fromtree] net: if: Add function to obtain IPv4 netmask" This reverts commit f86772e8d17df0b3f10c2dd05a87752e287f9300. Signed-off-by: Robert Lubos --- include/zephyr/net/net_if.h | 9 --------- subsys/net/ip/net_if.c | 21 --------------------- 2 files changed, 30 deletions(-) diff --git a/include/zephyr/net/net_if.h b/include/zephyr/net/net_if.h index f1e5be67cf7..788c3316391 100644 --- a/include/zephyr/net/net_if.h +++ b/include/zephyr/net/net_if.h @@ -2217,15 +2217,6 @@ struct in_addr *net_if_ipv4_get_ll(struct net_if *iface, struct in_addr *net_if_ipv4_get_global_addr(struct net_if *iface, enum net_addr_state addr_state); -/** - * @brief Get IPv4 netmask of an interface. - * - * @param iface Interface to use. - * - * @return The netmask set on the interface, unspecified address if not found. - */ -struct in_addr net_if_ipv4_get_netmask(struct net_if *iface); - /** * @brief Set IPv4 netmask for an interface. * diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 1a8199ad62c..00c9c74495d 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -3532,27 +3532,6 @@ static inline int z_vrfy_net_if_ipv4_addr_lookup_by_index( #include #endif -struct in_addr net_if_ipv4_get_netmask(struct net_if *iface) -{ - struct in_addr netmask = { 0 }; - - net_if_lock(iface); - - if (net_if_config_ipv4_get(iface, NULL) < 0) { - goto out; - } - - if (!iface->config.ip.ipv4) { - goto out; - } - - netmask = iface->config.ip.ipv4->netmask; -out: - net_if_unlock(iface); - - return netmask; -} - void net_if_ipv4_set_netmask(struct net_if *iface, const struct in_addr *netmask) { From 291c70367b52647ee0a420dd1efa0dd4bd459d49 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:51 +0100 Subject: [PATCH 1183/2300] Revert "[nrf fromtree] net: arp: Make arp_update() function externally visible" This reverts commit 5176be65e79dc4a337e1230adbbfb424ed58b91c. Signed-off-by: Robert Lubos --- subsys/net/l2/ethernet/arp.c | 34 +++++++++++++++++----------------- subsys/net/l2/ethernet/arp.h | 4 ---- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index 6be7255b19b..39a06ed64a0 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -457,11 +457,11 @@ static void arp_gratuitous(struct net_if *iface, } } -void net_arp_update(struct net_if *iface, - struct in_addr *src, - struct net_eth_addr *hwaddr, - bool gratuitous, - bool force) +static void arp_update(struct net_if *iface, + struct in_addr *src, + struct net_eth_addr *hwaddr, + bool gratuitous, + bool force) { struct arp_entry *entry; struct net_pkt *pkt; @@ -647,10 +647,10 @@ enum net_verdict net_arp_input(struct net_pkt *pkt, /* If the IP address is in our cache, * then update it here. */ - net_arp_update(net_pkt_iface(pkt), - (struct in_addr *)arp_hdr->src_ipaddr, - &arp_hdr->src_hwaddr, - true, false); + arp_update(net_pkt_iface(pkt), + (struct in_addr *)arp_hdr->src_ipaddr, + &arp_hdr->src_hwaddr, + true, false); break; } } @@ -689,10 +689,10 @@ enum net_verdict net_arp_input(struct net_pkt *pkt, net_sprint_ll_addr((uint8_t *)&arp_hdr->src_hwaddr, arp_hdr->hwlen)); - net_arp_update(net_pkt_iface(pkt), - (struct in_addr *)arp_hdr->src_ipaddr, - &arp_hdr->src_hwaddr, - false, true); + arp_update(net_pkt_iface(pkt), + (struct in_addr *)arp_hdr->src_ipaddr, + &arp_hdr->src_hwaddr, + false, true); dst_hw_addr = &arp_hdr->src_hwaddr; } else { @@ -711,10 +711,10 @@ enum net_verdict net_arp_input(struct net_pkt *pkt, case NET_ARP_REPLY: if (net_ipv4_is_my_addr((struct in_addr *)arp_hdr->dst_ipaddr)) { - net_arp_update(net_pkt_iface(pkt), - (struct in_addr *)arp_hdr->src_ipaddr, - &arp_hdr->src_hwaddr, - false, false); + arp_update(net_pkt_iface(pkt), + (struct in_addr *)arp_hdr->src_ipaddr, + &arp_hdr->src_hwaddr, + false, false); } break; diff --git a/subsys/net/l2/ethernet/arp.h b/subsys/net/l2/ethernet/arp.h index 46589cbc1f7..28cafe5f20a 100644 --- a/subsys/net/l2/ethernet/arp.h +++ b/subsys/net/l2/ethernet/arp.h @@ -67,9 +67,6 @@ int net_arp_foreach(net_arp_cb_t cb, void *user_data); void net_arp_clear_cache(struct net_if *iface); void net_arp_init(void); -void net_arp_update(struct net_if *iface, struct in_addr *src, - struct net_eth_addr *hwaddr, bool gratuitous, - bool force); /** * @} @@ -86,7 +83,6 @@ void net_arp_update(struct net_if *iface, struct in_addr *src, #define net_arp_foreach(...) 0 #define net_arp_init(...) #define net_arp_clear_pending(...) 0 -#define net_arp_update(...) #endif /* CONFIG_NET_ARP */ From c7ea27c738547e2739d8237780eb300cf58571f4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:51 +0100 Subject: [PATCH 1184/2300] Revert "[nrf fromtree] net: socket_service: Fix iterable section location" This reverts commit 406215a9b428a41655ef8da9155c48be0bc05ff1. Signed-off-by: Robert Lubos --- include/zephyr/linker/common-rom/common-rom-net.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/linker/common-rom/common-rom-net.ld b/include/zephyr/linker/common-rom/common-rom-net.ld index 2aa46dfecf5..18360212edc 100644 --- a/include/zephyr/linker/common-rom/common-rom-net.ld +++ b/include/zephyr/linker/common-rom/common-rom-net.ld @@ -23,5 +23,5 @@ #endif #if defined(CONFIG_NET_SOCKETS_SERVICE) - ITERABLE_SECTION_ROM(net_socket_service_desc, 4) + ITERABLE_SECTION_RAM(net_socket_service_desc, 4) #endif From 2c9c67a95c47a3558d8e68a1ec1af3532935368c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:51 +0100 Subject: [PATCH 1185/2300] Revert "[nrf fromtree] net: socket_service: Add underscore in the idx variable name" This reverts commit daa00eee818d73744503e02f3836b6b88838314b. Signed-off-by: Robert Lubos --- include/zephyr/net/socket_service.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/net/socket_service.h b/include/zephyr/net/socket_service.h index a4e21f00a33..16da94d238b 100644 --- a/include/zephyr/net/socket_service.h +++ b/include/zephyr/net/socket_service.h @@ -76,7 +76,7 @@ struct net_socket_service_desc { }; #define __z_net_socket_svc_get_name(_svc_id) __z_net_socket_service_##_svc_id -#define __z_net_socket_svc_get_idx(_svc_id) __z_net_socket_service_idx_##_svc_id +#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); From 3038557896e9bcfebbaee6160624f18216a2a780 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:51 +0100 Subject: [PATCH 1186/2300] Revert "[nrf fromtree] net: sockets: Create a socket service API" This reverts commit a2ab348e978d61aa41cb6385732f3a2bfb9c1c60. Signed-off-by: Robert Lubos --- .../linker/common-rom/common-rom-net.ld | 4 - include/zephyr/net/socket_service.h | 246 --------------- subsys/net/lib/sockets/CMakeLists.txt | 1 - subsys/net/lib/sockets/Kconfig | 25 -- subsys/net/lib/sockets/sockets_service.c | 291 ------------------ 5 files changed, 567 deletions(-) delete mode 100644 include/zephyr/net/socket_service.h delete mode 100644 subsys/net/lib/sockets/sockets_service.c diff --git a/include/zephyr/linker/common-rom/common-rom-net.ld b/include/zephyr/linker/common-rom/common-rom-net.ld index 18360212edc..71c1c1e089f 100644 --- a/include/zephyr/linker/common-rom/common-rom-net.ld +++ b/include/zephyr/linker/common-rom/common-rom-net.ld @@ -21,7 +21,3 @@ #if defined(CONFIG_COAP_SERVER) ITERABLE_SECTION_ROM(coap_service, 4) #endif - -#if defined(CONFIG_NET_SOCKETS_SERVICE) - ITERABLE_SECTION_RAM(net_socket_service_desc, 4) -#endif diff --git a/include/zephyr/net/socket_service.h b/include/zephyr/net/socket_service.h deleted file mode 100644 index 16da94d238b..00000000000 --- a/include/zephyr/net/socket_service.h +++ /dev/null @@ -1,246 +0,0 @@ -/** - * @file - * @brief BSD Socket service API - * - * API can be used to install a k_work that is called - * if there is data received to a socket. - */ - -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_NET_SOCKET_SERVICE_H_ -#define ZEPHYR_INCLUDE_NET_SOCKET_SERVICE_H_ - -/** - * @brief BSD socket service API - * @defgroup bsd_socket_service BSD socket service API - * @ingroup networking - * @{ - */ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * 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; - /** Socket information that triggered this event. */ - struct zsock_pollfd event; - /** User data */ - void *user_data; - /** Service back pointer */ - struct net_socket_service_desc *svc; -}; - -/** - * Main structure holding socket service configuration information. - * The k_work item is created so that when there is data coming - * to those fds, the k_work callback is then called. - * The workqueue can be set NULL in which case system workqueue is used. - * The service descriptor should be created at built time, and then used - * as a parameter to register the sockets to be monitored. - * User should create needed sockets and then setup the poll struct and - * then register the sockets to be monitored at runtime. - */ -struct net_socket_service_desc { -#if CONFIG_NET_SOCKETS_LOG_LEVEL >= LOG_LEVEL_DBG - /** - * Owner name. This can be used in debugging to see who has - * registered this service. - */ - 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. */ - int pev_len; - /** Where are my pollfd entries in the global list */ - int *idx; -}; - -#define __z_net_socket_svc_get_name(_svc_id) __z_net_socket_service_##_svc_id -#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 -#define NET_SOCKET_SERVICE_OWNER -#endif - -#define NET_SOCKET_SERVICE_CALLBACK_MODE(_flag) \ - IF_ENABLED(_flag, \ - (.work = Z_WORK_INITIALIZER(net_socket_service_callback),)) - -#define __z_net_socket_service_define(_name, _work_q, _cb, _count, _async, ...) \ - static int __z_net_socket_svc_get_idx(_name); \ - static struct net_socket_service_event \ - __z_net_socket_svc_get_name(_name)[_count] = { \ - [0 ... ((_count) - 1)] = { \ - .event.fd = -1, /* Invalid socket */ \ - NET_SOCKET_SERVICE_CALLBACK_MODE(_async) \ - .callback = _cb, \ - } \ - }; \ - 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), \ - } - -/** - * @brief Statically define a network socket service. - * The user callback is called asynchronously for this service meaning that - * the service API will not wait until the user callback returns before continuing - * with next socket service. - * - * The socket service can be accessed outside the module where it is defined using: - * - * @code extern struct net_socket_service_desc ; @endcode - * - * @note This macro cannot be used together with a static keyword. - * If such a use-case is desired, use NET_SOCKET_SERVICE_ASYNC_DEFINE_STATIC - * 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_ASYNC_DEFINE(name, work_q, cb, count) \ - __z_net_socket_service_define(name, work_q, cb, count, 1) - -/** - * @brief Statically define a network socket service in a private (static) scope. - * The user callback is called asynchronously for this service meaning that - * the service API will not wait until the user callback returns before continuing - * 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_ASYNC_DEFINE_STATIC(name, work_q, cb, count) \ - __z_net_socket_service_define(name, work_q, cb, count, 1, static) - -/** - * @brief Statically define a network socket service. - * The user callback is called synchronously for this service meaning that - * the service API will wait until the user callback returns before continuing - * with next socket service. - * - * The socket service can be accessed outside the module where it is defined using: - * - * @code extern struct net_socket_service_desc ; @endcode - * - * @note This macro cannot be used together with a static keyword. - * If such a use-case is desired, use NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC - * 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, 0) - -/** - * @brief Statically define a network socket service in a private (static) scope. - * The user callback is called synchronously for this service meaning that - * the service API will wait until the user callback returns before continuing - * 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, 0, static) - -/** - * @brief Register pollable sockets. - * - * @param service Pointer to a service description. - * @param fds Socket array to poll. - * @param len Length of the socket array. - * @param user_data User specific data. - * - * @retval 0 No error - * @retval -ENOENT Service is not found. - * @retval -ENINVAL Invalid parameter. - */ -__syscall int net_socket_service_register(const struct net_socket_service_desc *service, - struct zsock_pollfd *fds, int len, void *user_data); - -/** - * @brief Unregister pollable sockets. - * - * @param service Pointer to a service description. - * - * @retval 0 No error - * @retval -ENOENT Service is not found. - * @retval -ENINVAL Invalid parameter. - */ -static inline int net_socket_service_unregister(const struct net_socket_service_desc *service) -{ - return net_socket_service_register(service, NULL, 0, NULL); -} - -/** - * @typedef net_socket_service_cb_t - * @brief Callback used while iterating over socket services. - * - * @param svc Pointer to current socket service. - * @param user_data A valid pointer to user data or NULL - */ -typedef void (*net_socket_service_cb_t)(const struct net_socket_service_desc *svc, - void *user_data); - -/** - * @brief Go through all the socket services and call callback for each service. - * - * @param cb User-supplied callback function to call - * @param user_data User specified data - */ -void net_socket_service_foreach(net_socket_service_cb_t cb, void *user_data); - -#ifdef __cplusplus -} -#endif - -#include - -/** - * @} - */ - -#endif /* ZEPHYR_INCLUDE_NET_SOCKET_SERVICE_H_ */ diff --git a/subsys/net/lib/sockets/CMakeLists.txt b/subsys/net/lib/sockets/CMakeLists.txt index 253cb4a182f..7ffd6dc476b 100644 --- a/subsys/net/lib/sockets/CMakeLists.txt +++ b/subsys/net/lib/sockets/CMakeLists.txt @@ -26,7 +26,6 @@ zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_SOCKOPT_TLS sockets_tls.c zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_OFFLOAD socket_offload.c) zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_OFFLOAD_DISPATCHER socket_dispatcher.c) zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_OBJ_CORE socket_obj_core.c) -zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_SERVICE sockets_service.c) if(CONFIG_NET_SOCKETS_NET_MGMT) zephyr_library_sources(sockets_net_mgmt.c) diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 40d86b9498f..b2da30c1e48 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -73,31 +73,6 @@ config NET_SOCKET_MAX_SEND_WAIT The maximum time a socket is waiting for a blocked connection before returning an ENOBUFS error. -config NET_SOCKETS_SERVICE - bool "Socket service support [EXPERIMENTAL]" - select EXPERIMENTAL - select EVENTFD - help - 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 - 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. - -config NET_SOCKETS_SERVICE_STACK_SIZE - int "Stack size for the thread handling socket services" - default 1200 - depends on NET_SOCKETS_SERVICE - help - Set the internal stack size for the thread that polls sockets. - -config NET_SOCKETS_SERVICE_INIT_PRIO - int "Startup priority for the network socket service" - default 95 - depends on NET_SOCKETS_SERVICE - config NET_SOCKETS_SOCKOPT_TLS bool "TCP TLS socket option support [EXPERIMENTAL]" imply TLS_CREDENTIALS diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c deleted file mode 100644 index d253ece629c..00000000000 --- a/subsys/net/lib/sockets/sockets_service.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -LOG_MODULE_REGISTER(net_sock_svc, CONFIG_NET_SOCKETS_LOG_LEVEL); - -#include -#include -#include - -static int init_socket_service(void); -static bool init_done; - -static K_MUTEX_DEFINE(lock); -static K_CONDVAR_DEFINE(wait_start); - -STRUCT_SECTION_START_EXTERN(net_socket_service_desc); -STRUCT_SECTION_END_EXTERN(net_socket_service_desc); - -static struct service { - /* The +1 is for triggering events from register function */ - struct zsock_pollfd events[1 + CONFIG_NET_SOCKETS_POLL_MAX]; - int count; -} ctx; - -#define get_idx(svc) (*(svc->idx)) - -void net_socket_service_foreach(net_socket_service_cb_t cb, void *user_data) -{ - STRUCT_SECTION_FOREACH(net_socket_service_desc, svc) { - cb(svc, user_data); - } -} - -static void cleanup_svc_events(const struct net_socket_service_desc *svc) -{ - for (int i = 0; i < svc->pev_len; i++) { - ctx.events[get_idx(svc) + i].fd = -1; - svc->pev[i].event.fd = -1; - svc->pev[i].event.events = 0; - } -} - -int z_impl_net_socket_service_register(const struct net_socket_service_desc *svc, - struct zsock_pollfd *fds, int len, - void *user_data) -{ - int i, ret = -ENOENT; - - k_mutex_lock(&lock, K_FOREVER); - - if (!init_done) { - (void)k_condvar_wait(&wait_start, &lock, K_FOREVER); - } - - if (STRUCT_SECTION_START(net_socket_service_desc) > svc || - STRUCT_SECTION_END(net_socket_service_desc) <= svc) { - goto out; - } - - if (fds == NULL) { - cleanup_svc_events(svc); - } else { - if (len > svc->pev_len) { - NET_DBG("Too many file descriptors, " - "max is %d for service %p", - svc->pev_len, svc); - ret = -ENOMEM; - goto out; - } - - for (i = 0; i < len; i++) { - svc->pev[i].event = fds[i]; - svc->pev[i].user_data = user_data; - } - - for (i = 0; i < svc->pev_len; i++) { - ctx.events[get_idx(svc) + i] = svc->pev[i].event; - } - } - - /* Tell the thread to re-read the variables */ - eventfd_write(ctx.events[0].fd, 1); - ret = 0; - -out: - k_mutex_unlock(&lock); - - return ret; -} - -static struct net_socket_service_desc *find_svc_and_event( - struct zsock_pollfd *pev, - struct net_socket_service_event **event) -{ - STRUCT_SECTION_FOREACH(net_socket_service_desc, svc) { - for (int i = 0; i < svc->pev_len; i++) { - if (svc->pev[i].event.fd == pev->fd) { - *event = &svc->pev[i]; - return svc; - } - } - } - - return NULL; -} - -/* We do not set the user callback to our work struct because we need to - * hook into the flow and restore the global poll array so that the next poll - * 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) -{ - 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; - - ev.callback(&ev.work); - - /* Copy back the socket fd to the global array because we marked - * it as -1 when triggering the work. - */ - for (int i = 0; i < svc->pev_len; i++) { - ctx.events[get_idx(svc) + i] = svc->pev[i].event; - } -} - -static int call_work(struct zsock_pollfd *pev, struct k_work_q *work_q, - struct k_work *work) -{ - int ret = 0; - - /* Mark the global fd non pollable so that we do not - * call the callback second time. - */ - pev->fd = -1; - - if (work->handler == NULL) { - /* Synchronous call */ - net_socket_service_callback(work); - } else { - if (work_q != NULL) { - ret = k_work_submit_to_queue(work_q, work); - } else { - ret = k_work_submit(work); - } - - k_yield(); - } - - return ret; - -} - -static int trigger_work(struct zsock_pollfd *pev) -{ - struct net_socket_service_event *event; - struct net_socket_service_desc *svc; - - svc = find_svc_and_event(pev, &event); - if (svc == NULL) { - return -ENOENT; - } - - event->svc = svc; - - /* Copy the triggered event to our event so that we know what - * was actually causing the event. - */ - event->event = *pev; - - return call_work(pev, svc->work_q, &event->work); -} - -static void socket_service_thread(void) -{ - int ret, i, fd, count = 0; - eventfd_t value; - - STRUCT_SECTION_COUNT(net_socket_service_desc, &ret); - if (ret == 0) { - NET_INFO("No socket services found, service disabled."); - goto fail; - } - - /* Create contiguous poll event array to enable socket polling */ - STRUCT_SECTION_FOREACH(net_socket_service_desc, svc) { - get_idx(svc) = count + 1; - count += svc->pev_len; - } - - if ((count + 1) > ARRAY_SIZE(ctx.events)) { - NET_WARN("You have %d services to monitor but " - "%d poll entries configured.", - count + 1, ARRAY_SIZE(ctx.events)); - NET_WARN("Consider increasing value of %s to %d", - "CONFIG_NET_SOCKETS_POLL_MAX", count + 1); - } - - NET_DBG("Monitoring %d socket entries", count); - - ctx.count = count + 1; - - /* Create an eventfd that can be used to trigger events during polling */ - fd = eventfd(0, 0); - if (fd < 0) { - fd = -errno; - NET_ERR("eventfd failed (%d)", fd); - goto out; - } - - init_done = true; - k_condvar_broadcast(&wait_start); - - ctx.events[0].fd = fd; - ctx.events[0].events = ZSOCK_POLLIN; - -restart: - i = 1; - - k_mutex_lock(&lock, K_FOREVER); - - /* Copy individual events to the big array */ - STRUCT_SECTION_FOREACH(net_socket_service_desc, svc) { - for (int j = 0; j < svc->pev_len; j++) { - ctx.events[get_idx(svc) + j] = svc->pev[j].event; - } - } - - k_mutex_unlock(&lock); - - while (true) { - ret = zsock_poll(ctx.events, count + 1, -1); - if (ret < 0) { - ret = -errno; - NET_ERR("poll failed (%d)", ret); - goto out; - } - - if (ret == 0) { - /* should not happen because timeout is -1 */ - break; - } - - if (ret > 0 && ctx.events[0].revents) { - eventfd_read(ctx.events[0].fd, &value); - NET_DBG("Received restart event."); - goto restart; - } - - for (i = 1; i < (count + 1); i++) { - if (ctx.events[i].fd < 0) { - continue; - } - - if (ctx.events[i].revents > 0) { - ret = trigger_work(&ctx.events[i]); - if (ret < 0) { - NET_DBG("Triggering work failed (%d)", ret); - } - } - } - } - -out: - NET_DBG("Socket service thread stopped"); - init_done = false; - - return; - -fail: - k_condvar_broadcast(&wait_start); -} - -K_THREAD_DEFINE(socket_service_monitor, CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE, - socket_service_thread, NULL, NULL, NULL, - K_LOWEST_APPLICATION_THREAD_PRIO, 0, 0); - -static int init_socket_service(void) -{ - k_thread_name_set(socket_service_monitor, "net_socket_service"); - - return 0; -} - -SYS_INIT(init_socket_service, APPLICATION, CONFIG_NET_SOCKETS_SERVICE_INIT_PRIO); From 8a62c28a6a76c4398bf96c54cbf5c71332b956e7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:51 +0100 Subject: [PATCH 1187/2300] Revert "[nrf fromtree] net: Move trickle files to lib" This reverts commit 8dd6ce3b6a701c9e1c2f6a5b2a28b1a1d50d93c5. Signed-off-by: Robert Lubos --- subsys/net/ip/CMakeLists.txt | 1 + subsys/net/ip/Kconfig | 14 ++++++++++++++ subsys/net/{lib/trickle => ip}/trickle.c | 0 subsys/net/lib/CMakeLists.txt | 1 - subsys/net/lib/Kconfig | 2 -- subsys/net/lib/trickle/CMakeLists.txt | 7 ------- subsys/net/lib/trickle/Kconfig | 18 ------------------ 7 files changed, 15 insertions(+), 28 deletions(-) rename subsys/net/{lib/trickle => ip}/trickle.c (100%) delete mode 100644 subsys/net/lib/trickle/CMakeLists.txt delete mode 100644 subsys/net/lib/trickle/Kconfig diff --git a/subsys/net/ip/CMakeLists.txt b/subsys/net/ip/CMakeLists.txt index 3a93e5020d4..b9493b894a7 100644 --- a/subsys/net/ip/CMakeLists.txt +++ b/subsys/net/ip/CMakeLists.txt @@ -45,6 +45,7 @@ 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) zephyr_library_sources_ifdef(CONFIG_NET_TEST_PROTOCOL tp.c) +zephyr_library_sources_ifdef(CONFIG_NET_TRICKLE trickle.c) zephyr_library_sources_ifdef(CONFIG_NET_UDP udp.c) zephyr_library_sources_ifdef(CONFIG_NET_PROMISCUOUS_MODE promiscuous.c) diff --git a/subsys/net/ip/Kconfig b/subsys/net/ip/Kconfig index a5a6b7ba01e..fffa028b628 100644 --- a/subsys/net/ip/Kconfig +++ b/subsys/net/ip/Kconfig @@ -758,6 +758,20 @@ config NET_SLIP_TAP communicate via the SLIP driver. See net-tools project at https://github.com/zephyrproject-rtos/net-tools for more details. +config NET_TRICKLE + bool "Trickle library" + help + Normally this is enabled automatically if needed, + so say 'n' if unsure. + +if NET_TRICKLE +module = NET_TRICKLE +module-dep = NET_LOG +module-str = Log level for Trickle algorithm +module-help = Enables Trickle library output debug messages +source "subsys/net/Kconfig.template.log_config.net" +endif # NET_TRICKLE + endif # NET_RAW_MODE config NET_PKT_RX_COUNT diff --git a/subsys/net/lib/trickle/trickle.c b/subsys/net/ip/trickle.c similarity index 100% rename from subsys/net/lib/trickle/trickle.c rename to subsys/net/ip/trickle.c diff --git a/subsys/net/lib/CMakeLists.txt b/subsys/net/lib/CMakeLists.txt index 5e4eae7e028..756adb41341 100644 --- a/subsys/net/lib/CMakeLists.txt +++ b/subsys/net/lib/CMakeLists.txt @@ -14,7 +14,6 @@ add_subdirectory_ifdef(CONFIG_TLS_CREDENTIALS tls_credentials) add_subdirectory_ifdef(CONFIG_NET_CAPTURE capture) add_subdirectory_ifdef(CONFIG_NET_ZPERF zperf) add_subdirectory_ifdef(CONFIG_NET_SHELL shell) -add_subdirectory_ifdef(CONFIG_NET_TRICKLE trickle) if (CONFIG_DNS_RESOLVER OR CONFIG_MDNS_RESPONDER diff --git a/subsys/net/lib/Kconfig b/subsys/net/lib/Kconfig index b70105d5f9b..5df4a445885 100644 --- a/subsys/net/lib/Kconfig +++ b/subsys/net/lib/Kconfig @@ -39,8 +39,6 @@ menu "Network additional services" source "subsys/net/lib/capture/Kconfig" -source "subsys/net/lib/trickle/Kconfig" - source "subsys/net/lib/zperf/Kconfig" endmenu diff --git a/subsys/net/lib/trickle/CMakeLists.txt b/subsys/net/lib/trickle/CMakeLists.txt deleted file mode 100644 index b9cf222aab5..00000000000 --- a/subsys/net/lib/trickle/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() - -zephyr_library_sources( - trickle.c - ) diff --git a/subsys/net/lib/trickle/Kconfig b/subsys/net/lib/trickle/Kconfig deleted file mode 100644 index edc4f8fcf56..00000000000 --- a/subsys/net/lib/trickle/Kconfig +++ /dev/null @@ -1,18 +0,0 @@ -# Trickle Library for Zephyr - -# Copyright (c) 2016 Intel Corporation. -# SPDX-License-Identifier: Apache-2.0 - -config NET_TRICKLE - bool "Trickle library" - help - Normally this is enabled automatically if needed, - so say 'n' if unsure. - -if NET_TRICKLE -module = NET_TRICKLE -module-dep = NET_LOG -module-str = Log level for Trickle algorithm -module-help = Enables Trickle library output debug messages -source "subsys/net/Kconfig.template.log_config.net" -endif # NET_TRICKLE From 53b05113b94f64e3c6a5cbd929401b981027e47c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:52 +0100 Subject: [PATCH 1188/2300] Revert "[nrf fromtree] Bluetooth: ISO: Fix CIS peripheral disconnection during setup" This reverts commit f37612f347798bdfb8242a2a13744922105d21e2. Signed-off-by: Robert Lubos --- subsys/bluetooth/host/iso.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index 4d6366ead67..42e9c877a9a 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -1117,8 +1117,7 @@ void hci_le_cis_established(struct net_buf *buf) bt_conn_set_state(iso, BT_CONN_CONNECTED); bt_conn_unref(iso); return; - } else if (iso->role == BT_HCI_ROLE_PERIPHERAL || - evt->status != BT_HCI_ERR_OP_CANCELLED_BY_HOST) { + } else if (evt->status != BT_HCI_ERR_OP_CANCELLED_BY_HOST) { iso->err = evt->status; bt_iso_disconnected(iso); } /* else we wait for disconnect event */ From de50f932c8307d4f284d519d6277a949fb3f5790 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:52 +0100 Subject: [PATCH 1189/2300] Revert "[nrf fromtree] boards nrf5340bsim_cpuapp: Select approprite 802154 radio in DT" This reverts commit 6e1e41298a25ef3c0e518e671013ebb6baf20d02. Signed-off-by: Robert Lubos --- boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts b/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts index c5ec3c95af5..a7c3d39ace5 100644 --- a/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts +++ b/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts @@ -49,7 +49,6 @@ zephyr,flash = &flash0; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; - zephyr,ieee802154 = &ieee802154; }; soc { From 89898a6c3e18cd7f9f46c271dc2b5232c7aebb40 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:52 +0100 Subject: [PATCH 1190/2300] Revert "[nrf fromtree] manifest: Update nrf hw models to latest" This reverts commit ff0f17ada73b2fa470871e04ea4042bb7e35070f. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 6249674c9c1..44967d775e7 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 9b985ea6bc237b6ae06f48eb228f2ac7f6e3b96b + revision: a715dcc179f1a71f51c574165958b72fe932ae3f path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 From e530915416ff25128c370843d66585ca35e46d16 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:52 +0100 Subject: [PATCH 1191/2300] Revert "[nrf fromtree] boards nrf5340bsim_cpuapp: Define chosen entropy source" This reverts commit ab7ad7ce7d258d307123baed62332e332656ba6d. Signed-off-by: Robert Lubos --- boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts b/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts index a7c3d39ace5..36cbf9691b3 100644 --- a/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts +++ b/boards/posix/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts @@ -45,7 +45,6 @@ }; chosen { - zephyr,entropy = &rng_hci; zephyr,flash = &flash0; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; From f245400e8030410dee89eea6cf3e691a055837c3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:52 +0100 Subject: [PATCH 1192/2300] Revert "[nrf fromtree] net: wifi_shell: Add help for maximum channels in scan" This reverts commit 65ff791bf0cbd49132d819c9ae8fde6c2554fd63. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1f13ae864ae..1e1ab4a3724 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1905,7 +1905,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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" + "[-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\n" "[-h, --help] : Print out the help for the scan command.\n", cmd_wifi_scan, 1, 8), From 75e694fb6493ffc396138b3d1b7aff74a718964a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:53 +0100 Subject: [PATCH 1193/2300] Revert "[nrf fromtree] net: wifi_shell: Add example of scan option" This reverts commit b99ed41c94807c6a95e6cc40f7ed7bdfa18e00af. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1e1ab4a3724..d3f573a28d6 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1905,7 +1905,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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\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\n" "[-h, --help] : Print out the help for the scan command.\n", cmd_wifi_scan, 1, 8), From da0da1eea3932de6e5417e60a742ddf968a535a7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:53 +0100 Subject: [PATCH 1194/2300] Revert "[nrf fromtree] net: wifi_shell: Update scan argument shell" This reverts commit 3ac1de52fbe95ccbbad8fe8c6568a05d649e5d9f. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d3f573a28d6..f470e700f8c 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1903,9 +1903,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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" + "[-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\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-11,14_5:36,149-165,44\n" "[-h, --help] : Print out the help for the scan command.\n", cmd_wifi_scan, 1, 8), From 5e28167a44672b507413c19f329a630a17e6755f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:53 +0100 Subject: [PATCH 1195/2300] Revert "[nrf fromtree] net: wifi_utils: Fix max channels allow for scan" This reverts commit fd31aa1338a58288873062b548a61fbc93931ecf. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_utils.c b/subsys/net/l2/wifi/wifi_utils.c index bd47205e4f9..76e93fc33e0 100644 --- a/subsys/net/l2/wifi/wifi_utils.c +++ b/subsys/net/l2/wifi/wifi_utils.c @@ -368,7 +368,7 @@ int wifi_utils_parse_scan_chan(char *scan_chan_str, memset(chan_str, 0, sizeof(chan_str)); if (chan_start) { - if ((chan_idx + (chan_val - chan_start)) > max_channels) { + if ((chan_idx + (chan_val - chan_start)) >= max_channels) { NET_ERR("Too many channels specified (%d)", max_channels); return -EINVAL; } From 48cd38b9ff2338d5769e5501c065eedb81dda673 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:53 +0100 Subject: [PATCH 1196/2300] Revert "[nrf fromtree] boards: arm: add nrf9151dk_nrf9151" This reverts commit 6a26f6b51450f09eab0e02c33fb8a40705d470b8. Signed-off-by: Robert Lubos --- boards/arm/nrf9151dk_nrf9151/Kconfig.board | 14 - .../arm/nrf9151dk_nrf9151/Kconfig.defconfig | 47 --- boards/arm/nrf9151dk_nrf9151/board.cmake | 14 - boards/arm/nrf9151dk_nrf9151/doc/index.rst | 203 ------------- .../nordic,nrf9151dk-nrf5340-reset.yaml | 18 -- .../dts/nrf9151dk_buttons_on_io_expander.dtsi | 25 -- .../dts/nrf9151dk_leds_on_io_expander.dtsi | 25 -- .../nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts | 19 -- .../nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml | 22 -- .../nrf9151dk_nrf9151_common-pinctrl.dtsi | 96 ------- .../nrf9151dk_nrf9151_common.dtsi | 268 ------------------ .../nrf9151dk_nrf9151_defconfig | 24 -- .../nrf9151dk_nrf9151_ns.dts | 22 -- .../nrf9151dk_nrf9151_ns.yaml | 20 -- .../nrf9151dk_nrf9151_ns_defconfig | 27 -- .../nrf9151dk_nrf9151_partition_conf.dtsi | 60 ---- .../arm/nrf9151dk_nrf9151/pre_dt_board.cmake | 7 - 17 files changed, 911 deletions(-) delete mode 100644 boards/arm/nrf9151dk_nrf9151/Kconfig.board delete mode 100644 boards/arm/nrf9151dk_nrf9151/Kconfig.defconfig delete mode 100644 boards/arm/nrf9151dk_nrf9151/board.cmake delete mode 100644 boards/arm/nrf9151dk_nrf9151/doc/index.rst delete mode 100644 boards/arm/nrf9151dk_nrf9151/dts/bindings/nordic,nrf9151dk-nrf5340-reset.yaml delete mode 100644 boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_buttons_on_io_expander.dtsi delete mode 100644 boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_leds_on_io_expander.dtsi delete mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts delete mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml delete mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common-pinctrl.dtsi delete mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi delete mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_defconfig delete mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.dts delete mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.yaml delete mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns_defconfig delete mode 100644 boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_partition_conf.dtsi delete mode 100644 boards/arm/nrf9151dk_nrf9151/pre_dt_board.cmake diff --git a/boards/arm/nrf9151dk_nrf9151/Kconfig.board b/boards/arm/nrf9151dk_nrf9151/Kconfig.board deleted file mode 100644 index 92352ddc16f..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/Kconfig.board +++ /dev/null @@ -1,14 +0,0 @@ -# nRF9151 DK NRF9151 board configuration - -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF9151_LACA - -config BOARD_NRF9151DK_NRF9151 - bool "nRF9151 DK NRF9151" - -config BOARD_NRF9151DK_NRF9151_NS - bool "nRF9151 DK NRF9151 non-secure" - -endif # SOC_NRF9151_LACA diff --git a/boards/arm/nrf9151dk_nrf9151/Kconfig.defconfig b/boards/arm/nrf9151dk_nrf9151/Kconfig.defconfig deleted file mode 100644 index 3cbff101d63..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/Kconfig.defconfig +++ /dev/null @@ -1,47 +0,0 @@ -# nRF9151 DK NRF9151 board configuration - -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_NRF9151DK_NRF9151 || BOARD_NRF9151DK_NRF9151_NS - -config BOARD - default "nrf9151dk_nrf9151" - -# 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. - -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - depends on BOARD_NRF9151DK_NRF9151 && TRUSTED_EXECUTION_SECURE - -if BOARD_NRF9151DK_NRF9151_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 # BOARD_NRF9151DK_NRF9151_NS - -config BT_HCI_VS - default y if BT - -config BT_WAIT_NOP - default BT && $(dt_nodelabel_enabled,nrf5340_reset) - -config I2C - default $(dt_compat_on_bus,$(DT_COMPAT_NXP_PCAL6408A),i2c) - -endif # BOARD_NRF9151DK_NRF9151 || BOARD_NRF9151DK_NRF9151_NS diff --git a/boards/arm/nrf9151dk_nrf9151/board.cmake b/boards/arm/nrf9151dk_nrf9151/board.cmake deleted file mode 100644 index a3126c941d9..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/board.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_BOARD_NRF9151DK_NRF9151_NS) - set(TFM_PUBLIC_KEY_FORMAT "full") -endif() - -if(CONFIG_TFM_FLASH_MERGED_BINARY) - set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex) -endif() - -# TODO: change to nRF9151_xxAA when such device is available in JLink -board_runner_args(jlink "--device=nRF9160_xxAA" "--speed=4000") -include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) -include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/arm/nrf9151dk_nrf9151/doc/index.rst b/boards/arm/nrf9151dk_nrf9151/doc/index.rst deleted file mode 100644 index 4c02e7ed372..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/doc/index.rst +++ /dev/null @@ -1,203 +0,0 @@ -.. _nrf9151dk_nrf9151: - -nRF9151 DK -########## - -Overview -******** - -The nRF9151 DK (PCA10171) is a single-board development kit for evaluation and -development on the nRF9151 SiP for DECT NR+ and LTE-M/NB-IoT with GNSS. The nrf9151dk_nrf9151 -board configuration provides support for the Nordic Semiconductor nRF9151 ARM -Cortex-M33F CPU with ARMv8-M Security Extension and the following devices: - -* :abbr:`ADC (Analog to Digital Converter)` -* CLOCK -* FLASH -* :abbr:`GPIO (General Purpose Input Output)` -* :abbr:`I2C (Inter-Integrated Circuit)` -* :abbr:`MPU (Memory Protection Unit)` -* :abbr:`NVIC (Nested Vectored Interrupt Controller)` -* :abbr:`PWM (Pulse Width Modulation)` -* :abbr:`RTC (nRF RTC System Clock)` -* Segger RTT (RTT Console) -* :abbr:`SPI (Serial Peripheral Interface)` -* :abbr:`UARTE (Universal asynchronous receiver-transmitter with EasyDMA)` -* :abbr:`WDT (Watchdog Timer)` -* :abbr:`IDAU (Implementation Defined Attribution Unit)` - -More information about the board can be found at the -`nRF9151 DK website`_. The `Nordic Semiconductor Infocenter`_ -contains the processor's information and the datasheet. - - -Hardware -******** - -nRF9151 DK has two external oscillators. The frequency of -the slow clock is 32.768 kHz. The frequency of the main clock -is 32 MHz. - -Supported Features -================== - -The nrf9151dk_nrf9151 board configuration supports the following -hardware features: - -+-----------+------------+----------------------+ -| Interface | Controller | Driver/Component | -+===========+============+======================+ -| ADC | on-chip | adc | -+-----------+------------+----------------------+ -| CLOCK | on-chip | clock_control | -+-----------+------------+----------------------+ -| FLASH | on-chip | flash | -+-----------+------------+----------------------+ -| FLASH | external | spi | -+-----------+------------+----------------------+ -| GPIO | on-chip | gpio | -+-----------+------------+----------------------+ -| GPIO | external | i2c | -+-----------+------------+----------------------+ -| I2C(M) | on-chip | i2c | -+-----------+------------+----------------------+ -| MPU | on-chip | arch/arm | -+-----------+------------+----------------------+ -| NVIC | on-chip | arch/arm | -+-----------+------------+----------------------+ -| PWM | on-chip | pwm | -+-----------+------------+----------------------+ -| RTC | on-chip | system clock | -+-----------+------------+----------------------+ -| RTT | nRF53 | console | -+-----------+------------+----------------------+ -| SPI(M/S) | on-chip | spi | -+-----------+------------+----------------------+ -| SPU | on-chip | system protection | -+-----------+------------+----------------------+ -| UARTE | on-chip | serial | -+-----------+------------+----------------------+ -| WDT | on-chip | watchdog | -+-----------+------------+----------------------+ - - -.. _nrf9151dk_additional_hardware: - -Other hardware features have not been enabled yet for this board. -See `nRF9151 DK website`_ and `Nordic Semiconductor Infocenter`_ -for a complete list of nRF9151 DK board hardware features. - -Connections and IOs -=================== - -LED ---- - -* LED1 (green) = P0.0 -* LED2 (green) = P0.1 -* LED3 (green) = P0.4 -* LED4 (green) = P0.5 - -Push buttons and Switches -------------------------- - -* BUTTON1 = P0.8 -* BUTTON2 = P0.9 -* SWITCH1 = P0.18 -* SWITCH2 = P0.19 -* BOOT = SW5 = boot/reset - -Security components -=================== - -- Implementation Defined Attribution Unit (`IDAU`_). The IDAU is implemented - with the System Protection Unit and is used to define secure and non-secure - memory maps. By default, all of the memory space (Flash, SRAM, and - peripheral address space) is defined to be secure accessible only. -- Secure boot. - - -Programming and Debugging -************************* - -nrf9151dk_nrf9151 supports the Armv8m Security Extension, and by default boots -in the Secure state. - -Building Secure/Non-Secure Zephyr applications with Arm |reg| TrustZone |reg| -============================================================================= - -The process requires the following steps: - -1. Build the Secure Zephyr application using ``-DBOARD=nrf9151dk_nrf9151`` and - ``CONFIG_TRUSTED_EXECUTION_SECURE=y`` in the application project configuration file. -2. Build the Non-Secure Zephyr application using ``-DBOARD=nrf9151dk_nrf9151_ns``. -3. Merge the two binaries together. - -When building a Secure/Non-Secure application, the Secure application will -have to set the IDAU (SPU) configuration to allow Non-Secure access to all -CPU resources utilized by the Non-Secure application firmware. SPU -configuration shall take place before jumping to the Non-Secure application. - -Building a Secure only application -================================== - -Build the Zephyr app in the usual way (see :ref:`build_an_application` -and :ref:`application_run`), using ``-DBOARD=nrf9151dk_nrf9151``. - -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). - -Here is an example for the :ref:`hello_world` application. - -First, run your favorite terminal program to listen for output. - -.. code-block:: console - - $ minicom -D -b 115200 - -Replace :code:`` with the port where the nRF9151 DK -can be found. For example, under Linux, :code:`/dev/ttyACM0`. - -Then build and flash the application in the usual way. - -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: nrf9151dk_nrf9151 - :goals: build flash - -Debugging -========= - -Refer to the :ref:`nordic_segger` page to learn about debugging Nordic boards with a -Segger IC. - - -Testing the LEDs and buttons in the nRF9151 DK -********************************************** - -There are 2 samples that allow you to test that the buttons (switches) and LEDs on -the board are working properly with Zephyr: - -* :zephyr:code-sample:`blinky` -* :zephyr:code-sample:`button` - -You can build and flash the examples to make sure Zephyr is running correctly on -your board. The button and LED definitions can be found in -:zephyr_file:`boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi`. - -References -********** - -.. target-notes:: - -.. _IDAU: - https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau -.. _nRF9151 DK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9151-DK -.. _Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com -.. _Trusted Firmware M: https://www.trustedfirmware.org/projects/tf-m/ diff --git a/boards/arm/nrf9151dk_nrf9151/dts/bindings/nordic,nrf9151dk-nrf5340-reset.yaml b/boards/arm/nrf9151dk_nrf9151/dts/bindings/nordic,nrf9151dk-nrf5340-reset.yaml deleted file mode 100644 index 2b51125312c..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/dts/bindings/nordic,nrf9151dk-nrf5340-reset.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: GPIO used to reset nRF5340 on nRF9151 DK - -compatible: "nordic,nrf9151dk-nrf5340-reset" - -include: base.yaml - -properties: - status: - required: true - - gpios: - type: phandle-array - required: true - description: | - GPIO to use as nRF5340 reset line: output in nRF9151, input in nRF5340. diff --git a/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_buttons_on_io_expander.dtsi b/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_buttons_on_io_expander.dtsi deleted file mode 100644 index 20f7d2406a5..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_buttons_on_io_expander.dtsi +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pcal6408a { - status = "okay"; -}; - -&button0 { - gpios = <&pcal6408a 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; -}; - -&button1 { - gpios = <&pcal6408a 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; -}; - -&button2 { - gpios = <&pcal6408a 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; -}; - -&button3 { - gpios = <&pcal6408a 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; -}; diff --git a/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_leds_on_io_expander.dtsi b/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_leds_on_io_expander.dtsi deleted file mode 100644 index d80c509d215..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/dts/nrf9151dk_leds_on_io_expander.dtsi +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pcal6408a { - status = "okay"; -}; - -&led0 { - gpios = <&pcal6408a 4 GPIO_ACTIVE_HIGH>; -}; - -&led1 { - gpios = <&pcal6408a 5 GPIO_ACTIVE_HIGH>; -}; - -&led2 { - gpios = <&pcal6408a 6 GPIO_ACTIVE_HIGH>; -}; - -&led3 { - gpios = <&pcal6408a 7 GPIO_ACTIVE_HIGH>; -}; diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts deleted file mode 100644 index 8c3b4921434..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.dts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; -#include -#include "nrf9151dk_nrf9151_common.dtsi" - -/ { - chosen { - zephyr,sram = &sram0_s; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_partition; - zephyr,sram-secure-partition = &sram0_s; - zephyr,sram-non-secure-partition = &sram0_ns; - }; -}; diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml deleted file mode 100644 index 3ad90fea76d..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151.yaml +++ /dev/null @@ -1,22 +0,0 @@ -identifier: nrf9151dk_nrf9151 -name: nRF9151-DK-NRF9151 -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 88 -flash: 1024 -supported: - - arduino_gpio - - arduino_i2c - - arduino_serial - - arduino_spi - - gpio - - i2c - - pwm - - spi - - watchdog - - counter -vendor: nordic diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common-pinctrl.dtsi b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common-pinctrl.dtsi deleted file mode 100644 index a1680e830f4..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common-pinctrl.dtsi +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart0_default: uart0_default { - group1 { - psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; - }; - }; - - uart0_sleep: uart0_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - - uart1_default: uart1_default { - group1 { - psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; - }; - }; - - uart1_sleep: uart1_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - - i2c2_default: i2c2_default { - group1 { - psels = , - ; - }; - }; - - i2c2_sleep: i2c2_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - pwm0_default: pwm0_default { - group1 { - psels = ; - }; - }; - - pwm0_sleep: pwm0_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; - - spi3_default: spi3_default { - group1 { - psels = , - , - ; - nordic,drive-mode = ; - }; - }; - - spi3_sleep: spi3_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; -}; diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi deleted file mode 100644 index 958e864c63c..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_common.dtsi +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "nrf9151dk_nrf9151_common-pinctrl.dtsi" -#include - -/ { - model = "Nordic nRF9151 DK NRF9151"; - compatible = "nordic,nrf9151-dk-nrf9151"; - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,uart-mcumgr = &uart0; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - led1: led_1 { - gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; - label = "Green LED 2"; - }; - led2: led_2 { - gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; - label = "Green LED 3"; - }; - led3: led_3 { - gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; - label = "Green LED 4"; - }; - }; - - pwmleds { - compatible = "pwm-leds"; - pwm_led0: pwm_led_0 { - pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; - }; - }; - - buttons { - compatible = "gpio-keys"; - button0: button_0 { - gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - zephyr,code = ; - }; - button1: button_1 { - gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - zephyr,code = ; - }; - button2: button_2 { - gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 3"; - zephyr,code = ; - }; - button3: button_3 { - gpios = <&gpio0 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 4"; - zephyr,code = ; - }; - }; - - nrf5340_reset: gpio-reset { - compatible = "nordic,nrf9151dk-nrf5340-reset"; - status = "disabled"; - gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; - }; - - arduino_header: connector { - compatible = "arduino-header-r3"; - #gpio-cells = <2>; - gpio-map-mask = <0xffffffff 0xffffffc0>; - gpio-map-pass-thru = <0 0x3f>; - gpio-map = <0 0 &gpio0 14 0>, /* A0 */ - <1 0 &gpio0 15 0>, /* A1 */ - <2 0 &gpio0 16 0>, /* A2 */ - <3 0 &gpio0 17 0>, /* A3 */ - <4 0 &gpio0 18 0>, /* A4 */ - <5 0 &gpio0 19 0>, /* A5 */ - <6 0 &gpio0 0 0>, /* D0 */ - <7 0 &gpio0 1 0>, /* D1 */ - <8 0 &gpio0 2 0>, /* D2 */ - <9 0 &gpio0 3 0>, /* D3 */ - <10 0 &gpio0 4 0>, /* D4 */ - <11 0 &gpio0 5 0>, /* D5 */ - <12 0 &gpio0 6 0>, /* D6 */ - <13 0 &gpio0 7 0>, /* D7 */ - <14 0 &gpio0 8 0>, /* D8 */ - <15 0 &gpio0 9 0>, /* D9 */ - <16 0 &gpio0 10 0>, /* D10 */ - <17 0 &gpio0 11 0>, /* D11 */ - <18 0 &gpio0 12 0>, /* D12 */ - <19 0 &gpio0 13 0>, /* D13 */ - <20 0 &gpio0 30 0>, /* D14 */ - <21 0 &gpio0 31 0>; /* D15 */ - }; - - arduino_adc: analog-connector { - compatible = "arduino,uno-adc"; - #io-channel-cells = <1>; - io-channel-map = <0 &adc 1>, /* A0 = P0.14 = AIN1 */ - <1 &adc 2>, /* A1 = P0.15 = AIN2 */ - <2 &adc 3>, /* A2 = P0.16 = AIN3 */ - <3 &adc 4>, /* A3 = P0.17 = AIN4 */ - <4 &adc 5>, /* A4 = P0.18 = AIN5 */ - <5 &adc 6>; /* A5 = P0.19 = AIN6 */ - }; - - /* These aliases are provided for compatibility with samples */ - aliases { - led0 = &led0; - led1 = &led1; - led2 = &led2; - led3 = &led3; - pwm-led0 = &pwm_led0; - sw0 = &button0; - sw1 = &button1; - sw2 = &button2; - sw3 = &button3; - bootloader-led0 = &led0; - mcuboot-button0 = &button0; - mcuboot-led0 = &led0; - watchdog0 = &wdt0; - spi-flash0 = &gd25wb256; - }; -}; - -&adc { - status = "okay"; -}; - -&gpiote { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_default>; - pinctrl-1 = <&uart0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -arduino_serial: &uart1 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart1_default>; - pinctrl-1 = <&uart1_sleep>; - pinctrl-names = "default", "sleep"; -}; - -arduino_i2c: &i2c2 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c2_default>; - pinctrl-1 = <&i2c2_sleep>; - pinctrl-names = "default", "sleep"; - clock-frequency = ; - - pcal6408a: pcal6408a@21 { - compatible = "nxp,pcal6408a"; - status = "disabled"; - reg = <0x21>; - gpio-controller; - #gpio-cells = <2>; - ngpios = <8>; - int-gpios = <&gpio0 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - }; -}; - -&pwm0 { - status = "okay"; - pinctrl-0 = <&pwm0_default>; - pinctrl-1 = <&pwm0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -arduino_spi: &spi3 { - compatible = "nordic,nrf-spim"; - status = "okay"; - cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>, /* D10 */ - <&gpio0 20 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&spi3_default>; - pinctrl-1 = <&spi3_sleep>; - pinctrl-names = "default", "sleep"; - - gd25wb256: gd25wb256e3ir@1 { - compatible = "jedec,spi-nor"; - status = "disabled"; - reg = <1>; - spi-max-frequency = <8000000>; - size = <268435456>; - has-dpd; - t-enter-dpd = <3000>; - t-exit-dpd = <40000>; - sfdp-bfp = [ - e5 20 f3 ff ff ff ff 0f 44 eb 08 6b 08 3b 42 bb - ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 - 10 d8 00 ff 44 7a c9 fe 83 67 26 62 ec 82 18 44 - 7a 75 7a 75 04 c4 d5 5c 00 06 74 00 08 50 00 01 - ]; - jedec-id = [c8 65 19]; - }; -}; - -&flash0 { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x10000>; - }; - slot0_partition: partition@10000 { - label = "image-0"; - }; - slot0_ns_partition: partition@50000 { - label = "image-0-nonsecure"; - }; - slot1_partition: partition@85000 { - label = "image-1"; - }; - slot1_ns_partition: partition@c5000 { - label = "image-1-nonsecure"; - }; - storage_partition: partition@fa000 { - label = "storage"; - reg = <0x000fa000 0x00006000>; - }; - }; -}; - -/ { - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_s: image_s@20000000 { - /* Secure image memory */ - }; - - sram0_modem: image_modem@20016000 { - /* Modem (shared) memory */ - }; - - sram0_ns: image_ns@20020000 { - /* Non-Secure image memory */ - }; - }; -}; - -/* Include partition configuration file */ -#include "nrf9151dk_nrf9151_partition_conf.dtsi" diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_defconfig b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_defconfig deleted file mode 100644 index 7afe5ac7aa9..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_defconfig +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF91X=y -CONFIG_SOC_NRF9151_LACA=y -CONFIG_BOARD_NRF9151DK_NRF9151=y - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# enable GPIO -CONFIG_GPIO=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.dts b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.dts deleted file mode 100644 index a41c4aad388..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.dts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; -#include -#include "nrf9151dk_nrf9151_common.dtsi" - -/ { - chosen { - zephyr,flash = &flash0; - zephyr,sram = &sram0_ns; - zephyr,code-partition = &slot0_ns_partition; - }; -}; - -/* Disable UART1, because it is used by default in TF-M */ -&uart1 { - status = "disabled"; -}; diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.yaml b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.yaml deleted file mode 100644 index c5d4fe92541..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns.yaml +++ /dev/null @@ -1,20 +0,0 @@ -identifier: nrf9151dk_nrf9151_ns -name: nRF9151-DK-NRF9151-Non-Secure -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 128 -flash: 192 -supported: - - arduino_gpio - - arduino_i2c - - arduino_serial - - arduino_spi - - i2c - - pwm - - watchdog - - netif:modem -vendor: nordic diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns_defconfig b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns_defconfig deleted file mode 100644 index 949ef39f856..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_ns_defconfig +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF91X=y -CONFIG_SOC_NRF9151_LACA=y -CONFIG_BOARD_NRF9151DK_NRF9151_NS=y - -# 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 uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_partition_conf.dtsi b/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_partition_conf.dtsi deleted file mode 100644 index b209608a725..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/nrf9151dk_nrf9151_partition_conf.dtsi +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * Default Flash planning for nRF9151dk_nrf9151. - * - * Zephyr build for nRF9151 with ARM TrustZone-M support, - * implies building Secure and Non-Secure Zephyr images. - * - * Secure image will be placed, by default, in flash0 - * (or in slot0, if MCUboot is present). - * Secure image will use sram0 for system memory. - * - * Non-Secure image will be placed in slot0_ns, and use - * sram0_ns for system memory. - * - * Note that the Secure image only requires knowledge of - * the beginning of the Non-Secure image (not its size). - */ - -&slot0_partition { - reg = <0x00010000 0x40000>; -}; - -&slot0_ns_partition { - reg = <0x00050000 0x35000>; -}; - -&slot1_partition { - reg = <0x00085000 0x40000>; -}; - -&slot1_ns_partition { - reg = <0x000c5000 0x35000>; -}; - -/* Default SRAM planning when building for nRF9151 with - * ARM TrustZone-M support - * - Lowest 88 kB SRAM allocated to Secure image (sram0_s). - * - 40 kB SRAM reserved for and used by the modem library - * (sram0_modem). This memory is Non-Secure. - * - Upper 128 kB allocated to Non-Secure image (sram0_ns). - * When building with TF-M, both sram0_modem and sram0_ns - * are allocated to the Non-Secure image. - */ - -&sram0_s { - reg = <0x20000000 DT_SIZE_K(88)>; -}; - -&sram0_modem { - reg = <0x20016000 DT_SIZE_K(40)>; -}; - -&sram0_ns { - reg = <0x20020000 DT_SIZE_K(128)>; -}; diff --git a/boards/arm/nrf9151dk_nrf9151/pre_dt_board.cmake b/boards/arm/nrf9151dk_nrf9151/pre_dt_board.cmake deleted file mode 100644 index c8267afd1b4..00000000000 --- a/boards/arm/nrf9151dk_nrf9151/pre_dt_board.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2021 Linaro Limited -# SPDX-License-Identifier: Apache-2.0 - -# Suppress "unique_unit_address_if_enabled" to handle the following overlaps: -# - flash-controller@39000 & kmu@39000 -# - power@5000 & clock@5000 -list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") From b1a855a5a83a7b83a95fad22bac355cf3fd7cfbe Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:54 +0100 Subject: [PATCH 1197/2300] Revert "[nrf fromtree] soc: arm: nordic_nrf: nrf91: add nRF9151 LACA" This reverts commit 8f1213662aa85dc960b191349652da8dbdc040a3. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf9151_laca.dtsi | 23 ------------------- dts/arm/nordic/nrf9151ns_laca.dtsi | 23 ------------------- .../nrf91/Kconfig.defconfig.nrf9151_LACA | 14 ----------- soc/arm/nordic_nrf/nrf91/Kconfig.soc | 4 ---- 4 files changed, 64 deletions(-) delete mode 100644 dts/arm/nordic/nrf9151_laca.dtsi delete mode 100644 dts/arm/nordic/nrf9151ns_laca.dtsi delete mode 100644 soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf9151_LACA diff --git a/dts/arm/nordic/nrf9151_laca.dtsi b/dts/arm/nordic/nrf9151_laca.dtsi deleted file mode 100644 index 9ed20274017..00000000000 --- a/dts/arm/nordic/nrf9151_laca.dtsi +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -&flash0 { - reg = <0x00000000 DT_SIZE_K(1024)>; -}; - -&sram0 { - reg = <0x20000000 DT_SIZE_K(256)>; -}; - -/ { - soc { - compatible = "nordic,nrf9151-laca", "nordic,nrf9120", - "nordic,nrf91", "simple-bus"; - }; -}; diff --git a/dts/arm/nordic/nrf9151ns_laca.dtsi b/dts/arm/nordic/nrf9151ns_laca.dtsi deleted file mode 100644 index ac31c6e19c6..00000000000 --- a/dts/arm/nordic/nrf9151ns_laca.dtsi +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -&flash0 { - reg = <0x00000000 DT_SIZE_K(1024)>; -}; - -&sram0 { - reg = <0x20000000 DT_SIZE_K(256)>; -}; - -/ { - soc { - compatible = "nordic,nrf9151-laca", "nordic,nrf9120", - "nordic,nrf91", "simple-bus"; - }; -}; diff --git a/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf9151_LACA b/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf9151_LACA deleted file mode 100644 index 1b3ea88e359..00000000000 --- a/soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf9151_LACA +++ /dev/null @@ -1,14 +0,0 @@ -# Nordic Semiconductor nRF9151 MCU - -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF9151_LACA - -config SOC - default "nRF9151_LACA" - -config NUM_IRQS - default 65 - -endif # SOC_NRF9151_LACA diff --git a/soc/arm/nordic_nrf/nrf91/Kconfig.soc b/soc/arm/nordic_nrf/nrf91/Kconfig.soc index 0267ada4850..c9b8c54438b 100644 --- a/soc/arm/nordic_nrf/nrf91/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf91/Kconfig.soc @@ -34,10 +34,6 @@ config SOC_NRF9131_LACA bool "NRF9131_LACA" select SOC_NRF9120 -config SOC_NRF9151_LACA - bool "NRF9151_LACA" - select SOC_NRF9120 - endchoice config NRF_ENABLE_ICACHE From 53e6f487fe97a6e6584d7e09d244654ea93b731d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:54 +0100 Subject: [PATCH 1198/2300] Revert "[nrf fromtree] drivers: sensor: adxl367: Add missing breaks" This reverts commit ccc32b6b705b08d947bd9309bde19696a3feb6e0. Signed-off-by: Robert Lubos --- drivers/sensor/adxl367/adxl367.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/sensor/adxl367/adxl367.c b/drivers/sensor/adxl367/adxl367.c index 1d5c31ad021..f63b8f73a32 100644 --- a/drivers/sensor/adxl367/adxl367.c +++ b/drivers/sensor/adxl367/adxl367.c @@ -287,22 +287,16 @@ int adxl367_self_test(const struct device *dev) switch (cfg->odr) { case ADXL367_ODR_12P5HZ: st_delay_ms = 320; - break; case ADXL367_ODR_25HZ: st_delay_ms = 160; - break; case ADXL367_ODR_50HZ: st_delay_ms = 80; - break; case ADXL367_ODR_100HZ: st_delay_ms = 40; - break; case ADXL367_ODR_200HZ: st_delay_ms = 20; - break; case ADXL367_ODR_400HZ: st_delay_ms = 10; - break; default: return -EINVAL; } From 3f983f7874bc9a837d117d2175921d1ce5261330 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:54 +0100 Subject: [PATCH 1199/2300] Revert "[nrf fromlist] drivers: ieee802154: fix nRF5 Rx error handling" This reverts commit 25efcd89ff31b4089d01959f55a2b8a36a00d07f. Signed-off-by: Robert Lubos --- drivers/ieee802154/ieee802154_nrf5.c | 10 +--------- drivers/ieee802154/ieee802154_nrf5.h | 3 --- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index f6a69307846..20444826857 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -759,7 +759,6 @@ static int nrf5_init(const struct device *dev) nrf5_get_capabilities_at_boot(); - nrf5_radio->rx_on_when_idle = true; nrf5_radio_cfg->irq_config_func(dev); k_thread_create(&nrf5_radio->rx_thread, nrf5_radio->rx_stack, @@ -987,7 +986,6 @@ static int nrf5_configure(const struct device *dev, case IEEE802154_CONFIG_RX_ON_WHEN_IDLE: nrf_802154_rx_on_when_idle_set(config->rx_on_when_idle); - nrf5_data.rx_on_when_idle = config->rx_on_when_idle; break; default: @@ -1068,13 +1066,7 @@ void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id) #if defined(CONFIG_IEEE802154_CSL_ENDPOINT) if (id == DRX_SLOT_RX && error == NRF_802154_RX_ERROR_DELAYED_TIMEOUT) { - if (!nrf5_data.rx_on_when_idle) { - /* Transition to RxOff done automatically by the driver */ - return; - } else if (nrf5_data.event_handler) { - /* Notify the higher layer to allow it to transition if needed */ - nrf5_data.event_handler(dev, IEEE802154_EVENT_RX_OFF, NULL); - } + return; } #else ARG_UNUSED(id); diff --git a/drivers/ieee802154/ieee802154_nrf5.h b/drivers/ieee802154/ieee802154_nrf5.h index b1c95548210..79b47827d72 100644 --- a/drivers/ieee802154/ieee802154_nrf5.h +++ b/drivers/ieee802154/ieee802154_nrf5.h @@ -107,9 +107,6 @@ struct nrf5_802154_data { /* The last configured value of CSL phase time in nanoseconds. */ net_time_t csl_rx_time; #endif /* CONFIG_NRF_802154_SER_HOST && CONFIG_IEEE802154_CSL_ENDPOINT */ - - /* Indicates if RxOnWhenIdle mode is enabled. */ - bool rx_on_when_idle; }; #endif /* ZEPHYR_DRIVERS_IEEE802154_IEEE802154_NRF5_H_ */ From 0d978d0981c5ca8aae7a7738c9b56ba1db9404ad Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:54 +0100 Subject: [PATCH 1200/2300] Revert "[nrf fromtree] drivers: regulator: Fixed reference counting during enable" This reverts commit 5b6e5bfa8b728f12944b1dc5d14f3ee426f4f755. Signed-off-by: Robert Lubos --- drivers/regulator/regulator_common.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/regulator_common.c b/drivers/regulator/regulator_common.c index 14866a3738f..7f33040d2d9 100644 --- a/drivers/regulator/regulator_common.c +++ b/drivers/regulator/regulator_common.c @@ -107,13 +107,10 @@ int regulator_enable(const struct device *dev) (void)k_mutex_lock(&data->lock, K_FOREVER); #endif - data->refcnt++; - - if (data->refcnt == 1) { + if (data->refcnt == 0) { ret = api->enable(dev); - if (ret < 0) { - data->refcnt--; - } else { + if (ret == 0) { + data->refcnt++; regulator_delay(config->off_on_delay_us); } } From 8f456bf11c5b97c37259a39a25a10b9e2e8890d6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:55 +0100 Subject: [PATCH 1201/2300] Revert "[nrf fromtree] net: openthread: Print the actual assert location" This reverts commit 1f497d41cb62d5299a87edc9458dd5823c017b23. Signed-off-by: Robert Lubos --- modules/openthread/platform/misc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/openthread/platform/misc.c b/modules/openthread/platform/misc.c index 5f9043dfa27..11fdc42ec34 100644 --- a/modules/openthread/platform/misc.c +++ b/modules/openthread/platform/misc.c @@ -99,10 +99,5 @@ void otPlatWakeHost(void) void otPlatAssertFail(const char *aFilename, int aLineNumber) { - /* - * The code below is used instead of __ASSERT(false) to print the actual assert - * location instead of __FILE__:__LINE__, which would point to this function. - */ - __ASSERT_PRINT("OpenThread ASSERT @ %s:%d\n", aFilename, aLineNumber); - __ASSERT_POST_ACTION(); + __ASSERT(false, "OpenThread ASSERT @ %s:%d", aFilename, aLineNumber); } From 655344d53542003329b93ece68d35692667f359b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:55 +0100 Subject: [PATCH 1202/2300] Revert "[nrf fromtree] net: openthread: Remove PSA crypto backend workarounds" This reverts commit e915aca2d03a78f08485f8dd5099b68a803639f5. Signed-off-by: Robert Lubos --- modules/openthread/platform/crypto_psa.c | 68 +++++++++++++++++++++--- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/modules/openthread/platform/crypto_psa.c b/modules/openthread/platform/crypto_psa.c index 55018254154..0dcf3803fde 100644 --- a/modules/openthread/platform/crypto_psa.c +++ b/modules/openthread/platform/crypto_psa.c @@ -111,6 +111,31 @@ static bool checkContext(otCryptoContext *aContext, size_t aMinSize) return aContext != NULL && aContext->mContext != NULL && aContext->mContextSize >= aMinSize; } +static void ensureKeyIsLoaded(otCryptoKeyRef aKeyRef) +{ + /* + * The workaround below will no longer be need after updating TF-M version used in Zephyr + * to 1.5.0 (see upstream commit 42e77b561fcfe19819ff1e63cb7c0b672ee8ba41). + * In the recent versions of TF-M the concept of key handles and psa_open_key()/ + * psa_close_key() APIs have been being deprecated, but the version currently used in Zephyr + * is in the middle of that transition. Consequently, psa_destroy_key() and lots of other + * functions will fail when a key ID that they take as a parameter is not loaded from the + * persistent storage. That may occur when a given persistent key is created via + * psa_generate_key() or psa_import_key(), and then the device reboots. + * + * Use psa_open_key() when the key has not been loaded yet to work around the issue. + */ + psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; + psa_status_t status = psa_get_key_attributes(aKeyRef, &attributes); + psa_key_id_t key_handle; + + if (status == PSA_ERROR_INVALID_HANDLE) { + psa_open_key(aKeyRef, &key_handle); + } + + psa_reset_key_attributes(&attributes); +} + void otPlatCryptoInit(void) { psa_crypto_init(); @@ -170,11 +195,15 @@ otError otPlatCryptoExportKey(otCryptoKeyRef aKeyRef, return OT_ERROR_INVALID_ARGS; } + ensureKeyIsLoaded(aKeyRef); + return psaToOtError(psa_export_key(aKeyRef, aBuffer, aBufferLen, aKeyLen)); } otError otPlatCryptoDestroyKey(otCryptoKeyRef aKeyRef) { + ensureKeyIsLoaded(aKeyRef); + return psaToOtError(psa_destroy_key(aKeyRef)); } @@ -183,6 +212,7 @@ bool otPlatCryptoHasKey(otCryptoKeyRef aKeyRef) psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; psa_status_t status; + ensureKeyIsLoaded(aKeyRef); status = psa_get_key_attributes(aKeyRef, &attributes); psa_reset_key_attributes(&attributes); @@ -225,6 +255,7 @@ otError otPlatCryptoHmacSha256Start(otCryptoContext *aContext, const otCryptoKey return OT_ERROR_INVALID_ARGS; } + ensureKeyIsLoaded(aKey->mKeyRef); operation = aContext->mContext; status = psa_mac_sign_setup(operation, aKey->mKeyRef, PSA_ALG_HMAC(PSA_ALG_SHA_256)); @@ -292,6 +323,7 @@ otError otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, { const size_t block_size = PSA_BLOCK_CIPHER_BLOCK_LENGTH(PSA_KEY_TYPE_AES); psa_status_t status = PSA_SUCCESS; + psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT; psa_key_id_t *key_ref; size_t cipher_length; @@ -299,15 +331,37 @@ otError otPlatCryptoAesEncrypt(otCryptoContext *aContext, const uint8_t *aInput, return OT_ERROR_INVALID_ARGS; } + /* + * The code below can be simplified after updating TF-M version used in Zephyr to 1.5.0 + * (see upstream commit: 045ec4abfc73152a0116684ba9127d0a97cc8d34), using + * psa_cipher_encrypt() function which will replace the setup-update-finish sequence below. + */ key_ref = aContext->mContext; - status = psa_cipher_encrypt(*key_ref, - PSA_ALG_ECB_NO_PADDING, - aInput, - block_size, - aOutput, - block_size, - &cipher_length); + ensureKeyIsLoaded(*key_ref); + status = psa_cipher_encrypt_setup(&operation, *key_ref, PSA_ALG_ECB_NO_PADDING); + + if (status != PSA_SUCCESS) { + goto out; + } + + status = psa_cipher_update(&operation, + aInput, + block_size, + aOutput, + block_size, + &cipher_length); + if (status != PSA_SUCCESS) { + goto out; + } + + status = psa_cipher_finish(&operation, + aOutput + cipher_length, + block_size - cipher_length, + &cipher_length); + +out: + psa_cipher_abort(&operation); return psaToOtError(status); } From 0bcbaa44de3bebabd1fdcaa576e7fc8b50a6c234 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:55 +0100 Subject: [PATCH 1203/2300] Revert "[nrf fromtree] net: openthread: Add new key and algorithm in PSA." This reverts commit 214cde4f5248edc1a7d54c939019ca66b0c5cecd. Signed-off-by: Robert Lubos --- modules/openthread/platform/crypto_psa.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/modules/openthread/platform/crypto_psa.c b/modules/openthread/platform/crypto_psa.c index 0dcf3803fde..e5b234ce030 100644 --- a/modules/openthread/platform/crypto_psa.c +++ b/modules/openthread/platform/crypto_psa.c @@ -41,8 +41,6 @@ static psa_key_type_t toPsaKeyType(otCryptoKeyType aType) return PSA_KEY_TYPE_AES; case OT_CRYPTO_KEY_TYPE_HMAC: return PSA_KEY_TYPE_HMAC; - case OT_CRYPTO_KEY_TYPE_ECDSA: - return PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1); default: return PSA_KEY_TYPE_NONE; } @@ -55,8 +53,6 @@ static psa_algorithm_t toPsaAlgorithm(otCryptoKeyAlgorithm aAlgorithm) return PSA_ALG_ECB_NO_PADDING; case OT_CRYPTO_KEY_ALG_HMAC_SHA_256: return PSA_ALG_HMAC(PSA_ALG_SHA_256); - case OT_CRYPTO_KEY_ALG_ECDSA: - return PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256); default: /* * There is currently no constant like PSA_ALG_NONE, but 0 is used @@ -86,10 +82,6 @@ static psa_key_usage_t toPsaKeyUsage(int aUsage) usage |= PSA_KEY_USAGE_SIGN_HASH; } - if (aUsage & OT_CRYPTO_KEY_USAGE_VERIFY_HASH) { - usage |= PSA_KEY_USAGE_VERIFY_HASH; - } - return usage; } @@ -97,10 +89,9 @@ static bool checkKeyUsage(int aUsage) { /* Check if only supported flags have been passed */ int supported_flags = OT_CRYPTO_KEY_USAGE_EXPORT | - OT_CRYPTO_KEY_USAGE_ENCRYPT | - OT_CRYPTO_KEY_USAGE_DECRYPT | - OT_CRYPTO_KEY_USAGE_SIGN_HASH | - OT_CRYPTO_KEY_USAGE_VERIFY_HASH; + OT_CRYPTO_KEY_USAGE_ENCRYPT | + OT_CRYPTO_KEY_USAGE_DECRYPT | + OT_CRYPTO_KEY_USAGE_SIGN_HASH; return (aUsage & ~supported_flags) == 0; } From 3239d634691955a4ad6f844efc89e8b2d96ba0d4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:55 +0100 Subject: [PATCH 1204/2300] Revert "[nrf fromtree] net: openthread: implement `otPlatResetToBootloader`" This reverts commit b25e8302a2820a6932f515b70c9aef99ef195680. Signed-off-by: Robert Lubos --- dts/bindings/options/openthread,config.yaml | 7 --- modules/openthread/CMakeLists.txt | 1 - modules/openthread/Kconfig.features | 23 +------ modules/openthread/platform/misc.c | 66 --------------------- 4 files changed, 2 insertions(+), 95 deletions(-) diff --git a/dts/bindings/options/openthread,config.yaml b/dts/bindings/options/openthread,config.yaml index 6366c289c80..054107fab44 100644 --- a/dts/bindings/options/openthread,config.yaml +++ b/dts/bindings/options/openthread,config.yaml @@ -10,7 +10,6 @@ description: | compatible = "openthread,config"; diag-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>, <&gpio1 0 GPIO_ACTIVE_LOW>; - bootloader-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; }; }; @@ -22,9 +21,3 @@ properties: description: | This enables access to diagnostic GPIO pins. Each field consists of GPIO pin's configuration: controller's phandle, pin number and configuration flags. - - bootloader-gpios: - type: phandle-array - description: | - This enables resetting to bootloader by triggering given GPIO pin. Property represents - chosen GPIO pin's configuration: controller's phandle, pin number and configuration flags. diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 5b64d3be2f5..c9ccf074649 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -99,7 +99,6 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDATA_PUBLISHER OT_NETDATA_PUBLISHER "E 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") kconfig_to_ot_option(CONFIG_OPENTHREAD_PING_SENDER OT_PING_SENDER "Enable ping sender support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE OT_PLATFORM_BOOTLOADER_MODE "Enable platform bootloader mode support") kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_KEY_REF OT_PLATFORM_KEY_REF "Enable platform key reference support") kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_NETIF OT_PLATFORM_NETIF "Enable platform netif support") kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_UDP OT_PLATFORM_UDP "Enable platform UDP support") diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index ba3990a348d..952a7853b43 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -17,7 +17,7 @@ config OPENTHREAD_THREAD_VERSION_1_3 bool "Version 1.3" config OPENTHREAD_THREAD_VERSION_1_3_1 bool "Version 1.3.1" -endchoice # OPENTHREAD_STACK_VERSION +endchoice config OPENTHREAD_THREAD_VERSION string @@ -255,25 +255,6 @@ config OPENTHREAD_PLATFORM_KEY_REF Enable usage of cryptographic key references instead of literal keys. This requires a crypto backend library that supports key references. -choice OPENTHREAD_PLATFORM_BOOTLOADER_MODE_CHOICE - prompt "Platform bootloader mode configuration" - optional - -config OPENTHREAD_PLATFORM_BOOTLOADER_MODE_RETENTION - bool "Bootloader mode support with boot mode retention API" - depends on RETENTION_BOOT_MODE && REBOOT - select OPENTHREAD_PLATFORM_BOOTLOADER_MODE - -config OPENTHREAD_PLATFORM_BOOTLOADER_MODE_GPIO - bool "Bootloader mode support with GPIO pin trigger" - select OPENTHREAD_PLATFORM_BOOTLOADER_MODE -endchoice # OPENTHREAD_PLATFORM_BOOTLOADER_MODE - -config OPENTHREAD_PLATFORM_BOOTLOADER_MODE - bool - help - Platform bootloader mode support - config OPENTHREAD_PLATFORM_NETIF bool "Platform netif support" @@ -295,7 +276,7 @@ config OPENTHREAD_POWER_SUPPLY_EXTERNAL_STABLE config OPENTHREAD_POWER_SUPPLY_EXTERNAL_UNSTABLE bool "OT_POWER_SUPPLY_EXTERNAL_UNSTABLE" -endchoice # OPENTHREAD_POWER_SUPPLY_CHOICE +endchoice config OPENTHREAD_POWER_SUPPLY string diff --git a/modules/openthread/platform/misc.c b/modules/openthread/platform/misc.c index 11fdc42ec34..7f57dddb9e3 100644 --- a/modules/openthread/platform/misc.c +++ b/modules/openthread/platform/misc.c @@ -9,24 +9,6 @@ #include #include -#if defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_RETENTION) - -#include - -#elif defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_GPIO) - -BUILD_ASSERT(DT_HAS_COMPAT_STATUS_OKAY(openthread_config), - "`openthread,config` compatible node not found"); -BUILD_ASSERT(DT_NODE_HAS_PROP(DT_COMPAT_GET_ANY_STATUS_OKAY(openthread_config), bootloader_gpios), - "`bootloader-gpios` property missing from `openthread,config` compatible node"); - -#include - -static const struct gpio_dt_spec bootloader_gpio = - GPIO_DT_SPEC_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(openthread_config), - bootloader_gpios); -#endif - #include "platform-zephyr.h" void otPlatReset(otInstance *aInstance) @@ -37,54 +19,6 @@ void otPlatReset(otInstance *aInstance) sys_reboot(SYS_REBOOT_WARM); } -#if defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE) -otError otPlatResetToBootloader(otInstance *aInstance) -{ - OT_UNUSED_VARIABLE(aInstance); - -#if defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_RETENTION) - if (bootmode_set(BOOT_MODE_TYPE_BOOTLOADER)) { - return OT_ERROR_NOT_CAPABLE; - } - sys_reboot(SYS_REBOOT_WARM); - -#elif defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_GPIO) - /* - * To enable resetting to bootloader by triggering gpio pin, - * select `CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE_GPIO=y`, - * and in Devicetree create `openthread` node in `/options/` path with - * `compatible = "openthread,config"` property and `bootloader-gpios` property, - * which should represent GPIO pin's configuration, - * containing controller phandle, pin number and pin flags. e.g: - * - * options { - * openthread { - * compatible = "openthread,config"; - * bootloader-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; - * }; - * }; - * - * Note: in below implementation, chosen GPIO pin is configured as output - * and initialized to active state (logical value ‘1’). - * Configuring pin flags in `bootloader-gpios` allows to choose - * if pin should be active in high or in low state. - */ - - if (!gpio_is_ready_dt(&bootloader_gpio)) { - return OT_ERROR_NOT_CAPABLE; - } - gpio_pin_configure_dt(&bootloader_gpio, GPIO_OUTPUT_ACTIVE); - -#endif - - /* - * Return OT_ERROR_NOT_CAPABLE if resetting has been unsuccessful (invalid configuration or - * triggering reset had no effect) - */ - return OT_ERROR_NOT_CAPABLE; -} -#endif /* defined(CONFIG_OPENTHREAD_PLATFORM_BOOTLOADER_MODE) */ - otPlatResetReason otPlatGetResetReason(otInstance *aInstance) { ARG_UNUSED(aInstance); From 11a766e085501a8e9e073bc9b58372a4c68e1a4e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:55 +0100 Subject: [PATCH 1205/2300] Revert "[nrf fromtree] net: openthread: add missing cmake option" This reverts commit 9ee703521969a90c51a086fb4320c8fde064e65a. Signed-off-by: Robert Lubos --- modules/openthread/CMakeLists.txt | 1 - .../platform/openthread-core-zephyr-config.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index c9ccf074649..6691084eebd 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -15,7 +15,6 @@ endmacro() set(OT_BUILD_EXECUTABLES OFF CACHE BOOL "Disable OpenThread samples") set(OT_BUILTIN_MBEDTLS_MANAGEMENT OFF CACHE BOOL "Use Zephyr's mbedTLS heap") set(OT_PLATFORM "zephyr" CACHE STRING "Zephyr as a target platform") -set(OT_PLATFORM_POWER_CALIBRATION OFF CACHE BOOL "Use Zephyr's power calibration handled by Radio Driver") set(OT_THREAD_VERSION ${CONFIG_OPENTHREAD_THREAD_VERSION} CACHE STRING "User selected Thread stack version") set(OT_CLI_TRANSPORT "CONSOLE" CACHE STRING "Set CLI to use console interpreter") diff --git a/modules/openthread/platform/openthread-core-zephyr-config.h b/modules/openthread/platform/openthread-core-zephyr-config.h index 71a087ca0b5..773cd170f2c 100644 --- a/modules/openthread/platform/openthread-core-zephyr-config.h +++ b/modules/openthread/platform/openthread-core-zephyr-config.h @@ -438,6 +438,17 @@ #define OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE 0 #endif +/** + * @def OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE + * + * In Zephyr, power calibration is handled by Radio Driver, so it can't be handled on OT level. + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE 0 +#endif + + /** * @def OPENTHREAD_CONFIG_RADIO_STATS * From fae98c9190f4af30d803008fba1bc57fd3b86bb4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:56 +0100 Subject: [PATCH 1206/2300] Revert "[nrf fromtree] net: openthread: increase TCAT stack size" This reverts commit e6a4ae7c8bd1d6f28158a86f15dcce78c6ba528b. Signed-off-by: Robert Lubos --- modules/openthread/Kconfig.thread | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index 542992e7fa1..66e039b7300 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -184,7 +184,6 @@ config OPENTHREAD_DEFAULT_TX_POWER config OPENTHREAD_BLE_TCAT_THREAD_STACK_SIZE int "Openthread default TCAT stack size" - default 5120 if OPENTHREAD_CRYPTO_PSA default 4200 help Openthread default TCAT stack size. From 097e28ba91749ebf43acacdac48137ded85b288e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:56 +0100 Subject: [PATCH 1207/2300] Revert "[nrf fromtree] net: openthread: Add cmake makro to openthread cmake lists." This reverts commit ac7bd9f3aeba1fa757204b4b39644ee106d59e39. Signed-off-by: Robert Lubos --- modules/openthread/CMakeLists.txt | 571 +++++++++++++++++++++++++----- 1 file changed, 481 insertions(+), 90 deletions(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 6691084eebd..150039863d9 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -3,14 +3,6 @@ if(CONFIG_OPENTHREAD_SOURCES) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -macro(kconfig_to_ot_option kconfig_option ot_config description) - if(${kconfig_option}) - set(${ot_config} ON CACHE BOOL "${description}" FORCE) - else() - set(${ot_config} OFF CACHE BOOL "${description}" FORCE) - endif() -endmacro() - # OpenThread options set(OT_BUILD_EXECUTABLES OFF CACHE BOOL "Disable OpenThread samples") set(OT_BUILTIN_MBEDTLS_MANAGEMENT OFF CACHE BOOL "Use Zephyr's mbedTLS heap") @@ -36,95 +28,494 @@ elseif(CONFIG_OPENTHREAD_MTD) set(OT_MTD ON CACHE BOOL "Enable MTD" FORCE) endif() -kconfig_to_ot_option(CONFIG_OPENTHREAD_ANYCAST_LOCATOR OT_ANYCAST_LOCATOR "Enable anycast locator") -kconfig_to_ot_option(CONFIG_ASSERT OT_ASSERT "Enable assert function OT_ASSERT()") -kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER OT_BACKBONE_ROUTER "Enable backbone router functionality") -kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER_DUA_NDPROXYING OT_BACKBONE_ROUTER_DUA_NDPROXYING "Enable BBR DUA ND Proxy support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER_MULTICAST_ROUTING OT_BACKBONE_ROUTER_MULTICAST_ROUTING "Enable BBR MR support") -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_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") -kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING_DHCP6_PD OT_BORDER_ROUTING_DHCP6_PD "DHCPv6-PD support in border routing") -kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MANAGER OT_CHANNEL_MANAGER "Enable channel manager support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_CHANNEL_MONITOR OT_CHANNEL_MONITOR "Enable channel monitor support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP OT_COAP "Enable CoAP API") -kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP_BLOCK OT_COAP_BLOCK "Enable CoAP Block-wise option support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_COAP_OBSERVE OT_COAP_OBSERVE "Enable CoAP Observe option support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_COAPS OT_COAPS "Enable secure CoAP API support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_COMMISSIONER OT_COMMISSIONER "Enable Commissioner") -kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_AUTO_SYNC OT_CSL_AUTO_SYNC "Enable csl autosync") -kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_DEBUG OT_CSL_DEBUG "Enable CSL debug") -kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_RECEIVER OT_CSL_RECEIVER "Enable CSL receiver feature for Thread 1.2") -kconfig_to_ot_option(CONFIG_OPENTHREAD_CSL_RECEIVER_LOCAL_TIME_SYNC OT_CSL_RECEIVER_LOCAL_TIME_SYNC "Use local time for CSL sync") -kconfig_to_ot_option(CONFIG_OPENTHREAD_DATASET_UPDATER OT_DATASET_UPDATER "Enable Dataset updater") -kconfig_to_ot_option(CONFIG_OPENTHREAD_DEVICE_PROP_LEADER_WEIGHT OT_DEVICE_PROP_LEADER_WEIGHT "Enable device props for leader weight") -kconfig_to_ot_option(CONFIG_OPENTHREAD_DHCP6_CLIENT OT_DHCP6_CLIENT "Enable DHCPv6 Client") -kconfig_to_ot_option(CONFIG_OPENTHREAD_DHCP6_SERVER OT_DHCP6_SERVER "Enable DHCPv6 Server") -kconfig_to_ot_option(CONFIG_OPENTHREAD_DIAG OT_DIAGNOSTIC "Enable Diagnostics support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_CLIENT OT_DNS_CLIENT "Enable DNS client support") -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_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_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") -kconfig_to_ot_option(CONFIG_OPENTHREAD_FIREWALL OT_FIREWALL "Enable firewall") -kconfig_to_ot_option(CONFIG_OPENTHREAD_FULL_LOGS OT_FULL_LOGS "Enable full logs") -kconfig_to_ot_option(CONFIG_OPENTHREAD_HISTORY_TRACKER OT_HISTORY_TRACKER "Enable history tracker support.") -kconfig_to_ot_option(CONFIG_OPENTHREAD_IP6_FRAGM OT_IP6_FRAGM "Enable IPv6 fragmentation support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_JAM_DETECTION OT_JAM_DETECTION "Enable Jam Detection") -kconfig_to_ot_option(CONFIG_OPENTHREAD_JOINER OT_JOINER "Enable Joiner") -kconfig_to_ot_option(CONFIG_OPENTHREAD_LEGACY OT_LEGACY "Enable legacy network support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_INITIATOR OT_LINK_METRICS_INITIATOR "Enable Link Metrics initiator for Thread 1.2") -kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_MANAGER OT_LINK_METRICS_MANAGER "Enable Link Metrics manager for Thread 1.2") -kconfig_to_ot_option(CONFIG_OPENTHREAD_LINK_METRICS_SUBJECT OT_LINK_METRICS_SUBJECT "Enable Link Metrics subject for Thread 1.2") -kconfig_to_ot_option(CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC OT_LOG_LEVEL_DYNAMIC "Enable dynamic log level control") -kconfig_to_ot_option(CONFIG_OPENTHREAD_MAC_FILTER OT_MAC_FILTER "Enable MAC filter support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_MESH_DIAG OT_MESH_DIAG "Enable Mesh Diagnostics") -kconfig_to_ot_option(CONFIG_OPENTHREAD_MESSAGE_USE_HEAP OT_MESSAGE_USE_HEAP "Enable heap allocator for message buffers") -kconfig_to_ot_option(CONFIG_OPENTHREAD_MLE_LONG_ROUTES OT_MLE_LONG_ROUTES "Enable MLE long routes support (Experimental)") -kconfig_to_ot_option(CONFIG_OPENTHREAD_MLR OT_MLR "Enable Multicast Listener Registration feature for Thread 1.2") -kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTIPAN_RCP OT_MULTIPAN_RCP "Enable Multi-PAN RCP") -kconfig_to_ot_option(CONFIG_OPENTHREAD_MULTIPLE_INSTANCE OT_MULTIPLE_INSTANCE "Enable multiple instances") -kconfig_to_ot_option(CONFIG_OPENTHREAD_NAT64_BORDER_ROUTING OT_NAT64_BORDER_ROUTING "Enable border routing NAT64 support") -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_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") -kconfig_to_ot_option(CONFIG_OPENTHREAD_PING_SENDER OT_PING_SENDER "Enable ping sender support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_KEY_REF OT_PLATFORM_KEY_REF "Enable platform key reference support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_NETIF OT_PLATFORM_NETIF "Enable platform netif support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_PLATFORM_UDP OT_PLATFORM_UDP "Enable platform UDP support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_RADIO_LINK_IEEE_802_15_4_ENABLE OT_15_4 "Enable 802.15.4 radio") -kconfig_to_ot_option(CONFIG_OPENTHREAD_RAW OT_LINK_RAW "Enable Link Raw") -kconfig_to_ot_option(CONFIG_OPENTHREAD_REFERENCE_DEVICE OT_REFERENCE_DEVICE "Enable Thread Certification Reference Device") -kconfig_to_ot_option(CONFIG_OPENTHREAD_SETTINGS_RAM OT_SETTINGS_RAM "Enable volatile-only storage of settings") -kconfig_to_ot_option(CONFIG_OPENTHREAD_SLAAC OT_SLAAC "Enable SLAAC") -kconfig_to_ot_option(CONFIG_OPENTHREAD_SNTP_CLIENT OT_SNTP_CLIENT "Enable SNTP Client support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_CLIENT OT_SRP_CLIENT "Enable SRP Client support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_SRP_SERVER OT_SRP_SERVER "Enable SRP Server support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_TCP_ENABLE OT_TCP "Enable TCP support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_TIME_SYNC OT_TIME_SYNC "Enable the time synchronization service feature") -kconfig_to_ot_option(CONFIG_OPENTHREAD_TREL OT_TREL "Enable TREL radio link for Thread over Infrastructure feature") -kconfig_to_ot_option(CONFIG_OPENTHREAD_TX_BEACON_PAYLOAD OT_TX_BEACON_PAYLOAD "Enable tx beacon payload support") -kconfig_to_ot_option(CONFIG_OPENTHREAD_TX_QUEUE_STATISTICS OT_TX_QUEUE_STATS "Enable tx queue statistics") -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") +if(CONFIG_OPENTHREAD_ANYCAST_LOCATOR) + set(OT_ANYCAST_LOCATOR ON CACHE BOOL "Enable anycast locator" FORCE) +else() + set(OT_ANYCAST_LOCATOR OFF CACHE BOOL "Enable anycast locator" FORCE) +endif() -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) +if(CONFIG_ASSERT) + set(OT_ASSERT ON CACHE BOOL "Enable assert function OT_ASSERT()" FORCE) +else() + set(OT_ASSERT OFF CACHE BOOL "Enable assert function OT_ASSERT()" FORCE) +endif() + +if(CONFIG_OPENTHREAD_BACKBONE_ROUTER) + set(OT_BACKBONE_ROUTER ON CACHE BOOL "Enable backbone router functionality" FORCE) +else() + set(OT_BACKBONE_ROUTER OFF CACHE BOOL "Enable backbone router functionality" FORCE) +endif() + +if(CONFIG_OPENTHREAD_BACKBONE_ROUTER_DUA_NDPROXYING) + set(OT_BACKBONE_ROUTER_DUA_NDPROXYING ON CACHE BOOL "Enable BBR DUA ND Proxy support" FORCE) +else() + set(OT_BACKBONE_ROUTER_DUA_NDPROXYING OFF CACHE BOOL "Enable BBR DUA ND Proxy support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_BACKBONE_ROUTER_MULTICAST_ROUTING) + set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING ON CACHE BOOL "Enable BBR MR support" FORCE) +else() + set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OFF CACHE BOOL "Enable BBR MR support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_BLE_TCAT) + set(OT_BLE_TCAT ON CACHE BOOL "Enable BLE TCAT support" FORCE) +else() + set(OT_BLE_TCAT OFF CACHE BOOL "Enable BLE TCAT support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_BORDER_AGENT) + set(OT_BORDER_AGENT ON CACHE BOOL "Enable Border Agent" FORCE) +else() + set(OT_BORDER_AGENT OFF CACHE BOOL "Enable Border Agent" FORCE) +endif() + +if(CONFIG_OPENTHREAD_BORDER_ROUTER) + set(OT_BORDER_ROUTER ON CACHE BOOL "Enable Border Router" FORCE) +else() + set(OT_BORDER_ROUTER OFF CACHE BOOL "Enable Border Router" FORCE) +endif() + +if(CONFIG_OPENTHREAD_BORDER_ROUTING) + set(OT_BORDER_ROUTING ON CACHE BOOL "Enable Border routing" FORCE) +else() + set(OT_BORDER_ROUTING OFF CACHE BOOL "Enable Border routing" FORCE) +endif() + +if(CONFIG_OPENTHREAD_BORDER_ROUTING_COUNTERS) + set(OT_BORDER_ROUTING_COUNTERS ON CACHE BOOL "Enable Border routing counters" FORCE) +else() + set(OT_BORDER_ROUTING_COUNTERS OFF CACHE BOOL "Enable Border routing counters" FORCE) +endif() + +if(CONFIG_OPENTHREAD_BORDER_ROUTING_DHCP6_PD) + set(OT_BORDER_ROUTING_DHCP6_PD ON CACHE BOOL "DHCPv6-PD support in border routing" FORCE) +else() + set(OT_BORDER_ROUTING_DHCP6_PD OFF CACHE BOOL "DHCPv6-PD support in border routing" FORCE) +endif() + +if(CONFIG_OPENTHREAD_CHANNEL_MANAGER) + set(OT_CHANNEL_MANAGER ON CACHE BOOL "Enable channel manager support" FORCE) +else() + set(OT_CHANNEL_MANAGER OFF CACHE BOOL "Enable channel manager support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_CHANNEL_MONITOR) + set(OT_CHANNEL_MONITOR ON CACHE BOOL "Enable channel monitor support" FORCE) +else() + set(OT_CHANNEL_MONITOR OFF CACHE BOOL "Enable channel monitor support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_COAP) + set(OT_COAP ON CACHE BOOL "Enable CoAP API" FORCE) +else() + set(OT_COAP OFF CACHE BOOL "Enable CoAP API" FORCE) +endif() + +if(CONFIG_OPENTHREAD_COAP_BLOCK) + set(OT_COAP_BLOCK ON CACHE BOOL "Enable CoAP Block-wise option support" FORCE) +else() + set(OT_COAP_BLOCK OFF CACHE BOOL "Enable CoAP Block-wise option support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_COAP_OBSERVE) + set(OT_COAP_OBSERVE ON CACHE BOOL "Enable CoAP Observe option support" FORCE) +else() + set(OT_COAP_OBSERVE OFF CACHE BOOL "Enable CoAP Observe option support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_COAPS) + set(OT_COAPS ON CACHE BOOL "Enable secure CoAP API support" FORCE) +else() + set(OT_COAPS OFF CACHE BOOL "Enable secure CoAP API support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_COMMISSIONER) + set(OT_COMMISSIONER ON CACHE BOOL "Enable Commissioner" FORCE) +else() + set(OT_COMMISSIONER OFF CACHE BOOL "Enable Commissioner" FORCE) +endif() + +if(CONFIG_OPENTHREAD_CSL_AUTO_SYNC) + set(OT_CSL_AUTO_SYNC ON CACHE BOOL "Enable csl autosync" FORCE) +else() + set(OT_CSL_AUTO_SYNC OFF CACHE BOOL "Enable csl autosync" FORCE) +endif() + +if(CONFIG_OPENTHREAD_CSL_DEBUG) + set(OT_CSL_DEBUG ON CACHE BOOL "Enable CSL debug" FORCE) +else() + set(OT_CSL_DEBUG OFF CACHE BOOL "Enable CSL debug" FORCE) +endif() + +if(CONFIG_OPENTHREAD_CSL_RECEIVER) + set(OT_CSL_RECEIVER ON CACHE BOOL "Enable CSL receiver feature for Thread 1.2" FORCE) +else() + set(OT_CSL_RECEIVER OFF CACHE BOOL "Enable CSL receiver feature for Thread 1.2" FORCE) +endif() + +if(CONFIG_OPENTHREAD_CSL_RECEIVER_LOCAL_TIME_SYNC) + set(OT_CSL_RECEIVER_LOCAL_TIME_SYNC ON CACHE BOOL "Use local time for CSL sync" FORCE) +else() + set(OT_CSL_RECEIVER_LOCAL_TIME_SYNC OFF CACHE BOOL "Use local time for CSL sync" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DATASET_UPDATER) + set(OT_DATASET_UPDATER ON CACHE BOOL "Enable Dataset updater" FORCE) +else() + set(OT_DATASET_UPDATER OFF CACHE BOOL "Enable Dataset updater" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DEVICE_PROP_LEADER_WEIGHT) + set(OT_DEVICE_PROP_LEADER_WEIGHT ON CACHE BOOL "Enable device props for leader weight" FORCE) +else() + set(OT_DEVICE_PROP_LEADER_WEIGHT OFF CACHE BOOL "Enable device props for leader weight" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DHCP6_CLIENT) + set(OT_DHCP6_CLIENT ON CACHE BOOL "Enable DHCPv6 Client" FORCE) +else() + set(OT_DHCP6_CLIENT OFF CACHE BOOL "Enable DHCPv6 Client" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DHCP6_SERVER) + set(OT_DHCP6_SERVER ON CACHE BOOL "Enable DHCPv6 Server" FORCE) +else() + set(OT_DHCP6_SERVER OFF CACHE BOOL "Enable DHCPv6 Server" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DIAG) + set(OT_DIAGNOSTIC ON CACHE BOOL "Enable Diagnostics support" FORCE) +else() + set(OT_DIAGNOSTIC OFF CACHE BOOL "Enable Diagnostics support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DNS_CLIENT) + set(OT_DNS_CLIENT ON CACHE BOOL "Enable DNS client support" FORCE) +else() + set(OT_DNS_CLIENT OFF CACHE BOOL "Enable DNS client support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DNS_CLIENT_OVER_TCP) + set(OT_DNS_CLIENT_OVER_TCP ON CACHE BOOL "Enable dns query over tcp" FORCE) +else() + set(OT_DNS_CLIENT_OVER_TCP OFF CACHE BOOL "Enable dns query over tcp" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DNS_DSO) + set(OT_DNS_DSO ON CACHE BOOL "Enable DNS Stateful Operations (DSO) support" FORCE) +else() + set(OT_DNS_DSO OFF CACHE BOOL "Enable DNS Stateful Operations (DSO) support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DNS_UPSTREAM_QUERY) + set(OT_DNS_UPSTREAM_QUERY ON CACHE BOOL "Enable forwarding DNS queries to upstream" FORCE) +else() + set(OT_DNS_UPSTREAM_QUERY OFF CACHE BOOL "Enable forwarding DNS queries to upstream" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DNSSD_SERVER) + set(OT_DNSSD_SERVER ON CACHE BOOL "Enable DNS-SD server support" FORCE) +else() + set(OT_DNSSD_SERVER OFF CACHE BOOL "Enable DNS-SD server support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_DUA) + set(OT_DUA ON CACHE BOOL "Enable Domain Unicast Address feature for Thread 1.2" FORCE) +else() + set(OT_DUA OFF CACHE BOOL "Enable Domain Unicast Address feature for Thread 1.2" FORCE) +endif() + +if(CONFIG_OPENTHREAD_ECDSA) + set(OT_ECDSA ON CACHE BOOL "Enable ECDSA support" FORCE) +else() + set(OT_ECDSA OFF CACHE BOOL "Enable ECDSA support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_ENABLE_SERVICE) + set(OT_SERVICE ON CACHE BOOL "Enable Service entries in Thread Network Data" FORCE) +else() + set(OT_SERVICE OFF CACHE BOOL "Enable Service entries in Thread Network Data" FORCE) +endif() + +if(CONFIG_OPENTHREAD_EXTERNAL_HEAP) + set(OT_EXTERNAL_HEAP ON CACHE BOOL "Enable external heap support" FORCE) +else() + set(OT_EXTERNAL_HEAP OFF CACHE BOOL "Enable external heap support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_FIREWALL) + set(OT_FIREWALL ON CACHE BOOL "Enable firewall" FORCE) +else() + set(OT_FIREWALL OFF CACHE BOOL "Enable firewall" FORCE) +endif() + +if(CONFIG_OPENTHREAD_FULL_LOGS) + set(OT_FULL_LOGS ON CACHE BOOL "Enable full logs" FORCE) +else() + set(OT_FULL_LOGS OFF CACHE BOOL "Enable full logs" FORCE) +endif() + +if(CONFIG_OPENTHREAD_HISTORY_TRACKER) + set(OT_HISTORY_TRACKER ON CACHE BOOL "Enable history tracker support." FORCE) +else() + set(OT_HISTORY_TRACKER OFF CACHE BOOL "Enable history tracker support." FORCE) +endif() + +if(CONFIG_OPENTHREAD_IP6_FRAGM) + set(OT_IP6_FRAGM ON CACHE BOOL "Enable IPv6 fragmentation support" FORCE) +else() + set(OT_IP6_FRAGM OFF CACHE BOOL "Enable IPv6 fragmentation support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_JAM_DETECTION) + set(OT_JAM_DETECTION ON CACHE BOOL "Enable Jam Detection" FORCE) +else() + set(OT_JAM_DETECTION OFF CACHE BOOL "Enable Jam Detection" FORCE) +endif() + +if(CONFIG_OPENTHREAD_JOINER) + set(OT_JOINER ON CACHE BOOL "Enable Joiner" FORCE) +else() + set(OT_JOINER OFF CACHE BOOL "Enable Joiner" FORCE) +endif() + +if(CONFIG_OPENTHREAD_LEGACY) + set(OT_LEGACY ON CACHE BOOL "Enable legacy network support" FORCE) +else() + set(OT_LEGACY OFF CACHE BOOL "Enable legacy network support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_LINK_METRICS_INITIATOR) + set(OT_LINK_METRICS_INITIATOR ON CACHE BOOL "Enable Link Metrics initiator for Thread 1.2" FORCE) +else() + set(OT_LINK_METRICS_INITIATOR OFF CACHE BOOL "Enable Link Metrics initiator for Thread 1.2" FORCE) +endif() + +if(CONFIG_OPENTHREAD_LINK_METRICS_MANAGER) + set(OT_LINK_METRICS_MANAGER ON CACHE BOOL "Enable Link Metrics manager for Thread 1.2" FORCE) +else() + set(OT_LINK_METRICS_MANAGER OFF CACHE BOOL "Enable Link Metrics manager for Thread 1.2" FORCE) +endif() + +if(CONFIG_OPENTHREAD_LINK_METRICS_SUBJECT) + set(OT_LINK_METRICS_SUBJECT ON CACHE BOOL "Enable Link Metrics subject for Thread 1.2" FORCE) +else() + set(OT_LINK_METRICS_SUBJECT OFF CACHE BOOL "Enable Link Metrics subject for Thread 1.2" FORCE) +endif() + +if(CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC) + set(OT_LOG_LEVEL_DYNAMIC ON CACHE BOOL "Enable dynamic log level control" FORCE) +else() + set(OT_LOG_LEVEL_DYNAMIC OFF CACHE BOOL "Enable dynamic log level control" FORCE) +endif() + +if(CONFIG_OPENTHREAD_MAC_FILTER) + set(OT_MAC_FILTER ON CACHE BOOL "Enable MAC filter support" FORCE) +else() + set(OT_MAC_FILTER OFF CACHE BOOL "Enable MAC filter support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_MESH_DIAG) + set(OT_MESH_DIAG ON CACHE BOOL "Enable Mesh Diagnostics" FORCE) +else() + set(OT_MESH_DIAG OFF CACHE BOOL "Enable Mesh Diagnostics" FORCE) +endif() + +if(CONFIG_OPENTHREAD_MESSAGE_USE_HEAP) + set(OT_MESSAGE_USE_HEAP ON CACHE BOOL "Enable heap allocator for message buffers" FORCE) +else() + set(OT_MESSAGE_USE_HEAP OFF CACHE BOOL "Enable heap allocator for message buffers" FORCE) +endif() + +if(CONFIG_OPENTHREAD_MLE_LONG_ROUTES) + set(OT_MLE_LONG_ROUTES ON CACHE BOOL "Enable MLE long routes support (Experimental)" FORCE) +else() + set(OT_MLE_LONG_ROUTES OFF CACHE BOOL "Enable MLE long routes support (Experimental)" FORCE) +endif() + +if(CONFIG_OPENTHREAD_MLR) + set(OT_MLR ON CACHE BOOL "Enable Multicast Listener Registration feature for Thread 1.2" FORCE) +else() + set(OT_MLR OFF CACHE BOOL "Enable Multicast Listener Registration feature for Thread 1.2" FORCE) +endif() + +if(CONFIG_OPENTHREAD_MULTIPAN_RCP) + set(OT_MULTIPAN_RCP ON CACHE BOOL "Enable Multi-PAN RCP" FORCE) +else() + set(OT_MULTIPAN_RCP OFF CACHE BOOL "Enable Multi-PAN RCP" FORCE) +endif() + +if(CONFIG_OPENTHREAD_MULTIPLE_INSTANCE) + set(OT_MULTIPLE_INSTANCE ON CACHE BOOL "Enable multiple instances" FORCE) +else() + set(OT_MULTIPLE_INSTANCE OFF CACHE BOOL "Enable multiple instances" FORCE) +endif() + +if(CONFIG_OPENTHREAD_NAT64_BORDER_ROUTING) + set(OT_NAT64_BORDER_ROUTING ON CACHE BOOL "Enable border routing NAT64 support" FORCE) +else() + set(OT_NAT64_BORDER_ROUTING OFF CACHE BOOL "Enable border routing NAT64 support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_NAT64_TRANSLATOR) + set(OT_NAT64_TRANSLATOR ON CACHE BOOL "Enable NAT64 translator" FORCE) +else() + set(OT_NAT64_TRANSLATOR OFF CACHE BOOL "Enable NAT64 translator" FORCE) +endif() + +if(CONFIG_OPENTHREAD_NEIGHBOR_DISCOVERY_AGENT) + set(OT_NEIGHBOR_DISCOVERY_AGENT ON CACHE BOOL "Enable neighbor discovery agent support" FORCE) +else() + set(OT_NEIGHBOR_DISCOVERY_AGENT OFF CACHE BOOL "Enable neighbor discovery agent support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_NETDIAG_CLIENT) + set(OT_NETDIAG_CLIENT ON CACHE BOOL "Enable TMF network diagnostics on clients" FORCE) +else() + set(OT_NETDIAG_CLIENT OFF CACHE BOOL "Enable TMF network diagnostics on clients" FORCE) +endif() + +if(CONFIG_OPENTHREAD_NETDATA_PUBLISHER) + set(OT_NETDATA_PUBLISHER ON CACHE BOOL "Enable Thread Network Data publisher" FORCE) +else() + set(OT_NETDATA_PUBLISHER OFF CACHE BOOL "Enable Thread Network Data publisher" FORCE) +endif() + +if(CONFIG_OPENTHREAD_OPERATIONAL_DATASET_AUTO_INIT) + set(OT_OPERATIONAL_DATASET_AUTO_INIT ON CACHE BOOL "Enable operational dataset auto init" FORCE) +else() + set(OT_OPERATIONAL_DATASET_AUTO_INIT OFF CACHE BOOL "Enable operational dataset auto init" FORCE) +endif() + +if(CONFIG_OPENTHREAD_OTNS) + set(OT_OTNS ON CACHE BOOL "Enable OTNS support" FORCE) +else() + set(OT_OTNS OFF CACHE BOOL "Enable OTNS support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_PING_SENDER) + set(OT_PING_SENDER ON CACHE BOOL "Enable ping sender support" FORCE) +else() + set(OT_PING_SENDER OFF CACHE BOOL "Enable ping sender support" FORCE) +endif() + +if(OPENTHREAD_PLATFORM_KEY_REF) + set(OT_PLATFORM_KEY_REF ON CACHE BOOL "Enable platform key reference support" FORCE) +else() + set(OT_PLATFORM_KEY_REF OFF CACHE BOOL "Enable platform key reference support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_PLATFORM_NETIF) + set(OT_PLATFORM_NETIF ON CACHE BOOL "Enable platform netif support" FORCE) +else() + set(OT_PLATFORM_NETIF OFF CACHE BOOL "Enable platform netif support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_PLATFORM_UDP) + set(OT_PLATFORM_UDP ON CACHE BOOL "Enable platform UDP support" FORCE) +else() + set(OT_PLATFORM_UDP OFF CACHE BOOL "Enable platform UDP support" FORCE) endif() if(CONFIG_OPENTHREAD_POWER_SUPPLY) set(OT_POWER_SUPPLY ${CONFIG_OPENTHREAD_POWER_SUPPLY} CACHE STRING "Power supply configuration" FORCE) endif() +if(CONFIG_OPENTHREAD_RADIO_LINK_IEEE_802_15_4_ENABLE) + set(OT_15_4 ON CACHE BOOL "Enable 802.15.4 radio" FORCE) +else() + set(OT_15_4 OFF CACHE BOOL "Enable 802.15.4 radio" FORCE) +endif() + +if(CONFIG_OPENTHREAD_RAW) + set(OT_LINK_RAW ON CACHE BOOL "Enable Link Raw" FORCE) +else() + set(OT_LINK_RAW OFF CACHE BOOL "Enable Link Raw" FORCE) +endif() + +if(CONFIG_OPENTHREAD_REFERENCE_DEVICE) + set(OT_REFERENCE_DEVICE ON CACHE BOOL "Enable Thread Certification Reference Device" FORCE) +else() + set(OT_REFERENCE_DEVICE OFF CACHE BOOL "Enable Thread Certification Reference Device" FORCE) +endif() + +if(CONFIG_OPENTHREAD_SETTINGS_RAM) + set(OT_SETTINGS_RAM ON CACHE BOOL "Enable volatile-only storage of settings" FORCE) +else() + set(OT_SETTINGS_RAM OFF CACHE BOOL "Enable volatile-only storage of settings" FORCE) +endif() + +if(CONFIG_OPENTHREAD_SLAAC) + set(OT_SLAAC ON CACHE BOOL "Enable SLAAC" FORCE) +else() + set(OT_SLAAC OFF CACHE BOOL "Enable SLAAC" FORCE) +endif() + +if(CONFIG_OPENTHREAD_SNTP_CLIENT) + set(OT_SNTP_CLIENT ON CACHE BOOL "Enable SNTP Client support" FORCE) +else() + set(OT_SNTP_CLIENT OFF CACHE BOOL "Enable SNTP Client support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_SRP_CLIENT) + set(OT_SRP_CLIENT ON CACHE BOOL "Enable SRP Client support" FORCE) +else() + set(OT_SRP_CLIENT OFF CACHE BOOL "Enable SRP Client support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_SRP_SERVER) + set(OT_SRP_SERVER ON CACHE BOOL "Enable SRP Server support" FORCE) +else() + set(OT_SRP_SERVER OFF CACHE BOOL "Enable SRP Server support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_TCP_ENABLE) + set(OT_TCP ON CACHE BOOL "Enable TCP support" FORCE) +else() + set(OT_TCP OFF CACHE BOOL "Enable TCP support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_TIME_SYNC) + set(OT_TIME_SYNC ON CACHE BOOL "Enable the time synchronization service feature" FORCE) +else() + set(OT_TIME_SYNC OFF CACHE BOOL "Enable the time synchronization service feature" FORCE) +endif() + +if(CONFIG_OPENTHREAD_TREL) + set(OT_TREL ON CACHE BOOL "Enable TREL radio link for Thread over Infrastructure feature" FORCE) +else() + set(OT_TREL OFF CACHE BOOL "Enable TREL radio link for Thread over Infrastructure feature" FORCE) +endif() + +if(CONFIG_OPENTHREAD_TX_BEACON_PAYLOAD) + set(OT_TX_BEACON_PAYLOAD ON CACHE BOOL "Enable tx beacon payload support" FORCE) +else() + set(OT_TX_BEACON_PAYLOAD OFF CACHE BOOL "Enable tx beacon payload support" FORCE) +endif() + +if(CONFIG_OPENTHREAD_TX_QUEUE_STATISTICS) + set(OT_TX_QUEUE_STATS ON CACHE BOOL "Enable tx queue statistics" FORCE) +else() + set(OT_TX_QUEUE_STATS OFF CACHE BOOL "Enable tx queue statistics" FORCE) +endif() + +if(CONFIG_OPENTHREAD_UDP_FORWARD) + set(OT_UDP_FORWARD ON CACHE BOOL "Enable UDP forward feature" FORCE) +else() + set(OT_UDP_FORWARD OFF CACHE BOOL "Enable UDP forward feature" FORCE) +endif() + +if(CONFIG_OPENTHREAD_UPTIME) + set(OT_UPTIME ON CACHE BOOL "Enable support for tracking OpenThread instance's uptime" FORCE) +else() + set(OT_UPTIME OFF CACHE BOOL "Enable support for tracking OpenThread instance's uptime" FORCE) +endif() + +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) +endif() + set(BUILD_TESTING OFF CACHE BOOL "Disable openthread cmake testing targets" FORCE) # Zephyr logging options From 0276745e13b3b1f5fed7d22ea7d9e7e4b7740cab Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:56 +0100 Subject: [PATCH 1208/2300] Revert "[nrf fromtree] net: openthread: upmerge to `75694d2`" This reverts commit 7b5a880d8e8fa917a9f95bdcdfe70ccd6c8e4a21. Signed-off-by: Robert Lubos --- modules/openthread/CMakeLists.txt | 6 ------ modules/openthread/Kconfig.features | 6 ------ .../platform/openthread-core-zephyr-config.h | 10 ++++++++++ subsys/net/l2/openthread/Kconfig | 10 ++++++++-- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 150039863d9..646b086ef1e 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -400,12 +400,6 @@ else() set(OT_PING_SENDER OFF CACHE BOOL "Enable ping sender support" FORCE) endif() -if(OPENTHREAD_PLATFORM_KEY_REF) - set(OT_PLATFORM_KEY_REF ON CACHE BOOL "Enable platform key reference support" FORCE) -else() - set(OT_PLATFORM_KEY_REF OFF CACHE BOOL "Enable platform key reference support" FORCE) -endif() - if(CONFIG_OPENTHREAD_PLATFORM_NETIF) set(OT_PLATFORM_NETIF ON CACHE BOOL "Enable platform netif support" FORCE) else() diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index 952a7853b43..2be5332cde3 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -249,12 +249,6 @@ config OPENTHREAD_OTNS config OPENTHREAD_PING_SENDER bool "Ping sender support" -config OPENTHREAD_PLATFORM_KEY_REF - bool "Platform cryptographic key reference support" - help - Enable usage of cryptographic key references instead of literal keys. - This requires a crypto backend library that supports key references. - config OPENTHREAD_PLATFORM_NETIF bool "Platform netif support" diff --git a/modules/openthread/platform/openthread-core-zephyr-config.h b/modules/openthread/platform/openthread-core-zephyr-config.h index 773cd170f2c..881585e5578 100644 --- a/modules/openthread/platform/openthread-core-zephyr-config.h +++ b/modules/openthread/platform/openthread-core-zephyr-config.h @@ -396,6 +396,16 @@ #define OPENTHREAD_CONFIG_CRYPTO_LIB OPENTHREAD_CONFIG_CRYPTO_LIB_PSA #endif +/** + * @def OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE + * + * Set to 1 if you want to enable key reference usage support. + * + */ +#ifdef CONFIG_OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE 1 +#endif + /** * @def OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE * diff --git a/subsys/net/l2/openthread/Kconfig b/subsys/net/l2/openthread/Kconfig index aa7e03b8204..98113975797 100644 --- a/subsys/net/l2/openthread/Kconfig +++ b/subsys/net/l2/openthread/Kconfig @@ -324,15 +324,21 @@ config OPENTHREAD_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE config OPENTHREAD_CRYPTO_PSA bool "ARM PSA crypto API" depends on MBEDTLS_PSA_CRYPTO_C || BUILD_WITH_TFM - select OPENTHREAD_PLATFORM_KEY_REF + select OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE select OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE help Enable crypto backend library implementation based on ARM PSA crypto API instead of the default, using mbedTLS. +config OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE + bool "Cryptographic key reference support" + help + Enable usage of cryptographic key references instead of literal keys + This requires a crypto backend library that supports key references. + config OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE bool "Make MAC keys exportable" - depends on OPENTHREAD_PLATFORM_KEY_REF + depends on OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE help Enable the creation of exportable MAC keys in the OpenThread Key Manager. From 2933b0d35300d110b978a6f502d7e21aef68d4bd Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:56 +0100 Subject: [PATCH 1209/2300] Revert "[nrf fromtree] drivers: nrf_qspi_nor: Deactivate QSPI peripheral after initialization" This reverts commit f3c9eaa01babbec87062e294e0c686ae2588d3b5. Signed-off-by: Robert Lubos --- drivers/flash/nrf_qspi_nor.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 0e9d4181418..d6695989857 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -1090,10 +1090,6 @@ static int qspi_nor_init(const struct device *dev) qspi_clock_div_restore(); - if (!IS_ENABLED(CONFIG_NORDIC_QSPI_NOR_XIP) && nrfx_qspi_init_check()) { - (void)nrfx_qspi_deactivate(); - } - #ifdef CONFIG_PM_DEVICE_RUNTIME int rc2 = pm_device_runtime_enable(dev); From 2296e0ddaecb9b46f53aff1be5d8736590162b2a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:56 +0100 Subject: [PATCH 1210/2300] Revert "[nrf fromlist] wifi: shell: Log errors for validation" This reverts commit 5398fb4fd71a0b2663a532982a6894cdf75a3c08. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 43 +++------------------------------ 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index f470e700f8c..49459774655 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -48,8 +48,6 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); NET_EVENT_WIFI_SCAN_RESULT) #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY */ -#define MAX_BANDS_STR_LEN 64 - static struct { const struct shell *sh; @@ -446,8 +444,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], int idx = 1; if (argc < 1) { - print(context.sh, SHELL_WARNING, - "SSID not specified\n"); return -EINVAL; } @@ -460,9 +456,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->ssid = argv[0]; params->ssid_length = strlen(params->ssid); if (params->ssid_length > WIFI_SSID_MAX_LEN) { - print(context.sh, SHELL_WARNING, - "SSID too long (max %d characters)\n", - WIFI_SSID_MAX_LEN); return -EINVAL; } @@ -471,11 +464,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], long channel = strtol(argv[idx], &endptr, 10); if (*endptr != '\0') { - print(context.sh, SHELL_ERROR, - "Failed to parse channel: %s: endp: %s, err: %s\n", - argv[idx], - endptr, - strerror(errno)); return -EINVAL; } @@ -487,23 +475,8 @@ static int __wifi_args_to_params(size_t argc, char *argv[], WIFI_FREQ_BAND_6_GHZ}; uint8_t band; bool found = false; - char bands_str[MAX_BANDS_STR_LEN] = {0}; - size_t offset = 0; for (band = 0; band < ARRAY_SIZE(bands); band++) { - offset += snprintf(bands_str + offset, - sizeof(bands_str) - offset, - "%s%s", - band ? "," : "", - wifi_band_txt(bands[band])); - if (offset >= sizeof(bands_str)) { - print(context.sh, SHELL_ERROR, - "Failed to parse channel: %s: " - "band string too long\n", - argv[idx]); - return -EINVAL; - } - if (wifi_utils_validate_chan(bands[band], channel)) { found = true; @@ -512,10 +485,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], } if (!found) { - print(context.sh, SHELL_ERROR, - "Invalid channel: %ld, checked bands: %s\n", - channel, - bands_str); return -EINVAL; } @@ -548,9 +517,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (security == WIFI_SECURITY_TYPE_NONE || security == WIFI_SECURITY_TYPE_WPA_PSK) { - print(context.sh, SHELL_ERROR, - "MFP not supported for security type %s\n", - wifi_security_txt(security)); return -EINVAL; } @@ -566,10 +532,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], params->psk_length > WIFI_PSK_MAX_LEN) || (params->security == WIFI_SECURITY_TYPE_SAE && params->psk_length > WIFI_SAE_PSWD_MAX_LEN)) { - print(context.sh, SHELL_ERROR, - "Invalid PSK length (%d) for security type %s\n", - params->psk_length, - wifi_security_txt(params->security)); return -EINVAL; } } @@ -584,13 +546,13 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, struct net_if *iface = net_if_get_first_wifi(); struct wifi_connect_req_params cnx_params = { 0 }; - context.sh = sh; if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_INFRA)) { shell_help(sh); return -ENOEXEC; } context.connecting = true; + context.sh = sh; if (net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, &cnx_params, sizeof(struct wifi_connect_req_params))) { @@ -1269,12 +1231,13 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, static struct wifi_connect_req_params cnx_params; int ret; - context.sh = sh; if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); return -ENOEXEC; } + context.sh = sh; + k_mutex_init(&wifi_ap_sta_list_lock); ret = net_mgmt(NET_REQUEST_WIFI_AP_ENABLE, iface, &cnx_params, From 951e5a7fa2fb33ae50fc34c24968658b5269c492 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:57 +0100 Subject: [PATCH 1211/2300] Revert "[nrf fromlist] wifi: shell: Fix the channel extraction" This reverts commit 7927411d52ae2c7c945ad4ef2bd37e7fa2073db4. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 49459774655..01a76359702 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -461,13 +461,12 @@ static int __wifi_args_to_params(size_t argc, char *argv[], /* Channel (optional: STA, mandatory: AP) */ if ((idx < argc) && (strlen(argv[idx]) <= 3)) { - long channel = strtol(argv[idx], &endptr, 10); - + params->channel = strtol(argv[idx], &endptr, 10); if (*endptr != '\0') { return -EINVAL; } - if (iface_mode == WIFI_MODE_INFRA && channel == 0) { + if (iface_mode == WIFI_MODE_INFRA && params->channel == 0) { params->channel = WIFI_CHANNEL_ANY; } else { const uint8_t bands[] = {WIFI_FREQ_BAND_2_4_GHZ, @@ -478,7 +477,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], for (band = 0; band < ARRAY_SIZE(bands); band++) { if (wifi_utils_validate_chan(bands[band], - channel)) { + params->channel)) { found = true; break; } @@ -487,9 +486,8 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (!found) { return -EINVAL; } - - params->channel = channel; } + idx++; } From 675f1922d515e38cd8d60f5f47ecf572f38c9ada Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:57 +0100 Subject: [PATCH 1212/2300] Revert "[nrf fromlist] wifi: shell: Add channel validation" This reverts commit a98292f1375f301cbd296cb2c29bccd7240f95e2. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 01a76359702..0ab9e884780 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -437,8 +437,7 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, } static int __wifi_args_to_params(size_t argc, char *argv[], - struct wifi_connect_req_params *params, - enum wifi_iface_mode iface_mode) + struct wifi_connect_req_params *params) { char *endptr; int idx = 1; @@ -466,26 +465,8 @@ static int __wifi_args_to_params(size_t argc, char *argv[], return -EINVAL; } - if (iface_mode == WIFI_MODE_INFRA && params->channel == 0) { + if (params->channel == 0U) { params->channel = WIFI_CHANNEL_ANY; - } else { - const uint8_t bands[] = {WIFI_FREQ_BAND_2_4_GHZ, - WIFI_FREQ_BAND_5_GHZ, - WIFI_FREQ_BAND_6_GHZ}; - uint8_t band; - bool found = false; - - for (band = 0; band < ARRAY_SIZE(bands); band++) { - if (wifi_utils_validate_chan(bands[band], - params->channel)) { - found = true; - break; - } - } - - if (!found) { - return -EINVAL; - } } idx++; @@ -544,7 +525,7 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, struct net_if *iface = net_if_get_first_wifi(); struct wifi_connect_req_params cnx_params = { 0 }; - if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_INFRA)) { + if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params)) { shell_help(sh); return -ENOEXEC; } @@ -1229,7 +1210,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, static struct wifi_connect_req_params cnx_params; int ret; - if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { + if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params)) { shell_help(sh); return -ENOEXEC; } From 111b880ea61e91f7d5b6d8af615a516ec202a85c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:57 +0100 Subject: [PATCH 1213/2300] Revert "[nrf fromlist] wifi: utils: Move channel helpers to public API" This reverts commit bc31c2f32edce5d7fbf958d2e5bc9adf816ba0f3. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_utils.h | 43 --------------------------------- subsys/net/l2/wifi/wifi_utils.c | 8 +++--- 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/include/zephyr/net/wifi_utils.h b/include/zephyr/net/wifi_utils.h index 537db787648..c16eef0e5b2 100644 --- a/include/zephyr/net/wifi_utils.h +++ b/include/zephyr/net/wifi_utils.h @@ -103,49 +103,6 @@ int wifi_utils_parse_scan_chan(char *scan_chan_str, struct wifi_band_channel *chan, uint8_t max_channels); - -/** - * @brief Validate a channel against a band. - * - * @param band Band to validate the channel against. - * @param chan Channel to validate. - * - * @retval true if the channel is valid for the band. - * @retval false if the channel is not valid for the band. - */ -bool wifi_utils_validate_chan(uint8_t band, - uint16_t chan); - -/** - * @brief Validate a channel against the 2.4 GHz band. - * - * @param chan Channel to validate. - * - * @retval true if the channel is valid for the band. - * @retval false if the channel is not valid for the band. - */ -bool wifi_utils_validate_chan_2g(uint16_t chan); - -/** - * @brief Validate a channel against the 5 GHz band. - * - * @param chan Channel to validate. - * - * @retval true if the channel is valid for the band. - * @retval false if the channel is not valid for the band. - */ -bool wifi_utils_validate_chan_5g(uint16_t chan); - -/** - * @brief Validate a channel against the 6 GHz band. - * - * @param chan Channel to validate. - * - * @retval true if the channel is valid for the band. - * @retval false if the channel is not valid for the band. - */ -bool wifi_utils_validate_chan_6g(uint16_t chan); - /** * @} */ diff --git a/subsys/net/l2/wifi/wifi_utils.c b/subsys/net/l2/wifi/wifi_utils.c index 76e93fc33e0..52d25d90566 100644 --- a/subsys/net/l2/wifi/wifi_utils.c +++ b/subsys/net/l2/wifi/wifi_utils.c @@ -44,7 +44,7 @@ static enum wifi_frequency_bands wifi_utils_map_band_str_to_idx(char *band_str) } -bool wifi_utils_validate_chan_2g(uint16_t chan) +static bool wifi_utils_validate_chan_2g(uint16_t chan) { if ((chan >= 1) && (chan <= 14)) { return true; @@ -54,7 +54,7 @@ bool wifi_utils_validate_chan_2g(uint16_t chan) } -bool wifi_utils_validate_chan_5g(uint16_t chan) +static bool wifi_utils_validate_chan_5g(uint16_t chan) { uint16_t i; @@ -68,7 +68,7 @@ bool wifi_utils_validate_chan_5g(uint16_t chan) } -bool wifi_utils_validate_chan_6g(uint16_t chan) +static bool wifi_utils_validate_chan_6g(uint16_t chan) { if (((chan >= 1) && (chan <= 233) && (!((chan - 1)%4))) || (chan == 2)) { @@ -79,7 +79,7 @@ bool wifi_utils_validate_chan_6g(uint16_t chan) } -bool wifi_utils_validate_chan(uint8_t band, +static bool wifi_utils_validate_chan(uint8_t band, uint16_t chan) { bool result = false; From 45ba953bee5b11c3cb37ebe3dbdf32877d1490e1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:57 +0100 Subject: [PATCH 1214/2300] Revert "[nrf fromlist] wifi: shell: Add a sanity check for MFP" This reverts commit bf73ce4c05ed11871082e47e8dc5af812b732e77. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 0ab9e884780..96ce19e3e5c 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -494,11 +494,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], if (idx < argc) { unsigned int mfp = strtol(argv[idx], &endptr, 10); - if (security == WIFI_SECURITY_TYPE_NONE || - security == WIFI_SECURITY_TYPE_WPA_PSK) { - return -EINVAL; - } - if (mfp <= WIFI_MFP_REQUIRED) { params->mfp = mfp; } From bf4faa16c47115bb909ba0a230925841d8ce7069 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:57 +0100 Subject: [PATCH 1215/2300] Revert "[nrf fromlist] wifi: shell: Make channel mandatory for AP" This reverts commit 3992dca805246f4938750910f9c8be0c6c3cbb73. Signed-off-by: Robert Lubos --- 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 96ce19e3e5c..726ce69b435 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -458,7 +458,7 @@ static int __wifi_args_to_params(size_t argc, char *argv[], return -EINVAL; } - /* Channel (optional: STA, mandatory: AP) */ + /* Channel (optional) */ if ((idx < argc) && (strlen(argv[idx]) <= 3)) { params->channel = strtol(argv[idx], &endptr, 10); if (*endptr != '\0') { @@ -1769,14 +1769,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, 1, 0), SHELL_CMD_ARG(enable, NULL, "\"\"\n" - "\n" + "[channel number: 0 means all]\n" "[PSK: valid only for secure SSIDs]\n" "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_ap_enable, - 3, 3), + 2, 4), SHELL_CMD_ARG(stations, NULL, "List stations connected to the AP", cmd_wifi_ap_stations, From 0656d44001bbea5062c564d39ac946a64d729504 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:58 +0100 Subject: [PATCH 1216/2300] Revert "[nrf fromtree] wifi: shell: Fix typo in comparison" This reverts commit 24f0ec8739ff5ba47402d5779372df8c1a8494fb. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 726ce69b435..450b7b00eb5 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -920,7 +920,7 @@ static int cmd_wifi_ps_mode(const struct shell *sh, size_t argc, char *argv[]) if (!strncasecmp(argv[1], "legacy", 6)) { params.mode = WIFI_PS_MODE_LEGACY; - } else if (!strncasecmp(argv[1], "WMM", 3)) { + } else if (!strncasecmp(argv[1], "WMM", 4)) { params.mode = WIFI_PS_MODE_WMM; } else { shell_fprintf(sh, SHELL_WARNING, "Invalid PS mode\n"); From cd5b75516fc17c9106cbbff0ad2e48f265a5fc15 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:58 +0100 Subject: [PATCH 1217/2300] Revert "[nrf fromtree] wifi: shell: Fix missing case sensitivity" This reverts commit b5febfc6f0fa63b250d8d153ddf11086de6a8d2a. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 450b7b00eb5..4f378a5029b 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -601,9 +601,9 @@ static int wifi_scan_args_to_params(const struct shell *sh, state = getopt_state_get(); switch (opt) { case 't': - if (!strncasecmp(optarg, "passive", 7)) { + if (!strcmp(optarg, "passive")) { params->scan_type = WIFI_SCAN_TYPE_PASSIVE; - } else if (!strncasecmp(optarg, "active", 6)) { + } else if (!strcmp(optarg, "active")) { params->scan_type = WIFI_SCAN_TYPE_ACTIVE; } else { shell_fprintf(sh, SHELL_ERROR, "Invalid scan type %s\n", optarg); From 1725f598dc955006c88c6b9e638f817ad9a66c39 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:58 +0100 Subject: [PATCH 1218/2300] Revert "[nrf fromtree] wifi: shell: Use case insensitive comparison" This reverts commit c954e19d2b3b7419e9f1bb8df47d179bd3e74eba. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 4f378a5029b..e1446cceca0 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -15,7 +15,6 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #include #include #include -#include #include #include #include @@ -887,9 +886,9 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) return 0; } - if (!strncasecmp(argv[1], "on", 2)) { + if (!strncmp(argv[1], "on", 2)) { params.enabled = WIFI_PS_ENABLED; - } else if (!strncasecmp(argv[1], "off", 3)) { + } else if (!strncmp(argv[1], "off", 3)) { params.enabled = WIFI_PS_DISABLED; } else { shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n"); @@ -918,9 +917,9 @@ static int cmd_wifi_ps_mode(const struct shell *sh, size_t argc, char *argv[]) context.sh = sh; - if (!strncasecmp(argv[1], "legacy", 6)) { + if (!strncmp(argv[1], "legacy", 6)) { params.mode = WIFI_PS_MODE_LEGACY; - } else if (!strncasecmp(argv[1], "WMM", 4)) { + } else if (!strncmp(argv[1], "wmm", 3)) { params.mode = WIFI_PS_MODE_WMM; } else { shell_fprintf(sh, SHELL_WARNING, "Invalid PS mode\n"); @@ -1406,9 +1405,9 @@ static int cmd_wifi_ps_wakeup_mode(const struct shell *sh, size_t argc, char *ar context.sh = sh; - if (!strncasecmp(argv[1], "dtim", 4)) { + if (!strncmp(argv[1], "dtim", 4)) { params.wakeup_mode = WIFI_PS_WAKEUP_MODE_DTIM; - } else if (!strncasecmp(argv[1], "listen_interval", 15)) { + } else if (!strncmp(argv[1], "listen_interval", 15)) { params.wakeup_mode = WIFI_PS_WAKEUP_MODE_LISTEN_INTERVAL; } else { shell_fprintf(sh, SHELL_WARNING, "Invalid argument\n"); From 1bd4bc69053be7d03a70d09b95cec4d666f528eb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:58 +0100 Subject: [PATCH 1219/2300] Revert "[nrf fromtree] net: lwm2m: add gateway callback to handle prefixed messages" This reverts commit 649f3d95939d6c51debabb36a06d65da5024950a. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 12 +---- subsys/net/lib/lwm2m/lwm2m_message_handling.h | 2 - subsys/net/lib/lwm2m/lwm2m_obj_gateway.c | 52 ------------------- subsys/net/lib/lwm2m/lwm2m_obj_gateway.h | 40 -------------- 4 files changed, 1 insertion(+), 105 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 480c64372e8..677879304f8 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -46,7 +46,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include "lwm2m_object.h" #include "lwm2m_obj_access_control.h" #include "lwm2m_obj_server.h" -#include "lwm2m_obj_gateway.h" #include "lwm2m_rw_link_format.h" #include "lwm2m_rw_oma_tlv.h" #include "lwm2m_rw_plain_text.h" @@ -480,7 +479,7 @@ void lwm2m_engine_context_init(struct lwm2m_ctx *client_ctx) } /* utility functions */ -int coap_options_to_path(struct coap_option *opt, int options_count, +static int coap_options_to_path(struct coap_option *opt, int options_count, struct lwm2m_obj_path *path) { uint16_t len, @@ -2269,15 +2268,6 @@ static int handle_request(struct coap_packet *request, struct lwm2m_message *msg msg->token = token; } - if (IS_ENABLED(CONFIG_LWM2M_GATEWAY_OBJ_SUPPORT)) { - r = lwm2m_gw_handle_req(msg); - if (r == 0) { - return 0; - } else if (r != -ENOENT) { - goto error; - } - } - /* parse the URL path into components */ r = coap_find_options(msg->in.in_cpkt, COAP_OPTION_URI_PATH, options, ARRAY_SIZE(options)); if (r < 0) { diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.h b/subsys/net/lib/lwm2m/lwm2m_message_handling.h index 3ac014b5db8..c41fbbac0ee 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.h +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.h @@ -39,8 +39,6 @@ #define NUM_OUTPUT_BLOCK_CONTEXT CONFIG_LWM2M_NUM_OUTPUT_BLOCK_CONTEXT #endif -int coap_options_to_path(struct coap_option *opt, int options_count, - struct lwm2m_obj_path *path); /* LwM2M message functions */ struct lwm2m_message *lwm2m_get_message(struct lwm2m_ctx *client_ctx); struct lwm2m_message *find_msg(struct coap_pending *pending, struct coap_reply *reply); diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_gateway.c b/subsys/net/lib/lwm2m/lwm2m_obj_gateway.c index 5bb12f80f47..711fd5fe127 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_gateway.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_gateway.c @@ -59,7 +59,6 @@ static struct lwm2m_engine_obj_field fields[] = { static struct lwm2m_engine_obj_inst inst[MAX_INSTANCE_COUNT]; static struct lwm2m_engine_res res[MAX_INSTANCE_COUNT][GATEWAY_MAX_ID]; static struct lwm2m_engine_res_inst res_inst[MAX_INSTANCE_COUNT][RESOURCE_INSTANCE_COUNT]; -lwm2m_engine_gateway_msg_cb gateway_msg_cb[MAX_INSTANCE_COUNT]; static int prefix_validation_cb(uint16_t obj_inst_id, uint16_t res_id, uint16_t res_inst_id, uint8_t *data, uint16_t data_len, bool last_block, @@ -147,57 +146,6 @@ static struct lwm2m_engine_obj_inst *lwm2m_gw_create(uint16_t obj_inst_id) return &inst[index]; } -int lwm2m_gw_handle_req(struct lwm2m_message *msg) -{ - struct coap_option options[4]; - int ret; - - ret = coap_find_options(msg->in.in_cpkt, COAP_OPTION_URI_PATH, options, - ARRAY_SIZE(options)); - if (ret < 0) { - return ret; - } - - for (int index = 0; index < MAX_INSTANCE_COUNT; index++) { - /* Skip uninitialized objects */ - if (!inst[index].obj) { - continue; - } - - char *prefix = device_table[index].prefix; - size_t prefix_len = strlen(prefix); - - if (prefix_len != options[0].len) { - continue; - } - if (strncmp(options[0].value, prefix, prefix_len) != 0) { - continue; - } - - if (gateway_msg_cb[index] == NULL) { - return -ENOENT; - } - /* Delete prefix from path*/ - ret = coap_options_to_path(&options[1], ret - 1, &msg->path); - if (ret < 0) { - return ret; - } - return gateway_msg_cb[index](msg); - } - return -ENOENT; -} - -int lwm2m_register_gw_callback(uint16_t obj_inst_id, lwm2m_engine_gateway_msg_cb cb) -{ - for (int index = 0; index < MAX_INSTANCE_COUNT; index++) { - if (inst[index].obj_inst_id == obj_inst_id) { - gateway_msg_cb[index] = cb; - return 0; - } - } - return -ENOENT; -} - static int lwm2m_gw_init(void) { int ret = 0; diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_gateway.h b/subsys/net/lib/lwm2m/lwm2m_obj_gateway.h index 0f7a82af249..597e3de19bc 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_gateway.h +++ b/subsys/net/lib/lwm2m/lwm2m_obj_gateway.h @@ -9,8 +9,6 @@ #ifndef __LWM2M_OBJ_GATEWAY__ #define __LWM2M_OBJ_GATEWAY__ -#include - /* LwM2M Gateway resource IDs */ /* clang-format off */ #define LWM2M_GATEWAY_DEVICE_RID 0 @@ -19,42 +17,4 @@ #define LWM2M_GATEWAY_IOT_DEVICE_OBJECTS_RID 3 /* clang-format on */ -/** - * @brief A callback which handles the prefixed messages from the server. - * - * The callback gets triggered each time the prefix in front of a received lwm2m - * msg path matches the prefix set in the LWM2M_GATEWAY_PREFIX_RID buffer. - * - * It must handle the content of the coap message completely. - * In case of success the LwM2M engine will then send the formatted coap message, - * otherwise a coap response code is sent. - * - * Example of returning CoAP response: - * @code{.c} - * lwm2m_init_message(msg); - * // Write CoAP packet to msg->out.out_cpkt - * return 0; - * @endcode - * - * - * @return 0 if msg contains a valid CoAP response. - * @return negative error code otherwise. - */ -typedef int (*lwm2m_engine_gateway_msg_cb)(struct lwm2m_message *msg); -/** - * @brief Register a callback which handles the prefixed messages from the server. - * - * @return 0 on success - * @return -ENOENT if no object instance with obj_inst_id was found - */ -int lwm2m_register_gw_callback(uint16_t obj_inst_id, lwm2m_engine_gateway_msg_cb cb); -/** - * @brief Check if given message is handled by Gateway callback. - * - * @return 0 if msg was handled by Gateawy and contains a valid response. Negative error code - * otherwise. - * @return -ENOENT if this msg was not handled by Gateway object. - */ -int lwm2m_gw_handle_req(struct lwm2m_message *msg); - #endif /* __LWM2M_OBJ_GATEWAY__ */ From c8ba6ed150a44b7794bca86803476aa7f903a087 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:58 +0100 Subject: [PATCH 1220/2300] Revert "[nrf fromtree] tests: net: lwm2m_engine: workaround stack overflow on qemu_x86" This reverts commit 7490b84296dd130dda3f646bd0fa63db4c55966d. Signed-off-by: Robert Lubos --- tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf diff --git a/tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf b/tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf deleted file mode 100644 index c735e1a8a2d..00000000000 --- a/tests/net/lib/lwm2m/lwm2m_engine/boards/qemu_x86.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_TEST_EXTRA_STACK_SIZE=1024 From e369e6f010a8a1c37779860b4a6b9cbf015cf8bf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:59 +0100 Subject: [PATCH 1221/2300] Revert "[nrf fromtree] net: lwm2m: Fix deadlock when calling lwm2m_engine_pause()" This reverts commit 8704811760810e0b0a38ef6f1333c95b584bafb4. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_engine.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index e08bb4ca17e..639f65ea0fa 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -1259,12 +1259,6 @@ int lwm2m_engine_pause(void) suspend_engine_thread = true; lwm2m_engine_wake_up(); - /* Check if pause requested within a engine thread, a callback for example. */ - if (engine_thread_id == k_current_get()) { - LOG_DBG("Pause requested"); - return 0; - } - while (active_engine_thread) { k_msleep(10); } @@ -1281,7 +1275,10 @@ int lwm2m_engine_resume(void) k_thread_resume(engine_thread_id); lwm2m_engine_wake_up(); - + while (!active_engine_thread) { + k_msleep(10); + } + LOG_INF("LWM2M engine thread resume"); return 0; } From c9e116acbcbcdffa30f8f580147aa4764419038b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:59 +0100 Subject: [PATCH 1222/2300] Revert "[nrf fromtree] net: lwm2m: Delay triggering registration update" This reverts commit 05b16c31f8117654c11b67c8a848b58b9c3f91a5. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_rd_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.c b/subsys/net/lib/lwm2m/lwm2m_rd_client.c index 95b576cb1c6..6b3fbcccc68 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.c +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.c @@ -1132,7 +1132,7 @@ static void sm_registration_done(void) if (sm_is_registered() && (client.trigger_update || now >= next_update())) { - set_sm_state_delayed(ENGINE_UPDATE_REGISTRATION, DELAY_FOR_ACK); + set_sm_state(ENGINE_UPDATE_REGISTRATION); } else if (IS_ENABLED(CONFIG_LWM2M_QUEUE_MODE_ENABLED) && (client.engine_state != ENGINE_REGISTRATION_DONE_RX_OFF) && (now >= next_rx_off())) { From bf97cce0ccf45fc8b551a57aa7bda02259e01153 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:59 +0100 Subject: [PATCH 1223/2300] Revert "[nrf fromtree] net: lwm2m: Add transmission state indicator to RX as well" This reverts commit 49cdc78cc0a313ef9796d84d327b3e508b238b77. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_engine.c | 72 ++++++++++------------------- 1 file changed, 25 insertions(+), 47 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 639f65ea0fa..d5a289a111f 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -630,50 +630,6 @@ static int64_t check_notifications(struct lwm2m_ctx *ctx, const int64_t timestam return next; } -/** - * @brief Check TX queue states as well as number or pending CoAP transmissions. - * - * If all queues are empty and there is no packet we are currently transmitting and no - * CoAP responses (pendings) we are waiting, inform the application by a callback - * that socket is in state LWM2M_SOCKET_STATE_NO_DATA. - * Otherwise, before sending a packet, depending on the state of the queues, inform with - * one of the ONGOING, ONE_RESPONSE or LAST indicators. - * - * @param ctx Client context. - * @param ongoing_tx Current packet to be transmitted or NULL. - */ -static void hint_socket_state(struct lwm2m_ctx *ctx, struct lwm2m_message *ongoing_tx) -{ - if (!ctx->set_socket_state) { - return; - } - -#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED) - bool empty = sys_slist_is_empty(&ctx->pending_sends) && - sys_slist_is_empty(&ctx->queued_messages); -#else - bool empty = sys_slist_is_empty(&ctx->pending_sends); -#endif - size_t pendings = coap_pendings_count(ctx->pendings, ARRAY_SIZE(ctx->pendings)); - - if (ongoing_tx) { - /* Check if more than current TX is in pendings list*/ - if (pendings > 1) { - empty = false; - } - - if (!empty) { - ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_ONGOING); - } else if (ongoing_tx->type == COAP_TYPE_CON) { - ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_ONE_RESPONSE); - } else { - ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_LAST); - } - } else if (empty && pendings == 0) { - ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_NO_DATA); - } -} - static int socket_recv_message(struct lwm2m_ctx *client_ctx) { static uint8_t in_buf[NET_IPV6_MTU]; @@ -728,7 +684,31 @@ static int socket_send_message(struct lwm2m_ctx *ctx) coap_pending_cycle(msg->pending); } - hint_socket_state(ctx, msg); + if (ctx->set_socket_state) { +#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED) + bool empty = sys_slist_is_empty(&ctx->pending_sends) && + sys_slist_is_empty(&ctx->queued_messages); +#else + bool empty = sys_slist_is_empty(&ctx->pending_sends); +#endif + if (coap_pendings_count(ctx->pendings, ARRAY_SIZE(ctx->pendings)) > 1) { + empty = false; + } + + if (!empty) { + ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_ONGOING); + } else { + switch (msg->type) { + case COAP_TYPE_CON: + ctx->set_socket_state(ctx->sock_fd, + LWM2M_SOCKET_STATE_ONE_RESPONSE); + break; + default: + ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_LAST); + break; + } + } + } rc = zsock_send(msg->ctx->sock_fd, msg->cpkt.data, msg->cpkt.offset, 0); @@ -867,8 +847,6 @@ static void socket_loop(void *p1, void *p2, void *p3) break; } } - - hint_socket_state(sock_ctx[i], NULL); } if (sock_fds[i].revents & ZSOCK_POLLOUT) { From 4635fa9fbfd0764903c6bd981ef43097144d1e2b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:27:59 +0100 Subject: [PATCH 1224/2300] Revert "[nrf fromtree] net: lwm2m: Deprecate lwm2m_get/set_u64" This reverts commit 8b012a34965f8bf722ab6751ec9c04dff4a72bda. Signed-off-by: Robert Lubos --- include/zephyr/net/lwm2m.h | 10 ---------- subsys/net/lib/lwm2m/lwm2m_registry.c | 4 ++-- subsys/net/lib/lwm2m/lwm2m_shell.c | 10 ++++++++++ .../net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c | 10 ++++++++++ 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index c643c32f0bf..3fca8bffae3 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -1009,16 +1009,11 @@ int lwm2m_engine_set_u64(const char *pathstr, uint64_t value); /** * @brief Set resource (instance) value (u64) * - * @deprecated Unsigned 64bit value type does not exits. - * This is internally handled as a int64_t. - * Use lwm2m_set_s64() instead. - * * @param[in] path LwM2M path as a struct * @param[in] value u64 value * * @return 0 for success or negative in case of error. */ -__deprecated int lwm2m_set_u64(const struct lwm2m_obj_path *path, uint64_t value); /** @@ -1340,16 +1335,11 @@ int lwm2m_engine_get_u64(const char *pathstr, uint64_t *value); /** * @brief Get resource (instance) value (u64) * - * @deprecated Unsigned 64bit value type does not exits. - * This is internally handled as a int64_t. - * Use lwm2m_get_s64() instead. - * @param[in] path LwM2M path as a struct * @param[out] value u64 buffer to copy data into * * @return 0 for success or negative in case of error. */ -__deprecated int lwm2m_get_u64(const struct lwm2m_obj_path *path, uint64_t *value); /** diff --git a/subsys/net/lib/lwm2m/lwm2m_registry.c b/subsys/net/lib/lwm2m/lwm2m_registry.c index 1701b7f7412..210c5525756 100644 --- a/subsys/net/lib/lwm2m/lwm2m_registry.c +++ b/subsys/net/lib/lwm2m/lwm2m_registry.c @@ -890,7 +890,7 @@ int lwm2m_engine_set_u64(const char *pathstr, uint64_t value) if (ret < 0) { return ret; } - return lwm2m_set_s64(&path, (int64_t) value); + return lwm2m_set_u64(&path, value); } int lwm2m_set_s8(const struct lwm2m_obj_path *path, int8_t value) @@ -1378,7 +1378,7 @@ int lwm2m_engine_get_u64(const char *pathstr, uint64_t *value) if (ret < 0) { return ret; } - return lwm2m_get_s64(&path, (int64_t *) value); + return lwm2m_get_u64(&path, value); } int lwm2m_get_s8(const struct lwm2m_obj_path *path, int8_t *value) diff --git a/subsys/net/lib/lwm2m/lwm2m_shell.c b/subsys/net/lib/lwm2m/lwm2m_shell.c index aad7dc5d166..a4cedf8cd62 100644 --- a/subsys/net/lib/lwm2m/lwm2m_shell.c +++ b/subsys/net/lib/lwm2m/lwm2m_shell.c @@ -246,6 +246,14 @@ static int cmd_read(const struct shell *sh, size_t argc, char **argv) goto out; } shell_print(sh, "%d\n", temp); + } else if (strcmp(dtype, "-u64") == 0) { + uint64_t temp = 0; + + ret = lwm2m_get_u64(&path, &temp); + if (ret != 0) { + goto out; + } + shell_print(sh, "%lld\n", temp); } else if (strcmp(dtype, "-f") == 0) { double temp = 0; @@ -341,6 +349,8 @@ static int cmd_write(const struct shell *sh, size_t argc, char **argv) ret = lwm2m_set_u16(&path, strtoul(value, &e, 10)); } else if (strcmp(dtype, "-u32") == 0) { ret = lwm2m_set_u32(&path, strtoul(value, &e, 10)); + } else if (strcmp(dtype, "-u64") == 0) { + ret = lwm2m_set_u64(&path, strtoull(value, &e, 10)); } else if (strcmp(dtype, "-b") == 0) { ret = lwm2m_set_bool(&path, strtoul(value, &e, 10)); } else if (strcmp(dtype, "-t") == 0) { diff --git a/tests/net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c b/tests/net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c index 8e99f666b7f..d4c0a7757a6 100644 --- a/tests/net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c +++ b/tests/net/lib/lwm2m/lwm2m_registry/src/lwm2m_registry.c @@ -203,6 +203,16 @@ ZTEST(lwm2m_registry, test_get_set) zassert_equal(strlen(buf), 0); } +ZTEST(lwm2m_registry, test_missing_u64) +{ + /* This data type is missing, so use S64 resource instead */ + uint64_t u64 = 123; + + zassert_equal(lwm2m_set_u64(&LWM2M_OBJ(32768, 0, LWM2M_RES_TYPE_S64), u64), 0); + zassert_equal(lwm2m_get_u64(&LWM2M_OBJ(32768, 0, LWM2M_RES_TYPE_S64), &u64), 0); + zassert_equal(u64, 123); +} + ZTEST(lwm2m_registry, test_temp_sensor) { int ret; From 3c73a2fd6ae30c99736f918ab88cc5f0a603918e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:00 +0100 Subject: [PATCH 1225/2300] Revert "[nrf fromtree] net: lwm2m: Transmission state indications" This reverts commit e1519af0be4b9937dc9a0c17a50c37f4d2f171a8. Signed-off-by: Robert Lubos --- include/zephyr/net/lwm2m.h | 24 ------- samples/net/lwm2m_client/overlay-queue.conf | 2 - samples/net/lwm2m_client/src/lwm2m-client.c | 20 ------ subsys/net/lib/lwm2m/lwm2m_engine.c | 35 +--------- tests/net/lib/lwm2m/lwm2m_engine/src/main.c | 72 +------------------- tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c | 2 - tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h | 4 -- 7 files changed, 4 insertions(+), 155 deletions(-) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index 3fca8bffae3..51324f63153 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -134,22 +134,6 @@ typedef void (*lwm2m_ctx_event_cb_t)(struct lwm2m_ctx *ctx, enum lwm2m_rd_client_event event); -/** - * @brief Different traffic states of the LwM2M socket. - * - * This information can be used to give hints for the network interface - * that can decide what kind of power management should be used. - * - * These hints are given from CoAP layer messages, so usage of DTLS might affect the - * actual number of expected datagrams. - */ -enum lwm2m_socket_states { - LWM2M_SOCKET_STATE_ONGOING, /**< Ongoing traffic is expected. */ - LWM2M_SOCKET_STATE_ONE_RESPONSE, /**< One response is expected for the next message. */ - LWM2M_SOCKET_STATE_LAST, /**< Next message is the last one. */ - LWM2M_SOCKET_STATE_NO_DATA, /**< No more data is expected. */ -}; - /** * @brief LwM2M context structure to maintain information for a single * LwM2M connection. @@ -265,14 +249,6 @@ struct lwm2m_ctx { * copied into the actual resource buffer. */ uint8_t validate_buf[CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE]; - - /** - * Callback to indicate transmission states. - * Client application may request LwM2M engine to indicate hints about - * transmission states and use that information to control various power - * saving modes. - */ - void (*set_socket_state)(int fd, enum lwm2m_socket_states state); }; /** diff --git a/samples/net/lwm2m_client/overlay-queue.conf b/samples/net/lwm2m_client/overlay-queue.conf index 946c0fbab67..1adc9eda5ec 100644 --- a/samples/net/lwm2m_client/overlay-queue.conf +++ b/samples/net/lwm2m_client/overlay-queue.conf @@ -1,7 +1,5 @@ CONFIG_LWM2M_QUEUE_MODE_ENABLED=y CONFIG_LWM2M_QUEUE_MODE_UPTIME=20 -CONFIG_LWM2M_RD_CLIENT_STOP_POLLING_AT_IDLE=y - # Default lifetime is 1 day CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIME=86400 # Send update once an hour diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index 2e9792e51ea..c610f1ad8dd 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -253,25 +253,6 @@ static void rd_client_event(struct lwm2m_ctx *client, } } -static void socket_state(int fd, enum lwm2m_socket_states state) -{ - (void) fd; - switch (state) { - case LWM2M_SOCKET_STATE_ONGOING: - LOG_DBG("LWM2M_SOCKET_STATE_ONGOING"); - break; - case LWM2M_SOCKET_STATE_ONE_RESPONSE: - LOG_DBG("LWM2M_SOCKET_STATE_ONE_RESPONSE"); - break; - case LWM2M_SOCKET_STATE_LAST: - LOG_DBG("LWM2M_SOCKET_STATE_LAST"); - break; - case LWM2M_SOCKET_STATE_NO_DATA: - LOG_DBG("LWM2M_SOCKET_STATE_NO_DATA"); - break; - } -} - static void observe_cb(enum lwm2m_observe_event event, struct lwm2m_obj_path *path, void *user_data) { @@ -386,7 +367,6 @@ int main(void) #if defined(CONFIG_LWM2M_DTLS_SUPPORT) client_ctx.tls_tag = CONFIG_LWM2M_APP_TLS_TAG; #endif - client_ctx.set_socket_state = socket_state; /* client_ctx.sec_obj_inst is 0 as a starting point */ lwm2m_rd_client_start(&client_ctx, endpoint, flags, rd_client_event, observe_cb); diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index d5a289a111f..85a428eeb5d 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -197,11 +197,6 @@ int lwm2m_socket_suspend(struct lwm2m_ctx *client_ctx) lwm2m_close_socket(client_ctx); /* store back the socket handle */ client_ctx->sock_fd = socket_temp_id; - - if (client_ctx->set_socket_state) { - client_ctx->set_socket_state(client_ctx->sock_fd, - LWM2M_SOCKET_STATE_NO_DATA); - } } return ret; @@ -664,10 +659,10 @@ static int socket_recv_message(struct lwm2m_ctx *client_ctx) return 0; } -static int socket_send_message(struct lwm2m_ctx *ctx) +static int socket_send_message(struct lwm2m_ctx *client_ctx) { int rc; - sys_snode_t *msg_node = sys_slist_get(&ctx->pending_sends); + sys_snode_t *msg_node = sys_slist_get(&client_ctx->pending_sends); struct lwm2m_message *msg; if (!msg_node) { @@ -684,32 +679,6 @@ static int socket_send_message(struct lwm2m_ctx *ctx) coap_pending_cycle(msg->pending); } - if (ctx->set_socket_state) { -#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED) - bool empty = sys_slist_is_empty(&ctx->pending_sends) && - sys_slist_is_empty(&ctx->queued_messages); -#else - bool empty = sys_slist_is_empty(&ctx->pending_sends); -#endif - if (coap_pendings_count(ctx->pendings, ARRAY_SIZE(ctx->pendings)) > 1) { - empty = false; - } - - if (!empty) { - ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_ONGOING); - } else { - switch (msg->type) { - case COAP_TYPE_CON: - ctx->set_socket_state(ctx->sock_fd, - LWM2M_SOCKET_STATE_ONE_RESPONSE); - break; - default: - ctx->set_socket_state(ctx->sock_fd, LWM2M_SOCKET_STATE_LAST); - break; - } - } - } - rc = zsock_send(msg->ctx->sock_fd, msg->cpkt.data, msg->cpkt.offset, 0); if (rc < 0) { diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c index 5d80f5d1049..ed26380eccd 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c @@ -13,11 +13,10 @@ #include "lwm2m_rd_client.h" #include "stubs.h" -#if defined(CONFIG_NATIVE_SIM_SLOWDOWN_TO_REAL_TIME) +#if defined(CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME) #include "timer_model.h" #endif -#define LOG_LEVEL LOG_LEVEL_DBG LOG_MODULE_REGISTER(lwm2m_engine_test); DEFINE_FFF_GLOBALS; @@ -68,7 +67,7 @@ static void test_service(struct k_work *work) static void setup(void *data) { -#if defined(CONFIG_NATIVE_SIM_SLOWDOWN_TO_REAL_TIME) +#if defined(CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME) /* It is enough that some slow-down is happening on sleeps, it does not have to be * real time */ @@ -468,70 +467,3 @@ ZTEST(lwm2m_engine, test_security) zassert_equal(tls_credential_add_fake.arg1_history[2], TLS_CREDENTIAL_CA_CERTIFICATE); zassert_equal(lwm2m_engine_stop(&ctx), 0); } - -static enum lwm2m_socket_states last_state; - -static void socket_state(int fd, enum lwm2m_socket_states state) -{ - (void) fd; - last_state = state; -} - -ZTEST(lwm2m_engine, test_socket_state) -{ - int ret; - struct lwm2m_ctx ctx = { - .remote_addr.sa_family = AF_INET, - .sock_fd = -1, - .set_socket_state = socket_state, - }; - struct lwm2m_message msg1 = { - .ctx = &ctx, - .type = COAP_TYPE_CON, - }; - struct lwm2m_message msg2 = msg1; - struct lwm2m_message ack = { - .ctx = &ctx, - .type = COAP_TYPE_ACK, - }; - - sys_slist_init(&ctx.pending_sends); - ret = lwm2m_engine_start(&ctx); - zassert_equal(ret, 0); - - /* One confimable in queue, should cause ONE_RESPONSE status */ - coap_pendings_count_fake.return_val = 1; - sys_slist_append(&ctx.pending_sends, &msg1.node); - set_socket_events(ZSOCK_POLLOUT); - k_sleep(K_MSEC(100)); - zassert_equal(last_state, LWM2M_SOCKET_STATE_ONE_RESPONSE); - - /* More than one messages in queue, not empty, should cause ONGOING */ - coap_pendings_count_fake.return_val = 2; - sys_slist_append(&ctx.pending_sends, &msg1.node); - sys_slist_append(&ctx.pending_sends, &msg2.node); - set_socket_events(ZSOCK_POLLOUT); - k_sleep(K_MSEC(100)); - zassert_equal(last_state, LWM2M_SOCKET_STATE_ONGOING); - - /* Last out, while waiting for ACK to both, should still cause ONGOING */ - coap_pendings_count_fake.return_val = 2; - set_socket_events(ZSOCK_POLLOUT); - k_sleep(K_MSEC(100)); - zassert_equal(last_state, LWM2M_SOCKET_STATE_ONGOING); - - /* Only one Ack transmiting, nothing expected back -> LAST */ - coap_pendings_count_fake.return_val = 0; - sys_slist_append(&ctx.pending_sends, &ack.node); - set_socket_events(ZSOCK_POLLOUT); - k_sleep(K_MSEC(100)); - zassert_equal(last_state, LWM2M_SOCKET_STATE_LAST); - - /* Socket suspended (as in QUEUE_RX_OFF), should cause NO_DATA */ - ret = lwm2m_socket_suspend(&ctx); - zassert_equal(ret, 0); - zassert_equal(last_state, LWM2M_SOCKET_STATE_NO_DATA); - - ret = lwm2m_engine_stop(&ctx); - zassert_equal(ret, 0); -} diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c index 0958d75a54a..5db155f1e29 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c @@ -19,7 +19,6 @@ DEFINE_FAKE_VALUE_FUNC(int, lwm2m_send_message_async, struct lwm2m_message *); DEFINE_FAKE_VOID_FUNC(lwm2m_registry_lock); DEFINE_FAKE_VOID_FUNC(lwm2m_registry_unlock); DEFINE_FAKE_VALUE_FUNC(bool, coap_pending_cycle, struct coap_pending *); -DEFINE_FAKE_VALUE_FUNC(size_t, coap_pendings_count, struct coap_pending *, size_t); DEFINE_FAKE_VALUE_FUNC(int, generate_notify_message, struct lwm2m_ctx *, struct observe_node *, void *); DEFINE_FAKE_VALUE_FUNC(int64_t, engine_observe_shedule_next_event, struct observe_node *, uint16_t, @@ -42,7 +41,6 @@ DEFINE_FAKE_VALUE_FUNC(int, lwm2m_delete_obj_inst, uint16_t, uint16_t); DEFINE_FAKE_VOID_FUNC(lwm2m_clear_block_contexts); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_security_mode, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(int, z_impl_zsock_setsockopt, int, int, int, const void *, socklen_t); -DEFINE_FAKE_VOID_FUNC(engine_update_tx_time); static sys_slist_t obs_obj_path_list = SYS_SLIST_STATIC_INIT(&obs_obj_path_list); sys_slist_t *lwm2m_obs_obj_path_list(void) diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h index 67c4cde883d..7b8ca481f85 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.h @@ -28,7 +28,6 @@ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_rd_client_resume); DECLARE_FAKE_VALUE_FUNC(struct lwm2m_message *, find_msg, struct coap_pending *, struct coap_reply *); DECLARE_FAKE_VOID_FUNC(coap_pending_clear, struct coap_pending *); -DECLARE_FAKE_VALUE_FUNC(size_t, coap_pendings_count, struct coap_pending *, size_t); DECLARE_FAKE_VOID_FUNC(lwm2m_reset_message, struct lwm2m_message *, bool); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_send_message_async, struct lwm2m_message *); DECLARE_FAKE_VOID_FUNC(lwm2m_registry_lock); @@ -57,7 +56,6 @@ DECLARE_FAKE_VOID_FUNC(lwm2m_clear_block_contexts); DECLARE_FAKE_VALUE_FUNC(int, z_impl_zsock_connect, int, const struct sockaddr *, socklen_t); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_mode, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, z_impl_zsock_setsockopt, int, int, int, const void *, socklen_t); -DECLARE_FAKE_VOID_FUNC(engine_update_tx_time); #define DO_FOREACH_FAKE(FUNC) \ do { \ @@ -65,7 +63,6 @@ DECLARE_FAKE_VOID_FUNC(engine_update_tx_time); FUNC(lwm2m_rd_client_resume) \ FUNC(find_msg) \ FUNC(coap_pending_clear) \ - FUNC(coap_pendings_count) \ FUNC(lwm2m_reset_message) \ FUNC(lwm2m_send_message_async) \ FUNC(lwm2m_registry_lock) \ @@ -88,7 +85,6 @@ DECLARE_FAKE_VOID_FUNC(engine_update_tx_time); FUNC(z_impl_zsock_connect) \ FUNC(lwm2m_security_mode) \ FUNC(z_impl_zsock_setsockopt) \ - FUNC(engine_update_tx_time) \ } while (0) #endif /* STUBS_H */ From 8854ec9dc0af2d0b1a5c4e0d7f7f26623d71936d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:00 +0100 Subject: [PATCH 1226/2300] Revert "[nrf fromtree] net: lwm2m: Update TX timestamp on zsock_send()" This reverts commit b9a2d31d14e2e54d41fe16a165255767b5caf788. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_engine.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 85a428eeb5d..959d07419d3 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -684,8 +684,6 @@ static int socket_send_message(struct lwm2m_ctx *client_ctx) if (rc < 0) { LOG_ERR("Failed to send packet, err %d", errno); rc = -errno; - } else { - engine_update_tx_time(); } if (msg->type != COAP_TYPE_CON) { From a34de9fdc78105e2b11b6b61f5e174774e4a3d39 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:00 +0100 Subject: [PATCH 1227/2300] Revert "[nrf fromtree] net: coap: Add API to count number of pending requests" This reverts commit 44fb7468ff22f2a5b76a748aba73ac422446a6f2. Signed-off-by: Robert Lubos --- include/zephyr/net/coap.h | 9 --------- subsys/net/lib/coap/coap.c | 13 ------------- 2 files changed, 22 deletions(-) diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index cd57c560bee..e303d5c8ad3 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -1112,15 +1112,6 @@ void coap_pending_clear(struct coap_pending *pending); */ void coap_pendings_clear(struct coap_pending *pendings, size_t len); -/** - * @brief Count number of pending requests. - * - * @param len Number of elements in array. - * @param pendings Array of pending requests. - * @return count of elements where timeout is not zero. - */ -size_t coap_pendings_count(struct coap_pending *pendings, size_t len); - /** * @brief Cancels awaiting for this reply, so it becomes available * again. User responsibility to free the memory associated with data. diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index d22ee29bea7..bfb643a8e8c 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1734,19 +1734,6 @@ void coap_pendings_clear(struct coap_pending *pendings, size_t len) } } -size_t coap_pendings_count(struct coap_pending *pendings, size_t len) -{ - struct coap_pending *p = pendings; - size_t c = 0; - - for (size_t i = 0; i < len && p; i++, p++) { - if (p->timeout) { - c++; - } - } - return c; -} - /* Reordering according to RFC7641 section 3.4 but without timestamp comparison */ static inline bool is_newer(int v1, int v2) { From 5b7f238a334bdb1670755f9bbf6ff6d46a777f81 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:01 +0100 Subject: [PATCH 1228/2300] Revert "[nrf fromtree] doc: migration-guide: 3.6: Add CoAP service send functions update." This reverts commit 1db2beecb042d6763b404da9b28d81d4c1afe909. Signed-off-by: Robert Lubos --- doc/releases/migration-guide-3.6.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index eeac0a89b75..27567c3c052 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -160,10 +160,6 @@ Networking use default values. (:github:`66482`) -* The CoAP public API functions :c:func:`coap_service_send` and :c:func:`coap_resource_send` have - changed. An additional parameter pointer to :c:struct:`coap_transmission_parameters` has been - added. It is safe to pass a NULL pointer to use default values. (:github:`66540`) - * The IGMP multicast library now supports IGMPv3. This results in a minor change to the existing api. The :c:func:`net_ipv4_igmp_join` now takes an additional argument of the type ``const struct igmp_param *param``. This allows IGMPv3 to exclude/include certain groups of From 90713af452620d1632053c4b1663fb9542d15ecc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:01 +0100 Subject: [PATCH 1229/2300] Revert "[nrf fromtree] net: lib: coap: Use coap_transmission_parameters in coap_server" This reverts commit 27d0080fa2425fa53fa360ebbf8cd91aeeb7918b. Signed-off-by: Robert Lubos --- .../networking/api/coap_server.rst | 4 ++-- include/zephyr/net/coap_service.h | 8 ++------ samples/net/sockets/coap_server/src/core.c | 2 +- samples/net/sockets/coap_server/src/large.c | 6 +++--- .../sockets/coap_server/src/location_query.c | 2 +- samples/net/sockets/coap_server/src/observer.c | 2 +- samples/net/sockets/coap_server/src/query.c | 2 +- samples/net/sockets/coap_server/src/separate.c | 4 ++-- samples/net/sockets/coap_server/src/test.c | 8 ++++---- subsys/net/lib/coap/Kconfig | 6 ++++++ subsys/net/lib/coap/coap_server.c | 18 ++++++++++-------- 11 files changed, 33 insertions(+), 29 deletions(-) diff --git a/doc/connectivity/networking/api/coap_server.rst b/doc/connectivity/networking/api/coap_server.rst index bd53630ad6c..eb816665f41 100644 --- a/doc/connectivity/networking/api/coap_server.rst +++ b/doc/connectivity/networking/api/coap_server.rst @@ -97,7 +97,7 @@ The following is an example of a CoAP resource registered with our service: coap_packet_append_payload(&response, (uint8_t *)msg, sizeof(msg)); /* Send to response back to the client */ - return coap_resource_send(resource, &response, addr, addr_len, NULL); + return coap_resource_send(resource, &response, addr, addr_len); } static int my_put(struct coap_resource *resource, struct coap_packet *request, @@ -189,7 +189,7 @@ and send state updates. An example using a temperature sensor can look like: coap_packet_append_payload_marker(&response); coap_packet_append_payload(&response, (uint8_t *)payload, strlen(payload)); - return coap_resource_send(resource, &response, addr, addr_len, NULL); + return coap_resource_send(resource, &response, addr, addr_len); } static int temp_get(struct coap_resource *resource, struct coap_packet *request, diff --git a/include/zephyr/net/coap_service.h b/include/zephyr/net/coap_service.h index b894fecf519..6f038ce61e1 100644 --- a/include/zephyr/net/coap_service.h +++ b/include/zephyr/net/coap_service.h @@ -235,12 +235,10 @@ int coap_service_is_running(const struct coap_service *service); * @param cpkt CoAP Packet to send * @param addr Peer address * @param addr_len Peer address length - * @param params Pointer to transmission parameters structure or NULL to use default values. * @return 0 in case of success or negative in case of error. */ int coap_service_send(const struct coap_service *service, const struct coap_packet *cpkt, - const struct sockaddr *addr, socklen_t addr_len, - const struct coap_transmission_parameters *params); + const struct sockaddr *addr, socklen_t addr_len); /** * @brief Send a CoAP message from the provided @p resource . @@ -251,12 +249,10 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack * @param cpkt CoAP Packet to send * @param addr Peer address * @param addr_len Peer address length - * @param params Pointer to transmission parameters structure or NULL to use default values. * @return 0 in case of success or negative in case of error. */ int coap_resource_send(const struct coap_resource *resource, const struct coap_packet *cpkt, - const struct sockaddr *addr, socklen_t addr_len, - const struct coap_transmission_parameters *params); + const struct sockaddr *addr, socklen_t addr_len); /** * @brief Parse a CoAP observe request for the provided @p resource . diff --git a/samples/net/sockets/coap_server/src/core.c b/samples/net/sockets/coap_server/src/core.c index 00f4adb4d34..276ab0d5de1 100644 --- a/samples/net/sockets/coap_server/src/core.c +++ b/samples/net/sockets/coap_server/src/core.c @@ -45,7 +45,7 @@ static int core_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } diff --git a/samples/net/sockets/coap_server/src/large.c b/samples/net/sockets/coap_server/src/large.c index 8656a5b53b1..28a3eebe099 100644 --- a/samples/net/sockets/coap_server/src/large.c +++ b/samples/net/sockets/coap_server/src/large.c @@ -87,7 +87,7 @@ static int large_get(struct coap_resource *resource, memset(&ctx, 0, sizeof(ctx)); } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } @@ -167,7 +167,7 @@ static int large_update_put(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } @@ -239,7 +239,7 @@ static int large_create_post(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } diff --git a/samples/net/sockets/coap_server/src/location_query.c b/samples/net/sockets/coap_server/src/location_query.c index bce4eb67b86..b13079bc456 100644 --- a/samples/net/sockets/coap_server/src/location_query.c +++ b/samples/net/sockets/coap_server/src/location_query.c @@ -59,7 +59,7 @@ static int location_query_post(struct coap_resource *resource, } } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } diff --git a/samples/net/sockets/coap_server/src/observer.c b/samples/net/sockets/coap_server/src/observer.c index 8a14d316c61..6d39536e232 100644 --- a/samples/net/sockets/coap_server/src/observer.c +++ b/samples/net/sockets/coap_server/src/observer.c @@ -80,7 +80,7 @@ static int send_notification_packet(struct coap_resource *resource, k_work_reschedule(&obs_work, K_SECONDS(5)); - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } diff --git a/samples/net/sockets/coap_server/src/query.c b/samples/net/sockets/coap_server/src/query.c index 95272189d9c..10479b1e6f1 100644 --- a/samples/net/sockets/coap_server/src/query.c +++ b/samples/net/sockets/coap_server/src/query.c @@ -89,7 +89,7 @@ static int query_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } diff --git a/samples/net/sockets/coap_server/src/separate.c b/samples/net/sockets/coap_server/src/separate.c index 68bba0bb473..c3f6f6c256e 100644 --- a/samples/net/sockets/coap_server/src/separate.c +++ b/samples/net/sockets/coap_server/src/separate.c @@ -43,7 +43,7 @@ static int separate_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); if (r < 0) { return r; } @@ -86,7 +86,7 @@ static int separate_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } diff --git a/samples/net/sockets/coap_server/src/test.c b/samples/net/sockets/coap_server/src/test.c index 52885b31a5d..aa496a125b1 100644 --- a/samples/net/sockets/coap_server/src/test.c +++ b/samples/net/sockets/coap_server/src/test.c @@ -73,7 +73,7 @@ static int piggyback_get(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } @@ -113,7 +113,7 @@ static int test_del(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } @@ -160,7 +160,7 @@ static int test_put(struct coap_resource *resource, return r; } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } @@ -221,7 +221,7 @@ static int test_post(struct coap_resource *resource, } } - r = coap_resource_send(resource, &response, addr, addr_len, NULL); + r = coap_resource_send(resource, &response, addr, addr_len); return r; } diff --git a/subsys/net/lib/coap/Kconfig b/subsys/net/lib/coap/Kconfig index 63396bb0518..f4d002d0c5d 100644 --- a/subsys/net/lib/coap/Kconfig +++ b/subsys/net/lib/coap/Kconfig @@ -202,6 +202,12 @@ config COAP_SERVICE_PENDING_MESSAGES help Maximum number of pending CoAP messages to retransmit per active service. +config COAP_SERVICE_PENDING_RETRANSMITS + int "CoAP retransmit count" + default 2 + help + Maximum number of retries to send a pending message. + config COAP_SERVICE_OBSERVERS int "CoAP service observers" default 3 diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 28d5b8de47f..66e5dcbc32c 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -215,7 +215,7 @@ static int coap_server_process(int sock_fd) goto unlock; } - ret = coap_service_send(service, &response, &client_addr, client_addr_len, NULL); + ret = coap_service_send(service, &response, &client_addr, client_addr_len); } else { ret = coap_handle_request_len(&request, service->res_begin, COAP_SERVICE_RESOURCE_COUNT(service), @@ -246,7 +246,7 @@ static int coap_server_process(int sock_fd) goto unlock; } - ret = coap_service_send(service, &ack, &client_addr, client_addr_len, NULL); + ret = coap_service_send(service, &ack, &client_addr, client_addr_len); } } @@ -521,8 +521,7 @@ int coap_service_is_running(const struct coap_service *service) } int coap_service_send(const struct coap_service *service, const struct coap_packet *cpkt, - const struct sockaddr *addr, socklen_t addr_len, - const struct coap_transmission_parameters *params) + const struct sockaddr *addr, socklen_t addr_len) { int ret; @@ -543,6 +542,8 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack * try to send. */ if (coap_header_get_type(cpkt) == COAP_TYPE_CON) { + struct coap_transmission_parameters params; + struct coap_pending *pending = coap_pending_next_unused(service->data->pending, MAX_PENDINGS); @@ -551,7 +552,9 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack goto send; } - ret = coap_pending_init(pending, cpkt, addr, params); + params = coap_get_transmission_parameters(); + params.max_retransmission = CONFIG_COAP_SERVICE_PENDING_RETRANSMITS; + ret = coap_pending_init(pending, cpkt, addr, ¶ms); if (ret < 0) { LOG_WRN("Failed to init pending message for %s (%d)", service->name, ret); goto send; @@ -586,13 +589,12 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack } int coap_resource_send(const struct coap_resource *resource, const struct coap_packet *cpkt, - const struct sockaddr *addr, socklen_t addr_len, - const struct coap_transmission_parameters *params) + const struct sockaddr *addr, socklen_t addr_len) { /* Find owning service */ COAP_SERVICE_FOREACH(svc) { if (COAP_SERVICE_HAS_RESOURCE(svc, resource)) { - return coap_service_send(svc, cpkt, addr, addr_len, params); + return coap_service_send(svc, cpkt, addr, addr_len); } } From 6c7f77e05a924b23052d0b548c0ecf3d094ea725 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:01 +0100 Subject: [PATCH 1230/2300] Revert "[nrf fromtree] tests: net: coap: Add test case for transmission parameters" This reverts commit ea66a88e403833bdbf301df2aaa42ac87e4fd713. Signed-off-by: Robert Lubos --- tests/net/lib/coap/src/main.c | 53 ----------------------------------- 1 file changed, 53 deletions(-) diff --git a/tests/net/lib/coap/src/main.c b/tests/net/lib/coap/src/main.c index d1903dea10c..52b6cf0fd2a 100644 --- a/tests/net/lib/coap/src/main.c +++ b/tests/net/lib/coap/src/main.c @@ -1718,57 +1718,4 @@ ZTEST(coap, test_coap_packet_set_path) COAP_OPTION_URI_PATH); } -ZTEST(coap, test_transmission_parameters) -{ - struct coap_packet cpkt; - struct coap_pending *pending; - struct coap_transmission_parameters params; - uint8_t *data = data_buf[0]; - int r; - uint16_t id; - - params = coap_get_transmission_parameters(); - zassert_equal(params.ack_timeout, CONFIG_COAP_INIT_ACK_TIMEOUT_MS, "Wrong ACK timeout"); - 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.coap_backoff_percent = 150; - params.max_retransmission = 2; - - coap_set_transmission_parameters(¶ms); - - id = coap_next_id(); - - r = coap_packet_init(&cpkt, data, COAP_BUF_SIZE, COAP_VERSION_1, - COAP_TYPE_CON, 0, coap_next_token(), - COAP_METHOD_GET, id); - zassert_equal(r, 0, "Could not initialize packet"); - - pending = coap_pending_next_unused(pendings, NUM_PENDINGS); - zassert_not_null(pending, "No free pending"); - - params.ack_timeout = 3000; - params.coap_backoff_percent = 250; - params.max_retransmission = 3; - - r = coap_pending_init(pending, &cpkt, (struct sockaddr *) &dummy_addr, - ¶ms); - zassert_equal(r, 0, "Could not initialize packet"); - - zassert_equal(pending->params.ack_timeout, 3000, "Wrong ACK timeout"); - zassert_equal(pending->params.coap_backoff_percent, 250, "Wrong backoff percent"); - zassert_equal(pending->params.max_retransmission, 3, "Wrong max retransmission value"); - - r = coap_pending_init(pending, &cpkt, (struct sockaddr *) &dummy_addr, - NULL); - zassert_equal(r, 0, "Could not initialize packet"); - - zassert_equal(pending->params.ack_timeout, 1000, "Wrong ACK timeout"); - zassert_equal(pending->params.coap_backoff_percent, 150, "Wrong backoff percent"); - zassert_equal(pending->params.max_retransmission, 2, "Wrong max retransmission value"); -} - ZTEST_SUITE(coap, NULL, NULL, NULL, NULL, NULL); From f7a117a33166ea08f837af44bce1c319720cbca8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:01 +0100 Subject: [PATCH 1231/2300] Revert "[nrf fromtree] net: lib: coap: Change coap_pending_init()" This reverts commit af6a8f95267720f08e2711d93bbf792b66753882. Signed-off-by: Robert Lubos --- doc/releases/migration-guide-3.6.rst | 22 ------------ doc/releases/release-notes-3.6.rst | 5 --- include/zephyr/net/coap.h | 30 ++++++++-------- include/zephyr/net/coap_client.h | 5 +-- subsys/net/lib/coap/coap.c | 23 +++++------- subsys/net/lib/coap/coap_client.c | 19 ++++++---- subsys/net/lib/coap/coap_server.c | 7 ++-- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 6 ++-- tests/net/lib/coap/src/main.c | 2 +- tests/net/lib/coap_client/src/main.c | 35 +++++++------------ 10 files changed, 57 insertions(+), 97 deletions(-) diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index 27567c3c052..c1739adf74d 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -150,28 +150,6 @@ Networking ``request`` argument for :c:func:`coap_well_known_core_get` is made ``const``. (:github:`64265`) -* CoAP observer events have moved from a callback function in a CoAP resource to the Network Events - subsystem. The ``CONFIG_COAP_OBSERVER_EVENTS`` configuration option has been removed. - (:github:`65936`) - -* The CoAP public API function :c:func:`coap_pending_init` has changed. The parameter - ``retries`` is replaced with a pointer to :c:struct:`coap_transmission_parameters`. This allows to - specify retransmission parameters of the confirmable message. It is safe to pass a NULL pointer to - use default values. - (:github:`66482`) - -* The IGMP multicast library now supports IGMPv3. This results in a minor change to the existing - api. The :c:func:`net_ipv4_igmp_join` now takes an additional argument of the type - ``const struct igmp_param *param``. This allows IGMPv3 to exclude/include certain groups of - addresses. If this functionality is not used or available (when using IGMPv2), you can safely pass - a NULL pointer. IGMPv3 can be enabled using the Kconfig ``CONFIG_NET_IPV4_IGMPV3``. - (:github:`65293`) - -* The network stack now uses a separate IPv4 TTL (time-to-live) value for multicast packets. - Before, the same TTL value was used for unicast and multicast packets. - The IPv6 hop limit value is also changed so that unicast and multicast packets can have a - different one. (:github:`65886`) - Other Subsystems ================ diff --git a/doc/releases/release-notes-3.6.rst b/doc/releases/release-notes-3.6.rst index f4d813432b1..a253434a085 100644 --- a/doc/releases/release-notes-3.6.rst +++ b/doc/releases/release-notes-3.6.rst @@ -195,11 +195,6 @@ Networking * CoAP: - * Added new API functions: - - * :c:func:`coap_get_transmission_parameters` - * :c:func:`coap_set_transmission_parameters` - * Connection Manager: * DHCP: diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index e303d5c8ad3..e4374f41e34 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -309,18 +309,6 @@ typedef int (*coap_reply_t)(const struct coap_packet *response, struct coap_reply *reply, const struct sockaddr *from); -/** - * @brief CoAP transmission parameters. - */ -struct coap_transmission_parameters { - /** Initial ACK timeout. Value is used as a base value to retry pending CoAP packets. */ - uint32_t 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. */ - uint8_t max_retransmission; -}; - /** * @brief Represents a request awaiting for an acknowledgment (ACK). */ @@ -332,7 +320,6 @@ struct coap_pending { uint8_t *data; /**< User allocated buffer */ uint16_t len; /**< Length of the CoAP packet */ uint8_t retries; /**< Number of times the request has been sent */ - struct coap_transmission_parameters params; /**< Transmission parameters */ }; /** @@ -1002,15 +989,14 @@ void coap_reply_init(struct coap_reply *reply, * confirmation message, initialized with data from @a request * @param request Message waiting for confirmation * @param addr Address to send the retransmission - * @param params Pointer to the CoAP transmission parameters struct, - * or NULL to use default values + * @param retries Maximum number of retransmissions of the message. * * @return 0 in case of success or negative in case of error. */ int coap_pending_init(struct coap_pending *pending, const struct coap_packet *request, const struct sockaddr *addr, - const struct coap_transmission_parameters *params); + uint8_t retries); /** * @brief Returns the next available pending struct, that can be used @@ -1148,6 +1134,18 @@ int coap_resource_notify(struct coap_resource *resource); */ bool coap_request_is_observe(const struct coap_packet *request); +/** + * @brief CoAP transmission parameters. + */ +struct coap_transmission_parameters { + /** Initial AKC timeout. Value is used as a base value to retry pending CoAP packets. */ + uint32_t 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. */ + uint8_t max_retransmission; +}; + /** * @brief Get currently active CoAP transmission parameters. * diff --git a/include/zephyr/net/coap_client.h b/include/zephyr/net/coap_client.h index e48048d5c26..c3de1abee27 100644 --- a/include/zephyr/net/coap_client.h +++ b/include/zephyr/net/coap_client.h @@ -83,6 +83,7 @@ struct coap_client_internal_request { uint32_t offset; uint32_t last_id; uint8_t request_tkl; + uint8_t retry_count; bool request_ongoing; struct coap_block_context recv_blk_ctx; struct coap_block_context send_blk_ctx; @@ -130,12 +131,12 @@ int coap_client_init(struct coap_client *client, const char *info); * @param sock Open socket file descriptor. * @param addr the destination address of the request, NULL if socket is already connected. * @param req CoAP request structure - * @param params Pointer to transmission parameters structure or NULL to use default values. + * @param retries How many times to retry or -1 to use default. * @return zero when operation started successfully or negative error code otherwise. */ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr *addr, - struct coap_client_request *req, struct coap_transmission_parameters *params); + struct coap_client_request *req, int retries); /** * @} diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index bfb643a8e8c..c21e14e5ded 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1553,7 +1553,7 @@ size_t coap_next_block(const struct coap_packet *cpkt, int coap_pending_init(struct coap_pending *pending, const struct coap_packet *request, const struct sockaddr *addr, - const struct coap_transmission_parameters *params) + uint8_t retries) { memset(pending, 0, sizeof(*pending)); @@ -1561,16 +1561,10 @@ int coap_pending_init(struct coap_pending *pending, memcpy(&pending->addr, addr, sizeof(*addr)); - if (params) { - pending->params = *params; - } else { - pending->params = coap_transmission_params; - } - pending->data = request->data; pending->len = request->offset; pending->t0 = k_uptime_get(); - pending->retries = pending->params.max_retransmission; + pending->retries = retries; return 0; } @@ -1682,12 +1676,12 @@ struct coap_pending *coap_pending_next_to_expire( return found; } -static uint32_t init_ack_timeout(const struct coap_transmission_parameters *params) +static uint32_t init_ack_timeout(void) { #if defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) - const uint32_t max_ack = params->ack_timeout * + const uint32_t max_ack = coap_transmission_params.ack_timeout * CONFIG_COAP_ACK_RANDOM_PERCENT / 100; - const uint32_t min_ack = params->ack_timeout; + const uint32_t min_ack = coap_transmission_params.ack_timeout; /* Randomly generated initial ACK timeout * ACK_TIMEOUT < INIT_ACK_TIMEOUT < ACK_TIMEOUT * ACK_RANDOM_FACTOR @@ -1695,7 +1689,7 @@ static uint32_t init_ack_timeout(const struct coap_transmission_parameters *para */ return min_ack + (sys_rand32_get() % (max_ack - min_ack)); #else - return params->ack_timeout; + return coap_transmission_params.ack_timeout; #endif /* defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) */ } @@ -1703,7 +1697,8 @@ bool coap_pending_cycle(struct coap_pending *pending) { if (pending->timeout == 0) { /* Initial transmission. */ - pending->timeout = init_ack_timeout(&pending->params); + pending->timeout = init_ack_timeout(); + return true; } @@ -1712,7 +1707,7 @@ bool coap_pending_cycle(struct coap_pending *pending) } pending->t0 += pending->timeout; - pending->timeout = pending->timeout * pending->params.coap_backoff_percent / 100; + pending->timeout = pending->timeout * coap_transmission_params.coap_backoff_percent / 100; pending->retries--; return true; diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 4bdf387a242..a947b15ae8e 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -16,6 +16,7 @@ LOG_MODULE_DECLARE(net_coap, CONFIG_COAP_LOG_LEVEL); #define COAP_VERSION 1 #define COAP_SEPARATE_TIMEOUT 6000 #define COAP_PERIODIC_TIMEOUT 500 +#define DEFAULT_RETRY_AMOUNT 5 #define BLOCK1_OPTION_SIZE 4 #define PAYLOAD_MARKER_SIZE 1 @@ -59,6 +60,7 @@ static void reset_internal_request(struct coap_client_internal_request *request) { request->offset = 0; request->last_id = 0; + request->retry_count = 0; reset_block_contexts(request); } @@ -275,7 +277,7 @@ static int coap_client_init_request(struct coap_client *client, } int coap_client_req(struct coap_client *client, int sock, const struct sockaddr *addr, - struct coap_client_request *req, struct coap_transmission_parameters *params) + struct coap_client_request *req, int retries) { int ret; @@ -350,8 +352,14 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr /* only TYPE_CON messages need pending tracking */ if (coap_header_get_type(&internal_req->request) == COAP_TYPE_CON) { + if (retries == -1) { + internal_req->retry_count = DEFAULT_RETRY_AMOUNT; + } else { + internal_req->retry_count = retries; + } + ret = coap_pending_init(&internal_req->pending, &internal_req->request, - &client->address, params); + &client->address, internal_req->retry_count); if (ret < 0) { LOG_ERR("Failed to initialize pending struct"); @@ -684,11 +692,9 @@ static int handle_response(struct coap_client *client, const struct coap_packet } if (coap_header_get_type(&internal_req->request) == COAP_TYPE_CON) { - struct coap_transmission_parameters params = - internal_req->pending.params; ret = coap_pending_init(&internal_req->pending, &internal_req->request, &client->address, - ¶ms); + internal_req->retry_count); if (ret < 0) { LOG_ERR("Error creating pending"); k_mutex_unlock(&client->send_mutex); @@ -787,9 +793,8 @@ static int handle_response(struct coap_client *client, const struct coap_packet goto fail; } - struct coap_transmission_parameters params = internal_req->pending.params; ret = coap_pending_init(&internal_req->pending, &internal_req->request, - &client->address, ¶ms); + &client->address, internal_req->retry_count); if (ret < 0) { LOG_ERR("Error creating pending"); k_mutex_unlock(&client->send_mutex); diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 66e5dcbc32c..ce312968ea7 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -542,8 +542,6 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack * try to send. */ if (coap_header_get_type(cpkt) == COAP_TYPE_CON) { - struct coap_transmission_parameters params; - struct coap_pending *pending = coap_pending_next_unused(service->data->pending, MAX_PENDINGS); @@ -552,9 +550,8 @@ int coap_service_send(const struct coap_service *service, const struct coap_pack goto send; } - params = coap_get_transmission_parameters(); - params.max_retransmission = CONFIG_COAP_SERVICE_PENDING_RETRANSMITS; - ret = coap_pending_init(pending, cpkt, addr, ¶ms); + ret = coap_pending_init(pending, cpkt, addr, + CONFIG_COAP_SERVICE_PENDING_RETRANSMITS); if (ret < 0) { LOG_WRN("Failed to init pending message for %s (%d)", service->name, ret); goto send; diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 677879304f8..02c62cee67c 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -654,7 +654,8 @@ int lwm2m_init_message(struct lwm2m_message *msg) goto cleanup; } - r = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr, NULL); + r = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr, + CONFIG_COAP_MAX_RETRANSMIT); if (r < 0) { LOG_ERR("Unable to initialize a pending " "retransmission (err:%d).", @@ -2593,7 +2594,8 @@ static int lwm2m_response_promote_to_con(struct lwm2m_message *msg) return -ENOMEM; } - ret = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr, NULL); + ret = coap_pending_init(msg->pending, &msg->cpkt, &msg->ctx->remote_addr, + CONFIG_COAP_MAX_RETRANSMIT); if (ret < 0) { LOG_ERR("Unable to initialize a pending " "retransmission (err:%d).", diff --git a/tests/net/lib/coap/src/main.c b/tests/net/lib/coap/src/main.c index 52b6cf0fd2a..c9d0456d332 100644 --- a/tests/net/lib/coap/src/main.c +++ b/tests/net/lib/coap/src/main.c @@ -779,7 +779,7 @@ ZTEST(coap, test_retransmit_second_round) zassert_not_null(pending, "No free pending"); r = coap_pending_init(pending, &cpkt, (struct sockaddr *) &dummy_addr, - NULL); + CONFIG_COAP_MAX_RETRANSMIT); zassert_equal(r, 0, "Could not initialize packet"); /* We "send" the packet the first time here */ diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 7d99c738950..e1240c5e2ed 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -378,7 +378,7 @@ ZTEST(coap_client, test_get_request) 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, &client_request, -1); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -409,7 +409,7 @@ ZTEST(coap_client, test_resend_request) 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, &client_request, -1); zassert_true(ret >= 0, "Sending request failed, %d", ret); k_sleep(K_MSEC(300)); set_socket_events(ZSOCK_POLLIN); @@ -441,7 +441,7 @@ ZTEST(coap_client, test_echo_option) 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, &client_request, -1); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -472,7 +472,7 @@ ZTEST(coap_client, test_echo_option_next_req) 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, &client_request, -1); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -487,7 +487,7 @@ ZTEST(coap_client, test_echo_option_next_req) client_request.len = strlen(payload); LOG_INF("Send next request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); + ret = coap_client_req(&client, 0, &address, &client_request, -1); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -516,7 +516,7 @@ ZTEST(coap_client, test_get_no_path) 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, &client_request, -1); zassert_equal(ret, -EINVAL, "Get request without path"); } @@ -541,7 +541,7 @@ ZTEST(coap_client, test_send_large_data) 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, &client_request, -1); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -563,11 +563,6 @@ ZTEST(coap_client, test_no_response) .payload = NULL, .len = 0 }; - struct coap_transmission_parameters params = { - .ack_timeout = 200, - .coap_backoff_percent = 200, - .max_retransmission = 0 - }; client_request.payload = short_payload; client_request.len = strlen(short_payload); @@ -576,7 +571,7 @@ ZTEST(coap_client, test_no_response) LOG_INF("Send request"); clear_socket_events(); - ret = coap_client_req(&client, 0, &address, &client_request, ¶ms); + ret = coap_client_req(&client, 0, &address, &client_request, 0); zassert_true(ret >= 0, "Sending request failed, %d", ret); k_sleep(K_MSEC(300)); @@ -606,7 +601,7 @@ ZTEST(coap_client, test_separate_response) 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, &client_request, -1); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -637,10 +632,10 @@ ZTEST(coap_client, test_multiple_requests) set_socket_events(ZSOCK_POLLIN); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); + ret = coap_client_req(&client, 0, &address, &client_request, -1); 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, &client_request, -1); zassert_true(ret >= 0, "Sending request failed, %d", ret); k_sleep(K_MSEC(5)); @@ -665,11 +660,6 @@ ZTEST(coap_client, test_unmatching_tokens) .payload = NULL, .len = 0 }; - struct coap_transmission_parameters params = { - .ack_timeout = 200, - .coap_backoff_percent = 200, - .max_retransmission = 0 - }; client_request.payload = short_payload; client_request.len = strlen(short_payload); @@ -677,7 +667,7 @@ ZTEST(coap_client, test_unmatching_tokens) z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_unmatching; LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, ¶ms); + ret = coap_client_req(&client, 0, &address, &client_request, 0); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -685,5 +675,4 @@ ZTEST(coap_client, test_unmatching_tokens) k_sleep(K_MSEC(1)); clear_socket_events(); k_sleep(K_MSEC(500)); - zassert_equal(last_response_code, -ETIMEDOUT, "Unexpected response"); } From 532693ee7b19926a2b60f1111432aea14455dc35 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:01 +0100 Subject: [PATCH 1232/2300] Revert "[nrf fromtree] net: lib: lwm2m: use correct format specifier for LOG_ERR" This reverts commit 44f5c1689319dac5d4ffa6567152ae76c70b7672. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_obj_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_device.c b/subsys/net/lib/lwm2m/lwm2m_obj_device.c index f5399fefc1e..9416b3cf92c 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_device.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_device.c @@ -261,7 +261,7 @@ static int lwm2m_obj_device_settings_set(const char *name, size_t len, if (settings_name_steq(name, ERROR_LIST_KEY, &next) && !next) { if (len > sizeof(error_code_list)) { - LOG_ERR("Error code list too large: %zu", len); + LOG_ERR("Error code list too large: %u", len); return -EINVAL; } From e69cbabe78371e69c1b689b1eaf39bd73187f055 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:02 +0100 Subject: [PATCH 1233/2300] Revert "[nrf fromtree] net: lib: coap: Add new API to configure retransmission settings" This reverts commit 6691357f9cb3236c036f8bf773ec0b29b17e06b6. Signed-off-by: Robert Lubos --- include/zephyr/net/coap.h | 26 ------------------------ subsys/net/lib/coap/Kconfig | 7 ------- subsys/net/lib/coap/coap.c | 24 ++++------------------ tests/net/lib/coap_client/CMakeLists.txt | 2 -- 4 files changed, 4 insertions(+), 55 deletions(-) diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index e4374f41e34..dceed869b43 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -1134,32 +1134,6 @@ int coap_resource_notify(struct coap_resource *resource); */ bool coap_request_is_observe(const struct coap_packet *request); -/** - * @brief CoAP transmission parameters. - */ -struct coap_transmission_parameters { - /** Initial AKC timeout. Value is used as a base value to retry pending CoAP packets. */ - uint32_t 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. */ - uint8_t max_retransmission; -}; - -/** - * @brief Get currently active CoAP transmission parameters. - * - * @return CoAP transmission parameters structure. - */ -struct coap_transmission_parameters coap_get_transmission_parameters(void); - -/** - * @brief Set CoAP transmission parameters. - * - * @param params Pointer to the transmission parameters structure. - */ -void coap_set_transmission_parameters(const struct coap_transmission_parameters *params); - #ifdef __cplusplus } #endif diff --git a/subsys/net/lib/coap/Kconfig b/subsys/net/lib/coap/Kconfig index f4d002d0c5d..cc6bee04f53 100644 --- a/subsys/net/lib/coap/Kconfig +++ b/subsys/net/lib/coap/Kconfig @@ -82,13 +82,6 @@ config COAP_MAX_RETRANSMIT default 4 range 1 10 -config COAP_BACKOFF_PERCENT - int "Retransmission backoff factor for ACK timeout described as percentage" - default 200 - help - Factor described as percentage to extend CoAP ACK timeout for retransmissions. - A value of 200 means a factor of 2.0. - config COAP_URI_WILDCARD bool "Wildcards in CoAP resource path" default y diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index c21e14e5ded..c49264e6776 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -54,12 +54,6 @@ LOG_MODULE_REGISTER(net_coap, CONFIG_COAP_LOG_LEVEL); /* The CoAP message ID that is incremented each time coap_next_id() is called. */ 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, - .coap_backoff_percent = CONFIG_COAP_BACKOFF_PERCENT -}; - static int insert_option(struct coap_packet *cpkt, uint16_t code, const uint8_t *value, uint16_t len); @@ -1679,9 +1673,9 @@ struct coap_pending *coap_pending_next_to_expire( static uint32_t init_ack_timeout(void) { #if defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) - const uint32_t max_ack = coap_transmission_params.ack_timeout * + const uint32_t max_ack = CONFIG_COAP_INIT_ACK_TIMEOUT_MS * CONFIG_COAP_ACK_RANDOM_PERCENT / 100; - const uint32_t min_ack = coap_transmission_params.ack_timeout; + const uint32_t min_ack = CONFIG_COAP_INIT_ACK_TIMEOUT_MS; /* Randomly generated initial ACK timeout * ACK_TIMEOUT < INIT_ACK_TIMEOUT < ACK_TIMEOUT * ACK_RANDOM_FACTOR @@ -1689,7 +1683,7 @@ static uint32_t init_ack_timeout(void) */ return min_ack + (sys_rand32_get() % (max_ack - min_ack)); #else - return coap_transmission_params.ack_timeout; + return CONFIG_COAP_INIT_ACK_TIMEOUT_MS; #endif /* defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) */ } @@ -1707,7 +1701,7 @@ bool coap_pending_cycle(struct coap_pending *pending) } pending->t0 += pending->timeout; - pending->timeout = pending->timeout * coap_transmission_params.coap_backoff_percent / 100; + pending->timeout = pending->timeout << 1; pending->retries--; return true; @@ -2012,13 +2006,3 @@ uint16_t coap_next_id(void) { return message_id++; } - -struct coap_transmission_parameters coap_get_transmission_parameters(void) -{ - return coap_transmission_params; -} - -void coap_set_transmission_parameters(const struct coap_transmission_parameters *params) -{ - coap_transmission_params = *params; -} diff --git a/tests/net/lib/coap_client/CMakeLists.txt b/tests/net/lib/coap_client/CMakeLists.txt index cb86d78f611..2e94112f0b0 100644 --- a/tests/net/lib/coap_client/CMakeLists.txt +++ b/tests/net/lib/coap_client/CMakeLists.txt @@ -27,5 +27,3 @@ add_compile_definitions(CONFIG_COAP_LOG_LEVEL=4) add_compile_definitions(CONFIG_COAP_INIT_ACK_TIMEOUT_MS=200) 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) From ccaba81929725afeef037ac3231c246f8a8e8520 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:02 +0100 Subject: [PATCH 1234/2300] Revert "[nrf fromtree] doc: connectivity: networking: api: Add doxygengroup for coap_mgmt" This reverts commit 0212686f70e777a7d772372fb0b73b7c74a608a8. Signed-off-by: Robert Lubos --- doc/connectivity/networking/api/coap_server.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/connectivity/networking/api/coap_server.rst b/doc/connectivity/networking/api/coap_server.rst index eb816665f41..9a91081f449 100644 --- a/doc/connectivity/networking/api/coap_server.rst +++ b/doc/connectivity/networking/api/coap_server.rst @@ -245,4 +245,3 @@ API Reference ************* .. doxygengroup:: coap_service -.. doxygengroup:: coap_mgmt From ccaedb82e55ad3e01661ee8df20f2a70a351e19b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:02 +0100 Subject: [PATCH 1235/2300] Revert "[nrf fromtree] test: lwm2m: Run interop tests in tickless mode" This reverts commit dec7ead8c28dc452408d6e80707a1d837fb5ae13. Signed-off-by: Robert Lubos --- tests/net/lib/lwm2m/interop/prj.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/prj.conf b/tests/net/lib/lwm2m/interop/prj.conf index 6115e6f40e3..43d4e73f081 100644 --- a/tests/net/lib/lwm2m/interop/prj.conf +++ b/tests/net/lib/lwm2m/interop/prj.conf @@ -18,9 +18,6 @@ CONFIG_LWM2M=y CONFIG_LWM2M_IPSO_SUPPORT=y CONFIG_LWM2M_SHELL=y -CONFIG_LWM2M_TICKLESS=y -CONFIG_NET_SOCKETPAIR=y - #Enable Portfolio object CONFIG_LWM2M_PORTFOLIO_OBJ_SUPPORT=y From 6f6b8657a22f1d03329266d75311f2dc3f47e20f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:02 +0100 Subject: [PATCH 1236/2300] Revert "[nrf fromtree] net: lwm2m: Fix pmin handling on tickless" This reverts commit 0b4beb59cd1b25d18a881179ca22f5e2fa9c1bb9. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_engine.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 959d07419d3..45d3822bdbb 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -581,24 +581,14 @@ void lwm2m_socket_del(struct lwm2m_ctx *ctx) lwm2m_engine_wake_up(); } -/* Generate notify messages. Return timestamp of next Notify event */ -static int64_t check_notifications(struct lwm2m_ctx *ctx, const int64_t timestamp) +static void check_notifications(struct lwm2m_ctx *ctx, const int64_t timestamp) { struct observe_node *obs; int rc; - int64_t next = INT64_MAX; lwm2m_registry_lock(); SYS_SLIST_FOR_EACH_CONTAINER(&ctx->observer, obs, node) { - if (!obs->event_timestamp) { - continue; - } - - if (obs->event_timestamp < next) { - next = obs->event_timestamp; - } - - if (timestamp < obs->event_timestamp) { + if (!obs->event_timestamp || timestamp < obs->event_timestamp) { continue; } /* Check That There is not pending process*/ @@ -614,7 +604,6 @@ static int64_t check_notifications(struct lwm2m_ctx *ctx, const int64_t timestam obs->event_timestamp = engine_observe_shedule_next_event(obs, ctx->srv_obj_inst, timestamp); obs->last_timestamp = timestamp; - if (!rc) { /* create at most one notification */ goto cleanup; @@ -622,7 +611,6 @@ static int64_t check_notifications(struct lwm2m_ctx *ctx, const int64_t timestam } cleanup: lwm2m_registry_unlock(); - return next; } static int socket_recv_message(struct lwm2m_ctx *client_ctx) @@ -716,7 +704,7 @@ static void socket_loop(void *p1, void *p2, void *p3) int i, rc; int64_t now, next; - int64_t timeout, next_tx; + int64_t timeout, next_retransmit; bool rd_client_paused; while (1) { @@ -753,15 +741,12 @@ static void socket_loop(void *p1, void *p2, void *p3) if (!sys_slist_is_empty(&sock_ctx[i]->pending_sends)) { continue; } - next_tx = retransmit_request(sock_ctx[i], now); - if (next_tx < next) { - next = next_tx; + next_retransmit = retransmit_request(sock_ctx[i], now); + if (next_retransmit < next) { + next = next_retransmit; } if (lwm2m_rd_client_is_registred(sock_ctx[i])) { - next_tx = check_notifications(sock_ctx[i], now); - if (next_tx < next) { - next = next_tx; - } + check_notifications(sock_ctx[i], now); } } From b40dc757d71205c95257f4dee2efde1801282378 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:03 +0100 Subject: [PATCH 1237/2300] Revert "[nrf fromtree] test: lwm2m: Implement missing test case 103" This reverts commit a958fd37b75eddaa2d7dd1f4fb0fee8447f9e315. Signed-off-by: Robert Lubos --- tests/net/lib/lwm2m/interop/README.md | 2 +- tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index 7df931203aa..28d8e12ccca 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -135,7 +135,7 @@ Tests are written from test spec; |LightweightM2M-1.1-int-9 - Bootstrap and Configuration Consistency | |testcase not implemented | |LightweightM2M-1.1-int-101 - Initial Registration |:white_check_mark:| | |LightweightM2M-1.1-int-102 - Registration Update |:white_check_mark:| | -|LightweightM2M-1.1-int-103 - Deregistration |:white_check_mark:| | +|LightweightM2M-1.1-int-103 - Deregistration |:large_orange_diamond:|We don't have "disabled" functionality in server object| |LightweightM2M-1.1-int-104 - Registration Update Trigge |:white_check_mark:| | |LightweightM2M-1.1-int-105 - Discarded Register Update |:white_check_mark:| | |LightweightM2M-1.1-int-107 - Extending the lifetime of a registration |:white_check_mark:| | diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index 4e0ae207e8d..ed7aaceac20 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -44,17 +44,6 @@ def test_LightweightM2M_1_1_int_102(shell: Shell, dut: DeviceAdapter, leshan: Le assert latest["lifetime"] == lifetime shell.exec_command('lwm2m write 1/0/1 -u32 86400') -def test_LightweightM2M_1_1_int_103(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): - """LightweightM2M-1.1-int-103 - Deregistration""" - leshan.execute(endpoint, '1/0/4') - dut.readlines_until(regex='LwM2M server disabled', timeout=5.0) - dut.readlines_until(regex='Deregistration success', timeout=5.0) - # Reset timers by restarting the client - shell.exec_command('lwm2m stop') - time.sleep(1) - shell.exec_command(f'lwm2m start {endpoint}') - dut.readlines_until(regex='.*Registration Done', timeout=5.0) - def test_LightweightM2M_1_1_int_104(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-104 - Registration Update Trigger""" shell.exec_command('lwm2m update') From 5b3dbad18dafde6ff13f840f0934603f1b18bc70 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:03 +0100 Subject: [PATCH 1238/2300] Revert "[nrf fromtree] test: lwm2m: Implement bootstrap tests 4 - 7" This reverts commit 372433c99338379d1db5f8d0450ac72ad72ef14a. Signed-off-by: Robert Lubos --- tests/net/lib/lwm2m/interop/README.md | 8 --- tests/net/lib/lwm2m/interop/prj.conf | 5 -- .../lwm2m/interop/pytest/test_bootstrap.py | 63 +++---------------- .../net/lib/lwm2m/interop/src/lwm2m-client.c | 11 ---- 4 files changed, 8 insertions(+), 79 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index 28d8e12ccca..3acbfcc71f8 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -125,14 +125,6 @@ Tests are written from test spec; |---------|------|-----| |LightweightM2M-1.1-int-0 - Client Initiated Bootstrap |:white_check_mark:| | |LightweightM2M-1.1-int-1 - Client Initiated Bootstrap Full (PSK) |:white_check_mark:| | -|LightweightM2M-1.1-int-2 - Client Initiated Bootstrap Full (Cert) | |testcase not implemented | -|LightweightM2M-1.1-int-3 – Simple Bootstrap from Smartcard |:large_orange_diamond:|We don't have any smartcard support.| -|LightweightM2M-1.1-int-4 - Bootstrap Delete |:white_check_mark:| | -|LightweightM2M-1.1-int-5 - Server Initiated Bootstrap |:white_check_mark:| | -|LightweightM2M-1.1-int-6 - Bootstrap Sequence |:white_check_mark:| | -|LightweightM2M-1.1-int-7 - Fallback to bootstrap |:white_check_mark:| | -|LightweightM2M-1.1-int-8 - Bootstrap Read | |Test cannot be implemented from client side.| -|LightweightM2M-1.1-int-9 - Bootstrap and Configuration Consistency | |testcase not implemented | |LightweightM2M-1.1-int-101 - Initial Registration |:white_check_mark:| | |LightweightM2M-1.1-int-102 - Registration Update |:white_check_mark:| | |LightweightM2M-1.1-int-103 - Deregistration |:large_orange_diamond:|We don't have "disabled" functionality in server object| diff --git a/tests/net/lib/lwm2m/interop/prj.conf b/tests/net/lib/lwm2m/interop/prj.conf index 43d4e73f081..07bd9a0535d 100644 --- a/tests/net/lib/lwm2m/interop/prj.conf +++ b/tests/net/lib/lwm2m/interop/prj.conf @@ -44,11 +44,6 @@ CONFIG_LWM2M_RW_OMA_TLV_SUPPORT=y CONFIG_COAP_EXTENDED_OPTIONS_LEN=y CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=40 -# Speed up testing, we are running in non-lossy network -CONFIG_COAP_INIT_ACK_TIMEOUT_MS=1000 -CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT=n -CONFIG_LWM2M_RD_CLIENT_MAX_RETRIES=2 - # Use QUEUE mode by default CONFIG_LWM2M_QUEUE_MODE_ENABLED=y CONFIG_LWM2M_QUEUE_MODE_UPTIME=20 diff --git a/tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py b/tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py index 2a45669d912..65561db0676 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py @@ -15,11 +15,9 @@ """ import logging -import pytest from leshan import Leshan from twister_harness import Shell from twister_harness import DeviceAdapter -from conftest import Endpoint logger = logging.getLogger(__name__) @@ -31,69 +29,24 @@ # Bootstrap Interface: [0-99] # -def verify_LightweightM2M_1_1_int_0(dut: DeviceAdapter, endpoint_bootstrap: Endpoint): +def verify_LightweightM2M_1_1_int_0(shell: Shell, dut: DeviceAdapter): """LightweightM2M-1.1-int-0 - Client Initiated Bootstrap""" - dut.readlines_until(regex='.*Bootstrap transfer complete', timeout=5.0) - endpoint_bootstrap.bootstrap = True + dut.readlines_until(regex='.*Bootstrap started with endpoint', timeout=5.0) + dut.readlines_until(regex='.*Bootstrap registration done', timeout=5.0) + dut.readlines_until(regex='.*Bootstrap data transfer done', timeout=5.0) -def test_LightweightM2M_1_1_int_1(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint_bootstrap: Endpoint): +def test_LightweightM2M_1_1_int_1(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint_bootstrap: str): """LightweightM2M-1.1-int-1 - Client Initiated Bootstrap Full (PSK)""" - verify_LightweightM2M_1_1_int_0(dut, endpoint_bootstrap) + verify_LightweightM2M_1_1_int_0(shell, dut) verify_LightweightM2M_1_1_int_101(shell, dut, leshan, endpoint_bootstrap) verify_LightweightM2M_1_1_int_401(shell, leshan, endpoint_bootstrap) -def test_LightweightM2M_1_1_int_4(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: Endpoint): - """LightweightM2M-1.1-int-4 - Bootstrap Delete""" - shell.exec_command('lwm2m create 1/2') - shell.exec_command('lwm2m read 1/2/0') - retval = int(shell.get_filtered_output(shell.exec_command('retval'))[0]) - assert retval == 0 - leshan.execute(endpoint, '1/0/9') - dut.readlines_until(regex='.*Registration Done', timeout=5.0) - shell.exec_command('lwm2m read 1/2/0') - retval = int(shell.get_filtered_output(shell.exec_command('retval'))[0]) - assert retval < 0 - logger.info('retval: %s', retval) - -def test_LightweightM2M_1_1_int_5(dut: DeviceAdapter, leshan: Leshan, endpoint: Endpoint): - """LightweightM2M-1.1-int-5 - Server Initiated Bootstrap""" - leshan.execute(endpoint, '1/0/9') - dut.readlines_until(regex='.*Server Initiated Bootstrap', timeout=1) - dut.readlines_until(regex='.*Bootstrap transfer complete', timeout=5.0) - dut.readlines_until(regex='.*Registration Done', timeout=5.0) - -def test_LightweightM2M_1_1_int_6(shell: Shell, dut: DeviceAdapter, endpoint: Endpoint): - """LightweightM2M-1.1-int-6 - Bootstrap Sequence""" - shell.exec_command('lwm2m stop') - dut.readlines_until(regex=r'.*Deregistration success', timeout=5) - shell.exec_command(f'lwm2m start {endpoint}') - lines = dut.readlines_until(regex='.*Registration Done', timeout=5.0) - assert not any("Bootstrap" in line for line in lines) - shell.exec_command('lwm2m stop') - dut.readlines_until(regex=r'.*Deregistration success', timeout=5) - shell.exec_command("lwm2m delete 1/0") - shell.exec_command("lwm2m delete 0/1") - shell.exec_command(f'lwm2m start {endpoint}') - lines = dut.readlines_until(regex='.*Registration Done', timeout=5.0) - assert any("Bootstrap" in line for line in lines) - -@pytest.mark.slow -def test_LightweightM2M_1_1_int_7(shell: Shell, dut: DeviceAdapter, endpoint: Endpoint): - """LightweightM2M-1.1-int-7 - Fallback to bootstrap""" - shell.exec_command('lwm2m stop') - dut.readlines_until(regex=r'.*Deregistration success', timeout=5) - shell.exec_command('lwm2m write 0/1/0 -s coaps://10.10.10.10:5684') - shell.exec_command(f'lwm2m start {endpoint}') - lines = dut.readlines_until(regex='.*Registration Done', timeout=600.0) - assert any("Bootstrap" in line for line in lines) - -def verify_LightweightM2M_1_1_int_101(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: Endpoint): +def verify_LightweightM2M_1_1_int_101(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-101 - Initial Registration""" dut.readlines_until(regex='.*Registration Done', timeout=5.0) assert leshan.get(f'/clients/{endpoint}') - endpoint.registered = True -def verify_LightweightM2M_1_1_int_401(shell: Shell, leshan: Leshan, endpoint: Endpoint): +def verify_LightweightM2M_1_1_int_401(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-401 - UDP Channel Security - Pre-shared Key Mode""" lines = shell.get_filtered_output(shell.exec_command('lwm2m read 0/0/0 -s')) host = lines[0] diff --git a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c index a150f1b41cb..b6634069fbd 100644 --- a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c +++ b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c @@ -73,17 +73,6 @@ int set_socketoptions(struct lwm2m_ctx *ctx) ret = -errno; LOG_ERR("Failed to enable TLS_DTLS_CID: %d", ret); } - - /* Allow DTLS handshake to timeout much faster. - * these tests run on TUN/TAP network, so there should be no network latency. - */ - uint32_t min = 100; - uint32_t max = 500; - - zsock_setsockopt(ctx->sock_fd, SOL_TLS, TLS_DTLS_HANDSHAKE_TIMEOUT_MIN, &min, - sizeof(min)); - zsock_setsockopt(ctx->sock_fd, SOL_TLS, TLS_DTLS_HANDSHAKE_TIMEOUT_MAX, &max, - sizeof(max)); } return lwm2m_set_default_sockopt(ctx); } From 44e9d42e8dda2a6d9fd6e9e40d039b9b577eb2e0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:03 +0100 Subject: [PATCH 1239/2300] Revert "[nrf fromtree] net: lwm2m: Reduce dependency on firmware update pull Kconfig" This reverts commit 66c0ad07f4adedc88f78cc82a68808990802e6b7. Signed-off-by: Robert Lubos --- include/zephyr/net/lwm2m.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index 51324f63153..6ac0458af87 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -551,6 +551,7 @@ void lwm2m_firmware_set_cancel_cb_inst(uint16_t obj_inst_id, lwm2m_engine_user_c */ lwm2m_engine_user_cb_t lwm2m_firmware_get_cancel_cb_inst(uint16_t obj_inst_id); +#if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT) || defined(__DOXYGEN__) /** * @brief Set data callback to handle firmware update execute events. * @@ -587,6 +588,8 @@ void lwm2m_firmware_set_update_cb_inst(uint16_t obj_inst_id, lwm2m_engine_execut */ lwm2m_engine_execute_cb_t lwm2m_firmware_get_update_cb_inst(uint16_t obj_inst_id); #endif +#endif + #if defined(CONFIG_LWM2M_SWMGMT_OBJ_SUPPORT) || defined(__DOXYGEN__) From d4323fc3d9e35d8efeee5090388733005fb60baf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:04 +0100 Subject: [PATCH 1240/2300] Revert "[nrf fromtree] samples: net: sockets: coap_server: Add CoAP events example" This reverts commit 5857c08502121b0beaefc5de13c3a90db748446c. Signed-off-by: Robert Lubos --- samples/net/sockets/coap_server/prj.conf | 5 -- samples/net/sockets/coap_server/src/events.c | 50 -------------------- 2 files changed, 55 deletions(-) delete mode 100644 samples/net/sockets/coap_server/src/events.c diff --git a/samples/net/sockets/coap_server/prj.conf b/samples/net/sockets/coap_server/prj.conf index 59d444db456..e9ff24577b7 100644 --- a/samples/net/sockets/coap_server/prj.conf +++ b/samples/net/sockets/coap_server/prj.conf @@ -29,11 +29,6 @@ CONFIG_COAP_SERVER_SHELL=y # Configuration CONFIG_NET_CONFIG_SETTINGS=y -# Events -CONFIG_NET_MGMT=y -CONFIG_NET_MGMT_EVENT=y -CONFIG_NET_MGMT_EVENT_INFO=y - # Enable only one protocol, if you enable both sources # won't compile. # IPv6 Support diff --git a/samples/net/sockets/coap_server/src/events.c b/samples/net/sockets/coap_server/src/events.c deleted file mode 100644 index 3f843fba017..00000000000 --- a/samples/net/sockets/coap_server/src/events.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2023 Basalte bv - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -LOG_MODULE_DECLARE(net_coap_service_sample); - -#include -#include - -#define COAP_EVENTS_SET (NET_EVENT_COAP_OBSERVER_ADDED | NET_EVENT_COAP_OBSERVER_REMOVED | \ - NET_EVENT_COAP_SERVICE_STARTED | NET_EVENT_COAP_SERVICE_STOPPED) - -void coap_event_handler(uint32_t mgmt_event, struct net_if *iface, - void *info, size_t info_length, void *user_data) -{ - ARG_UNUSED(iface); - ARG_UNUSED(user_data); - - switch (mgmt_event) { - case NET_EVENT_COAP_OBSERVER_ADDED: - LOG_INF("CoAP observer added"); - break; - case NET_EVENT_COAP_OBSERVER_REMOVED: - LOG_INF("CoAP observer removed"); - break; - case NET_EVENT_COAP_SERVICE_STARTED: - if (info != NULL && info_length == sizeof(struct net_event_coap_service)) { - struct net_event_coap_service *net_event = info; - - LOG_INF("CoAP service %s started", net_event->service->name); - } else { - LOG_INF("CoAP service started"); - } - break; - case NET_EVENT_COAP_SERVICE_STOPPED: - if (info != NULL && info_length == sizeof(struct net_event_coap_service)) { - struct net_event_coap_service *net_event = info; - - LOG_INF("CoAP service %s stopped", net_event->service->name); - } else { - LOG_INF("CoAP service stopped"); - } - break; - } -} - -NET_MGMT_REGISTER_EVENT_HANDLER(coap_events, COAP_EVENTS_SET, coap_event_handler, NULL); From 2741dae002985dac8c6781ab78a992864d78199c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:04 +0100 Subject: [PATCH 1241/2300] Revert "[nrf fromtree] net: lib: coap: Introduce net mgmt events for CoAP" This reverts commit db5c9caafa0d4789d3db3ecda3391b6547668b13. Signed-off-by: Robert Lubos --- include/zephyr/net/coap_mgmt.h | 102 ------------------------------ subsys/net/lib/coap/coap.c | 30 +-------- subsys/net/lib/coap/coap_server.c | 25 +------- 3 files changed, 4 insertions(+), 153 deletions(-) delete mode 100644 include/zephyr/net/coap_mgmt.h diff --git a/include/zephyr/net/coap_mgmt.h b/include/zephyr/net/coap_mgmt.h deleted file mode 100644 index f19eec6eb4b..00000000000 --- a/include/zephyr/net/coap_mgmt.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2023 Basalte bv - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief CoAP Events code public header - */ - -#ifndef ZEPHYR_INCLUDE_NET_COAP_MGMT_H_ -#define ZEPHYR_INCLUDE_NET_COAP_MGMT_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief CoAP Manager Events - * @defgroup coap_mgmt CoAP Manager Events - * @ingroup networking - * @{ - */ - -/** @cond INTERNAL_HIDDEN */ - -/* CoAP events */ -#define _NET_COAP_LAYER NET_MGMT_LAYER_L4 -#define _NET_COAP_CODE 0x1c0 -#define _NET_COAP_IF_BASE (NET_MGMT_EVENT_BIT | \ - NET_MGMT_LAYER(_NET_COAP_LAYER) | \ - NET_MGMT_LAYER_CODE(_NET_COAP_CODE)) - -struct coap_service; -struct coap_resource; -struct coap_observer; - -/** @endcond */ - -enum net_event_coap_cmd { - /* Service events */ - NET_EVENT_COAP_CMD_SERVICE_STARTED = 1, - NET_EVENT_COAP_CMD_SERVICE_STOPPED, - /* Observer events */ - NET_EVENT_COAP_CMD_OBSERVER_ADDED, - NET_EVENT_COAP_CMD_OBSERVER_REMOVED, -}; - -/** - * @brief coap_mgmt event raised when a service has started - */ -#define NET_EVENT_COAP_SERVICE_STARTED \ - (_NET_COAP_IF_BASE | NET_EVENT_COAP_CMD_SERVICE_STARTED) - -/** - * @brief coap_mgmt event raised when a service has stopped - */ -#define NET_EVENT_COAP_SERVICE_STOPPED \ - (_NET_COAP_IF_BASE | NET_EVENT_COAP_CMD_SERVICE_STOPPED) - -/** - * @brief coap_mgmt event raised when an observer has been added to a resource - */ -#define NET_EVENT_COAP_OBSERVER_ADDED \ - (_NET_COAP_IF_BASE | NET_EVENT_COAP_CMD_OBSERVER_ADDED) - -/** - * @brief coap_mgmt event raised when an observer has been removed from a resource - */ -#define NET_EVENT_COAP_OBSERVER_REMOVED \ - (_NET_COAP_IF_BASE | NET_EVENT_COAP_CMD_OBSERVER_REMOVED) - -/** - * @brief CoAP Service event structure. - */ -struct net_event_coap_service { - /* The CoAP service for which the event is emitted */ - const struct coap_service *service; -}; - -/** - * @brief CoAP Observer event structure. - */ -struct net_event_coap_observer { - /* The CoAP resource for which the event is emitted */ - struct coap_resource *resource; - /* The observer that is added/removed */ - struct coap_observer *observer; -}; - -#ifdef __cplusplus -} -#endif - -/** - * @} - */ - -#endif /* ZEPHYR_INCLUDE_NET_COAP_MGMT_H_ */ diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index c49264e6776..e2ff715aec6 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -23,7 +23,6 @@ LOG_MODULE_REGISTER(net_coap, CONFIG_COAP_LOG_LEVEL); #include #include #include -#include #define COAP_PATH_ELEM_DELIM '/' #define COAP_PATH_ELEM_QUERY '?' @@ -1845,25 +1844,6 @@ void coap_observer_init(struct coap_observer *observer, net_ipaddr_copy(&observer->addr, addr); } -static inline void coap_observer_raise_event(struct coap_resource *resource, - struct coap_observer *observer, - uint32_t mgmt_event) -{ -#ifdef CONFIG_NET_MGMT_EVENT_INFO - const struct net_event_coap_observer net_event = { - .resource = resource, - .observer = observer, - }; - - net_mgmt_event_notify_with_info(mgmt_event, NULL, (void *)&net_event, sizeof(net_event)); -#else - ARG_UNUSED(resource); - ARG_UNUSED(observer); - - net_mgmt_event_notify(mgmt_event, NULL); -#endif -} - bool coap_register_observer(struct coap_resource *resource, struct coap_observer *observer) { @@ -1876,21 +1856,13 @@ bool coap_register_observer(struct coap_resource *resource, resource->age = 2; } - coap_observer_raise_event(resource, observer, NET_EVENT_COAP_OBSERVER_ADDED); - return first; } bool coap_remove_observer(struct coap_resource *resource, struct coap_observer *observer) { - if (!sys_slist_find_and_remove(&resource->observers, &observer->list)) { - return false; - } - - coap_observer_raise_event(resource, observer, NET_EVENT_COAP_OBSERVER_REMOVED); - - return true; + return sys_slist_find_and_remove(&resource->observers, &observer->list); } static bool sockaddr_equal(const struct sockaddr *a, diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index ce312968ea7..386bc2081bb 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -14,7 +14,6 @@ LOG_MODULE_DECLARE(net_coap, CONFIG_COAP_LOG_LEVEL); #include #include #include -#include #include #ifdef CONFIG_ARCH_POSIX #include @@ -346,21 +345,6 @@ static inline bool coap_service_in_section(const struct coap_service *service) STRUCT_SECTION_END(coap_service) > service; } -static inline void coap_service_raise_event(const struct coap_service *service, uint32_t mgmt_event) -{ -#if defined(CONFIG_NET_MGMT_EVENT_INFO) - const struct net_event_coap_service net_event = { - .service = service, - }; - - net_mgmt_event_notify_with_info(mgmt_event, NULL, (void *)&net_event, sizeof(net_event)); -#else - ARG_UNUSED(service); - - net_mgmt_event_notify(mgmt_event, NULL); -#endif -} - int coap_service_start(const struct coap_service *service) { int ret; @@ -462,8 +446,6 @@ int coap_service_start(const struct coap_service *service) coap_server_update_services(); - coap_service_raise_event(service, NET_EVENT_COAP_SERVICE_STARTED); - return ret; close: @@ -487,18 +469,17 @@ int coap_service_stop(const struct coap_service *service) k_mutex_lock(&lock, K_FOREVER); if (service->data->sock_fd < 0) { - k_mutex_unlock(&lock); - return -EALREADY; + ret = -EALREADY; + goto end; } /* Closing a socket will trigger a poll event */ ret = zsock_close(service->data->sock_fd); service->data->sock_fd = -1; +end: k_mutex_unlock(&lock); - coap_service_raise_event(service, NET_EVENT_COAP_SERVICE_STOPPED); - return ret; } From 8a34fafaef926badf1d35a13eaafc60c6f87323b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:04 +0100 Subject: [PATCH 1242/2300] Revert "[nrf fromtree] Revert "net: lib: coap: Add support for observer event callbacks"" This reverts commit ae0c47277db55ee81bcbb9eb7babf6fcca3d0cea. Signed-off-by: Robert Lubos --- include/zephyr/net/coap.h | 30 ++++++++++++++++++++++++++++++ subsys/net/lib/coap/Kconfig | 6 ++++++ subsys/net/lib/coap/coap.c | 17 ++++++++++++++++- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index dceed869b43..a907d1311e1 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -238,6 +238,29 @@ typedef int (*coap_method_t)(struct coap_resource *resource, typedef void (*coap_notify_t)(struct coap_resource *resource, struct coap_observer *observer); +/** + * @brief Event types for observer event callbacks. + */ +enum coap_observer_event { + /** An observer was added. */ + COAP_OBSERVER_ADDED = 0, + /** An observer was removed. */ + COAP_OBSERVER_REMOVED, +}; + +/** + * @typedef coap_observer_event_handler_t + * @brief Type of the handler being called when a resource's observers has been modified. + * Either an observer was added or removed. + * + * @param resource A pointer to a CoAP resource for which the event occurred + * @param observer The observer being added/removed + * @param event The event type + */ +typedef void (*coap_observer_event_handler_t)(struct coap_resource *resource, + struct coap_observer *observer, + enum coap_observer_event event); + /** * @brief Description of CoAP resource. * @@ -252,6 +275,13 @@ struct coap_resource { void *user_data; sys_slist_t observers; int age; +#if defined(CONFIG_COAP_OBSERVER_EVENTS) || defined(DOXYGEN) + /** + * Optional observer event callback function + * Only available when @kconfig{CONFIG_COAP_OBSERVER_EVENTS} is enabled. + */ + coap_observer_event_handler_t observer_event_handler; +#endif }; /** diff --git a/subsys/net/lib/coap/Kconfig b/subsys/net/lib/coap/Kconfig index cc6bee04f53..8e62983ea72 100644 --- a/subsys/net/lib/coap/Kconfig +++ b/subsys/net/lib/coap/Kconfig @@ -89,6 +89,12 @@ config COAP_URI_WILDCARD This option enables MQTT-style wildcards in path. Disable it if resource path may contain plus or hash symbol. +config COAP_OBSERVER_EVENTS + bool "CoAP resource observer events" + help + This option enables to register a callback function to CoAP resources + that will be called when adding/removing observers. + config COAP_KEEP_USER_DATA bool "Keeping user data in the CoAP packet" help diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index e2ff715aec6..9fe62730b47 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1856,13 +1856,28 @@ bool coap_register_observer(struct coap_resource *resource, resource->age = 2; } +#ifdef CONFIG_COAP_OBSERVER_EVENTS + if (resource->observer_event_handler) { + resource->observer_event_handler(resource, observer, COAP_OBSERVER_ADDED); + } +#endif + return first; } bool coap_remove_observer(struct coap_resource *resource, struct coap_observer *observer) { - return sys_slist_find_and_remove(&resource->observers, &observer->list); + if (!sys_slist_find_and_remove(&resource->observers, &observer->list)) { + return false; + } + +#ifdef CONFIG_COAP_OBSERVER_EVENTS + if (resource->observer_event_handler) { + resource->observer_event_handler(resource, observer, COAP_OBSERVER_REMOVED); + } +#endif + return true; } static bool sockaddr_equal(const struct sockaddr *a, From 363b50f7070740907496561fee24d0acabd3a6c7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:04 +0100 Subject: [PATCH 1243/2300] Revert "[nrf fromtree] samples: net: sockets: coap_server: Remove observer events" This reverts commit 6b3b6df9fe2c0ef6200c6f7e1fc908e6ac176a84. Signed-off-by: Robert Lubos --- samples/net/sockets/coap_server/prj.conf | 1 + samples/net/sockets/coap_server/src/observer.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/samples/net/sockets/coap_server/prj.conf b/samples/net/sockets/coap_server/prj.conf index e9ff24577b7..1a26e614786 100644 --- a/samples/net/sockets/coap_server/prj.conf +++ b/samples/net/sockets/coap_server/prj.conf @@ -13,6 +13,7 @@ CONFIG_COAP=y CONFIG_COAP_SERVER=y CONFIG_COAP_SERVER_WELL_KNOWN_CORE=y CONFIG_COAP_WELL_KNOWN_BLOCK_WISE=n +CONFIG_COAP_OBSERVER_EVENTS=y # Kernel options CONFIG_ENTROPY_GENERATOR=y diff --git a/samples/net/sockets/coap_server/src/observer.c b/samples/net/sockets/coap_server/src/observer.c index 6d39536e232..29b7b4ed472 100644 --- a/samples/net/sockets/coap_server/src/observer.c +++ b/samples/net/sockets/coap_server/src/observer.c @@ -17,6 +17,16 @@ static int obs_counter; static void update_counter(struct k_work *work); K_WORK_DELAYABLE_DEFINE(obs_work, update_counter); +#ifdef CONFIG_COAP_OBSERVER_EVENTS + +static void observer_event(struct coap_resource *resource, struct coap_observer *observer, + enum coap_observer_event event) +{ + LOG_INF("Observer %s", event == COAP_OBSERVER_ADDED ? "added" : "removed"); +} + +#endif + static int send_notification_packet(struct coap_resource *resource, const struct sockaddr *addr, socklen_t addr_len, @@ -128,6 +138,9 @@ COAP_RESOURCE_DEFINE(obs, coap_server, .get = obs_get, .path = obs_path, .notify = obs_notify, +#ifdef CONFIG_COAP_OBSERVER_EVENTS + .observer_event_handler = observer_event, +#endif }); static void update_counter(struct k_work *work) From b6be68915139b7ba9544a5975c9b0f8fcace9081 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:04 +0100 Subject: [PATCH 1244/2300] Revert "[nrf fromtree] net: lwm2m: device object: optionally store error list in settings" This reverts commit 28275ad931e08ae74ac7a196c54032812a1a6c33. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/Kconfig | 7 -- subsys/net/lib/lwm2m/lwm2m_obj_device.c | 106 ++---------------------- 2 files changed, 8 insertions(+), 105 deletions(-) diff --git a/subsys/net/lib/lwm2m/Kconfig b/subsys/net/lib/lwm2m/Kconfig index 1e5a7ac8f6a..dd3c0c45618 100644 --- a/subsys/net/lib/lwm2m/Kconfig +++ b/subsys/net/lib/lwm2m/Kconfig @@ -392,13 +392,6 @@ config LWM2M_COMPOSITE_PATH_LIST_SIZE help Define path list size for Composite Read and send operation. -config LWM2M_DEVICE_ERROR_CODE_SETTINGS - bool "Use settings to store error codes across device resets" - depends on SETTINGS - help - Store the device error code list in settings. Ensures error list can - be transferred to LwM2M server even if the device is reset. - config LWM2M_DEVICE_PWRSRC_MAX int "Maximum # of device power source records" default 5 diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_device.c b/subsys/net/lib/lwm2m/lwm2m_obj_device.c index 9416b3cf92c..7df9df03a93 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_device.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_device.c @@ -1,7 +1,6 @@ /* * Copyright (c) 2017 Linaro Limited * Copyright (c) 2018-2019 Foundries.io - * Copyright (c) 2023 FTP Technologies * * SPDX-License-Identifier: Apache-2.0 */ @@ -20,7 +19,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include #include -#include #include "lwm2m_object.h" #include "lwm2m_engine.h" @@ -131,12 +129,10 @@ static struct lwm2m_engine_res_inst res_inst[RESOURCE_INSTANCE_COUNT]; /* save error code resource instance point so we can easily clear later */ static struct lwm2m_engine_res_inst *error_code_ri; -#define SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE "lwm2m_obj_dev" -#define ERROR_LIST_KEY "err" - /* callbacks */ -static void reset_error_list(void) +static int reset_error_list_cb(uint16_t obj_inst_id, + uint8_t *args, uint16_t args_len) { int i; @@ -148,29 +144,8 @@ static void reset_error_list(void) /* Default error code indicating no error */ error_code_ri[0].res_inst_id = 0; -} - -static int reset_error_list_cb(uint16_t obj_inst_id, - uint8_t *args, uint16_t args_len) -{ - int ret = 0; - - ARG_UNUSED(obj_inst_id); - ARG_UNUSED(args); - ARG_UNUSED(args_len); - - reset_error_list(); - lwm2m_notify_observer(LWM2M_OBJECT_DEVICE_ID, 0, DEVICE_ERROR_CODE_ID); - - if (IS_ENABLED(CONFIG_LWM2M_DEVICE_ERROR_CODE_SETTINGS)) { - ret = settings_delete(SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE "/" ERROR_LIST_KEY); - if (ret != 0) { - LOG_ERR("Couldn't save error list: %d", ret); - } - } - - return ret; + return 0; } static void *current_time_read_cb(uint16_t obj_inst_id, uint16_t res_id, @@ -207,9 +182,9 @@ static int current_time_post_write_cb(uint16_t obj_inst_id, uint16_t res_id, } /* error code function */ + int lwm2m_device_add_err(uint8_t error_code) { - int ret = 0; int i; for (i = 0; i < DEVICE_ERROR_CODE_MAX; i++) { @@ -231,15 +206,7 @@ int lwm2m_device_add_err(uint8_t error_code) error_code_ri[i].res_inst_id = i; lwm2m_notify_observer(LWM2M_OBJECT_DEVICE_ID, 0, DEVICE_ERROR_CODE_ID); - if (IS_ENABLED(CONFIG_LWM2M_DEVICE_ERROR_CODE_SETTINGS)) { - ret = settings_save_one(SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE "/" ERROR_LIST_KEY, - error_code_list, i + 1); - if (ret != 0) { - LOG_ERR("Couldn't save error list: %d", ret); - } - } - - return ret; + return 0; } static void device_periodic_service(struct k_work *work) @@ -252,49 +219,6 @@ int lwm2m_update_device_service_period(uint32_t period_ms) return lwm2m_engine_update_service_period(device_periodic_service, period_ms); } -static int lwm2m_obj_device_settings_set(const char *name, size_t len, - settings_read_cb read_cb, void *cb_arg) -{ - const char *next; - int rc; - int i; - - if (settings_name_steq(name, ERROR_LIST_KEY, &next) && !next) { - if (len > sizeof(error_code_list)) { - LOG_ERR("Error code list too large: %u", len); - return -EINVAL; - } - - rc = read_cb(cb_arg, error_code_list, sizeof(error_code_list)); - if (rc == 0) { - reset_error_list(); - return 0; - } else if (rc > 0) { - for (i = 0; i < ARRAY_SIZE(error_code_list); i++) { - if (i < rc) { - error_code_ri[i].res_inst_id = i; - } else { - /* Reset remaining error code instances */ - error_code_list[i] = LWM2M_DEVICE_ERROR_NONE; - error_code_ri[i].res_inst_id = RES_INSTANCE_NOT_CREATED; - } - } - return 0; - } - - LOG_ERR("Error code list read failure: %d", rc); - - return rc; - } - - return -ENOENT; -} - -static struct settings_handler lwm2m_obj_device_settings_handler = { - .name = SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE, - .h_set = lwm2m_obj_device_settings_set, -}; - static struct lwm2m_engine_obj_inst *device_create(uint16_t obj_inst_id) { int i = 0, j = 0; @@ -347,7 +271,7 @@ static struct lwm2m_engine_obj_inst *device_create(uint16_t obj_inst_id) static int lwm2m_device_init(void) { struct lwm2m_engine_obj_inst *obj_inst = NULL; - int ret; + int ret = 0; /* Set default values */ time_offset = 0U; @@ -370,26 +294,12 @@ static int lwm2m_device_init(void) LOG_DBG("Create LWM2M instance 0 error: %d", ret); } - /* Ensure error list is reset if not loaded from settings */ - reset_error_list(); - - /* Load error code resource instances */ - if (IS_ENABLED(CONFIG_LWM2M_DEVICE_ERROR_CODE_SETTINGS)) { - ret = settings_register(&lwm2m_obj_device_settings_handler); - if (ret == 0) { - ret = settings_load_subtree(SETTINGS_SUBTREE_LWM2M_OBJ_DEVICE); - if (ret != 0) { - LOG_ERR("Settings load failed: %d", ret); - } - } else { - LOG_ERR("Settings register failed: %d", ret); - } - } + /* Create the default error code resource instance */ + lwm2m_device_add_err(0); /* call device_periodic_service() every 10 seconds */ ret = lwm2m_engine_add_service(device_periodic_service, DEVICE_SERVICE_INTERVAL_MS); - return ret; } From acf9548d0dfdc4a981721dfc16ca700c97430c7b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:05 +0100 Subject: [PATCH 1245/2300] Revert "[nrf fromtree] net: lwm2m: device object: use LWM2M_DEVICE_ERROR_NONE" This reverts commit d41479647f22e5a2cf21aa804d28681b23c73b8b. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_obj_device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_device.c b/subsys/net/lib/lwm2m/lwm2m_obj_device.c index 7df9df03a93..c17815795c2 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_device.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_device.c @@ -89,7 +89,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); DEVICE_EXT_DEV_INFO_MAX) /* resource state variables */ -static uint8_t error_code_list[DEVICE_ERROR_CODE_MAX] = { LWM2M_DEVICE_ERROR_NONE }; +static uint8_t error_code_list[DEVICE_ERROR_CODE_MAX]; static time_t time_temp; static time_t time_offset; static uint8_t binding_mode[DEVICE_STRING_SHORT]; @@ -138,7 +138,7 @@ static int reset_error_list_cb(uint16_t obj_inst_id, /* "delete" error codes */ for (i = 0; i < DEVICE_ERROR_CODE_MAX; i++) { - error_code_list[i] = LWM2M_DEVICE_ERROR_NONE; + error_code_list[i] = 0; error_code_ri[i].res_inst_id = RES_INSTANCE_NOT_CREATED; } @@ -188,7 +188,7 @@ int lwm2m_device_add_err(uint8_t error_code) int i; for (i = 0; i < DEVICE_ERROR_CODE_MAX; i++) { - if (error_code_list[i] == LWM2M_DEVICE_ERROR_NONE) { + if (error_code_list[i] == 0) { break; } From 5ee66cc1e04ca66dbc133a2ddc6afef5223d223b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:05 +0100 Subject: [PATCH 1246/2300] Revert "[nrf fromtree] test: lwm2m: Refactor tests to work with fallback changes" This reverts commit 56dc01d77ebb4fb5c6c59142854aa5423219c287. Signed-off-by: Robert Lubos --- .../net/lib/lwm2m/interop/pytest/conftest.py | 34 ++++--------------- .../lib/lwm2m/interop/pytest/test_lwm2m.py | 9 +++-- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/pytest/conftest.py b/tests/net/lib/lwm2m/interop/pytest/conftest.py index 7d3ea4e7f80..9ca971b85c7 100644 --- a/tests/net/lib/lwm2m/interop/pytest/conftest.py +++ b/tests/net/lib/lwm2m/interop/pytest/conftest.py @@ -27,25 +27,6 @@ logger = logging.getLogger(__name__) -class Endpoint: - def __init__(self, name: str, shell: Shell, registered: bool = False, bootstrap: bool = False): - self.name = name - self.registered = registered - self.bootstrap = bootstrap - self.shell = shell - self.last_update = 0.0 - - def check_update(self): - if not self.registered: - return - if self.last_update < time.time() - 5: - self.shell.exec_command('lwm2m update') - self.last_update = time.time() - - def __str__(self): - return self.name - - @pytest.fixture(scope='session') def leshan() -> Leshan: """ @@ -108,8 +89,9 @@ def endpoint_nosec(shell: Shell, dut: DeviceAdapter, leshan: Leshan) -> str: shell.exec_command('lwm2m write 1/0/0 -u16 1') shell.exec_command('lwm2m write 1/0/1 -u32 86400') shell.exec_command(f'lwm2m start {ep} -b 0') + dut.readlines_until(regex=f"RD Client started with endpoint '{ep}'", timeout=10.0) - yield Endpoint(ep, shell) + yield ep # All done shell.exec_command('lwm2m stop') @@ -143,7 +125,7 @@ def endpoint_bootstrap(shell: Shell, dut: DeviceAdapter, leshan: Leshan, leshan_ shell.exec_command(f'lwm2m write 0/0/5 -s {bs_passwd}') shell.exec_command(f'lwm2m start {ep} -b 1') - yield Endpoint(ep, shell) + yield ep shell.exec_command('lwm2m stop') dut.readlines_until(regex=r'.*Deregistration success', timeout=10.0) @@ -155,16 +137,12 @@ def endpoint_bootstrap(shell: Shell, dut: DeviceAdapter, leshan: Leshan, leshan_ leshan_bootstrap.delete_bs_device(ep) @pytest.fixture(scope='module') -def endpoint_registered(endpoint_bootstrap, dut: DeviceAdapter) -> str: +def endpoint_registered(endpoint_bootstrap, shell: Shell, dut: DeviceAdapter) -> str: """Fixture that returns an endpoint that is registered.""" - if not endpoint_bootstrap.registered: - dut.readlines_until(regex='.*Registration Done', timeout=5.0) - endpoint_bootstrap.bootstrap = True - endpoint_bootstrap.registered = True + dut.readlines_until(regex='.*Registration Done', timeout=5.0) return endpoint_bootstrap -@pytest.fixture(scope='function') +@pytest.fixture(scope='module') def endpoint(endpoint_registered) -> str: """Fixture that returns an endpoint that is registered.""" - endpoint_registered.check_update() return endpoint_registered diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index ed7aaceac20..131acb68e14 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -171,7 +171,6 @@ def verify_setting_basic_in_format(shell, leshan, endpoint, format): verify_server_object(server_obj) # Remove Read-Only resources, so we don't end up writing those del server_obj[0][0] - del server_obj[0][13] data = { 2: 101, 3: 1010, @@ -209,7 +208,7 @@ def test_LightweightM2M_1_1_int_222(shell: Shell, leshan: Leshan, endpoint: str) """LightweightM2M-1.1-int-222 - Read on Object""" resp = leshan.read(endpoint, '1') assert len(resp) == 1 - assert len(resp[1][0]) == 11 + assert len(resp[1][0]) == 9 resp = leshan.read(endpoint, '3') assert len(resp) == 1 assert len(resp[3]) == 1 @@ -219,7 +218,7 @@ def test_LightweightM2M_1_1_int_222(shell: Shell, leshan: Leshan, endpoint: str) def test_LightweightM2M_1_1_int_223(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-223 - Read on Object Instance""" resp = leshan.read(endpoint, '1/0') - assert len(resp[0]) == 11 + assert len(resp[0]) == 9 resp = leshan.read(endpoint, '3/0') assert len(resp[0]) == 15 assert resp[0][0] == 'Zephyr' @@ -283,7 +282,7 @@ def test_LightweightM2M_1_1_int_229(shell: Shell, leshan: Leshan, endpoint: str) assert resp[3] is not None assert resp[1][0] is not None assert len(resp[3][0]) == 15 - assert len(resp[1][0]) == 11 + assert len(resp[1][0]) == 9 resp = leshan.composite_read(endpoint, ['1/0/1', '/3/0/11/0']) logger.debug(resp) @@ -371,7 +370,7 @@ def test_LightweightM2M_1_1_int_234(shell: Shell, leshan: Leshan, endpoint: str) def test_LightweightM2M_1_1_int_235(leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-235 - Read-Composite Operation on root path""" resp = leshan.composite_read(endpoint, ['/']) - expected_keys = [1, 3, 5] + expected_keys = [16, 1, 3, 5] missing_keys = [key for key in expected_keys if key not in resp.keys()] assert len(missing_keys) == 0 From fc28b5c3787b6a84a9fe9216e908ecdb0393b46e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:05 +0100 Subject: [PATCH 1247/2300] Revert "[nrf fromtree] net: lwm2m: Implement fallback mechanism and support for diable" This reverts commit 73c0f6bf3b44dd9fab27af3fd2cf75b1127fa27f. Signed-off-by: Robert Lubos --- include/zephyr/net/lwm2m.h | 1 - samples/net/lwm2m_client/src/lwm2m-client.c | 4 - subsys/net/lib/lwm2m/lwm2m_obj_server.c | 18 +- subsys/net/lib/lwm2m/lwm2m_rd_client.c | 421 +++++++----------- subsys/net/lib/lwm2m/lwm2m_rd_client.h | 10 - .../net/lib/lwm2m/interop/src/lwm2m-client.c | 4 - .../net/lib/lwm2m/lwm2m_rd_client/src/main.c | 201 ++------- .../net/lib/lwm2m/lwm2m_rd_client/src/stubs.c | 22 - .../net/lib/lwm2m/lwm2m_rd_client/src/stubs.h | 9 +- 9 files changed, 195 insertions(+), 495 deletions(-) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index 6ac0458af87..a57b5542f88 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -2075,7 +2075,6 @@ enum lwm2m_rd_client_event { LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR, LWM2M_RD_CLIENT_EVENT_REG_UPDATE, LWM2M_RD_CLIENT_EVENT_DEREGISTER, - LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED, }; /** diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index c610f1ad8dd..a120506639d 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -191,10 +191,6 @@ static void rd_client_event(struct lwm2m_ctx *client, /* do nothing */ break; - case LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED: - LOG_DBG("LwM2M server disabled"); - break; - case LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE: LOG_DBG("Bootstrap registration failure!"); break; diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_server.c b/subsys/net/lib/lwm2m/lwm2m_obj_server.c index a9432340038..10c7a1a1ea0 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_server.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_server.c @@ -95,21 +95,13 @@ static struct lwm2m_engine_res_inst static int disable_cb(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len) { - ARG_UNUSED(args); - ARG_UNUSED(args_len); - - int ret; + int i; - for (int i = 0; i < MAX_INSTANCE_COUNT; i++) { + LOG_DBG("DISABLE %d", obj_inst_id); + for (i = 0; i < MAX_INSTANCE_COUNT; i++) { if (inst[i].obj && inst[i].obj_inst_id == obj_inst_id) { - LOG_DBG("DISABLE %d", obj_inst_id); - ret = lwm2m_rd_client_server_disabled(obj_inst_id); - if (ret == 0) { - disabled_until[i] = - sys_timepoint_calc(K_SECONDS(disabled_timeout[i])); - return 0; - } - return ret; + disabled_until[i] = sys_timepoint_calc(K_SECONDS(disabled_timeout[i])); + return 0; } } diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.c b/subsys/net/lib/lwm2m/lwm2m_rd_client.c index 6b3fbcccc68..6eacba0ee0d 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.c +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.c @@ -72,7 +72,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define DELAY_FOR_ACK 100U #define EXCHANGE_LIFETIME 247U #define MINIMUM_PERIOD 15 -#define DISABLE_TIMEOUT (K_SECONDS(CONFIG_LWM2M_RD_CLIENT_MAX_RETRIES * EXCHANGE_LIFETIME)) static void sm_handle_registration_update_failure(void); static int sm_send_registration_msg(void); @@ -81,8 +80,6 @@ static void lwm2m_rd_client_service(struct k_work *work); static int64_t calc_next_event(void); static void set_sm_state_delayed(uint8_t sm_state, int64_t delay_ms); static void set_sm_state(uint8_t sm_state); -/** Try to fallback to bootstrap. Return true if we did. */ -static bool fallback_to_bootstrap(void); /* The states for the RD client state machine */ /* @@ -104,7 +101,6 @@ enum sm_engine_state { ENGINE_REGISTRATION_DONE_RX_OFF, ENGINE_UPDATE_REGISTRATION, ENGINE_UPDATE_SENT, - ENGINE_SERVER_DISABLED, ENGINE_SUSPENDED, ENGINE_DEREGISTER, ENGINE_DEREGISTER_SENT, @@ -129,11 +125,11 @@ struct lwm2m_rd_client_info { char ep_name[CLIENT_EP_LEN]; char server_ep[CLIENT_EP_LEN]; - bool use_bootstrap : 1; + bool use_bootstrap : 1; + bool trigger_update : 1; bool update_objects : 1; - bool close_socket : 1; - bool server_disabled: 1; + bool close_socket : 1; } client; /* Allocate some data for queries and updates. Make sure it's large enough to @@ -205,18 +201,23 @@ static void set_sm_state_delayed(uint8_t sm_state, int64_t delay_ms) event = LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE; } else if (sm_state == ENGINE_REGISTRATION_DONE_RX_OFF) { event = LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF; - } else if (sm_state == ENGINE_DEREGISTERED && + } else if ((sm_state == ENGINE_INIT || + sm_state == ENGINE_DEREGISTERED) && (client.engine_state >= ENGINE_DO_REGISTRATION && - client.engine_state <= ENGINE_DEREGISTER_SENT) && !client.server_disabled) { + client.engine_state <= ENGINE_DEREGISTER_SENT)) { event = LWM2M_RD_CLIENT_EVENT_DISCONNECT; + } else if (sm_state == ENGINE_NETWORK_ERROR) { + lwm2m_socket_close(client.ctx); + client.retry_delay = 1 << client.retries; + client.retries++; + if (client.retries > CONFIG_LWM2M_RD_CLIENT_MAX_RETRIES) { + client.retries = 0; + event = LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR; + } } else if (sm_state == ENGINE_UPDATE_REGISTRATION) { event = LWM2M_RD_CLIENT_EVENT_REG_UPDATE; } else if (sm_state == ENGINE_DEREGISTER) { - if (client.server_disabled) { - event = LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED; - } else { - event = LWM2M_RD_CLIENT_EVENT_DEREGISTER; - } + event = LWM2M_RD_CLIENT_EVENT_DEREGISTER; } if (sm_is_suspended()) { @@ -291,22 +292,27 @@ static uint8_t get_sm_state(void) return state; } -static void sm_handle_timeout_state(enum sm_engine_state sm_state) +static void sm_handle_timeout_state(struct lwm2m_message *msg, + enum sm_engine_state sm_state) { k_mutex_lock(&client.mutex, K_FOREVER); enum lwm2m_rd_client_event event = LWM2M_RD_CLIENT_EVENT_NONE; - /* Don't send BOOTSTRAP_REG_FAILURE event, that is only emitted from - * do_network_error() once we are out of retries. - */ - if (client.engine_state == ENGINE_REGISTRATION_SENT) { - event = LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT; - } else if (client.engine_state == ENGINE_UPDATE_SENT) { - event = LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT; - } else if (client.engine_state == ENGINE_DEREGISTER_SENT) { - event = LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE; - } else { - /* TODO: unknown timeout state */ +#if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) + if (client.engine_state == ENGINE_BOOTSTRAP_REG_SENT) { + event = LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE; + } else +#endif + { + if (client.engine_state == ENGINE_REGISTRATION_SENT) { + event = LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT; + } else if (client.engine_state == ENGINE_UPDATE_SENT) { + event = LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT; + } else if (client.engine_state == ENGINE_DEREGISTER_SENT) { + event = LWM2M_RD_CLIENT_EVENT_DEREGISTER_FAILURE; + } else { + /* TODO: unknown timeout state */ + } } set_sm_state(sm_state); @@ -368,14 +374,11 @@ static void socket_fault_cb(int error) /* Network error state causes engine to re-register, * so only trigger that state if we are not stopping the * engine. - * Also when engine is going to be disabled, for a while, we might get spurious - * socket errors when closing, so ignore them. */ if (client.engine_state > ENGINE_IDLE && - client.engine_state < ENGINE_SERVER_DISABLED) { - sm_handle_timeout_state(ENGINE_NETWORK_ERROR); - } else if (client.engine_state != ENGINE_SUSPENDED && - !client.server_disabled) { + client.engine_state < ENGINE_SUSPENDED) { + set_sm_state(ENGINE_NETWORK_ERROR); + } else if (client.engine_state != ENGINE_SUSPENDED) { sm_handle_failure_state(ENGINE_IDLE); } } @@ -450,7 +453,13 @@ static int do_bootstrap_reply_cb(const struct coap_packet *response, static void do_bootstrap_reg_timeout_cb(struct lwm2m_message *msg) { LOG_WRN("Bootstrap Timeout"); - sm_handle_timeout_state(ENGINE_NETWORK_ERROR); + + /* TODO: + * Look for the "next" BOOTSTRAP server entry in our security info + */ + + /* Restart from scratch */ + sm_handle_timeout_state(msg, ENGINE_INIT); } #endif @@ -513,8 +522,6 @@ static int do_registration_reply_cb(const struct coap_packet *response, /* remember the last reg time */ client.last_update = k_uptime_get(); - client.server_disabled = false; - client.retries = 0; memcpy(client.server_ep, options[1].value, options[1].len); @@ -526,12 +533,11 @@ static int do_registration_reply_cb(const struct coap_packet *response, return 0; } - LOG_ERR("Failed with code %u.%u (%s).", + LOG_ERR("Failed with code %u.%u (%s). Not Retrying.", COAP_RESPONSE_CODE_CLASS(code), COAP_RESPONSE_CODE_DETAIL(code), code2str(code)); fail: - lwm2m_server_disable(client.ctx->srv_obj_inst, DISABLE_TIMEOUT); - sm_handle_failure_state(ENGINE_NETWORK_ERROR); + sm_handle_failure_state(ENGINE_IDLE); return ret; } @@ -540,7 +546,8 @@ static void do_registration_timeout_cb(struct lwm2m_message *msg) { LOG_WRN("Registration Timeout"); - sm_handle_timeout_state(ENGINE_NETWORK_ERROR); + /* Restart from scratch */ + sm_handle_timeout_state(msg, ENGINE_INIT); } static int do_update_reply_cb(const struct coap_packet *response, @@ -581,7 +588,7 @@ static void do_update_timeout_cb(struct lwm2m_message *msg) client.close_socket = true; } /* Re-do registration */ - sm_handle_timeout_state(ENGINE_DO_REGISTRATION); + sm_handle_timeout_state(msg, ENGINE_DO_REGISTRATION); } static int do_deregister_reply_cb(const struct coap_packet *response, @@ -605,7 +612,7 @@ static int do_deregister_reply_cb(const struct coap_packet *response, COAP_RESPONSE_CODE_CLASS(code), COAP_RESPONSE_CODE_DETAIL(code), code2str(code)); - sm_handle_failure_state(ENGINE_DEREGISTERED); + sm_handle_failure_state(ENGINE_IDLE); return 0; } @@ -614,10 +621,10 @@ static void do_deregister_timeout_cb(struct lwm2m_message *msg) { LOG_WRN("De-Registration Timeout"); - sm_handle_timeout_state(ENGINE_DEREGISTERED); + sm_handle_timeout_state(msg, ENGINE_IDLE); } -static bool is_bootsrap_server(int sec_obj_inst) +static bool sm_bootstrap_verify(bool bootstrap_server, int sec_obj_inst) { bool bootstrap; int ret; @@ -627,7 +634,12 @@ static bool is_bootsrap_server(int sec_obj_inst) LOG_WRN("Failed to check bootstrap, err %d", ret); return false; } - return bootstrap; + + if (bootstrap == bootstrap_server) { + return true; + } else { + return false; + } } static bool sm_update_lifetime(int srv_obj_inst, uint32_t *lifetime) @@ -653,40 +665,58 @@ static bool sm_update_lifetime(int srv_obj_inst, uint32_t *lifetime) return false; } -/** - * @brief Find the next security instance for bootstrapping. - * - * Search for the next security instance that has the bootstrap flag set and - * is not the same as current security instance. - * - * @param sec_obj_inst current security instance or -1. - * @return zero on success, negative on error. - */ -static int sm_next_bootstrap_inst(int *sec_obj_inst) +static int sm_select_server_inst(int sec_obj_inst, int *srv_obj_inst, + uint32_t *lifetime) +{ + uint16_t server_id; + int ret, obj_inst_id; + + ret = lwm2m_get_u16(&LWM2M_OBJ(0, sec_obj_inst, 10), &server_id); + if (ret < 0) { + LOG_WRN("Failed to obtain Short Server ID, err %d", ret); + return -EINVAL; + } + + obj_inst_id = lwm2m_server_short_id_to_inst(server_id); + if (obj_inst_id < 0) { + LOG_WRN("Failed to obtain Server Object instance, err %d", + obj_inst_id); + return -EINVAL; + } + + sm_update_lifetime(obj_inst_id, lifetime); + *srv_obj_inst = obj_inst_id; + + return 0; +} + +static int sm_select_security_inst(bool bootstrap_server, int *sec_obj_inst) { int i, obj_inst_id = -1; - if (*sec_obj_inst >= 0 && !is_bootsrap_server(*sec_obj_inst)) { - *sec_obj_inst = -1; + /* lookup existing index */ + i = lwm2m_security_inst_id_to_index(*sec_obj_inst); + if (i >= 0 && sm_bootstrap_verify(bootstrap_server, *sec_obj_inst)) { + return 0; } + *sec_obj_inst = -1; + /* Iterate over all instances to find the correct one. */ for (i = 0; i < CONFIG_LWM2M_SECURITY_INSTANCE_COUNT; i++) { obj_inst_id = lwm2m_security_index_to_inst_id(i); if (obj_inst_id < 0) { - continue; - } - if (obj_inst_id == *sec_obj_inst) { + LOG_WRN("Failed to get inst id for %d", i); continue; } - if (is_bootsrap_server(obj_inst_id)) { + if (sm_bootstrap_verify(bootstrap_server, obj_inst_id)) { *sec_obj_inst = obj_inst_id; return 0; } } - LOG_WRN("No Bootstrap servers found."); + LOG_WRN("sec_obj_inst: No matching servers found."); return -ENOENT; } @@ -696,17 +726,24 @@ static int sm_next_bootstrap_inst(int *sec_obj_inst) static int sm_do_init(void) { lwm2m_engine_stop(client.ctx); + client.ctx->sec_obj_inst = -1; + client.ctx->srv_obj_inst = -1; client.trigger_update = false; client.lifetime = 0U; + client.retries = 0U; client.last_update = 0U; client.close_socket = false; /* Do bootstrap or registration */ - if (client.use_bootstrap && IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)) { +#if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) + if (client.use_bootstrap) { set_sm_state(ENGINE_DO_BOOTSTRAP_REG); } else { set_sm_state(ENGINE_DO_REGISTRATION); } +#else + set_sm_state(ENGINE_DO_REGISTRATION); +#endif return 0; } @@ -777,7 +814,7 @@ static int sm_send_bootstrap_registration(void) return ret; } -static void sm_do_bootstrap_reg(void) +static int sm_do_bootstrap_reg(void) { int ret; @@ -787,20 +824,23 @@ static void sm_do_bootstrap_reg(void) } client.ctx->bootstrap_mode = true; - ret = sm_next_bootstrap_inst(&client.ctx->sec_obj_inst); + ret = sm_select_security_inst(client.ctx->bootstrap_mode, + &client.ctx->sec_obj_inst); if (ret < 0) { - set_sm_state(ENGINE_NETWORK_ERROR); - return; + /* no bootstrap server found, let's move to registration */ + LOG_WRN("Bootstrap server not found! Try normal registration."); + set_sm_state(ENGINE_DO_REGISTRATION); + return ret; } - LOG_INF("Bootstrap started with endpoint '%s' using security object %d", - client.ep_name, client.ctx->sec_obj_inst); + LOG_INF("Bootstrap started with endpoint '%s' with client lifetime %d", + client.ep_name, client.lifetime); ret = lwm2m_engine_start(client.ctx); if (ret < 0) { LOG_ERR("Cannot init LWM2M engine (%d)", ret); set_sm_state(ENGINE_NETWORK_ERROR); - return; + return ret; } ret = sm_send_bootstrap_registration(); @@ -811,7 +851,7 @@ static void sm_do_bootstrap_reg(void) set_sm_state(ENGINE_NETWORK_ERROR); } - return; + return ret; } void engine_bootstrap_finish(void) @@ -1007,9 +1047,8 @@ static int sm_send_registration_msg(void) return ret; } -static void sm_do_registration(void) +static int sm_do_registration(void) { - uint16_t ssid; int ret = 0; if (client.ctx->connection_suspended) { @@ -1017,16 +1056,10 @@ static void sm_do_registration(void) lwm2m_engine_context_close(client.ctx); /* perform full registration */ set_sm_state(ENGINE_DO_REGISTRATION); - return; + return 0; } } else { - bool select_srv = true; - uint16_t srv = (uint16_t) client.ctx->srv_obj_inst; - - client.last_update = 0; - client.ctx->bootstrap_mode = false; - /* clear out existing connection data */ if (client.ctx->sock_fd > -1) { if (client.close_socket) { @@ -1035,58 +1068,43 @@ static void sm_do_registration(void) lwm2m_engine_stop(client.ctx); } else { lwm2m_engine_context_close(client.ctx); - /* Keep current connection, retry registration with same server */ - select_srv = false; } } - if (select_srv) { - /* Select next one from the list, or fail */ - if (!lwm2m_server_select(&srv)) { - LOG_ERR("Unable to find a valid server instance."); - goto bootstrap_or_retry; - } - - client.ctx->srv_obj_inst = srv; - sm_update_lifetime(srv, &client.lifetime); + client.last_update = 0; - ret = lwm2m_get_u16(&LWM2M_OBJ(1, client.ctx->srv_obj_inst, 0), &ssid); - if (ret < 0) { - LOG_ERR("Failed to read SSID"); - lwm2m_server_disable(srv, K_FOREVER); - goto bootstrap_or_retry; - } + client.ctx->bootstrap_mode = false; + ret = sm_select_security_inst(client.ctx->bootstrap_mode, + &client.ctx->sec_obj_inst); + if (ret < 0) { + LOG_ERR("Unable to find a valid security instance."); + set_sm_state(ENGINE_INIT); + return -EINVAL; + } - ret = lwm2m_security_short_id_to_inst(ssid); - if (ret < 0) { - LOG_ERR("Unable to find a valid security instance."); - lwm2m_server_disable(srv, K_FOREVER); - goto bootstrap_or_retry; - } - client.ctx->sec_obj_inst = (uint16_t) ret; + ret = sm_select_server_inst(client.ctx->sec_obj_inst, + &client.ctx->srv_obj_inst, + &client.lifetime); + if (ret < 0) { + LOG_ERR("Unable to find a valid server instance."); + set_sm_state(ENGINE_INIT); + return -EINVAL; } - LOG_INF("RD Client started with endpoint '%s' with client lifetime %d using server " - "object %d", - client.ep_name, client.lifetime, client.ctx->srv_obj_inst); + LOG_INF("RD Client started with endpoint '%s' with client lifetime %d", + client.ep_name, client.lifetime); ret = lwm2m_engine_start(client.ctx); if (ret < 0) { LOG_ERR("Cannot init LWM2M engine (%d)", ret); - goto bootstrap_or_retry; + set_sm_state(ENGINE_NETWORK_ERROR); + return ret; } } - sm_send_registration_msg(); - return; - -bootstrap_or_retry: - lwm2m_engine_stop(client.ctx); - if (!client.server_disabled && fallback_to_bootstrap()) { - return; - } + ret = sm_send_registration_msg(); - set_sm_state(ENGINE_NETWORK_ERROR); + return ret; } static int64_t next_update(void) @@ -1251,116 +1269,32 @@ static int sm_do_deregister(void) return ret; } -static bool fallback_to_bootstrap(void) -{ - if (IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)) { - bool fallback = true; - - (void)lwm2m_get_bool(&LWM2M_OBJ(LWM2M_OBJECT_SERVER_ID, client.ctx->srv_obj_inst, - SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID), - &fallback); - if (fallback) { - client.use_bootstrap = true; - set_sm_state(ENGINE_INIT); - return true; - } - } - return false; -} - static void sm_do_network_error(void) { int err; - LOG_ERR("sm_do_network_error, retries %d", client.retries); - - lwm2m_socket_close(client.ctx); - if (client.retry_delay) { - next_event_at(k_uptime_get() + client.retry_delay * MSEC_PER_SEC); client.retry_delay = 0; + next_event_at(k_uptime_get() + client.retry_delay * MSEC_PER_SEC); return; } - client.retry_delay = 1 << client.retries; - client.retries++; - - /* Stop retrying and try fallback */ - if (client.retries > CONFIG_LWM2M_RD_CLIENT_MAX_RETRIES) { - LOG_ERR("Network error, max retries reached (%d)", client.retries); - /* Disable current server for a period so lwm2m_server_select() does not pick it */ - if (client.ctx->srv_obj_inst > -1) { - lwm2m_server_disable(client.ctx->srv_obj_inst, DISABLE_TIMEOUT); - } - - /* Are we in bootstrap? Try if we can fallback to some other BS server */ - if (client.ctx->bootstrap_mode && - IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)) { - LOG_DBG("In bootstrap, try fallback srv"); - /* Do we have any other bootstrap server to back off to? */ - if (sm_next_bootstrap_inst(&client.ctx->sec_obj_inst) < 0) { - /* No, we are out of options, stop engine */ - goto stop_engine; - } - set_sm_state(ENGINE_INIT); - return; - } - - /* Try if there are other server to fall back to, - * Only allow fallback to higher priority server (lower value, or lower id) - * if we have successfully registered before. - * This should block us from looping the same list again. - * Instead we should fallback to bootstrap. - */ - uint16_t srv; - - if (lwm2m_server_select(&srv)) { - uint8_t p1, p2; - - p1 = lwm2m_server_get_prio(client.ctx->srv_obj_inst); - p2 = lwm2m_server_get_prio(srv); - if (p1 < p2 || client.last_update != 0) { - set_sm_state(ENGINE_INIT); - return; - } - } - - /* If we have been disabled by some server, don't fall back to bootstrap */ - if (client.server_disabled) { - set_sm_state(ENGINE_SERVER_DISABLED); - return; - } - - if (fallback_to_bootstrap()) { - return; - } - goto stop_engine; - } - - /* Retry bootstrap */ - if (IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)) { - if (client.ctx->bootstrap_mode) { - lwm2m_engine_context_close(client.ctx); - /* If we don't have fallback BS server, retry with current one */ - if (sm_next_bootstrap_inst(&client.ctx->sec_obj_inst) < 0) { - client.ctx->sec_obj_inst = -1; - } - set_sm_state(ENGINE_DO_BOOTSTRAP_REG); - return; - } +#if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) + if (client.ctx->bootstrap_mode) { + lwm2m_engine_context_close(client.ctx); + set_sm_state(ENGINE_DO_BOOTSTRAP_REG); + return; } +#endif if (!client.last_update || (k_uptime_get() - client.last_update) / MSEC_PER_SEC > client.lifetime) { /* do full registration as there is no active registration or lifetime exceeded */ - /* Keep the same server until out of retry */ + lwm2m_engine_context_close(client.ctx); set_sm_state(ENGINE_DO_REGISTRATION); return; } - /* Try if we can recover the DTLS session and try Update. - * This might fallback into full registration on sm_handle_registration_update_failure(). - */ err = lwm2m_socket_start(client.ctx); if (err) { LOG_ERR("Failed to start socket %d", err); @@ -1371,21 +1305,8 @@ static void sm_do_network_error(void) set_sm_state(ENGINE_NETWORK_ERROR); return; } - set_sm_state(ENGINE_UPDATE_REGISTRATION); - return; - -stop_engine: - /* We are out of options, stop engine */ - if (client.ctx->event_cb) { - if (client.ctx->bootstrap_mode) { - client.ctx->event_cb(client.ctx, - LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE); - } else { - client.ctx->event_cb(client.ctx, LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR); - } - } - set_sm_state(ENGINE_IDLE); + set_sm_state(ENGINE_UPDATE_REGISTRATION); } static void lwm2m_rd_client_service(struct k_work *work) @@ -1459,19 +1380,6 @@ static void lwm2m_rd_client_service(struct k_work *work) timeout = EXCHANGE_LIFETIME; break; - case ENGINE_SERVER_DISABLED: - if (lwm2m_server_select(NULL)) { - set_sm_state(ENGINE_INIT); - } else { - /* wait for server to be enabled. */ - /* - * TODO: Once engine is converted to use timepoint_t - * this should calculate the next event from the previous server. - */ - next_event_at(k_uptime_get() + SEC_PER_MIN * MSEC_PER_SEC); - } - break; - case ENGINE_DEREGISTER: sm_do_deregister(); break; @@ -1483,11 +1391,7 @@ static void lwm2m_rd_client_service(struct k_work *work) case ENGINE_DEREGISTERED: lwm2m_engine_stop(client.ctx); - if (client.server_disabled) { - set_sm_state(ENGINE_SERVER_DISABLED); - } else { - set_sm_state(ENGINE_IDLE); - } + set_sm_state(ENGINE_IDLE); break; case ENGINE_NETWORK_ERROR: @@ -1504,7 +1408,7 @@ static void lwm2m_rd_client_service(struct k_work *work) if (end < k_uptime_get()) { LOG_DBG("State machine have timed out"); - sm_handle_timeout_state(ENGINE_INIT); + sm_handle_timeout_state(NULL, ENGINE_INIT); } else if (client.next_event > end) { next_event_at(end); } @@ -1538,7 +1442,6 @@ int lwm2m_rd_client_start(struct lwm2m_ctx *client_ctx, const char *ep_name, } /* Init Context */ - lwm2m_server_reset_timestamps(); lwm2m_engine_context_init(client_ctx); client.ctx = client_ctx; @@ -1547,15 +1450,13 @@ int lwm2m_rd_client_start(struct lwm2m_ctx *client_ctx, const char *ep_name, client.ctx->observe_cb = observe_cb; client.ctx->event_cb = event_cb; client.use_bootstrap = flags & LWM2M_RD_CLIENT_FLAG_BOOTSTRAP; - client.ctx->srv_obj_inst = -1; - client.ctx->sec_obj_inst = -1; - client.retries = 0; + set_sm_state(ENGINE_INIT); strncpy(client.ep_name, ep_name, CLIENT_EP_LEN - 1); client.ep_name[CLIENT_EP_LEN - 1] = '\0'; LOG_INF("Start LWM2M Client: %s", client.ep_name); - set_sm_state(ENGINE_INIT); + next_event_at(0); k_mutex_unlock(&client.mutex); @@ -1576,10 +1477,9 @@ int lwm2m_rd_client_stop(struct lwm2m_ctx *client_ctx, client.ctx->event_cb = event_cb; rd_client_message_free(); - if (sm_is_registered() && deregister && !client.server_disabled) { + if (sm_is_registered() && deregister) { set_sm_state(ENGINE_DEREGISTER); } else { - client.server_disabled = false; set_sm_state(ENGINE_DEREGISTERED); } @@ -1657,7 +1557,7 @@ int lwm2m_rd_client_resume(void) #endif /* Or do we resume into registration state */ if (client.engine_state >= ENGINE_DO_REGISTRATION && - client.engine_state <= ENGINE_SERVER_DISABLED) { + client.engine_state <= ENGINE_SUSPENDED) { if (!client.last_update || (client.lifetime <= (k_uptime_get() - client.last_update) / MSEC_PER_SEC)) { /* No lifetime left, register again */ @@ -1675,29 +1575,6 @@ int lwm2m_rd_client_resume(void) return 0; } -int lwm2m_rd_client_server_disabled(uint16_t inst_id) -{ - if (client.ctx->srv_obj_inst != inst_id) { - return -EPERM; - } - - k_mutex_lock(&client.mutex, K_FOREVER); - - client.server_disabled = true; - - if (sm_is_registered()) { - LOG_INF("Server disabled, deregister"); - set_sm_state_delayed(ENGINE_DEREGISTER, DELAY_BEFORE_CLOSING); - } else { - LOG_INF("Server disabled"); - set_sm_state(ENGINE_DEREGISTERED); - } - - k_mutex_unlock(&client.mutex); - - return 0; -} - void lwm2m_rd_client_update(void) { engine_trigger_update(false); diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.h b/subsys/net/lib/lwm2m/lwm2m_rd_client.h index 5d71ccb30f6..66a3aac20f3 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.h +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.h @@ -56,14 +56,4 @@ int lwm2m_rd_client_connection_resume(struct lwm2m_ctx *client_ctx); void engine_update_tx_time(void); struct lwm2m_message *lwm2m_get_ongoing_rd_msg(void); -/** - * @brief Notify RD client that this server is disabled. - * - * This may return error -EPERM, if RD client is not registered on that server. - * - * @param inst_id server instance id - * @return int 0 on success, negative errno on failure. - */ -int lwm2m_rd_client_server_disabled(uint16_t inst_id); - #endif /* LWM2M_RD_CLIENT_H */ diff --git a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c index b6634069fbd..706091659a5 100644 --- a/tests/net/lib/lwm2m/interop/src/lwm2m-client.c +++ b/tests/net/lib/lwm2m/interop/src/lwm2m-client.c @@ -119,10 +119,6 @@ static void rd_client_event(struct lwm2m_ctx *client, /* do nothing */ break; - case LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED: - LOG_DBG("LwM2M server disabled"); - break; - case LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE: LOG_DBG("Bootstrap registration failure!"); break; diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c b/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c index 1d6a4e584fa..208298512d4 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c @@ -21,7 +21,7 @@ DEFINE_FFF_GLOBALS; /* Maximum number of iterations within the state machine of RD Client * service that is waited for until a possible event occurs */ -#define RD_CLIENT_MAX_LOOKUP_ITERATIONS 500 +static const uint8_t RD_CLIENT_MAX_LOOKUP_ITERATIONS = 100; FAKE_VOID_FUNC(show_lwm2m_event, enum lwm2m_rd_client_event); FAKE_VOID_FUNC(show_lwm2m_observe, enum lwm2m_observe_event); @@ -97,9 +97,6 @@ static void lwm2m_event_cb(struct lwm2m_ctx *client, enum lwm2m_rd_client_event case LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF: LOG_INF("*** LWM2M_RD_CLIENT_EVENT_QUEUE_MODE_RX_OFF"); break; - case LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED: - LOG_INF("*** LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED"); - break; case LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED: LOG_INF("*** LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED"); break; @@ -168,7 +165,6 @@ static void my_suite_before(void *data) lwm2m_init_message_fake.custom_fake = lwm2m_init_message_fake_default; coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; coap_packet_append_option_fake.custom_fake = NULL; - stub_lwm2m_server_disable(false); } static void my_suite_after(void *data) @@ -202,6 +198,8 @@ ZTEST(lwm2m_rd_client, test_start_registration_ok) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -209,7 +207,6 @@ ZTEST(lwm2m_rd_client, test_start_registration_ok) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert(lwm2m_rd_client_ctx() == &ctx, ""); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -231,6 +228,8 @@ ZTEST(lwm2m_rd_client, test_register_update_too_small_lifetime_to_default) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -238,7 +237,6 @@ ZTEST(lwm2m_rd_client, test_register_update_too_small_lifetime_to_default) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert(lwm2m_rd_client_ctx() == &ctx, ""); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -251,13 +249,14 @@ ZTEST(lwm2m_rd_client, test_timeout_resume_registration) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert(lwm2m_rd_client_ctx() == &ctx, ""); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -274,17 +273,16 @@ ZTEST(lwm2m_rd_client, test_start_registration_timeout) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_timeout_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_timeout_cb_default); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); + zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_DISCONNECT), NULL); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR), NULL); } ZTEST(lwm2m_rd_client, test_start_registration_fail) @@ -293,6 +291,8 @@ ZTEST(lwm2m_rd_client, test_start_registration_fail) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -302,15 +302,8 @@ ZTEST(lwm2m_rd_client, test_start_registration_fail) lwm2m_init_message_fake.custom_fake = lwm2m_init_message_fake_default; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE), - NULL); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE), NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_FAILURE), - NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_NETWORK_ERROR), - NULL); } ZTEST(lwm2m_rd_client, test_start_registration_update) @@ -319,6 +312,8 @@ ZTEST(lwm2m_rd_client, test_start_registration_update) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -326,7 +321,6 @@ ZTEST(lwm2m_rd_client, test_start_registration_update) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -341,6 +335,8 @@ ZTEST(lwm2m_rd_client, test_rx_off) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -348,7 +344,6 @@ ZTEST(lwm2m_rd_client, test_rx_off) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -364,6 +359,8 @@ ZTEST(lwm2m_rd_client, test_start_registration_update_fail) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -371,7 +368,6 @@ ZTEST(lwm2m_rd_client, test_start_registration_update_fail) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -388,6 +384,8 @@ ZTEST(lwm2m_rd_client, test_registration_update_timeout) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -395,7 +393,6 @@ ZTEST(lwm2m_rd_client, test_registration_update_timeout) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); test_prepare_pending_message_cb(&message_reply_timeout_cb_default); @@ -418,6 +415,8 @@ ZTEST(lwm2m_rd_client, test_deregistration_timeout) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -425,7 +424,6 @@ ZTEST(lwm2m_rd_client, test_deregistration_timeout) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -441,6 +439,8 @@ ZTEST(lwm2m_rd_client, test_error_on_registration_update) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -449,8 +449,6 @@ ZTEST(lwm2m_rd_client, test_error_on_registration_update) coap_packet_append_option_fake.custom_fake = NULL; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -484,6 +482,8 @@ ZTEST(lwm2m_rd_client, test_suspend_resume_registration) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -491,7 +491,6 @@ ZTEST(lwm2m_rd_client, test_suspend_resume_registration) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); zassert_true(!lwm2m_rd_client_is_suspended(&ctx), NULL); @@ -518,6 +517,8 @@ ZTEST(lwm2m_rd_client, test_suspend_stop_resume) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -526,7 +527,6 @@ ZTEST(lwm2m_rd_client, test_suspend_stop_resume) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); zassert_true(lwm2m_rd_client_pause() == 0, NULL); @@ -544,6 +544,8 @@ ZTEST(lwm2m_rd_client, test_socket_error) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -552,7 +554,6 @@ ZTEST(lwm2m_rd_client, test_socket_error) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -568,6 +569,8 @@ ZTEST(lwm2m_rd_client, test_socket_error_on_stop) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -576,7 +579,6 @@ ZTEST(lwm2m_rd_client, test_socket_error_on_stop) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); @@ -606,6 +608,8 @@ ZTEST(lwm2m_rd_client, test_engine_trigger_bootstrap) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -613,7 +617,6 @@ ZTEST(lwm2m_rd_client, test_engine_trigger_bootstrap) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_true; @@ -635,6 +638,8 @@ ZTEST(lwm2m_rd_client, test_bootstrap_timeout) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_timeout_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -646,7 +651,6 @@ ZTEST(lwm2m_rd_client, test_bootstrap_timeout) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 1, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_timeout_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE), NULL); } @@ -657,6 +661,8 @@ ZTEST(lwm2m_rd_client, test_bootstrap_fail) (void)memset(&ctx, 0x0, sizeof(ctx)); + test_prepare_pending_message_cb(&message_reply_cb_default); + lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); @@ -668,154 +674,27 @@ ZTEST(lwm2m_rd_client, test_bootstrap_fail) coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; zassert_true(lwm2m_rd_client_start(&ctx, "Test", 1, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE), NULL); } -ZTEST(lwm2m_rd_client, test_bootstrap_no_srv) +ZTEST(lwm2m_rd_client, test_bootstrap_no_srv_fallback_to_register) { struct lwm2m_ctx ctx; (void)memset(&ctx, 0x0, sizeof(ctx)); - lwm2m_rd_client_init(); - test_lwm2m_engine_start_service(); - wait_for_service(1); - - coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; - zassert_true(lwm2m_rd_client_start(&ctx, "Test", 1, lwm2m_event_cb, lwm2m_observe_cb) == 0, - NULL); test_prepare_pending_message_cb(&message_reply_cb_default); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE), - NULL); -} - -ZTEST(lwm2m_rd_client, test_disable_server) -{ - struct lwm2m_ctx ctx; - - (void)memset(&ctx, 0x0, sizeof(ctx)); lwm2m_rd_client_init(); test_lwm2m_engine_start_service(); wait_for_service(1); coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; - zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, - NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), - NULL); - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; - stub_lwm2m_server_disable(true); - lwm2m_rd_client_server_disabled(0); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED), - NULL); -} - -ZTEST(lwm2m_rd_client, test_disable_server_stop) -{ - struct lwm2m_ctx ctx; - - (void)memset(&ctx, 0x0, sizeof(ctx)); - - lwm2m_rd_client_init(); - test_lwm2m_engine_start_service(); - wait_for_service(1); - - coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; - zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, - NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), - NULL); - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; - stub_lwm2m_server_disable(true); - lwm2m_rd_client_server_disabled(0); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED), - NULL); - wait_for_service(1); - zassert_true(lwm2m_rd_client_stop(&ctx, lwm2m_event_cb, true) == 0, NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_DISCONNECT), NULL); -} - -ZTEST(lwm2m_rd_client, test_disable_server_connect) -{ - struct lwm2m_ctx ctx; - - (void)memset(&ctx, 0x0, sizeof(ctx)); - - lwm2m_rd_client_init(); - test_lwm2m_engine_start_service(); - wait_for_service(1); - - coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; - zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, - NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), - NULL); - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; - stub_lwm2m_server_disable(true); - lwm2m_rd_client_server_disabled(0); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_SERVER_DISABLED), - NULL); - - wait_for_service(500); - - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; - stub_lwm2m_server_disable(false); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), - NULL); -} - -ZTEST(lwm2m_rd_client, test_fallback_to_bootstrap) -{ - struct lwm2m_ctx ctx; - - (void)memset(&ctx, 0x0, sizeof(ctx)); - - lwm2m_rd_client_init(); - test_lwm2m_engine_start_service(); - wait_for_service(1); - - lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_true; - zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, - NULL); - test_prepare_pending_message_cb(&message_reply_timeout_cb_default); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REG_TIMEOUT), NULL); - - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_FAILURE), - NULL); -} - -ZTEST(lwm2m_rd_client, test_no_srv_fallback_to_bootstrap) -{ - struct lwm2m_ctx ctx; - - (void)memset(&ctx, 0x0, sizeof(ctx)); - - lwm2m_rd_client_init(); - test_lwm2m_engine_start_service(); - wait_for_service(1); - - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_changed; - lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_true; - stub_lwm2m_server_disable(true); - zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, - NULL); - test_prepare_pending_message_cb(&message_reply_cb_default); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_REG_COMPLETE), + zassert_true(lwm2m_rd_client_start(&ctx, "Test", 1, lwm2m_event_cb, lwm2m_observe_cb) == 0, NULL); - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; - coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; - stub_lwm2m_server_disable(false); - engine_bootstrap_finish(); zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); } diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c index 621057f8496..3cbde9060ce 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c @@ -116,24 +116,6 @@ char *lwm2m_sprint_ip_addr_fake_default(const struct sockaddr *addr) DEFINE_FAKE_VALUE_FUNC(int, lwm2m_server_short_id_to_inst, uint16_t); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_security_index_to_inst_id, int); -DEFINE_FAKE_VALUE_FUNC(int, lwm2m_security_short_id_to_inst, uint16_t); -DEFINE_FAKE_VALUE_FUNC(int, lwm2m_server_disable, uint16_t, k_timeout_t); -DEFINE_FAKE_VALUE_FUNC(uint8_t, lwm2m_server_get_prio, uint16_t); -DEFINE_FAKE_VOID_FUNC(lwm2m_server_reset_timestamps); - -static bool srv_disabled; -bool lwm2m_server_select(uint16_t *obj_inst_id) -{ - if (obj_inst_id) { - *obj_inst_id = 0; - } - return !srv_disabled; -} - -void stub_lwm2m_server_disable(bool disable) -{ - srv_disabled = disable; -} k_work_handler_t service; int64_t next; @@ -195,13 +177,9 @@ void test_lwm2m_engine_start_service(void) void test_lwm2m_engine_stop_service(void) { - struct k_work_sync sync; - pending_message_cb = NULL; - pending_message = NULL; running = false; k_work_cancel(&service_work); - k_work_flush(&service_work, &sync); } /* subsys/net/lib/lwm2m/lwm2m_message_handling.h */ diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h index 0a3ce31d9e8..1276dd5c109 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h @@ -59,8 +59,6 @@ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_close, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_close_socket, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_suspend, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_inst_id_to_index, uint16_t); -DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_short_id_to_inst, uint16_t); -DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_index_to_inst_id, int); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_engine_connection_resume, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_push_queued_buffers, struct lwm2m_ctx *); DECLARE_FAKE_VOID_FUNC(lwm2m_engine_context_init, struct lwm2m_ctx *); @@ -70,15 +68,10 @@ DECLARE_FAKE_VOID_FUNC(lwm2m_engine_context_close, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(char *, lwm2m_sprint_ip_addr, const struct sockaddr *); char *lwm2m_sprint_ip_addr_fake_default(const struct sockaddr *addr); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_server_short_id_to_inst, uint16_t); -DECLARE_FAKE_VALUE_FUNC(int, lwm2m_server_disable, uint16_t, k_timeout_t); -DECLARE_FAKE_VALUE_FUNC(uint8_t, lwm2m_server_get_prio, uint16_t); -DECLARE_FAKE_VOID_FUNC(lwm2m_server_reset_timestamps); - - +DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_index_to_inst_id, int); void wait_for_service(uint16_t cycles); void test_lwm2m_engine_start_service(void); void test_lwm2m_engine_stop_service(void); -void stub_lwm2m_server_disable(bool disable); /* subsys/net/lib/lwm2m/lwm2m_message_handling.h */ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_init_message, struct lwm2m_message *); From aaf1c2b95a1988163ef95cf860686714e025581f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:05 +0100 Subject: [PATCH 1248/2300] Revert "[nrf fromtree] net: lwm2m: Allow disabling server for a period of time" This reverts commit f6562da1b89821d350ea61458d1700b502c0563c. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_engine.h | 40 +++- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 1 - subsys/net/lib/lwm2m/lwm2m_obj_server.c | 224 ++++++------------ subsys/net/lib/lwm2m/lwm2m_obj_server.h | 144 ----------- subsys/net/lib/lwm2m/lwm2m_observation.c | 1 - subsys/net/lib/lwm2m/lwm2m_rd_client.c | 1 - 6 files changed, 109 insertions(+), 302 deletions(-) delete mode 100644 subsys/net/lib/lwm2m/lwm2m_obj_server.h diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.h b/subsys/net/lib/lwm2m/lwm2m_engine.h index 81b28395662..2ea3e583242 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.h +++ b/subsys/net/lib/lwm2m/lwm2m_engine.h @@ -30,7 +30,6 @@ /* length of time in milliseconds to wait for buffer allocations */ #define BUF_ALLOC_TIMEOUT K_SECONDS(1) - /** * @brief Validates that writing is a legal operation on the field given by the object in * @p obj_inst and the resource id in @p msg. Returns the field to obj_field (if it exists). @@ -151,6 +150,45 @@ int lwm2m_security_short_id_to_inst(uint16_t short_id); */ int lwm2m_security_index_to_inst_id(int index); +/** + * @brief Returns the default minimum period for an observation set for the server + * with object instance id given by @p obj_inst_id. + * + * @param[in] obj_inst_id Object instance id of the server object instance + * @return int32_t pmin value + */ +int32_t lwm2m_server_get_pmin(uint16_t obj_inst_id); + +/** + * @brief Returns the default maximum period for an observation set for the server + * with object instance id given by @p obj_inst_id. + * + * @param[in] obj_inst_id Object instance id of the server object instance + * @return int32_t pmax value + */ +int32_t lwm2m_server_get_pmax(uint16_t obj_inst_id); + +/** + * @brief Returns the Short Server ID of the server object instance with + * object instance id given by @p obj_inst_id. + * + * @param[in] obj_inst_id Object instance id of the server object + * @return SSID or negative in case not found + */ +int lwm2m_server_get_ssid(uint16_t obj_inst_id); + +/** + * @brief Returns the object instance id of the server having ssid given by @p short_id. + * + * @param[in] short_id ssid of the server object + * @return Object instance id or negative in case not found + */ +int lwm2m_server_short_id_to_inst(uint16_t short_id); + +#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) +bool lwm2m_server_get_mute_send(uint16_t obj_inst_id); +#endif + #if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_OBJ_SUPPORT) /** * @brief Sets the update state (as specified in LWM2M SPEC E.6 regarding the firmware update) diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 02c62cee67c..6d006b4603e 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -45,7 +45,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include "lwm2m_engine.h" #include "lwm2m_object.h" #include "lwm2m_obj_access_control.h" -#include "lwm2m_obj_server.h" #include "lwm2m_rw_link_format.h" #include "lwm2m_rw_oma_tlv.h" #include "lwm2m_rw_plain_text.h" diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_server.c b/subsys/net/lib/lwm2m/lwm2m_obj_server.c index 10c7a1a1ea0..a1b2185ef1d 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_server.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_server.c @@ -15,9 +15,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include "lwm2m_object.h" -#include "lwm2m_obj_server.h" +#include "lwm2m_engine.h" #include "lwm2m_rd_client.h" -#include "lwm2m_registry.h" #define SERVER_VERSION_MAJOR 1 #if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) @@ -28,7 +27,37 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define SERVER_MAX_ID 9 #endif /* defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) */ +/* Server resource IDs */ +#define SERVER_SHORT_SERVER_ID 0 +#define SERVER_LIFETIME_ID 1 +#define SERVER_DEFAULT_MIN_PERIOD_ID 2 +#define SERVER_DEFAULT_MAX_PERIOD_ID 3 +#define SERVER_DISABLE_ID 4 +#define SERVER_DISABLE_TIMEOUT_ID 5 +#define SERVER_STORE_NOTIFY_ID 6 +#define SERVER_TRANSPORT_BINDING_ID 7 +#define SERVER_REG_UPDATE_TRIGGER_ID 8 +#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) +#define SERVER_BOOTSTRAP_UPDATE_TRIGGER_ID 9 +#define SERVER_APN_LINK_ID 10 +#define SERVER_TLS_DTLS_ALERT_CODE_ID 11 +#define SERVER_LAST_BOOTSTRAPPED_ID 12 +#define SERVER_REGISTRATION_PRIORITY_ORDER_ID 13 +#define SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID 14 +#define SERVER_REGISTRATION_FAILURE_BLOCK_ID 15 +#define SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID 16 +#define SERVER_COMMUNICATION_RETRY_COUNT_ID 17 +#define SERVER_COMMUNICATION_RETRY_TIMER_ID 18 +#define SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID 19 +#define SERVER_COMMUNICATION_SEQUENCE_RETRY_TIMER_ID 20 +#define SERVER_SMS_TRIGGER_ID 21 +#define SERVER_PREFERRED_TRANSPORT_ID 22 +#define SERVER_MUTE_SEND_ID 23 +#endif /* defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) */ + + /* Server flags */ +#define SERVER_FLAG_DISABLED 1 #define SERVER_FLAG_STORE_NOTIFY 2 #define MAX_INSTANCE_COUNT CONFIG_LWM2M_SERVER_INSTANCE_COUNT @@ -47,14 +76,13 @@ static uint16_t server_id[MAX_INSTANCE_COUNT]; static uint32_t lifetime[MAX_INSTANCE_COUNT]; static uint32_t default_min_period[MAX_INSTANCE_COUNT]; static uint32_t default_max_period[MAX_INSTANCE_COUNT]; -static k_timepoint_t disabled_until[MAX_INSTANCE_COUNT]; +static uint8_t server_flag_disabled[MAX_INSTANCE_COUNT]; static uint32_t disabled_timeout[MAX_INSTANCE_COUNT]; static uint8_t server_flag_store_notify[MAX_INSTANCE_COUNT]; static char transport_binding[MAX_INSTANCE_COUNT][TRANSPORT_BINDING_LEN]; -/* Server object version 1.1 */ -static uint8_t priority[MAX_INSTANCE_COUNT]; +#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) static bool mute_send[MAX_INSTANCE_COUNT]; -static bool boostrap_on_fail[MAX_INSTANCE_COUNT]; +#endif static struct lwm2m_engine_obj server; static struct lwm2m_engine_obj_field fields[] = { @@ -73,10 +101,10 @@ static struct lwm2m_engine_obj_field fields[] = { OBJ_FIELD_DATA(SERVER_APN_LINK_ID, RW_OPT, OBJLNK), OBJ_FIELD_DATA(SERVER_TLS_DTLS_ALERT_CODE_ID, R_OPT, U8), OBJ_FIELD_DATA(SERVER_LAST_BOOTSTRAPPED_ID, R_OPT, TIME), - OBJ_FIELD_DATA(SERVER_REGISTRATION_PRIORITY_ORDER_ID, RW_OPT, U8), + OBJ_FIELD_DATA(SERVER_REGISTRATION_PRIORITY_ORDER_ID, W_OPT, U16), OBJ_FIELD_DATA(SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID, W_OPT, U16), OBJ_FIELD_DATA(SERVER_REGISTRATION_FAILURE_BLOCK_ID, W_OPT, BOOL), - OBJ_FIELD_DATA(SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID, RW_OPT, BOOL), + OBJ_FIELD_DATA(SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID, W_OPT, BOOL), OBJ_FIELD_DATA(SERVER_COMMUNICATION_RETRY_COUNT_ID, W_OPT, U16), OBJ_FIELD_DATA(SERVER_COMMUNICATION_RETRY_TIMER_ID, W_OPT, U16), OBJ_FIELD_DATA(SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID, W_OPT, U16), @@ -100,7 +128,7 @@ static int disable_cb(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len) LOG_DBG("DISABLE %d", obj_inst_id); for (i = 0; i < MAX_INSTANCE_COUNT; i++) { if (inst[i].obj && inst[i].obj_inst_id == obj_inst_id) { - disabled_until[i] = sys_timepoint_calc(K_SECONDS(disabled_timeout[i])); + server_flag_disabled[i] = 1U; return 0; } } @@ -115,6 +143,7 @@ static int update_trigger_cb(uint16_t obj_inst_id, return 0; } +#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) static int bootstrap_trigger_cb(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len) { @@ -132,6 +161,7 @@ bool lwm2m_server_get_mute_send(uint16_t obj_inst_id) } return false; } +#endif /* defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) */ static int lifetime_write_cb(uint16_t obj_inst_id, uint16_t res_id, @@ -203,116 +233,6 @@ int lwm2m_server_short_id_to_inst(uint16_t short_id) return -ENOENT; } -static int lwm2m_server_inst_id_to_index(uint16_t obj_inst_id) -{ - for (int i = 0; i < ARRAY_SIZE(inst); i++) { - if (inst[i].obj && inst[i].obj_inst_id == obj_inst_id) { - return i; - } - } - return -1; -} - -bool lwm2m_server_is_enabled(uint16_t obj_inst_id) -{ - int idx = lwm2m_server_inst_id_to_index(obj_inst_id); - - if (idx < 0) { - return false; - } - return sys_timepoint_expired(disabled_until[idx]); -} - -int lwm2m_server_disable(uint16_t obj_inst_id, k_timeout_t timeout) -{ - int idx = lwm2m_server_inst_id_to_index(obj_inst_id); - - if (idx < 0) { - return -ENOENT; - } - disabled_until[idx] = sys_timepoint_calc(timeout); - return 0; -} - -k_timepoint_t lwm2m_server_get_disabled_time(uint16_t obj_inst_id) -{ - int idx = lwm2m_server_inst_id_to_index(obj_inst_id); - - if (idx < 0) { - return sys_timepoint_calc(K_FOREVER); - } - return disabled_until[idx]; -} - -void lwm2m_server_reset_timestamps(void) -{ - for (int i = 0; i < ARRAY_SIZE(inst); i++) { - disabled_until[i] = sys_timepoint_calc(K_NO_WAIT); - } -} - -bool lwm2m_server_select(uint16_t *obj_inst_id) -{ - uint8_t min = UINT8_MAX; - uint8_t max = 0; - - /* Find priority boundaries */ - if (IS_ENABLED(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1)) { - for (int i = 0; i < ARRAY_SIZE(inst); i++) { - if (min > priority[i]) { - min = priority[i]; - } - if (max < priority[i]) { - max = priority[i]; - } - } - } else { - min = max = 0; - } - - for (uint8_t prio = min; prio <= max; prio++) { - for (int i = 0; i < ARRAY_SIZE(inst); i++) { - /* Disabled for a period */ - if (!lwm2m_server_is_enabled(inst[i].obj_inst_id)) { - continue; - } - - /* Invalid short IDs */ - if (server_id[i] == 0 || server_id[i] == UINT16_MAX) { - continue; - } - - /* Check priority */ - if (IS_ENABLED(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1)) { - if (priority[i] > prio) { - continue; - } - } - if (obj_inst_id) { - *obj_inst_id = inst[i].obj_inst_id; - } - return true; - } - } - - LOG_ERR("No server candidate found"); - return false; -} - -uint8_t lwm2m_server_get_prio(uint16_t obj_inst_id) -{ - if (IS_ENABLED(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1)) { - int idx = lwm2m_server_inst_id_to_index(obj_inst_id); - - if (idx < 0) { - return UINT8_MAX; - } - return priority[idx]; - } - - return (uint8_t)obj_inst_id % UINT8_MAX; -} - static struct lwm2m_engine_obj_inst *server_create(uint16_t obj_inst_id) { int index, i = 0, j = 0; @@ -339,14 +259,16 @@ static struct lwm2m_engine_obj_inst *server_create(uint16_t obj_inst_id) } /* Set default values */ - disabled_until[i] = sys_timepoint_calc(K_NO_WAIT); + server_flag_disabled[index] = 0U; server_flag_store_notify[index] = 0U; server_id[index] = index + 1; lifetime[index] = CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIME; default_min_period[index] = CONFIG_LWM2M_SERVER_DEFAULT_PMIN; default_max_period[index] = CONFIG_LWM2M_SERVER_DEFAULT_PMAX; disabled_timeout[index] = 86400U; - boostrap_on_fail[index] = true; +#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) + mute_send[index] = false; +#endif lwm2m_engine_get_binding(transport_binding[index]); @@ -383,39 +305,33 @@ static struct lwm2m_engine_obj_inst *server_create(uint16_t obj_inst_id) transport_binding[index], TRANSPORT_BINDING_LEN, strlen(transport_binding[index]) + 1); INIT_OBJ_RES_EXECUTE(SERVER_REG_UPDATE_TRIGGER_ID, res[index], i, update_trigger_cb); - - if (IS_ENABLED(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1)) { - mute_send[index] = false; - priority[index] = 0; - INIT_OBJ_RES_EXECUTE(SERVER_BOOTSTRAP_UPDATE_TRIGGER_ID, res[index], i, - bootstrap_trigger_cb); - INIT_OBJ_RES_OPTDATA(SERVER_APN_LINK_ID, res[index], i, res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_TLS_DTLS_ALERT_CODE_ID, res[index], i, res_inst[index], - j); - INIT_OBJ_RES_OPTDATA(SERVER_LAST_BOOTSTRAPPED_ID, res[index], i, res_inst[index], - j); - INIT_OBJ_RES_DATA(SERVER_REGISTRATION_PRIORITY_ORDER_ID, res[index], i, - res_inst[index], j, &priority[index], sizeof(uint8_t)); - INIT_OBJ_RES_OPTDATA(SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_REGISTRATION_FAILURE_BLOCK_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_DATA(SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID, res[index], i, - res_inst[index], j, &boostrap_on_fail[index], sizeof(bool)); - INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_RETRY_COUNT_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_RETRY_TIMER_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_SEQUENCE_RETRY_TIMER_ID, res[index], i, - res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_SMS_TRIGGER_ID, res[index], i, res_inst[index], j); - INIT_OBJ_RES_OPTDATA(SERVER_PREFERRED_TRANSPORT_ID, res[index], i, res_inst[index], - j); - INIT_OBJ_RES_DATA(SERVER_MUTE_SEND_ID, res[index], i, res_inst[index], j, - &mute_send[index], sizeof(bool)); - } +#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) + INIT_OBJ_RES_EXECUTE(SERVER_BOOTSTRAP_UPDATE_TRIGGER_ID, res[index], i, + bootstrap_trigger_cb); + INIT_OBJ_RES_OPTDATA(SERVER_APN_LINK_ID, res[index], i, res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_TLS_DTLS_ALERT_CODE_ID, res[index], i, res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_LAST_BOOTSTRAPPED_ID, res[index], i, res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_REGISTRATION_PRIORITY_ORDER_ID, res[index], i, res_inst[index], + j); + INIT_OBJ_RES_OPTDATA(SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_REGISTRATION_FAILURE_BLOCK_ID, res[index], i, res_inst[index], + j); + INIT_OBJ_RES_OPTDATA(SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_RETRY_COUNT_ID, res[index], i, res_inst[index], + j); + INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_RETRY_TIMER_ID, res[index], i, res_inst[index], + j); + INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_COMMUNICATION_SEQUENCE_RETRY_TIMER_ID, res[index], i, + res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_SMS_TRIGGER_ID, res[index], i, res_inst[index], j); + INIT_OBJ_RES_OPTDATA(SERVER_PREFERRED_TRANSPORT_ID, res[index], i, res_inst[index], j); + INIT_OBJ_RES_DATA(SERVER_MUTE_SEND_ID, res[index], i, res_inst[index], j, &mute_send[index], + sizeof(bool)); +#endif /* defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) */ inst[index].resources = res[index]; inst[index].resource_count = i; diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_server.h b/subsys/net/lib/lwm2m/lwm2m_obj_server.h deleted file mode 100644 index 56d7a674071..00000000000 --- a/subsys/net/lib/lwm2m/lwm2m_obj_server.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef LWM2M_OBJ_SERVER_H_ -#define LWM2M_OBJ_SERVER_H_ - -#include -#include -#include - -/* Server resource IDs */ -#define SERVER_SHORT_SERVER_ID 0 -#define SERVER_LIFETIME_ID 1 -#define SERVER_DEFAULT_MIN_PERIOD_ID 2 -#define SERVER_DEFAULT_MAX_PERIOD_ID 3 -#define SERVER_DISABLE_ID 4 -#define SERVER_DISABLE_TIMEOUT_ID 5 -#define SERVER_STORE_NOTIFY_ID 6 -#define SERVER_TRANSPORT_BINDING_ID 7 -#define SERVER_REG_UPDATE_TRIGGER_ID 8 -/* Server object version 1.1 resource IDs */ -#define SERVER_BOOTSTRAP_UPDATE_TRIGGER_ID 9 -#define SERVER_APN_LINK_ID 10 -#define SERVER_TLS_DTLS_ALERT_CODE_ID 11 -#define SERVER_LAST_BOOTSTRAPPED_ID 12 -#define SERVER_REGISTRATION_PRIORITY_ORDER_ID 13 -#define SERVER_INITIAL_REGISTRATION_DELAY_TIMER_ID 14 -#define SERVER_REGISTRATION_FAILURE_BLOCK_ID 15 -#define SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID 16 -#define SERVER_COMMUNICATION_RETRY_COUNT_ID 17 -#define SERVER_COMMUNICATION_RETRY_TIMER_ID 18 -#define SERVER_COMMUNICATION_SEQUENCE_DELAY_TIMER_ID 19 -#define SERVER_COMMUNICATION_SEQUENCE_RETRY_TIMER_ID 20 -#define SERVER_SMS_TRIGGER_ID 21 -#define SERVER_PREFERRED_TRANSPORT_ID 22 -#define SERVER_MUTE_SEND_ID 23 - -/** - * @brief Returns the default minimum period for an observation set for the server - * with object instance id given by @p obj_inst_id. - * - * @param[in] obj_inst_id Object instance id of the server object instance - * @return int32_t pmin value - */ -int32_t lwm2m_server_get_pmin(uint16_t obj_inst_id); - -/** - * @brief Returns the default maximum period for an observation set for the server - * with object instance id given by @p obj_inst_id. - * - * @param[in] obj_inst_id Object instance id of the server object instance - * @return int32_t pmax value - */ -int32_t lwm2m_server_get_pmax(uint16_t obj_inst_id); - -/** - * @brief Returns the Short Server ID of the server object instance with - * object instance id given by @p obj_inst_id. - * - * @param[in] obj_inst_id Object instance id of the server object - * @return SSID or negative in case not found - */ -int lwm2m_server_get_ssid(uint16_t obj_inst_id); - -/** - * @brief Returns the object instance id of the server having ssid given by @p short_id. - * - * @param[in] short_id ssid of the server object - * @return Object instance id or negative in case not found - */ -int lwm2m_server_short_id_to_inst(uint16_t short_id); - -/** - * @brief Check if given server instance is not disabled - * - * @param[in] obj_inst_id server instance - * @return true if not disabled, false otherwise. - */ -bool lwm2m_server_is_enabled(uint16_t obj_inst_id); - -/** - * @brief Select server instance. - * - * Find possible server instance considering values on server data. - * Server candidates cannot be in disabled state and if priority values are set, - * those are compared and lowest values are considered first. - * - * If @ref obj_inst_id is NULL, this can be used to check if there are any server available. - * - * @param[out] obj_inst_id where selected server instance ID is written. Can be NULL. - * @return true if server instance was found, false otherwise. - */ -bool lwm2m_server_select(uint16_t *obj_inst_id); - -/** - * @brief Disable server instance for a period of time. - * - * Timeout values can be calculated using kernel macros like K_SECONDS(). - * Values like K_FOREVER or K_NO_WAIT are also accepted. - * - * @param timeout Timeout value. - * @return zero on success, negative error code otherwise. - */ -int lwm2m_server_disable(uint16_t obj_inst_id, k_timeout_t timeout); - -/** - * @brief Get timepoint how long server instance is disabled. - * - * If server instance is not disabled, this still returns a valid timepoint - * that have already expired. - * If the instance id is not valid, the timepoint is set to K_FOREVER. - * - * @param obj_inst_id Server instance ID. - * @return timepoint - */ -k_timepoint_t lwm2m_server_get_disabled_time(uint16_t obj_inst_id); - -/** - * @brief Get priority of given server instance. - * - * Lower values mean higher priority. - * If LwM2M server object version 1.1 is not enabled, - * this returns obj_inst_id as priority. - * - * @param obj_inst_id instance ID - * @return priority or UINT8_MAX if instance not found - */ -uint8_t lwm2m_server_get_prio(uint16_t obj_inst_id); - -/** - * @brief Reset all disable-timers for all server instances. - * - */ -void lwm2m_server_reset_timestamps(void); - -#if defined(CONFIG_LWM2M_SERVER_OBJECT_VERSION_1_1) -bool lwm2m_server_get_mute_send(uint16_t obj_inst_id); -#endif - - -#endif /* LWM2M_OBJ_SERVER_H_ */ diff --git a/subsys/net/lib/lwm2m/lwm2m_observation.c b/subsys/net/lib/lwm2m/lwm2m_observation.c index 1c8034e6535..9ee1fa6eda1 100644 --- a/subsys/net/lib/lwm2m/lwm2m_observation.c +++ b/subsys/net/lib/lwm2m/lwm2m_observation.c @@ -37,7 +37,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include #include -#include "lwm2m_obj_server.h" #if defined(CONFIG_LWM2M_RW_SENML_JSON_SUPPORT) #include "lwm2m_rw_senml_json.h" diff --git a/subsys/net/lib/lwm2m/lwm2m_rd_client.c b/subsys/net/lib/lwm2m/lwm2m_rd_client.c index 6eacba0ee0d..d9f2e229edd 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rd_client.c +++ b/subsys/net/lib/lwm2m/lwm2m_rd_client.c @@ -62,7 +62,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include "lwm2m_rd_client.h" #include "lwm2m_rw_link_format.h" #include "lwm2m_util.h" -#include "lwm2m_obj_server.h" #define LWM2M_RD_CLIENT_URI "rd" #define CLIENT_EP_LEN CONFIG_LWM2M_RD_CLIENT_ENDPOINT_NAME_MAX_LENGTH From f39815cb668ba905bf3fc45195604ed29a6424e7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:05 +0100 Subject: [PATCH 1249/2300] Revert "[nrf fromtree] net: lwm2m: Allow finding security instance by short ID." This reverts commit 129f5c6df5f0df40caaf659bcb25926ff4c5e387. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_engine.h | 8 -------- subsys/net/lib/lwm2m/lwm2m_obj_security.c | 10 ---------- 2 files changed, 18 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.h b/subsys/net/lib/lwm2m/lwm2m_engine.h index 2ea3e583242..2306fced197 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.h +++ b/subsys/net/lib/lwm2m/lwm2m_engine.h @@ -133,14 +133,6 @@ int lwm2m_engine_call_now(k_work_handler_t service); */ int lwm2m_security_inst_id_to_index(uint16_t obj_inst_id); -/** - * @brief Returns the object instance id of the security having ssid given by @p short_id. - * - * @param[in] short_id ssid of the security object - * @return Object instance id or negative in case not found - */ -int lwm2m_security_short_id_to_inst(uint16_t short_id); - /** * @brief Returns the object instance id of the security object instance at @p index * in the security object list. diff --git a/subsys/net/lib/lwm2m/lwm2m_obj_security.c b/subsys/net/lib/lwm2m/lwm2m_obj_security.c index 00796648634..874925c39d8 100644 --- a/subsys/net/lib/lwm2m/lwm2m_obj_security.c +++ b/subsys/net/lib/lwm2m/lwm2m_obj_security.c @@ -212,16 +212,6 @@ int lwm2m_security_index_to_inst_id(int index) return inst[index].obj_inst_id; } -int lwm2m_security_short_id_to_inst(uint16_t short_id) -{ - for (int i = 0; i < MAX_INSTANCE_COUNT; i++) { - if (short_server_id[i] == short_id) { - return inst[i].obj_inst_id; - } - } - return -ENOENT; -} - int lwm2m_security_mode(struct lwm2m_ctx *ctx) { int ret; From 5ac13e59a2b9a90f06a48d896dffd7e6d5d7dc64 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:06 +0100 Subject: [PATCH 1250/2300] Revert "[nrf fromtree] net: lib: coap: Add coap_service_is_running" This reverts commit 2d0aeab9021fa95a66d9f4c537caacff1a49538d. Signed-off-by: Robert Lubos --- include/zephyr/net/coap_service.h | 12 ------------ subsys/net/lib/coap/coap_server.c | 18 ------------------ 2 files changed, 30 deletions(-) diff --git a/include/zephyr/net/coap_service.h b/include/zephyr/net/coap_service.h index 6f038ce61e1..92a276d0d48 100644 --- a/include/zephyr/net/coap_service.h +++ b/include/zephyr/net/coap_service.h @@ -214,18 +214,6 @@ int coap_service_start(const struct coap_service *service); */ int coap_service_stop(const struct coap_service *service); -/** - * @brief Query the provided @p service running state. - * - * @note This function is suitable for a @p service defined with @ref COAP_SERVICE_DEFINE. - * - * @param service Pointer to CoAP service - * @retval 1 if the service is running - * @retval 0 if the service is stopped - * @retval negative in case of an error. - */ -int coap_service_is_running(const struct coap_service *service); - /** * @brief Send a CoAP message from the provided @p service . * diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 386bc2081bb..009a0fe0274 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -483,24 +483,6 @@ int coap_service_stop(const struct coap_service *service) return ret; } -int coap_service_is_running(const struct coap_service *service) -{ - int ret; - - if (!coap_service_in_section(service)) { - __ASSERT_NO_MSG(false); - return -EINVAL; - } - - k_mutex_lock(&lock, K_FOREVER); - - ret = (service->data->sock_fd < 0) ? 0 : 1; - - k_mutex_unlock(&lock); - - return ret; -} - int coap_service_send(const struct coap_service *service, const struct coap_packet *cpkt, const struct sockaddr *addr, socklen_t addr_len) { From 5dfba414f08816a7a573721fd2a1a5f8551cb3f4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:06 +0100 Subject: [PATCH 1251/2300] Revert "[nrf fromtree] net: lib: coap: Fix return value documentation coap_service_start" This reverts commit eef1361e16e17373d341deb470cb5fad0efa8a30. Signed-off-by: Robert Lubos --- include/zephyr/net/coap_service.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/net/coap_service.h b/include/zephyr/net/coap_service.h index 92a276d0d48..377c89a7bef 100644 --- a/include/zephyr/net/coap_service.h +++ b/include/zephyr/net/coap_service.h @@ -199,7 +199,7 @@ struct coap_service { * @param service Pointer to CoAP service * @retval 0 in case of success. * @retval -EALREADY in case of an already running service. - * @retval -ENOTSUP in case the server has no valid host and port configuration. + * @retval -ENOMEM in case the server has no available context. */ int coap_service_start(const struct coap_service *service); From 0268c39e454f13f802a476552921b4a8c6ad3561 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:06 +0100 Subject: [PATCH 1252/2300] Revert "[nrf fromtree] net: lib: coap: Init CoAP service socket fd to -1" This reverts commit 81a63f5d95eff9e3b6d2bf9e572ee77f9a19aa69. Signed-off-by: Robert Lubos --- include/zephyr/net/coap_service.h | 4 +--- subsys/net/lib/coap/coap_server.c | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/coap_service.h b/include/zephyr/net/coap_service.h index 377c89a7bef..3e3201308b9 100644 --- a/include/zephyr/net/coap_service.h +++ b/include/zephyr/net/coap_service.h @@ -57,9 +57,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 = { \ - .sock_fd = -1, \ - }; \ + static struct coap_service_data coap_service_data_##_name; \ const STRUCT_SECTION_ITERABLE(coap_service, _name) = { \ .name = STRINGIFY(_name), \ .host = _host, \ diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 009a0fe0274..ac179f5545e 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -707,6 +707,9 @@ static void coap_server_thread(void *p1, void *p2, void *p3) } COAP_SERVICE_FOREACH(svc) { + /* Init all file descriptors to -1 */ + svc->data->sock_fd = -1; + if (svc->flags & COAP_SERVICE_AUTOSTART) { ret = coap_service_start(svc); if (ret < 0) { From 4fe627d6ddebf5c365e43bbcd39c8c2b6d86fd8f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:06 +0100 Subject: [PATCH 1253/2300] Revert "[nrf fromtree] tests: net: lib: coap_server: Do not autostart service B with port 0" This reverts commit 297b4797cfdf0620ec628ecb1b2a46de42ddc786. Signed-off-by: Robert Lubos --- tests/net/lib/coap_server/common/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/net/lib/coap_server/common/src/main.c b/tests/net/lib/coap_server/common/src/main.c index 20c4b7c0317..7af940c5360 100644 --- a/tests/net/lib/coap_server/common/src/main.c +++ b/tests/net/lib/coap_server/common/src/main.c @@ -48,7 +48,7 @@ COAP_RESOURCE_DEFINE(resource_1, service_A, { }); static uint16_t service_B_port; -COAP_SERVICE_DEFINE(service_B, "b.service.com", &service_B_port, 0); +COAP_SERVICE_DEFINE(service_B, "b.service.com", &service_B_port, COAP_SERVICE_AUTOSTART); static const char * const resource_2_path[] = { "res2", "sub", NULL }; COAP_RESOURCE_DEFINE(resource_2, service_B, { @@ -132,7 +132,7 @@ ZTEST(coap_service, test_COAP_SERVICE_FOREACH) zassert_equal(svc->flags & COAP_SERVICE_AUTOSTART, COAP_SERVICE_AUTOSTART); } else if (svc == &service_B) { have_service_B = 1; - zassert_equal(svc->flags & COAP_SERVICE_AUTOSTART, 0); + zassert_equal(svc->flags & COAP_SERVICE_AUTOSTART, COAP_SERVICE_AUTOSTART); } else if (svc == &service_C) { have_service_C = 1; zassert_equal(svc->flags & COAP_SERVICE_AUTOSTART, 0); From 491a1cf84eec3744267c1913d6acf76e73830811 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:06 +0100 Subject: [PATCH 1254/2300] Revert "[nrf fromtree] net: lib: coap: Translate handler errors to CoAP response codes" This reverts commit 6682521923d8038fbae1ad3215f1510337c1efcd. Signed-off-by: Robert Lubos --- subsys/net/lib/coap/coap_server.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index ac179f5545e..4b4f1719f46 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -220,19 +220,6 @@ static int coap_server_process(int sock_fd) COAP_SERVICE_RESOURCE_COUNT(service), options, opt_num, &client_addr, client_addr_len); - /* Translate errors to response codes */ - switch (ret) { - case -ENOENT: - ret = COAP_RESPONSE_CODE_NOT_FOUND; - break; - case -ENOTSUP: - ret = COAP_RESPONSE_CODE_BAD_REQUEST; - break; - case -EPERM: - ret = COAP_RESPONSE_CODE_NOT_ALLOWED; - break; - } - /* Shortcut for replying a code without a body */ if (ret > 0 && type == COAP_TYPE_CON) { /* Minimal sized ack buffer */ From ff453948a011a348c6fa1d1c8cd6b6028cfe6684 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:07 +0100 Subject: [PATCH 1255/2300] Revert "[nrf fromtree] tests: lwm2m_rd_client: Added more fff tests" This reverts commit a7ef49523e503b264c8af591c69bbd40f6c4ed6b. Signed-off-by: Robert Lubos --- .../net/lib/lwm2m/lwm2m_rd_client/src/main.c | 70 ------------------- .../net/lib/lwm2m/lwm2m_rd_client/src/stubs.c | 14 ---- .../net/lib/lwm2m/lwm2m_rd_client/src/stubs.h | 3 - 3 files changed, 87 deletions(-) diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c b/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c index 208298512d4..931f6f15904 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/main.c @@ -698,73 +698,3 @@ ZTEST(lwm2m_rd_client, test_bootstrap_no_srv_fallback_to_register) zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), NULL); } - -ZTEST(lwm2m_rd_client, test_start_stop_ignore_engine_fault) -{ - struct lwm2m_ctx ctx; - - (void)memset(&ctx, 0x0, sizeof(ctx)); - - test_prepare_pending_message_cb(&message_reply_cb_default); - - lwm2m_rd_client_init(); - test_lwm2m_engine_start_service(); - wait_for_service(1); - - lwm2m_engine_context_init_fake.custom_fake = lwm2m_engine_context_init_fake1; - lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_default; - lwm2m_sprint_ip_addr_fake.custom_fake = lwm2m_sprint_ip_addr_fake_default; - lwm2m_init_message_fake.custom_fake = lwm2m_init_message_fake_default; - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; - coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; - zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, - NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), - NULL); - - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; - zassert_true(lwm2m_rd_client_stop(&ctx, lwm2m_event_cb, true) == 0, NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_DISCONNECT), NULL); - - int c = show_lwm2m_event_fake.call_count; - - test_throw_network_error_from_engine(EIO); - wait_for_service(10); - zassert_equal(show_lwm2m_event_fake.call_count, c, - "Should not enter any other state and throw an event"); -} - -ZTEST(lwm2m_rd_client, test_start_suspend_ignore_engine_fault) -{ - struct lwm2m_ctx ctx; - - (void)memset(&ctx, 0x0, sizeof(ctx)); - - test_prepare_pending_message_cb(&message_reply_cb_default); - - lwm2m_rd_client_init(); - test_lwm2m_engine_start_service(); - wait_for_service(1); - - lwm2m_engine_context_init_fake.custom_fake = lwm2m_engine_context_init_fake1; - lwm2m_get_bool_fake.custom_fake = lwm2m_get_bool_fake_default; - lwm2m_sprint_ip_addr_fake.custom_fake = lwm2m_sprint_ip_addr_fake_default; - lwm2m_init_message_fake.custom_fake = lwm2m_init_message_fake_default; - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_created; - coap_find_options_fake.custom_fake = coap_find_options_do_registration_reply_cb_ok; - zassert_true(lwm2m_rd_client_start(&ctx, "Test", 0, lwm2m_event_cb, lwm2m_observe_cb) == 0, - NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_REGISTRATION_COMPLETE), - NULL); - - coap_header_get_code_fake.custom_fake = coap_header_get_code_fake_deleted; - zassert_true(lwm2m_rd_client_pause() == 0, NULL); - zassert_true(expect_lwm2m_rd_client_event(LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED), NULL); - - int c = show_lwm2m_event_fake.call_count; - - test_throw_network_error_from_engine(EIO); - wait_for_service(10); - zassert_equal(show_lwm2m_event_fake.call_count, c, - "Should not enter any other state and throw an event"); -} diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c index 3cbde9060ce..41789e20340 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.c @@ -86,10 +86,6 @@ int lwm2m_get_u32_val(const struct lwm2m_obj_path *path, uint32_t *val) /* subsys/net/lib/lwm2m/lwm2m_engine.h */ DEFINE_FAKE_VALUE_FUNC(int, lwm2m_socket_start, struct lwm2m_ctx *); -int lwm2m_socket_start_fake_fail(struct lwm2m_ctx *client_ctx) -{ - return -1; -} DEFINE_FAKE_VALUE_FUNC(int, lwm2m_socket_close, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_close_socket, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_socket_suspend, struct lwm2m_ctx *); @@ -97,16 +93,6 @@ DEFINE_FAKE_VALUE_FUNC(int, lwm2m_security_inst_id_to_index, uint16_t); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_engine_connection_resume, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_push_queued_buffers, struct lwm2m_ctx *); DEFINE_FAKE_VOID_FUNC(lwm2m_engine_context_init, struct lwm2m_ctx *); -struct lwm2m_ctx *client_ctx_fake; -void lwm2m_engine_context_init_fake1(struct lwm2m_ctx *client_ctx) -{ - client_ctx_fake = client_ctx; -} -void test_throw_network_error_from_engine(int err) -{ - client_ctx_fake->fault_cb(err); -} - DEFINE_FAKE_VOID_FUNC(lwm2m_engine_context_close, struct lwm2m_ctx *); DEFINE_FAKE_VALUE_FUNC(char *, lwm2m_sprint_ip_addr, const struct sockaddr *); char *lwm2m_sprint_ip_addr_fake_default(const struct sockaddr *addr) diff --git a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h index 1276dd5c109..620e4d8fc12 100644 --- a/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h +++ b/tests/net/lib/lwm2m/lwm2m_rd_client/src/stubs.h @@ -54,7 +54,6 @@ int lwm2m_get_u32_val(const struct lwm2m_obj_path *path, uint32_t *val); /* subsys/net/lib/lwm2m/lwm2m_engine.h */ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_start, struct lwm2m_ctx *); -int lwm2m_socket_start_fake_fail(struct lwm2m_ctx *client_ctx); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_close, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_close_socket, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_socket_suspend, struct lwm2m_ctx *); @@ -62,8 +61,6 @@ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_security_inst_id_to_index, uint16_t); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_engine_connection_resume, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_push_queued_buffers, struct lwm2m_ctx *); DECLARE_FAKE_VOID_FUNC(lwm2m_engine_context_init, struct lwm2m_ctx *); -void lwm2m_engine_context_init_fake1(struct lwm2m_ctx *client_ctx); -void test_throw_network_error_from_engine(int err); DECLARE_FAKE_VOID_FUNC(lwm2m_engine_context_close, struct lwm2m_ctx *); DECLARE_FAKE_VALUE_FUNC(char *, lwm2m_sprint_ip_addr, const struct sockaddr *); char *lwm2m_sprint_ip_addr_fake_default(const struct sockaddr *addr); From d9d26c27f1f53e2ca82dca481b9eae9c02afe923 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:07 +0100 Subject: [PATCH 1256/2300] Revert "[nrf fromtree] samples: lwm2m: Add support for Connection Manager" This reverts commit eb5990c3d252ff4fefde1d0b6e913a7cb5854363. Signed-off-by: Robert Lubos --- samples/net/lwm2m_client/src/lwm2m-client.c | 78 --------------------- 1 file changed, 78 deletions(-) diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index a120506639d..748f654d9ee 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -16,8 +16,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include #include -#include -#include #include "modules.h" #define APP_BANNER "Run LWM2M client" @@ -31,10 +29,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define CLIENT_FIRMWARE_VER "1.0" #define CLIENT_HW_VER "1.0.1" -/* Macros used to subscribe to specific Zephyr NET management events. */ -#define L4_EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED) -#define CONN_LAYER_EVENT_MASK (NET_EVENT_CONN_IF_FATAL_ERROR) - static uint8_t bat_idx = LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT; static int bat_mv = 3800; static int bat_ma = 125; @@ -58,12 +52,6 @@ BUILD_ASSERT(sizeof(endpoint) <= CONFIG_LWM2M_SECURITY_KEY_SIZE, static struct k_sem quit_lock; -/* Zephyr NET management event callback structures. */ -static struct net_mgmt_event_callback l4_cb; -static struct net_mgmt_event_callback conn_cb; - -static K_SEM_DEFINE(network_connected_sem, 0, 1); - static int device_reboot_cb(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len) { @@ -277,47 +265,6 @@ static void observe_cb(enum lwm2m_observe_event event, } } -static void on_net_event_l4_disconnected(void) -{ - LOG_INF("Disconnected from network"); - lwm2m_engine_pause(); -} - -static void on_net_event_l4_connected(void) -{ - LOG_INF("Connected to network"); - k_sem_give(&network_connected_sem); - lwm2m_engine_resume(); -} - -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("IP Up"); - on_net_event_l4_connected(); - break; - case NET_EVENT_L4_DISCONNECTED: - LOG_INF("IP down"); - on_net_event_l4_disconnected(); - break; - default: - break; - } -} - -static void connectivity_event_handler(struct net_mgmt_event_callback *cb, - uint32_t event, - struct net_if *iface) -{ - if (event == NET_EVENT_CONN_IF_FATAL_ERROR) { - LOG_ERR("Fatal error received from the connectivity layer"); - return; - } -} - int main(void) { uint32_t flags = IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) ? @@ -328,31 +275,6 @@ int main(void) k_sem_init(&quit_lock, 0, K_SEM_MAX_LIMIT); - if (IS_ENABLED(CONFIG_NET_CONNECTION_MANAGER)) { - /* Setup handler for Zephyr NET Connection Manager events. */ - net_mgmt_init_event_callback(&l4_cb, l4_event_handler, L4_EVENT_MASK); - net_mgmt_add_event_callback(&l4_cb); - - /* Setup handler for Zephyr NET Connection Manager Connectivity layer. */ - net_mgmt_init_event_callback(&conn_cb, connectivity_event_handler, - CONN_LAYER_EVENT_MASK); - net_mgmt_add_event_callback(&conn_cb); - - ret = net_if_up(net_if_get_default()); - - if (ret < 0 && ret != -EALREADY) { - LOG_ERR("net_if_up, error: %d", ret); - 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); - } - } - ret = lwm2m_setup(); if (ret < 0) { LOG_ERR("Cannot setup LWM2M fields (%d)", ret); From 6a8b2703c129a479dde47f96a1928e3e4f364d6d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:07 +0100 Subject: [PATCH 1257/2300] Revert "[nrf fromtree] test: lwm2m: Test cancellation using observe parameter" This reverts commit 77b242914525edb1ab0a07ff0c9d71d1d85730c4. Signed-off-by: Robert Lubos --- tests/net/lib/lwm2m/interop/README.md | 4 +-- tests/net/lib/lwm2m/interop/pytest/leshan.py | 7 ----- .../lib/lwm2m/interop/pytest/test_lwm2m.py | 30 ++----------------- 3 files changed, 5 insertions(+), 36 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index 3acbfcc71f8..204aff636ac 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -172,9 +172,9 @@ Tests are written from test spec; |LightweightM2M-1.1-int-281 - Partially Successful Read-Composite Operation|:white_check_mark:| | |LightweightM2M-1.1-int-301 - Observation and Notification of parameter values|:white_check_mark:| | |LightweightM2M-1.1-int-302 - Cancel Observations using Reset Operation|:white_check_mark:| | -|LightweightM2M-1.1-int-303 - Cancel observations using Observe with Cancel parameter|:white_check_mark:|| +|LightweightM2M-1.1-int-303 - Cancel observations using Observe with Cancel parameter|:large_orange_diamond:|Leshan only supports passive cancelling| |LightweightM2M-1.1-int-304 - Observe-Composite Operation|:white_check_mark:| | -|LightweightM2M-1.1-int-305 - Cancel Observation-Composite Operation|:white_check_mark:| | +|LightweightM2M-1.1-int-305 - Cancel Observation-Composite Operation|:large_orange_diamond:|Leshan only supports passive cancelling| |LightweightM2M-1.1-int-306 – Send Operation|:white_check_mark:|[~~#64290~~](https://github.com/zephyrproject-rtos/zephyr/issues/64290)| |LightweightM2M-1.1-int-307 – Muting Send|:white_check_mark:| | |LightweightM2M-1.1-int-308 - Observe-Composite and Creating Object Instance|:white_check_mark:|[~~#64634~~](https://github.com/zephyrproject-rtos/zephyr/issues/64634)| diff --git a/tests/net/lib/lwm2m/interop/pytest/leshan.py b/tests/net/lib/lwm2m/interop/pytest/leshan.py index 181f15ebf61..65295e652bc 100644 --- a/tests/net/lib/lwm2m/interop/pytest/leshan.py +++ b/tests/net/lib/lwm2m/interop/pytest/leshan.py @@ -389,9 +389,6 @@ def observe(self, endpoint: str, path: str): return self.post(f'/clients/{endpoint}/{path}/observe', data="") def cancel_observe(self, endpoint: str, path: str): - return self.delete_raw(f'/clients/{endpoint}/{path}/observe?active') - - def passive_cancel_observe(self, endpoint: str, path: str): return self.delete_raw(f'/clients/{endpoint}/{path}/observe') def composite_observe(self, endpoint: str, paths: list[str]): @@ -401,10 +398,6 @@ def composite_observe(self, endpoint: str, paths: list[str]): return self.parse_composite(payload) def cancel_composite_observe(self, endpoint: str, paths: list[str]): - paths = [path if path.startswith('/') else '/' + path for path in paths] - return self.delete_raw(f'/clients/{endpoint}/composite/observe?paths=' + ','.join(paths) + '&active') - - def passive_cancel_composite_observe(self, endpoint: str, paths: list[str]): paths = [path if path.startswith('/') else '/' + path for path in paths] return self.delete_raw(f'/clients/{endpoint}/composite/observe?paths=' + ','.join(paths)) diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index 131acb68e14..eabc4bbc614 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -532,40 +532,24 @@ def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str) leshan.cancel_observe(endpoint, '3/0/7') leshan.remove_attributes(endpoint, '3/0/7', ['pmin', 'pmax']) +@pytest.mark.slow def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-302 - Cancel Observations using Reset Operation""" leshan.observe(endpoint, '3/0/7') leshan.observe(endpoint, '3/0/8') - with leshan.get_event_stream(endpoint) as events: - shell.exec_command('lwm2m write /3/0/7/0 -u32 4000') - data = events.next_event('NOTIFICATION') - assert data[3][0][7][0] == 4000 - leshan.passive_cancel_observe(endpoint, '3/0/7') - shell.exec_command('lwm2m write /3/0/7/0 -u32 3000') - dut.readlines_until(regex=r'.*Observer removed for 3/0/7') - with leshan.get_event_stream(endpoint) as events: - shell.exec_command('lwm2m write /3/0/8/0 -u32 100') - data = events.next_event('NOTIFICATION') - assert data[3][0][8][0] == 100 - leshan.passive_cancel_observe(endpoint, '3/0/8') - shell.exec_command('lwm2m write /3/0/8/0 -u32 50') - dut.readlines_until(regex=r'.*Observer removed for 3/0/8') - -def test_LightweightM2M_1_1_int_303(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): - """LightweightM2M-1.1-int-303 - Cancel observations using Observe with Cancel parameter""" - leshan.observe(endpoint, '3/0/7') - leshan.observe(endpoint, '3/0/8') with leshan.get_event_stream(endpoint) as events: shell.exec_command('lwm2m write /3/0/7/0 -u32 4000') data = events.next_event('NOTIFICATION') assert data[3][0][7][0] == 4000 leshan.cancel_observe(endpoint, '3/0/7') + shell.exec_command('lwm2m write /3/0/7/0 -u32 3000') dut.readlines_until(regex=r'.*Observer removed for 3/0/7') with leshan.get_event_stream(endpoint) as events: shell.exec_command('lwm2m write /3/0/8/0 -u32 100') data = events.next_event('NOTIFICATION') assert data[3][0][8][0] == 100 leshan.cancel_observe(endpoint, '3/0/8') + shell.exec_command('lwm2m write /3/0/8/0 -u32 50') dut.readlines_until(regex=r'.*Observer removed for 3/0/8') @pytest.mark.slow @@ -600,14 +584,6 @@ def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str) shell.exec_command('lwm2m write 1/0/3 -u32 10') leshan.remove_attributes(endpoint, '1/0/1', ['pmin', 'pmax']) -def test_LightweightM2M_1_1_int_305(dut: DeviceAdapter, leshan: Leshan, endpoint: str): - """LightweightM2M-1.1-int-305 - Cancel Observation-Composite Operation""" - leshan.composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16']) - leshan.cancel_composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16']) - dut.readlines_until(regex=r'.*Observer removed for 1/0/1') - dut.readlines_until(regex=r'.*Observer removed for 3/0/11/0') - dut.readlines_until(regex=r'.*Observer removed for 3/0/16') - def test_LightweightM2M_1_1_int_306(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-306 - Send Operation""" with leshan.get_event_stream(endpoint) as events: From 306ea2e40eaad19d175a10b5908a9db876525248 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:07 +0100 Subject: [PATCH 1258/2300] Revert "[nrf fromtree] test: lwm2m: Implement Read-Composite Operation on root path" This reverts commit fe952014ab5b8dabfda93820fef30cb2a94997df. Signed-off-by: Robert Lubos --- tests/net/lib/lwm2m/interop/README.md | 2 +- tests/net/lib/lwm2m/interop/pytest/leshan.py | 4 ---- tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py | 7 ++----- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index 204aff636ac..3654ca94b01 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -160,7 +160,7 @@ Tests are written from test spec; |LightweightM2M-1.1-int-232 - Querying basic information in SenML CBOR format|:white_check_mark:| | |LightweightM2M-1.1-int-233 - Setting basic information in SenML CBOR format|:white_check_mark:| | |LightweightM2M-1.1-int-234 - Setting basic information in SenML JSON format|:white_check_mark:| | -|LightweightM2M-1.1-int-235 - Read-Composite Operation on root path|:white_check_mark:| | +|LightweightM2M-1.1-int-235 - Read-Composite Operation on root path|:large_orange_diamond:|Root Path is not yet supported by Leshan.| |LightweightM2M-1.1-int-236 - Read-Composite - Partial Presence|:white_check_mark:| | |LightweightM2M-1.1-int-237 - Read on Object without specifying Content-Type|:white_check_mark:| | |LightweightM2M-1.1-int-241 - Executable Resource: Rebooting the device|:white_check_mark:| | diff --git a/tests/net/lib/lwm2m/interop/pytest/leshan.py b/tests/net/lib/lwm2m/interop/pytest/leshan.py index 65295e652bc..4add988ea77 100644 --- a/tests/net/lib/lwm2m/interop/pytest/leshan.py +++ b/tests/net/lib/lwm2m/interop/pytest/leshan.py @@ -271,10 +271,6 @@ def parse_composite(cls, payload: dict): raise RuntimeError(f'No content received') payload = payload['content'] for path, content in payload.items(): - if path == "/": - for obj in content['objects']: - data.update(cls._decode_obj(obj)) - continue keys = [int(key) for key in path.lstrip("/").split('/')] if len(keys) == 1: data.update(cls._decode_obj(content)) diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index eabc4bbc614..f596f74d30a 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -367,12 +367,9 @@ def test_LightweightM2M_1_1_int_234(shell: Shell, leshan: Leshan, endpoint: str) """LightweightM2M-1.1-int-234 - Setting basic information in SenML JSON format""" setting_basic_senml(shell, leshan, endpoint, 'SENML_JSON') -def test_LightweightM2M_1_1_int_235(leshan: Leshan, endpoint: str): +@pytest.mark.skip("Leshan does not allow reading root path") +def test_LightweightM2M_1_1_int_235(): """LightweightM2M-1.1-int-235 - Read-Composite Operation on root path""" - resp = leshan.composite_read(endpoint, ['/']) - expected_keys = [16, 1, 3, 5] - missing_keys = [key for key in expected_keys if key not in resp.keys()] - assert len(missing_keys) == 0 def test_LightweightM2M_1_1_int_236(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-236 - Read-Composite - Partial Presence""" From 044153ee5d3c4a3d74a3ab265a59926f42028bab Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:07 +0100 Subject: [PATCH 1259/2300] Revert "[nrf fromtree] test: lwm2m: Implement write_attributes()" This reverts commit 9e42510c28dbd156863c2a0eb59bc36f28dbd582. Signed-off-by: Robert Lubos --- tests/net/lib/lwm2m/interop/README.md | 2 +- tests/net/lib/lwm2m/interop/pytest/leshan.py | 19 +------ .../lib/lwm2m/interop/pytest/test_lwm2m.py | 56 +++++++++---------- 3 files changed, 29 insertions(+), 48 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/README.md b/tests/net/lib/lwm2m/interop/README.md index 3654ca94b01..bda38924d26 100644 --- a/tests/net/lib/lwm2m/interop/README.md +++ b/tests/net/lib/lwm2m/interop/README.md @@ -167,7 +167,7 @@ Tests are written from test spec; |LightweightM2M-1.1-int-256 - Write Operation Failure|:white_check_mark:| | |LightweightM2M-1.1-int-257 - Write-Composite Operation|:white_check_mark:| | |LightweightM2M-1.1-int-260 - Discover Command|:white_check_mark:| | -|LightweightM2M-1.1-int-261 - Write-Attribute Operation on a multiple resource|:white_check_mark:| | +|LightweightM2M-1.1-int-261 - Write-Attribute Operation on a multiple resource|:large_orange_diamond:|Leshan don't allow writing attributes to resource instance| |LightweightM2M-1.1-int-280 - Successful Read-Composite Operation|:white_check_mark:| | |LightweightM2M-1.1-int-281 - Partially Successful Read-Composite Operation|:white_check_mark:| | |LightweightM2M-1.1-int-301 - Observation and Notification of parameter values|:white_check_mark:| | diff --git a/tests/net/lib/lwm2m/interop/pytest/leshan.py b/tests/net/lib/lwm2m/interop/pytest/leshan.py index 4add988ea77..7240aae2baf 100644 --- a/tests/net/lib/lwm2m/interop/pytest/leshan.py +++ b/tests/net/lib/lwm2m/interop/pytest/leshan.py @@ -62,9 +62,9 @@ def get(self, path: str): resp = self._s.get(f'{self.api_url}{path}', params=params, timeout=self.timeout) return Leshan.handle_response(resp) - def put_raw(self, path: str, data: str | dict | None = None, headers: dict | None = None, params: dict | None = None): + def put_raw(self, path: str, data: str | dict | None = None, headers: dict | None = None): """Send HTTP PUT query without any default parameters""" - resp = self._s.put(f'{self.api_url}{path}', data=data, headers=headers, params=params, timeout=self.timeout) + resp = self._s.put(f'{self.api_url}{path}', data=data, headers=headers, timeout=self.timeout) return Leshan.handle_response(resp) def put(self, path: str, data: str | dict, uri_options: str = ''): @@ -108,21 +108,6 @@ def write(self, endpoint: str, path: str, value: bool | int | str): rid = path.split('/')[-1] return self.put(f'/clients/{endpoint}/{path}', self._define_resource(rid, value, kind)) - def write_attributes(self, endpoint: str, path: str, attributes: dict): - """Send LwM2M Write-Attributes to given path - example: - leshan.write_attributes(endpoint, '1/2/3, {'pmin': 10, 'pmax': 40}) - """ - return self.put_raw(f'/clients/{endpoint}/{path}/attributes', params=attributes) - - def remove_attributes(self, endpoint: str, path: str, attributes: list): - """Send LwM2M Write-Attributes to given path - example: - leshan.remove_attributes(endpoint, '1/2/3, ['pmin', 'pmax']) - """ - attrs = '&'.join(attributes) - return self.put_raw(f'/clients/{endpoint}/{path}/attributes?'+ attrs) - def update_obj_instance(self, endpoint: str, path: str, resources: dict): """Update object instance""" data = self._define_obj_inst(path, resources) diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index f596f74d30a..c37a3900aa6 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -202,7 +202,7 @@ def test_LightweightM2M_1_1_int_221(shell: Shell, leshan: Leshan, endpoint: str) """LightweightM2M-1.1-int-221 - Attempt to perform operations on Security""" assert leshan.read(endpoint, '0/0')['status'] == 'UNAUTHORIZED(401)' assert leshan.write(endpoint, '0/0/0', 'coap://localhost')['status'] == 'UNAUTHORIZED(401)' - assert leshan.write_attributes(endpoint, '0', {'pmin':10})['status'] == 'UNAUTHORIZED(401)' + assert leshan.put_raw(f'/clients/{endpoint}/0/attributes?pmin=10')['status'] == 'UNAUTHORIZED(401)' def test_LightweightM2M_1_1_int_222(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-222 - Read on Object""" @@ -429,12 +429,15 @@ def test_LightweightM2M_1_1_int_260(shell: Shell, leshan: Leshan, endpoint: str) expected_keys = ['/3', '/3/0', '/3/0/1', '/3/0/2', '/3/0/3', '/3/0/4', '/3/0/6', '/3/0/7', '/3/0/8', '/3/0/9', '/3/0/11', '/3/0/16'] missing_keys = [key for key in expected_keys if key not in resp.keys()] assert len(missing_keys) == 0 - assert leshan.write_attributes(endpoint, '3', {'pmin': 10, 'pmax': 200})['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmin=10')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmax=200')['status'] == 'CHANGED(204)' resp = leshan.discover(endpoint, '3/0') assert int(resp['/3/0/6']['dim']) == 2 assert int(resp['/3/0/7']['dim']) == 2 assert int(resp['/3/0/8']['dim']) == 2 - assert leshan.write_attributes(endpoint, '3/0/7', {'lt': 1, 'gt': 6, 'st': 1})['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?lt=1')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?gt=6')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?st=1')['status'] == 'CHANGED(204)' resp = leshan.discover(endpoint, '3/0') expected_keys = ['/3/0', '/3/0/1', '/3/0/2', '/3/0/3', '/3/0/4', '/3/0/6', '/3/0/7', '/3/0/8', '/3/0/9', '/3/0/11', '/3/0/16'] missing_keys = [key for key in expected_keys if key not in resp.keys()] @@ -448,9 +451,8 @@ def test_LightweightM2M_1_1_int_260(shell: Shell, leshan: Leshan, endpoint: str) missing_keys = [key for key in expected_keys if key not in resp.keys()] assert len(missing_keys) == 0 assert len(resp) == len(expected_keys) - # restore - leshan.remove_attributes(endpoint, '3', ['pmin', 'pmax']) +@pytest.mark.skip(reason="Leshan don't allow writing attributes to resource instance") def test_LightweightM2M_1_1_int_261(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-261 - Write-Attribute Operation on a multiple resource""" resp = leshan.discover(endpoint, '3/0/11') @@ -460,20 +462,19 @@ def test_LightweightM2M_1_1_int_261(shell: Shell, leshan: Leshan, endpoint: str) assert len(missing_keys) == 0 assert len(resp) == len(expected_keys) assert int(resp['/3/0/11']['dim']) == 1 - assert leshan.write_attributes(endpoint, '3', {'pmin':10, 'pmax':200})['status'] == 'CHANGED(204)' - assert leshan.write_attributes(endpoint, '3/0', {'pmax':320})['status'] == 'CHANGED(204)' - assert leshan.write_attributes(endpoint, '3/0/11/0', {'pmax':100, 'epmin':1, 'epmax':20})['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmin=10')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmax=200')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/0/attributes?pmax=320')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/0/11/0/attributes?pmax=100')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/0/11/0/attributes?epmin=1')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/0/11/0/attributes?epmax=20')['status'] == 'CHANGED(204)' resp = leshan.discover(endpoint, '3/0/11') logger.debug(resp) assert int(resp['/3/0/11']['pmin']) == 10 assert int(resp['/3/0/11']['pmax']) == 320 assert int(resp['/3/0/11/0']['pmax']) == 100 - # Note: Zephyr does not support epmin&epmax. - # Restore - leshan.remove_attributes(endpoint, '3', ['pmin', 'pmax']) - leshan.remove_attributes(endpoint, '3/0', ['pmax']) - leshan.remove_attributes(endpoint, '3/0/11/0', ['pmax']) - + assert int(resp['/3/0/11/0']['epmin']) == 1 + assert int(resp['/3/0/11/0']['epmax']) == 20 def test_LightweightM2M_1_1_int_280(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-280 - Successful Read-Composite Operation""" @@ -508,7 +509,8 @@ def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str) logger.debug(pwr_src) assert pwr_src[6][0] == 1 assert pwr_src[6][1] == 5 - assert leshan.write_attributes(endpoint, '3/0/7', {'pmin': 5, 'pmax': 10})['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?pmin=5')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/0/7/attributes?pmax=10')['status'] == 'CHANGED(204)' leshan.observe(endpoint, '3/0/7') with leshan.get_event_stream(endpoint, timeout=30) as events: shell.exec_command('lwm2m write /3/0/7/0 -u32 3000') @@ -527,7 +529,6 @@ def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str) assert data[3][0][7][0] == 3500 assert (start + 15) <= time.time() + 1 # Allow 1 second slack. (pMinx + pMax=15) leshan.cancel_observe(endpoint, '3/0/7') - leshan.remove_attributes(endpoint, '3/0/7', ['pmin', 'pmax']) @pytest.mark.slow def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): @@ -552,10 +553,8 @@ def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Le @pytest.mark.slow def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-304 - Observe-Composite Operation""" - # Need to use Configuration C.1 - shell.exec_command('lwm2m write 1/0/2 -u32 0') - shell.exec_command('lwm2m write 1/0/3 -u32 0') - assert leshan.write_attributes(endpoint, '1/0/1', {'pmin': 30, 'pmax': 45})['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/1/0/1/attributes?pmin=30')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/1/0/1/attributes?pmax=45')['status'] == 'CHANGED(204)' data = leshan.composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16']) assert data[1][0][1] is not None assert data[3][0][11][0] is not None @@ -576,10 +575,6 @@ def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str) assert (start + 30) < time.time() assert (start + 45) > time.time() - 1 leshan.cancel_composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16']) - # Restore configuration C.3 - shell.exec_command('lwm2m write 1/0/2 -u32 1') - shell.exec_command('lwm2m write 1/0/3 -u32 10') - leshan.remove_attributes(endpoint, '1/0/1', ['pmin', 'pmax']) def test_LightweightM2M_1_1_int_306(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-306 - Send Operation""" @@ -625,7 +620,8 @@ def test_LightweightM2M_1_1_int_308(shell: Shell, dut: DeviceAdapter, leshan: Le content_both = {16: {0: resources_a, 1: resources_b}} assert leshan.create_obj_instance(endpoint, '16/0', resources_a)['status'] == 'CREATED(201)' dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0) - assert leshan.write_attributes(endpoint, '16/0', {'pmin': 30, 'pmax': 45})['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/16/0/attributes?pmin=30')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/16/0/attributes?pmax=45')['status'] == 'CHANGED(204)' data = leshan.composite_observe(endpoint, ['/16/0', '/16/1']) assert data == content_one with leshan.get_event_stream(endpoint, timeout=50) as events: @@ -641,7 +637,6 @@ def test_LightweightM2M_1_1_int_308(shell: Shell, dut: DeviceAdapter, leshan: Le # Restore configuration C.3 shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') - leshan.remove_attributes(endpoint, '16/0', ['pmin','pmax']) @pytest.mark.slow def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): @@ -668,7 +663,8 @@ def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Le assert leshan.create_obj_instance(endpoint, '16/0', resources_a)['status'] == 'CREATED(201)' assert leshan.create_obj_instance(endpoint, '16/1', resources_b)['status'] == 'CREATED(201)' dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0) - assert leshan.write_attributes(endpoint, '16/0', {'pmin': 30, 'pmax': 45})['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/16/0/attributes?pmin=30')['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/16/0/attributes?pmax=45')['status'] == 'CHANGED(204)' data = leshan.composite_observe(endpoint, ['/16/0', '/16/1']) assert data == content_both with leshan.get_event_stream(endpoint, timeout=50) as events: @@ -684,7 +680,6 @@ def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Le # Restore configuration C.3 shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') - leshan.remove_attributes(endpoint, '16/0', ['pmin', 'pmax']) @pytest.mark.slow def test_LightweightM2M_1_1_int_310(shell: Shell, leshan: Leshan, endpoint: str): @@ -692,9 +687,11 @@ def test_LightweightM2M_1_1_int_310(shell: Shell, leshan: Leshan, endpoint: str) # Need to use Configuration C.1 shell.exec_command('lwm2m write 1/0/2 -u32 0') shell.exec_command('lwm2m write 1/0/3 -u32 0') + # Ensure that our previous attributes are not conflicting + assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmin=0')['status'] == 'CHANGED(204)' leshan.composite_observe(endpoint, ['/1/0/1', '/3/0']) with leshan.get_event_stream(endpoint, timeout=50) as events: - assert leshan.write_attributes(endpoint, '3', {'pmax': 5})['status'] == 'CHANGED(204)' + assert leshan.put_raw(f'/clients/{endpoint}/3/attributes?pmax=5')['status'] == 'CHANGED(204)' start = time.time() data = events.next_event('NOTIFICATION') assert data[3][0][0] == 'Zephyr' @@ -707,7 +704,6 @@ def test_LightweightM2M_1_1_int_310(shell: Shell, leshan: Leshan, endpoint: str) # Restore configuration C.3 shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') - leshan.remove_attributes(endpoint, '3', ['pmax']) def test_LightweightM2M_1_1_int_311(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-311 - Send command""" From ea1387bc4f8a13b1aefd809d174a27f79eb97579 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:07 +0100 Subject: [PATCH 1260/2300] Revert "[nrf fromtree] test: lwm2m: Mark some tests as slow" This reverts commit 5f6e44a5b303afc22a6f1fe3781687202f570557. Signed-off-by: Robert Lubos --- tests/net/lib/lwm2m/interop/pytest/pytest.ini | 3 --- tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py | 9 --------- 2 files changed, 12 deletions(-) delete mode 100644 tests/net/lib/lwm2m/interop/pytest/pytest.ini diff --git a/tests/net/lib/lwm2m/interop/pytest/pytest.ini b/tests/net/lib/lwm2m/interop/pytest/pytest.ini deleted file mode 100644 index 761785364d8..00000000000 --- a/tests/net/lib/lwm2m/interop/pytest/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -markers = - slow: marks tests as slow (deselect with '-m "not slow"') diff --git a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py index c37a3900aa6..8f3acd69c7e 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py @@ -51,7 +51,6 @@ def test_LightweightM2M_1_1_int_104(shell: Shell, dut: DeviceAdapter, leshan: Le leshan.execute(endpoint, '1/0/8') dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0) -@pytest.mark.slow def test_LightweightM2M_1_1_int_107(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-107 - Extending the lifetime of a registration""" leshan.write(endpoint, '1/0/1', 120) @@ -67,7 +66,6 @@ def test_LightweightM2M_1_1_int_108(leshan, endpoint): """LightweightM2M-1.1-int-108 - Turn on Queue Mode""" assert leshan.get(f'/clients/{endpoint}')["queuemode"] -@pytest.mark.slow def test_LightweightM2M_1_1_int_109(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-109 - Behavior in Queue Mode""" logger.debug('Wait for Queue RX OFF') @@ -502,7 +500,6 @@ def test_LightweightM2M_1_1_int_281(shell: Shell, leshan: Leshan, endpoint: str) # Information Reporting Interface [300-399] # -@pytest.mark.slow def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-301 - Observation and Notification of parameter values""" pwr_src = leshan.read(endpoint, '3/0/6') @@ -530,7 +527,6 @@ def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str) assert (start + 15) <= time.time() + 1 # Allow 1 second slack. (pMinx + pMax=15) leshan.cancel_observe(endpoint, '3/0/7') -@pytest.mark.slow def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-302 - Cancel Observations using Reset Operation""" leshan.observe(endpoint, '3/0/7') @@ -550,7 +546,6 @@ def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Le shell.exec_command('lwm2m write /3/0/8/0 -u32 50') dut.readlines_until(regex=r'.*Observer removed for 3/0/8') -@pytest.mark.slow def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-304 - Observe-Composite Operation""" assert leshan.put_raw(f'/clients/{endpoint}/1/0/1/attributes?pmin=30')['status'] == 'CHANGED(204)' @@ -595,8 +590,6 @@ def test_LightweightM2M_1_1_int_307(shell: Shell, dut: DeviceAdapter, leshan: Le shell.exec_command('lwm2m send /3/0') dut.readlines_until(regex=r'.*SEND status: 0', timeout=5.0) - -@pytest.mark.slow def test_LightweightM2M_1_1_int_308(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-308 - Observe-Composite and Creating Object Instance""" shell.exec_command('lwm2m delete /16/0') @@ -638,7 +631,6 @@ def test_LightweightM2M_1_1_int_308(shell: Shell, dut: DeviceAdapter, leshan: Le shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') -@pytest.mark.slow def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-309 - Observe-Composite and Deleting Object Instance""" shell.exec_command('lwm2m delete /16/0') @@ -681,7 +673,6 @@ def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Le shell.exec_command('lwm2m write 1/0/2 -u32 1') shell.exec_command('lwm2m write 1/0/3 -u32 10') -@pytest.mark.slow def test_LightweightM2M_1_1_int_310(shell: Shell, leshan: Leshan, endpoint: str): """LightweightM2M-1.1-int-310 - Observe-Composite and modification of parameter values""" # Need to use Configuration C.1 From 42b91717a22f0a4d7b296eb3f3537ac7b76ce6a9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:07 +0100 Subject: [PATCH 1261/2300] Revert "[nrf fromtree] net: sockets: prevent null pointer dereference" This reverts commit 230c66aea40330402bb285c6558c1911047676de. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/sockets.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index 060c7fff8f7..d35317352c9 100644 --- a/subsys/net/lib/sockets/sockets.c +++ b/subsys/net/lib/sockets/sockets.c @@ -681,9 +681,7 @@ int z_impl_zsock_accept(int sock, struct sockaddr *addr, socklen_t *addrlen) new_sock = VTABLE_CALL(accept, sock, addr, addrlen); - if (addr) { - (void)sock_obj_core_alloc_find(sock, new_sock, addr->sa_family, SOCK_STREAM); - } + (void)sock_obj_core_alloc_find(sock, new_sock, addr->sa_family, SOCK_STREAM); return new_sock; } From e3b8c376391ff3d61ee6b512ea996c1456e5db13 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:08 +0100 Subject: [PATCH 1262/2300] Revert "[nrf fromtree] drivers: ieee802154: nrf5: add `IEEE802154_RX_ON_WHEN_IDLE` capability" This reverts commit 5bbaec17bc6636bb0dca266ba92a2d6a621876d4. Signed-off-by: Robert Lubos --- drivers/ieee802154/ieee802154_nrf5.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 20444826857..0dc618cad6d 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -236,7 +236,6 @@ static void nrf5_get_capabilities_at_boot(void) ((caps & NRF_802154_CAPABILITY_DELAYED_TX) ? IEEE802154_HW_TXTIME : 0UL) | ((caps & NRF_802154_CAPABILITY_DELAYED_RX) ? IEEE802154_HW_RXTIME : 0UL) | IEEE802154_HW_SLEEP_TO_TX | - IEEE802154_RX_ON_WHEN_IDLE | ((caps & NRF_802154_CAPABILITY_SECURITY) ? IEEE802154_HW_TX_SEC : 0UL) #if defined(CONFIG_IEEE802154_NRF5_MULTIPLE_CCA) | IEEE802154_OPENTHREAD_HW_MULTIPLE_CCA @@ -984,10 +983,6 @@ static int nrf5_configure(const struct device *dev, break; #endif /* CONFIG_IEEE802154_NRF5_MULTIPLE_CCA */ - case IEEE802154_CONFIG_RX_ON_WHEN_IDLE: - nrf_802154_rx_on_when_idle_set(config->rx_on_when_idle); - break; - default: return -EINVAL; } @@ -1065,8 +1060,20 @@ void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id) const struct device *dev = nrf5_get_device(); #if defined(CONFIG_IEEE802154_CSL_ENDPOINT) - if (id == DRX_SLOT_RX && error == NRF_802154_RX_ERROR_DELAYED_TIMEOUT) { - return; + if (id == DRX_SLOT_RX) { + __ASSERT_NO_MSG(nrf5_data.event_handler); +#if !defined(CONFIG_IEEE802154_CSL_DEBUG) + /* When CSL debug option is used we intentionally avoid notifying the higher layer + * about the finalization of a DRX slot, so that the radio stays in receive state + * for receiving "out of slot" frames. + * As a side effect, regular failure notifications would be reported with the + * incorrect ID. + */ + nrf5_data.event_handler(dev, IEEE802154_EVENT_RX_OFF, NULL); +#endif + if (error == NRF_802154_RX_ERROR_DELAYED_TIMEOUT) { + return; + } } #else ARG_UNUSED(id); From 0f0d59ee8b0ef302a6e8c21f2edc4510eb3f497d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:08 +0100 Subject: [PATCH 1263/2300] Revert "[nrf fromtree] drivers: ieee802154: nrf: make selective tx power the default" This reverts commit 9aca277f295eb85e37a57902d37c30984fefba6e. Signed-off-by: Robert Lubos --- doc/releases/release-notes-3.6.rst | 2 -- drivers/ieee802154/Kconfig | 5 +++++ drivers/ieee802154/ieee802154_nrf5.c | 24 +++++++++++++----------- drivers/ieee802154/ieee802154_nrf5.h | 3 --- include/zephyr/net/ieee802154_pkt.h | 18 ++++++++++++++++++ modules/openthread/platform/radio.c | 7 ++++++- 6 files changed, 42 insertions(+), 17 deletions(-) diff --git a/doc/releases/release-notes-3.6.rst b/doc/releases/release-notes-3.6.rst index a253434a085..8edd3280382 100644 --- a/doc/releases/release-notes-3.6.rst +++ b/doc/releases/release-notes-3.6.rst @@ -154,8 +154,6 @@ Drivers and Sensors * IEEE 802.15.4 - * Removed :kconfig:option:`CONFIG_IEEE802154_SELECTIVE_TXPOWER` Kconfig option. - * Interrupt Controller * Input diff --git a/drivers/ieee802154/Kconfig b/drivers/ieee802154/Kconfig index d692024b096..feccd4a6001 100644 --- a/drivers/ieee802154/Kconfig +++ b/drivers/ieee802154/Kconfig @@ -98,6 +98,11 @@ config IEEE802154_CSL_DEBUG help Enable support for CSL debugging by avoiding sleep state in favor of receive state. +config IEEE802154_SELECTIVE_TXPOWER + bool "Support selective TX power setting" + help + Enable support for selectively setting TX power for every transmission request. + module = IEEE802154_DRIVER module-str = IEEE 802.15.4 driver module-help = Sets log level for IEEE 802.15.4 Device Drivers. diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 0dc618cad6d..458b4e90e8a 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -375,7 +375,7 @@ static int nrf5_set_txpower(const struct device *dev, int16_t dbm) LOG_DBG("%d", dbm); - nrf5_data.txpwr = dbm; + nrf_802154_tx_power_set(dbm); return 0; } @@ -465,8 +465,10 @@ static bool nrf5_tx_immediate(struct net_pkt *pkt, uint8_t *payload, bool cca) }, .cca = cca, .tx_power = { - .use_metadata_value = true, - .power = nrf5_data.txpwr, + .use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER), +#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) + .power = net_pkt_ieee802154_txpwr(pkt), +#endif }, }; @@ -482,8 +484,10 @@ static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload) .dynamic_data_is_set = net_pkt_ieee802154_mac_hdr_rdy(pkt), }, .tx_power = { - .use_metadata_value = true, - .power = nrf5_data.txpwr, + .use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER), +#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) + .power = net_pkt_ieee802154_txpwr(pkt), +#endif }, }; @@ -526,8 +530,10 @@ static bool nrf5_tx_at(struct nrf5_802154_data *nrf5_radio, struct net_pkt *pkt, .cca = cca, .channel = nrf_802154_channel_get(), .tx_power = { - .use_metadata_value = true, - .power = nrf5_data.txpwr, + .use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER), +#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) + .power = net_pkt_ieee802154_txpwr(pkt), +#endif }, #if defined(CONFIG_IEEE802154_NRF5_MULTIPLE_CCA) .extra_cca_attempts = max_extra_cca_attempts, @@ -665,8 +671,6 @@ static int nrf5_start(const struct device *dev) { ARG_UNUSED(dev); - nrf_802154_tx_power_set(nrf5_data.txpwr); - if (!nrf_802154_receive()) { LOG_ERR("Failed to enter receive state"); return -EIO; @@ -709,8 +713,6 @@ static int nrf5_continuous_carrier(const struct device *dev) { ARG_UNUSED(dev); - nrf_802154_tx_power_set(nrf5_data.txpwr); - if (!nrf_802154_continuous_carrier()) { LOG_ERR("Failed to enter continuous carrier state"); return -EIO; diff --git a/drivers/ieee802154/ieee802154_nrf5.h b/drivers/ieee802154/ieee802154_nrf5.h index 79b47827d72..9115fe0bdae 100644 --- a/drivers/ieee802154/ieee802154_nrf5.h +++ b/drivers/ieee802154/ieee802154_nrf5.h @@ -97,9 +97,6 @@ struct nrf5_802154_data { uint8_t max_extra_cca_attempts; #endif - /* The TX power in dBm. */ - int8_t txpwr; - #if defined(CONFIG_NRF_802154_SER_HOST) && defined(CONFIG_IEEE802154_CSL_ENDPOINT) /* The last configured value of CSL period in units of 10 symbols. */ uint32_t csl_period; diff --git a/include/zephyr/net/ieee802154_pkt.h b/include/zephyr/net/ieee802154_pkt.h index 3270f994248..d5fdc712b49 100644 --- a/include/zephyr/net/ieee802154_pkt.h +++ b/include/zephyr/net/ieee802154_pkt.h @@ -59,6 +59,12 @@ struct net_pkt_cb_ieee802154 { */ uint8_t rssi; }; +#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) + /* TX packets */ + struct { + int8_t txpwr; /* TX power in dBm. */ + }; +#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */ }; /* Flags */ @@ -179,6 +185,18 @@ static inline void net_pkt_set_ieee802154_rssi_dbm(struct net_pkt *pkt, int16_t CODE_UNREACHABLE; } +#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) +static inline int8_t net_pkt_ieee802154_txpwr(struct net_pkt *pkt) +{ + return net_pkt_cb_ieee802154(pkt)->txpwr; +} + +static inline void net_pkt_set_ieee802154_txpwr(struct net_pkt *pkt, int8_t txpwr) +{ + net_pkt_cb_ieee802154(pkt)->txpwr = txpwr; +} +#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */ + static inline bool net_pkt_ieee802154_ack_fpb(struct net_pkt *pkt) { return net_pkt_cb_ieee802154(pkt)->ack_fpb; diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index cec73e3ef6f..a09b7dd3b67 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -380,8 +380,13 @@ void transmit_message(struct k_work *tx_job) channel = sTransmitFrame.mChannel; - radio_api->set_channel(radio_dev, channel); + radio_api->set_channel(radio_dev, sTransmitFrame.mChannel); + +#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER) + net_pkt_set_ieee802154_txpwr(tx_pkt, get_transmit_power_for_channel(channel)); +#else radio_api->set_txpower(radio_dev, get_transmit_power_for_channel(channel)); +#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */ net_pkt_set_ieee802154_frame_secured(tx_pkt, sTransmitFrame.mInfo.mTxInfo.mIsSecurityProcessed); From 9ecfa4406a4d954cb03a116fb7a7cb54219cae7e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:08 +0100 Subject: [PATCH 1264/2300] Revert "[nrf fromtree] manifest: update hal_nordic revision" This reverts commit 500fb9bedb7a21a6142a35dc81533bf148acb643. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 44967d775e7..e49d66c39e4 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 3786c55424d4d64c62dd25219de31618cef26fdf + revision: b9633ecea67bf52925d4c61455046223b46402b1 path: modules/hal/nordic groups: - hal From 3736eb0edcf19b2ba24811a3c8a69480550370a8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:08 +0100 Subject: [PATCH 1265/2300] Revert "[nrf fromtree] net: mgmt: Provide Regulatory channel info" This reverts commit a2cd875ded9dfbca45b4b1af7ac4ae0e48ebd3d2. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 20 -------------------- subsys/net/l2/wifi/wifi_shell.c | 19 ++----------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index f6ae631a830..78800f451e7 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -546,22 +546,6 @@ enum wifi_mgmt_op { WIFI_MGMT_SET = 1, }; -#define MAX_REG_CHAN_NUM 42 - -/** Per-channel regulatory attributes */ -struct wifi_reg_chan_info { - /** Center frequency in MHz */ - unsigned short center_frequency; - /** Maximum transmission power (in dBm) */ - unsigned short max_power:8; - /** Is channel supported or not */ - unsigned short supported:1; - /** Passive transmissions only */ - unsigned short passive_only:1; - /** Is a DFS channel */ - unsigned short dfs:1; -} __packed; - /** Regulatory domain information or configuration */ struct wifi_reg_domain { /* Regulatory domain operation */ @@ -570,10 +554,6 @@ struct wifi_reg_domain { bool force; /** Country code: ISO/IEC 3166-1 alpha-2 */ uint8_t country_code[WIFI_COUNTRY_CODE_LEN]; - /** Number of channels supported */ - unsigned int num_channels; - /** Channels information */ - struct wifi_reg_chan_info *chan_info; }; /** Wi-Fi TWT sleep states */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index e1446cceca0..1ee94304781 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -64,7 +64,6 @@ static struct { static uint32_t scan_result; static struct net_mgmt_event_callback wifi_shell_mgmt_cb; -static struct wifi_reg_chan_info chan_info[MAX_REG_CHAN_NUM]; static K_MUTEX_DEFINE(wifi_ap_sta_list_lock); struct wifi_ap_sta_node { @@ -135,6 +134,7 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) wifi_mfp_txt(entry->mfp)); } +#ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS static int wifi_freq_to_channel(int frequency) { int channel = 0; @@ -156,7 +156,6 @@ static int wifi_freq_to_channel(int frequency) return channel; } -#ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS static enum wifi_frequency_bands wifi_freq_to_band(int frequency) { enum wifi_frequency_bands band = WIFI_FREQ_BAND_2_4_GHZ; @@ -1290,10 +1289,9 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, { struct net_if *iface = net_if_get_first_wifi(); struct wifi_reg_domain regd = {0}; - int ret, chan_idx = 0; + int ret; if (argc == 1) { - (®d)->chan_info = &chan_info[0]; regd.oper = WIFI_MGMT_GET; } else if (argc >= 2 && argc <= 3) { regd.oper = WIFI_MGMT_SET; @@ -1338,19 +1336,6 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, if (regd.oper == WIFI_MGMT_GET) { shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Regulatory domain is: %c%c\n", regd.country_code[0], regd.country_code[1]); - shell_fprintf(sh, SHELL_NORMAL, - "\t

\t\t" - "\t\t\n"); - for (chan_idx = 0; chan_idx < regd.num_channels; chan_idx++) { - shell_fprintf(sh, SHELL_NORMAL, - " %d\t\t\t\%d\t\t\t\%s\t\t\t%d\t\t\t%s\t\t\t\t%s\n", - wifi_freq_to_channel(chan_info[chan_idx].center_frequency), - chan_info[chan_idx].center_frequency, - chan_info[chan_idx].supported ? "y" : "n", - chan_info[chan_idx].max_power, - chan_info[chan_idx].passive_only ? "y" : "n", - chan_info[chan_idx].dfs ? "y" : "n"); - } } else { shell_fprintf(sh, SHELL_NORMAL, "Wi-Fi Regulatory domain set to: %c%c\n", regd.country_code[0], regd.country_code[1]); From 5befd7a5974894c06f4d44e72656fa3e2d397d85 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:08 +0100 Subject: [PATCH 1266/2300] Revert "[nrf fromtree] dts: nrf5340: add missing `easydma-maxcnt-bits` for nrf5340_cpunet" This reverts commit 798bf40bea1c0f7cfc0a6570c0b354bd927bb413. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf5340_cpunet.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index c1e8371d410..63c7e920f81 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -192,7 +192,6 @@ reg = <0x41013000 0x1000>; clock-frequency = ; interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; status = "disabled"; }; From 921bd321a29c6056027b7d51921e3c80241529f6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:09 +0100 Subject: [PATCH 1267/2300] Revert "[nrf fromtree] Bluetooth: Mesh: suspend/resume gatt advs" This reverts commit d9e6ed4b1d08dbee5c4957d78db3df9a26290986. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/main.c | 40 +----------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 1b80233cec1..2689a3355c1 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -462,22 +462,6 @@ int bt_mesh_suspend(void) bt_mesh_access_suspend(); - if (IS_ENABLED(CONFIG_BT_MESH_PB_GATT)) { - err = bt_mesh_pb_gatt_srv_disable(); - if (err && err != -EALREADY) { - LOG_WRN("Disabling PB-GATT failed (err %d)", err); - return err; - } - } - - if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) { - err = bt_mesh_proxy_gatt_disable(); - if (err && err != -EALREADY) { - LOG_WRN("Disabling GATT proxy failed (err %d)", err); - return err; - } - } - err = bt_mesh_adv_disable(); if (err) { atomic_clear_bit(bt_mesh.flags, BT_MESH_SUSPENDED); @@ -524,22 +508,6 @@ int bt_mesh_resume(void) return err; } - if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY) && bt_mesh_is_provisioned()) { - err = bt_mesh_proxy_gatt_enable(); - if (err) { - LOG_WRN("Re-enabling GATT proxy failed (err %d)", err); - return err; - } - } - - if (IS_ENABLED(CONFIG_BT_MESH_PB_GATT) && !bt_mesh_is_provisioned()) { - err = bt_mesh_pb_gatt_srv_enable(); - if (err) { - LOG_WRN("Re-enabling PB-GATT failed (err %d)", err); - return err; - } - } - err = bt_mesh_scan_enable(); if (err) { LOG_WRN("Re-enabling scanning failed (err %d)", err); @@ -556,13 +524,7 @@ int bt_mesh_resume(void) bt_mesh_model_foreach(model_resume, NULL); - err = bt_mesh_adv_gatt_send(); - if (err && (err != -ENOTSUP)) { - LOG_WRN("GATT send failed (err %d)", err); - return err; - } - - return 0; + return err; } int bt_mesh_init(const struct bt_mesh_prov *prov, From d8e4e10e2939646fe602f0448f3dc9145d064ec9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:09 +0100 Subject: [PATCH 1268/2300] Revert "[nrf fromtree] Bluetooth: Mesh: fix proxy srv return value" This reverts commit e01bbbc63b82af02fe793bcb86b2a106bf49b622. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/proxy_srv.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index a903d94ffa9..25a44abfded 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -975,8 +975,6 @@ static void svc_reg_work_handler(struct k_work *work) int bt_mesh_proxy_gatt_enable(void) { - int err; - LOG_DBG(""); if (!bt_mesh_is_provisioned()) { @@ -988,13 +986,7 @@ int bt_mesh_proxy_gatt_enable(void) } svc_reg_attempts = PROXY_SVC_REG_ATTEMPTS; - err = k_work_schedule(&svc_reg_work, PROXY_SVC_INIT_TIMEOUT); - if (err < 0) { - LOG_ERR("Enabling GATT proxy failed (err %d)", err); - return err; - } - - return 0; + return k_work_schedule(&svc_reg_work, PROXY_SVC_INIT_TIMEOUT); } void bt_mesh_proxy_gatt_disconnect(void) From c3c625075f8965f3ff513d10b58c49320a346ba5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:09 +0100 Subject: [PATCH 1269/2300] Revert "[nrf fromtree] Bluetooth: Mesh: remove 20ms tx delay in adv bearer" This reverts commit e3a41ded255f8465eb59902386785ada04b1401f. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/adv_ext.c | 54 +++++++++++++------ tests/bsim/bluetooth/mesh/overlay_pst.conf | 2 - .../bluetooth/mesh/src/test_persistence.c | 6 --- .../bsim/bluetooth/mesh/src/test_provision.c | 10 ---- 4 files changed, 38 insertions(+), 34 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 8f4f05a34cf..856c6c39f1d 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -63,8 +63,8 @@ struct bt_mesh_ext_adv { ATOMIC_DEFINE(flags, ADV_FLAGS_NUM); struct bt_le_ext_adv *instance; struct bt_mesh_adv *adv; - uint32_t timestamp; - struct k_work work; + uint64_t timestamp; + struct k_work_delayable work; struct bt_le_adv_param adv_param; }; @@ -88,7 +88,7 @@ static struct bt_mesh_ext_adv advs[] = { #endif /* CONFIG_BT_MESH_PB_ADV */ BT_MESH_ADV_TAG_BIT_LOCAL ), - .work = Z_WORK_INITIALIZER(send_pending_adv), + .work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv), }, #if CONFIG_BT_MESH_RELAY_ADV_SETS [1 ... CONFIG_BT_MESH_RELAY_ADV_SETS] = { @@ -100,19 +100,19 @@ static struct bt_mesh_ext_adv advs[] = { BT_MESH_ADV_TAG_BIT_PROV | #endif /* CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS */ 0), - .work = Z_WORK_INITIALIZER(send_pending_adv), + .work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv), }, #endif /* CONFIG_BT_MESH_RELAY_ADV_SETS */ #if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) { .tags = BT_MESH_ADV_TAG_BIT_FRIEND, - .work = Z_WORK_INITIALIZER(send_pending_adv), + .work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv), }, #endif /* CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE */ #if defined(CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE) { .tags = BT_MESH_ADV_TAG_BIT_PROXY, - .work = Z_WORK_INITIALIZER(send_pending_adv), + .work = Z_WORK_DELAYABLE_INITIALIZER(send_pending_adv), }, #endif /* CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE */ }; @@ -197,7 +197,7 @@ static int adv_start(struct bt_mesh_ext_adv *ext_adv, return err; } - ext_adv->timestamp = k_uptime_get_32(); + ext_adv->timestamp = k_uptime_get(); err = bt_le_ext_adv_start(ext_adv->instance, start); if (err) { @@ -271,13 +271,18 @@ static void send_pending_adv(struct k_work *work) struct bt_mesh_adv *adv; int err; - ext_adv = CONTAINER_OF(work, struct bt_mesh_ext_adv, work); + ext_adv = CONTAINER_OF(work, struct bt_mesh_ext_adv, work.work); if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_SENT)) { - LOG_DBG("Advertising stopped after %u ms for %s", - k_uptime_get_32() - ext_adv->timestamp, - ext_adv->adv ? adv_tag_to_str[ext_adv->adv->ctx.tag] - : adv_tag_to_str[BT_MESH_ADV_TAG_PROXY]); + /* Calling k_uptime_delta on a timestamp moves it to the current time. + * This is essential here, as schedule_send() uses the end of the event + * as a reference to avoid sending the next advertisement too soon. + */ + int64_t duration = k_uptime_delta(&ext_adv->timestamp); + + LOG_DBG("Advertising stopped after %u ms for %s", (uint32_t)duration, + ext_adv->adv ? adv_tag_to_str[ext_adv->adv->ctx.tag] : + adv_tag_to_str[BT_MESH_ADV_TAG_PROXY]); atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY); @@ -335,6 +340,11 @@ static void send_pending_adv(struct k_work *work) static bool schedule_send(struct bt_mesh_ext_adv *ext_adv) { + uint64_t timestamp; + int64_t delta; + + timestamp = ext_adv->timestamp; + if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_PROXY)) { atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); (void)bt_le_ext_adv_stop(ext_adv->instance); @@ -350,7 +360,19 @@ static bool schedule_send(struct bt_mesh_ext_adv *ext_adv) } atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); - k_work_submit(&ext_adv->work); + + if ((IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && + ext_adv->tags & BT_MESH_ADV_TAG_BIT_FRIEND) || + (CONFIG_BT_MESH_RELAY_ADV_SETS > 0 && ext_adv->tags & BT_MESH_ADV_TAG_BIT_RELAY)) { + k_work_reschedule(&ext_adv->work, K_NO_WAIT); + } else { + /* The controller will send the next advertisement immediately. + * Introduce a delay here to avoid sending the next mesh packet closer + * to the previous packet than what's permitted by the specification. + */ + delta = k_uptime_delta(×tamp); + k_work_reschedule(&ext_adv->work, K_MSEC(ADV_INT_FAST_MS - delta)); + } return true; } @@ -416,7 +438,7 @@ void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) atomic_set_bit(ext_adv->flags, ADV_FLAG_SENT); - k_work_submit(&ext_adv->work); + k_work_submit(&ext_adv->work.work); return; } @@ -465,7 +487,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); + k_work_submit(&ext_adv->work.work); } #if defined(CONFIG_BT_MESH_GATT_SERVER) @@ -521,7 +543,7 @@ int bt_mesh_adv_disable(void) struct k_work_sync sync; for (int i = 0; i < ARRAY_SIZE(advs); i++) { - k_work_flush(&advs[i].work, &sync); + k_work_flush_delayable(&advs[i].work, &sync); err = bt_le_ext_adv_stop(advs[i].instance); if (err) { diff --git a/tests/bsim/bluetooth/mesh/overlay_pst.conf b/tests/bsim/bluetooth/mesh/overlay_pst.conf index 6730b9ee233..6a56ec8065b 100644 --- a/tests/bsim/bluetooth/mesh/overlay_pst.conf +++ b/tests/bsim/bluetooth/mesh/overlay_pst.conf @@ -19,6 +19,4 @@ CONFIG_BT_MESH_SEQ_STORE_RATE=1 CONFIG_BT_MESH_RPL_STORE_TIMEOUT=1 CONFIG_BT_MESH_STORE_TIMEOUT=1 CONFIG_BT_MESH_TX_SEG_RETRANS_COUNT=1 -CONFIG_BT_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST=200 -CONFIG_BT_MESH_SEG_ACK_BASE_TIMEOUT=400 CONFIG_BT_MESH_COMP_PST_BUF_SIZE=600 diff --git a/tests/bsim/bluetooth/mesh/src/test_persistence.c b/tests/bsim/bluetooth/mesh/src/test_persistence.c index ec7d838d26a..4bf1f9faa93 100644 --- a/tests/bsim/bluetooth/mesh/src/test_persistence.c +++ b/tests/bsim/bluetooth/mesh/src/test_persistence.c @@ -455,12 +455,6 @@ static void provisioner_setup(void) FAIL("Failed to add test_netkey (err: %d, status: %d)", err, status); } - err = bt_mesh_cfg_cli_net_transmit_set(test_netkey_idx, TEST_PROV_ADDR, - BT_MESH_TRANSMIT(3, 50), &status); - if (err || status != BT_MESH_TRANSMIT(3, 50)) { - FAIL("Net transmit set failed (err %d, transmit %x)", err, status); - } - provisioner_ready = true; } diff --git a/tests/bsim/bluetooth/mesh/src/test_provision.c b/tests/bsim/bluetooth/mesh/src/test_provision.c index 2bff871b187..3d0e8010c75 100644 --- a/tests/bsim/bluetooth/mesh/src/test_provision.c +++ b/tests/bsim/bluetooth/mesh/src/test_provision.c @@ -1205,7 +1205,6 @@ static void test_provisioner_pb_remote_client_nppi_robustness(void) uint16_t pb_remote_server_addr; uint8_t status; struct bt_mesh_cdb_node *node; - int err; provisioner_pb_remote_client_setup(); @@ -1219,15 +1218,6 @@ static void test_provisioner_pb_remote_client_nppi_robustness(void) .ttl = 3, }; - /* Set Network Transmit Count state on the remote client greater than on the remote server - * to increase probability of reception responses. - */ - err = bt_mesh_cfg_cli_net_transmit_set(0, current_dev_addr, BT_MESH_TRANSMIT(3, 50), - &status); - if (err || status != BT_MESH_TRANSMIT(3, 50)) { - FAIL("Net transmit set failed (err %d, transmit %x)", err, status); - } - ASSERT_OK(provision_remote(&srv, 2, &srv.addr)); /* Check device key by adding appkey. */ From 48a36599b2f35996c355b3d3462c41f28bce3f82 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:09 +0100 Subject: [PATCH 1270/2300] Revert "[nrf fromtree] tests: Bluetooth: Mesh: Add proxy adv coex test." This reverts commit 660b52ee5d2edff02a1d068fc1fac9b9175469a6. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/proxy_srv.c | 11 +- tests/bsim/bluetooth/mesh/overlay_gatt.conf | 1 - tests/bsim/bluetooth/mesh/src/test_beacon.c | 366 ++---------------- .../proxy_adv_multi_subnet_coex.sh | 54 --- 4 files changed, 35 insertions(+), 397 deletions(-) delete mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index 25a44abfded..9cad9e2fe04 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -712,13 +712,6 @@ static bool proxy_adv_request_get(struct bt_mesh_subnet *sub, struct proxy_adv_r return false; } - /** The priority for proxy adv is first solicitation, then Node Identity, - * and lastly Network ID. Network ID is prioritized last since, in many - * cases, another device can fulfill the same demand. Solicitation is - * prioritized first since legacy devices are dependent on this to - * connect to the network. - */ - #if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) if (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited) { int32_t timeout = MSEC_PER_SEC * (int32_t)bt_mesh_od_priv_proxy_get(); @@ -760,7 +753,7 @@ static bool proxy_adv_request_get(struct bt_mesh_subnet *sub, struct proxy_adv_r static struct bt_mesh_subnet *adv_sub_get_next(struct bt_mesh_subnet *sub_start, struct proxy_adv_request *request) { - struct bt_mesh_subnet *sub_temp = bt_mesh_subnet_next(sub_start); + struct bt_mesh_subnet *sub_temp = sub_start; do { if (proxy_adv_request_get(sub_temp, request)) { @@ -830,7 +823,7 @@ static int gatt_proxy_advertise(void) } } - sub = adv_sub_get_next(sub_adv.sub, &request); + sub = adv_sub_get_next(bt_mesh_subnet_next(sub_adv.sub), &request); if (!sub) { LOG_ERR("Could not find subnet to advertise"); return -ENOENT; diff --git a/tests/bsim/bluetooth/mesh/overlay_gatt.conf b/tests/bsim/bluetooth/mesh/overlay_gatt.conf index 7660313b700..f94a26d623f 100644 --- a/tests/bsim/bluetooth/mesh/overlay_gatt.conf +++ b/tests/bsim/bluetooth/mesh/overlay_gatt.conf @@ -6,4 +6,3 @@ CONFIG_BT_MESH_LOW_POWER=n CONFIG_BT_MESH_FRIEND=n CONFIG_BT_CENTRAL=y CONFIG_BT_MESH_PROXY_CLIENT=y -CONFIG_BT_MESH_PROXY_SOLICITATION=y diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index e5f7d515da7..f9230a397a9 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -31,7 +31,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL_INF); #define BEACON_TYPE_PRIVATE 0x02 #endif -static uint8_t test_net_key_2[16] = { 0xca, 0x11, 0xab, 0x1e }; +static uint8_t test_net_key_secondary[16] = { 0xca, 0x11, 0xab, 0x1e }; static struct { uint8_t primary[16]; uint8_t secondary[16]; @@ -334,7 +334,6 @@ static struct { uint8_t random[13]; uint64_t pp_hash; uint64_t pp_random; - uint64_t net_id; bt_addr_le_t adv_addr; #endif bool (*process_cb)(const uint8_t *net_id, void *ctx); @@ -626,7 +625,7 @@ static void test_tx_kr_old_key(void) * the new Net Key. The node shall set Key Refresh phase to 2. The beacon interval shall * be increased. */ - beacon_create(&buf, test_net_key_2, 0x03, 0x0001); + beacon_create(&buf, test_net_key_secondary, 0x03, 0x0001); send_beacon(&buf); ASSERT_FALSE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); ASSERT_TRUE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); @@ -646,7 +645,7 @@ static void test_tx_kr_old_key(void) /* Try the same with the new Net Key. Now the node shall change Key Refresh phase to 0. The * beacon interval shall be increased. */ - beacon_create(&buf, test_net_key_2, 0x02, 0x0001); + beacon_create(&buf, test_net_key_secondary, 0x02, 0x0001); send_beacon(&buf); ASSERT_FALSE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); ASSERT_TRUE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); @@ -666,7 +665,7 @@ static void test_tx_kr_old_key(void) /* Do the same, but secure beacon with the new Net Key. Now the node shall change IV Update * flag to 0. The beacon interval shall be increased. */ - beacon_create(&buf, test_net_key_2, 0x00, 0x0001); + beacon_create(&buf, test_net_key_secondary, 0x00, 0x0001); send_beacon(&buf); ASSERT_FALSE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); ASSERT_TRUE(wait_for_beacon(beacon_scan_cb, BEACON_INTERVAL + 1, NULL, NULL)); @@ -687,7 +686,7 @@ static void test_rx_kr_old_key(void) bt_mesh_test_setup(); bt_mesh_iv_update_test(true); - err = bt_mesh_cfg_cli_net_key_update(0, cfg->addr, 0, test_net_key_2, &status); + err = bt_mesh_cfg_cli_net_key_update(0, cfg->addr, 0, test_net_key_secondary, &status); if (err || status) { FAIL("Net Key update failed (err %d, status %u)", err, status); } @@ -1542,73 +1541,60 @@ static void test_tx_priv_beacon_cache(void) #if IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY) -static uint8_t test_net_key_3[16] = {0x12, 0x54, 0xab, 0x1e}; - -#define UNTIL_UPTIME(time) (k_uptime_get() > (time) ? K_NO_WAIT : K_MSEC((time) - k_uptime_get())) -#define BEACON_TYPE_NET_ID 0 -#define BEACON_TYPE_NODE_ID 1 #define BEACON_TYPE_PRIVATE_NET_ID 2 #define BEACON_TYPE_PRIVATE_NODE_ID 3 #define BEACON_TYPE_PRIVATE_LEN 28 #define TEST_NET_IDX1 0 #define TEST_NET_IDX2 1 -#define TEST_NET_IDX3 2 #define MAX_TIMEOUT ((CONFIG_BT_MESH_NODE_ID_TIMEOUT * 1000) / 6) #define PP_NET_ID_WAIT_TIME 610 /*seconds*/ #define PP_NODE_ID_WAIT_TIME 80 /*seconds*/ #define PP_MULT_NET_ID_WAIT_TIME 50 /*seconds*/ -#define PROXY_ADV_MULTI_SUBNET_COEX_WAIT_TIME 151 /*seconds*/ -struct netkey_ctx { +struct pp_netkey_ctx { uint8_t *net_key; uint8_t net_id[8]; - uint8_t net_idx; struct bt_mesh_key id_key; }; -static struct netkey_ctx pp_net0 = {.net_key = (uint8_t *)test_net_key, .net_idx = 0}; -static struct netkey_ctx pp_net1 = {.net_key = (uint8_t *)test_net_key_2, .net_idx = 1}; -static struct netkey_ctx pp_net2 = {.net_key = (uint8_t *)test_net_key_3, .net_idx = 2}; +static struct pp_netkey_ctx pp_net0 = {.net_key = (uint8_t *)test_net_key}; +static struct pp_netkey_ctx pp_net1 = {.net_key = (uint8_t *)test_net_key_secondary}; struct priv_test_ctx { uint8_t beacon_type; uint16_t *node_id_addr; }; -static void pp_netkey_ctx_init(struct netkey_ctx *net) +static void pp_netkey_ctx_init(struct pp_netkey_ctx *net) { ASSERT_OK_MSG(bt_mesh_identity_key(net->net_key, &net->id_key), "Failed to generate ID key"); ASSERT_OK_MSG(bt_mesh_k3(net->net_key, net->net_id), "Failed to generate Net ID"); } -static uint8_t proxy_adv_type_get(uint8_t adv_type, struct net_buf_simple *buf) +static bool pp_type_check(uint16_t expected_beacon, uint8_t adv_type, struct net_buf_simple *buf) { - uint8_t type; - uint8_t len = buf->len; - - if (adv_type != BT_GAP_ADV_TYPE_ADV_IND || len < 12) { - return 0xFF; + if (adv_type != BT_GAP_ADV_TYPE_ADV_IND || buf->len != BEACON_TYPE_PRIVATE_LEN) { + return false; } + /* Remove Header */ (void)net_buf_simple_pull_mem(buf, 11); - type = net_buf_simple_pull_u8(buf); - /* BEACON_TYPE_NET_ID is 20 bytes long, while the three other accepted types are 28 bytes*/ - if (len != ((type == BEACON_TYPE_NET_ID) ? 20 : 28)) { - return 0xFF; + + uint8_t beacon_type = net_buf_simple_pull_u8(buf); + + if (beacon_type != expected_beacon) { + return false; } - return type; + return true; } -static uint64_t proxy_adv_hash_calc(struct netkey_ctx *net, uint64_t random, uint16_t *addr, - bool is_priv) +static uint64_t pp_hash_calc(struct pp_netkey_ctx *net, uint64_t random, uint16_t *addr) { uint64_t hash; - uint8_t tmp[16] = {0}; - - tmp[5] = is_priv ? 3 : 0; + uint8_t tmp[16] = {0, 0, 0, 0, 0, 3}; if (addr) { memcpy(&tmp[6], &random, 8); @@ -1630,7 +1616,7 @@ static bool pp_beacon_check(const uint8_t *net_id, void *ctx) struct priv_test_ctx *test_ctx = (struct priv_test_ctx *)ctx; ASSERT_EQUAL(beacon.pp_hash, - proxy_adv_hash_calc(&pp_net0, beacon.pp_random, test_ctx->node_id_addr, true)); + pp_hash_calc(&pp_net0, beacon.pp_random, test_ctx->node_id_addr)); if (memcmp(beacon.adv_addr.a.val, last_beacon_adv_addr.a.val, BT_ADDR_SIZE) == 0) { return false; @@ -1646,58 +1632,15 @@ static void priv_scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type { struct priv_test_ctx *ctx = (struct priv_test_ctx *)beacon.user_ctx; - if (proxy_adv_type_get(adv_type, buf) != ctx->beacon_type) { + if (!pp_type_check(ctx->beacon_type, adv_type, buf)) { /* Wrong message type */ return; } bt_addr_le_copy(&beacon.adv_addr, addr); - if (ctx->beacon_type == BEACON_TYPE_NET_ID) { - beacon.net_id = net_buf_simple_pull_le64(buf); - } else { - beacon.pp_hash = net_buf_simple_pull_le64(buf); - beacon.pp_random = net_buf_simple_pull_le64(buf); - } - - if (!beacon.process_cb || beacon.process_cb(NULL, beacon.user_ctx)) { - k_sem_give(&observer_sem); - } -} - -struct proxy_adv_beacon { - uint8_t evt_type; - uint8_t net_idx; - int64_t rx_timestamp; - union { - uint64_t net_id; - struct { - uint64_t hash; - uint64_t random; - } enc; - } ctx; -}; - -static void proxy_adv_scan_all_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type, - struct net_buf_simple *buf) -{ - struct proxy_adv_beacon *beac = (struct proxy_adv_beacon *)beacon.user_ctx; - - beac->evt_type = proxy_adv_type_get(adv_type, buf); - if (beac->evt_type == 0xFF) { - /* Not a related beacon type */ - return; - } - - bt_addr_le_copy(&beacon.adv_addr, addr); - beac->rx_timestamp = k_uptime_get(); - - if (beac->evt_type == BEACON_TYPE_NET_ID) { - beac->ctx.net_id = net_buf_simple_pull_le64(buf); - } else { - beac->ctx.enc.hash = net_buf_simple_pull_le64(buf); - beac->ctx.enc.random = net_buf_simple_pull_le64(buf); - } + beacon.pp_hash = net_buf_simple_pull_le64(buf); + beacon.pp_random = net_buf_simple_pull_le64(buf); if (!beacon.process_cb || beacon.process_cb(NULL, beacon.user_ctx)) { k_sem_give(&observer_sem); @@ -1713,11 +1656,11 @@ static void rx_priv_common_init(uint16_t wait) ASSERT_OK_MSG(bt_enable(NULL), "Bluetooth init failed"); } -static void tx_proxy_adv_common_init(uint16_t wait, const struct bt_mesh_test_cfg *cfg) +static void tx_priv_common_init(uint16_t wait) { bt_mesh_test_cfg_set(NULL, wait); bt_mesh_device_setup(&prov, &prb_comp); - provision(cfg); + provision(&tx_cfg); /* Disable GATT proxy */ ASSERT_OK_MSG(bt_mesh_gatt_proxy_set(BT_MESH_GATT_PROXY_DISABLED), @@ -1726,7 +1669,7 @@ static void tx_proxy_adv_common_init(uint16_t wait, const struct bt_mesh_test_cf static void test_tx_priv_net_id(void) { - tx_proxy_adv_common_init(PP_NET_ID_WAIT_TIME, &tx_cfg); + tx_priv_common_init(PP_NET_ID_WAIT_TIME); /* Enable private GATT proxy */ ASSERT_OK_MSG(bt_mesh_priv_gatt_proxy_set(BT_MESH_GATT_PROXY_ENABLED), @@ -1765,7 +1708,7 @@ static void test_tx_priv_node_id(void) { enum bt_mesh_feat_state state; - tx_proxy_adv_common_init(PP_NODE_ID_WAIT_TIME, &tx_cfg); + tx_priv_common_init(PP_NODE_ID_WAIT_TIME); /* Start first node advertisement */ ASSERT_OK_MSG(bt_mesh_subnet_priv_node_id_set(TEST_NET_IDX1, BT_MESH_NODE_IDENTITY_RUNNING), @@ -1818,10 +1761,10 @@ static void test_rx_priv_node_id(void) static void test_tx_priv_multi_net_id(void) { - tx_proxy_adv_common_init(PP_MULT_NET_ID_WAIT_TIME, &tx_cfg); + tx_priv_common_init(PP_MULT_NET_ID_WAIT_TIME); /* Add second network */ - ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_2), + ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_secondary), "Failed to add second subnet"); /* Enable private GATT proxy */ @@ -1831,246 +1774,6 @@ static void test_tx_priv_multi_net_id(void) PASS(); } -static void proxy_adv_subnet_find(struct proxy_adv_beacon *beac, struct netkey_ctx **nets, - uint8_t net_cnt) -{ - for (size_t i = 0; i < net_cnt; i++) { - - switch (beac->evt_type) { - case BEACON_TYPE_NET_ID: - if (!memcmp(nets[i]->net_id, &beac->ctx.net_id, 8)) { - beac->net_idx = nets[i]->net_idx; - return; - } - break; - case BEACON_TYPE_NODE_ID: - if (beac->ctx.enc.hash == - proxy_adv_hash_calc(nets[i], beac->ctx.enc.random, - (uint16_t *)&tx_cfg.addr, false)) { - beac->net_idx = nets[i]->net_idx; - return; - } - break; - case BEACON_TYPE_PRIVATE_NET_ID: - if (beac->ctx.enc.hash == - proxy_adv_hash_calc(nets[i], beac->ctx.enc.random, - NULL, true)) { - beac->net_idx = nets[i]->net_idx; - return; - } - break; - case BEACON_TYPE_PRIVATE_NODE_ID: - if (beac->ctx.enc.hash == - proxy_adv_hash_calc(nets[i], beac->ctx.enc.random, - (uint16_t *)&tx_cfg.addr, true)) { - beac->net_idx = nets[i]->net_idx; - return; - } - break; - - default: - FAIL("Unexpected beacon type"); - break; - } - } - - FAIL("Could not find matching subnet for incoming proxy adv beacon"); -} - -static const char *const proxy_adv_str[] = {"Net_ID", "Node_ID", "Priv_Net_ID", "Priv_Node_ID"}; -struct expected_proxy_adv_evt { - uint8_t evt_type; - uint8_t net_idx; - uint16_t evt_cnt; - struct { - int64_t after; - int64_t before; - } time; -}; - -static void proxy_adv_register_evt(struct proxy_adv_beacon *beac, - struct expected_proxy_adv_evt *exp_evts, uint8_t cnt) -{ - for (int i = 0; i < cnt; i++) { - if ((exp_evts[i].evt_cnt) && (beac->evt_type == exp_evts[i].evt_type) && - (beac->net_idx == exp_evts[i].net_idx) && - (beac->rx_timestamp >= exp_evts[i].time.after) && - (beac->rx_timestamp <= exp_evts[i].time.before)) { - exp_evts[i].evt_cnt--; - } - } -} - -static void proxy_adv_confirm_evt(struct expected_proxy_adv_evt *exp_evts, uint8_t cnt) -{ - bool missing_evts = false; - - for (int i = 0; i < cnt; i++) { - if (exp_evts[i].evt_cnt) { - LOG_ERR("Missing %d expected %s events in period %llums-%llums", - exp_evts[i].evt_cnt, proxy_adv_str[exp_evts[i].evt_type], - exp_evts[i].time.after, exp_evts[i].time.before); - missing_evts = true; - } - } - - if (missing_evts) { - FAIL("Test failed due to missing events"); - } -} - -static void proxy_adv_scan_all(struct netkey_ctx **nets, uint16_t net_cnt, - struct expected_proxy_adv_evt *exp_evt, uint16_t exp_evt_cnt, - int64_t timeout) -{ - struct proxy_adv_beacon beac; - - while (k_uptime_get() < timeout) { - - ASSERT_TRUE(wait_for_beacon(proxy_adv_scan_all_cb, 2, NULL, &beac)); - proxy_adv_subnet_find(&beac, nets, net_cnt); - proxy_adv_register_evt(&beac, exp_evt, exp_evt_cnt); - - /** We want to monitor an even distribution of adv events. - * To ensure this, we wait a little less than the minimum - * proxy adv period (1 second) before scanning for the next - * evt. - */ - k_sleep(K_MSEC(990)); - } - - proxy_adv_confirm_evt(exp_evt, exp_evt_cnt); -} - -#define PROXY_ADV_MULTI_CHECKPOINT_1 20000 -#define PROXY_ADV_MULTI_CHECKPOINT_2 50000 -#define PROXY_ADV_MULTI_CHECKPOINT_3 110000 -#define PROXY_ADV_MULTI_CHECKPOINT_4 130000 -#define PROXY_ADV_MULTI_CHECKPOINT_END 150000 - -static void test_tx_proxy_adv_multi_subnet_coex(void) -{ - tx_proxy_adv_common_init(PROXY_ADV_MULTI_SUBNET_COEX_WAIT_TIME, &tx_cfg); - - /* Enable GATT proxy */ - ASSERT_OK_MSG(bt_mesh_gatt_proxy_set(BT_MESH_GATT_PROXY_ENABLED), - "Failed to Enable gatt proxy"); - - k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_1)); - /* Add second and third network */ - ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_2), - "Failed to add second subnet"); - ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX3, test_net_key_3), - "Failed to add third subnet"); - - k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_2)); - /* Start Node Identity on second network */ - bt_mesh_proxy_identity_start(bt_mesh_subnet_get(TEST_NET_IDX2), false); - - k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_3)); - /* Prepare for solicitation */ - ASSERT_OK_MSG(bt_mesh_gatt_proxy_set(BT_MESH_GATT_PROXY_DISABLED), - "Failed to Enable gatt proxy"); - ASSERT_OK_MSG(bt_mesh_od_priv_proxy_set(20), "Failed to set OD priv proxy state"); - - k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_4)); - /* Re-enable GATT proxy and remove second and third network */ - ASSERT_OK_MSG(bt_mesh_gatt_proxy_set(BT_MESH_GATT_PROXY_ENABLED), - "Failed to Enable gatt proxy"); - ASSERT_OK_MSG(bt_mesh_subnet_del(TEST_NET_IDX2), "Failed to delete subnet"); - ASSERT_OK_MSG(bt_mesh_subnet_del(TEST_NET_IDX3), "Failed to delete subnet"); - - PASS(); -} - -static const struct bt_mesh_test_cfg solicit_trigger_cfg = { - .addr = 0x0003, - .dev_key = { 0x03 }, -}; - -static void test_tx_proxy_adv_solicit_trigger(void) -{ - tx_proxy_adv_common_init(PROXY_ADV_MULTI_SUBNET_COEX_WAIT_TIME, &solicit_trigger_cfg); - ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_2), - "Failed to add second subnet"); - - k_sleep(UNTIL_UPTIME(PROXY_ADV_MULTI_CHECKPOINT_3)); - - /* Solicit first and second network */ - ASSERT_OK_MSG(bt_mesh_proxy_solicit(TEST_NET_IDX1), - "Failed to start solicitation"); - ASSERT_OK_MSG(bt_mesh_proxy_solicit(TEST_NET_IDX2), - "Failed to start solicitation"); - - PASS(); -} - -static void test_rx_proxy_adv_multi_subnet_coex(void) -{ - rx_priv_common_init(PROXY_ADV_MULTI_SUBNET_COEX_WAIT_TIME); - pp_netkey_ctx_init(&pp_net1); - pp_netkey_ctx_init(&pp_net2); - - struct netkey_ctx *nets[] = {&pp_net0, &pp_net1, &pp_net2}; - struct expected_proxy_adv_evt exp_evt[] = { - /** A single subnet is active on the device with GATT Proxy - * enabled. Verify that the single subnet has exclusive - * access to the adv medium. - */ - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 19, - .time = {.after = 0, .before = PROXY_ADV_MULTI_CHECKPOINT_1}}, - - /** Two additional subnets are added to the device. - * Check that the subnets are sharing the adv medium, - * advertising NET_ID beacons. - */ - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 8, - .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_1, - .before = PROXY_ADV_MULTI_CHECKPOINT_2}}, - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 1, .evt_cnt = 8, - .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_1, - .before = PROXY_ADV_MULTI_CHECKPOINT_2}}, - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 8, - .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_1, - .before = PROXY_ADV_MULTI_CHECKPOINT_2}}, - - /** The second subnet enables Node Identity. Check that NODE_ID - * is advertised by this subnet, and that the two others - * continues to advertise NET_ID. - */ - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 17, - .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, - .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, - {.evt_type = BEACON_TYPE_NODE_ID, .net_idx = 1, .evt_cnt = 17, - .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, - .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 17, - .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_2, - .before = PROXY_ADV_MULTI_CHECKPOINT_3}}, - - /** The first and second subnet gets solicited. Check that - * PRIVATE_NET_ID is advertised by these subnet, - */ - {.evt_type = BEACON_TYPE_PRIVATE_NET_ID, .net_idx = 0, .evt_cnt = 9, - .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_3, - .before = PROXY_ADV_MULTI_CHECKPOINT_4}}, - {.evt_type = BEACON_TYPE_PRIVATE_NET_ID, .net_idx = 1, .evt_cnt = 9, - .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_3, - .before = PROXY_ADV_MULTI_CHECKPOINT_4}}, - - /** Second and third subnet are disabled. Verify that the single - * subnet has exclusive access to the adv medium. - */ - {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 0, .evt_cnt = 19, - .time = {.after = PROXY_ADV_MULTI_CHECKPOINT_4, - .before = PROXY_ADV_MULTI_CHECKPOINT_END}}, - }; - - proxy_adv_scan_all(nets, ARRAY_SIZE(nets), exp_evt, ARRAY_SIZE(exp_evt), - PROXY_ADV_MULTI_CHECKPOINT_END); - PASS(); -} - static void test_rx_priv_multi_net_id(void) { rx_priv_common_init(PP_MULT_NET_ID_WAIT_TIME); @@ -2084,7 +1787,7 @@ static void test_rx_priv_multi_net_id(void) uint16_t itr = 4; static uint8_t old_idx = 0xff; static struct { - struct netkey_ctx *net; + struct pp_netkey_ctx *net; uint16_t recv_cnt; int64_t start; } net_ctx[2] = { @@ -2099,7 +1802,7 @@ static void test_rx_priv_multi_net_id(void) for (size_t i = 0; i < ARRAY_SIZE(net_ctx); i++) { if (beacon.pp_hash == - proxy_adv_hash_calc(net_ctx[i].net, beacon.pp_random, NULL, true)) { + pp_hash_calc(net_ctx[i].net, beacon.pp_random, NULL)) { if (old_idx == 0xff) { /* Received first Net ID advertisment */ old_idx = i; @@ -2228,8 +1931,6 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(tx, priv_node_id, "Private Proxy: advertise Node ID"), TEST_CASE(tx, priv_multi_net_id, "Private Proxy: advertise multiple Net ID"), TEST_CASE(tx, priv_gatt_proxy, "Private Proxy: Send Private Beacons over GATT"), - TEST_CASE(tx, proxy_adv_multi_subnet_coex, "Proxy Adv: Multi subnet coex proxy adv"), - TEST_CASE(tx, proxy_adv_solicit_trigger, "Proxy Adv: Trigger Solicitation"), #endif #endif @@ -2250,7 +1951,6 @@ static const struct bst_test_instance test_beacon[] = { TEST_CASE(rx, priv_node_id, "Private Proxy: scan for Node ID"), TEST_CASE(rx, priv_multi_net_id, "Private Proxy: scan for multiple Net ID"), TEST_CASE(rx, priv_gatt_proxy, "Private Proxy: Receive Private Beacons over GATT"), - TEST_CASE(rx, proxy_adv_multi_subnet_coex, "Proxy Adv: Multi subnet coex proxy adv"), #endif #endif BSTEST_END_MARKER diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh b/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh deleted file mode 100755 index aa96ee325d8..00000000000 --- a/tests/bsim/bluetooth/mesh/tests_scripts/priv_beacon/proxy_adv_multi_subnet_coex.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh - -# Test Proxy advertisement Coex - -# This test verifies correct Proxy advertisement behavior for a device -# where the Proxy adv requirements changes over time, both for single -# and multiple subnets. The TX device is the DUT in this instance, while -# the RX device scans and verifies that the correct proxy adv messages of -# the different subnets is sent within the expected time delta. - -# Note 1: The maximum allowed timeslot for a subnet to advertise proxy -# in this scenario is 10 seconds when there is more than one subnet that -# has active proxy adv work. This is reflected in the scanning criteria -# on the RX device. - -# Note 2: The expected message received count for each event is based on -# what would be a reasonable/acceptable to receive within a given time -# window. The Mesh Protocol specification does not specify exactly the -# timing for Proxy ADV messages. - -# Test procedure: -# 1. (0-20 seconds) A single subnet is active on the TX device with GATT -# Proxy enabled. RX device verifies that the single subnet has exclusive -# access to the adv medium. -# 2. (20-50 seconds) Two additional subnets are added to the TX device. RX -# device checks that the subnets are sharing the adv medium, advertising -# NET_ID beacons. -# 3. (50-110 seconds) The second subnet enables Node Identity. RX device -# checks that NODE_ID is advertised by this subnet, and that the two -# others continues to advertise NET_ID. -# 4. (110-130 seconds) The first and second subnet gets solicited. RX device -# checks that PRIVATE_NET_ID is advertised by these subnets. -# 5. (130-150 seconds) The second and third subnet are disabled on the TX -# device. RX device verifies that the single subnet has exclusive access -# to the adv medium again. - - -conf=prj_mesh1d1_conf -overlay=overlay_gatt_conf -RunTest proxy_adv_multi_subnet_coex \ - beacon_tx_proxy_adv_multi_subnet_coex \ - beacon_rx_proxy_adv_multi_subnet_coex \ - beacon_tx_proxy_adv_solicit_trigger - -conf=prj_mesh1d1_conf -overlay=overlay_gatt_conf_overlay_psa_conf -RunTest proxy_adv_multi_subnet_coex \ - beacon_tx_proxy_adv_multi_subnet_coex \ - beacon_rx_proxy_adv_multi_subnet_coex \ - beacon_tx_proxy_adv_solicit_trigger From 8dba50406259bd4e7d2384e175b0ef6005a4869e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:10 +0100 Subject: [PATCH 1271/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Refactor proxy adv" This reverts commit 0a6a7acb7ccfe8e0fae7233e9563d866a806775b. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/proxy_srv.c | 332 +++++++++----------- tests/bsim/bluetooth/mesh/src/test_beacon.c | 10 +- 2 files changed, 152 insertions(+), 190 deletions(-) diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index 9cad9e2fe04..45e29915325 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -625,7 +625,7 @@ static int net_id_adv(struct bt_mesh_subnet *sub, int32_t duration) return 0; } -static bool is_sub_proxy_active(struct bt_mesh_subnet *sub) +static bool advertise_subnet(struct bt_mesh_subnet *sub) { if (sub->net_idx == BT_MESH_KEY_UNUSED) { return false; @@ -633,245 +633,201 @@ static bool is_sub_proxy_active(struct bt_mesh_subnet *sub) return (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING || #if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) - (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited) || + sub->solicited || #endif bt_mesh_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED || bt_mesh_priv_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED); } -static bool active_proxy_sub_cnt_cb(struct bt_mesh_subnet *sub, void *cb_data) +static struct bt_mesh_subnet *next_sub(void) { - int *cnt = cb_data; + struct bt_mesh_subnet *sub = NULL; - if (is_sub_proxy_active(sub)) { - (*cnt)++; - } - - /* Don't stop until we've visited all subnets. - * We're only using the "find" variant of the subnet iteration to get a context parameter. - */ - return false; -} - -static int active_proxy_sub_cnt_get(void) -{ - int cnt = 0; - - (void)bt_mesh_subnet_find(active_proxy_sub_cnt_cb, &cnt); - - return cnt; -} - -static void proxy_adv_timeout_eval(struct bt_mesh_subnet *sub) -{ - int32_t time_passed; - - if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) { - time_passed = k_uptime_get_32() - sub->node_id_start; - if (time_passed > (NODE_ID_TIMEOUT - MSEC_PER_SEC)) { - bt_mesh_proxy_identity_stop(sub); - LOG_DBG("Node ID stopped for subnet %d after %dms", sub->net_idx, - time_passed); + if (!beacon_sub) { + beacon_sub = bt_mesh_subnet_next(NULL); + if (!beacon_sub) { + /* No valid subnets */ + return NULL; } } -#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) - if (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited && sub->priv_net_id_sent) { - time_passed = k_uptime_get_32() - sub->priv_net_id_sent; - if (time_passed > ((MSEC_PER_SEC * bt_mesh_od_priv_proxy_get()) - MSEC_PER_SEC)) { - sub->priv_net_id_sent = 0; - sub->solicited = false; - LOG_DBG("Private Network ID stopped for subnet %d after %dms on " - "solicitation", - sub->net_idx, time_passed); + sub = beacon_sub; + do { + if (advertise_subnet(sub)) { + beacon_sub = sub; + return sub; } - } -#endif -} -enum proxy_adv_evt { - NET_ID, - PRIV_NET_ID, - NODE_ID, - PRIV_NODE_ID, - OD_PRIV_NET_ID, -}; + sub = bt_mesh_subnet_next(sub); + } while (sub != beacon_sub); -struct proxy_adv_request { - int32_t duration; - enum proxy_adv_evt evt; -}; + /* No subnets to advertise on */ + return NULL; +} -static bool proxy_adv_request_get(struct bt_mesh_subnet *sub, struct proxy_adv_request *request) +static bool sub_count_cb(struct bt_mesh_subnet *sub, void *cb_data) { - if (!sub) { - return false; - } + int *count = cb_data; - if (sub->net_idx == BT_MESH_KEY_UNUSED) { - return false; + if (advertise_subnet(sub)) { + (*count)++; } -#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) - if (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited) { - int32_t timeout = MSEC_PER_SEC * (int32_t)bt_mesh_od_priv_proxy_get(); - - request->evt = OD_PRIV_NET_ID; - request->duration = !sub->priv_net_id_sent - ? timeout - : timeout - (k_uptime_get_32() - sub->priv_net_id_sent); - return true; - } -#endif - - if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) { - request->duration = NODE_ID_TIMEOUT - (k_uptime_get_32() - sub->node_id_start); - request->evt = -#if defined(CONFIG_BT_MESH_PRIV_BEACONS) - sub->priv_beacon_ctx.node_id ? PRIV_NODE_ID : -#endif - NODE_ID; - - return true; - } + /* Don't stop until we've visited all subnets. + * We're only using the "find" variant of the subnet iteration to get a context parameter. + */ + return false; +} - if (bt_mesh_priv_gatt_proxy_get() == BT_MESH_FEATURE_ENABLED) { - request->evt = PRIV_NET_ID; - request->duration = PROXY_RANDOM_UPDATE_INTERVAL; - return true; - } +static int sub_count(void) +{ + int count = 0; - if (bt_mesh_gatt_proxy_get() == BT_MESH_FEATURE_ENABLED) { - request->evt = NET_ID; - request->duration = SYS_FOREVER_MS; - return true; - } + (void)bt_mesh_subnet_find(sub_count_cb, &count); - return false; + return count; } -static struct bt_mesh_subnet *adv_sub_get_next(struct bt_mesh_subnet *sub_start, - struct proxy_adv_request *request) +#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) +static void gatt_proxy_solicited(struct bt_mesh_subnet *sub) { - struct bt_mesh_subnet *sub_temp = sub_start; - - do { - if (proxy_adv_request_get(sub_temp, request)) { - return sub_temp; - } + int64_t now = k_uptime_get(); + int64_t timeout = 0; + int32_t remaining; + + if (sub->priv_net_id_sent > 0) { + timeout = sub->priv_net_id_sent + + MSEC_PER_SEC * (int64_t) bt_mesh_od_priv_proxy_get(); + remaining = MIN(timeout - now, INT32_MAX); + } else { + remaining = MSEC_PER_SEC * bt_mesh_od_priv_proxy_get(); + } - sub_temp = bt_mesh_subnet_next(sub_temp); - } while (sub_temp != sub_start); + if ((timeout > 0 && now > timeout) || (remaining / MSEC_PER_SEC < 1)) { + LOG_DBG("Advertising Private Network ID timed out " + "after solicitation"); + sub->priv_net_id_sent = 0; + sub->solicited = false; + } else { + LOG_DBG("Advertising Private Network ID for %ds" + "(%d remaining)", + bt_mesh_od_priv_proxy_get(), + remaining / MSEC_PER_SEC); + priv_net_id_adv(sub, remaining); - return NULL; + if (!sub->priv_net_id_sent) { + sub->priv_net_id_sent = now; + } + } } +#endif -static struct { - int32_t start; - struct bt_mesh_subnet *sub; - struct proxy_adv_request request; -} sub_adv; - -static int gatt_proxy_advertise(void) +static int gatt_proxy_advertise(struct bt_mesh_subnet *sub) { - int err; - - int32_t max_adv_duration; - int cnt; - struct bt_mesh_subnet *sub; - struct proxy_adv_request request; + int32_t remaining = SYS_FOREVER_MS; + int subnet_count; + int err = -EBUSY; + bool planned = false; LOG_DBG(""); - /* Close proxy activity that has timed out on all subnets */ - bt_mesh_subnet_foreach(proxy_adv_timeout_eval); - if (!bt_mesh_proxy_has_avail_conn()) { LOG_DBG("Connectable advertising deferred (max connections)"); return -ENOMEM; } - cnt = active_proxy_sub_cnt_get(); - if (!cnt) { - LOG_DBG("No subnets to advertise proxy on"); + sub = beacon_sub ? beacon_sub : bt_mesh_subnet_next(beacon_sub); + if (!sub) { + LOG_WRN("No subnets to advertise on"); return -ENOENT; - } else if (cnt > 1) { - /** There is more than one subnet that requires proxy adv, - * and the adv resources must be shared. - */ + } + + subnet_count = sub_count(); + LOG_DBG("sub_count %u", subnet_count); + if (subnet_count > 1) { + int32_t max_timeout; /* We use NODE_ID_TIMEOUT as a starting point since it may * be less than 60 seconds. Divide this period into at least - * 6 slices, but make sure that a slice is more than one + * 6 slices, but make sure that a slice is at least one * second long (to avoid excessive rotation). */ - max_adv_duration = NODE_ID_TIMEOUT / MAX(cnt, 6); - max_adv_duration = MAX(max_adv_duration, MSEC_PER_SEC + 20); - - /* Check if the previous subnet finished its allocated timeslot */ - if ((sub_adv.request.duration != SYS_FOREVER_MS) && - proxy_adv_request_get(sub_adv.sub, &request) && - (sub_adv.request.evt == request.evt)) { - int32_t time_passed = k_uptime_get_32() - sub_adv.start; - - if (time_passed < sub_adv.request.duration && - ((sub_adv.request.duration - time_passed) >= MSEC_PER_SEC)) { - sub = sub_adv.sub; - request.duration = sub_adv.request.duration - time_passed; - goto end; - } + max_timeout = NODE_ID_TIMEOUT / MAX(subnet_count, 6); + max_timeout = MAX(max_timeout, 1 * MSEC_PER_SEC); + + if (remaining > max_timeout || remaining == SYS_FOREVER_MS) { + remaining = max_timeout; } } - sub = adv_sub_get_next(bt_mesh_subnet_next(sub_adv.sub), &request); - if (!sub) { - LOG_ERR("Could not find subnet to advertise"); - return -ENOENT; - } -end: - if (cnt > 1) { - request.duration = (request.duration == SYS_FOREVER_MS) - ? max_adv_duration - : MIN(request.duration, max_adv_duration); - } + for (int i = 0; i < subnet_count; i++) { - /* Save current state for next iteration */ - sub_adv.start = k_uptime_get_32(); - sub_adv.sub = sub; - sub_adv.request = request; + if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) { + uint32_t active = k_uptime_get_32() - sub->node_id_start; + bool priv_node_id = false; - switch (request.evt) { - case NET_ID: - err = net_id_adv(sub, request.duration); - break; -#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) - case OD_PRIV_NET_ID: - if (!sub->priv_net_id_sent) { - sub->priv_net_id_sent = k_uptime_get(); + if (active < NODE_ID_TIMEOUT) { + remaining = MIN(remaining, NODE_ID_TIMEOUT - active); + LOG_DBG("Node ID active for %u ms, %d ms remaining", + active, remaining); +#if defined(CONFIG_BT_MESH_PRIV_BEACONS) + priv_node_id = sub->priv_beacon_ctx.node_id; +#endif + if (priv_node_id) { + err = priv_node_id_adv(sub, remaining); + } else { + err = node_id_adv(sub, remaining); + } + planned = true; + } else { + bt_mesh_proxy_identity_stop(sub); + LOG_DBG("Node ID stopped"); + } } - /* Fall through */ + + /* MshPRTv1.1: section 7.2.2.2.1: + * "A node that does not support the Proxy feature or + * has the GATT Proxy state disabled shall not advertise with Network ID." + */ + if (sub->node_id == BT_MESH_NODE_IDENTITY_STOPPED) { + if (IS_ENABLED(CONFIG_BT_MESH_PRIV_BEACONS) && + (bt_mesh_priv_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED)) { + /* MshPRTv1.1: 7.2.2.2.4: The Random + * field should be updated every 10 minutes. Limit advertising to + * 10 minutes to ensure regeneration of a new random value at least + * that often. + */ + if (remaining == SYS_FOREVER_MS || + remaining > PROXY_RANDOM_UPDATE_INTERVAL) { + remaining = PROXY_RANDOM_UPDATE_INTERVAL; + } + + err = priv_net_id_adv(sub, remaining); + planned = true; + } else if (bt_mesh_gatt_proxy_get() == BT_MESH_FEATURE_ENABLED) { + err = net_id_adv(sub, remaining); + planned = true; + } + +#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_SRV) + else if (bt_mesh_od_priv_proxy_get() > 0 && + sub->solicited) { + gatt_proxy_solicited(sub); + } #endif - case PRIV_NET_ID: - err = priv_net_id_adv(sub, request.duration); - break; - case NODE_ID: - err = node_id_adv(sub, request.duration); - break; - case PRIV_NODE_ID: - err = priv_node_id_adv(sub, request.duration); - break; - default: - LOG_ERR("Unexpected proxy adv evt: %d", request.evt); - return -ENODEV; - } + } - if (err) { - LOG_ERR("Advertising proxy failed (err: %d)", err); - return err; + beacon_sub = bt_mesh_subnet_next(sub); + + if (planned) { + LOG_DBG("Advertising %d ms for net_idx 0x%04x", remaining, sub->net_idx); + return err; + } + + sub = beacon_sub; } - LOG_DBG("Advertising %d ms for net_idx 0x%04x", request.duration, sub->net_idx); - return err; + return 0; } static void subnet_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt) @@ -1196,7 +1152,7 @@ int bt_mesh_proxy_adv_start(void) return -ENOTSUP; } - return gatt_proxy_advertise(); + return gatt_proxy_advertise(next_sub()); } BT_CONN_CB_DEFINE(conn_callbacks) = { diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index f9230a397a9..038c705f2cb 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -1763,6 +1763,12 @@ static void test_tx_priv_multi_net_id(void) { tx_priv_common_init(PP_MULT_NET_ID_WAIT_TIME); + /* TODO: This should be removed as soon as + * SNB/proxy service advertising issue has + * been resolved. + */ + bt_mesh_beacon_set(false); + /* Add second network */ ASSERT_OK_MSG(bt_mesh_subnet_add(TEST_NET_IDX2, test_net_key_secondary), "Failed to add second subnet"); @@ -1813,8 +1819,8 @@ static void test_rx_priv_multi_net_id(void) /* Verify last Net ID adv result */ ASSERT_IN_RANGE(k_uptime_get() - net_ctx[old_idx].start, - MAX_TIMEOUT - 1000, MAX_TIMEOUT + 1000); - ASSERT_IN_RANGE(net_ctx[old_idx].recv_cnt, 9, 12); + MAX_TIMEOUT - 1000, MAX_TIMEOUT); + ASSERT_IN_RANGE(net_ctx[old_idx].recv_cnt, 9, 10); net_ctx[old_idx].recv_cnt = 0; old_idx = i; From ab0e2eb10c189c8df7e00b5664ecb597e5ca8149 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:10 +0100 Subject: [PATCH 1272/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Added support for randomly delaying publications" This reverts commit a02aeef00872c7306224d3f4030ec282e655f9bb. Signed-off-by: Robert Lubos --- .../bluetooth/api/mesh/access.rst | 15 -- include/zephyr/bluetooth/mesh/access.h | 2 - subsys/bluetooth/mesh/Kconfig | 9 - subsys/bluetooth/mesh/access.c | 91 +-------- tests/bsim/bluetooth/mesh/src/test_access.c | 176 ++---------------- .../access/access_period_delayable.sh | 17 -- .../access/access_transmit_delayable.sh | 17 -- 7 files changed, 16 insertions(+), 311 deletions(-) delete mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh delete mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh diff --git a/doc/connectivity/bluetooth/api/mesh/access.rst b/doc/connectivity/bluetooth/api/mesh/access.rst index cb02028b697..7030a3c14b2 100644 --- a/doc/connectivity/bluetooth/api/mesh/access.rst +++ b/doc/connectivity/bluetooth/api/mesh/access.rst @@ -255,21 +255,6 @@ message, it will send messages with delay close to expiration to free memory. When the mesh stack is suspended or reset, messages not yet sent are removed and the :c:member:`bt_mesh_send_cb.start` callback is raised with an error code. -Delayable publications -====================== - -The delayable publication functionality implements the specification recommendations for message -publication delays in the following cases: - -* Between 20 to 500 milliseconds when the Bluetooth Mesh stack starts or when the publication is - triggered by the :c:func:`bt_mesh_model_publish` function -* Between 20 to 50 milliseconds for periodically published messages - -This feature is optional and enabled with the :kconfig:option:`CONFIG_BT_MESH_DELAYABLE_PUBLICATION` -Kconfig option. When enabled, each model can enable or disable the delayable publication by setting -the :c:member:`bt_mesh_model_pub.delayable` bit field to ``1`` or ``0`` correspondingly. This bit -field can be changed at any time. - API reference ************* diff --git a/include/zephyr/bluetooth/mesh/access.h b/include/zephyr/bluetooth/mesh/access.h index a236ede525d..d57f30f8f05 100644 --- a/include/zephyr/bluetooth/mesh/access.h +++ b/include/zephyr/bluetooth/mesh/access.h @@ -713,8 +713,6 @@ struct bt_mesh_model_pub { uint8_t period_div:4, /**< Divisor for the Period. */ count:4; /**< Transmissions left. */ - uint8_t delayable:1; /**< Use random delay for publishing. */ - uint32_t period_start; /**< Start of the current period. */ /** @brief Publication buffer, containing the publication message. diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index af6af8c44dc..bffbac3e8e7 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -672,15 +672,6 @@ config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT endif # BT_MESH_ACCESS_DELAYABLE_MSG -config BT_MESH_DELAYABLE_PUBLICATION - bool "Delayable publication" - default y - help - When enabled, the periodic publications are randomly delayed by 20 to 50ms. Publications - triggered at the start of the stack or by the bt_mesh_model_publish() call are delayed by - 20 to 500ms. This option reduces the probability of collisions when multiple nodes publish - at the same time. - endmenu # Access layer menu "Models" diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index c3ef6a40554..4cffe064329 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -33,11 +33,6 @@ #include LOG_MODULE_REGISTER(bt_mesh_access); -/* 20 - 50ms */ -#define RANDOM_DELAY_SHORT 30 -/* 20 - 500ms */ -#define RANDOM_DELAY_LONG 480 - /* Model publication information for persistent storage. */ struct mod_pub_val { struct { @@ -766,16 +761,8 @@ static int32_t next_period(const struct bt_mesh_model *mod) if (period && elapsed >= period) { LOG_WRN("Retransmission interval is too short"); - - if (!!pub->delayable) { - LOG_WRN("Publication period is too short for" - " retransmissions"); - } - - /* Keep retransmitting the message with the interval sacrificing the - * next publication period start. - */ - return BT_MESH_PUB_TRANSMIT_INT(mod->pub->retransmit); + /* Return smallest positive number since 0 means disabled */ + return 1; } } @@ -788,11 +775,6 @@ static int32_t next_period(const struct bt_mesh_model *mod) if (elapsed >= period) { LOG_WRN("Publication sending took longer than the period"); - - if (!!pub->delayable) { - LOG_WRN("Publication period is too short to be delayable"); - } - /* Return smallest positive number since 0 means disabled */ return 1; } @@ -873,39 +855,6 @@ static int pub_period_start(struct bt_mesh_model_pub *pub) return 0; } -static uint16_t pub_delay_get(int random_delay_window) -{ - if (!IS_ENABLED(CONFIG_BT_MESH_DELAYABLE_PUBLICATION)) { - return 0; - } - - uint16_t num = 0; - - (void)bt_rand(&num, sizeof(num)); - - return 20 + (num % random_delay_window); -} - -static int pub_delay_schedule(struct bt_mesh_model_pub *pub, int delay) -{ - uint16_t random; - int err; - - if (!IS_ENABLED(CONFIG_BT_MESH_DELAYABLE_PUBLICATION)) { - return -ENOTSUP; - } - - random = pub_delay_get(delay); - err = k_work_reschedule(&pub->timer, K_MSEC(random)); - if (err < 0) { - LOG_ERR("Unable to delay publication (err %d)", err); - return err; - } - - LOG_DBG("Publication delayed by %dms", random); - return 0; -} - static void mod_publish(struct k_work *work) { struct k_work_delayable *dwork = k_work_delayable_from_work(work); @@ -941,13 +890,6 @@ static void mod_publish(struct k_work *work) if (err) { return; } - - /* Delay the first publication in a period. */ - if (!!pub->delayable && !pub_delay_schedule(pub, RANDOM_DELAY_SHORT)) { - /* Increment count as it would do BT_MESH_PUB_MSG_TOTAL */ - pub->count++; - return; - } } err = publish_transmit(pub->mod); @@ -1622,18 +1564,6 @@ int bt_mesh_model_publish(const struct bt_mesh_model *model) LOG_DBG("Publish Retransmit Count %u Interval %ums", pub->count, BT_MESH_PUB_TRANSMIT_INT(pub->retransmit)); - /* Delay the publication for longer time when the publication is triggered manually (section - * 3.7.3.1): - * - * When the publication of a message is the result of a power-up, a state transition - * progress update, or completion of a state transition, multiple nodes may be reporting the - * state change at the same time. To reduce the probability of a message collision, these - * messages should be sent with a random delay between 20 and 500 milliseconds. - */ - if (!!pub->delayable && !pub_delay_schedule(pub, RANDOM_DELAY_LONG)) { - return 0; - } - k_work_reschedule(&pub->timer, K_NO_WAIT); return 0; @@ -2638,21 +2568,8 @@ static void commit_mod(const struct bt_mesh_model *mod, const struct bt_mesh_ele int32_t ms = bt_mesh_model_pub_period_get(mod); if (ms > 0) { - /* Delay the first publication after power-up for longer time (section - * 3.7.3.1): - * - * When the publication of a message is the result of a power-up, a state - * transition progress update, or completion of a state transition, multiple - * nodes may be reporting the state change at the same time. To reduce the - * probability of a message collision, these messages should be sent with a - * random delay between 20 and 500 milliseconds. - */ - uint16_t random; - - random = !!mod->pub->delayable ? pub_delay_get(RANDOM_DELAY_LONG) : 0; - - LOG_DBG("Starting publish timer (period %u ms, delay %u ms)", ms, random); - k_work_schedule(&mod->pub->timer, K_MSEC(ms + random)); + LOG_DBG("Starting publish timer (period %u ms)", ms); + k_work_schedule(&mod->pub->timer, K_MSEC(ms)); } } diff --git a/tests/bsim/bluetooth/mesh/src/test_access.c b/tests/bsim/bluetooth/mesh/src/test_access.c index 5cb7d2e28e1..b8b10fd7634 100644 --- a/tests/bsim/bluetooth/mesh/src/test_access.c +++ b/tests/bsim/bluetooth/mesh/src/test_access.c @@ -60,7 +60,6 @@ static const struct { uint8_t div; int32_t period_ms; } test_period[] = { - { BT_MESH_PUB_PERIOD_100MS(1), 0, 100 }, { BT_MESH_PUB_PERIOD_100MS(5), 0, 500 }, { BT_MESH_PUB_PERIOD_SEC(2), 0, 2000 }, { BT_MESH_PUB_PERIOD_10SEC(1), 0, 10000 }, @@ -523,91 +522,6 @@ static void msgf_publish(void) bt_mesh_model_publish(model); } -static void pub_delayable_check(int32_t interval, uint8_t count) -{ - int64_t timestamp = k_uptime_get(); - int err; - - for (size_t j = 0; j < count; j++) { - /* Every new publication will release semaphore in the update handler and the time - * between two consecutive publications will be measured. - */ - err = k_sem_take(&publish_sem, K_SECONDS(20)); - if (err) { - FAIL("Send timed out"); - } - - int32_t time_delta = k_uptime_delta(×tamp); - int32_t pub_delta = time_delta - interval; - - LOG_DBG("Send time: %d delta: %d pub_delta: %d", (int32_t)timestamp, time_delta, - pub_delta); - - if (j == 0) { - /* The first delta will be between the messages published manually and next - * publication (or retransmission). So the time difference should not be - * longer than 500 - 20 + 10 (margin): - * - * |---|-------|--------|-------|----> - * M1 20ms tx(M1) 500ms - * update() - */ - ASSERT_IN_RANGE(pub_delta, 0, 510); - } else { - /* Time difference between the consequtive update callback calls should be - * within a small margin like without random delay as the callbacks should - * be called at the regular interval or immediately (if it passed the next - * period time). - */ - ASSERT_IN_RANGE(pub_delta, 0, 10); - } - } -} - -static void recv_delayable_check(int32_t interval, uint8_t count) -{ - int64_t timestamp; - int err; - - /* The measurement starts by the first received message. */ - err = k_sem_take(&publish_sem, K_SECONDS(20)); - if (err) { - FAIL("Recv timed out"); - } - - timestamp = k_uptime_get(); - - for (size_t j = 0; j < count; j++) { - /* Every new received message will release semaphore in the message handler and - * the time between two consecutive publications will be measured. - */ - err = k_sem_take(&publish_sem, K_SECONDS(20)); - if (err) { - FAIL("Recv timed out"); - } - - int32_t time_delta = k_uptime_delta(×tamp); - /* First message can be delayed up to 500ms, others for up to 50ms. */ - int32_t upper_delay = j == 0 ? 500 : 50; - - /* - * Lower boundary: tx2 - tx1 + interval - * |---|-------|---------------|-------|-----> - * M1 tx1(50ms/500ms) M2 tx2(20ms) - * - * Upper boundary: tx2 - tx1 + interval - * |---|-------|--------|-----------|-----> - * M1 tx1(20ms) M2 tx2(50ms/500ms) - */ - int32_t lower_boundary = 20 - upper_delay + interval; - int32_t upper_boundary = upper_delay - 20 + interval; - - LOG_DBG("Recv time: %d delta: %d boundaries: %d/%d", (int32_t)timestamp, time_delta, - lower_boundary, upper_boundary); - ASSERT_IN_RANGE(time_delta, lower_boundary, upper_boundary + RX_JITTER_MAX); - } -} - static void pub_jitter_check(int32_t interval, uint8_t count) { int64_t timestamp = k_uptime_get(); @@ -664,8 +578,8 @@ static void recv_jitter_check(int32_t interval, uint8_t count) jitter = MAX(pub_delta, jitter); - LOG_DBG("Recv time: %d delta: %d jitter: %d, j: %d", (int32_t)timestamp, time_delta, - jitter, j); + LOG_DBG("Recv time: %d delta: %d jitter: %d", (int32_t)timestamp, time_delta, + jitter); } LOG_INF("Recv jitter: %d", jitter); @@ -675,19 +589,17 @@ static void recv_jitter_check(int32_t interval, uint8_t count) /* Test publish period states by publishing a message and checking interval between update handler * calls. */ -static void tx_period(bool delayable) +static void test_tx_period(void) { const struct bt_mesh_model *model = &models[2]; - bt_mesh_test_cfg_set(NULL, 70); + bt_mesh_test_cfg_set(NULL, 60); bt_mesh_device_setup(&prov, &local_comp); provision(UNICAST_ADDR1); common_configure(UNICAST_ADDR1); k_sem_init(&publish_sem, 0, 1); - model->pub->delayable = delayable; - for (size_t i = 0; i < ARRAY_SIZE(test_period); i++) { pub_param_set(test_period[i].period, 0); @@ -699,11 +611,7 @@ static void tx_period(bool delayable) /* Start publishing messages and measure jitter. */ msgf_publish(); publish_allow = true; - if (delayable) { - pub_delayable_check(test_period[i].period_ms, PUB_PERIOD_COUNT); - } else { - pub_jitter_check(test_period[i].period_ms, PUB_PERIOD_COUNT); - } + pub_jitter_check(test_period[i].period_ms, PUB_PERIOD_COUNT); /* Disable periodic publication before the next test iteration. */ publish_allow = false; @@ -718,9 +626,9 @@ static void tx_period(bool delayable) /* Receive a periodically published message and check publication period by measuring interval * between message handler calls. */ -static void rx_period(bool delayable) +static void test_rx_period(void) { - bt_mesh_test_cfg_set(NULL, 70); + bt_mesh_test_cfg_set(NULL, 60); bt_mesh_device_setup(&prov, &local_comp); provision(UNICAST_ADDR2); common_configure(UNICAST_ADDR2); @@ -728,40 +636,16 @@ static void rx_period(bool delayable) k_sem_init(&publish_sem, 0, 1); for (size_t i = 0; i < ARRAY_SIZE(test_period); i++) { - if (delayable) { - recv_delayable_check(test_period[i].period_ms, PUB_PERIOD_COUNT); - } else { - recv_jitter_check(test_period[i].period_ms, PUB_PERIOD_COUNT); - } + recv_jitter_check(test_period[i].period_ms, PUB_PERIOD_COUNT); } PASS(); } -static void test_tx_period(void) -{ - tx_period(false); -} - -static void test_rx_period(void) -{ - rx_period(false); -} - -static void test_tx_period_delayable(void) -{ - tx_period(true); -} - -static void test_rx_period_delayable(void) -{ - rx_period(true); -} - /* Test publish retransmit interval and count states by publishing a message and checking interval * between update handler calls. */ -static void tx_transmit(bool delayable) +static void test_tx_transmit(void) { const struct bt_mesh_model *model = &models[2]; uint8_t status; @@ -788,7 +672,6 @@ static void tx_transmit(bool delayable) publish_allow = true; model->pub->retr_update = true; - model->pub->delayable = delayable; for (size_t i = 0; i < ARRAY_SIZE(test_transmit); i++) { pub_param_set(0, test_transmit[i]); @@ -800,11 +683,7 @@ static void tx_transmit(bool delayable) /* Start publishing messages and measure jitter. */ msgf_publish(); - if (delayable) { - pub_delayable_check(interval, count); - } else { - pub_jitter_check(interval, count); - } + pub_jitter_check(interval, count); /* Let the receiver hit the first semaphore. */ k_sleep(K_SECONDS(1)); @@ -816,7 +695,7 @@ static void tx_transmit(bool delayable) /* Receive a published message and check retransmission interval by measuring interval between * message handler calls. */ -static void rx_transmit(bool delayable) +static void test_rx_transmit(void) { bt_mesh_test_cfg_set(NULL, 60); bt_mesh_device_setup(&prov, &local_comp); @@ -829,36 +708,12 @@ static void rx_transmit(bool delayable) int32_t interval = BT_MESH_PUB_TRANSMIT_INT(test_transmit[i]); int count = BT_MESH_PUB_TRANSMIT_COUNT(test_transmit[i]); - if (delayable) { - recv_delayable_check(interval, count); - } else { - recv_jitter_check(interval, count); - } + recv_jitter_check(interval, count); } PASS(); } -static void test_tx_transmit(void) -{ - tx_transmit(false); -} - -static void test_rx_transmit(void) -{ - rx_transmit(false); -} - -static void test_tx_transmit_delayable(void) -{ - tx_transmit(true); -} - -static void test_rx_transmit_delayable(void) -{ - rx_transmit(true); -} - /* Cancel one of messages to be published and check that the next one is published when next period * starts. */ @@ -986,13 +841,6 @@ static const struct bst_test_instance test_access[] = { TEST_CASE(tx, cancel, "Access: Cancel a message during publication"), TEST_CASE(rx, cancel, "Access: Receive published messages except cancelled"), - TEST_CASE(tx, period_delayable, "Access: Test delayable periodic publication"), - TEST_CASE(rx, period_delayable, "Access: Receive delayable periodic publication"), - - TEST_CASE(tx, transmit_delayable, "Access: Test delayable publication with retransmission"), - TEST_CASE(rx, transmit_delayable, "Access: Receive delayable publication with" - " retransmissions"), - BSTEST_END_MARKER }; diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh deleted file mode 100755 index 5ecd4a061de..00000000000 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_period_delayable.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh - -RunTest mesh_access_pub_period_delayable_retr \ - access_tx_period_delayable access_rx_period_delayable - -conf=prj_mesh1d1_conf -RunTest mesh_access_pub_period_delayable_retr_1d1 \ - access_tx_period_delayable access_rx_period_delayable - -conf=prj_mesh1d1_conf -overlay=overlay_psa_conf -RunTest mesh_access_pub_period_delayable_retr_psa \ - access_tx_period_delayable access_rx_period_delayable diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh deleted file mode 100755 index 1622ac49f06..00000000000 --- a/tests/bsim/bluetooth/mesh/tests_scripts/access/access_transmit_delayable.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2023 Nordic Semiconductor -# SPDX-License-Identifier: Apache-2.0 - -source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh - -RunTest mesh_access_pub_transmit_delayable_retr \ - access_tx_transmit_delayable access_rx_transmit_delayable - -conf=prj_mesh1d1_conf -RunTest mesh_access_pub_transmit_delayable_retr_1d1 \ - access_tx_transmit_delayable access_rx_transmit_delayable - -conf=prj_mesh1d1_conf -overlay=overlay_psa_conf -RunTest mesh_access_pub_transmit_delayable_retr_psa \ - access_tx_period_delayable access_rx_period_delayable From db6069197989a82b77a5fa527f8fd0d1e8d6737c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:10 +0100 Subject: [PATCH 1273/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Rename prov_dev->provisionee" This reverts commit d7cbe1794778949c4163bdb328db13b409d55173. Signed-off-by: Robert Lubos --- doc/connectivity/bluetooth/api/mesh/shell.rst | 4 +- doc/releases/migration-guide-3.6.rst | 25 ++----- samples/bluetooth/mesh_provisioner/prj.conf | 2 +- subsys/bluetooth/Kconfig.logging | 2 +- subsys/bluetooth/mesh/CMakeLists.txt | 2 +- subsys/bluetooth/mesh/Kconfig | 15 +--- .../mesh/{provisionee.c => prov_device.c} | 8 +-- subsys/bluetooth/mesh/provisioner.c | 72 +++++++++---------- subsys/bluetooth/mesh/shell/shell.c | 8 +-- tests/bsim/bluetooth/mesh/prj.conf | 2 +- tests/bsim/bluetooth/mesh/prj_mesh1d1.conf | 2 +- 11 files changed, 61 insertions(+), 81 deletions(-) rename subsys/bluetooth/mesh/{provisionee.c => prov_device.c} (99%) diff --git a/doc/connectivity/bluetooth/api/mesh/shell.rst b/doc/connectivity/bluetooth/api/mesh/shell.rst index 3d925f29a3e..9d5829fe380 100644 --- a/doc/connectivity/bluetooth/api/mesh/shell.rst +++ b/doc/connectivity/bluetooth/api/mesh/shell.rst @@ -282,7 +282,7 @@ Provisioning ============ To allow a device to broadcast connectable unprovisioned beacons, the -:kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` configuration option must be enabled, along with the +:kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE` configuration option must be enabled, along with the :kconfig:option:`CONFIG_BT_MESH_PB_GATT` option. ``mesh prov pb-gatt `` @@ -295,7 +295,7 @@ To allow a device to broadcast connectable unprovisioned beacons, the * ``Val``: Enable or disable provisioning with GATT To allow a device to broadcast unprovisioned beacons, the -:kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` configuration option must be enabled, along with the +:kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE` configuration option must be enabled, along with the :kconfig:option:`CONFIG_BT_MESH_PB_ADV` option. ``mesh prov pb-adv `` diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index c1739adf74d..c4b93e5f150 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -113,24 +113,13 @@ Bluetooth cleared on :c:func:`bt_enable`. Callbacks can now be registered before the initial call to :c:func:`bt_enable`, and should no longer be re-registered after a :c:func:`bt_disable` :c:func:`bt_enable` cycle. (:github:`63693`) -* The Bluetooth UUID has been modified to rodata in ``BT_UUID_DECLARE_16``, ``BT_UUID_DECLARE_32` - and ``BT_UUID_DECLARE_128`` as the return value has been changed to `const`. - Any pointer to a UUID must be prefixed with `const`, otherwise there will be a compilation warning. - For example change ``struct bt_uuid *uuid = BT_UUID_DECLARE_16(xx)`` to - ``const struct bt_uuid *uuid = BT_UUID_DECLARE_16(xx)``. (:github:`66136`) - -* Mesh - - * The Bluetooth Mesh ``model`` declaration has been changed to add prefix ``const``. - The ``model->user_data``, ``model->elem_idx`` and ``model->mod_idx`` field has been changed to - the new runtime structure, replaced by ``model->rt->user_data``, ``model->rt->elem_idx`` and - ``model->rt->mod_idx`` separately. (:github:`65152`) - * The Bluetooth Mesh ``element`` declaration has been changed to add prefix ``const``. - The ``elem->addr`` field has been changed to the new runtime structure, replaced by - ``elem->rt->addr``. (:github:`65388`) - * Deprecated :kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE`. This option is - replaced by new option :kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` to - be aligned with Mesh Protocol Specification v1.1, section 5.4. (:github:`64252`) +* The Bluetooth Mesh ``model`` declaration has been changed to add prefix ``const``. + The ``model->user_data``, ``model->elem_idx`` and ``model->mod_idx`` field has been changed to + the new runtime structure, replaced by ``model->rt->user_data``, ``model->rt->elem_idx`` and + ``model->rt->mod_idx`` separately. (:github:`65152`) +* The Bluetooth Mesh ``element`` declaration has been changed to add prefix ``const``. + The ``elem->addr`` field has been changed to the new runtime structure, replaced by + ``elem->rt->addr``. (:github:`65388`) LoRaWAN ======= diff --git a/samples/bluetooth/mesh_provisioner/prj.conf b/samples/bluetooth/mesh_provisioner/prj.conf index 341dd49ed2e..bfc6d5a1241 100644 --- a/samples/bluetooth/mesh_provisioner/prj.conf +++ b/samples/bluetooth/mesh_provisioner/prj.conf @@ -33,7 +33,7 @@ CONFIG_BT_MESH_RELAY=y CONFIG_BT_MESH_RELAY_RETRANSMIT_COUNT=3 CONFIG_BT_MESH_PROVISIONER=y -CONFIG_BT_MESH_PROVISIONEE=n +CONFIG_BT_MESH_PROV_DEVICE=n CONFIG_BT_MESH_CDB=y CONFIG_BT_MESH_CDB_NODE_COUNT=16 CONFIG_BT_MESH_CDB_SUBNET_COUNT=3 diff --git a/subsys/bluetooth/Kconfig.logging b/subsys/bluetooth/Kconfig.logging index b6505f6e53a..6d8b999e03c 100644 --- a/subsys/bluetooth/Kconfig.logging +++ b/subsys/bluetooth/Kconfig.logging @@ -1002,7 +1002,7 @@ legacy-debug-sym = BT_MESH_DEBUG_PROVISIONER module-str = "Provisioner" source "subsys/bluetooth/common/Kconfig.template.log_config_bt" -module = BT_MESH_PROVISIONEE +module = BT_MESH_PROV_DEVICE legacy-debug-sym = BT_MESH_DEBUG_PROV_DEVICE module-str = "Provisioning device" source "subsys/bluetooth/common/Kconfig.template.log_config_bt" diff --git a/subsys/bluetooth/mesh/CMakeLists.txt b/subsys/bluetooth/mesh/CMakeLists.txt index fe4444b28ab..3fd2e7c3bfc 100644 --- a/subsys/bluetooth/mesh/CMakeLists.txt +++ b/subsys/bluetooth/mesh/CMakeLists.txt @@ -40,7 +40,7 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH_FRIEND friend.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROV prov.c) -zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROVISIONEE provisionee.c) +zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROV_DEVICE prov_device.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROVISIONER provisioner.c) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index bffbac3e8e7..3bc7dd2940f 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -240,7 +240,7 @@ config BT_MESH_PB_GATT select BT_MESH_GATT_SERVER select BT_MESH_PROV select BT_MESH_PB_GATT_COMMON - select BT_MESH_PROVISIONEE + select BT_MESH_PROV_DEVICE help Enable this option to allow the device to be provisioned over GATT. @@ -268,16 +268,7 @@ 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" + bool "Provisioning device role support" depends on BT_MESH_PB_ADV || BT_MESH_PB_GATT default y help @@ -285,7 +276,7 @@ config BT_MESH_PROVISIONEE config BT_MESH_PROV_OOB_PUBLIC_KEY bool "OOB Public key support" - depends on BT_MESH_PROVISIONEE + depends on BT_MESH_PROV_DEVICE help Enable this option if public key is to be exchanged via Out of Band (OOB) technology. diff --git a/subsys/bluetooth/mesh/provisionee.c b/subsys/bluetooth/mesh/prov_device.c similarity index 99% rename from subsys/bluetooth/mesh/provisionee.c rename to subsys/bluetooth/mesh/prov_device.c index dcecb5838f0..6ca65c2ec63 100644 --- a/subsys/bluetooth/mesh/provisionee.c +++ b/subsys/bluetooth/mesh/prov_device.c @@ -32,9 +32,9 @@ #include "settings.h" #include "rpr.h" -#define LOG_LEVEL CONFIG_BT_MESH_PROVISIONEE_LOG_LEVEL +#define LOG_LEVEL CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL #include -LOG_MODULE_REGISTER(bt_mesh_provisionee); +LOG_MODULE_REGISTER(bt_mesh_prov_device); static void reprovision_fail(void); @@ -696,8 +696,8 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers) return -EALREADY; } -#if defined(CONFIG_BT_MESH_PROVISIONEE_LOG_LEVEL) - if (CONFIG_BT_MESH_PROVISIONEE_LOG_LEVEL > 2) { +#if defined(CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL) + if (CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL > 2) { struct bt_uuid_128 uuid = { .uuid = { BT_UUID_TYPE_128 } }; sys_memcpy_swap(uuid.val, bt_mesh_prov->uuid, 16); diff --git a/subsys/bluetooth/mesh/provisioner.c b/subsys/bluetooth/mesh/provisioner.c index 08b3f8bb8f1..ba02723e830 100644 --- a/subsys/bluetooth/mesh/provisioner.c +++ b/subsys/bluetooth/mesh/provisioner.c @@ -46,7 +46,7 @@ static struct { uint8_t attention_duration; uint8_t uuid[16]; uint8_t new_dev_key[16]; -} provisionee; +} prov_device; static void send_pub_key(void); static void prov_dh_key_gen(void); @@ -54,8 +54,8 @@ static void prov_dh_key_gen(void); static int reset_state(void) { if (!atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION) && - provisionee.node != NULL) { - bt_mesh_cdb_node_del(provisionee.node, false); + prov_device.node != NULL) { + bt_mesh_cdb_node_del(prov_device.node, false); } return bt_mesh_prov_reset_state(); @@ -86,9 +86,9 @@ static void send_invite(void) LOG_DBG(""); bt_mesh_prov_buf_init(&inv, PROV_INVITE); - net_buf_simple_add_u8(&inv, provisionee.attention_duration); + net_buf_simple_add_u8(&inv, prov_device.attention_duration); - memcpy(bt_mesh_prov_link.conf_inputs.invite, &provisionee.attention_duration, + memcpy(bt_mesh_prov_link.conf_inputs.invite, &prov_device.attention_duration, PDU_LEN_INVITE); if (bt_mesh_prov_send(&inv, NULL)) { @@ -246,8 +246,8 @@ static void prov_capabilities(const uint8_t *data) LOG_DBG("Input OOB Size: %u", caps.input_size); LOG_DBG("Input OOB Action: 0x%04x", caps.input_actions); - provisionee.elem_count = caps.elem_count; - if (provisionee.elem_count == 0) { + prov_device.elem_count = caps.elem_count; + if (prov_device.elem_count == 0) { LOG_ERR("Invalid number of elements"); prov_fail(PROV_ERR_NVAL_FMT); return; @@ -271,7 +271,7 @@ static void prov_capabilities(const uint8_t *data) if (atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) { if (!bt_mesh_prov_link.addr) { bt_mesh_prov_link.addr = bt_mesh_cdb_free_addr_get( - provisionee.elem_count); + prov_device.elem_count); if (!bt_mesh_prov_link.addr) { LOG_ERR("Failed allocating address for node"); prov_fail(PROV_ERR_ADDR); @@ -279,19 +279,19 @@ static void prov_capabilities(const uint8_t *data) } } } else { - provisionee.node = - bt_mesh_cdb_node_alloc(provisionee.uuid, + prov_device.node = + bt_mesh_cdb_node_alloc(prov_device.uuid, bt_mesh_prov_link.addr, - provisionee.elem_count, - provisionee.net_idx); - if (provisionee.node == NULL) { + prov_device.elem_count, + prov_device.net_idx); + if (prov_device.node == NULL) { LOG_ERR("Failed allocating node 0x%04x", bt_mesh_prov_link.addr); prov_fail(PROV_ERR_RESOURCES); return; } /* Address might change in the alloc call */ - bt_mesh_prov_link.addr = provisionee.node->addr; + bt_mesh_prov_link.addr = prov_device.node->addr; } memcpy(bt_mesh_prov_link.conf_inputs.capabilities, data, PDU_LEN_CAPABILITIES); @@ -517,16 +517,16 @@ static void send_prov_data(void) LOG_DBG("Nonce: %s", bt_hex(nonce, 13)); err = bt_mesh_dev_key(bt_mesh_prov_link.dhkey, - bt_mesh_prov_link.prov_salt, provisionee.new_dev_key); + bt_mesh_prov_link.prov_salt, prov_device.new_dev_key); if (err) { LOG_ERR("Unable to generate device key"); prov_fail(PROV_ERR_UNEXP_ERR); goto session_key_destructor; } - sub = bt_mesh_cdb_subnet_get(provisionee.node->net_idx); + sub = bt_mesh_cdb_subnet_get(prov_device.node->net_idx); if (sub == NULL) { - LOG_ERR("No subnet with net_idx %u", provisionee.node->net_idx); + LOG_ERR("No subnet with net_idx %u", prov_device.node->net_idx); prov_fail(PROV_ERR_UNEXP_ERR); goto session_key_destructor; } @@ -540,14 +540,14 @@ static void send_prov_data(void) bt_mesh_prov_buf_init(&pdu, PROV_DATA); net_buf_simple_add_mem(&pdu, net_key, sizeof(net_key)); - net_buf_simple_add_be16(&pdu, provisionee.node->net_idx); + net_buf_simple_add_be16(&pdu, prov_device.node->net_idx); net_buf_simple_add_u8(&pdu, bt_mesh_cdb_subnet_flags(sub)); net_buf_simple_add_be32(&pdu, bt_mesh_cdb.iv_index); net_buf_simple_add_be16(&pdu, bt_mesh_prov_link.addr); net_buf_simple_add(&pdu, 8); /* For MIC */ LOG_DBG("net_idx %u, iv_index 0x%08x, addr 0x%04x", - provisionee.node->net_idx, bt_mesh.iv_index, + prov_device.node->net_idx, bt_mesh.iv_index, bt_mesh_prov_link.addr); err = bt_mesh_prov_encrypt(&session_key, nonce, &pdu.data[1], @@ -571,10 +571,10 @@ static void send_prov_data(void) static void prov_complete(const uint8_t *data) { - struct bt_mesh_cdb_node *node = provisionee.node; + struct bt_mesh_cdb_node *node = prov_device.node; LOG_DBG("key %s, net_idx %u, num_elem %u, addr 0x%04x", - bt_hex(&provisionee.new_dev_key, 16), node->net_idx, + bt_hex(&prov_device.new_dev_key, 16), node->net_idx, node->num_elem, node->addr); bt_mesh_prov_link.expect = PROV_NO_PDU; @@ -586,15 +586,15 @@ static void prov_complete(const uint8_t *data) static void prov_node_add(void) { LOG_DBG(""); - struct bt_mesh_cdb_node *node = provisionee.node; + struct bt_mesh_cdb_node *node = prov_device.node; int err; if (atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) { bt_mesh_cdb_node_update(node, bt_mesh_prov_link.addr, - provisionee.elem_count); + prov_device.elem_count); } - err = bt_mesh_cdb_node_key_import(node, provisionee.new_dev_key); + err = bt_mesh_cdb_node_key_import(node, prov_device.new_dev_key); if (err) { LOG_ERR("Failed to import node device key"); return; @@ -604,7 +604,7 @@ static void prov_node_add(void) bt_mesh_cdb_node_store(node); } - provisionee.node = NULL; + prov_device.node = NULL; if (bt_mesh_prov->node_added) { bt_mesh_prov->node_added(node->net_idx, node->uuid, node->addr, @@ -807,7 +807,7 @@ static int link_open(const uint8_t *uuid, const struct prov_bearer *bearer, } if (uuid) { - memcpy(provisionee.uuid, uuid, 16); + memcpy(prov_device.uuid, uuid, 16); struct bt_uuid_128 uuid_repr = { .uuid = { BT_UUID_TYPE_128 } }; @@ -823,8 +823,8 @@ static int link_open(const uint8_t *uuid, const struct prov_bearer *bearer, bt_mesh_prov_link.addr = addr; bt_mesh_prov_link.bearer = bearer; bt_mesh_prov_link.role = &role_provisioner; - provisionee.net_idx = net_idx; - provisionee.attention_duration = attention_duration; + prov_device.net_idx = net_idx; + prov_device.attention_duration = attention_duration; err = bt_mesh_prov_link.bearer->link_open( uuid, timeout, bt_mesh_prov_bearer_cb_get(), bearer_cb_data); @@ -877,15 +877,15 @@ static int reprovision_local_client_server(uint16_t addr) } LOG_DBG("net_idx %u iv_index 0x%08x, addr 0x%04x", - provisionee.node->net_idx, bt_mesh_cdb.iv_index, addr); + prov_device.node->net_idx, bt_mesh_cdb.iv_index, addr); atomic_set_bit(bt_mesh_prov_link.flags, REPROVISION); atomic_set_bit(bt_mesh_prov_link.flags, PROVISIONER); bt_mesh_prov_link.addr = addr; bt_mesh_prov_link.bearer = &pb_remote_cli; bt_mesh_prov_link.role = &role_provisioner; - provisionee.net_idx = provisionee.node->net_idx; - provisionee.attention_duration = 0; + prov_device.net_idx = prov_device.node->net_idx; + prov_device.attention_duration = 0; if (IS_ENABLED(CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY) && bt_mesh_prov->public_key_be && bt_mesh_prov->private_key_be) { @@ -908,13 +908,13 @@ static int reprovision_local_client_server(uint16_t addr) LOG_DBG("DHkey: %s", bt_hex(bt_mesh_prov_link.dhkey, DH_KEY_SIZE)); err = bt_mesh_dev_key(bt_mesh_prov_link.dhkey, - bt_mesh_prov_link.prov_salt, provisionee.new_dev_key); + bt_mesh_prov_link.prov_salt, prov_device.new_dev_key); if (err) { LOG_ERR("Unable to generate device key"); return err; } - bt_mesh_dev_key_cand(provisionee.new_dev_key); + bt_mesh_dev_key_cand(prov_device.new_dev_key); /* Mark the link that was never opened as closed. */ atomic_set_bit(bt_mesh_prov_link.flags, COMPLETE); bt_mesh_reprovision(addr); @@ -943,8 +943,8 @@ int bt_mesh_pb_remote_open_node(struct bt_mesh_rpr_cli *cli, ctx.refresh = BT_MESH_RPR_NODE_REFRESH_DEVKEY; } - provisionee.node = bt_mesh_cdb_node_get(srv->addr); - if (!provisionee.node) { + prov_device.node = bt_mesh_cdb_node_get(srv->addr); + if (!prov_device.node) { LOG_ERR("No CDB node for 0x%04x", srv->addr); return -ENOENT; } @@ -954,7 +954,7 @@ int bt_mesh_pb_remote_open_node(struct bt_mesh_rpr_cli *cli, return reprovision_local_client_server(addr); } - return link_open(NULL, &pb_remote_cli, provisionee.node->net_idx, addr, + return link_open(NULL, &pb_remote_cli, prov_device.node->net_idx, addr, 0, &ctx, 0); } #endif diff --git a/subsys/bluetooth/mesh/shell/shell.c b/subsys/bluetooth/mesh/shell/shell.c index 9a0e5ece5e3..bb9892eb355 100644 --- a/subsys/bluetooth/mesh/shell/shell.c +++ b/subsys/bluetooth/mesh/shell/shell.c @@ -771,7 +771,7 @@ static int cmd_provision_gatt(const struct shell *sh, size_t argc, } #endif /* CONFIG_BT_MESH_PB_GATT_CLIENT */ -#if defined(CONFIG_BT_MESH_PROVISIONEE) +#if defined(CONFIG_BT_MESH_PROV_DEVICE) static int cmd_pb(bt_mesh_prov_bearer_t bearer, const struct shell *sh, size_t argc, char *argv[]) { @@ -822,7 +822,7 @@ static int cmd_pb_gatt(const struct shell *sh, size_t argc, char *argv[]) return cmd_pb(BT_MESH_PROV_GATT, sh, argc, argv); } #endif /* CONFIG_BT_MESH_PB_GATT */ -#endif /* CONFIG_BT_MESH_PROVISIONEE */ +#endif /* CONFIG_BT_MESH_PROV_DEVICE */ #if defined(CONFIG_BT_MESH_PROVISIONER) static int cmd_remote_pub_key_set(const struct shell *sh, size_t argc, char *argv[]) @@ -1681,14 +1681,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE( SHELL_CMD_ARG(comp-change, NULL, NULL, cmd_comp_change, 1, 0), /* Provisioning operations */ -#if defined(CONFIG_BT_MESH_PROVISIONEE) +#if defined(CONFIG_BT_MESH_PROV_DEVICE) #if defined(CONFIG_BT_MESH_PB_GATT) SHELL_CMD_ARG(pb-gatt, NULL, "", cmd_pb_gatt, 2, 0), #endif #if defined(CONFIG_BT_MESH_PB_ADV) SHELL_CMD_ARG(pb-adv, NULL, "", cmd_pb_adv, 2, 0), #endif -#endif /* CONFIG_BT_MESH_PROVISIONEE */ +#endif /* CONFIG_BT_MESH_PROV_DEVICE */ #if defined(CONFIG_BT_MESH_PROVISIONER) SHELL_CMD(auth-method, &auth_cmds, "Authentication methods", bt_mesh_shell_mdl_cmds_help), diff --git a/tests/bsim/bluetooth/mesh/prj.conf b/tests/bsim/bluetooth/mesh/prj.conf index e9c719de6d7..a45bef89775 100644 --- a/tests/bsim/bluetooth/mesh/prj.conf +++ b/tests/bsim/bluetooth/mesh/prj.conf @@ -37,7 +37,7 @@ CONFIG_BT_MESH_LABEL_COUNT=3 CONFIG_BT_MESH_IV_UPDATE_TEST=y CONFIG_BT_MESH_PB_ADV=y CONFIG_BT_MESH_PROVISIONER=y -CONFIG_BT_MESH_PROVISIONEE=y +CONFIG_BT_MESH_PROV_DEVICE=y CONFIG_BT_MESH_CDB=y CONFIG_BT_MESH_CDB_NODE_COUNT=4 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y diff --git a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf index fd0c953226b..11059c03da4 100644 --- a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf +++ b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf @@ -39,7 +39,7 @@ CONFIG_BT_MESH_LABEL_COUNT=3 CONFIG_BT_MESH_IV_UPDATE_TEST=y CONFIG_BT_MESH_PB_ADV=y CONFIG_BT_MESH_PROVISIONER=y -CONFIG_BT_MESH_PROVISIONEE=y +CONFIG_BT_MESH_PROV_DEVICE=y CONFIG_BT_MESH_CDB=y CONFIG_BT_MESH_CDB_NODE_COUNT=4 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y From 732f8519c61dcc9faa75d5865ef00ae6af7949ad Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:10 +0100 Subject: [PATCH 1274/2300] Revert "[nrf fromtree] Bluetooth: Mesh: access tx msg randomizer" This reverts commit d0431c986016730d9343a5273ed421acfb2273ac. Signed-off-by: Robert Lubos --- .../bluetooth/api/mesh/access.rst | 33 -- doc/releases/release-notes-3.6.rst | 5 - include/zephyr/bluetooth/mesh/msg.h | 3 - .../bluetooth/mesh/boards/bbc_microbit.conf | 1 - .../mesh_demo/boards/bbc_microbit.conf | 1 - subsys/bluetooth/mesh/CMakeLists.txt | 2 - subsys/bluetooth/mesh/Kconfig | 35 -- subsys/bluetooth/mesh/access.c | 29 -- subsys/bluetooth/mesh/access.h | 17 - subsys/bluetooth/mesh/delayable_msg.c | 314 ------------------ subsys/bluetooth/mesh/delayable_msg.h | 16 - subsys/bluetooth/mesh/main.c | 4 - 12 files changed, 460 deletions(-) delete mode 100644 subsys/bluetooth/mesh/delayable_msg.c delete mode 100644 subsys/bluetooth/mesh/delayable_msg.h diff --git a/doc/connectivity/bluetooth/api/mesh/access.rst b/doc/connectivity/bluetooth/api/mesh/access.rst index 7030a3c14b2..e4a94440556 100644 --- a/doc/connectivity/bluetooth/api/mesh/access.rst +++ b/doc/connectivity/bluetooth/api/mesh/access.rst @@ -222,39 +222,6 @@ They are used to represent the new content of the mirrored pages when the Compos change after a firmware update. See :ref:`bluetooth_mesh_dfu_srv_comp_data_and_models_metadata` for details. -Delayable messages -================== - -The delayable message functionality is enabled with Kconfig option -:kconfig:option:`CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG`. -This is an optional functionality that implements specification recommendations for -messages that are transmitted by a model in a response to a received message, also called -response messages. - -Response messages should be sent with the following random delays: - -* Between 20 and 50 milliseconds if the received message was sent - to a unicast address -* Between 20 and 500 milliseconds if the received message was sent - to a group or virtual address - -The delayable message functionality is triggered if the :c:member:`bt_mesh_msg_ctx.rnd_delay` -flag is set. -The delayable message functionality stores messages in the local memory while they are -waiting for the random delay expiration. - -If the transport layer doesn't have sufficient memory to send a message at the moment -the random delay expires, the message is postponed for another 10 milliseconds. -If the transport layer cannot send a message for any other reason, the delayable message -functionality raises the :c:member:`bt_mesh_send_cb.start` callback with a transport layer -error code. - -If the delayable message functionality cannot find enough free memory to store an incoming -message, it will send messages with delay close to expiration to free memory. - -When the mesh stack is suspended or reset, messages not yet sent are removed and -the :c:member:`bt_mesh_send_cb.start` callback is raised with an error code. - API reference ************* diff --git a/doc/releases/release-notes-3.6.rst b/doc/releases/release-notes-3.6.rst index 8edd3280382..676e16fa77c 100644 --- a/doc/releases/release-notes-3.6.rst +++ b/doc/releases/release-notes-3.6.rst @@ -52,11 +52,6 @@ Bluetooth * Mesh - * Added the delayable messages functionality to apply random delays for - the transmitted responses on the Access layer. - The functionality is enabled by the :kconfig:option:`CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG` - Kconfig option. - * Controller Boards & SoC Support diff --git a/include/zephyr/bluetooth/mesh/msg.h b/include/zephyr/bluetooth/mesh/msg.h index 8a7ce1a7128..e52ca85e3a4 100644 --- a/include/zephyr/bluetooth/mesh/msg.h +++ b/include/zephyr/bluetooth/mesh/msg.h @@ -98,9 +98,6 @@ struct bt_mesh_msg_ctx { /** Force sending reliably by using segment acknowledgment */ bool send_rel; - /** Send message with a random delay according to the Access layer transmitting rules. */ - bool rnd_delay; - /** TTL, or BT_MESH_TTL_DEFAULT for default TTL. */ uint8_t send_ttl; }; diff --git a/samples/bluetooth/mesh/boards/bbc_microbit.conf b/samples/bluetooth/mesh/boards/bbc_microbit.conf index 1655768864b..26fb05301c1 100644 --- a/samples/bluetooth/mesh/boards/bbc_microbit.conf +++ b/samples/bluetooth/mesh/boards/bbc_microbit.conf @@ -32,4 +32,3 @@ CONFIG_BT_MESH_SUBNET_COUNT=1 CONFIG_BT_MESH_APP_KEY_COUNT=1 CONFIG_BT_MESH_MODEL_GROUP_COUNT=1 CONFIG_BT_MESH_LABEL_COUNT=0 -CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG=n diff --git a/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf b/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf index 64adc465794..5eb087c4ced 100644 --- a/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf +++ b/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf @@ -22,4 +22,3 @@ CONFIG_BT_MESH_BEACON_ENABLED=n CONFIG_BT_MESH_LABEL_COUNT=1 CONFIG_BT_MESH_SETTINGS_WORKQ=n -CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG=n diff --git a/subsys/bluetooth/mesh/CMakeLists.txt b/subsys/bluetooth/mesh/CMakeLists.txt index 3fd2e7c3bfc..10b142e87f5 100644 --- a/subsys/bluetooth/mesh/CMakeLists.txt +++ b/subsys/bluetooth/mesh/CMakeLists.txt @@ -122,8 +122,6 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH_SOLICITATION solicitation.c) zephyr_library_sources_ifdef(CONFIG_BT_MESH_STATISTIC statistic.c) -zephyr_library_sources_ifdef(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG delayable_msg.c) - if (CONFIG_BT_MESH_USES_TINYCRYPT) zephyr_library_sources(crypto_tc.c) else() diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 3bc7dd2940f..0c654e18064 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -628,41 +628,6 @@ config BT_MESH_LABEL_NO_RECOVER unprovisioned before upgrading to the version with this option). The option is marked as deprecated to remove the recovery code eventually. -menuconfig BT_MESH_ACCESS_DELAYABLE_MSG - bool "Access layer tx delayable message" - help - Enable following of the message transmitting recommendations, the Access layer - specification. The recommendations are optional. - However, they are strictly recommended if the device participates in the network with - intensive communication where the device receives a lot of requests that require responses. - -if BT_MESH_ACCESS_DELAYABLE_MSG - -config BT_MESH_ACCESS_DELAYABLE_MSG_COUNT - int "Number of simultaneously delayed messages" - default 4 - help - The maximum number of messages the Access layer can manage to delay - at the same time. The number of messages can be handled only if the Access layer - has a sufficient amount of memory to store the model payload for them. - -config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE - int "Maximum delayable message storage chunk" - default 20 - help - Size of memory that Access layer uses to split model message to. It allocates - a sufficient number of these chunks from the pool to store the full model payload. - -config BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT - int "Maximum number of available chunks" - default 20 - help - The maximum number of available chunks the Access layer allocates to store model payload. - It is recommended to keep chunk size equal to the reasonable small value to prevent - unnecessary memory wasting. - -endif # BT_MESH_ACCESS_DELAYABLE_MSG - endmenu # Access layer menu "Models" diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 4cffe064329..f7de46fe167 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -27,7 +27,6 @@ #include "op_agg.h" #include "settings.h" #include "va.h" -#include "delayable_msg.h" #define LOG_LEVEL CONFIG_BT_MESH_ACCESS_LOG_LEVEL #include @@ -1519,13 +1518,6 @@ int bt_mesh_model_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx return -EINVAL; } -#if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG - if (ctx->rnd_delay) { - return bt_mesh_delayable_msg_manage(ctx, msg, bt_mesh_model_elem(model)->rt->addr, - cb, cb_data); - } -#endif - return bt_mesh_access_send(ctx, msg, bt_mesh_model_elem(model)->rt->addr, cb, cb_data); } @@ -2621,24 +2613,3 @@ uint8_t bt_mesh_comp_parse_page(struct net_buf_simple *buf) return page; } - -void bt_mesh_access_init(void) -{ -#if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG - bt_mesh_delayable_msg_init(); -#endif -} - -void bt_mesh_access_suspend(void) -{ -#if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG - bt_mesh_delayable_msg_stop(); -#endif -} - -void bt_mesh_access_reset(void) -{ -#if defined CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG - bt_mesh_delayable_msg_stop(); -#endif -} diff --git a/subsys/bluetooth/mesh/access.h b/subsys/bluetooth/mesh/access.h index 210fceee319..48e0eadec10 100644 --- a/subsys/bluetooth/mesh/access.h +++ b/subsys/bluetooth/mesh/access.h @@ -96,25 +96,8 @@ void bt_mesh_msg_cb_set(void (*cb)(uint32_t opcode, struct bt_mesh_msg_ctx *ctx, * * @param ctx The Bluetooth Mesh message context. * @param buf The message payload. - * @param src_addr The source address of model - * @param cb Callback function. - * @param cb_data Callback data. * * @return 0 on success or negative error code on failure. */ int bt_mesh_access_send(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf, uint16_t src_addr, const struct bt_mesh_send_cb *cb, void *cb_data); - -/** @brief Initialize the Access layer. - * - * Initialize the delayable message mechanism if it has been enabled. - */ -void bt_mesh_access_init(void); - -/** @brief Suspend the Access layer. - */ -void bt_mesh_access_suspend(void); - -/** @brief Reset the Access layer. - */ -void bt_mesh_access_reset(void); diff --git a/subsys/bluetooth/mesh/delayable_msg.c b/subsys/bluetooth/mesh/delayable_msg.c deleted file mode 100644 index 5fa43205d63..00000000000 --- a/subsys/bluetooth/mesh/delayable_msg.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -#include -#include - -#include "msg.h" -#include "access.h" -#include "net.h" - -#define LOG_LEVEL CONFIG_BT_MESH_ACCESS_LOG_LEVEL -#include -LOG_MODULE_REGISTER(bt_mesh_delayable_msg); - -static void delayable_msg_handler(struct k_work *w); -static bool push_msg_from_delayable_msgs(void); - -static struct delayable_msg_chunk { - sys_snode_t node; - uint8_t data[CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE]; -} delayable_msg_chunks[CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT]; - -static struct delayable_msg_ctx { - sys_snode_t node; - sys_slist_t chunks; - struct bt_mesh_msg_ctx ctx; - uint16_t src_addr; - const struct bt_mesh_send_cb *cb; - void *cb_data; - uint32_t fired_time; - uint16_t len; -} delayable_msgs_ctx[CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_COUNT]; - -static struct { - sys_slist_t busy_ctx; - sys_slist_t free_ctx; - sys_slist_t free_chunks; - struct k_work_delayable random_delay; -} access_delayable_msg = {.random_delay = Z_WORK_DELAYABLE_INITIALIZER(delayable_msg_handler)}; - -static void put_ctx_to_busy_list(struct delayable_msg_ctx *ctx) -{ - struct delayable_msg_ctx *curr_ctx; - sys_slist_t *list = &access_delayable_msg.busy_ctx; - sys_snode_t *head = sys_slist_peek_head(list); - sys_snode_t *curr = head; - sys_snode_t *prev = curr; - - if (!head) { - sys_slist_append(list, &ctx->node); - return; - } - - do { - curr_ctx = CONTAINER_OF(curr, struct delayable_msg_ctx, node); - if (ctx->fired_time < curr_ctx->fired_time) { - if (curr == head) { - sys_slist_prepend(list, &ctx->node); - } else { - sys_slist_insert(list, prev, &ctx->node); - } - return; - } - prev = curr; - } while ((curr = sys_slist_peek_next(curr))); - - sys_slist_append(list, &ctx->node); -} - -static struct delayable_msg_ctx *peek_pending_msg(void) -{ - struct delayable_msg_ctx *pending_msg = NULL; - sys_snode_t *node = sys_slist_peek_head(&access_delayable_msg.busy_ctx); - - if (node) { - pending_msg = CONTAINER_OF(node, struct delayable_msg_ctx, node); - } - - return pending_msg; -} - -static void reschedule_delayable_msg(struct delayable_msg_ctx *msg) -{ - uint32_t curr_time; - k_timeout_t delay = K_NO_WAIT; - struct delayable_msg_ctx *pending_msg; - - if (msg) { - put_ctx_to_busy_list(msg); - } - - pending_msg = peek_pending_msg(); - - if (!pending_msg) { - return; - } - - curr_time = k_uptime_get_32(); - if (curr_time < pending_msg->fired_time) { - delay = K_MSEC(pending_msg->fired_time - curr_time); - } - - k_work_reschedule(&access_delayable_msg.random_delay, delay); -} - -static int allocate_delayable_msg_chunks(struct delayable_msg_ctx *msg, int number) -{ - sys_snode_t *node; - - for (int i = 0; i < number; i++) { - node = sys_slist_get(&access_delayable_msg.free_chunks); - if (!node) { - LOG_WRN("Unable allocate %u chunks, allocated %u", number, i); - return i; - } - sys_slist_append(&msg->chunks, node); - } - - return number; -} - -static void release_delayable_msg_chunks(struct delayable_msg_ctx *msg) -{ - sys_snode_t *node; - - while ((node = sys_slist_get(&msg->chunks))) { - sys_slist_append(&access_delayable_msg.free_chunks, node); - } -} - -static struct delayable_msg_ctx *allocate_delayable_msg_ctx(void) -{ - struct delayable_msg_ctx *msg; - sys_snode_t *node; - - if (sys_slist_is_empty(&access_delayable_msg.free_ctx)) { - LOG_WRN("Purge pending delayable message."); - if (!push_msg_from_delayable_msgs()) { - return NULL; - } - } - - node = sys_slist_get(&access_delayable_msg.free_ctx); - msg = CONTAINER_OF(node, struct delayable_msg_ctx, node); - sys_slist_init(&msg->chunks); - - return msg; -} - -static void release_delayable_msg_ctx(struct delayable_msg_ctx *ctx) -{ - if (sys_slist_find_and_remove(&access_delayable_msg.busy_ctx, &ctx->node)) { - sys_slist_append(&access_delayable_msg.free_ctx, &ctx->node); - } -} - -static bool push_msg_from_delayable_msgs(void) -{ - sys_snode_t *node; - struct delayable_msg_chunk *chunk; - struct delayable_msg_ctx *msg = peek_pending_msg(); - uint16_t len = msg->len; - int err; - - if (!msg) { - return false; - } - - NET_BUF_SIMPLE_DEFINE(buf, BT_MESH_TX_SDU_MAX); - - SYS_SLIST_FOR_EACH_NODE(&msg->chunks, node) { - uint16_t tmp = MIN(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE, len); - - chunk = CONTAINER_OF(node, struct delayable_msg_chunk, node); - memcpy(net_buf_simple_add(&buf, tmp), chunk->data, tmp); - len -= tmp; - } - - msg->ctx.rnd_delay = false; - err = bt_mesh_access_send(&msg->ctx, &buf, msg->src_addr, msg->cb, msg->cb_data); - msg->ctx.rnd_delay = true; - - if (err == -EBUSY || err == -ENOBUFS) { - return false; - } - - release_delayable_msg_chunks(msg); - release_delayable_msg_ctx(msg); - - if (err && msg->cb && msg->cb->start) { - msg->cb->start(0, err, msg->cb_data); - } - - return true; -} - -static void delayable_msg_handler(struct k_work *w) -{ - if (!push_msg_from_delayable_msgs()) { - sys_snode_t *node = sys_slist_get(&access_delayable_msg.busy_ctx); - struct delayable_msg_ctx *pending_msg = - CONTAINER_OF(node, struct delayable_msg_ctx, node); - - pending_msg->fired_time += 10; - reschedule_delayable_msg(pending_msg); - } else { - reschedule_delayable_msg(NULL); - } -} - -int bt_mesh_delayable_msg_manage(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf, - uint16_t src_addr, const struct bt_mesh_send_cb *cb, void *cb_data) -{ - sys_snode_t *node; - struct delayable_msg_ctx *msg; - uint16_t random_delay; - int total_number = DIV_ROUND_UP(buf->size, CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE); - int allocated_number = 0; - uint16_t len = buf->len; - - if (atomic_test_bit(bt_mesh.flags, BT_MESH_SUSPENDED)) { - LOG_WRN("Refusing to allocate message context while suspended"); - return -ENODEV; - } - - if (total_number > CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT) { - return -EINVAL; - } - - msg = allocate_delayable_msg_ctx(); - if (!msg) { - LOG_WRN("No available free delayable message context."); - return -ENOMEM; - } - - do { - allocated_number += - allocate_delayable_msg_chunks(msg, total_number - allocated_number); - - if (total_number > allocated_number) { - LOG_DBG("Unable allocate %u chunks, allocated %u", total_number, - allocated_number); - if (!push_msg_from_delayable_msgs()) { - LOG_WRN("No available chunk memory."); - release_delayable_msg_chunks(msg); - release_delayable_msg_ctx(msg); - return -ENOMEM; - } - } - } while (total_number > allocated_number); - - SYS_SLIST_FOR_EACH_NODE(&msg->chunks, node) { - uint16_t tmp = MIN(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_SIZE, buf->len); - - struct delayable_msg_chunk *chunk = - CONTAINER_OF(node, struct delayable_msg_chunk, node); - - memcpy(chunk->data, net_buf_simple_pull_mem(buf, tmp), tmp); - } - - bt_rand(&random_delay, sizeof(uint16_t)); - random_delay = 20 + random_delay % (BT_MESH_ADDR_IS_UNICAST(ctx->recv_dst) ? 30 : 480); - msg->fired_time = k_uptime_get_32() + random_delay; - msg->ctx = *ctx; - msg->src_addr = src_addr; - msg->cb = cb; - msg->cb_data = cb_data; - msg->len = len; - - reschedule_delayable_msg(msg); - - return 0; -} - -void bt_mesh_delayable_msg_init(void) -{ - sys_slist_init(&access_delayable_msg.busy_ctx); - sys_slist_init(&access_delayable_msg.free_ctx); - sys_slist_init(&access_delayable_msg.free_chunks); - - for (int i = 0; i < CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_COUNT; i++) { - sys_slist_append(&access_delayable_msg.free_ctx, &delayable_msgs_ctx[i].node); - } - - for (int i = 0; i < CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG_CHUNK_COUNT; i++) { - sys_slist_append(&access_delayable_msg.free_chunks, &delayable_msg_chunks[i].node); - } -} - -void bt_mesh_delayable_msg_stop(void) -{ - sys_snode_t *node; - struct delayable_msg_ctx *ctx; - - k_work_cancel_delayable(&access_delayable_msg.random_delay); - - while ((node = sys_slist_peek_head(&access_delayable_msg.busy_ctx))) { - ctx = CONTAINER_OF(node, struct delayable_msg_ctx, node); - release_delayable_msg_chunks(ctx); - release_delayable_msg_ctx(ctx); - - if (ctx->cb && ctx->cb->start) { - ctx->cb->start(0, -ENODEV, ctx->cb_data); - } - } -} diff --git a/subsys/bluetooth/mesh/delayable_msg.h b/subsys/bluetooth/mesh/delayable_msg.h deleted file mode 100644 index 1ab5dde2e76..00000000000 --- a/subsys/bluetooth/mesh/delayable_msg.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_DELAYABLE_MSG_H__ -#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_DELAYABLE_MSG_H__ - -int bt_mesh_delayable_msg_manage(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf, - uint16_t src_addr, const struct bt_mesh_send_cb *cb, - void *cb_data); -void bt_mesh_delayable_msg_init(void); -void bt_mesh_delayable_msg_stop(void); - -#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_DELAYABLE_MSG_H__ */ diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 2689a3355c1..89115ebe3e8 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -359,7 +359,6 @@ void bt_mesh_reset(void) */ (void)k_work_cancel_delayable(&bt_mesh.ivu_timer); - bt_mesh_access_reset(); bt_mesh_model_reset(); bt_mesh_cfg_default_set(); bt_mesh_trans_reset(); @@ -460,8 +459,6 @@ int bt_mesh_suspend(void) bt_mesh_model_foreach(model_suspend, NULL); - bt_mesh_access_suspend(); - err = bt_mesh_adv_disable(); if (err) { atomic_clear_bit(bt_mesh.flags, BT_MESH_SUSPENDED); @@ -561,7 +558,6 @@ int bt_mesh_init(const struct bt_mesh_prov *prov, bt_mesh_cfg_default_set(); bt_mesh_net_init(); bt_mesh_trans_init(); - bt_mesh_access_init(); bt_mesh_hb_init(); bt_mesh_beacon_init(); bt_mesh_adv_init(); From 125ece43c17f81d9a5368d2f7e6f6b1675b77aa3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:10 +0100 Subject: [PATCH 1275/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Use memslab replace with net_buf_pool" This reverts commit fba4d322a8ec2d4d38af138f8caf8f762eb33413. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/access.c | 1 + subsys/bluetooth/mesh/adv.c | 195 ++++++++---------- subsys/bluetooth/mesh/adv.h | 51 ++--- subsys/bluetooth/mesh/adv_ext.c | 193 ++++++++--------- subsys/bluetooth/mesh/adv_legacy.c | 65 +++--- subsys/bluetooth/mesh/app_keys.c | 1 + subsys/bluetooth/mesh/beacon.c | 49 ++--- subsys/bluetooth/mesh/cfg.c | 1 + subsys/bluetooth/mesh/cfg_srv.c | 1 + subsys/bluetooth/mesh/friend.c | 15 +- subsys/bluetooth/mesh/gatt_cli.c | 1 + subsys/bluetooth/mesh/health_srv.c | 1 + subsys/bluetooth/mesh/lpn.c | 1 + subsys/bluetooth/mesh/main.c | 1 + subsys/bluetooth/mesh/net.c | 49 ++--- subsys/bluetooth/mesh/net.h | 3 +- subsys/bluetooth/mesh/pb_adv.c | 143 ++++++------- subsys/bluetooth/mesh/pb_gatt.c | 1 + subsys/bluetooth/mesh/pb_gatt_cli.c | 1 + subsys/bluetooth/mesh/pb_gatt_srv.c | 1 + subsys/bluetooth/mesh/priv_beacon_srv.c | 1 + subsys/bluetooth/mesh/prov_device.c | 1 + subsys/bluetooth/mesh/provisioner.c | 1 + subsys/bluetooth/mesh/proxy.h | 2 +- subsys/bluetooth/mesh/proxy_cli.c | 5 +- subsys/bluetooth/mesh/proxy_cli.h | 2 +- subsys/bluetooth/mesh/proxy_msg.c | 15 +- subsys/bluetooth/mesh/proxy_msg.h | 2 +- subsys/bluetooth/mesh/proxy_srv.c | 7 +- subsys/bluetooth/mesh/rpl.c | 1 + subsys/bluetooth/mesh/rpr_srv.c | 1 + subsys/bluetooth/mesh/solicitation.c | 1 + subsys/bluetooth/mesh/statistic.c | 17 +- subsys/bluetooth/mesh/statistic.h | 4 +- subsys/bluetooth/mesh/subnet.c | 1 + subsys/bluetooth/mesh/transport.c | 31 +-- subsys/bluetooth/mesh/transport_legacy.c | 31 +-- .../bsim/bluetooth/mesh/src/test_advertiser.c | 142 ++++++------- tests/bsim/bluetooth/mesh/src/test_beacon.c | 1 + tests/bsim/bluetooth/mesh/src/test_blob.c | 2 +- tests/bsim/bluetooth/mesh/src/test_dfu.c | 1 + .../bsim/bluetooth/mesh/src/test_provision.c | 1 + tests/bsim/bluetooth/mesh/src/test_scanner.c | 1 + 43 files changed, 524 insertions(+), 521 deletions(-) diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index f7de46fe167..81e2902afd1 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -19,6 +19,7 @@ #include "host/testing.h" #include "mesh.h" +#include "adv.h" #include "net.h" #include "lpn.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index 00e2a4aa7bb..548e7f3fe15 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -17,6 +17,7 @@ #include "common/bt_str.h" +#include "adv.h" #include "net.h" #include "foundation.h" #include "beacon.h" @@ -46,144 +47,124 @@ static K_FIFO_DEFINE(bt_mesh_adv_queue); static K_FIFO_DEFINE(bt_mesh_relay_queue); static K_FIFO_DEFINE(bt_mesh_friend_queue); -K_MEM_SLAB_DEFINE_STATIC(local_adv_pool, sizeof(struct bt_mesh_adv), - CONFIG_BT_MESH_ADV_BUF_COUNT, __alignof__(struct bt_mesh_adv)); - -#if defined(CONFIG_BT_MESH_RELAY_BUF_COUNT) -K_MEM_SLAB_DEFINE_STATIC(relay_adv_pool, sizeof(struct bt_mesh_adv), - CONFIG_BT_MESH_RELAY_BUF_COUNT, __alignof__(struct bt_mesh_adv)); -#endif - -#if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) -K_MEM_SLAB_DEFINE_STATIC(friend_adv_pool, sizeof(struct bt_mesh_adv), - CONFIG_BT_MESH_FRIEND_LPN_COUNT, __alignof__(struct bt_mesh_adv)); -#endif - -void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv_ctx *ctx) +void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv *adv) { - if (!ctx->started) { - ctx->started = 1; + if (!adv->started) { + adv->started = 1; - if (ctx->cb && ctx->cb->start) { - ctx->cb->start(duration, err, ctx->cb_data); + if (adv->cb && adv->cb->start) { + adv->cb->start(duration, err, adv->cb_data); } if (err) { - ctx->cb = NULL; + adv->cb = NULL; } else if (IS_ENABLED(CONFIG_BT_MESH_STATISTIC)) { - bt_mesh_stat_succeeded_count(ctx); + bt_mesh_stat_succeeded_count(adv); } } } -static void bt_mesh_adv_send_end(int err, struct bt_mesh_adv_ctx const *ctx) +static void bt_mesh_adv_send_end(int err, struct bt_mesh_adv const *adv) { - if (ctx->started && ctx->cb && ctx->cb->end) { - ctx->cb->end(err, ctx->cb_data); + if (adv->started && adv->cb && adv->cb->end) { + adv->cb->end(err, adv->cb_data); } } -static struct bt_mesh_adv *adv_create_from_pool(struct k_mem_slab *buf_pool, - enum bt_mesh_adv_type type, - enum bt_mesh_adv_tag tag, - uint8_t xmit, k_timeout_t timeout) +static void adv_buf_destroy(struct net_buf *buf) { - struct bt_mesh_adv_ctx *ctx; - struct bt_mesh_adv *adv; - int err; + struct bt_mesh_adv adv = *BT_MESH_ADV(buf); - if (atomic_test_bit(bt_mesh.flags, BT_MESH_SUSPENDED)) { - LOG_WRN("Refusing to allocate buffer while suspended"); - return NULL; - } + net_buf_destroy(buf); - err = k_mem_slab_alloc(buf_pool, (void **)&adv, timeout); - if (err) { - return NULL; - } + bt_mesh_adv_send_end(0, &adv); +} - adv->__ref = 1; +NET_BUF_POOL_DEFINE(adv_buf_pool, CONFIG_BT_MESH_ADV_BUF_COUNT, + BT_MESH_ADV_DATA_SIZE, BT_MESH_ADV_USER_DATA_SIZE, + adv_buf_destroy); - net_buf_simple_init_with_data(&adv->b, adv->__bufs, BT_MESH_ADV_DATA_SIZE); - net_buf_simple_reset(&adv->b); +static struct bt_mesh_adv adv_local_pool[CONFIG_BT_MESH_ADV_BUF_COUNT]; - ctx = &adv->ctx; +#if defined(CONFIG_BT_MESH_RELAY) +NET_BUF_POOL_DEFINE(relay_buf_pool, CONFIG_BT_MESH_RELAY_BUF_COUNT, + BT_MESH_ADV_DATA_SIZE, BT_MESH_ADV_USER_DATA_SIZE, + adv_buf_destroy); - (void)memset(ctx, 0, sizeof(*ctx)); +static struct bt_mesh_adv adv_relay_pool[CONFIG_BT_MESH_RELAY_BUF_COUNT]; +#endif - ctx->type = type; - ctx->tag = tag; - ctx->xmit = xmit; +#if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) +NET_BUF_POOL_DEFINE(friend_buf_pool, CONFIG_BT_MESH_FRIEND_LPN_COUNT, + BT_MESH_ADV_DATA_SIZE, BT_MESH_ADV_USER_DATA_SIZE, + adv_buf_destroy); - return adv; -} +static struct bt_mesh_adv adv_friend_pool[CONFIG_BT_MESH_FRIEND_LPN_COUNT]; +#endif -struct bt_mesh_adv *bt_mesh_adv_ref(struct bt_mesh_adv *adv) +static struct net_buf *bt_mesh_adv_create_from_pool(struct net_buf_pool *buf_pool, + struct bt_mesh_adv *adv_pool, + enum bt_mesh_adv_type type, + enum bt_mesh_adv_tag tag, + uint8_t xmit, k_timeout_t timeout) { - __ASSERT_NO_MSG(adv->__ref < UINT8_MAX); - - adv->__ref++; - - return adv; -} + struct bt_mesh_adv *adv; + struct net_buf *buf; -void bt_mesh_adv_unref(struct bt_mesh_adv *adv) -{ - __ASSERT_NO_MSG(adv->__ref > 0); + if (atomic_test_bit(bt_mesh.flags, BT_MESH_SUSPENDED)) { + LOG_WRN("Refusing to allocate buffer while suspended"); + return NULL; + } - if (--adv->__ref > 0) { - return; + buf = net_buf_alloc(buf_pool, timeout); + if (!buf) { + return NULL; } - struct k_mem_slab *slab = &local_adv_pool; - struct bt_mesh_adv_ctx ctx = adv->ctx; + adv = &adv_pool[net_buf_id(buf)]; + BT_MESH_ADV(buf) = adv; -#if defined(CONFIG_BT_MESH_RELAY) - if (adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) { - slab = &relay_adv_pool; - } -#endif + (void)memset(adv, 0, sizeof(*adv)); -#if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) - if (adv->ctx.tag == BT_MESH_ADV_TAG_FRIEND) { - slab = &friend_adv_pool; - } -#endif + adv->type = type; + adv->tag = tag; + adv->xmit = xmit; - k_mem_slab_free(slab, (void *)adv); - bt_mesh_adv_send_end(0, &ctx); + return buf; } -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) +struct net_buf *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 (tag == BT_MESH_ADV_TAG_RELAY) { - return adv_create_from_pool(&relay_adv_pool, - type, tag, xmit, timeout); + return bt_mesh_adv_create_from_pool(&relay_buf_pool, + adv_relay_pool, type, + tag, xmit, timeout); } #endif #if defined(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) if (tag == BT_MESH_ADV_TAG_FRIEND) { - return adv_create_from_pool(&friend_adv_pool, - type, tag, xmit, timeout); + return bt_mesh_adv_create_from_pool(&friend_buf_pool, + adv_friend_pool, type, + tag, xmit, timeout); } #endif - return adv_create_from_pool(&local_adv_pool, type, - tag, xmit, timeout); + return bt_mesh_adv_create_from_pool(&adv_buf_pool, adv_local_pool, type, + tag, xmit, timeout); } -static struct bt_mesh_adv *process_events(struct k_poll_event *ev, int count) +static struct net_buf *process_events(struct k_poll_event *ev, int count) { for (; count; ev++, count--) { LOG_DBG("ev->state %u", ev->state); switch (ev->state) { case K_POLL_STATE_FIFO_DATA_AVAILABLE: - return k_fifo_get(ev->fifo, K_NO_WAIT); + return net_buf_get(ev->fifo, K_NO_WAIT); case K_POLL_STATE_NOT_READY: case K_POLL_STATE_CANCELLED: break; @@ -196,7 +177,7 @@ static struct bt_mesh_adv *process_events(struct k_poll_event *ev, int count) return NULL; } -struct bt_mesh_adv *bt_mesh_adv_get(k_timeout_t timeout) +struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout) { int err; struct k_poll_event events[] = { @@ -223,22 +204,22 @@ struct bt_mesh_adv *bt_mesh_adv_get(k_timeout_t timeout) return process_events(events, ARRAY_SIZE(events)); } -struct bt_mesh_adv *bt_mesh_adv_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout) +struct net_buf *bt_mesh_adv_buf_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout) { if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && tags & BT_MESH_ADV_TAG_BIT_FRIEND) { - return k_fifo_get(&bt_mesh_friend_queue, timeout); + return net_buf_get(&bt_mesh_friend_queue, timeout); } if (IS_ENABLED(CONFIG_BT_MESH_RELAY) && !(tags & BT_MESH_ADV_TAG_BIT_LOCAL)) { - return k_fifo_get(&bt_mesh_relay_queue, timeout); + return net_buf_get(&bt_mesh_relay_queue, timeout); } - return bt_mesh_adv_get(timeout); + return bt_mesh_adv_buf_get(timeout); } -void bt_mesh_adv_get_cancel(void) +void bt_mesh_adv_buf_get_cancel(void) { LOG_DBG(""); @@ -253,38 +234,38 @@ void bt_mesh_adv_get_cancel(void) } } -void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, +void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb, void *cb_data) { - LOG_DBG("type 0x%02x len %u: %s", adv->ctx.type, adv->b.len, - bt_hex(adv->b.data, adv->b.len)); + LOG_DBG("type 0x%02x len %u: %s", BT_MESH_ADV(buf)->type, buf->len, + bt_hex(buf->data, buf->len)); - adv->ctx.cb = cb; - adv->ctx.cb_data = cb_data; - adv->ctx.busy = 1U; + BT_MESH_ADV(buf)->cb = cb; + BT_MESH_ADV(buf)->cb_data = cb_data; + BT_MESH_ADV(buf)->busy = 1U; if (IS_ENABLED(CONFIG_BT_MESH_STATISTIC)) { - bt_mesh_stat_planned_count(&adv->ctx); + bt_mesh_stat_planned_count(BT_MESH_ADV(buf)); } if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && - adv->ctx.tag == BT_MESH_ADV_TAG_FRIEND) { - k_fifo_put(&bt_mesh_friend_queue, bt_mesh_adv_ref(adv)); - bt_mesh_adv_friend_ready(); + BT_MESH_ADV(buf)->tag == BT_MESH_ADV_TAG_FRIEND) { + net_buf_put(&bt_mesh_friend_queue, net_buf_ref(buf)); + bt_mesh_adv_buf_friend_ready(); return; } if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) && - adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) || + BT_MESH_ADV(buf)->tag == BT_MESH_ADV_TAG_RELAY) || (IS_ENABLED(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS) && - adv->ctx.tag == BT_MESH_ADV_TAG_PROV)) { - k_fifo_put(&bt_mesh_relay_queue, bt_mesh_adv_ref(adv)); - bt_mesh_adv_relay_ready(); + BT_MESH_ADV(buf)->tag == BT_MESH_ADV_TAG_PROV)) { + net_buf_put(&bt_mesh_relay_queue, net_buf_ref(buf)); + bt_mesh_adv_buf_relay_ready(); return; } - k_fifo_put(&bt_mesh_adv_queue, bt_mesh_adv_ref(adv)); - bt_mesh_adv_local_ready(); + net_buf_put(&bt_mesh_adv_queue, net_buf_ref(buf)); + bt_mesh_adv_buf_local_ready(); } int bt_mesh_adv_gatt_send(void) diff --git a/subsys/bluetooth/mesh/adv.h b/subsys/bluetooth/mesh/adv.h index 0c936a1aa52..42b07601ad5 100644 --- a/subsys/bluetooth/mesh/adv.h +++ b/subsys/bluetooth/mesh/adv.h @@ -4,12 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_SUBSYS_BLUETOOTH_MESH_ADV_H_ -#define ZEPHYR_SUBSYS_BLUETOOTH_MESH_ADV_H_ - /* Maximum advertising data payload for a single data type */ #define BT_MESH_ADV_DATA_SIZE 29 +/* The user data is a pointer (4 bytes) to struct bt_mesh_adv */ +#define BT_MESH_ADV_USER_DATA_SIZE 4 + +#define BT_MESH_ADV(buf) (*(struct bt_mesh_adv **)net_buf_user_data(buf)) + #define BT_MESH_ADV_SCAN_UNIT(_ms) ((_ms) * 8 / 5) #define BT_MESH_SCAN_INTERVAL_MS 30 #define BT_MESH_SCAN_WINDOW_MS 30 @@ -39,7 +41,7 @@ enum bt_mesh_adv_tag_bit { BT_MESH_ADV_TAG_BIT_PROV = BIT(BT_MESH_ADV_TAG_PROV), }; -struct bt_mesh_adv_ctx { +struct bt_mesh_adv { const struct bt_mesh_send_cb *cb; void *cb_data; @@ -51,39 +53,24 @@ struct bt_mesh_adv_ctx { uint8_t xmit; }; -struct bt_mesh_adv { - sys_snode_t node; - - struct bt_mesh_adv_ctx ctx; - - struct net_buf_simple b; - - uint8_t __ref; - - uint8_t __bufs[BT_MESH_ADV_DATA_SIZE]; -}; - /* Lookup table for Advertising data types for bt_mesh_adv_type: */ extern const uint8_t bt_mesh_adv_type[BT_MESH_ADV_TYPES]; -struct bt_mesh_adv *bt_mesh_adv_ref(struct bt_mesh_adv *adv); -void bt_mesh_adv_unref(struct bt_mesh_adv *adv); - /* xmit_count: Number of retransmissions, i.e. 0 == 1 transmission */ -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); +struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type, + enum bt_mesh_adv_tag tag, + uint8_t xmit, k_timeout_t timeout); -void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, +void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb, void *cb_data); -struct bt_mesh_adv *bt_mesh_adv_get(k_timeout_t timeout); +struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout); -struct bt_mesh_adv *bt_mesh_adv_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout); +struct net_buf *bt_mesh_adv_buf_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_timeout_t timeout); void bt_mesh_adv_gatt_update(void); -void bt_mesh_adv_get_cancel(void); +void bt_mesh_adv_buf_get_cancel(void); void bt_mesh_adv_init(void); @@ -96,13 +83,13 @@ int bt_mesh_adv_enable(void); /* Should not be called from work queue due to undefined behavior */ int bt_mesh_adv_disable(void); -void bt_mesh_adv_local_ready(void); +void bt_mesh_adv_buf_local_ready(void); -void bt_mesh_adv_relay_ready(void); +void bt_mesh_adv_buf_relay_ready(void); -void bt_mesh_adv_terminate(struct bt_mesh_adv *adv); +void bt_mesh_adv_buf_terminate(const struct net_buf *buf); -void bt_mesh_adv_friend_ready(void); +void bt_mesh_adv_buf_friend_ready(void); int bt_mesh_adv_gatt_send(void); @@ -110,11 +97,9 @@ int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, int32_t duration const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len); -void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv_ctx *ctx); +void bt_mesh_adv_send_start(uint16_t duration, int err, struct bt_mesh_adv *adv); 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); - -#endif /* ZEPHYR_SUBSYS_BLUETOOTH_MESH_ADV_H_ */ diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 856c6c39f1d..9f0caa582ed 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -21,6 +21,7 @@ #include "host/hci_core.h" +#include "adv.h" #include "net.h" #include "proxy.h" #include "solicitation.h" @@ -62,14 +63,14 @@ struct bt_mesh_ext_adv { const enum bt_mesh_adv_tag_bit tags; ATOMIC_DEFINE(flags, ADV_FLAGS_NUM); struct bt_le_ext_adv *instance; - struct bt_mesh_adv *adv; + struct net_buf *buf; uint64_t timestamp; struct k_work_delayable work; struct bt_le_adv_param adv_param; }; static void send_pending_adv(struct k_work *work); -static bool schedule_send(struct bt_mesh_ext_adv *ext_adv); +static bool schedule_send(struct bt_mesh_ext_adv *adv); static struct bt_mesh_ext_adv advs[] = { [0] = { @@ -160,7 +161,7 @@ static int set_adv_randomness(uint8_t handle, int rand_us) #endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ } -static int adv_start(struct bt_mesh_ext_adv *ext_adv, +static int adv_start(struct bt_mesh_ext_adv *adv, const struct bt_le_adv_param *param, struct bt_le_ext_adv_start_param *start, const struct bt_data *ad, size_t ad_len, @@ -168,47 +169,47 @@ static int adv_start(struct bt_mesh_ext_adv *ext_adv, { int err; - if (!ext_adv->instance) { + if (!adv->instance) { LOG_ERR("Mesh advertiser not enabled"); return -ENODEV; } - if (atomic_test_and_set_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { + if (atomic_test_and_set_bit(adv->flags, ADV_FLAG_ACTIVE)) { LOG_ERR("Advertiser is busy"); return -EBUSY; } - if (atomic_test_bit(ext_adv->flags, ADV_FLAG_UPDATE_PARAMS)) { - err = bt_le_ext_adv_update_param(ext_adv->instance, param); + if (atomic_test_bit(adv->flags, ADV_FLAG_UPDATE_PARAMS)) { + err = bt_le_ext_adv_update_param(adv->instance, param); if (err) { LOG_ERR("Failed updating adv params: %d", err); - atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); return err; } - atomic_set_bit_to(ext_adv->flags, ADV_FLAG_UPDATE_PARAMS, - param != &ext_adv->adv_param); + atomic_set_bit_to(adv->flags, ADV_FLAG_UPDATE_PARAMS, + param != &adv->adv_param); } - err = bt_le_ext_adv_set_data(ext_adv->instance, ad, ad_len, sd, sd_len); + err = bt_le_ext_adv_set_data(adv->instance, ad, ad_len, sd, sd_len); if (err) { LOG_ERR("Failed setting adv data: %d", err); - atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); return err; } - ext_adv->timestamp = k_uptime_get(); + adv->timestamp = k_uptime_get(); - err = bt_le_ext_adv_start(ext_adv->instance, start); + err = bt_le_ext_adv_start(adv->instance, start); if (err) { LOG_ERR("Advertising failed: err %d", err); - atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); } return err; } -static int bt_data_send(struct bt_mesh_ext_adv *ext_adv, uint8_t num_events, uint16_t adv_interval, +static int bt_data_send(struct bt_mesh_ext_adv *adv, uint8_t num_events, uint16_t adv_interval, const struct bt_data *ad, size_t ad_len) { struct bt_le_ext_adv_start_param start = { @@ -218,41 +219,41 @@ static int bt_data_send(struct bt_mesh_ext_adv *ext_adv, uint8_t num_events, uin adv_interval = MAX(ADV_INT_FAST_MS, adv_interval); /* Only update advertising parameters if they're different */ - if (ext_adv->adv_param.interval_min != BT_MESH_ADV_SCAN_UNIT(adv_interval)) { - ext_adv->adv_param.interval_min = BT_MESH_ADV_SCAN_UNIT(adv_interval); - ext_adv->adv_param.interval_max = ext_adv->adv_param.interval_min; - atomic_set_bit(ext_adv->flags, ADV_FLAG_UPDATE_PARAMS); + if (adv->adv_param.interval_min != BT_MESH_ADV_SCAN_UNIT(adv_interval)) { + adv->adv_param.interval_min = BT_MESH_ADV_SCAN_UNIT(adv_interval); + adv->adv_param.interval_max = adv->adv_param.interval_min; + atomic_set_bit(adv->flags, ADV_FLAG_UPDATE_PARAMS); } - return adv_start(ext_adv, &ext_adv->adv_param, &start, ad, ad_len, NULL, 0); + return adv_start(adv, &adv->adv_param, &start, ad, ad_len, NULL, 0); } -static int adv_send(struct bt_mesh_ext_adv *ext_adv, struct bt_mesh_adv *adv) +static int buf_send(struct bt_mesh_ext_adv *adv, struct net_buf *buf) { - uint8_t num_events = BT_MESH_TRANSMIT_COUNT(adv->ctx.xmit) + 1; + uint8_t num_events = BT_MESH_TRANSMIT_COUNT(BT_MESH_ADV(buf)->xmit) + 1; uint16_t duration, adv_int; struct bt_data ad; int err; - adv_int = BT_MESH_TRANSMIT_INT(adv->ctx.xmit); + adv_int = BT_MESH_TRANSMIT_INT(BT_MESH_ADV(buf)->xmit); /* Upper boundary estimate: */ duration = num_events * (adv_int + 10); - LOG_DBG("type %u len %u: %s", adv->ctx.type, - adv->b.len, bt_hex(adv->b.data, adv->b.len)); + LOG_DBG("type %u len %u: %s", BT_MESH_ADV(buf)->type, + buf->len, bt_hex(buf->data, buf->len)); LOG_DBG("count %u interval %ums duration %ums", num_events, adv_int, duration); - ad.type = bt_mesh_adv_type[adv->ctx.type]; - ad.data_len = adv->b.len; - ad.data = adv->b.data; + ad.type = bt_mesh_adv_type[BT_MESH_ADV(buf)->type]; + ad.data_len = buf->len; + ad.data = buf->data; - err = bt_data_send(ext_adv, num_events, adv_int, &ad, 1); + err = bt_data_send(adv, num_events, adv_int, &ad, 1); if (!err) { - ext_adv->adv = bt_mesh_adv_ref(adv); + adv->buf = net_buf_ref(buf); } - bt_mesh_adv_send_start(duration, err, &adv->ctx); + bt_mesh_adv_send_start(duration, err, BT_MESH_ADV(buf)); return err; } @@ -267,50 +268,50 @@ static const char * const adv_tag_to_str[] = { static void send_pending_adv(struct k_work *work) { - struct bt_mesh_ext_adv *ext_adv; - struct bt_mesh_adv *adv; + struct bt_mesh_ext_adv *adv; + struct net_buf *buf; int err; - ext_adv = CONTAINER_OF(work, struct bt_mesh_ext_adv, work.work); + adv = CONTAINER_OF(work, struct bt_mesh_ext_adv, work.work); - if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_SENT)) { + if (atomic_test_and_clear_bit(adv->flags, ADV_FLAG_SENT)) { /* Calling k_uptime_delta on a timestamp moves it to the current time. * This is essential here, as schedule_send() uses the end of the event * as a reference to avoid sending the next advertisement too soon. */ - int64_t duration = k_uptime_delta(&ext_adv->timestamp); + int64_t duration = k_uptime_delta(&adv->timestamp); LOG_DBG("Advertising stopped after %u ms for %s", (uint32_t)duration, - ext_adv->adv ? adv_tag_to_str[ext_adv->adv->ctx.tag] : + adv->buf ? adv_tag_to_str[BT_MESH_ADV(adv->buf)->tag] : adv_tag_to_str[BT_MESH_ADV_TAG_PROXY]); - atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); - atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY); - atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); + atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(adv->flags, ADV_FLAG_PROXY); + atomic_clear_bit(adv->flags, ADV_FLAG_PROXY_START); - if (ext_adv->adv) { - bt_mesh_adv_unref(ext_adv->adv); - ext_adv->adv = NULL; + if (adv->buf) { + net_buf_unref(adv->buf); + adv->buf = NULL; } - (void)schedule_send(ext_adv); + (void)schedule_send(adv); return; } - atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULED); + atomic_clear_bit(adv->flags, ADV_FLAG_SCHEDULED); - while ((adv = bt_mesh_adv_get_by_tag(ext_adv->tags, K_NO_WAIT))) { + while ((buf = bt_mesh_adv_buf_get_by_tag(adv->tags, K_NO_WAIT))) { /* busy == 0 means this was canceled */ - if (!adv->ctx.busy) { - bt_mesh_adv_unref(adv); + if (!BT_MESH_ADV(buf)->busy) { + net_buf_unref(buf); continue; } - adv->ctx.busy = 0U; - err = adv_send(ext_adv, adv); + BT_MESH_ADV(buf)->busy = 0U; + err = buf_send(adv, buf); - bt_mesh_adv_unref(adv); + net_buf_unref(buf); if (!err) { return; /* Wait for advertising to finish */ @@ -318,7 +319,7 @@ static void send_pending_adv(struct k_work *work) } if (!IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER) || - !(ext_adv->tags & BT_MESH_ADV_TAG_BIT_PROXY)) { + !(adv->tags & BT_MESH_ADV_TAG_BIT_PROXY)) { return; } @@ -327,51 +328,51 @@ static void send_pending_adv(struct k_work *work) return; } - atomic_set_bit(ext_adv->flags, ADV_FLAG_PROXY_START); + atomic_set_bit(adv->flags, ADV_FLAG_PROXY_START); if (!bt_mesh_adv_gatt_send()) { - atomic_set_bit(ext_adv->flags, ADV_FLAG_PROXY); + atomic_set_bit(adv->flags, ADV_FLAG_PROXY); } - if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING)) { - schedule_send(ext_adv); + if (atomic_test_and_clear_bit(adv->flags, ADV_FLAG_SCHEDULE_PENDING)) { + schedule_send(adv); } } -static bool schedule_send(struct bt_mesh_ext_adv *ext_adv) +static bool schedule_send(struct bt_mesh_ext_adv *adv) { uint64_t timestamp; int64_t delta; - timestamp = ext_adv->timestamp; + timestamp = adv->timestamp; - if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_PROXY)) { - atomic_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START); - (void)bt_le_ext_adv_stop(ext_adv->instance); + if (atomic_test_and_clear_bit(adv->flags, ADV_FLAG_PROXY)) { + atomic_clear_bit(adv->flags, ADV_FLAG_PROXY_START); + (void)bt_le_ext_adv_stop(adv->instance); - atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); + atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); } - if (atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { - atomic_set_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); + if (atomic_test_bit(adv->flags, ADV_FLAG_ACTIVE)) { + atomic_set_bit(adv->flags, ADV_FLAG_SCHEDULE_PENDING); return false; - } else if (atomic_test_and_set_bit(ext_adv->flags, ADV_FLAG_SCHEDULED)) { + } else if (atomic_test_and_set_bit(adv->flags, ADV_FLAG_SCHEDULED)) { return false; } - atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); + atomic_clear_bit(adv->flags, ADV_FLAG_SCHEDULE_PENDING); if ((IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && - ext_adv->tags & BT_MESH_ADV_TAG_BIT_FRIEND) || - (CONFIG_BT_MESH_RELAY_ADV_SETS > 0 && ext_adv->tags & BT_MESH_ADV_TAG_BIT_RELAY)) { - k_work_reschedule(&ext_adv->work, K_NO_WAIT); + adv->tags & BT_MESH_ADV_TAG_BIT_FRIEND) || + (CONFIG_BT_MESH_RELAY_ADV_SETS > 0 && adv->tags & BT_MESH_ADV_TAG_BIT_RELAY)) { + k_work_reschedule(&adv->work, K_NO_WAIT); } else { /* The controller will send the next advertisement immediately. * Introduce a delay here to avoid sending the next mesh packet closer * to the previous packet than what's permitted by the specification. */ delta = k_uptime_delta(×tamp); - k_work_reschedule(&ext_adv->work, K_MSEC(ADV_INT_FAST_MS - delta)); + k_work_reschedule(&adv->work, K_MSEC(ADV_INT_FAST_MS - delta)); } return true; @@ -382,17 +383,17 @@ void bt_mesh_adv_gatt_update(void) (void)schedule_send(gatt_adv_get()); } -void bt_mesh_adv_local_ready(void) +void bt_mesh_adv_buf_local_ready(void) { (void)schedule_send(advs); } -void bt_mesh_adv_relay_ready(void) +void bt_mesh_adv_buf_relay_ready(void) { - struct bt_mesh_ext_adv *ext_adv = relay_adv_get(); + struct bt_mesh_ext_adv *adv = relay_adv_get(); for (int i = 0; i < CONFIG_BT_MESH_RELAY_ADV_SETS; i++) { - if (schedule_send(&ext_adv[i])) { + if (schedule_send(&adv[i])) { return; } } @@ -403,7 +404,7 @@ void bt_mesh_adv_relay_ready(void) } } -void bt_mesh_adv_friend_ready(void) +void bt_mesh_adv_buf_friend_ready(void) { if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE)) { schedule_send(&advs[1 + CONFIG_BT_MESH_RELAY_ADV_SETS]); @@ -412,33 +413,33 @@ void bt_mesh_adv_friend_ready(void) } } -void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) +void bt_mesh_adv_buf_terminate(const struct net_buf *buf) { int err; for (int i = 0; i < ARRAY_SIZE(advs); i++) { - struct bt_mesh_ext_adv *ext_adv = &advs[i]; + struct bt_mesh_ext_adv *adv = &advs[i]; - if (ext_adv->adv != adv) { + if (adv->buf != buf) { continue; } - if (!atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { + if (!atomic_test_bit(adv->flags, ADV_FLAG_ACTIVE)) { return; } - err = bt_le_ext_adv_stop(ext_adv->instance); + err = bt_le_ext_adv_stop(adv->instance); if (err) { LOG_ERR("Failed to stop adv %d", err); return; } /* Do not call `cb:end`, since this user action */ - adv->ctx.cb = NULL; + BT_MESH_ADV(adv->buf)->cb = NULL; - atomic_set_bit(ext_adv->flags, ADV_FLAG_SENT); + atomic_set_bit(adv->flags, ADV_FLAG_SENT); - k_work_submit(&ext_adv->work.work); + k_work_submit(&adv->work.work); return; } @@ -474,31 +475,31 @@ static struct bt_mesh_ext_adv *adv_instance_find(struct bt_le_ext_adv *instance) static void adv_sent(struct bt_le_ext_adv *instance, struct bt_le_ext_adv_sent_info *info) { - struct bt_mesh_ext_adv *ext_adv = adv_instance_find(instance); + struct bt_mesh_ext_adv *adv = adv_instance_find(instance); - if (!ext_adv) { + if (!adv) { LOG_WRN("Unexpected adv instance"); return; } - if (!atomic_test_bit(ext_adv->flags, ADV_FLAG_ACTIVE)) { + if (!atomic_test_bit(adv->flags, ADV_FLAG_ACTIVE)) { return; } - atomic_set_bit(ext_adv->flags, ADV_FLAG_SENT); + atomic_set_bit(adv->flags, ADV_FLAG_SENT); - k_work_submit(&ext_adv->work.work); + k_work_submit(&adv->work.work); } #if defined(CONFIG_BT_MESH_GATT_SERVER) static void connected(struct bt_le_ext_adv *instance, struct bt_le_ext_adv_connected_info *info) { - struct bt_mesh_ext_adv *ext_adv = gatt_adv_get(); + struct bt_mesh_ext_adv *adv = gatt_adv_get(); - if (atomic_test_and_clear_bit(ext_adv->flags, ADV_FLAG_PROXY_START)) { - atomic_clear_bit(ext_adv->flags, ADV_FLAG_ACTIVE); - (void)schedule_send(ext_adv); + if (atomic_test_and_clear_bit(adv->flags, ADV_FLAG_PROXY_START)) { + atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE); + (void)schedule_send(adv); } } #endif /* CONFIG_BT_MESH_GATT_SERVER */ @@ -572,7 +573,7 @@ int bt_mesh_adv_gatt_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_mesh_ext_adv *ext_adv = gatt_adv_get(); + struct bt_mesh_ext_adv *adv = gatt_adv_get(); struct bt_le_ext_adv_start_param start = { /* Timeout is set in 10 ms steps, with 0 indicating "forever" */ .timeout = (duration == SYS_FOREVER_MS) ? 0 : MAX(1, duration / 10), @@ -580,9 +581,9 @@ int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, LOG_DBG("Start advertising %d ms", duration); - atomic_set_bit(ext_adv->flags, ADV_FLAG_UPDATE_PARAMS); + atomic_set_bit(adv->flags, ADV_FLAG_UPDATE_PARAMS); - return adv_start(ext_adv, param, &start, ad, ad_len, sd, sd_len); + return adv_start(adv, param, &start, ad, ad_len, sd, sd_len); } int bt_mesh_adv_bt_data_send(uint8_t num_events, uint16_t adv_interval, diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index d4003e497bb..aef13864131 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -19,6 +19,7 @@ #include "host/hci_core.h" +#include "adv.h" #include "net.h" #include "foundation.h" #include "beacon.h" @@ -42,7 +43,7 @@ static bool enabled; static int bt_data_send(uint8_t num_events, uint16_t adv_int, const struct bt_data *ad, size_t ad_len, - struct bt_mesh_adv_ctx *ctx) + struct bt_mesh_adv *adv) { struct bt_le_adv_param param = {}; uint64_t uptime = k_uptime_get(); @@ -100,8 +101,8 @@ static int bt_data_send(uint8_t num_events, uint16_t adv_int, LOG_DBG("Advertising started. Sleeping %u ms", duration); - if (ctx) { - bt_mesh_adv_send_start(duration, err, ctx); + if (adv) { + bt_mesh_adv_send_start(duration, err, adv); } k_sleep(K_MSEC(duration)); @@ -123,37 +124,37 @@ int bt_mesh_adv_bt_data_send(uint8_t num_events, uint16_t adv_int, return bt_data_send(num_events, adv_int, ad, ad_len, NULL); } -static inline void adv_send(struct bt_mesh_adv *adv) +static inline void buf_send(struct net_buf *buf) { - uint16_t num_events = BT_MESH_TRANSMIT_COUNT(adv->ctx.xmit) + 1; + uint16_t num_events = BT_MESH_TRANSMIT_COUNT(BT_MESH_ADV(buf)->xmit) + 1; uint16_t adv_int; struct bt_data ad; - adv_int = BT_MESH_TRANSMIT_INT(adv->ctx.xmit); + adv_int = BT_MESH_TRANSMIT_INT(BT_MESH_ADV(buf)->xmit); - LOG_DBG("type %u len %u: %s", adv->ctx.type, - adv->b.len, bt_hex(adv->b.data, adv->b.len)); + LOG_DBG("type %u len %u: %s", BT_MESH_ADV(buf)->type, + buf->len, bt_hex(buf->data, buf->len)); - ad.type = bt_mesh_adv_type[adv->ctx.type]; - ad.data_len = adv->b.len; - ad.data = adv->b.data; + ad.type = bt_mesh_adv_type[BT_MESH_ADV(buf)->type]; + ad.data_len = buf->len; + ad.data = buf->data; - bt_data_send(num_events, adv_int, &ad, 1, &adv->ctx); + bt_data_send(num_events, adv_int, &ad, 1, BT_MESH_ADV(buf)); } static void adv_thread(void *p1, void *p2, void *p3) { LOG_DBG("started"); - struct bt_mesh_adv *adv; + struct net_buf *buf; while (enabled) { 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) { + buf = bt_mesh_adv_buf_get(K_NO_WAIT); + if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !buf) { (void)bt_mesh_sol_send(); } - while (!adv) { + while (!buf) { /* Adv timeout may be set by a call from proxy * to bt_mesh_adv_gatt_start: @@ -161,58 +162,58 @@ static void adv_thread(void *p1, void *p2, void *p3) adv_timeout = SYS_FOREVER_MS; (void)bt_mesh_adv_gatt_send(); - adv = bt_mesh_adv_get(SYS_TIMEOUT_MS(adv_timeout)); + buf = bt_mesh_adv_buf_get(SYS_TIMEOUT_MS(adv_timeout)); bt_le_adv_stop(); - if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !adv) { + if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !buf) { (void)bt_mesh_sol_send(); } } } else { - adv = bt_mesh_adv_get(K_FOREVER); + buf = bt_mesh_adv_buf_get(K_FOREVER); } - if (!adv) { + if (!buf) { continue; } /* busy == 0 means this was canceled */ - if (adv->ctx.busy) { - adv->ctx.busy = 0U; - adv_send(adv); + if (BT_MESH_ADV(buf)->busy) { + BT_MESH_ADV(buf)->busy = 0U; + buf_send(buf); } - bt_mesh_adv_unref(adv); + net_buf_unref(buf); /* Give other threads a chance to run */ k_yield(); } /* Empty the advertising pool when advertising is disabled */ - while ((adv = bt_mesh_adv_get(K_NO_WAIT))) { - bt_mesh_adv_send_start(0, -ENODEV, &adv->ctx); - bt_mesh_adv_unref(adv); + while ((buf = bt_mesh_adv_buf_get(K_NO_WAIT))) { + bt_mesh_adv_send_start(0, -ENODEV, BT_MESH_ADV(buf)); + net_buf_unref(buf); } } -void bt_mesh_adv_local_ready(void) +void bt_mesh_adv_buf_local_ready(void) { /* Will be handled automatically */ } -void bt_mesh_adv_relay_ready(void) +void bt_mesh_adv_buf_relay_ready(void) { /* Will be handled automatically */ } void bt_mesh_adv_gatt_update(void) { - bt_mesh_adv_get_cancel(); + bt_mesh_adv_buf_get_cancel(); } -void bt_mesh_adv_terminate(struct bt_mesh_adv *adv) +void bt_mesh_adv_buf_terminate(const struct net_buf *buf) { - ARG_UNUSED(adv); + ARG_UNUSED(buf); } void bt_mesh_adv_init(void) diff --git a/subsys/bluetooth/mesh/app_keys.c b/subsys/bluetooth/mesh/app_keys.c index 5afd887a8e8..a47d31447c5 100644 --- a/subsys/bluetooth/mesh/app_keys.c +++ b/subsys/bluetooth/mesh/app_keys.c @@ -17,6 +17,7 @@ #include "rpl.h" #include "settings.h" #include "crypto.h" +#include "adv.h" #include "proxy.h" #include "friend.h" #include "foundation.h" diff --git a/subsys/bluetooth/mesh/beacon.c b/subsys/bluetooth/mesh/beacon.c index ef337f9f510..afdea5b4c6a 100644 --- a/subsys/bluetooth/mesh/beacon.c +++ b/subsys/bluetooth/mesh/beacon.c @@ -16,6 +16,7 @@ #include "common/bt_str.h" +#include "adv.h" #include "mesh.h" #include "net.h" #include "prov.h" @@ -255,7 +256,7 @@ static bool net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *b .end = beacon_complete, }; uint32_t now = k_uptime_get_32(); - struct bt_mesh_adv *adv; + struct net_buf *buf; uint32_t time_diff; uint32_t time_since_last_recv; int err; @@ -270,19 +271,19 @@ static bool net_beacon_send(struct bt_mesh_subnet *sub, struct bt_mesh_beacon *b return false; } - adv = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, + buf = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, PROV_XMIT, K_NO_WAIT); - if (!adv) { - LOG_ERR("Unable to allocate beacon adv"); + if (!buf) { + LOG_ERR("Unable to allocate beacon buffer"); return true; /* Bail out */ } - err = beacon_create(sub, &adv->b); + err = beacon_create(sub, &buf->b); if (!err) { - bt_mesh_adv_send(adv, &send_cb, beacon); + bt_mesh_adv_send(buf, &send_cb, beacon); } - bt_mesh_adv_unref(adv); + net_buf_unref(buf); return err != 0; } @@ -329,22 +330,22 @@ static int unprovisioned_beacon_send(void) { const struct bt_mesh_prov *prov; uint8_t uri_hash[16] = { 0 }; - struct bt_mesh_adv *adv; + struct net_buf *buf; uint16_t oob_info; LOG_DBG(""); - adv = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, + buf = bt_mesh_adv_create(BT_MESH_ADV_BEACON, BT_MESH_ADV_TAG_LOCAL, UNPROV_XMIT, K_NO_WAIT); - if (!adv) { - LOG_ERR("Unable to allocate beacon adv"); + if (!buf) { + LOG_ERR("Unable to allocate beacon buffer"); return -ENOBUFS; } prov = bt_mesh_prov_get(); - net_buf_simple_add_u8(&adv->b, BEACON_TYPE_UNPROVISIONED); - net_buf_simple_add_mem(&adv->b, prov->uuid, 16); + net_buf_add_u8(buf, BEACON_TYPE_UNPROVISIONED); + net_buf_add_mem(buf, prov->uuid, 16); if (prov->uri && bt_mesh_s1_str(prov->uri, uri_hash) == 0) { oob_info = prov->oob_info | BT_MESH_PROV_OOB_URI; @@ -352,31 +353,31 @@ static int unprovisioned_beacon_send(void) oob_info = prov->oob_info; } - net_buf_simple_add_be16(&adv->b, oob_info); - net_buf_simple_add_mem(&adv->b, uri_hash, 4); + net_buf_add_be16(buf, oob_info); + net_buf_add_mem(buf, uri_hash, 4); - bt_mesh_adv_send(adv, NULL, NULL); - bt_mesh_adv_unref(adv); + bt_mesh_adv_send(buf, NULL, NULL); + net_buf_unref(buf); if (prov->uri) { size_t len; - adv = bt_mesh_adv_create(BT_MESH_ADV_URI, BT_MESH_ADV_TAG_LOCAL, + buf = bt_mesh_adv_create(BT_MESH_ADV_URI, BT_MESH_ADV_TAG_LOCAL, UNPROV_XMIT, K_NO_WAIT); - if (!adv) { - LOG_ERR("Unable to allocate URI adv"); + if (!buf) { + LOG_ERR("Unable to allocate URI buffer"); return -ENOBUFS; } len = strlen(prov->uri); - if (net_buf_simple_tailroom(&adv->b) < len) { + if (net_buf_tailroom(buf) < len) { LOG_WRN("Too long URI to fit advertising data"); } else { - net_buf_simple_add_mem(&adv->b, prov->uri, len); - bt_mesh_adv_send(adv, NULL, NULL); + net_buf_add_mem(buf, prov->uri, len); + bt_mesh_adv_send(buf, NULL, NULL); } - bt_mesh_adv_unref(adv); + net_buf_unref(buf); } return 0; diff --git a/subsys/bluetooth/mesh/cfg.c b/subsys/bluetooth/mesh/cfg.c index 4fef60d5c8d..c7bea0d29b0 100644 --- a/subsys/bluetooth/mesh/cfg.c +++ b/subsys/bluetooth/mesh/cfg.c @@ -14,6 +14,7 @@ #include "settings.h" #include "heartbeat.h" #include "friend.h" +#include "adv.h" #include "cfg.h" #include "od_priv_proxy.h" #include "priv_beacon.h" diff --git a/subsys/bluetooth/mesh/cfg_srv.c b/subsys/bluetooth/mesh/cfg_srv.c index 268f883d8b8..fa6bb48703a 100644 --- a/subsys/bluetooth/mesh/cfg_srv.c +++ b/subsys/bluetooth/mesh/cfg_srv.c @@ -21,6 +21,7 @@ #include "host/testing.h" #include "mesh.h" +#include "adv.h" #include "net.h" #include "rpl.h" #include "lpn.h" diff --git a/subsys/bluetooth/mesh/friend.c b/subsys/bluetooth/mesh/friend.c index 6fbd9f81a68..73b75eadf4f 100644 --- a/subsys/bluetooth/mesh/friend.c +++ b/subsys/bluetooth/mesh/friend.c @@ -13,6 +13,7 @@ #include #include "crypto.h" +#include "adv.h" #include "mesh.h" #include "net.h" #include "app_keys.h" @@ -1238,7 +1239,7 @@ static void friend_timeout(struct k_work *work) .start = buf_send_start, .end = buf_send_end, }; - struct bt_mesh_adv *adv; + struct net_buf *buf; uint8_t md; if (!friend_is_allocated(frnd)) { @@ -1280,19 +1281,19 @@ static void friend_timeout(struct k_work *work) frnd->queue_size--; send_last: - adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_FRIEND, + buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_FRIEND, FRIEND_XMIT, K_NO_WAIT); - if (!adv) { - LOG_ERR("Unable to allocate friend adv"); + if (!buf) { + LOG_ERR("Unable to allocate friend adv buffer"); return; } - net_buf_simple_add_mem(&adv->b, frnd->last->data, frnd->last->len); + net_buf_add_mem(buf, frnd->last->data, frnd->last->len); frnd->pending_req = 0U; frnd->pending_buf = 1U; - bt_mesh_adv_send(adv, &buf_sent_cb, frnd); - bt_mesh_adv_unref(adv); + bt_mesh_adv_send(buf, &buf_sent_cb, frnd); + net_buf_unref(buf); } static void subnet_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt) diff --git a/subsys/bluetooth/mesh/gatt_cli.c b/subsys/bluetooth/mesh/gatt_cli.c index 7814f32f27f..bff9b567011 100644 --- a/subsys/bluetooth/mesh/gatt_cli.c +++ b/subsys/bluetooth/mesh/gatt_cli.c @@ -18,6 +18,7 @@ #include "common/bt_str.h" #include "mesh.h" +#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/health_srv.c b/subsys/bluetooth/mesh/health_srv.c index 3db3410aa34..8611e1004f6 100644 --- a/subsys/bluetooth/mesh/health_srv.c +++ b/subsys/bluetooth/mesh/health_srv.c @@ -16,6 +16,7 @@ #include #include "mesh.h" +#include "adv.h" #include "net.h" #include "transport.h" #include "access.h" diff --git a/subsys/bluetooth/mesh/lpn.c b/subsys/bluetooth/mesh/lpn.c index f6f906b12fe..2b655f729f3 100644 --- a/subsys/bluetooth/mesh/lpn.c +++ b/subsys/bluetooth/mesh/lpn.c @@ -13,6 +13,7 @@ #include #include "crypto.h" +#include "adv.h" #include "mesh.h" #include "net.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 89115ebe3e8..24bbd7c7e94 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -18,6 +18,7 @@ #include #include "test.h" +#include "adv.h" #include "prov.h" #include "provisioner.h" #include "net.h" diff --git a/subsys/bluetooth/mesh/net.c b/subsys/bluetooth/mesh/net.c index 943a5e83c23..6a9f29b4064 100644 --- a/subsys/bluetooth/mesh/net.c +++ b/subsys/bluetooth/mesh/net.c @@ -20,6 +20,7 @@ #include "common/bt_str.h" #include "crypto.h" +#include "adv.h" #include "mesh.h" #include "net.h" #include "rpl.h" @@ -525,19 +526,19 @@ static int net_loopback(const struct bt_mesh_net_tx *tx, const uint8_t *data, return 0; } -int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct bt_mesh_adv *adv, +int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf, const struct bt_mesh_send_cb *cb, void *cb_data) { const struct bt_mesh_net_cred *cred; int err; LOG_DBG("src 0x%04x dst 0x%04x len %u headroom %zu tailroom %zu", tx->src, tx->ctx->addr, - adv->b.len, net_buf_simple_headroom(&adv->b), net_buf_simple_tailroom(&adv->b)); - LOG_DBG("Payload len %u: %s", adv->b.len, bt_hex(adv->b.data, adv->b.len)); + buf->len, net_buf_headroom(buf), net_buf_tailroom(buf)); + LOG_DBG("Payload len %u: %s", buf->len, bt_hex(buf->data, buf->len)); LOG_DBG("Seq 0x%06x", bt_mesh.seq); cred = net_tx_cred_get(tx); - err = net_header_encode(tx, cred->nid, &adv->b); + err = net_header_encode(tx, cred->nid, &buf->b); if (err) { goto done; } @@ -545,7 +546,7 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct bt_mesh_adv *adv, /* Deliver to local network interface if necessary */ if (bt_mesh_fixed_group_match(tx->ctx->addr) || bt_mesh_has_addr(tx->ctx->addr)) { - err = net_loopback(tx, adv->b.data, adv->b.len); + err = net_loopback(tx, buf->data, buf->len); /* Local unicast messages should not go out to network */ if (BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr) || @@ -568,28 +569,28 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct bt_mesh_adv *adv, goto done; } - err = net_encrypt(&adv->b, cred, BT_MESH_NET_IVI_TX, BT_MESH_NONCE_NETWORK); + err = net_encrypt(&buf->b, cred, BT_MESH_NET_IVI_TX, BT_MESH_NONCE_NETWORK); if (err) { goto done; } - adv->ctx.cb = cb; - adv->ctx.cb_data = cb_data; + BT_MESH_ADV(buf)->cb = cb; + BT_MESH_ADV(buf)->cb_data = cb_data; /* Deliver to GATT Proxy Clients if necessary. */ if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) { - (void)bt_mesh_proxy_relay(adv, tx->ctx->addr); + (void)bt_mesh_proxy_relay(buf, tx->ctx->addr); } /* Deliver to GATT Proxy Servers if necessary. */ if (IS_ENABLED(CONFIG_BT_MESH_PROXY_CLIENT)) { - (void)bt_mesh_proxy_cli_relay(adv); + (void)bt_mesh_proxy_cli_relay(buf); } - bt_mesh_adv_send(adv, cb, cb_data); + bt_mesh_adv_send(buf, cb, cb_data); done: - bt_mesh_adv_unref(adv); + net_buf_unref(buf); return err; } @@ -683,7 +684,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, struct bt_mesh_net_rx *rx) { const struct bt_mesh_net_cred *cred; - struct bt_mesh_adv *adv; + struct net_buf *buf; uint8_t transmit; if (rx->ctx.recv_ttl <= 1U) { @@ -710,10 +711,10 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, transmit = bt_mesh_net_transmit_get(); } - adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_RELAY, + buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_RELAY, transmit, K_NO_WAIT); - if (!adv) { - LOG_DBG("Out of relay advs"); + if (!buf) { + LOG_DBG("Out of relay buffers"); return; } @@ -721,23 +722,23 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, sbuf->data[1] &= 0x80; sbuf->data[1] |= rx->ctx.recv_ttl - 1U; - net_buf_simple_add_mem(&adv->b, sbuf->data, sbuf->len); + net_buf_add_mem(buf, sbuf->data, sbuf->len); cred = &rx->sub->keys[SUBNET_KEY_TX_IDX(rx->sub)].msg; - LOG_DBG("Relaying packet. TTL is now %u", TTL(adv->b.data)); + LOG_DBG("Relaying packet. TTL is now %u", TTL(buf->data)); /* Update NID if RX or RX was with friend credentials */ if (rx->friend_cred) { - adv->b.data[0] &= 0x80; /* Clear everything except IVI */ - adv->b.data[0] |= cred->nid; + buf->data[0] &= 0x80; /* Clear everything except IVI */ + buf->data[0] |= cred->nid; } /* We re-encrypt and obfuscate using the received IVI rather than * the normal TX IVI (which may be different) since the transport * layer nonce includes the IVI. */ - if (net_encrypt(&adv->b, cred, BT_MESH_NET_IVI_RX(rx), BT_MESH_NONCE_NETWORK)) { + if (net_encrypt(&buf->b, cred, BT_MESH_NET_IVI_RX(rx), BT_MESH_NONCE_NETWORK)) { LOG_ERR("Re-encrypting failed"); goto done; } @@ -750,15 +751,15 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, (rx->friend_cred || bt_mesh_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED || bt_mesh_priv_gatt_proxy_get() == BT_MESH_PRIV_GATT_PROXY_ENABLED)) { - bt_mesh_proxy_relay(adv, rx->ctx.recv_dst); + bt_mesh_proxy_relay(buf, rx->ctx.recv_dst); } if (relay_to_adv(rx->net_if) || rx->friend_cred) { - bt_mesh_adv_send(adv, NULL, NULL); + bt_mesh_adv_send(buf, NULL, NULL); } done: - bt_mesh_adv_unref(adv); + net_buf_unref(buf); } void bt_mesh_net_header_parse(struct net_buf_simple *buf, diff --git a/subsys/bluetooth/mesh/net.h b/subsys/bluetooth/mesh/net.h index 28c21da3eaf..04179a4dd49 100644 --- a/subsys/bluetooth/mesh/net.h +++ b/subsys/bluetooth/mesh/net.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "adv.h" #include "subnet.h" #include @@ -292,7 +291,7 @@ bool bt_mesh_net_iv_update(uint32_t iv_index, bool iv_update); int bt_mesh_net_encode(struct bt_mesh_net_tx *tx, struct net_buf_simple *buf, enum bt_mesh_nonce_type type); -int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct bt_mesh_adv *adv, +int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf, const struct bt_mesh_send_cb *cb, void *cb_data); int bt_mesh_net_decode(struct net_buf_simple *in, enum bt_mesh_net_if net_if, diff --git a/subsys/bluetooth/mesh/pb_adv.c b/subsys/bluetooth/mesh/pb_adv.c index f723ff48c14..e273739ed72 100644 --- a/subsys/bluetooth/mesh/pb_adv.c +++ b/subsys/bluetooth/mesh/pb_adv.c @@ -11,6 +11,7 @@ #include #include "host/testing.h" #include "net.h" +#include "adv.h" #include "crypto.h" #include "beacon.h" #include "prov.h" @@ -100,8 +101,8 @@ struct pb_adv { /* Transaction timeout in seconds */ uint8_t timeout; - /* Pending outgoing adv(s) */ - struct bt_mesh_adv *adv[3]; + /* Pending outgoing buffer(s) */ + struct net_buf *buf[3]; prov_bearer_send_complete_t cb; @@ -169,24 +170,24 @@ static void free_segments(void) { int i; - for (i = 0; i < ARRAY_SIZE(link.tx.adv); i++) { - struct bt_mesh_adv *adv = link.tx.adv[i]; + for (i = 0; i < ARRAY_SIZE(link.tx.buf); i++) { + struct net_buf *buf = link.tx.buf[i]; - if (!adv) { + if (!buf) { break; } - link.tx.adv[i] = NULL; + link.tx.buf[i] = NULL; /* Terminate active adv */ - if (adv->ctx.busy == 0U) { - bt_mesh_adv_terminate(adv); + if (BT_MESH_ADV(buf)->busy == 0U) { + bt_mesh_adv_buf_terminate(buf); } else { /* Mark as canceled */ - adv->ctx.busy = 0U; + BT_MESH_ADV(buf)->busy = 0U; } - bt_mesh_adv_unref(adv); + net_buf_unref(buf); } } @@ -199,7 +200,7 @@ static void prov_clear_tx(void) { LOG_DBG(""); - /* If this fails, the work handler will not find any advs to send, + /* If this fails, the work handler will not find any buffers to send, * and return without rescheduling. The work handler also checks the * LINK_ACTIVE flag, so if this call is part of reset_adv_link, it'll * exit early. @@ -253,19 +254,19 @@ static void close_link(enum prov_bearer_link_status reason) cb->link_closed(&bt_mesh_pb_adv, cb_data, reason); } -static struct bt_mesh_adv *adv_create(uint8_t retransmits) +static struct net_buf *adv_buf_create(uint8_t retransmits) { - struct bt_mesh_adv *adv; + struct net_buf *buf; - adv = bt_mesh_adv_create(BT_MESH_ADV_PROV, BT_MESH_ADV_TAG_PROV, + buf = bt_mesh_adv_create(BT_MESH_ADV_PROV, BT_MESH_ADV_TAG_PROV, BT_MESH_TRANSMIT(retransmits, 20), BUF_TIMEOUT); - if (!adv) { - LOG_ERR("Out of provisioning advs"); + if (!buf) { + LOG_ERR("Out of provisioning buffers"); return NULL; } - return adv; + return buf; } static void ack_complete(uint16_t duration, int err, void *user_data) @@ -327,7 +328,7 @@ static void gen_prov_ack_send(uint8_t xact_id) .start = ack_complete, }; const struct bt_mesh_send_cb *complete; - struct bt_mesh_adv *adv; + struct net_buf *buf; bool pending = atomic_test_and_set_bit(link.flags, ADV_ACK_PENDING); LOG_DBG("xact_id 0x%x", xact_id); @@ -337,8 +338,8 @@ static void gen_prov_ack_send(uint8_t xact_id) return; } - adv = adv_create(RETRANSMITS_ACK); - if (!adv) { + buf = adv_buf_create(RETRANSMITS_ACK); + if (!buf) { atomic_clear_bit(link.flags, ADV_ACK_PENDING); return; } @@ -350,12 +351,12 @@ static void gen_prov_ack_send(uint8_t xact_id) complete = &cb; } - net_buf_simple_add_be32(&adv->b, link.id); - net_buf_simple_add_u8(&adv->b, xact_id); - net_buf_simple_add_u8(&adv->b, GPC_ACK); + net_buf_add_be32(buf, link.id); + net_buf_add_u8(buf, xact_id); + net_buf_add_u8(buf, GPC_ACK); - bt_mesh_adv_send(adv, complete, NULL); - bt_mesh_adv_unref(adv); + bt_mesh_adv_send(buf, complete, NULL); + net_buf_unref(buf); } static void gen_prov_cont(struct prov_rx *rx, struct net_buf_simple *buf) @@ -430,7 +431,7 @@ static void gen_prov_ack(struct prov_rx *rx, struct net_buf_simple *buf) { LOG_DBG("len %u", buf->len); - if (!link.tx.adv[0]) { + if (!link.tx.buf[0]) { return; } @@ -595,20 +596,20 @@ static void send_reliable(void) { int i; - for (i = 0; i < ARRAY_SIZE(link.tx.adv); i++) { - struct bt_mesh_adv *adv = link.tx.adv[i]; + for (i = 0; i < ARRAY_SIZE(link.tx.buf); i++) { + struct net_buf *buf = link.tx.buf[i]; - if (!adv) { + if (!buf) { break; } - if (adv->ctx.busy) { + if (BT_MESH_ADV(buf)->busy) { continue; } - LOG_DBG("%u bytes: %s", adv->b.len, bt_hex(adv->b.data, adv->b.len)); + LOG_DBG("%u bytes: %s", buf->len, bt_hex(buf->data, buf->len)); - bt_mesh_adv_send(adv, NULL, NULL); + bt_mesh_adv_send(buf, NULL, NULL); } k_work_reschedule(&link.tx.retransmit, RETRANSMIT_TIMEOUT); @@ -632,30 +633,30 @@ static void prov_retransmit(struct k_work *work) send_reliable(); } -static struct bt_mesh_adv *ctl_adv_create(uint8_t op, const void *data, uint8_t data_len, - uint8_t retransmits) +static struct net_buf *ctl_buf_create(uint8_t op, const void *data, uint8_t data_len, + uint8_t retransmits) { - struct bt_mesh_adv *adv; + struct net_buf *buf; LOG_DBG("op 0x%02x data_len %u", op, data_len); - adv = adv_create(retransmits); - if (!adv) { + buf = adv_buf_create(retransmits); + if (!buf) { return NULL; } - net_buf_simple_add_be32(&adv->b, link.id); + net_buf_add_be32(buf, link.id); /* Transaction ID, always 0 for Bearer messages */ - net_buf_simple_add_u8(&adv->b, 0x00); - net_buf_simple_add_u8(&adv->b, GPC_CTL(op)); - net_buf_simple_add_mem(&adv->b, data, data_len); + net_buf_add_u8(buf, 0x00); + net_buf_add_u8(buf, GPC_CTL(op)); + net_buf_add_mem(buf, data, data_len); - return adv; + return buf; } -static int bearer_ctl_send(struct bt_mesh_adv *adv) +static int bearer_ctl_send(struct net_buf *buf) { - if (!adv) { + if (!buf) { return -ENOMEM; } @@ -663,23 +664,23 @@ static int bearer_ctl_send(struct bt_mesh_adv *adv) k_work_reschedule(&link.prot_timer, bt_mesh_prov_protocol_timeout_get()); link.tx.start = k_uptime_get(); - link.tx.adv[0] = adv; + link.tx.buf[0] = buf; send_reliable(); return 0; } -static int bearer_ctl_send_unacked(struct bt_mesh_adv *adv, void *user_data) +static int bearer_ctl_send_unacked(struct net_buf *buf, void *user_data) { - if (!adv) { + if (!buf) { return -ENOMEM; } prov_clear_tx(); k_work_reschedule(&link.prot_timer, bt_mesh_prov_protocol_timeout_get()); - bt_mesh_adv_send(adv, &buf_sent_cb, user_data); - bt_mesh_adv_unref(adv); + bt_mesh_adv_send(buf, &buf_sent_cb, user_data); + net_buf_unref(buf); return 0; } @@ -687,26 +688,26 @@ static int bearer_ctl_send_unacked(struct bt_mesh_adv *adv, void *user_data) static int prov_send_adv(struct net_buf_simple *msg, prov_bearer_send_complete_t cb, void *cb_data) { - struct bt_mesh_adv *start, *adv; + struct net_buf *start, *buf; uint8_t seg_len, seg_id; prov_clear_tx(); k_work_reschedule(&link.prot_timer, bt_mesh_prov_protocol_timeout_get()); - start = adv_create(RETRANSMITS_RELIABLE); + start = adv_buf_create(RETRANSMITS_RELIABLE); if (!start) { return -ENOBUFS; } link.tx.id = next_transaction_id(link.tx.id); - net_buf_simple_add_be32(&start->b, link.id); - net_buf_simple_add_u8(&start->b, link.tx.id); + net_buf_add_be32(start, link.id); + net_buf_add_u8(start, link.tx.id); - net_buf_simple_add_u8(&start->b, GPC_START(last_seg(msg->len))); - net_buf_simple_add_be16(&start->b, msg->len); - net_buf_simple_add_u8(&start->b, bt_mesh_fcs_calc(msg->data, msg->len)); + net_buf_add_u8(start, GPC_START(last_seg(msg->len))); + net_buf_add_be16(start, msg->len); + net_buf_add_u8(start, bt_mesh_fcs_calc(msg->data, msg->len)); - link.tx.adv[0] = start; + link.tx.buf[0] = start; link.tx.cb = cb; link.tx.cb_data = cb_data; link.tx.start = k_uptime_get(); @@ -715,33 +716,33 @@ static int prov_send_adv(struct net_buf_simple *msg, seg_len = MIN(msg->len, START_PAYLOAD_MAX); LOG_DBG("seg 0 len %u: %s", seg_len, bt_hex(msg->data, seg_len)); - net_buf_simple_add_mem(&start->b, msg->data, seg_len); + net_buf_add_mem(start, msg->data, seg_len); net_buf_simple_pull(msg, seg_len); - adv = start; + buf = start; for (seg_id = 1U; msg->len > 0; seg_id++) { - if (seg_id >= ARRAY_SIZE(link.tx.adv)) { + if (seg_id >= ARRAY_SIZE(link.tx.buf)) { LOG_ERR("Too big message"); free_segments(); return -E2BIG; } - adv = adv_create(RETRANSMITS_RELIABLE); - if (!adv) { + buf = adv_buf_create(RETRANSMITS_RELIABLE); + if (!buf) { free_segments(); return -ENOBUFS; } - link.tx.adv[seg_id] = adv; + link.tx.buf[seg_id] = buf; seg_len = MIN(msg->len, CONT_PAYLOAD_MAX); LOG_DBG("seg %u len %u: %s", seg_id, seg_len, bt_hex(msg->data, seg_len)); - net_buf_simple_add_be32(&adv->b, link.id); - net_buf_simple_add_u8(&adv->b, link.tx.id); - net_buf_simple_add_u8(&adv->b, GPC_CONT(seg_id)); - net_buf_simple_add_mem(&adv->b, msg->data, seg_len); + net_buf_add_be32(buf, link.id); + net_buf_add_u8(buf, link.tx.id); + net_buf_add_u8(buf, GPC_CONT(seg_id)); + net_buf_add_mem(buf, msg->data, seg_len); net_buf_simple_pull(msg, seg_len); } @@ -775,7 +776,7 @@ static void link_open(struct prov_rx *rx, struct net_buf_simple *buf) LOG_DBG("Resending link ack"); /* Ignore errors, message will be attempted again if we keep receiving link open: */ (void)bearer_ctl_send_unacked( - ctl_adv_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), + ctl_buf_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), (void *)PROV_BEARER_LINK_STATUS_SUCCESS); return; } @@ -790,7 +791,7 @@ static void link_open(struct prov_rx *rx, struct net_buf_simple *buf) net_buf_simple_reset(link.rx.buf); err = bearer_ctl_send_unacked( - ctl_adv_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), + ctl_buf_create(LINK_ACK, NULL, 0, RETRANSMITS_ACK), (void *)PROV_BEARER_LINK_STATUS_SUCCESS); if (err) { reset_adv_link(); @@ -890,7 +891,7 @@ static int prov_link_open(const uint8_t uuid[16], uint8_t timeout, net_buf_simple_reset(link.rx.buf); - return bearer_ctl_send(ctl_adv_create(LINK_OPEN, uuid, 16, RETRANSMITS_RELIABLE)); + return bearer_ctl_send(ctl_buf_create(LINK_OPEN, uuid, 16, RETRANSMITS_RELIABLE)); } static int prov_link_accept(const struct prov_bearer_cb *cb, void *cb_data) @@ -935,7 +936,7 @@ static void prov_link_close(enum prov_bearer_link_status status) link.tx.timeout = CLOSING_TIMEOUT; /* Ignore errors, the link will time out eventually if this doesn't get sent */ bearer_ctl_send_unacked( - ctl_adv_create(LINK_CLOSE, &status, 1, RETRANSMITS_LINK_CLOSE), + ctl_buf_create(LINK_CLOSE, &status, 1, RETRANSMITS_LINK_CLOSE), (void *)status); } diff --git a/subsys/bluetooth/mesh/pb_gatt.c b/subsys/bluetooth/mesh/pb_gatt.c index 849914f4b5f..f8acc8f6c5a 100644 --- a/subsys/bluetooth/mesh/pb_gatt.c +++ b/subsys/bluetooth/mesh/pb_gatt.c @@ -8,6 +8,7 @@ #include #include "net.h" #include "proxy.h" +#include "adv.h" #include "prov.h" #include "pb_gatt.h" #include "proxy_msg.h" diff --git a/subsys/bluetooth/mesh/pb_gatt_cli.c b/subsys/bluetooth/mesh/pb_gatt_cli.c index bf7dc14029a..9231cc0f0b1 100644 --- a/subsys/bluetooth/mesh/pb_gatt_cli.c +++ b/subsys/bluetooth/mesh/pb_gatt_cli.c @@ -16,6 +16,7 @@ #include #include "mesh.h" +#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/pb_gatt_srv.c b/subsys/bluetooth/mesh/pb_gatt_srv.c index f4fdac53570..f6d9298fc78 100644 --- a/subsys/bluetooth/mesh/pb_gatt_srv.c +++ b/subsys/bluetooth/mesh/pb_gatt_srv.c @@ -17,6 +17,7 @@ #include "common/bt_str.h" #include "mesh.h" +#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" diff --git a/subsys/bluetooth/mesh/priv_beacon_srv.c b/subsys/bluetooth/mesh/priv_beacon_srv.c index 98be589fc22..5b5e62f1736 100644 --- a/subsys/bluetooth/mesh/priv_beacon_srv.c +++ b/subsys/bluetooth/mesh/priv_beacon_srv.c @@ -5,6 +5,7 @@ */ #include #include "net.h" +#include "adv.h" #include #include "proxy.h" #include "foundation.h" diff --git a/subsys/bluetooth/mesh/prov_device.c b/subsys/bluetooth/mesh/prov_device.c index 6ca65c2ec63..af890396ac7 100644 --- a/subsys/bluetooth/mesh/prov_device.c +++ b/subsys/bluetooth/mesh/prov_device.c @@ -20,6 +20,7 @@ #include "common/bt_str.h" #include "crypto.h" +#include "adv.h" #include "mesh.h" #include "net.h" #include "rpl.h" diff --git a/subsys/bluetooth/mesh/provisioner.c b/subsys/bluetooth/mesh/provisioner.c index ba02723e830..aba2449892f 100644 --- a/subsys/bluetooth/mesh/provisioner.c +++ b/subsys/bluetooth/mesh/provisioner.c @@ -21,6 +21,7 @@ #include "common/bt_str.h" #include "crypto.h" +#include "adv.h" #include "mesh.h" #include "net.h" #include "rpl.h" diff --git a/subsys/bluetooth/mesh/proxy.h b/subsys/bluetooth/mesh/proxy.h index 34a119c3df6..a2f6bb45ff6 100644 --- a/subsys/bluetooth/mesh/proxy.h +++ b/subsys/bluetooth/mesh/proxy.h @@ -34,6 +34,6 @@ int bt_mesh_proxy_adv_start(void); void bt_mesh_proxy_identity_start(struct bt_mesh_subnet *sub, bool private); void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub); -bool bt_mesh_proxy_relay(struct bt_mesh_adv *adv, uint16_t dst); +bool bt_mesh_proxy_relay(struct net_buf *buf, uint16_t dst); void bt_mesh_proxy_addr_add(struct net_buf_simple *buf, uint16_t addr); uint8_t bt_mesh_proxy_srv_connected_cnt(void); diff --git a/subsys/bluetooth/mesh/proxy_cli.c b/subsys/bluetooth/mesh/proxy_cli.c index 5dd6b02361f..a0a25751b41 100644 --- a/subsys/bluetooth/mesh/proxy_cli.c +++ b/subsys/bluetooth/mesh/proxy_cli.c @@ -16,6 +16,7 @@ #include #include "mesh.h" +#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" @@ -78,7 +79,7 @@ static struct bt_mesh_proxy_server *find_proxy_srv_by_conn(struct bt_conn *conn) return NULL; } -bool bt_mesh_proxy_cli_relay(struct bt_mesh_adv *adv) +bool bt_mesh_proxy_cli_relay(struct net_buf *buf) { bool relayed = false; int i; @@ -90,7 +91,7 @@ bool bt_mesh_proxy_cli_relay(struct bt_mesh_adv *adv) continue; } - if (bt_mesh_proxy_relay_send(server->role->conn, adv)) { + if (bt_mesh_proxy_relay_send(server->role->conn, buf)) { continue; } diff --git a/subsys/bluetooth/mesh/proxy_cli.h b/subsys/bluetooth/mesh/proxy_cli.h index c0b69f4aaf6..8c1fae10e84 100644 --- a/subsys/bluetooth/mesh/proxy_cli.h +++ b/subsys/bluetooth/mesh/proxy_cli.h @@ -8,6 +8,6 @@ void bt_mesh_proxy_cli_adv_recv(const struct bt_le_scan_recv_info *info, struct net_buf_simple *buf); -bool bt_mesh_proxy_cli_relay(struct bt_mesh_adv *adv); +bool bt_mesh_proxy_cli_relay(struct net_buf *buf); bool bt_mesh_proxy_cli_is_connected(uint16_t net_idx); diff --git a/subsys/bluetooth/mesh/proxy_msg.c b/subsys/bluetooth/mesh/proxy_msg.c index b2fa113d456..025909e0503 100644 --- a/subsys/bluetooth/mesh/proxy_msg.c +++ b/subsys/bluetooth/mesh/proxy_msg.c @@ -21,6 +21,7 @@ #include "common/bt_str.h" #include "mesh.h" +#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" @@ -195,12 +196,12 @@ int bt_mesh_proxy_msg_send(struct bt_conn *conn, uint8_t type, static void buf_send_end(struct bt_conn *conn, void *user_data) { - struct bt_mesh_adv *adv = user_data; + struct net_buf *buf = user_data; - bt_mesh_adv_unref(adv); + net_buf_unref(buf); } -int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv) +int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct net_buf *buf) { int err; @@ -210,12 +211,12 @@ int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv) * so we need to make a copy. */ net_buf_simple_reserve(&msg, 1); - net_buf_simple_add_mem(&msg, adv->b.data, adv->b.len); + net_buf_simple_add_mem(&msg, buf->data, buf->len); err = bt_mesh_proxy_msg_send(conn, BT_MESH_PROXY_NET_PDU, - &msg, buf_send_end, bt_mesh_adv_ref(adv)); + &msg, buf_send_end, net_buf_ref(buf)); - bt_mesh_adv_send_start(0, err, &adv->ctx); + bt_mesh_adv_send_start(0, err, BT_MESH_ADV(buf)); if (err) { LOG_ERR("Failed to send proxy message (err %d)", err); @@ -224,7 +225,7 @@ int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv) * which is just opaque data to segment_and send) reference given * to segment_and_send() here. */ - bt_mesh_adv_unref(adv); + net_buf_unref(buf); } return err; diff --git a/subsys/bluetooth/mesh/proxy_msg.h b/subsys/bluetooth/mesh/proxy_msg.h index 7ad4be7ae5d..7d4bd51ae4f 100644 --- a/subsys/bluetooth/mesh/proxy_msg.h +++ b/subsys/bluetooth/mesh/proxy_msg.h @@ -51,7 +51,7 @@ ssize_t bt_mesh_proxy_msg_recv(struct bt_conn *conn, int bt_mesh_proxy_msg_send(struct bt_conn *conn, uint8_t type, struct net_buf_simple *msg, bt_gatt_complete_func_t end, void *user_data); -int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv); +int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct net_buf *buf); struct bt_mesh_proxy_role *bt_mesh_proxy_role_setup(struct bt_conn *conn, 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 45e29915325..571144ceaed 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -20,6 +20,7 @@ #include "common/bt_str.h" #include "mesh.h" +#include "adv.h" #include "net.h" #include "rpl.h" #include "transport.h" @@ -1021,12 +1022,12 @@ static bool client_filter_match(struct bt_mesh_proxy_client *client, return false; } -bool bt_mesh_proxy_relay(struct bt_mesh_adv *adv, uint16_t dst) +bool bt_mesh_proxy_relay(struct net_buf *buf, uint16_t dst) { bool relayed = false; int i; - LOG_DBG("%u bytes to dst 0x%04x", adv->b.len, dst); + LOG_DBG("%u bytes to dst 0x%04x", buf->len, dst); for (i = 0; i < ARRAY_SIZE(clients); i++) { struct bt_mesh_proxy_client *client = &clients[i]; @@ -1039,7 +1040,7 @@ bool bt_mesh_proxy_relay(struct bt_mesh_adv *adv, uint16_t dst) continue; } - if (bt_mesh_proxy_relay_send(client->cli->conn, adv)) { + if (bt_mesh_proxy_relay_send(client->cli->conn, buf)) { continue; } diff --git a/subsys/bluetooth/mesh/rpl.c b/subsys/bluetooth/mesh/rpl.c index df67ddf9d2e..e19df33908f 100644 --- a/subsys/bluetooth/mesh/rpl.c +++ b/subsys/bluetooth/mesh/rpl.c @@ -20,6 +20,7 @@ #include #include "mesh.h" +#include "adv.h" #include "net.h" #include "rpl.h" #include "settings.h" diff --git a/subsys/bluetooth/mesh/rpr_srv.c b/subsys/bluetooth/mesh/rpr_srv.c index e97df35f28f..9813842a367 100644 --- a/subsys/bluetooth/mesh/rpr_srv.c +++ b/subsys/bluetooth/mesh/rpr_srv.c @@ -14,6 +14,7 @@ #include #include #include "access.h" +#include "adv.h" #include "prov.h" #include "crypto.h" #include "rpr.h" diff --git a/subsys/bluetooth/mesh/solicitation.c b/subsys/bluetooth/mesh/solicitation.c index 642abfd87f1..e2100fa42db 100644 --- a/subsys/bluetooth/mesh/solicitation.c +++ b/subsys/bluetooth/mesh/solicitation.c @@ -12,6 +12,7 @@ #include #include #include "access.h" +#include "adv.h" #include "cfg.h" #include "crypto.h" #include "mesh.h" diff --git a/subsys/bluetooth/mesh/statistic.c b/subsys/bluetooth/mesh/statistic.c index b9f542a5923..21c451bee73 100644 --- a/subsys/bluetooth/mesh/statistic.c +++ b/subsys/bluetooth/mesh/statistic.c @@ -6,6 +6,7 @@ #include +#include "adv.h" #include "net.h" #include "statistic.h" @@ -21,24 +22,24 @@ void bt_mesh_stat_reset(void) memset(&stat, 0, sizeof(struct bt_mesh_statistic)); } -void bt_mesh_stat_planned_count(struct bt_mesh_adv_ctx *ctx) +void bt_mesh_stat_planned_count(struct bt_mesh_adv *adv) { - if (ctx->tag == BT_MESH_ADV_TAG_LOCAL) { + if (adv->tag == BT_MESH_ADV_TAG_LOCAL) { stat.tx_local_planned++; - } else if (ctx->tag == BT_MESH_ADV_TAG_RELAY) { + } else if (adv->tag == BT_MESH_ADV_TAG_RELAY) { stat.tx_adv_relay_planned++; - } else if (ctx->tag == BT_MESH_ADV_TAG_FRIEND) { + } else if (adv->tag == BT_MESH_ADV_TAG_FRIEND) { stat.tx_friend_planned++; } } -void bt_mesh_stat_succeeded_count(struct bt_mesh_adv_ctx *ctx) +void bt_mesh_stat_succeeded_count(struct bt_mesh_adv *adv) { - if (ctx->tag == BT_MESH_ADV_TAG_LOCAL) { + if (adv->tag == BT_MESH_ADV_TAG_LOCAL) { stat.tx_local_succeeded++; - } else if (ctx->tag == BT_MESH_ADV_TAG_RELAY) { + } else if (adv->tag == BT_MESH_ADV_TAG_RELAY) { stat.tx_adv_relay_succeeded++; - } else if (ctx->tag == BT_MESH_ADV_TAG_FRIEND) { + } else if (adv->tag == BT_MESH_ADV_TAG_FRIEND) { stat.tx_friend_succeeded++; } } diff --git a/subsys/bluetooth/mesh/statistic.h b/subsys/bluetooth/mesh/statistic.h index 4cd9187f45a..fdb488f0d81 100644 --- a/subsys/bluetooth/mesh/statistic.h +++ b/subsys/bluetooth/mesh/statistic.h @@ -7,8 +7,8 @@ #ifndef ZEPHYR_SUBSYS_BLUETOOTH_MESH_STATISTIC_H_ #define ZEPHYR_SUBSYS_BLUETOOTH_MESH_STATISTIC_H_ -void bt_mesh_stat_planned_count(struct bt_mesh_adv_ctx *ctx); -void bt_mesh_stat_succeeded_count(struct bt_mesh_adv_ctx *ctx); +void bt_mesh_stat_planned_count(struct bt_mesh_adv *adv); +void bt_mesh_stat_succeeded_count(struct bt_mesh_adv *adv); void bt_mesh_stat_rx(enum bt_mesh_net_if net_if); #endif /* ZEPHYR_SUBSYS_BLUETOOTH_MESH_STATISTIC_H_ */ diff --git a/subsys/bluetooth/mesh/subnet.c b/subsys/bluetooth/mesh/subnet.c index 695dd321b49..ef90ff8f725 100644 --- a/subsys/bluetooth/mesh/subnet.c +++ b/subsys/bluetooth/mesh/subnet.c @@ -22,6 +22,7 @@ #include "common/bt_str.h" #include "crypto.h" +#include "adv.h" #include "mesh.h" #include "net.h" #include "lpn.h" diff --git a/subsys/bluetooth/mesh/transport.c b/subsys/bluetooth/mesh/transport.c index 47e8492a901..94c1f698e91 100644 --- a/subsys/bluetooth/mesh/transport.c +++ b/subsys/bluetooth/mesh/transport.c @@ -22,6 +22,7 @@ #include "host/testing.h" #include "crypto.h" +#include "adv.h" #include "mesh.h" #include "net.h" #include "app_keys.h" @@ -121,26 +122,26 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, const struct bt_mesh_send_cb *cb, void *cb_data, const uint8_t *ctl_op) { - struct bt_mesh_adv *adv; + struct net_buf *buf; - adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, tx->xmit, BUF_TIMEOUT); - if (!adv) { - LOG_ERR("Out of network advs"); + if (!buf) { + LOG_ERR("Out of network buffers"); return -ENOBUFS; } - net_buf_simple_reserve(&adv->b, BT_MESH_NET_HDR_LEN); + net_buf_reserve(buf, BT_MESH_NET_HDR_LEN); if (ctl_op) { - net_buf_simple_add_u8(&adv->b, TRANS_CTL_HDR(*ctl_op, 0)); + net_buf_add_u8(buf, TRANS_CTL_HDR(*ctl_op, 0)); } else if (BT_MESH_IS_DEV_KEY(tx->ctx->app_idx)) { - net_buf_simple_add_u8(&adv->b, UNSEG_HDR(0, 0)); + net_buf_add_u8(buf, UNSEG_HDR(0, 0)); } else { - net_buf_simple_add_u8(&adv->b, UNSEG_HDR(1, tx->aid)); + net_buf_add_u8(buf, UNSEG_HDR(1, tx->aid)); } - net_buf_simple_add_mem(&adv->b, sdu->data, sdu->len); + net_buf_add_mem(buf, sdu->data, sdu->len); if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { if (!bt_mesh_friend_queue_has_space(tx->sub->net_idx, @@ -148,7 +149,7 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, NULL, 1)) { if (BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { LOG_ERR("Not enough space in Friend Queue"); - bt_mesh_adv_unref(adv); + net_buf_unref(buf); return -ENOBUFS; } else { LOG_WRN("No space in Friend Queue"); @@ -157,19 +158,19 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, } if (bt_mesh_friend_enqueue_tx(tx, BT_MESH_FRIEND_PDU_SINGLE, - NULL, 1, &adv->b) && + NULL, 1, &buf->b) && BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { /* PDUs for a specific Friend should only go * out through the Friend Queue. */ - bt_mesh_adv_unref(adv); + net_buf_unref(buf); send_cb_finalize(cb, cb_data); return 0; } } send: - return bt_mesh_net_send(tx, adv, cb, cb_data); + return bt_mesh_net_send(tx, buf, cb, cb_data); } static inline uint8_t seg_len(bool ctl) @@ -404,7 +405,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx) (uint16_t)(tx->seq_auth & TRANS_SEQ_ZERO_MASK), tx->attempts_left); while (tx->seg_o <= tx->seg_n) { - struct bt_mesh_adv *seg; + struct net_buf *seg; int err; if (!tx->seg[tx->seg_o]) { @@ -420,7 +421,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx) goto end; } - net_buf_simple_reserve(&seg->b, BT_MESH_NET_HDR_LEN); + net_buf_reserve(seg, BT_MESH_NET_HDR_LEN); seg_tx_buf_build(tx, tx->seg_o, &seg->b); LOG_DBG("Sending %u/%u", tx->seg_o, tx->seg_n); diff --git a/subsys/bluetooth/mesh/transport_legacy.c b/subsys/bluetooth/mesh/transport_legacy.c index 1a826db4ac4..da0c1830f73 100644 --- a/subsys/bluetooth/mesh/transport_legacy.c +++ b/subsys/bluetooth/mesh/transport_legacy.c @@ -22,6 +22,7 @@ #include "host/testing.h" #include "crypto.h" +#include "adv.h" #include "mesh.h" #include "net.h" #include "app_keys.h" @@ -128,26 +129,26 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, const struct bt_mesh_send_cb *cb, void *cb_data, const uint8_t *ctl_op) { - struct bt_mesh_adv *adv; + struct net_buf *buf; - adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, tx->xmit, BUF_TIMEOUT); - if (!adv) { - LOG_ERR("Out of network advs"); + if (!buf) { + LOG_ERR("Out of network buffers"); return -ENOBUFS; } - net_buf_simple_reserve(&adv->b, BT_MESH_NET_HDR_LEN); + net_buf_reserve(buf, BT_MESH_NET_HDR_LEN); if (ctl_op) { - net_buf_simple_add_u8(&adv->b, TRANS_CTL_HDR(*ctl_op, 0)); + net_buf_add_u8(buf, TRANS_CTL_HDR(*ctl_op, 0)); } else if (BT_MESH_IS_DEV_KEY(tx->ctx->app_idx)) { - net_buf_simple_add_u8(&adv->b, UNSEG_HDR(0, 0)); + net_buf_add_u8(buf, UNSEG_HDR(0, 0)); } else { - net_buf_simple_add_u8(&adv->b, UNSEG_HDR(1, tx->aid)); + net_buf_add_u8(buf, UNSEG_HDR(1, tx->aid)); } - net_buf_simple_add_mem(&adv->b, sdu->data, sdu->len); + net_buf_add_mem(buf, sdu->data, sdu->len); if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) { if (!bt_mesh_friend_queue_has_space(tx->sub->net_idx, @@ -155,7 +156,7 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, NULL, 1)) { if (BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { LOG_ERR("Not enough space in Friend Queue"); - bt_mesh_adv_unref(adv); + net_buf_unref(buf); return -ENOBUFS; } @@ -164,19 +165,19 @@ static int send_unseg(struct bt_mesh_net_tx *tx, struct net_buf_simple *sdu, } if (bt_mesh_friend_enqueue_tx(tx, BT_MESH_FRIEND_PDU_SINGLE, - NULL, 1, &adv->b) && + NULL, 1, &buf->b) && BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { /* PDUs for a specific Friend should only go * out through the Friend Queue. */ - bt_mesh_adv_unref(adv); + net_buf_unref(buf); send_cb_finalize(cb, cb_data); return 0; } } send: - return bt_mesh_net_send(tx, adv, cb, cb_data); + return bt_mesh_net_send(tx, buf, cb, cb_data); } static inline uint8_t seg_len(bool ctl) @@ -391,7 +392,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx) tx->attempts); while (tx->seg_o <= tx->seg_n) { - struct bt_mesh_adv *seg; + struct net_buf *seg; int err; if (!tx->seg[tx->seg_o]) { @@ -407,7 +408,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx) goto end; } - net_buf_simple_reserve(&seg->b, BT_MESH_NET_HDR_LEN); + net_buf_reserve(seg, BT_MESH_NET_HDR_LEN); seg_tx_buf_build(tx, tx->seg_o, &seg->b); LOG_DBG("Sending %u/%u", tx->seg_o, tx->seg_n); diff --git a/tests/bsim/bluetooth/mesh/src/test_advertiser.c b/tests/bsim/bluetooth/mesh/src/test_advertiser.c index 47851fc72f4..073651ae843 100644 --- a/tests/bsim/bluetooth/mesh/src/test_advertiser.c +++ b/tests/bsim/bluetooth/mesh/src/test_advertiser.c @@ -7,6 +7,7 @@ #include #include #include "mesh_test.h" +#include "mesh/adv.h" #include "mesh/net.h" #include "mesh/mesh.h" #include "mesh/foundation.h" @@ -77,25 +78,25 @@ static void adv_init(void) ASSERT_OK_MSG(bt_mesh_adv_enable(), "Mesh adv init failed"); } -static void allocate_all_array(struct bt_mesh_adv **adv, size_t num_adv, uint8_t xmit) +static void allocate_all_array(struct net_buf **buf, size_t num_buf, uint8_t xmit) { - for (int i = 0; i < num_adv; i++) { - *adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + for (int i = 0; i < num_buf; i++) { + *buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, xmit, K_NO_WAIT); - ASSERT_FALSE_MSG(!*adv, "Out of advs\n"); - adv++; + ASSERT_FALSE_MSG(!*buf, "Out of buffers\n"); + buf++; } } static void verify_adv_queue_overflow(void) { - struct bt_mesh_adv *dummy_adv; + struct net_buf *dummy_buf; /* Verity Queue overflow */ - dummy_adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + dummy_buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, BT_MESH_TRANSMIT(2, 20), K_NO_WAIT); - ASSERT_TRUE_MSG(!dummy_adv, "Unexpected extra adv\n"); + ASSERT_TRUE_MSG(!dummy_buf, "Unexpected extra buffer\n"); } static bool check_delta_time(uint8_t transmit, uint64_t interval) @@ -156,12 +157,12 @@ static void single_end_cb(int err, void *cb_data) static void realloc_end_cb(int err, void *cb_data) { - struct bt_mesh_adv *adv = (struct bt_mesh_adv *)cb_data; + struct net_buf *buf = (struct net_buf *)cb_data; ASSERT_EQUAL(0, err); - adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, BT_MESH_TRANSMIT(2, 20), K_NO_WAIT); - ASSERT_FALSE_MSG(!adv, "Out of advs\n"); + ASSERT_FALSE_MSG(!buf, "Out of buffers\n"); k_sem_give(&observer_sem); } @@ -304,13 +305,13 @@ static void rx_xmit_adv(void) static void send_order_start_cb(uint16_t duration, int err, void *user_data) { - struct bt_mesh_adv *adv = (struct bt_mesh_adv *)user_data; + struct net_buf *buf = (struct net_buf *)user_data; ASSERT_OK_MSG(err, "Failed adv start cb err (%d)", err); - ASSERT_EQUAL(2, adv->b.len); + ASSERT_EQUAL(2, buf->len); - uint8_t current = adv->b.data[0]; - uint8_t previous = adv->b.data[1]; + uint8_t current = buf->data[0]; + uint8_t previous = buf->data[1]; LOG_INF("tx start: current(%d) previous(%d)", current, previous); @@ -320,7 +321,10 @@ static void send_order_start_cb(uint16_t duration, int err, void *user_data) static void send_order_end_cb(int err, void *user_data) { + struct net_buf *buf = (struct net_buf *)user_data; + ASSERT_OK_MSG(err, "Failed adv start cb err (%d)", err); + ASSERT_TRUE_MSG(!buf->data, "Data not cleared!\n"); seq_checker++; LOG_INF("tx end: seq(%d)", seq_checker); @@ -376,19 +380,19 @@ static void receive_order(int expect_adv) ASSERT_FALSE_MSG(err && err != -EALREADY, "Stopping scan failed (err %d)\n", err); } -static void send_adv_buf(struct bt_mesh_adv *adv, uint8_t curr, uint8_t prev) +static void send_adv_buf(struct net_buf *buf, uint8_t curr, uint8_t prev) { send_cb.start = send_order_start_cb; send_cb.end = send_order_end_cb; - (void)net_buf_simple_add_u8(&adv->b, curr); - (void)net_buf_simple_add_u8(&adv->b, prev); + (void)net_buf_add_u8(buf, curr); + (void)net_buf_add_u8(buf, prev); - bt_mesh_adv_send(adv, &send_cb, adv); - bt_mesh_adv_unref(adv); + bt_mesh_adv_send(buf, &send_cb, buf); + net_buf_unref(buf); } -static void send_adv_array(struct bt_mesh_adv **adv, size_t num_buf, bool reverse) +static void send_adv_array(struct net_buf **buf, size_t num_buf, bool reverse) { uint8_t previous; int i; @@ -401,13 +405,13 @@ static void send_adv_array(struct bt_mesh_adv **adv, size_t num_buf, bool revers i = num_buf - 1; } while ((!reverse && i < num_buf) || (reverse && i >= 0)) { - send_adv_buf(*adv, (uint8_t)i, previous); + send_adv_buf(*buf, (uint8_t)i, previous); previous = (uint8_t)i; if (!reverse) { - adv++; + buf++; i++; } else { - adv--; + buf--; i--; } } @@ -415,24 +419,24 @@ static void send_adv_array(struct bt_mesh_adv **adv, size_t num_buf, bool revers static void test_tx_cb_single(void) { - struct bt_mesh_adv *adv; + struct net_buf *buf; int err; bt_init(); adv_init(); - adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, BT_MESH_TRANSMIT(2, 20), K_NO_WAIT); - ASSERT_FALSE_MSG(!adv, "Out of advs\n"); + ASSERT_FALSE_MSG(!buf, "Out of buffers\n"); send_cb.start = single_start_cb; send_cb.end = single_end_cb; - net_buf_simple_add_mem(&adv->b, txt_msg, sizeof(txt_msg)); + net_buf_add_mem(buf, txt_msg, sizeof(txt_msg)); seq_checker = 0; tx_timestamp = k_uptime_get(); - bt_mesh_adv_send(adv, &send_cb, (void *)cb_msg); - bt_mesh_adv_unref(adv); + bt_mesh_adv_send(buf, &send_cb, (void *)cb_msg); + net_buf_unref(buf); err = k_sem_take(&observer_sem, K_SECONDS(1)); ASSERT_OK_MSG(err, "Didn't call end tx cb."); @@ -453,37 +457,37 @@ static void test_rx_xmit(void) static void test_tx_cb_multi(void) { - struct bt_mesh_adv *adv[CONFIG_BT_MESH_ADV_BUF_COUNT]; + struct net_buf *buf[CONFIG_BT_MESH_ADV_BUF_COUNT]; int err; bt_init(); adv_init(); - /* Allocate all network advs. */ - allocate_all_array(adv, ARRAY_SIZE(adv), BT_MESH_TRANSMIT(2, 20)); + /* Allocate all network buffers. */ + allocate_all_array(buf, ARRAY_SIZE(buf), BT_MESH_TRANSMIT(2, 20)); - /* Start single adv to reallocate one network adv in callback. - * Check that the adv is freed before cb is triggered. + /* Start single adv to reallocate one network buffer in callback. + * Check that the buffer is freed before cb is triggered. */ send_cb.start = NULL; send_cb.end = realloc_end_cb; - net_buf_simple_add_mem(&(adv[0]->b), txt_msg, sizeof(txt_msg)); + net_buf_add_mem(buf[0], txt_msg, sizeof(txt_msg)); - bt_mesh_adv_send(adv[0], &send_cb, adv[0]); - bt_mesh_adv_unref(adv[0]); + bt_mesh_adv_send(buf[0], &send_cb, buf[0]); + net_buf_unref(buf[0]); err = k_sem_take(&observer_sem, K_SECONDS(1)); - ASSERT_OK_MSG(err, "Didn't call the end tx cb that reallocates adv one more time."); + ASSERT_OK_MSG(err, "Didn't call the end tx cb that reallocates buffer one more time."); - /* Start multi advs to check that all advs are sent and cbs are triggered. */ + /* Start multi advs to check that all buffers are sent and cbs are triggered. */ send_cb.start = seq_start_cb; send_cb.end = seq_end_cb; seq_checker = 0; for (int i = 0; i < CONFIG_BT_MESH_ADV_BUF_COUNT; i++) { - net_buf_simple_add_le32(&(adv[i]->b), i); - bt_mesh_adv_send(adv[i], &send_cb, (void *)(intptr_t)i); - bt_mesh_adv_unref(adv[i]); + net_buf_add_le32(buf[i], i); + bt_mesh_adv_send(buf[i], &send_cb, (void *)(intptr_t)i); + net_buf_unref(buf[i]); } err = k_sem_take(&observer_sem, K_SECONDS(10)); @@ -526,10 +530,10 @@ static void test_tx_proxy_mixin(void) * Advertising the proxy service should be resumed after * finishing advertising the message. */ - struct bt_mesh_adv *adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + struct net_buf *buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, BT_MESH_TRANSMIT(5, 20), K_NO_WAIT); - net_buf_simple_add_mem(&adv->b, txt_msg, sizeof(txt_msg)); - bt_mesh_adv_send(adv, NULL, NULL); + net_buf_add_mem(buf, txt_msg, sizeof(txt_msg)); + bt_mesh_adv_send(buf, NULL, NULL); k_sleep(K_MSEC(150)); /* Let the tester to measure an interval between advertisements again. */ @@ -573,46 +577,46 @@ static void test_rx_proxy_mixin(void) static void test_tx_send_order(void) { - struct bt_mesh_adv *adv[CONFIG_BT_MESH_ADV_BUF_COUNT]; + struct net_buf *buf[CONFIG_BT_MESH_ADV_BUF_COUNT]; uint8_t xmit = BT_MESH_TRANSMIT(2, 20); bt_init(); adv_init(); /* Verify sending order */ - allocate_all_array(adv, ARRAY_SIZE(adv), xmit); + allocate_all_array(buf, ARRAY_SIZE(buf), xmit); verify_adv_queue_overflow(); - send_adv_array(&adv[0], ARRAY_SIZE(adv), false); + send_adv_array(&buf[0], ARRAY_SIZE(buf), false); /* Wait for no message receive window to end. */ ASSERT_OK_MSG(k_sem_take(&observer_sem, K_SECONDS(10)), "Didn't call the last end tx cb."); - /* Verify adv allocation/deallocation after sending */ - allocate_all_array(adv, ARRAY_SIZE(adv), xmit); + /* Verify buffer allocation/deallocation after sending */ + allocate_all_array(buf, ARRAY_SIZE(buf), xmit); verify_adv_queue_overflow(); for (int i = 0; i < CONFIG_BT_MESH_ADV_BUF_COUNT; i++) { - bt_mesh_adv_unref(adv[i]); - adv[i] = NULL; + net_buf_unref(buf[i]); + buf[i] = NULL; } - /* Check that it possible to add just one net adv. */ - allocate_all_array(adv, 1, xmit); + /* Check that it possible to add just one net buf. */ + allocate_all_array(buf, 1, xmit); PASS(); } static void test_tx_reverse_order(void) { - struct bt_mesh_adv *adv[CONFIG_BT_MESH_ADV_BUF_COUNT]; + struct net_buf *buf[CONFIG_BT_MESH_ADV_BUF_COUNT]; uint8_t xmit = BT_MESH_TRANSMIT(2, 20); bt_init(); adv_init(); /* Verify reversed sending order */ - allocate_all_array(adv, ARRAY_SIZE(adv), xmit); + allocate_all_array(buf, ARRAY_SIZE(buf), xmit); - send_adv_array(&adv[CONFIG_BT_MESH_ADV_BUF_COUNT - 1], ARRAY_SIZE(adv), true); + send_adv_array(&buf[CONFIG_BT_MESH_ADV_BUF_COUNT - 1], ARRAY_SIZE(buf), true); /* Wait for no message receive window to end. */ ASSERT_OK_MSG(k_sem_take(&observer_sem, K_SECONDS(10)), @@ -623,31 +627,31 @@ static void test_tx_reverse_order(void) static void test_tx_random_order(void) { - struct bt_mesh_adv *adv[3]; + struct net_buf *buf[3]; uint8_t xmit = BT_MESH_TRANSMIT(0, 20); bt_init(); adv_init(); /* Verify random order calls */ - num_adv_sent = ARRAY_SIZE(adv); + num_adv_sent = ARRAY_SIZE(buf); previous_checker = 0xff; - adv[0] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + buf[0] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, xmit, K_NO_WAIT); - ASSERT_FALSE_MSG(!adv[0], "Out of advs\n"); - adv[1] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + ASSERT_FALSE_MSG(!buf[0], "Out of buffers\n"); + buf[1] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, xmit, K_NO_WAIT); - ASSERT_FALSE_MSG(!adv[1], "Out of advs\n"); + ASSERT_FALSE_MSG(!buf[1], "Out of buffers\n"); - send_adv_buf(adv[0], 0, 0xff); + send_adv_buf(buf[0], 0, 0xff); - adv[2] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, + buf[2] = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, xmit, K_NO_WAIT); - ASSERT_FALSE_MSG(!adv[2], "Out of advs\n"); + ASSERT_FALSE_MSG(!buf[2], "Out of buffers\n"); - send_adv_buf(adv[2], 2, 0); + send_adv_buf(buf[2], 2, 0); - send_adv_buf(adv[1], 1, 2); + send_adv_buf(buf[1], 1, 2); /* Wait for no message receive window to end. */ ASSERT_OK_MSG(k_sem_take(&observer_sem, K_SECONDS(10)), diff --git a/tests/bsim/bluetooth/mesh/src/test_beacon.c b/tests/bsim/bluetooth/mesh/src/test_beacon.c index 038c705f2cb..e93c2301e46 100644 --- a/tests/bsim/bluetooth/mesh/src/test_beacon.c +++ b/tests/bsim/bluetooth/mesh/src/test_beacon.c @@ -6,6 +6,7 @@ #include #include #include "mesh_test.h" +#include "mesh/adv.h" #include "mesh/net.h" #include "mesh/beacon.h" #include "mesh/mesh.h" diff --git a/tests/bsim/bluetooth/mesh/src/test_blob.c b/tests/bsim/bluetooth/mesh/src/test_blob.c index 0d3a69da2fc..4258ff77c62 100644 --- a/tests/bsim/bluetooth/mesh/src/test_blob.c +++ b/tests/bsim/bluetooth/mesh/src/test_blob.c @@ -6,9 +6,9 @@ #include "mesh_test.h" #include "dfu_blob_common.h" #include "friendship_common.h" -#include "mesh/adv.h" #include "mesh/blob.h" #include "argparse.h" +#include "mesh/adv.h" #define LOG_MODULE_NAME test_blob diff --git a/tests/bsim/bluetooth/mesh/src/test_dfu.c b/tests/bsim/bluetooth/mesh/src/test_dfu.c index 1b54e873cc5..06f7248a6ad 100644 --- a/tests/bsim/bluetooth/mesh/src/test_dfu.c +++ b/tests/bsim/bluetooth/mesh/src/test_dfu.c @@ -6,6 +6,7 @@ #include "mesh_test.h" #include "mesh/dfd_srv_internal.h" #include "mesh/dfu_slot.h" +#include "mesh/adv.h" #include "mesh/dfu.h" #include "mesh/blob.h" #include "argparse.h" diff --git a/tests/bsim/bluetooth/mesh/src/test_provision.c b/tests/bsim/bluetooth/mesh/src/test_provision.c index 3d0e8010c75..f2c98778a3b 100644 --- a/tests/bsim/bluetooth/mesh/src/test_provision.c +++ b/tests/bsim/bluetooth/mesh/src/test_provision.c @@ -28,6 +28,7 @@ #define LOG_MODULE_NAME mesh_prov #include +#include "mesh/adv.h" #include "mesh/rpr.h" LOG_MODULE_REGISTER(LOG_MODULE_NAME); diff --git a/tests/bsim/bluetooth/mesh/src/test_scanner.c b/tests/bsim/bluetooth/mesh/src/test_scanner.c index a63284701df..12557b7e1b2 100644 --- a/tests/bsim/bluetooth/mesh/src/test_scanner.c +++ b/tests/bsim/bluetooth/mesh/src/test_scanner.c @@ -6,6 +6,7 @@ #include #include "mesh_test.h" #include "mesh/net.h" +#include "mesh/adv.h" #include "mesh/mesh.h" #include "mesh/foundation.h" From c9cdf64ac11c9bd53e3175ea1879f906c58fc790 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:10 +0100 Subject: [PATCH 1276/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Convert no opcode error to debug log" This reverts commit 37fcdbafb6e73d1c56d7add8e377a9471751ee0d. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 81e2902afd1..dcf7f0f783b 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -1424,7 +1424,7 @@ static int element_model_recv(struct bt_mesh_msg_ctx *ctx, struct net_buf_simple op = find_op(elem, opcode, &model); if (!op) { - LOG_DBG("No OpCode 0x%08x for elem 0x%02x", opcode, elem->rt->addr); + LOG_ERR("No OpCode 0x%08x for elem 0x%02x", opcode, elem->rt->addr); return ACCESS_STATUS_WRONG_OPCODE; } From a01aac697a7498704e7552c810450e8a1bdb2b42 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:11 +0100 Subject: [PATCH 1277/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Allow custom RPL use mesh settings work" This reverts commit 3a7a2d0e40710427c7bd8cd922b576c775d02f1f. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/settings.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/settings.c b/subsys/bluetooth/mesh/settings.c index 8ec9c66481a..9cfcb3f5c2c 100644 --- a/subsys/bluetooth/mesh/settings.c +++ b/subsys/bluetooth/mesh/settings.c @@ -186,7 +186,8 @@ static void store_pending(struct k_work *work) { LOG_DBG(""); - if (atomic_test_and_clear_bit(pending_flags, BT_MESH_SETTINGS_RPL_PENDING)) { + if (IS_ENABLED(CONFIG_BT_MESH_RPL_STORAGE_MODE_SETTINGS) && + atomic_test_and_clear_bit(pending_flags, BT_MESH_SETTINGS_RPL_PENDING)) { bt_mesh_rpl_pending_store(BT_MESH_ADDR_ALL_NODES); } From 7ea847c3ddd541689045acde1db8a65495c268ce Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:11 +0100 Subject: [PATCH 1278/2300] Revert "[nrf fromtree] Bluetooth: Mesh: suspend/resume advertising" This reverts commit 5abc83dee7b26d73994d90e2647e4a347730ebaa. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/main.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index 24bbd7c7e94..2c78ea227de 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -460,13 +460,6 @@ int bt_mesh_suspend(void) bt_mesh_model_foreach(model_suspend, NULL); - err = bt_mesh_adv_disable(); - if (err) { - atomic_clear_bit(bt_mesh.flags, BT_MESH_SUSPENDED); - LOG_WRN("Disabling advertisers failed (err %d)", err); - return err; - } - return 0; } @@ -495,17 +488,6 @@ int bt_mesh_resume(void) return -EALREADY; } - if (!IS_ENABLED(CONFIG_BT_EXT_ADV)) { - bt_mesh_adv_init(); - } - - err = bt_mesh_adv_enable(); - if (err) { - atomic_set_bit(bt_mesh.flags, BT_MESH_SUSPENDED); - LOG_WRN("Re-enabling advertisers failed (err %d)", err); - return err; - } - err = bt_mesh_scan_enable(); if (err) { LOG_WRN("Re-enabling scanning failed (err %d)", err); From 4ea310fb59b16a1985429c066d7ef8faab2b1f1f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:11 +0100 Subject: [PATCH 1279/2300] Revert "[nrf fromtree] Bluetooth: Mesh: advertiser: add disable function" This reverts commit 624e83f15f6761fbb4b50413a7eea34475fcbbd2. Signed-off-by: Robert Lubos --- include/zephyr/bluetooth/mesh/main.h | 4 ---- subsys/bluetooth/mesh/adv.h | 3 --- subsys/bluetooth/mesh/adv_ext.c | 30 ---------------------------- subsys/bluetooth/mesh/adv_legacy.c | 21 +++---------------- 4 files changed, 3 insertions(+), 55 deletions(-) diff --git a/include/zephyr/bluetooth/mesh/main.h b/include/zephyr/bluetooth/mesh/main.h index a213e8ce22c..8e7445fae6f 100644 --- a/include/zephyr/bluetooth/mesh/main.h +++ b/include/zephyr/bluetooth/mesh/main.h @@ -607,10 +607,6 @@ void bt_mesh_reset(void); * If at all possible, the Friendship feature should be used instead, to * make the node into a Low Power Node. * - * @note Should not be called from work queue due to undefined behavior. - * This is due to k_work_flush_delayable() being used in disabling of the - * extended advertising. - * * @return 0 on success, or (negative) error code on failure. */ int bt_mesh_suspend(void); diff --git a/subsys/bluetooth/mesh/adv.h b/subsys/bluetooth/mesh/adv.h index 42b07601ad5..a80ff7e8d4b 100644 --- a/subsys/bluetooth/mesh/adv.h +++ b/subsys/bluetooth/mesh/adv.h @@ -80,9 +80,6 @@ int bt_mesh_scan_disable(void); int bt_mesh_adv_enable(void); -/* Should not be called from work queue due to undefined behavior */ -int bt_mesh_adv_disable(void); - void bt_mesh_adv_buf_local_ready(void); void bt_mesh_adv_buf_relay_ready(void); diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 9f0caa582ed..0c11fc0053a 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -538,36 +538,6 @@ int bt_mesh_adv_enable(void) return 0; } -int bt_mesh_adv_disable(void) -{ - int err; - struct k_work_sync sync; - - for (int i = 0; i < ARRAY_SIZE(advs); i++) { - k_work_flush_delayable(&advs[i].work, &sync); - - err = bt_le_ext_adv_stop(advs[i].instance); - if (err) { - LOG_ERR("Failed to stop adv %d", err); - return err; - } - - /* `adv_sent` is called to finish transmission of an adv buffer that was pushed to - * the host before the advertiser was stopped, but did not finish. - */ - adv_sent(advs[i].instance, NULL); - - err = bt_le_ext_adv_delete(advs[i].instance); - if (err) { - LOG_ERR("Failed to delete adv %d", err); - return err; - } - advs[i].instance = NULL; - } - - return 0; -} - int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, int32_t duration, const struct bt_data *ad, size_t ad_len, diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index aef13864131..a7d7dd1a320 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -39,7 +39,6 @@ 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 int bt_data_send(uint8_t num_events, uint16_t adv_int, const struct bt_data *ad, size_t ad_len, @@ -145,9 +144,10 @@ static inline void buf_send(struct net_buf *buf) static void adv_thread(void *p1, void *p2, void *p3) { LOG_DBG("started"); - struct net_buf *buf; - while (enabled) { + while (1) { + struct net_buf *buf; + if (IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER)) { buf = bt_mesh_adv_buf_get(K_NO_WAIT); if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !buf) { @@ -188,12 +188,6 @@ static void adv_thread(void *p1, void *p2, void *p3) /* Give other threads a chance to run */ k_yield(); } - - /* Empty the advertising pool when advertising is disabled */ - while ((buf = bt_mesh_adv_buf_get(K_NO_WAIT))) { - bt_mesh_adv_send_start(0, -ENODEV, BT_MESH_ADV(buf)); - net_buf_unref(buf); - } } void bt_mesh_adv_buf_local_ready(void) @@ -227,19 +221,10 @@ void bt_mesh_adv_init(void) int bt_mesh_adv_enable(void) { - enabled = true; k_thread_start(&adv_thread_data); return 0; } -int bt_mesh_adv_disable(void) -{ - enabled = false; - k_thread_join(&adv_thread_data, K_FOREVER); - LOG_DBG("Advertising disabled"); - return 0; -} - int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, int32_t duration, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len) From 0c3b8ed325aa562b75dbc5b300bdce3ea1061505 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:11 +0100 Subject: [PATCH 1280/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Align some code" This reverts commit 44714f3e1960913deba6bfc0f2e62e5383f623ac. Signed-off-by: Robert Lubos --- include/zephyr/bluetooth/mesh/access.h | 4 ++-- include/zephyr/bluetooth/mesh/blob_cli.h | 8 ++++---- include/zephyr/bluetooth/mesh/cdb.h | 2 +- include/zephyr/bluetooth/mesh/cfg_cli.h | 20 ++++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/zephyr/bluetooth/mesh/access.h b/include/zephyr/bluetooth/mesh/access.h index d57f30f8f05..817fba918ef 100644 --- a/include/zephyr/bluetooth/mesh/access.h +++ b/include/zephyr/bluetooth/mesh/access.h @@ -1011,7 +1011,7 @@ const struct bt_mesh_elem *bt_mesh_model_elem(const struct bt_mesh_model *mod); * if no SIG model with the given ID exists in the given element. */ const struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem, - uint16_t id); + uint16_t id); /** @brief Find a vendor model. * @@ -1023,7 +1023,7 @@ const struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem, * if no vendor model with the given ID exists in the given element. */ const struct bt_mesh_model *bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem, - uint16_t company, uint16_t id); + uint16_t company, uint16_t id); /** @brief Get whether the model is in the primary element of the device. * diff --git a/include/zephyr/bluetooth/mesh/blob_cli.h b/include/zephyr/bluetooth/mesh/blob_cli.h index 9b591cfdd35..8e239b31457 100644 --- a/include/zephyr/bluetooth/mesh/blob_cli.h +++ b/include/zephyr/bluetooth/mesh/blob_cli.h @@ -265,10 +265,10 @@ struct blob_cli_broadcast_ctx { void (*send)(struct bt_mesh_blob_cli *cli, uint16_t dst); /** Called after every @ref blob_cli_broadcast_ctx::send callback. */ void (*send_complete)(struct bt_mesh_blob_cli *cli, uint16_t dst); - /** If @ref blob_cli_broadcast_ctx::acked is true, called after all Target nodes - * have confirmed reception by @ref blob_cli_broadcast_rsp. Otherwise, called - * after transmission has been completed. - */ + /** If @ref blob_cli_broadcast_ctx::acked is true, called after all Target nodes + * have confirmed reception by @ref blob_cli_broadcast_rsp. Otherwise, called + * after transmission has been completed. + */ void (*next)(struct bt_mesh_blob_cli *cli); /** If true, every transmission needs to be confirmed by @ref blob_cli_broadcast_rsp before * @ref blob_cli_broadcast_ctx::next is called. diff --git a/include/zephyr/bluetooth/mesh/cdb.h b/include/zephyr/bluetooth/mesh/cdb.h index 8ea35ec2e55..800ae07edc4 100644 --- a/include/zephyr/bluetooth/mesh/cdb.h +++ b/include/zephyr/bluetooth/mesh/cdb.h @@ -231,7 +231,7 @@ enum { * or BT_MESH_CDB_ITER_STOP to stop. */ typedef uint8_t (*bt_mesh_cdb_node_func_t)(struct bt_mesh_cdb_node *node, - void *user_data); + void *user_data); /** @brief Node iterator. * diff --git a/include/zephyr/bluetooth/mesh/cfg_cli.h b/include/zephyr/bluetooth/mesh/cfg_cli.h index 4aca0c17451..0e8c26131ff 100644 --- a/include/zephyr/bluetooth/mesh/cfg_cli.h +++ b/include/zephyr/bluetooth/mesh/cfg_cli.h @@ -96,8 +96,8 @@ struct bt_mesh_cfg_cli_cb { * @param buf Message buffer containing subscription addresses. */ void (*mod_sub_list)(struct bt_mesh_cfg_cli *cli, uint16_t addr, uint8_t status, - uint16_t elem_addr, uint16_t mod_id, uint16_t cid, - struct net_buf_simple *buf); + uint16_t elem_addr, uint16_t mod_id, uint16_t cid, + struct net_buf_simple *buf); /** @brief Optional callback for Node Reset Status messages. * @@ -128,7 +128,7 @@ struct bt_mesh_cfg_cli_cb { * @param status Status Code for requesting message. */ void (*ttl_status)(struct bt_mesh_cfg_cli *cli, uint16_t addr, - uint8_t status); + uint8_t status); /** @brief Optional callback for Friend Status messages. * @@ -139,7 +139,7 @@ struct bt_mesh_cfg_cli_cb { * @param status Status Code for requesting message. */ void (*friend_status)(struct bt_mesh_cfg_cli *cli, uint16_t addr, - uint8_t status); + uint8_t status); /** @brief Optional callback for GATT Proxy Status messages. * @@ -150,7 +150,7 @@ struct bt_mesh_cfg_cli_cb { * @param status Status Code for requesting message. */ void (*gatt_proxy_status)(struct bt_mesh_cfg_cli *cli, uint16_t addr, - uint8_t status); + uint8_t status); /** @brief Optional callback for Network Transmit Status messages. * @@ -199,7 +199,7 @@ struct bt_mesh_cfg_cli_cb { * @param buf Message buffer containing key indexes. */ void (*net_key_list)(struct bt_mesh_cfg_cli *cli, uint16_t addr, - struct net_buf_simple *buf); + struct net_buf_simple *buf); /** @brief Optional callback for AppKey Status messages. * @@ -229,7 +229,7 @@ struct bt_mesh_cfg_cli_cb { * @param buf Message buffer containing key indexes. */ void (*app_key_list)(struct bt_mesh_cfg_cli *cli, uint16_t addr, uint8_t status, - uint16_t net_idx, struct net_buf_simple *buf); + uint16_t net_idx, struct net_buf_simple *buf); /** @brief Optional callback for Model App Status messages. * @@ -262,8 +262,8 @@ struct bt_mesh_cfg_cli_cb { * @param buf Message buffer containing key indexes. */ void (*mod_app_list)(struct bt_mesh_cfg_cli *cli, uint16_t addr, uint8_t status, - uint16_t elem_addr, uint16_t mod_id, uint16_t cid, - struct net_buf_simple *buf); + uint16_t elem_addr, uint16_t mod_id, uint16_t cid, + struct net_buf_simple *buf); /** @brief Optional callback for Node Identity Status messages. * @@ -326,7 +326,7 @@ struct bt_mesh_cfg_cli_cb { * @param sub HB subscription configuration parameters. */ void (*hb_sub_status)(struct bt_mesh_cfg_cli *cli, uint16_t addr, uint8_t status, - struct bt_mesh_cfg_cli_hb_sub *sub); + struct bt_mesh_cfg_cli_hb_sub *sub); }; /** Mesh Configuration Client Model Context */ From 2ca98770c1c8234f25b71538643cb44c6bddc557 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:11 +0100 Subject: [PATCH 1281/2300] Revert "[nrf fromtree] bluetooth: mesh: Doc fix Bluetooth mesh to Mesh" This reverts commit 77a5867648e81c2f75cf3853c06da02b0965604c. Signed-off-by: Robert Lubos --- boards/arm/nrf52840_mdk/doc/index.rst | 2 +- boards/riscv/esp32c3_devkitm/doc/index.rst | 2 +- .../riscv/esp32c3_luatos_core/doc/index.rst | 2 +- doc/connectivity/bluetooth/api/mesh.rst | 4 +-- .../bluetooth/api/mesh/access.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/blob.rst | 6 ++-- .../bluetooth/api/mesh/blob_cli.rst | 2 +- .../bluetooth/api/mesh/blob_srv.rst | 2 +- doc/connectivity/bluetooth/api/mesh/cfg.rst | 2 +- .../bluetooth/api/mesh/cfg_cli.rst | 2 +- .../bluetooth/api/mesh/cfg_srv.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/core.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/dfu.rst | 24 ++++++------- .../bluetooth/api/mesh/dfu_srv.rst | 8 ++--- .../bluetooth/api/mesh/health_srv.rst | 4 +-- .../bluetooth/api/mesh/heartbeat.rst | 2 +- .../bluetooth/api/mesh/lcd_cli.rst | 2 +- .../bluetooth/api/mesh/lcd_srv.rst | 2 +- .../bluetooth/api/mesh/models.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/msg.rst | 2 +- .../bluetooth/api/mesh/od_cli.rst | 2 +- .../bluetooth/api/mesh/od_srv.rst | 2 +- .../bluetooth/api/mesh/op_agg_cli.rst | 2 +- .../bluetooth/api/mesh/priv_beacon_cli.rst | 2 +- .../bluetooth/api/mesh/priv_beacon_srv.rst | 2 +- .../bluetooth/api/mesh/provisioning.rst | 8 ++--- doc/connectivity/bluetooth/api/mesh/proxy.rst | 2 +- .../bluetooth/api/mesh/sar_cfg.rst | 4 +-- .../bluetooth/api/mesh/sar_cfg_cli.rst | 2 +- .../bluetooth/api/mesh/sar_cfg_srv.rst | 4 +-- doc/connectivity/bluetooth/api/mesh/shell.rst | 34 +++++++++---------- doc/connectivity/bluetooth/bluetooth-arch.rst | 2 +- doc/connectivity/bluetooth/overview.rst | 2 +- doc/introduction/index.rst | 2 +- doc/kernel/timeutil.rst | 2 +- doc/security/vulnerabilities.rst | 4 +-- include/zephyr/bluetooth/mesh.h | 2 +- include/zephyr/bluetooth/mesh/blob_srv.h | 2 +- include/zephyr/bluetooth/mesh/cfg.h | 2 +- include/zephyr/bluetooth/mesh/dfu_cli.h | 2 +- include/zephyr/bluetooth/mesh/dfu_metadata.h | 4 +-- include/zephyr/bluetooth/mesh/dfu_srv.h | 4 +-- include/zephyr/bluetooth/mesh/main.h | 6 ++-- samples/bluetooth/mesh/README.rst | 2 +- samples/bluetooth/mesh_demo/README.rst | 2 +- samples/bluetooth/mesh_provisioner/README.rst | 2 +- samples/boards/nrf/mesh/onoff-app/README.rst | 2 +- .../onoff_level_lighting_vnd_app/README.rst | 2 +- .../boards/reel_board/mesh_badge/README.rst | 4 +-- subsys/bluetooth/Kconfig.logging | 26 +++++++------- subsys/bluetooth/common/Kconfig | 2 +- subsys/bluetooth/mesh/Kconfig | 20 +++++------ subsys/bluetooth/mesh/access.h | 2 +- subsys/bluetooth/mesh/settings.c | 2 +- subsys/bluetooth/mesh/shell/Kconfig | 10 +++--- subsys/bluetooth/mesh/shell/shell.c | 2 +- tests/bsim/bluetooth/mesh/README.rst | 14 ++++---- tests/bsim/bluetooth/mesh/prj.conf | 2 +- tests/bsim/bluetooth/mesh/prj_mesh1d1.conf | 2 +- tests/bsim/bluetooth/mesh/src/mesh_test.h | 2 +- 60 files changed, 140 insertions(+), 140 deletions(-) diff --git a/boards/arm/nrf52840_mdk/doc/index.rst b/boards/arm/nrf52840_mdk/doc/index.rst index 6e0b24b65f2..fce05bee593 100644 --- a/boards/arm/nrf52840_mdk/doc/index.rst +++ b/boards/arm/nrf52840_mdk/doc/index.rst @@ -7,7 +7,7 @@ Overview ******** The nRF52840-MDK is a versatile, easy-to-use IoT hardware platform for -Bluetooth 5, Bluetooth Mesh, Thread, IEEE 802.15.4, ANT and 2.4GHz proprietary +Bluetooth 5, Bluetooth mesh, Thread, IEEE 802.15.4, ANT and 2.4GHz proprietary applications using the nRF52840 SoC. The development kit comes with a fully integrated debugger (also known as diff --git a/boards/riscv/esp32c3_devkitm/doc/index.rst b/boards/riscv/esp32c3_devkitm/doc/index.rst index 26f1521e087..6d21b2918c3 100644 --- a/boards/riscv/esp32c3_devkitm/doc/index.rst +++ b/boards/riscv/esp32c3_devkitm/doc/index.rst @@ -18,7 +18,7 @@ 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 +- A Bluetooth LE subsystem that supports features of Bluetooth 5 and Bluetooth mesh - Various peripherals: - 12-bit ADC with up to 6 channels diff --git a/boards/riscv/esp32c3_luatos_core/doc/index.rst b/boards/riscv/esp32c3_luatos_core/doc/index.rst index fae8e2eb178..c943931a9e6 100644 --- a/boards/riscv/esp32c3_luatos_core/doc/index.rst +++ b/boards/riscv/esp32c3_luatos_core/doc/index.rst @@ -18,7 +18,7 @@ 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 +- A Bluetooth LE subsystem that supports features of Bluetooth 5 and Bluetooth mesh - Various peripherals: - 12-bit ADC with up to 6 channels diff --git a/doc/connectivity/bluetooth/api/mesh.rst b/doc/connectivity/bluetooth/api/mesh.rst index f234ff7cedc..457aa5b6895 100644 --- a/doc/connectivity/bluetooth/api/mesh.rst +++ b/doc/connectivity/bluetooth/api/mesh.rst @@ -3,14 +3,14 @@ Bluetooth Mesh Profile ###################### -The Bluetooth Mesh profile adds secure wireless multi-hop communication for +The Bluetooth mesh profile adds secure wireless multi-hop communication for Bluetooth Low Energy. This module implements the `Bluetooth Mesh Profile Specification v1.0.1 `_. Implementation of the `Bluetooth Mesh Protocol Specification v1.1 `_ is in experimental state. -Read more about Bluetooth Mesh on the +Read more about Bluetooth mesh on the `Bluetooth SIG Website `_. .. toctree:: diff --git a/doc/connectivity/bluetooth/api/mesh/access.rst b/doc/connectivity/bluetooth/api/mesh/access.rst index e4a94440556..2af8e6a03b8 100644 --- a/doc/connectivity/bluetooth/api/mesh/access.rst +++ b/doc/connectivity/bluetooth/api/mesh/access.rst @@ -3,7 +3,7 @@ Access layer ############ -The access layer is the application's interface to the Bluetooth Mesh network. +The access layer is the application's interface to the Bluetooth mesh network. The access layer provides mechanisms for compartmentalizing the node behavior into elements and models, which are implemented by the application. @@ -113,7 +113,7 @@ number within one publication interval. Extended models =============== -The Bluetooth Mesh specification allows the mesh models to extend each other. +The Bluetooth mesh specification allows the mesh models to extend each other. When a model extends another, it inherits that model's functionality, and extension can be used to construct complex models out of simple ones, leveraging the existing model functionality to avoid defining new opcodes. diff --git a/doc/connectivity/bluetooth/api/mesh/blob.rst b/doc/connectivity/bluetooth/api/mesh/blob.rst index 8395026afe4..31f45289560 100644 --- a/doc/connectivity/bluetooth/api/mesh/blob.rst +++ b/doc/connectivity/bluetooth/api/mesh/blob.rst @@ -5,7 +5,7 @@ BLOB Transfer models The Binary Large Object (BLOB) Transfer models implement the Bluetooth Mesh Binary Large Object Transfer Model specification version 1.0 and provide functionality for sending large binary objects -from a single source to many Target nodes over the Bluetooth Mesh network. It is the underlying +from a single source to many Target nodes over the Bluetooth mesh network. It is the underlying transport method for the :ref:`bluetooth_mesh_dfu`, but may be used for other object transfer purposes. The implementation is in experimental state. @@ -50,7 +50,7 @@ structure of the BLOB, and applications are free to define any encoding or compr on the data itself. The BLOB transfer protocol does not provide any built-in integrity checks, encryption or -authentication of the BLOB data. However, the underlying encryption of the Bluetooth Mesh protocol +authentication of the BLOB data. However, the underlying encryption of the Bluetooth mesh protocol provides data integrity checks and protects the contents of the BLOB from third parties using network and application level encryption. @@ -68,7 +68,7 @@ Chunks ------ Each block is divided into chunks. A chunk is the smallest data unit in the BLOB transfer, and must -fit inside a single Bluetooth Mesh access message excluding the opcode (379 bytes or less). The +fit inside a single Bluetooth mesh access message excluding the opcode (379 bytes or less). The mechanism for transferring chunks depends on the transfer mode. When operating in Push BLOB Transfer Mode, the chunks are sent as unacknowledged packets from the diff --git a/doc/connectivity/bluetooth/api/mesh/blob_cli.rst b/doc/connectivity/bluetooth/api/mesh/blob_cli.rst index b4193d50334..25b90c281c4 100644 --- a/doc/connectivity/bluetooth/api/mesh/blob_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/blob_cli.rst @@ -67,7 +67,7 @@ Target nodes having the BLOB Transfer Server model subscribe to this group addre Using group addresses for transferring the BLOBs can generally increase the transfer speed, as the BLOB Transfer Client sends each message to all Target nodes at the same time. However, sending -large, segmented messages to group addresses in Bluetooth Mesh is generally less reliable than +large, segmented messages to group addresses in Bluetooth mesh is generally less reliable than sending them to unicast addresses, as there is no transport layer acknowledgment mechanism for groups. This can lead to longer recovery periods at the end of each block, and increases the risk of losing Target nodes. Using group addresses for BLOB transfers will generally only pay off if the diff --git a/doc/connectivity/bluetooth/api/mesh/blob_srv.rst b/doc/connectivity/bluetooth/api/mesh/blob_srv.rst index 0d13e92148e..918b9493ff9 100644 --- a/doc/connectivity/bluetooth/api/mesh/blob_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/blob_srv.rst @@ -77,7 +77,7 @@ Transfer recovery ***************** The state of the BLOB transfer is stored persistently. If a reboot occurs, the BLOB Transfer Server -will attempt to recover the transfer. When the Bluetooth Mesh subsystem is started (for instance by +will attempt to recover the transfer. When the Bluetooth mesh subsystem is started (for instance by calling :c:func:`bt_mesh_init`), the BLOB Transfer Server will check for aborted transfers, and call the :c:member:`recover ` callback if there is any. In the recover callback, the user must provide a BLOB stream to use for the rest of the transfer. If the recover diff --git a/doc/connectivity/bluetooth/api/mesh/cfg.rst b/doc/connectivity/bluetooth/api/mesh/cfg.rst index e178984210d..01d3c9ca2e5 100644 --- a/doc/connectivity/bluetooth/api/mesh/cfg.rst +++ b/doc/connectivity/bluetooth/api/mesh/cfg.rst @@ -6,7 +6,7 @@ Runtime Configuration The runtime configuration API allows applications to change their runtime configuration directly, without going through the Configuration models. -Bluetooth Mesh nodes should generally be configured by a central network +Bluetooth mesh nodes should generally be configured by a central network configurator device with a :ref:`bluetooth_mesh_models_cfg_cli` model. Each mesh node instantiates a :ref:`bluetooth_mesh_models_cfg_srv` model that the Configuration Client can communicate with to change the node configuration. In some diff --git a/doc/connectivity/bluetooth/api/mesh/cfg_cli.rst b/doc/connectivity/bluetooth/api/mesh/cfg_cli.rst index 300c8ee3bc1..bf84edc6b86 100644 --- a/doc/connectivity/bluetooth/api/mesh/cfg_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/cfg_cli.rst @@ -3,7 +3,7 @@ Configuration Client #################### -The Configuration Client model is a foundation model defined by the Bluetooth Mesh +The Configuration Client model is a foundation model defined by the Bluetooth mesh specification. It provides functionality for configuring most parameters of a mesh node, including encryption keys, model configuration and feature enabling. diff --git a/doc/connectivity/bluetooth/api/mesh/cfg_srv.rst b/doc/connectivity/bluetooth/api/mesh/cfg_srv.rst index 8f595bf9b11..84f174df88b 100644 --- a/doc/connectivity/bluetooth/api/mesh/cfg_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/cfg_srv.rst @@ -3,7 +3,7 @@ Configuration Server #################### -The Configuration Server model is a foundation model defined by the Bluetooth Mesh +The Configuration Server model is a foundation model defined by the Bluetooth mesh specification. The Configuration Server model controls most parameters of the mesh node. It does not have an API of its own, but relies on a :ref:`bluetooth_mesh_models_cfg_cli` to control it. @@ -14,7 +14,7 @@ mesh node. It does not have an API of its own, but relies on a should be set through Kconfig, and the Heartbeat feature should be controlled through the :ref:`bluetooth_mesh_heartbeat` API. -The Configuration Server model is mandatory on all Bluetooth Mesh nodes, and +The Configuration Server model is mandatory on all Bluetooth mesh nodes, and must only be instantiated on the primary element. API reference diff --git a/doc/connectivity/bluetooth/api/mesh/core.rst b/doc/connectivity/bluetooth/api/mesh/core.rst index 94e2b8a6e5e..b9fdd164257 100644 --- a/doc/connectivity/bluetooth/api/mesh/core.rst +++ b/doc/connectivity/bluetooth/api/mesh/core.rst @@ -3,7 +3,7 @@ Core #### -The core provides functionality for managing the general Bluetooth Mesh +The core provides functionality for managing the general Bluetooth mesh state. .. _bluetooth_mesh_lpn: @@ -117,7 +117,7 @@ Advertisement identity All mesh stack bearers advertise data with the :c:macro:`BT_ID_DEFAULT` local identity. The value is preset in the mesh stack implementation. When Bluetooth® Low Energy (LE) -and Bluetooth Mesh coexist on the same device, the application should allocate and +and Bluetooth mesh coexist on the same device, the application should allocate and configure another local identity for Bluetooth LE purposes before starting the communication. API reference diff --git a/doc/connectivity/bluetooth/api/mesh/dfu.rst b/doc/connectivity/bluetooth/api/mesh/dfu.rst index 6718b3ea0ce..9cf55e244d6 100644 --- a/doc/connectivity/bluetooth/api/mesh/dfu.rst +++ b/doc/connectivity/bluetooth/api/mesh/dfu.rst @@ -3,16 +3,16 @@ Device Firmware Update (DFU) ############################ -Bluetooth Mesh supports the distribution of firmware images across a mesh network. The Bluetooth +Bluetooth mesh supports the distribution of firmware images across a mesh network. The Bluetooth mesh DFU subsystem implements the Bluetooth Mesh Device Firmware Update Model specification version 1.0. The implementation is in experimental state. -Bluetooth Mesh DFU implements a distribution mechanism for firmware images, and does not put any +Bluetooth mesh DFU implements a distribution mechanism for firmware images, and does not put any restrictions on the size, format or usage of the images. The primary design goal of the subsystem is -to provide the qualifiable parts of the Bluetooth Mesh DFU specification, and leave the usage, +to provide the qualifiable parts of the Bluetooth mesh DFU specification, and leave the usage, firmware validation and deployment to the application. -The DFU specification is implemented in the Zephyr Bluetooth Mesh DFU subsystem as three separate +The DFU specification is implemented in the Zephyr Bluetooth mesh DFU subsystem as three separate models: .. toctree:: @@ -28,7 +28,7 @@ Overview DFU roles ========= -The Bluetooth Mesh DFU subsystem defines three different roles the mesh nodes have to assume in the +The Bluetooth mesh DFU subsystem defines three different roles the mesh nodes have to assume in the distribution of firmware images: Target node @@ -47,20 +47,20 @@ Distributor image to the Target nodes. Initiator - The Initiator role is typically implemented by the same device that implements the Bluetooth Mesh + The Initiator role is typically implemented by the same device that implements the Bluetooth mesh :ref:`Provisioner ` and :ref:`Configurator ` roles. The Initiator needs a full overview of the potential Target nodes and their firmware, and will control (and initiate) all firmware updates. The - Initiator role is not implemented in the Zephyr Bluetooth Mesh DFU subsystem. + Initiator role is not implemented in the Zephyr Bluetooth mesh DFU subsystem. .. figure:: images/dfu_roles_mesh.svg :align: center :alt: Graphic overview of the DFU roles mesh nodes can have during the process of image distribution - DFU roles and the associated Bluetooth Mesh models + DFU roles and the associated Bluetooth mesh models -Bluetooth Mesh applications may combine the DFU roles in any way they'd like, and even take on +Bluetooth mesh applications may combine the DFU roles in any way they'd like, and even take on multiple instances of the same role by instantiating the models on separate elements. For instance, the Distributor and Initiator role can be combined by instantiating the :ref:`bluetooth_mesh_dfu_cli` on the Initiator node and calling its API directly. @@ -76,7 +76,7 @@ Firmware Update Client model directly, e.g. over a serial protocol. Stages ====== -The Bluetooth Mesh DFU process is designed to act in three stages: +The Bluetooth mesh DFU process is designed to act in three stages: Upload stage First, the image is uploaded to a Distributor in a mesh network by an external entity, such as a @@ -131,7 +131,7 @@ Firmware metadata Target node. The firmware metadata is optional, and its maximum length is determined by :kconfig:option:`CONFIG_BT_MESH_DFU_METADATA_MAXLEN`. - The Bluetooth Mesh DFU subsystem in Zephyr provides its own metadata format + The Bluetooth mesh DFU subsystem in Zephyr provides its own metadata format (:c:struct:`bt_mesh_dfu_metadata`) together with a set of related functions that can be used by an end product. The support for it is enabled using the :kconfig:option:`CONFIG_BT_MESH_DFU_METADATA` option. The format of the metadata is presented in @@ -299,7 +299,7 @@ following steps: node firmware image index and the firmware image metadata. Each Target node performs a metadata check and prepares their BLOB Transfer Server model for the transfer, before sending a status response to the Firmware Update Client, indicating if the firmware update will have any effect on - the Bluetooth Mesh state of the node. + the Bluetooth mesh state of the node. #. The Distributor's BLOB Transfer Client model transfers the firmware image to all Target nodes. #. Once the BLOB transfer has been received, the Target nodes' applications verify that the firmware is valid by performing checks such as signature verification or image checksums against the image diff --git a/doc/connectivity/bluetooth/api/mesh/dfu_srv.rst b/doc/connectivity/bluetooth/api/mesh/dfu_srv.rst index 105bdecb86c..2642dec8cc9 100644 --- a/doc/connectivity/bluetooth/api/mesh/dfu_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/dfu_srv.rst @@ -16,7 +16,7 @@ Firmware images The Firmware Update Server holds a list of all the updatable firmware images on the device. The full list shall be passed to the server through the ``_imgs`` parameter in -:c:macro:`BT_MESH_DFU_SRV_INIT`, and must be populated before the Bluetooth Mesh subsystem is +:c:macro:`BT_MESH_DFU_SRV_INIT`, and must be populated before the Bluetooth mesh subsystem is started. Each firmware image in the image list must be independently updatable, and should have its own firmware ID. @@ -33,9 +33,9 @@ application is described below: .. figure:: images/dfu_srv.svg :align: center - :alt: Bluetooth Mesh Firmware Update Server transfer + :alt: Bluetooth mesh Firmware Update Server transfer - Bluetooth Mesh Firmware Update Server transfer + Bluetooth mesh Firmware Update Server transfer Transfer check ============== @@ -118,7 +118,7 @@ updated image. When the transfer applies to the mesh application itself, the device might have to reboot as part of the swap. This restart can be performed from inside the apply callback, or done asynchronously. After booting up with the new firmware, the firmware image table should be updated before the -Bluetooth Mesh subsystem is started. +Bluetooth mesh subsystem is started. The Distributor will read out the firmware image table to confirm that the transfer was successfully applied. If the metadata check indicated that the device would become unprovisioned, the Target node diff --git a/doc/connectivity/bluetooth/api/mesh/health_srv.rst b/doc/connectivity/bluetooth/api/mesh/health_srv.rst index 6f7b1fc3f33..84c543b4766 100644 --- a/doc/connectivity/bluetooth/api/mesh/health_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/health_srv.rst @@ -21,7 +21,7 @@ necessarily damaging to the device. Errors indicate conditions that are outside of the node's design limits, and may have caused invalid behavior or permanent damage to the device. -Fault values ``0x01`` to ``0x7f`` are reserved for the Bluetooth Mesh +Fault values ``0x01`` to ``0x7f`` are reserved for the Bluetooth mesh specification, and the full list of specification defined faults are available in :ref:`bluetooth_mesh_health_faults`. Fault values ``0x80`` to ``0xff`` are vendor specific. The list of faults are always reported with a company ID to @@ -57,6 +57,6 @@ API reference Health faults ============= -Fault values defined by the Bluetooth Mesh specification. +Fault values defined by the Bluetooth mesh specification. .. doxygengroup:: bt_mesh_health_faults diff --git a/doc/connectivity/bluetooth/api/mesh/heartbeat.rst b/doc/connectivity/bluetooth/api/mesh/heartbeat.rst index 706625849c1..16c2bfa7840 100644 --- a/doc/connectivity/bluetooth/api/mesh/heartbeat.rst +++ b/doc/connectivity/bluetooth/api/mesh/heartbeat.rst @@ -3,7 +3,7 @@ Heartbeat ######### -The Heartbeat feature provides functionality for monitoring Bluetooth Mesh nodes +The Heartbeat feature provides functionality for monitoring Bluetooth mesh nodes and determining the distance between nodes. The Heartbeat feature is configured through the :ref:`bluetooth_mesh_models_cfg_srv` model. diff --git a/doc/connectivity/bluetooth/api/mesh/lcd_cli.rst b/doc/connectivity/bluetooth/api/mesh/lcd_cli.rst index 96189e21dd3..0eca28f1b2a 100644 --- a/doc/connectivity/bluetooth/api/mesh/lcd_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/lcd_cli.rst @@ -3,7 +3,7 @@ Large Composition Data Client ############################# -The Large Composition Data Client model is a foundation model defined by the Bluetooth Mesh +The Large Composition Data Client model is a foundation model defined by the Bluetooth mesh specification. The model is optional, and is enabled through the :kconfig:option:`CONFIG_BT_MESH_LARGE_COMP_DATA_CLI` option. diff --git a/doc/connectivity/bluetooth/api/mesh/lcd_srv.rst b/doc/connectivity/bluetooth/api/mesh/lcd_srv.rst index f67b31c27f8..f96436138b7 100644 --- a/doc/connectivity/bluetooth/api/mesh/lcd_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/lcd_srv.rst @@ -3,7 +3,7 @@ Large Composition Data Server ############################# -The Large Composition Data Server model is a foundation model defined by the Bluetooth Mesh +The Large Composition Data Server model is a foundation model defined by the Bluetooth mesh specification. The model is optional, and is enabled through the :kconfig:option:`CONFIG_BT_MESH_LARGE_COMP_DATA_SRV` option. diff --git a/doc/connectivity/bluetooth/api/mesh/models.rst b/doc/connectivity/bluetooth/api/mesh/models.rst index 94c3914ca53..3f5f94152ce 100644 --- a/doc/connectivity/bluetooth/api/mesh/models.rst +++ b/doc/connectivity/bluetooth/api/mesh/models.rst @@ -6,7 +6,7 @@ Mesh models Foundation models ***************** -The Bluetooth Mesh specification defines foundation models that can be +The Bluetooth mesh specification defines foundation models that can be used by network administrators to configure and diagnose mesh nodes. .. toctree:: @@ -34,7 +34,7 @@ used by network administrators to configure and diagnose mesh nodes. Model specification models ************************** -In addition to the foundation models defined in the Bluetooth Mesh specification, the Bluetooth Mesh +In addition to the foundation models defined in the Bluetooth mesh specification, the Bluetooth Mesh Model Specification defines several models, some of which are implemented in Zephyr: .. toctree:: diff --git a/doc/connectivity/bluetooth/api/mesh/msg.rst b/doc/connectivity/bluetooth/api/mesh/msg.rst index 614d2604d90..ae8b968198a 100644 --- a/doc/connectivity/bluetooth/api/mesh/msg.rst +++ b/doc/connectivity/bluetooth/api/mesh/msg.rst @@ -3,7 +3,7 @@ Message ####### -The Bluetooth Mesh message provides set of structures, macros and functions used +The Bluetooth mesh message provides set of structures, macros and functions used for preparing message buffers, managing message and acknowledged message contexts. diff --git a/doc/connectivity/bluetooth/api/mesh/od_cli.rst b/doc/connectivity/bluetooth/api/mesh/od_cli.rst index e419acb7572..5fc841716ce 100644 --- a/doc/connectivity/bluetooth/api/mesh/od_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/od_cli.rst @@ -3,7 +3,7 @@ On-Demand Private Proxy Client ############################## -The On-Demand Private Proxy Client model is a foundation model defined by the Bluetooth Mesh +The On-Demand Private Proxy Client model is a foundation model defined by the Bluetooth mesh specification. The model is optional, and is enabled with the :kconfig:option:`CONFIG_BT_MESH_OD_PRIV_PROXY_CLI` option. diff --git a/doc/connectivity/bluetooth/api/mesh/od_srv.rst b/doc/connectivity/bluetooth/api/mesh/od_srv.rst index 3c2f993bb30..700517e4283 100644 --- a/doc/connectivity/bluetooth/api/mesh/od_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/od_srv.rst @@ -3,7 +3,7 @@ On-Demand Private Proxy Server ############################## -The On-Demand Private Proxy Server model is a foundation model defined by the Bluetooth Mesh +The On-Demand Private Proxy Server model is a foundation model defined by the Bluetooth mesh specification. It is enabled with the :kconfig:option:`CONFIG_BT_MESH_OD_PRIV_PROXY_SRV` option. The On-Demand Private Proxy Server model was introduced in the Bluetooth Mesh Protocol Specification diff --git a/doc/connectivity/bluetooth/api/mesh/op_agg_cli.rst b/doc/connectivity/bluetooth/api/mesh/op_agg_cli.rst index 4648b4495cd..148557a4e81 100644 --- a/doc/connectivity/bluetooth/api/mesh/op_agg_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/op_agg_cli.rst @@ -3,7 +3,7 @@ Opcodes Aggregator Client ######################### -The Opcodes Aggregator Client model is a foundation model defined by the Bluetooth Mesh +The Opcodes Aggregator Client model is a foundation model defined by the Bluetooth mesh specification. It is an optional model, enabled with the :kconfig:option:`CONFIG_BT_MESH_OP_AGG_CLI` option. diff --git a/doc/connectivity/bluetooth/api/mesh/priv_beacon_cli.rst b/doc/connectivity/bluetooth/api/mesh/priv_beacon_cli.rst index c9bcc8e5eb1..cb531a4c3c8 100644 --- a/doc/connectivity/bluetooth/api/mesh/priv_beacon_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/priv_beacon_cli.rst @@ -11,7 +11,7 @@ The Private Beacon Client model is introduced in the Bluetooth Mesh Protocol Specification version 1.1, and provides functionality for configuring the :ref:`bluetooth_mesh_models_priv_beacon_srv` models. -The Private Beacons feature adds privacy to the different Bluetooth Mesh +The Private Beacons feature adds privacy to the different Bluetooth mesh beacons by periodically randomizing the beacon input data. This protects the mesh node from being tracked by devices outside the mesh network, and hides the network's IV index, IV update and the Key Refresh state. diff --git a/doc/connectivity/bluetooth/api/mesh/priv_beacon_srv.rst b/doc/connectivity/bluetooth/api/mesh/priv_beacon_srv.rst index 62450634a31..3c17cc44675 100644 --- a/doc/connectivity/bluetooth/api/mesh/priv_beacon_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/priv_beacon_srv.rst @@ -11,7 +11,7 @@ The Private Beacon Server model is introduced in the Bluetooth Mesh Protocol Specification version 1.1, and controls the mesh node's Private Beacon state, Private GATT Proxy state and Private Node Identity state. -The Private Beacons feature adds privacy to the different Bluetooth Mesh +The Private Beacons feature adds privacy to the different Bluetooth mesh beacons by periodically randomizing the beacon input data. This protects the mesh node from being tracked by devices outside the mesh network, and hides the network's IV index, IV update and the Key Refresh state. The Private Beacon Server diff --git a/doc/connectivity/bluetooth/api/mesh/provisioning.rst b/doc/connectivity/bluetooth/api/mesh/provisioning.rst index 685c9dda455..36fa38927a3 100644 --- a/doc/connectivity/bluetooth/api/mesh/provisioning.rst +++ b/doc/connectivity/bluetooth/api/mesh/provisioning.rst @@ -12,15 +12,15 @@ two devices operating in the following roles: Provisioning process. Before the provisioning process starts, the provisionee is an *unprovisioned device*. -The Provisioning module in the Zephyr Bluetooth Mesh stack supports both the +The Provisioning module in the Zephyr Bluetooth mesh stack supports both the Advertising and GATT Provisioning bearers for the provisionee role, as well as the Advertising Provisioning bearer for the provisioner role. The Provisioning process ************************ -All Bluetooth Mesh nodes must be provisioned before they can participate in a -Bluetooth Mesh network. The Provisioning API provides all the functionality +All Bluetooth mesh nodes must be provisioned before they can participate in a +Bluetooth mesh network. The Provisioning API provides all the functionality necessary for a device to become a provisioned mesh node. Provisioning is a five-step process, involving the following steps: @@ -176,7 +176,7 @@ Depending on the choice of public key exchange mechanism and authentication meth the provisioning process can be secure or insecure. On May 24th 2021, ANSSI `disclosed `_ -a set of vulnerabilities in the Bluetooth Mesh provisioning protocol that showcased +a set of vulnerabilities in the Bluetooth mesh provisioning protocol that showcased how the low entropy provided by the Blink, Vibrate, Push, Twist and Input/Output numeric OOB methods could be exploited in impersonation and MITM attacks. In response, the Bluetooth SIG has reclassified these OOB methods as diff --git a/doc/connectivity/bluetooth/api/mesh/proxy.rst b/doc/connectivity/bluetooth/api/mesh/proxy.rst index 5e905f2c9ef..823401c9571 100644 --- a/doc/connectivity/bluetooth/api/mesh/proxy.rst +++ b/doc/connectivity/bluetooth/api/mesh/proxy.rst @@ -3,7 +3,7 @@ Proxy ##### -The Proxy feature allows legacy devices like phones to access the Bluetooth Mesh network through +The Proxy feature allows legacy devices like phones to access the Bluetooth mesh network through GATT. The Proxy feature is only compiled in if the :kconfig:option:`CONFIG_BT_MESH_GATT_PROXY` option is set. The Proxy feature state is controlled by the :ref:`bluetooth_mesh_models_cfg_srv`, and the initial value can be set with :c:member:`bt_mesh_cfg_srv.gatt_proxy`. diff --git a/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst b/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst index 4f3354945c9..a0aa2b46a3e 100644 --- a/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst +++ b/doc/connectivity/bluetooth/api/mesh/sar_cfg.rst @@ -4,7 +4,7 @@ Segmentation and reassembly (SAR) ################################# Segmentation and reassembly (SAR) provides a way of handling larger upper transport layer messages -in a mesh network, with a purpose of enhancing the Bluetooth Mesh throughput. The segmentation and +in a mesh network, with a purpose of enhancing the Bluetooth mesh throughput. The segmentation and reassembly mechanism is used by the lower transport layer. The lower transport layer defines how the upper transport layer PDUs are segmented and reassembled @@ -23,7 +23,7 @@ required. Set the ``send rel`` flag (see :c:struct:`bt_mesh_msg_ctx`) to use the transmission and acknowledge single-segment segmented messages. The transport layer is able to transport up to 32 segments with its SAR mechanism, with a maximum -message (PDU) size of 384 octets. To configure message size for the Bluetooth Mesh stack, use the +message (PDU) size of 384 octets. To configure message size for the Bluetooth mesh stack, use the following Kconfig options: * :kconfig:option:`CONFIG_BT_MESH_RX_SEG_MAX` to set the maximum number of segments in an incoming message. diff --git a/doc/connectivity/bluetooth/api/mesh/sar_cfg_cli.rst b/doc/connectivity/bluetooth/api/mesh/sar_cfg_cli.rst index 1e2ab6c47a1..b017b53a01a 100644 --- a/doc/connectivity/bluetooth/api/mesh/sar_cfg_cli.rst +++ b/doc/connectivity/bluetooth/api/mesh/sar_cfg_cli.rst @@ -3,7 +3,7 @@ SAR Configuration Client ######################## -The SAR Configuration Client model is a foundation model defined by the Bluetooth Mesh +The SAR Configuration Client model is a foundation model defined by the Bluetooth mesh specification. It is an optional model, enabled with the :kconfig:option:`CONFIG_BT_MESH_SAR_CFG_CLI` configuration option. diff --git a/doc/connectivity/bluetooth/api/mesh/sar_cfg_srv.rst b/doc/connectivity/bluetooth/api/mesh/sar_cfg_srv.rst index 4280fae1350..2ea1446c9ea 100644 --- a/doc/connectivity/bluetooth/api/mesh/sar_cfg_srv.rst +++ b/doc/connectivity/bluetooth/api/mesh/sar_cfg_srv.rst @@ -3,13 +3,13 @@ SAR Configuration Server ######################## -The SAR Configuration Server model is a foundation model defined by the Bluetooth Mesh +The SAR Configuration Server model is a foundation model defined by the Bluetooth mesh specification. It is an optional model, enabled with the :kconfig:option:`CONFIG_BT_MESH_SAR_CFG_SRV` configuration option. The SAR Configuration Server model is introduced in the Bluetooth Mesh Protocol Specification version 1.1, and it supports the configuration of the -:ref:`segmentation and reassembly (SAR) ` behavior of a Bluetooth Mesh node. +:ref:`segmentation and reassembly (SAR) ` behavior of a Bluetooth mesh node. The model defines a set of states and messages for the SAR configuration. The SAR Configuration Server model defines two states, SAR Transmitter state and SAR Receiver state. diff --git a/doc/connectivity/bluetooth/api/mesh/shell.rst b/doc/connectivity/bluetooth/api/mesh/shell.rst index 9d5829fe380..66bfcdf6168 100644 --- a/doc/connectivity/bluetooth/api/mesh/shell.rst +++ b/doc/connectivity/bluetooth/api/mesh/shell.rst @@ -3,32 +3,32 @@ Bluetooth Mesh Shell #################### -The Bluetooth Mesh shell subsystem provides a set of Bluetooth Mesh shell commands for the -:ref:`shell_api` module. It allows for testing and exploring the Bluetooth Mesh API through an +The Bluetooth mesh shell subsystem provides a set of Bluetooth mesh shell commands for the +:ref:`shell_api` module. It allows for testing and exploring the Bluetooth mesh API through an interactive interface, without having to write an application. -The Bluetooth Mesh shell interface provides access to most Bluetooth Mesh features, including +The Bluetooth mesh shell interface provides access to most Bluetooth mesh features, including provisioning, configuration, and message sending. Prerequisites ************* -The Bluetooth Mesh shell subsystem depends on the application to create the composition data and do +The Bluetooth mesh shell subsystem depends on the application to create the composition data and do the mesh initialization. Application *********** -The Bluetooth Mesh shell subsystem is most easily used through the Bluetooth Mesh shell application +The Bluetooth mesh shell subsystem is most easily used through the Bluetooth mesh shell application under ``tests/bluetooth/mesh_shell``. See :ref:`shell_api` for information on how to connect and -interact with the Bluetooth Mesh shell application. +interact with the Bluetooth mesh shell application. Basic usage *********** -The Bluetooth Mesh shell subsystem adds a single ``mesh`` command, which holds a set of +The Bluetooth mesh shell subsystem adds a single ``mesh`` command, which holds a set of sub-commands. Every time the device boots up, make sure to call ``mesh init`` before any of the -other Bluetooth Mesh shell commands can be called:: +other Bluetooth mesh shell commands can be called:: uart:~$ mesh init @@ -82,7 +82,7 @@ Message sending =============== With an application key added (see above), the mesh node's transition parameters are all valid, and -the Bluetooth Mesh shell can send raw mesh messages through the network. +the Bluetooth mesh shell can send raw mesh messages through the network. For example, to send a Generic OnOff Set message, call:: @@ -107,7 +107,7 @@ configured network and application keys will receive and process the messages we Sending raw mesh packets is a good way to test model message handler implementations during development, as it can be done without having to implement the sending model. By default, only the -reception of the model messages can be tested this way, as the Bluetooth Mesh shell only includes +reception of the model messages can be tested this way, as the Bluetooth mesh shell only includes the foundation models. To receive a packet in the mesh node, you have to add a model with a valid opcode handler list to the composition data in ``subsys/bluetooth/mesh/shell.c``, and print the incoming message to the shell in the handler callback. @@ -115,7 +115,7 @@ incoming message to the shell in the handler callback. Parameter formats ***************** -The Bluetooth Mesh shell commands are parsed with a variety of formats: +The Bluetooth mesh shell commands are parsed with a variety of formats: .. list-table:: Parameter formats :widths: 1 4 2 @@ -139,12 +139,12 @@ The Bluetooth Mesh shell commands are parsed with a variety of formats: Commands ******** -The Bluetooth Mesh shell implements a large set of commands. Some of the commands accept parameters, +The Bluetooth mesh shell implements a large set of commands. Some of the commands accept parameters, which are mentioned in brackets after the command name. For example, ``mesh lpn set ``. Mandatory parameters are marked with angle brackets (e.g. ````), and optional parameters are marked with square brackets (e.g. ``[DstAddr]``). -The Bluetooth Mesh shell commands are divided into the following groups: +The Bluetooth mesh shell commands are divided into the following groups: .. contents:: :depth: 1 @@ -500,10 +500,10 @@ application. This shell module can be used for configuring itself and other node network. The Configuration Client uses general message parameters set by ``mesh target dst`` and ``mesh -target net`` to target specific nodes. When the Bluetooth Mesh shell node is provisioned, given that +target net`` to target specific nodes. When the Bluetooth mesh shell node is provisioned, given that the :kconfig:option:`CONFIG_BT_MESH_SHELL_PROV_CTX_INSTANCE` option is enabled with the shell provisioning context initialized, the Configuration Client model targets itself by default. -Similarly, when another node has been provisioned by the Bluetooth Mesh shell, the Configuration +Similarly, when another node has been provisioned by the Bluetooth mesh shell, the Configuration Client model targets the new node. In most common use-cases, the Configuration Client is depending on the provisioning features and the Configuration database to be fully functional. The Configuration Client always sends messages using the Device key bound to the destination address, so @@ -1645,7 +1645,7 @@ The Private Beacon Client model is an optional mesh subsystem that can be enable Opcodes Aggregator Client ------------------------- -The Opcodes Aggregator client is an optional Bluetooth Mesh model that can be enabled through the +The Opcodes Aggregator client is an optional Bluetooth mesh model that can be enabled through the :kconfig:option:`CONFIG_BT_MESH_OP_AGG_CLI` configuration option. The Opcodes Aggregator Client model is used to support the functionality of dispatching a sequence of access layer messages to nodes supporting the Opcodes Aggregator Server model. @@ -1675,7 +1675,7 @@ nodes supporting the Opcodes Aggregator Server model. Remote Provisioning Client -------------------------- -The Remote Provisioning Client is an optional Bluetooth Mesh model enabled through the +The Remote Provisioning Client is an optional Bluetooth mesh model enabled through the :kconfig:option:`CONFIG_BT_MESH_RPR_CLI` configuration option. The Remote Provisioning Client model provides support for remote provisioning of devices into a mesh network by using the Remote Provisioning Server model. diff --git a/doc/connectivity/bluetooth/bluetooth-arch.rst b/doc/connectivity/bluetooth/bluetooth-arch.rst index ed0cf1ea9f6..9b455e680d0 100644 --- a/doc/connectivity/bluetooth/bluetooth-arch.rst +++ b/doc/connectivity/bluetooth/bluetooth-arch.rst @@ -248,7 +248,7 @@ Each role comes with its own build-time configuration option: connection-oriented roles central implicitly enables observer role, and peripheral implicitly enables broadcaster role. Usually the first step when creating an application is to decide which roles are needed and go -from there. Bluetooth Mesh is a slightly special case, requiring at +from there. Bluetooth mesh is a slightly special case, requiring at least the observer and broadcaster roles, and possibly also the Peripheral role. This will be described in more detail in a later section. diff --git a/doc/connectivity/bluetooth/overview.rst b/doc/connectivity/bluetooth/overview.rst index 1f727736b2d..fece4ade496 100644 --- a/doc/connectivity/bluetooth/overview.rst +++ b/doc/connectivity/bluetooth/overview.rst @@ -76,7 +76,7 @@ Bluetooth stack. * Non-volatile storage support for permanent storage of Bluetooth-specific settings and data - * Bluetooth Mesh support + * Bluetooth mesh support * Relay, Friend Node, Low-Power Node (LPN) and GATT Proxy features * Both Provisioning roles and bearers supported (PB-ADV & PB-GATT) diff --git a/doc/introduction/index.rst b/doc/introduction/index.rst index 13204e6bb7d..85968ca456a 100644 --- a/doc/introduction/index.rst +++ b/doc/introduction/index.rst @@ -123,7 +123,7 @@ Zephyr offers a large and ever growing number of features including: **Bluetooth Low Energy 5.0 support** Bluetooth 5.0 compliant (ESR10) and Bluetooth Low Energy Controller support - (LE Link Layer). Includes Bluetooth Mesh and a Bluetooth qualification-ready + (LE Link Layer). Includes Bluetooth mesh and a Bluetooth qualification-ready Bluetooth controller. * Generic Access Profile (GAP) with all possible LE roles diff --git a/doc/kernel/timeutil.rst b/doc/kernel/timeutil.rst index 203d52ea9af..d41c5b48b89 100644 --- a/doc/kernel/timeutil.rst +++ b/doc/kernel/timeutil.rst @@ -223,7 +223,7 @@ include: - GPS time: epoch of 1980-01-06T00:00:00Z, continuous following TAI with an offset of TAI-GPS=19 s. -- Bluetooth Mesh time: epoch of 2000-01-01T00:00:00Z, continuous following TAI +- Bluetooth mesh time: epoch of 2000-01-01T00:00:00Z, continuous following TAI with an offset of -32. - UNIX Leap Time: epoch of 1970-01-01T00:00:00Z, continuous following TAI with an offset of -8. diff --git a/doc/security/vulnerabilities.rst b/doc/security/vulnerabilities.rst index fde156983d3..61d0d25f618 100644 --- a/doc/security/vulnerabilities.rst +++ b/doc/security/vulnerabilities.rst @@ -1176,7 +1176,7 @@ This has been fixed in main for v3.0.0 CVE-2022-1041 -------------- -Out-of-bound write vulnerability in the Bluetooth Mesh core stack can be triggered during provisioning +Out-of-bound write vulnerability in the Bluetooth mesh core stack can be triggered during provisioning This has been fixed in main for v3.1.0 @@ -1195,7 +1195,7 @@ This has been fixed in main for v3.1.0 CVE-2022-1042 -------------- -Out-of-bound write vulnerability in the Bluetooth Mesh core stack can be triggered during provisioning +Out-of-bound write vulnerability in the Bluetooth mesh core stack can be triggered during provisioning This has been fixed in main for v3.1.0 diff --git a/include/zephyr/bluetooth/mesh.h b/include/zephyr/bluetooth/mesh.h index fc84814fa44..a4ef70dc6de 100644 --- a/include/zephyr/bluetooth/mesh.h +++ b/include/zephyr/bluetooth/mesh.h @@ -1,5 +1,5 @@ /** @file - * @brief Bluetooth Mesh Profile APIs. + * @brief Bluetooth mesh Profile APIs. */ /* diff --git a/include/zephyr/bluetooth/mesh/blob_srv.h b/include/zephyr/bluetooth/mesh/blob_srv.h index 92c809bd6b5..bf807bad92f 100644 --- a/include/zephyr/bluetooth/mesh/blob_srv.h +++ b/include/zephyr/bluetooth/mesh/blob_srv.h @@ -108,7 +108,7 @@ struct bt_mesh_blob_srv_cb { /** @brief Transfer recovery callback. * - * Called when the Bluetooth Mesh subsystem is started if the device is rebooted + * Called when the Bluetooth mesh subsystem is started if the device is rebooted * in the middle of a transfer. * * Transfers will not be resumed after a reboot if this callback is not diff --git a/include/zephyr/bluetooth/mesh/cfg.h b/include/zephyr/bluetooth/mesh/cfg.h index 9bfd067da9b..7d1ca4e868f 100644 --- a/include/zephyr/bluetooth/mesh/cfg.h +++ b/include/zephyr/bluetooth/mesh/cfg.h @@ -26,7 +26,7 @@ extern "C" { #endif -/** Bluetooth Mesh feature states */ +/** Bluetooth mesh feature states */ enum bt_mesh_feat_state { /** Feature is supported, but disabled. */ BT_MESH_FEATURE_DISABLED, diff --git a/include/zephyr/bluetooth/mesh/dfu_cli.h b/include/zephyr/bluetooth/mesh/dfu_cli.h index ad8881ebc26..3cbc220d825 100644 --- a/include/zephyr/bluetooth/mesh/dfu_cli.h +++ b/include/zephyr/bluetooth/mesh/dfu_cli.h @@ -9,7 +9,7 @@ * @defgroup bt_mesh_dfu_cli Firmware Uppdate Client model * @ingroup bt_mesh_dfu * @{ - * @brief API for the Bluetooth Mesh Firmware Update Client model + * @brief API for the Bluetooth mesh Firmware Update Client model */ #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_CLI_H__ diff --git a/include/zephyr/bluetooth/mesh/dfu_metadata.h b/include/zephyr/bluetooth/mesh/dfu_metadata.h index 21d032236a7..bec65897ac7 100644 --- a/include/zephyr/bluetooth/mesh/dfu_metadata.h +++ b/include/zephyr/bluetooth/mesh/dfu_metadata.h @@ -6,10 +6,10 @@ /** * @file - * @defgroup bt_mesh_dfu_metadata Bluetooth Mesh Device Firmware Update (DFU) metadata + * @defgroup bt_mesh_dfu_metadata Bluetooth mesh Device Firmware Update (DFU) metadata * @ingroup bt_mesh_dfu * @{ - * @brief Common types and functions for the Bluetooth Mesh DFU metadata. + * @brief Common types and functions for the Bluetooth mesh DFU metadata. */ #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_METADATA_H__ diff --git a/include/zephyr/bluetooth/mesh/dfu_srv.h b/include/zephyr/bluetooth/mesh/dfu_srv.h index 2beaf2d9772..e136701e664 100644 --- a/include/zephyr/bluetooth/mesh/dfu_srv.h +++ b/include/zephyr/bluetooth/mesh/dfu_srv.h @@ -9,7 +9,7 @@ * @defgroup bt_mesh_dfu_srv Firmware Update Server model * @ingroup bt_mesh_dfu * @{ - * @brief API for the Bluetooth Mesh Firmware Update Server model + * @brief API for the Bluetooth mesh Firmware Update Server model */ #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_DFU_SRV_H__ @@ -136,7 +136,7 @@ struct bt_mesh_dfu_srv_cb { /** @brief Transfer recovery callback. * * If the device reboots in the middle of a transfer, the Firmware Update Server - * calls this function when the Bluetooth Mesh subsystem is started. + * calls this function when the Bluetooth mesh subsystem is started. * * This callback is optional, but transfers will not be recovered after * a reboot without it. diff --git a/include/zephyr/bluetooth/mesh/main.h b/include/zephyr/bluetooth/mesh/main.h index 8e7445fae6f..a4e98b97f8c 100644 --- a/include/zephyr/bluetooth/mesh/main.h +++ b/include/zephyr/bluetooth/mesh/main.h @@ -1,5 +1,5 @@ /** @file - * @brief Bluetooth Mesh Protocol APIs. + * @brief Bluetooth mesh Protocol APIs. */ /* @@ -550,8 +550,8 @@ bool bt_mesh_is_provisioned(void); */ /** - * @brief Bluetooth Mesh - * @defgroup bt_mesh Bluetooth Mesh + * @brief Bluetooth mesh + * @defgroup bt_mesh Bluetooth mesh * @ingroup bluetooth * @{ */ diff --git a/samples/bluetooth/mesh/README.rst b/samples/bluetooth/mesh/README.rst index 58532a0600b..e6ee78ba3a7 100644 --- a/samples/bluetooth/mesh/README.rst +++ b/samples/bluetooth/mesh/README.rst @@ -6,7 +6,7 @@ Bluetooth: Mesh Overview ******** -This sample demonstrates Bluetooth Mesh functionality. It has several +This sample demonstrates Bluetooth mesh functionality. It has several standard mesh models, and supports provisioning over both the Advertising and the GATT Provisioning Bearers (i.e. PB-ADV and PB-GATT). The application also needs a functioning serial console, since that's diff --git a/samples/bluetooth/mesh_demo/README.rst b/samples/bluetooth/mesh_demo/README.rst index 2edb690ab19..7fe7f0908ce 100644 --- a/samples/bluetooth/mesh_demo/README.rst +++ b/samples/bluetooth/mesh_demo/README.rst @@ -6,7 +6,7 @@ Bluetooth: Mesh Demo Overview ******** -This sample is a Bluetooth Mesh application intended for demonstration +This sample is a Bluetooth mesh application intended for demonstration purposes only. The application provisions and configures itself (i.e. no external provisioner needed) with hard-coded network and application key values. The local unicast address can be set using a NODE_ADDR build diff --git a/samples/bluetooth/mesh_provisioner/README.rst b/samples/bluetooth/mesh_provisioner/README.rst index 1b37a04a4a8..6da113afc1b 100644 --- a/samples/bluetooth/mesh_provisioner/README.rst +++ b/samples/bluetooth/mesh_provisioner/README.rst @@ -6,7 +6,7 @@ Bluetooth: Mesh Provisioner Overview ******** -This sample demonstrates how to use the Bluetooth Mesh APIs related to +This sample demonstrates how to use the Bluetooth mesh APIs related to provisioning and using the Configuration Database (CDB). It is intended to be tested together with a device capable of being provisioned. For example, one could use the sample in diff --git a/samples/boards/nrf/mesh/onoff-app/README.rst b/samples/boards/nrf/mesh/onoff-app/README.rst index 35e37d6a599..e8cadccd53c 100644 --- a/samples/boards/nrf/mesh/onoff-app/README.rst +++ b/samples/boards/nrf/mesh/onoff-app/README.rst @@ -6,7 +6,7 @@ Bluetooth: Mesh OnOff Model Overview ******** -This is a simple application demonstrating a Bluetooth Mesh multi-element node. +This is a simple application demonstrating a Bluetooth mesh multi-element node. Each element has a mesh onoff client and server model which controls one of the 4 sets of buttons and LEDs . diff --git a/samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/README.rst b/samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/README.rst index f33bf1e7761..05b8d896e77 100644 --- a/samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/README.rst +++ b/samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/README.rst @@ -4,7 +4,7 @@ Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models ###################################################################### Overview ******** -This is a application demonstrating a Bluetooth Mesh node in +This is a application demonstrating a Bluetooth mesh node in which Root element has following models - Generic OnOff Server diff --git a/samples/boards/reel_board/mesh_badge/README.rst b/samples/boards/reel_board/mesh_badge/README.rst index ccfc7e771ae..d5973ab8e9c 100644 --- a/samples/boards/reel_board/mesh_badge/README.rst +++ b/samples/boards/reel_board/mesh_badge/README.rst @@ -6,7 +6,7 @@ Mesh Badge Overview ******** -This sample app for the reel board showcases Bluetooth Mesh +This sample app for the reel board showcases Bluetooth mesh The app starts off as a regular Bluetooth GATT peripheral application. Install the "nRF Connect" app on your phone (available both for @@ -34,7 +34,7 @@ Steps to set up you're not happy with it you can try writing something else. #. When you're happy with the text, disconnect from the board (exit the app or go back to the device scan page) -#. Once disconnected the board switches over to Bluetooth Mesh mode, and you +#. Once disconnected the board switches over to Bluetooth mesh mode, and you can't connect to it anymore over GATT. If you configure multiple boards like this they can communicate with diff --git a/subsys/bluetooth/Kconfig.logging b/subsys/bluetooth/Kconfig.logging index 6d8b999e03c..ec95ddad10e 100644 --- a/subsys/bluetooth/Kconfig.logging +++ b/subsys/bluetooth/Kconfig.logging @@ -469,56 +469,56 @@ config BT_MESH_DEBUG_NET select DEPRECATED help Use this option to enable Network layer debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. config BT_MESH_DEBUG_RPL bool "[DEPRECATED] Replay protection list debug" select DEPRECATED help Use this option to enable Replay protection list debug logs - for the Bluetooth Mesh functionality. + for the Bluetooth mesh functionality. config BT_MESH_DEBUG_TRANS bool "[DEPRECATED] Transport layer debug" select DEPRECATED help Use this option to enable Transport layer debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. config BT_MESH_DEBUG_BEACON bool "[DEPRECATED] Beacon debug" select DEPRECATED help Use this option to enable Beacon-related debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. config BT_MESH_DEBUG_CRYPTO bool "[DEPRECATED] Crypto debug" select DEPRECATED help Use this option to enable cryptographic debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. config BT_MESH_DEBUG_KEYS bool "[DEPRECATED] Key management debug" select DEPRECATED help Use this option to enable key management debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. config BT_MESH_DEBUG_PROV bool "[DEPRECATED] Provisioning debug" select DEPRECATED help Use this option to enable Provisioning debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. config BT_MESH_DEBUG_PROVISIONER bool "[DEPRECATED] Provisioner debug" select DEPRECATED help Use this option to enable Provisioner debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. config BT_MESH_DEBUG_PROV_DEVICE bool "[DEPRECATED] Provisioning device debug" @@ -532,7 +532,7 @@ config BT_MESH_DEBUG_ACCESS select DEPRECATED help Use this option to enable Access layer and device composition - related debug logs for Bluetooth Mesh. + related debug logs for Bluetooth mesh. config BT_MESH_DEBUG_MODEL bool "[DEPRECATED] Foundation model debug" @@ -546,21 +546,21 @@ config BT_MESH_DEBUG_ADV select DEPRECATED help Use this option to enable advertising debug logs for - the Bluetooth Mesh functionality. + the Bluetooth mesh functionality. config BT_MESH_DEBUG_LOW_POWER bool "[DEPRECATED] Low Power debug" select DEPRECATED help Use this option to enable Low Power debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. config BT_MESH_DEBUG_FRIEND bool "[DEPRECATED] Friend debug" select DEPRECATED help Use this option to enable Friend debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. config BT_MESH_DEBUG_PROXY bool "[DEPRECATED] Proxy debug" @@ -588,7 +588,7 @@ config BT_MESH_DEBUG_CFG select DEPRECATED help Use this option to enable node configuration debug logs for the - Bluetooth Mesh functionality. + Bluetooth mesh functionality. endmenu # [DEPRECATED] Mesh diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index 2fdc98694b1..7b6bc839b89 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -243,7 +243,7 @@ config BT_HCI_MESH_EXT bool "Mesh HCI Command support" depends on BT_BROADCASTER && BT_OBSERVER && !BT_LL_SW_SPLIT help - Enable support for the Bluetooth Mesh HCI Commands. + Enable support for the Bluetooth mesh HCI Commands. config BT_WAIT_NOP bool "Wait for \"NOP\" Command Complete event during init" diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 0c654e18064..04366828bbe 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1,13 +1,13 @@ -# Bluetooth Mesh configuration options +# Bluetooth mesh configuration options # Copyright (c) 2017 Intel Corporation # SPDX-License-Identifier: Apache-2.0 menuconfig BT_MESH - bool "Bluetooth Mesh support" + bool "Bluetooth mesh support" depends on BT_OBSERVER && BT_BROADCASTER help - This option enables Bluetooth Mesh support. The specific + This option enables Bluetooth mesh support. The specific features that are available may depend on other features that have been enabled in the stack, such as GATT support. @@ -598,7 +598,7 @@ config BT_MESH_ACCESS_LAYER_MSG help This option allows the application to directly access Bluetooth access layer messages without the need to - instantiate Bluetooth Mesh models. + instantiate Bluetooth mesh models. config BT_MESH_MODEL_VND_MSG_CID_FORCE bool "Force vendor model to use the corresponding CID field message" @@ -1049,9 +1049,9 @@ config BT_MESH_FRIEND_ADV_LATENCY endif # BT_MESH_FRIEND menuconfig BT_MESH_V1d1 - bool "Bluetooth Mesh v1.1 support" + bool "Bluetooth mesh v1.1 support" help - This option enables Bluetooth Mesh v1.1 support. Bluetooth Mesh v1.1 + This option enables Bluetooth mesh v1.1 support. Bluetooth mesh v1.1 is backward compatible with v1.0.1. config BT_MESH_ECDH_P256_CMAC_AES128_AES_CCM @@ -1201,7 +1201,7 @@ config BT_MESH_DFU_METADATA bool "Support for the default metadata format" help This option adds a set of functions that can be used to encode and decode a firmware - metadata using the format defined in the Bluetooth Mesh DFU subsystem. + metadata using the format defined in the Bluetooth mesh DFU subsystem. config BT_MESH_DFU_URI_MAXLEN int "DFU URI max length" @@ -1734,16 +1734,16 @@ config BT_MESH_RPL_STORE_TIMEOUT endif # BT_MESH_RPL_STORAGE_MODE_SETTINGS && BT_SETTINGS config BT_MESH_SETTINGS_WORKQ - bool "Store the Bluetooth Mesh settings in a separate work queue" + bool "Store the Bluetooth mesh settings in a separate work queue" default y help This option enables a separate cooperative thread which is used to - store Bluetooth Mesh configuration. When this option is disabled, + store Bluetooth mesh configuration. When this option is disabled, the stack's configuration is stored in the system workqueue. This means that the system workqueue will be blocked for the time needed to store the pending data. This time may significantly increase if the flash driver does the erase operation. Enabling this option - allows Bluetooth Mesh not to block the system workqueue, and thus + allows Bluetooth mesh not to block the system workqueue, and thus process the incoming and outgoing messages while the flash driver waits for the controller to allocate the time needed to write the data and/or erase the required flash pages. diff --git a/subsys/bluetooth/mesh/access.h b/subsys/bluetooth/mesh/access.h index 48e0eadec10..b7ce1abd0ea 100644 --- a/subsys/bluetooth/mesh/access.h +++ b/subsys/bluetooth/mesh/access.h @@ -94,7 +94,7 @@ void bt_mesh_msg_cb_set(void (*cb)(uint32_t opcode, struct bt_mesh_msg_ctx *ctx, * Send a mesh model layer message out into the mesh network without having instantiated * the relevant mesh models. * - * @param ctx The Bluetooth Mesh message context. + * @param ctx The Bluetooth mesh message context. * @param buf The message payload. * * @return 0 on success or negative error code on failure. diff --git a/subsys/bluetooth/mesh/settings.c b/subsys/bluetooth/mesh/settings.c index 9cfcb3f5c2c..771aad9b946 100644 --- a/subsys/bluetooth/mesh/settings.c +++ b/subsys/bluetooth/mesh/settings.c @@ -88,7 +88,7 @@ static int mesh_commit(void) } if (!atomic_test_bit(bt_dev.flags, BT_DEV_ENABLE)) { - /* The Bluetooth Mesh settings loader calls bt_mesh_start() immediately + /* The Bluetooth mesh settings loader calls bt_mesh_start() immediately * after loading the settings. This is not intended to work before * bt_enable(). The doc on @ref bt_enable requires the "bt/" settings * tree to be loaded after @ref bt_enable is completed, so this handler diff --git a/subsys/bluetooth/mesh/shell/Kconfig b/subsys/bluetooth/mesh/shell/Kconfig index 46671c3bfaa..5e1e43f0057 100644 --- a/subsys/bluetooth/mesh/shell/Kconfig +++ b/subsys/bluetooth/mesh/shell/Kconfig @@ -1,13 +1,13 @@ -# Bluetooth Mesh shell configuration options +# Bluetooth mesh shell configuration options # Copyright (c) 2022 Nordic Semiconductor # SPDX-License-Identifier: Apache-2.0 menuconfig BT_MESH_SHELL - bool "Bluetooth Mesh shell" + bool "Bluetooth mesh shell" select SHELL help - Activate shell module that provides Bluetooth Mesh commands to + Activate shell module that provides Bluetooth mesh commands to the console. if BT_MESH_SHELL @@ -24,7 +24,7 @@ config BT_MESH_SHELL_PROV_CTX_INSTANCE depends on BT_MESH_SHELL_PROV help This option enables the provisioning context instance in the - Bluetooth Mesh shell module together with several provisioning + Bluetooth mesh shell module together with several provisioning commands and target utility features. To use the provisioning context instance, use bt_mesh_shell_prov in the initialization of mesh. @@ -54,7 +54,7 @@ config BT_MESH_SHELL_HEALTH_SRV_INSTANCE depends on BT_MESH_SHELL_TEST help This option enables Health Server model instance in the - Bluetooth Mesh shell module together with fault controlling + Bluetooth mesh shell module together with fault controlling shell commands. To use the model instance, add bt_mesh_shell_health_srv to the device composition data. Use BT_MESH_SHELL_HEALTH_PUB_DEFINE to instantiate publication context. diff --git a/subsys/bluetooth/mesh/shell/shell.c b/subsys/bluetooth/mesh/shell/shell.c index bb9892eb355..a169bb16422 100644 --- a/subsys/bluetooth/mesh/shell/shell.c +++ b/subsys/bluetooth/mesh/shell/shell.c @@ -1814,5 +1814,5 @@ SHELL_STATIC_SUBCMD_SET_CREATE(mesh_cmds, SHELL_SUBCMD_SET_END ); -SHELL_CMD_ARG_REGISTER(mesh, &mesh_cmds, "Bluetooth Mesh shell commands", +SHELL_CMD_ARG_REGISTER(mesh, &mesh_cmds, "Bluetooth mesh shell commands", bt_mesh_shell_mdl_cmds_help, 1, 1); diff --git a/tests/bsim/bluetooth/mesh/README.rst b/tests/bsim/bluetooth/mesh/README.rst index 1ae78887b71..787b0084f0b 100644 --- a/tests/bsim/bluetooth/mesh/README.rst +++ b/tests/bsim/bluetooth/mesh/README.rst @@ -1,7 +1,7 @@ -Bluetooth Mesh BabbleSim tests +Bluetooth mesh BabbleSim tests ############################## -This directory contains a set of high level system tests for the Bluetooth Mesh +This directory contains a set of high level system tests for the Bluetooth mesh subsystem. The tests run on the BabbleSim simulator, using the BabbleSim test framework. @@ -10,7 +10,7 @@ subfolder of test_scripts contains tests for a specific module in the Bluetooth mesh subsystem, and each folder has a corresponding test_.c under the src/ directory containing the necessary test harnesses to execute the tests. -There's only a single test application for all the Bluetooth Mesh BabbleSim +There's only a single test application for all the Bluetooth mesh BabbleSim tests. The test application is built from this directory, and includes all test harnesses in every build. The overlying bsim test framework selects the harness to use at runtime, using the test identifiers passed in the test scripts. @@ -18,7 +18,7 @@ to use at runtime, using the test identifiers passed in the test scripts. Running the tests ***************** -The Bluetooth Mesh tests have no extra requirements, and can be run using the +The Bluetooth mesh tests have no extra requirements, and can be run using the procedure described in the parent folder. To only run the mesh tests, set ``SEARCH_PATH`` to point to this folder before @@ -57,13 +57,13 @@ Then separately, call Framework ********* -The Bluetooth Mesh BabbleSim tests mainly operate on the test framework for the +The Bluetooth mesh BabbleSim tests mainly operate on the test framework for the BabbleSim platform, but with some mesh specific additions: mesh_test.sh ============= -All test scripts in the Bluetooth Mesh BabbleSim test suite follow a common +All test scripts in the Bluetooth mesh BabbleSim test suite follow a common pattern for running a single test across N devices with different test harnesses. ``mesh_test.sh`` is sourced in each test script, and its ``RunTest`` function is called once in each script with the following parameters: @@ -113,6 +113,6 @@ has been called - otherwise, it will fail. The Bluetooth stack must be initialized in the ``test_main_f`` function of the harness, as the previous callbacks are all executed in hardware threads. -The Bluetooth Mesh tests include the entire Bluetooth host and controller +The Bluetooth mesh tests include the entire Bluetooth host and controller subsystems, so timing requirements should generally be kept fairly liberal to avoid regressions on changes in the underlying layers. diff --git a/tests/bsim/bluetooth/mesh/prj.conf b/tests/bsim/bluetooth/mesh/prj.conf index a45bef89775..b0738c4fa05 100644 --- a/tests/bsim/bluetooth/mesh/prj.conf +++ b/tests/bsim/bluetooth/mesh/prj.conf @@ -15,7 +15,7 @@ CONFIG_BT_BROADCASTER=y CONFIG_BT_CTLR_DUP_FILTER_LEN=0 CONFIG_BT_CTLR_PRIVACY=n -# Bluetooth Mesh configuration +# Bluetooth mesh configuration CONFIG_BT_MESH=y CONFIG_BT_MESH_LOG_LEVEL_DBG=y CONFIG_BT_MESH_RELAY=y diff --git a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf index 11059c03da4..ab6066e01bf 100644 --- a/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf +++ b/tests/bsim/bluetooth/mesh/prj_mesh1d1.conf @@ -15,7 +15,7 @@ CONFIG_BT_BROADCASTER=y CONFIG_BT_CTLR_DUP_FILTER_LEN=0 CONFIG_BT_CTLR_PRIVACY=n -# Bluetooth Mesh configuration +# Bluetooth mesh configuration CONFIG_BT_MESH=y CONFIG_BT_MESH_V1d1=y CONFIG_BT_MESH_LOG_LEVEL_DBG=y diff --git a/tests/bsim/bluetooth/mesh/src/mesh_test.h b/tests/bsim/bluetooth/mesh/src/mesh_test.h index 3dcaa5f784a..a5c8694947b 100644 --- a/tests/bsim/bluetooth/mesh/src/mesh_test.h +++ b/tests/bsim/bluetooth/mesh/src/mesh_test.h @@ -1,5 +1,5 @@ /** @file - * @brief Common functionality for Bluetooth Mesh BabbleSim tests. + * @brief Common functionality for Bluetooth mesh BabbleSim tests. */ /* From 9f9a062421a3de0f5a1b025107095ba046b67c11 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:12 +0100 Subject: [PATCH 1282/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Return immediately if labels not supported" This reverts commit a4a44a56bd231df42845597e3b8a46a4ddfd019e. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/va.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/subsys/bluetooth/mesh/va.c b/subsys/bluetooth/mesh/va.c index b69c22f40e9..6db9194da47 100644 --- a/subsys/bluetooth/mesh/va.c +++ b/subsys/bluetooth/mesh/va.c @@ -306,10 +306,6 @@ void bt_mesh_va_clear(void) { int i; - if (CONFIG_BT_MESH_LABEL_COUNT == 0) { - return; - } - for (i = 0; i < ARRAY_SIZE(virtual_addrs); i++) { if (virtual_addrs[i].ref) { virtual_addrs[i].ref = 0U; From 3f47f360411816e9601f99ff0d9c2fbdca8e5273 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:12 +0100 Subject: [PATCH 1283/2300] Revert "[nrf fromtree] Bluetooth: Mesh: Use ATOMIC_DEFINE instead of atomic_t" This reverts commit 584d436c9fdf75979fdf3c06f1ae69619ce65f3c. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/rpl.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/mesh/rpl.c b/subsys/bluetooth/mesh/rpl.c index e19df33908f..b3113530854 100644 --- a/subsys/bluetooth/mesh/rpl.c +++ b/subsys/bluetooth/mesh/rpl.c @@ -41,9 +41,8 @@ static ATOMIC_DEFINE(store, CONFIG_BT_MESH_CRPL); enum { PENDING_CLEAR, PENDING_RESET, - RPL_FLAGS_COUNT, }; -static ATOMIC_DEFINE(rpl_flags, RPL_FLAGS_COUNT); +static atomic_t rpl_flags; static inline int rpl_idx(const struct bt_mesh_rpl *rpl) { @@ -134,7 +133,7 @@ bool bt_mesh_rpl_check(struct bt_mesh_net_rx *rx, /* Existing slot for given address */ if (rpl->src == rx->ctx.addr) { if (!rpl->old_iv && - atomic_test_bit(rpl_flags, PENDING_RESET) && + atomic_test_bit(&rpl_flags, PENDING_RESET) && !atomic_test_bit(store, i)) { /* Until rpl reset is finished, entry with old_iv == false and * without "store" bit set will be removed, therefore it can be @@ -179,7 +178,7 @@ void bt_mesh_rpl_clear(void) return; } - atomic_set_bit(rpl_flags, PENDING_CLEAR); + atomic_set_bit(&rpl_flags, PENDING_CLEAR); bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_RPL_PENDING); } @@ -234,7 +233,7 @@ void bt_mesh_rpl_reset(void) } if (i != 0) { - atomic_set_bit(rpl_flags, PENDING_RESET); + atomic_set_bit(&rpl_flags, PENDING_RESET); bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_RPL_PENDING); } } else { @@ -359,8 +358,8 @@ void bt_mesh_rpl_pending_store(uint16_t addr) bt_mesh_settings_store_cancel(BT_MESH_SETTINGS_RPL_PENDING); } - clr = atomic_test_and_clear_bit(rpl_flags, PENDING_CLEAR); - rst = atomic_test_bit(rpl_flags, PENDING_RESET); + clr = atomic_test_and_clear_bit(&rpl_flags, PENDING_CLEAR); + rst = atomic_test_bit(&rpl_flags, PENDING_RESET); for (int i = 0; i < ARRAY_SIZE(replay_list); i++) { struct bt_mesh_rpl *rpl = &replay_list[i]; @@ -399,7 +398,7 @@ void bt_mesh_rpl_pending_store(uint16_t addr) } } - atomic_clear_bit(rpl_flags, PENDING_RESET); + atomic_clear_bit(&rpl_flags, PENDING_RESET); if (addr == BT_MESH_ADDR_ALL_NODES) { (void)memset(&replay_list[last - shift + 1], 0, sizeof(struct bt_mesh_rpl) * shift); From c23ae903679b97fbc1ec7b9c03a7f9fef740201d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:12 +0100 Subject: [PATCH 1284/2300] Revert "[nrf fromtree] Bluetooth: Mesh: allocate mesh max required buffer number" This reverts commit e1fe018383adce3b5082ccd5d1de23d099cede59. Signed-off-by: Robert Lubos --- subsys/bluetooth/common/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index 7b6bc839b89..bf4aee75e48 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -33,7 +33,6 @@ config BT_BUF_ACL_TX_SIZE config BT_BUF_ACL_TX_COUNT int "Number of outgoing ACL data buffers" default 7 if BT_HCI_RAW - default 4 if BT_MESH_GATT default 3 range 1 255 help From fa895fb1f67585cda5e2ceb7c851aab2cfd71e1c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:12 +0100 Subject: [PATCH 1285/2300] Revert "[nrf noup] Bluetooth: Mesh: zero randomization for friend's adv" This reverts commit 9d3acb7a7d46e96bb2f93c0faa251deedc3f31c4. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 2 +- subsys/bluetooth/mesh/adv_ext.c | 32 -------------------------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 04366828bbe..de409e9c53c 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -958,7 +958,7 @@ config BT_MESH_LPN_INIT_POLL_TIMEOUT config BT_MESH_LPN_SCAN_LATENCY int "Latency for enabling scanning" range 0 50 - default 2 + default 15 help Latency in milliseconds that it takes to enable scanning. This is in practice how much time in advance before the Receive Window diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 0c11fc0053a..0bfc2041c7d 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -13,9 +13,6 @@ #include #include #include -#if defined(CONFIG_BT_LL_SOFTDEVICE) -#include -#endif #include "common/bt_str.h" @@ -139,28 +136,6 @@ static inline struct bt_mesh_ext_adv *gatt_adv_get(void) } } -static int set_adv_randomness(uint8_t handle, int rand_us) -{ -#if defined(CONFIG_BT_LL_SOFTDEVICE) - struct net_buf *buf; - sdc_hci_cmd_vs_set_adv_randomness_t *cmd_params; - - buf = bt_hci_cmd_create(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, sizeof(*cmd_params)); - if (!buf) { - LOG_ERR("Could not allocate command buffer"); - return -ENOMEM; - } - - cmd_params = net_buf_add(buf, sizeof(*cmd_params)); - cmd_params->adv_handle = handle; - cmd_params->rand_us = rand_us; - - return bt_hci_cmd_send_sync(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, buf, NULL); -#else - return 0; -#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ -} - static int adv_start(struct bt_mesh_ext_adv *adv, const struct bt_le_adv_param *param, struct bt_le_ext_adv_start_param *start, @@ -526,13 +501,6 @@ int bt_mesh_adv_enable(void) if (err) { return err; } - - if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { - err = set_adv_randomness(adv->instance->handle, 0); - if (err) { - LOG_ERR("Failed to set zero randomness: %d", err); - } - } } return 0; From def72464a55e3688ec484bff07c62e4924c1c27a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:12 +0100 Subject: [PATCH 1286/2300] Revert "[nrf fromtree] tests: modem: backend: uart: Add fixture to test suite" This reverts commit a5bedc35f07c8b3fc617f1571aeb46e79535ea98. Signed-off-by: Robert Lubos --- .../uart/boards/b_u585i_iot02a.overlay | 35 +++++++++++++--- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 42 +++++++++++-------- tests/subsys/modem/backends/uart/src/main.c | 2 +- .../subsys/modem/backends/uart/testcase.yaml | 18 ++++---- 4 files changed, 64 insertions(+), 33 deletions(-) diff --git a/tests/subsys/modem/backends/uart/boards/b_u585i_iot02a.overlay b/tests/subsys/modem/backends/uart/boards/b_u585i_iot02a.overlay index 30402e6e9d2..394facef7bb 100644 --- a/tests/subsys/modem/backends/uart/boards/b_u585i_iot02a.overlay +++ b/tests/subsys/modem/backends/uart/boards/b_u585i_iot02a.overlay @@ -1,11 +1,34 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - /* - * The Arduino D0 and D1 must be connected to each other to loopback RX/TX. + * Pins 2 and 3 must be connected to each other on the STMOD+1 connector to + * loopback RX/TX. */ -dut: &usart3 { - dmas = <&gpdma1 0 29 STM32_DMA_PERIPH_TX - &gpdma1 1 28 STM32_DMA_PERIPH_RX>; +/ { + aliases { + test-uart = &usart2; + }; +}; + +&gpioh { + misc_fixed_usart2 { + gpio-hog; + gpios = <13 GPIO_ACTIVE_HIGH>; + output-high; + }; +}; + +&gpdma1 { + status = "okay"; +}; + +&usart2 { + pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3 &usart2_rts_pa1 &usart2_cts_pa0>; + pinctrl-names = "default"; + current-speed = <115200>; + + dmas = <&gpdma1 0 27 STM32_DMA_PERIPH_TX + &gpdma1 1 26 STM32_DMA_PERIPH_RX>; dma-names = "tx", "rx"; + + status = "okay"; }; diff --git a/tests/subsys/modem/backends/uart/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/subsys/modem/backends/uart/boards/nrf5340dk_nrf5340_cpuapp.overlay index 777aebd8d3b..2d47b0f0744 100644 --- a/tests/subsys/modem/backends/uart/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/subsys/modem/backends/uart/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -1,31 +1,37 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - /* - * Pins P0.4 and P0.5 must be connected to each other to loopback RX/TX. + * Pins P1.10 and P1.11 must be connected to each other to loopback RX/TX. */ +/ { + aliases { + test-uart = &uart1; + }; +}; + +&uart1 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart1_default>; + pinctrl-1 = <&uart1_sleep>; + hw-flow-control; + pinctrl-names = "default", "sleep"; +}; + &pinctrl { - uart1_default_alt: uart1_default_alt { + uart1_default: uart1_default { group1 { - psels = , - ; + psels = ; + }; + group2 { + psels = ; }; }; - uart1_sleep_alt: uart1_sleep_alt { + uart1_sleep: uart1_sleep { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; }; - -dut: &uart1 { - compatible = "nordic,nrf-uarte"; - current-speed = <115200>; - status = "okay"; - pinctrl-0 = <&uart1_default_alt>; - pinctrl-1 = <&uart1_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/subsys/modem/backends/uart/src/main.c b/tests/subsys/modem/backends/uart/src/main.c index dffc203bb21..8a6c4c2813a 100644 --- a/tests/subsys/modem/backends/uart/src/main.c +++ b/tests/subsys/modem/backends/uart/src/main.c @@ -28,7 +28,7 @@ /*************************************************************************************************/ /* Mock pipe */ /*************************************************************************************************/ -static const struct device *uart = DEVICE_DT_GET(DT_NODELABEL(dut)); +static const struct device *uart = DEVICE_DT_GET(DT_ALIAS(test_uart)); static struct modem_backend_uart uart_backend; static struct modem_pipe *pipe; K_SEM_DEFINE(receive_ready_sem, 0, 1); diff --git a/tests/subsys/modem/backends/uart/testcase.yaml b/tests/subsys/modem/backends/uart/testcase.yaml index 54d8a6b9470..626ca639f75 100644 --- a/tests/subsys/modem/backends/uart/testcase.yaml +++ b/tests/subsys/modem/backends/uart/testcase.yaml @@ -1,19 +1,21 @@ # Copyright (c) 2023 Trackunit Corporation # SPDX-License-Identifier: Apache-2.0 -common: - harness: ztest - harness_config: - fixture: gpio_loopback - platform_allow: - - b_u585i_iot02a - - nrf5340dk_nrf5340_cpuapp - tests: modem.backends.uart.async: + tags: modem_backend + harness: ztest + platform_allow: + - b_u585i_iot02a + - nrf5340dk_nrf5340_cpuapp extra_configs: - CONFIG_UART_ASYNC_API=y modem.backends.uart.isr: + tags: modem_backend + harness: ztest + platform_allow: + - b_u585i_iot02a + - nrf5340dk_nrf5340_cpuapp extra_configs: - CONFIG_UART_INTERRUPT_DRIVEN=y From f05eb16ee3ce4145acddcb42a1f03769c20ea0e8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:12 +0100 Subject: [PATCH 1287/2300] Revert "[nrf fromtree] tests: logging: log_backend_uart: Disable backends other than UART" This reverts commit f6a60ffcdc92f3c972d55aeac56882a0c896897c. Signed-off-by: Robert Lubos --- tests/subsys/logging/log_backend_uart/prj.conf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/subsys/logging/log_backend_uart/prj.conf b/tests/subsys/logging/log_backend_uart/prj.conf index c8615a65adb..ef6894f355e 100644 --- a/tests/subsys/logging/log_backend_uart/prj.conf +++ b/tests/subsys/logging/log_backend_uart/prj.conf @@ -9,8 +9,3 @@ CONFIG_LOG=y CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_LOG_PRINTK=n -# -# Disable all potential other default backends -CONFIG_LOG_BACKEND_NATIVE_POSIX=n -CONFIG_LOG_BACKEND_RTT=n -CONFIG_LOG_BACKEND_XTENSA_SIM=n From e2e6f70ea7f3e9d7b21c274b64a1de8f5f5515e8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:13 +0100 Subject: [PATCH 1288/2300] Revert "[nrf fromlist] doc: extensions: zephyr-domain: make transforms optional" This reverts commit 7419d9432bafc8cebb952856f714a32ec58fdba5. Signed-off-by: Robert Lubos --- doc/_extensions/zephyr/domain.py | 14 +------------- doc/conf.py | 4 ---- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/doc/_extensions/zephyr/domain.py b/doc/_extensions/zephyr/domain.py index 053965e26e3..beb94eb4d2f 100644 --- a/doc/_extensions/zephyr/domain.py +++ b/doc/_extensions/zephyr/domain.py @@ -80,9 +80,6 @@ class ConvertCodeSampleNode(SphinxTransform): default_priority = 100 def apply(self): - if not self.config.zephyr_domain_apply_transforms: - return - matcher = NodeMatcher(CodeSampleNode) for node in self.document.traverse(matcher): self.convert_node(node) @@ -143,9 +140,6 @@ class ProcessRelatedCodeSamplesNode(SphinxPostTransform): default_priority = 5 # before ReferencesResolver def run(self, **kwargs: Any) -> None: - if not self.config.zephyr_domain_apply_transforms: - return - matcher = NodeMatcher(RelatedCodeSamplesNode) for node in self.document.traverse(matcher): id = node["id"] # the ID of the node is the name of the doxygen group for which we @@ -314,16 +308,10 @@ class CustomDoxygenGroupDirective(DoxygenGroupDirective): def run(self) -> List[Node]: nodes = super().run() - - if self.config.zephyr_domain_apply_transforms: - return [RelatedCodeSamplesNode(id=self.arguments[0]), *nodes] - else: - return nodes + return [RelatedCodeSamplesNode(id=self.arguments[0]), *nodes] def setup(app): - app.add_config_value("zephyr_domain_apply_transforms", False, "env") - app.add_domain(ZephyrDomain) app.add_transform(ConvertCodeSampleNode) diff --git a/doc/conf.py b/doc/conf.py index 4bab42dcc90..85488318a0a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -302,10 +302,6 @@ "build/dts/api/compatibles/**/*", ] -# -- Options for zephyr.domain -------------------------------------------- - -zephyr_domain_apply_transforms = True - # -- Options for sphinx.ext.graphviz -------------------------------------- graphviz_dot = os.environ.get("DOT_EXECUTABLE", "dot") From db0d35957d515e5572daac3e257bd464dd2a62a0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:13 +0100 Subject: [PATCH 1289/2300] Revert "[nrf fromlist] doc: extensions: zephyr-domain: fix object descriptions" This reverts commit 9dc2f2424ea3693567b624926280d45726fb1879. Signed-off-by: Robert Lubos --- doc/_extensions/zephyr/domain.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/_extensions/zephyr/domain.py b/doc/_extensions/zephyr/domain.py index beb94eb4d2f..8c395142818 100644 --- a/doc/_extensions/zephyr/domain.py +++ b/doc/_extensions/zephyr/domain.py @@ -249,7 +249,7 @@ class ZephyrDomain(Domain): directives = {"code-sample": CodeSampleDirective} object_types: Dict[str, ObjType] = { - "code-sample": ObjType("code-sample", "code-sample"), + "code-sample": ObjType("code sample", "code-sample"), } initial_data: Dict[str, Any] = {"code-samples": {}} @@ -267,9 +267,9 @@ def merge_domaindata(self, docnames: List[str], otherdata: Dict) -> None: def get_objects(self): for _, code_sample in self.data["code-samples"].items(): yield ( - code_sample["id"], code_sample["name"], - "code-sample", + code_sample["name"], + "code sample", code_sample["docname"], code_sample["id"], 1, From 33530c8b9971c1b1904fe21473a51152b629aa8d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:13 +0100 Subject: [PATCH 1290/2300] Revert "[nrf fromtree] doc: ext/gh_utils: pass MAINTAINERS.yml to Maintainers" This reverts commit 22bbd51b60ab3a921e577d2009d7d2d8f395089d. Signed-off-by: Robert Lubos --- doc/_extensions/zephyr/gh_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_extensions/zephyr/gh_utils.py b/doc/_extensions/zephyr/gh_utils.py index 2c992436c87..6ba75ce5ab7 100644 --- a/doc/_extensions/zephyr/gh_utils.py +++ b/doc/_extensions/zephyr/gh_utils.py @@ -53,7 +53,7 @@ from get_maintainer import Maintainers -MAINTAINERS : Final[Maintainers] = Maintainers(filename=f"{ZEPHYR_BASE}/MAINTAINERS.yml") +MAINTAINERS : Final[Maintainers] = Maintainers() __version__ = "0.1.0" From ea6c6a0ebd49f7843cc7611fdf628c86a31ca5bc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:13 +0100 Subject: [PATCH 1291/2300] Revert "[nrf fromtree] samples: ipc: multi_endpoint: Fix synchronisation of data receiving" This reverts commit 9dd2208c6362a29634c14f6c75ec9cef60ceba04. Signed-off-by: Robert Lubos --- samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c | 2 +- samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c b/samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c index f285f4b6d23..9b288f8a6a1 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/remote/src/main.c @@ -193,7 +193,7 @@ static void ipc1_ept_recv(const void *data, size_t len, void *priv) { ipc1_received_data = *((uint8_t *) data); - k_sem_give(&ipc1_data_sem); + k_sem_give(&ipc0B_data_sem); } static struct ipc_ept_cfg ipc1_ept_cfg = { diff --git a/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c b/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c index 4ad5659df38..78d7af05288 100644 --- a/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c +++ b/samples/subsys/ipc/ipc_service/multi_endpoint/src/main.c @@ -190,7 +190,7 @@ static void ipc1_ept_recv(const void *data, size_t len, void *priv) { ipc1_received_data = *((uint8_t *) data); - k_sem_give(&ipc1_data_sem); + k_sem_give(&ipc0B_data_sem); } static struct ipc_ept_cfg ipc1_ept_cfg = { From f1f7a3d310ed4bde773be047c97f23567feabda4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:13 +0100 Subject: [PATCH 1292/2300] Revert "[nrf fromtree] tests: drivers: flash: Use fixtures for tests requiring external chips" This reverts commit 639f4f456638271fbf930786221eab429217204e. Signed-off-by: Robert Lubos --- tests/drivers/flash/common/testcase.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 88ce0a40e07..9aa13bb40d5 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -21,7 +21,7 @@ tests: - OVERLAY_CONFIG=boards/nrf52840_flash_qspi.conf - DTC_OVERLAY_FILE=boards/nrf52840dk_mx25l51245g.overlay harness_config: - fixture: external_flash_mx25l51245g + fixture: external_flash integration_platforms: - nrf52840dk_nrf52840 drivers.flash.common.soc_flash_nrf: @@ -78,15 +78,11 @@ tests: extra_args: - OVERLAY_CONFIG=boards/nrf52840dk_flash_spi.conf - DTC_OVERLAY_FILE=boards/nrf52840dk_spi_nor.overlay - harness_config: - fixture: external_flash_mx25v1635f drivers.flash.common.spi_nor_wp_hold: platform_allow: nrf52840dk_nrf52840 extra_args: - OVERLAY_CONFIG=boards/nrf52840dk_flash_spi.conf - DTC_OVERLAY_FILE=boards/nrf52840dk_spi_nor_wp_hold.overlay - harness_config: - fixture: external_flash_mx25v1635f drivers.flash.common.sam0: platform_allow: - atsamd20_xpro From 61560a31ae41ce3ca6f4dd3b2a197083045ab96c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:14 +0100 Subject: [PATCH 1293/2300] Revert "[nrf fromtree] tests: drivers: flash: Update nrf52840dk_mx25r_high_perf.overlay" This reverts commit 12ce4cabaf23ec84a5e823c1f1d374fce486cadf. Signed-off-by: Robert Lubos --- .../flash/common/boards/nrf52840dk_mx25r_high_perf.overlay | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/drivers/flash/common/boards/nrf52840dk_mx25r_high_perf.overlay b/tests/drivers/flash/common/boards/nrf52840dk_mx25r_high_perf.overlay index a67f25e46c0..eabb26ebda6 100644 --- a/tests/drivers/flash/common/boards/nrf52840dk_mx25r_high_perf.overlay +++ b/tests/drivers/flash/common/boards/nrf52840dk_mx25r_high_perf.overlay @@ -1,9 +1,5 @@ /delete-node/ &qspi; -&gpio0 { - gpio-reserved-ranges = <0 2>, <6 1>, <8 3>, <18 6>; -}; - &spi2 { compatible = "nordic,nrf-spim"; status = "okay"; From 4e1a825fe0d23e0d3573d4bc3a831ca2b8135b55 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:14 +0100 Subject: [PATCH 1294/2300] Revert "[nrf fromtree] boards: nrf52840dk_nrf52840: Fix reserved GPIO lines" This reverts commit 1e402ef7906bdda6acdd45aa81220db1a19776d1. Signed-off-by: Robert Lubos --- .../nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts b/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts index 60c3ecf55a1..dcee7b0db5f 100644 --- a/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts +++ b/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts @@ -149,18 +149,18 @@ &gpio0 { status = "okay"; - gpio-reserved-ranges = <0 2>, <6 1>, <8 3>, <17 7>; - gpio-line-names = "XL1", "XL2", "AREF", "A0", "A1", "RTS", "TXD", - "CTS", "RXD", "NFC1", "NFC2", "BUTTON1", "BUTTON2", "LED1", - "LED2", "LED3", "LED4", "QSPI CS", "RESET", "QSPI CLK", - "QSPI DIO0", "QSPI DIO1", "QSPI DIO2", "QSPI DIO3","BUTTON3", - "BUTTON4", "SDA", "SCL", "A2", "A3", "A4", "A5"; + gpio-reserved-ranges = <0 11>, <17 7>, <26 6>; + gpio-line-names = "", "", "", "", "", "", "", "", + "", "", "", "BUTTON1", "BUTTON2", "LED1", "LED2", "LED3", + "LED4", "", "", "", "", "", "", "", + "BUTTON3", "BUTTON4", "", "", "", "", "", ""; }; &gpio1 { status = "okay"; + gpio-reserved-ranges = <0 1>, <9 1>, <12 4>; gpio-line-names = "", "D0", "D1", "D2", "D3", "D4", "D5", "D6", - "D7", "", "D8", "D9", "D10", "D11", "D12", "D13"; + "D7", "", "D8", "D9", "", "", "", ""; }; &uart0 { From 6892c8b43554ccae9e3c31f0f26ac59d40cf83a4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:14 +0100 Subject: [PATCH 1295/2300] Revert "[nrf fromtree] llext: fix read-only extension image" This reverts commit d5fef229fe222e17c05b678b92d2e51b2a9ab4cd. Signed-off-by: Robert Lubos --- subsys/llext/Kconfig | 6 ------ subsys/llext/llext.c | 3 +-- tests/subsys/llext/src/test_llext_simple.c | 5 +---- tests/subsys/llext/testcase.yaml | 2 -- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/subsys/llext/Kconfig b/subsys/llext/Kconfig index b1210b8f2e8..9fec16cb230 100644 --- a/subsys/llext/Kconfig +++ b/subsys/llext/Kconfig @@ -27,12 +27,6 @@ config LLEXT_SHELL_MAX_SIZE help When loading llext with shell it is stored in a temporary buffer of this size -config LLEXT_STORAGE_WRITABLE - bool "llext storage is writable" - help - Select if LLEXT storage is writable, i.e. if extensions are stored in - RAM and can be modified in place - module = LLEXT module-str = llext source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index 8dd5801bc95..a24d2b0833f 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -242,8 +242,7 @@ static int llext_copy_section(struct llext_loader *ldr, struct llext *ext, return 0; } - if (ldr->sects[sect_idx].sh_type != SHT_NOBITS && - IS_ENABLED(CONFIG_LLEXT_STORAGE_WRITABLE)) { + if (ldr->sects[sect_idx].sh_type != SHT_NOBITS) { ext->mem[mem_idx] = llext_peek(ldr, ldr->sects[sect_idx].sh_offset); if (ext->mem[mem_idx]) { ext->mem_on_heap[mem_idx] = false; diff --git a/tests/subsys/llext/src/test_llext_simple.c b/tests/subsys/llext/src/test_llext_simple.c index 557697f576c..d96191c1d72 100644 --- a/tests/subsys/llext/src/test_llext_simple.c +++ b/tests/subsys/llext/src/test_llext_simple.c @@ -10,10 +10,7 @@ #include #if defined(CONFIG_ARM) /* ARMV7 */ || defined(CONFIG_XTENSA) -#ifndef CONFIG_LLEXT_STORAGE_WRITABLE -const -#endif -static uint8_t hello_world_elf[] __aligned(4) = { +const static uint8_t hello_world_elf[] __aligned(4) = { #include "hello_world.inc" }; #endif diff --git a/tests/subsys/llext/testcase.yaml b/tests/subsys/llext/testcase.yaml index 2747edf8d0c..0bbccd5e1ca 100644 --- a/tests/subsys/llext/testcase.yaml +++ b/tests/subsys/llext/testcase.yaml @@ -11,8 +11,6 @@ tests: - nuvoton_pfm_m487 # See #63167 llext.simple.xtensa: arch_allow: xtensa - extra_configs: - - CONFIG_LLEXT_STORAGE_WRITABLE=y # Broken platforms platform_exclude: - qemu_xtensa_mmu # ELF sections are read-only, and without peek() .text copy isn't executable From 7663bf1e1d985fafccc26b171037bf25deb3cd40 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:14 +0100 Subject: [PATCH 1296/2300] Revert "[nrf fromtree] llext: remove redundant initialisation" This reverts commit d9934c10584943018586bd8dc19d2f408e473e0f. Signed-off-by: Robert Lubos --- subsys/llext/llext.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index a24d2b0833f..4f43dc17a1d 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -792,6 +792,10 @@ int llext_load(struct llext_loader *ldr, const char *name, struct llext **ext) } memset(*ext, 0, sizeof(struct llext)); + for (int i = 0; i < LLEXT_MEM_COUNT; i++) { + (*ext)->mem[i] = NULL; + } + ldr->hdr = ehdr; ret = do_llext_load(ldr, *ext); break; From 91c3f0750a9bf1fd171bbc449a9c64055333621b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:14 +0100 Subject: [PATCH 1297/2300] Revert "[nrf fromtree] llext: clarify section map allocation size" This reverts commit 02da11f2f67bf408e86788ea44f259efb7fc67ee. Signed-off-by: Robert Lubos --- subsys/llext/llext.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index 4f43dc17a1d..6c47ddf29c6 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -670,7 +670,7 @@ static int do_llext_load(struct llext_loader *ldr, struct llext *ext) memset(ldr->sects, 0, sizeof(ldr->sects)); ldr->sect_cnt = 0; - size_t sect_map_sz = ldr->hdr.e_shnum * sizeof(ldr->sect_map[0]); + size_t sect_map_sz = ldr->hdr.e_shnum * sizeof(uint32_t); ldr->sect_map = k_heap_alloc(&llext_heap, sect_map_sz, K_NO_WAIT); if (!ldr->sect_map) { @@ -678,8 +678,7 @@ static int do_llext_load(struct llext_loader *ldr, struct llext *ext) ret = -ENOMEM; goto out; } - memset(ldr->sect_map, 0, sect_map_sz); - + memset(ldr->sect_map, 0, ldr->hdr.e_shnum*sizeof(uint32_t)); ldr->sect_cnt = ldr->hdr.e_shnum; ext->mem_size += sect_map_sz; From 92821b0804ac8fd21574b5e04054d0c8e63ff61c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:15 +0100 Subject: [PATCH 1298/2300] Revert "[nrf fromtree] llext: add Xtensa test support" This reverts commit 3a1532896ece9b32e3558c79a2338cf8204cc259. Signed-off-by: Robert Lubos --- tests/subsys/llext/hello_world/CMakeLists.txt | 23 ++++--------------- tests/subsys/llext/src/test_llext_simple.c | 4 ++-- tests/subsys/llext/testcase.yaml | 5 ---- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/tests/subsys/llext/hello_world/CMakeLists.txt b/tests/subsys/llext/hello_world/CMakeLists.txt index 6519075e2f4..1a16d4be26b 100644 --- a/tests/subsys/llext/hello_world/CMakeLists.txt +++ b/tests/subsys/llext/hello_world/CMakeLists.txt @@ -6,26 +6,11 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(hello_world) # TODO check which architecture is being used -if(CONFIG_ARM) - set(CMAKE_C_FLAGS "-mlong-calls" "-mthumb") +set(CMAKE_C_FLAGS "-mlong-calls" "-mthumb") - add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/hello_world.llext - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -c - -o ${PROJECT_BINARY_DIR}/hello_world.llext - ${PROJECT_SOURCE_DIR}/hello_world.c - ) -elseif(CONFIG_XTENSA) - set(CMAKE_C_FLAGS "-shared" "-fPIC" "-nostdlib" "-nodefaultlibs") - - add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/hello_world.llext - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} - -o ${PROJECT_BINARY_DIR}/hello_world.pre.llext - ${PROJECT_SOURCE_DIR}/hello_world.c - COMMAND ${CROSS_COMPILE}strip -R .xt.* - -o ${PROJECT_BINARY_DIR}/hello_world.llext - ${PROJECT_BINARY_DIR}/hello_world.pre.llext - ) -endif() +add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/hello_world.llext + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -c -o ${PROJECT_BINARY_DIR}/hello_world.llext ${PROJECT_SOURCE_DIR}/hello_world.c +) set(HELLO_WORLD_LLEXT ${PROJECT_BINARY_DIR}/hello_world.llext PARENT_SCOPE) diff --git a/tests/subsys/llext/src/test_llext_simple.c b/tests/subsys/llext/src/test_llext_simple.c index d96191c1d72..ef0e62b93b5 100644 --- a/tests/subsys/llext/src/test_llext_simple.c +++ b/tests/subsys/llext/src/test_llext_simple.c @@ -9,7 +9,7 @@ #include #include -#if defined(CONFIG_ARM) /* ARMV7 */ || defined(CONFIG_XTENSA) +#ifdef CONFIG_ARM /* ARMV7 */ const static uint8_t hello_world_elf[] __aligned(4) = { #include "hello_world.inc" }; @@ -24,7 +24,7 @@ const static uint8_t hello_world_elf[] __aligned(4) = { */ ZTEST(llext, test_llext_simple) { - const char name[16] = "hello"; + const char name[16] = {'h', 'e', 'l', 'l', 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; struct llext_buf_loader buf_loader = LLEXT_BUF_LOADER(hello_world_elf, ARRAY_SIZE(hello_world_elf)); struct llext_loader *loader = &buf_loader.loader; diff --git a/tests/subsys/llext/testcase.yaml b/tests/subsys/llext/testcase.yaml index 0bbccd5e1ca..79d8f5a1fd9 100644 --- a/tests/subsys/llext/testcase.yaml +++ b/tests/subsys/llext/testcase.yaml @@ -9,8 +9,3 @@ tests: # Broken platforms platform_exclude: - nuvoton_pfm_m487 # See #63167 - llext.simple.xtensa: - arch_allow: xtensa - # Broken platforms - platform_exclude: - - qemu_xtensa_mmu # ELF sections are read-only, and without peek() .text copy isn't executable From 3ff308994d88565b4baad802c9f0b66e0af173e1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:15 +0100 Subject: [PATCH 1299/2300] Revert "[nrf fromtree] llext: make buffer access functions accessible externally" This reverts commit 3cc2c7454f8b7a4e9448e3a7dc3f323eac1cdf33. Signed-off-by: Robert Lubos --- include/zephyr/llext/loader.h | 19 ------------------- subsys/llext/llext.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/zephyr/llext/loader.h b/include/zephyr/llext/loader.h index 3102f17cf1a..3cc53da7d88 100644 --- a/include/zephyr/llext/loader.h +++ b/include/zephyr/llext/loader.h @@ -97,25 +97,6 @@ struct llext_loader { /** @endcond */ }; -static inline int llext_read(struct llext_loader *l, void *buf, size_t len) -{ - return l->read(l, buf, len); -} - -static inline int llext_seek(struct llext_loader *l, size_t pos) -{ - return l->seek(l, pos); -} - -static inline void *llext_peek(struct llext_loader *l, size_t pos) -{ - if (l->peek) { - return l->peek(l, pos); - } - - return NULL; -} - /** * @} */ diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index 6c47ddf29c6..7b8099a9190 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -21,6 +21,25 @@ K_HEAP_DEFINE(llext_heap, CONFIG_LLEXT_HEAP_SIZE * 1024); static const char ELF_MAGIC[] = {0x7f, 'E', 'L', 'F'}; +static inline int llext_read(struct llext_loader *l, void *buf, size_t len) +{ + return l->read(l, buf, len); +} + +static inline int llext_seek(struct llext_loader *l, size_t pos) +{ + return l->seek(l, pos); +} + +static inline void *llext_peek(struct llext_loader *l, size_t pos) +{ + if (l->peek) { + return l->peek(l, pos); + } + + return NULL; +} + static sys_slist_t _llext_list = SYS_SLIST_STATIC_INIT(&_llext_list); sys_slist_t *llext_list(void) From 59464e49de17844029716054f2475d4ed0603e1d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:15 +0100 Subject: [PATCH 1300/2300] Revert "[nrf fromtree] llext: export some symbols" This reverts commit b1efb734dfd7b261ca53d83ffcd1b6a7500e99af. Signed-off-by: Robert Lubos --- include/zephyr/llext/symbol.h | 10 ---------- kernel/mutex.c | 3 --- kernel/thread.c | 2 -- lib/os/assert.c | 4 +--- subsys/llext/CMakeLists.txt | 3 ++- subsys/llext/llext_export.c | 17 ----------------- subsys/logging/log_msg.c | 2 -- 7 files changed, 3 insertions(+), 38 deletions(-) delete mode 100644 subsys/llext/llext_export.c diff --git a/include/zephyr/llext/symbol.h b/include/zephyr/llext/symbol.h index 84e43d22b5b..b1aef67413e 100644 --- a/include/zephyr/llext/symbol.h +++ b/include/zephyr/llext/symbol.h @@ -78,16 +78,6 @@ struct llext_symtable { .name = STRINGIFY(x), .addr = &x, \ } -/** - * @brief Export a system call to a table of symbols - * - * Takes a system call name and uses @a EXPORT_SYMBOL() to export the respective - * function. - * - * @param x System call to export - */ -#define EXPORT_SYSCALL(x) EXPORT_SYMBOL(z_impl_ ## x) - /** * @} */ diff --git a/kernel/mutex.c b/kernel/mutex.c index 622422aef7b..6d22ce83f22 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -37,7 +37,6 @@ #include #include #include -#include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); /* We use a global spinlock here because some of the synchronization @@ -196,7 +195,6 @@ int z_impl_k_mutex_lock(struct k_mutex *mutex, k_timeout_t timeout) return -EAGAIN; } -EXPORT_SYSCALL(k_mutex_lock); #ifdef CONFIG_USERSPACE static inline int z_vrfy_k_mutex_lock(struct k_mutex *mutex, @@ -282,7 +280,6 @@ int z_impl_k_mutex_unlock(struct k_mutex *mutex) return 0; } -EXPORT_SYSCALL(k_mutex_unlock); #ifdef CONFIG_USERSPACE static inline int z_vrfy_k_mutex_unlock(struct k_mutex *mutex) diff --git a/kernel/thread.c b/kernel/thread.c index fc31f4b36d8..8f60054e798 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -29,7 +29,6 @@ #include #include #include -#include #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); @@ -142,7 +141,6 @@ bool k_is_in_isr(void) { return arch_is_in_isr(); } -EXPORT_SYMBOL(k_is_in_isr); /* * This function tags the current thread as essential to system operation. diff --git a/lib/os/assert.c b/lib/os/assert.c index 1fee487bff6..b6a33ae7320 100644 --- a/lib/os/assert.c +++ b/lib/os/assert.c @@ -7,7 +7,7 @@ #include #include #include -#include + /** * @brief Assert Action Handler @@ -42,7 +42,6 @@ __weak void assert_post_action(const char *file, unsigned int line) k_panic(); } -EXPORT_SYMBOL(assert_post_action); void assert_print(const char *fmt, ...) { @@ -54,4 +53,3 @@ void assert_print(const char *fmt, ...) va_end(ap); } -EXPORT_SYMBOL(assert_print); diff --git a/subsys/llext/CMakeLists.txt b/subsys/llext/CMakeLists.txt index b129dc7f943..ac54f3172c3 100644 --- a/subsys/llext/CMakeLists.txt +++ b/subsys/llext/CMakeLists.txt @@ -1,5 +1,6 @@ if(CONFIG_LLEXT) zephyr_library() - zephyr_library_sources(llext.c llext_export.c buf_loader.c) + zephyr_library_sources(llext.c) + zephyr_library_sources(buf_loader.c) zephyr_library_sources_ifdef(CONFIG_LLEXT_SHELL shell.c) endif() diff --git a/subsys/llext/llext_export.c b/subsys/llext/llext_export.c deleted file mode 100644 index 0ec7fe4ac0a..00000000000 --- a/subsys/llext/llext_export.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2023 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -EXPORT_SYMBOL(strcpy); -EXPORT_SYMBOL(strncpy); -EXPORT_SYMBOL(strlen); -EXPORT_SYMBOL(strcmp); -EXPORT_SYMBOL(strncmp); -EXPORT_SYMBOL(memcmp); -EXPORT_SYMBOL(memcpy); -EXPORT_SYMBOL(memset); diff --git a/subsys/logging/log_msg.c b/subsys/logging/log_msg.c index da9dffdc62e..8023cefbf8c 100644 --- a/subsys/logging/log_msg.c +++ b/subsys/logging/log_msg.c @@ -10,7 +10,6 @@ #include #include #include -#include LOG_MODULE_DECLARE(log); BUILD_ASSERT(sizeof(struct log_msg_desc) == sizeof(uint32_t), @@ -271,7 +270,6 @@ void z_impl_z_log_msg_static_create(const void *source, z_log_msg_finalize(msg, source, out_desc, data); } -EXPORT_SYSCALL(z_log_msg_static_create); #ifdef CONFIG_USERSPACE static inline void z_vrfy_z_log_msg_static_create(const void *source, From a27fedaec75321195ac5fe77bcefdd58a6d5c92d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:15 +0100 Subject: [PATCH 1301/2300] Revert "[nrf fromtree] llext: add support for shared objects" This reverts commit c5a6594390ea7ac4ba7d2a7f7dd55c884fc55bf0. Signed-off-by: Robert Lubos --- subsys/llext/llext.c | 112 ++----------------------------------------- 1 file changed, 3 insertions(+), 109 deletions(-) diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index 7b8099a9190..3d99c8af4fa 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -446,105 +446,6 @@ static int llext_copy_symbols(struct llext_loader *ldr, struct llext *ext) return 0; } -/* - * Find the section, containing the supplied offset and return file offset for - * that value - */ -static size_t llext_file_offset(struct llext_loader *ldr, size_t offset) -{ - unsigned int i; - - for (i = 0; i < LLEXT_SECT_COUNT; i++) - if (ldr->sects[i].sh_addr <= offset && - ldr->sects[i].sh_addr + ldr->sects[i].sh_size > offset) - return offset - ldr->sects[i].sh_addr + ldr->sects[i].sh_offset; - - return offset; -} - -static void llext_link_plt(struct llext_loader *ldr, struct llext *ext, elf_shdr_t *shdr) -{ - unsigned int sh_cnt = shdr->sh_size / shdr->sh_entsize; - /* - * CPU address where the .text section is stored, we use .text just as a - * reference point - */ - uint8_t *text = ext->mem[LLEXT_MEM_TEXT]; - - LOG_DBG("Found %p in PLT %u size %u cnt %u text %p", - (void *)llext_string(ldr, ext, LLEXT_MEM_SHSTRTAB, shdr->sh_name), - shdr->sh_type, shdr->sh_entsize, sh_cnt, (void *)text); - - const elf_shdr_t *sym_shdr = ldr->sects + LLEXT_SECT_SYMTAB; - unsigned int sym_cnt = sym_shdr->sh_size / sym_shdr->sh_entsize; - - for (unsigned int i = 0; i < sh_cnt; i++) { - elf_rela_t rela; - - int ret = llext_seek(ldr, shdr->sh_offset + i * shdr->sh_entsize); - - if (!ret) { - ret = llext_read(ldr, &rela, sizeof(rela)); - } - - if (ret < 0) { - LOG_ERR("PLT: failed to read RELA #%u, trying to continue", i); - continue; - } - - /* Index in the symbol table */ - unsigned int j = ELF32_R_SYM(rela.r_info); - - if (j >= sym_cnt) { - LOG_WRN("PLT: idx %u >= %u", j, sym_cnt); - continue; - } - - elf_sym_t sym_tbl; - - ret = llext_seek(ldr, sym_shdr->sh_offset + j * sizeof(elf_sym_t)); - if (!ret) { - ret = llext_read(ldr, &sym_tbl, sizeof(sym_tbl)); - } - - if (ret < 0) { - LOG_ERR("PLT: failed to read symbol table #%u RELA #%u, trying to continue", - j, i); - continue; - } - - uint32_t stt = ELF_ST_TYPE(sym_tbl.st_info); - const char *name = llext_string(ldr, ext, LLEXT_MEM_STRTAB, sym_tbl.st_name); - /* - * Both r_offset and sh_addr are addresses for which the extension - * has been built. - */ - size_t got_offset = llext_file_offset(ldr, rela.r_offset) - - ldr->sects[LLEXT_SECT_TEXT].sh_offset; - - if (stt == STT_NOTYPE && sym_tbl.st_shndx == SHN_UNDEF && name[0] != '\0') { - const void *link_addr = llext_find_sym(NULL, name); - - if (!link_addr) { - LOG_WRN("PLT: cannot find idx %u name %s", j, name); - continue; - } - - if (!rela.r_offset) { - LOG_WRN("PLT: zero offset idx %u name %s", j, name); - continue; - } - - LOG_DBG("symbol %s offset %#x r-offset %#x .text offset %#x", - name, got_offset, - rela.r_offset, ldr->sects[LLEXT_SECT_TEXT].sh_offset); - - /* Resolve the symbol */ - *(const void **)(text + got_offset) = link_addr; - } - } -} - __weak void arch_elf_relocate(elf_rela_t *rel, uintptr_t opaddr, uintptr_t opval) { } @@ -585,19 +486,12 @@ static int llext_link(struct llext_loader *ldr, struct llext *ext) if (strcmp(name, ".rel.text") == 0 || strcmp(name, ".rela.text") == 0) { loc = (uintptr_t)ext->mem[LLEXT_MEM_TEXT]; - } else if (strcmp(name, ".rel.bss") == 0 || - strcmp(name, ".rela.bss") == 0) { + } else if (strcmp(name, ".rel.bss") == 0) { loc = (uintptr_t)ext->mem[LLEXT_MEM_BSS]; - } else if (strcmp(name, ".rel.rodata") == 0 || - strcmp(name, ".rela.rodata") == 0) { + } else if (strcmp(name, ".rel.rodata") == 0) { loc = (uintptr_t)ext->mem[LLEXT_MEM_RODATA]; - } else if (strcmp(name, ".rel.data") == 0 || - strcmp(name, ".rela.data") == 0) { + } else if (strcmp(name, ".rel.data") == 0) { loc = (uintptr_t)ext->mem[LLEXT_MEM_DATA]; - } else if (strcmp(name, ".rela.plt") == 0 || - strcmp(name, ".rela.dyn") == 0) { - llext_link_plt(ldr, ext, &shdr); - continue; } LOG_DBG("relocation section %s (%d) linked to section %d has %d relocations", From acc15538b8072444305fd57c2a9035c0d590dc28 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:15 +0100 Subject: [PATCH 1302/2300] Revert "[nrf fromtree] net: shell: Rename the common.h to be more unique" This reverts commit b1574c3b51c110c5494f5bf2d24bfe07df488595. Signed-off-by: Robert Lubos --- subsys/net/lib/shell/allocs.c | 2 +- subsys/net/lib/shell/arp.c | 2 +- subsys/net/lib/shell/capture.c | 2 +- subsys/net/lib/shell/{net_shell_private.h => common.h} | 0 subsys/net/lib/shell/conn.c | 2 +- subsys/net/lib/shell/dns.c | 2 +- subsys/net/lib/shell/events.c | 2 +- subsys/net/lib/shell/gptp.c | 2 +- subsys/net/lib/shell/iface.c | 2 +- subsys/net/lib/shell/ipv4.c | 2 +- subsys/net/lib/shell/ipv6.c | 2 +- subsys/net/lib/shell/mem.c | 2 +- subsys/net/lib/shell/nbr.c | 2 +- subsys/net/lib/shell/net_shell.c | 2 +- subsys/net/lib/shell/ping.c | 2 +- subsys/net/lib/shell/pkt.c | 2 +- subsys/net/lib/shell/ppp.c | 2 +- subsys/net/lib/shell/resume.c | 2 +- subsys/net/lib/shell/route.c | 2 +- subsys/net/lib/shell/sockets.c | 2 +- subsys/net/lib/shell/stats.c | 2 +- subsys/net/lib/shell/suspend.c | 2 +- subsys/net/lib/shell/tcp.c | 2 +- subsys/net/lib/shell/udp.c | 2 +- subsys/net/lib/shell/virtual.c | 2 +- subsys/net/lib/shell/vlan.c | 2 +- subsys/net/lib/shell/websocket.c | 2 +- 27 files changed, 26 insertions(+), 26 deletions(-) rename subsys/net/lib/shell/{net_shell_private.h => common.h} (100%) diff --git a/subsys/net/lib/shell/allocs.c b/subsys/net/lib/shell/allocs.c index a2669590520..1c6e7288003 100644 --- a/subsys/net/lib/shell/allocs.c +++ b/subsys/net/lib/shell/allocs.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_DEBUG_NET_PKT_ALLOC) static void allocs_cb(struct net_pkt *pkt, diff --git a/subsys/net/lib/shell/arp.c b/subsys/net/lib/shell/arp.c index 58889f27d5c..fb1582411e9 100644 --- a/subsys/net/lib/shell/arp.c +++ b/subsys/net/lib/shell/arp.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_ARP) #include "ethernet/arp.h" diff --git a/subsys/net/lib/shell/capture.c b/subsys/net/lib/shell/capture.c index 0c7347f8774..f05531562ae 100644 --- a/subsys/net/lib/shell/capture.c +++ b/subsys/net/lib/shell/capture.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "net_shell_private.h" +#include "common.h" #include diff --git a/subsys/net/lib/shell/net_shell_private.h b/subsys/net/lib/shell/common.h similarity index 100% rename from subsys/net/lib/shell/net_shell_private.h rename to subsys/net/lib/shell/common.h diff --git a/subsys/net/lib/shell/conn.c b/subsys/net/lib/shell/conn.c index 24b528537bd..36831809eb8 100644 --- a/subsys/net/lib/shell/conn.c +++ b/subsys/net/lib/shell/conn.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_TCP) #include "tcp_internal.h" diff --git a/subsys/net/lib/shell/dns.c b/subsys/net/lib/shell/dns.c index 54c768cecd1..24a52f5e8a2 100644 --- a/subsys/net/lib/shell/dns.c +++ b/subsys/net/lib/shell/dns.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_DNS_RESOLVER) static void dns_result_cb(enum dns_resolve_status status, diff --git a/subsys/net/lib/shell/events.c b/subsys/net/lib/shell/events.c index 5a5d0f38f7d..047fd1e2186 100644 --- a/subsys/net/lib/shell/events.c +++ b/subsys/net/lib/shell/events.c @@ -13,7 +13,7 @@ LOG_MODULE_DECLARE(net_shell); #include #include -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_MGMT_EVENT_MONITOR) #define EVENT_MON_STACK_SIZE 1024 diff --git a/subsys/net/lib/shell/gptp.c b/subsys/net/lib/shell/gptp.c index 0de653e26cd..a156637e3af 100644 --- a/subsys/net/lib/shell/gptp.c +++ b/subsys/net/lib/shell/gptp.c @@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(net_shell); #include "ethernet/gptp/gptp_private.h" #endif -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_GPTP) static const char *selected_role_str(int port); diff --git a/subsys/net/lib/shell/iface.c b/subsys/net/lib/shell/iface.c index 53d4e99bd21..89983bd4839 100644 --- a/subsys/net/lib/shell/iface.c +++ b/subsys/net/lib/shell/iface.c @@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(net_shell); #include #endif -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_L2_ETHERNET) && defined(CONFIG_NET_NATIVE) struct ethernet_capabilities { diff --git a/subsys/net/lib/shell/ipv4.c b/subsys/net/lib/shell/ipv4.c index e8584b205fb..8fc88168c9a 100644 --- a/subsys/net/lib/shell/ipv4.c +++ b/subsys/net/lib/shell/ipv4.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "net_shell_private.h" +#include "common.h" #include "../ip/ipv4.h" #if defined(CONFIG_NET_NATIVE_IPV4) diff --git a/subsys/net/lib/shell/ipv6.c b/subsys/net/lib/shell/ipv6.c index 04efda65d0f..f81b8dcae23 100644 --- a/subsys/net/lib/shell/ipv6.c +++ b/subsys/net/lib/shell/ipv6.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" #include "../ip/ipv6.h" #if defined(CONFIG_NET_IPV6_FRAGMENT) diff --git a/subsys/net/lib/shell/mem.c b/subsys/net/lib/shell/mem.c index 47058f92767..cf58cda6bd6 100644 --- a/subsys/net/lib/shell/mem.c +++ b/subsys/net/lib/shell/mem.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" struct ctx_info { int pos; diff --git a/subsys/net/lib/shell/nbr.c b/subsys/net/lib/shell/nbr.c index 63b62406702..fd420b818ae 100644 --- a/subsys/net/lib/shell/nbr.c +++ b/subsys/net/lib/shell/nbr.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" static int cmd_net_nbr_rm(const struct shell *sh, size_t argc, char *argv[]) { diff --git a/subsys/net/lib/shell/net_shell.c b/subsys/net/lib/shell/net_shell.c index 9f932cb1bc4..19bab12e029 100644 --- a/subsys/net/lib/shell/net_shell.c +++ b/subsys/net/lib/shell/net_shell.c @@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(net_shell, LOG_LEVEL_DBG); #include -#include "net_shell_private.h" +#include "common.h" #include "net_shell.h" int get_iface_idx(const struct shell *sh, char *index_str) diff --git a/subsys/net/lib/shell/ping.c b/subsys/net/lib/shell/ping.c index 833c6eb8d54..8b52df110be 100644 --- a/subsys/net/lib/shell/ping.c +++ b/subsys/net/lib/shell/ping.c @@ -13,7 +13,7 @@ LOG_MODULE_DECLARE(net_shell); #include #include -#include "net_shell_private.h" +#include "common.h" #include "../ip/icmpv6.h" #include "../ip/icmpv4.h" diff --git a/subsys/net/lib/shell/pkt.c b/subsys/net/lib/shell/pkt.c index 3306b05d1a7..09d7ae6738a 100644 --- a/subsys/net/lib/shell/pkt.c +++ b/subsys/net/lib/shell/pkt.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" static bool is_pkt_part_of_slab(const struct k_mem_slab *slab, const char *ptr) { diff --git a/subsys/net/lib/shell/ppp.c b/subsys/net/lib/shell/ppp.c index f63c6ca3324..9b5f8355d47 100644 --- a/subsys/net/lib/shell/ppp.c +++ b/subsys/net/lib/shell/ppp.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_L2_PPP) #include diff --git a/subsys/net/lib/shell/resume.c b/subsys/net/lib/shell/resume.c index dcd3fbf309d..585d421efab 100644 --- a/subsys/net/lib/shell/resume.c +++ b/subsys/net/lib/shell/resume.c @@ -9,7 +9,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" static int cmd_net_resume(const struct shell *sh, size_t argc, char *argv[]) { diff --git a/subsys/net/lib/shell/route.c b/subsys/net/lib/shell/route.c index 035b56f6dfc..d48c442ed41 100644 --- a/subsys/net/lib/shell/route.c +++ b/subsys/net/lib/shell/route.c @@ -8,7 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" #include "../ip/route.h" diff --git a/subsys/net/lib/shell/sockets.c b/subsys/net/lib/shell/sockets.c index 8be67fc5faf..792e34efc21 100644 --- a/subsys/net/lib/shell/sockets.c +++ b/subsys/net/lib/shell/sockets.c @@ -7,7 +7,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" #include #if defined(CONFIG_NET_SOCKETS_OBJ_CORE) diff --git a/subsys/net/lib/shell/stats.c b/subsys/net/lib/shell/stats.c index 666a98e35d7..455f5d7decd 100644 --- a/subsys/net/lib/shell/stats.c +++ b/subsys/net/lib/shell/stats.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "net_shell_private.h" +#include "common.h" #include "../ip/net_stats.h" diff --git a/subsys/net/lib/shell/suspend.c b/subsys/net/lib/shell/suspend.c index cfa01375cac..326eb602077 100644 --- a/subsys/net/lib/shell/suspend.c +++ b/subsys/net/lib/shell/suspend.c @@ -9,7 +9,7 @@ #include LOG_MODULE_DECLARE(net_shell); -#include "net_shell_private.h" +#include "common.h" static int cmd_net_suspend(const struct shell *sh, size_t argc, char *argv[]) { diff --git a/subsys/net/lib/shell/tcp.c b/subsys/net/lib/shell/tcp.c index e2839af36ba..f90e16b3b66 100644 --- a/subsys/net/lib/shell/tcp.c +++ b/subsys/net/lib/shell/tcp.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_TCP) && defined(CONFIG_NET_NATIVE_TCP) static struct net_context *tcp_ctx; diff --git a/subsys/net/lib/shell/udp.c b/subsys/net/lib/shell/udp.c index 7bccbf93ba3..9eaf3254514 100644 --- a/subsys/net/lib/shell/udp.c +++ b/subsys/net/lib/shell/udp.c @@ -10,7 +10,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_UDP) && defined(CONFIG_NET_NATIVE_UDP) static struct net_context *udp_ctx; diff --git a/subsys/net/lib/shell/virtual.c b/subsys/net/lib/shell/virtual.c index 4eaabaa9916..19c9b1c1b0e 100644 --- a/subsys/net/lib/shell/virtual.c +++ b/subsys/net/lib/shell/virtual.c @@ -12,7 +12,7 @@ LOG_MODULE_DECLARE(net_shell); #include #endif -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_L2_VIRTUAL) static void virtual_iface_cb(struct net_if *iface, void *user_data) diff --git a/subsys/net/lib/shell/vlan.c b/subsys/net/lib/shell/vlan.c index ea7103ef1c9..0a980caa11f 100644 --- a/subsys/net/lib/shell/vlan.c +++ b/subsys/net/lib/shell/vlan.c @@ -15,7 +15,7 @@ LOG_MODULE_DECLARE(net_shell); #include -#include "net_shell_private.h" +#include "common.h" #if defined(CONFIG_NET_VLAN) static void iface_vlan_del_cb(struct net_if *iface, void *user_data) diff --git a/subsys/net/lib/shell/websocket.c b/subsys/net/lib/shell/websocket.c index 56e705199e3..f3e77187627 100644 --- a/subsys/net/lib/shell/websocket.c +++ b/subsys/net/lib/shell/websocket.c @@ -12,7 +12,7 @@ LOG_MODULE_DECLARE(net_shell); #include #endif -#include "net_shell_private.h" +#include "common.h" #include "websocket/websocket_internal.h" From 09d935e797f875900d8085f1a43633ec4d3c0375 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:15 +0100 Subject: [PATCH 1303/2300] Revert "[nrf fromtree] samples/drivers/mbox: Reduce sysbuild boilerplate" This reverts commit 3014aa720f16319a710179d9da3bcf4fd842ac4c. Signed-off-by: Robert Lubos --- samples/drivers/mbox/sysbuild.cmake | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/samples/drivers/mbox/sysbuild.cmake b/samples/drivers/mbox/sysbuild.cmake index a8dfb8ebdf4..1bd6a00ae9e 100644 --- a/samples/drivers/mbox/sysbuild.cmake +++ b/samples/drivers/mbox/sysbuild.cmake @@ -15,6 +15,24 @@ ExternalZephyrProject_Add( BOARD ${SB_CONFIG_REMOTE_BOARD} ) -native_simulator_set_child_images(${DEFAULT_IMAGE} ${REMOTE_APP}) +if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${REMOTE_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) -native_simulator_set_final_executable(${DEFAULT_IMAGE}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) + + # Let's meet users expectations of finding the final executable in zephyr/zephyr.exe + add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} + ) +endif() From a105aae13949f47342cb8d94f1cc3c86e48fd09a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:16 +0100 Subject: [PATCH 1304/2300] Revert "[nrf fromtree] samples/boards/nrf/nrf53_sync_rtc: Reduce sysbuild boilerplate" This reverts commit a75e56410a5666cce3f587e1b38e88ffc877161a. Signed-off-by: Robert Lubos --- .../boards/nrf/nrf53_sync_rtc/sysbuild.cmake | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/samples/boards/nrf/nrf53_sync_rtc/sysbuild.cmake b/samples/boards/nrf/nrf53_sync_rtc/sysbuild.cmake index 0c97244fd7b..a5d1eb9874f 100644 --- a/samples/boards/nrf/nrf53_sync_rtc/sysbuild.cmake +++ b/samples/boards/nrf/nrf53_sync_rtc/sysbuild.cmake @@ -15,6 +15,24 @@ ExternalZephyrProject_Add( BOARD ${SB_CONFIG_NET_CORE_BOARD} ) -native_simulator_set_child_images(${DEFAULT_IMAGE} ${REMOTE_APP}) +if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${REMOTE_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) -native_simulator_set_final_executable(${DEFAULT_IMAGE}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) + + # Let's meet users expectations of finding the final executable in zephyr/zephyr.exe + add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} + ) +endif() From 17ca8dbc464d7c8915d296f98180b33491013630 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:16 +0100 Subject: [PATCH 1305/2300] Revert "[nrf fromtree] samples/subsys/logging/multidomain: Reduce sysbuild boilerplate" This reverts commit 6820ab212bffbd4f2ef258a9aa6e837161feb6a3. Signed-off-by: Robert Lubos --- .../subsys/logging/multidomain/sysbuild.cmake | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/samples/subsys/logging/multidomain/sysbuild.cmake b/samples/subsys/logging/multidomain/sysbuild.cmake index 496a7a03f9d..e50f47b6db1 100644 --- a/samples/subsys/logging/multidomain/sysbuild.cmake +++ b/samples/subsys/logging/multidomain/sysbuild.cmake @@ -15,6 +15,24 @@ ExternalZephyrProject_Add( BOARD ${SB_CONFIG_NET_CORE_BOARD} ) -native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) +if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) -native_simulator_set_final_executable(${DEFAULT_IMAGE}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) + + # Let's meet users expectations of finding the final executable in zephyr/zephyr.exe + add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} + ) +endif() From b3e6a763decebb507a7e241eff1d199628eb7fac Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:16 +0100 Subject: [PATCH 1306/2300] Revert "[nrf fromtree] tests/bsim/bluetooth: Reduce sysbuild boilerplate" This reverts commit 1f1f41788b6647e75a94c50127c9744dd309a213. Signed-off-by: Robert Lubos --- .../broadcast_audio_sink/sysbuild.cmake | 9 +++++- .../unicast_audio_client/sysbuild.cmake | 9 +++++- tests/bsim/bluetooth/ll/bis/sysbuild.cmake | 29 +++++++++++++++++-- tests/bsim/bluetooth/ll/cis/sysbuild.cmake | 29 +++++++++++++++++-- tests/bsim/bluetooth/ll/conn/sysbuild.cmake | 29 +++++++++++++++++-- 5 files changed, 94 insertions(+), 11 deletions(-) diff --git a/tests/bsim/bluetooth/audio_samples/broadcast_audio_sink/sysbuild.cmake b/tests/bsim/bluetooth/audio_samples/broadcast_audio_sink/sysbuild.cmake index 2bf2920a476..a922830546d 100644 --- a/tests/bsim/bluetooth/audio_samples/broadcast_audio_sink/sysbuild.cmake +++ b/tests/bsim/bluetooth/audio_samples/broadcast_audio_sink/sysbuild.cmake @@ -3,4 +3,11 @@ include(${ZEPHYR_BASE}/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake) -native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) +if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) + set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) +endif() diff --git a/tests/bsim/bluetooth/audio_samples/unicast_audio_client/sysbuild.cmake b/tests/bsim/bluetooth/audio_samples/unicast_audio_client/sysbuild.cmake index 85b85b7cb63..9686cde1bce 100644 --- a/tests/bsim/bluetooth/audio_samples/unicast_audio_client/sysbuild.cmake +++ b/tests/bsim/bluetooth/audio_samples/unicast_audio_client/sysbuild.cmake @@ -3,4 +3,11 @@ include(${ZEPHYR_BASE}/samples/bluetooth/unicast_audio_client/sysbuild.cmake) -native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) +if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) + set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) +endif() diff --git a/tests/bsim/bluetooth/ll/bis/sysbuild.cmake b/tests/bsim/bluetooth/ll/bis/sysbuild.cmake index 69397264edf..eb75debccd3 100644 --- a/tests/bsim/bluetooth/ll/bis/sysbuild.cmake +++ b/tests/bsim/bluetooth/ll/bis/sysbuild.cmake @@ -16,9 +16,32 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) CACHE INTERNAL "" ) - native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) + + if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) + set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + endif() - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) endif() -native_simulator_set_final_executable(${DEFAULT_IMAGE}) +# Let's meet the expectation of finding the final executable in zephyr/zephyr.exe +add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} +) diff --git a/tests/bsim/bluetooth/ll/cis/sysbuild.cmake b/tests/bsim/bluetooth/ll/cis/sysbuild.cmake index a1258ecf1f2..495c3f4a20d 100644 --- a/tests/bsim/bluetooth/ll/cis/sysbuild.cmake +++ b/tests/bsim/bluetooth/ll/cis/sysbuild.cmake @@ -16,9 +16,32 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) CACHE INTERNAL "" ) - native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) + + if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) + set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + endif() - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) endif() -native_simulator_set_final_executable(${DEFAULT_IMAGE}) +# Let's meet the expectation of finding the final executable in zephyr/zephyr.exe +add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} +) diff --git a/tests/bsim/bluetooth/ll/conn/sysbuild.cmake b/tests/bsim/bluetooth/ll/conn/sysbuild.cmake index 4dfa34ef519..2294fd5bb5e 100644 --- a/tests/bsim/bluetooth/ll/conn/sysbuild.cmake +++ b/tests/bsim/bluetooth/ll/conn/sysbuild.cmake @@ -11,9 +11,32 @@ if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) BOARD ${SB_CONFIG_NET_CORE_BOARD} ) - native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP}) + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) + + if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) + set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" + ) + endif() - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) endif() -native_simulator_set_final_executable(${DEFAULT_IMAGE}) +# Let's meet the expectation of finding the final executable in zephyr/zephyr.exe +add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} +) From 76c26e83b9def1ee9c10b95c8694b5a5db7bf7ba Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:16 +0100 Subject: [PATCH 1307/2300] Revert "[nrf fromtree] samples/bluetooth: Reduce sysbuild boilerplate" This reverts commit 5006f1942b7bd90ce8222283a699e580ce5e335a. Signed-off-by: Robert Lubos --- .../broadcast_audio_sink/sysbuild.cmake | 24 +++++++++++++++++-- .../broadcast_audio_source/sysbuild.cmake | 24 +++++++++++++++++-- .../unicast_audio_client/sysbuild.cmake | 24 +++++++++++++++++-- .../unicast_audio_server/sysbuild.cmake | 24 +++++++++++++++++-- 4 files changed, 88 insertions(+), 8 deletions(-) diff --git a/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake b/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake index 2523aac8ea7..ed30d7f31f3 100644 --- a/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake +++ b/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake @@ -18,7 +18,27 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) + + if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) + endif() endif() -native_simulator_set_final_executable(${DEFAULT_IMAGE}) +if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) + # Let's meet the expectation of finding the final executable in zephyr/zephyr.exe + add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} + ) +endif() diff --git a/samples/bluetooth/broadcast_audio_source/sysbuild.cmake b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake index 2523aac8ea7..ed30d7f31f3 100644 --- a/samples/bluetooth/broadcast_audio_source/sysbuild.cmake +++ b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake @@ -18,7 +18,27 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) + + if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) + endif() endif() -native_simulator_set_final_executable(${DEFAULT_IMAGE}) +if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) + # Let's meet the expectation of finding the final executable in zephyr/zephyr.exe + add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} + ) +endif() diff --git a/samples/bluetooth/unicast_audio_client/sysbuild.cmake b/samples/bluetooth/unicast_audio_client/sysbuild.cmake index 2523aac8ea7..ed30d7f31f3 100644 --- a/samples/bluetooth/unicast_audio_client/sysbuild.cmake +++ b/samples/bluetooth/unicast_audio_client/sysbuild.cmake @@ -18,7 +18,27 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) + + if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) + endif() endif() -native_simulator_set_final_executable(${DEFAULT_IMAGE}) +if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) + # Let's meet the expectation of finding the final executable in zephyr/zephyr.exe + add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} + ) +endif() diff --git a/samples/bluetooth/unicast_audio_server/sysbuild.cmake b/samples/bluetooth/unicast_audio_server/sysbuild.cmake index 2523aac8ea7..ed30d7f31f3 100644 --- a/samples/bluetooth/unicast_audio_server/sysbuild.cmake +++ b/samples/bluetooth/unicast_audio_server/sysbuild.cmake @@ -18,7 +18,27 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) - native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) + + if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) + endif() endif() -native_simulator_set_final_executable(${DEFAULT_IMAGE}) +if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) + # Let's meet the expectation of finding the final executable in zephyr/zephyr.exe + add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} + ) +endif() From 67a81646c4140ef85a8230bcdcd359db1b073a03 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:16 +0100 Subject: [PATCH 1308/2300] Revert "[nrf fromtree] sysbuild: Add extensions for native_simulator based targets" This reverts commit 3d73a3a45f9a7ab67d377514041219920b13abd3. Signed-off-by: Robert Lubos --- share/sysbuild/CMakeLists.txt | 7 +-- .../native_simulator_sb_extensions.cmake | 62 ------------------- 2 files changed, 2 insertions(+), 67 deletions(-) delete mode 100644 share/sysbuild/cmake/modules/native_simulator_sb_extensions.cmake diff --git a/share/sysbuild/CMakeLists.txt b/share/sysbuild/CMakeLists.txt index 8a15da9cef5..7bbfe138760 100644 --- a/share/sysbuild/CMakeLists.txt +++ b/share/sysbuild/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Nordic Semiconductor +# Copyright (c) 2021-2023 Nordic Semiconductor # # SPDX-License-Identifier: Apache-2.0 @@ -18,10 +18,7 @@ set(APP_DIR ${APP_DIR} CACHE PATH "Main Application Source Directory") list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/modules) # List of Zephyr and sysbuild CMake modules we need for sysbuild. # Note: sysbuild_kconfig will internally load kconfig CMake module. -set(zephyr_modules extensions - sysbuild_extensions python west root zephyr_module boards shields - sysbuild_kconfig native_simulator_sb_extensions - ) +set(zephyr_modules extensions sysbuild_extensions python west root zephyr_module boards shields sysbuild_kconfig) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS ${zephyr_modules}) diff --git a/share/sysbuild/cmake/modules/native_simulator_sb_extensions.cmake b/share/sysbuild/cmake/modules/native_simulator_sb_extensions.cmake deleted file mode 100644 index 3d888d1775e..00000000000 --- a/share/sysbuild/cmake/modules/native_simulator_sb_extensions.cmake +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor -# -# SPDX-License-Identifier: Apache-2.0 - -# Usage: -# native_simulator_set_final_executable() -# -# When building for a native_simulator based target (including bsim targets), -# this function adds an extra build target which will copy the executable produced by -# `` to the top level, as zephyr/zephyr.exe -# -# This final image is expected to have been set to assemble other dependent images into -# itself if necessary, by calling native_simulator_set_child_images() -# This will allow other tools, like twister, or the bsim test scripts, as well as users to find -# this final executable in the same place as for non-sysbuild builds. -# -function(native_simulator_set_final_executable final_image) - if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) - add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${final_image}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${final_image} - ) - endif() -endfunction() - -# Usage: -# native_simulator_set_child_images( ) -# -# When building for a native_simulator based target (including bsim targets), -# this function sets a `` as dependencies of `` -# and configures the final image to assemble the child images into its final executable. -# -function(native_simulator_set_child_images final_image child_image) - if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) - add_dependencies(${final_image} ${child_image}) - - set(CHILD_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${child_image}/zephyr/zephyr.elf) - set_property(TARGET ${final_image} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${CHILD_LIBRARY_PATH}\"\n" - ) - endif() -endfunction() - -# Usage: -# native_simulator_set_primary_mcu_index( [ ...]) -# -# Propagate the SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX setting, -# if it is set, to each given image CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX -# -function(native_simulator_set_primary_mcu_index) - if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) - foreach(arg IN LISTS ARGV) - set_property(TARGET ${arg} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - endforeach() - endif() -endfunction() From 1fd4c08930dc44754d5d9237e14b8e8e5e7fa8c0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:17 +0100 Subject: [PATCH 1309/2300] Revert "[nrf fromtree] tests: bsim: Bluetooth: Enable nrf5340bsim CIS ACL group test" This reverts commit eca6fba06e402143c247a5bbd8353fa99621400c. Signed-off-by: Robert Lubos --- .../compile.nrf5340bsim_nrf5340_cpuapp.sh | 1 - tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild | 14 -- tests/bsim/bluetooth/ll/cis/sysbuild.cmake | 47 ------- ...0_cpunet_iso_acl_group-bt_ll_sw_split.conf | 122 ------------------ 4 files changed, 184 deletions(-) delete mode 100644 tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild delete mode 100644 tests/bsim/bluetooth/ll/cis/sysbuild.cmake delete mode 100644 tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf diff --git a/tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh b/tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh index 65769185867..4f175540347 100755 --- a/tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh +++ b/tests/bsim/bluetooth/compile.nrf5340bsim_nrf5340_cpuapp.sh @@ -21,7 +21,6 @@ source ${ZEPHYR_BASE}/tests/bsim/compile.source app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_privacy.conf sysbuild=1 compile app=tests/bsim/bluetooth/ll/bis sysbuild=1 compile -app=tests/bsim/bluetooth/ll/cis conf_overlay=overlay-acl_group.conf sysbuild=1 compile run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/audio_samples/compile.sh diff --git a/tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild b/tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild deleted file mode 100644 index 6c89fddc9f3..00000000000 --- a/tests/bsim/bluetooth/ll/cis/Kconfig.sysbuild +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "share/sysbuild/Kconfig" - -config NET_CORE_BOARD - string - default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" - -config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX - int - # Let's pass the test arguments to the application MCU test - # otherwise by default they would have gone to the net core. - default 0 if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" diff --git a/tests/bsim/bluetooth/ll/cis/sysbuild.cmake b/tests/bsim/bluetooth/ll/cis/sysbuild.cmake deleted file mode 100644 index 495c3f4a20d..00000000000 --- a/tests/bsim/bluetooth/ll/cis/sysbuild.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) - 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 - ${APP_DIR}/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf - CACHE INTERNAL "" - ) - - # For the simulated board, the application core build will produce the final executable - # for that, we give it the path to the netcore image - set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" - ) - - if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) - set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG - "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" - ) - endif() - - # Let's build the net core library first - add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) -endif() - -# Let's meet the expectation of finding the final executable in zephyr/zephyr.exe -add_custom_target(final_executable - ALL - COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe - ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe - DEPENDS ${DEFAULT_IMAGE} -) 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 deleted file mode 100644 index a3c8f43c71f..00000000000 --- a/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf +++ /dev/null @@ -1,122 +0,0 @@ -CONFIG_IPC_SERVICE=y -CONFIG_MBOX=y - -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 - -CONFIG_BT=y -CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 -CONFIG_BT_MAX_CONN=4 - -# Workaround: Unable to allocate command buffer when using K_NO_WAIT since -# Host number of completed commands does not follow normal flow control. -CONFIG_BT_BUF_CMD_TX_COUNT=10 - -CONFIG_BT_BUF_EVT_RX_COUNT=16 - -CONFIG_BT_BUF_EVT_RX_SIZE=255 -CONFIG_BT_BUF_ACL_RX_SIZE=255 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_BUF_CMD_TX_SIZE=255 - -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - -# Host features -CONFIG_BT_EXT_ADV=y -CONFIG_BT_PER_ADV=y -CONFIG_BT_PER_ADV_SYNC=y -CONFIG_BT_PER_ADV_SYNC_MAX=2 - -# Broadcast and Connected ISO -CONFIG_BT_ISO_BROADCASTER=y -CONFIG_BT_ISO_SYNC_RECEIVER=y -CONFIG_BT_ISO_CENTRAL=y -CONFIG_BT_ISO_PERIPHERAL=y - -# ISO Streams -CONFIG_BT_ISO_MAX_CHAN=4 - -# Controller -CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CTLR_ASSERT_HANDLER=y -CONFIG_BT_CTLR_DTM_HCI=y - -# Rx ACL and Adv Reports -CONFIG_BT_CTLR_RX_BUFFERS=9 -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 - -# Coded PHY support -CONFIG_BT_CTLR_PHY_CODED=n - -# Advertising Sets and Extended Scanning -CONFIG_BT_CTLR_ADV_EXT=y -CONFIG_BT_CTLR_ADV_SET=3 -CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 -CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=1650 - -CONFIG_BT_CTLR_ADVANCED_FEATURES=y -CONFIG_BT_CTLR_ADV_AUX_SET=3 -CONFIG_BT_CTLR_ADV_AUX_PDU_BACK2BACK=y -CONFIG_BT_CTLR_ADV_SYNC_SET=3 -CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK=y -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_ADV_RESERVE_MAX=n -CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n -# CONFIG_BT_CTLR_CENTRAL_SPACING=10000 -CONFIG_BT_CTLR_CENTRAL_SPACING=0 -CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE=n -CONFIG_BT_CTLR_SCAN_UNRESERVED=n -CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH=y -CONFIG_BT_TICKER_EXT=y -CONFIG_BT_TICKER_EXT_SLOT_WINDOW_YIELD=y - -# Control Procedure -CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=9 - -# ISO Broadcaster Controller -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_STREAM_MAX=2 - -# ISO Receive Controller -CONFIG_BT_CTLR_ADV_EXT=y -CONFIG_BT_CTLR_SYNC_PERIODIC=y -CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 -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_PDU_LEN_MAX=251 -CONFIG_BT_CTLR_CONN_ISO_STREAMS=4 -CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=4 - -# ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 -CONFIG_BT_CTLR_ISOAL_SOURCES=4 - -# ISO Receptions -CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 -CONFIG_BT_CTLR_ISOAL_SINKS=4 - -# Tx Power Dynamic Control -CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y From a9f569b1e642249095a4863136c6394a638dd3e8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:17 +0100 Subject: [PATCH 1310/2300] Revert "[nrf fromtree] samples/bluetooth: sysbuild: Add Kconfig setting for HCI IPC inclusion" This reverts commit b0a05b3a4577637e8bb052abf828373f6b71ac90. Signed-off-by: Robert Lubos --- samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild | 5 ----- samples/bluetooth/broadcast_audio_source/sysbuild.cmake | 2 +- samples/bluetooth/unicast_audio_client/Kconfig.sysbuild | 5 ----- samples/bluetooth/unicast_audio_client/sysbuild.cmake | 2 +- samples/bluetooth/unicast_audio_server/Kconfig.sysbuild | 5 ----- samples/bluetooth/unicast_audio_server/sysbuild.cmake | 2 +- 6 files changed, 3 insertions(+), 18 deletions(-) diff --git a/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild b/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild index f434010f81d..37a6b66c7f4 100644 --- a/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild +++ b/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild @@ -8,8 +8,3 @@ config NET_CORE_BOARD default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340_audio_dk_nrf5340_cpunet" if $(BOARD) = "nrf5340_audio_dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" - -config NET_CORE_IMAGE_HCI_IPC - bool "HCI IPC image on network core" - default y - depends on NET_CORE_BOARD != "" diff --git a/samples/bluetooth/broadcast_audio_source/sysbuild.cmake b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake index ed30d7f31f3..c150913cc55 100644 --- a/samples/bluetooth/broadcast_audio_source/sysbuild.cmake +++ b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) +if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) # For builds in the nrf5340, we build the netcore image with the controller set(NET_APP hci_ipc) diff --git a/samples/bluetooth/unicast_audio_client/Kconfig.sysbuild b/samples/bluetooth/unicast_audio_client/Kconfig.sysbuild index f434010f81d..37a6b66c7f4 100644 --- a/samples/bluetooth/unicast_audio_client/Kconfig.sysbuild +++ b/samples/bluetooth/unicast_audio_client/Kconfig.sysbuild @@ -8,8 +8,3 @@ config NET_CORE_BOARD default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340_audio_dk_nrf5340_cpunet" if $(BOARD) = "nrf5340_audio_dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" - -config NET_CORE_IMAGE_HCI_IPC - bool "HCI IPC image on network core" - default y - depends on NET_CORE_BOARD != "" diff --git a/samples/bluetooth/unicast_audio_client/sysbuild.cmake b/samples/bluetooth/unicast_audio_client/sysbuild.cmake index ed30d7f31f3..c150913cc55 100644 --- a/samples/bluetooth/unicast_audio_client/sysbuild.cmake +++ b/samples/bluetooth/unicast_audio_client/sysbuild.cmake @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) +if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) # For builds in the nrf5340, we build the netcore image with the controller set(NET_APP hci_ipc) diff --git a/samples/bluetooth/unicast_audio_server/Kconfig.sysbuild b/samples/bluetooth/unicast_audio_server/Kconfig.sysbuild index f434010f81d..37a6b66c7f4 100644 --- a/samples/bluetooth/unicast_audio_server/Kconfig.sysbuild +++ b/samples/bluetooth/unicast_audio_server/Kconfig.sysbuild @@ -8,8 +8,3 @@ config NET_CORE_BOARD default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340_audio_dk_nrf5340_cpunet" if $(BOARD) = "nrf5340_audio_dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" - -config NET_CORE_IMAGE_HCI_IPC - bool "HCI IPC image on network core" - default y - depends on NET_CORE_BOARD != "" diff --git a/samples/bluetooth/unicast_audio_server/sysbuild.cmake b/samples/bluetooth/unicast_audio_server/sysbuild.cmake index ed30d7f31f3..c150913cc55 100644 --- a/samples/bluetooth/unicast_audio_server/sysbuild.cmake +++ b/samples/bluetooth/unicast_audio_server/sysbuild.cmake @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) +if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) # For builds in the nrf5340, we build the netcore image with the controller set(NET_APP hci_ipc) From fab501f0be32398ef51eb7696d175953ebcecec0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:17 +0100 Subject: [PATCH 1311/2300] Revert "[nrf fromlist] logging: Fix using simplified message creation mode" This reverts commit 30f6ef68ec596d94f6f432781c17d8b519c6b9fa. Signed-off-by: Robert Lubos --- include/zephyr/logging/log_msg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/logging/log_msg.h b/include/zephyr/logging/log_msg.h index 39cbf1cedbc..fabc7a16b0c 100644 --- a/include/zephyr/logging/log_msg.h +++ b/include/zephyr/logging/log_msg.h @@ -241,7 +241,7 @@ enum z_log_msg_mode { #define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_0(fmt) 1 #define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_1(fmt, arg) Z_CBPRINTF_IS_WORD_NUM(arg) #define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_2(fmt, arg0, arg1) \ - Z_CBPRINTF_IS_WORD_NUM(arg0) && Z_CBPRINTF_IS_WORD_NUM(arg1) + Z_CBPRINTF_IS_WORD_NUM(arg0) || Z_CBPRINTF_IS_WORD_NUM(arg1) /** brief Determine if string arguments types allow to use simplified message creation mode. * From df138153bd60a0a3530401693e245e4fe1bee741 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:17 +0100 Subject: [PATCH 1312/2300] Revert "[nrf fromlist] drivers: usb: nrf_usbd_common: Remove unneeded assertion" This reverts commit 7d6c142381231c6f14b33b0864cf1e0ce363ecc9. Signed-off-by: Robert Lubos --- drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c b/drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c index 3db193ee2f0..9045e1ded70 100644 --- a/drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c +++ b/drivers/usb/common/nrf_usbd_common/nrf_usbd_common.c @@ -376,6 +376,8 @@ static bool nrf_usbd_common_feeder(nrf_usbd_common_ep_transfer_t *p_next, nrf_usbd_common_transfer_t *p_transfer, size_t ep_size) { + __ASSERT_NO_MSG(nrfx_is_in_ram(p_transfer->p_data.tx)); + size_t tx_size = p_transfer->size; if (tx_size > ep_size) { From 7a7bd585a38a32d92579669690910f3375c35fc9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:17 +0100 Subject: [PATCH 1313/2300] Revert "[nrf fromtree] soc: arm: nrf52: Configurable EGU instance for anomaly 109 workaround" This reverts commit c3cf78aaf2eb65240fbb853112854c6b59975c01. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/nrfx_config.h | 2 -- soc/arm/nordic_nrf/nrf52/Kconfig.soc | 8 -------- 2 files changed, 10 deletions(-) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index b5b09b96078..aaf31751004 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -586,8 +586,6 @@ #define NRFX_SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 #define NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 #define NRFX_PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1 -#define NRFX_PWM_NRF52_ANOMALY_109_EGU_INSTANCE \ - CONFIG_NRF52_ANOMALY_109_WORKAROUND_EGU_INSTANCE #endif #if defined(CONFIG_SOC_SERIES_BSIM_NRFXX) diff --git a/soc/arm/nordic_nrf/nrf52/Kconfig.soc b/soc/arm/nordic_nrf/nrf52/Kconfig.soc index de6a16129d3..517b4ce2baa 100644 --- a/soc/arm/nordic_nrf/nrf52/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf52/Kconfig.soc @@ -147,12 +147,4 @@ config NRF52_ANOMALY_109_WORKAROUND 64MHz clock at the same time as the peripheral that is using DMA is started. This anomaly applies to IC revisions up to "3", the most recent one. -config NRF52_ANOMALY_109_WORKAROUND_EGU_INSTANCE - int "Anomaly 109 workaround EGU instance" - depends on NRF52_ANOMALY_109_WORKAROUND - range 0 5 - default 5 - help - EGU instance used by the nRF52 Anomaly 109 workaround for PWM. - endif # SOC_SERIES_NRF52X From 226d7645912eef9350cf13809ad51943f8935d4f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:18 +0100 Subject: [PATCH 1314/2300] Revert "[nrf fromtree] sysbuild: introduce Kconfig setting for controlling HCI IPC inclusion" This reverts commit 41fa254d61c499f7cc708ccf39e68cf7fbc28d51. Signed-off-by: Robert Lubos --- samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild | 5 ----- samples/bluetooth/broadcast_audio_sink/sysbuild.cmake | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild b/samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild index f434010f81d..37a6b66c7f4 100644 --- a/samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild +++ b/samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild @@ -8,8 +8,3 @@ config NET_CORE_BOARD default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" default "nrf5340_audio_dk_nrf5340_cpunet" if $(BOARD) = "nrf5340_audio_dk_nrf5340_cpuapp" default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" - -config NET_CORE_IMAGE_HCI_IPC - bool "HCI IPC image on network core" - default y - depends on NET_CORE_BOARD != "" diff --git a/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake b/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake index ed30d7f31f3..c150913cc55 100644 --- a/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake +++ b/samples/bluetooth/broadcast_audio_sink/sysbuild.cmake @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) +if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) # For builds in the nrf5340, we build the netcore image with the controller set(NET_APP hci_ipc) From 363c7f1b31d0c0439520ea4375f3cd9bebf03955 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:18 +0100 Subject: [PATCH 1315/2300] Revert "[nrf fromlist] drivers: ieee802154: nrf5: Fix missed variable rename" This reverts commit a719561b6ed470fd0faf0ac147ecc24e686a3bdb. Signed-off-by: Robert Lubos --- drivers/ieee802154/ieee802154_nrf5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 458b4e90e8a..075555542bf 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -943,9 +943,9 @@ static int nrf5_configure(const struct device *dev, #if defined(CONFIG_NRF_802154_SER_HOST) net_time_t period_ns = nrf5_data.csl_period * NSEC_PER_TEN_SYMBOLS; - bool changed = (config->expected_rx_time - nrf5_data.csl_rx_time) % period_ns; + bool changed = (config->csl_rx_time - nrf5_data.csl_rx_time) % period_ns; - nrf5_data.csl_rx_time = config->expected_rx_time; + nrf5_data.csl_rx_time = config->csl_rx_time; if (changed) #endif /* CONFIG_NRF_802154_SER_HOST */ From 4b3d834479e7b7df5e3703caac48219fd9f0c1dc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:18 +0100 Subject: [PATCH 1316/2300] Revert "[nrf fromlist] wifi: shell: Add a shell command to list stations" This reverts commit 2fd793f4135114c03ce7c4525e25b6793204d4b1. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/Kconfig | 8 --- subsys/net/l2/wifi/wifi_shell.c | 90 --------------------------------- 2 files changed, 98 deletions(-) diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 2816be56d74..134448aa57f 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -64,14 +64,6 @@ config WIFI_MGMT_SCAN_CHAN_MAX_MANUAL There are approximately 100 channels allocated across the three supported bands. The default of 3 allows the 3 most common channels (2.4GHz: 1, 6, 11) to be specified. -config WIFI_SHELL_MAX_AP_STA - int "Maximum number of APs and STAs that can be managed in Wi-Fi shell" - range 1 5 - default 1 - help - This option defines the maximum number of APs and STAs that can be managed - in Wi-Fi shell. - config WIFI_NM bool "Wi-Fi Network manager support" help diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1ee94304781..045fbed197e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -24,7 +24,6 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #include #include #include -#include #include "net_private.h" @@ -65,13 +64,6 @@ static uint32_t scan_result; static struct net_mgmt_event_callback wifi_shell_mgmt_cb; -static K_MUTEX_DEFINE(wifi_ap_sta_list_lock); -struct wifi_ap_sta_node { - bool valid; - struct wifi_ap_sta_info sta_info; -}; -static struct wifi_ap_sta_node sta_list[CONFIG_WIFI_SHELL_MAX_AP_STA]; - #define print(sh, level, fmt, ...) \ do { \ if (sh) { \ @@ -336,10 +328,6 @@ static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) } else { print(context.sh, SHELL_NORMAL, "AP disabled\n"); } - - k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); - memset(&sta_list, 0, sizeof(sta_list)); - k_mutex_unlock(&wifi_ap_sta_list_lock); } static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) @@ -347,25 +335,10 @@ static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) const struct wifi_ap_sta_info *sta_info = (const struct wifi_ap_sta_info *)cb->info; uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - int i; print(context.sh, SHELL_NORMAL, "Station connected: %s\n", net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, mac_string_buf, sizeof(mac_string_buf))); - - k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); - for (i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { - if (!sta_list[i].valid) { - sta_list[i].sta_info = *sta_info; - sta_list[i].valid = true; - break; - } - } - if (i == CONFIG_WIFI_SHELL_MAX_AP_STA) { - print(context.sh, SHELL_WARNING, "No space to store station info: " - "Increase CONFIG_WIFI_SHELL_MAX_AP_STA\n"); - } - k_mutex_unlock(&wifi_ap_sta_list_lock); } static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) @@ -377,20 +350,6 @@ static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) print(context.sh, SHELL_NORMAL, "Station disconnected: %s\n", net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, mac_string_buf, sizeof(mac_string_buf))); - - k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); - for (int i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { - if (!sta_list[i].valid) { - continue; - } - - if (!memcmp(sta_list[i].sta_info.mac, sta_info->mac, - WIFI_MAC_ADDR_LEN)) { - sta_list[i].valid = false; - break; - } - } - k_mutex_unlock(&wifi_ap_sta_list_lock); } static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, @@ -1210,8 +1169,6 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, context.sh = sh; - k_mutex_init(&wifi_ap_sta_list_lock); - ret = net_mgmt(NET_REQUEST_WIFI_AP_ENABLE, iface, &cnx_params, sizeof(struct wifi_connect_req_params)); if (ret) { @@ -1240,49 +1197,6 @@ static int cmd_wifi_ap_disable(const struct shell *sh, size_t argc, return 0; } -static int cmd_wifi_ap_stations(const struct shell *sh, size_t argc, - char *argv[]) -{ - size_t id = 1; - - ARG_UNUSED(argv); - ARG_UNUSED(argc); - - shell_fprintf(sh, SHELL_NORMAL, "AP stations:\n"); - shell_fprintf(sh, SHELL_NORMAL, "============\n"); - - k_mutex_lock(&wifi_ap_sta_list_lock, K_FOREVER); - for (int i = 0; i < CONFIG_WIFI_SHELL_MAX_AP_STA; i++) { - struct wifi_ap_sta_info *sta; - uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - - if (!sta_list[i].valid) { - continue; - } - - sta = &sta_list[i].sta_info; - - shell_fprintf(sh, SHELL_NORMAL, "Station %zu:\n", id++); - shell_fprintf(sh, SHELL_NORMAL, "==========\n"); - shell_fprintf(sh, SHELL_NORMAL, "MAC: %s\n", - net_sprint_ll_addr_buf(sta->mac, - WIFI_MAC_ADDR_LEN, - mac_string_buf, - sizeof(mac_string_buf))); - shell_fprintf(sh, SHELL_NORMAL, "Link mode: %s\n", - wifi_link_mode_txt(sta->link_mode)); - shell_fprintf(sh, SHELL_NORMAL, "TWT: %s\n", - sta->twt_capable ? "Supported" : "Not supported"); - } - - if (id == 1) { - shell_fprintf(sh, SHELL_NORMAL, "No stations connected\n"); - } - k_mutex_unlock(&wifi_ap_sta_list_lock); - - return 0; -} - static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, char *argv[]) @@ -1761,10 +1675,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_ap_enable, 2, 4), - SHELL_CMD_ARG(stations, NULL, - "List stations connected to the AP", - cmd_wifi_ap_stations, - 1, 0), SHELL_SUBCMD_SET_END ); From 381677a6ad318d9a0118088e1e98a79964202921 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:18 +0100 Subject: [PATCH 1317/2300] Revert "[nrf fromlist] wifi: ap: Add client side events" This reverts commit ad65b863a10809780df85856cf571b746ceab227. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 38 --------------------------------- subsys/net/l2/wifi/wifi_mgmt.c | 16 -------------- subsys/net/l2/wifi/wifi_shell.c | 32 +-------------------------- 3 files changed, 1 insertion(+), 85 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 78800f451e7..0897bdd5715 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -184,10 +184,6 @@ enum net_event_wifi_cmd { NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT, /** AP mode disable result */ NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT, - /** STA connected to AP */ - NET_EVENT_WIFI_CMD_AP_STA_CONNECTED, - /** STA disconnected from AP */ - NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED, }; #define NET_EVENT_WIFI_SCAN_RESULT \ @@ -223,12 +219,6 @@ enum net_event_wifi_cmd { #define NET_EVENT_WIFI_AP_DISABLE_RESULT \ (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT) -#define NET_EVENT_WIFI_AP_STA_CONNECTED \ - (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) - -#define NET_EVENT_WIFI_AP_STA_DISCONNECTED \ - (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED) - /** * @brief Wi-Fi structure to uniquely identify a band-channel pair */ @@ -578,18 +568,6 @@ struct wifi_raw_scan_result { }; #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ -/** AP mode - connected STA details */ -struct wifi_ap_sta_info { - /** Link mode, see enum wifi_link_mode */ - enum wifi_link_mode link_mode; - /** MAC address */ - uint8_t mac[WIFI_MAC_ADDR_LEN]; - /** MAC address length */ - uint8_t mac_length; - /** is TWT capable ? */ - bool twt_capable; -}; - /* for use in max info size calculations */ union wifi_mgmt_events { struct wifi_scan_result scan_result; @@ -599,7 +577,6 @@ union wifi_mgmt_events { struct wifi_raw_scan_result raw_scan_result; #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ struct wifi_twt_params twt_params; - struct wifi_ap_sta_info ap_sta_info; }; /** Wi-Fi mode setup */ @@ -872,21 +849,6 @@ void wifi_mgmt_raise_ap_enable_result_event(struct net_if *iface, enum wifi_ap_s */ void wifi_mgmt_raise_ap_disable_result_event(struct net_if *iface, enum wifi_ap_status status); -/** Wi-Fi management AP mode STA connected event - * - * @param iface Network interface - * @param sta_info STA information - */ -void wifi_mgmt_raise_ap_sta_connected_event(struct net_if *iface, - struct wifi_ap_sta_info *sta_info); - -/** Wi-Fi management AP mode STA disconnected event - * @param iface Network interface - * @param sta_info STA information - */ -void wifi_mgmt_raise_ap_sta_disconnected_event(struct net_if *iface, - struct wifi_ap_sta_info *sta_info); - /** * @} */ diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 6e0cb761dbf..21a426d794d 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -731,19 +731,3 @@ void wifi_mgmt_raise_ap_disable_result_event(struct net_if *iface, iface, &cnx_status, sizeof(enum wifi_ap_status)); } - -void wifi_mgmt_raise_ap_sta_connected_event(struct net_if *iface, - struct wifi_ap_sta_info *sta_info) -{ - net_mgmt_event_notify_with_info(NET_EVENT_WIFI_AP_STA_CONNECTED, - iface, sta_info, - sizeof(struct wifi_ap_sta_info)); -} - -void wifi_mgmt_raise_ap_sta_disconnected_event(struct net_if *iface, - struct wifi_ap_sta_info *sta_info) -{ - net_mgmt_event_notify_with_info(NET_EVENT_WIFI_AP_STA_DISCONNECTED, - iface, sta_info, - sizeof(struct wifi_ap_sta_info)); -} diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 045fbed197e..217e4c703c0 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -35,9 +35,7 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); NET_EVENT_WIFI_TWT |\ NET_EVENT_WIFI_RAW_SCAN_RESULT |\ NET_EVENT_WIFI_AP_ENABLE_RESULT |\ - NET_EVENT_WIFI_AP_DISABLE_RESULT |\ - NET_EVENT_WIFI_AP_STA_CONNECTED |\ - NET_EVENT_WIFI_AP_STA_DISCONNECTED) + NET_EVENT_WIFI_AP_DISABLE_RESULT) #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY #define WIFI_SHELL_MGMT_EVENTS (WIFI_SHELL_MGMT_EVENTS_COMMON) @@ -330,28 +328,6 @@ static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) } } -static void handle_wifi_ap_sta_connected(struct net_mgmt_event_callback *cb) -{ - const struct wifi_ap_sta_info *sta_info = - (const struct wifi_ap_sta_info *)cb->info; - uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - - print(context.sh, SHELL_NORMAL, "Station connected: %s\n", - net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, - mac_string_buf, sizeof(mac_string_buf))); -} - -static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) -{ - const struct wifi_ap_sta_info *sta_info = - (const struct wifi_ap_sta_info *)cb->info; - uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - - print(context.sh, SHELL_NORMAL, "Station disconnected: %s\n", - net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, - mac_string_buf, sizeof(mac_string_buf))); -} - static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { @@ -382,12 +358,6 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, case NET_EVENT_WIFI_AP_DISABLE_RESULT: handle_wifi_ap_disable_result(cb); break; - case NET_EVENT_WIFI_AP_STA_CONNECTED: - handle_wifi_ap_sta_connected(cb); - break; - case NET_EVENT_WIFI_AP_STA_DISCONNECTED: - handle_wifi_ap_sta_disconnected(cb); - break; default: break; } From 72101b7fbed12d63034104bd4fcd0e2f2697ea19 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:18 +0100 Subject: [PATCH 1318/2300] Revert "[nrf fromlist] wifi: ap: Add status events" This reverts commit c7c88b07661d5ff0d2af754a93f76410d6e1ef7a. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 47 --------------------------------- subsys/net/l2/wifi/wifi_mgmt.c | 24 ----------------- subsys/net/l2/wifi/wifi_shell.c | 41 +++------------------------- 3 files changed, 4 insertions(+), 108 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 0897bdd5715..babf67722c1 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -180,10 +180,6 @@ enum net_event_wifi_cmd { NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT, /** Disconnect complete */ NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE, - /** AP mode enable result */ - NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT, - /** AP mode disable result */ - NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT, }; #define NET_EVENT_WIFI_SCAN_RESULT \ @@ -213,12 +209,6 @@ enum net_event_wifi_cmd { #define NET_EVENT_WIFI_DISCONNECT_COMPLETE \ (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE) -#define NET_EVENT_WIFI_AP_ENABLE_RESULT \ - (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT) - -#define NET_EVENT_WIFI_AP_DISABLE_RESULT \ - (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT) - /** * @brief Wi-Fi structure to uniquely identify a band-channel pair */ @@ -361,35 +351,12 @@ enum wifi_disconn_reason { WIFI_REASON_DISCONN_INACTIVITY, }; -/** Wi-Fi AP mode result codes. To be overlaid on top of \ref wifi_status - * in the AP mode enable or disable result event for detailed status. - */ -enum wifi_ap_status { - /** AP mode enable or disable successful */ - WIFI_STATUS_AP_SUCCESS = 0, - /** AP mode enable or disable failed - generic failure */ - WIFI_STATUS_AP_FAIL, - /** AP mode enable failed - channel not supported */ - WIFI_STATUS_AP_CHANNEL_NOT_SUPPORTED, - /** AP mode enable failed - channel not allowed */ - WIFI_STATUS_AP_CHANNEL_NOT_ALLOWED, - /** AP mode enable failed - SSID not allowed */ - WIFI_STATUS_AP_SSID_NOT_ALLOWED, - /** AP mode enable failed - authentication type not supported */ - WIFI_STATUS_AP_AUTH_TYPE_NOT_SUPPORTED, - /** AP mode enable failed - operation not supported */ - WIFI_STATUS_AP_OP_NOT_SUPPORTED, - /** AP mode enable failed - operation not permitted */ - WIFI_STATUS_AP_OP_NOT_PERMITTED, -}; - /** Generic Wi-Fi status for commands and events */ struct wifi_status { union { int status; enum wifi_conn_status conn_status; enum wifi_disconn_reason disconn_reason; - enum wifi_ap_status ap_status; }; }; @@ -835,20 +802,6 @@ 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); -/** Wi-Fi management AP mode enable result event - * - * @param iface Network interface - * @param status AP mode enable result status - */ -void wifi_mgmt_raise_ap_enable_result_event(struct net_if *iface, enum wifi_ap_status status); - -/** Wi-Fi management AP mode disable result event - * - * @param iface Network interface - * @param status AP mode disable result status - */ -void wifi_mgmt_raise_ap_disable_result_event(struct net_if *iface, enum wifi_ap_status status); - /** * @} */ diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 21a426d794d..1a866d4c47c 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -707,27 +707,3 @@ void wifi_mgmt_raise_disconnect_complete_event(struct net_if *iface, iface, &cnx_status, sizeof(struct wifi_status)); } - -void wifi_mgmt_raise_ap_enable_result_event(struct net_if *iface, - enum wifi_ap_status status) -{ - struct wifi_status cnx_status = { - .status = status, - }; - - net_mgmt_event_notify_with_info(NET_EVENT_WIFI_AP_ENABLE_RESULT, - iface, &cnx_status, - sizeof(enum wifi_ap_status)); -} - -void wifi_mgmt_raise_ap_disable_result_event(struct net_if *iface, - enum wifi_ap_status status) -{ - struct wifi_status cnx_status = { - .status = status, - }; - - net_mgmt_event_notify_with_info(NET_EVENT_WIFI_AP_DISABLE_RESULT, - iface, &cnx_status, - sizeof(enum wifi_ap_status)); -} diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 217e4c703c0..236e5cd05b8 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -33,9 +33,7 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); NET_EVENT_WIFI_CONNECT_RESULT |\ NET_EVENT_WIFI_DISCONNECT_RESULT | \ NET_EVENT_WIFI_TWT |\ - NET_EVENT_WIFI_RAW_SCAN_RESULT |\ - NET_EVENT_WIFI_AP_ENABLE_RESULT |\ - NET_EVENT_WIFI_AP_DISABLE_RESULT) + NET_EVENT_WIFI_RAW_SCAN_RESULT) #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY #define WIFI_SHELL_MGMT_EVENTS (WIFI_SHELL_MGMT_EVENTS_COMMON) @@ -302,32 +300,6 @@ static void handle_wifi_twt_event(struct net_mgmt_event_callback *cb) } } -static void handle_wifi_ap_enable_result(struct net_mgmt_event_callback *cb) -{ - const struct wifi_status *status = - (const struct wifi_status *)cb->info; - - if (status->status) { - print(context.sh, SHELL_WARNING, - "AP enable request failed (%d)\n", status->status); - } else { - print(context.sh, SHELL_NORMAL, "AP enabled\n"); - } -} - -static void handle_wifi_ap_disable_result(struct net_mgmt_event_callback *cb) -{ - const struct wifi_status *status = - (const struct wifi_status *)cb->info; - - if (status->status) { - print(context.sh, SHELL_WARNING, - "AP disable request failed (%d)\n", status->status); - } else { - print(context.sh, SHELL_NORMAL, "AP disabled\n"); - } -} - static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { @@ -352,12 +324,6 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, handle_wifi_raw_scan_result(cb); break; #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ - case NET_EVENT_WIFI_AP_ENABLE_RESULT: - handle_wifi_ap_enable_result(cb); - break; - case NET_EVENT_WIFI_AP_DISABLE_RESULT: - handle_wifi_ap_disable_result(cb); - break; default: break; } @@ -1146,7 +1112,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "AP mode enable requested\n"); + shell_fprintf(sh, SHELL_NORMAL, "AP mode enabled\n"); return 0; } @@ -1163,7 +1129,8 @@ static int cmd_wifi_ap_disable(const struct shell *sh, size_t argc, return -ENOEXEC; } - shell_fprintf(sh, SHELL_NORMAL, "AP mode disable requested\n"); + shell_fprintf(sh, SHELL_NORMAL, "AP mode disabled\n"); + return 0; } From f9e91c9e8f2bf4533773311f2b27e46aaf9d8445 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:18 +0100 Subject: [PATCH 1319/2300] Revert "[nrf fromlist] wifi: Fix duplication" This reverts commit 9ceed40d25789ac60f90d9c3496b65295ab840ea. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 236e5cd05b8..9bf33e827ec 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -29,17 +29,19 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #define WIFI_SHELL_MODULE "wifi" -#define WIFI_SHELL_MGMT_EVENTS_COMMON (NET_EVENT_WIFI_SCAN_DONE |\ - NET_EVENT_WIFI_CONNECT_RESULT |\ - NET_EVENT_WIFI_DISCONNECT_RESULT | \ - NET_EVENT_WIFI_TWT |\ - NET_EVENT_WIFI_RAW_SCAN_RESULT) - #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY -#define WIFI_SHELL_MGMT_EVENTS (WIFI_SHELL_MGMT_EVENTS_COMMON) +#define WIFI_SHELL_MGMT_EVENTS (NET_EVENT_WIFI_RAW_SCAN_RESULT | \ + NET_EVENT_WIFI_SCAN_DONE | \ + NET_EVENT_WIFI_CONNECT_RESULT | \ + NET_EVENT_WIFI_DISCONNECT_RESULT | \ + NET_EVENT_WIFI_TWT) #else -#define WIFI_SHELL_MGMT_EVENTS (WIFI_SHELL_MGMT_EVENTS_COMMON |\ - NET_EVENT_WIFI_SCAN_RESULT) +#define WIFI_SHELL_MGMT_EVENTS (NET_EVENT_WIFI_SCAN_RESULT | \ + NET_EVENT_WIFI_SCAN_DONE | \ + NET_EVENT_WIFI_CONNECT_RESULT | \ + NET_EVENT_WIFI_DISCONNECT_RESULT | \ + NET_EVENT_WIFI_TWT | \ + NET_EVENT_WIFI_RAW_SCAN_RESULT) #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY */ static struct { From d29245fce23f27e8bdb5d2b3ec3256a1e2caab75 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:18 +0100 Subject: [PATCH 1320/2300] Revert "[nrf fromlist] shell: Add a space after colon" This reverts commit b8a072b24cf4445756b8265ad5ae6300702e9bde. Signed-off-by: Robert Lubos --- subsys/shell/shell_help.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/shell/shell_help.c b/subsys/shell/shell_help.c index 235e2111032..53bf00953c1 100644 --- a/subsys/shell/shell_help.c +++ b/subsys/shell/shell_help.c @@ -139,7 +139,7 @@ static void help_item_print(const struct shell *sh, const char *item_name, z_cursor_next_line_move(sh); return; } else { - z_shell_fprintf(sh, SHELL_NORMAL, "%s: ", tabulator); + z_shell_fprintf(sh, SHELL_NORMAL, "%s:", tabulator); } /* print option help */ formatted_text_print(sh, item_help, offset, false); From f831792a75b3023cb0b667a74bcf2b6b7a83148b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:19 +0100 Subject: [PATCH 1321/2300] Revert "[nrf fromlist] wifi: shell: Fix the inconsistency in commands separation" This reverts commit 8a95bf43a03a4082f60af65c83363e964117cb15. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 98 ++++++++++++++++----------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 9bf33e827ec..a983e5c18f5 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1601,7 +1601,7 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, SHELL_CMD_ARG(disable, NULL, - "Disable Access Point mode.\n", + "Disable Access Point mode", cmd_wifi_ap_disable, 1, 0), SHELL_CMD_ARG(enable, NULL, @@ -1611,7 +1611,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[MFP (optional: needs security type to be specified)]\n" - ": 0:Disable, 1:Optional, 2:Required.\n", + ": 0:Disable, 1:Optional, 2:Required", cmd_wifi_ap_enable, 2, 4), SHELL_SUBCMD_SET_END @@ -1619,30 +1619,30 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, SHELL_CMD_ARG(quick_setup, NULL, " Start a TWT flow with defaults:\n" - " .\n", + " \n", cmd_wifi_twt_setup_quick, 3, 0), SHELL_CMD_ARG(setup, NULL, " Start a TWT flow:\n" "\n" "\n" " " - " .\n", + " \n", cmd_wifi_twt_setup, 11, 0), SHELL_CMD_ARG(teardown, NULL, " Teardown a TWT flow:\n" "\n" "\n" - " .\n", + " \n", cmd_wifi_twt_teardown, 5, 0), - SHELL_CMD_ARG(teardown_all, NULL, " Teardown all TWT flows.\n", + SHELL_CMD_ARG(teardown_all, NULL, " Teardown all TWT flows\n", cmd_wifi_twt_teardown_all, 1, 0), SHELL_SUBCMD_SET_END ); SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, - SHELL_CMD(ap, &wifi_cmd_ap, "Access Point mode commands.\n", NULL), + SHELL_CMD(ap, &wifi_cmd_ap, "Access Point mode commands", NULL), SHELL_CMD_ARG(connect, NULL, "Connect to a Wi-Fi AP\n" "\"\"\n" @@ -1651,108 +1651,108 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[MFP (optional: needs security type to be specified)]\n" - ": 0:Disable, 1:Optional, 2:Required.\n", + ": 0:Disable, 1:Optional, 2:Required", cmd_wifi_connect, 2, 4), - SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP.\n", + SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP", cmd_wifi_disconnect, 1, 0), SHELL_CMD_ARG(ps, NULL, "Configure or display Wi-Fi power save state\n" - "[on/off].\n", + "[on/off]\n", cmd_wifi_ps, 1, 1), SHELL_CMD_ARG(ps_mode, NULL, - ".\n", + "\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" + "[-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-11,14_5:36,149-165,44\n" - "[-h, --help] : Print out the help for the scan command.\n", + "[-h, --help] : Print out the help for the scan command.", cmd_wifi_scan, 1, 8), - SHELL_CMD_ARG(statistics, NULL, "Wi-Fi interface statistics.\n", cmd_wifi_stats, 1, 0), - 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(statistics, NULL, "Wi-Fi interface statistics", cmd_wifi_stats, 1, 0), + SHELL_CMD_ARG(status, NULL, "Status of the Wi-Fi interface", cmd_wifi_status, 1, 0), + SHELL_CMD(twt, &wifi_twt_ops, "Manage TWT flows", 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", + "Note: This may cause regulatory compliance issues, use it at your own risk.", 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" - "[-p, --promiscuous] : Promiscuous mode\n" - "[-t, --tx-injection] : TX-Injection 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" + "[-i, --if-index ] : Interface index.\n" + "[-s, --sta] : Station mode.\n" + "[-m, --monitor] : Monitor mode.\n" + "[-p, --promiscuous] : Promiscuous mode.\n" + "[-t, --tx-injection] : TX-Injection 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", + "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" + "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" + "[-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" + "[-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" + "[-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", + "wifi packet_filter -i1 -md\n", cmd_wifi_packet_filter, 1, 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" + "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" + "[-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", + "wifi -i1 -c5\n", cmd_wifi_channel, 1, 4), SHELL_CMD_ARG(ps_timeout, NULL, - " - PS inactivity timer(in ms).\n", + " - PS inactivity timer(in ms)", cmd_wifi_ps_timeout, 2, 0), SHELL_CMD_ARG(ps_listen_interval, NULL, - " - Listen interval in the range of <0-65535>.\n", + " - Listen interval in the range of <0-65535>", cmd_wifi_listen_interval, 2, 0), SHELL_CMD_ARG(ps_wakeup_mode, NULL, - ".\n", + "\n", cmd_wifi_ps_wakeup_mode, 2, 0), From 241da498078fb7db7cf68cf4f3fa29a09a698e96 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:19 +0100 Subject: [PATCH 1322/2300] Revert "[nrf fromlist] wifi: shell: Remove the unnecessary text" This reverts commit 3b9ee8bc4cd125c4b9746210dc868c953064a704. Signed-off-by: Robert Lubos --- 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 a983e5c18f5..890bb8f121e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1691,6 +1691,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, 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" + "parameters:" "[-i, --if-index ] : Interface index.\n" "[-s, --sta] : Station mode.\n" "[-m, --monitor] : Monitor mode.\n" @@ -1710,6 +1711,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "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" + "parameters:" "[-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" @@ -1728,6 +1730,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "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" + "parameters:" "[-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" From df26b92ed13c359c9a06e92922729178e20ca553 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:19 +0100 Subject: [PATCH 1323/2300] Revert "[nrf fromlist] wifi: shell: Fix the help for reg domain" This reverts commit 28e13ec6f32b0fc21c9a60b7e7f0c45fed79bb4a. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 890bb8f121e..d6d14c86bf1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1684,7 +1684,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(twt, &wifi_twt_ops, "Manage TWT flows", NULL), SHELL_CMD_ARG(reg_domain, NULL, "Set or Get Wi-Fi regulatory domain\n" - "[ISO/IEC 3166-1 alpha2]: Regulatory domain\n" + "Usage: wifi reg_domain [ISO/IEC 3166-1 alpha2] [-f]\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.", cmd_wifi_reg_domain, From f27fb067e10bcf1584de32d4725745ac5a8f0ae4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:19 +0100 Subject: [PATCH 1324/2300] Revert "[nrf fromlist] wifi: shell: Remove the unnecessary text in scan" This reverts commit 60706e2ec827338ef8f7334b07f282b4f2e94640. Signed-off-by: Robert Lubos --- 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 d6d14c86bf1..6ef745670ab 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1669,6 +1669,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, 0), SHELL_CMD_ARG(scan, NULL, "Scan for Wi-Fi APs\n" + "OPTIONAL PARAMETERS:\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" From 1055ad7fae6a75fd95ef306a6f2533092aec9e9c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:19 +0100 Subject: [PATCH 1325/2300] Revert "[nrf fromlist] wifi: shell: Fix help for PS command" This reverts commit e3d7c1fd5946fbde994e5e4df947b412cd545d5b. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 6ef745670ab..dbec138fea0 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1657,8 +1657,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP", cmd_wifi_disconnect, 1, 0), - SHELL_CMD_ARG(ps, NULL, "Configure or display Wi-Fi power save state\n" - "[on/off]\n", + SHELL_CMD_ARG(ps, NULL, "Configure Wi-F PS on/off, no arguments will dump config", cmd_wifi_ps, 1, 1), SHELL_CMD_ARG(ps_mode, From 4de7b0727346074cd785b69d22835cb63307e35d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:20 +0100 Subject: [PATCH 1326/2300] Revert "[nrf fromlist] wifi: shell: Fix optional arg count for connect" This reverts commit 285ad75652402f16e03417f19e74d4e10e33fa83. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index dbec138fea0..c3100c9ad2c 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1653,7 +1653,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required", cmd_wifi_connect, - 2, 4), + 2, 5), SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP", cmd_wifi_disconnect, 1, 0), From 9e0196b5ca3cec3152821c702af3b32bf3b743cc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:20 +0100 Subject: [PATCH 1327/2300] Revert "[nrf fromlist] wifi: shell: Fix the arg count for reg domain" This reverts commit 422e1af4f1127626f944452e907073f0f3592077. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c3100c9ad2c..3aa674e73b7 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1688,7 +1688,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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.", cmd_wifi_reg_domain, - 1, 2), + 1, 1), 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" "parameters:" From 6ce36f61961e801ddbc34ad7e0e2fd715d442446 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:20 +0100 Subject: [PATCH 1328/2300] Revert "[nrf fromlist] wifi: shell: Fix arg count for regulatory domain" This reverts commit 1b56e7b4b8c7411ca21e87e326088a91e4d96218. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 3aa674e73b7..f1a98105204 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1688,7 +1688,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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.", cmd_wifi_reg_domain, - 1, 1), + 2, 1), 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" "parameters:" From bd69cd62221d81f708c30bb54c0e60b0ae4c1f19 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:20 +0100 Subject: [PATCH 1329/2300] Revert "[nrf fromtree] wifi: shell: Display RSSI only for station mode" This reverts commit 048e524fd969fc0fb0229f869fc523424948d28b. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index f1a98105204..e243a9de4e4 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -660,9 +660,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) wifi_security_txt(status.security)); shell_fprintf(sh, SHELL_NORMAL, "MFP: %s\n", wifi_mfp_txt(status.mfp)); - if (status.iface_mode == WIFI_MODE_INFRA) { - shell_fprintf(sh, SHELL_NORMAL, "RSSI: %d\n", status.rssi); - } + shell_fprintf(sh, SHELL_NORMAL, "RSSI: %d\n", status.rssi); shell_fprintf(sh, SHELL_NORMAL, "Beacon Interval: %d\n", status.beacon_interval); shell_fprintf(sh, SHELL_NORMAL, "DTIM: %d\n", status.dtim_period); shell_fprintf(sh, SHELL_NORMAL, "TWT: %s\n", From c6503511376101a04c502d0c182603bf1fcbd1bf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:20 +0100 Subject: [PATCH 1330/2300] Revert "[nrf fromtree] wifi: shell: Fix AP argument checks and help" This reverts commit 2270d5f523f83ec3c69f192e64af48c6f1b71acc. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index e243a9de4e4..c5b8f60d933 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1602,16 +1602,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, "Disable Access Point mode", cmd_wifi_ap_disable, 1, 0), - SHELL_CMD_ARG(enable, NULL, - "\"\"\n" - "[channel number: 0 means all]\n" - "[PSK: valid only for secure SSIDs]\n" - "[Security type: valid only for secure SSIDs]\n" - "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" - "[MFP (optional: needs security type to be specified)]\n" - ": 0:Disable, 1:Optional, 2:Required", + SHELL_CMD_ARG(enable, NULL, " [channel] [PSK]", cmd_wifi_ap_enable, - 2, 4), + 2, 1), SHELL_SUBCMD_SET_END ); From 30cbc661887ec226e78ffab241567d53aec5c56e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:20 +0100 Subject: [PATCH 1331/2300] Revert "[nrf fromtree] drivers: nrf_qspi_nor: Fix and refactor driver initialization" This reverts commit eeeb0aa138b32372ec79c1e3d7bf72bd497ff231. Signed-off-by: Robert Lubos --- drivers/flash/nrf_qspi_nor.c | 125 ++++++++++++++++++++++------------- 1 file changed, 80 insertions(+), 45 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index d6695989857..aa6449763be 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -599,10 +599,41 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) return rc != 0 ? rc : rc2; } -static int configure_chip(const struct device *dev) +/* Configures QSPI memory for the transfer */ +static int qspi_nrfx_configure(const struct device *dev) { + struct qspi_nor_data *dev_data = dev->data; const struct qspi_nor_config *dev_config = dev->config; - int rc = 0; + nrfx_err_t res; + int rc; + + res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); + rc = qspi_get_zephyr_ret_code(res); + if (rc < 0) { + return rc; + } + +#if DT_INST_NODE_HAS_PROP(0, rx_delay) + if (!nrf53_errata_121()) { + nrf_qspi_iftiming_set(NRF_QSPI, DT_INST_PROP(0, rx_delay)); + } +#endif + + /* It may happen that after the flash chip was previously put into + * the DPD mode, the system was reset but the flash chip was not. + * Consequently, the flash chip can be in the DPD mode at this point. + * Some flash chips will just exit the DPD mode on the first CS pulse, + * but some need to receive the dedicated command to do it, so send it. + * This can be the case even if the current image does not have + * CONFIG_PM_DEVICE set to enter DPD mode, as a previously executing image + * (for example the main image if the currently executing image is the + * bootloader) might have set DPD mode before reboot. As a result, + * attempt to exit DPD mode regardless of whether CONFIG_PM_DEVICE is set. + */ + rc = exit_dpd(dev); + if (rc < 0) { + return rc; + } /* Set QE to match transfer mode. If not using quad * it's OK to leave QE set, but doing so prevents use @@ -753,6 +784,33 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, #endif /* CONFIG_FLASH_JESD216_API */ +/** + * @brief Retrieve the Flash JEDEC ID and compare it with the one expected + * + * @param dev The device structure + * @return 0 on success, negative errno code otherwise + */ +static inline int qspi_nor_read_id(const struct device *dev) +{ + uint8_t id[SPI_NOR_MAX_ID_LEN]; + int rc = qspi_rdid(dev, id); + + if (rc != 0) { + return -EIO; + } + + const struct qspi_nor_config *qnc = dev->config; + + if (memcmp(qnc->id, id, SPI_NOR_MAX_ID_LEN) != 0) { + LOG_ERR("JEDEC id [%02x %02x %02x] expect [%02x %02x %02x]", + id[0], id[1], id[2], + qnc->id[0], qnc->id[1], qnc->id[2]); + return -ENODEV; + } + + return 0; +} + static inline nrfx_err_t read_non_aligned(const struct device *dev, off_t addr, void *dest, size_t size) @@ -1019,58 +1077,35 @@ static int qspi_nor_write_protection_set(const struct device *dev, return rc; } -static int qspi_init(const struct device *dev) +/** + * @brief Configure the flash + * + * @param dev The flash device structure + * @param info The flash info structure + * @return 0 on success, negative errno code otherwise + */ +static int qspi_nor_configure(const struct device *dev) { - const struct qspi_nor_config *dev_config = dev->config; - uint8_t id[SPI_NOR_MAX_ID_LEN]; - nrfx_err_t res; - int rc; - - res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev->data); - rc = qspi_get_zephyr_ret_code(res); - if (rc < 0) { - return rc; - } - -#if DT_INST_NODE_HAS_PROP(0, rx_delay) - if (!nrf53_errata_121()) { - nrf_qspi_iftiming_set(NRF_QSPI, DT_INST_PROP(0, rx_delay)); - } -#endif - - /* It may happen that after the flash chip was previously put into - * the DPD mode, the system was reset but the flash chip was not. - * Consequently, the flash chip can be in the DPD mode at this point. - * Some flash chips will just exit the DPD mode on the first CS pulse, - * but some need to receive the dedicated command to do it, so send it. - * This can be the case even if the current image does not have - * CONFIG_PM_DEVICE set to enter DPD mode, as a previously executing image - * (for example the main image if the currently executing image is the - * bootloader) might have set DPD mode before reboot. As a result, - * attempt to exit DPD mode regardless of whether CONFIG_PM_DEVICE is set. - */ - rc = exit_dpd(dev); - if (rc < 0) { - return rc; - } + int rc = qspi_nrfx_configure(dev); - /* Retrieve the Flash JEDEC ID and compare it with the one expected. */ - rc = qspi_rdid(dev, id); - if (rc < 0) { + if (rc != 0) { return rc; } - if (memcmp(dev_config->id, id, SPI_NOR_MAX_ID_LEN) != 0) { - LOG_ERR("JEDEC id [%02x %02x %02x] expect [%02x %02x %02x]", - id[0], id[1], id[2], dev_config->id[0], - dev_config->id[1], dev_config->id[2]); + /* now the spi bus is configured, we can verify the flash id */ + if (qspi_nor_read_id(dev) != 0) { return -ENODEV; } - /* The chip is correct, it can be configured now. */ - return configure_chip(dev); + return 0; } +/** + * @brief Initialize and configure the flash + * + * @param name The flash name + * @return 0 on success, negative errno code otherwise + */ static int qspi_nor_init(const struct device *dev) { const struct qspi_nor_config *dev_config = dev->config; @@ -1086,7 +1121,7 @@ static int qspi_nor_init(const struct device *dev) qspi_clock_div_change(); - rc = qspi_init(dev); + rc = qspi_nor_configure(dev); qspi_clock_div_restore(); From 66622bbce3444f55b42e28eea7bcce2c1096cca5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:20 +0100 Subject: [PATCH 1332/2300] Revert "[nrf fromtree] drivers: nrf_qspi_nor: Refactor deactivation and locking access to QSPI" This reverts commit 90958c687bfd6723e8b902ae6e11263ecc00c3af. Signed-off-by: Robert Lubos --- drivers/flash/nrf_qspi_nor.c | 507 ++++++++++++++++++++++------------- 1 file changed, 314 insertions(+), 193 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index aa6449763be..ca4673e8aa2 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -26,15 +26,15 @@ LOG_MODULE_REGISTER(qspi_nor, CONFIG_FLASH_LOG_LEVEL); #include struct qspi_nor_data { -#if !defined(CONFIG_PM_DEVICE_RUNTIME) && defined(CONFIG_MULTITHREADING) - /* A semaphore to control QSPI deactivation. */ - struct k_sem count; -#endif #ifdef CONFIG_MULTITHREADING + /* The semaphore to control exclusive access on write/erase. */ + struct k_sem trans; /* The semaphore to control exclusive access to the device. */ struct k_sem sem; /* The semaphore to indicate that transfer has completed. */ struct k_sem sync; + /* The semaphore to control driver init/uninit. */ + struct k_sem count; #else /* CONFIG_MULTITHREADING */ /* A flag that signals completed transfer when threads are * not enabled. @@ -173,6 +173,12 @@ BUILD_ASSERT(DT_INST_PROP(0, address_size_32), "After entering 4 byte addressing mode, 4 byte addressing is expected"); #endif +#ifndef CONFIG_PM_DEVICE_RUNTIME +static bool qspi_initialized; +#endif + +static int qspi_device_init(const struct device *dev); +static void qspi_device_uninit(const struct device *dev); void z_impl_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable); void z_vrfy_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable); @@ -239,99 +245,72 @@ static inline int qspi_get_zephyr_ret_code(nrfx_err_t res) static inline void qspi_lock(const struct device *dev) { -#ifdef CONFIG_MULTITHREADING struct qspi_nor_data *dev_data = dev->data; + pm_device_busy_set(dev); + +#ifdef CONFIG_MULTITHREADING k_sem_take(&dev_data->sem, K_FOREVER); +#else /* CONFIG_MULTITHREADING */ + ARG_UNUSED(dev_data); +#endif /* CONFIG_MULTITHREADING */ + + /* + * Change the base clock divider only for the time the driver is locked + * to perform a QSPI operation, otherwise the power consumption would be + * increased also when the QSPI peripheral is idle. + * When XIP is enabled, there is nothing to do here as the changed + * divider is kept all the time. + */ +#if defined(CONFIG_SOC_SERIES_NRF53X) + if (!dev_data->xip_enabled) { + nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); + } #endif } static inline void qspi_unlock(const struct device *dev) { -#ifdef CONFIG_MULTITHREADING struct qspi_nor_data *dev_data = dev->data; - k_sem_give(&dev_data->sem); -#endif -} - -static inline void qspi_clock_div_change(void) -{ -#ifdef CONFIG_SOC_SERIES_NRF53X - /* Make sure the base clock divider is changed accordingly - * before a QSPI transfer is performed. +#if defined(CONFIG_SOC_SERIES_NRF53X) + /* Restore the default base clock divider to reduce power consumption. + * Unless XIP is enabled, then the changed divider needs to be kept. */ - nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); + if (!dev_data->xip_enabled) { + nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); + } #endif -} -static inline void qspi_clock_div_restore(void) -{ -#ifdef CONFIG_SOC_SERIES_NRF53X - /* Restore the default base clock divider to reduce power - * consumption when the QSPI peripheral is idle. - */ - nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); +#ifdef CONFIG_MULTITHREADING + k_sem_give(&dev_data->sem); +#else + ARG_UNUSED(dev_data); #endif + + pm_device_busy_clear(dev); } -static void qspi_acquire(const struct device *dev) +static inline void qspi_trans_lock(const struct device *dev) { +#ifdef CONFIG_MULTITHREADING struct qspi_nor_data *dev_data = dev->data; -#if defined(CONFIG_PM_DEVICE_RUNTIME) - int rc = pm_device_runtime_get(dev); - - if (rc < 0) { - LOG_ERR("pm_device_runtime_get failed: %d", rc); - } -#elif defined(CONFIG_MULTITHREADING) - /* In multithreading, the driver can call qspi_acquire more than once - * before calling qspi_release. Keeping count, so QSPI is deactivated - * only at the last call (count == 0). - */ - k_sem_give(&dev_data->count); -#endif - - qspi_lock(dev); - - if (!dev_data->xip_enabled) { - qspi_clock_div_change(); - - pm_device_busy_set(dev); - } + k_sem_take(&dev_data->trans, K_FOREVER); +#else /* CONFIG_MULTITHREADING */ + ARG_UNUSED(dev); +#endif /* CONFIG_MULTITHREADING */ } -static void qspi_release(const struct device *dev) +static inline void qspi_trans_unlock(const struct device *dev) { +#ifdef CONFIG_MULTITHREADING struct qspi_nor_data *dev_data = dev->data; - bool deactivate = true; -#if !defined(CONFIG_PM_DEVICE_RUNTIME) && defined(CONFIG_MULTITHREADING) - /* The last thread to finish using the driver deactivates the QSPI */ - (void) k_sem_take(&dev_data->count, K_NO_WAIT); - deactivate = (k_sem_count_get(&dev_data->count) == 0); -#endif - - if (!dev_data->xip_enabled) { - qspi_clock_div_restore(); - - if (deactivate && !IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { - (void) nrfx_qspi_deactivate(); - } - - pm_device_busy_clear(dev); - } - - qspi_unlock(dev); - -#if defined(CONFIG_PM_DEVICE_RUNTIME) - int rc = pm_device_runtime_put(dev); - - if (rc < 0) { - LOG_ERR("pm_device_runtime_put failed: %d", rc); - } -#endif + k_sem_give(&dev_data->trans); +#else /* CONFIG_MULTITHREADING */ + ARG_UNUSED(dev); +#endif /* CONFIG_MULTITHREADING */ } static inline void qspi_wait_for_completion(const struct device *dev, @@ -380,6 +359,89 @@ static void qspi_handler(nrfx_qspi_evt_t event, void *p_context) } } +static int qspi_device_init(const struct device *dev) +{ + struct qspi_nor_data *dev_data = dev->data; + + if (dev_data->xip_enabled) { + return 0; + } + +#ifdef CONFIG_PM_DEVICE_RUNTIME + return pm_device_runtime_get(dev); +#else + nrfx_err_t res; + int rc = 0; + + qspi_lock(dev); + + /* In multithreading, driver can call qspi_device_init more than once + * before calling qspi_device_uninit. Keepping count, so QSPI is + * uninitialized only at the last call (count == 0). + */ +#ifdef CONFIG_MULTITHREADING + k_sem_give(&dev_data->count); +#endif + + if (!qspi_initialized) { + const struct qspi_nor_config *dev_config = dev->config; + + res = nrfx_qspi_init(&dev_config->nrfx_cfg, + qspi_handler, + dev_data); + rc = qspi_get_zephyr_ret_code(res); + qspi_initialized = (rc == 0); + } + + qspi_unlock(dev); + + return rc; +#endif +} + +static void qspi_device_uninit(const struct device *dev) +{ + struct qspi_nor_data *dev_data = dev->data; + + if (dev_data->xip_enabled) { + return; + } + +#ifdef CONFIG_PM_DEVICE_RUNTIME + int rc = pm_device_runtime_put(dev); + + if (rc < 0) { + LOG_ERR("Failed to schedule device sleep: %d", rc); + } +#else + bool last = true; + + qspi_lock(dev); + +#ifdef CONFIG_MULTITHREADING + /* The last thread to finish using the driver uninit the QSPI */ + (void) k_sem_take(&dev_data->count, K_NO_WAIT); + last = (k_sem_count_get(&dev_data->count) == 0); +#endif + + if (last) { + while (nrfx_qspi_mem_busy_check() != NRFX_SUCCESS) { + if (IS_ENABLED(CONFIG_MULTITHREADING)) { + k_msleep(50); + } else { + k_busy_wait(50000); + } + } + + nrfx_qspi_uninit(); + + qspi_initialized = false; + } + + qspi_unlock(dev); +#endif +} + /* QSPI send custom command. * * If this is used for both send and receive the buffer sizes must be @@ -435,8 +497,11 @@ static int qspi_send_cmd(const struct device *dev, const struct qspi_cmd *cmd, .wren = wren, }; + qspi_lock(dev); + int res = nrfx_qspi_cinstr_xfer(&cinstr_cfg, tx_buf, rx_buf); + qspi_unlock(dev); return qspi_get_zephyr_ret_code(res); } @@ -552,13 +617,29 @@ static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) /* QSPI erase */ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) { + /* address must be sector-aligned */ + if ((addr % QSPI_SECTOR_SIZE) != 0) { + return -EINVAL; + } + + /* size must be a non-zero multiple of sectors */ + if ((size == 0) || (size % QSPI_SECTOR_SIZE) != 0) { + return -EINVAL; + } + const struct qspi_nor_config *params = dev->config; int rc, rc2; + rc = qspi_device_init(dev); + if (rc != 0) { + goto out; + } + qspi_trans_lock(dev); rc = qspi_nor_write_protection_set(dev, false); if (rc != 0) { - return rc; + goto out_trans_unlock; } + qspi_lock(dev); while (size > 0) { nrfx_err_t res = !NRFX_SUCCESS; uint32_t adj = 0; @@ -593,10 +674,20 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) break; } } + qspi_unlock(dev); rc2 = qspi_nor_write_protection_set(dev, true); - return rc != 0 ? rc : rc2; + if (!rc) { + rc = rc2; + } + +out_trans_unlock: + qspi_trans_unlock(dev); + +out: + qspi_device_uninit(dev); + return rc; } /* Configures QSPI memory for the transfer */ @@ -607,7 +698,22 @@ static int qspi_nrfx_configure(const struct device *dev) nrfx_err_t res; int rc; +#if defined(CONFIG_SOC_SERIES_NRF53X) + /* When the QSPI peripheral is activated, during the nrfx_qspi driver + * initialization, it reads the status of the connected flash chip. + * Make sure this transaction is performed with a valid base clock + * divider. + */ + nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); +#endif + res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); + +#if defined(CONFIG_SOC_SERIES_NRF53X) + /* Restore the default /4 divider after the QSPI initialization. */ + nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); +#endif + rc = qspi_get_zephyr_ret_code(res); if (rc < 0) { return rc; @@ -708,7 +814,8 @@ static int qspi_nrfx_configure(const struct device *dev) return rc; } -static int qspi_rdid(const struct device *dev, uint8_t *id) +static int qspi_read_jedec_id(const struct device *dev, + uint8_t *id) { const struct qspi_buf rx_buf = { .buf = id, @@ -719,24 +826,18 @@ static int qspi_rdid(const struct device *dev, uint8_t *id) .rx_buf = &rx_buf, }; - return qspi_send_cmd(dev, &cmd, false); -} - -#if defined(CONFIG_FLASH_JESD216_API) + int rc = qspi_device_init(dev); -static int qspi_read_jedec_id(const struct device *dev, uint8_t *id) -{ - int rc; - - qspi_acquire(dev); - - rc = qspi_rdid(dev, id); - - qspi_release(dev); + if (rc == 0) { + rc = qspi_send_cmd(dev, &cmd, false); + } + qspi_device_uninit(dev); return rc; } +#if defined(CONFIG_FLASH_JESD216_API) + static int qspi_sfdp_read(const struct device *dev, off_t offset, void *data, size_t len) { @@ -754,10 +855,17 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, .io2_level = true, .io3_level = true, }; - nrfx_err_t res; - qspi_acquire(dev); + int rc = qspi_device_init(dev); + nrfx_err_t res = NRFX_SUCCESS; + + if (rc != 0) { + LOG_DBG("qspi_device_init: %d", rc); + qspi_device_uninit(dev); + return rc; + } + qspi_lock(dev); res = nrfx_qspi_lfm_start(&cinstr_cfg); if (res != NRFX_SUCCESS) { LOG_DBG("lfm_start: %x", res); @@ -777,8 +885,8 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, } out: - qspi_release(dev); - + qspi_unlock(dev); + qspi_device_uninit(dev); return qspi_get_zephyr_ret_code(res); } @@ -793,7 +901,7 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, static inline int qspi_nor_read_id(const struct device *dev) { uint8_t id[SPI_NOR_MAX_ID_LEN]; - int rc = qspi_rdid(dev, id); + int rc = qspi_read_jedec_id(dev, id); if (rc != 0) { return -EIO; @@ -885,9 +993,6 @@ static inline nrfx_err_t read_non_aligned(const struct device *dev, static int qspi_nor_read(const struct device *dev, off_t addr, void *dest, size_t size) { - const struct qspi_nor_config *params = dev->config; - nrfx_err_t res; - if (!dest) { return -EINVAL; } @@ -897,6 +1002,8 @@ static int qspi_nor_read(const struct device *dev, off_t addr, void *dest, return 0; } + const struct qspi_nor_config *params = dev->config; + /* affected region should be within device */ if (addr < 0 || (addr + size) > params->size) { @@ -906,13 +1013,23 @@ static int qspi_nor_read(const struct device *dev, off_t addr, void *dest, return -EINVAL; } - qspi_acquire(dev); + int rc = qspi_device_init(dev); + + if (rc != 0) { + goto out; + } - res = read_non_aligned(dev, addr, dest, size); + qspi_lock(dev); - qspi_release(dev); + nrfx_err_t res = read_non_aligned(dev, addr, dest, size); - return qspi_get_zephyr_ret_code(res); + qspi_unlock(dev); + + rc = qspi_get_zephyr_ret_code(res); + +out: + qspi_device_uninit(dev); + return rc; } /* addr aligned, sptr not null, slen less than 4 */ @@ -977,9 +1094,6 @@ static int qspi_nor_write(const struct device *dev, off_t addr, const void *src, size_t size) { - const struct qspi_nor_config *params = dev->config; - int rc, rc2; - if (!src) { return -EINVAL; } @@ -994,6 +1108,9 @@ static int qspi_nor_write(const struct device *dev, off_t addr, return -EINVAL; } + const struct qspi_nor_config *params = dev->config; + int rc, rc2; + /* affected region should be within device */ if (addr < 0 || (addr + size) > params->size) { @@ -1003,9 +1120,15 @@ static int qspi_nor_write(const struct device *dev, off_t addr, return -EINVAL; } - qspi_acquire(dev); + rc = qspi_device_init(dev); + if (rc != 0) { + goto out; + } + + qspi_trans_lock(dev); rc = qspi_nor_write_protection_set(dev, false); + qspi_lock(dev); if (rc == 0) { nrfx_err_t res; @@ -1021,28 +1144,23 @@ static int qspi_nor_write(const struct device *dev, off_t addr, rc = qspi_get_zephyr_ret_code(res); } + qspi_unlock(dev); rc2 = qspi_nor_write_protection_set(dev, true); - qspi_release(dev); + qspi_trans_unlock(dev); + if (rc == 0) { + rc = rc2; + } - return rc != 0 ? rc : rc2; +out: + qspi_device_uninit(dev); + return rc; } static int qspi_nor_erase(const struct device *dev, off_t addr, size_t size) { const struct qspi_nor_config *params = dev->config; - int rc; - - /* address must be sector-aligned */ - if ((addr % QSPI_SECTOR_SIZE) != 0) { - return -EINVAL; - } - - /* size must be a non-zero multiple of sectors */ - if ((size == 0) || (size % QSPI_SECTOR_SIZE) != 0) { - return -EINVAL; - } /* affected region should be within device */ if (addr < 0 || @@ -1053,11 +1171,7 @@ static int qspi_nor_erase(const struct device *dev, off_t addr, size_t size) return -EINVAL; } - qspi_acquire(dev); - - rc = qspi_erase(dev, addr, size); - - qspi_release(dev); + int rc = qspi_erase(dev, addr, size); return rc; } @@ -1092,6 +1206,17 @@ static int qspi_nor_configure(const struct device *dev) return rc; } +#ifdef CONFIG_PM_DEVICE_RUNTIME + rc = pm_device_runtime_enable(dev); + if (rc < 0) { + LOG_ERR("Failed to enable runtime power management: %d", rc); + } else { + LOG_DBG("Runtime power management enabled"); + } +#else + qspi_device_uninit(dev); +#endif + /* now the spi bus is configured, we can verify the flash id */ if (qspi_nor_read_id(dev) != 0) { return -ENODEV; @@ -1119,24 +1244,10 @@ static int qspi_nor_init(const struct device *dev) IRQ_CONNECT(DT_IRQN(QSPI_NODE), DT_IRQ(QSPI_NODE, priority), nrfx_isr, nrfx_qspi_irq_handler, 0); - qspi_clock_div_change(); - rc = qspi_nor_configure(dev); - qspi_clock_div_restore(); - -#ifdef CONFIG_PM_DEVICE_RUNTIME - int rc2 = pm_device_runtime_enable(dev); - - if (rc2 < 0) { - LOG_ERR("Failed to enable runtime power management: %d", rc2); - } else { - LOG_DBG("Runtime power management enabled"); - } -#endif - #ifdef CONFIG_NORDIC_QSPI_NOR_XIP - if (rc == 0) { + if (!rc) { /* Enable XIP mode for QSPI NOR flash, this will prevent the * flash from being powered down */ @@ -1272,97 +1383,108 @@ static int exit_dpd(const struct device *const dev) } #ifdef CONFIG_PM_DEVICE -static int qspi_suspend(const struct device *dev) -{ - const struct qspi_nor_config *dev_config = dev->config; - nrfx_err_t res; - int rc; - - res = nrfx_qspi_mem_busy_check(); - if (res != NRFX_SUCCESS) { - return -EBUSY; - } - - rc = enter_dpd(dev); - if (rc < 0) { - return rc; - } - - nrfx_qspi_uninit(); - - return pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); -} - -static int qspi_resume(const struct device *dev) -{ - const struct qspi_nor_config *dev_config = dev->config; - nrfx_err_t res; - int rc; - - rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); - if (rc < 0) { - return rc; - } - - res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev->data); - if (res != NRFX_SUCCESS) { - return -EIO; - } - - return exit_dpd(dev); -} - static int qspi_nor_pm_action(const struct device *dev, enum pm_device_action action) { + struct qspi_nor_data *dev_data = dev->data; + const struct qspi_nor_config *dev_config = dev->config; int rc; + nrfx_err_t res; if (pm_device_is_busy(dev)) { return -EBUSY; } - qspi_lock(dev); - qspi_clock_div_change(); - switch (action) { case PM_DEVICE_ACTION_SUSPEND: - rc = qspi_suspend(dev); +#ifndef CONFIG_PM_DEVICE_RUNTIME + /* If PM_DEVICE_RUNTIME, we don't uninit after RESUME */ + rc = qspi_device_init(dev); + if (rc < 0) { + return rc; + } +#endif + + if (dev_data->xip_enabled) { + return -EBUSY; + } + + if (nrfx_qspi_mem_busy_check() != NRFX_SUCCESS) { + return -EBUSY; + } + + rc = enter_dpd(dev); + if (rc < 0) { + return rc; + } + + nrfx_qspi_uninit(); + rc = pinctrl_apply_state(dev_config->pcfg, + PINCTRL_STATE_SLEEP); + if (rc < 0) { + return rc; + } break; case PM_DEVICE_ACTION_RESUME: - rc = qspi_resume(dev); + rc = pinctrl_apply_state(dev_config->pcfg, + PINCTRL_STATE_DEFAULT); + if (rc < 0) { + return rc; + } + res = nrfx_qspi_init(&dev_config->nrfx_cfg, + qspi_handler, + dev_data); + if (res != NRFX_SUCCESS) { + return -EIO; + } + + rc = exit_dpd(dev); + if (rc < 0) { + return rc; + } + +#ifndef CONFIG_PM_DEVICE_RUNTIME + /* If PM_DEVICE_RUNTIME, we're immediately going to use the device */ + qspi_device_uninit(dev); +#endif break; default: - rc = -ENOTSUP; + return -ENOTSUP; } - qspi_clock_div_restore(); - qspi_unlock(dev); - - return rc; + return 0; } #endif /* CONFIG_PM_DEVICE */ void z_impl_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable) { struct qspi_nor_data *dev_data = dev->data; + int rc; if (dev_data->xip_enabled == enable) { return; } - qspi_acquire(dev); + rc = qspi_device_init(dev); + + if (rc != 0) { + LOG_ERR("NRF QSPI NOR XIP %s failed with %d\n", enable ? "enable" : "disable", rc); + return; + } #if NRF_QSPI_HAS_XIPEN nrf_qspi_xip_set(NRF_QSPI, enable); #endif + qspi_lock(dev); if (enable) { (void)nrfx_qspi_activate(false); } dev_data->xip_enabled = enable; + qspi_unlock(dev); - qspi_release(dev); + qspi_device_uninit(dev); } #ifdef CONFIG_USERSPACE @@ -1380,12 +1502,11 @@ void z_vrfy_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable) #endif /* CONFIG_USERSPACE */ static struct qspi_nor_data qspi_nor_dev_data = { -#if !defined(CONFIG_PM_DEVICE_RUNTIME) && defined(CONFIG_MULTITHREADING) - .count = Z_SEM_INITIALIZER(qspi_nor_dev_data.count, 0, K_SEM_MAX_LIMIT), -#endif #ifdef CONFIG_MULTITHREADING + .trans = Z_SEM_INITIALIZER(qspi_nor_dev_data.trans, 1, 1), .sem = Z_SEM_INITIALIZER(qspi_nor_dev_data.sem, 1, 1), .sync = Z_SEM_INITIALIZER(qspi_nor_dev_data.sync, 0, 1), + .count = Z_SEM_INITIALIZER(qspi_nor_dev_data.count, 0, K_SEM_MAX_LIMIT), #endif /* CONFIG_MULTITHREADING */ }; From dc8d0720226e4acf74f9224d24ab8b05395ad011 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:21 +0100 Subject: [PATCH 1333/2300] Revert "[nrf fromtree] drivers: nrf_qspi_nor: Clean up handling of return values" This reverts commit 39e6897979daa7eeab2e977ce03712a06c72a1b3. Signed-off-by: Robert Lubos --- drivers/flash/nrf_qspi_nor.c | 248 +++++++++++++++++------------------ 1 file changed, 123 insertions(+), 125 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index ca4673e8aa2..467d0643d48 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -371,7 +371,7 @@ static int qspi_device_init(const struct device *dev) return pm_device_runtime_get(dev); #else nrfx_err_t res; - int rc = 0; + int ret = 0; qspi_lock(dev); @@ -389,13 +389,13 @@ static int qspi_device_init(const struct device *dev) res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); - rc = qspi_get_zephyr_ret_code(res); - qspi_initialized = (rc == 0); + ret = qspi_get_zephyr_ret_code(res); + qspi_initialized = (ret == 0); } qspi_unlock(dev); - return rc; + return ret; #endif } @@ -408,10 +408,10 @@ static void qspi_device_uninit(const struct device *dev) } #ifdef CONFIG_PM_DEVICE_RUNTIME - int rc = pm_device_runtime_put(dev); + int ret = pm_device_runtime_put(dev); - if (rc < 0) { - LOG_ERR("Failed to schedule device sleep: %d", rc); + if (ret < 0) { + LOG_ERR("Failed to schedule device sleep: %d", ret); } #else bool last = true; @@ -526,27 +526,27 @@ static int qspi_rdsr(const struct device *dev, uint8_t sr_num) .op_code = opcode, .rx_buf = &sr_buf, }; - int rc = qspi_send_cmd(dev, &cmd, false); + int ret = qspi_send_cmd(dev, &cmd, false); - return (rc < 0) ? rc : sr; + return (ret < 0) ? ret : sr; } /* Wait until RDSR confirms write is not in progress. */ static int qspi_wait_while_writing(const struct device *dev) { - int rc; + int ret; do { - rc = qspi_rdsr(dev, 1); - } while ((rc >= 0) - && ((rc & SPI_NOR_WIP_BIT) != 0U)); + ret = qspi_rdsr(dev, 1); + } while ((ret >= 0) + && ((ret & SPI_NOR_WIP_BIT) != 0U)); - return (rc < 0) ? rc : 0; + return (ret < 0) ? ret : 0; } static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) { - int rc = 0; + int ret = 0; uint8_t opcode = SPI_NOR_CMD_WRSR; uint8_t length = 1; uint8_t sr_array[2] = {0}; @@ -559,12 +559,12 @@ static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) sr_array[0] = sr_val; #if SR1_WRITE_CLEARS_SR2 /* Writing sr1 clears sr2. need to read/modify/write both. */ - rc = qspi_rdsr(dev, 2); - if (rc < 0) { - LOG_ERR("RDSR for WRSR failed: %d", rc); - return rc; + ret = qspi_rdsr(dev, 2); + if (ret < 0) { + LOG_ERR("RDSR for WRSR failed: %d", ret); + return ret; } - sr_array[1] = rc; + sr_array[1] = ret; length = 2; #endif } else { /* sr_num == 2 */ @@ -574,12 +574,12 @@ static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) * Uses standard WRSR opcode */ sr_array[1] = sr_val; - rc = qspi_rdsr(dev, 1); - if (rc < 0) { - LOG_ERR("RDSR for WRSR failed: %d", rc); - return rc; + ret = qspi_rdsr(dev, 1); + if (ret < 0) { + LOG_ERR("RDSR for WRSR failed: %d", ret); + return ret; } - sr_array[0] = rc; + sr_array[0] = ret; length = 2; #elif IS_EQUAL(INST_0_QER, JESD216_DW15_QER_VAL_S2B1v6) /* Writing sr2 uses a dedicated WRSR2 command */ @@ -600,17 +600,17 @@ static int qspi_wrsr(const struct device *dev, uint8_t sr_val, uint8_t sr_num) .tx_buf = &sr_buf, }; - rc = qspi_send_cmd(dev, &cmd, true); + ret = qspi_send_cmd(dev, &cmd, true); /* Writing SR can take some time, and further * commands sent while it's happening can be * corrupted. Wait. */ - if (rc == 0) { - rc = qspi_wait_while_writing(dev); + if (ret == 0) { + ret = qspi_wait_while_writing(dev); } - return rc; + return ret; } #endif /* !IS_EQUAL(INST_0_QER, JESD216_DW15_QER_VAL_NONE) */ @@ -627,16 +627,16 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) return -EINVAL; } + int rv = 0; const struct qspi_nor_config *params = dev->config; - int rc, rc2; - rc = qspi_device_init(dev); - if (rc != 0) { + rv = qspi_device_init(dev); + if (rv != 0) { goto out; } qspi_trans_lock(dev); - rc = qspi_nor_write_protection_set(dev, false); - if (rc != 0) { + rv = qspi_nor_write_protection_set(dev, false); + if (rv != 0) { goto out_trans_unlock; } qspi_lock(dev); @@ -670,16 +670,16 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) size -= adj; } else { LOG_ERR("erase error at 0x%lx size %zu", (long)addr, size); - rc = qspi_get_zephyr_ret_code(res); + rv = qspi_get_zephyr_ret_code(res); break; } } qspi_unlock(dev); - rc2 = qspi_nor_write_protection_set(dev, true); + int rv2 = qspi_nor_write_protection_set(dev, true); - if (!rc) { - rc = rc2; + if (!rv) { + rv = rv2; } out_trans_unlock: @@ -687,7 +687,7 @@ static int qspi_erase(const struct device *dev, uint32_t addr, uint32_t size) out: qspi_device_uninit(dev); - return rc; + return rv; } /* Configures QSPI memory for the transfer */ @@ -695,8 +695,6 @@ static int qspi_nrfx_configure(const struct device *dev) { struct qspi_nor_data *dev_data = dev->data; const struct qspi_nor_config *dev_config = dev->config; - nrfx_err_t res; - int rc; #if defined(CONFIG_SOC_SERIES_NRF53X) /* When the QSPI peripheral is activated, during the nrfx_qspi driver @@ -707,16 +705,18 @@ static int qspi_nrfx_configure(const struct device *dev) nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); #endif - res = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); + nrfx_err_t res = nrfx_qspi_init(&dev_config->nrfx_cfg, + qspi_handler, + dev_data); #if defined(CONFIG_SOC_SERIES_NRF53X) /* Restore the default /4 divider after the QSPI initialization. */ nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); #endif - rc = qspi_get_zephyr_ret_code(res); - if (rc < 0) { - return rc; + int ret = qspi_get_zephyr_ret_code(res); + if (ret < 0) { + return ret; } #if DT_INST_NODE_HAS_PROP(0, rx_delay) @@ -736,9 +736,9 @@ static int qspi_nrfx_configure(const struct device *dev) * bootloader) might have set DPD mode before reboot. As a result, * attempt to exit DPD mode regardless of whether CONFIG_PM_DEVICE is set. */ - rc = exit_dpd(dev); - if (rc < 0) { - return rc; + ret = exit_dpd(dev); + if (ret < 0) { + return ret; } /* Set QE to match transfer mode. If not using quad @@ -769,28 +769,28 @@ static int qspi_nrfx_configure(const struct device *dev) return -EINVAL; #endif - rc = qspi_rdsr(dev, sr_num); - if (rc < 0) { - LOG_ERR("RDSR failed: %d", rc); - return rc; + ret = qspi_rdsr(dev, sr_num); + if (ret < 0) { + LOG_ERR("RDSR failed: %d", ret); + return ret; } - uint8_t sr = (uint8_t)rc; + uint8_t sr = (uint8_t)ret; bool qe_state = ((sr & qe_mask) != 0U); LOG_DBG("RDSR %02x QE %d need %d: %s", sr, qe_state, qe_value, (qe_state != qe_value) ? "updating" : "no-change"); - rc = 0; + ret = 0; if (qe_state != qe_value) { sr ^= qe_mask; - rc = qspi_wrsr(dev, sr, sr_num); + ret = qspi_wrsr(dev, sr, sr_num); } - if (rc < 0) { + if (ret < 0) { LOG_ERR("QE %s failed: %d", qe_value ? "set" : "clear", - rc); - return rc; + ret); + return ret; } #endif @@ -802,16 +802,16 @@ static int qspi_nrfx_configure(const struct device *dev) /* Call will send write enable before instruction if that * requirement is encoded in INST_0_4BA. */ - rc = qspi_send_cmd(dev, &cmd, (INST_0_4BA & 0x02)); + ret = qspi_send_cmd(dev, &cmd, (INST_0_4BA & 0x02)); - if (rc < 0) { - LOG_ERR("E4BA cmd issue failed: %d.", rc); + if (ret < 0) { + LOG_ERR("E4BA cmd issue failed: %d.", ret); } else { LOG_DBG("E4BA cmd issued."); } } - return rc; + return ret; } static int qspi_read_jedec_id(const struct device *dev, @@ -826,14 +826,14 @@ static int qspi_read_jedec_id(const struct device *dev, .rx_buf = &rx_buf, }; - int rc = qspi_device_init(dev); + int ret = qspi_device_init(dev); - if (rc == 0) { - rc = qspi_send_cmd(dev, &cmd, false); + if (ret == 0) { + ret = qspi_send_cmd(dev, &cmd, false); } qspi_device_uninit(dev); - return rc; + return ret; } #if defined(CONFIG_FLASH_JESD216_API) @@ -856,13 +856,13 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, .io3_level = true, }; - int rc = qspi_device_init(dev); + int ret = qspi_device_init(dev); nrfx_err_t res = NRFX_SUCCESS; - if (rc != 0) { - LOG_DBG("qspi_device_init: %d", rc); + if (ret != 0) { + LOG_DBG("qspi_device_init: %d", ret); qspi_device_uninit(dev); - return rc; + return ret; } qspi_lock(dev); @@ -901,9 +901,9 @@ static int qspi_sfdp_read(const struct device *dev, off_t offset, static inline int qspi_nor_read_id(const struct device *dev) { uint8_t id[SPI_NOR_MAX_ID_LEN]; - int rc = qspi_read_jedec_id(dev, id); + int ret = qspi_read_jedec_id(dev, id); - if (rc != 0) { + if (ret != 0) { return -EIO; } @@ -1109,7 +1109,6 @@ static int qspi_nor_write(const struct device *dev, off_t addr, } const struct qspi_nor_config *params = dev->config; - int rc, rc2; /* affected region should be within device */ if (addr < 0 || @@ -1120,18 +1119,18 @@ static int qspi_nor_write(const struct device *dev, off_t addr, return -EINVAL; } + nrfx_err_t res = NRFX_SUCCESS; + + int rc = qspi_device_init(dev); - rc = qspi_device_init(dev); if (rc != 0) { goto out; } qspi_trans_lock(dev); - rc = qspi_nor_write_protection_set(dev, false); + res = qspi_nor_write_protection_set(dev, false); qspi_lock(dev); - if (rc == 0) { - nrfx_err_t res; - + if (!res) { if (size < 4U) { res = write_sub_word(dev, addr, src, size); } else if (!nrfx_is_in_ram(src) || @@ -1141,18 +1140,17 @@ static int qspi_nor_write(const struct device *dev, off_t addr, res = nrfx_qspi_write(src, size, addr); qspi_wait_for_completion(dev, res); } - - rc = qspi_get_zephyr_ret_code(res); } qspi_unlock(dev); - rc2 = qspi_nor_write_protection_set(dev, true); + int res2 = qspi_nor_write_protection_set(dev, true); qspi_trans_unlock(dev); - if (rc == 0) { - rc = rc2; + if (!res) { + res = res2; } + rc = qspi_get_zephyr_ret_code(res); out: qspi_device_uninit(dev); return rc; @@ -1171,24 +1169,24 @@ static int qspi_nor_erase(const struct device *dev, off_t addr, size_t size) return -EINVAL; } - int rc = qspi_erase(dev, addr, size); + int ret = qspi_erase(dev, addr, size); - return rc; + return ret; } static int qspi_nor_write_protection_set(const struct device *dev, bool write_protect) { - int rc = 0; + int ret = 0; struct qspi_cmd cmd = { .op_code = ((write_protect) ? SPI_NOR_CMD_WRDI : SPI_NOR_CMD_WREN), }; if (qspi_send_cmd(dev, &cmd, false) != 0) { - rc = -EIO; + ret = -EIO; } - return rc; + return ret; } /** @@ -1200,16 +1198,16 @@ static int qspi_nor_write_protection_set(const struct device *dev, */ static int qspi_nor_configure(const struct device *dev) { - int rc = qspi_nrfx_configure(dev); + int ret = qspi_nrfx_configure(dev); - if (rc != 0) { - return rc; + if (ret != 0) { + return ret; } #ifdef CONFIG_PM_DEVICE_RUNTIME - rc = pm_device_runtime_enable(dev); - if (rc < 0) { - LOG_ERR("Failed to enable runtime power management: %d", rc); + ret = pm_device_runtime_enable(dev); + if (ret < 0) { + LOG_ERR("Failed to enable runtime power management: %d", ret); } else { LOG_DBG("Runtime power management enabled"); } @@ -1233,12 +1231,12 @@ static int qspi_nor_configure(const struct device *dev) */ static int qspi_nor_init(const struct device *dev) { - const struct qspi_nor_config *dev_config = dev->config; int rc; + const struct qspi_nor_config *dev_config = dev->config; + int ret = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); - rc = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); - if (rc < 0) { - return rc; + if (ret < 0) { + return ret; } IRQ_CONNECT(DT_IRQN(QSPI_NODE), DT_IRQ(QSPI_NODE, priority), @@ -1319,11 +1317,11 @@ static int enter_dpd(const struct device *const dev) .op_code = SPI_NOR_CMD_DPD, }; uint32_t t_enter_dpd = DT_INST_PROP_OR(0, t_enter_dpd, 0); - int rc; + int ret; - rc = qspi_send_cmd(dev, &cmd, false); - if (rc < 0) { - return rc; + ret = qspi_send_cmd(dev, &cmd, false); + if (ret < 0) { + return ret; } if (t_enter_dpd) { @@ -1388,8 +1386,8 @@ static int qspi_nor_pm_action(const struct device *dev, { struct qspi_nor_data *dev_data = dev->data; const struct qspi_nor_config *dev_config = dev->config; - int rc; - nrfx_err_t res; + int ret; + nrfx_err_t err; if (pm_device_is_busy(dev)) { return -EBUSY; @@ -1399,9 +1397,9 @@ static int qspi_nor_pm_action(const struct device *dev, case PM_DEVICE_ACTION_SUSPEND: #ifndef CONFIG_PM_DEVICE_RUNTIME /* If PM_DEVICE_RUNTIME, we don't uninit after RESUME */ - rc = qspi_device_init(dev); - if (rc < 0) { - return rc; + ret = qspi_device_init(dev); + if (ret < 0) { + return ret; } #endif @@ -1413,35 +1411,35 @@ static int qspi_nor_pm_action(const struct device *dev, return -EBUSY; } - rc = enter_dpd(dev); - if (rc < 0) { - return rc; + ret = enter_dpd(dev); + if (ret < 0) { + return ret; } nrfx_qspi_uninit(); - rc = pinctrl_apply_state(dev_config->pcfg, + ret = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); - if (rc < 0) { - return rc; + if (ret < 0) { + return ret; } break; case PM_DEVICE_ACTION_RESUME: - rc = pinctrl_apply_state(dev_config->pcfg, + ret = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); - if (rc < 0) { - return rc; + if (ret < 0) { + return ret; } - res = nrfx_qspi_init(&dev_config->nrfx_cfg, + err = nrfx_qspi_init(&dev_config->nrfx_cfg, qspi_handler, dev_data); - if (res != NRFX_SUCCESS) { + if (err != NRFX_SUCCESS) { return -EIO; } - rc = exit_dpd(dev); - if (rc < 0) { - return rc; + ret = exit_dpd(dev); + if (ret < 0) { + return ret; } #ifndef CONFIG_PM_DEVICE_RUNTIME @@ -1461,16 +1459,16 @@ static int qspi_nor_pm_action(const struct device *dev, void z_impl_nrf_qspi_nor_xip_enable(const struct device *dev, bool enable) { struct qspi_nor_data *dev_data = dev->data; - int rc; + int ret; if (dev_data->xip_enabled == enable) { return; } - rc = qspi_device_init(dev); + ret = qspi_device_init(dev); - if (rc != 0) { - LOG_ERR("NRF QSPI NOR XIP %s failed with %d\n", enable ? "enable" : "disable", rc); + if (ret != 0) { + LOG_ERR("NRF QSPI NOR XIP %s failed with %d\n", enable ? "enable" : "disable", ret); return; } From da59d7e384daf103d34f3af0f266c243a57eca10 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:21 +0100 Subject: [PATCH 1334/2300] Revert "[nrf fromtree] drivers: nrf_qspi_nor: Prevent reading status before sending RDPD" This reverts commit b0c15fbb61e4b5e6a1ef5eecde0bdf3a90827159. Signed-off-by: Robert Lubos --- drivers/flash/nrf_qspi_nor.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 467d0643d48..28c705f6707 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -1339,34 +1339,15 @@ static int enter_dpd(const struct device *const dev) static int exit_dpd(const struct device *const dev) { if (IS_ENABLED(DT_INST_PROP(0, has_dpd))) { - nrf_qspi_pins_t pins; - nrf_qspi_pins_t disconnected_pins = { - .sck_pin = NRF_QSPI_PIN_NOT_CONNECTED, - .csn_pin = NRF_QSPI_PIN_NOT_CONNECTED, - .io0_pin = NRF_QSPI_PIN_NOT_CONNECTED, - .io1_pin = NRF_QSPI_PIN_NOT_CONNECTED, - .io2_pin = NRF_QSPI_PIN_NOT_CONNECTED, - .io3_pin = NRF_QSPI_PIN_NOT_CONNECTED, - }; struct qspi_cmd cmd = { .op_code = SPI_NOR_CMD_RDPD, }; uint32_t t_exit_dpd = DT_INST_PROP_OR(0, t_exit_dpd, 0); - nrfx_err_t res; - int rc; - - nrf_qspi_pins_get(NRF_QSPI, &pins); - nrf_qspi_pins_set(NRF_QSPI, &disconnected_pins); - res = nrfx_qspi_activate(true); - nrf_qspi_pins_set(NRF_QSPI, &pins); - - if (res != NRFX_SUCCESS) { - return -EIO; - } + int ret; - rc = qspi_send_cmd(dev, &cmd, false); - if (rc < 0) { - return rc; + ret = qspi_send_cmd(dev, &cmd, false); + if (ret < 0) { + return ret; } if (t_exit_dpd) { From 5462453e260f1ad1e6077b94c02253ba125b514c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:21 +0100 Subject: [PATCH 1335/2300] Revert "[nrf fromtree] tfm: Enforce initial attestation with required key provisioned" This reverts commit 085d33a7ec044a50afe7da4b1524c0fadb905ae4. Signed-off-by: Robert Lubos --- boards/arm/b_u585i_iot02a/Kconfig.defconfig | 4 ---- modules/trusted-firmware-m/Kconfig.tfm | 8 -------- modules/trusted-firmware-m/Kconfig.tfm.partitions | 1 - 3 files changed, 13 deletions(-) diff --git a/boards/arm/b_u585i_iot02a/Kconfig.defconfig b/boards/arm/b_u585i_iot02a/Kconfig.defconfig index 6b3b72554ff..e8224106dae 100644 --- a/boards/arm/b_u585i_iot02a/Kconfig.defconfig +++ b/boards/arm/b_u585i_iot02a/Kconfig.defconfig @@ -18,10 +18,6 @@ config USE_DT_CODE_PARTITION if BUILD_WITH_TFM -# Initial Attestation key provisioned by the BL1 bootloader -config TFM_INITIAL_ATTESTATION_KEY - default y - config TFM_DUMMY_PROVISIONING default n diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index a0d71328540..fed6ae4f485 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -179,7 +179,6 @@ config TFM_PARTITION_PLATFORM_CUSTOM_REBOOT config TFM_DUMMY_PROVISIONING bool "Provision with dummy values. NOT to be used in production" - select TFM_INITIAL_ATTESTATION_KEY default y help If this option is enabled (as it is by default), a set of dummy @@ -189,13 +188,6 @@ config TFM_DUMMY_PROVISIONING This option MUST not be used in production hardware, as the keys are insecure. -config TFM_INITIAL_ATTESTATION_KEY - bool - help - Hidden option to mark that the TF-M platform has an initial - attestation key, which is a requirement for the Initial Attestation - partition. - config TFM_BL2_NOT_SUPPORTED bool help diff --git a/modules/trusted-firmware-m/Kconfig.tfm.partitions b/modules/trusted-firmware-m/Kconfig.tfm.partitions index 67b46f5328b..cd9aaadb1ec 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm.partitions +++ b/modules/trusted-firmware-m/Kconfig.tfm.partitions @@ -44,7 +44,6 @@ config TFM_PARTITION_CRYPTO config TFM_PARTITION_INITIAL_ATTESTATION bool "Secure partition 'Initial Attestation'" depends on TFM_PARTITION_CRYPTO - depends on TFM_INITIAL_ATTESTATION_KEY default n help Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION' From c2e9652bc0063d303e97eaf9263878bc946c5002 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:21 +0100 Subject: [PATCH 1336/2300] Revert "[nrf fromtree] tfm: Harded build against TF-M built with unsecure keys" This reverts commit bac40f69443a66e29d33239a85491ee637460850. Signed-off-by: Robert Lubos --- boards/arm/b_u585i_iot02a/Kconfig.defconfig | 7 ------- modules/trusted-firmware-m/CMakeLists.txt | 17 +---------------- modules/trusted-firmware-m/Kconfig.tfm | 11 ----------- scripts/kconfig/hardened.csv | 1 - 4 files changed, 1 insertion(+), 35 deletions(-) diff --git a/boards/arm/b_u585i_iot02a/Kconfig.defconfig b/boards/arm/b_u585i_iot02a/Kconfig.defconfig index e8224106dae..ae1e57aba8e 100644 --- a/boards/arm/b_u585i_iot02a/Kconfig.defconfig +++ b/boards/arm/b_u585i_iot02a/Kconfig.defconfig @@ -16,11 +16,4 @@ config SPI_STM32_INTERRUPT config USE_DT_CODE_PARTITION default y if TRUSTED_EXECUTION_NONSECURE -if BUILD_WITH_TFM - -config TFM_DUMMY_PROVISIONING - default n - -endif # BUILD_WITH_TFM - endif # BOARD_B_U585I_IOT02A diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index ad1109d849b..177a47e28d6 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -95,12 +95,6 @@ if (CONFIG_BUILD_WITH_TFM) list(APPEND TFM_CMAKE_ARGS -DMCUBOOT_IMAGE_NUMBER=${CONFIG_TFM_MCUBOOT_IMAGE_NUMBER}) endif() - if (CONFIG_TFM_DUMMY_PROVISIONING) - list(APPEND TFM_CMAKE_ARGS -DTFM_DUMMY_PROVISIONING=ON) - else() - list(APPEND TFM_CMAKE_ARGS -DTFM_DUMMY_PROVISIONING=OFF) - endif() - if (CONFIG_TFM_EXCEPTION_INFO_DUMP) list(APPEND TFM_CMAKE_ARGS -DTFM_EXCEPTION_INFO_DUMP=ON) else() @@ -585,13 +579,4 @@ if (CONFIG_BUILD_WITH_TFM) ${MERGED_FILE} ) endif() - - if(CONFIG_TFM_DUMMY_PROVISIONING) - message(WARNING - "TFM_DUMMY_PROVISIONING is enabled: - The device will be provisioned using dummy keys and is NOT secure! - This is not suitable for production" - ) - endif() - -endif() # CONFIG_BUILD_WITH_TFM +endif() diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index fed6ae4f485..b635347b6e1 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -177,17 +177,6 @@ config TFM_PARTITION_PLATFORM_CUSTOM_REBOOT Instead the application will have to override the weak ARM implementation of sys_arch_reset(). -config TFM_DUMMY_PROVISIONING - bool "Provision with dummy values. NOT to be used in production" - default y - help - If this option is enabled (as it is by default), a set of dummy - keys / data will be provisioned. The dummy IAK matches the IAK tested - by the TF-M tests, and the dummy bl2 ROTPKs match the dummy bl2 keys - used by default. - This option MUST not be used in production hardware, as the keys are - insecure. - config TFM_BL2_NOT_SUPPORTED bool help diff --git a/scripts/kconfig/hardened.csv b/scripts/kconfig/hardened.csv index 6cc978f7e56..ee95b54b3a7 100644 --- a/scripts/kconfig/hardened.csv +++ b/scripts/kconfig/hardened.csv @@ -39,7 +39,6 @@ TEST_RANDOM_GENERATOR,n TEST_SHELL,n TEST_USERSPACE,n TFM_CMAKE_BUILD_TYPE_DEBUG,n -TFM_DUMMY_PROVISIONING,n THREAD_MONITOR,n THREAD_NAME,n TIMER_RANDOM_GENERATOR,n From 56023766bb7d9146b66591bece3a74adf818ed44 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:21 +0100 Subject: [PATCH 1337/2300] Revert "[nrf fromlist] soc: nordic_nrf: Enable the TF-M NS storage partition for nordic boards" This reverts commit 9e4151fc21c0d9a64934b1b2aef84d4094cb9109. Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/CMakeLists.txt | 4 ---- soc/arm/nordic_nrf/Kconfig | 4 ---- 2 files changed, 8 deletions(-) diff --git a/soc/arm/nordic_nrf/CMakeLists.txt b/soc/arm/nordic_nrf/CMakeLists.txt index 3b097d73569..47364b35ffb 100644 --- a/soc/arm/nordic_nrf/CMakeLists.txt +++ b/soc/arm/nordic_nrf/CMakeLists.txt @@ -25,8 +25,4 @@ if(CONFIG_BUILD_WITH_TFM) set_property(TARGET zephyr_property_target APPEND PROPERTY TFM_CMAKE_OPTIONS -DZEPHYR_BASE=${ZEPHYR_BASE} ) - - set_property(TARGET zephyr_property_target - APPEND PROPERTY TFM_CMAKE_OPTIONS -DNRF_NS_STORAGE=${CONFIG_TFM_NRF_NS_STORAGE} - ) endif() diff --git a/soc/arm/nordic_nrf/Kconfig b/soc/arm/nordic_nrf/Kconfig index 0372492cd7d..19e49c05454 100644 --- a/soc/arm/nordic_nrf/Kconfig +++ b/soc/arm/nordic_nrf/Kconfig @@ -45,10 +45,6 @@ config TFM_LOG_LEVEL_SILENCE Disable TF-M secure output if the uart1 node has not assigned GPIO pins using pinctrl. -config TFM_NRF_NS_STORAGE - bool "TF-M non-secure storage partition" - default y - endif # BUILD_WITH_TFM From a18e692b8ccce72669cdcd032c5effd88c149b33 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:22 +0100 Subject: [PATCH 1338/2300] Revert "[nrf fromtree] net: openthread: Openthread upmerge to `4ed44bc`" This reverts commit 8a275bc4f1f4375136f0821ae32fdcd027298d5c. Signed-off-by: Robert Lubos --- modules/openthread/CMakeLists.txt | 6 ------ modules/openthread/Kconfig.features | 3 --- west.yml | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 646b086ef1e..8afa1aec440 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -340,12 +340,6 @@ else() set(OT_MLR OFF CACHE BOOL "Enable Multicast Listener Registration feature for Thread 1.2" FORCE) endif() -if(CONFIG_OPENTHREAD_MULTIPAN_RCP) - set(OT_MULTIPAN_RCP ON CACHE BOOL "Enable Multi-PAN RCP" FORCE) -else() - set(OT_MULTIPAN_RCP OFF CACHE BOOL "Enable Multi-PAN RCP" FORCE) -endif() - if(CONFIG_OPENTHREAD_MULTIPLE_INSTANCE) set(OT_MULTIPLE_INSTANCE ON CACHE BOOL "Enable multiple instances" FORCE) else() diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index 2be5332cde3..bd8a05ed9b9 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -218,9 +218,6 @@ config OPENTHREAD_MLR help Enable Multicast Listener Registration support for Thread 1.2 -config OPENTHREAD_MULTIPAN_RCP - bool "OpenThread multipan rcp" - config OPENTHREAD_MULTIPLE_INSTANCE bool "OpenThread multiple instances" diff --git a/west.yml b/west.yml index e49d66c39e4..6d94c985b93 100644 --- a/west.yml +++ b/west.yml @@ -301,7 +301,7 @@ manifest: revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 path: modules/lib/open-amp - name: openthread - revision: 4ed44bc7d58d9a98c6cca13a50d38129045ab3df + revision: 193e77e40ec2387d458eaebd1e03902d86f484a5 path: modules/lib/openthread - name: percepio path: modules/debug/percepio From 5a431711d4b7d895db67e080cf9ad4c0afa036d4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:22 +0100 Subject: [PATCH 1339/2300] Revert "[nrf fromlist] manifest: hal_nordic: Update revision with fixed workaround in nrfx_qspi" This reverts commit a8a54e5a7efd4b426fb199112a6447cc00bb4319. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 6d94c985b93..78681374e73 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: b9633ecea67bf52925d4c61455046223b46402b1 + revision: 56e0b052dff311c2f8eb08c6804e60fc79feb56f path: modules/hal/nordic groups: - hal From 0da9f874382a7aa4c016f2d3f582a2c830383138 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:22 +0100 Subject: [PATCH 1340/2300] Revert "[nrf fromtree] scripts/pylib/twister/twisterlib: Support multiple `--pytest-args`" This reverts commit d5e85fecd38817d7cd0bf5cee1bcad58277b4e8a. Signed-off-by: Robert Lubos --- doc/develop/test/pytest.rst | 2 -- .../pylib/twister/twisterlib/environment.py | 3 +-- scripts/pylib/twister/twisterlib/harness.py | 19 +++++++++---------- .../pytest_integration/test_harness_pytest.py | 5 ++--- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/doc/develop/test/pytest.rst b/doc/develop/test/pytest.rst index f6ba54fa52e..f3db6fcee89 100644 --- a/doc/develop/test/pytest.rst +++ b/doc/develop/test/pytest.rst @@ -67,8 +67,6 @@ For instance, one can use a command: --pytest-args='-k test_shell_print_version' -Note that ``--pytest-args`` can be passed multiple times to pass several arguments to the pytest. - Helpers & fixtures ================== diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index 16e19c85fec..b7e11406cd4 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -216,8 +216,7 @@ def add_parse_arguments(parser = None): and 'fifo_loop' is a name of a function found in main.c without test prefix. """) - parser.add_argument( - "--pytest-args", action="append", + parser.add_argument("--pytest-args", help="""Pass additional arguments to the pytest subprocess. This parameter will override the pytest_args from the harness_config in YAML file. """) diff --git a/scripts/pylib/twister/twisterlib/harness.py b/scripts/pylib/twister/twisterlib/harness.py index 8b8ad92fc51..dece1673c7a 100644 --- a/scripts/pylib/twister/twisterlib/harness.py +++ b/scripts/pylib/twister/twisterlib/harness.py @@ -326,6 +326,15 @@ def generate_command(self): command.extend([os.path.normpath(os.path.join( self.source_dir, os.path.expanduser(os.path.expandvars(src)))) for src in pytest_root]) + if handler.options.pytest_args: + command.append(handler.options.pytest_args) + if pytest_args_yaml: + logger.warning(f'The pytest_args ({handler.options.pytest_args}) specified ' + 'in the command line will override the pytest_args defined ' + f'in the YAML file {pytest_args_yaml}') + else: + command.extend(pytest_args_yaml) + if pytest_dut_scope: command.append(f'--dut-scope={pytest_dut_scope}') @@ -345,16 +354,6 @@ def generate_command(self): command.append('--device-type=custom') else: raise PytestHarnessException(f'Handling of handler {handler.type_str} not implemented yet') - - if handler.options.pytest_args: - command.extend(handler.options.pytest_args) - if pytest_args_yaml: - logger.warning(f'The pytest_args ({handler.options.pytest_args}) specified ' - 'in the command line will override the pytest_args defined ' - f'in the YAML file {pytest_args_yaml}') - else: - command.extend(pytest_args_yaml) - return command def _generate_parameters_for_hardware(self, handler: Handler): diff --git a/scripts/tests/twister/pytest_integration/test_harness_pytest.py b/scripts/tests/twister/pytest_integration/test_harness_pytest.py index befd384be37..fc60b99e0d1 100644 --- a/scripts/tests/twister/pytest_integration/test_harness_pytest.py +++ b/scripts/tests/twister/pytest_integration/test_harness_pytest.py @@ -71,13 +71,12 @@ def test_pytest_command_extra_args(testinstance: TestInstance): def test_pytest_command_extra_args_in_options(testinstance: TestInstance): pytest_harness = Pytest() pytest_args_from_yaml = '-k test_from_yaml' - pytest_args_from_cmd = ['-k', 'test_from_cmd'] + pytest_args_from_cmd = '-k test_from_cmd' testinstance.testsuite.harness_config['pytest_args'] = [pytest_args_from_yaml] testinstance.handler.options.pytest_args = pytest_args_from_cmd pytest_harness.configure(testinstance) command = pytest_harness.generate_command() - assert pytest_args_from_cmd[0] in command - assert pytest_args_from_cmd[1] in command + assert pytest_args_from_cmd in command assert pytest_args_from_yaml not in command From b5f7447280ece4d9017640192c1ad0426bdfa850 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:22 +0100 Subject: [PATCH 1341/2300] Revert "[nrf fromtree] twister: pytest: Add --pytest-args to Twister command line" This reverts commit 5d089633e9eddeb6cf49b9b497f18e7c0480320b. Signed-off-by: Robert Lubos --- doc/develop/test/pytest.rst | 10 --- .../pylib/twister/twisterlib/environment.py | 5 -- scripts/pylib/twister/twisterlib/harness.py | 19 ++---- .../pytest_integration/test_harness_pytest.py | 66 ------------------- 4 files changed, 4 insertions(+), 96 deletions(-) diff --git a/doc/develop/test/pytest.rst b/doc/develop/test/pytest.rst index f3db6fcee89..e644882191e 100644 --- a/doc/develop/test/pytest.rst +++ b/doc/develop/test/pytest.rst @@ -56,16 +56,6 @@ Pytest scans the given locations looking for tests, following its default `discovery rules `_ One can also pass some extra arguments to the pytest from yaml file using ``pytest_args`` keyword under ``harness_config``, e.g.: ``pytest_args: [‘-k=test_method’, ‘--log-level=DEBUG’]``. -There is also an option to pass ``--pytest-args`` through Twister command line parameters. -This can be particularly useful when one wants to select a specific testcase from a test suite. -For instance, one can use a command: - -.. code-block:: console - - $ ./scripts/twister --platform native_sim -T samples/subsys/testsuite/pytest/shell \ - -s samples/subsys/testsuite/pytest/shell/sample.pytest.shell \ - --pytest-args='-k test_shell_print_version' - Helpers & fixtures ================== diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index b7e11406cd4..86965f1f9cf 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -216,11 +216,6 @@ def add_parse_arguments(parser = None): and 'fifo_loop' is a name of a function found in main.c without test prefix. """) - parser.add_argument("--pytest-args", - help="""Pass additional arguments to the pytest subprocess. This parameter - will override the pytest_args from the harness_config in YAML file. - """) - valgrind_asan_group.add_argument( "--enable-valgrind", action="store_true", help="""Run binary through valgrind and check for several memory access diff --git a/scripts/pylib/twister/twisterlib/harness.py b/scripts/pylib/twister/twisterlib/harness.py index dece1673c7a..052def7162a 100644 --- a/scripts/pylib/twister/twisterlib/harness.py +++ b/scripts/pylib/twister/twisterlib/harness.py @@ -309,9 +309,8 @@ def pytest_run(self, timeout): def generate_command(self): config = self.instance.testsuite.harness_config - handler: Handler = self.instance.handler pytest_root = config.get('pytest_root', ['pytest']) if config else ['pytest'] - pytest_args_yaml = config.get('pytest_args', []) if config else [] + pytest_args = config.get('pytest_args', []) if config else [] pytest_dut_scope = config.get('pytest_dut_scope', None) if config else None command = [ 'pytest', @@ -325,19 +324,12 @@ def generate_command(self): ] command.extend([os.path.normpath(os.path.join( self.source_dir, os.path.expanduser(os.path.expandvars(src)))) for src in pytest_root]) - - if handler.options.pytest_args: - command.append(handler.options.pytest_args) - if pytest_args_yaml: - logger.warning(f'The pytest_args ({handler.options.pytest_args}) specified ' - 'in the command line will override the pytest_args defined ' - f'in the YAML file {pytest_args_yaml}') - else: - command.extend(pytest_args_yaml) - + command.extend(pytest_args) if pytest_dut_scope: command.append(f'--dut-scope={pytest_dut_scope}') + handler: Handler = self.instance.handler + if handler.options.verbose > 1: command.extend([ '--log-cli-level=DEBUG', @@ -497,9 +489,6 @@ def _parse_report_file(self, report): tc.status = 'error' tc.reason = elem.get('message') tc.output = elem.text - else: - self.state = 'skipped' - self.instance.reason = 'No tests collected' class Gtest(Harness): diff --git a/scripts/tests/twister/pytest_integration/test_harness_pytest.py b/scripts/tests/twister/pytest_integration/test_harness_pytest.py index fc60b99e0d1..150980059b3 100644 --- a/scripts/tests/twister/pytest_integration/test_harness_pytest.py +++ b/scripts/tests/twister/pytest_integration/test_harness_pytest.py @@ -25,7 +25,6 @@ def testinstance() -> TestInstance: testinstance.handler = mock.Mock() testinstance.handler.options = mock.Mock() testinstance.handler.options.verbose = 1 - testinstance.handler.options.pytest_args = None testinstance.handler.type_str = 'native' return testinstance @@ -68,18 +67,6 @@ def test_pytest_command_extra_args(testinstance: TestInstance): assert c in command -def test_pytest_command_extra_args_in_options(testinstance: TestInstance): - pytest_harness = Pytest() - pytest_args_from_yaml = '-k test_from_yaml' - pytest_args_from_cmd = '-k test_from_cmd' - testinstance.testsuite.harness_config['pytest_args'] = [pytest_args_from_yaml] - testinstance.handler.options.pytest_args = pytest_args_from_cmd - pytest_harness.configure(testinstance) - command = pytest_harness.generate_command() - assert pytest_args_from_cmd in command - assert pytest_args_from_yaml not in command - - @pytest.mark.parametrize( ('pytest_root', 'expected'), [ @@ -235,56 +222,3 @@ def test_skip_2(): assert len(testinstance.testcases) == 2 for tc in testinstance.testcases: assert tc.status == "skipped" - - -def test_if_report_with_filter(pytester, testinstance: TestInstance): - test_file_content = textwrap.dedent(""" - import pytest - def test_A(): - pass - def test_B(): - pass - """) - test_file = pytester.path / 'test_filter.py' - test_file.write_text(test_file_content) - report_file = pytester.path / 'report.xml' - result = pytester.runpytest( - str(test_file), - '-k', 'test_B', - f'--junit-xml={str(report_file)}' - ) - result.assert_outcomes(passed=1) - assert report_file.is_file() - - pytest_harness = Pytest() - pytest_harness.configure(testinstance) - pytest_harness.report_file = report_file - pytest_harness._update_test_status() - assert pytest_harness.state == "passed" - assert testinstance.status == "passed" - assert len(testinstance.testcases) == 1 - - -def test_if_report_with_no_collected(pytester, testinstance: TestInstance): - test_file_content = textwrap.dedent(""" - import pytest - def test_A(): - pass - """) - test_file = pytester.path / 'test_filter.py' - test_file.write_text(test_file_content) - report_file = pytester.path / 'report.xml' - result = pytester.runpytest( - str(test_file), - '-k', 'test_B', - f'--junit-xml={str(report_file)}' - ) - result.assert_outcomes(passed=0) - assert report_file.is_file() - - pytest_harness = Pytest() - pytest_harness.configure(testinstance) - pytest_harness.report_file = report_file - pytest_harness._update_test_status() - assert pytest_harness.state == "skipped" - assert testinstance.status == "skipped" From b5d0172ec743f3baf5156272182c2b961fa3a4bf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:22 +0100 Subject: [PATCH 1342/2300] Revert "[nrf fromlist] wifi: shell: Add long arguments to help" This reverts commit 5418963fc0a506fa6a5884d46248166bfce07acf. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c5b8f60d933..d0cd0551897 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1275,10 +1275,10 @@ void parse_mode_args_to_params(const struct shell *sh, int argc, int opt; int option_index = 0; - static struct option long_options[] = {{"if-index", optional_argument, 0, 'i'}, + static struct option long_options[] = {{"if_index", optional_argument, 0, 'i'}, {"sta", no_argument, 0, 's'}, {"monitor", no_argument, 0, 'm'}, - {"tx-injection", no_argument, 0, 't'}, + {"TX-injection", no_argument, 0, 't'}, {"promiscuous", no_argument, 0, 'p'}, {"ap", no_argument, 0, 'a'}, {"softap", no_argument, 0, 'k'}, @@ -1385,7 +1385,7 @@ void parse_channel_args_to_params(const struct shell *sh, int argc, int opt; int option_index = 0; - static struct option long_options[] = {{"if-index", optional_argument, 0, 'i'}, + static struct option long_options[] = {{"if_index", optional_argument, 0, 'i'}, {"channel", required_argument, 0, 'c'}, {"get", no_argument, 0, 'g'}, {"help", no_argument, 0, 'h'}, @@ -1491,8 +1491,8 @@ void parse_filter_args_to_params(const struct shell *sh, int argc, int opt; int option_index = 0; - static struct option long_options[] = {{"if-index", optional_argument, 0, 'i'}, - {"capture-len", optional_argument, 0, 'b'}, + static struct option long_options[] = {{"if_index", optional_argument, 0, 'i'}, + {"capture_len", optional_argument, 0, 'b'}, {"all", no_argument, 0, 'a'}, {"mgmt", no_argument, 0, 'm'}, {"ctrl", no_argument, 0, 'c'}, @@ -1683,15 +1683,15 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, 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" "parameters:" - "[-i, --if-index ] : Interface index.\n" - "[-s, --sta] : Station mode.\n" - "[-m, --monitor] : Monitor mode.\n" - "[-p, --promiscuous] : Promiscuous mode.\n" - "[-t, --tx-injection] : TX-Injection 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" + "[-i] : Interface index - optional argument\n" + "[-s] : Station mode.\n" + "[-m] : Monitor mode.\n" + "[-p] : Promiscuous mode.\n" + "[-t] : TX-Injection mode.\n" + "[-a] : AP mode.\n" + "[-k] : Softap mode.\n" + "[-h] : Help.\n" + "[-g] : 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" @@ -1703,14 +1703,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "monitor, TX-Injection and promiscuous mode is enabled.\n" "The different packet filter modes are control, management, data and enable all filters\n" "parameters:" - "[-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" + "[-i] : Interface index - optional argument.\n" + "[-a] : Enable all packet filter modes\n" + "[-m] : Enable management packets to allowed up the stack.\n" + "[-c] : Enable control packets to be allowed up the stack.\n" + "[-d] : Enable Data packets to be allowed up the stack.\n" + "[-g] : Get current filter settings for a specific interface index.\n" + "<-b> : Capture length buffer size for each packet to be captured - optional argument.\n" + "<-h> : 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" @@ -1722,10 +1722,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "monitor or TX-Injection mode is enabled.\n" "Currently 20 MHz is only supported and no BW parameter is provided\n" "parameters:" - "[-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" + "[-i] : Interface index - optional argument.\n" + "[-c] : Set a specific channel number to the lower layer.\n" + "[-g] : Get current set channel number from the lower layer.\n" + "[-h] : 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" From fb614ab21e437943c0fee7a1c82fbf88e7711948 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:23 +0100 Subject: [PATCH 1343/2300] Revert "[nrf fromlist] wifi: shell: Enforce argument count checks" This reverts commit 98bee806c321971f10a6487b1e10756616177e96. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 74 +++++++++++++-------------------- 1 file changed, 30 insertions(+), 44 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d0cd0551897..767ac3eaf05 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1598,43 +1598,37 @@ static int cmd_wifi_packet_filter(const struct shell *sh, size_t argc, char *arg } SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, - SHELL_CMD_ARG(disable, NULL, + SHELL_CMD(disable, NULL, "Disable Access Point mode", - cmd_wifi_ap_disable, - 1, 0), - SHELL_CMD_ARG(enable, NULL, " [channel] [PSK]", - cmd_wifi_ap_enable, - 2, 1), + cmd_wifi_ap_disable), + SHELL_CMD(enable, NULL, " [channel] [PSK]", + cmd_wifi_ap_enable), SHELL_SUBCMD_SET_END ); SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, - SHELL_CMD_ARG(quick_setup, NULL, " Start a TWT flow with defaults:\n" + SHELL_CMD(quick_setup, NULL, " Start a TWT flow with defaults:\n" " \n", - cmd_wifi_twt_setup_quick, - 3, 0), - SHELL_CMD_ARG(setup, NULL, " Start a TWT flow:\n" + cmd_wifi_twt_setup_quick), + SHELL_CMD(setup, NULL, " Start a TWT flow:\n" "\n" "\n" " " " \n", - cmd_wifi_twt_setup, - 11, 0), - SHELL_CMD_ARG(teardown, NULL, " Teardown a TWT flow:\n" + cmd_wifi_twt_setup), + SHELL_CMD(teardown, NULL, " Teardown a TWT flow:\n" "\n" "\n" " \n", - cmd_wifi_twt_teardown, - 5, 0), - SHELL_CMD_ARG(teardown_all, NULL, " Teardown all TWT flows\n", - cmd_wifi_twt_teardown_all, - 1, 0), + cmd_wifi_twt_teardown), + SHELL_CMD(teardown_all, NULL, " Teardown all TWT flows\n", + cmd_wifi_twt_teardown_all), SHELL_SUBCMD_SET_END ); SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(ap, &wifi_cmd_ap, "Access Point mode commands", NULL), - SHELL_CMD_ARG(connect, NULL, + SHELL_CMD(connect, NULL, "Connect to a Wi-Fi AP\n" "\"\"\n" "[channel number: 0 means all]\n" @@ -1643,21 +1637,18 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required", - cmd_wifi_connect, - 2, 5), - SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP", - cmd_wifi_disconnect, - 1, 0), - SHELL_CMD_ARG(ps, NULL, "Configure Wi-F PS on/off, no arguments will dump config", - cmd_wifi_ps, - 1, 1), + cmd_wifi_connect), + SHELL_CMD(disconnect, NULL, "Disconnect from the Wi-Fi AP", + cmd_wifi_disconnect), + SHELL_CMD(ps, NULL, "Configure Wi-F PS on/off, no arguments will dump config", + cmd_wifi_ps), SHELL_CMD_ARG(ps_mode, NULL, "\n", cmd_wifi_ps_mode, 2, 0), - SHELL_CMD_ARG(scan, NULL, + SHELL_CMD(scan, NULL, "Scan for Wi-Fi APs\n" "OPTIONAL PARAMETERS:\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" @@ -1668,19 +1659,17 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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-11,14_5:36,149-165,44\n" "[-h, --help] : Print out the help for the scan command.", - cmd_wifi_scan, - 1, 8), - SHELL_CMD_ARG(statistics, NULL, "Wi-Fi interface statistics", cmd_wifi_stats, 1, 0), - SHELL_CMD_ARG(status, NULL, "Status of the Wi-Fi interface", cmd_wifi_status, 1, 0), + cmd_wifi_scan), + SHELL_CMD(statistics, NULL, "Wi-Fi interface statistics", cmd_wifi_stats), + SHELL_CMD(status, NULL, "Status of the Wi-Fi interface", cmd_wifi_status), SHELL_CMD(twt, &wifi_twt_ops, "Manage TWT flows", NULL), - SHELL_CMD_ARG(reg_domain, NULL, + SHELL_CMD(reg_domain, NULL, "Set or Get Wi-Fi regulatory domain\n" "Usage: wifi reg_domain [ISO/IEC 3166-1 alpha2] [-f]\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.", - cmd_wifi_reg_domain, - 2, 1), - SHELL_CMD_ARG(mode, NULL, "mode operational setting\n" + cmd_wifi_reg_domain), + SHELL_CMD(mode, NULL, "mode operational setting\n" "This command may be used to set the Wi-Fi device into a specific mode of operation\n" "parameters:" "[-i] : Interface index - optional argument\n" @@ -1696,9 +1685,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "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" + cmd_wifi_mode), + SHELL_CMD(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" @@ -1715,9 +1703,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "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, - 1, 8), - SHELL_CMD_ARG(channel, NULL, "wifi channel setting\n" + cmd_wifi_packet_filter), + SHELL_CMD(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" @@ -1730,8 +1717,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "wifi channel -g -i1\n" "Set operation example for interface index 1 (setting channel 5)\n" "wifi -i1 -c5\n", - cmd_wifi_channel, - 1, 4), + cmd_wifi_channel), SHELL_CMD_ARG(ps_timeout, NULL, " - PS inactivity timer(in ms)", From 537a7d4c98cc91205eefff1c5bf8032cb343de24 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:23 +0100 Subject: [PATCH 1344/2300] Revert "[nrf fromlist] wifi: shell: Add missing security options" This reverts commit 753d06483941443b43742a331d72aaf12e10aa0e. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 767ac3eaf05..cd3390828d1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1634,7 +1634,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[channel number: 0 means all]\n" "[PSK: valid only for secure SSIDs]\n" "[Security type: valid only for secure SSIDs]\n" - "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" + "0:None, 1:PSK, 2:PSK-256, 3:SAE\n" "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required", cmd_wifi_connect), From 7c45ec4e2ef6f81858abc386049cd5eee8c008e7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:23 +0100 Subject: [PATCH 1345/2300] Revert "[nrf fromlist] wifi: shell: Fix PS mode help" This reverts commit 4679230967e6e7127bf39df984f4dc700acbcd93. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index cd3390828d1..64f125dea01 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1644,7 +1644,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, cmd_wifi_ps), SHELL_CMD_ARG(ps_mode, NULL, - "\n", + "\n" + "", cmd_wifi_ps_mode, 2, 0), @@ -1732,7 +1733,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, 0), SHELL_CMD_ARG(ps_wakeup_mode, NULL, - "\n", + " : Set PS wake up mode to DTIM interval\n" + " : Set PS wake up mode to listen interval", cmd_wifi_ps_wakeup_mode, 2, 0), From 6bce68fc17745cde70ba71f321ef88e658d6a18f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:24 +0100 Subject: [PATCH 1346/2300] Revert "[nrf fromlist] wifi: shell: Fix brackets type for optional params" This reverts commit e46ff46820db4c68624b2ef10d2b4e9e5dd7e4a7. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 64f125dea01..c50175e086f 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1631,11 +1631,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(connect, NULL, "Connect to a Wi-Fi AP\n" "\"\"\n" - "[channel number: 0 means all]\n" - "[PSK: valid only for secure SSIDs]\n" - "[Security type: valid only for secure SSIDs]\n" + "\n" + "\n" + "\n" "0:None, 1:PSK, 2:PSK-256, 3:SAE\n" - "[MFP (optional: needs security type to be specified)]\n" + "\n" ": 0:Disable, 1:Optional, 2:Required", cmd_wifi_connect), SHELL_CMD(disconnect, NULL, "Disconnect from the Wi-Fi AP", @@ -1667,7 +1667,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(reg_domain, NULL, "Set or Get Wi-Fi regulatory domain\n" "Usage: wifi reg_domain [ISO/IEC 3166-1 alpha2] [-f]\n" - "[-f]: Force to use this regulatory hint over any other regulatory hints\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.", cmd_wifi_reg_domain), SHELL_CMD(mode, NULL, "mode operational setting\n" From 922bc0db927f6d1791aa77acf6ae6b120ae1f817 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:24 +0100 Subject: [PATCH 1347/2300] Revert "[nrf fromlist] wifi: shell: Fix unbalanced braces" This reverts commit 8c115b97779f71bf2a583f7383d514b22841316c. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c50175e086f..5f7eb5ba0ee 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1673,15 +1673,15 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(mode, NULL, "mode operational setting\n" "This command may be used to set the Wi-Fi device into a specific mode of operation\n" "parameters:" - "[-i] : Interface index - optional argument\n" - "[-s] : Station mode.\n" - "[-m] : Monitor mode.\n" - "[-p] : Promiscuous mode.\n" - "[-t] : TX-Injection mode.\n" - "[-a] : AP mode.\n" - "[-k] : Softap mode.\n" - "[-h] : Help.\n" - "[-g] : Get current mode for a specific interface index.\n" + "[-i : Interface index - optional argument\n" + "[-s : Station mode.\n" + "[-m : Monitor mode.\n" + "[-p : Promiscuous mode.\n" + "[-t : TX-Injection mode.\n" + "[-a : AP mode.\n" + "[-k : Softap mode.\n" + "[-h : Help.\n" + "[-g : 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" @@ -1692,14 +1692,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "monitor, TX-Injection and promiscuous mode is enabled.\n" "The different packet filter modes are control, management, data and enable all filters\n" "parameters:" - "[-i] : Interface index - optional argument.\n" - "[-a] : Enable all packet filter modes\n" - "[-m] : Enable management packets to allowed up the stack.\n" - "[-c] : Enable control packets to be allowed up the stack.\n" - "[-d] : Enable Data packets to be allowed up the stack.\n" - "[-g] : Get current filter settings for a specific interface index.\n" - "<-b> : Capture length buffer size for each packet to be captured - optional argument.\n" - "<-h> : Help.\n" + "[-i : Interface index - optional argument.\n" + "[-a : Enable all packet filter modes\n" + "[-m : Enable management packets to allowed up the stack.\n" + "[-c : Enable control packets to be allowed up the stack.\n" + "[-d : Enable Data packets to be allowed up the stack.\n" + "[-g : Get current filter settings for a specific interface index.\n" + "<-b : Capture length buffer size for each packet to be captured - optional argument.\n" + "<-h : 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" @@ -1710,10 +1710,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "monitor or TX-Injection mode is enabled.\n" "Currently 20 MHz is only supported and no BW parameter is provided\n" "parameters:" - "[-i] : Interface index - optional argument.\n" - "[-c] : Set a specific channel number to the lower layer.\n" - "[-g] : Get current set channel number from the lower layer.\n" - "[-h] : Help.\n" + "[-i : Interface index - optional argument.\n" + "[-c : Set a specific channel number to the lower layer.\n" + "[-g : Get current set channel number from the lower layer.\n" + "[-h : 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" From 9992104405ebaf441dc0352247ff0bced9b9c746 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:24 +0100 Subject: [PATCH 1348/2300] Revert "[nrf fromlist] tfm: Remove limitation of enabling FP when build TF-M NS application" This reverts commit b3bd06e6cd70623d42ae024e4cad0515a7c59921. Signed-off-by: Robert Lubos --- arch/arm/core/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/core/Kconfig b/arch/arm/core/Kconfig index 4afe6c06ab5..75a64ea90eb 100644 --- a/arch/arm/core/Kconfig +++ b/arch/arm/core/Kconfig @@ -268,6 +268,9 @@ choice config FP_HARDABI bool "Floating point Hard ABI" + # TF-M build system does not build the NS app and libraries correctly with Hard ABI. + # This limitation should be removed in the next TF-M synchronization. + depends on !TFM_BUILD_NS help This option selects the Floating point ABI in which hardware floating point instructions are generated and uses FPU-specific calling From 4d6553a8db277c88ecd663919e0a6bfb2d55d994 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:24 +0100 Subject: [PATCH 1349/2300] Revert "[nrf fromtree] modules: hal_nordic: new nrf_802154 configuration option" This reverts commit fb5c7141c2a960f6d8680bfe93e1f758b94fb4c5. Signed-off-by: Robert Lubos --- modules/hal_nordic/Kconfig | 6 ------ modules/hal_nordic/nrf_802154/CMakeLists.txt | 3 --- 2 files changed, 9 deletions(-) diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index 6f77bbea427..b461c094ef4 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -196,12 +196,6 @@ config NRF_802154_ENCRYPTION bool "nRF 802.15.4 AES-CCM* authentication & encryption" depends on !CRYPTO_NRF_ECB -config NRF_802154_SECURITY_KEY_STORAGE_SIZE - int "nRF 802.15.4 security key storage size" - default 3 - help - Number of encryption keys that the nRF 802.15.4 Radio Driver can store simultaneously. - config NRF_802154_CARRIER_FUNCTIONS bool "nRF 802.15.4 carrier functions" help diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index 763f9625be8..a274a019e25 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -56,9 +56,6 @@ target_compile_definitions(zephyr-802154-interface NRF_802154_CCA_CORR_LIMIT_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_LIMIT} NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_THRESHOLD} NRF_802154_CCA_ED_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD} - - # Key storage size - NRF_802154_SECURITY_KEY_STORAGE_SIZE=${CONFIG_NRF_802154_SECURITY_KEY_STORAGE_SIZE} ) if (CONFIG_NRF_802154_CCA_MODE_ED) From c2af85f7d677afcf1cb669b119284b9b78e9dd29 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:24 +0100 Subject: [PATCH 1350/2300] Revert "[nrf fromtree] modules: hal_nordic: reorganize nrf_802154 Kconfig" This reverts commit 89ee8499c5a9d7c6f0d93b9979604ddeb097bc45. Signed-off-by: Robert Lubos --- modules/hal_nordic/Kconfig | 119 ++++++++++--------- modules/hal_nordic/nrf_802154/CMakeLists.txt | 46 +++---- 2 files changed, 90 insertions(+), 75 deletions(-) diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index b461c094ef4..44c12e88685 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -43,6 +43,30 @@ config NRF_802154_MULTIPROTOCOL_SUPPORT in the driver, this option must be enabled. Otherwise, the driver assumes that access to the radio peripheral is granted indefinitely. +config NRF_802154_ENCRYPTION + bool "nRF 802.15.4 AES-CCM* authentication & encryption" + depends on !CRYPTO_NRF_ECB + +choice NRF_802154_CCA_MODE + prompt "nRF IEEE 802.15.4 CCA mode" + default NRF_802154_CCA_MODE_ED + help + CCA mode + +config NRF_802154_CCA_MODE_ED + bool "Energy Above Threshold" + +config NRF_802154_CCA_MODE_CARRIER + bool "Carrier Seen" + +config NRF_802154_CCA_MODE_CARRIER_AND_ED + bool "Energy Above Threshold AND Carrier Seen" + +config NRF_802154_CCA_MODE_CARRIER_OR_ED + bool "Energy Above Threshold OR Carrier Seen" + +endchoice + choice NRF_802154_SL_TYPE prompt "nRF IEEE 802.15.4 Service Layer Type" @@ -53,6 +77,43 @@ config NRF_802154_SL_OPENSOURCE endchoice +config NRF_802154_CCA_ED_THRESHOLD + int "nRF IEEE 802.15.4 CCA Energy Detection threshold" + default 45 + help + If energy detected in a given channel is above the value then the + channel is deemed busy. The unit is defined as per 802.15.4-2006 spec. + +config NRF_802154_CCA_CORR_THRESHOLD + int "nRF IEEE 802.15.4 CCA Correlator threshold" + default 45 + +config NRF_802154_CCA_CORR_LIMIT + int "nRF IEEE 802.15.4 CCA Correlator limit" + default 2 + help + Limit for occurrences above correlator threshold. When not equal to + zero the correlator based signal detect is enabled. + +config NRF_802154_PENDING_SHORT_ADDRESSES + int "nRF 802.15.4 pending short addresses" + default 16 + help + Number of slots containing short addresses of nodes for which pending data is stored + +config NRF_802154_PENDING_EXTENDED_ADDRESSES + int "nRF 802.15.4 pending extended addresses" + default 16 + help + Number of slots containing extended addresses of nodes for which pending data is stored + +config NRF_802154_RX_BUFFERS + int "nRF 802.15.4 receive buffers" + default 16 + help + Number of buffers in nRF 802.15.4 driver receive queue. If this value is modified, + its serialization host counterpart must be set to the exact same value. + config NRF_802154_TEMPERATURE_UPDATE bool "nRF 802.15.4 temperature update" default y @@ -131,47 +192,7 @@ config NRF_802154_SER_DEFAULT_RESPONSE_TIMEOUT This option specifies default timeout of spinel status response in milliseconds. -endmenu # NRF_802154_SER_HOST || NRF_802154_SER_RADIO - -if NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION - -choice NRF_802154_CCA_MODE - prompt "nRF IEEE 802.15.4 CCA mode" - default NRF_802154_CCA_MODE_ED - help - CCA mode - -config NRF_802154_CCA_MODE_ED - bool "Energy Above Threshold" - -config NRF_802154_CCA_MODE_CARRIER - bool "Carrier Seen" - -config NRF_802154_CCA_MODE_CARRIER_AND_ED - bool "Energy Above Threshold AND Carrier Seen" - -config NRF_802154_CCA_MODE_CARRIER_OR_ED - bool "Energy Above Threshold OR Carrier Seen" - -endchoice - -config NRF_802154_CCA_ED_THRESHOLD - int "nRF IEEE 802.15.4 CCA Energy Detection threshold" - default 45 - help - If energy detected in a given channel is above the value then the - channel is deemed busy. The unit is defined as per 802.15.4-2006 spec. - -config NRF_802154_CCA_CORR_THRESHOLD - int "nRF IEEE 802.15.4 CCA Correlator threshold" - default 45 - -config NRF_802154_CCA_CORR_LIMIT - int "nRF IEEE 802.15.4 CCA Correlator limit" - default 2 - help - Limit for occurrences above correlator threshold. When not equal to - zero the correlator based signal detect is enabled. +if NRF_802154_SER_HOST config NRF_802154_RX_BUFFERS int "nRF 802.15.4 receive buffers" @@ -180,21 +201,11 @@ config NRF_802154_RX_BUFFERS Number of buffers in nRF 802.15.4 driver serialization host's receive queue. If this value is modified, its remote counterpart must be set to the exact same value. -config NRF_802154_PENDING_SHORT_ADDRESSES - int "nRF 802.15.4 pending short addresses" - default 16 - help - Number of slots containing short addresses of nodes for which pending data is stored +endif -config NRF_802154_PENDING_EXTENDED_ADDRESSES - int "nRF 802.15.4 pending extended addresses" - default 16 - help - Number of slots containing extended addresses of nodes for which pending data is stored +endmenu # NRF_802154_SER_HOST || NRF_802154_SER_RADIO -config NRF_802154_ENCRYPTION - bool "nRF 802.15.4 AES-CCM* authentication & encryption" - depends on !CRYPTO_NRF_ECB +if NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION config NRF_802154_CARRIER_FUNCTIONS bool "nRF 802.15.4 carrier functions" diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index a274a019e25..cd5ace0b278 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -12,6 +12,24 @@ if (CONFIG_NRF_802154_RADIO_DRIVER) sl_opensource/platform/nrf_802154_irq_zephyr.c sl_opensource/platform/nrf_802154_temperature_zephyr.c ) + + target_compile_definitions(zephyr-802154-interface + INTERFACE + # CCA mode options + NRF_802154_CCA_CORR_LIMIT_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_LIMIT} + NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_THRESHOLD} + NRF_802154_CCA_ED_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD} + ) + + if (CONFIG_NRF_802154_CCA_MODE_ED) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED) + elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER) + elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_AND_ED) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_AND_ED) + elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_OR_ED) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_OR_ED) + endif() endif () if (CONFIG_NRF_802154_SERIALIZATION) @@ -51,23 +69,8 @@ target_compile_definitions(zephyr-802154-interface # ACK timeout NRF_802154_ACK_TIMEOUT_ENABLED=1 - - # CCA mode options - NRF_802154_CCA_CORR_LIMIT_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_LIMIT} - NRF_802154_CCA_CORR_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_CORR_THRESHOLD} - NRF_802154_CCA_ED_THRESHOLD_DEFAULT=${CONFIG_NRF_802154_CCA_ED_THRESHOLD} ) -if (CONFIG_NRF_802154_CCA_MODE_ED) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED) -elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER) -elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_AND_ED) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_AND_ED) -elseif (CONFIG_NRF_802154_CCA_MODE_CARRIER_OR_ED) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_CARRIER_OR_ED) -endif() - if (CONFIG_NRF_802154_ENCRYPTION) target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENCRYPTION_ENABLED=1) target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_SECURITY_WRITER_ENABLED=1) @@ -90,12 +93,13 @@ else() target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_CARRIER_FUNCTIONS_ENABLED=0) endif() -target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENERGY_DETECTED_VERSION=1) - -if (CONFIG_NRF_802154_ASSERT_ZEPHYR OR CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) - target_include_directories(zephyr-802154-interface INTERFACE include) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_PLATFORM_ASSERT_INCLUDE=\"nrf_802154_assert_zephyr.h\") - target_sources(nrf-802154-platform PRIVATE nrf_802154_assert_handler.c) +if (CONFIG_NRF_802154_RADIO_DRIVER OR CONFIG_NRF_802154_SERIALIZATION) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENERGY_DETECTED_VERSION=1) + if (CONFIG_NRF_802154_ASSERT_ZEPHYR OR CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) + target_include_directories(zephyr-802154-interface INTERFACE include) + target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_PLATFORM_ASSERT_INCLUDE=\"nrf_802154_assert_zephyr.h\") + target_sources(nrf-802154-platform PRIVATE nrf_802154_assert_handler.c) + endif() endif() set(NRF52_SERIES ${CONFIG_SOC_SERIES_NRF52X}) From 50547c5b645e08e0da38b9910ad8ae6aee3ba7d9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:25 +0100 Subject: [PATCH 1351/2300] Revert "[nrf fromtree] modules: hal_nordic: nrf_802154: remove magic number" This reverts commit f9a5ede4697ea3ac12766a78825489f489365ac2. Signed-off-by: Robert Lubos --- .../serialization/platform/nrf_802154_spinel_backend_ipc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c index b2629eef67b..8a9cd8739b2 100644 --- a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c +++ b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c @@ -9,7 +9,6 @@ #include #include -#include "nrf_802154.h" #include "nrf_802154_spinel_backend_callouts.h" #include "nrf_802154_serialization_error.h" #include "../../spinel_base/spinel.h" @@ -75,7 +74,7 @@ nrf_802154_ser_err_t nrf_802154_backend_init(void) #define SEND_THREAD_STACK_SIZE 1024 /* Make the ring buffer long enough to hold all notifications that the driver can produce */ -#define RING_BUFFER_LEN (NRF_802154_MAX_PENDING_NOTIFICATIONS + 1) +#define RING_BUFFER_LEN (CONFIG_NRF_802154_RX_BUFFERS + 10) static K_SEM_DEFINE(send_sem, 0, RING_BUFFER_LEN); K_THREAD_STACK_DEFINE(send_thread_stack, SEND_THREAD_STACK_SIZE); From 84b75af82714967930fc43f0d44d2c7ebcbdb3f8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:25 +0100 Subject: [PATCH 1352/2300] Revert "[nrf fromtree] drivers: ieee802154: support Key Identifier Mode > 1" This reverts commit 05594b89487c8a61385e4e67e8f0e83469006307. Signed-off-by: Robert Lubos --- drivers/ieee802154/ieee802154_nrf5.c | 26 +++++++++++++++++++------- include/zephyr/net/ieee802154_radio.h | 7 +------ modules/openthread/platform/radio.c | 27 +++++++++------------------ 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 075555542bf..838e141d7b4 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -791,17 +791,25 @@ static void nrf5_iface_init(struct net_if *iface) #if defined(CONFIG_NRF_802154_ENCRYPTION) static void nrf5_config_mac_keys(struct ieee802154_key *mac_keys) { - nrf_802154_security_key_remove_all(); + static nrf_802154_key_id_t stored_key_ids[NRF_802154_SECURITY_KEY_STORAGE_SIZE]; + static uint8_t stored_ids[NRF_802154_SECURITY_KEY_STORAGE_SIZE]; + uint8_t i; - for (uint8_t i = 0; mac_keys->key_value - && i < NRF_802154_SECURITY_KEY_STORAGE_SIZE; mac_keys++, i++) { + for (i = 0; i < NRF_802154_SECURITY_KEY_STORAGE_SIZE && stored_key_ids[i].p_key_id; i++) { + nrf_802154_security_key_remove(&stored_key_ids[i]); + stored_key_ids[i].p_key_id = NULL; + } + + i = 0; + for (struct ieee802154_key *keys = mac_keys; keys->key_value + && i < NRF_802154_SECURITY_KEY_STORAGE_SIZE; keys++, i++) { nrf_802154_key_t key = { - .value.p_cleartext_key = mac_keys->key_value, - .id.mode = mac_keys->key_id_mode, - .id.p_key_id = mac_keys->key_id, + .value.p_cleartext_key = keys->key_value, + .id.mode = keys->key_id_mode, + .id.p_key_id = &(keys->key_index), .type = NRF_802154_KEY_CLEARTEXT, .frame_counter = 0, - .use_global_frame_counter = !(mac_keys->frame_counter_per_key), + .use_global_frame_counter = !(keys->frame_counter_per_key), }; __ASSERT_EVAL((void)nrf_802154_security_key_store(&key), @@ -809,6 +817,10 @@ static void nrf5_config_mac_keys(struct ieee802154_key *mac_keys) err == NRF_802154_SECURITY_ERROR_NONE || err == NRF_802154_SECURITY_ERROR_ALREADY_PRESENT, "Storing key failed, err: %d", err); + + stored_ids[i] = *key.id.p_key_id; + stored_key_ids[i].mode = key.id.mode; + stored_key_ids[i].p_key_id = &stored_ids[i]; }; } #endif /* CONFIG_NRF_802154_ENCRYPTION */ diff --git a/include/zephyr/net/ieee802154_radio.h b/include/zephyr/net/ieee802154_radio.h index de0cf89da4c..59608fac391 100644 --- a/include/zephyr/net/ieee802154_radio.h +++ b/include/zephyr/net/ieee802154_radio.h @@ -592,16 +592,11 @@ struct ieee802154_filter { * IEEE802154_CONFIG_MAC_KEYS. */ struct ieee802154_key { - /** Key material */ uint8_t *key_value; - /** Initial value of frame counter associated with the key, see section 9.4.3 */ uint32_t key_frame_counter; - /** Indicates if per-key frame counter should be used, see section 9.4.3 */ bool frame_counter_per_key; - /** Key Identifier Mode, see section 9.4.2.3, Table 9-7 */ uint8_t key_id_mode; - /** Key Identifier, see section 9.4.4 */ - uint8_t *key_id; + uint8_t key_index; }; /** IEEE 802.15.4 Transmission mode. */ diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index a09b7dd3b67..98eab182aad 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1188,14 +1188,20 @@ void otPlatRadioSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKe struct ieee802154_key keys[] = { { .key_id_mode = key_id_mode, + .key_index = aKeyId == 1 ? 0x80 : aKeyId - 1, + .key_value = (uint8_t *)aPrevKey->mKeyMaterial.mKey.m8, .frame_counter_per_key = false, }, { .key_id_mode = key_id_mode, + .key_index = aKeyId, + .key_value = (uint8_t *)aCurrKey->mKeyMaterial.mKey.m8, .frame_counter_per_key = false, }, { .key_id_mode = key_id_mode, + .key_index = aKeyId == 0x80 ? 1 : aKeyId + 1, + .key_value = (uint8_t *)aNextKey->mKeyMaterial.mKey.m8, .frame_counter_per_key = false, }, { @@ -1209,24 +1215,9 @@ void otPlatRadioSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKe }, }; - if (key_id_mode == 1) { - /* aKeyId in range: (1, 0x80) means valid keys */ - uint8_t prev_key_id = aKeyId == 1 ? 0x80 : aKeyId - 1; - uint8_t next_key_id = aKeyId == 0x80 ? 1 : aKeyId + 1; - - keys[0].key_id = &prev_key_id; - keys[0].key_value = (uint8_t *)aPrevKey->mKeyMaterial.mKey.m8; - - keys[1].key_id = &aKeyId; - keys[1].key_value = (uint8_t *)aCurrKey->mKeyMaterial.mKey.m8; - - keys[2].key_id = &next_key_id; - keys[2].key_value = (uint8_t *)aNextKey->mKeyMaterial.mKey.m8; - } else { - /* aKeyId == 0 is used only to clear keys for stack reset in RCP */ - __ASSERT_NO_MSG((key_id_mode == 0) && (aKeyId == 0)); - } - + /* aKeyId in range: (1, 0x80) means valid keys + * aKeyId == 0 is used only to clear keys for stack reset in RCP + */ struct ieee802154_config config = { .mac_keys = aKeyId == 0 ? clear_keys : keys, }; From 375f53244cdd2a68ffdace9d38c682d689a4f617 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:25 +0100 Subject: [PATCH 1353/2300] Revert "[nrf fromtree] modules: hal_nordic: nrf_802154: lengthen serialization ring buffer" This reverts commit 7b3c2b789dc053d49faab6b4ca13d698013c499a. Signed-off-by: Robert Lubos --- .../serialization/platform/nrf_802154_spinel_backend_ipc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c index 8a9cd8739b2..06ad1f003e6 100644 --- a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c +++ b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c @@ -71,11 +71,9 @@ nrf_802154_ser_err_t nrf_802154_backend_init(void) } /* Send packet thread details */ +#define RING_BUFFER_LEN 16 #define SEND_THREAD_STACK_SIZE 1024 -/* Make the ring buffer long enough to hold all notifications that the driver can produce */ -#define RING_BUFFER_LEN (CONFIG_NRF_802154_RX_BUFFERS + 10) - static K_SEM_DEFINE(send_sem, 0, RING_BUFFER_LEN); K_THREAD_STACK_DEFINE(send_thread_stack, SEND_THREAD_STACK_SIZE); struct k_thread send_thread_data; From 9557a878454383b64a1de35385db9e7ff289edde Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:25 +0100 Subject: [PATCH 1354/2300] Revert "[nrf fromtree] drivers: ieee802154: nrf5: support raw mode" This reverts commit 3675ef9dcc4f62dd702e1fda9356fe8be6b73c49. Signed-off-by: Robert Lubos --- drivers/ieee802154/ieee802154_nrf5.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 838e141d7b4..5e2b0d844dc 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -57,9 +57,6 @@ struct nrf5_802154_config { }; static struct nrf5_802154_data nrf5_data; -#if defined(CONFIG_IEEE802154_RAW_MODE) -static const struct device *nrf5_dev; -#endif #define DRX_SLOT_RX 0 /* Delayed reception window ID */ @@ -98,15 +95,6 @@ static const struct device *nrf5_dev; #define IEEE802154_NRF5_VENDOR_OUI (uint32_t)0xF4CE36 #endif -static inline const struct device *nrf5_get_device(void) -{ -#if defined(CONFIG_IEEE802154_RAW_MODE) - return nrf5_dev; -#else - return net_if_get_device(nrf5_data.iface); -#endif -} - static void nrf5_get_eui64(uint8_t *mac) { uint64_t factoryAddress; @@ -748,9 +736,6 @@ static int nrf5_init(const struct device *dev) { const struct nrf5_802154_config *nrf5_radio_cfg = NRF5_802154_CFG(dev); struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev); -#if defined(CONFIG_IEEE802154_RAW_MODE) - nrf5_dev = dev; -#endif k_fifo_init(&nrf5_radio->rx_fifo); k_sem_init(&nrf5_radio->tx_wait, 0, 1); @@ -1071,7 +1056,7 @@ void nrf_802154_received_timestamp_raw(uint8_t *data, int8_t power, uint8_t lqi, void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id) { - const struct device *dev = nrf5_get_device(); + const struct device *dev = net_if_get_device(nrf5_data.iface); #if defined(CONFIG_IEEE802154_CSL_ENDPOINT) if (id == DRX_SLOT_RX) { @@ -1196,7 +1181,7 @@ void nrf_802154_energy_detected(const nrf_802154_energy_detected_t *result) energy_scan_done_cb_t callback = nrf5_data.energy_scan_done; nrf5_data.energy_scan_done = NULL; - callback(nrf5_get_device(), result->ed_dbm); + callback(net_if_get_device(nrf5_data.iface), result->ed_dbm); } } @@ -1206,7 +1191,7 @@ void nrf_802154_energy_detection_failed(nrf_802154_ed_error_t error) energy_scan_done_cb_t callback = nrf5_data.energy_scan_done; nrf5_data.energy_scan_done = NULL; - callback(nrf5_get_device(), SHRT_MAX); + callback(net_if_get_device(nrf5_data.iface), SHRT_MAX); } } From f674bc5acbc8fc3f538ff19c52476b20334b448c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:26 +0100 Subject: [PATCH 1355/2300] Revert "[nrf fromlist] tests: flash: Use a flash partition that is known to be nonsecure" This reverts commit 6fa31b7fd36fbbf744739614e8e877d13937b2ad. Signed-off-by: Robert Lubos --- .../flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf | 4 ---- tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf | 4 ---- tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf | 4 ---- tests/drivers/flash/common/src/main.c | 3 +++ tests/drivers/flash/common/testcase.yaml | 2 +- 5 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 tests/drivers/flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf delete mode 100644 tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf delete mode 100644 tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf diff --git a/tests/drivers/flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf b/tests/drivers/flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf deleted file mode 100644 index 821a5e77e5b..00000000000 --- a/tests/drivers/flash/common/boards/nrf5340dk_nrf5340_cpuapp_ns.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_FCB=y -CONFIG_FLASH_MAP=y -CONFIG_SETTINGS=y -CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf b/tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf deleted file mode 100644 index 821a5e77e5b..00000000000 --- a/tests/drivers/flash/common/boards/nrf9160dk_nrf9160_ns.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_FCB=y -CONFIG_FLASH_MAP=y -CONFIG_SETTINGS=y -CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf b/tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf deleted file mode 100644 index 821a5e77e5b..00000000000 --- a/tests/drivers/flash/common/boards/nrf9161dk_nrf9161_ns.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_FCB=y -CONFIG_FLASH_MAP=y -CONFIG_SETTINGS=y -CONFIG_SETTINGS_FCB=y diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index 79d75ca9b13..4e73617ba41 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -14,6 +14,9 @@ #define TEST_AREA_DEV_NODE DT_INST(0, nordic_qspi_nor) #elif defined(CONFIG_SPI_NOR) #define TEST_AREA_DEV_NODE DT_INST(0, jedec_spi_nor) +#elif defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) +/* SoC embedded NVM */ +#define TEST_AREA slot1_ns_partition #else #define TEST_AREA storage_partition #endif diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 9aa13bb40d5..f7ee0b7fc6d 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -38,7 +38,7 @@ tests: drivers.flash.common.tfm_ns: build_only: true filter: (CONFIG_FLASH_HAS_DRIVER_ENABLED and CONFIG_TRUSTED_EXECUTION_NONSECURE - and dt_label_with_parent_compat_enabled("storage_partition", "fixed-partitions")) + and dt_label_with_parent_compat_enabled("slot1_ns_partition", "fixed-partitions")) integration_platforms: - nrf9161dk_nrf9161_ns drivers.flash.common.stm32: From 87f39e5b0a8b2a40874d7dc96c1fab6d792a4282 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:26 +0100 Subject: [PATCH 1356/2300] Revert "[nrf fromlist] samples: soc_flash_nrf: Make sure that the flash partition is valid" This reverts commit 75676023d89063e3da0b7cfae17b7a0f41741b40. Signed-off-by: Robert Lubos --- samples/drivers/soc_flash_nrf/prj.conf | 4 ---- samples/drivers/soc_flash_nrf/src/main.c | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/drivers/soc_flash_nrf/prj.conf b/samples/drivers/soc_flash_nrf/prj.conf index 48e64121b6a..9909ef3b29f 100644 --- a/samples/drivers/soc_flash_nrf/prj.conf +++ b/samples/drivers/soc_flash_nrf/prj.conf @@ -3,7 +3,3 @@ CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_MPU_ALLOW_FLASH_WRITE=y CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y -CONFIG_FCB=y -CONFIG_FLASH_MAP=y -CONFIG_SETTINGS=y -CONFIG_SETTINGS_FCB=y diff --git a/samples/drivers/soc_flash_nrf/src/main.c b/samples/drivers/soc_flash_nrf/src/main.c index 29606a9ca5d..33ab9b28e1d 100644 --- a/samples/drivers/soc_flash_nrf/src/main.c +++ b/samples/drivers/soc_flash_nrf/src/main.c @@ -13,7 +13,11 @@ #include -#define TEST_PARTITION storage_partition +#ifdef CONFIG_TRUSTED_EXECUTION_NONSECURE +#define TEST_PARTITION slot1_ns_partition +#else +#define TEST_PARTITION slot1_partition +#endif #define TEST_PARTITION_OFFSET FIXED_PARTITION_OFFSET(TEST_PARTITION) #define TEST_PARTITION_DEVICE FIXED_PARTITION_DEVICE(TEST_PARTITION) From 1319b28ea6dd23cd9113d37a47c0f45ce1a089e7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:26 +0100 Subject: [PATCH 1357/2300] Revert "[nrf fromlist] samples: soc_flash_nrf: Print finished message" This reverts commit d04645929217d687974f82d5d85a775afdb99c1d. Signed-off-by: Robert Lubos --- samples/drivers/soc_flash_nrf/README.rst | 2 -- samples/drivers/soc_flash_nrf/sample.yaml | 1 - samples/drivers/soc_flash_nrf/src/main.c | 2 -- 3 files changed, 5 deletions(-) diff --git a/samples/drivers/soc_flash_nrf/README.rst b/samples/drivers/soc_flash_nrf/README.rst index 2ee87739aad..de49eb6db28 100644 --- a/samples/drivers/soc_flash_nrf/README.rst +++ b/samples/drivers/soc_flash_nrf/README.rst @@ -131,5 +131,3 @@ Sample Output Test 8: Write block size API write-block-size = 1 - - Finished! diff --git a/samples/drivers/soc_flash_nrf/sample.yaml b/samples/drivers/soc_flash_nrf/sample.yaml index d1f635ca93f..b8a59328be4 100644 --- a/samples/drivers/soc_flash_nrf/sample.yaml +++ b/samples/drivers/soc_flash_nrf/sample.yaml @@ -29,4 +29,3 @@ tests: - "Data read matches data written. Good!" - "SoC flash consists of \\d+ pages." - "write-block-size = 1" - - "Finished!" diff --git a/samples/drivers/soc_flash_nrf/src/main.c b/samples/drivers/soc_flash_nrf/src/main.c index 33ab9b28e1d..91a763c781d 100644 --- a/samples/drivers/soc_flash_nrf/src/main.c +++ b/samples/drivers/soc_flash_nrf/src/main.c @@ -191,7 +191,5 @@ int main(void) printf("\nTest 8: Write block size API\n"); printf(" write-block-size = %u\n", flash_get_write_block_size(flash_dev)); - - printf("\nFinished!\n"); return 0; } From 8e97c9ebb4e6b19d5c724e7d301dbe8ac6b010dd Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:26 +0100 Subject: [PATCH 1358/2300] Revert "[nrf fromlist] samples: soc_flash_nrf: Stop erasing outside of test partition" This reverts commit eead8ff00f130eb969bc4f6c21673d3fee3f3ca6. Signed-off-by: Robert Lubos --- samples/drivers/soc_flash_nrf/README.rst | 2 +- samples/drivers/soc_flash_nrf/src/main.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/drivers/soc_flash_nrf/README.rst b/samples/drivers/soc_flash_nrf/README.rst index de49eb6db28..496688e8b65 100644 --- a/samples/drivers/soc_flash_nrf/README.rst +++ b/samples/drivers/soc_flash_nrf/README.rst @@ -62,7 +62,7 @@ Sample Output Data read: 1234 Data read matches data written. Good! - Test 3: Flash erase (2 pages at 0x80000) + Test 3: Flash erase (4 pages at 0x80000) Flash erase succeeded! Test 4: Flash write (word array 2) diff --git a/samples/drivers/soc_flash_nrf/src/main.c b/samples/drivers/soc_flash_nrf/src/main.c index 91a763c781d..a438a67cf2f 100644 --- a/samples/drivers/soc_flash_nrf/src/main.c +++ b/samples/drivers/soc_flash_nrf/src/main.c @@ -84,9 +84,9 @@ int main(void) } } - offset = TEST_PARTITION_OFFSET; - printf("\nTest 3: Flash erase (2 pages at 0x%x)\n", offset); - if (flash_erase(flash_dev, offset, FLASH_PAGE_SIZE * 2) != 0) { + offset = TEST_PARTITION_OFFSET - FLASH_PAGE_SIZE * 2; + printf("\nTest 3: Flash erase (4 pages at 0x%x)\n", offset); + if (flash_erase(flash_dev, offset, FLASH_PAGE_SIZE * 4) != 0) { printf(" Flash erase failed!\n"); } else { printf(" Flash erase succeeded!\n"); From 6ac28d7fe3e6a9733e71ac1bbc9ba7191d32868f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:26 +0100 Subject: [PATCH 1359/2300] Revert "[nrf fromtree] net: openthread: Add openthread TCAT implementation." This reverts commit 77065228342dea9bf36be58454a2617db32aebac. Signed-off-by: Robert Lubos --- modules/openthread/CMakeLists.txt | 6 - modules/openthread/Kconfig.features | 4 - modules/openthread/Kconfig.thread | 12 - modules/openthread/platform/CMakeLists.txt | 1 - modules/openthread/platform/ble.c | 458 --------------------- 5 files changed, 481 deletions(-) delete mode 100644 modules/openthread/platform/ble.c diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 8afa1aec440..2b2b593f82f 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -58,12 +58,6 @@ else() set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OFF CACHE BOOL "Enable BBR MR support" FORCE) endif() -if(CONFIG_OPENTHREAD_BLE_TCAT) - set(OT_BLE_TCAT ON CACHE BOOL "Enable BLE TCAT support" FORCE) -else() - set(OT_BLE_TCAT OFF CACHE BOOL "Enable BLE TCAT support" FORCE) -endif() - if(CONFIG_OPENTHREAD_BORDER_AGENT) set(OT_BORDER_AGENT ON CACHE BOOL "Enable Border Agent" FORCE) else() diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index bd8a05ed9b9..a75c9e8fd48 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -39,10 +39,6 @@ config OPENTHREAD_BACKBONE_ROUTER_DUA_NDPROXYING config OPENTHREAD_BACKBONE_ROUTER_MULTICAST_ROUTING bool "BBR MR support" -config OPENTHREAD_BLE_TCAT - bool "BLE TCAT support" - select EXPERIMENTAL - config OPENTHREAD_BORDER_AGENT bool "Border Agent support" diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index 66e039b7300..891365b4672 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -181,15 +181,3 @@ config OPENTHREAD_DEFAULT_TX_POWER default 0 help Set the default TX output power [dBm] in radio driver for OpenThread purpose. - -config OPENTHREAD_BLE_TCAT_THREAD_STACK_SIZE - int "Openthread default TCAT stack size" - default 4200 - help - 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. diff --git a/modules/openthread/platform/CMakeLists.txt b/modules/openthread/platform/CMakeLists.txt index 542aa5186ea..d363bcda7df 100644 --- a/modules/openthread/platform/CMakeLists.txt +++ b/modules/openthread/platform/CMakeLists.txt @@ -10,7 +10,6 @@ zephyr_library_sources( spi.c ) -zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_BLE_TCAT ble.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_DIAG diag.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_COPROCESSOR uart.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_CRYPTO_PSA crypto_psa.c) diff --git a/modules/openthread/platform/ble.c b/modules/openthread/platform/ble.c deleted file mode 100644 index 7b41556b617..00000000000 --- a/modules/openthread/platform/ble.c +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* Zephyr OpenThread integration Library */ -#include - -/* OpenThread BLE driver API */ -#include - -/* Zephyr Logging */ - -#define LOG_MODULE_NAME net_openthread_tcat -#define LOG_LEVEL CONFIG_OPENTHREAD_LOG_LEVEL - -LOG_MODULE_REGISTER(LOG_MODULE_NAME); - -#define DEVICE_NAME CONFIG_BT_DEVICE_NAME -#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) - -/* BLE connection constants as defined in thread specification. */ -#define TOBLE_SERVICE_UUID 0xfffb -#define RX_CHARACTERISTIC_UUID \ - BT_UUID_128_ENCODE(0x6bd10d8b, 0x85a7, 0x4e5a, 0xba2d, 0xc83558a5f220) -#define TX_CHARACTERISTIC_UUID \ - BT_UUID_128_ENCODE(0x7fddf61f, 0x280a, 0x4773, 0xb448, 0xba1b8fe0dd69) - -#define BT_UUID_TCAT_SERVICE BT_UUID_DECLARE_16(TOBLE_SERVICE_UUID) -#define BT_UUID_TCAT_SERVICE_RX BT_UUID_DECLARE_128(RX_CHARACTERISTIC_UUID) -#define BT_UUID_TCAT_SERVICE_TX BT_UUID_DECLARE_128(TX_CHARACTERISTIC_UUID) - -#define PLAT_BLE_THREAD_DEALY 500 -#define PLAT_BLE_MSG_DATA_MAX CONFIG_BT_L2CAP_TX_MTU /* must match the maximum MTU size used */ - -#define PLAT_BLE_MSG_CONNECT (PLAT_BLE_MSG_DATA_MAX + 1U) -#define PLAT_BLE_MSG_DISCONNECT (PLAT_BLE_MSG_CONNECT + 1U) - -/* Zephyr Kernel Objects */ - -static void ot_plat_ble_thread(void *, void *, void *); -static uint8_t ot_plat_ble_msg_buf[PLAT_BLE_MSG_DATA_MAX]; - -static K_SEM_DEFINE(ot_plat_ble_init_semaphore, 0, 1); -static K_SEM_DEFINE(ot_plat_ble_event_semaphore, 0, K_SEM_MAX_LIMIT); -RING_BUF_DECLARE(ot_plat_ble_ring_buf, CONFIG_OPENTHREAD_BLE_TCAT_RING_BUF_SIZE); -static K_THREAD_DEFINE(ot_plat_ble_tid, CONFIG_OPENTHREAD_BLE_TCAT_THREAD_STACK_SIZE, - ot_plat_ble_thread, NULL, NULL, NULL, 5, 0, PLAT_BLE_THREAD_DEALY); - -/* OpenThread Objects */ - -static otInstance *ble_openthread_instance; - -/* BLE service Objects */ - -/* forward declaration for callback functions */ -static ssize_t on_receive(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, - uint16_t len, uint16_t offset, uint8_t flags); -static void on_cccd_changed(const struct bt_gatt_attr *attr, uint16_t value); - -/* Service Declaration and Registration */ -BT_GATT_SERVICE_DEFINE(my_service, BT_GATT_PRIMARY_SERVICE(BT_UUID_TCAT_SERVICE), - BT_GATT_CHARACTERISTIC(BT_UUID_TCAT_SERVICE_RX, - BT_GATT_CHRC_WRITE | BT_GATT_CHRC_WRITE_WITHOUT_RESP, - BT_GATT_PERM_READ | BT_GATT_PERM_WRITE, NULL, - on_receive, NULL), - BT_GATT_CHARACTERISTIC(BT_UUID_TCAT_SERVICE_TX, BT_GATT_CHRC_NOTIFY, - BT_GATT_PERM_READ, NULL, NULL, NULL), - BT_GATT_CCC(on_cccd_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),); - -/* Zephyr BLE Objects */ - -/* forward declaration for callback functions */ -static void connected(struct bt_conn *conn, uint8_t err); -static void disconnected(struct bt_conn *conn, uint8_t reason); -static bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param); -static void le_param_updated(struct bt_conn *conn, uint16_t interval, uint16_t latency, - uint16_t timeout); - -static struct bt_conn *ot_plat_ble_connection; - -static struct bt_conn_cb conn_callbacks = {.connected = connected, - .disconnected = disconnected, - .le_param_req = le_param_req, - .le_param_updated = le_param_updated}; - -static const struct bt_data ad[] = { - BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), - BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN), -}; - -static const struct bt_data sd[] = { - BT_DATA_BYTES(BT_DATA_UUID16_ALL, BT_UUID_16_ENCODE(TOBLE_SERVICE_UUID)), -}; - -/* Zephyr BLE Message Queue and Thread */ - -static bool ot_plat_ble_queue_msg(const uint8_t *aData, uint16_t aLen, int8_t aRssi) -{ - otError error = OT_ERROR_NONE; - uint16_t len = 0; - - if (aLen <= PLAT_BLE_MSG_DATA_MAX && aData == NULL) { - return OT_ERROR_INVALID_ARGS; - } - - k_sched_lock(); - - len = sizeof(aLen) + sizeof(aRssi) + ((aLen <= PLAT_BLE_MSG_DATA_MAX) ? aLen : 0); - - if (ring_buf_space_get(&ot_plat_ble_ring_buf) >= len) { - ring_buf_put(&ot_plat_ble_ring_buf, (uint8_t *)&aLen, sizeof(aLen)); - ring_buf_put(&ot_plat_ble_ring_buf, &aRssi, sizeof(aRssi)); - if (aLen <= PLAT_BLE_MSG_DATA_MAX) { - ring_buf_put(&ot_plat_ble_ring_buf, aData, aLen); - } - k_sem_give(&ot_plat_ble_event_semaphore); - } else { - error = OT_ERROR_NO_BUFS; - } - - k_sched_unlock(); - - return error; -} - -static void ot_plat_ble_thread(void *unused1, void *unused2, void *unused3) -{ - ARG_UNUSED(unused1); - ARG_UNUSED(unused2); - ARG_UNUSED(unused3); - - uint16_t len; - int8_t rssi; - otBleRadioPacket my_packet; - - LOG_INF("%s started", __func__); - - while (1) { - k_sem_take(&ot_plat_ble_event_semaphore, K_FOREVER); - ring_buf_get(&ot_plat_ble_ring_buf, (uint8_t *)&len, sizeof(len)); - ring_buf_get(&ot_plat_ble_ring_buf, &rssi, sizeof(rssi)); - if (len <= PLAT_BLE_MSG_DATA_MAX) { - ring_buf_get(&ot_plat_ble_ring_buf, ot_plat_ble_msg_buf, len); - } - - openthread_api_mutex_lock(openthread_get_default_context()); - - if (len <= PLAT_BLE_MSG_DATA_MAX) { - /* The packet parameter in otPlatBleGattServerOnWriteRequest is not const. - * Re-write all members. - */ - my_packet.mValue = ot_plat_ble_msg_buf; - my_packet.mPower = rssi; - my_packet.mLength = len; - otPlatBleGattServerOnWriteRequest(ble_openthread_instance, 0, &my_packet); - } else if (len == PLAT_BLE_MSG_CONNECT) { - otPlatBleGapOnConnected(ble_openthread_instance, 0); - } else if (len == PLAT_BLE_MSG_DISCONNECT) { - otPlatBleGapOnDisconnected(ble_openthread_instance, 0); - } - openthread_api_mutex_unlock(openthread_get_default_context()); - } -} - -/* Zephyr BLE service callbacks */ - -/* This function is called whenever the RX Characteristic has been written to by a Client */ -static ssize_t on_receive(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, - uint16_t len, uint16_t offset, uint8_t flags) -{ - LOG_DBG("Received data, handle %" PRIu16 ", len %" PRIu16, attr->handle, len); - - otError error = ot_plat_ble_queue_msg(buf, len, 0); - - if (error != OT_ERROR_NONE) { - LOG_WRN("Error queuing message: %s", otThreadErrorToString(error)); - } - - return len; -} - -/* This function is called whenever a Notification has been sent by the TX Characteristic */ -static void on_sent(struct bt_conn *conn, void *user_data) -{ - ARG_UNUSED(conn); - ARG_UNUSED(user_data); - - LOG_DBG("Data sent"); -} - -/* This function is called whenever the CCCD register has been changed by the client */ -void on_cccd_changed(const struct bt_gatt_attr *attr, uint16_t value) -{ - uint16_t mtu; - otError error = OT_ERROR_NONE; - - ARG_UNUSED(attr); - - switch (value) { - case BT_GATT_CCC_NOTIFY: - - error = ot_plat_ble_queue_msg(NULL, PLAT_BLE_MSG_CONNECT, 0); - if (error != OT_ERROR_NONE) { - LOG_WRN("Error queuing message: %s", otThreadErrorToString(error)); - } - - error = otPlatBleGattMtuGet(ble_openthread_instance, &mtu); - if (error != OT_ERROR_NONE) { - LOG_WRN("Error retrieving mtu: %s", otThreadErrorToString(error)); - } - - LOG_INF("CCCD update (mtu=%" PRIu16 ")!", mtu); - - break; - - default: - break; - } -} - -otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, - const otBleRadioPacket *aPacket) -{ - ARG_UNUSED(aInstance); - - /* TO DO change to indications. */ - const struct bt_gatt_attr *attr = &my_service.attrs[3]; - - struct bt_gatt_notify_params params = {.uuid = BT_UUID_TCAT_SERVICE_TX, - .attr = attr, - .data = aPacket->mValue, - .len = aPacket->mLength, - .func = on_sent}; - - LOG_DBG("Send data, handle %d, len %d", attr->handle, aPacket->mLength); - - /* Only one connection supported */ - if (aHandle != 0) { - return OT_ERROR_INVALID_ARGS; - } - - if (ot_plat_ble_connection == NULL) { - return OT_ERROR_INVALID_STATE; - } - - /* Check whether notifications are enabled or not */ - if (bt_gatt_is_subscribed(ot_plat_ble_connection, attr, BT_GATT_CCC_NOTIFY)) { - if (bt_gatt_notify_cb(ot_plat_ble_connection, ¶ms)) { - LOG_WRN("Error, unable to send notification"); - return OT_ERROR_INVALID_ARGS; - } - } else { - LOG_WRN("Warning, notification not enabled on the selected attribute"); - return OT_ERROR_INVALID_STATE; - } - - return OT_ERROR_NONE; -} - -otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu) -{ - ARG_UNUSED(aInstance); - - if (ot_plat_ble_connection == NULL) { - return OT_ERROR_FAILED; - } - - if (aMtu != NULL) { - *aMtu = bt_gatt_get_mtu(ot_plat_ble_connection); - } - - return OT_ERROR_NONE; -} - -otError otPlatBleGapDisconnect(otInstance *aInstance) -{ - ARG_UNUSED(aInstance); - - if (ot_plat_ble_connection == NULL) { - return OT_ERROR_INVALID_STATE; - } - - if (bt_conn_disconnect(ot_plat_ble_connection, BT_HCI_ERR_REMOTE_USER_TERM_CONN)) { - return OT_ERROR_INVALID_STATE; - } - - return OT_ERROR_NONE; -} - -/* Zephyr BLE callbacks */ - -static void connected(struct bt_conn *conn, uint8_t err) -{ - struct bt_conn_info info; - char addr[BT_ADDR_LE_STR_LEN]; - uint16_t mtu; - otError error = OT_ERROR_NONE; - - ot_plat_ble_connection = bt_conn_ref(conn); - - if (err) { - LOG_WRN("Connection failed (err %u)", err); - return; - } else if (bt_conn_get_info(conn, &info)) { - LOG_WRN("Could not parse connection info"); - } else { - bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - - error = otPlatBleGattMtuGet(ble_openthread_instance, &mtu); - if (error != OT_ERROR_NONE) { - LOG_WRN("Error retrieving mtu: %s", otThreadErrorToString(error)); - } - - LOG_INF("Connection established (mtu=%" PRIu16 ")!", mtu); - } -} - -static void disconnected(struct bt_conn *conn, uint8_t reason) -{ - otError error = OT_ERROR_NONE; - - LOG_INF("Disconnected (reason %" PRIu8 ")", reason); - - if (ot_plat_ble_connection) { - bt_conn_unref(ot_plat_ble_connection); - ot_plat_ble_connection = NULL; - - error = ot_plat_ble_queue_msg(NULL, PLAT_BLE_MSG_DISCONNECT, 0); - if (error != OT_ERROR_NONE) { - LOG_WRN("Error queuing message: %s", otThreadErrorToString(error)); - } - } -} - -static bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param) -{ - return true; -} - -static void le_param_updated(struct bt_conn *conn, uint16_t interval, uint16_t latency, - uint16_t timeout) -{ - struct bt_conn_info info; - char addr[BT_ADDR_LE_STR_LEN]; - uint16_t mtu; - otError error = OT_ERROR_NONE; - - if (bt_conn_get_info(conn, &info)) { - LOG_INF("Could not parse connection info"); - } else { - bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - - error = otPlatBleGattMtuGet(ble_openthread_instance, &mtu); - - if (error != OT_ERROR_NONE) { - LOG_WRN("Error retrieving mtu: %s", otThreadErrorToString(error)); - } - - LOG_INF("Connection parameters updated (mtu=%" PRIu16 ")!", mtu); - } -} - -static void bt_ready(int err) -{ - if (err) { - LOG_WRN("BLE init failed with error code %d", err); - return; - } - - bt_conn_cb_register(&conn_callbacks); - k_sem_give(&ot_plat_ble_init_semaphore); /* BLE stack up an running */ -} - -otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval) -{ - ARG_UNUSED(aInstance); - ARG_UNUSED(aInterval); - - /* TO DO advertisement format change */ - int err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); - - if (err != 0 && err != -EALREADY) { - LOG_WRN("Advertising failed to start (err %d)", err); - return OT_ERROR_INVALID_STATE; - } - - LOG_INF("Advertising successfully started"); - - return OT_ERROR_NONE; -} - -otError otPlatBleGapAdvStop(otInstance *aInstance) -{ - ARG_UNUSED(aInstance); - - int err = bt_le_adv_stop(); - - if (err != 0 && err != -EALREADY) { - LOG_WRN("Advertisement failed to stop (err %d)", err); - return OT_ERROR_FAILED; - } - return OT_ERROR_NONE; -} - -/* Zephyr BLE initialization */ - -otError otPlatBleEnable(otInstance *aInstance) -{ - int err; - - ble_openthread_instance = aInstance; - err = bt_enable(bt_ready); - - if (err != 0 && err != -EALREADY) { - LOG_WRN("BLE enable failed with error code %d", err); - return OT_ERROR_FAILED; - } else if (err == -EALREADY) { - err = k_sem_take(&ot_plat_ble_init_semaphore, K_MSEC(500)); - return OT_ERROR_NONE; - } - - err = k_sem_take(&ot_plat_ble_init_semaphore, K_MSEC(500)); - - if (!err) { - LOG_INF("Bluetooth initialized"); - } else { - LOG_INF("BLE initialization did not complete in time"); - return OT_ERROR_FAILED; - } - - return OT_ERROR_NONE; -} - -otError otPlatBleDisable(otInstance *aInstance) -{ - ARG_UNUSED(aInstance); - /* This function intentionally does nothing since disabling advertisement disables BLE - * stack. - */ - return OT_ERROR_NONE; -} From 7c9b523a67c15dab837a1cf310ad4c41a9b669cf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:27 +0100 Subject: [PATCH 1360/2300] Revert "[nrf fromtree] modules: hal_nordic: nRF 802.15.4 customizable asserts" This reverts commit cd6ab6cdc5fc662bfd25f24cc2c5f969d2236f9c. Signed-off-by: Robert Lubos --- modules/hal_nordic/Kconfig | 28 +----------------- modules/hal_nordic/nrf_802154/CMakeLists.txt | 5 ---- .../include/nrf_802154_assert_zephyr.h | 29 ------------------- .../nrf_802154/nrf_802154_assert_handler.c | 26 ----------------- 4 files changed, 1 insertion(+), 87 deletions(-) delete mode 100644 modules/hal_nordic/nrf_802154/include/nrf_802154_assert_zephyr.h delete mode 100644 modules/hal_nordic/nrf_802154/nrf_802154_assert_handler.c diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index 44c12e88685..f842d2cb646 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -205,39 +205,13 @@ endif endmenu # NRF_802154_SER_HOST || NRF_802154_SER_RADIO -if NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION - config NRF_802154_CARRIER_FUNCTIONS bool "nRF 802.15.4 carrier functions" + depends on NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION help This option enables functions such as modulated carrier and continuous carrier. If this option is modified on a multicore SoC, its remote counterpart must be set to the exact same value. -choice NRF_802154_ASSERT_CHOICE - prompt "nRF 802.15.4 assert implementation" - default NRF_802154_ASSERT_ZEPHYR_MINIMAL - -config NRF_802154_ASSERT_ZEPHYR_MINIMAL - bool "nRF 802.15.4 minimal assertions" - help - This option provides minimal run-time checking of the nRF 802.15.4 Radio Driver's operation, - even if kernel-wide CONFIG_ASSERT is disabled. In case of an abnormal condition the function - `nrf_802154_assert_handler()` is called. File and line debug information are not provided - to save memory of the image file. Default implementation of the `nrf_802154_assert_handler` - involves a call to `k_panic`/`k_oops` and allows further tweaking of the behavior. - You can also provide your own implementation of `nrf_802154_assert_handler`. - -config NRF_802154_ASSERT_ZEPHYR - bool "nRF 802.15.4 Radio Driver assertions as Zephyr's standard __ASERT_NO_MSG" - help - The run-time checking of the nRF 802.15.4 Radio Driver depends fully on the configuration - of the `__ASSERT_NO_MSG` macro, including the ability to completely turn off the run-time - checking. - -endchoice # NRF_802154_ASSERT_CHOICE - -endif # NRF_802154_RADIO_DRIVER || NRF_802154_SERIALIZATION - endmenu # HAS_NORDIC_DRIVERS rsource "nrfx/Kconfig" diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index cd5ace0b278..c338981b651 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -95,11 +95,6 @@ endif() if (CONFIG_NRF_802154_RADIO_DRIVER OR CONFIG_NRF_802154_SERIALIZATION) target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_ENERGY_DETECTED_VERSION=1) - if (CONFIG_NRF_802154_ASSERT_ZEPHYR OR CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) - target_include_directories(zephyr-802154-interface INTERFACE include) - target_compile_definitions(zephyr-802154-interface INTERFACE NRF_802154_PLATFORM_ASSERT_INCLUDE=\"nrf_802154_assert_zephyr.h\") - target_sources(nrf-802154-platform PRIVATE nrf_802154_assert_handler.c) - endif() endif() set(NRF52_SERIES ${CONFIG_SOC_SERIES_NRF52X}) diff --git a/modules/hal_nordic/nrf_802154/include/nrf_802154_assert_zephyr.h b/modules/hal_nordic/nrf_802154/include/nrf_802154_assert_zephyr.h deleted file mode 100644 index ecd09de609a..00000000000 --- a/modules/hal_nordic/nrf_802154/include/nrf_802154_assert_zephyr.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2023, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRF_802154_ASSERT_ZEPHYR_H__ -#define NRF_802154_ASSERT_ZEPHYR_H__ - -#if defined(CONFIG_NRF_802154_ASSERT_ZEPHYR) - -#include - -#define NRF_802154_ASSERT(condition) __ASSERT_NO_MSG(condition) - -#elif defined(CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) - -extern void nrf_802154_assert_handler(void); - -#define NRF_802154_ASSERT(condition) \ - do { \ - if (!(condition)) { \ - nrf_802154_assert_handler(); \ - } \ - } while (0) - -#endif /* CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL */ - -#endif /* NRF_802154_ASSERT_ZEPHYR_H__*/ diff --git a/modules/hal_nordic/nrf_802154/nrf_802154_assert_handler.c b/modules/hal_nordic/nrf_802154/nrf_802154_assert_handler.c deleted file mode 100644 index 14d964724c6..00000000000 --- a/modules/hal_nordic/nrf_802154/nrf_802154_assert_handler.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include "nrf_802154_assert_zephyr.h" - -#if defined(CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL) - -__weak void nrf_802154_assert_handler(void) -{ -#ifdef CONFIG_USERSPACE - /* User threads aren't allowed to induce kernel panics; generate - * an oops instead. - */ - if (k_is_user_context()) { - k_oops(); - } -#endif - - k_panic(); -} - -#endif /* CONFIG_NRF_802154_ASSERT_ZEPHYR_MINIMAL */ From 1a2dc17f54f654be9e1aa8745e0aeca896e314e0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:27 +0100 Subject: [PATCH 1361/2300] Revert "[nrf fromlist] wifi: Add the enums to the status" This reverts commit 0a6ec5c96dbe9fa668db07d8bf1c6a2258a1b7fb. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index babf67722c1..e52cefd2d68 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -353,11 +353,7 @@ enum wifi_disconn_reason { /** Generic Wi-Fi status for commands and events */ struct wifi_status { - union { - int status; - enum wifi_conn_status conn_status; - enum wifi_disconn_reason disconn_reason; - }; + int status; }; /** Wi-Fi interface status */ From fb84ebfab0b9b7609420a7d88e430fc2160b3a6e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:27 +0100 Subject: [PATCH 1362/2300] Revert "[nrf fromlist] wifi: Add an enum for disconnect reasons" This reverts commit bf644c7b687acea27aa9bfd74ee8f64b3a5deeea. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index e52cefd2d68..91c9ad088a8 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -337,20 +337,6 @@ enum wifi_conn_status { WIFI_STATUS_CONN_AP_NOT_FOUND, }; -/** Wi-Fi disconnect reason codes. To be overlaid on top of \ref wifi_status - * in the disconnect result event for detailed reason. - */ -enum wifi_disconn_reason { - /** Unspecified reason */ - WIFI_REASON_DISCONN_UNSPECIFIED = 0, - /** Disconnected due to user request */ - WIFI_REASON_DISCONN_USER_REQUEST, - /** Disconnected due to AP leaving */ - WIFI_REASON_DISCONN_AP_LEAVING, - /** Disconnected due to inactivity */ - WIFI_REASON_DISCONN_INACTIVITY, -}; - /** Generic Wi-Fi status for commands and events */ struct wifi_status { int status; From ab6baae93b35d271728b779fc8604fc4fa2a08b1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:27 +0100 Subject: [PATCH 1363/2300] Revert "[nrf fromlist] wifi: Add an enum for connect result status" This reverts commit 378bdeb3c8bc4c55c21b5693336a6887e8a1bb90. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 91c9ad088a8..faf83b42b84 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -321,22 +321,6 @@ struct wifi_connect_req_params { int timeout; }; -/** Wi-Fi connect result codes. To be overlaid on top of \ref wifi_status - * in the connect result event for detailed status. - */ -enum wifi_conn_status { - /** Connection successful */ - WIFI_STATUS_CONN_SUCCESS = 0, - /** Connection failed - generic failure */ - WIFI_STATUS_CONN_FAIL, - /** Connection failed - wrong password */ - WIFI_STATUS_CONN_WRONG_PASSWORD, - /** Connection timed out */ - WIFI_STATUS_CONN_TIMEOUT, - /** Connection failed - AP not found */ - WIFI_STATUS_CONN_AP_NOT_FOUND, -}; - /** Generic Wi-Fi status for commands and events */ struct wifi_status { int status; From 90a3d6ac81e4db8fe7bcd241c3a297260161e2f7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:27 +0100 Subject: [PATCH 1364/2300] Revert "[nrf fromtree] net: l2: wifi: Fix Print of SSID in WIFI status" This reverts commit 6be1b72ed9c0d1d3f27120f760e8f32b49cbd2df. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 5f7eb5ba0ee..ed85b015971 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -647,7 +647,7 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) wifi_mode_txt(status.iface_mode)); shell_fprintf(sh, SHELL_NORMAL, "Link Mode: %s\n", wifi_link_mode_txt(status.link_mode)); - shell_fprintf(sh, SHELL_NORMAL, "SSID: %.32s\n", status.ssid); + shell_fprintf(sh, SHELL_NORMAL, "SSID: %-32s\n", status.ssid); shell_fprintf(sh, SHELL_NORMAL, "BSSID: %s\n", net_sprint_ll_addr_buf(status.bssid, WIFI_MAC_ADDR_LEN, mac_string_buf, From bf2faea19a3257c5e051c6917640d224808a4e03 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:28 +0100 Subject: [PATCH 1365/2300] Revert "[nrf fromlist] wifi: Check WPA-PSK passphrase length" This reverts commit bfe1858e369a3247254f4c08205a4e2f729a9901. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_mgmt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 1a866d4c47c..6eb8a6682c2 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -274,7 +274,6 @@ static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, (params->ssid_length > WIFI_SSID_MAX_LEN) || (params->ssid_length == 0U) || ((params->security == WIFI_SECURITY_TYPE_PSK || - params->security == WIFI_SECURITY_TYPE_WPA_PSK || params->security == WIFI_SECURITY_TYPE_PSK_SHA256) && ((params->psk_length < 8) || (params->psk_length > 64) || (params->psk_length == 0U) || !params->psk)) || From a8413fdc5017a5e9ac6966b747ce8ab6f0196425 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:28 +0100 Subject: [PATCH 1366/2300] Revert "[nrf fromtree] Bluetooth: Host: build shell power_control_request" This reverts commit 721a8da0e44e7d44b0e10eb1bfd7ce0e008e45dd. Signed-off-by: Robert Lubos --- tests/bluetooth/shell/testcase.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index ef4eed67eb3..4b46c8d6781 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -13,13 +13,6 @@ tests: tags: bluetooth harness: keyboard min_flash: 145 - bluetooth.shell.power_control_request: - extra_configs: - - CONFIG_BT_TRANSMIT_POWER_CONTROL=y - - CONFIG_BT_CTLR=n - platform_allow: - - native_posix - build_only: true bluetooth.shell.cdc_acm: extra_args: - OVERLAY_CONFIG=cdc_acm.conf From c436269cdbb6e709be4f6ccf77855cdc104ffc0e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:28 +0100 Subject: [PATCH 1367/2300] Revert "[nrf fromtree] Bluetooth: Host: Align return lines of bt shell helper function phy2str" This reverts commit cff33499e662011aefac5a77cf5ec93486fb6c1e. Signed-off-by: Robert Lubos --- subsys/bluetooth/shell/bt.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index 42c9f55455b..ea27535504d 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -100,14 +100,10 @@ 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"; + 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"; } } #endif From b7b2dc55a1d4da8b8ca3edaa15dd96a8c0b14633 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:29 +0100 Subject: [PATCH 1368/2300] Revert "[nrf fromtree] Bluetooth: Host: Add bt shell functions LE Power Control Request Feature" This reverts commit 282414d21a515bb25d5eec909a71707d41810e8c. Signed-off-by: Robert Lubos --- subsys/bluetooth/shell/bt.c | 178 ------------------------------------ 1 file changed, 178 deletions(-) diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index ea27535504d..67d23c81ebb 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -124,67 +124,6 @@ static void print_le_addr(const char *desc, const bt_addr_le_t *addr) } #endif /* CONFIG_BT_CONN || (CONFIG_BT_BROADCASTER && CONFIG_BT_EXT_ADV) */ -#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) -static const char *tx_power_flag2str(int8_t flag) -{ - switch (flag) { - case 0: - return "Neither Max nor Min Tx Power"; - case 1: - return "Tx Power Level is at minimum"; - case 2: - return "Tx Power Level is at maximum"; - /* Current Tx Power Level is the only available one*/ - case 3: - return "Tx Power Level is at minimum & maximum."; - default: - return "Unknown"; - } -} - -static const char *tx_power_report_reason2str(uint8_t reason) -{ - switch (reason) { - case BT_HCI_LE_TX_POWER_REPORT_REASON_LOCAL_CHANGED: - return "Local Tx Power changed"; - case BT_HCI_LE_TX_POWER_REPORT_REASON_REMOTE_CHANGED: - return "Remote Tx Power changed"; - case BT_HCI_LE_TX_POWER_REPORT_REASON_READ_REMOTE_COMPLETED: - return "Completed to read remote Tx Power"; - default: - return "Unknown"; - } -} - -static const char *tx_pwr_ctrl_phy2str(enum bt_conn_le_tx_power_phy phy) -{ - switch (phy) { - case BT_CONN_LE_TX_POWER_PHY_NONE: - return "None"; - case BT_CONN_LE_TX_POWER_PHY_1M: - return "LE 1M"; - case BT_CONN_LE_TX_POWER_PHY_2M: - return "LE 2M"; - case BT_CONN_LE_TX_POWER_PHY_CODED_S8: - return "LE Coded S8"; - case BT_CONN_LE_TX_POWER_PHY_CODED_S2: - return "LE Coded S2"; - default: - return "Unknown"; - } -} - -static const char *enabled2str(bool enabled) -{ - if (enabled) { - return "Enabled"; - } else { - return "Disabled"; - } -} - -#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ - #if defined(CONFIG_BT_CENTRAL) static int cmd_scan_off(const struct shell *sh); static int cmd_connect_le(const struct shell *sh, size_t argc, char *argv[]); @@ -932,19 +871,6 @@ void le_phy_updated(struct bt_conn *conn, } #endif -#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) -void tx_power_report(struct bt_conn *conn, - const struct bt_conn_le_tx_power_report *report) -{ - shell_print(ctx_shell, "Tx Power Report: Reason: %s, PHY: %s, Tx Power Level: %d", - tx_power_report_reason2str(report->reason), tx_pwr_ctrl_phy2str(report->phy), - report->tx_power_level); - shell_print(ctx_shell, "Tx Power Level Flag Info: %s, Delta: %d", - tx_power_flag2str(report->tx_power_level_flag), report->delta); -} -#endif - - static struct bt_conn_cb conn_callbacks = { .connected = connected, .disconnected = disconnected, @@ -965,9 +891,6 @@ static struct bt_conn_cb conn_callbacks = { #if defined(CONFIG_BT_USER_PHY_UPDATE) .le_phy_updated = le_phy_updated, #endif -#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) - .tx_power_report = tx_power_report, -#endif }; #endif /* CONFIG_BT_CONN */ @@ -2747,102 +2670,6 @@ static int cmd_per_adv_set_info_transfer(const struct shell *sh, size_t argc, } #endif /* CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER && CONFIG_BT_PER_ADV */ -#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) -static int cmd_read_remote_tx_power(const struct shell *sh, size_t argc, char *argv[]) -{ - if (argc < 3) { - int err = 0; - enum bt_conn_le_tx_power_phy phy = strtoul(argv[1], NULL, 16); - - err = bt_conn_le_get_remote_tx_power_level(default_conn, phy); - - if (!err) { - shell_print(sh, "Read Remote TX Power for PHY %s", - tx_pwr_ctrl_phy2str(phy)); - } else { - shell_print(sh, "error %d", err); - } - } else { - shell_help(sh); - return SHELL_CMD_HELP_PRINTED; - } - return 0; -} - -static int cmd_read_local_tx_power(const struct shell *sh, size_t argc, char *argv[]) -{ - int err = 0; - - if (argc < 3) { - struct bt_conn_le_tx_power tx_power_level; - - tx_power_level.phy = strtoul(argv[1], NULL, 16); - - int8_t unachievable_current_level = -100; - /* Arbitrary, these are output parameters.*/ - tx_power_level.current_level = unachievable_current_level; - tx_power_level.max_level = 6; - - if (default_conn == NULL) { - shell_error(sh, "Conn handle error, at least one connection is required."); - return -ENOEXEC; - } - err = bt_conn_le_get_tx_power_level(default_conn, &tx_power_level); - if (err) { - shell_print(sh, "Commad returned error error %d", err); - return err; - } - if (tx_power_level.current_level == unachievable_current_level) { - shell_print(sh, "We received no current tx power level."); - return -EIO; - } - shell_print(sh, "Read local TX Power: current level: %d, PHY: %s, Max Level: %d", - tx_power_level.current_level, - tx_pwr_ctrl_phy2str((enum bt_conn_le_tx_power_phy)tx_power_level.phy), - tx_power_level.max_level); - } else { - shell_help(sh); - return SHELL_CMD_HELP_PRINTED; - } - - return err; -} - -static int cmd_set_power_report_enable(const struct shell *sh, size_t argc, char *argv[]) -{ - if (argc < 4) { - int err = 0; - bool local_enable = 0; - bool remote_enable = 0; - - if (*argv[1] == '1') { - local_enable = 1; - } - if (*argv[2] == '1') { - remote_enable = 1; - } - if (default_conn == NULL) { - shell_error(sh, "Conn handle error, at least one connection is required."); - return -ENOEXEC; - } - err = bt_conn_le_set_tx_power_report_enable(default_conn, local_enable, - remote_enable); - if (!err) { - shell_print(sh, "Tx Power Report: local: %s, remote: %s", - enabled2str(local_enable), enabled2str(remote_enable)); - } else { - shell_print(sh, "error %d", err); - } - } else { - shell_help(sh); - return SHELL_CMD_HELP_PRINTED; - } - return 0; -} - -#endif - - #if defined(CONFIG_BT_CONN) #if defined(CONFIG_BT_CENTRAL) static int cmd_connect_le(const struct shell *sh, size_t argc, char *argv[]) @@ -4524,11 +4351,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, cmd_default_handler), SHELL_CMD_ARG(scan-verbose-output, NULL, "", cmd_scan_verbose_output, 2, 0), #endif /* CONFIG_BT_OBSERVER */ -#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) - SHELL_CMD_ARG(read-remote-tx-power, NULL, HELP_NONE, cmd_read_remote_tx_power, 2, 0), - SHELL_CMD_ARG(read-local-tx-power, NULL, HELP_NONE, cmd_read_local_tx_power, 2, 0), - SHELL_CMD_ARG(set-power-report-enable, NULL, HELP_NONE, cmd_set_power_report_enable, 3, 0), -#endif #if defined(CONFIG_BT_BROADCASTER) SHELL_CMD_ARG(advertise, NULL, " [mode: discov, non_discov] " From 83f4734c66a732a09512774bbdd94b43924365fb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:29 +0100 Subject: [PATCH 1369/2300] Revert "[nrf fromtree] Bluetooth: Host: Add LE Power Control Request Procedure APIs" This reverts commit 69d1ee3676de575f7d8356185bdff0204a53ec46. Signed-off-by: Robert Lubos --- include/zephyr/bluetooth/conn.h | 87 --------------------- include/zephyr/bluetooth/hci_types.h | 49 ------------ subsys/bluetooth/Kconfig | 8 -- subsys/bluetooth/host/conn.c | 108 +------------------------- subsys/bluetooth/host/conn_internal.h | 3 - subsys/bluetooth/host/hci_core.c | 34 -------- 6 files changed, 4 insertions(+), 285 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index bdc644d82e9..09b8321d685 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -479,42 +479,6 @@ struct bt_conn_le_tx_power { int8_t max_level; }; - -/** LE Transmit Power Reporting Structure */ -struct bt_conn_le_tx_power_report { - - /** Reason for Transmit power reporting, - * as documented in Core Spec. Version 5.4 Vol. 4, Part E, 7.7.65.33. - */ - uint8_t reason; - - /** Phy of Transmit power reporting. */ - enum bt_conn_le_tx_power_phy phy; - - /** Transmit power level - * - 0xXX - Transmit power level - * + Range: -127 to 20 - * + Units: dBm - * - * - 0x7E - Remote device is not managing power levels on this PHY. - * - 0x7F - Transmit power level is not available - */ - int8_t tx_power_level; - - /** Bit 0: Transmit power level is at minimum level. - * Bit 1: Transmit power level is at maximum level. - */ - uint8_t tx_power_level_flag; - - /** Change in transmit power level - * - 0xXX - Change in transmit power level (positive indicates increased - * power, negative indicates decreased power, zero indicates unchanged) - * Units: dB - * - 0x7F - Change is not available or is out of range. - */ - int8_t delta; -}; - /** @brief Passkey Keypress Notification type * * The numeric values are the same as in the Core specification for Pairing @@ -566,41 +530,6 @@ int bt_conn_get_remote_info(struct bt_conn *conn, int bt_conn_le_get_tx_power_level(struct bt_conn *conn, struct bt_conn_le_tx_power *tx_power_level); -/** @brief Get local enhanced connection transmit power level. - * - * @param conn Connection object. - * @param tx_power Transmit power level descriptor. - * - * @return Zero on success or (negative) error code on failure. - * @retval -ENOBUFS HCI command buffer is not available. - */ -int bt_conn_le_enhanced_get_tx_power_level(struct bt_conn *conn, - struct bt_conn_le_tx_power *tx_power); - -/** @brief Get remote (peer) transmit power level. - * - * @param conn Connection object. - * @param phy PHY information. - * - * @return Zero on success or (negative) error code on failure. - * @retval -ENOBUFS HCI command buffer is not available. - */ -int bt_conn_le_get_remote_tx_power_level(struct bt_conn *conn, - enum bt_conn_le_tx_power_phy phy); - -/** @brief Enable transmit power reporting. - * - * @param conn Connection object. - * @param local_enable Enable/disable reporting for local. - * @param remote_enable Enable/disable reporting for remote. - * - * @return Zero on success or (negative) error code on failure. - * @retval -ENOBUFS HCI command buffer is not available. - */ -int bt_conn_le_set_tx_power_report_enable(struct bt_conn *conn, - bool local_enable, - bool remote_enable); - /** @brief Update the connection parameters. * * If the local device is in the peripheral role then updating the connection @@ -1123,22 +1052,6 @@ struct bt_conn_cb { const struct bt_df_conn_iq_samples_report *iq_report); #endif /* CONFIG_BT_DF_CONNECTION_CTE_RX */ -#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) - /** @brief LE Read Remote Transmit Power Level procedure has completed or LE - * Transmit Power Reporting event. - * - * This callback notifies the application that either the remote transmit power level - * has been read from the peer or transmit power level has changed for the local or - * remote controller when transmit power reporting is enabled for the respective side - * using @ref bt_conn_le_set_tx_power_report_enable. - * - * @param conn Connection object. - * @param report Transmit power report. - */ - void (*tx_power_report)(struct bt_conn *conn, - const struct bt_conn_le_tx_power_report *report); -#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ - struct bt_conn_cb *_next; }; diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index f1cb92f372c..4d637bbe4e2 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -571,35 +571,6 @@ struct bt_hci_rp_read_tx_power_level { int8_t tx_power_level; } __packed; -#define BT_HCI_LE_TX_POWER_PHY_1M 0x01 -#define BT_HCI_LE_TX_POWER_PHY_2M 0x02 -#define BT_HCI_LE_TX_POWER_PHY_CODED_S8 0x03 -#define BT_HCI_LE_TX_POWER_PHY_CODED_S2 0x04 -#define BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL BT_OP(BT_OGF_LE, 0x0076) -struct bt_hci_cp_le_read_tx_power_level { - uint16_t handle; - uint8_t phy; -} __packed; - -struct bt_hci_rp_le_read_tx_power_level { - uint8_t status; - uint16_t handle; - uint8_t phy; - int8_t current_tx_power_level; - int8_t max_tx_power_level; -} __packed; - -#define BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL BT_OP(BT_OGF_LE, 0x0077) - -#define BT_HCI_LE_TX_POWER_REPORT_DISABLE 0x00 -#define BT_HCI_LE_TX_POWER_REPORT_ENABLE 0x01 -#define BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE BT_OP(BT_OGF_LE, 0x007A) -struct bt_hci_cp_le_set_tx_power_report_enable { - uint16_t handle; - uint8_t local_enable; - uint8_t remote_enable; -} __packed; - #define BT_HCI_CTL_TO_HOST_FLOW_DISABLE 0x00 #define BT_HCI_CTL_TO_HOST_FLOW_ENABLE 0x01 #define BT_HCI_OP_SET_CTL_TO_HOST_FLOW BT_OP(BT_OGF_BASEBAND, 0x0031) @@ -2934,26 +2905,6 @@ struct bt_hci_evt_le_req_peer_sca_complete { uint8_t sca; } __packed; -/** Reason for Transmit power reporting. - */ -/* Local Transmit power changed. */ -#define BT_HCI_LE_TX_POWER_REPORT_REASON_LOCAL_CHANGED 0x00 -/* Remote Transmit power changed. */ -#define BT_HCI_LE_TX_POWER_REPORT_REASON_REMOTE_CHANGED 0x01 -/* HCI_LE_Read_Remote_Transmit_Power_Level command completed. */ -#define BT_HCI_LE_TX_POWER_REPORT_REASON_READ_REMOTE_COMPLETED 0x02 - -#define BT_HCI_EVT_LE_TRANSMIT_POWER_REPORT 0x21 -struct bt_hci_evt_le_transmit_power_report { - uint8_t status; - uint16_t handle; - uint8_t reason; - uint8_t phy; - int8_t tx_power_level; - uint8_t tx_power_level_flag; - int8_t delta; -} __packed; - #define BT_HCI_EVT_LE_BIGINFO_ADV_REPORT 0x22 struct bt_hci_evt_le_biginfo_adv_report { uint16_t sync_handle; diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 912846e4cda..e02901cd906 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -175,14 +175,6 @@ config BT_SCA_UPDATE depends on !BT_CTLR || BT_CTLR_SCA_UPDATE_SUPPORT help Enable support for Bluetooth 5.1 Sleep Clock Accuracy Update Procedure - -config BT_TRANSMIT_POWER_CONTROL - bool "LE Power Control" - depends on !BT_CTLR || BT_CTLR_LE_POWER_CONTROL_SUPPORT - help - Enable support for LE Power Control Request feature that is defined in the - Bluetooth Core specification, Version 5.4 | Vol 6, Part B, Section 4.6.31. - endif # BT_CONN rsource "Kconfig.iso" diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 06a3e7553a2..1fd2f5fbc49 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -2619,116 +2619,16 @@ static int bt_conn_get_tx_power_level(struct bt_conn *conn, uint8_t type, return 0; } -#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) -void notify_tx_power_report(struct bt_conn *conn, - struct bt_conn_le_tx_power_report report) -{ - for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) { - if (cb->tx_power_report) { - cb->tx_power_report(conn, &report); - } - } - - STRUCT_SECTION_FOREACH(bt_conn_cb, cb) - { - if (cb->tx_power_report) { - cb->tx_power_report(conn, &report); - } - } -} - -int bt_conn_le_enhanced_get_tx_power_level(struct bt_conn *conn, - struct bt_conn_le_tx_power *tx_power) -{ - int err; - struct bt_hci_rp_le_read_tx_power_level *rp; - struct net_buf *rsp; - struct bt_hci_cp_le_read_tx_power_level *cp; - struct net_buf *buf; - - if (!tx_power->phy) { - return -EINVAL; - } - - buf = bt_hci_cmd_create(BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL, sizeof(*cp)); - if (!buf) { - return -ENOBUFS; - } - - cp = net_buf_add(buf, sizeof(*cp)); - cp->handle = sys_cpu_to_le16(conn->handle); - cp->phy = tx_power->phy; - - err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_ENH_READ_TX_POWER_LEVEL, buf, &rsp); - if (err) { - return err; - } - - rp = (void *) rsp->data; - tx_power->phy = rp->phy; - tx_power->current_level = rp->current_tx_power_level; - tx_power->max_level = rp->max_tx_power_level; - net_buf_unref(rsp); - - return 0; -} - -int bt_conn_le_get_remote_tx_power_level(struct bt_conn *conn, - enum bt_conn_le_tx_power_phy phy) -{ - struct bt_hci_cp_le_read_tx_power_level *cp; - struct net_buf *buf; - - if (!phy) { - return -EINVAL; - } - - buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL, sizeof(*cp)); - if (!buf) { - return -ENOBUFS; - } - - cp = net_buf_add(buf, sizeof(*cp)); - cp->handle = sys_cpu_to_le16(conn->handle); - cp->phy = phy; - - return bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_REMOTE_TX_POWER_LEVEL, buf, NULL); -} - -int bt_conn_le_set_tx_power_report_enable(struct bt_conn *conn, - bool local_enable, - bool remote_enable) -{ - struct bt_hci_cp_le_set_tx_power_report_enable *cp; - struct net_buf *buf; - - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE, sizeof(*cp)); - if (!buf) { - return -ENOBUFS; - } - - cp = net_buf_add(buf, sizeof(*cp)); - cp->handle = sys_cpu_to_le16(conn->handle); - cp->local_enable = local_enable ? BT_HCI_LE_TX_POWER_REPORT_ENABLE : - BT_HCI_LE_TX_POWER_REPORT_DISABLE; - cp->remote_enable = remote_enable ? BT_HCI_LE_TX_POWER_REPORT_ENABLE : - BT_HCI_LE_TX_POWER_REPORT_DISABLE; - - return bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_TX_POWER_REPORT_ENABLE, buf, NULL); -} -#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ - int bt_conn_le_get_tx_power_level(struct bt_conn *conn, struct bt_conn_le_tx_power *tx_power_level) { int err; if (tx_power_level->phy != 0) { - if (IS_ENABLED(CONFIG_BT_TRANSMIT_POWER_CONTROL)) { - return bt_conn_le_enhanced_get_tx_power_level(conn, tx_power_level); - } else { - return -ENOTSUP; - } + /* Extend the implementation when LE Enhanced Read Transmit + * Power Level HCI command is available for use. + */ + return -ENOTSUP; } err = bt_conn_get_tx_power_level(conn, BT_TX_POWER_LEVEL_CURRENT, diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index a13adff704a..7741e259a61 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -364,9 +364,6 @@ void notify_le_phy_updated(struct bt_conn *conn); bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param); -void notify_tx_power_report(struct bt_conn *conn, - struct bt_conn_le_tx_power_report report); - #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/hci_core.c b/subsys/bluetooth/host/hci_core.c index b37cd45e1ae..de4fb637b49 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -2399,33 +2399,6 @@ int bt_hci_register_vnd_evt_cb(bt_hci_vnd_evt_cb_t cb) } #endif /* CONFIG_BT_HCI_VS_EVT_USER */ -#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) -void bt_hci_le_transmit_power_report(struct net_buf *buf) -{ - struct bt_hci_evt_le_transmit_power_report *evt; - struct bt_conn_le_tx_power_report report; - struct bt_conn *conn; - - evt = net_buf_pull_mem(buf, sizeof(*evt)); - conn = bt_conn_lookup_handle(sys_le16_to_cpu(evt->handle), BT_CONN_TYPE_LE); - if (!conn) { - LOG_ERR("Unknown conn handle 0x%04X for transmit power report", - sys_le16_to_cpu(evt->handle)); - return; - } - - report.reason = evt->reason; - report.phy = evt->phy; - report.tx_power_level = evt->tx_power_level; - report.tx_power_level_flag = evt->tx_power_level_flag; - report.delta = evt->delta; - - notify_tx_power_report(conn, report); - - bt_conn_unref(conn); -} -#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ - static const struct event_handler vs_events[] = { #if defined(CONFIG_BT_DF_VS_CL_IQ_REPORT_16_BITS_IQ_SAMPLES) EVENT_HANDLER(BT_HCI_EVT_VS_LE_CONNECTIONLESS_IQ_REPORT, @@ -2571,10 +2544,6 @@ static const struct event_handler meta_events[] = { EVENT_HANDLER(BT_HCI_EVT_LE_CTE_REQUEST_FAILED, bt_hci_le_df_cte_req_failed, sizeof(struct bt_hci_evt_le_cte_req_failed)), #endif /* CONFIG_BT_DF_CONNECTION_CTE_REQ */ -#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL) - EVENT_HANDLER(BT_HCI_EVT_LE_TRANSMIT_POWER_REPORT, bt_hci_le_transmit_power_report, - sizeof(struct bt_hci_evt_le_transmit_power_report)), -#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */ #if defined(CONFIG_BT_PER_ADV_SYNC_RSP) EVENT_HANDLER(BT_HCI_EVT_LE_PER_ADVERTISING_REPORT_V2, bt_hci_le_per_adv_report_v2, sizeof(struct bt_hci_evt_le_per_advertising_report_v2)), @@ -3120,9 +3089,6 @@ static int le_set_event_mask(void) BT_FEAT_LE_PHY_CODED(bt_dev.le.features))) { mask |= BT_EVT_MASK_LE_PHY_UPDATE_COMPLETE; } - if (IS_ENABLED(CONFIG_BT_TRANSMIT_POWER_CONTROL)) { - mask |= BT_EVT_MASK_LE_TRANSMIT_POWER_REPORTING; - } } if (IS_ENABLED(CONFIG_BT_SMP) && From daed0911b5e0cfe49cb5a1b15b516aff77920082 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:29 +0100 Subject: [PATCH 1370/2300] Revert "[nrf fromtree] Bluetooth: Controller: Add Kconfig for LE Power Control Request Feature" This reverts commit c187d31c1d999fa091b4da55b7a7696cb0d8cbbe. Signed-off-by: Robert Lubos --- subsys/bluetooth/controller/Kconfig | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 91f4f08c15c..3bec6b624f6 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -101,9 +101,6 @@ config BT_CTLR_READ_ISO_LINK_QUALITY_SUPPORT BT_CTLR_PERIPHERAL_ISO_SUPPORT bool -config BT_CTLR_LE_POWER_CONTROL_SUPPORT - bool - config BT_CTLR bool "Bluetooth Controller" help @@ -488,14 +485,6 @@ config BT_CTLR_CONN_RSSI help Enable connection RSSI measurement. -config BT_CTLR_LE_POWER_CONTROL - bool "LE Power Control Request Feature" - depends on BT_CTLR_LE_POWER_CONTROL_SUPPORT - default y if BT_TRANSMIT_POWER_CONTROL - help - Enable support for LE Power Control Request feature that is defined in the - Bluetooth Core specification, Version 5.4 | Vol 6, Part B, Section 4.6.31. - endif # BT_CONN config BT_CTLR_FILTER_ACCEPT_LIST From 5fc568680ed76e96c8c8674704e4e1a4617bcb49 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 21 Mar 2024 11:28:30 +0100 Subject: [PATCH 1371/2300] Revert "[nrf fromlist] cmake: Add support for sysbuild-set signing script" This reverts commit e902349fefd0176e40e46c47c1239fd7e7c997dc. Signed-off-by: Robert Lubos --- CMakeLists.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97bcd98d0d7..164d82fde0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1806,15 +1806,8 @@ endif() # Generate and use MCUboot related artifacts as needed. if(CONFIG_BOOTLOADER_MCUBOOT) get_target_property(signing_script zephyr_property_target SIGNING_SCRIPT) - if(NOT signing_script) - zephyr_get(signing_script VAR SIGNING_SCRIPT SYSBUILD) - - if(signing_script) - set_target_properties(zephyr_property_target PROPERTIES SIGNING_SCRIPT ${signing_script}) - else() - set_target_properties(zephyr_property_target PROPERTIES SIGNING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/cmake/mcuboot.cmake) - endif() + set_target_properties(zephyr_property_target PROPERTIES SIGNING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/cmake/mcuboot.cmake) endif() endif() From 45209857cb06da35772e88e66e6ca38cf7a05cbe Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 07:24:26 +0200 Subject: [PATCH 1372/2300] [nrf fromlist] drivers: modem_cellular: allow variable length chat delimiter and filter Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68981 To allow for differences between modems. Signed-off-by: Tomi Fontanilles (cherry picked from commit b6577fd6ff96da8853a5b193a31801e996ff143c) (cherry picked from commit 4974702e2bcc03fd5a938b12d5bad628b4ab95b5) Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index f5e099cd08c..35b05602a74 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -96,8 +96,8 @@ struct modem_cellular_data { /* Modem chat */ struct modem_chat chat; uint8_t chat_receive_buf[128]; - uint8_t chat_delimiter[1]; - uint8_t chat_filter[1]; + uint8_t *chat_delimiter; + uint8_t *chat_filter; uint8_t *chat_argv[32]; /* Status */ @@ -424,9 +424,9 @@ MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); MODEM_CHAT_MATCH_DEFINE(cesq_match, "+CESQ: ", ",", modem_cellular_chat_on_cesq); -MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); -MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); -MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); +MODEM_CHAT_MATCH_DEFINE(cimi_match __maybe_unused, "", "", modem_cellular_chat_on_imsi); +MODEM_CHAT_MATCH_DEFINE(cgmi_match __maybe_unused, "", "", modem_cellular_chat_on_cgmi); +MODEM_CHAT_MATCH_DEFINE(cgmr_match __maybe_unused, "", "", modem_cellular_chat_on_cgmr); MODEM_CHAT_MATCHES_DEFINE(unsol_matches, MODEM_CHAT_MATCH("+CREG: ", ",", modem_cellular_chat_on_cxreg), @@ -1513,9 +1513,9 @@ static int modem_cellular_init(const struct device *dev) .receive_buf = data->chat_receive_buf, .receive_buf_size = ARRAY_SIZE(data->chat_receive_buf), .delimiter = data->chat_delimiter, - .delimiter_size = ARRAY_SIZE(data->chat_delimiter), + .delimiter_size = strlen(data->chat_delimiter), .filter = data->chat_filter, - .filter_size = ARRAY_SIZE(data->chat_filter), + .filter_size = strlen(data->chat_filter), .argv = data->chat_argv, .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, @@ -1939,8 +1939,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -1968,8 +1968,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -1997,8 +1997,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2026,8 +2026,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2055,8 +2055,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2084,8 +2084,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2114,8 +2114,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2143,8 +2143,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = {'\r'}, \ - .chat_filter = {'\n'}, \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ From e17559225295a1803af8a7c265c48b75128aae3d Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 08:12:34 +0200 Subject: [PATCH 1373/2300] [nrf fromlist] drivers: modem_cellular: make the buffer sizes configurable Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68981 To allow fine tuning and accommodate modem differences. Signed-off-by: Tomi Fontanilles (cherry picked from commit 6b2f8b1939e1028c5bf808901709429ca4d10361) (cherry picked from commit d2822f2f951966ef9042935ec75b094df853e6b6) Signed-off-by: Robert Lubos --- drivers/modem/Kconfig.cellular | 14 ++++++++++++++ drivers/modem/modem_cellular.c | 15 ++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 0460cda8d96..599a8a61138 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -36,4 +36,18 @@ config MODEM_CELLULAR_PERIODIC_SCRIPT_MS int "Periodic script interval in milliseconds" default 2000 +config MODEM_CELLULAR_UART_BUFFER_SIZES + int "The UART receive and transmit buffer sizes in bytes." + default 512 + +config MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE + int "The maximum CMUX frame size in bytes." + default 128 + help + This value affects the size of buffers used to receive and transmit CMUX frames. + +config MODEM_CELLULAR_CHAT_BUFFER_SIZES + int "The size of the buffers used for the chat scripts in bytes." + default 128 + endif diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 35b05602a74..63430d45c1a 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -79,23 +79,24 @@ struct modem_cellular_data { /* UART backend */ struct modem_pipe *uart_pipe; struct modem_backend_uart uart_backend; - uint8_t uart_backend_receive_buf[512]; - uint8_t uart_backend_transmit_buf[512]; + uint8_t uart_backend_receive_buf[CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES]; + uint8_t uart_backend_transmit_buf[CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES]; /* CMUX */ struct modem_cmux cmux; - uint8_t cmux_receive_buf[128]; - uint8_t cmux_transmit_buf[256]; + uint8_t cmux_receive_buf[CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; + uint8_t cmux_transmit_buf[2 * CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; struct modem_cmux_dlci dlci1; struct modem_cmux_dlci dlci2; struct modem_pipe *dlci1_pipe; struct modem_pipe *dlci2_pipe; - uint8_t dlci1_receive_buf[128]; - uint8_t dlci2_receive_buf[256]; + uint8_t dlci1_receive_buf[CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; + /* DLCI 2 is only used for chat scripts. */ + uint8_t dlci2_receive_buf[CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES]; /* Modem chat */ struct modem_chat chat; - uint8_t chat_receive_buf[128]; + uint8_t chat_receive_buf[CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES]; uint8_t *chat_delimiter; uint8_t *chat_filter; uint8_t *chat_argv[32]; From a1f3dbbb5fd7e01c00a777076eb1de5c7d46dbf1 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 14 Feb 2024 10:27:55 +0200 Subject: [PATCH 1374/2300] [nrf fromlist] drivers: modem_cellular: add nRF91 series (w/ SLM) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68981 The nRF91 series devices, when running the Serial LTE Modem (SLM) application starting with nRF Connect SDK 2.6.0, can now be used as standalone modems via the generic modem_cellular driver. A configuration to run the cellular_modem sample on the nRF9160 DK (plugged in to another nRF91 series device running SLM) is provided. Signed-off-by: Tomi Fontanilles (cherry picked from commit f41b357a25cc302f9c2bcd37fb7976306f04f027) (cherry picked from commit 5d4b1d296970c3bd05f84a4586a74b0a7f679382) Signed-off-by: Robert Lubos --- drivers/modem/Kconfig.cellular | 3 +- drivers/modem/modem_cellular.c | 67 +++++++++++++++++++ dts/bindings/modem/nordic,nrf91-slm.yaml | 9 +++ .../boards/nrf9160dk_nrf9160_ns.conf | 16 +++++ .../boards/nrf9160dk_nrf9160_ns.overlay | 34 ++++++++++ tests/drivers/build_all/modem/uart.dtsi | 6 ++ 6 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 dts/bindings/modem/nordic,nrf91-slm.yaml create mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf create mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 599a8a61138..aacf4449d28 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -15,7 +15,8 @@ config MODEM_CELLULAR depends on (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ DT_HAS_U_BLOX_SARA_R5_ENABLED || DT_HAS_SWIR_HL7800_ENABLED || \ - DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED) + DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED || \ + DT_HAS_NORDIC_NRF91_SLM_ENABLED) help This driver uses the generic 3gpp AT commands, along with the standard protocols CMUX and PPP, to configure diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 63430d45c1a..ed4e998fec3 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1933,6 +1933,41 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, modem_cellular_chat_callback_handler, 4); #endif +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf91_slm) +MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_init_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP_MULT("AT", allow_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), + MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT#XCMUX=1", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_init_chat_script, nordic_nrf91_slm_init_chat_script_cmds, + abort_matches, modem_cellular_chat_callback_handler, 10); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_dial_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=1", ok_match), + MODEM_CHAT_SCRIPT_CMD_RESP("AT#XCMUX=2", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_dial_chat_script, nordic_nrf91_slm_dial_chat_script_cmds, + dial_abort_matches, modem_cellular_chat_callback_handler, 10); + +MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_periodic_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, + nordic_nrf91_slm_periodic_chat_script_cmds, abort_matches, + modem_cellular_chat_callback_handler, 4); +#endif + #define MODEM_CELLULAR_INST_NAME(name, inst) \ _CONCAT(_CONCAT(_CONCAT(name, _), DT_DRV_COMPAT), inst) @@ -2169,6 +2204,34 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ &modem_cellular_api); +#define MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM(inst) \ + MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 1500); \ + \ + static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ + .chat_delimiter = "\r\n", \ + .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ + }; \ + \ + static struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \ + .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ + .power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \ + .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_reset_gpios, {}), \ + .power_pulse_duration_ms = 100, \ + .reset_pulse_duration_ms = 100, \ + .startup_time_ms = 2000, \ + .shutdown_time_ms = 3000, \ + .init_chat_script = &nordic_nrf91_slm_init_chat_script, \ + .dial_chat_script = &nordic_nrf91_slm_dial_chat_script, \ + .periodic_chat_script = &nordic_nrf91_slm_periodic_chat_script, \ + }; \ + \ + PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ + \ + DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ + &MODEM_CELLULAR_INST_NAME(data, inst), \ + &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ + &modem_cellular_api); + #define DT_DRV_COMPAT quectel_bg95 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_QUECTEL_BG95) #undef DT_DRV_COMPAT @@ -2200,3 +2263,7 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #define DT_DRV_COMPAT telit_me910g1 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) #undef DT_DRV_COMPAT + +#define DT_DRV_COMPAT nordic_nrf91_slm +DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM) +#undef DT_DRV_COMPAT diff --git a/dts/bindings/modem/nordic,nrf91-slm.yaml b/dts/bindings/modem/nordic,nrf91-slm.yaml new file mode 100644 index 00000000000..3f06696197d --- /dev/null +++ b/dts/bindings/modem/nordic,nrf91-slm.yaml @@ -0,0 +1,9 @@ +description: Nordic nRF91 series running the Serial LTE Modem application + +compatible: "nordic,nrf91-slm" + +include: uart-device.yaml + +properties: + mdm-power-gpios: + type: phandle-array diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf new file mode 100644 index 00000000000..441a5395ca1 --- /dev/null +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf @@ -0,0 +1,16 @@ +CONFIG_UART_ASYNC_API=y + +# Align with the Serial LTE Modem (SLM) application. +CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE=1500 +CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=1500 + +# Allow large UART TXs to go through @115200. +CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS=200 + +# Prevent sockets getting offloaded to the modem. +CONFIG_NET_SOCKETS_OFFLOAD=n + +# Print logs and printk() output on uart0. +CONFIG_LOG=y +CONFIG_LOG_BACKEND_UART=y +CONFIG_MODEM_LOG_LEVEL_DBG=y diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay new file mode 100644 index 00000000000..44ce80601a1 --- /dev/null +++ b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay @@ -0,0 +1,34 @@ +/ { + aliases { + modem = &modem; + }; +}; + +&uart1 { + compatible = "nordic,nrf-uarte"; + current-speed = <115200>; + hw-flow-control; + status = "okay"; + + pinctrl-0 = <&uart1_default_alt>; + + modem: modem { + compatible = "nordic,nrf91-slm"; + status = "okay"; + mdm-power-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + }; +}; + +&pinctrl { + uart1_default_alt: uart1_default_alt { + group1 { + psels = ; + bias-pull-up; + }; + group2 { + psels = , + , + ; + }; + }; +}; diff --git a/tests/drivers/build_all/modem/uart.dtsi b/tests/drivers/build_all/modem/uart.dtsi index 3d649a2ff60..08da2c325d3 100644 --- a/tests/drivers/build_all/modem/uart.dtsi +++ b/tests/drivers/build_all/modem/uart.dtsi @@ -70,3 +70,9 @@ test_telit_me910g1: telit_me910g1 { test_esp_at: esp_at { compatible = "espressif,esp-at"; }; + +test_nordic_nrf91_slm: nordic_nrf91_slm { + compatible = "nordic,nrf91-slm"; + + mdm-power-gpios = <&test_gpio 0 0>; +}; From eab783c7d645bee60606def787caad29d0d01f5f Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 21 Feb 2024 13:27:31 +0200 Subject: [PATCH 1375/2300] [nrf fromlist] drivers: modem_cellular: fine tune nRF91's shutdown_time Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69288 A shutdown lasting more than 5 seconds was experienced. Signed-off-by: Tomi Fontanilles (cherry picked from commit f7718c38852467bb30095015c92222ddaddd57d5) (cherry picked from commit 4c36459d673f2d4bda0dc7a031862dae947aacd0) Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index ed4e998fec3..276c9d38f7b 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -2219,7 +2219,7 @@ MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, .power_pulse_duration_ms = 100, \ .reset_pulse_duration_ms = 100, \ .startup_time_ms = 2000, \ - .shutdown_time_ms = 3000, \ + .shutdown_time_ms = 10000, \ .init_chat_script = &nordic_nrf91_slm_init_chat_script, \ .dial_chat_script = &nordic_nrf91_slm_dial_chat_script, \ .periodic_chat_script = &nordic_nrf91_slm_periodic_chat_script, \ From a7007991bf72bcd5051dd4aff8028b271a4af4b8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:33:24 +0100 Subject: [PATCH 1376/2300] [nrf fromlist] drivers: misc: nordic_vpr_launcher: initialize earlier Set driver to initialize at early POST_KERNEL, so that we make sure other future dependencies priorities (eg VEVIF) do not conflict. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 3e8ea343878acabdf163d1a084cef61f8e077ed5) (cherry picked from commit 851de7e087d0aae184299f46f0f128e95dc16ec6) (cherry picked from commit 1bcad2f40ec7094f379848f45ac7e1810193f1ca) Signed-off-by: Robert Lubos --- drivers/misc/nordic_vpr_launcher/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/nordic_vpr_launcher/Kconfig b/drivers/misc/nordic_vpr_launcher/Kconfig index 57605e505f2..6aeabcd251c 100644 --- a/drivers/misc/nordic_vpr_launcher/Kconfig +++ b/drivers/misc/nordic_vpr_launcher/Kconfig @@ -17,7 +17,7 @@ source "subsys/logging/Kconfig.template.log_config" config NORDIC_VPR_LAUNCHER_INIT_PRIORITY int "Nordic VPR coprocessor launcher init priority" - default KERNEL_INIT_PRIORITY_DEVICE + default 0 help The init priority of the VPR coprocessor launcher. From 5e63290f335d41ccc4ead98d18a6ebd689d707dd Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:42:14 +0100 Subject: [PATCH 1377/2300] [nrf fromlist] samples: drivers: mbox: allow to configure RX/TX channels By adding Kconfig options for both samples. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 253593c966f339e7aebbdbbbb8126963f3529ebe) (cherry picked from commit a1701713c22ad32b4345ee19e958f24d46e4e599) (cherry picked from commit 5529abcb2a92f4a7648001f0e846aca51e255381) Signed-off-by: Robert Lubos --- samples/drivers/mbox/Kconfig | 13 +++++++++++++ samples/drivers/mbox/remote/Kconfig | 17 +++++++++++++++++ samples/drivers/mbox/remote/src/main.c | 7 ++----- samples/drivers/mbox/src/main.c | 7 ++----- 4 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 samples/drivers/mbox/remote/Kconfig diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig index 3837c49b6e9..79dd2d09689 100644 --- a/samples/drivers/mbox/Kconfig +++ b/samples/drivers/mbox/Kconfig @@ -9,3 +9,16 @@ config INCLUDE_REMOTE_DIR help Include remote build header files. Can be used if primary image needs to be aware of size or base address of secondary image + +config TX_CHANNEL_ID + int "Channel ID for TX" + default 1 + help + Channel ID for TX + + +config RX_CHANNEL_ID + int "Channel ID for RX" + default 0 + help + Channel ID for RX diff --git a/samples/drivers/mbox/remote/Kconfig b/samples/drivers/mbox/remote/Kconfig new file mode 100644 index 00000000000..a8897e4aab0 --- /dev/null +++ b/samples/drivers/mbox/remote/Kconfig @@ -0,0 +1,17 @@ +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "Kconfig.zephyr" + +config TX_CHANNEL_ID + int "Channel ID for TX" + default 0 + help + Channel ID for TX + + +config RX_CHANNEL_ID + int "Channel ID for RX" + default 1 + help + Channel ID for RX diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index 89039e3b277..a256ed21daa 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -9,9 +9,6 @@ #include #include -#define TX_ID (0) -#define RX_ID (1) - static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { @@ -28,8 +25,8 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, TX_ID); - mbox_init_channel(&rx_channel, dev, RX_ID); + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); + mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index d6c79729b4f..bfe28443f95 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -9,9 +9,6 @@ #include #include -#define TX_ID (1) -#define RX_ID (0) - static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { @@ -28,8 +25,8 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, TX_ID); - mbox_init_channel(&rx_channel, dev, RX_ID); + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); + mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); From 7d399d06e46cf7594bfd17c86578b3f591220a2b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:48:59 +0100 Subject: [PATCH 1378/2300] [nrf fromlist] samples: drivers: mbox: allow to enable RX/TX This can be useful to provide multiple setups, eg unidirectional ping-pong. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 5cb43795d8082be70e4a18f90e66c50122f3c293) (cherry picked from commit 20f4571b37cf92b6558eb81551401fd5c6f97105) (cherry picked from commit e4189b3f9d2f1adc5abf801dca5f607b2a383abf) Signed-off-by: Robert Lubos --- samples/drivers/mbox/Kconfig | 13 +++++++++++++ samples/drivers/mbox/remote/Kconfig | 13 +++++++++++++ samples/drivers/mbox/remote/src/main.c | 20 +++++++++++++++++--- samples/drivers/mbox/src/main.c | 15 ++++++++++++--- 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig index 79dd2d09689..3af6e740bfc 100644 --- a/samples/drivers/mbox/Kconfig +++ b/samples/drivers/mbox/Kconfig @@ -10,15 +10,28 @@ config INCLUDE_REMOTE_DIR Include remote build header files. Can be used if primary image needs to be aware of size or base address of secondary image +config TX_ENABLED + bool "TX enabled" + default y + help + Enable TX + config TX_CHANNEL_ID int "Channel ID for TX" default 1 + depends on TX_ENABLED help Channel ID for TX +config RX_ENABLED + bool "RX enabled" + default y + help + Enable RX config RX_CHANNEL_ID int "Channel ID for RX" + depends on RX_ENABLED default 0 help Channel ID for RX diff --git a/samples/drivers/mbox/remote/Kconfig b/samples/drivers/mbox/remote/Kconfig index a8897e4aab0..7edb8574359 100644 --- a/samples/drivers/mbox/remote/Kconfig +++ b/samples/drivers/mbox/remote/Kconfig @@ -3,15 +3,28 @@ source "Kconfig.zephyr" +config TX_ENABLED + bool "TX enabled" + default y + help + Enable TX + config TX_CHANNEL_ID int "Channel ID for TX" default 0 + depends on TX_ENABLED help Channel ID for TX +config RX_ENABLED + bool "RX enabled" + default y + help + Enable RX config RX_CHANNEL_ID int "Channel ID for RX" + depends on RX_ENABLED default 1 help Channel ID for RX diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index a256ed21daa..31665951172 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -9,23 +9,29 @@ #include #include +#if !defined(CONFIG_RX_ENABLED) && !defined(CONFIG_TX_ENABLED) +#error "At least one of CONFIG_RX_ENABLED or CONFIG_TX_ENABLED must be set" +#endif + +#ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { printk("Pong (on channel %d)\n", channel); } +#endif /* CONFIG_RX_ENABLED */ int main(void) { - struct mbox_channel tx_channel; - struct mbox_channel rx_channel; const struct device *dev; printk("Hello from NET\n"); dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); +#ifdef CONFIG_RX_ENABLED + struct mbox_channel rx_channel; + mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { @@ -37,6 +43,12 @@ int main(void) printk("mbox_set_enable() error\n"); return 0; } +#endif /* CONFIG_RX_ENABLED */ + +#ifdef CONFIG_TX_ENABLED + struct mbox_channel tx_channel; + + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { @@ -49,5 +61,7 @@ int main(void) k_sleep(K_MSEC(3000)); } +#endif /* CONFIG_TX_ENABLED */ + return 0; } diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index bfe28443f95..cea34afb29a 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -9,23 +9,25 @@ #include #include +#ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { printk("Pong (on channel %d)\n", channel); } +#endif int main(void) { - struct mbox_channel tx_channel; - struct mbox_channel rx_channel; const struct device *dev; printk("Hello from APP\n"); dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); +#ifdef CONFIG_RX_ENABLED + struct mbox_channel rx_channel; + mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { @@ -37,6 +39,12 @@ int main(void) printk("mbox_set_enable() error\n"); return 0; } +#endif /* CONFIG_RX_ENABLED */ + +#ifdef CONFIG_TX_ENABLED + struct mbox_channel tx_channel; + + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { k_sleep(K_MSEC(2000)); @@ -48,5 +56,6 @@ int main(void) return 0; } } +#endif /* CONFIG_TX_ENABLED */ return 0; } From 737da5af682b26ce089f4043b7102f1103e8dbb1 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:59:22 +0100 Subject: [PATCH 1379/2300] [nrf fromlist] samples: drivers: mbox: misc cleanups/enhancements - Include cleanup - s/NET/REMOTE (remote core may have nothing to do with NET) - Improved error reporting Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit cf67d54ed49d896112a285044a12a28b7dfacff0) (cherry picked from commit 56cc531bd5ba1ea1f22e726f9cbd9b72247cc8fb) (cherry picked from commit fdd4cbee5e08c04c725340774831a4d14d03841d) Signed-off-by: Robert Lubos --- samples/drivers/mbox/remote/src/main.c | 26 +++++++++++++------------- samples/drivers/mbox/src/main.c | 23 ++++++++++++----------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index 31665951172..1ca832a697c 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -4,10 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include #include #include +#include #if !defined(CONFIG_RX_ENABLED) && !defined(CONFIG_TX_ENABLED) #error "At least one of CONFIG_RX_ENABLED or CONFIG_TX_ENABLED must be set" @@ -23,24 +22,25 @@ static void callback(const struct device *dev, uint32_t channel, int main(void) { - const struct device *dev; + int ret; + const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - printk("Hello from NET\n"); - - dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + printk("Hello from REMOTE\n"); #ifdef CONFIG_RX_ENABLED struct mbox_channel rx_channel; mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); - if (mbox_register_callback(&rx_channel, callback, NULL)) { - printk("mbox_register_callback() error\n"); + ret = mbox_register_callback(&rx_channel, callback, NULL); + if (ret < 0) { + printk("Could not register callback (%d)\n", ret); return 0; } - if (mbox_set_enabled(&rx_channel, 1)) { - printk("mbox_set_enable() error\n"); + ret = mbox_set_enabled(&rx_channel, true); + if (ret < 0) { + printk("Could not enable RX channel %d (%d)\n", rx_channel.id, ret); return 0; } #endif /* CONFIG_RX_ENABLED */ @@ -51,11 +51,11 @@ int main(void) mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { - printk("Ping (on channel %d)\n", tx_channel.id); - if (mbox_send(&tx_channel, NULL) < 0) { - printk("mbox_send() error\n"); + ret = mbox_send(&tx_channel, NULL); + if (ret < 0) { + printk("Could not send (%d)\n", ret); return 0; } diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index cea34afb29a..d4dd21d342f 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -4,10 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include #include #include +#include #ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, @@ -19,24 +18,25 @@ static void callback(const struct device *dev, uint32_t channel, int main(void) { - const struct device *dev; + int ret; + const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); printk("Hello from APP\n"); - dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - #ifdef CONFIG_RX_ENABLED struct mbox_channel rx_channel; mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); - if (mbox_register_callback(&rx_channel, callback, NULL)) { - printk("mbox_register_callback() error\n"); + ret = mbox_register_callback(&rx_channel, callback, NULL); + if (ret < 0) { + printk("Could not register callback (%d)\n", ret); return 0; } - if (mbox_set_enabled(&rx_channel, 1)) { - printk("mbox_set_enable() error\n"); + ret = mbox_set_enabled(&rx_channel, true); + if (ret < 0) { + printk("Could not enable RX channel %d (%d)\n", rx_channel.id, ret); return 0; } #endif /* CONFIG_RX_ENABLED */ @@ -51,8 +51,9 @@ int main(void) printk("Ping (on channel %d)\n", tx_channel.id); - if (mbox_send(&tx_channel, NULL) < 0) { - printk("mbox_send() error\n"); + ret = mbox_send(&tx_channel, NULL); + if (ret < 0) { + printk("Could not send (%d)\n", ret); return 0; } } From 077d1b2c473a0abccf9c7fc31cbac6eb23f60d27 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 22 Feb 2024 16:24:14 +0100 Subject: [PATCH 1380/2300] [nrf fromlist] dts: nordic: nrf54h20_enga: add BELLBOARD nodes Add nodes for APP/RAD BELLBOARD peripherals. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 19dca26c3c2801123b6c4e7e9d7915dba4f4ccce) (cherry picked from commit 831c6b056dfbc412aea0c2d824c44ec11a2a8db4) (cherry picked from commit eadc28bcec9158f7bc7caec1e1a24006df0c3a0b) Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 12 ++++++++++++ dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 12 ++++++++++++ dts/common/nordic/nrf54h20_enga.dtsi | 18 ++++++++++++++++++ dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 12 ++++++++++++ 4 files changed, 54 insertions(+) diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi index f51528d5733..25585659968 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -29,6 +29,18 @@ nvic: &cpuapp_nvic {}; ranges; }; +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-local"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + &gpiote130 { interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi index cb2767381da..e51ce316c3f 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -29,6 +29,18 @@ nvic: &cpurad_nvic {}; ranges; }; +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-local"; +}; + &gpiote130 { interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 5a9af57801c..3a8a5759268 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -223,6 +223,24 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; + cpusec_bellboard: mailbox@99000 { + reg = <0x99000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + cpuapp_bellboard: mailbox@9a000 { + reg = <0x9a000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + cpurad_bellboard: mailbox@9b000 { + reg = <0x9b000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + timer120: timer@8e2000 { compatible = "nordic,nrf-timer"; reg = <0x8e2000 0x1000>; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi index d42a815a4b2..dcefe95885c 100644 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -26,6 +26,18 @@ clic: &cpuppr_clic {}; }; }; +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + &gpiote130 { interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; }; From 11dad4da8b5634b4a3a040fe22416a6d3ae17880 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Tue, 27 Feb 2024 12:21:12 +0100 Subject: [PATCH 1381/2300] [nrf fromlist] boards: arm: nrf9151dk: fix broken link This patch fixes a broken link in the docs for the nrf9151dk. It points to the SiP's product page for now. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69516 Signed-off-by: Maximilian Deubel (cherry picked from commit 1b88b6f4d1384d69fde89f2ff67612288ccca998) (cherry picked from commit 9af8910735cf0a233288da4d9f2b570b0787ba03) (cherry picked from commit a75b8284e97e7fc868acd58041ec8c1ea01b7a7a) Signed-off-by: Robert Lubos --- boards/arm/nrf9151dk_nrf9151/doc/index.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/boards/arm/nrf9151dk_nrf9151/doc/index.rst b/boards/arm/nrf9151dk_nrf9151/doc/index.rst index 4c02e7ed372..91e9b75ad9c 100644 --- a/boards/arm/nrf9151dk_nrf9151/doc/index.rst +++ b/boards/arm/nrf9151dk_nrf9151/doc/index.rst @@ -26,9 +26,7 @@ Cortex-M33F CPU with ARMv8-M Security Extension and the following devices: * :abbr:`WDT (Watchdog Timer)` * :abbr:`IDAU (Implementation Defined Attribution Unit)` -More information about the board can be found at the -`nRF9151 DK website`_. The `Nordic Semiconductor Infocenter`_ -contains the processor's information and the datasheet. +More information about the board can be found at the `nRF9151 website`_. Hardware @@ -84,8 +82,7 @@ hardware features: .. _nrf9151dk_additional_hardware: Other hardware features have not been enabled yet for this board. -See `nRF9151 DK website`_ and `Nordic Semiconductor Infocenter`_ -for a complete list of nRF9151 DK board hardware features. +See the `nRF9151 website`_ for more information. Connections and IOs =================== @@ -198,6 +195,6 @@ References .. _IDAU: https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau -.. _nRF9151 DK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9151-DK +.. _nRF9151 website: https://www.nordicsemi.com/Products/nRF9151 .. _Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com .. _Trusted Firmware M: https://www.trustedfirmware.org/projects/tf-m/ From 63bf0c42728cfc861e1ee5cc1e2615df445eff6e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 16:13:59 +0100 Subject: [PATCH 1382/2300] [nrf fromlist] dts: nordic: nrf54h20_enga: add PPR VEVIF nodes Add a new nodes for PPR's VEVIF. In app cores, VEVIF registers are part of the VPR peripheral, so it is exposed as a child node (since it requires its own properties, eg #mbox-cells). In VPR, it's a CPU child since it's not a memory-mapped peripheral, but used with CSRs. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 901708525cd5fdeabdea78d3272c2639d796c0d0) (cherry picked from commit 743cc86218e1bf355bda66cdd535bf837b958ef0) (cherry picked from commit eb64ac18ece7b8c7054c6a9710e3b9ca92f8acad) Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 1 + dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 1 + dts/common/nordic/nrf54h20_enga.dtsi | 34 ++++++++++++++++++++++ dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 1 + 4 files changed, 37 insertions(+) diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi index 25585659968..7252b3d5a04 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -9,6 +9,7 @@ cpu: &cpuapp {}; systick: &cpuapp_systick {}; nvic: &cpuapp_nvic {}; +cpuppr_vevif: &cpuppr_vevif_remote {}; /delete-node/ &cpuppr; /delete-node/ &cpurad; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi index e51ce316c3f..d2aaa790349 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -9,6 +9,7 @@ cpu: &cpurad {}; systick: &cpurad_systick {}; nvic: &cpurad_nvic {}; +cpuppr_vevif: &cpuppr_vevif_remote {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 3a8a5759268..610fbd81587 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -40,6 +40,31 @@ clock-frequency = ; riscv,isa = "rv32emc"; nordic,bus-width = <32>; + + cpuppr_vevif_local: mailbox { + compatible = "nordic,nrf-vevif-local"; + status = "disabled"; + interrupt-parent = <&cpuppr_clic>; + interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, + <1 NRF_DEFAULT_IRQ_PRIORITY>, + <2 NRF_DEFAULT_IRQ_PRIORITY>, + <3 NRF_DEFAULT_IRQ_PRIORITY>, + <4 NRF_DEFAULT_IRQ_PRIORITY>, + <5 NRF_DEFAULT_IRQ_PRIORITY>, + <6 NRF_DEFAULT_IRQ_PRIORITY>, + <7 NRF_DEFAULT_IRQ_PRIORITY>, + <8 NRF_DEFAULT_IRQ_PRIORITY>, + <9 NRF_DEFAULT_IRQ_PRIORITY>, + <10 NRF_DEFAULT_IRQ_PRIORITY>, + <11 NRF_DEFAULT_IRQ_PRIORITY>, + <12 NRF_DEFAULT_IRQ_PRIORITY>, + <13 NRF_DEFAULT_IRQ_PRIORITY>, + <14 NRF_DEFAULT_IRQ_PRIORITY>, + <15 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask = <0xfffffff0>; + }; }; }; @@ -299,6 +324,15 @@ #size-cells = <1>; ranges = <0x0 0x908000 0x4000>; + cpuppr_vevif_remote: mailbox@0 { + compatible = "nordic,nrf-vevif-remote"; + reg = <0x0 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask = <0xfffffff0>; + }; + cpuppr_clic: interrupt-controller@1000 { compatible = "nordic,nrf-clic"; reg = <0x1000 0x3000>; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi index dcefe95885c..0af6618688f 100644 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -8,6 +8,7 @@ cpu: &cpuppr {}; clic: &cpuppr_clic {}; +cpuppr_vevif: &cpuppr_vevif_local {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; From cfb31b2e6478d63adaf771c9a2d9ccff14428b38 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 26 Feb 2024 14:50:21 +0100 Subject: [PATCH 1383/2300] [nrf fromlist] boards: nrf54h20pdk_nrf54h20: Update memory map Add IPC shared memory regions in the global RAM, as well as an enlarged SRAM region for Application core. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Grzegorz Swiderski (cherry picked from commit 7a5f20bc041a73d89484607bdf0fb8001bf146f3) (cherry picked from commit 458185d22602e2d372240008564fdd88909babe4) (cherry picked from commit ccbbadfcea727cdd93d6a314f996896552313e60) Signed-off-by: Robert Lubos --- .../nrf54h20pdk_nrf54h20-memory_map.dtsi | 100 +++++++++++++++++- .../nrf54h20pdk_nrf54h20_cpuapp.dts | 8 +- .../nrf54h20pdk_nrf54h20_cpurad.dts | 2 +- 3 files changed, 106 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi index cb5a4fe0b0c..560700b1756 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi @@ -6,6 +6,96 @@ / { reserved-memory { + cpuapp_ram0x_region: memory@2f000000 { + compatible = "nordic,owned-memory"; + reg = <0x2f000000 DT_SIZE_K(260)>; + status = "disabled"; + perm-read; + perm-write; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f000000 0x41000>; + + cpusec_cpuapp_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpuapp_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + + cpuapp_data: memory@1000 { + reg = <0x1000 DT_SIZE_K(256)>; + }; + }; + + cpurad_ram0x_region: memory@2f041000 { + compatible = "nordic,owned-memory"; + reg = <0x2f041000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f041000 0x1000>; + + cpusec_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + }; + + cpuapp_cpurad_ram0x_region: memory@2f0bf000 { + compatible = "nordic,owned-memory"; + reg = <0x2f0bf000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f0bf000 0x1000>; + + cpuapp_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpuapp_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + }; + + shared_ram20_region: memory@2f88f000 { + compatible = "nordic,owned-memory"; + reg = <0x2f88f000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f88f000 0x1000>; + + cpuapp_cpusys_ipc_shm: memory@ce0 { + reg = <0xce0 0x80>; + }; + + cpusys_cpuapp_ipc_shm: memory@d60 { + reg = <0xd60 0x80>; + }; + + cpurad_cpusys_ipc_shm: memory@e00 { + reg = <0xe00 0x80>; + }; + + cpusys_cpurad_ipc_shm: memory@e80 { + reg = <0xe80 0x80>; + }; + }; + cpuppr_ram3x_region: memory@2fc00000 { compatible = "nordic,owned-memory"; reg = <0x2fc00000 DT_SIZE_K(28)>; @@ -15,7 +105,7 @@ perm-execute; }; - ram3x_dma_region: memory@2fc07000 { + shared_ram3x_region: memory@2fc07000 { compatible = "nordic,owned-memory"; reg = <0x2fc07000 DT_SIZE_K(4)>; status = "disabled"; @@ -25,6 +115,14 @@ #size-cells = <1>; ranges = <0x0 0x2fc07000 0x1000>; + cpuapp_cpuppr_ipc_shm: memory@0 { + reg = <0x0 0x340>; + }; + + cpuppr_cpuapp_ipc_shm: memory@340 { + reg = <0x340 0x340>; + }; + cpuapp_dma_region: memory@680 { compatible = "zephyr,memory-region"; reg = <0x680 DT_SIZE_K(2)>; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 8500d22a924..0251fbded25 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -18,7 +18,7 @@ zephyr,console = &uart136; zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; - zephyr,sram = &cpuapp_ram0; + zephyr,sram = &cpuapp_data; }; aliases { @@ -85,7 +85,11 @@ }; }; -&ram3x_dma_region { +&cpuapp_ram0x_region { + status = "okay"; +}; + +&shared_ram3x_region { status = "okay"; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index a7d142b06c4..d639847e197 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -22,7 +22,7 @@ }; }; -&ram3x_dma_region { +&shared_ram3x_region { status = "okay"; }; From b6e4ad45786e4b775409c07fcc7ffdbf9865a1f3 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 29 Feb 2024 11:49:37 +0100 Subject: [PATCH 1384/2300] [nrf fromlist] boards: nrf54h20pdk: Add default IPC configuration Add `zephyr,ipc-icmsg*` nodes, with mboxes specified in a common file. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Grzegorz Swiderski Signed-off-by: Gerard Marull-Partetas (cherry picked from commit 035adef5768e79f4466e1f74dcd501efc39e2dc2) (cherry picked from commit 6319eaa2d2bfe96e7e8358c2acfee19d534358e0) (cherry picked from commit f256013e8ee1d18284e575bef6470f4e20a633e9) Signed-off-by: Robert Lubos --- .../nrf54h20pdk_nrf54h20-ipc_conf.dtsi | 36 +++++++++++++++++++ .../nrf54h20pdk_nrf54h20_cpuapp.dts | 29 +++++++++++++++ .../nrf54h20pdk_nrf54h20_cpurad.dts | 24 +++++++++++++ .../nrf54h20pdk_nrf54h20_cpuppr.dts | 11 ++++++ 4 files changed, 100 insertions(+) create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi new file mode 100644 index 00000000000..9c3d971b9bc --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + ipc { + cpusec_cpuapp_ipc: ipc-1-2 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpusec_bellboard 12>, + <&cpuapp_bellboard 0>; + }; + + cpusec_cpurad_ipc: ipc-1-3 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpusec_bellboard 18>, + <&cpurad_bellboard 0>; + }; + + cpuapp_cpurad_ipc: ipc-2-3 { + status = "disabled"; + mboxes = <&cpuapp_bellboard 18>, + <&cpurad_bellboard 12>; + }; + + cpuapp_cpuppr_ipc: ipc-2-13 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpuapp_bellboard 13>, + <&cpuppr_vevif 12>; + }; + }; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 0251fbded25..b2db9e4b9b1 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -8,8 +8,11 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" +/delete-node/ &cpusec_cpurad_ipc; + / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpuapp"; model = "Nordic nRF54H20 PDK nRF54H20 Application MCU"; @@ -93,6 +96,32 @@ status = "okay"; }; +&cpuapp_bellboard { + interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq0"; + /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ + nordic,interrupt-mapping = <0x00042001 0>; +}; + +&cpusec_cpuapp_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuapp_cpusec_ipc_shm>; + rx-region = <&cpusec_cpuapp_ipc_shm>; +}; + +&cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-initiator"; + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpurad_ipc_shm>; + rx-region = <&cpurad_cpuapp_ipc_shm>; +}; + +&cpuapp_cpuppr_ipc { + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpuppr_ipc_shm>; + rx-region = <&cpuppr_cpuapp_ipc_shm>; +}; + &cpuapp_dma_region { status = "okay"; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index d639847e197..8d2629df62e 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -8,8 +8,12 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" +/delete-node/ &cpuapp_cpuppr_ipc; +/delete-node/ &cpusec_cpuapp_ipc; + / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpurad"; model = "Nordic nRF54H20 PDK nRF54H20 Radio MCU"; @@ -26,6 +30,26 @@ status = "okay"; }; +&cpurad_bellboard { + interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq0"; + /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ + nordic,interrupt-mapping = <0x00001001 0>; +}; + +&cpusec_cpurad_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpusec_ipc_shm>; + rx-region = <&cpusec_cpurad_ipc_shm>; +}; + +&cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-follower"; + mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpurad_ipc_shm>; +}; + &cpurad_dma_region { status = "okay"; }; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts index 3c74e7c88d4..f98abb9e44b 100644 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts @@ -8,8 +8,13 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" +/delete-node/ &cpuapp_cpurad_ipc; +/delete-node/ &cpusec_cpuapp_ipc; +/delete-node/ &cpusec_cpurad_ipc; + / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpuppr"; model = "Nordic nRF54H20 PDK nRF54H20 Peripheral Processor MCU"; @@ -24,6 +29,12 @@ }; }; +&cpuapp_cpuppr_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuppr_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpuppr_ipc_shm>; +}; + &grtc { status = "okay"; owned-channels = <5>; From 1ee5a6fb10567a1a47f749f3a2bcc4d56e9d772e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 21 Feb 2024 17:36:43 +0100 Subject: [PATCH 1385/2300] [nrf fromlist] samples: drivers: mbox: add support for nRF VEVIF Add support for nRF VEVIF. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit d40fd1f886666d0d61a7a555439857c5654bec55) (cherry picked from commit 599986ab52c40d96ee293687718a32fcfb5d09be) (cherry picked from commit a66f3be42739460fc1da6cf14564b1b25e9e87cd) Signed-off-by: Robert Lubos --- samples/drivers/mbox/CMakeLists.txt | 3 ++- samples/drivers/mbox/Kconfig.sysbuild | 1 + .../nrf54h20pdk_nrf54h20_cpuapp_vevif.conf | 2 ++ .../nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay | 8 +++++++ samples/drivers/mbox/remote/CMakeLists.txt | 3 ++- .../nrf54h20pdk_nrf54h20_cpuppr_vevif.conf | 2 ++ .../nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay | 8 +++++++ samples/drivers/mbox/sample.yaml | 21 +++++++++++++++++++ 8 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf create mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay create mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf create mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index ec79db9deed..c69621c2496 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -17,7 +17,8 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0") OR + ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuapp")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index a17dd56ee55..aca48b8ead3 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -14,3 +14,4 @@ string default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" + default "nrf54h20pdk_nrf54h20_cpuppr" if $(BOARD) = "nrf54h20pdk_nrf54h20_cpuapp" diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf new file mode 100644 index 00000000000..d8d66e9812d --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf @@ -0,0 +1,2 @@ +CONFIG_RX_ENABLED=n +CONFIG_TX_CHANNEL_ID=4 diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay new file mode 100644 index 00000000000..ed631f04cc3 --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +mbox: &cpuppr_vevif { + status = "okay"; +}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index 2c7c8fff29e..cb024cb6112 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -15,7 +15,8 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1") OR - ("${BOARD}" STREQUAL "adp_xc7k_ae350")) + ("${BOARD}" STREQUAL "adp_xc7k_ae350") OR + ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuppr")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf new file mode 100644 index 00000000000..19e03b75c63 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf @@ -0,0 +1,2 @@ +CONFIG_TX_ENABLED=n +CONFIG_RX_CHANNEL_ID=4 diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay new file mode 100644 index 00000000000..ed631f04cc3 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +mbox: &cpuppr_vevif { + status = "okay"; +}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index e38deda55d3..8c85a8d5150 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -23,6 +23,27 @@ tests: - "Pong \\(on channel 0\\)" - "Ping \\(on channel 1\\)" - "Pong \\(on channel 1\\)" + + sample.drivers.mbox.nrf54h20_vevif: + platform_allow: + - nrf54h20pdk_nrf54h20_cpuapp + integration_platforms: + - nrf54h20pdk_nrf54h20_cpuapp + extra_args: + mbox_SNIPPET=nordic-ppr + mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf + mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay + remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf + remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay + sysbuild: true + harness: console + harness_config: + type: multi_line + ordered: false + regex: + - "Ping \\(on channel 4\\)" + - "Pong \\(on channel 4\\)" + sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp From ae6525bb4e7e294fd629240de7f88f8bd52c64cd Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 22 Feb 2024 16:22:21 +0100 Subject: [PATCH 1386/2300] [nrf fromlist] samples: drivers: mbox: add support for nRF BELLBOARD Add support for testing BELLBOARD between cpuapp (local) and cpuppr (remote). Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69303 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 54d64e39a00b6ef9383ea46eb79a409e11ccc189) (cherry picked from commit bd0efe3503272d4af94b193a1d6a629dc08ddb30) (cherry picked from commit 34e58efcd85ab0dae226d0be16c3224e5b1b584d) Signed-off-by: Robert Lubos --- ...nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf | 1 + ...54h20pdk_nrf54h20_cpuapp_bellboard.overlay | 8 ++++++++ ...nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf | 1 + ...54h20pdk_nrf54h20_cpuppr_bellboard.overlay | 8 ++++++++ samples/drivers/mbox/sample.yaml | 20 +++++++++++++++++++ 5 files changed, 38 insertions(+) create mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf create mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay create mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf create mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf new file mode 100644 index 00000000000..0b6bc73d6bc --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf @@ -0,0 +1 @@ +CONFIG_TX_ENABLED=n diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay new file mode 100644 index 00000000000..5f0cfe2261d --- /dev/null +++ b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +mbox: &cpuapp_bellboard { + status = "okay"; +}; diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf new file mode 100644 index 00000000000..4596bc3a757 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf @@ -0,0 +1 @@ +CONFIG_RX_ENABLED=n diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay new file mode 100644 index 00000000000..5f0cfe2261d --- /dev/null +++ b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +mbox: &cpuapp_bellboard { + status = "okay"; +}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 8c85a8d5150..b386b9d2b4b 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -44,6 +44,26 @@ tests: - "Ping \\(on channel 4\\)" - "Pong \\(on channel 4\\)" + sample.drivers.mbox.nrf54h20_bellboard: + platform_allow: + - nrf54h20pdk_nrf54h20_cpuapp + integration_platforms: + - nrf54h20pdk_nrf54h20_cpuapp + extra_args: + mbox_SNIPPET=nordic-ppr + mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf + mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay + remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf + remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay + sysbuild: true + harness: console + harness_config: + type: multi_line + ordered: false + regex: + - "Ping \\(on channel 0\\)" + - "Pong \\(on channel 0\\)" + sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp From 74208ee8f77c0184758a48128afd1a45fc133cb6 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Wed, 31 Jan 2024 17:00:20 +0100 Subject: [PATCH 1387/2300] [nrf fromlist] dts: arm: nrf54l: Add nodes required by MCUboot Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68393 The commit adds partitons on rram0. Signed-off-by: Mateusz Michalek (cherry picked from commit 1f01183e44e290eeed5632bdd9bc3fd8fadea650) (cherry picked from commit 229904255a65fc168fe04b07a62c70bd8f868023) Signed-off-by: Robert Lubos --- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index 1e0245f6cc3..f2703872899 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -133,13 +133,30 @@ compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - slot0_partition: partition@0 { - label = "image-0"; + boot_partition: partition@0 { + label = "mcuboot"; reg = <0x0 DT_SIZE_K(64)>; }; - storage_partition: partition@f2000 { + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(348)>; + }; + slot0_ns_partition: partition@67000 { + label = "image-0-nonsecure"; + reg = <0x67000 DT_SIZE_K(348)>; + }; + slot1_partition: partition@be000 { + label = "image-1"; + reg = <0xbe000 DT_SIZE_K(348)>; + }; + slot1_ns_partition: partition@115000 { + label = "image-1-nonsecure"; + reg = <0x115000 DT_SIZE_K(348)>; + }; + /* 32k from 0x16c000 to 0x173fff reserved for TF-M partitions */ + storage_partition: partition@174000 { label = "storage"; - reg = <0xf2000 DT_SIZE_K(24)>; + reg = <0x174000 DT_SIZE_K(36)>; }; }; }; From ce7a9abbc9ebb852644e1fe1207a6547006de700 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Fri, 16 Feb 2024 12:57:30 +0100 Subject: [PATCH 1388/2300] [nrf fromlist] dts: arm: add uart-mcumgr choosen for 54L15 Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68393 setting uart20 as default uart-mcumgr Signed-off-by: Mateusz Michalek (cherry picked from commit a7971abcb9a7daca57756ca96045a24014a0f396) (cherry picked from commit 54f6f538b691e3ec1dbcb7ec14466e07dedbf698) Signed-off-by: Robert Lubos --- boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index f2703872899..9876e3996e8 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -16,6 +16,7 @@ chosen { zephyr,console = &uart20; zephyr,shell-uart = &uart20; + zephyr,uart-mcumgr = &uart20; zephyr,sram = &sram0; zephyr,flash = &rram0; zephyr,code-partition = &slot0_partition; From 3701af0b87579c566c128e90c1c3e1c9302be191 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 13 Feb 2024 12:44:45 +0100 Subject: [PATCH 1389/2300] [nrf fromlist] linker: Set ROM offset for MCUboot with NRF54L Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68393 Due to number of IRQs the ROM offset, that contains MCUboot, needs to be moved to address that is aligned with 2048 byte long vector table. This comes from Cortex-M requirement where vector table needs to be placed at offset equal to lowest power of two number that will fit vector table. Signed-off-by: Dominik Ermel Signed-off-by: Mateusz Michalek Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 3912101710c23bfa3b6a2c5ab6fdecb6043a7133) (cherry picked from commit 1d331bf7e78fde7c98fe87cf385ebd5ff970196b) Signed-off-by: Robert Lubos --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig index 532ea07c859..3e47a0bb583 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig @@ -9,4 +9,8 @@ config BOARD config BT_CTLR default BT +config ROM_START_OFFSET + hex + default 0x800 if BOOTLOADER_MCUBOOT + endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP From 3f9065356fe91353311ebec8924471071a8a4131 Mon Sep 17 00:00:00 2001 From: Radoslaw Koppel Date: Tue, 27 Feb 2024 13:17:37 +0100 Subject: [PATCH 1390/2300] [nrf fromlist] buildsystem: Enable LTO also for the application MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69519 It turns out that currently LTO is enabled only for the kernel. This commit updates it to enable it for the whole application and adds additional LTO exclusions required for the standard C libraries to build and link properly. Signed-off-by: Radosław Koppel (cherry picked from commit 9448e2b8de2772771a7faae884a4adaee451cba8) (cherry picked from commit 739b8f74740eccc2f320ac684d6b3934b2144fe3) Signed-off-by: Robert Lubos --- CMakeLists.txt | 2 +- lib/libc/newlib/CMakeLists.txt | 3 +++ lib/libc/picolibc/CMakeLists.txt | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1fb89660f9..a229c06413e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,7 +214,7 @@ endif() zephyr_compile_options(${OPTIMIZATION_FLAG}) if(CONFIG_LTO) - add_compile_options($) + zephyr_compile_options($) add_link_options($) endif() diff --git a/lib/libc/newlib/CMakeLists.txt b/lib/libc/newlib/CMakeLists.txt index 6556a3e814c..35c6a9b6337 100644 --- a/lib/libc/newlib/CMakeLists.txt +++ b/lib/libc/newlib/CMakeLists.txt @@ -3,6 +3,9 @@ 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 normally uses -ffreestanding, which with current GNU toolchains # means that the flag macros used by newlib 3.x to signal # support for PRI.64 macros are not present. To make them available we diff --git a/lib/libc/picolibc/CMakeLists.txt b/lib/libc/picolibc/CMakeLists.txt index 23e84231e2a..87fb0d9d8ec 100644 --- a/lib/libc/picolibc/CMakeLists.txt +++ b/lib/libc/picolibc/CMakeLists.txt @@ -3,6 +3,9 @@ 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 $) + # define __LINUX_ERRNO_EXTENSIONS__ so we get errno defines like -ESHUTDOWN # used by the network stack zephyr_compile_definitions(__LINUX_ERRNO_EXTENSIONS__) From 22df05a1f6caa10bed711b9545e520cf8b27580b Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Thu, 29 Feb 2024 19:40:12 +0100 Subject: [PATCH 1391/2300] [nrf fromlist] modules: hal_nordic: Enforce nrf-regtool minimum version Require the presence of the nrf-regtool package as well as requiring a minimum version, failing the build whenever a suitable version is not found in the system. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69633 Signed-off-by: Carles Cufi (cherry picked from commit 0e13f61d8ed687a2cc428c8a0458f496e639bd70) (cherry picked from commit 8d93a161567dcc525771f70692587e6a37947b71) (cherry picked from commit 3eb95e74276b956f1eda8649e54a6fbd8f8a46b1) Signed-off-by: Robert Lubos --- 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 c4a7134935c..7f46997c697 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -11,7 +11,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.1.0 + find_package(nrf-regtool 5.1.0 REQUIRED COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From a102df7e8a2063d226767bc7c705d5f20e9630ef Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Thu, 7 Mar 2024 11:35:04 +0200 Subject: [PATCH 1392/2300] [nrf fromtree] drivers: modem_cellular: allow leaving out the chat_filter parameter Allow not specifying the chat_filter parameter in a device definition, which is equivalent to setting it to "". Signed-off-by: Tomi Fontanilles (cherry picked from commit fd5c76ddfdfe4c0e32c77f5baaf0bc62c8c8d950) (cherry picked from commit c92db91f87efccfb6c1a586a48b04b96c0ca525d) (cherry picked from commit 01f4a78eca85ee7d902bd4e3c10566ff896fb4e5) Signed-off-by: Robert Lubos --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 276c9d38f7b..15f10f11a52 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1516,7 +1516,7 @@ static int modem_cellular_init(const struct device *dev) .delimiter = data->chat_delimiter, .delimiter_size = strlen(data->chat_delimiter), .filter = data->chat_filter, - .filter_size = strlen(data->chat_filter), + .filter_size = data->chat_filter ? strlen(data->chat_filter) : 0, .argv = data->chat_argv, .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, From 56e0ecf9ed3d45ec48e9c6f03f15bdb02417b432 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 5 Mar 2024 14:18:50 +0100 Subject: [PATCH 1393/2300] [nrf fromtree] drivers: flash: Add flash driver for MRAM Basic driver utilizing the flash API for NVM operations on the nRF54H20. Signed-off-by: Grzegorz Swiderski (cherry picked from commit f91323ee5da06fa8e26f47317a2dddb2d52da154) (cherry picked from commit ad03431d632d1629a38cae504ba2b162d0098d05) (cherry picked from commit f57e95b2762782f390d731ab5dfbeaefe0feda3e) Signed-off-by: Robert Lubos --- drivers/flash/CMakeLists.txt | 1 + drivers/flash/Kconfig | 2 + drivers/flash/Kconfig.nrf_mram | 19 ++++ drivers/flash/soc_flash_nrf_mram.c | 177 +++++++++++++++++++++++++++++ 4 files changed, 199 insertions(+) create mode 100644 drivers/flash/Kconfig.nrf_mram create mode 100644 drivers/flash/soc_flash_nrf_mram.c diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index 4f21b2f65ed..98f24ff123c 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -129,3 +129,4 @@ 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_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) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index 4731a628438..0c24890d44d 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -163,4 +163,6 @@ source "drivers/flash/Kconfig.ambiq" source "drivers/flash/Kconfig.nrf_rram" +source "drivers/flash/Kconfig.nrf_mram" + endif # FLASH diff --git a/drivers/flash/Kconfig.nrf_mram b/drivers/flash/Kconfig.nrf_mram new file mode 100644 index 00000000000..0ef65864a62 --- /dev/null +++ b/drivers/flash/Kconfig.nrf_mram @@ -0,0 +1,19 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +config SOC_FLASH_NRF_MRAM + bool "Nordic Semiconductor flash driver for MRAM" + default y + depends on DT_HAS_NORDIC_MRAM_ENABLED + select FLASH_HAS_DRIVER_ENABLED + select FLASH_HAS_PAGE_LAYOUT + imply MPU_ALLOW_FLASH_WRITE if ARM_MPU + help + Enables Nordic Semiconductor flash driver for MRAM in direct write mode. + + Note that MRAM words are auto-erased when written to, but writing to a + pre-erased area is faster. Hence, the erase API is not required, but + it can be used to amortize write performance for some use cases. diff --git a/drivers/flash/soc_flash_nrf_mram.c b/drivers/flash/soc_flash_nrf_mram.c new file mode 100644 index 00000000000..9b33ee05d6f --- /dev/null +++ b/drivers/flash/soc_flash_nrf_mram.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include + +LOG_MODULE_REGISTER(flash_nrf_mram, CONFIG_FLASH_LOG_LEVEL); + +#define DT_DRV_COMPAT nordic_mram + +#define MRAM_START DT_INST_REG_ADDR(0) +#define MRAM_SIZE DT_INST_REG_SIZE(0) + +#define MRAM_WORD_SIZE 16 +#define MRAM_WORD_MASK 0xf + +#define WRITE_BLOCK_SIZE DT_INST_PROP_OR(0, write_block_size, MRAM_WORD_SIZE) +#define ERASE_BLOCK_SIZE DT_INST_PROP_OR(0, erase_block_size, WRITE_BLOCK_SIZE) + +#define ERASE_VALUE 0xff + +BUILD_ASSERT(MRAM_START > 0, "nordic,mram: start address expected to be non-zero"); +BUILD_ASSERT((ERASE_BLOCK_SIZE % WRITE_BLOCK_SIZE) == 0, + "erase-block-size expected to be a multiple of write-block-size"); + +/** + * @param[in,out] offset Relative offset into memory, from the driver API. + * @param[in] len Number of bytes for the intended operation. + * @param[in] must_align Require MRAM word alignment, if applicable. + * + * @return Absolute address in MRAM, or NULL if @p offset or @p len are not + * within bounds or appropriately aligned. + */ +static uintptr_t validate_and_map_addr(off_t offset, size_t len, bool must_align) +{ + if (unlikely(offset < 0 || offset >= MRAM_SIZE || len > MRAM_SIZE - offset)) { + LOG_ERR("invalid offset: %ld:%zu", offset, len); + return 0; + } + + const uintptr_t addr = MRAM_START + offset; + + if (WRITE_BLOCK_SIZE > 1 && must_align && + unlikely((addr % WRITE_BLOCK_SIZE) != 0 || (len % WRITE_BLOCK_SIZE) != 0)) { + LOG_ERR("invalid alignment: %p:%zu", (void *)addr, len); + return 0; + } + + return addr; +} + +/** + * @param[in] addr_end Last modified MRAM address (not inclusive). + */ +static void commit_changes(uintptr_t addr_end) +{ + /* Barrier following our last write. */ + barrier_dmem_fence_full(); + + if ((WRITE_BLOCK_SIZE & MRAM_WORD_MASK) == 0 || (addr_end & MRAM_WORD_MASK) == 0) { + /* Our last operation was MRAM word-aligned, so we're done. + * Note: if WRITE_BLOCK_SIZE is a multiple of MRAM_WORD_SIZE, + * then this was already checked in validate_and_map_addr(). + */ + return; + } + + /* Get the most significant byte (MSB) of the last MRAM word we were modifying. + * Writing to this byte makes the MRAM controller commit other pending writes to that word. + */ + addr_end |= MRAM_WORD_MASK; + + /* Issue a dummy write, since we didn't have anything to write here. + * Doing this lets us finalize our changes before we exit the driver API. + */ + sys_write8(sys_read8(addr_end), addr_end); +} + +static int nrf_mram_read(const struct device *dev, off_t offset, void *data, size_t len) +{ + ARG_UNUSED(dev); + + const uintptr_t addr = validate_and_map_addr(offset, len, false); + + if (!addr) { + return -EINVAL; + } + + LOG_DBG("read: %p:%zu", (void *)addr, len); + + memcpy(data, (void *)addr, len); + + return 0; +} + +static int nrf_mram_write(const struct device *dev, off_t offset, const void *data, size_t len) +{ + ARG_UNUSED(dev); + + const uintptr_t addr = validate_and_map_addr(offset, len, true); + + if (!addr) { + return -EINVAL; + } + + LOG_DBG("write: %p:%zu", (void *)addr, len); + + memcpy((void *)addr, data, len); + commit_changes(addr + len); + + return 0; +} + +static int nrf_mram_erase(const struct device *dev, off_t offset, size_t size) +{ + ARG_UNUSED(dev); + + const uintptr_t addr = validate_and_map_addr(offset, size, true); + + if (!addr) { + return -EINVAL; + } + + LOG_DBG("erase: %p:%zu", (void *)addr, size); + + memset((void *)addr, ERASE_VALUE, size); + commit_changes(addr + size); + + return 0; +} + +static const struct flash_parameters *nrf_mram_get_parameters(const struct device *dev) +{ + ARG_UNUSED(dev); + + static const struct flash_parameters parameters = { + .write_block_size = WRITE_BLOCK_SIZE, + .erase_value = ERASE_VALUE, + }; + + return ¶meters; +} + +#if defined(CONFIG_FLASH_PAGE_LAYOUT) +static void nrf_mram_page_layout(const struct device *dev, const struct flash_pages_layout **layout, + size_t *layout_size) +{ + ARG_UNUSED(dev); + + static const struct flash_pages_layout pages_layout = { + .pages_count = (MRAM_SIZE) / (ERASE_BLOCK_SIZE), + .pages_size = ERASE_BLOCK_SIZE, + }; + + *layout = &pages_layout; + *layout_size = 1; +} +#endif + +static const struct flash_driver_api nrf_mram_api = { + .read = nrf_mram_read, + .write = nrf_mram_write, + .erase = nrf_mram_erase, + .get_parameters = nrf_mram_get_parameters, +#if defined(CONFIG_FLASH_PAGE_LAYOUT) + .page_layout = nrf_mram_page_layout, +#endif +}; + +DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, + &nrf_mram_api); From 77d21e0e54f3996c8318145912bb6e8556194917 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 7 Mar 2024 15:59:15 +0100 Subject: [PATCH 1394/2300] [nrf fromtree] dts: nordic: nrf54h20_enga: Add erase-block-size to mram1x The MRAM has no concept of erase blocks or pages, so this is treated as driver configuration. Signed-off-by: Grzegorz Swiderski (cherry picked from commit beab89d6e82bce3de5ef827074e9273811949ddd) (cherry picked from commit cce721bce2b15685cca65f2d1943cafdd4d6e1e6) (cherry picked from commit 04433a6c721c96b04f4c162e0c33ca7d4786d295) Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 610fbd81587..70c994ccd06 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -96,6 +96,7 @@ mram1x: mram@e000000 { compatible = "nordic,mram"; reg = <0xe000000 DT_SIZE_K(2048)>; + erase-block-size = <4096>; write-block-size = <16>; }; From 20b7e5c80778c5162d8c040516b830593305d831 Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Tue, 6 Feb 2024 09:29:33 +0100 Subject: [PATCH 1395/2300] [nrf fromtree] manifest: update hal_nordic revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates revision of hal_nordic repo. Signed-off-by: Andrzej Kuroś (cherry picked from commit fa3f2ee485309fee44fa7d78f7a53946983d53fa) Signed-off-by: Andrzej Głąbek (cherry picked from commit 157e4838b541a0fb03acdf648104e4dec1ca86ee) (cherry picked from commit 826a22820c6decf9daeebe0d60ecd07370840965) Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 3da134e76ce..a288009c15a 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: dce8519f7da37b0a745237679fd3f88250b495ff + revision: daf875285120be6b2825969b7a0abc3f415b248d path: modules/hal/nordic groups: - hal From 4663189d08d5c51238a60ed15996087a87b1526f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 29 Feb 2024 16:30:41 +0100 Subject: [PATCH 1396/2300] [nrf fromlist] dts: nordic: Add DPPIC and IPCT nodes to nRF54H20 EngA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And add the corresponding bindings. Move alse the already existing bindings for nrf-dppic, nrf-ppi, and nrf-ipc so they are located together with the new ones and in more appropriate folders (DPPIC and PPI peripherals are not related to ARM, and IPC is for sending and receiving events, not messages, so ipm/ does not seem to be the best fit for it). Signed-off-by: Andrzej Głąbek (cherry picked from commit ae33b354173ab96065abe69d26c73b8ebe30aeac) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit cbe75dd25eee898ac91b0e4e2018016722504fa1) (cherry picked from commit 50e4aa2286986e8c66b7a5c713907f4195b9aeb5) Signed-off-by: Robert Lubos --- dts/bindings/{ipm => ipc}/nordic,nrf-ipc.yaml | 0 dts/bindings/ipc/nordic,nrf-ipct-common.yaml | 45 +++++++++ dts/bindings/ipc/nordic,nrf-ipct-global.yaml | 17 ++++ dts/bindings/ipc/nordic,nrf-ipct-local.yaml | 12 +++ .../misc/nordic,nrf-dppic-global.yaml | 18 ++++ dts/bindings/misc/nordic,nrf-dppic-links.yaml | 17 ++++ dts/bindings/misc/nordic,nrf-dppic-local.yaml | 13 +++ .../{arm => misc}/nordic,nrf-dppic.yaml | 0 .../{arm => misc}/nordic,nrf-ppi.yaml | 0 .../misc/nordic,split-channel-groups.yaml | 20 ++++ dts/common/nordic/nrf54h20_enga.dtsi | 94 +++++++++++++++++++ 11 files changed, 236 insertions(+) rename dts/bindings/{ipm => ipc}/nordic,nrf-ipc.yaml (100%) create mode 100644 dts/bindings/ipc/nordic,nrf-ipct-common.yaml create mode 100644 dts/bindings/ipc/nordic,nrf-ipct-global.yaml create mode 100644 dts/bindings/ipc/nordic,nrf-ipct-local.yaml create mode 100644 dts/bindings/misc/nordic,nrf-dppic-global.yaml create mode 100644 dts/bindings/misc/nordic,nrf-dppic-links.yaml create mode 100644 dts/bindings/misc/nordic,nrf-dppic-local.yaml rename dts/bindings/{arm => misc}/nordic,nrf-dppic.yaml (100%) rename dts/bindings/{arm => misc}/nordic,nrf-ppi.yaml (100%) create mode 100644 dts/bindings/misc/nordic,split-channel-groups.yaml diff --git a/dts/bindings/ipm/nordic,nrf-ipc.yaml b/dts/bindings/ipc/nordic,nrf-ipc.yaml similarity index 100% rename from dts/bindings/ipm/nordic,nrf-ipc.yaml rename to dts/bindings/ipc/nordic,nrf-ipc.yaml diff --git a/dts/bindings/ipc/nordic,nrf-ipct-common.yaml b/dts/bindings/ipc/nordic,nrf-ipct-common.yaml new file mode 100644 index 00000000000..a75b63577c4 --- /dev/null +++ b/dts/bindings/ipc/nordic,nrf-ipct-common.yaml @@ -0,0 +1,45 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic IPCT (Interprocessor Communication Transceiver) + +include: base.yaml + +properties: + reg: + required: true + + channels: + type: int + required: true + description: Number of channels implemented by the IPCT instance. + + source-channel-links: + type: array + description: | + Mapping of IPCT channels that are mapped between two IPCT instances on + separate domains, in which a channel on this IPCT node is considered + the source. This array is then comprised of a 3-integer-wide "unit" + that defines one connection of the mapping. The format of this unit + is . Units are sequential + in the array, therefore requiring the length of this property to be + a factor of 3. + + For example, if channel 2 is to be mapped to Radio Core (ID: 3) IPCT + channel 4, then the array "unit" would be <2 NRF_DOMAIN_ID_RADIOCORE 4> + or <2 3 4>. + + sink-channel-links: + type: array + description: | + Mapping of IPCT channels that are mapped between two IPCT instances on + separate domains, in which a channel on this IPCT node is considered + the sink. This array is then comprised of a 3-integer-wide "unit" + that defines one connection of the mapping. The format of this unit + is . Units are sequential + in the array, therefore requiring the length of this property to be + a factor of 3. + + For example, if channel 2 is to be mapped to Radio Core (ID: 3) IPCT + channel 4, then the array "unit" would be <2 NRF_DOMAIN_ID_RADIOCORE 4> + or <2 3 4>. diff --git a/dts/bindings/ipc/nordic,nrf-ipct-global.yaml b/dts/bindings/ipc/nordic,nrf-ipct-global.yaml new file mode 100644 index 00000000000..a1f7776d464 --- /dev/null +++ b/dts/bindings/ipc/nordic,nrf-ipct-global.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic Global IPCT (Interprocessor Communication Transceiver) + +compatible: "nordic,nrf-ipct-global" + +include: ["nordic,nrf-ipct-common.yaml", "nordic,split-channels.yaml"] + +properties: + global-domain-id: + required: true + type: int + description: | + Global IPCT instances reside on specific buses within the Global Domain, + such as fast and slow, which have different IDs that do not match the + standard Global Domain ID presented in their address. diff --git a/dts/bindings/ipc/nordic,nrf-ipct-local.yaml b/dts/bindings/ipc/nordic,nrf-ipct-local.yaml new file mode 100644 index 00000000000..9f055eb8b79 --- /dev/null +++ b/dts/bindings/ipc/nordic,nrf-ipct-local.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic Local IPCT (Interprocessor Communication Transceiver) + +compatible: "nordic,nrf-ipct-local" + +include: "nordic,nrf-ipct-common.yaml" + +properties: + interrupts: + required: true diff --git a/dts/bindings/misc/nordic,nrf-dppic-global.yaml b/dts/bindings/misc/nordic,nrf-dppic-global.yaml new file mode 100644 index 00000000000..3257c519348 --- /dev/null +++ b/dts/bindings/misc/nordic,nrf-dppic-global.yaml @@ -0,0 +1,18 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic Global DPPIC + (Distributed Programmable Peripheral Interconnect Controller) + + Updated DPPIC binding set for Nordic products that have global DPPIC instances + with inter-bridge functionality. These instances also have split-ownership + of its channels and channel groups. + +compatible: "nordic,nrf-dppic-global" + +include: + - "nordic,nrf-dppic.yaml" + - "nordic,nrf-dppic-links.yaml" + - "nordic,split-channels.yaml" + - "nordic,split-channel-groups.yaml" diff --git a/dts/bindings/misc/nordic,nrf-dppic-links.yaml b/dts/bindings/misc/nordic,nrf-dppic-links.yaml new file mode 100644 index 00000000000..db12ccb72cb --- /dev/null +++ b/dts/bindings/misc/nordic,nrf-dppic-links.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic DPPIC Channel Linking + +properties: + source-channels: + type: array + description: | + Channels that are linked to channels of DPPIC instances on separate + bridges as publishing sources. + + sink-channels: + type: array + description: | + Channels that are linked to channels of DPPIC instances on separate + bridges as subscribing sinks. diff --git a/dts/bindings/misc/nordic,nrf-dppic-local.yaml b/dts/bindings/misc/nordic,nrf-dppic-local.yaml new file mode 100644 index 00000000000..bea53bddec8 --- /dev/null +++ b/dts/bindings/misc/nordic,nrf-dppic-local.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +description: | + Nordic Local DPPIC + (Distributed Programmable Peripheral Interconnect Controller) + + Updated DPPIC binding set for Nordic products that have local DPPIC instances + with inter-bridge functionality. + +compatible: "nordic,nrf-dppic-local" + +include: ["nordic,nrf-dppic.yaml", "nordic,nrf-dppic-links.yaml"] diff --git a/dts/bindings/arm/nordic,nrf-dppic.yaml b/dts/bindings/misc/nordic,nrf-dppic.yaml similarity index 100% rename from dts/bindings/arm/nordic,nrf-dppic.yaml rename to dts/bindings/misc/nordic,nrf-dppic.yaml diff --git a/dts/bindings/arm/nordic,nrf-ppi.yaml b/dts/bindings/misc/nordic,nrf-ppi.yaml similarity index 100% rename from dts/bindings/arm/nordic,nrf-ppi.yaml rename to dts/bindings/misc/nordic,nrf-ppi.yaml diff --git a/dts/bindings/misc/nordic,split-channel-groups.yaml b/dts/bindings/misc/nordic,split-channel-groups.yaml new file mode 100644 index 00000000000..868bc5fecec --- /dev/null +++ b/dts/bindings/misc/nordic,split-channel-groups.yaml @@ -0,0 +1,20 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic Split Channel Groups + +properties: + owned-channel-groups: + type: array + description: | + List of channel groups of a split-ownership peripheral that are to be + owned for use by the compiled domain. + + nonsecure-channel-groups: + type: array + description: | + List of channel groups in a split-ownership, split-security peripheral + that are to be configured as nonsecure. In Trustzone systems, this + property is only evaluated for secure peripherals, as nonsecure channels + are implicitly specified through the owned-channels property. This + property is ignored in non-Trustzone systems. diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 70c994ccd06..47aba0df253 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -9,6 +9,12 @@ #include +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 2 +#define NRF_DOMAIN_ID_RADIOCORE 3 +#define NRF_DOMAIN_ID_GLOBALFAST 12 +#define NRF_DOMAIN_ID_GLOBALSLOW 13 + /delete-node/ &sw_pwm; / { @@ -153,6 +159,15 @@ <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; nordic,ficr-names = "vsup", "coarse", "fine"; }; + + cpuapp_ipct: ipct@13000 { + compatible = "nordic,nrf-ipct-local"; + reg = <0x13000 0x1000>; + status = "disabled"; + channels = <4>; + interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, + <65 NRF_DEFAULT_IRQ_PRIORITY>; + }; }; cpurad_peripherals: peripheral@53000000 { @@ -173,6 +188,21 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; + dppic020: dppic@22000 { + compatible = "nordic,nrf-dppic-local"; + reg = <0x22000 0x1000>; + status = "disabled"; + }; + + cpurad_ipct: ipct@24000 { + compatible = "nordic,nrf-ipct-local"; + reg = <0x24000 0x1000>; + status = "disabled"; + channels = <8>; + interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, + <65 NRF_DEFAULT_IRQ_PRIORITY>; + }; + egu020: egu@25000 { compatible = "nordic,nrf-egu"; reg = <0x25000 0x1000>; @@ -267,6 +297,20 @@ #mbox-cells = <1>; }; + ipct120: ipct@8d1000 { + compatible = "nordic,nrf-ipct-global"; + reg = <0x8d1000 0x1000>; + status = "disabled"; + channels = <8>; + global-domain-id = <12>; + }; + + dppic120: dppic@8e1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x8e1000 0x1000>; + status = "disabled"; + }; + timer120: timer@8e2000 { compatible = "nordic,nrf-timer"; reg = <0x8e2000 0x1000>; @@ -344,6 +388,20 @@ }; }; + ipct130: ipct@921000 { + compatible = "nordic,nrf-ipct-global"; + reg = <0x921000 0x1000>; + status = "disabled"; + channels = <8>; + global-domain-id = <13>; + }; + + dppic130: dppic@922000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x922000 0x1000>; + status = "disabled"; + }; + rtc130: rtc@928000 { compatible = "nordic,nrf-rtc"; reg = <0x928000 0x1000>; @@ -449,6 +507,12 @@ port = <9>; }; + dppic131: dppic@981000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x981000 0x1000>; + status = "disabled"; + }; + comp: comparator@983000 { compatible = "nordic,nrf-comp"; reg = <0x983000 0x1000>; @@ -471,6 +535,12 @@ interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; }; + dppic132: dppic@991000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x991000 0x1000>; + status = "disabled"; + }; + qdec130: qdec@994000 { compatible = "nordic,nrf-qdec"; reg = <0x994000 0x1000>; @@ -492,6 +562,12 @@ cc-num = <16>; }; + dppic133: dppic@9a1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9a1000 0x1000>; + status = "disabled"; + }; + timer130: timer@9a2000 { compatible = "nordic,nrf-timer"; reg = <0x9a2000 0x1000>; @@ -568,6 +644,12 @@ interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; }; + dppic134: dppic@9b1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9b1000 0x1000>; + status = "disabled"; + }; + timer132: timer@9b2000 { compatible = "nordic,nrf-timer"; reg = <0x9b2000 0x1000>; @@ -644,6 +726,12 @@ interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; }; + dppic135: dppic@9c1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9c1000 0x1000>; + status = "disabled"; + }; + timer134: timer@9c2000 { compatible = "nordic,nrf-timer"; reg = <0x9c2000 0x1000>; @@ -720,6 +808,12 @@ interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; }; + dppic136: dppic@9d1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9d1000 0x1000>; + status = "disabled"; + }; + timer136: timer@9d2000 { compatible = "nordic,nrf-timer"; reg = <0x9d2000 0x1000>; From 8c7a4439115a0ff24f97b69309fce989d8cd8371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 6 Mar 2024 12:31:23 +0100 Subject: [PATCH 1397/2300] [nrf fromlist] dts: nordic: Add missing ECB020 node in nRF54H20 EngA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit 4db40601dd7f0b98a48f3e6072bf44643a4ea3db. There are two ECB instances in nRF54H20 and the above commit added only one of them. Signed-off-by: Andrzej Głąbek (cherry picked from commit d7c2c5e723f1b86f1824fdc83eacfc779202e04d) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit 9b6a87d8b08dd4d5f32c48f4bd7997d2a57ae8a2) (cherry picked from commit 0ab98d9e8869f01eb3781ea231a92fac95c8a118) Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20_enga.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 47aba0df253..8552b9534eb 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -210,6 +210,13 @@ interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; }; + ecb020: ecb@27000 { + compatible = "nordic,nrf-ecb"; + reg = <0x27000 0x1000>; + status = "disabled"; + interrupts = <39 NRF_DEFAULT_IRQ_PRIORITY>; + }; + timer020: timer@28000 { compatible = "nordic,nrf-timer"; reg = <0x28000 0x1000>; From 319fb4c47550b0adcd3eed7aba804b75aedbce30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 6 Mar 2024 12:02:36 +0100 Subject: [PATCH 1398/2300] [nrf fromlist] soc: nordic_nrf: Add address validation entries for nRF54H/L dts nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add entries for checking if the recently added dts nodes for nRF54H20 and nRF54L15 have correct base addresses (if they match those provided by MDK). Signed-off-by: Andrzej Głąbek (cherry picked from commit f3e6d39b90bbcf763fca76e0752a703f49a9c58e) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit 8d6f1543ef71ceffd36284714b1fde9986b8c6ec) (cherry picked from commit 81c93e932666b923915e0fa87c6c430c8f288b78) Signed-off-by: Robert Lubos --- soc/arm/nordic_nrf/validate_base_addresses.c | 76 ++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 28ec231b132..04c7a1ae3cd 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -133,17 +133,39 @@ CHECK_DT_REG(cryptocell, NRF_CRYPTOCELL); CHECK_DT_REG(ctrlap, NRF_CTRLAP); CHECK_DT_REG(dcnf, NRF_DCNF); CHECK_DT_REG(dppic, NRF_DPPIC); +CHECK_DT_REG(dppic00, NRF_DPPIC00); +CHECK_DT_REG(dppic10, NRF_DPPIC10); +CHECK_DT_REG(dppic20, NRF_DPPIC20); +CHECK_DT_REG(dppic30, NRF_DPPIC30); +CHECK_DT_REG(dppic020, NRF_DPPIC020); +CHECK_DT_REG(dppic120, NRF_DPPIC120); +CHECK_DT_REG(dppic130, NRF_DPPIC130); +CHECK_DT_REG(dppic131, NRF_DPPIC131); +CHECK_DT_REG(dppic132, NRF_DPPIC132); +CHECK_DT_REG(dppic133, NRF_DPPIC133); +CHECK_DT_REG(dppic134, NRF_DPPIC134); +CHECK_DT_REG(dppic135, NRF_DPPIC135); +CHECK_DT_REG(dppic136, NRF_DPPIC136); CHECK_DT_REG(ecb, NRF_ECB); +CHECK_DT_REG(ecb020, NRF_ECB020); +CHECK_DT_REG(ecb030, NRF_ECB030); CHECK_DT_REG(egu0, NRF_EGU0); CHECK_DT_REG(egu1, NRF_EGU1); CHECK_DT_REG(egu2, NRF_EGU2); CHECK_DT_REG(egu3, NRF_EGU3); CHECK_DT_REG(egu4, NRF_EGU4); CHECK_DT_REG(egu5, NRF_EGU5); +CHECK_DT_REG(egu10, NRF_EGU10); +CHECK_DT_REG(egu20, NRF_EGU20); +CHECK_DT_REG(egu020, NRF_EGU020); CHECK_DT_REG(ficr, NRF_FICR); CHECK_DT_REG(flash_controller, NRF_NVMC); CHECK_DT_REG(gpio0, NRF_P0); CHECK_DT_REG(gpio1, NRF_P1); +CHECK_DT_REG(gpio2, NRF_P2); +CHECK_DT_REG(gpio6, NRF_P6); +CHECK_DT_REG(gpio7, NRF_P7); +CHECK_DT_REG(gpio9, NRF_P9); CHECK_DT_REG(gpiote, NRF_GPIOTE); CHECK_DT_REG(gpiote0, NRF_GPIOTE0); CHECK_DT_REG(gpiote1, NRF_GPIOTE1); @@ -155,8 +177,25 @@ CHECK_I2C_REG(i2c0, 0); CHECK_I2C_REG(i2c1, 1); CHECK_DT_REG(i2c2, NRF_TWIM2); CHECK_DT_REG(i2c3, NRF_TWIM3); +CHECK_DT_REG(i2c20, NRF_TWIM20); +CHECK_DT_REG(i2c21, NRF_TWIM21); +CHECK_DT_REG(i2c22, NRF_TWIM22); +CHECK_DT_REG(i2c30, NRF_TWIM30); +CHECK_DT_REG(i2c130, NRF_TWIM130); +CHECK_DT_REG(i2c131, NRF_TWIM131); +CHECK_DT_REG(i2c132, NRF_TWIM132); +CHECK_DT_REG(i2c133, NRF_TWIM133); +CHECK_DT_REG(i2c134, NRF_TWIM134); +CHECK_DT_REG(i2c135, NRF_TWIM135); +CHECK_DT_REG(i2c136, NRF_TWIM136); +CHECK_DT_REG(i2c137, NRF_TWIM137); CHECK_DT_REG(i2s0, NRF_I2S0); +CHECK_DT_REG(i2s20, NRF_I2S20); CHECK_DT_REG(ipc, NRF_IPC); +CHECK_DT_REG(cpuapp_ipct, NRF_IPCT); +CHECK_DT_REG(cpurad_ipct, NRF_IPCT); +CHECK_DT_REG(ipct120, NRF_IPCT120); +CHECK_DT_REG(ipct130, NRF_IPCT130); CHECK_DT_REG(kmu, NRF_KMU); CHECK_DT_REG(mutex, NRF_MUTEX); CHECK_DT_REG(mwu, NRF_MWU); @@ -173,18 +212,40 @@ CHECK_DT_REG(pwm3, NRF_PWM3); CHECK_DT_REG(qdec, NRF_QDEC0); /* this should be the same node as qdec0 */ CHECK_DT_REG(qdec0, NRF_QDEC0); CHECK_DT_REG(qdec1, NRF_QDEC1); +CHECK_DT_REG(qdec20, NRF_QDEC20); +CHECK_DT_REG(qdec21, NRF_QDEC21); +CHECK_DT_REG(qdec130, NRF_QDEC130); +CHECK_DT_REG(qdec131, NRF_QDEC131); CHECK_DT_REG(radio, NRF_RADIO); CHECK_DT_REG(regulators, NRF_REGULATORS); CHECK_DT_REG(reset, NRF_RESET); CHECK_DT_REG(rng, NRF_RNG); +CHECK_DT_REG(rtc, NRF_RTC); CHECK_DT_REG(rtc0, NRF_RTC0); CHECK_DT_REG(rtc1, NRF_RTC1); CHECK_DT_REG(rtc2, NRF_RTC2); +CHECK_DT_REG(rtc130, NRF_RTC130); +CHECK_DT_REG(rtc131, NRF_RTC131); CHECK_SPI_REG(spi0, 0); CHECK_SPI_REG(spi1, 1); CHECK_SPI_REG(spi2, 2); CHECK_DT_REG(spi3, NRF_SPIM3); CHECK_DT_REG(spi4, NRF_SPIM4); +CHECK_DT_REG(spi00, NRF_SPIM00); +CHECK_DT_REG(spi20, NRF_SPIM20); +CHECK_DT_REG(spi21, NRF_SPIM21); +CHECK_DT_REG(spi22, NRF_SPIM22); +CHECK_DT_REG(spi30, NRF_SPIM30); +CHECK_DT_REG(spi120, NRF_SPIM120); +CHECK_DT_REG(spi121, NRF_SPIM121); +CHECK_DT_REG(spi130, NRF_SPIM130); +CHECK_DT_REG(spi131, NRF_SPIM131); +CHECK_DT_REG(spi132, NRF_SPIM132); +CHECK_DT_REG(spi133, NRF_SPIM133); +CHECK_DT_REG(spi134, NRF_SPIM134); +CHECK_DT_REG(spi135, NRF_SPIM135); +CHECK_DT_REG(spi136, NRF_SPIM136); +CHECK_DT_REG(spi137, NRF_SPIM137); CHECK_DT_REG(spu, NRF_SPU); CHECK_DT_REG(swi0, NRF_SWI0); CHECK_DT_REG(swi1, NRF_SWI1); @@ -205,6 +266,19 @@ CHECK_DT_REG(timer21, NRF_TIMER21); CHECK_DT_REG(timer22, NRF_TIMER22); CHECK_DT_REG(timer23, NRF_TIMER23); CHECK_DT_REG(timer24, NRF_TIMER24); +CHECK_DT_REG(timer020, NRF_TIMER020); +CHECK_DT_REG(timer021, NRF_TIMER021); +CHECK_DT_REG(timer022, NRF_TIMER022); +CHECK_DT_REG(timer120, NRF_TIMER120); +CHECK_DT_REG(timer121, NRF_TIMER121); +CHECK_DT_REG(timer130, NRF_TIMER130); +CHECK_DT_REG(timer131, NRF_TIMER131); +CHECK_DT_REG(timer132, NRF_TIMER132); +CHECK_DT_REG(timer133, NRF_TIMER133); +CHECK_DT_REG(timer134, NRF_TIMER134); +CHECK_DT_REG(timer135, NRF_TIMER135); +CHECK_DT_REG(timer136, NRF_TIMER136); +CHECK_DT_REG(timer137, NRF_TIMER137); CHECK_UART_REG(uart0, 0); CHECK_DT_REG(uart1, NRF_UARTE1); CHECK_DT_REG(uart2, NRF_UARTE2); @@ -232,6 +306,8 @@ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); CHECK_DT_REG(wdt30, NRF_WDT30); CHECK_DT_REG(wdt31, NRF_WDT31); +CHECK_DT_REG(wdt131, NRF_WDT131); +CHECK_DT_REG(wdt132, NRF_WDT132); /* nRF51/nRF52-specific addresses */ #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) From 70d831dfcfad758cf70b7a5712bcf442b563e067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 5 Mar 2024 15:34:32 +0100 Subject: [PATCH 1399/2300] [nrf fromlist] manifest: Update hal_nordic revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pull in fixes in the nrfx_gppi_dppi_ppib helper so that it can be compiled successfuly. Signed-off-by: Andrzej Głąbek (cherry picked from commit a84e44b68b4a291a28466e320207926b56514a77) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit 1382003ca06daa80bbbd6f68580db828167cd0f8) (cherry picked from commit b3850e23340108a71cedb780a893138dac95fbf7) Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index a288009c15a..f8e75062ad4 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: daf875285120be6b2825969b7a0abc3f415b248d + revision: 5470822384781624efb2fda28cbc6a895a227677 path: modules/hal/nordic groups: - hal From 4378c6032eefd27fd4e0216051287b160af0516b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 1 Mar 2024 11:16:28 +0100 Subject: [PATCH 1400/2300] [nrf fromlist] modules: hal_nordic: Enable support for DPPI on nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include into compilation the nrfx_gppi_dppi_ppib helper and related interconnect layers when DPPIC nodes are enabled in DTS. Provide macro definitions required by those interconnect layers based on information from devicetree (the nrf_grtc_timer is only modified because a macro that it uses became more generic). Signed-off-by: Andrzej Głąbek (cherry picked from commit e46a0a51650dcd2afd3216fdb8a003dd7080cdf9) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69811 (cherry picked from commit 7285f59cbbeff4a660e622a6f9053174d1a0e751) (cherry picked from commit 413344936c729e7813173a121c4e2155b683a912) Signed-off-by: Robert Lubos --- drivers/timer/nrf_grtc_timer.c | 4 +- modules/hal_nordic/nrfx/CMakeLists.txt | 8 ++ modules/hal_nordic/nrfx/nrfx_config.h | 121 +++++++++++++++++++++++-- 3 files changed, 121 insertions(+), 12 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 8ac357864cc..c9e51db2469 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -21,8 +21,8 @@ #if !DT_NODE_HAS_PROP(GRTC_NODE, owned_channels) #error GRTC owned-channels DT property is not defined #endif -#define OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(owned_channels) -#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels) +#define OWNED_CHANNELS_MASK NRFX_CONFIG_MASK_DT(GRTC_NODE, owned_channels) +#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_MASK_DT(GRTC_NODE, child_owned_channels) #if ((OWNED_CHANNELS_MASK | CHILD_OWNED_CHANNELS_MASK) != OWNED_CHANNELS_MASK) #error GRTC child-owned-channels DT property must be a subset of owned-channels #endif diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 4db5ac891fe..13ee18db7a6 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -163,6 +163,14 @@ if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) zephyr_library_sources(${NRFX_DIR}/soc/interconnect/dppic_ppib/nrfx_interconnect_dppic_ppib.c) endif() +if(CONFIG_SOC_SERIES_NRF54HX AND + (CONFIG_DT_HAS_NORDIC_NRF_DPPIC_LOCAL_ENABLED OR + CONFIG_DT_HAS_NORDIC_NRF_DPPIC_GLOBAL_ENABLED)) + zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib.c) + zephyr_library_sources(${NRFX_DIR}/soc/interconnect/apb/nrfx_interconnect_apb.c) + zephyr_library_sources(${NRFX_DIR}/soc/interconnect/ipct/nrfx_interconnect_ipct.c) +endif() + # Get the SVD file for the current SoC macro(mdk_svd_ifdef feature_toggle filename) if(${feature_toggle}) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 5ebc243541e..5c1a071f9bf 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -8,6 +8,7 @@ #define NRFX_CONFIG_H__ #include +#include /* * These are mappings of Kconfig options enabling nrfx drivers and particular @@ -756,27 +757,127 @@ #define NRF_PERIPH(P) P##_S #endif +#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) BIT(DT_PROP_BY_IDX(node_id, prop, idx)) +#define NRFX_CONFIG_MASK_DT(node_id, prop) \ + (COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \ + (DT_FOREACH_PROP_ELEM_SEP(node_id, prop, NRFX_CONFIG_BIT_DT, (|))), \ + (0))) + /* If the GRTC system timer driver is to be used, prepare definitions required * by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and * NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree. */ #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) -#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ - BIT(DT_PROP_BY_IDX(node_id, prop, idx)) -#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ - (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ - (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ - NRFX_CONFIG_BIT_DT, (|))), \ - (0))) - #define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ - (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ - ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) + (NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), owned_channels) & \ + ~NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), child_owned_channels)) #define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ +/* If global of local DPPIC peripherals are used, provide the following macro + * definitions required by the interconnect/apb layer: + * - NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) + * - NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) + * - NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) + * - NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) + * - NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE + * - NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE + * based on information from devicetree. + */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || \ + DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_local) +#ifndef NRFX_DPPI_ENABLED +#define NRFX_DPPI_ENABLED 1 +#endif +/* Source (publish) channels masks generation. */ +#define NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels) + +/* Sink (subscribe) channels masks generation. */ +#define NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels) + +#define NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) \ + UTIL_OR(DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels), \ + DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels)) + +/* Variables names generation. */ +#define NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) +#define NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(DT_NODELABEL(_CONCAT(dppic, inst_num))) + +/* Variables entries generation. */ +#define NRFX_CONFIG_DPPI_CHANNELS_ENTRY(node_id) \ + static nrfx_atomic_t NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) \ + __attribute__((used)) = \ + NRFX_CONFIG_MASK_DT(node_id, source_channels) | \ + NRFX_CONFIG_MASK_DT(node_id, sink_channels); +#define NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE \ + DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_global, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) +#define NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE \ + DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_local, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || ... */ + +/* If local or global DPPIC peripherals are used, provide the following macro + * definitions required by the interconnect/ipct layer: + * - NRFX_IPCTx_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) + * - NRFX_IPCTx_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) + * - NRFX_IPCT_PUB_OR_SUB_MASK(inst_num) + * - NRFX_IPCTx_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) + * - NRFX_INTERCONNECT_IPCT_GLOBAL_DEFINE + * - NRFX_INTERCONNECT_IPCT_LOCAL_DEFINE + * based on information from devicetree. + */ +#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_global) || \ + DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_local) +/* Channels masks generation. */ +#define NRFX_CONFIG_IPCT_MASK_DT(node_id) \ + COND_CODE_1(DT_NODE_HAS_PROP(node_id, owned_channels), \ + (NRFX_CONFIG_MASK_DT(node_id, owned_channels)), \ + (COND_CODE_1(DT_NODE_HAS_COMPAT(node_id, nordic_nrf_ipct_local), \ + (BIT_MASK(DT_PROP(node_id, channels))), (0)))) + +#if defined(NRF_APPLICATION) +#define NRFX_CONFIG_IPCT_LOCAL_NODE DT_NODELABEL(cpuapp_ipct) +#elif defined(NRF_RADIOCORE) +#define NRFX_CONFIG_IPCT_LOCAL_NODE DT_NODELABEL(cpurad_ipct) +#endif +#define NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num) \ + COND_CODE_1(IS_EMPTY(inst_num), \ + (NRFX_CONFIG_IPCT_LOCAL_NODE), \ + (DT_NODELABEL(_CONCAT(ipct, inst_num)))) + +#define NRFX_IPCTx_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_IPCT_MASK_DT(NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num)) + +#define NRFX_IPCTx_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ + NRFX_CONFIG_IPCT_MASK_DT(NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num)) + +#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_PROP(DT_NODELABEL(_CONCAT(ipct, inst_num)), owned_channels))) + +/* Variables names generation. */ +#define NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) +#define NRFX_IPCTx_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) \ + COND_CODE_1(IS_EMPTY(inst_num), \ + (NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(NRFX_CONFIG_IPCT_LOCAL_NODE)), \ + (NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(DT_NODELABEL(_CONCAT(ipct, inst_num))))) + +/* Variables entries generation. */ +#define NRFX_CONFIG_IPCT_CHANNELS_ENTRY(node_id) \ + static nrfx_atomic_t NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(node_id) \ + __attribute__((used)) = \ + NRFX_CONFIG_IPCT_MASK_DT(node_id); +#define NRFX_INTERCONNECT_IPCT_LOCAL_DEFINE \ + DT_FOREACH_STATUS_OKAY(nordic_nrf_ipct_local, NRFX_CONFIG_IPCT_CHANNELS_ENTRY) +#define NRFX_INTERCONNECT_IPCT_GLOBAL_DEFINE \ + DT_FOREACH_STATUS_OKAY(nordic_nrf_ipct_global, NRFX_CONFIG_IPCT_CHANNELS_ENTRY) +#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_global) || ... */ + #include #if defined(NRF51) #include From 368628d23026e5c141b92816fefb801640cfb908 Mon Sep 17 00:00:00 2001 From: Maciej Perkowski Date: Fri, 28 Jan 2022 12:02:58 +0100 Subject: [PATCH 1401/2300] [nrf noup] ci: clang: parallel execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bring back parallel execution to the clang action. In the upstream they went to use a single dedicated powerful agent to run this. We need to keep this as we have to base on agents available in github's cloud. zephyr_runner is upstream's proprietary agent inaccessible outside of upstream's CI. Use ubuntu-latest instead. Signed-off-by: Maciej Perkowski Signed-off-by: Gerard Marull-Paretas Signed-off-by: Dominik Ermel Signed-off-by: Torsten Rasmussen Signed-off-by: Tomasz Moń Signed-off-by: Stephanos Ioannidis Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Dominik Ermel (cherry picked from commit 4d76b6a7403a5d3c14098d4d67e26e284e3c5757) (cherry picked from commit 0643f1e138ce460226b667d33b7aaace4fd0938a) Signed-off-by: Robert Lubos --- .github/workflows/clang.yaml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index 17fbc1c72bd..b28d3c387e4 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -8,8 +8,7 @@ concurrency: jobs: clang-build: - if: github.repository_owner == 'zephyrproject-rtos' - runs-on: zephyr-runner-linux-x64-4xlarge + runs-on: ubuntu-latest container: image: ghcr.io/zephyrproject-rtos/ci:v0.26.7 options: '--entrypoint /bin/bash' @@ -19,10 +18,12 @@ jobs: fail-fast: false matrix: platform: ["native_sim"] + subset: [1, 2, 3, 4, 5] env: LLVM_TOOLCHAIN_PATH: /usr/lib/llvm-16 COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} BASE_REF: ${{ github.base_ref }} + MATRIX_SIZE: 5 outputs: report_needed: ${{ steps.twister.outputs.report_needed }} steps: @@ -87,7 +88,7 @@ jobs: id: cache-ccache uses: zephyrproject-rtos/action-s3-cache@v1.2.0 with: - key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.platform }}-ccache + key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.subset }}-ccache path: /github/home/.cache/ccache aws-s3-bucket: ccache.zephyrproject.org aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }} @@ -100,6 +101,16 @@ jobs: test -d github/home/.cache/ccache && rm -rf /github/home/.cache/ccache && mv github/home/.cache/ccache /github/home/.cache/ccache ccache -M 10G -s + - name: Build test plan with Twister + id: twister_test_plan + run: | + export ZEPHYR_BASE=${PWD} + 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 -p native_posix -c origin/${BASE_REF}.. + + - name: Run Tests with Twister id: twister run: | @@ -113,7 +124,7 @@ jobs: 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 --inline-logs -M -N -v --load-tests testplan.json --retry-failed 2 --subset ${{matrix.subset}}/${MATRIX_SIZE} else # if nothing is run, skip reporting step echo "report_needed=0" >> $GITHUB_OUTPUT @@ -128,7 +139,7 @@ jobs: if: always() && steps.twister.outputs.report_needed != 0 uses: actions/upload-artifact@v4 with: - name: Unit Test Results (Subset ${{ matrix.platform }}) + name: Unit Test Results (Subset ${{ matrix.subset }}) path: twister-out/twister.xml clang-build-results: From 39598424d22cc357cfb37365901c9a5cf733436b Mon Sep 17 00:00:00 2001 From: Sigvart Hovland Date: Fri, 3 May 2019 14:21:52 +0200 Subject: [PATCH 1402/2300] [nrf noup] tree-wide: support NCS Partition Manager (PM) definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partition Manager (PM) is a component of the nRF Connect SDK (NCS) which uses yaml files to resolve flash partition placement with a holistic view of the entire device, including each firmware image present on the flash device, and various subsystems, such as settings and NFFS. When this NCS extension is used, various source files which would use partition information from devicetree in "vanilla" zephyr instead use defines generated by PM instead. This commit removes support for HEX_FILES_TO_MERGE, as it conflicts with PM. The settings subsystem pm.yml defines a partition 'settings_storage'. The nffs subsystem pm.yml defines 'nffs_storage'. Leverage label translation to avoid patching partition names. Refer to the NCS documentation page for this feature for more details. This is a long-running out of tree patch which has been worked on by several people. The following sign-offs are in alphabetical order by first name. Signed-off-by: Andrzej Głąbek Signed-off-by: Andrzej Puzdrowski Signed-off-by: Håkon Øye Amundsen Signed-off-by: Ioannis Glaropoulos Signed-off-by: Joakim Andersson Signed-off-by: Johann Fischer Signed-off-by: Martí Bolívar Signed-off-by: Ole Sæther Signed-off-by: Robert Lubos Signed-off-by: Sebastian Bøe Signed-off-by: Sigvart Hovland Signed-off-by: Thomas Stenersen Signed-off-by: Torsten Rasmussen Signed-off-by: Øyvind Rønningstad Signed-off-by: Trond Einar Snekvik Signed-off-by: Gerard Marull-Paretas Signed-off-by: Tomasz Moń Signed-off-by: Dominik Ermel (cherry picked from commit a7fb26837763ee7c21fb666fe2faa8c7503a17f1) (cherry picked from commit ea83f6ccc7786349ddcf267af19a1b63e0fe950f) --- arch/arm/core/mpu/arm_mpu_regions.c | 13 ++++++ cmake/modules/kernel.cmake | 4 ++ drivers/flash/soc_flash_nrf.c | 11 +++++ .../arch/arm/cortex_m/scripts/linker.ld | 46 +++++++++++++++++++ include/zephyr/storage/flash_map.h | 6 +++ lib/heap/Kconfig | 2 +- lib/libc/common/source/stdlib/malloc.c | 18 +++++++- subsys/fs/littlefs_fs.c | 7 ++- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 +++++++++++ 9 files changed, 130 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index 6af62f84078..cfe1230c907 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,6 +8,9 @@ #include #include +#if USE_PARTITION_MANAGER +#include +#endif static const struct arm_mpu_region mpu_regions[] = { /* Region 0 */ @@ -21,6 +24,14 @@ static const struct arm_mpu_region mpu_regions[] = { #endif /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", +#if USE_PARTITION_MANAGER + PM_SRAM_ADDRESS, +#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) + REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), +#else + REGION_RAM_ATTR(REGION_SRAM_SIZE)), +#endif +#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -28,6 +39,8 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif + +#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index a093d46691f..06e1642f362 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -243,3 +243,7 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() + +if(ZEPHYR_NRF_MODULE_DIR) + include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) +endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index cc840309264..b5a3fefa1e5 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,6 +37,11 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER +#include +#include +#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ + #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -166,6 +171,12 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS + if (addr < PM_APP_ADDRESS) { + return soc_secure_mem_read(data, (void *)addr, len); + } +#endif + nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index d061468d2ac..14eb78f3e70 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -26,6 +26,35 @@ #endif #define RAMABLE_REGION RAM +#if USE_PARTITION_MANAGER + +#include + +#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) +/* We are linking against S1, create symbol containing the flash ID of S0. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S0_ID; + +#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ + +#ifdef PM_S1_ID +/* We are linking against S0, create symbol containing the flash ID of S1. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S1_ID; +#endif /* PM_S1_ID */ + +#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ + +#define ROM_ADDR PM_ADDRESS +#define ROM_SIZE PM_SIZE + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -58,6 +87,23 @@ #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS #endif +#endif /* USE_PARTITION_MANAGER */ + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) +#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) +#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) +#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) +#endif + #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index 12f4f4c34a2..ffe386d6b7a 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -271,6 +271,10 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); +#if USE_PARTITION_MANAGER +#include +#else + /** * Returns non-0 value if fixed-partition of given DTS node label exists. * @@ -328,6 +332,8 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_DEVICE(label) \ DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))) +#endif /* USE_PARTITION_MANAGER */ + #ifdef __cplusplus } #endif diff --git a/lib/heap/Kconfig b/lib/heap/Kconfig index 7f01b280b3b..68476eb735c 100644 --- a/lib/heap/Kconfig +++ b/lib/heap/Kconfig @@ -68,7 +68,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index e3a5db6f7d5..2f469d673e4 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,6 +25,20 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); +#if USE_PARTITION_MANAGER + +#include + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + +#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) +#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS + +#endif /* USE_PARTITION_MANAGER */ + #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -106,8 +120,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ - ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ + ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index b373ca92ba8..3fc84c2922d 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1054,7 +1054,12 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ + .storage_dev = (void *) \ + COND_CODE_1(USE_PARTITION_MANAGER, \ + (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ + (FIXED_PARTITION_ID(littlefs_storage)), \ + (FIXED_PARTITION_ID(storage)))), \ + (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index a74e46b8520..9996e1d74d9 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,8 +13,35 @@ extern "C" { #endif +#if CONFIG_PARTITION_MANAGER_ENABLED + +#include "pm_config.h" + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) +#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE +#else +/* The current image is a child image in a different domain than the image + * which defined the required values. To reach the values of the parent domain + * we use the 'PM__' variant of the define. + */ +#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ + +#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ + +#else + +#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) +#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) + +#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From 2aba1375175390c61cdc6b9af57d2f3494891c43 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Mon, 16 Jan 2023 14:15:22 +0100 Subject: [PATCH 1403/2300] [nrf noup] dts: choose a crypto accelerator for entropy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a long-term noup patch because crypto driver support is NCS-only for both cryptocell and CRACEN. Set HAS_HW_NRF_CC3XX to be defined in NS build when cryptocell is accessed through the PSA API. We need to know which CC3XX features are available. Set PSA as the entropy source for 54L. PSA is the only NCS-supported interface to CRACEN. Signed-off-by: Georgios Vasilakis Signed-off-by: Joakim Andersson Signed-off-by: Dominik Ermel Signed-off-by: Sebastian Bøe (cherry picked from commit 499041d072580ae79d4fe967f0df52e60e43966b) (cherry picked from commit baa4ee7ebd5d885119d6d196d62c1ca1e6af5841) (cherry picked from commit 4fa3cc9657abf7334c4e44257c57684db65a1b3f) Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf52840.dtsi | 4 ++-- dts/arm/nordic/nrf5340_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf54l_common.dtsi | 6 ++++++ dts/arm/nordic/nrf91.dtsi | 3 ++- soc/common/nordic_nrf/Kconfig.peripherals | 6 ++++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 20c18cf3d84..8efe49a3c91 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -5,7 +5,7 @@ / { chosen { - zephyr,entropy = &rng; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -547,7 +547,7 @@ reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index e40f6241d91..d48f0ce62dc 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -33,7 +33,7 @@ }; chosen { - zephyr,entropy = &rng_hci; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -102,7 +102,7 @@ reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index 415f2471174..3214daeac84 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -25,6 +25,12 @@ chosen { zephyr,flash-controller = &rram_controller; + zephyr,entropy = &psa_rng; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; }; sw_pwm: sw-pwm { diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 78502d3f086..0fb4c4addf4 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -27,6 +27,7 @@ }; chosen { + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -50,7 +51,7 @@ reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; ctrlap: ctrlap@50006000 { diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index ca24384cf8e..a6b62428626 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -13,10 +13,12 @@ config HAS_HW_NRF_BPROT def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_BPROT)) config HAS_HW_NRF_CC310 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_SERIES_NRF91X) config HAS_HW_NRF_CC312 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_NRF5340_CPUAPP) config HAS_HW_NRF_CCM def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_CCM)) From e29c8640d0cc8d43732339899219335c19653106 Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Tue, 7 Feb 2023 12:39:12 +0100 Subject: [PATCH 1404/2300] [nrf noup] Bluetooth: Mesh: zero randomization for friend's adv Friend's replies on LPN's polls do not assume randomization in advertiser. Zero randomization will help to optimize time when LPN keeps receiving window open and save power. Signed-off-by: Aleksandr Khromykh (cherry picked from commit 468009977970899f2d250231847e160671f74d18) (cherry picked from commit 9d3acb7a7d46e96bb2f93c0faa251deedc3f31c4) Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/Kconfig | 2 +- subsys/bluetooth/mesh/adv_ext.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 085d72c3b18..ce845e995fd 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1550,7 +1550,7 @@ config BT_MESH_LPN_INIT_POLL_TIMEOUT config BT_MESH_LPN_SCAN_LATENCY int "Latency for enabling scanning" range 0 50 - default 15 + default 2 help Latency in milliseconds that it takes to enable scanning. This is in practice how much time in advance before the Receive Window diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index f6367a05258..7a5630469e9 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -13,6 +13,9 @@ #include #include #include +#if defined(CONFIG_BT_LL_SOFTDEVICE) +#include +#endif #include "common/bt_str.h" @@ -136,6 +139,28 @@ static inline struct bt_mesh_ext_adv *gatt_adv_get(void) } } +static int set_adv_randomness(uint8_t handle, int rand_us) +{ +#if defined(CONFIG_BT_LL_SOFTDEVICE) + struct net_buf *buf; + sdc_hci_cmd_vs_set_adv_randomness_t *cmd_params; + + buf = bt_hci_cmd_create(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, sizeof(*cmd_params)); + if (!buf) { + LOG_ERR("Could not allocate command buffer"); + return -ENOMEM; + } + + cmd_params = net_buf_add(buf, sizeof(*cmd_params)); + cmd_params->adv_handle = handle; + cmd_params->rand_us = rand_us; + + return bt_hci_cmd_send_sync(SDC_HCI_OPCODE_CMD_VS_SET_ADV_RANDOMNESS, buf, NULL); +#else + return 0; +#endif /* defined(CONFIG_BT_LL_SOFTDEVICE) */ +} + static int adv_start(struct bt_mesh_ext_adv *ext_adv, const struct bt_le_adv_param *param, struct bt_le_ext_adv_start_param *start, @@ -490,6 +515,13 @@ int bt_mesh_adv_enable(void) if (err) { return err; } + + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { + err = set_adv_randomness(adv->instance->handle, 0); + if (err) { + LOG_ERR("Failed to set zero randomness: %d", err); + } + } } return 0; From 0f9b3695966c6ab7988464cd7e5e050634e17d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Storr=C3=B8?= Date: Wed, 8 Mar 2023 12:17:09 +0100 Subject: [PATCH 1405/2300] [nrf noup] Bluetooth: Mesh: Fix adv randomness bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes issue where randomness can be removed for advertising sets that have to handle other adv types than the BT_MESH_FRIEND_ADV tag type. Signed-off-by: Anders Storrø Signed-off-by: Aleksandr Khromykh Signed-off-by: Dominik Ermel (cherry picked from commit 3afe29330d959ee78d57db509a7380f0e05b6bba) (cherry picked from commit 36710dee098619426dcadcecdb7f217c12d01910) (cherry picked from commit c202d38d216500057134a36bb6637dfaeb139440) Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/adv_ext.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 7a5630469e9..c4d3e335748 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -516,8 +516,10 @@ int bt_mesh_adv_enable(void) return err; } - if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && adv->tag & BT_MESH_FRIEND_ADV) { - err = set_adv_randomness(adv->instance->handle, 0); + if (IS_ENABLED(CONFIG_BT_LL_SOFTDEVICE) && + IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) && + advs[i].tags == BT_MESH_ADV_TAG_BIT_FRIEND) { + err = set_adv_randomness(advs[i].instance->handle, 0); if (err) { LOG_ERR("Failed to set zero randomness: %d", err); } From a5a8676af4c2702e5570cdb1381dceadf2d8b6c0 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Mon, 11 Mar 2024 14:35:23 +0100 Subject: [PATCH 1406/2300] [nrf noup] boards: arm: kconfig: ROM_START_OFFSET sets up default for builds with partition manager. Signed-off-by: Mateusz Michalek (cherry picked from commit e23b096e93631cba98704d093717d417a56c1b55) Signed-off-by: Robert Lubos --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig index 3e47a0bb583..94b0fc7299d 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig @@ -10,7 +10,7 @@ config BT_CTLR default BT config ROM_START_OFFSET - hex + default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP From 8a134f993662ebb63a790d9e479669bc7a171c0c Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Thu, 1 Feb 2024 14:42:27 +0100 Subject: [PATCH 1407/2300] [nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add ieee802154 status okay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set status = "okay" for ieee802154 device tree node to allow use of ieee802154 on the nrf54l15pdk_nrf54l15_cpuapp board. Signed-off-by: Andrzej Kuroś (cherry picked from commit 32da903ef8f079185b849c7c7c4f434f21453f53) (cherry picked from commit cddd22498a8323a6c35f7f378bd907bdff070b2d) Signed-off-by: Robert Lubos --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index 9876e3996e8..c009f0bd544 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -129,6 +129,10 @@ status = "okay"; }; +&ieee802154 { + status = "okay"; +}; + &rram0 { partitions { compatible = "fixed-partitions"; From d3a903aff7b36e992ec3b5ce32eeb94dea426de0 Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Tue, 6 Feb 2024 14:41:35 +0100 Subject: [PATCH 1408/2300] [nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add temp status okay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set status = "okay" for temp device tree node to allow use of nRF 802.15.4 Radio Driver on the nrf54l15pdk_nrf54l15_cpuapp board. Signed-off-by: Andrzej Kuroś (cherry picked from commit 306d6c2290f5f86bf176e1dbe7036c0b19f27dd3) (cherry picked from commit 3abe0f7f364787d02cabdaa5e3445d2e85febe57) Signed-off-by: Robert Lubos --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index c009f0bd544..c801ddc8dc5 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -133,6 +133,10 @@ status = "okay"; }; +&temp { + status = "okay"; +}; + &rram0 { partitions { compatible = "fixed-partitions"; From be32f653555d4445f4ca525cd8e0021a81fbbf31 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Tue, 19 Mar 2024 09:39:06 +0100 Subject: [PATCH 1409/2300] [nrf fromlist] dts: arm: nordic: nrf54l15 write block size write-block-size correction. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70412 Signed-off-by: Mateusz Michalek (cherry picked from commit 78c194bb204eea873a29a9317f81fa081cfbabf1) Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54l_common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index 3214daeac84..c537554b05b 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -18,7 +18,7 @@ rram0: rram@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; - write-block-size = <1>; + write-block-size = <16>; }; }; }; From e0363868fd5447ceb1fb0565380f863cd210a0d0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 6 Mar 2024 10:24:57 +0100 Subject: [PATCH 1410/2300] [nrf fromtree] sys: Include sys/util.h header in sys/atomic.h Commit a1358aaedf0d10d5c105a7b0d79e48f16be6cacf introduced ROUND_UP macro use within sys/atomic.h header, but did not include the header (sys/util.h) which actually defines the macro. This commit fixes it. Signed-off-by: Robert Lubos (cherry picked from commit a487addc615d6b28fb4b106fb5407eed42c5c214) --- include/zephyr/sys/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/sys/atomic.h b/include/zephyr/sys/atomic.h index 3982e428038..86ba2cdf144 100644 --- a/include/zephyr/sys/atomic.h +++ b/include/zephyr/sys/atomic.h @@ -15,7 +15,7 @@ #include /* IWYU pragma: export */ #include -#include +#include #ifdef __cplusplus extern "C" { From 28ac23896bacca886d8cf0acc580b6c423e268fc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 7 Mar 2024 12:26:49 +0100 Subject: [PATCH 1411/2300] [nrf noup] Revert "net: openthread: Add PSA implementation for PBDKF2 genkey" This reverts commit 85bc24eb0731cef2275529633c6f4a915ae8f6ed. Pbkdf2 support is not yet available in TFM, and w/o it we won't be able to build OpenThread for certain platforms. Therefore, we need to temporarily revert the upstream change that introduced Pbkdf2 use in OT. This noup commit shall be dropped as soon as Pbkdf2 support is added to TFM. Signed-off-by: Robert Lubos --- modules/openthread/platform/crypto_psa.c | 62 ------------------------ 1 file changed, 62 deletions(-) diff --git a/modules/openthread/platform/crypto_psa.c b/modules/openthread/platform/crypto_psa.c index 6ad286f3734..c818c5695a3 100644 --- a/modules/openthread/platform/crypto_psa.c +++ b/modules/openthread/platform/crypto_psa.c @@ -603,66 +603,4 @@ otError otPlatCryptoEcdsaGenerateAndImportKey(otCryptoKeyRef aKeyRef) return psaToOtError(status); } -otError otPlatCryptoPbkdf2GenerateKey(const uint8_t *aPassword, - uint16_t aPasswordLen, - const uint8_t *aSalt, - uint16_t aSaltLen, - uint32_t aIterationCounter, - uint16_t aKeyLen, - uint8_t *aKey) -{ - psa_status_t status = PSA_SUCCESS; - psa_key_id_t key_id = PSA_KEY_ID_NULL; - psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; - psa_algorithm_t algorithm = PSA_ALG_PBKDF2_AES_CMAC_PRF_128; - psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT; - - psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE); - psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_VOLATILE); - psa_set_key_algorithm(&attributes, algorithm); - psa_set_key_type(&attributes, PSA_KEY_TYPE_PASSWORD); - psa_set_key_bits(&attributes, PSA_BYTES_TO_BITS(aPasswordLen)); - - status = psa_import_key(&attributes, aPassword, aPasswordLen, &key_id); - if (status != PSA_SUCCESS) { - goto out; - } - - status = psa_key_derivation_setup(&operation, algorithm); - if (status != PSA_SUCCESS) { - goto out; - } - - status = psa_key_derivation_input_integer(&operation, PSA_KEY_DERIVATION_INPUT_COST, - aIterationCounter); - if (status != PSA_SUCCESS) { - goto out; - } - - status = psa_key_derivation_input_bytes(&operation, PSA_KEY_DERIVATION_INPUT_SALT, - aSalt, aSaltLen); - if (status != PSA_SUCCESS) { - goto out; - } - - status = psa_key_derivation_input_key(&operation, PSA_KEY_DERIVATION_INPUT_PASSWORD, - key_id); - if (status != PSA_SUCCESS) { - goto out; - } - - status = psa_key_derivation_output_bytes(&operation, aKey, aKeyLen); - if (status != PSA_SUCCESS) { - goto out; - } - -out: - psa_reset_key_attributes(&attributes); - psa_key_derivation_abort(&operation); - psa_destroy_key(key_id); - - __ASSERT_NO_MSG(status == PSA_SUCCESS); - return psaToOtError(status); -} - #endif /* #if CONFIG_OPENTHREAD_ECDSA */ From a74f47a3f06d47d92edf3c0c9657816daae43611 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 7 Mar 2024 13:13:57 +0100 Subject: [PATCH 1412/2300] [nrf fromtree] drivers: input: Fix uninitialized closest_mv variable warning Building with GCC 9.4.0 gives the following warning/error: error: closest_mv may be used uninitialized in this function This commit fixes it. Signed-off-by: Robert Lubos (cherry picked from commit 35502592a7c702954697660f390b46e4912f8c56) --- drivers/input/input_adc_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/input_adc_keys.c b/drivers/input/input_adc_keys.c index 2e24ffd097d..d37d79bf098 100644 --- a/drivers/input/input_adc_keys.c +++ b/drivers/input/input_adc_keys.c @@ -70,7 +70,7 @@ static inline int32_t adc_keys_read(const struct device *dev) static inline void adc_keys_process(const struct device *dev) { const struct adc_keys_config *cfg = dev->config; - int32_t sample_mv, closest_mv; + int32_t sample_mv, closest_mv = 0; uint32_t diff, closest_diff = UINT32_MAX; const struct adc_keys_code_config *code_cfg; struct adc_keys_key_state *key_state; From c20c5afe1fd6cbd301e16e12144e0956cee0c9e6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 7 Mar 2024 16:38:04 +0200 Subject: [PATCH 1413/2300] [nrf fromtree] posix: socket: Add missing recvmsg() The sys/socket.h was missing recently added recvmsg() call to net/socket.h Signed-off-by: Jukka Rissanen (cherry picked from commit b65b6a82082a5670c7462686e68e36cd8d254b87) Signed-off-by: Robert Lubos --- include/zephyr/posix/sys/socket.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/zephyr/posix/sys/socket.h b/include/zephyr/posix/sys/socket.h index af4f48e3907..235bd76cc59 100644 --- a/include/zephyr/posix/sys/socket.h +++ b/include/zephyr/posix/sys/socket.h @@ -88,6 +88,11 @@ static inline ssize_t sendmsg(int sock, const struct msghdr *message, return zsock_sendmsg(sock, message, flags); } +static inline ssize_t recvmsg(int sock, struct msghdr *msg, int flags) +{ + return zsock_recvmsg(sock, msg, flags); +} + static inline ssize_t recvfrom(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) { From 41b38928f63ed79960084cf415299703b44d870f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 7 Mar 2024 10:06:53 +0100 Subject: [PATCH 1414/2300] [nrf fromtree] tests: llext: Set min_ram requirement for readonly_mpu variant Set the minimal RAM requirement for the test variant, so that it does not get built for platforms it won't fit anyway. Signed-off-by: Robert Lubos (cherry picked from commit 328ff9ac454aeae3f04e87b17aab545744bc4fa9) --- tests/subsys/llext/hello_world/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/llext/hello_world/testcase.yaml b/tests/subsys/llext/hello_world/testcase.yaml index c977dc5f94f..2b324bea5ab 100644 --- a/tests/subsys/llext/hello_world/testcase.yaml +++ b/tests/subsys/llext/hello_world/testcase.yaml @@ -13,6 +13,7 @@ tests: - arch:arm:CONFIG_ARM_MPU=n - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.readonly_mpu: + min_ram: 128 arch_exclude: xtensa # for now filter: CONFIG_CPU_HAS_MPU extra_configs: From 18b88cb8aa8a88594594723c0c323eb5f6803659 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 8 Mar 2024 13:47:41 +0100 Subject: [PATCH 1415/2300] [nrf fromtree] manifest: Update nrf hw models to latest * Update the HW models module to 3925b7030736f25f45ceedc3621219125a2d4685 Including the following: * 3925b70: Add new API to convert real peripheral addr to simulated one * 319e3eb: nhw_convert_periph_base_addr: Fix include for nrf5340 Signed-off-by: Alberto Escolar Piedras (cherry picked from commit f6435e012ecc0819b0f6aaf060c385d6a88f10a0) Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f8e75062ad4..f9cf79db073 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 52d0b4b7b7431d8da6222cc3b17a8afdcb099baf + revision: 319e3ebd3134935c330980dfac53d05d28c0af9a path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: da78aea63159771956fe0c9263f2e6985b66e9d5 From a8da6e408aa22c5002557d0c55f0ed2c390dfbd0 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 8 Mar 2024 11:14:11 +0100 Subject: [PATCH 1416/2300] [nrf fromtree] drivers/counter nrfx: Fix with DT instance not matching device instance 478530ec0aa1fe5f481786c25d50f7a081b22208 introduced a bug where if the DT index while iterating its DT structure initialization does not match the actual peripheral instance, or if the device instance string is not just a simple integer, but a more complex string like "00", or "02", either the wrong peripheral address would be used, or the file would failt to compile. Let's fix this by reverting that change, and instead, for simulation converting the hardcoded DT/real HW address to the valid addr for simulation on the fly. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit f9d5e8458ce261d6c3574d50d3b16ea031419279) Signed-off-by: Robert Lubos --- drivers/counter/counter_nrfx_timer.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/counter/counter_nrfx_timer.c b/drivers/counter/counter_nrfx_timer.c index 47537b16d7d..1fe3a98f8d7 100644 --- a/drivers/counter/counter_nrfx_timer.c +++ b/drivers/counter/counter_nrfx_timer.c @@ -28,6 +28,12 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL); #define COUNTER_OVERFLOW_SHORT NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK #define COUNTER_READ_CC NRF_TIMER_CC_CHANNEL1 +#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX) +#define MAYBE_CONST_CONFIG +#else +#define MAYBE_CONST_CONFIG const +#endif + struct counter_nrfx_data { counter_top_callback_t top_cb; void *top_user_data; @@ -283,7 +289,16 @@ static uint32_t get_pending_int(const struct device *dev) static int init_timer(const struct device *dev, const struct counter_timer_config *config) { - const struct counter_nrfx_config *nrfx_config = dev->config; + MAYBE_CONST_CONFIG struct counter_nrfx_config *nrfx_config = + (MAYBE_CONST_CONFIG struct counter_nrfx_config *)dev->config; + +#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX) + /* For simulated devices we need to convert the hardcoded DT address from the real + * peripheral into the correct one for simulation + */ + nrfx_config->timer = nhw_convert_periph_base_addr(nrfx_config->timer); +#endif + NRF_TIMER_Type *reg = nrfx_config->timer; nrf_timer_bit_width_set(reg, config->bit_width); @@ -430,7 +445,7 @@ static const struct counter_driver_api counter_nrfx_driver_api = { static struct counter_nrfx_ch_data \ counter##idx##_ch_data[CC_TO_ID(DT_INST_PROP(idx, cc_num))]; \ LOG_INSTANCE_REGISTER(LOG_MODULE_NAME, idx, CONFIG_COUNTER_LOG_LEVEL); \ - static const struct counter_nrfx_config nrfx_counter_##idx##_config = { \ + static MAYBE_CONST_CONFIG struct counter_nrfx_config nrfx_counter_##idx##_config = { \ .info = { \ .max_top_value = (uint32_t)BIT64_MASK(DT_INST_PROP(idx, max_bit_width)),\ .freq = TIMER_CLOCK((NRF_TIMER_Type *)DT_INST_REG_ADDR(idx)) / \ @@ -439,7 +454,7 @@ static const struct counter_driver_api counter_nrfx_driver_api = { .channels = CC_TO_ID(DT_INST_PROP(idx, cc_num)), \ }, \ .ch_data = counter##idx##_ch_data, \ - .timer = (NRF_TIMER_Type *)_CONCAT(NRF_TIMER, idx), \ + .timer = (NRF_TIMER_Type *)DT_INST_REG_ADDR(idx), \ LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \ }; \ DEVICE_DT_INST_DEFINE(idx, \ From 38cf979136ece17b1e42010384e449645c268be5 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Fri, 15 Mar 2024 15:02:42 +0100 Subject: [PATCH 1417/2300] [nrf fromlist] scripts: pylib: twister: twisterlib: prevent empty gcda files In case of problem with parsing hex data from coverage dump, do not create empty gcda file. Such empty file will break gcovr parsing. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70297 Signed-off-by: Piotr Kosycarz --- scripts/pylib/twister/twisterlib/coverage.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/coverage.py b/scripts/pylib/twister/twisterlib/coverage.py index 556f5b359ba..90d523e793a 100644 --- a/scripts/pylib/twister/twisterlib/coverage.py +++ b/scripts/pylib/twister/twisterlib/coverage.py @@ -92,8 +92,9 @@ def create_gcda_files(extracted_coverage_info): continue try: + hex_bytes = bytes.fromhex(hexdump_val) with open(filename, 'wb') as fp: - fp.write(bytes.fromhex(hexdump_val)) + fp.write(hex_bytes) except ValueError: logger.exception("Unable to convert hex data for file: {}".format(filename)) gcda_created = False From fc3886f97f63a62a7d6e5f1f8621db297ad7ce21 Mon Sep 17 00:00:00 2001 From: Herman Berget Date: Mon, 18 Mar 2024 10:31:37 +0100 Subject: [PATCH 1418/2300] [nrf fromtree] samples: hci_uart_async: Dont try to receive 0 bytes It is not necessary and it ends up in an nrfx assert. Signed-off-by: Herman Berget (cherry picked from commit 976da5da5c0df600da199c8a622a43bc318162f8) Signed-off-by: Herman Berget --- samples/bluetooth/hci_uart_async/src/hci_uart_async.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 4d276e42378..cf9cc600d5c 100644 --- a/samples/bluetooth/hci_uart_async/src/hci_uart_async.c +++ b/samples/bluetooth/hci_uart_async/src/hci_uart_async.c @@ -254,7 +254,9 @@ static void h2c_h4_transport(void) LOG_DBG("h2c: payload_size %u", payload_size); - if (payload_size <= net_buf_tailroom(buf)) { + if (payload_size == 0) { + /* Done, dont rx zero bytes */ + } else if (payload_size <= net_buf_tailroom(buf)) { uint8_t *payload_dst = net_buf_add(buf, payload_size); err = uart_h2c_rx(payload_dst, payload_size); From 3b2bdcf3c698238a40ce79fcc580c27d41b56768 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 8 Mar 2024 16:01:11 +0100 Subject: [PATCH 1419/2300] [nrf fromtree] soc: nordic: nrf54l: Remove redundant option The option SOC_NRF54L_GLITCHDET_WORKAROUND is not needed anymore becuase the glitch detector is already disabled in the Nordic MDK in the hal_nordic repo. File path in hal_nordic: nrfx/mdk/system_nrf54l.c Signed-off-by: Georgios Vasilakis (cherry picked from commit 0bc547ea3bb3f2d254c0ecb0e06583f04be71366) --- soc/arm/nordic_nrf/nrf54l/Kconfig.soc | 6 ------ soc/arm/nordic_nrf/nrf54l/soc.c | 4 ---- 2 files changed, 10 deletions(-) diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc index c42c8cfc9b3..915b1e4b2d2 100644 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc @@ -47,12 +47,6 @@ config SOC_NRF54L_VREG_MAIN_DCDC config SOC_NRF54L_NORMAL_VOLTAGE_MODE bool "NRF54L Normal Voltage Mode." -config SOC_NRF54L_GLITCHDET_WORKAROUND - bool "Workaround that disables glitch detector" - default y - help - Temporary workaround - disabling glitch detector to limit power consumption. - if NRF_GRTC_TIMER config ELV_GRTC_LFXO_ALLOWED diff --git a/soc/arm/nordic_nrf/nrf54l/soc.c b/soc/arm/nordic_nrf/nrf54l/soc.c index a7b286fa048..6af0ff4ebcd 100644 --- a/soc/arm/nordic_nrf/nrf54l/soc.c +++ b/soc/arm/nordic_nrf/nrf54l/soc.c @@ -42,10 +42,6 @@ static int nordicsemi_nrf54l_init(void) /* Enable ICACHE */ sys_cache_instr_enable(); - if (IS_ENABLED(CONFIG_SOC_NRF54L_GLITCHDET_WORKAROUND)) { - nrf_glitchdet_enable_set(NRF_GLITCHDET, false); - } - #if DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, internal) uint32_t xosc32ktrim = NRF_FICR->XOSC32KTRIM; From a1ff51de6be0cf34387a1e6fea3811196768101d Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 8 Mar 2024 13:26:21 +0100 Subject: [PATCH 1420/2300] [nrf fromlist] soc: nordic: Refactor soc_secure.h The soc_secure_* function are used by the non-secure application to access hardware resources which are mapped as secure. Using these functions for hardware resources mapped as non-secure is missleading. We have some soc_secure_* functions which read FICR values. In nRF91 and nRF53 platforms this made sense since FICR has hardware fixed mapping as secure. For nRF54 though the FICR has hardware fixed mapping as non-secure. This change refactors the soc_secure.h to exclude the functions which read FICR values from being included when FICR is mapped as non-secure. Also updates the hwinfo and ieee802154 drivers to adjust to this change. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69968 Signed-off-by: Georgios Vasilakis --- drivers/hwinfo/hwinfo_nrf.c | 12 ++++- drivers/ieee802154/ieee802154_nrf5.c | 11 +++++ soc/arm/nordic_nrf/common/soc_secure.h | 64 +++++++++++++------------- 3 files changed, 54 insertions(+), 33 deletions(-) diff --git a/drivers/hwinfo/hwinfo_nrf.c b/drivers/hwinfo/hwinfo_nrf.c index 4375cf05b2f..8b644f2f60e 100644 --- a/drivers/hwinfo/hwinfo_nrf.c +++ b/drivers/hwinfo/hwinfo_nrf.c @@ -7,12 +7,17 @@ #include #include #include -#include #include #ifndef CONFIG_BOARD_QEMU_CORTEX_M0 #include #endif + +#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) #include +#else +#include +#endif + struct nrf_uid { uint32_t id[2]; }; @@ -22,7 +27,12 @@ ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length) struct nrf_uid dev_id; uint32_t deviceid[2]; +#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) soc_secure_read_deviceid(deviceid); +#else + deviceid[0] = nrf_ficr_deviceid_get(NRF_FICR, 0); + deviceid[1] = nrf_ficr_deviceid_get(NRF_FICR, 1); +#endif dev_id.id[0] = sys_cpu_to_be32(deviceid[1]); dev_id.id[1] = sys_cpu_to_be32(deviceid[0]); diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 67b5431e9cc..4cbdd9eb607 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -25,7 +25,13 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include + +#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) #include +#else +#include +#endif + #include #include #include @@ -120,7 +126,12 @@ static void nrf5_get_eui64(uint8_t *mac) mac[index++] = (IEEE802154_NRF5_VENDOR_OUI >> 8) & 0xff; mac[index++] = IEEE802154_NRF5_VENDOR_OUI & 0xff; +#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) soc_secure_read_deviceid(deviceid); +#else + deviceid[0] = nrf_ficr_deviceid_get(NRF_FICR, 0); + deviceid[1] = nrf_ficr_deviceid_get(NRF_FICR, 1); +#endif factoryAddress = (uint64_t)deviceid[EUI64_ADDR_HIGH] << 32; factoryAddress |= deviceid[EUI64_ADDR_LOW]; diff --git a/soc/arm/nordic_nrf/common/soc_secure.h b/soc/arm/nordic_nrf/common/soc_secure.h index d38d66ab488..28d18e9b4bb 100644 --- a/soc/arm/nordic_nrf/common/soc_secure.h +++ b/soc/arm/nordic_nrf/common/soc_secure.h @@ -9,20 +9,44 @@ #include #if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) +int soc_secure_mem_read(void *dst, void *src, size_t len); #if NRF_GPIO_HAS_SEL void soc_secure_gpio_pin_mcu_select(uint32_t pin_number, nrf_gpio_pin_sel_t mcu); #endif -int soc_secure_mem_read(void *dst, void *src, size_t len); +#else /* defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ +static inline int soc_secure_mem_read(void *dst, void *src, size_t len) +{ + (void)memcpy(dst, src, len); + return 0; +} +#if NRF_GPIO_HAS_SEL +static inline void soc_secure_gpio_pin_mcu_select(uint32_t pin_number, nrf_gpio_pin_sel_t mcu) +{ + nrf_gpio_pin_control_select(pin_number, mcu); +} +#endif /* NRF_GPIO_HAS_SEL */ + +#endif /* defined CONFIG_TRUSTED_EXECUTION_NONSECURE */ +/* Include these soc_secure_* functions only when the FICR is mapped as secure only */ +#if defined(NRF_FICR_S) +#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) +static inline void soc_secure_read_deviceid(uint32_t deviceid[2]) +{ + int err; + + err = soc_secure_mem_read(deviceid, (void *)&NRF_FICR_S->INFO.DEVICEID, + 2 * sizeof(uint32_t)); + __ASSERT(err == 0, "Secure read error (%d)", err); +} #if defined(CONFIG_SOC_HFXO_CAP_INTERNAL) static inline uint32_t soc_secure_read_xosc32mtrim(void) { uint32_t xosc32mtrim; int err; - err = soc_secure_mem_read(&xosc32mtrim, - (void *)&NRF_FICR_S->XOSC32MTRIM, + err = soc_secure_mem_read(&xosc32mtrim, (void *)&NRF_FICR_S->XOSC32MTRIM, sizeof(xosc32mtrim)); __ASSERT(err == 0, "Secure read error (%d)", err); @@ -30,42 +54,18 @@ static inline uint32_t soc_secure_read_xosc32mtrim(void) } #endif /* defined(CONFIG_SOC_HFXO_CAP_INTERNAL) */ -static inline void soc_secure_read_deviceid(uint32_t deviceid[2]) -{ - int err; - - err = soc_secure_mem_read(deviceid, - (void *)&NRF_FICR_S->INFO.DEVICEID, - 2 * sizeof(uint32_t)); - __ASSERT(err == 0, "Secure read error (%d)", err); -} - #else /* defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ - -static inline int soc_secure_mem_read(void *dst, void *src, size_t len) -{ - (void)memcpy(dst, src, len); - return 0; -} - -#if NRF_GPIO_HAS_SEL -static inline void soc_secure_gpio_pin_mcu_select(uint32_t pin_number, - nrf_gpio_pin_sel_t mcu) +static inline void soc_secure_read_deviceid(uint32_t deviceid[2]) { - nrf_gpio_pin_control_select(pin_number, mcu); + deviceid[0] = nrf_ficr_deviceid_get(NRF_FICR_S, 0); + deviceid[1] = nrf_ficr_deviceid_get(NRF_FICR_S, 1); } -#endif /* NRF_GPIO_HAS_SEL */ - #if defined(CONFIG_SOC_HFXO_CAP_INTERNAL) static inline uint32_t soc_secure_read_xosc32mtrim(void) { - return NRF_FICR->XOSC32MTRIM; + return NRF_FICR_S->XOSC32MTRIM; } #endif /* defined(CONFIG_SOC_HFXO_CAP_INTERNAL) */ -static inline void soc_secure_read_deviceid(uint32_t deviceid[2]) -{ - deviceid[0] = nrf_ficr_deviceid_get(NRF_FICR, 0); - deviceid[1] = nrf_ficr_deviceid_get(NRF_FICR, 1); -} #endif /* defined CONFIG_TRUSTED_EXECUTION_NONSECURE */ +#endif /* defined(NRF_FICR_S) */ From f03e194923c1403b9cb9a423d6d2b5d9cf5553f3 Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 12 Mar 2024 17:32:53 +0100 Subject: [PATCH 1421/2300] [nrf fromtree] soc: nordic: nrf54l: add two new Kconfig options Add SOC_NRF54LX_DISABLE_FICR_TRIMCNF and SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE config options. Signed-off-by: Magdalena Pastula (cherry picked from commit b0b4bc0517d801d2d21b7c0860d5bf4677451817) --- soc/arm/nordic_nrf/nrf54l/Kconfig.soc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc index 915b1e4b2d2..18c2517df92 100644 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc @@ -31,6 +31,22 @@ config SOC_NRF54LX_SKIP_CLOCK_CONFIG With this option, the CPU clock frequency is not set during system initialization. The CPU runs with the default, hardware-selected frequency. +config SOC_NRF54LX_DISABLE_FICR_TRIMCNF + bool "Disable trimming of the device" + default y if TRUSTED_EXECUTION_NONSECURE + help + Disable trimming of the device. When the device is trimmed it + will copy all the trimming values from FICR into the target + addresses. When TF-M is enabled it will trim the device before + booting this image. + +config SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE + bool "Skip disabling glitch detector" + default n + help + With this option, the glitch detector is not disabled during system initialization. + The CPU runs with the default state of glitch detector. + config SOC_NRF_FORCE_CONSTLAT bool "Force constant-latency mode" help From 55663b1e4975a97626257a4feb67a6909800826c Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Tue, 12 Mar 2024 17:33:59 +0100 Subject: [PATCH 1422/2300] [nrf fromtree] modules: hal_nordic: nrfx: propagate new configs to nrfx Add support for propagating SOC_NRF54LX_DISABLE_FICR_TRIMCNF and SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE values to nrfx. Signed-off-by: Magdalena Pastula (cherry picked from commit 92f1b3ff96901a706bc5b144281117ddab6311a5) --- modules/hal_nordic/nrfx/CMakeLists.txt | 2 ++ soc/arm/nordic_nrf/nrf54l/Kconfig.soc | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 13ee18db7a6..597c91dbad9 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -157,6 +157,8 @@ if(CONFIG_SOC_NRF54L15) endif() zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_CLOCK_CONFIGURATION) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_DISABLE_FICR_TRIMCNF NRF_DISABLE_FICR_TRIMCNF) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE NRF_SKIP_GLITCHDETECTOR_DISABLE) if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib_lumos.c) diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc index 18c2517df92..f8eadd1388d 100644 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc @@ -37,12 +37,11 @@ config SOC_NRF54LX_DISABLE_FICR_TRIMCNF help Disable trimming of the device. When the device is trimmed it will copy all the trimming values from FICR into the target - addresses. When TF-M is enabled it will trim the device before - booting this image. + addresses. config SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE bool "Skip disabling glitch detector" - default n + default y if TRUSTED_EXECUTION_NONSECURE help With this option, the glitch detector is not disabled during system initialization. The CPU runs with the default state of glitch detector. From 05ff843b520258dbd35e984e947104b846fe65ca Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Fri, 15 Mar 2024 21:14:52 +0100 Subject: [PATCH 1423/2300] [nrf noup] modules: mbedtls: add PSA configurations fixup! [nrf noup] modules: mbedtls: add PSA configurations PSA_HAS_KEY_AGREEMENT needs to be selected if at least one of the two key agreement algorithms ECDH/FFDH is enabled. Ref: NCSDK-26277 Signed-off-by: Georgios Vasilakis --- modules/mbedtls/Kconfig.psa | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa index bbd60a9e8d8..9a0be3c4063 100644 --- a/modules/mbedtls/Kconfig.psa +++ b/modules/mbedtls/Kconfig.psa @@ -517,8 +517,7 @@ menu "PSA Key agreement support" config PSA_HAS_KEY_AGREEMENT bool default y - depends on PSA_WANT_ALG_ECDH - depends on PSA_WANT_ALG_FFDH + depends on PSA_WANT_ALG_ECDH || PSA_WANT_ALG_FFDH help Promt-less configuration that states that key agreement is supported. From a55a68f01811d66b52ce9d0e82744d78792db3c1 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Wed, 20 Mar 2024 12:10:13 +0100 Subject: [PATCH 1424/2300] [nrf noup] samples: smp_svr: configuration for nrf54l15 Configuration allows DFU with serial transport using mcumgr and over BT using nRF Connect. Signed-off-by: Mateusz Michalek --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index a13270e5845..373c3acccb9 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -12,9 +12,11 @@ tests: - nrf52840dk_nrf52840 - pinnacle_100_dvk - mg100 + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf52dk_nrf52832 - nrf52840dk_nrf52840 + - nrf54l15pdk_nrf54l15_cpuapp sample.mcumgr.smp_svr.udp: extra_args: OVERLAY_CONFIG="overlay-udp.conf" platform_allow: frdm_k64f From 5dd838f21312d6bc88c2acc51d96f8f4938abefe Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 4 Mar 2024 11:20:05 +0100 Subject: [PATCH 1425/2300] [nrf fromlist] soc: nordic: vpr: always select HAS_FLASH_LOAD_OFFSET MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While not needed when XIP=n, it can be still be selected so that come defconfigs are simplified. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 895f2f0e659f289518568f887f861ba233696a31) Signed-off-by: Andrzej Głąbek Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69747 --- soc/riscv/nordic_nrf/common/vpr/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig index 70ac63e7204..baef3432a90 100644 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig @@ -14,6 +14,6 @@ config RISCV_CORE_NORDIC_VPR select RISCV_ISA_EXT_ZIFENCEI select RISCV_SOC_HAS_ISR_STACKING select RISCV_SOC_CONTEXT_SAVE - select HAS_FLASH_LOAD_OFFSET if XIP + select HAS_FLASH_LOAD_OFFSET help Enable support for the RISC-V Nordic VPR core. From 3c4c757e6f0a1df5de4b0f285b1dcf4ab67429e4 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 8 Mar 2024 12:35:22 +0100 Subject: [PATCH 1426/2300] [nrf fromtree] manifest: hal_nordic: update revision to have nrfx 3.4.0 release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New hal_nordic revision contains nrfx 3.4.0 which adds support for nRF54H20 and nRF54L15 devices. Signed-off-by: Nikodem Kastelik (cherry picked from commit e36d15c971c3102ce6b45ae8b89b60c76121c69d) Signed-off-by: Andrzej Głąbek --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f9cf79db073..9c375a568fe 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 5470822384781624efb2fda28cbc6a895a227677 + revision: 13ac55b5b52c905642e9c54f069109d188aa5840 path: modules/hal/nordic groups: - hal From 4580e21835ab345eff1ab258d60058e97e003b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 12 Mar 2024 12:11:57 +0100 Subject: [PATCH 1427/2300] [nrf fromtree] drivers: nrf_qspi_nor: Handle anomaly 159 on nRF5340 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nrfx_qspi driver in nrfx 3.4.0 started checking conditions that could trigger anomaly 159 on nRF5340 so make sure that QSPI transfers are only performed with properly configured clocks (PCLK192M undivided and HCLK128M divided by 2). Signed-off-by: Andrzej Głąbek (cherry picked from commit cb6f44c3b966be0953f4794e729c7fbe3053b0ed) --- drivers/flash/nrf_qspi_nor.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index c0e8c397d8e..c2ac5f3f3ba 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -21,6 +21,7 @@ LOG_MODULE_REGISTER(qspi_nor, CONFIG_FLASH_LOG_LEVEL); #include "spi_nor.h" #include "jesd216.h" #include "flash_priv.h" +#include #include #include #include @@ -101,6 +102,11 @@ BUILD_ASSERT(INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), /* 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 +/* If anomaly 159 is to be prevented, only /1 divider can be used. */ +#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)) /* For 96 MHz > SCK >= 48 MHz, use HFCLK192M / 2 / (2*1) = 48 MHz */ #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_2 @@ -115,6 +121,13 @@ BUILD_ASSERT(INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), #define INST_0_SCK_CFG (DIV_ROUND_UP(NRF_QSPI_BASE_CLOCK_FREQ / 2, \ INST_0_SCK_FREQUENCY) - 1) #endif +/* After the base clock divider is changed, some time is needed for the new + * setting to take effect. This value specifies the delay (in microseconds) + * to be applied to ensure that the clock is ready when the QSPI operation + * 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 #else /* @@ -230,6 +243,12 @@ static inline int qspi_get_zephyr_ret_code(nrfx_err_t res) return -EINVAL; case NRFX_ERROR_INVALID_STATE: return -ECANCELED; +#if NRF53_ERRATA_159_ENABLE_WORKAROUND + case NRFX_ERROR_FORBIDDEN: + LOG_ERR("nRF5340 anomaly 159 conditions detected"); + LOG_ERR("Set the CPU clock to 64 MHz before starting QSPI operation"); + return -ECANCELED; +#endif case NRFX_ERROR_BUSY: case NRFX_ERROR_TIMEOUT: default: @@ -262,6 +281,7 @@ static inline void qspi_clock_div_change(void) * before a QSPI transfer is performed. */ nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); + k_busy_wait(BASE_CLOCK_SWITCH_DELAY_US); #endif } From bdde95118bce09fa620c83d9b8bff6959077a2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 11 Mar 2024 12:53:48 +0100 Subject: [PATCH 1428/2300] [nrf fromtree] modules: hal_nordic: Align nRF54H20 nrfx_configs with nrfx templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add new entries that appeared in nrfx 3.4.0 - correct the default IRQ priority value for PPR (it is intended to be the lowest prority, so unlike for ARM cores, for RISC-V it should be the lowest value) Signed-off-by: Andrzej Głąbek (cherry picked from commit e3d7c3b6e91aa4ce544ff581226391567a4cc6db) --- .../nrfx_config_nrf54h20_enga_application.h | 27 +++++++++++++++++ .../nrfx/nrfx_config_nrf54h20_enga_ppr.h | 29 ++++++++++++++++++- .../nrfx_config_nrf54h20_enga_radiocore.h | 27 +++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h index e6c79341b9a..af74d9d3dc3 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h @@ -331,6 +331,33 @@ #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 +#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_NUM_OF_CC_CHANNELS * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h index 369fe18a81f..65b3e2fa958 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h @@ -18,7 +18,7 @@ * Integer value. Minimum: 0. Maximum: 3. */ #ifndef NRFX_DEFAULT_IRQ_PRIORITY -#define NRFX_DEFAULT_IRQ_PRIORITY 3 +#define NRFX_DEFAULT_IRQ_PRIORITY 0 #endif /** @@ -277,6 +277,33 @@ #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 +#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_NUM_OF_CC_CHANNELS * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h index 7b9a1c4b733..ca7bf3aca63 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h @@ -385,6 +385,33 @@ #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 +#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_NUM_OF_CC_CHANNELS * From bfc54995e2c166f73838411a0048ba229869ca85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 12 Mar 2024 16:19:55 +0100 Subject: [PATCH 1429/2300] [nrf fromtree] drivers: pinctrl_nrf: Set clockpin bitfield when necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For certain peripheral signal lines in nRF54H20, it is required to set the clockpin bitfield for pins assigned to them, otherwise the peripheral may not work properly, for example, there will be no output from UART. Signed-off-by: Andrzej Głąbek (cherry picked from commit e977a8d623865ad0c31dd9b32d7afb186c51dbc6) --- drivers/pinctrl/pinctrl_nrf.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 12ee1d52294..950037bc8ab 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -40,16 +40,19 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_uart) #define NRF_PSEL_UART(reg, line) ((NRF_UART_Type *)reg)->PSEL##line #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_uarte) +#include #define NRF_PSEL_UART(reg, line) ((NRF_UARTE_Type *)reg)->PSEL.line #endif #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spi) #define NRF_PSEL_SPIM(reg, line) ((NRF_SPI_Type *)reg)->PSEL##line #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spim) +#include #define NRF_PSEL_SPIM(reg, line) ((NRF_SPIM_Type *)reg)->PSEL.line #endif #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spis) +#include #if defined(NRF51) #define NRF_PSEL_SPIS(reg, line) ((NRF_SPIS_Type *)reg)->PSEL##line #else @@ -64,6 +67,7 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { #define NRF_PSEL_TWIM(reg, line) ((NRF_TWI_Type *)reg)->PSEL.line #endif #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_twim) +#include #define NRF_PSEL_TWIM(reg, line) ((NRF_TWIM_Type *)reg)->PSEL.line #endif @@ -97,6 +101,9 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uint32_t write = NO_WRITE; nrf_gpio_pin_dir_t dir; nrf_gpio_pin_input_t input; +#if NRF_GPIO_HAS_CLOCKPIN + bool clockpin = false; +#endif if (drive_idx < ARRAY_SIZE(drive_modes)) { drive = drive_modes[drive_idx]; @@ -115,6 +122,9 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, write = 1U; dir = NRF_GPIO_PIN_DIR_OUTPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; +#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_UARTE_CLOCKPIN_TXD_NEEDED) + clockpin = true; +#endif break; case NRF_FUN_UART_RX: NRF_PSEL_UART(reg, RXD) = psel; @@ -126,6 +136,9 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, write = 1U; dir = NRF_GPIO_PIN_DIR_OUTPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; +#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_UARTE_CLOCKPIN_RTS_NEEDED) + clockpin = true; +#endif break; case NRF_FUN_UART_CTS: NRF_PSEL_UART(reg, CTS) = psel; @@ -139,12 +152,18 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, write = 0U; dir = NRF_GPIO_PIN_DIR_OUTPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; +#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_SPIM_CLOCKPIN_SCK_NEEDED) + clockpin = true; +#endif break; case NRF_FUN_SPIM_MOSI: NRF_PSEL_SPIM(reg, MOSI) = psel; write = 0U; dir = NRF_GPIO_PIN_DIR_OUTPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; +#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_SPIM_CLOCKPIN_MOSI_NEEDED) + clockpin = true; +#endif break; case NRF_FUN_SPIM_MISO: NRF_PSEL_SPIM(reg, MISO) = psel; @@ -157,6 +176,9 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, NRF_PSEL_SPIS(reg, SCK) = psel; dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; +#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_SPIS_CLOCKPIN_SCK_NEEDED) + clockpin = true; +#endif break; case NRF_FUN_SPIS_MOSI: NRF_PSEL_SPIS(reg, MOSI) = psel; @@ -167,6 +189,9 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, NRF_PSEL_SPIS(reg, MISO) = psel; dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; +#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_SPIS_CLOCKPIN_MISO_NEEDED) + clockpin = true; +#endif break; case NRF_FUN_SPIS_CSN: NRF_PSEL_SPIS(reg, CSN) = psel; @@ -188,6 +213,9 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, } dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; +#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_TWIM_CLOCKPIN_SCL_NEEDED) + clockpin = true; +#endif break; case NRF_FUN_TWIM_SDA: NRF_PSEL_TWIM(reg, SDA) = psel; @@ -196,6 +224,9 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, } dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; +#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_TWIM_CLOCKPIN_SDA_NEEDED) + clockpin = true; +#endif break; #endif /* defined(NRF_PSEL_TWIM) */ #if defined(NRF_PSEL_I2S) @@ -348,6 +379,9 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, nrf_gpio_cfg(pin, dir, input, NRF_GET_PULL(pins[i]), drive, NRF_GPIO_PIN_NOSENSE); +#if NRF_GPIO_HAS_CLOCKPIN + nrf_gpio_pin_clock_set(pin, clockpin); +#endif } } From 32eaa669cbd1c32af67cf81466dba899223303a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 11 Mar 2024 12:54:43 +0100 Subject: [PATCH 1430/2300] [nrf fromlist] soc: nordic: Add initial support for nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Kconfig symbols that allow building for the nRF54H20 (not EngA) SoC. Signed-off-by: Andrzej Głąbek (cherry picked from commit 4011015fb4eb7fb6127a2dccce95d5de97fb081c) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 6 +++--- .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 6 +++--- .../Kconfig.defconfig.nrf54h20_enga_cpuapp | 17 +++++++++++++++++ .../Kconfig.defconfig.nrf54h20_enga_cpurad | 17 +++++++++++++++++ soc/arm/nordic_nrf/nrf54h/Kconfig.soc | 16 ++++++++++++++++ .../nordic_nrf/common/vpr/Kconfig.defconfig | 2 +- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuppr | 15 +++++++++++++++ soc/riscv/nordic_nrf/nrf54h/Kconfig.soc | 4 ++++ 8 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp create mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad create mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index d90f87c0b89..007035c0f48 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -3,10 +3,10 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_ENGA_CPUAPP +if SOC_NRF54H20_CPUAPP config SOC - default "nrf54h20_enga_cpuapp" + default "nrf54h20_cpuapp" config NUM_IRQS default 471 @@ -14,4 +14,4 @@ config NUM_IRQS config NRF_REGTOOL_GENERATE_UICR default y -endif # SOC_NRF54H20_ENGA_CPUAPP +endif # SOC_NRF54H20_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad index 6aae8c3a105..0f9e4c7e102 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -3,10 +3,10 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_ENGA_CPURAD +if SOC_NRF54H20_CPURAD config SOC - default "nrf54h20_enga_cpurad" + default "nrf54h20_cpurad" config NUM_IRQS default 471 @@ -14,4 +14,4 @@ config NUM_IRQS config NRF_REGTOOL_GENERATE_UICR default y -endif # SOC_NRF54H20_ENGA_CPURAD +endif # SOC_NRF54H20_CPURAD diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp new file mode 100644 index 00000000000..d90f87c0b89 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp @@ -0,0 +1,17 @@ +# Nordic Semiconductor nRF54H20 Application MCU + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54H20_ENGA_CPUAPP + +config SOC + default "nrf54h20_enga_cpuapp" + +config NUM_IRQS + default 471 + +config NRF_REGTOOL_GENERATE_UICR + default y + +endif # SOC_NRF54H20_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad new file mode 100644 index 00000000000..6aae8c3a105 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad @@ -0,0 +1,17 @@ +# Nordic Semiconductor nRF54H20 Radio MCU + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54H20_ENGA_CPURAD + +config SOC + default "nrf54h20_enga_cpurad" + +config NUM_IRQS + default 471 + +config NRF_REGTOOL_GENERATE_UICR + default y + +endif # SOC_NRF54H20_ENGA_CPURAD diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc index 9c065e79eaf..32256a809a9 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc @@ -12,6 +12,22 @@ if SOC_NRF54H20 choice prompt "nRF54H20 MCU Selection" +config SOC_NRF54H20_CPUAPP + bool "nRF54H20 CPUAPP" + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_DCACHE + select CPU_HAS_ICACHE + select CPU_HAS_FPU + +config SOC_NRF54H20_CPURAD + bool "nRF54H20 CPURAD" + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_DCACHE + select CPU_HAS_ICACHE + select CPU_HAS_FPU + config SOC_NRF54H20_ENGA_CPUAPP bool "nRF54H20 ENGA CPUAPP" select CPU_HAS_ARM_MPU diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig index f0014455b3a..a89593170f6 100644 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig @@ -5,7 +5,7 @@ CPU_PATH := $(dt_nodelabel_path,cpu) CPU_ID := $(dt_node_reg_addr_int,$(CPU_PATH)) config RV_BOOT_HART - default $(CPU_ID) + default $(CPU_ID) if SOC_NRF54H20_ENGA_CPUPPR config RISCV_MCAUSE_EXCEPTION_MASK default 0xFFF diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr new file mode 100644 index 00000000000..caecd6ad0eb --- /dev/null +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54H20_CPUPPR + +config SOC + default "nrf54h20_cpuppr" + +config NUM_IRQS + default 496 + +config SYS_CLOCK_TICKS_PER_SEC + default 1000 + +endif # SOC_NRF54H20_CPUPPR diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc index 760e05a0e64..47138277fce 100644 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc @@ -10,6 +10,10 @@ if SOC_NRF54H20 choice prompt "nRF54Hx MCU Selection" +config SOC_NRF54H20_CPUPPR + bool "nRF54H20 CPUPPR" + select RISCV + config SOC_NRF54H20_ENGA_CPUPPR bool "nRF54H20 ENGA CPUPPR" depends on RISCV_CORE_NORDIC_VPR From e1ac501f97385e95f120a27508ad59585ddc9970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 11 Mar 2024 12:54:25 +0100 Subject: [PATCH 1431/2300] [nrf fromtree] dts: nordic: Add initial support for nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add definition of the nRF54H20 SoC with its Application, Radio, and Peripheral Processor (PPR) cores and an initial set of peripherals. Signed-off-by: Andrzej Głąbek (cherry picked from commit 029081a3f7a81a31f2cd5afffaa1190f8045c275) --- dts/arm/nordic/nrf54h20_cpuapp.dtsi | 51 + dts/arm/nordic/nrf54h20_cpurad.dtsi | 51 + dts/common/nordic/nrf54h20.dtsi | 948 ++++++++++++++++++ dts/riscv/nordic/nrf54h20_cpuppr.dtsi | 48 + .../misc/nordic-nrf-ficr-nrf54h20.h | 85 ++ 5 files changed, 1183 insertions(+) create mode 100644 dts/arm/nordic/nrf54h20_cpuapp.dtsi create mode 100644 dts/arm/nordic/nrf54h20_cpurad.dtsi create mode 100644 dts/common/nordic/nrf54h20.dtsi create mode 100644 dts/riscv/nordic/nrf54h20_cpuppr.dtsi create mode 100644 include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20.h diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi new file mode 100644 index 00000000000..d82c69262c0 --- /dev/null +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuapp {}; +systick: &cpuapp_systick {}; +nvic: &cpuapp_nvic {}; +cpuppr_vevif: &cpuppr_vevif_remote {}; + +/delete-node/ &cpuppr; +/delete-node/ &cpurad; +/delete-node/ &cpurad_peripherals; +/delete-node/ &cpurad_ppb; +/delete-node/ &cpurad_ram0; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuapp_nvic>; + ranges; + }; +}; + +&cpuapp_ppb { + compatible = "simple-bus"; + ranges; +}; + +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-local"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&gpiote130 { + interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&grtc { + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi new file mode 100644 index 00000000000..2f463f2d427 --- /dev/null +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpurad {}; +systick: &cpurad_systick {}; +nvic: &cpurad_nvic {}; +cpuppr_vevif: &cpuppr_vevif_remote {}; + +/delete-node/ &cpuapp; +/delete-node/ &cpuapp_peripherals; +/delete-node/ &cpuapp_ppb; +/delete-node/ &cpuapp_ram0; +/delete-node/ &cpuppr; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpurad_nvic>; + ranges; + }; +}; + +&cpurad_ppb { + compatible = "simple-bus"; + ranges; +}; + +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-local"; +}; + +&gpiote130 { + interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&grtc { + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi new file mode 100644 index 00000000000..78e4c5b6549 --- /dev/null +++ b/dts/common/nordic/nrf54h20.dtsi @@ -0,0 +1,948 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include + +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 2 +#define NRF_DOMAIN_ID_RADIOCORE 3 +#define NRF_DOMAIN_ID_GLOBALFAST 12 +#define NRF_DOMAIN_ID_GLOBALSLOW 13 + +/delete-node/ &sw_pwm; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpuapp: cpu@2 { + compatible = "arm,cortex-m33"; + reg = <2>; + device_type = "cpu"; + clock-frequency = ; + }; + + cpurad: cpu@3 { + compatible = "arm,cortex-m33"; + reg = <3>; + device_type = "cpu"; + clock-frequency = ; + }; + + cpuppr: cpu@d { + compatible = "nordic,vpr"; + reg = <13>; + device_type = "cpu"; + clock-frequency = ; + riscv,isa = "rv32emc"; + nordic,bus-width = <32>; + + cpuppr_vevif_local: mailbox { + compatible = "nordic,nrf-vevif-local"; + status = "disabled"; + interrupt-parent = <&cpuppr_clic>; + interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, + <1 NRF_DEFAULT_IRQ_PRIORITY>, + <2 NRF_DEFAULT_IRQ_PRIORITY>, + <3 NRF_DEFAULT_IRQ_PRIORITY>, + <4 NRF_DEFAULT_IRQ_PRIORITY>, + <5 NRF_DEFAULT_IRQ_PRIORITY>, + <6 NRF_DEFAULT_IRQ_PRIORITY>, + <7 NRF_DEFAULT_IRQ_PRIORITY>, + <8 NRF_DEFAULT_IRQ_PRIORITY>, + <9 NRF_DEFAULT_IRQ_PRIORITY>, + <10 NRF_DEFAULT_IRQ_PRIORITY>, + <11 NRF_DEFAULT_IRQ_PRIORITY>, + <12 NRF_DEFAULT_IRQ_PRIORITY>, + <13 NRF_DEFAULT_IRQ_PRIORITY>, + <14 NRF_DEFAULT_IRQ_PRIORITY>, + <15 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask = <0xfffffff0>; + }; + }; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + + cpurad_uicr_ext: memory@e1ff000 { + reg = <0xe1ff000 DT_SIZE_K(2)>; + }; + + cpuapp_uicr_ext: memory@e1ff800 { + reg = <0xe1ff800 DT_SIZE_K(2)>; + }; + }; + + clocks { + fll16m: fll16m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + + mram1x: mram@e000000 { + compatible = "nordic,mram"; + reg = <0xe000000 DT_SIZE_K(2048)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + + cpuapp_uicr: uicr@fff8000 { + 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 { + compatible = "nordic,nrf-ficr"; + reg = <0xfffe000 DT_SIZE_K(2)>; + #nordic,ficr-cells = <1>; + }; + + cpuapp_ram0: sram@22000000 { + compatible = "mmio-sram"; + reg = <0x22000000 DT_SIZE_K(32)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x22000000 0x8000>; + }; + + cpurad_ram0: sram@23000000 { + compatible = "mmio-sram"; + reg = <0x23000000 DT_SIZE_K(192)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x23000000 0x30000>; + }; + + cpuapp_peripherals: peripheral@52000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x52000000 0x1000000>; + + cpuapp_hsfll: clock@d000 { + compatible = "nordic,nrf-hsfll"; + #clock-cells = <0>; + reg = <0xd000 0x1000>; + clocks = <&fll16m>; + clock-frequency = ; + nordic,ficrs = + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; + nordic,ficr-names = "vsup", "coarse", "fine"; + }; + + cpuapp_ipct: ipct@13000 { + compatible = "nordic,nrf-ipct-local"; + reg = <0x13000 0x1000>; + status = "disabled"; + channels = <4>; + interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, + <65 NRF_DEFAULT_IRQ_PRIORITY>; + }; + }; + + cpurad_peripherals: peripheral@53000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x53000000 0x1000000>; + + cpurad_hsfll: clock@d000 { + compatible = "nordic,nrf-hsfll"; + #clock-cells = <0>; + reg = <0xd000 0x1000>; + clocks = <&fll16m>; + clock-frequency = ; + nordic,ficrs = + <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP>, + <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1>, + <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1>; + nordic,ficr-names = "vsup", "coarse", "fine"; + }; + + dppic020: dppic@22000 { + compatible = "nordic,nrf-dppic-local"; + reg = <0x22000 0x1000>; + status = "disabled"; + }; + + cpurad_ipct: ipct@24000 { + compatible = "nordic,nrf-ipct-local"; + reg = <0x24000 0x1000>; + status = "disabled"; + channels = <8>; + interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, + <65 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + egu020: egu@25000 { + compatible = "nordic,nrf-egu"; + reg = <0x25000 0x1000>; + status = "disabled"; + interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + timer020: timer@28000 { + compatible = "nordic,nrf-timer"; + reg = <0x28000 0x1000>; + status = "disabled"; + cc-num = <8>; + interrupts = <40 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer021: timer@29000 { + compatible = "nordic,nrf-timer"; + reg = <0x29000 0x1000>; + status = "disabled"; + cc-num = <8>; + interrupts = <41 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer022: timer@2a000 { + compatible = "nordic,nrf-timer"; + reg = <0x2a000 0x1000>; + status = "disabled"; + cc-num = <8>; + interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + rtc: rtc@2b000 { + compatible = "nordic,nrf-rtc"; + reg = <0x2b000 0x1000>; + status = "disabled"; + cc-num = <4>; + clock-frequency = <32768>; + interrupts = <43 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <1>; + }; + + radio: radio@2c000 { + compatible = "nordic,nrf-radio"; + reg = <0x2c000 0x1000>; + status = "disabled"; + ble-2mbps-supported; + ble-coded-phy-supported; + dfe-supported; + ieee802154-supported; + interrupts = <44 NRF_DEFAULT_IRQ_PRIORITY>; + + cpurad_ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; + }; + + ecb030: ecb@3b000 { + compatible = "nordic,nrf-ecb"; + reg = <0x3b000 0x1000>; + interrupts = <59 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + ccm031: ccm@3c000 { + compatible = "nordic,nrf-ccm"; + reg = <0x3c000 0x1000>; + interrupts = <60 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + ecb031: ecb@3d000 { + compatible = "nordic,nrf-ecb"; + reg = <0x3d000 0x1000>; + status = "disabled"; + interrupts = <61 NRF_DEFAULT_IRQ_PRIORITY>; + }; + }; + + global_peripherals: peripheral@5f000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x5f000000 0x1000000>; + + cpusec_bellboard: mailbox@99000 { + reg = <0x99000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + cpuapp_bellboard: mailbox@9a000 { + reg = <0x9a000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + cpurad_bellboard: mailbox@9b000 { + reg = <0x9b000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + ipct120: ipct@8d1000 { + compatible = "nordic,nrf-ipct-global"; + reg = <0x8d1000 0x1000>; + status = "disabled"; + channels = <8>; + global-domain-id = <12>; + }; + + dppic120: dppic@8e1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x8e1000 0x1000>; + status = "disabled"; + }; + + timer120: timer@8e2000 { + compatible = "nordic,nrf-timer"; + reg = <0x8e2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer121: timer@8e3000 { + compatible = "nordic,nrf-timer"; + reg = <0x8e3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + spi120: spi@8e6000 { + compatible = "nordic,nrf-spim"; + reg = <0x8e6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart120: uart@8e6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x8e6000 0x1000>; + status = "disabled"; + interrupts = <229 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + spi121: spi@8e7000 { + compatible = "nordic,nrf-spim"; + reg = <0x8e7000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <231 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + cpuppr_vpr: vpr@908000 { + compatible = "nordic,nrf-vpr-coprocessor"; + reg = <0x908000 0x1000>; + status = "disabled"; + cpu = <13>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x908000 0x4000>; + + cpuppr_vevif_remote: mailbox@0 { + compatible = "nordic,nrf-vevif-remote"; + reg = <0x0 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask = <0xfffffff0>; + }; + + cpuppr_clic: interrupt-controller@1000 { + compatible = "nordic,nrf-clic"; + reg = <0x1000 0x3000>; + status = "disabled"; + #interrupt-cells = <2>; + interrupt-controller; + #address-cells = <1>; + }; + }; + + ipct130: ipct@921000 { + compatible = "nordic,nrf-ipct-global"; + reg = <0x921000 0x1000>; + status = "disabled"; + channels = <8>; + global-domain-id = <13>; + }; + + dppic130: dppic@922000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x922000 0x1000>; + status = "disabled"; + }; + + rtc130: rtc@928000 { + compatible = "nordic,nrf-rtc"; + reg = <0x928000 0x1000>; + status = "disabled"; + cc-num = <4>; + clock-frequency = <32768>; + interrupts = <296 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <1>; + }; + + rtc131: rtc@929000 { + compatible = "nordic,nrf-rtc"; + reg = <0x929000 0x1000>; + status = "disabled"; + cc-num = <4>; + clock-frequency = <32768>; + interrupts = <297 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <1>; + }; + + wdt131: watchdog@92b000 { + compatible = "nordic,nrf-wdt"; + reg = <0x92b000 0x1000>; + status = "disabled"; + interrupts = <299 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + wdt132: watchdog@92c000 { + compatible = "nordic,nrf-wdt"; + reg = <0x92c000 0x1000>; + status = "disabled"; + interrupts = <300 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + gpiote130: gpiote@934000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x934000 0x1000>; + status = "disabled"; + instance = <130>; + }; + + gpio0: gpio@938000 { + compatible = "nordic,nrf-gpio"; + reg = <0x938000 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <12>; + port = <0>; + }; + + gpio1: gpio@938200 { + compatible = "nordic,nrf-gpio"; + reg = <0x938200 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <12>; + port = <1>; + }; + + gpio2: gpio@938400 { + compatible = "nordic,nrf-gpio"; + reg = <0x938400 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <12>; + port = <2>; + }; + + gpio6: gpio@938c00 { + compatible = "nordic,nrf-gpio"; + reg = <0x938c00 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + ngpios = <14>; + port = <6>; + }; + + gpio7: gpio@938e00 { + compatible = "nordic,nrf-gpio"; + reg = <0x938e00 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + ngpios = <8>; + port = <7>; + }; + + gpio9: gpio@939200 { + compatible = "nordic,nrf-gpio"; + reg = <0x939200 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <6>; + port = <9>; + }; + + dppic131: dppic@981000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x981000 0x1000>; + status = "disabled"; + }; + + comp: comparator@983000 { + compatible = "nordic,nrf-comp"; + reg = <0x983000 0x1000>; + status = "disabled"; + interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; + #io-channel-cells = <1>; + }; + + temp: temperature-sensor@984000 { + compatible = "nordic,nrf-temp"; + reg = <0x984000 0x1000>; + interrupts = <388 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + nfct: nfct@985000 { + compatible = "nordic,nrf-nfct"; + reg = <0x985000 0x1000>; + status = "disabled"; + interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + dppic132: dppic@991000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x991000 0x1000>; + status = "disabled"; + }; + + qdec130: qdec@994000 { + compatible = "nordic,nrf-qdec"; + reg = <0x994000 0x1000>; + status = "disabled"; + interrupts = <404 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + qdec131: qdec@995000 { + compatible = "nordic,nrf-qdec"; + reg = <0x995000 0x1000>; + status = "disabled"; + interrupts = <405 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + grtc: grtc@99c000 { + compatible = "nordic,nrf-grtc"; + reg = <0x99c000 0x1000>; + status = "disabled"; + cc-num = <16>; + }; + + dppic133: dppic@9a1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9a1000 0x1000>; + status = "disabled"; + }; + + timer130: timer@9a2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9a2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <418 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer131: timer@9a3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9a3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <419 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + i2c130: i2c@9a5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9a5000 0x1000>; + status = "disabled"; + interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi130: spi@9a5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9a5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart130: uart@9a5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9a5000 0x1000>; + status = "disabled"; + interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + i2c131: i2c@9a6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9a6000 0x1000>; + status = "disabled"; + interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi131: spi@9a6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9a6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart131: uart@9a6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9a6000 0x1000>; + status = "disabled"; + interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + dppic134: dppic@9b1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9b1000 0x1000>; + status = "disabled"; + }; + + timer132: timer@9b2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9b2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <434 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer133: timer@9b3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9b3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <435 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + i2c132: i2c@9b5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9b5000 0x1000>; + status = "disabled"; + interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi132: spi@9b5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9b5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart132: uart@9b5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9b5000 0x1000>; + status = "disabled"; + interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + i2c133: i2c@9b6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9b6000 0x1000>; + status = "disabled"; + interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi133: spi@9b6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9b6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart133: uart@9b6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9b6000 0x1000>; + status = "disabled"; + interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + dppic135: dppic@9c1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9c1000 0x1000>; + status = "disabled"; + }; + + timer134: timer@9c2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9c2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <450 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer135: timer@9c3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9c3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <451 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + i2c134: i2c@9c5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9c5000 0x1000>; + status = "disabled"; + interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi134: spi@9c5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9c5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart134: uart@9c5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9c5000 0x1000>; + status = "disabled"; + interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + i2c135: i2c@9c6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9c6000 0x1000>; + status = "disabled"; + interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi135: spi@9c6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9c6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart135: uart@9c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9c6000 0x1000>; + status = "disabled"; + interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + dppic136: dppic@9d1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9d1000 0x1000>; + status = "disabled"; + }; + + timer136: timer@9d2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9d2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <466 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer137: timer@9d3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9d3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <467 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + i2c136: i2c@9d5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9d5000 0x1000>; + status = "disabled"; + interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi136: spi@9d5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9d5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart136: uart@9d5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9d5000 0x1000>; + status = "disabled"; + interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + i2c137: i2c@9d6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9d6000 0x1000>; + status = "disabled"; + interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi137: spi@9d6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9d6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart137: uart@9d6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9d6000 0x1000>; + status = "disabled"; + interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; + }; + }; + }; + + cpuapp_ppb: cpuapp-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + + cpuapp_nvic: interrupt-controller@e000e100 { + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + #interrupt-cells = <2>; + interrupt-controller; + #address-cells = <1>; + }; + }; + + cpurad_ppb: cpurad-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpurad_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + + cpurad_nvic: interrupt-controller@e000e100 { + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + #interrupt-cells = <2>; + interrupt-controller; + #address-cells = <1>; + }; + }; +}; diff --git a/dts/riscv/nordic/nrf54h20_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_cpuppr.dtsi new file mode 100644 index 00000000000..d74147bc04b --- /dev/null +++ b/dts/riscv/nordic/nrf54h20_cpuppr.dtsi @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuppr {}; +clic: &cpuppr_clic {}; +cpuppr_vevif: &cpuppr_vevif_local {}; + +/delete-node/ &cpuapp; +/delete-node/ &cpuapp_peripherals; +/delete-node/ &cpuapp_ppb; +/delete-node/ &cpuapp_ram0; +/delete-node/ &cpurad; +/delete-node/ &cpurad_peripherals; +/delete-node/ &cpurad_ppb; +/delete-node/ &cpurad_ram0; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuppr_clic>; + ranges; + }; +}; + +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&gpiote130 { + interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&grtc { + interrupts = <108 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20.h b/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20.h new file mode 100644 index 00000000000..4ebd8fb6614 --- /dev/null +++ b/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/* autogenerated using Nordic HAL utils/gen_offsets.py script */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_H_ + +#define NRF_FICR_BLE_ADDRTYPE 0x00CU +#define NRF_FICR_BLE_ADDR_0 0x010U +#define NRF_FICR_BLE_ADDR_1 0x014U +#define NRF_FICR_BLE_ER_0 0x018U +#define NRF_FICR_BLE_ER_1 0x01CU +#define NRF_FICR_BLE_ER_2 0x020U +#define NRF_FICR_BLE_ER_3 0x024U +#define NRF_FICR_BLE_IR_0 0x028U +#define NRF_FICR_BLE_IR_1 0x02CU +#define NRF_FICR_BLE_IR_2 0x030U +#define NRF_FICR_BLE_IR_3 0x034U +#define NRF_FICR_NFC_TAGHEADER_0 0x040U +#define NRF_FICR_NFC_TAGHEADER_1 0x044U +#define NRF_FICR_NFC_TAGHEADER_2 0x048U +#define NRF_FICR_NFC_TAGHEADER_3 0x04CU +#define NRF_FICR_INFO_CONFIGID 0x050U +#define NRF_FICR_INFO_PART 0x054U +#define NRF_FICR_INFO_VARIANT 0x058U +#define NRF_FICR_INFO_PACKAGE 0x05CU +#define NRF_FICR_INFO_RAM 0x060U +#define NRF_FICR_INFO_MRAM 0x064U +#define NRF_FICR_INFO_CODEPAGESIZE 0x068U +#define NRF_FICR_INFO_CODESIZE 0x06CU +#define NRF_FICR_INFO_DEVICETYPE 0x070U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CAL_0 0x388U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CAL_1 0x38CU +#define NRF_FICR_TRIM_GLOBAL_SAADC_CAL_2 0x390U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALREF 0x394U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_0 0x398U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_1 0x39CU +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_2 0x3A0U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_3 0x3A4U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_4 0x3A8U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_5 0x3ACU +#define NRF_FICR_TRIM_GLOBAL_NFCT_BIASCFG 0x3B4U +#define NRF_FICR_TRIM_GLOBAL_CANPLL_TRIM_CTUNE 0x3B8U +#define NRF_FICR_TRIM_GLOBAL_COMP_REFTRIM 0x3C0U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP 0x3C8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0 0x3CCU +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_1 0x3D0U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_2 0x3D4U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_3 0x3D8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_4 0x3DCU +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_5 0x3E0U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0 0x3E4U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_1 0x3E8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_2 0x3ECU +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_3 0x3F0U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_4 0x3F4U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_5 0x3F8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_TCOEF 0x3FCU +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_0_TRIM 0x400U +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_1_TRIM 0x404U +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_2_TRIM 0x408U +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_3_TRIM 0x40CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP 0x410U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_0 0x414U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1 0x418U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_2 0x41CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_3 0x420U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_4 0x424U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_5 0x428U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_0 0x42CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1 0x430U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_2 0x434U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_3 0x438U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_4 0x43CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_5 0x440U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_TCOEF 0x444U +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_0_TRIM 0x448U +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_1_TRIM 0x44CU +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_2_TRIM 0x450U +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_3_TRIM 0x454U + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_H_ */ From b13898244d1e6b2d033ae9a3e355e57057339956 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Thu, 22 Feb 2024 12:58:38 +0100 Subject: [PATCH 1432/2300] [nrf fromtree] modules: hal_nordic: nrfx: include config for nrf54l15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both nRF54L15 and nRF54L15 EngA uses same nrfx config file. Signed-off-by: Nikodem Kastelik (cherry picked from commit ca147ff6376f57378fe2b28f72495849e5c2d8a2) Signed-off-by: Andrzej Głąbek --- modules/hal_nordic/nrfx/nrfx_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 5c1a071f9bf..aadb0af7179 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -907,7 +907,7 @@ #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) #include -#elif defined(NRF54L15_ENGA_XXAA) && defined(NRF_APPLICATION) +#elif (defined(NRF54L15_XXAA) || defined(NRF54L15_ENGA_XXAA)) && defined(NRF_APPLICATION) #include #else #error "Unknown device." From 26010c1110a8682c0a3afb0023c93b560d953f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 11 Mar 2024 12:55:01 +0100 Subject: [PATCH 1433/2300] [nrf fromtree] modules: hal_nordic: Add nrfx configuration needed for nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add cmake and nrfx_config entries that allow building for the nRF54H20 SoC. Signed-off-by: Andrzej Głąbek (cherry picked from commit eac91bf8acce7f453d41b13ac7ad795e6768fdaf) --- modules/hal_nordic/nrfx/CMakeLists.txt | 9 + modules/hal_nordic/nrfx/nrfx_config.h | 10 +- .../nrfx/nrfx_config_nrf54h20_application.h | 1937 ++++++++++++++++ .../nrfx/nrfx_config_nrf54h20_ppr.h | 1865 +++++++++++++++ .../nrfx/nrfx_config_nrf54h20_radiocore.h | 2001 +++++++++++++++++ 5 files changed, 5820 insertions(+), 2 deletions(-) create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 597c91dbad9..a9227de8259 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -36,6 +36,12 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUAPP NRF5340_XXAA_APP zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP NRF5340_XXAA_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUNET NRF5340_XXAA_NETWORK) zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET NRF5340_XXAA_NETWORK) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUAPP NRF54H20_XXAA + NRF_APPLICATION) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPURAD NRF54H20_XXAA + NRF_RADIOCORE) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUPPR NRF54H20_XXAA + NRF_PPR) 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_NRF9120 NRF9120_XXAA) @@ -190,6 +196,9 @@ mdk_svd_ifdef(CONFIG_SOC_NRF52833 nrf52833.svd) mdk_svd_ifdef(CONFIG_SOC_NRF52840 nrf52840.svd) mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUAPP nrf5340_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUNET nrf5340_network.svd) +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_CPURAD nrf54h20_radiocore.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP nrf54h20_enga_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR nrf54h20_enga_ppr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD nrf54h20_enga_radiocore.svd) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index aadb0af7179..e2dd3df0f60 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -899,16 +899,22 @@ #include #elif defined(NRF5340_XXAA_NETWORK) #include +#elif defined(NRF54H20_XXAA) && defined(NRF_APPLICATION) + #include +#elif defined(NRF54H20_XXAA) && defined(NRF_RADIOCORE) + #include +#elif defined(NRF54H20_XXAA) && defined(NRF_PPR) + #include #elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_APPLICATION) #include #elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_RADIOCORE) #include #elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_PPR) #include -#elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) - #include #elif (defined(NRF54L15_XXAA) || defined(NRF54L15_ENGA_XXAA)) && defined(NRF_APPLICATION) #include +#elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) + #include #else #error "Unknown device." #endif diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h new file mode 100644 index 00000000000..5b91d921c7c --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h @@ -0,0 +1,1937 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54H20_APPLICATION_H__ +#define NRFX_CONFIG_NRF54H20_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_BELLBOARD_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD_ENABLED +#define NRFX_BELLBOARD_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_BELLBOARD0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD0_ENABLED +#define NRFX_BELLBOARD0_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD1_ENABLED +#define NRFX_BELLBOARD1_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD2_ENABLED +#define NRFX_BELLBOARD2_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD3_ENABLED +#define NRFX_BELLBOARD3_ENABLED 0 +#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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 +#endif + +/** + * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e +#endif + +/** + * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 +#endif + +/** + * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 +#endif + +/** + * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 +#endif + +/** + * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f +#endif + +/** + * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 +#endif + +/** + * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df +#endif + +/** + * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf +#endif + +/** + * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e +#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_EGU130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU130_ENABLED +#define NRFX_EGU130_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 1 +#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_GPIOTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE130_ENABLED +#define NRFX_GPIOTE130_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_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 +#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_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: 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_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#endif + +/** + * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#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_MVDMA_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA_ENABLED +#define NRFX_MVDMA_ENABLED 0 +#endif + +/** + * @brief NRFX_MVDMA120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA120_ENABLED +#define NRFX_MVDMA120_ENABLED 0 +#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_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_PRS_BOX_6_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_6_ENABLED +#define NRFX_PRS_BOX_6_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_7_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_7_ENABLED +#define NRFX_PRS_BOX_7_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_8_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_8_ENABLED +#define NRFX_PRS_BOX_8_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_9_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_9_ENABLED +#define NRFX_PRS_BOX_9_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_PWM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM120_ENABLED +#define NRFX_PWM120_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM130_ENABLED +#define NRFX_PWM130_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM131_ENABLED +#define NRFX_PWM131_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM132_ENABLED +#define NRFX_PWM132_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM133_ENABLED +#define NRFX_PWM133_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_QDEC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC130_ENABLED +#define NRFX_QDEC130_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC131_ENABLED +#define NRFX_QDEC131_ENABLED 0 +#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_RTC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC130_ENABLED +#define NRFX_RTC130_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC131_ENABLED +#define NRFX_RTC131_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_SPIM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM120_ENABLED +#define NRFX_SPIM120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM121_ENABLED +#define NRFX_SPIM121_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM130_ENABLED +#define NRFX_SPIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM131_ENABLED +#define NRFX_SPIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM132_ENABLED +#define NRFX_SPIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM133_ENABLED +#define NRFX_SPIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM134_ENABLED +#define NRFX_SPIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM135_ENABLED +#define NRFX_SPIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM136_ENABLED +#define NRFX_SPIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM137_ENABLED +#define NRFX_SPIM137_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_SPIS120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS120_ENABLED +#define NRFX_SPIS120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS130_ENABLED +#define NRFX_SPIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS131_ENABLED +#define NRFX_SPIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS132_ENABLED +#define NRFX_SPIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS133_ENABLED +#define NRFX_SPIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS134_ENABLED +#define NRFX_SPIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS135_ENABLED +#define NRFX_SPIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS136_ENABLED +#define NRFX_SPIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS137_ENABLED +#define NRFX_SPIS137_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_TIMER120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER120_ENABLED +#define NRFX_TIMER120_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER121_ENABLED +#define NRFX_TIMER121_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER130_ENABLED +#define NRFX_TIMER130_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER131_ENABLED +#define NRFX_TIMER131_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER132_ENABLED +#define NRFX_TIMER132_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER133_ENABLED +#define NRFX_TIMER133_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER134_ENABLED +#define NRFX_TIMER134_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER135_ENABLED +#define NRFX_TIMER135_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER136_ENABLED +#define NRFX_TIMER136_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER137_ENABLED +#define NRFX_TIMER137_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_TWIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM130_ENABLED +#define NRFX_TWIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM131_ENABLED +#define NRFX_TWIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM132_ENABLED +#define NRFX_TWIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM133_ENABLED +#define NRFX_TWIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM134_ENABLED +#define NRFX_TWIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM135_ENABLED +#define NRFX_TWIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM136_ENABLED +#define NRFX_TWIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM137_ENABLED +#define NRFX_TWIM137_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_TWIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS130_ENABLED +#define NRFX_TWIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS131_ENABLED +#define NRFX_TWIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS132_ENABLED +#define NRFX_TWIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS133_ENABLED +#define NRFX_TWIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS134_ENABLED +#define NRFX_TWIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS135_ENABLED +#define NRFX_TWIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS136_ENABLED +#define NRFX_TWIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS137_ENABLED +#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE120_ENABLED +#define NRFX_UARTE120_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE130_ENABLED +#define NRFX_UARTE130_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE131_ENABLED +#define NRFX_UARTE131_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE132_ENABLED +#define NRFX_UARTE132_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE133_ENABLED +#define NRFX_UARTE133_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE134_ENABLED +#define NRFX_UARTE134_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE135_ENABLED +#define NRFX_UARTE135_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE136_ENABLED +#define NRFX_UARTE136_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE137_ENABLED +#define NRFX_UARTE137_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_WDT010_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT010_ENABLED +#define NRFX_WDT010_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT011_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT011_ENABLED +#define NRFX_WDT011_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT131_ENABLED +#define NRFX_WDT131_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT132_ENABLED +#define NRFX_WDT132_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54H20_APPLICATION_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h new file mode 100644 index 00000000000..4a4e6c08a8a --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h @@ -0,0 +1,1865 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54H20_PPR_H__ +#define NRFX_CONFIG_NRF54H20_PPR_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_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_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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 +#endif + +/** + * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e +#endif + +/** + * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 +#endif + +/** + * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 +#endif + +/** + * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 +#endif + +/** + * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 +#endif + +/** + * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df +#endif + +/** + * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf +#endif + +/** + * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e +#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_EGU130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU130_ENABLED +#define NRFX_EGU130_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 1 +#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_GPIOTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE130_ENABLED +#define NRFX_GPIOTE130_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_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 +#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_NUM_OF_CC_CHANNELS + * + * Integer value. + */ +#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 2 +#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 0x000000c0 +#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_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#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_MVDMA_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA_ENABLED +#define NRFX_MVDMA_ENABLED 0 +#endif + +/** + * @brief NRFX_MVDMA120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA120_ENABLED +#define NRFX_MVDMA120_ENABLED 0 +#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_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_PRS_BOX_6_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_6_ENABLED +#define NRFX_PRS_BOX_6_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_7_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_7_ENABLED +#define NRFX_PRS_BOX_7_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_8_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_8_ENABLED +#define NRFX_PRS_BOX_8_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_9_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_9_ENABLED +#define NRFX_PRS_BOX_9_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_PWM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM120_ENABLED +#define NRFX_PWM120_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM130_ENABLED +#define NRFX_PWM130_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM131_ENABLED +#define NRFX_PWM131_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM132_ENABLED +#define NRFX_PWM132_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM133_ENABLED +#define NRFX_PWM133_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_QDEC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC130_ENABLED +#define NRFX_QDEC130_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC131_ENABLED +#define NRFX_QDEC131_ENABLED 0 +#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_RTC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC130_ENABLED +#define NRFX_RTC130_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC131_ENABLED +#define NRFX_RTC131_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_SPIM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM120_ENABLED +#define NRFX_SPIM120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM121_ENABLED +#define NRFX_SPIM121_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM130_ENABLED +#define NRFX_SPIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM131_ENABLED +#define NRFX_SPIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM132_ENABLED +#define NRFX_SPIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM133_ENABLED +#define NRFX_SPIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM134_ENABLED +#define NRFX_SPIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM135_ENABLED +#define NRFX_SPIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM136_ENABLED +#define NRFX_SPIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM137_ENABLED +#define NRFX_SPIM137_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_SPIS120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS120_ENABLED +#define NRFX_SPIS120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS130_ENABLED +#define NRFX_SPIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS131_ENABLED +#define NRFX_SPIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS132_ENABLED +#define NRFX_SPIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS133_ENABLED +#define NRFX_SPIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS134_ENABLED +#define NRFX_SPIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS135_ENABLED +#define NRFX_SPIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS136_ENABLED +#define NRFX_SPIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS137_ENABLED +#define NRFX_SPIS137_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_TIMER120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER120_ENABLED +#define NRFX_TIMER120_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER121_ENABLED +#define NRFX_TIMER121_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER130_ENABLED +#define NRFX_TIMER130_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER131_ENABLED +#define NRFX_TIMER131_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER132_ENABLED +#define NRFX_TIMER132_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER133_ENABLED +#define NRFX_TIMER133_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER134_ENABLED +#define NRFX_TIMER134_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER135_ENABLED +#define NRFX_TIMER135_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER136_ENABLED +#define NRFX_TIMER136_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER137_ENABLED +#define NRFX_TIMER137_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_TWIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM130_ENABLED +#define NRFX_TWIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM131_ENABLED +#define NRFX_TWIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM132_ENABLED +#define NRFX_TWIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM133_ENABLED +#define NRFX_TWIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM134_ENABLED +#define NRFX_TWIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM135_ENABLED +#define NRFX_TWIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM136_ENABLED +#define NRFX_TWIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM137_ENABLED +#define NRFX_TWIM137_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_TWIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS130_ENABLED +#define NRFX_TWIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS131_ENABLED +#define NRFX_TWIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS132_ENABLED +#define NRFX_TWIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS133_ENABLED +#define NRFX_TWIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS134_ENABLED +#define NRFX_TWIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS135_ENABLED +#define NRFX_TWIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS136_ENABLED +#define NRFX_TWIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS137_ENABLED +#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE120_ENABLED +#define NRFX_UARTE120_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE130_ENABLED +#define NRFX_UARTE130_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE131_ENABLED +#define NRFX_UARTE131_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE132_ENABLED +#define NRFX_UARTE132_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE133_ENABLED +#define NRFX_UARTE133_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE134_ENABLED +#define NRFX_UARTE134_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE135_ENABLED +#define NRFX_UARTE135_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE136_ENABLED +#define NRFX_UARTE136_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE137_ENABLED +#define NRFX_UARTE137_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_WDT131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT131_ENABLED +#define NRFX_WDT131_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT132_ENABLED +#define NRFX_WDT132_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54H20_PPR_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h new file mode 100644 index 00000000000..274073e6a38 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h @@ -0,0 +1,2001 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54H20_RADIOCORE_H__ +#define NRFX_CONFIG_NRF54H20_RADIOCORE_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_BELLBOARD_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD_ENABLED +#define NRFX_BELLBOARD_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_BELLBOARD0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD0_ENABLED +#define NRFX_BELLBOARD0_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD1_ENABLED +#define NRFX_BELLBOARD1_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD2_ENABLED +#define NRFX_BELLBOARD2_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD3_ENABLED +#define NRFX_BELLBOARD3_ENABLED 0 +#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_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#endif + +/** + * @brief NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#endif + +/** + * @brief NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 +#endif + +/** + * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e +#endif + +/** + * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 +#endif + +/** + * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 +#endif + +/** + * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 +#endif + +/** + * @brief NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f +#endif + +/** + * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 +#endif + +/** + * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df +#endif + +/** + * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf +#endif + +/** + * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e +#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_EGU020_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU020_ENABLED +#define NRFX_EGU020_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU130_ENABLED +#define NRFX_EGU130_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 1 +#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_GPIOTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE130_ENABLED +#define NRFX_GPIOTE130_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_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 +#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_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 0x00000f00 +#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_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 +#endif + +/** + * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000c0 +#endif + +/** + * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#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_MVDMA_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA_ENABLED +#define NRFX_MVDMA_ENABLED 0 +#endif + +/** + * @brief NRFX_MVDMA120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA120_ENABLED +#define NRFX_MVDMA120_ENABLED 0 +#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_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_PRS_BOX_6_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_6_ENABLED +#define NRFX_PRS_BOX_6_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_7_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_7_ENABLED +#define NRFX_PRS_BOX_7_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_8_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_8_ENABLED +#define NRFX_PRS_BOX_8_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_9_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_9_ENABLED +#define NRFX_PRS_BOX_9_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_PWM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM120_ENABLED +#define NRFX_PWM120_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM130_ENABLED +#define NRFX_PWM130_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM131_ENABLED +#define NRFX_PWM131_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM132_ENABLED +#define NRFX_PWM132_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM133_ENABLED +#define NRFX_PWM133_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_QDEC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC130_ENABLED +#define NRFX_QDEC130_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC131_ENABLED +#define NRFX_QDEC131_ENABLED 0 +#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_RTC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC130_ENABLED +#define NRFX_RTC130_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC131_ENABLED +#define NRFX_RTC131_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_SPIM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM120_ENABLED +#define NRFX_SPIM120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM121_ENABLED +#define NRFX_SPIM121_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM130_ENABLED +#define NRFX_SPIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM131_ENABLED +#define NRFX_SPIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM132_ENABLED +#define NRFX_SPIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM133_ENABLED +#define NRFX_SPIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM134_ENABLED +#define NRFX_SPIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM135_ENABLED +#define NRFX_SPIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM136_ENABLED +#define NRFX_SPIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM137_ENABLED +#define NRFX_SPIM137_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_SPIS120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS120_ENABLED +#define NRFX_SPIS120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS130_ENABLED +#define NRFX_SPIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS131_ENABLED +#define NRFX_SPIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS132_ENABLED +#define NRFX_SPIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS133_ENABLED +#define NRFX_SPIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS134_ENABLED +#define NRFX_SPIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS135_ENABLED +#define NRFX_SPIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS136_ENABLED +#define NRFX_SPIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS137_ENABLED +#define NRFX_SPIS137_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_TIMER020_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER020_ENABLED +#define NRFX_TIMER020_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER021_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER021_ENABLED +#define NRFX_TIMER021_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER022_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER022_ENABLED +#define NRFX_TIMER022_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER120_ENABLED +#define NRFX_TIMER120_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER121_ENABLED +#define NRFX_TIMER121_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER130_ENABLED +#define NRFX_TIMER130_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER131_ENABLED +#define NRFX_TIMER131_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER132_ENABLED +#define NRFX_TIMER132_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER133_ENABLED +#define NRFX_TIMER133_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER134_ENABLED +#define NRFX_TIMER134_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER135_ENABLED +#define NRFX_TIMER135_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER136_ENABLED +#define NRFX_TIMER136_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER137_ENABLED +#define NRFX_TIMER137_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_TWIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM130_ENABLED +#define NRFX_TWIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM131_ENABLED +#define NRFX_TWIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM132_ENABLED +#define NRFX_TWIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM133_ENABLED +#define NRFX_TWIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM134_ENABLED +#define NRFX_TWIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM135_ENABLED +#define NRFX_TWIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM136_ENABLED +#define NRFX_TWIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM137_ENABLED +#define NRFX_TWIM137_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_TWIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS130_ENABLED +#define NRFX_TWIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS131_ENABLED +#define NRFX_TWIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS132_ENABLED +#define NRFX_TWIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS133_ENABLED +#define NRFX_TWIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS134_ENABLED +#define NRFX_TWIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS135_ENABLED +#define NRFX_TWIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS136_ENABLED +#define NRFX_TWIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS137_ENABLED +#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE120_ENABLED +#define NRFX_UARTE120_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE130_ENABLED +#define NRFX_UARTE130_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE131_ENABLED +#define NRFX_UARTE131_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE132_ENABLED +#define NRFX_UARTE132_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE133_ENABLED +#define NRFX_UARTE133_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE134_ENABLED +#define NRFX_UARTE134_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE135_ENABLED +#define NRFX_UARTE135_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE136_ENABLED +#define NRFX_UARTE136_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE137_ENABLED +#define NRFX_UARTE137_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_WDT010_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT010_ENABLED +#define NRFX_WDT010_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT011_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT011_ENABLED +#define NRFX_WDT011_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT131_ENABLED +#define NRFX_WDT131_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT132_ENABLED +#define NRFX_WDT132_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54H20_RADIOCORE_H__ */ From 831cf634c93216a742c61a7ef0b5a023a4001b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 12 Mar 2024 15:00:05 +0100 Subject: [PATCH 1434/2300] [nrf fromlist] boards: nordic: Add support for nRF54H20 DK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add targets for the Application, Radio, and PPR cores in the nRF54H20 SoC on the nRF54H20 DK board. Signed-off-by: Andrzej Głąbek (cherry picked from commit d0ce78f23028385b3e512f92d1b8ce925602db6f) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- boards/arm/nrf54h20dk_nrf54h20/Kconfig.board | 10 + .../arm/nrf54h20dk_nrf54h20/Kconfig.defconfig | 6 + boards/arm/nrf54h20dk_nrf54h20/board.cmake | 13 ++ boards/arm/nrf54h20dk_nrf54h20/doc/index.rst | 154 +++++++++++++++ .../nrf54h20dk_nrf54h20-ipc_conf.dtsi | 36 ++++ .../nrf54h20dk_nrf54h20-memory_map.dtsi | 184 ++++++++++++++++++ .../nrf54h20dk_nrf54h20-pinctrl.dtsi | 53 +++++ .../nrf54h20dk_nrf54h20_cpuapp.dts | 171 ++++++++++++++++ .../nrf54h20dk_nrf54h20_cpuapp.yaml | 15 ++ .../nrf54h20dk_nrf54h20_cpuapp_defconfig | 33 ++++ .../nrf54h20dk_nrf54h20_cpurad.dts | 84 ++++++++ .../nrf54h20dk_nrf54h20_cpurad.yaml | 15 ++ .../nrf54h20dk_nrf54h20_cpurad_defconfig | 30 +++ .../support/nrf54h20_cpurad.JLinkScript | 4 + .../riscv/nrf54h20dk_nrf54h20/Kconfig.board | 10 + .../nrf54h20dk_nrf54h20/Kconfig.defconfig | 6 + .../nrf54h20dk_nrf54h20_cpuppr.dts | 56 ++++++ .../nrf54h20dk_nrf54h20_cpuppr.yaml | 13 ++ .../nrf54h20dk_nrf54h20_cpuppr_defconfig | 14 ++ .../nrf54h20dk_nrf54h20_cpuppr_ram.dts | 11 ++ .../nrf54h20dk_nrf54h20_cpuppr_ram.yaml | 13 ++ .../nrf54h20dk_nrf54h20_cpuppr_ram_defconfig | 16 ++ .../nrf54h20dk_nrf54h20/pre_dt_board.cmake | 7 + 23 files changed, 954 insertions(+) create mode 100644 boards/arm/nrf54h20dk_nrf54h20/Kconfig.board create mode 100644 boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig create mode 100644 boards/arm/nrf54h20dk_nrf54h20/board.cmake create mode 100644 boards/arm/nrf54h20dk_nrf54h20/doc/index.rst create mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi create mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi create mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi create mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts create mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.yaml create mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp_defconfig create mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts create mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.yaml create mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad_defconfig create mode 100644 boards/arm/nrf54h20dk_nrf54h20/support/nrf54h20_cpurad.JLinkScript create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/Kconfig.board create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/Kconfig.defconfig create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/pre_dt_board.cmake diff --git a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.board b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.board new file mode 100644 index 00000000000..831ddc009c2 --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.board @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF54H20DK_NRF54H20_CPUAPP + bool "nRF54H20 DK nRF54H20 Application MCU" + depends on SOC_NRF54H20_CPUAPP + +config BOARD_NRF54H20DK_NRF54H20_CPURAD + bool "nRF54H20 DK nRF54H20 Radio MCU" + depends on SOC_NRF54H20_CPURAD diff --git a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig new file mode 100644 index 00000000000..1a029338775 --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD + default "nrf54h20dk_nrf54h20_cpuapp" if BOARD_NRF54H20DK_NRF54H20_CPUAPP + default "nrf54h20dk_nrf54h20_cpurad" if BOARD_NRF54H20DK_NRF54H20_CPURAD diff --git a/boards/arm/nrf54h20dk_nrf54h20/board.cmake b/boards/arm/nrf54h20dk_nrf54h20/board.cmake new file mode 100644 index 00000000000..32d1daac179 --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/board.cmake @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) + if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) + set( + JLINK_TOOL_OPT + "-jlinkscriptfile ${CMAKE_CURRENT_LIST_DIR}/support/nrf54h20_cpurad.JLinkScript" + ) + endif() + + board_runner_args(jlink "--device=CORTEX-M33" "--speed=4000" "--tool-opt=${JLINK_TOOL_OPT}") + include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) +endif() diff --git a/boards/arm/nrf54h20dk_nrf54h20/doc/index.rst b/boards/arm/nrf54h20dk_nrf54h20/doc/index.rst new file mode 100644 index 00000000000..6b8a08f0953 --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/doc/index.rst @@ -0,0 +1,154 @@ +.. _nrf54h20dk_nrf54h20: + +nRF54H20 DK +########### + +Overview +******** + +.. note:: + + All software for the nRF54H20 SoC is experimental and hardware availability + is restricted to the participants in the limited sampling program. + +The nRF54H20 DK is a single-board development kit for evaluation and development +on the Nordic nRF54H20 System-on-Chip (SoC). + +The nRF54H20 is a multicore SoC with: + +* an Arm Cortex-M33 core with DSP instructions, FPU, and Armv8-M Security + Extensions, running at up to 320 MHz, referred to as the **application core** +* an Arm Cortex-M33 core with DSP instructions, FPU, and Armv8-M Security + Extensions, running at up to 256 MHz, referred to as the **radio core**. + +The ``nrf54h20dk/nrf54h20/cpuapp`` build target provides support for +the application core on the nRF54H20 SoC. +The ``nrf54h20dk/nrf54h20/cpurad`` build target provides support for +the radio core on the nRF54H20 SoC. + +nRF54H20 SoC provides support for the following devices: + +* :abbr:`ADC (Analog to Digital Converter)` +* CLOCK +* :abbr:`GPIO (General Purpose Input Output)` +* :abbr:`GRTC (Global real-time counter)` +* :abbr:`I2C (Inter-Integrated Circuit)` +* MRAM +* :abbr:`PWM (Pulse Width Modulation)` +* RADIO (Bluetooth Low Energy and 802.15.4) +* :abbr:`SPI (Serial Peripheral Interface)` +* :abbr:`UART (Universal asynchronous receiver-transmitter)` +* :abbr:`USB (Universal Serial Bus)` +* :abbr:`WDT (Watchdog Timer)` + +Hardware +******** + +nRF54H20 DK has two crystal oscillators: + +* High-frequency 32 MHz crystal oscillator (HFXO) +* Low-frequency 32.768 kHz crystal oscillator (LFXO) + +Supported Features +================== + +The ``nrf54h20dk/nrf54h20/cpuapp`` board configuration supports the following +hardware features: + ++-----------+------------+----------------------+ +| Interface | Controller | Driver/Component | ++===========+============+======================+ +| GPIO | on-chip | gpio | ++-----------+------------+----------------------+ +| GRTC | on-chip | system clock | ++-----------+------------+----------------------+ +| I2C(M) | on-chip | i2c | ++-----------+------------+----------------------+ +| SPI(M/S) | on-chip | spi | ++-----------+------------+----------------------+ +| UART | on-chip | serial | ++-----------+------------+----------------------+ +| WDT | on-chip | watchdog | ++-----------+------------+----------------------+ + +The ``nrf54h20dk/nrf54h20/cpurad`` board configuration supports the following +hardware features: + ++-----------+------------+----------------------+ +| Interface | Controller | Driver/Component | ++===========+============+======================+ +| GPIO | on-chip | gpio | ++-----------+------------+----------------------+ +| GRTC | on-chip | system clock | ++-----------+------------+----------------------+ +| I2C(M) | on-chip | i2c | ++-----------+------------+----------------------+ +| SPI(M/S) | on-chip | spi | ++-----------+------------+----------------------+ +| UART | on-chip | serial | ++-----------+------------+----------------------+ +| WDT | on-chip | watchdog | ++-----------+------------+----------------------+ + +Other hardware features have not been enabled yet for this board. + +Connections and IOs +=================== + +LEDs +---- + +* LED1 (green) = P9.0 +* LED2 (green) = P9.1 +* LED3 (green) = P9.2 +* LED4 (green) = P9.3 + +Push buttons +------------ + +* BUTTON1 = P0.8 +* BUTTON2 = P0.9 +* BUTTON3 = P0.10 +* BUTTON4 = P0.11 +* RESET (SW1) + +Programming and Debugging +************************* + +Applications for both the ``nrf54h20dk/nrf54h20/cpuapp`` and +``nrf54h20dk/nrf54h20/cpurad`` targets 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 +======== + +As an example, this section shows how to build and flash the :ref:`hello_world` +application. + +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`. + +To build and program the sample to the nRF54H20 DK, complete the following steps: + +1. Connect the nRF54H20 DK to your computer using the IMCU USB port on the DK. +#. Build the sample by running the following command: + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: nrf54h20dk/nrf54h20/cpuapp + :goals: build flash + +Testing the LEDs and buttons in the nRF54H20 DK +*********************************************** + +There are 2 samples that allow you to test that the buttons (switches) and LEDs +on the board are working properly with Zephyr: + +* :zephyr:code-sample:`blinky` +* :zephyr:code-sample:`button` + +You can build and flash the examples to make sure Zephyr is running correctly on +your board. The button and LED definitions can be found in +:zephyr_file:`boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts`. diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi new file mode 100644 index 00000000000..9c3d971b9bc --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + ipc { + cpusec_cpuapp_ipc: ipc-1-2 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpusec_bellboard 12>, + <&cpuapp_bellboard 0>; + }; + + cpusec_cpurad_ipc: ipc-1-3 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpusec_bellboard 18>, + <&cpurad_bellboard 0>; + }; + + cpuapp_cpurad_ipc: ipc-2-3 { + status = "disabled"; + mboxes = <&cpuapp_bellboard 18>, + <&cpurad_bellboard 12>; + }; + + cpuapp_cpuppr_ipc: ipc-2-13 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpuapp_bellboard 13>, + <&cpuppr_vevif 12>; + }; + }; +}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi new file mode 100644 index 00000000000..6b6402eb90f --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + reserved-memory { + cpuapp_ram0x_region: memory@2f000000 { + compatible = "nordic,owned-memory"; + reg = <0x2f000000 DT_SIZE_K(260)>; + status = "disabled"; + perm-read; + perm-write; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f000000 0x41000>; + + cpusec_cpuapp_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpuapp_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + + cpuapp_data: memory@1000 { + reg = <0x1000 DT_SIZE_K(256)>; + }; + }; + + cpurad_ram0x_region: memory@2f041000 { + compatible = "nordic,owned-memory"; + reg = <0x2f041000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f041000 0x1000>; + + cpusec_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + }; + + cpuapp_cpurad_ram0x_region: memory@2f0bf000 { + compatible = "nordic,owned-memory"; + reg = <0x2f0bf000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f0bf000 0x1000>; + + cpuapp_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpuapp_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + }; + + shared_ram20_region: memory@2f88f000 { + compatible = "nordic,owned-memory"; + reg = <0x2f88f000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f88f000 0x1000>; + + cpuapp_cpusys_ipc_shm: memory@ce0 { + reg = <0xce0 0x80>; + }; + + cpusys_cpuapp_ipc_shm: memory@d60 { + reg = <0xd60 0x80>; + }; + + cpurad_cpusys_ipc_shm: memory@e00 { + reg = <0xe00 0x80>; + }; + + cpusys_cpurad_ipc_shm: memory@e80 { + reg = <0xe80 0x80>; + }; + }; + + cpuppr_ram3x_region: memory@2fc00000 { + compatible = "nordic,owned-memory"; + reg = <0x2fc00000 DT_SIZE_K(64)>; + status = "disabled"; + perm-read; + perm-write; + perm-execute; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2fc00000 0x10000>; + + cpuppr_code_data: memory@0 { + reg = <0x0 DT_SIZE_K(62)>; + }; + + cpuapp_cpuppr_ipc_shm: memory@f800 { + reg = <0xf800 DT_SIZE_K(1)>; + }; + + cpuppr_cpuapp_ipc_shm: memory@fc00 { + reg = <0xfc00 DT_SIZE_K(1)>; + }; + }; + + 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(4)>; + status = "disabled"; + #memory-region-cells = <0>; + zephyr,memory-region = "DMA_RAM3x_APP"; + }; + + cpurad_dma_region: memory@1e80 { + compatible = "zephyr,memory-region"; + reg = <0x1e80 0x80>; + status = "disabled"; + #memory-region-cells = <0>; + zephyr,memory-region = "DMA_RAM3x_RAD"; + }; + }; + }; +}; + +&mram1x { + cpurad_rx_partitions: cpurad-rx-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + perm-read; + perm-execute; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + + cpurad_slot0_partition: partition@66000 { + reg = <0x66000 DT_SIZE_K(256)>; + }; + }; + + cpuapp_rx_partitions: cpuapp-rx-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + perm-read; + perm-execute; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_slot0_partition: partition@a6000 { + reg = <0xa6000 DT_SIZE_K(512)>; + }; + + cpuppr_code_partition: partition@126000 { + reg = <0x126000 DT_SIZE_K(64)>; + }; + }; +}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi new file mode 100644 index 00000000000..6c6da3fa747 --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + /omit-if-no-ref/ uart135_default: uart135_default { + group1 { + psels = , + ; + }; + + group2 { + bias-pull-up; + psels = , + ; + }; + }; + + /omit-if-no-ref/ uart135_sleep: uart135_sleep { + group1 { + low-power-enable; + psels = , + , + , + ; + }; + }; + + /omit-if-no-ref/ uart136_default: uart136_default { + group1 { + psels = , + ; + }; + + group2 { + bias-pull-up; + psels = , + ; + }; + }; + + /omit-if-no-ref/ uart136_sleep: uart136_sleep { + group1 { + low-power-enable; + psels = , + , + , + ; + }; + }; +}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts new file mode 100644 index 00000000000..3873fec457e --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54h20dk_nrf54h20-memory_map.dtsi" +#include "nrf54h20dk_nrf54h20-ipc_conf.dtsi" +#include "nrf54h20dk_nrf54h20-pinctrl.dtsi" + +/delete-node/ &cpusec_cpurad_ipc; + +/ { + compatible = "nordic,nrf54h20dk_nrf54h20-cpuapp"; + model = "Nordic nRF54H20 DK nRF54H20 Application MCU"; + + chosen { + zephyr,console = &uart136; + zephyr,code-partition = &cpuapp_slot0_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpuapp_data; + }; + + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + }; + + buttons { + compatible = "gpio-keys"; + + button0: button_0 { + gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 0"; + zephyr,code = ; + }; + + button1: button_1 { + gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 1"; + zephyr,code = ; + }; + + button2: button_2 { + gpios = <&gpio0 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 2"; + zephyr,code = ; + }; + + button3: button_3 { + gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 3"; + zephyr,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + + led1: led_1 { + gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + + led2: led_2 { + gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + + led3: led_3 { + gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; +}; + +&cpuapp_ram0x_region { + status = "okay"; +}; + +&shared_ram3x_region { + status = "okay"; +}; + +&cpuapp_bellboard { + interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq0"; + /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ + nordic,interrupt-mapping = <0x00042001 0>; +}; + +&cpusec_cpuapp_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuapp_cpusec_ipc_shm>; + rx-region = <&cpusec_cpuapp_ipc_shm>; +}; + +&cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-initiator"; + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpurad_ipc_shm>; + rx-region = <&cpurad_cpuapp_ipc_shm>; +}; + +&cpuapp_cpuppr_ipc { + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpuppr_ipc_shm>; + rx-region = <&cpuppr_cpuapp_ipc_shm>; +}; + +&cpuapp_dma_region { + status = "okay"; +}; + +&cpuapp_rx_partitions { + status = "okay"; +}; + +&cpuppr_vpr { + execution-memory = <&cpuppr_code_partition>; +}; + +&gpiote130 { + status = "okay"; + owned-channels = <0 1 2 3 4 5 6 7>; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio9 { + status = "okay"; +}; + +&grtc { + status = "okay"; + child-owned-channels = <5 6>; + nonsecure-channels = <5 6>; + owned-channels = <4 5 6>; +}; + +&uart135 { + current-speed = <115200>; + pinctrl-0 = <&uart135_default>; + pinctrl-1 = <&uart135_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart136 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + current-speed = <115200>; + pinctrl-0 = <&uart136_default>; + pinctrl-1 = <&uart136_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.yaml new file mode 100644 index 00000000000..ec2437ef84c --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk_nrf54h20_cpuapp +name: nRF54H20-DK-nRF54H20-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 256 +flash: 512 +supported: + - gpio diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp_defconfig b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp_defconfig new file mode 100644 index 00000000000..d83fabfcfa0 --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp_defconfig @@ -0,0 +1,33 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_CPUAPP=y +CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP=y + +CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts new file mode 100644 index 00000000000..1998f4fc131 --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54h20dk_nrf54h20-memory_map.dtsi" +#include "nrf54h20dk_nrf54h20-ipc_conf.dtsi" +#include "nrf54h20dk_nrf54h20-pinctrl.dtsi" + +/delete-node/ &cpuapp_cpuppr_ipc; +/delete-node/ &cpusec_cpuapp_ipc; + +/ { + compatible = "nordic,nrf54h20dk_nrf54h20-cpurad"; + model = "Nordic nRF54H20 DK nRF54H20 Radio MCU"; + + chosen { + zephyr,console = &uart135; + zephyr,code-partition = &cpurad_slot0_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpurad_ram0; + }; +}; + +&shared_ram3x_region { + status = "okay"; +}; + +&cpurad_bellboard { + interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq0"; + /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ + nordic,interrupt-mapping = <0x00001001 0>; +}; + +&cpusec_cpurad_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpusec_ipc_shm>; + rx-region = <&cpusec_cpurad_ipc_shm>; +}; + +&cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-follower"; + mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpurad_ipc_shm>; +}; + +&cpurad_dma_region { + status = "okay"; +}; + +&cpurad_rx_partitions { + status = "okay"; +}; + +&grtc { + status = "okay"; + child-owned-channels = <8 9 10 11 12>; + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, + <108 NRF_DEFAULT_IRQ_PRIORITY>; + nonsecure-channels = <8 9 10 11 12>; + owned-channels = <7 8 9 10 11 12 13 14>; +}; + +&uart135 { + status = "okay"; + memory-regions = <&cpurad_dma_region>; + current-speed = <115200>; + pinctrl-0 = <&uart135_default>; + pinctrl-1 = <&uart135_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart136 { + current-speed = <115200>; + pinctrl-0 = <&uart136_default>; + pinctrl-1 = <&uart136_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.yaml new file mode 100644 index 00000000000..80bd2a60ec0 --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk_nrf54h20_cpurad +name: nRF54H20-DK-nRF54H20-Radio +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 192 +flash: 256 +supported: + - gpio diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad_defconfig b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad_defconfig new file mode 100644 index 00000000000..4d87fe6bc0e --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad_defconfig @@ -0,0 +1,30 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_CPURAD=y +CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD=y + +CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf54h20dk_nrf54h20/support/nrf54h20_cpurad.JLinkScript b/boards/arm/nrf54h20dk_nrf54h20/support/nrf54h20_cpurad.JLinkScript new file mode 100644 index 00000000000..2fb7e32302e --- /dev/null +++ b/boards/arm/nrf54h20dk_nrf54h20/support/nrf54h20_cpurad.JLinkScript @@ -0,0 +1,4 @@ +void ConfigTargetSettings(void) { + JLINK_ExecCommand("CORESIGHT_AddAP = Index=1 Type=AHB-AP"); + CORESIGHT_IndexAHBAPToUse = 1; +} diff --git a/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.board b/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.board new file mode 100644 index 00000000000..a35655ec3fd --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.board @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF54H20DK_NRF54H20_CPUPPR + bool "nRF54H20 DK nRF54H20 PPR MCU" + depends on SOC_NRF54H20_CPUPPR + +config BOARD_NRF54H20DK_NRF54H20_CPUPPR_RAM + bool "nRF54H20 DK nRF54H20 PPR MCU (executing from RAM)" + depends on SOC_NRF54H20_CPUPPR diff --git a/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.defconfig b/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.defconfig new file mode 100644 index 00000000000..fa67352d3c8 --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.defconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD + default "nrf54h20dk_nrf54h20_cpuppr" + depends on BOARD_NRF54H20DK_NRF54H20_CPUPPR || BOARD_NRF54H20DK_NRF54H20_CPUPPR_RAM diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts new file mode 100644 index 00000000000..edce1a8b275 --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54h20dk_nrf54h20-memory_map.dtsi" +#include "nrf54h20dk_nrf54h20-ipc_conf.dtsi" +#include "nrf54h20dk_nrf54h20-pinctrl.dtsi" + +/delete-node/ &cpuapp_cpurad_ipc; +/delete-node/ &cpusec_cpuapp_ipc; +/delete-node/ &cpusec_cpurad_ipc; + +/ { + compatible = "nordic,nrf54h20dk_nrf54h20-cpuppr"; + model = "Nordic nRF54H20 DK nRF54H20 Peripheral Processor MCU"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart135; + zephyr,code-partition = &cpuppr_code_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpuppr_code_data; + }; +}; + +&cpuapp_cpuppr_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuppr_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpuppr_ipc_shm>; +}; + +&grtc { + status = "okay"; + owned-channels = <5>; +}; + +&uart135 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart135_default>; + pinctrl-1 = <&uart135_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart136 { + current-speed = <115200>; + pinctrl-0 = <&uart136_default>; + pinctrl-1 = <&uart136_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml new file mode 100644 index 00000000000..02e28651f5d --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk_nrf54h20_cpuppr +name: nRF54H20-DK-nRF54H20-PPR +type: mcu +arch: riscv +toolchain: + - zephyr +ram: 62 +flash: 64 +supported: + - gpio diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig new file mode 100644 index 00000000000..2f6ccc43892 --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_CPUPPR=y +CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_SERIAL=y + +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts new file mode 100644 index 00000000000..b10cff15474 --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_cpuppr.dts" + +&cpuppr_code_partition { + reg = <0x126000 DT_SIZE_K(62)>; +}; diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml new file mode 100644 index 00000000000..26d6ebeac9a --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk_nrf54h20_cpuppr_ram +name: nRF54H20-DK-nRF54H20-PPR-RAM +type: mcu +arch: riscv +toolchain: + - zephyr +ram: 62 +flash: 62 +supported: + - gpio diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig new file mode 100644 index 00000000000..73056fac7ef --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig @@ -0,0 +1,16 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_CPUPPR=y +CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_SERIAL=y + +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +CONFIG_XIP=n diff --git a/boards/riscv/nrf54h20dk_nrf54h20/pre_dt_board.cmake b/boards/riscv/nrf54h20dk_nrf54h20/pre_dt_board.cmake new file mode 100644 index 00000000000..5e0fecebdc8 --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/pre_dt_board.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Allow common DTS files to be included from the other board directory. +# To be removed after HWMv2 (#51831), once both directories can be merged into one. +string(REGEX REPLACE "/riscv/(.*$)" "/arm/\\1" BOARD_DIR_ARM "${BOARD_DIR}") +list(APPEND DTS_EXTRA_CPPFLAGS -isystem "${BOARD_DIR_ARM}") From 7ead64ecf47a4ae42b29aef31182365d0d4a03a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 13 Mar 2024 17:20:12 +0100 Subject: [PATCH 1435/2300] [nrf fromlist] samples: Replace nRF54H20 PDK with nRF54H20 DK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nRF54H20 PDK is superseded by nRF54H20 DK and will no longer be supported. Signed-off-by: Andrzej Głąbek (cherry picked from commit 7cda16528c2c47f821f9233b8aff59ed26a518b7) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- samples/drivers/mbox/CMakeLists.txt | 2 +- samples/drivers/mbox/Kconfig.sysbuild | 2 +- ...nrf54h20dk_nrf54h20_cpuapp_bellboard.conf} | 0 ...54h20dk_nrf54h20_cpuapp_bellboard.overlay} | 0 ... => nrf54h20dk_nrf54h20_cpuapp_vevif.conf} | 0 ... nrf54h20dk_nrf54h20_cpuapp_vevif.overlay} | 0 samples/drivers/mbox/remote/CMakeLists.txt | 2 +- ...nrf54h20dk_nrf54h20_cpuppr_bellboard.conf} | 0 ...54h20dk_nrf54h20_cpuppr_bellboard.overlay} | 0 ... => nrf54h20dk_nrf54h20_cpuppr_vevif.conf} | 0 ... nrf54h20dk_nrf54h20_cpuppr_vevif.overlay} | 0 samples/drivers/mbox/sample.yaml | 24 +++++++++---------- 12 files changed, 15 insertions(+), 15 deletions(-) rename samples/drivers/mbox/boards/{nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf => nrf54h20dk_nrf54h20_cpuapp_bellboard.conf} (100%) rename samples/drivers/mbox/boards/{nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay => nrf54h20dk_nrf54h20_cpuapp_bellboard.overlay} (100%) rename samples/drivers/mbox/boards/{nrf54h20pdk_nrf54h20_cpuapp_vevif.conf => nrf54h20dk_nrf54h20_cpuapp_vevif.conf} (100%) rename samples/drivers/mbox/boards/{nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay => nrf54h20dk_nrf54h20_cpuapp_vevif.overlay} (100%) rename samples/drivers/mbox/remote/boards/{nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf => nrf54h20dk_nrf54h20_cpuppr_bellboard.conf} (100%) rename samples/drivers/mbox/remote/boards/{nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay => nrf54h20dk_nrf54h20_cpuppr_bellboard.overlay} (100%) rename samples/drivers/mbox/remote/boards/{nrf54h20pdk_nrf54h20_cpuppr_vevif.conf => nrf54h20dk_nrf54h20_cpuppr_vevif.conf} (100%) rename samples/drivers/mbox/remote/boards/{nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay => nrf54h20dk_nrf54h20_cpuppr_vevif.overlay} (100%) diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index c69621c2496..5c21619a8cf 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -18,7 +18,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0") OR - ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuapp")) + ("${BOARD}" STREQUAL "nrf54h20dk_nrf54h20_cpuapp")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index aca48b8ead3..0899d958bdb 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -14,4 +14,4 @@ string default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" - default "nrf54h20pdk_nrf54h20_cpuppr" if $(BOARD) = "nrf54h20pdk_nrf54h20_cpuapp" + default "nrf54h20dk_nrf54h20_cpuppr" if $(BOARD) = "nrf54h20dk_nrf54h20_cpuapp" diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf b/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.conf similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf rename to samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.conf diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay b/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.overlay similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay rename to samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.overlay diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf b/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_vevif.conf similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf rename to samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_vevif.conf diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay b/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_vevif.overlay similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay rename to samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_vevif.overlay diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index cb024cb6112..9ae8d377685 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -16,7 +16,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1") OR ("${BOARD}" STREQUAL "adp_xc7k_ae350") OR - ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuppr")) + ("${BOARD}" STREQUAL "nrf54h20dk_nrf54h20_cpuppr")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf b/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.conf similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf rename to samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.conf diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay b/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.overlay similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay rename to samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.overlay diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf b/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_vevif.conf similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf rename to samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_vevif.conf diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay b/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_vevif.overlay similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay rename to samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_vevif.overlay diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index b386b9d2b4b..19b6322d9bf 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -26,15 +26,15 @@ tests: sample.drivers.mbox.nrf54h20_vevif: platform_allow: - - nrf54h20pdk_nrf54h20_cpuapp + - nrf54h20dk_nrf54h20_cpuapp integration_platforms: - - nrf54h20pdk_nrf54h20_cpuapp + - nrf54h20dk_nrf54h20_cpuapp extra_args: mbox_SNIPPET=nordic-ppr - mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf - mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay - remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf - remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay + mbox_EXTRA_CONF_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_vevif.conf + mbox_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_vevif.overlay + remote_EXTRA_CONF_FILE=boards/nrf54h20dk_nrf54h20_cpuppr_vevif.conf + remote_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuppr_vevif.overlay sysbuild: true harness: console harness_config: @@ -46,15 +46,15 @@ tests: sample.drivers.mbox.nrf54h20_bellboard: platform_allow: - - nrf54h20pdk_nrf54h20_cpuapp + - nrf54h20dk_nrf54h20_cpuapp integration_platforms: - - nrf54h20pdk_nrf54h20_cpuapp + - nrf54h20dk_nrf54h20_cpuapp extra_args: mbox_SNIPPET=nordic-ppr - mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf - mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay - remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf - remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay + mbox_EXTRA_CONF_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.conf + mbox_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.overlay + remote_EXTRA_CONF_FILE=boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.conf + remote_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.overlay sysbuild: true harness: console harness_config: From fb3be114abc636b794ab624f01bf4dbdd6e51bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 13 Mar 2024 17:24:31 +0100 Subject: [PATCH 1436/2300] [nrf fromlist] snippets: Replace nRF54H20 PDK with nRF54H20 DK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nRF54H20 PDK is superseded by nRF54H20 DK and will no longer be supported. Signed-off-by: Andrzej Głąbek (cherry picked from commit 3a6fadf27024bd39bab2b5a43283cc709515dc2a) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- ...4h20_cpuapp.overlay => nrf54h20dk_nrf54h20_cpuapp.overlay} | 4 ++-- snippets/nordic-ppr-ram/nordic-ppr-ram.overlay | 2 +- snippets/nordic-ppr-ram/snippet.yml | 4 ++-- ...4h20_cpuapp.overlay => nrf54h20dk_nrf54h20_cpuapp.overlay} | 0 snippets/nordic-ppr/snippet.yml | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) rename snippets/nordic-ppr-ram/boards/{nrf54h20pdk_nrf54h20_cpuapp.overlay => nrf54h20dk_nrf54h20_cpuapp.overlay} (71%) rename snippets/nordic-ppr/boards/{nrf54h20pdk_nrf54h20_cpuapp.overlay => nrf54h20dk_nrf54h20_cpuapp.overlay} (100%) diff --git a/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay similarity index 71% rename from snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay rename to snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 5597c886b85..ea866358fc0 100644 --- a/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay +++ b/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -3,12 +3,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -&cpuppr_ram3x_region { +&cpuppr_code_data { status = "okay"; }; &cpuppr_vpr { - execution-memory = <&cpuppr_ram3x_region>; + execution-memory = <&cpuppr_code_data>; }; &uart135 { diff --git a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay index e69c3a0d2bf..71c45c1b9f4 100644 --- a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay +++ b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay @@ -11,5 +11,5 @@ /* code partition size must match RAM size */ &cpuppr_code_partition { - reg = <0x126000 DT_SIZE_K(28)>; + reg = <0x126000 DT_SIZE_K(62)>; }; diff --git a/snippets/nordic-ppr-ram/snippet.yml b/snippets/nordic-ppr-ram/snippet.yml index 0d6039af2e5..022ed8d38e8 100644 --- a/snippets/nordic-ppr-ram/snippet.yml +++ b/snippets/nordic-ppr-ram/snippet.yml @@ -3,6 +3,6 @@ append: EXTRA_DTC_OVERLAY_FILE: nordic-ppr-ram.overlay boards: - nrf54h20pdk_nrf54h20_cpuapp: + nrf54h20dk_nrf54h20_cpuapp: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20pdk_nrf54h20_cpuapp.overlay + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay similarity index 100% rename from snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay rename to snippets/nordic-ppr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-ppr/snippet.yml b/snippets/nordic-ppr/snippet.yml index 9e1f20bb757..d9b37963c3a 100644 --- a/snippets/nordic-ppr/snippet.yml +++ b/snippets/nordic-ppr/snippet.yml @@ -3,6 +3,6 @@ append: EXTRA_DTC_OVERLAY_FILE: nordic-ppr.overlay boards: - nrf54h20pdk_nrf54h20_cpuapp: + nrf54h20dk_nrf54h20_cpuapp: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20pdk_nrf54h20_cpuapp.overlay + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay From afe06d25554dd31a0c0054ee635e61ddb2e2b640 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 11 Mar 2024 13:11:31 +0100 Subject: [PATCH 1437/2300] [nrf fromtree] tests: arch: common: ramfunc: add nrf54h20pdk cpuapp overlays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On nRF54H20, we need to configure RAM with execution permissions in order to execute code from it. This patch adds overlays for the nRF54H20 PDK cpuapp cores so that RAM0X region is given execution permissions and so the test runs successfully. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 6cb283d10684346ffab2c8cc3f0cdc9eef280de2) Signed-off-by: Andrzej Głąbek --- .../ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay diff --git a/tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..2deb6756009 --- /dev/null +++ b/tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuapp_ram0x_region { + perm-execute; +}; From b933325a93ce4d27b49a9554bb2095bc913514e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 13 Mar 2024 17:25:13 +0100 Subject: [PATCH 1438/2300] [nrf fromlist] tests: Replace nRF54H20 PDK with nRF54H20 DK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nRF54H20 PDK is superseded by nRF54H20 DK and will no longer be supported. Signed-off-by: Andrzej Głąbek (cherry picked from commit 787e24576105b4d428deb64792715dbf8ce67b08) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- ...4h20_cpuapp.overlay => nrf54h20dk_nrf54h20_cpuapp.overlay} | 0 tests/lib/cpp/cxx/testcase.yaml | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/arch/common/ramfunc/boards/{nrf54h20pdk_nrf54h20_cpuapp.overlay => nrf54h20dk_nrf54h20_cpuapp.overlay} (100%) diff --git a/tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay similarity index 100% rename from tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay rename to tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/lib/cpp/cxx/testcase.yaml b/tests/lib/cpp/cxx/testcase.yaml index f06b451742b..04e5cd2bf21 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -37,8 +37,8 @@ tests: # Exclude nRF54L15 and nRF54H20 as Nordic HAL is not compatible with C++98. platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp - - nrf54h20pdk_nrf54h20_cpuapp - - nrf54h20pdk_nrf54h20_cpurad + - nrf54h20dk_nrf54h20_cpuapp + - nrf54h20dk_nrf54h20_cpurad build_only: true extra_configs: - CONFIG_STD_CPP98=y From 1fcc5e329b6eb9dbe2f068139747c805186dba63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 13 Mar 2024 17:26:33 +0100 Subject: [PATCH 1439/2300] [nrf fromlist] boards: nordic: Remove definition of nRF54H20 PDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nRF54H20 PDK is superseded by nRF54H20 DK and will no longer be supported. The board was superseded by nRF54H20 DK. Signed-off-by: Andrzej Głąbek (cherry picked from commit fbf03a406321b5ab955055db9b5ea0a2db0d02d1) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board | 10 - .../nrf54h20pdk_nrf54h20/Kconfig.defconfig | 14 -- boards/arm/nrf54h20pdk_nrf54h20/board.cmake | 3 - .../doc/img/nrf54h20pdk_nrf54h20.webp | Bin 27232 -> 0 bytes boards/arm/nrf54h20pdk_nrf54h20/doc/index.rst | 153 --------------- .../nrf54h20pdk_nrf54h20-ipc_conf.dtsi | 36 ---- .../nrf54h20pdk_nrf54h20-memory_map.dtsi | 177 ------------------ .../nrf54h20pdk_nrf54h20-pinctrl.dtsi | 53 ------ .../nrf54h20pdk_nrf54h20_cpuapp.dts | 171 ----------------- .../nrf54h20pdk_nrf54h20_cpuapp.yaml | 15 -- .../nrf54h20pdk_nrf54h20_cpuapp_defconfig | 33 ---- .../nrf54h20pdk_nrf54h20_cpurad.dts | 84 --------- .../nrf54h20pdk_nrf54h20_cpurad.yaml | 15 -- .../nrf54h20pdk_nrf54h20_cpurad_defconfig | 30 --- .../riscv/nrf54h20pdk_nrf54h20/Kconfig.board | 6 - .../nrf54h20pdk_nrf54h20/Kconfig.defconfig | 6 - boards/riscv/nrf54h20pdk_nrf54h20/board.cmake | 3 - .../nrf54h20pdk_nrf54h20_cpuppr.dts | 56 ------ .../nrf54h20pdk_nrf54h20_cpuppr.yaml | 13 -- .../nrf54h20pdk_nrf54h20_cpuppr_defconfig | 14 -- .../nrf54h20pdk_nrf54h20/pre_dt_board.cmake | 7 - 21 files changed, 899 deletions(-) delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/board.cmake delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/doc/index.rst delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/board.cmake delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig delete mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake diff --git a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board deleted file mode 100644 index b76cfce6800..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_NRF54H20PDK_NRF54H20_CPUAPP - bool "nRF54H20 PDK nRF54H20 Application MCU" - depends on SOC_NRF54H20_ENGA_CPUAPP - -config BOARD_NRF54H20PDK_NRF54H20_CPURAD - bool "nRF54H20 PDK nRF54H20 Radio MCU" - depends on SOC_NRF54H20_ENGA_CPURAD diff --git a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig deleted file mode 100644 index 954276ec829..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD - default "nrf54h20pdk_nrf54h20_cpuapp" if BOARD_NRF54H20PDK_NRF54H20_CPUAPP - default "nrf54h20pdk_nrf54h20_cpurad" if BOARD_NRF54H20PDK_NRF54H20_CPURAD - -if BOARD_NRF54H20PDK_NRF54H20_CPUAPP || BOARD_NRF54H20PDK_NRF54H20_CPURAD - -# Data cache is disabled due to a HW issue in the EngA SoC revision. -config DCACHE - default n - -endif # BOARD_NRF54H20PDK_NRF54H20_CPUAPP || BOARD_NRF54H20PDK_NRF54H20_CPURAD diff --git a/boards/arm/nrf54h20pdk_nrf54h20/board.cmake b/boards/arm/nrf54h20pdk_nrf54h20/board.cmake deleted file mode 100644 index 4c63f1dd05e..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/board.cmake +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp b/boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp deleted file mode 100644 index bcda6b0732b3acefe24e83332692e8ae898d47b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27232 zcmV(sK<&R$Nk&FkY5)LNMM6+kP&il$000000001Q0stKW09H^qAmnKP05D|%odGIv z0v-WAkv^G7C8MIFs<#_f`^Tyu{XVb1!~f~^1^a#KxBm0?$KBueKTr?yzxRD)|MGwT|LO39{#*Y? z|NsC01K+xSonO6Q4IkwH^m@#H=j+tz7wmud-%B0?{y+QA?r)yHJUxT_SMGoKKW`kl z_1&qL&c6bG5BukzfAhb|en2ZGY47uKWM|&)k22Kj|Op|7*S3zsvvi{~yuM z*Z#sCHT^9R#aYszQ6T%hXv25?9kP{cS8-sRRn~HZN_VFXGV_7VrZsBY0)EkU@d%ZP zDO{TD=THao;x*IxY4#c%C(_1A-lkL*4UEJII+fEPN{Tm_c_=izGlI;`lSSSfQ&t9l zr!I}oC4w&O?eX&8`wfx=cGKmU^0F!HK1YUGbmK>s5-#N>dX$p2G$E`oDFWY!)i+## zd~+uIv%gtK<6x(}ETEzWU-?>~k@tVdC6*nRFigE{`(T}MwKtOqR%7*Jtn+!K>=}cb zbyvmBmyR(sqMS!NVOh7e3k|ou*deS&v`)jorS3@ymUpRq1A$;uo)9%LD^< zh=}Us5mBoS+gPPc*@)d!vMnORyv7#TFtjumnwldw|J8g^k}rN8I9I*5DbpyQ`|mW( zD+G^|`+*4Ja?x^ts{$+3v)S2UM7^`AiNaS;hd9;seAUMqr+9D-8iCaJ_ij5YqzeYm zI=hf_SF}=<&P~E_P4XzSt$8bfx~@R`qEzV$K)U)jmsdPI=-Kbr&3$RqA{CHeX%vWE}L zq}8~4%$5>tvzCXYthxOrQlB!E9>%Pmj!kqXJhftBHWw@-rTspQU5+AM(!&Gu^m?H8R+r9W|7OPb$( zYDC_gB~1y#f%h}(abst_&Om9KRYgE%lnRKl(gCV(4Cj+GXI6+P>vOLZSr~r-@iJ*Z{Y+qy3{$w(C-Ucc4h zv9!P&vpEx0kT__~G=X4!;tK#)8*>t-N>>N`?NPs_X%-or-`*+KI4Y3$!)&tPBEAx4 zYatLe>3vUy6~2>cH6@kvW&ZSF$7@@ev{kO-PLQl?{=crSVuUvGUW^Th(=(JgBjeZ0 z;)88URvX0eAKkhTubh_R^qf$wc_SZF*vuky=$h&e)nkc+_IS0l7^SZGP1IpCWnjyB zpawTHE%E)vx@Q+{4nc;Kwm|5M8gK0az z71Ld7vyjEYF=th7=^J$&EJ~Ed1a%(NV#SMvy}v3i79?kpY76T{5W3iL)1Jq2c%`v( zwk`3GjAO|q{2?cl+T{OnW?fT>qO6++?{`kSH!jMqAXzvyBaLUQjxE#F8&xIy^Y)D# zC@H_5Z{&b#;#I~3fJGDAvH1)$@!vy}4A~h3`!;s&=@h0_pMF84pZ@O*J@Tz)N%6N! zROKOkZ8eLWk*l!(13)c>wWQ!|(NS9G-1q23b0tK3-a)c<2;XUB=Pe$ZeR*7QkqH^7 z*VrmOSjt3)60pVtn9Tui({4DuO&TOo$XthUv*tuzA=r|m=BOPPcRbvBR;h%~n@%OU zLIMVSbvOIQK@!2KqR>g9`Ddud83VY3NS;%GqCwTJs-_9=5dwV&0Y6teSdh;9vyyGi z0=We0p!o*?js{=;5aV2%J`T^dIlsLu@a|?-@nam-0ES{-*s|Jr{zhoat=OeHF}7%34UQ6FI8SaIA1OAW~jJ9Pc;uW32%OwwPOVSw9Cr^O%soLQel;5n--6nirp9 z_|-k_VQmU7)DR*DJG8X>JjF$(d)vp%HKfV%*q2&9gpxUXjVMeL?e}W#C+igTu|z&j z7mPj*8p6t40Pxb!^~=p``t}Q_585gJeE}`m*@f!{-w3WIbjC`9Gvuf(BmUN+U=`;THq{Xavb@z$ zyZ^aK1}HInId#{m!&1i3&B*+IeEIeE%h;vMdJ0JsNLcEIhu?uKomXy6*VR8giG2jT zu|f+Z*=f7AN#%9b!j&RzE94h;U#LzF^S%Cpz@^t;iScjLPA1wvGq!1RmBO0wQ;|BS zWx%qB8MI5O$#Y@Kw(&7T-YkCP>Yq@Nr}C9YC(0>|Z6O%Osa-y&Raic5Qt*Ni64Ru1 zwMJC=YisyI%9*fZ#2*3(i;<#9ib1D!3|Bu19y7YXimF65wrKsuLK$yqh+5UI-UVnk zH0+}t>U!R}UJ__UE@xzz7%gov`WDi3hmbnH_zsp$vo~gn#rG$5gWzgwWAuRTdKKw{ zMduHokK=vhZ2B|Kh^d?ijGOxst1#hv4&(oNzqCQY?r^N;I0Z6I6cJH!4yjMgb{F1z z%C7w(JwiMdJ=B2MnvEVE2||zzWM)m*t!vfJjOj6-G_^;j!{YmaPy_1|+(zBs z*i81H?~5W*Qkb90GH7oS|Kc&nasWqVdoSK-3}i;#s#5br%W=WRF2T{rOHB05zB0=+ z0V_yxt$G99+O3$HHl=+rq{cRojAO`4%X{MN23V!fR}9LzUnAn73ne> zPgOXA{**J8^y7&^SWH?|S@Jgtm91Ui%qHsvUMu6^GC{b7&peXC#aGSe0pJeC6A3T? z{`8#BZ5?p7{dSb@IVt~BaRa`7lxF99Dm8<73C;^CAnL|g-t?8qX%ORlH<@gsgebT@ zN<`mk-QVA{cC0S!-FWh%SJ)p#@m-2vv-1nVce?2Ns)WFdzt_*3!gojBHQk<*mylRW zYr}$X4s=OUV9txH^r>|74HP7eR9dt4f#ftC+yCP83)Zzx+nCdRxazNs1R=rv_K*9# zAQe4r(=SCI$O%4e3te9%Y51uh8I~Q;X&-No^U0Jy_W}Q}UDhN9dEotk6Vo*}_CI0| zX36tA-3SzaxiFf}xBX9L<&@;-?qwL*?mWKlKp!W5_W#lg&QS!i-`Tt$FbX#dH z;`^{4jTMsXRE)fiz`|xHcDLrMv!b@f&^dyxhw*8e#?O_AZZwHozPbR*lB6pp5x;el z8AXZd<;6O1{1kR))iMwn62g&*x8>8L6dfvKs)F0k(2!F)^fMV5Sq<)0lfhK88)-P2 z!?Q_Uqh|)v1;47?OkIDg@ zaSj4MQaO%ZKAq{RQF{iI3j*xNEtvbd@Wx5^`!sE-b&rT zsQz`zy4f1s;zaIaWk#MKcvLFk{w>bmdN9a6m1i@%PUp3>l-WG05DD#8QL3>;=3YQ! zen{XB`5-d}G52gZ`DaspS#{{5#am0f-SFQ5M-|F!Nqyt^|2;?tlyAV#IZ*-AI4gyn zIyIHu#E3WS-eMIT2#Ij~@KsX|Wm5cFlh8~;vN1f4&-lfzOzrvtV1SfD6}S!~gnwnG zPURmT{w*F~N>ehBA8Wi+p5cw*!=m#i&ab4WHJIYk+%wlmyaL;TIoPH;u{5LjiN~&} zkes=zmF~|9&kN`)jMNkVF;pXd%RKdXlMe`k+KGJLE%X)OcZ)qtzOf&-pn*EjiJnU( z0dsC4`Xh^FnPnkyK$TGk!mg?f0AEPXHIk}ok=`MYW&3ik-VH~GB_?`*adTL00z-0u z`D(CtB0^<3$afjF;UD)3@crO2tnbx855onX!q13kp5|6vCD zcDzPoPEmcfin7a1WJ}l$ACGUg7qe&&GG;zi%OTD85h_7Z+meLOerw&cA*=9?odO(E zL()JqK~(Z{J50(|rqdr;r9Rp8BM8Cm)dM0Cs7MMN(E|g0YJKPOem~P zD-nQ4nfM2hE99CazCnnN51GO%itIW6$g)7vd_l%uPFNNw*BL)Py5$K%dCe(n%DGWl za27H9|B@tCeQZr%FL#tTCD)Gl20tS=7);1Kk=wggPNb}f zk*`&NF;Sd5ih3l#l=<^zI64rO$bqe_HAErlLcU5s)JORWPv0mCrVRp%;r3$twB^3B zdux$6{KHOkH(=u^O|-%t&m46{O50M_(&*dec+h$=VaUl(blK*L47HSVN>{MZJ-O0Z?!UZ2VNK5)kjilN+q28AX z9kVtbgu)9}(iT(Rvgj8vZ@?U~_gCb)!0mQn$xu2QF_-US?aEG~MB^IJK$67L;LiyR zQ22quWB~v`7Kx%aV6M{TvBaI}0d}#`e}e^K-d859f0+k7HJ(YYfdz-g_$Gm|8u~M< z?W$>?4q&)yh4B4cnIggu(O$=XgEhXJ1)*urcplQLiv^?yzc+;_8w;O&)lS_J+Ib^J zY~PWbh2}h*<%Ew?Kg1-mp<>pOlK~q~?E!yQ^AYfxYVTFw8CHyG zfX^kR9u>}l`LYfwF!rS;h#Yx1uraqn{u}+-+&Gf|ov$Fx=FcUey#YD%IVu0n!Xz0gwsT5acjwL0klt@REZ-Q?jgYYDVtzNe^y}Z$bvy?SnZ2xiJ)7;P z>`v(zw?j!<8)4Dq>%9jSX6dbV7jT^oUIQu0Q?Qsv)j3H)n~RYbDAP*#nQbGOvOriw zI@pP)EN*xT?}$VwYtgpW?q%v>nv)ui2!>N1wtRN$ftd&ccxzV_7A0g-ba4QV@nZdc z*}c2S;{1)ZdSOaPyPFOE7{8Z)jzTf=;L8IIRfxeA)^yH&1CJ?z9EC%81a6u?z2sT2 zyEYiM48bul<7V-?W(RjVX))jSPcDt@rNI&K2pQYtM5YE;O;Mp9N{QwA ztZI_~nuQ!*v_{30cGph$-=^9^+xB~|Ea9EqmpQ8$v)~T^x_RQw*@Qg>wpf4Scgy5Qm-iJo$#K7 zI?SQ9IhY{Zi^@I`w5dbATKNd@ZTz+9MdB_*kmy6N&yEhd{HS(yr9L)MJF}$P^V zxNmr&l`9X{spN=;|K&h7>|%KVcfLJ|TOIV9U&!hOU036Gm*AoNZ|>Xgc$65Oedseq z3!4KcigwSe_Oi^tZ{@sTQ|3*x5iUTpnUwC$JbpUVhldI*hoer zj_*FnL;EMUO}NkH0CFGw3R=b3FkOTWMYWdLl?dozvU`K{_~ie+IJcRlpjUnWuRwU5 z{4SRbS5uyc9bGps=Py1Mzo#2aPHl1lAw2uA=lEpukj~H(89kPPZrlIXTB(Ko;I-%{18 zPOpR-j8sxZ$V5gG*y221Wt19=6_X>HS5@wj11nX9HH8{dfTVDxu0D6t$S;j@^jvCW z!olT+(Zvn-?*8sRIJixwOMm%>+96cQ$r&7p2HN3sEpiIa)n1p_LQUN#@x)N5ng3-> zHSWNB?9c&8*GpMZrs#J7olsbbGN)>(`ZT7kY;LKuJJ5jp5rIY|%f#-~=NWQYm)~li zqg;bftvGJ@Vr?Ybr`ymNO#J2xUE4dS^s`D`nyEqdV=D`et7hMS%INSqQFv{Q0{ zM+bU3YxhPx!|Tn~pW`!Fs&*qV7aqo~+(b%Pt zJr~{_6hzg)aU;sF`i^$O zKe5zwh*!h$jo%8YO=HA6Y0qMChzNf;Z*G}8TQ&++YQgwW#IpWCd|v4z6u#)tHr`;9 z3Z~d-7JrO!{HK0q%pzIlzA6?-v@LA{-8CglV`Vzxv5GV=nnxE6d|DoUnUaKEEQWQo zCsHo_lfAe1o5&w@O25m;6@4=lkYh#91(jZS5~OE8WiL=3zYE+!C7{>=5F4XtJS*W3 z)wDCMtrnaif)d1w+p?o)!?@|#+^)*koobI{Nv_~nIbpz#C3!*7)?5L^{s$^-{A5mh z-X9kl-RD*8l&zLsB}sjS>XgGfWh%I;MKOxoBMIu2tD8osePcxJa-|c|vnPlBtqDj0 z4tGz(mV;Yq)Yu&b$bl0sqAT;HF_;7VkmJ^H-0$YW&-0>wEMtzzqKh%IO}j2Zc+em5 z>GauvL;0{kdnpPw9&dQLh*xFG57}we?|-t`raj;6)U-k>K%VH1V;|YbSL%quLB(J+ zklCSUN8=)_@%vFO7PAL?5}ZXKavcOs@3Cb=l;_hL;}*LJb7u+f1r6dS_Dk}`j$C44 zm(F;3wUhkMk?W^PjX>ApHU{%t1%mkD9u_RcUy-gZqlWDXT9z{yrO@ksgVaKQ`Gs=j zj9qr-;Aov`Kfo{;6+%47ZTn#x(pP%ZeI-nFdp7C)-t87)PmH&Umalwgg@rxr36<`Y z;k7gayCe->lHn2eIBDq_>^ zlFJngySy4vFeM7%*XkwF@AHW+JG0AV1yJk7?B}|HR0P>lJ6ZHIjK?|~=u!wR zZQo^uxH6SY!2R}_Yr?#6h(L#2f*t zP_+=a#R&1tm8AZFr_(g;Gv#M+RsW#|kV$fx^91Ofd6$~MC8tx^6ITU&lMONq!qZCM zTn+M-ZX}@P5a*H<=5H_UV%_BTf<=lW=^=B3c`7?r#&$v?x#{f3UV8wCf($Y-PKyDP z^r7FzxO=k7K)r0RmkX(W^sp0n{5S6X7*F*NxqGkZd(Pz2KS`lk^z7VPo6BQtk{DWqm&yGZi{ zV)#}3Fr=3Yao*l6Gup{6PGLQz;j@hdduqGRIBPMHlC^GwJTB}jV65Tlw0;RcibHe1 z<{oh*+!ItduzbCNz#DcXnl(73^^3LhQ^vBeV_hO+?GJ7A&AY9SOEVBLo6XIN{MNjo zv1X%5ZGzz8&hso|plf{X&@ifuUwMG+FTbbvDG6Ka1_?xJdx6xrQ!>pqRG*Umej&n=AO?86T(8%U8=Lih19_GgXyCOV zV-P`;y+d{(ylfaGtAB5I{vB&-3H=@lle)VoCL3w@-H?0MuspM%+xHVsBunIze8dvo zSR+w6bY^Jm=d#*|NulZc$GZNwS_cn$5+nry=JJ=CSiCMUX~+Rxq?8xfx^f)#k1^n{ zu8p+pxnRL#^GvmUvBTE^Ab@M@AIA$14ZVdWRS0ZqHT+h8#$8bpVIrQ#hx0M9 z9-OlvAcJaeria$VW;ujxk(NokEOVe%FC#onSD85yP*(eHb*gUI{tZsevZ_lPS2toO zgCdJFww-RrvHDpFhz&hysu3|3#)bnC>_%p?H>P6KB*vGHht8Tk`?Wd_fZVvvEW-;h z!Ep588D?(~g-Q6;IWW$_?R_D${2;R@t*C{dP%U z0@9Up(bA7EkNd!W`IU>kD*^-2CCx2M(;| zp4XV#eeeI%(Eir%o8W|J^J_&Kje0eDh8>_n5k*}^6odIY7m-ADyx9S?D#fj^-`eDd z{6!(Ftp;a{K_eIXtb$sR0Fx2&7KcQ-Iup@|{Z#`W3p zpJH@4g^C1S&-SsxuD5oy>cBfXjf)1;k0L11`}epol(tlO;5Mt)@|`VFi-c%tzoWE-Zp>fKB=T^3XJ>qt8XK_25APWndGefr#C_;$(~jMXS% z-8@*u+_~`JN+~<)#mkY<2Tr;aLU*8gs48ZL$B*mW%;xg#7ud+JY+Y@>a4JVR6&R$S zqpgzfW9}Un-bHGKm+V(dzoZ<+?Ig<5OM#KyAdCTv_pVB^<#BxgrMjC@`!=OlyV}=& zA~Q`j>78q}E4ggkM5mUz^dm?Wue`sKL0fsd-n`BrF#$m)&yCN@B^cmm(NRB;NarC> z*T^M-i6k7*7Q&@?QfxQXJPj{Ef>0hHD%HBhNF;Sr-2_>SL3ry7t?*#*(C3Rk_YAB0`?&@i{RVFeI^U;0}4j0Ej;7UO(2XgZM`1 zQ^3xNA3YLg)grUg2jMMUw49ViK@kWR-?x*!Q3LVqJzk@`awvM_7?)&#Jq0p7$e4t) z_gU7$La{k}pgvT0J9uM9>LySuXo=N2m{MigR2!dWh1*-3Ib)uUX{8qCV}XU&^gx4) zh|&5f+jGsp9-#kDXcq^g>D|>OD)_3d#p;X7O}dEE7_i!u@1WpY=G9Wc(xEXAm(64L zAWvVH2>Twg98`B+q1qAqwHaf>xqp~y(KQ^^dGJ+OXehr<_dU-JP!fsGOBnQdtHlo2 z9y-QPF%vqHCypnIl@wzVk_MfSSN+ zJN(`Vd@J6)A3{TW$K|vW22`l6~2ZA2Y{nIJQVHA2AVguRVjTDAg^C(J!3s}Z8 z+7iX2X%m13LpNl3aBn{})%z!|61O%gwb|z?u#>>F#GfYL$aX}IBxQ$!zQ0@jG0lcf zm4tMh{EXJ*Ii;$`IWpI z<1epa3{=CAlD#c3Siq4$`LAgyS|tzcPUNTPd+<%Rges7^6A598WL7X(0R>=@~j zHV|xmX1P&VDm1w9pyFk`;0L@y!R0mhh}Mqh)IZO3Bw5+Wv;1F{iDZw7eHrrr9aXce zwIBfE>(0Zkn4Id&)=j^hD;oS1W5@i#E50&$v%P(1I&lM$;)#h*#g*dTQ1;HPYKsOh zwA_o>Y~cI`(YU3xy@DojtK~LQr!Kb$Wr^D34Fis#f_F6WfYCGxY(xe7k6EdJL?a4< zV)%h_0MSRz`XDOY6wZb%1S${Drg771P~Jgor3nW49tSx;&!EYWH`7e)N+H;m_!mmC=V|Kq^B1ZRk_L#dh7_3Ov32?U@e!*w1APB+>Ggzsxa z$~|qq+yt}STSQm6TB4tXQ#RJk41+yRLR}^fZ%vJH7-a?NJyqZ=nZlh|(V{lCG(y5PG!Pz0ga)V1U2k}^6+a4xX0kn;!u(QD^`6n5>p&N z)q6tik+t{#1_`+g_FXCL+9SQW$m(vd=rQfzIL;NgybvI?5`@_zYM%w~?|b@GUBT(!~m;WRo#C6hHQ@X5w;I6g0)%e>M$ zS%Xq6o|x7$CY-Ag6yG)_I0O)1ya6z4EPX@Ug=xAKjY@%}O&u3gGhcQdPq7;Z!5Y*U zUo0B_J*P~0B}Het-iixTjHExMlobl@sL=xTUB(^HgkDm?n;?x#%r+f_nLCqGjM$$%n7tl7+o=Rh2926#KzsQ?hzP*?lS= zSvblAU`b#I1hfhu-&$6i#xThk|8N19{FTPkm)S|Kn)S&|!}gzvUHzWdf-TFI2^O@> zbaV}Oh7u9XJ1u8J+(bl#aep=SWk6|(oOQ2RMaX`6xC@#8Wh{ybI|xMT3FQWp9LBP! zwsu9`3A5UEnpV~ppRE=EVD?zIqD zi=Q1Q;L#7YWMw3_X9i1%rv7hfncX&QM8mghyaJ|WeNy>?0&fIP9Gqo}CSncZ$+xny zF&g(Z4inYGAyDA`Jh!TmPRW~PrxxIZ8)GzN@||=7denUduMA!{UweGLZ6M;6jX`u(m}n?BPw zp7(PmFOx)V4TB`uaFJWS$UZN)?*8%BY;H`gI$S`lGaR=yF!QkYq63|^-n>}T*SAD7 z`<9y3T@bW4IjEDb6v}92r`VUn3ItlC(XBdV^CoY0=K2bbku6~EPCLfFW0$CWInUmf z(xyNQd;lokaOPboaAVxivIvsdIrhte>?i}^DqE}(qq7;Ly{%KkZkn^Noml*ky11ML z@B58I(o=+YVZ}%Ti6(jGZ@?Iiy?zy~vW7&5CGWnu77mqqUP-@^Ef`Oe4nD561t4|J)>WTAWeAtxreKDRxuJ+Li*jhkCHNB7(1R4wDks#UI z4n5`(w72#LU_lB;h|Goev4&qbM^j~);~m?QZEEZ~6EAPR>QSgR`ozV~1Lw3qvT6u$ z5}S2O3V7OB8=-H&qge5Oc?7?$bEq?{4Z*&T9xJFlt27`o#tmiz@S9#%`f9v^)s-A z+s4|lxHkzN&tg~)#11dEg!@)IW}{Z%?=I|fBdsX2CTdeeY`99`5AcXmCLbWt6(5D6 z4-9vYK`Sf5X+;pnd(6=NnA*JO;%*NE)E_RCur9eh$C3t z7qZqw0gYxC>Lo_r^-y`#`!hgB#FXX_US&+-2*(WcTMnb#@bPv5 z{$)|wnK1^LQ+8S(MAsXRo5H)Q%H<6HD9AY?>opn2Zy_}CYScPg(4Xg#&Xe9KcL{1NGuB1;vHP0~Xsrcf;2Bdy(6XC#9 zkqn?K7ya`(gRsA4rvDn$`bL_68;zWHg1JHxp0ah+klacJWegH_K50JPt53X$1k|-D zluJYDq4YCiOUA_3VV5Dz1D`V60dufOonH&d7n`*qxdDHllg>30(YoDY(PR>NHROcTCTpB= zpJsVS+ip#<3L>7pUv_F79pimKgXloIqb8ZrTid9cUCY#sL!MwXe>nwvxmFu}=~QYo z21m#^fvTSIkE3k0(EWh2z)r4kry>2qnxxn_1XlMB`QFHX%&m^zFHq0=&gMu(W8dwn zTXi>8g>4hH^us-YVQ$H2XM19sLKO?qt=**zf|mXG_L$?O{C-C1CQgGN*6r6k&DNmE z;clq2ay>Rf!e;S=$YS_sDQKKrX9?$E&DoX(|F?Lxdk{X;v!IUZRdz!43qh)a`?qdt z@W75Zj_SY(7DDxjICf_KC-P)?qUoQs6E0!svimPIhj4l}pu7C5{nc+yIip2LQ3&k$cAcasX=T@eu(HkcL|fS)k@W**pITdy zzfi`hS8>e|2O=`wtc>J(;}PYx%_PC4I}HV8_~|LOrvqiLCY*Lra+qOXV1_OwB|Rk2 zA7{QPX}Tydhu*-m$_MzozD_n?lMy&pR(o??LgD~*t;L&AZ4<6A>oLzr+QkDX^YkXh zx~ohy!XhTJOuV8w#{t&*$_vkn^_#*NKj~gFv};1{0=3i(3DMD|nz21uM@6?UMf~9x zU78U0YYw~>IkDSLpC|{K*dtY(;67-@qn0T*KWRF;{Un*pcw!0Zu1U7nv-3bRo&tJh zM9f5G755j-*J79?jqNy0>5AMiL{GbVrNRq|ViXXBubfA^_h-M{P(V|*n-N;4q0qE{ znJUS{G-TLkRiML=KZV@RPR7q-s(w+(C=nx7aRX%cPdQ?B>%tg65bCQ zQ~rZHt7f3$>~nZj7!e#^RZ+RY88C)9;DNTC)t>?->AX{mMsom5PTKwV_qxm5k1)n; zZ@x(`hFwA$IwS%UwdHAMx@4ifSpM(vn89$zZtz)dXcpY7OhDz75GZzXxNy$53c!)q z9wqSQj_KYl3du=I6W#1%?0jvOl(lITW@eYjg>JK;&ytMJWa;^!rQ3#wvDs`wc*&$d*D9GI# z90SSv=^Mb4yloqYSi~^8<7Y|bDAFG0i+=|d&fBSS>8#W|UC{M#5Fp1Z+ZM&wtNtoc zK1k6UqwL+k7Zzs-O^n#55#jcKvx=k*478(y zhj)soOt9XzVBKr)l)o5J=S^wSPz{3Sex=N@B{^pyOwsfWF~o#^V6ho`f@%TLNn&LVz5X_xBOR%vEcPyO*L)!$E0Hms(mL}e40XNIwUUD>b;h0u;FidkK5p3J z4{OxfJQoh~(OEM~XEz?n@(?Z*UYgo0(GPr61hX6gwf=oWIZ^Wj%ij{tsz52bfxm8# zc7vBT;r|AVwoTmdzfi2X<`3t>*s!y^wN5bQ4u*PL=KB7^TFg=NYPt&MS~x827~-9D zXLA4LA;jcbeTFv7@JsXanQ|79pHv&iygfJKx52Q`Sh7~MW&F-vz*~w;+3{nUxxDfb z6=F)ED4I~YG{~t57E?%pX)isUME_Fo+m``xL;YsH$IISb?qJ38++q+!6YJDQ5z4IC zfWwXRdAY5>Nm!%@_9;fF38O&w(<}en7-TIkZu+X_NMH18XB+T}_rgyqEcc`(A9G!k z@3<;=6FXoKWDB;@M#+7){{m?+xEquLM!4j`p4TYJK3K?v%o7&Vf}PEp4M-0fFw79G z6zooEEf;#+?Of3EecMDwbbNT+i8y}pFr5M7?F5BeG2=xq_Qy%%wokBji1RA{h;=L) z7M@mMqaX3GskS(sBrc!RSWCLuS=!Z?OQ;7lC%4nldVHk%i$&`n4TO)O6+}-t1rjC4 zqX&p81bB@PYAUn*yMO)S!u!BLdNYbS<8Df^FJP$#7qG^>wx{X7(J&l@XsTUkHMWs89Xt;ro5?DUn}>$e6m$2@&Shlk-7~D7O52Pt0WR;ZeE1M1 zdiEkgY@PIr=Z#Z%16k+2kjCuDF{6n~7!XHCH-f16=jnPCs=`@p{Tqdf{)O6(ZLtho zpKvnbU31JRS9TY5UrmA~%1OVMnL@S@1q<=&hjH2s4>n`hAPW@x(Yw)k-=Cw3p+N26 zAoN=kQH*7*P&FcktczYONK3}EWJjOdD#juacZ{3!Zu?z&qxr~nJSZ0nLMJ;s^8XtD z2bkw~=r`r`%SyE~o*{FOeMJd-9s;d3@RJ?nx z7_v=Bx-N3F`m6y~`o^LQ)`Qc{(Sti8LQXJdq(g5JUrSX;8R#(EP2h0kZae zoHp82VkRbYl&&WM0Ze=Z7^T3dg!RxfO;BcR*p`DF*bXPBrrag9QaJWE!mmJ|xTDC} z*|qb{y2F+|&2~xe8eIgI{5$NcSfN^O1+MO98A<6S%YUfK*s&KObA}QZ!Lz;kuHj+f4ROmzt%2_q86P z#6~TUWXpkoC{#pv?}6TFF%CcDXSndS8aL-lILAMVe}+wJxXjpv?s}V%vJZ}V-VGWe zGqAEAML>@s6JHrAIaNo#&_-s(7DGtDj(L}z`iJ-2lqU{8zJII~Rx?|qF4B*^wmSNZ zZAGQv^fE6|t3*42BD3gI)snVAs0c?vW|f@cxtRA}$ydnpn2Y~Ur-{#rZk%F%!7jt{l}`O>35J|iqNAZNlcluqoV=p0xg&@ zhCp6{>;#2T)nhZOzU-cOnzSo|A1;HD&;@&fufFrb?>UGmqUF5UR36Jizs%$%qyWo_ zAKcqX>Pk^KM5~=q<4L*ze@DwF=?nb1T?@A{^NT`J#q>Ja;U`CY0pNO0pS1=-Tv);g z>_%Ibv{=-ZE??}$6K)m3%0LYUBU+Q@^$a$JqZWy6>p6`AQ6R!6ErEHk-C-6R1fJyV zehqbBSr_i;G^%vn6fq<=+2fa|Wy}Pd-83OXZXL!V@CcaFrpbNws@NL(I7Iw;p#Fx$ zR1j_E(;TNrAI=j(eBH@N;mkuryzmi9vV}q|`tj%J?(a1c09LMj*xWmkJ+VDLghPUMe33bcyrHV>v~-7f-3h!?}*#v z3ZX|VwP{1Wj@U1WO^Pk1eV3sA;L?=hZx%r9Nz>VJV7cIy_W(oRIRLA;Md>vFoNM{T4Q2HM_Ev$s~Qsn;f)1QRc%`F|0De| zdiJt3VHpLE7ulbz%!uu4Sgt_(@Ubu1>>_p{MHCrbE+8A}i6tO?2hqIE%2y;Qp~ea= zPBDYLj9C8-k&+#JsD3jqw;D#+bR-5lf-ylU!ZlmJgjx#wRzDz=SLOWSN>{er^z$Y2 znm&&h!|iUU<+R2Jo_FPU8Vs<2*$Ks03J7LWjjil`myqIs&tkQ*hxz>R+Z zXhXT~I3qfhfzFsx&<<9KxEO*4IAyFyZJT*C&8Qj#`6`Np>qGb>wIIpIEOo41)*hc# z#3$E;$`i^4tHv`ojq3Ygl!dVQ5Th*7O`JG3w);!_a}fb&LVFnV0;UL8uDBukf}t}@ zvD;g>yN>nm@N>OAo0Dcx8ix7r>9j~%UCSj7j5A}5SIiiTMzwkFt~2mHP#xLgmA7m2 zZv7quKC7VtOOyr&*50y}u5S`M#ufQ@V?i$=@QW;`00DNylEcp@a7 zlW9Ye9+XS`Zv%P3pvZyndTxW0iLG6R89t-*{SnK22J?@W6V^@wG(7SxD`{ptS#M8; zO(QF63*MC)u~C*$OI-;L$O+ns@R} zjxlumh^oaIisFFx@rGkOkF=_4I~aE&hDQGJc~k-)ML5_GUK%-ZFn0vu|zDFC0-D716cj5Mn_9mPJeua&XwE<2lvDH+su*IpyJfp~7e#)O`r1}7l zR~+0?PV`&o9(z*+1|D=Gt;kmSf5$|YH!~P{D)}XQdD?n7mH}7lTv^G_5_j%v=#vk* zBF%;D;V75cfAKDa9Ky6!e;X-#V(;`gBGWTVmuW!nIR?lBF^mH!)IXtNZ{Vq`{zYbl zn67J_{2;e`5MXy%^{)fSN}v->DYg);7|f3Cd%aubw5DDi^t$soO(#;2d}-qS zUUPB(^*Ls`Mg-1*NfFnj()QA{=bSxo-*U0!%f(;c0Qcq(!t~a@0$?pH1_A?}Kge9t zBq)CZw=-T@jyP&#$2HxiBx7y1x+;Oio1di}WAR=?)T9(`hJorx3=1 z7h)lfH-xn-iL)9#%NAk*R8d0~fj6@L1m-YVX~Okyw7Qz!<-$0QO>UvYIieb@0dxpd z3P2w~Vc=~>MJDrxm?$uXp*fo~H8b5x-Tf`l7K3pwL1uO8^06I& zr7^W#yxbE%<0qzTYvY*J%y^ec@2>#0k+sP;YA?**O?!YN7y%G^TT}~-?+w=1Y)g+x zl^(ObODmd`iO>2A#$}ZB;5hzC1@_*UsVQ=HC#xreFjdOYTkG}dH;9Wl_|r!-n);k) zdWkLr?5L#OzDachyqkyzJo=wmxEbQxTR{HA2xYhUHTtsseb28TBXABd0TBE4Z%>KF z_oau~64jMT045a0H(x>}CX1}QT1`&GA1@2(mHQ;tzGonsHOvmttIXw10(Y+~G-m!% zKM;TlN^D|PkhG|!7;K2FyPl32xU#2kIn*R66lGwpHz7(wvZIuU;1x5IAef3zL(;-Y zo>=#`W{nJwq`{6Y&x_#Z1=mj-%Qk|YAY6l5r4w4V4v1TowrcJ*Qndr>T5N)yrw0jD zOC+p2#2HOA4jB|Z zhdm48o#{AvZOyFTWY?lew4nm>KX>LZ-rD^4hwRun_twdfnzfWJ-S8TWIJzgt#g2B1 z9wWd`t&NkXp=W7D&2Ep>Zloz+?sCU%T|V{dxk19JCINQ1QtFP!kbQ8}aqm#ZBp zieN@o8_x00u{=hYLF1aYofoY?S*_hGkvDYA?Ydw?F zFty4U5M>{R4HjvB=!OA~V%We)d8A4LT#0NULxQBsdMm{q4uNr6gtmv2jwaV7ns^t3 zWy8eFrACDyM-;sHX|Cv$ucuaY%I8nTPMq7?5#{)Y4mnwS){AmHXi$+|c>4|jiqv99nP*F3 zUp@>CXq6ohTQ@YGSF63yF|4`0802!vC5J5C@d5*9?rw@Ob8}_V)#gl89+5(g*fL7Uvj{_Rb_Wh8b-C4&ttd$RU92|M z`x?1U0HjeZgtwLm%&@lh-jP3=7EsO8bOP~?dmOm9S^nXT3O!NCn(;M-b|E^aY0ttb zkf`j?|G~S6ofwdSg1KbqmrTAjPbv6di(LdzBKyz6YCg8e!l%MxDyF}+YZ*S1)UztlpmHtS^Dgnb`gM~B)#DaCvu|z)J^GGl zN|mk*V=2GiqgJN-y*i8T@yN(XG5aqmT$ z9Bd`2{i?A^%Sumzb^BR-GV!}j^PLp*a}PVxc}u&USN9Q;nh>=SgE=d@HB$DKu2${$ zk`Az?(a)hZ6iY2RP9PJl9&~>q3H#oBsG6sGXBf zrC0fy|1K8*iM^36jvumMY()?6d`+d&-*36B?I%cuK-&h#UIBW;VQL`5ZcU>rU9cW z*UiHi6b>u@?B%69tETpE*_O~cUDdnDrVuP#KJ~}G+Nta($jMO&3x*_a;`D5 z%z&}*DeREg_I4mnU)AI8WzH60o3mbk6M^M%s28gjPEx3F-wt0TKPc-4z2C2Pny!OEfM& z{SqE_U}pl6M6~>xDA`L3w^zI+f@L_t5$~D9w?_!_H7f02atl)z%FP4#KKjnzC6lk?tR0o+L#=Fho(0*#x zIXgLyWaLB4pw^^MA;1?fPfX&+(oXf0uvwQpDej}5qk1S|i^?EDTAo;jnC;tgC8I{( z#N!9U&9zorsq0?v&wqNLjfARkZ{1pfq?X#L%3;8{BJDYJ$<;qKm^`NTiN-{%rQE*J z{IkJBH;qK711NdHc9=US$9G}OWHp*-J75*S1du`!A?y|wux8W(#i>FSEC>@yNH|1W z!8ItEC0m=cet?Xc)AZIN zv5kJc?$oviQn(pvZQ~QTPb&4jo1Isa>;s=~-RP#c+PRu74$ja8S9FqXZU=6wctfGF z=shij1v(~$$Oe{L5-_pGi`3m*^=+Ggo?1a`pOs{>K3v^2lkbuDw>>v^_0{FBPEMUF z>&V!I3*2H|ZHFASFh~StF&@X2jwPxY=Fq1N{URvcvY|>bQP}bT4OL&RclvmwPHcec zl%CkPrM|0NML@I9^;toXy-@Y-Fx5bHMZ`*9}qf0CP#WanRIwy;clK0ar zz*iB@mna^3H}5A=sP6E*Zmq)t+9G&3`XTx~s%O*Ip#_cje#y~h2&Wv~SJp0Gu;C?g z5heJF61IlamdA9}2RuS(vJ2Pu$ccFpl3rlYRXAE_Tj;zQeWhg49W(2ovlo}oLeJ0d zkBE-I`Quq1*S9J;5J=wHL?y^HtDiLO;km04X2t>=G3Vr(0giKT$b{3~qG}k46hp!3 zsxMeaZh7Rc!xte^$vQfxC_VquvJjgU4uBGtxFhVf5qzi=KG)W!Cyp0t_pPVnaG**q zuiEpw6A)$MC~_$0ssP@@vd9s{i?f;9QjD~!x%7|ik$SJ7;EV>)^_g^+s&09dSGvhl z>#^+RGyUxhfLk`W@4D7mX~1NGlh2Y5wwQxs3Xi2-!EmEaUq&$i30C{wk)XPasx0rS zeCU*p98z2iPZNmFpu%S*QWobJ9j;^4z~RpN!^`58&}oc<>5X?HdV0Kx>(lU|>twx{dpG_!lO*)|b9#M}JUF9W$bqy3 z<-a^P8-6xV#_3p_LUoFg$P$=xoGa*OFsr3E;%k$Wzk=85*3_ofO+xULrv};7ZHc1k zwyCg>-xG2QRov$Z_nQ=FWo*xVs5(;+@#r7?T8AZ?9pOu6K4Kk?S1%a+EiNx&lk!+CqNkPcT+`dB+>5tZT%j<Ts91u>cHElNLL|>t6`nD|0Rv8%PcD2c`DYb8(B% zY-9UDfm9ElY-;D~)<(jJ0Ol4WuKfHbcp8g8A$^f*fVp^mxEoH8KBum5C3dI49x|Jj zn~p@x@v{^&^I8!i^ad-TnWrxziWzJt17Ogd9u8fIZAKo7Cy$9|Z86u4{Sgl=aZjh4 zlNaN-c9mda0Pd_@Z(X%4uU7}5-1UsEDxnD9_LlSPhI(<((puQ}jL#mBC4Lo?0XNpn z-o86n31O|#=G?fR74$kX5=tmgHuOK2Hir4bh6R};+2e%nnSEmP4tUvQ#g0s$6@C9% z!u5sbjgGaU4P>V_YLsg&7BubdB*KD^8q^So6snGX4fkrFfej0h5x@~<@gQGiPy+ci z%X<4ytF*0@qgKp3LjiJnEhquQM_~?RbW<;VK)U`OCbMn1G}+mMS`ygia~|xIRDS=WJCP%QbID3>v?9dgeiB<||5XsEQO*%C zcM1e&E4So84(^V@Jgs0jaYK#u@y(;drdt82Jtja02hE}3V-=$&p({*$XIkrt_%2Wb zYjKeekiKbukWGq^jnCZgI?im_3zmw$x3(E>zokza(B2g&LD#iMC&NP`$p{v%$`J1#DW_Xr3o&P%tK^J~8Il^(Qw>*b(Yp zT*$ob*Ktqy=%yml9q8|70Rj<&UsbExmeaumwc?0+)V`?BPN%(Mpv0j)xW+zozg}0M zzO0=J%JfH)u5CV|qJ9_Y0GJG3SAP|G;Syg><_CRt9S$2iphYK$+mtMctHcXQ1qIq>Y4I`>*C?w_n7>U$TRlr__7*X_C zH1l!bX)36_RG;PWhL0Q=5@uXW8|kZIim=eG+Emg$WGJh`B8J{-9qt~CsXFF9w8bJ0 zCSIs#K491h=t%(ysg1sC*jz>}c4En32nz=RsO&6b%RriWN9TXy|1)85U#S(ESfB8L z&CFGd@xp%9G33B&f1K-`rXDoFj&XU5?WEoeXj$59s2b?s8k z=ONT{_VuiGefx=}rt*Y(f?l@F3&cEu^3V7Than9xgPw`MaG{L5OVem0n-@LgDl2RC za1pNG{>vhVXQ=)$+d__=0+8O{z4*Us>l+g5;Te zs69Z(V6Y<5zUX%@u)f>!g+9$a!OR|))Ura04`=mt586Vl#L!PQdK*eMTYn6V1{nrI z0FY2t==EJMnsJl&Vdy(R|D3#42R12!xy|~(!hm(cjvcxH00CtDLD$Ewt3g^?SG12F zvtpb+3{g+Ngx8F(Qi|p{A-PT{sQ%p(7kHj%DT$*t-2V#k3#oZQN;=u_7Q@0`r2pH+gBz6swQ~Z)rFiO5 zU4!mZzCea@G1^Mfo^g5J#!)Lb6(4<-pJsd_sXZM+bMRyHInfe(}L$G#B$f2X7_gc_Wz0`M<12xCR2Gv(16fTri z971@n)%{~VN`w!%sr?HB8pTc%8T==Uh4I6>duX-OAOg}Dnpa`8#OBWHmWj_DsY35{ zhjGb*E#Rsb13IXTQ*adl=;?M03<&zZxtU`5d2~U0Oa1z(#gIYk<`;tRa`Ule!sN4r z-YvQ-u?sAX#s+=o2Qiwx`iBSm?uFrbP3~TN*U^HH-jO)`!R}y)P`Ilvo{e)wk+K5pd%-K(93?AAO7Q z{ z+M6JA(CqeEuOlDfwL(kgn=SjBU|0u6GpB;=KoI)7a%JT$I(Hm7n4x@Oh<6vhh^%J< zTsG9iRI(qfKYj;RC6aMLCuLwik8}~)T&iN=Bo86|TT>>>KLY{`gEkuBSbM1B531rc z0NYj$tId{AsPJoKU`14Guj(t#volrwiSxfxZGpT*q^O0b_LhjIHR1JD+qMfuH&JTSSQojJrHiG- zCj1N=f;DMSnoQ^eK|vOzWQ000FF7&vMTpszA;c068v<=z9s z2HG(PJG@EvGpmchb)3Rr)GcH%Rh>xd{!GzoNr||tin>vbA4sL=AUraA_ecZPpHSr^ zlf8f+WskMrRSZY-)=-yRaN6L?}^NO_c|&5by>CG49#YHdi#~K zrt0M#kWz7e?2bxGG!mjWCkVStvcjP6rct?5maE*{NTpeqpQ>`8m-R;Z${_i^TuOGf8op*_Xr3m9XU>R7;k0blj!ShlR+>0C{7$U@ zV*h|pLKs#I&oDq8*p%N$h9kQFDNB=sCkt&JpJT`Q-zmc(9y+>9mb{D#%OJ`i{kSnY3AN}7<{AQ>7pQ#`V{x!3N z5jF_@Ooc-)i9Zcos9b1iOMvIuM-r1Qi20*1U9a`|vem!M$Bszxg%k92usgs`37ZPN znvdz$(BvwdUPuhUWY(~^SYPp~W`9lJ$-;3!LUXLGRa<=<7j6$((N=lasIg)eu2VIN zZM8)R>S_e@IJ6sX@~;uOe9);@w>*}DJdGFKi|GdUTq6pCv%E#H=>JxS1F`6O?S9yu%fV9Scd^B4jY zQlC9RJ&yco)#-rO2CZ%aG{3L#&W8o{)uoeD7v-(zuUh{qZkV8RzWTy^DW2i6QLch9 zZ233BnnbmSsn8ryvrJeZyVNNP&|efR*Y6$Vo^w>Azwi5S>*YXNpdMj6idRx-=fPF7 zhhDZ?+q;btDEbA??Ft{4iKrgi7E!o`q&{y8wH*Q4MgFTO_*_T{C42!o&5Oj*Zo>Kc zt5hS%`xP#-9v~Z7KxCOxqQQy;Z+m?#oLRi+7y*O1X zfry2HyWl934q2eFwa({}fA{ZwxSUP|W;~}AKRCM8@Ga^3w zRRE|_8+O{*S<9{6H}|@4-8Dn;24Y)gF$DY-fJE7w- zHM<$yRPfS@5c?PBg#6w}%~2wuP0e-D^sk`}QL2vpf`ek4Eb7U$$jqeTr-cYcvS+<4 zw;bQcfa&IK zd+q7XvyG#{M$P8KF#A3+SIDLLKr6gz>7dBj^)W>6VGuW)5le!P#%zX#^lGQ1*!plw zq|TmchIo!8l3SG}7!;JRz4`48xeE*}#G-SnN{m$zc7N|MZ8cNd_tVBkiGylMXhiIS%3e5n` zB#_QM!SN-4SK#0%DA;TGb_XIr=v$Jx%y9_wg(*9nW9-#UK^}7{0hIMB`hgdD-=zNm zl_{;M(x%>yqq~Ofy29$o=AAB5^U|1I3T6=ww?PpCg`96t1PL?B{G?Ej625gBf6BIO z;!4)12ltK3?OI7|Dzy}aF{K{-I zR?cAUNk-8!XXH{04dWemXTjZ~6W)Gl%ko*p=)}yvb_@SJ67?OBuS0$M#L9+*k3FS%>eT59X{iROEPwz(W}#q&0x|i+Q2WK!?c}N= z1_fm9ss0kFlo_Fr1i~fpT&e2H9bYI^JXin}De#O5Jd!fmgAGurA8#|HLdiS1_B?bM zB^UYiD?)UR)TNX@7VDtzmjkupr87f0CqFpI!&z}}r+q$p0J5!KQLgS9A=(|}YP1H< zT;`oU!h-;AVe@c^ud8Ip|+$il}po#6??=%)lCdSuIU99aF%)bbURj9QEL}QZm z*B#rxPO{zk&t&rIFnc^uv%Rk6e9y9B+!wo!KvA$ew4%gOevJHwI@VhVGx_{#_&rh$fhM%XWEB)DstnVvI|iA3ZfYcl`2 zB*e|guVf*^w^RrHw(VIRWv-Wkm@15n;ttbzh0Wzc$hnRZT^Y1oF&{ zIE8?g!4VXGP>l*d)vy6H!$o4=B85hx3T4)sMk!V36nZbXI>s-oJo<5?D%^2I^EwHt zJypczl#$yr(D3~B+${+gKg`v9Iz|=BJi=Fs{RCc1m3jRA#gcy*x^YN{0cagH(OU*{ zCXE37GF>(K;kdq*jSsxGfehKv40er;kcIETft%^*RoCtSmjlC{w;d~IALp%U0AiD; z<#6rltA44gB^hzVMqL)B%GK-FXO0&YoyMko?Y38L=SisWc`82q9KQ- zMV=op;`9nI9wk)f+fo$Y}yDrlVJ>U|d>MTZW}zl&22fUfHzuM~087f(u>CGxAI z+#J`lfLg9>o&wLoyl(j{-qR`ez<4j&?Kdav!^%I*P&(Tq~QjVq4q z>Jat5kt0PeNGns@TyUb}R2UQh00004%9rC15?<5O4Wtg1P7}FxP0xXs8C-P!`RLLuM z+AD#+U)aw-9GQ8t4wpAM>^O4smyH+E{P5C4c{*UqQO8&Iu|LO85}^)F;u%bracM|?d_`q16RwtytCw`t__27Uc-=G@$` ziNMu15-b?jZu6;`C%feZpNXvDKNCgVO%h;@oC(gFB;l%(qa#LY`Zy|_16<~^j@8r} zvmms3KN^>|YAzqBtn34I>ps1;)bG%?q6kd|rW79|(sShsy%G6#be=~tfjt*y4;h(2 zzR!InryGgEy#TIHS3(*pK6BEDhXB~VE?~mk46&?=5%d<3gjk6ni$f1dM^cU?A^FGP zzoY@aSAKXV-dUBh%oQ`K5967$&EybidTzApYc&qRD1A?PWeA|SM2peYR2j04$B(c? z^u1Z8D5|^%a+CM;Vahun2|cRqV1nK`5, - <&cpuapp_bellboard 0>; - }; - - cpusec_cpurad_ipc: ipc-1-3 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpusec_bellboard 18>, - <&cpurad_bellboard 0>; - }; - - cpuapp_cpurad_ipc: ipc-2-3 { - status = "disabled"; - mboxes = <&cpuapp_bellboard 18>, - <&cpurad_bellboard 12>; - }; - - cpuapp_cpuppr_ipc: ipc-2-13 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpuapp_bellboard 13>, - <&cpuppr_vevif 12>; - }; - }; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi deleted file mode 100644 index 560700b1756..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - reserved-memory { - cpuapp_ram0x_region: memory@2f000000 { - compatible = "nordic,owned-memory"; - reg = <0x2f000000 DT_SIZE_K(260)>; - status = "disabled"; - perm-read; - perm-write; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f000000 0x41000>; - - cpusec_cpuapp_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpuapp_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - - cpuapp_data: memory@1000 { - reg = <0x1000 DT_SIZE_K(256)>; - }; - }; - - cpurad_ram0x_region: memory@2f041000 { - compatible = "nordic,owned-memory"; - reg = <0x2f041000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f041000 0x1000>; - - cpusec_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpurad_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - }; - - cpuapp_cpurad_ram0x_region: memory@2f0bf000 { - compatible = "nordic,owned-memory"; - reg = <0x2f0bf000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f0bf000 0x1000>; - - cpuapp_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpurad_cpuapp_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - }; - - shared_ram20_region: memory@2f88f000 { - compatible = "nordic,owned-memory"; - reg = <0x2f88f000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f88f000 0x1000>; - - cpuapp_cpusys_ipc_shm: memory@ce0 { - reg = <0xce0 0x80>; - }; - - cpusys_cpuapp_ipc_shm: memory@d60 { - reg = <0xd60 0x80>; - }; - - cpurad_cpusys_ipc_shm: memory@e00 { - reg = <0xe00 0x80>; - }; - - cpusys_cpurad_ipc_shm: memory@e80 { - reg = <0xe80 0x80>; - }; - }; - - cpuppr_ram3x_region: memory@2fc00000 { - compatible = "nordic,owned-memory"; - reg = <0x2fc00000 DT_SIZE_K(28)>; - status = "disabled"; - perm-read; - perm-write; - perm-execute; - }; - - shared_ram3x_region: memory@2fc07000 { - compatible = "nordic,owned-memory"; - reg = <0x2fc07000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2fc07000 0x1000>; - - cpuapp_cpuppr_ipc_shm: memory@0 { - reg = <0x0 0x340>; - }; - - cpuppr_cpuapp_ipc_shm: memory@340 { - reg = <0x340 0x340>; - }; - - cpuapp_dma_region: memory@680 { - compatible = "zephyr,memory-region"; - reg = <0x680 DT_SIZE_K(2)>; - status = "disabled"; - #memory-region-cells = <0>; - zephyr,memory-region = "DMA_RAM3x_APP"; - }; - - cpurad_dma_region: memory@e80 { - compatible = "zephyr,memory-region"; - reg = <0xe80 0x80>; - status = "disabled"; - #memory-region-cells = <0>; - zephyr,memory-region = "DMA_RAM3x_RAD"; - }; - }; - }; -}; - -&mram1x { - cpurad_rx_partitions: cpurad-rx-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - perm-read; - perm-execute; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - - cpurad_slot0_partition: partition@66000 { - reg = <0x66000 DT_SIZE_K(256)>; - }; - }; - - cpuapp_rx_partitions: cpuapp-rx-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - perm-read; - perm-execute; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_slot0_partition: partition@a6000 { - reg = <0xa6000 DT_SIZE_K(512)>; - }; - - cpuppr_code_partition: partition@126000 { - reg = <0x126000 DT_SIZE_K(64)>; - }; - }; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi deleted file mode 100644 index d3b79120322..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - /omit-if-no-ref/ uart135_default: uart135_default { - group1 { - psels = , - ; - }; - - group2 { - bias-pull-up; - psels = , - ; - }; - }; - - /omit-if-no-ref/ uart135_sleep: uart135_sleep { - group1 { - low-power-enable; - psels = , - , - , - ; - }; - }; - - /omit-if-no-ref/ uart136_default: uart136_default { - group1 { - psels = , - ; - }; - - group2 { - bias-pull-up; - psels = , - ; - }; - }; - - /omit-if-no-ref/ uart136_sleep: uart136_sleep { - group1 { - low-power-enable; - psels = , - , - , - ; - }; - }; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts deleted file mode 100644 index b2db9e4b9b1..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" -#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" - -/delete-node/ &cpusec_cpurad_ipc; - -/ { - compatible = "nordic,nrf54h20pdk_nrf54h20-cpuapp"; - model = "Nordic nRF54H20 PDK nRF54H20 Application MCU"; - - chosen { - zephyr,console = &uart136; - zephyr,code-partition = &cpuapp_slot0_partition; - zephyr,flash = &mram1x; - zephyr,sram = &cpuapp_data; - }; - - aliases { - led0 = &led0; - led1 = &led1; - led2 = &led2; - led3 = &led3; - sw0 = &button0; - sw1 = &button1; - sw2 = &button2; - sw3 = &button3; - }; - - buttons { - compatible = "gpio-keys"; - - button0: button_0 { - gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 0"; - zephyr,code = ; - }; - - button1: button_1 { - gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - zephyr,code = ; - }; - - button2: button_2 { - gpios = <&gpio0 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - zephyr,code = ; - }; - - button3: button_3 { - gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 3"; - zephyr,code = ; - }; - }; - - leds { - compatible = "gpio-leds"; - - led0: led_0 { - gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - - led1: led_1 { - gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - - led2: led_2 { - gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; - label = "Green LED 2"; - }; - - led3: led_3 { - gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; - label = "Green LED 3"; - }; - }; -}; - -&cpuapp_ram0x_region { - status = "okay"; -}; - -&shared_ram3x_region { - status = "okay"; -}; - -&cpuapp_bellboard { - interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; - interrupt-names = "irq0"; - /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ - nordic,interrupt-mapping = <0x00042001 0>; -}; - -&cpusec_cpuapp_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpuapp_cpusec_ipc_shm>; - rx-region = <&cpusec_cpuapp_ipc_shm>; -}; - -&cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-initiator"; - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpurad_ipc_shm>; - rx-region = <&cpurad_cpuapp_ipc_shm>; -}; - -&cpuapp_cpuppr_ipc { - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpuppr_ipc_shm>; - rx-region = <&cpuppr_cpuapp_ipc_shm>; -}; - -&cpuapp_dma_region { - status = "okay"; -}; - -&cpuapp_rx_partitions { - status = "okay"; -}; - -&cpuppr_vpr { - execution-memory = <&cpuppr_code_partition>; -}; - -&gpiote130 { - status = "okay"; - owned-channels = <0 1 2 3 4 5 6 7>; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio9 { - status = "okay"; -}; - -&grtc { - status = "okay"; - child-owned-channels = <5 6>; - nonsecure-channels = <5 6>; - owned-channels = <4 5 6>; -}; - -&uart135 { - current-speed = <115200>; - pinctrl-0 = <&uart135_default>; - pinctrl-1 = <&uart135_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart136 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - current-speed = <115200>; - pinctrl-0 = <&uart136_default>; - pinctrl-1 = <&uart136_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml deleted file mode 100644 index a364c2863d3..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20pdk_nrf54h20_cpuapp -name: nRF54H20-PDK-nRF54H20-Application -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 32 -flash: 368 -supported: - - gpio diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig deleted file mode 100644 index 1f7ef38a7fc..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_ENGA_CPUAPP=y -CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUAPP=y - -CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# Enable GPIO -CONFIG_GPIO=y - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts deleted file mode 100644 index 8d2629df62e..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" -#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" - -/delete-node/ &cpuapp_cpuppr_ipc; -/delete-node/ &cpusec_cpuapp_ipc; - -/ { - compatible = "nordic,nrf54h20pdk_nrf54h20-cpurad"; - model = "Nordic nRF54H20 PDK nRF54H20 Radio MCU"; - - chosen { - zephyr,console = &uart135; - zephyr,code-partition = &cpurad_slot0_partition; - zephyr,flash = &mram1x; - zephyr,sram = &cpurad_ram0; - }; -}; - -&shared_ram3x_region { - status = "okay"; -}; - -&cpurad_bellboard { - interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; - interrupt-names = "irq0"; - /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ - nordic,interrupt-mapping = <0x00001001 0>; -}; - -&cpusec_cpurad_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpusec_ipc_shm>; - rx-region = <&cpusec_cpurad_ipc_shm>; -}; - -&cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-follower"; - mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpuapp_ipc_shm>; - rx-region = <&cpuapp_cpurad_ipc_shm>; -}; - -&cpurad_dma_region { - status = "okay"; -}; - -&cpurad_rx_partitions { - status = "okay"; -}; - -&grtc { - status = "okay"; - child-owned-channels = <8 9 10 11 12>; - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, - <108 NRF_DEFAULT_IRQ_PRIORITY>; - nonsecure-channels = <8 9 10 11 12>; - owned-channels = <7 8 9 10 11 12 13 14>; -}; - -&uart135 { - status = "okay"; - memory-regions = <&cpurad_dma_region>; - current-speed = <115200>; - pinctrl-0 = <&uart135_default>; - pinctrl-1 = <&uart135_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart136 { - current-speed = <115200>; - pinctrl-0 = <&uart136_default>; - pinctrl-1 = <&uart136_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml deleted file mode 100644 index d1c8548d07d..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20pdk_nrf54h20_cpurad -name: nRF54H20-PDK-nRF54H20-Radio -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 32 -flash: 368 -supported: - - gpio diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig deleted file mode 100644 index 254d8656e61..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_ENGA_CPURAD=y -CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPURAD=y - -CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board deleted file mode 100644 index 9bbbba60dd4..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_NRF54H20PDK_NRF54H20_CPUPPR - bool "nRF54H20 PDK nRF54H20 PPR MCU" - depends on SOC_NRF54H20_ENGA_CPUPPR diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig deleted file mode 100644 index 256976d6519..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD - default "nrf54h20pdk_nrf54h20_cpuppr" - depends on BOARD_NRF54H20PDK_NRF54H20_CPUPPR diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake b/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake deleted file mode 100644 index 4c63f1dd05e..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts deleted file mode 100644 index f98abb9e44b..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" -#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" - -/delete-node/ &cpuapp_cpurad_ipc; -/delete-node/ &cpusec_cpuapp_ipc; -/delete-node/ &cpusec_cpurad_ipc; - -/ { - compatible = "nordic,nrf54h20pdk_nrf54h20-cpuppr"; - model = "Nordic nRF54H20 PDK nRF54H20 Peripheral Processor MCU"; - #address-cells = <1>; - #size-cells = <1>; - - chosen { - zephyr,console = &uart135; - zephyr,code-partition = &cpuppr_code_partition; - zephyr,flash = &mram1x; - zephyr,sram = &cpuppr_ram3x_region; - }; -}; - -&cpuapp_cpuppr_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpuppr_cpuapp_ipc_shm>; - rx-region = <&cpuapp_cpuppr_ipc_shm>; -}; - -&grtc { - status = "okay"; - owned-channels = <5>; -}; - -&uart135 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart135_default>; - pinctrl-1 = <&uart135_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart136 { - current-speed = <115200>; - pinctrl-0 = <&uart136_default>; - pinctrl-1 = <&uart136_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml deleted file mode 100644 index 274be865c36..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20pdk_nrf54h20_cpuppr -name: nRF54H20-PDK-nRF54H20-PPR -type: mcu -arch: riscv -toolchain: - - zephyr -ram: 28 -flash: 28 -supported: - - gpio diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig deleted file mode 100644 index 112140693ef..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_ENGA_CPUPPR=y -CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUPPR=y - -CONFIG_USE_DT_CODE_PARTITION=y - -CONFIG_SERIAL=y - -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake b/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake deleted file mode 100644 index 5e0fecebdc8..00000000000 --- a/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Allow common DTS files to be included from the other board directory. -# To be removed after HWMv2 (#51831), once both directories can be merged into one. -string(REGEX REPLACE "/riscv/(.*$)" "/arm/\\1" BOARD_DIR_ARM "${BOARD_DIR}") -list(APPEND DTS_EXTRA_CPPFLAGS -isystem "${BOARD_DIR_ARM}") From 26aa38e4115b5f87aabc242cd1590ccdfa782564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 13 Mar 2024 17:29:33 +0100 Subject: [PATCH 1440/2300] [nrf fromtree] modules: hal_nordic: Remove support for nRF54H20 EngA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was a preview revision of the SoC that will no longer be supported. Signed-off-by: Andrzej Głąbek (cherry picked from commit cec6ab0dcd5f5a823fb30239a656f614cac60dd2) --- modules/hal_nordic/nrfx/CMakeLists.txt | 10 - modules/hal_nordic/nrfx/nrfx_config.h | 6 - .../nrfx_config_nrf54h20_enga_application.h | 1962 ---------------- .../nrfx/nrfx_config_nrf54h20_enga_ppr.h | 1882 --------------- .../nrfx_config_nrf54h20_enga_radiocore.h | 2043 ----------------- 5 files changed, 5903 deletions(-) delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index a9227de8259..463c4790743 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -47,13 +47,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_ENGA_CPUAPP NRF_APPLICATION zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP NRF54H20_ENGA_XXAA - NRF_APPLICATION) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD NRF54H20_ENGA_XXAA - NRF_RADIOCORE) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR NRF54H20_ENGA_XXAA - NRF_PPR) - zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_LOCK ENABLE_APPROTECT) zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_USER_HANDLING @@ -199,8 +192,5 @@ mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUNET nrf5340_network.svd) 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_CPURAD nrf54h20_radiocore.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP nrf54h20_enga_application.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR nrf54h20_enga_ppr.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD nrf54h20_enga_radiocore.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9120 nrf9120.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9160 nrf9160.svd) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index e2dd3df0f60..ad5d5ba690b 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -905,12 +905,6 @@ #include #elif defined(NRF54H20_XXAA) && defined(NRF_PPR) #include -#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_APPLICATION) - #include -#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_RADIOCORE) - #include -#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_PPR) - #include #elif (defined(NRF54L15_XXAA) || defined(NRF54L15_ENGA_XXAA)) && defined(NRF_APPLICATION) #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h deleted file mode 100644 index af74d9d3dc3..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h +++ /dev/null @@ -1,1962 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54H20_ENGA_APPLICATION_H__ -#define NRFX_CONFIG_NRF54H20_ENGA_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_BELLBOARD_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD_ENABLED -#define NRFX_BELLBOARD_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY - * - * Integer value. Minimum: 0. Maximum: 7. - */ -#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY -#endif - -/** - * @brief NRFX_BELLBOARD0_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD0_ENABLED -#define NRFX_BELLBOARD0_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD1_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD1_ENABLED -#define NRFX_BELLBOARD1_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD2_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD2_ENABLED -#define NRFX_BELLBOARD2_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD3_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD3_ENABLED -#define NRFX_BELLBOARD3_ENABLED 0 -#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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 -#endif - -/** - * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e -#endif - -/** - * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 -#endif - -/** - * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 -#endif - -/** - * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 -#endif - -/** - * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f -#endif - -/** - * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 -#endif - -/** - * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df -#endif - -/** - * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf -#endif - -/** - * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e -#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 1 -#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_GPIOTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GPIOTE130_ENABLED -#define NRFX_GPIOTE130_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_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 -#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_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: 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_I2S130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S130_ENABLED -#define NRFX_I2S130_ENABLED 0 -#endif - -/** - * @brief NRFX_I2S131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S131_ENABLED -#define NRFX_I2S131_ENABLED 0 -#endif - -/** - * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#endif - -/** - * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#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_MVDMA_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA_ENABLED -#define NRFX_MVDMA_ENABLED 0 -#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_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_PRS_BOX_6_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_6_ENABLED -#define NRFX_PRS_BOX_6_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_7_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_7_ENABLED -#define NRFX_PRS_BOX_7_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_8_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_8_ENABLED -#define NRFX_PRS_BOX_8_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_9_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_9_ENABLED -#define NRFX_PRS_BOX_9_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_PWM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM120_ENABLED -#define NRFX_PWM120_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM130_ENABLED -#define NRFX_PWM130_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM131_ENABLED -#define NRFX_PWM131_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM132_ENABLED -#define NRFX_PWM132_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM133_ENABLED -#define NRFX_PWM133_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_QDEC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC130_ENABLED -#define NRFX_QDEC130_ENABLED 0 -#endif - -/** - * @brief NRFX_QDEC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC131_ENABLED -#define NRFX_QDEC131_ENABLED 0 -#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_RTC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC130_ENABLED -#define NRFX_RTC130_ENABLED 0 -#endif - -/** - * @brief NRFX_RTC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC131_ENABLED -#define NRFX_RTC131_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_SPIM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM120_ENABLED -#define NRFX_SPIM120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM121_ENABLED -#define NRFX_SPIM121_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM130_ENABLED -#define NRFX_SPIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM131_ENABLED -#define NRFX_SPIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM132_ENABLED -#define NRFX_SPIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM133_ENABLED -#define NRFX_SPIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM134_ENABLED -#define NRFX_SPIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM135_ENABLED -#define NRFX_SPIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM136_ENABLED -#define NRFX_SPIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM137_ENABLED -#define NRFX_SPIM137_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_SPIS120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS120_ENABLED -#define NRFX_SPIS120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS130_ENABLED -#define NRFX_SPIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS131_ENABLED -#define NRFX_SPIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS132_ENABLED -#define NRFX_SPIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS133_ENABLED -#define NRFX_SPIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS134_ENABLED -#define NRFX_SPIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS135_ENABLED -#define NRFX_SPIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS136_ENABLED -#define NRFX_SPIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS137_ENABLED -#define NRFX_SPIS137_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_TIMER120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER120_ENABLED -#define NRFX_TIMER120_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER121_ENABLED -#define NRFX_TIMER121_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER130_ENABLED -#define NRFX_TIMER130_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER131_ENABLED -#define NRFX_TIMER131_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER132_ENABLED -#define NRFX_TIMER132_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER133_ENABLED -#define NRFX_TIMER133_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER134_ENABLED -#define NRFX_TIMER134_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER135_ENABLED -#define NRFX_TIMER135_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER136_ENABLED -#define NRFX_TIMER136_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER137_ENABLED -#define NRFX_TIMER137_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_TWIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM130_ENABLED -#define NRFX_TWIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM131_ENABLED -#define NRFX_TWIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM132_ENABLED -#define NRFX_TWIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM133_ENABLED -#define NRFX_TWIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM134_ENABLED -#define NRFX_TWIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM135_ENABLED -#define NRFX_TWIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM136_ENABLED -#define NRFX_TWIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM137_ENABLED -#define NRFX_TWIM137_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_TWIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS130_ENABLED -#define NRFX_TWIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS131_ENABLED -#define NRFX_TWIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS132_ENABLED -#define NRFX_TWIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS133_ENABLED -#define NRFX_TWIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS134_ENABLED -#define NRFX_TWIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS135_ENABLED -#define NRFX_TWIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS136_ENABLED -#define NRFX_TWIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS137_ENABLED -#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE120_ENABLED -#define NRFX_UARTE120_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE130_ENABLED -#define NRFX_UARTE130_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE131_ENABLED -#define NRFX_UARTE131_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE132_ENABLED -#define NRFX_UARTE132_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE133_ENABLED -#define NRFX_UARTE133_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE134_ENABLED -#define NRFX_UARTE134_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE135_ENABLED -#define NRFX_UARTE135_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE136_ENABLED -#define NRFX_UARTE136_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE137_ENABLED -#define NRFX_UARTE137_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_WDT010_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT010_ENABLED -#define NRFX_WDT010_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT011_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT011_ENABLED -#define NRFX_WDT011_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT131_ENABLED -#define NRFX_WDT131_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT132_ENABLED -#define NRFX_WDT132_ENABLED 0 -#endif - -#endif /* NRFX_CONFIG_NRF54H20_ENGA_APPLICATION_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h deleted file mode 100644 index 65b3e2fa958..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h +++ /dev/null @@ -1,1882 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54H20_ENGA_PPR_H__ -#define NRFX_CONFIG_NRF54H20_ENGA_PPR_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_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_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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 -#endif - -/** - * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e -#endif - -/** - * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 -#endif - -/** - * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 -#endif - -/** - * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 -#endif - -/** - * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 -#endif - -/** - * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df -#endif - -/** - * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf -#endif - -/** - * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e -#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 1 -#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_GPIOTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GPIOTE130_ENABLED -#define NRFX_GPIOTE130_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_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 -#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_NUM_OF_CC_CHANNELS - * - * Integer value. - */ -#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS -#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 2 -#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 0x000000c0 -#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_I2S130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S130_ENABLED -#define NRFX_I2S130_ENABLED 0 -#endif - -/** - * @brief NRFX_I2S131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S131_ENABLED -#define NRFX_I2S131_ENABLED 0 -#endif - -/** - * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#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_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_PRS_BOX_6_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_6_ENABLED -#define NRFX_PRS_BOX_6_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_7_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_7_ENABLED -#define NRFX_PRS_BOX_7_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_8_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_8_ENABLED -#define NRFX_PRS_BOX_8_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_9_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_9_ENABLED -#define NRFX_PRS_BOX_9_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_PWM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM120_ENABLED -#define NRFX_PWM120_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM130_ENABLED -#define NRFX_PWM130_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM131_ENABLED -#define NRFX_PWM131_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM132_ENABLED -#define NRFX_PWM132_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM133_ENABLED -#define NRFX_PWM133_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_QDEC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC130_ENABLED -#define NRFX_QDEC130_ENABLED 0 -#endif - -/** - * @brief NRFX_QDEC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC131_ENABLED -#define NRFX_QDEC131_ENABLED 0 -#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_RTC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC130_ENABLED -#define NRFX_RTC130_ENABLED 0 -#endif - -/** - * @brief NRFX_RTC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC131_ENABLED -#define NRFX_RTC131_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_SPIM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM120_ENABLED -#define NRFX_SPIM120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM121_ENABLED -#define NRFX_SPIM121_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM130_ENABLED -#define NRFX_SPIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM131_ENABLED -#define NRFX_SPIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM132_ENABLED -#define NRFX_SPIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM133_ENABLED -#define NRFX_SPIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM134_ENABLED -#define NRFX_SPIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM135_ENABLED -#define NRFX_SPIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM136_ENABLED -#define NRFX_SPIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM137_ENABLED -#define NRFX_SPIM137_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_SPIS120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS120_ENABLED -#define NRFX_SPIS120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS130_ENABLED -#define NRFX_SPIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS131_ENABLED -#define NRFX_SPIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS132_ENABLED -#define NRFX_SPIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS133_ENABLED -#define NRFX_SPIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS134_ENABLED -#define NRFX_SPIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS135_ENABLED -#define NRFX_SPIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS136_ENABLED -#define NRFX_SPIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS137_ENABLED -#define NRFX_SPIS137_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_TIMER120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER120_ENABLED -#define NRFX_TIMER120_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER121_ENABLED -#define NRFX_TIMER121_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER130_ENABLED -#define NRFX_TIMER130_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER131_ENABLED -#define NRFX_TIMER131_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER132_ENABLED -#define NRFX_TIMER132_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER133_ENABLED -#define NRFX_TIMER133_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER134_ENABLED -#define NRFX_TIMER134_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER135_ENABLED -#define NRFX_TIMER135_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER136_ENABLED -#define NRFX_TIMER136_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER137_ENABLED -#define NRFX_TIMER137_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_TWIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM130_ENABLED -#define NRFX_TWIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM131_ENABLED -#define NRFX_TWIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM132_ENABLED -#define NRFX_TWIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM133_ENABLED -#define NRFX_TWIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM134_ENABLED -#define NRFX_TWIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM135_ENABLED -#define NRFX_TWIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM136_ENABLED -#define NRFX_TWIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM137_ENABLED -#define NRFX_TWIM137_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_TWIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS130_ENABLED -#define NRFX_TWIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS131_ENABLED -#define NRFX_TWIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS132_ENABLED -#define NRFX_TWIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS133_ENABLED -#define NRFX_TWIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS134_ENABLED -#define NRFX_TWIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS135_ENABLED -#define NRFX_TWIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS136_ENABLED -#define NRFX_TWIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS137_ENABLED -#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE120_ENABLED -#define NRFX_UARTE120_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE130_ENABLED -#define NRFX_UARTE130_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE131_ENABLED -#define NRFX_UARTE131_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE132_ENABLED -#define NRFX_UARTE132_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE133_ENABLED -#define NRFX_UARTE133_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE134_ENABLED -#define NRFX_UARTE134_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE135_ENABLED -#define NRFX_UARTE135_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE136_ENABLED -#define NRFX_UARTE136_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE137_ENABLED -#define NRFX_UARTE137_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_WDT131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT131_ENABLED -#define NRFX_WDT131_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT132_ENABLED -#define NRFX_WDT132_ENABLED 0 -#endif - -#endif /* NRFX_CONFIG_NRF54H20_ENGA_PPR_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h deleted file mode 100644 index ca7bf3aca63..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h +++ /dev/null @@ -1,2043 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_H__ -#define NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_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_BELLBOARD_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD_ENABLED -#define NRFX_BELLBOARD_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY - * - * Integer value. Minimum: 0. Maximum: 7. - */ -#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY -#endif - -/** - * @brief NRFX_BELLBOARD0_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD0_ENABLED -#define NRFX_BELLBOARD0_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD1_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD1_ENABLED -#define NRFX_BELLBOARD1_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD2_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD2_ENABLED -#define NRFX_BELLBOARD2_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD3_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD3_ENABLED -#define NRFX_BELLBOARD3_ENABLED 0 -#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_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#endif - -/** - * @brief NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#endif - -/** - * @brief NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 -#endif - -/** - * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e -#endif - -/** - * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 -#endif - -/** - * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 -#endif - -/** - * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 -#endif - -/** - * @brief NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f -#endif - -/** - * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 -#endif - -/** - * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df -#endif - -/** - * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf -#endif - -/** - * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e -#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_EGU020_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_EGU020_ENABLED -#define NRFX_EGU020_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 1 -#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_GPIOTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GPIOTE130_ENABLED -#define NRFX_GPIOTE130_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_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 -#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_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 0x00000f00 -#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_I2S130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S130_ENABLED -#define NRFX_I2S130_ENABLED 0 -#endif - -/** - * @brief NRFX_I2S131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_I2S131_ENABLED -#define NRFX_I2S131_ENABLED 0 -#endif - -/** - * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 -#endif - -/** - * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000c0 -#endif - -/** - * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#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_MVDMA_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA_ENABLED -#define NRFX_MVDMA_ENABLED 0 -#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_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_PRS_BOX_6_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_6_ENABLED -#define NRFX_PRS_BOX_6_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_7_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_7_ENABLED -#define NRFX_PRS_BOX_7_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_8_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_8_ENABLED -#define NRFX_PRS_BOX_8_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_9_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_9_ENABLED -#define NRFX_PRS_BOX_9_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_PWM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM120_ENABLED -#define NRFX_PWM120_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM130_ENABLED -#define NRFX_PWM130_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM131_ENABLED -#define NRFX_PWM131_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM132_ENABLED -#define NRFX_PWM132_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM133_ENABLED -#define NRFX_PWM133_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_QDEC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC130_ENABLED -#define NRFX_QDEC130_ENABLED 0 -#endif - -/** - * @brief NRFX_QDEC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC131_ENABLED -#define NRFX_QDEC131_ENABLED 0 -#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_RTC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC130_ENABLED -#define NRFX_RTC130_ENABLED 0 -#endif - -/** - * @brief NRFX_RTC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC131_ENABLED -#define NRFX_RTC131_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_SPIM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM120_ENABLED -#define NRFX_SPIM120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM121_ENABLED -#define NRFX_SPIM121_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM130_ENABLED -#define NRFX_SPIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM131_ENABLED -#define NRFX_SPIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM132_ENABLED -#define NRFX_SPIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM133_ENABLED -#define NRFX_SPIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM134_ENABLED -#define NRFX_SPIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM135_ENABLED -#define NRFX_SPIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM136_ENABLED -#define NRFX_SPIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM137_ENABLED -#define NRFX_SPIM137_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_SPIS120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS120_ENABLED -#define NRFX_SPIS120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS130_ENABLED -#define NRFX_SPIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS131_ENABLED -#define NRFX_SPIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS132_ENABLED -#define NRFX_SPIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS133_ENABLED -#define NRFX_SPIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS134_ENABLED -#define NRFX_SPIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS135_ENABLED -#define NRFX_SPIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS136_ENABLED -#define NRFX_SPIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS137_ENABLED -#define NRFX_SPIS137_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_TIMER020_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER020_ENABLED -#define NRFX_TIMER020_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER021_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER021_ENABLED -#define NRFX_TIMER021_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER022_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER022_ENABLED -#define NRFX_TIMER022_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER120_ENABLED -#define NRFX_TIMER120_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER121_ENABLED -#define NRFX_TIMER121_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER130_ENABLED -#define NRFX_TIMER130_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER131_ENABLED -#define NRFX_TIMER131_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER132_ENABLED -#define NRFX_TIMER132_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER133_ENABLED -#define NRFX_TIMER133_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER134_ENABLED -#define NRFX_TIMER134_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER135_ENABLED -#define NRFX_TIMER135_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER136_ENABLED -#define NRFX_TIMER136_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER137_ENABLED -#define NRFX_TIMER137_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_TWIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM130_ENABLED -#define NRFX_TWIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM131_ENABLED -#define NRFX_TWIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM132_ENABLED -#define NRFX_TWIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM133_ENABLED -#define NRFX_TWIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM134_ENABLED -#define NRFX_TWIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM135_ENABLED -#define NRFX_TWIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM136_ENABLED -#define NRFX_TWIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM137_ENABLED -#define NRFX_TWIM137_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_TWIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS130_ENABLED -#define NRFX_TWIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS131_ENABLED -#define NRFX_TWIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS132_ENABLED -#define NRFX_TWIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS133_ENABLED -#define NRFX_TWIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS134_ENABLED -#define NRFX_TWIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS135_ENABLED -#define NRFX_TWIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS136_ENABLED -#define NRFX_TWIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS137_ENABLED -#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE120_ENABLED -#define NRFX_UARTE120_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE130_ENABLED -#define NRFX_UARTE130_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE131_ENABLED -#define NRFX_UARTE131_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE132_ENABLED -#define NRFX_UARTE132_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE133_ENABLED -#define NRFX_UARTE133_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE134_ENABLED -#define NRFX_UARTE134_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE135_ENABLED -#define NRFX_UARTE135_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE136_ENABLED -#define NRFX_UARTE136_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE137_ENABLED -#define NRFX_UARTE137_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_WDT010_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT010_ENABLED -#define NRFX_WDT010_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT011_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT011_ENABLED -#define NRFX_WDT011_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT131_ENABLED -#define NRFX_WDT131_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT132_ENABLED -#define NRFX_WDT132_ENABLED 0 -#endif - -#endif /* NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_H__ */ From 0938076a408d4ec076d8886d32ccb5016b8434d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 13 Mar 2024 17:40:30 +0100 Subject: [PATCH 1441/2300] [nrf fromtree] dts: Remove support for nRF54H20 EngA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was a preview revision of the SoC that will no longer be supported. Signed-off-by: Andrzej Głąbek (cherry picked from commit a8bb9fd1c1129a550930ebacfd573e720b03b335) --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 51 - dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 51 - dts/common/nordic/nrf54h20_enga.dtsi | 941 ------------------ dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 48 - .../misc/nordic-nrf-ficr-nrf54h20-enga.h | 96 -- 5 files changed, 1187 deletions(-) delete mode 100644 dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi delete mode 100644 dts/arm/nordic/nrf54h20_enga_cpurad.dtsi delete mode 100644 dts/common/nordic/nrf54h20_enga.dtsi delete mode 100644 dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi delete mode 100644 include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi deleted file mode 100644 index 7252b3d5a04..00000000000 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuapp {}; -systick: &cpuapp_systick {}; -nvic: &cpuapp_nvic {}; -cpuppr_vevif: &cpuppr_vevif_remote {}; - -/delete-node/ &cpuppr; -/delete-node/ &cpurad; -/delete-node/ &cpurad_peripherals; -/delete-node/ &cpurad_ppb; -/delete-node/ &cpurad_ram0; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuapp_nvic>; - ranges; - }; -}; - -&cpuapp_ppb { - compatible = "simple-bus"; - ranges; -}; - -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-local"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&gpiote130 { - interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&grtc { - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; -}; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi deleted file mode 100644 index d2aaa790349..00000000000 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpurad {}; -systick: &cpurad_systick {}; -nvic: &cpurad_nvic {}; -cpuppr_vevif: &cpuppr_vevif_remote {}; - -/delete-node/ &cpuapp; -/delete-node/ &cpuapp_peripherals; -/delete-node/ &cpuapp_ppb; -/delete-node/ &cpuapp_ram0; -/delete-node/ &cpuppr; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpurad_nvic>; - ranges; - }; -}; - -&cpurad_ppb { - compatible = "simple-bus"; - ranges; -}; - -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-local"; -}; - -&gpiote130 { - interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&grtc { - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; -}; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi deleted file mode 100644 index 8552b9534eb..00000000000 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ /dev/null @@ -1,941 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#include - -/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ -#define NRF_DOMAIN_ID_APPLICATION 2 -#define NRF_DOMAIN_ID_RADIOCORE 3 -#define NRF_DOMAIN_ID_GLOBALFAST 12 -#define NRF_DOMAIN_ID_GLOBALSLOW 13 - -/delete-node/ &sw_pwm; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpuapp: cpu@2 { - compatible = "arm,cortex-m33"; - reg = <2>; - device_type = "cpu"; - clock-frequency = ; - }; - - cpurad: cpu@3 { - compatible = "arm,cortex-m33"; - reg = <3>; - device_type = "cpu"; - clock-frequency = ; - }; - - cpuppr: cpu@d { - compatible = "nordic,vpr"; - reg = <13>; - device_type = "cpu"; - clock-frequency = ; - riscv,isa = "rv32emc"; - nordic,bus-width = <32>; - - cpuppr_vevif_local: mailbox { - compatible = "nordic,nrf-vevif-local"; - status = "disabled"; - interrupt-parent = <&cpuppr_clic>; - interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, - <1 NRF_DEFAULT_IRQ_PRIORITY>, - <2 NRF_DEFAULT_IRQ_PRIORITY>, - <3 NRF_DEFAULT_IRQ_PRIORITY>, - <4 NRF_DEFAULT_IRQ_PRIORITY>, - <5 NRF_DEFAULT_IRQ_PRIORITY>, - <6 NRF_DEFAULT_IRQ_PRIORITY>, - <7 NRF_DEFAULT_IRQ_PRIORITY>, - <8 NRF_DEFAULT_IRQ_PRIORITY>, - <9 NRF_DEFAULT_IRQ_PRIORITY>, - <10 NRF_DEFAULT_IRQ_PRIORITY>, - <11 NRF_DEFAULT_IRQ_PRIORITY>, - <12 NRF_DEFAULT_IRQ_PRIORITY>, - <13 NRF_DEFAULT_IRQ_PRIORITY>, - <14 NRF_DEFAULT_IRQ_PRIORITY>, - <15 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask = <0xfffffff0>; - }; - }; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - - cpurad_uicr_ext: memory@e1ff000 { - reg = <0xe1ff000 DT_SIZE_K(2)>; - }; - - cpuapp_uicr_ext: memory@e1ff800 { - reg = <0xe1ff800 DT_SIZE_K(2)>; - }; - }; - - clocks { - fll16m: fll16m { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - }; - - soc { - #address-cells = <1>; - #size-cells = <1>; - - mram1x: mram@e000000 { - compatible = "nordic,mram"; - reg = <0xe000000 DT_SIZE_K(2048)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - - cpuapp_uicr: uicr@fff8000 { - 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 { - compatible = "nordic,nrf-ficr"; - reg = <0xfffe000 DT_SIZE_K(2)>; - #nordic,ficr-cells = <1>; - }; - - cpuapp_ram0: sram@22000000 { - compatible = "mmio-sram"; - reg = <0x22000000 DT_SIZE_K(32)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x22000000 0x8000>; - }; - - cpurad_ram0: sram@23000000 { - compatible = "mmio-sram"; - reg = <0x23000000 DT_SIZE_K(64)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x23000000 0x10000>; - }; - - cpuapp_peripherals: peripheral@52000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x52000000 0x1000000>; - - cpuapp_hsfll: clock@d000 { - compatible = "nordic,nrf-hsfll"; - #clock-cells = <0>; - reg = <0xd000 0x1000>; - clocks = <&fll16m>; - clock-frequency = ; - nordic,ficrs = - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; - nordic,ficr-names = "vsup", "coarse", "fine"; - }; - - cpuapp_ipct: ipct@13000 { - compatible = "nordic,nrf-ipct-local"; - reg = <0x13000 0x1000>; - status = "disabled"; - channels = <4>; - interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, - <65 NRF_DEFAULT_IRQ_PRIORITY>; - }; - }; - - cpurad_peripherals: peripheral@53000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x53000000 0x1000000>; - - cpurad_hsfll: clock@d000 { - compatible = "nordic,nrf-hsfll"; - #clock-cells = <0>; - reg = <0xd000 0x1000>; - clocks = <&fll16m>; - clock-frequency = ; - nordic,ficrs = - <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP>, - <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1>, - <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1>; - nordic,ficr-names = "vsup", "coarse", "fine"; - }; - - dppic020: dppic@22000 { - compatible = "nordic,nrf-dppic-local"; - reg = <0x22000 0x1000>; - status = "disabled"; - }; - - cpurad_ipct: ipct@24000 { - compatible = "nordic,nrf-ipct-local"; - reg = <0x24000 0x1000>; - status = "disabled"; - channels = <8>; - interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, - <65 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - egu020: egu@25000 { - compatible = "nordic,nrf-egu"; - reg = <0x25000 0x1000>; - status = "disabled"; - interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - ecb020: ecb@27000 { - compatible = "nordic,nrf-ecb"; - reg = <0x27000 0x1000>; - status = "disabled"; - interrupts = <39 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - timer020: timer@28000 { - compatible = "nordic,nrf-timer"; - reg = <0x28000 0x1000>; - status = "disabled"; - cc-num = <8>; - interrupts = <40 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer021: timer@29000 { - compatible = "nordic,nrf-timer"; - reg = <0x29000 0x1000>; - status = "disabled"; - cc-num = <8>; - interrupts = <41 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer022: timer@2a000 { - compatible = "nordic,nrf-timer"; - reg = <0x2a000 0x1000>; - status = "disabled"; - cc-num = <8>; - interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - rtc: rtc@2b000 { - compatible = "nordic,nrf-rtc"; - reg = <0x2b000 0x1000>; - status = "disabled"; - cc-num = <4>; - clock-frequency = <32768>; - interrupts = <43 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <1>; - }; - - radio: radio@2c000 { - compatible = "nordic,nrf-radio"; - reg = <0x2c000 0x1000>; - status = "disabled"; - ble-2mbps-supported; - ble-coded-phy-supported; - dfe-supported; - ieee802154-supported; - interrupts = <44 NRF_DEFAULT_IRQ_PRIORITY>; - - cpurad_ieee802154: ieee802154 { - compatible = "nordic,nrf-ieee802154"; - status = "disabled"; - }; - }; - - ecb030: ecb@3b000 { - compatible = "nordic,nrf-ecb"; - reg = <0x3b000 0x1000>; - interrupts = <59 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - }; - - global_peripherals: peripheral@5f000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x5f000000 0x1000000>; - - cpusec_bellboard: mailbox@99000 { - reg = <0x99000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - cpuapp_bellboard: mailbox@9a000 { - reg = <0x9a000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - cpurad_bellboard: mailbox@9b000 { - reg = <0x9b000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - ipct120: ipct@8d1000 { - compatible = "nordic,nrf-ipct-global"; - reg = <0x8d1000 0x1000>; - status = "disabled"; - channels = <8>; - global-domain-id = <12>; - }; - - dppic120: dppic@8e1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x8e1000 0x1000>; - status = "disabled"; - }; - - timer120: timer@8e2000 { - compatible = "nordic,nrf-timer"; - reg = <0x8e2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer121: timer@8e3000 { - compatible = "nordic,nrf-timer"; - reg = <0x8e3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - uart120: uart@8e5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x8e5000 0x1000>; - status = "disabled"; - interrupts = <229 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - spi120: spi@8e6000 { - compatible = "nordic,nrf-spim"; - reg = <0x8e6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi121: spi@8e7000 { - compatible = "nordic,nrf-spim"; - reg = <0x8e7000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <231 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - cpuppr_vpr: vpr@908000 { - compatible = "nordic,nrf-vpr-coprocessor"; - reg = <0x908000 0x1000>; - status = "disabled"; - cpu = <13>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x908000 0x4000>; - - cpuppr_vevif_remote: mailbox@0 { - compatible = "nordic,nrf-vevif-remote"; - reg = <0x0 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask = <0xfffffff0>; - }; - - cpuppr_clic: interrupt-controller@1000 { - compatible = "nordic,nrf-clic"; - reg = <0x1000 0x3000>; - status = "disabled"; - #interrupt-cells = <2>; - interrupt-controller; - #address-cells = <1>; - }; - }; - - ipct130: ipct@921000 { - compatible = "nordic,nrf-ipct-global"; - reg = <0x921000 0x1000>; - status = "disabled"; - channels = <8>; - global-domain-id = <13>; - }; - - dppic130: dppic@922000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x922000 0x1000>; - status = "disabled"; - }; - - rtc130: rtc@928000 { - compatible = "nordic,nrf-rtc"; - reg = <0x928000 0x1000>; - status = "disabled"; - cc-num = <4>; - clock-frequency = <32768>; - interrupts = <296 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <1>; - }; - - rtc131: rtc@929000 { - compatible = "nordic,nrf-rtc"; - reg = <0x929000 0x1000>; - status = "disabled"; - cc-num = <4>; - clock-frequency = <32768>; - interrupts = <297 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <1>; - }; - - wdt131: watchdog@92b000 { - compatible = "nordic,nrf-wdt"; - reg = <0x92b000 0x1000>; - status = "disabled"; - interrupts = <299 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - wdt132: watchdog@92c000 { - compatible = "nordic,nrf-wdt"; - reg = <0x92c000 0x1000>; - status = "disabled"; - interrupts = <300 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - gpiote130: gpiote@934000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x934000 0x1000>; - status = "disabled"; - instance = <130>; - }; - - gpio0: gpio@938000 { - compatible = "nordic,nrf-gpio"; - reg = <0x938000 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <12>; - port = <0>; - }; - - gpio1: gpio@938200 { - compatible = "nordic,nrf-gpio"; - reg = <0x938200 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <12>; - port = <1>; - }; - - gpio2: gpio@938400 { - compatible = "nordic,nrf-gpio"; - reg = <0x938400 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <12>; - port = <2>; - }; - - gpio6: gpio@938c00 { - compatible = "nordic,nrf-gpio"; - reg = <0x938c00 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - ngpios = <14>; - port = <6>; - }; - - gpio7: gpio@938e00 { - compatible = "nordic,nrf-gpio"; - reg = <0x938e00 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - ngpios = <8>; - port = <7>; - }; - - gpio9: gpio@939200 { - compatible = "nordic,nrf-gpio"; - reg = <0x939200 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <6>; - port = <9>; - }; - - dppic131: dppic@981000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x981000 0x1000>; - status = "disabled"; - }; - - comp: comparator@983000 { - compatible = "nordic,nrf-comp"; - reg = <0x983000 0x1000>; - status = "disabled"; - interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; - #io-channel-cells = <1>; - }; - - temp: temperature-sensor@984000 { - compatible = "nordic,nrf-temp"; - reg = <0x984000 0x1000>; - interrupts = <388 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - nfct: nfct@985000 { - compatible = "nordic,nrf-nfct"; - reg = <0x985000 0x1000>; - status = "disabled"; - interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - dppic132: dppic@991000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x991000 0x1000>; - status = "disabled"; - }; - - qdec130: qdec@994000 { - compatible = "nordic,nrf-qdec"; - reg = <0x994000 0x1000>; - status = "disabled"; - interrupts = <404 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - qdec131: qdec@995000 { - compatible = "nordic,nrf-qdec"; - reg = <0x995000 0x1000>; - status = "disabled"; - interrupts = <405 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - grtc: grtc@99c000 { - compatible = "nordic,nrf-grtc"; - reg = <0x99c000 0x1000>; - status = "disabled"; - cc-num = <16>; - }; - - dppic133: dppic@9a1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9a1000 0x1000>; - status = "disabled"; - }; - - timer130: timer@9a2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9a2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <418 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer131: timer@9a3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9a3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <419 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - i2c130: i2c@9a5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9a5000 0x1000>; - status = "disabled"; - interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi130: spi@9a5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9a5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart130: uart@9a5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9a5000 0x1000>; - status = "disabled"; - interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - i2c131: i2c@9a6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9a6000 0x1000>; - status = "disabled"; - interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi131: spi@9a6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9a6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart131: uart@9a6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9a6000 0x1000>; - status = "disabled"; - interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - dppic134: dppic@9b1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9b1000 0x1000>; - status = "disabled"; - }; - - timer132: timer@9b2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9b2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <434 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer133: timer@9b3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9b3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <435 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - i2c132: i2c@9b5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9b5000 0x1000>; - status = "disabled"; - interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi132: spi@9b5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9b5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart132: uart@9b5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9b5000 0x1000>; - status = "disabled"; - interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - i2c133: i2c@9b6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9b6000 0x1000>; - status = "disabled"; - interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi133: spi@9b6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9b6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart133: uart@9b6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9b6000 0x1000>; - status = "disabled"; - interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - dppic135: dppic@9c1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9c1000 0x1000>; - status = "disabled"; - }; - - timer134: timer@9c2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9c2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <450 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer135: timer@9c3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9c3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <451 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - i2c134: i2c@9c5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9c5000 0x1000>; - status = "disabled"; - interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi134: spi@9c5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9c5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart134: uart@9c5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9c5000 0x1000>; - status = "disabled"; - interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - i2c135: i2c@9c6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9c6000 0x1000>; - status = "disabled"; - interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi135: spi@9c6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9c6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart135: uart@9c6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9c6000 0x1000>; - status = "disabled"; - interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - dppic136: dppic@9d1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9d1000 0x1000>; - status = "disabled"; - }; - - timer136: timer@9d2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9d2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <466 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer137: timer@9d3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9d3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <467 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - i2c136: i2c@9d5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9d5000 0x1000>; - status = "disabled"; - interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi136: spi@9d5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9d5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart136: uart@9d5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9d5000 0x1000>; - status = "disabled"; - interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - i2c137: i2c@9d6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9d6000 0x1000>; - status = "disabled"; - interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi137: spi@9d6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9d6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart137: uart@9d6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9d6000 0x1000>; - status = "disabled"; - interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; - }; - }; - }; - - cpuapp_ppb: cpuapp-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - - cpuapp_nvic: interrupt-controller@e000e100 { - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - #interrupt-cells = <2>; - interrupt-controller; - #address-cells = <1>; - }; - }; - - cpurad_ppb: cpurad-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpurad_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - - cpurad_nvic: interrupt-controller@e000e100 { - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - #interrupt-cells = <2>; - interrupt-controller; - #address-cells = <1>; - }; - }; -}; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi deleted file mode 100644 index 0af6618688f..00000000000 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuppr {}; -clic: &cpuppr_clic {}; -cpuppr_vevif: &cpuppr_vevif_local {}; - -/delete-node/ &cpuapp; -/delete-node/ &cpuapp_peripherals; -/delete-node/ &cpuapp_ppb; -/delete-node/ &cpuapp_ram0; -/delete-node/ &cpurad; -/delete-node/ &cpurad_peripherals; -/delete-node/ &cpurad_ppb; -/delete-node/ &cpurad_ram0; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuppr_clic>; - ranges; - }; -}; - -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&gpiote130 { - interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&grtc { - interrupts = <108 NRF_DEFAULT_IRQ_PRIORITY>; -}; diff --git a/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h b/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h deleted file mode 100644 index 60b788a3516..00000000000 --- a/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/* autogenerated using Nordic HAL utils/gen_offsets.py script */ - -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ - -#define NRF_FICR_BLE_ADDRTYPE 0x00CU -#define NRF_FICR_BLE_ADDR_0 0x010U -#define NRF_FICR_BLE_ADDR_1 0x014U -#define NRF_FICR_BLE_ER_0 0x018U -#define NRF_FICR_BLE_ER_1 0x01CU -#define NRF_FICR_BLE_ER_2 0x020U -#define NRF_FICR_BLE_ER_3 0x024U -#define NRF_FICR_BLE_IR_0 0x028U -#define NRF_FICR_BLE_IR_1 0x02CU -#define NRF_FICR_BLE_IR_2 0x030U -#define NRF_FICR_BLE_IR_3 0x034U -#define NRF_FICR_NFC_TAGHEADER_0 0x040U -#define NRF_FICR_NFC_TAGHEADER_1 0x044U -#define NRF_FICR_NFC_TAGHEADER_2 0x048U -#define NRF_FICR_NFC_TAGHEADER_3 0x04CU -#define NRF_FICR_INFO_CONFIGID 0x050U -#define NRF_FICR_INFO_PART 0x054U -#define NRF_FICR_INFO_VARIANT 0x058U -#define NRF_FICR_INFO_PACKAGE 0x05CU -#define NRF_FICR_INFO_RAM 0x060U -#define NRF_FICR_INFO_MRAM 0x064U -#define NRF_FICR_INFO_CODEPAGESIZE 0x068U -#define NRF_FICR_INFO_CODESIZE 0x06CU -#define NRF_FICR_INFO_DEVICETYPE 0x070U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALVREF 0x384U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_0 0x388U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_1 0x38CU -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_2 0x390U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALOFFSET 0x394U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_0 0x398U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_1 0x39CU -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_2 0x3A0U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_3 0x3A4U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_4 0x3A8U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_5 0x3ACU -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALIREF 0x3B0U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALVREFTC 0x3B4U -#define NRF_FICR_TRIM_GLOBAL_NFCT_BIASCFG 0x3BCU -#define NRF_FICR_TRIM_GLOBAL_CANPLL_TRIM_CTUNE 0x3C0U -#define NRF_FICR_TRIM_GLOBAL_COMP_REFTRIM 0x3D0U -#define NRF_FICR_TRIM_GLOBAL_COMP_RCALTRIM 0x3D4U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP 0x3D8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0 0x3DCU -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_1 0x3E0U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_2 0x3E4U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_3 0x3E8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_4 0x3ECU -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_5 0x3F0U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0 0x3F4U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_1 0x3F8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_2 0x3FCU -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_3 0x400U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_4 0x404U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_5 0x408U -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_0_TRIM 0x40CU -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_1_TRIM 0x410U -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_2_TRIM 0x414U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP 0x418U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_0 0x41CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1 0x420U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_2 0x424U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_3 0x428U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_4 0x42CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_5 0x430U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_0 0x434U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1 0x438U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_2 0x43CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_3 0x440U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_4 0x444U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_5 0x448U -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_0_TRIM 0x44CU -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_1_TRIM 0x450U -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_2_TRIM 0x454U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL0 0x458U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL1 0x45CU -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL2 0x460U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_RXCTRL 0x464U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_OVRRXTRIMCODE 0x468U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_RXAGC_CALIBRATION 0x46CU -#define NRF_FICR_TRIM_RADIOCORE_RADIO_PVTTOT 0x470U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_KDTC 0x474U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_TXHFGAIN 0x478U -#define NRF_FICR_TRIM_RADIOCORE_RADIO_PVTTOFIX 0x47CU -#define NRF_FICR_TRIM_RADIOCORE_RADIO_LOOPGAIN 0x480U - -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ */ From faee8c01b85062c17441675717a73fc7ae67f925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 13 Mar 2024 17:41:37 +0100 Subject: [PATCH 1442/2300] [nrf fromlist] soc: nordic: Remove support for nRF54H20 EngA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was a preview revision of the SoC that will no longer be supported. Signed-off-by: Andrzej Głąbek (cherry picked from commit 4d16e5b7d9166e1bb57cdfb55da56f9538a57a9b) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- .../Kconfig.defconfig.nrf54h20_enga_cpuapp | 17 ----------------- .../Kconfig.defconfig.nrf54h20_enga_cpurad | 17 ----------------- soc/arm/nordic_nrf/nrf54h/Kconfig.soc | 16 ---------------- soc/arm/nordic_nrf/nrf54h/soc.c | 10 ---------- .../nordic_nrf/common/vpr/Kconfig.defconfig | 6 ------ .../Kconfig.defconfig.nrf54h20_enga_cpuppr | 15 --------------- soc/riscv/nordic_nrf/nrf54h/Kconfig.soc | 4 ---- 7 files changed, 85 deletions(-) delete mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp delete mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad delete mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp deleted file mode 100644 index d90f87c0b89..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp +++ /dev/null @@ -1,17 +0,0 @@ -# Nordic Semiconductor nRF54H20 Application MCU - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54H20_ENGA_CPUAPP - -config SOC - default "nrf54h20_enga_cpuapp" - -config NUM_IRQS - default 471 - -config NRF_REGTOOL_GENERATE_UICR - default y - -endif # SOC_NRF54H20_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad deleted file mode 100644 index 6aae8c3a105..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad +++ /dev/null @@ -1,17 +0,0 @@ -# Nordic Semiconductor nRF54H20 Radio MCU - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54H20_ENGA_CPURAD - -config SOC - default "nrf54h20_enga_cpurad" - -config NUM_IRQS - default 471 - -config NRF_REGTOOL_GENERATE_UICR - default y - -endif # SOC_NRF54H20_ENGA_CPURAD diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc index 32256a809a9..be8752c8b5f 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc @@ -28,22 +28,6 @@ config SOC_NRF54H20_CPURAD select CPU_HAS_ICACHE select CPU_HAS_FPU -config SOC_NRF54H20_ENGA_CPUAPP - bool "nRF54H20 ENGA CPUAPP" - select CPU_HAS_ARM_MPU - select CPU_HAS_ARM_SAU - select CPU_HAS_DCACHE - select CPU_HAS_ICACHE - select CPU_HAS_FPU - -config SOC_NRF54H20_ENGA_CPURAD - bool "nRF54H20 ENGA CPURAD" - select CPU_HAS_ARM_MPU - select CPU_HAS_ARM_SAU - select CPU_HAS_DCACHE - select CPU_HAS_ICACHE - select CPU_HAS_FPU - endchoice config NRF_ENABLE_ICACHE diff --git a/soc/arm/nordic_nrf/nrf54h/soc.c b/soc/arm/nordic_nrf/nrf54h/soc.c index 9fefd414152..cf134dc99b1 100644 --- a/soc/arm/nordic_nrf/nrf54h/soc.c +++ b/soc/arm/nordic_nrf/nrf54h/soc.c @@ -44,10 +44,6 @@ static void power_domain_init(void) nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, true); nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, true); - -#if defined(CONFIG_SOC_NRF54H20_ENGA_CPUAPP) - nrf_lrcconf_poweron_force_set(NRF_LRCCONF000, NRF_LRCCONF_POWER_DOMAIN_0, true); -#endif } static int trim_hsfll(void) @@ -69,12 +65,6 @@ static int trim_hsfll(void) nrf_hsfll_trim_set(hsfll, &trim); nrf_hsfll_task_trigger(hsfll, NRF_HSFLL_TASK_FREQ_CHANGE); -#if defined(CONFIG_SOC_NRF54H20_ENGA_CPUAPP) || defined(CONFIG_SOC_NRF54H20_ENGA_CPURAD) - /* In this HW revision, HSFLL task frequency change needs to be - * triggered additional time to take effect. - */ - nrf_hsfll_task_trigger(hsfll, NRF_HSFLL_TASK_FREQ_CHANGE); -#endif LOG_DBG("NRF_HSFLL->TRIM.VSUP = %d", hsfll->TRIM.VSUP); LOG_DBG("NRF_HSFLL->TRIM.COARSE = %d", hsfll->TRIM.COARSE); diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig index a89593170f6..ccab6b62c1d 100644 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig @@ -1,12 +1,6 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -CPU_PATH := $(dt_nodelabel_path,cpu) -CPU_ID := $(dt_node_reg_addr_int,$(CPU_PATH)) - -config RV_BOOT_HART - default $(CPU_ID) if SOC_NRF54H20_ENGA_CPUPPR - config RISCV_MCAUSE_EXCEPTION_MASK default 0xFFF diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr deleted file mode 100644 index a36d24c72ae..00000000000 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54H20_ENGA_CPUPPR - -config SOC - default "nrf54h20_enga_cpuppr" - -config NUM_IRQS - default 496 - -config SYS_CLOCK_TICKS_PER_SEC - default 1000 - -endif # SOC_NRF54H20_ENGA_CPUPPR diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc index 47138277fce..51d42e201f9 100644 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc @@ -14,10 +14,6 @@ config SOC_NRF54H20_CPUPPR bool "nRF54H20 CPUPPR" select RISCV -config SOC_NRF54H20_ENGA_CPUPPR - bool "nRF54H20 ENGA CPUPPR" - depends on RISCV_CORE_NORDIC_VPR - endchoice endif # SOC_NRF54H20 From 7852ea12dddd317d8ab02874596d85a1f2f7771b Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 14 Mar 2024 08:39:38 +0100 Subject: [PATCH 1443/2300] [nrf fromlist] boards: nrf54h20dk: Make execution from RAM default for PPR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In practice, PPR is intended to be running code from RAM, so make this the default choice for the `nrf54h20dk/nrf54h20/cpuppr` board target. Keep the MRAM execution option as a `xip` variant of that target, replacing the `ram` one. Align the default `cpuapp` configuration for copying PPR's image to RAM before it boots the child processor. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 6ff7ec220e25ac1ba1a1803831ee3407acd26e76) Signed-off-by: Andrzej Głąbek Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- .../arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts | 3 ++- .../nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml | 2 +- .../nrf54h20dk_nrf54h20_cpuppr_defconfig | 3 +++ ...20_cpuppr_ram.dts => nrf54h20dk_nrf54h20_cpuppr_xip.dts} | 0 ..._cpuppr_ram.yaml => nrf54h20dk_nrf54h20_cpuppr_xip.yaml} | 6 +++--- ...m_defconfig => nrf54h20dk_nrf54h20_cpuppr_xip_defconfig} | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) rename boards/riscv/nrf54h20dk_nrf54h20/{nrf54h20dk_nrf54h20_cpuppr_ram.dts => nrf54h20dk_nrf54h20_cpuppr_xip.dts} (100%) rename boards/riscv/nrf54h20dk_nrf54h20/{nrf54h20dk_nrf54h20_cpuppr_ram.yaml => nrf54h20dk_nrf54h20_cpuppr_xip.yaml} (62%) rename boards/riscv/nrf54h20dk_nrf54h20/{nrf54h20dk_nrf54h20_cpuppr_ram_defconfig => nrf54h20dk_nrf54h20_cpuppr_xip_defconfig} (95%) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 3873fec457e..a8ea9fe730f 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -131,7 +131,8 @@ }; &cpuppr_vpr { - execution-memory = <&cpuppr_code_partition>; + execution-memory = <&cpuppr_code_data>; + source-memory = <&cpuppr_code_partition>; }; &gpiote130 { diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml index 02e28651f5d..839869d55c2 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml @@ -8,6 +8,6 @@ arch: riscv toolchain: - zephyr ram: 62 -flash: 64 +flash: 62 supported: - gpio diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig index 2f6ccc43892..1e4c72309c6 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig @@ -12,3 +12,6 @@ CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y + +# Execute from RAM +CONFIG_XIP=n diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.dts similarity index 100% rename from boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts rename to boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.dts diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.yaml similarity index 62% rename from boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml rename to boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.yaml index 26d6ebeac9a..82f2109707a 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.yaml @@ -1,13 +1,13 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -identifier: nrf54h20dk_nrf54h20_cpuppr_ram -name: nRF54H20-DK-nRF54H20-PPR-RAM +identifier: nrf54h20dk_nrf54h20_cpuppr_xip +name: nRF54H20-DK-nRF54H20-PPR (MRAM XIP) type: mcu arch: riscv toolchain: - zephyr ram: 62 -flash: 62 +flash: 64 supported: - gpio diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip_defconfig similarity index 95% rename from boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig rename to boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip_defconfig index 73056fac7ef..7e4a13b811b 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip_defconfig @@ -13,4 +13,4 @@ CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y -CONFIG_XIP=n +CONFIG_XIP=y From c676736bb95569ee8c2cd5d09e56ff4d5d347d31 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 14 Mar 2024 08:39:38 +0100 Subject: [PATCH 1444/2300] [nrf fromlist] snippets: Remove nordic-ppr-ram MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `nordic-ppr` snippet can now be used instead, since RAM execution is default for PPR. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 13bebdbf3ad4d4a6f0292720955ef41cb792f0cb) Signed-off-by: Andrzej Głąbek Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- snippets/nordic-ppr-ram/README.rst | 11 ----------- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 16 ---------------- snippets/nordic-ppr-ram/nordic-ppr-ram.overlay | 15 --------------- snippets/nordic-ppr-ram/snippet.yml | 8 -------- 4 files changed, 50 deletions(-) delete mode 100644 snippets/nordic-ppr-ram/README.rst delete mode 100644 snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 snippets/nordic-ppr-ram/nordic-ppr-ram.overlay delete mode 100644 snippets/nordic-ppr-ram/snippet.yml diff --git a/snippets/nordic-ppr-ram/README.rst b/snippets/nordic-ppr-ram/README.rst deleted file mode 100644 index 501e5073357..00000000000 --- a/snippets/nordic-ppr-ram/README.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. _nordic-ppr-ram: - -Nordic boot PPR snippet with execution from RAM (nordic-ppr-ram) -################################################################ - -Overview -******** - -This snippet allows users to build Zephyr with the capability to boot Nordic PPR -(Peripheral Processor) from another core. PPR code is executed from RAM. Note -that PPR image must be built with :kconfig:option:`CONFIG_XIP` disabled. diff --git a/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index ea866358fc0..00000000000 --- a/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuppr_code_data { - status = "okay"; -}; - -&cpuppr_vpr { - execution-memory = <&cpuppr_code_data>; -}; - -&uart135 { - status = "reserved"; -}; diff --git a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay deleted file mode 100644 index 71c45c1b9f4..00000000000 --- a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -/* code is sourced from cpuppr code partition */ -&cpuppr_vpr { - status = "okay"; - source-memory = <&cpuppr_code_partition>; -}; - -/* code partition size must match RAM size */ -&cpuppr_code_partition { - reg = <0x126000 DT_SIZE_K(62)>; -}; diff --git a/snippets/nordic-ppr-ram/snippet.yml b/snippets/nordic-ppr-ram/snippet.yml deleted file mode 100644 index 022ed8d38e8..00000000000 --- a/snippets/nordic-ppr-ram/snippet.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: nordic-ppr-ram -append: - EXTRA_DTC_OVERLAY_FILE: nordic-ppr-ram.overlay - -boards: - nrf54h20dk_nrf54h20_cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay From daa61372e121eaf4c261112434b0b90d2dab60e6 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 14 Mar 2024 08:39:39 +0100 Subject: [PATCH 1445/2300] [nrf fromlist] snippets: Add nordic-ppr-xip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replacement for the `nordic-ppr-ram` snippet does the opposite: enable PPR execution in place from MRAM. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 74f9f866f2385c426437d698eb9bea0ea590f121) Signed-off-by: Andrzej Głąbek Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70172 --- snippets/nordic-ppr-xip/README.rst | 12 ++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 +++++++++++++++++ snippets/nordic-ppr-xip/nordic-ppr-xip.overlay | 8 ++++++++ snippets/nordic-ppr-xip/snippet.yml | 8 ++++++++ 4 files changed, 45 insertions(+) create mode 100644 snippets/nordic-ppr-xip/README.rst create mode 100644 snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 snippets/nordic-ppr-xip/nordic-ppr-xip.overlay create mode 100644 snippets/nordic-ppr-xip/snippet.yml diff --git a/snippets/nordic-ppr-xip/README.rst b/snippets/nordic-ppr-xip/README.rst new file mode 100644 index 00000000000..64977da2989 --- /dev/null +++ b/snippets/nordic-ppr-xip/README.rst @@ -0,0 +1,12 @@ +.. _nordic-ppr-xip: + +Nordic boot PPR snippet with execution in place (nordic-ppr-xip) +################################################################ + +Overview +******** + +This snippet allows users to build Zephyr with the capability to boot Nordic PPR +(Peripheral Processor) from another core. PPR code is to be executed from MRAM, +so the PPR image must be built for the ``xip`` board variant, or with +:kconfig:option:`CONFIG_XIP` enabled. diff --git a/snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..4d02921660b --- /dev/null +++ b/snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuppr_ram3x_region { + status = "okay"; +}; + +&cpuppr_vpr { + execution-memory = <&cpuppr_code_partition>; + /delete-property/ source-memory; +}; + +&uart135 { + status = "reserved"; +}; diff --git a/snippets/nordic-ppr-xip/nordic-ppr-xip.overlay b/snippets/nordic-ppr-xip/nordic-ppr-xip.overlay new file mode 100644 index 00000000000..e33885fc10d --- /dev/null +++ b/snippets/nordic-ppr-xip/nordic-ppr-xip.overlay @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuppr_vpr { + status = "okay"; +}; diff --git a/snippets/nordic-ppr-xip/snippet.yml b/snippets/nordic-ppr-xip/snippet.yml new file mode 100644 index 00000000000..4af89ccc2c0 --- /dev/null +++ b/snippets/nordic-ppr-xip/snippet.yml @@ -0,0 +1,8 @@ +name: nordic-ppr-xip +append: + EXTRA_DTC_OVERLAY_FILE: nordic-ppr-xip.overlay + +boards: + nrf54h20dk_nrf54h20_cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay From bcb46da71cd8bdd05e159de349384f12b8009994 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 14 Mar 2024 09:02:31 +0100 Subject: [PATCH 1446/2300] [nrf fromtree] drivers: misc: nordic_vpr_launcher: Update src/exec memory size check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Firstly, build-asserting the execution/source memory sizes to be equal wasn't working, due to the wrong (non-inst) DT API being used. Secondly, this assert can be relaxed so that the source memory region only needs to have greater than or equal size to the execution region, as VPR firmware needs to fit into execution memory first and foremost. This will come in handy, since MRAM partitions (typical source memory) have stricter alignment requirements than RAM regions. Signed-off-by: Grzegorz Swiderski (cherry picked from commit a55f67d2840dc66c207f83a4dc106d2059e3a067) Signed-off-by: Andrzej Głąbek --- .../nordic_vpr_launcher/nordic_vpr_launcher.c | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c index 64d4969081b..11b75a2c0e5 100644 --- a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c +++ b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c @@ -22,7 +22,7 @@ struct nordic_vpr_launcher_config { uintptr_t exec_addr; #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory) uintptr_t src_addr; - size_t src_size; + size_t size; #endif }; @@ -31,10 +31,10 @@ static int nordic_vpr_launcher_init(const struct device *dev) const struct nordic_vpr_launcher_config *config = dev->config; #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory) - if (config->src_size > 0U) { + if (config->size > 0U) { LOG_DBG("Loading VPR (%p) from %p to %p (%zu bytes)", config->vpr, - (void *)config->src_addr, (void *)config->exec_addr, config->src_size); - memcpy((void *)config->exec_addr, (void *)config->src_addr, config->src_size); + (void *)config->src_addr, (void *)config->exec_addr, config->size); + memcpy((void *)config->exec_addr, (void *)config->src_addr, config->size); } #endif @@ -51,19 +51,17 @@ static int nordic_vpr_launcher_init(const struct device *dev) COND_CODE_0(DT_FIXED_PARTITION_EXISTS(node_id), (0), (DT_REG_ADDR(DT_GPARENT(node_id))))) #define NORDIC_VPR_LAUNCHER_DEFINE(inst) \ - COND_CODE_1(DT_NODE_HAS_PROP(inst, source_memory), \ - (BUILD_ASSERT((DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)) == \ - DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory))), \ - "Source/execution memory sizes mismatch");), \ - ()) \ + IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, source_memory), \ + (BUILD_ASSERT((DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)) <= \ + DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory))), \ + "Execution memory exceeds source memory size");)) \ \ static const struct nordic_vpr_launcher_config config##inst = { \ .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ .exec_addr = VPR_ADDR(DT_INST_PHANDLE(inst, execution_memory)), \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, source_memory), \ - (.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ - .src_size = DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory)),), \ - ())}; \ + IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, source_memory), \ + (.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ + .size = DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)),))}; \ \ DEVICE_DT_INST_DEFINE(inst, nordic_vpr_launcher_init, NULL, NULL, &config##inst, \ POST_KERNEL, CONFIG_NORDIC_VPR_LAUNCHER_INIT_PRIORITY, NULL); From 50d71e240539698b2b6a0da5f8c311cdfa22e4ed Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Mon, 18 Mar 2024 14:16:40 +0100 Subject: [PATCH 1447/2300] [nrf fromtree] scripts: test for imported ELFFile instead of setting it to None MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mypy fails with: Incompatible types in assignment (expression has type "None", variable has type "Type[ELFFile]") this happens because of the code: try: from elftools.elf.elffile import ELFFile except ImportError: ELFFile = None ELFFile is set to None to allow later code to check if ELFFile was imported by checking against None. Instead of setting ELFFile to None, then update testing code to check if the class has been loaded, as: if globals().get('ELFFile') is None: Update the try-catch to `pass`. Removed ELFFile cargo cult from intel_cyclonev.py and fix pylint warnings. Disable duplicate code check. The intel_cyclonev.py is already based upon openocd.py, so although the duplication detection is correct then this should not prevent other code changes / fixes to those files from being applied. Signed-off-by: Torsten Rasmussen (cherry picked from commit c531e4c2ac34a9eca268efb78834cf5245d745d0) Signed-off-by: Andrzej Głąbek --- scripts/west_commands/runners/intel_cyclonev.py | 16 ++++------------ scripts/west_commands/runners/openocd.py | 8 +++++--- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/scripts/west_commands/runners/intel_cyclonev.py b/scripts/west_commands/runners/intel_cyclonev.py index eb67c860800..c6bfb65eeef 100644 --- a/scripts/west_commands/runners/intel_cyclonev.py +++ b/scripts/west_commands/runners/intel_cyclonev.py @@ -11,11 +11,6 @@ from os import path from pathlib import Path -try: - from elftools.elf.elffile import ELFFile -except ImportError: - ELFFile = None - from runners.core import ZephyrBinaryRunner, RunnerCaps DEFAULT_OPENOCD_TCL_PORT = 6333 @@ -195,7 +190,7 @@ def to_num(self, number): def read_version(self): self.require(self.openocd_cmd[0]) - # OpenOCD prints in stderr, need redirect to get output + # OpenOCD prints in stderr, need redirect to get output out = self.check_output([self.openocd_cmd[0], '--version'], stderr=subprocess.STDOUT).decode() @@ -210,9 +205,6 @@ def supports_thread_info(self): def do_run(self, command, **kwargs): self.require(self.openocd_cmd[0]) - if ELFFile is None: - raise RuntimeError( - 'elftools missing; please "pip3 install elftools"') self.cfg_cmd = [] if self.openocd_config is not None: @@ -272,11 +264,11 @@ def do_flash_elf(self, **kwargs): self.require(gdb_cmd[0]) self.print_gdbserver_message() - cmd1 = (echo + server_cmd) + cmd1 = echo + server_cmd self.check_call(cmd1) - cmd2 = (echo + gdb_cmd) + cmd2 = echo + gdb_cmd self.check_call(cmd2) - cmd3 = (echo + gdb_cmd2) + cmd3 = echo + gdb_cmd2 self.check_call(cmd3) self.run_server_and_client(server_cmd, gdb_cmd) diff --git a/scripts/west_commands/runners/openocd.py b/scripts/west_commands/runners/openocd.py index ff92d4f58f4..dd7c6882a36 100644 --- a/scripts/west_commands/runners/openocd.py +++ b/scripts/west_commands/runners/openocd.py @@ -1,6 +1,8 @@ # Copyright (c) 2017 Linaro Limited. # # SPDX-License-Identifier: Apache-2.0 +# +# pylint: disable=duplicate-code '''Runner for openocd.''' @@ -13,7 +15,7 @@ try: from elftools.elf.elffile import ELFFile except ImportError: - ELFFile = None + pass from runners.core import ZephyrBinaryRunner @@ -189,7 +191,7 @@ def to_num(self, number): def read_version(self): self.require(self.openocd_cmd[0]) - # OpenOCD prints in stderr, need redirect to get output + # OpenOCD prints in stderr, need redirect to get output out = self.check_output([self.openocd_cmd[0], '--version'], stderr=subprocess.STDOUT).decode() @@ -204,7 +206,7 @@ def supports_thread_info(self): def do_run(self, command, **kwargs): self.require(self.openocd_cmd[0]) - if ELFFile is None: + if globals().get('ELFFile') is None: raise RuntimeError( 'elftools missing; please "pip3 install elftools"') From 6e6e417a4356f9e0c4935ae5388e971698b1ed68 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 18 Mar 2024 10:32:19 +0100 Subject: [PATCH 1448/2300] [nrf fromtree] scripts: west_commands: runners: nrfjprog: drop nRF54H support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nRF54Hx series is no longer supported in nrfjprog. nrfutil is now required. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 7bea89ac4491423a23be17f171f18145f6d4fb11) Signed-off-by: Andrzej Głąbek --- scripts/west_commands/runners/nrfjprog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index 723080d56c3..cfcf43c9e78 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -48,7 +48,7 @@ def do_exec_op(self, op, force=False): families = {'NRF51_FAMILY': 'NRF51', 'NRF52_FAMILY': 'NRF52', 'NRF53_FAMILY': 'NRF53', 'NRF54L_FAMILY': 'NRF54L', - 'NRF54H_FAMILY': 'NRF54H', 'NRF91_FAMILY': 'NRF91'} + 'NRF91_FAMILY': 'NRF91'} cores = {'NRFDL_DEVICE_CORE_APPLICATION': 'CP_APPLICATION', 'NRFDL_DEVICE_CORE_NETWORK': 'CP_NETWORK'} From 09101e38a030f12e8ff8c6e97fc7cc4aa20a9d6b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 18 Mar 2024 10:55:53 +0100 Subject: [PATCH 1449/2300] [nrf fromtree] scripts: west_commands: runners: nrfutil: use x-execute-batch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit execute-batch is now named x-execute-batch, as it is an experimental option. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 0387214bfcafa30e11f8b4d11889f8b55a998fff) Signed-off-by: Andrzej Głąbek --- scripts/west_commands/runners/nrfutil.py | 2 +- scripts/west_commands/tests/test_nrf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/nrfutil.py b/scripts/west_commands/runners/nrfutil.py index 719e432a23b..50db41abae2 100644 --- a/scripts/west_commands/runners/nrfutil.py +++ b/scripts/west_commands/runners/nrfutil.py @@ -97,7 +97,7 @@ def _exec_batch(self): self._ops = [] self._op_id = 1 self.logger.debug(f'Executing batch in: {json_file}') - self._exec(['execute-batch', '--batch-path', f'{json_file}', + self._exec(['x-execute-batch', '--batch-path', f'{json_file}', '--serial-number', f'{self.dev_id}']) def do_exec_op(self, op, force=False): diff --git a/scripts/west_commands/tests/test_nrf.py b/scripts/west_commands/tests/test_nrf.py index 405e6ea9d6c..a15fe2302e5 100644 --- a/scripts/west_commands/tests/test_nrf.py +++ b/scripts/west_commands/tests/test_nrf.py @@ -521,7 +521,7 @@ def check_expected(tool, test_case, check_fn, get_snr, tmpdir, runner_config): # Extract filename nrfutil_args = check_fn.call_args_list[0].args[0] tmpfile = nrfutil_args[nrfutil_args.index('--batch-path') + 1] - cmds = (['nrfutil', '--json', 'device', 'execute-batch', '--batch-path', + cmds = (['nrfutil', '--json', 'device', 'x-execute-batch', '--batch-path', tmpfile, '--serial-number', expected[0]],) else: cmds = expected From 084cec5e437aadd93b5479a74eb2e20b6f6a0df4 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 18 Mar 2024 11:42:50 +0100 Subject: [PATCH 1450/2300] [nrf fromtree] scripts: west_commands: runners: nrfutil: provide live feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nrfutil runner uses the batch-mode, so no live feedback is provided to the user. However, batch-mode reports batch progress containing human-readable strings of the operation being done. This patch changes the _exec() implementation to parse the subprocess output in real-time, logging to info the 'batch_update' reports. Note that only the first batch update of a sequence (percentage = 0) is logged because first, percentage resolution seems to be pretty bad, and, because logging messages cannot be easily _appended_. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit acc0a43fb919f84600a84467fda71b164796b7cc) Signed-off-by: Andrzej Głąbek --- scripts/west_commands/runners/nrfutil.py | 51 ++++++++++++++---------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/scripts/west_commands/runners/nrfutil.py b/scripts/west_commands/runners/nrfutil.py index 50db41abae2..a7ff512bb9f 100644 --- a/scripts/west_commands/runners/nrfutil.py +++ b/scripts/west_commands/runners/nrfutil.py @@ -10,8 +10,10 @@ import sys import subprocess +from runners.core import _DRY_RUN from runners.nrf_common import NrfBinaryRunner + class NrfUtilBinaryRunner(NrfBinaryRunner): '''Runner front-end for nrfutil.''' @@ -40,27 +42,34 @@ def do_create(cls, cfg, args): recover=args.recover) def _exec(self, args): - try: - out = self.check_output(['nrfutil', '--json', 'device'] + args) - except subprocess.CalledProcessError as e: - # https://docs.python.org/3/reference/compound_stmts.html#except-clause - cpe = e - out = cpe.stdout - else: - cpe = None - finally: - # https://github.com/ndjson/ndjson-spec - out = [json.loads(s) for s in - out.decode(sys.getdefaultencoding()).split('\n') if len(s)] - self.logger.debug(f'output: {out}') - if cpe: - if 'execute-batch' in args: - for o in out: - if o['type'] == 'batch_end' and o['data']['error']: - cpe.returncode = o['data']['error']['code'] - raise cpe - - return out + jout_all = [] + + cmd = ['nrfutil', '--json', 'device'] + args + self._log_cmd(cmd) + + if _DRY_RUN: + return {} + + with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p: + for line in iter(p.stdout.readline, b''): + # https://github.com/ndjson/ndjson-spec + jout = json.loads(line.decode(sys.getdefaultencoding())) + jout_all.append(jout) + + if 'x-execute-batch' in args: + if jout['type'] == 'batch_update': + pld = jout['data']['data'] + if ( + pld['type'] == 'task_progress' and + pld['data']['progress']['progressPercentage'] == 0 + ): + self.logger.info(pld['data']['progress']['description']) + elif jout['type'] == 'batch_end' and jout['data']['error']: + raise subprocess.CalledProcessError( + jout['data']['error']['code'], cmd + ) + + return jout_all def do_get_boards(self): out = self._exec(['list']) From 79075ef37fbb80f0710262b2362fec6103da0ece Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 18 Mar 2024 11:46:26 +0100 Subject: [PATCH 1451/2300] [nrf fromtree] scripts: west_commands: runners: nrf_common: update nRF54H support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nRF54H can only be flashed using nrfutil now, so some workaround present in the nrf_common module are no longer needed, e.g. UICR erasing. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 78706dffdbc502e2f99cf6807ad33cf1708a7467) Signed-off-by: Andrzej Głąbek --- scripts/west_commands/runners/nrf_common.py | 62 ++++++++++----------- scripts/west_commands/runners/nrfjprog.py | 3 +- scripts/west_commands/tests/test_nrf.py | 21 ++++--- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 76662c72ea9..1ea09f8f595 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -29,10 +29,6 @@ '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), } @@ -42,8 +38,7 @@ class NrfBinaryRunner(ZephyrBinaryRunner): '''Runner front-end base class for nrf tools.''' def __init__(self, cfg, family, softreset, dev_id, erase=False, - reset=True, tool_opt=[], force=False, recover=False, - erase_all_uicrs=False): + reset=True, tool_opt=[], force=False, recover=False): super().__init__(cfg) self.hex_ = cfg.hex_file if family and not family.endswith('_FAMILY'): @@ -55,7 +50,6 @@ def __init__(self, cfg, family, softreset, dev_id, erase=False, self.reset = bool(reset) self.force = force self.recover = bool(recover) - self.erase_all_uicrs = bool(erase_all_uicrs) self.tool_opt = [] for opts in [shlex.split(opt) for opt in tool_opt]: @@ -92,11 +86,6 @@ def do_add_parser(cls, parser): help='''erase all user available non-volatile memory and disable read back protection before flashing (erases flash for both cores on nRF53)''') - parser.add_argument('--erase-all-uicrs', required=False, - action='store_true', - help='''Erase all UICR registers before flashing - (nRF54H only). When not set, only UICR registers - present in the hex file will be erased.''') parser.set_defaults(reset=True) @@ -261,14 +250,36 @@ def program_hex(self): # Get the command use to actually program self.hex_. self.logger.info('Flashing file: {}'.format(self.hex_)) - # What type of erase argument should we pass to the tool? - if self.erase: - erase_arg = 'ERASE_ALL' + # What type of erase/core arguments should we pass to the tool? + core = None + + if self.family == 'NRF54H_FAMILY': + erase_arg = 'ERASE_NONE' + + if self.erase: + self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION') + self.exec_op('erase', core='NRFDL_DEVICE_CORE_NETWORK') + + if self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPUAPP'): + if not self.erase: + self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION', + chip_erase_mode='ERASE_UICR', + qspi_erase_mode='ERASE_NONE') + core = 'NRFDL_DEVICE_CORE_APPLICATION' + elif self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPURAD'): + if not self.erase: + self.exec_op('erase', core='NRFDL_DEVICE_CORE_NETWORK', + chip_erase_mode='ERASE_UICR', + qspi_erase_mode='ERASE_NONE') + core = 'NRFDL_DEVICE_CORE_NETWORK' else: - if self.family == 'NRF52_FAMILY': - erase_arg = 'ERASE_PAGES_INCLUDING_UICR' + if self.erase: + erase_arg = 'ERASE_ALL' else: - erase_arg = 'ERASE_PAGES' + if self.family == 'NRF52_FAMILY': + erase_arg = 'ERASE_PAGES_INCLUDING_UICR' + else: + erase_arg = 'ERASE_PAGES' xip_ranges = { 'NRF52_FAMILY': (0x12000000, 0x19FFFFFF), @@ -284,24 +295,11 @@ def program_hex(self): if self.family == 'NRF53_FAMILY': # nRF53 requires special treatment due to the extra coprocessor. self.program_hex_nrf53(erase_arg, qspi_erase_opt) - elif self.family == 'NRF54H_FAMILY': - self.program_hex_nrf54h() else: - self.op_program(self.hex_, erase_arg, qspi_erase_opt, defer=True) + self.op_program(self.hex_, erase_arg, qspi_erase_opt, defer=True, core=core) self.flush(force=False) - def program_hex_nrf54h(self): - if self.erase_all_uicrs: - uicrs = UICR_RANGES['NRF54H_FAMILY'] - else: - uicrs = self.hex_get_uicrs() - - for uicr_core, range in uicrs.items(): - self.exec_op('erasepage', defer=True, core=uicr_core, page=range[0]) - - self.op_program(self.hex_, 'NO_ERASE', None, defer=True) - def program_hex_nrf53(self, erase_arg, qspi_erase_opt): # program_hex() helper for nRF53. diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index cfcf43c9e78..f4bdfa74f97 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -32,8 +32,7 @@ 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, - erase_all_uicrs=args.erase_all_uicrs) + recover=args.recover) def do_get_boards(self): snrs = self.check_output(['nrfjprog', '--ids']) diff --git a/scripts/west_commands/tests/test_nrf.py b/scripts/west_commands/tests/test_nrf.py index a15fe2302e5..d3f429ef775 100644 --- a/scripts/west_commands/tests/test_nrf.py +++ b/scripts/west_commands/tests/test_nrf.py @@ -5,6 +5,7 @@ import argparse import functools +import io import os from pathlib import Path import shlex @@ -523,14 +524,16 @@ def check_expected(tool, test_case, check_fn, get_snr, tmpdir, runner_config): tmpfile = nrfutil_args[nrfutil_args.index('--batch-path') + 1] cmds = (['nrfutil', '--json', 'device', 'x-execute-batch', '--batch-path', tmpfile, '--serial-number', expected[0]],) + call_args = [call(nrfutil_args)] else: cmds = expected + call_args = check_fn.call_args_list if callable(cmds): - assert (check_fn.call_args_list == + assert (call_args == [call(x) for x in cmds(tmpdir, runner_config.hex_file)]) else: - assert check_fn.call_args_list == [call(x) for x in cmds] + assert call_args == [call(x) for x in cmds] if not test_case.snr: get_snr.assert_called_once_with('*') @@ -542,10 +545,11 @@ def check_expected(tool, test_case, check_fn, get_snr, tmpdir, runner_config): @patch('runners.core.ZephyrBinaryRunner.require') @patch('runners.nrfjprog.NrfBinaryRunner.get_board_snr', side_effect=get_board_snr_patch) -@patch('runners.nrfjprog.NrfBinaryRunner.check_output') +@patch('runners.nrfutil.subprocess.Popen') @patch('runners.nrfjprog.NrfBinaryRunner.check_call') -def test_init(check_call, check_output, get_snr, require, tool, test_case, +def test_init(check_call, popen, get_snr, require, tool, test_case, runner_config, tmpdir): + popen.return_value.__enter__.return_value.stdout = io.BytesIO(b'') require.side_effect = functools.partial(require_patch, tool) runner_config = fix_up_runner_config(test_case, runner_config, tmpdir) @@ -564,7 +568,7 @@ def test_init(check_call, check_output, get_snr, require, tool, test_case, runner.run('flash') assert require.called - CHECK_FN_MAP = {'nrfjprog': check_call, 'nrfutil': check_output} + CHECK_FN_MAP = {'nrfjprog': check_call, 'nrfutil': popen} check_expected(tool, test_case, CHECK_FN_MAP[tool], get_snr, tmpdir, runner_config) @@ -573,10 +577,11 @@ def test_init(check_call, check_output, get_snr, require, tool, test_case, @patch('runners.core.ZephyrBinaryRunner.require') @patch('runners.nrfjprog.NrfBinaryRunner.get_board_snr', side_effect=get_board_snr_patch) -@patch('runners.nrfjprog.NrfBinaryRunner.check_output') +@patch('runners.nrfutil.subprocess.Popen') @patch('runners.nrfjprog.NrfBinaryRunner.check_call') -def test_create(check_call, check_output, get_snr, require, tool, test_case, +def test_create(check_call, popen, get_snr, require, tool, test_case, runner_config, tmpdir): + popen.return_value.__enter__.return_value.stdout = io.BytesIO(b'') require.side_effect = functools.partial(require_patch, tool) runner_config = fix_up_runner_config(test_case, runner_config, tmpdir) @@ -603,6 +608,6 @@ def test_create(check_call, check_output, get_snr, require, tool, test_case, assert require.called - CHECK_FN_MAP = {'nrfjprog': check_call, 'nrfutil': check_output} + CHECK_FN_MAP = {'nrfjprog': check_call, 'nrfutil': popen} check_expected(tool, test_case, CHECK_FN_MAP[tool], get_snr, tmpdir, runner_config) From a316ce85304b757f5a51de20e75450fce1cc8ea6 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 18 Mar 2024 11:47:31 +0100 Subject: [PATCH 1452/2300] [nrf fromlist] boards: nordic: nrf54h20dk: enable nrfutil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Board can be programmed using nrfutil. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit db237875376e3ef548f3691994a7fbb35caef254) Signed-off-by: Andrzej Głąbek Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70411 --- boards/arm/nrf54h20dk_nrf54h20/board.cmake | 2 ++ boards/riscv/nrf54h20dk_nrf54h20/board.cmake | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 boards/riscv/nrf54h20dk_nrf54h20/board.cmake diff --git a/boards/arm/nrf54h20dk_nrf54h20/board.cmake b/boards/arm/nrf54h20dk_nrf54h20/board.cmake index 32d1daac179..6361f7fe7b4 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/board.cmake +++ b/boards/arm/nrf54h20dk_nrf54h20/board.cmake @@ -1,5 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 +include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) + if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) set( diff --git a/boards/riscv/nrf54h20dk_nrf54h20/board.cmake b/boards/riscv/nrf54h20dk_nrf54h20/board.cmake new file mode 100644 index 00000000000..86de994b4e2 --- /dev/null +++ b/boards/riscv/nrf54h20dk_nrf54h20/board.cmake @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: Apache-2.0 + +include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) From 5b8966b6c9ec3b2cae07bcec349e8e851795ab07 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Wed, 20 Mar 2024 13:44:06 +0100 Subject: [PATCH 1453/2300] [nrf fromtree] scripts: twister: handlers: pass dev-id for nrfutil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needed to distinguish boards. Signed-off-by: Piotr Kosycarz (cherry picked from commit c3b96ffbabd2d24fc059538ebdc0122e757e868f) Signed-off-by: Andrzej Głąbek --- scripts/pylib/twister/twisterlib/handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index 3a13b819649..6170fc8076e 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -499,7 +499,7 @@ def _create_command(self, runner, hardware): board_id = hardware.probe_id or hardware.id product = hardware.product if board_id is not None: - if runner in ("pyocd", "nrfjprog"): + if runner in ("pyocd", "nrfjprog", "nrfutil"): command_extra_args.append("--dev-id") command_extra_args.append(board_id) elif runner == "openocd" and product == "STM32 STLink": From c98ea075249aba735508a2de53bbc4438ac943da Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Thu, 7 Mar 2024 14:47:23 +0100 Subject: [PATCH 1454/2300] [nrf fromlist] boards: nordic: Add to GRTC missing child-owned-channels allocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The child-owned-channels property of GRTC is used by nrfx_grtc driver to exclude channels for common pool of channels allowed for dynamic allocation. That is sort-of workaround for missing property that allowes to remove some channels from the pool. There are also not aligned GRTC IRQs for nRF54H20 and nRF54L15. Only one of avaialbe IRQs was added to GRTC in DTS whereas there should be two. That allows to find second IRQ by other drivers that use GRTC peripehral. Signed-off-by: Piotr Pryga (cherry picked from commit 6608ff810be95294114352d848dbefb9a234f4dd) Signed-off-by: Andrzej Głąbek Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69924 --- boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts | 2 -- dts/arm/nordic/nrf54h20_cpurad.dtsi | 3 ++- dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi | 4 +++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 1998f4fc131..fd65d2d495a 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -61,8 +61,6 @@ &grtc { status = "okay"; child-owned-channels = <8 9 10 11 12>; - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, - <108 NRF_DEFAULT_IRQ_PRIORITY>; nonsecure-channels = <8 9 10 11 12>; owned-channels = <7 8 9 10 11 12 13 14>; }; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 2f463f2d427..7b7f236de0c 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -47,5 +47,6 @@ cpuppr_vevif: &cpuppr_vevif_remote {}; }; &grtc { - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, + <108 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index 485d85829a4..25f94241336 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -330,7 +330,9 @@ grtc: grtc@e2000 { reg = <0xe2000 0x1000>; cc-num = <12>; owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; + child-owned-channels = <7 8 9 10 11>; + interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, + <229 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; }; From 479305b555fbe875faf0683efb73bc0bbe4e4656 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Wed, 13 Mar 2024 11:23:21 +0100 Subject: [PATCH 1455/2300] [nrf fromlist] dts: nrf54h20: move GRTC channels allocation to the SOC dtsi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GRTC channels and irqs configuration for Radio domain is SOC specific not board specific. Move the configuration to SOC dtsi file. Signed-off-by: Piotr Pryga (cherry picked from commit e0a23663f6fa0677f66b4e058fe7200eba6e575f) Signed-off-by: Andrzej Głąbek Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70154 --- .../arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts | 3 --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index fd65d2d495a..3efa07f6349 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -60,9 +60,6 @@ &grtc { status = "okay"; - child-owned-channels = <8 9 10 11 12>; - nonsecure-channels = <8 9 10 11 12>; - owned-channels = <7 8 9 10 11 12 13 14>; }; &uart135 { diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 7b7f236de0c..f30c777dbe2 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -47,6 +47,10 @@ cpuppr_vevif: &cpuppr_vevif_remote {}; }; &grtc { + owned-channels = <7 8 9 10 11 12 13 14>; + child-owned-channels = <8 9 10 11 12>; + nonsecure-channels = <8 9 10 11 12>; interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, - <108 NRF_DEFAULT_IRQ_PRIORITY>; + <109 NRF_DEFAULT_IRQ_PRIORITY>, + <110 NRF_DEFAULT_IRQ_PRIORITY>; }; From 3fb1c87c354a91b6dbc62f5289b05b860534e011 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Wed, 13 Mar 2024 11:25:15 +0100 Subject: [PATCH 1456/2300] [nrf fromtree] dts: nrf54h20: Add missing global dppic and ipcst configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There were missing global dppic and ipct channels configuration that allows to deliver events from global peripherlas like GRTC to Radio domain. Add missing configuration to nrf54h20 dtsi file. Signed-off-by: Piotr Pryga (cherry picked from commit 3140b9585beea994a8d1b919e78541ebe8749889) Signed-off-by: Andrzej Głąbek --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index f30c777dbe2..4bdaf76e348 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -54,3 +54,23 @@ cpuppr_vevif: &cpuppr_vevif_remote {}; <109 NRF_DEFAULT_IRQ_PRIORITY>, <110 NRF_DEFAULT_IRQ_PRIORITY>; }; + +&dppic130 { + owned-channels = <0>; + sink-channels = <0>; + nonsecure-channels = <0>; + status = "okay"; +}; + +&dppic132 { + owned-channels = <0>; + source-channels = <0>; + nonsecure-channels = <0>; + status = "okay"; +}; + +&ipct130 { + owned-channels = <0>; + source-channel-links = <0 3 0>; + status = "okay"; +}; From 272786b074227b4abcbe8f954d5bb8acf54f3dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 22 Mar 2024 16:32:22 +0100 Subject: [PATCH 1457/2300] [nrf fromlist] modules: hal_nordic: Add missing nrfx_config entries for nRF54L15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nrfx_grtc related entries that were introduced in nrfx 3.4.0, especially NRFX_GRTC_CONFIG_AUTOSTART that should be by default set to 1. Signed-off-by: Andrzej Głąbek (cherry picked from commit 0fdf9cc9970aa02bff31750f9a456a3ddece4b22) Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70616 --- .../nrfx_config_nrf54l15_enga_application.h | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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 a694a07955d..57e469686ec 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h @@ -249,6 +249,33 @@ #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 +#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_NUM_OF_CC_CHANNELS * From 6ba6f31d69b697b7ac87e9e3ef6bf6190e2d613b Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Mon, 11 Mar 2024 13:53:09 +0100 Subject: [PATCH 1458/2300] [nrf fromtree] Bluetooth: Host: Add macros for contiuous scanner It is often desired to maximize the chances of receiving advertising when scanning. To achieve this, the scanner should be enabled all the time. Some controller implementations (like Nordic's SoftDevice Controller) handle scheduling differently when scan_window = scan_interval. Having a macro that defines this scanning configuration simplifies writing applications. Signed-off-by: Rubin Gerritsen (cherry picked from commit 7c2f26bd2a51fcc667d53154a9d650412630eb70) --- include/zephyr/bluetooth/bluetooth.h | 25 +++++++++++++++++++ include/zephyr/bluetooth/gap.h | 1 + .../host/att/pipeline/dut/src/main.c | 8 +----- tests/bsim/bluetooth/ll/cis/src/main.c | 11 +------- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 0cfad9b1f6b..99a26884371 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -2125,6 +2125,18 @@ struct bt_le_scan_cb { BT_GAP_SCAN_FAST_INTERVAL, \ BT_GAP_SCAN_FAST_WINDOW) +/** + * @brief Helper macro to enable active scanning to discover new devices with window == interval. + * + * Continuous scanning should be used to maximize the chances of receiving advertising packets. + */ +#define BT_LE_SCAN_ACTIVE_CONTINUOUS BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \ + BT_LE_SCAN_OPT_FILTER_DUPLICATE, \ + BT_GAP_SCAN_FAST_INTERVAL_MIN, \ + BT_GAP_SCAN_FAST_WINDOW) +BUILD_ASSERT(BT_GAP_SCAN_FAST_WINDOW == BT_GAP_SCAN_FAST_INTERVAL_MIN, + "Continuous scanning is requested by setting window and interval equal."); + /** * @brief Helper macro to enable passive scanning to discover new devices. * @@ -2136,6 +2148,19 @@ struct bt_le_scan_cb { BT_GAP_SCAN_FAST_INTERVAL, \ BT_GAP_SCAN_FAST_WINDOW) +/** + * @brief Helper macro to enable passive scanning to discover new devices with window==interval. + * + * This macro should be used if information required for device identification + * (e.g., UUID) are known to be placed in Advertising Data. + */ +#define BT_LE_SCAN_PASSIVE_CONTINUOUS BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \ + BT_LE_SCAN_OPT_FILTER_DUPLICATE, \ + BT_GAP_SCAN_FAST_INTERVAL_MIN, \ + BT_GAP_SCAN_FAST_WINDOW) +BUILD_ASSERT(BT_GAP_SCAN_FAST_WINDOW == BT_GAP_SCAN_FAST_INTERVAL_MIN, + "Continuous scanning is requested by setting window and interval equal."); + /** * @brief Helper macro to enable active scanning to discover new devices. * Include scanning on Coded PHY in addition to 1M PHY. diff --git a/include/zephyr/bluetooth/gap.h b/include/zephyr/bluetooth/gap.h index 02fa8878c6b..16026d218e1 100644 --- a/include/zephyr/bluetooth/gap.h +++ b/include/zephyr/bluetooth/gap.h @@ -708,6 +708,7 @@ extern "C" { * @name Defined GAP timers * @{ */ +#define BT_GAP_SCAN_FAST_INTERVAL_MIN 0x0030 /* 30 ms */ #define BT_GAP_SCAN_FAST_INTERVAL 0x0060 /* 60 ms */ #define BT_GAP_SCAN_FAST_WINDOW 0x0030 /* 30 ms */ #define BT_GAP_SCAN_SLOW_INTERVAL_1 0x0800 /* 1.28 s */ 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 1a3c1480e1e..6481ce909b4 100644 --- a/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c +++ b/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c @@ -151,16 +151,10 @@ static struct bt_conn *connect(void) { int err; struct bt_conn *conn; - struct bt_le_scan_param scan_param = { - .type = BT_LE_SCAN_TYPE_ACTIVE, - .options = BT_LE_SCAN_OPT_NONE, - .interval = BT_GAP_SCAN_FAST_INTERVAL, - .window = BT_GAP_SCAN_FAST_WINDOW, - }; UNSET_FLAG(is_connected); - err = bt_le_scan_start(&scan_param, device_found); + err = bt_le_scan_start(BT_LE_SCAN_ACTIVE_CONTINUOUS, device_found); ASSERT(!err, "Scanning failed to start (err %d)\n", err); LOG_DBG("Central initiating connection..."); diff --git a/tests/bsim/bluetooth/ll/cis/src/main.c b/tests/bsim/bluetooth/ll/cis/src/main.c index 665c8e0daa4..e54b2e5224c 100644 --- a/tests/bsim/bluetooth/ll/cis/src/main.c +++ b/tests/bsim/bluetooth/ll/cis/src/main.c @@ -45,9 +45,6 @@ static K_SEM_DEFINE(sem_iso_data, CONFIG_BT_ISO_TX_BUF_COUNT, CONFIG_BT_ISO_TX_BUF_COUNT); static bt_addr_le_t peer_addr; -#define SCAN_INTERVAL 0x0010 -#define SCAN_WINDOW 0x0010 - #define CREATE_CONN_INTERVAL 0x0010 #define CREATE_CONN_WINDOW 0x0010 @@ -69,12 +66,6 @@ static bt_addr_le_t peer_addr; #define ADV_INTERVAL_MIN 0x0020 #define ADV_INTERVAL_MAX 0x0020 -#define BT_LE_SCAN_CUSTOM \ - BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \ - BT_LE_SCAN_OPT_NONE, \ - SCAN_INTERVAL, \ - SCAN_WINDOW) - #define BT_CONN_LE_CREATE_CONN_CUSTOM \ BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \ CREATE_CONN_INTERVAL, \ @@ -451,7 +442,7 @@ static void test_cis_central(void) int chan; printk("Start scanning (%d)...", i); - err = bt_le_scan_start(BT_LE_SCAN_CUSTOM, NULL); + err = bt_le_scan_start(BT_LE_SCAN_PASSIVE_CONTINUOUS, NULL); if (err) { FAIL("Could not start scan: %d\n", err); return; From e85f119dcf7f13acb3b239c99bdad69912e3b0af Mon Sep 17 00:00:00 2001 From: Ryan Chu Date: Mon, 25 Mar 2024 15:00:42 +0100 Subject: [PATCH 1459/2300] [nrf fromtree] Samples: Bluetooth: Fix PAwR sample failed to set subevent data Be respectful of PAwR subevents while scheduling scan activities. The radio will be swtiched from scan to PAwR when it is closed to the next subevent interval. Signed-off-by: Ryan Chu (cherry picked from commit 2759a35a1811b10079cd3dc6f20ea9e9c9dab916) --- samples/bluetooth/periodic_adv_rsp/src/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/bluetooth/periodic_adv_rsp/src/main.c b/samples/bluetooth/periodic_adv_rsp/src/main.c index 0b0db776692..6764b023a5a 100644 --- a/samples/bluetooth/periodic_adv_rsp/src/main.c +++ b/samples/bluetooth/periodic_adv_rsp/src/main.c @@ -295,7 +295,8 @@ int main(void) } while (num_synced < MAX_SYNCS) { - err = bt_le_scan_start(BT_LE_SCAN_PASSIVE, device_found); + /* Enable continuous scanning */ + err = bt_le_scan_start(BT_LE_SCAN_PASSIVE_CONTINUOUS, device_found); if (err) { printk("Scanning failed to start (err %d)\n", err); return 0; From 7d7953d89e4cfe1c6f8cdf8635d89c3f40324073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 2 Apr 2024 15:46:39 +0200 Subject: [PATCH 1460/2300] [nrf fromtree] manifest: Update hal_nordic with DMA address check fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix address checking function for nrf54h20. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 7fd73716d0e511a43f7afe685d7c94d5d926c499) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 9c375a568fe..720e5d5a97b 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 13ac55b5b52c905642e9c54f069109d188aa5840 + revision: 7803a3e6b606ddde8df9a10108d7251a108bd7c9 path: modules/hal/nordic groups: - hal From 78cf54bcaced3de263184c72f958ee0bf1bf9a8e Mon Sep 17 00:00:00 2001 From: Marcin Gasiorek Date: Tue, 5 Mar 2024 13:44:39 +0100 Subject: [PATCH 1461/2300] [nrf fromtree] net: ip: Fix for improper offset return by `net_pkt_find_offset()` The original packet's link-layer destination and source address can be stored in separately allocated memory. This allocated memory can be placed just after pkt data buffers. In case when `net_pkt_find_offset()` uses condition: `if (buf->data <= ptr && ptr <= (buf->data + buf->len)) {` the offset is set outside the packet's buffer and the function returns incorrect offset instead of error code. Finally the offset is used to set ll address in cloned packet, and this can have unexpected behavior (e.g. crash when cursor will be set to empty memory). Signed-off-by: Marcin Gasiorek (cherry picked from commit fb99f65fe9a9e7c05f352903a3a41622d61fda8d) --- subsys/net/ip/net_pkt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/ip/net_pkt.c b/subsys/net/ip/net_pkt.c index 38fc288d8f5..d7556a5023d 100644 --- a/subsys/net/ip/net_pkt.c +++ b/subsys/net/ip/net_pkt.c @@ -1817,7 +1817,7 @@ static int32_t net_pkt_find_offset(struct net_pkt *pkt, uint8_t *ptr) buf = pkt->buffer; while (buf) { - if (buf->data <= ptr && ptr <= (buf->data + buf->len)) { + if (buf->data <= ptr && ptr < (buf->data + buf->len)) { ret = offset + (ptr - buf->data); break; } From c24df01678e8fc55ce50b322d484eb3f2b5b56a6 Mon Sep 17 00:00:00 2001 From: Marcin Gasiorek Date: Thu, 28 Mar 2024 22:58:07 +0100 Subject: [PATCH 1462/2300] [nrf fromtree] net: dhcpv6: Add configurable DUID buffer length According to the `RFC8415` the length of the DUID is at least 1 octet up to 128 octets. Now a user can choose buffer length without the need for source code modification. Signed-off-by: Marcin Gasiorek (cherry picked from commit 9c0b8181f3fd66cdff5354409c8acdae3206d1a0) --- include/zephyr/net/dhcpv6.h | 7 +++++-- subsys/net/lib/dhcpv6/Kconfig | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/dhcpv6.h b/include/zephyr/net/dhcpv6.h index 95b59f530b5..715b8cae858 100644 --- a/include/zephyr/net/dhcpv6.h +++ b/include/zephyr/net/dhcpv6.h @@ -38,11 +38,14 @@ enum net_dhcpv6_state { } __packed; #define DHCPV6_TID_SIZE 3 -#define DHCPV6_DUID_MAX_SIZE 20 + +#ifndef CONFIG_NET_DHCPV6_DUID_MAX_LEN +#define CONFIG_NET_DHCPV6_DUID_MAX_LEN 22 +#endif struct net_dhcpv6_duid_raw { uint16_t type; - uint8_t buf[DHCPV6_DUID_MAX_SIZE]; + uint8_t buf[CONFIG_NET_DHCPV6_DUID_MAX_LEN]; } __packed; struct net_dhcpv6_duid_storage { diff --git a/subsys/net/lib/dhcpv6/Kconfig b/subsys/net/lib/dhcpv6/Kconfig index a406f4022a8..24443c9b36c 100644 --- a/subsys/net/lib/dhcpv6/Kconfig +++ b/subsys/net/lib/dhcpv6/Kconfig @@ -15,6 +15,13 @@ config NET_DHCPV6 select NET_MGMT_EVENT depends on NET_IPV6 && NET_UDP +config NET_DHCPV6_DUID_MAX_LEN + int "The maximum DUID length (not including a type code)" + range 1 128 + default 22 + help + This will set the available number of bytes for the DUID. + if NET_DHCPV6 module = NET_DHCPV6 module-dep = NET_LOG From 1b8b90c4b252e40c6ccb56ce25f6b17e616627af Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Mon, 25 Mar 2024 09:50:59 +0100 Subject: [PATCH 1463/2300] [nrf fromtree] samples: bluetooth: hci_ipc: Add nrf54h20 DK board overlay There are required DTS entries to nable peripherals required for IPC communication between Radio and APP CPUs. Signed-off-by: Piotr Pryga (cherry picked from commit 73bdf622f14e847068b3db776dd5a373654e2f6a) --- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 00000000000..02db7c39272 --- /dev/null +++ b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,27 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,bt-hci-ipc = &ipc0; + }; +}; + +ipc0: &cpuapp_cpurad_ipc { + status = "okay"; +}; + +&cpuapp_cpurad_ram0x_region { + status = "okay"; +}; + +&cpurad_bellboard { + status = "okay"; +}; + +&cpuapp_bellboard { + status = "okay"; +}; From a6e3fd56ead78a1373f6af36170f48f5736d4e67 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Fri, 22 Mar 2024 10:12:13 +0100 Subject: [PATCH 1464/2300] [nrf fromtree] boards: nrf54h20: Fix storage partitions for setting subsytem There was missing storage partition that is required for setting subsytem. Add missing entries to board files. Signed-off-by: Piotr Pryga (cherry picked from commit 6f07cecc9529d44fac0b0adfe5313379719d7681) --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 14 ++++++++++++++ .../nrf54h20dk_nrf54h20_cpuapp.dts | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi index 6b6402eb90f..68c0d5cd990 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -181,4 +181,18 @@ reg = <0x126000 DT_SIZE_K(64)>; }; }; + + cpuapp_rw_partitions: cpuapp-rw-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + perm-read; + perm-write; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + + storage_partition: partition@136000 { + reg = <0x136000 DT_SIZE_K(24)>; + }; + }; }; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index a8ea9fe730f..8c6512861e8 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -130,6 +130,10 @@ status = "okay"; }; +&cpuapp_rw_partitions { + status = "okay"; +}; + &cpuppr_vpr { execution-memory = <&cpuppr_code_data>; source-memory = <&cpuppr_code_partition>; From a503870a7a7f6f0b1f9a8213998c0a4ed066b194 Mon Sep 17 00:00:00 2001 From: Piotr Pryga Date: Fri, 22 Mar 2024 10:27:38 +0100 Subject: [PATCH 1465/2300] [nrf fromtree] board: nrf54h20dk: Add missing default BT related configs There are default configs that are provided by default for e.g. nRF5340dk to enable HCI IPC communication type for application domain and enable BT controller for radio domain. These configs were missing for nRF54h20 DK. Signed-off-by: Piotr Pryga (cherry picked from commit b0f9391aee393a9d1d28b0a603c8364560b75f99) --- boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig index 1a029338775..c0e83e0f6a8 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig +++ b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig @@ -4,3 +4,18 @@ config BOARD default "nrf54h20dk_nrf54h20_cpuapp" if BOARD_NRF54H20DK_NRF54H20_CPUAPP default "nrf54h20dk_nrf54h20_cpurad" if BOARD_NRF54H20DK_NRF54H20_CPURAD + +if BOARD_NRF54H20DK_NRF54H20_CPUAPP + +choice BT_HCI_BUS_TYPE + default BT_HCI_IPC if BT +endchoice + +endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP + +if BOARD_NRF54H20DK_NRF54H20_CPURAD + +config BT_CTLR + default y if BT + +endif # BOARD_NRF54H20DK_NRF54H20_CPURAD From 93f8406a968cd750bbfa8ada1682a4556972ed66 Mon Sep 17 00:00:00 2001 From: Bartosz Sokolski Date: Fri, 22 Mar 2024 10:58:51 +0100 Subject: [PATCH 1466/2300] [nrf fromlist] boards: nrf54l15pdk_nrf54l15_cpuapp: add support for PDK 0.3.0 Add support for the PDK 0.3.0 Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/70543 Signed-off-by: Bartosz Sokolski --- .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay | 38 +++++++++++++++++++ .../arm/nrf54l15pdk_nrf54l15/revision.cmake | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay new file mode 100644 index 00000000000..d8262dde994 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + + +&led0 { + gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; +}; + +&led1 { + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; +}; + +&led2 { + gpios = <&gpio2 7 GPIO_ACTIVE_HIGH>; +}; + +&led3 { + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; +}; + +&button0 { + gpios = <&gpio1 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; +}; + +&button1 { + gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; +}; + +&button2 { + gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; +}; + +&button3 { + gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; +}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake b/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake index 4fe5b260db3..6057362de55 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake +++ b/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake @@ -5,5 +5,5 @@ # board_check_revision(FORMAT MAJOR.MINOR.PATCH - VALID_REVISIONS 0.2.0 + VALID_REVISIONS 0.2.0 0.3.0 DEFAULT_REVISION 0.2.0) From 09eb172fafde2bcd727e6310d453e70a2e1e8da5 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 28 Mar 2024 15:04:41 +0100 Subject: [PATCH 1467/2300] [nrf noup] dfu/boot/mcuboot: fix confirmation in case of USE_PARTITION_MANAGER Active partition ID need to be extracted basing on PARTITION_MANAGER products. ref.:NCSDK-26693 Signed-off-by: Andrzej Puzdrowski --- subsys/dfu/boot/mcuboot.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/subsys/dfu/boot/mcuboot.c b/subsys/dfu/boot/mcuboot.c index 4f03c7c9e24..1be8f819442 100644 --- a/subsys/dfu/boot/mcuboot.c +++ b/subsys/dfu/boot/mcuboot.c @@ -34,8 +34,34 @@ #define BOOT_HEADER_MAGIC_V1 0x96f3b83d #define BOOT_HEADER_SIZE_V1 32 +#if USE_PARTITION_MANAGER +#include + +#if CONFIG_BUILD_WITH_TFM + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE + PM_TFM_SIZE) +#else + #define PM_ADDRESS_OFFSET (PM_MCUBOOT_PAD_SIZE) +#endif + +#ifdef CONFIG_MCUBOOT + /* lib is part of MCUboot -> operate on the primart application slot */ + #define ACTIVE_SLOT_ID PM_MCUBOOT_PRIMARY_ID +#else + /* lib is part of the App -> operate on active slot */ +#if (PM_ADDRESS - PM_ADDRESS_OFFSET) == PM_MCUBOOT_PRIMARY_ADDRESS + #define ACTIVE_SLOT_ID PM_MCUBOOT_PRIMARY_ID +#elif (PM_ADDRESS - PM_ADDRESS_OFFSET) == PM_MCUBOOT_SECONDARY_ADDRESS + #define ACTIVE_SLOT_ID PM_MCUBOOT_SECONDARY_ID +#else + #error Missing partition definitions. +#endif +#endif /* CONFIG_MCUBOOT */ + +#define ACTIVE_SLOT_FLASH_AREA_ID ACTIVE_SLOT_ID +#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 /* USE_PARTITION_MANAGER */ /* * Raw (on-flash) representation of the v1 image header. From e658f5167cb48c29fe434f43c8171f49fecf6e48 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 27 Mar 2024 00:55:21 +0530 Subject: [PATCH 1468/2300] [nrf fromtree] net: wifi: Fix the Wi-Fi state check Once Wi-Fi is associated few parameters like listen interval and power-save mode cannot be changed. The state for association is "ASSOCIATED" and not completed. Even after state transitions to COMPLETE, it can still go back to other states, e.g., PTK/GTK renewal. Fix the state check. Signed-off-by: Chaitanya Tata (cherry picked from commit 159617c8f6196bf9f69f2f6d47d31303c5a1c464) --- subsys/net/l2/wifi/wifi_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index bc844016fa5..5ef047e6c72 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -504,7 +504,7 @@ static int wifi_set_power_save(uint32_t mgmt_request, struct net_if *iface, return -EIO; } - if (info.state == WIFI_STATE_COMPLETED) { + if (info.state >= WIFI_STATE_ASSOCIATED) { ps_params->fail_reason = WIFI_PS_PARAM_FAIL_DEVICE_CONNECTED; return -ENOTSUP; From 35a387057f373217b6ad64ddc2c31ca939f1e190 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 27 Mar 2024 18:00:33 +0530 Subject: [PATCH 1469/2300] [nrf fromtree] net: wifi: Add an build assert for checking states order This helps us sanity check the enumerations order isn't changed. Signed-off-by: Chaitanya Tata (cherry picked from commit cb331c2371144f3c391856eec4417ce65cbf0957) --- include/zephyr/net/wifi.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index 0f19d7c4c18..a0840a2319a 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -138,6 +138,18 @@ enum wifi_iface_state { WIFI_STATE_UNKNOWN }; +/* We rely on the strict order of the enum values, so, let's check it */ +BUILD_ASSERT(WIFI_STATE_DISCONNECTED < WIFI_STATE_INTERFACE_DISABLED && + WIFI_STATE_INTERFACE_DISABLED < WIFI_STATE_INACTIVE && + WIFI_STATE_INACTIVE < WIFI_STATE_SCANNING && + WIFI_STATE_SCANNING < WIFI_STATE_AUTHENTICATING && + WIFI_STATE_AUTHENTICATING < WIFI_STATE_ASSOCIATING && + WIFI_STATE_ASSOCIATING < WIFI_STATE_ASSOCIATED && + WIFI_STATE_ASSOCIATED < WIFI_STATE_4WAY_HANDSHAKE && + WIFI_STATE_4WAY_HANDSHAKE < WIFI_STATE_GROUP_HANDSHAKE && + WIFI_STATE_GROUP_HANDSHAKE < WIFI_STATE_COMPLETED); + + /** Helper function to get user-friendly interface state name. */ const char *wifi_state_txt(enum wifi_iface_state state); From 0f0b9f3c45c6884671a8205f9526be23f9463d15 Mon Sep 17 00:00:00 2001 From: Georges Oates_Larsen Date: Fri, 29 Mar 2024 15:01:05 -0700 Subject: [PATCH 1470/2300] [nrf fromtree] net: lib: http: Correct http_client edge-case behavior Correct various small edge-case behaviors that have been accidentally introduced in the http_client. - http_client_req no longer incorrectly returns -ETIMEDOUT on NULL HTTP resonse. -ETIMEDOUT is now only returned when the underlying TLS socket times out. - http_client_req now returns -ECONRESET upon incomplete (but non-NULL) HTTP response. The request callback is no longer called in this case (as with any other error state). - http_wait_data has been refactored slightly to increase clarity. Signed-off-by: Georges Oates_Larsen (cherry picked from commit 30c7d0920c9b03dd15f9ac1913738c290c003275) --- subsys/net/lib/http/http_client.c | 105 +++++++++++++++++------------- 1 file changed, 58 insertions(+), 47 deletions(-) diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index 3992e5fafdd..0f73ce6e8f8 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -392,7 +392,11 @@ static void http_client_init_parser(struct http_parser *parser, settings->on_url = on_url; } -static void http_data_final_null_resp(struct http_request *req) +/* Report a NULL HTTP response to the caller. + * A NULL response is when the HTTP server intentionally closes the TLS socket (using FINACK) + * without sending any HTTP payload. + */ +static void http_report_null(struct http_request *req) { if (req->internal.response.cb) { NET_DBG("Calling callback for Final Data" @@ -413,6 +417,28 @@ static void http_data_final_null_resp(struct http_request *req) } } +/* Report a completed HTTP transaction (with no error) to the caller */ +static void http_report_complete(struct http_request *req) +{ + if (req->internal.response.cb) { + NET_DBG("Calling callback for %zd len data", req->internal.response.data_len); + req->internal.response.cb(&req->internal.response, HTTP_DATA_FINAL, + req->internal.user_data); + } +} + +/* Report that some data has been received, but the HTTP transaction is still ongoing. */ +static void http_report_progress(struct http_request *req) +{ + if (req->internal.response.cb) { + NET_DBG("Calling callback for partitioned %zd len data", + req->internal.response.data_len); + + req->internal.response.cb(&req->internal.response, HTTP_DATA_MORE, + req->internal.user_data); + } +} + static int http_wait_data(int sock, struct http_request *req, int32_t timeout) { int total_received = 0; @@ -438,24 +464,26 @@ static int http_wait_data(int sock, struct http_request *req, int32_t timeout) ret = zsock_poll(fds, nfds, remaining_time); if (ret == 0) { LOG_DBG("Timeout"); - goto finalize_data; + ret = -ETIMEDOUT; + goto error; } else if (ret < 0) { + ret = -errno; goto error; } if (fds[0].revents & (ZSOCK_POLLERR | ZSOCK_POLLNVAL)) { + ret = -errno; goto error; } else if (fds[0].revents & ZSOCK_POLLHUP) { /* Connection closed */ - LOG_DBG("Connection closed"); - goto finalize_data; + goto closed; } else if (fds[0].revents & ZSOCK_POLLIN) { received = zsock_recv(sock, req->internal.response.recv_buf + offset, req->internal.response.recv_buf_len - offset, 0); if (received == 0) { /* Connection closed */ - LOG_DBG("Connection closed"); - goto finalize_data; + goto closed; } else if (received < 0) { + ret = -errno; goto error; } else { req->internal.response.data_len += received; @@ -472,54 +500,41 @@ static int http_wait_data(int sock, struct http_request *req, int32_t timeout) offset = 0; } - if (req->internal.response.cb) { - bool notify = false; - enum http_final_call event; - - if (req->internal.response.message_complete) { - NET_DBG("Calling callback for %zd len data", - req->internal.response.data_len); - - notify = true; - event = HTTP_DATA_FINAL; - } else if (offset == 0) { - NET_DBG("Calling callback for partitioned %zd len data", - req->internal.response.data_len); - - notify = true; - event = HTTP_DATA_MORE; - } - - if (notify) { - req->internal.response.cb(&req->internal.response, event, - req->internal.user_data); - - /* Re-use the result buffer and start to fill it again */ - req->internal.response.data_len = 0; - req->internal.response.body_frag_start = NULL; - req->internal.response.body_frag_len = 0; - } - } - if (req->internal.response.message_complete) { - ret = total_received; + http_report_complete(req); break; + } else if (offset == 0) { + http_report_progress(req); + + /* Re-use the result buffer and start to fill it again */ + req->internal.response.data_len = 0; + req->internal.response.body_frag_start = NULL; + req->internal.response.body_frag_len = 0; } } } while (true); - return ret; + return total_received; -finalize_data: - ret = total_received; +closed: + LOG_DBG("Connection closed"); - http_data_final_null_resp(req); - return ret; + /* If connection was closed with no data sent, this is a NULL response, and is a special + * case valid response. + */ + if (total_received == 0) { + http_report_null(req); + return total_received; + } + + /* Otherwise, connection was closed mid-way through response, and this should be + * considered an error. + */ + ret = -ECONNRESET; error: - LOG_DBG("Connection error (%d)", errno); - ret = -errno; + LOG_DBG("Connection error (%d)", ret); return ret; } @@ -719,10 +734,6 @@ int http_client_req(int sock, struct http_request *req, NET_DBG("Wait data failure (%d)", total_recv); ret = total_recv; goto out; - } else if (total_recv == 0) { - NET_DBG("Timeout while waiting data"); - ret = -ETIMEDOUT; - goto out; } NET_DBG("Received %d bytes", total_recv); From 2a3a5c9757f1f333a638fce9808d2d352623b76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 8 Apr 2024 10:58:59 +0200 Subject: [PATCH 1471/2300] [nrf fromtree] tests: drivers: uart: uart_mix_fifo_poll: Add nRF54L15 to platform allow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nRF54L15 to the platform allow list. Overlay file already exists. Signed-off-by: Sebastian Głąb (cherry picked from commit 2b549daabc9d2cddda3e22c6ec1f5b27ea1997ad) --- tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index ccfdd1aa717..60a3501f9fd 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 + - nrf54l15pdk_nrf54l15_cpuapp - nrf52_bsim integration_platforms: - nrf52840dk_nrf52840 From 76c76edcbabed3192d5cba95b66e94149d2d1879 Mon Sep 17 00:00:00 2001 From: Sigurd Hellesvik Date: Tue, 26 Mar 2024 16:35:05 +0100 Subject: [PATCH 1472/2300] [nrf noup] modules: mbedtls: Use help for DISABLE_MBEDTLS_BUILTIN info Using a comment to explain Kconfig options make them invisible to Kconfig search. Use help instead. Signed-off-by: Sigurd Hellesvik --- modules/mbedtls/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index 25c1d15f84a..99eb3bcf859 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -41,10 +41,11 @@ config MBEDTLS_LIBRARY endchoice -# subsystems cannot deselect MBEDTLS_BUILTIN, but they can select -# DISABLE_MBEDTLS_BUILTIN. config DISABLE_MBEDTLS_BUILTIN bool + help + Subsystems cannot deselect MBEDTLS_BUILTIN, but they can select + DISABLE_MBEDTLS_BUILTIN. config CUSTOM_MBEDTLS_CFG_FILE bool "Custom mbed TLS configuration file" From 92095510b5f18979b12718ebb83f3741c6e411ee Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 8 Mar 2024 11:41:38 +0000 Subject: [PATCH 1473/2300] [nrf fromtree] scripts: snippets: Fix path output on windows Fixes an issue with paths being output in windows-style with back slashes, this causes issues for certain escape sequences when cmake interprets them. Replace these paths with posix paths so that they are not treated as possible escape sequences. Signed-off-by: Jamie McCrae (cherry picked from commit b680a6ec72da4191eb3ae28ec010cfbf05333936) --- scripts/snippets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/snippets.py b/scripts/snippets.py index 78ab896e85b..4050f57a973 100644 --- a/scripts/snippets.py +++ b/scripts/snippets.py @@ -56,7 +56,7 @@ def append_value(variable, value): path = pathobj.parent / value if not path.is_file(): _err(f'snippet file {pathobj}: {variable}: file not found: {path}') - return f'"{path}"' + return f'"{path.as_posix()}"' if variable in ('DTS_EXTRA_CPPFLAGS'): return f'"{value}"' _err(f'unknown append variable: {variable}') From d06a1a7d77b564b331b24db2f3cca58076ef28e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 10 Apr 2024 10:31:11 +0200 Subject: [PATCH 1474/2300] [nrf fromtree] samples: subsys: settings: Add configuration for nRF54L15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration needed to run the sample on nrf54l15pdk/nrf54l15/cpuapp. Signed-off-by: Sebastian Głąb (cherry picked from commit f8ddeed85c7c01d05a69e13d9d5c0738df338860) --- samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf | 2 ++ samples/subsys/settings/sample.yaml | 1 + 2 files changed, 3 insertions(+) create mode 100644 samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf diff --git a/samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf new file mode 100644 index 00000000000..3746c13c741 --- /dev/null +++ b/samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf @@ -0,0 +1,2 @@ +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y diff --git a/samples/subsys/settings/sample.yaml b/samples/subsys/settings/sample.yaml index 2cd51d1405d..1bb763eedb4 100644 --- a/samples/subsys/settings/sample.yaml +++ b/samples/subsys/settings/sample.yaml @@ -12,6 +12,7 @@ tests: - native_sim - native_sim_64 - mr_canhubk3 + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - native_sim harness: console From df2e0db29ed705f528e2cfb385738b8bf389544b Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 21 Mar 2024 18:04:54 +0530 Subject: [PATCH 1475/2300] [nrf fromtree] net: wifi: Add channel validity check for AP mode Channel is mandatory for AP mode. It is processed only if its less than or equal to three characters. Otherwise we need to throw error for channel in AP mode. Signed-off-by: Kapil Bhatt (cherry picked from commit c1e29cc10720cbb059fb925d0d23ad536689cd34) --- subsys/net/l2/wifi/wifi_shell.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index a2e6df39256..c14a36906d5 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -541,6 +541,11 @@ static int __wifi_args_to_params(size_t argc, char *argv[], idx++; } + if ((idx == 1) && (iface_mode == WIFI_MODE_AP)) { + PR_ERROR("Invalid channel: %s\n", argv[idx]); + return -EINVAL; + } + /* PSK (optional) */ if (idx < argc) { params->psk = argv[idx]; From 6886bf7441b53a8734482009130f53c8e70166e2 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Fri, 22 Mar 2024 15:24:38 +0530 Subject: [PATCH 1476/2300] [nrf fromtree] net: wifi: Set default values of dwell time Dwell time Active or Passive is optional in wifi scan. If user don't set the Dwell time value, it will be set as 0. We are adding a range check in scan extensions for dwell time. So need to set default values. Signed-off-by: Kapil Bhatt (cherry picked from commit e25c68be5dcced3ced2a6269df8e47c8921a8235) --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c14a36906d5..1eb1c7d1947 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -769,7 +769,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, static int cmd_wifi_scan(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); - struct wifi_scan_params params = { 0 }; + struct wifi_scan_params params = { .dwell_time_active = 50, .dwell_time_passive = 130, }; bool do_scan = true; int opt_num; From b91d6d1ce593bf96cf23c5c7e76cff6479998709 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 30 Jan 2024 14:26:13 +0530 Subject: [PATCH 1477/2300] [nrf fromtree] net: wifi: Fix disconnect reason codes The shell is printing "connected" while passing the wrong password to connect command. If the status value is 0, then only shell will print "connected." The wrong password will disconnect the connection with an unspecified reason code. If the default value of the unspecified disconnect reason code is 0, then status will print "connected." By changing the default value to WIFI_STATUS_CONN_LAST_STATUS, it will print the correct reason, like a failed request with reason code. Signed-off-by: Kapil Bhatt (cherry picked from commit 6e6f53dc8e4705078dfdc3e2f96164b4a0457977) --- include/zephyr/net/wifi_mgmt.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index e0930d2f106..82898113649 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -377,6 +377,10 @@ enum wifi_conn_status { WIFI_STATUS_CONN_TIMEOUT, /** Connection failed - AP not found */ WIFI_STATUS_CONN_AP_NOT_FOUND, + /** Last connection status */ + WIFI_STATUS_CONN_LAST_STATUS, + /** Connection disconnected status */ + WIFI_STATUS_DISCONN_FIRST_STATUS = WIFI_STATUS_CONN_LAST_STATUS, }; /** Wi-Fi disconnect reason codes. To be overlaid on top of \ref wifi_status @@ -384,7 +388,7 @@ enum wifi_conn_status { */ enum wifi_disconn_reason { /** Unspecified reason */ - WIFI_REASON_DISCONN_UNSPECIFIED = 0, + WIFI_REASON_DISCONN_UNSPECIFIED = WIFI_STATUS_DISCONN_FIRST_STATUS, /** Disconnected due to user request */ WIFI_REASON_DISCONN_USER_REQUEST, /** Disconnected due to AP leaving */ From d9a8f7e0430296e33c738d2be76406528aeed897 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Wed, 27 Mar 2024 16:58:18 +0530 Subject: [PATCH 1478/2300] [nrf fromtree] net: wifi: Replace numeric values with defines There should be a particular defines which clarify the use of that number. So, replacing numbers with defines in wifi shell. Signed-off-by: Kapil Bhatt (cherry picked from commit 6a0e6e4737df541502176f410baeb714fd23331d) --- include/zephyr/net/wifi_mgmt.h | 7 +++++++ subsys/net/l2/wifi/wifi_shell.c | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 82898113649..dca41092817 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -48,6 +48,13 @@ extern "C" { #endif /* CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL */ #define WIFI_MGMT_BAND_STR_SIZE_MAX 8 +#define WIFI_MGMT_SCAN_MIN_DWELL_TIME_ACTIVE 5 +#define WIFI_MGMT_SCAN_MAX_DWELL_TIME_ACTIVE 1000 +#define WIFI_MGMT_SCAN_MIN_DWELL_TIME_PASSIVE 10 +#define WIFI_MGMT_SCAN_MAX_DWELL_TIME_PASSIVE 1000 +#define WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_ACTIVE 50 +#define WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_PASSIVE 130 +#define WIFI_MGMT_SCAN_MAX_BSS_CNT 65535 /** Wi-Fi management commands */ enum net_request_wifi_cmd { diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1eb1c7d1947..463597b3107 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -700,7 +700,8 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'a': val = atoi(optarg); - if ((val < 5) || (val > 1000)) { + if ((val < WIFI_MGMT_SCAN_MIN_DWELL_TIME_ACTIVE) || + (val > WIFI_MGMT_SCAN_MAX_DWELL_TIME_ACTIVE)) { PR_ERROR("Invalid dwell_time_active val\n"); return -ENOEXEC; } @@ -711,7 +712,8 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'p': val = atoi(optarg); - if ((val < 10) || (val > 1000)) { + if ((val < WIFI_MGMT_SCAN_MIN_DWELL_TIME_PASSIVE) || + (val > WIFI_MGMT_SCAN_MAX_DWELL_TIME_PASSIVE)) { PR_ERROR("Invalid dwell_time_passive val\n"); return -ENOEXEC; } @@ -732,7 +734,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'm': val = atoi(optarg); - if ((val < 0) || (val > 65535)) { + if ((val < 0) || (val > WIFI_MGMT_SCAN_MAX_BSS_CNT)) { PR_ERROR("Invalid max_bss val\n"); return -ENOEXEC; } @@ -769,7 +771,10 @@ static int wifi_scan_args_to_params(const struct shell *sh, static int cmd_wifi_scan(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); - struct wifi_scan_params params = { .dwell_time_active = 50, .dwell_time_passive = 130, }; + struct wifi_scan_params params = { .dwell_time_active = + WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_ACTIVE, + .dwell_time_passive = + WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_PASSIVE, }; bool do_scan = true; int opt_num; From 98aa4243c15e646e6a82c0a34ddd7454d6d9a9a4 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 28 Mar 2024 12:17:11 +0530 Subject: [PATCH 1479/2300] [nrf fromtree] net: wifi: Add reasons for 4 way handshake failure When there is 4 way handshake timeout, it can be because of incorrect credential or some times when AP's signal strength is weak. It can cause 4 way handshake fail. Adding comment where WIFI_STATUS_CONN_WRONG_PASSWORD is defined. Signed-off-by: Kapil Bhatt (cherry picked from commit 10d9099356728b5c7680efceafe022e9e8f968dd) --- include/zephyr/net/wifi_mgmt.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index dca41092817..2b469ce1d12 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -378,7 +378,14 @@ enum wifi_conn_status { WIFI_STATUS_CONN_SUCCESS = 0, /** Connection failed - generic failure */ WIFI_STATUS_CONN_FAIL, - /** Connection failed - wrong password */ + /** Connection failed - wrong password + * Few possible reasons for 4-way handshake failure that we can guess are as follows: + * 1) Incorrect key + * 2) EAPoL frames lost causing timeout + * + * #1 is the likely cause, so, we convey to the user that it is due to + * Wrong passphrase/password. + */ WIFI_STATUS_CONN_WRONG_PASSWORD, /** Connection timed out */ WIFI_STATUS_CONN_TIMEOUT, From a76c880b8922777333549d86b991597cd7a46031 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Fri, 5 Apr 2024 16:35:19 +0530 Subject: [PATCH 1480/2300] [nrf fromtree] net: wifi: Remove constraints for dwell time There is no limitations for dwell time. Just add valid condition for positive value. So , it's better to remove those constraints. Signed-off-by: Kapil Bhatt (cherry picked from commit a087a40ac6d01f183b192b50fa6cce11c71c42cf) --- include/zephyr/net/wifi_mgmt.h | 6 ------ subsys/net/l2/wifi/wifi_shell.c | 11 +++-------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 2b469ce1d12..b2ac4e0d4f4 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -48,12 +48,6 @@ extern "C" { #endif /* CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL */ #define WIFI_MGMT_BAND_STR_SIZE_MAX 8 -#define WIFI_MGMT_SCAN_MIN_DWELL_TIME_ACTIVE 5 -#define WIFI_MGMT_SCAN_MAX_DWELL_TIME_ACTIVE 1000 -#define WIFI_MGMT_SCAN_MIN_DWELL_TIME_PASSIVE 10 -#define WIFI_MGMT_SCAN_MAX_DWELL_TIME_PASSIVE 1000 -#define WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_ACTIVE 50 -#define WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_PASSIVE 130 #define WIFI_MGMT_SCAN_MAX_BSS_CNT 65535 /** Wi-Fi management commands */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 463597b3107..316ea2f950e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -700,8 +700,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'a': val = atoi(optarg); - if ((val < WIFI_MGMT_SCAN_MIN_DWELL_TIME_ACTIVE) || - (val > WIFI_MGMT_SCAN_MAX_DWELL_TIME_ACTIVE)) { + if (val < 0) { PR_ERROR("Invalid dwell_time_active val\n"); return -ENOEXEC; } @@ -712,8 +711,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'p': val = atoi(optarg); - if ((val < WIFI_MGMT_SCAN_MIN_DWELL_TIME_PASSIVE) || - (val > WIFI_MGMT_SCAN_MAX_DWELL_TIME_PASSIVE)) { + if (val < 0) { PR_ERROR("Invalid dwell_time_passive val\n"); return -ENOEXEC; } @@ -771,10 +769,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, static int cmd_wifi_scan(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); - struct wifi_scan_params params = { .dwell_time_active = - WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_ACTIVE, - .dwell_time_passive = - WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_PASSIVE, }; + struct wifi_scan_params params = { 0 }; bool do_scan = true; int opt_num; From c976657eb74bfb052d93479be37594bddeff3d86 Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Tue, 9 Apr 2024 14:24:34 +0200 Subject: [PATCH 1481/2300] [nrf noup] entropy: Add fake entropy nRF PRNG driver This adds temporary entropy driver simulation for nRF54h20 device since final entropy source is not available yet. TODO: Remove this commit when proper solution will be available. Jira: NCSDK-25947 Signed-off-by: Kamil Gawor --- .../nrf54h20dk_nrf54h20_cpuapp.dts | 6 ++ .../nrf54h20dk_nrf54h20_cpurad.dts | 6 ++ drivers/entropy/CMakeLists.txt | 7 ++ drivers/entropy/Kconfig | 1 + drivers/entropy/Kconfig.nrf_prng | 19 ++++ drivers/entropy/fake_entropy_nrf_prng.c | 101 ++++++++++++++++++ dts/bindings/rng/nordic,nrf-prng.yaml | 8 ++ 7 files changed, 148 insertions(+) create mode 100644 drivers/entropy/Kconfig.nrf_prng create mode 100644 drivers/entropy/fake_entropy_nrf_prng.c create mode 100644 dts/bindings/rng/nordic,nrf-prng.yaml diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 8c6512861e8..894685693ac 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -22,6 +22,7 @@ zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; + zephyr,entropy = &prng; }; aliases { @@ -86,6 +87,11 @@ label = "Green LED 3"; }; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; }; &cpuapp_ram0x_region { diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 3efa07f6349..4ab3876abab 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -23,6 +23,12 @@ zephyr,code-partition = &cpurad_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; + zephyr,entropy = &prng; + }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; }; }; diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 11e361517c2..c3ffe1413e6 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -34,6 +34,13 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_BT_HCI entropy_bt_hci.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE entropy_gecko_se.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypto.c) +if (CONFIG_FAKE_ENTROPY_NRF_PRNG) + zephyr_library_sources(fake_entropy_nrf_prng.c) + + message(WARNING "\nA nRF PRNG is used, which does not produce real random bits." + "This is not secure and should therefore never be used in a product.") +endif() + if (CONFIG_BUILD_WITH_TFM) target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE $/api_ns/interface/include diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index e932f62c6bf..604a28e7ac7 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -35,6 +35,7 @@ source "drivers/entropy/Kconfig.gecko" source "drivers/entropy/Kconfig.neorv32" source "drivers/entropy/Kconfig.bt_hci" source "drivers/entropy/Kconfig.psa_crypto" +source "drivers/entropy/Kconfig.nrf_prng" config ENTROPY_HAS_DRIVER bool diff --git a/drivers/entropy/Kconfig.nrf_prng b/drivers/entropy/Kconfig.nrf_prng new file mode 100644 index 00000000000..e1b1a9ab4fe --- /dev/null +++ b/drivers/entropy/Kconfig.nrf_prng @@ -0,0 +1,19 @@ +# nRF fake entropy prng generator driver configuration + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if ENTROPY_GENERATOR + +config FAKE_ENTROPY_NRF_PRNG + bool "A fake nRF entropy driver" + default y + depends on DT_HAS_NORDIC_ENTROPY_PRNG_ENABLED + depends on SOC_SERIES_NRF54HX + select ENTROPY_HAS_DRIVER + help + This is a super simple PRNG driver that can be used on nRF platforms that + do not have an entropy source. + This is NOT SAFE to use for cryptographic operations! + +endif diff --git a/drivers/entropy/fake_entropy_nrf_prng.c b/drivers/entropy/fake_entropy_nrf_prng.c new file mode 100644 index 00000000000..8624c844405 --- /dev/null +++ b/drivers/entropy/fake_entropy_nrf_prng.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#define DT_DRV_COMPAT nordic_entropy_prng + +/* This file implements a pseudo-RNG + * https://vigna.di.unimi.it/xorshift/xoshiro128plus.c + */ + +static uint32_t s[4]; + +static inline uint32_t rotl(const uint32_t x, int k) +{ + return (x << k) | (x >> (32 - k)); +} + +static uint32_t rng_next(void) +{ + const uint32_t result = rotl(s[0] + s[3], 7) + s[0]; + + const uint32_t t = s[1] << 9; + + s[2] ^= s[0]; + s[3] ^= s[1]; + s[1] ^= s[2]; + s[0] ^= s[3]; + + s[2] ^= t; + + s[3] = rotl(s[3], 11); + + return result; +} + +static int entropy_prng_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length) +{ + ARG_UNUSED(dev); + + while (length) { + /* + * Note that only 1 thread (Zephyr thread or HW models), runs at + * a time, therefore there is no need to use random_r() + */ + uint32_t value = rng_next(); + + size_t to_copy = MIN(length, sizeof(long)); + + memcpy(buffer, &value, to_copy); + buffer += to_copy; + length -= to_copy; + } + + return 0; +} + +static int entropy_prng_get_entropy_isr(const struct device *dev, uint8_t *buf, uint16_t len, + uint32_t flags) +{ + ARG_UNUSED(flags); + + int err; + + /* + * entropy_prng_get_entropy() is also safe for ISRs + * and always produces data. + */ + err = entropy_prng_get_entropy(dev, buf, len); + if (err < 0) { + return err; + } else { + return len; + } +} + +static int entropy_prng_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + /* Picked some arbitrary initial seed. */ + s[0] = 0xAF568BC0; + s[1] = 0xAC34307E; + s[2] = 0x9B7F6DD1; + s[3] = 0xD84319FC; + return 0; +} + +static const struct entropy_driver_api entropy_prng_api_funcs = { + .get_entropy = entropy_prng_get_entropy, .get_entropy_isr = entropy_prng_get_entropy_isr}; + +DEVICE_DT_INST_DEFINE(0, entropy_prng_init, NULL, NULL, NULL, PRE_KERNEL_1, + CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prng_api_funcs); diff --git a/dts/bindings/rng/nordic,nrf-prng.yaml b/dts/bindings/rng/nordic,nrf-prng.yaml new file mode 100644 index 00000000000..8936393a0b6 --- /dev/null +++ b/dts/bindings/rng/nordic,nrf-prng.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +description: This is a super simple PRNG + +compatible: "nordic,entropy-prng" + +include: base.yaml From dd8fd47265796b558c2d2d495d6880848c50815b Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Wed, 10 Apr 2024 13:00:14 +0200 Subject: [PATCH 1482/2300] [nrf fromlist] boards: nordic: nrf54h20dk: enable HWFC For both UARTs connected to debugger chip. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71324 Signed-off-by: Piotr Kosycarz --- boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts | 1 + boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts | 1 + boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts | 1 + 3 files changed, 3 insertions(+) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 894685693ac..7e5127f8b16 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -179,4 +179,5 @@ pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; + hw-flow-control; }; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 4ab3876abab..30fdf7286d5 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -75,6 +75,7 @@ pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; + hw-flow-control; }; &uart136 { diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts index edce1a8b275..679afcdc8f9 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts @@ -46,6 +46,7 @@ pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; + hw-flow-control; }; &uart136 { From 7c48c142bd059d2bc40b3339d58af7cea054141a Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Mon, 8 Apr 2024 11:39:38 +0200 Subject: [PATCH 1483/2300] [nrf fromtree] samples: sensor: qdec: Allow coverage calculation Sample must end to dump coverage data. Signed-off-by: Piotr Kosycarz (cherry picked from commit 8d4743d14474fc5b65cbb8016aeee7ab3fe3090c) --- samples/sensor/qdec/src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/sensor/qdec/src/main.c b/samples/sensor/qdec/src/main.c index 3e7e87ab021..3410d04e5ba 100644 --- a/samples/sensor/qdec/src/main.c +++ b/samples/sensor/qdec/src/main.c @@ -85,7 +85,11 @@ int main(void) qenc_emulate_init(); +#ifndef CONFIG_COVERAGE while (true) { +#else + for (int i = 0; i < 3; i++) { +#endif rc = sensor_sample_fetch(dev); if (rc != 0) { printk("Failed to fetch sample (%d)\n", rc); From 3c68e19f4eb40c472b8be4fdff067c2519f7379f Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Wed, 10 Apr 2024 15:32:12 +0200 Subject: [PATCH 1484/2300] [nrf noup] test-spec: include nrf54 boards in low-level test trigger All changes in nrf54 boards will trigger low-level testing. Signed-off-by: Piotr Kosycarz --- .github/test-spec.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index a4776a433f3..f0ac25e3f27 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -293,6 +293,8 @@ "CI-test-low-level": - "dts/**/*" + - "boards/arm/nrf54*/**/*" + - "boards/riscv/nrf54*/**/*" - "include/zephyr/**/*" - "tests/arch/**/*" - "arch/**/*" From ba7fac2d7c93492e985e4fa9e9323671ee7ca8bf Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Fri, 5 Apr 2024 11:51:47 +0200 Subject: [PATCH 1485/2300] [nrf fromlist] tests: Extend tests coverage for UARTE driver Add more test cases for the UARTE driver. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71146 Signed-off-by: Bartosz Miller --- .../uart/uart_elementary/CMakeLists.txt | 10 + tests/drivers/uart/uart_elementary/Kconfig | 11 + tests/drivers/uart/uart_elementary/README.txt | 13 + .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 + .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 32 ++ .../boards/nrf54h20dk_nrf54h20_common.dtsi | 37 ++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 3 + ...f54h20dk_nrf54h20_cpuapp_dual_uart.overlay | 56 +++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 31 ++ ...54l15pdk_nrf54l15_cpuapp_dual_uart.overlay | 51 +++ tests/drivers/uart/uart_elementary/prj.conf | 6 + tests/drivers/uart/uart_elementary/src/main.c | 322 ++++++++++++++++++ .../uart/uart_elementary/testcase.yaml | 35 ++ 13 files changed, 608 insertions(+) create mode 100644 tests/drivers/uart/uart_elementary/CMakeLists.txt create mode 100644 tests/drivers/uart/uart_elementary/Kconfig create mode 100644 tests/drivers/uart/uart_elementary/README.txt create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay create mode 100644 tests/drivers/uart/uart_elementary/prj.conf create mode 100644 tests/drivers/uart/uart_elementary/src/main.c create mode 100644 tests/drivers/uart/uart_elementary/testcase.yaml diff --git a/tests/drivers/uart/uart_elementary/CMakeLists.txt b/tests/drivers/uart/uart_elementary/CMakeLists.txt new file mode 100644 index 00000000000..59b31ee68a9 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/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(uart_high_level_api) + +target_sources(app PRIVATE + src/main.c + ) diff --git a/tests/drivers/uart/uart_elementary/Kconfig b/tests/drivers/uart/uart_elementary/Kconfig new file mode 100644 index 00000000000..aed523c5832 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/Kconfig @@ -0,0 +1,11 @@ +# UART test configuration options +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config DUAL_UART_TEST + bool "Enable dual UART test" + +config SETUP_MISMATCH_TEST + bool "Enable mismatched configuration in dual UART test" + +source "Kconfig.zephyr" diff --git a/tests/drivers/uart/uart_elementary/README.txt b/tests/drivers/uart/uart_elementary/README.txt new file mode 100644 index 00000000000..5af85beff46 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/README.txt @@ -0,0 +1,13 @@ +The purpose of this test is to validate basic UART driver functions, +that are not tested elsewhere. +UART interrupt mode is used for the tests purpose. + +Hardware setup required for these tests: +For single uart conviguration - UART0 TX connected to RX and CTS to RTS +For dual uart configuratiom - UART0 and UART1 TXs and RXs cross-connected + +These test cases cover: +- UART configuration, +- UART error check, +- UART callback setup, +- Dual UART transmission with matched and mismatched configurations diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000..064e78b6f74 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000..f98f3657f13 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart1_default_alt: uart1_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + uart1_sleep_alt: uart1_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart1 { + current-speed = <115200>; + compatible = "nordic,nrf-uarte"; + status = "okay"; + pinctrl-0 = <&uart1_default_alt>; + pinctrl-1 = <&uart1_sleep_alt>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi new file mode 100644 index 00000000000..22d8378937c --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&cpuapp_dma_region { + status="okay"; +}; + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; + hw-flow-control; + +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..f65b4dd3b0b --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay new file mode 100644 index 00000000000..23c36ee8974 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; + +&pinctrl { + uart137_default_alt: uart137_default_alt { + group1 { + psels = , + ; + }; + }; + + uart137_sleep_alt: uart137_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut_aux: &uart137 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart137_default_alt>; + pinctrl-1 = <&uart137_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..cf481b7a161 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay new file mode 100644 index 00000000000..2031f7a2444 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart22_default: uart22_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart22_sleep: uart22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; + +dut_aux: &uart22 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart22_default>; + pinctrl-1 = <&uart22_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_elementary/prj.conf b/tests/drivers/uart/uart_elementary/prj.conf new file mode 100644 index 00000000000..26c93d320a7 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/prj.conf @@ -0,0 +1,6 @@ +CONFIG_SERIAL=y +CONFIG_ZTEST=y +CONFIG_TEST_USERSPACE=y +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_UART_USE_RUNTIME_CONFIGURE=y +CONFIG_UART_INTERRUPT_DRIVEN=y diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c new file mode 100644 index 00000000000..d7d85ee9542 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @addtogroup t_driver_uart + * @{ + * @defgroup t_uart_elementary test_uart_elementary + * @} + */ + +#include +#include + +#if DT_NODE_EXISTS(DT_NODELABEL(dut)) +#define UART_NODE DT_NODELABEL(dut) +#else +#define UART_NODE DT_CHOSEN(zephyr_console) +#endif + +#if DT_NODE_EXISTS(DT_NODELABEL(dut_aux)) +#define UART_NODE_AUX DT_NODELABEL(dut_aux) +#else +#define UART_NODE_AUX DT_CHOSEN(zephyr_console) +#endif + +#define SLEEP_TIME_US 1000 +#define TEST_BUFFER_LEN 10 + +static const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE); + +const uint8_t test_pattern[TEST_BUFFER_LEN] = { 0x11, 0x12, 0x13, 0x14, 0x15, + 0x16, 0x17, 0x18, 0x19, 0x20 }; +static uint8_t test_buffer[TEST_BUFFER_LEN]; +static volatile uint8_t uart_error_counter; + +#if defined(CONFIG_DUAL_UART_TEST) +static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); +static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; +static volatile uint8_t aux_uart_error; +#endif + +/* + * ISR for UART TX action + */ +static void uart_tx_interrupt_service(const struct device *dev, int *tx_byte_offset) +{ + uint8_t bytes_sent = 0; + uint8_t *tx_data_pointer = (uint8_t *)(test_pattern + *tx_byte_offset); + + if (*tx_byte_offset < TEST_BUFFER_LEN) { + bytes_sent = uart_fifo_fill(dev, tx_data_pointer, 1); + *tx_byte_offset += bytes_sent; + } else { + *tx_byte_offset = 0; + uart_irq_tx_disable(dev); + } +} + +/* + * ISR for UART RX action + */ +static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive_buffer_pointer, + int *rx_byte_offset) +{ + int rx_data_length = 0; + int bytes_received = 0; + + do { + rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, + TEST_BUFFER_LEN); + bytes_received += rx_data_length; + } while (rx_data_length); + *rx_byte_offset += bytes_received; +} + +/* + * Callback function for MAIN UART interrupt based transmission test + */ +static void interrupt_driven_uart_callback_main_uart(const struct device *dev, void *user_data) +{ + int err; + static int tx_byte_offset; + static int rx_byte_offset; + + uart_irq_update(dev); + err = uart_err_check(dev); + if (err != 0) { + uart_error_counter++; + } + while (uart_irq_is_pending(dev)) { + if (uart_irq_rx_ready(dev)) { + uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset); + } + if (uart_irq_tx_ready(dev)) { + uart_tx_interrupt_service(dev, &tx_byte_offset); + } + } +} + +#if defined(CONFIG_DUAL_UART_TEST) +/* + * Callback function for AUX UART interrupt based transmission test + */ +static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, void *user_data) +{ + int err; + static int tx_byte_offset_aux; + static int rx_byte_offset_aux; + + uart_irq_update(dev); + err = uart_err_check(dev); +#if !defined(CONFIG_COVERAGE) + /* This assetion will fail with coverge enabled + * When in coverage mode it has no impact on test case execution + */ + zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); +#endif /* CONFIG_COVERAGE */ + while (uart_irq_is_pending(dev)) { + if (uart_irq_rx_ready(dev)) { + uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); + } + if (uart_irq_tx_ready(dev)) { + uart_tx_interrupt_service(dev, &tx_byte_offset_aux); + } + } +} +#endif /* CONFIG_DUAL_UART_TEST */ + +/* + * Test UART proper configuration call + */ +ZTEST(uart_elementary, test_uart_proper_configuration) +{ + Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); + + int err; + struct uart_config test_expected_uart_config; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; + + err = uart_configure(uart_dev, &test_uart_config); + zassert_equal(err, 0, "'uart_configure' api call - unexpected error: %d", err); + + err = uart_config_get(uart_dev, &test_expected_uart_config); + zassert_equal(err, 0, "'uart_config_get' api call - unexpected error raised : %d", err); + + zassert_equal(test_uart_config.baudrate, test_expected_uart_config.baudrate, + "Set and actual UART config baudrate mismatch: %d != %d", + test_uart_config.baudrate, test_expected_uart_config.baudrate); + + zassert_equal(test_uart_config.parity, test_expected_uart_config.parity, + "Set and actual UART config parity mismatch: %d != %d", + test_uart_config.parity, test_expected_uart_config.parity); + + zassert_equal(test_uart_config.stop_bits, test_expected_uart_config.stop_bits, + "Set and actual UART config stop_bits mismatch: %d != %d", + test_uart_config.stop_bits, test_expected_uart_config.stop_bits); + + zassert_equal(test_uart_config.data_bits, test_expected_uart_config.data_bits, + "Set and actual UART config data_bits mismatch: %d != %d", + test_uart_config.data_bits, test_expected_uart_config.data_bits); + + zassert_equal(test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl, + "Set and actual UART config flow_ctrl mismatch: %d != %d", + test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl); +} + +/* + * Test UART improper configuration call + */ +ZTEST(uart_elementary, test_uart_improper_configuration) +{ + Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); + + int err; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = 7, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; + + err = uart_configure(uart_dev, &test_uart_config); + zassert_not_equal( + err, 0, + "'uart_configure' with incorrect configuration havent't raised an error, err=%d", + err); +} + +#if !defined(CONFIG_DUAL_UART_TEST) +/* + * Test UART basic interrupt based transmission (with loopback) + */ +ZTEST(uart_elementary, test_uart_basic_transmission) +{ + int err; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = UART_CFG_PARITY_ODD, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; + + err = uart_configure(uart_dev, &test_uart_config); + zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); + + err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); + zassert_equal(err, 0, "Unexpected error when setting callback %d", err); + err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, + (void *)test_buffer); + zassert_equal(err, 0, "Unexpected error when setting user data for callback %d", err); + uart_irq_err_enable(uart_dev); + uart_irq_rx_enable(uart_dev); + uart_irq_tx_enable(uart_dev); + + /* wait for the tramission to finish (no polling is intentional) */ + k_sleep(K_USEC(100 * SLEEP_TIME_US)); + + uart_irq_tx_disable(uart_dev); + uart_irq_rx_disable(uart_dev); + uart_irq_err_disable(uart_dev); + for (int index = 0; index < TEST_BUFFER_LEN; index++) { + zassert_equal(test_buffer[index], test_pattern[index], + "Recieived data byte %d does not match pattern 0x%x != 0x%x", index, + test_buffer[index], test_pattern[index]); + } +} +#else +/* + * Test UART interrupt based transmission between two ports + */ +ZTEST(uart_elementary, test_uart_dual_port_transmission) +{ + int err; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; + +#if defined(CONFIG_SETUP_MISMATCH_TEST) + struct uart_config test_uart_config_aux = { .baudrate = 9600, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; +#endif + err = uart_configure(uart_dev, &test_uart_config); + zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); + +#if defined(CONFIG_SETUP_MISMATCH_TEST) + err = uart_configure(uart_dev_aux, &test_uart_config_aux); +#else + err = uart_configure(uart_dev_aux, &test_uart_config); +#endif + + zassert_equal(err, 0, "Unexpected error when configuring UART1: %d", err); + + err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); + zassert_equal(err, 0, "Unexpected error when setting callback for UART0 %d", err); + err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, + (void *)test_buffer); + zassert_equal(err, 0, "Unexpected error when setting user data for UART0 callback %d", err); + + err = uart_irq_callback_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart); + zassert_equal(err, 0, "Unexpected error when setting callback for UART1 %d", err); + err = uart_irq_callback_user_data_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart, + (void *)test_buffer_aux); + zassert_equal(err, 0, "Unexpected error when setting user data for UART1 callback %d", err); + + uart_irq_err_enable(uart_dev); + uart_irq_err_enable(uart_dev_aux); + + uart_irq_tx_enable(uart_dev); + uart_irq_tx_enable(uart_dev_aux); + + uart_irq_rx_enable(uart_dev); + uart_irq_rx_enable(uart_dev_aux); + + /* wait for the tramission to finish (no polling is intentional) */ + k_sleep(K_USEC(100 * SLEEP_TIME_US)); + + uart_irq_tx_disable(uart_dev); + uart_irq_tx_disable(uart_dev_aux); + uart_irq_rx_disable(uart_dev); + uart_irq_rx_disable(uart_dev_aux); + uart_irq_err_disable(uart_dev); + uart_irq_err_disable(uart_dev_aux); + +#if defined(CONFIG_SETUP_MISMATCH_TEST) + zassert_not_equal(uart_error_counter, 0); +#else + for (int index = 0; index < TEST_BUFFER_LEN; index++) { + zassert_equal(test_buffer[index], test_pattern[index], + "UART0 recieived data byte %d does not match pattern 0x%x != 0x%x", + index, test_buffer[index], test_pattern[index]); + zassert_equal(test_buffer_aux[index], test_pattern[index], + "UART1 recieived data byte %d does not match pattern 0x%x != 0x%x", + index, test_buffer_aux[index], test_pattern[index]); + } +#endif /* CONFIG_SETUP_MISMATCH_TEST */ +} +#endif /* CONFIG_DUAL_UART_TEST */ + +/* + * Test setup + */ +void *test_setup(void) +{ + zassert_true(device_is_ready(uart_dev), "UART0 device is not ready"); +#if defined(CONFIG_DUAL_UART_TEST) + zassert_true(device_is_ready(uart_dev_aux), "UART1 device is not ready"); +#endif + + return NULL; +} + +ZTEST_SUITE(uart_elementary, NULL, test_setup, NULL, NULL, NULL); diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml new file mode 100644 index 00000000000..7c06967e7ad --- /dev/null +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -0,0 +1,35 @@ +common: + tags: drivers uart + depends_on: gpio + harness: ztest + harness_config: + fixture: gpio_loopback +tests: + drivers.uart.uart_elementary: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15pdk/nrf54l15/cpuapp + - nrf5340dk/nrf5340/cpuapp + drivers.uart.uart_elementary_dual_nrf54h: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + drivers.uart.uart_elementary_dual_setup_mismatch_nrf54h: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + - CONFIG_SETUP_MISMATCH_TEST=y + drivers.uart.uart_elementary_dual_nrf54l: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54l15pdk/nrf54l15/cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y From 35bde43cd1d7b516f79e70e434ca1954801dc309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 10 Apr 2024 16:17:41 +0200 Subject: [PATCH 1486/2300] [nrf fromtree] samples: sensor: qdec: Add nRF54L15 to platform allow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nRF54L15 to platform_allow and integration_platforms in the sample.yaml. Overlay file for that target already exists in the boards directory. Signed-off-by: Sebastian Głąb (cherry picked from commit ad33d007eaeef27869475f56f958c2442049eaa0) --- samples/sensor/qdec/sample.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/sensor/qdec/sample.yaml b/samples/sensor/qdec/sample.yaml index 5849f3e00c7..48654c582a6 100644 --- a/samples/sensor/qdec/sample.yaml +++ b/samples/sensor/qdec/sample.yaml @@ -20,8 +20,10 @@ tests: platform_allow: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp + - nrf54l15pdk_nrf54l15_cpuapp harness_config: fixture: gpio_loopback From 22e2d8781ef57c215b49539ae1b16fcd42b331cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 10 Apr 2024 16:20:47 +0200 Subject: [PATCH 1487/2300] [nrf fromtree] samples: sensor: qdec: Move console regex to each test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Harness_config defined in the 'common' section is discarded when test adds fixture to it's harness_config. Signed-off-by: Sebastian Głąb (cherry picked from commit 0fdfcad6759a5bab83c4708d86c7274fb749f300) --- samples/sensor/qdec/sample.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/samples/sensor/qdec/sample.yaml b/samples/sensor/qdec/sample.yaml index 48654c582a6..8d5652906a1 100644 --- a/samples/sensor/qdec/sample.yaml +++ b/samples/sensor/qdec/sample.yaml @@ -5,17 +5,18 @@ common: tags: sensors timeout: 5 harness: console - harness_config: - type: multi_line - ordered: true - regex: - - "Quadrature decoder sensor test" - - "Position = (.*) degrees" + tests: sample.sensor.qdec_sensor: platform_allow: nucleo_f401re harness_config: fixture: fixture_mech_encoder + type: multi_line + ordered: true + regex: + - "Quadrature decoder sensor test" + - "Position = (.*) degrees" + sample.sensor.nrf_qdec_sensor: platform_allow: - nrf52840dk_nrf52840 @@ -27,3 +28,8 @@ tests: - nrf54l15pdk_nrf54l15_cpuapp harness_config: fixture: gpio_loopback + type: multi_line + ordered: true + regex: + - "Quadrature decoder sensor test" + - "Position = (.*) degrees" From 70a046e332a078778d3ef4e78e13b6108ae4a0bb Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 3 Apr 2024 13:21:20 +0200 Subject: [PATCH 1488/2300] [nrf fromtree] manifest: update hal_nordic to have PWM fix for nRF54 Updated hal_nordic revision contains fix that allows the PWM on nRF54H20 and nRF54L15 devices to work. Signed-off-by: Nikodem Kastelik (cherry picked from commit f9b7a2a37db9d0ce70145edafd05afd1db2a8dd5) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 720e5d5a97b..c25c87dcd32 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 7803a3e6b606ddde8df9a10108d7251a108bd7c9 + revision: fc2bab706f195c64d40016c9855b8acd7c235ded path: modules/hal/nordic groups: - hal From 293ae3de1470640f70664dd3c4d7e006440012d5 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 3 Apr 2024 12:33:40 +0200 Subject: [PATCH 1489/2300] [nrf fromtree] dts: nordic: add PWM instances for nRF54 Series Add definitions of PWM peripheral instances so it can be utilized on nRF54H20 and nRF54L15 devices. Signed-off-by: Nikodem Kastelik (cherry picked from commit 0401d063fa9ea3eb78542cee74e2a89f501b02f9) --- .../nordic/nrf54l15_cpuapp_peripherals.dtsi | 24 +++++++++++ dts/common/nordic/nrf54h20.dtsi | 40 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index 25f94241336..eb161844841 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -261,6 +261,30 @@ timer24: timer@ce000 { prescaler = <0>; }; +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>; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 78e4c5b6549..ec5c4cca14f 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -345,6 +345,14 @@ prescaler = <0>; }; + pwm120: pwm@8e4000 { + compatible = "nordic,nrf-pwm"; + reg = <0x8e4000 0x1000>; + status = "disabled"; + interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + spi120: spi@8e6000 { compatible = "nordic,nrf-spim"; reg = <0x8e6000 0x1000>; @@ -602,6 +610,14 @@ prescaler = <0>; }; + pwm130: pwm@9a4000 { + compatible = "nordic,nrf-pwm"; + reg = <0x9a4000 0x1000>; + status = "disabled"; + interrupts = <420 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + i2c130: i2c@9a5000 { compatible = "nordic,nrf-twim"; reg = <0x9a5000 0x1000>; @@ -684,6 +700,14 @@ prescaler = <0>; }; + pwm131: pwm@9b4000 { + compatible = "nordic,nrf-pwm"; + reg = <0x9b4000 0x1000>; + status = "disabled"; + interrupts = <436 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + i2c132: i2c@9b5000 { compatible = "nordic,nrf-twim"; reg = <0x9b5000 0x1000>; @@ -766,6 +790,14 @@ prescaler = <0>; }; + pwm132: pwm@9c4000 { + compatible = "nordic,nrf-pwm"; + reg = <0x9c4000 0x1000>; + status = "disabled"; + interrupts = <452 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + i2c134: i2c@9c5000 { compatible = "nordic,nrf-twim"; reg = <0x9c5000 0x1000>; @@ -848,6 +880,14 @@ prescaler = <0>; }; + pwm133: pwm@9d4000 { + compatible = "nordic,nrf-pwm"; + reg = <0x9d4000 0x1000>; + status = "disabled"; + interrupts = <468 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + i2c136: i2c@9d5000 { compatible = "nordic,nrf-twim"; reg = <0x9d5000 0x1000>; From 591e739e9611a28643a49ea9bc919667f65cfd07 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 3 Apr 2024 12:37:00 +0200 Subject: [PATCH 1490/2300] [nrf fromtree] soc: nordic: add nRF54 PWM HAS_HW & base addr validation Add HAS_HW symbols for PWM instances found on nRF54H20 and nRF54L15 devices. Signed-off-by: Nikodem Kastelik (cherry picked from commit 6bce78937df09f55143ddd8fc14b064438a020e9) --- soc/arm/nordic_nrf/validate_base_addresses.c | 8 +++++++ soc/common/nordic_nrf/Kconfig.peripherals | 24 ++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 04c7a1ae3cd..f3c1b29b69a 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -209,6 +209,14 @@ CHECK_DT_REG(pwm0, NRF_PWM0); CHECK_DT_REG(pwm1, NRF_PWM1); CHECK_DT_REG(pwm2, NRF_PWM2); CHECK_DT_REG(pwm3, NRF_PWM3); +CHECK_DT_REG(pwm20, NRF_PWM20); +CHECK_DT_REG(pwm21, NRF_PWM21); +CHECK_DT_REG(pwm22, NRF_PWM22); +CHECK_DT_REG(pwm120, NRF_PWM120); +CHECK_DT_REG(pwm130, NRF_PWM130); +CHECK_DT_REG(pwm131, NRF_PWM131); +CHECK_DT_REG(pwm132, NRF_PWM132); +CHECK_DT_REG(pwm133, NRF_PWM133); CHECK_DT_REG(qdec, NRF_QDEC0); /* this should be the same node as qdec0 */ CHECK_DT_REG(qdec0, NRF_QDEC0); CHECK_DT_REG(qdec1, NRF_QDEC1); diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index a6b62428626..39ed2e6432f 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -149,6 +149,30 @@ config HAS_HW_NRF_PWM2 config HAS_HW_NRF_PWM3 def_bool $(dt_nodelabel_enabled_with_compat,pwm3,$(DT_COMPAT_NORDIC_NRF_PWM)) +config HAS_HW_NRF_PWM20 + def_bool $(dt_nodelabel_enabled_with_compat,pwm20,$(DT_COMPAT_NORDIC_NRF_PWM)) + +config HAS_HW_NRF_PWM21 + def_bool $(dt_nodelabel_enabled_with_compat,pwm21,$(DT_COMPAT_NORDIC_NRF_PWM)) + +config HAS_HW_NRF_PWM22 + def_bool $(dt_nodelabel_enabled_with_compat,pwm22,$(DT_COMPAT_NORDIC_NRF_PWM)) + +config HAS_HW_NRF_PWM120 + def_bool $(dt_nodelabel_enabled_with_compat,pwm120,$(DT_COMPAT_NORDIC_NRF_PWM)) + +config HAS_HW_NRF_PWM130 + def_bool $(dt_nodelabel_enabled_with_compat,pwm130,$(DT_COMPAT_NORDIC_NRF_PWM)) + +config HAS_HW_NRF_PWM131 + def_bool $(dt_nodelabel_enabled_with_compat,pwm131,$(DT_COMPAT_NORDIC_NRF_PWM)) + +config HAS_HW_NRF_PWM132 + def_bool $(dt_nodelabel_enabled_with_compat,pwm132,$(DT_COMPAT_NORDIC_NRF_PWM)) + +config HAS_HW_NRF_PWM133 + def_bool $(dt_nodelabel_enabled_with_compat,pwm133,$(DT_COMPAT_NORDIC_NRF_PWM)) + config HAS_HW_NRF_QDEC0 def_bool $(dt_nodelabel_enabled_with_compat,qdec0,$(DT_COMPAT_NORDIC_NRF_QDEC)) From 1730143bcf32278f446e310ad6a5458a4408d191 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 3 Apr 2024 12:39:13 +0200 Subject: [PATCH 1491/2300] [nrf fromtree] modules: hal_nordic: nrfx: add support for nRF54 PWM Add Kconfig-to-nrfx symbol redefinitions so that PWM instances found on nRF54H20 and nRF54L15 devices are supported. Signed-off-by: Nikodem Kastelik (cherry picked from commit 9949645dd447bce65c66c03066e4034ba86631be) --- modules/hal_nordic/nrfx/Kconfig | 40 +++++++++++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 24 ++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index a511af42e17..c1138ab25a3 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -184,6 +184,46 @@ config NRFX_PWM3 depends on $(dt_nodelabel_has_compat,pwm3,$(DT_COMPAT_NORDIC_NRF_PWM)) select NRFX_PWM +config NRFX_PWM20 + bool "PWM20 driver instance" + depends on $(dt_nodelabel_has_compat,pwm20,$(DT_COMPAT_NORDIC_NRF_PWM)) + select NRFX_PWM + +config NRFX_PWM21 + bool "PWM21 driver instance" + depends on $(dt_nodelabel_has_compat,pwm21,$(DT_COMPAT_NORDIC_NRF_PWM)) + select NRFX_PWM + +config NRFX_PWM22 + bool "PWM22 driver instance" + depends on $(dt_nodelabel_has_compat,pwm22,$(DT_COMPAT_NORDIC_NRF_PWM)) + select NRFX_PWM + +config NRFX_PWM120 + bool "PWM120 driver instance" + depends on $(dt_nodelabel_has_compat,pwm120,$(DT_COMPAT_NORDIC_NRF_PWM)) + select NRFX_PWM + +config NRFX_PWM130 + bool "PWM130 driver instance" + depends on $(dt_nodelabel_has_compat,pwm130,$(DT_COMPAT_NORDIC_NRF_PWM)) + select NRFX_PWM + +config NRFX_PWM131 + bool "PWM131 driver instance" + depends on $(dt_nodelabel_has_compat,pwm131,$(DT_COMPAT_NORDIC_NRF_PWM)) + select NRFX_PWM + +config NRFX_PWM132 + bool "PWM132 driver instance" + depends on $(dt_nodelabel_has_compat,pwm132,$(DT_COMPAT_NORDIC_NRF_PWM)) + select NRFX_PWM + +config NRFX_PWM133 + bool "PWM133 driver instance" + depends on $(dt_nodelabel_has_compat,pwm133,$(DT_COMPAT_NORDIC_NRF_PWM)) + select NRFX_PWM + config NRFX_QDEC bool diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index ad5d5ba690b..e99c80d43cd 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -248,6 +248,30 @@ #ifdef CONFIG_NRFX_PWM3 #define NRFX_PWM3_ENABLED 1 #endif +#ifdef CONFIG_NRFX_PWM20 +#define NRFX_PWM20_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PWM21 +#define NRFX_PWM21_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PWM22 +#define NRFX_PWM22_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PWM120 +#define NRFX_PWM120_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PWM130 +#define NRFX_PWM130_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PWM131 +#define NRFX_PWM131_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PWM132 +#define NRFX_PWM132_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PWM133 +#define NRFX_PWM133_ENABLED 1 +#endif #ifdef CONFIG_NRFX_QDEC #define NRFX_QDEC_ENABLED 1 From 3b0c038225cd86ed4fabe5fe937c61cff6bd6be2 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 3 Apr 2024 12:40:50 +0200 Subject: [PATCH 1492/2300] [nrf fromtree] drivers: pwm: add support for nRF54 devices Add PWM instances found on nRF54H20 and nRF54L15 devices, so that PWM driver can be utilized on these. Signed-off-by: Nikodem Kastelik (cherry picked from commit 835f3bef7059a97b6e0543ac449d6376c2d06e58) --- drivers/pwm/Kconfig.nrfx | 8 ++++++++ drivers/pwm/pwm_nrfx.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/pwm/Kconfig.nrfx b/drivers/pwm/Kconfig.nrfx index 9a84c5fd21b..933fe7cb29c 100644 --- a/drivers/pwm/Kconfig.nrfx +++ b/drivers/pwm/Kconfig.nrfx @@ -9,6 +9,14 @@ config PWM_NRFX select NRFX_PWM1 if HAS_HW_NRF_PWM1 select NRFX_PWM2 if HAS_HW_NRF_PWM2 select NRFX_PWM3 if HAS_HW_NRF_PWM3 + select NRFX_PWM20 if HAS_HW_NRF_PWM20 + select NRFX_PWM21 if HAS_HW_NRF_PWM21 + select NRFX_PWM22 if HAS_HW_NRF_PWM22 + select NRFX_PWM120 if HAS_HW_NRF_PWM120 + select NRFX_PWM130 if HAS_HW_NRF_PWM130 + select NRFX_PWM131 if HAS_HW_NRF_PWM131 + select NRFX_PWM132 if HAS_HW_NRF_PWM132 + select NRFX_PWM133 if HAS_HW_NRF_PWM133 select PINCTRL help Enable support for nrfx Hardware PWM driver for nRF52 MCU series. diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 52257dce104..9feacb2c10b 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -391,3 +391,35 @@ PWM_NRFX_DEVICE(2); #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 + +#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 From ecdf156a7c546417559d2abcdba9cfa696d89116 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 3 Apr 2024 15:42:40 +0200 Subject: [PATCH 1493/2300] [nrf fromtree] boards: nordic: nrf54l15pdk: mark PWM as supported PWM peripheral is now supported on nRF54L15 PDK. Signed-off-by: Nikodem Kastelik (cherry picked from commit c5d39a83dd1728aecb5c83257fb6049b645d4801) --- boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml index de5ce29d162..e8e69adfc6d 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml @@ -14,6 +14,7 @@ flash: 1536 supported: - gpio - i2c + - pwm - spi - watchdog - i2s From 66fec84a3e19b7661aa0300d257d07eaf9b5a287 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 3 Apr 2024 12:42:21 +0200 Subject: [PATCH 1494/2300] [nrf fromtree] tests: drivers: pwm: add support for nRF54 devices Add missing alignments and overlays so that nRF54H20 and nRF54L15 can run the test. Signed-off-by: Nikodem Kastelik (cherry picked from commit 53a7a402a78fd53c2fed08dfd10907a86906a5b6) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 20 +++++++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 20 +++++++++++++++++++ tests/drivers/pwm/pwm_api/src/test_pwm.c | 5 ++++- tests/drivers/pwm/pwm_api/testcase.yaml | 2 +- 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/pwm/pwm_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..c483d27f569 --- /dev/null +++ b/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,20 @@ +&pinctrl { + pwm_default: pwm_default { + group1 { + psels = ; + }; + }; + pwm_sleep: pwm_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; + +&pwm130 { + status = "okay"; + pinctrl-0 = <&pwm_default>; + pinctrl-1 = <&pwm_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/pwm/pwm_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/pwm/pwm_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..013653617e4 --- /dev/null +++ b/tests/drivers/pwm/pwm_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,20 @@ +&pinctrl { + pwm_default: pwm_default { + group1 { + psels = ; + }; + }; + pwm_sleep: pwm_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; + +&pwm20 { + status = "okay"; + pinctrl-0 = <&pwm_default>; + pinctrl-1 = <&pwm_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/pwm/pwm_api/src/test_pwm.c b/tests/drivers/pwm/pwm_api/src/test_pwm.c index 867025d99b1..f8e71d1cb24 100644 --- a/tests/drivers/pwm/pwm_api/src/test_pwm.c +++ b/tests/drivers/pwm/pwm_api/src/test_pwm.c @@ -38,6 +38,9 @@ #elif DT_NODE_HAS_STATUS(DT_ALIAS(pwm_3), okay) #define PWM_DEV_NODE DT_ALIAS(pwm_3) +#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pwm) +#define PWM_DEV_NODE DT_INST(0, nordic_nrf_pwm) + #elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_pwm) #define PWM_DEV_NODE DT_INST(0, st_stm32_pwm) @@ -76,7 +79,7 @@ #if defined CONFIG_BOARD_SAM_E70_XPLAINED #define DEFAULT_PWM_PORT 2 /* PWM on EXT2 connector, pin 8 */ #elif defined CONFIG_PWM_NRFX -#define DEFAULT_PWM_PORT DT_PROP(DT_ALIAS(pwm_0), ch0_pin) +#define DEFAULT_PWM_PORT 0 #elif defined CONFIG_BOARD_ADAFRUIT_ITSYBITSY_M4_EXPRESS #define DEFAULT_PWM_PORT 2 /* TCC1/WO[2] on PA18 (D7) */ #elif defined CONFIG_BOARD_MIMXRT685_EVK diff --git a/tests/drivers/pwm/pwm_api/testcase.yaml b/tests/drivers/pwm/pwm_api/testcase.yaml index 608a4d0a0e1..aca9172fc96 100644 --- a/tests/drivers/pwm/pwm_api/testcase.yaml +++ b/tests/drivers/pwm/pwm_api/testcase.yaml @@ -6,5 +6,5 @@ tests: - userspace filter: dt_alias_exists("pwm-0") or dt_alias_exists("pwm-1") or dt_alias_exists("pwm-2") or dt_alias_exists("pwm-3") or dt_compat_enabled("st,stm32-pwm") - or dt_compat_enabled("intel,blinky-pwm") + or dt_compat_enabled("intel,blinky-pwm") or dt_compat_enabled("nordic,nrf-pwm") depends_on: pwm From 26c7f37b9e4efe371ee40873fb409cacd30cdf11 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Thu, 11 Apr 2024 16:02:32 +0200 Subject: [PATCH 1495/2300] Revert "[nrf fromlist] tests: Extend tests coverage for UARTE driver" This reverts commit ba7fac2d7c93492e985e4fa9e9323671ee7ca8bf. Signed-off-by: Bartosz Miller --- .../uart/uart_elementary/CMakeLists.txt | 10 - tests/drivers/uart/uart_elementary/Kconfig | 11 - tests/drivers/uart/uart_elementary/README.txt | 13 - .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 - .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 32 -- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 37 -- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 3 - ...f54h20dk_nrf54h20_cpuapp_dual_uart.overlay | 56 --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 31 -- ...54l15pdk_nrf54l15_cpuapp_dual_uart.overlay | 51 --- tests/drivers/uart/uart_elementary/prj.conf | 6 - tests/drivers/uart/uart_elementary/src/main.c | 322 ------------------ .../uart/uart_elementary/testcase.yaml | 35 -- 13 files changed, 608 deletions(-) delete mode 100644 tests/drivers/uart/uart_elementary/CMakeLists.txt delete mode 100644 tests/drivers/uart/uart_elementary/Kconfig delete mode 100644 tests/drivers/uart/uart_elementary/README.txt delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay delete mode 100644 tests/drivers/uart/uart_elementary/prj.conf delete mode 100644 tests/drivers/uart/uart_elementary/src/main.c delete mode 100644 tests/drivers/uart/uart_elementary/testcase.yaml diff --git a/tests/drivers/uart/uart_elementary/CMakeLists.txt b/tests/drivers/uart/uart_elementary/CMakeLists.txt deleted file mode 100644 index 59b31ee68a9..00000000000 --- a/tests/drivers/uart/uart_elementary/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(uart_high_level_api) - -target_sources(app PRIVATE - src/main.c - ) diff --git a/tests/drivers/uart/uart_elementary/Kconfig b/tests/drivers/uart/uart_elementary/Kconfig deleted file mode 100644 index aed523c5832..00000000000 --- a/tests/drivers/uart/uart_elementary/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# UART test configuration options -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config DUAL_UART_TEST - bool "Enable dual UART test" - -config SETUP_MISMATCH_TEST - bool "Enable mismatched configuration in dual UART test" - -source "Kconfig.zephyr" diff --git a/tests/drivers/uart/uart_elementary/README.txt b/tests/drivers/uart/uart_elementary/README.txt deleted file mode 100644 index 5af85beff46..00000000000 --- a/tests/drivers/uart/uart_elementary/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -The purpose of this test is to validate basic UART driver functions, -that are not tested elsewhere. -UART interrupt mode is used for the tests purpose. - -Hardware setup required for these tests: -For single uart conviguration - UART0 TX connected to RX and CTS to RTS -For dual uart configuratiom - UART0 and UART1 TXs and RXs cross-connected - -These test cases cover: -- UART configuration, -- UART error check, -- UART callback setup, -- Dual UART transmission with matched and mismatched configurations diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 064e78b6f74..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f98f3657f13..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart1_default_alt: uart1_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - uart1_sleep_alt: uart1_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart1 { - current-speed = <115200>; - compatible = "nordic,nrf-uarte"; - status = "okay"; - pinctrl-0 = <&uart1_default_alt>; - pinctrl-1 = <&uart1_sleep_alt>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi deleted file mode 100644 index 22d8378937c..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&cpuapp_dma_region { - status="okay"; -}; - -&pinctrl { - uart135_default_alt: uart135_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - uart135_sleep_alt: uart135_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart135 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart135_default_alt>; - pinctrl-1 = <&uart135_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; - hw-flow-control; - -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index f65b4dd3b0b..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay deleted file mode 100644 index 23c36ee8974..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay +++ /dev/null @@ -1,56 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" - - -&pinctrl { - uart135_default_alt: uart135_default_alt { - group1 { - psels = , - ; - }; - }; - - uart135_sleep_alt: uart135_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart135 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart135_default_alt>; - pinctrl-1 = <&uart135_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; -}; - -&pinctrl { - uart137_default_alt: uart137_default_alt { - group1 { - psels = , - ; - }; - }; - - uart137_sleep_alt: uart137_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut_aux: &uart137 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart137_default_alt>; - pinctrl-1 = <&uart137_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index cf481b7a161..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay deleted file mode 100644 index 2031f7a2444..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay +++ /dev/null @@ -1,51 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart22_default: uart22_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart22_sleep: uart22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; - -dut_aux: &uart22 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart22_default>; - pinctrl-1 = <&uart22_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_elementary/prj.conf b/tests/drivers/uart/uart_elementary/prj.conf deleted file mode 100644 index 26c93d320a7..00000000000 --- a/tests/drivers/uart/uart_elementary/prj.conf +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_SERIAL=y -CONFIG_ZTEST=y -CONFIG_TEST_USERSPACE=y -CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_UART_USE_RUNTIME_CONFIGURE=y -CONFIG_UART_INTERRUPT_DRIVEN=y diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c deleted file mode 100644 index d7d85ee9542..00000000000 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @addtogroup t_driver_uart - * @{ - * @defgroup t_uart_elementary test_uart_elementary - * @} - */ - -#include -#include - -#if DT_NODE_EXISTS(DT_NODELABEL(dut)) -#define UART_NODE DT_NODELABEL(dut) -#else -#define UART_NODE DT_CHOSEN(zephyr_console) -#endif - -#if DT_NODE_EXISTS(DT_NODELABEL(dut_aux)) -#define UART_NODE_AUX DT_NODELABEL(dut_aux) -#else -#define UART_NODE_AUX DT_CHOSEN(zephyr_console) -#endif - -#define SLEEP_TIME_US 1000 -#define TEST_BUFFER_LEN 10 - -static const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE); - -const uint8_t test_pattern[TEST_BUFFER_LEN] = { 0x11, 0x12, 0x13, 0x14, 0x15, - 0x16, 0x17, 0x18, 0x19, 0x20 }; -static uint8_t test_buffer[TEST_BUFFER_LEN]; -static volatile uint8_t uart_error_counter; - -#if defined(CONFIG_DUAL_UART_TEST) -static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); -static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; -static volatile uint8_t aux_uart_error; -#endif - -/* - * ISR for UART TX action - */ -static void uart_tx_interrupt_service(const struct device *dev, int *tx_byte_offset) -{ - uint8_t bytes_sent = 0; - uint8_t *tx_data_pointer = (uint8_t *)(test_pattern + *tx_byte_offset); - - if (*tx_byte_offset < TEST_BUFFER_LEN) { - bytes_sent = uart_fifo_fill(dev, tx_data_pointer, 1); - *tx_byte_offset += bytes_sent; - } else { - *tx_byte_offset = 0; - uart_irq_tx_disable(dev); - } -} - -/* - * ISR for UART RX action - */ -static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive_buffer_pointer, - int *rx_byte_offset) -{ - int rx_data_length = 0; - int bytes_received = 0; - - do { - rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, - TEST_BUFFER_LEN); - bytes_received += rx_data_length; - } while (rx_data_length); - *rx_byte_offset += bytes_received; -} - -/* - * Callback function for MAIN UART interrupt based transmission test - */ -static void interrupt_driven_uart_callback_main_uart(const struct device *dev, void *user_data) -{ - int err; - static int tx_byte_offset; - static int rx_byte_offset; - - uart_irq_update(dev); - err = uart_err_check(dev); - if (err != 0) { - uart_error_counter++; - } - while (uart_irq_is_pending(dev)) { - if (uart_irq_rx_ready(dev)) { - uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset); - } - if (uart_irq_tx_ready(dev)) { - uart_tx_interrupt_service(dev, &tx_byte_offset); - } - } -} - -#if defined(CONFIG_DUAL_UART_TEST) -/* - * Callback function for AUX UART interrupt based transmission test - */ -static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, void *user_data) -{ - int err; - static int tx_byte_offset_aux; - static int rx_byte_offset_aux; - - uart_irq_update(dev); - err = uart_err_check(dev); -#if !defined(CONFIG_COVERAGE) - /* This assetion will fail with coverge enabled - * When in coverage mode it has no impact on test case execution - */ - zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); -#endif /* CONFIG_COVERAGE */ - while (uart_irq_is_pending(dev)) { - if (uart_irq_rx_ready(dev)) { - uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); - } - if (uart_irq_tx_ready(dev)) { - uart_tx_interrupt_service(dev, &tx_byte_offset_aux); - } - } -} -#endif /* CONFIG_DUAL_UART_TEST */ - -/* - * Test UART proper configuration call - */ -ZTEST(uart_elementary, test_uart_proper_configuration) -{ - Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); - - int err; - struct uart_config test_expected_uart_config; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; - - err = uart_configure(uart_dev, &test_uart_config); - zassert_equal(err, 0, "'uart_configure' api call - unexpected error: %d", err); - - err = uart_config_get(uart_dev, &test_expected_uart_config); - zassert_equal(err, 0, "'uart_config_get' api call - unexpected error raised : %d", err); - - zassert_equal(test_uart_config.baudrate, test_expected_uart_config.baudrate, - "Set and actual UART config baudrate mismatch: %d != %d", - test_uart_config.baudrate, test_expected_uart_config.baudrate); - - zassert_equal(test_uart_config.parity, test_expected_uart_config.parity, - "Set and actual UART config parity mismatch: %d != %d", - test_uart_config.parity, test_expected_uart_config.parity); - - zassert_equal(test_uart_config.stop_bits, test_expected_uart_config.stop_bits, - "Set and actual UART config stop_bits mismatch: %d != %d", - test_uart_config.stop_bits, test_expected_uart_config.stop_bits); - - zassert_equal(test_uart_config.data_bits, test_expected_uart_config.data_bits, - "Set and actual UART config data_bits mismatch: %d != %d", - test_uart_config.data_bits, test_expected_uart_config.data_bits); - - zassert_equal(test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl, - "Set and actual UART config flow_ctrl mismatch: %d != %d", - test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl); -} - -/* - * Test UART improper configuration call - */ -ZTEST(uart_elementary, test_uart_improper_configuration) -{ - Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); - - int err; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = 7, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; - - err = uart_configure(uart_dev, &test_uart_config); - zassert_not_equal( - err, 0, - "'uart_configure' with incorrect configuration havent't raised an error, err=%d", - err); -} - -#if !defined(CONFIG_DUAL_UART_TEST) -/* - * Test UART basic interrupt based transmission (with loopback) - */ -ZTEST(uart_elementary, test_uart_basic_transmission) -{ - int err; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_ODD, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; - - err = uart_configure(uart_dev, &test_uart_config); - zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); - - err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); - zassert_equal(err, 0, "Unexpected error when setting callback %d", err); - err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, - (void *)test_buffer); - zassert_equal(err, 0, "Unexpected error when setting user data for callback %d", err); - uart_irq_err_enable(uart_dev); - uart_irq_rx_enable(uart_dev); - uart_irq_tx_enable(uart_dev); - - /* wait for the tramission to finish (no polling is intentional) */ - k_sleep(K_USEC(100 * SLEEP_TIME_US)); - - uart_irq_tx_disable(uart_dev); - uart_irq_rx_disable(uart_dev); - uart_irq_err_disable(uart_dev); - for (int index = 0; index < TEST_BUFFER_LEN; index++) { - zassert_equal(test_buffer[index], test_pattern[index], - "Recieived data byte %d does not match pattern 0x%x != 0x%x", index, - test_buffer[index], test_pattern[index]); - } -} -#else -/* - * Test UART interrupt based transmission between two ports - */ -ZTEST(uart_elementary, test_uart_dual_port_transmission) -{ - int err; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; - -#if defined(CONFIG_SETUP_MISMATCH_TEST) - struct uart_config test_uart_config_aux = { .baudrate = 9600, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; -#endif - err = uart_configure(uart_dev, &test_uart_config); - zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); - -#if defined(CONFIG_SETUP_MISMATCH_TEST) - err = uart_configure(uart_dev_aux, &test_uart_config_aux); -#else - err = uart_configure(uart_dev_aux, &test_uart_config); -#endif - - zassert_equal(err, 0, "Unexpected error when configuring UART1: %d", err); - - err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); - zassert_equal(err, 0, "Unexpected error when setting callback for UART0 %d", err); - err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, - (void *)test_buffer); - zassert_equal(err, 0, "Unexpected error when setting user data for UART0 callback %d", err); - - err = uart_irq_callback_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart); - zassert_equal(err, 0, "Unexpected error when setting callback for UART1 %d", err); - err = uart_irq_callback_user_data_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart, - (void *)test_buffer_aux); - zassert_equal(err, 0, "Unexpected error when setting user data for UART1 callback %d", err); - - uart_irq_err_enable(uart_dev); - uart_irq_err_enable(uart_dev_aux); - - uart_irq_tx_enable(uart_dev); - uart_irq_tx_enable(uart_dev_aux); - - uart_irq_rx_enable(uart_dev); - uart_irq_rx_enable(uart_dev_aux); - - /* wait for the tramission to finish (no polling is intentional) */ - k_sleep(K_USEC(100 * SLEEP_TIME_US)); - - uart_irq_tx_disable(uart_dev); - uart_irq_tx_disable(uart_dev_aux); - uart_irq_rx_disable(uart_dev); - uart_irq_rx_disable(uart_dev_aux); - uart_irq_err_disable(uart_dev); - uart_irq_err_disable(uart_dev_aux); - -#if defined(CONFIG_SETUP_MISMATCH_TEST) - zassert_not_equal(uart_error_counter, 0); -#else - for (int index = 0; index < TEST_BUFFER_LEN; index++) { - zassert_equal(test_buffer[index], test_pattern[index], - "UART0 recieived data byte %d does not match pattern 0x%x != 0x%x", - index, test_buffer[index], test_pattern[index]); - zassert_equal(test_buffer_aux[index], test_pattern[index], - "UART1 recieived data byte %d does not match pattern 0x%x != 0x%x", - index, test_buffer_aux[index], test_pattern[index]); - } -#endif /* CONFIG_SETUP_MISMATCH_TEST */ -} -#endif /* CONFIG_DUAL_UART_TEST */ - -/* - * Test setup - */ -void *test_setup(void) -{ - zassert_true(device_is_ready(uart_dev), "UART0 device is not ready"); -#if defined(CONFIG_DUAL_UART_TEST) - zassert_true(device_is_ready(uart_dev_aux), "UART1 device is not ready"); -#endif - - return NULL; -} - -ZTEST_SUITE(uart_elementary, NULL, test_setup, NULL, NULL, NULL); diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml deleted file mode 100644 index 7c06967e7ad..00000000000 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ /dev/null @@ -1,35 +0,0 @@ -common: - tags: drivers uart - depends_on: gpio - harness: ztest - harness_config: - fixture: gpio_loopback -tests: - drivers.uart.uart_elementary: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - - nrf54l15pdk/nrf54l15/cpuapp - - nrf5340dk/nrf5340/cpuapp - drivers.uart.uart_elementary_dual_nrf54h: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - drivers.uart.uart_elementary_dual_setup_mismatch_nrf54h: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - - CONFIG_SETUP_MISMATCH_TEST=y - drivers.uart.uart_elementary_dual_nrf54l: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54l15pdk/nrf54l15/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y From 2cad7ad67aa16b023968463d77e26755955bc855 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 8 Apr 2024 11:40:05 +0300 Subject: [PATCH 1496/2300] [nrf fromtree] net: dns-sd: Do not use sockaddr struct directly The "struct sockaddr" should only be used in casts and never as a standalone variable because it might not have enough space allocated for all the protocol specific fields. So refactor the port_in_use() function to reflect that. Signed-off-by: Jukka Rissanen (cherry picked from commit cb7aae6f82c5cbc953da48c46baef51b54d9614b) --- subsys/net/lib/dns/dns_sd.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/subsys/net/lib/dns/dns_sd.c b/subsys/net/lib/dns/dns_sd.c index fa55a24271b..5d4dff10ef9 100644 --- a/subsys/net/lib/dns/dns_sd.c +++ b/subsys/net/lib/dns/dns_sd.c @@ -667,33 +667,40 @@ static bool port_in_use_sockaddr(uint16_t proto, uint16_t port, || net_context_port_in_use(proto, port, anyp); } -static bool port_in_use(uint16_t proto, uint16_t port, const struct in_addr *addr4, - const struct in6_addr *addr6) +static bool port_in_use(uint16_t proto, uint16_t port, + const struct in_addr *addr4, + const struct in6_addr *addr6) { - bool r; - struct sockaddr sa; + bool ret = false; if (addr4 != NULL) { - net_sin(&sa)->sin_family = AF_INET; - net_sin(&sa)->sin_addr = *addr4; + struct sockaddr_in sa = { 0 }; + + sa.sin_family = AF_INET; + sa.sin_addr = *addr4; - r = port_in_use_sockaddr(proto, port, &sa); - if (r) { - return true; + ret = port_in_use_sockaddr(proto, port, + (struct sockaddr *)&sa); + if (ret) { + goto out; } } if (addr6 != NULL) { - net_sin6(&sa)->sin6_family = AF_INET6; - net_sin6(&sa)->sin6_addr = *addr6; + struct sockaddr_in6 sa = { 0 }; + + sa.sin6_family = AF_INET6; + sa.sin6_addr = *addr6; - r = port_in_use_sockaddr(proto, port, &sa); - if (r) { - return true; + ret = port_in_use_sockaddr(proto, port, + (struct sockaddr *)&sa); + if (ret) { + goto out; } } - return false; +out: + return ret; } #else /* CONFIG_NET_TEST */ static inline bool port_in_use(uint16_t proto, uint16_t port, const struct in_addr *addr4, From 70729fcad3c56dd6f84e82c5f2b0b62e99b4301c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 5 Mar 2024 10:24:56 +0100 Subject: [PATCH 1497/2300] [nrf fromtree] dts: arm: nordic: keep NFCT disabled by default Enabling peripherals at SoC dts files should not be done, unless there are good reasons (e.g. always needed peripherals). NFCT node should either be enabled at board level, or, at application level. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 624c87af160367e7d0fb5f1adfbf1a689e4e99a6) --- 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 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index ed5a21b9935..13ee05226b7 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -177,7 +177,7 @@ compatible = "nordic,nrf-nfct"; reg = <0x40005000 0x1000>; interrupts = <5 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; gpiote: gpiote0: gpiote@40006000 { diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 5ac9cb2d2f8..f22cb36bc14 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -184,7 +184,7 @@ compatible = "nordic,nrf-nfct"; reg = <0x40005000 0x1000>; interrupts = <5 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; gpiote: gpiote0: gpiote@40006000 { diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 8efe49a3c91..c105da55c76 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -179,7 +179,7 @@ compatible = "nordic,nrf-nfct"; reg = <0x40005000 0x1000>; interrupts = <5 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; gpiote: gpiote0: gpiote@40006000 { diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index 94e764ec52c..c9f1ff2fae9 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -449,7 +449,7 @@ nfct: nfct@2d000 { compatible = "nordic,nrf-nfct"; reg = <0x2d000 0x1000>; interrupts = <45 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; mutex: mutex@30000 { From 3ae75850e43503aecbe481bfec7a51872e2aa946 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Tue, 9 Apr 2024 08:50:11 +0200 Subject: [PATCH 1498/2300] [nrf fromtree] Bluetooth: Audio: Add iso_chan to bt_bap_ep_info By exposing the underlying iso channel, the application can retrieve properties of the iso channel. This can be useful in case the application wants to use the connection handle for vendor specific HCI commands or to retrieve the particular parameters used for the given channel. Signed-off-by: Rubin Gerritsen (cherry picked from commit 75973852bfb0328957b2bf86cfbe67e1139ee2c0) --- include/zephyr/bluetooth/audio/bap.h | 3 +++ subsys/bluetooth/audio/bap_stream.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index f61accde211..a0719bd939d 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -397,6 +397,9 @@ struct bt_bap_ep_info { /** Capabilities type */ enum bt_audio_dir dir; + /** The isochronous channel associated with the endpoint. */ + struct bt_iso_chan *iso_chan; + /** @brief True if the stream associated with the endpoint is able to send data */ bool can_send; diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index 2f1cf71e8dd..dc776c6483d 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -107,8 +107,10 @@ int bt_bap_ep_get_info(const struct bt_bap_ep *ep, struct bt_bap_ep_info *info) if (ep->iso == NULL) { info->paired_ep = NULL; + info->iso_chan = NULL; } else { info->paired_ep = bt_bap_iso_get_paired_ep(ep); + info->iso_chan = &ep->iso->chan; } info->can_send = false; From d152f628d772f3cbb26b4cd02d5382fc292bb575 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 9 Apr 2024 14:22:44 +0530 Subject: [PATCH 1499/2300] [nrf fromtree] wifi: Remove unused defines When the ops for PS parameters we removed and aggregated into a single OP, the respective defines weren't cleaned up. Signed-off-by: Chaitanya Tata (cherry picked from commit 5997815352165800ae0c36b110bca8bca4fcb632) --- include/zephyr/net/wifi_mgmt.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index b2ac4e0d4f4..9123d03ab29 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -66,16 +66,12 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_IFACE_STATUS, /** Set power save status */ NET_REQUEST_WIFI_CMD_PS, - /** Set power save mode */ - NET_REQUEST_WIFI_CMD_PS_MODE, /** Setup or teardown TWT flow */ NET_REQUEST_WIFI_CMD_TWT, /** Get power save config */ NET_REQUEST_WIFI_CMD_PS_CONFIG, /** Set or get regulatory domain */ NET_REQUEST_WIFI_CMD_REG_DOMAIN, - /** Set power save timeout */ - NET_REQUEST_WIFI_CMD_PS_TIMEOUT, /** Set or get Mode of operation */ NET_REQUEST_WIFI_CMD_MODE, /** Set or get packet filter setting for current mode */ @@ -124,11 +120,6 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_IFACE_STATUS); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS); -#define NET_REQUEST_WIFI_PS_MODE \ - (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_PS_MODE) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_MODE); - #define NET_REQUEST_WIFI_TWT \ (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_TWT) @@ -143,11 +134,6 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_CONFIG); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_REG_DOMAIN); -#define NET_REQUEST_WIFI_PS_TIMEOUT \ - (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_PS_TIMEOUT) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_TIMEOUT); - #define NET_REQUEST_WIFI_MODE \ (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_MODE) From d4ee5b3ce2ae353412430857cba05dfe846049cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 12 Apr 2024 10:35:42 +0200 Subject: [PATCH 1500/2300] [nrf fromtree] tests: drivers: clock_control: Add nRF54L15 to platform allow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nRF54L15 to platform_allow in the sample.yaml: - clock_control_api, - nrf_clock_calibration, - nrf_lf_clock_start, - onoff. Signed-off-by: Sebastian Głąb (cherry picked from commit 5600ae335b104f6ba088693946ee3e60b63161b9) --- .../clock_control/clock_control_api/testcase.yaml | 2 ++ .../clock_control/nrf_clock_calibration/testcase.yaml | 1 + .../clock_control/nrf_lf_clock_start/testcase.yaml | 9 +++++++++ tests/drivers/clock_control/onoff/testcase.yaml | 1 + 4 files changed, 13 insertions(+) diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index be789c8382a..42ca3013a0f 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -7,6 +7,7 @@ tests: - nrf51dk_nrf51422 - nrf52dk_nrf52832 - nrf52840dk_nrf52840 + - nrf54l15pdk_nrf54l15_cpuapp - nrf9160dk_nrf9160 integration_platforms: - nrf51dk_nrf51422 @@ -18,6 +19,7 @@ tests: - nrf51dk_nrf51422 - nrf52dk_nrf52832 - nrf52840dk_nrf52840 + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_args: CONF_FILE="nrf_lfclk_rc.conf" diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index 092471d30e4..8b28612378d 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -7,5 +7,6 @@ tests: - nrf51dk_nrf51422 - nrf52dk_nrf52832 - nrf52840dk_nrf52840 + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index f4940d79896..e24dcb83786 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -13,6 +13,7 @@ tests: - nrf9160dk_nrf9160 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet + - nrf54l15pdk_nrf54l15_cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_STABILITY=y - CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y @@ -27,6 +28,7 @@ tests: - nrf9160dk_nrf9160 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet + - nrf54l15pdk_nrf54l15_cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY=y - CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y @@ -41,6 +43,7 @@ tests: - nrf9160dk_nrf9160 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -54,6 +57,7 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -67,6 +71,7 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -80,6 +85,7 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -93,6 +99,7 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -106,6 +113,7 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -119,6 +127,7 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet + - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index a6e03d9a0ec..cf6d4b3f8cd 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -7,6 +7,7 @@ tests: - nrf51dk_nrf51422 - nrf52dk_nrf52832 - nrf52840dk_nrf52840 + - nrf54l15pdk_nrf54l15_cpuapp - nrf9160dk_nrf9160 integration_platforms: - nrf51dk_nrf51422 From 512023e7f16a413144b20c76dffd3b492c9505e6 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Sun, 10 Mar 2024 23:33:41 +0530 Subject: [PATCH 1501/2300] [nrf fromtree] net: wifi: shell: Use getopt API for connect options Use getopt API to process the arguments passed with connect command. Signed-off-by: Ravi Dondaputi (cherry picked from commit 8256d02d3a9625c03e1d584cf54b1f0cc1ae164b) --- subsys/net/l2/wifi/wifi_shell.c | 204 ++++++++++++++------------------ 1 file changed, 90 insertions(+), 114 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 316ea2f950e..ef12f8bd2a3 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -442,73 +442,69 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, } } -static int __wifi_args_to_params(size_t argc, char *argv[], +static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv[], struct wifi_connect_req_params *params, enum wifi_iface_mode iface_mode) { char *endptr; int idx = 1; - const struct shell *sh = context.sh; + struct getopt_state *state; + int opt; + bool secure_connection = false; + static struct option long_options[] = {{"ssid", required_argument, 0, 's'}, + {"passphrase", required_argument, 0, 'p'}, + {"key-mgmt", required_argument, 0, 'k'}, + {"ieee-80211w", required_argument, 0, 'w'}, + {"bssid", required_argument, 0, 'm'}, + {"band", required_argument, 0, 'b'}, + {"channel", required_argument, 0, 'c'}, + {"help", no_argument, 0, 'h'}, + {0, 0, 0, 0}}; + int opt_index = 0; + uint8_t band; + const uint8_t all_bands[] = { + WIFI_FREQ_BAND_2_4_GHZ, + WIFI_FREQ_BAND_5_GHZ, + WIFI_FREQ_BAND_6_GHZ + }; + bool found = false; + char bands_str[MAX_BANDS_STR_LEN] = {0}; + size_t offset = 0; /* Defaults */ params->band = WIFI_FREQ_BAND_UNKNOWN; params->channel = WIFI_CHANNEL_ANY; params->security = WIFI_SECURITY_TYPE_NONE; + params->mfp = WIFI_MFP_OPTIONAL; - /* SSID */ - params->ssid = argv[0]; - params->ssid_length = strlen(params->ssid); - if (params->ssid_length > WIFI_SSID_MAX_LEN) { - PR_WARNING("SSID too long (max %d characters)\n", - WIFI_SSID_MAX_LEN); - return -EINVAL; - } - - /* Channel (optional: STA, mandatory: AP) */ - if ((idx < argc) && (strlen(argv[idx]) <= 3)) { - uint8_t band; - long channel = strtol(argv[idx], &endptr, 10); - const uint8_t all_bands[] = {WIFI_FREQ_BAND_2_4_GHZ, - WIFI_FREQ_BAND_5_GHZ, - WIFI_FREQ_BAND_6_GHZ}; - bool found = false; - char bands_str[MAX_BANDS_STR_LEN] = {0}; - size_t offset = 0; - - if (*endptr != '\0') { - PR_ERROR("Failed to parse channel: %s: endp: %s, err: %s\n", - argv[idx], - endptr, - strerror(errno)); - return -EINVAL; - } - - if (iface_mode == WIFI_MODE_INFRA) { - if (channel < 0) { - /* Negative channel means band */ - switch (-channel) { - case 2: - params->band = WIFI_FREQ_BAND_2_4_GHZ; - break; - case 5: - params->band = WIFI_FREQ_BAND_5_GHZ; - break; - case 6: - params->band = WIFI_FREQ_BAND_6_GHZ; - break; - default: - PR_ERROR("Invalid band: %ld\n", channel); - return -EINVAL; - } - } - } else { - if (channel < 0) { - PR_ERROR("Invalid channel: %ld\n", channel); + while ((opt = getopt_long(argc, argv, "s:p:k:w:b:c:h", long_options, &opt_index)) != -1) { + state = getopt_state_get(); + switch (opt) { + case 's': + params->ssid = optarg; + params->ssid_length = strlen(params->ssid); + if (params->ssid_length > WIFI_SSID_MAX_LEN) { + PR_WARNING("SSID too long (max %d characters)\n", + WIFI_SSID_MAX_LEN); return -EINVAL; } - } - - if (channel > 0) { + break; + case 'k': + params->security = atoi(optarg); + if (params->security) { + secure_connection = true; + } + break; + case 'p': + if (secure_connection) { + params->psk = optarg; + params->psk_length = strlen(params->psk); + } else { + PR_WARNING("Passphrase provided without security configuration\n"); + } + break; + case 'c': + long channel = strtol(optarg, &endptr, 10); for (band = 0; band < ARRAY_SIZE(all_bands); band++) { offset += snprintf(bands_str + offset, sizeof(bands_str) - offset, @@ -537,63 +533,43 @@ static int __wifi_args_to_params(size_t argc, char *argv[], } params->channel = channel; - } - idx++; - } - - if ((idx == 1) && (iface_mode == WIFI_MODE_AP)) { - PR_ERROR("Invalid channel: %s\n", argv[idx]); - return -EINVAL; - } - - /* PSK (optional) */ - if (idx < argc) { - params->psk = argv[idx]; - params->psk_length = strlen(argv[idx]); - /* Defaults */ - params->security = WIFI_SECURITY_TYPE_PSK; - params->mfp = WIFI_MFP_OPTIONAL; - idx++; - - /* Security type (optional) */ - if (idx < argc) { - unsigned int security = strtol(argv[idx], &endptr, 10); - - if (security <= WIFI_SECURITY_TYPE_MAX) { - params->security = security; - } - idx++; - - /* MFP (optional) */ - if (idx < argc) { - unsigned int mfp = strtol(argv[idx], &endptr, 10); - - if (security == WIFI_SECURITY_TYPE_NONE || - security == WIFI_SECURITY_TYPE_WPA_PSK) { - PR_ERROR("MFP not supported for security type %s\n", - wifi_security_txt(security)); + break; + case 'b': + if (iface_mode == WIFI_MODE_INFRA) { + switch (atoi(optarg)) { + case 2: + params->band = WIFI_FREQ_BAND_2_4_GHZ; + break; + case 5: + params->band = WIFI_FREQ_BAND_5_GHZ; + break; + case 6: + params->band = WIFI_FREQ_BAND_6_GHZ; + break; + default: + PR_ERROR("Invalid band: %d\n", atoi(optarg)); return -EINVAL; } - - if (mfp <= WIFI_MFP_REQUIRED) { - params->mfp = mfp; - } - idx++; } - } - - if (params->psk_length < WIFI_PSK_MIN_LEN || - (params->security != WIFI_SECURITY_TYPE_SAE && - params->psk_length > WIFI_PSK_MAX_LEN) || - (params->security == WIFI_SECURITY_TYPE_SAE && - params->psk_length > WIFI_SAE_PSWD_MAX_LEN)) { - PR_ERROR("Invalid PSK length (%d) for security type %s\n", - params->psk_length, - wifi_security_txt(params->security)); + break; + case 'w': + if (params->security == WIFI_SECURITY_TYPE_NONE || + params->security == WIFI_SECURITY_TYPE_WPA_PSK) { + PR_ERROR("MFP not supported for security type %s\n", + wifi_security_txt(params->security)); + return -EINVAL; + } + params->mfp = atoi(optarg); + break; + case 'h': + shell_help(sh); + break; + default: + PR_ERROR("Invalid option %c\n", opt); + shell_help(sh); return -EINVAL; } } - return 0; } @@ -604,7 +580,7 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, struct wifi_connect_req_params cnx_params = { 0 }; context.sh = sh; - if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_INFRA)) { + if (__wifi_args_to_params(sh, argc, argv, &cnx_params, WIFI_MODE_INFRA)) { shell_help(sh); return -ENOEXEC; } @@ -1259,7 +1235,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, int ret; context.sh = sh; - if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { + if (__wifi_args_to_params(sh, argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); return -ENOEXEC; } @@ -1875,16 +1851,16 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(ap, &wifi_cmd_ap, "Access Point mode commands.\n", NULL), SHELL_CMD_ARG(connect, NULL, "Connect to a Wi-Fi AP\n" - "\"\"\n" - "[channel number/band: > 0:Channel, 0:any channel,\n" - "< 0:band (-2:2.4GHz, -5:5GHz, -6:6GHz]\n" - "[PSK: valid only for secure SSIDs]\n" - "[Security type: valid only for secure SSIDs]\n" + "<-s --ssid \"\">: SSID.\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" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" - "[MFP (optional: needs security type to be specified)]\n" + "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_connect, - 2, 4), + 2, 5), SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP.\n", cmd_wifi_disconnect, 1, 0), From edb5148d0ea4823860920c652511df1c78909200 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Mon, 11 Mar 2024 13:00:26 +0530 Subject: [PATCH 1502/2300] [nrf fromtree] net: wifi: shell: Support BSSID configuration Add support for BSSID configuration in connect call. Signed-off-by: Ravi Dondaputi (cherry picked from commit 73ed81cccee9840626c3b93fa141c1442df452c1) --- include/zephyr/net/wifi_mgmt.h | 2 ++ subsys/net/l2/wifi/wifi_shell.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 9123d03ab29..c1fa8145dbf 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -346,6 +346,8 @@ struct wifi_connect_req_params { enum wifi_security_type security; /** MFP options */ enum wifi_mfp_options mfp; + /** BSSID */ + uint8_t bssid[WIFI_MAC_ADDR_LEN]; /** Connect timeout in seconds, SYS_FOREVER_MS for no timeout */ int timeout; }; diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index ef12f8bd2a3..9dbd9ee4736 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -477,7 +477,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv params->security = WIFI_SECURITY_TYPE_NONE; params->mfp = WIFI_MFP_OPTIONAL; - while ((opt = getopt_long(argc, argv, "s:p:k:w:b:c:h", long_options, &opt_index)) != -1) { + while ((opt = getopt_long(argc, argv, "s:p:k:w:b:c:m:h", long_options, &opt_index)) != -1) { state = getopt_state_get(); switch (opt) { case 's': @@ -561,6 +561,12 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv } params->mfp = atoi(optarg); break; + case 'm': + sscanf(optarg, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", + ¶ms->bssid[0], ¶ms->bssid[1], + ¶ms->bssid[2], ¶ms->bssid[3], + ¶ms->bssid[4], ¶ms->bssid[5]); + break; case 'h': shell_help(sh); break; @@ -570,6 +576,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv return -EINVAL; } } + return 0; } @@ -1858,9 +1865,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" - ": 0:Disable, 1:Optional, 2:Required.\n", + ": 0:Disable, 1:Optional, 2:Required.\n" + "[-m, --bssid]: MAC address of the AP (BSSID).\n" + "[-h, --help]: Print out the help for the connect command.\n", cmd_wifi_connect, - 2, 5), + 2, 7), SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP.\n", cmd_wifi_disconnect, 1, 0), From 55541273196045fc112c4b97e46a914d0e915291 Mon Sep 17 00:00:00 2001 From: Brad Kemp Date: Tue, 2 Apr 2024 13:26:20 -0400 Subject: [PATCH 1503/2300] [nrf fromtree] net: wifi: shell: update wifi ap enable to use get opt parsing The commit 8256d02d3a9625c03e1d584cf54b1f0cc1ae164b introduced getopt parsing for the wifi connect command This needs to be updated for the wifi ap enable since ap enable also uses the same parsing as connect. The use of getopt removes the parameter ordering restrictions Signed-off-by: Brad Kemp (cherry picked from commit 3e2c067010cd26220d66d3237d891f6e4a3ed05e) --- subsys/net/l2/wifi/wifi_shell.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 9dbd9ee4736..75b166f457e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -496,12 +496,8 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv } break; case 'p': - if (secure_connection) { - params->psk = optarg; - params->psk_length = strlen(params->psk); - } else { - PR_WARNING("Passphrase provided without security configuration\n"); - } + params->psk = optarg; + params->psk_length = strlen(params->psk); break; case 'c': long channel = strtol(optarg, &endptr, 10); @@ -568,7 +564,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv ¶ms->bssid[4], ¶ms->bssid[5]); break; case 'h': - shell_help(sh); + return -ENOEXEC; break; default: PR_ERROR("Invalid option %c\n", opt); @@ -576,7 +572,9 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv return -EINVAL; } } - + if (params->psk && !secure_connection) { + PR_WARNING("Passphrase provided without security configuration\n"); + } return 0; } @@ -1242,7 +1240,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, int ret; context.sh = sh; - if (__wifi_args_to_params(sh, argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { + if (__wifi_args_to_params(sh, argc, &argv[0], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); return -ENOEXEC; } @@ -1805,15 +1803,18 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, cmd_wifi_ap_disable, 1, 0), SHELL_CMD_ARG(enable, NULL, - "\"\"\n" - "\n" - "[PSK: valid only for secure SSIDs]\n" - "[Security type: valid only for secure SSIDs]\n" + "-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, 6:WEP, 7: WPA-PSK\n" - "[MFP (optional: needs security type to be specified)]\n" - ": 0:Disable, 1:Optional, 2:Required.\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, - 3, 3), + 2, 13), SHELL_CMD_ARG(stations, NULL, "List stations connected to the AP", cmd_wifi_ap_stations, From 57e78845ad43eac40c05550507435c7123517174 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Mon, 15 Apr 2024 13:36:31 +0530 Subject: [PATCH 1504/2300] [nrf fromlist] net: wifi: shell: Correct help text for `connect` command Since `NONE` is a valid option for key management in `connect` command, we should remove the part in help text which says: "valid only for secure SSIDs". Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71319 Signed-off-by: Ravi Dondaputi --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 75b166f457e..b22771596bf 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1863,7 +1863,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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" + "[-k, --key-mgmt]: Key Management type\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n" From 700870d10917960e4799926b864189d755d95f83 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Mon, 15 Apr 2024 17:45:02 +0530 Subject: [PATCH 1505/2300] [nrf fromlist] net: wifi: shell: Remove redundant break Having a `break` statement after `return` is redundant and needs to be removed. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71319 Signed-off-by: Ravi Dondaputi --- 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 b22771596bf..8b5c8186222 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -565,7 +565,6 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv break; case 'h': return -ENOEXEC; - break; default: PR_ERROR("Invalid option %c\n", opt); shell_help(sh); From 1155e53bb25ba554bc7507dcc5c9ad45a494d804 Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Mon, 15 Apr 2024 11:47:43 +0200 Subject: [PATCH 1506/2300] [nrf fromlist] ipc_service: backends: icbmsg: Fix strnlen warnings This fixes warnings when building with icbmsg backend for IPC service by defining _POSIX_C_SOURCE 200809L in source file. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71492 Signed-off-by: Kamil Gawor --- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index cb4d91d7e8a..c2e34718419 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -75,6 +75,9 @@ * data messages, it calls bound endpoint and it is ready to send data. */ +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L /* For strnlen() */ + #include #include From 2f52b92ebdd60f68a8ee1be02e134b3ff4bc8cb6 Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Mon, 15 Apr 2024 11:52:36 +0200 Subject: [PATCH 1507/2300] [nrf fromlist] boards: nordic: nrf54h20dk: Change IPC default backend Change IPC backend between Application and Radio core to icbmsg which is more future proof than legacy icmsg_me backend. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71492 Signed-off-by: Kamil Gawor --- .../arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 1 + boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts | 3 ++- boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi index 9c3d971b9bc..539e80d149a 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -21,6 +21,7 @@ }; cpuapp_cpurad_ipc: ipc-2-3 { + compatible = "zephyr,ipc-icbmsg"; status = "disabled"; mboxes = <&cpuapp_bellboard 18>, <&cpurad_bellboard 12>; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 7e5127f8b16..4eff8c7741d 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -116,10 +116,11 @@ }; &cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-initiator"; mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpurad_ipc_shm>; rx-region = <&cpurad_cpuapp_ipc_shm>; + tx-blocks = <32>; + rx-blocks = <32>; }; &cpuapp_cpuppr_ipc { diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 30fdf7286d5..9e3dacbeb32 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -50,10 +50,11 @@ }; &cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-follower"; mbox-names = "tx", "rx"; tx-region = <&cpurad_cpuapp_ipc_shm>; rx-region = <&cpuapp_cpurad_ipc_shm>; + tx-blocks = <32>; + rx-blocks = <32>; }; &cpurad_dma_region { From dd3931ad85d643528bec4494898abc6b6cbe21a0 Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Mon, 15 Apr 2024 14:05:47 +0200 Subject: [PATCH 1508/2300] [nrf fromlist] boards: nordic: nrf54h20dk: Add configuration for BLE Add default configuration related to BLE protocol, for Application and Radio core on nRF54h20 platform. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71501 Signed-off-by: Kamil Gawor --- .../nrf54h20dk_nrf54h20_cpuapp.dts | 13 ++++++++- .../nrf54h20dk_nrf54h20_cpurad.dts | 13 ++++++++- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 27 ------------------- 3 files changed, 24 insertions(+), 29 deletions(-) delete mode 100644 samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 4eff8c7741d..4b04ff8dcd4 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -23,6 +23,7 @@ zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; zephyr,entropy = &prng; + zephyr,bt-hci-ipc = &ipc0; }; aliases { @@ -98,24 +99,34 @@ status = "okay"; }; +&cpuapp_cpurad_ram0x_region { + status = "okay"; +}; + &shared_ram3x_region { status = "okay"; }; &cpuapp_bellboard { + status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ nordic,interrupt-mapping = <0x00042001 0>; }; +&cpurad_bellboard { + status = "okay"; +}; + &cpusec_cpuapp_ipc { mbox-names = "tx", "rx"; tx-region = <&cpuapp_cpusec_ipc_shm>; rx-region = <&cpusec_cpuapp_ipc_shm>; }; -&cpuapp_cpurad_ipc { +ipc0: &cpuapp_cpurad_ipc { + status = "okay"; mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpurad_ipc_shm>; rx-region = <&cpurad_cpuapp_ipc_shm>; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 9e3dacbeb32..36ac2aef20a 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -24,6 +24,7 @@ zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; zephyr,entropy = &prng; + zephyr,bt-hci-ipc = &ipc0; }; prng: prng { @@ -36,20 +37,30 @@ status = "okay"; }; +&cpuapp_cpurad_ram0x_region { + status = "okay"; +}; + &cpurad_bellboard { + status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ nordic,interrupt-mapping = <0x00001001 0>; }; +&cpuapp_bellboard { + status = "okay"; +}; + &cpusec_cpurad_ipc { mbox-names = "tx", "rx"; tx-region = <&cpurad_cpusec_ipc_shm>; rx-region = <&cpusec_cpurad_ipc_shm>; }; -&cpuapp_cpurad_ipc { +ipc0: &cpuapp_cpurad_ipc { + status = "okay"; mbox-names = "tx", "rx"; tx-region = <&cpurad_cpuapp_ipc_shm>; rx-region = <&cpuapp_cpurad_ipc_shm>; diff --git a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index 02db7c39272..00000000000 --- a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,bt-hci-ipc = &ipc0; - }; -}; - -ipc0: &cpuapp_cpurad_ipc { - status = "okay"; -}; - -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - -&cpurad_bellboard { - status = "okay"; -}; - -&cpuapp_bellboard { - status = "okay"; -}; From 912ad48d94eabea6bec511a334c59e453f90c16d Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Wed, 17 Apr 2024 14:05:02 +0200 Subject: [PATCH 1509/2300] [nrf fromlist] boards: nordic: nrf54l15pdk: enable HWFC Define RTS and CTS pins. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71605 Signed-off-by: Piotr Kosycarz --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 22 +++++++++++++++---- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 02b02bc8171..96c53f948fc 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -7,14 +7,21 @@ uart20_default: uart20_default { group1 { psels = , - ; + ; + }; + group2 { + psels = , + ; + bias-pull-up; }; }; uart20_sleep: uart20_sleep { group1 { psels = , - ; + , + , + ; low-power-enable; }; }; @@ -22,14 +29,21 @@ uart30_default: uart30_default { group1 { psels = , - ; + ; + }; + group2 { + psels = , + ; + bias-pull-up; }; }; uart30_sleep: uart30_sleep { group1 { psels = , - ; + , + , + ; low-power-enable; }; }; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index c801ddc8dc5..0b9e76ff083 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -96,6 +96,7 @@ pinctrl-0 = <&uart20_default>; pinctrl-1 = <&uart20_sleep>; pinctrl-names = "default", "sleep"; + hw-flow-control; }; &uart30 { From 5c484901b955fb78e97b9f76cb51fd38433fd4f2 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Wed, 20 Mar 2024 22:39:40 +0100 Subject: [PATCH 1510/2300] [nrf noup] modules: mbedtls: add PSA configurations fixup! [nrf noup] modules: mbedtls: add PSA configurations Deprecate PSA_WANT_KEY_TYPE_ECC_KEY_PAIR since it was removed from the Oberon PSA core. Signed-off-by: Georgios Vasilakis --- modules/mbedtls/Kconfig.psa | 65 ++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa index 9a0be3c4063..27e50381779 100644 --- a/modules/mbedtls/Kconfig.psa +++ b/modules/mbedtls/Kconfig.psa @@ -34,24 +34,27 @@ menu "PSA key type support" config PSA_HAS_KEY_SUPPORT bool default y - depends on PSA_WANT_KEY_TYPE_DERIVE || \ - PSA_WANT_KEY_TYPE_HMAC || \ - PSA_WANT_KEY_TYPE_RAW_DATA || \ - PSA_WANT_KEY_TYPE_PASSWORD || \ - PSA_WANT_KEY_TYPE_PASSWORD_HASH || \ - PSA_WANT_KEY_TYPE_PEPPER || \ - PSA_WANT_KEY_TYPE_AES || \ - PSA_WANT_KEY_TYPE_ARIA || \ - PSA_WANT_KEY_TYPE_DES || \ - PSA_WANT_KEY_TYPE_CAMELLIA || \ - PSA_WANT_KEY_TYPE_SM4 || \ - PSA_WANT_KEY_TYPE_ARC4 || \ - PSA_WANT_KEY_TYPE_CHACHA20 || \ - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR || \ - PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY || \ - PSA_WANT_KEY_TYPE_RSA_KEY_PAIR || \ - PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || \ - PSA_WANT_KEY_TYPE_DH_KEY_PAIR || \ + depends on PSA_WANT_KEY_TYPE_DERIVE || \ + PSA_WANT_KEY_TYPE_HMAC || \ + PSA_WANT_KEY_TYPE_RAW_DATA || \ + PSA_WANT_KEY_TYPE_PASSWORD || \ + PSA_WANT_KEY_TYPE_PASSWORD_HASH || \ + PSA_WANT_KEY_TYPE_PEPPER || \ + PSA_WANT_KEY_TYPE_AES || \ + PSA_WANT_KEY_TYPE_ARIA || \ + PSA_WANT_KEY_TYPE_DES || \ + PSA_WANT_KEY_TYPE_CAMELLIA || \ + PSA_WANT_KEY_TYPE_SM4 || \ + PSA_WANT_KEY_TYPE_ARC4 || \ + PSA_WANT_KEY_TYPE_CHACHA20 || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE || \ + PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR || \ + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_DH_KEY_PAIR || \ PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY config PSA_WANT_KEY_TYPE_DERIVE @@ -122,12 +125,23 @@ config PSA_WANT_KEY_TYPE_CHACHA20 help Key for the ChaCha20 stream cipher or the ChaCha20-Poly1305 AEAD algorithm. + config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR bool "PSA ECC key pair support" select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT + select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT + select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE + select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE + select DEPRECATED help + DEPRECATED: This configuration will be removed in a future release, + please use the individual options for import, export, generate, + derive and public key instead. + Elliptic curve key pair: both the private and public key. + config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY bool "PSA ECC public key support" help @@ -136,37 +150,36 @@ config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT bool "PSA ECC import key pair support" - default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY help Elliptic curve key pair: import for both the private and public key. config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT bool "PSA ECC export key pair support" - default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY help Elliptic curve key pair: export for both the private and public key. config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE bool "PSA ECC generate key pair support" - default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY help Elliptic curve key pair: generate for both the private and public key. +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE + bool "PSA ECC derive key pair support" + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + help + Elliptic curve key pair: key derivation support. + config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC bool default y depends on PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT || \ PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE || \ PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE -config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE - bool - default y - depends on PSA_WANT_KEY_TYPE_ECC_KEY_PAIR - config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR bool "PSA RSA key pair type support" select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY From c90430fac16392db6d5a724c1c6faf1248f3a093 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Thu, 4 Apr 2024 13:44:52 +0200 Subject: [PATCH 1511/2300] [nrf fromtree] drivers: Extend coverage for i2s driver Add more tests cases in the i2s driver error management area Signed-off-by: Bartosz Miller (cherry picked from commit 32dd4ec4e89b1ebf43ef108adf8090ccf461703c) --- tests/drivers/i2s/i2s_api/src/main.c | 1 + .../drivers/i2s/i2s_api/src/test_i2s_errors.c | 153 ++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 tests/drivers/i2s/i2s_api/src/test_i2s_errors.c diff --git a/tests/drivers/i2s/i2s_api/src/main.c b/tests/drivers/i2s/i2s_api/src/main.c index 82a4dba5f9c..febb721932d 100644 --- a/tests/drivers/i2s/i2s_api/src/main.c +++ b/tests/drivers/i2s/i2s_api/src/main.c @@ -78,3 +78,4 @@ ZTEST_SUITE(i2s_loopback, NULL, setup, before, NULL, NULL); ZTEST_SUITE(i2s_states, NULL, setup, before, NULL, NULL); ZTEST_SUITE(i2s_dir_both_states, NULL, setup, before_dir_both, NULL, NULL); ZTEST_SUITE(i2s_dir_both_loopback, NULL, setup, before_dir_both, NULL, NULL); +ZTEST_SUITE(i2s_errors, NULL, setup, before, NULL, NULL); diff --git a/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c b/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c new file mode 100644 index 00000000000..477292d84c2 --- /dev/null +++ b/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include "i2s_api_test.h" + +#define INVALID_TRIGGER_SETTING 7 + +ZTEST_USER(i2s_errors, test_i2s_improper_configuration) +{ + int err; + struct i2s_config invalid_config = { .word_size = 16U, + .channels = 2U, + .format = I2S_FMT_DATA_FORMAT_I2S, + .frame_clk_freq = FRAME_CLK_FREQ, + .block_size = BLOCK_SIZE, + .timeout = TIMEOUT, + .options = I2S_OPT_FRAME_CLK_MASTER | + I2S_OPT_BIT_CLK_MASTER, + .mem_slab = &tx_mem_slab }; + + + invalid_config.format = + I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED | I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED; + + err = i2s_configure(dev_i2s, I2S_DIR_TX, &invalid_config); + zassert_not_equal( + err, 0, + "I2S configuration did not detect improper data format (I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED | I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED)"); + + invalid_config.format = I2S_FMT_DATA_FORMAT_I2S | I2S_FMT_DATA_ORDER_LSB; + + err = i2s_configure(dev_i2s, I2S_DIR_TX, &invalid_config); + zassert_not_equal( + err, 0, + "I2S configuration did not detect improper stream format (I2S_FMT_DATA_ORDER_LSB)"); + + invalid_config.format = I2S_FMT_DATA_FORMAT_I2S; + invalid_config.channels = 3U; + err = i2s_configure(dev_i2s, I2S_DIR_TX, &invalid_config); + zassert_not_equal(err, 0, + "I2S configuration did not detect improper channels configuration (3)"); +} + +ZTEST_USER(i2s_errors, test_i2s_config_attempt_in_wrong_state) +{ + int err; + int config_err; + char tx_data[BLOCK_SIZE] = {0}; + struct i2s_config inactive_config = { .word_size = 16U, + .channels = 2U, + .format = I2S_FMT_DATA_FORMAT_I2S, + .frame_clk_freq = FRAME_CLK_FREQ, + .block_size = BLOCK_SIZE, + .timeout = TIMEOUT, + .options = I2S_OPT_FRAME_CLK_MASTER | + I2S_OPT_BIT_CLK_MASTER, + .mem_slab = &tx_mem_slab }; + + err = i2s_configure(dev_i2s, I2S_DIR_TX, &inactive_config); + zassert_equal(err, 0, "I2S interface configuration failed, err=%d", err); + + err = i2s_buf_write(dev_i2s, tx_data, BLOCK_SIZE); + zassert_equal(err, 0, "I2S buffer write unexpected error: %d", err); + + err = i2s_trigger(dev_i2s, I2S_DIR_TX, I2S_TRIGGER_START); + zassert_equal(err, 0, "I2S_TRIGGER_START unexpected error: %d", err); + + config_err = i2s_configure(dev_i2s, I2S_DIR_TX, &inactive_config); + + err = i2s_trigger(dev_i2s, I2S_DIR_TX, I2S_TRIGGER_STOP); + zassert_equal(err, 0, "I2S_TRIGGER_STOP unexpected error: %d", err); + + zassert_not_equal( + config_err, 0, + "I2S configuration should not be possible in states other than I2S_STATE_READY"); +} + +ZTEST_USER(i2s_errors, test_i2s_incorrect_trigger) +{ + int err; + char tx_data[BLOCK_SIZE] = {0}; + struct i2s_config test_config = { .word_size = 16U, + .channels = 2U, + .format = I2S_FMT_DATA_FORMAT_I2S, + .frame_clk_freq = FRAME_CLK_FREQ, + .block_size = BLOCK_SIZE, + .timeout = TIMEOUT, + .options = + I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_MASTER, + .mem_slab = &tx_mem_slab }; + + err = i2s_configure(dev_i2s, I2S_DIR_TX, &test_config); + zassert_equal(err, 0, "CFG err=%d", err); + + err = i2s_buf_write(dev_i2s, tx_data, BLOCK_SIZE); + zassert_equal(err, 0, "I2S buffer write unexpected error: %d", err); + + err = i2s_trigger(dev_i2s, I2S_DIR_TX, INVALID_TRIGGER_SETTING); + zassert_equal(err, -EINVAL, "I2S invalid trigger setting not detected: err=%d", err); +} + +ZTEST_USER(i2s_errors, test_i2s_unconfigured_access) +{ + int err; + char tx_data[BLOCK_SIZE] = {0}; + struct i2s_config inactive_config = { .word_size = 16U, + .channels = 2U, + .format = I2S_FMT_DATA_FORMAT_I2S, + .frame_clk_freq = 0, + .block_size = BLOCK_SIZE, + .timeout = TIMEOUT, + .options = I2S_OPT_FRAME_CLK_MASTER | + I2S_OPT_BIT_CLK_MASTER, + .mem_slab = &tx_mem_slab }; + + err = i2s_configure(dev_i2s, I2S_DIR_TX, &inactive_config); + zassert_equal(err, 0, "I2S interface NOT_READY state transition failed. err=%d", err); + + err = i2s_buf_write(dev_i2s, tx_data, BLOCK_SIZE); + zassert_equal( + err, -EIO, + "I2S attempting unconfigured interface access did not raise I/O error, err=%d", + err); +} + +ZTEST_USER(i2s_errors, test_i2s_improper_block_size_write) +{ + int err; + char tx_data[BLOCK_SIZE] = {0}; + struct i2s_config test_config = { .word_size = 16U, + .channels = 2U, + .format = I2S_FMT_DATA_FORMAT_I2S, + .frame_clk_freq = FRAME_CLK_FREQ, + .block_size = BLOCK_SIZE, + .timeout = TIMEOUT, + .options = + I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_MASTER, + .mem_slab = &tx_mem_slab }; + + err = i2s_configure(dev_i2s, I2S_DIR_TX, &test_config); + zassert_equal(err, 0, "Unexpected error when configuring I2S interface: %d", err); + + err = i2s_buf_write(dev_i2s, tx_data, sizeof(uint16_t) + BLOCK_SIZE); + zassert_not_equal( + err, 0, + "I2S attempting write with incorrect block size did not raise error, err=%d", err); +} From ddca5117acdf51a52bfa09649ac4c9c3fb8a1e43 Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Tue, 16 Apr 2024 09:44:36 +0200 Subject: [PATCH 1512/2300] [nrf fromlist] twister: pytest: hardware_adapter: adapt to nrfutil. add --dev-id to flashing command also when nrfutil runner is used. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71532 Signed-off-by: Bartlomiej Buczek --- .../src/twister_harness/device/hardware_adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py index 4a6967b6372..5a5a845c3a1 100644 --- a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py +++ b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py @@ -70,7 +70,7 @@ def _prepare_runner_args(self) -> tuple[list[str], list[str]]: if runner == 'pyocd': extra_args.append('--board-id') extra_args.append(board_id) - elif runner == 'nrfjprog': + elif runner in ('nrfjprog', 'nrfutil'): extra_args.append('--dev-id') extra_args.append(board_id) elif runner == 'openocd' and self.device_config.product in ['STM32 STLink', 'STLINK-V3']: From 5647467695b545e6baf127ef6e8d7d0cee0a403f Mon Sep 17 00:00:00 2001 From: Bartosz Sokolski Date: Thu, 11 Apr 2024 11:05:55 +0200 Subject: [PATCH 1513/2300] [nrf fromlist] boards: nrf54l15pdk_nrf54l15_cpuapp: yaml for PDK 0.3.0 add twister yaml to support PDK 0.3.0 in tests Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71375 Signed-off-by: Bartosz Sokolski --- .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml new file mode 100644 index 00000000000..8db30713e43 --- /dev/null +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml @@ -0,0 +1,20 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54l15pdk_nrf54l15_cpuapp@0.3.0 +name: nRF54l15-PDK-nRF54l15-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 256 +flash: 1536 +supported: + - counter + - gpio + - i2c + - spi + - watchdog + - i2s From 15e63321d72e83f4b7ba0f1a6df80b86a8e6bf1f Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Thu, 18 Apr 2024 11:35:22 +0200 Subject: [PATCH 1514/2300] Revert "[nrf fromlist] boards: nordic: nrf54l15pdk: enable HWFC" This reverts commit 912ad48d94eabea6bec511a334c59e453f90c16d. Signed-off-by: Piotr Kosycarz --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 22 ++++--------------- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 1 - 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 96c53f948fc..02b02bc8171 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -7,21 +7,14 @@ uart20_default: uart20_default { group1 { psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; + ; }; }; uart20_sleep: uart20_sleep { group1 { psels = , - , - , - ; + ; low-power-enable; }; }; @@ -29,21 +22,14 @@ uart30_default: uart30_default { group1 { psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; + ; }; }; uart30_sleep: uart30_sleep { group1 { psels = , - , - , - ; + ; low-power-enable; }; }; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index 0b9e76ff083..c801ddc8dc5 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -96,7 +96,6 @@ pinctrl-0 = <&uart20_default>; pinctrl-1 = <&uart20_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart30 { From c22c9c258ce776b88dac8a917ab13f46a4c7db85 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Wed, 17 Apr 2024 14:05:02 +0200 Subject: [PATCH 1515/2300] [nrf noup] boards: nordic: nrf54l15pdk: enable HWFC Define RTS and CTS pins. This commit can be dropped when those upstream changes will be included: https://github.com/zephyrproject-rtos/zephyr/pull/70892 https://github.com/zephyrproject-rtos/zephyr/pull/71605 Signed-off-by: Piotr Kosycarz --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 22 +++++++++++++++---- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 02b02bc8171..96c53f948fc 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -7,14 +7,21 @@ uart20_default: uart20_default { group1 { psels = , - ; + ; + }; + group2 { + psels = , + ; + bias-pull-up; }; }; uart20_sleep: uart20_sleep { group1 { psels = , - ; + , + , + ; low-power-enable; }; }; @@ -22,14 +29,21 @@ uart30_default: uart30_default { group1 { psels = , - ; + ; + }; + group2 { + psels = , + ; + bias-pull-up; }; }; uart30_sleep: uart30_sleep { group1 { psels = , - ; + , + , + ; low-power-enable; }; }; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index c801ddc8dc5..0b9e76ff083 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -96,6 +96,7 @@ pinctrl-0 = <&uart20_default>; pinctrl-1 = <&uart20_sleep>; pinctrl-names = "default", "sleep"; + hw-flow-control; }; &uart30 { From 113f05cbc93fb7775ab5512fd56e718d908a03cf Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 12 Apr 2024 11:42:38 +0200 Subject: [PATCH 1516/2300] [nrf fromlist] boards/nordic/nrf54l15pdk: added mx25r64 flash DTS Added DTS of PDK's mx25r64 flash memory. Memory is described under spi00 peripheral and can be controlled used flash spi_nor driver. Signed-off-by: Andrzej Puzdrowski Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71425 --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 17 ++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.dts | 27 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 96c53f948fc..31c2f820f3f 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -47,4 +47,21 @@ low-power-enable; }; }; + + spi0_default: spi0_default { + group1 { + psels = , + , + ; + }; + }; + + spi0_sleep: spi0_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; }; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index 0b9e76ff083..e6ef815e783 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -77,6 +77,7 @@ sw1 = &button1; sw2 = &button2; sw3 = &button3; + spi-flash0 = &mx25r64; }; }; @@ -174,3 +175,29 @@ &clock { status = "okay"; }; + +&spi00 { + status = "okay"; + cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&spi0_default>; + pinctrl-1 = <&spi0_sleep>; + pinctrl-names = "default", "sleep"; + + mx25r64: mx25r6435f@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + status = "disabled"; + spi-max-frequency = <8000000>; + jedec-id = [c2 28 17]; + sfdp-bfp = [ + e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb + ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 + 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 48 44 + 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff + ]; + size = <67108864>; + has-dpd; + t-enter-dpd = <10000>; + t-exit-dpd = <35000>; + }; +}; From dbea77330f5da536adb0dbe33f47c746cbb1ff73 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 10 Apr 2024 16:19:34 +0200 Subject: [PATCH 1517/2300] [nrf fromlist] soc/nordic/comomn: Added HAS_HW_NRF_GPIO2 Added Kconfig indicator boolean for HW instance of GPIO2. Signed-off-by: Andrzej Puzdrowski Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71425 --- soc/common/nordic_nrf/Kconfig.peripherals | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 39ed2e6432f..e10ddb42d20 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -74,6 +74,9 @@ config HAS_HW_NRF_GPIO0 config HAS_HW_NRF_GPIO1 def_bool $(dt_nodelabel_enabled_with_compat,gpio1,$(DT_COMPAT_NORDIC_NRF_GPIO)) +config HAS_HW_NRF_GPIO2 + def_bool $(dt_nodelabel_enabled_with_compat,gpio2,$(DT_COMPAT_NORDIC_NRF_GPIO)) + config HAS_HW_NRF_GPIOTE0 def_bool $(dt_nodelabel_enabled_with_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) From cb3f0667354e519557bfb3bace57567d25c1f835 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 10 Apr 2024 16:21:40 +0200 Subject: [PATCH 1518/2300] [nrf noup] sample/**/smp_svr: nrf54l15pdk external memory dts overlay Added overlay with m25r64 on-DK memory selecton. This aim to support testing DFU with secondary partition moved to the external flash. Signed-off-by: Andrzej Puzdrowski --- .../boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay new file mode 100644 index 00000000000..410388bfa6d --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay @@ -0,0 +1,9 @@ +/ { + chosen { + nordic,pm-ext-flash = &mx25r64; + }; +}; + +&mx25r64 { + status = "okay"; +}; From 849d51f27998807371199e36cf7995652b4864a1 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 12 Apr 2024 17:53:35 +0200 Subject: [PATCH 1519/2300] [nrf noup] samples/**/smp_svr: testcase of nrf54l15pdk with ext-flash Added description of sample testcase for building smp_svr with support of secondary partition in on PDK spi_nor flash. Signed-off-by: Andrzej Puzdrowski --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 373c3acccb9..e5c30662d90 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -94,3 +94,15 @@ tests: - mg100 integration_platforms: - nrf52840dk_nrf52840 + sample.mcumgr.smp_svr.bt.nrf54l15pdk.ext_flash: + extra_args: + - OVERLAY_CONFIG="overlay-bt.conf" + - DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" + - mcuboot_CONF_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.conf" + - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" + extra_configs: + - CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y + platform_allow: + - nrf54l15pdk_nrf54l15_cpuapp + integration_platforms: + - nrf54l15pdk_nrf54l15_cpuapp From f46813ec86e56ed491ca0180f993e998e48c89ed Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Tue, 16 Apr 2024 19:13:37 +0530 Subject: [PATCH 1520/2300] [nrf fromlist] wifi: shell: Support WPA auto personal security mode Applications need to run a scan to identify the security mode before attempting the connection which adds to the time taken for connection to be established. To avoid the initial scan, support auto security mode which will enable STA to choose between WPA, WPA2 and WPA3, based on the network configuration. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71044 Signed-off-by: Ravi Dondaputi --- include/zephyr/net/wifi.h | 2 ++ subsys/net/l2/wifi/wifi_mgmt.c | 3 ++- subsys/net/l2/wifi/wifi_shell.c | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index a0840a2319a..ebfc76d2192 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -49,6 +49,8 @@ enum wifi_security_type { WIFI_SECURITY_TYPE_WEP, /** WPA-PSK security. */ WIFI_SECURITY_TYPE_WPA_PSK, + /** WPA/WPA2/WPA3 PSK security. */ + WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL, __WIFI_SECURITY_TYPE_AFTER_LAST, WIFI_SECURITY_TYPE_MAX = __WIFI_SECURITY_TYPE_AFTER_LAST - 1, diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 5ef047e6c72..937306a7240 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -275,7 +275,8 @@ static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, (params->ssid_length == 0U) || ((params->security == WIFI_SECURITY_TYPE_PSK || params->security == WIFI_SECURITY_TYPE_WPA_PSK || - params->security == WIFI_SECURITY_TYPE_PSK_SHA256) && + params->security == WIFI_SECURITY_TYPE_PSK_SHA256 || + params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) && ((params->psk_length < 8) || (params->psk_length > 64) || (params->psk_length == 0U) || !params->psk)) || ((params->security == WIFI_SECURITY_TYPE_SAE) && diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 8b5c8186222..b6a654e82ea 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1862,8 +1862,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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\n" - "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" + "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n" + "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP," + " 7: WPA-PSK, 8: WPA-Auto-Personal\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n" "[-m, --bssid]: MAC address of the AP (BSSID).\n" From b85b85b1873a59f13e7dcee558845b623ff883b9 Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Mon, 5 Feb 2024 17:04:05 +0100 Subject: [PATCH 1521/2300] [nrf fromtree] tests: drivers: counter: add nRF54L15 overlay Add nRF54L15 overlay for counter_basic_api test. Signed-off-by: Magdalena Pastula (cherry picked from commit 1e20632b3675e064fe8c53a3e398defa99592c9a) --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..54b47926164 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,34 @@ +&timer00 { + prescaler = <6>; + status = "okay"; +}; + +&timer10 { + prescaler = <4>; + status = "okay"; +}; + +&timer20 { + prescaler = <4>; + status = "okay"; +}; + +&timer21 { + prescaler = <4>; + status = "okay"; +}; + +&timer22 { + prescaler = <4>; + status = "okay"; +}; + +&timer23 { + prescaler = <4>; + status = "okay"; +}; + +&timer24 { + prescaler = <4>; + status = "okay"; +}; From 09df3e05ad7ed1e6f0b7400efef5d31fdbdc06a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 18 Apr 2024 10:50:57 +0200 Subject: [PATCH 1522/2300] [nrf fromlist] tests: drivers: counter: counter_basic_api: Add nrf54h20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlays for nrf54h20dk cpuapp and cpurad. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71642 Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 58 ++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 77 +++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..8cabf100ae2 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,58 @@ +&timer120 { + status = "okay"; + prescaler = <7>; +}; + +&timer121 { + status = "okay"; + prescaler = <7>; +}; + +&timer130 { + status = "okay"; + prescaler = <4>; +}; + +&timer131 { + status = "okay"; + prescaler = <4>; +}; + +&timer132 { + status = "okay"; + prescaler = <4>; +}; + +&timer133 { + status = "okay"; + prescaler = <4>; +}; + +&timer134 { + status = "okay"; + prescaler = <4>; +}; + +&timer135 { + status = "okay"; + prescaler = <4>; +}; + +&timer136 { + status = "okay"; + prescaler = <4>; +}; + +&timer137 { + status = "okay"; + prescaler = <4>; +}; + +&rtc130 { + status = "okay"; + ppi-wrap; +}; + +&rtc131 { + status = "okay"; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 00000000000..7cacbc5d7ec --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,77 @@ +&timer020 { + status = "okay"; + prescaler = <7>; +}; + +&timer021 { + status = "okay"; + prescaler = <7>; +}; + +&timer022 { + status = "okay"; + prescaler = <7>; +}; + +&timer120 { + status = "okay"; + prescaler = <7>; +}; + +&timer121 { + status = "okay"; + prescaler = <7>; +}; + +&timer130 { + status = "okay"; + prescaler = <4>; +}; + +&timer131 { + status = "okay"; + prescaler = <4>; +}; + +&timer132 { + status = "okay"; + prescaler = <4>; +}; + +&timer133 { + status = "okay"; + prescaler = <4>; +}; + +&timer134 { + status = "okay"; + prescaler = <4>; +}; + +&timer135 { + status = "okay"; + prescaler = <4>; +}; + +&timer136 { + status = "okay"; + prescaler = <4>; +}; + +&timer137 { + status = "okay"; + prescaler = <4>; +}; + +&rtc130 { + status = "okay"; + ppi-wrap; +}; + +&rtc131 { + status = "okay"; +}; + +&rtc { + status = "okay"; +}; From 100646ff29f04b35dd2387e40cda494882a49a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 9 Apr 2024 11:21:16 +0200 Subject: [PATCH 1523/2300] [nrf fromlist] manifest: Update hal_nordic fix nrfx_uarte fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update hal nordic with fixes in the driver and MDK (EasyDMA UARTE MAXCNT). Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71261 Signed-off-by: Krzysztof Chruściński --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c25c87dcd32..0b80a43c597 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: fc2bab706f195c64d40016c9855b8acd7c235ded + revision: f8e4d73a78316ea9ef85f09f24a3a229e40c1a80 path: modules/hal/nordic groups: - hal From 8fd1556ae3a6730001464830139a928319889a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 6 Feb 2024 13:44:09 +0100 Subject: [PATCH 1524/2300] [nrf fromtree] drivers: serial: nrfx_uarte2: Fix re-enabling the RX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move providing of the first buffer in uart_rx_enable from that function to the callback which is called from nrfx_uarte_rx_enable context. By doing this nrfx_uarte_rx_buffer_set is called when RX configuration flags are already known to the driver. Signed-off-by: Krzysztof Chruściński (cherry picked from commit a1e3e19204dde072b0f55b5dca8cc2f999bac471) --- drivers/serial/uart_nrfx_uarte2.c | 42 ++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index 750c211efb0..cf109c32d8e 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -115,6 +115,9 @@ struct uarte_async_data { uart_callback_t user_callback; void *user_data; + uint8_t *en_rx_buf; + size_t en_rx_len; + struct k_timer tx_timer; struct k_timer rx_timer; @@ -288,6 +291,22 @@ static void on_rx_buf_req(const struct device *dev) struct uarte_async_data *adata = data->async; const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); + /* If buffer is not null it indicates that event comes from RX enabling + * function context. We need to pass provided buffer to the driver. + */ + if (adata->en_rx_buf) { + uint8_t *buf = adata->en_rx_buf; + size_t len = adata->en_rx_len; + nrfx_err_t err; + + adata->en_rx_buf = NULL; + adata->en_rx_len = 0; + + err = nrfx_uarte_rx_buffer_set(nrfx_dev, buf, len); + __ASSERT_NO_MSG(err == NRFX_SUCCESS); + return; + } + struct uart_event evt = { .type = UART_RX_BUF_REQUEST }; @@ -296,8 +315,6 @@ static void on_rx_buf_req(const struct device *dev) * reception of one buffer was terminated to restart another transfer. */ if (!K_TIMEOUT_EQ(adata->rx_timeout, K_NO_WAIT)) { - /* Read and clear any pending new data information. */ - nrfx_uarte_rx_new_data_check(nrfx_dev); nrfx_uarte_rxdrdy_enable(nrfx_dev); } data->async->user_callback(dev, &evt, data->async->user_data); @@ -469,22 +486,28 @@ static int api_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int if (timeout != SYS_FOREVER_US) { adata->idle_cnt = RX_TIMEOUT_DIV + 1; adata->rx_timeout = K_USEC(timeout / RX_TIMEOUT_DIV); + nrfx_uarte_rxdrdy_enable(nrfx_dev); } else { adata->rx_timeout = K_NO_WAIT; } - err = nrfx_uarte_rx_buffer_set(nrfx_dev, buf, len); - if (err != NRFX_SUCCESS) { - return -EIO; - } + /* Store the buffer. It will be passed to the driver in the event handler. + * We do that instead of calling nrfx_uarte_rx_buffer_set here to ensure + * that nrfx_uarte_rx_buffer_set is called when RX enable configuration + * flags are already known to the driver (e.g. if flushed data shall be + * kept or not). + */ + adata->en_rx_buf = buf; + adata->en_rx_len = len; + + atomic_or(&data->flags, UARTE_DATA_FLAG_RX_ENABLED); err = nrfx_uarte_rx_enable(nrfx_dev, flags); if (err != NRFX_SUCCESS) { + atomic_and(&data->flags, ~UARTE_DATA_FLAG_RX_ENABLED); return (err == NRFX_ERROR_BUSY) ? -EBUSY : -EIO; } - atomic_or(&data->flags, UARTE_DATA_FLAG_RX_ENABLED); - return 0; } @@ -932,7 +955,8 @@ static int uarte_nrfx_pm_action(const struct device *dev, UARTE_MEMORY_SECTION(idx) __aligned(4); \ static nrfx_uarte_rx_cache_t uarte##idx##_rx_cache_scratch; \ IF_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN, \ - (static uint8_t a2i_rx_buf##idx[CONFIG_UART_##idx##_A2I_RX_SIZE];)) \ + (static uint8_t a2i_rx_buf##idx[CONFIG_UART_##idx##_A2I_RX_SIZE] \ + UARTE_MEMORY_SECTION(idx) __aligned(4);)) \ PINCTRL_DT_DEFINE(UARTE(idx)); \ static const struct uart_async_to_irq_config uarte_a2i_config_##idx = \ UART_ASYNC_TO_IRQ_API_CONFIG_INITIALIZER(&a2i_api, \ From c080d9332c09a9a525c781cbc1283ccbd22e738b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 4 Apr 2024 15:07:45 +0200 Subject: [PATCH 1525/2300] [nrf fromlist] drivers: serial: nrfx_uarte2: Clean error on rx_enable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clean error state on re-enabling RX. If previous transmission ended with an error it should not impact next receiving session. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71254 Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_nrfx_uarte2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index cf109c32d8e..f052c1fb742 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -497,6 +497,7 @@ static int api_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int * flags are already known to the driver (e.g. if flushed data shall be * kept or not). */ + adata->err = 0; adata->en_rx_buf = buf; adata->en_rx_len = len; From 6e61c5e595bbbccd46d6828bdecb11ac073be28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 8 Apr 2024 17:21:42 +0200 Subject: [PATCH 1526/2300] [nrf fromlist] drivers: serial: uart_nrfx_uarte2: Prevent TX in suspend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not transmit if the device is in suspend mode. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71254 Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_nrfx_uarte2.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index f052c1fb742..ebe85448cea 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -385,6 +385,15 @@ static int api_tx(const struct device *dev, const uint8_t *buf, size_t len, int3 nrfx_err_t err; bool hwfc; +#if CONFIG_PM_DEVICE + enum pm_device_state state; + + (void)pm_device_state_get(dev, &state); + if (state != PM_DEVICE_STATE_ACTIVE) { + return 0; + } +#endif + #if CONFIG_UART_USE_RUNTIME_CONFIGURE hwfc = data->uart_config.flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS; #else @@ -575,6 +584,15 @@ static void api_poll_out(const struct device *dev, unsigned char out_char) const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); nrfx_err_t err; +#if CONFIG_PM_DEVICE + enum pm_device_state state; + + (void)pm_device_state_get(dev, &state); + if (state != PM_DEVICE_STATE_ACTIVE) { + return; + } +#endif + do { /* When runtime PM is used we cannot use early return because then * we have no information when UART is actually done with the From eac6c474270860683c6f19afef3010d9ffb337e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 8 Apr 2024 17:23:01 +0200 Subject: [PATCH 1527/2300] [nrf fromtree] drivers: serial: uart_async_rx: Fix uart_async_rx_reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing fields clearing to the resetting function. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 8f89013789a86a43941e4cf342d9cf7482b768fd) --- drivers/serial/uart_async_rx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/serial/uart_async_rx.c b/drivers/serial/uart_async_rx.c index 68e17691c3e..709f8733849 100644 --- a/drivers/serial/uart_async_rx.c +++ b/drivers/serial/uart_async_rx.c @@ -116,6 +116,9 @@ void uart_async_rx_data_consume(struct uart_async_rx *rx_data, size_t length) void uart_async_rx_reset(struct uart_async_rx *rx_data) { rx_data->free_buf_cnt = rx_data->config->buf_cnt; + rx_data->rd_buf_idx = 0; + rx_data->drv_buf_idx = 0; + rx_data->pending_bytes = 0; for (uint8_t i = 0; i < rx_data->config->buf_cnt; i++) { buf_reset(get_buf(rx_data, i)); } From f5c0d3105ef9baefc05ef14f7f823df79662becf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 8 Apr 2024 17:24:09 +0200 Subject: [PATCH 1528/2300] [nrf fromtree] drivers: serial: uart_async_to_irq: Move resetting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move resetting of the receiver state to disabling function so that once uart is disabled there is no data pending in the module. Signed-off-by: Krzysztof Chruściński (cherry picked from commit e10ed057e878acb59fc764c599dc24ea28832ae8) --- drivers/serial/uart_async_to_irq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/serial/uart_async_to_irq.c b/drivers/serial/uart_async_to_irq.c index e18536449f3..ef8f4a6a06c 100644 --- a/drivers/serial/uart_async_to_irq.c +++ b/drivers/serial/uart_async_to_irq.c @@ -107,6 +107,10 @@ static void on_rx_dis(const struct device *dev, struct uart_async_to_irq_data *d if (data->flags & A2I_RX_ENABLE) { int err; + if (data->rx.async_rx.pending_bytes == 0) { + uart_async_rx_reset(&data->rx.async_rx); + } + err = try_rx_enable(dev, data); if (err == 0) { data->rx.pending_buf_req = 0; @@ -332,7 +336,6 @@ int uart_async_to_irq_rx_enable(const struct device *dev) return err; } - uart_async_rx_reset(&data->rx.async_rx); err = try_rx_enable(dev, data); if (err == 0) { @@ -356,6 +359,8 @@ int uart_async_to_irq_rx_disable(const struct device *dev) k_sem_take(&data->rx.sem, K_FOREVER); } + uart_async_rx_reset(&data->rx.async_rx); + return 0; } From 8e66a574d232953317299cf7bcfdac5b030839fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 8 Apr 2024 17:34:03 +0200 Subject: [PATCH 1529/2300] [nrf fromlist] tests: drivers: uart: uart_pm: Change pm action call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PM action shall be called from the thread context thus switching to k_work instead of the k_timer. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71261 Signed-off-by: Krzysztof Chruściński --- tests/drivers/uart/uart_pm/src/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/drivers/uart/uart_pm/src/main.c b/tests/drivers/uart/uart_pm/src/main.c index 7f3782ee615..6b640853b90 100644 --- a/tests/drivers/uart/uart_pm/src/main.c +++ b/tests/drivers/uart/uart_pm/src/main.c @@ -203,36 +203,36 @@ ZTEST(uart_pm, test_uart_pm_poll_tx) communication_verify(dev, true); } -static void timeout(struct k_timer *timer) +static void work_handler(struct k_work *work) { - const struct device *uart = k_timer_user_data_get(timer); + const struct device *dev = DEVICE_DT_GET(UART_NODE); - action_run(uart, PM_DEVICE_ACTION_SUSPEND, 0); + action_run(dev, PM_DEVICE_ACTION_SUSPEND, 0); } -static K_TIMER_DEFINE(pm_timer, timeout, NULL); - /* Test going into low power state after interrupting poll out. Use various * delays to test interruption at multiple places. */ ZTEST(uart_pm, test_uart_pm_poll_tx_interrupted) { + static struct k_work_delayable dwork; + static struct k_work_sync sync; const struct device *dev; char str[] = "test"; dev = DEVICE_DT_GET(UART_NODE); zassert_true(device_is_ready(dev), "uart device is not ready"); - k_timer_user_data_set(&pm_timer, (void *)dev); + k_work_init_delayable(&dwork, work_handler); for (int i = 1; i < 100; i++) { - k_timer_start(&pm_timer, K_USEC(i * 10), K_NO_WAIT); + k_work_schedule(&dwork, K_USEC(i * 10)); for (int j = 0; j < sizeof(str); j++) { uart_poll_out(dev, str[j]); } - k_timer_status_sync(&pm_timer); + k_work_flush_delayable(&dwork, &sync); action_run(dev, PM_DEVICE_ACTION_RESUME, 0); From a412cab08dd77e6020d443506052d82c17e21f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 8 Apr 2024 17:36:41 +0200 Subject: [PATCH 1530/2300] [nrf fromlist] tests: drivers: uart: uart_pm: Minor adjustments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modifying arbitrary delay to cover for receivers with timeout. Adding a delay between polling and asynchronous checking to cover for cases when CPU processing is fast enough so that both checks may overlap. Allow error code for uart_rx_disable call. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71261 Signed-off-by: Krzysztof Chruściński --- tests/drivers/uart/uart_pm/src/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/drivers/uart/uart_pm/src/main.c b/tests/drivers/uart/uart_pm/src/main.c index 6b640853b90..07e75ec8dd6 100644 --- a/tests/drivers/uart/uart_pm/src/main.c +++ b/tests/drivers/uart/uart_pm/src/main.c @@ -34,7 +34,10 @@ static void polling_verify(const struct device *dev, bool is_async, bool active) for (int i = 0; i < ARRAY_SIZE(outs); i++) { uart_poll_out(dev, outs[i]); - k_busy_wait(1000); + /* We need to wait until receiver gets the data. Receiver may have + * RX timeout so data is not received instantly. + */ + k_busy_wait(5000); if (active) { err = uart_poll_in(dev, &c); @@ -78,6 +81,12 @@ static bool async_verify(const struct device *dev, bool active) zassert_equal(err, 0, "Unexpected err: %d", err); + /* Wait a bit to ensure that polling transfer is already finished otherwise + * receiver might be enabled when there is an ongoing transfer and bytes + * will get corrupted. + */ + k_busy_wait(1000); + if (!DISABLED_RX) { err = uart_rx_enable(dev, rxbuf, sizeof(rxbuf), 1 * USEC_PER_MSEC); zassert_equal(err, 0, "Unexpected err: %d", err); @@ -90,7 +99,7 @@ static bool async_verify(const struct device *dev, bool active) if (!DISABLED_RX) { err = uart_rx_disable(dev); - zassert_equal(err, 0, "Unexpected err: %d", err); + zassert_true((err == 0) || (err == -EFAULT)); k_busy_wait(10000); From a105c379cffad1c1454a09a37880d26050c7e54f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 9 Apr 2024 07:55:19 +0200 Subject: [PATCH 1531/2300] [nrf fromlist] tests: drivers: uart: uart_pm: Limit scope for nrf54l15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some configurations which are not valid for nrf54l15. Mainly those which are using ENHANCED_POLL_OUT option which is not applicable for nrf54l15 because it has ENDTX_STOPTX short so PPI connection is not needed. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71261 Signed-off-by: Krzysztof Chruściński --- tests/drivers/uart/uart_pm/testcase.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 5417be597e0..69e3b0e5d0d 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -5,6 +5,7 @@ common: harness: ztest platform_allow: - nrf52840dk_nrf52840 + - nrf54l15pdk_nrf54l15_cpuapp - nrf52_bsim harness_config: fixture: gpio_loopback @@ -24,6 +25,8 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=n - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" + platform_exclude: + - nrf54l15pdk_nrf54l15_cpuapp drivers.uart.pm.enhanced_poll: extra_configs: @@ -31,6 +34,8 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y + platform_exclude: + - nrf54l15pdk_nrf54l15_cpuapp drivers.uart.pm.int_driven: extra_configs: @@ -47,6 +52,8 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y + platform_exclude: + - nrf54l15pdk_nrf54l15_cpuapp drivers.uart.pm.async: extra_configs: @@ -69,3 +76,5 @@ tests: - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y + platform_exclude: + - nrf54l15pdk_nrf54l15_cpuapp From 53ca2050ec1ab44c9eee3195780d0a1b0f69349c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 9 Apr 2024 09:59:26 +0200 Subject: [PATCH 1532/2300] [nrf fromlist] tests: drivers: uart: uart_pm: Add support for nrf54h20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration for nrf54h20dk. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71261 Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 31 +++++++++++++++++++ tests/drivers/uart/uart_pm/testcase.yaml | 5 +++ 2 files changed, 36 insertions(+) create mode 100644 tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..d01ebce4c8a --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 69e3b0e5d0d..1430fd9a8c2 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 - nrf54l15pdk_nrf54l15_cpuapp + - nrf54h20dk_nrf54h20_cpuapp - nrf52_bsim harness_config: fixture: gpio_loopback @@ -27,6 +28,7 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp + - nrf54h20dk_nrf54h20_cpuapp drivers.uart.pm.enhanced_poll: extra_configs: @@ -36,6 +38,7 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp + - nrf54h20dk_nrf54h20_cpuapp drivers.uart.pm.int_driven: extra_configs: @@ -54,6 +57,7 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp + - nrf54h20dk_nrf54h20_cpuapp drivers.uart.pm.async: extra_configs: @@ -78,3 +82,4 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp + - nrf54h20dk_nrf54h20_cpuapp From 9e79564fad08b8b32fccd5a81cea196d3cadee80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 4 Apr 2024 10:24:12 +0200 Subject: [PATCH 1533/2300] [nrf fromlist] tests: drivers: uart: async_api: Add nrf54h20 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlays for nrf54h20dk. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71260 Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 25 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 11 ++++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 11 ++++++++ 3 files changed, 47 insertions(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay 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 new file mode 100644 index 00000000000..172d75904e4 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; 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 new file mode 100644 index 00000000000..a8fe36d37bb --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&cpuapp_dma_region { + status = "okay"; +}; + +&dut { + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 00000000000..32f95625201 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&cpurad_dma_region { + status = "okay"; +}; + +&dut { + memory-regions = <&cpurad_dma_region>; +}; From 5660de700fced8de58b33ae9da90852633e78310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 10 Apr 2024 14:55:44 +0200 Subject: [PATCH 1534/2300] [nrf fromlist] drivers: serial: nrf: Adapt config deps to nrf54h20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DT nodes and compatible had been renamed and Kconfig option was relying on the names that do not exists. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71365 Signed-off-by: Krzysztof Chruściński --- drivers/serial/Kconfig.nrfx_uart_instance | 2 +- modules/hal_nordic/nrfx/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index 9e992ca9737..b8a62084ce5 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -87,7 +87,7 @@ config UART_$(nrfx_uart_num)_TX_CACHE_SIZE config UART_$(nrfx_uart_num)_RX_CACHE_SIZE int "RX cache buffer size" depends on !UART_NRFX_UARTE_LEGACY_SHIM - default 32 if $(dt_nodelabel_has_compat,ram3x,$(DT_COMPAT_MMIO_SRAM)) + default 32 if $(dt_nodelabel_has_compat,shared_ram3x_region,$(DT_COMPAT_NORDIC_OWNED_MEMORY)) default 5 range 5 255 help diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index c1138ab25a3..3f4bd589485 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -816,7 +816,7 @@ config NRFX_UARTE_CONFIG_TX_LINK config NRFX_UARTE_CONFIG_RX_CACHE_ENABLED bool "UARTE RX caching support" - default y if $(dt_nodelabel_has_compat,ram3x,$(DT_COMPAT_MMIO_SRAM)) + default y if $(dt_nodelabel_has_compat,shared_ram3x_region,$(DT_COMPAT_NORDIC_OWNED_MEMORY)) depends on NRFX_UARTE help Feature might be enabled on platforms which has limitations regarding addresses From 117bb08c370f38d02bba10e0838f588acf19a0ab Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Fri, 5 Apr 2024 11:51:47 +0200 Subject: [PATCH 1535/2300] [nrf fromtree] drivers: Extend coverage for UARTE driver Add more test cases for UARTE driver API Signed-off-by: Bartosz Miller (cherry picked from commit 211477f87401dfe57603e725e0332baf41cff082) --- .../uart/uart_elementary/CMakeLists.txt | 10 + tests/drivers/uart/uart_elementary/Kconfig | 11 + tests/drivers/uart/uart_elementary/README.txt | 13 + .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 + .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 32 ++ .../boards/nrf54h20dk_nrf54h20_common.dtsi | 37 ++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 3 + ...f54h20dk_nrf54h20_cpuapp_dual_uart.overlay | 56 +++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 31 ++ ...54l15pdk_nrf54l15_cpuapp_dual_uart.overlay | 51 +++ tests/drivers/uart/uart_elementary/prj.conf | 6 + tests/drivers/uart/uart_elementary/src/main.c | 322 ++++++++++++++++++ .../uart/uart_elementary/testcase.yaml | 35 ++ 13 files changed, 608 insertions(+) create mode 100644 tests/drivers/uart/uart_elementary/CMakeLists.txt create mode 100644 tests/drivers/uart/uart_elementary/Kconfig create mode 100644 tests/drivers/uart/uart_elementary/README.txt create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay create mode 100644 tests/drivers/uart/uart_elementary/prj.conf create mode 100644 tests/drivers/uart/uart_elementary/src/main.c create mode 100644 tests/drivers/uart/uart_elementary/testcase.yaml diff --git a/tests/drivers/uart/uart_elementary/CMakeLists.txt b/tests/drivers/uart/uart_elementary/CMakeLists.txt new file mode 100644 index 00000000000..59b31ee68a9 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/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(uart_high_level_api) + +target_sources(app PRIVATE + src/main.c + ) diff --git a/tests/drivers/uart/uart_elementary/Kconfig b/tests/drivers/uart/uart_elementary/Kconfig new file mode 100644 index 00000000000..aed523c5832 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/Kconfig @@ -0,0 +1,11 @@ +# UART test configuration options +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config DUAL_UART_TEST + bool "Enable dual UART test" + +config SETUP_MISMATCH_TEST + bool "Enable mismatched configuration in dual UART test" + +source "Kconfig.zephyr" diff --git a/tests/drivers/uart/uart_elementary/README.txt b/tests/drivers/uart/uart_elementary/README.txt new file mode 100644 index 00000000000..5af85beff46 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/README.txt @@ -0,0 +1,13 @@ +The purpose of this test is to validate basic UART driver functions, +that are not tested elsewhere. +UART interrupt mode is used for the tests purpose. + +Hardware setup required for these tests: +For single uart conviguration - UART0 TX connected to RX and CTS to RTS +For dual uart configuratiom - UART0 and UART1 TXs and RXs cross-connected + +These test cases cover: +- UART configuration, +- UART error check, +- UART callback setup, +- Dual UART transmission with matched and mismatched configurations diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000..064e78b6f74 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000..f98f3657f13 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart1_default_alt: uart1_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + uart1_sleep_alt: uart1_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart1 { + current-speed = <115200>; + compatible = "nordic,nrf-uarte"; + status = "okay"; + pinctrl-0 = <&uart1_default_alt>; + pinctrl-1 = <&uart1_sleep_alt>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi new file mode 100644 index 00000000000..22d8378937c --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&cpuapp_dma_region { + status="okay"; +}; + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; + hw-flow-control; + +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..f65b4dd3b0b --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay new file mode 100644 index 00000000000..23c36ee8974 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; + +&pinctrl { + uart137_default_alt: uart137_default_alt { + group1 { + psels = , + ; + }; + }; + + uart137_sleep_alt: uart137_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut_aux: &uart137 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart137_default_alt>; + pinctrl-1 = <&uart137_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..cf481b7a161 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay new file mode 100644 index 00000000000..2031f7a2444 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart22_default: uart22_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart22_sleep: uart22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; + +dut_aux: &uart22 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart22_default>; + pinctrl-1 = <&uart22_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_elementary/prj.conf b/tests/drivers/uart/uart_elementary/prj.conf new file mode 100644 index 00000000000..26c93d320a7 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/prj.conf @@ -0,0 +1,6 @@ +CONFIG_SERIAL=y +CONFIG_ZTEST=y +CONFIG_TEST_USERSPACE=y +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_UART_USE_RUNTIME_CONFIGURE=y +CONFIG_UART_INTERRUPT_DRIVEN=y diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c new file mode 100644 index 00000000000..d7d85ee9542 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @addtogroup t_driver_uart + * @{ + * @defgroup t_uart_elementary test_uart_elementary + * @} + */ + +#include +#include + +#if DT_NODE_EXISTS(DT_NODELABEL(dut)) +#define UART_NODE DT_NODELABEL(dut) +#else +#define UART_NODE DT_CHOSEN(zephyr_console) +#endif + +#if DT_NODE_EXISTS(DT_NODELABEL(dut_aux)) +#define UART_NODE_AUX DT_NODELABEL(dut_aux) +#else +#define UART_NODE_AUX DT_CHOSEN(zephyr_console) +#endif + +#define SLEEP_TIME_US 1000 +#define TEST_BUFFER_LEN 10 + +static const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE); + +const uint8_t test_pattern[TEST_BUFFER_LEN] = { 0x11, 0x12, 0x13, 0x14, 0x15, + 0x16, 0x17, 0x18, 0x19, 0x20 }; +static uint8_t test_buffer[TEST_BUFFER_LEN]; +static volatile uint8_t uart_error_counter; + +#if defined(CONFIG_DUAL_UART_TEST) +static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); +static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; +static volatile uint8_t aux_uart_error; +#endif + +/* + * ISR for UART TX action + */ +static void uart_tx_interrupt_service(const struct device *dev, int *tx_byte_offset) +{ + uint8_t bytes_sent = 0; + uint8_t *tx_data_pointer = (uint8_t *)(test_pattern + *tx_byte_offset); + + if (*tx_byte_offset < TEST_BUFFER_LEN) { + bytes_sent = uart_fifo_fill(dev, tx_data_pointer, 1); + *tx_byte_offset += bytes_sent; + } else { + *tx_byte_offset = 0; + uart_irq_tx_disable(dev); + } +} + +/* + * ISR for UART RX action + */ +static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive_buffer_pointer, + int *rx_byte_offset) +{ + int rx_data_length = 0; + int bytes_received = 0; + + do { + rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, + TEST_BUFFER_LEN); + bytes_received += rx_data_length; + } while (rx_data_length); + *rx_byte_offset += bytes_received; +} + +/* + * Callback function for MAIN UART interrupt based transmission test + */ +static void interrupt_driven_uart_callback_main_uart(const struct device *dev, void *user_data) +{ + int err; + static int tx_byte_offset; + static int rx_byte_offset; + + uart_irq_update(dev); + err = uart_err_check(dev); + if (err != 0) { + uart_error_counter++; + } + while (uart_irq_is_pending(dev)) { + if (uart_irq_rx_ready(dev)) { + uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset); + } + if (uart_irq_tx_ready(dev)) { + uart_tx_interrupt_service(dev, &tx_byte_offset); + } + } +} + +#if defined(CONFIG_DUAL_UART_TEST) +/* + * Callback function for AUX UART interrupt based transmission test + */ +static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, void *user_data) +{ + int err; + static int tx_byte_offset_aux; + static int rx_byte_offset_aux; + + uart_irq_update(dev); + err = uart_err_check(dev); +#if !defined(CONFIG_COVERAGE) + /* This assetion will fail with coverge enabled + * When in coverage mode it has no impact on test case execution + */ + zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); +#endif /* CONFIG_COVERAGE */ + while (uart_irq_is_pending(dev)) { + if (uart_irq_rx_ready(dev)) { + uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); + } + if (uart_irq_tx_ready(dev)) { + uart_tx_interrupt_service(dev, &tx_byte_offset_aux); + } + } +} +#endif /* CONFIG_DUAL_UART_TEST */ + +/* + * Test UART proper configuration call + */ +ZTEST(uart_elementary, test_uart_proper_configuration) +{ + Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); + + int err; + struct uart_config test_expected_uart_config; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; + + err = uart_configure(uart_dev, &test_uart_config); + zassert_equal(err, 0, "'uart_configure' api call - unexpected error: %d", err); + + err = uart_config_get(uart_dev, &test_expected_uart_config); + zassert_equal(err, 0, "'uart_config_get' api call - unexpected error raised : %d", err); + + zassert_equal(test_uart_config.baudrate, test_expected_uart_config.baudrate, + "Set and actual UART config baudrate mismatch: %d != %d", + test_uart_config.baudrate, test_expected_uart_config.baudrate); + + zassert_equal(test_uart_config.parity, test_expected_uart_config.parity, + "Set and actual UART config parity mismatch: %d != %d", + test_uart_config.parity, test_expected_uart_config.parity); + + zassert_equal(test_uart_config.stop_bits, test_expected_uart_config.stop_bits, + "Set and actual UART config stop_bits mismatch: %d != %d", + test_uart_config.stop_bits, test_expected_uart_config.stop_bits); + + zassert_equal(test_uart_config.data_bits, test_expected_uart_config.data_bits, + "Set and actual UART config data_bits mismatch: %d != %d", + test_uart_config.data_bits, test_expected_uart_config.data_bits); + + zassert_equal(test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl, + "Set and actual UART config flow_ctrl mismatch: %d != %d", + test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl); +} + +/* + * Test UART improper configuration call + */ +ZTEST(uart_elementary, test_uart_improper_configuration) +{ + Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); + + int err; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = 7, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; + + err = uart_configure(uart_dev, &test_uart_config); + zassert_not_equal( + err, 0, + "'uart_configure' with incorrect configuration havent't raised an error, err=%d", + err); +} + +#if !defined(CONFIG_DUAL_UART_TEST) +/* + * Test UART basic interrupt based transmission (with loopback) + */ +ZTEST(uart_elementary, test_uart_basic_transmission) +{ + int err; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = UART_CFG_PARITY_ODD, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; + + err = uart_configure(uart_dev, &test_uart_config); + zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); + + err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); + zassert_equal(err, 0, "Unexpected error when setting callback %d", err); + err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, + (void *)test_buffer); + zassert_equal(err, 0, "Unexpected error when setting user data for callback %d", err); + uart_irq_err_enable(uart_dev); + uart_irq_rx_enable(uart_dev); + uart_irq_tx_enable(uart_dev); + + /* wait for the tramission to finish (no polling is intentional) */ + k_sleep(K_USEC(100 * SLEEP_TIME_US)); + + uart_irq_tx_disable(uart_dev); + uart_irq_rx_disable(uart_dev); + uart_irq_err_disable(uart_dev); + for (int index = 0; index < TEST_BUFFER_LEN; index++) { + zassert_equal(test_buffer[index], test_pattern[index], + "Recieived data byte %d does not match pattern 0x%x != 0x%x", index, + test_buffer[index], test_pattern[index]); + } +} +#else +/* + * Test UART interrupt based transmission between two ports + */ +ZTEST(uart_elementary, test_uart_dual_port_transmission) +{ + int err; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; + +#if defined(CONFIG_SETUP_MISMATCH_TEST) + struct uart_config test_uart_config_aux = { .baudrate = 9600, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; +#endif + err = uart_configure(uart_dev, &test_uart_config); + zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); + +#if defined(CONFIG_SETUP_MISMATCH_TEST) + err = uart_configure(uart_dev_aux, &test_uart_config_aux); +#else + err = uart_configure(uart_dev_aux, &test_uart_config); +#endif + + zassert_equal(err, 0, "Unexpected error when configuring UART1: %d", err); + + err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); + zassert_equal(err, 0, "Unexpected error when setting callback for UART0 %d", err); + err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, + (void *)test_buffer); + zassert_equal(err, 0, "Unexpected error when setting user data for UART0 callback %d", err); + + err = uart_irq_callback_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart); + zassert_equal(err, 0, "Unexpected error when setting callback for UART1 %d", err); + err = uart_irq_callback_user_data_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart, + (void *)test_buffer_aux); + zassert_equal(err, 0, "Unexpected error when setting user data for UART1 callback %d", err); + + uart_irq_err_enable(uart_dev); + uart_irq_err_enable(uart_dev_aux); + + uart_irq_tx_enable(uart_dev); + uart_irq_tx_enable(uart_dev_aux); + + uart_irq_rx_enable(uart_dev); + uart_irq_rx_enable(uart_dev_aux); + + /* wait for the tramission to finish (no polling is intentional) */ + k_sleep(K_USEC(100 * SLEEP_TIME_US)); + + uart_irq_tx_disable(uart_dev); + uart_irq_tx_disable(uart_dev_aux); + uart_irq_rx_disable(uart_dev); + uart_irq_rx_disable(uart_dev_aux); + uart_irq_err_disable(uart_dev); + uart_irq_err_disable(uart_dev_aux); + +#if defined(CONFIG_SETUP_MISMATCH_TEST) + zassert_not_equal(uart_error_counter, 0); +#else + for (int index = 0; index < TEST_BUFFER_LEN; index++) { + zassert_equal(test_buffer[index], test_pattern[index], + "UART0 recieived data byte %d does not match pattern 0x%x != 0x%x", + index, test_buffer[index], test_pattern[index]); + zassert_equal(test_buffer_aux[index], test_pattern[index], + "UART1 recieived data byte %d does not match pattern 0x%x != 0x%x", + index, test_buffer_aux[index], test_pattern[index]); + } +#endif /* CONFIG_SETUP_MISMATCH_TEST */ +} +#endif /* CONFIG_DUAL_UART_TEST */ + +/* + * Test setup + */ +void *test_setup(void) +{ + zassert_true(device_is_ready(uart_dev), "UART0 device is not ready"); +#if defined(CONFIG_DUAL_UART_TEST) + zassert_true(device_is_ready(uart_dev_aux), "UART1 device is not ready"); +#endif + + return NULL; +} + +ZTEST_SUITE(uart_elementary, NULL, test_setup, NULL, NULL, NULL); diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml new file mode 100644 index 00000000000..9308ffbf5c2 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -0,0 +1,35 @@ +common: + tags: drivers uart + depends_on: gpio + harness: ztest + harness_config: + fixture: gpio_loopback +tests: + drivers.uart.uart_elementary: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54h20dk_nrf54h20_cpuapp + - nrf54l15pdk_nrf54l15_cpuapp + - nrf5340dk_nrf5340_cpuapp + drivers.uart.uart_elementary_dual_nrf54h: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54h20dk_nrf54h20_cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + drivers.uart.uart_elementary_dual_setup_mismatch_nrf54h: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54h20dk_nrf54h20_cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + - CONFIG_SETUP_MISMATCH_TEST=y + drivers.uart.uart_elementary_dual_nrf54l: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54l15pdk_nrf54l15_cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y From 1fffbd9a5fce282301542ddcfa7255c495af9bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 17 Apr 2024 17:49:34 +0200 Subject: [PATCH 1536/2300] [nrf fromlist] tests: drivers: uart: uart_elementary: Fix RX handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rx_byte_offset was wrongly updated which could lead to test failures. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71615 Signed-off-by: Krzysztof Chruściński --- tests/drivers/uart/uart_elementary/src/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index d7d85ee9542..1c4df3273a7 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -66,14 +66,12 @@ static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive int *rx_byte_offset) { int rx_data_length = 0; - int bytes_received = 0; do { rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, TEST_BUFFER_LEN); - bytes_received += rx_data_length; + *rx_byte_offset += rx_data_length; } while (rx_data_length); - *rx_byte_offset += bytes_received; } /* From 42762514e253fb37aa803294018943dfdd367a9d Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Thu, 18 Apr 2024 10:57:05 +0200 Subject: [PATCH 1537/2300] [nrf fromlist] tests: drivers: uart: uart_elementary: Fix mismatch case UART error may be reported with random timing from either UART in configuration mismatch case. The test case is now aligned to such behaviour. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71642 Signed-off-by: Bartosz Miller --- tests/drivers/uart/uart_elementary/src/main.c | 15 ++++++++------- tests/drivers/uart/uart_elementary/testcase.yaml | 8 ++++++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index 1c4df3273a7..df8c7b54b10 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -40,6 +40,7 @@ static volatile uint8_t uart_error_counter; static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; static volatile uint8_t aux_uart_error; +static volatile uint8_t aux_uart_error_counter; #endif /* @@ -110,12 +111,9 @@ static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, vo uart_irq_update(dev); err = uart_err_check(dev); -#if !defined(CONFIG_COVERAGE) - /* This assetion will fail with coverge enabled - * When in coverage mode it has no impact on test case execution - */ - zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); -#endif /* CONFIG_COVERAGE */ + if (err != 0) { + aux_uart_error_counter++; + } while (uart_irq_is_pending(dev)) { if (uart_irq_rx_ready(dev)) { uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); @@ -290,7 +288,10 @@ ZTEST(uart_elementary, test_uart_dual_port_transmission) uart_irq_err_disable(uart_dev_aux); #if defined(CONFIG_SETUP_MISMATCH_TEST) - zassert_not_equal(uart_error_counter, 0); + TC_PRINT("Mismatched configuration test\n"); + zassert_not_equal(uart_error_counter + aux_uart_error_counter, 0, + "UART configuration mismatch error not detected"); + #else for (int index = 0; index < TEST_BUFFER_LEN; index++) { zassert_equal(test_buffer[index], test_pattern[index], diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index 9308ffbf5c2..67ac04fc1d6 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -33,3 +33,11 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" extra_configs: - CONFIG_DUAL_UART_TEST=y + drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54l15pdk_nrf54l15_cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + - CONFIG_SETUP_MISMATCH_TEST=y From 2e476d935ea60e644e221327806fd2d539734c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 22 Jan 2024 13:40:44 +0100 Subject: [PATCH 1538/2300] [nrf fromtree] drivers: spi: nrf: Add new SPIS instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for upcomming SPIS instances. Signed-off-by: Krzysztof Chruściński (cherry picked from commit c975910f84ffc53eee1f21aaebdcaff8d48c1f7e) --- drivers/spi/Kconfig.nrfx | 14 +++++ drivers/spi/spi_nrfx_spis.c | 19 ++---- modules/hal_nordic/nrfx/Kconfig | 70 +++++++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 42 ++++++++++++++ soc/common/nordic_nrf/Kconfig.peripherals | 42 ++++++++++++++ 5 files changed, 173 insertions(+), 14 deletions(-) diff --git a/drivers/spi/Kconfig.nrfx b/drivers/spi/Kconfig.nrfx index 0ee1c03065b..870730769fa 100644 --- a/drivers/spi/Kconfig.nrfx +++ b/drivers/spi/Kconfig.nrfx @@ -51,6 +51,20 @@ config SPI_NRFX_SPIS select NRFX_SPIS1 if HAS_HW_NRF_SPIS1 select NRFX_SPIS2 if HAS_HW_NRF_SPIS2 select NRFX_SPIS3 if HAS_HW_NRF_SPIS3 + select NRFX_SPIS00 if HAS_HW_NRF_SPIS00 + select NRFX_SPIS20 if HAS_HW_NRF_SPIS20 + select NRFX_SPIS21 if HAS_HW_NRF_SPIS21 + select NRFX_SPIS22 if HAS_HW_NRF_SPIS22 + select NRFX_SPIS30 if HAS_HW_NRF_SPIS30 + select NRFX_SPIS120 if HAS_HW_NRF_SPIS120 + select NRFX_SPIS130 if HAS_HW_NRF_SPIS130 + select NRFX_SPIS131 if HAS_HW_NRF_SPIS131 + select NRFX_SPIS132 if HAS_HW_NRF_SPIS132 + select NRFX_SPIS133 if HAS_HW_NRF_SPIS133 + select NRFX_SPIS134 if HAS_HW_NRF_SPIS134 + select NRFX_SPIS135 if HAS_HW_NRF_SPIS135 + select NRFX_SPIS136 if HAS_HW_NRF_SPIS136 + select NRFX_SPIS137 if HAS_HW_NRF_SPIS137 config SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 depends on SOC_NRF52832 diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index d2a61530f00..78bcc9f84be 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -399,18 +399,9 @@ static int spi_nrfx_init(const struct device *dev) CONFIG_SPI_INIT_PRIORITY, \ &spi_nrfx_driver_api) -#ifdef CONFIG_HAS_HW_NRF_SPIS0 -SPI_NRFX_SPIS_DEFINE(0); -#endif - -#ifdef CONFIG_HAS_HW_NRF_SPIS1 -SPI_NRFX_SPIS_DEFINE(1); -#endif +/* Macro creates device instance if it is enabled in devicetree. */ +#define SPIS_DEVICE(periph, prefix, id, _) \ + IF_ENABLED(CONFIG_HAS_HW_NRF_SPIS##prefix##id, (SPI_NRFX_SPIS_DEFINE(prefix##id);)) -#ifdef CONFIG_HAS_HW_NRF_SPIS2 -SPI_NRFX_SPIS_DEFINE(2); -#endif - -#ifdef CONFIG_HAS_HW_NRF_SPIS3 -SPI_NRFX_SPIS_DEFINE(3); -#endif +/* Macro iterates over nrfx_spis instances enabled in the nrfx_config.h. */ +NRFX_FOREACH_ENABLED(SPIS, SPIS_DEVICE, (), (), _) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 3f4bd589485..ba36da42a12 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -441,6 +441,76 @@ config NRFX_SPIS3 depends on $(dt_nodelabel_has_compat,spi3,$(DT_COMPAT_NORDIC_NRF_SPIS)) select NRFX_SPIS +config NRFX_SPIS00 + bool "SPIS00 driver instance" + depends on $(dt_nodelabel_has_compat,spi00,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS20 + bool "SPIS20 driver instance" + depends on $(dt_nodelabel_has_compat,spi20,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS21 + bool "SPIS21 driver instance" + depends on $(dt_nodelabel_has_compat,spi21,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS22 + bool "SPIS22 driver instance" + depends on $(dt_nodelabel_has_compat,spi22,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS30 + bool "SPIS30 driver instance" + depends on $(dt_nodelabel_has_compat,spi30,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS120 + bool "SPIS120 driver instance" + depends on $(dt_nodelabel_has_compat,spi120,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS130 + bool "SPIS130 driver instance" + depends on $(dt_nodelabel_has_compat,spi130,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS131 + bool "SPIS131 driver instance" + depends on $(dt_nodelabel_has_compat,spi131,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS132 + bool "SPIS132 driver instance" + depends on $(dt_nodelabel_has_compat,spi132,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS133 + bool "SPIS133 driver instance" + depends on $(dt_nodelabel_has_compat,spi133,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS134 + bool "SPIS134 driver instance" + depends on $(dt_nodelabel_has_compat,spi134,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS135 + bool "SPIS135 driver instance" + depends on $(dt_nodelabel_has_compat,spi135,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS136 + bool "SPIS136 driver instance" + depends on $(dt_nodelabel_has_compat,spi136,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + +config NRFX_SPIS137 + bool "SPIS137 driver instance" + depends on $(dt_nodelabel_has_compat,spi137,$(DT_COMPAT_NORDIC_NRF_SPIS)) + select NRFX_SPIS + config NRFX_SYSTICK bool "SYSTICK driver" depends on CPU_CORTEX_M_HAS_SYSTICK diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index e99c80d43cd..60fcd276ea4 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -449,6 +449,48 @@ #ifdef CONFIG_NRFX_SPIS3 #define NRFX_SPIS3_ENABLED 1 #endif +#ifdef CONFIG_NRFX_SPIS00 +#define NRFX_SPIS00_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS20 +#define NRFX_SPIS20_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS21 +#define NRFX_SPIS21_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS22 +#define NRFX_SPIS22_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS30 +#define NRFX_SPIS30_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS120 +#define NRFX_SPIS120_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS130 +#define NRFX_SPIS130_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS131 +#define NRFX_SPIS131_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS132 +#define NRFX_SPIS132_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS133 +#define NRFX_SPIS133_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS134 +#define NRFX_SPIS134_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS135 +#define NRFX_SPIS135_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS136 +#define NRFX_SPIS136_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_SPIS137 +#define NRFX_SPIS130_ENABLED 1 +#endif #ifdef CONFIG_NRFX_SYSTICK #define NRFX_SYSTICK_ENABLED 1 diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index e10ddb42d20..817002f7282 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -320,6 +320,48 @@ config HAS_HW_NRF_SPIS2 config HAS_HW_NRF_SPIS3 def_bool $(dt_nodelabel_enabled_with_compat,spi3,$(DT_COMPAT_NORDIC_NRF_SPIS)) +config HAS_HW_NRF_SPIS00 + def_bool $(dt_nodelabel_enabled_with_compat,spi00,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS20 + def_bool $(dt_nodelabel_enabled_with_compat,spi20,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS21 + def_bool $(dt_nodelabel_enabled_with_compat,spi21,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS22 + def_bool $(dt_nodelabel_enabled_with_compat,spi22,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS30 + def_bool $(dt_nodelabel_enabled_with_compat,spi30,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS120 + def_bool $(dt_nodelabel_enabled_with_compat,spi120,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS130 + def_bool $(dt_nodelabel_enabled_with_compat,spi130,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS131 + def_bool $(dt_nodelabel_enabled_with_compat,spi131,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS132 + def_bool $(dt_nodelabel_enabled_with_compat,spi132,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS133 + def_bool $(dt_nodelabel_enabled_with_compat,spi133,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS134 + def_bool $(dt_nodelabel_enabled_with_compat,spi134,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS135 + def_bool $(dt_nodelabel_enabled_with_compat,spi135,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS136 + def_bool $(dt_nodelabel_enabled_with_compat,spi136,$(DT_COMPAT_NORDIC_NRF_SPIS)) + +config HAS_HW_NRF_SPIS137 + def_bool $(dt_nodelabel_enabled_with_compat,spi137,$(DT_COMPAT_NORDIC_NRF_SPIS)) + config HAS_HW_NRF_SPU def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_SPU)) From 476eef81fbd379e162959f0cb32a730fba5c81fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 23 Jan 2024 11:46:02 +0100 Subject: [PATCH 1539/2300] [nrf fromtree] tests: drivers: spi: Add test for SPI master and slave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add test which is using one SPI master and one SPI slave instance. There is already a loopback test for SPI master so this test is focusing on SPI slave API. Test requires 4 pairs of GPIO pins shortened together. One set of pins is used by SPI master and one for SPI slave. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 1cd7f5150708ef066bbd679ac1f58f42a2b647be) --- tests/drivers/spi/spi_slave/CMakeLists.txt | 10 + .../boards/nrf52840dk_nrf52840.overlay | 67 +++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 73 +++ tests/drivers/spi/spi_slave/prj.conf | 6 + tests/drivers/spi/spi_slave/src/main.c | 452 ++++++++++++++++++ tests/drivers/spi/spi_slave/testcase.yaml | 10 + 6 files changed, 618 insertions(+) create mode 100644 tests/drivers/spi/spi_slave/CMakeLists.txt create mode 100644 tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_slave/prj.conf create mode 100644 tests/drivers/spi/spi_slave/src/main.c create mode 100644 tests/drivers/spi/spi_slave/testcase.yaml diff --git a/tests/drivers/spi/spi_slave/CMakeLists.txt b/tests/drivers/spi/spi_slave/CMakeLists.txt new file mode 100644 index 00000000000..f9f7a6bdae4 --- /dev/null +++ b/tests/drivers/spi/spi_slave/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(spi_slave) + +FILE(GLOB app_sources src/*.c) + +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000..477917e0ca7 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi3_default_alt: spi3_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi3_sleep_alt: spi3_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi1_sleep_alt: spi1_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + +&spi3 { + status = "okay"; + pinctrl-0 = <&spi3_default_alt>; + pinctrl-1 = <&spi3_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <4000000>; + }; +}; + +dut_spis: &spi1 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-1 = <&spi1_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..d431f278337 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi22_default_alt: spi22_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi22_sleep_alt: spi22_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi21_default_alt: spi21_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi21_sleep_alt: spi21_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + +&gpio2 { + status = "okay"; +}; + +&spi22 { + status = "okay"; + pinctrl-0 = <&spi22_default_alt>; + pinctrl-1 = <&spi22_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <4000000>; + }; +}; + +dut_spis: &spi21 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi21_default_alt>; + pinctrl-1 = <&spi21_sleep_alt>; + pinctrl-names = "default", "sleep"; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; diff --git a/tests/drivers/spi/spi_slave/prj.conf b/tests/drivers/spi/spi_slave/prj.conf new file mode 100644 index 00000000000..840a8f87d9a --- /dev/null +++ b/tests/drivers/spi/spi_slave/prj.conf @@ -0,0 +1,6 @@ +CONFIG_SPI=y +CONFIG_SPI_SLAVE=y +CONFIG_GPIO=y +CONFIG_POLL=y +CONFIG_SPI_ASYNC=y +CONFIG_ZTEST=y diff --git a/tests/drivers/spi/spi_slave/src/main.c b/tests/drivers/spi/spi_slave/src/main.c new file mode 100644 index 00000000000..7a6ca1b7545 --- /dev/null +++ b/tests/drivers/spi/spi_slave/src/main.c @@ -0,0 +1,452 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#define SPI_MODE (SPI_MODE_CPOL | SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE) +#define SPIM_OP (SPI_OP_MODE_MASTER | SPI_MODE) +#define SPIS_OP (SPI_OP_MODE_SLAVE | SPI_MODE) + +static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); +static const struct device *spis_dev = DEVICE_DT_GET(DT_NODELABEL(dut_spis)); +static const struct spi_config spis_config = { + .operation = SPIS_OP +}; + +static struct k_poll_signal async_sig = K_POLL_SIGNAL_INITIALIZER(async_sig); +static struct k_poll_event async_evt = + K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &async_sig); + +#define MEMORY_SECTION(node) \ + COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ + (__attribute__((__section__( \ + LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ + ()) + +static uint8_t spim_buffer[32] MEMORY_SECTION(DT_BUS(DT_NODELABEL(dut_spi_dt))); +static uint8_t spis_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spis)); + +struct test_data { + struct k_work_delayable test_work; + struct k_sem sem; + int spim_alloc_idx; + int spis_alloc_idx; + struct spi_buf_set sets[4]; + struct spi_buf_set *mtx_set; + struct spi_buf_set *mrx_set; + struct spi_buf_set *stx_set; + struct spi_buf_set *srx_set; + struct spi_buf bufs[8]; +}; + +static struct test_data tdata; + +/* Allocate buffer from spim or spis space. */ +static uint8_t *buf_alloc(size_t len, bool spim) +{ + int *idx = spim ? &tdata.spim_alloc_idx : &tdata.spis_alloc_idx; + uint8_t *buf = spim ? spim_buffer : spis_buffer; + size_t total = spim ? sizeof(spim_buffer) : sizeof(spis_buffer); + uint8_t *rv; + + if (*idx + len > total) { + zassert_false(true); + + return NULL; + } + + rv = &buf[*idx]; + *idx += len; + + return rv; +} + +static void work_handler(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct test_data *td = CONTAINER_OF(dwork, struct test_data, test_work); + int rv; + + rv = spi_transceive_dt(&spim, td->mtx_set, td->mrx_set); + if (rv == 0) { + k_sem_give(&td->sem); + } +} + +/** Copies data from buffers in the set to a single buffer which makes it easier + * to compare transmitted and received data. + * + * @param buf Output buffer. + * @param len Buffer length. + * @param set Set of buffers. + * + * @return Number of bytes copied. + */ +static int cpy_data(uint8_t *buf, size_t len, struct spi_buf_set *set) +{ + int idx = 0; + + for (size_t i = 0; i < set->count; i++) { + size_t l = set->buffers[i].len; + + if (len - idx >= l) { + memcpy(&buf[idx], set->buffers[i].buf, l); + idx += l; + } else { + return -1; + } + } + + return idx; +} + +/** Compare two sets. + * + * @param tx_set TX set. + * @param rx_set RX set. + * @param same_size True if it is expected to have the same amount of data in both sets. + * + * @return 0 if data is the same and other value indicate that check failed. + */ +static int check_buffers(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set, bool same_size) +{ + static uint8_t tx_data[256]; + static uint8_t rx_data[256]; + int rx_len; + int tx_len; + + if (!tx_set || !rx_set) { + return 0; + } + + rx_len = cpy_data(rx_data, sizeof(rx_data), rx_set); + tx_len = cpy_data(tx_data, sizeof(tx_data), tx_set); + if (same_size && (rx_len != tx_len)) { + return -1; + } + + return memcmp(tx_data, rx_data, rx_len); +} + +/** Calculate expected number of received bytes by the slave. + * + * It is used to check if SPI API call for slave returns correct value. + * @param tx_set TX set. + * @param rx_set RX set. + * + * @return Expected amount of received bytes. + */ +static int slave_rx_len(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set) +{ + size_t tx_len = 0; + size_t rx_len = 0; + + if (!tx_set || !rx_set) { + return 0; + } + + for (size_t i = 0; i < tx_set->count; i++) { + tx_len += tx_set->buffers[i].len; + } + + for (size_t i = 0; i < rx_set->count; i++) { + rx_len += rx_set->buffers[i].len; + } + + return MIN(rx_len, tx_len); +} + +/** Generic function which runs the test with sets prepared in the test data structure. */ +static void run_test(bool m_same_size, bool s_same_size, bool async) +{ + int rv; + int slave_rv; + int srx_len; + + rv = k_work_schedule(&tdata.test_work, K_MSEC(10)); + zassert_equal(rv, 1); + + if (!async) { + slave_rv = spi_transceive(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set); + if (slave_rv == -ENOTSUP) { + ztest_test_skip(); + } + } else { + rv = spi_transceive_signal(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set, + &async_sig); + if (rv == -ENOTSUP) { + ztest_test_skip(); + } + zassert_equal(rv, 0); + + /* Transfer not finished yet */ + rv = k_sem_take(&tdata.sem, K_NO_WAIT); + zassert_equal(rv, -EBUSY); + + rv = k_poll(&async_evt, 1, K_MSEC(200)); + zassert_false(rv, "one or more events are not ready"); + + slave_rv = async_evt.signal->result; + + /* Reinitializing for next call */ + async_evt.signal->signaled = 0U; + async_evt.state = K_POLL_STATE_NOT_READY; + } + + rv = k_sem_take(&tdata.sem, K_MSEC(100)); + zassert_equal(rv, 0); + + srx_len = slave_rx_len(tdata.mtx_set, tdata.srx_set); + + zassert_equal(slave_rv, srx_len, "Got: %d but expected:%d", slave_rv, srx_len); + + rv = check_buffers(tdata.mtx_set, tdata.srx_set, m_same_size); + zassert_equal(rv, 0); + + rv = check_buffers(tdata.stx_set, tdata.mrx_set, s_same_size); + zassert_equal(rv, 0); +} + +/** Basic test where slave and master have RX and TX sets which contains only one + * same size buffer. + */ +static void test_basic(bool async) +{ + size_t len = 16; + + for (int i = 0; i < 4; i++) { + tdata.bufs[i].buf = buf_alloc(len, i < 2); + tdata.bufs[i].len = len; + tdata.sets[i].buffers = &tdata.bufs[i]; + tdata.sets[i].count = 1; + } + + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = &tdata.sets[1]; + tdata.stx_set = &tdata.sets[2]; + tdata.srx_set = &tdata.sets[3]; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_basic) +{ + test_basic(false); +} + +ZTEST(spi_slave, test_basic_async) +{ + test_basic(true); +} + +/** Setup a transfer where RX buffer on master and slave are shorter than + * TX buffers. RX buffers shall contain beginning of TX data and last TX + * bytes that did not fit in the RX buffers shall be lost. + */ +static void test_short_rx(bool async) +{ + size_t len = 16; + + tdata.bufs[0].buf = buf_alloc(len, true); + tdata.bufs[0].len = len; + tdata.bufs[1].buf = buf_alloc(len, true); + tdata.bufs[1].len = len - 3; /* RX buffer */ + tdata.bufs[2].buf = buf_alloc(len, false); + tdata.bufs[2].len = len; + tdata.bufs[3].buf = buf_alloc(len, false); + tdata.bufs[3].len = len - 4; /* RX buffer */ + + for (int i = 0; i < 4; i++) { + tdata.sets[i].buffers = &tdata.bufs[i]; + tdata.sets[i].count = 1; + } + + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = &tdata.sets[1]; + tdata.stx_set = &tdata.sets[2]; + tdata.srx_set = &tdata.sets[3]; + + run_test(false, false, async); +} + +ZTEST(spi_slave, test_short_rx) +{ + test_short_rx(false); +} + +ZTEST(spi_slave, test_short_rx_async) +{ + test_short_rx(true); +} + +/** Test where only master transmits. */ +static void test_only_tx(bool async) +{ + size_t len = 16; + + /* MTX buffer */ + tdata.bufs[0].buf = buf_alloc(len, true); + tdata.bufs[0].len = len; + tdata.sets[0].buffers = &tdata.bufs[0]; + tdata.sets[0].count = 1; + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = NULL; + + /* STX buffer */ + tdata.bufs[1].buf = buf_alloc(len, false); + tdata.bufs[1].len = len; + tdata.sets[1].buffers = &tdata.bufs[1]; + tdata.sets[1].count = 1; + tdata.srx_set = &tdata.sets[1]; + tdata.stx_set = NULL; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_only_tx) +{ + test_only_tx(false); +} + +ZTEST(spi_slave, test_only_tx_async) +{ + test_only_tx(true); +} + +/** Test where only master transmits and slave receives in chunks. */ +static void test_only_tx_in_chunks(bool async) +{ + size_t len1 = 7; + size_t len2 = 8; + + /* MTX buffer */ + tdata.bufs[0].buf = buf_alloc(len1 + len2, true); + tdata.bufs[0].len = len1 + len2; + tdata.sets[0].buffers = &tdata.bufs[0]; + tdata.sets[0].count = 1; + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = NULL; + + /* STX buffer */ + tdata.bufs[1].buf = buf_alloc(len1, false); + tdata.bufs[1].len = len1; + tdata.bufs[2].buf = buf_alloc(len2, false); + tdata.bufs[2].len = len2; + tdata.sets[1].buffers = &tdata.bufs[1]; + tdata.sets[1].count = 2; + tdata.srx_set = &tdata.sets[1]; + tdata.stx_set = NULL; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_only_tx_in_chunks) +{ + test_only_tx_in_chunks(false); +} + +ZTEST(spi_slave, test_only_tx_in_chunks_async) +{ + test_only_tx_in_chunks(true); +} + +/** Test where only slave transmits. */ +static void test_only_rx(bool async) +{ + size_t len = 16; + + /* MTX buffer */ + tdata.bufs[0].buf = buf_alloc(len, true); + tdata.bufs[0].len = len; + tdata.sets[0].buffers = &tdata.bufs[0]; + tdata.sets[0].count = 1; + tdata.mrx_set = &tdata.sets[0]; + tdata.mtx_set = NULL; + + /* STX buffer */ + tdata.bufs[1].buf = buf_alloc(len, false); + tdata.bufs[1].len = len; + tdata.sets[1].buffers = &tdata.bufs[1]; + tdata.sets[1].count = 1; + tdata.stx_set = &tdata.sets[1]; + tdata.srx_set = NULL; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_only_rx) +{ + test_only_rx(false); +} + +ZTEST(spi_slave, test_only_rx_async) +{ + test_only_rx(true); +} + +/** Test where only slave transmits in chunks. */ +static void test_only_rx_in_chunks(bool async) +{ + size_t len1 = 7; + size_t len2 = 9; + + /* MTX buffer */ + tdata.bufs[0].buf = buf_alloc(len1 + len2, true); + tdata.bufs[0].len = len1 + len2; + tdata.sets[0].buffers = &tdata.bufs[0]; + tdata.sets[0].count = 1; + tdata.mrx_set = &tdata.sets[0]; + tdata.mtx_set = NULL; + + /* STX buffer */ + tdata.bufs[1].buf = buf_alloc(len1, false); + tdata.bufs[1].len = len1; + tdata.bufs[2].buf = buf_alloc(len2, false); + tdata.bufs[2].len = len2; + tdata.sets[1].buffers = &tdata.bufs[1]; + tdata.sets[1].count = 2; + tdata.stx_set = &tdata.sets[1]; + tdata.srx_set = NULL; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_only_rx_in_chunks) +{ + test_only_rx_in_chunks(false); +} + +ZTEST(spi_slave, test_only_rx_in_chunks_async) +{ + test_only_rx_in_chunks(true); +} + +static void before(void *not_used) +{ + ARG_UNUSED(not_used); + + memset(&tdata, 0, sizeof(tdata)); + for (size_t i = 0; i < sizeof(spim_buffer); i++) { + spim_buffer[i] = (uint8_t)i; + } + for (size_t i = 0; i < sizeof(spis_buffer); i++) { + spis_buffer[i] = (uint8_t)(i + 0x80); + } + + k_work_init_delayable(&tdata.test_work, work_handler); + k_sem_init(&tdata.sem, 0, 1); +} + +static void *suite_setup(void) +{ + return NULL; +} + +ZTEST_SUITE(spi_slave, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/spi/spi_slave/testcase.yaml b/tests/drivers/spi/spi_slave/testcase.yaml new file mode 100644 index 00000000000..9f04af801fd --- /dev/null +++ b/tests/drivers/spi/spi_slave/testcase.yaml @@ -0,0 +1,10 @@ +tests: + drivers.spi_slave.api: + depends_on: spi + tags: drivers spi + harness: ztest + harness_config: + fixture: gpio_spi_loopback + platform_allow: nrf52840dk_nrf52840 nrf54l15pdk_nrf54l15_cpuapp + integration_platforms: + - nrf52840dk_nrf52840 From f706d530ad301755b02fba26a8216978cba7f682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 3 Apr 2024 12:14:43 +0200 Subject: [PATCH 1540/2300] [nrf fromtree] modules: hal_nordic: Extend SPI configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Iterate over all instances to get the information about extended feature support in SPIM driver. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 865c8800c63e7c7a0ae97a7031ab92f565eff003) --- modules/hal_nordic/nrfx/nrfx_config.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 60fcd276ea4..9357bddab0a 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -381,8 +381,10 @@ #ifdef CONFIG_NRFX_SPIM4 #define NRFX_SPIM4_ENABLED 1 #endif -#if (DT_PROP(DT_NODELABEL(spi3), rx_delay_supported) || \ - DT_PROP(DT_NODELABEL(spi4), rx_delay_supported)) + +#define NRFX_SPIM_DT_HAS_RX_DELAY(node) DT_PROP(node, rx_delay_supported) + + +#if DT_FOREACH_STATUS_OKAY(nordic_nrf_spim, NRFX_SPIM_DT_HAS_RX_DELAY) 0 #define NRFX_SPIM_EXTENDED_ENABLED 1 #endif #ifdef CONFIG_NRFX_SPIM00 From d97636ea3172f524150b152a046eb7388e6cf765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 3 Apr 2024 12:15:46 +0200 Subject: [PATCH 1541/2300] [nrf fromtree] dts: common: nordic: nrf54: Add rx-delay property to SPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add rx-delay property to all SPI nodes. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 8acc6a961a895b91fcfc06a71ba58dfd836b8a45) --- .../nordic/nrf54l15_cpuapp_peripherals.dtsi | 10 ++++++++++ dts/common/nordic/nrf54h20.dtsi | 20 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index eb161844841..3e4d3641069 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -24,6 +24,8 @@ spi00: spi@4a000 { interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; @@ -124,6 +126,8 @@ spi20: spi@c6000 { interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; @@ -159,6 +163,8 @@ spi21: spi@c7000 { interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; @@ -194,6 +200,8 @@ spi22: spi@c8000 { interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; @@ -391,6 +399,8 @@ spi30: spi@104000 { interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index ec5c4cca14f..d3b6b20188f 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -362,6 +362,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart120: uart@8e6000 { @@ -380,6 +382,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; cpuppr_vpr: vpr@908000 { @@ -637,6 +641,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart130: uart@9a5000 { @@ -665,6 +671,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart131: uart@9a6000 { @@ -727,6 +735,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart132: uart@9b5000 { @@ -755,6 +765,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart133: uart@9b6000 { @@ -817,6 +829,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart134: uart@9c5000 { @@ -845,6 +859,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart135: uart@9c6000 { @@ -907,6 +923,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart136: uart@9d5000 { @@ -935,6 +953,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart137: uart@9d6000 { From cd31de02bd74e486bed493f3f78d980774717b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 2 Apr 2024 14:04:18 +0200 Subject: [PATCH 1542/2300] [nrf fromtree] tests: drivers: spi: spi_loopback_test: Add nrf54h20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for nrf54h20dk for the SPI loopback test. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 1e6a2a00e236e6ed33e27f33a79bf9c44db81d89) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..5ab0e84eeaa --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,43 @@ +/* + * 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 { + 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 = ; + }; +}; From a49a583e33618d906e0be2b1da2525fe47ece5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 19 Apr 2024 08:49:02 +0200 Subject: [PATCH 1543/2300] [nrf fromlist] tests: drivers: spi: spi_slave: Add nrf54h20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration for nrf54h20dk to the test. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71677 Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 79 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 14 ++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 14 ++++ tests/drivers/spi/spi_slave/src/main.c | 1 + tests/drivers/spi/spi_slave/testcase.yaml | 4 +- 5 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi new file mode 100644 index 00000000000..0a9425cc2f9 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,79 @@ +/* + * 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; + }; + }; + +}; + +&gpio0 { + status = "okay"; +}; + +&gpiote130 { + status = "okay"; + owned-channels = <7>; +}; + +dut_spi: &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_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..ff337ebdec4 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&dut_spi { + memory-regions = <&cpuapp_dma_region>; +}; + +&dut_spis { + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 00000000000..936bd5b15d5 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&dut_spi { + memory-regions = <&cpurad_dma_region>; +}; + +&dut_spis { + memory-regions = <&cpurad_dma_region>; +}; diff --git a/tests/drivers/spi/spi_slave/src/main.c b/tests/drivers/spi/spi_slave/src/main.c index 7a6ca1b7545..5f441480c12 100644 --- a/tests/drivers/spi/spi_slave/src/main.c +++ b/tests/drivers/spi/spi_slave/src/main.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #define SPI_MODE (SPI_MODE_CPOL | SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE) diff --git a/tests/drivers/spi/spi_slave/testcase.yaml b/tests/drivers/spi/spi_slave/testcase.yaml index 9f04af801fd..2ad23f25d4f 100644 --- a/tests/drivers/spi/spi_slave/testcase.yaml +++ b/tests/drivers/spi/spi_slave/testcase.yaml @@ -5,6 +5,8 @@ tests: harness: ztest harness_config: fixture: gpio_spi_loopback - platform_allow: nrf52840dk_nrf52840 nrf54l15pdk_nrf54l15_cpuapp + platform_allow: | + nrf52840dk_nrf52840 nrf54l15pdk_nrf54l15_cpuapp nrf54h20dk_nrf54h20_cpuapp + nrf54h20dk_nrf54h20_cpurad integration_platforms: - nrf52840dk_nrf52840 From 74b659fb11b82a2009d3dcde331f4b01eb7dcfe4 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 19 Apr 2024 12:58:47 +0200 Subject: [PATCH 1544/2300] [nrf noup] samples: psa_crypto: Remove support for Nordic boards We have our own psa crypto samples to show how to used PSA crypto with NCS. This sample still uses CONFIG_MBEDTLS_BUILTIN which is not supported anymore, therefore removing the support for it in NCS. Ref: NCSDK-17944 Signed-off-by: Markus Swarowsky --- samples/tfm_integration/psa_crypto/sample.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/tfm_integration/psa_crypto/sample.yaml b/samples/tfm_integration/psa_crypto/sample.yaml index 45c9940b021..b368f289e8c 100644 --- a/samples/tfm_integration/psa_crypto/sample.yaml +++ b/samples/tfm_integration/psa_crypto/sample.yaml @@ -12,7 +12,6 @@ tests: - csr - mcuboot platform_allow: mps2_an521_ns v2m_musca_s1_ns - nrf5340dk_nrf5340_cpuapp_ns nrf9160dk_nrf9160_ns stm32l562e_dk_ns bl5340_dvk_cpuapp_ns harness: console harness_config: From 33a0ef8c3ab89959671c703f79d5b1b8d6faaf42 Mon Sep 17 00:00:00 2001 From: Magdalena Pastula Date: Fri, 2 Feb 2024 15:50:34 +0100 Subject: [PATCH 1545/2300] [nrf fromtree] tests: drivers: timer: add nrf_grtc_timer tests Add NRF GRTC timer test for nRF54L15. Signed-off-by: Magdalena Pastula (cherry picked from commit c57946173f417b2c3ff644991f2385a6d4716fec) --- .../timer/nrf_grtc_timer/CMakeLists.txt | 9 +++++ tests/drivers/timer/nrf_grtc_timer/prj.conf | 2 + tests/drivers/timer/nrf_grtc_timer/src/main.c | 40 +++++++++++++++++++ .../timer/nrf_grtc_timer/testcase.yaml | 4 ++ 4 files changed, 55 insertions(+) create mode 100644 tests/drivers/timer/nrf_grtc_timer/CMakeLists.txt create mode 100644 tests/drivers/timer/nrf_grtc_timer/prj.conf create mode 100644 tests/drivers/timer/nrf_grtc_timer/src/main.c create mode 100644 tests/drivers/timer/nrf_grtc_timer/testcase.yaml diff --git a/tests/drivers/timer/nrf_grtc_timer/CMakeLists.txt b/tests/drivers/timer/nrf_grtc_timer/CMakeLists.txt new file mode 100644 index 00000000000..6dfe69d0045 --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/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(nrf_grtc_timer) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/timer/nrf_grtc_timer/prj.conf b/tests/drivers/timer/nrf_grtc_timer/prj.conf new file mode 100644 index 00000000000..dea03477519 --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/prj.conf @@ -0,0 +1,2 @@ +CONFIG_ZTEST=y +CONFIG_NRF_GRTC_TIMER=y diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c new file mode 100644 index 00000000000..197270cc6a4 --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include + +#define GRTC_SLEW_TICKS 10 + +ZTEST(nrf_grtc_timer, test_get_ticks) +{ + k_timeout_t t = K_MSEC(1); + + uint64_t exp_ticks = z_nrf_grtc_timer_read() + t.ticks; + int64_t ticks; + + /* Relative 1ms from now timeout converted to GRTC */ + ticks = z_nrf_grtc_timer_get_ticks(t); + zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), + "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); + + /* Absolute timeout 1ms in the past */ + t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() - K_MSEC(1).ticks)); + + exp_ticks = z_nrf_grtc_timer_read() - K_MSEC(1).ticks; + ticks = z_nrf_grtc_timer_get_ticks(t); + zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), + "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); + + /* Absolute timeout 10ms in the future */ + t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() + K_MSEC(10).ticks)); + exp_ticks = z_nrf_grtc_timer_read() + K_MSEC(10).ticks; + ticks = z_nrf_grtc_timer_get_ticks(t); + zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), + "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); +} + +ZTEST_SUITE(nrf_grtc_timer, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml new file mode 100644 index 00000000000..81b320c7c9b --- /dev/null +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -0,0 +1,4 @@ +tests: + drivers.timer.nrf_grtc_timer: + tags: drivers + platform_allow: nrf54l15pdk_nrf54l15_cpuapp From 05d72f27f9494aadd6cda8b09f23c17951170091 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Mon, 15 Apr 2024 14:12:27 +0200 Subject: [PATCH 1546/2300] [nrf fromtree] tests: drivers: nrf_grtc_timer: add nRF54H20 target GRTC peripheral is present on nRF54H20, so the tests should be executed on this target as well. Signed-off-by: Nikodem Kastelik (cherry picked from commit 1f9bec7f0844784cc790cac20b85d098294ecbfa) --- tests/drivers/timer/nrf_grtc_timer/testcase.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 81b320c7c9b..654594cfe0a 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -1,4 +1,7 @@ tests: drivers.timer.nrf_grtc_timer: tags: drivers - platform_allow: nrf54l15pdk_nrf54l15_cpuapp + platform_allow: + - nrf54l15pdk_nrf54l15_cpuapp + - nrf54h20dk_nrf54h20_cpuapp + - nrf54h20dk_nrf54h20_cpurad From 54b4e400ed8ffe37602112ad719bab4db5ea0087 Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Fri, 19 Apr 2024 10:55:48 +0200 Subject: [PATCH 1547/2300] Revert "[nrf noup] Revert "net: openthread: Add PSA implementation for PBDKF2 genkey"" This reverts commit 28ac23896bacca886d8cf0acc580b6c423e268fc. Pbkdf2 support is now available in TFM. Therefore commit 85bc24eb0731cef2275529633c6f4a915ae8f6ed "net: openthread: Add PSA implementation for PBDKF2 genkey" can be restored. Signed-off-by: Maciej Baczmanski --- modules/openthread/platform/crypto_psa.c | 62 ++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/modules/openthread/platform/crypto_psa.c b/modules/openthread/platform/crypto_psa.c index c818c5695a3..6ad286f3734 100644 --- a/modules/openthread/platform/crypto_psa.c +++ b/modules/openthread/platform/crypto_psa.c @@ -603,4 +603,66 @@ otError otPlatCryptoEcdsaGenerateAndImportKey(otCryptoKeyRef aKeyRef) return psaToOtError(status); } +otError otPlatCryptoPbkdf2GenerateKey(const uint8_t *aPassword, + uint16_t aPasswordLen, + const uint8_t *aSalt, + uint16_t aSaltLen, + uint32_t aIterationCounter, + uint16_t aKeyLen, + uint8_t *aKey) +{ + psa_status_t status = PSA_SUCCESS; + psa_key_id_t key_id = PSA_KEY_ID_NULL; + psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; + psa_algorithm_t algorithm = PSA_ALG_PBKDF2_AES_CMAC_PRF_128; + psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT; + + psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE); + psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_VOLATILE); + psa_set_key_algorithm(&attributes, algorithm); + psa_set_key_type(&attributes, PSA_KEY_TYPE_PASSWORD); + psa_set_key_bits(&attributes, PSA_BYTES_TO_BITS(aPasswordLen)); + + status = psa_import_key(&attributes, aPassword, aPasswordLen, &key_id); + if (status != PSA_SUCCESS) { + goto out; + } + + status = psa_key_derivation_setup(&operation, algorithm); + if (status != PSA_SUCCESS) { + goto out; + } + + status = psa_key_derivation_input_integer(&operation, PSA_KEY_DERIVATION_INPUT_COST, + aIterationCounter); + if (status != PSA_SUCCESS) { + goto out; + } + + status = psa_key_derivation_input_bytes(&operation, PSA_KEY_DERIVATION_INPUT_SALT, + aSalt, aSaltLen); + if (status != PSA_SUCCESS) { + goto out; + } + + status = psa_key_derivation_input_key(&operation, PSA_KEY_DERIVATION_INPUT_PASSWORD, + key_id); + if (status != PSA_SUCCESS) { + goto out; + } + + status = psa_key_derivation_output_bytes(&operation, aKey, aKeyLen); + if (status != PSA_SUCCESS) { + goto out; + } + +out: + psa_reset_key_attributes(&attributes); + psa_key_derivation_abort(&operation); + psa_destroy_key(key_id); + + __ASSERT_NO_MSG(status == PSA_SUCCESS); + return psaToOtError(status); +} + #endif /* #if CONFIG_OPENTHREAD_ECDSA */ From f71ddc7dcc5d89a297cd1691582318efcb12a0ed Mon Sep 17 00:00:00 2001 From: Andy Sinclair Date: Wed, 21 Feb 2024 11:21:43 +0000 Subject: [PATCH 1548/2300] [nrf fromtree] drivers: regulator: common: Added regulator-boot-off Added regulator-boot-off option to common regulator driver. Signed-off-by: Andy Sinclair (cherry picked from commit a14abeb2e6c0fc0884490a1aa3250405d0ffa9fa) --- drivers/regulator/regulator_common.c | 3 +++ dts/bindings/regulator/regulator.yaml | 5 +++++ include/zephyr/drivers/regulator.h | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/regulator_common.c b/drivers/regulator/regulator_common.c index f2d9f6275e6..c539e1169ee 100644 --- a/drivers/regulator/regulator_common.c +++ b/drivers/regulator/regulator_common.c @@ -90,6 +90,9 @@ int regulator_common_init(const struct device *dev, bool is_enabled) if (is_enabled) { data->refcnt++; + if ((config->flags & REGULATOR_BOOT_OFF) != 0U) { + return regulator_disable(dev); + } } else if ((config->flags & REGULATOR_INIT_ENABLED) != 0U) { ret = api->enable(dev); if (ret < 0) { diff --git a/dts/bindings/regulator/regulator.yaml b/dts/bindings/regulator/regulator.yaml index 635bfa49596..b072ce8c920 100644 --- a/dts/bindings/regulator/regulator.yaml +++ b/dts/bindings/regulator/regulator.yaml @@ -61,6 +61,11 @@ properties: This property is intended to only be used for regulators where software cannot read the state of the regulator. + regulator-boot-off: + type: boolean + description: | + Regulator should be disabled on boot. + regulator-allow-bypass: type: boolean description: allow the regulator to go into bypass mode diff --git a/include/zephyr/drivers/regulator.h b/include/zephyr/drivers/regulator.h index 77e441d0dae..46a085d9239 100644 --- a/include/zephyr/drivers/regulator.h +++ b/include/zephyr/drivers/regulator.h @@ -141,6 +141,8 @@ __subsystem struct regulator_driver_api { /** Regulator active discharge get bits */ #define REGULATOR_ACTIVE_DISCHARGE_GET_BITS(x) \ (((x) & REGULATOR_ACTIVE_DISCHARGE_MASK) >> REGULATOR_ACTIVE_DISCHARGE_POS) +/** Indicates regulator must be initialized OFF */ +#define REGULATOR_BOOT_OFF BIT(4) /** @} */ @@ -212,7 +214,9 @@ struct regulator_common_config { REGULATOR_BOOT_ON) | \ (REGULATOR_ACTIVE_DISCHARGE_SET_BITS( \ DT_PROP_OR(node_id, regulator_active_discharge, \ - REGULATOR_ACTIVE_DISCHARGE_DEFAULT)))), \ + REGULATOR_ACTIVE_DISCHARGE_DEFAULT))) | \ + (DT_PROP_OR(node_id, regulator_boot_off, 0U) * \ + REGULATOR_BOOT_OFF)), \ } /** @@ -254,6 +258,7 @@ void regulator_common_data_init(const struct device *dev); * * - Automatically enable the regulator if it is set to `regulator-boot-on` * or `regulator-always-on` and increase its usage count. + * - Automatically disable the regulator if it is set to `regulator-boot-off`. * - Configure the regulator mode if `regulator-initial-mode` is set. * - Ensure regulator voltage is set to a valid range. * From 4698e88891b150910a5c84eb50c4e50be79fc9ad Mon Sep 17 00:00:00 2001 From: Andy Sinclair Date: Tue, 20 Feb 2024 22:18:45 +0000 Subject: [PATCH 1549/2300] [nrf fromtree] drivers: regulator: fake: Added is_enabled property Added is_enabled devicetree property to fake regulator. Allows testing of init behaviour when regulator is enabled in hardware. Signed-off-by: Andy Sinclair (cherry picked from commit 16fdc4bc9f3fd870c5358a477cf4c079e1e5615b) --- drivers/regulator/regulator_fake.c | 6 +++++- dts/bindings/regulator/zephyr,fake-regulator.yaml | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/regulator_fake.c b/drivers/regulator/regulator_fake.c index 129ef2f215e..c2c71593c61 100644 --- a/drivers/regulator/regulator_fake.c +++ b/drivers/regulator/regulator_fake.c @@ -15,6 +15,7 @@ struct regulator_fake_config { struct regulator_common_config common; + bool is_enabled; }; struct regulator_fake_data { @@ -64,9 +65,11 @@ static struct regulator_driver_api api = { static int regulator_fake_init(const struct device *dev) { + const struct regulator_fake_config *config = dev->config; + regulator_common_data_init(dev); - return regulator_common_init(dev, false); + return regulator_common_init(dev, config->is_enabled); } /* parent regulator */ @@ -90,6 +93,7 @@ static struct regulator_parent_driver_api parent_api = { \ static const struct regulator_fake_config FAKE_CONF_NAME(node_id) = { \ .common = REGULATOR_DT_COMMON_CONFIG_INIT(node_id), \ + .is_enabled = DT_PROP(node_id, fake_is_enabled_in_hardware), \ }; \ \ DEVICE_DT_DEFINE(node_id, regulator_fake_init, NULL, \ diff --git a/dts/bindings/regulator/zephyr,fake-regulator.yaml b/dts/bindings/regulator/zephyr,fake-regulator.yaml index 7a6894948b2..833dc8ca115 100644 --- a/dts/bindings/regulator/zephyr,fake-regulator.yaml +++ b/dts/bindings/regulator/zephyr,fake-regulator.yaml @@ -10,3 +10,10 @@ compatible: "zephyr,fake-regulator" child-binding: include: regulator.yaml + + properties: + fake-is-enabled-in-hardware: + type: boolean + description: | + Sets the is_enabled flag passed to regulator_common_init. + Allows test cases where the regulator is enabled in hardware. From 8d3fda6b1beb831d5352017afaf3c0a218725c7c Mon Sep 17 00:00:00 2001 From: Andy Sinclair Date: Tue, 20 Feb 2024 22:35:49 +0000 Subject: [PATCH 1550/2300] [nrf fromtree] tests: drivers: regulator: added regulator-boot-off tests Added tests for new regulator-boot-off property. Signed-off-by: Andy Sinclair (cherry picked from commit b46e2f3d8acdc96dae37cae962648b8bf2ee302a) --- tests/drivers/regulator/api/app.overlay | 9 ++++++++ tests/drivers/regulator/api/src/main.c | 29 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/tests/drivers/regulator/api/app.overlay b/tests/drivers/regulator/api/app.overlay index 25d1d8bb795..6dfeefed18f 100644 --- a/tests/drivers/regulator/api/app.overlay +++ b/tests/drivers/regulator/api/app.overlay @@ -26,5 +26,14 @@ regulator-initial-mode = <1>; regulator-active-discharge = <1>; }; + + reg4: REG4 { + regulator-boot-off; + }; + + reg5: REG5 { + regulator-boot-off; + fake-is-enabled-in-hardware; + }; }; }; diff --git a/tests/drivers/regulator/api/src/main.c b/tests/drivers/regulator/api/src/main.c index 648d761a8b4..93fa7863085 100644 --- a/tests/drivers/regulator/api/src/main.c +++ b/tests/drivers/regulator/api/src/main.c @@ -19,6 +19,10 @@ static const struct device *const reg1 = DEVICE_DT_GET(DT_NODELABEL(reg1)); static const struct device *const reg2 = DEVICE_DT_GET(DT_NODELABEL(reg2)); /* REG3: regulator-max/min-microvolt/microamp, regulator-allowed-modes */ static const struct device *const reg3 = DEVICE_DT_GET(DT_NODELABEL(reg3)); +/* REG4: regulator-boot-off */ +static const struct device *const reg4 = DEVICE_DT_GET(DT_NODELABEL(reg4)); +/* REG5: regulator-boot-off and is_enabled */ +static const struct device *const reg5 = DEVICE_DT_GET(DT_NODELABEL(reg5)); ZTEST(regulator_api, test_parent_dvs_state_set_not_implemented) { @@ -129,6 +133,10 @@ ZTEST(regulator_api, test_common_config) zassert_equal(config->allowed_modes[1], 10U); zassert_equal(config->allowed_modes_cnt, 2U); zassert_equal(REGULATOR_ACTIVE_DISCHARGE_GET_BITS(config->flags), 1U); + + /* reg4: regulator-boot-off */ + config = reg4->config; + zassert_equal(config->flags & REGULATOR_BOOT_OFF, REGULATOR_BOOT_OFF); } ZTEST(regulator_api, test_common_is_init_enabled) @@ -137,6 +145,8 @@ ZTEST(regulator_api, test_common_is_init_enabled) zassert_true(regulator_common_is_init_enabled(reg1)); zassert_true(regulator_common_is_init_enabled(reg2)); zassert_false(regulator_common_is_init_enabled(reg3)); + zassert_false(regulator_common_is_init_enabled(reg4)); + zassert_false(regulator_common_is_init_enabled(reg5)); } ZTEST(regulator_api, test_enable_disable) @@ -171,6 +181,16 @@ ZTEST(regulator_api, test_enable_disable) zassert_equal(regulator_disable(reg0), 0); zassert_equal(regulator_fake_disable_fake.arg0_val, reg0); zassert_equal(regulator_fake_disable_fake.call_count, 2U); + + /* REG5: disabled at boot, can be enabled again */ + zassert_equal(regulator_enable(reg5), 0); + zassert_equal(regulator_fake_enable_fake.call_count, 3U); + + /* 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) @@ -776,6 +796,8 @@ void *setup(void) zassert_true(device_is_ready(reg1)); zassert_true(device_is_ready(reg2)); zassert_true(device_is_ready(reg3)); + zassert_true(device_is_ready(reg4)); + zassert_true(device_is_ready(reg5)); /* REG1, REG2 initialized at init time (always-on/boot-on) */ zassert_equal(regulator_fake_enable_fake.call_count, 2U); @@ -785,6 +807,13 @@ void *setup(void) /* REG3 mode set at init time (initial-mode) */ zassert_equal(regulator_fake_set_mode_fake.call_count, 1U); + /* REG4 already disabled at init time (boot-off) */ + zassert_false(regulator_is_enabled(reg4)); + + /* REG5 explicitly disabled at init time (boot-off) */ + zassert_equal(regulator_fake_disable_fake.call_count, 1U); + zassert_false(regulator_is_enabled(reg5)); + return NULL; } From 94a7ff975973a43864c851af331abc3ae8dfc962 Mon Sep 17 00:00:00 2001 From: Andy Sinclair Date: Fri, 23 Feb 2024 11:36:39 +0000 Subject: [PATCH 1551/2300] [nrf fromtree] dts: bindings: regulator: Added regulator-boot-off to allowlists Added regulator-boot-off to property-allowlist for adp5360, npm1300, npm6001 and axp192. Signed-off-by: Andy Sinclair (cherry picked from commit 977fc0c2ad21c30665d48acf88dbc9fa5ce4b78a) --- dts/bindings/regulator/adi,adp5360-regulator.yaml | 1 + dts/bindings/regulator/nordic,npm1300-regulator.yaml | 1 + dts/bindings/regulator/nordic,npm6001-regulator.yaml | 1 + dts/bindings/regulator/x-powers,axp192-regulator.yaml | 1 + 4 files changed, 4 insertions(+) diff --git a/dts/bindings/regulator/adi,adp5360-regulator.yaml b/dts/bindings/regulator/adi,adp5360-regulator.yaml index d683bd694ef..e54a305e80f 100644 --- a/dts/bindings/regulator/adi,adp5360-regulator.yaml +++ b/dts/bindings/regulator/adi,adp5360-regulator.yaml @@ -34,6 +34,7 @@ child-binding: property-allowlist: - regulator-always-on - regulator-boot-on + - regulator-boot-off - regulator-init-microvolt - regulator-min-microvolt - regulator-max-microvolt diff --git a/dts/bindings/regulator/nordic,npm1300-regulator.yaml b/dts/bindings/regulator/nordic,npm1300-regulator.yaml index c5364a49fe0..e0fc28ff8be 100644 --- a/dts/bindings/regulator/nordic,npm1300-regulator.yaml +++ b/dts/bindings/regulator/nordic,npm1300-regulator.yaml @@ -53,6 +53,7 @@ child-binding: property-allowlist: - regulator-always-on - regulator-boot-on + - regulator-boot-off - regulator-min-microvolt - regulator-max-microvolt - regulator-init-microvolt diff --git a/dts/bindings/regulator/nordic,npm6001-regulator.yaml b/dts/bindings/regulator/nordic,npm6001-regulator.yaml index 34c90c78640..378f6c0a8ec 100644 --- a/dts/bindings/regulator/nordic,npm6001-regulator.yaml +++ b/dts/bindings/regulator/nordic,npm6001-regulator.yaml @@ -45,6 +45,7 @@ child-binding: property-allowlist: - regulator-always-on - regulator-boot-on + - regulator-boot-off - regulator-max-microamp - regulator-min-microvolt - regulator-max-microvolt diff --git a/dts/bindings/regulator/x-powers,axp192-regulator.yaml b/dts/bindings/regulator/x-powers,axp192-regulator.yaml index 98599731c3b..9072e80727b 100644 --- a/dts/bindings/regulator/x-powers,axp192-regulator.yaml +++ b/dts/bindings/regulator/x-powers,axp192-regulator.yaml @@ -51,6 +51,7 @@ child-binding: - regulator-max-microvolt - regulator-always-on - regulator-boot-on + - regulator-boot-off - regulator-initial-mode - regulator-allowed-modes From 4a4ff2741cb753e5d5e6961f283486b0c062c8ba Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 12 Apr 2024 13:41:15 +0200 Subject: [PATCH 1552/2300] [nrf fromtree] soc: nordic: add nRF54 TWIS HAS_HW symbols Add HAS_HW symbols for TWIS instances found on nRF54H20 and nRF54L15 devices. Signed-off-by: Nikodem Kastelik (cherry picked from commit 03cb84ffda13cce818180e2f827c0462f8d75197) --- soc/common/nordic_nrf/Kconfig.peripherals | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 817002f7282..f0adc82d44a 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -530,6 +530,42 @@ config HAS_HW_NRF_TWIS2 config HAS_HW_NRF_TWIS3 def_bool $(dt_nodelabel_enabled_with_compat,i2c3,$(DT_COMPAT_NORDIC_NRF_TWIS)) +config HAS_HW_NRF_TWIS20 + def_bool $(dt_nodelabel_enabled_with_compat,i2c20,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS21 + def_bool $(dt_nodelabel_enabled_with_compat,i2c21,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS22 + def_bool $(dt_nodelabel_enabled_with_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS30 + def_bool $(dt_nodelabel_enabled_with_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS130 + def_bool $(dt_nodelabel_enabled_with_compat,i2c130,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS131 + def_bool $(dt_nodelabel_enabled_with_compat,i2c131,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS132 + def_bool $(dt_nodelabel_enabled_with_compat,i2c132,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS133 + def_bool $(dt_nodelabel_enabled_with_compat,i2c133,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS134 + def_bool $(dt_nodelabel_enabled_with_compat,i2c134,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS135 + def_bool $(dt_nodelabel_enabled_with_compat,i2c135,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS136 + def_bool $(dt_nodelabel_enabled_with_compat,i2c136,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS137 + def_bool $(dt_nodelabel_enabled_with_compat,i2c137,$(DT_COMPAT_NORDIC_NRF_TWIS)) + config HAS_HW_NRF_UART0 def_bool $(dt_nodelabel_enabled_with_compat,uart0,$(DT_COMPAT_NORDIC_NRF_UART)) From 28e2f57a34fbf79e4f45ea5f2d6a242b7b60c4f5 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 12 Apr 2024 13:46:45 +0200 Subject: [PATCH 1553/2300] [nrf fromtree] modules: hal_nordic: nrfx: add support for nRF54 TWIS Add Kconfig-to-nrfx symbol redefinitions so that TWIS instances found on nRF54H20 and nRF54L15 devices are supported. Signed-off-by: Nikodem Kastelik (cherry picked from commit 9711b37e7b490dcaceb3b9bd1df57fcb6840de82) --- modules/hal_nordic/nrfx/Kconfig | 60 +++++++++++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 36 ++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index ba36da42a12..32386d54274 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -771,6 +771,66 @@ config NRFX_TWIS3 depends on $(dt_nodelabel_has_compat,i2c3,$(DT_COMPAT_NORDIC_NRF_TWIS)) select NRFX_TWIS +config NRFX_TWIS20 + bool "TWIS20 driver instance" + depends on $(dt_nodelabel_has_compat,i2c20,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS21 + bool "TWIS21 driver instance" + depends on $(dt_nodelabel_has_compat,i2c21,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS22 + bool "TWIS22 driver instance" + depends on $(dt_nodelabel_has_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS30 + bool "TWIS30 driver instance" + depends on $(dt_nodelabel_has_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS130 + bool "TWIS130 driver instance" + depends on $(dt_nodelabel_has_compat,i2c130,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS131 + bool "TWIS131 driver instance" + depends on $(dt_nodelabel_has_compat,i2c131,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS132 + bool "TWIS132 driver instance" + depends on $(dt_nodelabel_has_compat,i2c132,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS133 + bool "TWIS133 driver instance" + depends on $(dt_nodelabel_has_compat,i2c133,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS134 + bool "TWIS134 driver instance" + depends on $(dt_nodelabel_has_compat,i2c134,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS135 + bool "TWIS135 driver instance" + depends on $(dt_nodelabel_has_compat,i2c135,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS136 + bool "TWIS136 driver instance" + depends on $(dt_nodelabel_has_compat,i2c136,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + +config NRFX_TWIS137 + bool "TWIS137 driver instance" + depends on $(dt_nodelabel_has_compat,i2c137,$(DT_COMPAT_NORDIC_NRF_TWIS)) + select NRFX_TWIS + config NRFX_UART bool diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 9357bddab0a..e7120b54ab7 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -679,6 +679,42 @@ #ifdef CONFIG_NRFX_TWIS3 #define NRFX_TWIS3_ENABLED 1 #endif +#ifdef CONFIG_NRFX_TWIS20 +#define NRFX_TWIS20_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS21 +#define NRFX_TWIS21_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS22 +#define NRFX_TWIS22_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS30 +#define NRFX_TWIS30_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS130 +#define NRFX_TWIS130_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS131 +#define NRFX_TWIS131_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS132 +#define NRFX_TWIS132_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS133 +#define NRFX_TWIS133_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS134 +#define NRFX_TWIS134_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS135 +#define NRFX_TWIS135_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS136 +#define NRFX_TWIS136_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_TWIS137 +#define NRFX_TWIS137_ENABLED 1 +#endif #ifdef CONFIG_NRFX_UART #define NRFX_UART_ENABLED 1 From ee43b9ac08c6351aeaee6089fb28c659151596d6 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 12 Apr 2024 14:13:31 +0200 Subject: [PATCH 1554/2300] [nrf fromtree] tests: boards: nrf: add i2c driver test with TWIS slave Test defines a lopback between i2c driver master and nrfx TWIS slave to verify their functional correctness. Signed-off-by: Nikodem Kastelik (cherry picked from commit 01ea0f2d7e433c0a9e9eb639f60987b075e07870) --- tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt | 10 ++ .../i2c_slave/boards/nrf52840dk_nrf52840.conf | 1 + .../boards/nrf52840dk_nrf52840.overlay | 60 ++++++++ .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 + .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 58 +++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 63 ++++++++ .../boards/nrf54l15pdk_nrf54l15_cpuapp.conf | 1 + .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 59 +++++++ tests/boards/nrf/i2c/i2c_slave/prj.conf | 2 + tests/boards/nrf/i2c/i2c_slave/src/main.c | 145 ++++++++++++++++++ tests/boards/nrf/i2c/i2c_slave/testcase.yaml | 12 ++ 12 files changed, 413 insertions(+) create mode 100644 tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/boards/nrf/i2c/i2c_slave/prj.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/src/main.c create mode 100644 tests/boards/nrf/i2c/i2c_slave/testcase.yaml diff --git a/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt b/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt new file mode 100644 index 00000000000..43130d6a07d --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/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(i2c_slave) + +FILE(GLOB app_sources src/*.c) + +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000..e79ad7a8126 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS1=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000..8628731faf4 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,60 @@ +/ { + aliases { + i2c-slave = &i2c1; + }; +}; + +&pinctrl { + i2c0_default_alt: i2c0_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c0_sleep_alt: i2c0_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c1_default_alt: i2c1_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c1_sleep_alt: i2c1_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c0 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c0_default_alt>; + pinctrl-1 = <&i2c0_sleep_alt>; + pinctrl-names = "default", "sleep"; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + + +&i2c1 { + compatible = "nordic,nrf-twis"; + status = "okay"; + pinctrl-0 = <&i2c1_default_alt>; + pinctrl-1 = <&i2c1_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000..a7bedf1f04b --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS2=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000..d473a04f85c --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,58 @@ +/ { + aliases { + i2c-slave = &i2c2; + }; +}; + +&pinctrl { + i2c1_default_alt: i2c1_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c1_sleep_alt: i2c1_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c2_default_alt: i2c2_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c2_sleep_alt: i2c2_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c1 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c1_default_alt>; + pinctrl-1 = <&i2c1_sleep_alt>; + pinctrl-names = "default", "sleep"; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + +&i2c2 { + compatible = "nordic,nrf-twis"; + pinctrl-0 = <&i2c2_default_alt>; + pinctrl-1 = <&i2c2_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 00000000000..157e0a11f72 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS131=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..73d1d85cf45 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,63 @@ +/ { + aliases { + i2c-slave = &i2c131; + }; +}; + +&pinctrl { + i2c130_default_alt: i2c130_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c130_sleep_alt: i2c130_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c131_default_alt: i2c131_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c131_sleep_alt: i2c131_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c130 { + compatible = "nordic,nrf-twim"; + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c130_default_alt>; + pinctrl-1 = <&i2c130_sleep_alt>; + pinctrl-names = "default", "sleep"; + memory-regions = <&cpuapp_dma_region>; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + +&i2c131 { + compatible = "nordic,nrf-twis"; + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c131_default_alt>; + pinctrl-1 = <&i2c131_sleep_alt>; + pinctrl-names = "default", "sleep"; + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf new file mode 100644 index 00000000000..b01af3b36a7 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS22=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..d60e42659ee --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,59 @@ +/ { + aliases { + i2c-slave = &i2c22; + }; +}; + +&pinctrl { + i2c21_default_alt: i2c21_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c21_sleep_alt: i2c21_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c22_default_alt: i2c22_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c22_sleep_alt: i2c22_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c21 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c21_default_alt>; + pinctrl-1 = <&i2c21_sleep_alt>; + pinctrl-names = "default", "sleep"; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + +&i2c22 { + compatible = "nordic,nrf-twis"; + status = "okay"; + pinctrl-0 = <&i2c22_default_alt>; + pinctrl-1 = <&i2c22_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/prj.conf b/tests/boards/nrf/i2c/i2c_slave/prj.conf new file mode 100644 index 00000000000..4b19609ecfb --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/prj.conf @@ -0,0 +1,2 @@ +CONFIG_I2C=y +CONFIG_ZTEST=y diff --git a/tests/boards/nrf/i2c/i2c_slave/src/main.c b/tests/boards/nrf/i2c/i2c_slave/src/main.c new file mode 100644 index 00000000000..1de4b16bc2c --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/src/main.c @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#if CONFIG_NRFX_TWIS1 +#define I2C_S_INSTANCE 1 +#elif CONFIG_NRFX_TWIS2 +#define I2C_S_INSTANCE 2 +#elif CONFIG_NRFX_TWIS22 +#define I2C_S_INSTANCE 22 +#elif CONFIG_NRFX_TWIS131 +#define I2C_S_INSTANCE 131 +#else +#error "TWIS instance not enabled or not supported" +#endif + +#define NODE_SENSOR DT_NODELABEL(sensor) +#define NODE_TWIS DT_ALIAS(i2c_slave) + +#define TWIS_MEMORY_SECTION \ + COND_CODE_1(DT_NODE_HAS_PROP(NODE_TWIS, memory_regions), \ + (__attribute__((__section__( \ + LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(NODE_TWIS, memory_regions)))))), \ + ()) + +#define TEST_DATA_SIZE 6 +static const uint8_t msg[TEST_DATA_SIZE] = "Nordic"; +static const nrfx_twis_t twis = NRFX_TWIS_INSTANCE(I2C_S_INSTANCE); + +static uint8_t i2c_slave_buffer[TEST_DATA_SIZE] TWIS_MEMORY_SECTION; +static uint8_t i2c_master_buffer[TEST_DATA_SIZE]; +struct i2c_api_twis_fixture { + const struct device *dev; + uint8_t addr; + uint8_t *const master_buffer; + uint8_t *const slave_buffer; +}; + +void i2s_slave_handler(nrfx_twis_evt_t const *p_event) +{ + switch (p_event->type) { + case NRFX_TWIS_EVT_READ_REQ: + nrfx_twis_tx_prepare(&twis, i2c_slave_buffer, TEST_DATA_SIZE); + TC_PRINT("TWIS event: read request\n"); + break; + case NRFX_TWIS_EVT_READ_DONE: + TC_PRINT("TWIS event: read done\n"); + break; + case NRFX_TWIS_EVT_WRITE_REQ: + nrfx_twis_rx_prepare(&twis, i2c_slave_buffer, TEST_DATA_SIZE); + TC_PRINT("TWIS event: write request\n"); + break; + case NRFX_TWIS_EVT_WRITE_DONE: + zassert_mem_equal(i2c_slave_buffer, msg, TEST_DATA_SIZE); + TC_PRINT("TWIS event: write done\n"); + break; + default: + TC_PRINT("TWIS event: %d\n", p_event->type); + break; + } +} + +static void *test_setup(void) +{ + static struct i2c_api_twis_fixture fixture = { + .dev = DEVICE_DT_GET(DT_BUS(NODE_SENSOR)), + .addr = DT_REG_ADDR(NODE_SENSOR), + .master_buffer = i2c_master_buffer, + .slave_buffer = i2c_slave_buffer, + }; + const nrfx_twis_config_t config = { + .addr = {fixture.addr, 0}, + .skip_gpio_cfg = true, + .skip_psel_cfg = true, + }; + int ret; + + zassert_equal(NRFX_SUCCESS, nrfx_twis_init(&twis, &config, i2s_slave_handler), + "TWIS initialization failed"); + + PINCTRL_DT_DEFINE(NODE_TWIS); + ret = pinctrl_apply_state(PINCTRL_DT_DEV_CONFIG_GET(NODE_TWIS), PINCTRL_STATE_DEFAULT); + zassert_ok(ret); + + IRQ_CONNECT(DT_IRQN(NODE_TWIS), DT_IRQ(NODE_TWIS, priority), + NRFX_TWIS_INST_HANDLER_GET(I2C_S_INSTANCE), NULL, 0); + + nrfx_twis_enable(&twis); + + return &fixture; +} + +static void cleanup_buffers(void *argc) +{ + struct i2c_api_twis_fixture *fixture = (struct i2c_api_twis_fixture *)argc; + + memset(fixture->slave_buffer, 0, TEST_DATA_SIZE); + memset(fixture->master_buffer, 0, TEST_DATA_SIZE); +} + +ZTEST_USER_F(i2c_api_twis, test_i2c_read_write) +{ + int ret = i2c_write_read(fixture->dev, fixture->addr, msg, TEST_DATA_SIZE, + fixture->master_buffer, TEST_DATA_SIZE); + + zassert_ok(ret); + zassert_mem_equal(fixture->master_buffer, msg, TEST_DATA_SIZE); +} + +ZTEST_USER_F(i2c_api_twis, test_i2c_read) +{ + /* Prepare slave data */ + strncpy(fixture->slave_buffer, msg, TEST_DATA_SIZE); + zassert_mem_equal(fixture->slave_buffer, msg, TEST_DATA_SIZE); + + int ret = i2c_read(fixture->dev, fixture->master_buffer, TEST_DATA_SIZE, fixture->addr); + + zassert_ok(ret); + zassert_mem_equal(fixture->master_buffer, msg, TEST_DATA_SIZE); +} + +ZTEST_USER_F(i2c_api_twis, test_i2c_write) +{ + int ret = i2c_write(fixture->dev, msg, TEST_DATA_SIZE, fixture->addr); + + zassert_ok(ret); + zassert_mem_equal(fixture->slave_buffer, msg, TEST_DATA_SIZE); +} + +ZTEST_SUITE(i2c_api_twis, NULL, test_setup, NULL, cleanup_buffers, NULL); diff --git a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml new file mode 100644 index 00000000000..06213b742ea --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml @@ -0,0 +1,12 @@ +tests: + boards.nrf.i2c.i2c_slave: + depends_on: i2c + tags: drivers i2c + harness: ztest + harness_config: + fixture: i2c_loopback + platform_allow: nrf52840dk_nrf52840 nrf5340dk_nrf5340_cpuapp nrf54l15pdk_nrf54l15_cpuapp + integration_platforms: + - nrf52840dk_nrf52840 + - nrf5340dk_nrf5340_cpuapp + - nrf54l15pdk_nrf54l15_cpuapp From 3733e7097909ae964e60cf66e4d51ade975ddcae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 11 Apr 2024 09:31:29 +0200 Subject: [PATCH 1555/2300] [nrf fromtree] drivers: pinctrl_nrf: Configure QSPI IO3 pin as output set high MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... so that the pin is kept in a defined state when the IO3 line is not controlled by the QSPI peripheral (when the peripheral is disabled or disconnected from the pin). The IO3 pin in Quad SPI flash chips usually has dual functionality - it is an I/O line when the chip is configured to work in Quad (4 I/O) mode and it is a HOLD# or RESET# line when the chip is configured to work in non-Quad (2 I/O) mode. In the latter case, it is important that the line is kept in the inactive (high) state, otherwise communication with the chip may be disrupted (and this actually happens when e.g. the spi_flash sample is used on a brand new nRF5340 or nRF52840 DK - the nrf_qspi_nor driver fails to initialize and the sample just ends up with the "mx25r6435f@0: device not ready" message). This commit addresses the problem in the same way that it was done for the CSN line in commit 6d8172f4e997254a338b8b8eee92e1c1fb36229d. Signed-off-by: Andrzej Głąbek (cherry picked from commit 2f4426663a2be18eb27dc06ff44c11bb963fd966) --- drivers/pinctrl/pinctrl_nrf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 950037bc8ab..0bf09e5e460 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -355,7 +355,8 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, break; case NRF_FUN_QSPI_IO3: NRF_PSEL_QSPI(reg, IO3) = psel; - dir = NRF_GPIO_PIN_DIR_INPUT; + write = 1U; + dir = NRF_GPIO_PIN_DIR_OUTPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; break; #endif /* defined(NRF_PSEL_QSPI) */ From 57de7d1fc50de73d1d24791f7ec2d6dc00e8ad6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Tue, 13 Feb 2024 13:55:21 +0100 Subject: [PATCH 1556/2300] [nrf fromlist] drivers: adc: Update adc driver to support nRF54L15 device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expands driver to cover nRF54L15 features like AIN as GPIO configuration, new reference voltage, different set of supported gain options. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68692 Signed-off-by: Karol Lasończyk --- drivers/adc/adc_nrfx_saadc.c | 189 ++++++++++++++++++++++++++++------- 1 file changed, 153 insertions(+), 36 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 6d1973ca0aa..e5e658c893a 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -6,7 +6,7 @@ #define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" -#include +#include #include #define LOG_LEVEL CONFIG_ADC_LOG_LEVEL @@ -16,6 +16,20 @@ LOG_MODULE_REGISTER(adc_nrfx_saadc); #define DT_DRV_COMPAT nordic_nrf_saadc +#if (NRF_SAADC_HAS_AIN_AS_PIN) + +static const uint8_t saadc_psels[NRF_SAADC_AIN7 + 1] = { + [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), + [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), + [NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), + [NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), + [NRF_SAADC_AIN4] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), + [NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), + [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(13U, 1), + [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(14U, 1), +}; + +#else BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && (NRF_SAADC_AIN1 == NRF_SAADC_INPUT_AIN1) && (NRF_SAADC_AIN2 == NRF_SAADC_INPUT_AIN2) && @@ -28,8 +42,12 @@ BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && #if defined(SAADC_CH_PSELP_PSELP_VDDHDIV5) (NRF_SAADC_VDDHDIV5 == NRF_SAADC_INPUT_VDDHDIV5) && #endif - (NRF_SAADC_VDD == NRF_SAADC_INPUT_VDD), +#if defined(SAADC_CH_PSELP_PSELP_VDD) + (NRF_SAADC_VDD == NRF_SAADC_INPUT_VDD) && +#endif + 1, "Definitions from nrf-adc.h do not match those from nrf_saadc.h"); +#endif struct driver_data { struct adc_context ctx; @@ -43,85 +61,158 @@ static struct driver_data m_data = { ADC_CONTEXT_INIT_SYNC(m_data, ctx), }; +/* Helper function to convert number of samples to the byte representation. */ +static uint32_t samples_to_bytes(const struct adc_sequence *sequence, uint16_t number_of_samples) +{ + if (NRF_SAADC_8BIT_SAMPLE_WIDTH == 8 && sequence->resolution == 8) { + return number_of_samples; + } + + return number_of_samples * 2; +} + +/* Helper function to convert acquisition time to register TACQ value. */ +static int adc_convert_acq_time(uint16_t acquisition_time, nrf_saadc_acqtime_t *p_tacq_val) +{ + int result = 0; + +#if NRF_SAADC_HAS_ACQTIME_ENUM + switch (acquisition_time) { + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 3): + *p_tacq_val = NRF_SAADC_ACQTIME_3US; + break; + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 5): + *p_tacq_val = NRF_SAADC_ACQTIME_5US; + break; + case ADC_ACQ_TIME_DEFAULT: + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10): + *p_tacq_val = NRF_SAADC_ACQTIME_10US; + break; + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 15): + *p_tacq_val = NRF_SAADC_ACQTIME_15US; + break; + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 20): + *p_tacq_val = NRF_SAADC_ACQTIME_20US; + break; + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40): + *p_tacq_val = NRF_SAADC_ACQTIME_40US; + break; + default: + result = -EINVAL; + } +#else +#define MINIMUM_ACQ_TIME_IN_NS 125 +#define DEFAULT_ACQ_TIME_IN_NS 10000 + + nrf_saadc_acqtime_t tacq = 0; + uint16_t acq_time = + (acquisition_time == ADC_ACQ_TIME_DEFAULT + ? DEFAULT_ACQ_TIME_IN_NS + : (ADC_ACQ_TIME_VALUE(acquisition_time) * + (ADC_ACQ_TIME_UNIT(acquisition_time) == ADC_ACQ_TIME_MICROSECONDS + ? 1000 + : 1))); + + tacq = (nrf_saadc_acqtime_t)(acq_time / MINIMUM_ACQ_TIME_IN_NS) - 1; + if ((tacq > NRF_SAADC_ACQTIME_MAX) || (acq_time < MINIMUM_ACQ_TIME_IN_NS)) { + result = -EINVAL; + } else { + *p_tacq_val = tacq; + } +#endif + + return result; +} /* Implementation of the ADC driver API function: adc_channel_setup. */ static int adc_nrfx_channel_setup(const struct device *dev, const struct adc_channel_cfg *channel_cfg) { nrf_saadc_channel_config_t config = { - .resistor_p = NRF_SAADC_RESISTOR_DISABLED, - .resistor_n = NRF_SAADC_RESISTOR_DISABLED, - .burst = NRF_SAADC_BURST_DISABLED, +#if NRF_SAADC_HAS_CH_CONFIG_RES + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, +#endif + .burst = NRF_SAADC_BURST_DISABLED, }; uint8_t channel_id = channel_cfg->channel_id; + uint32_t input_negative = channel_cfg->input_negative; if (channel_id >= SAADC_CH_NUM) { return -EINVAL; } switch (channel_cfg->gain) { +#if defined(SAADC_CH_CONFIG_GAIN_Gain1_6) case ADC_GAIN_1_6: config.gain = NRF_SAADC_GAIN1_6; break; +#endif +#if defined(SAADC_CH_CONFIG_GAIN_Gain1_5) case ADC_GAIN_1_5: config.gain = NRF_SAADC_GAIN1_5; break; +#endif +#if defined(SAADC_CH_CONFIG_GAIN_Gain1_4) case ADC_GAIN_1_4: config.gain = NRF_SAADC_GAIN1_4; break; +#endif +#if defined(SAADC_CH_CONFIG_GAIN_Gain1_3) case ADC_GAIN_1_3: config.gain = NRF_SAADC_GAIN1_3; break; +#endif +#if defined(SAADC_CH_CONFIG_GAIN_Gain1_2) case ADC_GAIN_1_2: config.gain = NRF_SAADC_GAIN1_2; break; +#endif +#if defined(SAADC_CH_CONFIG_GAIN_Gain2_3) + case ADC_GAIN_2_3: + config.gain = NRF_SAADC_GAIN2_3; + break; +#endif case ADC_GAIN_1: config.gain = NRF_SAADC_GAIN1; break; case ADC_GAIN_2: config.gain = NRF_SAADC_GAIN2; break; +#if defined(SAADC_CH_CONFIG_GAIN_Gain4) case ADC_GAIN_4: config.gain = NRF_SAADC_GAIN4; break; +#endif default: LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; } switch (channel_cfg->reference) { +#if defined(SAADC_CH_CONFIG_REFSEL_Internal) case ADC_REF_INTERNAL: config.reference = NRF_SAADC_REFERENCE_INTERNAL; break; +#endif +#if defined(SAADC_CH_CONFIG_REFSEL_VDD1_4) case ADC_REF_VDD_1_4: config.reference = NRF_SAADC_REFERENCE_VDD4; break; +#endif +#if defined(SAADC_CH_CONFIG_REFSEL_External) + case ADC_REF_EXTERNAL0: + config.reference = NRF_SAADC_REFERENCE_EXTERNAL; + break; +#endif default: LOG_ERR("Selected ADC reference is not valid"); return -EINVAL; } - switch (channel_cfg->acquisition_time) { - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 3): - config.acq_time = NRF_SAADC_ACQTIME_3US; - break; - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 5): - config.acq_time = NRF_SAADC_ACQTIME_5US; - break; - case ADC_ACQ_TIME_DEFAULT: - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10): - config.acq_time = NRF_SAADC_ACQTIME_10US; - break; - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 15): - config.acq_time = NRF_SAADC_ACQTIME_15US; - break; - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 20): - config.acq_time = NRF_SAADC_ACQTIME_20US; - break; - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40): - config.acq_time = NRF_SAADC_ACQTIME_40US; - break; - default: + int ret = adc_convert_acq_time(channel_cfg->acquisition_time, &config.acq_time); + + if (ret) { LOG_ERR("Selected ADC acquisition time is not valid"); return -EINVAL; } @@ -134,17 +225,37 @@ static int adc_nrfx_channel_setup(const struct device *dev, * in a sampling sequence. */ - nrf_saadc_channel_init(NRF_SAADC, channel_id, &config); - nrf_saadc_channel_input_set(NRF_SAADC, - channel_id, - NRF_SAADC_INPUT_DISABLED, - channel_cfg->input_negative); +#if (NRF_SAADC_HAS_AIN_AS_PIN) + if ((channel_cfg->input_positive > NRF_SAADC_AIN7) || + (channel_cfg->input_positive < NRF_SAADC_AIN0)) { + return -EINVAL; + } + + if (config.mode == NRF_SAADC_MODE_DIFFERENTIAL) { + if (input_negative > NRF_SAADC_AIN7 || + input_negative < NRF_SAADC_AIN0) { + return -EINVAL; + } + + input_negative = saadc_psels[input_negative]; + } else { + input_negative = NRF_SAADC_INPUT_DISABLED; + } /* Store the positive input selection in a dedicated array, * to get it later when the channel is selected for a sampling * and to mark the channel as configured (ready to be selected). */ + m_data.positive_inputs[channel_id] = saadc_psels[channel_cfg->input_positive]; +#else m_data.positive_inputs[channel_id] = channel_cfg->input_positive; +#endif + + nrf_saadc_channel_init(NRF_SAADC, channel_id, &config); + nrf_saadc_channel_input_set(NRF_SAADC, + channel_id, + NRF_SAADC_INPUT_DISABLED, + input_negative); return 0; } @@ -168,10 +279,11 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx, ARG_UNUSED(ctx); if (!repeat) { - nrf_saadc_buffer_pointer_set( - NRF_SAADC, - (uint16_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + - nrf_saadc_amount_get(NRF_SAADC)); + nrf_saadc_value_t *buffer = + (uint8_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + + samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); + + nrfy_saadc_buffer_pointer_set(NRF_SAADC, buffer); } } @@ -256,7 +368,8 @@ static int check_buffer_size(const struct adc_sequence *sequence, { size_t needed_buffer_size; - needed_buffer_size = active_channels * sizeof(uint16_t); + needed_buffer_size = samples_to_bytes(sequence, active_channels); + if (sequence->options) { needed_buffer_size *= (1 + sequence->options->extra_samplings); } @@ -429,7 +542,11 @@ 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) + .ref_internal = 900, +#else .ref_internal = 600, +#endif }; /* From c045098d5a17be01227750fe27b422983ce8b59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Tue, 23 Apr 2024 12:54:38 +0200 Subject: [PATCH 1557/2300] [nrf fromlist] boards: Enable ADC in nRF54L15 PDK configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simple enabling adc node. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68692 Signed-off-by: Karol Lasończyk --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index e6ef815e783..f64952ba886 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -201,3 +201,7 @@ t-exit-dpd = <35000>; }; }; + +&adc { + status = "okay"; +}; From 51f7968750ed8fdce6b59eeebaeae2c0e40eb932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Tue, 13 Feb 2024 13:58:23 +0100 Subject: [PATCH 1558/2300] [nrf fromlist] samples: adc: Add overlay for nRF54L15 PDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New file with ADC configuration for nRF54L15 PDK. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68692 Signed-off-by: Karol Lasończyk --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 samples/drivers/adc/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/samples/drivers/adc/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/samples/drivers/adc/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..f185624f9b9 --- /dev/null +++ b/samples/drivers/adc/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,45 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1>, <&adc 7>; + }; +}; + +&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 = ; /* P1.11 */ + zephyr,resolution = <10>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.06 */ + zephyr,resolution = <12>; + zephyr,oversampling = <8>; + }; + + channel@7 { + reg = <7>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P1.13 */ + zephyr,input-negative = ; /* P1.14 */ + zephyr,resolution = <12>; + }; +}; From 2da6498dc8195a3d8946f78c63046c18cdb2d1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Tue, 13 Feb 2024 13:59:40 +0100 Subject: [PATCH 1559/2300] [nrf fromlist] tests: adc: Add overlay for nRF54L15 PDK for adc_api test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New file to make test works. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68692 Signed-off-by: Karol Lasończyk --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/drivers/adc/adc_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/adc/adc_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..e10ddc54328 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,34 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + +/ { + zephyr,user { + io-channels = <&adc 0>, <&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@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; +}; From 63c8c9de984dbb59e3ca42ce00484c632fa3350e Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Mon, 18 Mar 2024 17:20:42 +0530 Subject: [PATCH 1560/2300] [nrf fromtree] net: wifi_mgmt: Setting RTS threshold Support to set RTS threshold. Signed-off-by: Ajay Parida (cherry picked from commit 4d4b304e031aacfdf92bf2026ed0896be0107249) --- include/zephyr/net/wifi_mgmt.h | 15 +++++++++++++ subsys/net/l2/wifi/wifi_mgmt.c | 20 +++++++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 40 +++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index c1fa8145dbf..70fd5978fba 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -82,6 +82,8 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT, /** Get Wi-Fi driver and Firmware versions */ NET_REQUEST_WIFI_CMD_VERSION, + /** Set RTS threshold */ + NET_REQUEST_WIFI_CMD_RTS_THRESHOLD, NET_REQUEST_WIFI_CMD_MAX }; @@ -159,6 +161,10 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION); +#define NET_REQUEST_WIFI_RTS_THRESHOLD \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_RTS_THRESHOLD) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD); /** Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -852,6 +858,15 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*get_version)(const struct device *dev, struct wifi_version *params); + /** Set RTS threshold value + * + * @param dev Pointer to the device structure for the driver instance. + * @param RTS threshold value + * + * @return 0 if ok, < 0 if error + */ + int (*set_rts_threshold)(const struct device *dev, unsigned int rts_threshold); + }; /** Wi-Fi management offload API */ diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 937306a7240..51e76aec5fb 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -720,6 +720,26 @@ static int wifi_get_version(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION, wifi_get_version); +static int wifi_set_rts_threshold(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); + unsigned int *rts_threshold = data; + + if (wifi_mgmt_api == NULL || wifi_mgmt_api->set_rts_threshold == NULL) { + return -ENOTSUP; + } + + if (!data || len != sizeof(*rts_threshold)) { + return -EINVAL; + } + + return wifi_mgmt_api->set_rts_threshold(dev, *rts_threshold); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD, wifi_set_rts_threshold); + #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface, struct wifi_raw_scan_result *raw_scan_result) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index b6a654e82ea..9206271b1f8 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1476,6 +1476,40 @@ static int cmd_wifi_ps_wakeup_mode(const struct shell *sh, size_t argc, char *ar return 0; } +static int cmd_wifi_set_rts_threshold(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = net_if_get_first_wifi(); + unsigned int rts_threshold = -1; /* Default value if user supplies "off" argument */ + int err = 0; + + context.sh = sh; + + if (strcmp(argv[1], "off") != 0) { + long rts_val = shell_strtol(argv[1], 10, &err); + + if (err) { + shell_error(sh, "Unable to parse input (err %d)", err); + return err; + } + + rts_threshold = (unsigned int)rts_val; + } + + if (net_mgmt(NET_REQUEST_WIFI_RTS_THRESHOLD, iface, + &rts_threshold, sizeof(rts_threshold))) { + shell_fprintf(sh, SHELL_WARNING, + "Setting RTS threshold failed.\n"); + return -ENOEXEC; + } + + if ((int)rts_threshold >= 0) + shell_fprintf(sh, SHELL_NORMAL, "RTS threshold: %d\n", rts_threshold); + else + shell_fprintf(sh, SHELL_NORMAL, "RTS threshold is off\n"); + + return 0; +} + void parse_mode_args_to_params(const struct shell *sh, int argc, char *argv[], struct wifi_mode_info *mode, bool *do_mode_oper) @@ -1971,6 +2005,12 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, cmd_wifi_ps_wakeup_mode, 2, 0), + SHELL_CMD_ARG(rts_threshold, + NULL, + ".\n", + cmd_wifi_set_rts_threshold, + 2, + 0), SHELL_SUBCMD_SET_END ); From 253ee08dec4dbd4a11ba0402a1c62aff8878497d Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Mon, 15 Apr 2024 15:10:22 +0530 Subject: [PATCH 1561/2300] [nrf fromtree] doc: release-notes: Set RTS threshold Added support to set RTS threshold. Signed-off-by: Ajay Parida (cherry picked from commit edba435f76342500b88097929bc23eda20c33e83) --- doc/releases/release-notes-3.7.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index d97f69bf628..8e223c13b8d 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -134,6 +134,9 @@ Drivers and Sensors * Wi-Fi + * Added support for configuring RTS threshold. With this, users can set the RTS threshold value or + disable the RTS mechanism. + Networking ********** From 6c515dd5fc7c777e0105cf5bb66c51b036f8b6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Tue, 16 Apr 2024 09:21:25 +0200 Subject: [PATCH 1562/2300] [nrf fromtree] tests: drivers: spi: Add negative test cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend test coverage by adding tests that check invalid use of the SPI API. Signed-off-by: Sebastian Głąb (cherry picked from commit 5e4bbd5c7c37b55b9b6df63ba7165f0b8ff6506c) --- .../spi/spi_error_cases/CMakeLists.txt | 10 + .../boards/nrf52840dk_nrf52840.overlay | 72 +++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 78 ++++++ tests/drivers/spi/spi_error_cases/prj.conf | 7 + tests/drivers/spi/spi_error_cases/src/main.c | 263 ++++++++++++++++++ .../drivers/spi/spi_error_cases/testcase.yaml | 12 + 6 files changed, 442 insertions(+) create mode 100644 tests/drivers/spi/spi_error_cases/CMakeLists.txt create mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_error_cases/prj.conf create mode 100644 tests/drivers/spi/spi_error_cases/src/main.c create mode 100644 tests/drivers/spi/spi_error_cases/testcase.yaml diff --git a/tests/drivers/spi/spi_error_cases/CMakeLists.txt b/tests/drivers/spi/spi_error_cases/CMakeLists.txt new file mode 100644 index 00000000000..2ac4bdbef4d --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/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(spi_error_cases) + +FILE(GLOB app_sources src/*.c) + +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000..183d6da9967 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi3_default_alt: spi3_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi3_sleep_alt: spi3_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi1_sleep_alt: spi1_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + +dut_spi: &spi3 { + status = "okay"; + pinctrl-0 = <&spi3_default_alt>; + pinctrl-1 = <&spi3_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <200000>; + }; +}; + +dut_spis: &spi1 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-1 = <&spi1_sleep_alt>; + pinctrl-names = "default", "sleep"; + dut_spis_dt: test-spis-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <200000>; + }; +}; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..2a0394c3f60 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi22_default_alt: spi22_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi22_sleep_alt: spi22_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi21_default_alt: spi21_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi21_sleep_alt: spi21_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + +&gpio2 { + status = "okay"; +}; + +dut_spi: &spi22 { + status = "okay"; + pinctrl-0 = <&spi22_default_alt>; + pinctrl-1 = <&spi22_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <200000>; + }; +}; + +dut_spis: &spi21 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi21_default_alt>; + pinctrl-1 = <&spi21_sleep_alt>; + pinctrl-names = "default", "sleep"; + dut_spis_dt: test-spis-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <200000>; + }; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; diff --git a/tests/drivers/spi/spi_error_cases/prj.conf b/tests/drivers/spi/spi_error_cases/prj.conf new file mode 100644 index 00000000000..1161e03f477 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/prj.conf @@ -0,0 +1,7 @@ +CONFIG_SPI=y +CONFIG_SPI_SLAVE=y +CONFIG_GPIO=y +CONFIG_POLL=y +CONFIG_SPI_ASYNC=y +CONFIG_SPI_EXTENDED_MODES=y +CONFIG_ZTEST=y diff --git a/tests/drivers/spi/spi_error_cases/src/main.c b/tests/drivers/spi/spi_error_cases/src/main.c new file mode 100644 index 00000000000..0b44812db84 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/src/main.c @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#define SPI_MODE (SPI_MODE_CPOL | SPI_WORD_SET(8) | SPI_LINES_SINGLE) +#define SPIM_OP (SPI_OP_MODE_MASTER | SPI_MODE) +#define SPIS_OP (SPI_OP_MODE_SLAVE | SPI_MODE) + +static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); +static struct spi_dt_spec spis = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spis_dt), SPIS_OP, 0); + +#define MEMORY_SECTION(node) \ + COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ + (__attribute__((__section__( \ + LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ + ()) + +static uint8_t spim_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spi)); +static uint8_t spis_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spis)); + +struct test_data { + int spim_alloc_idx; + int spis_alloc_idx; + struct spi_buf_set sets[4]; + struct spi_buf_set *mtx_set; + struct spi_buf_set *mrx_set; + struct spi_buf_set *stx_set; + struct spi_buf_set *srx_set; + struct spi_buf bufs[4]; +}; + +static struct test_data tdata; + +/* Allocate buffer from spim or spis space. */ +static uint8_t *buf_alloc(size_t len, bool spim) +{ + int *idx = spim ? &tdata.spim_alloc_idx : &tdata.spis_alloc_idx; + uint8_t *buf = spim ? spim_buffer : spis_buffer; + size_t total = spim ? sizeof(spim_buffer) : sizeof(spis_buffer); + uint8_t *rv; + + if (*idx + len > total) { + zassert_false(true); + + return NULL; + } + + rv = &buf[*idx]; + *idx += len; + + return rv; +} + +ZTEST(spi_error_cases, test_SPI_HALF_DUPLEX_not_supported) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_HALF_DUPLEX; + spis_invalid.config.operation |= SPI_HALF_DUPLEX; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -ENOTSUP, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_SPI_OP_MODE_invalid) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_OP_MODE_SLAVE; + spis_invalid.config.operation &= !SPI_OP_MODE_SLAVE; + + /* Check that Operation Mode Slave on spim is not supported */ + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + /* Check that Operation Mode Master on spis is not supported */ + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_SPI_MODE_LOOP_not_supported) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_MODE_LOOP; + spis_invalid.config.operation |= SPI_MODE_LOOP; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_only_SPI_LINES_SINGLE_supported) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_LINES_DUAL; + spis_invalid.config.operation |= SPI_LINES_DUAL; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); + + spim_invalid = spim; + spis_invalid = spis; + spim_invalid.config.operation |= SPI_LINES_QUAD; + spis_invalid.config.operation |= SPI_LINES_QUAD; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); + + spim_invalid = spim; + spis_invalid = spis; + spim_invalid.config.operation |= SPI_LINES_OCTAL; + spis_invalid.config.operation |= SPI_LINES_OCTAL; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_only_8BIT_supported) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_WORD_SET(16); + spis_invalid.config.operation |= SPI_WORD_SET(16); + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_unsupported_frequency) +{ + int rv; + struct spi_dt_spec spim_invalid = spim; + + spim_invalid.config.frequency = 124999; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); +} + +ZTEST(spi_error_cases, test_CS_unsupported_on_slave) +{ + int slave_rv; + struct spi_dt_spec spis_invalid = spis; + struct gpio_dt_spec test_gpio = { DEVICE_DT_GET(DT_NODELABEL(gpio1)), 10, GPIO_ACTIVE_LOW }; + + spis_invalid.config.cs.gpio = test_gpio; + + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_scattered_tx_buf_not_supported) +{ + int slave_rv; + + tdata.sets[2].count = 2; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_scattered_rx_buf_not_supported) +{ + int slave_rv; + + tdata.sets[3].count = 2; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_tx_buf_too_big) +{ + int slave_rv; + + tdata.bufs[2].len = (size_t)65536; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_rx_buf_too_big) +{ + int slave_rv; + + tdata.bufs[3].len = (size_t)65536; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_tx_buf_not_in_ram) +{ + int slave_rv; + + tdata.bufs[2].buf = (void *)0x12345678; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); +} + +static void before(void *not_used) +{ + ARG_UNUSED(not_used); + size_t len = 16; + + memset(&tdata, 0, sizeof(tdata)); + for (size_t i = 0; i < sizeof(spim_buffer); i++) { + spim_buffer[i] = (uint8_t)i; + } + for (size_t i = 0; i < sizeof(spis_buffer); i++) { + spis_buffer[i] = (uint8_t)i; + } + + for (int i = 0; i < 4; i++) { + tdata.bufs[i].buf = buf_alloc(len, i < 2); + tdata.bufs[i].len = len; + tdata.sets[i].buffers = &tdata.bufs[i]; + tdata.sets[i].count = 1; + } + + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = &tdata.sets[1]; + tdata.stx_set = &tdata.sets[2]; + tdata.srx_set = &tdata.sets[3]; +} + +static void *suite_setup(void) +{ + return NULL; +} + +ZTEST_SUITE(spi_error_cases, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml new file mode 100644 index 00000000000..17cee921111 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/testcase.yaml @@ -0,0 +1,12 @@ +tests: + drivers.spi.spi_error_cases: + depends_on: spi + tags: drivers spi + harness: ztest + harness_config: + fixture: gpio_spi_loopback + platform_allow: + - nrf52840dk_nrf52840 + - nrf54l15pdk_nrf54l15_cpuapp + integration_platforms: + - nrf52840dk_nrf52840 From 2570119b1097b0dd688f34aab1383cea9aef3c4a Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Mon, 29 Jan 2024 15:04:01 +0100 Subject: [PATCH 1563/2300] [nrf fromlist] drivers: timer: grtc: Fix ticks calculation for GRTC Fixed calculation of GRTC ticks inside `z_nrf_grtc_timer_get_ticks()` function. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71688 Signed-off-by: Adam Kondraciuk --- drivers/timer/nrf_grtc_timer.c | 7 +++++-- include/zephyr/drivers/timer/nrf_grtc_timer.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index c9e51db2469..3ed746e692a 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -319,18 +319,21 @@ uint64_t z_nrf_grtc_timer_get_ticks(k_timeout_t t) int64_t curr_tick; int64_t result; int64_t abs_ticks; + int64_t grtc_ticks; curr_time = counter(); curr_tick = sys_clock_tick_get(); + grtc_ticks = t.ticks * CYC_PER_TICK; abs_ticks = Z_TICK_ABS(t.ticks); if (abs_ticks < 0) { /* relative timeout */ - return (t.ticks > (int64_t)COUNTER_SPAN) ? -EINVAL : (curr_time + t.ticks); + return (grtc_ticks > (int64_t)COUNTER_SPAN) ? + -EINVAL : (curr_time + grtc_ticks); } /* absolute timeout */ - result = abs_ticks - curr_tick; + result = (abs_ticks - curr_tick) * CYC_PER_TICK; if (result > (int64_t)COUNTER_SPAN) { return -EINVAL; diff --git a/include/zephyr/drivers/timer/nrf_grtc_timer.h b/include/zephyr/drivers/timer/nrf_grtc_timer.h index 172a904fdef..76fa7b70346 100644 --- a/include/zephyr/drivers/timer/nrf_grtc_timer.h +++ b/include/zephyr/drivers/timer/nrf_grtc_timer.h @@ -111,7 +111,7 @@ uint64_t z_nrf_grtc_timer_compare_read(int32_t chan); * * @param chan Channel ID. * - * @param target_time Absolute target time in ticks. + * @param target_time Absolute target time in GRTC ticks. * * @param handler User function called in the context of the GRTC interrupt. * From 8a5c578ffa948a1b0cbd8242f631c946f54d1fce Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 19 Dec 2023 15:25:08 +0100 Subject: [PATCH 1564/2300] [nrf fromlist] drivers: timer: grtc: Update GRTC driver This commit aligns the GRTC driver to changes introduced in hal_nordic. Some of the features regarding GRTC sleep/wakeup functionality has been modified and moved out to the nrfx driver's code. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71688 Signed-off-by: Adam Kondraciuk --- drivers/timer/Kconfig.nrf_grtc | 13 +++- drivers/timer/nrf_grtc_timer.c | 87 ++++++-------------------- modules/hal_nordic/nrfx/CMakeLists.txt | 15 ++++- 3 files changed, 45 insertions(+), 70 deletions(-) diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc index 442c524fd19..444d13aab31 100644 --- a/drivers/timer/Kconfig.nrf_grtc +++ b/drivers/timer/Kconfig.nrf_grtc @@ -40,9 +40,20 @@ config NRF_GRTC_TIMER_CLOCK_MANAGEMENT the GRTC. Usually this is only needed by the processor that is starting the SYSCOUNTER, but can be shared by multiple processors in the system. -config NRF_GRTC_SLEEP_MINIMUM_LATENCY +config NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY int default 1000 depends on NRF_GRTC_SLEEP_ALLOWED + 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 + NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY period makes no sense. + +config NRF_GRTC_TIMER_AUTO_KEEP_ALIVE + bool + default y if NRF_GRTC_START_SYSCOUNTER + help + This feature prevents the SYSCOUNTER to sleep when any core is in + active state. endif # NRF_GRTC_TIMER diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 3ed746e692a..51f00687e7e 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -29,12 +29,6 @@ #define CHAN_COUNT NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS #define EXT_CHAN_COUNT (CHAN_COUNT - 1) -/* The reset value of waketime is 1, which doesn't seem to work. - * It's being looked into, but for the time being use 4. - * Timeout must always be higher than waketime, so setting that to 5. - */ -#define WAKETIME (4) -#define TIMEOUT (WAKETIME + 1) #ifndef GRTC_SYSCOUNTERL_VALUE_Msk #define GRTC_SYSCOUNTERL_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERL_VALUE_Msk @@ -55,9 +49,6 @@ #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) -/* The maximum SYSCOUNTERVALID settling time equals 1x32k cycles + 20x1MHz cycles. */ -#define GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US 51 - #if defined(CONFIG_TEST) const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); #endif @@ -78,36 +69,6 @@ static nrfx_grtc_channel_t system_clock_channel_data = { __ASSERT_NO_MSG((NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK & (1UL << (chan))) && \ ((chan) != system_clock_channel_data.channel)) -static inline void grtc_active_set(void) -{ -#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) - nrfy_grtc_sys_counter_active_set(NRF_GRTC, true); - while (!nrfy_grtc_sys_conter_ready_check(NRF_GRTC)) { - } -#else - nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, true); - k_busy_wait(GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US); -#endif -} - -static inline void grtc_wakeup(void) -{ - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - grtc_active_set(); - } -} - -static inline void grtc_sleep(void) -{ - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { -#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) - nrfy_grtc_sys_counter_active_set(NRF_GRTC, false); -#else - nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, false); -#endif - } -} - static inline uint64_t counter_sub(uint64_t a, uint64_t b) { return (a - b); @@ -116,10 +77,7 @@ static inline uint64_t counter_sub(uint64_t a, uint64_t b) static inline uint64_t counter(void) { uint64_t now; - - grtc_wakeup(); nrfx_grtc_syscounter_get(&now); - grtc_sleep(); return now; } @@ -141,10 +99,8 @@ static inline uint64_t get_comparator(uint32_t chan) static void system_timeout_set(uint64_t value) { if (value <= NRF_GRTC_SYSCOUNTER_CCADD_MASK) { - grtc_wakeup(); nrfx_grtc_syscounter_cc_relative_set(&system_clock_channel_data, value, true, NRFX_GRTC_CC_RELATIVE_SYSCOUNTER); - grtc_sleep(); } else { nrfx_grtc_syscounter_cc_absolute_set(&system_clock_channel_data, value + counter(), true); @@ -373,6 +329,7 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ uint64_t capt_time; + nrfx_err_t result; IS_CHANNEL_ALLOWED_ASSERT(chan); @@ -383,8 +340,10 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ return -EBUSY; } - - capt_time = nrfy_grtc_sys_counter_cc_get(NRF_GRTC, chan); + result = nrfx_grtc_syscounter_cc_value_read(chan, &capt_time); + if (result != NRFX_SUCCESS) { + return -EPERM; + } __ASSERT_NO_MSG(capt_time < COUNTER_SPAN); @@ -399,16 +358,22 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) nrfx_err_t err_code; static uint8_t systemoff_channel; uint64_t now = counter(); + nrfx_grtc_sleep_config_t sleep_cfg; /* Minimum time that ensures valid execution of system-off procedure. */ - uint32_t minimum_latency_us = nrfy_grtc_waketime_get(NRF_GRTC) + - nrfy_grtc_timeout_get(NRF_GRTC) + - CONFIG_NRF_GRTC_SLEEP_MINIMUM_LATENCY; + uint32_t minimum_latency_us; uint32_t chan; int ret; + nrfx_grtc_sleep_configuration_get(&sleep_cfg); + minimum_latency_us = (sleep_cfg.waketime + sleep_cfg.timeout) * USEC_PER_SEC / 32768 + + CONFIG_NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY; + sleep_cfg.auto_mode = false; + nrfx_grtc_sleep_configure(&sleep_cfg); + if (minimum_latency_us > wake_time_us) { return -EINVAL; } + k_spinlock_key_t key = k_spin_lock(&lock); err_code = nrfx_grtc_channel_alloc(&systemoff_channel); @@ -417,7 +382,9 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) return -ENOMEM; } (void)nrfx_grtc_syscounter_cc_int_disable(systemoff_channel); - ret = compare_set(systemoff_channel, now + wake_time_us, NULL, NULL); + ret = compare_set(systemoff_channel, + now + wake_time_us * sys_clock_hw_cycles_per_sec() / USEC_PER_SEC, NULL, + NULL); if (ret < 0) { k_spin_unlock(&lock, key); return ret; @@ -433,7 +400,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) } /* Make sure that wake_time_us was not triggered yet. */ - if (nrfy_grtc_sys_counter_compare_event_check(NRF_GRTC, systemoff_channel)) { + if (nrfx_grtc_syscounter_compare_event_check(systemoff_channel)) { k_spin_unlock(&lock, key); return -EINVAL; } @@ -444,7 +411,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) MAX_CC_LATCH_WAIT_TIME_US; k_busy_wait(wait_time); #if NRF_GRTC_HAS_CLKSEL - nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFXO); + nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); #endif k_spin_unlock(&lock, key); return 0; @@ -485,16 +452,9 @@ static int sys_clock_driver_init(void) #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. */ - nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFCLK); + nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFCLK); #endif -#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) - /* SYSCOUNTER needs to be turned off before initialization. */ - nrfy_grtc_sys_counter_set(NRF_GRTC, false); - nrfy_grtc_timeout_set(NRF_GRTC, TIMEOUT); - nrfy_grtc_waketime_set(NRF_GRTC, WAKETIME); -#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_grtc_irq_handler, 0, 0); err_code = nrfx_grtc_init(0); @@ -507,9 +467,6 @@ static int sys_clock_driver_init(void) if (err_code != NRFX_SUCCESS) { return err_code == NRFX_ERROR_NO_MEM ? -ENOMEM : -EPERM; } - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - nrfy_grtc_sys_counter_auto_mode_set(NRF_GRTC, false); - } #else err_code = nrfx_grtc_channel_alloc(&system_clock_channel_data.channel); if (err_code != NRFX_SUCCESS) { @@ -517,10 +474,6 @@ static int sys_clock_driver_init(void) } #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - if (!IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - grtc_active_set(); - } - int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set(CYC_PER_TICK); diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 463c4790743..adce870fc3a 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -127,8 +127,19 @@ if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM) zephyr_library_sources(${SRC_DIR}/nrfx_twi_twim.c) endif() -if (CONFIG_NRF_GRTC_TIMER AND CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) - zephyr_library_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) +if (CONFIG_NRF_GRTC_TIMER) + if (CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) + zephyr_library_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) + endif() + if (CONFIG_NRF_GRTC_SLEEP_ALLOWED) + zephyr_compile_definitions(NRFX_GRTC_CONFIG_SLEEP_ALLOWED=1) + endif() + if (CONFIG_NRF_GRTC_TIMER_AUTO_KEEP_ALIVE) + zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOEN=1) + endif() + if (CONFIG_NRF_GRTC_START_SYSCOUNTER) + zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOSTART=1) + endif() endif() # Inject HAL "CONFIG_NFCT_PINS_AS_GPIOS" definition if user requests to From f50ad41dd6ea61d36bece05171768e12f5ceb5a3 Mon Sep 17 00:00:00 2001 From: Martin Tverdal Date: Mon, 15 Apr 2024 09:53:43 +0200 Subject: [PATCH 1565/2300] [nrf fromtree] drivers: clock_control: Update RC accuracy nRF devices It is only nrf52 that has 500ppm accuracy on LFRC. All others have 250ppm. Signed-off-by: Martin Tverdal (cherry picked from commit 4f68adfbd54c6828029621c5fca39f11ea411623) --- drivers/clock_control/Kconfig.nrf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index 453aac5b5d0..8b30772f26c 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -130,7 +130,8 @@ endif # CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION choice CLOCK_CONTROL_NRF_ACCURACY_PPM prompt "32KHz clock accuracy" - default CLOCK_CONTROL_NRF_K32SRC_500PPM if CLOCK_CONTROL_NRF_K32SRC_RC + default CLOCK_CONTROL_NRF_K32SRC_500PPM if CLOCK_CONTROL_NRF_K32SRC_RC && SOC_COMPATIBLE_NRF52X + default CLOCK_CONTROL_NRF_K32SRC_250PPM if CLOCK_CONTROL_NRF_K32SRC_RC default CLOCK_CONTROL_NRF_K32SRC_50PPM config CLOCK_CONTROL_NRF_K32SRC_500PPM From 570c8c21ab04bcda1059cbb2af3ee872d4a6d364 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Fri, 19 Apr 2024 17:45:35 +0530 Subject: [PATCH 1566/2300] [nrf fromtree] net: l2: wifi: Protect processing of nm data Use lock while accessing nm data. One of the use case is while setting regulatory, it accesses nm data, while from some other place also it can be accessed same time. Protected the nm data processing. Signed-off-by: Ajay Parida (cherry picked from commit b93002655e06eaf496bd88c8e2c740dc4d8a4a6b) --- subsys/net/l2/wifi/wifi_nm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/subsys/net/l2/wifi/wifi_nm.c b/subsys/net/l2/wifi/wifi_nm.c index 4f3e2d239a1..b365f32cbc6 100644 --- a/subsys/net/l2/wifi/wifi_nm.c +++ b/subsys/net/l2/wifi/wifi_nm.c @@ -10,6 +10,9 @@ LOG_MODULE_REGISTER(wifi_nm, CONFIG_WIFI_NM_LOG_LEVEL); #include #include +/* Used to protect nm data */ +static K_MUTEX_DEFINE(wifi_nm_lock); + struct wifi_nm_instance *wifi_nm_get_instance(const char *name) { STRUCT_SECTION_FOREACH(wifi_nm_instance, nm) { @@ -27,13 +30,16 @@ struct wifi_nm_instance *wifi_nm_get_instance_iface(struct net_if *iface) return false; } + k_mutex_lock(&wifi_nm_lock, K_FOREVER); STRUCT_SECTION_FOREACH(wifi_nm_instance, nm) { for (int i = 0; i < CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES; i++) { if (nm->mgd_ifaces[i] == iface) { + k_mutex_unlock(&wifi_nm_lock); return nm; } } } + k_mutex_unlock(&wifi_nm_lock); return NULL; } @@ -48,12 +54,15 @@ int wifi_nm_register_mgd_iface(struct wifi_nm_instance *nm, struct net_if *iface return -ENOTSUP; } + k_mutex_lock(&wifi_nm_lock, K_FOREVER); for (int i = 0; i < CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES; i++) { if (!nm->mgd_ifaces[i]) { nm->mgd_ifaces[i] = iface; + k_mutex_unlock(&wifi_nm_lock); return 0; } } + k_mutex_unlock(&wifi_nm_lock); return -ENOMEM; } @@ -64,12 +73,15 @@ int wifi_nm_unregister_mgd_iface(struct wifi_nm_instance *nm, struct net_if *ifa return -EINVAL; } + k_mutex_lock(&wifi_nm_lock, K_FOREVER); for (int i = 0; i < CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES; i++) { if (nm->mgd_ifaces[i] == iface) { nm->mgd_ifaces[i] = NULL; + k_mutex_unlock(&wifi_nm_lock); return 0; } } + k_mutex_unlock(&wifi_nm_lock); return -ENOENT; } From 2ef7c817ee362e88376e36e60c4a4a5dee6a3a94 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Mon, 22 Apr 2024 12:33:40 +0530 Subject: [PATCH 1567/2300] [nrf fromtree] net: l2: wifi: Fix for wrong return type The function should return NULL instead of false in case of failure. Signed-off-by: Ajay Parida (cherry picked from commit 02f4e7163323c7be208056b45cd76d69f43f99d1) --- subsys/net/l2/wifi/wifi_nm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_nm.c b/subsys/net/l2/wifi/wifi_nm.c index b365f32cbc6..588992634bf 100644 --- a/subsys/net/l2/wifi/wifi_nm.c +++ b/subsys/net/l2/wifi/wifi_nm.c @@ -27,7 +27,7 @@ struct wifi_nm_instance *wifi_nm_get_instance(const char *name) struct wifi_nm_instance *wifi_nm_get_instance_iface(struct net_if *iface) { if (!iface || !net_if_is_wifi(iface)) { - return false; + return NULL; } k_mutex_lock(&wifi_nm_lock, K_FOREVER); From b320a9e142f2249008f7c2c8e9a5b625a6fe56b6 Mon Sep 17 00:00:00 2001 From: Martin Tverdal Date: Mon, 22 Apr 2024 13:44:04 +0200 Subject: [PATCH 1568/2300] [nrf fromtree] drivers: clock_control: Update XTAL accuracy on nRF54L We are not able to achive 50ppm on nRF54L. Working on fixing it propperly, but untill we do set what we get. Signed-off-by: Martin Tverdal (cherry picked from commit dbf62a5a2a84edfe3fce4d6dc3524d3e18dea59c) --- drivers/clock_control/Kconfig.nrf | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index 8b30772f26c..725a7694986 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -132,6 +132,7 @@ choice CLOCK_CONTROL_NRF_ACCURACY_PPM prompt "32KHz clock accuracy" default CLOCK_CONTROL_NRF_K32SRC_500PPM if CLOCK_CONTROL_NRF_K32SRC_RC && SOC_COMPATIBLE_NRF52X default CLOCK_CONTROL_NRF_K32SRC_250PPM if CLOCK_CONTROL_NRF_K32SRC_RC + default CLOCK_CONTROL_NRF_K32SRC_150PPM if CLOCK_CONTROL_NRF_K32SRC_XTAL && SOC_SERIES_NRF54LX default CLOCK_CONTROL_NRF_K32SRC_50PPM config CLOCK_CONTROL_NRF_K32SRC_500PPM From 634bfae60938f9b005f6a14aa15e88798458fbd3 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Wed, 24 Apr 2024 15:51:28 +0530 Subject: [PATCH 1569/2300] [nrf fromlist] net: wifi: Unicast frames statistics Unicast RX stats It represents total number of unicast (any type data, action or any other unicast frames) frames received at firmware level. The actual frames passed to host will be different as firmware may drop packets or some packets may be dropped because of errors. Unicast TX stats Transmission side the unicast packets count states the packets handed over to firmware. The stats taken at firmware level. Actual packets transmission may vary depending upon various factors. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71917 Signed-off-by: Ajay Parida --- include/zephyr/net/net_stats.h | 1 + subsys/net/l2/wifi/wifi_shell.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/zephyr/net/net_stats.h b/include/zephyr/net/net_stats.h index ddaa8d1180f..f5a567fcdbc 100644 --- a/include/zephyr/net/net_stats.h +++ b/include/zephyr/net/net_stats.h @@ -494,6 +494,7 @@ struct net_stats_wifi { struct net_stats_pkts broadcast; struct net_stats_pkts multicast; struct net_stats_pkts errors; + struct net_stats_pkts unicast; }; #if defined(CONFIG_NET_STATISTICS_USER_API) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 9206271b1f8..a81af57d40f 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -846,6 +846,8 @@ static void print_wifi_stats(struct net_if *iface, struct net_stats_wifi *data, PR("Mcast sent : %u\n", data->multicast.tx); PR("Beacons received : %u\n", data->sta_mgmt.beacons_rx); PR("Beacons missed : %u\n", data->sta_mgmt.beacons_miss); + PR("Unicast received : %u\n", data->unicast.rx); + PR("Unicast sent : %u\n", data->unicast.tx); } #endif /* CONFIG_NET_STATISTICS_WIFI && CONFIG_NET_STATISTICS_USER_API */ From 8b560b37f8421c0a68dc0bf3d352ce6a7c8016c5 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Wed, 6 Mar 2024 12:51:46 +0000 Subject: [PATCH 1570/2300] [nrf fromtree] mcumgr/img_mgmt: Fix CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE Usage of the Kconfig, in code, has been missing CONFIG_, so selected or not it did nothing. (cherry picked from commit 1ec7116042f6f32c11ead15b4cc67589370ef7d6) Signed-off-by: Dominik Ermel --- subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 7de448ac78d..29e222d1de9 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -469,7 +469,7 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt) ok = zcbor_tstr_put_lit(zse, "mode") && zcbor_int32_put(zse, BOOTLOADER_MODE); -#if IS_ENABLED(MCUBOOT_BOOTLOADER_NO_DOWNGRADE) +#if IS_ENABLED(CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE) ok = zcbor_tstr_put_lit(zse, "no-downgrade") && zcbor_bool_encode(zse, true); #endif From 99187c89524710cba572477a2cc95ab8d309b563 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Tue, 23 Apr 2024 16:21:08 +0000 Subject: [PATCH 1571/2300] [nrf fromtree] mcumgr/img_mgmt: Fix zcbor logic in os_mgmt_bootloader_info There have been to problems with the code where zcbor_bool_encode has been fed value instead of expected pointer and the result of previous zcbor_encode operations has not been taken to evaluate value of ok status. The change also replaces usage of #if IS_ENABLED with #ifdef, as IS_ENABLED should not be used outside if(). (cherry picked from commit c007e717d4bda353a8147c90fbe21456aa44b4c8) Signed-off-by: Dominik Ermel --- subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 29e222d1de9..9fc02f81661 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -469,9 +469,9 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt) ok = zcbor_tstr_put_lit(zse, "mode") && zcbor_int32_put(zse, BOOTLOADER_MODE); -#if IS_ENABLED(CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE) - ok = zcbor_tstr_put_lit(zse, "no-downgrade") && - zcbor_bool_encode(zse, true); +#ifdef CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE + ok = ok && zcbor_tstr_put_lit(zse, "no-downgrade") && + zcbor_bool_encode(zse, &(bool){true}); #endif } else { return OS_MGMT_ERR_QUERY_YIELDS_NO_ANSWER; From bdda11bdb687157e55b44e3053bb0966ecf75d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Mon, 29 Apr 2024 16:30:01 +0200 Subject: [PATCH 1572/2300] [nrf fromlist] boards: nordic: Add PWM support for LEDs on nRF54 DKs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds support for first possible LED to be connected with HW PWM. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72010 Signed-off-by: Karol Lasończyk --- .../nrf54h20dk_nrf54h20-pinctrl.dtsi | 14 ++++++++++++++ .../nrf54h20dk_nrf54h20_cpuapp.dts | 15 +++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 13 +++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.dts | 15 +++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay | 15 +++++++++++++++ 5 files changed, 72 insertions(+) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi index 6c6da3fa747..cc6b5e90beb 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -50,4 +50,18 @@ ; }; }; + + /omit-if-no-ref/ pwm120_default: pwm120_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm120_sleep: pwm120_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; + }; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 4b04ff8dcd4..aee17df9f8f 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -31,6 +31,7 @@ led1 = &led1; led2 = &led2; led3 = &led3; + pwm-led0 = &pwm_led0; sw0 = &button0; sw1 = &button1; sw2 = &button2; @@ -89,6 +90,13 @@ }; }; + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm120 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + }; + }; + prng: prng { compatible = "nordic,entropy-prng"; status = "okay"; @@ -193,3 +201,10 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-names = "default", "sleep"; hw-flow-control; }; + +&pwm120 { + status = "okay"; + pinctrl-0 = <&pwm120_default>; + pinctrl-1 = <&pwm120_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 31c2f820f3f..ac6cd2e4357 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -64,4 +64,17 @@ low-power-enable; }; }; + + pwm20_default: pwm20_default { + group1 { + psels = ; + }; + }; + + pwm20_sleep: pwm20_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; }; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index f64952ba886..e5f808de44b 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -43,6 +43,13 @@ }; }; + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm20 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + }; + }; + buttons { compatible = "gpio-keys"; button0: button_0 { @@ -72,6 +79,7 @@ led1 = &led1; led2 = &led2; led3 = &led3; + pwm-led0 = &pwm_led0; watchdog0 = &wdt30; sw0 = &button0; sw1 = &button1; @@ -205,3 +213,10 @@ &adc { status = "okay"; }; + +&pwm20 { + status = "okay"; + pinctrl-0 = <&pwm20_default>; + pinctrl-1 = <&pwm20_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay index d8262dde994..99ba6ff3062 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay @@ -36,3 +36,18 @@ &button3 { gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; }; + +&pinctrl { + /omit-if-no-ref/ pwm20_default: pwm20_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; From abc1ea146b74aabdd075d158caac0aed5e42593a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:05 +0200 Subject: [PATCH 1573/2300] Revert "[nrf fromlist] boards: nordic: Add PWM support for LEDs on nRF54 DKs" This reverts commit bdda11bdb687157e55b44e3053bb0966ecf75d4f. Signed-off-by: Gerard Marull-Paretas --- .../nrf54h20dk_nrf54h20-pinctrl.dtsi | 14 -------------- .../nrf54h20dk_nrf54h20_cpuapp.dts | 15 --------------- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 13 ------------- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 15 --------------- .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay | 15 --------------- 5 files changed, 72 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi index cc6b5e90beb..6c6da3fa747 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -50,18 +50,4 @@ ; }; }; - - /omit-if-no-ref/ pwm120_default: pwm120_default { - group1 { - psels = ; - }; - }; - - /omit-if-no-ref/ pwm120_sleep: pwm120_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; - }; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index aee17df9f8f..4b04ff8dcd4 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -31,7 +31,6 @@ led1 = &led1; led2 = &led2; led3 = &led3; - pwm-led0 = &pwm_led0; sw0 = &button0; sw1 = &button1; sw2 = &button2; @@ -90,13 +89,6 @@ }; }; - pwmleds { - compatible = "pwm-leds"; - pwm_led0: pwm_led_0 { - pwms = <&pwm120 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; - }; - }; - prng: prng { compatible = "nordic,entropy-prng"; status = "okay"; @@ -201,10 +193,3 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-names = "default", "sleep"; hw-flow-control; }; - -&pwm120 { - status = "okay"; - pinctrl-0 = <&pwm120_default>; - pinctrl-1 = <&pwm120_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index ac6cd2e4357..31c2f820f3f 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -64,17 +64,4 @@ low-power-enable; }; }; - - pwm20_default: pwm20_default { - group1 { - psels = ; - }; - }; - - pwm20_sleep: pwm20_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; }; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index e5f808de44b..f64952ba886 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -43,13 +43,6 @@ }; }; - pwmleds { - compatible = "pwm-leds"; - pwm_led0: pwm_led_0 { - pwms = <&pwm20 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; - }; - }; - buttons { compatible = "gpio-keys"; button0: button_0 { @@ -79,7 +72,6 @@ led1 = &led1; led2 = &led2; led3 = &led3; - pwm-led0 = &pwm_led0; watchdog0 = &wdt30; sw0 = &button0; sw1 = &button1; @@ -213,10 +205,3 @@ &adc { status = "okay"; }; - -&pwm20 { - status = "okay"; - pinctrl-0 = <&pwm20_default>; - pinctrl-1 = <&pwm20_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay index 99ba6ff3062..d8262dde994 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay @@ -36,18 +36,3 @@ &button3 { gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; }; - -&pinctrl { - /omit-if-no-ref/ pwm20_default: pwm20_default { - group1 { - psels = ; - }; - }; - - /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; -}; From 29db402584a4ac325a894e9c054e9da494ec1151 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:05 +0200 Subject: [PATCH 1574/2300] Revert "[nrf fromtree] mcumgr/img_mgmt: Fix zcbor logic in os_mgmt_bootloader_info" This reverts commit 99187c89524710cba572477a2cc95ab8d309b563. Signed-off-by: Gerard Marull-Paretas --- subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 9fc02f81661..29e222d1de9 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -469,9 +469,9 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt) ok = zcbor_tstr_put_lit(zse, "mode") && zcbor_int32_put(zse, BOOTLOADER_MODE); -#ifdef CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE - ok = ok && zcbor_tstr_put_lit(zse, "no-downgrade") && - zcbor_bool_encode(zse, &(bool){true}); +#if IS_ENABLED(CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE) + ok = zcbor_tstr_put_lit(zse, "no-downgrade") && + zcbor_bool_encode(zse, true); #endif } else { return OS_MGMT_ERR_QUERY_YIELDS_NO_ANSWER; From 24611ecb035155b0c05e4e0dfd895a6e535066f7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:06 +0200 Subject: [PATCH 1575/2300] Revert "[nrf fromtree] mcumgr/img_mgmt: Fix CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE" This reverts commit 8b560b37f8421c0a68dc0bf3d352ce6a7c8016c5. Signed-off-by: Gerard Marull-Paretas --- subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 29e222d1de9..7de448ac78d 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -469,7 +469,7 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt) ok = zcbor_tstr_put_lit(zse, "mode") && zcbor_int32_put(zse, BOOTLOADER_MODE); -#if IS_ENABLED(CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE) +#if IS_ENABLED(MCUBOOT_BOOTLOADER_NO_DOWNGRADE) ok = zcbor_tstr_put_lit(zse, "no-downgrade") && zcbor_bool_encode(zse, true); #endif From fe24fc440db509ab04bb150ee0044ff3b324a422 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:06 +0200 Subject: [PATCH 1576/2300] Revert "[nrf fromtree] tests: drivers: spi: Add negative test cases" This reverts commit 6c515dd5fc7c777e0105cf5bb66c51b036f8b6dd. Signed-off-by: Gerard Marull-Paretas --- .../spi/spi_error_cases/CMakeLists.txt | 10 - .../boards/nrf52840dk_nrf52840.overlay | 72 ----- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 78 ------ tests/drivers/spi/spi_error_cases/prj.conf | 7 - tests/drivers/spi/spi_error_cases/src/main.c | 263 ------------------ .../drivers/spi/spi_error_cases/testcase.yaml | 12 - 6 files changed, 442 deletions(-) delete mode 100644 tests/drivers/spi/spi_error_cases/CMakeLists.txt delete mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay delete mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_error_cases/prj.conf delete mode 100644 tests/drivers/spi/spi_error_cases/src/main.c delete mode 100644 tests/drivers/spi/spi_error_cases/testcase.yaml diff --git a/tests/drivers/spi/spi_error_cases/CMakeLists.txt b/tests/drivers/spi/spi_error_cases/CMakeLists.txt deleted file mode 100644 index 2ac4bdbef4d..00000000000 --- a/tests/drivers/spi/spi_error_cases/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(spi_error_cases) - -FILE(GLOB app_sources src/*.c) - -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 183d6da9967..00000000000 --- a/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi3_default_alt: spi3_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi3_sleep_alt: spi3_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi1_sleep_alt: spi1_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -dut_spi: &spi3 { - status = "okay"; - pinctrl-0 = <&spi3_default_alt>; - pinctrl-1 = <&spi3_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <200000>; - }; -}; - -dut_spis: &spi1 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-1 = <&spi1_sleep_alt>; - pinctrl-names = "default", "sleep"; - dut_spis_dt: test-spis-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <200000>; - }; -}; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 2a0394c3f60..00000000000 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi22_default_alt: spi22_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi22_sleep_alt: spi22_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi21_default_alt: spi21_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi21_sleep_alt: spi21_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -&gpio2 { - status = "okay"; -}; - -dut_spi: &spi22 { - status = "okay"; - pinctrl-0 = <&spi22_default_alt>; - pinctrl-1 = <&spi22_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <200000>; - }; -}; - -dut_spis: &spi21 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi21_default_alt>; - pinctrl-1 = <&spi21_sleep_alt>; - pinctrl-names = "default", "sleep"; - dut_spis_dt: test-spis-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <200000>; - }; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; diff --git a/tests/drivers/spi/spi_error_cases/prj.conf b/tests/drivers/spi/spi_error_cases/prj.conf deleted file mode 100644 index 1161e03f477..00000000000 --- a/tests/drivers/spi/spi_error_cases/prj.conf +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG_SPI=y -CONFIG_SPI_SLAVE=y -CONFIG_GPIO=y -CONFIG_POLL=y -CONFIG_SPI_ASYNC=y -CONFIG_SPI_EXTENDED_MODES=y -CONFIG_ZTEST=y diff --git a/tests/drivers/spi/spi_error_cases/src/main.c b/tests/drivers/spi/spi_error_cases/src/main.c deleted file mode 100644 index 0b44812db84..00000000000 --- a/tests/drivers/spi/spi_error_cases/src/main.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -#define SPI_MODE (SPI_MODE_CPOL | SPI_WORD_SET(8) | SPI_LINES_SINGLE) -#define SPIM_OP (SPI_OP_MODE_MASTER | SPI_MODE) -#define SPIS_OP (SPI_OP_MODE_SLAVE | SPI_MODE) - -static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); -static struct spi_dt_spec spis = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spis_dt), SPIS_OP, 0); - -#define MEMORY_SECTION(node) \ - COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ - (__attribute__((__section__( \ - LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ - ()) - -static uint8_t spim_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spi)); -static uint8_t spis_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spis)); - -struct test_data { - int spim_alloc_idx; - int spis_alloc_idx; - struct spi_buf_set sets[4]; - struct spi_buf_set *mtx_set; - struct spi_buf_set *mrx_set; - struct spi_buf_set *stx_set; - struct spi_buf_set *srx_set; - struct spi_buf bufs[4]; -}; - -static struct test_data tdata; - -/* Allocate buffer from spim or spis space. */ -static uint8_t *buf_alloc(size_t len, bool spim) -{ - int *idx = spim ? &tdata.spim_alloc_idx : &tdata.spis_alloc_idx; - uint8_t *buf = spim ? spim_buffer : spis_buffer; - size_t total = spim ? sizeof(spim_buffer) : sizeof(spis_buffer); - uint8_t *rv; - - if (*idx + len > total) { - zassert_false(true); - - return NULL; - } - - rv = &buf[*idx]; - *idx += len; - - return rv; -} - -ZTEST(spi_error_cases, test_SPI_HALF_DUPLEX_not_supported) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_HALF_DUPLEX; - spis_invalid.config.operation |= SPI_HALF_DUPLEX; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -ENOTSUP, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_SPI_OP_MODE_invalid) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_OP_MODE_SLAVE; - spis_invalid.config.operation &= !SPI_OP_MODE_SLAVE; - - /* Check that Operation Mode Slave on spim is not supported */ - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - /* Check that Operation Mode Master on spis is not supported */ - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_SPI_MODE_LOOP_not_supported) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_MODE_LOOP; - spis_invalid.config.operation |= SPI_MODE_LOOP; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_only_SPI_LINES_SINGLE_supported) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_LINES_DUAL; - spis_invalid.config.operation |= SPI_LINES_DUAL; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); - - spim_invalid = spim; - spis_invalid = spis; - spim_invalid.config.operation |= SPI_LINES_QUAD; - spis_invalid.config.operation |= SPI_LINES_QUAD; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); - - spim_invalid = spim; - spis_invalid = spis; - spim_invalid.config.operation |= SPI_LINES_OCTAL; - spis_invalid.config.operation |= SPI_LINES_OCTAL; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_only_8BIT_supported) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_WORD_SET(16); - spis_invalid.config.operation |= SPI_WORD_SET(16); - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_unsupported_frequency) -{ - int rv; - struct spi_dt_spec spim_invalid = spim; - - spim_invalid.config.frequency = 124999; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); -} - -ZTEST(spi_error_cases, test_CS_unsupported_on_slave) -{ - int slave_rv; - struct spi_dt_spec spis_invalid = spis; - struct gpio_dt_spec test_gpio = { DEVICE_DT_GET(DT_NODELABEL(gpio1)), 10, GPIO_ACTIVE_LOW }; - - spis_invalid.config.cs.gpio = test_gpio; - - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_scattered_tx_buf_not_supported) -{ - int slave_rv; - - tdata.sets[2].count = 2; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_scattered_rx_buf_not_supported) -{ - int slave_rv; - - tdata.sets[3].count = 2; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_tx_buf_too_big) -{ - int slave_rv; - - tdata.bufs[2].len = (size_t)65536; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_rx_buf_too_big) -{ - int slave_rv; - - tdata.bufs[3].len = (size_t)65536; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_tx_buf_not_in_ram) -{ - int slave_rv; - - tdata.bufs[2].buf = (void *)0x12345678; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); -} - -static void before(void *not_used) -{ - ARG_UNUSED(not_used); - size_t len = 16; - - memset(&tdata, 0, sizeof(tdata)); - for (size_t i = 0; i < sizeof(spim_buffer); i++) { - spim_buffer[i] = (uint8_t)i; - } - for (size_t i = 0; i < sizeof(spis_buffer); i++) { - spis_buffer[i] = (uint8_t)i; - } - - for (int i = 0; i < 4; i++) { - tdata.bufs[i].buf = buf_alloc(len, i < 2); - tdata.bufs[i].len = len; - tdata.sets[i].buffers = &tdata.bufs[i]; - tdata.sets[i].count = 1; - } - - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = &tdata.sets[1]; - tdata.stx_set = &tdata.sets[2]; - tdata.srx_set = &tdata.sets[3]; -} - -static void *suite_setup(void) -{ - return NULL; -} - -ZTEST_SUITE(spi_error_cases, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml deleted file mode 100644 index 17cee921111..00000000000 --- a/tests/drivers/spi/spi_error_cases/testcase.yaml +++ /dev/null @@ -1,12 +0,0 @@ -tests: - drivers.spi.spi_error_cases: - depends_on: spi - tags: drivers spi - harness: ztest - harness_config: - fixture: gpio_spi_loopback - platform_allow: - - nrf52840dk_nrf52840 - - nrf54l15pdk_nrf54l15_cpuapp - integration_platforms: - - nrf52840dk_nrf52840 From 754abd0e7e513310b72141f21a82fff0392f9818 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:06 +0200 Subject: [PATCH 1577/2300] Revert "[nrf fromlist] boards: Enable ADC in nRF54L15 PDK configuration" This reverts commit c045098d5a17be01227750fe27b422983ce8b59d. Signed-off-by: Gerard Marull-Paretas --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index f64952ba886..e6ef815e783 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -201,7 +201,3 @@ t-exit-dpd = <35000>; }; }; - -&adc { - status = "okay"; -}; From d20dbb4f5d8fcc496bea2c19517d546f1144559e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:06 +0200 Subject: [PATCH 1578/2300] Revert "[nrf fromtree] tests: boards: nrf: add i2c driver test with TWIS slave" This reverts commit ee43b9ac08c6351aeaee6089fb28c659151596d6. Signed-off-by: Gerard Marull-Paretas --- tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt | 10 -- .../i2c_slave/boards/nrf52840dk_nrf52840.conf | 1 - .../boards/nrf52840dk_nrf52840.overlay | 60 -------- .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 - .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 58 ------- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 63 -------- .../boards/nrf54l15pdk_nrf54l15_cpuapp.conf | 1 - .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 59 ------- tests/boards/nrf/i2c/i2c_slave/prj.conf | 2 - tests/boards/nrf/i2c/i2c_slave/src/main.c | 145 ------------------ tests/boards/nrf/i2c/i2c_slave/testcase.yaml | 12 -- 12 files changed, 413 deletions(-) delete mode 100644 tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/boards/nrf/i2c/i2c_slave/prj.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/src/main.c delete mode 100644 tests/boards/nrf/i2c/i2c_slave/testcase.yaml diff --git a/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt b/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt deleted file mode 100644 index 43130d6a07d..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(i2c_slave) - -FILE(GLOB app_sources src/*.c) - -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index e79ad7a8126..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS1=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 8628731faf4..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,60 +0,0 @@ -/ { - aliases { - i2c-slave = &i2c1; - }; -}; - -&pinctrl { - i2c0_default_alt: i2c0_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c0_sleep_alt: i2c0_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c1_default_alt: i2c1_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c1_sleep_alt: i2c1_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c0 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c0_default_alt>; - pinctrl-1 = <&i2c0_sleep_alt>; - pinctrl-names = "default", "sleep"; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - - -&i2c1 { - compatible = "nordic,nrf-twis"; - status = "okay"; - pinctrl-0 = <&i2c1_default_alt>; - pinctrl-1 = <&i2c1_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index a7bedf1f04b..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS2=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index d473a04f85c..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,58 +0,0 @@ -/ { - aliases { - i2c-slave = &i2c2; - }; -}; - -&pinctrl { - i2c1_default_alt: i2c1_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c1_sleep_alt: i2c1_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c2_default_alt: i2c2_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c2_sleep_alt: i2c2_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c1 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c1_default_alt>; - pinctrl-1 = <&i2c1_sleep_alt>; - pinctrl-names = "default", "sleep"; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - -&i2c2 { - compatible = "nordic,nrf-twis"; - pinctrl-0 = <&i2c2_default_alt>; - pinctrl-1 = <&i2c2_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf deleted file mode 100644 index 157e0a11f72..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS131=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 73d1d85cf45..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,63 +0,0 @@ -/ { - aliases { - i2c-slave = &i2c131; - }; -}; - -&pinctrl { - i2c130_default_alt: i2c130_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c130_sleep_alt: i2c130_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c131_default_alt: i2c131_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c131_sleep_alt: i2c131_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c130 { - compatible = "nordic,nrf-twim"; - status = "okay"; - clock-frequency = ; - pinctrl-0 = <&i2c130_default_alt>; - pinctrl-1 = <&i2c130_sleep_alt>; - pinctrl-names = "default", "sleep"; - memory-regions = <&cpuapp_dma_region>; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - -&i2c131 { - compatible = "nordic,nrf-twis"; - status = "okay"; - clock-frequency = ; - pinctrl-0 = <&i2c131_default_alt>; - pinctrl-1 = <&i2c131_sleep_alt>; - pinctrl-names = "default", "sleep"; - memory-regions = <&cpuapp_dma_region>; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf deleted file mode 100644 index b01af3b36a7..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS22=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index d60e42659ee..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,59 +0,0 @@ -/ { - aliases { - i2c-slave = &i2c22; - }; -}; - -&pinctrl { - i2c21_default_alt: i2c21_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c21_sleep_alt: i2c21_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c22_default_alt: i2c22_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c22_sleep_alt: i2c22_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c21 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c21_default_alt>; - pinctrl-1 = <&i2c21_sleep_alt>; - pinctrl-names = "default", "sleep"; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - -&i2c22 { - compatible = "nordic,nrf-twis"; - status = "okay"; - pinctrl-0 = <&i2c22_default_alt>; - pinctrl-1 = <&i2c22_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/prj.conf b/tests/boards/nrf/i2c/i2c_slave/prj.conf deleted file mode 100644 index 4b19609ecfb..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/prj.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_I2C=y -CONFIG_ZTEST=y diff --git a/tests/boards/nrf/i2c/i2c_slave/src/main.c b/tests/boards/nrf/i2c/i2c_slave/src/main.c deleted file mode 100644 index 1de4b16bc2c..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/src/main.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include - -#if CONFIG_NRFX_TWIS1 -#define I2C_S_INSTANCE 1 -#elif CONFIG_NRFX_TWIS2 -#define I2C_S_INSTANCE 2 -#elif CONFIG_NRFX_TWIS22 -#define I2C_S_INSTANCE 22 -#elif CONFIG_NRFX_TWIS131 -#define I2C_S_INSTANCE 131 -#else -#error "TWIS instance not enabled or not supported" -#endif - -#define NODE_SENSOR DT_NODELABEL(sensor) -#define NODE_TWIS DT_ALIAS(i2c_slave) - -#define TWIS_MEMORY_SECTION \ - COND_CODE_1(DT_NODE_HAS_PROP(NODE_TWIS, memory_regions), \ - (__attribute__((__section__( \ - LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(NODE_TWIS, memory_regions)))))), \ - ()) - -#define TEST_DATA_SIZE 6 -static const uint8_t msg[TEST_DATA_SIZE] = "Nordic"; -static const nrfx_twis_t twis = NRFX_TWIS_INSTANCE(I2C_S_INSTANCE); - -static uint8_t i2c_slave_buffer[TEST_DATA_SIZE] TWIS_MEMORY_SECTION; -static uint8_t i2c_master_buffer[TEST_DATA_SIZE]; -struct i2c_api_twis_fixture { - const struct device *dev; - uint8_t addr; - uint8_t *const master_buffer; - uint8_t *const slave_buffer; -}; - -void i2s_slave_handler(nrfx_twis_evt_t const *p_event) -{ - switch (p_event->type) { - case NRFX_TWIS_EVT_READ_REQ: - nrfx_twis_tx_prepare(&twis, i2c_slave_buffer, TEST_DATA_SIZE); - TC_PRINT("TWIS event: read request\n"); - break; - case NRFX_TWIS_EVT_READ_DONE: - TC_PRINT("TWIS event: read done\n"); - break; - case NRFX_TWIS_EVT_WRITE_REQ: - nrfx_twis_rx_prepare(&twis, i2c_slave_buffer, TEST_DATA_SIZE); - TC_PRINT("TWIS event: write request\n"); - break; - case NRFX_TWIS_EVT_WRITE_DONE: - zassert_mem_equal(i2c_slave_buffer, msg, TEST_DATA_SIZE); - TC_PRINT("TWIS event: write done\n"); - break; - default: - TC_PRINT("TWIS event: %d\n", p_event->type); - break; - } -} - -static void *test_setup(void) -{ - static struct i2c_api_twis_fixture fixture = { - .dev = DEVICE_DT_GET(DT_BUS(NODE_SENSOR)), - .addr = DT_REG_ADDR(NODE_SENSOR), - .master_buffer = i2c_master_buffer, - .slave_buffer = i2c_slave_buffer, - }; - const nrfx_twis_config_t config = { - .addr = {fixture.addr, 0}, - .skip_gpio_cfg = true, - .skip_psel_cfg = true, - }; - int ret; - - zassert_equal(NRFX_SUCCESS, nrfx_twis_init(&twis, &config, i2s_slave_handler), - "TWIS initialization failed"); - - PINCTRL_DT_DEFINE(NODE_TWIS); - ret = pinctrl_apply_state(PINCTRL_DT_DEV_CONFIG_GET(NODE_TWIS), PINCTRL_STATE_DEFAULT); - zassert_ok(ret); - - IRQ_CONNECT(DT_IRQN(NODE_TWIS), DT_IRQ(NODE_TWIS, priority), - NRFX_TWIS_INST_HANDLER_GET(I2C_S_INSTANCE), NULL, 0); - - nrfx_twis_enable(&twis); - - return &fixture; -} - -static void cleanup_buffers(void *argc) -{ - struct i2c_api_twis_fixture *fixture = (struct i2c_api_twis_fixture *)argc; - - memset(fixture->slave_buffer, 0, TEST_DATA_SIZE); - memset(fixture->master_buffer, 0, TEST_DATA_SIZE); -} - -ZTEST_USER_F(i2c_api_twis, test_i2c_read_write) -{ - int ret = i2c_write_read(fixture->dev, fixture->addr, msg, TEST_DATA_SIZE, - fixture->master_buffer, TEST_DATA_SIZE); - - zassert_ok(ret); - zassert_mem_equal(fixture->master_buffer, msg, TEST_DATA_SIZE); -} - -ZTEST_USER_F(i2c_api_twis, test_i2c_read) -{ - /* Prepare slave data */ - strncpy(fixture->slave_buffer, msg, TEST_DATA_SIZE); - zassert_mem_equal(fixture->slave_buffer, msg, TEST_DATA_SIZE); - - int ret = i2c_read(fixture->dev, fixture->master_buffer, TEST_DATA_SIZE, fixture->addr); - - zassert_ok(ret); - zassert_mem_equal(fixture->master_buffer, msg, TEST_DATA_SIZE); -} - -ZTEST_USER_F(i2c_api_twis, test_i2c_write) -{ - int ret = i2c_write(fixture->dev, msg, TEST_DATA_SIZE, fixture->addr); - - zassert_ok(ret); - zassert_mem_equal(fixture->slave_buffer, msg, TEST_DATA_SIZE); -} - -ZTEST_SUITE(i2c_api_twis, NULL, test_setup, NULL, cleanup_buffers, NULL); diff --git a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml deleted file mode 100644 index 06213b742ea..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml +++ /dev/null @@ -1,12 +0,0 @@ -tests: - boards.nrf.i2c.i2c_slave: - depends_on: i2c - tags: drivers i2c - harness: ztest - harness_config: - fixture: i2c_loopback - platform_allow: nrf52840dk_nrf52840 nrf5340dk_nrf5340_cpuapp nrf54l15pdk_nrf54l15_cpuapp - integration_platforms: - - nrf52840dk_nrf52840 - - nrf5340dk_nrf5340_cpuapp - - nrf54l15pdk_nrf54l15_cpuapp From 814c4912fbe2f148159e724850e57494dd380134 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:06 +0200 Subject: [PATCH 1579/2300] Revert "[nrf fromtree] soc: nordic: add nRF54 TWIS HAS_HW symbols" This reverts commit 4a4ff2741cb753e5d5e6961f283486b0c062c8ba. Signed-off-by: Gerard Marull-Paretas --- soc/common/nordic_nrf/Kconfig.peripherals | 36 ----------------------- 1 file changed, 36 deletions(-) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index f0adc82d44a..817002f7282 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -530,42 +530,6 @@ config HAS_HW_NRF_TWIS2 config HAS_HW_NRF_TWIS3 def_bool $(dt_nodelabel_enabled_with_compat,i2c3,$(DT_COMPAT_NORDIC_NRF_TWIS)) -config HAS_HW_NRF_TWIS20 - def_bool $(dt_nodelabel_enabled_with_compat,i2c20,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS21 - def_bool $(dt_nodelabel_enabled_with_compat,i2c21,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS22 - def_bool $(dt_nodelabel_enabled_with_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS30 - def_bool $(dt_nodelabel_enabled_with_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS130 - def_bool $(dt_nodelabel_enabled_with_compat,i2c130,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS131 - def_bool $(dt_nodelabel_enabled_with_compat,i2c131,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS132 - def_bool $(dt_nodelabel_enabled_with_compat,i2c132,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS133 - def_bool $(dt_nodelabel_enabled_with_compat,i2c133,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS134 - def_bool $(dt_nodelabel_enabled_with_compat,i2c134,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS135 - def_bool $(dt_nodelabel_enabled_with_compat,i2c135,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS136 - def_bool $(dt_nodelabel_enabled_with_compat,i2c136,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS137 - def_bool $(dt_nodelabel_enabled_with_compat,i2c137,$(DT_COMPAT_NORDIC_NRF_TWIS)) - config HAS_HW_NRF_UART0 def_bool $(dt_nodelabel_enabled_with_compat,uart0,$(DT_COMPAT_NORDIC_NRF_UART)) From f49d5db44aeeb7c91d3c4a88f0aa036e343a20b2 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:07 +0200 Subject: [PATCH 1580/2300] Revert "[nrf fromtree] dts: bindings: regulator: Added regulator-boot-off to allowlists" This reverts commit 94a7ff975973a43864c851af331abc3ae8dfc962. Signed-off-by: Gerard Marull-Paretas --- dts/bindings/regulator/adi,adp5360-regulator.yaml | 1 - dts/bindings/regulator/nordic,npm1300-regulator.yaml | 1 - dts/bindings/regulator/nordic,npm6001-regulator.yaml | 1 - dts/bindings/regulator/x-powers,axp192-regulator.yaml | 1 - 4 files changed, 4 deletions(-) diff --git a/dts/bindings/regulator/adi,adp5360-regulator.yaml b/dts/bindings/regulator/adi,adp5360-regulator.yaml index e54a305e80f..d683bd694ef 100644 --- a/dts/bindings/regulator/adi,adp5360-regulator.yaml +++ b/dts/bindings/regulator/adi,adp5360-regulator.yaml @@ -34,7 +34,6 @@ child-binding: property-allowlist: - regulator-always-on - regulator-boot-on - - regulator-boot-off - regulator-init-microvolt - regulator-min-microvolt - regulator-max-microvolt diff --git a/dts/bindings/regulator/nordic,npm1300-regulator.yaml b/dts/bindings/regulator/nordic,npm1300-regulator.yaml index e0fc28ff8be..c5364a49fe0 100644 --- a/dts/bindings/regulator/nordic,npm1300-regulator.yaml +++ b/dts/bindings/regulator/nordic,npm1300-regulator.yaml @@ -53,7 +53,6 @@ child-binding: property-allowlist: - regulator-always-on - regulator-boot-on - - regulator-boot-off - regulator-min-microvolt - regulator-max-microvolt - regulator-init-microvolt diff --git a/dts/bindings/regulator/nordic,npm6001-regulator.yaml b/dts/bindings/regulator/nordic,npm6001-regulator.yaml index 378f6c0a8ec..34c90c78640 100644 --- a/dts/bindings/regulator/nordic,npm6001-regulator.yaml +++ b/dts/bindings/regulator/nordic,npm6001-regulator.yaml @@ -45,7 +45,6 @@ child-binding: property-allowlist: - regulator-always-on - regulator-boot-on - - regulator-boot-off - regulator-max-microamp - regulator-min-microvolt - regulator-max-microvolt diff --git a/dts/bindings/regulator/x-powers,axp192-regulator.yaml b/dts/bindings/regulator/x-powers,axp192-regulator.yaml index 9072e80727b..98599731c3b 100644 --- a/dts/bindings/regulator/x-powers,axp192-regulator.yaml +++ b/dts/bindings/regulator/x-powers,axp192-regulator.yaml @@ -51,7 +51,6 @@ child-binding: - regulator-max-microvolt - regulator-always-on - regulator-boot-on - - regulator-boot-off - regulator-initial-mode - regulator-allowed-modes From c77fbf1953e80145b3b6378c8a395335105ed02a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:07 +0200 Subject: [PATCH 1581/2300] Revert "[nrf fromtree] tests: drivers: regulator: added regulator-boot-off tests" This reverts commit 8d3fda6b1beb831d5352017afaf3c0a218725c7c. Signed-off-by: Gerard Marull-Paretas --- tests/drivers/regulator/api/app.overlay | 9 -------- tests/drivers/regulator/api/src/main.c | 29 ------------------------- 2 files changed, 38 deletions(-) diff --git a/tests/drivers/regulator/api/app.overlay b/tests/drivers/regulator/api/app.overlay index 6dfeefed18f..25d1d8bb795 100644 --- a/tests/drivers/regulator/api/app.overlay +++ b/tests/drivers/regulator/api/app.overlay @@ -26,14 +26,5 @@ regulator-initial-mode = <1>; regulator-active-discharge = <1>; }; - - reg4: REG4 { - regulator-boot-off; - }; - - reg5: REG5 { - regulator-boot-off; - fake-is-enabled-in-hardware; - }; }; }; diff --git a/tests/drivers/regulator/api/src/main.c b/tests/drivers/regulator/api/src/main.c index 93fa7863085..648d761a8b4 100644 --- a/tests/drivers/regulator/api/src/main.c +++ b/tests/drivers/regulator/api/src/main.c @@ -19,10 +19,6 @@ static const struct device *const reg1 = DEVICE_DT_GET(DT_NODELABEL(reg1)); static const struct device *const reg2 = DEVICE_DT_GET(DT_NODELABEL(reg2)); /* REG3: regulator-max/min-microvolt/microamp, regulator-allowed-modes */ static const struct device *const reg3 = DEVICE_DT_GET(DT_NODELABEL(reg3)); -/* REG4: regulator-boot-off */ -static const struct device *const reg4 = DEVICE_DT_GET(DT_NODELABEL(reg4)); -/* REG5: regulator-boot-off and is_enabled */ -static const struct device *const reg5 = DEVICE_DT_GET(DT_NODELABEL(reg5)); ZTEST(regulator_api, test_parent_dvs_state_set_not_implemented) { @@ -133,10 +129,6 @@ ZTEST(regulator_api, test_common_config) zassert_equal(config->allowed_modes[1], 10U); zassert_equal(config->allowed_modes_cnt, 2U); zassert_equal(REGULATOR_ACTIVE_DISCHARGE_GET_BITS(config->flags), 1U); - - /* reg4: regulator-boot-off */ - config = reg4->config; - zassert_equal(config->flags & REGULATOR_BOOT_OFF, REGULATOR_BOOT_OFF); } ZTEST(regulator_api, test_common_is_init_enabled) @@ -145,8 +137,6 @@ ZTEST(regulator_api, test_common_is_init_enabled) zassert_true(regulator_common_is_init_enabled(reg1)); zassert_true(regulator_common_is_init_enabled(reg2)); zassert_false(regulator_common_is_init_enabled(reg3)); - zassert_false(regulator_common_is_init_enabled(reg4)); - zassert_false(regulator_common_is_init_enabled(reg5)); } ZTEST(regulator_api, test_enable_disable) @@ -181,16 +171,6 @@ ZTEST(regulator_api, test_enable_disable) zassert_equal(regulator_disable(reg0), 0); zassert_equal(regulator_fake_disable_fake.arg0_val, reg0); zassert_equal(regulator_fake_disable_fake.call_count, 2U); - - /* REG5: disabled at boot, can be enabled again */ - zassert_equal(regulator_enable(reg5), 0); - zassert_equal(regulator_fake_enable_fake.call_count, 3U); - - /* 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) @@ -796,8 +776,6 @@ void *setup(void) zassert_true(device_is_ready(reg1)); zassert_true(device_is_ready(reg2)); zassert_true(device_is_ready(reg3)); - zassert_true(device_is_ready(reg4)); - zassert_true(device_is_ready(reg5)); /* REG1, REG2 initialized at init time (always-on/boot-on) */ zassert_equal(regulator_fake_enable_fake.call_count, 2U); @@ -807,13 +785,6 @@ void *setup(void) /* REG3 mode set at init time (initial-mode) */ zassert_equal(regulator_fake_set_mode_fake.call_count, 1U); - /* REG4 already disabled at init time (boot-off) */ - zassert_false(regulator_is_enabled(reg4)); - - /* REG5 explicitly disabled at init time (boot-off) */ - zassert_equal(regulator_fake_disable_fake.call_count, 1U); - zassert_false(regulator_is_enabled(reg5)); - return NULL; } From 3740446eb683a285e96b9dbacdcba5febe718e74 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:07 +0200 Subject: [PATCH 1582/2300] Revert "[nrf fromtree] drivers: regulator: fake: Added is_enabled property" This reverts commit 4698e88891b150910a5c84eb50c4e50be79fc9ad. Signed-off-by: Gerard Marull-Paretas --- drivers/regulator/regulator_fake.c | 6 +----- dts/bindings/regulator/zephyr,fake-regulator.yaml | 7 ------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/regulator/regulator_fake.c b/drivers/regulator/regulator_fake.c index c2c71593c61..129ef2f215e 100644 --- a/drivers/regulator/regulator_fake.c +++ b/drivers/regulator/regulator_fake.c @@ -15,7 +15,6 @@ struct regulator_fake_config { struct regulator_common_config common; - bool is_enabled; }; struct regulator_fake_data { @@ -65,11 +64,9 @@ static struct regulator_driver_api api = { static int regulator_fake_init(const struct device *dev) { - const struct regulator_fake_config *config = dev->config; - regulator_common_data_init(dev); - return regulator_common_init(dev, config->is_enabled); + return regulator_common_init(dev, false); } /* parent regulator */ @@ -93,7 +90,6 @@ static struct regulator_parent_driver_api parent_api = { \ static const struct regulator_fake_config FAKE_CONF_NAME(node_id) = { \ .common = REGULATOR_DT_COMMON_CONFIG_INIT(node_id), \ - .is_enabled = DT_PROP(node_id, fake_is_enabled_in_hardware), \ }; \ \ DEVICE_DT_DEFINE(node_id, regulator_fake_init, NULL, \ diff --git a/dts/bindings/regulator/zephyr,fake-regulator.yaml b/dts/bindings/regulator/zephyr,fake-regulator.yaml index 833dc8ca115..7a6894948b2 100644 --- a/dts/bindings/regulator/zephyr,fake-regulator.yaml +++ b/dts/bindings/regulator/zephyr,fake-regulator.yaml @@ -10,10 +10,3 @@ compatible: "zephyr,fake-regulator" child-binding: include: regulator.yaml - - properties: - fake-is-enabled-in-hardware: - type: boolean - description: | - Sets the is_enabled flag passed to regulator_common_init. - Allows test cases where the regulator is enabled in hardware. From 920d951f0df068f76fd868ccc69bbc9090f4009d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:07 +0200 Subject: [PATCH 1583/2300] Revert "[nrf fromtree] drivers: regulator: common: Added regulator-boot-off" This reverts commit f71ddc7dcc5d89a297cd1691582318efcb12a0ed. Signed-off-by: Gerard Marull-Paretas --- drivers/regulator/regulator_common.c | 3 --- dts/bindings/regulator/regulator.yaml | 5 ----- include/zephyr/drivers/regulator.h | 7 +------ 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/regulator/regulator_common.c b/drivers/regulator/regulator_common.c index c539e1169ee..f2d9f6275e6 100644 --- a/drivers/regulator/regulator_common.c +++ b/drivers/regulator/regulator_common.c @@ -90,9 +90,6 @@ int regulator_common_init(const struct device *dev, bool is_enabled) if (is_enabled) { data->refcnt++; - if ((config->flags & REGULATOR_BOOT_OFF) != 0U) { - return regulator_disable(dev); - } } else if ((config->flags & REGULATOR_INIT_ENABLED) != 0U) { ret = api->enable(dev); if (ret < 0) { diff --git a/dts/bindings/regulator/regulator.yaml b/dts/bindings/regulator/regulator.yaml index b072ce8c920..635bfa49596 100644 --- a/dts/bindings/regulator/regulator.yaml +++ b/dts/bindings/regulator/regulator.yaml @@ -61,11 +61,6 @@ properties: This property is intended to only be used for regulators where software cannot read the state of the regulator. - regulator-boot-off: - type: boolean - description: | - Regulator should be disabled on boot. - regulator-allow-bypass: type: boolean description: allow the regulator to go into bypass mode diff --git a/include/zephyr/drivers/regulator.h b/include/zephyr/drivers/regulator.h index 46a085d9239..77e441d0dae 100644 --- a/include/zephyr/drivers/regulator.h +++ b/include/zephyr/drivers/regulator.h @@ -141,8 +141,6 @@ __subsystem struct regulator_driver_api { /** Regulator active discharge get bits */ #define REGULATOR_ACTIVE_DISCHARGE_GET_BITS(x) \ (((x) & REGULATOR_ACTIVE_DISCHARGE_MASK) >> REGULATOR_ACTIVE_DISCHARGE_POS) -/** Indicates regulator must be initialized OFF */ -#define REGULATOR_BOOT_OFF BIT(4) /** @} */ @@ -214,9 +212,7 @@ struct regulator_common_config { REGULATOR_BOOT_ON) | \ (REGULATOR_ACTIVE_DISCHARGE_SET_BITS( \ DT_PROP_OR(node_id, regulator_active_discharge, \ - REGULATOR_ACTIVE_DISCHARGE_DEFAULT))) | \ - (DT_PROP_OR(node_id, regulator_boot_off, 0U) * \ - REGULATOR_BOOT_OFF)), \ + REGULATOR_ACTIVE_DISCHARGE_DEFAULT)))), \ } /** @@ -258,7 +254,6 @@ void regulator_common_data_init(const struct device *dev); * * - Automatically enable the regulator if it is set to `regulator-boot-on` * or `regulator-always-on` and increase its usage count. - * - Automatically disable the regulator if it is set to `regulator-boot-off`. * - Configure the regulator mode if `regulator-initial-mode` is set. * - Ensure regulator voltage is set to a valid range. * From 2c7ed1e8415bcf5c34cc3d35c085a6dd74516b06 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:07 +0200 Subject: [PATCH 1584/2300] Revert "[nrf fromtree] tests: drivers: nrf_grtc_timer: add nRF54H20 target" This reverts commit 05d72f27f9494aadd6cda8b09f23c17951170091. Signed-off-by: Gerard Marull-Paretas --- tests/drivers/timer/nrf_grtc_timer/testcase.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 654594cfe0a..81b320c7c9b 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -1,7 +1,4 @@ tests: drivers.timer.nrf_grtc_timer: tags: drivers - platform_allow: - - nrf54l15pdk_nrf54l15_cpuapp - - nrf54h20dk_nrf54h20_cpuapp - - nrf54h20dk_nrf54h20_cpurad + platform_allow: nrf54l15pdk_nrf54l15_cpuapp From ee8ac538f2db98c529fa4b5a8d7080401ebd3bd3 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:08 +0200 Subject: [PATCH 1585/2300] Revert "[nrf fromtree] tests: drivers: timer: add nrf_grtc_timer tests" This reverts commit 33a0ef8c3ab89959671c703f79d5b1b8d6faaf42. Signed-off-by: Gerard Marull-Paretas --- .../timer/nrf_grtc_timer/CMakeLists.txt | 9 ----- tests/drivers/timer/nrf_grtc_timer/prj.conf | 2 - tests/drivers/timer/nrf_grtc_timer/src/main.c | 40 ------------------- .../timer/nrf_grtc_timer/testcase.yaml | 4 -- 4 files changed, 55 deletions(-) delete mode 100644 tests/drivers/timer/nrf_grtc_timer/CMakeLists.txt delete mode 100644 tests/drivers/timer/nrf_grtc_timer/prj.conf delete mode 100644 tests/drivers/timer/nrf_grtc_timer/src/main.c delete mode 100644 tests/drivers/timer/nrf_grtc_timer/testcase.yaml diff --git a/tests/drivers/timer/nrf_grtc_timer/CMakeLists.txt b/tests/drivers/timer/nrf_grtc_timer/CMakeLists.txt deleted file mode 100644 index 6dfe69d0045..00000000000 --- a/tests/drivers/timer/nrf_grtc_timer/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(nrf_grtc_timer) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/timer/nrf_grtc_timer/prj.conf b/tests/drivers/timer/nrf_grtc_timer/prj.conf deleted file mode 100644 index dea03477519..00000000000 --- a/tests/drivers/timer/nrf_grtc_timer/prj.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_ZTEST=y -CONFIG_NRF_GRTC_TIMER=y diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c deleted file mode 100644 index 197270cc6a4..00000000000 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2022, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include - -#define GRTC_SLEW_TICKS 10 - -ZTEST(nrf_grtc_timer, test_get_ticks) -{ - k_timeout_t t = K_MSEC(1); - - uint64_t exp_ticks = z_nrf_grtc_timer_read() + t.ticks; - int64_t ticks; - - /* Relative 1ms from now timeout converted to GRTC */ - ticks = z_nrf_grtc_timer_get_ticks(t); - zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), - "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); - - /* Absolute timeout 1ms in the past */ - t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() - K_MSEC(1).ticks)); - - exp_ticks = z_nrf_grtc_timer_read() - K_MSEC(1).ticks; - ticks = z_nrf_grtc_timer_get_ticks(t); - zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), - "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); - - /* Absolute timeout 10ms in the future */ - t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() + K_MSEC(10).ticks)); - exp_ticks = z_nrf_grtc_timer_read() + K_MSEC(10).ticks; - ticks = z_nrf_grtc_timer_get_ticks(t); - zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), - "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); -} - -ZTEST_SUITE(nrf_grtc_timer, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml deleted file mode 100644 index 81b320c7c9b..00000000000 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ /dev/null @@ -1,4 +0,0 @@ -tests: - drivers.timer.nrf_grtc_timer: - tags: drivers - platform_allow: nrf54l15pdk_nrf54l15_cpuapp From 39440c28de260fa5330b10924b99501f6135de55 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:08 +0200 Subject: [PATCH 1586/2300] Revert "[nrf noup] samples: psa_crypto: Remove support for Nordic boards" This reverts commit 74b659fb11b82a2009d3dcde331f4b01eb7dcfe4. Signed-off-by: Gerard Marull-Paretas --- samples/tfm_integration/psa_crypto/sample.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/tfm_integration/psa_crypto/sample.yaml b/samples/tfm_integration/psa_crypto/sample.yaml index b368f289e8c..45c9940b021 100644 --- a/samples/tfm_integration/psa_crypto/sample.yaml +++ b/samples/tfm_integration/psa_crypto/sample.yaml @@ -12,6 +12,7 @@ tests: - csr - mcuboot platform_allow: mps2_an521_ns v2m_musca_s1_ns + nrf5340dk_nrf5340_cpuapp_ns nrf9160dk_nrf9160_ns stm32l562e_dk_ns bl5340_dvk_cpuapp_ns harness: console harness_config: From 318305e31e075cdc8e0210641c44221b20d6a8ae Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:08 +0200 Subject: [PATCH 1587/2300] Revert "[nrf fromlist] tests: drivers: spi: spi_slave: Add nrf54h20dk" This reverts commit a49a583e33618d906e0be2b1da2525fe47ece5df. Signed-off-by: Gerard Marull-Paretas --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 79 ------------------- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 14 ---- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 14 ---- tests/drivers/spi/spi_slave/src/main.c | 1 - tests/drivers/spi/spi_slave/testcase.yaml | 4 +- 5 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi deleted file mode 100644 index 0a9425cc2f9..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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; - }; - }; - -}; - -&gpio0 { - status = "okay"; -}; - -&gpiote130 { - status = "okay"; - owned-channels = <7>; -}; - -dut_spi: &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_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index ff337ebdec4..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "nrf54h20dk_nrf54h20_common.dtsi" - -&dut_spi { - memory-regions = <&cpuapp_dma_region>; -}; - -&dut_spis { - memory-regions = <&cpuapp_dma_region>; -}; diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index 936bd5b15d5..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "nrf54h20dk_nrf54h20_common.dtsi" - -&dut_spi { - memory-regions = <&cpurad_dma_region>; -}; - -&dut_spis { - memory-regions = <&cpurad_dma_region>; -}; diff --git a/tests/drivers/spi/spi_slave/src/main.c b/tests/drivers/spi/spi_slave/src/main.c index 5f441480c12..7a6ca1b7545 100644 --- a/tests/drivers/spi/spi_slave/src/main.c +++ b/tests/drivers/spi/spi_slave/src/main.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #define SPI_MODE (SPI_MODE_CPOL | SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE) diff --git a/tests/drivers/spi/spi_slave/testcase.yaml b/tests/drivers/spi/spi_slave/testcase.yaml index 2ad23f25d4f..9f04af801fd 100644 --- a/tests/drivers/spi/spi_slave/testcase.yaml +++ b/tests/drivers/spi/spi_slave/testcase.yaml @@ -5,8 +5,6 @@ tests: harness: ztest harness_config: fixture: gpio_spi_loopback - platform_allow: | - nrf52840dk_nrf52840 nrf54l15pdk_nrf54l15_cpuapp nrf54h20dk_nrf54h20_cpuapp - nrf54h20dk_nrf54h20_cpurad + platform_allow: nrf52840dk_nrf52840 nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf52840dk_nrf52840 From 52dfba36a96e2ff82baad83f02b1476bb5d71901 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:08 +0200 Subject: [PATCH 1588/2300] Revert "[nrf fromtree] tests: drivers: spi: spi_loopback_test: Add nrf54h20dk" This reverts commit cd31de02bd74e486bed493f3f78d980774717b2e. Signed-off-by: Gerard Marull-Paretas --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 5ab0e84eeaa..00000000000 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 { - 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 = ; - }; -}; From 0d4790ce9c4dd2bf97fbbfced0680d4abb63197b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:08 +0200 Subject: [PATCH 1589/2300] Revert "[nrf fromtree] dts: common: nordic: nrf54: Add rx-delay property to SPI" This reverts commit d97636ea3172f524150b152a046eb7388e6cf765. Signed-off-by: Gerard Marull-Paretas --- .../nordic/nrf54l15_cpuapp_peripherals.dtsi | 10 ---------- dts/common/nordic/nrf54h20.dtsi | 20 ------------------- 2 files changed, 30 deletions(-) diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index 3e4d3641069..eb161844841 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -24,8 +24,6 @@ spi00: spi@4a000 { interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; @@ -126,8 +124,6 @@ spi20: spi@c6000 { interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; @@ -163,8 +159,6 @@ spi21: spi@c7000 { interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; @@ -200,8 +194,6 @@ spi22: spi@c8000 { interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; @@ -399,8 +391,6 @@ spi30: spi@104000 { interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index d3b6b20188f..ec5c4cca14f 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -362,8 +362,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart120: uart@8e6000 { @@ -382,8 +380,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; cpuppr_vpr: vpr@908000 { @@ -641,8 +637,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart130: uart@9a5000 { @@ -671,8 +665,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart131: uart@9a6000 { @@ -735,8 +727,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart132: uart@9b5000 { @@ -765,8 +755,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart133: uart@9b6000 { @@ -829,8 +817,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart134: uart@9c5000 { @@ -859,8 +845,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart135: uart@9c6000 { @@ -923,8 +907,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart136: uart@9d5000 { @@ -953,8 +935,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart137: uart@9d6000 { From a0c1c6a1a33df4dae372e76b966aabeb4e8c70e7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:08 +0200 Subject: [PATCH 1590/2300] Revert "[nrf fromtree] tests: drivers: spi: Add test for SPI master and slave" This reverts commit 476eef81fbd379e162959f0cb32a730fba5c81fa. Signed-off-by: Gerard Marull-Paretas --- tests/drivers/spi/spi_slave/CMakeLists.txt | 10 - .../boards/nrf52840dk_nrf52840.overlay | 67 --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 73 --- tests/drivers/spi/spi_slave/prj.conf | 6 - tests/drivers/spi/spi_slave/src/main.c | 452 ------------------ tests/drivers/spi/spi_slave/testcase.yaml | 10 - 6 files changed, 618 deletions(-) delete mode 100644 tests/drivers/spi/spi_slave/CMakeLists.txt delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_slave/prj.conf delete mode 100644 tests/drivers/spi/spi_slave/src/main.c delete mode 100644 tests/drivers/spi/spi_slave/testcase.yaml diff --git a/tests/drivers/spi/spi_slave/CMakeLists.txt b/tests/drivers/spi/spi_slave/CMakeLists.txt deleted file mode 100644 index f9f7a6bdae4..00000000000 --- a/tests/drivers/spi/spi_slave/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(spi_slave) - -FILE(GLOB app_sources src/*.c) - -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 477917e0ca7..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi3_default_alt: spi3_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi3_sleep_alt: spi3_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi1_sleep_alt: spi1_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -&spi3 { - status = "okay"; - pinctrl-0 = <&spi3_default_alt>; - pinctrl-1 = <&spi3_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <4000000>; - }; -}; - -dut_spis: &spi1 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-1 = <&spi1_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index d431f278337..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi22_default_alt: spi22_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi22_sleep_alt: spi22_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi21_default_alt: spi21_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi21_sleep_alt: spi21_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -&gpio2 { - status = "okay"; -}; - -&spi22 { - status = "okay"; - pinctrl-0 = <&spi22_default_alt>; - pinctrl-1 = <&spi22_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <4000000>; - }; -}; - -dut_spis: &spi21 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi21_default_alt>; - pinctrl-1 = <&spi21_sleep_alt>; - pinctrl-names = "default", "sleep"; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; diff --git a/tests/drivers/spi/spi_slave/prj.conf b/tests/drivers/spi/spi_slave/prj.conf deleted file mode 100644 index 840a8f87d9a..00000000000 --- a/tests/drivers/spi/spi_slave/prj.conf +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_SPI=y -CONFIG_SPI_SLAVE=y -CONFIG_GPIO=y -CONFIG_POLL=y -CONFIG_SPI_ASYNC=y -CONFIG_ZTEST=y diff --git a/tests/drivers/spi/spi_slave/src/main.c b/tests/drivers/spi/spi_slave/src/main.c deleted file mode 100644 index 7a6ca1b7545..00000000000 --- a/tests/drivers/spi/spi_slave/src/main.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -#define SPI_MODE (SPI_MODE_CPOL | SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE) -#define SPIM_OP (SPI_OP_MODE_MASTER | SPI_MODE) -#define SPIS_OP (SPI_OP_MODE_SLAVE | SPI_MODE) - -static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); -static const struct device *spis_dev = DEVICE_DT_GET(DT_NODELABEL(dut_spis)); -static const struct spi_config spis_config = { - .operation = SPIS_OP -}; - -static struct k_poll_signal async_sig = K_POLL_SIGNAL_INITIALIZER(async_sig); -static struct k_poll_event async_evt = - K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &async_sig); - -#define MEMORY_SECTION(node) \ - COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ - (__attribute__((__section__( \ - LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ - ()) - -static uint8_t spim_buffer[32] MEMORY_SECTION(DT_BUS(DT_NODELABEL(dut_spi_dt))); -static uint8_t spis_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spis)); - -struct test_data { - struct k_work_delayable test_work; - struct k_sem sem; - int spim_alloc_idx; - int spis_alloc_idx; - struct spi_buf_set sets[4]; - struct spi_buf_set *mtx_set; - struct spi_buf_set *mrx_set; - struct spi_buf_set *stx_set; - struct spi_buf_set *srx_set; - struct spi_buf bufs[8]; -}; - -static struct test_data tdata; - -/* Allocate buffer from spim or spis space. */ -static uint8_t *buf_alloc(size_t len, bool spim) -{ - int *idx = spim ? &tdata.spim_alloc_idx : &tdata.spis_alloc_idx; - uint8_t *buf = spim ? spim_buffer : spis_buffer; - size_t total = spim ? sizeof(spim_buffer) : sizeof(spis_buffer); - uint8_t *rv; - - if (*idx + len > total) { - zassert_false(true); - - return NULL; - } - - rv = &buf[*idx]; - *idx += len; - - return rv; -} - -static void work_handler(struct k_work *work) -{ - struct k_work_delayable *dwork = k_work_delayable_from_work(work); - struct test_data *td = CONTAINER_OF(dwork, struct test_data, test_work); - int rv; - - rv = spi_transceive_dt(&spim, td->mtx_set, td->mrx_set); - if (rv == 0) { - k_sem_give(&td->sem); - } -} - -/** Copies data from buffers in the set to a single buffer which makes it easier - * to compare transmitted and received data. - * - * @param buf Output buffer. - * @param len Buffer length. - * @param set Set of buffers. - * - * @return Number of bytes copied. - */ -static int cpy_data(uint8_t *buf, size_t len, struct spi_buf_set *set) -{ - int idx = 0; - - for (size_t i = 0; i < set->count; i++) { - size_t l = set->buffers[i].len; - - if (len - idx >= l) { - memcpy(&buf[idx], set->buffers[i].buf, l); - idx += l; - } else { - return -1; - } - } - - return idx; -} - -/** Compare two sets. - * - * @param tx_set TX set. - * @param rx_set RX set. - * @param same_size True if it is expected to have the same amount of data in both sets. - * - * @return 0 if data is the same and other value indicate that check failed. - */ -static int check_buffers(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set, bool same_size) -{ - static uint8_t tx_data[256]; - static uint8_t rx_data[256]; - int rx_len; - int tx_len; - - if (!tx_set || !rx_set) { - return 0; - } - - rx_len = cpy_data(rx_data, sizeof(rx_data), rx_set); - tx_len = cpy_data(tx_data, sizeof(tx_data), tx_set); - if (same_size && (rx_len != tx_len)) { - return -1; - } - - return memcmp(tx_data, rx_data, rx_len); -} - -/** Calculate expected number of received bytes by the slave. - * - * It is used to check if SPI API call for slave returns correct value. - * @param tx_set TX set. - * @param rx_set RX set. - * - * @return Expected amount of received bytes. - */ -static int slave_rx_len(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set) -{ - size_t tx_len = 0; - size_t rx_len = 0; - - if (!tx_set || !rx_set) { - return 0; - } - - for (size_t i = 0; i < tx_set->count; i++) { - tx_len += tx_set->buffers[i].len; - } - - for (size_t i = 0; i < rx_set->count; i++) { - rx_len += rx_set->buffers[i].len; - } - - return MIN(rx_len, tx_len); -} - -/** Generic function which runs the test with sets prepared in the test data structure. */ -static void run_test(bool m_same_size, bool s_same_size, bool async) -{ - int rv; - int slave_rv; - int srx_len; - - rv = k_work_schedule(&tdata.test_work, K_MSEC(10)); - zassert_equal(rv, 1); - - if (!async) { - slave_rv = spi_transceive(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set); - if (slave_rv == -ENOTSUP) { - ztest_test_skip(); - } - } else { - rv = spi_transceive_signal(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set, - &async_sig); - if (rv == -ENOTSUP) { - ztest_test_skip(); - } - zassert_equal(rv, 0); - - /* Transfer not finished yet */ - rv = k_sem_take(&tdata.sem, K_NO_WAIT); - zassert_equal(rv, -EBUSY); - - rv = k_poll(&async_evt, 1, K_MSEC(200)); - zassert_false(rv, "one or more events are not ready"); - - slave_rv = async_evt.signal->result; - - /* Reinitializing for next call */ - async_evt.signal->signaled = 0U; - async_evt.state = K_POLL_STATE_NOT_READY; - } - - rv = k_sem_take(&tdata.sem, K_MSEC(100)); - zassert_equal(rv, 0); - - srx_len = slave_rx_len(tdata.mtx_set, tdata.srx_set); - - zassert_equal(slave_rv, srx_len, "Got: %d but expected:%d", slave_rv, srx_len); - - rv = check_buffers(tdata.mtx_set, tdata.srx_set, m_same_size); - zassert_equal(rv, 0); - - rv = check_buffers(tdata.stx_set, tdata.mrx_set, s_same_size); - zassert_equal(rv, 0); -} - -/** Basic test where slave and master have RX and TX sets which contains only one - * same size buffer. - */ -static void test_basic(bool async) -{ - size_t len = 16; - - for (int i = 0; i < 4; i++) { - tdata.bufs[i].buf = buf_alloc(len, i < 2); - tdata.bufs[i].len = len; - tdata.sets[i].buffers = &tdata.bufs[i]; - tdata.sets[i].count = 1; - } - - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = &tdata.sets[1]; - tdata.stx_set = &tdata.sets[2]; - tdata.srx_set = &tdata.sets[3]; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_basic) -{ - test_basic(false); -} - -ZTEST(spi_slave, test_basic_async) -{ - test_basic(true); -} - -/** Setup a transfer where RX buffer on master and slave are shorter than - * TX buffers. RX buffers shall contain beginning of TX data and last TX - * bytes that did not fit in the RX buffers shall be lost. - */ -static void test_short_rx(bool async) -{ - size_t len = 16; - - tdata.bufs[0].buf = buf_alloc(len, true); - tdata.bufs[0].len = len; - tdata.bufs[1].buf = buf_alloc(len, true); - tdata.bufs[1].len = len - 3; /* RX buffer */ - tdata.bufs[2].buf = buf_alloc(len, false); - tdata.bufs[2].len = len; - tdata.bufs[3].buf = buf_alloc(len, false); - tdata.bufs[3].len = len - 4; /* RX buffer */ - - for (int i = 0; i < 4; i++) { - tdata.sets[i].buffers = &tdata.bufs[i]; - tdata.sets[i].count = 1; - } - - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = &tdata.sets[1]; - tdata.stx_set = &tdata.sets[2]; - tdata.srx_set = &tdata.sets[3]; - - run_test(false, false, async); -} - -ZTEST(spi_slave, test_short_rx) -{ - test_short_rx(false); -} - -ZTEST(spi_slave, test_short_rx_async) -{ - test_short_rx(true); -} - -/** Test where only master transmits. */ -static void test_only_tx(bool async) -{ - size_t len = 16; - - /* MTX buffer */ - tdata.bufs[0].buf = buf_alloc(len, true); - tdata.bufs[0].len = len; - tdata.sets[0].buffers = &tdata.bufs[0]; - tdata.sets[0].count = 1; - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = NULL; - - /* STX buffer */ - tdata.bufs[1].buf = buf_alloc(len, false); - tdata.bufs[1].len = len; - tdata.sets[1].buffers = &tdata.bufs[1]; - tdata.sets[1].count = 1; - tdata.srx_set = &tdata.sets[1]; - tdata.stx_set = NULL; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_only_tx) -{ - test_only_tx(false); -} - -ZTEST(spi_slave, test_only_tx_async) -{ - test_only_tx(true); -} - -/** Test where only master transmits and slave receives in chunks. */ -static void test_only_tx_in_chunks(bool async) -{ - size_t len1 = 7; - size_t len2 = 8; - - /* MTX buffer */ - tdata.bufs[0].buf = buf_alloc(len1 + len2, true); - tdata.bufs[0].len = len1 + len2; - tdata.sets[0].buffers = &tdata.bufs[0]; - tdata.sets[0].count = 1; - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = NULL; - - /* STX buffer */ - tdata.bufs[1].buf = buf_alloc(len1, false); - tdata.bufs[1].len = len1; - tdata.bufs[2].buf = buf_alloc(len2, false); - tdata.bufs[2].len = len2; - tdata.sets[1].buffers = &tdata.bufs[1]; - tdata.sets[1].count = 2; - tdata.srx_set = &tdata.sets[1]; - tdata.stx_set = NULL; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_only_tx_in_chunks) -{ - test_only_tx_in_chunks(false); -} - -ZTEST(spi_slave, test_only_tx_in_chunks_async) -{ - test_only_tx_in_chunks(true); -} - -/** Test where only slave transmits. */ -static void test_only_rx(bool async) -{ - size_t len = 16; - - /* MTX buffer */ - tdata.bufs[0].buf = buf_alloc(len, true); - tdata.bufs[0].len = len; - tdata.sets[0].buffers = &tdata.bufs[0]; - tdata.sets[0].count = 1; - tdata.mrx_set = &tdata.sets[0]; - tdata.mtx_set = NULL; - - /* STX buffer */ - tdata.bufs[1].buf = buf_alloc(len, false); - tdata.bufs[1].len = len; - tdata.sets[1].buffers = &tdata.bufs[1]; - tdata.sets[1].count = 1; - tdata.stx_set = &tdata.sets[1]; - tdata.srx_set = NULL; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_only_rx) -{ - test_only_rx(false); -} - -ZTEST(spi_slave, test_only_rx_async) -{ - test_only_rx(true); -} - -/** Test where only slave transmits in chunks. */ -static void test_only_rx_in_chunks(bool async) -{ - size_t len1 = 7; - size_t len2 = 9; - - /* MTX buffer */ - tdata.bufs[0].buf = buf_alloc(len1 + len2, true); - tdata.bufs[0].len = len1 + len2; - tdata.sets[0].buffers = &tdata.bufs[0]; - tdata.sets[0].count = 1; - tdata.mrx_set = &tdata.sets[0]; - tdata.mtx_set = NULL; - - /* STX buffer */ - tdata.bufs[1].buf = buf_alloc(len1, false); - tdata.bufs[1].len = len1; - tdata.bufs[2].buf = buf_alloc(len2, false); - tdata.bufs[2].len = len2; - tdata.sets[1].buffers = &tdata.bufs[1]; - tdata.sets[1].count = 2; - tdata.stx_set = &tdata.sets[1]; - tdata.srx_set = NULL; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_only_rx_in_chunks) -{ - test_only_rx_in_chunks(false); -} - -ZTEST(spi_slave, test_only_rx_in_chunks_async) -{ - test_only_rx_in_chunks(true); -} - -static void before(void *not_used) -{ - ARG_UNUSED(not_used); - - memset(&tdata, 0, sizeof(tdata)); - for (size_t i = 0; i < sizeof(spim_buffer); i++) { - spim_buffer[i] = (uint8_t)i; - } - for (size_t i = 0; i < sizeof(spis_buffer); i++) { - spis_buffer[i] = (uint8_t)(i + 0x80); - } - - k_work_init_delayable(&tdata.test_work, work_handler); - k_sem_init(&tdata.sem, 0, 1); -} - -static void *suite_setup(void) -{ - return NULL; -} - -ZTEST_SUITE(spi_slave, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/spi/spi_slave/testcase.yaml b/tests/drivers/spi/spi_slave/testcase.yaml deleted file mode 100644 index 9f04af801fd..00000000000 --- a/tests/drivers/spi/spi_slave/testcase.yaml +++ /dev/null @@ -1,10 +0,0 @@ -tests: - drivers.spi_slave.api: - depends_on: spi - tags: drivers spi - harness: ztest - harness_config: - fixture: gpio_spi_loopback - platform_allow: nrf52840dk_nrf52840 nrf54l15pdk_nrf54l15_cpuapp - integration_platforms: - - nrf52840dk_nrf52840 From 0a8ca5995f3333b89866bed7d1ddd9328386c3aa Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:09 +0200 Subject: [PATCH 1591/2300] Revert "[nrf fromtree] drivers: spi: nrf: Add new SPIS instances" This reverts commit 2e476d935ea60e644e221327806fd2d539734c9e. Signed-off-by: Gerard Marull-Paretas --- drivers/spi/Kconfig.nrfx | 14 ----- drivers/spi/spi_nrfx_spis.c | 19 ++++-- modules/hal_nordic/nrfx/Kconfig | 70 ----------------------- modules/hal_nordic/nrfx/nrfx_config.h | 42 -------------- soc/common/nordic_nrf/Kconfig.peripherals | 42 -------------- 5 files changed, 14 insertions(+), 173 deletions(-) diff --git a/drivers/spi/Kconfig.nrfx b/drivers/spi/Kconfig.nrfx index 870730769fa..0ee1c03065b 100644 --- a/drivers/spi/Kconfig.nrfx +++ b/drivers/spi/Kconfig.nrfx @@ -51,20 +51,6 @@ config SPI_NRFX_SPIS select NRFX_SPIS1 if HAS_HW_NRF_SPIS1 select NRFX_SPIS2 if HAS_HW_NRF_SPIS2 select NRFX_SPIS3 if HAS_HW_NRF_SPIS3 - select NRFX_SPIS00 if HAS_HW_NRF_SPIS00 - select NRFX_SPIS20 if HAS_HW_NRF_SPIS20 - select NRFX_SPIS21 if HAS_HW_NRF_SPIS21 - select NRFX_SPIS22 if HAS_HW_NRF_SPIS22 - select NRFX_SPIS30 if HAS_HW_NRF_SPIS30 - select NRFX_SPIS120 if HAS_HW_NRF_SPIS120 - select NRFX_SPIS130 if HAS_HW_NRF_SPIS130 - select NRFX_SPIS131 if HAS_HW_NRF_SPIS131 - select NRFX_SPIS132 if HAS_HW_NRF_SPIS132 - select NRFX_SPIS133 if HAS_HW_NRF_SPIS133 - select NRFX_SPIS134 if HAS_HW_NRF_SPIS134 - select NRFX_SPIS135 if HAS_HW_NRF_SPIS135 - select NRFX_SPIS136 if HAS_HW_NRF_SPIS136 - select NRFX_SPIS137 if HAS_HW_NRF_SPIS137 config SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 depends on SOC_NRF52832 diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index 78bcc9f84be..d2a61530f00 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -399,9 +399,18 @@ static int spi_nrfx_init(const struct device *dev) CONFIG_SPI_INIT_PRIORITY, \ &spi_nrfx_driver_api) -/* Macro creates device instance if it is enabled in devicetree. */ -#define SPIS_DEVICE(periph, prefix, id, _) \ - IF_ENABLED(CONFIG_HAS_HW_NRF_SPIS##prefix##id, (SPI_NRFX_SPIS_DEFINE(prefix##id);)) +#ifdef CONFIG_HAS_HW_NRF_SPIS0 +SPI_NRFX_SPIS_DEFINE(0); +#endif + +#ifdef CONFIG_HAS_HW_NRF_SPIS1 +SPI_NRFX_SPIS_DEFINE(1); +#endif -/* Macro iterates over nrfx_spis instances enabled in the nrfx_config.h. */ -NRFX_FOREACH_ENABLED(SPIS, SPIS_DEVICE, (), (), _) +#ifdef CONFIG_HAS_HW_NRF_SPIS2 +SPI_NRFX_SPIS_DEFINE(2); +#endif + +#ifdef CONFIG_HAS_HW_NRF_SPIS3 +SPI_NRFX_SPIS_DEFINE(3); +#endif diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 32386d54274..22758742ef4 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -441,76 +441,6 @@ config NRFX_SPIS3 depends on $(dt_nodelabel_has_compat,spi3,$(DT_COMPAT_NORDIC_NRF_SPIS)) select NRFX_SPIS -config NRFX_SPIS00 - bool "SPIS00 driver instance" - depends on $(dt_nodelabel_has_compat,spi00,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS20 - bool "SPIS20 driver instance" - depends on $(dt_nodelabel_has_compat,spi20,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS21 - bool "SPIS21 driver instance" - depends on $(dt_nodelabel_has_compat,spi21,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS22 - bool "SPIS22 driver instance" - depends on $(dt_nodelabel_has_compat,spi22,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS30 - bool "SPIS30 driver instance" - depends on $(dt_nodelabel_has_compat,spi30,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS120 - bool "SPIS120 driver instance" - depends on $(dt_nodelabel_has_compat,spi120,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS130 - bool "SPIS130 driver instance" - depends on $(dt_nodelabel_has_compat,spi130,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS131 - bool "SPIS131 driver instance" - depends on $(dt_nodelabel_has_compat,spi131,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS132 - bool "SPIS132 driver instance" - depends on $(dt_nodelabel_has_compat,spi132,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS133 - bool "SPIS133 driver instance" - depends on $(dt_nodelabel_has_compat,spi133,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS134 - bool "SPIS134 driver instance" - depends on $(dt_nodelabel_has_compat,spi134,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS135 - bool "SPIS135 driver instance" - depends on $(dt_nodelabel_has_compat,spi135,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS136 - bool "SPIS136 driver instance" - depends on $(dt_nodelabel_has_compat,spi136,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - -config NRFX_SPIS137 - bool "SPIS137 driver instance" - depends on $(dt_nodelabel_has_compat,spi137,$(DT_COMPAT_NORDIC_NRF_SPIS)) - select NRFX_SPIS - config NRFX_SYSTICK bool "SYSTICK driver" depends on CPU_CORTEX_M_HAS_SYSTICK diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index e7120b54ab7..4a7ae346d84 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -451,48 +451,6 @@ #ifdef CONFIG_NRFX_SPIS3 #define NRFX_SPIS3_ENABLED 1 #endif -#ifdef CONFIG_NRFX_SPIS00 -#define NRFX_SPIS00_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS20 -#define NRFX_SPIS20_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS21 -#define NRFX_SPIS21_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS22 -#define NRFX_SPIS22_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS30 -#define NRFX_SPIS30_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS120 -#define NRFX_SPIS120_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS130 -#define NRFX_SPIS130_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS131 -#define NRFX_SPIS131_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS132 -#define NRFX_SPIS132_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS133 -#define NRFX_SPIS133_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS134 -#define NRFX_SPIS134_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS135 -#define NRFX_SPIS135_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS136 -#define NRFX_SPIS136_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_SPIS137 -#define NRFX_SPIS130_ENABLED 1 -#endif #ifdef CONFIG_NRFX_SYSTICK #define NRFX_SYSTICK_ENABLED 1 diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 817002f7282..e10ddb42d20 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -320,48 +320,6 @@ config HAS_HW_NRF_SPIS2 config HAS_HW_NRF_SPIS3 def_bool $(dt_nodelabel_enabled_with_compat,spi3,$(DT_COMPAT_NORDIC_NRF_SPIS)) -config HAS_HW_NRF_SPIS00 - def_bool $(dt_nodelabel_enabled_with_compat,spi00,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS20 - def_bool $(dt_nodelabel_enabled_with_compat,spi20,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS21 - def_bool $(dt_nodelabel_enabled_with_compat,spi21,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS22 - def_bool $(dt_nodelabel_enabled_with_compat,spi22,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS30 - def_bool $(dt_nodelabel_enabled_with_compat,spi30,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS120 - def_bool $(dt_nodelabel_enabled_with_compat,spi120,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS130 - def_bool $(dt_nodelabel_enabled_with_compat,spi130,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS131 - def_bool $(dt_nodelabel_enabled_with_compat,spi131,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS132 - def_bool $(dt_nodelabel_enabled_with_compat,spi132,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS133 - def_bool $(dt_nodelabel_enabled_with_compat,spi133,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS134 - def_bool $(dt_nodelabel_enabled_with_compat,spi134,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS135 - def_bool $(dt_nodelabel_enabled_with_compat,spi135,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS136 - def_bool $(dt_nodelabel_enabled_with_compat,spi136,$(DT_COMPAT_NORDIC_NRF_SPIS)) - -config HAS_HW_NRF_SPIS137 - def_bool $(dt_nodelabel_enabled_with_compat,spi137,$(DT_COMPAT_NORDIC_NRF_SPIS)) - config HAS_HW_NRF_SPU def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_SPU)) From 464d3c8bbbd57245807ee5fbd3cbe0f5a21fcd2e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:09 +0200 Subject: [PATCH 1592/2300] Revert "[nrf fromlist] tests: drivers: uart: uart_elementary: Fix mismatch case" This reverts commit 42762514e253fb37aa803294018943dfdd367a9d. Signed-off-by: Gerard Marull-Paretas --- tests/drivers/uart/uart_elementary/src/main.c | 15 +++++++-------- tests/drivers/uart/uart_elementary/testcase.yaml | 8 -------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index df8c7b54b10..1c4df3273a7 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -40,7 +40,6 @@ static volatile uint8_t uart_error_counter; static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; static volatile uint8_t aux_uart_error; -static volatile uint8_t aux_uart_error_counter; #endif /* @@ -111,9 +110,12 @@ static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, vo uart_irq_update(dev); err = uart_err_check(dev); - if (err != 0) { - aux_uart_error_counter++; - } +#if !defined(CONFIG_COVERAGE) + /* This assetion will fail with coverge enabled + * When in coverage mode it has no impact on test case execution + */ + zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); +#endif /* CONFIG_COVERAGE */ while (uart_irq_is_pending(dev)) { if (uart_irq_rx_ready(dev)) { uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); @@ -288,10 +290,7 @@ ZTEST(uart_elementary, test_uart_dual_port_transmission) uart_irq_err_disable(uart_dev_aux); #if defined(CONFIG_SETUP_MISMATCH_TEST) - TC_PRINT("Mismatched configuration test\n"); - zassert_not_equal(uart_error_counter + aux_uart_error_counter, 0, - "UART configuration mismatch error not detected"); - + zassert_not_equal(uart_error_counter, 0); #else for (int index = 0; index < TEST_BUFFER_LEN; index++) { zassert_equal(test_buffer[index], test_pattern[index], diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index 67ac04fc1d6..9308ffbf5c2 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -33,11 +33,3 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" extra_configs: - CONFIG_DUAL_UART_TEST=y - drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54l15pdk_nrf54l15_cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - - CONFIG_SETUP_MISMATCH_TEST=y From a8dc208b932ac225ccf52f6c9ad7df99bfd14c21 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:09 +0200 Subject: [PATCH 1593/2300] Revert "[nrf fromlist] tests: drivers: uart: uart_elementary: Fix RX handling" This reverts commit 1fffbd9a5fce282301542ddcfa7255c495af9bd4. Signed-off-by: Gerard Marull-Paretas --- tests/drivers/uart/uart_elementary/src/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index 1c4df3273a7..d7d85ee9542 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -66,12 +66,14 @@ static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive int *rx_byte_offset) { int rx_data_length = 0; + int bytes_received = 0; do { rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, TEST_BUFFER_LEN); - *rx_byte_offset += rx_data_length; + bytes_received += rx_data_length; } while (rx_data_length); + *rx_byte_offset += bytes_received; } /* From 98b892bea503a36c30bf7a157fe795929df9b145 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:09 +0200 Subject: [PATCH 1594/2300] Revert "[nrf fromtree] drivers: Extend coverage for UARTE driver" This reverts commit 117bb08c370f38d02bba10e0838f588acf19a0ab. Signed-off-by: Gerard Marull-Paretas --- .../uart/uart_elementary/CMakeLists.txt | 10 - tests/drivers/uart/uart_elementary/Kconfig | 11 - tests/drivers/uart/uart_elementary/README.txt | 13 - .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 - .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 32 -- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 37 -- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 3 - ...f54h20dk_nrf54h20_cpuapp_dual_uart.overlay | 56 --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 31 -- ...54l15pdk_nrf54l15_cpuapp_dual_uart.overlay | 51 --- tests/drivers/uart/uart_elementary/prj.conf | 6 - tests/drivers/uart/uart_elementary/src/main.c | 322 ------------------ .../uart/uart_elementary/testcase.yaml | 35 -- 13 files changed, 608 deletions(-) delete mode 100644 tests/drivers/uart/uart_elementary/CMakeLists.txt delete mode 100644 tests/drivers/uart/uart_elementary/Kconfig delete mode 100644 tests/drivers/uart/uart_elementary/README.txt delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay delete mode 100644 tests/drivers/uart/uart_elementary/prj.conf delete mode 100644 tests/drivers/uart/uart_elementary/src/main.c delete mode 100644 tests/drivers/uart/uart_elementary/testcase.yaml diff --git a/tests/drivers/uart/uart_elementary/CMakeLists.txt b/tests/drivers/uart/uart_elementary/CMakeLists.txt deleted file mode 100644 index 59b31ee68a9..00000000000 --- a/tests/drivers/uart/uart_elementary/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(uart_high_level_api) - -target_sources(app PRIVATE - src/main.c - ) diff --git a/tests/drivers/uart/uart_elementary/Kconfig b/tests/drivers/uart/uart_elementary/Kconfig deleted file mode 100644 index aed523c5832..00000000000 --- a/tests/drivers/uart/uart_elementary/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# UART test configuration options -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config DUAL_UART_TEST - bool "Enable dual UART test" - -config SETUP_MISMATCH_TEST - bool "Enable mismatched configuration in dual UART test" - -source "Kconfig.zephyr" diff --git a/tests/drivers/uart/uart_elementary/README.txt b/tests/drivers/uart/uart_elementary/README.txt deleted file mode 100644 index 5af85beff46..00000000000 --- a/tests/drivers/uart/uart_elementary/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -The purpose of this test is to validate basic UART driver functions, -that are not tested elsewhere. -UART interrupt mode is used for the tests purpose. - -Hardware setup required for these tests: -For single uart conviguration - UART0 TX connected to RX and CTS to RTS -For dual uart configuratiom - UART0 and UART1 TXs and RXs cross-connected - -These test cases cover: -- UART configuration, -- UART error check, -- UART callback setup, -- Dual UART transmission with matched and mismatched configurations diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 064e78b6f74..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f98f3657f13..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart1_default_alt: uart1_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - uart1_sleep_alt: uart1_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart1 { - current-speed = <115200>; - compatible = "nordic,nrf-uarte"; - status = "okay"; - pinctrl-0 = <&uart1_default_alt>; - pinctrl-1 = <&uart1_sleep_alt>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi deleted file mode 100644 index 22d8378937c..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&cpuapp_dma_region { - status="okay"; -}; - -&pinctrl { - uart135_default_alt: uart135_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - uart135_sleep_alt: uart135_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart135 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart135_default_alt>; - pinctrl-1 = <&uart135_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; - hw-flow-control; - -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index f65b4dd3b0b..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay deleted file mode 100644 index 23c36ee8974..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay +++ /dev/null @@ -1,56 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" - - -&pinctrl { - uart135_default_alt: uart135_default_alt { - group1 { - psels = , - ; - }; - }; - - uart135_sleep_alt: uart135_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart135 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart135_default_alt>; - pinctrl-1 = <&uart135_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; -}; - -&pinctrl { - uart137_default_alt: uart137_default_alt { - group1 { - psels = , - ; - }; - }; - - uart137_sleep_alt: uart137_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut_aux: &uart137 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart137_default_alt>; - pinctrl-1 = <&uart137_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index cf481b7a161..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay deleted file mode 100644 index 2031f7a2444..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay +++ /dev/null @@ -1,51 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart22_default: uart22_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart22_sleep: uart22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; - -dut_aux: &uart22 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart22_default>; - pinctrl-1 = <&uart22_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_elementary/prj.conf b/tests/drivers/uart/uart_elementary/prj.conf deleted file mode 100644 index 26c93d320a7..00000000000 --- a/tests/drivers/uart/uart_elementary/prj.conf +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_SERIAL=y -CONFIG_ZTEST=y -CONFIG_TEST_USERSPACE=y -CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_UART_USE_RUNTIME_CONFIGURE=y -CONFIG_UART_INTERRUPT_DRIVEN=y diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c deleted file mode 100644 index d7d85ee9542..00000000000 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @addtogroup t_driver_uart - * @{ - * @defgroup t_uart_elementary test_uart_elementary - * @} - */ - -#include -#include - -#if DT_NODE_EXISTS(DT_NODELABEL(dut)) -#define UART_NODE DT_NODELABEL(dut) -#else -#define UART_NODE DT_CHOSEN(zephyr_console) -#endif - -#if DT_NODE_EXISTS(DT_NODELABEL(dut_aux)) -#define UART_NODE_AUX DT_NODELABEL(dut_aux) -#else -#define UART_NODE_AUX DT_CHOSEN(zephyr_console) -#endif - -#define SLEEP_TIME_US 1000 -#define TEST_BUFFER_LEN 10 - -static const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE); - -const uint8_t test_pattern[TEST_BUFFER_LEN] = { 0x11, 0x12, 0x13, 0x14, 0x15, - 0x16, 0x17, 0x18, 0x19, 0x20 }; -static uint8_t test_buffer[TEST_BUFFER_LEN]; -static volatile uint8_t uart_error_counter; - -#if defined(CONFIG_DUAL_UART_TEST) -static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); -static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; -static volatile uint8_t aux_uart_error; -#endif - -/* - * ISR for UART TX action - */ -static void uart_tx_interrupt_service(const struct device *dev, int *tx_byte_offset) -{ - uint8_t bytes_sent = 0; - uint8_t *tx_data_pointer = (uint8_t *)(test_pattern + *tx_byte_offset); - - if (*tx_byte_offset < TEST_BUFFER_LEN) { - bytes_sent = uart_fifo_fill(dev, tx_data_pointer, 1); - *tx_byte_offset += bytes_sent; - } else { - *tx_byte_offset = 0; - uart_irq_tx_disable(dev); - } -} - -/* - * ISR for UART RX action - */ -static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive_buffer_pointer, - int *rx_byte_offset) -{ - int rx_data_length = 0; - int bytes_received = 0; - - do { - rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, - TEST_BUFFER_LEN); - bytes_received += rx_data_length; - } while (rx_data_length); - *rx_byte_offset += bytes_received; -} - -/* - * Callback function for MAIN UART interrupt based transmission test - */ -static void interrupt_driven_uart_callback_main_uart(const struct device *dev, void *user_data) -{ - int err; - static int tx_byte_offset; - static int rx_byte_offset; - - uart_irq_update(dev); - err = uart_err_check(dev); - if (err != 0) { - uart_error_counter++; - } - while (uart_irq_is_pending(dev)) { - if (uart_irq_rx_ready(dev)) { - uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset); - } - if (uart_irq_tx_ready(dev)) { - uart_tx_interrupt_service(dev, &tx_byte_offset); - } - } -} - -#if defined(CONFIG_DUAL_UART_TEST) -/* - * Callback function for AUX UART interrupt based transmission test - */ -static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, void *user_data) -{ - int err; - static int tx_byte_offset_aux; - static int rx_byte_offset_aux; - - uart_irq_update(dev); - err = uart_err_check(dev); -#if !defined(CONFIG_COVERAGE) - /* This assetion will fail with coverge enabled - * When in coverage mode it has no impact on test case execution - */ - zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); -#endif /* CONFIG_COVERAGE */ - while (uart_irq_is_pending(dev)) { - if (uart_irq_rx_ready(dev)) { - uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); - } - if (uart_irq_tx_ready(dev)) { - uart_tx_interrupt_service(dev, &tx_byte_offset_aux); - } - } -} -#endif /* CONFIG_DUAL_UART_TEST */ - -/* - * Test UART proper configuration call - */ -ZTEST(uart_elementary, test_uart_proper_configuration) -{ - Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); - - int err; - struct uart_config test_expected_uart_config; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; - - err = uart_configure(uart_dev, &test_uart_config); - zassert_equal(err, 0, "'uart_configure' api call - unexpected error: %d", err); - - err = uart_config_get(uart_dev, &test_expected_uart_config); - zassert_equal(err, 0, "'uart_config_get' api call - unexpected error raised : %d", err); - - zassert_equal(test_uart_config.baudrate, test_expected_uart_config.baudrate, - "Set and actual UART config baudrate mismatch: %d != %d", - test_uart_config.baudrate, test_expected_uart_config.baudrate); - - zassert_equal(test_uart_config.parity, test_expected_uart_config.parity, - "Set and actual UART config parity mismatch: %d != %d", - test_uart_config.parity, test_expected_uart_config.parity); - - zassert_equal(test_uart_config.stop_bits, test_expected_uart_config.stop_bits, - "Set and actual UART config stop_bits mismatch: %d != %d", - test_uart_config.stop_bits, test_expected_uart_config.stop_bits); - - zassert_equal(test_uart_config.data_bits, test_expected_uart_config.data_bits, - "Set and actual UART config data_bits mismatch: %d != %d", - test_uart_config.data_bits, test_expected_uart_config.data_bits); - - zassert_equal(test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl, - "Set and actual UART config flow_ctrl mismatch: %d != %d", - test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl); -} - -/* - * Test UART improper configuration call - */ -ZTEST(uart_elementary, test_uart_improper_configuration) -{ - Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); - - int err; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = 7, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; - - err = uart_configure(uart_dev, &test_uart_config); - zassert_not_equal( - err, 0, - "'uart_configure' with incorrect configuration havent't raised an error, err=%d", - err); -} - -#if !defined(CONFIG_DUAL_UART_TEST) -/* - * Test UART basic interrupt based transmission (with loopback) - */ -ZTEST(uart_elementary, test_uart_basic_transmission) -{ - int err; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_ODD, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; - - err = uart_configure(uart_dev, &test_uart_config); - zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); - - err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); - zassert_equal(err, 0, "Unexpected error when setting callback %d", err); - err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, - (void *)test_buffer); - zassert_equal(err, 0, "Unexpected error when setting user data for callback %d", err); - uart_irq_err_enable(uart_dev); - uart_irq_rx_enable(uart_dev); - uart_irq_tx_enable(uart_dev); - - /* wait for the tramission to finish (no polling is intentional) */ - k_sleep(K_USEC(100 * SLEEP_TIME_US)); - - uart_irq_tx_disable(uart_dev); - uart_irq_rx_disable(uart_dev); - uart_irq_err_disable(uart_dev); - for (int index = 0; index < TEST_BUFFER_LEN; index++) { - zassert_equal(test_buffer[index], test_pattern[index], - "Recieived data byte %d does not match pattern 0x%x != 0x%x", index, - test_buffer[index], test_pattern[index]); - } -} -#else -/* - * Test UART interrupt based transmission between two ports - */ -ZTEST(uart_elementary, test_uart_dual_port_transmission) -{ - int err; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; - -#if defined(CONFIG_SETUP_MISMATCH_TEST) - struct uart_config test_uart_config_aux = { .baudrate = 9600, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; -#endif - err = uart_configure(uart_dev, &test_uart_config); - zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); - -#if defined(CONFIG_SETUP_MISMATCH_TEST) - err = uart_configure(uart_dev_aux, &test_uart_config_aux); -#else - err = uart_configure(uart_dev_aux, &test_uart_config); -#endif - - zassert_equal(err, 0, "Unexpected error when configuring UART1: %d", err); - - err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); - zassert_equal(err, 0, "Unexpected error when setting callback for UART0 %d", err); - err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, - (void *)test_buffer); - zassert_equal(err, 0, "Unexpected error when setting user data for UART0 callback %d", err); - - err = uart_irq_callback_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart); - zassert_equal(err, 0, "Unexpected error when setting callback for UART1 %d", err); - err = uart_irq_callback_user_data_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart, - (void *)test_buffer_aux); - zassert_equal(err, 0, "Unexpected error when setting user data for UART1 callback %d", err); - - uart_irq_err_enable(uart_dev); - uart_irq_err_enable(uart_dev_aux); - - uart_irq_tx_enable(uart_dev); - uart_irq_tx_enable(uart_dev_aux); - - uart_irq_rx_enable(uart_dev); - uart_irq_rx_enable(uart_dev_aux); - - /* wait for the tramission to finish (no polling is intentional) */ - k_sleep(K_USEC(100 * SLEEP_TIME_US)); - - uart_irq_tx_disable(uart_dev); - uart_irq_tx_disable(uart_dev_aux); - uart_irq_rx_disable(uart_dev); - uart_irq_rx_disable(uart_dev_aux); - uart_irq_err_disable(uart_dev); - uart_irq_err_disable(uart_dev_aux); - -#if defined(CONFIG_SETUP_MISMATCH_TEST) - zassert_not_equal(uart_error_counter, 0); -#else - for (int index = 0; index < TEST_BUFFER_LEN; index++) { - zassert_equal(test_buffer[index], test_pattern[index], - "UART0 recieived data byte %d does not match pattern 0x%x != 0x%x", - index, test_buffer[index], test_pattern[index]); - zassert_equal(test_buffer_aux[index], test_pattern[index], - "UART1 recieived data byte %d does not match pattern 0x%x != 0x%x", - index, test_buffer_aux[index], test_pattern[index]); - } -#endif /* CONFIG_SETUP_MISMATCH_TEST */ -} -#endif /* CONFIG_DUAL_UART_TEST */ - -/* - * Test setup - */ -void *test_setup(void) -{ - zassert_true(device_is_ready(uart_dev), "UART0 device is not ready"); -#if defined(CONFIG_DUAL_UART_TEST) - zassert_true(device_is_ready(uart_dev_aux), "UART1 device is not ready"); -#endif - - return NULL; -} - -ZTEST_SUITE(uart_elementary, NULL, test_setup, NULL, NULL, NULL); diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml deleted file mode 100644 index 9308ffbf5c2..00000000000 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ /dev/null @@ -1,35 +0,0 @@ -common: - tags: drivers uart - depends_on: gpio - harness: ztest - harness_config: - fixture: gpio_loopback -tests: - drivers.uart.uart_elementary: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54h20dk_nrf54h20_cpuapp - - nrf54l15pdk_nrf54l15_cpuapp - - nrf5340dk_nrf5340_cpuapp - drivers.uart.uart_elementary_dual_nrf54h: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54h20dk_nrf54h20_cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - drivers.uart.uart_elementary_dual_setup_mismatch_nrf54h: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54h20dk_nrf54h20_cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - - CONFIG_SETUP_MISMATCH_TEST=y - drivers.uart.uart_elementary_dual_nrf54l: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54l15pdk_nrf54l15_cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y From 0eca162fe9ac3747f8e4cda57e5e57560c2a346c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:09 +0200 Subject: [PATCH 1595/2300] Revert "[nrf fromlist] tests: drivers: uart: async_api: Add nrf54h20 support" This reverts commit 9e79564fad08b8b32fccd5a81cea196d3cadee80. Signed-off-by: Gerard Marull-Paretas --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 25 ------------------- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 11 -------- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 11 -------- 3 files changed, 47 deletions(-) delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay 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 deleted file mode 100644 index 172d75904e4..00000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi +++ /dev/null @@ -1,25 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart135_default_alt: uart135_default_alt { - group1 { - psels = , - ; - }; - }; - - uart135_sleep_alt: uart135_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart135 { - status = "okay"; - pinctrl-0 = <&uart135_default_alt>; - pinctrl-1 = <&uart135_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; 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 deleted file mode 100644 index a8fe36d37bb..00000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" - -&cpuapp_dma_region { - status = "okay"; -}; - -&dut { - memory-regions = <&cpuapp_dma_region>; -}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index 32f95625201..00000000000 --- a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" - -&cpurad_dma_region { - status = "okay"; -}; - -&dut { - memory-regions = <&cpurad_dma_region>; -}; From 24c8aaa4c2974bdf965b32afac27e0fa03e2b12a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:10 +0200 Subject: [PATCH 1596/2300] Revert "[nrf fromlist] tests: drivers: uart: uart_pm: Add support for nrf54h20dk" This reverts commit 53ca2050ec1ab44c9eee3195780d0a1b0f69349c. Signed-off-by: Gerard Marull-Paretas --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 31 ------------------- tests/drivers/uart/uart_pm/testcase.yaml | 5 --- 2 files changed, 36 deletions(-) delete mode 100644 tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index d01ebce4c8a..00000000000 --- a/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart135_default_alt: uart135_default_alt { - group1 { - psels = , - ; - }; - }; - - uart135_sleep_alt: uart135_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart135 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart135_default_alt>; - pinctrl-1 = <&uart135_sleep_alt>; - pinctrl-names = "default", "sleep"; - memory-regions = <&cpuapp_dma_region>; -}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 1430fd9a8c2..69e3b0e5d0d 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -6,7 +6,6 @@ common: platform_allow: - nrf52840dk_nrf52840 - nrf54l15pdk_nrf54l15_cpuapp - - nrf54h20dk_nrf54h20_cpuapp - nrf52_bsim harness_config: fixture: gpio_loopback @@ -28,7 +27,6 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp - - nrf54h20dk_nrf54h20_cpuapp drivers.uart.pm.enhanced_poll: extra_configs: @@ -38,7 +36,6 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp - - nrf54h20dk_nrf54h20_cpuapp drivers.uart.pm.int_driven: extra_configs: @@ -57,7 +54,6 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp - - nrf54h20dk_nrf54h20_cpuapp drivers.uart.pm.async: extra_configs: @@ -82,4 +78,3 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp - - nrf54h20dk_nrf54h20_cpuapp From bb21376b7e500a2809cdbe5c53f61108cd7cc546 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:10 +0200 Subject: [PATCH 1597/2300] Revert "[nrf fromlist] tests: drivers: uart: uart_pm: Limit scope for nrf54l15" This reverts commit a105c379cffad1c1454a09a37880d26050c7e54f. Signed-off-by: Gerard Marull-Paretas --- tests/drivers/uart/uart_pm/testcase.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 69e3b0e5d0d..5417be597e0 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -5,7 +5,6 @@ common: harness: ztest platform_allow: - nrf52840dk_nrf52840 - - nrf54l15pdk_nrf54l15_cpuapp - nrf52_bsim harness_config: fixture: gpio_loopback @@ -25,8 +24,6 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=n - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" - platform_exclude: - - nrf54l15pdk_nrf54l15_cpuapp drivers.uart.pm.enhanced_poll: extra_configs: @@ -34,8 +31,6 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y - platform_exclude: - - nrf54l15pdk_nrf54l15_cpuapp drivers.uart.pm.int_driven: extra_configs: @@ -52,8 +47,6 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y - platform_exclude: - - nrf54l15pdk_nrf54l15_cpuapp drivers.uart.pm.async: extra_configs: @@ -76,5 +69,3 @@ tests: - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y - platform_exclude: - - nrf54l15pdk_nrf54l15_cpuapp From 10c36a4d513dba461db2ffc22d23afc340c713ed Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:10 +0200 Subject: [PATCH 1598/2300] Revert "[nrf fromtree] drivers: serial: uart_async_rx: Fix uart_async_rx_reset" This reverts commit eac6c474270860683c6f19afef3010d9ffb337e8. Signed-off-by: Gerard Marull-Paretas --- drivers/serial/uart_async_rx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/serial/uart_async_rx.c b/drivers/serial/uart_async_rx.c index 709f8733849..68e17691c3e 100644 --- a/drivers/serial/uart_async_rx.c +++ b/drivers/serial/uart_async_rx.c @@ -116,9 +116,6 @@ void uart_async_rx_data_consume(struct uart_async_rx *rx_data, size_t length) void uart_async_rx_reset(struct uart_async_rx *rx_data) { rx_data->free_buf_cnt = rx_data->config->buf_cnt; - rx_data->rd_buf_idx = 0; - rx_data->drv_buf_idx = 0; - rx_data->pending_bytes = 0; for (uint8_t i = 0; i < rx_data->config->buf_cnt; i++) { buf_reset(get_buf(rx_data, i)); } From d6727f22d5433bbf0b17f651ba0ccc9d3a0aef1b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:10 +0200 Subject: [PATCH 1599/2300] Revert "[nrf fromlist] drivers: serial: nrfx_uarte2: Clean error on rx_enable" This reverts commit c080d9332c09a9a525c781cbc1283ccbd22e738b. Signed-off-by: Gerard Marull-Paretas --- drivers/serial/uart_nrfx_uarte2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index ebe85448cea..0b8350714eb 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -506,7 +506,6 @@ static int api_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int * flags are already known to the driver (e.g. if flushed data shall be * kept or not). */ - adata->err = 0; adata->en_rx_buf = buf; adata->en_rx_len = len; From 3f2ce5a0395bd8053126067a0472a1447518aeb7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:10 +0200 Subject: [PATCH 1600/2300] Revert "[nrf fromtree] drivers: serial: nrfx_uarte2: Fix re-enabling the RX" This reverts commit 8fd1556ae3a6730001464830139a928319889a27. Signed-off-by: Gerard Marull-Paretas --- drivers/serial/uart_nrfx_uarte2.c | 42 +++++++------------------------ 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index 0b8350714eb..67e6adfccd5 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -115,9 +115,6 @@ struct uarte_async_data { uart_callback_t user_callback; void *user_data; - uint8_t *en_rx_buf; - size_t en_rx_len; - struct k_timer tx_timer; struct k_timer rx_timer; @@ -291,22 +288,6 @@ static void on_rx_buf_req(const struct device *dev) struct uarte_async_data *adata = data->async; const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); - /* If buffer is not null it indicates that event comes from RX enabling - * function context. We need to pass provided buffer to the driver. - */ - if (adata->en_rx_buf) { - uint8_t *buf = adata->en_rx_buf; - size_t len = adata->en_rx_len; - nrfx_err_t err; - - adata->en_rx_buf = NULL; - adata->en_rx_len = 0; - - err = nrfx_uarte_rx_buffer_set(nrfx_dev, buf, len); - __ASSERT_NO_MSG(err == NRFX_SUCCESS); - return; - } - struct uart_event evt = { .type = UART_RX_BUF_REQUEST }; @@ -315,6 +296,8 @@ static void on_rx_buf_req(const struct device *dev) * reception of one buffer was terminated to restart another transfer. */ if (!K_TIMEOUT_EQ(adata->rx_timeout, K_NO_WAIT)) { + /* Read and clear any pending new data information. */ + nrfx_uarte_rx_new_data_check(nrfx_dev); nrfx_uarte_rxdrdy_enable(nrfx_dev); } data->async->user_callback(dev, &evt, data->async->user_data); @@ -495,28 +478,22 @@ static int api_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int if (timeout != SYS_FOREVER_US) { adata->idle_cnt = RX_TIMEOUT_DIV + 1; adata->rx_timeout = K_USEC(timeout / RX_TIMEOUT_DIV); - nrfx_uarte_rxdrdy_enable(nrfx_dev); } else { adata->rx_timeout = K_NO_WAIT; } - /* Store the buffer. It will be passed to the driver in the event handler. - * We do that instead of calling nrfx_uarte_rx_buffer_set here to ensure - * that nrfx_uarte_rx_buffer_set is called when RX enable configuration - * flags are already known to the driver (e.g. if flushed data shall be - * kept or not). - */ - adata->en_rx_buf = buf; - adata->en_rx_len = len; - - atomic_or(&data->flags, UARTE_DATA_FLAG_RX_ENABLED); + err = nrfx_uarte_rx_buffer_set(nrfx_dev, buf, len); + if (err != NRFX_SUCCESS) { + return -EIO; + } err = nrfx_uarte_rx_enable(nrfx_dev, flags); if (err != NRFX_SUCCESS) { - atomic_and(&data->flags, ~UARTE_DATA_FLAG_RX_ENABLED); return (err == NRFX_ERROR_BUSY) ? -EBUSY : -EIO; } + atomic_or(&data->flags, UARTE_DATA_FLAG_RX_ENABLED); + return 0; } @@ -973,8 +950,7 @@ static int uarte_nrfx_pm_action(const struct device *dev, UARTE_MEMORY_SECTION(idx) __aligned(4); \ static nrfx_uarte_rx_cache_t uarte##idx##_rx_cache_scratch; \ IF_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN, \ - (static uint8_t a2i_rx_buf##idx[CONFIG_UART_##idx##_A2I_RX_SIZE] \ - UARTE_MEMORY_SECTION(idx) __aligned(4);)) \ + (static uint8_t a2i_rx_buf##idx[CONFIG_UART_##idx##_A2I_RX_SIZE];)) \ PINCTRL_DT_DEFINE(UARTE(idx)); \ static const struct uart_async_to_irq_config uarte_a2i_config_##idx = \ UART_ASYNC_TO_IRQ_API_CONFIG_INITIALIZER(&a2i_api, \ From bab41529fb665db64b854405d4e6b3d3afd4f771 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:11 +0200 Subject: [PATCH 1601/2300] Revert "[nrf fromlist] manifest: Update hal_nordic fix nrfx_uarte fixes" This reverts commit 100646ff29f04b35dd2387e40cda494882a49a0b. 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 0b80a43c597..c25c87dcd32 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: f8e4d73a78316ea9ef85f09f24a3a229e40c1a80 + revision: fc2bab706f195c64d40016c9855b8acd7c235ded path: modules/hal/nordic groups: - hal From c0a42d06b7f6669a8e9c81f74a6245732beab836 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:11 +0200 Subject: [PATCH 1602/2300] Revert "[nrf fromtree] tests: drivers: counter: add nRF54L15 overlay" This reverts commit b85b85b1873a59f13e7dcee558845b623ff883b9. Signed-off-by: Gerard Marull-Paretas --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 54b47926164..00000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,34 +0,0 @@ -&timer00 { - prescaler = <6>; - status = "okay"; -}; - -&timer10 { - prescaler = <4>; - status = "okay"; -}; - -&timer20 { - prescaler = <4>; - status = "okay"; -}; - -&timer21 { - prescaler = <4>; - status = "okay"; -}; - -&timer22 { - prescaler = <4>; - status = "okay"; -}; - -&timer23 { - prescaler = <4>; - status = "okay"; -}; - -&timer24 { - prescaler = <4>; - status = "okay"; -}; From f5b98a085ddf5fa8be4a853c0a069855aeaff5b8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:11 +0200 Subject: [PATCH 1603/2300] Revert "[nrf fromlist] wifi: shell: Support WPA auto personal security mode" This reverts commit f46813ec86e56ed491ca0180f993e998e48c89ed. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/net/wifi.h | 2 -- subsys/net/l2/wifi/wifi_mgmt.c | 3 +-- subsys/net/l2/wifi/wifi_shell.c | 5 ++--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index ebfc76d2192..a0840a2319a 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -49,8 +49,6 @@ enum wifi_security_type { WIFI_SECURITY_TYPE_WEP, /** WPA-PSK security. */ WIFI_SECURITY_TYPE_WPA_PSK, - /** WPA/WPA2/WPA3 PSK security. */ - WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL, __WIFI_SECURITY_TYPE_AFTER_LAST, WIFI_SECURITY_TYPE_MAX = __WIFI_SECURITY_TYPE_AFTER_LAST - 1, diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 51e76aec5fb..72552d371d7 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -275,8 +275,7 @@ static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, (params->ssid_length == 0U) || ((params->security == WIFI_SECURITY_TYPE_PSK || params->security == WIFI_SECURITY_TYPE_WPA_PSK || - params->security == WIFI_SECURITY_TYPE_PSK_SHA256 || - params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) && + params->security == WIFI_SECURITY_TYPE_PSK_SHA256) && ((params->psk_length < 8) || (params->psk_length > 64) || (params->psk_length == 0U) || !params->psk)) || ((params->security == WIFI_SECURITY_TYPE_SAE) && diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index a81af57d40f..b938a80bc4b 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1898,9 +1898,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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" - "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP," - " 7: WPA-PSK, 8: WPA-Auto-Personal\n" + "[-k, --key-mgmt]: Key Management type\n" + "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n" "[-m, --bssid]: MAC address of the AP (BSSID).\n" From 3b38ac315d5947efb63dc0e19988dae344ab59e7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:11 +0200 Subject: [PATCH 1604/2300] Revert "[nrf noup] samples/**/smp_svr: testcase of nrf54l15pdk with ext-flash" This reverts commit 849d51f27998807371199e36cf7995652b4864a1. Signed-off-by: Gerard Marull-Paretas --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index e5c30662d90..373c3acccb9 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -94,15 +94,3 @@ tests: - mg100 integration_platforms: - nrf52840dk_nrf52840 - sample.mcumgr.smp_svr.bt.nrf54l15pdk.ext_flash: - extra_args: - - OVERLAY_CONFIG="overlay-bt.conf" - - DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" - - mcuboot_CONF_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.conf" - - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" - extra_configs: - - CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y - platform_allow: - - nrf54l15pdk_nrf54l15_cpuapp - integration_platforms: - - nrf54l15pdk_nrf54l15_cpuapp From 378d9b6eb1ba474c23d210555103e179c89abb6e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:11 +0200 Subject: [PATCH 1605/2300] Revert "[nrf fromlist] soc/nordic/comomn: Added HAS_HW_NRF_GPIO2" This reverts commit dbea77330f5da536adb0dbe33f47c746cbb1ff73. Signed-off-by: Gerard Marull-Paretas --- soc/common/nordic_nrf/Kconfig.peripherals | 3 --- 1 file changed, 3 deletions(-) diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index e10ddb42d20..39ed2e6432f 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -74,9 +74,6 @@ config HAS_HW_NRF_GPIO0 config HAS_HW_NRF_GPIO1 def_bool $(dt_nodelabel_enabled_with_compat,gpio1,$(DT_COMPAT_NORDIC_NRF_GPIO)) -config HAS_HW_NRF_GPIO2 - def_bool $(dt_nodelabel_enabled_with_compat,gpio2,$(DT_COMPAT_NORDIC_NRF_GPIO)) - config HAS_HW_NRF_GPIOTE0 def_bool $(dt_nodelabel_enabled_with_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) From a7c4a08ef718e09a89085f7b6a25c41d2e693848 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:12 +0200 Subject: [PATCH 1606/2300] Revert "[nrf fromlist] boards/nordic/nrf54l15pdk: added mx25r64 flash DTS" This reverts commit 113f05cbc93fb7775ab5512fd56e718d908a03cf. Signed-off-by: Gerard Marull-Paretas --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 17 ------------ .../nrf54l15pdk_nrf54l15_cpuapp.dts | 27 ------------------- 2 files changed, 44 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 31c2f820f3f..96c53f948fc 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -47,21 +47,4 @@ low-power-enable; }; }; - - spi0_default: spi0_default { - group1 { - psels = , - , - ; - }; - }; - - spi0_sleep: spi0_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; }; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index e6ef815e783..0b9e76ff083 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -77,7 +77,6 @@ sw1 = &button1; sw2 = &button2; sw3 = &button3; - spi-flash0 = &mx25r64; }; }; @@ -175,29 +174,3 @@ &clock { status = "okay"; }; - -&spi00 { - status = "okay"; - cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&spi0_default>; - pinctrl-1 = <&spi0_sleep>; - pinctrl-names = "default", "sleep"; - - mx25r64: mx25r6435f@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - status = "disabled"; - spi-max-frequency = <8000000>; - jedec-id = [c2 28 17]; - sfdp-bfp = [ - e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb - ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 - 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 48 44 - 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff - ]; - size = <67108864>; - has-dpd; - t-enter-dpd = <10000>; - t-exit-dpd = <35000>; - }; -}; From 8dcf65af8e82fda3e5d1d4d972d231a86e7cce77 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:12 +0200 Subject: [PATCH 1607/2300] Revert "[nrf noup] boards: nordic: nrf54l15pdk: enable HWFC" This reverts commit c22c9c258ce776b88dac8a917ab13f46a4c7db85. Signed-off-by: Gerard Marull-Paretas --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 22 ++++--------------- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 1 - 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 96c53f948fc..02b02bc8171 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -7,21 +7,14 @@ uart20_default: uart20_default { group1 { psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; + ; }; }; uart20_sleep: uart20_sleep { group1 { psels = , - , - , - ; + ; low-power-enable; }; }; @@ -29,21 +22,14 @@ uart30_default: uart30_default { group1 { psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; + ; }; }; uart30_sleep: uart30_sleep { group1 { psels = , - , - , - ; + ; low-power-enable; }; }; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index 0b9e76ff083..c801ddc8dc5 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -96,7 +96,6 @@ pinctrl-0 = <&uart20_default>; pinctrl-1 = <&uart20_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart30 { From 3182ea8d971d0809585919e0bcf063263f048bba Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:12 +0200 Subject: [PATCH 1608/2300] Revert "[nrf fromlist] boards: nrf54l15pdk_nrf54l15_cpuapp: yaml for PDK 0.3.0" This reverts commit 5647467695b545e6baf127ef6e8d7d0cee0a403f. Signed-off-by: Gerard Marull-Paretas --- .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml deleted file mode 100644 index 8db30713e43..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54l15pdk_nrf54l15_cpuapp@0.3.0 -name: nRF54l15-PDK-nRF54l15-Application -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 256 -flash: 1536 -supported: - - counter - - gpio - - i2c - - spi - - watchdog - - i2s From 83a3f30ebabacd7d02bb6f3301b29d50bf6d7fe5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:12 +0200 Subject: [PATCH 1609/2300] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: Add configuration for BLE" This reverts commit dd3931ad85d643528bec4494898abc6b6cbe21a0. Signed-off-by: Gerard Marull-Paretas --- .../nrf54h20dk_nrf54h20_cpuapp.dts | 13 +-------- .../nrf54h20dk_nrf54h20_cpurad.dts | 13 +-------- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 27 +++++++++++++++++++ 3 files changed, 29 insertions(+), 24 deletions(-) create mode 100644 samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 4b04ff8dcd4..4eff8c7741d 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -23,7 +23,6 @@ zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; zephyr,entropy = &prng; - zephyr,bt-hci-ipc = &ipc0; }; aliases { @@ -99,34 +98,24 @@ status = "okay"; }; -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - &shared_ram3x_region { status = "okay"; }; &cpuapp_bellboard { - status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ nordic,interrupt-mapping = <0x00042001 0>; }; -&cpurad_bellboard { - status = "okay"; -}; - &cpusec_cpuapp_ipc { mbox-names = "tx", "rx"; tx-region = <&cpuapp_cpusec_ipc_shm>; rx-region = <&cpusec_cpuapp_ipc_shm>; }; -ipc0: &cpuapp_cpurad_ipc { - status = "okay"; +&cpuapp_cpurad_ipc { mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpurad_ipc_shm>; rx-region = <&cpurad_cpuapp_ipc_shm>; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 36ac2aef20a..9e3dacbeb32 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -24,7 +24,6 @@ zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; zephyr,entropy = &prng; - zephyr,bt-hci-ipc = &ipc0; }; prng: prng { @@ -37,30 +36,20 @@ status = "okay"; }; -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - &cpurad_bellboard { - status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ nordic,interrupt-mapping = <0x00001001 0>; }; -&cpuapp_bellboard { - status = "okay"; -}; - &cpusec_cpurad_ipc { mbox-names = "tx", "rx"; tx-region = <&cpurad_cpusec_ipc_shm>; rx-region = <&cpusec_cpurad_ipc_shm>; }; -ipc0: &cpuapp_cpurad_ipc { - status = "okay"; +&cpuapp_cpurad_ipc { mbox-names = "tx", "rx"; tx-region = <&cpurad_cpuapp_ipc_shm>; rx-region = <&cpuapp_cpurad_ipc_shm>; diff --git a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 00000000000..02db7c39272 --- /dev/null +++ b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,27 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,bt-hci-ipc = &ipc0; + }; +}; + +ipc0: &cpuapp_cpurad_ipc { + status = "okay"; +}; + +&cpuapp_cpurad_ram0x_region { + status = "okay"; +}; + +&cpurad_bellboard { + status = "okay"; +}; + +&cpuapp_bellboard { + status = "okay"; +}; From ecd7d2cb0a4e9b990fae444a3e64a344cb82855f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:12 +0200 Subject: [PATCH 1610/2300] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: Change IPC default backend" This reverts commit 2f52b92ebdd60f68a8ee1be02e134b3ff4bc8cb6. Signed-off-by: Gerard Marull-Paretas --- .../arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 1 - boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts | 3 +-- boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi index 539e80d149a..9c3d971b9bc 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -21,7 +21,6 @@ }; cpuapp_cpurad_ipc: ipc-2-3 { - compatible = "zephyr,ipc-icbmsg"; status = "disabled"; mboxes = <&cpuapp_bellboard 18>, <&cpurad_bellboard 12>; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 4eff8c7741d..7e5127f8b16 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -116,11 +116,10 @@ }; &cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-initiator"; mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpurad_ipc_shm>; rx-region = <&cpurad_cpuapp_ipc_shm>; - tx-blocks = <32>; - rx-blocks = <32>; }; &cpuapp_cpuppr_ipc { diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 9e3dacbeb32..30fdf7286d5 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -50,11 +50,10 @@ }; &cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-follower"; mbox-names = "tx", "rx"; tx-region = <&cpurad_cpuapp_ipc_shm>; rx-region = <&cpuapp_cpurad_ipc_shm>; - tx-blocks = <32>; - rx-blocks = <32>; }; &cpurad_dma_region { From 51cf483500f04dc83481ae25ed9d1ebe2b42b90c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:13 +0200 Subject: [PATCH 1611/2300] Revert "[nrf fromlist] net: wifi: shell: Remove redundant break" This reverts commit 700870d10917960e4799926b864189d755d95f83. Signed-off-by: Gerard Marull-Paretas --- 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 b938a80bc4b..5578444acc6 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -565,6 +565,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv break; case 'h': return -ENOEXEC; + break; default: PR_ERROR("Invalid option %c\n", opt); shell_help(sh); From f1c5f5a74c76cfad486dbb5975f023b28e365356 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:13 +0200 Subject: [PATCH 1612/2300] Revert "[nrf fromlist] net: wifi: shell: Correct help text for `connect` command" This reverts commit 57e78845ad43eac40c05550507435c7123517174. Signed-off-by: Gerard Marull-Paretas --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 5578444acc6..995e39cbbd2 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1899,7 +1899,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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\n" + "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n" From d815f1dd09ac140546645d15c15a51b639b26d4b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:13 +0200 Subject: [PATCH 1613/2300] Revert "[nrf fromtree] net: wifi: shell: update wifi ap enable to use get opt parsing" This reverts commit 55541273196045fc112c4b97e46a914d0e915291. Signed-off-by: Gerard Marull-Paretas --- subsys/net/l2/wifi/wifi_shell.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 995e39cbbd2..cd4fa7b503e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -496,8 +496,12 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv } break; case 'p': - params->psk = optarg; - params->psk_length = strlen(params->psk); + if (secure_connection) { + params->psk = optarg; + params->psk_length = strlen(params->psk); + } else { + PR_WARNING("Passphrase provided without security configuration\n"); + } break; case 'c': long channel = strtol(optarg, &endptr, 10); @@ -564,7 +568,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv ¶ms->bssid[4], ¶ms->bssid[5]); break; case 'h': - return -ENOEXEC; + shell_help(sh); break; default: PR_ERROR("Invalid option %c\n", opt); @@ -572,9 +576,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv return -EINVAL; } } - if (params->psk && !secure_connection) { - PR_WARNING("Passphrase provided without security configuration\n"); - } + return 0; } @@ -1242,7 +1244,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, int ret; context.sh = sh; - if (__wifi_args_to_params(sh, argc, &argv[0], &cnx_params, WIFI_MODE_AP)) { + if (__wifi_args_to_params(sh, argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); return -ENOEXEC; } @@ -1839,18 +1841,15 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, 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" + "\"\"\n" + "\n" + "[PSK: valid only for secure SSIDs]\n" + "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\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)", + "[MFP (optional: needs security type to be specified)]\n" + ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_ap_enable, - 2, 13), + 3, 3), SHELL_CMD_ARG(stations, NULL, "List stations connected to the AP", cmd_wifi_ap_stations, From a2b4cdba2be687afb6d5ca3351bc0243440bcab8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:13 +0200 Subject: [PATCH 1614/2300] Revert "[nrf fromtree] net: wifi: shell: Support BSSID configuration" This reverts commit edb5148d0ea4823860920c652511df1c78909200. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/net/wifi_mgmt.h | 2 -- subsys/net/l2/wifi/wifi_shell.c | 15 +++------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 70fd5978fba..f8fb7893234 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -352,8 +352,6 @@ struct wifi_connect_req_params { enum wifi_security_type security; /** MFP options */ enum wifi_mfp_options mfp; - /** BSSID */ - uint8_t bssid[WIFI_MAC_ADDR_LEN]; /** Connect timeout in seconds, SYS_FOREVER_MS for no timeout */ int timeout; }; diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index cd4fa7b503e..871680a1705 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -477,7 +477,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv params->security = WIFI_SECURITY_TYPE_NONE; params->mfp = WIFI_MFP_OPTIONAL; - while ((opt = getopt_long(argc, argv, "s:p:k:w:b:c:m:h", long_options, &opt_index)) != -1) { + while ((opt = getopt_long(argc, argv, "s:p:k:w:b:c:h", long_options, &opt_index)) != -1) { state = getopt_state_get(); switch (opt) { case 's': @@ -561,12 +561,6 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv } params->mfp = atoi(optarg); break; - case 'm': - sscanf(optarg, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", - ¶ms->bssid[0], ¶ms->bssid[1], - ¶ms->bssid[2], ¶ms->bssid[3], - ¶ms->bssid[4], ¶ms->bssid[5]); - break; case 'h': shell_help(sh); break; @@ -576,7 +570,6 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv return -EINVAL; } } - return 0; } @@ -1901,11 +1894,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" - ": 0:Disable, 1:Optional, 2:Required.\n" - "[-m, --bssid]: MAC address of the AP (BSSID).\n" - "[-h, --help]: Print out the help for the connect command.\n", + ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_connect, - 2, 7), + 2, 5), SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP.\n", cmd_wifi_disconnect, 1, 0), From e898600b85345eae43611358470ecf8a613a3bea Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:13 +0200 Subject: [PATCH 1615/2300] Revert "[nrf fromtree] net: wifi: shell: Use getopt API for connect options" This reverts commit 512023e7f16a413144b20c76dffd3b492c9505e6. Signed-off-by: Gerard Marull-Paretas --- subsys/net/l2/wifi/wifi_shell.c | 204 ++++++++++++++++++-------------- 1 file changed, 114 insertions(+), 90 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 871680a1705..c512612e7ed 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -442,69 +442,73 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, } } -static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv[], +static int __wifi_args_to_params(size_t argc, char *argv[], struct wifi_connect_req_params *params, enum wifi_iface_mode iface_mode) { char *endptr; int idx = 1; - struct getopt_state *state; - int opt; - bool secure_connection = false; - static struct option long_options[] = {{"ssid", required_argument, 0, 's'}, - {"passphrase", required_argument, 0, 'p'}, - {"key-mgmt", required_argument, 0, 'k'}, - {"ieee-80211w", required_argument, 0, 'w'}, - {"bssid", required_argument, 0, 'm'}, - {"band", required_argument, 0, 'b'}, - {"channel", required_argument, 0, 'c'}, - {"help", no_argument, 0, 'h'}, - {0, 0, 0, 0}}; - int opt_index = 0; - uint8_t band; - const uint8_t all_bands[] = { - WIFI_FREQ_BAND_2_4_GHZ, - WIFI_FREQ_BAND_5_GHZ, - WIFI_FREQ_BAND_6_GHZ - }; - bool found = false; - char bands_str[MAX_BANDS_STR_LEN] = {0}; - size_t offset = 0; + const struct shell *sh = context.sh; /* Defaults */ params->band = WIFI_FREQ_BAND_UNKNOWN; params->channel = WIFI_CHANNEL_ANY; params->security = WIFI_SECURITY_TYPE_NONE; - params->mfp = WIFI_MFP_OPTIONAL; - while ((opt = getopt_long(argc, argv, "s:p:k:w:b:c:h", long_options, &opt_index)) != -1) { - state = getopt_state_get(); - switch (opt) { - case 's': - params->ssid = optarg; - params->ssid_length = strlen(params->ssid); - if (params->ssid_length > WIFI_SSID_MAX_LEN) { - PR_WARNING("SSID too long (max %d characters)\n", - WIFI_SSID_MAX_LEN); - return -EINVAL; - } - break; - case 'k': - params->security = atoi(optarg); - if (params->security) { - secure_connection = true; + /* SSID */ + params->ssid = argv[0]; + params->ssid_length = strlen(params->ssid); + if (params->ssid_length > WIFI_SSID_MAX_LEN) { + PR_WARNING("SSID too long (max %d characters)\n", + WIFI_SSID_MAX_LEN); + return -EINVAL; + } + + /* Channel (optional: STA, mandatory: AP) */ + if ((idx < argc) && (strlen(argv[idx]) <= 3)) { + uint8_t band; + long channel = strtol(argv[idx], &endptr, 10); + const uint8_t all_bands[] = {WIFI_FREQ_BAND_2_4_GHZ, + WIFI_FREQ_BAND_5_GHZ, + WIFI_FREQ_BAND_6_GHZ}; + bool found = false; + char bands_str[MAX_BANDS_STR_LEN] = {0}; + size_t offset = 0; + + if (*endptr != '\0') { + PR_ERROR("Failed to parse channel: %s: endp: %s, err: %s\n", + argv[idx], + endptr, + strerror(errno)); + return -EINVAL; + } + + if (iface_mode == WIFI_MODE_INFRA) { + if (channel < 0) { + /* Negative channel means band */ + switch (-channel) { + case 2: + params->band = WIFI_FREQ_BAND_2_4_GHZ; + break; + case 5: + params->band = WIFI_FREQ_BAND_5_GHZ; + break; + case 6: + params->band = WIFI_FREQ_BAND_6_GHZ; + break; + default: + PR_ERROR("Invalid band: %ld\n", channel); + return -EINVAL; + } } - break; - case 'p': - if (secure_connection) { - params->psk = optarg; - params->psk_length = strlen(params->psk); - } else { - PR_WARNING("Passphrase provided without security configuration\n"); + } else { + if (channel < 0) { + PR_ERROR("Invalid channel: %ld\n", channel); + return -EINVAL; } - break; - case 'c': - long channel = strtol(optarg, &endptr, 10); + } + + if (channel > 0) { for (band = 0; band < ARRAY_SIZE(all_bands); band++) { offset += snprintf(bands_str + offset, sizeof(bands_str) - offset, @@ -533,43 +537,63 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv } params->channel = channel; - break; - case 'b': - if (iface_mode == WIFI_MODE_INFRA) { - switch (atoi(optarg)) { - case 2: - params->band = WIFI_FREQ_BAND_2_4_GHZ; - break; - case 5: - params->band = WIFI_FREQ_BAND_5_GHZ; - break; - case 6: - params->band = WIFI_FREQ_BAND_6_GHZ; - break; - default: - PR_ERROR("Invalid band: %d\n", atoi(optarg)); + } + idx++; + } + + if ((idx == 1) && (iface_mode == WIFI_MODE_AP)) { + PR_ERROR("Invalid channel: %s\n", argv[idx]); + return -EINVAL; + } + + /* PSK (optional) */ + if (idx < argc) { + params->psk = argv[idx]; + params->psk_length = strlen(argv[idx]); + /* Defaults */ + params->security = WIFI_SECURITY_TYPE_PSK; + params->mfp = WIFI_MFP_OPTIONAL; + idx++; + + /* Security type (optional) */ + if (idx < argc) { + unsigned int security = strtol(argv[idx], &endptr, 10); + + if (security <= WIFI_SECURITY_TYPE_MAX) { + params->security = security; + } + idx++; + + /* MFP (optional) */ + if (idx < argc) { + unsigned int mfp = strtol(argv[idx], &endptr, 10); + + if (security == WIFI_SECURITY_TYPE_NONE || + security == WIFI_SECURITY_TYPE_WPA_PSK) { + PR_ERROR("MFP not supported for security type %s\n", + wifi_security_txt(security)); return -EINVAL; } + + if (mfp <= WIFI_MFP_REQUIRED) { + params->mfp = mfp; + } + idx++; } - break; - case 'w': - if (params->security == WIFI_SECURITY_TYPE_NONE || - params->security == WIFI_SECURITY_TYPE_WPA_PSK) { - PR_ERROR("MFP not supported for security type %s\n", - wifi_security_txt(params->security)); - return -EINVAL; - } - params->mfp = atoi(optarg); - break; - case 'h': - shell_help(sh); - break; - default: - PR_ERROR("Invalid option %c\n", opt); - shell_help(sh); + } + + if (params->psk_length < WIFI_PSK_MIN_LEN || + (params->security != WIFI_SECURITY_TYPE_SAE && + params->psk_length > WIFI_PSK_MAX_LEN) || + (params->security == WIFI_SECURITY_TYPE_SAE && + params->psk_length > WIFI_SAE_PSWD_MAX_LEN)) { + PR_ERROR("Invalid PSK length (%d) for security type %s\n", + params->psk_length, + wifi_security_txt(params->security)); return -EINVAL; } } + return 0; } @@ -580,7 +604,7 @@ static int cmd_wifi_connect(const struct shell *sh, size_t argc, struct wifi_connect_req_params cnx_params = { 0 }; context.sh = sh; - if (__wifi_args_to_params(sh, argc, argv, &cnx_params, WIFI_MODE_INFRA)) { + if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_INFRA)) { shell_help(sh); return -ENOEXEC; } @@ -1237,7 +1261,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, int ret; context.sh = sh; - if (__wifi_args_to_params(sh, argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { + if (__wifi_args_to_params(argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); return -ENOEXEC; } @@ -1887,16 +1911,16 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD(ap, &wifi_cmd_ap, "Access Point mode commands.\n", NULL), SHELL_CMD_ARG(connect, NULL, "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" - "[-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" + "\"\"\n" + "[channel number/band: > 0:Channel, 0:any channel,\n" + "< 0:band (-2:2.4GHz, -5:5GHz, -6:6GHz]\n" + "[PSK: valid only for secure SSIDs]\n" + "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" - "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" + "[MFP (optional: needs security type to be specified)]\n" ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_connect, - 2, 5), + 2, 4), SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP.\n", cmd_wifi_disconnect, 1, 0), From add80a7f5b8ef314cadd0162e7a79ae2e60077fe Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:14 +0200 Subject: [PATCH 1616/2300] Revert "[nrf fromtree] tests: drivers: clock_control: Add nRF54L15 to platform allow" This reverts commit d4ee5b3ce2ae353412430857cba05dfe846049cd. Signed-off-by: Gerard Marull-Paretas --- .../clock_control/clock_control_api/testcase.yaml | 2 -- .../clock_control/nrf_clock_calibration/testcase.yaml | 1 - .../clock_control/nrf_lf_clock_start/testcase.yaml | 9 --------- tests/drivers/clock_control/onoff/testcase.yaml | 1 - 4 files changed, 13 deletions(-) diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index 42ca3013a0f..be789c8382a 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -7,7 +7,6 @@ tests: - nrf51dk_nrf51422 - nrf52dk_nrf52832 - nrf52840dk_nrf52840 - - nrf54l15pdk_nrf54l15_cpuapp - nrf9160dk_nrf9160 integration_platforms: - nrf51dk_nrf51422 @@ -19,7 +18,6 @@ tests: - nrf51dk_nrf51422 - nrf52dk_nrf52832 - nrf52840dk_nrf52840 - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_args: CONF_FILE="nrf_lfclk_rc.conf" diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index 8b28612378d..092471d30e4 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -7,6 +7,5 @@ tests: - nrf51dk_nrf51422 - nrf52dk_nrf52832 - nrf52840dk_nrf52840 - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index e24dcb83786..f4940d79896 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -13,7 +13,6 @@ tests: - nrf9160dk_nrf9160 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet - - nrf54l15pdk_nrf54l15_cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_STABILITY=y - CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y @@ -28,7 +27,6 @@ tests: - nrf9160dk_nrf9160 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet - - nrf54l15pdk_nrf54l15_cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY=y - CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y @@ -43,7 +41,6 @@ tests: - nrf9160dk_nrf9160 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -57,7 +54,6 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -71,7 +67,6 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -85,7 +80,6 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -99,7 +93,6 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -113,7 +106,6 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: @@ -127,7 +119,6 @@ tests: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - nrf5340dk_nrf5340_cpunet - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf51dk_nrf51422 extra_configs: diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index cf6d4b3f8cd..a6e03d9a0ec 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -7,7 +7,6 @@ tests: - nrf51dk_nrf51422 - nrf52dk_nrf52832 - nrf52840dk_nrf52840 - - nrf54l15pdk_nrf54l15_cpuapp - nrf9160dk_nrf9160 integration_platforms: - nrf51dk_nrf51422 From 4afff9798b5b891b48a2f6fdd6820b2eae3f2ee1 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:14 +0200 Subject: [PATCH 1617/2300] Revert "[nrf fromtree] Bluetooth: Audio: Add iso_chan to bt_bap_ep_info" This reverts commit 3ae75850e43503aecbe481bfec7a51872e2aa946. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/bluetooth/audio/bap.h | 3 --- subsys/bluetooth/audio/bap_stream.c | 2 -- 2 files changed, 5 deletions(-) diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index a0719bd939d..f61accde211 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -397,9 +397,6 @@ struct bt_bap_ep_info { /** Capabilities type */ enum bt_audio_dir dir; - /** The isochronous channel associated with the endpoint. */ - struct bt_iso_chan *iso_chan; - /** @brief True if the stream associated with the endpoint is able to send data */ bool can_send; diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index dc776c6483d..2f1cf71e8dd 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -107,10 +107,8 @@ int bt_bap_ep_get_info(const struct bt_bap_ep *ep, struct bt_bap_ep_info *info) if (ep->iso == NULL) { info->paired_ep = NULL; - info->iso_chan = NULL; } else { info->paired_ep = bt_bap_iso_get_paired_ep(ep); - info->iso_chan = &ep->iso->chan; } info->can_send = false; From f894e66fcf11931803dd54159f60ae1d9f11c595 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:14 +0200 Subject: [PATCH 1618/2300] Revert "[nrf fromtree] dts: arm: nordic: keep NFCT disabled by default" This reverts commit 70729fcad3c56dd6f84e82c5f2b0b62e99b4301c. Signed-off-by: Gerard Marull-Paretas --- 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 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 13ee05226b7..ed5a21b9935 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -177,7 +177,7 @@ compatible = "nordic,nrf-nfct"; reg = <0x40005000 0x1000>; interrupts = <5 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; gpiote: gpiote0: gpiote@40006000 { diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index f22cb36bc14..5ac9cb2d2f8 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -184,7 +184,7 @@ compatible = "nordic,nrf-nfct"; reg = <0x40005000 0x1000>; interrupts = <5 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; gpiote: gpiote0: gpiote@40006000 { diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index c105da55c76..8efe49a3c91 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -179,7 +179,7 @@ compatible = "nordic,nrf-nfct"; reg = <0x40005000 0x1000>; interrupts = <5 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; gpiote: gpiote0: gpiote@40006000 { diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index c9f1ff2fae9..94e764ec52c 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -449,7 +449,7 @@ nfct: nfct@2d000 { compatible = "nordic,nrf-nfct"; reg = <0x2d000 0x1000>; interrupts = <45 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; mutex: mutex@30000 { From 344264945c8ec2df543226229eddba870092adb8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:14 +0200 Subject: [PATCH 1619/2300] Revert "[nrf fromtree] net: dns-sd: Do not use sockaddr struct directly" This reverts commit 2cad7ad67aa16b023968463d77e26755955bc855. Signed-off-by: Gerard Marull-Paretas --- subsys/net/lib/dns/dns_sd.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/subsys/net/lib/dns/dns_sd.c b/subsys/net/lib/dns/dns_sd.c index 5d4dff10ef9..fa55a24271b 100644 --- a/subsys/net/lib/dns/dns_sd.c +++ b/subsys/net/lib/dns/dns_sd.c @@ -667,40 +667,33 @@ static bool port_in_use_sockaddr(uint16_t proto, uint16_t port, || net_context_port_in_use(proto, port, anyp); } -static bool port_in_use(uint16_t proto, uint16_t port, - const struct in_addr *addr4, - const struct in6_addr *addr6) +static bool port_in_use(uint16_t proto, uint16_t port, const struct in_addr *addr4, + const struct in6_addr *addr6) { - bool ret = false; + bool r; + struct sockaddr sa; if (addr4 != NULL) { - struct sockaddr_in sa = { 0 }; - - sa.sin_family = AF_INET; - sa.sin_addr = *addr4; + net_sin(&sa)->sin_family = AF_INET; + net_sin(&sa)->sin_addr = *addr4; - ret = port_in_use_sockaddr(proto, port, - (struct sockaddr *)&sa); - if (ret) { - goto out; + r = port_in_use_sockaddr(proto, port, &sa); + if (r) { + return true; } } if (addr6 != NULL) { - struct sockaddr_in6 sa = { 0 }; - - sa.sin6_family = AF_INET6; - sa.sin6_addr = *addr6; + net_sin6(&sa)->sin6_family = AF_INET6; + net_sin6(&sa)->sin6_addr = *addr6; - ret = port_in_use_sockaddr(proto, port, - (struct sockaddr *)&sa); - if (ret) { - goto out; + r = port_in_use_sockaddr(proto, port, &sa); + if (r) { + return true; } } -out: - return ret; + return false; } #else /* CONFIG_NET_TEST */ static inline bool port_in_use(uint16_t proto, uint16_t port, const struct in_addr *addr4, From cfdf3f7e9ac8082e10453edd4772b67b424506da Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:14 +0200 Subject: [PATCH 1620/2300] Revert "[nrf fromtree] tests: drivers: pwm: add support for nRF54 devices" This reverts commit 66fec84a3e19b7661aa0300d257d07eaf9b5a287. Signed-off-by: Gerard Marull-Paretas --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 20 ------------------- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 20 ------------------- tests/drivers/pwm/pwm_api/src/test_pwm.c | 5 +---- tests/drivers/pwm/pwm_api/testcase.yaml | 2 +- 4 files changed, 2 insertions(+), 45 deletions(-) delete mode 100644 tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/pwm/pwm_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index c483d27f569..00000000000 --- a/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -&pinctrl { - pwm_default: pwm_default { - group1 { - psels = ; - }; - }; - pwm_sleep: pwm_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; -}; - -&pwm130 { - status = "okay"; - pinctrl-0 = <&pwm_default>; - pinctrl-1 = <&pwm_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/pwm/pwm_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/pwm/pwm_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 013653617e4..00000000000 --- a/tests/drivers/pwm/pwm_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -&pinctrl { - pwm_default: pwm_default { - group1 { - psels = ; - }; - }; - pwm_sleep: pwm_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; -}; - -&pwm20 { - status = "okay"; - pinctrl-0 = <&pwm_default>; - pinctrl-1 = <&pwm_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/pwm/pwm_api/src/test_pwm.c b/tests/drivers/pwm/pwm_api/src/test_pwm.c index f8e71d1cb24..867025d99b1 100644 --- a/tests/drivers/pwm/pwm_api/src/test_pwm.c +++ b/tests/drivers/pwm/pwm_api/src/test_pwm.c @@ -38,9 +38,6 @@ #elif DT_NODE_HAS_STATUS(DT_ALIAS(pwm_3), okay) #define PWM_DEV_NODE DT_ALIAS(pwm_3) -#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pwm) -#define PWM_DEV_NODE DT_INST(0, nordic_nrf_pwm) - #elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_pwm) #define PWM_DEV_NODE DT_INST(0, st_stm32_pwm) @@ -79,7 +76,7 @@ #if defined CONFIG_BOARD_SAM_E70_XPLAINED #define DEFAULT_PWM_PORT 2 /* PWM on EXT2 connector, pin 8 */ #elif defined CONFIG_PWM_NRFX -#define DEFAULT_PWM_PORT 0 +#define DEFAULT_PWM_PORT DT_PROP(DT_ALIAS(pwm_0), ch0_pin) #elif defined CONFIG_BOARD_ADAFRUIT_ITSYBITSY_M4_EXPRESS #define DEFAULT_PWM_PORT 2 /* TCC1/WO[2] on PA18 (D7) */ #elif defined CONFIG_BOARD_MIMXRT685_EVK diff --git a/tests/drivers/pwm/pwm_api/testcase.yaml b/tests/drivers/pwm/pwm_api/testcase.yaml index aca9172fc96..608a4d0a0e1 100644 --- a/tests/drivers/pwm/pwm_api/testcase.yaml +++ b/tests/drivers/pwm/pwm_api/testcase.yaml @@ -6,5 +6,5 @@ tests: - userspace filter: dt_alias_exists("pwm-0") or dt_alias_exists("pwm-1") or dt_alias_exists("pwm-2") or dt_alias_exists("pwm-3") or dt_compat_enabled("st,stm32-pwm") - or dt_compat_enabled("intel,blinky-pwm") or dt_compat_enabled("nordic,nrf-pwm") + or dt_compat_enabled("intel,blinky-pwm") depends_on: pwm From 94bd204845c25d08c7fa9fb61ba7e188746df6f2 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:15 +0200 Subject: [PATCH 1621/2300] Revert "[nrf fromtree] boards: nordic: nrf54l15pdk: mark PWM as supported" This reverts commit ecdf156a7c546417559d2abcdba9cfa696d89116. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml index e8e69adfc6d..de5ce29d162 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.yaml @@ -14,7 +14,6 @@ flash: 1536 supported: - gpio - i2c - - pwm - spi - watchdog - i2s From 6b9824e0970877931df9dd369964db0f5e5cbd7c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:15 +0200 Subject: [PATCH 1622/2300] Revert "[nrf fromtree] drivers: pwm: add support for nRF54 devices" This reverts commit 3b0c038225cd86ed4fabe5fe937c61cff6bd6be2. Signed-off-by: Gerard Marull-Paretas --- drivers/pwm/Kconfig.nrfx | 8 -------- drivers/pwm/pwm_nrfx.c | 32 -------------------------------- 2 files changed, 40 deletions(-) diff --git a/drivers/pwm/Kconfig.nrfx b/drivers/pwm/Kconfig.nrfx index 933fe7cb29c..9a84c5fd21b 100644 --- a/drivers/pwm/Kconfig.nrfx +++ b/drivers/pwm/Kconfig.nrfx @@ -9,14 +9,6 @@ config PWM_NRFX select NRFX_PWM1 if HAS_HW_NRF_PWM1 select NRFX_PWM2 if HAS_HW_NRF_PWM2 select NRFX_PWM3 if HAS_HW_NRF_PWM3 - select NRFX_PWM20 if HAS_HW_NRF_PWM20 - select NRFX_PWM21 if HAS_HW_NRF_PWM21 - select NRFX_PWM22 if HAS_HW_NRF_PWM22 - select NRFX_PWM120 if HAS_HW_NRF_PWM120 - select NRFX_PWM130 if HAS_HW_NRF_PWM130 - select NRFX_PWM131 if HAS_HW_NRF_PWM131 - select NRFX_PWM132 if HAS_HW_NRF_PWM132 - select NRFX_PWM133 if HAS_HW_NRF_PWM133 select PINCTRL help Enable support for nrfx Hardware PWM driver for nRF52 MCU series. diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 9feacb2c10b..52257dce104 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -391,35 +391,3 @@ PWM_NRFX_DEVICE(2); #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 - -#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 From b81198bc6c15a7a8e3140f100a153fc055bbeed5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:15 +0200 Subject: [PATCH 1623/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx: add support for nRF54 PWM" This reverts commit 1730143bcf32278f446e310ad6a5458a4408d191. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/nrfx/Kconfig | 40 --------------------------- modules/hal_nordic/nrfx/nrfx_config.h | 24 ---------------- 2 files changed, 64 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 22758742ef4..7d34f2f289d 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -184,46 +184,6 @@ config NRFX_PWM3 depends on $(dt_nodelabel_has_compat,pwm3,$(DT_COMPAT_NORDIC_NRF_PWM)) select NRFX_PWM -config NRFX_PWM20 - bool "PWM20 driver instance" - depends on $(dt_nodelabel_has_compat,pwm20,$(DT_COMPAT_NORDIC_NRF_PWM)) - select NRFX_PWM - -config NRFX_PWM21 - bool "PWM21 driver instance" - depends on $(dt_nodelabel_has_compat,pwm21,$(DT_COMPAT_NORDIC_NRF_PWM)) - select NRFX_PWM - -config NRFX_PWM22 - bool "PWM22 driver instance" - depends on $(dt_nodelabel_has_compat,pwm22,$(DT_COMPAT_NORDIC_NRF_PWM)) - select NRFX_PWM - -config NRFX_PWM120 - bool "PWM120 driver instance" - depends on $(dt_nodelabel_has_compat,pwm120,$(DT_COMPAT_NORDIC_NRF_PWM)) - select NRFX_PWM - -config NRFX_PWM130 - bool "PWM130 driver instance" - depends on $(dt_nodelabel_has_compat,pwm130,$(DT_COMPAT_NORDIC_NRF_PWM)) - select NRFX_PWM - -config NRFX_PWM131 - bool "PWM131 driver instance" - depends on $(dt_nodelabel_has_compat,pwm131,$(DT_COMPAT_NORDIC_NRF_PWM)) - select NRFX_PWM - -config NRFX_PWM132 - bool "PWM132 driver instance" - depends on $(dt_nodelabel_has_compat,pwm132,$(DT_COMPAT_NORDIC_NRF_PWM)) - select NRFX_PWM - -config NRFX_PWM133 - bool "PWM133 driver instance" - depends on $(dt_nodelabel_has_compat,pwm133,$(DT_COMPAT_NORDIC_NRF_PWM)) - select NRFX_PWM - config NRFX_QDEC bool diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 4a7ae346d84..c4798d1906a 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -248,30 +248,6 @@ #ifdef CONFIG_NRFX_PWM3 #define NRFX_PWM3_ENABLED 1 #endif -#ifdef CONFIG_NRFX_PWM20 -#define NRFX_PWM20_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PWM21 -#define NRFX_PWM21_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PWM22 -#define NRFX_PWM22_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PWM120 -#define NRFX_PWM120_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PWM130 -#define NRFX_PWM130_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PWM131 -#define NRFX_PWM131_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PWM132 -#define NRFX_PWM132_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_PWM133 -#define NRFX_PWM133_ENABLED 1 -#endif #ifdef CONFIG_NRFX_QDEC #define NRFX_QDEC_ENABLED 1 From 6547ac18282d8b2a8d49d1ad01041daa916891b0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:15 +0200 Subject: [PATCH 1624/2300] Revert "[nrf fromtree] soc: nordic: add nRF54 PWM HAS_HW & base addr validation" This reverts commit 591e739e9611a28643a49ea9bc919667f65cfd07. Signed-off-by: Gerard Marull-Paretas --- soc/arm/nordic_nrf/validate_base_addresses.c | 8 ------- soc/common/nordic_nrf/Kconfig.peripherals | 24 -------------------- 2 files changed, 32 deletions(-) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index f3c1b29b69a..04c7a1ae3cd 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -209,14 +209,6 @@ CHECK_DT_REG(pwm0, NRF_PWM0); CHECK_DT_REG(pwm1, NRF_PWM1); CHECK_DT_REG(pwm2, NRF_PWM2); CHECK_DT_REG(pwm3, NRF_PWM3); -CHECK_DT_REG(pwm20, NRF_PWM20); -CHECK_DT_REG(pwm21, NRF_PWM21); -CHECK_DT_REG(pwm22, NRF_PWM22); -CHECK_DT_REG(pwm120, NRF_PWM120); -CHECK_DT_REG(pwm130, NRF_PWM130); -CHECK_DT_REG(pwm131, NRF_PWM131); -CHECK_DT_REG(pwm132, NRF_PWM132); -CHECK_DT_REG(pwm133, NRF_PWM133); CHECK_DT_REG(qdec, NRF_QDEC0); /* this should be the same node as qdec0 */ CHECK_DT_REG(qdec0, NRF_QDEC0); CHECK_DT_REG(qdec1, NRF_QDEC1); diff --git a/soc/common/nordic_nrf/Kconfig.peripherals b/soc/common/nordic_nrf/Kconfig.peripherals index 39ed2e6432f..a6b62428626 100644 --- a/soc/common/nordic_nrf/Kconfig.peripherals +++ b/soc/common/nordic_nrf/Kconfig.peripherals @@ -149,30 +149,6 @@ config HAS_HW_NRF_PWM2 config HAS_HW_NRF_PWM3 def_bool $(dt_nodelabel_enabled_with_compat,pwm3,$(DT_COMPAT_NORDIC_NRF_PWM)) -config HAS_HW_NRF_PWM20 - def_bool $(dt_nodelabel_enabled_with_compat,pwm20,$(DT_COMPAT_NORDIC_NRF_PWM)) - -config HAS_HW_NRF_PWM21 - def_bool $(dt_nodelabel_enabled_with_compat,pwm21,$(DT_COMPAT_NORDIC_NRF_PWM)) - -config HAS_HW_NRF_PWM22 - def_bool $(dt_nodelabel_enabled_with_compat,pwm22,$(DT_COMPAT_NORDIC_NRF_PWM)) - -config HAS_HW_NRF_PWM120 - def_bool $(dt_nodelabel_enabled_with_compat,pwm120,$(DT_COMPAT_NORDIC_NRF_PWM)) - -config HAS_HW_NRF_PWM130 - def_bool $(dt_nodelabel_enabled_with_compat,pwm130,$(DT_COMPAT_NORDIC_NRF_PWM)) - -config HAS_HW_NRF_PWM131 - def_bool $(dt_nodelabel_enabled_with_compat,pwm131,$(DT_COMPAT_NORDIC_NRF_PWM)) - -config HAS_HW_NRF_PWM132 - def_bool $(dt_nodelabel_enabled_with_compat,pwm132,$(DT_COMPAT_NORDIC_NRF_PWM)) - -config HAS_HW_NRF_PWM133 - def_bool $(dt_nodelabel_enabled_with_compat,pwm133,$(DT_COMPAT_NORDIC_NRF_PWM)) - config HAS_HW_NRF_QDEC0 def_bool $(dt_nodelabel_enabled_with_compat,qdec0,$(DT_COMPAT_NORDIC_NRF_QDEC)) From d764d5807a572b44e5de81bee5ce5ecc419989c6 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:15 +0200 Subject: [PATCH 1625/2300] Revert "[nrf fromtree] dts: nordic: add PWM instances for nRF54 Series" This reverts commit 293ae3de1470640f70664dd3c4d7e006440012d5. Signed-off-by: Gerard Marull-Paretas --- .../nordic/nrf54l15_cpuapp_peripherals.dtsi | 24 ----------- dts/common/nordic/nrf54h20.dtsi | 40 ------------------- 2 files changed, 64 deletions(-) diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index eb161844841..25f94241336 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -261,30 +261,6 @@ timer24: timer@ce000 { prescaler = <0>; }; -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>; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index ec5c4cca14f..78e4c5b6549 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -345,14 +345,6 @@ prescaler = <0>; }; - pwm120: pwm@8e4000 { - compatible = "nordic,nrf-pwm"; - reg = <0x8e4000 0x1000>; - status = "disabled"; - interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - spi120: spi@8e6000 { compatible = "nordic,nrf-spim"; reg = <0x8e6000 0x1000>; @@ -610,14 +602,6 @@ prescaler = <0>; }; - pwm130: pwm@9a4000 { - compatible = "nordic,nrf-pwm"; - reg = <0x9a4000 0x1000>; - status = "disabled"; - interrupts = <420 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - i2c130: i2c@9a5000 { compatible = "nordic,nrf-twim"; reg = <0x9a5000 0x1000>; @@ -700,14 +684,6 @@ prescaler = <0>; }; - pwm131: pwm@9b4000 { - compatible = "nordic,nrf-pwm"; - reg = <0x9b4000 0x1000>; - status = "disabled"; - interrupts = <436 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - i2c132: i2c@9b5000 { compatible = "nordic,nrf-twim"; reg = <0x9b5000 0x1000>; @@ -790,14 +766,6 @@ prescaler = <0>; }; - pwm132: pwm@9c4000 { - compatible = "nordic,nrf-pwm"; - reg = <0x9c4000 0x1000>; - status = "disabled"; - interrupts = <452 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - i2c134: i2c@9c5000 { compatible = "nordic,nrf-twim"; reg = <0x9c5000 0x1000>; @@ -880,14 +848,6 @@ prescaler = <0>; }; - pwm133: pwm@9d4000 { - compatible = "nordic,nrf-pwm"; - reg = <0x9d4000 0x1000>; - status = "disabled"; - interrupts = <468 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - i2c136: i2c@9d5000 { compatible = "nordic,nrf-twim"; reg = <0x9d5000 0x1000>; From 62bd97f2136bb2b10b2ae25f6e7a715f8914587c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:16 +0200 Subject: [PATCH 1626/2300] Revert "[nrf fromtree] manifest: update hal_nordic to have PWM fix for nRF54" This reverts commit 70a046e332a078778d3ef4e78e13b6108ae4a0bb. 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 c25c87dcd32..720e5d5a97b 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: fc2bab706f195c64d40016c9855b8acd7c235ded + revision: 7803a3e6b606ddde8df9a10108d7251a108bd7c9 path: modules/hal/nordic groups: - hal From 039e83e80d3563da8bb2edbaeb8c5a02af9caa2e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:16 +0200 Subject: [PATCH 1627/2300] Revert "[nrf fromtree] samples: sensor: qdec: Move console regex to each test" This reverts commit 22e2d8781ef57c215b49539ae1b16fcd42b331cf. Signed-off-by: Gerard Marull-Paretas --- samples/sensor/qdec/sample.yaml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/samples/sensor/qdec/sample.yaml b/samples/sensor/qdec/sample.yaml index 8d5652906a1..48654c582a6 100644 --- a/samples/sensor/qdec/sample.yaml +++ b/samples/sensor/qdec/sample.yaml @@ -5,18 +5,17 @@ common: tags: sensors timeout: 5 harness: console - + harness_config: + type: multi_line + ordered: true + regex: + - "Quadrature decoder sensor test" + - "Position = (.*) degrees" tests: sample.sensor.qdec_sensor: platform_allow: nucleo_f401re harness_config: fixture: fixture_mech_encoder - type: multi_line - ordered: true - regex: - - "Quadrature decoder sensor test" - - "Position = (.*) degrees" - sample.sensor.nrf_qdec_sensor: platform_allow: - nrf52840dk_nrf52840 @@ -28,8 +27,3 @@ tests: - nrf54l15pdk_nrf54l15_cpuapp harness_config: fixture: gpio_loopback - type: multi_line - ordered: true - regex: - - "Quadrature decoder sensor test" - - "Position = (.*) degrees" From 997c121e3ddb05e6a934bd5871f8e3fe334de453 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:16 +0200 Subject: [PATCH 1628/2300] Revert "[nrf fromtree] samples: sensor: qdec: Add nRF54L15 to platform allow" This reverts commit 35bde43cd1d7b516f79e70e434ca1954801dc309. Signed-off-by: Gerard Marull-Paretas --- samples/sensor/qdec/sample.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/sensor/qdec/sample.yaml b/samples/sensor/qdec/sample.yaml index 48654c582a6..5849f3e00c7 100644 --- a/samples/sensor/qdec/sample.yaml +++ b/samples/sensor/qdec/sample.yaml @@ -20,10 +20,8 @@ tests: platform_allow: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf52840dk_nrf52840 - nrf5340dk_nrf5340_cpuapp - - nrf54l15pdk_nrf54l15_cpuapp harness_config: fixture: gpio_loopback From d643ed127aafb06460be7c0fb6857fbf47b86f34 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:16 +0200 Subject: [PATCH 1629/2300] Revert "[nrf noup] test-spec: include nrf54 boards in low-level test trigger" This reverts commit 3c68e19f4eb40c472b8be4fdff067c2519f7379f. Signed-off-by: Gerard Marull-Paretas --- .github/test-spec.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index f0ac25e3f27..a4776a433f3 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -293,8 +293,6 @@ "CI-test-low-level": - "dts/**/*" - - "boards/arm/nrf54*/**/*" - - "boards/riscv/nrf54*/**/*" - "include/zephyr/**/*" - "tests/arch/**/*" - "arch/**/*" From 46c21dcc6c08824aa41f260520da273efd438de5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:16 +0200 Subject: [PATCH 1630/2300] Revert "[nrf fromtree] samples: sensor: qdec: Allow coverage calculation" This reverts commit 7c48c142bd059d2bc40b3339d58af7cea054141a. Signed-off-by: Gerard Marull-Paretas --- samples/sensor/qdec/src/main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/samples/sensor/qdec/src/main.c b/samples/sensor/qdec/src/main.c index 3410d04e5ba..3e7e87ab021 100644 --- a/samples/sensor/qdec/src/main.c +++ b/samples/sensor/qdec/src/main.c @@ -85,11 +85,7 @@ int main(void) qenc_emulate_init(); -#ifndef CONFIG_COVERAGE while (true) { -#else - for (int i = 0; i < 3; i++) { -#endif rc = sensor_sample_fetch(dev); if (rc != 0) { printk("Failed to fetch sample (%d)\n", rc); From ad41a5afcfc80d757ed2eb8e592f72aabc77f1f8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:17 +0200 Subject: [PATCH 1631/2300] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: enable HWFC" This reverts commit dd8fd47265796b558c2d2d495d6880848c50815b. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts | 1 - boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts | 1 - boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts | 1 - 3 files changed, 3 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 7e5127f8b16..894685693ac 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -179,5 +179,4 @@ pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 30fdf7286d5..4ab3876abab 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -75,7 +75,6 @@ pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart136 { diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts index 679afcdc8f9..edce1a8b275 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts @@ -46,7 +46,6 @@ pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart136 { From 16cf5b98560bd1fc98afb9bef173474c95067156 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:17 +0200 Subject: [PATCH 1632/2300] Revert "[nrf noup] entropy: Add fake entropy nRF PRNG driver" This reverts commit c976657eb74bfb052d93479be37594bddeff3d86. Signed-off-by: Gerard Marull-Paretas --- .../nrf54h20dk_nrf54h20_cpuapp.dts | 6 -- .../nrf54h20dk_nrf54h20_cpurad.dts | 6 -- drivers/entropy/CMakeLists.txt | 7 -- drivers/entropy/Kconfig | 1 - drivers/entropy/Kconfig.nrf_prng | 19 ---- drivers/entropy/fake_entropy_nrf_prng.c | 101 ------------------ dts/bindings/rng/nordic,nrf-prng.yaml | 8 -- 7 files changed, 148 deletions(-) delete mode 100644 drivers/entropy/Kconfig.nrf_prng delete mode 100644 drivers/entropy/fake_entropy_nrf_prng.c delete mode 100644 dts/bindings/rng/nordic,nrf-prng.yaml diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 894685693ac..8c6512861e8 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -22,7 +22,6 @@ zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; - zephyr,entropy = &prng; }; aliases { @@ -87,11 +86,6 @@ label = "Green LED 3"; }; }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; }; &cpuapp_ram0x_region { diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 4ab3876abab..3efa07f6349 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -23,12 +23,6 @@ zephyr,code-partition = &cpurad_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; - zephyr,entropy = &prng; - }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; }; }; diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index c3ffe1413e6..11e361517c2 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -34,13 +34,6 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_BT_HCI entropy_bt_hci.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE entropy_gecko_se.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypto.c) -if (CONFIG_FAKE_ENTROPY_NRF_PRNG) - zephyr_library_sources(fake_entropy_nrf_prng.c) - - message(WARNING "\nA nRF PRNG is used, which does not produce real random bits." - "This is not secure and should therefore never be used in a product.") -endif() - if (CONFIG_BUILD_WITH_TFM) target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE $/api_ns/interface/include diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index 604a28e7ac7..e932f62c6bf 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -35,7 +35,6 @@ source "drivers/entropy/Kconfig.gecko" source "drivers/entropy/Kconfig.neorv32" source "drivers/entropy/Kconfig.bt_hci" source "drivers/entropy/Kconfig.psa_crypto" -source "drivers/entropy/Kconfig.nrf_prng" config ENTROPY_HAS_DRIVER bool diff --git a/drivers/entropy/Kconfig.nrf_prng b/drivers/entropy/Kconfig.nrf_prng deleted file mode 100644 index e1b1a9ab4fe..00000000000 --- a/drivers/entropy/Kconfig.nrf_prng +++ /dev/null @@ -1,19 +0,0 @@ -# nRF fake entropy prng generator driver configuration - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if ENTROPY_GENERATOR - -config FAKE_ENTROPY_NRF_PRNG - bool "A fake nRF entropy driver" - default y - depends on DT_HAS_NORDIC_ENTROPY_PRNG_ENABLED - depends on SOC_SERIES_NRF54HX - select ENTROPY_HAS_DRIVER - help - This is a super simple PRNG driver that can be used on nRF platforms that - do not have an entropy source. - This is NOT SAFE to use for cryptographic operations! - -endif diff --git a/drivers/entropy/fake_entropy_nrf_prng.c b/drivers/entropy/fake_entropy_nrf_prng.c deleted file mode 100644 index 8624c844405..00000000000 --- a/drivers/entropy/fake_entropy_nrf_prng.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include - -#define DT_DRV_COMPAT nordic_entropy_prng - -/* This file implements a pseudo-RNG - * https://vigna.di.unimi.it/xorshift/xoshiro128plus.c - */ - -static uint32_t s[4]; - -static inline uint32_t rotl(const uint32_t x, int k) -{ - return (x << k) | (x >> (32 - k)); -} - -static uint32_t rng_next(void) -{ - const uint32_t result = rotl(s[0] + s[3], 7) + s[0]; - - const uint32_t t = s[1] << 9; - - s[2] ^= s[0]; - s[3] ^= s[1]; - s[1] ^= s[2]; - s[0] ^= s[3]; - - s[2] ^= t; - - s[3] = rotl(s[3], 11); - - return result; -} - -static int entropy_prng_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length) -{ - ARG_UNUSED(dev); - - while (length) { - /* - * Note that only 1 thread (Zephyr thread or HW models), runs at - * a time, therefore there is no need to use random_r() - */ - uint32_t value = rng_next(); - - size_t to_copy = MIN(length, sizeof(long)); - - memcpy(buffer, &value, to_copy); - buffer += to_copy; - length -= to_copy; - } - - return 0; -} - -static int entropy_prng_get_entropy_isr(const struct device *dev, uint8_t *buf, uint16_t len, - uint32_t flags) -{ - ARG_UNUSED(flags); - - int err; - - /* - * entropy_prng_get_entropy() is also safe for ISRs - * and always produces data. - */ - err = entropy_prng_get_entropy(dev, buf, len); - if (err < 0) { - return err; - } else { - return len; - } -} - -static int entropy_prng_init(const struct device *dev) -{ - ARG_UNUSED(dev); - - /* Picked some arbitrary initial seed. */ - s[0] = 0xAF568BC0; - s[1] = 0xAC34307E; - s[2] = 0x9B7F6DD1; - s[3] = 0xD84319FC; - return 0; -} - -static const struct entropy_driver_api entropy_prng_api_funcs = { - .get_entropy = entropy_prng_get_entropy, .get_entropy_isr = entropy_prng_get_entropy_isr}; - -DEVICE_DT_INST_DEFINE(0, entropy_prng_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prng_api_funcs); diff --git a/dts/bindings/rng/nordic,nrf-prng.yaml b/dts/bindings/rng/nordic,nrf-prng.yaml deleted file mode 100644 index 8936393a0b6..00000000000 --- a/dts/bindings/rng/nordic,nrf-prng.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -description: This is a super simple PRNG - -compatible: "nordic,entropy-prng" - -include: base.yaml From 6fd64f77046bf621d3de35ca5aa7b18b4d104d92 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:17 +0200 Subject: [PATCH 1633/2300] Revert "[nrf fromtree] net: wifi: Remove constraints for dwell time" This reverts commit a76c880b8922777333549d86b991597cd7a46031. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/net/wifi_mgmt.h | 6 ++++++ subsys/net/l2/wifi/wifi_shell.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index f8fb7893234..a5af218bf4a 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -48,6 +48,12 @@ extern "C" { #endif /* CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL */ #define WIFI_MGMT_BAND_STR_SIZE_MAX 8 +#define WIFI_MGMT_SCAN_MIN_DWELL_TIME_ACTIVE 5 +#define WIFI_MGMT_SCAN_MAX_DWELL_TIME_ACTIVE 1000 +#define WIFI_MGMT_SCAN_MIN_DWELL_TIME_PASSIVE 10 +#define WIFI_MGMT_SCAN_MAX_DWELL_TIME_PASSIVE 1000 +#define WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_ACTIVE 50 +#define WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_PASSIVE 130 #define WIFI_MGMT_SCAN_MAX_BSS_CNT 65535 /** Wi-Fi management commands */ diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c512612e7ed..d62788ab6c8 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -700,7 +700,8 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'a': val = atoi(optarg); - if (val < 0) { + if ((val < WIFI_MGMT_SCAN_MIN_DWELL_TIME_ACTIVE) || + (val > WIFI_MGMT_SCAN_MAX_DWELL_TIME_ACTIVE)) { PR_ERROR("Invalid dwell_time_active val\n"); return -ENOEXEC; } @@ -711,7 +712,8 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'p': val = atoi(optarg); - if (val < 0) { + if ((val < WIFI_MGMT_SCAN_MIN_DWELL_TIME_PASSIVE) || + (val > WIFI_MGMT_SCAN_MAX_DWELL_TIME_PASSIVE)) { PR_ERROR("Invalid dwell_time_passive val\n"); return -ENOEXEC; } @@ -769,7 +771,10 @@ static int wifi_scan_args_to_params(const struct shell *sh, static int cmd_wifi_scan(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); - struct wifi_scan_params params = { 0 }; + struct wifi_scan_params params = { .dwell_time_active = + WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_ACTIVE, + .dwell_time_passive = + WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_PASSIVE, }; bool do_scan = true; int opt_num; From 7f7bf979e7d84d84e0da7b74d4b2595d20997da0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:17 +0200 Subject: [PATCH 1634/2300] Revert "[nrf fromtree] net: wifi: Add reasons for 4 way handshake failure" This reverts commit 98aa4243c15e646e6a82c0a34ddd7454d6d9a9a4. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/net/wifi_mgmt.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index a5af218bf4a..414263d31e7 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -370,14 +370,7 @@ enum wifi_conn_status { WIFI_STATUS_CONN_SUCCESS = 0, /** Connection failed - generic failure */ WIFI_STATUS_CONN_FAIL, - /** Connection failed - wrong password - * Few possible reasons for 4-way handshake failure that we can guess are as follows: - * 1) Incorrect key - * 2) EAPoL frames lost causing timeout - * - * #1 is the likely cause, so, we convey to the user that it is due to - * Wrong passphrase/password. - */ + /** Connection failed - wrong password */ WIFI_STATUS_CONN_WRONG_PASSWORD, /** Connection timed out */ WIFI_STATUS_CONN_TIMEOUT, From aa7a3dd5b98c8d712f1d497ccc787ecb3b54ea2b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:17 +0200 Subject: [PATCH 1635/2300] Revert "[nrf fromtree] net: wifi: Replace numeric values with defines" This reverts commit d9a8f7e0430296e33c738d2be76406528aeed897. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/net/wifi_mgmt.h | 7 ------- subsys/net/l2/wifi/wifi_shell.c | 13 ++++--------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 414263d31e7..25cdf0919f7 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -48,13 +48,6 @@ extern "C" { #endif /* CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL */ #define WIFI_MGMT_BAND_STR_SIZE_MAX 8 -#define WIFI_MGMT_SCAN_MIN_DWELL_TIME_ACTIVE 5 -#define WIFI_MGMT_SCAN_MAX_DWELL_TIME_ACTIVE 1000 -#define WIFI_MGMT_SCAN_MIN_DWELL_TIME_PASSIVE 10 -#define WIFI_MGMT_SCAN_MAX_DWELL_TIME_PASSIVE 1000 -#define WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_ACTIVE 50 -#define WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_PASSIVE 130 -#define WIFI_MGMT_SCAN_MAX_BSS_CNT 65535 /** Wi-Fi management commands */ enum net_request_wifi_cmd { diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d62788ab6c8..f1a52aaf23a 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -700,8 +700,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'a': val = atoi(optarg); - if ((val < WIFI_MGMT_SCAN_MIN_DWELL_TIME_ACTIVE) || - (val > WIFI_MGMT_SCAN_MAX_DWELL_TIME_ACTIVE)) { + if ((val < 5) || (val > 1000)) { PR_ERROR("Invalid dwell_time_active val\n"); return -ENOEXEC; } @@ -712,8 +711,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'p': val = atoi(optarg); - if ((val < WIFI_MGMT_SCAN_MIN_DWELL_TIME_PASSIVE) || - (val > WIFI_MGMT_SCAN_MAX_DWELL_TIME_PASSIVE)) { + if ((val < 10) || (val > 1000)) { PR_ERROR("Invalid dwell_time_passive val\n"); return -ENOEXEC; } @@ -734,7 +732,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, case 'm': val = atoi(optarg); - if ((val < 0) || (val > WIFI_MGMT_SCAN_MAX_BSS_CNT)) { + if ((val < 0) || (val > 65535)) { PR_ERROR("Invalid max_bss val\n"); return -ENOEXEC; } @@ -771,10 +769,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, static int cmd_wifi_scan(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); - struct wifi_scan_params params = { .dwell_time_active = - WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_ACTIVE, - .dwell_time_passive = - WIFI_MGMT_SCAN_DEFAULT_DWELL_TIME_PASSIVE, }; + struct wifi_scan_params params = { .dwell_time_active = 50, .dwell_time_passive = 130, }; bool do_scan = true; int opt_num; From 53385223f24489f0d7fa11ed367cb4f8dd1ecfcf Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:18 +0200 Subject: [PATCH 1636/2300] Revert "[nrf fromtree] net: wifi: Fix disconnect reason codes" This reverts commit b91d6d1ce593bf96cf23c5c7e76cff6479998709. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/net/wifi_mgmt.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 25cdf0919f7..894c25e7e8c 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -369,10 +369,6 @@ enum wifi_conn_status { WIFI_STATUS_CONN_TIMEOUT, /** Connection failed - AP not found */ WIFI_STATUS_CONN_AP_NOT_FOUND, - /** Last connection status */ - WIFI_STATUS_CONN_LAST_STATUS, - /** Connection disconnected status */ - WIFI_STATUS_DISCONN_FIRST_STATUS = WIFI_STATUS_CONN_LAST_STATUS, }; /** Wi-Fi disconnect reason codes. To be overlaid on top of \ref wifi_status @@ -380,7 +376,7 @@ enum wifi_conn_status { */ enum wifi_disconn_reason { /** Unspecified reason */ - WIFI_REASON_DISCONN_UNSPECIFIED = WIFI_STATUS_DISCONN_FIRST_STATUS, + WIFI_REASON_DISCONN_UNSPECIFIED = 0, /** Disconnected due to user request */ WIFI_REASON_DISCONN_USER_REQUEST, /** Disconnected due to AP leaving */ From c287b82d66029f05b7d2be6651e5c60e98143eb0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:18 +0200 Subject: [PATCH 1637/2300] Revert "[nrf fromtree] net: wifi: Set default values of dwell time" This reverts commit 6886bf7441b53a8734482009130f53c8e70166e2. Signed-off-by: Gerard Marull-Paretas --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index f1a52aaf23a..fc4c8cf0def 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -769,7 +769,7 @@ static int wifi_scan_args_to_params(const struct shell *sh, static int cmd_wifi_scan(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); - struct wifi_scan_params params = { .dwell_time_active = 50, .dwell_time_passive = 130, }; + struct wifi_scan_params params = { 0 }; bool do_scan = true; int opt_num; From bec8fac39bf6e6886113258a61445896f7813587 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:18 +0200 Subject: [PATCH 1638/2300] Revert "[nrf fromtree] net: wifi: Add channel validity check for AP mode" This reverts commit df2e0db29ed705f528e2cfb385738b8bf389544b. Signed-off-by: Gerard Marull-Paretas --- subsys/net/l2/wifi/wifi_shell.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index fc4c8cf0def..c1ecf4533b1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -541,11 +541,6 @@ static int __wifi_args_to_params(size_t argc, char *argv[], idx++; } - if ((idx == 1) && (iface_mode == WIFI_MODE_AP)) { - PR_ERROR("Invalid channel: %s\n", argv[idx]); - return -EINVAL; - } - /* PSK (optional) */ if (idx < argc) { params->psk = argv[idx]; From a9ea6cb2e52c2aa362638e6e74beeb0348183f00 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:18 +0200 Subject: [PATCH 1639/2300] Revert "[nrf fromtree] samples: subsys: settings: Add configuration for nRF54L15" This reverts commit d06a1a7d77b564b331b24db2f3cca58076ef28e9. Signed-off-by: Gerard Marull-Paretas --- samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf | 2 -- samples/subsys/settings/sample.yaml | 1 - 2 files changed, 3 deletions(-) delete mode 100644 samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf diff --git a/samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf deleted file mode 100644 index 3746c13c741..00000000000 --- a/samples/subsys/settings/boards/nrf54l15pdk_nrf54l15_cpuapp.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_NVS=y -CONFIG_SETTINGS_NVS=y diff --git a/samples/subsys/settings/sample.yaml b/samples/subsys/settings/sample.yaml index 1bb763eedb4..2cd51d1405d 100644 --- a/samples/subsys/settings/sample.yaml +++ b/samples/subsys/settings/sample.yaml @@ -12,7 +12,6 @@ tests: - native_sim - native_sim_64 - mr_canhubk3 - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - native_sim harness: console From 36a6df9fcff294b54f8bdab97f55f906706a4112 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:18 +0200 Subject: [PATCH 1640/2300] Revert "[nrf fromtree] scripts: snippets: Fix path output on windows" This reverts commit 92095510b5f18979b12718ebb83f3741c6e411ee. Signed-off-by: Gerard Marull-Paretas --- scripts/snippets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/snippets.py b/scripts/snippets.py index 4050f57a973..78ab896e85b 100644 --- a/scripts/snippets.py +++ b/scripts/snippets.py @@ -56,7 +56,7 @@ def append_value(variable, value): path = pathobj.parent / value if not path.is_file(): _err(f'snippet file {pathobj}: {variable}: file not found: {path}') - return f'"{path.as_posix()}"' + return f'"{path}"' if variable in ('DTS_EXTRA_CPPFLAGS'): return f'"{value}"' _err(f'unknown append variable: {variable}') From 61aeecf41347c12130786138ccbb5dbee0d9a696 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:19 +0200 Subject: [PATCH 1641/2300] Revert "[nrf fromtree] tests: drivers: uart: uart_mix_fifo_poll: Add nRF54L15 to platform allow" This reverts commit 2a3a5c9757f1f333a638fce9808d2d352623b76c. Signed-off-by: Gerard Marull-Paretas --- tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 60a3501f9fd..ccfdd1aa717 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -8,7 +8,6 @@ common: - nrf52840dk_nrf52840 - nrf9160dk_nrf9160 - nrf5340dk_nrf5340_cpuapp - - nrf54l15pdk_nrf54l15_cpuapp - nrf52_bsim integration_platforms: - nrf52840dk_nrf52840 From 5e3a7b8b2fe80182bbcc9652d55c9e8e3ba3dd41 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:19 +0200 Subject: [PATCH 1642/2300] Revert "[nrf fromtree] net: lib: http: Correct http_client edge-case behavior" This reverts commit 0f0b9f3c45c6884671a8205f9526be23f9463d15. Signed-off-by: Gerard Marull-Paretas --- subsys/net/lib/http/http_client.c | 105 +++++++++++++----------------- 1 file changed, 47 insertions(+), 58 deletions(-) diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index 0f73ce6e8f8..3992e5fafdd 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -392,11 +392,7 @@ static void http_client_init_parser(struct http_parser *parser, settings->on_url = on_url; } -/* Report a NULL HTTP response to the caller. - * A NULL response is when the HTTP server intentionally closes the TLS socket (using FINACK) - * without sending any HTTP payload. - */ -static void http_report_null(struct http_request *req) +static void http_data_final_null_resp(struct http_request *req) { if (req->internal.response.cb) { NET_DBG("Calling callback for Final Data" @@ -417,28 +413,6 @@ static void http_report_null(struct http_request *req) } } -/* Report a completed HTTP transaction (with no error) to the caller */ -static void http_report_complete(struct http_request *req) -{ - if (req->internal.response.cb) { - NET_DBG("Calling callback for %zd len data", req->internal.response.data_len); - req->internal.response.cb(&req->internal.response, HTTP_DATA_FINAL, - req->internal.user_data); - } -} - -/* Report that some data has been received, but the HTTP transaction is still ongoing. */ -static void http_report_progress(struct http_request *req) -{ - if (req->internal.response.cb) { - NET_DBG("Calling callback for partitioned %zd len data", - req->internal.response.data_len); - - req->internal.response.cb(&req->internal.response, HTTP_DATA_MORE, - req->internal.user_data); - } -} - static int http_wait_data(int sock, struct http_request *req, int32_t timeout) { int total_received = 0; @@ -464,26 +438,24 @@ static int http_wait_data(int sock, struct http_request *req, int32_t timeout) ret = zsock_poll(fds, nfds, remaining_time); if (ret == 0) { LOG_DBG("Timeout"); - ret = -ETIMEDOUT; - goto error; + goto finalize_data; } else if (ret < 0) { - ret = -errno; goto error; } if (fds[0].revents & (ZSOCK_POLLERR | ZSOCK_POLLNVAL)) { - ret = -errno; goto error; } else if (fds[0].revents & ZSOCK_POLLHUP) { /* Connection closed */ - goto closed; + LOG_DBG("Connection closed"); + goto finalize_data; } else if (fds[0].revents & ZSOCK_POLLIN) { received = zsock_recv(sock, req->internal.response.recv_buf + offset, req->internal.response.recv_buf_len - offset, 0); if (received == 0) { /* Connection closed */ - goto closed; + LOG_DBG("Connection closed"); + goto finalize_data; } else if (received < 0) { - ret = -errno; goto error; } else { req->internal.response.data_len += received; @@ -500,41 +472,54 @@ static int http_wait_data(int sock, struct http_request *req, int32_t timeout) offset = 0; } + if (req->internal.response.cb) { + bool notify = false; + enum http_final_call event; + + if (req->internal.response.message_complete) { + NET_DBG("Calling callback for %zd len data", + req->internal.response.data_len); + + notify = true; + event = HTTP_DATA_FINAL; + } else if (offset == 0) { + NET_DBG("Calling callback for partitioned %zd len data", + req->internal.response.data_len); + + notify = true; + event = HTTP_DATA_MORE; + } + + if (notify) { + req->internal.response.cb(&req->internal.response, event, + req->internal.user_data); + + /* Re-use the result buffer and start to fill it again */ + req->internal.response.data_len = 0; + req->internal.response.body_frag_start = NULL; + req->internal.response.body_frag_len = 0; + } + } + if (req->internal.response.message_complete) { - http_report_complete(req); + ret = total_received; break; - } else if (offset == 0) { - http_report_progress(req); - - /* Re-use the result buffer and start to fill it again */ - req->internal.response.data_len = 0; - req->internal.response.body_frag_start = NULL; - req->internal.response.body_frag_len = 0; } } } while (true); - return total_received; + return ret; -closed: - LOG_DBG("Connection closed"); +finalize_data: + ret = total_received; - /* If connection was closed with no data sent, this is a NULL response, and is a special - * case valid response. - */ - if (total_received == 0) { - http_report_null(req); - return total_received; - } - - /* Otherwise, connection was closed mid-way through response, and this should be - * considered an error. - */ - ret = -ECONNRESET; + http_data_final_null_resp(req); + return ret; error: - LOG_DBG("Connection error (%d)", ret); + LOG_DBG("Connection error (%d)", errno); + ret = -errno; return ret; } @@ -734,6 +719,10 @@ int http_client_req(int sock, struct http_request *req, NET_DBG("Wait data failure (%d)", total_recv); ret = total_recv; goto out; + } else if (total_recv == 0) { + NET_DBG("Timeout while waiting data"); + ret = -ETIMEDOUT; + goto out; } NET_DBG("Received %d bytes", total_recv); From f47848363152e5a8943df2a20351566d3d9073b8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:19 +0200 Subject: [PATCH 1643/2300] Revert "[nrf fromtree] net: wifi: Add an build assert for checking states order" This reverts commit 35a387057f373217b6ad64ddc2c31ca939f1e190. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/net/wifi.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index a0840a2319a..0f19d7c4c18 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -138,18 +138,6 @@ enum wifi_iface_state { WIFI_STATE_UNKNOWN }; -/* We rely on the strict order of the enum values, so, let's check it */ -BUILD_ASSERT(WIFI_STATE_DISCONNECTED < WIFI_STATE_INTERFACE_DISABLED && - WIFI_STATE_INTERFACE_DISABLED < WIFI_STATE_INACTIVE && - WIFI_STATE_INACTIVE < WIFI_STATE_SCANNING && - WIFI_STATE_SCANNING < WIFI_STATE_AUTHENTICATING && - WIFI_STATE_AUTHENTICATING < WIFI_STATE_ASSOCIATING && - WIFI_STATE_ASSOCIATING < WIFI_STATE_ASSOCIATED && - WIFI_STATE_ASSOCIATED < WIFI_STATE_4WAY_HANDSHAKE && - WIFI_STATE_4WAY_HANDSHAKE < WIFI_STATE_GROUP_HANDSHAKE && - WIFI_STATE_GROUP_HANDSHAKE < WIFI_STATE_COMPLETED); - - /** Helper function to get user-friendly interface state name. */ const char *wifi_state_txt(enum wifi_iface_state state); From dfe309b1bf92ca24e507cd50b6dc430888ea2f69 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:19 +0200 Subject: [PATCH 1644/2300] Revert "[nrf fromtree] net: wifi: Fix the Wi-Fi state check" This reverts commit e658f5167cb48c29fe434f43c8171f49fecf6e48. Signed-off-by: Gerard Marull-Paretas --- subsys/net/l2/wifi/wifi_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 72552d371d7..a9c931507ed 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -504,7 +504,7 @@ static int wifi_set_power_save(uint32_t mgmt_request, struct net_if *iface, return -EIO; } - if (info.state >= WIFI_STATE_ASSOCIATED) { + if (info.state == WIFI_STATE_COMPLETED) { ps_params->fail_reason = WIFI_PS_PARAM_FAIL_DEVICE_CONNECTED; return -ENOTSUP; From 81a6b1bb12c35c3432dc8eec6e779090336e284b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:19 +0200 Subject: [PATCH 1645/2300] Revert "[nrf fromlist] boards: nrf54l15pdk_nrf54l15_cpuapp: add support for PDK 0.3.0" This reverts commit 93f8406a968cd750bbfa8ada1682a4556972ed66. Signed-off-by: Gerard Marull-Paretas --- .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay | 38 ------------------- .../arm/nrf54l15pdk_nrf54l15/revision.cmake | 2 +- 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay deleted file mode 100644 index d8262dde994..00000000000 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - - -&led0 { - gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; -}; - -&led1 { - gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; -}; - -&led2 { - gpios = <&gpio2 7 GPIO_ACTIVE_HIGH>; -}; - -&led3 { - gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; -}; - -&button0 { - gpios = <&gpio1 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; -}; - -&button1 { - gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; -}; - -&button2 { - gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; -}; - -&button3 { - gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; -}; diff --git a/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake b/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake index 6057362de55..4fe5b260db3 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake +++ b/boards/arm/nrf54l15pdk_nrf54l15/revision.cmake @@ -5,5 +5,5 @@ # board_check_revision(FORMAT MAJOR.MINOR.PATCH - VALID_REVISIONS 0.2.0 0.3.0 + VALID_REVISIONS 0.2.0 DEFAULT_REVISION 0.2.0) From 8d79477ace858b4fc304188fa0460e39f73d82b1 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:20 +0200 Subject: [PATCH 1646/2300] Revert "[nrf fromtree] board: nrf54h20dk: Add missing default BT related configs" This reverts commit a503870a7a7f6f0b1f9a8213998c0a4ed066b194. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig index c0e83e0f6a8..1a029338775 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig +++ b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig @@ -4,18 +4,3 @@ config BOARD default "nrf54h20dk_nrf54h20_cpuapp" if BOARD_NRF54H20DK_NRF54H20_CPUAPP default "nrf54h20dk_nrf54h20_cpurad" if BOARD_NRF54H20DK_NRF54H20_CPURAD - -if BOARD_NRF54H20DK_NRF54H20_CPUAPP - -choice BT_HCI_BUS_TYPE - default BT_HCI_IPC if BT -endchoice - -endif # BOARD_NRF54H20DK_NRF54H20_CPUAPP - -if BOARD_NRF54H20DK_NRF54H20_CPURAD - -config BT_CTLR - default y if BT - -endif # BOARD_NRF54H20DK_NRF54H20_CPURAD From b4e552754c2343ad1f477b0ea0d97540991d5bbb Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:20 +0200 Subject: [PATCH 1647/2300] Revert "[nrf fromtree] boards: nrf54h20: Fix storage partitions for setting subsytem" This reverts commit a6e3fd56ead78a1373f6af36170f48f5736d4e67. Signed-off-by: Gerard Marull-Paretas --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 14 -------------- .../nrf54h20dk_nrf54h20_cpuapp.dts | 4 ---- 2 files changed, 18 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi index 68c0d5cd990..6b6402eb90f 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -181,18 +181,4 @@ reg = <0x126000 DT_SIZE_K(64)>; }; }; - - cpuapp_rw_partitions: cpuapp-rw-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - perm-read; - perm-write; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - - storage_partition: partition@136000 { - reg = <0x136000 DT_SIZE_K(24)>; - }; - }; }; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index 8c6512861e8..a8ea9fe730f 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -130,10 +130,6 @@ status = "okay"; }; -&cpuapp_rw_partitions { - status = "okay"; -}; - &cpuppr_vpr { execution-memory = <&cpuppr_code_data>; source-memory = <&cpuppr_code_partition>; From 5ba69c4a7c4dd056ab6edfc763a7a902488035a8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:20 +0200 Subject: [PATCH 1648/2300] Revert "[nrf fromtree] samples: bluetooth: hci_ipc: Add nrf54h20 DK board overlay" This reverts commit 1b8b90c4b252e40c6ccb56ce25f6b17e616627af. Signed-off-by: Gerard Marull-Paretas --- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index 02db7c39272..00000000000 --- a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,bt-hci-ipc = &ipc0; - }; -}; - -ipc0: &cpuapp_cpurad_ipc { - status = "okay"; -}; - -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - -&cpurad_bellboard { - status = "okay"; -}; - -&cpuapp_bellboard { - status = "okay"; -}; From bcc5f2fc2cb13f44b21de942ad0dba9d34b39e29 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:20 +0200 Subject: [PATCH 1649/2300] Revert "[nrf fromtree] net: dhcpv6: Add configurable DUID buffer length" This reverts commit c24df01678e8fc55ce50b322d484eb3f2b5b56a6. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/net/dhcpv6.h | 7 ++----- subsys/net/lib/dhcpv6/Kconfig | 7 ------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/include/zephyr/net/dhcpv6.h b/include/zephyr/net/dhcpv6.h index 715b8cae858..95b59f530b5 100644 --- a/include/zephyr/net/dhcpv6.h +++ b/include/zephyr/net/dhcpv6.h @@ -38,14 +38,11 @@ enum net_dhcpv6_state { } __packed; #define DHCPV6_TID_SIZE 3 - -#ifndef CONFIG_NET_DHCPV6_DUID_MAX_LEN -#define CONFIG_NET_DHCPV6_DUID_MAX_LEN 22 -#endif +#define DHCPV6_DUID_MAX_SIZE 20 struct net_dhcpv6_duid_raw { uint16_t type; - uint8_t buf[CONFIG_NET_DHCPV6_DUID_MAX_LEN]; + uint8_t buf[DHCPV6_DUID_MAX_SIZE]; } __packed; struct net_dhcpv6_duid_storage { diff --git a/subsys/net/lib/dhcpv6/Kconfig b/subsys/net/lib/dhcpv6/Kconfig index 24443c9b36c..a406f4022a8 100644 --- a/subsys/net/lib/dhcpv6/Kconfig +++ b/subsys/net/lib/dhcpv6/Kconfig @@ -15,13 +15,6 @@ config NET_DHCPV6 select NET_MGMT_EVENT depends on NET_IPV6 && NET_UDP -config NET_DHCPV6_DUID_MAX_LEN - int "The maximum DUID length (not including a type code)" - range 1 128 - default 22 - help - This will set the available number of bytes for the DUID. - if NET_DHCPV6 module = NET_DHCPV6 module-dep = NET_LOG From 29b0d855a099e5715888a345f68eef209997734e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:20 +0200 Subject: [PATCH 1650/2300] Revert "[nrf fromtree] net: ip: Fix for improper offset return by `net_pkt_find_offset()`" This reverts commit 78cf54bcaced3de263184c72f958ee0bf1bf9a8e. Signed-off-by: Gerard Marull-Paretas --- subsys/net/ip/net_pkt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/ip/net_pkt.c b/subsys/net/ip/net_pkt.c index d7556a5023d..38fc288d8f5 100644 --- a/subsys/net/ip/net_pkt.c +++ b/subsys/net/ip/net_pkt.c @@ -1817,7 +1817,7 @@ static int32_t net_pkt_find_offset(struct net_pkt *pkt, uint8_t *ptr) buf = pkt->buffer; while (buf) { - if (buf->data <= ptr && ptr < (buf->data + buf->len)) { + if (buf->data <= ptr && ptr <= (buf->data + buf->len)) { ret = offset + (ptr - buf->data); break; } From 863c3bf143275457be945cb01cd1612b5d722a6a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:21 +0200 Subject: [PATCH 1651/2300] Revert "[nrf fromtree] manifest: Update hal_nordic with DMA address check fix" This reverts commit 7d7953d89e4cfe1c6f8cdf8635d89c3f40324073. 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 720e5d5a97b..9c375a568fe 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 7803a3e6b606ddde8df9a10108d7251a108bd7c9 + revision: 13ac55b5b52c905642e9c54f069109d188aa5840 path: modules/hal/nordic groups: - hal From d80f9b1787f48b7a95fedabf64eda44bcdbaea00 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:21 +0200 Subject: [PATCH 1652/2300] Revert "[nrf fromtree] Samples: Bluetooth: Fix PAwR sample failed to set subevent data" This reverts commit e85f119dcf7f13acb3b239c99bdad69912e3b0af. Signed-off-by: Gerard Marull-Paretas --- samples/bluetooth/periodic_adv_rsp/src/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/samples/bluetooth/periodic_adv_rsp/src/main.c b/samples/bluetooth/periodic_adv_rsp/src/main.c index 6764b023a5a..0b0db776692 100644 --- a/samples/bluetooth/periodic_adv_rsp/src/main.c +++ b/samples/bluetooth/periodic_adv_rsp/src/main.c @@ -295,8 +295,7 @@ int main(void) } while (num_synced < MAX_SYNCS) { - /* Enable continuous scanning */ - err = bt_le_scan_start(BT_LE_SCAN_PASSIVE_CONTINUOUS, device_found); + err = bt_le_scan_start(BT_LE_SCAN_PASSIVE, device_found); if (err) { printk("Scanning failed to start (err %d)\n", err); return 0; From 5557b29d69c359ae40ea387a4521c813ff1d2ddf Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:21 +0200 Subject: [PATCH 1653/2300] Revert "[nrf fromtree] Bluetooth: Host: Add macros for contiuous scanner" This reverts commit 6ba6f31d69b697b7ac87e9e3ef6bf6190e2d613b. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/bluetooth/bluetooth.h | 25 ------------------- include/zephyr/bluetooth/gap.h | 1 - .../host/att/pipeline/dut/src/main.c | 8 +++++- tests/bsim/bluetooth/ll/cis/src/main.c | 11 +++++++- 4 files changed, 17 insertions(+), 28 deletions(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 99a26884371..0cfad9b1f6b 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -2125,18 +2125,6 @@ struct bt_le_scan_cb { BT_GAP_SCAN_FAST_INTERVAL, \ BT_GAP_SCAN_FAST_WINDOW) -/** - * @brief Helper macro to enable active scanning to discover new devices with window == interval. - * - * Continuous scanning should be used to maximize the chances of receiving advertising packets. - */ -#define BT_LE_SCAN_ACTIVE_CONTINUOUS BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \ - BT_LE_SCAN_OPT_FILTER_DUPLICATE, \ - BT_GAP_SCAN_FAST_INTERVAL_MIN, \ - BT_GAP_SCAN_FAST_WINDOW) -BUILD_ASSERT(BT_GAP_SCAN_FAST_WINDOW == BT_GAP_SCAN_FAST_INTERVAL_MIN, - "Continuous scanning is requested by setting window and interval equal."); - /** * @brief Helper macro to enable passive scanning to discover new devices. * @@ -2148,19 +2136,6 @@ BUILD_ASSERT(BT_GAP_SCAN_FAST_WINDOW == BT_GAP_SCAN_FAST_INTERVAL_MIN, BT_GAP_SCAN_FAST_INTERVAL, \ BT_GAP_SCAN_FAST_WINDOW) -/** - * @brief Helper macro to enable passive scanning to discover new devices with window==interval. - * - * This macro should be used if information required for device identification - * (e.g., UUID) are known to be placed in Advertising Data. - */ -#define BT_LE_SCAN_PASSIVE_CONTINUOUS BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \ - BT_LE_SCAN_OPT_FILTER_DUPLICATE, \ - BT_GAP_SCAN_FAST_INTERVAL_MIN, \ - BT_GAP_SCAN_FAST_WINDOW) -BUILD_ASSERT(BT_GAP_SCAN_FAST_WINDOW == BT_GAP_SCAN_FAST_INTERVAL_MIN, - "Continuous scanning is requested by setting window and interval equal."); - /** * @brief Helper macro to enable active scanning to discover new devices. * Include scanning on Coded PHY in addition to 1M PHY. diff --git a/include/zephyr/bluetooth/gap.h b/include/zephyr/bluetooth/gap.h index 16026d218e1..02fa8878c6b 100644 --- a/include/zephyr/bluetooth/gap.h +++ b/include/zephyr/bluetooth/gap.h @@ -708,7 +708,6 @@ extern "C" { * @name Defined GAP timers * @{ */ -#define BT_GAP_SCAN_FAST_INTERVAL_MIN 0x0030 /* 30 ms */ #define BT_GAP_SCAN_FAST_INTERVAL 0x0060 /* 60 ms */ #define BT_GAP_SCAN_FAST_WINDOW 0x0030 /* 30 ms */ #define BT_GAP_SCAN_SLOW_INTERVAL_1 0x0800 /* 1.28 s */ 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 6481ce909b4..1a3c1480e1e 100644 --- a/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c +++ b/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c @@ -151,10 +151,16 @@ static struct bt_conn *connect(void) { int err; struct bt_conn *conn; + struct bt_le_scan_param scan_param = { + .type = BT_LE_SCAN_TYPE_ACTIVE, + .options = BT_LE_SCAN_OPT_NONE, + .interval = BT_GAP_SCAN_FAST_INTERVAL, + .window = BT_GAP_SCAN_FAST_WINDOW, + }; UNSET_FLAG(is_connected); - err = bt_le_scan_start(BT_LE_SCAN_ACTIVE_CONTINUOUS, device_found); + err = bt_le_scan_start(&scan_param, device_found); ASSERT(!err, "Scanning failed to start (err %d)\n", err); LOG_DBG("Central initiating connection..."); diff --git a/tests/bsim/bluetooth/ll/cis/src/main.c b/tests/bsim/bluetooth/ll/cis/src/main.c index e54b2e5224c..665c8e0daa4 100644 --- a/tests/bsim/bluetooth/ll/cis/src/main.c +++ b/tests/bsim/bluetooth/ll/cis/src/main.c @@ -45,6 +45,9 @@ static K_SEM_DEFINE(sem_iso_data, CONFIG_BT_ISO_TX_BUF_COUNT, CONFIG_BT_ISO_TX_BUF_COUNT); static bt_addr_le_t peer_addr; +#define SCAN_INTERVAL 0x0010 +#define SCAN_WINDOW 0x0010 + #define CREATE_CONN_INTERVAL 0x0010 #define CREATE_CONN_WINDOW 0x0010 @@ -66,6 +69,12 @@ static bt_addr_le_t peer_addr; #define ADV_INTERVAL_MIN 0x0020 #define ADV_INTERVAL_MAX 0x0020 +#define BT_LE_SCAN_CUSTOM \ + BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \ + BT_LE_SCAN_OPT_NONE, \ + SCAN_INTERVAL, \ + SCAN_WINDOW) + #define BT_CONN_LE_CREATE_CONN_CUSTOM \ BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \ CREATE_CONN_INTERVAL, \ @@ -442,7 +451,7 @@ static void test_cis_central(void) int chan; printk("Start scanning (%d)...", i); - err = bt_le_scan_start(BT_LE_SCAN_PASSIVE_CONTINUOUS, NULL); + err = bt_le_scan_start(BT_LE_SCAN_CUSTOM, NULL); if (err) { FAIL("Could not start scan: %d\n", err); return; From fd46606cfdea6e25accdb98769d8c5a9c725cd96 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:21 +0200 Subject: [PATCH 1654/2300] Revert "[nrf fromlist] modules: hal_nordic: Add missing nrfx_config entries for nRF54L15" This reverts commit 272786b074227b4abcbe8f954d5bb8acf54f3dd3. Signed-off-by: Gerard Marull-Paretas --- .../nrfx_config_nrf54l15_enga_application.h | 27 ------------------- 1 file changed, 27 deletions(-) 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 57e469686ec..a694a07955d 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h @@ -249,33 +249,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 - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 -#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_NUM_OF_CC_CHANNELS * From 6afcc93398892e1ad79b7b649e7a50db2eb9fe3a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:21 +0200 Subject: [PATCH 1655/2300] Revert "[nrf fromtree] dts: nrf54h20: Add missing global dppic and ipcst configs" This reverts commit 3fb1c87c354a91b6dbc62f5289b05b860534e011. Signed-off-by: Gerard Marull-Paretas --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 4bdaf76e348..f30c777dbe2 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -54,23 +54,3 @@ cpuppr_vevif: &cpuppr_vevif_remote {}; <109 NRF_DEFAULT_IRQ_PRIORITY>, <110 NRF_DEFAULT_IRQ_PRIORITY>; }; - -&dppic130 { - owned-channels = <0>; - sink-channels = <0>; - nonsecure-channels = <0>; - status = "okay"; -}; - -&dppic132 { - owned-channels = <0>; - source-channels = <0>; - nonsecure-channels = <0>; - status = "okay"; -}; - -&ipct130 { - owned-channels = <0>; - source-channel-links = <0 3 0>; - status = "okay"; -}; From 5da9e77535b71172a718134971018849764a16ab Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:22 +0200 Subject: [PATCH 1656/2300] Revert "[nrf fromlist] dts: nrf54h20: move GRTC channels allocation to the SOC dtsi" This reverts commit 479305b555fbe875faf0683efb73bc0bbe4e4656. Signed-off-by: Gerard Marull-Paretas --- .../arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts | 3 +++ dts/arm/nordic/nrf54h20_cpurad.dtsi | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index 3efa07f6349..fd65d2d495a 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -60,6 +60,9 @@ &grtc { status = "okay"; + child-owned-channels = <8 9 10 11 12>; + nonsecure-channels = <8 9 10 11 12>; + owned-channels = <7 8 9 10 11 12 13 14>; }; &uart135 { diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index f30c777dbe2..7b7f236de0c 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -47,10 +47,6 @@ cpuppr_vevif: &cpuppr_vevif_remote {}; }; &grtc { - owned-channels = <7 8 9 10 11 12 13 14>; - child-owned-channels = <8 9 10 11 12>; - nonsecure-channels = <8 9 10 11 12>; interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, - <109 NRF_DEFAULT_IRQ_PRIORITY>, - <110 NRF_DEFAULT_IRQ_PRIORITY>; + <108 NRF_DEFAULT_IRQ_PRIORITY>; }; From 4b8adc477f8cf4ac4eb05e2b5e86491386232f21 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:22 +0200 Subject: [PATCH 1657/2300] Revert "[nrf fromlist] boards: nordic: Add to GRTC missing child-owned-channels allocation" This reverts commit c98ea075249aba735508a2de53bbc4438ac943da. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts | 2 ++ dts/arm/nordic/nrf54h20_cpurad.dtsi | 3 +-- dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts index fd65d2d495a..1998f4fc131 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts @@ -61,6 +61,8 @@ &grtc { status = "okay"; child-owned-channels = <8 9 10 11 12>; + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, + <108 NRF_DEFAULT_IRQ_PRIORITY>; nonsecure-channels = <8 9 10 11 12>; owned-channels = <7 8 9 10 11 12 13 14>; }; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 7b7f236de0c..2f463f2d427 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -47,6 +47,5 @@ cpuppr_vevif: &cpuppr_vevif_remote {}; }; &grtc { - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, - <108 NRF_DEFAULT_IRQ_PRIORITY>; + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index 25f94241336..485d85829a4 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -330,9 +330,7 @@ grtc: grtc@e2000 { reg = <0xe2000 0x1000>; cc-num = <12>; owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - child-owned-channels = <7 8 9 10 11>; - interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, - <229 NRF_DEFAULT_IRQ_PRIORITY>; + interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; }; From 707103862c1ba000d5210e49785914a8261c1af4 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:22 +0200 Subject: [PATCH 1658/2300] Revert "[nrf fromtree] scripts: twister: handlers: pass dev-id for nrfutil" This reverts commit 5b8966b6c9ec3b2cae07bcec349e8e851795ab07. Signed-off-by: Gerard Marull-Paretas --- scripts/pylib/twister/twisterlib/handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index 6170fc8076e..3a13b819649 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -499,7 +499,7 @@ def _create_command(self, runner, hardware): board_id = hardware.probe_id or hardware.id product = hardware.product if board_id is not None: - if runner in ("pyocd", "nrfjprog", "nrfutil"): + if runner in ("pyocd", "nrfjprog"): command_extra_args.append("--dev-id") command_extra_args.append(board_id) elif runner == "openocd" and product == "STM32 STLink": From 09b1d1dfcfddc7a0891681108a1bf6f6090e6c3c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:22 +0200 Subject: [PATCH 1659/2300] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: enable nrfutil" This reverts commit a316ce85304b757f5a51de20e75450fce1cc8ea6. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54h20dk_nrf54h20/board.cmake | 2 -- boards/riscv/nrf54h20dk_nrf54h20/board.cmake | 3 --- 2 files changed, 5 deletions(-) delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/board.cmake diff --git a/boards/arm/nrf54h20dk_nrf54h20/board.cmake b/boards/arm/nrf54h20dk_nrf54h20/board.cmake index 6361f7fe7b4..32d1daac179 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/board.cmake +++ b/boards/arm/nrf54h20dk_nrf54h20/board.cmake @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) - if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) set( diff --git a/boards/riscv/nrf54h20dk_nrf54h20/board.cmake b/boards/riscv/nrf54h20dk_nrf54h20/board.cmake deleted file mode 100644 index 86de994b4e2..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/board.cmake +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) From 1201d35e58895ce82885756334d618ecd3ebb467 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:22 +0200 Subject: [PATCH 1660/2300] Revert "[nrf fromtree] scripts: west_commands: runners: nrf_common: update nRF54H support" This reverts commit 79075ef37fbb80f0710262b2362fec6103da0ece. Signed-off-by: Gerard Marull-Paretas --- scripts/west_commands/runners/nrf_common.py | 62 +++++++++++---------- scripts/west_commands/runners/nrfjprog.py | 3 +- scripts/west_commands/tests/test_nrf.py | 21 +++---- 3 files changed, 42 insertions(+), 44 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 1ea09f8f595..76662c72ea9 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -29,6 +29,10 @@ '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), } @@ -38,7 +42,8 @@ class NrfBinaryRunner(ZephyrBinaryRunner): '''Runner front-end base class for nrf tools.''' 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, + erase_all_uicrs=False): super().__init__(cfg) self.hex_ = cfg.hex_file if family and not family.endswith('_FAMILY'): @@ -50,6 +55,7 @@ def __init__(self, cfg, family, softreset, dev_id, erase=False, self.reset = bool(reset) self.force = force self.recover = bool(recover) + self.erase_all_uicrs = bool(erase_all_uicrs) self.tool_opt = [] for opts in [shlex.split(opt) for opt in tool_opt]: @@ -86,6 +92,11 @@ def do_add_parser(cls, parser): help='''erase all user available non-volatile memory and disable read back protection before flashing (erases flash for both cores on nRF53)''') + parser.add_argument('--erase-all-uicrs', required=False, + action='store_true', + help='''Erase all UICR registers before flashing + (nRF54H only). When not set, only UICR registers + present in the hex file will be erased.''') parser.set_defaults(reset=True) @@ -250,36 +261,14 @@ def program_hex(self): # Get the command use to actually program self.hex_. self.logger.info('Flashing file: {}'.format(self.hex_)) - # What type of erase/core arguments should we pass to the tool? - core = None - - if self.family == 'NRF54H_FAMILY': - erase_arg = 'ERASE_NONE' - - if self.erase: - self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION') - self.exec_op('erase', core='NRFDL_DEVICE_CORE_NETWORK') - - if self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPUAPP'): - if not self.erase: - self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION', - chip_erase_mode='ERASE_UICR', - qspi_erase_mode='ERASE_NONE') - core = 'NRFDL_DEVICE_CORE_APPLICATION' - elif self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPURAD'): - if not self.erase: - self.exec_op('erase', core='NRFDL_DEVICE_CORE_NETWORK', - chip_erase_mode='ERASE_UICR', - qspi_erase_mode='ERASE_NONE') - core = 'NRFDL_DEVICE_CORE_NETWORK' + # What type of erase argument should we pass to the tool? + if self.erase: + erase_arg = 'ERASE_ALL' else: - if self.erase: - erase_arg = 'ERASE_ALL' + if self.family == 'NRF52_FAMILY': + erase_arg = 'ERASE_PAGES_INCLUDING_UICR' else: - if self.family == 'NRF52_FAMILY': - erase_arg = 'ERASE_PAGES_INCLUDING_UICR' - else: - erase_arg = 'ERASE_PAGES' + erase_arg = 'ERASE_PAGES' xip_ranges = { 'NRF52_FAMILY': (0x12000000, 0x19FFFFFF), @@ -295,11 +284,24 @@ def program_hex(self): if self.family == 'NRF53_FAMILY': # nRF53 requires special treatment due to the extra coprocessor. self.program_hex_nrf53(erase_arg, qspi_erase_opt) + elif self.family == 'NRF54H_FAMILY': + self.program_hex_nrf54h() else: - self.op_program(self.hex_, erase_arg, qspi_erase_opt, defer=True, core=core) + self.op_program(self.hex_, erase_arg, qspi_erase_opt, defer=True) self.flush(force=False) + def program_hex_nrf54h(self): + if self.erase_all_uicrs: + uicrs = UICR_RANGES['NRF54H_FAMILY'] + else: + uicrs = self.hex_get_uicrs() + + for uicr_core, range in uicrs.items(): + self.exec_op('erasepage', defer=True, core=uicr_core, page=range[0]) + + self.op_program(self.hex_, 'NO_ERASE', None, defer=True) + def program_hex_nrf53(self, erase_arg, qspi_erase_opt): # program_hex() helper for nRF53. diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index f4bdfa74f97..cfcf43c9e78 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -32,7 +32,8 @@ 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, + erase_all_uicrs=args.erase_all_uicrs) def do_get_boards(self): snrs = self.check_output(['nrfjprog', '--ids']) diff --git a/scripts/west_commands/tests/test_nrf.py b/scripts/west_commands/tests/test_nrf.py index d3f429ef775..a15fe2302e5 100644 --- a/scripts/west_commands/tests/test_nrf.py +++ b/scripts/west_commands/tests/test_nrf.py @@ -5,7 +5,6 @@ import argparse import functools -import io import os from pathlib import Path import shlex @@ -524,16 +523,14 @@ def check_expected(tool, test_case, check_fn, get_snr, tmpdir, runner_config): tmpfile = nrfutil_args[nrfutil_args.index('--batch-path') + 1] cmds = (['nrfutil', '--json', 'device', 'x-execute-batch', '--batch-path', tmpfile, '--serial-number', expected[0]],) - call_args = [call(nrfutil_args)] else: cmds = expected - call_args = check_fn.call_args_list if callable(cmds): - assert (call_args == + assert (check_fn.call_args_list == [call(x) for x in cmds(tmpdir, runner_config.hex_file)]) else: - assert call_args == [call(x) for x in cmds] + assert check_fn.call_args_list == [call(x) for x in cmds] if not test_case.snr: get_snr.assert_called_once_with('*') @@ -545,11 +542,10 @@ def check_expected(tool, test_case, check_fn, get_snr, tmpdir, runner_config): @patch('runners.core.ZephyrBinaryRunner.require') @patch('runners.nrfjprog.NrfBinaryRunner.get_board_snr', side_effect=get_board_snr_patch) -@patch('runners.nrfutil.subprocess.Popen') +@patch('runners.nrfjprog.NrfBinaryRunner.check_output') @patch('runners.nrfjprog.NrfBinaryRunner.check_call') -def test_init(check_call, popen, get_snr, require, tool, test_case, +def test_init(check_call, check_output, get_snr, require, tool, test_case, runner_config, tmpdir): - popen.return_value.__enter__.return_value.stdout = io.BytesIO(b'') require.side_effect = functools.partial(require_patch, tool) runner_config = fix_up_runner_config(test_case, runner_config, tmpdir) @@ -568,7 +564,7 @@ def test_init(check_call, popen, get_snr, require, tool, test_case, runner.run('flash') assert require.called - CHECK_FN_MAP = {'nrfjprog': check_call, 'nrfutil': popen} + CHECK_FN_MAP = {'nrfjprog': check_call, 'nrfutil': check_output} check_expected(tool, test_case, CHECK_FN_MAP[tool], get_snr, tmpdir, runner_config) @@ -577,11 +573,10 @@ def test_init(check_call, popen, get_snr, require, tool, test_case, @patch('runners.core.ZephyrBinaryRunner.require') @patch('runners.nrfjprog.NrfBinaryRunner.get_board_snr', side_effect=get_board_snr_patch) -@patch('runners.nrfutil.subprocess.Popen') +@patch('runners.nrfjprog.NrfBinaryRunner.check_output') @patch('runners.nrfjprog.NrfBinaryRunner.check_call') -def test_create(check_call, popen, get_snr, require, tool, test_case, +def test_create(check_call, check_output, get_snr, require, tool, test_case, runner_config, tmpdir): - popen.return_value.__enter__.return_value.stdout = io.BytesIO(b'') require.side_effect = functools.partial(require_patch, tool) runner_config = fix_up_runner_config(test_case, runner_config, tmpdir) @@ -608,6 +603,6 @@ def test_create(check_call, popen, get_snr, require, tool, test_case, assert require.called - CHECK_FN_MAP = {'nrfjprog': check_call, 'nrfutil': popen} + CHECK_FN_MAP = {'nrfjprog': check_call, 'nrfutil': check_output} check_expected(tool, test_case, CHECK_FN_MAP[tool], get_snr, tmpdir, runner_config) From 054728fc814d030fa7532f7b18d4332d762614f2 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:23 +0200 Subject: [PATCH 1661/2300] Revert "[nrf fromtree] scripts: west_commands: runners: nrfutil: provide live feedback" This reverts commit 084cec5e437aadd93b5479a74eb2e20b6f6a0df4. Signed-off-by: Gerard Marull-Paretas --- scripts/west_commands/runners/nrfutil.py | 51 ++++++++++-------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/scripts/west_commands/runners/nrfutil.py b/scripts/west_commands/runners/nrfutil.py index a7ff512bb9f..50db41abae2 100644 --- a/scripts/west_commands/runners/nrfutil.py +++ b/scripts/west_commands/runners/nrfutil.py @@ -10,10 +10,8 @@ import sys import subprocess -from runners.core import _DRY_RUN from runners.nrf_common import NrfBinaryRunner - class NrfUtilBinaryRunner(NrfBinaryRunner): '''Runner front-end for nrfutil.''' @@ -42,34 +40,27 @@ def do_create(cls, cfg, args): recover=args.recover) def _exec(self, args): - jout_all = [] - - cmd = ['nrfutil', '--json', 'device'] + args - self._log_cmd(cmd) - - if _DRY_RUN: - return {} - - with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p: - for line in iter(p.stdout.readline, b''): - # https://github.com/ndjson/ndjson-spec - jout = json.loads(line.decode(sys.getdefaultencoding())) - jout_all.append(jout) - - if 'x-execute-batch' in args: - if jout['type'] == 'batch_update': - pld = jout['data']['data'] - if ( - pld['type'] == 'task_progress' and - pld['data']['progress']['progressPercentage'] == 0 - ): - self.logger.info(pld['data']['progress']['description']) - elif jout['type'] == 'batch_end' and jout['data']['error']: - raise subprocess.CalledProcessError( - jout['data']['error']['code'], cmd - ) - - return jout_all + try: + out = self.check_output(['nrfutil', '--json', 'device'] + args) + except subprocess.CalledProcessError as e: + # https://docs.python.org/3/reference/compound_stmts.html#except-clause + cpe = e + out = cpe.stdout + else: + cpe = None + finally: + # https://github.com/ndjson/ndjson-spec + out = [json.loads(s) for s in + out.decode(sys.getdefaultencoding()).split('\n') if len(s)] + self.logger.debug(f'output: {out}') + if cpe: + if 'execute-batch' in args: + for o in out: + if o['type'] == 'batch_end' and o['data']['error']: + cpe.returncode = o['data']['error']['code'] + raise cpe + + return out def do_get_boards(self): out = self._exec(['list']) From 2df4882d4464fd42d6006c3028369709f6d87b85 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:23 +0200 Subject: [PATCH 1662/2300] Revert "[nrf fromtree] scripts: west_commands: runners: nrfutil: use x-execute-batch" This reverts commit 09101e38a030f12e8ff8c6e97fc7cc4aa20a9d6b. Signed-off-by: Gerard Marull-Paretas --- scripts/west_commands/runners/nrfutil.py | 2 +- scripts/west_commands/tests/test_nrf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/nrfutil.py b/scripts/west_commands/runners/nrfutil.py index 50db41abae2..719e432a23b 100644 --- a/scripts/west_commands/runners/nrfutil.py +++ b/scripts/west_commands/runners/nrfutil.py @@ -97,7 +97,7 @@ def _exec_batch(self): self._ops = [] self._op_id = 1 self.logger.debug(f'Executing batch in: {json_file}') - self._exec(['x-execute-batch', '--batch-path', f'{json_file}', + self._exec(['execute-batch', '--batch-path', f'{json_file}', '--serial-number', f'{self.dev_id}']) def do_exec_op(self, op, force=False): diff --git a/scripts/west_commands/tests/test_nrf.py b/scripts/west_commands/tests/test_nrf.py index a15fe2302e5..405e6ea9d6c 100644 --- a/scripts/west_commands/tests/test_nrf.py +++ b/scripts/west_commands/tests/test_nrf.py @@ -521,7 +521,7 @@ def check_expected(tool, test_case, check_fn, get_snr, tmpdir, runner_config): # Extract filename nrfutil_args = check_fn.call_args_list[0].args[0] tmpfile = nrfutil_args[nrfutil_args.index('--batch-path') + 1] - cmds = (['nrfutil', '--json', 'device', 'x-execute-batch', '--batch-path', + cmds = (['nrfutil', '--json', 'device', 'execute-batch', '--batch-path', tmpfile, '--serial-number', expected[0]],) else: cmds = expected From ac2f1a8c68f10384c4b43d13da4d16d2f7ad8bdd Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:23 +0200 Subject: [PATCH 1663/2300] Revert "[nrf fromtree] scripts: west_commands: runners: nrfjprog: drop nRF54H support" This reverts commit 6e6e417a4356f9e0c4935ae5388e971698b1ed68. Signed-off-by: Gerard Marull-Paretas --- scripts/west_commands/runners/nrfjprog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index cfcf43c9e78..723080d56c3 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -48,7 +48,7 @@ def do_exec_op(self, op, force=False): families = {'NRF51_FAMILY': 'NRF51', 'NRF52_FAMILY': 'NRF52', 'NRF53_FAMILY': 'NRF53', 'NRF54L_FAMILY': 'NRF54L', - 'NRF91_FAMILY': 'NRF91'} + 'NRF54H_FAMILY': 'NRF54H', 'NRF91_FAMILY': 'NRF91'} cores = {'NRFDL_DEVICE_CORE_APPLICATION': 'CP_APPLICATION', 'NRFDL_DEVICE_CORE_NETWORK': 'CP_NETWORK'} From 895caa12c2d35e1b5944a50e5b3b0173ed2adb01 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:23 +0200 Subject: [PATCH 1664/2300] Revert "[nrf fromtree] scripts: test for imported ELFFile instead of setting it to None" This reverts commit 50d71e240539698b2b6a0da5f8c311cdfa22e4ed. Signed-off-by: Gerard Marull-Paretas --- scripts/west_commands/runners/intel_cyclonev.py | 16 ++++++++++++---- scripts/west_commands/runners/openocd.py | 8 +++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/west_commands/runners/intel_cyclonev.py b/scripts/west_commands/runners/intel_cyclonev.py index c6bfb65eeef..eb67c860800 100644 --- a/scripts/west_commands/runners/intel_cyclonev.py +++ b/scripts/west_commands/runners/intel_cyclonev.py @@ -11,6 +11,11 @@ from os import path from pathlib import Path +try: + from elftools.elf.elffile import ELFFile +except ImportError: + ELFFile = None + from runners.core import ZephyrBinaryRunner, RunnerCaps DEFAULT_OPENOCD_TCL_PORT = 6333 @@ -190,7 +195,7 @@ def to_num(self, number): def read_version(self): self.require(self.openocd_cmd[0]) - # OpenOCD prints in stderr, need redirect to get output + # OpenOCD prints in stderr, need redirect to get output out = self.check_output([self.openocd_cmd[0], '--version'], stderr=subprocess.STDOUT).decode() @@ -205,6 +210,9 @@ def supports_thread_info(self): def do_run(self, command, **kwargs): self.require(self.openocd_cmd[0]) + if ELFFile is None: + raise RuntimeError( + 'elftools missing; please "pip3 install elftools"') self.cfg_cmd = [] if self.openocd_config is not None: @@ -264,11 +272,11 @@ def do_flash_elf(self, **kwargs): self.require(gdb_cmd[0]) self.print_gdbserver_message() - cmd1 = echo + server_cmd + cmd1 = (echo + server_cmd) self.check_call(cmd1) - cmd2 = echo + gdb_cmd + cmd2 = (echo + gdb_cmd) self.check_call(cmd2) - cmd3 = echo + gdb_cmd2 + cmd3 = (echo + gdb_cmd2) self.check_call(cmd3) self.run_server_and_client(server_cmd, gdb_cmd) diff --git a/scripts/west_commands/runners/openocd.py b/scripts/west_commands/runners/openocd.py index dd7c6882a36..ff92d4f58f4 100644 --- a/scripts/west_commands/runners/openocd.py +++ b/scripts/west_commands/runners/openocd.py @@ -1,8 +1,6 @@ # Copyright (c) 2017 Linaro Limited. # # SPDX-License-Identifier: Apache-2.0 -# -# pylint: disable=duplicate-code '''Runner for openocd.''' @@ -15,7 +13,7 @@ try: from elftools.elf.elffile import ELFFile except ImportError: - pass + ELFFile = None from runners.core import ZephyrBinaryRunner @@ -191,7 +189,7 @@ def to_num(self, number): def read_version(self): self.require(self.openocd_cmd[0]) - # OpenOCD prints in stderr, need redirect to get output + # OpenOCD prints in stderr, need redirect to get output out = self.check_output([self.openocd_cmd[0], '--version'], stderr=subprocess.STDOUT).decode() @@ -206,7 +204,7 @@ def supports_thread_info(self): def do_run(self, command, **kwargs): self.require(self.openocd_cmd[0]) - if globals().get('ELFFile') is None: + if ELFFile is None: raise RuntimeError( 'elftools missing; please "pip3 install elftools"') From 86ce31a0ced7549ae57dd64355e63e788a43d7b0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:23 +0200 Subject: [PATCH 1665/2300] Revert "[nrf fromtree] drivers: misc: nordic_vpr_launcher: Update src/exec memory size check" This reverts commit bcb46da71cd8bdd05e159de349384f12b8009994. Signed-off-by: Gerard Marull-Paretas --- .../nordic_vpr_launcher/nordic_vpr_launcher.c | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c index 11b75a2c0e5..64d4969081b 100644 --- a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c +++ b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c @@ -22,7 +22,7 @@ struct nordic_vpr_launcher_config { uintptr_t exec_addr; #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory) uintptr_t src_addr; - size_t size; + size_t src_size; #endif }; @@ -31,10 +31,10 @@ static int nordic_vpr_launcher_init(const struct device *dev) const struct nordic_vpr_launcher_config *config = dev->config; #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(source_memory) - if (config->size > 0U) { + if (config->src_size > 0U) { LOG_DBG("Loading VPR (%p) from %p to %p (%zu bytes)", config->vpr, - (void *)config->src_addr, (void *)config->exec_addr, config->size); - memcpy((void *)config->exec_addr, (void *)config->src_addr, config->size); + (void *)config->src_addr, (void *)config->exec_addr, config->src_size); + memcpy((void *)config->exec_addr, (void *)config->src_addr, config->src_size); } #endif @@ -51,17 +51,19 @@ static int nordic_vpr_launcher_init(const struct device *dev) COND_CODE_0(DT_FIXED_PARTITION_EXISTS(node_id), (0), (DT_REG_ADDR(DT_GPARENT(node_id))))) #define NORDIC_VPR_LAUNCHER_DEFINE(inst) \ - IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, source_memory), \ - (BUILD_ASSERT((DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)) <= \ - DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory))), \ - "Execution memory exceeds source memory size");)) \ + COND_CODE_1(DT_NODE_HAS_PROP(inst, source_memory), \ + (BUILD_ASSERT((DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)) == \ + DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory))), \ + "Source/execution memory sizes mismatch");), \ + ()) \ \ static const struct nordic_vpr_launcher_config config##inst = { \ .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ .exec_addr = VPR_ADDR(DT_INST_PHANDLE(inst, execution_memory)), \ - IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, source_memory), \ - (.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ - .size = DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)),))}; \ + COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, source_memory), \ + (.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ + .src_size = DT_REG_SIZE(DT_INST_PHANDLE(inst, source_memory)),), \ + ())}; \ \ DEVICE_DT_INST_DEFINE(inst, nordic_vpr_launcher_init, NULL, NULL, &config##inst, \ POST_KERNEL, CONFIG_NORDIC_VPR_LAUNCHER_INIT_PRIORITY, NULL); From 02f56db5ee8ff0fd63d917e506e10dfa61237343 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:24 +0200 Subject: [PATCH 1666/2300] Revert "[nrf fromlist] snippets: Add nordic-ppr-xip" This reverts commit daa61372e121eaf4c261112434b0b90d2dab60e6. Signed-off-by: Gerard Marull-Paretas --- snippets/nordic-ppr-xip/README.rst | 12 ------------ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 ----------------- snippets/nordic-ppr-xip/nordic-ppr-xip.overlay | 8 -------- snippets/nordic-ppr-xip/snippet.yml | 8 -------- 4 files changed, 45 deletions(-) delete mode 100644 snippets/nordic-ppr-xip/README.rst delete mode 100644 snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 snippets/nordic-ppr-xip/nordic-ppr-xip.overlay delete mode 100644 snippets/nordic-ppr-xip/snippet.yml diff --git a/snippets/nordic-ppr-xip/README.rst b/snippets/nordic-ppr-xip/README.rst deleted file mode 100644 index 64977da2989..00000000000 --- a/snippets/nordic-ppr-xip/README.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. _nordic-ppr-xip: - -Nordic boot PPR snippet with execution in place (nordic-ppr-xip) -################################################################ - -Overview -******** - -This snippet allows users to build Zephyr with the capability to boot Nordic PPR -(Peripheral Processor) from another core. PPR code is to be executed from MRAM, -so the PPR image must be built for the ``xip`` board variant, or with -:kconfig:option:`CONFIG_XIP` enabled. diff --git a/snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 4d02921660b..00000000000 --- a/snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuppr_ram3x_region { - status = "okay"; -}; - -&cpuppr_vpr { - execution-memory = <&cpuppr_code_partition>; - /delete-property/ source-memory; -}; - -&uart135 { - status = "reserved"; -}; diff --git a/snippets/nordic-ppr-xip/nordic-ppr-xip.overlay b/snippets/nordic-ppr-xip/nordic-ppr-xip.overlay deleted file mode 100644 index e33885fc10d..00000000000 --- a/snippets/nordic-ppr-xip/nordic-ppr-xip.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuppr_vpr { - status = "okay"; -}; diff --git a/snippets/nordic-ppr-xip/snippet.yml b/snippets/nordic-ppr-xip/snippet.yml deleted file mode 100644 index 4af89ccc2c0..00000000000 --- a/snippets/nordic-ppr-xip/snippet.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: nordic-ppr-xip -append: - EXTRA_DTC_OVERLAY_FILE: nordic-ppr-xip.overlay - -boards: - nrf54h20dk_nrf54h20_cpuapp: - append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay From 01f611e27a74f8e1db95d6c268de0223878eb962 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:24 +0200 Subject: [PATCH 1667/2300] Revert "[nrf fromlist] snippets: Remove nordic-ppr-ram" This reverts commit c676736bb95569ee8c2cd5d09e56ff4d5d347d31. Signed-off-by: Gerard Marull-Paretas --- snippets/nordic-ppr-ram/README.rst | 11 +++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 16 ++++++++++++++++ snippets/nordic-ppr-ram/nordic-ppr-ram.overlay | 15 +++++++++++++++ snippets/nordic-ppr-ram/snippet.yml | 8 ++++++++ 4 files changed, 50 insertions(+) create mode 100644 snippets/nordic-ppr-ram/README.rst create mode 100644 snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 snippets/nordic-ppr-ram/nordic-ppr-ram.overlay create mode 100644 snippets/nordic-ppr-ram/snippet.yml diff --git a/snippets/nordic-ppr-ram/README.rst b/snippets/nordic-ppr-ram/README.rst new file mode 100644 index 00000000000..501e5073357 --- /dev/null +++ b/snippets/nordic-ppr-ram/README.rst @@ -0,0 +1,11 @@ +.. _nordic-ppr-ram: + +Nordic boot PPR snippet with execution from RAM (nordic-ppr-ram) +################################################################ + +Overview +******** + +This snippet allows users to build Zephyr with the capability to boot Nordic PPR +(Peripheral Processor) from another core. PPR code is executed from RAM. Note +that PPR image must be built with :kconfig:option:`CONFIG_XIP` disabled. diff --git a/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..ea866358fc0 --- /dev/null +++ b/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&cpuppr_code_data { + status = "okay"; +}; + +&cpuppr_vpr { + execution-memory = <&cpuppr_code_data>; +}; + +&uart135 { + status = "reserved"; +}; diff --git a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay new file mode 100644 index 00000000000..71c45c1b9f4 --- /dev/null +++ b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +/* code is sourced from cpuppr code partition */ +&cpuppr_vpr { + status = "okay"; + source-memory = <&cpuppr_code_partition>; +}; + +/* code partition size must match RAM size */ +&cpuppr_code_partition { + reg = <0x126000 DT_SIZE_K(62)>; +}; diff --git a/snippets/nordic-ppr-ram/snippet.yml b/snippets/nordic-ppr-ram/snippet.yml new file mode 100644 index 00000000000..022ed8d38e8 --- /dev/null +++ b/snippets/nordic-ppr-ram/snippet.yml @@ -0,0 +1,8 @@ +name: nordic-ppr-ram +append: + EXTRA_DTC_OVERLAY_FILE: nordic-ppr-ram.overlay + +boards: + nrf54h20dk_nrf54h20_cpuapp: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay From 64ed4e0435588bac8646872c449e30a7fb67f89c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:24 +0200 Subject: [PATCH 1668/2300] Revert "[nrf fromlist] boards: nrf54h20dk: Make execution from RAM default for PPR" This reverts commit 7852ea12dddd317d8ab02874596d85a1f2f7771b. Signed-off-by: Gerard Marull-Paretas --- .../arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts | 3 +-- .../nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml | 2 +- .../nrf54h20dk_nrf54h20_cpuppr_defconfig | 3 --- ...20_cpuppr_xip.dts => nrf54h20dk_nrf54h20_cpuppr_ram.dts} | 0 ..._cpuppr_xip.yaml => nrf54h20dk_nrf54h20_cpuppr_ram.yaml} | 6 +++--- ...p_defconfig => nrf54h20dk_nrf54h20_cpuppr_ram_defconfig} | 2 +- 6 files changed, 6 insertions(+), 10 deletions(-) rename boards/riscv/nrf54h20dk_nrf54h20/{nrf54h20dk_nrf54h20_cpuppr_xip.dts => nrf54h20dk_nrf54h20_cpuppr_ram.dts} (100%) rename boards/riscv/nrf54h20dk_nrf54h20/{nrf54h20dk_nrf54h20_cpuppr_xip.yaml => nrf54h20dk_nrf54h20_cpuppr_ram.yaml} (62%) rename boards/riscv/nrf54h20dk_nrf54h20/{nrf54h20dk_nrf54h20_cpuppr_xip_defconfig => nrf54h20dk_nrf54h20_cpuppr_ram_defconfig} (95%) diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts index a8ea9fe730f..3873fec457e 100644 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts @@ -131,8 +131,7 @@ }; &cpuppr_vpr { - execution-memory = <&cpuppr_code_data>; - source-memory = <&cpuppr_code_partition>; + execution-memory = <&cpuppr_code_partition>; }; &gpiote130 { diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml index 839869d55c2..02e28651f5d 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml @@ -8,6 +8,6 @@ arch: riscv toolchain: - zephyr ram: 62 -flash: 62 +flash: 64 supported: - gpio diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig index 1e4c72309c6..2f6ccc43892 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig @@ -12,6 +12,3 @@ CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y - -# Execute from RAM -CONFIG_XIP=n diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.dts b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts similarity index 100% rename from boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.dts rename to boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.yaml b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml similarity index 62% rename from boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.yaml rename to boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml index 82f2109707a..26d6ebeac9a 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip.yaml +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml @@ -1,13 +1,13 @@ # 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_nrf54h20_cpuppr_ram +name: nRF54H20-DK-nRF54H20-PPR-RAM type: mcu arch: riscv toolchain: - zephyr ram: 62 -flash: 64 +flash: 62 supported: - gpio diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip_defconfig b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig similarity index 95% rename from boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip_defconfig rename to boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig index 7e4a13b811b..73056fac7ef 100644 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_xip_defconfig +++ b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig @@ -13,4 +13,4 @@ CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y -CONFIG_XIP=y +CONFIG_XIP=n From 86629f0efe3ba636ce9d4c6437566e118e9f8a34 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:24 +0200 Subject: [PATCH 1669/2300] Revert "[nrf fromlist] soc: nordic: Remove support for nRF54H20 EngA" This reverts commit faee8c01b85062c17441675717a73fc7ae67f925. Signed-off-by: Gerard Marull-Paretas --- .../Kconfig.defconfig.nrf54h20_enga_cpuapp | 17 +++++++++++++++++ .../Kconfig.defconfig.nrf54h20_enga_cpurad | 17 +++++++++++++++++ soc/arm/nordic_nrf/nrf54h/Kconfig.soc | 16 ++++++++++++++++ soc/arm/nordic_nrf/nrf54h/soc.c | 10 ++++++++++ .../nordic_nrf/common/vpr/Kconfig.defconfig | 6 ++++++ .../Kconfig.defconfig.nrf54h20_enga_cpuppr | 15 +++++++++++++++ soc/riscv/nordic_nrf/nrf54h/Kconfig.soc | 4 ++++ 7 files changed, 85 insertions(+) create mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp create mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad create mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp new file mode 100644 index 00000000000..d90f87c0b89 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp @@ -0,0 +1,17 @@ +# Nordic Semiconductor nRF54H20 Application MCU + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54H20_ENGA_CPUAPP + +config SOC + default "nrf54h20_enga_cpuapp" + +config NUM_IRQS + default 471 + +config NRF_REGTOOL_GENERATE_UICR + default y + +endif # SOC_NRF54H20_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad new file mode 100644 index 00000000000..6aae8c3a105 --- /dev/null +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad @@ -0,0 +1,17 @@ +# Nordic Semiconductor nRF54H20 Radio MCU + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54H20_ENGA_CPURAD + +config SOC + default "nrf54h20_enga_cpurad" + +config NUM_IRQS + default 471 + +config NRF_REGTOOL_GENERATE_UICR + default y + +endif # SOC_NRF54H20_ENGA_CPURAD diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc index be8752c8b5f..32256a809a9 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc @@ -28,6 +28,22 @@ config SOC_NRF54H20_CPURAD select CPU_HAS_ICACHE select CPU_HAS_FPU +config SOC_NRF54H20_ENGA_CPUAPP + bool "nRF54H20 ENGA CPUAPP" + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_DCACHE + select CPU_HAS_ICACHE + select CPU_HAS_FPU + +config SOC_NRF54H20_ENGA_CPURAD + bool "nRF54H20 ENGA CPURAD" + select CPU_HAS_ARM_MPU + select CPU_HAS_ARM_SAU + select CPU_HAS_DCACHE + select CPU_HAS_ICACHE + select CPU_HAS_FPU + endchoice config NRF_ENABLE_ICACHE diff --git a/soc/arm/nordic_nrf/nrf54h/soc.c b/soc/arm/nordic_nrf/nrf54h/soc.c index cf134dc99b1..9fefd414152 100644 --- a/soc/arm/nordic_nrf/nrf54h/soc.c +++ b/soc/arm/nordic_nrf/nrf54h/soc.c @@ -44,6 +44,10 @@ static void power_domain_init(void) nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_MAIN, true); nrf_lrcconf_retain_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_0, true); + +#if defined(CONFIG_SOC_NRF54H20_ENGA_CPUAPP) + nrf_lrcconf_poweron_force_set(NRF_LRCCONF000, NRF_LRCCONF_POWER_DOMAIN_0, true); +#endif } static int trim_hsfll(void) @@ -65,6 +69,12 @@ static int trim_hsfll(void) nrf_hsfll_trim_set(hsfll, &trim); nrf_hsfll_task_trigger(hsfll, NRF_HSFLL_TASK_FREQ_CHANGE); +#if defined(CONFIG_SOC_NRF54H20_ENGA_CPUAPP) || defined(CONFIG_SOC_NRF54H20_ENGA_CPURAD) + /* In this HW revision, HSFLL task frequency change needs to be + * triggered additional time to take effect. + */ + nrf_hsfll_task_trigger(hsfll, NRF_HSFLL_TASK_FREQ_CHANGE); +#endif LOG_DBG("NRF_HSFLL->TRIM.VSUP = %d", hsfll->TRIM.VSUP); LOG_DBG("NRF_HSFLL->TRIM.COARSE = %d", hsfll->TRIM.COARSE); diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig index ccab6b62c1d..a89593170f6 100644 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig @@ -1,6 +1,12 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +CPU_PATH := $(dt_nodelabel_path,cpu) +CPU_ID := $(dt_node_reg_addr_int,$(CPU_PATH)) + +config RV_BOOT_HART + default $(CPU_ID) if SOC_NRF54H20_ENGA_CPUPPR + config RISCV_MCAUSE_EXCEPTION_MASK default 0xFFF diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr new file mode 100644 index 00000000000..a36d24c72ae --- /dev/null +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuppr @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54H20_ENGA_CPUPPR + +config SOC + default "nrf54h20_enga_cpuppr" + +config NUM_IRQS + default 496 + +config SYS_CLOCK_TICKS_PER_SEC + default 1000 + +endif # SOC_NRF54H20_ENGA_CPUPPR diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc index 51d42e201f9..47138277fce 100644 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc @@ -14,6 +14,10 @@ config SOC_NRF54H20_CPUPPR bool "nRF54H20 CPUPPR" select RISCV +config SOC_NRF54H20_ENGA_CPUPPR + bool "nRF54H20 ENGA CPUPPR" + depends on RISCV_CORE_NORDIC_VPR + endchoice endif # SOC_NRF54H20 From 7a6d7ab2d6732ec667d06ce1fc057890bc025385 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:25 +0200 Subject: [PATCH 1670/2300] Revert "[nrf fromtree] dts: Remove support for nRF54H20 EngA" This reverts commit 0938076a408d4ec076d8886d32ccb5016b8434d2. Signed-off-by: Gerard Marull-Paretas --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 51 + dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 51 + dts/common/nordic/nrf54h20_enga.dtsi | 941 ++++++++++++++++++ dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 48 + .../misc/nordic-nrf-ficr-nrf54h20-enga.h | 96 ++ 5 files changed, 1187 insertions(+) create mode 100644 dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi create mode 100644 dts/arm/nordic/nrf54h20_enga_cpurad.dtsi create mode 100644 dts/common/nordic/nrf54h20_enga.dtsi create mode 100644 dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi create mode 100644 include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi new file mode 100644 index 00000000000..7252b3d5a04 --- /dev/null +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuapp {}; +systick: &cpuapp_systick {}; +nvic: &cpuapp_nvic {}; +cpuppr_vevif: &cpuppr_vevif_remote {}; + +/delete-node/ &cpuppr; +/delete-node/ &cpurad; +/delete-node/ &cpurad_peripherals; +/delete-node/ &cpurad_ppb; +/delete-node/ &cpurad_ram0; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuapp_nvic>; + ranges; + }; +}; + +&cpuapp_ppb { + compatible = "simple-bus"; + ranges; +}; + +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-local"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&gpiote130 { + interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&grtc { + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi new file mode 100644 index 00000000000..d2aaa790349 --- /dev/null +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpurad {}; +systick: &cpurad_systick {}; +nvic: &cpurad_nvic {}; +cpuppr_vevif: &cpuppr_vevif_remote {}; + +/delete-node/ &cpuapp; +/delete-node/ &cpuapp_peripherals; +/delete-node/ &cpuapp_ppb; +/delete-node/ &cpuapp_ram0; +/delete-node/ &cpuppr; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpurad_nvic>; + ranges; + }; +}; + +&cpurad_ppb { + compatible = "simple-bus"; + ranges; +}; + +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-local"; +}; + +&gpiote130 { + interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&grtc { + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi new file mode 100644 index 00000000000..8552b9534eb --- /dev/null +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -0,0 +1,941 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include + +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 2 +#define NRF_DOMAIN_ID_RADIOCORE 3 +#define NRF_DOMAIN_ID_GLOBALFAST 12 +#define NRF_DOMAIN_ID_GLOBALSLOW 13 + +/delete-node/ &sw_pwm; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpuapp: cpu@2 { + compatible = "arm,cortex-m33"; + reg = <2>; + device_type = "cpu"; + clock-frequency = ; + }; + + cpurad: cpu@3 { + compatible = "arm,cortex-m33"; + reg = <3>; + device_type = "cpu"; + clock-frequency = ; + }; + + cpuppr: cpu@d { + compatible = "nordic,vpr"; + reg = <13>; + device_type = "cpu"; + clock-frequency = ; + riscv,isa = "rv32emc"; + nordic,bus-width = <32>; + + cpuppr_vevif_local: mailbox { + compatible = "nordic,nrf-vevif-local"; + status = "disabled"; + interrupt-parent = <&cpuppr_clic>; + interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, + <1 NRF_DEFAULT_IRQ_PRIORITY>, + <2 NRF_DEFAULT_IRQ_PRIORITY>, + <3 NRF_DEFAULT_IRQ_PRIORITY>, + <4 NRF_DEFAULT_IRQ_PRIORITY>, + <5 NRF_DEFAULT_IRQ_PRIORITY>, + <6 NRF_DEFAULT_IRQ_PRIORITY>, + <7 NRF_DEFAULT_IRQ_PRIORITY>, + <8 NRF_DEFAULT_IRQ_PRIORITY>, + <9 NRF_DEFAULT_IRQ_PRIORITY>, + <10 NRF_DEFAULT_IRQ_PRIORITY>, + <11 NRF_DEFAULT_IRQ_PRIORITY>, + <12 NRF_DEFAULT_IRQ_PRIORITY>, + <13 NRF_DEFAULT_IRQ_PRIORITY>, + <14 NRF_DEFAULT_IRQ_PRIORITY>, + <15 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask = <0xfffffff0>; + }; + }; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + + cpurad_uicr_ext: memory@e1ff000 { + reg = <0xe1ff000 DT_SIZE_K(2)>; + }; + + cpuapp_uicr_ext: memory@e1ff800 { + reg = <0xe1ff800 DT_SIZE_K(2)>; + }; + }; + + clocks { + fll16m: fll16m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + + mram1x: mram@e000000 { + compatible = "nordic,mram"; + reg = <0xe000000 DT_SIZE_K(2048)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; + + cpuapp_uicr: uicr@fff8000 { + 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 { + compatible = "nordic,nrf-ficr"; + reg = <0xfffe000 DT_SIZE_K(2)>; + #nordic,ficr-cells = <1>; + }; + + cpuapp_ram0: sram@22000000 { + compatible = "mmio-sram"; + reg = <0x22000000 DT_SIZE_K(32)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x22000000 0x8000>; + }; + + cpurad_ram0: sram@23000000 { + compatible = "mmio-sram"; + reg = <0x23000000 DT_SIZE_K(64)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x23000000 0x10000>; + }; + + cpuapp_peripherals: peripheral@52000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x52000000 0x1000000>; + + cpuapp_hsfll: clock@d000 { + compatible = "nordic,nrf-hsfll"; + #clock-cells = <0>; + reg = <0xd000 0x1000>; + clocks = <&fll16m>; + clock-frequency = ; + nordic,ficrs = + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, + <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; + nordic,ficr-names = "vsup", "coarse", "fine"; + }; + + cpuapp_ipct: ipct@13000 { + compatible = "nordic,nrf-ipct-local"; + reg = <0x13000 0x1000>; + status = "disabled"; + channels = <4>; + interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, + <65 NRF_DEFAULT_IRQ_PRIORITY>; + }; + }; + + cpurad_peripherals: peripheral@53000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x53000000 0x1000000>; + + cpurad_hsfll: clock@d000 { + compatible = "nordic,nrf-hsfll"; + #clock-cells = <0>; + reg = <0xd000 0x1000>; + clocks = <&fll16m>; + clock-frequency = ; + nordic,ficrs = + <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP>, + <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1>, + <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1>; + nordic,ficr-names = "vsup", "coarse", "fine"; + }; + + dppic020: dppic@22000 { + compatible = "nordic,nrf-dppic-local"; + reg = <0x22000 0x1000>; + status = "disabled"; + }; + + cpurad_ipct: ipct@24000 { + compatible = "nordic,nrf-ipct-local"; + reg = <0x24000 0x1000>; + status = "disabled"; + channels = <8>; + interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, + <65 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + egu020: egu@25000 { + compatible = "nordic,nrf-egu"; + reg = <0x25000 0x1000>; + status = "disabled"; + interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + ecb020: ecb@27000 { + compatible = "nordic,nrf-ecb"; + reg = <0x27000 0x1000>; + status = "disabled"; + interrupts = <39 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + timer020: timer@28000 { + compatible = "nordic,nrf-timer"; + reg = <0x28000 0x1000>; + status = "disabled"; + cc-num = <8>; + interrupts = <40 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer021: timer@29000 { + compatible = "nordic,nrf-timer"; + reg = <0x29000 0x1000>; + status = "disabled"; + cc-num = <8>; + interrupts = <41 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer022: timer@2a000 { + compatible = "nordic,nrf-timer"; + reg = <0x2a000 0x1000>; + status = "disabled"; + cc-num = <8>; + interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + rtc: rtc@2b000 { + compatible = "nordic,nrf-rtc"; + reg = <0x2b000 0x1000>; + status = "disabled"; + cc-num = <4>; + clock-frequency = <32768>; + interrupts = <43 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <1>; + }; + + radio: radio@2c000 { + compatible = "nordic,nrf-radio"; + reg = <0x2c000 0x1000>; + status = "disabled"; + ble-2mbps-supported; + ble-coded-phy-supported; + dfe-supported; + ieee802154-supported; + interrupts = <44 NRF_DEFAULT_IRQ_PRIORITY>; + + cpurad_ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; + }; + + ecb030: ecb@3b000 { + compatible = "nordic,nrf-ecb"; + reg = <0x3b000 0x1000>; + interrupts = <59 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + }; + + global_peripherals: peripheral@5f000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x5f000000 0x1000000>; + + cpusec_bellboard: mailbox@99000 { + reg = <0x99000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + cpuapp_bellboard: mailbox@9a000 { + reg = <0x9a000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + cpurad_bellboard: mailbox@9b000 { + reg = <0x9b000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + }; + + ipct120: ipct@8d1000 { + compatible = "nordic,nrf-ipct-global"; + reg = <0x8d1000 0x1000>; + status = "disabled"; + channels = <8>; + global-domain-id = <12>; + }; + + dppic120: dppic@8e1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x8e1000 0x1000>; + status = "disabled"; + }; + + timer120: timer@8e2000 { + compatible = "nordic,nrf-timer"; + reg = <0x8e2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer121: timer@8e3000 { + compatible = "nordic,nrf-timer"; + reg = <0x8e3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + uart120: uart@8e5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x8e5000 0x1000>; + status = "disabled"; + interrupts = <229 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + spi120: spi@8e6000 { + compatible = "nordic,nrf-spim"; + reg = <0x8e6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi121: spi@8e7000 { + compatible = "nordic,nrf-spim"; + reg = <0x8e7000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <231 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + cpuppr_vpr: vpr@908000 { + compatible = "nordic,nrf-vpr-coprocessor"; + reg = <0x908000 0x1000>; + status = "disabled"; + cpu = <13>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x908000 0x4000>; + + cpuppr_vevif_remote: mailbox@0 { + compatible = "nordic,nrf-vevif-remote"; + reg = <0x0 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + nordic,tasks = <16>; + nordic,tasks-mask = <0xfffffff0>; + }; + + cpuppr_clic: interrupt-controller@1000 { + compatible = "nordic,nrf-clic"; + reg = <0x1000 0x3000>; + status = "disabled"; + #interrupt-cells = <2>; + interrupt-controller; + #address-cells = <1>; + }; + }; + + ipct130: ipct@921000 { + compatible = "nordic,nrf-ipct-global"; + reg = <0x921000 0x1000>; + status = "disabled"; + channels = <8>; + global-domain-id = <13>; + }; + + dppic130: dppic@922000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x922000 0x1000>; + status = "disabled"; + }; + + rtc130: rtc@928000 { + compatible = "nordic,nrf-rtc"; + reg = <0x928000 0x1000>; + status = "disabled"; + cc-num = <4>; + clock-frequency = <32768>; + interrupts = <296 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <1>; + }; + + rtc131: rtc@929000 { + compatible = "nordic,nrf-rtc"; + reg = <0x929000 0x1000>; + status = "disabled"; + cc-num = <4>; + clock-frequency = <32768>; + interrupts = <297 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <1>; + }; + + wdt131: watchdog@92b000 { + compatible = "nordic,nrf-wdt"; + reg = <0x92b000 0x1000>; + status = "disabled"; + interrupts = <299 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + wdt132: watchdog@92c000 { + compatible = "nordic,nrf-wdt"; + reg = <0x92c000 0x1000>; + status = "disabled"; + interrupts = <300 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + gpiote130: gpiote@934000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x934000 0x1000>; + status = "disabled"; + instance = <130>; + }; + + gpio0: gpio@938000 { + compatible = "nordic,nrf-gpio"; + reg = <0x938000 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <12>; + port = <0>; + }; + + gpio1: gpio@938200 { + compatible = "nordic,nrf-gpio"; + reg = <0x938200 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <12>; + port = <1>; + }; + + gpio2: gpio@938400 { + compatible = "nordic,nrf-gpio"; + reg = <0x938400 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <12>; + port = <2>; + }; + + gpio6: gpio@938c00 { + compatible = "nordic,nrf-gpio"; + reg = <0x938c00 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + ngpios = <14>; + port = <6>; + }; + + gpio7: gpio@938e00 { + compatible = "nordic,nrf-gpio"; + reg = <0x938e00 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + ngpios = <8>; + port = <7>; + }; + + gpio9: gpio@939200 { + compatible = "nordic,nrf-gpio"; + reg = <0x939200 0x200>; + status = "disabled"; + #gpio-cells = <2>; + gpio-controller; + gpiote-instance = <&gpiote130>; + ngpios = <6>; + port = <9>; + }; + + dppic131: dppic@981000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x981000 0x1000>; + status = "disabled"; + }; + + comp: comparator@983000 { + compatible = "nordic,nrf-comp"; + reg = <0x983000 0x1000>; + status = "disabled"; + interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; + #io-channel-cells = <1>; + }; + + temp: temperature-sensor@984000 { + compatible = "nordic,nrf-temp"; + reg = <0x984000 0x1000>; + interrupts = <388 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + nfct: nfct@985000 { + compatible = "nordic,nrf-nfct"; + reg = <0x985000 0x1000>; + status = "disabled"; + interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + dppic132: dppic@991000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x991000 0x1000>; + status = "disabled"; + }; + + qdec130: qdec@994000 { + compatible = "nordic,nrf-qdec"; + reg = <0x994000 0x1000>; + status = "disabled"; + interrupts = <404 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + qdec131: qdec@995000 { + compatible = "nordic,nrf-qdec"; + reg = <0x995000 0x1000>; + status = "disabled"; + interrupts = <405 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + grtc: grtc@99c000 { + compatible = "nordic,nrf-grtc"; + reg = <0x99c000 0x1000>; + status = "disabled"; + cc-num = <16>; + }; + + dppic133: dppic@9a1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9a1000 0x1000>; + status = "disabled"; + }; + + timer130: timer@9a2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9a2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <418 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer131: timer@9a3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9a3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <419 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + i2c130: i2c@9a5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9a5000 0x1000>; + status = "disabled"; + interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi130: spi@9a5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9a5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart130: uart@9a5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9a5000 0x1000>; + status = "disabled"; + interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + i2c131: i2c@9a6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9a6000 0x1000>; + status = "disabled"; + interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi131: spi@9a6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9a6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart131: uart@9a6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9a6000 0x1000>; + status = "disabled"; + interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + dppic134: dppic@9b1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9b1000 0x1000>; + status = "disabled"; + }; + + timer132: timer@9b2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9b2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <434 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer133: timer@9b3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9b3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <435 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + i2c132: i2c@9b5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9b5000 0x1000>; + status = "disabled"; + interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi132: spi@9b5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9b5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart132: uart@9b5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9b5000 0x1000>; + status = "disabled"; + interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + i2c133: i2c@9b6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9b6000 0x1000>; + status = "disabled"; + interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi133: spi@9b6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9b6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart133: uart@9b6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9b6000 0x1000>; + status = "disabled"; + interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + dppic135: dppic@9c1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9c1000 0x1000>; + status = "disabled"; + }; + + timer134: timer@9c2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9c2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <450 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer135: timer@9c3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9c3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <451 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + i2c134: i2c@9c5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9c5000 0x1000>; + status = "disabled"; + interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi134: spi@9c5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9c5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart134: uart@9c5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9c5000 0x1000>; + status = "disabled"; + interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + i2c135: i2c@9c6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9c6000 0x1000>; + status = "disabled"; + interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi135: spi@9c6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9c6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart135: uart@9c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9c6000 0x1000>; + status = "disabled"; + interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + dppic136: dppic@9d1000 { + compatible = "nordic,nrf-dppic-global"; + reg = <0x9d1000 0x1000>; + status = "disabled"; + }; + + timer136: timer@9d2000 { + compatible = "nordic,nrf-timer"; + reg = <0x9d2000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <466 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + timer137: timer@9d3000 { + compatible = "nordic,nrf-timer"; + reg = <0x9d3000 0x1000>; + status = "disabled"; + cc-num = <6>; + interrupts = <467 NRF_DEFAULT_IRQ_PRIORITY>; + max-bit-width = <32>; + prescaler = <0>; + }; + + i2c136: i2c@9d5000 { + compatible = "nordic,nrf-twim"; + reg = <0x9d5000 0x1000>; + status = "disabled"; + interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi136: spi@9d5000 { + compatible = "nordic,nrf-spim"; + reg = <0x9d5000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart136: uart@9d5000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9d5000 0x1000>; + status = "disabled"; + interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + i2c137: i2c@9d6000 { + compatible = "nordic,nrf-twim"; + reg = <0x9d6000 0x1000>; + status = "disabled"; + interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <15>; + #address-cells = <1>; + #size-cells = <0>; + }; + + spi137: spi@9d6000 { + compatible = "nordic,nrf-spim"; + reg = <0x9d6000 0x1000>; + status = "disabled"; + easydma-maxcnt-bits = <15>; + interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart137: uart@9d6000 { + compatible = "nordic,nrf-uarte"; + reg = <0x9d6000 0x1000>; + status = "disabled"; + interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; + }; + }; + }; + + cpuapp_ppb: cpuapp-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + + cpuapp_nvic: interrupt-controller@e000e100 { + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + #interrupt-cells = <2>; + interrupt-controller; + #address-cells = <1>; + }; + }; + + cpurad_ppb: cpurad-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpurad_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + + cpurad_nvic: interrupt-controller@e000e100 { + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + #interrupt-cells = <2>; + interrupt-controller; + #address-cells = <1>; + }; + }; +}; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi new file mode 100644 index 00000000000..0af6618688f --- /dev/null +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +cpu: &cpuppr {}; +clic: &cpuppr_clic {}; +cpuppr_vevif: &cpuppr_vevif_local {}; + +/delete-node/ &cpuapp; +/delete-node/ &cpuapp_peripherals; +/delete-node/ &cpuapp_ppb; +/delete-node/ &cpuapp_ram0; +/delete-node/ &cpurad; +/delete-node/ &cpurad_peripherals; +/delete-node/ &cpurad_ppb; +/delete-node/ &cpurad_ram0; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuppr_clic>; + ranges; + }; +}; + +&cpusec_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpuapp_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&cpurad_bellboard { + compatible = "nordic,nrf-bellboard-remote"; +}; + +&gpiote130 { + interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&grtc { + interrupts = <108 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h b/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h new file mode 100644 index 00000000000..60b788a3516 --- /dev/null +++ b/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20-enga.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/* autogenerated using Nordic HAL utils/gen_offsets.py script */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ + +#define NRF_FICR_BLE_ADDRTYPE 0x00CU +#define NRF_FICR_BLE_ADDR_0 0x010U +#define NRF_FICR_BLE_ADDR_1 0x014U +#define NRF_FICR_BLE_ER_0 0x018U +#define NRF_FICR_BLE_ER_1 0x01CU +#define NRF_FICR_BLE_ER_2 0x020U +#define NRF_FICR_BLE_ER_3 0x024U +#define NRF_FICR_BLE_IR_0 0x028U +#define NRF_FICR_BLE_IR_1 0x02CU +#define NRF_FICR_BLE_IR_2 0x030U +#define NRF_FICR_BLE_IR_3 0x034U +#define NRF_FICR_NFC_TAGHEADER_0 0x040U +#define NRF_FICR_NFC_TAGHEADER_1 0x044U +#define NRF_FICR_NFC_TAGHEADER_2 0x048U +#define NRF_FICR_NFC_TAGHEADER_3 0x04CU +#define NRF_FICR_INFO_CONFIGID 0x050U +#define NRF_FICR_INFO_PART 0x054U +#define NRF_FICR_INFO_VARIANT 0x058U +#define NRF_FICR_INFO_PACKAGE 0x05CU +#define NRF_FICR_INFO_RAM 0x060U +#define NRF_FICR_INFO_MRAM 0x064U +#define NRF_FICR_INFO_CODEPAGESIZE 0x068U +#define NRF_FICR_INFO_CODESIZE 0x06CU +#define NRF_FICR_INFO_DEVICETYPE 0x070U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALVREF 0x384U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_0 0x388U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_1 0x38CU +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALGAIN_2 0x390U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALOFFSET 0x394U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_0 0x398U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_1 0x39CU +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_2 0x3A0U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_3 0x3A4U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_4 0x3A8U +#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_5 0x3ACU +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALIREF 0x3B0U +#define NRF_FICR_TRIM_GLOBAL_SAADC_CALVREFTC 0x3B4U +#define NRF_FICR_TRIM_GLOBAL_NFCT_BIASCFG 0x3BCU +#define NRF_FICR_TRIM_GLOBAL_CANPLL_TRIM_CTUNE 0x3C0U +#define NRF_FICR_TRIM_GLOBAL_COMP_REFTRIM 0x3D0U +#define NRF_FICR_TRIM_GLOBAL_COMP_RCALTRIM 0x3D4U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP 0x3D8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0 0x3DCU +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_1 0x3E0U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_2 0x3E4U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_3 0x3E8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_4 0x3ECU +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_5 0x3F0U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0 0x3F4U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_1 0x3F8U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_2 0x3FCU +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_3 0x400U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_4 0x404U +#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_5 0x408U +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_0_TRIM 0x40CU +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_1_TRIM 0x410U +#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_2_TRIM 0x414U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP 0x418U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_0 0x41CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1 0x420U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_2 0x424U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_3 0x428U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_4 0x42CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_5 0x430U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_0 0x434U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1 0x438U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_2 0x43CU +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_3 0x440U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_4 0x444U +#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_5 0x448U +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_0_TRIM 0x44CU +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_1_TRIM 0x450U +#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_2_TRIM 0x454U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL0 0x458U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL1 0x45CU +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_FSCTRL2 0x460U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_RXCTRL 0x464U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_SPHYNXANA_OVRRXTRIMCODE 0x468U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_RXAGC_CALIBRATION 0x46CU +#define NRF_FICR_TRIM_RADIOCORE_RADIO_PVTTOT 0x470U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_KDTC 0x474U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_TXHFGAIN 0x478U +#define NRF_FICR_TRIM_RADIOCORE_RADIO_PVTTOFIX 0x47CU +#define NRF_FICR_TRIM_RADIOCORE_RADIO_LOOPGAIN 0x480U + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_ENGA_H_ */ From f09da2659ea67073ccbda5ec6872ba033c071f48 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:25 +0200 Subject: [PATCH 1671/2300] Revert "[nrf fromtree] modules: hal_nordic: Remove support for nRF54H20 EngA" This reverts commit 26aa38e4115b5f87aabc242cd1590ccdfa782564. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/nrfx/CMakeLists.txt | 10 + modules/hal_nordic/nrfx/nrfx_config.h | 6 + .../nrfx_config_nrf54h20_enga_application.h | 1962 ++++++++++++++++ .../nrfx/nrfx_config_nrf54h20_enga_ppr.h | 1882 +++++++++++++++ .../nrfx_config_nrf54h20_enga_radiocore.h | 2043 +++++++++++++++++ 5 files changed, 5903 insertions(+) create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index adce870fc3a..eb384046aa6 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -47,6 +47,13 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_ENGA_CPUAPP NRF_APPLICATION zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9120 NRF9120_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9160 NRF9160_XXAA) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP NRF54H20_ENGA_XXAA + NRF_APPLICATION) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD NRF54H20_ENGA_XXAA + NRF_RADIOCORE) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR NRF54H20_ENGA_XXAA + NRF_PPR) + zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_LOCK ENABLE_APPROTECT) zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_USER_HANDLING @@ -203,5 +210,8 @@ mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUNET nrf5340_network.svd) 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_CPURAD nrf54h20_radiocore.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP nrf54h20_enga_application.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR nrf54h20_enga_ppr.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD nrf54h20_enga_radiocore.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9120 nrf9120.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9160 nrf9160.svd) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index c4798d1906a..d0f2a0555d5 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -943,6 +943,12 @@ #include #elif defined(NRF54H20_XXAA) && defined(NRF_PPR) #include +#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_APPLICATION) + #include +#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_RADIOCORE) + #include +#elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_PPR) + #include #elif (defined(NRF54L15_XXAA) || defined(NRF54L15_ENGA_XXAA)) && defined(NRF_APPLICATION) #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h new file mode 100644 index 00000000000..af74d9d3dc3 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h @@ -0,0 +1,1962 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54H20_ENGA_APPLICATION_H__ +#define NRFX_CONFIG_NRF54H20_ENGA_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_BELLBOARD_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD_ENABLED +#define NRFX_BELLBOARD_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_BELLBOARD0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD0_ENABLED +#define NRFX_BELLBOARD0_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD1_ENABLED +#define NRFX_BELLBOARD1_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD2_ENABLED +#define NRFX_BELLBOARD2_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD3_ENABLED +#define NRFX_BELLBOARD3_ENABLED 0 +#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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 +#endif + +/** + * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e +#endif + +/** + * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 +#endif + +/** + * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 +#endif + +/** + * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 +#endif + +/** + * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f +#endif + +/** + * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 +#endif + +/** + * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df +#endif + +/** + * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf +#endif + +/** + * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e +#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 1 +#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_GPIOTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE130_ENABLED +#define NRFX_GPIOTE130_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_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 +#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_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: 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_I2S130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S130_ENABLED +#define NRFX_I2S130_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S131_ENABLED +#define NRFX_I2S131_ENABLED 0 +#endif + +/** + * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#endif + +/** + * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#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_MVDMA_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA_ENABLED +#define NRFX_MVDMA_ENABLED 0 +#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_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_PRS_BOX_6_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_6_ENABLED +#define NRFX_PRS_BOX_6_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_7_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_7_ENABLED +#define NRFX_PRS_BOX_7_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_8_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_8_ENABLED +#define NRFX_PRS_BOX_8_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_9_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_9_ENABLED +#define NRFX_PRS_BOX_9_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_PWM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM120_ENABLED +#define NRFX_PWM120_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM130_ENABLED +#define NRFX_PWM130_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM131_ENABLED +#define NRFX_PWM131_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM132_ENABLED +#define NRFX_PWM132_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM133_ENABLED +#define NRFX_PWM133_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_QDEC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC130_ENABLED +#define NRFX_QDEC130_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC131_ENABLED +#define NRFX_QDEC131_ENABLED 0 +#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_RTC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC130_ENABLED +#define NRFX_RTC130_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC131_ENABLED +#define NRFX_RTC131_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_SPIM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM120_ENABLED +#define NRFX_SPIM120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM121_ENABLED +#define NRFX_SPIM121_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM130_ENABLED +#define NRFX_SPIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM131_ENABLED +#define NRFX_SPIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM132_ENABLED +#define NRFX_SPIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM133_ENABLED +#define NRFX_SPIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM134_ENABLED +#define NRFX_SPIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM135_ENABLED +#define NRFX_SPIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM136_ENABLED +#define NRFX_SPIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM137_ENABLED +#define NRFX_SPIM137_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_SPIS120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS120_ENABLED +#define NRFX_SPIS120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS130_ENABLED +#define NRFX_SPIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS131_ENABLED +#define NRFX_SPIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS132_ENABLED +#define NRFX_SPIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS133_ENABLED +#define NRFX_SPIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS134_ENABLED +#define NRFX_SPIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS135_ENABLED +#define NRFX_SPIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS136_ENABLED +#define NRFX_SPIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS137_ENABLED +#define NRFX_SPIS137_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_TIMER120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER120_ENABLED +#define NRFX_TIMER120_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER121_ENABLED +#define NRFX_TIMER121_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER130_ENABLED +#define NRFX_TIMER130_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER131_ENABLED +#define NRFX_TIMER131_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER132_ENABLED +#define NRFX_TIMER132_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER133_ENABLED +#define NRFX_TIMER133_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER134_ENABLED +#define NRFX_TIMER134_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER135_ENABLED +#define NRFX_TIMER135_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER136_ENABLED +#define NRFX_TIMER136_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER137_ENABLED +#define NRFX_TIMER137_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_TWIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM130_ENABLED +#define NRFX_TWIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM131_ENABLED +#define NRFX_TWIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM132_ENABLED +#define NRFX_TWIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM133_ENABLED +#define NRFX_TWIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM134_ENABLED +#define NRFX_TWIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM135_ENABLED +#define NRFX_TWIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM136_ENABLED +#define NRFX_TWIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM137_ENABLED +#define NRFX_TWIM137_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_TWIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS130_ENABLED +#define NRFX_TWIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS131_ENABLED +#define NRFX_TWIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS132_ENABLED +#define NRFX_TWIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS133_ENABLED +#define NRFX_TWIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS134_ENABLED +#define NRFX_TWIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS135_ENABLED +#define NRFX_TWIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS136_ENABLED +#define NRFX_TWIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS137_ENABLED +#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE120_ENABLED +#define NRFX_UARTE120_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE130_ENABLED +#define NRFX_UARTE130_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE131_ENABLED +#define NRFX_UARTE131_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE132_ENABLED +#define NRFX_UARTE132_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE133_ENABLED +#define NRFX_UARTE133_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE134_ENABLED +#define NRFX_UARTE134_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE135_ENABLED +#define NRFX_UARTE135_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE136_ENABLED +#define NRFX_UARTE136_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE137_ENABLED +#define NRFX_UARTE137_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_WDT010_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT010_ENABLED +#define NRFX_WDT010_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT011_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT011_ENABLED +#define NRFX_WDT011_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT131_ENABLED +#define NRFX_WDT131_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT132_ENABLED +#define NRFX_WDT132_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54H20_ENGA_APPLICATION_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h new file mode 100644 index 00000000000..65b3e2fa958 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h @@ -0,0 +1,1882 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54H20_ENGA_PPR_H__ +#define NRFX_CONFIG_NRF54H20_ENGA_PPR_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_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_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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 +#endif + +/** + * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e +#endif + +/** + * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 +#endif + +/** + * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 +#endif + +/** + * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 +#endif + +/** + * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 +#endif + +/** + * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df +#endif + +/** + * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf +#endif + +/** + * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e +#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 1 +#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_GPIOTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE130_ENABLED +#define NRFX_GPIOTE130_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_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 +#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_NUM_OF_CC_CHANNELS + * + * Integer value. + */ +#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 2 +#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 0x000000c0 +#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_I2S130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S130_ENABLED +#define NRFX_I2S130_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S131_ENABLED +#define NRFX_I2S131_ENABLED 0 +#endif + +/** + * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#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_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_PRS_BOX_6_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_6_ENABLED +#define NRFX_PRS_BOX_6_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_7_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_7_ENABLED +#define NRFX_PRS_BOX_7_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_8_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_8_ENABLED +#define NRFX_PRS_BOX_8_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_9_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_9_ENABLED +#define NRFX_PRS_BOX_9_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_PWM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM120_ENABLED +#define NRFX_PWM120_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM130_ENABLED +#define NRFX_PWM130_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM131_ENABLED +#define NRFX_PWM131_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM132_ENABLED +#define NRFX_PWM132_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM133_ENABLED +#define NRFX_PWM133_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_QDEC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC130_ENABLED +#define NRFX_QDEC130_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC131_ENABLED +#define NRFX_QDEC131_ENABLED 0 +#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_RTC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC130_ENABLED +#define NRFX_RTC130_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC131_ENABLED +#define NRFX_RTC131_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_SPIM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM120_ENABLED +#define NRFX_SPIM120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM121_ENABLED +#define NRFX_SPIM121_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM130_ENABLED +#define NRFX_SPIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM131_ENABLED +#define NRFX_SPIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM132_ENABLED +#define NRFX_SPIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM133_ENABLED +#define NRFX_SPIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM134_ENABLED +#define NRFX_SPIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM135_ENABLED +#define NRFX_SPIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM136_ENABLED +#define NRFX_SPIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM137_ENABLED +#define NRFX_SPIM137_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_SPIS120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS120_ENABLED +#define NRFX_SPIS120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS130_ENABLED +#define NRFX_SPIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS131_ENABLED +#define NRFX_SPIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS132_ENABLED +#define NRFX_SPIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS133_ENABLED +#define NRFX_SPIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS134_ENABLED +#define NRFX_SPIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS135_ENABLED +#define NRFX_SPIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS136_ENABLED +#define NRFX_SPIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS137_ENABLED +#define NRFX_SPIS137_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_TIMER120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER120_ENABLED +#define NRFX_TIMER120_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER121_ENABLED +#define NRFX_TIMER121_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER130_ENABLED +#define NRFX_TIMER130_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER131_ENABLED +#define NRFX_TIMER131_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER132_ENABLED +#define NRFX_TIMER132_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER133_ENABLED +#define NRFX_TIMER133_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER134_ENABLED +#define NRFX_TIMER134_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER135_ENABLED +#define NRFX_TIMER135_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER136_ENABLED +#define NRFX_TIMER136_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER137_ENABLED +#define NRFX_TIMER137_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_TWIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM130_ENABLED +#define NRFX_TWIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM131_ENABLED +#define NRFX_TWIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM132_ENABLED +#define NRFX_TWIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM133_ENABLED +#define NRFX_TWIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM134_ENABLED +#define NRFX_TWIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM135_ENABLED +#define NRFX_TWIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM136_ENABLED +#define NRFX_TWIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM137_ENABLED +#define NRFX_TWIM137_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_TWIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS130_ENABLED +#define NRFX_TWIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS131_ENABLED +#define NRFX_TWIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS132_ENABLED +#define NRFX_TWIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS133_ENABLED +#define NRFX_TWIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS134_ENABLED +#define NRFX_TWIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS135_ENABLED +#define NRFX_TWIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS136_ENABLED +#define NRFX_TWIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS137_ENABLED +#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE120_ENABLED +#define NRFX_UARTE120_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE130_ENABLED +#define NRFX_UARTE130_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE131_ENABLED +#define NRFX_UARTE131_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE132_ENABLED +#define NRFX_UARTE132_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE133_ENABLED +#define NRFX_UARTE133_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE134_ENABLED +#define NRFX_UARTE134_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE135_ENABLED +#define NRFX_UARTE135_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE136_ENABLED +#define NRFX_UARTE136_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE137_ENABLED +#define NRFX_UARTE137_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_WDT131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT131_ENABLED +#define NRFX_WDT131_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT132_ENABLED +#define NRFX_WDT132_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54H20_ENGA_PPR_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h new file mode 100644 index 00000000000..ca7bf3aca63 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h @@ -0,0 +1,2043 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_H__ +#define NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_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_BELLBOARD_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD_ENABLED +#define NRFX_BELLBOARD_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_BELLBOARD0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD0_ENABLED +#define NRFX_BELLBOARD0_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD1_ENABLED +#define NRFX_BELLBOARD1_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD2_ENABLED +#define NRFX_BELLBOARD2_ENABLED 0 +#endif + +/** + * @brief NRFX_BELLBOARD3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_BELLBOARD3_ENABLED +#define NRFX_BELLBOARD3_ENABLED 0 +#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_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#endif + +/** + * @brief NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#endif + +/** + * @brief NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 +#endif + +/** + * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e +#endif + +/** + * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 +#endif + +/** + * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 +#endif + +/** + * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 +#endif + +/** + * @brief NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f +#endif + +/** + * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff +#endif + +/** + * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 +#endif + +/** + * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df +#endif + +/** + * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf +#endif + +/** + * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e +#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_EGU020_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU020_ENABLED +#define NRFX_EGU020_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 1 +#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_GPIOTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE130_ENABLED +#define NRFX_GPIOTE130_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_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 +#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_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 0x00000f00 +#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_I2S130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S130_ENABLED +#define NRFX_I2S130_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S131_ENABLED +#define NRFX_I2S131_ENABLED 0 +#endif + +/** + * @brief NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 +#endif + +/** + * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c +#endif + +/** + * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000c0 +#endif + +/** + * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 +#endif + +/** + * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK + */ +#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK +#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 +#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_MVDMA_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_MVDMA_ENABLED +#define NRFX_MVDMA_ENABLED 0 +#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_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_PRS_BOX_6_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_6_ENABLED +#define NRFX_PRS_BOX_6_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_7_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_7_ENABLED +#define NRFX_PRS_BOX_7_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_8_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_8_ENABLED +#define NRFX_PRS_BOX_8_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_9_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_9_ENABLED +#define NRFX_PRS_BOX_9_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_PWM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM120_ENABLED +#define NRFX_PWM120_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM130_ENABLED +#define NRFX_PWM130_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM131_ENABLED +#define NRFX_PWM131_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM132_ENABLED +#define NRFX_PWM132_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM133_ENABLED +#define NRFX_PWM133_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_QDEC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC130_ENABLED +#define NRFX_QDEC130_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC131_ENABLED +#define NRFX_QDEC131_ENABLED 0 +#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_RTC130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC130_ENABLED +#define NRFX_RTC130_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC131_ENABLED +#define NRFX_RTC131_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_SPIM120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM120_ENABLED +#define NRFX_SPIM120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM121_ENABLED +#define NRFX_SPIM121_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM130_ENABLED +#define NRFX_SPIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM131_ENABLED +#define NRFX_SPIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM132_ENABLED +#define NRFX_SPIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM133_ENABLED +#define NRFX_SPIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM134_ENABLED +#define NRFX_SPIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM135_ENABLED +#define NRFX_SPIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM136_ENABLED +#define NRFX_SPIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM137_ENABLED +#define NRFX_SPIM137_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_SPIS120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS120_ENABLED +#define NRFX_SPIS120_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS130_ENABLED +#define NRFX_SPIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS131_ENABLED +#define NRFX_SPIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS132_ENABLED +#define NRFX_SPIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS133_ENABLED +#define NRFX_SPIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS134_ENABLED +#define NRFX_SPIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS135_ENABLED +#define NRFX_SPIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS136_ENABLED +#define NRFX_SPIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS137_ENABLED +#define NRFX_SPIS137_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_TIMER020_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER020_ENABLED +#define NRFX_TIMER020_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER021_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER021_ENABLED +#define NRFX_TIMER021_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER022_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER022_ENABLED +#define NRFX_TIMER022_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER120_ENABLED +#define NRFX_TIMER120_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER121_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER121_ENABLED +#define NRFX_TIMER121_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER130_ENABLED +#define NRFX_TIMER130_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER131_ENABLED +#define NRFX_TIMER131_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER132_ENABLED +#define NRFX_TIMER132_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER133_ENABLED +#define NRFX_TIMER133_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER134_ENABLED +#define NRFX_TIMER134_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER135_ENABLED +#define NRFX_TIMER135_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER136_ENABLED +#define NRFX_TIMER136_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER137_ENABLED +#define NRFX_TIMER137_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_TWIM130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM130_ENABLED +#define NRFX_TWIM130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM131_ENABLED +#define NRFX_TWIM131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM132_ENABLED +#define NRFX_TWIM132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM133_ENABLED +#define NRFX_TWIM133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM134_ENABLED +#define NRFX_TWIM134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM135_ENABLED +#define NRFX_TWIM135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM136_ENABLED +#define NRFX_TWIM136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM137_ENABLED +#define NRFX_TWIM137_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_TWIS130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS130_ENABLED +#define NRFX_TWIS130_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS131_ENABLED +#define NRFX_TWIS131_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS132_ENABLED +#define NRFX_TWIS132_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS133_ENABLED +#define NRFX_TWIS133_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS134_ENABLED +#define NRFX_TWIS134_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS135_ENABLED +#define NRFX_TWIS135_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS136_ENABLED +#define NRFX_TWIS136_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS137_ENABLED +#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED +#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE120_ENABLED +#define NRFX_UARTE120_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE130_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE130_ENABLED +#define NRFX_UARTE130_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE131_ENABLED +#define NRFX_UARTE131_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE132_ENABLED +#define NRFX_UARTE132_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE133_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE133_ENABLED +#define NRFX_UARTE133_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE134_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE134_ENABLED +#define NRFX_UARTE134_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE135_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE135_ENABLED +#define NRFX_UARTE135_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE136_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE136_ENABLED +#define NRFX_UARTE136_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE137_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE137_ENABLED +#define NRFX_UARTE137_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_WDT010_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT010_ENABLED +#define NRFX_WDT010_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT011_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT011_ENABLED +#define NRFX_WDT011_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT131_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT131_ENABLED +#define NRFX_WDT131_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT132_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT132_ENABLED +#define NRFX_WDT132_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54H20_ENGA_RADIOCORE_H__ */ From 22ccbb8300c125d1db9a43bcce125475d68ffa42 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:25 +0200 Subject: [PATCH 1672/2300] Revert "[nrf fromlist] boards: nordic: Remove definition of nRF54H20 PDK" This reverts commit 1fcc5e329b6eb9dbe2f068139747c805186dba63. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board | 10 + .../nrf54h20pdk_nrf54h20/Kconfig.defconfig | 14 ++ boards/arm/nrf54h20pdk_nrf54h20/board.cmake | 3 + .../doc/img/nrf54h20pdk_nrf54h20.webp | Bin 0 -> 27232 bytes boards/arm/nrf54h20pdk_nrf54h20/doc/index.rst | 153 +++++++++++++++ .../nrf54h20pdk_nrf54h20-ipc_conf.dtsi | 36 ++++ .../nrf54h20pdk_nrf54h20-memory_map.dtsi | 177 ++++++++++++++++++ .../nrf54h20pdk_nrf54h20-pinctrl.dtsi | 53 ++++++ .../nrf54h20pdk_nrf54h20_cpuapp.dts | 171 +++++++++++++++++ .../nrf54h20pdk_nrf54h20_cpuapp.yaml | 15 ++ .../nrf54h20pdk_nrf54h20_cpuapp_defconfig | 33 ++++ .../nrf54h20pdk_nrf54h20_cpurad.dts | 84 +++++++++ .../nrf54h20pdk_nrf54h20_cpurad.yaml | 15 ++ .../nrf54h20pdk_nrf54h20_cpurad_defconfig | 30 +++ .../riscv/nrf54h20pdk_nrf54h20/Kconfig.board | 6 + .../nrf54h20pdk_nrf54h20/Kconfig.defconfig | 6 + boards/riscv/nrf54h20pdk_nrf54h20/board.cmake | 3 + .../nrf54h20pdk_nrf54h20_cpuppr.dts | 56 ++++++ .../nrf54h20pdk_nrf54h20_cpuppr.yaml | 13 ++ .../nrf54h20pdk_nrf54h20_cpuppr_defconfig | 14 ++ .../nrf54h20pdk_nrf54h20/pre_dt_board.cmake | 7 + 21 files changed, 899 insertions(+) create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/board.cmake create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/doc/index.rst create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml create mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/board.cmake create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig create mode 100644 boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake diff --git a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board new file mode 100644 index 00000000000..b76cfce6800 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.board @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF54H20PDK_NRF54H20_CPUAPP + bool "nRF54H20 PDK nRF54H20 Application MCU" + depends on SOC_NRF54H20_ENGA_CPUAPP + +config BOARD_NRF54H20PDK_NRF54H20_CPURAD + bool "nRF54H20 PDK nRF54H20 Radio MCU" + depends on SOC_NRF54H20_ENGA_CPURAD diff --git a/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig new file mode 100644 index 00000000000..954276ec829 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/Kconfig.defconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD + default "nrf54h20pdk_nrf54h20_cpuapp" if BOARD_NRF54H20PDK_NRF54H20_CPUAPP + default "nrf54h20pdk_nrf54h20_cpurad" if BOARD_NRF54H20PDK_NRF54H20_CPURAD + +if BOARD_NRF54H20PDK_NRF54H20_CPUAPP || BOARD_NRF54H20PDK_NRF54H20_CPURAD + +# Data cache is disabled due to a HW issue in the EngA SoC revision. +config DCACHE + default n + +endif # BOARD_NRF54H20PDK_NRF54H20_CPUAPP || BOARD_NRF54H20PDK_NRF54H20_CPURAD diff --git a/boards/arm/nrf54h20pdk_nrf54h20/board.cmake b/boards/arm/nrf54h20pdk_nrf54h20/board.cmake new file mode 100644 index 00000000000..4c63f1dd05e --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/board.cmake @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: Apache-2.0 + +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp b/boards/arm/nrf54h20pdk_nrf54h20/doc/img/nrf54h20pdk_nrf54h20.webp new file mode 100644 index 0000000000000000000000000000000000000000..bcda6b0732b3acefe24e83332692e8ae898d47b4 GIT binary patch literal 27232 zcmV(sK<&R$Nk&FkY5)LNMM6+kP&il$000000001Q0stKW09H^qAmnKP05D|%odGIv z0v-WAkv^G7C8MIFs<#_f`^Tyu{XVb1!~f~^1^a#KxBm0?$KBueKTr?yzxRD)|MGwT|LO39{#*Y? z|NsC01K+xSonO6Q4IkwH^m@#H=j+tz7wmud-%B0?{y+QA?r)yHJUxT_SMGoKKW`kl z_1&qL&c6bG5BukzfAhb|en2ZGY47uKWM|&)k22Kj|Op|7*S3zsvvi{~yuM z*Z#sCHT^9R#aYszQ6T%hXv25?9kP{cS8-sRRn~HZN_VFXGV_7VrZsBY0)EkU@d%ZP zDO{TD=THao;x*IxY4#c%C(_1A-lkL*4UEJII+fEPN{Tm_c_=izGlI;`lSSSfQ&t9l zr!I}oC4w&O?eX&8`wfx=cGKmU^0F!HK1YUGbmK>s5-#N>dX$p2G$E`oDFWY!)i+## zd~+uIv%gtK<6x(}ETEzWU-?>~k@tVdC6*nRFigE{`(T}MwKtOqR%7*Jtn+!K>=}cb zbyvmBmyR(sqMS!NVOh7e3k|ou*deS&v`)jorS3@ymUpRq1A$;uo)9%LD^< zh=}Us5mBoS+gPPc*@)d!vMnORyv7#TFtjumnwldw|J8g^k}rN8I9I*5DbpyQ`|mW( zD+G^|`+*4Ja?x^ts{$+3v)S2UM7^`AiNaS;hd9;seAUMqr+9D-8iCaJ_ij5YqzeYm zI=hf_SF}=<&P~E_P4XzSt$8bfx~@R`qEzV$K)U)jmsdPI=-Kbr&3$RqA{CHeX%vWE}L zq}8~4%$5>tvzCXYthxOrQlB!E9>%Pmj!kqXJhftBHWw@-rTspQU5+AM(!&Gu^m?H8R+r9W|7OPb$( zYDC_gB~1y#f%h}(abst_&Om9KRYgE%lnRKl(gCV(4Cj+GXI6+P>vOLZSr~r-@iJ*Z{Y+qy3{$w(C-Ucc4h zv9!P&vpEx0kT__~G=X4!;tK#)8*>t-N>>N`?NPs_X%-or-`*+KI4Y3$!)&tPBEAx4 zYatLe>3vUy6~2>cH6@kvW&ZSF$7@@ev{kO-PLQl?{=crSVuUvGUW^Th(=(JgBjeZ0 z;)88URvX0eAKkhTubh_R^qf$wc_SZF*vuky=$h&e)nkc+_IS0l7^SZGP1IpCWnjyB zpawTHE%E)vx@Q+{4nc;Kwm|5M8gK0az z71Ld7vyjEYF=th7=^J$&EJ~Ed1a%(NV#SMvy}v3i79?kpY76T{5W3iL)1Jq2c%`v( zwk`3GjAO|q{2?cl+T{OnW?fT>qO6++?{`kSH!jMqAXzvyBaLUQjxE#F8&xIy^Y)D# zC@H_5Z{&b#;#I~3fJGDAvH1)$@!vy}4A~h3`!;s&=@h0_pMF84pZ@O*J@Tz)N%6N! zROKOkZ8eLWk*l!(13)c>wWQ!|(NS9G-1q23b0tK3-a)c<2;XUB=Pe$ZeR*7QkqH^7 z*VrmOSjt3)60pVtn9Tui({4DuO&TOo$XthUv*tuzA=r|m=BOPPcRbvBR;h%~n@%OU zLIMVSbvOIQK@!2KqR>g9`Ddud83VY3NS;%GqCwTJs-_9=5dwV&0Y6teSdh;9vyyGi z0=We0p!o*?js{=;5aV2%J`T^dIlsLu@a|?-@nam-0ES{-*s|Jr{zhoat=OeHF}7%34UQ6FI8SaIA1OAW~jJ9Pc;uW32%OwwPOVSw9Cr^O%soLQel;5n--6nirp9 z_|-k_VQmU7)DR*DJG8X>JjF$(d)vp%HKfV%*q2&9gpxUXjVMeL?e}W#C+igTu|z&j z7mPj*8p6t40Pxb!^~=p``t}Q_585gJeE}`m*@f!{-w3WIbjC`9Gvuf(BmUN+U=`;THq{Xavb@z$ zyZ^aK1}HInId#{m!&1i3&B*+IeEIeE%h;vMdJ0JsNLcEIhu?uKomXy6*VR8giG2jT zu|f+Z*=f7AN#%9b!j&RzE94h;U#LzF^S%Cpz@^t;iScjLPA1wvGq!1RmBO0wQ;|BS zWx%qB8MI5O$#Y@Kw(&7T-YkCP>Yq@Nr}C9YC(0>|Z6O%Osa-y&Raic5Qt*Ni64Ru1 zwMJC=YisyI%9*fZ#2*3(i;<#9ib1D!3|Bu19y7YXimF65wrKsuLK$yqh+5UI-UVnk zH0+}t>U!R}UJ__UE@xzz7%gov`WDi3hmbnH_zsp$vo~gn#rG$5gWzgwWAuRTdKKw{ zMduHokK=vhZ2B|Kh^d?ijGOxst1#hv4&(oNzqCQY?r^N;I0Z6I6cJH!4yjMgb{F1z z%C7w(JwiMdJ=B2MnvEVE2||zzWM)m*t!vfJjOj6-G_^;j!{YmaPy_1|+(zBs z*i81H?~5W*Qkb90GH7oS|Kc&nasWqVdoSK-3}i;#s#5br%W=WRF2T{rOHB05zB0=+ z0V_yxt$G99+O3$HHl=+rq{cRojAO`4%X{MN23V!fR}9LzUnAn73ne> zPgOXA{**J8^y7&^SWH?|S@Jgtm91Ui%qHsvUMu6^GC{b7&peXC#aGSe0pJeC6A3T? z{`8#BZ5?p7{dSb@IVt~BaRa`7lxF99Dm8<73C;^CAnL|g-t?8qX%ORlH<@gsgebT@ zN<`mk-QVA{cC0S!-FWh%SJ)p#@m-2vv-1nVce?2Ns)WFdzt_*3!gojBHQk<*mylRW zYr}$X4s=OUV9txH^r>|74HP7eR9dt4f#ftC+yCP83)Zzx+nCdRxazNs1R=rv_K*9# zAQe4r(=SCI$O%4e3te9%Y51uh8I~Q;X&-No^U0Jy_W}Q}UDhN9dEotk6Vo*}_CI0| zX36tA-3SzaxiFf}xBX9L<&@;-?qwL*?mWKlKp!W5_W#lg&QS!i-`Tt$FbX#dH z;`^{4jTMsXRE)fiz`|xHcDLrMv!b@f&^dyxhw*8e#?O_AZZwHozPbR*lB6pp5x;el z8AXZd<;6O1{1kR))iMwn62g&*x8>8L6dfvKs)F0k(2!F)^fMV5Sq<)0lfhK88)-P2 z!?Q_Uqh|)v1;47?OkIDg@ zaSj4MQaO%ZKAq{RQF{iI3j*xNEtvbd@Wx5^`!sE-b&rT zsQz`zy4f1s;zaIaWk#MKcvLFk{w>bmdN9a6m1i@%PUp3>l-WG05DD#8QL3>;=3YQ! zen{XB`5-d}G52gZ`DaspS#{{5#am0f-SFQ5M-|F!Nqyt^|2;?tlyAV#IZ*-AI4gyn zIyIHu#E3WS-eMIT2#Ij~@KsX|Wm5cFlh8~;vN1f4&-lfzOzrvtV1SfD6}S!~gnwnG zPURmT{w*F~N>ehBA8Wi+p5cw*!=m#i&ab4WHJIYk+%wlmyaL;TIoPH;u{5LjiN~&} zkes=zmF~|9&kN`)jMNkVF;pXd%RKdXlMe`k+KGJLE%X)OcZ)qtzOf&-pn*EjiJnU( z0dsC4`Xh^FnPnkyK$TGk!mg?f0AEPXHIk}ok=`MYW&3ik-VH~GB_?`*adTL00z-0u z`D(CtB0^<3$afjF;UD)3@crO2tnbx855onX!q13kp5|6vCD zcDzPoPEmcfin7a1WJ}l$ACGUg7qe&&GG;zi%OTD85h_7Z+meLOerw&cA*=9?odO(E zL()JqK~(Z{J50(|rqdr;r9Rp8BM8Cm)dM0Cs7MMN(E|g0YJKPOem~P zD-nQ4nfM2hE99CazCnnN51GO%itIW6$g)7vd_l%uPFNNw*BL)Py5$K%dCe(n%DGWl za27H9|B@tCeQZr%FL#tTCD)Gl20tS=7);1Kk=wggPNb}f zk*`&NF;Sd5ih3l#l=<^zI64rO$bqe_HAErlLcU5s)JORWPv0mCrVRp%;r3$twB^3B zdux$6{KHOkH(=u^O|-%t&m46{O50M_(&*dec+h$=VaUl(blK*L47HSVN>{MZJ-O0Z?!UZ2VNK5)kjilN+q28AX z9kVtbgu)9}(iT(Rvgj8vZ@?U~_gCb)!0mQn$xu2QF_-US?aEG~MB^IJK$67L;LiyR zQ22quWB~v`7Kx%aV6M{TvBaI}0d}#`e}e^K-d859f0+k7HJ(YYfdz-g_$Gm|8u~M< z?W$>?4q&)yh4B4cnIggu(O$=XgEhXJ1)*urcplQLiv^?yzc+;_8w;O&)lS_J+Ib^J zY~PWbh2}h*<%Ew?Kg1-mp<>pOlK~q~?E!yQ^AYfxYVTFw8CHyG zfX^kR9u>}l`LYfwF!rS;h#Yx1uraqn{u}+-+&Gf|ov$Fx=FcUey#YD%IVu0n!Xz0gwsT5acjwL0klt@REZ-Q?jgYYDVtzNe^y}Z$bvy?SnZ2xiJ)7;P z>`v(zw?j!<8)4Dq>%9jSX6dbV7jT^oUIQu0Q?Qsv)j3H)n~RYbDAP*#nQbGOvOriw zI@pP)EN*xT?}$VwYtgpW?q%v>nv)ui2!>N1wtRN$ftd&ccxzV_7A0g-ba4QV@nZdc z*}c2S;{1)ZdSOaPyPFOE7{8Z)jzTf=;L8IIRfxeA)^yH&1CJ?z9EC%81a6u?z2sT2 zyEYiM48bul<7V-?W(RjVX))jSPcDt@rNI&K2pQYtM5YE;O;Mp9N{QwA ztZI_~nuQ!*v_{30cGph$-=^9^+xB~|Ea9EqmpQ8$v)~T^x_RQw*@Qg>wpf4Scgy5Qm-iJo$#K7 zI?SQ9IhY{Zi^@I`w5dbATKNd@ZTz+9MdB_*kmy6N&yEhd{HS(yr9L)MJF}$P^V zxNmr&l`9X{spN=;|K&h7>|%KVcfLJ|TOIV9U&!hOU036Gm*AoNZ|>Xgc$65Oedseq z3!4KcigwSe_Oi^tZ{@sTQ|3*x5iUTpnUwC$JbpUVhldI*hoer zj_*FnL;EMUO}NkH0CFGw3R=b3FkOTWMYWdLl?dozvU`K{_~ie+IJcRlpjUnWuRwU5 z{4SRbS5uyc9bGps=Py1Mzo#2aPHl1lAw2uA=lEpukj~H(89kPPZrlIXTB(Ko;I-%{18 zPOpR-j8sxZ$V5gG*y221Wt19=6_X>HS5@wj11nX9HH8{dfTVDxu0D6t$S;j@^jvCW z!olT+(Zvn-?*8sRIJixwOMm%>+96cQ$r&7p2HN3sEpiIa)n1p_LQUN#@x)N5ng3-> zHSWNB?9c&8*GpMZrs#J7olsbbGN)>(`ZT7kY;LKuJJ5jp5rIY|%f#-~=NWQYm)~li zqg;bftvGJ@Vr?Ybr`ymNO#J2xUE4dS^s`D`nyEqdV=D`et7hMS%INSqQFv{Q0{ zM+bU3YxhPx!|Tn~pW`!Fs&*qV7aqo~+(b%Pt zJr~{_6hzg)aU;sF`i^$O zKe5zwh*!h$jo%8YO=HA6Y0qMChzNf;Z*G}8TQ&++YQgwW#IpWCd|v4z6u#)tHr`;9 z3Z~d-7JrO!{HK0q%pzIlzA6?-v@LA{-8CglV`Vzxv5GV=nnxE6d|DoUnUaKEEQWQo zCsHo_lfAe1o5&w@O25m;6@4=lkYh#91(jZS5~OE8WiL=3zYE+!C7{>=5F4XtJS*W3 z)wDCMtrnaif)d1w+p?o)!?@|#+^)*koobI{Nv_~nIbpz#C3!*7)?5L^{s$^-{A5mh z-X9kl-RD*8l&zLsB}sjS>XgGfWh%I;MKOxoBMIu2tD8osePcxJa-|c|vnPlBtqDj0 z4tGz(mV;Yq)Yu&b$bl0sqAT;HF_;7VkmJ^H-0$YW&-0>wEMtzzqKh%IO}j2Zc+em5 z>GauvL;0{kdnpPw9&dQLh*xFG57}we?|-t`raj;6)U-k>K%VH1V;|YbSL%quLB(J+ zklCSUN8=)_@%vFO7PAL?5}ZXKavcOs@3Cb=l;_hL;}*LJb7u+f1r6dS_Dk}`j$C44 zm(F;3wUhkMk?W^PjX>ApHU{%t1%mkD9u_RcUy-gZqlWDXT9z{yrO@ksgVaKQ`Gs=j zj9qr-;Aov`Kfo{;6+%47ZTn#x(pP%ZeI-nFdp7C)-t87)PmH&Umalwgg@rxr36<`Y z;k7gayCe->lHn2eIBDq_>^ zlFJngySy4vFeM7%*XkwF@AHW+JG0AV1yJk7?B}|HR0P>lJ6ZHIjK?|~=u!wR zZQo^uxH6SY!2R}_Yr?#6h(L#2f*t zP_+=a#R&1tm8AZFr_(g;Gv#M+RsW#|kV$fx^91Ofd6$~MC8tx^6ITU&lMONq!qZCM zTn+M-ZX}@P5a*H<=5H_UV%_BTf<=lW=^=B3c`7?r#&$v?x#{f3UV8wCf($Y-PKyDP z^r7FzxO=k7K)r0RmkX(W^sp0n{5S6X7*F*NxqGkZd(Pz2KS`lk^z7VPo6BQtk{DWqm&yGZi{ zV)#}3Fr=3Yao*l6Gup{6PGLQz;j@hdduqGRIBPMHlC^GwJTB}jV65Tlw0;RcibHe1 z<{oh*+!ItduzbCNz#DcXnl(73^^3LhQ^vBeV_hO+?GJ7A&AY9SOEVBLo6XIN{MNjo zv1X%5ZGzz8&hso|plf{X&@ifuUwMG+FTbbvDG6Ka1_?xJdx6xrQ!>pqRG*Umej&n=AO?86T(8%U8=Lih19_GgXyCOV zV-P`;y+d{(ylfaGtAB5I{vB&-3H=@lle)VoCL3w@-H?0MuspM%+xHVsBunIze8dvo zSR+w6bY^Jm=d#*|NulZc$GZNwS_cn$5+nry=JJ=CSiCMUX~+Rxq?8xfx^f)#k1^n{ zu8p+pxnRL#^GvmUvBTE^Ab@M@AIA$14ZVdWRS0ZqHT+h8#$8bpVIrQ#hx0M9 z9-OlvAcJaeria$VW;ujxk(NokEOVe%FC#onSD85yP*(eHb*gUI{tZsevZ_lPS2toO zgCdJFww-RrvHDpFhz&hysu3|3#)bnC>_%p?H>P6KB*vGHht8Tk`?Wd_fZVvvEW-;h z!Ep588D?(~g-Q6;IWW$_?R_D${2;R@t*C{dP%U z0@9Up(bA7EkNd!W`IU>kD*^-2CCx2M(;| zp4XV#eeeI%(Eir%o8W|J^J_&Kje0eDh8>_n5k*}^6odIY7m-ADyx9S?D#fj^-`eDd z{6!(Ftp;a{K_eIXtb$sR0Fx2&7KcQ-Iup@|{Z#`W3p zpJH@4g^C1S&-SsxuD5oy>cBfXjf)1;k0L11`}epol(tlO;5Mt)@|`VFi-c%tzoWE-Zp>fKB=T^3XJ>qt8XK_25APWndGefr#C_;$(~jMXS% z-8@*u+_~`JN+~<)#mkY<2Tr;aLU*8gs48ZL$B*mW%;xg#7ud+JY+Y@>a4JVR6&R$S zqpgzfW9}Un-bHGKm+V(dzoZ<+?Ig<5OM#KyAdCTv_pVB^<#BxgrMjC@`!=OlyV}=& zA~Q`j>78q}E4ggkM5mUz^dm?Wue`sKL0fsd-n`BrF#$m)&yCN@B^cmm(NRB;NarC> z*T^M-i6k7*7Q&@?QfxQXJPj{Ef>0hHD%HBhNF;Sr-2_>SL3ry7t?*#*(C3Rk_YAB0`?&@i{RVFeI^U;0}4j0Ej;7UO(2XgZM`1 zQ^3xNA3YLg)grUg2jMMUw49ViK@kWR-?x*!Q3LVqJzk@`awvM_7?)&#Jq0p7$e4t) z_gU7$La{k}pgvT0J9uM9>LySuXo=N2m{MigR2!dWh1*-3Ib)uUX{8qCV}XU&^gx4) zh|&5f+jGsp9-#kDXcq^g>D|>OD)_3d#p;X7O}dEE7_i!u@1WpY=G9Wc(xEXAm(64L zAWvVH2>Twg98`B+q1qAqwHaf>xqp~y(KQ^^dGJ+OXehr<_dU-JP!fsGOBnQdtHlo2 z9y-QPF%vqHCypnIl@wzVk_MfSSN+ zJN(`Vd@J6)A3{TW$K|vW22`l6~2ZA2Y{nIJQVHA2AVguRVjTDAg^C(J!3s}Z8 z+7iX2X%m13LpNl3aBn{})%z!|61O%gwb|z?u#>>F#GfYL$aX}IBxQ$!zQ0@jG0lcf zm4tMh{EXJ*Ii;$`IWpI z<1epa3{=CAlD#c3Siq4$`LAgyS|tzcPUNTPd+<%Rges7^6A598WL7X(0R>=@~j zHV|xmX1P&VDm1w9pyFk`;0L@y!R0mhh}Mqh)IZO3Bw5+Wv;1F{iDZw7eHrrr9aXce zwIBfE>(0Zkn4Id&)=j^hD;oS1W5@i#E50&$v%P(1I&lM$;)#h*#g*dTQ1;HPYKsOh zwA_o>Y~cI`(YU3xy@DojtK~LQr!Kb$Wr^D34Fis#f_F6WfYCGxY(xe7k6EdJL?a4< zV)%h_0MSRz`XDOY6wZb%1S${Drg771P~Jgor3nW49tSx;&!EYWH`7e)N+H;m_!mmC=V|Kq^B1ZRk_L#dh7_3Ov32?U@e!*w1APB+>Ggzsxa z$~|qq+yt}STSQm6TB4tXQ#RJk41+yRLR}^fZ%vJH7-a?NJyqZ=nZlh|(V{lCG(y5PG!Pz0ga)V1U2k}^6+a4xX0kn;!u(QD^`6n5>p&N z)q6tik+t{#1_`+g_FXCL+9SQW$m(vd=rQfzIL;NgybvI?5`@_zYM%w~?|b@GUBT(!~m;WRo#C6hHQ@X5w;I6g0)%e>M$ zS%Xq6o|x7$CY-Ag6yG)_I0O)1ya6z4EPX@Ug=xAKjY@%}O&u3gGhcQdPq7;Z!5Y*U zUo0B_J*P~0B}Het-iixTjHExMlobl@sL=xTUB(^HgkDm?n;?x#%r+f_nLCqGjM$$%n7tl7+o=Rh2926#KzsQ?hzP*?lS= zSvblAU`b#I1hfhu-&$6i#xThk|8N19{FTPkm)S|Kn)S&|!}gzvUHzWdf-TFI2^O@> zbaV}Oh7u9XJ1u8J+(bl#aep=SWk6|(oOQ2RMaX`6xC@#8Wh{ybI|xMT3FQWp9LBP! zwsu9`3A5UEnpV~ppRE=EVD?zIqD zi=Q1Q;L#7YWMw3_X9i1%rv7hfncX&QM8mghyaJ|WeNy>?0&fIP9Gqo}CSncZ$+xny zF&g(Z4inYGAyDA`Jh!TmPRW~PrxxIZ8)GzN@||=7denUduMA!{UweGLZ6M;6jX`u(m}n?BPw zp7(PmFOx)V4TB`uaFJWS$UZN)?*8%BY;H`gI$S`lGaR=yF!QkYq63|^-n>}T*SAD7 z`<9y3T@bW4IjEDb6v}92r`VUn3ItlC(XBdV^CoY0=K2bbku6~EPCLfFW0$CWInUmf z(xyNQd;lokaOPboaAVxivIvsdIrhte>?i}^DqE}(qq7;Ly{%KkZkn^Noml*ky11ML z@B58I(o=+YVZ}%Ti6(jGZ@?Iiy?zy~vW7&5CGWnu77mqqUP-@^Ef`Oe4nD561t4|J)>WTAWeAtxreKDRxuJ+Li*jhkCHNB7(1R4wDks#UI z4n5`(w72#LU_lB;h|Goev4&qbM^j~);~m?QZEEZ~6EAPR>QSgR`ozV~1Lw3qvT6u$ z5}S2O3V7OB8=-H&qge5Oc?7?$bEq?{4Z*&T9xJFlt27`o#tmiz@S9#%`f9v^)s-A z+s4|lxHkzN&tg~)#11dEg!@)IW}{Z%?=I|fBdsX2CTdeeY`99`5AcXmCLbWt6(5D6 z4-9vYK`Sf5X+;pnd(6=NnA*JO;%*NE)E_RCur9eh$C3t z7qZqw0gYxC>Lo_r^-y`#`!hgB#FXX_US&+-2*(WcTMnb#@bPv5 z{$)|wnK1^LQ+8S(MAsXRo5H)Q%H<6HD9AY?>opn2Zy_}CYScPg(4Xg#&Xe9KcL{1NGuB1;vHP0~Xsrcf;2Bdy(6XC#9 zkqn?K7ya`(gRsA4rvDn$`bL_68;zWHg1JHxp0ah+klacJWegH_K50JPt53X$1k|-D zluJYDq4YCiOUA_3VV5Dz1D`V60dufOonH&d7n`*qxdDHllg>30(YoDY(PR>NHROcTCTpB= zpJsVS+ip#<3L>7pUv_F79pimKgXloIqb8ZrTid9cUCY#sL!MwXe>nwvxmFu}=~QYo z21m#^fvTSIkE3k0(EWh2z)r4kry>2qnxxn_1XlMB`QFHX%&m^zFHq0=&gMu(W8dwn zTXi>8g>4hH^us-YVQ$H2XM19sLKO?qt=**zf|mXG_L$?O{C-C1CQgGN*6r6k&DNmE z;clq2ay>Rf!e;S=$YS_sDQKKrX9?$E&DoX(|F?Lxdk{X;v!IUZRdz!43qh)a`?qdt z@W75Zj_SY(7DDxjICf_KC-P)?qUoQs6E0!svimPIhj4l}pu7C5{nc+yIip2LQ3&k$cAcasX=T@eu(HkcL|fS)k@W**pITdy zzfi`hS8>e|2O=`wtc>J(;}PYx%_PC4I}HV8_~|LOrvqiLCY*Lra+qOXV1_OwB|Rk2 zA7{QPX}Tydhu*-m$_MzozD_n?lMy&pR(o??LgD~*t;L&AZ4<6A>oLzr+QkDX^YkXh zx~ohy!XhTJOuV8w#{t&*$_vkn^_#*NKj~gFv};1{0=3i(3DMD|nz21uM@6?UMf~9x zU78U0YYw~>IkDSLpC|{K*dtY(;67-@qn0T*KWRF;{Un*pcw!0Zu1U7nv-3bRo&tJh zM9f5G755j-*J79?jqNy0>5AMiL{GbVrNRq|ViXXBubfA^_h-M{P(V|*n-N;4q0qE{ znJUS{G-TLkRiML=KZV@RPR7q-s(w+(C=nx7aRX%cPdQ?B>%tg65bCQ zQ~rZHt7f3$>~nZj7!e#^RZ+RY88C)9;DNTC)t>?->AX{mMsom5PTKwV_qxm5k1)n; zZ@x(`hFwA$IwS%UwdHAMx@4ifSpM(vn89$zZtz)dXcpY7OhDz75GZzXxNy$53c!)q z9wqSQj_KYl3du=I6W#1%?0jvOl(lITW@eYjg>JK;&ytMJWa;^!rQ3#wvDs`wc*&$d*D9GI# z90SSv=^Mb4yloqYSi~^8<7Y|bDAFG0i+=|d&fBSS>8#W|UC{M#5Fp1Z+ZM&wtNtoc zK1k6UqwL+k7Zzs-O^n#55#jcKvx=k*478(y zhj)soOt9XzVBKr)l)o5J=S^wSPz{3Sex=N@B{^pyOwsfWF~o#^V6ho`f@%TLNn&LVz5X_xBOR%vEcPyO*L)!$E0Hms(mL}e40XNIwUUD>b;h0u;FidkK5p3J z4{OxfJQoh~(OEM~XEz?n@(?Z*UYgo0(GPr61hX6gwf=oWIZ^Wj%ij{tsz52bfxm8# zc7vBT;r|AVwoTmdzfi2X<`3t>*s!y^wN5bQ4u*PL=KB7^TFg=NYPt&MS~x827~-9D zXLA4LA;jcbeTFv7@JsXanQ|79pHv&iygfJKx52Q`Sh7~MW&F-vz*~w;+3{nUxxDfb z6=F)ED4I~YG{~t57E?%pX)isUME_Fo+m``xL;YsH$IISb?qJ38++q+!6YJDQ5z4IC zfWwXRdAY5>Nm!%@_9;fF38O&w(<}en7-TIkZu+X_NMH18XB+T}_rgyqEcc`(A9G!k z@3<;=6FXoKWDB;@M#+7){{m?+xEquLM!4j`p4TYJK3K?v%o7&Vf}PEp4M-0fFw79G z6zooEEf;#+?Of3EecMDwbbNT+i8y}pFr5M7?F5BeG2=xq_Qy%%wokBji1RA{h;=L) z7M@mMqaX3GskS(sBrc!RSWCLuS=!Z?OQ;7lC%4nldVHk%i$&`n4TO)O6+}-t1rjC4 zqX&p81bB@PYAUn*yMO)S!u!BLdNYbS<8Df^FJP$#7qG^>wx{X7(J&l@XsTUkHMWs89Xt;ro5?DUn}>$e6m$2@&Shlk-7~D7O52Pt0WR;ZeE1M1 zdiEkgY@PIr=Z#Z%16k+2kjCuDF{6n~7!XHCH-f16=jnPCs=`@p{Tqdf{)O6(ZLtho zpKvnbU31JRS9TY5UrmA~%1OVMnL@S@1q<=&hjH2s4>n`hAPW@x(Yw)k-=Cw3p+N26 zAoN=kQH*7*P&FcktczYONK3}EWJjOdD#juacZ{3!Zu?z&qxr~nJSZ0nLMJ;s^8XtD z2bkw~=r`r`%SyE~o*{FOeMJd-9s;d3@RJ?nx z7_v=Bx-N3F`m6y~`o^LQ)`Qc{(Sti8LQXJdq(g5JUrSX;8R#(EP2h0kZae zoHp82VkRbYl&&WM0Ze=Z7^T3dg!RxfO;BcR*p`DF*bXPBrrag9QaJWE!mmJ|xTDC} z*|qb{y2F+|&2~xe8eIgI{5$NcSfN^O1+MO98A<6S%YUfK*s&KObA}QZ!Lz;kuHj+f4ROmzt%2_q86P z#6~TUWXpkoC{#pv?}6TFF%CcDXSndS8aL-lILAMVe}+wJxXjpv?s}V%vJZ}V-VGWe zGqAEAML>@s6JHrAIaNo#&_-s(7DGtDj(L}z`iJ-2lqU{8zJII~Rx?|qF4B*^wmSNZ zZAGQv^fE6|t3*42BD3gI)snVAs0c?vW|f@cxtRA}$ydnpn2Y~Ur-{#rZk%F%!7jt{l}`O>35J|iqNAZNlcluqoV=p0xg&@ zhCp6{>;#2T)nhZOzU-cOnzSo|A1;HD&;@&fufFrb?>UGmqUF5UR36Jizs%$%qyWo_ zAKcqX>Pk^KM5~=q<4L*ze@DwF=?nb1T?@A{^NT`J#q>Ja;U`CY0pNO0pS1=-Tv);g z>_%Ibv{=-ZE??}$6K)m3%0LYUBU+Q@^$a$JqZWy6>p6`AQ6R!6ErEHk-C-6R1fJyV zehqbBSr_i;G^%vn6fq<=+2fa|Wy}Pd-83OXZXL!V@CcaFrpbNws@NL(I7Iw;p#Fx$ zR1j_E(;TNrAI=j(eBH@N;mkuryzmi9vV}q|`tj%J?(a1c09LMj*xWmkJ+VDLghPUMe33bcyrHV>v~-7f-3h!?}*#v z3ZX|VwP{1Wj@U1WO^Pk1eV3sA;L?=hZx%r9Nz>VJV7cIy_W(oRIRLA;Md>vFoNM{T4Q2HM_Ev$s~Qsn;f)1QRc%`F|0De| zdiJt3VHpLE7ulbz%!uu4Sgt_(@Ubu1>>_p{MHCrbE+8A}i6tO?2hqIE%2y;Qp~ea= zPBDYLj9C8-k&+#JsD3jqw;D#+bR-5lf-ylU!ZlmJgjx#wRzDz=SLOWSN>{er^z$Y2 znm&&h!|iUU<+R2Jo_FPU8Vs<2*$Ks03J7LWjjil`myqIs&tkQ*hxz>R+Z zXhXT~I3qfhfzFsx&<<9KxEO*4IAyFyZJT*C&8Qj#`6`Np>qGb>wIIpIEOo41)*hc# z#3$E;$`i^4tHv`ojq3Ygl!dVQ5Th*7O`JG3w);!_a}fb&LVFnV0;UL8uDBukf}t}@ zvD;g>yN>nm@N>OAo0Dcx8ix7r>9j~%UCSj7j5A}5SIiiTMzwkFt~2mHP#xLgmA7m2 zZv7quKC7VtOOyr&*50y}u5S`M#ufQ@V?i$=@QW;`00DNylEcp@a7 zlW9Ye9+XS`Zv%P3pvZyndTxW0iLG6R89t-*{SnK22J?@W6V^@wG(7SxD`{ptS#M8; zO(QF63*MC)u~C*$OI-;L$O+ns@R} zjxlumh^oaIisFFx@rGkOkF=_4I~aE&hDQGJc~k-)ML5_GUK%-ZFn0vu|zDFC0-D716cj5Mn_9mPJeua&XwE<2lvDH+su*IpyJfp~7e#)O`r1}7l zR~+0?PV`&o9(z*+1|D=Gt;kmSf5$|YH!~P{D)}XQdD?n7mH}7lTv^G_5_j%v=#vk* zBF%;D;V75cfAKDa9Ky6!e;X-#V(;`gBGWTVmuW!nIR?lBF^mH!)IXtNZ{Vq`{zYbl zn67J_{2;e`5MXy%^{)fSN}v->DYg);7|f3Cd%aubw5DDi^t$soO(#;2d}-qS zUUPB(^*Ls`Mg-1*NfFnj()QA{=bSxo-*U0!%f(;c0Qcq(!t~a@0$?pH1_A?}Kge9t zBq)CZw=-T@jyP&#$2HxiBx7y1x+;Oio1di}WAR=?)T9(`hJorx3=1 z7h)lfH-xn-iL)9#%NAk*R8d0~fj6@L1m-YVX~Okyw7Qz!<-$0QO>UvYIieb@0dxpd z3P2w~Vc=~>MJDrxm?$uXp*fo~H8b5x-Tf`l7K3pwL1uO8^06I& zr7^W#yxbE%<0qzTYvY*J%y^ec@2>#0k+sP;YA?**O?!YN7y%G^TT}~-?+w=1Y)g+x zl^(ObODmd`iO>2A#$}ZB;5hzC1@_*UsVQ=HC#xreFjdOYTkG}dH;9Wl_|r!-n);k) zdWkLr?5L#OzDachyqkyzJo=wmxEbQxTR{HA2xYhUHTtsseb28TBXABd0TBE4Z%>KF z_oau~64jMT045a0H(x>}CX1}QT1`&GA1@2(mHQ;tzGonsHOvmttIXw10(Y+~G-m!% zKM;TlN^D|PkhG|!7;K2FyPl32xU#2kIn*R66lGwpHz7(wvZIuU;1x5IAef3zL(;-Y zo>=#`W{nJwq`{6Y&x_#Z1=mj-%Qk|YAY6l5r4w4V4v1TowrcJ*Qndr>T5N)yrw0jD zOC+p2#2HOA4jB|Z zhdm48o#{AvZOyFTWY?lew4nm>KX>LZ-rD^4hwRun_twdfnzfWJ-S8TWIJzgt#g2B1 z9wWd`t&NkXp=W7D&2Ep>Zloz+?sCU%T|V{dxk19JCINQ1QtFP!kbQ8}aqm#ZBp zieN@o8_x00u{=hYLF1aYofoY?S*_hGkvDYA?Ydw?F zFty4U5M>{R4HjvB=!OA~V%We)d8A4LT#0NULxQBsdMm{q4uNr6gtmv2jwaV7ns^t3 zWy8eFrACDyM-;sHX|Cv$ucuaY%I8nTPMq7?5#{)Y4mnwS){AmHXi$+|c>4|jiqv99nP*F3 zUp@>CXq6ohTQ@YGSF63yF|4`0802!vC5J5C@d5*9?rw@Ob8}_V)#gl89+5(g*fL7Uvj{_Rb_Wh8b-C4&ttd$RU92|M z`x?1U0HjeZgtwLm%&@lh-jP3=7EsO8bOP~?dmOm9S^nXT3O!NCn(;M-b|E^aY0ttb zkf`j?|G~S6ofwdSg1KbqmrTAjPbv6di(LdzBKyz6YCg8e!l%MxDyF}+YZ*S1)UztlpmHtS^Dgnb`gM~B)#DaCvu|z)J^GGl zN|mk*V=2GiqgJN-y*i8T@yN(XG5aqmT$ z9Bd`2{i?A^%Sumzb^BR-GV!}j^PLp*a}PVxc}u&USN9Q;nh>=SgE=d@HB$DKu2${$ zk`Az?(a)hZ6iY2RP9PJl9&~>q3H#oBsG6sGXBf zrC0fy|1K8*iM^36jvumMY()?6d`+d&-*36B?I%cuK-&h#UIBW;VQL`5ZcU>rU9cW z*UiHi6b>u@?B%69tETpE*_O~cUDdnDrVuP#KJ~}G+Nta($jMO&3x*_a;`D5 z%z&}*DeREg_I4mnU)AI8WzH60o3mbk6M^M%s28gjPEx3F-wt0TKPc-4z2C2Pny!OEfM& z{SqE_U}pl6M6~>xDA`L3w^zI+f@L_t5$~D9w?_!_H7f02atl)z%FP4#KKjnzC6lk?tR0o+L#=Fho(0*#x zIXgLyWaLB4pw^^MA;1?fPfX&+(oXf0uvwQpDej}5qk1S|i^?EDTAo;jnC;tgC8I{( z#N!9U&9zorsq0?v&wqNLjfARkZ{1pfq?X#L%3;8{BJDYJ$<;qKm^`NTiN-{%rQE*J z{IkJBH;qK711NdHc9=US$9G}OWHp*-J75*S1du`!A?y|wux8W(#i>FSEC>@yNH|1W z!8ItEC0m=cet?Xc)AZIN zv5kJc?$oviQn(pvZQ~QTPb&4jo1Isa>;s=~-RP#c+PRu74$ja8S9FqXZU=6wctfGF z=shij1v(~$$Oe{L5-_pGi`3m*^=+Ggo?1a`pOs{>K3v^2lkbuDw>>v^_0{FBPEMUF z>&V!I3*2H|ZHFASFh~StF&@X2jwPxY=Fq1N{URvcvY|>bQP}bT4OL&RclvmwPHcec zl%CkPrM|0NML@I9^;toXy-@Y-Fx5bHMZ`*9}qf0CP#WanRIwy;clK0ar zz*iB@mna^3H}5A=sP6E*Zmq)t+9G&3`XTx~s%O*Ip#_cje#y~h2&Wv~SJp0Gu;C?g z5heJF61IlamdA9}2RuS(vJ2Pu$ccFpl3rlYRXAE_Tj;zQeWhg49W(2ovlo}oLeJ0d zkBE-I`Quq1*S9J;5J=wHL?y^HtDiLO;km04X2t>=G3Vr(0giKT$b{3~qG}k46hp!3 zsxMeaZh7Rc!xte^$vQfxC_VquvJjgU4uBGtxFhVf5qzi=KG)W!Cyp0t_pPVnaG**q zuiEpw6A)$MC~_$0ssP@@vd9s{i?f;9QjD~!x%7|ik$SJ7;EV>)^_g^+s&09dSGvhl z>#^+RGyUxhfLk`W@4D7mX~1NGlh2Y5wwQxs3Xi2-!EmEaUq&$i30C{wk)XPasx0rS zeCU*p98z2iPZNmFpu%S*QWobJ9j;^4z~RpN!^`58&}oc<>5X?HdV0Kx>(lU|>twx{dpG_!lO*)|b9#M}JUF9W$bqy3 z<-a^P8-6xV#_3p_LUoFg$P$=xoGa*OFsr3E;%k$Wzk=85*3_ofO+xULrv};7ZHc1k zwyCg>-xG2QRov$Z_nQ=FWo*xVs5(;+@#r7?T8AZ?9pOu6K4Kk?S1%a+EiNx&lk!+CqNkPcT+`dB+>5tZT%j<Ts91u>cHElNLL|>t6`nD|0Rv8%PcD2c`DYb8(B% zY-9UDfm9ElY-;D~)<(jJ0Ol4WuKfHbcp8g8A$^f*fVp^mxEoH8KBum5C3dI49x|Jj zn~p@x@v{^&^I8!i^ad-TnWrxziWzJt17Ogd9u8fIZAKo7Cy$9|Z86u4{Sgl=aZjh4 zlNaN-c9mda0Pd_@Z(X%4uU7}5-1UsEDxnD9_LlSPhI(<((puQ}jL#mBC4Lo?0XNpn z-o86n31O|#=G?fR74$kX5=tmgHuOK2Hir4bh6R};+2e%nnSEmP4tUvQ#g0s$6@C9% z!u5sbjgGaU4P>V_YLsg&7BubdB*KD^8q^So6snGX4fkrFfej0h5x@~<@gQGiPy+ci z%X<4ytF*0@qgKp3LjiJnEhquQM_~?RbW<;VK)U`OCbMn1G}+mMS`ygia~|xIRDS=WJCP%QbID3>v?9dgeiB<||5XsEQO*%C zcM1e&E4So84(^V@Jgs0jaYK#u@y(;drdt82Jtja02hE}3V-=$&p({*$XIkrt_%2Wb zYjKeekiKbukWGq^jnCZgI?im_3zmw$x3(E>zokza(B2g&LD#iMC&NP`$p{v%$`J1#DW_Xr3o&P%tK^J~8Il^(Qw>*b(Yp zT*$ob*Ktqy=%yml9q8|70Rj<&UsbExmeaumwc?0+)V`?BPN%(Mpv0j)xW+zozg}0M zzO0=J%JfH)u5CV|qJ9_Y0GJG3SAP|G;Syg><_CRt9S$2iphYK$+mtMctHcXQ1qIq>Y4I`>*C?w_n7>U$TRlr__7*X_C zH1l!bX)36_RG;PWhL0Q=5@uXW8|kZIim=eG+Emg$WGJh`B8J{-9qt~CsXFF9w8bJ0 zCSIs#K491h=t%(ysg1sC*jz>}c4En32nz=RsO&6b%RriWN9TXy|1)85U#S(ESfB8L z&CFGd@xp%9G33B&f1K-`rXDoFj&XU5?WEoeXj$59s2b?s8k z=ONT{_VuiGefx=}rt*Y(f?l@F3&cEu^3V7Than9xgPw`MaG{L5OVem0n-@LgDl2RC za1pNG{>vhVXQ=)$+d__=0+8O{z4*Us>l+g5;Te zs69Z(V6Y<5zUX%@u)f>!g+9$a!OR|))Ura04`=mt586Vl#L!PQdK*eMTYn6V1{nrI z0FY2t==EJMnsJl&Vdy(R|D3#42R12!xy|~(!hm(cjvcxH00CtDLD$Ewt3g^?SG12F zvtpb+3{g+Ngx8F(Qi|p{A-PT{sQ%p(7kHj%DT$*t-2V#k3#oZQN;=u_7Q@0`r2pH+gBz6swQ~Z)rFiO5 zU4!mZzCea@G1^Mfo^g5J#!)Lb6(4<-pJsd_sXZM+bMRyHInfe(}L$G#B$f2X7_gc_Wz0`M<12xCR2Gv(16fTri z971@n)%{~VN`w!%sr?HB8pTc%8T==Uh4I6>duX-OAOg}Dnpa`8#OBWHmWj_DsY35{ zhjGb*E#Rsb13IXTQ*adl=;?M03<&zZxtU`5d2~U0Oa1z(#gIYk<`;tRa`Ule!sN4r z-YvQ-u?sAX#s+=o2Qiwx`iBSm?uFrbP3~TN*U^HH-jO)`!R}y)P`Ilvo{e)wk+K5pd%-K(93?AAO7Q z{ z+M6JA(CqeEuOlDfwL(kgn=SjBU|0u6GpB;=KoI)7a%JT$I(Hm7n4x@Oh<6vhh^%J< zTsG9iRI(qfKYj;RC6aMLCuLwik8}~)T&iN=Bo86|TT>>>KLY{`gEkuBSbM1B531rc z0NYj$tId{AsPJoKU`14Guj(t#volrwiSxfxZGpT*q^O0b_LhjIHR1JD+qMfuH&JTSSQojJrHiG- zCj1N=f;DMSnoQ^eK|vOzWQ000FF7&vMTpszA;c068v<=z9s z2HG(PJG@EvGpmchb)3Rr)GcH%Rh>xd{!GzoNr||tin>vbA4sL=AUraA_ecZPpHSr^ zlf8f+WskMrRSZY-)=-yRaN6L?}^NO_c|&5by>CG49#YHdi#~K zrt0M#kWz7e?2bxGG!mjWCkVStvcjP6rct?5maE*{NTpeqpQ>`8m-R;Z${_i^TuOGf8op*_Xr3m9XU>R7;k0blj!ShlR+>0C{7$U@ zV*h|pLKs#I&oDq8*p%N$h9kQFDNB=sCkt&JpJT`Q-zmc(9y+>9mb{D#%OJ`i{kSnY3AN}7<{AQ>7pQ#`V{x!3N z5jF_@Ooc-)i9Zcos9b1iOMvIuM-r1Qi20*1U9a`|vem!M$Bszxg%k92usgs`37ZPN znvdz$(BvwdUPuhUWY(~^SYPp~W`9lJ$-;3!LUXLGRa<=<7j6$((N=lasIg)eu2VIN zZM8)R>S_e@IJ6sX@~;uOe9);@w>*}DJdGFKi|GdUTq6pCv%E#H=>JxS1F`6O?S9yu%fV9Scd^B4jY zQlC9RJ&yco)#-rO2CZ%aG{3L#&W8o{)uoeD7v-(zuUh{qZkV8RzWTy^DW2i6QLch9 zZ233BnnbmSsn8ryvrJeZyVNNP&|efR*Y6$Vo^w>Azwi5S>*YXNpdMj6idRx-=fPF7 zhhDZ?+q;btDEbA??Ft{4iKrgi7E!o`q&{y8wH*Q4MgFTO_*_T{C42!o&5Oj*Zo>Kc zt5hS%`xP#-9v~Z7KxCOxqQQy;Z+m?#oLRi+7y*O1X zfry2HyWl934q2eFwa({}fA{ZwxSUP|W;~}AKRCM8@Ga^3w zRRE|_8+O{*S<9{6H}|@4-8Dn;24Y)gF$DY-fJE7w- zHM<$yRPfS@5c?PBg#6w}%~2wuP0e-D^sk`}QL2vpf`ek4Eb7U$$jqeTr-cYcvS+<4 zw;bQcfa&IK zd+q7XvyG#{M$P8KF#A3+SIDLLKr6gz>7dBj^)W>6VGuW)5le!P#%zX#^lGQ1*!plw zq|TmchIo!8l3SG}7!;JRz4`48xeE*}#G-SnN{m$zc7N|MZ8cNd_tVBkiGylMXhiIS%3e5n` zB#_QM!SN-4SK#0%DA;TGb_XIr=v$Jx%y9_wg(*9nW9-#UK^}7{0hIMB`hgdD-=zNm zl_{;M(x%>yqq~Ofy29$o=AAB5^U|1I3T6=ww?PpCg`96t1PL?B{G?Ej625gBf6BIO z;!4)12ltK3?OI7|Dzy}aF{K{-I zR?cAUNk-8!XXH{04dWemXTjZ~6W)Gl%ko*p=)}yvb_@SJ67?OBuS0$M#L9+*k3FS%>eT59X{iROEPwz(W}#q&0x|i+Q2WK!?c}N= z1_fm9ss0kFlo_Fr1i~fpT&e2H9bYI^JXin}De#O5Jd!fmgAGurA8#|HLdiS1_B?bM zB^UYiD?)UR)TNX@7VDtzmjkupr87f0CqFpI!&z}}r+q$p0J5!KQLgS9A=(|}YP1H< zT;`oU!h-;AVe@c^ud8Ip|+$il}po#6??=%)lCdSuIU99aF%)bbURj9QEL}QZm z*B#rxPO{zk&t&rIFnc^uv%Rk6e9y9B+!wo!KvA$ew4%gOevJHwI@VhVGx_{#_&rh$fhM%XWEB)DstnVvI|iA3ZfYcl`2 zB*e|guVf*^w^RrHw(VIRWv-Wkm@15n;ttbzh0Wzc$hnRZT^Y1oF&{ zIE8?g!4VXGP>l*d)vy6H!$o4=B85hx3T4)sMk!V36nZbXI>s-oJo<5?D%^2I^EwHt zJypczl#$yr(D3~B+${+gKg`v9Iz|=BJi=Fs{RCc1m3jRA#gcy*x^YN{0cagH(OU*{ zCXE37GF>(K;kdq*jSsxGfehKv40er;kcIETft%^*RoCtSmjlC{w;d~IALp%U0AiD; z<#6rltA44gB^hzVMqL)B%GK-FXO0&YoyMko?Y38L=SisWc`82q9KQ- zMV=op;`9nI9wk)f+fo$Y}yDrlVJ>U|d>MTZW}zl&22fUfHzuM~087f(u>CGxAI z+#J`lfLg9>o&wLoyl(j{-qR`ez<4j&?Kdav!^%I*P&(Tq~QjVq4q z>Jat5kt0PeNGns@TyUb}R2UQh00004%9rC15?<5O4Wtg1P7}FxP0xXs8C-P!`RLLuM z+AD#+U)aw-9GQ8t4wpAM>^O4smyH+E{P5C4c{*UqQO8&Iu|LO85}^)F;u%bracM|?d_`q16RwtytCw`t__27Uc-=G@$` ziNMu15-b?jZu6;`C%feZpNXvDKNCgVO%h;@oC(gFB;l%(qa#LY`Zy|_16<~^j@8r} zvmms3KN^>|YAzqBtn34I>ps1;)bG%?q6kd|rW79|(sShsy%G6#be=~tfjt*y4;h(2 zzR!InryGgEy#TIHS3(*pK6BEDhXB~VE?~mk46&?=5%d<3gjk6ni$f1dM^cU?A^FGP zzoY@aSAKXV-dUBh%oQ`K5967$&EybidTzApYc&qRD1A?PWeA|SM2peYR2j04$B(c? z^u1Z8D5|^%a+CM;Vahun2|cRqV1nK`5, + <&cpuapp_bellboard 0>; + }; + + cpusec_cpurad_ipc: ipc-1-3 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpusec_bellboard 18>, + <&cpurad_bellboard 0>; + }; + + cpuapp_cpurad_ipc: ipc-2-3 { + status = "disabled"; + mboxes = <&cpuapp_bellboard 18>, + <&cpurad_bellboard 12>; + }; + + cpuapp_cpuppr_ipc: ipc-2-13 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpuapp_bellboard 13>, + <&cpuppr_vevif 12>; + }; + }; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi new file mode 100644 index 00000000000..560700b1756 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + reserved-memory { + cpuapp_ram0x_region: memory@2f000000 { + compatible = "nordic,owned-memory"; + reg = <0x2f000000 DT_SIZE_K(260)>; + status = "disabled"; + perm-read; + perm-write; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f000000 0x41000>; + + cpusec_cpuapp_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpuapp_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + + cpuapp_data: memory@1000 { + reg = <0x1000 DT_SIZE_K(256)>; + }; + }; + + cpurad_ram0x_region: memory@2f041000 { + compatible = "nordic,owned-memory"; + reg = <0x2f041000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f041000 0x1000>; + + cpusec_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpusec_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + }; + + cpuapp_cpurad_ram0x_region: memory@2f0bf000 { + compatible = "nordic,owned-memory"; + reg = <0x2f0bf000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f0bf000 0x1000>; + + cpuapp_cpurad_ipc_shm: memory@0 { + reg = <0x0 DT_SIZE_K(2)>; + }; + + cpurad_cpuapp_ipc_shm: memory@800 { + reg = <0x800 DT_SIZE_K(2)>; + }; + }; + + shared_ram20_region: memory@2f88f000 { + compatible = "nordic,owned-memory"; + reg = <0x2f88f000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2f88f000 0x1000>; + + cpuapp_cpusys_ipc_shm: memory@ce0 { + reg = <0xce0 0x80>; + }; + + cpusys_cpuapp_ipc_shm: memory@d60 { + reg = <0xd60 0x80>; + }; + + cpurad_cpusys_ipc_shm: memory@e00 { + reg = <0xe00 0x80>; + }; + + cpusys_cpurad_ipc_shm: memory@e80 { + reg = <0xe80 0x80>; + }; + }; + + cpuppr_ram3x_region: memory@2fc00000 { + compatible = "nordic,owned-memory"; + reg = <0x2fc00000 DT_SIZE_K(28)>; + status = "disabled"; + perm-read; + perm-write; + perm-execute; + }; + + shared_ram3x_region: memory@2fc07000 { + compatible = "nordic,owned-memory"; + reg = <0x2fc07000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2fc07000 0x1000>; + + cpuapp_cpuppr_ipc_shm: memory@0 { + reg = <0x0 0x340>; + }; + + cpuppr_cpuapp_ipc_shm: memory@340 { + reg = <0x340 0x340>; + }; + + cpuapp_dma_region: memory@680 { + compatible = "zephyr,memory-region"; + reg = <0x680 DT_SIZE_K(2)>; + status = "disabled"; + #memory-region-cells = <0>; + zephyr,memory-region = "DMA_RAM3x_APP"; + }; + + cpurad_dma_region: memory@e80 { + compatible = "zephyr,memory-region"; + reg = <0xe80 0x80>; + status = "disabled"; + #memory-region-cells = <0>; + zephyr,memory-region = "DMA_RAM3x_RAD"; + }; + }; + }; +}; + +&mram1x { + cpurad_rx_partitions: cpurad-rx-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + perm-read; + perm-execute; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + + cpurad_slot0_partition: partition@66000 { + reg = <0x66000 DT_SIZE_K(256)>; + }; + }; + + cpuapp_rx_partitions: cpuapp-rx-partitions { + compatible = "nordic,owned-partitions", "fixed-partitions"; + status = "disabled"; + perm-read; + perm-execute; + perm-secure; + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_slot0_partition: partition@a6000 { + reg = <0xa6000 DT_SIZE_K(512)>; + }; + + cpuppr_code_partition: partition@126000 { + reg = <0x126000 DT_SIZE_K(64)>; + }; + }; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi new file mode 100644 index 00000000000..d3b79120322 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-pinctrl.dtsi @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + /omit-if-no-ref/ uart135_default: uart135_default { + group1 { + psels = , + ; + }; + + group2 { + bias-pull-up; + psels = , + ; + }; + }; + + /omit-if-no-ref/ uart135_sleep: uart135_sleep { + group1 { + low-power-enable; + psels = , + , + , + ; + }; + }; + + /omit-if-no-ref/ uart136_default: uart136_default { + group1 { + psels = , + ; + }; + + group2 { + bias-pull-up; + psels = , + ; + }; + }; + + /omit-if-no-ref/ uart136_sleep: uart136_sleep { + group1 { + low-power-enable; + psels = , + , + , + ; + }; + }; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts new file mode 100644 index 00000000000..b2db9e4b9b1 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" +#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" + +/delete-node/ &cpusec_cpurad_ipc; + +/ { + compatible = "nordic,nrf54h20pdk_nrf54h20-cpuapp"; + model = "Nordic nRF54H20 PDK nRF54H20 Application MCU"; + + chosen { + zephyr,console = &uart136; + zephyr,code-partition = &cpuapp_slot0_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpuapp_data; + }; + + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + }; + + buttons { + compatible = "gpio-keys"; + + button0: button_0 { + gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 0"; + zephyr,code = ; + }; + + button1: button_1 { + gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 1"; + zephyr,code = ; + }; + + button2: button_2 { + gpios = <&gpio0 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 2"; + zephyr,code = ; + }; + + button3: button_3 { + gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 3"; + zephyr,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + + led1: led_1 { + gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + + led2: led_2 { + gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + + led3: led_3 { + gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; +}; + +&cpuapp_ram0x_region { + status = "okay"; +}; + +&shared_ram3x_region { + status = "okay"; +}; + +&cpuapp_bellboard { + interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq0"; + /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ + nordic,interrupt-mapping = <0x00042001 0>; +}; + +&cpusec_cpuapp_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuapp_cpusec_ipc_shm>; + rx-region = <&cpusec_cpuapp_ipc_shm>; +}; + +&cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-initiator"; + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpurad_ipc_shm>; + rx-region = <&cpurad_cpuapp_ipc_shm>; +}; + +&cpuapp_cpuppr_ipc { + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpuppr_ipc_shm>; + rx-region = <&cpuppr_cpuapp_ipc_shm>; +}; + +&cpuapp_dma_region { + status = "okay"; +}; + +&cpuapp_rx_partitions { + status = "okay"; +}; + +&cpuppr_vpr { + execution-memory = <&cpuppr_code_partition>; +}; + +&gpiote130 { + status = "okay"; + owned-channels = <0 1 2 3 4 5 6 7>; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio9 { + status = "okay"; +}; + +&grtc { + status = "okay"; + child-owned-channels = <5 6>; + nonsecure-channels = <5 6>; + owned-channels = <4 5 6>; +}; + +&uart135 { + current-speed = <115200>; + pinctrl-0 = <&uart135_default>; + pinctrl-1 = <&uart135_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart136 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + current-speed = <115200>; + pinctrl-0 = <&uart136_default>; + pinctrl-1 = <&uart136_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml new file mode 100644 index 00000000000..a364c2863d3 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20pdk_nrf54h20_cpuapp +name: nRF54H20-PDK-nRF54H20-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 32 +flash: 368 +supported: + - gpio diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig new file mode 100644 index 00000000000..1f7ef38a7fc --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp_defconfig @@ -0,0 +1,33 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_ENGA_CPUAPP=y +CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUAPP=y + +CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts new file mode 100644 index 00000000000..8d2629df62e --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" +#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" + +/delete-node/ &cpuapp_cpuppr_ipc; +/delete-node/ &cpusec_cpuapp_ipc; + +/ { + compatible = "nordic,nrf54h20pdk_nrf54h20-cpurad"; + model = "Nordic nRF54H20 PDK nRF54H20 Radio MCU"; + + chosen { + zephyr,console = &uart135; + zephyr,code-partition = &cpurad_slot0_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpurad_ram0; + }; +}; + +&shared_ram3x_region { + status = "okay"; +}; + +&cpurad_bellboard { + interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq0"; + /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ + nordic,interrupt-mapping = <0x00001001 0>; +}; + +&cpusec_cpurad_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpusec_ipc_shm>; + rx-region = <&cpusec_cpurad_ipc_shm>; +}; + +&cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-follower"; + mbox-names = "tx", "rx"; + tx-region = <&cpurad_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpurad_ipc_shm>; +}; + +&cpurad_dma_region { + status = "okay"; +}; + +&cpurad_rx_partitions { + status = "okay"; +}; + +&grtc { + status = "okay"; + child-owned-channels = <8 9 10 11 12>; + interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, + <108 NRF_DEFAULT_IRQ_PRIORITY>; + nonsecure-channels = <8 9 10 11 12>; + owned-channels = <7 8 9 10 11 12 13 14>; +}; + +&uart135 { + status = "okay"; + memory-regions = <&cpurad_dma_region>; + current-speed = <115200>; + pinctrl-0 = <&uart135_default>; + pinctrl-1 = <&uart135_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart136 { + current-speed = <115200>; + pinctrl-0 = <&uart136_default>; + pinctrl-1 = <&uart136_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml new file mode 100644 index 00000000000..d1c8548d07d --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20pdk_nrf54h20_cpurad +name: nRF54H20-PDK-nRF54H20-Radio +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 32 +flash: 368 +supported: + - gpio diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig new file mode 100644 index 00000000000..254d8656e61 --- /dev/null +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad_defconfig @@ -0,0 +1,30 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_ENGA_CPURAD=y +CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPURAD=y + +CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board new file mode 100644 index 00000000000..9bbbba60dd4 --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.board @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF54H20PDK_NRF54H20_CPUPPR + bool "nRF54H20 PDK nRF54H20 PPR MCU" + depends on SOC_NRF54H20_ENGA_CPUPPR diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig new file mode 100644 index 00000000000..256976d6519 --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/Kconfig.defconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD + default "nrf54h20pdk_nrf54h20_cpuppr" + depends on BOARD_NRF54H20PDK_NRF54H20_CPUPPR diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake b/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake new file mode 100644 index 00000000000..4c63f1dd05e --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/board.cmake @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: Apache-2.0 + +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts new file mode 100644 index 00000000000..f98abb9e44b --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54h20pdk_nrf54h20-memory_map.dtsi" +#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" +#include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" + +/delete-node/ &cpuapp_cpurad_ipc; +/delete-node/ &cpusec_cpuapp_ipc; +/delete-node/ &cpusec_cpurad_ipc; + +/ { + compatible = "nordic,nrf54h20pdk_nrf54h20-cpuppr"; + model = "Nordic nRF54H20 PDK nRF54H20 Peripheral Processor MCU"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart135; + zephyr,code-partition = &cpuppr_code_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpuppr_ram3x_region; + }; +}; + +&cpuapp_cpuppr_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuppr_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpuppr_ipc_shm>; +}; + +&grtc { + status = "okay"; + owned-channels = <5>; +}; + +&uart135 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart135_default>; + pinctrl-1 = <&uart135_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart136 { + current-speed = <115200>; + pinctrl-0 = <&uart136_default>; + pinctrl-1 = <&uart136_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml new file mode 100644 index 00000000000..274be865c36 --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20pdk_nrf54h20_cpuppr +name: nRF54H20-PDK-nRF54H20-PPR +type: mcu +arch: riscv +toolchain: + - zephyr +ram: 28 +flash: 28 +supported: + - gpio diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig new file mode 100644 index 00000000000..112140693ef --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr_defconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF54HX=y +CONFIG_SOC_NRF54H20=y +CONFIG_SOC_NRF54H20_ENGA_CPUPPR=y +CONFIG_BOARD_NRF54H20PDK_NRF54H20_CPUPPR=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_SERIAL=y + +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake b/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake new file mode 100644 index 00000000000..5e0fecebdc8 --- /dev/null +++ b/boards/riscv/nrf54h20pdk_nrf54h20/pre_dt_board.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Allow common DTS files to be included from the other board directory. +# To be removed after HWMv2 (#51831), once both directories can be merged into one. +string(REGEX REPLACE "/riscv/(.*$)" "/arm/\\1" BOARD_DIR_ARM "${BOARD_DIR}") +list(APPEND DTS_EXTRA_CPPFLAGS -isystem "${BOARD_DIR_ARM}") From c2f956a18e44815f5ae693143e0f2a19013a71ae Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:25 +0200 Subject: [PATCH 1673/2300] Revert "[nrf fromlist] tests: Replace nRF54H20 PDK with nRF54H20 DK" This reverts commit b933325a93ce4d27b49a9554bb2095bc913514e2. Signed-off-by: Gerard Marull-Paretas --- ...h20_cpuapp.overlay => nrf54h20pdk_nrf54h20_cpuapp.overlay} | 0 tests/lib/cpp/cxx/testcase.yaml | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/arch/common/ramfunc/boards/{nrf54h20dk_nrf54h20_cpuapp.overlay => nrf54h20pdk_nrf54h20_cpuapp.overlay} (100%) diff --git a/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay similarity index 100% rename from tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay diff --git a/tests/lib/cpp/cxx/testcase.yaml b/tests/lib/cpp/cxx/testcase.yaml index 04e5cd2bf21..f06b451742b 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -37,8 +37,8 @@ tests: # Exclude nRF54L15 and nRF54H20 as Nordic HAL is not compatible with C++98. platform_exclude: - nrf54l15pdk_nrf54l15_cpuapp - - nrf54h20dk_nrf54h20_cpuapp - - nrf54h20dk_nrf54h20_cpurad + - nrf54h20pdk_nrf54h20_cpuapp + - nrf54h20pdk_nrf54h20_cpurad build_only: true extra_configs: - CONFIG_STD_CPP98=y From 9534117ef8dfa404a5637aae036ce6c72cf1512d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:25 +0200 Subject: [PATCH 1674/2300] Revert "[nrf fromtree] tests: arch: common: ramfunc: add nrf54h20pdk cpuapp overlays" This reverts commit afe06d25554dd31a0c0054ee635e61ddb2e2b640. Signed-off-by: Gerard Marull-Paretas --- .../ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay diff --git a/tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay b/tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 2deb6756009..00000000000 --- a/tests/arch/common/ramfunc/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&cpuapp_ram0x_region { - perm-execute; -}; From 4189175b688a3ef213700f8a6f6cb61d83b49cb9 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:26 +0200 Subject: [PATCH 1675/2300] Revert "[nrf fromlist] snippets: Replace nRF54H20 PDK with nRF54H20 DK" This reverts commit fb3be114abc636b794ab624f01bf4dbdd6e51bca. Signed-off-by: Gerard Marull-Paretas --- ...h20_cpuapp.overlay => nrf54h20pdk_nrf54h20_cpuapp.overlay} | 4 ++-- snippets/nordic-ppr-ram/nordic-ppr-ram.overlay | 2 +- snippets/nordic-ppr-ram/snippet.yml | 4 ++-- ...h20_cpuapp.overlay => nrf54h20pdk_nrf54h20_cpuapp.overlay} | 0 snippets/nordic-ppr/snippet.yml | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) rename snippets/nordic-ppr-ram/boards/{nrf54h20dk_nrf54h20_cpuapp.overlay => nrf54h20pdk_nrf54h20_cpuapp.overlay} (71%) rename snippets/nordic-ppr/boards/{nrf54h20dk_nrf54h20_cpuapp.overlay => nrf54h20pdk_nrf54h20_cpuapp.overlay} (100%) diff --git a/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay similarity index 71% rename from snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay index ea866358fc0..5597c886b85 100644 --- a/snippets/nordic-ppr-ram/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/snippets/nordic-ppr-ram/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay @@ -3,12 +3,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -&cpuppr_code_data { +&cpuppr_ram3x_region { status = "okay"; }; &cpuppr_vpr { - execution-memory = <&cpuppr_code_data>; + execution-memory = <&cpuppr_ram3x_region>; }; &uart135 { diff --git a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay index 71c45c1b9f4..e69c3a0d2bf 100644 --- a/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay +++ b/snippets/nordic-ppr-ram/nordic-ppr-ram.overlay @@ -11,5 +11,5 @@ /* code partition size must match RAM size */ &cpuppr_code_partition { - reg = <0x126000 DT_SIZE_K(62)>; + reg = <0x126000 DT_SIZE_K(28)>; }; diff --git a/snippets/nordic-ppr-ram/snippet.yml b/snippets/nordic-ppr-ram/snippet.yml index 022ed8d38e8..0d6039af2e5 100644 --- a/snippets/nordic-ppr-ram/snippet.yml +++ b/snippets/nordic-ppr-ram/snippet.yml @@ -3,6 +3,6 @@ append: EXTRA_DTC_OVERLAY_FILE: nordic-ppr-ram.overlay boards: - nrf54h20dk_nrf54h20_cpuapp: + nrf54h20pdk_nrf54h20_cpuapp: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20pdk_nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-ppr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay similarity index 100% rename from snippets/nordic-ppr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to snippets/nordic-ppr/boards/nrf54h20pdk_nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-ppr/snippet.yml b/snippets/nordic-ppr/snippet.yml index d9b37963c3a..9e1f20bb757 100644 --- a/snippets/nordic-ppr/snippet.yml +++ b/snippets/nordic-ppr/snippet.yml @@ -3,6 +3,6 @@ append: EXTRA_DTC_OVERLAY_FILE: nordic-ppr.overlay boards: - nrf54h20dk_nrf54h20_cpuapp: + nrf54h20pdk_nrf54h20_cpuapp: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20pdk_nrf54h20_cpuapp.overlay From 423b85d3d3873182a94878ede3573cf0073e29e3 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:26 +0200 Subject: [PATCH 1676/2300] Revert "[nrf fromlist] samples: Replace nRF54H20 PDK with nRF54H20 DK" This reverts commit 7ead64ecf47a4ae42b29aef31182365d0d4a03a1. Signed-off-by: Gerard Marull-Paretas --- samples/drivers/mbox/CMakeLists.txt | 2 +- samples/drivers/mbox/Kconfig.sysbuild | 2 +- ...rf54h20pdk_nrf54h20_cpuapp_bellboard.conf} | 0 ...4h20pdk_nrf54h20_cpuapp_bellboard.overlay} | 0 ...=> nrf54h20pdk_nrf54h20_cpuapp_vevif.conf} | 0 ...nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay} | 0 samples/drivers/mbox/remote/CMakeLists.txt | 2 +- ...rf54h20pdk_nrf54h20_cpuppr_bellboard.conf} | 0 ...4h20pdk_nrf54h20_cpuppr_bellboard.overlay} | 0 ...=> nrf54h20pdk_nrf54h20_cpuppr_vevif.conf} | 0 ...nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay} | 0 samples/drivers/mbox/sample.yaml | 24 +++++++++---------- 12 files changed, 15 insertions(+), 15 deletions(-) rename samples/drivers/mbox/boards/{nrf54h20dk_nrf54h20_cpuapp_bellboard.conf => nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf} (100%) rename samples/drivers/mbox/boards/{nrf54h20dk_nrf54h20_cpuapp_bellboard.overlay => nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay} (100%) rename samples/drivers/mbox/boards/{nrf54h20dk_nrf54h20_cpuapp_vevif.conf => nrf54h20pdk_nrf54h20_cpuapp_vevif.conf} (100%) rename samples/drivers/mbox/boards/{nrf54h20dk_nrf54h20_cpuapp_vevif.overlay => nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay} (100%) rename samples/drivers/mbox/remote/boards/{nrf54h20dk_nrf54h20_cpuppr_bellboard.conf => nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf} (100%) rename samples/drivers/mbox/remote/boards/{nrf54h20dk_nrf54h20_cpuppr_bellboard.overlay => nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay} (100%) rename samples/drivers/mbox/remote/boards/{nrf54h20dk_nrf54h20_cpuppr_vevif.conf => nrf54h20pdk_nrf54h20_cpuppr_vevif.conf} (100%) rename samples/drivers/mbox/remote/boards/{nrf54h20dk_nrf54h20_cpuppr_vevif.overlay => nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay} (100%) diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index 5c21619a8cf..c69621c2496 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -18,7 +18,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0") OR - ("${BOARD}" STREQUAL "nrf54h20dk_nrf54h20_cpuapp")) + ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuapp")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index 0899d958bdb..aca48b8ead3 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -14,4 +14,4 @@ string default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" - default "nrf54h20dk_nrf54h20_cpuppr" if $(BOARD) = "nrf54h20dk_nrf54h20_cpuapp" + default "nrf54h20pdk_nrf54h20_cpuppr" if $(BOARD) = "nrf54h20pdk_nrf54h20_cpuapp" diff --git a/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.conf rename to samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf diff --git a/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.overlay rename to samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay diff --git a/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_vevif.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_vevif.conf rename to samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf diff --git a/samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_vevif.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay similarity index 100% rename from samples/drivers/mbox/boards/nrf54h20dk_nrf54h20_cpuapp_vevif.overlay rename to samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index 9ae8d377685..cb024cb6112 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -16,7 +16,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1") OR ("${BOARD}" STREQUAL "adp_xc7k_ae350") OR - ("${BOARD}" STREQUAL "nrf54h20dk_nrf54h20_cpuppr")) + ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuppr")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.conf rename to samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf diff --git a/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.overlay rename to samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay diff --git a/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_vevif.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_vevif.conf rename to samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf diff --git a/samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_vevif.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay similarity index 100% rename from samples/drivers/mbox/remote/boards/nrf54h20dk_nrf54h20_cpuppr_vevif.overlay rename to samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 19b6322d9bf..b386b9d2b4b 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -26,15 +26,15 @@ tests: sample.drivers.mbox.nrf54h20_vevif: platform_allow: - - nrf54h20dk_nrf54h20_cpuapp + - nrf54h20pdk_nrf54h20_cpuapp integration_platforms: - - nrf54h20dk_nrf54h20_cpuapp + - nrf54h20pdk_nrf54h20_cpuapp extra_args: mbox_SNIPPET=nordic-ppr - mbox_EXTRA_CONF_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_vevif.conf - mbox_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_vevif.overlay - remote_EXTRA_CONF_FILE=boards/nrf54h20dk_nrf54h20_cpuppr_vevif.conf - remote_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuppr_vevif.overlay + mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf + mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay + remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf + remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay sysbuild: true harness: console harness_config: @@ -46,15 +46,15 @@ tests: sample.drivers.mbox.nrf54h20_bellboard: platform_allow: - - nrf54h20dk_nrf54h20_cpuapp + - nrf54h20pdk_nrf54h20_cpuapp integration_platforms: - - nrf54h20dk_nrf54h20_cpuapp + - nrf54h20pdk_nrf54h20_cpuapp extra_args: mbox_SNIPPET=nordic-ppr - mbox_EXTRA_CONF_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.conf - mbox_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuapp_bellboard.overlay - remote_EXTRA_CONF_FILE=boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.conf - remote_DTC_OVERLAY_FILE=boards/nrf54h20dk_nrf54h20_cpuppr_bellboard.overlay + mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf + mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay + remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf + remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay sysbuild: true harness: console harness_config: From 161b554e83b2363712c13529ec98e21ef93cd715 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:26 +0200 Subject: [PATCH 1677/2300] Revert "[nrf fromlist] boards: nordic: Add support for nRF54H20 DK" This reverts commit 831cf634c93216a742c61a7ef0b5a023a4001b59. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54h20dk_nrf54h20/Kconfig.board | 10 - .../arm/nrf54h20dk_nrf54h20/Kconfig.defconfig | 6 - boards/arm/nrf54h20dk_nrf54h20/board.cmake | 13 -- boards/arm/nrf54h20dk_nrf54h20/doc/index.rst | 154 --------------- .../nrf54h20dk_nrf54h20-ipc_conf.dtsi | 36 ---- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 184 ------------------ .../nrf54h20dk_nrf54h20-pinctrl.dtsi | 53 ----- .../nrf54h20dk_nrf54h20_cpuapp.dts | 171 ---------------- .../nrf54h20dk_nrf54h20_cpuapp.yaml | 15 -- .../nrf54h20dk_nrf54h20_cpuapp_defconfig | 33 ---- .../nrf54h20dk_nrf54h20_cpurad.dts | 84 -------- .../nrf54h20dk_nrf54h20_cpurad.yaml | 15 -- .../nrf54h20dk_nrf54h20_cpurad_defconfig | 30 --- .../support/nrf54h20_cpurad.JLinkScript | 4 - .../riscv/nrf54h20dk_nrf54h20/Kconfig.board | 10 - .../nrf54h20dk_nrf54h20/Kconfig.defconfig | 6 - .../nrf54h20dk_nrf54h20_cpuppr.dts | 56 ------ .../nrf54h20dk_nrf54h20_cpuppr.yaml | 13 -- .../nrf54h20dk_nrf54h20_cpuppr_defconfig | 14 -- .../nrf54h20dk_nrf54h20_cpuppr_ram.dts | 11 -- .../nrf54h20dk_nrf54h20_cpuppr_ram.yaml | 13 -- .../nrf54h20dk_nrf54h20_cpuppr_ram_defconfig | 16 -- .../nrf54h20dk_nrf54h20/pre_dt_board.cmake | 7 - 23 files changed, 954 deletions(-) delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/Kconfig.board delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/board.cmake delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/doc/index.rst delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.yaml delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp_defconfig delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.yaml delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad_defconfig delete mode 100644 boards/arm/nrf54h20dk_nrf54h20/support/nrf54h20_cpurad.JLinkScript delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/Kconfig.board delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/Kconfig.defconfig delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig delete mode 100644 boards/riscv/nrf54h20dk_nrf54h20/pre_dt_board.cmake diff --git a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.board b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.board deleted file mode 100644 index 831ddc009c2..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.board +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_NRF54H20DK_NRF54H20_CPUAPP - bool "nRF54H20 DK nRF54H20 Application MCU" - depends on SOC_NRF54H20_CPUAPP - -config BOARD_NRF54H20DK_NRF54H20_CPURAD - bool "nRF54H20 DK nRF54H20 Radio MCU" - depends on SOC_NRF54H20_CPURAD diff --git a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig b/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig deleted file mode 100644 index 1a029338775..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/Kconfig.defconfig +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD - default "nrf54h20dk_nrf54h20_cpuapp" if BOARD_NRF54H20DK_NRF54H20_CPUAPP - default "nrf54h20dk_nrf54h20_cpurad" if BOARD_NRF54H20DK_NRF54H20_CPURAD diff --git a/boards/arm/nrf54h20dk_nrf54h20/board.cmake b/boards/arm/nrf54h20dk_nrf54h20/board.cmake deleted file mode 100644 index 32d1daac179..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/board.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP OR CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) - if(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD) - set( - JLINK_TOOL_OPT - "-jlinkscriptfile ${CMAKE_CURRENT_LIST_DIR}/support/nrf54h20_cpurad.JLinkScript" - ) - endif() - - board_runner_args(jlink "--device=CORTEX-M33" "--speed=4000" "--tool-opt=${JLINK_TOOL_OPT}") - include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) -endif() diff --git a/boards/arm/nrf54h20dk_nrf54h20/doc/index.rst b/boards/arm/nrf54h20dk_nrf54h20/doc/index.rst deleted file mode 100644 index 6b8a08f0953..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/doc/index.rst +++ /dev/null @@ -1,154 +0,0 @@ -.. _nrf54h20dk_nrf54h20: - -nRF54H20 DK -########### - -Overview -******** - -.. note:: - - All software for the nRF54H20 SoC is experimental and hardware availability - is restricted to the participants in the limited sampling program. - -The nRF54H20 DK is a single-board development kit for evaluation and development -on the Nordic nRF54H20 System-on-Chip (SoC). - -The nRF54H20 is a multicore SoC with: - -* an Arm Cortex-M33 core with DSP instructions, FPU, and Armv8-M Security - Extensions, running at up to 320 MHz, referred to as the **application core** -* an Arm Cortex-M33 core with DSP instructions, FPU, and Armv8-M Security - Extensions, running at up to 256 MHz, referred to as the **radio core**. - -The ``nrf54h20dk/nrf54h20/cpuapp`` build target provides support for -the application core on the nRF54H20 SoC. -The ``nrf54h20dk/nrf54h20/cpurad`` build target provides support for -the radio core on the nRF54H20 SoC. - -nRF54H20 SoC provides support for the following devices: - -* :abbr:`ADC (Analog to Digital Converter)` -* CLOCK -* :abbr:`GPIO (General Purpose Input Output)` -* :abbr:`GRTC (Global real-time counter)` -* :abbr:`I2C (Inter-Integrated Circuit)` -* MRAM -* :abbr:`PWM (Pulse Width Modulation)` -* RADIO (Bluetooth Low Energy and 802.15.4) -* :abbr:`SPI (Serial Peripheral Interface)` -* :abbr:`UART (Universal asynchronous receiver-transmitter)` -* :abbr:`USB (Universal Serial Bus)` -* :abbr:`WDT (Watchdog Timer)` - -Hardware -******** - -nRF54H20 DK has two crystal oscillators: - -* High-frequency 32 MHz crystal oscillator (HFXO) -* Low-frequency 32.768 kHz crystal oscillator (LFXO) - -Supported Features -================== - -The ``nrf54h20dk/nrf54h20/cpuapp`` board configuration supports the following -hardware features: - -+-----------+------------+----------------------+ -| Interface | Controller | Driver/Component | -+===========+============+======================+ -| GPIO | on-chip | gpio | -+-----------+------------+----------------------+ -| GRTC | on-chip | system clock | -+-----------+------------+----------------------+ -| I2C(M) | on-chip | i2c | -+-----------+------------+----------------------+ -| SPI(M/S) | on-chip | spi | -+-----------+------------+----------------------+ -| UART | on-chip | serial | -+-----------+------------+----------------------+ -| WDT | on-chip | watchdog | -+-----------+------------+----------------------+ - -The ``nrf54h20dk/nrf54h20/cpurad`` board configuration supports the following -hardware features: - -+-----------+------------+----------------------+ -| Interface | Controller | Driver/Component | -+===========+============+======================+ -| GPIO | on-chip | gpio | -+-----------+------------+----------------------+ -| GRTC | on-chip | system clock | -+-----------+------------+----------------------+ -| I2C(M) | on-chip | i2c | -+-----------+------------+----------------------+ -| SPI(M/S) | on-chip | spi | -+-----------+------------+----------------------+ -| UART | on-chip | serial | -+-----------+------------+----------------------+ -| WDT | on-chip | watchdog | -+-----------+------------+----------------------+ - -Other hardware features have not been enabled yet for this board. - -Connections and IOs -=================== - -LEDs ----- - -* LED1 (green) = P9.0 -* LED2 (green) = P9.1 -* LED3 (green) = P9.2 -* LED4 (green) = P9.3 - -Push buttons ------------- - -* BUTTON1 = P0.8 -* BUTTON2 = P0.9 -* BUTTON3 = P0.10 -* BUTTON4 = P0.11 -* RESET (SW1) - -Programming and Debugging -************************* - -Applications for both the ``nrf54h20dk/nrf54h20/cpuapp`` and -``nrf54h20dk/nrf54h20/cpurad`` targets 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 -======== - -As an example, this section shows how to build and flash the :ref:`hello_world` -application. - -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`. - -To build and program the sample to the nRF54H20 DK, complete the following steps: - -1. Connect the nRF54H20 DK to your computer using the IMCU USB port on the DK. -#. Build the sample by running the following command: - - .. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: nrf54h20dk/nrf54h20/cpuapp - :goals: build flash - -Testing the LEDs and buttons in the nRF54H20 DK -*********************************************** - -There are 2 samples that allow you to test that the buttons (switches) and LEDs -on the board are working properly with Zephyr: - -* :zephyr:code-sample:`blinky` -* :zephyr:code-sample:`button` - -You can build and flash the examples to make sure Zephyr is running correctly on -your board. The button and LED definitions can be found in -:zephyr_file:`boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts`. diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi deleted file mode 100644 index 9c3d971b9bc..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - ipc { - cpusec_cpuapp_ipc: ipc-1-2 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpusec_bellboard 12>, - <&cpuapp_bellboard 0>; - }; - - cpusec_cpurad_ipc: ipc-1-3 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpusec_bellboard 18>, - <&cpurad_bellboard 0>; - }; - - cpuapp_cpurad_ipc: ipc-2-3 { - status = "disabled"; - mboxes = <&cpuapp_bellboard 18>, - <&cpurad_bellboard 12>; - }; - - cpuapp_cpuppr_ipc: ipc-2-13 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpuapp_bellboard 13>, - <&cpuppr_vevif 12>; - }; - }; -}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi deleted file mode 100644 index 6b6402eb90f..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-memory_map.dtsi +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - reserved-memory { - cpuapp_ram0x_region: memory@2f000000 { - compatible = "nordic,owned-memory"; - reg = <0x2f000000 DT_SIZE_K(260)>; - status = "disabled"; - perm-read; - perm-write; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f000000 0x41000>; - - cpusec_cpuapp_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpuapp_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - - cpuapp_data: memory@1000 { - reg = <0x1000 DT_SIZE_K(256)>; - }; - }; - - cpurad_ram0x_region: memory@2f041000 { - compatible = "nordic,owned-memory"; - reg = <0x2f041000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f041000 0x1000>; - - cpusec_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpurad_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - }; - - cpuapp_cpurad_ram0x_region: memory@2f0bf000 { - compatible = "nordic,owned-memory"; - reg = <0x2f0bf000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f0bf000 0x1000>; - - cpuapp_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpurad_cpuapp_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - }; - - shared_ram20_region: memory@2f88f000 { - compatible = "nordic,owned-memory"; - reg = <0x2f88f000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f88f000 0x1000>; - - cpuapp_cpusys_ipc_shm: memory@ce0 { - reg = <0xce0 0x80>; - }; - - cpusys_cpuapp_ipc_shm: memory@d60 { - reg = <0xd60 0x80>; - }; - - cpurad_cpusys_ipc_shm: memory@e00 { - reg = <0xe00 0x80>; - }; - - cpusys_cpurad_ipc_shm: memory@e80 { - reg = <0xe80 0x80>; - }; - }; - - cpuppr_ram3x_region: memory@2fc00000 { - compatible = "nordic,owned-memory"; - reg = <0x2fc00000 DT_SIZE_K(64)>; - status = "disabled"; - perm-read; - perm-write; - perm-execute; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2fc00000 0x10000>; - - cpuppr_code_data: memory@0 { - reg = <0x0 DT_SIZE_K(62)>; - }; - - cpuapp_cpuppr_ipc_shm: memory@f800 { - reg = <0xf800 DT_SIZE_K(1)>; - }; - - cpuppr_cpuapp_ipc_shm: memory@fc00 { - reg = <0xfc00 DT_SIZE_K(1)>; - }; - }; - - 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(4)>; - status = "disabled"; - #memory-region-cells = <0>; - zephyr,memory-region = "DMA_RAM3x_APP"; - }; - - cpurad_dma_region: memory@1e80 { - compatible = "zephyr,memory-region"; - reg = <0x1e80 0x80>; - status = "disabled"; - #memory-region-cells = <0>; - zephyr,memory-region = "DMA_RAM3x_RAD"; - }; - }; - }; -}; - -&mram1x { - cpurad_rx_partitions: cpurad-rx-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - perm-read; - perm-execute; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - - cpurad_slot0_partition: partition@66000 { - reg = <0x66000 DT_SIZE_K(256)>; - }; - }; - - cpuapp_rx_partitions: cpuapp-rx-partitions { - compatible = "nordic,owned-partitions", "fixed-partitions"; - status = "disabled"; - perm-read; - perm-execute; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_slot0_partition: partition@a6000 { - reg = <0xa6000 DT_SIZE_K(512)>; - }; - - cpuppr_code_partition: partition@126000 { - reg = <0x126000 DT_SIZE_K(64)>; - }; - }; -}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi deleted file mode 100644 index 6c6da3fa747..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - /omit-if-no-ref/ uart135_default: uart135_default { - group1 { - psels = , - ; - }; - - group2 { - bias-pull-up; - psels = , - ; - }; - }; - - /omit-if-no-ref/ uart135_sleep: uart135_sleep { - group1 { - low-power-enable; - psels = , - , - , - ; - }; - }; - - /omit-if-no-ref/ uart136_default: uart136_default { - group1 { - psels = , - ; - }; - - group2 { - bias-pull-up; - psels = , - ; - }; - }; - - /omit-if-no-ref/ uart136_sleep: uart136_sleep { - group1 { - low-power-enable; - psels = , - , - , - ; - }; - }; -}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts deleted file mode 100644 index 3873fec457e..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.dts +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include "nrf54h20dk_nrf54h20-memory_map.dtsi" -#include "nrf54h20dk_nrf54h20-ipc_conf.dtsi" -#include "nrf54h20dk_nrf54h20-pinctrl.dtsi" - -/delete-node/ &cpusec_cpurad_ipc; - -/ { - compatible = "nordic,nrf54h20dk_nrf54h20-cpuapp"; - model = "Nordic nRF54H20 DK nRF54H20 Application MCU"; - - chosen { - zephyr,console = &uart136; - zephyr,code-partition = &cpuapp_slot0_partition; - zephyr,flash = &mram1x; - zephyr,sram = &cpuapp_data; - }; - - aliases { - led0 = &led0; - led1 = &led1; - led2 = &led2; - led3 = &led3; - sw0 = &button0; - sw1 = &button1; - sw2 = &button2; - sw3 = &button3; - }; - - buttons { - compatible = "gpio-keys"; - - button0: button_0 { - gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 0"; - zephyr,code = ; - }; - - button1: button_1 { - gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - zephyr,code = ; - }; - - button2: button_2 { - gpios = <&gpio0 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - zephyr,code = ; - }; - - button3: button_3 { - gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 3"; - zephyr,code = ; - }; - }; - - leds { - compatible = "gpio-leds"; - - led0: led_0 { - gpios = <&gpio9 0 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - - led1: led_1 { - gpios = <&gpio9 1 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - - led2: led_2 { - gpios = <&gpio9 2 GPIO_ACTIVE_HIGH>; - label = "Green LED 2"; - }; - - led3: led_3 { - gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>; - label = "Green LED 3"; - }; - }; -}; - -&cpuapp_ram0x_region { - status = "okay"; -}; - -&shared_ram3x_region { - status = "okay"; -}; - -&cpuapp_bellboard { - interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; - interrupt-names = "irq0"; - /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ - nordic,interrupt-mapping = <0x00042001 0>; -}; - -&cpusec_cpuapp_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpuapp_cpusec_ipc_shm>; - rx-region = <&cpusec_cpuapp_ipc_shm>; -}; - -&cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-initiator"; - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpurad_ipc_shm>; - rx-region = <&cpurad_cpuapp_ipc_shm>; -}; - -&cpuapp_cpuppr_ipc { - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpuppr_ipc_shm>; - rx-region = <&cpuppr_cpuapp_ipc_shm>; -}; - -&cpuapp_dma_region { - status = "okay"; -}; - -&cpuapp_rx_partitions { - status = "okay"; -}; - -&cpuppr_vpr { - execution-memory = <&cpuppr_code_partition>; -}; - -&gpiote130 { - status = "okay"; - owned-channels = <0 1 2 3 4 5 6 7>; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio9 { - status = "okay"; -}; - -&grtc { - status = "okay"; - child-owned-channels = <5 6>; - nonsecure-channels = <5 6>; - owned-channels = <4 5 6>; -}; - -&uart135 { - current-speed = <115200>; - pinctrl-0 = <&uart135_default>; - pinctrl-1 = <&uart135_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart136 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - current-speed = <115200>; - pinctrl-0 = <&uart136_default>; - pinctrl-1 = <&uart136_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.yaml deleted file mode 100644 index ec2437ef84c..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk_nrf54h20_cpuapp -name: nRF54H20-DK-nRF54H20-Application -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 256 -flash: 512 -supported: - - gpio diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp_defconfig b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp_defconfig deleted file mode 100644 index d83fabfcfa0..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuapp_defconfig +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_CPUAPP=y -CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP=y - -CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# Enable GPIO -CONFIG_GPIO=y - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts deleted file mode 100644 index 1998f4fc131..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.dts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include "nrf54h20dk_nrf54h20-memory_map.dtsi" -#include "nrf54h20dk_nrf54h20-ipc_conf.dtsi" -#include "nrf54h20dk_nrf54h20-pinctrl.dtsi" - -/delete-node/ &cpuapp_cpuppr_ipc; -/delete-node/ &cpusec_cpuapp_ipc; - -/ { - compatible = "nordic,nrf54h20dk_nrf54h20-cpurad"; - model = "Nordic nRF54H20 DK nRF54H20 Radio MCU"; - - chosen { - zephyr,console = &uart135; - zephyr,code-partition = &cpurad_slot0_partition; - zephyr,flash = &mram1x; - zephyr,sram = &cpurad_ram0; - }; -}; - -&shared_ram3x_region { - status = "okay"; -}; - -&cpurad_bellboard { - interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; - interrupt-names = "irq0"; - /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ - nordic,interrupt-mapping = <0x00001001 0>; -}; - -&cpusec_cpurad_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpusec_ipc_shm>; - rx-region = <&cpusec_cpurad_ipc_shm>; -}; - -&cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-follower"; - mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpuapp_ipc_shm>; - rx-region = <&cpuapp_cpurad_ipc_shm>; -}; - -&cpurad_dma_region { - status = "okay"; -}; - -&cpurad_rx_partitions { - status = "okay"; -}; - -&grtc { - status = "okay"; - child-owned-channels = <8 9 10 11 12>; - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, - <108 NRF_DEFAULT_IRQ_PRIORITY>; - nonsecure-channels = <8 9 10 11 12>; - owned-channels = <7 8 9 10 11 12 13 14>; -}; - -&uart135 { - status = "okay"; - memory-regions = <&cpurad_dma_region>; - current-speed = <115200>; - pinctrl-0 = <&uart135_default>; - pinctrl-1 = <&uart135_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart136 { - current-speed = <115200>; - pinctrl-0 = <&uart136_default>; - pinctrl-1 = <&uart136_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.yaml deleted file mode 100644 index 80bd2a60ec0..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk_nrf54h20_cpurad -name: nRF54H20-DK-nRF54H20-Radio -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 192 -flash: 256 -supported: - - gpio diff --git a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad_defconfig b/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad_defconfig deleted file mode 100644 index 4d87fe6bc0e..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpurad_defconfig +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_CPURAD=y -CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD=y - -CONFIG_USE_DT_CODE_PARTITION=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) region is unmapped for this target. -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable cache -CONFIG_CACHE_MANAGEMENT=y -CONFIG_EXTERNAL_CACHE=y - -# Enable UART driver -CONFIG_SERIAL=y - -# Enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf54h20dk_nrf54h20/support/nrf54h20_cpurad.JLinkScript b/boards/arm/nrf54h20dk_nrf54h20/support/nrf54h20_cpurad.JLinkScript deleted file mode 100644 index 2fb7e32302e..00000000000 --- a/boards/arm/nrf54h20dk_nrf54h20/support/nrf54h20_cpurad.JLinkScript +++ /dev/null @@ -1,4 +0,0 @@ -void ConfigTargetSettings(void) { - JLINK_ExecCommand("CORESIGHT_AddAP = Index=1 Type=AHB-AP"); - CORESIGHT_IndexAHBAPToUse = 1; -} diff --git a/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.board b/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.board deleted file mode 100644 index a35655ec3fd..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.board +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_NRF54H20DK_NRF54H20_CPUPPR - bool "nRF54H20 DK nRF54H20 PPR MCU" - depends on SOC_NRF54H20_CPUPPR - -config BOARD_NRF54H20DK_NRF54H20_CPUPPR_RAM - bool "nRF54H20 DK nRF54H20 PPR MCU (executing from RAM)" - depends on SOC_NRF54H20_CPUPPR diff --git a/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.defconfig b/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.defconfig deleted file mode 100644 index fa67352d3c8..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/Kconfig.defconfig +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config BOARD - default "nrf54h20dk_nrf54h20_cpuppr" - depends on BOARD_NRF54H20DK_NRF54H20_CPUPPR || BOARD_NRF54H20DK_NRF54H20_CPUPPR_RAM diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts deleted file mode 100644 index edce1a8b275..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.dts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; - -#include -#include "nrf54h20dk_nrf54h20-memory_map.dtsi" -#include "nrf54h20dk_nrf54h20-ipc_conf.dtsi" -#include "nrf54h20dk_nrf54h20-pinctrl.dtsi" - -/delete-node/ &cpuapp_cpurad_ipc; -/delete-node/ &cpusec_cpuapp_ipc; -/delete-node/ &cpusec_cpurad_ipc; - -/ { - compatible = "nordic,nrf54h20dk_nrf54h20-cpuppr"; - model = "Nordic nRF54H20 DK nRF54H20 Peripheral Processor MCU"; - #address-cells = <1>; - #size-cells = <1>; - - chosen { - zephyr,console = &uart135; - zephyr,code-partition = &cpuppr_code_partition; - zephyr,flash = &mram1x; - zephyr,sram = &cpuppr_code_data; - }; -}; - -&cpuapp_cpuppr_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpuppr_cpuapp_ipc_shm>; - rx-region = <&cpuapp_cpuppr_ipc_shm>; -}; - -&grtc { - status = "okay"; - owned-channels = <5>; -}; - -&uart135 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart135_default>; - pinctrl-1 = <&uart135_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart136 { - current-speed = <115200>; - pinctrl-0 = <&uart136_default>; - pinctrl-1 = <&uart136_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml deleted file mode 100644 index 02e28651f5d..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk_nrf54h20_cpuppr -name: nRF54H20-DK-nRF54H20-PPR -type: mcu -arch: riscv -toolchain: - - zephyr -ram: 62 -flash: 64 -supported: - - gpio diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig deleted file mode 100644 index 2f6ccc43892..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_defconfig +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_CPUPPR=y -CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR=y - -CONFIG_USE_DT_CODE_PARTITION=y - -CONFIG_SERIAL=y - -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts deleted file mode 100644 index b10cff15474..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.dts +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54h20dk_nrf54h20_cpuppr.dts" - -&cpuppr_code_partition { - reg = <0x126000 DT_SIZE_K(62)>; -}; diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml deleted file mode 100644 index 26d6ebeac9a..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk_nrf54h20_cpuppr_ram -name: nRF54H20-DK-nRF54H20-PPR-RAM -type: mcu -arch: riscv -toolchain: - - zephyr -ram: 62 -flash: 62 -supported: - - gpio diff --git a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig b/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig deleted file mode 100644 index 73056fac7ef..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/nrf54h20dk_nrf54h20_cpuppr_ram_defconfig +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SOC_SERIES_NRF54HX=y -CONFIG_SOC_NRF54H20=y -CONFIG_SOC_NRF54H20_CPUPPR=y -CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUPPR=y - -CONFIG_USE_DT_CODE_PARTITION=y - -CONFIG_SERIAL=y - -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y - -CONFIG_XIP=n diff --git a/boards/riscv/nrf54h20dk_nrf54h20/pre_dt_board.cmake b/boards/riscv/nrf54h20dk_nrf54h20/pre_dt_board.cmake deleted file mode 100644 index 5e0fecebdc8..00000000000 --- a/boards/riscv/nrf54h20dk_nrf54h20/pre_dt_board.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Allow common DTS files to be included from the other board directory. -# To be removed after HWMv2 (#51831), once both directories can be merged into one. -string(REGEX REPLACE "/riscv/(.*$)" "/arm/\\1" BOARD_DIR_ARM "${BOARD_DIR}") -list(APPEND DTS_EXTRA_CPPFLAGS -isystem "${BOARD_DIR_ARM}") From f99357f994c18c3417864e07c16c2d3aa50faf9c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:26 +0200 Subject: [PATCH 1678/2300] Revert "[nrf fromtree] modules: hal_nordic: Add nrfx configuration needed for nRF54H20" This reverts commit 26010c1110a8682c0a3afb0023c93b560d953f3b. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/nrfx/CMakeLists.txt | 9 - modules/hal_nordic/nrfx/nrfx_config.h | 10 +- .../nrfx/nrfx_config_nrf54h20_application.h | 1937 ---------------- .../nrfx/nrfx_config_nrf54h20_ppr.h | 1865 --------------- .../nrfx/nrfx_config_nrf54h20_radiocore.h | 2001 ----------------- 5 files changed, 2 insertions(+), 5820 deletions(-) delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h delete mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index eb384046aa6..92aa3962f61 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -36,12 +36,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUAPP NRF5340_XXAA_APP zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF5340_CPUAPP NRF5340_XXAA_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF5340_CPUNET NRF5340_XXAA_NETWORK) zephyr_compile_definitions_ifdef(CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET NRF5340_XXAA_NETWORK) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUAPP NRF54H20_XXAA - NRF_APPLICATION) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPURAD NRF54H20_XXAA - NRF_RADIOCORE) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUPPR NRF54H20_XXAA - NRF_PPR) 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_NRF9120 NRF9120_XXAA) @@ -207,9 +201,6 @@ mdk_svd_ifdef(CONFIG_SOC_NRF52833 nrf52833.svd) mdk_svd_ifdef(CONFIG_SOC_NRF52840 nrf52840.svd) mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUAPP nrf5340_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF5340_CPUNET nrf5340_network.svd) -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_CPURAD nrf54h20_radiocore.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUAPP nrf54h20_enga_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPUPPR nrf54h20_enga_ppr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGA_CPURAD nrf54h20_enga_radiocore.svd) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index d0f2a0555d5..58b9cd2aba7 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -937,22 +937,16 @@ #include #elif defined(NRF5340_XXAA_NETWORK) #include -#elif defined(NRF54H20_XXAA) && defined(NRF_APPLICATION) - #include -#elif defined(NRF54H20_XXAA) && defined(NRF_RADIOCORE) - #include -#elif defined(NRF54H20_XXAA) && defined(NRF_PPR) - #include #elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_APPLICATION) #include #elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_RADIOCORE) #include #elif defined(NRF54H20_ENGA_XXAA) && defined(NRF_PPR) #include -#elif (defined(NRF54L15_XXAA) || defined(NRF54L15_ENGA_XXAA)) && defined(NRF_APPLICATION) - #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) #include +#elif (defined(NRF54L15_XXAA) || defined(NRF54L15_ENGA_XXAA)) && defined(NRF_APPLICATION) + #include #else #error "Unknown device." #endif diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h deleted file mode 100644 index 5b91d921c7c..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h +++ /dev/null @@ -1,1937 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54H20_APPLICATION_H__ -#define NRFX_CONFIG_NRF54H20_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_BELLBOARD_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD_ENABLED -#define NRFX_BELLBOARD_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY - * - * Integer value. Minimum: 0. Maximum: 7. - */ -#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY -#endif - -/** - * @brief NRFX_BELLBOARD0_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD0_ENABLED -#define NRFX_BELLBOARD0_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD1_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD1_ENABLED -#define NRFX_BELLBOARD1_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD2_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD2_ENABLED -#define NRFX_BELLBOARD2_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD3_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD3_ENABLED -#define NRFX_BELLBOARD3_ENABLED 0 -#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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 -#endif - -/** - * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e -#endif - -/** - * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 -#endif - -/** - * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 -#endif - -/** - * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 -#endif - -/** - * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f -#endif - -/** - * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 -#endif - -/** - * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df -#endif - -/** - * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf -#endif - -/** - * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e -#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_EGU130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_EGU130_ENABLED -#define NRFX_EGU130_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 1 -#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_GPIOTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GPIOTE130_ENABLED -#define NRFX_GPIOTE130_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_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 -#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_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: 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_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#endif - -/** - * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#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_MVDMA_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA_ENABLED -#define NRFX_MVDMA_ENABLED 0 -#endif - -/** - * @brief NRFX_MVDMA120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA120_ENABLED -#define NRFX_MVDMA120_ENABLED 0 -#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_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_PRS_BOX_6_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_6_ENABLED -#define NRFX_PRS_BOX_6_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_7_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_7_ENABLED -#define NRFX_PRS_BOX_7_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_8_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_8_ENABLED -#define NRFX_PRS_BOX_8_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_9_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_9_ENABLED -#define NRFX_PRS_BOX_9_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_PWM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM120_ENABLED -#define NRFX_PWM120_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM130_ENABLED -#define NRFX_PWM130_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM131_ENABLED -#define NRFX_PWM131_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM132_ENABLED -#define NRFX_PWM132_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM133_ENABLED -#define NRFX_PWM133_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_QDEC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC130_ENABLED -#define NRFX_QDEC130_ENABLED 0 -#endif - -/** - * @brief NRFX_QDEC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC131_ENABLED -#define NRFX_QDEC131_ENABLED 0 -#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_RTC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC130_ENABLED -#define NRFX_RTC130_ENABLED 0 -#endif - -/** - * @brief NRFX_RTC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC131_ENABLED -#define NRFX_RTC131_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_SPIM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM120_ENABLED -#define NRFX_SPIM120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM121_ENABLED -#define NRFX_SPIM121_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM130_ENABLED -#define NRFX_SPIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM131_ENABLED -#define NRFX_SPIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM132_ENABLED -#define NRFX_SPIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM133_ENABLED -#define NRFX_SPIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM134_ENABLED -#define NRFX_SPIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM135_ENABLED -#define NRFX_SPIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM136_ENABLED -#define NRFX_SPIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM137_ENABLED -#define NRFX_SPIM137_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_SPIS120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS120_ENABLED -#define NRFX_SPIS120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS130_ENABLED -#define NRFX_SPIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS131_ENABLED -#define NRFX_SPIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS132_ENABLED -#define NRFX_SPIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS133_ENABLED -#define NRFX_SPIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS134_ENABLED -#define NRFX_SPIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS135_ENABLED -#define NRFX_SPIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS136_ENABLED -#define NRFX_SPIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS137_ENABLED -#define NRFX_SPIS137_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_TIMER120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER120_ENABLED -#define NRFX_TIMER120_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER121_ENABLED -#define NRFX_TIMER121_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER130_ENABLED -#define NRFX_TIMER130_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER131_ENABLED -#define NRFX_TIMER131_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER132_ENABLED -#define NRFX_TIMER132_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER133_ENABLED -#define NRFX_TIMER133_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER134_ENABLED -#define NRFX_TIMER134_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER135_ENABLED -#define NRFX_TIMER135_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER136_ENABLED -#define NRFX_TIMER136_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER137_ENABLED -#define NRFX_TIMER137_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_TWIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM130_ENABLED -#define NRFX_TWIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM131_ENABLED -#define NRFX_TWIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM132_ENABLED -#define NRFX_TWIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM133_ENABLED -#define NRFX_TWIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM134_ENABLED -#define NRFX_TWIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM135_ENABLED -#define NRFX_TWIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM136_ENABLED -#define NRFX_TWIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM137_ENABLED -#define NRFX_TWIM137_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_TWIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS130_ENABLED -#define NRFX_TWIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS131_ENABLED -#define NRFX_TWIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS132_ENABLED -#define NRFX_TWIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS133_ENABLED -#define NRFX_TWIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS134_ENABLED -#define NRFX_TWIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS135_ENABLED -#define NRFX_TWIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS136_ENABLED -#define NRFX_TWIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS137_ENABLED -#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE120_ENABLED -#define NRFX_UARTE120_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE130_ENABLED -#define NRFX_UARTE130_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE131_ENABLED -#define NRFX_UARTE131_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE132_ENABLED -#define NRFX_UARTE132_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE133_ENABLED -#define NRFX_UARTE133_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE134_ENABLED -#define NRFX_UARTE134_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE135_ENABLED -#define NRFX_UARTE135_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE136_ENABLED -#define NRFX_UARTE136_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE137_ENABLED -#define NRFX_UARTE137_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_WDT010_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT010_ENABLED -#define NRFX_WDT010_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT011_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT011_ENABLED -#define NRFX_WDT011_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT131_ENABLED -#define NRFX_WDT131_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT132_ENABLED -#define NRFX_WDT132_ENABLED 0 -#endif - -#endif /* NRFX_CONFIG_NRF54H20_APPLICATION_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h deleted file mode 100644 index 4a4e6c08a8a..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h +++ /dev/null @@ -1,1865 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54H20_PPR_H__ -#define NRFX_CONFIG_NRF54H20_PPR_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_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_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_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 -#endif - -/** - * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e -#endif - -/** - * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 -#endif - -/** - * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 -#endif - -/** - * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 -#endif - -/** - * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 -#endif - -/** - * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df -#endif - -/** - * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf -#endif - -/** - * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e -#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_EGU130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_EGU130_ENABLED -#define NRFX_EGU130_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 1 -#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_GPIOTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GPIOTE130_ENABLED -#define NRFX_GPIOTE130_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_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 -#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_NUM_OF_CC_CHANNELS - * - * Integer value. - */ -#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS -#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 2 -#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 0x000000c0 -#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_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#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_MVDMA_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA_ENABLED -#define NRFX_MVDMA_ENABLED 0 -#endif - -/** - * @brief NRFX_MVDMA120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA120_ENABLED -#define NRFX_MVDMA120_ENABLED 0 -#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_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_PRS_BOX_6_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_6_ENABLED -#define NRFX_PRS_BOX_6_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_7_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_7_ENABLED -#define NRFX_PRS_BOX_7_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_8_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_8_ENABLED -#define NRFX_PRS_BOX_8_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_9_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_9_ENABLED -#define NRFX_PRS_BOX_9_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_PWM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM120_ENABLED -#define NRFX_PWM120_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM130_ENABLED -#define NRFX_PWM130_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM131_ENABLED -#define NRFX_PWM131_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM132_ENABLED -#define NRFX_PWM132_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM133_ENABLED -#define NRFX_PWM133_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_QDEC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC130_ENABLED -#define NRFX_QDEC130_ENABLED 0 -#endif - -/** - * @brief NRFX_QDEC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC131_ENABLED -#define NRFX_QDEC131_ENABLED 0 -#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_RTC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC130_ENABLED -#define NRFX_RTC130_ENABLED 0 -#endif - -/** - * @brief NRFX_RTC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC131_ENABLED -#define NRFX_RTC131_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_SPIM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM120_ENABLED -#define NRFX_SPIM120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM121_ENABLED -#define NRFX_SPIM121_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM130_ENABLED -#define NRFX_SPIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM131_ENABLED -#define NRFX_SPIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM132_ENABLED -#define NRFX_SPIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM133_ENABLED -#define NRFX_SPIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM134_ENABLED -#define NRFX_SPIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM135_ENABLED -#define NRFX_SPIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM136_ENABLED -#define NRFX_SPIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM137_ENABLED -#define NRFX_SPIM137_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_SPIS120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS120_ENABLED -#define NRFX_SPIS120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS130_ENABLED -#define NRFX_SPIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS131_ENABLED -#define NRFX_SPIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS132_ENABLED -#define NRFX_SPIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS133_ENABLED -#define NRFX_SPIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS134_ENABLED -#define NRFX_SPIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS135_ENABLED -#define NRFX_SPIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS136_ENABLED -#define NRFX_SPIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS137_ENABLED -#define NRFX_SPIS137_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_TIMER120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER120_ENABLED -#define NRFX_TIMER120_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER121_ENABLED -#define NRFX_TIMER121_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER130_ENABLED -#define NRFX_TIMER130_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER131_ENABLED -#define NRFX_TIMER131_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER132_ENABLED -#define NRFX_TIMER132_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER133_ENABLED -#define NRFX_TIMER133_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER134_ENABLED -#define NRFX_TIMER134_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER135_ENABLED -#define NRFX_TIMER135_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER136_ENABLED -#define NRFX_TIMER136_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER137_ENABLED -#define NRFX_TIMER137_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_TWIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM130_ENABLED -#define NRFX_TWIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM131_ENABLED -#define NRFX_TWIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM132_ENABLED -#define NRFX_TWIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM133_ENABLED -#define NRFX_TWIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM134_ENABLED -#define NRFX_TWIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM135_ENABLED -#define NRFX_TWIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM136_ENABLED -#define NRFX_TWIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM137_ENABLED -#define NRFX_TWIM137_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_TWIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS130_ENABLED -#define NRFX_TWIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS131_ENABLED -#define NRFX_TWIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS132_ENABLED -#define NRFX_TWIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS133_ENABLED -#define NRFX_TWIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS134_ENABLED -#define NRFX_TWIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS135_ENABLED -#define NRFX_TWIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS136_ENABLED -#define NRFX_TWIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS137_ENABLED -#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE120_ENABLED -#define NRFX_UARTE120_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE130_ENABLED -#define NRFX_UARTE130_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE131_ENABLED -#define NRFX_UARTE131_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE132_ENABLED -#define NRFX_UARTE132_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE133_ENABLED -#define NRFX_UARTE133_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE134_ENABLED -#define NRFX_UARTE134_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE135_ENABLED -#define NRFX_UARTE135_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE136_ENABLED -#define NRFX_UARTE136_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE137_ENABLED -#define NRFX_UARTE137_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_WDT131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT131_ENABLED -#define NRFX_WDT131_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT132_ENABLED -#define NRFX_WDT132_ENABLED 0 -#endif - -#endif /* NRFX_CONFIG_NRF54H20_PPR_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h deleted file mode 100644 index 274073e6a38..00000000000 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h +++ /dev/null @@ -1,2001 +0,0 @@ -/* - * Copyright (c) 2024, Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef NRFX_CONFIG_NRF54H20_RADIOCORE_H__ -#define NRFX_CONFIG_NRF54H20_RADIOCORE_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_BELLBOARD_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD_ENABLED -#define NRFX_BELLBOARD_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY - * - * Integer value. Minimum: 0. Maximum: 7. - */ -#ifndef NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_BELLBOARD_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY -#endif - -/** - * @brief NRFX_BELLBOARD0_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD0_ENABLED -#define NRFX_BELLBOARD0_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD1_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD1_ENABLED -#define NRFX_BELLBOARD1_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD2_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD2_ENABLED -#define NRFX_BELLBOARD2_ENABLED 0 -#endif - -/** - * @brief NRFX_BELLBOARD3_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_BELLBOARD3_ENABLED -#define NRFX_BELLBOARD3_ENABLED 0 -#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_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI020_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#endif - -/** - * @brief NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI030_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#endif - -/** - * @brief NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000f0 -#endif - -/** - * @brief NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000001e -#endif - -/** - * @brief NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000020 -#endif - -/** - * @brief NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000040 -#endif - -/** - * @brief NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000081 -#endif - -/** - * @brief NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI020_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI030_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000f -#endif - -/** - * @brief NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI131_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000ff -#endif - -/** - * @brief NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI132_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI133_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000e1 -#endif - -/** - * @brief NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI134_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000df -#endif - -/** - * @brief NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI135_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000bf -#endif - -/** - * @brief NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_DPPI136_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000007e -#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_EGU020_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_EGU020_ENABLED -#define NRFX_EGU020_ENABLED 0 -#endif - -/** - * @brief NRFX_EGU130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_EGU130_ENABLED -#define NRFX_EGU130_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 1 -#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_GPIOTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GPIOTE130_ENABLED -#define NRFX_GPIOTE130_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_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 -#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_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 0x00000f00 -#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_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000030 -#endif - -/** - * @brief NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_PUB_CONFIG_ALLOWED_CHANNELS_MASK 0x0000000c -#endif - -/** - * @brief NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x000000c0 -#endif - -/** - * @brief NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT120_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0 -#endif - -/** - * @brief NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK - */ -#ifndef NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK -#define NRFX_IPCT130_SUB_CONFIG_ALLOWED_CHANNELS_MASK 0x00000003 -#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_MVDMA_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA_ENABLED -#define NRFX_MVDMA_ENABLED 0 -#endif - -/** - * @brief NRFX_MVDMA120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_MVDMA120_ENABLED -#define NRFX_MVDMA120_ENABLED 0 -#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_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_PRS_BOX_6_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_6_ENABLED -#define NRFX_PRS_BOX_6_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_7_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_7_ENABLED -#define NRFX_PRS_BOX_7_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_8_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_8_ENABLED -#define NRFX_PRS_BOX_8_ENABLED 0 -#endif - -/** - * @brief NRFX_PRS_BOX_9_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PRS_BOX_9_ENABLED -#define NRFX_PRS_BOX_9_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_PWM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM120_ENABLED -#define NRFX_PWM120_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM130_ENABLED -#define NRFX_PWM130_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM131_ENABLED -#define NRFX_PWM131_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM132_ENABLED -#define NRFX_PWM132_ENABLED 0 -#endif - -/** - * @brief NRFX_PWM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_PWM133_ENABLED -#define NRFX_PWM133_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_QDEC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC130_ENABLED -#define NRFX_QDEC130_ENABLED 0 -#endif - -/** - * @brief NRFX_QDEC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_QDEC131_ENABLED -#define NRFX_QDEC131_ENABLED 0 -#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_RTC130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC130_ENABLED -#define NRFX_RTC130_ENABLED 0 -#endif - -/** - * @brief NRFX_RTC131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_RTC131_ENABLED -#define NRFX_RTC131_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_SPIM120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM120_ENABLED -#define NRFX_SPIM120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM121_ENABLED -#define NRFX_SPIM121_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM130_ENABLED -#define NRFX_SPIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM131_ENABLED -#define NRFX_SPIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM132_ENABLED -#define NRFX_SPIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM133_ENABLED -#define NRFX_SPIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM134_ENABLED -#define NRFX_SPIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM135_ENABLED -#define NRFX_SPIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM136_ENABLED -#define NRFX_SPIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIM137_ENABLED -#define NRFX_SPIM137_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_SPIS120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS120_ENABLED -#define NRFX_SPIS120_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS130_ENABLED -#define NRFX_SPIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS131_ENABLED -#define NRFX_SPIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS132_ENABLED -#define NRFX_SPIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS133_ENABLED -#define NRFX_SPIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS134_ENABLED -#define NRFX_SPIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS135_ENABLED -#define NRFX_SPIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS136_ENABLED -#define NRFX_SPIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_SPIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_SPIS137_ENABLED -#define NRFX_SPIS137_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_TIMER020_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER020_ENABLED -#define NRFX_TIMER020_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER021_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER021_ENABLED -#define NRFX_TIMER021_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER022_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER022_ENABLED -#define NRFX_TIMER022_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER120_ENABLED -#define NRFX_TIMER120_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER121_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER121_ENABLED -#define NRFX_TIMER121_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER130_ENABLED -#define NRFX_TIMER130_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER131_ENABLED -#define NRFX_TIMER131_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER132_ENABLED -#define NRFX_TIMER132_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER133_ENABLED -#define NRFX_TIMER133_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER134_ENABLED -#define NRFX_TIMER134_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER135_ENABLED -#define NRFX_TIMER135_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER136_ENABLED -#define NRFX_TIMER136_ENABLED 0 -#endif - -/** - * @brief NRFX_TIMER137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TIMER137_ENABLED -#define NRFX_TIMER137_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_TWIM130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM130_ENABLED -#define NRFX_TWIM130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM131_ENABLED -#define NRFX_TWIM131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM132_ENABLED -#define NRFX_TWIM132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM133_ENABLED -#define NRFX_TWIM133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM134_ENABLED -#define NRFX_TWIM134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM135_ENABLED -#define NRFX_TWIM135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM136_ENABLED -#define NRFX_TWIM136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIM137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIM137_ENABLED -#define NRFX_TWIM137_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_TWIS130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS130_ENABLED -#define NRFX_TWIS130_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS131_ENABLED -#define NRFX_TWIS131_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS132_ENABLED -#define NRFX_TWIS132_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS133_ENABLED -#define NRFX_TWIS133_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS134_ENABLED -#define NRFX_TWIS134_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS135_ENABLED -#define NRFX_TWIS135_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS136_ENABLED -#define NRFX_TWIS136_ENABLED 0 -#endif - -/** - * @brief NRFX_TWIS137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_TWIS137_ENABLED -#define NRFX_TWIS137_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_CONFIG_RX_CACHE_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE_CONFIG_RX_CACHE_ENABLED -#define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 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_UARTE120_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE120_ENABLED -#define NRFX_UARTE120_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE130_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE130_ENABLED -#define NRFX_UARTE130_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE131_ENABLED -#define NRFX_UARTE131_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE132_ENABLED -#define NRFX_UARTE132_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE133_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE133_ENABLED -#define NRFX_UARTE133_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE134_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE134_ENABLED -#define NRFX_UARTE134_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE135_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE135_ENABLED -#define NRFX_UARTE135_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE136_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE136_ENABLED -#define NRFX_UARTE136_ENABLED 0 -#endif - -/** - * @brief NRFX_UARTE137_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_UARTE137_ENABLED -#define NRFX_UARTE137_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_WDT010_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT010_ENABLED -#define NRFX_WDT010_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT011_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT011_ENABLED -#define NRFX_WDT011_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT131_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT131_ENABLED -#define NRFX_WDT131_ENABLED 0 -#endif - -/** - * @brief NRFX_WDT132_ENABLED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_WDT132_ENABLED -#define NRFX_WDT132_ENABLED 0 -#endif - -#endif /* NRFX_CONFIG_NRF54H20_RADIOCORE_H__ */ From 395fa26639f6a2b74a308257747dbf51e03de600 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:26 +0200 Subject: [PATCH 1679/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx: include config for nrf54l15" This reverts commit b13898244d1e6b2d033ae9a3e355e57057339956. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/nrfx/nrfx_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 58b9cd2aba7..206fa2ed5dc 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -945,7 +945,7 @@ #include #elif defined(NRF9120_XXAA) || defined(NRF9160_XXAA) #include -#elif (defined(NRF54L15_XXAA) || defined(NRF54L15_ENGA_XXAA)) && defined(NRF_APPLICATION) +#elif defined(NRF54L15_ENGA_XXAA) && defined(NRF_APPLICATION) #include #else #error "Unknown device." From b60ed7900a335e287134853d4fe4dc8298d4ea69 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:27 +0200 Subject: [PATCH 1680/2300] Revert "[nrf fromtree] dts: nordic: Add initial support for nRF54H20" This reverts commit e1ac501f97385e95f120a27508ad59585ddc9970. Signed-off-by: Gerard Marull-Paretas --- dts/arm/nordic/nrf54h20_cpuapp.dtsi | 51 - dts/arm/nordic/nrf54h20_cpurad.dtsi | 51 - dts/common/nordic/nrf54h20.dtsi | 948 ------------------ dts/riscv/nordic/nrf54h20_cpuppr.dtsi | 48 - .../misc/nordic-nrf-ficr-nrf54h20.h | 85 -- 5 files changed, 1183 deletions(-) delete mode 100644 dts/arm/nordic/nrf54h20_cpuapp.dtsi delete mode 100644 dts/arm/nordic/nrf54h20_cpurad.dtsi delete mode 100644 dts/common/nordic/nrf54h20.dtsi delete mode 100644 dts/riscv/nordic/nrf54h20_cpuppr.dtsi delete mode 100644 include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20.h diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi deleted file mode 100644 index d82c69262c0..00000000000 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuapp {}; -systick: &cpuapp_systick {}; -nvic: &cpuapp_nvic {}; -cpuppr_vevif: &cpuppr_vevif_remote {}; - -/delete-node/ &cpuppr; -/delete-node/ &cpurad; -/delete-node/ &cpurad_peripherals; -/delete-node/ &cpurad_ppb; -/delete-node/ &cpurad_ram0; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuapp_nvic>; - ranges; - }; -}; - -&cpuapp_ppb { - compatible = "simple-bus"; - ranges; -}; - -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-local"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&gpiote130 { - interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&grtc { - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; -}; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi deleted file mode 100644 index 2f463f2d427..00000000000 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpurad {}; -systick: &cpurad_systick {}; -nvic: &cpurad_nvic {}; -cpuppr_vevif: &cpuppr_vevif_remote {}; - -/delete-node/ &cpuapp; -/delete-node/ &cpuapp_peripherals; -/delete-node/ &cpuapp_ppb; -/delete-node/ &cpuapp_ram0; -/delete-node/ &cpuppr; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpurad_nvic>; - ranges; - }; -}; - -&cpurad_ppb { - compatible = "simple-bus"; - ranges; -}; - -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-local"; -}; - -&gpiote130 { - interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&grtc { - interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>; -}; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi deleted file mode 100644 index 78e4c5b6549..00000000000 --- a/dts/common/nordic/nrf54h20.dtsi +++ /dev/null @@ -1,948 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#include - -/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ -#define NRF_DOMAIN_ID_APPLICATION 2 -#define NRF_DOMAIN_ID_RADIOCORE 3 -#define NRF_DOMAIN_ID_GLOBALFAST 12 -#define NRF_DOMAIN_ID_GLOBALSLOW 13 - -/delete-node/ &sw_pwm; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpuapp: cpu@2 { - compatible = "arm,cortex-m33"; - reg = <2>; - device_type = "cpu"; - clock-frequency = ; - }; - - cpurad: cpu@3 { - compatible = "arm,cortex-m33"; - reg = <3>; - device_type = "cpu"; - clock-frequency = ; - }; - - cpuppr: cpu@d { - compatible = "nordic,vpr"; - reg = <13>; - device_type = "cpu"; - clock-frequency = ; - riscv,isa = "rv32emc"; - nordic,bus-width = <32>; - - cpuppr_vevif_local: mailbox { - compatible = "nordic,nrf-vevif-local"; - status = "disabled"; - interrupt-parent = <&cpuppr_clic>; - interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, - <1 NRF_DEFAULT_IRQ_PRIORITY>, - <2 NRF_DEFAULT_IRQ_PRIORITY>, - <3 NRF_DEFAULT_IRQ_PRIORITY>, - <4 NRF_DEFAULT_IRQ_PRIORITY>, - <5 NRF_DEFAULT_IRQ_PRIORITY>, - <6 NRF_DEFAULT_IRQ_PRIORITY>, - <7 NRF_DEFAULT_IRQ_PRIORITY>, - <8 NRF_DEFAULT_IRQ_PRIORITY>, - <9 NRF_DEFAULT_IRQ_PRIORITY>, - <10 NRF_DEFAULT_IRQ_PRIORITY>, - <11 NRF_DEFAULT_IRQ_PRIORITY>, - <12 NRF_DEFAULT_IRQ_PRIORITY>, - <13 NRF_DEFAULT_IRQ_PRIORITY>, - <14 NRF_DEFAULT_IRQ_PRIORITY>, - <15 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask = <0xfffffff0>; - }; - }; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - - cpurad_uicr_ext: memory@e1ff000 { - reg = <0xe1ff000 DT_SIZE_K(2)>; - }; - - cpuapp_uicr_ext: memory@e1ff800 { - reg = <0xe1ff800 DT_SIZE_K(2)>; - }; - }; - - clocks { - fll16m: fll16m { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = ; - }; - }; - - soc { - #address-cells = <1>; - #size-cells = <1>; - - mram1x: mram@e000000 { - compatible = "nordic,mram"; - reg = <0xe000000 DT_SIZE_K(2048)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - - cpuapp_uicr: uicr@fff8000 { - 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 { - compatible = "nordic,nrf-ficr"; - reg = <0xfffe000 DT_SIZE_K(2)>; - #nordic,ficr-cells = <1>; - }; - - cpuapp_ram0: sram@22000000 { - compatible = "mmio-sram"; - reg = <0x22000000 DT_SIZE_K(32)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x22000000 0x8000>; - }; - - cpurad_ram0: sram@23000000 { - compatible = "mmio-sram"; - reg = <0x23000000 DT_SIZE_K(192)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x23000000 0x30000>; - }; - - cpuapp_peripherals: peripheral@52000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x52000000 0x1000000>; - - cpuapp_hsfll: clock@d000 { - compatible = "nordic,nrf-hsfll"; - #clock-cells = <0>; - reg = <0xd000 0x1000>; - clocks = <&fll16m>; - clock-frequency = ; - nordic,ficrs = - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0>, - <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; - nordic,ficr-names = "vsup", "coarse", "fine"; - }; - - cpuapp_ipct: ipct@13000 { - compatible = "nordic,nrf-ipct-local"; - reg = <0x13000 0x1000>; - status = "disabled"; - channels = <4>; - interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, - <65 NRF_DEFAULT_IRQ_PRIORITY>; - }; - }; - - cpurad_peripherals: peripheral@53000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x53000000 0x1000000>; - - cpurad_hsfll: clock@d000 { - compatible = "nordic,nrf-hsfll"; - #clock-cells = <0>; - reg = <0xd000 0x1000>; - clocks = <&fll16m>; - clock-frequency = ; - nordic,ficrs = - <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP>, - <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1>, - <&ficr NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1>; - nordic,ficr-names = "vsup", "coarse", "fine"; - }; - - dppic020: dppic@22000 { - compatible = "nordic,nrf-dppic-local"; - reg = <0x22000 0x1000>; - status = "disabled"; - }; - - cpurad_ipct: ipct@24000 { - compatible = "nordic,nrf-ipct-local"; - reg = <0x24000 0x1000>; - status = "disabled"; - channels = <8>; - interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, - <65 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - egu020: egu@25000 { - compatible = "nordic,nrf-egu"; - reg = <0x25000 0x1000>; - status = "disabled"; - interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - timer020: timer@28000 { - compatible = "nordic,nrf-timer"; - reg = <0x28000 0x1000>; - status = "disabled"; - cc-num = <8>; - interrupts = <40 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer021: timer@29000 { - compatible = "nordic,nrf-timer"; - reg = <0x29000 0x1000>; - status = "disabled"; - cc-num = <8>; - interrupts = <41 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer022: timer@2a000 { - compatible = "nordic,nrf-timer"; - reg = <0x2a000 0x1000>; - status = "disabled"; - cc-num = <8>; - interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - rtc: rtc@2b000 { - compatible = "nordic,nrf-rtc"; - reg = <0x2b000 0x1000>; - status = "disabled"; - cc-num = <4>; - clock-frequency = <32768>; - interrupts = <43 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <1>; - }; - - radio: radio@2c000 { - compatible = "nordic,nrf-radio"; - reg = <0x2c000 0x1000>; - status = "disabled"; - ble-2mbps-supported; - ble-coded-phy-supported; - dfe-supported; - ieee802154-supported; - interrupts = <44 NRF_DEFAULT_IRQ_PRIORITY>; - - cpurad_ieee802154: ieee802154 { - compatible = "nordic,nrf-ieee802154"; - status = "disabled"; - }; - }; - - ecb030: ecb@3b000 { - compatible = "nordic,nrf-ecb"; - reg = <0x3b000 0x1000>; - interrupts = <59 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - ccm031: ccm@3c000 { - compatible = "nordic,nrf-ccm"; - reg = <0x3c000 0x1000>; - interrupts = <60 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - ecb031: ecb@3d000 { - compatible = "nordic,nrf-ecb"; - reg = <0x3d000 0x1000>; - status = "disabled"; - interrupts = <61 NRF_DEFAULT_IRQ_PRIORITY>; - }; - }; - - global_peripherals: peripheral@5f000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x5f000000 0x1000000>; - - cpusec_bellboard: mailbox@99000 { - reg = <0x99000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - cpuapp_bellboard: mailbox@9a000 { - reg = <0x9a000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - cpurad_bellboard: mailbox@9b000 { - reg = <0x9b000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - ipct120: ipct@8d1000 { - compatible = "nordic,nrf-ipct-global"; - reg = <0x8d1000 0x1000>; - status = "disabled"; - channels = <8>; - global-domain-id = <12>; - }; - - dppic120: dppic@8e1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x8e1000 0x1000>; - status = "disabled"; - }; - - timer120: timer@8e2000 { - compatible = "nordic,nrf-timer"; - reg = <0x8e2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer121: timer@8e3000 { - compatible = "nordic,nrf-timer"; - reg = <0x8e3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - spi120: spi@8e6000 { - compatible = "nordic,nrf-spim"; - reg = <0x8e6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart120: uart@8e6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x8e6000 0x1000>; - status = "disabled"; - interrupts = <229 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - spi121: spi@8e7000 { - compatible = "nordic,nrf-spim"; - reg = <0x8e7000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <231 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - cpuppr_vpr: vpr@908000 { - compatible = "nordic,nrf-vpr-coprocessor"; - reg = <0x908000 0x1000>; - status = "disabled"; - cpu = <13>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x908000 0x4000>; - - cpuppr_vevif_remote: mailbox@0 { - compatible = "nordic,nrf-vevif-remote"; - reg = <0x0 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask = <0xfffffff0>; - }; - - cpuppr_clic: interrupt-controller@1000 { - compatible = "nordic,nrf-clic"; - reg = <0x1000 0x3000>; - status = "disabled"; - #interrupt-cells = <2>; - interrupt-controller; - #address-cells = <1>; - }; - }; - - ipct130: ipct@921000 { - compatible = "nordic,nrf-ipct-global"; - reg = <0x921000 0x1000>; - status = "disabled"; - channels = <8>; - global-domain-id = <13>; - }; - - dppic130: dppic@922000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x922000 0x1000>; - status = "disabled"; - }; - - rtc130: rtc@928000 { - compatible = "nordic,nrf-rtc"; - reg = <0x928000 0x1000>; - status = "disabled"; - cc-num = <4>; - clock-frequency = <32768>; - interrupts = <296 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <1>; - }; - - rtc131: rtc@929000 { - compatible = "nordic,nrf-rtc"; - reg = <0x929000 0x1000>; - status = "disabled"; - cc-num = <4>; - clock-frequency = <32768>; - interrupts = <297 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <1>; - }; - - wdt131: watchdog@92b000 { - compatible = "nordic,nrf-wdt"; - reg = <0x92b000 0x1000>; - status = "disabled"; - interrupts = <299 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - wdt132: watchdog@92c000 { - compatible = "nordic,nrf-wdt"; - reg = <0x92c000 0x1000>; - status = "disabled"; - interrupts = <300 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - gpiote130: gpiote@934000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x934000 0x1000>; - status = "disabled"; - instance = <130>; - }; - - gpio0: gpio@938000 { - compatible = "nordic,nrf-gpio"; - reg = <0x938000 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <12>; - port = <0>; - }; - - gpio1: gpio@938200 { - compatible = "nordic,nrf-gpio"; - reg = <0x938200 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <12>; - port = <1>; - }; - - gpio2: gpio@938400 { - compatible = "nordic,nrf-gpio"; - reg = <0x938400 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <12>; - port = <2>; - }; - - gpio6: gpio@938c00 { - compatible = "nordic,nrf-gpio"; - reg = <0x938c00 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - ngpios = <14>; - port = <6>; - }; - - gpio7: gpio@938e00 { - compatible = "nordic,nrf-gpio"; - reg = <0x938e00 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - ngpios = <8>; - port = <7>; - }; - - gpio9: gpio@939200 { - compatible = "nordic,nrf-gpio"; - reg = <0x939200 0x200>; - status = "disabled"; - #gpio-cells = <2>; - gpio-controller; - gpiote-instance = <&gpiote130>; - ngpios = <6>; - port = <9>; - }; - - dppic131: dppic@981000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x981000 0x1000>; - status = "disabled"; - }; - - comp: comparator@983000 { - compatible = "nordic,nrf-comp"; - reg = <0x983000 0x1000>; - status = "disabled"; - interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; - #io-channel-cells = <1>; - }; - - temp: temperature-sensor@984000 { - compatible = "nordic,nrf-temp"; - reg = <0x984000 0x1000>; - interrupts = <388 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - nfct: nfct@985000 { - compatible = "nordic,nrf-nfct"; - reg = <0x985000 0x1000>; - status = "disabled"; - interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - dppic132: dppic@991000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x991000 0x1000>; - status = "disabled"; - }; - - qdec130: qdec@994000 { - compatible = "nordic,nrf-qdec"; - reg = <0x994000 0x1000>; - status = "disabled"; - interrupts = <404 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - qdec131: qdec@995000 { - compatible = "nordic,nrf-qdec"; - reg = <0x995000 0x1000>; - status = "disabled"; - interrupts = <405 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - grtc: grtc@99c000 { - compatible = "nordic,nrf-grtc"; - reg = <0x99c000 0x1000>; - status = "disabled"; - cc-num = <16>; - }; - - dppic133: dppic@9a1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9a1000 0x1000>; - status = "disabled"; - }; - - timer130: timer@9a2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9a2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <418 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer131: timer@9a3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9a3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <419 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - i2c130: i2c@9a5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9a5000 0x1000>; - status = "disabled"; - interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi130: spi@9a5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9a5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart130: uart@9a5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9a5000 0x1000>; - status = "disabled"; - interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - i2c131: i2c@9a6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9a6000 0x1000>; - status = "disabled"; - interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi131: spi@9a6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9a6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart131: uart@9a6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9a6000 0x1000>; - status = "disabled"; - interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - dppic134: dppic@9b1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9b1000 0x1000>; - status = "disabled"; - }; - - timer132: timer@9b2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9b2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <434 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer133: timer@9b3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9b3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <435 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - i2c132: i2c@9b5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9b5000 0x1000>; - status = "disabled"; - interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi132: spi@9b5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9b5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart132: uart@9b5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9b5000 0x1000>; - status = "disabled"; - interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - i2c133: i2c@9b6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9b6000 0x1000>; - status = "disabled"; - interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi133: spi@9b6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9b6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart133: uart@9b6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9b6000 0x1000>; - status = "disabled"; - interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - dppic135: dppic@9c1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9c1000 0x1000>; - status = "disabled"; - }; - - timer134: timer@9c2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9c2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <450 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer135: timer@9c3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9c3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <451 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - i2c134: i2c@9c5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9c5000 0x1000>; - status = "disabled"; - interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi134: spi@9c5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9c5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart134: uart@9c5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9c5000 0x1000>; - status = "disabled"; - interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - i2c135: i2c@9c6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9c6000 0x1000>; - status = "disabled"; - interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi135: spi@9c6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9c6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart135: uart@9c6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9c6000 0x1000>; - status = "disabled"; - interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - dppic136: dppic@9d1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9d1000 0x1000>; - status = "disabled"; - }; - - timer136: timer@9d2000 { - compatible = "nordic,nrf-timer"; - reg = <0x9d2000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <466 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - timer137: timer@9d3000 { - compatible = "nordic,nrf-timer"; - reg = <0x9d3000 0x1000>; - status = "disabled"; - cc-num = <6>; - interrupts = <467 NRF_DEFAULT_IRQ_PRIORITY>; - max-bit-width = <32>; - prescaler = <0>; - }; - - i2c136: i2c@9d5000 { - compatible = "nordic,nrf-twim"; - reg = <0x9d5000 0x1000>; - status = "disabled"; - interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi136: spi@9d5000 { - compatible = "nordic,nrf-spim"; - reg = <0x9d5000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart136: uart@9d5000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9d5000 0x1000>; - status = "disabled"; - interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - i2c137: i2c@9d6000 { - compatible = "nordic,nrf-twim"; - reg = <0x9d6000 0x1000>; - status = "disabled"; - interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <15>; - #address-cells = <1>; - #size-cells = <0>; - }; - - spi137: spi@9d6000 { - compatible = "nordic,nrf-spim"; - reg = <0x9d6000 0x1000>; - status = "disabled"; - easydma-maxcnt-bits = <15>; - interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - #address-cells = <1>; - #size-cells = <0>; - }; - - uart137: uart@9d6000 { - compatible = "nordic,nrf-uarte"; - reg = <0x9d6000 0x1000>; - status = "disabled"; - interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; - }; - }; - }; - - cpuapp_ppb: cpuapp-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - - cpuapp_nvic: interrupt-controller@e000e100 { - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - #interrupt-cells = <2>; - interrupt-controller; - #address-cells = <1>; - }; - }; - - cpurad_ppb: cpurad-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpurad_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - - cpurad_nvic: interrupt-controller@e000e100 { - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - #interrupt-cells = <2>; - interrupt-controller; - #address-cells = <1>; - }; - }; -}; diff --git a/dts/riscv/nordic/nrf54h20_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_cpuppr.dtsi deleted file mode 100644 index d74147bc04b..00000000000 --- a/dts/riscv/nordic/nrf54h20_cpuppr.dtsi +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -cpu: &cpuppr {}; -clic: &cpuppr_clic {}; -cpuppr_vevif: &cpuppr_vevif_local {}; - -/delete-node/ &cpuapp; -/delete-node/ &cpuapp_peripherals; -/delete-node/ &cpuapp_ppb; -/delete-node/ &cpuapp_ram0; -/delete-node/ &cpurad; -/delete-node/ &cpurad_peripherals; -/delete-node/ &cpurad_ppb; -/delete-node/ &cpurad_ram0; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuppr_clic>; - ranges; - }; -}; - -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&gpiote130 { - interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&grtc { - interrupts = <108 NRF_DEFAULT_IRQ_PRIORITY>; -}; diff --git a/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20.h b/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20.h deleted file mode 100644 index 4ebd8fb6614..00000000000 --- a/include/zephyr/dt-bindings/misc/nordic-nrf-ficr-nrf54h20.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/* autogenerated using Nordic HAL utils/gen_offsets.py script */ - -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_H_ - -#define NRF_FICR_BLE_ADDRTYPE 0x00CU -#define NRF_FICR_BLE_ADDR_0 0x010U -#define NRF_FICR_BLE_ADDR_1 0x014U -#define NRF_FICR_BLE_ER_0 0x018U -#define NRF_FICR_BLE_ER_1 0x01CU -#define NRF_FICR_BLE_ER_2 0x020U -#define NRF_FICR_BLE_ER_3 0x024U -#define NRF_FICR_BLE_IR_0 0x028U -#define NRF_FICR_BLE_IR_1 0x02CU -#define NRF_FICR_BLE_IR_2 0x030U -#define NRF_FICR_BLE_IR_3 0x034U -#define NRF_FICR_NFC_TAGHEADER_0 0x040U -#define NRF_FICR_NFC_TAGHEADER_1 0x044U -#define NRF_FICR_NFC_TAGHEADER_2 0x048U -#define NRF_FICR_NFC_TAGHEADER_3 0x04CU -#define NRF_FICR_INFO_CONFIGID 0x050U -#define NRF_FICR_INFO_PART 0x054U -#define NRF_FICR_INFO_VARIANT 0x058U -#define NRF_FICR_INFO_PACKAGE 0x05CU -#define NRF_FICR_INFO_RAM 0x060U -#define NRF_FICR_INFO_MRAM 0x064U -#define NRF_FICR_INFO_CODEPAGESIZE 0x068U -#define NRF_FICR_INFO_CODESIZE 0x06CU -#define NRF_FICR_INFO_DEVICETYPE 0x070U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CAL_0 0x388U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CAL_1 0x38CU -#define NRF_FICR_TRIM_GLOBAL_SAADC_CAL_2 0x390U -#define NRF_FICR_TRIM_GLOBAL_SAADC_CALREF 0x394U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_0 0x398U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_1 0x39CU -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_2 0x3A0U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_3 0x3A4U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_4 0x3A8U -#define NRF_FICR_TRIM_GLOBAL_SAADC_LINCALCOEFF_5 0x3ACU -#define NRF_FICR_TRIM_GLOBAL_NFCT_BIASCFG 0x3B4U -#define NRF_FICR_TRIM_GLOBAL_CANPLL_TRIM_CTUNE 0x3B8U -#define NRF_FICR_TRIM_GLOBAL_COMP_REFTRIM 0x3C0U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_VSUP 0x3C8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_0 0x3CCU -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_1 0x3D0U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_2 0x3D4U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_3 0x3D8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_4 0x3DCU -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_COARSE_5 0x3E0U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0 0x3E4U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_1 0x3E8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_2 0x3ECU -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_3 0x3F0U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_4 0x3F4U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_5 0x3F8U -#define NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_TCOEF 0x3FCU -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_0_TRIM 0x400U -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_1_TRIM 0x404U -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_2_TRIM 0x408U -#define NRF_FICR_TRIM_APPLICATION_MEMCONF_BLOCKTYPE_3_TRIM 0x40CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_VSUP 0x410U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_0 0x414U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_1 0x418U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_2 0x41CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_3 0x420U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_4 0x424U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_COARSE_5 0x428U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_0 0x42CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_1 0x430U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_2 0x434U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_3 0x438U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_4 0x43CU -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_FINE_5 0x440U -#define NRF_FICR_TRIM_RADIOCORE_HSFLL_TRIM_TCOEF 0x444U -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_0_TRIM 0x448U -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_1_TRIM 0x44CU -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_2_TRIM 0x450U -#define NRF_FICR_TRIM_RADIOCORE_MEMCONF_BLOCKTYPE_3_TRIM 0x454U - -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_MISC_NORDIC_NRF_FICR_NRF54H20_H_ */ From ef3a37e71d4157b33e2a476e89de27a08f49f04a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:27 +0200 Subject: [PATCH 1681/2300] Revert "[nrf fromlist] soc: nordic: Add initial support for nRF54H20" This reverts commit 32eaa669cbd1c32af67cf81466dba899223303a5. Signed-off-by: Gerard Marull-Paretas --- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 6 +++--- .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 6 +++--- .../Kconfig.defconfig.nrf54h20_enga_cpuapp | 17 ----------------- .../Kconfig.defconfig.nrf54h20_enga_cpurad | 17 ----------------- soc/arm/nordic_nrf/nrf54h/Kconfig.soc | 16 ---------------- .../nordic_nrf/common/vpr/Kconfig.defconfig | 2 +- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuppr | 15 --------------- soc/riscv/nordic_nrf/nrf54h/Kconfig.soc | 4 ---- 8 files changed, 7 insertions(+), 76 deletions(-) delete mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp delete mode 100644 soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad delete mode 100644 soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index 007035c0f48..d90f87c0b89 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -3,10 +3,10 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPUAPP +if SOC_NRF54H20_ENGA_CPUAPP config SOC - default "nrf54h20_cpuapp" + default "nrf54h20_enga_cpuapp" config NUM_IRQS default 471 @@ -14,4 +14,4 @@ config NUM_IRQS config NRF_REGTOOL_GENERATE_UICR default y -endif # SOC_NRF54H20_CPUAPP +endif # SOC_NRF54H20_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad index 0f9e4c7e102..6aae8c3a105 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -3,10 +3,10 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPURAD +if SOC_NRF54H20_ENGA_CPURAD config SOC - default "nrf54h20_cpurad" + default "nrf54h20_enga_cpurad" config NUM_IRQS default 471 @@ -14,4 +14,4 @@ config NUM_IRQS config NRF_REGTOOL_GENERATE_UICR default y -endif # SOC_NRF54H20_CPURAD +endif # SOC_NRF54H20_ENGA_CPURAD diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp deleted file mode 100644 index d90f87c0b89..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpuapp +++ /dev/null @@ -1,17 +0,0 @@ -# Nordic Semiconductor nRF54H20 Application MCU - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54H20_ENGA_CPUAPP - -config SOC - default "nrf54h20_enga_cpuapp" - -config NUM_IRQS - default 471 - -config NRF_REGTOOL_GENERATE_UICR - default y - -endif # SOC_NRF54H20_ENGA_CPUAPP diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad b/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad deleted file mode 100644 index 6aae8c3a105..00000000000 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_enga_cpurad +++ /dev/null @@ -1,17 +0,0 @@ -# Nordic Semiconductor nRF54H20 Radio MCU - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54H20_ENGA_CPURAD - -config SOC - default "nrf54h20_enga_cpurad" - -config NUM_IRQS - default 471 - -config NRF_REGTOOL_GENERATE_UICR - default y - -endif # SOC_NRF54H20_ENGA_CPURAD diff --git a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc index 32256a809a9..9c065e79eaf 100644 --- a/soc/arm/nordic_nrf/nrf54h/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54h/Kconfig.soc @@ -12,22 +12,6 @@ if SOC_NRF54H20 choice prompt "nRF54H20 MCU Selection" -config SOC_NRF54H20_CPUAPP - bool "nRF54H20 CPUAPP" - select CPU_HAS_ARM_MPU - select CPU_HAS_ARM_SAU - select CPU_HAS_DCACHE - select CPU_HAS_ICACHE - select CPU_HAS_FPU - -config SOC_NRF54H20_CPURAD - bool "nRF54H20 CPURAD" - select CPU_HAS_ARM_MPU - select CPU_HAS_ARM_SAU - select CPU_HAS_DCACHE - select CPU_HAS_ICACHE - select CPU_HAS_FPU - config SOC_NRF54H20_ENGA_CPUAPP bool "nRF54H20 ENGA CPUAPP" select CPU_HAS_ARM_MPU diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig index a89593170f6..f0014455b3a 100644 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig.defconfig @@ -5,7 +5,7 @@ CPU_PATH := $(dt_nodelabel_path,cpu) CPU_ID := $(dt_node_reg_addr_int,$(CPU_PATH)) config RV_BOOT_HART - default $(CPU_ID) if SOC_NRF54H20_ENGA_CPUPPR + default $(CPU_ID) config RISCV_MCAUSE_EXCEPTION_MASK default 0xFFF diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr b/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr deleted file mode 100644 index caecd6ad0eb..00000000000 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54H20_CPUPPR - -config SOC - default "nrf54h20_cpuppr" - -config NUM_IRQS - default 496 - -config SYS_CLOCK_TICKS_PER_SEC - default 1000 - -endif # SOC_NRF54H20_CPUPPR diff --git a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc index 47138277fce..760e05a0e64 100644 --- a/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc +++ b/soc/riscv/nordic_nrf/nrf54h/Kconfig.soc @@ -10,10 +10,6 @@ if SOC_NRF54H20 choice prompt "nRF54Hx MCU Selection" -config SOC_NRF54H20_CPUPPR - bool "nRF54H20 CPUPPR" - select RISCV - config SOC_NRF54H20_ENGA_CPUPPR bool "nRF54H20 ENGA CPUPPR" depends on RISCV_CORE_NORDIC_VPR From e0199c587a78b3b095c41d7dc8b76006459143d6 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:27 +0200 Subject: [PATCH 1682/2300] Revert "[nrf fromtree] drivers: pinctrl_nrf: Set clockpin bitfield when necessary" This reverts commit bfc54995e2c166f73838411a0048ba229869ca85. Signed-off-by: Gerard Marull-Paretas --- drivers/pinctrl/pinctrl_nrf.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 0bf09e5e460..3ff28922835 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -40,19 +40,16 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_uart) #define NRF_PSEL_UART(reg, line) ((NRF_UART_Type *)reg)->PSEL##line #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_uarte) -#include #define NRF_PSEL_UART(reg, line) ((NRF_UARTE_Type *)reg)->PSEL.line #endif #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spi) #define NRF_PSEL_SPIM(reg, line) ((NRF_SPI_Type *)reg)->PSEL##line #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spim) -#include #define NRF_PSEL_SPIM(reg, line) ((NRF_SPIM_Type *)reg)->PSEL.line #endif #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spis) -#include #if defined(NRF51) #define NRF_PSEL_SPIS(reg, line) ((NRF_SPIS_Type *)reg)->PSEL##line #else @@ -67,7 +64,6 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { #define NRF_PSEL_TWIM(reg, line) ((NRF_TWI_Type *)reg)->PSEL.line #endif #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_twim) -#include #define NRF_PSEL_TWIM(reg, line) ((NRF_TWIM_Type *)reg)->PSEL.line #endif @@ -101,9 +97,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uint32_t write = NO_WRITE; nrf_gpio_pin_dir_t dir; nrf_gpio_pin_input_t input; -#if NRF_GPIO_HAS_CLOCKPIN - bool clockpin = false; -#endif if (drive_idx < ARRAY_SIZE(drive_modes)) { drive = drive_modes[drive_idx]; @@ -122,9 +115,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, write = 1U; dir = NRF_GPIO_PIN_DIR_OUTPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; -#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_UARTE_CLOCKPIN_TXD_NEEDED) - clockpin = true; -#endif break; case NRF_FUN_UART_RX: NRF_PSEL_UART(reg, RXD) = psel; @@ -136,9 +126,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, write = 1U; dir = NRF_GPIO_PIN_DIR_OUTPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; -#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_UARTE_CLOCKPIN_RTS_NEEDED) - clockpin = true; -#endif break; case NRF_FUN_UART_CTS: NRF_PSEL_UART(reg, CTS) = psel; @@ -152,18 +139,12 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, write = 0U; dir = NRF_GPIO_PIN_DIR_OUTPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; -#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_SPIM_CLOCKPIN_SCK_NEEDED) - clockpin = true; -#endif break; case NRF_FUN_SPIM_MOSI: NRF_PSEL_SPIM(reg, MOSI) = psel; write = 0U; dir = NRF_GPIO_PIN_DIR_OUTPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; -#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_SPIM_CLOCKPIN_MOSI_NEEDED) - clockpin = true; -#endif break; case NRF_FUN_SPIM_MISO: NRF_PSEL_SPIM(reg, MISO) = psel; @@ -176,9 +157,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, NRF_PSEL_SPIS(reg, SCK) = psel; dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; -#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_SPIS_CLOCKPIN_SCK_NEEDED) - clockpin = true; -#endif break; case NRF_FUN_SPIS_MOSI: NRF_PSEL_SPIS(reg, MOSI) = psel; @@ -189,9 +167,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, NRF_PSEL_SPIS(reg, MISO) = psel; dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; -#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_SPIS_CLOCKPIN_MISO_NEEDED) - clockpin = true; -#endif break; case NRF_FUN_SPIS_CSN: NRF_PSEL_SPIS(reg, CSN) = psel; @@ -213,9 +188,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, } dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; -#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_TWIM_CLOCKPIN_SCL_NEEDED) - clockpin = true; -#endif break; case NRF_FUN_TWIM_SDA: NRF_PSEL_TWIM(reg, SDA) = psel; @@ -224,9 +196,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, } dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_CONNECT; -#if NRF_GPIO_HAS_CLOCKPIN && defined(NRF_TWIM_CLOCKPIN_SDA_NEEDED) - clockpin = true; -#endif break; #endif /* defined(NRF_PSEL_TWIM) */ #if defined(NRF_PSEL_I2S) @@ -380,9 +349,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, nrf_gpio_cfg(pin, dir, input, NRF_GET_PULL(pins[i]), drive, NRF_GPIO_PIN_NOSENSE); -#if NRF_GPIO_HAS_CLOCKPIN - nrf_gpio_pin_clock_set(pin, clockpin); -#endif } } From 6157ceb6c091e559e3d82295e4c0f3b5eca8d09a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:27 +0200 Subject: [PATCH 1683/2300] Revert "[nrf fromtree] modules: hal_nordic: Align nRF54H20 nrfx_configs with nrfx templates" This reverts commit bdde95118bce09fa620c83d9b8bff6959077a2fb. Signed-off-by: Gerard Marull-Paretas --- .../nrfx_config_nrf54h20_enga_application.h | 27 ----------------- .../nrfx/nrfx_config_nrf54h20_enga_ppr.h | 29 +------------------ .../nrfx_config_nrf54h20_enga_radiocore.h | 27 ----------------- 3 files changed, 1 insertion(+), 82 deletions(-) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h index af74d9d3dc3..e6c79341b9a 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_application.h @@ -331,33 +331,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 - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 -#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_NUM_OF_CC_CHANNELS * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h index 65b3e2fa958..369fe18a81f 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_ppr.h @@ -18,7 +18,7 @@ * Integer value. Minimum: 0. Maximum: 3. */ #ifndef NRFX_DEFAULT_IRQ_PRIORITY -#define NRFX_DEFAULT_IRQ_PRIORITY 0 +#define NRFX_DEFAULT_IRQ_PRIORITY 3 #endif /** @@ -277,33 +277,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 - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 -#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_NUM_OF_CC_CHANNELS * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h index ca7bf3aca63..7b9a1c4b733 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_enga_radiocore.h @@ -385,33 +385,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 - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 -#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_NUM_OF_CC_CHANNELS * From 5d4ea06efc348e0dc59dd9508f915658b972e2ce Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:27 +0200 Subject: [PATCH 1684/2300] Revert "[nrf fromtree] drivers: nrf_qspi_nor: Handle anomaly 159 on nRF5340" This reverts commit 4580e21835ab345eff1ab258d60058e97e003b72. Signed-off-by: Gerard Marull-Paretas --- drivers/flash/nrf_qspi_nor.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index c2ac5f3f3ba..c0e8c397d8e 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -21,7 +21,6 @@ LOG_MODULE_REGISTER(qspi_nor, CONFIG_FLASH_LOG_LEVEL); #include "spi_nor.h" #include "jesd216.h" #include "flash_priv.h" -#include #include #include #include @@ -102,11 +101,6 @@ BUILD_ASSERT(INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), /* 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 -/* If anomaly 159 is to be prevented, only /1 divider can be used. */ -#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)) /* For 96 MHz > SCK >= 48 MHz, use HFCLK192M / 2 / (2*1) = 48 MHz */ #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_2 @@ -121,13 +115,6 @@ BUILD_ASSERT(INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), #define INST_0_SCK_CFG (DIV_ROUND_UP(NRF_QSPI_BASE_CLOCK_FREQ / 2, \ INST_0_SCK_FREQUENCY) - 1) #endif -/* After the base clock divider is changed, some time is needed for the new - * setting to take effect. This value specifies the delay (in microseconds) - * to be applied to ensure that the clock is ready when the QSPI operation - * 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 #else /* @@ -243,12 +230,6 @@ static inline int qspi_get_zephyr_ret_code(nrfx_err_t res) return -EINVAL; case NRFX_ERROR_INVALID_STATE: return -ECANCELED; -#if NRF53_ERRATA_159_ENABLE_WORKAROUND - case NRFX_ERROR_FORBIDDEN: - LOG_ERR("nRF5340 anomaly 159 conditions detected"); - LOG_ERR("Set the CPU clock to 64 MHz before starting QSPI operation"); - return -ECANCELED; -#endif case NRFX_ERROR_BUSY: case NRFX_ERROR_TIMEOUT: default: @@ -281,7 +262,6 @@ static inline void qspi_clock_div_change(void) * before a QSPI transfer is performed. */ nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); - k_busy_wait(BASE_CLOCK_SWITCH_DELAY_US); #endif } From 5e80e9ec6a437ff6b48d43ccd3041b13628c7231 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:28 +0200 Subject: [PATCH 1685/2300] Revert "[nrf fromtree] manifest: hal_nordic: update revision to have nrfx 3.4.0 release" This reverts commit 3c4c757e6f0a1df5de4b0f285b1dcf4ab67429e4. 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 9c375a568fe..f9cf79db073 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 13ac55b5b52c905642e9c54f069109d188aa5840 + revision: 5470822384781624efb2fda28cbc6a895a227677 path: modules/hal/nordic groups: - hal From d44f9d41d265acb2f73754b64af6aa794c3214ec Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:28 +0200 Subject: [PATCH 1686/2300] Revert "[nrf fromlist] soc: nordic: vpr: always select HAS_FLASH_LOAD_OFFSET" This reverts commit 5dd838f21312d6bc88c2acc51d96f8f4938abefe. Signed-off-by: Gerard Marull-Paretas --- soc/riscv/nordic_nrf/common/vpr/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/riscv/nordic_nrf/common/vpr/Kconfig b/soc/riscv/nordic_nrf/common/vpr/Kconfig index baef3432a90..70ac63e7204 100644 --- a/soc/riscv/nordic_nrf/common/vpr/Kconfig +++ b/soc/riscv/nordic_nrf/common/vpr/Kconfig @@ -14,6 +14,6 @@ config RISCV_CORE_NORDIC_VPR select RISCV_ISA_EXT_ZIFENCEI select RISCV_SOC_HAS_ISR_STACKING select RISCV_SOC_CONTEXT_SAVE - select HAS_FLASH_LOAD_OFFSET + select HAS_FLASH_LOAD_OFFSET if XIP help Enable support for the RISC-V Nordic VPR core. From d770be6302e845c4f34186a9b9d7358158205869 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:28 +0200 Subject: [PATCH 1687/2300] Revert "[nrf noup] samples: smp_svr: configuration for nrf54l15" This reverts commit a55a68f01811d66b52ce9d0e82744d78792db3c1. Signed-off-by: Gerard Marull-Paretas --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 373c3acccb9..a13270e5845 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -12,11 +12,9 @@ tests: - nrf52840dk_nrf52840 - pinnacle_100_dvk - mg100 - - nrf54l15pdk_nrf54l15_cpuapp integration_platforms: - nrf52dk_nrf52832 - nrf52840dk_nrf52840 - - nrf54l15pdk_nrf54l15_cpuapp sample.mcumgr.smp_svr.udp: extra_args: OVERLAY_CONFIG="overlay-udp.conf" platform_allow: frdm_k64f From 2c72c281f8f9afb8d0c2630f93d06347f92e2080 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:28 +0200 Subject: [PATCH 1688/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx: propagate new configs to nrfx" This reverts commit 55663b1e4975a97626257a4feb67a6909800826c. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/nrfx/CMakeLists.txt | 2 -- soc/arm/nordic_nrf/nrf54l/Kconfig.soc | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 92aa3962f61..285293722bb 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -168,8 +168,6 @@ if(CONFIG_SOC_NRF54L15) endif() zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_CLOCK_CONFIG NRF_SKIP_CLOCK_CONFIGURATION) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_DISABLE_FICR_TRIMCNF NRF_DISABLE_FICR_TRIMCNF) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE NRF_SKIP_GLITCHDETECTOR_DISABLE) if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib_lumos.c) diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc index f8eadd1388d..18c2517df92 100644 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc @@ -37,11 +37,12 @@ config SOC_NRF54LX_DISABLE_FICR_TRIMCNF help Disable trimming of the device. When the device is trimmed it will copy all the trimming values from FICR into the target - addresses. + addresses. When TF-M is enabled it will trim the device before + booting this image. config SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE bool "Skip disabling glitch detector" - default y if TRUSTED_EXECUTION_NONSECURE + default n help With this option, the glitch detector is not disabled during system initialization. The CPU runs with the default state of glitch detector. From 096eb373623bf5a244274e2f5cab84e0c693e60d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:28 +0200 Subject: [PATCH 1689/2300] Revert "[nrf fromtree] soc: nordic: nrf54l: add two new Kconfig options" This reverts commit f03e194923c1403b9cb9a423d6d2b5d9cf5553f3. Signed-off-by: Gerard Marull-Paretas --- soc/arm/nordic_nrf/nrf54l/Kconfig.soc | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc index 18c2517df92..915b1e4b2d2 100644 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc @@ -31,22 +31,6 @@ config SOC_NRF54LX_SKIP_CLOCK_CONFIG With this option, the CPU clock frequency is not set during system initialization. The CPU runs with the default, hardware-selected frequency. -config SOC_NRF54LX_DISABLE_FICR_TRIMCNF - bool "Disable trimming of the device" - default y if TRUSTED_EXECUTION_NONSECURE - help - Disable trimming of the device. When the device is trimmed it - will copy all the trimming values from FICR into the target - addresses. When TF-M is enabled it will trim the device before - booting this image. - -config SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE - bool "Skip disabling glitch detector" - default n - help - With this option, the glitch detector is not disabled during system initialization. - The CPU runs with the default state of glitch detector. - config SOC_NRF_FORCE_CONSTLAT bool "Force constant-latency mode" help From f1b95e4ddd3cc87c96bc2cc76f62190c0eb9e4d0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:29 +0200 Subject: [PATCH 1690/2300] Revert "[nrf fromlist] soc: nordic: Refactor soc_secure.h" This reverts commit a1ff51de6be0cf34387a1e6fea3811196768101d. Signed-off-by: Gerard Marull-Paretas --- drivers/hwinfo/hwinfo_nrf.c | 12 +---- drivers/ieee802154/ieee802154_nrf5.c | 11 ----- soc/arm/nordic_nrf/common/soc_secure.h | 64 +++++++++++++------------- 3 files changed, 33 insertions(+), 54 deletions(-) diff --git a/drivers/hwinfo/hwinfo_nrf.c b/drivers/hwinfo/hwinfo_nrf.c index 8b644f2f60e..4375cf05b2f 100644 --- a/drivers/hwinfo/hwinfo_nrf.c +++ b/drivers/hwinfo/hwinfo_nrf.c @@ -7,17 +7,12 @@ #include #include #include +#include #include #ifndef CONFIG_BOARD_QEMU_CORTEX_M0 #include #endif - -#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) #include -#else -#include -#endif - struct nrf_uid { uint32_t id[2]; }; @@ -27,12 +22,7 @@ ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length) struct nrf_uid dev_id; uint32_t deviceid[2]; -#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) soc_secure_read_deviceid(deviceid); -#else - deviceid[0] = nrf_ficr_deviceid_get(NRF_FICR, 0); - deviceid[1] = nrf_ficr_deviceid_get(NRF_FICR, 1); -#endif dev_id.id[0] = sys_cpu_to_be32(deviceid[1]); dev_id.id[1] = sys_cpu_to_be32(deviceid[0]); diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 4cbdd9eb607..67b5431e9cc 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -25,13 +25,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include #include - -#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) #include -#else -#include -#endif - #include #include #include @@ -126,12 +120,7 @@ static void nrf5_get_eui64(uint8_t *mac) mac[index++] = (IEEE802154_NRF5_VENDOR_OUI >> 8) & 0xff; mac[index++] = IEEE802154_NRF5_VENDOR_OUI & 0xff; -#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) soc_secure_read_deviceid(deviceid); -#else - deviceid[0] = nrf_ficr_deviceid_get(NRF_FICR, 0); - deviceid[1] = nrf_ficr_deviceid_get(NRF_FICR, 1); -#endif factoryAddress = (uint64_t)deviceid[EUI64_ADDR_HIGH] << 32; factoryAddress |= deviceid[EUI64_ADDR_LOW]; diff --git a/soc/arm/nordic_nrf/common/soc_secure.h b/soc/arm/nordic_nrf/common/soc_secure.h index 28d18e9b4bb..d38d66ab488 100644 --- a/soc/arm/nordic_nrf/common/soc_secure.h +++ b/soc/arm/nordic_nrf/common/soc_secure.h @@ -9,44 +9,20 @@ #include #if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) -int soc_secure_mem_read(void *dst, void *src, size_t len); #if NRF_GPIO_HAS_SEL void soc_secure_gpio_pin_mcu_select(uint32_t pin_number, nrf_gpio_pin_sel_t mcu); #endif -#else /* defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ -static inline int soc_secure_mem_read(void *dst, void *src, size_t len) -{ - (void)memcpy(dst, src, len); - return 0; -} -#if NRF_GPIO_HAS_SEL -static inline void soc_secure_gpio_pin_mcu_select(uint32_t pin_number, nrf_gpio_pin_sel_t mcu) -{ - nrf_gpio_pin_control_select(pin_number, mcu); -} -#endif /* NRF_GPIO_HAS_SEL */ - -#endif /* defined CONFIG_TRUSTED_EXECUTION_NONSECURE */ - -/* Include these soc_secure_* functions only when the FICR is mapped as secure only */ -#if defined(NRF_FICR_S) -#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) -static inline void soc_secure_read_deviceid(uint32_t deviceid[2]) -{ - int err; +int soc_secure_mem_read(void *dst, void *src, size_t len); - err = soc_secure_mem_read(deviceid, (void *)&NRF_FICR_S->INFO.DEVICEID, - 2 * sizeof(uint32_t)); - __ASSERT(err == 0, "Secure read error (%d)", err); -} #if defined(CONFIG_SOC_HFXO_CAP_INTERNAL) static inline uint32_t soc_secure_read_xosc32mtrim(void) { uint32_t xosc32mtrim; int err; - err = soc_secure_mem_read(&xosc32mtrim, (void *)&NRF_FICR_S->XOSC32MTRIM, + err = soc_secure_mem_read(&xosc32mtrim, + (void *)&NRF_FICR_S->XOSC32MTRIM, sizeof(xosc32mtrim)); __ASSERT(err == 0, "Secure read error (%d)", err); @@ -54,18 +30,42 @@ static inline uint32_t soc_secure_read_xosc32mtrim(void) } #endif /* defined(CONFIG_SOC_HFXO_CAP_INTERNAL) */ -#else /* defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ static inline void soc_secure_read_deviceid(uint32_t deviceid[2]) { - deviceid[0] = nrf_ficr_deviceid_get(NRF_FICR_S, 0); - deviceid[1] = nrf_ficr_deviceid_get(NRF_FICR_S, 1); + int err; + + err = soc_secure_mem_read(deviceid, + (void *)&NRF_FICR_S->INFO.DEVICEID, + 2 * sizeof(uint32_t)); + __ASSERT(err == 0, "Secure read error (%d)", err); +} + +#else /* defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ + +static inline int soc_secure_mem_read(void *dst, void *src, size_t len) +{ + (void)memcpy(dst, src, len); + return 0; +} + +#if NRF_GPIO_HAS_SEL +static inline void soc_secure_gpio_pin_mcu_select(uint32_t pin_number, + nrf_gpio_pin_sel_t mcu) +{ + nrf_gpio_pin_control_select(pin_number, mcu); } +#endif /* NRF_GPIO_HAS_SEL */ + #if defined(CONFIG_SOC_HFXO_CAP_INTERNAL) static inline uint32_t soc_secure_read_xosc32mtrim(void) { - return NRF_FICR_S->XOSC32MTRIM; + return NRF_FICR->XOSC32MTRIM; } #endif /* defined(CONFIG_SOC_HFXO_CAP_INTERNAL) */ +static inline void soc_secure_read_deviceid(uint32_t deviceid[2]) +{ + deviceid[0] = nrf_ficr_deviceid_get(NRF_FICR, 0); + deviceid[1] = nrf_ficr_deviceid_get(NRF_FICR, 1); +} #endif /* defined CONFIG_TRUSTED_EXECUTION_NONSECURE */ -#endif /* defined(NRF_FICR_S) */ From 89abb6e59ed99923ea974f1370a67dfc9ef34e3f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:29 +0200 Subject: [PATCH 1691/2300] Revert "[nrf fromtree] soc: nordic: nrf54l: Remove redundant option" This reverts commit 3b2bdcf3c698238a40ce79fcc580c27d41b56768. Signed-off-by: Gerard Marull-Paretas --- soc/arm/nordic_nrf/nrf54l/Kconfig.soc | 6 ++++++ soc/arm/nordic_nrf/nrf54l/soc.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc index 915b1e4b2d2..c42c8cfc9b3 100644 --- a/soc/arm/nordic_nrf/nrf54l/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf54l/Kconfig.soc @@ -47,6 +47,12 @@ config SOC_NRF54L_VREG_MAIN_DCDC config SOC_NRF54L_NORMAL_VOLTAGE_MODE bool "NRF54L Normal Voltage Mode." +config SOC_NRF54L_GLITCHDET_WORKAROUND + bool "Workaround that disables glitch detector" + default y + help + Temporary workaround - disabling glitch detector to limit power consumption. + if NRF_GRTC_TIMER config ELV_GRTC_LFXO_ALLOWED diff --git a/soc/arm/nordic_nrf/nrf54l/soc.c b/soc/arm/nordic_nrf/nrf54l/soc.c index 6af0ff4ebcd..a7b286fa048 100644 --- a/soc/arm/nordic_nrf/nrf54l/soc.c +++ b/soc/arm/nordic_nrf/nrf54l/soc.c @@ -42,6 +42,10 @@ static int nordicsemi_nrf54l_init(void) /* Enable ICACHE */ sys_cache_instr_enable(); + if (IS_ENABLED(CONFIG_SOC_NRF54L_GLITCHDET_WORKAROUND)) { + nrf_glitchdet_enable_set(NRF_GLITCHDET, false); + } + #if DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, internal) uint32_t xosc32ktrim = NRF_FICR->XOSC32KTRIM; From aa8ad236cadb054c4c4cdbfb6572cc079899a151 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:29 +0200 Subject: [PATCH 1692/2300] Revert "[nrf fromtree] samples: hci_uart_async: Dont try to receive 0 bytes" This reverts commit fc3886f97f63a62a7d6e5f1f8621db297ad7ce21. Signed-off-by: Gerard Marull-Paretas --- samples/bluetooth/hci_uart_async/src/hci_uart_async.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 cf9cc600d5c..4d276e42378 100644 --- a/samples/bluetooth/hci_uart_async/src/hci_uart_async.c +++ b/samples/bluetooth/hci_uart_async/src/hci_uart_async.c @@ -254,9 +254,7 @@ static void h2c_h4_transport(void) LOG_DBG("h2c: payload_size %u", payload_size); - if (payload_size == 0) { - /* Done, dont rx zero bytes */ - } else if (payload_size <= net_buf_tailroom(buf)) { + if (payload_size <= net_buf_tailroom(buf)) { uint8_t *payload_dst = net_buf_add(buf, payload_size); err = uart_h2c_rx(payload_dst, payload_size); From ff850f2e1c50c0b5744443c27bff05bf678c00c2 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:29 +0200 Subject: [PATCH 1693/2300] Revert "[nrf fromtree] drivers/counter nrfx: Fix with DT instance not matching device instance" This reverts commit a8da6e408aa22c5002557d0c55f0ed2c390dfbd0. Signed-off-by: Gerard Marull-Paretas --- drivers/counter/counter_nrfx_timer.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/drivers/counter/counter_nrfx_timer.c b/drivers/counter/counter_nrfx_timer.c index 1fe3a98f8d7..47537b16d7d 100644 --- a/drivers/counter/counter_nrfx_timer.c +++ b/drivers/counter/counter_nrfx_timer.c @@ -28,12 +28,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL); #define COUNTER_OVERFLOW_SHORT NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK #define COUNTER_READ_CC NRF_TIMER_CC_CHANNEL1 -#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX) -#define MAYBE_CONST_CONFIG -#else -#define MAYBE_CONST_CONFIG const -#endif - struct counter_nrfx_data { counter_top_callback_t top_cb; void *top_user_data; @@ -289,16 +283,7 @@ static uint32_t get_pending_int(const struct device *dev) static int init_timer(const struct device *dev, const struct counter_timer_config *config) { - MAYBE_CONST_CONFIG struct counter_nrfx_config *nrfx_config = - (MAYBE_CONST_CONFIG struct counter_nrfx_config *)dev->config; - -#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX) - /* For simulated devices we need to convert the hardcoded DT address from the real - * peripheral into the correct one for simulation - */ - nrfx_config->timer = nhw_convert_periph_base_addr(nrfx_config->timer); -#endif - + const struct counter_nrfx_config *nrfx_config = dev->config; NRF_TIMER_Type *reg = nrfx_config->timer; nrf_timer_bit_width_set(reg, config->bit_width); @@ -445,7 +430,7 @@ static const struct counter_driver_api counter_nrfx_driver_api = { static struct counter_nrfx_ch_data \ counter##idx##_ch_data[CC_TO_ID(DT_INST_PROP(idx, cc_num))]; \ LOG_INSTANCE_REGISTER(LOG_MODULE_NAME, idx, CONFIG_COUNTER_LOG_LEVEL); \ - static MAYBE_CONST_CONFIG struct counter_nrfx_config nrfx_counter_##idx##_config = { \ + static const struct counter_nrfx_config nrfx_counter_##idx##_config = { \ .info = { \ .max_top_value = (uint32_t)BIT64_MASK(DT_INST_PROP(idx, max_bit_width)),\ .freq = TIMER_CLOCK((NRF_TIMER_Type *)DT_INST_REG_ADDR(idx)) / \ @@ -454,7 +439,7 @@ static const struct counter_driver_api counter_nrfx_driver_api = { .channels = CC_TO_ID(DT_INST_PROP(idx, cc_num)), \ }, \ .ch_data = counter##idx##_ch_data, \ - .timer = (NRF_TIMER_Type *)DT_INST_REG_ADDR(idx), \ + .timer = (NRF_TIMER_Type *)_CONCAT(NRF_TIMER, idx), \ LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \ }; \ DEVICE_DT_INST_DEFINE(idx, \ From debaf47db5fe1f35e0dcf0885063c262acc46c79 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:29 +0200 Subject: [PATCH 1694/2300] Revert "[nrf fromtree] manifest: Update nrf hw models to latest" This reverts commit 18b88cb8aa8a88594594723c0c323eb5f6803659. 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 f9cf79db073..f8e75062ad4 100644 --- a/west.yml +++ b/west.yml @@ -295,7 +295,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 319e3ebd3134935c330980dfac53d05d28c0af9a + revision: 52d0b4b7b7431d8da6222cc3b17a8afdcb099baf path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: da78aea63159771956fe0c9263f2e6985b66e9d5 From 1056520b0a3d914b4cb0591abfd27e153f4e8d54 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:30 +0200 Subject: [PATCH 1695/2300] Revert "[nrf fromtree] tests: llext: Set min_ram requirement for readonly_mpu variant" This reverts commit 41b38928f63ed79960084cf415299703b44d870f. Signed-off-by: Gerard Marull-Paretas --- tests/subsys/llext/hello_world/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/subsys/llext/hello_world/testcase.yaml b/tests/subsys/llext/hello_world/testcase.yaml index 2b324bea5ab..c977dc5f94f 100644 --- a/tests/subsys/llext/hello_world/testcase.yaml +++ b/tests/subsys/llext/hello_world/testcase.yaml @@ -13,7 +13,6 @@ tests: - arch:arm:CONFIG_ARM_MPU=n - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.readonly_mpu: - min_ram: 128 arch_exclude: xtensa # for now filter: CONFIG_CPU_HAS_MPU extra_configs: From 4295836cc5be98b8df2b64c1cb6deb119e61039f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:30 +0200 Subject: [PATCH 1696/2300] Revert "[nrf fromtree] posix: socket: Add missing recvmsg()" This reverts commit c20c5afe1fd6cbd301e16e12144e0956cee0c9e6. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/posix/sys/socket.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/zephyr/posix/sys/socket.h b/include/zephyr/posix/sys/socket.h index 235bd76cc59..af4f48e3907 100644 --- a/include/zephyr/posix/sys/socket.h +++ b/include/zephyr/posix/sys/socket.h @@ -88,11 +88,6 @@ static inline ssize_t sendmsg(int sock, const struct msghdr *message, return zsock_sendmsg(sock, message, flags); } -static inline ssize_t recvmsg(int sock, struct msghdr *msg, int flags) -{ - return zsock_recvmsg(sock, msg, flags); -} - static inline ssize_t recvfrom(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) { From fe0dd8988368003c61773dac81b9feacf4bf521c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:30 +0200 Subject: [PATCH 1697/2300] Revert "[nrf fromtree] drivers: input: Fix uninitialized closest_mv variable warning" This reverts commit a74f47a3f06d47d92edf3c0c9657816daae43611. Signed-off-by: Gerard Marull-Paretas --- drivers/input/input_adc_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/input_adc_keys.c b/drivers/input/input_adc_keys.c index d37d79bf098..2e24ffd097d 100644 --- a/drivers/input/input_adc_keys.c +++ b/drivers/input/input_adc_keys.c @@ -70,7 +70,7 @@ static inline int32_t adc_keys_read(const struct device *dev) static inline void adc_keys_process(const struct device *dev) { const struct adc_keys_config *cfg = dev->config; - int32_t sample_mv, closest_mv = 0; + int32_t sample_mv, closest_mv; uint32_t diff, closest_diff = UINT32_MAX; const struct adc_keys_code_config *code_cfg; struct adc_keys_key_state *key_state; From a8a5ce7a3e527b846695fa0ca41ca6168b98c8e3 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:30 +0200 Subject: [PATCH 1698/2300] Revert "[nrf fromtree] sys: Include sys/util.h header in sys/atomic.h" This reverts commit e0363868fd5447ceb1fb0565380f863cd210a0d0. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/sys/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/sys/atomic.h b/include/zephyr/sys/atomic.h index 86ba2cdf144..3982e428038 100644 --- a/include/zephyr/sys/atomic.h +++ b/include/zephyr/sys/atomic.h @@ -15,7 +15,7 @@ #include /* IWYU pragma: export */ #include -#include +#include #ifdef __cplusplus extern "C" { From b8eed899bcf186b48440586df7edcada10c07656 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:30 +0200 Subject: [PATCH 1699/2300] Revert "[nrf fromlist] dts: arm: nordic: nrf54l15 write block size" This reverts commit be32f653555d4445f4ca525cd8e0021a81fbbf31. Signed-off-by: Gerard Marull-Paretas --- dts/arm/nordic/nrf54l_common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index c537554b05b..3214daeac84 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -18,7 +18,7 @@ rram0: rram@0 { compatible = "soc-nv-flash"; erase-block-size = <4096>; - write-block-size = <16>; + write-block-size = <1>; }; }; }; From 80321903d62e2f2a4729f4993ac20d749575515d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:31 +0200 Subject: [PATCH 1700/2300] Revert "[nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add temp status okay" This reverts commit d3a903aff7b36e992ec3b5ce32eeb94dea426de0. Signed-off-by: Gerard Marull-Paretas --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index c801ddc8dc5..c009f0bd544 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -133,10 +133,6 @@ status = "okay"; }; -&temp { - status = "okay"; -}; - &rram0 { partitions { compatible = "fixed-partitions"; From f15b6f0b7443d616fcdff38eb9dfc173ab4ef386 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:31 +0200 Subject: [PATCH 1701/2300] Revert "[nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add ieee802154 status okay" This reverts commit 8a134f993662ebb63a790d9e479669bc7a171c0c. Signed-off-by: Gerard Marull-Paretas --- .../arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index c009f0bd544..9876e3996e8 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -129,10 +129,6 @@ status = "okay"; }; -&ieee802154 { - status = "okay"; -}; - &rram0 { partitions { compatible = "fixed-partitions"; From aa345f6bf5b667e17b402408750f4cf1a5553c32 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:31 +0200 Subject: [PATCH 1702/2300] Revert "[nrf noup] boards: arm: kconfig: ROM_START_OFFSET" This reverts commit a5a8676af4c2702e5570cdb1381dceadf2d8b6c0. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig index 94b0fc7299d..3e47a0bb583 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig @@ -10,7 +10,7 @@ config BT_CTLR default BT config ROM_START_OFFSET - default 0 if PARTITION_MANAGER_ENABLED + hex default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP From 8adf363d08f3015be10e6f1fc610543a969e6f1e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:31 +0200 Subject: [PATCH 1703/2300] Revert "[nrf noup] tree-wide: support NCS Partition Manager (PM) definitions" This reverts commit 39598424d22cc357cfb37365901c9a5cf733436b. Signed-off-by: Gerard Marull-Paretas --- arch/arm/core/mpu/arm_mpu_regions.c | 13 ------ cmake/modules/kernel.cmake | 4 -- drivers/flash/soc_flash_nrf.c | 11 ----- .../arch/arm/cortex_m/scripts/linker.ld | 46 ------------------- include/zephyr/storage/flash_map.h | 6 --- lib/heap/Kconfig | 2 +- lib/libc/common/source/stdlib/malloc.c | 18 +------- subsys/fs/littlefs_fs.c | 7 +-- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 ----------- 9 files changed, 4 insertions(+), 130 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index cfe1230c907..6af62f84078 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,9 +8,6 @@ #include #include -#if USE_PARTITION_MANAGER -#include -#endif static const struct arm_mpu_region mpu_regions[] = { /* Region 0 */ @@ -24,14 +21,6 @@ static const struct arm_mpu_region mpu_regions[] = { #endif /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", -#if USE_PARTITION_MANAGER - PM_SRAM_ADDRESS, -#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) - REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), -#else - REGION_RAM_ATTR(REGION_SRAM_SIZE)), -#endif -#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -39,8 +28,6 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif - -#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index 06e1642f362..a093d46691f 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -243,7 +243,3 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() - -if(ZEPHYR_NRF_MODULE_DIR) - include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) -endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index b5a3fefa1e5..cc840309264 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,11 +37,6 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER -#include -#include -#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ - #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -171,12 +166,6 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS - if (addr < PM_APP_ADDRESS) { - return soc_secure_mem_read(data, (void *)addr, len); - } -#endif - nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 14eb78f3e70..d061468d2ac 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -26,35 +26,6 @@ #endif #define RAMABLE_REGION RAM -#if USE_PARTITION_MANAGER - -#include - -#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) -/* We are linking against S1, create symbol containing the flash ID of S0. - * This is used when writing code operating on the "other" slot. - */ -_image_1_primary_slot_id = PM_S0_ID; - -#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ - -#ifdef PM_S1_ID -/* We are linking against S0, create symbol containing the flash ID of S1. - * This is used when writing code operating on the "other" slot. - */ -_image_1_primary_slot_id = PM_S1_ID; -#endif /* PM_S1_ID */ - -#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ - -#define ROM_ADDR PM_ADDRESS -#define ROM_SIZE PM_SIZE - -#define RAM_SIZE PM_SRAM_SIZE -#define RAM_ADDR PM_SRAM_ADDRESS - -#else /* ! USE_PARTITION_MANAGER */ - #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -87,23 +58,6 @@ _image_1_primary_slot_id = PM_S1_ID; #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS #endif -#endif /* USE_PARTITION_MANAGER */ - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) -#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) -#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) -#endif - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) -#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) -#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) -#endif - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) -#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) -#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) -#endif - #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index ffe386d6b7a..12f4f4c34a2 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -271,10 +271,6 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); -#if USE_PARTITION_MANAGER -#include -#else - /** * Returns non-0 value if fixed-partition of given DTS node label exists. * @@ -332,8 +328,6 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_DEVICE(label) \ DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))) -#endif /* USE_PARTITION_MANAGER */ - #ifdef __cplusplus } #endif diff --git a/lib/heap/Kconfig b/lib/heap/Kconfig index 68476eb735c..7f01b280b3b 100644 --- a/lib/heap/Kconfig +++ b/lib/heap/Kconfig @@ -68,7 +68,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index 2f469d673e4..e3a5db6f7d5 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,20 +25,6 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); -#if USE_PARTITION_MANAGER - -#include - -#define RAM_SIZE PM_SRAM_SIZE -#define RAM_ADDR PM_SRAM_ADDRESS - -#else /* ! USE_PARTITION_MANAGER */ - -#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) -#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS - -#endif /* USE_PARTITION_MANAGER */ - #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -120,8 +106,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ - ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ + ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index 3fc84c2922d..b373ca92ba8 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1054,12 +1054,7 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *) \ - COND_CODE_1(USE_PARTITION_MANAGER, \ - (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ - (FIXED_PARTITION_ID(littlefs_storage)), \ - (FIXED_PARTITION_ID(storage)))), \ - (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ + .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index 9996e1d74d9..a74e46b8520 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,35 +13,8 @@ extern "C" { #endif -#if CONFIG_PARTITION_MANAGER_ENABLED - -#include "pm_config.h" - -#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) - -#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) -#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS -#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE -#else -/* The current image is a child image in a different domain than the image - * which defined the required values. To reach the values of the parent domain - * we use the 'PM__' variant of the define. - */ -#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS -#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE -#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ - -#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) -#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ - -#else - -#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) -#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) - -#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From dfba153563167d6e850227e949347caca0db2695 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:32 +0200 Subject: [PATCH 1704/2300] Revert "[nrf noup] ci: clang: parallel execution" This reverts commit 368628d23026e5c141b92816fefb801640cfb908. Signed-off-by: Gerard Marull-Paretas --- .github/workflows/clang.yaml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index b28d3c387e4..17fbc1c72bd 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -8,7 +8,8 @@ concurrency: jobs: clang-build: - runs-on: ubuntu-latest + if: github.repository_owner == 'zephyrproject-rtos' + runs-on: zephyr-runner-linux-x64-4xlarge container: image: ghcr.io/zephyrproject-rtos/ci:v0.26.7 options: '--entrypoint /bin/bash' @@ -18,12 +19,10 @@ jobs: fail-fast: false matrix: platform: ["native_sim"] - subset: [1, 2, 3, 4, 5] env: LLVM_TOOLCHAIN_PATH: /usr/lib/llvm-16 COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} BASE_REF: ${{ github.base_ref }} - MATRIX_SIZE: 5 outputs: report_needed: ${{ steps.twister.outputs.report_needed }} steps: @@ -88,7 +87,7 @@ jobs: id: cache-ccache uses: zephyrproject-rtos/action-s3-cache@v1.2.0 with: - key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.subset }}-ccache + key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.platform }}-ccache path: /github/home/.cache/ccache aws-s3-bucket: ccache.zephyrproject.org aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }} @@ -101,16 +100,6 @@ jobs: test -d github/home/.cache/ccache && rm -rf /github/home/.cache/ccache && mv github/home/.cache/ccache /github/home/.cache/ccache ccache -M 10G -s - - name: Build test plan with Twister - id: twister_test_plan - run: | - export ZEPHYR_BASE=${PWD} - 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 -p native_posix -c origin/${BASE_REF}.. - - - name: Run Tests with Twister id: twister run: | @@ -124,7 +113,7 @@ jobs: if [ -s testplan.json ]; then echo "report_needed=1" >> $GITHUB_OUTPUT # Full twister but with options based on changes - ./scripts/twister --inline-logs -M -N -v --load-tests testplan.json --retry-failed 2 --subset ${{matrix.subset}}/${MATRIX_SIZE} + ./scripts/twister --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 @@ -139,7 +128,7 @@ jobs: if: always() && steps.twister.outputs.report_needed != 0 uses: actions/upload-artifact@v4 with: - name: Unit Test Results (Subset ${{ matrix.subset }}) + name: Unit Test Results (Subset ${{ matrix.platform }}) path: twister-out/twister.xml clang-build-results: From e4f8129a466a73459eddc3aef3cc390a38354c4b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:32 +0200 Subject: [PATCH 1705/2300] Revert "[nrf fromlist] modules: hal_nordic: Enable support for DPPI on nRF54H20" This reverts commit 4378c6032eefd27fd4e0216051287b160af0516b. Signed-off-by: Gerard Marull-Paretas --- drivers/timer/nrf_grtc_timer.c | 4 +- modules/hal_nordic/nrfx/CMakeLists.txt | 8 -- modules/hal_nordic/nrfx/nrfx_config.h | 121 ++----------------------- 3 files changed, 12 insertions(+), 121 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 51f00687e7e..7ac6eca80eb 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -21,8 +21,8 @@ #if !DT_NODE_HAS_PROP(GRTC_NODE, owned_channels) #error GRTC owned-channels DT property is not defined #endif -#define OWNED_CHANNELS_MASK NRFX_CONFIG_MASK_DT(GRTC_NODE, owned_channels) -#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_MASK_DT(GRTC_NODE, child_owned_channels) +#define OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(owned_channels) +#define CHILD_OWNED_CHANNELS_MASK NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels) #if ((OWNED_CHANNELS_MASK | CHILD_OWNED_CHANNELS_MASK) != OWNED_CHANNELS_MASK) #error GRTC child-owned-channels DT property must be a subset of owned-channels #endif diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 285293722bb..29f09783f2f 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -174,14 +174,6 @@ if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) zephyr_library_sources(${NRFX_DIR}/soc/interconnect/dppic_ppib/nrfx_interconnect_dppic_ppib.c) endif() -if(CONFIG_SOC_SERIES_NRF54HX AND - (CONFIG_DT_HAS_NORDIC_NRF_DPPIC_LOCAL_ENABLED OR - CONFIG_DT_HAS_NORDIC_NRF_DPPIC_GLOBAL_ENABLED)) - zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib.c) - zephyr_library_sources(${NRFX_DIR}/soc/interconnect/apb/nrfx_interconnect_apb.c) - zephyr_library_sources(${NRFX_DIR}/soc/interconnect/ipct/nrfx_interconnect_ipct.c) -endif() - # Get the SVD file for the current SoC macro(mdk_svd_ifdef feature_toggle filename) if(${feature_toggle}) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 206fa2ed5dc..0daa476cb9d 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -8,7 +8,6 @@ #define NRFX_CONFIG_H__ #include -#include /* * These are mappings of Kconfig options enabling nrfx drivers and particular @@ -795,127 +794,27 @@ #define NRF_PERIPH(P) P##_S #endif -#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) BIT(DT_PROP_BY_IDX(node_id, prop, idx)) -#define NRFX_CONFIG_MASK_DT(node_id, prop) \ - (COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \ - (DT_FOREACH_PROP_ELEM_SEP(node_id, prop, NRFX_CONFIG_BIT_DT, (|))), \ - (0))) - /* If the GRTC system timer driver is to be used, prepare definitions required * by the nrfx_grtc driver (NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK and * NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS) based on information from devicetree. */ #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) +#define NRFX_CONFIG_BIT_DT(node_id, prop, idx) \ + BIT(DT_PROP_BY_IDX(node_id, prop, idx)) +#define NRFX_CONFIG_GRTC_MASK_DT(prop) \ + (COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(0, nordic_nrf_grtc), prop), \ + (DT_FOREACH_PROP_ELEM_SEP(DT_INST(0, nordic_nrf_grtc), prop, \ + NRFX_CONFIG_BIT_DT, (|))), \ + (0))) + #define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK \ - (NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), owned_channels) & \ - ~NRFX_CONFIG_MASK_DT(DT_INST(0, nordic_nrf_grtc), child_owned_channels)) + (NRFX_CONFIG_GRTC_MASK_DT(owned_channels) & \ + ~NRFX_CONFIG_GRTC_MASK_DT(child_owned_channels)) #define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS \ (DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), owned_channels, 0) - \ DT_PROP_LEN_OR(DT_INST(0, nordic_nrf_grtc), child_owned_channels, 0)) #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) */ -/* If global of local DPPIC peripherals are used, provide the following macro - * definitions required by the interconnect/apb layer: - * - NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) - * - NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) - * - NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE - * - NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE - * based on information from devicetree. - */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || \ - DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_local) -#ifndef NRFX_DPPI_ENABLED -#define NRFX_DPPI_ENABLED 1 -#endif -/* Source (publish) channels masks generation. */ -#define NRFX_DPPI_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels) - -/* Sink (subscribe) channels masks generation. */ -#define NRFX_DPPI_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_MASK_DT(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels) - -#define NRFX_DPPI_PUB_OR_SUB_MASK(inst_num) \ - UTIL_OR(DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), source_channels), \ - DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(dppic, inst_num)), sink_channels)) - -/* Variables names generation. */ -#define NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) -#define NRFX_DPPI_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(DT_NODELABEL(_CONCAT(dppic, inst_num))) - -/* Variables entries generation. */ -#define NRFX_CONFIG_DPPI_CHANNELS_ENTRY(node_id) \ - static nrfx_atomic_t NRFX_CONFIG_DPPI_CHANNELS_ENTRY_NAME(node_id) \ - __attribute__((used)) = \ - NRFX_CONFIG_MASK_DT(node_id, source_channels) | \ - NRFX_CONFIG_MASK_DT(node_id, sink_channels); -#define NRFX_INTERCONNECT_APB_GLOBAL_DPPI_DEFINE \ - DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_global, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) -#define NRFX_INTERCONNECT_APB_LOCAL_DPPI_DEFINE \ - DT_FOREACH_STATUS_OKAY(nordic_nrf_dppic_local, NRFX_CONFIG_DPPI_CHANNELS_ENTRY) -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_dppic_global) || ... */ - -/* If local or global DPPIC peripherals are used, provide the following macro - * definitions required by the interconnect/ipct layer: - * - NRFX_IPCTx_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_IPCTx_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) - * - NRFX_IPCT_PUB_OR_SUB_MASK(inst_num) - * - NRFX_IPCTx_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) - * - NRFX_INTERCONNECT_IPCT_GLOBAL_DEFINE - * - NRFX_INTERCONNECT_IPCT_LOCAL_DEFINE - * based on information from devicetree. - */ -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_global) || \ - DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_local) -/* Channels masks generation. */ -#define NRFX_CONFIG_IPCT_MASK_DT(node_id) \ - COND_CODE_1(DT_NODE_HAS_PROP(node_id, owned_channels), \ - (NRFX_CONFIG_MASK_DT(node_id, owned_channels)), \ - (COND_CODE_1(DT_NODE_HAS_COMPAT(node_id, nordic_nrf_ipct_local), \ - (BIT_MASK(DT_PROP(node_id, channels))), (0)))) - -#if defined(NRF_APPLICATION) -#define NRFX_CONFIG_IPCT_LOCAL_NODE DT_NODELABEL(cpuapp_ipct) -#elif defined(NRF_RADIOCORE) -#define NRFX_CONFIG_IPCT_LOCAL_NODE DT_NODELABEL(cpurad_ipct) -#endif -#define NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num) \ - COND_CODE_1(IS_EMPTY(inst_num), \ - (NRFX_CONFIG_IPCT_LOCAL_NODE), \ - (DT_NODELABEL(_CONCAT(ipct, inst_num)))) - -#define NRFX_IPCTx_PUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_IPCT_MASK_DT(NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num)) - -#define NRFX_IPCTx_SUB_CONFIG_ALLOWED_CHANNELS_MASK_BY_INST_NUM(inst_num) \ - NRFX_CONFIG_IPCT_MASK_DT(NRFX_CONFIG_IPCT_NODE_BY_INST_NUM(inst_num)) - -#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_PROP(DT_NODELABEL(_CONCAT(ipct, inst_num)), owned_channels))) - -/* Variables names generation. */ -#define NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(node_id) _CONCAT(_CONCAT(m_, node_id), _channels) -#define NRFX_IPCTx_CHANNELS_SINGLE_VAR_NAME_BY_INST_NUM(inst_num) \ - COND_CODE_1(IS_EMPTY(inst_num), \ - (NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(NRFX_CONFIG_IPCT_LOCAL_NODE)), \ - (NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(DT_NODELABEL(_CONCAT(ipct, inst_num))))) - -/* Variables entries generation. */ -#define NRFX_CONFIG_IPCT_CHANNELS_ENTRY(node_id) \ - static nrfx_atomic_t NRFX_CONFIG_IPCT_CHANNELS_ENTRY_NAME(node_id) \ - __attribute__((used)) = \ - NRFX_CONFIG_IPCT_MASK_DT(node_id); -#define NRFX_INTERCONNECT_IPCT_LOCAL_DEFINE \ - DT_FOREACH_STATUS_OKAY(nordic_nrf_ipct_local, NRFX_CONFIG_IPCT_CHANNELS_ENTRY) -#define NRFX_INTERCONNECT_IPCT_GLOBAL_DEFINE \ - DT_FOREACH_STATUS_OKAY(nordic_nrf_ipct_global, NRFX_CONFIG_IPCT_CHANNELS_ENTRY) -#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_ipct_global) || ... */ - #include #if defined(NRF51) #include From a8116f53123b5d8b6deb7b333eff6527033ba6bc Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:32 +0200 Subject: [PATCH 1706/2300] Revert "[nrf fromlist] manifest: Update hal_nordic revision" This reverts commit 70d831dfcfad758cf70b7a5712bcf442b563e067. 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 f8e75062ad4..a288009c15a 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 5470822384781624efb2fda28cbc6a895a227677 + revision: daf875285120be6b2825969b7a0abc3f415b248d path: modules/hal/nordic groups: - hal From 89a5417274e3679df6e3210502837de69bb00630 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:32 +0200 Subject: [PATCH 1707/2300] Revert "[nrf fromlist] soc: nordic_nrf: Add address validation entries for nRF54H/L dts nodes" This reverts commit 319fb4c47550b0adcd3eed7aba804b75aedbce30. Signed-off-by: Gerard Marull-Paretas --- soc/arm/nordic_nrf/validate_base_addresses.c | 76 -------------------- 1 file changed, 76 deletions(-) diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 04c7a1ae3cd..28ec231b132 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -133,39 +133,17 @@ CHECK_DT_REG(cryptocell, NRF_CRYPTOCELL); CHECK_DT_REG(ctrlap, NRF_CTRLAP); CHECK_DT_REG(dcnf, NRF_DCNF); CHECK_DT_REG(dppic, NRF_DPPIC); -CHECK_DT_REG(dppic00, NRF_DPPIC00); -CHECK_DT_REG(dppic10, NRF_DPPIC10); -CHECK_DT_REG(dppic20, NRF_DPPIC20); -CHECK_DT_REG(dppic30, NRF_DPPIC30); -CHECK_DT_REG(dppic020, NRF_DPPIC020); -CHECK_DT_REG(dppic120, NRF_DPPIC120); -CHECK_DT_REG(dppic130, NRF_DPPIC130); -CHECK_DT_REG(dppic131, NRF_DPPIC131); -CHECK_DT_REG(dppic132, NRF_DPPIC132); -CHECK_DT_REG(dppic133, NRF_DPPIC133); -CHECK_DT_REG(dppic134, NRF_DPPIC134); -CHECK_DT_REG(dppic135, NRF_DPPIC135); -CHECK_DT_REG(dppic136, NRF_DPPIC136); CHECK_DT_REG(ecb, NRF_ECB); -CHECK_DT_REG(ecb020, NRF_ECB020); -CHECK_DT_REG(ecb030, NRF_ECB030); CHECK_DT_REG(egu0, NRF_EGU0); CHECK_DT_REG(egu1, NRF_EGU1); CHECK_DT_REG(egu2, NRF_EGU2); CHECK_DT_REG(egu3, NRF_EGU3); CHECK_DT_REG(egu4, NRF_EGU4); CHECK_DT_REG(egu5, NRF_EGU5); -CHECK_DT_REG(egu10, NRF_EGU10); -CHECK_DT_REG(egu20, NRF_EGU20); -CHECK_DT_REG(egu020, NRF_EGU020); CHECK_DT_REG(ficr, NRF_FICR); CHECK_DT_REG(flash_controller, NRF_NVMC); CHECK_DT_REG(gpio0, NRF_P0); CHECK_DT_REG(gpio1, NRF_P1); -CHECK_DT_REG(gpio2, NRF_P2); -CHECK_DT_REG(gpio6, NRF_P6); -CHECK_DT_REG(gpio7, NRF_P7); -CHECK_DT_REG(gpio9, NRF_P9); CHECK_DT_REG(gpiote, NRF_GPIOTE); CHECK_DT_REG(gpiote0, NRF_GPIOTE0); CHECK_DT_REG(gpiote1, NRF_GPIOTE1); @@ -177,25 +155,8 @@ CHECK_I2C_REG(i2c0, 0); CHECK_I2C_REG(i2c1, 1); CHECK_DT_REG(i2c2, NRF_TWIM2); CHECK_DT_REG(i2c3, NRF_TWIM3); -CHECK_DT_REG(i2c20, NRF_TWIM20); -CHECK_DT_REG(i2c21, NRF_TWIM21); -CHECK_DT_REG(i2c22, NRF_TWIM22); -CHECK_DT_REG(i2c30, NRF_TWIM30); -CHECK_DT_REG(i2c130, NRF_TWIM130); -CHECK_DT_REG(i2c131, NRF_TWIM131); -CHECK_DT_REG(i2c132, NRF_TWIM132); -CHECK_DT_REG(i2c133, NRF_TWIM133); -CHECK_DT_REG(i2c134, NRF_TWIM134); -CHECK_DT_REG(i2c135, NRF_TWIM135); -CHECK_DT_REG(i2c136, NRF_TWIM136); -CHECK_DT_REG(i2c137, NRF_TWIM137); CHECK_DT_REG(i2s0, NRF_I2S0); -CHECK_DT_REG(i2s20, NRF_I2S20); CHECK_DT_REG(ipc, NRF_IPC); -CHECK_DT_REG(cpuapp_ipct, NRF_IPCT); -CHECK_DT_REG(cpurad_ipct, NRF_IPCT); -CHECK_DT_REG(ipct120, NRF_IPCT120); -CHECK_DT_REG(ipct130, NRF_IPCT130); CHECK_DT_REG(kmu, NRF_KMU); CHECK_DT_REG(mutex, NRF_MUTEX); CHECK_DT_REG(mwu, NRF_MWU); @@ -212,40 +173,18 @@ CHECK_DT_REG(pwm3, NRF_PWM3); CHECK_DT_REG(qdec, NRF_QDEC0); /* this should be the same node as qdec0 */ CHECK_DT_REG(qdec0, NRF_QDEC0); CHECK_DT_REG(qdec1, NRF_QDEC1); -CHECK_DT_REG(qdec20, NRF_QDEC20); -CHECK_DT_REG(qdec21, NRF_QDEC21); -CHECK_DT_REG(qdec130, NRF_QDEC130); -CHECK_DT_REG(qdec131, NRF_QDEC131); CHECK_DT_REG(radio, NRF_RADIO); CHECK_DT_REG(regulators, NRF_REGULATORS); CHECK_DT_REG(reset, NRF_RESET); CHECK_DT_REG(rng, NRF_RNG); -CHECK_DT_REG(rtc, NRF_RTC); CHECK_DT_REG(rtc0, NRF_RTC0); CHECK_DT_REG(rtc1, NRF_RTC1); CHECK_DT_REG(rtc2, NRF_RTC2); -CHECK_DT_REG(rtc130, NRF_RTC130); -CHECK_DT_REG(rtc131, NRF_RTC131); CHECK_SPI_REG(spi0, 0); CHECK_SPI_REG(spi1, 1); CHECK_SPI_REG(spi2, 2); CHECK_DT_REG(spi3, NRF_SPIM3); CHECK_DT_REG(spi4, NRF_SPIM4); -CHECK_DT_REG(spi00, NRF_SPIM00); -CHECK_DT_REG(spi20, NRF_SPIM20); -CHECK_DT_REG(spi21, NRF_SPIM21); -CHECK_DT_REG(spi22, NRF_SPIM22); -CHECK_DT_REG(spi30, NRF_SPIM30); -CHECK_DT_REG(spi120, NRF_SPIM120); -CHECK_DT_REG(spi121, NRF_SPIM121); -CHECK_DT_REG(spi130, NRF_SPIM130); -CHECK_DT_REG(spi131, NRF_SPIM131); -CHECK_DT_REG(spi132, NRF_SPIM132); -CHECK_DT_REG(spi133, NRF_SPIM133); -CHECK_DT_REG(spi134, NRF_SPIM134); -CHECK_DT_REG(spi135, NRF_SPIM135); -CHECK_DT_REG(spi136, NRF_SPIM136); -CHECK_DT_REG(spi137, NRF_SPIM137); CHECK_DT_REG(spu, NRF_SPU); CHECK_DT_REG(swi0, NRF_SWI0); CHECK_DT_REG(swi1, NRF_SWI1); @@ -266,19 +205,6 @@ CHECK_DT_REG(timer21, NRF_TIMER21); CHECK_DT_REG(timer22, NRF_TIMER22); CHECK_DT_REG(timer23, NRF_TIMER23); CHECK_DT_REG(timer24, NRF_TIMER24); -CHECK_DT_REG(timer020, NRF_TIMER020); -CHECK_DT_REG(timer021, NRF_TIMER021); -CHECK_DT_REG(timer022, NRF_TIMER022); -CHECK_DT_REG(timer120, NRF_TIMER120); -CHECK_DT_REG(timer121, NRF_TIMER121); -CHECK_DT_REG(timer130, NRF_TIMER130); -CHECK_DT_REG(timer131, NRF_TIMER131); -CHECK_DT_REG(timer132, NRF_TIMER132); -CHECK_DT_REG(timer133, NRF_TIMER133); -CHECK_DT_REG(timer134, NRF_TIMER134); -CHECK_DT_REG(timer135, NRF_TIMER135); -CHECK_DT_REG(timer136, NRF_TIMER136); -CHECK_DT_REG(timer137, NRF_TIMER137); CHECK_UART_REG(uart0, 0); CHECK_DT_REG(uart1, NRF_UARTE1); CHECK_DT_REG(uart2, NRF_UARTE2); @@ -306,8 +232,6 @@ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); CHECK_DT_REG(wdt30, NRF_WDT30); CHECK_DT_REG(wdt31, NRF_WDT31); -CHECK_DT_REG(wdt131, NRF_WDT131); -CHECK_DT_REG(wdt132, NRF_WDT132); /* nRF51/nRF52-specific addresses */ #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) From 762d11be686708dcf6f4f152057da0f14d08925b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:32 +0200 Subject: [PATCH 1708/2300] Revert "[nrf fromlist] dts: nordic: Add missing ECB020 node in nRF54H20 EngA" This reverts commit 8c7a4439115a0ff24f97b69309fce989d8cd8371. Signed-off-by: Gerard Marull-Paretas --- dts/common/nordic/nrf54h20_enga.dtsi | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 8552b9534eb..47aba0df253 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -210,13 +210,6 @@ interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>; }; - ecb020: ecb@27000 { - compatible = "nordic,nrf-ecb"; - reg = <0x27000 0x1000>; - status = "disabled"; - interrupts = <39 NRF_DEFAULT_IRQ_PRIORITY>; - }; - timer020: timer@28000 { compatible = "nordic,nrf-timer"; reg = <0x28000 0x1000>; From c0660ab7e59aaf3372477f10772467eddc896e75 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:33 +0200 Subject: [PATCH 1709/2300] Revert "[nrf fromlist] dts: nordic: Add DPPIC and IPCT nodes to nRF54H20 EngA" This reverts commit 4663189d08d5c51238a60ed15996087a87b1526f. Signed-off-by: Gerard Marull-Paretas --- .../{misc => arm}/nordic,nrf-dppic.yaml | 0 .../{misc => arm}/nordic,nrf-ppi.yaml | 0 dts/bindings/ipc/nordic,nrf-ipct-common.yaml | 45 --------- dts/bindings/ipc/nordic,nrf-ipct-global.yaml | 17 ---- dts/bindings/ipc/nordic,nrf-ipct-local.yaml | 12 --- dts/bindings/{ipc => ipm}/nordic,nrf-ipc.yaml | 0 .../misc/nordic,nrf-dppic-global.yaml | 18 ---- dts/bindings/misc/nordic,nrf-dppic-links.yaml | 17 ---- dts/bindings/misc/nordic,nrf-dppic-local.yaml | 13 --- .../misc/nordic,split-channel-groups.yaml | 20 ---- dts/common/nordic/nrf54h20_enga.dtsi | 94 ------------------- 11 files changed, 236 deletions(-) rename dts/bindings/{misc => arm}/nordic,nrf-dppic.yaml (100%) rename dts/bindings/{misc => arm}/nordic,nrf-ppi.yaml (100%) delete mode 100644 dts/bindings/ipc/nordic,nrf-ipct-common.yaml delete mode 100644 dts/bindings/ipc/nordic,nrf-ipct-global.yaml delete mode 100644 dts/bindings/ipc/nordic,nrf-ipct-local.yaml rename dts/bindings/{ipc => ipm}/nordic,nrf-ipc.yaml (100%) delete mode 100644 dts/bindings/misc/nordic,nrf-dppic-global.yaml delete mode 100644 dts/bindings/misc/nordic,nrf-dppic-links.yaml delete mode 100644 dts/bindings/misc/nordic,nrf-dppic-local.yaml delete mode 100644 dts/bindings/misc/nordic,split-channel-groups.yaml diff --git a/dts/bindings/misc/nordic,nrf-dppic.yaml b/dts/bindings/arm/nordic,nrf-dppic.yaml similarity index 100% rename from dts/bindings/misc/nordic,nrf-dppic.yaml rename to dts/bindings/arm/nordic,nrf-dppic.yaml diff --git a/dts/bindings/misc/nordic,nrf-ppi.yaml b/dts/bindings/arm/nordic,nrf-ppi.yaml similarity index 100% rename from dts/bindings/misc/nordic,nrf-ppi.yaml rename to dts/bindings/arm/nordic,nrf-ppi.yaml diff --git a/dts/bindings/ipc/nordic,nrf-ipct-common.yaml b/dts/bindings/ipc/nordic,nrf-ipct-common.yaml deleted file mode 100644 index a75b63577c4..00000000000 --- a/dts/bindings/ipc/nordic,nrf-ipct-common.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic IPCT (Interprocessor Communication Transceiver) - -include: base.yaml - -properties: - reg: - required: true - - channels: - type: int - required: true - description: Number of channels implemented by the IPCT instance. - - source-channel-links: - type: array - description: | - Mapping of IPCT channels that are mapped between two IPCT instances on - separate domains, in which a channel on this IPCT node is considered - the source. This array is then comprised of a 3-integer-wide "unit" - that defines one connection of the mapping. The format of this unit - is . Units are sequential - in the array, therefore requiring the length of this property to be - a factor of 3. - - For example, if channel 2 is to be mapped to Radio Core (ID: 3) IPCT - channel 4, then the array "unit" would be <2 NRF_DOMAIN_ID_RADIOCORE 4> - or <2 3 4>. - - sink-channel-links: - type: array - description: | - Mapping of IPCT channels that are mapped between two IPCT instances on - separate domains, in which a channel on this IPCT node is considered - the sink. This array is then comprised of a 3-integer-wide "unit" - that defines one connection of the mapping. The format of this unit - is . Units are sequential - in the array, therefore requiring the length of this property to be - a factor of 3. - - For example, if channel 2 is to be mapped to Radio Core (ID: 3) IPCT - channel 4, then the array "unit" would be <2 NRF_DOMAIN_ID_RADIOCORE 4> - or <2 3 4>. diff --git a/dts/bindings/ipc/nordic,nrf-ipct-global.yaml b/dts/bindings/ipc/nordic,nrf-ipct-global.yaml deleted file mode 100644 index a1f7776d464..00000000000 --- a/dts/bindings/ipc/nordic,nrf-ipct-global.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic Global IPCT (Interprocessor Communication Transceiver) - -compatible: "nordic,nrf-ipct-global" - -include: ["nordic,nrf-ipct-common.yaml", "nordic,split-channels.yaml"] - -properties: - global-domain-id: - required: true - type: int - description: | - Global IPCT instances reside on specific buses within the Global Domain, - such as fast and slow, which have different IDs that do not match the - standard Global Domain ID presented in their address. diff --git a/dts/bindings/ipc/nordic,nrf-ipct-local.yaml b/dts/bindings/ipc/nordic,nrf-ipct-local.yaml deleted file mode 100644 index 9f055eb8b79..00000000000 --- a/dts/bindings/ipc/nordic,nrf-ipct-local.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic Local IPCT (Interprocessor Communication Transceiver) - -compatible: "nordic,nrf-ipct-local" - -include: "nordic,nrf-ipct-common.yaml" - -properties: - interrupts: - required: true diff --git a/dts/bindings/ipc/nordic,nrf-ipc.yaml b/dts/bindings/ipm/nordic,nrf-ipc.yaml similarity index 100% rename from dts/bindings/ipc/nordic,nrf-ipc.yaml rename to dts/bindings/ipm/nordic,nrf-ipc.yaml diff --git a/dts/bindings/misc/nordic,nrf-dppic-global.yaml b/dts/bindings/misc/nordic,nrf-dppic-global.yaml deleted file mode 100644 index 3257c519348..00000000000 --- a/dts/bindings/misc/nordic,nrf-dppic-global.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic Global DPPIC - (Distributed Programmable Peripheral Interconnect Controller) - - Updated DPPIC binding set for Nordic products that have global DPPIC instances - with inter-bridge functionality. These instances also have split-ownership - of its channels and channel groups. - -compatible: "nordic,nrf-dppic-global" - -include: - - "nordic,nrf-dppic.yaml" - - "nordic,nrf-dppic-links.yaml" - - "nordic,split-channels.yaml" - - "nordic,split-channel-groups.yaml" diff --git a/dts/bindings/misc/nordic,nrf-dppic-links.yaml b/dts/bindings/misc/nordic,nrf-dppic-links.yaml deleted file mode 100644 index db12ccb72cb..00000000000 --- a/dts/bindings/misc/nordic,nrf-dppic-links.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic DPPIC Channel Linking - -properties: - source-channels: - type: array - description: | - Channels that are linked to channels of DPPIC instances on separate - bridges as publishing sources. - - sink-channels: - type: array - description: | - Channels that are linked to channels of DPPIC instances on separate - bridges as subscribing sinks. diff --git a/dts/bindings/misc/nordic,nrf-dppic-local.yaml b/dts/bindings/misc/nordic,nrf-dppic-local.yaml deleted file mode 100644 index bea53bddec8..00000000000 --- a/dts/bindings/misc/nordic,nrf-dppic-local.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -description: | - Nordic Local DPPIC - (Distributed Programmable Peripheral Interconnect Controller) - - Updated DPPIC binding set for Nordic products that have local DPPIC instances - with inter-bridge functionality. - -compatible: "nordic,nrf-dppic-local" - -include: ["nordic,nrf-dppic.yaml", "nordic,nrf-dppic-links.yaml"] diff --git a/dts/bindings/misc/nordic,split-channel-groups.yaml b/dts/bindings/misc/nordic,split-channel-groups.yaml deleted file mode 100644 index 868bc5fecec..00000000000 --- a/dts/bindings/misc/nordic,split-channel-groups.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic Split Channel Groups - -properties: - owned-channel-groups: - type: array - description: | - List of channel groups of a split-ownership peripheral that are to be - owned for use by the compiled domain. - - nonsecure-channel-groups: - type: array - description: | - List of channel groups in a split-ownership, split-security peripheral - that are to be configured as nonsecure. In Trustzone systems, this - property is only evaluated for secure peripherals, as nonsecure channels - are implicitly specified through the owned-channels property. This - property is ignored in non-Trustzone systems. diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 47aba0df253..70c994ccd06 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -9,12 +9,6 @@ #include -/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ -#define NRF_DOMAIN_ID_APPLICATION 2 -#define NRF_DOMAIN_ID_RADIOCORE 3 -#define NRF_DOMAIN_ID_GLOBALFAST 12 -#define NRF_DOMAIN_ID_GLOBALSLOW 13 - /delete-node/ &sw_pwm; / { @@ -159,15 +153,6 @@ <&ficr NRF_FICR_TRIM_APPLICATION_HSFLL_TRIM_FINE_0>; nordic,ficr-names = "vsup", "coarse", "fine"; }; - - cpuapp_ipct: ipct@13000 { - compatible = "nordic,nrf-ipct-local"; - reg = <0x13000 0x1000>; - status = "disabled"; - channels = <4>; - interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, - <65 NRF_DEFAULT_IRQ_PRIORITY>; - }; }; cpurad_peripherals: peripheral@53000000 { @@ -188,21 +173,6 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; - dppic020: dppic@22000 { - compatible = "nordic,nrf-dppic-local"; - reg = <0x22000 0x1000>; - status = "disabled"; - }; - - cpurad_ipct: ipct@24000 { - compatible = "nordic,nrf-ipct-local"; - reg = <0x24000 0x1000>; - status = "disabled"; - channels = <8>; - interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, - <65 NRF_DEFAULT_IRQ_PRIORITY>; - }; - egu020: egu@25000 { compatible = "nordic,nrf-egu"; reg = <0x25000 0x1000>; @@ -297,20 +267,6 @@ #mbox-cells = <1>; }; - ipct120: ipct@8d1000 { - compatible = "nordic,nrf-ipct-global"; - reg = <0x8d1000 0x1000>; - status = "disabled"; - channels = <8>; - global-domain-id = <12>; - }; - - dppic120: dppic@8e1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x8e1000 0x1000>; - status = "disabled"; - }; - timer120: timer@8e2000 { compatible = "nordic,nrf-timer"; reg = <0x8e2000 0x1000>; @@ -388,20 +344,6 @@ }; }; - ipct130: ipct@921000 { - compatible = "nordic,nrf-ipct-global"; - reg = <0x921000 0x1000>; - status = "disabled"; - channels = <8>; - global-domain-id = <13>; - }; - - dppic130: dppic@922000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x922000 0x1000>; - status = "disabled"; - }; - rtc130: rtc@928000 { compatible = "nordic,nrf-rtc"; reg = <0x928000 0x1000>; @@ -507,12 +449,6 @@ port = <9>; }; - dppic131: dppic@981000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x981000 0x1000>; - status = "disabled"; - }; - comp: comparator@983000 { compatible = "nordic,nrf-comp"; reg = <0x983000 0x1000>; @@ -535,12 +471,6 @@ interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; }; - dppic132: dppic@991000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x991000 0x1000>; - status = "disabled"; - }; - qdec130: qdec@994000 { compatible = "nordic,nrf-qdec"; reg = <0x994000 0x1000>; @@ -562,12 +492,6 @@ cc-num = <16>; }; - dppic133: dppic@9a1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9a1000 0x1000>; - status = "disabled"; - }; - timer130: timer@9a2000 { compatible = "nordic,nrf-timer"; reg = <0x9a2000 0x1000>; @@ -644,12 +568,6 @@ interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; }; - dppic134: dppic@9b1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9b1000 0x1000>; - status = "disabled"; - }; - timer132: timer@9b2000 { compatible = "nordic,nrf-timer"; reg = <0x9b2000 0x1000>; @@ -726,12 +644,6 @@ interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; }; - dppic135: dppic@9c1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9c1000 0x1000>; - status = "disabled"; - }; - timer134: timer@9c2000 { compatible = "nordic,nrf-timer"; reg = <0x9c2000 0x1000>; @@ -808,12 +720,6 @@ interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; }; - dppic136: dppic@9d1000 { - compatible = "nordic,nrf-dppic-global"; - reg = <0x9d1000 0x1000>; - status = "disabled"; - }; - timer136: timer@9d2000 { compatible = "nordic,nrf-timer"; reg = <0x9d2000 0x1000>; From b68b9890ad3f0d239afc53673f54ad7924ed07ad Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:33 +0200 Subject: [PATCH 1710/2300] Revert "[nrf fromtree] manifest: update hal_nordic revision" This reverts commit 20b7e5c80778c5162d8c040516b830593305d831. 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 a288009c15a..3da134e76ce 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: daf875285120be6b2825969b7a0abc3f415b248d + revision: dce8519f7da37b0a745237679fd3f88250b495ff path: modules/hal/nordic groups: - hal From f724dba59dab3ceb34ffcfd2bb5ab396e67a7d05 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:33 +0200 Subject: [PATCH 1711/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20_enga: Add erase-block-size to mram1x" This reverts commit 77d21e0e54f3996c8318145912bb6e8556194917. Signed-off-by: Gerard Marull-Paretas --- dts/common/nordic/nrf54h20_enga.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 70c994ccd06..610fbd81587 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -96,7 +96,6 @@ mram1x: mram@e000000 { compatible = "nordic,mram"; reg = <0xe000000 DT_SIZE_K(2048)>; - erase-block-size = <4096>; write-block-size = <16>; }; From 3f7bd6c8a4b9e6a6417957917a1689e19c45cc12 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:33 +0200 Subject: [PATCH 1712/2300] Revert "[nrf fromtree] drivers: flash: Add flash driver for MRAM" This reverts commit 56e0ecf9ed3d45ec48e9c6f03f15bdb02417b432. Signed-off-by: Gerard Marull-Paretas --- drivers/flash/CMakeLists.txt | 1 - drivers/flash/Kconfig | 2 - drivers/flash/Kconfig.nrf_mram | 19 ---- drivers/flash/soc_flash_nrf_mram.c | 177 ----------------------------- 4 files changed, 199 deletions(-) delete mode 100644 drivers/flash/Kconfig.nrf_mram delete mode 100644 drivers/flash/soc_flash_nrf_mram.c diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index 98f24ff123c..4f21b2f65ed 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -129,4 +129,3 @@ 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_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) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index 0c24890d44d..4731a628438 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -163,6 +163,4 @@ source "drivers/flash/Kconfig.ambiq" source "drivers/flash/Kconfig.nrf_rram" -source "drivers/flash/Kconfig.nrf_mram" - endif # FLASH diff --git a/drivers/flash/Kconfig.nrf_mram b/drivers/flash/Kconfig.nrf_mram deleted file mode 100644 index 0ef65864a62..00000000000 --- a/drivers/flash/Kconfig.nrf_mram +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (c) 2024 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: Apache-2.0 -# - -config SOC_FLASH_NRF_MRAM - bool "Nordic Semiconductor flash driver for MRAM" - default y - depends on DT_HAS_NORDIC_MRAM_ENABLED - select FLASH_HAS_DRIVER_ENABLED - select FLASH_HAS_PAGE_LAYOUT - imply MPU_ALLOW_FLASH_WRITE if ARM_MPU - help - Enables Nordic Semiconductor flash driver for MRAM in direct write mode. - - Note that MRAM words are auto-erased when written to, but writing to a - pre-erased area is faster. Hence, the erase API is not required, but - it can be used to amortize write performance for some use cases. diff --git a/drivers/flash/soc_flash_nrf_mram.c b/drivers/flash/soc_flash_nrf_mram.c deleted file mode 100644 index 9b33ee05d6f..00000000000 --- a/drivers/flash/soc_flash_nrf_mram.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#include -#include -#include - -LOG_MODULE_REGISTER(flash_nrf_mram, CONFIG_FLASH_LOG_LEVEL); - -#define DT_DRV_COMPAT nordic_mram - -#define MRAM_START DT_INST_REG_ADDR(0) -#define MRAM_SIZE DT_INST_REG_SIZE(0) - -#define MRAM_WORD_SIZE 16 -#define MRAM_WORD_MASK 0xf - -#define WRITE_BLOCK_SIZE DT_INST_PROP_OR(0, write_block_size, MRAM_WORD_SIZE) -#define ERASE_BLOCK_SIZE DT_INST_PROP_OR(0, erase_block_size, WRITE_BLOCK_SIZE) - -#define ERASE_VALUE 0xff - -BUILD_ASSERT(MRAM_START > 0, "nordic,mram: start address expected to be non-zero"); -BUILD_ASSERT((ERASE_BLOCK_SIZE % WRITE_BLOCK_SIZE) == 0, - "erase-block-size expected to be a multiple of write-block-size"); - -/** - * @param[in,out] offset Relative offset into memory, from the driver API. - * @param[in] len Number of bytes for the intended operation. - * @param[in] must_align Require MRAM word alignment, if applicable. - * - * @return Absolute address in MRAM, or NULL if @p offset or @p len are not - * within bounds or appropriately aligned. - */ -static uintptr_t validate_and_map_addr(off_t offset, size_t len, bool must_align) -{ - if (unlikely(offset < 0 || offset >= MRAM_SIZE || len > MRAM_SIZE - offset)) { - LOG_ERR("invalid offset: %ld:%zu", offset, len); - return 0; - } - - const uintptr_t addr = MRAM_START + offset; - - if (WRITE_BLOCK_SIZE > 1 && must_align && - unlikely((addr % WRITE_BLOCK_SIZE) != 0 || (len % WRITE_BLOCK_SIZE) != 0)) { - LOG_ERR("invalid alignment: %p:%zu", (void *)addr, len); - return 0; - } - - return addr; -} - -/** - * @param[in] addr_end Last modified MRAM address (not inclusive). - */ -static void commit_changes(uintptr_t addr_end) -{ - /* Barrier following our last write. */ - barrier_dmem_fence_full(); - - if ((WRITE_BLOCK_SIZE & MRAM_WORD_MASK) == 0 || (addr_end & MRAM_WORD_MASK) == 0) { - /* Our last operation was MRAM word-aligned, so we're done. - * Note: if WRITE_BLOCK_SIZE is a multiple of MRAM_WORD_SIZE, - * then this was already checked in validate_and_map_addr(). - */ - return; - } - - /* Get the most significant byte (MSB) of the last MRAM word we were modifying. - * Writing to this byte makes the MRAM controller commit other pending writes to that word. - */ - addr_end |= MRAM_WORD_MASK; - - /* Issue a dummy write, since we didn't have anything to write here. - * Doing this lets us finalize our changes before we exit the driver API. - */ - sys_write8(sys_read8(addr_end), addr_end); -} - -static int nrf_mram_read(const struct device *dev, off_t offset, void *data, size_t len) -{ - ARG_UNUSED(dev); - - const uintptr_t addr = validate_and_map_addr(offset, len, false); - - if (!addr) { - return -EINVAL; - } - - LOG_DBG("read: %p:%zu", (void *)addr, len); - - memcpy(data, (void *)addr, len); - - return 0; -} - -static int nrf_mram_write(const struct device *dev, off_t offset, const void *data, size_t len) -{ - ARG_UNUSED(dev); - - const uintptr_t addr = validate_and_map_addr(offset, len, true); - - if (!addr) { - return -EINVAL; - } - - LOG_DBG("write: %p:%zu", (void *)addr, len); - - memcpy((void *)addr, data, len); - commit_changes(addr + len); - - return 0; -} - -static int nrf_mram_erase(const struct device *dev, off_t offset, size_t size) -{ - ARG_UNUSED(dev); - - const uintptr_t addr = validate_and_map_addr(offset, size, true); - - if (!addr) { - return -EINVAL; - } - - LOG_DBG("erase: %p:%zu", (void *)addr, size); - - memset((void *)addr, ERASE_VALUE, size); - commit_changes(addr + size); - - return 0; -} - -static const struct flash_parameters *nrf_mram_get_parameters(const struct device *dev) -{ - ARG_UNUSED(dev); - - static const struct flash_parameters parameters = { - .write_block_size = WRITE_BLOCK_SIZE, - .erase_value = ERASE_VALUE, - }; - - return ¶meters; -} - -#if defined(CONFIG_FLASH_PAGE_LAYOUT) -static void nrf_mram_page_layout(const struct device *dev, const struct flash_pages_layout **layout, - size_t *layout_size) -{ - ARG_UNUSED(dev); - - static const struct flash_pages_layout pages_layout = { - .pages_count = (MRAM_SIZE) / (ERASE_BLOCK_SIZE), - .pages_size = ERASE_BLOCK_SIZE, - }; - - *layout = &pages_layout; - *layout_size = 1; -} -#endif - -static const struct flash_driver_api nrf_mram_api = { - .read = nrf_mram_read, - .write = nrf_mram_write, - .erase = nrf_mram_erase, - .get_parameters = nrf_mram_get_parameters, -#if defined(CONFIG_FLASH_PAGE_LAYOUT) - .page_layout = nrf_mram_page_layout, -#endif -}; - -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &nrf_mram_api); From 150d71dcbef11c4a775e3539beeb12c866d2bdeb Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:33 +0200 Subject: [PATCH 1713/2300] Revert "[nrf fromtree] drivers: modem_cellular: allow leaving out the chat_filter parameter" This reverts commit a102df7e8a2063d226767bc7c705d5f20e9630ef. Signed-off-by: Gerard Marull-Paretas --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 15f10f11a52..276c9d38f7b 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1516,7 +1516,7 @@ static int modem_cellular_init(const struct device *dev) .delimiter = data->chat_delimiter, .delimiter_size = strlen(data->chat_delimiter), .filter = data->chat_filter, - .filter_size = data->chat_filter ? strlen(data->chat_filter) : 0, + .filter_size = strlen(data->chat_filter), .argv = data->chat_argv, .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, From aa1f23bf290473046b564f409b0dd8890a3a5178 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:34 +0200 Subject: [PATCH 1714/2300] Revert "[nrf fromlist] buildsystem: Enable LTO also for the application" This reverts commit 3f9065356fe91353311ebec8924471071a8a4131. Signed-off-by: Gerard Marull-Paretas --- CMakeLists.txt | 2 +- lib/libc/newlib/CMakeLists.txt | 3 --- lib/libc/picolibc/CMakeLists.txt | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a229c06413e..f1fb89660f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,7 +214,7 @@ endif() zephyr_compile_options(${OPTIMIZATION_FLAG}) if(CONFIG_LTO) - zephyr_compile_options($) + add_compile_options($) add_link_options($) endif() diff --git a/lib/libc/newlib/CMakeLists.txt b/lib/libc/newlib/CMakeLists.txt index 35c6a9b6337..6556a3e814c 100644 --- a/lib/libc/newlib/CMakeLists.txt +++ b/lib/libc/newlib/CMakeLists.txt @@ -3,9 +3,6 @@ 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 normally uses -ffreestanding, which with current GNU toolchains # means that the flag macros used by newlib 3.x to signal # support for PRI.64 macros are not present. To make them available we diff --git a/lib/libc/picolibc/CMakeLists.txt b/lib/libc/picolibc/CMakeLists.txt index 87fb0d9d8ec..23e84231e2a 100644 --- a/lib/libc/picolibc/CMakeLists.txt +++ b/lib/libc/picolibc/CMakeLists.txt @@ -3,9 +3,6 @@ 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 $) - # define __LINUX_ERRNO_EXTENSIONS__ so we get errno defines like -ESHUTDOWN # used by the network stack zephyr_compile_definitions(__LINUX_ERRNO_EXTENSIONS__) From a1012e5a26778be0207de31cb8b13bdfc938c617 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:34 +0200 Subject: [PATCH 1715/2300] Revert "[nrf fromlist] linker: Set ROM offset for MCUboot with NRF54L" This reverts commit 3701af0b87579c566c128e90c1c3e1c9302be191. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig index 3e47a0bb583..532ea07c859 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig +++ b/boards/arm/nrf54l15pdk_nrf54l15/Kconfig.defconfig @@ -9,8 +9,4 @@ config BOARD config BT_CTLR default BT -config ROM_START_OFFSET - hex - default 0x800 if BOOTLOADER_MCUBOOT - endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP From 58122e75538220f2d639dfe7e453f8b6b36728e7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:34 +0200 Subject: [PATCH 1716/2300] Revert "[nrf fromlist] dts: arm: add uart-mcumgr choosen for 54L15" This reverts commit ce7a9abbc9ebb852644e1fe1207a6547006de700. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index 9876e3996e8..f2703872899 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -16,7 +16,6 @@ chosen { zephyr,console = &uart20; zephyr,shell-uart = &uart20; - zephyr,uart-mcumgr = &uart20; zephyr,sram = &sram0; zephyr,flash = &rram0; zephyr,code-partition = &slot0_partition; From 221bac446d7746fdcf5a7aa0a8f6d1c6acfdfd1b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:34 +0200 Subject: [PATCH 1717/2300] Revert "[nrf fromlist] dts: arm: nrf54l: Add nodes required by MCUboot" This reverts commit 74208ee8f77c0184758a48128afd1a45fc133cb6. Signed-off-by: Gerard Marull-Paretas --- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts index f2703872899..1e0245f6cc3 100644 --- a/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/arm/nrf54l15pdk_nrf54l15/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -133,30 +133,13 @@ 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 { + slot0_partition: partition@0 { label = "image-0"; - reg = <0x10000 DT_SIZE_K(348)>; - }; - slot0_ns_partition: partition@67000 { - label = "image-0-nonsecure"; - reg = <0x67000 DT_SIZE_K(348)>; - }; - slot1_partition: partition@be000 { - label = "image-1"; - reg = <0xbe000 DT_SIZE_K(348)>; - }; - slot1_ns_partition: partition@115000 { - label = "image-1-nonsecure"; - reg = <0x115000 DT_SIZE_K(348)>; + reg = <0x0 DT_SIZE_K(64)>; }; - /* 32k from 0x16c000 to 0x173fff reserved for TF-M partitions */ - storage_partition: partition@174000 { + storage_partition: partition@f2000 { label = "storage"; - reg = <0x174000 DT_SIZE_K(36)>; + reg = <0xf2000 DT_SIZE_K(24)>; }; }; }; From 4213173f5c4026064093ce5dd4b90e453c183b6f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:34 +0200 Subject: [PATCH 1718/2300] Revert "[nrf fromlist] samples: drivers: mbox: add support for nRF BELLBOARD" This reverts commit ae6525bb4e7e294fd629240de7f88f8bd52c64cd. Signed-off-by: Gerard Marull-Paretas --- ...nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf | 1 - ...54h20pdk_nrf54h20_cpuapp_bellboard.overlay | 8 -------- ...nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf | 1 - ...54h20pdk_nrf54h20_cpuppr_bellboard.overlay | 8 -------- samples/drivers/mbox/sample.yaml | 20 ------------------- 5 files changed, 38 deletions(-) delete mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf delete mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay delete mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf delete mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf deleted file mode 100644 index 0b6bc73d6bc..00000000000 --- a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_TX_ENABLED=n diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay deleted file mode 100644 index 5f0cfe2261d..00000000000 --- a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -mbox: &cpuapp_bellboard { - status = "okay"; -}; diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf deleted file mode 100644 index 4596bc3a757..00000000000 --- a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_RX_ENABLED=n diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay deleted file mode 100644 index 5f0cfe2261d..00000000000 --- a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -mbox: &cpuapp_bellboard { - status = "okay"; -}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index b386b9d2b4b..8c85a8d5150 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -44,26 +44,6 @@ tests: - "Ping \\(on channel 4\\)" - "Pong \\(on channel 4\\)" - sample.drivers.mbox.nrf54h20_bellboard: - platform_allow: - - nrf54h20pdk_nrf54h20_cpuapp - integration_platforms: - - nrf54h20pdk_nrf54h20_cpuapp - extra_args: - mbox_SNIPPET=nordic-ppr - mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.conf - mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_bellboard.overlay - remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.conf - remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_bellboard.overlay - sysbuild: true - harness: console - harness_config: - type: multi_line - ordered: false - regex: - - "Ping \\(on channel 0\\)" - - "Pong \\(on channel 0\\)" - sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp From 66170b8b331740fe280721f4e96046b9ebf9752b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:35 +0200 Subject: [PATCH 1719/2300] Revert "[nrf fromlist] samples: drivers: mbox: add support for nRF VEVIF" This reverts commit 1ee5a6fb10567a1a47f749f3a2bcc4d56e9d772e. Signed-off-by: Gerard Marull-Paretas --- samples/drivers/mbox/CMakeLists.txt | 3 +-- samples/drivers/mbox/Kconfig.sysbuild | 1 - .../nrf54h20pdk_nrf54h20_cpuapp_vevif.conf | 2 -- .../nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay | 8 ------- samples/drivers/mbox/remote/CMakeLists.txt | 3 +-- .../nrf54h20pdk_nrf54h20_cpuppr_vevif.conf | 2 -- .../nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay | 8 ------- samples/drivers/mbox/sample.yaml | 21 ------------------- 8 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf delete mode 100644 samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay delete mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf delete mode 100644 samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay diff --git a/samples/drivers/mbox/CMakeLists.txt b/samples/drivers/mbox/CMakeLists.txt index c69621c2496..ec79db9deed 100644 --- a/samples/drivers/mbox/CMakeLists.txt +++ b/samples/drivers/mbox/CMakeLists.txt @@ -17,8 +17,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR - ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0") OR - ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuapp")) + ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")) message(STATUS "${BOARD} compile as Main in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/Kconfig.sysbuild b/samples/drivers/mbox/Kconfig.sysbuild index aca48b8ead3..a17dd56ee55 100644 --- a/samples/drivers/mbox/Kconfig.sysbuild +++ b/samples/drivers/mbox/Kconfig.sysbuild @@ -14,4 +14,3 @@ string default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7" default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7" default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0" - default "nrf54h20pdk_nrf54h20_cpuppr" if $(BOARD) = "nrf54h20pdk_nrf54h20_cpuapp" diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf deleted file mode 100644 index d8d66e9812d..00000000000 --- a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_RX_ENABLED=n -CONFIG_TX_CHANNEL_ID=4 diff --git a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay b/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay deleted file mode 100644 index ed631f04cc3..00000000000 --- a/samples/drivers/mbox/boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -mbox: &cpuppr_vevif { - status = "okay"; -}; diff --git a/samples/drivers/mbox/remote/CMakeLists.txt b/samples/drivers/mbox/remote/CMakeLists.txt index cb024cb6112..2c7c8fff29e 100644 --- a/samples/drivers/mbox/remote/CMakeLists.txt +++ b/samples/drivers/mbox/remote/CMakeLists.txt @@ -15,8 +15,7 @@ if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR ("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR ("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR ("${BOARD}" STREQUAL "lpcxpresso55s69_cpu1") OR - ("${BOARD}" STREQUAL "adp_xc7k_ae350") OR - ("${BOARD}" STREQUAL "nrf54h20pdk_nrf54h20_cpuppr")) + ("${BOARD}" STREQUAL "adp_xc7k_ae350")) message(STATUS "${BOARD} compile as remote in this sample") else() message(FATAL_ERROR "${BOARD} is not supported for this sample") diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf deleted file mode 100644 index 19e03b75c63..00000000000 --- a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_TX_ENABLED=n -CONFIG_RX_CHANNEL_ID=4 diff --git a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay b/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay deleted file mode 100644 index ed631f04cc3..00000000000 --- a/samples/drivers/mbox/remote/boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -mbox: &cpuppr_vevif { - status = "okay"; -}; diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 8c85a8d5150..e38deda55d3 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -23,27 +23,6 @@ tests: - "Pong \\(on channel 0\\)" - "Ping \\(on channel 1\\)" - "Pong \\(on channel 1\\)" - - sample.drivers.mbox.nrf54h20_vevif: - platform_allow: - - nrf54h20pdk_nrf54h20_cpuapp - integration_platforms: - - nrf54h20pdk_nrf54h20_cpuapp - extra_args: - mbox_SNIPPET=nordic-ppr - mbox_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.conf - mbox_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuapp_vevif.overlay - remote_EXTRA_CONF_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.conf - remote_DTC_OVERLAY_FILE=boards/nrf54h20pdk_nrf54h20_cpuppr_vevif.overlay - sysbuild: true - harness: console - harness_config: - type: multi_line - ordered: false - regex: - - "Ping \\(on channel 4\\)" - - "Pong \\(on channel 4\\)" - sample.drivers.mbox.simu: platform_allow: - nrf5340bsim_nrf5340_cpuapp From 83b4d4fd8308b56d9587d13a95a81f2332aa4635 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:35 +0200 Subject: [PATCH 1720/2300] Revert "[nrf fromlist] boards: nrf54h20pdk: Add default IPC configuration" This reverts commit b6e4ad45786e4b775409c07fcc7ffdbf9865a1f3. Signed-off-by: Gerard Marull-Paretas --- .../nrf54h20pdk_nrf54h20-ipc_conf.dtsi | 36 ------------------- .../nrf54h20pdk_nrf54h20_cpuapp.dts | 29 --------------- .../nrf54h20pdk_nrf54h20_cpurad.dts | 24 ------------- .../nrf54h20pdk_nrf54h20_cpuppr.dts | 11 ------ 4 files changed, 100 deletions(-) delete mode 100644 boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi deleted file mode 100644 index 9c3d971b9bc..00000000000 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-ipc_conf.dtsi +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - ipc { - cpusec_cpuapp_ipc: ipc-1-2 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpusec_bellboard 12>, - <&cpuapp_bellboard 0>; - }; - - cpusec_cpurad_ipc: ipc-1-3 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpusec_bellboard 18>, - <&cpurad_bellboard 0>; - }; - - cpuapp_cpurad_ipc: ipc-2-3 { - status = "disabled"; - mboxes = <&cpuapp_bellboard 18>, - <&cpurad_bellboard 12>; - }; - - cpuapp_cpuppr_ipc: ipc-2-13 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpuapp_bellboard 13>, - <&cpuppr_vevif 12>; - }; - }; -}; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index b2db9e4b9b1..0251fbded25 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -8,11 +8,8 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" -/delete-node/ &cpusec_cpurad_ipc; - / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpuapp"; model = "Nordic nRF54H20 PDK nRF54H20 Application MCU"; @@ -96,32 +93,6 @@ status = "okay"; }; -&cpuapp_bellboard { - interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; - interrupt-names = "irq0"; - /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ - nordic,interrupt-mapping = <0x00042001 0>; -}; - -&cpusec_cpuapp_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpuapp_cpusec_ipc_shm>; - rx-region = <&cpusec_cpuapp_ipc_shm>; -}; - -&cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-initiator"; - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpurad_ipc_shm>; - rx-region = <&cpurad_cpuapp_ipc_shm>; -}; - -&cpuapp_cpuppr_ipc { - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpuppr_ipc_shm>; - rx-region = <&cpuppr_cpuapp_ipc_shm>; -}; - &cpuapp_dma_region { status = "okay"; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index 8d2629df62e..d639847e197 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -8,12 +8,8 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" -/delete-node/ &cpuapp_cpuppr_ipc; -/delete-node/ &cpusec_cpuapp_ipc; - / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpurad"; model = "Nordic nRF54H20 PDK nRF54H20 Radio MCU"; @@ -30,26 +26,6 @@ status = "okay"; }; -&cpurad_bellboard { - interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; - interrupt-names = "irq0"; - /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ - nordic,interrupt-mapping = <0x00001001 0>; -}; - -&cpusec_cpurad_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpusec_ipc_shm>; - rx-region = <&cpusec_cpurad_ipc_shm>; -}; - -&cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-follower"; - mbox-names = "tx", "rx"; - tx-region = <&cpurad_cpuapp_ipc_shm>; - rx-region = <&cpuapp_cpurad_ipc_shm>; -}; - &cpurad_dma_region { status = "okay"; }; diff --git a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts index f98abb9e44b..3c74e7c88d4 100644 --- a/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts +++ b/boards/riscv/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuppr.dts @@ -8,13 +8,8 @@ #include #include "nrf54h20pdk_nrf54h20-memory_map.dtsi" -#include "nrf54h20pdk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20pdk_nrf54h20-pinctrl.dtsi" -/delete-node/ &cpuapp_cpurad_ipc; -/delete-node/ &cpusec_cpuapp_ipc; -/delete-node/ &cpusec_cpurad_ipc; - / { compatible = "nordic,nrf54h20pdk_nrf54h20-cpuppr"; model = "Nordic nRF54H20 PDK nRF54H20 Peripheral Processor MCU"; @@ -29,12 +24,6 @@ }; }; -&cpuapp_cpuppr_ipc { - mbox-names = "tx", "rx"; - tx-region = <&cpuppr_cpuapp_ipc_shm>; - rx-region = <&cpuapp_cpuppr_ipc_shm>; -}; - &grtc { status = "okay"; owned-channels = <5>; From c9593e9a005d02a1f3c2166f23e552373fc65975 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:35 +0200 Subject: [PATCH 1721/2300] Revert "[nrf fromlist] boards: nrf54h20pdk_nrf54h20: Update memory map" This reverts commit cfb31b2e6478d63adaf771c9a2d9ccff14428b38. Signed-off-by: Gerard Marull-Paretas --- .../nrf54h20pdk_nrf54h20-memory_map.dtsi | 100 +----------------- .../nrf54h20pdk_nrf54h20_cpuapp.dts | 8 +- .../nrf54h20pdk_nrf54h20_cpurad.dts | 2 +- 3 files changed, 4 insertions(+), 106 deletions(-) diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi index 560700b1756..cb5a4fe0b0c 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20-memory_map.dtsi @@ -6,96 +6,6 @@ / { reserved-memory { - cpuapp_ram0x_region: memory@2f000000 { - compatible = "nordic,owned-memory"; - reg = <0x2f000000 DT_SIZE_K(260)>; - status = "disabled"; - perm-read; - perm-write; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f000000 0x41000>; - - cpusec_cpuapp_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpuapp_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - - cpuapp_data: memory@1000 { - reg = <0x1000 DT_SIZE_K(256)>; - }; - }; - - cpurad_ram0x_region: memory@2f041000 { - compatible = "nordic,owned-memory"; - reg = <0x2f041000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - perm-secure; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f041000 0x1000>; - - cpusec_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpurad_cpusec_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - }; - - cpuapp_cpurad_ram0x_region: memory@2f0bf000 { - compatible = "nordic,owned-memory"; - reg = <0x2f0bf000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f0bf000 0x1000>; - - cpuapp_cpurad_ipc_shm: memory@0 { - reg = <0x0 DT_SIZE_K(2)>; - }; - - cpurad_cpuapp_ipc_shm: memory@800 { - reg = <0x800 DT_SIZE_K(2)>; - }; - }; - - shared_ram20_region: memory@2f88f000 { - compatible = "nordic,owned-memory"; - reg = <0x2f88f000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f88f000 0x1000>; - - cpuapp_cpusys_ipc_shm: memory@ce0 { - reg = <0xce0 0x80>; - }; - - cpusys_cpuapp_ipc_shm: memory@d60 { - reg = <0xd60 0x80>; - }; - - cpurad_cpusys_ipc_shm: memory@e00 { - reg = <0xe00 0x80>; - }; - - cpusys_cpurad_ipc_shm: memory@e80 { - reg = <0xe80 0x80>; - }; - }; - cpuppr_ram3x_region: memory@2fc00000 { compatible = "nordic,owned-memory"; reg = <0x2fc00000 DT_SIZE_K(28)>; @@ -105,7 +15,7 @@ perm-execute; }; - shared_ram3x_region: memory@2fc07000 { + ram3x_dma_region: memory@2fc07000 { compatible = "nordic,owned-memory"; reg = <0x2fc07000 DT_SIZE_K(4)>; status = "disabled"; @@ -115,14 +25,6 @@ #size-cells = <1>; ranges = <0x0 0x2fc07000 0x1000>; - cpuapp_cpuppr_ipc_shm: memory@0 { - reg = <0x0 0x340>; - }; - - cpuppr_cpuapp_ipc_shm: memory@340 { - reg = <0x340 0x340>; - }; - cpuapp_dma_region: memory@680 { compatible = "zephyr,memory-region"; reg = <0x680 DT_SIZE_K(2)>; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts index 0251fbded25..8500d22a924 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpuapp.dts @@ -18,7 +18,7 @@ zephyr,console = &uart136; zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; - zephyr,sram = &cpuapp_data; + zephyr,sram = &cpuapp_ram0; }; aliases { @@ -85,11 +85,7 @@ }; }; -&cpuapp_ram0x_region { - status = "okay"; -}; - -&shared_ram3x_region { +&ram3x_dma_region { status = "okay"; }; diff --git a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts index d639847e197..a7d142b06c4 100644 --- a/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts +++ b/boards/arm/nrf54h20pdk_nrf54h20/nrf54h20pdk_nrf54h20_cpurad.dts @@ -22,7 +22,7 @@ }; }; -&shared_ram3x_region { +&ram3x_dma_region { status = "okay"; }; From 9a57a2fae2c7d937cabeb4b01c4ab84fcb2b40e9 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:35 +0200 Subject: [PATCH 1722/2300] Revert "[nrf fromlist] dts: nordic: nrf54h20_enga: add PPR VEVIF nodes" This reverts commit 63bf0c42728cfc861e1ee5cc1e2615df445eff6e. Signed-off-by: Gerard Marull-Paretas --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 1 - dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 1 - dts/common/nordic/nrf54h20_enga.dtsi | 34 ---------------------- dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 1 - 4 files changed, 37 deletions(-) diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi index 7252b3d5a04..25585659968 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -9,7 +9,6 @@ cpu: &cpuapp {}; systick: &cpuapp_systick {}; nvic: &cpuapp_nvic {}; -cpuppr_vevif: &cpuppr_vevif_remote {}; /delete-node/ &cpuppr; /delete-node/ &cpurad; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi index d2aaa790349..e51ce316c3f 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -9,7 +9,6 @@ cpu: &cpurad {}; systick: &cpurad_systick {}; nvic: &cpurad_nvic {}; -cpuppr_vevif: &cpuppr_vevif_remote {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 610fbd81587..3a8a5759268 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -40,31 +40,6 @@ clock-frequency = ; riscv,isa = "rv32emc"; nordic,bus-width = <32>; - - cpuppr_vevif_local: mailbox { - compatible = "nordic,nrf-vevif-local"; - status = "disabled"; - interrupt-parent = <&cpuppr_clic>; - interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, - <1 NRF_DEFAULT_IRQ_PRIORITY>, - <2 NRF_DEFAULT_IRQ_PRIORITY>, - <3 NRF_DEFAULT_IRQ_PRIORITY>, - <4 NRF_DEFAULT_IRQ_PRIORITY>, - <5 NRF_DEFAULT_IRQ_PRIORITY>, - <6 NRF_DEFAULT_IRQ_PRIORITY>, - <7 NRF_DEFAULT_IRQ_PRIORITY>, - <8 NRF_DEFAULT_IRQ_PRIORITY>, - <9 NRF_DEFAULT_IRQ_PRIORITY>, - <10 NRF_DEFAULT_IRQ_PRIORITY>, - <11 NRF_DEFAULT_IRQ_PRIORITY>, - <12 NRF_DEFAULT_IRQ_PRIORITY>, - <13 NRF_DEFAULT_IRQ_PRIORITY>, - <14 NRF_DEFAULT_IRQ_PRIORITY>, - <15 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask = <0xfffffff0>; - }; }; }; @@ -324,15 +299,6 @@ #size-cells = <1>; ranges = <0x0 0x908000 0x4000>; - cpuppr_vevif_remote: mailbox@0 { - compatible = "nordic,nrf-vevif-remote"; - reg = <0x0 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask = <0xfffffff0>; - }; - cpuppr_clic: interrupt-controller@1000 { compatible = "nordic,nrf-clic"; reg = <0x1000 0x3000>; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi index 0af6618688f..dcefe95885c 100644 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -8,7 +8,6 @@ cpu: &cpuppr {}; clic: &cpuppr_clic {}; -cpuppr_vevif: &cpuppr_vevif_local {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; From 808032d592bf98a39e2209b353d44e19038c86e7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:35 +0200 Subject: [PATCH 1723/2300] Revert "[nrf fromlist] boards: arm: nrf9151dk: fix broken link" This reverts commit 11dad4da8b5634b4a3a040fe22416a6d3ae17880. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf9151dk_nrf9151/doc/index.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/boards/arm/nrf9151dk_nrf9151/doc/index.rst b/boards/arm/nrf9151dk_nrf9151/doc/index.rst index 91e9b75ad9c..4c02e7ed372 100644 --- a/boards/arm/nrf9151dk_nrf9151/doc/index.rst +++ b/boards/arm/nrf9151dk_nrf9151/doc/index.rst @@ -26,7 +26,9 @@ Cortex-M33F CPU with ARMv8-M Security Extension and the following devices: * :abbr:`WDT (Watchdog Timer)` * :abbr:`IDAU (Implementation Defined Attribution Unit)` -More information about the board can be found at the `nRF9151 website`_. +More information about the board can be found at the +`nRF9151 DK website`_. The `Nordic Semiconductor Infocenter`_ +contains the processor's information and the datasheet. Hardware @@ -82,7 +84,8 @@ hardware features: .. _nrf9151dk_additional_hardware: Other hardware features have not been enabled yet for this board. -See the `nRF9151 website`_ for more information. +See `nRF9151 DK website`_ and `Nordic Semiconductor Infocenter`_ +for a complete list of nRF9151 DK board hardware features. Connections and IOs =================== @@ -195,6 +198,6 @@ References .. _IDAU: https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau -.. _nRF9151 website: https://www.nordicsemi.com/Products/nRF9151 +.. _nRF9151 DK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9151-DK .. _Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com .. _Trusted Firmware M: https://www.trustedfirmware.org/projects/tf-m/ From 007e8a400adfa6a7036b0c226a874afdbda6a17e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:36 +0200 Subject: [PATCH 1724/2300] Revert "[nrf fromlist] dts: nordic: nrf54h20_enga: add BELLBOARD nodes" This reverts commit 077d1b2c473a0abccf9c7fc31cbac6eb23f60d27. Signed-off-by: Gerard Marull-Paretas --- dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi | 12 ------------ dts/arm/nordic/nrf54h20_enga_cpurad.dtsi | 12 ------------ dts/common/nordic/nrf54h20_enga.dtsi | 18 ------------------ dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi | 12 ------------ 4 files changed, 54 deletions(-) diff --git a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi index 25585659968..f51528d5733 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpuapp.dtsi @@ -29,18 +29,6 @@ nvic: &cpuapp_nvic {}; ranges; }; -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-local"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - &gpiote130 { interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi index e51ce316c3f..cb2767381da 100644 --- a/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_enga_cpurad.dtsi @@ -29,18 +29,6 @@ nvic: &cpurad_nvic {}; ranges; }; -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-local"; -}; - &gpiote130 { interrupts = <105 NRF_DEFAULT_IRQ_PRIORITY>; }; diff --git a/dts/common/nordic/nrf54h20_enga.dtsi b/dts/common/nordic/nrf54h20_enga.dtsi index 3a8a5759268..5a9af57801c 100644 --- a/dts/common/nordic/nrf54h20_enga.dtsi +++ b/dts/common/nordic/nrf54h20_enga.dtsi @@ -223,24 +223,6 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; - cpusec_bellboard: mailbox@99000 { - reg = <0x99000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - cpuapp_bellboard: mailbox@9a000 { - reg = <0x9a000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - - cpurad_bellboard: mailbox@9b000 { - reg = <0x9b000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - }; - timer120: timer@8e2000 { compatible = "nordic,nrf-timer"; reg = <0x8e2000 0x1000>; diff --git a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi index dcefe95885c..d42a815a4b2 100644 --- a/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_enga_cpuppr.dtsi @@ -26,18 +26,6 @@ clic: &cpuppr_clic {}; }; }; -&cpusec_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpuapp_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - -&cpurad_bellboard { - compatible = "nordic,nrf-bellboard-remote"; -}; - &gpiote130 { interrupts = <104 NRF_DEFAULT_IRQ_PRIORITY>; }; From 44efd81cd74e15e33faeb8e4d842636ba2e9ee75 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:36 +0200 Subject: [PATCH 1725/2300] Revert "[nrf fromlist] samples: drivers: mbox: misc cleanups/enhancements" This reverts commit 737da5af682b26ce089f4043b7102f1103e8dbb1. Signed-off-by: Gerard Marull-Paretas --- samples/drivers/mbox/remote/src/main.c | 26 +++++++++++++------------- samples/drivers/mbox/src/main.c | 23 +++++++++++------------ 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index 1ca832a697c..31665951172 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -4,9 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include +#include #include #include -#include #if !defined(CONFIG_RX_ENABLED) && !defined(CONFIG_TX_ENABLED) #error "At least one of CONFIG_RX_ENABLED or CONFIG_TX_ENABLED must be set" @@ -22,25 +23,24 @@ static void callback(const struct device *dev, uint32_t channel, int main(void) { - int ret; - const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + const struct device *dev; - printk("Hello from REMOTE\n"); + printk("Hello from NET\n"); + + dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); #ifdef CONFIG_RX_ENABLED struct mbox_channel rx_channel; mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); - ret = mbox_register_callback(&rx_channel, callback, NULL); - if (ret < 0) { - printk("Could not register callback (%d)\n", ret); + if (mbox_register_callback(&rx_channel, callback, NULL)) { + printk("mbox_register_callback() error\n"); return 0; } - ret = mbox_set_enabled(&rx_channel, true); - if (ret < 0) { - printk("Could not enable RX channel %d (%d)\n", rx_channel.id, ret); + if (mbox_set_enabled(&rx_channel, 1)) { + printk("mbox_set_enable() error\n"); return 0; } #endif /* CONFIG_RX_ENABLED */ @@ -51,11 +51,11 @@ int main(void) mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { + printk("Ping (on channel %d)\n", tx_channel.id); - ret = mbox_send(&tx_channel, NULL); - if (ret < 0) { - printk("Could not send (%d)\n", ret); + if (mbox_send(&tx_channel, NULL) < 0) { + printk("mbox_send() error\n"); return 0; } diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index d4dd21d342f..cea34afb29a 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -4,9 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include +#include #include #include -#include #ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, @@ -18,25 +19,24 @@ static void callback(const struct device *dev, uint32_t channel, int main(void) { - int ret; - const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + const struct device *dev; printk("Hello from APP\n"); + dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); + #ifdef CONFIG_RX_ENABLED struct mbox_channel rx_channel; mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); - ret = mbox_register_callback(&rx_channel, callback, NULL); - if (ret < 0) { - printk("Could not register callback (%d)\n", ret); + if (mbox_register_callback(&rx_channel, callback, NULL)) { + printk("mbox_register_callback() error\n"); return 0; } - ret = mbox_set_enabled(&rx_channel, true); - if (ret < 0) { - printk("Could not enable RX channel %d (%d)\n", rx_channel.id, ret); + if (mbox_set_enabled(&rx_channel, 1)) { + printk("mbox_set_enable() error\n"); return 0; } #endif /* CONFIG_RX_ENABLED */ @@ -51,9 +51,8 @@ int main(void) printk("Ping (on channel %d)\n", tx_channel.id); - ret = mbox_send(&tx_channel, NULL); - if (ret < 0) { - printk("Could not send (%d)\n", ret); + if (mbox_send(&tx_channel, NULL) < 0) { + printk("mbox_send() error\n"); return 0; } } From 0f8f21e664fb2b6460173a51868c7adde8aa45d3 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:36 +0200 Subject: [PATCH 1726/2300] Revert "[nrf fromlist] samples: drivers: mbox: allow to enable RX/TX" This reverts commit 7d399d06e46cf7594bfd17c86578b3f591220a2b. Signed-off-by: Gerard Marull-Paretas --- samples/drivers/mbox/Kconfig | 13 ------------- samples/drivers/mbox/remote/Kconfig | 13 ------------- samples/drivers/mbox/remote/src/main.c | 20 +++----------------- samples/drivers/mbox/src/main.c | 15 +++------------ 4 files changed, 6 insertions(+), 55 deletions(-) diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig index 3af6e740bfc..79dd2d09689 100644 --- a/samples/drivers/mbox/Kconfig +++ b/samples/drivers/mbox/Kconfig @@ -10,28 +10,15 @@ config INCLUDE_REMOTE_DIR Include remote build header files. Can be used if primary image needs to be aware of size or base address of secondary image -config TX_ENABLED - bool "TX enabled" - default y - help - Enable TX - config TX_CHANNEL_ID int "Channel ID for TX" default 1 - depends on TX_ENABLED help Channel ID for TX -config RX_ENABLED - bool "RX enabled" - default y - help - Enable RX config RX_CHANNEL_ID int "Channel ID for RX" - depends on RX_ENABLED default 0 help Channel ID for RX diff --git a/samples/drivers/mbox/remote/Kconfig b/samples/drivers/mbox/remote/Kconfig index 7edb8574359..a8897e4aab0 100644 --- a/samples/drivers/mbox/remote/Kconfig +++ b/samples/drivers/mbox/remote/Kconfig @@ -3,28 +3,15 @@ source "Kconfig.zephyr" -config TX_ENABLED - bool "TX enabled" - default y - help - Enable TX - config TX_CHANNEL_ID int "Channel ID for TX" default 0 - depends on TX_ENABLED help Channel ID for TX -config RX_ENABLED - bool "RX enabled" - default y - help - Enable RX config RX_CHANNEL_ID int "Channel ID for RX" - depends on RX_ENABLED default 1 help Channel ID for RX diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index 31665951172..a256ed21daa 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -9,29 +9,23 @@ #include #include -#if !defined(CONFIG_RX_ENABLED) && !defined(CONFIG_TX_ENABLED) -#error "At least one of CONFIG_RX_ENABLED or CONFIG_TX_ENABLED must be set" -#endif - -#ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { printk("Pong (on channel %d)\n", channel); } -#endif /* CONFIG_RX_ENABLED */ int main(void) { + struct mbox_channel tx_channel; + struct mbox_channel rx_channel; const struct device *dev; printk("Hello from NET\n"); dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); -#ifdef CONFIG_RX_ENABLED - struct mbox_channel rx_channel; - + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { @@ -43,12 +37,6 @@ int main(void) printk("mbox_set_enable() error\n"); return 0; } -#endif /* CONFIG_RX_ENABLED */ - -#ifdef CONFIG_TX_ENABLED - struct mbox_channel tx_channel; - - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { @@ -61,7 +49,5 @@ int main(void) k_sleep(K_MSEC(3000)); } -#endif /* CONFIG_TX_ENABLED */ - return 0; } diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index cea34afb29a..bfe28443f95 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -9,25 +9,23 @@ #include #include -#ifdef CONFIG_RX_ENABLED static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { printk("Pong (on channel %d)\n", channel); } -#endif int main(void) { + struct mbox_channel tx_channel; + struct mbox_channel rx_channel; const struct device *dev; printk("Hello from APP\n"); dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); -#ifdef CONFIG_RX_ENABLED - struct mbox_channel rx_channel; - + mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { @@ -39,12 +37,6 @@ int main(void) printk("mbox_set_enable() error\n"); return 0; } -#endif /* CONFIG_RX_ENABLED */ - -#ifdef CONFIG_TX_ENABLED - struct mbox_channel tx_channel; - - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); while (1) { k_sleep(K_MSEC(2000)); @@ -56,6 +48,5 @@ int main(void) return 0; } } -#endif /* CONFIG_TX_ENABLED */ return 0; } From 51ddaa890c217947b920bf49e2b031d114fcb3f0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:36 +0200 Subject: [PATCH 1727/2300] Revert "[nrf fromlist] samples: drivers: mbox: allow to configure RX/TX channels" This reverts commit 5e63290f335d41ccc4ead98d18a6ebd689d707dd. Signed-off-by: Gerard Marull-Paretas --- samples/drivers/mbox/Kconfig | 13 ------------- samples/drivers/mbox/remote/Kconfig | 17 ----------------- samples/drivers/mbox/remote/src/main.c | 7 +++++-- samples/drivers/mbox/src/main.c | 7 +++++-- 4 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 samples/drivers/mbox/remote/Kconfig diff --git a/samples/drivers/mbox/Kconfig b/samples/drivers/mbox/Kconfig index 79dd2d09689..3837c49b6e9 100644 --- a/samples/drivers/mbox/Kconfig +++ b/samples/drivers/mbox/Kconfig @@ -9,16 +9,3 @@ config INCLUDE_REMOTE_DIR help Include remote build header files. Can be used if primary image needs to be aware of size or base address of secondary image - -config TX_CHANNEL_ID - int "Channel ID for TX" - default 1 - help - Channel ID for TX - - -config RX_CHANNEL_ID - int "Channel ID for RX" - default 0 - help - Channel ID for RX diff --git a/samples/drivers/mbox/remote/Kconfig b/samples/drivers/mbox/remote/Kconfig deleted file mode 100644 index a8897e4aab0..00000000000 --- a/samples/drivers/mbox/remote/Kconfig +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -source "Kconfig.zephyr" - -config TX_CHANNEL_ID - int "Channel ID for TX" - default 0 - help - Channel ID for TX - - -config RX_CHANNEL_ID - int "Channel ID for RX" - default 1 - help - Channel ID for RX diff --git a/samples/drivers/mbox/remote/src/main.c b/samples/drivers/mbox/remote/src/main.c index a256ed21daa..89039e3b277 100644 --- a/samples/drivers/mbox/remote/src/main.c +++ b/samples/drivers/mbox/remote/src/main.c @@ -9,6 +9,9 @@ #include #include +#define TX_ID (0) +#define RX_ID (1) + static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { @@ -25,8 +28,8 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); - mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); + mbox_init_channel(&tx_channel, dev, TX_ID); + mbox_init_channel(&rx_channel, dev, RX_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); diff --git a/samples/drivers/mbox/src/main.c b/samples/drivers/mbox/src/main.c index bfe28443f95..d6c79729b4f 100644 --- a/samples/drivers/mbox/src/main.c +++ b/samples/drivers/mbox/src/main.c @@ -9,6 +9,9 @@ #include #include +#define TX_ID (1) +#define RX_ID (0) + static void callback(const struct device *dev, uint32_t channel, void *user_data, struct mbox_msg *data) { @@ -25,8 +28,8 @@ int main(void) dev = DEVICE_DT_GET(DT_NODELABEL(mbox)); - mbox_init_channel(&tx_channel, dev, CONFIG_TX_CHANNEL_ID); - mbox_init_channel(&rx_channel, dev, CONFIG_RX_CHANNEL_ID); + mbox_init_channel(&tx_channel, dev, TX_ID); + mbox_init_channel(&rx_channel, dev, RX_ID); if (mbox_register_callback(&rx_channel, callback, NULL)) { printk("mbox_register_callback() error\n"); From e74fbce17db01a0713bff517eebb43085016b042 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:36 +0200 Subject: [PATCH 1728/2300] Revert "[nrf fromlist] drivers: misc: nordic_vpr_launcher: initialize earlier" This reverts commit a7007991bf72bcd5051dd4aff8028b271a4af4b8. Signed-off-by: Gerard Marull-Paretas --- drivers/misc/nordic_vpr_launcher/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/nordic_vpr_launcher/Kconfig b/drivers/misc/nordic_vpr_launcher/Kconfig index 6aeabcd251c..57605e505f2 100644 --- a/drivers/misc/nordic_vpr_launcher/Kconfig +++ b/drivers/misc/nordic_vpr_launcher/Kconfig @@ -17,7 +17,7 @@ source "subsys/logging/Kconfig.template.log_config" config NORDIC_VPR_LAUNCHER_INIT_PRIORITY int "Nordic VPR coprocessor launcher init priority" - default 0 + default KERNEL_INIT_PRIORITY_DEVICE help The init priority of the VPR coprocessor launcher. From 1e1fdb95f4ffb8c08bf08337dccd3af3574d2e86 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:37 +0200 Subject: [PATCH 1729/2300] Revert "[nrf fromlist] drivers: modem_cellular: fine tune nRF91's shutdown_time" This reverts commit eab783c7d645bee60606def787caad29d0d01f5f. Signed-off-by: Gerard Marull-Paretas --- drivers/modem/modem_cellular.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 276c9d38f7b..ed4e998fec3 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -2219,7 +2219,7 @@ MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, .power_pulse_duration_ms = 100, \ .reset_pulse_duration_ms = 100, \ .startup_time_ms = 2000, \ - .shutdown_time_ms = 10000, \ + .shutdown_time_ms = 3000, \ .init_chat_script = &nordic_nrf91_slm_init_chat_script, \ .dial_chat_script = &nordic_nrf91_slm_dial_chat_script, \ .periodic_chat_script = &nordic_nrf91_slm_periodic_chat_script, \ From df58e1a30229b9e84b0e2ab83c2ae12f469851aa Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:37 +0200 Subject: [PATCH 1730/2300] Revert "[nrf fromlist] drivers: modem_cellular: add nRF91 series (w/ SLM)" This reverts commit a1f3dbbb5fd7e01c00a777076eb1de5c7d46dbf1. Signed-off-by: Gerard Marull-Paretas --- drivers/modem/Kconfig.cellular | 3 +- drivers/modem/modem_cellular.c | 67 ------------------- dts/bindings/modem/nordic,nrf91-slm.yaml | 9 --- .../boards/nrf9160dk_nrf9160_ns.conf | 16 ----- .../boards/nrf9160dk_nrf9160_ns.overlay | 34 ---------- tests/drivers/build_all/modem/uart.dtsi | 6 -- 6 files changed, 1 insertion(+), 134 deletions(-) delete mode 100644 dts/bindings/modem/nordic,nrf91-slm.yaml delete mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf delete mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index aacf4449d28..599a8a61138 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -15,8 +15,7 @@ config MODEM_CELLULAR depends on (DT_HAS_QUECTEL_BG95_ENABLED || DT_HAS_ZEPHYR_GSM_PPP_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ DT_HAS_U_BLOX_SARA_R5_ENABLED || DT_HAS_SWIR_HL7800_ENABLED || \ - DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED || \ - DT_HAS_NORDIC_NRF91_SLM_ENABLED) + DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED) help This driver uses the generic 3gpp AT commands, along with the standard protocols CMUX and PPP, to configure diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index ed4e998fec3..63430d45c1a 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1933,41 +1933,6 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, modem_cellular_chat_callback_handler, 4); #endif -#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf91_slm) -MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_init_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP_MULT("AT", allow_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CMEE=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGSN", imei_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMM", cgmm_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMI", cgmi_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGMR", cgmr_match), - MODEM_CHAT_SCRIPT_CMD_RESP("", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT#XCMUX=1", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_init_chat_script, nordic_nrf91_slm_init_chat_script_cmds, - abort_matches, modem_cellular_chat_callback_handler, 10); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_dial_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=4", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CFUN=1", ok_match), - MODEM_CHAT_SCRIPT_CMD_RESP("AT#XCMUX=2", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_dial_chat_script, nordic_nrf91_slm_dial_chat_script_cmds, - dial_abort_matches, modem_cellular_chat_callback_handler, 10); - -MODEM_CHAT_SCRIPT_CMDS_DEFINE(nordic_nrf91_slm_periodic_chat_script_cmds, - MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match)); - -MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, - nordic_nrf91_slm_periodic_chat_script_cmds, abort_matches, - modem_cellular_chat_callback_handler, 4); -#endif - #define MODEM_CELLULAR_INST_NAME(name, inst) \ _CONCAT(_CONCAT(_CONCAT(name, _), DT_DRV_COMPAT), inst) @@ -2204,34 +2169,6 @@ MODEM_CHAT_SCRIPT_DEFINE(nordic_nrf91_slm_periodic_chat_script, &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ &modem_cellular_api); -#define MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM(inst) \ - MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 1500); \ - \ - static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r\n", \ - .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ - }; \ - \ - static struct modem_cellular_config MODEM_CELLULAR_INST_NAME(config, inst) = { \ - .uart = DEVICE_DT_GET(DT_INST_BUS(inst)), \ - .power_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_power_gpios, {}), \ - .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, mdm_reset_gpios, {}), \ - .power_pulse_duration_ms = 100, \ - .reset_pulse_duration_ms = 100, \ - .startup_time_ms = 2000, \ - .shutdown_time_ms = 3000, \ - .init_chat_script = &nordic_nrf91_slm_init_chat_script, \ - .dial_chat_script = &nordic_nrf91_slm_dial_chat_script, \ - .periodic_chat_script = &nordic_nrf91_slm_periodic_chat_script, \ - }; \ - \ - PM_DEVICE_DT_INST_DEFINE(inst, modem_cellular_pm_action); \ - \ - DEVICE_DT_INST_DEFINE(inst, modem_cellular_init, PM_DEVICE_DT_INST_GET(inst), \ - &MODEM_CELLULAR_INST_NAME(data, inst), \ - &MODEM_CELLULAR_INST_NAME(config, inst), POST_KERNEL, 99, \ - &modem_cellular_api); - #define DT_DRV_COMPAT quectel_bg95 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_QUECTEL_BG95) #undef DT_DRV_COMPAT @@ -2263,7 +2200,3 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) #define DT_DRV_COMPAT telit_me910g1 DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) #undef DT_DRV_COMPAT - -#define DT_DRV_COMPAT nordic_nrf91_slm -DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM) -#undef DT_DRV_COMPAT diff --git a/dts/bindings/modem/nordic,nrf91-slm.yaml b/dts/bindings/modem/nordic,nrf91-slm.yaml deleted file mode 100644 index 3f06696197d..00000000000 --- a/dts/bindings/modem/nordic,nrf91-slm.yaml +++ /dev/null @@ -1,9 +0,0 @@ -description: Nordic nRF91 series running the Serial LTE Modem application - -compatible: "nordic,nrf91-slm" - -include: uart-device.yaml - -properties: - mdm-power-gpios: - type: phandle-array diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf deleted file mode 100644 index 441a5395ca1..00000000000 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.conf +++ /dev/null @@ -1,16 +0,0 @@ -CONFIG_UART_ASYNC_API=y - -# Align with the Serial LTE Modem (SLM) application. -CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE=1500 -CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=1500 - -# Allow large UART TXs to go through @115200. -CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS=200 - -# Prevent sockets getting offloaded to the modem. -CONFIG_NET_SOCKETS_OFFLOAD=n - -# Print logs and printk() output on uart0. -CONFIG_LOG=y -CONFIG_LOG_BACKEND_UART=y -CONFIG_MODEM_LOG_LEVEL_DBG=y diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay b/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay deleted file mode 100644 index 44ce80601a1..00000000000 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf9160_ns.overlay +++ /dev/null @@ -1,34 +0,0 @@ -/ { - aliases { - modem = &modem; - }; -}; - -&uart1 { - compatible = "nordic,nrf-uarte"; - current-speed = <115200>; - hw-flow-control; - status = "okay"; - - pinctrl-0 = <&uart1_default_alt>; - - modem: modem { - compatible = "nordic,nrf91-slm"; - status = "okay"; - mdm-power-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; - }; -}; - -&pinctrl { - uart1_default_alt: uart1_default_alt { - group1 { - psels = ; - bias-pull-up; - }; - group2 { - psels = , - , - ; - }; - }; -}; diff --git a/tests/drivers/build_all/modem/uart.dtsi b/tests/drivers/build_all/modem/uart.dtsi index 08da2c325d3..3d649a2ff60 100644 --- a/tests/drivers/build_all/modem/uart.dtsi +++ b/tests/drivers/build_all/modem/uart.dtsi @@ -70,9 +70,3 @@ test_telit_me910g1: telit_me910g1 { test_esp_at: esp_at { compatible = "espressif,esp-at"; }; - -test_nordic_nrf91_slm: nordic_nrf91_slm { - compatible = "nordic,nrf91-slm"; - - mdm-power-gpios = <&test_gpio 0 0>; -}; From 48589d9d652de64ea7c2979789bf267999c85c6b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:37 +0200 Subject: [PATCH 1731/2300] Revert "[nrf fromlist] drivers: modem_cellular: make the buffer sizes configurable" This reverts commit e17559225295a1803af8a7c265c48b75128aae3d. Signed-off-by: Gerard Marull-Paretas --- drivers/modem/Kconfig.cellular | 14 -------------- drivers/modem/modem_cellular.c | 15 +++++++-------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 599a8a61138..0460cda8d96 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -36,18 +36,4 @@ config MODEM_CELLULAR_PERIODIC_SCRIPT_MS int "Periodic script interval in milliseconds" default 2000 -config MODEM_CELLULAR_UART_BUFFER_SIZES - int "The UART receive and transmit buffer sizes in bytes." - default 512 - -config MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE - int "The maximum CMUX frame size in bytes." - default 128 - help - This value affects the size of buffers used to receive and transmit CMUX frames. - -config MODEM_CELLULAR_CHAT_BUFFER_SIZES - int "The size of the buffers used for the chat scripts in bytes." - default 128 - endif diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 63430d45c1a..35b05602a74 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -79,24 +79,23 @@ struct modem_cellular_data { /* UART backend */ struct modem_pipe *uart_pipe; struct modem_backend_uart uart_backend; - uint8_t uart_backend_receive_buf[CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES]; - uint8_t uart_backend_transmit_buf[CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES]; + uint8_t uart_backend_receive_buf[512]; + uint8_t uart_backend_transmit_buf[512]; /* CMUX */ struct modem_cmux cmux; - uint8_t cmux_receive_buf[CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; - uint8_t cmux_transmit_buf[2 * CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; + uint8_t cmux_receive_buf[128]; + uint8_t cmux_transmit_buf[256]; struct modem_cmux_dlci dlci1; struct modem_cmux_dlci dlci2; struct modem_pipe *dlci1_pipe; struct modem_pipe *dlci2_pipe; - uint8_t dlci1_receive_buf[CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE]; - /* DLCI 2 is only used for chat scripts. */ - uint8_t dlci2_receive_buf[CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES]; + uint8_t dlci1_receive_buf[128]; + uint8_t dlci2_receive_buf[256]; /* Modem chat */ struct modem_chat chat; - uint8_t chat_receive_buf[CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES]; + uint8_t chat_receive_buf[128]; uint8_t *chat_delimiter; uint8_t *chat_filter; uint8_t *chat_argv[32]; From a0819fa974ce932b3175dee011e43a8718aa53a8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:37 +0200 Subject: [PATCH 1732/2300] Revert "[nrf fromlist] drivers: modem_cellular: allow variable length chat delimiter and filter" This reverts commit 45209857cb06da35772e88e66e6ca38cf7a05cbe. Signed-off-by: Gerard Marull-Paretas --- drivers/modem/modem_cellular.c | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 35b05602a74..f5e099cd08c 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -96,8 +96,8 @@ struct modem_cellular_data { /* Modem chat */ struct modem_chat chat; uint8_t chat_receive_buf[128]; - uint8_t *chat_delimiter; - uint8_t *chat_filter; + uint8_t chat_delimiter[1]; + uint8_t chat_filter[1]; uint8_t *chat_argv[32]; /* Status */ @@ -424,9 +424,9 @@ MODEM_CHAT_MATCH_DEFINE(imei_match, "", "", modem_cellular_chat_on_imei); MODEM_CHAT_MATCH_DEFINE(cgmm_match, "", "", modem_cellular_chat_on_cgmm); MODEM_CHAT_MATCH_DEFINE(csq_match, "+CSQ: ", ",", modem_cellular_chat_on_csq); MODEM_CHAT_MATCH_DEFINE(cesq_match, "+CESQ: ", ",", modem_cellular_chat_on_cesq); -MODEM_CHAT_MATCH_DEFINE(cimi_match __maybe_unused, "", "", modem_cellular_chat_on_imsi); -MODEM_CHAT_MATCH_DEFINE(cgmi_match __maybe_unused, "", "", modem_cellular_chat_on_cgmi); -MODEM_CHAT_MATCH_DEFINE(cgmr_match __maybe_unused, "", "", modem_cellular_chat_on_cgmr); +MODEM_CHAT_MATCH_DEFINE(cimi_match, "", "", modem_cellular_chat_on_imsi); +MODEM_CHAT_MATCH_DEFINE(cgmi_match, "", "", modem_cellular_chat_on_cgmi); +MODEM_CHAT_MATCH_DEFINE(cgmr_match, "", "", modem_cellular_chat_on_cgmr); MODEM_CHAT_MATCHES_DEFINE(unsol_matches, MODEM_CHAT_MATCH("+CREG: ", ",", modem_cellular_chat_on_cxreg), @@ -1513,9 +1513,9 @@ static int modem_cellular_init(const struct device *dev) .receive_buf = data->chat_receive_buf, .receive_buf_size = ARRAY_SIZE(data->chat_receive_buf), .delimiter = data->chat_delimiter, - .delimiter_size = strlen(data->chat_delimiter), + .delimiter_size = ARRAY_SIZE(data->chat_delimiter), .filter = data->chat_filter, - .filter_size = strlen(data->chat_filter), + .filter_size = ARRAY_SIZE(data->chat_filter), .argv = data->chat_argv, .argv_size = ARRAY_SIZE(data->chat_argv), .unsol_matches = unsol_matches, @@ -1939,8 +1939,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -1968,8 +1968,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -1997,8 +1997,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2026,8 +2026,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2055,8 +2055,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2084,8 +2084,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2114,8 +2114,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ @@ -2143,8 +2143,8 @@ MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ \ static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ - .chat_delimiter = "\r", \ - .chat_filter = "\n", \ + .chat_delimiter = {'\r'}, \ + .chat_filter = {'\n'}, \ .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ }; \ \ From 423638f70c975e8f027016bc76fcc2978cd8cf99 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:38 +0200 Subject: [PATCH 1733/2300] Revert "[nrf fromtree] drivers: ieee802154_nrf5: Use Radio IRQ number from DT" This reverts commit 869cf57a5f72df5e2974d8c87e2b7d4079bdb68e. Signed-off-by: Gerard Marull-Paretas --- drivers/ieee802154/ieee802154_nrf5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 67b5431e9cc..ecc758455d7 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -738,8 +738,9 @@ static void nrf5_irq_config(const struct device *dev) ARG_UNUSED(dev); #if !IS_ENABLED(CONFIG_IEEE802154_NRF5_EXT_IRQ_MGMT) - IRQ_CONNECT(DT_IRQN(DT_NODELABEL(radio)), NRF_802154_IRQ_PRIORITY, nrf5_radio_irq, NULL, 0); - irq_enable(DT_IRQN(DT_NODELABEL(radio))); + IRQ_CONNECT(RADIO_IRQn, NRF_802154_IRQ_PRIORITY, + nrf5_radio_irq, NULL, 0); + irq_enable(RADIO_IRQn); #endif } From e277f4fac82662ed3f9f44cd5f938e069065364d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:38 +0200 Subject: [PATCH 1734/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx_glue add missing code for nrf_802154" This reverts commit e9136301ebee6633b91ac35d21662b36c027e2eb. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/nrfx/nrfx_glue.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/hal_nordic/nrfx/nrfx_glue.h b/modules/hal_nordic/nrfx/nrfx_glue.h index 748c5eafd47..0edda440112 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.h +++ b/modules/hal_nordic/nrfx/nrfx_glue.h @@ -364,10 +364,6 @@ void nrfx_busy_wait(uint32_t usec_to_wait); #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 #else #error Unsupported chip family #endif From 4e088be990755ad3e4fe7d13c42bab9bca8be4cb Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:38 +0200 Subject: [PATCH 1735/2300] Revert "[nrf fromtree] Bluetooth: Shell: Add support for EAD" This reverts commit aa2eeb1a34df2d9abcdb46c9b85aafbf8fbc768f. Signed-off-by: Gerard Marull-Paretas --- .../bluetooth/bluetooth-shell.rst | 84 ----- subsys/bluetooth/shell/bt.c | 340 ------------------ tests/bluetooth/shell/prj.conf | 2 - 3 files changed, 426 deletions(-) diff --git a/doc/connectivity/bluetooth/bluetooth-shell.rst b/doc/connectivity/bluetooth/bluetooth-shell.rst index 2b38f4c7b6f..f639cb0b030 100644 --- a/doc/connectivity/bluetooth/bluetooth-shell.rst +++ b/doc/connectivity/bluetooth/bluetooth-shell.rst @@ -228,90 +228,6 @@ Let's now have a look at some extended advertising features. To enable extended 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 ****************** diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index e8952e47526..bbe794969d7 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -32,7 +32,6 @@ #include #include #include -#include #include @@ -217,30 +216,6 @@ static struct bt_scan_filter { static const char scan_response_label[] = "[DEVICE]: "; static bool scan_verbose_output; -#if defined(CONFIG_BT_EAD) -static uint8_t bt_shell_ead_session_key[BT_EAD_KEY_SIZE] = {0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, - 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, - 0xCC, 0xCD, 0xCE, 0xCF}; -static uint8_t bt_shell_ead_iv[BT_EAD_IV_SIZE] = {0xFB, 0x56, 0xE1, 0xDA, 0xDC, 0x7E, 0xAD, 0xF5}; - -/* this is the number of ad struct allowed */ -#define BT_SHELL_EAD_MAX_AD 10 -static size_t bt_shell_ead_ad_len; - -#if defined(CONFIG_BT_CTLR_ADV_DATA_LEN_MAX) -/* this is the maximum total size of the ad data */ -#define BT_SHELL_EAD_DATA_MAX_SIZE CONFIG_BT_CTLR_ADV_DATA_LEN_MAX -#else -#define BT_SHELL_EAD_DATA_MAX_SIZE 31 -#endif -static size_t bt_shell_ead_data_size; -static uint8_t bt_shell_ead_data[BT_SHELL_EAD_DATA_MAX_SIZE] = {0}; - -int ead_update_ad(void); -#endif - -static bool bt_shell_ead_decrypt_scan; - /** * @brief Compares two strings without case sensitivy * @@ -408,36 +383,6 @@ static bool data_verbose_cb(struct bt_data *data, void *user_data) case BT_DATA_CSIS_RSI: print_data_set(3, data->data, data->data_len); break; - case BT_DATA_ENCRYPTED_AD_DATA: - shell_fprintf(ctx_shell, SHELL_INFO, "Encrypted Advertising Data: "); - print_data_set(1, data->data, data->data_len); - - if (bt_shell_ead_decrypt_scan) { -#if defined(CONFIG_BT_EAD) - shell_fprintf(ctx_shell, SHELL_INFO, "\n%*s[START DECRYPTED DATA]\n", - strlen(scan_response_label), ""); - - int ead_err; - struct net_buf_simple decrypted_buf; - size_t decrypted_data_size = BT_EAD_DECRYPTED_PAYLOAD_SIZE(data->data_len); - uint8_t decrypted_data[decrypted_data_size]; - - ead_err = bt_ead_decrypt(bt_shell_ead_session_key, bt_shell_ead_iv, - data->data, data->data_len, decrypted_data); - if (ead_err) { - shell_error(ctx_shell, "Error during decryption (err %d)", ead_err); - } - - net_buf_simple_init_with_data(&decrypted_buf, &decrypted_data[0], - decrypted_data_size); - - bt_data_parse(&decrypted_buf, &data_verbose_cb, user_data); - - shell_fprintf(ctx_shell, SHELL_INFO, "%*s[END DECRYPTED DATA]", - strlen(scan_response_label), ""); -#endif - } - break; default: print_data_set(1, data->data, data->data_len); } @@ -636,13 +581,6 @@ static bool adv_rpa_expired(struct bt_le_ext_adv *adv) adv_index, adv, keep_rpa ? "not expired" : "expired"); -#if defined(CONFIG_BT_EAD) - /* EAD must be updated each time the RPA is updated */ - if (!keep_rpa) { - ead_update_ad(); - } -#endif - return keep_rpa; } #endif /* defined(CONFIG_BT_PRIVACY) */ @@ -4189,267 +4127,6 @@ static int cmd_auth_oob_tk(const struct shell *sh, size_t argc, char *argv[]) #endif /* !defined(CONFIG_BT_SMP_SC_PAIR_ONLY) */ #endif /* CONFIG_BT_SMP) || CONFIG_BT_BREDR */ -#if defined(CONFIG_BT_EAD) -static int cmd_encrypted_ad_set_keys(const struct shell *sh, size_t argc, char *argv[]) -{ - size_t len; - - const char *session_key = argv[1]; - const char *iv = argv[2]; - - len = hex2bin(session_key, strlen(session_key), bt_shell_ead_session_key, BT_EAD_KEY_SIZE); - if (len != BT_EAD_KEY_SIZE) { - shell_error(sh, "Failed to set session key"); - return -ENOEXEC; - } - - len = hex2bin(iv, strlen(iv), bt_shell_ead_iv, BT_EAD_IV_SIZE); - if (len != BT_EAD_IV_SIZE) { - shell_error(sh, "Failed to set initialisation vector"); - return -ENOEXEC; - } - - shell_info(sh, "session key set to:"); - shell_hexdump(sh, bt_shell_ead_session_key, BT_EAD_KEY_SIZE); - shell_info(sh, "initialisation vector set to:"); - shell_hexdump(sh, bt_shell_ead_iv, BT_EAD_IV_SIZE); - - return 0; -} - -int encrypted_ad_store_ad(const struct shell *sh, uint8_t type, const uint8_t *data, - uint8_t data_len) -{ - /* data_len is the size of the data, add two bytes for the size of the type - * and the length that will be stored with the data - */ - uint8_t new_data_size = data_len + 2; - - if (bt_shell_ead_data_size + new_data_size > BT_SHELL_EAD_DATA_MAX_SIZE) { - shell_error(sh, "Failed to add data (trying to add %d but %d already used on %d)", - new_data_size, bt_shell_ead_data_size, BT_SHELL_EAD_DATA_MAX_SIZE); - return -ENOEXEC; - } - - /* the length is the size of the data + the size of the type */ - bt_shell_ead_data[bt_shell_ead_data_size] = data_len + 1; - bt_shell_ead_data[bt_shell_ead_data_size + 1] = type; - memcpy(&bt_shell_ead_data[bt_shell_ead_data_size + 2], data, data_len); - - bt_shell_ead_data_size += new_data_size; - bt_shell_ead_ad_len += 1; - - return 0; -} - -bool is_payload_valid_ad(uint8_t *payload, size_t payload_size) -{ - size_t idx = 0; - bool is_valid = true; - - uint8_t ad_len; - - while (idx < payload_size) { - ad_len = payload[idx]; - - if (payload_size <= ad_len) { - is_valid = false; - break; - } - - idx += ad_len + 1; - } - - if (idx != payload_size) { - is_valid = false; - } - - return is_valid; -} - -static int cmd_encrypted_ad_add_ead(const struct shell *sh, size_t argc, char *argv[]) -{ - size_t len; - - char *hex_payload = argv[1]; - size_t hex_payload_size = strlen(hex_payload); - - uint8_t payload[BT_SHELL_EAD_DATA_MAX_SIZE] = {0}; - uint8_t payload_size = hex_payload_size / 2 + hex_payload_size % 2; - - uint8_t ead_size = BT_EAD_ENCRYPTED_PAYLOAD_SIZE(payload_size); - - if (ead_size > BT_SHELL_EAD_DATA_MAX_SIZE) { - shell_error(sh, - "Failed to add data. Maximum AD size is %d, passed data size after " - "encryption is %d", - BT_SHELL_EAD_DATA_MAX_SIZE, ead_size); - return -ENOEXEC; - } - - len = hex2bin(hex_payload, hex_payload_size, payload, BT_SHELL_EAD_DATA_MAX_SIZE); - if (len != payload_size) { - shell_error(sh, "Failed to add data"); - return -ENOEXEC; - } - - /* check that the given advertising data structures are valid before encrypting them */ - if (!is_payload_valid_ad(payload, payload_size)) { - shell_error(sh, "Failed to add data. Advertising structure are malformed."); - return -ENOEXEC; - } - - /* store not-yet encrypted AD but claim the expected size of encrypted AD */ - return encrypted_ad_store_ad(sh, BT_DATA_ENCRYPTED_AD_DATA, payload, ead_size); -} - -static int cmd_encrypted_ad_add_ad(const struct shell *sh, size_t argc, char *argv[]) -{ - size_t len; - uint8_t ad_len; - uint8_t ad_type; - - char *hex_payload = argv[1]; - size_t hex_payload_size = strlen(hex_payload); - - uint8_t payload[BT_SHELL_EAD_DATA_MAX_SIZE] = {0}; - uint8_t payload_size = hex_payload_size / 2 + hex_payload_size % 2; - - len = hex2bin(hex_payload, hex_payload_size, payload, BT_SHELL_EAD_DATA_MAX_SIZE); - if (len != payload_size) { - shell_error(sh, "Failed to add data"); - return -ENOEXEC; - } - - /* the length received is the length of ad data + the length of the data - * type but `bt_data` struct `data_len` field is only the size of the - * data - */ - ad_len = payload[0] - 1; - ad_type = payload[1]; - - /* if the ad data is malformed or there is more than 1 ad data passed we - * fail - */ - if (len != ad_len + 2) { - shell_error(sh, - "Failed to add data. Data need to be formated as specified in the " - "Core Spec. Only one non-encrypted AD payload can be added at a time."); - return -ENOEXEC; - } - - return encrypted_ad_store_ad(sh, ad_type, payload, payload_size); -} - -static int cmd_encrypted_ad_clear_ad(const struct shell *sh, size_t argc, char *argv[]) -{ - memset(bt_shell_ead_data, 0, BT_SHELL_EAD_DATA_MAX_SIZE); - - bt_shell_ead_ad_len = 0; - bt_shell_ead_data_size = 0; - - shell_info(sh, "Advertising data has been cleared."); - - return 0; -} - -int ead_encrypt_ad(const uint8_t *payload, uint8_t payload_size, uint8_t *encrypted_payload) -{ - int err; - - err = bt_ead_encrypt(bt_shell_ead_session_key, bt_shell_ead_iv, payload, payload_size, - encrypted_payload); - if (err != 0) { - shell_error(ctx_shell, "Failed to encrypt AD."); - return -1; - } - - return 0; -} - -int ead_update_ad(void) -{ - int err; - size_t idx = 0; - struct bt_le_ext_adv *adv = adv_sets[selected_adv]; - - struct bt_data *ad; - size_t ad_structs_idx = 0; - struct bt_data ad_structs[BT_SHELL_EAD_MAX_AD] = {0}; - - size_t encrypted_data_buf_len = 0; - uint8_t encrypted_data_buf[BT_SHELL_EAD_DATA_MAX_SIZE] = {0}; - - while (idx < bt_shell_ead_data_size && ad_structs_idx < BT_SHELL_EAD_MAX_AD) { - ad = &ad_structs[ad_structs_idx]; - - /* the data_len from bt_data struct doesn't include the size of the type */ - ad->data_len = bt_shell_ead_data[idx] - 1; - - if (ad->data_len < 0) { - /* if the len is less than 0 that mean there is not even a type field */ - shell_error(ctx_shell, "Failed to update AD due to malformed AD."); - return -ENOEXEC; - } - - ad->type = bt_shell_ead_data[idx + 1]; - - if (ad->data_len > 0) { - if (ad->type == BT_DATA_ENCRYPTED_AD_DATA) { - /* for EAD the size used to store the non-encrypted data - * is the size of those data when encrypted - */ - ead_encrypt_ad(&bt_shell_ead_data[idx + 2], - BT_EAD_DECRYPTED_PAYLOAD_SIZE(ad->data_len), - &encrypted_data_buf[encrypted_data_buf_len]); - - ad->data = &encrypted_data_buf[encrypted_data_buf_len]; - encrypted_data_buf_len += ad->data_len; - } else { - ad->data = &bt_shell_ead_data[idx + 2]; - } - } - - ad_structs_idx += 1; - idx += ad->data_len + 2; - } - - err = bt_le_ext_adv_set_data(adv, ad_structs, bt_shell_ead_ad_len, NULL, 0); - if (err != 0) { - shell_error(ctx_shell, "Failed to set advertising data (err %d)", err); - return -ENOEXEC; - } - - shell_info(ctx_shell, "Advertising data for Advertiser[%d] %p updated.", selected_adv, adv); - - return 0; -} - -static int cmd_encrypted_ad_commit_ad(const struct shell *sh, size_t argc, char *argv[]) -{ - return ead_update_ad(); -} - -static int cmd_encrypted_ad_decrypt_scan(const struct shell *sh, size_t argc, char *argv[]) -{ - const char *action = argv[1]; - - if (strcmp(action, "on") == 0) { - bt_shell_ead_decrypt_scan = true; - shell_info(sh, "Received encrypted advertising data will now be decrypted using " - "provided key materials."); - } else if (strcmp(action, "off") == 0) { - bt_shell_ead_decrypt_scan = false; - shell_info(sh, "Received encrypted advertising data will now longer be decrypted."); - } else { - shell_error(sh, "Invalid option."); - return -ENOEXEC; - } - - return 0; -} -#endif - static int cmd_default_handler(const struct shell *sh, size_t argc, char **argv) { if (argc == 1) { @@ -4497,19 +4174,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_scan_filter_clear_cmds, ); #endif /* CONFIG_BT_OBSERVER */ -#if defined(CONFIG_BT_EAD) -SHELL_STATIC_SUBCMD_SET_CREATE( - bt_encrypted_ad_cmds, - SHELL_CMD_ARG(set-keys, NULL, " ", cmd_encrypted_ad_set_keys, 3, - 0), - SHELL_CMD_ARG(add-ead, NULL, "", cmd_encrypted_ad_add_ead, 2, 0), - SHELL_CMD_ARG(add-ad, NULL, "", cmd_encrypted_ad_add_ad, 2, 0), - SHELL_CMD(clear-ad, NULL, HELP_NONE, cmd_encrypted_ad_clear_ad), - SHELL_CMD(commit-ad, NULL, HELP_NONE, cmd_encrypted_ad_commit_ad), - SHELL_CMD_ARG(decrypt-scan, NULL, HELP_ONOFF, cmd_encrypted_ad_decrypt_scan, 2, 0), - SHELL_SUBCMD_SET_END); -#endif - SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, SHELL_CMD_ARG(init, NULL, "[no-settings-load], [sync]", cmd_init, 1, 2), @@ -4598,10 +4262,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, cmd_per_adv_sync_delete, 1, 1), SHELL_CMD_ARG(per-adv-sync-select, NULL, "[adv]", cmd_per_adv_sync_select, 1, 1), #endif /* defined(CONFIG_BT_PER_ADV_SYNC) */ -#if defined(CONFIG_BT_EAD) - SHELL_CMD(encrypted-ad, &bt_encrypted_ad_cmds, "Manage advertiser with encrypted data", - cmd_default_handler), -#endif /* CONFIG_BT_EAD */ #if defined(CONFIG_BT_CONN) #if defined(CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER) SHELL_CMD_ARG(past-subscribe, NULL, "[conn] [skip ] " diff --git a/tests/bluetooth/shell/prj.conf b/tests/bluetooth/shell/prj.conf index 185167de1d1..168ccf62a7f 100644 --- a/tests/bluetooth/shell/prj.conf +++ b/tests/bluetooth/shell/prj.conf @@ -46,8 +46,6 @@ CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_USER_DATA_LEN_UPDATE=y CONFIG_BT_AUTO_DATA_LEN_UPDATE=y -CONFIG_BT_EAD=y - CONFIG_BT_USER_PHY_UPDATE=y CONFIG_BT_AUTO_PHY_UPDATE=y From ffbc70cdd6331edae8607e3509d44e08eeb448cb Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:38 +0200 Subject: [PATCH 1736/2300] Revert "[nrf fromtree] Bluetooth: add missing initilization of sync_info member" This reverts commit daefd697e55896e075fd75c5e8c8e79c439b87b5. Signed-off-by: Gerard Marull-Paretas --- subsys/bluetooth/host/scan.c | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index ceb4fd2428e..0b61305e2c3 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -1246,7 +1246,6 @@ static void bt_hci_le_past_received_common(struct net_buf *buf) sync_info.addr = &per_adv_sync->addr; sync_info.sid = per_adv_sync->sid; sync_info.service_data = sys_le16_to_cpu(evt->service_data); - sync_info.recv_enabled = true; #if defined(CONFIG_BT_PER_ADV_SYNC_RSP) sync_info.num_subevents = per_adv_sync->num_subevents; From 988c412d1c90ff3d47f1b5711186f36f3aeafd81 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:38 +0200 Subject: [PATCH 1737/2300] Revert "[nrf fromtree] modules: crypto: update tinycrypt revision" This reverts commit efbf382d11bde519e7b0fb8f15ee87080271be55. 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 3da134e76ce..4d04f7fecaf 100644 --- a/west.yml +++ b/west.yml @@ -317,7 +317,7 @@ manifest: groups: - debug - name: tinycrypt - revision: 1012a3ebee18c15ede5efc8332ee2fc37817670f + revision: 3e9a49d2672ec01435ffbf0d788db6d95ef28de0 path: modules/crypto/tinycrypt groups: - crypto From ec399a0bf1798ceec9fd5d70f9f68825b2e34b82 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:39 +0200 Subject: [PATCH 1738/2300] Revert "[nrf noup] boards: arm: nrf9131ek: enable tfm" This reverts commit 9377fa01e755a19c0aad584c55d5665e327a2db5. Signed-off-by: Gerard Marull-Paretas --- boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig b/boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig index 378a58fb6e3..0ece4f9a2ac 100644 --- a/boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig +++ b/boards/arm/nrf9131ek_nrf9131/Kconfig.defconfig @@ -8,22 +8,6 @@ if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS config BOARD default "nrf9131ek_nrf9131" - -# By default, if we build for a Non-Secure version of the board, -# enable building with TF-M as the Secure Execution Environment. -config BUILD_WITH_TFM - default y if BOARD_NRF9131EK_NRF9131_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 - # 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- From 1975a842591153dd6dd68c468dcbb6b29cf3ff29 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:39 +0200 Subject: [PATCH 1739/2300] Revert "[nrf noup] boards: thingy53_nrf5340: Enable MCUboot by default" This reverts commit b923938da11c598ad0c5d0b3a7eeacf3d771a166. Signed-off-by: Gerard Marull-Paretas --- boards/arm/thingy53_nrf5340/Kconfig.defconfig | 6 ------ boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi | 1 - 2 files changed, 7 deletions(-) diff --git a/boards/arm/thingy53_nrf5340/Kconfig.defconfig b/boards/arm/thingy53_nrf5340/Kconfig.defconfig index 2c5dfa46d9c..0b9246e1787 100644 --- a/boards/arm/thingy53_nrf5340/Kconfig.defconfig +++ b/boards/arm/thingy53_nrf5340/Kconfig.defconfig @@ -8,12 +8,6 @@ if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS config BOARD default "thingy53_nrf5340_cpuapp" -config BOOTLOADER_MCUBOOT - default y if !MCUBOOT - -config BOARD_ENABLE_CPUNET - default y if !MCUBOOT - # Code Partition: # # For the secure version of the board the firmware is linked at the beginning diff --git a/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi b/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi index 54efd588cf7..694a6960584 100644 --- a/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi +++ b/boards/arm/thingy53_nrf5340/thingy53_nrf5340_common.dtsi @@ -16,7 +16,6 @@ zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,ieee802154 = &ieee802154; - nordic,pm-ext-flash = &mx25r64; }; buttons { From a28972bb2f81c77e987ca659ad6a743cd7d77738 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:39 +0200 Subject: [PATCH 1740/2300] Revert "[nrf noup] boards: arm: thingy53: Disable USB CDC added by MCUBoot" This reverts commit ef801f13ca0f4dd63cced39b527f6adb90c1eff0. Signed-off-by: Gerard Marull-Paretas --- boards/arm/thingy53_nrf5340/Kconfig.defconfig | 7 ------- 1 file changed, 7 deletions(-) diff --git a/boards/arm/thingy53_nrf5340/Kconfig.defconfig b/boards/arm/thingy53_nrf5340/Kconfig.defconfig index 0b9246e1787..12f1e5bbdc9 100644 --- a/boards/arm/thingy53_nrf5340/Kconfig.defconfig +++ b/boards/arm/thingy53_nrf5340/Kconfig.defconfig @@ -136,13 +136,6 @@ endif # LOG endif # BOARD_SERIAL_BACKEND_CDC_ACM -# By default, a USB CDC ACM instance is already enabled in the board's DTS. -# It is not necessary for nRF Connect SDK to add another instance if MCUBoot -# bootloader is built as a child image. -config MCUBOOT_USB_SUPPORT - bool - default n - endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS if BOARD_THINGY53_NRF5340_CPUNET From 7c14eba611f9ff7eb686ff8c12d2822384ac04d9 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:39 +0200 Subject: [PATCH 1741/2300] Revert "[nrf noup] boards: thingy53_nrf5340: Add common partition map" This reverts commit 5b9d7df92cafb0e4b97430d61e3717055b46743a. Signed-off-by: Gerard Marull-Paretas --- .../pm_static_thingy53_nrf5340_cpuapp.yml | 55 -------------- .../pm_static_thingy53_nrf5340_cpuapp_ns.yml | 73 ------------------- 2 files changed, 128 deletions(-) delete mode 100644 boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp.yml delete mode 100644 boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp_ns.yml diff --git a/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp.yml b/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp.yml deleted file mode 100644 index 7a48d51ec33..00000000000 --- a/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp.yml +++ /dev/null @@ -1,55 +0,0 @@ -app: - address: 0x10200 - region: flash_primary - size: 0xdfe00 -mcuboot: - address: 0x0 - region: flash_primary - size: 0x10000 -mcuboot_pad: - address: 0x10000 - region: flash_primary - size: 0x200 -mcuboot_primary: - address: 0x10000 - orig_span: &id001 - - mcuboot_pad - - app - region: flash_primary - size: 0xe0000 - span: *id001 -mcuboot_primary_app: - address: 0x10200 - orig_span: &id002 - - app - region: flash_primary - size: 0xdfe00 - span: *id002 -settings_storage: - address: 0xf0000 - region: flash_primary - size: 0x10000 -mcuboot_primary_1: - address: 0x0 - size: 0x40000 - device: flash_ctrl - region: ram_flash -mcuboot_secondary: - address: 0x00000 - size: 0xe0000 - device: MX25R64 - region: external_flash -mcuboot_secondary_1: - address: 0xe0000 - size: 0x40000 - device: MX25R64 - region: external_flash -external_flash: - address: 0x120000 - size: 0x6e0000 - device: MX25R64 - region: external_flash -pcd_sram: - address: 0x20000000 - size: 0x2000 - region: sram_primary diff --git a/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp_ns.yml b/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp_ns.yml deleted file mode 100644 index 70ffe6d9c12..00000000000 --- a/boards/arm/thingy53_nrf5340/pm_static_thingy53_nrf5340_cpuapp_ns.yml +++ /dev/null @@ -1,73 +0,0 @@ -mcuboot: - address: 0x0 - region: flash_primary - size: 0x10000 -mcuboot_pad: - address: 0x10000 - region: flash_primary - size: 0x200 -tfm_secure: - address: 0x10000 - size: 0xc000 - span: [mcuboot_pad, tfm] -tfm_nonsecure: - address: 0x1c000 - size: 0xd4000 - span: [app] -tfm: - address: 0x10200 - region: flash_primary - size: 0xbe00 -app: - address: 0x1c000 - region: flash_primary - size: 0xd4000 -mcuboot_primary: - address: 0x10000 - orig_span: &id001 - - mcuboot_pad - - tfm - - app - region: flash_primary - size: 0xe0000 - span: *id001 -mcuboot_primary_app: - address: 0x10200 - orig_span: &id002 - - tfm - - app - region: flash_primary - size: 0xdfe00 - span: *id002 -nonsecure_storage: - address: 0xf0000 - size: 0x10000 - span: [settings_storage] -settings_storage: - address: 0xf0000 - region: flash_primary - size: 0x10000 -mcuboot_primary_1: - address: 0x0 - size: 0x40000 - device: flash_ctrl - region: ram_flash -mcuboot_secondary: - address: 0x00000 - size: 0xe0000 - device: MX25R64 - region: external_flash -mcuboot_secondary_1: - address: 0xe0000 - size: 0x40000 - device: MX25R64 - region: external_flash -external_flash: - address: 0x120000 - size: 0x6e0000 - device: MX25R64 - region: external_flash -pcd_sram: - address: 0x20000000 - size: 0x2000 - region: sram_primary From be1bdd9051ad2627231f5b20cd0016718a3a7656 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:39 +0200 Subject: [PATCH 1742/2300] Revert "[nrf noup] soc: arm: nRF91: Add SPU Flash/RAM alignment" This reverts commit 95a3bde0a6269dbe41e22fc97d6259070d170d2c. Signed-off-by: Gerard Marull-Paretas --- soc/arm/nordic_nrf/nrf91/Kconfig.series | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/soc/arm/nordic_nrf/nrf91/Kconfig.series b/soc/arm/nordic_nrf/nrf91/Kconfig.series index 08d36e5b48c..1be69c377e5 100644 --- a/soc/arm/nordic_nrf/nrf91/Kconfig.series +++ b/soc/arm/nordic_nrf/nrf91/Kconfig.series @@ -27,23 +27,9 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral -config NRF_SPU_FLASH_REGION_ALIGNMENT - hex - default 0x8000 - help - FLASH regions must be aligned to this value due to SPU HW - limitations. - config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 help RAM region size for the NRF_SPU peripheral - -config NRF_SPU_RAM_REGION_ALIGNMENT - hex - default 0x2000 - help - RAM regions must be aligned to this value due to SPU HW - limitations. endif From e7687c1a9f96a4e95932aa5e7caca743a37dae51 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:40 +0200 Subject: [PATCH 1743/2300] Revert "[nrf noup] soc: arm: nRF53: Add SPU Flash/RAM alignment" This reverts commit 58d05502b3e1bb25e70d64f7b255cf0a387699fa. Signed-off-by: Gerard Marull-Paretas --- soc/arm/nordic_nrf/nrf53/Kconfig.soc | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.soc b/soc/arm/nordic_nrf/nrf53/Kconfig.soc index b3ca2661675..3ecf09ecd92 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.soc @@ -124,26 +124,12 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral -config NRF_SPU_FLASH_REGION_ALIGNMENT - hex - default 0x4000 - help - FLASH regions must be aligned to this value due to SPU HW - limitations. - config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 help RAM region size for the NRF_SPU peripheral -config NRF_SPU_RAM_REGION_ALIGNMENT - hex - default 0x2000 - help - RAM regions must be aligned to this value due to SPU HW - limitations. - config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 bool depends on NRF_SOC_SECURE_SUPPORTED From 0e6eb70cf650c2d7adfbc5bd50baf85a6b761e1c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:40 +0200 Subject: [PATCH 1744/2300] Revert "[nrf noup] net: mqtt: add native TLS support" This reverts commit b09985d98a322c19c5e777bdb1c043897c733e30. Signed-off-by: Gerard Marull-Paretas --- doc/connectivity/networking/api/mqtt.rst | 3 --- include/zephyr/net/mqtt.h | 3 --- subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 7 +------ 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/doc/connectivity/networking/api/mqtt.rst b/doc/connectivity/networking/api/mqtt.rst index 79da5abe57b..b232f125333 100644 --- a/doc/connectivity/networking/api/mqtt.rst +++ b/doc/connectivity/networking/api/mqtt.rst @@ -150,7 +150,6 @@ additional configuration information: tls_config->sec_tag_list = m_sec_tags; tls_config->sec_tag_count = ARRAY_SIZE(m_sec_tags); tls_config->hostname = MQTT_BROKER_HOSTNAME; - tls_config->set_native_tls = true; In this sample code, the ``m_sec_tags`` array holds a list of tags, referencing TLS credentials that the MQTT library should use for authentication. We do not specify @@ -163,8 +162,6 @@ Note, that TLS credentials referenced by the ``m_sec_tags`` array must be registered in the system first. For more information on how to do that, refer to :ref:`secure sockets documentation `. -Finally, ``set_native_tls`` can be optionally set to enable native TLS support instead of offloading TLS operations to the modem. - An example of how to use TLS with MQTT is also present in :zephyr:code-sample:`mqtt-publisher` sample application. diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index 906cd8f6be6..83ec02a5999 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -366,9 +366,6 @@ struct mqtt_sec_config { /** Indicates the preference for copying certificates to the heap. */ int cert_nocopy; - - /** Set socket to native TLS */ - bool set_native_tls; }; /** @brief MQTT transport type. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 8e9cc87239a..363ff51afef 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -22,15 +22,10 @@ int mqtt_client_tls_connect(struct mqtt_client *client) { const struct sockaddr *broker = client->broker; struct mqtt_sec_config *tls_config = &client->transport.tls.config; - int type = SOCK_STREAM; int ret; - if (tls_config->set_native_tls) { - type |= SOCK_NATIVE_TLS; - } - client->transport.tls.sock = zsock_socket(broker->sa_family, - type, IPPROTO_TLS_1_2); + SOCK_STREAM, IPPROTO_TLS_1_2); if (client->transport.tls.sock < 0) { return -errno; } From 854bf1f2f9b4604f52e4449608a7a159f77db4c8 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:40 +0200 Subject: [PATCH 1745/2300] Revert "[nrf noup] net: mqtt: Provide option to enable TLS session caching" This reverts commit 188c2707060bfc6b054971b899c01c4408d5296a. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/net/mqtt.h | 3 --- subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 10 ---------- 2 files changed, 13 deletions(-) diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index 83ec02a5999..f1071af64f2 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -356,9 +356,6 @@ struct mqtt_sec_config { /** Indicates the list of security tags to be used for the session. */ const sec_tag_t *sec_tag_list; - /** Indicates the preference for enabling TLS session caching. */ - int session_cache; - /** Peer hostname for ceritificate verification. * May be NULL to skip hostname verification. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 363ff51afef..c835656b6cf 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -78,16 +78,6 @@ int mqtt_client_tls_connect(struct mqtt_client *client) } } - if (tls_config->session_cache == TLS_SESSION_CACHE_ENABLED) { - ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, - TLS_SESSION_CACHE, - &tls_config->session_cache, - sizeof(tls_config->session_cache)); - if (ret < 0) { - goto error; - } - } - if (tls_config->cert_nocopy != TLS_CERT_NOCOPY_NONE) { ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, TLS_CERT_NOCOPY, &tls_config->cert_nocopy, From 3c86da18e5cd1ff6122f448d52f37f81e5db8902 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:40 +0200 Subject: [PATCH 1746/2300] Revert "[nrf noup] test: schedule_api: Use Minimal C library" This reverts commit 2f2142f031254c1c1abc858be2b55afed1ca8b8f. Signed-off-by: Gerard Marull-Paretas --- tests/kernel/sched/schedule_api/prj.conf | 1 - tests/kernel/sched/schedule_api/prj_dumb.conf | 1 - tests/kernel/sched/schedule_api/prj_multiq.conf | 1 - 3 files changed, 3 deletions(-) diff --git a/tests/kernel/sched/schedule_api/prj.conf b/tests/kernel/sched/schedule_api/prj.conf index 785e9a3987b..fe5125047e3 100644 --- a/tests/kernel/sched/schedule_api/prj.conf +++ b/tests/kernel/sched/schedule_api/prj.conf @@ -7,4 +7,3 @@ CONFIG_MAX_THREAD_BYTES=5 CONFIG_TEST_USERSPACE=y CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y -CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj_dumb.conf b/tests/kernel/sched/schedule_api/prj_dumb.conf index a1d0cf6dced..c0ddfbd7c3f 100644 --- a/tests/kernel/sched/schedule_api/prj_dumb.conf +++ b/tests/kernel/sched/schedule_api/prj_dumb.conf @@ -5,4 +5,3 @@ CONFIG_SCHED_DUMB=y CONFIG_MAX_THREAD_BYTES=5 CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y -CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj_multiq.conf b/tests/kernel/sched/schedule_api/prj_multiq.conf index 77b3a49fd34..18d04dd8656 100644 --- a/tests/kernel/sched/schedule_api/prj_multiq.conf +++ b/tests/kernel/sched/schedule_api/prj_multiq.conf @@ -5,4 +5,3 @@ CONFIG_SCHED_MULTIQ=y CONFIG_MAX_THREAD_BYTES=5 CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y -CONFIG_MINIMAL_LIBC=y From 24b3646c76ab717ab01cc269c69090e18f8d9861 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:40 +0200 Subject: [PATCH 1747/2300] Revert "[nrf noup] ci: NCS-specific CI tweaks" This reverts commit 4cf7a19e8939c0f44293e431a11139d41e115328. Signed-off-by: Gerard Marull-Paretas --- .github/workflows/commit-tags.yml | 31 -------------------------- .github/workflows/compliance.yml | 8 +++---- Jenkinsfile | 5 ----- scripts/gitlint/zephyr_commit_rules.py | 4 ++-- 4 files changed, 6 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/commit-tags.yml delete mode 100644 Jenkinsfile diff --git a/.github/workflows/commit-tags.yml b/.github/workflows/commit-tags.yml deleted file mode 100644 index 9e0323f9498..00000000000 --- a/.github/workflows/commit-tags.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Commit tags - -on: pull_request - -jobs: - commit_tags: - runs-on: ubuntu-22.04 - name: Run commit tags checks on patch series (PR) - steps: - - name: Update PATH for west - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Checkout the code - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Install python dependencies - run: | - pip3 install setuptools - pip3 install wheel - pip3 install gitlint - - - name: Run the commit tags - uses: nrfconnect/action-commit-tags@main - with: - target: '.' - baserev: origin/${{ github.base_ref }} - revrange: 'none' diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index 5dc913626cd..219fbfae607 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -38,8 +38,8 @@ jobs: git config --global user.name "Your Name" git remote -v # Ensure there's no merge commits in the PR - #[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ - #(echo "::error ::Merge commits not allowed, rebase instead";false) + [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ + (echo "::error ::Merge commits not allowed, rebase instead";false) git rebase origin/${BASE_REF} # debug git log --pretty=oneline | head -n 10 @@ -57,8 +57,8 @@ jobs: # debug ls -la git log --pretty=oneline | head -n 10 - ./scripts/ci/check_compliance.py --annotate -e KconfigBasic -e Kconfig \ - -e KconfigBasicNoModules -e ModulesMaintainers -c origin/${BASE_REF}.. + ./scripts/ci/check_compliance.py --annotate -e KconfigBasic \ + -c origin/${BASE_REF}.. - name: upload-results uses: actions/upload-artifact@v4 diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 3b9cf002239..00000000000 --- a/Jenkinsfile +++ /dev/null @@ -1,5 +0,0 @@ -@Library("CI_LIB") _ - -def pipeline = new ncs.sdk_zephyr.Main() - -pipeline.run(JOB_NAME) diff --git a/scripts/gitlint/zephyr_commit_rules.py b/scripts/gitlint/zephyr_commit_rules.py index d39c7997e26..ea31c6737f3 100644 --- a/scripts/gitlint/zephyr_commit_rules.py +++ b/scripts/gitlint/zephyr_commit_rules.py @@ -78,7 +78,7 @@ class TitleMaxLengthRevert(LineRule): name = "title-max-length-no-revert" id = "UC5" target = CommitMessageTitle - options_spec = [IntOption('line-length', 120, "Max line length")] + options_spec = [IntOption('line-length', 75, "Max line length")] violation_message = "Commit title exceeds max length ({0}>{1})" def validate(self, line, _commit): @@ -103,7 +103,7 @@ class MaxLineLengthExceptions(LineRule): name = "max-line-length-with-exceptions" id = "UC4" target = CommitMessageBody - options_spec = [IntOption('line-length', 120, "Max line length")] + options_spec = [IntOption('line-length', 75, "Max line length")] violation_message = "Commit message body line exceeds max length ({0}>{1})" def validate(self, line, _commit): From 82b067c7d3348428400e0b936690969efc22e2c2 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:41 +0200 Subject: [PATCH 1748/2300] Revert "[nrf fromlist] Bluetooth: ATT: lock scheduler when sending from user thread" This reverts commit e71b56e87ba8b50962709a68593076a771bfe50e. Signed-off-by: Gerard Marull-Paretas --- subsys/bluetooth/host/att.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 2ed3dfcb768..35be784c209 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -3863,19 +3863,14 @@ int bt_att_req_send(struct bt_conn *conn, struct bt_att_req *req) __ASSERT_NO_MSG(conn); __ASSERT_NO_MSG(req); - k_sched_lock(); - att = att_get(conn); if (!att) { - k_sched_unlock(); return -ENOTCONN; } sys_slist_append(&att->reqs, &req->node); att_req_send_process(att); - k_sched_unlock(); - return 0; } From d47fda791940b9a980f670b467f23aff6a54261a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:41 +0200 Subject: [PATCH 1749/2300] Revert "[nrf fromlist] net: sockets: packet: Ignore the packet type if LL address is not set" This reverts commit 04aecc5917ed08d4e9d4b7705f5aa99d7c4e4c0f. Signed-off-by: Gerard Marull-Paretas --- subsys/net/lib/sockets/sockets_packet.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/subsys/net/lib/sockets/sockets_packet.c b/subsys/net/lib/sockets/sockets_packet.c index ce4f83190c4..bcf063abe29 100644 --- a/subsys/net/lib/sockets/sockets_packet.c +++ b/subsys/net/lib/sockets/sockets_packet.c @@ -144,10 +144,6 @@ static void zpacket_set_eth_pkttype(struct net_if *iface, struct sockaddr_ll *addr, struct net_linkaddr *lladdr) { - if (lladdr == NULL || lladdr->addr == NULL) { - return; - } - if (net_eth_is_addr_broadcast((struct net_eth_addr *)lladdr->addr)) { addr->sll_pkttype = PACKET_BROADCAST; } else if (net_eth_is_addr_multicast( From 68db38b516fbed2dc6be13c8628de7c45ff8d65e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:41 +0200 Subject: [PATCH 1750/2300] Revert "[nrf fromtree] manifest: remove .git suffixes from repo-paths" This reverts commit 9982b0f82554206e4c5ecd79919aea8b212447bf. Signed-off-by: Gerard Marull-Paretas --- west.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/west.yml b/west.yml index 4d04f7fecaf..da5a202241b 100644 --- a/west.yml +++ b/west.yml @@ -40,77 +40,77 @@ manifest: - babblesim - name: babblesim_base remote: babblesim - repo-path: base + repo-path: base.git path: tools/bsim/components revision: 19d62424c0802c6c9fc15528febe666e40f372a1 groups: - babblesim - name: babblesim_ext_2G4_libPhyComv1 remote: babblesim - repo-path: ext_2G4_libPhyComv1 + repo-path: ext_2G4_libPhyComv1.git path: tools/bsim/components/ext_2G4_libPhyComv1 revision: 9018113a362fa6c9e8f4b9cab9e5a8f12cc46b94 groups: - babblesim - name: babblesim_ext_2G4_phy_v1 remote: babblesim - repo-path: ext_2G4_phy_v1 + repo-path: ext_2G4_phy_v1.git path: tools/bsim/components/ext_2G4_phy_v1 revision: d47c6dd90035b41b14f6921785ccb7b8484868e2 groups: - babblesim - name: babblesim_ext_2G4_channel_NtNcable remote: babblesim - repo-path: ext_2G4_channel_NtNcable + repo-path: ext_2G4_channel_NtNcable.git path: tools/bsim/components/ext_2G4_channel_NtNcable revision: 20a38c997f507b0aa53817aab3d73a462fff7af1 groups: - babblesim - name: babblesim_ext_2G4_channel_multiatt remote: babblesim - repo-path: ext_2G4_channel_multiatt + repo-path: ext_2G4_channel_multiatt.git path: tools/bsim/components/ext_2G4_channel_multiatt revision: bde72a57384dde7a4310bcf3843469401be93074 groups: - babblesim - name: babblesim_ext_2G4_modem_magic remote: babblesim - repo-path: ext_2G4_modem_magic + repo-path: ext_2G4_modem_magic.git path: tools/bsim/components/ext_2G4_modem_magic revision: cb70771794f0bf6f262aa474848611c68ae8f1ed groups: - babblesim - name: babblesim_ext_2G4_modem_BLE_simple remote: babblesim - repo-path: ext_2G4_modem_BLE_simple + repo-path: ext_2G4_modem_BLE_simple.git path: tools/bsim/components/ext_2G4_modem_BLE_simple revision: 809ab073159c9ab6686c2fea5749b0702e0909f7 groups: - babblesim - name: babblesim_ext_2G4_device_burst_interferer remote: babblesim - repo-path: ext_2G4_device_burst_interferer + repo-path: ext_2G4_device_burst_interferer.git path: tools/bsim/components/ext_2G4_device_burst_interferer revision: 5b5339351d6e6a2368c686c734dc8b2fc65698fc groups: - babblesim - name: babblesim_ext_2G4_device_WLAN_actmod remote: babblesim - repo-path: ext_2G4_device_WLAN_actmod + repo-path: ext_2G4_device_WLAN_actmod.git path: tools/bsim/components/ext_2G4_device_WLAN_actmod revision: 9cb6d8e72695f6b785e57443f0629a18069d6ce4 groups: - babblesim - name: babblesim_ext_2G4_device_playback remote: babblesim - repo-path: ext_2G4_device_playback + repo-path: ext_2G4_device_playback.git path: tools/bsim/components/ext_2G4_device_playback revision: 85c645929cf1ce995d8537107d9dcbd12ed64036 groups: - babblesim - name: babblesim_ext_libCryptov1 remote: babblesim - repo-path: ext_libCryptov1 + repo-path: ext_libCryptov1.git path: tools/bsim/components/ext_libCryptov1 revision: eed6d7038e839153e340bd333bc43541cb90ba64 groups: From e2e355586afe3fc583124e73d0f830aa7a9e1c60 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:41 +0200 Subject: [PATCH 1751/2300] Revert "[nrf fromlist] kconfig: shell: fix incorrect shell stack size for Thread" This reverts commit 724394e5c95d1424daead22e5550d06c26c92fcb. Signed-off-by: Gerard Marull-Paretas --- subsys/shell/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/shell/Kconfig b/subsys/shell/Kconfig index 618570af1e2..45e469ac457 100644 --- a/subsys/shell/Kconfig +++ b/subsys/shell/Kconfig @@ -40,8 +40,9 @@ endif config SHELL_STACK_SIZE int "Shell thread stack size" - default 3168 if OPENTHREAD_SHELL + default 3168 if OPENTHREAD_SHELL && OPENTHREAD_JOINER default 3072 if 64BIT + default 2616 if OPENTHREAD_SHELL default 2048 if MULTITHREADING default 0 if !MULTITHREADING help From c731bf15f8fb351cc3e4f7464cbf396ad783a16b Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:41 +0200 Subject: [PATCH 1752/2300] Revert "[nrf fromlist] modules: hal_nordic: remove weak nrf_802154_clock_hfclk_ready" This reverts commit 7e15ea29496a13608de49588efa0a2bdd7511900. Signed-off-by: Gerard Marull-Paretas --- .../sl_opensource/platform/nrf_802154_clock_zephyr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index 3a3d9501d0c..c9260bf278a 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -109,6 +109,11 @@ bool nrf_802154_clock_lfclk_is_running(void) return lfclk_is_running; } +__WEAK void nrf_802154_clock_hfclk_ready(void) +{ + /* Intentionally empty. */ +} + __WEAK void nrf_802154_clock_lfclk_ready(void) { /* Intentionally empty. */ From bfd3104d68004c77a94ef3c62b5f7c5a14d2f0aa Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:42 +0200 Subject: [PATCH 1753/2300] Revert "[nrf fromlist] drivers: mbox: nrf_bellboard: add initial driver" This reverts commit cc15acc1654fb0687e6cf107b8cb692d03405fbf. Signed-off-by: Gerard Marull-Paretas --- drivers/mbox/CMakeLists.txt | 2 - drivers/mbox/Kconfig | 1 - drivers/mbox/Kconfig.nrf_bellboard | 16 --- drivers/mbox/mbox_nrf_bellboard_local.c | 169 ----------------------- drivers/mbox/mbox_nrf_bellboard_remote.c | 62 --------- 5 files changed, 250 deletions(-) delete mode 100644 drivers/mbox/Kconfig.nrf_bellboard delete mode 100644 drivers/mbox/mbox_nrf_bellboard_local.c delete mode 100644 drivers/mbox/mbox_nrf_bellboard_remote.c diff --git a/drivers/mbox/CMakeLists.txt b/drivers/mbox/CMakeLists.txt index 1d5c65cded7..b8e28afe6b4 100644 --- a/drivers/mbox/CMakeLists.txt +++ b/drivers/mbox/CMakeLists.txt @@ -12,5 +12,3 @@ zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_MAILBOX mbox_nxp_mailbox.c) zephyr_library_sources_ifdef(CONFIG_MBOX_ANDES_PLIC_SW mbox_andes_plic_sw.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_LOCAL mbox_nrf_vevif_local.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_REMOTE mbox_nrf_vevif_remote.c) -zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_LOCAL mbox_nrf_bellboard_local.c) -zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_REMOTE mbox_nrf_bellboard_remote.c) diff --git a/drivers/mbox/Kconfig b/drivers/mbox/Kconfig index 7f00324ba47..c6fe36832c9 100644 --- a/drivers/mbox/Kconfig +++ b/drivers/mbox/Kconfig @@ -18,7 +18,6 @@ source "drivers/mbox/Kconfig.nxp_imx" source "drivers/mbox/Kconfig.nxp_mailbox" source "drivers/mbox/Kconfig.andes" source "drivers/mbox/Kconfig.nrf_vevif" -source "drivers/mbox/Kconfig.nrf_bellboard" config MBOX_INIT_PRIORITY int "MBOX init priority" diff --git a/drivers/mbox/Kconfig.nrf_bellboard b/drivers/mbox/Kconfig.nrf_bellboard deleted file mode 100644 index 45233122bd5..00000000000 --- a/drivers/mbox/Kconfig.nrf_bellboard +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config MBOX_NRF_BELLBOARD_LOCAL - bool "nRF BELLBOARD local driver" - depends on DT_HAS_NORDIC_NRF_BELLBOARD_LOCAL_ENABLED - default y - help - Mailbox driver for local Nordic nRF BELLBOARD - -config MBOX_NRF_BELLBOARD_REMOTE - bool "nRF BELLBOARD remote driver" - depends on DT_HAS_NORDIC_NRF_BELLBOARD_REMOTE_ENABLED - default y - help - Mailbox driver for remote Nordic nRF BELLBOARD diff --git a/drivers/mbox/mbox_nrf_bellboard_local.c b/drivers/mbox/mbox_nrf_bellboard_local.c deleted file mode 100644 index 99d05351aaa..00000000000 --- a/drivers/mbox/mbox_nrf_bellboard_local.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT nordic_nrf_bellboard_local - -#include -#include -#include - -#include - -#define BELLBOARD_NUM_IRQS 4U - -BUILD_ASSERT(DT_NUM_IRQS(DT_DRV_INST(0)) <= BELLBOARD_NUM_IRQS, "# interrupt exceeds maximum"); - -BUILD_ASSERT((DT_INST_PROP_LEN(0, nordic_interrupt_mapping) % 2) == 0, - "# interrupt mappings not specified in pairs"); - -/* BELLBOARD event mappings */ -#define EVT_MAPPING_ITEM(idx) DT_INST_PROP_BY_IDX(0, nordic_interrupt_mapping, idx) -#define BELLBOARD_GET_EVT_MAPPING(idx, _) \ - COND_CODE_1( \ - DT_INST_PROP_HAS_IDX(0, nordic_interrupt_mapping, UTIL_INC(UTIL_X2(idx))), \ - ([EVT_MAPPING_ITEM(UTIL_INC(UTIL_X2(idx)))] = EVT_MAPPING_ITEM(UTIL_X2(idx)),), \ - ()) - -static const uint32_t evt_mappings[BELLBOARD_NUM_IRQS] = { - LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), BELLBOARD_GET_EVT_MAPPING, ())}; - -/* BELLBOARD instance */ -static NRF_BELLBOARD_Type *bellboard = (NRF_BELLBOARD_Type *)DT_INST_REG_ADDR(0); - -/* BELLBOARD runtime resources */ -static mbox_callback_t cbs[NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT]; -static void *cbs_ctx[NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT]; -static uint32_t evt_enabled_masks[BELLBOARD_NUM_IRQS]; - -static void bellboard_local_isr(const void *parameter) -{ - uint8_t irq_idx = (uint8_t)(uintptr_t)parameter; - uint32_t int_pend; - - int_pend = nrf_bellboard_int_pending_get(bellboard, irq_idx); - - for (uint8_t i = 0U; i < NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT; i++) { - nrf_bellboard_event_t event = nrf_bellboard_triggered_event_get(i); - - if (nrf_bellboard_event_check(bellboard, event)) { - nrf_bellboard_event_clear(bellboard, event); - } - - if ((int_pend & BIT(i)) != 0U) { - if (cbs[i] != NULL) { - cbs[i](DEVICE_DT_INST_GET(0), i, cbs_ctx[i], NULL); - } - } - } -} - -static uint32_t bellboard_local_max_channels_get(const struct device *dev) -{ - ARG_UNUSED(dev); - - return NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT; -} - -static int bellboard_local_register_callback(const struct device *dev, uint32_t id, - mbox_callback_t cb, void *user_data) -{ - ARG_UNUSED(dev); - - if (id >= NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT) { - return -EINVAL; - } - - cbs[id] = cb; - cbs_ctx[id] = user_data; - - return 0; -} - -static int bellboard_local_set_enabled(const struct device *dev, uint32_t id, bool enable) -{ - bool valid_found = false; - - ARG_UNUSED(dev); - - if (id >= NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT) { - return -EINVAL; - } - - for (uint8_t i = 0U; i < BELLBOARD_NUM_IRQS; i++) { - uint32_t *evt_enabled_mask; - - if ((evt_mappings[i] == 0U) || ((evt_mappings[i] & BIT(id)) == 0U)) { - continue; - } - - valid_found = true; - evt_enabled_mask = &evt_enabled_masks[i]; - - if (enable) { - if ((*evt_enabled_mask & BIT(id)) != 0U) { - return -EALREADY; - } - - *evt_enabled_mask |= BIT(id); - nrf_bellboard_int_enable(bellboard, i, BIT(id)); - } else { - if ((*evt_enabled_mask & BIT(id)) == 0U) { - return -EALREADY; - } - - *evt_enabled_mask &= ~BIT(id); - nrf_bellboard_int_disable(bellboard, i, BIT(id)); - } - } - - if (!valid_found) { - return -EINVAL; - } - - return 0; -} - -static const struct mbox_driver_api bellboard_local_driver_api = { - .max_channels_get = bellboard_local_max_channels_get, - .register_callback = bellboard_local_register_callback, - .set_enabled = bellboard_local_set_enabled, -}; - -#define BELLBOARD_IRQ_CONFIGURE(name, idx) \ - COND_CODE_1(DT_INST_IRQ_HAS_NAME(0, name), \ - (IRQ_CONNECT(DT_INST_IRQ_BY_NAME(0, name, irq), \ - DT_INST_IRQ_BY_NAME(0, name, priority), bellboard_local_isr, \ - (const void *)idx, 0); \ - irq_enable(DT_INST_IRQ_BY_NAME(0, name, irq));), \ - ()) - -static int bellboard_local_init(const struct device *dev) -{ - uint32_t evt_all_mappings = - evt_mappings[0] | evt_mappings[1] | evt_mappings[2] | evt_mappings[3]; - - ARG_UNUSED(dev); - - nrf_bellboard_int_disable(bellboard, 0, evt_mappings[0]); - nrf_bellboard_int_disable(bellboard, 1, evt_mappings[1]); - nrf_bellboard_int_disable(bellboard, 2, evt_mappings[2]); - nrf_bellboard_int_disable(bellboard, 3, evt_mappings[3]); - - for (uint8_t i = 0U; i < NRF_BELLBOARD_EVENTS_TRIGGERED_COUNT; i++) { - if ((evt_all_mappings & BIT(i)) != 0U) { - nrf_bellboard_event_clear(bellboard, nrf_bellboard_triggered_event_get(i)); - } - } - - BELLBOARD_IRQ_CONFIGURE(irq0, 0); - BELLBOARD_IRQ_CONFIGURE(irq1, 1); - BELLBOARD_IRQ_CONFIGURE(irq2, 2); - BELLBOARD_IRQ_CONFIGURE(irq3, 3); - - return 0; -} - -DEVICE_DT_INST_DEFINE(0, bellboard_local_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_MBOX_INIT_PRIORITY, &bellboard_local_driver_api); diff --git a/drivers/mbox/mbox_nrf_bellboard_remote.c b/drivers/mbox/mbox_nrf_bellboard_remote.c deleted file mode 100644 index c362522c0bf..00000000000 --- a/drivers/mbox/mbox_nrf_bellboard_remote.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT nordic_nrf_bellboard_remote - -#include -#include - -#include - -struct mbox_bellboard_remote_conf { - NRF_BELLBOARD_Type *bellboard; -}; - -static int bellboard_remote_send(const struct device *dev, uint32_t id, const struct mbox_msg *msg) -{ - const struct mbox_bellboard_remote_conf *config = dev->config; - - if (id >= BELLBOARD_TASKS_TRIGGER_MaxCount) { - return -EINVAL; - } - - if (msg != NULL) { - return -ENOTSUP; - } - - nrfy_bellboard_task_trigger(config->bellboard, nrf_bellboard_trigger_task_get(id)); - - return 0; -} - -static int bellboard_remote_mtu_get(const struct device *dev) -{ - ARG_UNUSED(dev); - - return 0; -} - -static uint32_t bellboard_remote_max_channels_get(const struct device *dev) -{ - ARG_UNUSED(dev); - - return BELLBOARD_TASKS_TRIGGER_MaxCount; -} - -static const struct mbox_driver_api bellboard_remote_driver_api = { - .send = bellboard_remote_send, - .mtu_get = bellboard_remote_mtu_get, - .max_channels_get = bellboard_remote_max_channels_get, -}; - -#define BELLBOARD_REMOTE_DEFINE(inst) \ - static const struct mbox_bellboard_remote_conf conf##inst = { \ - .bellboard = (NRF_BELLBOARD_Type *)DT_INST_REG_ADDR(inst), \ - }; \ - \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ - CONFIG_MBOX_INIT_PRIORITY, &bellboard_remote_driver_api); - -DT_INST_FOREACH_STATUS_OKAY(BELLBOARD_REMOTE_DEFINE) From 421daa43f4132e5fa6a17727a6441e079d7e5d41 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:42 +0200 Subject: [PATCH 1754/2300] Revert "[nrf fromlist] dts: bindings: mbox: add nordic,nrf-bellboard-local|remote" This reverts commit 76156d457aab3145e9366602955cac2608d37667. Signed-off-by: Gerard Marull-Paretas --- .../mbox/nordic,nrf-bellboard-common.yaml | 11 ----- .../mbox/nordic,nrf-bellboard-local.yaml | 43 ------------------- .../mbox/nordic,nrf-bellboard-remote.yaml | 22 ---------- 3 files changed, 76 deletions(-) delete mode 100644 dts/bindings/mbox/nordic,nrf-bellboard-common.yaml delete mode 100644 dts/bindings/mbox/nordic,nrf-bellboard-local.yaml delete mode 100644 dts/bindings/mbox/nordic,nrf-bellboard-remote.yaml diff --git a/dts/bindings/mbox/nordic,nrf-bellboard-common.yaml b/dts/bindings/mbox/nordic,nrf-bellboard-common.yaml deleted file mode 100644 index 0d1d0bc26e2..00000000000 --- a/dts/bindings/mbox/nordic,nrf-bellboard-common.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -include: [base.yaml, "mailbox-controller.yaml"] - -properties: - reg: - required: true - -mbox-cells: - - channel diff --git a/dts/bindings/mbox/nordic,nrf-bellboard-local.yaml b/dts/bindings/mbox/nordic,nrf-bellboard-local.yaml deleted file mode 100644 index 5c1709987cc..00000000000 --- a/dts/bindings/mbox/nordic,nrf-bellboard-local.yaml +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic BELLBOARD - - BELLBOARD provides support for inter-domain software signaling. It implements - a set of tasks and events intended for signaling within an interprocessor - communication (IPC) framework. When used in local mode, the BELLBOARD - instance is used to receive events triggered by other remote cores. - - Example definition: - - bellboard: mailbox@deadbeef { - compatible = "nordic,nrf-bellboard-local"; - reg = <0xdeadbeef 0x1000>; - interrupts = <98 NRF_DEFAULT_IRQ_PRIORITY>, - <99 NRF_DEFAULT_IRQ_PRIORITY>; - interrupt-names = "irq2", "irq3"; - nordic,interrupt-mapping = <0x0000000f 2>, <0x000000f0 3>; - #mbox-cells = <1>; - }; - -compatible: "nordic,nrf-bellboard-local" - -include: "nordic,nrf-bellboard-common.yaml" - -properties: - interrupts: - required: true - - interrupt-names: - required: true - - nordic,interrupt-mapping: - type: array - required: true - description: | - Set of interrupt mapping pairs. Each pair consists of a bitmask and an - interrupt identifier. The bitmask is used to indicate which of the 32 - possible events are mapped to the given interrupt. For example, given - <0x0000000f 2>, the first four events are mapped to interrupt 2 - (irq2). diff --git a/dts/bindings/mbox/nordic,nrf-bellboard-remote.yaml b/dts/bindings/mbox/nordic,nrf-bellboard-remote.yaml deleted file mode 100644 index ae17fc916a1..00000000000 --- a/dts/bindings/mbox/nordic,nrf-bellboard-remote.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic BELLBOARD - - BELLBOARD provides support for inter-domain software signaling. It implements - a set of tasks and events intended for signaling within an interprocessor - communication (IPC) framework. When used in remote mode, the BELLBOARD - instance is used to trigger events to another core. - - Example definition: - - bellboard: mailbox@deadbeef { - compatible = "nordic,nrf-bellboard-remote"; - reg = <0xdeadbeef 0x1000>; - #mbox-cells = <1>; - }; - -compatible: "nordic,nrf-bellboard-remote" - -include: "nordic,nrf-bellboard-common.yaml" From 1005793256bf4580b3befbf6ad0e5772ffb549d9 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:42 +0200 Subject: [PATCH 1755/2300] Revert "[nrf fromlist] drivers: mbox: add initial driver for nRF VEVIF" This reverts commit 630a73a6c641eb2f3152aba23920862439fa4096. Signed-off-by: Gerard Marull-Paretas --- drivers/mbox/CMakeLists.txt | 2 - drivers/mbox/Kconfig | 1 - drivers/mbox/Kconfig.nrf_vevif | 16 ---- drivers/mbox/mbox_nrf_vevif_local.c | 123 --------------------------- drivers/mbox/mbox_nrf_vevif_remote.c | 76 ----------------- 5 files changed, 218 deletions(-) delete mode 100644 drivers/mbox/Kconfig.nrf_vevif delete mode 100644 drivers/mbox/mbox_nrf_vevif_local.c delete mode 100644 drivers/mbox/mbox_nrf_vevif_remote.c diff --git a/drivers/mbox/CMakeLists.txt b/drivers/mbox/CMakeLists.txt index b8e28afe6b4..89e5d58e65c 100644 --- a/drivers/mbox/CMakeLists.txt +++ b/drivers/mbox/CMakeLists.txt @@ -10,5 +10,3 @@ zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_S32_MRU mbox_nxp_s32_mru.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_IMX_MU mbox_nxp_imx_mu.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NXP_MAILBOX mbox_nxp_mailbox.c) zephyr_library_sources_ifdef(CONFIG_MBOX_ANDES_PLIC_SW mbox_andes_plic_sw.c) -zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_LOCAL mbox_nrf_vevif_local.c) -zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_REMOTE mbox_nrf_vevif_remote.c) diff --git a/drivers/mbox/Kconfig b/drivers/mbox/Kconfig index c6fe36832c9..67041e91f59 100644 --- a/drivers/mbox/Kconfig +++ b/drivers/mbox/Kconfig @@ -17,7 +17,6 @@ source "drivers/mbox/Kconfig.nxp_s32" source "drivers/mbox/Kconfig.nxp_imx" source "drivers/mbox/Kconfig.nxp_mailbox" source "drivers/mbox/Kconfig.andes" -source "drivers/mbox/Kconfig.nrf_vevif" config MBOX_INIT_PRIORITY int "MBOX init priority" diff --git a/drivers/mbox/Kconfig.nrf_vevif b/drivers/mbox/Kconfig.nrf_vevif deleted file mode 100644 index 4abb0ef8241..00000000000 --- a/drivers/mbox/Kconfig.nrf_vevif +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config MBOX_NRF_VEVIF_LOCAL - bool "nRF VEVIF local driver" - depends on DT_HAS_NORDIC_NRF_VEVIF_LOCAL_ENABLED - default y - help - Mailbox driver for local Nordic nRF VEVIF (VPR Event Interface) - -config MBOX_NRF_VEVIF_REMOTE - bool "nRF VEVIF remote driver" - depends on DT_HAS_NORDIC_NRF_VEVIF_REMOTE_ENABLED - default y - help - Mailbox driver for remote Nordic nRF VEVIF (VPR Event Interface) diff --git a/drivers/mbox/mbox_nrf_vevif_local.c b/drivers/mbox/mbox_nrf_vevif_local.c deleted file mode 100644 index 31b89e1e6fb..00000000000 --- a/drivers/mbox/mbox_nrf_vevif_local.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT nordic_nrf_vevif_local - -#include -#include - -#include -#include -#include - -#define VEVIF_TASKS_NUM DT_INST_PROP(0, nordic_tasks) -#define VEVIF_TASKS_MASK DT_INST_PROP(0, nordic_tasks_mask) - -BUILD_ASSERT(VEVIF_TASKS_NUM <= VPR_TASKS_TRIGGER_MaxCount, "Number of tasks exceeds maximum"); -BUILD_ASSERT(VEVIF_TASKS_NUM == DT_NUM_IRQS(DT_DRV_INST(0)), "# IRQs != # tasks"); - -/* callbacks */ -struct mbox_vevif_local_cbs { - mbox_callback_t cb[VEVIF_TASKS_NUM]; - void *user_data[VEVIF_TASKS_NUM]; - uint32_t enabled_mask; -}; - -static struct mbox_vevif_local_cbs cbs; - -/* IRQ list */ -#define VEVIF_IRQN(idx, _) DT_INST_IRQ_BY_IDX(0, idx, irq) - -static const uint8_t vevif_irqs[VEVIF_TASKS_NUM] = { - LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), VEVIF_IRQN, (,)) -}; - -static void vevif_local_isr(const void *parameter) -{ - uint8_t id = *(uint8_t *)parameter; - - nrf_vpr_csr_vevif_tasks_clear(BIT(id)); - - if (cbs.cb[id] != NULL) { - cbs.cb[id](DEVICE_DT_INST_GET(0), id, cbs.user_data[id], NULL); - } -} - -static inline bool vevif_local_is_task_valid(uint32_t id) -{ - return (id < VEVIF_TASKS_NUM) && ((VEVIF_TASKS_MASK & BIT(id)) != 0U); -} - -static uint32_t vevif_local_max_channels_get(const struct device *dev) -{ - ARG_UNUSED(dev); - - return VEVIF_TASKS_NUM; -} - -static int vevif_local_register_callback(const struct device *dev, uint32_t id, mbox_callback_t cb, - void *user_data) -{ - ARG_UNUSED(dev); - - if (!vevif_local_is_task_valid(id)) { - return -EINVAL; - } - - cbs.cb[id] = cb; - cbs.user_data[id] = user_data; - - return 0; -} - -static int vevif_local_set_enabled(const struct device *dev, uint32_t id, bool enable) -{ - ARG_UNUSED(dev); - - if (!vevif_local_is_task_valid(id)) { - return -EINVAL; - } - - if (enable) { - if ((cbs.enabled_mask & BIT(id)) != 0U) { - return -EALREADY; - } - - cbs.enabled_mask |= BIT(id); - irq_enable(vevif_irqs[id]); - } else { - if ((cbs.enabled_mask & BIT(id)) == 0U) { - return -EALREADY; - } - - cbs.enabled_mask &= ~BIT(id); - irq_disable(vevif_irqs[id]); - } - - return 0; -} - -static const struct mbox_driver_api vevif_local_driver_api = { - .max_channels_get = vevif_local_max_channels_get, - .register_callback = vevif_local_register_callback, - .set_enabled = vevif_local_set_enabled, -}; - -#define VEVIF_IRQ_CONNECT(idx, _) \ - IRQ_CONNECT(DT_INST_IRQ_BY_IDX(0, idx, irq), DT_INST_IRQ_BY_IDX(0, idx, priority), \ - vevif_local_isr, &vevif_irqs[idx], 0) - -static int vevif_local_init(const struct device *dev) -{ - nrf_vpr_csr_rtperiph_enable_set(true); - nrf_vpr_csr_vevif_tasks_clear(NRF_VPR_TASK_TRIGGER_ALL_MASK); - - LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), VEVIF_IRQ_CONNECT, (;)); - - return 0; -} - -DEVICE_DT_INST_DEFINE(0, vevif_local_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_MBOX_INIT_PRIORITY, - &vevif_local_driver_api); diff --git a/drivers/mbox/mbox_nrf_vevif_remote.c b/drivers/mbox/mbox_nrf_vevif_remote.c deleted file mode 100644 index cb5d7c507c5..00000000000 --- a/drivers/mbox/mbox_nrf_vevif_remote.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT nordic_nrf_vevif_remote - -#include -#include - -#include - -struct mbox_vevif_remote_conf { - NRF_VPR_Type *vpr; - uint32_t tasks_mask; - uint8_t tasks; -}; - -static inline bool vevif_remote_is_task_valid(const struct device *dev, uint32_t id) -{ - const struct mbox_vevif_remote_conf *config = dev->config; - - return (id < config->tasks) && ((config->tasks_mask & BIT(id)) != 0U); -} - -static int vevif_remote_send(const struct device *dev, uint32_t id, const struct mbox_msg *msg) -{ - const struct mbox_vevif_remote_conf *config = dev->config; - - if (!vevif_remote_is_task_valid(dev, id)) { - return -EINVAL; - } - - if (msg != NULL) { - return -ENOTSUP; - } - - nrfy_vpr_task_trigger(config->vpr, nrfy_vpr_trigger_task_get(id)); - - return 0; -} - -static int vevif_remote_mtu_get(const struct device *dev) -{ - ARG_UNUSED(dev); - - return 0; -} - -static uint32_t vevif_remote_max_channels_get(const struct device *dev) -{ - const struct mbox_vevif_remote_conf *config = dev->config; - - return config->tasks; -} - -static const struct mbox_driver_api vevif_remote_driver_api = { - .send = vevif_remote_send, - .mtu_get = vevif_remote_mtu_get, - .max_channels_get = vevif_remote_max_channels_get, -}; - -#define VEVIF_REMOTE_DEFINE(inst) \ - BUILD_ASSERT(DT_INST_PROP(inst, nordic_tasks) <= VPR_TASKS_TRIGGER_MaxCount, \ - "Number of tasks exceeds maximum"); \ - \ - static const struct mbox_vevif_remote_conf conf##inst = { \ - .vpr = (NRF_VPR_Type *)DT_INST_REG_ADDR(inst), \ - .tasks = DT_INST_PROP(inst, nordic_tasks), \ - .tasks_mask = DT_INST_PROP(inst, nordic_tasks_mask), \ - }; \ - \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ - CONFIG_MBOX_INIT_PRIORITY, &vevif_remote_driver_api); - -DT_INST_FOREACH_STATUS_OKAY(VEVIF_REMOTE_DEFINE) From efe0ac52f372d39ff7ad6163db94dc3a19233713 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:42 +0200 Subject: [PATCH 1756/2300] Revert "[nrf fromlist] dts: bindings: mbox: add nordic,nrf-vevif-local|remote" This reverts commit 77878202ae4e676750b2337b60a30d3f69d9c19a. Signed-off-by: Gerard Marull-Paretas --- .../mbox/nordic,nrf-vevif-common.yaml | 18 ----------- dts/bindings/mbox/nordic,nrf-vevif-local.yaml | 32 ------------------- .../mbox/nordic,nrf-vevif-remote.yaml | 29 ----------------- 3 files changed, 79 deletions(-) delete mode 100644 dts/bindings/mbox/nordic,nrf-vevif-common.yaml delete mode 100644 dts/bindings/mbox/nordic,nrf-vevif-local.yaml delete mode 100644 dts/bindings/mbox/nordic,nrf-vevif-remote.yaml diff --git a/dts/bindings/mbox/nordic,nrf-vevif-common.yaml b/dts/bindings/mbox/nordic,nrf-vevif-common.yaml deleted file mode 100644 index b7cb15457f6..00000000000 --- a/dts/bindings/mbox/nordic,nrf-vevif-common.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -include: mailbox-controller.yaml - -properties: - nordic,tasks: - type: int - required: true - description: Number of tasks supported by the VEVIF instance. - - nordic,tasks-mask: - type: int - required: true - description: Mask of tasks supported by the VEVIF instance. - -mbox-cells: - - channel diff --git a/dts/bindings/mbox/nordic,nrf-vevif-local.yaml b/dts/bindings/mbox/nordic,nrf-vevif-local.yaml deleted file mode 100644 index 5d23cfdcf1e..00000000000 --- a/dts/bindings/mbox/nordic,nrf-vevif-local.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic VEVIF (VPR Event Interface) - Local - - VEVIF is an event interface for VPR, allowing connection to the domain's DPPI - system. VEVIF can also generate IRQs to other CPUs. - - Example definition: - - cpuppr: cpu@d { - ... - cpuppr_vevif_local: mailbox { - compatible = "nordic,nrf-vevif-local"; - interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>, - <1 NRF_DEFAULT_IRQ_PRIORITY>, - ... - ; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask: <0xfffffff0>; - }; - }; - -compatible: "nordic,nrf-vevif-local" - -include: [base.yaml, "nordic,nrf-vevif-common.yaml"] - -properties: - interrupts: - required: true diff --git a/dts/bindings/mbox/nordic,nrf-vevif-remote.yaml b/dts/bindings/mbox/nordic,nrf-vevif-remote.yaml deleted file mode 100644 index 07522fed99d..00000000000 --- a/dts/bindings/mbox/nordic,nrf-vevif-remote.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: | - Nordic VEVIF (VPR Event Interface) - Remote - - VEVIF is an event interface for VPR, allowing connection to the domain's DPPI - system. VEVIF can also generate IRQs to other CPUs. - - Example definition: - - cpuppr_vpr: vpr@deadbeef{ - ... - cpuppr_vevif_remote: mailbox@0 { - compatible = "nordic,nrf-vevif-remote"; - reg = <0x0 0x1000>; - #mbox-cells = <1>; - nordic,tasks = <16>; - nordic,tasks-mask: <0xfffffff0>; - }; - }; - -compatible: "nordic,nrf-vevif-remote" - -include: [base.yaml, "nordic,nrf-vevif-common.yaml"] - -properties: - reg: - required: true From f2fb21561939ffebc08b14d3d66ac60bb8714403 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:43 +0200 Subject: [PATCH 1757/2300] Revert "[nrf fromlist] drivers: ieee802154: gracefully handle invalid Ack timestamp" This reverts commit f2de48f36b21d9b1f0f43239c7a08aca950e5523. Signed-off-by: Gerard Marull-Paretas --- drivers/ieee802154/ieee802154_nrf5.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index ecc758455d7..39891c635c9 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -387,17 +387,6 @@ static int handle_ack(struct nrf5_802154_data *nrf5_radio) struct net_pkt *ack_pkt; int err = 0; -#if defined(CONFIG_NET_PKT_TIMESTAMP) - if (nrf5_radio->ack_frame.time == NRF_802154_NO_TIMESTAMP) { - /* Ack timestamp is invalid and cannot be used by the upper layer. - * Report the transmission as failed as if the Ack was not received at all. - */ - LOG_WRN("Invalid ACK timestamp."); - err = -ENOMSG; - goto free_nrf_ack; - } -#endif - if (IS_ENABLED(CONFIG_IEEE802154_NRF5_FCS_IN_LENGTH)) { ack_len = nrf5_radio->ack_frame.psdu[0]; } else { @@ -1141,14 +1130,8 @@ void nrf_802154_transmitted_raw(uint8_t *frame, nrf5_data.ack_frame.lqi = metadata->data.transmitted.lqi; #if defined(CONFIG_NET_PKT_TIMESTAMP) - if (metadata->data.transmitted.time == NRF_802154_NO_TIMESTAMP) { - /* Ack timestamp is invalid. Keep this value to detect it when handling Ack - */ - nrf5_data.ack_frame.time = NRF_802154_NO_TIMESTAMP; - } else { - nrf5_data.ack_frame.time = nrf_802154_timestamp_end_to_phr_convert( - metadata->data.transmitted.time, nrf5_data.ack_frame.psdu[0]); - } + nrf5_data.ack_frame.time = nrf_802154_timestamp_end_to_phr_convert( + metadata->data.transmitted.time, nrf5_data.ack_frame.psdu[0]); #endif } From 0b8d69941eb55fd085e1e45bab519e7159a05132 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:43 +0200 Subject: [PATCH 1758/2300] Revert "[nrf fromlist] samples: net: cellular_modem: add nRF9160 DK's nRF52840" This reverts commit 3a97de47ca5cde5dba3a6584add1aa6b60d3ac5a. Signed-off-by: Gerard Marull-Paretas --- .../boards/nrf9160dk_nrf52840.conf | 13 ------------- .../boards/nrf9160dk_nrf52840.overlay | 18 ------------------ 2 files changed, 31 deletions(-) delete mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf delete mode 100644 samples/net/cellular_modem/boards/nrf9160dk_nrf52840.overlay diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf deleted file mode 100644 index 2af3b6d2a41..00000000000 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.conf +++ /dev/null @@ -1,13 +0,0 @@ -CONFIG_UART_ASYNC_API=y - -# Align with the Serial LTE Modem (SLM) application. -CONFIG_MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE=1500 -CONFIG_MODEM_CELLULAR_UART_BUFFER_SIZES=1500 - -# Allow large UART TXs to go through @115200. -CONFIG_MODEM_BACKEND_UART_ASYNC_TRANSMIT_TIMEOUT_MS=200 - -# Print logs and printk() output on uart0. -CONFIG_LOG=y -CONFIG_LOG_BACKEND_UART=y -CONFIG_MODEM_LOG_LEVEL_DBG=y diff --git a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.overlay b/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.overlay deleted file mode 100644 index c639ec8b305..00000000000 --- a/samples/net/cellular_modem/boards/nrf9160dk_nrf52840.overlay +++ /dev/null @@ -1,18 +0,0 @@ -#include - -/ { - aliases { - modem = &modem; - }; -}; - -&uart1 { - current-speed = <115200>; - hw-flow-control; - - modem: modem { - compatible = "nordic,nrf91-slm"; - status = "okay"; - mdm-power-gpios = <&interface_to_nrf9160 4 GPIO_ACTIVE_LOW>; - }; -}; From 060b09c49ba9869cab77f9f48851019cb773d61d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:43 +0200 Subject: [PATCH 1759/2300] Revert "[nrf fromlist] samples: net: cellular_modem: small fixes/improvements" This reverts commit bd0953fe392f6e5f787ce92f85ada2ded6207eab. Signed-off-by: Gerard Marull-Paretas --- samples/net/cellular_modem/prj.conf | 4 --- samples/net/cellular_modem/src/main.c | 39 +++++++++++++-------------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/samples/net/cellular_modem/prj.conf b/samples/net/cellular_modem/prj.conf index ab44ca9528e..52d0ca26bde 100644 --- a/samples/net/cellular_modem/prj.conf +++ b/samples/net/cellular_modem/prj.conf @@ -22,7 +22,3 @@ CONFIG_NET_CONNECTION_MANAGER=y CONFIG_MODEM=y CONFIG_PM_DEVICE=y CONFIG_MODEM_CELLULAR=y - -# Logging -CONFIG_MODEM_MODULES_LOG_LEVEL_DBG=y -#CONFIG_MODEM_CMUX_LOG_LEVEL_DBG=y diff --git a/samples/net/cellular_modem/src/main.c b/samples/net/cellular_modem/src/main.c index b7e738d13e5..6ab5ddc297d 100644 --- a/samples/net/cellular_modem/src/main.c +++ b/samples/net/cellular_modem/src/main.c @@ -160,7 +160,7 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t continue; } - printk("Receiving echoed packet\n"); + printk("Receiving echoed packet"); ret = zsock_recv(socket_fd, sample_recv_buffer, sizeof(sample_recv_buffer), 0); if (ret != sizeof(sample_test_packet)) { printk("Echoed sample test packet has incorrect size\n"); @@ -181,10 +181,10 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t printk("Echo transmit time %ums\n", echo_received_ms - send_start_ms); } - printk("Successfully sent and received %u of %u packets\n", packets_sent, + printk("Successfully sent %u packets of %u packets\n", packets_sent, SAMPLE_TEST_ECHO_PACKETS); - printk("Average time per successful echo: %u ms\n", + printk("Average time per echo: %u ms\n", accumulated_ms / packets_sent); printk("Close UDP socket\n"); @@ -265,7 +265,10 @@ int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint int main(void) { struct net_if *const iface = net_if_get_first_by_type(&NET_L2_GET_NAME(PPP)); + uint32_t raised_event; uint16_t *port; + const void *info; + size_t info_len; int ret; init_sample_test_packet(); @@ -281,8 +284,9 @@ int main(void) } printk("Waiting for L4 connected\n"); - ret = net_mgmt_event_wait_on_iface(iface, NET_EVENT_L4_CONNECTED, NULL, NULL, NULL, - K_SECONDS(120)); + ret = net_mgmt_event_wait_on_iface(iface, + NET_EVENT_L4_CONNECTED, &raised_event, &info, + &info_len, K_SECONDS(120)); if (ret != 0) { printk("L4 was not connected in time\n"); @@ -290,12 +294,9 @@ int main(void) } printk("Waiting for DNS server added\n"); - ret = net_mgmt_event_wait_on_iface(iface, NET_EVENT_DNS_SERVER_ADD, NULL, NULL, NULL, - K_SECONDS(10)); - if (ret) { - printk("DNS server was not added in time\n"); - return -1; - } + ret = net_mgmt_event_wait_on_iface(iface, + NET_EVENT_DNS_SERVER_ADD, &raised_event, &info, + &info_len, K_SECONDS(10)); printk("Retrieving cellular info\n"); print_cellular_info(); @@ -332,7 +333,7 @@ int main(void) sample_test_dns_addrinfo.ai_addrlen, port); if (ret < 0) { - printk("Failed to send echos\n"); + printk("Failed to send echo\n"); return -1; } @@ -354,26 +355,24 @@ int main(void) pm_device_action_run(modem, PM_DEVICE_ACTION_RESUME); printk("Waiting for L4 connected\n"); - ret = net_mgmt_event_wait_on_iface(iface, NET_EVENT_L4_CONNECTED, NULL, NULL, NULL, - K_SECONDS(60)); + ret = net_mgmt_event_wait_on_iface(net_if_get_default(), + NET_EVENT_L4_CONNECTED, &raised_event, &info, + &info_len, K_SECONDS(60)); + if (ret != 0) { printk("L4 was not connected in time\n"); return -1; } - printk("L4 connected\n"); - - /* Wait a bit to avoid (unsuccessfully) trying to send the first echo packet too quickly. */ - k_sleep(K_SECONDS(1)); ret = sample_echo_packet(&sample_test_dns_addrinfo.ai_addr, sample_test_dns_addrinfo.ai_addrlen, port); if (ret < 0) { - printk("Failed to send echos after restart\n"); + printk("Failed to send echo after restart\n"); return -1; } - ret = net_if_down(iface); + ret = net_if_down(net_if_get_default()); if (ret < 0) { printk("Failed to bring down network interface\n"); return -1; From 0f03c0a0df9351d089cd5e2a687e06464519d088 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:43 +0200 Subject: [PATCH 1760/2300] Revert "[nrf fromlist] modem: backends: uart_async: log the number of bytes dropped" This reverts commit 53f95da47e946c118367fd3724d9b6410cfe9ea3. Signed-off-by: Gerard Marull-Paretas --- subsys/modem/backends/modem_backend_uart_async.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/modem/backends/modem_backend_uart_async.c b/subsys/modem/backends/modem_backend_uart_async.c index 0fa3684780e..29107198c2f 100644 --- a/subsys/modem/backends/modem_backend_uart_async.c +++ b/subsys/modem/backends/modem_backend_uart_async.c @@ -114,8 +114,7 @@ static void modem_backend_uart_async_event_handler(const struct device *dev, if (received < evt->data.rx.len) { ring_buf_reset(&backend->async.receive_rb); k_spin_unlock(&backend->async.receive_rb_lock, key); - LOG_WRN("Receive buffer overrun (%u/%u dropped)", - evt->data.rx.len - received, evt->data.rx.len); + LOG_WRN("Receive buffer overrun"); break; } From 9a509bba2a413a7eb499bfa846c058d31688b8fd Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:43 +0200 Subject: [PATCH 1761/2300] Revert "[nrf fromlist] Bluetooth: Controller: Remove experimental from LE Set Host Feature" This reverts commit 1ead4c257b3b67b92e0e3f39eb2c763673cc666a. Signed-off-by: Gerard Marull-Paretas --- subsys/bluetooth/controller/Kconfig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index a7b2c1a74f1..bff6c17bca6 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -853,14 +853,11 @@ config BT_CTLR_SYNC_ISO_PDU_LEN_MAX endif # BT_CTLR_ADV_EXT config BT_CTLR_SET_HOST_FEATURE - bool "LE Set Host Feature Command" if !BT_LL_SW_SPLIT + bool "LE Set Host Feature Command [EXPERIMENTAL]" + select EXPERIMENTAL help Enables optional LE Set Host Feature Command -config BT_CTLR_SET_HOST_FEATURE - bool "LE Set Host Feature Command (Split Link Layer) [EXPERIMENTAL]" if BT_LL_SW_SPLIT - select EXPERIMENTAL if BT_LL_SW_SPLIT - config BT_CTLR_CENTRAL_ISO bool "LE Connected Isochronous Stream Central" if !BT_LL_SW_SPLIT depends on BT_CTLR_CENTRAL_ISO_SUPPORT && BT_CENTRAL From d4af7ad3e39688d695bc07900e3be1579672d180 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 30 Apr 2024 11:04:44 +0200 Subject: [PATCH 1762/2300] Revert "[nrf fromlist] samples: net: cellular_modem: small improvements" This reverts commit 509dcb2757b9ec83cddba8a7f166fb11dcef3208. Signed-off-by: Gerard Marull-Paretas --- samples/net/cellular_modem/README.rst | 2 +- samples/net/cellular_modem/src/main.c | 63 +++++++++++---------------- 2 files changed, 26 insertions(+), 39 deletions(-) diff --git a/samples/net/cellular_modem/README.rst b/samples/net/cellular_modem/README.rst index b845b2e37d8..384d8b3bef5 100644 --- a/samples/net/cellular_modem/README.rst +++ b/samples/net/cellular_modem/README.rst @@ -18,7 +18,7 @@ Notes This sample uses the devicetree alias modem to identify the modem instance to use. The sample also presumes that -the modem driver creates the only PPP network interface. +the modem driver creates the only network interface. Setup ***** diff --git a/samples/net/cellular_modem/src/main.c b/samples/net/cellular_modem/src/main.c index 6ab5ddc297d..35a97d3e831 100644 --- a/samples/net/cellular_modem/src/main.c +++ b/samples/net/cellular_modem/src/main.c @@ -127,7 +127,7 @@ static int sample_dns_request(void) return 0; } -int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t *port) +int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen) { int ret; int socket_fd; @@ -140,16 +140,22 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t socket_fd = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (socket_fd < 0) { - printk("Failed to open socket (%d)\n", errno); + printk("Failed to open socket\n"); return -1; } printk("Socket opened\n"); - *port = htons(SAMPLE_TEST_ENDPOINT_UDP_ECHO_PORT); + if (ai_addr->sa_family == AF_INET) { + net_sin(ai_addr)->sin_port = htons(SAMPLE_TEST_ENDPOINT_UDP_ECHO_PORT); + } else if (ai_addr->sa_family == AF_INET6) { + net_sin6(ai_addr)->sin6_port = htons(SAMPLE_TEST_ENDPOINT_UDP_ECHO_PORT); + } else { + printk("Unsupported address family\n"); + return -1; + } for (uint32_t i = 0; i < SAMPLE_TEST_ECHO_PACKETS; i++) { - printk("Sending echo packet\n"); send_start_ms = k_uptime_get_32(); ret = zsock_sendto(socket_fd, sample_test_packet, sizeof(sample_test_packet), 0, @@ -160,7 +166,6 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t continue; } - printk("Receiving echoed packet"); ret = zsock_recv(socket_fd, sample_recv_buffer, sizeof(sample_recv_buffer), 0); if (ret != sizeof(sample_test_packet)) { printk("Echoed sample test packet has incorrect size\n"); @@ -199,7 +204,7 @@ int sample_echo_packet(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t } -int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint16_t *port) +int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen) { int ret; int socket_fd; @@ -219,7 +224,14 @@ int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint printk("Socket opened\n"); - *port = htons(SAMPLE_TEST_ENDPOINT_UDP_RECEIVE_PORT); + if (ai_addr->sa_family == AF_INET) { + net_sin(ai_addr)->sin_port = htons(SAMPLE_TEST_ENDPOINT_UDP_RECEIVE_PORT); + } else if (ai_addr->sa_family == AF_INET6) { + net_sin6(ai_addr)->sin6_port = htons(SAMPLE_TEST_ENDPOINT_UDP_RECEIVE_PORT); + } else { + printk("Unsupported address family\n"); + return -1; + } printk("Sending %u packets\n", SAMPLE_TEST_TRANSMIT_PACKETS); send_start_ms = k_uptime_get_32(); @@ -264,9 +276,7 @@ int sample_transmit_packets(struct sockaddr *ai_addr, socklen_t ai_addrlen, uint int main(void) { - struct net_if *const iface = net_if_get_first_by_type(&NET_L2_GET_NAME(PPP)); uint32_t raised_event; - uint16_t *port; const void *info; size_t info_len; int ret; @@ -277,14 +287,14 @@ int main(void) pm_device_action_run(modem, PM_DEVICE_ACTION_RESUME); printk("Bring up network interface\n"); - ret = net_if_up(iface); + ret = net_if_up(net_if_get_default()); if (ret < 0) { printk("Failed to bring up network interface\n"); return -1; } printk("Waiting for L4 connected\n"); - ret = net_mgmt_event_wait_on_iface(iface, + ret = net_mgmt_event_wait_on_iface(net_if_get_default(), NET_EVENT_L4_CONNECTED, &raised_event, &info, &info_len, K_SECONDS(120)); @@ -294,7 +304,7 @@ int main(void) } printk("Waiting for DNS server added\n"); - ret = net_mgmt_event_wait_on_iface(iface, + ret = net_mgmt_event_wait_on_iface(net_if_get_default(), NET_EVENT_DNS_SERVER_ADD, &raised_event, &info, &info_len, K_SECONDS(10)); @@ -308,29 +318,8 @@ int main(void) return -1; } - { - char ip_str[INET6_ADDRSTRLEN]; - const void *src; - - switch (sample_test_dns_addrinfo.ai_addr.sa_family) { - case AF_INET: - src = &net_sin(&sample_test_dns_addrinfo.ai_addr)->sin_addr; - port = &net_sin(&sample_test_dns_addrinfo.ai_addr)->sin_port; - break; - case AF_INET6: - src = &net_sin6(&sample_test_dns_addrinfo.ai_addr)->sin6_addr; - port = &net_sin6(&sample_test_dns_addrinfo.ai_addr)->sin6_port; - break; - default: - printk("Unsupported address family\n"); - return -1; - } - inet_ntop(sample_test_dns_addrinfo.ai_addr.sa_family, src, ip_str, sizeof(ip_str)); - printk("Resolved to %s\n", ip_str); - } - ret = sample_echo_packet(&sample_test_dns_addrinfo.ai_addr, - sample_test_dns_addrinfo.ai_addrlen, port); + sample_test_dns_addrinfo.ai_addrlen); if (ret < 0) { printk("Failed to send echo\n"); @@ -338,7 +327,7 @@ int main(void) } ret = sample_transmit_packets(&sample_test_dns_addrinfo.ai_addr, - sample_test_dns_addrinfo.ai_addrlen, port); + sample_test_dns_addrinfo.ai_addrlen); if (ret < 0) { printk("Failed to send packets\n"); @@ -353,8 +342,6 @@ int main(void) } pm_device_action_run(modem, PM_DEVICE_ACTION_RESUME); - - printk("Waiting for L4 connected\n"); ret = net_mgmt_event_wait_on_iface(net_if_get_default(), NET_EVENT_L4_CONNECTED, &raised_event, &info, &info_len, K_SECONDS(60)); @@ -365,7 +352,7 @@ int main(void) } ret = sample_echo_packet(&sample_test_dns_addrinfo.ai_addr, - sample_test_dns_addrinfo.ai_addrlen, port); + sample_test_dns_addrinfo.ai_addrlen); if (ret < 0) { printk("Failed to send echo after restart\n"); From cce72196f80c7a5e37cc6c3d9059e35153f08abc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 15 Apr 2024 11:02:41 +0300 Subject: [PATCH 1763/2300] [nrf fromlist] samples: net: Disable native_posix target in more samples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The native_posix compilations fail with various socket errors like this: samples/net/sockets/can/src/main.c:65:9: error: implicit \ declaration of function ‘send’ [-Werror=implicit-function-declaration] 65 | ret = send(fd, &sframe, sizeof(sframe), 0); | ^~~~ So disable the native_posix board from networking samples as native_posix board is not compatible with CONFIG_POSIX_API This is related to commit b8fc1c4c3e ("samples: net: Disable native_posix target in samples") but disables more network samples for native_posix board. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71485 Signed-off-by: Jukka Rissanen (cherry picked from commit 883bc85a5493d8fe06eee7b8e2224309f7b95b53) --- samples/net/sockets/can/sample.yaml | 4 ++++ samples/net/sockets/dumb_http_server_mt/sample.yaml | 4 ++++ samples/net/sockets/http_client/sample.yaml | 4 ++++ samples/net/sockets/packet/sample.yaml | 2 -- samples/net/sockets/txtime/sample.yaml | 2 -- samples/net/sockets/websocket_client/sample.yaml | 4 ++++ 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/samples/net/sockets/can/sample.yaml b/samples/net/sockets/can/sample.yaml index 4e1d9d1c9fa..a9dff7079d3 100644 --- a/samples/net/sockets/can/sample.yaml +++ b/samples/net/sockets/can/sample.yaml @@ -8,6 +8,10 @@ common: filter: dt_chosen_enabled("zephyr,canbus") and not dt_compat_enabled("kvaser,pcican") depends_on: can harness: console + # native_posix does not work with CONFIG_POSIX_API + platform_exclude: + - native_posix + - native_posix/native/64 tests: sample.net.sockets.can.one_socket: extra_configs: diff --git a/samples/net/sockets/dumb_http_server_mt/sample.yaml b/samples/net/sockets/dumb_http_server_mt/sample.yaml index fa69fea8c97..dc0c8182246 100644 --- a/samples/net/sockets/dumb_http_server_mt/sample.yaml +++ b/samples/net/sockets/dumb_http_server_mt/sample.yaml @@ -9,6 +9,10 @@ common: - net - socket - http + # native_posix does not work with CONFIG_POSIX_API + platform_exclude: + - native_posix + - native_posix/native/64 tests: sample.net.sockets.dumb_http_server_mt: extra_configs: diff --git a/samples/net/sockets/http_client/sample.yaml b/samples/net/sockets/http_client/sample.yaml index 271f61b94ec..afd14a1a255 100644 --- a/samples/net/sockets/http_client/sample.yaml +++ b/samples/net/sockets/http_client/sample.yaml @@ -5,6 +5,10 @@ common: - http_client min_ram: 32 depends_on: netif + # native_posix does not work with CONFIG_POSIX_API + platform_exclude: + - native_posix + - native_posix/native/64 sample: description: HTTP client sample name: http_client diff --git a/samples/net/sockets/packet/sample.yaml b/samples/net/sockets/packet/sample.yaml index dc816ac52e8..723978b5de8 100644 --- a/samples/net/sockets/packet/sample.yaml +++ b/samples/net/sockets/packet/sample.yaml @@ -5,8 +5,6 @@ tests: sample.net.sockets.packet: harness: net platform_allow: - - native_posix - - native_posix/native/64 - native_sim - native_sim/native/64 integration_platforms: diff --git a/samples/net/sockets/txtime/sample.yaml b/samples/net/sockets/txtime/sample.yaml index feb099bd63b..18613f4b87a 100644 --- a/samples/net/sockets/txtime/sample.yaml +++ b/samples/net/sockets/txtime/sample.yaml @@ -3,8 +3,6 @@ common: depends_on: netif # We can only run this in platforms that support PTP clock and TXTIME platform_allow: - - native_posix - - native_posix/native/64 - native_sim - native_sim/native/64 - qemu_x86 diff --git a/samples/net/sockets/websocket_client/sample.yaml b/samples/net/sockets/websocket_client/sample.yaml index a0472b856f9..df7603cf1a1 100644 --- a/samples/net/sockets/websocket_client/sample.yaml +++ b/samples/net/sockets/websocket_client/sample.yaml @@ -7,6 +7,10 @@ common: - websocket min_ram: 35 depends_on: netif + # native_posix does not work with CONFIG_POSIX_API + platform_exclude: + - native_posix + - native_posix/native/64 sample: description: Websocket client sample name: websocket_client From 1552882744a9ce10e528f2c4a60bdf5de48e2352 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 15 Apr 2024 15:54:58 +0200 Subject: [PATCH 1764/2300] [nrf fromlist] samples: net: tftp_client: do not allow native_posix Because CONFIG_POSIX_API (required) cannot be selected on that platform, resulting in build failures. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71516 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit e4d137eadddbd87b879380c19b8f2f7d852165b4) --- samples/net/tftp_client/sample.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/net/tftp_client/sample.yaml b/samples/net/tftp_client/sample.yaml index 3ccedecafe9..6e53b0f1881 100644 --- a/samples/net/tftp_client/sample.yaml +++ b/samples/net/tftp_client/sample.yaml @@ -6,7 +6,6 @@ tests: harness: net depends_on: netif platform_allow: - - native_posix - native_sim integration_platforms: - native_sim From ffbf62c7753b85cb9e274bef5fef441c871d7f4c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 15 Apr 2024 14:59:19 +0100 Subject: [PATCH 1765/2300] [nrf fromlist] boards: Fix doc build warnings Fixes warnings when building documentation due to additional SoC names being part of the Kconfig symbols which they should not be Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71517 Signed-off-by: Jamie McCrae (cherry picked from commit eeec8c22a1b16bb40cb31a2b6b58696972a3aded) --- boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 | 2 +- boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb | 2 +- boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk | 4 ++-- boards/nxp/imx93_evk/Kconfig.imx93_evk | 4 ++-- boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 | 4 ++-- boards/rak/rak5010/Kconfig.rak5010 | 2 +- boards/starfive/visionfive2/Kconfig.visionfive2 | 2 +- boards/ti/sk_am62/Kconfig.sk_am62 | 6 ++---- boards/we/proteus2ev/Kconfig.we_proteus2ev | 2 +- 9 files changed, 13 insertions(+), 15 deletions(-) diff --git a/boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 b/boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 index 2b69264a29c..1abf2e23fd8 100644 --- a/boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 +++ b/boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 @@ -3,5 +3,5 @@ # Copyright (c) 2021 Blue Clover # SPDX-License-Identifier: Apache-2.0 -config BOARD_BLUECLOVER_PLT_DEMO_V2_NRF52832 +config BOARD_BLUECLOVER_PLT_DEMO_V2 select SOC_NRF52832_QFAA diff --git a/boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb b/boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb index 8a04ffd502d..60fa87104fc 100644 --- a/boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb +++ b/boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb @@ -3,5 +3,5 @@ # Copyright (c) 2021 Michal Morsisko # SPDX-License-Identifier: Apache-2.0 -config BOARD_EBYTE_E73_TBB_NRF52832 +config BOARD_EBYTE_E73_TBB select SOC_NRF52832_QFAA diff --git a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk index 4ec5b6ee62d..12f6e2efd48 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk +++ b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk @@ -1,5 +1,5 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config BOARD_NRF54L15PDK_NRF54L15_CPUAPP - select SOC_NRF54L15_ENGA_CPUAPP +config BOARD_NRF54L15PDK + select SOC_NRF54L15_ENGA_CPUAPP if BOARD_NRF54L15PDK_NRF54L15_CPUAPP diff --git a/boards/nxp/imx93_evk/Kconfig.imx93_evk b/boards/nxp/imx93_evk/Kconfig.imx93_evk index e3121418393..0115518a6d2 100644 --- a/boards/nxp/imx93_evk/Kconfig.imx93_evk +++ b/boards/nxp/imx93_evk/Kconfig.imx93_evk @@ -1,6 +1,6 @@ # Copyright 2022,2024 NXP # SPDX-License-Identifier: Apache-2.0 -config BOARD_IMX93_EVK_MIMX9352_A55 - select SOC_MIMX9352_A55 +config BOARD_IMX93_EVK + select SOC_MIMX9352_A55 if BOARD_IMX93_EVK_MIMX9352_A55 select SOC_PART_NUMBER_MIMX9352CVUXK diff --git a/boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 b/boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 index cfd9ba449db..081124dd1a8 100644 --- a/boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 +++ b/boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 @@ -1,6 +1,6 @@ # Copyright 2023 NXP # SPDX-License-Identifier: Apache-2.0 -config BOARD_VMU_RT1170_MIMXRT1176_CM7 - select SOC_MIMXRT1176_CM7 +config BOARD_VMU_RT1170 + select SOC_MIMXRT1176_CM7 if BOARD_VMU_RT1170_MIMXRT1176_CM7 select SOC_PART_NUMBER_MIMXRT1176DVMAA diff --git a/boards/rak/rak5010/Kconfig.rak5010 b/boards/rak/rak5010/Kconfig.rak5010 index ced2b62b39c..4c5db16669d 100644 --- a/boards/rak/rak5010/Kconfig.rak5010 +++ b/boards/rak/rak5010/Kconfig.rak5010 @@ -3,5 +3,5 @@ # Copyright (c) 2020 Guillaume Paquet # SPDX-License-Identifier: Apache-2.0 -config BOARD_RAK5010_NRF52840 +config BOARD_RAK5010 select SOC_NRF52840_QIAA diff --git a/boards/starfive/visionfive2/Kconfig.visionfive2 b/boards/starfive/visionfive2/Kconfig.visionfive2 index e451964f979..d2988440b2d 100644 --- a/boards/starfive/visionfive2/Kconfig.visionfive2 +++ b/boards/starfive/visionfive2/Kconfig.visionfive2 @@ -1,5 +1,5 @@ # Copyright (c) 2024 Kanak Shilledar # SPDX-License-Identifier: Apache-2.0 -config BOARD_VISIONFIVE2_JH7110 +config BOARD_VISIONFIVE2 select SOC_JH7110 diff --git a/boards/ti/sk_am62/Kconfig.sk_am62 b/boards/ti/sk_am62/Kconfig.sk_am62 index d7e83cba87a..fab6d884508 100644 --- a/boards/ti/sk_am62/Kconfig.sk_am62 +++ b/boards/ti/sk_am62/Kconfig.sk_am62 @@ -5,7 +5,5 @@ # # SPDX-License-Identifier: Apache-2.0 -config BOARD_SK_AM62_AM6234_M4 - select SOC_AM6234_M4 - help - TI AM62x M4 Starter Kit (SK) Evaluation Module (EVM) +config BOARD_SK_AM62 + select SOC_AM6234_M4 if BOARD_SK_AM62_AM6234_M4 diff --git a/boards/we/proteus2ev/Kconfig.we_proteus2ev b/boards/we/proteus2ev/Kconfig.we_proteus2ev index 60aa73fb142..b18f4c4f9bb 100644 --- a/boards/we/proteus2ev/Kconfig.we_proteus2ev +++ b/boards/we/proteus2ev/Kconfig.we_proteus2ev @@ -1,5 +1,5 @@ # Copyright (c) 2022 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config BOARD_WE_PROTEUS2EV_NRF52832 +config BOARD_WE_PROTEUS2EV select SOC_NRF52832_CIAA From 24663df1abb2af207fdfba31e025229350231b31 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Mon, 15 Apr 2024 14:12:11 +0200 Subject: [PATCH 1766/2300] [nrf fromlist] scripts: support soc/boards in Zephyr modules Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71519 Extend check_compliance with support for soc and boards defined Zephyr modules. Signed-off-by: Torsten Rasmussen --- scripts/ci/check_compliance.py | 45 +++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 95c7e26a5ea..ba44e084e6d 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -379,7 +379,7 @@ def get_modules(self, modules_file, settings_file): )) fp_module_file.write(content) - def get_kconfig_dts(self, kconfig_dts_file, settings_file): + def get_module_setting_root(self, root, settings_file): """ Generate the Kconfig.dts using dts/bindings as the source. @@ -388,10 +388,7 @@ def get_kconfig_dts(self, kconfig_dts_file, settings_file): """ # Invoke the script directly using the Python executable since this is # not a module nor a pip-installed Python utility - zephyr_drv_kconfig_path = os.path.join(ZEPHYR_BASE, "scripts", "dts", - "gen_driver_kconfig_dts.py") - binding_paths = [] - binding_paths.append(os.path.join(ZEPHYR_BASE, "dts", "bindings")) + root_paths = [] if os.path.exists(settings_file): with open(settings_file, 'r') as fp_setting_file: @@ -399,9 +396,29 @@ def get_kconfig_dts(self, kconfig_dts_file, settings_file): lines = content.strip().split('\n') for line in lines: - if line.startswith('"DTS_ROOT":'): - _, dts_root_path = line.split(":", 1) - binding_paths.append(os.path.join(dts_root_path.strip('"'), "dts", "bindings")) + root = root.upper() + if line.startswith(f'"{root}_ROOT":'): + _, root_path = line.split(":", 1) + root_paths.append(Path(root_path.strip('"'))) + return root_paths + + def get_kconfig_dts(self, kconfig_dts_file, settings_file): + """ + Generate the Kconfig.dts using dts/bindings as the source. + + This is needed to complete Kconfig compliance tests. + + """ + # Invoke the script directly using the Python executable since this is + # not a module nor a pip-installed Python utility + zephyr_drv_kconfig_path = os.path.join(ZEPHYR_BASE, "scripts", "dts", + "gen_driver_kconfig_dts.py") + binding_paths = [] + binding_paths.append(os.path.join(ZEPHYR_BASE, "dts", "bindings")) + + dts_root_paths = self.get_module_setting_root('dts', settings_file) + for p in dts_root_paths: + binding_paths.append(p / "dts" / "bindings") cmd = [sys.executable, zephyr_drv_kconfig_path, '--kconfig-out', kconfig_dts_file, '--bindings-dirs'] @@ -439,7 +456,7 @@ def get_v1_model_syms(self, kconfig_v1_file, kconfig_v1_syms_file): fp_kconfig_v1_syms_file.write('\n\t' + kconfiglib.TYPE_TO_STR[s.type]) fp_kconfig_v1_syms_file.write('\n\n') - def get_v2_model(self, kconfig_dir): + def get_v2_model(self, kconfig_dir, settings_file): """ Get lists of v2 boards and SoCs and put them in a file that is parsed by Kconfig @@ -451,8 +468,12 @@ def get_v2_model(self, kconfig_dir): kconfig_boards_file = os.path.join(kconfig_dir, 'boards', 'Kconfig.boards') kconfig_defconfig_file = os.path.join(kconfig_dir, 'boards', 'Kconfig.defconfig') - root_args = argparse.Namespace(**{'board_roots': [Path(ZEPHYR_BASE)], - 'soc_roots': [Path(ZEPHYR_BASE)], 'board': None}) + board_roots = self.get_module_setting_root('board', settings_file) + board_roots.insert(0, Path(ZEPHYR_BASE)) + 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) with open(kconfig_defconfig_file, 'w') as fp: @@ -558,7 +579,7 @@ def parse_kconfig(self, filename="Kconfig", hwm=None): os.makedirs(os.path.join(kconfiglib_dir, 'arch'), exist_ok=True) os.environ["BOARD_DIR"] = kconfiglib_boards_dir - self.get_v2_model(kconfiglib_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 # symbols within Kconfig files From 1758a3204dd9627f78974cd0815a6df2c9519974 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 15 Apr 2024 09:23:00 +0100 Subject: [PATCH 1767/2300] [nrf fromtree] cmake: modules: boards: Add normalised variables Adds a new variable NORMALIZED_BOARD_QUALIFIERS which contains the board qualifiers in file-name format, this allows for constructing strings in applications (e.g. for folder names) prior to Zephyr being found for things like APPLICATION_CONFIG_DIR. Also adds NORMALIZED_BOARD_TARGET. Signed-off-by: Jamie McCrae (cherry picked from commit a2ed8162c8c42a4301264709e9e476ef9eaa0552) --- cmake/modules/boards.cmake | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/cmake/modules/boards.cmake b/cmake/modules/boards.cmake index cb07262f150..b1e2b21abce 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -21,13 +21,18 @@ # Outcome: # The following variables will be defined when this CMake module completes: # -# - BOARD: Board, without revision field. -# - BOARD_REVISION: Board revision -# - BOARD_DIR: Board directory with the implementation for selected board -# - ARCH_DIR: Arch dir for extracted from selected board -# - BOARD_ROOT: BOARD_ROOT with ZEPHYR_BASE appended -# - BOARD_EXTENSION_DIRS: List of board extension directories (If -# BOARD_EXTENSIONS is not explicitly disabled) +# - BOARD: Board, without revision field. +# - BOARD_REVISION: Board revision +# - BOARD_QUALIFIERS: Board qualifiers +# - NORMALIZED_BOARD_QUALIFIERS: Board qualifiers in lower-case format where slashes have been +# replaced with underscores +# - NORMALIZED_BOARD_TARGET: Board target in lower-case format where slashes have been +# replaced with underscores +# - BOARD_DIR: Board directory with the implementation for selected board +# - ARCH_DIR: Arch dir for extracted from selected board +# - BOARD_ROOT: BOARD_ROOT with ZEPHYR_BASE appended +# - BOARD_EXTENSION_DIRS: List of board extension directories (If +# BOARD_EXTENSIONS is not explicitly disabled) # # The following targets will be defined when this CMake module completes: # - board: when invoked, a list of valid boards will be printed @@ -336,8 +341,13 @@ endif() if(DEFINED BOARD_QUALIFIERS) string(REGEX REPLACE "^/" "qualifiers: " board_message_qualifiers "${BOARD_QUALIFIERS}") set(board_message "${board_message}, ${board_message_qualifiers}") + + string(REPLACE "/" "_" NORMALIZED_BOARD_QUALIFIERS "${BOARD_QUALIFIERS}") endif() +set(NORMALIZED_BOARD_TARGET "${BOARD}${BOARD_QUALIFIERS}") +string(REPLACE "/" "_" NORMALIZED_BOARD_TARGET "${NORMALIZED_BOARD_TARGET}") + message(STATUS "${board_message}") add_custom_target(boards ${list_boards_commands} USES_TERMINAL) From 4fa036ea4d3d2990f652f701b2c3877195e7ef7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Wed, 10 Apr 2024 11:37:21 +0200 Subject: [PATCH 1768/2300] [nrf fromtree] soc: nordic: nrf53: network CPU Force-OFF management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces a common API for managing nRF53 SoC network CPU Force-OFF state. From the application CPU point of view, the network CPU is a shared resource used by multiple users. The current solution where every user controls the network core state directly leads to dependencies between users and does not scale well. To address this problem there should be a single entity responsible for controlling the network CPU Force-OFF signal. This commit introduces such module. Signed-off-by: Jędrzej Ciupis (cherry picked from commit ec3c3f153b0c1d074c9739d416ee1d40c80481d9) --- soc/nordic/nrf53/CMakeLists.txt | 1 + soc/nordic/nrf53/Kconfig | 7 +++ soc/nordic/nrf53/nrf53_cpunet_mgmt.c | 68 ++++++++++++++++++++++++++++ soc/nordic/nrf53/nrf53_cpunet_mgmt.h | 31 +++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 soc/nordic/nrf53/nrf53_cpunet_mgmt.c create mode 100644 soc/nordic/nrf53/nrf53_cpunet_mgmt.h diff --git a/soc/nordic/nrf53/CMakeLists.txt b/soc/nordic/nrf53/CMakeLists.txt index 0e8b1e69a29..145a425e55a 100644 --- a/soc/nordic/nrf53/CMakeLists.txt +++ b/soc/nordic/nrf53/CMakeLists.txt @@ -3,6 +3,7 @@ zephyr_library_sources(soc.c) zephyr_include_directories(.) +zephyr_library_sources_ifdef(CONFIG_SOC_NRF53_CPUNET_MGMT nrf53_cpunet_mgmt.c) zephyr_library_sources_ifdef(CONFIG_NRF53_SYNC_RTC sync_rtc.c) if (CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED AND diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index 7ef9546058d..cc7bdaa5dc6 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -24,6 +24,7 @@ config SOC_NRF5340_CPUAPP select ARMV8_M_DSP select HAS_POWEROFF select SOC_COMPATIBLE_NRF5340_CPUAPP + select SOC_NRF53_CPUNET_MGMT imply SOC_NRF53_RTC_PRETICK imply SOC_NRF53_ANOMALY_168_WORKAROUND @@ -138,6 +139,12 @@ config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 help hidden option for including the nRF GPIO pin forwarding +config SOC_NRF53_CPUNET_MGMT + bool + select ONOFF + help + hidden option for including the nRF53 network CPU management + if !TRUSTED_EXECUTION_NONSECURE || BUILD_WITH_TFM config SOC_ENABLE_LFXO diff --git a/soc/nordic/nrf53/nrf53_cpunet_mgmt.c b/soc/nordic/nrf53/nrf53_cpunet_mgmt.c new file mode 100644 index 00000000000..57a23d29bb8 --- /dev/null +++ b/soc/nordic/nrf53/nrf53_cpunet_mgmt.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file Nordic Semiconductor nRF53 processors family management helper for the network CPU. + */ + +#include + +#include +#include +#include +#include +#include + +#include + +static struct onoff_manager cpunet_mgr; + +static void onoff_start(struct onoff_manager *mgr, onoff_notify_fn notify) +{ + nrf_reset_network_force_off(NRF_RESET, false); + + notify(mgr, 0); +} + +static void onoff_stop(struct onoff_manager *mgr, onoff_notify_fn notify) +{ + nrf_reset_network_force_off(NRF_RESET, true); + + notify(mgr, 0); +} + +static int nrf53_cpunet_mgmt_init(void) +{ + static const struct onoff_transitions transitions = { + .start = onoff_start, + .stop = onoff_stop + }; + + return onoff_manager_init(&cpunet_mgr, &transitions); +} + +SYS_INIT(nrf53_cpunet_mgmt_init, PRE_KERNEL_1, 0); + +void nrf53_cpunet_enable(bool on) +{ + int ret; + int ignored; + struct onoff_client cli; + + if (on) { + sys_notify_init_spinwait(&cli.notify); + + ret = onoff_request(&cpunet_mgr, &cli); + __ASSERT_NO_MSG(ret >= 0); + + /* The transition is synchronous and shall take effect immediately. */ + ret = sys_notify_fetch_result(&cli.notify, &ignored); + } else { + ret = onoff_release(&cpunet_mgr); + } + + __ASSERT_NO_MSG(ret >= 0); +} diff --git a/soc/nordic/nrf53/nrf53_cpunet_mgmt.h b/soc/nordic/nrf53/nrf53_cpunet_mgmt.h new file mode 100644 index 00000000000..0273061c20c --- /dev/null +++ b/soc/nordic/nrf53/nrf53_cpunet_mgmt.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file Nordic Semiconductor nRF53 processors family management helper for the network CPU. + */ + +#ifndef NRF53_CPUNET_MGMT_H__ +#define NRF53_CPUNET_MGMT_H__ + +#include + +/** + * @brief Enables or disables nRF53 network CPU. + * + * This function shall be used to control the network CPU exclusively. Internally, it keeps track of + * the requests to enable or disable nRF53 network CPU. It guarantees to enable the network CPU if + * at least one user requests it and to keep it enabled until all users release it. + * + * In conseqeuence, if @p on equals @c true then the network CPU is guaranteed to be enabled when + * this function returns. If @p on equals @c false then nothing can be inferred about the state of + * the network CPU when the function returns. + * + * @param on indicates whether the network CPU shall be powered on or off. + */ +void nrf53_cpunet_enable(bool on); + +#endif /* NRF53_CPUNET_MGMT_H__ */ From 955ca269dd22d14c7ae7ed061c0b402547e13834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Wed, 10 Apr 2024 11:51:14 +0200 Subject: [PATCH 1769/2300] [nrf fromtree] boards: nrf53: switch to the network CPU management API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch to the network CPU management API from direct nrfx calls. Signed-off-by: Jędrzej Ciupis (cherry picked from commit 2b23a52642701d2b8f6df6de07c0a2511b28dcc9) --- .../bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c | 4 ++-- .../nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c | 4 ++-- boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c | 4 ++-- boards/nordic/thingy53/board.c | 4 ++-- boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c | 4 ++-- drivers/bluetooth/hci/nrf53_support.c | 6 +++--- samples/subsys/ipc/ipc_service/icmsg/src/main.c | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c b/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c index 49c0e5a1c73..c4f39467314 100644 --- a/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c +++ b/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c @@ -10,7 +10,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(bl5340_dvk_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -50,7 +50,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c index f9082e6ca40..3d08a5dd4cd 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include LOG_MODULE_REGISTER(nrf5340_audio_dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -71,7 +71,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c b/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c index dadba8c0f54..3b85d55dfd0 100644 --- a/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c +++ b/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(nrf5340dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -49,7 +49,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/thingy53/board.c b/boards/nordic/thingy53/board.c index 67059bd4ee8..491808f236a 100644 --- a/boards/nordic/thingy53/board.c +++ b/boards/nordic/thingy53/board.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include LOG_MODULE_REGISTER(thingy53_board_init); @@ -52,7 +52,7 @@ static void enable_cpunet(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c b/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c index bf0626ce30b..cd8281cb2bf 100644 --- a/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c +++ b/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include #if defined(CONFIG_BOARD_PAN1783_EVB_NRF5340_CPUAPP) LOG_MODULE_REGISTER(pan1783_evb_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -42,7 +42,7 @@ static int remoteproc_mgr_boot(void) remoteproc_mgr_config(); /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); diff --git a/drivers/bluetooth/hci/nrf53_support.c b/drivers/bluetooth/hci/nrf53_support.c index 995586eb325..2d0f64ac428 100644 --- a/drivers/bluetooth/hci/nrf53_support.c +++ b/drivers/bluetooth/hci/nrf53_support.c @@ -6,7 +6,7 @@ #include #include -#include +#include #if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) #include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/debug.h> #else @@ -21,7 +21,7 @@ int bt_hci_transport_teardown(const struct device *dev) { ARG_UNUSED(dev); /* Put the Network MCU in Forced-OFF mode. */ - nrf_reset_network_force_off(NRF_RESET, true); + nrf53_cpunet_enable(false); LOG_DBG("Network MCU placed in Forced-OFF mode"); return 0; @@ -43,7 +43,7 @@ int bt_hci_transport_setup(const struct device *dev) #endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); return 0; } diff --git a/samples/subsys/ipc/ipc_service/icmsg/src/main.c b/samples/subsys/ipc/ipc_service/icmsg/src/main.c index 3500b472e7d..d10fa6c8bf6 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/src/main.c +++ b/samples/subsys/ipc/ipc_service/icmsg/src/main.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include "common.h" @@ -130,7 +130,7 @@ int main(void) k_msleep(500); LOG_INF("Stop network core"); - nrf_reset_network_force_off(NRF_RESET, true); + nrf53_cpunet_enable(false); LOG_INF("Reset IPC service"); @@ -158,7 +158,7 @@ int main(void) } LOG_INF("Run network core"); - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); k_sem_take(&bound_sem, K_FOREVER); From 2d2a2e0ae943910f1e005d9709b4df9e0d8b6206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Thu, 11 Apr 2024 08:20:21 +0200 Subject: [PATCH 1770/2300] [nrf fromtree] boards: raytac: remove direct RESET register access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace direct access to RESET register to control the network CPU with dedicated API, which allows safely sharing the network CPU with other users. Signed-off-by: Jędrzej Ciupis (cherry picked from commit 2371dce46bc8fba09438c1c52904d0204cd76aaa) --- .../mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c | 3 ++- .../mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c b/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c index 97ae3fc1bd0..64e335869fb 100644 --- a/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c +++ b/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c @@ -10,6 +10,7 @@ #include #include +#include LOG_MODULE_REGISTER(raytac_mdbt53_db_40_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -49,7 +50,7 @@ static int remoteproc_mgr_boot(const struct device *dev) */ /* Release the Network MCU, 'Release force off signal' */ - NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release; + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c b/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c index fd48ae16fd6..ec4567274c4 100644 --- a/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c +++ b/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c @@ -49,7 +49,7 @@ static int remoteproc_mgr_boot(const struct device *dev) */ /* Release the Network MCU, 'Release force off signal' */ - NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release; + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ From 51c8066bf063263b457ecb3f6f179d80cd0238e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 5 Apr 2024 10:43:41 +0200 Subject: [PATCH 1771/2300] [nrf fromtree] tests: drivers: clock_control: Add nRF54L15 to platform allow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nRF54L15 to platform_allow in the sample.yaml: - clock_control_api, - nrf_clock_calibration, - nrf_lf_clock_start, - onoff. Signed-off-by: Sebastian Głąb (cherry picked from commit 5600ae335b104f6ba088693946ee3e60b63161b9) --- .../clock_control/clock_control_api/testcase.yaml | 2 ++ .../clock_control/nrf_clock_calibration/testcase.yaml | 1 + .../clock_control/nrf_lf_clock_start/testcase.yaml | 9 +++++++++ tests/drivers/clock_control/onoff/testcase.yaml | 1 + 4 files changed, 13 insertions(+) diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index 7a3552fd4e7..356893f400f 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -8,6 +8,7 @@ tests: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf9160dk/nrf9160 + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 drivers.clock.clock_control_nrf5_lfclk_rc: @@ -18,6 +19,7 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_args: CONF_FILE="nrf_lfclk_rc.conf" diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index 2e2934b33ea..e5f1248f5ec 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -7,5 +7,6 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index a5716326ab9..c35d4529722 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -13,6 +13,7 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l15pdk/nrf54l15/cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_STABILITY=y - CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y @@ -27,6 +28,7 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l15pdk/nrf54l15/cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY=y - CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y @@ -41,6 +43,7 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -54,6 +57,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -67,6 +71,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -80,6 +85,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -93,6 +99,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -106,6 +113,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -119,6 +127,7 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index 91239e3b538..867ae2dce40 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -7,6 +7,7 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 + - nrf54l15pdk/nrf54l15/cpuapp - nrf9160dk/nrf9160 integration_platforms: - nrf51dk/nrf51822 From 08dee4bd57722e199e249e4b87b7f9961e3c92de Mon Sep 17 00:00:00 2001 From: Brad Kemp Date: Tue, 2 Apr 2024 13:26:20 -0400 Subject: [PATCH 1772/2300] [nrf fromtree] net: wifi: shell: update wifi ap enable to use get opt parsing The commit 8256d02d3a9625c03e1d584cf54b1f0cc1ae164b introduced getopt parsing for the wifi connect command This needs to be updated for the wifi ap enable since ap enable also uses the same parsing as connect. The use of getopt removes the parameter ordering restrictions Signed-off-by: Brad Kemp (cherry picked from commit 3e2c067010cd26220d66d3237d891f6e4a3ed05e) --- subsys/net/l2/wifi/wifi_shell.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 946a9b1939e..99d49535fa0 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -496,12 +496,8 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv } break; case 'p': - if (secure_connection) { - params->psk = optarg; - params->psk_length = strlen(params->psk); - } else { - PR_WARNING("Passphrase provided without security configuration\n"); - } + params->psk = optarg; + params->psk_length = strlen(params->psk); break; case 'c': channel = strtol(optarg, &endptr, 10); @@ -568,7 +564,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv ¶ms->bssid[4], ¶ms->bssid[5]); break; case 'h': - shell_help(sh); + return -ENOEXEC; break; default: PR_ERROR("Invalid option %c\n", opt); @@ -576,7 +572,9 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv return -EINVAL; } } - + if (params->psk && !secure_connection) { + PR_WARNING("Passphrase provided without security configuration\n"); + } return 0; } @@ -1244,7 +1242,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, int ret; context.sh = sh; - if (__wifi_args_to_params(sh, argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { + if (__wifi_args_to_params(sh, argc, &argv[0], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); return -ENOEXEC; } @@ -1847,15 +1845,18 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, cmd_wifi_ap_disable, 1, 0), SHELL_CMD_ARG(enable, NULL, - "\"\"\n" - "\n" - "[PSK: valid only for secure SSIDs]\n" - "[Security type: valid only for secure SSIDs]\n" + "-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, 6:WEP, 7: WPA-PSK\n" - "[MFP (optional: needs security type to be specified)]\n" - ": 0:Disable, 1:Optional, 2:Required.\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, - 3, 3), + 2, 13), SHELL_CMD_ARG(stations, NULL, "List stations connected to the AP", cmd_wifi_ap_stations, From 73bef57621faa003a733c541fdcd8eeaeed75b44 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Mon, 15 Apr 2024 13:36:31 +0530 Subject: [PATCH 1773/2300] [nrf fromlist] net: wifi: shell: Correct help text for `connect` command Since `NONE` is a valid option for key management in `connect` command, we should remove the part in help text which says: "valid only for secure SSIDs". Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71319 Signed-off-by: Ravi Dondaputi --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 99d49535fa0..bae31b9c3ed 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1905,7 +1905,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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" + "[-k, --key-mgmt]: Key Management type\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n" From da1af7e1288d011b76df72b71334749003ffa95b Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Mon, 15 Apr 2024 17:45:02 +0530 Subject: [PATCH 1774/2300] [nrf fromlist] net: wifi: shell: Remove redundant break Having a `break` statement after `return` is redundant and needs to be removed. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71319 Signed-off-by: Ravi Dondaputi --- 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 bae31b9c3ed..46a2457c6c8 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -565,7 +565,6 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv break; case 'h': return -ENOEXEC; - break; default: PR_ERROR("Invalid option %c\n", opt); shell_help(sh); From 4dd0af500d9911ce3953d29c0eb9cbbba8eefb08 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Wed, 10 Apr 2024 13:00:14 +0200 Subject: [PATCH 1775/2300] [nrf fromtree] boards: nordic: nrf54h20dk: enable HWFC For both UARTs connected to debugger chip. Signed-off-by: Piotr Kosycarz (cherry picked from commit c7c6cb4c99b09a1cdc4686f5f0ef6fe7a0c17d6c) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 1 + 3 files changed, 3 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 8c6512861e8..495271d576b 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -173,4 +173,5 @@ pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; + hw-flow-control; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts index edce1a8b275..679afcdc8f9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts @@ -46,6 +46,7 @@ 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 3efa07f6349..b2f14ff2525 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -69,6 +69,7 @@ pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; + hw-flow-control; }; &uart136 { From b3ec34595efd1462c60b7b811d27f2e745c7ed9a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 15 Apr 2024 17:31:16 +0530 Subject: [PATCH 1776/2300] [nrf fromtree] boards: nrf54h20dk: Enable shell input This enables typing commands in shell over UART. Signed-off-by: Chaitanya Tata (cherry picked from commit c091c944b6caaf4fa0ae79fe8785ed207b6ce39e) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 1 + 3 files changed, 3 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 495271d576b..21a7b9ca7e2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -22,6 +22,7 @@ zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; + zephyr,shell-uart = &uart136; }; aliases { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts index 679afcdc8f9..4cfad97323e 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts @@ -26,6 +26,7 @@ zephyr,code-partition = &cpuppr_code_partition; zephyr,flash = &mram1x; zephyr,sram = &cpuppr_code_data; + zephyr,shell-uart = &uart135; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index b2f14ff2525..a3d3736fde2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -23,6 +23,7 @@ zephyr,code-partition = &cpurad_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; + zephyr,shell-uart = &uart135; }; }; From 443cae032ef887b04063a8d25bf3a26d0acb20b7 Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Mon, 15 Apr 2024 11:52:36 +0200 Subject: [PATCH 1777/2300] [nrf fromlist] boards: nordic: nrf54h20dk: Change IPC default backend Change IPC backend between Application and Radio core to icbmsg which is more future proof than legacy icmsg_me backend. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71492 Signed-off-by: Kamil Gawor (cherry picked from commit dba219bc9c7c9a170c42f04ce0b78011a9f3dfa3) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 3 ++- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index 9c3d971b9bc..539e80d149a 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -21,6 +21,7 @@ }; cpuapp_cpurad_ipc: ipc-2-3 { + compatible = "zephyr,ipc-icbmsg"; status = "disabled"; mboxes = <&cpuapp_bellboard 18>, <&cpurad_bellboard 12>; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 21a7b9ca7e2..f6427f477b2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -111,10 +111,11 @@ }; &cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-initiator"; mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpurad_ipc_shm>; rx-region = <&cpurad_cpuapp_ipc_shm>; + tx-blocks = <32>; + rx-blocks = <32>; }; &cpuapp_cpuppr_ipc { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index a3d3736fde2..2b970a1b3e2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -45,10 +45,11 @@ }; &cpuapp_cpurad_ipc { - compatible = "zephyr,ipc-icmsg-me-follower"; mbox-names = "tx", "rx"; tx-region = <&cpurad_cpuapp_ipc_shm>; rx-region = <&cpuapp_cpurad_ipc_shm>; + tx-blocks = <32>; + rx-blocks = <32>; }; &cpurad_dma_region { From 12bfeea211d9928d0fecfca8b45c42d3a81eafbe Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Mon, 15 Apr 2024 14:05:47 +0200 Subject: [PATCH 1778/2300] [nrf fromlist] boards: nordic: nrf54h20dk: Add configuration for BLE Add default configuration related to BLE protocol, for Application and Radio core on nRF54h20 platform. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71501 Signed-off-by: Kamil Gawor (cherry picked from commit 0fba136786caeb79398de81cd189c4949e4c14ca) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 13 ++++++++- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 13 ++++++++- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 27 ------------------- 3 files changed, 24 insertions(+), 29 deletions(-) delete mode 100644 samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index f6427f477b2..93259180e43 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -23,6 +23,7 @@ zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; zephyr,shell-uart = &uart136; + zephyr,bt-hci-ipc = &ipc0; }; aliases { @@ -93,24 +94,34 @@ status = "okay"; }; +&cpuapp_cpurad_ram0x_region { + status = "okay"; +}; + &shared_ram3x_region { status = "okay"; }; &cpuapp_bellboard { + status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ nordic,interrupt-mapping = <0x00042001 0>; }; +&cpurad_bellboard { + status = "okay"; +}; + &cpusec_cpuapp_ipc { mbox-names = "tx", "rx"; tx-region = <&cpuapp_cpusec_ipc_shm>; rx-region = <&cpusec_cpuapp_ipc_shm>; }; -&cpuapp_cpurad_ipc { +ipc0: &cpuapp_cpurad_ipc { + status = "okay"; mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpurad_ipc_shm>; rx-region = <&cpurad_cpuapp_ipc_shm>; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 2b970a1b3e2..c0b9c0b47b7 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -24,6 +24,7 @@ zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; zephyr,shell-uart = &uart135; + zephyr,bt-hci-ipc = &ipc0; }; }; @@ -31,20 +32,30 @@ status = "okay"; }; +&cpuapp_cpurad_ram0x_region { + status = "okay"; +}; + &cpurad_bellboard { + status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ nordic,interrupt-mapping = <0x00001001 0>; }; +&cpuapp_bellboard { + status = "okay"; +}; + &cpusec_cpurad_ipc { mbox-names = "tx", "rx"; tx-region = <&cpurad_cpusec_ipc_shm>; rx-region = <&cpusec_cpurad_ipc_shm>; }; -&cpuapp_cpurad_ipc { +ipc0: &cpuapp_cpurad_ipc { + status = "okay"; mbox-names = "tx", "rx"; tx-region = <&cpurad_cpuapp_ipc_shm>; rx-region = <&cpuapp_cpurad_ipc_shm>; diff --git a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index 02db7c39272..00000000000 --- a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - chosen { - zephyr,bt-hci-ipc = &ipc0; - }; -}; - -ipc0: &cpuapp_cpurad_ipc { - status = "okay"; -}; - -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - -&cpurad_bellboard { - status = "okay"; -}; - -&cpuapp_bellboard { - status = "okay"; -}; From 2c8aad6f4ed4f550a01b86f935d145b5ad43b4e2 Mon Sep 17 00:00:00 2001 From: Bartosz Sokolski Date: Thu, 11 Apr 2024 11:05:55 +0200 Subject: [PATCH 1779/2300] [nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add twister yaml for PDK 0.3.0 add twister yaml to support PDK 0.3.0 in tests Signed-off-by: Bartosz Sokolski (cherry picked from commit e1ef3e41deccba17f217b1992e6c04ae6151e279) --- .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml new file mode 100644 index 00000000000..a19bc8fdc8b --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml @@ -0,0 +1,20 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54l15pdk@0.3.0/nrf54l15/cpuapp +name: nRF54l15-PDK-nRF54l15-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 256 +flash: 1536 +supported: + - counter + - gpio + - i2c + - spi + - watchdog + - i2s From 85ed6f2655de3528e58e766505a02bbd46dcbeaf Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 9 Apr 2024 15:49:05 +0100 Subject: [PATCH 1780/2300] [nrf fromlist] cmake: modules: extensions: Rename prefix in functions Renames a prefix in a function to avoid clashes with global variable that have the same name Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71280 Signed-off-by: Jamie McCrae (cherry picked from commit 030130573a035f50f0cc931763e4767dd3e8ab3b) --- cmake/modules/extensions.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 4c989e808ae..2c1866c422a 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -2865,9 +2865,9 @@ endfunction() # function(zephyr_file_suffix filename) set(single_args SUFFIX) - cmake_parse_arguments(FILE "" "${single_args}" "" ${ARGN}) + cmake_parse_arguments(SFILE "" "${single_args}" "" ${ARGN}) - if(NOT DEFINED FILE_SUFFIX OR NOT DEFINED ${filename}) + if(NOT DEFINED SFILE_SUFFIX OR NOT DEFINED ${filename}) # If the file suffix variable is not known then there is nothing to do, return early return() endif() @@ -2883,7 +2883,7 @@ function(zephyr_file_suffix filename) # Search for the full stop so we know where to add the file suffix before the file extension cmake_path(GET file EXTENSION file_ext) cmake_path(REMOVE_EXTENSION file OUTPUT_VARIABLE new_filename) - cmake_path(APPEND_STRING new_filename "_${FILE_SUFFIX}${file_ext}") + cmake_path(APPEND_STRING new_filename "_${SFILE_SUFFIX}${file_ext}") # Use the filename with the suffix if it exists, if not then fall back to the default if(EXISTS "${new_filename}") From 77a71701509491a6cf0a220b80537dff08ac304d Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 3 Apr 2024 13:46:16 +0200 Subject: [PATCH 1781/2300] [nrf fromtree] Bluetooth: Controller: Fix regression in BT_RX_STACK_SIZE use Fix regression in BT_RX_STACK_SIZE use due to commit b91728619c05 ("Bluetooth: host: remove `CONFIG_BT_RECV_BLOCKING`"). Profiling of Controller Rx thread has been mentioned in commit 586ba9fd13e8 ("Bluetooth: Controller: Increase BT_RX_STACK_SIZE for BT_HCI_RAW enabled"). Also, move the TX_STACK_SIZE value as default in Kconfig from the explicit value being set in hci_ipc sample. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 7ece6aed16c270ccc6736e815be7cf7c3fd77f50) --- .../hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf | 6 ------ .../hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf | 6 ------ .../hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf | 6 ------ .../hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf | 6 ------ .../nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf | 6 ------ .../nrf5340_cpunet_iso_central-bt_ll_sw_split.conf | 6 ------ .../nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf | 6 ------ .../nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf | 6 ------ samples/bluetooth/peripheral_hr/prj_minimal.conf | 1 - subsys/bluetooth/controller/Kconfig.ll_sw_split | 9 +++++++-- subsys/bluetooth/controller/hci/hci_driver.c | 2 +- subsys/bluetooth/host/Kconfig | 2 +- .../nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf | 6 ------ 13 files changed, 9 insertions(+), 59 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 f0a22f760f9..6b407a208f7 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 @@ -24,12 +24,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y 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 7fab285f3be..6dd49214caa 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 @@ -24,12 +24,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=n 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 21d4a042ad7..ab87866b19a 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 @@ -24,12 +24,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=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 f80f324be53..0bb34dfa790 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 @@ -25,12 +25,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=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 74dc735c076..12f3b8a1147 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 @@ -16,12 +16,6 @@ CONFIG_BT_HCI_RAW_RESERVE=1 # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - # Host CONFIG_BT_BROADCASTER=y CONFIG_BT_PERIPHERAL=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 f29917aaf93..e7ec0c140d6 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 @@ -21,12 +21,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - # Host CONFIG_BT_BROADCASTER=n CONFIG_BT_PERIPHERAL=n 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 ddd7d7e7b31..fa3d303604e 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 @@ -21,12 +21,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - # Host CONFIG_BT_BROADCASTER=y CONFIG_BT_PERIPHERAL=y 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 d88aa87f8aa..d139e83996a 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 @@ -16,12 +16,6 @@ CONFIG_BT_HCI_RAW_RESERVE=1 # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - # Host CONFIG_BT_BROADCASTER=n CONFIG_BT_PERIPHERAL=n diff --git a/samples/bluetooth/peripheral_hr/prj_minimal.conf b/samples/bluetooth/peripheral_hr/prj_minimal.conf index 888c75d8a5d..a9feeb48cb0 100644 --- a/samples/bluetooth/peripheral_hr/prj_minimal.conf +++ b/samples/bluetooth/peripheral_hr/prj_minimal.conf @@ -69,7 +69,6 @@ CONFIG_ARM_MPU=n # idle 00 : STACK: unused 208 usage 48 / 256 (18 %); CPU: 97 % # main : STACK: unused 576 usage 448 / 1024 (43 %); CPU: 0 % CONFIG_BT_RX_STACK_SIZE=1024 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y CONFIG_BT_HCI_TX_STACK_SIZE=640 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index ba43622604a..bce9b76186f 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -99,10 +99,15 @@ config BT_CTLR_ULL_LLL_PRIO_SUPPORT bool config BT_CTLR_RX_PRIO_STACK_SIZE - # Controller's Co-Operative high priority Rx thread stack size. - int "High priority Rx thread stack size" + # Hidden, Controller's Co-Operative high priority Rx thread stack size. + int default 448 +config BT_CTLR_RX_STACK_SIZE + # Hidden, Controller's Co-Operative Rx thread stack size. + int + default 768 + config BT_CTLR_SETTINGS bool "Settings System" depends on SETTINGS diff --git a/subsys/bluetooth/controller/hci/hci_driver.c b/subsys/bluetooth/controller/hci/hci_driver.c index cc315a99df6..9c66594bcda 100644 --- a/subsys/bluetooth/controller/hci/hci_driver.c +++ b/subsys/bluetooth/controller/hci/hci_driver.c @@ -73,7 +73,7 @@ struct k_thread prio_recv_thread_data; static K_KERNEL_STACK_DEFINE(prio_recv_thread_stack, CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE); struct k_thread recv_thread_data; -static K_KERNEL_STACK_DEFINE(recv_thread_stack, CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE); +static K_KERNEL_STACK_DEFINE(recv_thread_stack, CONFIG_BT_CTLR_RX_STACK_SIZE); #if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL) static struct k_poll_signal hbuf_signal; diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 0be375007ca..1753c7a2d6a 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -48,7 +48,7 @@ config BT_HCI_TX_STACK_SIZE default 512 if BT_H4 default 512 if BT_H5 default 416 if BT_SPI - default 940 if BT_CTLR && BT_LL_SW_SPLIT && (NO_OPTIMIZATIONS || BT_ISO_BROADCAST) + default 1152 if BT_CTLR && BT_LL_SW_SPLIT && (NO_OPTIMIZATIONS || BT_ISO_BROADCAST) default 1024 if BT_CTLR && BT_LL_SW_SPLIT && BT_CENTRAL default 768 if BT_CTLR && BT_LL_SW_SPLIT default 512 if BT_USERCHAN 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 a3c8f43c71f..4a53b153a5c 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 @@ -25,12 +25,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Tx/Rx Thread Stack Sizes -CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y -CONFIG_BT_HCI_TX_STACK_SIZE=1152 -CONFIG_BT_RX_STACK_SIZE=640 -CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 - # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y From 12f0521d1fcaafc39f96e6804536b584644db433 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 12 Apr 2024 11:49:02 +0200 Subject: [PATCH 1782/2300] [nrf fromlist] soc/nordic/comomn: Added HAS_HW_NRF_GPIO2 Added Kconfig indicator boolean for HW instance of GPIO2. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71425 Signed-off-by: Andrzej Puzdrowski (cherry picked from commit cc1de21afbd706b8953cb3301d8eebbc22992816) --- soc/nordic/common/Kconfig.peripherals | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index bc79b63d1d8..817002f7282 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -74,6 +74,9 @@ config HAS_HW_NRF_GPIO0 config HAS_HW_NRF_GPIO1 def_bool $(dt_nodelabel_enabled_with_compat,gpio1,$(DT_COMPAT_NORDIC_NRF_GPIO)) +config HAS_HW_NRF_GPIO2 + def_bool $(dt_nodelabel_enabled_with_compat,gpio2,$(DT_COMPAT_NORDIC_NRF_GPIO)) + config HAS_HW_NRF_GPIOTE0 def_bool $(dt_nodelabel_enabled_with_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) From d39eff89a3ced3a9fdbdb5ad4d7cb513a9628ac7 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Tue, 16 Apr 2024 19:13:37 +0530 Subject: [PATCH 1783/2300] [nrf fromlist] wifi: shell: Support WPA auto personal security mode Applications need to run a scan to identify the security mode before attempting the connection which adds to the time taken for connection to be established. To avoid the initial scan, support auto security mode which will enable STA to choose between WPA, WPA2 and WPA3, based on the network configuration. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71044 Signed-off-by: Ravi Dondaputi (cherry picked from commit e9375df78af4ce0589ed8651a500c5d45617fdf2) --- include/zephyr/net/wifi.h | 2 ++ subsys/net/l2/wifi/wifi_mgmt.c | 3 ++- subsys/net/l2/wifi/wifi_shell.c | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index a0840a2319a..ebfc76d2192 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -49,6 +49,8 @@ enum wifi_security_type { WIFI_SECURITY_TYPE_WEP, /** WPA-PSK security. */ WIFI_SECURITY_TYPE_WPA_PSK, + /** WPA/WPA2/WPA3 PSK security. */ + WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL, __WIFI_SECURITY_TYPE_AFTER_LAST, WIFI_SECURITY_TYPE_MAX = __WIFI_SECURITY_TYPE_AFTER_LAST - 1, diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 72552d371d7..51e76aec5fb 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -275,7 +275,8 @@ static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, (params->ssid_length == 0U) || ((params->security == WIFI_SECURITY_TYPE_PSK || params->security == WIFI_SECURITY_TYPE_WPA_PSK || - params->security == WIFI_SECURITY_TYPE_PSK_SHA256) && + params->security == WIFI_SECURITY_TYPE_PSK_SHA256 || + params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) && ((params->psk_length < 8) || (params->psk_length > 64) || (params->psk_length == 0U) || !params->psk)) || ((params->security == WIFI_SECURITY_TYPE_SAE) && diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 46a2457c6c8..954b6aecc07 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1904,8 +1904,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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\n" - "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" + "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n" + "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP," + " 7: WPA-PSK, 8: WPA-Auto-Personal\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n" "[-m, --bssid]: MAC address of the AP (BSSID).\n" From 7b8fb26cbfc35eb142438a957906d29a2f13c749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 9 Apr 2024 11:21:16 +0200 Subject: [PATCH 1784/2300] [nrf fromtree] manifest: Update hal_nordic fix nrfx_uarte fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update hal nordic with fixes in the driver and MDK (EasyDMA UARTE MAXCNT). Signed-off-by: Krzysztof Chruściński (cherry picked from commit 3163f24a11887f203da0a2d7760f398cca05b612) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 9fdaa6b2be8..39252a3dfa4 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: fc2bab706f195c64d40016c9855b8acd7c235ded + revision: f8e4d73a78316ea9ef85f09f24a3a229e40c1a80 path: modules/hal/nordic groups: - hal From 2ace1ea2ce5019cb8a5024c73e4456c44b8fd885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 4 Apr 2024 15:07:45 +0200 Subject: [PATCH 1785/2300] [nrf fromtree] drivers: serial: nrfx_uarte2: Clean error state on rx_enable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clean error state on re-enabling RX. If previous transmission ended with an error it should not impact next receiving session. Signed-off-by: Krzysztof Chruściński (cherry picked from commit d27842c9536e62fb21bc49bd425928e35d2af849) --- drivers/serial/uart_nrfx_uarte2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index 0b8350714eb..ebe85448cea 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -506,6 +506,7 @@ static int api_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int * flags are already known to the driver (e.g. if flushed data shall be * kept or not). */ + adata->err = 0; adata->en_rx_buf = buf; adata->en_rx_len = len; From 7b3063a1d9877af7ac2d25385793d0765452691c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 8 Apr 2024 17:23:01 +0200 Subject: [PATCH 1786/2300] [nrf fromtree] drivers: serial: uart_async_rx: Fix uart_async_rx_reset function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing fields clearing to the resetting function. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 8f89013789a86a43941e4cf342d9cf7482b768fd) --- drivers/serial/uart_async_rx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/serial/uart_async_rx.c b/drivers/serial/uart_async_rx.c index 7c51a6cd251..8ee3fc54af1 100644 --- a/drivers/serial/uart_async_rx.c +++ b/drivers/serial/uart_async_rx.c @@ -126,6 +126,9 @@ void uart_async_rx_reset(struct uart_async_rx *rx_data) { rx_data->free_buf_cnt = rx_data->config->buf_cnt; rx_data->rd_idx = 0; + rx_data->rd_buf_idx = 0; + rx_data->drv_buf_idx = 0; + rx_data->pending_bytes = 0; for (uint8_t i = 0; i < rx_data->config->buf_cnt; i++) { buf_reset(get_buf(rx_data, i)); } From 0fb3fdcedb1db19f7899cf8a1a50c2d9651fbdaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 9 Apr 2024 07:55:19 +0200 Subject: [PATCH 1787/2300] [nrf fromtree] tests: drivers: uart: uart_pm: Limit scope for nrf54l15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some configurations which are not valid for nrf54l15. Mainly those which are using ENHANCED_POLL_OUT option which is not applicable for nrf54l15 because it has ENDTX_STOPTX short so PPI connection is not needed. Signed-off-by: Krzysztof Chruściński (cherry picked from commit c72b6a75ba17d1216dd2d389e66566989667fb2e) --- tests/drivers/uart/uart_pm/testcase.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index f90eed73949..355bb3c4282 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -5,6 +5,7 @@ common: harness: ztest platform_allow: - nrf52840dk/nrf52840 + - nrf54l15pdk/nrf54l15/cpuapp - nrf52_bsim harness_config: fixture: gpio_loopback @@ -24,6 +25,8 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=n - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" + platform_exclude: + - nrf54l15pdk/nrf54l15/cpuapp drivers.uart.pm.enhanced_poll: extra_configs: @@ -31,6 +34,8 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y + platform_exclude: + - nrf54l15pdk/nrf54l15/cpuapp drivers.uart.pm.int_driven: extra_configs: @@ -47,6 +52,8 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y + platform_exclude: + - nrf54l15pdk/nrf54l15/cpuapp drivers.uart.pm.async: extra_configs: @@ -69,3 +76,5 @@ tests: - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y + platform_exclude: + - nrf54l15pdk/nrf54l15/cpuapp From f77e4e98908a2bc02cdbaa956f0a52b96e42c595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 9 Apr 2024 09:59:26 +0200 Subject: [PATCH 1788/2300] [nrf fromtree] tests: drivers: uart: uart_pm: Add support for nrf54h20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration for nrf54h20dk. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 8e65ed94cb0563a6ec8ee651576a49ef0e380fb3) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 31 +++++++++++++++++++ tests/drivers/uart/uart_pm/testcase.yaml | 5 +++ 2 files changed, 36 insertions(+) create mode 100644 tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..d01ebce4c8a --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 355bb3c4282..c7c7b803442 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 - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim harness_config: fixture: gpio_loopback @@ -27,6 +28,7 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" platform_exclude: - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp drivers.uart.pm.enhanced_poll: extra_configs: @@ -36,6 +38,7 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp drivers.uart.pm.int_driven: extra_configs: @@ -54,6 +57,7 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp drivers.uart.pm.async: extra_configs: @@ -78,3 +82,4 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp From e51431446b8c5b324a04beed4681529d64ccdef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 4 Apr 2024 10:24:12 +0200 Subject: [PATCH 1789/2300] [nrf fromlist] tests: drivers: uart: async_api: Add nrf54h20 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlays for nrf54h20dk. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71260 Signed-off-by: Krzysztof Chruściński (cherry picked from commit b10fd761ce2e5e847e4cfc132c2f4e828c75cb7a) --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 25 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 11 ++++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 11 ++++++++ 3 files changed, 47 insertions(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay 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 new file mode 100644 index 00000000000..172d75904e4 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; 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 new file mode 100644 index 00000000000..a8fe36d37bb --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&cpuapp_dma_region { + status = "okay"; +}; + +&dut { + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 00000000000..32f95625201 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&cpurad_dma_region { + status = "okay"; +}; + +&dut { + memory-regions = <&cpurad_dma_region>; +}; From 16458fffeed93fdd45432c636ebf193b82041606 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Fri, 5 Apr 2024 11:51:47 +0200 Subject: [PATCH 1790/2300] [nrf fromtree] drivers: Extend coverage for UARTE driver Add more test cases for UARTE driver API Signed-off-by: Bartosz Miller (cherry picked from commit 211477f87401dfe57603e725e0332baf41cff082) --- .../uart/uart_elementary/CMakeLists.txt | 10 + tests/drivers/uart/uart_elementary/Kconfig | 11 + tests/drivers/uart/uart_elementary/README.txt | 13 + .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 + .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 32 ++ .../boards/nrf54h20dk_nrf54h20_common.dtsi | 37 ++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 3 + ...f54h20dk_nrf54h20_cpuapp_dual_uart.overlay | 56 +++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 31 ++ ...54l15pdk_nrf54l15_cpuapp_dual_uart.overlay | 51 +++ tests/drivers/uart/uart_elementary/prj.conf | 6 + tests/drivers/uart/uart_elementary/src/main.c | 322 ++++++++++++++++++ .../uart/uart_elementary/testcase.yaml | 35 ++ 13 files changed, 608 insertions(+) create mode 100644 tests/drivers/uart/uart_elementary/CMakeLists.txt create mode 100644 tests/drivers/uart/uart_elementary/Kconfig create mode 100644 tests/drivers/uart/uart_elementary/README.txt create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay create mode 100644 tests/drivers/uart/uart_elementary/prj.conf create mode 100644 tests/drivers/uart/uart_elementary/src/main.c create mode 100644 tests/drivers/uart/uart_elementary/testcase.yaml diff --git a/tests/drivers/uart/uart_elementary/CMakeLists.txt b/tests/drivers/uart/uart_elementary/CMakeLists.txt new file mode 100644 index 00000000000..59b31ee68a9 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/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(uart_high_level_api) + +target_sources(app PRIVATE + src/main.c + ) diff --git a/tests/drivers/uart/uart_elementary/Kconfig b/tests/drivers/uart/uart_elementary/Kconfig new file mode 100644 index 00000000000..aed523c5832 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/Kconfig @@ -0,0 +1,11 @@ +# UART test configuration options +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config DUAL_UART_TEST + bool "Enable dual UART test" + +config SETUP_MISMATCH_TEST + bool "Enable mismatched configuration in dual UART test" + +source "Kconfig.zephyr" diff --git a/tests/drivers/uart/uart_elementary/README.txt b/tests/drivers/uart/uart_elementary/README.txt new file mode 100644 index 00000000000..5af85beff46 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/README.txt @@ -0,0 +1,13 @@ +The purpose of this test is to validate basic UART driver functions, +that are not tested elsewhere. +UART interrupt mode is used for the tests purpose. + +Hardware setup required for these tests: +For single uart conviguration - UART0 TX connected to RX and CTS to RTS +For dual uart configuratiom - UART0 and UART1 TXs and RXs cross-connected + +These test cases cover: +- UART configuration, +- UART error check, +- UART callback setup, +- Dual UART transmission with matched and mismatched configurations diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000..064e78b6f74 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000..f98f3657f13 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart1_default_alt: uart1_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + uart1_sleep_alt: uart1_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart1 { + current-speed = <115200>; + compatible = "nordic,nrf-uarte"; + status = "okay"; + pinctrl-0 = <&uart1_default_alt>; + pinctrl-1 = <&uart1_sleep_alt>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi new file mode 100644 index 00000000000..22d8378937c --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&cpuapp_dma_region { + status="okay"; +}; + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; + hw-flow-control; + +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..f65b4dd3b0b --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay new file mode 100644 index 00000000000..23c36ee8974 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + + +&pinctrl { + uart135_default_alt: uart135_default_alt { + group1 { + psels = , + ; + }; + }; + + uart135_sleep_alt: uart135_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart135 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart135_default_alt>; + pinctrl-1 = <&uart135_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; + +&pinctrl { + uart137_default_alt: uart137_default_alt { + group1 { + psels = , + ; + }; + }; + + uart137_sleep_alt: uart137_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut_aux: &uart137 { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; + pinctrl-0 = <&uart137_default_alt>; + pinctrl-1 = <&uart137_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..cf481b7a161 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + , + , + ; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; + hw-flow-control; +}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay new file mode 100644 index 00000000000..2031f7a2444 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default: uart21_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart21_sleep: uart21_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart22_default: uart22_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + uart22_sleep: uart22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart21_default>; + pinctrl-1 = <&uart21_sleep>; + pinctrl-names = "default", "sleep"; +}; + +dut_aux: &uart22 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart22_default>; + pinctrl-1 = <&uart22_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/uart/uart_elementary/prj.conf b/tests/drivers/uart/uart_elementary/prj.conf new file mode 100644 index 00000000000..26c93d320a7 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/prj.conf @@ -0,0 +1,6 @@ +CONFIG_SERIAL=y +CONFIG_ZTEST=y +CONFIG_TEST_USERSPACE=y +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_UART_USE_RUNTIME_CONFIGURE=y +CONFIG_UART_INTERRUPT_DRIVEN=y diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c new file mode 100644 index 00000000000..d7d85ee9542 --- /dev/null +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @addtogroup t_driver_uart + * @{ + * @defgroup t_uart_elementary test_uart_elementary + * @} + */ + +#include +#include + +#if DT_NODE_EXISTS(DT_NODELABEL(dut)) +#define UART_NODE DT_NODELABEL(dut) +#else +#define UART_NODE DT_CHOSEN(zephyr_console) +#endif + +#if DT_NODE_EXISTS(DT_NODELABEL(dut_aux)) +#define UART_NODE_AUX DT_NODELABEL(dut_aux) +#else +#define UART_NODE_AUX DT_CHOSEN(zephyr_console) +#endif + +#define SLEEP_TIME_US 1000 +#define TEST_BUFFER_LEN 10 + +static const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE); + +const uint8_t test_pattern[TEST_BUFFER_LEN] = { 0x11, 0x12, 0x13, 0x14, 0x15, + 0x16, 0x17, 0x18, 0x19, 0x20 }; +static uint8_t test_buffer[TEST_BUFFER_LEN]; +static volatile uint8_t uart_error_counter; + +#if defined(CONFIG_DUAL_UART_TEST) +static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); +static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; +static volatile uint8_t aux_uart_error; +#endif + +/* + * ISR for UART TX action + */ +static void uart_tx_interrupt_service(const struct device *dev, int *tx_byte_offset) +{ + uint8_t bytes_sent = 0; + uint8_t *tx_data_pointer = (uint8_t *)(test_pattern + *tx_byte_offset); + + if (*tx_byte_offset < TEST_BUFFER_LEN) { + bytes_sent = uart_fifo_fill(dev, tx_data_pointer, 1); + *tx_byte_offset += bytes_sent; + } else { + *tx_byte_offset = 0; + uart_irq_tx_disable(dev); + } +} + +/* + * ISR for UART RX action + */ +static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive_buffer_pointer, + int *rx_byte_offset) +{ + int rx_data_length = 0; + int bytes_received = 0; + + do { + rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, + TEST_BUFFER_LEN); + bytes_received += rx_data_length; + } while (rx_data_length); + *rx_byte_offset += bytes_received; +} + +/* + * Callback function for MAIN UART interrupt based transmission test + */ +static void interrupt_driven_uart_callback_main_uart(const struct device *dev, void *user_data) +{ + int err; + static int tx_byte_offset; + static int rx_byte_offset; + + uart_irq_update(dev); + err = uart_err_check(dev); + if (err != 0) { + uart_error_counter++; + } + while (uart_irq_is_pending(dev)) { + if (uart_irq_rx_ready(dev)) { + uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset); + } + if (uart_irq_tx_ready(dev)) { + uart_tx_interrupt_service(dev, &tx_byte_offset); + } + } +} + +#if defined(CONFIG_DUAL_UART_TEST) +/* + * Callback function for AUX UART interrupt based transmission test + */ +static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, void *user_data) +{ + int err; + static int tx_byte_offset_aux; + static int rx_byte_offset_aux; + + uart_irq_update(dev); + err = uart_err_check(dev); +#if !defined(CONFIG_COVERAGE) + /* This assetion will fail with coverge enabled + * When in coverage mode it has no impact on test case execution + */ + zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); +#endif /* CONFIG_COVERAGE */ + while (uart_irq_is_pending(dev)) { + if (uart_irq_rx_ready(dev)) { + uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); + } + if (uart_irq_tx_ready(dev)) { + uart_tx_interrupt_service(dev, &tx_byte_offset_aux); + } + } +} +#endif /* CONFIG_DUAL_UART_TEST */ + +/* + * Test UART proper configuration call + */ +ZTEST(uart_elementary, test_uart_proper_configuration) +{ + Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); + + int err; + struct uart_config test_expected_uart_config; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; + + err = uart_configure(uart_dev, &test_uart_config); + zassert_equal(err, 0, "'uart_configure' api call - unexpected error: %d", err); + + err = uart_config_get(uart_dev, &test_expected_uart_config); + zassert_equal(err, 0, "'uart_config_get' api call - unexpected error raised : %d", err); + + zassert_equal(test_uart_config.baudrate, test_expected_uart_config.baudrate, + "Set and actual UART config baudrate mismatch: %d != %d", + test_uart_config.baudrate, test_expected_uart_config.baudrate); + + zassert_equal(test_uart_config.parity, test_expected_uart_config.parity, + "Set and actual UART config parity mismatch: %d != %d", + test_uart_config.parity, test_expected_uart_config.parity); + + zassert_equal(test_uart_config.stop_bits, test_expected_uart_config.stop_bits, + "Set and actual UART config stop_bits mismatch: %d != %d", + test_uart_config.stop_bits, test_expected_uart_config.stop_bits); + + zassert_equal(test_uart_config.data_bits, test_expected_uart_config.data_bits, + "Set and actual UART config data_bits mismatch: %d != %d", + test_uart_config.data_bits, test_expected_uart_config.data_bits); + + zassert_equal(test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl, + "Set and actual UART config flow_ctrl mismatch: %d != %d", + test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl); +} + +/* + * Test UART improper configuration call + */ +ZTEST(uart_elementary, test_uart_improper_configuration) +{ + Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); + + int err; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = 7, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; + + err = uart_configure(uart_dev, &test_uart_config); + zassert_not_equal( + err, 0, + "'uart_configure' with incorrect configuration havent't raised an error, err=%d", + err); +} + +#if !defined(CONFIG_DUAL_UART_TEST) +/* + * Test UART basic interrupt based transmission (with loopback) + */ +ZTEST(uart_elementary, test_uart_basic_transmission) +{ + int err; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = UART_CFG_PARITY_ODD, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; + + err = uart_configure(uart_dev, &test_uart_config); + zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); + + err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); + zassert_equal(err, 0, "Unexpected error when setting callback %d", err); + err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, + (void *)test_buffer); + zassert_equal(err, 0, "Unexpected error when setting user data for callback %d", err); + uart_irq_err_enable(uart_dev); + uart_irq_rx_enable(uart_dev); + uart_irq_tx_enable(uart_dev); + + /* wait for the tramission to finish (no polling is intentional) */ + k_sleep(K_USEC(100 * SLEEP_TIME_US)); + + uart_irq_tx_disable(uart_dev); + uart_irq_rx_disable(uart_dev); + uart_irq_err_disable(uart_dev); + for (int index = 0; index < TEST_BUFFER_LEN; index++) { + zassert_equal(test_buffer[index], test_pattern[index], + "Recieived data byte %d does not match pattern 0x%x != 0x%x", index, + test_buffer[index], test_pattern[index]); + } +} +#else +/* + * Test UART interrupt based transmission between two ports + */ +ZTEST(uart_elementary, test_uart_dual_port_transmission) +{ + int err; + struct uart_config test_uart_config = { .baudrate = 115200, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; + +#if defined(CONFIG_SETUP_MISMATCH_TEST) + struct uart_config test_uart_config_aux = { .baudrate = 9600, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, + .data_bits = UART_CFG_DATA_BITS_8, + .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; +#endif + err = uart_configure(uart_dev, &test_uart_config); + zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); + +#if defined(CONFIG_SETUP_MISMATCH_TEST) + err = uart_configure(uart_dev_aux, &test_uart_config_aux); +#else + err = uart_configure(uart_dev_aux, &test_uart_config); +#endif + + zassert_equal(err, 0, "Unexpected error when configuring UART1: %d", err); + + err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); + zassert_equal(err, 0, "Unexpected error when setting callback for UART0 %d", err); + err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, + (void *)test_buffer); + zassert_equal(err, 0, "Unexpected error when setting user data for UART0 callback %d", err); + + err = uart_irq_callback_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart); + zassert_equal(err, 0, "Unexpected error when setting callback for UART1 %d", err); + err = uart_irq_callback_user_data_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart, + (void *)test_buffer_aux); + zassert_equal(err, 0, "Unexpected error when setting user data for UART1 callback %d", err); + + uart_irq_err_enable(uart_dev); + uart_irq_err_enable(uart_dev_aux); + + uart_irq_tx_enable(uart_dev); + uart_irq_tx_enable(uart_dev_aux); + + uart_irq_rx_enable(uart_dev); + uart_irq_rx_enable(uart_dev_aux); + + /* wait for the tramission to finish (no polling is intentional) */ + k_sleep(K_USEC(100 * SLEEP_TIME_US)); + + uart_irq_tx_disable(uart_dev); + uart_irq_tx_disable(uart_dev_aux); + uart_irq_rx_disable(uart_dev); + uart_irq_rx_disable(uart_dev_aux); + uart_irq_err_disable(uart_dev); + uart_irq_err_disable(uart_dev_aux); + +#if defined(CONFIG_SETUP_MISMATCH_TEST) + zassert_not_equal(uart_error_counter, 0); +#else + for (int index = 0; index < TEST_BUFFER_LEN; index++) { + zassert_equal(test_buffer[index], test_pattern[index], + "UART0 recieived data byte %d does not match pattern 0x%x != 0x%x", + index, test_buffer[index], test_pattern[index]); + zassert_equal(test_buffer_aux[index], test_pattern[index], + "UART1 recieived data byte %d does not match pattern 0x%x != 0x%x", + index, test_buffer_aux[index], test_pattern[index]); + } +#endif /* CONFIG_SETUP_MISMATCH_TEST */ +} +#endif /* CONFIG_DUAL_UART_TEST */ + +/* + * Test setup + */ +void *test_setup(void) +{ + zassert_true(device_is_ready(uart_dev), "UART0 device is not ready"); +#if defined(CONFIG_DUAL_UART_TEST) + zassert_true(device_is_ready(uart_dev_aux), "UART1 device is not ready"); +#endif + + return NULL; +} + +ZTEST_SUITE(uart_elementary, NULL, test_setup, NULL, NULL, NULL); diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml new file mode 100644 index 00000000000..7c06967e7ad --- /dev/null +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -0,0 +1,35 @@ +common: + tags: drivers uart + depends_on: gpio + harness: ztest + harness_config: + fixture: gpio_loopback +tests: + drivers.uart.uart_elementary: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15pdk/nrf54l15/cpuapp + - nrf5340dk/nrf5340/cpuapp + drivers.uart.uart_elementary_dual_nrf54h: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + drivers.uart.uart_elementary_dual_setup_mismatch_nrf54h: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + - CONFIG_SETUP_MISMATCH_TEST=y + drivers.uart.uart_elementary_dual_nrf54l: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54l15pdk/nrf54l15/cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y From 6498044123c17077106d4ae9c2dc605e065cb85a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 17 Apr 2024 17:49:34 +0200 Subject: [PATCH 1791/2300] [nrf fromtree] tests: drivers: uart: uart_elementary: Fix RX handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rx_byte_offset was wrongly updated which could lead to test failures. Signed-off-by: Krzysztof Chruściński (cherry picked from commit b36550b8a509eb30b5524b56d4cf3fcea4c87dd2) --- tests/drivers/uart/uart_elementary/src/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index d7d85ee9542..1c4df3273a7 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -66,14 +66,12 @@ static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive int *rx_byte_offset) { int rx_data_length = 0; - int bytes_received = 0; do { rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, TEST_BUFFER_LEN); - bytes_received += rx_data_length; + *rx_byte_offset += rx_data_length; } while (rx_data_length); - *rx_byte_offset += bytes_received; } /* From 51407a9bf1e44777d124bfe1f3b9c373c0832d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 23 Jan 2024 11:46:02 +0100 Subject: [PATCH 1792/2300] [nrf fromtree] tests: drivers: spi: Add test for SPI master and slave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add test which is using one SPI master and one SPI slave instance. There is already a loopback test for SPI master so this test is focusing on SPI slave API. Test requires 4 pairs of GPIO pins shortened together. One set of pins is used by SPI master and one for SPI slave. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 1cd7f5150708ef066bbd679ac1f58f42a2b647be) --- tests/drivers/spi/spi_slave/CMakeLists.txt | 10 + .../boards/nrf52840dk_nrf52840.overlay | 67 +++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 73 +++ tests/drivers/spi/spi_slave/prj.conf | 6 + tests/drivers/spi/spi_slave/src/main.c | 452 ++++++++++++++++++ tests/drivers/spi/spi_slave/testcase.yaml | 10 + 6 files changed, 618 insertions(+) create mode 100644 tests/drivers/spi/spi_slave/CMakeLists.txt create mode 100644 tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_slave/prj.conf create mode 100644 tests/drivers/spi/spi_slave/src/main.c create mode 100644 tests/drivers/spi/spi_slave/testcase.yaml diff --git a/tests/drivers/spi/spi_slave/CMakeLists.txt b/tests/drivers/spi/spi_slave/CMakeLists.txt new file mode 100644 index 00000000000..f9f7a6bdae4 --- /dev/null +++ b/tests/drivers/spi/spi_slave/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(spi_slave) + +FILE(GLOB app_sources src/*.c) + +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000..477917e0ca7 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi3_default_alt: spi3_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi3_sleep_alt: spi3_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi1_sleep_alt: spi1_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + +&spi3 { + status = "okay"; + pinctrl-0 = <&spi3_default_alt>; + pinctrl-1 = <&spi3_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <4000000>; + }; +}; + +dut_spis: &spi1 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-1 = <&spi1_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..d431f278337 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi22_default_alt: spi22_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi22_sleep_alt: spi22_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi21_default_alt: spi21_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi21_sleep_alt: spi21_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + +&gpio2 { + status = "okay"; +}; + +&spi22 { + status = "okay"; + pinctrl-0 = <&spi22_default_alt>; + pinctrl-1 = <&spi22_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <4000000>; + }; +}; + +dut_spis: &spi21 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi21_default_alt>; + pinctrl-1 = <&spi21_sleep_alt>; + pinctrl-names = "default", "sleep"; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; diff --git a/tests/drivers/spi/spi_slave/prj.conf b/tests/drivers/spi/spi_slave/prj.conf new file mode 100644 index 00000000000..840a8f87d9a --- /dev/null +++ b/tests/drivers/spi/spi_slave/prj.conf @@ -0,0 +1,6 @@ +CONFIG_SPI=y +CONFIG_SPI_SLAVE=y +CONFIG_GPIO=y +CONFIG_POLL=y +CONFIG_SPI_ASYNC=y +CONFIG_ZTEST=y diff --git a/tests/drivers/spi/spi_slave/src/main.c b/tests/drivers/spi/spi_slave/src/main.c new file mode 100644 index 00000000000..7a6ca1b7545 --- /dev/null +++ b/tests/drivers/spi/spi_slave/src/main.c @@ -0,0 +1,452 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#define SPI_MODE (SPI_MODE_CPOL | SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE) +#define SPIM_OP (SPI_OP_MODE_MASTER | SPI_MODE) +#define SPIS_OP (SPI_OP_MODE_SLAVE | SPI_MODE) + +static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); +static const struct device *spis_dev = DEVICE_DT_GET(DT_NODELABEL(dut_spis)); +static const struct spi_config spis_config = { + .operation = SPIS_OP +}; + +static struct k_poll_signal async_sig = K_POLL_SIGNAL_INITIALIZER(async_sig); +static struct k_poll_event async_evt = + K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &async_sig); + +#define MEMORY_SECTION(node) \ + COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ + (__attribute__((__section__( \ + LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ + ()) + +static uint8_t spim_buffer[32] MEMORY_SECTION(DT_BUS(DT_NODELABEL(dut_spi_dt))); +static uint8_t spis_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spis)); + +struct test_data { + struct k_work_delayable test_work; + struct k_sem sem; + int spim_alloc_idx; + int spis_alloc_idx; + struct spi_buf_set sets[4]; + struct spi_buf_set *mtx_set; + struct spi_buf_set *mrx_set; + struct spi_buf_set *stx_set; + struct spi_buf_set *srx_set; + struct spi_buf bufs[8]; +}; + +static struct test_data tdata; + +/* Allocate buffer from spim or spis space. */ +static uint8_t *buf_alloc(size_t len, bool spim) +{ + int *idx = spim ? &tdata.spim_alloc_idx : &tdata.spis_alloc_idx; + uint8_t *buf = spim ? spim_buffer : spis_buffer; + size_t total = spim ? sizeof(spim_buffer) : sizeof(spis_buffer); + uint8_t *rv; + + if (*idx + len > total) { + zassert_false(true); + + return NULL; + } + + rv = &buf[*idx]; + *idx += len; + + return rv; +} + +static void work_handler(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct test_data *td = CONTAINER_OF(dwork, struct test_data, test_work); + int rv; + + rv = spi_transceive_dt(&spim, td->mtx_set, td->mrx_set); + if (rv == 0) { + k_sem_give(&td->sem); + } +} + +/** Copies data from buffers in the set to a single buffer which makes it easier + * to compare transmitted and received data. + * + * @param buf Output buffer. + * @param len Buffer length. + * @param set Set of buffers. + * + * @return Number of bytes copied. + */ +static int cpy_data(uint8_t *buf, size_t len, struct spi_buf_set *set) +{ + int idx = 0; + + for (size_t i = 0; i < set->count; i++) { + size_t l = set->buffers[i].len; + + if (len - idx >= l) { + memcpy(&buf[idx], set->buffers[i].buf, l); + idx += l; + } else { + return -1; + } + } + + return idx; +} + +/** Compare two sets. + * + * @param tx_set TX set. + * @param rx_set RX set. + * @param same_size True if it is expected to have the same amount of data in both sets. + * + * @return 0 if data is the same and other value indicate that check failed. + */ +static int check_buffers(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set, bool same_size) +{ + static uint8_t tx_data[256]; + static uint8_t rx_data[256]; + int rx_len; + int tx_len; + + if (!tx_set || !rx_set) { + return 0; + } + + rx_len = cpy_data(rx_data, sizeof(rx_data), rx_set); + tx_len = cpy_data(tx_data, sizeof(tx_data), tx_set); + if (same_size && (rx_len != tx_len)) { + return -1; + } + + return memcmp(tx_data, rx_data, rx_len); +} + +/** Calculate expected number of received bytes by the slave. + * + * It is used to check if SPI API call for slave returns correct value. + * @param tx_set TX set. + * @param rx_set RX set. + * + * @return Expected amount of received bytes. + */ +static int slave_rx_len(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set) +{ + size_t tx_len = 0; + size_t rx_len = 0; + + if (!tx_set || !rx_set) { + return 0; + } + + for (size_t i = 0; i < tx_set->count; i++) { + tx_len += tx_set->buffers[i].len; + } + + for (size_t i = 0; i < rx_set->count; i++) { + rx_len += rx_set->buffers[i].len; + } + + return MIN(rx_len, tx_len); +} + +/** Generic function which runs the test with sets prepared in the test data structure. */ +static void run_test(bool m_same_size, bool s_same_size, bool async) +{ + int rv; + int slave_rv; + int srx_len; + + rv = k_work_schedule(&tdata.test_work, K_MSEC(10)); + zassert_equal(rv, 1); + + if (!async) { + slave_rv = spi_transceive(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set); + if (slave_rv == -ENOTSUP) { + ztest_test_skip(); + } + } else { + rv = spi_transceive_signal(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set, + &async_sig); + if (rv == -ENOTSUP) { + ztest_test_skip(); + } + zassert_equal(rv, 0); + + /* Transfer not finished yet */ + rv = k_sem_take(&tdata.sem, K_NO_WAIT); + zassert_equal(rv, -EBUSY); + + rv = k_poll(&async_evt, 1, K_MSEC(200)); + zassert_false(rv, "one or more events are not ready"); + + slave_rv = async_evt.signal->result; + + /* Reinitializing for next call */ + async_evt.signal->signaled = 0U; + async_evt.state = K_POLL_STATE_NOT_READY; + } + + rv = k_sem_take(&tdata.sem, K_MSEC(100)); + zassert_equal(rv, 0); + + srx_len = slave_rx_len(tdata.mtx_set, tdata.srx_set); + + zassert_equal(slave_rv, srx_len, "Got: %d but expected:%d", slave_rv, srx_len); + + rv = check_buffers(tdata.mtx_set, tdata.srx_set, m_same_size); + zassert_equal(rv, 0); + + rv = check_buffers(tdata.stx_set, tdata.mrx_set, s_same_size); + zassert_equal(rv, 0); +} + +/** Basic test where slave and master have RX and TX sets which contains only one + * same size buffer. + */ +static void test_basic(bool async) +{ + size_t len = 16; + + for (int i = 0; i < 4; i++) { + tdata.bufs[i].buf = buf_alloc(len, i < 2); + tdata.bufs[i].len = len; + tdata.sets[i].buffers = &tdata.bufs[i]; + tdata.sets[i].count = 1; + } + + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = &tdata.sets[1]; + tdata.stx_set = &tdata.sets[2]; + tdata.srx_set = &tdata.sets[3]; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_basic) +{ + test_basic(false); +} + +ZTEST(spi_slave, test_basic_async) +{ + test_basic(true); +} + +/** Setup a transfer where RX buffer on master and slave are shorter than + * TX buffers. RX buffers shall contain beginning of TX data and last TX + * bytes that did not fit in the RX buffers shall be lost. + */ +static void test_short_rx(bool async) +{ + size_t len = 16; + + tdata.bufs[0].buf = buf_alloc(len, true); + tdata.bufs[0].len = len; + tdata.bufs[1].buf = buf_alloc(len, true); + tdata.bufs[1].len = len - 3; /* RX buffer */ + tdata.bufs[2].buf = buf_alloc(len, false); + tdata.bufs[2].len = len; + tdata.bufs[3].buf = buf_alloc(len, false); + tdata.bufs[3].len = len - 4; /* RX buffer */ + + for (int i = 0; i < 4; i++) { + tdata.sets[i].buffers = &tdata.bufs[i]; + tdata.sets[i].count = 1; + } + + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = &tdata.sets[1]; + tdata.stx_set = &tdata.sets[2]; + tdata.srx_set = &tdata.sets[3]; + + run_test(false, false, async); +} + +ZTEST(spi_slave, test_short_rx) +{ + test_short_rx(false); +} + +ZTEST(spi_slave, test_short_rx_async) +{ + test_short_rx(true); +} + +/** Test where only master transmits. */ +static void test_only_tx(bool async) +{ + size_t len = 16; + + /* MTX buffer */ + tdata.bufs[0].buf = buf_alloc(len, true); + tdata.bufs[0].len = len; + tdata.sets[0].buffers = &tdata.bufs[0]; + tdata.sets[0].count = 1; + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = NULL; + + /* STX buffer */ + tdata.bufs[1].buf = buf_alloc(len, false); + tdata.bufs[1].len = len; + tdata.sets[1].buffers = &tdata.bufs[1]; + tdata.sets[1].count = 1; + tdata.srx_set = &tdata.sets[1]; + tdata.stx_set = NULL; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_only_tx) +{ + test_only_tx(false); +} + +ZTEST(spi_slave, test_only_tx_async) +{ + test_only_tx(true); +} + +/** Test where only master transmits and slave receives in chunks. */ +static void test_only_tx_in_chunks(bool async) +{ + size_t len1 = 7; + size_t len2 = 8; + + /* MTX buffer */ + tdata.bufs[0].buf = buf_alloc(len1 + len2, true); + tdata.bufs[0].len = len1 + len2; + tdata.sets[0].buffers = &tdata.bufs[0]; + tdata.sets[0].count = 1; + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = NULL; + + /* STX buffer */ + tdata.bufs[1].buf = buf_alloc(len1, false); + tdata.bufs[1].len = len1; + tdata.bufs[2].buf = buf_alloc(len2, false); + tdata.bufs[2].len = len2; + tdata.sets[1].buffers = &tdata.bufs[1]; + tdata.sets[1].count = 2; + tdata.srx_set = &tdata.sets[1]; + tdata.stx_set = NULL; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_only_tx_in_chunks) +{ + test_only_tx_in_chunks(false); +} + +ZTEST(spi_slave, test_only_tx_in_chunks_async) +{ + test_only_tx_in_chunks(true); +} + +/** Test where only slave transmits. */ +static void test_only_rx(bool async) +{ + size_t len = 16; + + /* MTX buffer */ + tdata.bufs[0].buf = buf_alloc(len, true); + tdata.bufs[0].len = len; + tdata.sets[0].buffers = &tdata.bufs[0]; + tdata.sets[0].count = 1; + tdata.mrx_set = &tdata.sets[0]; + tdata.mtx_set = NULL; + + /* STX buffer */ + tdata.bufs[1].buf = buf_alloc(len, false); + tdata.bufs[1].len = len; + tdata.sets[1].buffers = &tdata.bufs[1]; + tdata.sets[1].count = 1; + tdata.stx_set = &tdata.sets[1]; + tdata.srx_set = NULL; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_only_rx) +{ + test_only_rx(false); +} + +ZTEST(spi_slave, test_only_rx_async) +{ + test_only_rx(true); +} + +/** Test where only slave transmits in chunks. */ +static void test_only_rx_in_chunks(bool async) +{ + size_t len1 = 7; + size_t len2 = 9; + + /* MTX buffer */ + tdata.bufs[0].buf = buf_alloc(len1 + len2, true); + tdata.bufs[0].len = len1 + len2; + tdata.sets[0].buffers = &tdata.bufs[0]; + tdata.sets[0].count = 1; + tdata.mrx_set = &tdata.sets[0]; + tdata.mtx_set = NULL; + + /* STX buffer */ + tdata.bufs[1].buf = buf_alloc(len1, false); + tdata.bufs[1].len = len1; + tdata.bufs[2].buf = buf_alloc(len2, false); + tdata.bufs[2].len = len2; + tdata.sets[1].buffers = &tdata.bufs[1]; + tdata.sets[1].count = 2; + tdata.stx_set = &tdata.sets[1]; + tdata.srx_set = NULL; + + run_test(true, true, async); +} + +ZTEST(spi_slave, test_only_rx_in_chunks) +{ + test_only_rx_in_chunks(false); +} + +ZTEST(spi_slave, test_only_rx_in_chunks_async) +{ + test_only_rx_in_chunks(true); +} + +static void before(void *not_used) +{ + ARG_UNUSED(not_used); + + memset(&tdata, 0, sizeof(tdata)); + for (size_t i = 0; i < sizeof(spim_buffer); i++) { + spim_buffer[i] = (uint8_t)i; + } + for (size_t i = 0; i < sizeof(spis_buffer); i++) { + spis_buffer[i] = (uint8_t)(i + 0x80); + } + + k_work_init_delayable(&tdata.test_work, work_handler); + k_sem_init(&tdata.sem, 0, 1); +} + +static void *suite_setup(void) +{ + return NULL; +} + +ZTEST_SUITE(spi_slave, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/spi/spi_slave/testcase.yaml b/tests/drivers/spi/spi_slave/testcase.yaml new file mode 100644 index 00000000000..1b5a46cc9e6 --- /dev/null +++ b/tests/drivers/spi/spi_slave/testcase.yaml @@ -0,0 +1,10 @@ +tests: + drivers.spi_slave.api: + depends_on: spi + tags: drivers spi + harness: ztest + harness_config: + fixture: gpio_spi_loopback + platform_allow: nrf52840dk/nrf52840 nrf54l15pdk/nrf54l15/cpuapp + integration_platforms: + - nrf52840dk/nrf52840 From 1c5cc9de2a2d14f0ff4cbddf595d9705c40ca3d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 3 Apr 2024 12:15:46 +0200 Subject: [PATCH 1793/2300] [nrf fromtree] dts: common: nordic: nrf54: Add rx-delay property to SPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add rx-delay property to all SPI nodes. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 8acc6a961a895b91fcfc06a71ba58dfd836b8a45) --- .../nordic/nrf54l15_cpuapp_peripherals.dtsi | 10 ++++++++++ dts/common/nordic/nrf54h20.dtsi | 20 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index eb161844841..3e4d3641069 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -24,6 +24,8 @@ spi00: spi@4a000 { interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; @@ -124,6 +126,8 @@ spi20: spi@c6000 { interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; @@ -159,6 +163,8 @@ spi21: spi@c7000 { interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; @@ -194,6 +200,8 @@ spi22: spi@c8000 { interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; @@ -391,6 +399,8 @@ spi30: spi@104000 { interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; status = "disabled"; }; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index b8456d719c0..7d5a64d0a83 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -369,6 +369,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart120: uart@8e6000 { @@ -387,6 +389,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; cpuppr_vpr: vpr@908000 { @@ -644,6 +648,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart130: uart@9a5000 { @@ -672,6 +678,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart131: uart@9a6000 { @@ -734,6 +742,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart132: uart@9b5000 { @@ -762,6 +772,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart133: uart@9b6000 { @@ -824,6 +836,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart134: uart@9c5000 { @@ -852,6 +866,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart135: uart@9c6000 { @@ -914,6 +930,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart136: uart@9d5000 { @@ -942,6 +960,8 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; + rx-delay-supported; + rx-delay = <1>; }; uart137: uart@9d6000 { From 0bdee3c8a8c20f5f7b48437885f430ec4ea9ae7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 2 Apr 2024 14:04:18 +0200 Subject: [PATCH 1794/2300] [nrf fromtree] tests: drivers: spi: spi_loopback_test: Add nrf54h20dk support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for nrf54h20dk for the SPI loopback test. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 1e6a2a00e236e6ed33e27f33a79bf9c44db81d89) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..5ab0e84eeaa --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,43 @@ +/* + * 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 { + 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 = ; + }; +}; From 4aa01ece24d527919eb1148471a07616103ced97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 19 Apr 2024 08:49:02 +0200 Subject: [PATCH 1795/2300] [nrf fromlist] tests: drivers: spi: spi_slave: Add nrf54h20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration for nrf54h20dk to the test. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71677 Signed-off-by: Krzysztof Chruściński (cherry picked from commit 5aeae3b35c79025d473a8ff0a9c3880f78fd5de2) --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 79 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 14 ++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 14 ++++ tests/drivers/spi/spi_slave/src/main.c | 1 + tests/drivers/spi/spi_slave/testcase.yaml | 4 +- 5 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi new file mode 100644 index 00000000000..0a9425cc2f9 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,79 @@ +/* + * 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; + }; + }; + +}; + +&gpio0 { + status = "okay"; +}; + +&gpiote130 { + status = "okay"; + owned-channels = <7>; +}; + +dut_spi: &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_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..ff337ebdec4 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&dut_spi { + memory-regions = <&cpuapp_dma_region>; +}; + +&dut_spis { + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 00000000000..936bd5b15d5 --- /dev/null +++ b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&dut_spi { + memory-regions = <&cpurad_dma_region>; +}; + +&dut_spis { + memory-regions = <&cpurad_dma_region>; +}; diff --git a/tests/drivers/spi/spi_slave/src/main.c b/tests/drivers/spi/spi_slave/src/main.c index 7a6ca1b7545..5f441480c12 100644 --- a/tests/drivers/spi/spi_slave/src/main.c +++ b/tests/drivers/spi/spi_slave/src/main.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #define SPI_MODE (SPI_MODE_CPOL | SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE) diff --git a/tests/drivers/spi/spi_slave/testcase.yaml b/tests/drivers/spi/spi_slave/testcase.yaml index 1b5a46cc9e6..c38b3e72952 100644 --- a/tests/drivers/spi/spi_slave/testcase.yaml +++ b/tests/drivers/spi/spi_slave/testcase.yaml @@ -5,6 +5,8 @@ tests: harness: ztest harness_config: fixture: gpio_spi_loopback - platform_allow: nrf52840dk/nrf52840 nrf54l15pdk/nrf54l15/cpuapp + platform_allow: | + nrf52840dk/nrf52840 nrf54l15pdk/nrf54l15/cpuapp nrf54h20dk/nrf54h20/cpuapp + nrf54h20dk/nrf54h20/cpurad integration_platforms: - nrf52840dk/nrf52840 From 1f655d6c493df7116203c75ca1ba603633242da3 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Mon, 15 Apr 2024 14:12:27 +0200 Subject: [PATCH 1796/2300] [nrf fromtree] tests: drivers: timer: nrf_grtc_timer: add nRF54H20 target GRTC peripheral is present on nRF54H20, so the tests should be executed on this target as well. Signed-off-by: Nikodem Kastelik (cherry picked from commit 1f9bec7f0844784cc790cac20b85d098294ecbfa) --- tests/drivers/timer/nrf_grtc_timer/testcase.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index f611a518a70..00ac1ed584b 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -1,4 +1,7 @@ tests: drivers.timer.nrf_grtc_timer: tags: drivers - platform_allow: nrf54l15pdk/nrf54l15/cpuapp + platform_allow: + - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad From ab8d66dd12917eb4d2e757f6bdb8b44bed5e556d Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 12 Apr 2024 13:41:15 +0200 Subject: [PATCH 1797/2300] [nrf fromtree] soc: nordic: add nRF54 TWIS HAS_HW symbols Add HAS_HW symbols for TWIS instances found on nRF54H20 and nRF54L15 devices. Signed-off-by: Nikodem Kastelik (cherry picked from commit 03cb84ffda13cce818180e2f827c0462f8d75197) --- soc/nordic/common/Kconfig.peripherals | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index 817002f7282..f0adc82d44a 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -530,6 +530,42 @@ config HAS_HW_NRF_TWIS2 config HAS_HW_NRF_TWIS3 def_bool $(dt_nodelabel_enabled_with_compat,i2c3,$(DT_COMPAT_NORDIC_NRF_TWIS)) +config HAS_HW_NRF_TWIS20 + def_bool $(dt_nodelabel_enabled_with_compat,i2c20,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS21 + def_bool $(dt_nodelabel_enabled_with_compat,i2c21,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS22 + def_bool $(dt_nodelabel_enabled_with_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS30 + def_bool $(dt_nodelabel_enabled_with_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS130 + def_bool $(dt_nodelabel_enabled_with_compat,i2c130,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS131 + def_bool $(dt_nodelabel_enabled_with_compat,i2c131,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS132 + def_bool $(dt_nodelabel_enabled_with_compat,i2c132,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS133 + def_bool $(dt_nodelabel_enabled_with_compat,i2c133,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS134 + def_bool $(dt_nodelabel_enabled_with_compat,i2c134,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS135 + def_bool $(dt_nodelabel_enabled_with_compat,i2c135,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS136 + def_bool $(dt_nodelabel_enabled_with_compat,i2c136,$(DT_COMPAT_NORDIC_NRF_TWIS)) + +config HAS_HW_NRF_TWIS137 + def_bool $(dt_nodelabel_enabled_with_compat,i2c137,$(DT_COMPAT_NORDIC_NRF_TWIS)) + config HAS_HW_NRF_UART0 def_bool $(dt_nodelabel_enabled_with_compat,uart0,$(DT_COMPAT_NORDIC_NRF_UART)) From 0301be3da47b8ec638e3851ef78a07208729df51 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 12 Apr 2024 14:13:31 +0200 Subject: [PATCH 1798/2300] [nrf fromtree] tests: boards: nrf: add i2c driver test with TWIS slave Test defines a lopback between i2c driver master and nrfx TWIS slave to verify their functional correctness. Signed-off-by: Nikodem Kastelik (cherry picked from commit 01ea0f2d7e433c0a9e9eb639f60987b075e07870) --- tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt | 10 ++ .../i2c_slave/boards/nrf52840dk_nrf52840.conf | 1 + .../boards/nrf52840dk_nrf52840.overlay | 60 ++++++++ .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 + .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 58 +++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 63 ++++++++ .../boards/nrf54l15pdk_nrf54l15_cpuapp.conf | 1 + .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 59 +++++++ tests/boards/nrf/i2c/i2c_slave/prj.conf | 2 + tests/boards/nrf/i2c/i2c_slave/src/main.c | 145 ++++++++++++++++++ tests/boards/nrf/i2c/i2c_slave/testcase.yaml | 12 ++ 12 files changed, 413 insertions(+) create mode 100644 tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/boards/nrf/i2c/i2c_slave/prj.conf create mode 100644 tests/boards/nrf/i2c/i2c_slave/src/main.c create mode 100644 tests/boards/nrf/i2c/i2c_slave/testcase.yaml diff --git a/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt b/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt new file mode 100644 index 00000000000..43130d6a07d --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/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(i2c_slave) + +FILE(GLOB app_sources src/*.c) + +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000..e79ad7a8126 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS1=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000..8628731faf4 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,60 @@ +/ { + aliases { + i2c-slave = &i2c1; + }; +}; + +&pinctrl { + i2c0_default_alt: i2c0_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c0_sleep_alt: i2c0_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c1_default_alt: i2c1_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c1_sleep_alt: i2c1_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c0 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c0_default_alt>; + pinctrl-1 = <&i2c0_sleep_alt>; + pinctrl-names = "default", "sleep"; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + + +&i2c1 { + compatible = "nordic,nrf-twis"; + status = "okay"; + pinctrl-0 = <&i2c1_default_alt>; + pinctrl-1 = <&i2c1_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000..a7bedf1f04b --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS2=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000..d473a04f85c --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,58 @@ +/ { + aliases { + i2c-slave = &i2c2; + }; +}; + +&pinctrl { + i2c1_default_alt: i2c1_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c1_sleep_alt: i2c1_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c2_default_alt: i2c2_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c2_sleep_alt: i2c2_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c1 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c1_default_alt>; + pinctrl-1 = <&i2c1_sleep_alt>; + pinctrl-names = "default", "sleep"; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + +&i2c2 { + compatible = "nordic,nrf-twis"; + pinctrl-0 = <&i2c2_default_alt>; + pinctrl-1 = <&i2c2_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 00000000000..157e0a11f72 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS131=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..73d1d85cf45 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,63 @@ +/ { + aliases { + i2c-slave = &i2c131; + }; +}; + +&pinctrl { + i2c130_default_alt: i2c130_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c130_sleep_alt: i2c130_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c131_default_alt: i2c131_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c131_sleep_alt: i2c131_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c130 { + compatible = "nordic,nrf-twim"; + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c130_default_alt>; + pinctrl-1 = <&i2c130_sleep_alt>; + pinctrl-names = "default", "sleep"; + memory-regions = <&cpuapp_dma_region>; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + +&i2c131 { + compatible = "nordic,nrf-twis"; + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c131_default_alt>; + pinctrl-1 = <&i2c131_sleep_alt>; + pinctrl-names = "default", "sleep"; + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf new file mode 100644 index 00000000000..b01af3b36a7 --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_NRFX_TWIS22=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..d60e42659ee --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,59 @@ +/ { + aliases { + i2c-slave = &i2c22; + }; +}; + +&pinctrl { + i2c21_default_alt: i2c21_default_alt { + group1 { + psels = , + ; + }; + }; + + i2c21_sleep_alt: i2c21_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c22_default_alt: i2c22_default_alt { + group1 { +/* Temporary workaround as it is currently not possible + * to configure pins for TWIS with pinctrl. */ + psels = , + ; + bias-pull-up; + }; + }; + + i2c22_sleep_alt: i2c22_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +&i2c21 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c21_default_alt>; + pinctrl-1 = <&i2c21_sleep_alt>; + pinctrl-names = "default", "sleep"; + sensor: sensor@54 { + reg = <0x54>; + }; +}; + +&i2c22 { + compatible = "nordic,nrf-twis"; + status = "okay"; + pinctrl-0 = <&i2c22_default_alt>; + pinctrl-1 = <&i2c22_sleep_alt>; + pinctrl-names = "default", "sleep"; +}; diff --git a/tests/boards/nrf/i2c/i2c_slave/prj.conf b/tests/boards/nrf/i2c/i2c_slave/prj.conf new file mode 100644 index 00000000000..4b19609ecfb --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/prj.conf @@ -0,0 +1,2 @@ +CONFIG_I2C=y +CONFIG_ZTEST=y diff --git a/tests/boards/nrf/i2c/i2c_slave/src/main.c b/tests/boards/nrf/i2c/i2c_slave/src/main.c new file mode 100644 index 00000000000..1de4b16bc2c --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/src/main.c @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#if CONFIG_NRFX_TWIS1 +#define I2C_S_INSTANCE 1 +#elif CONFIG_NRFX_TWIS2 +#define I2C_S_INSTANCE 2 +#elif CONFIG_NRFX_TWIS22 +#define I2C_S_INSTANCE 22 +#elif CONFIG_NRFX_TWIS131 +#define I2C_S_INSTANCE 131 +#else +#error "TWIS instance not enabled or not supported" +#endif + +#define NODE_SENSOR DT_NODELABEL(sensor) +#define NODE_TWIS DT_ALIAS(i2c_slave) + +#define TWIS_MEMORY_SECTION \ + COND_CODE_1(DT_NODE_HAS_PROP(NODE_TWIS, memory_regions), \ + (__attribute__((__section__( \ + LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(NODE_TWIS, memory_regions)))))), \ + ()) + +#define TEST_DATA_SIZE 6 +static const uint8_t msg[TEST_DATA_SIZE] = "Nordic"; +static const nrfx_twis_t twis = NRFX_TWIS_INSTANCE(I2C_S_INSTANCE); + +static uint8_t i2c_slave_buffer[TEST_DATA_SIZE] TWIS_MEMORY_SECTION; +static uint8_t i2c_master_buffer[TEST_DATA_SIZE]; +struct i2c_api_twis_fixture { + const struct device *dev; + uint8_t addr; + uint8_t *const master_buffer; + uint8_t *const slave_buffer; +}; + +void i2s_slave_handler(nrfx_twis_evt_t const *p_event) +{ + switch (p_event->type) { + case NRFX_TWIS_EVT_READ_REQ: + nrfx_twis_tx_prepare(&twis, i2c_slave_buffer, TEST_DATA_SIZE); + TC_PRINT("TWIS event: read request\n"); + break; + case NRFX_TWIS_EVT_READ_DONE: + TC_PRINT("TWIS event: read done\n"); + break; + case NRFX_TWIS_EVT_WRITE_REQ: + nrfx_twis_rx_prepare(&twis, i2c_slave_buffer, TEST_DATA_SIZE); + TC_PRINT("TWIS event: write request\n"); + break; + case NRFX_TWIS_EVT_WRITE_DONE: + zassert_mem_equal(i2c_slave_buffer, msg, TEST_DATA_SIZE); + TC_PRINT("TWIS event: write done\n"); + break; + default: + TC_PRINT("TWIS event: %d\n", p_event->type); + break; + } +} + +static void *test_setup(void) +{ + static struct i2c_api_twis_fixture fixture = { + .dev = DEVICE_DT_GET(DT_BUS(NODE_SENSOR)), + .addr = DT_REG_ADDR(NODE_SENSOR), + .master_buffer = i2c_master_buffer, + .slave_buffer = i2c_slave_buffer, + }; + const nrfx_twis_config_t config = { + .addr = {fixture.addr, 0}, + .skip_gpio_cfg = true, + .skip_psel_cfg = true, + }; + int ret; + + zassert_equal(NRFX_SUCCESS, nrfx_twis_init(&twis, &config, i2s_slave_handler), + "TWIS initialization failed"); + + PINCTRL_DT_DEFINE(NODE_TWIS); + ret = pinctrl_apply_state(PINCTRL_DT_DEV_CONFIG_GET(NODE_TWIS), PINCTRL_STATE_DEFAULT); + zassert_ok(ret); + + IRQ_CONNECT(DT_IRQN(NODE_TWIS), DT_IRQ(NODE_TWIS, priority), + NRFX_TWIS_INST_HANDLER_GET(I2C_S_INSTANCE), NULL, 0); + + nrfx_twis_enable(&twis); + + return &fixture; +} + +static void cleanup_buffers(void *argc) +{ + struct i2c_api_twis_fixture *fixture = (struct i2c_api_twis_fixture *)argc; + + memset(fixture->slave_buffer, 0, TEST_DATA_SIZE); + memset(fixture->master_buffer, 0, TEST_DATA_SIZE); +} + +ZTEST_USER_F(i2c_api_twis, test_i2c_read_write) +{ + int ret = i2c_write_read(fixture->dev, fixture->addr, msg, TEST_DATA_SIZE, + fixture->master_buffer, TEST_DATA_SIZE); + + zassert_ok(ret); + zassert_mem_equal(fixture->master_buffer, msg, TEST_DATA_SIZE); +} + +ZTEST_USER_F(i2c_api_twis, test_i2c_read) +{ + /* Prepare slave data */ + strncpy(fixture->slave_buffer, msg, TEST_DATA_SIZE); + zassert_mem_equal(fixture->slave_buffer, msg, TEST_DATA_SIZE); + + int ret = i2c_read(fixture->dev, fixture->master_buffer, TEST_DATA_SIZE, fixture->addr); + + zassert_ok(ret); + zassert_mem_equal(fixture->master_buffer, msg, TEST_DATA_SIZE); +} + +ZTEST_USER_F(i2c_api_twis, test_i2c_write) +{ + int ret = i2c_write(fixture->dev, msg, TEST_DATA_SIZE, fixture->addr); + + zassert_ok(ret); + zassert_mem_equal(fixture->slave_buffer, msg, TEST_DATA_SIZE); +} + +ZTEST_SUITE(i2c_api_twis, NULL, test_setup, NULL, cleanup_buffers, NULL); diff --git a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml new file mode 100644 index 00000000000..1309b60146e --- /dev/null +++ b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml @@ -0,0 +1,12 @@ +tests: + boards.nrf.i2c.i2c_slave: + depends_on: i2c + tags: drivers i2c + harness: ztest + harness_config: + fixture: i2c_loopback + platform_allow: nrf52840dk/nrf52840 nrf5340dk/nrf5340/cpuapp nrf54l15pdk/nrf54l15/cpuapp + integration_platforms: + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15pdk/nrf54l15/cpuapp From 0b1ebb5e018ef7829582eebc815d9eea35e58263 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 17 Apr 2024 08:12:58 +0200 Subject: [PATCH 1799/2300] [nrf fromtree] soc: nordic: Fix undefined z_arm_platform_init Fixes #71511 Follow-up to #70977 Update the approach by moving the `PROVIDE` directive to a separate linker script added using `zephyr_linker_sources()`. This makes the change more likely to propagate to existing samples which are using CONFIG_CUSTOM_LINKER_SCRIPT. Signed-off-by: Grzegorz Swiderski (cherry picked from commit f16b33e902d4bae8c0a72c0c568f9c33ce6f6209) --- soc/nordic/CMakeLists.txt | 4 +++- soc/nordic/common/CMakeLists.txt | 2 ++ soc/nordic/{linker.ld => common/arm_platform_init.ld} | 11 ----------- soc/nordic/common/vpr/CMakeLists.txt | 2 ++ 4 files changed, 7 insertions(+), 12 deletions(-) rename soc/nordic/{linker.ld => common/arm_platform_init.ld} (52%) diff --git a/soc/nordic/CMakeLists.txt b/soc/nordic/CMakeLists.txt index 6dae6e97fb2..9797d2e717a 100644 --- a/soc/nordic/CMakeLists.txt +++ b/soc/nordic/CMakeLists.txt @@ -2,7 +2,9 @@ zephyr_library() -set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "SoC Linker script") +if(CONFIG_ARM) + set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "SoC Linker script") +endif() zephyr_library_sources( validate_base_addresses.c diff --git a/soc/nordic/common/CMakeLists.txt b/soc/nordic/common/CMakeLists.txt index b574cafc0c7..805113f53d6 100644 --- a/soc/nordic/common/CMakeLists.txt +++ b/soc/nordic/common/CMakeLists.txt @@ -3,6 +3,8 @@ add_subdirectory_ifdef(CONFIG_RISCV_CORE_NORDIC_VPR vpr) +zephyr_linker_sources_ifdef(CONFIG_ARM SECTIONS arm_platform_init.ld) + zephyr_library_sources_ifdef(CONFIG_POWEROFF poweroff.c) zephyr_include_directories(.) diff --git a/soc/nordic/linker.ld b/soc/nordic/common/arm_platform_init.ld similarity index 52% rename from soc/nordic/linker.ld rename to soc/nordic/common/arm_platform_init.ld index c8dbb426592..9773ada3dcf 100644 --- a/soc/nordic/linker.ld +++ b/soc/nordic/common/arm_platform_init.ld @@ -4,16 +4,5 @@ * SPDX-License-Identifier: Apache-2.0 */ -#if defined(CONFIG_ARM) -#include - /* Let SystemInit() be called in place of z_arm_platform_init() by default. */ PROVIDE(z_arm_platform_init = SystemInit); - -#elif defined(CONFIG_RISCV) -#include - -#else -#error Unsupported architecture - -#endif diff --git a/soc/nordic/common/vpr/CMakeLists.txt b/soc/nordic/common/vpr/CMakeLists.txt index 3849a3fdc94..d418954eebc 100644 --- a/soc/nordic/common/vpr/CMakeLists.txt +++ b/soc/nordic/common/vpr/CMakeLists.txt @@ -4,3 +4,5 @@ zephyr_include_directories(.) zephyr_library_sources(soc_idle.c soc_irq.S soc_irq.c vector.S) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") From 7ad93e14a3375bab75c75f3e79655d8f83fabc84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 12 Apr 2024 12:26:27 +0200 Subject: [PATCH 1800/2300] [nrf fromtree] tests: drivers: spi: Add negative test cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend test coverage by adding tests that check invalid use of the SPI API. Signed-off-by: Sebastian Głąb (cherry picked from commit 5e4bbd5c7c37b55b9b6df63ba7165f0b8ff6506c) --- .../spi/spi_error_cases/CMakeLists.txt | 10 + .../boards/nrf52840dk_nrf52840.overlay | 72 +++++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 78 ++++++ tests/drivers/spi/spi_error_cases/prj.conf | 7 + tests/drivers/spi/spi_error_cases/src/main.c | 263 ++++++++++++++++++ .../drivers/spi/spi_error_cases/testcase.yaml | 12 + 6 files changed, 442 insertions(+) create mode 100644 tests/drivers/spi/spi_error_cases/CMakeLists.txt create mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_error_cases/prj.conf create mode 100644 tests/drivers/spi/spi_error_cases/src/main.c create mode 100644 tests/drivers/spi/spi_error_cases/testcase.yaml diff --git a/tests/drivers/spi/spi_error_cases/CMakeLists.txt b/tests/drivers/spi/spi_error_cases/CMakeLists.txt new file mode 100644 index 00000000000..2ac4bdbef4d --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/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(spi_error_cases) + +FILE(GLOB app_sources src/*.c) + +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000..183d6da9967 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi3_default_alt: spi3_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi3_sleep_alt: spi3_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi1_default_alt: spi1_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi1_sleep_alt: spi1_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + +dut_spi: &spi3 { + status = "okay"; + pinctrl-0 = <&spi3_default_alt>; + pinctrl-1 = <&spi3_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <200000>; + }; +}; + +dut_spis: &spi1 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi1_default_alt>; + pinctrl-1 = <&spi1_sleep_alt>; + pinctrl-names = "default", "sleep"; + dut_spis_dt: test-spis-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <200000>; + }; +}; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..2a0394c3f60 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi22_default_alt: spi22_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi22_sleep_alt: spi22_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spi21_default_alt: spi21_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spi21_sleep_alt: spi21_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + +&gpio2 { + status = "okay"; +}; + +dut_spi: &spi22 { + status = "okay"; + pinctrl-0 = <&spi22_default_alt>; + pinctrl-1 = <&spi22_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <200000>; + }; +}; + +dut_spis: &spi21 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spi21_default_alt>; + pinctrl-1 = <&spi21_sleep_alt>; + pinctrl-names = "default", "sleep"; + dut_spis_dt: test-spis-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <200000>; + }; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; diff --git a/tests/drivers/spi/spi_error_cases/prj.conf b/tests/drivers/spi/spi_error_cases/prj.conf new file mode 100644 index 00000000000..1161e03f477 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/prj.conf @@ -0,0 +1,7 @@ +CONFIG_SPI=y +CONFIG_SPI_SLAVE=y +CONFIG_GPIO=y +CONFIG_POLL=y +CONFIG_SPI_ASYNC=y +CONFIG_SPI_EXTENDED_MODES=y +CONFIG_ZTEST=y diff --git a/tests/drivers/spi/spi_error_cases/src/main.c b/tests/drivers/spi/spi_error_cases/src/main.c new file mode 100644 index 00000000000..0b44812db84 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/src/main.c @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#define SPI_MODE (SPI_MODE_CPOL | SPI_WORD_SET(8) | SPI_LINES_SINGLE) +#define SPIM_OP (SPI_OP_MODE_MASTER | SPI_MODE) +#define SPIS_OP (SPI_OP_MODE_SLAVE | SPI_MODE) + +static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); +static struct spi_dt_spec spis = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spis_dt), SPIS_OP, 0); + +#define MEMORY_SECTION(node) \ + COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ + (__attribute__((__section__( \ + LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ + ()) + +static uint8_t spim_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spi)); +static uint8_t spis_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spis)); + +struct test_data { + int spim_alloc_idx; + int spis_alloc_idx; + struct spi_buf_set sets[4]; + struct spi_buf_set *mtx_set; + struct spi_buf_set *mrx_set; + struct spi_buf_set *stx_set; + struct spi_buf_set *srx_set; + struct spi_buf bufs[4]; +}; + +static struct test_data tdata; + +/* Allocate buffer from spim or spis space. */ +static uint8_t *buf_alloc(size_t len, bool spim) +{ + int *idx = spim ? &tdata.spim_alloc_idx : &tdata.spis_alloc_idx; + uint8_t *buf = spim ? spim_buffer : spis_buffer; + size_t total = spim ? sizeof(spim_buffer) : sizeof(spis_buffer); + uint8_t *rv; + + if (*idx + len > total) { + zassert_false(true); + + return NULL; + } + + rv = &buf[*idx]; + *idx += len; + + return rv; +} + +ZTEST(spi_error_cases, test_SPI_HALF_DUPLEX_not_supported) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_HALF_DUPLEX; + spis_invalid.config.operation |= SPI_HALF_DUPLEX; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -ENOTSUP, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_SPI_OP_MODE_invalid) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_OP_MODE_SLAVE; + spis_invalid.config.operation &= !SPI_OP_MODE_SLAVE; + + /* Check that Operation Mode Slave on spim is not supported */ + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + /* Check that Operation Mode Master on spis is not supported */ + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_SPI_MODE_LOOP_not_supported) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_MODE_LOOP; + spis_invalid.config.operation |= SPI_MODE_LOOP; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_only_SPI_LINES_SINGLE_supported) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_LINES_DUAL; + spis_invalid.config.operation |= SPI_LINES_DUAL; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); + + spim_invalid = spim; + spis_invalid = spis; + spim_invalid.config.operation |= SPI_LINES_QUAD; + spis_invalid.config.operation |= SPI_LINES_QUAD; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); + + spim_invalid = spim; + spis_invalid = spis; + spim_invalid.config.operation |= SPI_LINES_OCTAL; + spis_invalid.config.operation |= SPI_LINES_OCTAL; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_only_8BIT_supported) +{ + int rv; + int slave_rv; + struct spi_dt_spec spim_invalid = spim; + struct spi_dt_spec spis_invalid = spis; + + spim_invalid.config.operation |= SPI_WORD_SET(16); + spis_invalid.config.operation |= SPI_WORD_SET(16); + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_unsupported_frequency) +{ + int rv; + struct spi_dt_spec spim_invalid = spim; + + spim_invalid.config.frequency = 124999; + + rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(rv, -EINVAL, "Got %d instead", rv); +} + +ZTEST(spi_error_cases, test_CS_unsupported_on_slave) +{ + int slave_rv; + struct spi_dt_spec spis_invalid = spis; + struct gpio_dt_spec test_gpio = { DEVICE_DT_GET(DT_NODELABEL(gpio1)), 10, GPIO_ACTIVE_LOW }; + + spis_invalid.config.cs.gpio = test_gpio; + + slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_scattered_tx_buf_not_supported) +{ + int slave_rv; + + tdata.sets[2].count = 2; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_scattered_rx_buf_not_supported) +{ + int slave_rv; + + tdata.sets[3].count = 2; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_tx_buf_too_big) +{ + int slave_rv; + + tdata.bufs[2].len = (size_t)65536; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_rx_buf_too_big) +{ + int slave_rv; + + tdata.bufs[3].len = (size_t)65536; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); +} + +ZTEST(spi_error_cases, test_spis_tx_buf_not_in_ram) +{ + int slave_rv; + + tdata.bufs[2].buf = (void *)0x12345678; + slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); + zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); +} + +static void before(void *not_used) +{ + ARG_UNUSED(not_used); + size_t len = 16; + + memset(&tdata, 0, sizeof(tdata)); + for (size_t i = 0; i < sizeof(spim_buffer); i++) { + spim_buffer[i] = (uint8_t)i; + } + for (size_t i = 0; i < sizeof(spis_buffer); i++) { + spis_buffer[i] = (uint8_t)i; + } + + for (int i = 0; i < 4; i++) { + tdata.bufs[i].buf = buf_alloc(len, i < 2); + tdata.bufs[i].len = len; + tdata.sets[i].buffers = &tdata.bufs[i]; + tdata.sets[i].count = 1; + } + + tdata.mtx_set = &tdata.sets[0]; + tdata.mrx_set = &tdata.sets[1]; + tdata.stx_set = &tdata.sets[2]; + tdata.srx_set = &tdata.sets[3]; +} + +static void *suite_setup(void) +{ + return NULL; +} + +ZTEST_SUITE(spi_error_cases, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml new file mode 100644 index 00000000000..9c7e40167e7 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/testcase.yaml @@ -0,0 +1,12 @@ +tests: + drivers.spi.spi_error_cases: + depends_on: spi + tags: drivers spi + harness: ztest + harness_config: + fixture: gpio_spi_loopback + platform_allow: + - nrf52840dk/nrf52840 + - nrf54l15pdk/nrf54l15/cpuapp + integration_platforms: + - nrf52840dk/nrf52840 From 56e3a0abf4376831b1c0e0aa933eb794d154b8b6 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Tue, 23 Apr 2024 16:21:08 +0000 Subject: [PATCH 1801/2300] [nrf fromtree] mcumgr/img_mgmt: Fix zcbor logic in os_mgmt_bootloader_info There have been to problems with the code where zcbor_bool_encode has been fed value instead of expected pointer and the result of previous zcbor_encode operations has not been taken to evaluate value of ok status. The change also replaces usage of #if IS_ENABLED with #ifdef, as IS_ENABLED should not be used outside if(). Signed-off-by: Dominik Ermel (cherry picked from commit c007e717d4bda353a8147c90fbe21456aa44b4c8) --- subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 29e222d1de9..9fc02f81661 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -469,9 +469,9 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt) ok = zcbor_tstr_put_lit(zse, "mode") && zcbor_int32_put(zse, BOOTLOADER_MODE); -#if IS_ENABLED(CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE) - ok = zcbor_tstr_put_lit(zse, "no-downgrade") && - zcbor_bool_encode(zse, true); +#ifdef CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE + ok = ok && zcbor_tstr_put_lit(zse, "no-downgrade") && + zcbor_bool_encode(zse, &(bool){true}); #endif } else { return OS_MGMT_ERR_QUERY_YIELDS_NO_ANSWER; From 2e73c44e405972528b8dfd4c6c37f44e047398b0 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Thu, 18 Apr 2024 10:57:05 +0200 Subject: [PATCH 1802/2300] [nrf fromtree] tests: drivers: uart: uart_elementary: Fix 'config_mismatch' test case UART error may be reported with random timing from either UART in configuration mismatch case. The test case is now aligned to such behaviour. Signed-off-by: Bartosz Miller (cherry picked from commit 3147243c8f6be6856339bcf33a23a21bf97b8ab2) --- tests/drivers/uart/uart_elementary/src/main.c | 15 ++++++++------- tests/drivers/uart/uart_elementary/testcase.yaml | 8 ++++++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index 1c4df3273a7..df8c7b54b10 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -40,6 +40,7 @@ static volatile uint8_t uart_error_counter; static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; static volatile uint8_t aux_uart_error; +static volatile uint8_t aux_uart_error_counter; #endif /* @@ -110,12 +111,9 @@ static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, vo uart_irq_update(dev); err = uart_err_check(dev); -#if !defined(CONFIG_COVERAGE) - /* This assetion will fail with coverge enabled - * When in coverage mode it has no impact on test case execution - */ - zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); -#endif /* CONFIG_COVERAGE */ + if (err != 0) { + aux_uart_error_counter++; + } while (uart_irq_is_pending(dev)) { if (uart_irq_rx_ready(dev)) { uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); @@ -290,7 +288,10 @@ ZTEST(uart_elementary, test_uart_dual_port_transmission) uart_irq_err_disable(uart_dev_aux); #if defined(CONFIG_SETUP_MISMATCH_TEST) - zassert_not_equal(uart_error_counter, 0); + TC_PRINT("Mismatched configuration test\n"); + zassert_not_equal(uart_error_counter + aux_uart_error_counter, 0, + "UART configuration mismatch error not detected"); + #else for (int index = 0; index < TEST_BUFFER_LEN; index++) { zassert_equal(test_buffer[index], test_pattern[index], diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index 7c06967e7ad..d8aa90d0536 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -33,3 +33,11 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" extra_configs: - CONFIG_DUAL_UART_TEST=y + drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l: + filter: CONFIG_SERIAL_SUPPORT_INTERRUPT + platform_allow: + - nrf54l15pdk/nrf54l15/cpuapp + extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" + extra_configs: + - CONFIG_DUAL_UART_TEST=y + - CONFIG_SETUP_MISMATCH_TEST=y From c39f4b1e097bc52d353e6425b157ba99af129ed5 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 30 Nov 2018 14:07:56 +0100 Subject: [PATCH 1803/2300] [nrf noup] ci: NCS-specific CI tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Necessary changes for NCS CI. - Add a Jenkinsfile - Add a commit-tags workflow: This enables sauce tag checking in sdk-zephyr - compliance.yml: Disable check for merge commits, since we have upmerges downstream. Also, since in the code we refer to Kconfig symbols that are defined in the sdk-nrf repository, the Kconfig checks (Kconfig, KconfigBasic and KconfigBasicNoModules) will not pass so exclude them. Also, disable any maintainers-related checks - scripts/gitlint: Extend the max commit line lengths for Gitlint to account for sauce tags Signed-off-by: Carles Cufi Signed-off-by: Dominik Ermel Signed-off-by: Martí Bolívar Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Krishna T Signed-off-by: Dominik Ermel Signed-off-by: Carles Cufi (cherry picked from commit 6b014316c607f99f927c6e05917ee73167e08f03) (cherry picked from commit d68a96e7be44ada31fe6e9a8d28e943298a6211f) --- .github/workflows/commit-tags.yml | 31 ++++++++++++++++++++++++++ .github/workflows/compliance.yml | 8 +++---- Jenkinsfile | 5 +++++ scripts/gitlint/zephyr_commit_rules.py | 4 ++-- 4 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/commit-tags.yml create mode 100644 Jenkinsfile diff --git a/.github/workflows/commit-tags.yml b/.github/workflows/commit-tags.yml new file mode 100644 index 00000000000..9e0323f9498 --- /dev/null +++ b/.github/workflows/commit-tags.yml @@ -0,0 +1,31 @@ +name: Commit tags + +on: pull_request + +jobs: + commit_tags: + runs-on: ubuntu-22.04 + name: Run commit tags checks on patch series (PR) + steps: + - name: Update PATH for west + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Checkout the code + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Install python dependencies + run: | + pip3 install setuptools + pip3 install wheel + pip3 install gitlint + + - name: Run the commit tags + uses: nrfconnect/action-commit-tags@main + with: + target: '.' + baserev: origin/${{ github.base_ref }} + revrange: 'none' diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index 5e6e2cff9a6..88c98e84710 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -38,8 +38,8 @@ jobs: git config --global user.name "Your Name" git remote -v # Ensure there's no merge commits in the PR - [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ - (echo "::error ::Merge commits not allowed, rebase instead";false) + #[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ + #(echo "::error ::Merge commits not allowed, rebase instead";false) git rebase origin/${BASE_REF} # debug git log --pretty=oneline | head -n 10 @@ -59,8 +59,8 @@ jobs: git log --pretty=oneline | head -n 10 # Increase rename limit to allow for large PRs git config diff.renameLimit 10000 - ./scripts/ci/check_compliance.py --annotate -e KconfigBasic \ - -c origin/${BASE_REF}.. + ./scripts/ci/check_compliance.py --annotate -e KconfigBasic -e Kconfig \ + -e KconfigBasicNoModules -e ModulesMaintainers -c origin/${BASE_REF}.. - name: upload-results uses: actions/upload-artifact@v4 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000000..3b9cf002239 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,5 @@ +@Library("CI_LIB") _ + +def pipeline = new ncs.sdk_zephyr.Main() + +pipeline.run(JOB_NAME) diff --git a/scripts/gitlint/zephyr_commit_rules.py b/scripts/gitlint/zephyr_commit_rules.py index a2c9cd3cb7f..ef317e22684 100644 --- a/scripts/gitlint/zephyr_commit_rules.py +++ b/scripts/gitlint/zephyr_commit_rules.py @@ -78,7 +78,7 @@ class TitleMaxLengthRevert(LineRule): name = "title-max-length-no-revert" id = "UC5" target = CommitMessageTitle - options_spec = [IntOption('line-length', 75, "Max line length")] + options_spec = [IntOption('line-length', 120, "Max line length")] violation_message = "Commit title exceeds max length ({0}>{1})" def validate(self, line, _commit): @@ -103,7 +103,7 @@ class MaxLineLengthExceptions(LineRule): name = "max-line-length-with-exceptions" id = "UC4" target = CommitMessageBody - options_spec = [IntOption('line-length', 75, "Max line length")] + options_spec = [IntOption('line-length', 120, "Max line length")] violation_message = "Commit message body line exceeds max length ({0}>{1})" def validate(self, line, _commit): From 14cf3aa0fef8ffef4c4978cb0443f43f2dbe9038 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Wed, 27 Sep 2023 09:41:10 +0000 Subject: [PATCH 1804/2300] [nrf noup] test: schedule_api: Use Minimal C library There is no point to use PICOLIB here as it bloats the tests. Signed-off-by: Dominik Ermel (cherry picked from commit 350e687dd5c75ac574fbea06200b8f02b854a7c7) --- tests/kernel/sched/schedule_api/prj.conf | 1 + tests/kernel/sched/schedule_api/prj_dumb.conf | 1 + tests/kernel/sched/schedule_api/prj_multiq.conf | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/kernel/sched/schedule_api/prj.conf b/tests/kernel/sched/schedule_api/prj.conf index fe5125047e3..785e9a3987b 100644 --- a/tests/kernel/sched/schedule_api/prj.conf +++ b/tests/kernel/sched/schedule_api/prj.conf @@ -7,3 +7,4 @@ CONFIG_MAX_THREAD_BYTES=5 CONFIG_TEST_USERSPACE=y CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y +CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj_dumb.conf b/tests/kernel/sched/schedule_api/prj_dumb.conf index c0ddfbd7c3f..a1d0cf6dced 100644 --- a/tests/kernel/sched/schedule_api/prj_dumb.conf +++ b/tests/kernel/sched/schedule_api/prj_dumb.conf @@ -5,3 +5,4 @@ CONFIG_SCHED_DUMB=y CONFIG_MAX_THREAD_BYTES=5 CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y +CONFIG_MINIMAL_LIBC=y diff --git a/tests/kernel/sched/schedule_api/prj_multiq.conf b/tests/kernel/sched/schedule_api/prj_multiq.conf index 6b28a1f39b2..cfe09fbce47 100644 --- a/tests/kernel/sched/schedule_api/prj_multiq.conf +++ b/tests/kernel/sched/schedule_api/prj_multiq.conf @@ -7,3 +7,4 @@ CONFIG_MP_MAX_NUM_CPUS=1 CONFIG_ZTEST_FATAL_HOOK=y CONFIG_NUM_COOP_PRIORITIES=30 CONFIG_NUM_PREEMPT_PRIORITIES=40 +CONFIG_MINIMAL_LIBC=y From cf41e66dd8d1cd017479631e4cf3c91b6f3e54c8 Mon Sep 17 00:00:00 2001 From: Jan Tore Guggedal Date: Mon, 18 May 2020 20:50:13 +0200 Subject: [PATCH 1805/2300] [nrf noup] net: mqtt: Provide option to enable TLS session caching Provides an option to enable TLS session caching for an MQTT client's secure socket. Signed-off-by: Jan Tore Guggedal Signed-off-by: Robert Lubos Signed-off-by: Dominik Ermel Signed-off-by: Johann Fischer (cherry picked from commit 05e424a60315d7083c1b2c3391010b54bd42443a) --- include/zephyr/net/mqtt.h | 3 +++ subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index 987b3726caf..d3c1c814b9d 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -371,6 +371,9 @@ struct mqtt_sec_config { uint32_t alpn_protocol_name_count; #endif + /** Indicates the preference for enabling TLS session caching. */ + int session_cache; + /** Peer hostname for ceritificate verification. * May be NULL to skip hostname verification. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index a33cee5aecf..445f45c95df 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -91,6 +91,16 @@ int mqtt_client_tls_connect(struct mqtt_client *client) } } + if (tls_config->session_cache == TLS_SESSION_CACHE_ENABLED) { + ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, + TLS_SESSION_CACHE, + &tls_config->session_cache, + sizeof(tls_config->session_cache)); + if (ret < 0) { + goto error; + } + } + if (tls_config->cert_nocopy != TLS_CERT_NOCOPY_NONE) { ret = zsock_setsockopt(client->transport.tls.sock, SOL_TLS, TLS_CERT_NOCOPY, &tls_config->cert_nocopy, From aed2d4a080ce139d653b86abfe67f119472cbf2b Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Thu, 10 Mar 2022 00:25:50 -0800 Subject: [PATCH 1806/2300] [nrf noup] net: mqtt: add native TLS support This commit adds an extra parameter in the configuration structure to configure native TLS support at runtime. Signed-off-by: Mirko Covizzi (cherry picked from commit 63940d988b3879983d2c36270e703422c5dd7d05) --- doc/connectivity/networking/api/mqtt.rst | 3 +++ include/zephyr/net/mqtt.h | 3 +++ subsys/net/lib/mqtt/mqtt_transport_socket_tls.c | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/mqtt.rst b/doc/connectivity/networking/api/mqtt.rst index b232f125333..79da5abe57b 100644 --- a/doc/connectivity/networking/api/mqtt.rst +++ b/doc/connectivity/networking/api/mqtt.rst @@ -150,6 +150,7 @@ additional configuration information: tls_config->sec_tag_list = m_sec_tags; tls_config->sec_tag_count = ARRAY_SIZE(m_sec_tags); tls_config->hostname = MQTT_BROKER_HOSTNAME; + tls_config->set_native_tls = true; In this sample code, the ``m_sec_tags`` array holds a list of tags, referencing TLS credentials that the MQTT library should use for authentication. We do not specify @@ -162,6 +163,8 @@ Note, that TLS credentials referenced by the ``m_sec_tags`` array must be registered in the system first. For more information on how to do that, refer to :ref:`secure sockets documentation `. +Finally, ``set_native_tls`` can be optionally set to enable native TLS support instead of offloading TLS operations to the modem. + An example of how to use TLS with MQTT is also present in :zephyr:code-sample:`mqtt-publisher` sample application. diff --git a/include/zephyr/net/mqtt.h b/include/zephyr/net/mqtt.h index d3c1c814b9d..54b2532f0fa 100644 --- a/include/zephyr/net/mqtt.h +++ b/include/zephyr/net/mqtt.h @@ -381,6 +381,9 @@ struct mqtt_sec_config { /** Indicates the preference for copying certificates to the heap. */ int cert_nocopy; + + /** Set socket to native TLS */ + bool set_native_tls; }; /** @brief MQTT transport type. */ diff --git a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c index 445f45c95df..c3816e5949f 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c +++ b/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c @@ -22,10 +22,15 @@ int mqtt_client_tls_connect(struct mqtt_client *client) { const struct sockaddr *broker = client->broker; struct mqtt_sec_config *tls_config = &client->transport.tls.config; + int type = SOCK_STREAM; int ret; + if (tls_config->set_native_tls) { + type |= SOCK_NATIVE_TLS; + } + client->transport.tls.sock = zsock_socket(broker->sa_family, - SOCK_STREAM, IPPROTO_TLS_1_2); + type, IPPROTO_TLS_1_2); if (client->transport.tls.sock < 0) { return -errno; } From 99c9a2b7600ecf4035ef7c8c2894ee2e540f25ff Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 4 Dec 2023 15:27:08 +0100 Subject: [PATCH 1807/2300] [nrf noup] soc: arm: nRF53: Add SPU Flash/RAM alignment TF-M will uses SPU alignment during build time to make sure all partitions can be locked down with the SPU. So adding them for nRF53 Signed-off-by: Markus Swarowsky Signed-off-by: Dominik Ermel (cherry picked from commit 90826581f1ee32b99f1cafdffc2e634a495d8ee3) --- soc/nordic/nrf53/Kconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index cc7bdaa5dc6..5f0d5b12326 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -127,12 +127,26 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral +config NRF_SPU_FLASH_REGION_ALIGNMENT + hex + default 0x4000 + help + FLASH regions must be aligned to this value due to SPU HW + limitations. + config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 help RAM region size for the NRF_SPU peripheral +config NRF_SPU_RAM_REGION_ALIGNMENT + hex + default 0x2000 + help + RAM regions must be aligned to this value due to SPU HW + limitations. + config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 bool depends on NRF_SOC_SECURE_SUPPORTED From 69121665915838ce1b6736e7935db13681e08d27 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Mon, 4 Dec 2023 15:27:14 +0100 Subject: [PATCH 1808/2300] [nrf noup] soc: arm: nRF91: Add SPU Flash/RAM alignment TF-M will uses SPU alignment during build time to make sure all partitions can be locked down with the SPU. So adding them for nRF91 Signed-off-by: Markus Swarowsky Signed-off-by: Dominik Ermel (cherry picked from commit 83be41dde2e00776f02e583d8e6e55743b6c2ef7) --- soc/nordic/nrf91/Kconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/soc/nordic/nrf91/Kconfig b/soc/nordic/nrf91/Kconfig index ed38eff73a2..8001f3aca3a 100644 --- a/soc/nordic/nrf91/Kconfig +++ b/soc/nordic/nrf91/Kconfig @@ -24,6 +24,13 @@ config NRF_SPU_FLASH_REGION_SIZE help FLASH region size for the NRF_SPU peripheral +config NRF_SPU_FLASH_REGION_ALIGNMENT + hex + default 0x8000 + help + FLASH regions must be aligned to this value due to SPU HW + limitations. + config NRF_SPU_RAM_REGION_SIZE hex default 0x2000 @@ -34,4 +41,11 @@ config NRF_ENABLE_ICACHE bool "Instruction cache (I-Cache)" default y +config NRF_SPU_RAM_REGION_ALIGNMENT + hex + default 0x2000 + help + RAM regions must be aligned to this value due to SPU HW + limitations. + endif # SOC_SERIES_NRF91X From 82e60763d2eaf1982f634e61ea8c428312cf8f1c Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Mon, 14 Nov 2022 11:22:06 +0100 Subject: [PATCH 1809/2300] [nrf noup] boards: thingy53_nrf5340: Add common partition map Change introduces common static Partition Manager configuration. The tfm_nonsecure partition must be SPU region aligned. Ref: NCSDK-18033 Ref: NCSDK-19515 Signed-off-by: Marek Pieta Signed-off-by: Markus Swarowsky (cherry picked from commit cb04671ad6e0de80e4441e996cc29416af40caaa) --- .../pm_static_thingy53_nrf5340_cpuapp.yml | 55 ++++++++++++++ .../pm_static_thingy53_nrf5340_cpuapp_ns.yml | 73 +++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml create mode 100644 boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml diff --git a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml new file mode 100644 index 00000000000..7a48d51ec33 --- /dev/null +++ b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp.yml @@ -0,0 +1,55 @@ +app: + address: 0x10200 + region: flash_primary + size: 0xdfe00 +mcuboot: + address: 0x0 + region: flash_primary + size: 0x10000 +mcuboot_pad: + address: 0x10000 + region: flash_primary + size: 0x200 +mcuboot_primary: + address: 0x10000 + orig_span: &id001 + - mcuboot_pad + - app + region: flash_primary + size: 0xe0000 + span: *id001 +mcuboot_primary_app: + address: 0x10200 + orig_span: &id002 + - app + region: flash_primary + size: 0xdfe00 + span: *id002 +settings_storage: + address: 0xf0000 + region: flash_primary + size: 0x10000 +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x00000 + size: 0xe0000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xe0000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x120000 + size: 0x6e0000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml new file mode 100644 index 00000000000..70ffe6d9c12 --- /dev/null +++ b/boards/nordic/thingy53/pm_static_thingy53_nrf5340_cpuapp_ns.yml @@ -0,0 +1,73 @@ +mcuboot: + address: 0x0 + region: flash_primary + size: 0x10000 +mcuboot_pad: + address: 0x10000 + region: flash_primary + size: 0x200 +tfm_secure: + address: 0x10000 + size: 0xc000 + span: [mcuboot_pad, tfm] +tfm_nonsecure: + address: 0x1c000 + size: 0xd4000 + span: [app] +tfm: + address: 0x10200 + region: flash_primary + size: 0xbe00 +app: + address: 0x1c000 + region: flash_primary + size: 0xd4000 +mcuboot_primary: + address: 0x10000 + orig_span: &id001 + - mcuboot_pad + - tfm + - app + region: flash_primary + size: 0xe0000 + span: *id001 +mcuboot_primary_app: + address: 0x10200 + orig_span: &id002 + - tfm + - app + region: flash_primary + size: 0xdfe00 + span: *id002 +nonsecure_storage: + address: 0xf0000 + size: 0x10000 + span: [settings_storage] +settings_storage: + address: 0xf0000 + region: flash_primary + size: 0x10000 +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x00000 + size: 0xe0000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xe0000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x120000 + size: 0x6e0000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary From 0cbfe199bfd402a6f627b3d13a911ae05406d287 Mon Sep 17 00:00:00 2001 From: Mateusz Kapala Date: Thu, 2 Feb 2023 11:04:23 +0100 Subject: [PATCH 1810/2300] [nrf noup] boards: arm: thingy53: Disable USB CDC added by MCUBoot Enabling USB CDC by default in Thingy:53 board configuration caused that there were two instances of USB CDC in MCUBoot. Change disables one instance which was added automatically by NCS if MCUBoot bootloader was built as a child image. Jira: NCSDK-18596 Signed-off-by: Mateusz Kapala Signed-off-by: Johann Fischer (cherry picked from commit 778b2a956086de2f6aec01f39651a25e3613cdae) (cherry picked from commit 6799c02cb60196ac26ebc1c1aeee54ca105f8e75) --- boards/nordic/thingy53/Kconfig.defconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index 701bd9be4e6..f498c936eb5 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -133,6 +133,13 @@ endif # LOG endif # BOARD_SERIAL_BACKEND_CDC_ACM +# By default, a USB CDC ACM instance is already enabled in the board's DTS. +# It is not necessary for nRF Connect SDK to add another instance if MCUBoot +# bootloader is built as a child image. +config MCUBOOT_USB_SUPPORT + bool + default n + endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS if BOARD_THINGY53_NRF5340_CPUNET From 6e623f79c2183cf1eff280f00a23fa5cde621aa4 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Mon, 28 Nov 2022 15:31:33 +0100 Subject: [PATCH 1811/2300] [nrf noup] boards: thingy53_nrf5340: Enable MCUboot by default Change enables MCUboot bootloader by default to allow programming samples and applications without external programmer (using MCUboot serial recovery). Change also enables network core to prevent build failures when building MCUboot with nRF53 multi image DFU. Jira: NCSDK-18263 Signed-off-by: Marek Pieta Signed-off-by: Vinayak Kariappa Chettimada Signed-off-by: Johann Fischer Signed-off-by: Joakim Andersson (cherry picked from commit ff85910bf8ed1aac0571bca0e7f206782234efbb) --- boards/nordic/thingy53/Kconfig.defconfig | 6 ++++++ boards/nordic/thingy53/thingy53_nrf5340_common.dtsi | 1 + 2 files changed, 7 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.defconfig b/boards/nordic/thingy53/Kconfig.defconfig index f498c936eb5..d849fda09ed 100644 --- a/boards/nordic/thingy53/Kconfig.defconfig +++ b/boards/nordic/thingy53/Kconfig.defconfig @@ -5,6 +5,12 @@ if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS +config BOOTLOADER_MCUBOOT + default y if !MCUBOOT + +config BOARD_ENABLE_CPUNET + default y if !MCUBOOT + # Code Partition: # # For the secure version of the board the firmware is linked at the beginning diff --git a/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi b/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi index 694a6960584..54efd588cf7 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi +++ b/boards/nordic/thingy53/thingy53_nrf5340_common.dtsi @@ -16,6 +16,7 @@ zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,ieee802154 = &ieee802154; + nordic,pm-ext-flash = &mx25r64; }; buttons { From 55be58b8659fec1c0cfe7d773634a0191c60f974 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Wed, 15 Nov 2023 12:55:40 +0100 Subject: [PATCH 1812/2300] [nrf noup] boards: arm: nrf9131ek: enable tfm This patch backports the nrf9131ek to a time before tfm was refactored. To be reverted when TF-M is updated. Signed-off-by: Maximilian Deubel Signed-off-by: Dominik Ermel (cherry picked from commit d0b22f5deb110cbe508a847faf79d4b7add5b4bf) --- boards/nordic/nrf9131ek/Kconfig.defconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/boards/nordic/nrf9131ek/Kconfig.defconfig b/boards/nordic/nrf9131ek/Kconfig.defconfig index b63e7ef8d34..8e0e1d02d1d 100644 --- a/boards/nordic/nrf9131ek/Kconfig.defconfig +++ b/boards/nordic/nrf9131ek/Kconfig.defconfig @@ -5,6 +5,21 @@ if BOARD_NRF9131EK_NRF9131 || BOARD_NRF9131EK_NRF9131_NS +# By default, if we build for a Non-Secure version of the board, +# enable building with TF-M as the Secure Execution Environment. +config BUILD_WITH_TFM + default y if BOARD_NRF9131EK_NRF9131_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 + # 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- From 91b6032820a140a6722f0838544f55d69b99a3e1 Mon Sep 17 00:00:00 2001 From: Sigvart Hovland Date: Fri, 3 May 2019 14:21:52 +0200 Subject: [PATCH 1813/2300] [nrf noup] tree-wide: support NCS Partition Manager (PM) definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partition Manager (PM) is a component of the nRF Connect SDK (NCS) which uses yaml files to resolve flash partition placement with a holistic view of the entire device, including each firmware image present on the flash device, and various subsystems, such as settings and NFFS. When this NCS extension is used, various source files which would use partition information from devicetree in "vanilla" zephyr instead use defines generated by PM instead. This commit removes support for HEX_FILES_TO_MERGE, as it conflicts with PM. The settings subsystem pm.yml defines a partition 'settings_storage'. The nffs subsystem pm.yml defines 'nffs_storage'. Leverage label translation to avoid patching partition names. Refer to the NCS documentation page for this feature for more details. This is a long-running out of tree patch which has been worked on by several people. The following sign-offs are in alphabetical order by first name. Signed-off-by: Andrzej Głąbek Signed-off-by: Andrzej Puzdrowski Signed-off-by: Håkon Øye Amundsen Signed-off-by: Ioannis Glaropoulos Signed-off-by: Joakim Andersson Signed-off-by: Johann Fischer Signed-off-by: Martí Bolívar Signed-off-by: Ole Sæther Signed-off-by: Robert Lubos Signed-off-by: Sebastian Bøe Signed-off-by: Sigvart Hovland Signed-off-by: Thomas Stenersen Signed-off-by: Torsten Rasmussen Signed-off-by: Øyvind Rønningstad Signed-off-by: Trond Einar Snekvik Signed-off-by: Gerard Marull-Paretas Signed-off-by: Tomasz Moń Signed-off-by: Dominik Ermel (cherry picked from commit a7fb26837763ee7c21fb666fe2faa8c7503a17f1) (cherry picked from commit ea83f6ccc7786349ddcf267af19a1b63e0fe950f) --- arch/arm/core/mpu/arm_mpu_regions.c | 13 ++++++ cmake/modules/kernel.cmake | 4 ++ drivers/flash/soc_flash_nrf.c | 11 +++++ .../arch/arm/cortex_m/scripts/linker.ld | 46 +++++++++++++++++++ include/zephyr/storage/flash_map.h | 6 +++ lib/heap/Kconfig | 2 +- lib/libc/common/source/stdlib/malloc.c | 18 +++++++- subsys/fs/littlefs_fs.c | 7 ++- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 +++++++++++ 9 files changed, 130 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index 6af62f84078..cfe1230c907 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,6 +8,9 @@ #include #include +#if USE_PARTITION_MANAGER +#include +#endif static const struct arm_mpu_region mpu_regions[] = { /* Region 0 */ @@ -21,6 +24,14 @@ static const struct arm_mpu_region mpu_regions[] = { #endif /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", +#if USE_PARTITION_MANAGER + PM_SRAM_ADDRESS, +#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) + REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), +#else + REGION_RAM_ATTR(REGION_SRAM_SIZE)), +#endif +#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -28,6 +39,8 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif + +#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index a093d46691f..06e1642f362 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -243,3 +243,7 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() + +if(ZEPHYR_NRF_MODULE_DIR) + include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) +endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index cc840309264..b5a3fefa1e5 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,6 +37,11 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER +#include +#include +#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ + #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -166,6 +171,12 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS + if (addr < PM_APP_ADDRESS) { + return soc_secure_mem_read(data, (void *)addr, len); + } +#endif + nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index d061468d2ac..14eb78f3e70 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -26,6 +26,35 @@ #endif #define RAMABLE_REGION RAM +#if USE_PARTITION_MANAGER + +#include + +#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) +/* We are linking against S1, create symbol containing the flash ID of S0. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S0_ID; + +#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ + +#ifdef PM_S1_ID +/* We are linking against S0, create symbol containing the flash ID of S1. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S1_ID; +#endif /* PM_S1_ID */ + +#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ + +#define ROM_ADDR PM_ADDRESS +#define ROM_SIZE PM_SIZE + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -58,6 +87,23 @@ #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS #endif +#endif /* USE_PARTITION_MANAGER */ + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) +#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) +#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) +#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) +#endif + #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index 37b7c7f3223..c53cbef8957 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -273,6 +273,10 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); +#if USE_PARTITION_MANAGER +#include +#else + /** * Returns non-0 value if fixed-partition of given DTS node label exists. * @@ -330,6 +334,8 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_DEVICE(label) \ DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))) +#endif /* USE_PARTITION_MANAGER */ + #ifdef __cplusplus } #endif diff --git a/lib/heap/Kconfig b/lib/heap/Kconfig index 7f01b280b3b..68476eb735c 100644 --- a/lib/heap/Kconfig +++ b/lib/heap/Kconfig @@ -68,7 +68,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index e3a5db6f7d5..2f469d673e4 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,6 +25,20 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); +#if USE_PARTITION_MANAGER + +#include + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + +#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) +#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS + +#endif /* USE_PARTITION_MANAGER */ + #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -106,8 +120,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ - ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ + ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index b373ca92ba8..3fc84c2922d 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1054,7 +1054,12 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ + .storage_dev = (void *) \ + COND_CODE_1(USE_PARTITION_MANAGER, \ + (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ + (FIXED_PARTITION_ID(littlefs_storage)), \ + (FIXED_PARTITION_ID(storage)))), \ + (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index a74e46b8520..9996e1d74d9 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,8 +13,35 @@ extern "C" { #endif +#if CONFIG_PARTITION_MANAGER_ENABLED + +#include "pm_config.h" + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) +#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE +#else +/* The current image is a child image in a different domain than the image + * which defined the required values. To reach the values of the parent domain + * we use the 'PM__' variant of the define. + */ +#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ + +#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ + +#else + +#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) +#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) + +#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From 4d6f8b4d50b9d0aa76635b5410a02fc18837d03b Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Wed, 20 Mar 2024 12:10:13 +0100 Subject: [PATCH 1814/2300] [nrf noup] samples: smp_svr: configuration for nrf54l15 Configuration allows DFU with serial transport using mcumgr and over BT using nRF Connect. Signed-off-by: Mateusz Michalek --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 6a3669b2438..04e19dfb48e 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -12,9 +12,11 @@ tests: - nrf52840dk/nrf52840 - pinnacle_100_dvk - mg100 + - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 + - nrf54l15pdk/nrf54l15/cpuapp sample.mcumgr.smp_svr.bt_static_svc: extra_args: OVERLAY_CONFIG="overlay-bt.conf" extra_configs: From e2b6a2d4d387e9d38f59befcdade925663125594 Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Tue, 9 Apr 2024 14:24:34 +0200 Subject: [PATCH 1815/2300] [nrf noup] entropy: Add fake entropy nRF PRNG driver This adds temporary entropy driver simulation for nRF54h20 device since final entropy source is not available yet. TODO: Remove this commit when proper solution will be available. Jira: NCSDK-25947 Signed-off-by: Kamil Gawor (cherry picked from commit c976657eb74bfb052d93479be37594bddeff3d86) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 6 ++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 6 ++ drivers/entropy/CMakeLists.txt | 7 ++ drivers/entropy/Kconfig | 1 + drivers/entropy/Kconfig.nrf_prng | 19 ++++ drivers/entropy/fake_entropy_nrf_prng.c | 101 ++++++++++++++++++ dts/bindings/rng/nordic,nrf-prng.yaml | 8 ++ 7 files changed, 148 insertions(+) create mode 100644 drivers/entropy/Kconfig.nrf_prng create mode 100644 drivers/entropy/fake_entropy_nrf_prng.c create mode 100644 dts/bindings/rng/nordic,nrf-prng.yaml diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 93259180e43..f5513a288ab 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -24,6 +24,7 @@ zephyr,sram = &cpuapp_data; zephyr,shell-uart = &uart136; zephyr,bt-hci-ipc = &ipc0; + zephyr,entropy = &prng; }; aliases { @@ -88,6 +89,11 @@ label = "Green LED 3"; }; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; }; &cpuapp_ram0x_region { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index c0b9c0b47b7..d72aa791091 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -25,6 +25,12 @@ zephyr,sram = &cpurad_ram0; zephyr,shell-uart = &uart135; zephyr,bt-hci-ipc = &ipc0; + zephyr,entropy = &prng; + }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; }; }; diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index c3d37e1461a..1ea31981857 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -34,6 +34,13 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE entropy_gecko_se. zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypto.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_NPCX_DRBG entropy_npcx_drbg.c) +if (CONFIG_FAKE_ENTROPY_NRF_PRNG) + zephyr_library_sources(fake_entropy_nrf_prng.c) + + message(WARNING "\nA nRF PRNG is used, which does not produce real random bits." + "This is not secure and should therefore never be used in a product.") +endif() + if (CONFIG_BUILD_WITH_TFM) target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE $/api_ns/interface/include diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index 34c020256bf..b1479756460 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -36,6 +36,7 @@ source "drivers/entropy/Kconfig.neorv32" source "drivers/entropy/Kconfig.bt_hci" source "drivers/entropy/Kconfig.psa_crypto" source "drivers/entropy/Kconfig.npcx" +source "drivers/entropy/Kconfig.nrf_prng" config ENTROPY_HAS_DRIVER bool diff --git a/drivers/entropy/Kconfig.nrf_prng b/drivers/entropy/Kconfig.nrf_prng new file mode 100644 index 00000000000..e1b1a9ab4fe --- /dev/null +++ b/drivers/entropy/Kconfig.nrf_prng @@ -0,0 +1,19 @@ +# nRF fake entropy prng generator driver configuration + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if ENTROPY_GENERATOR + +config FAKE_ENTROPY_NRF_PRNG + bool "A fake nRF entropy driver" + default y + depends on DT_HAS_NORDIC_ENTROPY_PRNG_ENABLED + depends on SOC_SERIES_NRF54HX + select ENTROPY_HAS_DRIVER + help + This is a super simple PRNG driver that can be used on nRF platforms that + do not have an entropy source. + This is NOT SAFE to use for cryptographic operations! + +endif diff --git a/drivers/entropy/fake_entropy_nrf_prng.c b/drivers/entropy/fake_entropy_nrf_prng.c new file mode 100644 index 00000000000..8624c844405 --- /dev/null +++ b/drivers/entropy/fake_entropy_nrf_prng.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#define DT_DRV_COMPAT nordic_entropy_prng + +/* This file implements a pseudo-RNG + * https://vigna.di.unimi.it/xorshift/xoshiro128plus.c + */ + +static uint32_t s[4]; + +static inline uint32_t rotl(const uint32_t x, int k) +{ + return (x << k) | (x >> (32 - k)); +} + +static uint32_t rng_next(void) +{ + const uint32_t result = rotl(s[0] + s[3], 7) + s[0]; + + const uint32_t t = s[1] << 9; + + s[2] ^= s[0]; + s[3] ^= s[1]; + s[1] ^= s[2]; + s[0] ^= s[3]; + + s[2] ^= t; + + s[3] = rotl(s[3], 11); + + return result; +} + +static int entropy_prng_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length) +{ + ARG_UNUSED(dev); + + while (length) { + /* + * Note that only 1 thread (Zephyr thread or HW models), runs at + * a time, therefore there is no need to use random_r() + */ + uint32_t value = rng_next(); + + size_t to_copy = MIN(length, sizeof(long)); + + memcpy(buffer, &value, to_copy); + buffer += to_copy; + length -= to_copy; + } + + return 0; +} + +static int entropy_prng_get_entropy_isr(const struct device *dev, uint8_t *buf, uint16_t len, + uint32_t flags) +{ + ARG_UNUSED(flags); + + int err; + + /* + * entropy_prng_get_entropy() is also safe for ISRs + * and always produces data. + */ + err = entropy_prng_get_entropy(dev, buf, len); + if (err < 0) { + return err; + } else { + return len; + } +} + +static int entropy_prng_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + /* Picked some arbitrary initial seed. */ + s[0] = 0xAF568BC0; + s[1] = 0xAC34307E; + s[2] = 0x9B7F6DD1; + s[3] = 0xD84319FC; + return 0; +} + +static const struct entropy_driver_api entropy_prng_api_funcs = { + .get_entropy = entropy_prng_get_entropy, .get_entropy_isr = entropy_prng_get_entropy_isr}; + +DEVICE_DT_INST_DEFINE(0, entropy_prng_init, NULL, NULL, NULL, PRE_KERNEL_1, + CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prng_api_funcs); diff --git a/dts/bindings/rng/nordic,nrf-prng.yaml b/dts/bindings/rng/nordic,nrf-prng.yaml new file mode 100644 index 00000000000..8936393a0b6 --- /dev/null +++ b/dts/bindings/rng/nordic,nrf-prng.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +description: This is a super simple PRNG + +compatible: "nordic,entropy-prng" + +include: base.yaml From e7aa7008b0c1c668ed4d4a20ee4c5662b57faa31 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Wed, 10 Apr 2024 15:32:12 +0200 Subject: [PATCH 1816/2300] [nrf noup] test-spec: include nrf54 boards in low-level test trigger All changes in nrf54 boards will trigger low-level testing. Signed-off-by: Piotr Kosycarz (cherry picked from commit 3c68e19f4eb40c472b8be4fdff067c2519f7379f) --- .github/test-spec.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index a4776a433f3..876e7eeff04 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -293,6 +293,7 @@ "CI-test-low-level": - "dts/**/*" + - "boards/nordic/nrf54*/**/*" - "include/zephyr/**/*" - "tests/arch/**/*" - "arch/**/*" From c8cc6634d2bd1c03e150342b7b0568c0eb191c92 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 12 Apr 2024 14:13:12 +0200 Subject: [PATCH 1817/2300] [nrf noup] boards: add nrf54l15/nrf54l15/cpuapp/ns as board variant This commit adds the nRF54l15//nrf54l15/cpuapp/ns board variant to sdk-zephyr. It allows to build nRF54l15pdk with TF-M in nRF Connect SDK. This is done as a nrf noup patch as the out-of-tree board extension feature is not available. When zephyrproject-rtos/zephyr#69548 is completed, then this commit can be reverted and the variant be placed in sdk-nrf repository. Signed-off-by: Torsten Rasmussen --- boards/nordic/nrf54l15pdk/Kconfig | 43 ++++++ boards/nordic/nrf54l15pdk/Kconfig.defconfig | 18 +++ boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk | 2 +- boards/nordic/nrf54l15pdk/board.cmake | 8 ++ boards/nordic/nrf54l15pdk/board.yml | 3 + ...rf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi | 38 +++++ .../nrf54l15pdk_nrf54l15_cpuapp_ns.dts | 132 ++++++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp_ns.yaml | 22 +++ .../nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig | 37 +++++ 9 files changed, 302 insertions(+), 1 deletion(-) create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig diff --git a/boards/nordic/nrf54l15pdk/Kconfig b/boards/nordic/nrf54l15pdk/Kconfig index 638ce57499d..db822a14820 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig +++ b/boards/nordic/nrf54l15pdk/Kconfig @@ -11,3 +11,46 @@ config BOARD_ENABLE_DCDC default y endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP + +if BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS + +# TODO: Remove the options bellow when (NCSDK-25023) is done +config NRF_SPU_FLASH_REGION_SIZE + hex + default 0x4000 + # This option does not apply to 54, but we pretend the HW has this limitation + # for now for easier porting. NCSDK-25023 + help + FLASH region size for the NRF_SPU peripheral. For nrf54 the + region size is configurable per-region so this option does + not apply. + +config NRF_SPU_FLASH_REGION_ALIGNMENT + hex + default 0x4000 + # This option does not apply to 54, but we pretend the HW has this limitation + # for now for easier porting. NCSDK-25023 + help + FLASH region size for the NRF_SPU peripheral. For nrf54 the + region size is configurable per-region so this option does + not apply. + +config NRF_SPU_RAM_REGION_SIZE + hex + default 0x2000 + # This HW limitation does not apply to 54, but we pretend + # it does for now for easier porting. NCSDK-25023 + help + RAM region size for the NRF_SPU peripheral. For nrf54 the + region size is configurable per-region so this option does + not apply. + + +config NRF_SPU_RAM_REGION_ALIGNMENT + hex + default 0x1000 + help + RAM regions must be aligned to this value due to SPU HW + limitations. + +endif #BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS diff --git a/boards/nordic/nrf54l15pdk/Kconfig.defconfig b/boards/nordic/nrf54l15pdk/Kconfig.defconfig index 1c83abbb020..3203a5b97ea 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15pdk/Kconfig.defconfig @@ -10,3 +10,21 @@ config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP + +if BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS + +config BT_CTLR + default BT + +# By default, if we build for a Non-Secure version of the board, +# enable building with TF-M as the Secure Execution Environment. +config BUILD_WITH_TFM + default y if BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS + +# 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 + default y + depends on BUILD_WITH_TFM + +endif #BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS diff --git a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk index 12f6e2efd48..36ee21a55b6 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk +++ b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk @@ -2,4 +2,4 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF54L15PDK - select SOC_NRF54L15_ENGA_CPUAPP if BOARD_NRF54L15PDK_NRF54L15_CPUAPP + select SOC_NRF54L15_ENGA_CPUAPP if BOARD_NRF54L15PDK_NRF54L15_CPUAPP || BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS diff --git a/boards/nordic/nrf54l15pdk/board.cmake b/boards/nordic/nrf54l15pdk/board.cmake index 2107fb5d71e..5a1e4b3221d 100644 --- a/boards/nordic/nrf54l15pdk/board.cmake +++ b/boards/nordic/nrf54l15pdk/board.cmake @@ -3,6 +3,14 @@ board_runner_args(jlink "--device=cortex-m33" "--speed=4000") +if(BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS) + set(TFM_PUBLIC_KEY_FORMAT "full") +endif() + +if(CONFIG_TFM_FLASH_MERGED_BINARY) + set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex) +endif() + include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/nordic/nrf54l15pdk/board.yml b/boards/nordic/nrf54l15pdk/board.yml index 3b0fc447385..69b51223209 100644 --- a/boards/nordic/nrf54l15pdk/board.yml +++ b/boards/nordic/nrf54l15pdk/board.yml @@ -3,6 +3,9 @@ board: vendor: nordic socs: - name: nrf54l15 + variants: + - name: ns + cpucluster: cpuapp revision: format: major.minor.patch default: "0.2.1" diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi new file mode 100644 index 00000000000..b4b924e90ef --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&pinctrl { + uart20_default: uart20_default { + group1 { + psels = , + ; + }; + }; + + uart20_sleep: uart20_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart30_default: uart30_default { + group1 { + psels = , + ; + }; + }; + + uart30_sleep: uart30_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + +}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts new file mode 100644 index 00000000000..49fd1ac0ece --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/dts-v1/; +#include +#include "nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi" + +/ { + chosen { + zephyr,console = &uart20; + /* TODO: NCSDK-24862: We don't support configuring RRAM and SRAM + * regions in the DTS file yet. The partition manager configures + * these regions now. + */ + zephyr,shell-uart = &uart20; + zephyr,flash = &rram0; + zephyr,sram = &sram0; + zephyr,ieee802154 = &ieee802154; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + led1: led_1 { + gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + led2: led_2 { + gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + led3: led_3 { + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; + + buttons { + compatible = "gpio-keys"; + button0: button_0 { + gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 0"; + zephyr,code = ; + }; + button1: button_1 { + gpios = <&gpio1 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 1"; + zephyr,code = ; + }; + button2: button_2 { + gpios = <&gpio2 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 2"; + zephyr,code = ; + }; + button3: button_3 { + gpios = <&gpio2 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 3"; + zephyr,code = ; + }; + }; + + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + }; +}; + +&uart20 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart20_default>; + pinctrl-1 = <&uart20_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart30 { + /* Disable so that TF-M can use this UART */ + status = "disabled"; + + current-speed = <115200>; + pinctrl-0 = <&uart30_default>; + pinctrl-1 = <&uart30_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&grtc { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&ieee802154 { + status = "okay"; +}; + +&temp { + status = "okay"; +}; + +&clock { + status = "okay"; +}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml new file mode 100644 index 00000000000..460803eaa53 --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml @@ -0,0 +1,22 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +identifier: nrf54l15pdk/nrf54l15/cpuapp/ns +name: nRF54l15-PDK-nRF54l15-Application-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 256 +flash: 1524 +supported: + - adc + - gpio + - i2c + - spi + - counter + - watchdog + - adc + - i2s diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig new file mode 100644 index 00000000000..ec01756bfd4 --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig @@ -0,0 +1,37 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# This Board implies building Non-Secure firmware +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +# Don't enable the cache in the non-secure image as it is a +# secure-only peripheral on 54l +CONFIG_CACHE_MANAGEMENT=n +CONFIG_EXTERNAL_CACHE=n + +CONFIG_UART_CONSOLE=y +CONFIG_CONSOLE=y +CONFIG_SERIAL=y + +# Enable GPIO +CONFIG_GPIO=y + +# NCSDK-26634: Rollback protection is not supported yet +CONFIG_TFM_PS_ROLLBACK_PROTECTION=n + +# NCSDK-22600: Built-in keys are not supported yet. +CONFIG_TFM_CRYPTO_BUILTIN_KEYS=n + +# Start SYSCOUNTER on driver init +CONFIG_NRF_GRTC_START_SYSCOUNTER=y From 59220de44c52c2f2772ae7647738dbeafb770af1 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Wed, 17 Apr 2024 14:05:02 +0200 Subject: [PATCH 1818/2300] [nrf noup] boards: nordic: nrf54l15pdk: enable HWFC Define RTS and CTS pins. This commit can be dropped when those upstream changes will be included: https://github.com/zephyrproject-rtos/zephyr/pull/70892 https://github.com/zephyrproject-rtos/zephyr/pull/71605 Signed-off-by: Piotr Kosycarz (cherry picked from commit c22c9c258ce776b88dac8a917ab13f46a4c7db85) --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 22 +++++++++++++++---- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 02b02bc8171..96c53f948fc 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -7,14 +7,21 @@ uart20_default: uart20_default { group1 { psels = , - ; + ; + }; + group2 { + psels = , + ; + bias-pull-up; }; }; uart20_sleep: uart20_sleep { group1 { psels = , - ; + , + , + ; low-power-enable; }; }; @@ -22,14 +29,21 @@ uart30_default: uart30_default { group1 { psels = , - ; + ; + }; + group2 { + psels = , + ; + bias-pull-up; }; }; uart30_sleep: uart30_sleep { group1 { psels = , - ; + , + , + ; low-power-enable; }; }; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts index c801ddc8dc5..0b9e76ff083 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -96,6 +96,7 @@ pinctrl-0 = <&uart20_default>; pinctrl-1 = <&uart20_sleep>; pinctrl-names = "default", "sleep"; + hw-flow-control; }; &uart30 { From a41c7c315b0914cbbe54796ce34a5373c35bae50 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 12 Apr 2024 17:53:35 +0200 Subject: [PATCH 1819/2300] [nrf noup] samples/**/smp_svr: testcase of nrf54l15pdk with ext-flash Added description of sample testcase for building smp_svr with support of secondary partition in on PDK spi_nor flash. Signed-off-by: Andrzej Puzdrowski (cherry picked from commit 849d51f27998807371199e36cf7995652b4864a1) --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 04e19dfb48e..81b06ca5634 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -104,3 +104,15 @@ tests: - mg100 integration_platforms: - nrf52840dk/nrf52840 + sample.mcumgr.smp_svr.bt.nrf54l15pdk.ext_flash: + extra_args: + - OVERLAY_CONFIG="overlay-bt.conf" + - DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" + - mcuboot_CONF_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.conf" + - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" + extra_configs: + - CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y + platform_allow: + - nrf54l15pdk/nrf54l15/cpuapp + integration_platforms: + - nrf54l15pdk/nrf54l15/cpuapp From 9a0218b0560aa2613ddf9e22c77dd237d5412bfa Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Fri, 19 Apr 2024 12:58:47 +0200 Subject: [PATCH 1820/2300] [nrf noup] samples: psa_crypto: Remove support for Nordic boards We have our own psa crypto samples to show how to used PSA crypto with NCS. This sample still uses CONFIG_MBEDTLS_BUILTIN which is not supported anymore, therefore removing the support for it in NCS. Ref: NCSDK-17944 Signed-off-by: Markus Swarowsky --- samples/tfm_integration/psa_crypto/sample.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/tfm_integration/psa_crypto/sample.yaml b/samples/tfm_integration/psa_crypto/sample.yaml index 3f25acf88f3..ec0a1f8dd3f 100644 --- a/samples/tfm_integration/psa_crypto/sample.yaml +++ b/samples/tfm_integration/psa_crypto/sample.yaml @@ -12,7 +12,6 @@ tests: - csr - mcuboot platform_allow: mps2/an521/cpu0/ns v2m_musca_s1/musca_s1/ns - nrf5340dk/nrf5340/cpuapp/ns nrf9160dk/nrf9160/ns stm32l562e_dk/stm32l562xx/ns bl5340_dvk/nrf5340/cpuapp/ns harness: console harness_config: From b0b3a063009d891c80c7e0448145034c2cd43e6b Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 12 Apr 2024 11:42:38 +0200 Subject: [PATCH 1821/2300] [nrf noup] boards/nordic/nrf54l15pdk: added mx25r64 flash DTS Added DTS of PDK's mx25r64 flash memory. Memory is described under spi00 peripheral and can be controlled used flash spi_nor driver. To be reverted once upstream PR can be applied cleanly https://github.com/zephyrproject-rtos/zephyr/pull/71425 Signed-off-by: Andrzej Puzdrowski --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 17 ++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.dts | 27 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 96c53f948fc..31c2f820f3f 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -47,4 +47,21 @@ low-power-enable; }; }; + + spi0_default: spi0_default { + group1 { + psels = , + , + ; + }; + }; + + spi0_sleep: spi0_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; }; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts index 0b9e76ff083..e6ef815e783 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -77,6 +77,7 @@ sw1 = &button1; sw2 = &button2; sw3 = &button3; + spi-flash0 = &mx25r64; }; }; @@ -174,3 +175,29 @@ &clock { status = "okay"; }; + +&spi00 { + status = "okay"; + cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&spi0_default>; + pinctrl-1 = <&spi0_sleep>; + pinctrl-names = "default", "sleep"; + + mx25r64: mx25r6435f@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + status = "disabled"; + spi-max-frequency = <8000000>; + jedec-id = [c2 28 17]; + sfdp-bfp = [ + e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb + ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 + 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 48 44 + 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff + ]; + size = <67108864>; + has-dpd; + t-enter-dpd = <10000>; + t-exit-dpd = <35000>; + }; +}; From 1970b3c5484050540a2705af7a47eb14038c6764 Mon Sep 17 00:00:00 2001 From: Grzegorz Chwierut Date: Wed, 24 Apr 2024 12:22:51 +0200 Subject: [PATCH 1822/2300] [nrf noup] boards: nrf54l15pdk: ROM_START_OFFSET Sets up default for builds with partition manager. Signed-off-by: Mateusz Michalek Signed-off-by: Grzegorz Chwierut --- boards/nordic/nrf54l15pdk/Kconfig.defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54l15pdk/Kconfig.defconfig b/boards/nordic/nrf54l15pdk/Kconfig.defconfig index 3203a5b97ea..87b8c1d0cc3 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15pdk/Kconfig.defconfig @@ -7,6 +7,7 @@ config BT_CTLR default BT config ROM_START_OFFSET + default 0 if PARTITION_MANAGER_ENABLED default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP From 00bf0097c3a178b2b223fa5c9d3378ae2d96d02f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Wed, 7 Feb 2024 14:21:59 +0100 Subject: [PATCH 1823/2300] [nrf noup] boards: Enable ADC in nRF54L15 PDK configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simple enabling adc node. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68692 Applied as noup because it can't be applied cleanly. Signed-off-by: Karol Lasończyk (cherry picked from commit 88adda3b14f726645c0a3ebac6d6fab571144f11) --- boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts index e6ef815e783..f64952ba886 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -201,3 +201,7 @@ t-exit-dpd = <35000>; }; }; + +&adc { + status = "okay"; +}; From 15cc59d1c2507d330c1eb58c359d3fc681b961a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Fri, 26 Apr 2024 16:32:56 +0200 Subject: [PATCH 1824/2300] [nrf noup] boards: nordic: Add PWM support for LEDs on nRF54 DKs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds support for first possible LED to be connected with HW PWM. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72010 Merged as noup because of conflicts. Signed-off-by: Karol Lasończyk (cherry picked from commit 382a1ee791e3637b5b7d25f22905017c24997438) --- .../nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi | 13 +++++++++++++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 15 +++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 13 +++++++++++++ .../nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts | 15 +++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay | 15 +++++++++++++++ 5 files changed, 71 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi index 6c6da3fa747..0c842057d64 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -50,4 +50,17 @@ ; }; }; + + /omit-if-no-ref/ pwm120_default: pwm120_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm120_sleep: pwm120_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index f5513a288ab..5406d113833 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -32,6 +32,7 @@ led1 = &led1; led2 = &led2; led3 = &led3; + pwm-led0 = &pwm_led0; sw0 = &button0; sw1 = &button1; sw2 = &button2; @@ -90,6 +91,13 @@ }; }; + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm120 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + }; + }; + prng: prng { compatible = "nordic,entropy-prng"; status = "okay"; @@ -194,3 +202,10 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-names = "default", "sleep"; hw-flow-control; }; + +&pwm120 { + status = "okay"; + pinctrl-0 = <&pwm120_default>; + pinctrl-1 = <&pwm120_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 31c2f820f3f..89ad7599870 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -64,4 +64,17 @@ low-power-enable; }; }; + + /omit-if-no-ref/ pwm20_default: pwm20_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; }; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts index f64952ba886..395f92d638c 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -43,6 +43,13 @@ }; }; + pwmleds { + compatible = "pwm-leds"; + pwm_led1: pwm_led_1 { + pwms = <&pwm20 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + }; + }; + buttons { compatible = "gpio-keys"; button0: button_0 { @@ -72,6 +79,7 @@ led1 = &led1; led2 = &led2; led3 = &led3; + pwm-led0 = &pwm_led1; watchdog0 = &wdt30; sw0 = &button0; sw1 = &button1; @@ -205,3 +213,10 @@ &adc { status = "okay"; }; + +&pwm20 { + status = "okay"; + pinctrl-0 = <&pwm20_default>; + pinctrl-1 = <&pwm20_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay index d8262dde994..99ba6ff3062 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay @@ -36,3 +36,18 @@ &button3 { gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; }; + +&pinctrl { + /omit-if-no-ref/ pwm20_default: pwm20_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; From 34de08466ee7197576cfa11663b264d0fec57c9a Mon Sep 17 00:00:00 2001 From: Jan Tore Guggedal Date: Tue, 30 Apr 2024 11:16:03 +0200 Subject: [PATCH 1825/2300] [nrf noup] drivers: flash: Fix spi_nor_set_address_mode and exit_dpd There was unneeded check for enter_4byte_addr_exist, that would be set by existence of enter-4byte-addr property, as the function is generic DTS/SFPD implementation and parsed parameter to obtain the information. The check was breaking usage of SFDP as with SFDP the parameter may never be provided. The commit removes the check and the enter_4byte_addr_exist, as it does not seem needed for anything. The incorrectly placed conditional compilation for DPD exit sequence has broken DPD exit in case where such sequence is not needed. Signed-off-by: Dominik Ermel Signed-off-by: Jan Tore Guggedal --- drivers/flash/spi_nor.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/flash/spi_nor.c b/drivers/flash/spi_nor.c index 39741df085f..0b4ab8fba0d 100644 --- a/drivers/flash/spi_nor.c +++ b/drivers/flash/spi_nor.c @@ -155,7 +155,6 @@ struct spi_nor_config { bool dpd_exist:1; bool dpd_wakeup_sequence_exist:1; bool mxicy_mx25r_power_mode_exist:1; - bool enter_4byte_addr_exist:1; bool reset_gpios_exist:1; bool requires_ulbpr_exist:1; bool wp_gpios_exist:1; @@ -520,10 +519,11 @@ static int exit_dpd(const struct device *const dev) const struct spi_nor_config *cfg = dev->config; if (cfg->dpd_exist) { +#if ANY_INST_HAS_DPD delay_until_exit_dpd_ok(dev); -#if ANY_INST_HAS_DPD_WAKEUP_SEQUENCE if (cfg->dpd_wakeup_sequence_exist) { +#if ANY_INST_HAS_DPD_WAKEUP_SEQUENCE /* Assert CSn and wait for tCRDP. * * Unfortunately the SPI API doesn't allow us to @@ -536,6 +536,7 @@ static int exit_dpd(const struct device *const dev) /* Deassert CSn and wait for tRDP */ k_sleep(K_MSEC(cfg->t_rdp_ms)); +#endif /* DPD_WAKEUP_SEQUENCE */ } else { ret = spi_nor_cmd_write(dev, SPI_NOR_CMD_RDPD); @@ -547,7 +548,7 @@ static int exit_dpd(const struct device *const dev) } #endif /* T_EXIT_DPD */ } -#endif /* DPD_WAKEUP_SEQUENCE */ +#endif /* ANY_INST_HAS_DPD */ } return ret; } @@ -1036,10 +1037,8 @@ static int spi_nor_read_jedec_id(const struct device *dev, static int spi_nor_set_address_mode(const struct device *dev, uint8_t enter_4byte_addr) { - const struct spi_nor_config *cfg = dev->config; - int ret = -ENOSYS; + int ret = 0; - if (cfg->enter_4byte_addr_exist) { /* Do nothing if not provided (either no bits or all bits * set). */ @@ -1074,7 +1073,6 @@ static int spi_nor_set_address_mode(const struct device *dev, } release_device(dev); - } return ret; } @@ -1664,7 +1662,6 @@ static const struct flash_driver_api spi_nor_api = { .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), \ - .enter_4byte_addr_exist = DT_INST_NODE_HAS_PROP(idx, enter_4byte_addr), \ .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), \ From 137ea1e810dcf50247e1a204b64ca7b0c080e3b2 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 24 Apr 2024 07:57:33 +0100 Subject: [PATCH 1826/2300] [nrf fromtree] cmake: boards: Fix missing board name Fixes an issue whereby the board name was missing Signed-off-by: Jamie McCrae (cherry picked from commit 23551eb05a4adc858187fa752e512878d23b08d1) --- cmake/modules/boards.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/boards.cmake b/cmake/modules/boards.cmake index b1e2b21abce..ec9b6579146 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -319,7 +319,7 @@ elseif(HWMv2) unset(CACHED_BOARD CACHE) message(FATAL_ERROR "Board qualifiers `${BOARD_QUALIFIERS}` for board \ `${BOARD}` not found. Please specify a valid board target.\n" - "Valid board targets for ${BOARD_NAME} are:\n${board_targets}\n") + "Valid board targets for ${LIST_BOARD_NAME} are:\n${board_targets}\n") endif() endif() else() From d7e52c2a82f80e0f9215790af10a0db5303ba217 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 29 Apr 2024 09:40:24 +0100 Subject: [PATCH 1827/2300] [nrf fromtree] scripts: module: Fix sysbuild module listing Fixes an issue with zephyr modules not being listed in sysbuild if they did not have a Kconfig file set Signed-off-by: Jamie McCrae (cherry picked from commit acd14f8af24704c0336cbe373c52807ee81b6a08) --- scripts/zephyr_module.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index ab27eaa5706..b5b257ed712 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -370,14 +370,15 @@ def process_sysbuildkconfig(module, meta): 'not point to a valid Kconfig file.' .format(module_yml, kconfig_setting)) - if kconfig_setting is None: - return "" + if kconfig_setting is not None: + kconfig_file = os.path.join(module, kconfig_setting) + if os.path.isfile(kconfig_file): + return kconfig_snippet(meta, module_path, Path(kconfig_file)) - kconfig_file = os.path.join(module, kconfig_setting) - if os.path.isfile(kconfig_file): - return kconfig_snippet(meta, module_path, Path(kconfig_file)) - else: - return "" + name_sanitized = meta['name-sanitized'] + return (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' + f' bool\n' + f' default y\n') def process_twister(module, meta): From 50c9a918bd6ebe8289a8321f05d45250a6d70c2c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 11 Apr 2024 09:02:46 +0100 Subject: [PATCH 1828/2300] [nrf fromtree] cmake: modules: extensions: Fix documentation for zephyr_build_string Fixes a missed entry and a wrong named variable in the documentation for this function Signed-off-by: Jamie McCrae (cherry picked from commit 43c323a835769cf492e525a35c402b4161331d0a) --- cmake/modules/extensions.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 2c1866c422a..bfe9bf78b45 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1532,6 +1532,7 @@ endfunction() # Usage: # zephyr_build_string( # BOARD +# [SHORT ] # [BOARD_QUALIFIERS ] # [BOARD_REVISION ] # [BUILD ] @@ -1565,7 +1566,7 @@ endfunction() # `alpha_soc_bar_1_0_0;alpha_soc_bar` in `build_string` parameter. # # calling -# zephyr_build_string(build_string SHORTENED short_build_string BOARD alpha BOARD_REVISION 1.0.0 BOARD_QUALIFIERS /soc/bar MERGE) +# zephyr_build_string(build_string SHORT short_build_string BOARD alpha BOARD_REVISION 1.0.0 BOARD_QUALIFIERS /soc/bar MERGE) # will return two lists of the following strings # `alpha_soc_bar_1_0_0;alpha_soc_bar` in `build_string` parameter. # `alpha_bar_1_0_0;alpha_bar` in `short_build_string` parameter. From 22ee8f7133cc83672703c3417257061afe92e360 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 10 Apr 2024 13:58:54 +0100 Subject: [PATCH 1829/2300] [nrf fromtree] cmake: Add support for socs folder and Kconfig fragments Adds support for a new ``socs`` folder that can be placed in application folders and functions similar to the ``boards`` folder, but works for SoCs instead of boards Signed-off-by: Jamie McCrae (cherry picked from commit 6f58159a72e0eeed8a7ed6aec168e8c724ce6a22) --- cmake/modules/configuration_files.cmake | 1 + cmake/modules/extensions.cmake | 48 ++++++++++++++++++------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/cmake/modules/configuration_files.cmake b/cmake/modules/configuration_files.cmake index 78e7bf2a494..dda142441ed 100644 --- a/cmake/modules/configuration_files.cmake +++ b/cmake/modules/configuration_files.cmake @@ -45,6 +45,7 @@ endif() zephyr_get(CONF_FILE SYSBUILD LOCAL) if(NOT DEFINED CONF_FILE) zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR} KCONF CONF_FILE NAMES "prj.conf" SUFFIX ${FILE_SUFFIX} REQUIRED) + zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/socs KCONF CONF_FILE QUALIFIERS SUFFIX ${FILE_SUFFIX}) zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/boards KCONF CONF_FILE SUFFIX ${FILE_SUFFIX}) else() string(CONFIGURE "${CONF_FILE}" CONF_FILE_EXPANDED) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index bfe9bf78b45..a4a33ffe137 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1538,6 +1538,11 @@ endfunction() # [BUILD ] # [MERGE [REVERSE]] # ) +# zephyr_build_string( +# BOARD_QUALIFIERS +# [BUILD ] +# [MERGE [REVERSE]] +# ) # # : Output variable where the build string will be returned. # SHORT : Output variable where the shortened build string will be returned. @@ -1571,6 +1576,10 @@ endfunction() # `alpha_soc_bar_1_0_0;alpha_soc_bar` in `build_string` parameter. # `alpha_bar_1_0_0;alpha_bar` in `short_build_string` parameter. # +# calling +# zephyr_build_string(build_string BOARD_QUALIFIERS /soc/bar/foo) +# will return the string `soc_bar_foo` in `build_string` parameter. +# function(zephyr_build_string outvar) set(options MERGE REVERSE) set(single_args BOARD BOARD_QUALIFIERS BOARD_REVISION BUILD SHORT) @@ -1590,10 +1599,17 @@ function(zephyr_build_string outvar) ) endif() - if(DEFINED BUILD_STR_BOARD_QUALIFIERS AND NOT BUILD_STR_BOARD) + if(DEFINED BUILD_STR_BOARD_REVISION AND NOT DEFINED BUILD_STR_BOARD) message(FATAL_ERROR - "zephyr_build_string(${ARGV0} BOARD_QUALIFIERS ${BUILD_STR_BOARD_QUALIFIERS} ...)" - " given without BOARD argument, please specify BOARD" + "zephyr_build_string(${ARGV0} BOARD_REVISION ${BUILD_STR_BOARD_REVISION} ...)" + " given without BOARD argument, these must be used together" + ) + endif() + + if(DEFINED BUILD_STR_SHORT AND NOT DEFINED BUILD_STR_BOARD) + message(FATAL_ERROR + "zephyr_build_string(${ARGV0} SHORT ${BUILD_STR_SHORT} ...)" + " given without BOARD argument, these must be used together" ) endif() @@ -2572,7 +2588,7 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES") if(${ARGV0} STREQUAL APPLICATION_ROOT) set(single_args APPLICATION_ROOT) elseif(${ARGV0} STREQUAL CONF_FILES) - set(options REQUIRED) + set(options QUALIFIERS REQUIRED) set(single_args BOARD BOARD_REVISION BOARD_QUALIFIERS DTS KCONF DEFCONFIG BUILD SUFFIX) set(multi_args CONF_FILES NAMES) endif() @@ -2641,14 +2657,22 @@ Relative paths are only allowed with `-D${ARGV1}=`") set(dts_filename_list ${ZFILE_NAMES}) set(kconf_filename_list ${ZFILE_NAMES}) else() - zephyr_build_string(filename_list - SHORT shortened_filename_list - BOARD ${ZFILE_BOARD} - BOARD_REVISION ${ZFILE_BOARD_REVISION} - BOARD_QUALIFIERS ${ZFILE_BOARD_QUALIFIERS} - BUILD ${ZFILE_BUILD} - MERGE REVERSE - ) + if(NOT ZFILE_QUALIFIERS) + zephyr_build_string(filename_list + SHORT shortened_filename_list + BOARD ${ZFILE_BOARD} + BOARD_REVISION ${ZFILE_BOARD_REVISION} + BOARD_QUALIFIERS ${ZFILE_BOARD_QUALIFIERS} + BUILD ${ZFILE_BUILD} + MERGE REVERSE + ) + else() + zephyr_build_string(filename_list + BOARD_QUALIFIERS ${ZFILE_BOARD_QUALIFIERS} + BUILD ${ZFILE_BUILD} + MERGE REVERSE + ) + endif() set(dts_filename_list ${filename_list}) set(dts_shortened_filename_list ${shortened_filename_list}) From b42c69e229f651f4a154d948fe04f55d5598e704 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 11 Apr 2024 09:15:41 +0100 Subject: [PATCH 1830/2300] [nrf fromtree] cmake: modules: configuration_files: Add support for soc overlays Adds support for SoC overlay files which go in a ``socs`` folder in application folders and functions similar to the ``boards`` folder, but works for SoCs instead of boards Signed-off-by: Jamie McCrae (cherry picked from commit 6ed5ac7111409196f0f31b81eb13fbcb748a2747) --- cmake/modules/configuration_files.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/modules/configuration_files.cmake b/cmake/modules/configuration_files.cmake index dda142441ed..2bd843a0d8d 100644 --- a/cmake/modules/configuration_files.cmake +++ b/cmake/modules/configuration_files.cmake @@ -76,9 +76,10 @@ zephyr_boilerplate_watch(CONF_FILE) zephyr_get(DTC_OVERLAY_FILE SYSBUILD LOCAL) -# If DTC_OVERLAY_FILE is not set by the user, look for board-specific overlays -# in the 'boards' configuration subdirectory. +# If DTC_OVERLAY_FILE is not set by the user, look for SoC and board-specific overlays +# in the 'boards' and `soc` configuration subdirectories. if(NOT DEFINED DTC_OVERLAY_FILE) + zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/socs DTS DTC_OVERLAY_FILE QUALIFIERS SUFFIX ${FILE_SUFFIX}) zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/boards DTS DTC_OVERLAY_FILE SUFFIX ${FILE_SUFFIX}) endif() @@ -91,7 +92,6 @@ if(NOT DEFINED DTC_OVERLAY_FILE) NAMES "app.overlay" SUFFIX ${FILE_SUFFIX} ) endif() - endif() set(DTC_OVERLAY_FILE ${DTC_OVERLAY_FILE} CACHE STRING "If desired, you can \ From 6df96e93c6331878e1be41fc2f1baf575d688576 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 11 Apr 2024 12:03:27 +0100 Subject: [PATCH 1831/2300] [nrf fromtree] tests: cmake: overlays: Add soc_folder_kconfig test Adds a testcase for the new ``socs`` folder using Kconfig fragments Signed-off-by: Jamie McCrae (cherry picked from commit 1ed6d89d13b5bcfa1e257d423b43e645a15d4894) --- .../soc_folder_kconfig/CMakeLists.txt | 9 ++ .../cmake/overlays/soc_folder_kconfig/Kconfig | 32 ++++ .../boards/native_sim_native.conf | 2 + .../boards/native_sim_native_64.conf | 2 + .../native_sim_native_64_somesuffix.conf | 2 + .../boards/native_sim_native_somesuffix.conf | 2 + .../soc_folder_kconfig/boards/other.conf | 3 + .../overlays/soc_folder_kconfig/prj.conf | 1 + .../soc_folder_kconfig/socs/native.conf | 2 + .../soc_folder_kconfig/socs/native_64.conf | 2 + .../socs/native_64_somesuffix.conf | 2 + .../socs/native_somesuffix.conf | 2 + .../soc_folder_kconfig/socs/other.conf | 2 + .../overlays/soc_folder_kconfig/src/main.c | 139 ++++++++++++++++++ .../overlays/soc_folder_kconfig/testcase.yaml | 26 ++++ 15 files changed, 228 insertions(+) create mode 100644 tests/cmake/overlays/soc_folder_kconfig/CMakeLists.txt create mode 100644 tests/cmake/overlays/soc_folder_kconfig/Kconfig create mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64_somesuffix.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_somesuffix.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/other.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/prj.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/native.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/native_64.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/native_64_somesuffix.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/native_somesuffix.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/other.conf create mode 100644 tests/cmake/overlays/soc_folder_kconfig/src/main.c create mode 100644 tests/cmake/overlays/soc_folder_kconfig/testcase.yaml diff --git a/tests/cmake/overlays/soc_folder_kconfig/CMakeLists.txt b/tests/cmake/overlays/soc_folder_kconfig/CMakeLists.txt new file mode 100644 index 00000000000..db78c7333ef --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/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(overlays_soc_folder_kconfig) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/cmake/overlays/soc_folder_kconfig/Kconfig b/tests/cmake/overlays/soc_folder_kconfig/Kconfig new file mode 100644 index 00000000000..fcc64e50e5c --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/Kconfig @@ -0,0 +1,32 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FOLDER_TEST_STRING + string "Test string" + default "one" + +config SOC_FOLDER_TEST_INCLUDE_BOARD + bool "Included board Kconfig fragment" + +config SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX + bool "Included board Kconfig fragment with suffix" + +config SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS + bool "Included board with qualifiers Kconfig fragment" + +config SOC_FOLDER_TEST_INCLUDE_BOARD_OTHER + bool "Included other board Kconfig fragment" + +config SOC_FOLDER_TEST_INCLUDE_SOC + bool "Included soc Kconfig fragment" + +config SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX + bool "Included soc overlay Kconfig fragment" + +config SOC_FOLDER_TEST_INCLUDE_SOC_OTHER + bool "Included other soc overlay Kconfig fragment" + +config TEST_TYPE + int "Test type" + +source "Kconfig.zephyr" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native.conf new file mode 100644 index 00000000000..4e5465df698 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native.conf @@ -0,0 +1,2 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD=y +CONFIG_SOC_FOLDER_TEST_STRING="two" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64.conf new file mode 100644 index 00000000000..f14979567c0 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64.conf @@ -0,0 +1,2 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS=y +CONFIG_SOC_FOLDER_TEST_STRING="five" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64_somesuffix.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64_somesuffix.conf new file mode 100644 index 00000000000..c77f9d10a7e --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64_somesuffix.conf @@ -0,0 +1,2 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX=y +CONFIG_SOC_FOLDER_TEST_STRING="four" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_somesuffix.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_somesuffix.conf new file mode 100644 index 00000000000..c77f9d10a7e --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_somesuffix.conf @@ -0,0 +1,2 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX=y +CONFIG_SOC_FOLDER_TEST_STRING="four" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/other.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/other.conf new file mode 100644 index 00000000000..4a8bc05df97 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/boards/other.conf @@ -0,0 +1,3 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_OTHER=y +CONFIG_SOC_FOLDER_TEST_STRING="three" +CONFIG_ZTEST=y diff --git a/tests/cmake/overlays/soc_folder_kconfig/prj.conf b/tests/cmake/overlays/soc_folder_kconfig/prj.conf new file mode 100644 index 00000000000..9467c292689 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/prj.conf @@ -0,0 +1 @@ +CONFIG_ZTEST=y diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/native.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/native.conf new file mode 100644 index 00000000000..ad2c3bb4ab6 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/socs/native.conf @@ -0,0 +1,2 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC=y +CONFIG_SOC_FOLDER_TEST_STRING="seven" diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/native_64.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/native_64.conf new file mode 100644 index 00000000000..5b99d60a0cc --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/socs/native_64.conf @@ -0,0 +1,2 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC=y +CONFIG_SOC_FOLDER_TEST_STRING="six" diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/native_64_somesuffix.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/native_64_somesuffix.conf new file mode 100644 index 00000000000..3eac9628cec --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/socs/native_64_somesuffix.conf @@ -0,0 +1,2 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX=y +CONFIG_SOC_FOLDER_TEST_STRING="eight" diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/native_somesuffix.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/native_somesuffix.conf new file mode 100644 index 00000000000..3eac9628cec --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/socs/native_somesuffix.conf @@ -0,0 +1,2 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX=y +CONFIG_SOC_FOLDER_TEST_STRING="eight" diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/other.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/other.conf new file mode 100644 index 00000000000..aff49c6a975 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/socs/other.conf @@ -0,0 +1,2 @@ +CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_OTHER=y +CONFIG_SOC_FOLDER_TEST_STRING="nine" diff --git a/tests/cmake/overlays/soc_folder_kconfig/src/main.c b/tests/cmake/overlays/soc_folder_kconfig/src/main.c new file mode 100644 index 00000000000..2a3c69c02b5 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/src/main.c @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#ifdef CONFIG_SOC_FOLDER_TEST_STRING +#define STRING_OUTPUT CONFIG_SOC_FOLDER_TEST_STRING +#else +#error "Invalid test configuration" +#endif + +#ifndef CONFIG_TEST_TYPE +#error "Invalid test configuration" +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD +#define INCLUDED_BOARD 1 +#else +#define INCLUDED_BOARD 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX +#define INCLUDED_BOARD_SUFFIX 1 +#else +#define INCLUDED_BOARD_SUFFIX 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS +#define INCLUDED_BOARD_QUALIFIERS 1 +#else +#define INCLUDED_BOARD_QUALIFIERS 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_OTHER +#define INCLUDED_BOARD_OTHER 1 +#else +#define INCLUDED_BOARD_OTHER 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC +#define INCLUDED_SOC 1 +#else +#define INCLUDED_SOC 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX +#define INCLUDED_SOC_SUFFIX 1 +#else +#define INCLUDED_SOC_SUFFIX 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_OTHER +#define INCLUDED_SOC_OTHER 1 +#else +#define INCLUDED_SOC_OTHER 0 +#endif + +#if CONFIG_TEST_TYPE == 0 +/* Default test */ +ZTEST(soc_folder_kconfig, test_default) +{ + zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix config to be present"); + +#ifdef CONFIG_BOARD_NATIVE_SIM_NATIVE_64 + zassert_false(INCLUDED_BOARD, "Did not expect board config to be present"); + zassert_true(INCLUDED_BOARD_QUALIFIERS, "Expected board qualifier config to be present"); + zassert_mem_equal(STRING_OUTPUT, "five", strlen("five"), "Expected string to match"); +#else + zassert_true(INCLUDED_BOARD, "Expected board config to be present"); + zassert_false(INCLUDED_BOARD_QUALIFIERS, + "Did not expect board qualifier config to be present"); + zassert_mem_equal(STRING_OUTPUT, "two", strlen("two"), "Expected string to match"); +#endif + + zassert_false(INCLUDED_BOARD_OTHER, "Did not expect board other config to be present"); + zassert_true(INCLUDED_SOC, "Expect soc config to be present"); + zassert_false(INCLUDED_SOC_SUFFIX, "Did not expect soc suffix config to be present"); + zassert_false(INCLUDED_SOC_OTHER, "Did not expect soc other config to be present"); +} +#elif CONFIG_TEST_TYPE == 1 +/* File suffix test */ +ZTEST(soc_folder_kconfig, test_suffix) +{ + zassert_true(INCLUDED_BOARD_SUFFIX, "Expected board suffix config to be present"); + + zassert_false(INCLUDED_BOARD, "Did not expect board config to be present"); + zassert_false(INCLUDED_BOARD_QUALIFIERS, + "Did not expect board qualifier config to be present"); + zassert_mem_equal(STRING_OUTPUT, "four", strlen("four"), "Expected string to match"); + zassert_false(INCLUDED_BOARD_OTHER, "Did not expect board other config to be present"); + zassert_false(INCLUDED_SOC, "Did not expect soc config to be present"); + zassert_true(INCLUDED_SOC_SUFFIX, "Expected soc suffix config to be present"); + zassert_false(INCLUDED_SOC_OTHER, "Did not expect soc other config to be present"); +} +#elif CONFIG_TEST_TYPE == 2 +/* Conf file test */ +ZTEST(soc_folder_kconfig, test_conf) +{ + zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix config to be present"); + +#ifdef CONFIG_BOARD_NATIVE_SIM_NATIVE_64 + zassert_false(INCLUDED_BOARD, "Did not expect board config to be present"); + zassert_true(INCLUDED_BOARD_QUALIFIERS, + "Expected board qualifier config to be present"); +#else + zassert_true(INCLUDED_BOARD, "Expected board config to be present"); + zassert_false(INCLUDED_BOARD_QUALIFIERS, + "Did not expect board qualifier config to be present"); +#endif + + zassert_mem_equal(STRING_OUTPUT, "three", strlen("three"), "Expected string to match"); + + zassert_true(INCLUDED_BOARD_OTHER, "Expected board other config to be present"); + zassert_true(INCLUDED_SOC, "Expected soc config to be present"); + zassert_false(INCLUDED_SOC_SUFFIX, "Did not expect soc suffix config to be present"); + zassert_false(INCLUDED_SOC_OTHER, "Did not expect soc other config to be present"); +} +#elif CONFIG_TEST_TYPE == 3 +/* File suffix and conf file test */ +ZTEST(soc_folder_kconfig, test_suffix_conf) +{ + zassert_true(INCLUDED_BOARD_SUFFIX, "Expected board suffix config to be present"); + zassert_false(INCLUDED_BOARD, "Did not expect board config to be present"); + zassert_false(INCLUDED_BOARD_QUALIFIERS, + "Did not expect board qualifier config to be present"); + zassert_mem_equal(STRING_OUTPUT, "three", strlen("three"), "Expected string to match"); + zassert_true(INCLUDED_BOARD_OTHER, "Expected board other config to be present"); + zassert_false(INCLUDED_SOC, "Did not expect soc config to be present"); + zassert_true(INCLUDED_SOC_SUFFIX, "Expected soc suffix config to be present"); + zassert_false(INCLUDED_SOC_OTHER, "Did not expect soc other config to be present"); +} +#else +#error "Invalid test type" +#endif + +ZTEST_SUITE(soc_folder_kconfig, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/cmake/overlays/soc_folder_kconfig/testcase.yaml b/tests/cmake/overlays/soc_folder_kconfig/testcase.yaml new file mode 100644 index 00000000000..32b8e5487b3 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_kconfig/testcase.yaml @@ -0,0 +1,26 @@ +common: + tags: + - cmake + platform_allow: + - native_sim + - native_sim/native/64 + integration_platforms: + - native_sim + - native_sim/native/64 +tests: + cmake.overlays.soc_folder_kconfig.default: + extra_args: + - CONFIG_TEST_TYPE=0 + cmake.overlays.soc_folder_kconfig.suffix: + extra_args: + - CONFIG_TEST_TYPE=1 + - FILE_SUFFIX=somesuffix + cmake.overlays.soc_folder_kconfig.conf: + extra_args: + - CONFIG_TEST_TYPE=2 + - EXTRA_CONF_FILE=boards/other.conf + cmake.overlays.soc_folder_kconfig.suffix.conf: + extra_args: + - CONFIG_TEST_TYPE=3 + - FILE_SUFFIX=somesuffix + - EXTRA_CONF_FILE=boards/other.conf From b57fbe421a80ecb94e2a5504db4b859bb234ed6f Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 11 Apr 2024 12:56:09 +0100 Subject: [PATCH 1832/2300] [nrf fromtree] tests: cmake: overlays: Add soc_folder_overlay test Adds a testcase for the new ``socs`` folder, with overlays Signed-off-by: Jamie McCrae (cherry picked from commit da3007e5595de074b49b374f1f220b05648507b3) --- .../soc_folder_overlay/CMakeLists.txt | 9 ++ .../cmake/overlays/soc_folder_overlay/Kconfig | 31 ++++++ .../overlays/soc_folder_overlay/app.overlay | 5 + .../boards/native_sim_native.overlay | 5 + .../boards/native_sim_native_64.overlay | 5 + .../native_sim_native_64_somesuffix.overlay | 5 + .../native_sim_native_somesuffix.overlay | 5 + .../overlays/soc_folder_overlay/prj.conf | 1 + .../soc_folder_overlay/socs/native.overlay | 5 + .../soc_folder_overlay/socs/native_64.overlay | 5 + .../socs/native_64_somesuffix.overlay | 5 + .../socs/native_somesuffix.overlay | 5 + .../overlays/soc_folder_overlay/src/main.c | 96 +++++++++++++++++++ .../overlays/soc_folder_overlay/testcase.yaml | 30 ++++++ 14 files changed, 212 insertions(+) create mode 100644 tests/cmake/overlays/soc_folder_overlay/CMakeLists.txt create mode 100644 tests/cmake/overlays/soc_folder_overlay/Kconfig create mode 100644 tests/cmake/overlays/soc_folder_overlay/app.overlay create mode 100644 tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native.overlay create mode 100644 tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64.overlay create mode 100644 tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64_somesuffix.overlay create mode 100644 tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_somesuffix.overlay create mode 100644 tests/cmake/overlays/soc_folder_overlay/prj.conf create mode 100644 tests/cmake/overlays/soc_folder_overlay/socs/native.overlay create mode 100644 tests/cmake/overlays/soc_folder_overlay/socs/native_64.overlay create mode 100644 tests/cmake/overlays/soc_folder_overlay/socs/native_64_somesuffix.overlay create mode 100644 tests/cmake/overlays/soc_folder_overlay/socs/native_somesuffix.overlay create mode 100644 tests/cmake/overlays/soc_folder_overlay/src/main.c create mode 100644 tests/cmake/overlays/soc_folder_overlay/testcase.yaml diff --git a/tests/cmake/overlays/soc_folder_overlay/CMakeLists.txt b/tests/cmake/overlays/soc_folder_overlay/CMakeLists.txt new file mode 100644 index 00000000000..dbd1fab670d --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/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(overlays_soc_folder_overlay) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/cmake/overlays/soc_folder_overlay/Kconfig b/tests/cmake/overlays/soc_folder_overlay/Kconfig new file mode 100644 index 00000000000..a49375710f3 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/Kconfig @@ -0,0 +1,31 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FOLDER_TEST_INCLUDE_APP + bool + default "$(dt_alias_enabled,test-app)" + +config SOC_FOLDER_TEST_INCLUDE_BOARD + bool + default "$(dt_alias_enabled,test-board)" + +config SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX + bool + default "$(dt_alias_enabled,test-board-suffix)" + +config SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS + bool + default "$(dt_alias_enabled,test-board-qualifiers)" + +config SOC_FOLDER_TEST_INCLUDE_SOC + bool + default "$(dt_alias_enabled,test-soc)" + +config SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX + bool + default "$(dt_alias_enabled,test-soc-suffix)" + +config TEST_TYPE + int "Test type" + +source "Kconfig.zephyr" diff --git a/tests/cmake/overlays/soc_folder_overlay/app.overlay b/tests/cmake/overlays/soc_folder_overlay/app.overlay new file mode 100644 index 00000000000..ad861b3e462 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/app.overlay @@ -0,0 +1,5 @@ +/ { + aliases { + test-app = &uart0; + }; +}; diff --git a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native.overlay b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native.overlay new file mode 100644 index 00000000000..126168af115 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native.overlay @@ -0,0 +1,5 @@ +/ { + aliases { + test-board = &uart0; + }; +}; diff --git a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64.overlay b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64.overlay new file mode 100644 index 00000000000..5db22cfdfc4 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64.overlay @@ -0,0 +1,5 @@ +/ { + aliases { + test-board-qualifiers = &uart0; + }; +}; diff --git a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64_somesuffix.overlay b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64_somesuffix.overlay new file mode 100644 index 00000000000..79d904a717e --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64_somesuffix.overlay @@ -0,0 +1,5 @@ +/ { + aliases { + test-board-suffix = &uart0; + }; +}; diff --git a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_somesuffix.overlay b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_somesuffix.overlay new file mode 100644 index 00000000000..79d904a717e --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_somesuffix.overlay @@ -0,0 +1,5 @@ +/ { + aliases { + test-board-suffix = &uart0; + }; +}; diff --git a/tests/cmake/overlays/soc_folder_overlay/prj.conf b/tests/cmake/overlays/soc_folder_overlay/prj.conf new file mode 100644 index 00000000000..9467c292689 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/prj.conf @@ -0,0 +1 @@ +CONFIG_ZTEST=y diff --git a/tests/cmake/overlays/soc_folder_overlay/socs/native.overlay b/tests/cmake/overlays/soc_folder_overlay/socs/native.overlay new file mode 100644 index 00000000000..240f4f97800 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/socs/native.overlay @@ -0,0 +1,5 @@ +/ { + aliases { + test-soc = &uart0; + }; +}; diff --git a/tests/cmake/overlays/soc_folder_overlay/socs/native_64.overlay b/tests/cmake/overlays/soc_folder_overlay/socs/native_64.overlay new file mode 100644 index 00000000000..240f4f97800 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/socs/native_64.overlay @@ -0,0 +1,5 @@ +/ { + aliases { + test-soc = &uart0; + }; +}; diff --git a/tests/cmake/overlays/soc_folder_overlay/socs/native_64_somesuffix.overlay b/tests/cmake/overlays/soc_folder_overlay/socs/native_64_somesuffix.overlay new file mode 100644 index 00000000000..be46f686750 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/socs/native_64_somesuffix.overlay @@ -0,0 +1,5 @@ +/ { + aliases { + test-soc-suffix = &uart0; + }; +}; diff --git a/tests/cmake/overlays/soc_folder_overlay/socs/native_somesuffix.overlay b/tests/cmake/overlays/soc_folder_overlay/socs/native_somesuffix.overlay new file mode 100644 index 00000000000..be46f686750 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/socs/native_somesuffix.overlay @@ -0,0 +1,5 @@ +/ { + aliases { + test-soc-suffix = &uart0; + }; +}; diff --git a/tests/cmake/overlays/soc_folder_overlay/src/main.c b/tests/cmake/overlays/soc_folder_overlay/src/main.c new file mode 100644 index 00000000000..b4e1f22b6ae --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/src/main.c @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#ifndef CONFIG_TEST_TYPE +#error "Invalid test configuration" +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_APP +#define INCLUDED_APP 1 +#else +#define INCLUDED_APP 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD +#define INCLUDED_BOARD 1 +#else +#define INCLUDED_BOARD 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX +#define INCLUDED_BOARD_SUFFIX 1 +#else +#define INCLUDED_BOARD_SUFFIX 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS +#define INCLUDED_BOARD_QUALIFIERS 1 +#else +#define INCLUDED_BOARD_QUALIFIERS 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC +#define INCLUDED_SOC 1 +#else +#define INCLUDED_SOC 0 +#endif + +#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX +#define INCLUDED_SOC_SUFFIX 1 +#else +#define INCLUDED_SOC_SUFFIX 0 +#endif + +#if CONFIG_TEST_TYPE == 0 +/* Default test */ +ZTEST(soc_folder_overlay, test_default) +{ + zassert_false(INCLUDED_APP, "Did not expect app overlay to be present"); + zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix overlay to be present"); + +#ifdef CONFIG_BOARD_NATIVE_SIM_NATIVE_64 + zassert_false(INCLUDED_BOARD, "Did not expect board overlay to be present"); + zassert_true(INCLUDED_BOARD_QUALIFIERS, "Expected board qualifier overlay to be present"); +#else + zassert_true(INCLUDED_BOARD, "Expected board overlay to be present"); + zassert_false(INCLUDED_BOARD_QUALIFIERS, + "Did not expect board qualifier overlay to be present"); +#endif + + zassert_true(INCLUDED_SOC, "Expect soc overlay to be present"); + zassert_false(INCLUDED_SOC_SUFFIX, "Did not expect soc suffix overlay to be present"); +} +#elif CONFIG_TEST_TYPE == 1 +/* File suffix test */ +ZTEST(soc_folder_overlay, test_suffix) +{ + zassert_false(INCLUDED_APP, "Did not expect app overlay to be present"); + zassert_true(INCLUDED_BOARD_SUFFIX, "Expected board suffix overlay to be present"); + zassert_false(INCLUDED_BOARD, "Did not expect board overlay to be present"); + zassert_false(INCLUDED_BOARD_QUALIFIERS, + "Did not expect board qualifier overlay to be present"); + zassert_false(INCLUDED_SOC, "Did not expect soc overlay to be present"); + zassert_true(INCLUDED_SOC_SUFFIX, "Expected soc suffix overlay to be present"); +} +#elif CONFIG_TEST_TYPE == 2 +/* App overlay test */ +ZTEST(soc_folder_overlay, test_app) +{ + zassert_true(INCLUDED_APP, "Expected app overlay to be present"); + zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix overlay to be present"); + zassert_false(INCLUDED_BOARD, "Did not expect board overlay to be present"); + zassert_false(INCLUDED_BOARD_QUALIFIERS, + "Did not expect board qualifier overlay to be present"); + zassert_false(INCLUDED_SOC, "Did not expect soc overlay to be present"); + zassert_false(INCLUDED_SOC_SUFFIX, "Did not epect soc suffix overlay to be present"); +} +#else +#error "Invalid test type" +#endif + +ZTEST_SUITE(soc_folder_overlay, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/cmake/overlays/soc_folder_overlay/testcase.yaml b/tests/cmake/overlays/soc_folder_overlay/testcase.yaml new file mode 100644 index 00000000000..659560cf836 --- /dev/null +++ b/tests/cmake/overlays/soc_folder_overlay/testcase.yaml @@ -0,0 +1,30 @@ +common: + tags: + - cmake +tests: + cmake.overlays.soc_folder_overlay.default: + platform_allow: + - native_sim + - native_sim/native/64 + integration_platforms: + - native_sim + - native_sim/native/64 + extra_args: + - CONFIG_TEST_TYPE=0 + cmake.overlays.soc_folder_overlay.suffix: + platform_allow: + - native_sim + - native_sim/native/64 + integration_platforms: + - native_sim + - native_sim/native/64 + extra_args: + - CONFIG_TEST_TYPE=1 + - FILE_SUFFIX=somesuffix + cmake.overlays.soc_folder_overlay.app: + platform_allow: + - qemu_cortex_m3 + integration_platforms: + - qemu_cortex_m3 + extra_args: + - CONFIG_TEST_TYPE=2 From 32653d77da94a492e9a4ae1eea45ec190bcdd0d3 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 11 Apr 2024 13:44:39 +0100 Subject: [PATCH 1833/2300] [nrf fromtree] doc: build: Add details on SoC overlays Adds details about Kconfig fragments and devicetree overlay files that will be included in a build if they are found in the ``socs`` folder Signed-off-by: Jamie McCrae (cherry picked from commit af467659de1e6b3049663750a7ab67b59a2b21f5) --- doc/build/dts/howtos.rst | 7 +++---- doc/build/kconfig/setting.rst | 8 +++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/build/dts/howtos.rst b/doc/build/dts/howtos.rst index cb556bb782d..c6ee5a80d30 100644 --- a/doc/build/dts/howtos.rst +++ b/doc/build/dts/howtos.rst @@ -237,11 +237,10 @@ If you don't set :makevar:`DTC_OVERLAY_FILE`, the build system will follow these steps, looking for files in your application configuration directory to use as devicetree overlays: -#. If the file :file:`boards/.overlay` exists, it will be used. +#. If the file :file:`socs/_.overlay` exists, it will be used. +#. If the file :file:`boards/.overlay` exists, it will be used in addition to the above. #. If the current board has :ref:`multiple revisions ` - and :file:`boards/_.overlay` exists, it will be used. - This file will be used in addition to :file:`boards/.overlay` - if both exist. + and :file:`boards/_.overlay` exists, it will be used in addition to the above. #. If one or more files have been found in the previous steps, the build system stops looking and just uses those files. #. Otherwise, if :file:`.overlay` exists, it will be used, and the build diff --git a/doc/build/kconfig/setting.rst b/doc/build/kconfig/setting.rst index cc7658a1664..ba3ee33938a 100644 --- a/doc/build/kconfig/setting.rst +++ b/doc/build/kconfig/setting.rst @@ -151,7 +151,8 @@ used. form :file:`prj_.conf` and if file :file:`boards/_.conf` exists in same folder as file :file:`prj_.conf`, the result of merging :file:`prj_.conf` and - :file:`boards/_.conf` is used. + :file:`boards/_.conf` is used - note that this feature is + deprecated, :ref:`application-file-suffixes` should be used instead. #. Otherwise, :file:`prj_.conf` is used if it exists in the application configuration directory. @@ -168,6 +169,11 @@ used. #. Otherwise, :file:`prj.conf` is used from the application configuration directory. If it does not exist then a fatal error will be emitted. +Furthermore, applications can have SoC overlay configuration that is applied to +it, the file :file:`socs/_.conf` will be applied if it exists, +after the main project configuration has been applied and before any board overlay +configuration files have been applied. + All configuration files will be taken from the application's configuration directory except for files with an absolute path that are given with the ``CONF_FILE``, ``EXTRA_CONF_FILE``, ``DTC_OVERLAY_FILE``, and From 8a73ec17c0d6bccdfcac09e9e46313f7402dda3d Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 4 Jan 2023 10:36:15 +0000 Subject: [PATCH 1834/2300] [nrf fromtree] west: runners: Add run once commands and deferred reset This adds supports for flashing images with sysbuild where there are multiple images per board to prevent using the same command per image flash which might cause issues if they are not ran just once per flash per unique board name. A deferred reset feature is also introduced that prevents a board (or multiple) from being reset if multiple images are to be flashed until the final one has been flashed which prevents issues with e.g. security bits being enabled that then prevent flashing further images. These options can be set at a board level (in board.yml) or a SoC level (in soc.yml), if both are present then the board configuration will be used instead of the SoC, and regex can be used for matching of partial names which allows for matching specific SoCs or CPU cores regardless of the board being used Signed-off-by: Jamie McCrae (cherry picked from commit a0267d2f4890427f10c16d510260e15a68bd1a84) --- cmake/modules/soc_v2.cmake | 2 +- scripts/schemas/board-schema.yml | 51 +++++++ scripts/schemas/soc-schema.yml | 51 +++++++ scripts/west_commands/run_common.py | 224 ++++++++++++++++++++++++++-- 4 files changed, 318 insertions(+), 10 deletions(-) diff --git a/cmake/modules/soc_v2.cmake b/cmake/modules/soc_v2.cmake index 6a03dd2cbf0..606ed690f77 100644 --- a/cmake/modules/soc_v2.cmake +++ b/cmake/modules/soc_v2.cmake @@ -27,6 +27,6 @@ if(HWMv2) set(SOC_TOOLCHAIN_NAME ${CONFIG_SOC_TOOLCHAIN_NAME}) set(SOC_FAMILY ${CONFIG_SOC_FAMILY}) set(SOC_V2_DIR ${SOC_${SOC_NAME}_DIR}) - set(SOC_FULL_DIR ${SOC_V2_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) endif() diff --git a/scripts/schemas/board-schema.yml b/scripts/schemas/board-schema.yml index 6a9262bf8f5..56ee4eab034 100644 --- a/scripts/schemas/board-schema.yml +++ b/scripts/schemas/board-schema.yml @@ -78,3 +78,54 @@ mapping: type: seq sequence: - include: board-schema + runners: + type: map + mapping: + run_once: + type: map + desc: | + Allows for restricting west flash commands when using sysbuild to run once per given + grouping of board targets. This is to allow for future image program cycles to not + erase the flash of a device which has just been programmed by another image. + mapping: + regex;(.*): + type: seq + desc: | + A dictionary of commands which should be limited to running once per invocation + of west flash for a given set of flash runners and board targets. + sequence: + - type: map + mapping: + run: + required: true + type: str + enum: ['first', 'last'] + desc: | + If first, will run this command once when the first image is flashed, if + last, will run this command once when the final image is flashed. + runners: + required: true + type: seq + sequence: + - type: str + desc: | + A list of flash runners that this applies to, can use `all` to apply + to all runners. + groups: + required: true + type: seq + sequence: + - type: map + desc: | + A grouping of board targets which the command should apply to. Can + be used multiple times to have multiple groups. + mapping: + boards: + required: true + type: seq + sequence: + - type: str + desc: | + A board target to match against in regex. Must be one entry + per board target, a single regex entry will not match two + board targets even if they both match. diff --git a/scripts/schemas/soc-schema.yml b/scripts/schemas/soc-schema.yml index dd62ee3c17d..c13b4a4f7e0 100644 --- a/scripts/schemas/soc-schema.yml +++ b/scripts/schemas/soc-schema.yml @@ -70,3 +70,54 @@ mapping: required: false type: str desc: Free form comment with extra information regarding the SoC. + runners: + type: map + mapping: + run_once: + type: map + desc: | + Allows for restricting west flash commands when using sysbuild to run once per given + grouping of board targets. This is to allow for future image program cycles to not + erase the flash of a device which has just been programmed by another image. + mapping: + regex;(.*): + type: seq + desc: | + A dictionary of commands which should be limited to running once per invocation + of west flash for a given set of flash runners and board targets. + sequence: + - type: map + mapping: + run: + required: true + type: str + enum: ['first', 'last'] + desc: | + If first, will run this command once when the first image is flashed, if + last, will run this command once when the final image is flashed. + runners: + required: true + type: seq + sequence: + - type: str + desc: | + A list of flash runners that this applies to, can use `all` to apply + to all runners. + groups: + required: true + type: seq + sequence: + - type: map + desc: | + A grouping of board targets which the command should apply to. Can + be used multiple times to have multiple groups. + mapping: + qualifiers: + required: true + type: seq + sequence: + - type: str + desc: | + A board qualifier to match against in regex form. Must be one + entry per board target, a single regex entry will not match + two board targets even if they both match. diff --git a/scripts/west_commands/run_common.py b/scripts/west_commands/run_common.py index 43d736f2b68..8656d090767 100644 --- a/scripts/west_commands/run_common.py +++ b/scripts/west_commands/run_common.py @@ -1,12 +1,15 @@ # Copyright (c) 2018 Open Source Foundries Limited. +# Copyright (c) 2023 Nordic Semiconductor ASA # # SPDX-License-Identifier: Apache-2.0 '''Common code used by commands which execute runners. ''' +import re import argparse import logging +from collections import defaultdict from os import close, getcwd, path, fspath from pathlib import Path from subprocess import CalledProcessError @@ -15,12 +18,14 @@ import textwrap import traceback +from dataclasses import dataclass from west import log from build_helpers import find_build_dir, is_zephyr_build, load_domains, \ FIND_BUILD_DIR_DESCRIPTION from west.commands import CommandError from west.configuration import config from runners.core import FileType +from runners.core import BuildConfiguration import yaml from zephyr_ext_common import ZEPHYR_SCRIPTS @@ -78,6 +83,19 @@ def emit(self, record): else: log.dbg(fmt, level=log.VERBOSE_EXTREME) +@dataclass +class UsedFlashCommand: + command: str + boards: list + runners: list + first: bool + ran: bool = False + +@dataclass +class ImagesFlashed: + flashed: int = 0 + total: int = 0 + def command_verb(command): return "flash" if command.name == "flash" else "debug" @@ -147,6 +165,19 @@ def do_run_common(command, user_args, user_runner_args, domains=None): # This is the main routine for all the "west flash", "west debug", # etc. commands. + # Holds a list of run once commands, this is useful for sysbuild images + # whereby there are multiple images per board with flash commands that can + # interfere with other images if they run one per time an image is flashed. + used_cmds = [] + + # Holds a set of processed board names for flash running information. + processed_boards = set() + + # Holds a dictionary of board image flash counts, the first element is + # number of images flashed so far and second element is total number of + # images for a given board. + board_image_count = defaultdict(ImagesFlashed) + if user_args.context: dump_context(command, user_args, user_runner_args) return @@ -165,20 +196,108 @@ def do_run_common(command, user_args, user_runner_args, domains=None): # Get the user specified domains. domains = load_domains(build_dir).get_domains(user_args.domain) - if len(domains) > 1 and len(user_runner_args) > 0: - log.wrn("Specifying runner options for multiple domains is experimental.\n" - "If problems are experienced, please specify a single domain " - "using '--domain '") + if len(domains) > 1: + if len(user_runner_args) > 0: + log.wrn("Specifying runner options for multiple domains is experimental.\n" + "If problems are experienced, please specify a single domain " + "using '--domain '") + + # Process all domains to load board names and populate flash runner + # parameters. + board_names = set() + for d in domains: + if d.build_dir is None: + build_dir = get_build_dir(user_args) + else: + build_dir = d.build_dir + + cache = load_cmake_cache(build_dir, user_args) + build_conf = BuildConfiguration(build_dir) + board = build_conf.get('CONFIG_BOARD_TARGET') + board_names.add(board) + board_image_count[board].total += 1 + + # 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: + 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)) + + # Reduce entries to only those having matching board names (either exact or with regex) and + # remove any entries with empty board lists + for i, entry in enumerate(used_cmds): + for l, match in enumerate(entry.boards): + match_found = False + + # Check if there is a matching board for this regex + for check in board_names: + if re.match(fr'^{match}$', check) is not None: + match_found = True + break + + if not match_found: + del entry.boards[l] + + if len(entry.boards) == 0: + del used_cmds[i] for d in domains: - do_run_common_image(command, user_args, user_runner_args, d.build_dir) + do_run_common_image(command, user_args, user_runner_args, + used_cmds, board_image_count, d.build_dir) + -def do_run_common_image(command, user_args, user_runner_args, build_dir=None): +def do_run_common_image(command, user_args, user_runner_args, used_cmds, + board_image_count, build_dir=None,): + global re command_name = command.name if build_dir is None: build_dir = get_build_dir(user_args) cache = load_cmake_cache(build_dir, user_args) - board = cache['CACHED_BOARD'] + build_conf = BuildConfiguration(build_dir) + board = build_conf.get('CONFIG_BOARD_TARGET') + + if board_image_count is not None and board in board_image_count: + board_image_count[board].flashed += 1 # Load runners.yaml. yaml_path = runners_yaml_path(build_dir, board) @@ -201,6 +320,93 @@ def do_run_common_image(command, user_args, user_runner_args, build_dir=None): # parsing, it will show up here, and needs to be filtered out. runner_args = [arg for arg in user_runner_args if arg != '--'] + # Check if there are any commands that should only be ran once per board + # and if so, remove them for all but the first iteration of the flash + # runner per unique board name. + if len(used_cmds) > 0 and len(runner_args) > 0: + i = len(runner_args) - 1 + while i >= 0: + for cmd in used_cmds: + if cmd.command == runner_args[i] and (runner_name in cmd.runners or 'all' in cmd.runners): + # Check if board is here + match_found = False + + for match in cmd.boards: + # Check if there is a matching board for this regex + if re.match(fr'^{match}$', board) is not None: + match_found = True + break + + if not match_found: + continue + + # Check if this is a first or last run + if not cmd.first: + # For last run instances, we need to check that this really is the last + # image of all boards being flashed + for check in cmd.boards: + can_continue = False + + for match in board_image_count: + if re.match(fr'^{check}$', match) is not None: + if board_image_count[match].flashed == board_image_count[match].total: + can_continue = True + break + + if not can_continue: + continue + + if not cmd.ran: + cmd.ran = True + else: + runner_args.pop(i) + + break + + i = i - 1 + + # If flashing multiple images, the runner supports reset after flashing and + # the board has enabled this functionality, check if the board should be + # reset or not. If this is not specified in the board/soc file, leave it up to + # the runner's default configuration to decide if a reset should occur. + if runner_cls.capabilities().reset: + if board_image_count is not None: + reset = True + + for cmd in used_cmds: + if cmd.command == '--reset' and (runner_name in cmd.runners or 'all' in cmd.runners): + # Check if board is here + match_found = False + + for match in cmd.boards: + if re.match(fr'^{match}$', board) is not None: + match_found = True + break + + if not match_found: + continue + + # Check if this is a first or last run + if cmd.first and cmd.ran: + reset = False + break + elif not cmd.first and not cmd.ran: + # For last run instances, we need to check that this really is the last + # image of all boards being flashed + for check in cmd.boards: + can_continue = False + + for match in board_image_count: + if re.match(fr'^{check}$', match) is not None: + if board_image_count[match].flashed != board_image_count[match].total: + reset = False + break + + if reset: + runner_args.append('--reset') + else: + runner_args.append('--no-reset') + # Arguments in this order to allow specific to override general: # # - runner-specific runners.yaml arguments @@ -439,8 +645,8 @@ def dump_context(command, args, unknown_args): log.wrn('no --build-dir given or found; output will be limited') runners_yaml = None else: - cache = load_cmake_cache(build_dir, args) - board = cache['CACHED_BOARD'] + build_conf = BuildConfiguration(build_dir) + board = build_conf.get('CONFIG_BOARD_TARGET') yaml_path = runners_yaml_path(build_dir, board) runners_yaml = load_runners_yaml(yaml_path) From 4bd4c1d35743f0c5d3260889a2ed6b4e56cecaf3 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 19 Mar 2024 10:15:02 +0000 Subject: [PATCH 1835/2300] [nrf fromtree] soc: nordic: Reformat soc.yml file Reformats the soc.yml file to have uniform 2-space indentation Upmerge warning: this commit has been modified to remove cpuflpr Signed-off-by: Jamie McCrae (cherry picked from commit 8b62a16b570aa4c5ee2fd792f34bf5d81bb236c2) --- soc/nordic/soc.yml | 76 +++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/soc/nordic/soc.yml b/soc/nordic/soc.yml index 87f35a46558..79aa5be285b 100644 --- a/soc/nordic/soc.yml +++ b/soc/nordic/soc.yml @@ -1,39 +1,39 @@ family: -- name: nordic_nrf - series: - - name: nrf51 - socs: - - name: nrf51822 - - name: nrf52 - socs: - - name: nrf52805 - - name: nrf52810 - - name: nrf52811 - - name: nrf52820 - - name: nrf52832 - - name: nrf52833 - - name: nrf52840 - - name: nrf53 - socs: - - name: nrf5340 - cpuclusters: - - name: cpuapp - - name: cpunet - - name: nrf54l - socs: - - name: nrf54l15 - cpuclusters: - - name: cpuapp - - name: nrf54h - socs: - - name: nrf54h20 - cpuclusters: - - name: cpuapp - - name: cpurad - - name: cpuppr - - name: nrf91 - socs: - - name: nrf9131 - - name: nrf9151 - - name: nrf9160 - - name: nrf9161 + - name: nordic_nrf + series: + - name: nrf51 + socs: + - name: nrf51822 + - name: nrf52 + socs: + - name: nrf52805 + - name: nrf52810 + - name: nrf52811 + - name: nrf52820 + - name: nrf52832 + - name: nrf52833 + - name: nrf52840 + - name: nrf53 + socs: + - name: nrf5340 + cpuclusters: + - name: cpuapp + - name: cpunet + - name: nrf54l + socs: + - name: nrf54l15 + cpuclusters: + - name: cpuapp + - name: nrf54h + socs: + - name: nrf54h20 + cpuclusters: + - name: cpuapp + - name: cpurad + - name: cpuppr + - name: nrf91 + socs: + - name: nrf9131 + - name: nrf9151 + - name: nrf9160 + - name: nrf9161 From 7de9ca038d00e48846c871ab290b4eda8e79a46e Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 4 Mar 2024 11:00:00 +0000 Subject: [PATCH 1836/2300] [nrf fromtree] soc: nordic: Add run once and deferred reset configuration Adds configuration that allows nRF53 and nRF91-based boards to be flashed through west using sysbuild for multiple images with the recover or erase options and prevent running those commands for each image being flash, which would make the device unbootable. Also defers reset whilst all images for the cores of these SoCs are flashed. Signed-off-by: Jamie McCrae (cherry picked from commit 4b2d19f14731a31d730b2814f1324c6fabb03f11) --- soc/nordic/soc.yml | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/soc/nordic/soc.yml b/soc/nordic/soc.yml index 79aa5be285b..f7fb6bfec71 100644 --- a/soc/nordic/soc.yml +++ b/soc/nordic/soc.yml @@ -37,3 +37,62 @@ family: - name: nrf9151 - name: nrf9160 - name: nrf9161 + +# Recovery/erase is only needed once per core. Prevent resetting the cores whilst flashing +# multiple images until all images for each core have been flashed, this allows security +# bits to be set during programming without them interfering with additional flashing +# operations. +runners: + run_once: + '--recover': + - runners: + - nrfjprog + run: first + groups: + - qualifiers: + - nrf51([0-9]{3})((.+)?) + - qualifiers: + - nrf52([0-9]{3})((.+)?) + - qualifiers: + - nrf5340/cpunet + - nrf5340/cpuapp + - nrf5340/cpuapp/ns + - qualifiers: + - nrf9160 + - nrf9160/ns + '--erase': + - runners: + - nrfjprog + - jlink + run: first + groups: + - qualifiers: + - nrf51([0-9]{3})((.+)?) + - qualifiers: + - nrf52([0-9]{3})((.+)?) + - qualifiers: + - nrf5340/cpunet + - qualifiers: + - nrf5340/cpuapp + - nrf5340/cpuapp/ns + - qualifiers: + - nrf9160 + - nrf9160/ns + '--reset': + - runners: + - nrfjprog + - jlink + run: last + groups: + - qualifiers: + - nrf51([0-9]{3})((.+)?) + - qualifiers: + - nrf52([0-9]{3})((.+)?) + - qualifiers: + - nrf5340/cpunet + - qualifiers: + - nrf5340/cpuapp + - nrf5340/cpuapp/ns + - qualifiers: + - nrf9160 + - nrf9160/ns From 58e52f09c670aeea5a4afdfbd47745c2d46c25ae Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 19 Mar 2024 15:52:16 +0000 Subject: [PATCH 1837/2300] [nrf fromtree] doc: build: flashing: Add documentation Adds documentation on the new flashing configuration system Signed-off-by: Jamie McCrae (cherry picked from commit ff823c63eea0a295a3cc9cbfc5f09627fb5e35a1) --- doc/build/flashing/configuration.rst | 106 +++++++++++++++++++++++++++ doc/build/flashing/index.rst | 9 +++ doc/build/index.rst | 1 + 3 files changed, 116 insertions(+) create mode 100644 doc/build/flashing/configuration.rst create mode 100644 doc/build/flashing/index.rst diff --git a/doc/build/flashing/configuration.rst b/doc/build/flashing/configuration.rst new file mode 100644 index 00000000000..0611420ce17 --- /dev/null +++ b/doc/build/flashing/configuration.rst @@ -0,0 +1,106 @@ +.. _flashing-soc-board-config: + +Flashing configuration +###################### + +Zephyr supports setting up configuration for flash runners (invoked from +:ref:`west flash`) which allows for customising how commands are used when +programming boards. This configuration is used for :ref:`sysbuild` projects and allows for +configuring when commands are ran for groups of board targets. As an example: a multi-core SoC +might want to only allow the ``--erase`` argument to be used once for all of the cores in the SoC +which would prevent multiple erase tasks running in a single ``west flash`` invocation, which +could wrongly clear the memory which is used by the other images being programmed. + +Priority +******** + +Flashing configuration is singular, it will only be read from a single location, this +configuration can reside in the following files starting with the highest priority: + + * ``soc.yml`` (in soc folder) + * ``board.yml`` (in board folder) + +Configuration +************* + +Configuration is applied in the yml file by using a ``runners`` map with a single ``run_once`` +child, this then contains a map of commands as they would be provided to the flash runner e.g. +``--reset`` followed by a list which specifies the settings for each of these commands (these +are grouped by flash runner, and by qualifiers/boards). Commands have associated runners that +they apply to using a ``runners`` list value, this can contain ``all`` if it applies to all +runners, otherwise must contain each runner that it applies to using the runner-specific name. +Groups of board targets can be specified using the ``groups`` key which has a list of board +target sets. Board targets are regular expression matches, for ``soc.yml`` files each set of +board targets must be in a ``qualifiers`` key (only regular expression matches for board +qualifiers are allowed, board names must be omitted from these entries). For ``board.yml`` +files each set of board targets must be in a ``boards`` key, these are lists containing the +matches which form a singular group. A final parameter ``run`` can be set to ``first`` which +means that the command will be ran once with the first image flashing process per set of board +targets, or to ``last`` which will be ran once for the final image flash per set of board targets. + +An example flashing configuration for a ``soc.yml`` is shown below in which the ``--recover`` +command will only be used once for any board targets which used the nRF5340 SoC application or +network CPU cores, and will only reset the network or application core after all images for the +respective core have been flashed. + +.. code-block:: yaml + + runners: + run_once: + '--recover': + - run: first + runners: + - nrfjprog + groups: + - qualifiers: + - nrf5340/cpunet + - nrf5340/cpuapp + - nrf5340/cpuapp/ns + '--reset': + - run: last + runners: + - nrfjprog + - jlink + groups: + - qualifiers: + - nrf5340/cpunet + - qualifiers: + - nrf5340/cpuapp + - nrf5340/cpuapp/ns + # Made up non-real world example to show how to specify different options for different + # flash runners + - run: first + runners: + - some_other_runner + groups: + - qualifiers: + - nrf5340/cpunet + - qualifiers: + - nrf5340/cpuapp + - nrf5340/cpuapp/ns + +Usage +***** + +Commands that are supported by flash runners can be used as normal when flashing non-sysbuild +applications, the run once configuration will not be used. When flashing a sysbuild project with +multiple images, the flash runner run once configuration will be applied. + +For example, building the :zephyr:code-sample:`smp-svr` sample for the nrf5340dk which will +include MCUboot as a secondary image: + +.. code-block:: console + + cmake -GNinja -Sshare/sysbuild/ -Bbuild -DBOARD=nrf5340dk/nrf5340/cpuapp -DAPP_DIR=samples/subsys/mgmt/mcumgr/smp_svr + cmake --build build + +Once built with an nrf5340dk connected, the following command can be used to flash the board with +both applications and will only perform a single device recovery operation when programming the +first image: + +.. code-block:: console + + west flash --recover + +If the above was ran without the flashing configuration, the recovery process would be ran twice +and the device would be unbootable. diff --git a/doc/build/flashing/index.rst b/doc/build/flashing/index.rst new file mode 100644 index 00000000000..003dba418ea --- /dev/null +++ b/doc/build/flashing/index.rst @@ -0,0 +1,9 @@ +.. _flashing: + +Flashing +######## + +.. toctree:: + :maxdepth: 1 + + configuration.rst diff --git a/doc/build/index.rst b/doc/build/index.rst index 4a3e76be307..91bf4c6018c 100644 --- a/doc/build/index.rst +++ b/doc/build/index.rst @@ -15,3 +15,4 @@ Build and Configuration Systems zephyr_cmake_package.rst sysbuild/index.rst version/index.rst + flashing/index.rst From b5cf3040298410845311ff7397374540d3451528 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 26 Mar 2024 11:21:13 +0000 Subject: [PATCH 1838/2300] [nrf fromtree] scripts: list_hardware: Add check for soc.yml runner validity Adds checking that qualifiers listed in a soc.yml file are valid for the socs and cpuclusters defined in that file Signed-off-by: Jamie McCrae (cherry picked from commit 5033399322fe10745a2e37db4c7c31ecd9241e74) --- scripts/list_hardware.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/scripts/list_hardware.py b/scripts/list_hardware.py index 2fa7c2a3638..d1f31a4712e 100755 --- a/scripts/list_hardware.py +++ b/scripts/list_hardware.py @@ -10,6 +10,7 @@ import sys from typing import List import yaml +import re SOC_SCHEMA_PATH = str(Path(__file__).parent / 'schemas' / 'soc-schema.yml') @@ -40,6 +41,40 @@ def __init__(self, folder='', soc_yaml=None): except (yaml.YAMLError, pykwalify.errors.SchemaError) as e: sys.exit(f'ERROR: Malformed yaml {soc_yaml.as_posix()}', e) + # Ensure that any runner configuration matches socs and cpuclusters declared in the same + # soc.yml file + if 'runners' in data and 'run_once' in data['runners']: + for grp in data['runners']['run_once']: + for item_data in data['runners']['run_once'][grp]: + for group in item_data['groups']: + for qualifiers in group['qualifiers']: + components = qualifiers.split('/') + soc = components.pop(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 len(components) > 0 and components[len(components)-1] == 'ns': + components.pop(len(components)-1) + + for f in data.get('family', []): + for s in f.get('series', []): + for socs in s.get('socs', []): + if re.match(fr'^{soc}$', socs.get('name')) is not None: + if 'cpuclusters' in socs and len(components) > 0: + check_string = '/'.join(components) + for cpucluster in socs.get('cpuclusters', []): + if re.match(fr'^{check_string}$', cpucluster.get('name')) is not None: + found_match = True + break + elif 'cpuclusters' not in socs and len(components) == 0: + found_match = True + break + + + if found_match is False: + sys.exit(f'ERROR: SoC qualifier match unresolved: {qualifiers}') + for f in data.get('family', []): family = Family(f['name'], folder, [], []) for s in f.get('series', []): From d22aedea308baaf64dea1da3b21bbb7f2410293d Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 7 May 2024 08:27:09 +0100 Subject: [PATCH 1839/2300] [nrf fromlist] kernel: banner: Make function weak Makes the boot banner function weak, this resolves an issue when building with llext enabled which uses different build options than a normal zephyr build Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72400 Signed-off-by: Jamie McCrae --- kernel/banner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/banner.c b/kernel/banner.c index dc2506fb9b1..061e57048d1 100644 --- a/kernel/banner.c +++ b/kernel/banner.c @@ -24,7 +24,7 @@ #endif /* BUILD_VERSION */ #endif /* !BANNER_VERSION */ -void boot_banner(void) +__weak void boot_banner(void) { #if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) printk("***** delaying boot " DELAY_STR "ms (per build configuration) *****\n"); From 921a872239fd188c5e8c12e0ca8dd8a4788e1911 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Fri, 12 Apr 2024 14:31:51 +0200 Subject: [PATCH 1840/2300] [nrf fromtree] tests: drivers: Extend test coverage for NRF GPIO driver Add more test cases for NRF specific GPIO features Signed-off-by: Bartosz Miller (cherry picked from commit aa67e5872aeab7336b2f7605f8451e6e1488f027) --- tests/drivers/gpio/gpio_nrf/CMakeLists.txt | 10 ++++ tests/drivers/gpio/gpio_nrf/README.txt | 4 ++ tests/drivers/gpio/gpio_nrf/prj.conf | 2 + tests/drivers/gpio/gpio_nrf/src/main.c | 61 ++++++++++++++++++++++ tests/drivers/gpio/gpio_nrf/testcase.yaml | 7 +++ 5 files changed, 84 insertions(+) create mode 100644 tests/drivers/gpio/gpio_nrf/CMakeLists.txt create mode 100644 tests/drivers/gpio/gpio_nrf/README.txt create mode 100644 tests/drivers/gpio/gpio_nrf/prj.conf create mode 100644 tests/drivers/gpio/gpio_nrf/src/main.c create mode 100644 tests/drivers/gpio/gpio_nrf/testcase.yaml diff --git a/tests/drivers/gpio/gpio_nrf/CMakeLists.txt b/tests/drivers/gpio/gpio_nrf/CMakeLists.txt new file mode 100644 index 00000000000..2af607d1164 --- /dev/null +++ b/tests/drivers/gpio/gpio_nrf/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(gpio_nrf_specific) + +target_sources(app PRIVATE + src/main.c + ) diff --git a/tests/drivers/gpio/gpio_nrf/README.txt b/tests/drivers/gpio/gpio_nrf/README.txt new file mode 100644 index 00000000000..6a5927b725f --- /dev/null +++ b/tests/drivers/gpio/gpio_nrf/README.txt @@ -0,0 +1,4 @@ +Nordic Semiconductor specific GPIO functions +############################################ +The suite specified here tests NRF specific +GPIO pin drive strength settings. diff --git a/tests/drivers/gpio/gpio_nrf/prj.conf b/tests/drivers/gpio/gpio_nrf/prj.conf new file mode 100644 index 00000000000..0e799280f51 --- /dev/null +++ b/tests/drivers/gpio/gpio_nrf/prj.conf @@ -0,0 +1,2 @@ +CONFIG_ZTEST=y +CONFIG_GPIO=y diff --git a/tests/drivers/gpio/gpio_nrf/src/main.c b/tests/drivers/gpio/gpio_nrf/src/main.c new file mode 100644 index 00000000000..8627e9bab1d --- /dev/null +++ b/tests/drivers/gpio/gpio_nrf/src/main.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#if DT_NODE_HAS_PROP(DT_ALIAS(led0), gpios) +#define TEST_NODE DT_GPIO_CTLR(DT_ALIAS(led0), gpios) +#define TEST_PIN DT_GPIO_PIN(DT_ALIAS(led0), gpios) +#else +#error Unsupported board +#endif + +/* + * Nordic Semiconductor specific pin drive configurations + */ +ZTEST(gpio_nrf, test_gpio_high_drive_strength) +{ + int err; + const struct device *port; + + port = DEVICE_DT_GET(TEST_NODE); + zassert_true(device_is_ready(port), "GPIO dev is not ready"); + + err = gpio_pin_configure(port, TEST_PIN, GPIO_PUSH_PULL | NRF_GPIO_DRIVE_S0H1); + zassert_equal( + err, 0, + "Failed to configure the pin as an P-P output with drive: NRF_GPIO_DRIVE_S0H1, err=%d", + err); + + err = gpio_pin_configure(port, TEST_PIN, GPIO_PUSH_PULL | NRF_GPIO_DRIVE_H0S1); + zassert_equal( + err, 0, + "Failed to configure the pin as an P-P output with drive: NRF_GPIO_DRIVE_H0S1, err=%d", + err); + + err = gpio_pin_configure(port, TEST_PIN, GPIO_PUSH_PULL | NRF_GPIO_DRIVE_H0H1); + zassert_equal( + err, 0, + "Failed to configure the pin as an P-P output with drive: NRF_GPIO_DRIVE_H0H1, err=%d", + err); + + err = gpio_pin_configure(port, TEST_PIN, GPIO_OPEN_DRAIN | NRF_GPIO_DRIVE_H0S1); + zassert_equal( + err, 0, + "Failed to configure the pin as an O-D output with drive: NRF_GPIO_DRIVE_H0S1, err=%d", + err); + + err = gpio_pin_configure(port, TEST_PIN, GPIO_OPEN_SOURCE | NRF_GPIO_DRIVE_S0H1); + zassert_equal( + err, 0, + "Failed to configure the pin as an O-S output with drive: NRF_GPIO_DRIVE_S0H1, err=%d", + err); +} + +ZTEST_SUITE(gpio_nrf, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/drivers/gpio/gpio_nrf/testcase.yaml b/tests/drivers/gpio/gpio_nrf/testcase.yaml new file mode 100644 index 00000000000..9c911ac378f --- /dev/null +++ b/tests/drivers/gpio/gpio_nrf/testcase.yaml @@ -0,0 +1,7 @@ +common: + tags: drivers gpio + depends_on: gpio + harness: ztest +tests: + drivers.gpio.gpio_nrf: + filter: dt_compat_enabled("nordic,nrf-gpio") and dt_nodelabel_enabled("led0") From 27319a0696777a3355c211f937baefe811b896ec Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Wed, 8 May 2024 08:48:46 +0200 Subject: [PATCH 1841/2300] [nrf fromlist] boards: nordic: Add ADC to supported in nRF54L15 PDK Expand supported list. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/68692. Signed-off-by: Bartlomiej Buczek --- boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml index 95fc08d422e..2858ddd35c5 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml @@ -12,6 +12,7 @@ toolchain: ram: 256 flash: 1536 supported: + - adc - counter - gpio - i2c From 4e6070dbdc332a17ae439649e5e6af01a6365290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Tue, 16 Apr 2024 10:02:53 +0200 Subject: [PATCH 1842/2300] [nrf fromtree] tests: drivers: watchdog: Add negative test cases for Watchdog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend test coverage by adding tests that check invalid use of the Watchdog API. Signed-off-by: Sebastian Głąb (cherry picked from commit fa7c05cf4718be15adad0e913fa51a2d5b5bf3dc) --- .../watchdog/wdt_error_cases/CMakeLists.txt | 9 + .../watchdog/wdt_error_cases/README.txt | 79 ++ .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 9 + .../drivers/watchdog/wdt_error_cases/prj.conf | 3 + .../watchdog/wdt_error_cases/src/main.c | 960 ++++++++++++++++++ .../watchdog/wdt_error_cases/testcase.yaml | 13 + 6 files changed, 1073 insertions(+) create mode 100644 tests/drivers/watchdog/wdt_error_cases/CMakeLists.txt create mode 100644 tests/drivers/watchdog/wdt_error_cases/README.txt create mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_error_cases/prj.conf create mode 100644 tests/drivers/watchdog/wdt_error_cases/src/main.c create mode 100644 tests/drivers/watchdog/wdt_error_cases/testcase.yaml diff --git a/tests/drivers/watchdog/wdt_error_cases/CMakeLists.txt b/tests/drivers/watchdog/wdt_error_cases/CMakeLists.txt new file mode 100644 index 00000000000..12c8c39535d --- /dev/null +++ b/tests/drivers/watchdog/wdt_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(wdt_error_cases) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/watchdog/wdt_error_cases/README.txt b/tests/drivers/watchdog/wdt_error_cases/README.txt new file mode 100644 index 00000000000..fcf9173ee93 --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/README.txt @@ -0,0 +1,79 @@ +This test suite contains negative test cases for the Watchdog driver. +Test scenarios validate that invalid use of the watchdog driver +returns error code as described in the API documentation +(or Assertion Fail as explained below). + +Ideally, the driver shall be fully compliant with the documentation. +However, it may happen that invalid function call results in +Assertion Fail instead of error code. +Since, main goal is to detect (and report) invalid use of the driver, +both error code and assertion fail set test result as passed. +See for example test_02_wdt_setup_before_setting_timeouts where +ztest_set_assert_valid(true); +is used to catch assertion fail. + +These tests were written to increase test coverage for the Watchdog driver. +Since, coverage data is stored in the RAM, it is lost when watchdog fires. +Therefore, in all test cases watchdog shall NOT expire. +Use other sample to verify positive scenario for the watchdog driver. + +These tests were prepared on a target that had a bug in the wdt_disable() +implementation. As a temporary remedy, order of tests was imposed. +Since, tests are executed alphabetically, order was set by starting +each test name with f.e. 'test_08b_...'. + + +Tests are based on the watchdog API documentation available here: +https://docs.zephyrproject.org/latest/hardware/peripherals/watchdog.html + + +Follow these guidelines when enabling test execution on a new target. + +1. Although, code defines WDT_DISABLE_SUPPORTED but it was tested on a + target that supports disabling the watchdog. + Multiple tests call wdt_setup() which starts the watchdog. + Every test assumes that watchdog is disabled at startup. + As a result, executing this test suite on a target that doesn't + support wdt_disable() may require changes to the code. + When target supports wdt_disable() then extend WDT_TEST_FLAGS with: + #define WDT_TEST_FLAGS (... | WDT_DISABLE_SUPPORTED) + +2. There are three watchdog flags that can be passed to wdt_install_timeout(): + - WDT_FLAG_RESET_NONE - when watchdog expires, it's callback is serviced but + reset doesn't occur. + - WDT_FLAG_RESET_CPU_CORE - when watchdog expires, only one core is reset, while + other cores are not affected. + - WDT_FLAG_RESET_SOC - when watchdog expires, target as "a whole" is reset. + Support for these flags varies between vendors and products. + a) List all supported flags in + #define WDT_TEST_FLAGS (... | WDT_FLAG_RESET_NONE_SUPPORTED | + WDT_FLAG_RESET_CPU_CORE_SUPPORTED | + WDT_FLAG_RESET_SOC_SUPPORTED) + b) Set supported flag in + #define DEFAULT_FLAGS (WDT_FLAG_RESET_SOC) + This define will be used in wdt_install_timeout() "correct" test step. + +3. These tests assume that watchdog driver supports multiple timeouts. Set + #define MAX_INSTALLABLE_TIMEOUTS (8) + +4. When all watchdog timeouts must have exactly the same watchdog timeout value + then extend WDT_TEST_FLAGS with: + #define WDT_TEST_FLAGS (... | WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED) + +5. Set maximal allowed watchdog timeout value, f.e.: + #define WDT_WINDOW_MAX_ALLOWED (0xFFFFFFFFU) + Also, test assumes that minimal allowed watchdog timeout value must be zero. + +6. There are two watchdog options that can be passed to wdt_setup(): + - WDT_OPT_PAUSE_IN_SLEEP; + - WDT_OPT_PAUSE_HALTED_BY_DBG. + Support for these options varies between vendors and products. + a) List all supported options in + #define WDT_TEST_FLAGS (... | WDT_OPT_PAUSE_IN_SLEEP_SUPPORTED | + WDT_OPT_PAUSE_HALTED_BY_DBG_SUPPORTED) + b) Set supported option(s) in + #define DEFAULT_OPTIONS (WDT_OPT_PAUSE_IN_SLEEP | WDT_OPT_PAUSE_HALTED_BY_DBG) + This define will be used in wdt_setup() "correct" test step. + +7. When wdt_feed() can stall, extend WDT_TEST_FLAGS with: + #define WDT_TEST_FLAGS (... | WDT_FEED_CAN_STALL) diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay new file mode 100644 index 00000000000..8d3dce3b380 --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l15pdk_nrf54l15_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_error_cases/prj.conf b/tests/drivers/watchdog/wdt_error_cases/prj.conf new file mode 100644 index 00000000000..be8069f78b4 --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/prj.conf @@ -0,0 +1,3 @@ +CONFIG_ZTEST=y +CONFIG_ZTEST_ASSERT_HOOK=y +CONFIG_WATCHDOG=y diff --git a/tests/drivers/watchdog/wdt_error_cases/src/main.c b/tests/drivers/watchdog/wdt_error_cases/src/main.c new file mode 100644 index 00000000000..fc453ba3b32 --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/src/main.c @@ -0,0 +1,960 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +/* + * To use this test, either the devicetree's /aliases must have a + * 'watchdog0' property, or one of the following watchdog compatibles + * must have an enabled node. + */ +#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) +#define WDT_NODE DT_ALIAS(watchdog0) +#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_wdt) +#define WDT_NODE DT_INST(0, nordic_nrf_wdt) +#elif DT_HAS_COMPAT_STATUS_OKAY(zephyr_counter_watchdog) +#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_counter_watchdog) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#define NOINIT_SECTION ".dtcm_noinit.test_wdt" +#else +#define NOINIT_SECTION ".noinit.test_wdt" +#endif + +/* Bit fields used to select tests to be run on the target */ +#define WDT_DISABLE_SUPPORTED BIT(0) +#define WDT_FLAG_RESET_NONE_SUPPORTED BIT(1) +#define WDT_FLAG_RESET_CPU_CORE_SUPPORTED BIT(2) +#define WDT_FLAG_RESET_SOC_SUPPORTED BIT(3) +#define WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED BIT(4) +#define WDT_OPT_PAUSE_IN_SLEEP_SUPPORTED BIT(5) +#define WDT_OPT_PAUSE_HALTED_BY_DBG_SUPPORTED BIT(6) +#define WDT_FEED_CAN_STALL BIT(7) + +/* Common for all targets: */ +#define DEFAULT_WINDOW_MAX (500U) +#define DEFAULT_WINDOW_MIN (0U) + +/* Align tests to the specific target: */ +#if defined(CONFIG_SOC_NRF54L15) +#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 | \ + WDT_OPT_PAUSE_HALTED_BY_DBG_SUPPORTED) +#define DEFAULT_FLAGS (WDT_FLAG_RESET_SOC) +#define MAX_INSTALLABLE_TIMEOUTS (8) +#define WDT_WINDOW_MAX_ALLOWED (0x07CFFFFFU) +#define DEFAULT_OPTIONS (WDT_OPT_PAUSE_IN_SLEEP | WDT_OPT_PAUSE_HALTED_BY_DBG) +#else +/* By default run most of the error checks. + * See Readme.txt on how to align test scope for the specific target. + */ +#define WDT_TEST_FLAGS \ + (WDT_DISABLE_SUPPORTED | WDT_FLAG_RESET_SOC_SUPPORTED | \ + WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED) +#define DEFAULT_FLAGS (WDT_FLAG_RESET_SOC) +#define MAX_INSTALLABLE_TIMEOUTS (8) +#define WDT_WINDOW_MAX_ALLOWED (0xFFFFFFFFU) +#define DEFAULT_OPTIONS (WDT_OPT_PAUSE_IN_SLEEP) +#endif + +static const struct device *const wdt = DEVICE_DT_GET(WDT_NODE); +static struct wdt_timeout_cfg m_cfg_wdt0; + +/* Following variables are incremented in WDT callbacks + * to indicate whether interrupt was fired or not. + */ +volatile uint32_t m_test_06b_value __attribute__((section(NOINIT_SECTION))); +#define TEST_06B_TAG (0x12345678U) +volatile uint32_t m_test_08b_value __attribute__((section(NOINIT_SECTION))); +#define TEST_08B_TAG (0x23456789U) +volatile uint32_t m_test_08d_A_value __attribute__((section(NOINIT_SECTION))); +#define TEST_08D_A_TAG (0x3456789AU) +volatile uint32_t m_test_08d_B_value __attribute__((section(NOINIT_SECTION))); +#define TEST_08D_B_TAG (0x456789ABU) + +static void wdt_test_06b_cb(const struct device *wdt_dev, int channel_id) +{ + ARG_UNUSED(wdt_dev); + ARG_UNUSED(channel_id); + m_test_06b_value = TEST_06B_TAG; +} + +static void wdt_test_08b_cb(const struct device *wdt_dev, int channel_id) +{ + ARG_UNUSED(wdt_dev); + ARG_UNUSED(channel_id); + m_test_08b_value = TEST_08B_TAG; +} + +static void wdt_test_08d_A_cb(const struct device *wdt_dev, int channel_id) +{ + ARG_UNUSED(wdt_dev); + ARG_UNUSED(channel_id); + m_test_08d_A_value = TEST_08D_A_TAG; +} + +static void wdt_test_08d_B_cb(const struct device *wdt_dev, int channel_id) +{ + ARG_UNUSED(wdt_dev); + ARG_UNUSED(channel_id); + m_test_08d_B_value = TEST_08D_B_TAG; +} + +/** + * @brief wdt_disable() negative test + * + * Confirm that wdt_disable() returns + * -EFAULT when watchdog instance is not enabled. + * + */ +ZTEST(wdt_coverage, test_01_wdt_disable_before_wdt_setup) +{ + int ret; + + if (!(WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED)) { + /* Skip this test because wdt_disable() is NOT supported. */ + ztest_test_skip(); + } + + /* Call wdt_disable before enabling wdt */ + ret = wdt_disable(wdt); + zassert_true(ret == -EFAULT, + "Calling wdt_disable before watchdog was started should return -EFAULT (-14), " + "got unexpected value of %d", + ret); +} + +/** + * @brief wdt_setup() negative test + * + * Confirm that wdt_setup() returns error value or ASSERTION FAIL + * when it's called before wdt_install_timeouts(). + * + */ +ZTEST(wdt_coverage, test_02_wdt_setup_before_setting_timeouts) +{ + int ret; + + /* Call wdt_setup before wdt_install_timeouts() */ + ztest_set_assert_valid(true); + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret < 0, + "Calling wdt_setup before installing timeouts should fail, got unexpected " + "value of %d", + ret); +} + +/** + * @brief wdt_feed() negative test + * + * Confirm that wdt_feed() returns error value + * when it's called before wdt_setup(). + * Test scenario where none of timeout channels is configured. + * + */ +ZTEST(wdt_coverage, test_03_wdt_feed_before_wdt_setup_channel_not_configured) +{ + int ret; + + /* Call wdt_feed() before wdt_setup() (channel wasn't configured) */ + ret = wdt_feed(wdt, 0); + zassert_true(ret == -EINVAL, + "wdt_feed() shall return error value when called before wdt_setup(), got " + "unexpected value of %d", + ret); +} + +/** + * @brief wdt_install_timeout() negative test + * + * Confirm that wdt_install_timeout() returns + * -ENOTSUP when flag WDT_FLAG_RESET_NONE is not supported + * + */ +ZTEST(wdt_coverage, test_04a_wdt_install_timeout_WDT_FLAG_RESET_NONE_not_supported) +{ + int ret; + + if (WDT_TEST_FLAGS & WDT_FLAG_RESET_NONE_SUPPORTED) { + /* Skip this test because WDT_FLAG_RESET_NONE is supported. */ + ztest_test_skip(); + } + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = WDT_FLAG_RESET_NONE; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret == -ENOTSUP, + "WDT_FLAG_RESET_NONE is not supported on this target and should fail, got " + "unexpected value of %d", + ret); +} + +/** + * @brief wdt_install_timeout() negative test + * + * Confirm that wdt_install_timeout() returns + * -ENOTSUP when flag WDT_FLAG_RESET_CPU_CORE is not supported + * + */ +ZTEST(wdt_coverage, test_04b_wdt_install_timeout_WDT_FLAG_RESET_CPU_CORE_not_supported) +{ + int ret; + + if (WDT_TEST_FLAGS & WDT_FLAG_RESET_CPU_CORE_SUPPORTED) { + /* Skip this test because WDT_FLAG_RESET_CPU_CORE is supported. */ + ztest_test_skip(); + } + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = WDT_FLAG_RESET_CPU_CORE; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret == -ENOTSUP, + "WDT_FLAG_RESET_CPU_CORE is not supported on this target and should fail, got " + "unexpected value of %d", + ret); +} + +/** + * @brief wdt_install_timeout() negative test + * + * Confirm that wdt_install_timeout() returns + * -ENOTSUP when flag WDT_FLAG_RESET_SOC is not supported + * + */ +ZTEST(wdt_coverage, test_04c_wdt_install_timeout_WDT_FLAG_RESET_SOC_not_supported) +{ + int ret; + + if (WDT_TEST_FLAGS & WDT_FLAG_RESET_SOC_SUPPORTED) { + /* Skip this test because WDT_FLAG_RESET_SOC is supported. */ + ztest_test_skip(); + } + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = WDT_FLAG_RESET_SOC; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret == -ENOTSUP, + "WDT_FLAG_RESET_SOC is not supported on this target and should fail, got " + "unexpected value of %d", + ret); +} + +/** + * @brief wdt_install_timeout() negative test + * + * Confirm that wdt_install_timeout() returns + * -EINVAL when window timeout is out of possible range + * + */ +ZTEST(wdt_coverage, test_04w_wdt_install_timeout_with_invalid_window) +{ + int ret; + + /* set defaults */ + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + /* ----------------- window.min + * Check that window.min can't be different than 0 + */ + m_cfg_wdt0.window.min = 1U; + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret == -EINVAL, + "Calling wdt_install_timeout with window.min = 1 should return -EINVAL (-22), " + "got unexpected value of %d", + ret); + + /* Set default window.min */ + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + /* ----------------- window.max + * Check that window.max can't be equal to 0 + */ + m_cfg_wdt0.window.max = 0U; + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret == -EINVAL, + "Calling wdt_install_timeout with window.max = 0 should return -EINVAL (-22), " + "got unexpected value of %d", + ret); + + /* Check that window.max can't exceed maximum allowed value */ + m_cfg_wdt0.window.max = WDT_WINDOW_MAX_ALLOWED + 1; + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret == -EINVAL, + "Calling wdt_install_timeout with window.max = %d should return -EINVAL " + "(-22), got unexpected value of %d", + WDT_WINDOW_MAX_ALLOWED + 1, ret); +} + +/** + * @brief wdt_install_timeout() negative test + * + * Confirm that wdt_install_timeout() returns + * -EINVAL when watchdog supports only one timeout value + * for all timeouts and the supplied timeout window differs + * from windows for alarms installed so far. + * + */ +ZTEST(wdt_coverage, test_04wm_wdt_install_timeout_with_multiple_timeout_values) +{ + int ret; + + if (!(WDT_TEST_FLAGS & WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED)) { + /* Skip this test because timeouts with different values are supported */ + ztest_test_skip(); + } + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + + /* Call wdt_install_timeout again with different window */ + m_cfg_wdt0.window.max = WDT_WINDOW_MAX_ALLOWED >> 1; + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret == -EINVAL, + "wdt_install_timeout should return -EINVAL (-22), got unexpected value of %d", + ret); +} + +/** + * @brief wdt_install_timeout() negative test + * + * Confirm that wdt_install_timeout() returns ASSERTION FAIL or + * -EBUSY when called after the watchdog instance has been already setup. + * + */ +ZTEST(wdt_coverage, test_05_wdt_install_timeout_after_wdt_setup) +{ + int ret; + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + + /* Call wdt_install_timeout again to test invalid use */ + ztest_set_assert_valid(true); + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret == -EBUSY, + "Calling wdt_install_timeout after wdt_setup should return -EBUSY (-16), got " + "unexpected value of %d", + ret); + + /* Assumption: wdt_disable() is called after this test */ +} + +/** + * @brief wdt_setup() negative test + * + * Confirm that wdt_setup() returns + * -ENOTSUP when option WDT_OPT_PAUSE_IN_SLEEP is not supported + * + */ +ZTEST(wdt_coverage, test_06a_wdt_setup_WDT_OPT_PAUSE_IN_SLEEP_not_supported) +{ + int ret; + + if (WDT_TEST_FLAGS & WDT_OPT_PAUSE_IN_SLEEP_SUPPORTED) { + /* Skip this test because WDT_OPT_PAUSE_IN_SLEEP is supported. */ + ztest_test_skip(); + } + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + + ret = wdt_setup(wdt, WDT_OPT_PAUSE_IN_SLEEP); + zassert_true(ret == -ENOTSUP, + "WDT_OPT_PAUSE_IN_SLEEP is not supported on this target and should fail, got " + "unexpected value of %d", + ret); + + ret = wdt_setup(wdt, WDT_OPT_PAUSE_IN_SLEEP | WDT_OPT_PAUSE_HALTED_BY_DBG); + zassert_true(ret == -ENOTSUP, + "WDT_OPT_PAUSE_IN_SLEEP is not supported on this target and should fail, got " + "unexpected value of %d", + ret); +} + +/** + * @brief Test that wdt_setup(device, WDT_OPT_PAUSE_IN_SLEEP) works as expected + * + * Confirm that when WDT_OPT_PAUSE_IN_SLEEP is set, + * watchdog will not fire when thread is sleeping. + * + */ +ZTEST(wdt_coverage, test_06b_wdt_setup_WDT_OPT_PAUSE_IN_SLEEP_functional) +{ + int ret; + + if (!(WDT_TEST_FLAGS & WDT_OPT_PAUSE_IN_SLEEP_SUPPORTED)) { + /* Skip this test because WDT_OPT_PAUSE_IN_SLEEP can NOT be used. */ + ztest_test_skip(); + } + + /* When test fails, watchdog sets m_test_06b_value to TEST_06B_TAG in WDT callback + * wdt_test_06b_cb. Then, target is reset. Check value of m_test_06b_value to prevent reset + * loop on this test. + */ + if (m_test_06b_value == TEST_06B_TAG) { + m_test_06b_value = 0U; + zassert_true(false, "Watchod has fired while it shouldn't"); + } + + /* Clear flag that is set when the watchdog fires */ + m_test_06b_value = 0U; + + m_cfg_wdt0.callback = wdt_test_06b_cb; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + /* Set timeout window to ~500 ms */ + m_cfg_wdt0.window.max = 500U; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + + ret = wdt_setup(wdt, WDT_OPT_PAUSE_IN_SLEEP); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + TC_PRINT("Test has failed if there is reset after this line\n"); + + /* Sleep for longer time than watchdog timeout */ + k_sleep(K_SECONDS(1)); + + /* m_test_06b_value is set to TEST_06B_TAG in WDT callback */ + zassert_equal(m_test_06b_value, 0, "Watchod has fired while it shouldn't"); + + /* Assumption: wdt_disable() is called after each test */ +} + +/** + * @brief wdt_setup() negative test + * + * Confirm that wdt_setup() returns + * -ENOTSUP when option WDT_OPT_PAUSE_HALTED_BY_DBG is not supported + * + */ +ZTEST(wdt_coverage, test_06c_wdt_setup_WDT_OPT_PAUSE_HALTED_BY_DBG_not_supported) +{ + int ret; + + if (WDT_TEST_FLAGS & WDT_OPT_PAUSE_HALTED_BY_DBG_SUPPORTED) { + /* Skip this test because WDT_OPT_PAUSE_HALTED_BY_DBG is supported. */ + ztest_test_skip(); + } + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + + ret = wdt_setup(wdt, WDT_OPT_PAUSE_HALTED_BY_DBG); + zassert_true(ret == -ENOTSUP, + "WDT_OPT_PAUSE_HALTED_BY_DBG is not supported on this target and should fail, " + "got unexpected value of %d", + ret); + + ret = wdt_setup(wdt, WDT_OPT_PAUSE_IN_SLEEP | WDT_OPT_PAUSE_HALTED_BY_DBG); + zassert_true(ret == -ENOTSUP, + "WDT_OPT_PAUSE_HALTED_BY_DBG is not supported on this target and should fail, " + "got unexpected value of %d", + ret); +} + +/** + * @brief wdt_setup() corner case + * + * Confirm that wdt_setup() returns + * 0 - success, when no option is provided + * + */ +ZTEST(wdt_coverage, test_06d_wdt_setup_without_any_OPT) +{ + int ret; + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + + ret = wdt_setup(wdt, 0x0); + zassert_true(ret == 0, "Got unexpected value of %d, while expected is 0", ret); +} + +/** + * @brief wdt_setup() negative test + * + * Confirm that wdt_setup() returns + * -EBUSY when watchdog instance has been already setup. + * + */ +ZTEST(wdt_coverage, test_07_wdt_setup_already_done) +{ + int ret; + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + + /* Call wdt_setup again to test invalid use */ + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == -EBUSY, + "Calling wdt_setup for the second time should return -EBUSY (-16), got " + "unexpected value of %d", + ret); + + /* Assumption: wdt_disable() is called after this test */ +} + +/** + * @brief wdt_setup() negative test + * + * Confirm that wdt_disable() returns + * -EPERM when watchdog can not be disabled directly by application code. + * + */ +ZTEST(wdt_coverage, test_08a_wdt_disable_not_supported) +{ + int ret; + + if (WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED) { + /* Skip this test because wdt_disable() is supported. */ + ztest_test_skip(); + } + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + /* Assumption - test suite execution finishes before WDT timeout will fire */ + m_cfg_wdt0.window.max = WDT_WINDOW_MAX_ALLOWED; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + + /* Call wdt_disable to test not allowed use */ + ret = wdt_disable(wdt); + zassert_true(ret == -EPERM, + "Disabling WDT is not supported on this target and should return -EPERM (-1), " + "got unexpected value of %d", + ret); +} + +/** + * @brief Test that wdt_disable() stops watchdog + * + * Confirm that wdt_disable() prevents previously configured + * watchdog from resetting the core. + * + */ +ZTEST(wdt_coverage, test_08b_wdt_disable_check_not_firing) +{ + int ret; + + if (!(WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED)) { + /* Skip this test because wdt_disable() is NOT supported. */ + ztest_test_skip(); + } + + /* When test fails, watchdog sets m_test_08b_value to TEST_08B_TAG in WDT callback + * wdt_test_08b_cb. Then, target is reset. Check value of m_test_08b_value to prevent reset + * loop on this test. + */ + if (m_test_08b_value == TEST_08B_TAG) { + m_test_08b_value = 0U; + zassert_true(false, "Watchod has fired while it shouldn't"); + } + + /* Clear flag that is set when the watchdog fires */ + m_test_08b_value = 0U; + + m_cfg_wdt0.callback = wdt_test_08b_cb; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + /* Set timeout window to ~500 ms */ + m_cfg_wdt0.window.max = 500U; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + TC_PRINT("Test has failed if there is reset after this line\n"); + + /* Wait for 450 ms, then disable the watchdog + * Don't change to k_sleep() because use of WDT_OPT_PAUSE_IN_SLEEP + * will break test scenario. + */ + k_busy_wait(450000); + ret = wdt_disable(wdt); + zassert_true(ret == 0, "Watchdog disable error, got unexpected value of %d", ret); + + /* Wait a bit more to see if watchdog fires + * Don't change to k_sleep() because use of WDT_OPT_PAUSE_IN_SLEEP + * will break test scenario. + */ + k_busy_wait(300000); + + /* m_test_08b_value is set to TEST_08B_TAG in WDT callback */ + zassert_equal(m_test_08b_value, 0, "Watchod has fired while it shouldn't"); +} + +/** + * @brief Test that after wdt_disable() timeouts can be reconfigured + * + * Confirm that after wdt_disable() it is possible to configure + * timeout channel that was configured previously. + * + */ +ZTEST(wdt_coverage, test_08c_wdt_disable_check_timeouts_reusable) +{ + int ret, id1, id2; + + if (!(WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED)) { + /* Skip this test because wdt_disable() is NOT supported. */ + ztest_test_skip(); + } + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + id1 = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(id1 >= 0, "Watchdog install error, got unexpected value of %d", id1); + TC_PRINT("Configured WDT channel %d\n", id1); + + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + + ret = wdt_disable(wdt); + zassert_true(ret == 0, "Watchdog disable error, got unexpected value of %d", ret); + + id2 = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(id2 >= 0, "Watchdog install error, got unexpected value of %d", id2); + TC_PRINT("Configured WDT channel %d\n", id2); + + /* test that timeout channel id2 is NOT greater than previously returned channel id1 */ + zassert_true(id2 <= id1, + "First usable timeout channel after wdt_disable() is %d, expected number no " + "greater than %d", + id2, id1); +} + +/** + * @brief Test that after wdt_disable() uninstalled timeouts don't have to be feed + * + * Confirm that wdt_disable() uninstalls all timeouts. + * When new timeout is configured, only this one has to be feed. + * + */ +ZTEST(wdt_coverage, test_08d_wdt_disable_check_timeouts_uninstalled) +{ + int ret, id_A, id_B, i; + + if (!(WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED)) { + /* Skip this test because wdt_disable() is NOT supported. */ + ztest_test_skip(); + } + + /* m_test_08d_A_value is set to TEST_08D_A_TAG in callback wdt_test_08d_A_cb */ + if (m_test_08d_A_value == TEST_08D_A_TAG) { + m_test_08d_A_value = 0U; + zassert_true(false, "Timeout A has fired while it shouldn't"); + } + + /* m_test_08d_B_value is set to TEST_08D_B_TAG in callback wdt_test_08d_B_cb */ + if (m_test_08d_B_value == TEST_08D_B_TAG) { + m_test_08d_B_value = 0U; + zassert_true(false, "Timeout B has fired while it shouldn't"); + } + + /* Clear flags that are set when the watchdog fires */ + m_test_08d_A_value = 0U; + m_test_08d_B_value = 0U; + + /* Configure Timeout A */ + m_cfg_wdt0.callback = wdt_test_08d_A_cb; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + /* Set timeout window to ~500 ms */ + m_cfg_wdt0.window.max = 500U; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + id_A = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(id_A >= 0, "Watchdog install error, got unexpected value of %d", id_A); + TC_PRINT("Configured WDT channel %d\n", id_A); + + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + + ret = wdt_disable(wdt); + zassert_true(ret == 0, "Watchdog disable error, got unexpected value of %d", ret); + + /* Configure Timeout B */ + m_cfg_wdt0.callback = wdt_test_08d_B_cb; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + /* Set timeout window to ~500 ms */ + m_cfg_wdt0.window.max = 500U; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + id_B = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(id_B >= 0, "Watchdog install error, got unexpected value of %d", id_B); + TC_PRINT("Configured WDT channel %d\n", id_B); + + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + TC_PRINT("Test has failed if there is reset after this line\n"); + + /* Confirm that only Timeout B has to be feed */ + for (i = 0; i < 4; i++) { + k_busy_wait(450000); + wdt_feed(wdt, id_B); + } + + ret = wdt_disable(wdt); + zassert_true(ret == 0, "Watchdog disable error, got unexpected value of %d", ret); + + /* m_test_08d_A_value is set to TEST_08D_A_TAG in callback wdt_test_08d_A_cb */ + zassert_equal(m_test_08d_A_value, 0, "Timeout A has fired while it shouldn't"); + + /* m_test_08d_B_value is set to TEST_08D_B_TAG in callback wdt_test_08d_B_cb */ + zassert_equal(m_test_08d_B_value, 0, "Timeout B has fired while it shouldn't"); +} + +/** + * @brief wdt_feed() negative test + * + * Confirm that wdt_feed() returns error or ASSERTION FAIL + * when it's called before wdt_setup(). + * Test scenario where timeout channel is configured. + * + */ +ZTEST(wdt_coverage, test_09a_wdt_feed_before_wdt_setup_channel_configured) +{ + int ret, ch_id; + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ch_id = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ch_id >= 0, "Watchdog install error, got unexpected value of %d", ch_id); + TC_PRINT("Configured WDT channel %d\n", ch_id); + + /* Call wdt_feed() before wdt_setup() (channel was configured) */ + ztest_set_assert_valid(true); + ret = wdt_feed(wdt, ch_id); + zassert_true(ret < 0, + "wdt_feed() shall return error value when called before wdt_setup(), got " + "unexpected value of %d", + ret); +} + +/** + * @brief wdt_feed() negative test + * + * Confirm that wdt_feed() returns + * -EINVAL when there is no installed timeout for supplied channel. + * + */ +ZTEST(wdt_coverage, test_09b_wdt_feed_invalid_channel) +{ + int ret, ch_id, ch_invalid; + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ch_id = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ch_id >= 0, "Watchdog install error, got unexpected value of %d", ch_id); + TC_PRINT("Configured WDT channel %d\n", ch_id); + + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + TC_PRINT("Test has failed if there is reset after this line\n"); + + /* Call wdt_feed() on not configured channel */ + ch_invalid = ch_id + 2; + ret = wdt_feed(wdt, ch_invalid); + zassert_true(ret == -EINVAL, + "wdt_feed(%d) shall return -EINVAL (-22), got unexpected value of %d", + ch_invalid, ret); + + /* Call wdt_feed() on not configured channel */ + ch_invalid = ch_id + 1; + ret = wdt_feed(wdt, ch_invalid); + zassert_true(ret == -EINVAL, + "wdt_feed(%d) shall return -EINVAL (-22), got unexpected value of %d", + ch_invalid, ret); + + /* Call wdt_feed() on invalid channel (no such channel) */ + ret = wdt_feed(wdt, -1); + zassert_true(ret == -EINVAL, + "wdt_feed(-1) shall return -EINVAL (-22), got unexpected value of %d", ret); + + /* Call wdt_feed() on invalid channel (no such channel) */ + ret = wdt_feed(wdt, MAX_INSTALLABLE_TIMEOUTS); + zassert_true(ret == -EINVAL, + "wdt_feed(%d) shall return -EINVAL (-22), got unexpected value of %d", + MAX_INSTALLABLE_TIMEOUTS, ret); + + /* Assumption: wdt_disable() is called after each test */ +} + +/** + * @brief wdt_feed() negative test + * + * Confirm that wdt_feed() returns + * -EAGAIN when completing the feed operation would stall the caller, for example + * due to an in-progress watchdog operation such as a previous wdt_feed() call. + * + */ +ZTEST(wdt_coverage, test_09c_wdt_feed_stall) +{ + int ret, ch_id, i; + + if (!(WDT_TEST_FLAGS & WDT_FEED_CAN_STALL)) { + /* Skip this test because wdt_feed() can NOT stall. */ + ztest_test_skip(); + } + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + ch_id = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ch_id >= 0, "Watchdog install error, got unexpected value of %d", ch_id); + TC_PRINT("Configured WDT channel %d\n", ch_id); + + ret = wdt_setup(wdt, DEFAULT_OPTIONS); + zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); + TC_PRINT("Test has failed if there is reset after this line\n"); + + for (i = 0; i < 5; i++) { + ret = wdt_feed(wdt, ch_id); + if (i == 0) { + zassert_true(ret == 0, "wdt_feed error, got unexpected value of %d", ret); + } else { + zassert_true( + ret == -EAGAIN, + "wdt_feed shall return -EAGAIN (-11), got unexpected value of %d", + ret); + } + } +} + +/** + * @brief wdt_install_timeout() negative test + * + * Confirm that wdt_install_timeout() returns + * -ENOMEM when no more timeouts can be installed. + * + */ +ZTEST(wdt_coverage, test_10_wdt_install_timeout_max_number_of_timeouts) +{ + int i, ret; + + m_cfg_wdt0.callback = NULL; + m_cfg_wdt0.flags = DEFAULT_FLAGS; + m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; + m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; + + for (i = 0; i < MAX_INSTALLABLE_TIMEOUTS; i++) { + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + /* Assumption - timeouts are counted from 0 to (MAX_INSTALLABLE_TIMEOUTS - 1) */ + zassert_true(ret < MAX_INSTALLABLE_TIMEOUTS, + "Watchdog install error, got unexpected value of %d", ret); + TC_PRINT("Configured WDT channel %d\n", ret); + } + + /* Call wdt_install_timeout again to test if error value is returned */ + ret = wdt_install_timeout(wdt, &m_cfg_wdt0); + zassert_true(ret == -ENOMEM, + "wdt_install_timeout shall return -ENOMEM (-12), 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; +} + +static void before_test(void *not_used) +{ + ARG_UNUSED(not_used); + int ret_val; + + ret_val = device_is_ready(wdt); + zassert_true(ret_val, "WDT device is not ready, got unexpected value of %d", ret_val); +} + +static void cleanup_after_test(void *f) +{ + if (WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED) { + /* Disable watchdog so it doesn't break other tests */ + wdt_disable(wdt); + } +} + +ZTEST_SUITE(wdt_coverage, NULL, suite_setup, before_test, cleanup_after_test, NULL); diff --git a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml new file mode 100644 index 00000000000..c408d2f8f1d --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml @@ -0,0 +1,13 @@ +common: + tags: + - drivers + - watchdog + depends_on: watchdog + harness: ztest + +tests: + drivers.watchdog.wdt_error_cases: + platform_allow: + - nrf54l15pdk/nrf54l15/cpuapp + integration_platforms: + - nrf54l15pdk/nrf54l15/cpuapp From 5c19b37dd82cb25c02da195af2666e75369b7fad Mon Sep 17 00:00:00 2001 From: Kamil Piszczek Date: Mon, 29 Apr 2024 15:01:06 +0200 Subject: [PATCH 1843/2300] [nrf fromlist] ipc: ipc_service: icbmsg backend: workaround endpoint binding deadlock This change works around the issue with the semaphore timeout during the Bluetooth HCI driver initialization when the bt_enable function is called in the context of the System Workqueue thread. This issue only affects platform that use the IPC service and its ICBMsg backend (e.g. the nRF54H20 DK target). The bt_enable function, when called in the System Workqueue context, results in a deadlock, as the waiting semaphore of the Bluetooth HCI driver times out: bt_hci_driver: Endpoint binding failed with -11 During the Bluetooth HCI driver open operation in the context of the bt_enable function, the driver code waits using the semaphore for the endpoint binding process of the IPC service module to finalize. The issue occurs when the waiting occurs in the System Workqueue context. The ICBMsg backend from the IPC service schedules a system work during the endpoint registration, in which it finalizes the binding operation - also in the System Workqueue context. As the Bluetooth HCI driver with its wait operation keeps the System Workqueue context busy, the endpoint binding cannot be completed by the ICBMsg backend before the HCI driver semaphore timeout. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72377 Signed-off-by: Kamil Piszczek --- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 22 +++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index c7cb5f8ea34..c7127888b18 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -110,6 +110,12 @@ LOG_MODULE_REGISTER(ipc_icbmsg, /** Registered endpoints count mask in flags. */ #define FLAG_EPT_COUNT_MASK 0xFFFF +/** Workqueue stack size for bounding processing (this configuration is not optimized). */ +#define EP_BOUND_WORK_Q_STACK_SIZE (512U) + +/** Workqueue priority for bounding processing. */ +#define EP_BOUND_WORK_Q_PRIORITY (CONFIG_SYSTEM_WORKQUEUE_PRIORITY) + enum msg_type { MSG_DATA = 0, /* Data message. */ MSG_RELEASE_DATA, /* Release data buffer message. */ @@ -194,6 +200,9 @@ struct control_message { BUILD_ASSERT(NUM_EPT <= EPT_ADDR_INVALID, "Too many endpoints"); +/* Work queue for bounding processing. */ +static struct k_work_q ep_bound_work_q; + /** * Calculate pointer to block from its index and channel configuration (RX or TX). * No validation is performed. @@ -672,7 +681,7 @@ static int send_bound_message(struct backend_data *dev_data, struct ept_data *ep */ static void schedule_ept_bound_process(struct backend_data *dev_data) { - k_work_submit(&dev_data->ep_bound_work); + k_work_submit_to_queue(&ep_bound_work_q, &dev_data->ep_bound_work); } /** @@ -1117,6 +1126,17 @@ static int backend_init(const struct device *instance) { const struct icbmsg_config *conf = instance->config; struct backend_data *dev_data = instance->data; + static K_THREAD_STACK_DEFINE(ep_bound_work_q_stack, EP_BOUND_WORK_Q_STACK_SIZE); + static bool is_work_q_started; + + if (!is_work_q_started) { + k_work_queue_init(&ep_bound_work_q); + k_work_queue_start(&ep_bound_work_q, ep_bound_work_q_stack, + K_THREAD_STACK_SIZEOF(ep_bound_work_q_stack), + EP_BOUND_WORK_Q_PRIORITY, NULL); + + is_work_q_started = true; + } dev_data->conf = conf; dev_data->is_initiator = (conf->rx.blocks_ptr < conf->tx.blocks_ptr); From 7491fd071f64c291693db2cad016565074ad8b8c Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 17 Apr 2024 13:54:00 +0200 Subject: [PATCH 1844/2300] [nrf fromtree] boards: nordic: nrf54h20dk: Update memory map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move global RAM0x regions to align with the documentation. Signed-off-by: Grzegorz Swiderski (cherry picked from commit b8338f956d937d6dce3af43f3da93a2c1caa06ec) Signed-off-by: Rafał Kuźnia --- .../nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index 68c0d5cd990..91899e2cf86 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -6,16 +6,16 @@ / { reserved-memory { - cpuapp_ram0x_region: memory@2f000000 { + cpuapp_ram0x_region: memory@2f010000 { compatible = "nordic,owned-memory"; - reg = <0x2f000000 DT_SIZE_K(260)>; + reg = <0x2f010000 DT_SIZE_K(260)>; status = "disabled"; perm-read; perm-write; perm-secure; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0x2f000000 0x41000>; + ranges = <0x0 0x2f010000 0x41000>; cpusec_cpuapp_ipc_shm: memory@0 { reg = <0x0 DT_SIZE_K(2)>; @@ -30,16 +30,16 @@ }; }; - cpurad_ram0x_region: memory@2f041000 { + cpurad_ram0x_region: memory@2f051000 { compatible = "nordic,owned-memory"; - reg = <0x2f041000 DT_SIZE_K(4)>; + reg = <0x2f051000 DT_SIZE_K(4)>; status = "disabled"; perm-read; perm-write; perm-secure; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0x2f041000 0x1000>; + ranges = <0x0 0x2f051000 0x1000>; cpusec_cpurad_ipc_shm: memory@0 { reg = <0x0 DT_SIZE_K(2)>; From 90742665f0f0cde0b1b2732c24f2f37fb3221eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Tue, 7 May 2024 12:56:02 +0200 Subject: [PATCH 1845/2300] [nrf fromlist] modules: hal_nordic: request nRF5340 network CPU in 802.15.4 init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The network CPU must be requested explicitly by the 802.15.4 driver for the sharing mechanism to work correctly. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72412 Signed-off-by: Jędrzej Ciupis --- .../platform/nrf_802154_spinel_backend_ipc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c index b2629eef67b..6df811f6bad 100644 --- a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c +++ b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c @@ -15,6 +15,10 @@ #include "../../spinel_base/spinel.h" #include "../../src/include/nrf_802154_spinel.h" +#if defined(CONFIG_SOC_NRF5340_CPUAPP) +#include +#endif + #define LOG_LEVEL LOG_LEVEL_INFO #define LOG_MODULE_NAME spinel_ipc_backend LOG_MODULE_REGISTER(LOG_MODULE_NAME); @@ -50,6 +54,10 @@ nrf_802154_ser_err_t nrf_802154_backend_init(void) DEVICE_DT_GET(DT_CHOSEN(nordic_802154_spinel_ipc)); int err; +#if defined(CONFIG_SOC_NRF5340_CPUAPP) + nrf53_cpunet_enable(true); +#endif + err = ipc_service_open_instance(ipc_instance); if (err < 0 && err != -EALREADY) { LOG_ERR("Failed to open IPC instance: %d", err); From 688107b4a1a26f2f1df58444d5268a35042c1731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Ciupis?= Date: Tue, 7 May 2024 13:04:51 +0200 Subject: [PATCH 1846/2300] [nrf fromlist] boards: control the network CPU directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Board initialization code should not use the network CPU management. It acts as a permanent request for the network CPU, which causes its users to be unable to turn it off. Instead, let the board initialization code control the network CPU directly. It sets initial state of the network core but does not have any impact on sharing the network CPU as a resource between its users. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72412 Signed-off-by: Jędrzej Ciupis --- .../lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c | 4 ++-- .../nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c | 4 ++-- boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c | 4 ++-- boards/nordic/thingy53/board.c | 4 ++-- boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c | 4 ++-- .../mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c | 4 ++-- .../mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c b/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c index c4f39467314..49c0e5a1c73 100644 --- a/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c +++ b/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c @@ -10,7 +10,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(bl5340_dvk_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -50,7 +50,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c index 3d08a5dd4cd..f9082e6ca40 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include LOG_MODULE_REGISTER(nrf5340_audio_dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -71,7 +71,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c b/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c index 3b85d55dfd0..dadba8c0f54 100644 --- a/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c +++ b/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(nrf5340dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -49,7 +49,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/thingy53/board.c b/boards/nordic/thingy53/board.c index 491808f236a..67059bd4ee8 100644 --- a/boards/nordic/thingy53/board.c +++ b/boards/nordic/thingy53/board.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include LOG_MODULE_REGISTER(thingy53_board_init); @@ -52,7 +52,7 @@ static void enable_cpunet(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c b/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c index cd8281cb2bf..bf0626ce30b 100644 --- a/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c +++ b/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include #if defined(CONFIG_BOARD_PAN1783_EVB_NRF5340_CPUAPP) LOG_MODULE_REGISTER(pan1783_evb_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -42,7 +42,7 @@ static int remoteproc_mgr_boot(void) remoteproc_mgr_config(); /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); diff --git a/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c b/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c index 64e335869fb..9596b3453be 100644 --- a/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c +++ b/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c @@ -10,7 +10,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(raytac_mdbt53_db_40_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -50,7 +50,7 @@ static int remoteproc_mgr_boot(const struct device *dev) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c b/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c index ec4567274c4..31b8bf5a75e 100644 --- a/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c +++ b/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c @@ -49,7 +49,7 @@ static int remoteproc_mgr_boot(const struct device *dev) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ From 888cc087fe4b5840087a95b09cdf2845344d7598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Fri, 26 Apr 2024 12:43:14 +0200 Subject: [PATCH 1847/2300] [nrf fromtree] drivers: spi_dw: add HSSI register layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Synopsys Designware SPI peripheral exists in two versions with slightly different register layouts. Added a Kconfig option that makes the driver compatible with the HSSI register layout. Signed-off-by: Rafał Kuźnia (cherry picked from commit 8ec1e0cdaf296c0ab0306ecee9b61eaafe0bef99) Signed-off-by: Rafał Kuźnia --- drivers/spi/Kconfig.dw | 6 ++++++ drivers/spi/spi_dw.h | 15 +++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/spi/Kconfig.dw b/drivers/spi/Kconfig.dw index 3ebdd54ee93..ed45361d8ed 100644 --- a/drivers/spi/Kconfig.dw +++ b/drivers/spi/Kconfig.dw @@ -20,4 +20,10 @@ config SPI_DW_ACCESS_WORD_ONLY DesignWare SPI only allows word access, byte access will raise exception. +config SPI_DW_HSSI + bool "Designware SPI HSSI variant" + help + Use register layout compatible with the SPI DW HSSI variant of the + peripheral. + endif # SPI_DW diff --git a/drivers/spi/spi_dw.h b/drivers/spi/spi_dw.h index d6383bc4ed2..6c073b47471 100644 --- a/drivers/spi/spi_dw.h +++ b/drivers/spi/spi_dw.h @@ -179,19 +179,26 @@ static int reg_test_bit(uint8_t bit, mm_reg_t addr, uint32_t off) /* Common registers settings, bits etc... */ /* CTRLR0 settings */ +#if !IS_ENABLED(CONFIG_SPI_DW_HSSI) #define DW_SPI_CTRLR0_SCPH_BIT (6) #define DW_SPI_CTRLR0_SCPOL_BIT (7) +#define DW_SPI_CTRLR0_TMOD_SHIFT (8) +#define DW_SPI_CTRLR0_SLV_OE_BIT (10) #define DW_SPI_CTRLR0_SRL_BIT (11) +#else +/* The register layout is different in the HSSI variant */ +#define DW_SPI_CTRLR0_SCPH_BIT (8) +#define DW_SPI_CTRLR0_SCPOL_BIT (9) +#define DW_SPI_CTRLR0_TMOD_SHIFT (10) +#define DW_SPI_CTRLR0_SLV_OE_BIT (12) +#define DW_SPI_CTRLR0_SRL_BIT (13) +#endif #define DW_SPI_CTRLR0_SCPH BIT(DW_SPI_CTRLR0_SCPH_BIT) #define DW_SPI_CTRLR0_SCPOL BIT(DW_SPI_CTRLR0_SCPOL_BIT) #define DW_SPI_CTRLR0_SRL BIT(DW_SPI_CTRLR0_SRL_BIT) - -#define DW_SPI_CTRLR0_SLV_OE_BIT (10) #define DW_SPI_CTRLR0_SLV_OE BIT(DW_SPI_CTRLR0_SLV_OE_BIT) -#define DW_SPI_CTRLR0_TMOD_SHIFT (8) - #define DW_SPI_CTRLR0_TMOD_TX_RX (0) #define DW_SPI_CTRLR0_TMOD_TX (1 << DW_SPI_CTRLR0_TMOD_SHIFT) #define DW_SPI_CTRLR0_TMOD_RX (2 << DW_SPI_CTRLR0_TMOD_SHIFT) From 539253be2bb0d930d3d1dc4268de6d8f3625fa75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Mon, 6 May 2024 10:37:46 +0200 Subject: [PATCH 1848/2300] [nrf fromtree] include: dts: nrf: add EXMIF pinctrl definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added EXMIP pinctrl definitions, which allow selecting pin functions by name in DTS. The definitions are added, but not used in pinctrl_nrf.c. The nrf-regtool reads the pinctrl configuration and applies the settings using different mechanisms. Signed-off-by: Rafał Kuźnia (cherry picked from commit 45d827a51a708e54437f5681dc6c4fb77bfb4f52) Signed-off-by: Rafał Kuźnia --- .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 9d7f8c2312f..a50233ab38c 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -126,6 +126,28 @@ #define NRF_FUN_QSPI_IO2 33U /** QSPI IO3 */ #define NRF_FUN_QSPI_IO3 34U +/** EXMIF CK */ +#define NRF_FUN_EXMIF_CK 35U +/** EXMIF DQ0 */ +#define NRF_FUN_EXMIF_DQ0 36U +/** EXMIF DQ1 */ +#define NRF_FUN_EXMIF_DQ1 37U +/** EXMIF DQ2 */ +#define NRF_FUN_EXMIF_DQ2 38U +/** EXMIF DQ3 */ +#define NRF_FUN_EXMIF_DQ3 39U +/** EXMIF DQ4 */ +#define NRF_FUN_EXMIF_DQ4 40U +/** EXMIF DQ5 */ +#define NRF_FUN_EXMIF_DQ5 41U +/** EXMIF DQ6 */ +#define NRF_FUN_EXMIF_DQ6 42U +/** EXMIF DQ7 */ +#define NRF_FUN_EXMIF_DQ7 43U +/** EXMIF CS0 */ +#define NRF_FUN_EXMIF_CS0 44U +/** EXMIF CS1 */ +#define NRF_FUN_EXMIF_CS1 45U /** @} */ From 6a0c9b2e9223ed2f595db16a69b82d679a971f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Mon, 6 May 2024 10:30:25 +0200 Subject: [PATCH 1849/2300] [nrf fromtree] soc: nrf54h: Enable SPI DW HSSI register layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nRF54H20 implements a variant of the SPI DW peripheral that has slightly different register layout. Enable it in the defconfig. Signed-off-by: Rafał Kuźnia (cherry picked from commit fe98eb767c507a9a2bad0d3124de9de096b29a18) Signed-off-by: Rafał Kuźnia --- 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 72ba234e883..ad06920c15c 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig +++ b/soc/nordic/nrf54h/Kconfig.defconfig @@ -33,4 +33,7 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC endif # RISCV +config SPI_DW_HSSI + default y if SPI_DW + endif # SOC_SERIES_NRF54HX From 3be1bc01f4d44bde6fe3ae0cea56458e2341525e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Fri, 26 Apr 2024 11:15:33 +0200 Subject: [PATCH 1850/2300] [nrf fromtree] dts: nordic: add EXMIF peripheral description to nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added EXMIF peripheral DTS description and bindings. The peripheral operates as an SPI device. Signed-off-by: Rafał Kuźnia (cherry picked from commit 4d30ccb8788eae9444deb78de1e2a3a6dc187927) Signed-off-by: Rafał Kuźnia --- dts/bindings/spi/nordic,nrf-exmif.yaml | 12 ++++++++++++ dts/common/nordic/nrf54h20.dtsi | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 dts/bindings/spi/nordic,nrf-exmif.yaml diff --git a/dts/bindings/spi/nordic,nrf-exmif.yaml b/dts/bindings/spi/nordic,nrf-exmif.yaml new file mode 100644 index 00000000000..d2b8815046b --- /dev/null +++ b/dts/bindings/spi/nordic,nrf-exmif.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic External Memory Interface (EXMIF) + +compatible: "nordic,nrf-exmif" + +include: snps,designware-spi.yaml + +properties: + reg: + required: true diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 7d5a64d0a83..92f2576e733 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -300,6 +300,19 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; + exmif: spi@95000 { + compatible = "nordic,nrf-exmif", "snps,designware-spi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x95000 0x500 0x95500 0xb00>; + reg-names = "wrapper", "core"; + interrupts = <149 NRF_DEFAULT_IRQ_PRIORITY>; + clock-frequency = ; + fifo-depth = <32>; + max-xfer-size = <16>; + status = "disabled"; + }; + cpusec_bellboard: mailbox@99000 { reg = <0x99000 0x1000>; status = "disabled"; From 69aa2866913399627598e9672174e4981ad58574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Mon, 6 May 2024 10:36:04 +0200 Subject: [PATCH 1851/2300] [nrf fromtree] boards: nordic: add mx25uw6345g flash node to nRF54H20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nRF54H20dk has mx25uw6345g flash device on board. Added DTS description and pinctrl configuration. The flash device node is disabled by default. The flash device needs to be powered-on using the nRF Connect for Desktop Board Configurator application. Signed-off-by: Rafał Kuźnia (cherry picked from commit e9c6990220f974cd6070b8acd34d555556cd9bef) Signed-off-by: Rafał Kuźnia --- .../nrf54h20dk_nrf54h20-pinctrl.dtsi | 9 ++++++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 29 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi index 0c842057d64..8bc02597c6d 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -63,4 +63,13 @@ low-power-enable; }; }; + + /omit-if-no-ref/ exmif_default: exmif_default { + group1 { + psels = , + , + ; + nordic,drive-mode = ; + }; + }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 5406d113833..7f2f918b0b9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -209,3 +209,32 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-1 = <&pwm120_sleep>; pinctrl-names = "default", "sleep"; }; + +&gpio6 { + status = "okay"; +}; + +&exmif { + cs-gpios = <&gpio6 3 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&exmif_default>; + pinctrl-names = "default"; + status = "okay"; + mx25uw63: mx25uw6345g@0 { + compatible = "jedec,spi-nor"; + status = "disabled"; + reg = <0>; + spi-max-frequency = ; + jedec-id = [c2 84 37]; + sfdp-bfp = [ + e5 20 8a ff ff ff ff 03 00 ff 00 ff 00 ff 00 ff + ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 10 d8 + 00 ff 00 ff 87 79 01 00 84 12 00 c4 cc 04 67 46 + 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 + 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 + ]; + size = <67108864>; + has-dpd; + t-enter-dpd = <10000>; + t-exit-dpd = <30000>; + }; +}; From 52cf91a352fd9a2fdaacfb6934ae244654a889d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Fri, 26 Apr 2024 10:42:19 +0200 Subject: [PATCH 1852/2300] [nrf fromtree] samples: drivers: jesd216: add nRF54H20 overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Configure the sample for nRF54H20 CPUAPP. Signed-off-by: Rafał Kuźnia (cherry picked from commit b1de9a6c46217b4edc7befb928a9cb2e6d010ca3) Signed-off-by: Rafał Kuźnia --- .../jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..b8f138ad2b2 --- /dev/null +++ b/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&mx25uw63 { + status = "okay"; +}; From 7ea6937f02affb74cae2327aeca955ae5e5c3106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Fri, 26 Apr 2024 13:36:54 +0200 Subject: [PATCH 1853/2300] [nrf noup] drivers: spi_dw: add custom EXMIF peripheral handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Synopsys Designware SPI peripheral core is wrapped in hardware that manages interrupts, power and clock. The SPI core registers are shifted by 0x500 bytes. Before the SPI core is used, the power and clock must be enabled by writing to EXMIF.TASKS_START register. Interrupts must be enabled by writing to EXMIF.INTENSET/INTENCLR registers. The SER register must be configured unconditionally during peripheral setup. Otherwise, the serial transaction does not complete. Signed-off-by: Rafał Kuźnia --- drivers/spi/spi_dw.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi_dw.c b/drivers/spi/spi_dw.c index 7f9d2428ae1..b2787b73a00 100644 --- a/drivers/spi/spi_dw.c +++ b/drivers/spi/spi_dw.c @@ -40,6 +40,10 @@ LOG_MODULE_REGISTER(spi_dw); #include #endif +#ifdef CONFIG_HAS_NRFX +#include +#endif + static inline bool spi_dw_is_slave(struct spi_dw_data *spi) { return (IS_ENABLED(CONFIG_SPI_SLAVE) && @@ -257,6 +261,7 @@ static int spi_dw_configure(const struct device *dev, /* Baud rate and Slave select, for master only */ write_baudr(dev, SPI_DW_CLK_DIVIDER(info->clock_frequency, config->frequency)); + write_ser(dev, BIT(config->slave)); } if (spi_dw_is_slave(spi)) { @@ -499,6 +504,10 @@ void spi_dw_isr(const struct device *dev) uint32_t int_status; int error; +#ifdef CONFIG_HAS_NRFX + NRF_EXMIF->EVENTS_CORE = 0; +#endif + int_status = read_isr(dev); LOG_DBG("SPI %p int_status 0x%x - (tx: %d, rx: %d)", dev, int_status, @@ -544,6 +553,11 @@ int spi_dw_init(const struct device *dev) DEVICE_MMIO_MAP(dev, K_MEM_CACHE_NONE); +#ifdef CONFIG_HAS_NRFX + NRF_EXMIF->INTENSET = BIT(0); + NRF_EXMIF->TASKS_START = 1; +#endif + info->config_func(); /* Masking interrupt and making sure controller is disabled */ @@ -562,6 +576,11 @@ int spi_dw_init(const struct device *dev) return 0; } +#define REG_ADDR(inst) \ + COND_CODE_1(DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), nordic_nrf_exmif), \ + (Z_DEVICE_MMIO_NAMED_ROM_INITIALIZER(core, DT_DRV_INST(inst))), \ + (DEVICE_MMIO_ROM_INIT(DT_DRV_INST(inst)))) + #define SPI_CFG_IRQS_SINGLE_ERR_LINE(inst) \ IRQ_CONNECT(DT_INST_IRQ_BY_NAME(inst, rx_avail, irq), \ DT_INST_IRQ_BY_NAME(inst, rx_avail, priority), \ @@ -634,7 +653,7 @@ COND_CODE_1(IS_EQ(DT_NUM_IRQS(DT_DRV_INST(inst)), 1), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), ctx) \ }; \ static const struct spi_dw_config spi_dw_config_##inst = { \ - DEVICE_MMIO_ROM_INIT(DT_DRV_INST(inst)), \ + REG_ADDR(inst), \ .clock_frequency = COND_CODE_1( \ DT_NODE_HAS_PROP(DT_INST_PHANDLE(inst, clocks), clock_frequency), \ (DT_INST_PROP_BY_PHANDLE(inst, clocks, clock_frequency)), \ From 046e281be0bdaa45f512981431fe7f20c028aa9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Thu, 9 May 2024 08:37:29 +0200 Subject: [PATCH 1854/2300] [nrf fromlist] soc: nrf54h: use word accesses to SPI_DW peripheral MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nRF54H20 EXMIF peripheral requires word accesses. Doing accesses of byte or half-word sizes results in bus fault. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72497 Signed-off-by: Rafał Kuźnia --- 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 ad06920c15c..b09b24e5e70 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig +++ b/soc/nordic/nrf54h/Kconfig.defconfig @@ -36,4 +36,7 @@ endif # RISCV config SPI_DW_HSSI default y if SPI_DW +config SPI_DW_ACCESS_WORD_ONLY + default y if SPI_DW + endif # SOC_SERIES_NRF54HX From db64b2e5da1fab1e4e8178125b6398535b16234b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 11 Apr 2024 14:03:32 +0200 Subject: [PATCH 1855/2300] [nrf fromtree] soc: nordic: nrf54h: Remove redundant ICACHE kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove CONFIG_NRF_ENABLE_ICACHE as it is not needed. There is CONFIG_ICACHE which is by default enabled for nrf54h. Signed-off-by: Krzysztof Chruściński (cherry picked from commit cfa6e250e4ab7f6e38547f8d9b06f117bc1910bc) --- soc/nordic/nrf54h/Kconfig | 8 -------- soc/nordic/nrf54h/soc.c | 2 -- 2 files changed, 10 deletions(-) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 2b967bece7c..8925669ae0d 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -31,11 +31,3 @@ config SOC_NRF54H20_CPURAD config SOC_NRF54H20_CPUPPR depends on RISCV_CORE_NORDIC_VPR - -if SOC_NRF54H20 - -config NRF_ENABLE_ICACHE - bool "Instruction cache (I-Cache)" - default y - -endif # SOC_NRF54H20 diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 1d071f96b20..dd04dbe1b59 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -82,9 +82,7 @@ static int trim_hsfll(void) static int nordicsemi_nrf54h_init(void) { -#if defined(CONFIG_NRF_ENABLE_ICACHE) sys_cache_instr_enable(); -#endif power_domain_init(); From 57df1158a8a9a3f1bd332ab081578e8effe67ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 11 Apr 2024 14:06:57 +0200 Subject: [PATCH 1856/2300] [nrf fromtree] soc: nordic: nrf54h: Add DCACHE initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add initialization of the data cache. Signed-off-by: Krzysztof Chruściński (cherry picked from commit d82b27b08bd7a9dce716b5932b4beeb37b287ea3) --- soc/nordic/nrf54h/soc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index dd04dbe1b59..df72cdb977b 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -83,6 +83,7 @@ static int trim_hsfll(void) static int nordicsemi_nrf54h_init(void) { sys_cache_instr_enable(); + sys_cache_data_enable(); power_domain_init(); From 8fb9679b60816d9f6cd5acf408578849bfcf55fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 15 Apr 2024 11:46:19 +0200 Subject: [PATCH 1857/2300] [nrf fromtree] manifest: Update hal_nordic with nrf_cache change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nrf_cache_lineaddr_get to nordic HAL. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 29a4bb61a00fa53d1dccce9dcf057efdcf25b237) --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 39252a3dfa4..a81bbc3e666 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: f8e4d73a78316ea9ef85f09f24a3a229e40c1a80 + revision: bdef8b66d5f59d95c09889918a04ddaecce322c8 path: modules/hal/nordic groups: - hal From d683236e962ea4c30102f6c25196aff1b2ca288c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 15 Apr 2024 11:37:43 +0200 Subject: [PATCH 1858/2300] [nrf fromtree] drivers: cache: nrf: Handle issue with LINEADDR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nrf54h20 has a bug that requires to manually set 28th bit in the line address. 28th bit indicates secure memory space. Add handling to the cache driver. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 73d4f58b98e9a920066ece1765b5cad5152220ee) --- drivers/cache/Kconfig.nrf | 6 ++++++ drivers/cache/cache_nrf.c | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/cache/Kconfig.nrf b/drivers/cache/Kconfig.nrf index 820445db432..c1cfc2c8c58 100644 --- a/drivers/cache/Kconfig.nrf +++ b/drivers/cache/Kconfig.nrf @@ -7,3 +7,9 @@ config CACHE_NRF_CACHE depends on HAS_NRFX && CACHE_MANAGEMENT help Enable support for the nRF cache driver. + +config CACHE_NRF_PATCH_LINEADDR + bool "Patch lineaddr" + default y if SOC_NRF54H20 + help + Manually set 28th bit in the LINEADDR in Trustzone Secure build. diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index 63d76a47d6e..dc40c5066d9 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -144,7 +144,17 @@ static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, vo size_t size) { uintptr_t line_addr = (uintptr_t)addr; - uintptr_t end_addr = line_addr + size; + uintptr_t end_addr; + + /* Some SOCs has a bug that requires to set 28th bit in the address on + * Trustzone secure builds. + */ + if (IS_ENABLED(CONFIG_CACHE_NRF_PATCH_LINEADDR) && + !IS_ENABLED(CONFIG_TRUSTED_EXECUTION_NONSECURE)) { + line_addr |= BIT(28); + } + + end_addr = line_addr + size; /* * Align address to line size From ead85e51192c6a95969803d75c09cd8ef03d8eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 15 Apr 2024 11:41:15 +0200 Subject: [PATCH 1859/2300] [nrf fromtree] drivers: cache: nrf: Fix case when driver may hang MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Driver was disabling cache before full range operations and that was causing hanging on polling for cache busy status since state was never changing (because cache was disabled). Additionally, added flushing to data cache disabling. If flushing is not performed then execution fails since data in cache is lost. Signed-off-by: Krzysztof Chruściński (cherry picked from commit b83a11281d9e1b8c7a73738513b19d8952d643cd) --- drivers/cache/cache_nrf.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index dc40c5066d9..b0fa8a02de8 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -68,14 +68,6 @@ static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) return -ENOTSUP; } - k_spinlock_key_t key = k_spin_lock(&lock); - - /* - * Invalidating the whole cache is dangerous. For good measure - * disable the cache. - */ - nrf_cache_disable(cache); - wait_for_cache(cache); switch (op) { @@ -102,10 +94,6 @@ static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) wait_for_cache(cache); - nrf_cache_enable(cache); - - k_spin_unlock(&lock, key); - return 0; } @@ -202,11 +190,6 @@ void cache_data_enable(void) nrf_cache_enable(NRF_DCACHE); } -void cache_data_disable(void) -{ - nrf_cache_disable(NRF_DCACHE); -} - int cache_data_flush_all(void) { #if NRF_CACHE_HAS_TASK_CLEAN @@ -216,6 +199,14 @@ int cache_data_flush_all(void) #endif } +void cache_data_disable(void) +{ + if (nrf_cache_enable_check(NRF_DCACHE)) { + (void)cache_data_flush_all(); + } + nrf_cache_disable(NRF_DCACHE); +} + int cache_data_invd_all(void) { return _cache_checks(NRF_DCACHE, K_NRF_CACHE_INVD, NULL, 0, false); From 77dae54438a064b3f0ff2a471ef6c6dfa38855db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 15 Apr 2024 11:44:39 +0200 Subject: [PATCH 1860/2300] [nrf fromtree] drivers: cache: nrf: Optimize operation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply changes which significantly speed up cache operations. Removed k_busy_wait from function which polls for cache busyness. Removed spinlock from cache operation. Lock taking and releasing takes time and it is faster to check if LINEADDR changed after performing the operation. If LINEADDR changed then it indicates that current context was preempted by another cache operation. If such state is detected current operation is repeated. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 9f6567b87a36f6d08a4923db08932ece5deb7d4d) --- drivers/cache/cache_nrf.c | 44 +++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index b0fa8a02de8..d1a28127727 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -17,7 +17,6 @@ LOG_MODULE_REGISTER(cache_nrfx, CONFIG_CACHE_LOG_LEVEL); #define CACHE_LINE_SIZE 32 #define CACHE_BUSY_RETRY_INTERVAL_US 10 -static struct k_spinlock lock; enum k_nrf_cache_op { /* @@ -55,7 +54,6 @@ static inline bool is_cache_busy(NRF_CACHE_Type *cache) static inline void wait_for_cache(NRF_CACHE_Type *cache) { while (is_cache_busy(cache)) { - k_busy_wait(CACHE_BUSY_RETRY_INTERVAL_US); } } @@ -99,33 +97,33 @@ static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) static inline void _cache_line(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, uintptr_t line_addr) { - wait_for_cache(cache); + do { + wait_for_cache(cache); - nrf_cache_lineaddr_set(cache, line_addr); + nrf_cache_lineaddr_set(cache, line_addr); - switch (op) { + switch (op) { #if NRF_CACHE_HAS_TASK_CLEAN - case K_NRF_CACHE_CLEAN: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANLINE); - break; + case K_NRF_CACHE_CLEAN: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANLINE); + break; #endif - case K_NRF_CACHE_INVD: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATELINE); - break; + case K_NRF_CACHE_INVD: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATELINE); + break; #if NRF_CACHE_HAS_TASK_FLUSH - case K_NRF_CACHE_FLUSH: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHLINE); - break; + case K_NRF_CACHE_FLUSH: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHLINE); + break; #endif - default: - break; - } - - wait_for_cache(cache); + default: + break; + } + } while (nrf_cache_lineaddr_get(cache) != line_addr); } static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, void *addr, @@ -150,16 +148,12 @@ static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, vo line_addr &= ~(CACHE_LINE_SIZE - 1); do { - k_spinlock_key_t key = k_spin_lock(&lock); - _cache_line(cache, op, line_addr); - - k_spin_unlock(&lock, key); - line_addr += CACHE_LINE_SIZE; - } while (line_addr < end_addr); + wait_for_cache(cache); + return 0; } From 77b790ce1d5f5d9d957a37d259ec89d256bf60a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 15 Apr 2024 11:56:10 +0200 Subject: [PATCH 1861/2300] [nrf fromtree] drivers: cache: nrf: Use CONFIG_DCACHE_LINE_SIZE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use Kconfig instead of fixed value in the driver code. Signed-off-by: Krzysztof Chruściński (cherry picked from commit 4e880e62dc37f76da4c8428ea6c519a139f3b0d2) --- drivers/cache/cache_nrf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index d1a28127727..3cf79897874 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -14,7 +14,6 @@ LOG_MODULE_REGISTER(cache_nrfx, CONFIG_CACHE_LOG_LEVEL); #define NRF_ICACHE NRF_CACHE #endif -#define CACHE_LINE_SIZE 32 #define CACHE_BUSY_RETRY_INTERVAL_US 10 @@ -145,11 +144,11 @@ static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, vo /* * Align address to line size */ - line_addr &= ~(CACHE_LINE_SIZE - 1); + line_addr &= ~(CONFIG_DCACHE_LINE_SIZE - 1); do { _cache_line(cache, op, line_addr); - line_addr += CACHE_LINE_SIZE; + line_addr += CONFIG_DCACHE_LINE_SIZE; } while (line_addr < end_addr); wait_for_cache(cache); From 6eb334e87a0e127c3ed9589f253d90b45818dc02 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Tue, 23 Apr 2024 11:46:34 +0200 Subject: [PATCH 1862/2300] [nrf fromtree] dts: bindings: pwm: nordic: add memory-region support This property will allow PWM driver allocate data buffer in appropriate memory region. Signed-off-by: Nikodem Kastelik (cherry picked from commit a6f57fae0b14992474ab1c757b2aee4fc1cefe82) --- dts/bindings/pwm/nordic,nrf-pwm.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/bindings/pwm/nordic,nrf-pwm.yaml b/dts/bindings/pwm/nordic,nrf-pwm.yaml index 9f2c21d2b35..e634cdee6d0 100644 --- a/dts/bindings/pwm/nordic,nrf-pwm.yaml +++ b/dts/bindings/pwm/nordic,nrf-pwm.yaml @@ -2,7 +2,7 @@ description: nRF PWM compatible: "nordic,nrf-pwm" -include: [pwm-controller.yaml, base.yaml, pinctrl-device.yaml] +include: [pwm-controller.yaml, base.yaml, pinctrl-device.yaml, memory-region.yaml] properties: reg: From 2c33fd0a3d1c4db354861b185ea17b189c72f879 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Tue, 23 Apr 2024 11:48:22 +0200 Subject: [PATCH 1863/2300] [nrf fromtree] drivers: pwm_nrfx: place data buf in correct mem reg Some devices (like nRF54H20) must have PWM data buffer stored in appropriate location. Signed-off-by: Nikodem Kastelik (cherry picked from commit e0b98dccd1df710e1e4bfe0a475273508a01bd6d) --- drivers/pwm/pwm_nrfx.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 9feacb2c10b..f6312535c7e 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -45,7 +46,6 @@ struct pwm_nrfx_config { struct pwm_nrfx_data { uint32_t period_cycles; - uint16_t seq_values[NRF_PWM_CHANNEL_COUNT]; /* Bit mask indicating channels that need the PWM generation. */ uint8_t pwm_needed; uint8_t prescaler; @@ -56,6 +56,12 @@ struct pwm_nrfx_data { #error "Current implementation supports maximum 8 channels." #endif +static uint16_t *seq_values_ptr_get(const struct device *dev) +{ + const struct pwm_nrfx_config *config = dev->config; + + return (uint16_t *)config->seq.values.p_raw; +} static bool pwm_period_check_and_set(const struct device *dev, uint32_t channel, uint32_t period_cycles) @@ -164,7 +170,7 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, needs_pwm = true; } - data->seq_values[channel] = PWM_NRFX_CH_VALUE(compare_value, inverted); + seq_values_ptr_get(dev)[channel] = PWM_NRFX_CH_VALUE(compare_value, inverted); LOG_DBG("channel %u, pulse %u, period %u, prescaler: %u.", channel, pulse_cycles, period_cycles, data->prescaler); @@ -249,7 +255,6 @@ static const struct pwm_driver_api pwm_nrfx_drv_api_funcs = { static int pwm_nrfx_init(const struct device *dev) { const struct pwm_nrfx_config *config = dev->config; - struct pwm_nrfx_data *data = dev->data; uint8_t initially_inverted = 0; int ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); @@ -260,7 +265,7 @@ static int pwm_nrfx_init(const struct device *dev) return ret; } - for (size_t i = 0; i < ARRAY_SIZE(data->seq_values); i++) { + for (size_t i = 0; i < NRF_PWM_CHANNEL_COUNT; i++) { uint32_t psel; if (channel_psel_get(i, &psel, config)) { @@ -273,10 +278,10 @@ static int pwm_nrfx_init(const struct device *dev) } } - for (size_t i = 0; i < ARRAY_SIZE(data->seq_values); i++) { + for (size_t i = 0; i < NRF_PWM_CHANNEL_COUNT; i++) { bool inverted = initially_inverted & BIT(i); - data->seq_values[i] = PWM_NRFX_CH_VALUE(0, inverted); + seq_values_ptr_get(dev)[i] = PWM_NRFX_CH_VALUE(0, inverted); } nrfx_err_t result = nrfx_pwm_init(&config->pwm, @@ -339,10 +344,19 @@ static int pwm_nrfx_pm_action(const struct device *dev, #define PWM(dev_idx) DT_NODELABEL(pwm##dev_idx) #define PWM_PROP(dev_idx, prop) DT_PROP(PWM(dev_idx), prop) +#define PWM_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(PWM(idx), prop) + +#define PWM_MEMORY_SECTION(idx) \ + COND_CODE_1(PWM_HAS_PROP(idx, memory_regions), \ + (__attribute__((__section__(LINKER_DT_NODE_REGION_NAME( \ + DT_PHANDLE(PWM(idx), memory_regions)))))), \ + ()) #define PWM_NRFX_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(PWM(idx)); \ static struct pwm_nrfx_data pwm_nrfx_##idx##_data; \ + static uint16_t pwm_##idx##_seq_values[NRF_PWM_CHANNEL_COUNT] \ + PWM_MEMORY_SECTION(idx); \ PINCTRL_DT_DEFINE(PWM(idx)); \ static const struct pwm_nrfx_config pwm_nrfx_##idx##_config = { \ .pwm = NRFX_PWM_INSTANCE(idx), \ @@ -357,7 +371,7 @@ static int pwm_nrfx_pm_action(const struct device *dev, .load_mode = NRF_PWM_LOAD_INDIVIDUAL, \ .step_mode = NRF_PWM_STEP_TRIGGERED, \ }, \ - .seq.values.p_raw = pwm_nrfx_##idx##_data.seq_values, \ + .seq.values.p_raw = pwm_##idx##_seq_values, \ .seq.length = NRF_PWM_CHANNEL_COUNT, \ .pcfg = PINCTRL_DT_DEV_CONFIG_GET(PWM(idx)), \ }; \ From a8a0b1cac46d8886a062af4b92f09c3827842539 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Tue, 23 Apr 2024 11:50:01 +0200 Subject: [PATCH 1864/2300] [nrf fromtree] tests: drivers: pwm: nrf54h20dk: add memory-region prop This property will ensure that PWM driver allocates data buffer in appropriate location. Signed-off-by: Nikodem Kastelik (cherry picked from commit 539a428032aa6bcb27d3de721adf0c74a6c7c0e7) --- .../pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index c483d27f569..6944718f64d 100644 --- a/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -17,4 +17,5 @@ pinctrl-0 = <&pwm_default>; pinctrl-1 = <&pwm_sleep>; pinctrl-names = "default", "sleep"; + memory-regions = <&cpuapp_dma_region>; }; From 2f78bc89c92578db48051e54f83f6820f9101909 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Thu, 25 Apr 2024 08:57:08 +0200 Subject: [PATCH 1865/2300] [nrf fromtree] boards: nordic: nrf54h20: add PWM to supported features PWM is now supported on nRF54H20 board. Signed-off-by: Nikodem Kastelik (cherry picked from commit 82db5d3adbadcebc6bb979f8da9c1d47cbe868f4) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml | 1 + 3 files changed, 3 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml index 0ba6bfe3ba2..6ecde2cfdb1 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml @@ -13,3 +13,4 @@ ram: 256 flash: 512 supported: - gpio + - pwm diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml index b986a456623..190d835f580 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml @@ -11,3 +11,4 @@ ram: 62 flash: 62 supported: - gpio + - pwm diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index 420d854cbca..b199f65385f 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -13,3 +13,4 @@ ram: 192 flash: 256 supported: - gpio + - pwm From 8e18208ae30e172d05b69bba5908095a561c0794 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Mon, 29 Apr 2024 13:55:53 +0000 Subject: [PATCH 1866/2300] [nrf fromtree] MAINTAINERS: fix more paths Fix few more paths that are failing to parse on system running Python >= 3.11 due to a change in behavior of glob. Signed-off-by: Fabio Baltieri (cherry picked from commit 0ef608a0ab3e90ba28b9f50862a207a0fc64af66) --- MAINTAINERS.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index c7fe04762ca..c70147b5195 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -3547,7 +3547,6 @@ STM32 Platforms: - GeorgeCGV files: - boards/st/ - - drivers/*/*stm32*/ - drivers/*/*stm32*.c - drivers/*/*stm32*.h - drivers/*/*/*stm32* @@ -3674,8 +3673,7 @@ Infineon Platforms: - boards/cypress/ - boards/infineon/ - drivers/*/*ifx_cat1* - - drivers/*/*xmc*/ - - drivers/*/*xmc*.c + - drivers/*/*xmc* - drivers/sensor/infineon/ - dts/arm/infineon/ - dts/arm/cypress/ From ea89f1f8f5795301fe2448ce81dd2589f3e04b00 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 10 Apr 2024 11:26:15 +0300 Subject: [PATCH 1867/2300] [nrf fromtree] net: vlan: Fix net_eth_get_vlan_tag() to check correct interface The network interface parameter for net_eth_get_vlan_tag() should be the VLAN interface so use the search loop properly. Earlier the main interface could be checked. Add also test cases for this so that we can catch that the func works properly. Signed-off-by: Jukka Rissanen (cherry picked from commit d40abe8c0f880c53bdfb759895c2a5c910892646) Signed-off-by: Robert Lubos --- subsys/net/l2/ethernet/vlan.c | 17 ++++++++--------- tests/net/vlan/src/main.c | 25 +++++++++++++++++++++---- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/subsys/net/l2/ethernet/vlan.c b/subsys/net/l2/ethernet/vlan.c index 844a6bbd2ef..9a6d660aeb6 100644 --- a/subsys/net/l2/ethernet/vlan.c +++ b/subsys/net/l2/ethernet/vlan.c @@ -317,18 +317,17 @@ bool net_eth_is_vlan_enabled(struct ethernet_context *ctx, uint16_t net_eth_get_vlan_tag(struct net_if *iface) { uint16_t tag = NET_VLAN_TAG_UNSPEC; - struct vlan_context *ctx; k_mutex_lock(&lock, K_FOREVER); - ctx = get_vlan_ctx(iface, tag, true); - if (ctx != NULL) { - /* The Ethernet interface does not have a tag so if user - * tried to use the main interface, then do not return - * the tag. - */ - if (ctx->attached_to != iface) { - tag = ctx->tag; + ARRAY_FOR_EACH(vlan_ctx, i) { + if (vlan_ctx[i] == NULL || !vlan_ctx[i]->is_used) { + continue; + } + + if (vlan_ctx[i]->iface == iface) { + tag = vlan_ctx[i]->tag; + break; } } diff --git a/tests/net/vlan/src/main.c b/tests/net/vlan/src/main.c index e739af7dd12..a17aef644c7 100644 --- a/tests/net/vlan/src/main.c +++ b/tests/net/vlan/src/main.c @@ -574,6 +574,23 @@ static void test_vlan_enable(void) ret = net_eth_vlan_enable(iface, VLAN_TAG_1); zassert_equal(ret, -EALREADY, "VLAN tag %d enabled for iface 1 (%d)", VLAN_TAG_1, ret); + + for (int i = VLAN_TAG_1; i <= VLAN_TAG_5; i += 100) { + iface = net_eth_get_vlan_iface(NULL, i); + + ARRAY_FOR_EACH_PTR(vlan_interfaces, vlan_iface) { + uint16_t tag; + + if (*vlan_iface == iface) { + tag = net_eth_get_vlan_tag(*vlan_iface); + + zassert_equal(tag, i, + "Could not get the VLAN interface (%d)", + net_if_get_by_iface(*vlan_iface)); + break; + } + } + } } static void test_vlan_disable(void) @@ -628,13 +645,13 @@ static void test_vlan_enable_all(void) int ret; ret = net_eth_vlan_enable(eth_interfaces[0], VLAN_TAG_1); - zassert_equal(ret, 0, "Cannot enable %d", VLAN_TAG_1); + zassert_true(ret == 0 || ret == -EALREADY, "Cannot enable %d", VLAN_TAG_1); ret = net_eth_vlan_enable(eth_interfaces[0], VLAN_TAG_2); - zassert_equal(ret, 0, "Cannot enable %d", VLAN_TAG_2); + zassert_true(ret == 0 || ret == -EALREADY, "Cannot enable %d", VLAN_TAG_2); ret = net_eth_vlan_enable(eth_interfaces[0], VLAN_TAG_3); - zassert_equal(ret, 0, "Cannot enable %d", VLAN_TAG_3); + zassert_true(ret == 0 || ret == -EALREADY, "Cannot enable %d", VLAN_TAG_3); ret = net_eth_vlan_enable(eth_interfaces[0], VLAN_TAG_4); - zassert_equal(ret, 0, "Cannot enable %d", VLAN_TAG_4); + zassert_true(ret == 0 || ret == -EALREADY, "Cannot enable %d", VLAN_TAG_4); eth_ctx = net_if_l2_data(eth_interfaces[0]); From f92b43cfe1cec05636b9991caf7a3b76dea81f23 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 25 Apr 2024 09:47:23 +0300 Subject: [PATCH 1868/2300] [nrf fromtree] net: vlan: Add a function to check if interface is VLAN one We were missing a helper function that can be used to check whether the given function is the virtual VLAN interface. Signed-off-by: Jukka Rissanen (cherry picked from commit 07599e3a539f4e6563144cada8cfbb50eae3d93c) Signed-off-by: Robert Lubos --- include/zephyr/net/ethernet.h | 18 ++++++++++++++++++ subsys/net/l2/ethernet/vlan.c | 16 ++++++++++++++++ tests/net/vlan/src/main.c | 5 +++++ 3 files changed, 39 insertions(+) diff --git a/include/zephyr/net/ethernet.h b/include/zephyr/net/ethernet.h index e39fa7d170e..9ecc7340d03 100644 --- a/include/zephyr/net/ethernet.h +++ b/include/zephyr/net/ethernet.h @@ -971,6 +971,24 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface) } #endif +/** + * @brief Check if the given interface is a VLAN interface. + * + * @param iface Network interface + * + * @return True if this network interface is VLAN one, false if not. + */ +#if defined(CONFIG_NET_VLAN) +bool net_eth_is_vlan_interface(struct net_if *iface); +#else +static inline bool net_eth_is_vlan_interface(struct net_if *iface) +{ + ARG_UNUSED(iface); + + return false; +} +#endif + #if !defined(CONFIG_ETH_DRIVER_RAW_MODE) #define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \ diff --git a/subsys/net/l2/ethernet/vlan.c b/subsys/net/l2/ethernet/vlan.c index 9a6d660aeb6..f8e21efbbb0 100644 --- a/subsys/net/l2/ethernet/vlan.c +++ b/subsys/net/l2/ethernet/vlan.c @@ -336,6 +336,22 @@ uint16_t net_eth_get_vlan_tag(struct net_if *iface) return tag; } +bool net_eth_is_vlan_interface(struct net_if *iface) +{ + enum virtual_interface_caps caps; + + if (net_if_l2(iface) != &NET_L2_GET_NAME(VIRTUAL)) { + return false; + } + + caps = net_virtual_get_iface_capabilities(iface); + if (!(caps & VIRTUAL_INTERFACE_VLAN)) { + return false; + } + + return true; +} + bool net_eth_get_vlan_status(struct net_if *iface) { bool status = false; diff --git a/tests/net/vlan/src/main.c b/tests/net/vlan/src/main.c index a17aef644c7..a7851cc2fc6 100644 --- a/tests/net/vlan/src/main.c +++ b/tests/net/vlan/src/main.c @@ -581,6 +581,11 @@ static void test_vlan_enable(void) ARRAY_FOR_EACH_PTR(vlan_interfaces, vlan_iface) { uint16_t tag; + ret = net_eth_is_vlan_interface(*vlan_iface); + zassert_equal(ret, true, + "Not identified as VLAN interface %d", + net_if_get_by_iface(*vlan_iface)); + if (*vlan_iface == iface) { tag = net_eth_get_vlan_tag(*vlan_iface); From 7c0c899c4e1eba58019c9424b3e8bcd5e5f2f2fc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 15 May 2023 11:43:27 +0200 Subject: [PATCH 1869/2300] [nrf fromtree] net: arp: Add support for gratuitous ARP transmission Add support for gratuitous ARP transmission by Zephyr network stack. This allows to prematurely fill the peer ARP table, so there's no need to send an explicit request when peer needs to send an actual packet. The gratuitous ARP is send when the network interface is brought up (joins the network) or a new IP address is added. The gratuitous ARP request is also sent periodically, with a configurable interval time. The gratuitous ARP should also be sent whenever MAC address of the interface is changed, but as Zephyr only allows to do this when interface is down, this is already covered by the first case (interface brought up). Signed-off-by: Robert Lubos (cherry picked from commit 6551e6f5baea82cbf7f98cb5bbf5ca5c3c7a901f) --- subsys/net/l2/ethernet/Kconfig | 13 +++ subsys/net/l2/ethernet/arp.c | 157 +++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+) diff --git a/subsys/net/l2/ethernet/Kconfig b/subsys/net/l2/ethernet/Kconfig index 17588b17fd1..e6fd07e47e2 100644 --- a/subsys/net/l2/ethernet/Kconfig +++ b/subsys/net/l2/ethernet/Kconfig @@ -73,6 +73,19 @@ config NET_ARP_GRATUITOUS ff:ff:ff:ff:ff:ff. Ordinarily, no reply packet will occur. A gratuitous ARP reply is a reply to which no request has been made. +config NET_ARP_GRATUITOUS_TRANSMISSION + bool "Transmit gratuitous ARP requests" + depends on NET_ARP_GRATUITOUS + depends on NET_MGMT_EVENT + depends on NET_MGMT_EVENT_INFO + help + Transmit gratuitous ARP requests, as defined in RFC 5227. + +config NET_ARP_GRATUITOUS_INTERVAL + int "Time interval (in seconds) between sending gratuitous ARP requests" + depends on NET_ARP_GRATUITOUS_TRANSMISSION + default 60 + if NET_ARP module = NET_ARP module-dep = NET_LOG diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index 7c0a2ba74f2..85eafd0eedb 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_arp, CONFIG_NET_ARP_LOG_LEVEL); #include #include #include +#include #include "arp.h" #include "net_private.h" @@ -34,6 +35,12 @@ static struct k_work_delayable arp_request_timer; static struct k_mutex arp_mutex; +#if defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) +static struct net_mgmt_event_callback iface_event_cb; +static struct net_mgmt_event_callback ipv4_event_cb; +static struct k_work_delayable arp_gratuitous_work; +#endif /* defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) */ + static void arp_entry_cleanup(struct arp_entry *entry, bool pending) { NET_DBG("entry %p", entry); @@ -466,6 +473,141 @@ static void arp_gratuitous(struct net_if *iface, } } +#if defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) +static void arp_gratuitous_send(struct net_if *iface, + struct in_addr *ipaddr) +{ + struct net_arp_hdr *hdr; + struct net_pkt *pkt; + + pkt = net_pkt_alloc_with_buffer(iface, sizeof(struct net_arp_hdr), + AF_UNSPEC, 0, NET_BUF_TIMEOUT); + if (!pkt) { + return; + } + + net_buf_add(pkt->buffer, sizeof(struct net_arp_hdr)); + net_pkt_set_vlan_tag(pkt, net_eth_get_vlan_tag(iface)); + + hdr = NET_ARP_HDR(pkt); + + hdr->hwtype = htons(NET_ARP_HTYPE_ETH); + hdr->protocol = htons(NET_ETH_PTYPE_IP); + hdr->hwlen = sizeof(struct net_eth_addr); + hdr->protolen = sizeof(struct in_addr); + hdr->opcode = htons(NET_ARP_REQUEST); + + memcpy(&hdr->dst_hwaddr.addr, net_eth_broadcast_addr(), + sizeof(struct net_eth_addr)); + memcpy(&hdr->src_hwaddr.addr, net_if_get_link_addr(iface)->addr, + sizeof(struct net_eth_addr)); + + net_ipv4_addr_copy_raw(hdr->dst_ipaddr, (uint8_t *)ipaddr); + net_ipv4_addr_copy_raw(hdr->src_ipaddr, (uint8_t *)ipaddr); + + net_pkt_lladdr_src(pkt)->addr = net_if_get_link_addr(iface)->addr; + net_pkt_lladdr_src(pkt)->len = sizeof(struct net_eth_addr); + + net_pkt_lladdr_dst(pkt)->addr = (uint8_t *)net_eth_broadcast_addr(); + net_pkt_lladdr_dst(pkt)->len = sizeof(struct net_eth_addr); + + NET_DBG("Sending gratuitous ARP pkt %p", pkt); + + if (net_if_send_data(iface, pkt) == NET_DROP) { + net_pkt_unref(pkt); + } +} + +static void notify_all_ipv4_addr(struct net_if *iface) +{ + struct net_if_ipv4 *ipv4 = iface->config.ip.ipv4; + int i; + + if (!ipv4) { + return; + } + + for (i = 0; i < NET_IF_MAX_IPV4_ADDR; i++) { + if (ipv4->unicast[i].ipv4.is_used && + ipv4->unicast[i].ipv4.address.family == AF_INET && + ipv4->unicast[i].ipv4.addr_state == NET_ADDR_PREFERRED) { + arp_gratuitous_send(iface, + &ipv4->unicast[i].ipv4.address.in_addr); + } + } +} + +static void iface_event_handler(struct net_mgmt_event_callback *cb, + uint32_t mgmt_event, struct net_if *iface) +{ + ARG_UNUSED(cb); + + if (!(net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET) || + net_eth_is_vlan_interface(iface))) { + return; + } + + if (mgmt_event != NET_EVENT_IF_UP) { + return; + } + + notify_all_ipv4_addr(iface); +} + +static void ipv4_event_handler(struct net_mgmt_event_callback *cb, + uint32_t mgmt_event, struct net_if *iface) +{ + struct in_addr *ipaddr; + + if (!(net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET) || + net_eth_is_vlan_interface(iface))) { + return; + } + + if (!net_if_is_up(iface)) { + return; + } + + if (mgmt_event != NET_EVENT_IPV4_ADDR_ADD) { + return; + } + + if (cb->info_length != sizeof(struct in_addr)) { + return; + } + + ipaddr = (struct in_addr *)cb->info; + + arp_gratuitous_send(iface, ipaddr); +} + +static void iface_cb(struct net_if *iface, void *user_data) +{ + ARG_UNUSED(user_data); + + if (!(net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET) || + net_eth_is_vlan_interface(iface))) { + return; + } + + if (!net_if_is_up(iface)) { + return; + } + + notify_all_ipv4_addr(iface); +} + +static void arp_gratuitous_work_handler(struct k_work *work) +{ + ARG_UNUSED(work); + + net_if_foreach(iface_cb, NULL); + + k_work_reschedule(&arp_gratuitous_work, + K_SECONDS(CONFIG_NET_ARP_GRATUITOUS_INTERVAL)); +} +#endif /* defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) */ + void net_arp_update(struct net_if *iface, struct in_addr *src, struct net_eth_addr *hwaddr, @@ -837,4 +979,19 @@ void net_arp_init(void) k_mutex_init(&arp_mutex); arp_cache_initialized = true; + +#if defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) + net_mgmt_init_event_callback(&iface_event_cb, iface_event_handler, + NET_EVENT_IF_UP); + net_mgmt_init_event_callback(&ipv4_event_cb, ipv4_event_handler, + NET_EVENT_IPV4_ADDR_ADD); + + net_mgmt_add_event_callback(&iface_event_cb); + net_mgmt_add_event_callback(&ipv4_event_cb); + + k_work_init_delayable(&arp_gratuitous_work, + arp_gratuitous_work_handler); + k_work_reschedule(&arp_gratuitous_work, + K_SECONDS(CONFIG_NET_ARP_GRATUITOUS_INTERVAL)); +#endif /* defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) */ } From 934b55e21e52316a895219ce81a48bb72d0b7e77 Mon Sep 17 00:00:00 2001 From: Marcin Kajor Date: Mon, 6 May 2024 09:26:21 +0200 Subject: [PATCH 1870/2300] [nrf fromtree] net: if: Extend the usage of rejoining the multicast groups It may happen that the interface is up but not yet running when we issue the rejoin_ipv6_mcast_groups(). This can be fixed by calling this function again right after the iface is set to 'running' state in the notify_iface_up handler. Signed-off-by: Marcin Kajor (cherry picked from commit b571e45d80923a786979460f218618e2000da8f3) --- subsys/net/ip/net_if.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index a72470a434d..15a66af477c 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -4633,6 +4633,18 @@ bool net_if_is_offloaded(struct net_if *iface) net_if_is_socket_offloaded(iface)); } +static void rejoin_multicast_groups(struct net_if *iface) +{ +#if defined(CONFIG_NET_NATIVE_IPV6) + rejoin_ipv6_mcast_groups(iface); + if (l2_flags_get(iface) & NET_L2_MULTICAST) { + join_mcast_allnodes(iface); + } +#else + ARG_UNUSED(iface); +#endif +} + static void notify_iface_up(struct net_if *iface) { /* In many places it's assumed that link address was set with @@ -4659,6 +4671,10 @@ static void notify_iface_up(struct net_if *iface) */ if (!net_if_is_offloaded(iface) && !(l2_flags_get(iface) & NET_L2_POINT_TO_POINT)) { + /* Make sure that we update the IPv6 addresses and join the + * multicast groups. + */ + rejoin_multicast_groups(iface); iface_ipv6_start(iface); net_ipv4_autoconf_start(iface); } @@ -4780,13 +4796,6 @@ static void init_igmp(struct net_if *iface) #endif } -static void rejoin_multicast_groups(struct net_if *iface) -{ -#if defined(CONFIG_NET_NATIVE_IPV6) - rejoin_ipv6_mcast_groups(iface); -#endif -} - int net_if_up(struct net_if *iface) { int status = 0; @@ -4844,14 +4853,6 @@ int net_if_up(struct net_if *iface) net_mgmt_event_notify(NET_EVENT_IF_ADMIN_UP, iface); update_operational_state(iface); - if (!net_if_is_offloaded(iface)) { - /* Make sure that we update the IPv6 addresses and join the - * multicast groups. - */ - rejoin_multicast_groups(iface); - net_if_start_dad(iface); - } - out: net_if_unlock(iface); From 8137bd7e5109e8616d8271379997abc070d563b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Mon, 13 May 2024 07:33:24 +0200 Subject: [PATCH 1871/2300] [nrf fromtree] bluetooth: mesh: Adapt BLOB IO to RRAM write size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adapts flash writing for BLOB IO to RRAM. The previously used write block alignment is not needed for RRAM. Signed-off-by: Håvard Reierstad (cherry picked from commit 0f416b3576d2b259f1bf4f381d8cae430bb41d2a) Signed-off-by: Håvard Reierstad --- subsys/bluetooth/mesh/blob_io_flash.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/blob_io_flash.c b/subsys/bluetooth/mesh/blob_io_flash.c index 8090416ab12..b82a7d20f7f 100644 --- a/subsys/bluetooth/mesh/blob_io_flash.c +++ b/subsys/bluetooth/mesh/blob_io_flash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Noioic Semiconductor ASA + * Copyright (c) 2020 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ @@ -12,7 +12,7 @@ #include "net.h" #include "transport.h" -#define WRITE_BLOCK_SIZE 4 +#define WRITE_BLOCK_SIZE DT_PROP(DT_INST(0, soc_nv_flash), write_block_size) #define FLASH_IO(_io) CONTAINER_OF(_io, struct bt_mesh_blob_io_flash, io) @@ -110,6 +110,13 @@ static int wr_chunk(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_chunk *chunk) { struct bt_mesh_blob_io_flash *flash = FLASH_IO(io); + + if (IS_ENABLED(CONFIG_SOC_FLASH_NRF_RRAM)) { + return flash_area_write(flash->area, + flash->offset + block->offset + chunk->offset, + chunk->data, chunk->size); + } + uint8_t buf[ROUND_UP(BLOB_CHUNK_SIZE_MAX(BT_MESH_RX_SDU_MAX), WRITE_BLOCK_SIZE)]; off_t area_offset = flash->offset + block->offset + chunk->offset; From 26f4b1bee18ab7851676fd836a4e7348ed0470ca Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 30 Apr 2024 01:41:21 +0530 Subject: [PATCH 1872/2300] [nrf fromtree] net: ipv6: mld: Fix improper reference drop In case of successful submission, the reference shouldn't be put down, this only should done on error cases. As reference is put down on success, during the buffer unref, no action is taken due to an uint8 overflow (ref is now 255), so, the buf->frags isn't cleared properly and the next time the frags is used and when L2 inserts a second frag, the first head frag and next frag are same (due to buffer re-use) causing an infinite loop in either net_buf_frag_last or net_pkt_get_len. Signed-off-by: Chaitanya Tata (cherry picked from commit 09048e0a16b368c6e4feea4b655c807ccad26357) --- subsys/net/ip/ipv6_mld.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subsys/net/ip/ipv6_mld.c b/subsys/net/ip/ipv6_mld.c index 2bd67a08c8e..f2ae80e0f10 100644 --- a/subsys/net/ip/ipv6_mld.c +++ b/subsys/net/ip/ipv6_mld.c @@ -299,9 +299,11 @@ static int send_mld_report(struct net_if *iface) ret = mld_send(pkt); if (ret < 0) { - return ret; + goto drop; } + return 0; + drop: net_pkt_unref(pkt); From bec373297305358a7b55b186d52498fbe69b0abe Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Wed, 24 Apr 2024 13:04:04 +0200 Subject: [PATCH 1873/2300] [nrf fromtree] kconfig: openthread: Fix PSA Key Ref config for RCP architecture `OPENTHREAD_PLATFORM_KEY_REF` should not be selected for RCP architecture, as keys are handled on host's side and passed to device over Spinel, and therefore they cannot be exported on platform from reference with PSA Crypto API. Signed-off-by: Maciej Baczmanski (cherry picked from commit 479e957b79c5d522a16844df51de8c81b556a025) --- subsys/net/l2/openthread/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/openthread/Kconfig b/subsys/net/l2/openthread/Kconfig index ef71e411b4e..9673aa7702a 100644 --- a/subsys/net/l2/openthread/Kconfig +++ b/subsys/net/l2/openthread/Kconfig @@ -323,8 +323,8 @@ config OPENTHREAD_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE config OPENTHREAD_CRYPTO_PSA bool "ARM PSA crypto API" depends on MBEDTLS_PSA_CRYPTO_C || BUILD_WITH_TFM - select OPENTHREAD_PLATFORM_KEY_REF - select OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE + select OPENTHREAD_PLATFORM_KEY_REF if !OPENTHREAD_COPROCESSOR_RCP + imply OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE help Enable crypto backend library implementation based on ARM PSA crypto API instead of the default, using mbedTLS. From 84e36b7ef28eacc67dac6b39b36fb8357a0127dd Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 6 May 2024 13:13:48 +0200 Subject: [PATCH 1874/2300] Revert "[nrf fromlist] drivers: timer: grtc: Update GRTC driver" This reverts commit 8a5c578ffa948a1b0cbd8242f631c946f54d1fce. A newer revision will be re-applied from the PR. Signed-off-by: Grzegorz Swiderski --- drivers/timer/Kconfig.nrf_grtc | 13 +--- drivers/timer/nrf_grtc_timer.c | 87 ++++++++++++++++++++------ modules/hal_nordic/nrfx/CMakeLists.txt | 15 +---- 3 files changed, 70 insertions(+), 45 deletions(-) diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc index 444d13aab31..442c524fd19 100644 --- a/drivers/timer/Kconfig.nrf_grtc +++ b/drivers/timer/Kconfig.nrf_grtc @@ -40,20 +40,9 @@ config NRF_GRTC_TIMER_CLOCK_MANAGEMENT the GRTC. Usually this is only needed by the processor that is starting the SYSCOUNTER, but can be shared by multiple processors in the system. -config NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY +config NRF_GRTC_SLEEP_MINIMUM_LATENCY int default 1000 depends on NRF_GRTC_SLEEP_ALLOWED - 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 - NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY period makes no sense. - -config NRF_GRTC_TIMER_AUTO_KEEP_ALIVE - bool - default y if NRF_GRTC_START_SYSCOUNTER - help - This feature prevents the SYSCOUNTER to sleep when any core is in - active state. endif # NRF_GRTC_TIMER diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 51f00687e7e..3ed746e692a 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -29,6 +29,12 @@ #define CHAN_COUNT NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS #define EXT_CHAN_COUNT (CHAN_COUNT - 1) +/* The reset value of waketime is 1, which doesn't seem to work. + * It's being looked into, but for the time being use 4. + * Timeout must always be higher than waketime, so setting that to 5. + */ +#define WAKETIME (4) +#define TIMEOUT (WAKETIME + 1) #ifndef GRTC_SYSCOUNTERL_VALUE_Msk #define GRTC_SYSCOUNTERL_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERL_VALUE_Msk @@ -49,6 +55,9 @@ #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) +/* The maximum SYSCOUNTERVALID settling time equals 1x32k cycles + 20x1MHz cycles. */ +#define GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US 51 + #if defined(CONFIG_TEST) const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); #endif @@ -69,6 +78,36 @@ static nrfx_grtc_channel_t system_clock_channel_data = { __ASSERT_NO_MSG((NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK & (1UL << (chan))) && \ ((chan) != system_clock_channel_data.channel)) +static inline void grtc_active_set(void) +{ +#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) + nrfy_grtc_sys_counter_active_set(NRF_GRTC, true); + while (!nrfy_grtc_sys_conter_ready_check(NRF_GRTC)) { + } +#else + nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, true); + k_busy_wait(GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US); +#endif +} + +static inline void grtc_wakeup(void) +{ + if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { + grtc_active_set(); + } +} + +static inline void grtc_sleep(void) +{ + if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { +#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) + nrfy_grtc_sys_counter_active_set(NRF_GRTC, false); +#else + nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, false); +#endif + } +} + static inline uint64_t counter_sub(uint64_t a, uint64_t b) { return (a - b); @@ -77,7 +116,10 @@ static inline uint64_t counter_sub(uint64_t a, uint64_t b) static inline uint64_t counter(void) { uint64_t now; + + grtc_wakeup(); nrfx_grtc_syscounter_get(&now); + grtc_sleep(); return now; } @@ -99,8 +141,10 @@ static inline uint64_t get_comparator(uint32_t chan) static void system_timeout_set(uint64_t value) { if (value <= NRF_GRTC_SYSCOUNTER_CCADD_MASK) { + grtc_wakeup(); nrfx_grtc_syscounter_cc_relative_set(&system_clock_channel_data, value, true, NRFX_GRTC_CC_RELATIVE_SYSCOUNTER); + grtc_sleep(); } else { nrfx_grtc_syscounter_cc_absolute_set(&system_clock_channel_data, value + counter(), true); @@ -329,7 +373,6 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ uint64_t capt_time; - nrfx_err_t result; IS_CHANNEL_ALLOWED_ASSERT(chan); @@ -340,10 +383,8 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ return -EBUSY; } - result = nrfx_grtc_syscounter_cc_value_read(chan, &capt_time); - if (result != NRFX_SUCCESS) { - return -EPERM; - } + + capt_time = nrfy_grtc_sys_counter_cc_get(NRF_GRTC, chan); __ASSERT_NO_MSG(capt_time < COUNTER_SPAN); @@ -358,22 +399,16 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) nrfx_err_t err_code; static uint8_t systemoff_channel; uint64_t now = counter(); - nrfx_grtc_sleep_config_t sleep_cfg; /* Minimum time that ensures valid execution of system-off procedure. */ - uint32_t minimum_latency_us; + uint32_t minimum_latency_us = nrfy_grtc_waketime_get(NRF_GRTC) + + nrfy_grtc_timeout_get(NRF_GRTC) + + CONFIG_NRF_GRTC_SLEEP_MINIMUM_LATENCY; uint32_t chan; int ret; - nrfx_grtc_sleep_configuration_get(&sleep_cfg); - minimum_latency_us = (sleep_cfg.waketime + sleep_cfg.timeout) * USEC_PER_SEC / 32768 + - CONFIG_NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY; - sleep_cfg.auto_mode = false; - nrfx_grtc_sleep_configure(&sleep_cfg); - if (minimum_latency_us > wake_time_us) { return -EINVAL; } - k_spinlock_key_t key = k_spin_lock(&lock); err_code = nrfx_grtc_channel_alloc(&systemoff_channel); @@ -382,9 +417,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) return -ENOMEM; } (void)nrfx_grtc_syscounter_cc_int_disable(systemoff_channel); - ret = compare_set(systemoff_channel, - now + wake_time_us * sys_clock_hw_cycles_per_sec() / USEC_PER_SEC, NULL, - NULL); + ret = compare_set(systemoff_channel, now + wake_time_us, NULL, NULL); if (ret < 0) { k_spin_unlock(&lock, key); return ret; @@ -400,7 +433,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) } /* Make sure that wake_time_us was not triggered yet. */ - if (nrfx_grtc_syscounter_compare_event_check(systemoff_channel)) { + if (nrfy_grtc_sys_counter_compare_event_check(NRF_GRTC, systemoff_channel)) { k_spin_unlock(&lock, key); return -EINVAL; } @@ -411,7 +444,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) MAX_CC_LATCH_WAIT_TIME_US; k_busy_wait(wait_time); #if NRF_GRTC_HAS_CLKSEL - nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); + nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFXO); #endif k_spin_unlock(&lock, key); return 0; @@ -452,9 +485,16 @@ static int sys_clock_driver_init(void) #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. */ - nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFCLK); + nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFCLK); #endif +#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) + /* SYSCOUNTER needs to be turned off before initialization. */ + nrfy_grtc_sys_counter_set(NRF_GRTC, false); + nrfy_grtc_timeout_set(NRF_GRTC, TIMEOUT); + nrfy_grtc_waketime_set(NRF_GRTC, WAKETIME); +#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ + IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_grtc_irq_handler, 0, 0); err_code = nrfx_grtc_init(0); @@ -467,6 +507,9 @@ static int sys_clock_driver_init(void) if (err_code != NRFX_SUCCESS) { return err_code == NRFX_ERROR_NO_MEM ? -ENOMEM : -EPERM; } + if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { + nrfy_grtc_sys_counter_auto_mode_set(NRF_GRTC, false); + } #else err_code = nrfx_grtc_channel_alloc(&system_clock_channel_data.channel); if (err_code != NRFX_SUCCESS) { @@ -474,6 +517,10 @@ static int sys_clock_driver_init(void) } #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ + if (!IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { + grtc_active_set(); + } + int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set(CYC_PER_TICK); diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index adce870fc3a..463c4790743 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -127,19 +127,8 @@ if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM) zephyr_library_sources(${SRC_DIR}/nrfx_twi_twim.c) endif() -if (CONFIG_NRF_GRTC_TIMER) - if (CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) - zephyr_library_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) - endif() - if (CONFIG_NRF_GRTC_SLEEP_ALLOWED) - zephyr_compile_definitions(NRFX_GRTC_CONFIG_SLEEP_ALLOWED=1) - endif() - if (CONFIG_NRF_GRTC_TIMER_AUTO_KEEP_ALIVE) - zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOEN=1) - endif() - if (CONFIG_NRF_GRTC_START_SYSCOUNTER) - zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOSTART=1) - endif() +if (CONFIG_NRF_GRTC_TIMER AND CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) + zephyr_library_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) endif() # Inject HAL "CONFIG_NFCT_PINS_AS_GPIOS" definition if user requests to From 9a6053161dd3766a67fa5bc3dffd08ba0f168e7e Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Fri, 10 May 2024 14:16:23 +0200 Subject: [PATCH 1875/2300] Revert "[nrf fromtree] dts: nordic: add EXMIF peripheral description to nRF54H20" This reverts commit 3be1bc01f4d44bde6fe3ae0cea56458e2341525e. To be re-applied in the correct git history order. Signed-off-by: Grzegorz Swiderski --- dts/bindings/spi/nordic,nrf-exmif.yaml | 12 ------------ dts/common/nordic/nrf54h20.dtsi | 13 ------------- 2 files changed, 25 deletions(-) delete mode 100644 dts/bindings/spi/nordic,nrf-exmif.yaml diff --git a/dts/bindings/spi/nordic,nrf-exmif.yaml b/dts/bindings/spi/nordic,nrf-exmif.yaml deleted file mode 100644 index d2b8815046b..00000000000 --- a/dts/bindings/spi/nordic,nrf-exmif.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic External Memory Interface (EXMIF) - -compatible: "nordic,nrf-exmif" - -include: snps,designware-spi.yaml - -properties: - reg: - required: true diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 92f2576e733..7d5a64d0a83 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -300,19 +300,6 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; - exmif: spi@95000 { - compatible = "nordic,nrf-exmif", "snps,designware-spi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x95000 0x500 0x95500 0xb00>; - reg-names = "wrapper", "core"; - interrupts = <149 NRF_DEFAULT_IRQ_PRIORITY>; - clock-frequency = ; - fifo-depth = <32>; - max-xfer-size = <16>; - status = "disabled"; - }; - cpusec_bellboard: mailbox@99000 { reg = <0x99000 0x1000>; status = "disabled"; From fc4ac4c8ca5141ce5d9ab1774473ddaeb3aa46af Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 16 Apr 2024 10:49:38 +0200 Subject: [PATCH 1876/2300] [nrf fromtree] modules: hal_nordic: Fix NRF_GRTC_HAS_EXTENDED This definition is used in nrfx header files, so it shouldn't be added using `zephyr_library_compile_definitions()`. This would cause the GRTC driver to fail the build when CONFIG_NRF_GRTC_START_SYSCOUNTER=y. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 35e418f4690643ed6dddbfe189d36a52dcc04d76) --- modules/hal_nordic/nrfx/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 463c4790743..540ec4e0b30 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -128,7 +128,7 @@ if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM) endif() if (CONFIG_NRF_GRTC_TIMER AND CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) - zephyr_library_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) + zephyr_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) endif() # Inject HAL "CONFIG_NFCT_PINS_AS_GPIOS" definition if user requests to From eb865af70063620c73a9a364e01c51ed113bed79 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 9 Apr 2024 12:57:27 +0200 Subject: [PATCH 1877/2300] [nrf fromtree] dts: nordic: nrf54h20: Add SysCtrl VEVIF node Add a VEVIF node to be used for communicating with SysCtrl (cpusys). This is the only part of the SysCtrl VPR exposed to local domains. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 163cacbe4ba4c04c3d1b8e867760223e0e2b0869) --- dts/arm/nordic/nrf54h20_cpuapp.dtsi | 1 + dts/arm/nordic/nrf54h20_cpurad.dtsi | 1 + dts/common/nordic/nrf54h20.dtsi | 9 +++++++++ dts/riscv/nordic/nrf54h20_cpuppr.dtsi | 1 + 4 files changed, 12 insertions(+) diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi index d82c69262c0..9d011019f4a 100644 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -10,6 +10,7 @@ cpu: &cpuapp {}; systick: &cpuapp_systick {}; nvic: &cpuapp_nvic {}; cpuppr_vevif: &cpuppr_vevif_remote {}; +cpusys_vevif: &cpusys_vevif_remote {}; /delete-node/ &cpuppr; /delete-node/ &cpurad; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 4bdaf76e348..2a62845dc89 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -10,6 +10,7 @@ cpu: &cpurad {}; systick: &cpurad_systick {}; nvic: &cpurad_nvic {}; cpuppr_vevif: &cpuppr_vevif_remote {}; +cpusys_vevif: &cpusys_vevif_remote {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 7d5a64d0a83..671292d1010 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -318,6 +318,15 @@ #mbox-cells = <1>; }; + cpusys_vevif_remote: mailbox@8c8000 { + compatible = "nordic,nrf-vevif-remote"; + reg = <0x8c8000 0x1000>; + status = "disabled"; + #mbox-cells = <1>; + nordic,tasks = <32>; + nordic,tasks-mask = <0xfffff0ff>; + }; + ipct120: ipct@8d1000 { compatible = "nordic,nrf-ipct-global"; reg = <0x8d1000 0x1000>; diff --git a/dts/riscv/nordic/nrf54h20_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_cpuppr.dtsi index d74147bc04b..6f90cbf3e6a 100644 --- a/dts/riscv/nordic/nrf54h20_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_cpuppr.dtsi @@ -9,6 +9,7 @@ cpu: &cpuppr {}; clic: &cpuppr_clic {}; cpuppr_vevif: &cpuppr_vevif_local {}; +cpusys_vevif: &cpusys_vevif_remote {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; From f52294a0bf61104d603c1d75f96c49161843f273 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 9 Apr 2024 12:57:27 +0200 Subject: [PATCH 1878/2300] [nrf fromtree] boards: nordic: nrf54h20dk: Add IPC configuration for SysCtrl Add the default `zephyr,ipc-icmsg` nodes for communication with Application and Radiocore. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 711abcd444291063290708b9afaac8f15ce1191b) --- .../nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 14 ++++++++++++++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 11 +++++++++-- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts | 2 ++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 11 +++++++++-- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index 539e80d149a..944dd7fb6ab 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -27,11 +27,25 @@ <&cpurad_bellboard 12>; }; + cpuapp_cpusys_ipc: ipc-2-12 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpuapp_bellboard 6>, + <&cpusys_vevif 12>; + }; + cpuapp_cpuppr_ipc: ipc-2-13 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; mboxes = <&cpuapp_bellboard 13>, <&cpuppr_vevif 12>; }; + + cpurad_cpusys_ipc: ipc-3-12 { + compatible = "zephyr,ipc-icmsg"; + status = "disabled"; + mboxes = <&cpurad_bellboard 6>, + <&cpusys_vevif 18>; + }; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 7f2f918b0b9..24d161420d6 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -11,6 +11,7 @@ #include "nrf54h20dk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20dk_nrf54h20-pinctrl.dtsi" +/delete-node/ &cpurad_cpusys_ipc; /delete-node/ &cpusec_cpurad_ipc; / { @@ -120,8 +121,8 @@ status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; - /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ - nordic,interrupt-mapping = <0x00042001 0>; + /* irq0: 0: cpuapp-cpusec, 6: cpuapp-cpusys, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ + nordic,interrupt-mapping = <0x00042041 0>; }; &cpurad_bellboard { @@ -143,6 +144,12 @@ ipc0: &cpuapp_cpurad_ipc { rx-blocks = <32>; }; +&cpuapp_cpusys_ipc { + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpusys_ipc_shm>; + rx-region = <&cpusys_cpuapp_ipc_shm>; +}; + &cpuapp_cpuppr_ipc { mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpuppr_ipc_shm>; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts index 4cfad97323e..80b690839d7 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts @@ -12,6 +12,8 @@ #include "nrf54h20dk_nrf54h20-pinctrl.dtsi" /delete-node/ &cpuapp_cpurad_ipc; +/delete-node/ &cpuapp_cpusys_ipc; +/delete-node/ &cpurad_cpusys_ipc; /delete-node/ &cpusec_cpuapp_ipc; /delete-node/ &cpusec_cpurad_ipc; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index d72aa791091..cb69b5ce3a6 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -12,6 +12,7 @@ #include "nrf54h20dk_nrf54h20-pinctrl.dtsi" /delete-node/ &cpuapp_cpuppr_ipc; +/delete-node/ &cpuapp_cpusys_ipc; /delete-node/ &cpusec_cpuapp_ipc; / { @@ -46,8 +47,8 @@ status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; - /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ - nordic,interrupt-mapping = <0x00001001 0>; + /* irq0: 0: cpurad-cpusec, 6: cpurad-cpusys, 12: cpurad-cpuapp */ + nordic,interrupt-mapping = <0x00001041 0>; }; &cpuapp_bellboard { @@ -69,6 +70,12 @@ ipc0: &cpuapp_cpurad_ipc { rx-blocks = <32>; }; +&cpurad_cpusys_ipc { + mbox-names = "rx", "tx"; + tx-region = <&cpurad_cpusys_ipc_shm>; + rx-region = <&cpusys_cpurad_ipc_shm>; +}; + &cpurad_dma_region { status = "okay"; }; From 48041ad564d1ceccc9fd7dd12980c48dfc207ba5 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 18 Apr 2024 16:14:46 +0200 Subject: [PATCH 1879/2300] [nrf fromtree] drivers/timer grtc: Fix for ISR prototype Interrupt handlers are expected to have a pototype void (const void*) but nrfx_grtc_irq_handler has just a void(void) (with no input parameter). Fix it by using a trampoline. Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 8e20b80575b888468136dc2efbb230f66930b941) --- drivers/timer/nrf_grtc_timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 3ed746e692a..7f6ae02bceb 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -495,7 +495,8 @@ static int sys_clock_driver_init(void) nrfy_grtc_waketime_set(NRF_GRTC, WAKETIME); #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_grtc_irq_handler, 0, 0); + IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr, + nrfx_grtc_irq_handler, 0); err_code = nrfx_grtc_init(0); if (err_code != NRFX_SUCCESS) { From a0e4011234b9fb049c6d0e10d67cceb8b7e91024 Mon Sep 17 00:00:00 2001 From: Lukasz Stepnicki Date: Thu, 18 Apr 2024 13:16:32 +0200 Subject: [PATCH 1880/2300] [nrf fromtree] soc: nordic: vpr: fix soc isr sw stacking. Fixed order of mepc and _mcause in esf for 32bit stacking. Added missing stack pointer alignement bit support.' Signed-off-by: Lukasz Stepnicki (cherry picked from commit 37e3449a393710df6339bd97cfc73679c63546ca) --- soc/nordic/common/vpr/soc_context.h | 14 ++++++++++-- soc/nordic/common/vpr/soc_isr_stacking.h | 29 +++++++++++++++++++++--- soc/nordic/common/vpr/soc_offsets.h | 4 +++- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/soc/nordic/common/vpr/soc_context.h b/soc/nordic/common/vpr/soc_context.h index 8cd0d1e5094..9735057e792 100644 --- a/soc/nordic/common/vpr/soc_context.h +++ b/soc/nordic/common/vpr/soc_context.h @@ -6,7 +6,17 @@ #ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ #define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ -#define SOC_ESF_MEMBERS unsigned long minttresh -#define SOC_ESF_INIT 0 +#define SOC_ESF_MEMBERS \ + unsigned long minttresh; \ + unsigned long sp_align; \ + unsigned long padding0; \ + unsigned long padding1; \ + unsigned long padding2 + +#define SOC_ESF_INIT \ + 0, \ + 0, \ + 0, \ + 0 #endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ */ diff --git a/soc/nordic/common/vpr/soc_isr_stacking.h b/soc/nordic/common/vpr/soc_isr_stacking.h index d5b139111d0..ff34f9d4e09 100644 --- a/soc/nordic/common/vpr/soc_isr_stacking.h +++ b/soc/nordic/common/vpr/soc_isr_stacking.h @@ -56,8 +56,8 @@ unsigned long a2; \ unsigned long a1; \ unsigned long a0; \ - unsigned long mepc; \ unsigned long _mcause; \ + unsigned long mepc; \ } __aligned(16); #endif /* DT_PROP(VPR_CPU, nordic_bus_width) == 64 */ @@ -79,7 +79,28 @@ * Size of the SW managed part of the ESF in case of interrupt * sizeof(__padding) + ... + sizeof(soc_context) */ -#define ESF_SW_IRQ_SIZEOF (0x10) +#define ESF_SW_IRQ_SIZEOF (0x20) + +/* + * VPR needs aligned(8) SP when doing HW stacking, if this condition is not fulfilled it will move + * SP by additional 4 bytes when HW stacking is done. This will be indicated by LSB bit in stacked + * MEPC. This bit needs to be saved and then restored because zephyr is managing MEPC and doesn't + * know anything about this additional offset. + */ +#define MEPC_SP_ALIGN_BIT_MASK (0x1UL) + +#define STORE_SP_ALIGN_BIT_FROM_MEPC \ + addi t1, sp, __z_arch_esf_t_soc_context_OFFSET; \ + lr t0, __z_arch_esf_t_mepc_OFFSET(sp); \ + andi t0, t0, MEPC_SP_ALIGN_BIT_MASK; \ + sr t0, __soc_esf_t_sp_align_OFFSET(t1) + +#define RESTORE_SP_ALIGN_BIT_TO_MEPC \ + addi t1, sp, __z_arch_esf_t_soc_context_OFFSET; \ + lr t0, __soc_esf_t_sp_align_OFFSET(t1); \ + lr t1, __z_arch_esf_t_mepc_OFFSET(sp); \ + or t2, t1, t0; \ + sr t2, __z_arch_esf_t_mepc_OFFSET(sp) #define SOC_ISR_SW_STACKING \ csrw mscratch, t0; \ @@ -97,9 +118,11 @@ stacking_is_interrupt: \ addi sp, sp, -ESF_SW_IRQ_SIZEOF; \ \ -stacking_keep_going: +stacking_keep_going: \ + STORE_SP_ALIGN_BIT_FROM_MEPC #define SOC_ISR_SW_UNSTACKING \ + RESTORE_SP_ALIGN_BIT_TO_MEPC; \ csrr t0, mcause; \ srli t0, t0, RISCV_MCAUSE_IRQ_POS; \ bnez t0, unstacking_is_interrupt; \ diff --git a/soc/nordic/common/vpr/soc_offsets.h b/soc/nordic/common/vpr/soc_offsets.h index 92d91044e1a..f03f784e864 100644 --- a/soc/nordic/common/vpr/soc_offsets.h +++ b/soc/nordic/common/vpr/soc_offsets.h @@ -6,6 +6,8 @@ #ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ #define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ -#define GEN_SOC_OFFSET_SYMS() GEN_OFFSET_SYM(soc_esf_t, minttresh) +#define GEN_SOC_OFFSET_SYMS() \ + GEN_OFFSET_SYM(soc_esf_t, minttresh); \ + GEN_OFFSET_SYM(soc_esf_t, sp_align) #endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ */ From 66d01b5efee856ada78e99736f139fc21aaa9f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Amundsen?= Date: Fri, 19 Apr 2024 09:58:41 +0200 Subject: [PATCH 1881/2300] [nrf fromtree] dts: nordic: add USBHS node for nrf54h20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing USBHS node to list of global peripherals. Signed-off-by: Håkon Amundsen (cherry picked from commit 5895be5438860f2ca2dd26c02664462324d9c50b) --- dts/common/nordic/nrf54h20.dtsi | 8 ++++++++ soc/nordic/validate_base_addresses.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 671292d1010..0131763ef1e 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -300,6 +300,14 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; + usbhs: usbhs@86000 { + compatible = "snps,dwc2"; + reg = <0x86000 0x1000>, <0x2f700000 0x40000>; + reg-names = "wrapper", "core"; + interrupts = <134 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + cpusec_bellboard: mailbox@99000 { reg = <0x99000 0x1000>; status = "disabled"; diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 1fa4c87c97b..e83c0ea8dcb 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -308,6 +308,8 @@ CHECK_DT_REG(uart136, NRF_UARTE136); CHECK_DT_REG(uart137, NRF_UARTE137); CHECK_DT_REG(uicr, NRF_UICR); CHECK_DT_REG(usbd, NRF_USBD); +CHECK_DT_REG(usbhs, NRF_USBHS); +CHECK_DT_REG(usbhs_core, NRF_USBHSCORE0); CHECK_DT_REG(usbreg, NRF_USBREGULATOR); CHECK_DT_REG(vmc, NRF_VMC); CHECK_DT_REG(wdt, NRF_WDT0); /* this should be the same node as wdt0 */ From 8f5467b5c414c88e65eb3de1ea686337c4ed08a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Fri, 26 Apr 2024 11:15:33 +0200 Subject: [PATCH 1882/2300] [nrf fromtree] dts: nordic: add EXMIF peripheral description to nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added EXMIF peripheral DTS description and bindings. The peripheral operates as an SPI device. Signed-off-by: Rafał Kuźnia (cherry picked from commit 4d30ccb8788eae9444deb78de1e2a3a6dc187927) --- dts/bindings/spi/nordic,nrf-exmif.yaml | 12 ++++++++++++ dts/common/nordic/nrf54h20.dtsi | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 dts/bindings/spi/nordic,nrf-exmif.yaml diff --git a/dts/bindings/spi/nordic,nrf-exmif.yaml b/dts/bindings/spi/nordic,nrf-exmif.yaml new file mode 100644 index 00000000000..d2b8815046b --- /dev/null +++ b/dts/bindings/spi/nordic,nrf-exmif.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic External Memory Interface (EXMIF) + +compatible: "nordic,nrf-exmif" + +include: snps,designware-spi.yaml + +properties: + reg: + required: true diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 0131763ef1e..75d112b85e2 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -308,6 +308,19 @@ status = "disabled"; }; + exmif: spi@95000 { + compatible = "nordic,nrf-exmif", "snps,designware-spi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x95000 0x500 0x95500 0xb00>; + reg-names = "wrapper", "core"; + interrupts = <149 NRF_DEFAULT_IRQ_PRIORITY>; + clock-frequency = ; + fifo-depth = <32>; + max-xfer-size = <16>; + status = "disabled"; + }; + cpusec_bellboard: mailbox@99000 { reg = <0x99000 0x1000>; status = "disabled"; From 39db5e1c6193488d9efca5f2275829b7935f187b Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 16 Apr 2024 10:46:32 +0200 Subject: [PATCH 1883/2300] [nrf fromlist] soc: nordic: nrf54h20: Make HSFLL trims optional Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71536 If no HSFLL needs trimming, then `trim_hsfll()` should be compiled out. This makes it easier to reuse the rest of `soc.c` out of tree. Furthermore, some HSFLL instances can be trimmed before booting Zephyr, so the FICR client properties in the DT binding should not be required. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 0803dc254b193dd10d94a99ca1289318d483087f) --- dts/bindings/clock/nordic,nrf-hsfll.yaml | 6 ------ soc/nordic/nrf54h/soc.c | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dts/bindings/clock/nordic,nrf-hsfll.yaml b/dts/bindings/clock/nordic,nrf-hsfll.yaml index 3614d80870f..f1077dbc4f0 100644 --- a/dts/bindings/clock/nordic,nrf-hsfll.yaml +++ b/dts/bindings/clock/nordic,nrf-hsfll.yaml @@ -57,9 +57,3 @@ properties: - 368000000 - 384000000 - 400000000 - - nordic,ficrs: - required: true - - nordic,ficr-names: - required: true diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index df72cdb977b..1ba620473a0 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -55,6 +55,8 @@ static void power_domain_init(void) static int trim_hsfll(void) { +#if defined(HSFLL_NODE) + NRF_HSFLL_Type *hsfll = (NRF_HSFLL_Type *)DT_REG_ADDR(HSFLL_NODE); nrf_hsfll_trim_t trim = { .vsup = sys_read32(FICR_ADDR_GET(HSFLL_NODE, vsup)), @@ -77,6 +79,8 @@ static int trim_hsfll(void) LOG_DBG("NRF_HSFLL->TRIM.COARSE = %d", hsfll->TRIM.COARSE); LOG_DBG("NRF_HSFLL->TRIM.FINE = %d", hsfll->TRIM.FINE); +#endif /* defined(HSFLL_NODE) */ + return 0; } From fc66ed99e00a18e04179034ddae99e50b510db33 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 16 Apr 2024 10:46:32 +0200 Subject: [PATCH 1884/2300] [nrf fromlist] soc: nordic: nrf54h20: Use KERNEL_INIT_PRIORITY_DEFAULT Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71536 Make the SoC initialization priority configurable. Signed-off-by: Grzegorz Swiderski (cherry picked from commit d5442da200a4b1e9ac3a11b4ea16c6a69666729c) --- soc/nordic/nrf54h/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 1ba620473a0..ce5af2e25af 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -111,4 +111,4 @@ void arch_busy_wait(uint32_t time_us) nrfx_coredep_delay_us(time_us); } -SYS_INIT(nordicsemi_nrf54h_init, PRE_KERNEL_1, 0); +SYS_INIT(nordicsemi_nrf54h_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); From 36d7f0a24d16c55cefede716dc9a06e498eb75eb Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 16 Apr 2024 10:46:32 +0200 Subject: [PATCH 1885/2300] [nrf fromlist] soc: nordic: Extend address validation for nRF54H20 Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71536 Add `CHECK_DT_REG()` entries for a few additional peripheral types: BELLBOARD, CCM, GRTC, HSFLL, UICR, and VPR. For peripheral instances outside of the Global Domain, such as DPPIC020, use domain-specific defines like NRF_RADIOCORE_DPPIC020 when validating. These are always defined by the MDK, while NRF_DPPIC020 isn't guaranteed to exist in those cases. Revise existing macro checks accordingly. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 1750413c7f22a76d504c35a890d31eab469c9850) --- soc/nordic/validate_base_addresses.c | 36 +++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index e83c0ea8dcb..5c9f31c9c1f 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -37,6 +37,14 @@ #define NRF_QDEC0 NRF_QDEC #endif +#if !defined(NRF_RADIO) && defined(NRF_RADIOCORE_RADIO) +#define NRF_RADIO NRF_RADIOCORE_RADIO +#endif + +#if !defined(NRF_RTC) && defined(NRF_RADIOCORE_RTC) +#define NRF_RTC NRF_RADIOCORE_RTC +#endif + #if !defined(NRF_SWI0) && defined(NRF_SWI_BASE) #define NRF_SWI0 ((0 * 0x1000) + NRF_SWI_BASE) #endif @@ -126,8 +134,13 @@ CHECK_DT_REG(acl, NRF_ACL); CHECK_DT_REG(adc, NODE_ADDRESS(adc, nordic_nrf_adc, NRF_ADC, NRF_SAADC)); +CHECK_DT_REG(cpusec_bellboard, NRF_SECDOMBELLBOARD); +CHECK_DT_REG(cpuapp_bellboard, NRF_APPLICATION_BELLBOARD); +CHECK_DT_REG(cpurad_bellboard, NRF_RADIOCORE_BELLBOARD); CHECK_DT_REG(bprot, NRF_BPROT); CHECK_DT_REG(ccm, NRF_CCM); +CHECK_DT_REG(ccm030, NRF_RADIOCORE_CCM030); +CHECK_DT_REG(ccm031, NRF_RADIOCORE_CCM031); CHECK_DT_REG(clock, NRF_CLOCK); CHECK_DT_REG(comp, NODE_ADDRESS(comp, nordic_nrf_comp, NRF_COMP, NRF_LPCOMP)); CHECK_DT_REG(cryptocell, NRF_CRYPTOCELL); @@ -138,7 +151,7 @@ CHECK_DT_REG(dppic00, NRF_DPPIC00); CHECK_DT_REG(dppic10, NRF_DPPIC10); CHECK_DT_REG(dppic20, NRF_DPPIC20); CHECK_DT_REG(dppic30, NRF_DPPIC30); -CHECK_DT_REG(dppic020, NRF_DPPIC020); +CHECK_DT_REG(dppic020, NRF_RADIOCORE_DPPIC020); CHECK_DT_REG(dppic120, NRF_DPPIC120); CHECK_DT_REG(dppic130, NRF_DPPIC130); CHECK_DT_REG(dppic131, NRF_DPPIC131); @@ -149,7 +162,8 @@ CHECK_DT_REG(dppic135, NRF_DPPIC135); CHECK_DT_REG(dppic136, NRF_DPPIC136); CHECK_DT_REG(ecb, NRF_ECB); CHECK_DT_REG(ecb020, NRF_ECB020); -CHECK_DT_REG(ecb030, NRF_ECB030); +CHECK_DT_REG(ecb030, NRF_RADIOCORE_ECB030); +CHECK_DT_REG(ecb031, NRF_RADIOCORE_ECB031); CHECK_DT_REG(egu0, NRF_EGU0); CHECK_DT_REG(egu1, NRF_EGU1); CHECK_DT_REG(egu2, NRF_EGU2); @@ -158,7 +172,7 @@ CHECK_DT_REG(egu4, NRF_EGU4); CHECK_DT_REG(egu5, NRF_EGU5); CHECK_DT_REG(egu10, NRF_EGU10); CHECK_DT_REG(egu20, NRF_EGU20); -CHECK_DT_REG(egu020, NRF_EGU020); +CHECK_DT_REG(egu020, NRF_RADIOCORE_EGU020); CHECK_DT_REG(ficr, NRF_FICR); CHECK_DT_REG(flash_controller, NRF_NVMC); CHECK_DT_REG(gpio0, NRF_P0); @@ -174,6 +188,9 @@ CHECK_DT_REG(gpiote20, NRF_GPIOTE20); CHECK_DT_REG(gpiote30, NRF_GPIOTE30); CHECK_DT_REG(gpiote130, NRF_GPIOTE130); CHECK_DT_REG(gpiote131, NRF_GPIOTE131); +CHECK_DT_REG(grtc, NRF_GRTC); +CHECK_DT_REG(cpuapp_hsfll, NRF_APPLICATION_HSFLL); +CHECK_DT_REG(cpurad_hsfll, NRF_RADIOCORE_HSFLL); CHECK_I2C_REG(i2c0, 0); CHECK_I2C_REG(i2c1, 1); CHECK_DT_REG(i2c2, NRF_TWIM2); @@ -193,8 +210,8 @@ CHECK_DT_REG(i2c137, NRF_TWIM137); CHECK_DT_REG(i2s0, NRF_I2S0); CHECK_DT_REG(i2s20, NRF_I2S20); CHECK_DT_REG(ipc, NRF_IPC); -CHECK_DT_REG(cpuapp_ipct, NRF_IPCT); -CHECK_DT_REG(cpurad_ipct, NRF_IPCT); +CHECK_DT_REG(cpuapp_ipct, NRF_APPLICATION_IPCT); +CHECK_DT_REG(cpurad_ipct, NRF_RADIOCORE_IPCT); CHECK_DT_REG(ipct120, NRF_IPCT120); CHECK_DT_REG(ipct130, NRF_IPCT130); CHECK_DT_REG(kmu, NRF_KMU); @@ -275,9 +292,9 @@ CHECK_DT_REG(timer21, NRF_TIMER21); CHECK_DT_REG(timer22, NRF_TIMER22); CHECK_DT_REG(timer23, NRF_TIMER23); CHECK_DT_REG(timer24, NRF_TIMER24); -CHECK_DT_REG(timer020, NRF_TIMER020); -CHECK_DT_REG(timer021, NRF_TIMER021); -CHECK_DT_REG(timer022, NRF_TIMER022); +CHECK_DT_REG(timer020, NRF_RADIOCORE_TIMER020); +CHECK_DT_REG(timer021, NRF_RADIOCORE_TIMER021); +CHECK_DT_REG(timer022, NRF_RADIOCORE_TIMER022); CHECK_DT_REG(timer120, NRF_TIMER120); CHECK_DT_REG(timer121, NRF_TIMER121); CHECK_DT_REG(timer130, NRF_TIMER130); @@ -307,11 +324,14 @@ CHECK_DT_REG(uart135, NRF_UARTE135); CHECK_DT_REG(uart136, NRF_UARTE136); CHECK_DT_REG(uart137, NRF_UARTE137); CHECK_DT_REG(uicr, NRF_UICR); +CHECK_DT_REG(cpuapp_uicr, NRF_APPLICATION_UICR); +CHECK_DT_REG(cpurad_uicr, NRF_RADIOCORE_UICR); CHECK_DT_REG(usbd, NRF_USBD); CHECK_DT_REG(usbhs, NRF_USBHS); CHECK_DT_REG(usbhs_core, NRF_USBHSCORE0); CHECK_DT_REG(usbreg, NRF_USBREGULATOR); CHECK_DT_REG(vmc, NRF_VMC); +CHECK_DT_REG(cpuppr_vpr, NRF_VPR130); CHECK_DT_REG(wdt, NRF_WDT0); /* this should be the same node as wdt0 */ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); From a72f221020e3f138aa0645476d1358a0797f1d36 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 17 Apr 2024 13:51:37 +0200 Subject: [PATCH 1886/2300] [nrf fromlist] dts: nordic: Add RESETINFO Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71609 Add devicetree nodes for the Reset Information registers on nRF54H20, along with a new binding. Signed-off-by: Grzegorz Swiderski (cherry picked from commit 8fe636b4d583b7f3d119d7e80094e3b5bfa52099) --- dts/bindings/arm/nordic,nrf-resetinfo.yaml | 12 ++++++++++++ dts/common/nordic/nrf54h20.dtsi | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 dts/bindings/arm/nordic,nrf-resetinfo.yaml diff --git a/dts/bindings/arm/nordic,nrf-resetinfo.yaml b/dts/bindings/arm/nordic,nrf-resetinfo.yaml new file mode 100644 index 00000000000..c8585e5897e --- /dev/null +++ b/dts/bindings/arm/nordic,nrf-resetinfo.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic RESETINFO (Reset Information) + +compatible: "nordic,nrf-resetinfo" + +include: base.yaml + +properties: + reg: + required: true diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 75d112b85e2..faaa9e8e1aa 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -168,6 +168,11 @@ interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, <65 NRF_DEFAULT_IRQ_PRIORITY>; }; + + cpuapp_resetinfo: resetinfo@1e000 { + compatible = "nordic,nrf-resetinfo"; + reg = <0x1e000 0x1000>; + }; }; cpurad_peripherals: peripheral@53000000 { @@ -188,6 +193,11 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; + cpurad_resetinfo: resetinfo@1e000 { + compatible = "nordic,nrf-resetinfo"; + reg = <0x1e000 0x1000>; + }; + dppic020: dppic@22000 { compatible = "nordic,nrf-dppic-local"; reg = <0x22000 0x1000>; From f7438b58c1edb10f96e7821c418a52034a0284b2 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 19 Dec 2023 15:25:08 +0100 Subject: [PATCH 1887/2300] [nrf fromlist] drivers: timer: grtc: Update GRTC driver Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71688 This commit aligns the GRTC driver to changes introduced in hal_nordic. Some of the features regarding GRTC sleep/wakeup functionality has been modified and moved out to the nrfx driver's code. Signed-off-by: Adam Kondraciuk (cherry picked from commit 88a50aa5ee0a01fe029676b916329dc75ca5deea) --- drivers/timer/Kconfig.nrf_grtc | 13 ++- drivers/timer/nrf_grtc_timer.c | 87 +++++-------------- include/zephyr/drivers/timer/nrf_grtc_timer.h | 1 + modules/hal_nordic/nrfx/CMakeLists.txt | 15 +++- 4 files changed, 46 insertions(+), 70 deletions(-) diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc index 442c524fd19..444d13aab31 100644 --- a/drivers/timer/Kconfig.nrf_grtc +++ b/drivers/timer/Kconfig.nrf_grtc @@ -40,9 +40,20 @@ config NRF_GRTC_TIMER_CLOCK_MANAGEMENT the GRTC. Usually this is only needed by the processor that is starting the SYSCOUNTER, but can be shared by multiple processors in the system. -config NRF_GRTC_SLEEP_MINIMUM_LATENCY +config NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY int default 1000 depends on NRF_GRTC_SLEEP_ALLOWED + 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 + NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY period makes no sense. + +config NRF_GRTC_TIMER_AUTO_KEEP_ALIVE + bool + default y if NRF_GRTC_START_SYSCOUNTER + help + This feature prevents the SYSCOUNTER to sleep when any core is in + active state. endif # NRF_GRTC_TIMER diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 7f6ae02bceb..7a31cde7bfa 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -29,12 +29,6 @@ #define CHAN_COUNT NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS #define EXT_CHAN_COUNT (CHAN_COUNT - 1) -/* The reset value of waketime is 1, which doesn't seem to work. - * It's being looked into, but for the time being use 4. - * Timeout must always be higher than waketime, so setting that to 5. - */ -#define WAKETIME (4) -#define TIMEOUT (WAKETIME + 1) #ifndef GRTC_SYSCOUNTERL_VALUE_Msk #define GRTC_SYSCOUNTERL_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERL_VALUE_Msk @@ -55,9 +49,6 @@ #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) -/* The maximum SYSCOUNTERVALID settling time equals 1x32k cycles + 20x1MHz cycles. */ -#define GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US 51 - #if defined(CONFIG_TEST) const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); #endif @@ -78,36 +69,6 @@ static nrfx_grtc_channel_t system_clock_channel_data = { __ASSERT_NO_MSG((NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK & (1UL << (chan))) && \ ((chan) != system_clock_channel_data.channel)) -static inline void grtc_active_set(void) -{ -#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) - nrfy_grtc_sys_counter_active_set(NRF_GRTC, true); - while (!nrfy_grtc_sys_conter_ready_check(NRF_GRTC)) { - } -#else - nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, true); - k_busy_wait(GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US); -#endif -} - -static inline void grtc_wakeup(void) -{ - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - grtc_active_set(); - } -} - -static inline void grtc_sleep(void) -{ - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { -#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) - nrfy_grtc_sys_counter_active_set(NRF_GRTC, false); -#else - nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, false); -#endif - } -} - static inline uint64_t counter_sub(uint64_t a, uint64_t b) { return (a - b); @@ -116,10 +77,7 @@ static inline uint64_t counter_sub(uint64_t a, uint64_t b) static inline uint64_t counter(void) { uint64_t now; - - grtc_wakeup(); nrfx_grtc_syscounter_get(&now); - grtc_sleep(); return now; } @@ -141,10 +99,8 @@ static inline uint64_t get_comparator(uint32_t chan) static void system_timeout_set(uint64_t value) { if (value <= NRF_GRTC_SYSCOUNTER_CCADD_MASK) { - grtc_wakeup(); nrfx_grtc_syscounter_cc_relative_set(&system_clock_channel_data, value, true, NRFX_GRTC_CC_RELATIVE_SYSCOUNTER); - grtc_sleep(); } else { nrfx_grtc_syscounter_cc_absolute_set(&system_clock_channel_data, value + counter(), true); @@ -373,6 +329,7 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ uint64_t capt_time; + nrfx_err_t result; IS_CHANNEL_ALLOWED_ASSERT(chan); @@ -383,8 +340,10 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ return -EBUSY; } - - capt_time = nrfy_grtc_sys_counter_cc_get(NRF_GRTC, chan); + result = nrfx_grtc_syscounter_cc_value_read(chan, &capt_time); + if (result != NRFX_SUCCESS) { + return -EPERM; + } __ASSERT_NO_MSG(capt_time < COUNTER_SPAN); @@ -399,16 +358,22 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) nrfx_err_t err_code; static uint8_t systemoff_channel; uint64_t now = counter(); + nrfx_grtc_sleep_config_t sleep_cfg; /* Minimum time that ensures valid execution of system-off procedure. */ - uint32_t minimum_latency_us = nrfy_grtc_waketime_get(NRF_GRTC) + - nrfy_grtc_timeout_get(NRF_GRTC) + - CONFIG_NRF_GRTC_SLEEP_MINIMUM_LATENCY; + uint32_t minimum_latency_us; uint32_t chan; int ret; + nrfx_grtc_sleep_configuration_get(&sleep_cfg); + minimum_latency_us = (sleep_cfg.waketime + sleep_cfg.timeout) * USEC_PER_SEC / 32768 + + CONFIG_NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY; + sleep_cfg.auto_mode = false; + nrfx_grtc_sleep_configure(&sleep_cfg); + if (minimum_latency_us > wake_time_us) { return -EINVAL; } + k_spinlock_key_t key = k_spin_lock(&lock); err_code = nrfx_grtc_channel_alloc(&systemoff_channel); @@ -417,7 +382,9 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) return -ENOMEM; } (void)nrfx_grtc_syscounter_cc_int_disable(systemoff_channel); - ret = compare_set(systemoff_channel, now + wake_time_us, NULL, NULL); + ret = compare_set(systemoff_channel, + now + wake_time_us * sys_clock_hw_cycles_per_sec() / USEC_PER_SEC, NULL, + NULL); if (ret < 0) { k_spin_unlock(&lock, key); return ret; @@ -433,7 +400,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) } /* Make sure that wake_time_us was not triggered yet. */ - if (nrfy_grtc_sys_counter_compare_event_check(NRF_GRTC, systemoff_channel)) { + if (nrfx_grtc_syscounter_compare_event_check(systemoff_channel)) { k_spin_unlock(&lock, key); return -EINVAL; } @@ -444,7 +411,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) MAX_CC_LATCH_WAIT_TIME_US; k_busy_wait(wait_time); #if NRF_GRTC_HAS_CLKSEL - nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFXO); + nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); #endif k_spin_unlock(&lock, key); return 0; @@ -485,16 +452,9 @@ static int sys_clock_driver_init(void) #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. */ - nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFCLK); + nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFCLK); #endif -#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) - /* SYSCOUNTER needs to be turned off before initialization. */ - nrfy_grtc_sys_counter_set(NRF_GRTC, false); - nrfy_grtc_timeout_set(NRF_GRTC, TIMEOUT); - nrfy_grtc_waketime_set(NRF_GRTC, WAKETIME); -#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr, nrfx_grtc_irq_handler, 0); @@ -508,9 +468,6 @@ static int sys_clock_driver_init(void) if (err_code != NRFX_SUCCESS) { return err_code == NRFX_ERROR_NO_MEM ? -ENOMEM : -EPERM; } - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - nrfy_grtc_sys_counter_auto_mode_set(NRF_GRTC, false); - } #else err_code = nrfx_grtc_channel_alloc(&system_clock_channel_data.channel); if (err_code != NRFX_SUCCESS) { @@ -518,10 +475,6 @@ static int sys_clock_driver_init(void) } #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - if (!IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - grtc_active_set(); - } - int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set(CYC_PER_TICK); diff --git a/include/zephyr/drivers/timer/nrf_grtc_timer.h b/include/zephyr/drivers/timer/nrf_grtc_timer.h index 76fa7b70346..1814202a097 100644 --- a/include/zephyr/drivers/timer/nrf_grtc_timer.h +++ b/include/zephyr/drivers/timer/nrf_grtc_timer.h @@ -169,6 +169,7 @@ int z_nrf_grtc_timer_capture_prepare(int32_t chan); * * @retval 0 if the timestamp was successfully caught and read. * @retval -EBUSY if capturing has not been triggered. + * @retval -EPERM if either channel is unavailable or SYSCOUNTER is not running. */ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time); diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 540ec4e0b30..557f3df0cab 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -127,8 +127,19 @@ if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM) zephyr_library_sources(${SRC_DIR}/nrfx_twi_twim.c) endif() -if (CONFIG_NRF_GRTC_TIMER AND CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) - zephyr_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) +if (CONFIG_NRF_GRTC_TIMER) + if (CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) + zephyr_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) + endif() + if (CONFIG_NRF_GRTC_SLEEP_ALLOWED) + zephyr_compile_definitions(NRFX_GRTC_CONFIG_SLEEP_ALLOWED=1) + endif() + if (CONFIG_NRF_GRTC_TIMER_AUTO_KEEP_ALIVE) + zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOEN=1) + endif() + if (CONFIG_NRF_GRTC_START_SYSCOUNTER) + zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOSTART=1) + endif() endif() # Inject HAL "CONFIG_NFCT_PINS_AS_GPIOS" definition if user requests to From d0b6a48b63f61087f2a0eb6b6ffc3f0918c1aa70 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 1 Feb 2024 09:46:02 +0100 Subject: [PATCH 1888/2300] [nrf fromlist] tests: drivers: timer: grtc: Fix GRTC test Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71688 The `z_nrf_grtc_timer_get_ticks()` function converts system ticks to GRTC ticks. It gets the current system tick to calculate an absolute GRTC value. The same does the test function to provide an argument to be converted. If the system tick occurs between those `sys_clock_tick_get()` calls the `z_nrf_grtc_timer_get_ticks()` will take into account the newer tick while the test estimate bases on the old tick value. Due to that the maximum result error is 1 system tick minus 1 GRTC tick which equals (`CYC_PER_TICK` - 1) for GRTC ticks. Signed-off-by: Adam Kondraciuk (cherry picked from commit 57713428a84d4a86290bae9c636a5d0606b9798f) --- tests/drivers/timer/nrf_grtc_timer/src/main.c | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index 197270cc6a4..e6621316666 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -8,12 +8,15 @@ #include #define GRTC_SLEW_TICKS 10 +#define NUMBER_OF_TRIES 2000 +#define CYC_PER_TICK \ + ((uint64_t)sys_clock_hw_cycles_per_sec() / (uint64_t)CONFIG_SYS_CLOCK_TICKS_PER_SEC) ZTEST(nrf_grtc_timer, test_get_ticks) { k_timeout_t t = K_MSEC(1); - uint64_t exp_ticks = z_nrf_grtc_timer_read() + t.ticks; + uint64_t exp_ticks = z_nrf_grtc_timer_read() + t.ticks * CYC_PER_TICK; int64_t ticks; /* Relative 1ms from now timeout converted to GRTC */ @@ -21,20 +24,26 @@ ZTEST(nrf_grtc_timer, test_get_ticks) zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); - /* Absolute timeout 1ms in the past */ - t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() - K_MSEC(1).ticks)); - - exp_ticks = z_nrf_grtc_timer_read() - K_MSEC(1).ticks; - ticks = z_nrf_grtc_timer_get_ticks(t); - zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), - "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); - - /* Absolute timeout 10ms in the future */ - t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() + K_MSEC(10).ticks)); - exp_ticks = z_nrf_grtc_timer_read() + K_MSEC(10).ticks; - ticks = z_nrf_grtc_timer_get_ticks(t); - zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), - "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); + for (uint32_t i = 0; i < NUMBER_OF_TRIES; i++) { + /* Absolute timeout 1ms in the past */ + t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() - K_MSEC(1).ticks)); + + exp_ticks = z_nrf_grtc_timer_read() - K_MSEC(1).ticks * CYC_PER_TICK; + ticks = z_nrf_grtc_timer_get_ticks(t); + zassert_true((ticks >= (exp_ticks - CYC_PER_TICK + 1)) && + (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), + "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, + exp_ticks); + + /* Absolute timeout 10ms in the future */ + t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() + K_MSEC(10).ticks)); + exp_ticks = z_nrf_grtc_timer_read() + K_MSEC(10).ticks * CYC_PER_TICK; + ticks = z_nrf_grtc_timer_get_ticks(t); + zassert_true((ticks >= (exp_ticks - CYC_PER_TICK + 1)) && + (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), + "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, + exp_ticks); + } } ZTEST_SUITE(nrf_grtc_timer, NULL, NULL, NULL, NULL, NULL); From aedc525fb722a003f7774b7cdcf65c037d846a1a Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Fri, 3 May 2024 10:07:30 +0200 Subject: [PATCH 1889/2300] [nrf fromlist] boards: nrf54h20dk: Drop shared_ram20_region's compatible Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72273 Access to this region should no longer be requested via UICR, because it will be statically allocated by secure domain firmware. Signed-off-by: Grzegorz Swiderski (cherry picked from commit d95aa856e98b6561d534cbe36ffc6e87de3deab2) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index 91899e2cf86..f67ddfb80bf 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -70,11 +70,7 @@ }; shared_ram20_region: memory@2f88f000 { - compatible = "nordic,owned-memory"; reg = <0x2f88f000 DT_SIZE_K(4)>; - status = "disabled"; - perm-read; - perm-write; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f88f000 0x1000>; From 04cb69403fc0822aaf9a1e02d58640add1349c8f Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 17 Apr 2024 13:51:37 +0200 Subject: [PATCH 1890/2300] [nrf noup] boards: nordic: nrf54h20dk: Add aliases for RESETINFO Each local RESETINFO instance can be used in samples. Applied as `noup` because of conflicts. Signed-off-by: Grzegorz Swiderski --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 24d161420d6..136197d2767 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -34,6 +34,7 @@ led2 = &led2; led3 = &led3; pwm-led0 = &pwm_led0; + resetinfo = &cpuapp_resetinfo; sw0 = &button0; sw1 = &button1; sw2 = &button2; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index cb69b5ce3a6..32cda09ff37 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -33,6 +33,10 @@ compatible = "nordic,entropy-prng"; status = "okay"; }; + + aliases { + resetinfo = &cpurad_resetinfo; + }; }; &shared_ram3x_region { From da41afb6ae575dd8903f3439d9622b4707e2029e Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Thu, 2 May 2024 12:29:40 +0200 Subject: [PATCH 1891/2300] [nrf noup] boards: nrf54l15/nrf54l15/cpuapp/ns Enable PS Rollback protection !fixup: [nrf noup] boards: add nrf54l15/nrf54l15/cpuapp/ns as board variant For initial support the Rollback protection was disabled as the NV counters and encryption was not supported. Now both is available therefor enabling the Rollback protection. Ref: NCSDK-26634 Signed-off-by: Markus Swarowsky --- .../nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig index ec01756bfd4..6336dfb87cc 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig @@ -27,9 +27,6 @@ CONFIG_SERIAL=y # Enable GPIO CONFIG_GPIO=y -# NCSDK-26634: Rollback protection is not supported yet -CONFIG_TFM_PS_ROLLBACK_PROTECTION=n - # NCSDK-22600: Built-in keys are not supported yet. CONFIG_TFM_CRYPTO_BUILTIN_KEYS=n From 987b5d17c3db527e91eb7d7677b021b47fda6980 Mon Sep 17 00:00:00 2001 From: Markus Swarowsky Date: Thu, 2 May 2024 12:32:09 +0200 Subject: [PATCH 1892/2300] [nrf noup] boards: nrf54l15/nrf54l15/cpuapp/ns enable builtin keys !fixup: [nrf noup] boards: add nrf54l15/nrf54l15/cpuapp/ns as board variant Build in keys are now supported in TF-M so enabled them Ref: NCSDK-22600 Signed-off-by: Markus Swarowsky --- .../nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig index 6336dfb87cc..70f01d7c9ba 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig @@ -27,8 +27,5 @@ CONFIG_SERIAL=y # Enable GPIO CONFIG_GPIO=y -# NCSDK-22600: Built-in keys are not supported yet. -CONFIG_TFM_CRYPTO_BUILTIN_KEYS=n - # Start SYSCOUNTER on driver init CONFIG_NRF_GRTC_START_SYSCOUNTER=y From 8789e400423311958399a85c9be46cc768a34e2c Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 2 May 2024 15:28:25 +0200 Subject: [PATCH 1893/2300] [nrf fromtree] Bluetooth: CSIP: Set Coordinator move data to instances Moved the busy flag and the GATT paramters to the individual CSIP Set Coordinator instances. This allows to use multiple instances in parallel, and thus in turn allow CAP to do things in parallel. This commit has been done with minimal amount of changes, even if there are multiple pieces of code that could likely be refactored to be better. Signed-off-by: Emil Gydesen (cherry picked from commit d45b462f23fc6a5cf529c93d6f594c01c7306b06) --- subsys/bluetooth/audio/csip_set_coordinator.c | 395 ++++++++++-------- 1 file changed, 210 insertions(+), 185 deletions(-) diff --git a/subsys/bluetooth/audio/csip_set_coordinator.c b/subsys/bluetooth/audio/csip_set_coordinator.c index d2dac6f9b6e..b59587ebdfc 100644 --- a/subsys/bluetooth/audio/csip_set_coordinator.c +++ b/subsys/bluetooth/audio/csip_set_coordinator.c @@ -42,29 +42,30 @@ LOG_MODULE_REGISTER(bt_csip_set_coordinator, CONFIG_BT_CSIP_SET_COORDINATOR_LOG_LEVEL); -static uint8_t gatt_write_buf[1]; -static struct bt_gatt_write_params write_params; -static struct bt_gatt_read_params read_params; -static struct bt_gatt_discover_params discover_params; -static struct bt_csip_set_coordinator_svc_inst *cur_inst; -static bool busy; - 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; uint8_t members_count; uint8_t members_handled; uint8_t members_restored; + bool in_progress; bt_csip_set_coordinator_ordered_access_t oap_cb; } active; struct bt_csip_set_coordinator_inst { uint8_t inst_count; - struct bt_csip_set_coordinator_svc_inst svc_insts - [CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES]; + bool busy; + uint8_t gatt_write_buf[1]; + + struct bt_csip_set_coordinator_svc_inst + svc_insts[CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES]; struct bt_csip_set_coordinator_set_member set_member; struct bt_conn *conn; + struct bt_csip_set_coordinator_svc_inst *cur_inst; + struct bt_gatt_discover_params discover_params; + struct bt_gatt_read_params read_params; + struct bt_gatt_write_params write_params; }; static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0); @@ -336,8 +337,8 @@ static void discover_complete(struct bt_csip_set_coordinator_inst *client, { struct bt_csip_set_coordinator_cb *listener; - cur_inst = NULL; - busy = false; + client->cur_inst = NULL; + client->busy = false; SYS_SLIST_FOR_EACH_CONTAINER(&csip_set_coordinator_cbs, listener, _node) { if (listener->discover) { @@ -529,30 +530,34 @@ static int csip_set_coordinator_write_set_lock(struct bt_csip_set_coordinator_sv bool lock, bt_gatt_write_func_t cb) { + struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(inst->conn)]; + if (inst->set_lock_handle == 0) { LOG_DBG("Handle not set"); - cur_inst = NULL; + client->cur_inst = NULL; return -EINVAL; } /* Write to call control point */ - gatt_write_buf[0] = lock ? BT_CSIP_LOCK_VALUE : BT_CSIP_RELEASE_VALUE; - write_params.data = gatt_write_buf; - write_params.length = sizeof(lock); - write_params.func = cb; - write_params.handle = inst->set_lock_handle; + client->gatt_write_buf[0] = lock ? BT_CSIP_LOCK_VALUE : BT_CSIP_RELEASE_VALUE; + client->write_params.data = client->gatt_write_buf; + client->write_params.length = sizeof(lock); + client->write_params.func = cb; + client->write_params.handle = inst->set_lock_handle; - return bt_gatt_write(inst->conn, &write_params); + return bt_gatt_write(inst->conn, &client->write_params); } static int read_set_sirk(struct bt_csip_set_coordinator_svc_inst *svc_inst) { - if (cur_inst != NULL) { - if (cur_inst != svc_inst) { + struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(svc_inst->conn)]; + + if (client->cur_inst != NULL) { + if (client->cur_inst != svc_inst) { return -EBUSY; } } else { - cur_inst = svc_inst; + client->cur_inst = svc_inst; } if (svc_inst->set_sirk_handle == 0) { @@ -560,86 +565,93 @@ static int read_set_sirk(struct bt_csip_set_coordinator_svc_inst *svc_inst) return -EINVAL; } - read_params.func = csip_set_coordinator_discover_insts_read_set_sirk_cb; - read_params.handle_count = 1; - read_params.single.handle = svc_inst->set_sirk_handle; - read_params.single.offset = 0U; + client->read_params.func = csip_set_coordinator_discover_insts_read_set_sirk_cb; + client->read_params.handle_count = 1; + client->read_params.single.handle = svc_inst->set_sirk_handle; + client->read_params.single.offset = 0U; - return bt_gatt_read(svc_inst->conn, &read_params); + return bt_gatt_read(svc_inst->conn, &client->read_params); } static int csip_set_coordinator_read_set_size(struct bt_conn *conn, uint8_t inst_idx, bt_gatt_read_func_t cb) { + struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; + if (inst_idx >= CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES) { return -EINVAL; - } else if (cur_inst != NULL) { - if (cur_inst != bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx)) { + } else if (client->cur_inst != NULL) { + if (client->cur_inst != + bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx)) { return -EBUSY; } } else { - cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx); - if (cur_inst == NULL) { + client->cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx); + if (client->cur_inst == NULL) { LOG_DBG("Inst not found"); return -EINVAL; } } - if (cur_inst->set_size_handle == 0) { + if (client->cur_inst->set_size_handle == 0) { LOG_DBG("Handle not set"); - cur_inst = NULL; + client->cur_inst = NULL; return -EINVAL; } - read_params.func = cb; - read_params.handle_count = 1; - read_params.single.handle = cur_inst->set_size_handle; - read_params.single.offset = 0U; + client->read_params.func = cb; + client->read_params.handle_count = 1; + client->read_params.single.handle = client->cur_inst->set_size_handle; + client->read_params.single.offset = 0U; - return bt_gatt_read(conn, &read_params); + return bt_gatt_read(conn, &client->read_params); } static int csip_set_coordinator_read_rank(struct bt_conn *conn, uint8_t inst_idx, bt_gatt_read_func_t cb) { + struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; + if (inst_idx >= CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES) { return -EINVAL; - } else if (cur_inst != NULL) { - if (cur_inst != bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx)) { + } else if (client->cur_inst != NULL) { + if (client->cur_inst != + bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx)) { return -EBUSY; } } else { - cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx); - if (cur_inst == NULL) { + client->cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx); + if (client->cur_inst == NULL) { LOG_DBG("Inst not found"); return -EINVAL; } } - if (cur_inst->rank_handle == 0) { + if (client->cur_inst->rank_handle == 0) { LOG_DBG("Handle not set"); - cur_inst = NULL; + client->cur_inst = NULL; return -EINVAL; } - read_params.func = cb; - read_params.handle_count = 1; - read_params.single.handle = cur_inst->rank_handle; - read_params.single.offset = 0U; + client->read_params.func = cb; + client->read_params.handle_count = 1; + client->read_params.single.handle = client->cur_inst->rank_handle; + client->read_params.single.offset = 0U; - return bt_gatt_read(conn, &read_params); + return bt_gatt_read(conn, &client->read_params); } -static int csip_set_coordinator_discover_sets(struct bt_csip_set_coordinator_set_member *member) +static int csip_set_coordinator_discover_sets(struct bt_csip_set_coordinator_inst *client) { + struct bt_csip_set_coordinator_set_member *member = &client->set_member; int err; /* Start reading values and call CB when done */ err = read_set_sirk((struct bt_csip_set_coordinator_svc_inst *)member->insts[0].svc_inst); if (err == 0) { - busy = true; + client->busy = true; } return err; @@ -655,21 +667,22 @@ static uint8_t discover_func(struct bt_conn *conn, void *notify_handler = NULL; if (attr == NULL) { - LOG_DBG("Setup complete for %u / %u", cur_inst->idx + 1, client->inst_count); + LOG_DBG("Setup complete for %u / %u", client->cur_inst->idx + 1, + client->inst_count); (void)memset(params, 0, sizeof(*params)); if (CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES > 1 && - (cur_inst->idx + 1) < client->inst_count) { + (client->cur_inst->idx + 1) < client->inst_count) { int err; - cur_inst = &client->svc_insts[cur_inst->idx + 1]; - discover_params.uuid = NULL; - discover_params.start_handle = cur_inst->start_handle; - discover_params.end_handle = cur_inst->end_handle; - discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; - discover_params.func = discover_func; + client->cur_inst = &client->svc_insts[client->cur_inst->idx + 1]; + client->discover_params.uuid = NULL; + client->discover_params.start_handle = client->cur_inst->start_handle; + client->discover_params.end_handle = client->cur_inst->end_handle; + client->discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; + client->discover_params.func = discover_func; - err = bt_gatt_discover(conn, &discover_params); + err = bt_gatt_discover(conn, &client->discover_params); if (err != 0) { LOG_DBG("Discover failed (err %d)", err); discover_complete(client, err); @@ -678,9 +691,9 @@ static uint8_t discover_func(struct bt_conn *conn, } else { int err; - cur_inst = NULL; - busy = false; - err = csip_set_coordinator_discover_sets(&client->set_member); + client->cur_inst = NULL; + client->busy = false; + err = csip_set_coordinator_discover_sets(client); if (err != 0) { LOG_DBG("Discover sets failed (err %d)", err); discover_complete(client, err); @@ -696,30 +709,30 @@ static uint8_t discover_func(struct bt_conn *conn, chrc = (struct bt_gatt_chrc *)attr->user_data; if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_SET_SIRK) == 0) { LOG_DBG("Set SIRK"); - cur_inst->set_sirk_handle = chrc->value_handle; - sub_params = &cur_inst->sirk_sub_params; - sub_params->disc_params = &cur_inst->sirk_sub_disc_params; + client->cur_inst->set_sirk_handle = chrc->value_handle; + sub_params = &client->cur_inst->sirk_sub_params; + sub_params->disc_params = &client->cur_inst->sirk_sub_disc_params; notify_handler = sirk_notify_func; } else if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_SET_SIZE) == 0) { LOG_DBG("Set size"); - cur_inst->set_size_handle = chrc->value_handle; - sub_params = &cur_inst->size_sub_params; - sub_params->disc_params = &cur_inst->size_sub_disc_params; + client->cur_inst->set_size_handle = chrc->value_handle; + sub_params = &client->cur_inst->size_sub_params; + sub_params->disc_params = &client->cur_inst->size_sub_disc_params; notify_handler = size_notify_func; } else if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_SET_LOCK) == 0) { struct bt_csip_set_coordinator_set_info *set_info; LOG_DBG("Set lock"); - cur_inst->set_lock_handle = chrc->value_handle; - sub_params = &cur_inst->lock_sub_params; - sub_params->disc_params = &cur_inst->lock_sub_disc_params; + client->cur_inst->set_lock_handle = chrc->value_handle; + sub_params = &client->cur_inst->lock_sub_params; + sub_params->disc_params = &client->cur_inst->lock_sub_disc_params; notify_handler = lock_notify_func; - set_info = &client->set_member.insts[cur_inst->idx].info; + set_info = &client->set_member.insts[client->cur_inst->idx].info; set_info->lockable = true; } else if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_RANK) == 0) { LOG_DBG("Set rank"); - cur_inst->rank_handle = chrc->value_handle; + client->cur_inst->rank_handle = chrc->value_handle; } if (sub_params != NULL && notify_handler != NULL) { @@ -735,7 +748,7 @@ static uint8_t discover_func(struct bt_conn *conn, /* With ccc_handle == 0 it will use auto discovery */ sub_params->ccc_handle = 0; - sub_params->end_handle = cur_inst->end_handle; + sub_params->end_handle = client->cur_inst->end_handle; sub_params->value_handle = chrc->value_handle; sub_params->notify = notify_handler; atomic_set_bit(sub_params->flags, BT_GATT_SUBSCRIBE_FLAG_VOLATILE); @@ -769,14 +782,14 @@ static uint8_t primary_discover_func(struct bt_conn *conn, if (client->inst_count != 0) { int err; - cur_inst = &client->svc_insts[0]; - discover_params.uuid = NULL; - discover_params.start_handle = cur_inst->start_handle; - discover_params.end_handle = cur_inst->end_handle; - discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; - discover_params.func = discover_func; + client->cur_inst = &client->svc_insts[0]; + client->discover_params.uuid = NULL; + client->discover_params.start_handle = client->cur_inst->start_handle; + client->discover_params.end_handle = client->cur_inst->end_handle; + client->discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; + client->discover_params.func = discover_func; - err = bt_gatt_discover(conn, &discover_params); + err = bt_gatt_discover(conn, &client->discover_params); if (err != 0) { LOG_DBG("Discover failed (err %d)", err); discover_complete(client, err); @@ -792,14 +805,14 @@ static uint8_t primary_discover_func(struct bt_conn *conn, if (params->type == BT_GATT_DISCOVER_PRIMARY) { prim_service = (struct bt_gatt_service_val *)attr->user_data; - discover_params.start_handle = attr->handle + 1; - - cur_inst = &client->svc_insts[client->inst_count]; - cur_inst->idx = client->inst_count; - cur_inst->start_handle = attr->handle; - cur_inst->end_handle = prim_service->end_handle; - cur_inst->conn = bt_conn_ref(conn); - cur_inst->set_info = &client->set_member.insts[cur_inst->idx].info; + client->discover_params.start_handle = attr->handle + 1; + + client->cur_inst = &client->svc_insts[client->inst_count]; + client->cur_inst->idx = client->inst_count; + client->cur_inst->start_handle = attr->handle; + client->cur_inst->end_handle = prim_service->end_handle; + client->cur_inst->conn = bt_conn_ref(conn); + client->cur_inst->set_info = &client->set_member.insts[client->cur_inst->idx].info; client->inst_count++; } @@ -843,9 +856,9 @@ static uint8_t csip_set_coordinator_discover_insts_read_rank_cb(struct bt_conn * { struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; - __ASSERT(cur_inst != NULL, "cur_inst must not be NULL"); + __ASSERT(client->cur_inst != NULL, "client->cur_inst must not be NULL"); - busy = false; + client->busy = false; if (err != 0) { LOG_DBG("err: 0x%02X", err); @@ -856,7 +869,7 @@ static uint8_t csip_set_coordinator_discover_insts_read_rank_cb(struct bt_conn * LOG_HEXDUMP_DBG(data, length, "Data read"); - set_info = &client->set_member.insts[cur_inst->idx].info; + set_info = &client->set_member.insts[client->cur_inst->idx].info; if (length == sizeof(set_info->rank)) { (void)memcpy(&set_info->rank, data, length); @@ -877,9 +890,9 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_size_cb( { struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; - __ASSERT(cur_inst != NULL, "cur_inst must not be NULL"); + __ASSERT(client->cur_inst != NULL, "client->cur_inst must not be NULL"); - busy = false; + client->busy = false; if (err != 0) { LOG_DBG("err: 0x%02X", err); @@ -890,7 +903,7 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_size_cb( LOG_HEXDUMP_DBG(data, length, "Data read"); - set_info = &client->set_member.insts[cur_inst->idx].info; + set_info = &client->set_member.insts[client->cur_inst->idx].info; if (length == sizeof(set_info->set_size)) { (void)memcpy(&set_info->set_size, data, length); @@ -899,7 +912,7 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_size_cb( LOG_DBG("Invalid length"); } - discover_insts_resume(conn, 0, 0, cur_inst->rank_handle); + discover_insts_resume(conn, 0, 0, client->cur_inst->rank_handle); } return BT_GATT_ITER_STOP; @@ -910,7 +923,7 @@ static int parse_sirk(struct bt_csip_set_coordinator_inst *client, { uint8_t *set_sirk; - set_sirk = client->set_member.insts[cur_inst->idx].info.set_sirk; + set_sirk = client->set_member.insts[client->cur_inst->idx].info.set_sirk; if (length == sizeof(struct bt_csip_set_sirk)) { struct bt_csip_set_sirk *sirk = @@ -960,9 +973,9 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_sirk_cb( { struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; int cb_err = err; - __ASSERT(cur_inst != NULL, "cur_inst must not be NULL"); + __ASSERT(client->cur_inst != NULL, "client->cur_inst must not be NULL"); - busy = false; + client->busy = false; if (err != 0) { LOG_DBG("err: 0x%02X", err); @@ -976,9 +989,8 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_sirk_cb( if (cb_err != 0) { LOG_DBG("Could not parse SIRK: %d", cb_err); } else { - discover_insts_resume(conn, 0, - cur_inst->set_size_handle, - cur_inst->rank_handle); + discover_insts_resume(conn, 0, client->cur_inst->set_size_handle, + client->cur_inst->rank_handle); } } @@ -1003,28 +1015,28 @@ static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle, if (size_handle != 0) { cb_err = csip_set_coordinator_read_set_size( - conn, cur_inst->idx, - csip_set_coordinator_discover_insts_read_set_size_cb); + conn, client->cur_inst->idx, + csip_set_coordinator_discover_insts_read_set_size_cb); if (cb_err != 0) { LOG_DBG("Could not read set size: %d", cb_err); } } else if (rank_handle != 0) { cb_err = csip_set_coordinator_read_rank( - conn, cur_inst->idx, - csip_set_coordinator_discover_insts_read_rank_cb); + conn, client->cur_inst->idx, + csip_set_coordinator_discover_insts_read_rank_cb); if (cb_err != 0) { LOG_DBG("Could not read set rank: %d", cb_err); } } else { - uint8_t next_idx = cur_inst->idx + 1; + uint8_t next_idx = client->cur_inst->idx + 1; - cur_inst = NULL; + client->cur_inst = NULL; if (next_idx < client->inst_count) { - cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, - next_idx); + client->cur_inst = + bt_csip_set_coordinator_lookup_instance_by_index(conn, next_idx); /* Read next */ - cb_err = read_set_sirk(cur_inst); + cb_err = read_set_sirk(client->cur_inst); } else { discover_complete(client, 0); @@ -1035,7 +1047,7 @@ static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle, if (cb_err != 0) { discover_complete(client, cb_err); } else { - busy = true; + client->busy = true; } } @@ -1043,7 +1055,9 @@ static void csip_set_coordinator_write_restore_cb(struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params) { - busy = false; + struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; + + client->busy = false; if (err != 0) { LOG_WRN("Could not restore (%d)", err); @@ -1061,18 +1075,17 @@ 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]; - cur_inst = lookup_instance_by_set_info(member, active.info); - if (cur_inst == NULL) { + client->cur_inst = lookup_instance_by_set_info(member, active.info); + if (client->cur_inst == NULL) { release_set_complete(-ENOENT); return; } csip_err = csip_set_coordinator_write_set_lock( - cur_inst, false, - csip_set_coordinator_write_restore_cb); + client->cur_inst, false, csip_set_coordinator_write_restore_cb); if (csip_err == 0) { - busy = true; + client->busy = true; } else { LOG_DBG("Failed to release next member[%u]: %d", active.members_handled, csip_err); @@ -1088,7 +1101,9 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params) { - busy = false; + struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; + + client->busy = false; if (err != 0) { LOG_DBG("Could not lock (0x%X)", err); @@ -1099,9 +1114,8 @@ 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]; - cur_inst = lookup_instance_by_set_info(member, - active.info); - if (cur_inst == NULL) { + 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); lock_set_complete(-ENOENT); @@ -1109,10 +1123,9 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, } csip_err = csip_set_coordinator_write_set_lock( - cur_inst, false, - csip_set_coordinator_write_restore_cb); + client->cur_inst, false, csip_set_coordinator_write_restore_cb); if (csip_err == 0) { - busy = true; + client->busy = true; } else { LOG_WRN("Could not release lock of previous locked member: %d", csip_err); @@ -1130,21 +1143,20 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, LOG_DBG("Locked %u/%u members", active.members_handled, active.members_count); if (active.members_handled < active.members_count) { - struct bt_csip_set_coordinator_svc_inst *prev_inst = cur_inst; + struct bt_csip_set_coordinator_svc_inst *prev_inst = client->cur_inst; int csip_err; - cur_inst = get_next_active_instance(); - if (cur_inst == NULL) { + client->cur_inst = get_next_active_instance(); + if (client->cur_inst == NULL) { lock_set_complete(-ENOENT); return; } - csip_err = csip_set_coordinator_write_set_lock( - cur_inst, true, - csip_set_coordinator_write_lock_cb); + csip_err = csip_set_coordinator_write_set_lock(client->cur_inst, true, + csip_set_coordinator_write_lock_cb); if (csip_err == 0) { - busy = true; + client->busy = true; } else { LOG_DBG("Failed to lock next member[%u]: %d", active.members_handled, csip_err); @@ -1155,7 +1167,7 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, prev_inst, false, csip_set_coordinator_write_restore_cb); if (csip_err == 0) { - busy = true; + client->busy = true; } else { LOG_WRN("Could not release lock of previous locked member: %d", csip_err); @@ -1171,7 +1183,9 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, static void csip_set_coordinator_write_release_cb(struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params) { - busy = false; + struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; + + client->busy = false; if (err != 0) { LOG_DBG("Could not release lock (%d)", err); @@ -1186,18 +1200,17 @@ static void csip_set_coordinator_write_release_cb(struct bt_conn *conn, uint8_t if (active.members_handled < active.members_count) { int csip_err; - cur_inst = get_next_active_instance(); - if (cur_inst == NULL) { + client->cur_inst = get_next_active_instance(); + if (client->cur_inst == NULL) { release_set_complete(-ENOENT); return; } csip_err = csip_set_coordinator_write_set_lock( - cur_inst, false, - csip_set_coordinator_write_release_cb); + client->cur_inst, false, csip_set_coordinator_write_release_cb); if (csip_err == 0) { - busy = true; + client->busy = true; } else { LOG_DBG("Failed to release next member[%u]: %d", active.members_handled, csip_err); @@ -1230,9 +1243,10 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, const void *data, uint16_t length) { + struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; uint8_t value = 0; - busy = false; + client->busy = false; if (err != 0) { LOG_DBG("Could not read lock value (0x%X)", err); @@ -1245,7 +1259,7 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, active.members_handled++; LOG_DBG("Read lock state on %u/%u members", active.members_handled, active.members_count); - if (data == NULL || length != sizeof(cur_inst->set_lock)) { + if (data == NULL || length != sizeof(client->cur_inst->set_lock)) { LOG_DBG("Invalid data %p or length %u", data, length); csip_set_coordinator_lock_state_read_cb(err, false); @@ -1263,7 +1277,7 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, return BT_GATT_ITER_STOP; } - cur_inst->set_lock = value; + client->cur_inst->set_lock = value; if (value != BT_CSIP_RELEASE_VALUE) { LOG_DBG("Set member not unlocked"); @@ -1276,16 +1290,16 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, if (active.members_handled < active.members_count) { int csip_err; - cur_inst = get_next_active_instance(); - if (cur_inst == NULL) { + client->cur_inst = get_next_active_instance(); + if (client->cur_inst == NULL) { csip_set_coordinator_lock_state_read_cb(-ENOENT, false); return BT_GATT_ITER_STOP; } - csip_err = csip_set_coordinator_read_set_lock(cur_inst); + csip_err = csip_set_coordinator_read_set_lock(client->cur_inst); if (csip_err == 0) { - busy = true; + client->busy = true; } else { LOG_DBG("Failed to read next member[%u]: %d", active.members_handled, csip_err); @@ -1301,18 +1315,28 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, static int csip_set_coordinator_read_set_lock(struct bt_csip_set_coordinator_svc_inst *inst) { + struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(inst->conn)]; + int err; + if (inst->set_lock_handle == 0) { LOG_DBG("Handle not set"); - cur_inst = NULL; + client->cur_inst = NULL; return -EINVAL; } - read_params.func = csip_set_coordinator_read_lock_cb; - read_params.handle_count = 1; - read_params.single.handle = inst->set_lock_handle; - read_params.single.offset = 0; + client->read_params.func = csip_set_coordinator_read_lock_cb; + client->read_params.handle_count = 1; + client->read_params.single.handle = inst->set_lock_handle; + client->read_params.single.offset = 0; + + client->cur_inst = inst; + + err = bt_gatt_read(inst->conn, &client->read_params); + if (err != 0) { + client->cur_inst = NULL; + } - return bt_gatt_read(inst->conn, &read_params); + return err; } static void csip_set_coordinator_reset(struct bt_csip_set_coordinator_inst *inst) @@ -1418,29 +1442,28 @@ int bt_csip_set_coordinator_discover(struct bt_conn *conn) return -EINVAL; } - if (busy) { + client = &client_insts[bt_conn_index(conn)]; + if (client->busy) { return -EBUSY; } - client = &client_insts[bt_conn_index(conn)]; - csip_set_coordinator_reset(client); /* Discover CSIS on peer, setup handles and notify */ - (void)memset(&discover_params, 0, sizeof(discover_params)); + (void)memset(&client->discover_params, 0, sizeof(client->discover_params)); (void)memcpy(&uuid, BT_UUID_CSIS, sizeof(uuid)); - discover_params.func = primary_discover_func; - discover_params.uuid = &uuid.uuid; - discover_params.type = BT_GATT_DISCOVER_PRIMARY; - discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; - discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; + client->discover_params.func = primary_discover_func; + client->discover_params.uuid = &uuid.uuid; + client->discover_params.type = BT_GATT_DISCOVER_PRIMARY; + client->discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; + client->discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; - err = bt_gatt_discover(conn, &discover_params); + err = bt_gatt_discover(conn, &client->discover_params); if (err == 0) { for (size_t i = 0; i < ARRAY_SIZE(client->set_member.insts); i++) { client->set_member.insts[i].svc_inst = (void *)&client->svc_insts[i]; } - busy = true; + client->busy = true; client->conn = bt_conn_ref(conn); } @@ -1526,8 +1549,8 @@ static int bt_csip_set_coordinator_get_lock_state( { int err; - if (busy) { - LOG_DBG("csip_set_coordinator busy"); + if (active.in_progress) { + LOG_DBG("Procedure in progress"); return -EBUSY; } @@ -1540,20 +1563,20 @@ static int bt_csip_set_coordinator_get_lock_state( active_members_store_ordered(members, count, set_info, true); for (uint8_t i = 0U; i < count; i++) { - cur_inst = lookup_instance_by_set_info(active.members[i], active.info); - if (cur_inst == NULL) { + struct bt_csip_set_coordinator_svc_inst *svc_inst; + + 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); active_members_reset(); return -ENOENT; } - if (cur_inst->set_info->lockable) { - err = csip_set_coordinator_read_set_lock(cur_inst); + if (svc_inst->set_info->lockable) { + err = csip_set_coordinator_read_set_lock(svc_inst); if (err == 0) { - busy = true; - } else { - cur_inst = NULL; + active.in_progress = true; } break; @@ -1562,7 +1585,7 @@ static int bt_csip_set_coordinator_get_lock_state( active.members_handled++; } - if (!busy && err == 0) { + if (!active.in_progress && err == 0) { /* We are not reading any lock states (because they are not on the remote devices), * so we can just initiate the ordered access procedure (oap) callback directly * here. @@ -1604,10 +1627,11 @@ int bt_csip_set_coordinator_lock( uint8_t count, const struct bt_csip_set_coordinator_set_info *set_info) { + struct bt_csip_set_coordinator_svc_inst *svc_inst; int err; - CHECKIF(busy) { - LOG_DBG("csip_set_coordinator busy"); + CHECKIF(active.in_progress) { + LOG_DBG("Procedure in progress"); return -EBUSY; } @@ -1619,18 +1643,18 @@ int bt_csip_set_coordinator_lock( active_members_store_ordered(members, count, set_info, true); - cur_inst = lookup_instance_by_set_info(active.members[0], active.info); - if (cur_inst == NULL) { + 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); active_members_reset(); return -ENOENT; } - err = csip_set_coordinator_write_set_lock(cur_inst, true, + err = csip_set_coordinator_write_set_lock(svc_inst, true, csip_set_coordinator_write_lock_cb); if (err == 0) { - busy = true; + active.in_progress = true; } return err; @@ -1640,10 +1664,11 @@ int bt_csip_set_coordinator_release(const struct bt_csip_set_coordinator_set_mem uint8_t count, const struct bt_csip_set_coordinator_set_info *set_info) { + struct bt_csip_set_coordinator_svc_inst *svc_inst; int err; - CHECKIF(busy) { - LOG_DBG("csip_set_coordinator busy"); + CHECKIF(active.in_progress) { + LOG_DBG("Procedure in progress"); return -EBUSY; } @@ -1655,18 +1680,18 @@ int bt_csip_set_coordinator_release(const struct bt_csip_set_coordinator_set_mem active_members_store_ordered(members, count, set_info, false); - cur_inst = lookup_instance_by_set_info(active.members[0], active.info); - if (cur_inst == NULL) { + 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); active_members_reset(); return -ENOENT; } - err = csip_set_coordinator_write_set_lock(cur_inst, false, + err = csip_set_coordinator_write_set_lock(svc_inst, false, csip_set_coordinator_write_release_cb); if (err == 0) { - busy = true; + active.in_progress = true; } return err; From f41cf518f951a990a35b49a27b0d46dab1e9e1b6 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 2 May 2024 09:57:00 +0200 Subject: [PATCH 1894/2300] [nrf fromtree] Bluetooth: CAP: Fix issue with parallel CAP discover The bt_cap_common_discover function relied on a global variable used to indicate that a discovery was in process. This global variable prevented multiple discoveries to take place on multiple ACL connections, where the intention was to stop multiple discoveries on the same ACL. This has been fixed by moving the variable into the struct bt_cap_common_client, so that it applies per connection, rather than a global check. Signed-off-by: Emil Gydesen (cherry picked from commit 68ea1c4fe454e2d5fd2a5ad55cfa3bf05b42fed4) --- subsys/bluetooth/audio/cap_common.c | 20 ++++++++++++-------- subsys/bluetooth/audio/cap_internal.h | 7 ++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/subsys/bluetooth/audio/cap_common.c b/subsys/bluetooth/audio/cap_common.c index 277b904355b..23de8c19cb7 100644 --- a/subsys/bluetooth/audio/cap_common.c +++ b/subsys/bluetooth/audio/cap_common.c @@ -17,7 +17,6 @@ LOG_MODULE_REGISTER(bt_cap_common, CONFIG_BT_CAP_COMMON_LOG_LEVEL); static struct bt_cap_common_client bt_cap_common_clients[CONFIG_BT_MAX_CONN]; static const struct bt_uuid *cas_uuid = BT_UUID_CAS; static struct bt_cap_common_proc active_proc; -static bt_cap_common_discover_func_t discover_cb_func; struct bt_cap_common_proc *bt_cap_common_get_active_proc(void) { @@ -258,10 +257,13 @@ struct bt_cap_common_client *bt_cap_common_get_client(enum bt_cap_set_type type, static void cap_common_discover_complete(struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_csis_inst *csis_inst) { - if (discover_cb_func != NULL) { - const bt_cap_common_discover_func_t cb_func = discover_cb_func; + struct bt_cap_common_client *client; + + client = bt_cap_common_get_client_by_acl(conn); + if (client != NULL && client->discover_cb_func != NULL) { + const bt_cap_common_discover_func_t cb_func = client->discover_cb_func; - discover_cb_func = NULL; + client->discover_cb_func = NULL; cb_func(conn, err, csis_inst); } } @@ -386,24 +388,26 @@ static uint8_t bt_cap_common_discover_cas_cb(struct bt_conn *conn, const struct int bt_cap_common_discover(struct bt_conn *conn, bt_cap_common_discover_func_t func) { struct bt_gatt_discover_params *param; + struct bt_cap_common_client *client; int err; - if (discover_cb_func != NULL) { + client = bt_cap_common_get_client_by_acl(conn); + if (client->discover_cb_func != NULL) { return -EBUSY; } - param = &bt_cap_common_clients[bt_conn_index(conn)].param; + param = &client->param; param->func = bt_cap_common_discover_cas_cb; param->uuid = cas_uuid; param->type = BT_GATT_DISCOVER_PRIMARY; param->start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; param->end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; - discover_cb_func = func; + client->discover_cb_func = func; err = bt_gatt_discover(conn, param); if (err != 0) { - discover_cb_func = NULL; + client->discover_cb_func = NULL; /* Report expected possible errors */ if (err == -ENOTCONN || err == -ENOMEM) { diff --git a/subsys/bluetooth/audio/cap_internal.h b/subsys/bluetooth/audio/cap_internal.h index c2dc861da3d..2210110703f 100644 --- a/subsys/bluetooth/audio/cap_internal.h +++ b/subsys/bluetooth/audio/cap_internal.h @@ -101,6 +101,9 @@ struct bt_cap_commander_proc_param { }; }; +typedef void (*bt_cap_common_discover_func_t)( + struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_csis_inst *csis_inst); + struct bt_cap_common_proc_param { union { #if defined(CONFIG_BT_CAP_INITIATOR_UNICAST) @@ -133,6 +136,7 @@ struct bt_cap_common_proc { struct bt_cap_common_client { struct bt_conn *conn; struct bt_gatt_discover_params param; + bt_cap_common_discover_func_t discover_cb_func; uint16_t csis_start_handle; const struct bt_csip_set_coordinator_csis_inst *csis_inst; bool cas_found; @@ -158,7 +162,4 @@ struct bt_cap_common_client * bt_cap_common_get_client_by_csis(const struct bt_csip_set_coordinator_csis_inst *csis_inst); struct bt_cap_common_client *bt_cap_common_get_client(enum bt_cap_set_type type, const union bt_cap_set_member *member); - -typedef void (*bt_cap_common_discover_func_t)( - struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_csis_inst *csis_inst); int bt_cap_common_discover(struct bt_conn *conn, bt_cap_common_discover_func_t func); From 234a37b22f5a5b1439ff444adc6ec1eb7a86a973 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 2 May 2024 15:27:18 +0200 Subject: [PATCH 1895/2300] [nrf fromtree] Tests: Bluetooth: CAP: Refactor some CAP commander functions Refactor som CAP commander test functions to perform operations in parallel, rather than sequential. The CAP initiator functions are kept sequential so that we are testing both versions. Signed-off-by: Emil Gydesen (cherry picked from commit 33c253c813d8cc56209ce0b572e127cd6eaa941b) --- tests/bsim/bluetooth/audio/prj.conf | 1 + .../bluetooth/audio/src/cap_commander_test.c | 188 ++++++++++++------ 2 files changed, 129 insertions(+), 60 deletions(-) diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index ec75aec4478..fb182f0aa07 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -194,6 +194,7 @@ CONFIG_BT_HAS_CLIENT_LOG_LEVEL_DBG=y CONFIG_BT_CAP_ACCEPTOR_LOG_LEVEL_DBG=y CONFIG_BT_CAP_INITIATOR_LOG_LEVEL_DBG=y CONFIG_BT_CAP_COMMANDER_LOG_LEVEL_DBG=y +CONFIG_BT_CAP_COMMON_LOG_LEVEL_DBG=y CONFIG_BT_GMAP_LOG_LEVEL_DBG=y # LOGGING diff --git a/tests/bsim/bluetooth/audio/src/cap_commander_test.c b/tests/bsim/bluetooth/audio/src/cap_commander_test.c index 1a8bb6dd7f6..9271a6a12de 100644 --- a/tests/bsim/bluetooth/audio/src/cap_commander_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_commander_test.c @@ -12,18 +12,22 @@ #include #include #include +#include #include #include "common.h" #include "bap_common.h" +#define SEM_TIMEOUT K_SECONDS(5) + extern enum bst_result_t bst_result; static struct bt_conn *connected_conns[CONFIG_BT_MAX_CONN]; static volatile size_t connected_conn_cnt; -CREATE_FLAG(flag_cas_discovered); -CREATE_FLAG(flag_vcs_discovered); -CREATE_FLAG(flag_mics_discovered); +static struct k_sem sem_disconnected; +static struct k_sem sem_cas_discovered; +static struct k_sem sem_vcs_discovered; +static struct k_sem sem_mics_discovered; CREATE_FLAG(flag_mtu_exchanged); CREATE_FLAG(flag_volume_changed); CREATE_FLAG(flag_volume_mute_changed); @@ -35,7 +39,7 @@ static void cap_discovery_complete_cb(struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_csis_inst *csis_inst) { if (err != 0) { - FAIL("Failed to discover CAS: %d\n", err); + FAIL("Discover failed on %p: %d\n", (void *)conn, err); return; } @@ -47,12 +51,12 @@ static void cap_discovery_complete_cb(struct bt_conn *conn, int err, return; } - printk("Found CAS with CSIS %p\n", csis_inst); + printk("Found CAS on %p with CSIS %p\n", (void *)conn, csis_inst); } else { - printk("Found CAS\n"); + printk("Found CAS on %p\n", (void *)conn); } - SET_FLAG(flag_cas_discovered); + k_sem_give(&sem_cas_discovered); } #if defined(CONFIG_BT_VCP_VOL_CTLR) @@ -140,7 +144,7 @@ static void cap_vcp_discover_cb(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8 } printk("VCS for %p found with %u VOCS and %u AICS\n", vol_ctlr, vocs_count, aics_count); - SET_FLAG(flag_vcs_discovered); + k_sem_give(&sem_vcs_discovered); } static void cap_vcp_state_cb(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t volume, @@ -168,7 +172,7 @@ static void cap_micp_discover_cb(struct bt_micp_mic_ctlr *mic_ctlr, int err, uin } printk("MICS for %p found with %u AICS\n", mic_ctlr, aics_count); - SET_FLAG(flag_mics_discovered); + k_sem_give(&sem_mics_discovered); } static struct bt_micp_mic_ctlr_cb micp_cb = { @@ -185,8 +189,16 @@ static struct bt_gatt_cb gatt_callbacks = { .att_mtu_updated = att_mtu_updated, }; -static void init(void) +static void cap_disconnected_cb(struct bt_conn *conn, uint8_t reason) +{ + k_sem_give(&sem_disconnected); +} + +static void init(size_t acceptor_cnt) { + static struct bt_conn_cb conn_cb = { + .disconnected = cap_disconnected_cb, + }; int err; err = bt_enable(NULL); @@ -196,6 +208,7 @@ static void init(void) } bt_gatt_cb_register(&gatt_callbacks); + bt_conn_cb_register(&conn_cb); err = bt_cap_commander_register_cb(&cap_cb); if (err != 0) { @@ -214,6 +227,11 @@ static void init(void) FAIL("Failed to register MICP callbacks (err %d)\n", err); return; } + + k_sem_init(&sem_disconnected, 0, acceptor_cnt); + k_sem_init(&sem_cas_discovered, 0, acceptor_cnt); + k_sem_init(&sem_vcs_discovered, 0, acceptor_cnt); + k_sem_init(&sem_mics_discovered, 0, acceptor_cnt); } static void cap_device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, @@ -276,62 +294,117 @@ static void scan_and_connect(void) connected_conn_cnt++; } -static void disconnect_acl(struct bt_conn *conn) +static void disconnect_acl(size_t acceptor_cnt) { - int err; + k_sem_reset(&sem_disconnected); - err = bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); - if (err != 0) { - FAIL("Failed to disconnect (err %d)\n", err); - return; + for (size_t i = 0U; i < acceptor_cnt; i++) { + struct bt_conn *conn = connected_conns[i]; + int err; + + printk("Disconnecting %p\n", (void *)conn); + + err = bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); + if (err != 0) { + FAIL("Failed to disconnect %p (err %d)\n", (void *)conn, err); + return; + } + } + + for (size_t i = 0U; i < acceptor_cnt; i++) { + const int err = k_sem_take(&sem_disconnected, SEM_TIMEOUT); + + if (err != 0) { + const struct bt_conn *conn = connected_conns[i]; + + FAIL("Failed to take sem_disconnected for %p: %d", (void *)conn, err); + } } } -static void discover_cas(struct bt_conn *conn) +static void discover_cas(size_t acceptor_cnt) { - int err; + k_sem_reset(&sem_cas_discovered); - UNSET_FLAG(flag_cas_discovered); + /* Do parallel discovery */ + for (size_t i = 0U; i < acceptor_cnt; i++) { + struct bt_conn *conn = connected_conns[i]; + int err; - err = bt_cap_commander_discover(conn); - if (err != 0) { - printk("Failed to discover CAS: %d\n", err); - return; + printk("Discovering CAS on %p\n", (void *)conn); + + err = bt_cap_commander_discover(conn); + if (err != 0) { + FAIL("Failed to discover CAS on %p: %d\n", (void *)conn, err); + return; + } } - WAIT_FOR_FLAG(flag_cas_discovered); + for (size_t i = 0U; i < acceptor_cnt; i++) { + const int err = k_sem_take(&sem_cas_discovered, SEM_TIMEOUT); + + if (err != 0) { + const struct bt_conn *conn = connected_conns[i]; + + FAIL("Failed to take sem_cas_discovered for %p: %d", (void *)conn, err); + } + } } -static void discover_vcs(struct bt_conn *conn) +static void discover_vcs(size_t acceptor_cnt) { - struct bt_vcp_vol_ctlr *vol_ctlr; - int err; + k_sem_reset(&sem_vcs_discovered); - UNSET_FLAG(flag_vcs_discovered); + /* Do parallel discovery */ + for (size_t i = 0U; i < acceptor_cnt; i++) { + struct bt_conn *conn = connected_conns[i]; + struct bt_vcp_vol_ctlr *vol_ctlr; + int err; - err = bt_vcp_vol_ctlr_discover(conn, &vol_ctlr); - if (err != 0) { - FAIL("Failed to discover VCS: %d\n", err); - return; + printk("Discovering VCS on %p\n", (void *)conn); + + err = bt_vcp_vol_ctlr_discover(conn, &vol_ctlr); + if (err != 0) { + FAIL("Failed to discover VCS on %p: %d\n", err); + return; + } } - WAIT_FOR_FLAG(flag_vcs_discovered); + for (size_t i = 0U; i < acceptor_cnt; i++) { + const int err = k_sem_take(&sem_vcs_discovered, SEM_TIMEOUT); + + if (err != 0) { + const struct bt_conn *conn = connected_conns[i]; + + FAIL("Failed to take sem_vcs_discovered for %p: %d", (void *)conn, err); + } + } } -static void discover_mics(struct bt_conn *conn) +static void discover_mics(size_t acceptor_cnt) { - struct bt_micp_mic_ctlr *mic_ctlr; - int err; + k_sem_reset(&sem_mics_discovered); - UNSET_FLAG(flag_mics_discovered); + for (size_t i = 0U; i < acceptor_cnt; i++) { + struct bt_micp_mic_ctlr *mic_ctlr; + int err; - err = bt_micp_mic_ctlr_discover(conn, &mic_ctlr); - if (err != 0) { - FAIL("Failed to discover MICS: %d\n", err); - return; + err = bt_micp_mic_ctlr_discover(connected_conns[i], &mic_ctlr); + if (err != 0) { + FAIL("Failed to discover MICS: %d\n", err); + return; + } } - WAIT_FOR_FLAG(flag_mics_discovered); + for (size_t i = 0U; i < acceptor_cnt; i++) { + const int err = k_sem_take(&sem_mics_discovered, SEM_TIMEOUT); + + if (err != 0) { + const struct bt_conn *conn = connected_conns[i]; + + FAIL("Failed to take sem_mics_discovered for %p: %d", (void *)conn, err); + } + } } static void test_change_volume(void) @@ -477,29 +550,25 @@ static void test_change_microphone_gain(void) static void test_main_cap_commander_capture_and_render(void) { - init(); + const size_t acceptor_cnt = get_dev_cnt() - 1; /* Assume all other devices are acceptors + */ + init(acceptor_cnt); /* Connect to and do discovery on all CAP acceptors */ - for (size_t i = 0U; i < get_dev_cnt() - 1; i++) { + for (size_t i = 0U; i < acceptor_cnt; i++) { scan_and_connect(); WAIT_FOR_FLAG(flag_mtu_exchanged); - - /* TODO: We should use CSIP to find set members */ - discover_cas(connected_conns[i]); - discover_cas(connected_conns[i]); /* test that we can discover twice */ - - if (IS_ENABLED(CONFIG_BT_VCP_VOL_CTLR)) { - discover_vcs(connected_conns[i]); - } - - if (IS_ENABLED(CONFIG_BT_MICP_MIC_CTLR)) { - discover_mics(connected_conns[i]); - } } + /* TODO: We should use CSIP to find set members */ + discover_cas(acceptor_cnt); + discover_cas(acceptor_cnt); /* verify that we can discover twice */ + if (IS_ENABLED(CONFIG_BT_CSIP_SET_COORDINATOR)) { if (IS_ENABLED(CONFIG_BT_VCP_VOL_CTLR)) { + discover_vcs(acceptor_cnt); + test_change_volume(); test_change_volume_mute(true); @@ -511,6 +580,8 @@ static void test_main_cap_commander_capture_and_render(void) } if (IS_ENABLED(CONFIG_BT_MICP_MIC_CTLR)) { + discover_mics(acceptor_cnt); + test_change_microphone_mute(true); test_change_microphone_mute(false); @@ -521,10 +592,7 @@ static void test_main_cap_commander_capture_and_render(void) } /* Disconnect all CAP acceptors */ - for (size_t i = 0U; i < connected_conn_cnt; i++) { - disconnect_acl(connected_conns[i]); - } - connected_conn_cnt = 0U; + disconnect_acl(acceptor_cnt); PASS("CAP commander capture and rendering passed\n"); } From 724fc55cbda6174e64cd6f8e18c67b09dfb22475 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Thu, 25 Apr 2024 10:36:35 +0200 Subject: [PATCH 1896/2300] [nrf fromtree] Bluetooth: Host: Document bt_le_scan_update() This function is used in many places, but just by reading its name it is not obvious why it is needed. By adding some documentation it will hopefully become a bit more clear that this function is mainly used for auto connection establishment. Signed-off-by: Rubin Gerritsen (cherry picked from commit 0a19c18f8534937023946a5c252dfcd81d99c562) Signed-off-by: Rubin Gerritsen --- subsys/bluetooth/host/hci_core.h | 23 +++++++++++++++++++++++ subsys/bluetooth/host/scan.c | 5 +++++ 2 files changed, 28 insertions(+) diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index d037d0add9d..dc6b52c51c8 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -440,6 +440,29 @@ uint8_t bt_get_phy(uint8_t hci_phy); * @return CTE type (@ref bt_df_cte_type). */ int bt_get_df_cte_type(uint8_t hci_cte_type); + +/** Start or restart scanner if needed + * + * Examples of cases where it may be required to start/restart a scanner: + * - When the auto-connection establishement feature is used: + * - When the host sets a connection context for auto-connection establishment. + * - When a connection was established. + * The host may now be able to retry to automatically set up a connection. + * - When a connection was disconnected/lost. + * The host may now be able to retry to automatically set up a connection. + * - When the application stops explicit scanning. + * The host may now be able to retry to automatically set up a connection. + * - The application tries to connect to another device, but fails. + * The host may now be able to retry to automatically set up a connection. + * - When the application wants to connect to a device, but we need + * to fallback to host privacy. + * - When the application wants to establish a periodic sync to a device + * and the application has not already started scanning. + * + * @param fast_scan Use fast scan parameters or slow scan parameters + * + * @return 0 in case of success, or a negative error code on failure. + */ int bt_le_scan_update(bool fast_scan); int bt_le_create_conn(const struct bt_conn *conn); diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index ceb4fd2428e..e3421c387de 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -318,6 +318,9 @@ static int start_passive_scan(bool fast_scan) int bt_le_scan_update(bool fast_scan) { if (atomic_test_bit(bt_dev.flags, BT_DEV_EXPLICIT_SCAN)) { + /* The application has already explicitly started scanning. + * We should keep the scanner running to avoid changing scan parameters. + */ return 0; } @@ -348,12 +351,14 @@ int bt_le_scan_update(bool fast_scan) bt_conn_unref(conn); + /* Start/Restart the scanner */ return start_passive_scan(fast_scan); } } #if defined(CONFIG_BT_PER_ADV_SYNC) if (get_pending_per_adv_sync()) { + /* Start/Restart the scanner. */ return start_passive_scan(fast_scan); } #endif From 7e216169f12643f909d19f5cc543e1f7c1c94705 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Mon, 29 Apr 2024 12:02:35 +0200 Subject: [PATCH 1897/2300] [nrf fromtree] Bluetooth: Host: Fix auto-connect/sync establishment on Coded PHY As documented in bt_le_scan_update(), the host may start scanning automatically for various reasons. Until now scanning was only done on 1M PHY, making it impossible to use auto-connect/sync establishment if the advertiser was using Coded PHY as its primary PHY. Auto-connection would never work. Sync establishment would work if the scanner was started by the application. This commit fixes this by instructing the controller to scan on both 1M and Coded PHY if the controller supports Coded PHY. The application may see increased power consumption as a result of this change as the controller may now spend 2*scan_window listening for advertising packets. Signed-off-by: Rubin Gerritsen (cherry picked from commit 44199f3a4865c03c349b4470d55f9bf9d04fe5a3) Signed-off-by: Rubin Gerritsen --- subsys/bluetooth/host/scan.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index e3421c387de..4ee6b46307f 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -289,7 +289,7 @@ static int start_le_scan_legacy(uint8_t scan_type, uint16_t interval, uint16_t w return 0; } -static int start_passive_scan(bool fast_scan) +static int start_host_initiated_scan(bool fast_scan) { uint16_t interval, window; @@ -303,13 +303,19 @@ static int start_passive_scan(bool fast_scan) if (IS_ENABLED(CONFIG_BT_EXT_ADV) && BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features)) { - struct bt_hci_ext_scan_phy scan; + struct bt_hci_ext_scan_phy scan_phy_params; - scan.type = BT_HCI_LE_SCAN_PASSIVE; - scan.interval = sys_cpu_to_le16(interval); - scan.window = sys_cpu_to_le16(window); + scan_phy_params.type = BT_HCI_LE_SCAN_PASSIVE; + scan_phy_params.interval = sys_cpu_to_le16(interval); + scan_phy_params.window = sys_cpu_to_le16(window); + + /* Scan on 1M + Coded if the controller supports it*/ + if (BT_FEAT_LE_PHY_CODED(bt_dev.le.features)) { + return start_le_scan_ext(&scan_phy_params, &scan_phy_params, 0); + } else { + return start_le_scan_ext(&scan_phy_params, NULL, 0); + } - return start_le_scan_ext(&scan, NULL, 0); } return start_le_scan_legacy(BT_HCI_LE_SCAN_PASSIVE, interval, window); @@ -352,14 +358,14 @@ int bt_le_scan_update(bool fast_scan) bt_conn_unref(conn); /* Start/Restart the scanner */ - return start_passive_scan(fast_scan); + return start_host_initiated_scan(fast_scan); } } #if defined(CONFIG_BT_PER_ADV_SYNC) if (get_pending_per_adv_sync()) { /* Start/Restart the scanner. */ - return start_passive_scan(fast_scan); + return start_host_initiated_scan(fast_scan); } #endif From c7b46f9d1f79450bdeea5423f9577f7c262a496c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Tue, 23 Apr 2024 16:41:23 +0200 Subject: [PATCH 1898/2300] [nrf fromtree] drivers: nrf: rram: Support TF-M MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From here: https://github.com/zephyrproject-rtos/zephyr/pull/71825 Non-secure images cannot reference NRF_RRAMC_NS because NRF_RRAMC_NS does not exist. TF-M will configure RRAMC according to these Kconfig's before booting the non-secure image so we ifdef out this code. Also, rewrite the implementation of commit_changes to also work when the commit task is not available. Signed-off-by: Sebastian Bøe (cherry picked from commit 99f94295eb4894cdbc09dc1d9f43ca4d2d6558dd) --- drivers/flash/soc_flash_nrf_rram.c | 55 ++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 714e4dca3b6..b8ab3afa8fe 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -17,6 +17,26 @@ #include +/* Note that it is supported to compile this driver for both secure + * and non-secure images, but non-secure images cannot call + * nrf_rramc_config_set because NRF_RRAMC_NS does not exist. + * + * Instead, when TF-M boots, it will configure RRAMC with this static + * configuration: + * + * nrf_rramc_config_t config = { + * .mode_write = true, + * .write_buff_size = WRITE_BUFFER_SIZE + * }; + * + * nrf_rramc_ready_next_timeout_t params = { + * .value = CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE, + * .enable = true, + * }; + * + * For more details see NCSDK-26982. + */ + LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define RRAM DT_INST(0, soc_nv_flash) @@ -85,19 +105,43 @@ static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start } #if WRITE_BUFFER_ENABLE -static void commit_changes(size_t len) +static void commit_changes(off_t addr, size_t len) { +#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) if (nrf_rramc_empty_buffer_check(NRF_RRAMC)) { /* The internal write-buffer has been committed to RRAM and is now empty. */ return; } +#endif if ((len % (WRITE_BUFFER_MAX_SIZE)) == 0) { /* Our last operation was buffer size-aligned, so we're done. */ return; } +#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) + ARG_UNUSED(addr); + nrf_rramc_task_trigger(NRF_RRAMC, NRF_RRAMC_TASK_COMMIT_WRITEBUF); +#else + /* + * When the commit task is unavailable we need to get creative to + * ensure this is committed. + * + * According to the PS the buffer is committed when "There is a + * read operation from a 128-bit word line in the buffer that has + * already been written to". + * + * So we read the last byte that has been written to trigger this + * commit. + * + * If this approach proves to be problematic, e.g. for writes to + * write-only memory, then one would have to rely on + * READYNEXTTIMEOUT to eventually commit the write. + */ + volatile uint8_t dummy_read = *(volatile uint8_t *)(addr + len - 1); + ARG_UNUSED(dummy_read); +#endif barrier_dmem_fence_full(); } @@ -105,9 +149,11 @@ static void commit_changes(size_t len) static void rram_write(off_t addr, const void *data, size_t len) { +#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) nrf_rramc_config_t config = {.mode_write = true, .write_buff_size = WRITE_BUFFER_SIZE}; nrf_rramc_config_set(NRF_RRAMC, &config); +#endif if (data) { memcpy((void *)addr, data, len); @@ -118,11 +164,13 @@ static void rram_write(off_t addr, const void *data, size_t len) barrier_dmem_fence_full(); /* Barrier following our last write. */ #if WRITE_BUFFER_ENABLE - commit_changes(len); + commit_changes(addr, len); #endif +#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) config.mode_write = false; nrf_rramc_config_set(NRF_RRAMC, &config); +#endif } #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE @@ -298,11 +346,12 @@ static int nrf_rram_init(const struct device *dev) nrf_flash_sync_init(); #endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ -#if CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE > 0 +#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE > 0 nrf_rramc_ready_next_timeout_t params = { .value = CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE, .enable = true, }; + nrf_rramc_ready_next_timeout_set(NRF_RRAMC, ¶ms); #endif From 4db075fed24f7cc2b88de82a63149cea5b1253b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 10 May 2024 12:59:21 +0200 Subject: [PATCH 1899/2300] [nrf fromtree] samples: sensor: qdec: Run sample on nrf54h20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay file that enables sample on nrf54h20 Application core. Signed-off-by: Sebastian Głąb (cherry picked from commit f84e082f73511789eab69577521a16040b8e1fce) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 43 +++++++++++++++++++ samples/sensor/qdec/sample.yaml | 2 + 2 files changed, 45 insertions(+) create mode 100644 samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..748e06aef83 --- /dev/null +++ b/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,43 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + qdec0 = &qdec130; + qenca = &phase_a; + qencb = &phase_b; + }; + + encoder-emulate { + compatible = "gpio-leds"; + phase_a: phase_a { + gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + }; + phase_b: phase_b { + gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pinctrl { + qdec_pinctrl: qdec_pinctrl { + group1 { + psels = , + ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&qdec130 { + status = "okay"; + pinctrl-0 = <&qdec_pinctrl>; + pinctrl-names = "default"; + steps = <120>; + led-pre = <500>; +}; diff --git a/samples/sensor/qdec/sample.yaml b/samples/sensor/qdec/sample.yaml index 8982dfccd33..52e19e8bb18 100644 --- a/samples/sensor/qdec/sample.yaml +++ b/samples/sensor/qdec/sample.yaml @@ -22,10 +22,12 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp harness_config: fixture: gpio_loopback type: multi_line From 3708cb038bc544252f2674af1b3f9824dcb57959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 10 May 2024 08:24:05 +0200 Subject: [PATCH 1900/2300] [nrf fromtree] drivers: wdt: nrf: Add WDT instances that exist in nrf54h20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add WDT instances no. 010, 011, 131, 132. Signed-off-by: Sebastian Głąb (cherry picked from commit 2f17c46fb11a17482c0c1cb6d5f59b6ec825f6ce) --- .../nrf54h20dk_nrf54h20_cpuapp.yaml | 1 + .../nrf54h20dk_nrf54h20_cpurad.yaml | 1 + drivers/watchdog/Kconfig.nrfx | 4 +++ drivers/watchdog/wdt_nrfx.c | 16 +++++++++++ dts/arm/nordic/nrf54h20_cpuapp.dtsi | 2 ++ dts/arm/nordic/nrf54h20_cpurad.dtsi | 2 ++ dts/common/nordic/nrf54h20.dtsi | 28 +++++++++++++++++++ modules/hal_nordic/nrfx/Kconfig | 10 +++++++ modules/hal_nordic/nrfx/nrfx_config.h | 6 ++++ soc/nordic/common/Kconfig.peripherals | 6 ++++ soc/nordic/validate_base_addresses.c | 4 +++ 11 files changed, 80 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml index 6ecde2cfdb1..107aa0be67f 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml @@ -14,3 +14,4 @@ flash: 512 supported: - gpio - pwm + - watchdog diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index b199f65385f..32375faf481 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -14,3 +14,4 @@ flash: 256 supported: - gpio - pwm + - watchdog diff --git a/drivers/watchdog/Kconfig.nrfx b/drivers/watchdog/Kconfig.nrfx index 2967fe86489..61f42d8ff31 100644 --- a/drivers/watchdog/Kconfig.nrfx +++ b/drivers/watchdog/Kconfig.nrfx @@ -11,7 +11,11 @@ config WDT_NRFX select NRFX_WDT1 if HAS_HW_NRF_WDT1 select NRFX_WDT30 if HAS_HW_NRF_WDT30 select NRFX_WDT31 if HAS_HW_NRF_WDT31 + select NRFX_WDT010 if HAS_HW_NRF_WDT010 + select NRFX_WDT011 if HAS_HW_NRF_WDT011 select NRFX_WDT130 if HAS_HW_NRF_WDT130 + select NRFX_WDT131 if HAS_HW_NRF_WDT131 + select NRFX_WDT132 if HAS_HW_NRF_WDT132 help Enable support for nrfx WDT driver for nRF MCU series. diff --git a/drivers/watchdog/wdt_nrfx.c b/drivers/watchdog/wdt_nrfx.c index 57b4dba828c..706c2621bbb 100644 --- a/drivers/watchdog/wdt_nrfx.c +++ b/drivers/watchdog/wdt_nrfx.c @@ -220,6 +220,22 @@ WDT_NRFX_WDT_DEVICE(30); WDT_NRFX_WDT_DEVICE(31); #endif +#ifdef CONFIG_HAS_HW_NRF_WDT010 +WDT_NRFX_WDT_DEVICE(010); +#endif + +#ifdef CONFIG_HAS_HW_NRF_WDT011 +WDT_NRFX_WDT_DEVICE(011); +#endif + #ifdef CONFIG_HAS_HW_NRF_WDT130 WDT_NRFX_WDT_DEVICE(130); #endif + +#ifdef CONFIG_HAS_HW_NRF_WDT131 +WDT_NRFX_WDT_DEVICE(131); +#endif + +#ifdef CONFIG_HAS_HW_NRF_WDT132 +WDT_NRFX_WDT_DEVICE(132); +#endif diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi index 9d011019f4a..1cfa3dddb55 100644 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -11,6 +11,8 @@ systick: &cpuapp_systick {}; nvic: &cpuapp_nvic {}; cpuppr_vevif: &cpuppr_vevif_remote {}; cpusys_vevif: &cpusys_vevif_remote {}; +wdt010: &cpuapp_wdt010 {}; +wdt011: &cpuapp_wdt011 {}; /delete-node/ &cpuppr; /delete-node/ &cpurad; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 2a62845dc89..e4a7469dac5 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -11,6 +11,8 @@ systick: &cpurad_systick {}; nvic: &cpurad_nvic {}; cpuppr_vevif: &cpuppr_vevif_remote {}; cpusys_vevif: &cpusys_vevif_remote {}; +wdt010: &cpurad_wdt010 {}; +wdt011: &cpurad_wdt011 {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index faaa9e8e1aa..cbc9197b5d5 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -169,6 +169,20 @@ <65 NRF_DEFAULT_IRQ_PRIORITY>; }; + cpuapp_wdt010: watchdog@14000 { + compatible = "nordic,nrf-wdt"; + reg = <0x14000 0x1000>; + status = "disabled"; + interrupts = <20 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + cpuapp_wdt011: watchdog@15000 { + compatible = "nordic,nrf-wdt"; + reg = <0x15000 0x1000>; + status = "disabled"; + interrupts = <21 NRF_DEFAULT_IRQ_PRIORITY>; + }; + cpuapp_resetinfo: resetinfo@1e000 { compatible = "nordic,nrf-resetinfo"; reg = <0x1e000 0x1000>; @@ -193,6 +207,20 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; + cpurad_wdt010: watchdog@13000 { + compatible = "nordic,nrf-wdt"; + reg = <0x13000 0x1000>; + status = "disabled"; + interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + cpurad_wdt011: watchdog@14000 { + compatible = "nordic,nrf-wdt"; + reg = <0x14000 0x1000>; + status = "disabled"; + interrupts = <20 NRF_DEFAULT_IRQ_PRIORITY>; + }; + cpurad_resetinfo: resetinfo@1e000 { compatible = "nordic,nrf-resetinfo"; reg = <0x1e000 0x1000>; diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 32386d54274..37059183891 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -980,6 +980,16 @@ config NRFX_WDT31 depends on $(dt_nodelabel_has_compat,wdt31,$(DT_COMPAT_NORDIC_NRF_WDT)) select NRFX_WDT +config NRFX_WDT010 + bool "WDT010 driver instance" + depends on $(dt_nodelabel_has_compat,wdt010,$(DT_COMPAT_NORDIC_NRF_WDT)) + select NRFX_WDT + +config NRFX_WDT011 + bool "WDT011 driver instance" + depends on $(dt_nodelabel_has_compat,wdt011,$(DT_COMPAT_NORDIC_NRF_WDT)) + select NRFX_WDT + config NRFX_WDT130 bool "WDT130 driver instance" depends on $(dt_nodelabel_has_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index e7120b54ab7..6072f3634f4 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -824,6 +824,12 @@ #ifdef CONFIG_NRFX_WDT31 #define NRFX_WDT31_ENABLED 1 #endif +#ifdef CONFIG_NRFX_WDT010 +#define NRFX_WDT010_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_WDT011 +#define NRFX_WDT011_ENABLED 1 +#endif #ifdef CONFIG_NRFX_WDT130 #define NRFX_WDT130_ENABLED 1 #endif diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index f0adc82d44a..f9b01417677 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -644,6 +644,12 @@ config HAS_HW_NRF_WDT30 config HAS_HW_NRF_WDT31 def_bool $(dt_nodelabel_enabled_with_compat,wdt31,$(DT_COMPAT_NORDIC_NRF_WDT)) +config HAS_HW_NRF_WDT010 + def_bool $(dt_nodelabel_enabled_with_compat,wdt010,$(DT_COMPAT_NORDIC_NRF_WDT)) + +config HAS_HW_NRF_WDT011 + def_bool $(dt_nodelabel_enabled_with_compat,wdt011,$(DT_COMPAT_NORDIC_NRF_WDT)) + config HAS_HW_NRF_WDT130 def_bool $(dt_nodelabel_enabled_with_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 5c9f31c9c1f..6874fe9c62e 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -337,6 +337,10 @@ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); CHECK_DT_REG(wdt30, NRF_WDT30); CHECK_DT_REG(wdt31, NRF_WDT31); +CHECK_DT_REG(cpuapp_wdt010, NRF_APPLICATION_WDT010); +CHECK_DT_REG(cpuapp_wdt011, NRF_APPLICATION_WDT011); +CHECK_DT_REG(cpurad_wdt010, NRF_RADIOCORE_WDT010); +CHECK_DT_REG(cpurad_wdt011, NRF_RADIOCORE_WDT011); CHECK_DT_REG(wdt131, NRF_WDT131); CHECK_DT_REG(wdt132, NRF_WDT132); From ed65de8f6cc645575a47f07d4833338b63c1c5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 10 May 2024 08:27:24 +0200 Subject: [PATCH 1901/2300] [nrf fromtree] tests: drivers: watchdog: wdt_error_cases: Run test on nRF54H20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overaly files for Application and Radio cores. Configure test according to watchdog features available on nRF54H20. Signed-off-by: Sebastian Głąb (cherry picked from commit 48ee6fcae0571681ec5f892616e90679eae8c104) --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 21 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 21 +++++++++++++++++++ .../watchdog/wdt_error_cases/src/main.c | 2 +- .../watchdog/wdt_error_cases/testcase.yaml | 2 ++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..d540137dadb --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt010 { + status = "okay"; +}; + +&wdt011 { + status = "disabled"; +}; + +&wdt131 { + status = "disabled"; +}; + +&wdt132 { + status = "disabled"; +}; diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 00000000000..7793fed2b8e --- /dev/null +++ b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt010 { + status = "disabled"; +}; + +&wdt011 { + status = "okay"; +}; + +&wdt131 { + status = "disabled"; +}; + +&wdt132 { + status = "disabled"; +}; diff --git a/tests/drivers/watchdog/wdt_error_cases/src/main.c b/tests/drivers/watchdog/wdt_error_cases/src/main.c index fc453ba3b32..65569ad30a4 100644 --- a/tests/drivers/watchdog/wdt_error_cases/src/main.c +++ b/tests/drivers/watchdog/wdt_error_cases/src/main.c @@ -42,7 +42,7 @@ #define DEFAULT_WINDOW_MIN (0U) /* Align tests to the specific target: */ -#if defined(CONFIG_SOC_NRF54L15) +#if defined(CONFIG_SOC_NRF54L15) || defined(CONFIG_SOC_NRF54H20) #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/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml index c408d2f8f1d..4fdbfaa1a4c 100644 --- a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml +++ b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml @@ -9,5 +9,7 @@ tests: drivers.watchdog.wdt_error_cases: platform_allow: - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad integration_platforms: - nrf54l15pdk/nrf54l15/cpuapp From 52850014d63b074b8f73c3bf5869a45cbd07e7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 10 May 2024 08:29:27 +0200 Subject: [PATCH 1902/2300] [nrf fromtree] boards: nordic: nrf54h20dk: Enable SPI driver tests in Twister MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add SPI to list of supported periperals by nrf54h20 Application and Radio core. This is needed to run following tests in Twister Signed-off-by: Sebastian Głąb (cherry picked from commit bb30a5d0846efdc259257b853b9fc5dd9d96b958) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml index 107aa0be67f..198f4db403b 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml @@ -14,4 +14,5 @@ flash: 512 supported: - gpio - pwm + - spi - watchdog diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index 32375faf481..68d169331ef 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -14,4 +14,5 @@ flash: 256 supported: - gpio - pwm + - spi - watchdog From 7f128a1027b50b69f5a69cfd8f01c093302f1a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 10 May 2024 16:21:14 +0200 Subject: [PATCH 1903/2300] [nrf fromlist] boards: nordic: nrf54h20dk: Disable watchdog tests on Radio core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is enough to test watchdog driver on the application core. Otherwise, at least three samples/tests fail due to missing overlay file for nrf54h20dk/nrf54h20/cpurad. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72566 Signed-off-by: Sebastian Głąb --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index 68d169331ef..53bbff4a460 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -15,4 +15,3 @@ supported: - gpio - pwm - spi - - watchdog From 7af1810cb391b630f064f4cd8f277981a13e9221 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Wed, 24 Apr 2024 13:12:03 +0200 Subject: [PATCH 1904/2300] [nrf fromtree] tests: drivers: Add more test cases for the i2c driver in controller mode Extend coverage for the i2c master mode driver This test suite uses external sensor BME688 Signed-off-by: Bartosz Miller (cherry picked from commit d8bffffda0417414396dd052da6ff88ff72a3a78) --- tests/drivers/i2c/i2c_bme688/CMakeLists.txt | 9 + tests/drivers/i2c/i2c_bme688/README.txt | 6 + tests/drivers/i2c/i2c_bme688/prj.conf | 2 + tests/drivers/i2c/i2c_bme688/src/main.c | 286 ++++++++++++++++++++ tests/drivers/i2c/i2c_bme688/src/sensor.c | 105 +++++++ tests/drivers/i2c/i2c_bme688/src/sensor.h | 163 +++++++++++ tests/drivers/i2c/i2c_bme688/testcase.yaml | 6 + 7 files changed, 577 insertions(+) create mode 100644 tests/drivers/i2c/i2c_bme688/CMakeLists.txt create mode 100644 tests/drivers/i2c/i2c_bme688/README.txt create mode 100644 tests/drivers/i2c/i2c_bme688/prj.conf create mode 100644 tests/drivers/i2c/i2c_bme688/src/main.c create mode 100644 tests/drivers/i2c/i2c_bme688/src/sensor.c create mode 100644 tests/drivers/i2c/i2c_bme688/src/sensor.h create mode 100644 tests/drivers/i2c/i2c_bme688/testcase.yaml diff --git a/tests/drivers/i2c/i2c_bme688/CMakeLists.txt b/tests/drivers/i2c/i2c_bme688/CMakeLists.txt new file mode 100644 index 00000000000..0e4b8e8a8b6 --- /dev/null +++ b/tests/drivers/i2c/i2c_bme688/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(i2c_bme688) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/i2c/i2c_bme688/README.txt b/tests/drivers/i2c/i2c_bme688/README.txt new file mode 100644 index 00000000000..b0ac29c8a97 --- /dev/null +++ b/tests/drivers/i2c/i2c_bme688/README.txt @@ -0,0 +1,6 @@ +I2C bus controller to BME688 sensor test +######################################## + +This test verifies I2C target driver API methods +with external sensors device - Bosch BME688. +I2C speed is set to standard. diff --git a/tests/drivers/i2c/i2c_bme688/prj.conf b/tests/drivers/i2c/i2c_bme688/prj.conf new file mode 100644 index 00000000000..4b19609ecfb --- /dev/null +++ b/tests/drivers/i2c/i2c_bme688/prj.conf @@ -0,0 +1,2 @@ +CONFIG_I2C=y +CONFIG_ZTEST=y diff --git a/tests/drivers/i2c/i2c_bme688/src/main.c b/tests/drivers/i2c/i2c_bme688/src/main.c new file mode 100644 index 00000000000..7041e579c13 --- /dev/null +++ b/tests/drivers/i2c/i2c_bme688/src/main.c @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include "sensor.h" + +#define SENSOR_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(bosch_bme680) +#define I2C_TEST_NODE DT_PARENT(SENSOR_NODE) +#define DEVICE_ADDRESS (uint8_t)DT_REG_ADDR(SENSOR_NODE) + +static const struct device *const i2c_device = DEVICE_DT_GET(I2C_TEST_NODE); +static struct calibration_coeffs cal_coeffs; +static int32_t t_fine; + +/* Read data from the senors register */ +static uint8_t read_sensor_register(uint8_t register_address) +{ + int err; + uint8_t response = 0; + + err = i2c_reg_read_byte(i2c_device, DEVICE_ADDRESS, register_address, &response); + zassert_equal(err, 0, "i2c_read(%x)' failed with error: %d\n", register_address, err); + TC_PRINT("I2C read reg, addr: 0x%x, val: 0x%x\n", register_address, response); + return response; +} + +/* Burst read data from the sensor registers */ +static void burst_read_sensor_registers(uint8_t starting_register_address, uint8_t number_of_bytes, + uint8_t *data_buffer) +{ + int err; + + zassert_true(number_of_bytes <= MAX_BURST_READ_SIZE, + "Too many bytes to read %d, max burst read size is set to: %d", + number_of_bytes, MAX_BURST_READ_SIZE); + err = i2c_burst_read(i2c_device, DEVICE_ADDRESS, starting_register_address, data_buffer, + number_of_bytes); + zassert_equal(err, 0, "i2c_burst_read(%x, %x)' failed with error: %d\n", + starting_register_address, number_of_bytes, err); + TC_PRINT("I2C burst read, start addr: 0x%x, number of bytes: %d\n", + starting_register_address, number_of_bytes); +} + +/* Write sensor register */ +static void write_sensor_register(uint8_t register_address, int8_t value) +{ + int err; + + err = i2c_reg_write_byte(i2c_device, DEVICE_ADDRESS, register_address, value); + zassert_equal(err, 0, "i2c_reg_write_byte(%x, %x)' failed with error: %d\n", + register_address, value, err); + TC_PRINT("I2C reg write, addr: 0x%x, val: 0x%x\n", register_address, value); +} + +/* Set IIR filter for the temperature and pressure measurements */ +static void set_sensor_iir_filter(void) +{ + uint8_t response = 0; + + TC_PRINT("Set IIR filter\n"); + response = read_sensor_register(CONF_REGISTER_ADDRESS); + response &= ~IIR_FILER_ORDER_BIT_MASK; + response |= IIR_FILER_COEFF_3 << IIR_FILER_ORDER_BIT_SHIFT; + write_sensor_register(CONF_REGISTER_ADDRESS, response); + read_sensor_register(CONF_REGISTER_ADDRESS); +} + +/* Read calibration coefficients for temperature, humifity and pressure */ +static void read_calibration_coeffs(struct calibration_coeffs *coeffs) +{ + uint8_t register_data[MAX_BURST_READ_SIZE] = { 0 }; + + /* Humidity */ + TC_PRINT("Reading humidity calibration coefficients\n"); + burst_read_sensor_registers(HUMI_PAR_REGISTERS_START_ADDRESS, HUMI_PAR_REGISTERS_COUNT, + register_data); + coeffs->par_h1 = (uint16_t)(((uint16_t)register_data[HUMI_PAR_H1_MSB_BUF_POSITION] << 4) | + (register_data[HUMI_PAR_H1_LSB_BUF_POSITION] & + HUMI_PAR_H1_LSB_BIT_MASK)); + coeffs->par_h2 = (uint16_t)(((uint16_t)register_data[HUMI_PAR_H2_MSB_BUF_POSITION] << 4) | + ((register_data[HUMI_PAR_H2_LSB_BUF_POSITION]) >> 4)); + + coeffs->par_h3 = (uint8_t)register_data[HUMI_PAR_H3_BUF_POSITION]; + coeffs->par_h4 = (uint8_t)register_data[HUMI_PAR_H4_BUF_POSITION]; + coeffs->par_h5 = (uint8_t)register_data[HUMI_PAR_H5_BUF_POSITION]; + coeffs->par_h6 = (uint8_t)register_data[HUMI_PAR_H6_BUF_POSITION]; + coeffs->par_h7 = (uint8_t)register_data[HUMI_PAR_H7_BUF_POSITION]; + + /* Temperature */ + TC_PRINT("Reading temperature calibration coefficients\n"); + burst_read_sensor_registers(TEMP_PAR_T1_REGISTER_ADDRESS_LSB, 2, register_data); + coeffs->par_t1 = (uint16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); + burst_read_sensor_registers(TEMP_PAR_T2_REGISTER_ADDRESS_LSB, 2, register_data); + coeffs->par_t2 = (uint16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); + coeffs->par_t3 = (uint8_t)read_sensor_register(TEMP_PAR_T3_REGISTER_ADDRESS); + + /* Pressure */ + TC_PRINT("Reading pressure calibration coefficients\n"); + burst_read_sensor_registers(PRES_PAR_P1_REGISTER_ADDRESS_LSB, 4, register_data); + coeffs->par_p1 = (uint16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); + coeffs->par_p2 = (int16_t)(((uint16_t)register_data[3] << 8) | (uint16_t)register_data[2]); + coeffs->par_p3 = (int8_t)read_sensor_register(PRES_PAR_P3_REGISTER_ADDRESS); + burst_read_sensor_registers(PRES_PAR_P4_REGISTER_ADDRESS_LSB, 4, register_data); + coeffs->par_p4 = (int16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); + coeffs->par_p5 = (int16_t)(((uint16_t)register_data[3] << 8) | (uint16_t)register_data[2]); + coeffs->par_p6 = (int8_t)read_sensor_register(PRES_PAR_P6_REGISTER_ADDRESS); + coeffs->par_p7 = (int8_t)read_sensor_register(PRES_PAR_P7_REGISTER_ADDRESS); + burst_read_sensor_registers(PRES_PAR_P8_REGISTER_ADDRESS_LSB, 4, register_data); + coeffs->par_p8 = (int16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); + coeffs->par_p9 = (int16_t)(((uint16_t)register_data[3] << 8) | (uint16_t)register_data[2]); + coeffs->par_p10 = read_sensor_register(PRES_PAR_P10_REGISTER_ADDRESS); +} + +/* Configure temperature, pressure and humidity measurements */ +static void configure_measurements(void) +{ + unsigned char response = 0; + + TC_PRINT("Configure measurements\n"); + + /* Humidity */ + response = read_sensor_register(CTRL_HUM_REGISTER_ADDRESS); + response &= ~HUMIDITY_OVERSAMPLING_BIT_MSK; + response |= HUMIDITY_OVERSAMPLING_1X << HUMIDITY_OVERSAMPLING_BIT_SHIFT; + write_sensor_register(CTRL_HUM_REGISTER_ADDRESS, response); + + /* Temperature*/ + response = read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); + response &= ~TEMP_OVERSAMPLING_BIT_MSK; + response |= TEMPERATURE_OVERSAMPLING_2X << TEMP_OVERSAMPLING_BIT_SHIFT; + + write_sensor_register(CTRL_MEAS_REGISTER_ADDRESS, response); + + /* Pressure */ + response = read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); + response &= ~PRES_OVERSAMPLING_BIT_MSK; + response |= PRESSURE_OVERSAMPLING_16X << PRES_OVERSAMPLING_BIT_SHIFT; + + write_sensor_register(CTRL_MEAS_REGISTER_ADDRESS, response); + read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); + set_sensor_iir_filter(); +} + +/* Set the sensor operation mode */ +static void set_sensor_mode(uint8_t sensor_mode) +{ + unsigned char response = 0; + + TC_PRINT("Set sensor mode to: 0x%x\n", sensor_mode); + + response = read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); + response &= ~CTRL_MEAS_MODE_BIT_MSK; + response |= sensor_mode << CTRL_MEAS_MODE_BIT_SHIFT; + write_sensor_register(CTRL_MEAS_REGISTER_ADDRESS, response); + read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); +} + +/* Read the raw ADC temperature measurement result */ +static uint32_t read_adc_temperature(void) +{ + uint32_t adc_temperature = 0; + + TC_PRINT("Reading ADC temperature\n"); + adc_temperature = (uint32_t)(((uint32_t)read_sensor_register(TEMP_ADC_DATA_MSB_0) << 12) | + ((uint32_t)read_sensor_register(TEMP_ADC_DATA_LSB_0) << 4) | + ((uint32_t)read_sensor_register(TEMP_ADC_DATA_XLSB_0) >> 4)); + + return adc_temperature; +} + +/* Read the raw ADC pressure measurement result */ +static uint32_t read_adc_pressure(void) +{ + uint32_t pres_adc = 0; + + TC_PRINT("Reading ADC pressure\n"); + pres_adc = (uint32_t)(((uint32_t)read_sensor_register(PRES_ADC_DATA_MSB_0) << 12) | + ((uint32_t)read_sensor_register(PRES_ADC_DATA_LSB_0) << 4) | + ((uint32_t)read_sensor_register(PRES_ADC_DATA_XLSB_0) >> 4)); + + return pres_adc; +} + +/* Read the raw ADC humidity measurement result */ +static uint16_t read_adc_humidity(void) +{ + uint16_t hum_adc = 0; + + TC_PRINT("Reading ADC humidity\n"); + hum_adc = (uint16_t)(((uint16_t)read_sensor_register(HUM_ADC_DATA_MSB_0) << 8) | + (uint16_t)read_sensor_register(HUM_ADC_DATA_LSB_0)); + + return hum_adc; +} + +ZTEST(i2c_controller_to_sensor, test_i2c_basic_memory_read) +{ + int err; + uint8_t entire_sensor_memory[SENSOR_MEMORY_SIZE_IN_BYTES] = { 0 }; + + TC_PRINT("Device address 0x%x\n", DEVICE_ADDRESS); + + err = i2c_read(i2c_device, entire_sensor_memory, SENSOR_MEMORY_SIZE_IN_BYTES, + DEVICE_ADDRESS); + zassert_equal(err, 0, "i2c_read' failed with error: %d\n", err); +} + +ZTEST(i2c_controller_to_sensor, test_i2c_controlled_sensor_operation) +{ + int err; + uint8_t response = 0; + int16_t temperature = 0; + uint32_t pressure = 0; + uint32_t humidity = 0; + uint32_t i2c_config = I2C_SPEED_SET(I2C_SPEED_STANDARD) | I2C_MODE_CONTROLLER; + uint8_t measurements_left = MEASUREMENT_CYCLES + 1; + + TC_PRINT("Device address 0x%x\n", DEVICE_ADDRESS); + + err = i2c_configure(i2c_device, i2c_config); + zassert_equal(err, 0, "i2c_configure' failed with error: %d\n", err); + + response = read_sensor_register(CHIP_ID_REGISTER_ADDRESS); + TC_PRINT("Chip_Id: %d\n", response); + + response = read_sensor_register(VARIANT_ID_REGISTER_ADDRESS); + TC_PRINT("Variant_Id: %d\n", response); + + write_sensor_register(RESET_REGISTER_ADDRESS, RESET_DEVICE); + k_sleep(K_MSEC(SLEEP_TIME_MS)); + + read_calibration_coeffs(&cal_coeffs); + + configure_measurements(); + set_sensor_mode(FORCED_MODE); + + while (measurements_left) { + response = read_sensor_register(MEAS_STATUS_0_REG_ADDRESS); + TC_PRINT("Meas status 0, meas in progress: %d, new data: %d\n", + response & MEASUREMENT_IN_PROGRESS_BIT_MASK, + response & MEASUREMENT_NEW_DATA_BIT_MASK); + if (response & MEASUREMENT_NEW_DATA_BIT_MASK) { + temperature = + calculate_temperature(read_adc_temperature(), &t_fine, &cal_coeffs); + pressure = calculate_pressure(read_adc_pressure(), t_fine, &cal_coeffs); + humidity = calculate_humidity(read_adc_humidity(), t_fine, &cal_coeffs); + TC_PRINT("Temperature: %d.%d C deg\n", temperature / 100, + temperature % 100); + TC_PRINT("Pressure: %d hPa\n", pressure / 100); + TC_PRINT("Humidity: %d %%\n", humidity / 1000); + set_sensor_mode(FORCED_MODE); + + /* Check if the results are within reasonable ranges + * for laboratory room usage + * This is asserted to catch values + * that may be results of an erroneous + * bus operation (corrupted read or write) + */ + zassert_true( + (temperature / 100 >= 5) && (temperature / 100 <= 55), + "Temperature is outside of the allowed range for labroatory use"); + zassert_true((pressure / 100 >= 700) && (pressure / 100 <= 1300), + "Pressure is outside of the allowed range for labroatory use"); + zassert_true((humidity / 1000 >= 10) && (humidity / 1000 <= 90), + "Humidity is outside of the allowed range for labroatory use"); + measurements_left--; + } + k_sleep(K_MSEC(SLEEP_TIME_MS)); + } +} + +/* + * Test setup + */ +void *test_setup(void) +{ + zassert_true(device_is_ready(i2c_device), "i2c device is not ready"); + return NULL; +} + +ZTEST_SUITE(i2c_controller_to_sensor, NULL, test_setup, NULL, NULL, NULL); diff --git a/tests/drivers/i2c/i2c_bme688/src/sensor.c b/tests/drivers/i2c/i2c_bme688/src/sensor.c new file mode 100644 index 00000000000..d351b31e707 --- /dev/null +++ b/tests/drivers/i2c/i2c_bme688/src/sensor.c @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "sensor.h" + +/* Calculate the compensated temperature */ +int32_t calculate_temperature(uint32_t adc_temp, int32_t *t_fine, + struct calibration_coeffs *cal_coeffs) +{ + int16_t temperature_compensated = 0; + int64_t var1, var2, var3; + + var1 = ((int32_t)adc_temp >> 3) - ((int32_t)cal_coeffs->par_t1 << 1); + var2 = (var1 * (int32_t)cal_coeffs->par_t2) >> 11; + var3 = ((var1 >> 1) * (var1 >> 1)) >> 12; + var3 = ((var3) * ((int32_t)cal_coeffs->par_t3 << 4)) >> 14; + *t_fine = var2 + var3; + temperature_compensated = (int16_t)(((*t_fine * 5) + 128) >> 8); + return temperature_compensated; +} + +/* Calculate the compensated pressure + * Note: temperature must be calculated first + * to obtain the 't_fine' + */ +uint32_t calculate_pressure(uint32_t pres_adc, int32_t t_fine, + struct calibration_coeffs *cal_coeffs) +{ + int32_t var1; + int32_t var2; + int32_t var3; + int32_t pressure_comp; + const int32_t pres_ovf_check = INT32_C(0x40000000); + + var1 = (((int32_t)t_fine) >> 1) - 64000; + var2 = ((((var1 >> 2) * (var1 >> 2)) >> 11) * (int32_t)cal_coeffs->par_p6) >> 2; + var2 = var2 + ((var1 * (int32_t)cal_coeffs->par_p5) << 1); + var2 = (var2 >> 2) + ((int32_t)cal_coeffs->par_p4 << 16); + var1 = (((((var1 >> 2) * (var1 >> 2)) >> 13) * ((int32_t)cal_coeffs->par_p3 << 5)) >> 3) + + (((int32_t)cal_coeffs->par_p2 * var1) >> 1); + var1 = var1 >> 18; + var1 = ((32768 + var1) * (int32_t)cal_coeffs->par_p1) >> 15; + pressure_comp = 1048576 - pres_adc; + pressure_comp = (int32_t)((pressure_comp - (var2 >> 12)) * ((uint32_t)3125)); + if (pressure_comp >= pres_ovf_check) { + pressure_comp = ((pressure_comp / var1) << 1); + } else { + pressure_comp = ((pressure_comp << 1) / var1); + } + + var1 = ((int32_t)cal_coeffs->par_p9 * + (int32_t)(((pressure_comp >> 3) * (pressure_comp >> 3)) >> 13)) >> + 12; + var2 = ((int32_t)(pressure_comp >> 2) * (int32_t)cal_coeffs->par_p8) >> 13; + var3 = ((int32_t)(pressure_comp >> 8) * (int32_t)(pressure_comp >> 8) * + (int32_t)(pressure_comp >> 8) * (int32_t)cal_coeffs->par_p10) >> + 17; + pressure_comp = (int32_t)(pressure_comp) + + ((var1 + var2 + var3 + ((int32_t)cal_coeffs->par_p7 << 7)) >> 4); + + return (uint32_t)pressure_comp; +} + +/* Calculate the relative humidity + * Note: temperature must be calculated first + * to obtain the 't_fine' + */ +uint32_t calculate_humidity(uint16_t hum_adc, int32_t t_fine, struct calibration_coeffs *cal_coeffs) +{ + int32_t var1; + int32_t var2; + int32_t var3; + int32_t var4; + int32_t var5; + int32_t var6; + int32_t temp_scaled; + int32_t calc_hum; + + temp_scaled = (((int32_t)t_fine * 5) + 128) >> 8; + var1 = (int32_t)(hum_adc - ((int32_t)((int32_t)cal_coeffs->par_h1 * 16))) - + (((temp_scaled * (int32_t)cal_coeffs->par_h3) / ((int32_t)100)) >> 1); + var2 = ((int32_t)cal_coeffs->par_h2 * + (((temp_scaled * (int32_t)cal_coeffs->par_h4) / ((int32_t)100)) + + (((temp_scaled * ((temp_scaled * (int32_t)cal_coeffs->par_h5) / ((int32_t)100))) >> + 6) / + ((int32_t)100)) + + (int32_t)(1 << 14))) >> + 10; + var3 = var1 * var2; + var4 = (int32_t)cal_coeffs->par_h6 << 7; + var4 = ((var4) + ((temp_scaled * (int32_t)cal_coeffs->par_h7) / ((int32_t)100))) >> 4; + var5 = ((var3 >> 14) * (var3 >> 14)) >> 10; + var6 = (var4 * var5) >> 1; + calc_hum = (((var3 + var6) >> 10) * ((int32_t)1000)) >> 12; + if (calc_hum > 100000) { + calc_hum = 100000; + } else if (calc_hum < 0) { + calc_hum = 0; + } + + return (uint32_t)calc_hum; +} diff --git a/tests/drivers/i2c/i2c_bme688/src/sensor.h b/tests/drivers/i2c/i2c_bme688/src/sensor.h new file mode 100644 index 00000000000..cac5addb33e --- /dev/null +++ b/tests/drivers/i2c/i2c_bme688/src/sensor.h @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SENSOR_H +#define SENSOR_H + +#include + +#define SLEEP_TIME_MS 250 +#define MEASUREMENT_CYCLES 3 +#define MAX_BURST_READ_SIZE 10 + +/* General */ +#define CHIP_ID_REGISTER_ADDRESS 0xD0 +#define VARIANT_ID_REGISTER_ADDRESS 0xF0 +#define CONF_REGISTER_ADDRESS 0x75 +#define CTRL_MEAS_REGISTER_ADDRESS 0x74 +#define CTRL_HUM_REGISTER_ADDRESS 0x72 +#define RESET_REGISTER_ADDRESS 0xE0 +#define SLEEP_MODE 0x0 +#define FORCED_MODE 0x1 +#define CTRL_MEAS_MODE_BIT_MSK 1 << 1 | 1 +#define CTRL_MEAS_MODE_BIT_SHIFT 0 +#define RESET_DEVICE 0xB6 +#define SENSOR_MEMORY_SIZE_IN_BYTES 255 + +/* Calibration coeffcients */ +#define TEMP_PAR_T1_REGISTER_ADDRESS_LSB 0xE9 +#define TEMP_PAR_T1_REGISTER_ADDRESS_MSB 0xEA +#define TEMP_PAR_T2_REGISTER_ADDRESS_LSB 0x8A +#define TEMP_PAR_T2_REGISTER_ADDRESS_MSB 0x8B +#define TEMP_PAR_T3_REGISTER_ADDRESS 0x8C + +#define HUMI_PAR_REGISTERS_START_ADDRESS 0xE1 +#define HUMI_PAR_REGISTERS_COUNT 8 +#define HUMI_PAR_H1_LSB_BUF_POSITION 1 +#define HUMI_PAR_H1_MSB_BUF_POSITION 2 +#define HUMI_PAR_H2_LSB_BUF_POSITION 1 +#define HUMI_PAR_H2_MSB_BUF_POSITION 0 +#define HUMI_PAR_H3_BUF_POSITION 3 +#define HUMI_PAR_H4_BUF_POSITION 4 +#define HUMI_PAR_H5_BUF_POSITION 5 +#define HUMI_PAR_H6_BUF_POSITION 6 +#define HUMI_PAR_H7_BUF_POSITION 7 + +#define HUMI_PAR_H1_REGISTER_ADDRESS_LSB 0xE2 +#define HUMI_PAR_H1_LSB_BIT_MASK 0xFF +#define HUMI_PAR_H1_REGISTER_ADDRESS_MSB 0xE3 +#define HUMI_PAR_H2_REGISTER_ADDRESS_LSB 0xE2 +#define HUMI_PAR_H2_REGISTER_ADDRESS_MSB 0xE1 +#define HUMI_PAR_H3_REGISTER_ADDRESS 0xE4 +#define HUMI_PAR_H4_REGISTER_ADDRESS 0xE5 +#define HUMI_PAR_H5_REGISTER_ADDRESS 0xE6 +#define HUMI_PAR_H6_REGISTER_ADDRESS 0xE7 +#define HUMI_PAR_H7_REGISTER_ADDRESS 0xE8 + +#define PRES_PAR_P1_REGISTER_ADDRESS_LSB 0x8E +#define PRES_PAR_P1_REGISTER_ADDRESS_MSB 0x8F +#define PRES_PAR_P2_REGISTER_ADDRESS_LSB 0x90 +#define PRES_PAR_P2_REGISTER_ADDRESS_MSB 0x91 +#define PRES_PAR_P3_REGISTER_ADDRESS 0x92 +#define PRES_PAR_P4_REGISTER_ADDRESS_LSB 0x94 +#define PRES_PAR_P4_REGISTER_ADDRESS_MSB 0x95 +#define PRES_PAR_P5_REGISTER_ADDRESS_LSB 0x96 +#define PRES_PAR_P5_REGISTER_ADDRESS_MSB 0x97 +#define PRES_PAR_P6_REGISTER_ADDRESS 0x99 +#define PRES_PAR_P7_REGISTER_ADDRESS 0x98 +#define PRES_PAR_P8_REGISTER_ADDRESS_LSB 0x9C +#define PRES_PAR_P8_REGISTER_ADDRESS_MSB 0x9D +#define PRES_PAR_P9_REGISTER_ADDRESS_LSB 0x9E +#define PRES_PAR_P9_REGISTER_ADDRESS_MSB 0x9F +#define PRES_PAR_P10_REGISTER_ADDRESS 0xA0 + +/* IIR filter */ +#define IIR_FILER_ORDER_BIT_MASK 1 << 4 | 1 << 3 | 1 << 2 +#define IIR_FILER_ORDER_BIT_SHIFT 2 +#define IIR_FILER_COEFF_3 0x2 + +/* Temperature measurement */ +#define TEMPERATURE_OVERSAMPLING_2X 0x2 +#define TEMP_OVERSAMPLING_BIT_MSK 1 << 7 | 1 << 6 | 1 << 5 +#define TEMP_OVERSAMPLING_BIT_SHIFT 5 + +#define TEMP_ADC_DATA_MSB_0 0x22 +#define TEMP_ADC_DATA_LSB_0 0x23 +#define TEMP_ADC_DATA_XLSB_0 0x24 + +/* Pressure measurement */ +#define PRESSURE_OVERSAMPLING_16X 0x5 +#define PRES_OVERSAMPLING_BIT_MSK 1 << 4 | 1 << 3 | 1 << 2 +#define PRES_OVERSAMPLING_BIT_SHIFT 2 + +#define PRES_ADC_DATA_MSB_0 0x1F +#define PRES_ADC_DATA_LSB_0 0x20 +#define PRES_ADC_DATA_XLSB_0 0x21 + +/* Humidity measurement */ +#define HUMIDITY_OVERSAMPLING_1X 0x1 +#define HUMIDITY_OVERSAMPLING_BIT_MSK 1 << 2 | 1 << 1 | 1 +#define HUMIDITY_OVERSAMPLING_BIT_SHIFT 0 + +#define HUM_ADC_DATA_MSB_0 0x25 +#define HUM_ADC_DATA_LSB_0 0x26 + +/* Measurement status */ +#define MEAS_STATUS_0_REG_ADDRESS 0x1D +#define MEAS_STATUS_1_REG_ADDRESS 0x2E +#define MEAS_STATUS_2_REG_ADDRESS 0x3F +#define MEASUREMENT_IN_PROGRESS_BIT_MASK 1 << 5 +#define MEASUREMENT_NEW_DATA_BIT_MASK 1 << 7 + +struct calibration_coeffs { + /* Temperature */ + uint16_t par_t1; + uint16_t par_t2; + uint8_t par_t3; + + /* Humidity */ + uint16_t par_h1; + uint16_t par_h2; + uint8_t par_h3; + uint8_t par_h4; + uint8_t par_h5; + uint8_t par_h6; + uint8_t par_h7; + + /* Pressure */ + uint16_t par_p1; + int16_t par_p2; + int8_t par_p3; + int16_t par_p4; + int16_t par_p5; + int8_t par_p6; + int8_t par_p7; + int16_t par_p8; + int16_t par_p9; + uint8_t par_p10; +}; + +/* Calculate the compensated temperature + * Note: 't_fine' is required for other measurements + */ +int32_t calculate_temperature(uint32_t adc_temp, int32_t *t_fine, + struct calibration_coeffs *cal_coeffs); + +/* Calculate the compensated pressure + * Note: temperature must be calculated first + * to obtain the 't_fine' + */ +uint32_t calculate_pressure(uint32_t pres_adc, int32_t t_fine, + struct calibration_coeffs *cal_coeffs); + +/* Calculate the relative humidity + * Note: temperature must be calculated first + * to obtain the 't_fine' + */ +uint32_t calculate_humidity(uint16_t hum_adc, int32_t t_fine, + struct calibration_coeffs *cal_coeffs); + +#endif diff --git a/tests/drivers/i2c/i2c_bme688/testcase.yaml b/tests/drivers/i2c/i2c_bme688/testcase.yaml new file mode 100644 index 00000000000..e36d79089f9 --- /dev/null +++ b/tests/drivers/i2c/i2c_bme688/testcase.yaml @@ -0,0 +1,6 @@ +common: + tags: drivers i2c + depends_on: i2c +tests: + drivers.i2c.bme688: + filter: dt_compat_enabled("bosch,bme680") From aa69cb93da07e9402e551bd912ded090581e7700 Mon Sep 17 00:00:00 2001 From: Bartosz Miller Date: Mon, 13 May 2024 12:47:03 +0200 Subject: [PATCH 1905/2300] [nrf fromtree] tests: drivers: Update uart_elementary suite with different configuration Conigure UART to use 2 stop bits and even parity in 'dual transmission' case to cover more driver code cases. Signed-off-by: Bartosz Miller (cherry picked from commit 7b82235e1e3773127aae787fb68c390d451fe539) --- tests/drivers/uart/uart_elementary/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index df8c7b54b10..da8fa4f6690 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -233,15 +233,15 @@ ZTEST(uart_elementary, test_uart_dual_port_transmission) { int err; struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, + .parity = UART_CFG_PARITY_EVEN, + .stop_bits = UART_CFG_STOP_BITS_2, .data_bits = UART_CFG_DATA_BITS_8, .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; #if defined(CONFIG_SETUP_MISMATCH_TEST) struct uart_config test_uart_config_aux = { .baudrate = 9600, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, + .parity = UART_CFG_PARITY_EVEN, + .stop_bits = UART_CFG_STOP_BITS_2, .data_bits = UART_CFG_DATA_BITS_8, .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; #endif From ce37c17343f0ef264373d359447815e5c80a99c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 10 May 2024 13:40:11 +0200 Subject: [PATCH 1906/2300] [nrf fromtree] samples: drivers: watchdog: Run sample on nrf54h20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay that enables selected WDT instance on nrf54h20 Application core. Signed-off-by: Sebastian Głąb (cherry picked from commit 7b2e20946d4bd2d6364d3323a74cd6c917f3c29d) --- .../watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..94e0d719af4 --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt010 { + status = "okay"; +}; From a90ac03df4228159b1c1022c73f7249535386c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 10 May 2024 15:46:52 +0200 Subject: [PATCH 1907/2300] [nrf fromtree] boards: nordic: nrf54h20dk: Define alias watchdog0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define alias watchdog0 for nrf54h20 Application core. Signed-off-by: Sebastian Głąb (cherry picked from commit c41438c4969a718feed7ddbd5663d2d7fbffb205) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 136197d2767..736588e22b1 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -39,6 +39,7 @@ sw1 = &button1; sw2 = &button2; sw3 = &button3; + watchdog0 = &wdt010; }; buttons { From 4708107b793a1ad9438168924a5eb5b94ed44750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 15 May 2024 15:15:03 +0200 Subject: [PATCH 1908/2300] [nrf fromtree] samples: drivers: watchdog: Add overlay files for nrf54l15/cpuflpr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both nrf54l15pdk/cpuflpr and nrf54l15pdk/cpuflpr_xip have watchdog on the list of supported periperals. As a result, Twister tries to build samples/drivers/watchdog for these two targets. Since overlays are missing, build is failing. Add missing overlay files. Signed-off-by: Sebastian Głąb (cherry picked from commit b3004be0a7e8e92ab840eaacca315889fbb82201) --- .../watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay | 8 ++++++++ .../boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay create mode 100644 samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay diff --git a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay new file mode 100644 index 00000000000..66157d79fb3 --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt30 { + status = "okay"; +}; diff --git a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay new file mode 100644 index 00000000000..66157d79fb3 --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt30 { + status = "okay"; +}; From 49762d522dba9bdd297f61b829e7778403da7204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 10 May 2024 14:16:16 +0200 Subject: [PATCH 1909/2300] [nrf fromtree] samples: subsys: settings: Run sample on nrf54h20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Kconfig file that makes the sample working on nrf54h20 Application core. Signed-off-by: Sebastian Głąb (cherry picked from commit 3a711143f40ece1fe43647cb678bf1f2a62a09cb) --- samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 2 ++ samples/subsys/settings/sample.yaml | 1 + 2 files changed, 3 insertions(+) create mode 100644 samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf diff --git a/samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 00000000000..3746c13c741 --- /dev/null +++ b/samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1,2 @@ +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y diff --git a/samples/subsys/settings/sample.yaml b/samples/subsys/settings/sample.yaml index 3ab57ee0923..e4a9e148c5a 100644 --- a/samples/subsys/settings/sample.yaml +++ b/samples/subsys/settings/sample.yaml @@ -13,6 +13,7 @@ tests: - native_sim/native/64 - mr_canhubk3 - nrf54l15pdk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - native_sim harness: console From 668b0460c46c7d0d329d4bf521acc395adbe825d Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 10 May 2024 11:06:44 +0200 Subject: [PATCH 1910/2300] [nrf fromtree] posix: env: Fix 2 build warnings Fix 2 build warnings in posix/options/env: The maximum length given to strncpy() matches the input string length, which makes the call equivalent to strcpy(). As the destination buffer size has been ensured sufficient (in the first case by chechking just before, in the second case by allocating it big enough), let's just use strcpy() instead. lib/posix/options/env.c: In function 'getenv_r': lib/posix/options/env.c:109:17: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-truncation] 109 | strncpy(buf, val, vsize); | ^~~~~~~~~~~~~~~~~~~~~~~~ lib/posix/options/env.c:104:25: note: length computed here 104 | vsize = strlen(val) + 1; | ^~~~~~~~~~~ lib/posix/options/env.c: In function 'setenv': lib/posix/options/env.c:191:17: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] 191 | strncpy(environ[ret], name, nsize); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lib/posix/options/env.c:128:51: note: length computed here 128 | const size_t nsize = (name == NULL) ? 0 : strlen(name); | ^~~~~~~~~~~~ Signed-off-by: Alberto Escolar Piedras (cherry picked from commit 7c8d53898228d8583861f4ef8411d984d0adc949) --- lib/posix/options/env.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/posix/options/env.c b/lib/posix/options/env.c index 2607ae2a4be..56d3b4ae543 100644 --- a/lib/posix/options/env.c +++ b/lib/posix/options/env.c @@ -106,7 +106,7 @@ int getenv_r(const char *name, char *buf, size_t len) ret = -ERANGE; K_SPINLOCK_BREAK; } - strncpy(buf, val, vsize); + strcpy(buf, val); LOG_DBG("Found entry %s", environ[ret]); } @@ -188,7 +188,7 @@ int setenv(const char *name, const char *val, int overwrite) environ[ret] = env; } - strncpy(environ[ret], name, nsize); + strcpy(environ[ret], name); environ[ret][nsize] = '='; strncpy(environ[ret] + nsize + 1, val, vsize + 1); LOG_DBG("Added entry %s", environ[ret]); From 25fbeabe900442d0568090765851aa452c4d8947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Mon, 13 May 2024 10:53:25 +0200 Subject: [PATCH 1911/2300] [nrf fromtree] boards: nordic: nrf54h20dk: Add counter to the supported peripherals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable Twister tests for the counter driver for: - nrf54h20/cpuapp; - nrf54h20/cpurad. Signed-off-by: Sebastian Głąb (cherry picked from commit faf6fd169c15b39c95315b014faaacb7ff57ea25) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml index 198f4db403b..2f83ef80de6 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml @@ -12,6 +12,7 @@ toolchain: ram: 256 flash: 512 supported: + - counter - gpio - pwm - spi diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index 53bbff4a460..e36f2e21ffe 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -12,6 +12,7 @@ toolchain: ram: 192 flash: 256 supported: + - counter - gpio - pwm - spi From 1a8f9cb0b324a6dde08ee7a9f544b97d2cbc8a1b Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 1 Feb 2024 09:46:02 +0100 Subject: [PATCH 1912/2300] [nrf fromlist] tests: drivers: timer: grtc: Fix GRTC test The `z_nrf_grtc_timer_get_ticks()` function converts system ticks to GRTC ticks. It gets the current system tick to calculate an absolute GRTC value. The same does the test function to provide an argument to be converted. If the system tick occurs between those `sys_clock_tick_get()` calls the `z_nrf_grtc_timer_get_ticks()` will take into account the newer tick while the test estimate bases on the old tick value. Due to that the maximum result error is 1 system tick minus 1 GRTC tick which equals (`CYC_PER_TICK` - 1) for GRTC ticks. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71688 Signed-off-by: Adam Kondraciuk --- tests/drivers/timer/nrf_grtc_timer/src/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/drivers/timer/nrf_grtc_timer/src/main.c b/tests/drivers/timer/nrf_grtc_timer/src/main.c index e6621316666..f8d33d8c53a 100644 --- a/tests/drivers/timer/nrf_grtc_timer/src/main.c +++ b/tests/drivers/timer/nrf_grtc_timer/src/main.c @@ -24,6 +24,8 @@ ZTEST(nrf_grtc_timer, test_get_ticks) zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); + k_msleep(1); + for (uint32_t i = 0; i < NUMBER_OF_TRIES; i++) { /* Absolute timeout 1ms in the past */ t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() - K_MSEC(1).ticks)); From f726a48e30d4c0c9164e51ae549bbc52c4479f6e Mon Sep 17 00:00:00 2001 From: Jan Zyczkowski Date: Thu, 16 May 2024 13:04:36 +0200 Subject: [PATCH 1913/2300] [nrf fromtree] ipc_service: backends: icbmsg: Silence maybe-uninitialized warning If compiling with optimizations (-O2/-Ofast) gcc emits a maybe-uninitialized warning for `size`. As far as I can tell, `size` will always be initialized in the cases where it is used and only left uninitialized in error cases. Reproduced on main with the multi_endpoint sample on nrf5340dk/nrf5340/cpuapp. Signed-off-by: Herman Berget Signed-off-by: Jan Zyczkowski (cherry picked from commit 9729651bb5f8cab445332e99cf548b75f67950e2) --- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index c7127888b18..37594025313 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -470,7 +470,7 @@ static int release_tx_buffer(struct backend_data *dev_data, const uint8_t *buffe int new_size) { const struct icbmsg_config *conf = dev_data->conf; - size_t size; + size_t size = 0; int tx_block_index; tx_block_index = buffer_to_index_validate(&conf->tx, buffer, &size); From e06581a5b0fe1ede8f3abb3ac39f77140e5110a9 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 15 Apr 2024 18:51:29 +0200 Subject: [PATCH 1914/2300] [nrf noup] samples/smp_svr: nrf54l15pdk ext-flash partition Added DTS with partitioning which involves external flash as place for slo1_partition.external slot1_partition Signed-off-by: Andrzej Puzdrowski --- ...54l15pdk_nrf54l15_cpuapp_ext_flash.overlay | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay index 410388bfa6d..76b648903a0 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay +++ b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay @@ -4,6 +4,42 @@ }; }; +/delete-node/ &boot_partition; +/delete-node/ &slot0_partition; +/delete-node/ &slot1_partition; + +/delete-node/ &slot0_ns_partition; +/delete-node/ &slot1_ns_partition; + +/delete-node/ &storage_partition; + +&rram0 { + partitions { + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x000000000 0x00014000>; + }; + slot0_partition: partition@14000 { + label = "image-0"; + reg = <0x000014000 0x0015A000>; + }; + storage_partition: partition@16E000 { + label = "storage"; + reg = < 0x16E000 0x9000 >; + }; + }; +}; + &mx25r64 { status = "okay"; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + slot1_partition: partition@0 { + label = "image-1"; + reg = <0x000000000 0x0015A000>; + }; + }; }; From 00c13a39a2903f38a0fb31bec7026200847d868c Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Mon, 29 Apr 2024 17:26:47 +0200 Subject: [PATCH 1915/2300] [nrf noup] samples/**/smp_svr: testcase of nrf54l15pdk with ext-flash DT Added description of sample testcase for building smp_svr with support of secondary partition in on PDK spi_nor flash uisng DTS. Signed-off-by: Andrzej Puzdrowski --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 81b06ca5634..00182054eba 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -116,3 +116,15 @@ tests: - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf54l15pdk/nrf54l15/cpuapp + sample.mcumgr.smp_svr.bt.nrf54l15pdk.ext_flash.pure_dts: + extra_args: + - OVERLAY_CONFIG="overlay-bt.conf" + - DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" + - mcuboot_CONF_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.conf" + - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" + extra_configs: + - SB_CONFIG_PARTITION_MANAGER=n + platform_allow: + - nrf54l15pdk/nrf54l15/cpuapp + integration_platforms: + - nrf54l15pdk/nrf54l15/cpuapp From 155bb98540633afb1c8b588397c67ea86409dbbd Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 15 May 2024 12:49:43 +0200 Subject: [PATCH 1916/2300] [nrf fromlist] dt-bindings: pinctrl: nrf: allow for more ports New nRF54H20 SoC series expose more ports, e.g. P9, so reserve more bits for the Port+Pin field. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73097 Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 8ffa1fa4a89734ec78017ff5e05c335480f1daa8) --- .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index a50233ab38c..cbd92c73460 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -10,13 +10,12 @@ * The whole nRF pin configuration information is encoded in a 32-bit bitfield * organized as follows: * - * - 31..16: Pin function. - * - 15: Reserved. - * - 14: Pin inversion mode. - * - 13: Pin low power mode. - * - 12..9: Pin output drive configuration. - * - 8..7: Pin pull configuration. - * - 6..0: Pin number (combination of port and pin). + * - 31..17: Pin function. + * - 16: Pin inversion mode. + * - 15: Pin low power mode. + * - 14..11: Pin output drive configuration. + * - 10..9: Pin pull configuration. + * - 8..0: Pin number (combination of port and pin). */ /** @@ -25,29 +24,29 @@ */ /** Position of the function field. */ -#define NRF_FUN_POS 16U +#define NRF_FUN_POS 17U /** Mask for the function field. */ -#define NRF_FUN_MSK 0xFFFFU +#define NRF_FUN_MSK 0x7FFFU /** Position of the invert field. */ -#define NRF_INVERT_POS 14U +#define NRF_INVERT_POS 16U /** Mask for the invert field. */ #define NRF_INVERT_MSK 0x1U /** Position of the low power field. */ -#define NRF_LP_POS 13U +#define NRF_LP_POS 15U /** Mask for the low power field. */ #define NRF_LP_MSK 0x1U /** Position of the drive configuration field. */ -#define NRF_DRIVE_POS 9U +#define NRF_DRIVE_POS 11U /** Mask for the drive configuration field. */ #define NRF_DRIVE_MSK 0xFU /** Position of the pull configuration field. */ -#define NRF_PULL_POS 7U +#define NRF_PULL_POS 9U /** Mask for the pull configuration field. */ #define NRF_PULL_MSK 0x3U /** Position of the pin field. */ #define NRF_PIN_POS 0U /** Mask for the pin field. */ -#define NRF_PIN_MSK 0x7FU +#define NRF_PIN_MSK 0x1FFU /** @} */ @@ -218,7 +217,7 @@ * @brief Utility macro to build nRF psels property entry. * * @param fun Pin function configuration (see NRF_FUNC_{name} macros). - * @param port Port (0 or 1). + * @param port Port (0 or 15). * @param pin Pin (0..31). */ #define NRF_PSEL(fun, port, pin) \ From fb155f1a0feaac61a86bd975ebf1c5051149ca87 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 9 May 2024 09:34:06 +0100 Subject: [PATCH 1917/2300] [nrf noup] boards: nordic: thingy53: Add sysbuild Kconfig file Adds a sysbuild Kconfig file which enables external flash when partition manager is enabled Signed-off-by: Jamie McCrae --- boards/nordic/thingy53/Kconfig.sysbuild | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 boards/nordic/thingy53/Kconfig.sysbuild diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild new file mode 100644 index 00000000000..2110f226e6b --- /dev/null +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y if BOOTLOADER_MCUBOOT From 8926df9c8cb267536d02f9ea4e6c954144f887c1 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 14 May 2024 12:22:51 +0100 Subject: [PATCH 1918/2300] [nrf noup] scripts: west: build: Use sysbuild by default if in NCS dir Uses sysbuild by default when building an application which resides in an allowed NCS-based directory when the sysbuild config key is not set. Do not use sysbuild if the mps2 board is being used to avoid problems with CI testing. Signed-off-by: Jamie McCrae --- scripts/west_commands/build.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py index f7a605f4d7f..832b4058a04 100644 --- a/scripts/west_commands/build.py +++ b/scripts/west_commands/build.py @@ -9,6 +9,11 @@ import sys import yaml +from pathlib import Path +from zephyr_ext_common import ZEPHYR_BASE +sys.path.append(os.fspath(Path(__file__).parent.parent)) +import zephyr_module + from west import log from west.configuration import config from zcmake import DEFAULT_CMAKE_GENERATOR, run_cmake, run_build, CMakeCache @@ -557,7 +562,24 @@ def _run_cmake(self, board, origin, cmake_opts): if user_args: cmake_opts.extend(shlex.split(user_args)) - config_sysbuild = config_getboolean('sysbuild', False) + config_sysbuild = config_getboolean('sysbuild', None) + + if config_sysbuild is None: + # Check if this is an ncs-repo directory + allow_list = [ 'mcuboot', 'sidewalk', 'find-my', 'nrf', 'matter', 'suit-processor', + 'memfault-firmware-sdk', 'zscilib', 'uoscore-uedhoc', 'zcbor', + 'hal_nordic' ] + config_sysbuild = False + + for module in zephyr_module.parse_modules(ZEPHYR_BASE, self.manifest): + if module.meta['name'] in allow_list and Path(self.source_dir).is_relative_to(module.project): + config_sysbuild = True + break + + if config_sysbuild is False and Path(self.source_dir).is_relative_to(ZEPHYR_BASE): + config_sysbuild = True + + if self.args.sysbuild or (config_sysbuild and not self.args.no_sysbuild): cmake_opts.extend(['-S{}'.format(SYSBUILD_PROJ_DIR), '-DAPP_DIR:PATH={}'.format(self.source_dir)]) From 9354bce7c3d56a20f9d5b398fb25ea1d785792d2 Mon Sep 17 00:00:00 2001 From: Maciej Perkowski Date: Fri, 10 May 2024 12:36:23 +0200 Subject: [PATCH 1919/2300] [nrf fromtree] twister: allow using west-flash with 'erase' Using `erase` with west-flash was blocked as it was messing with sysbuild. With #69748 the issue is fixed, hence 'erase' is no longer blocked. Remove obsolete twister test Signed-off-by: Maciej Perkowski (cherry picked from commit be682e22e166c33a67c1db0755f8ca20c37b6576) --- scripts/pylib/twister/twisterlib/runner.py | 8 +------- scripts/tests/twister/test_runner.py | 16 +--------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 28e3dae80cd..1e8dc3b1a68 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -496,17 +496,11 @@ def parse_generated(self, filter_stages=[]): if self.testsuite.sysbuild and self.env.options.device_testing: # Verify that twister's arguments support sysbuild. # Twister sysbuild flashing currently only works with west, so - # --west-flash must be passed. Additionally, erasing the DUT - # before each test with --west-flash=--erase will inherently not - # work with sysbuild. + # --west-flash must be passed. if self.env.options.west_flash is None: logger.warning("Sysbuild test will be skipped. " + "West must be used for flashing.") return {os.path.join(self.platform.name, self.testsuite.name): True} - elif "--erase" in self.env.options.west_flash: - logger.warning("Sysbuild test will be skipped, " + - "--erase is not supported with --west-flash") - return {os.path.join(self.platform.name, self.testsuite.name): True} if self.testsuite and self.testsuite.filter: try: diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index b07ab333f89..df034b8c00c 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -554,20 +554,6 @@ def mock_popen(*args, **kwargs): ['Sysbuild test will be skipped. West must be used for flashing.'], {os.path.join('other', 'dummy.testsuite.name'): True} ), - ( - 'other', ['other'], True, - False, ['--erase'], True, - 'Dummy parse results', True, - None, - None, - {}, - {}, - None, - b'dummy edt pickle contents', - ['Sysbuild test will be skipped,' \ - ' --erase is not supported with --west-flash'], - {os.path.join('other', 'dummy.testsuite.name'): True} - ), ( 'other', ['other'], False, True, None, False, @@ -651,7 +637,7 @@ def mock_popen(*args, **kwargs): ' expected_logs, expected_return', TESTDATA_3, ids=['unit testing', 'domain', 'kconfig', 'no cache', - 'no west options', 'erase west flash option', 'no edt', + 'no west options', 'no edt', 'parse result', 'no parse result', 'no testsuite filter', 'parse err'] ) def test_filterbuilder_parse_generated( From 2e8f954db9372b7e25ce783cbf3decfc73e596bb Mon Sep 17 00:00:00 2001 From: Lukasz Mrugala Date: Thu, 25 Apr 2024 13:10:44 +0000 Subject: [PATCH 1920/2300] [nrf fromtree] scripts: twister: Remove Handler atavisms Removed following fields from relevant Handlers, as they were unused in code: * Handler's state * Handler's generator * BinaryHandler's call_west_flash * QEMUHandler's results * QEMUWinHandler's results Signed-off-by: Lukasz Mrugala (cherry picked from commit 83db378dc50f76ed75fbbbd9f33b664abd41409d) --- scripts/pylib/twister/twisterlib/handlers.py | 12 ++---------- scripts/pylib/twister/twisterlib/testinstance.py | 1 - scripts/tests/twister/test_handlers.py | 16 +++++----------- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index ae283c1722e..d6dff8f0195 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -72,7 +72,6 @@ def __init__(self, instance, type_str="build"): """ self.options = None - self.state = "waiting" self.run = False self.type_str = type_str @@ -86,7 +85,6 @@ def __init__(self, instance, type_str="build"): self.build_dir = instance.build_dir self.log = os.path.join(self.build_dir, "handler.log") self.returncode = 0 - self.generator = None self.generator_cmd = None self.suite_name_check = True self.ready = False @@ -178,7 +176,6 @@ def __init__(self, instance, type_str): """ super().__init__(instance, type_str) - self.call_west_flash = False self.seed = None self.extra_test_args = None self.line = b"" @@ -241,8 +238,6 @@ def _create_command(self, robot_test): command = [self.generator_cmd, "run_renode_test"] elif self.call_make_run: command = [self.generator_cmd, "run"] - elif self.call_west_flash: - command = ["west", "flash", "--skip-rebuild", "-d", self.build_dir] else: command = [self.binary] @@ -856,7 +851,7 @@ def _thread_update_instance_info(handler, handler_time, out_state): handler.instance.reason = "Unknown" @staticmethod - def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn, results, + def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn, harness, ignore_unexpected_eof=False): fifo_in, fifo_out = QEMUHandler._thread_get_fifo_names(fifo_fn) @@ -997,7 +992,6 @@ def _update_instance_info(self, harness_state, is_timeout): self.instance.add_missing_case_status("blocked") def handle(self, harness): - self.results = {} self.run = True sysbuild_build_dir = self._get_sysbuild_build_dir() @@ -1009,7 +1003,7 @@ def handle(self, harness): self.thread = threading.Thread(name=self.name, target=QEMUHandler._thread, args=(self, self.get_test_timeout(), self.build_dir, self.log_fn, self.fifo_fn, - self.pid_fn, self.results, harness, + self.pid_fn, harness, self.ignore_unexpected_eof)) self.thread.daemon = True @@ -1088,7 +1082,6 @@ def __init__(self, instance, type_str): self.pid = 0 self.thread = None self.stop_thread = False - self.results = {} if instance.testsuite.ignore_qemu_crash: self.ignore_qemu_crash = True @@ -1296,7 +1289,6 @@ def _monitor_output(self, queue, timeout, logfile, pid_fn, harness, ignore_unexp self._stop_qemu_process(self.pid) def handle(self, harness): - self.results = {} self.run = True sysbuild_build_dir = self._get_sysbuild_build_dir() diff --git a/scripts/pylib/twister/twisterlib/testinstance.py b/scripts/pylib/twister/twisterlib/testinstance.py index 5ec183a6a87..5be57e1deb6 100644 --- a/scripts/pylib/twister/twisterlib/testinstance.py +++ b/scripts/pylib/twister/twisterlib/testinstance.py @@ -201,7 +201,6 @@ def setup_handler(self, env): if handler: handler.options = options handler.generator_cmd = env.generator_cmd - handler.generator = env.generator handler.suite_name_check = not options.disable_suite_name_check self.handler = handler diff --git a/scripts/tests/twister/test_handlers.py b/scripts/tests/twister/test_handlers.py index 219d90a89d6..7eddd016ca9 100644 --- a/scripts/tests/twister/test_handlers.py +++ b/scripts/tests/twister/test_handlers.py @@ -442,28 +442,25 @@ def wait(self, *args, **kwargs): TESTDATA_4 = [ - (True, False, False, True, None, None, + (True, False, True, None, None, ['valgrind', '--error-exitcode=2', '--leak-check=full', f'--suppressions={ZEPHYR_BASE}/scripts/valgrind.supp', '--log-file=build_dir/valgrind.log', '--track-origins=yes', 'generator', 'run_renode_test']), - (False, True, False, False, 123, None, ['generator', 'run', '--seed=123']), - (False, False, True, False, None, None, - ['west', 'flash', '--skip-rebuild', '-d', 'build_dir']), - (False, False, False, False, None, ['ex1', 'ex2'], ['bin', 'ex1', 'ex2']), + (False, True, False, 123, None, ['generator', 'run', '--seed=123']), + (False, False, False, None, ['ex1', 'ex2'], ['bin', 'ex1', 'ex2']), ] @pytest.mark.parametrize( - 'robot_test, call_make_run, call_west_flash, enable_valgrind, seed,' \ + 'robot_test, call_make_run, enable_valgrind, seed,' \ ' extra_args, expected', TESTDATA_4, - ids=['robot, valgrind', 'make run, seed', 'west flash', 'binary, extra'] + ids=['robot, valgrind', 'make run, seed', 'binary, extra'] ) def test_binaryhandler_create_command( mocked_instance, robot_test, call_make_run, - call_west_flash, enable_valgrind, seed, extra_args, @@ -473,7 +470,6 @@ def test_binaryhandler_create_command( handler.generator_cmd = 'generator' handler.binary = 'bin' handler.call_make_run = call_make_run - handler.call_west_flash = call_west_flash handler.options = mock.Mock(enable_valgrind=enable_valgrind) handler.seed = seed handler.extra_test_args = extra_args @@ -1893,7 +1889,6 @@ def mock_cputime(pid): type(mocked_instance.testsuite).timeout = mock.PropertyMock(return_value=timeout) handler = QEMUHandler(mocked_instance, 'build') - handler.results = {} handler.ignore_unexpected_eof = False handler.pid_fn = 'pid_fn' handler.fifo_fn = 'fifo_fn' @@ -1953,7 +1948,6 @@ def mocked_open(filename, *args, **kwargs): handler.log, handler.fifo_fn, handler.pid_fn, - handler.results, harness, handler.ignore_unexpected_eof ) From 33c8345d3bdc6280f252afd5eab638a4267dc114 Mon Sep 17 00:00:00 2001 From: Grzegorz Chwierut Date: Mon, 29 Apr 2024 16:38:37 +0200 Subject: [PATCH 1921/2300] [nrf fromlist] twister: Allow to run sysbuild with native_sim Fix issue 72083. Update path to zephyr.exe binary using default domain from domains.yaml file. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72100 Signed-off-by: Grzegorz Chwierut --- scripts/pylib/twister/twisterlib/handlers.py | 58 +++++++------------- scripts/tests/twister/test_handlers.py | 11 ++-- 2 files changed, 27 insertions(+), 42 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index d6dff8f0195..6ea8f5165c1 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -75,7 +75,6 @@ def __init__(self, instance, type_str="build"): self.run = False self.type_str = type_str - self.binary = None self.pid_fn = None self.call_make_run = True @@ -167,6 +166,19 @@ def _final_handle_actions(self, harness, handler_time): self.record(harness) + def get_default_domain_build_dir(self): + if self.instance.testsuite.sysbuild: + # Load domain yaml to get default domain build directory + # Note: for targets using QEMU, we assume that the target will + # have added any additional images to the run target manually + domain_path = os.path.join(self.build_dir, "domains.yaml") + domains = Domains.from_file(domain_path) + logger.debug("Loaded sysbuild domain data from %s" % domain_path) + build_dir = domains.get_default_domain().build_dir + else: + build_dir = self.build_dir + return build_dir + class BinaryHandler(Handler): def __init__(self, instance, type_str): @@ -239,7 +251,8 @@ def _create_command(self, robot_test): elif self.call_make_run: command = [self.generator_cmd, "run"] else: - command = [self.binary] + binary = os.path.join(self.get_default_domain_build_dir(), "zephyr", "zephyr.exe") + command = [binary] if self.options.enable_valgrind: command = ["valgrind", "--error-exitcode=2", @@ -344,7 +357,6 @@ def __init__(self, instance, type_str): self.pid_fn = os.path.join(instance.build_dir, "renode.pid") elif type_str == 'native': self.call_make_run = False - self.binary = os.path.join(instance.build_dir, "zephyr", "zephyr.exe") self.ready = True @@ -949,20 +961,6 @@ def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn, QEMUHandler._thread_close_files(fifo_in, fifo_out, pid, out_fp, in_fp, log_out_fp) - def _get_sysbuild_build_dir(self): - if self.instance.testsuite.sysbuild: - # Load domain yaml to get default domain build directory - # Note: for targets using QEMU, we assume that the target will - # have added any additional images to the run target manually - domain_path = os.path.join(self.build_dir, "domains.yaml") - domains = Domains.from_file(domain_path) - logger.debug("Loaded sysbuild domain data from %s" % domain_path) - build_dir = domains.get_default_domain().build_dir - else: - build_dir = self.build_dir - - return build_dir - def _set_qemu_filenames(self, sysbuild_build_dir): # We pass this to QEMU which looks for fifos with .in and .out suffixes. # QEMU fifo will use main build dir @@ -994,11 +992,11 @@ def _update_instance_info(self, harness_state, is_timeout): def handle(self, harness): self.run = True - sysbuild_build_dir = self._get_sysbuild_build_dir() + domain_build_dir = self.get_default_domain_build_dir() - command = self._create_command(sysbuild_build_dir) + command = self._create_command(domain_build_dir) - self._set_qemu_filenames(sysbuild_build_dir) + self._set_qemu_filenames(domain_build_dir) self.thread = threading.Thread(name=self.name, target=QEMUHandler._thread, args=(self, self.get_test_timeout(), self.build_dir, @@ -1138,20 +1136,6 @@ def _monitor_update_instance_info(handler, handler_time, out_state): handler.instance.status = out_state handler.instance.reason = "Unknown" - def _get_sysbuild_build_dir(self): - if self.instance.testsuite.sysbuild: - # Load domain yaml to get default domain build directory - # Note: for targets using QEMU, we assume that the target will - # have added any additional images to the run target manually - domain_path = os.path.join(self.build_dir, "domains.yaml") - domains = Domains.from_file(domain_path) - logger.debug("Loaded sysbuild domain data from %s" % domain_path) - build_dir = domains.get_default_domain().build_dir - else: - build_dir = self.build_dir - - return build_dir - def _set_qemu_filenames(self, sysbuild_build_dir): # PID file will be created in the main sysbuild app's build dir self.pid_fn = os.path.join(sysbuild_build_dir, "qemu.pid") @@ -1291,9 +1275,9 @@ def _monitor_output(self, queue, timeout, logfile, pid_fn, harness, ignore_unexp def handle(self, harness): self.run = True - sysbuild_build_dir = self._get_sysbuild_build_dir() - command = self._create_command(sysbuild_build_dir) - self._set_qemu_filenames(sysbuild_build_dir) + domain_build_dir = self.get_default_domain_build_dir() + command = self._create_command(domain_build_dir) + self._set_qemu_filenames(domain_build_dir) logger.debug("Running %s (%s)" % (self.name, self.type_str)) is_timeout = False diff --git a/scripts/tests/twister/test_handlers.py b/scripts/tests/twister/test_handlers.py index 7eddd016ca9..dd0686906db 100644 --- a/scripts/tests/twister/test_handlers.py +++ b/scripts/tests/twister/test_handlers.py @@ -448,7 +448,7 @@ def wait(self, *args, **kwargs): '--log-file=build_dir/valgrind.log', '--track-origins=yes', 'generator', 'run_renode_test']), (False, True, False, 123, None, ['generator', 'run', '--seed=123']), - (False, False, False, None, ['ex1', 'ex2'], ['bin', 'ex1', 'ex2']), + (False, False, False, None, ['ex1', 'ex2'], ['build_dir/zephyr/zephyr.exe', 'ex1', 'ex2']), ] @pytest.mark.parametrize( @@ -474,6 +474,7 @@ def test_binaryhandler_create_command( handler.seed = seed handler.extra_test_args = extra_args handler.build_dir = 'build_dir' + handler.instance.testsuite.sysbuild = False command = handler._create_command(robot_test) @@ -1478,7 +1479,7 @@ def mock_process(pid): TESTDATA_19, ids=['domains build dir', 'self build dir'] ) -def test_qemuhandler_get_sysbuild_build_dir( +def test_qemuhandler_get_default_domain_build_dir( mocked_instance, self_sysbuild, self_build_dir, @@ -1495,7 +1496,7 @@ def test_qemuhandler_get_sysbuild_build_dir( handler.build_dir = self_build_dir with mock.patch('domains.Domains.from_file', from_file_mock): - result = handler._get_sysbuild_build_dir() + result = handler.get_default_domain_build_dir() assert result == expected @@ -2017,7 +2018,7 @@ def mock_filenames(sysbuild_build_dir): harness = mock.Mock(state=harness_state) handler_options_west_flash = [] - sysbuild_build_dir = os.path.join('sysbuild', 'dummydir') + domain_build_dir = os.path.join('sysbuild', 'dummydir') command = ['generator_cmd', '-C', os.path.join('cmd', 'path'), 'run'] handler.options = mock.Mock( @@ -2030,7 +2031,7 @@ def mock_filenames(sysbuild_build_dir): handler._final_handle_actions = mock.Mock(return_value=None) handler._create_command = mock.Mock(return_value=command) handler._set_qemu_filenames = mock.Mock(side_effect=mock_filenames) - handler._get_sysbuild_build_dir = mock.Mock(return_value=sysbuild_build_dir) + handler.get_default_domain_build_dir = mock.Mock(return_value=domain_build_dir) handler.terminate = mock.Mock() unlink_mock = mock.Mock() From dd586c683bd75c35815d097b24eb65d0f7f0b454 Mon Sep 17 00:00:00 2001 From: Maciej Perkowski Date: Thu, 16 May 2024 12:57:07 +0200 Subject: [PATCH 1922/2300] [nrf fromtree] twister: Fix path to binary location for unit_testing board PR #72100 broke execution of unit type tests. This commit fixes it by bringing back the "old" logic for selecting a binary path for unit type tests. Signed-off-by: Maciej Perkowski (cherry picked from commit 7d3dc4e7e377746ce752390082e634120b7edb8e) --- scripts/pylib/twister/twisterlib/handlers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index 6ea8f5165c1..c8399a59ce5 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -250,6 +250,8 @@ def _create_command(self, robot_test): command = [self.generator_cmd, "run_renode_test"] elif self.call_make_run: command = [self.generator_cmd, "run"] + elif self.instance.testsuite.type == "unit": + command = [self.binary] else: binary = os.path.join(self.get_default_domain_build_dir(), "zephyr", "zephyr.exe") command = [binary] From 2bc6913f010a0d9fe1bf26c866b0c8e78fad1315 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 17 May 2024 10:15:33 +0100 Subject: [PATCH 1923/2300] [nrf noup] board: nordic: thingy53: Enable default images for sysbuild Enables MCUboot, empty network core and network core updates by default when building for the thingy53 Signed-off-by: Jamie McCrae --- boards/nordic/thingy53/Kconfig.sysbuild | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/boards/nordic/thingy53/Kconfig.sysbuild b/boards/nordic/thingy53/Kconfig.sysbuild index 2110f226e6b..2fbd8e803a1 100644 --- a/boards/nordic/thingy53/Kconfig.sysbuild +++ b/boards/nordic/thingy53/Kconfig.sysbuild @@ -1,5 +1,25 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +if BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS + +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +config SECURE_BOOT + default y + +config SECURE_BOOT_NETCORE + default y if SECURE_BOOT + +config NETCORE_APP_UPDATE + default y if SECURE_BOOT + +config NRF_DEFAULT_EMPTY + default y + +endif # BOARD_THINGY53_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP_NS + config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY default y if BOOTLOADER_MCUBOOT From af6ac3ac77137ba38bfd043c950fb2b934eaa964 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Fri, 10 May 2024 16:16:01 +0200 Subject: [PATCH 1924/2300] [nrf fromlist] include: storage: flash_map: _NODE macros adds size, offset and divice access macros that are operating with nodes as an argument. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72582 Signed-off-by: Mateusz Michalek --- include/zephyr/storage/flash_map.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index c53cbef8957..c76ca18bae2 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -305,6 +305,15 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); */ #define FIXED_PARTITION_OFFSET(label) DT_REG_ADDR(DT_NODELABEL(label)) +/** + * Get fixed-partition offset from DTS node + * + * @param node DTS node of a partition + * + * @return fixed-partition offset, as defined for the partition in DTS. + */ +#define FIXED_PARTITION_NODE_OFFSET(node) DT_REG_ADDR(node) + /** * Get fixed-partition size for DTS node label * @@ -314,6 +323,15 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); */ #define FIXED_PARTITION_SIZE(label) DT_REG_SIZE(DT_NODELABEL(label)) +/** + * Get fixed-partition size for DTS node + * + * @param node DTS node of a partition + * + * @return fixed-partition size, as defined for the partition in DTS. + */ +#define FIXED_PARTITION_NODE_SIZE(node) DT_REG_SIZE(node) + /** * Get device pointer for device the area/partition resides on * @@ -334,6 +352,16 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_DEVICE(label) \ DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))) +/** + * Get device pointer for device the area/partition resides on + * + * @param node DTS node of a partition + * + * @return Pointer to a device. + */ +#define FIXED_PARTITION_NODE_DEVICE(node) \ + DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(node)) + #endif /* USE_PARTITION_MANAGER */ #ifdef __cplusplus From 706f82bc1b8aaaadbe7b56745bb1574a87ddd470 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Tue, 14 May 2024 13:55:57 +0200 Subject: [PATCH 1925/2300] [nrf fromlist] tests: storage: flash_map: _NODE macros adds API checks for fixed partitions access macros that are called with nodes as an argumet. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72582 Signed-off-by: Mateusz Michalek --- tests/subsys/storage/flash_map/src/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/subsys/storage/flash_map/src/main.c b/tests/subsys/storage/flash_map/src/main.c index 07430fc766e..e66f6ac7e0f 100644 --- a/tests/subsys/storage/flash_map/src/main.c +++ b/tests/subsys/storage/flash_map/src/main.c @@ -13,6 +13,7 @@ #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) extern int flash_map_entries; struct flash_sector fs_sectors[256]; @@ -190,4 +191,15 @@ ZTEST(flash_map, test_flash_area_erased_val) flash_area_close(fa); } +ZTEST(flash_map, test_fixed_partition_node_macros) +{ + /* Test against changes in API */ + zassert_equal(FIXED_PARTITION_NODE_OFFSET(SLOT1_PARTITION_NODE), + DT_REG_ADDR(SLOT1_PARTITION_NODE)); + zassert_equal(FIXED_PARTITION_NODE_SIZE(SLOT1_PARTITION_NODE), + DT_REG_SIZE(SLOT1_PARTITION_NODE)); + zassert_equal(FIXED_PARTITION_NODE_DEVICE(SLOT1_PARTITION_NODE), + DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(SLOT1_PARTITION_NODE))); +} + ZTEST_SUITE(flash_map, NULL, NULL, NULL, NULL, NULL); From 9818f530c87b070c33c827f9d1945c7c4bda5d7e Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Fri, 17 May 2024 13:50:49 +0200 Subject: [PATCH 1926/2300] [nrf fromtree] scripts: ci: test_plan: fix usage with files When modified files list is used instead of commit range, repo object was incorrect. (cherry picked from commit 65703a80af836c979007c93cf2524ed1e4e5d9c5) Signed-off-by: Piotr Kosycarz --- scripts/ci/test_plan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 625d47a7805..6c8b823b128 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -24,7 +24,7 @@ # however, pylint complains that it doesn't recognized them when used (used-before-assignment). zephyr_base = Path(os.environ['ZEPHYR_BASE']) repository_path = zephyr_base -repo_to_scan = zephyr_base +repo_to_scan = Repo(zephyr_base) args = None @@ -434,8 +434,8 @@ def parse_args(): errors = 0 if args.repo_to_scan: repository_path = Path(args.repo_to_scan) - if args.commits: repo_to_scan = Repo(repository_path) + if args.commits: commit = repo_to_scan.git.diff("--name-only", args.commits) files = commit.split("\n") elif args.modified_files: From 41e954cd8bd69b8fca87da83c49201b61e088543 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Fri, 17 May 2024 20:11:48 +0200 Subject: [PATCH 1927/2300] [nrf fromtree] scripts: ci: test_plan: add parameter for no of testcase roots Allow to provide from CLI, threshold value for number of test case roots selected for execution base on changed files. When such threshold will be exceeded, full scope will be executed. (cherry picked from commit a7cb8659bd9940c31d6f3e251352bbe39f6ff93b) Signed-off-by: Piotr Kosycarz --- scripts/ci/test_plan.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 6c8b823b128..9fc3c2b000c 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -95,7 +95,7 @@ def __repr__(self): class Filters: def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, - pull_request=False, platforms=[], detailed_test_id=True, quarantine_list=None): + pull_request=False, platforms=[], detailed_test_id=True, quarantine_list=None, tc_roots_th=20): self.modified_files = modified_files self.testsuite_root = testsuite_root self.resolved_files = [] @@ -109,6 +109,7 @@ def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, self.ignore_path = ignore_path self.tag_cfg_file = alt_tags self.quarantine_list = quarantine_list + self.tc_roots_th = tc_roots_th def process(self): self.find_modules() @@ -292,7 +293,7 @@ def find_tests(self): for t in tests: _options.extend(["-T", t ]) - if len(tests) > 20: + if len(tests) > self.tc_roots_th: logging.warning(f"{len(tests)} tests changed, this looks like a global change, skipping test handling, revert to default") self.full_twister = True return @@ -396,6 +397,9 @@ def parse_args(): help="Number of tests per builder") parser.add_argument('-n', '--default-matrix', default=10, type=int, help="Number of tests per builder") + parser.add_argument('--testcase-roots-threshold', default=20, type=int, + help="Threshold value for number of modified testcase roots, up to which an optimized scope is still applied." + "When exceeded, full scope will be triggered") parser.add_argument('--detailed-test-id', action='store_true', help="Include paths to tests' locations in tests' names.") parser.add_argument("--no-detailed-test-id", dest='detailed_test_id', action="store_false", @@ -448,7 +452,7 @@ def parse_args(): print("=========") f = Filters(files, args.ignore_path, args.alt_tags, args.testsuite_root, - args.pull_request, args.platform, args.detailed_test_id, args.quarantine_list) + args.pull_request, args.platform, args.detailed_test_id, args.quarantine_list, args.testcase_roots_threshold) f.process() # remove dupes and filtered cases From 092fc54f66c01ad1e50bd66580989dcb129ab317 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 21 May 2024 16:30:31 +0200 Subject: [PATCH 1928/2300] [nrf noup] samples/**/smp_svr: fix SB_CONFIG_PARTITION_MANAGER injection In sample.yaml: `SB_CONFIG_PARTITION_MANAGER=n` moved to extar_args as extra_config can't handle property with `SB_` prefix. Signed-off-by: Andrzej Puzdrowski --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 00182054eba..3aa3ca449e5 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -122,7 +122,6 @@ tests: - DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" - mcuboot_CONF_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.conf" - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_ext_flash.overlay" - extra_configs: - SB_CONFIG_PARTITION_MANAGER=n platform_allow: - nrf54l15pdk/nrf54l15/cpuapp From ebd324c2783b00f64d000decc1460032dbfcad84 Mon Sep 17 00:00:00 2001 From: Thomas Stilwell Date: Mon, 13 May 2024 13:10:47 +0200 Subject: [PATCH 1929/2300] [nrf noup] test-spec: update boards paths for HWv2 nrf-squash! [nrf noup] test-spec: include nrf54 boards in low-level test trigger nrf-squash! [nrf noup] test-spec: introduce specific ble-sample label nrf-squash! [nrf noup] ci: add .github/test-spec.yml /boards/arm -> /boards/nordic Signed-off-by: Thomas Stilwell --- .github/test-spec.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/test-spec.yml b/.github/test-spec.yml index 876e7eeff04..7f896b3c58f 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -24,13 +24,13 @@ - "subsys/net/**/*" "CI-iot-samples-test": - - "boards/arm/nrf9160dk_nrf9160/**/*" + - "boards/nordic/nrf9160dk/**/*" - "dts/arm/nordic/nrf9160*" - "include/net/**/*" - "subsys/net/lib/**/*" "CI-iot-libraries-test": - - "boards/arm/nrf9160dk_nrf9160/**/*" + - "boards/nordic/nrf9160dk/**/*" - "dts/arm/nordic/nrf9160*" - "include/net/socket_ncs.h" - "subsys/testsuite/ztest/**/*" @@ -46,8 +46,8 @@ - "samples/subsys/mgmt/mcumgr/smp_svr/**/*" "CI-tfm-test": - - "boards/arm/nrf5340dk_nrf5340/**/*" - - "boards/arm/nrf9160dk_nrf9160/**/*" + - "boards/nordic/nrf5340dk/**/*" + - "boards/nordic/nrf9160dk/**/*" - "drivers/entropy/*" - "dts/arm/nordic/nrf5340*" - "dts/arm/nordic/nrf9160*" @@ -98,7 +98,7 @@ - "include/dfu/**/*" "CI-thingy91-test": - - "boards/arm/nrf9160dk_nrf9160/**/*" + - "boards/nordic/nrf9160dk/**/*" - "arch/x86/core/**/*" - "arch/x86/include/**/*" - "drivers/console/**/*" @@ -137,9 +137,9 @@ - "!tests/bluetooth/**/*" "CI-crypto-test": - - "boards/arm/nrf52840dk_nrf52840/**/*" - - "boards/arm/nrf5340dk_nrf5340/**/*" - - "boards/arm/nrf9160dk_nrf9160/**/*" + - "boards/nordic/nrf52840dk/**/*" + - "boards/nordic/nrf5340dk/**/*" + - "boards/nordic/nrf9160dk/**/*" - "drivers/entropy/*" - "drivers/serial/**/*" - "dts/arm/nordic/nrf52840*" @@ -261,7 +261,7 @@ - "!subsys/bluetooth/audio/**/*" "CI-audio-test": - - "boards/arm/nrf5340_audio_dk_nrf5340/**/*" + - "boards/nordic/nrf5340_audio_dk/**/*" - "drivers/flash/**/*" - "drivers/spi/**/*" - "drivers/gpio/**/*" From 41095df79d11e081ea96d150fbe3dbd93f73af6c Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Wed, 15 May 2024 15:19:01 +0200 Subject: [PATCH 1930/2300] [nrf fromlist] boards: nrf54h20dk: Add SUIT storage definition Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72810 Add a definition of SUIT storage, so there will be a common source of the SUIT storage location for both SDFW and scripts generating SUIT storage areas, assigned to local domains. Signed-off-by: Tomasz Chyrowicz --- dts/common/nordic/nrf54h20.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index cbc9197b5d5..c894dab8edf 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -78,6 +78,10 @@ #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)>; }; From 05c1f1d9580633f71fa89ca21aa36634fdda77ec Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1931/2300] Revert "[nrf fromtree] scripts: ci: test_plan: add parameter for no of testcase roots" This reverts commit 41e954cd8bd69b8fca87da83c49201b61e088543. Signed-off-by: Robert Lubos --- scripts/ci/test_plan.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 9fc3c2b000c..6c8b823b128 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -95,7 +95,7 @@ def __repr__(self): class Filters: def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, - pull_request=False, platforms=[], detailed_test_id=True, quarantine_list=None, tc_roots_th=20): + pull_request=False, platforms=[], detailed_test_id=True, quarantine_list=None): self.modified_files = modified_files self.testsuite_root = testsuite_root self.resolved_files = [] @@ -109,7 +109,6 @@ def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, self.ignore_path = ignore_path self.tag_cfg_file = alt_tags self.quarantine_list = quarantine_list - self.tc_roots_th = tc_roots_th def process(self): self.find_modules() @@ -293,7 +292,7 @@ def find_tests(self): for t in tests: _options.extend(["-T", t ]) - if len(tests) > self.tc_roots_th: + if len(tests) > 20: logging.warning(f"{len(tests)} tests changed, this looks like a global change, skipping test handling, revert to default") self.full_twister = True return @@ -397,9 +396,6 @@ def parse_args(): help="Number of tests per builder") parser.add_argument('-n', '--default-matrix', default=10, type=int, help="Number of tests per builder") - parser.add_argument('--testcase-roots-threshold', default=20, type=int, - help="Threshold value for number of modified testcase roots, up to which an optimized scope is still applied." - "When exceeded, full scope will be triggered") parser.add_argument('--detailed-test-id', action='store_true', help="Include paths to tests' locations in tests' names.") parser.add_argument("--no-detailed-test-id", dest='detailed_test_id', action="store_false", @@ -452,7 +448,7 @@ def parse_args(): print("=========") f = Filters(files, args.ignore_path, args.alt_tags, args.testsuite_root, - args.pull_request, args.platform, args.detailed_test_id, args.quarantine_list, args.testcase_roots_threshold) + args.pull_request, args.platform, args.detailed_test_id, args.quarantine_list) f.process() # remove dupes and filtered cases From 91b2184b46a5556578022cdfb290fa5e337ba761 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1932/2300] Revert "[nrf fromtree] scripts: ci: test_plan: fix usage with files" This reverts commit 9818f530c87b070c33c827f9d1945c7c4bda5d7e. Signed-off-by: Robert Lubos --- scripts/ci/test_plan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 6c8b823b128..625d47a7805 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -24,7 +24,7 @@ # however, pylint complains that it doesn't recognized them when used (used-before-assignment). zephyr_base = Path(os.environ['ZEPHYR_BASE']) repository_path = zephyr_base -repo_to_scan = Repo(zephyr_base) +repo_to_scan = zephyr_base args = None @@ -434,8 +434,8 @@ def parse_args(): errors = 0 if args.repo_to_scan: repository_path = Path(args.repo_to_scan) - repo_to_scan = Repo(repository_path) if args.commits: + repo_to_scan = Repo(repository_path) commit = repo_to_scan.git.diff("--name-only", args.commits) files = commit.split("\n") elif args.modified_files: From b2106e8478afdb7e506bb3c10dc29b198659d870 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1933/2300] Revert "[nrf fromlist] tests: storage: flash_map: _NODE macros" This reverts commit 706f82bc1b8aaaadbe7b56745bb1574a87ddd470. Signed-off-by: Robert Lubos --- tests/subsys/storage/flash_map/src/main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/subsys/storage/flash_map/src/main.c b/tests/subsys/storage/flash_map/src/main.c index e66f6ac7e0f..07430fc766e 100644 --- a/tests/subsys/storage/flash_map/src/main.c +++ b/tests/subsys/storage/flash_map/src/main.c @@ -13,7 +13,6 @@ #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) extern int flash_map_entries; struct flash_sector fs_sectors[256]; @@ -191,15 +190,4 @@ ZTEST(flash_map, test_flash_area_erased_val) flash_area_close(fa); } -ZTEST(flash_map, test_fixed_partition_node_macros) -{ - /* Test against changes in API */ - zassert_equal(FIXED_PARTITION_NODE_OFFSET(SLOT1_PARTITION_NODE), - DT_REG_ADDR(SLOT1_PARTITION_NODE)); - zassert_equal(FIXED_PARTITION_NODE_SIZE(SLOT1_PARTITION_NODE), - DT_REG_SIZE(SLOT1_PARTITION_NODE)); - zassert_equal(FIXED_PARTITION_NODE_DEVICE(SLOT1_PARTITION_NODE), - DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(SLOT1_PARTITION_NODE))); -} - ZTEST_SUITE(flash_map, NULL, NULL, NULL, NULL, NULL); From 253d1524c6a7726024701a6be67dbcd6d93044f6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1934/2300] Revert "[nrf fromlist] include: storage: flash_map: _NODE macros" This reverts commit af6ac3ac77137ba38bfd043c950fb2b934eaa964. Signed-off-by: Robert Lubos --- include/zephyr/storage/flash_map.h | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index c76ca18bae2..c53cbef8957 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -305,15 +305,6 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); */ #define FIXED_PARTITION_OFFSET(label) DT_REG_ADDR(DT_NODELABEL(label)) -/** - * Get fixed-partition offset from DTS node - * - * @param node DTS node of a partition - * - * @return fixed-partition offset, as defined for the partition in DTS. - */ -#define FIXED_PARTITION_NODE_OFFSET(node) DT_REG_ADDR(node) - /** * Get fixed-partition size for DTS node label * @@ -323,15 +314,6 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); */ #define FIXED_PARTITION_SIZE(label) DT_REG_SIZE(DT_NODELABEL(label)) -/** - * Get fixed-partition size for DTS node - * - * @param node DTS node of a partition - * - * @return fixed-partition size, as defined for the partition in DTS. - */ -#define FIXED_PARTITION_NODE_SIZE(node) DT_REG_SIZE(node) - /** * Get device pointer for device the area/partition resides on * @@ -352,16 +334,6 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_DEVICE(label) \ DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))) -/** - * Get device pointer for device the area/partition resides on - * - * @param node DTS node of a partition - * - * @return Pointer to a device. - */ -#define FIXED_PARTITION_NODE_DEVICE(node) \ - DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(node)) - #endif /* USE_PARTITION_MANAGER */ #ifdef __cplusplus From 62c84e0220b28156b9608ce49f9b8c469e78223e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1935/2300] Revert "[nrf fromtree] twister: Fix path to binary location for unit_testing board" This reverts commit dd586c683bd75c35815d097b24eb65d0f7f0b454. Signed-off-by: Robert Lubos --- scripts/pylib/twister/twisterlib/handlers.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index c8399a59ce5..6ea8f5165c1 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -250,8 +250,6 @@ def _create_command(self, robot_test): command = [self.generator_cmd, "run_renode_test"] elif self.call_make_run: command = [self.generator_cmd, "run"] - elif self.instance.testsuite.type == "unit": - command = [self.binary] else: binary = os.path.join(self.get_default_domain_build_dir(), "zephyr", "zephyr.exe") command = [binary] From 3329e8e18c18bb2f98fe1f7e646e85f4f6be08ee Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1936/2300] Revert "[nrf fromlist] twister: Allow to run sysbuild with native_sim" This reverts commit 33c8345d3bdc6280f252afd5eab638a4267dc114. Signed-off-by: Robert Lubos --- scripts/pylib/twister/twisterlib/handlers.py | 58 +++++++++++++------- scripts/tests/twister/test_handlers.py | 11 ++-- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index 6ea8f5165c1..d6dff8f0195 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -75,6 +75,7 @@ def __init__(self, instance, type_str="build"): self.run = False self.type_str = type_str + self.binary = None self.pid_fn = None self.call_make_run = True @@ -166,19 +167,6 @@ def _final_handle_actions(self, harness, handler_time): self.record(harness) - def get_default_domain_build_dir(self): - if self.instance.testsuite.sysbuild: - # Load domain yaml to get default domain build directory - # Note: for targets using QEMU, we assume that the target will - # have added any additional images to the run target manually - domain_path = os.path.join(self.build_dir, "domains.yaml") - domains = Domains.from_file(domain_path) - logger.debug("Loaded sysbuild domain data from %s" % domain_path) - build_dir = domains.get_default_domain().build_dir - else: - build_dir = self.build_dir - return build_dir - class BinaryHandler(Handler): def __init__(self, instance, type_str): @@ -251,8 +239,7 @@ def _create_command(self, robot_test): elif self.call_make_run: command = [self.generator_cmd, "run"] else: - binary = os.path.join(self.get_default_domain_build_dir(), "zephyr", "zephyr.exe") - command = [binary] + command = [self.binary] if self.options.enable_valgrind: command = ["valgrind", "--error-exitcode=2", @@ -357,6 +344,7 @@ def __init__(self, instance, type_str): self.pid_fn = os.path.join(instance.build_dir, "renode.pid") elif type_str == 'native': self.call_make_run = False + self.binary = os.path.join(instance.build_dir, "zephyr", "zephyr.exe") self.ready = True @@ -961,6 +949,20 @@ def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn, QEMUHandler._thread_close_files(fifo_in, fifo_out, pid, out_fp, in_fp, log_out_fp) + def _get_sysbuild_build_dir(self): + if self.instance.testsuite.sysbuild: + # Load domain yaml to get default domain build directory + # Note: for targets using QEMU, we assume that the target will + # have added any additional images to the run target manually + domain_path = os.path.join(self.build_dir, "domains.yaml") + domains = Domains.from_file(domain_path) + logger.debug("Loaded sysbuild domain data from %s" % domain_path) + build_dir = domains.get_default_domain().build_dir + else: + build_dir = self.build_dir + + return build_dir + def _set_qemu_filenames(self, sysbuild_build_dir): # We pass this to QEMU which looks for fifos with .in and .out suffixes. # QEMU fifo will use main build dir @@ -992,11 +994,11 @@ def _update_instance_info(self, harness_state, is_timeout): def handle(self, harness): self.run = True - domain_build_dir = self.get_default_domain_build_dir() + sysbuild_build_dir = self._get_sysbuild_build_dir() - command = self._create_command(domain_build_dir) + command = self._create_command(sysbuild_build_dir) - self._set_qemu_filenames(domain_build_dir) + self._set_qemu_filenames(sysbuild_build_dir) self.thread = threading.Thread(name=self.name, target=QEMUHandler._thread, args=(self, self.get_test_timeout(), self.build_dir, @@ -1136,6 +1138,20 @@ def _monitor_update_instance_info(handler, handler_time, out_state): handler.instance.status = out_state handler.instance.reason = "Unknown" + def _get_sysbuild_build_dir(self): + if self.instance.testsuite.sysbuild: + # Load domain yaml to get default domain build directory + # Note: for targets using QEMU, we assume that the target will + # have added any additional images to the run target manually + domain_path = os.path.join(self.build_dir, "domains.yaml") + domains = Domains.from_file(domain_path) + logger.debug("Loaded sysbuild domain data from %s" % domain_path) + build_dir = domains.get_default_domain().build_dir + else: + build_dir = self.build_dir + + return build_dir + def _set_qemu_filenames(self, sysbuild_build_dir): # PID file will be created in the main sysbuild app's build dir self.pid_fn = os.path.join(sysbuild_build_dir, "qemu.pid") @@ -1275,9 +1291,9 @@ def _monitor_output(self, queue, timeout, logfile, pid_fn, harness, ignore_unexp def handle(self, harness): self.run = True - domain_build_dir = self.get_default_domain_build_dir() - command = self._create_command(domain_build_dir) - self._set_qemu_filenames(domain_build_dir) + sysbuild_build_dir = self._get_sysbuild_build_dir() + command = self._create_command(sysbuild_build_dir) + self._set_qemu_filenames(sysbuild_build_dir) logger.debug("Running %s (%s)" % (self.name, self.type_str)) is_timeout = False diff --git a/scripts/tests/twister/test_handlers.py b/scripts/tests/twister/test_handlers.py index dd0686906db..7eddd016ca9 100644 --- a/scripts/tests/twister/test_handlers.py +++ b/scripts/tests/twister/test_handlers.py @@ -448,7 +448,7 @@ def wait(self, *args, **kwargs): '--log-file=build_dir/valgrind.log', '--track-origins=yes', 'generator', 'run_renode_test']), (False, True, False, 123, None, ['generator', 'run', '--seed=123']), - (False, False, False, None, ['ex1', 'ex2'], ['build_dir/zephyr/zephyr.exe', 'ex1', 'ex2']), + (False, False, False, None, ['ex1', 'ex2'], ['bin', 'ex1', 'ex2']), ] @pytest.mark.parametrize( @@ -474,7 +474,6 @@ def test_binaryhandler_create_command( handler.seed = seed handler.extra_test_args = extra_args handler.build_dir = 'build_dir' - handler.instance.testsuite.sysbuild = False command = handler._create_command(robot_test) @@ -1479,7 +1478,7 @@ def mock_process(pid): TESTDATA_19, ids=['domains build dir', 'self build dir'] ) -def test_qemuhandler_get_default_domain_build_dir( +def test_qemuhandler_get_sysbuild_build_dir( mocked_instance, self_sysbuild, self_build_dir, @@ -1496,7 +1495,7 @@ def test_qemuhandler_get_default_domain_build_dir( handler.build_dir = self_build_dir with mock.patch('domains.Domains.from_file', from_file_mock): - result = handler.get_default_domain_build_dir() + result = handler._get_sysbuild_build_dir() assert result == expected @@ -2018,7 +2017,7 @@ def mock_filenames(sysbuild_build_dir): harness = mock.Mock(state=harness_state) handler_options_west_flash = [] - domain_build_dir = os.path.join('sysbuild', 'dummydir') + sysbuild_build_dir = os.path.join('sysbuild', 'dummydir') command = ['generator_cmd', '-C', os.path.join('cmd', 'path'), 'run'] handler.options = mock.Mock( @@ -2031,7 +2030,7 @@ def mock_filenames(sysbuild_build_dir): handler._final_handle_actions = mock.Mock(return_value=None) handler._create_command = mock.Mock(return_value=command) handler._set_qemu_filenames = mock.Mock(side_effect=mock_filenames) - handler.get_default_domain_build_dir = mock.Mock(return_value=domain_build_dir) + handler._get_sysbuild_build_dir = mock.Mock(return_value=sysbuild_build_dir) handler.terminate = mock.Mock() unlink_mock = mock.Mock() From e14790d076413ff1deef6bcbdf708da2d8edc673 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1937/2300] Revert "[nrf fromtree] scripts: twister: Remove Handler atavisms" This reverts commit 2e8f954db9372b7e25ce783cbf3decfc73e596bb. Signed-off-by: Robert Lubos --- scripts/pylib/twister/twisterlib/handlers.py | 12 ++++++++++-- scripts/pylib/twister/twisterlib/testinstance.py | 1 + scripts/tests/twister/test_handlers.py | 16 +++++++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index d6dff8f0195..ae283c1722e 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -72,6 +72,7 @@ def __init__(self, instance, type_str="build"): """ self.options = None + self.state = "waiting" self.run = False self.type_str = type_str @@ -85,6 +86,7 @@ def __init__(self, instance, type_str="build"): self.build_dir = instance.build_dir self.log = os.path.join(self.build_dir, "handler.log") self.returncode = 0 + self.generator = None self.generator_cmd = None self.suite_name_check = True self.ready = False @@ -176,6 +178,7 @@ def __init__(self, instance, type_str): """ super().__init__(instance, type_str) + self.call_west_flash = False self.seed = None self.extra_test_args = None self.line = b"" @@ -238,6 +241,8 @@ def _create_command(self, robot_test): command = [self.generator_cmd, "run_renode_test"] elif self.call_make_run: command = [self.generator_cmd, "run"] + elif self.call_west_flash: + command = ["west", "flash", "--skip-rebuild", "-d", self.build_dir] else: command = [self.binary] @@ -851,7 +856,7 @@ def _thread_update_instance_info(handler, handler_time, out_state): handler.instance.reason = "Unknown" @staticmethod - def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn, + def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn, results, harness, ignore_unexpected_eof=False): fifo_in, fifo_out = QEMUHandler._thread_get_fifo_names(fifo_fn) @@ -992,6 +997,7 @@ def _update_instance_info(self, harness_state, is_timeout): self.instance.add_missing_case_status("blocked") def handle(self, harness): + self.results = {} self.run = True sysbuild_build_dir = self._get_sysbuild_build_dir() @@ -1003,7 +1009,7 @@ def handle(self, harness): self.thread = threading.Thread(name=self.name, target=QEMUHandler._thread, args=(self, self.get_test_timeout(), self.build_dir, self.log_fn, self.fifo_fn, - self.pid_fn, harness, + self.pid_fn, self.results, harness, self.ignore_unexpected_eof)) self.thread.daemon = True @@ -1082,6 +1088,7 @@ def __init__(self, instance, type_str): self.pid = 0 self.thread = None self.stop_thread = False + self.results = {} if instance.testsuite.ignore_qemu_crash: self.ignore_qemu_crash = True @@ -1289,6 +1296,7 @@ def _monitor_output(self, queue, timeout, logfile, pid_fn, harness, ignore_unexp self._stop_qemu_process(self.pid) def handle(self, harness): + self.results = {} self.run = True sysbuild_build_dir = self._get_sysbuild_build_dir() diff --git a/scripts/pylib/twister/twisterlib/testinstance.py b/scripts/pylib/twister/twisterlib/testinstance.py index 5be57e1deb6..5ec183a6a87 100644 --- a/scripts/pylib/twister/twisterlib/testinstance.py +++ b/scripts/pylib/twister/twisterlib/testinstance.py @@ -201,6 +201,7 @@ def setup_handler(self, env): if handler: handler.options = options handler.generator_cmd = env.generator_cmd + handler.generator = env.generator handler.suite_name_check = not options.disable_suite_name_check self.handler = handler diff --git a/scripts/tests/twister/test_handlers.py b/scripts/tests/twister/test_handlers.py index 7eddd016ca9..219d90a89d6 100644 --- a/scripts/tests/twister/test_handlers.py +++ b/scripts/tests/twister/test_handlers.py @@ -442,25 +442,28 @@ def wait(self, *args, **kwargs): TESTDATA_4 = [ - (True, False, True, None, None, + (True, False, False, True, None, None, ['valgrind', '--error-exitcode=2', '--leak-check=full', f'--suppressions={ZEPHYR_BASE}/scripts/valgrind.supp', '--log-file=build_dir/valgrind.log', '--track-origins=yes', 'generator', 'run_renode_test']), - (False, True, False, 123, None, ['generator', 'run', '--seed=123']), - (False, False, False, None, ['ex1', 'ex2'], ['bin', 'ex1', 'ex2']), + (False, True, False, False, 123, None, ['generator', 'run', '--seed=123']), + (False, False, True, False, None, None, + ['west', 'flash', '--skip-rebuild', '-d', 'build_dir']), + (False, False, False, False, None, ['ex1', 'ex2'], ['bin', 'ex1', 'ex2']), ] @pytest.mark.parametrize( - 'robot_test, call_make_run, enable_valgrind, seed,' \ + 'robot_test, call_make_run, call_west_flash, enable_valgrind, seed,' \ ' extra_args, expected', TESTDATA_4, - ids=['robot, valgrind', 'make run, seed', 'binary, extra'] + ids=['robot, valgrind', 'make run, seed', 'west flash', 'binary, extra'] ) def test_binaryhandler_create_command( mocked_instance, robot_test, call_make_run, + call_west_flash, enable_valgrind, seed, extra_args, @@ -470,6 +473,7 @@ def test_binaryhandler_create_command( handler.generator_cmd = 'generator' handler.binary = 'bin' handler.call_make_run = call_make_run + handler.call_west_flash = call_west_flash handler.options = mock.Mock(enable_valgrind=enable_valgrind) handler.seed = seed handler.extra_test_args = extra_args @@ -1889,6 +1893,7 @@ def mock_cputime(pid): type(mocked_instance.testsuite).timeout = mock.PropertyMock(return_value=timeout) handler = QEMUHandler(mocked_instance, 'build') + handler.results = {} handler.ignore_unexpected_eof = False handler.pid_fn = 'pid_fn' handler.fifo_fn = 'fifo_fn' @@ -1948,6 +1953,7 @@ def mocked_open(filename, *args, **kwargs): handler.log, handler.fifo_fn, handler.pid_fn, + handler.results, harness, handler.ignore_unexpected_eof ) From 4976bbcd3b9639aaa6674f7cc82c2d1675b88e1b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1938/2300] Revert "[nrf fromtree] twister: allow using west-flash with 'erase'" This reverts commit 9354bce7c3d56a20f9d5b398fb25ea1d785792d2. Signed-off-by: Robert Lubos --- scripts/pylib/twister/twisterlib/runner.py | 8 +++++++- scripts/tests/twister/test_runner.py | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 1e8dc3b1a68..28e3dae80cd 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -496,11 +496,17 @@ def parse_generated(self, filter_stages=[]): if self.testsuite.sysbuild and self.env.options.device_testing: # Verify that twister's arguments support sysbuild. # Twister sysbuild flashing currently only works with west, so - # --west-flash must be passed. + # --west-flash must be passed. Additionally, erasing the DUT + # before each test with --west-flash=--erase will inherently not + # work with sysbuild. if self.env.options.west_flash is None: logger.warning("Sysbuild test will be skipped. " + "West must be used for flashing.") return {os.path.join(self.platform.name, self.testsuite.name): True} + elif "--erase" in self.env.options.west_flash: + logger.warning("Sysbuild test will be skipped, " + + "--erase is not supported with --west-flash") + return {os.path.join(self.platform.name, self.testsuite.name): True} if self.testsuite and self.testsuite.filter: try: diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index df034b8c00c..b07ab333f89 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -554,6 +554,20 @@ def mock_popen(*args, **kwargs): ['Sysbuild test will be skipped. West must be used for flashing.'], {os.path.join('other', 'dummy.testsuite.name'): True} ), + ( + 'other', ['other'], True, + False, ['--erase'], True, + 'Dummy parse results', True, + None, + None, + {}, + {}, + None, + b'dummy edt pickle contents', + ['Sysbuild test will be skipped,' \ + ' --erase is not supported with --west-flash'], + {os.path.join('other', 'dummy.testsuite.name'): True} + ), ( 'other', ['other'], False, True, None, False, @@ -637,7 +651,7 @@ def mock_popen(*args, **kwargs): ' expected_logs, expected_return', TESTDATA_3, ids=['unit testing', 'domain', 'kconfig', 'no cache', - 'no west options', 'no edt', + 'no west options', 'erase west flash option', 'no edt', 'parse result', 'no parse result', 'no testsuite filter', 'parse err'] ) def test_filterbuilder_parse_generated( From 056101d0ebd7ab80b37839c71fc4fd3785516326 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1939/2300] Revert "[nrf fromtree] ipc_service: backends: icbmsg: Silence maybe-uninitialized warning" This reverts commit f726a48e30d4c0c9164e51ae549bbc52c4479f6e. Signed-off-by: Robert Lubos --- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index 37594025313..c7127888b18 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -470,7 +470,7 @@ static int release_tx_buffer(struct backend_data *dev_data, const uint8_t *buffe int new_size) { const struct icbmsg_config *conf = dev_data->conf; - size_t size = 0; + size_t size; int tx_block_index; tx_block_index = buffer_to_index_validate(&conf->tx, buffer, &size); From 71cb9e45dfdd9e00d37a7f26fdc1d8fd4e96ae39 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1940/2300] Revert "[nrf fromtree] boards: nordic: nrf54h20dk: Add counter to the supported peripherals" This reverts commit 25fbeabe900442d0568090765851aa452c4d8947. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml index 2f83ef80de6..198f4db403b 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml @@ -12,7 +12,6 @@ toolchain: ram: 256 flash: 512 supported: - - counter - gpio - pwm - spi diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index e36f2e21ffe..53bbff4a460 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -12,7 +12,6 @@ toolchain: ram: 192 flash: 256 supported: - - counter - gpio - pwm - spi From 02570f204ceef915c02d0e64609546bf0d4b3f3d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1941/2300] Revert "[nrf fromtree] posix: env: Fix 2 build warnings" This reverts commit 668b0460c46c7d0d329d4bf521acc395adbe825d. Signed-off-by: Robert Lubos --- lib/posix/options/env.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/posix/options/env.c b/lib/posix/options/env.c index 56d3b4ae543..2607ae2a4be 100644 --- a/lib/posix/options/env.c +++ b/lib/posix/options/env.c @@ -106,7 +106,7 @@ int getenv_r(const char *name, char *buf, size_t len) ret = -ERANGE; K_SPINLOCK_BREAK; } - strcpy(buf, val); + strncpy(buf, val, vsize); LOG_DBG("Found entry %s", environ[ret]); } @@ -188,7 +188,7 @@ int setenv(const char *name, const char *val, int overwrite) environ[ret] = env; } - strcpy(environ[ret], name); + strncpy(environ[ret], name, nsize); environ[ret][nsize] = '='; strncpy(environ[ret] + nsize + 1, val, vsize + 1); LOG_DBG("Added entry %s", environ[ret]); From 6a1a42f559fdb402ae798859a12fcffeaad470c7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:11 +0200 Subject: [PATCH 1942/2300] Revert "[nrf fromtree] samples: subsys: settings: Run sample on nrf54h20" This reverts commit 49762d522dba9bdd297f61b829e7778403da7204. Signed-off-by: Robert Lubos --- samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 2 -- samples/subsys/settings/sample.yaml | 1 - 2 files changed, 3 deletions(-) delete mode 100644 samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf diff --git a/samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf deleted file mode 100644 index 3746c13c741..00000000000 --- a/samples/subsys/settings/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_NVS=y -CONFIG_SETTINGS_NVS=y diff --git a/samples/subsys/settings/sample.yaml b/samples/subsys/settings/sample.yaml index e4a9e148c5a..3ab57ee0923 100644 --- a/samples/subsys/settings/sample.yaml +++ b/samples/subsys/settings/sample.yaml @@ -13,7 +13,6 @@ tests: - native_sim/native/64 - mr_canhubk3 - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - native_sim harness: console From 0ef2e1049c1f7db54bcac6a3ef1699ba28f335a8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1943/2300] Revert "[nrf fromtree] samples: drivers: watchdog: Add overlay files for nrf54l15/cpuflpr" This reverts commit 4708107b793a1ad9438168924a5eb5b94ed44750. Signed-off-by: Robert Lubos --- .../watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay | 8 -------- .../boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay | 8 -------- 2 files changed, 16 deletions(-) delete mode 100644 samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay delete mode 100644 samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay diff --git a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay deleted file mode 100644 index 66157d79fb3..00000000000 --- a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt30 { - status = "okay"; -}; diff --git a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay deleted file mode 100644 index 66157d79fb3..00000000000 --- a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt30 { - status = "okay"; -}; From b37a02be8625b2226d56d1f6f9a119225badb637 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1944/2300] Revert "[nrf fromtree] boards: nordic: nrf54h20dk: Define alias watchdog0" This reverts commit a90ac03df4228159b1c1022c73f7249535386c09. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 736588e22b1..136197d2767 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -39,7 +39,6 @@ sw1 = &button1; sw2 = &button2; sw3 = &button3; - watchdog0 = &wdt010; }; buttons { From da10878d14bac63c2ee112fa5358c5b4f21770c2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1945/2300] Revert "[nrf fromtree] samples: drivers: watchdog: Run sample on nrf54h20" This reverts commit ce37c17343f0ef264373d359447815e5c80a99c4. Signed-off-by: Robert Lubos --- .../watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 94e0d719af4..00000000000 --- a/samples/drivers/watchdog/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt010 { - status = "okay"; -}; From 1389ce4c026ccd14bcbbff9ba4c9fd186aeb5586 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1946/2300] Revert "[nrf fromtree] tests: drivers: Update uart_elementary suite with different configuration" This reverts commit aa69cb93da07e9402e551bd912ded090581e7700. Signed-off-by: Robert Lubos --- tests/drivers/uart/uart_elementary/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index da8fa4f6690..df8c7b54b10 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -233,15 +233,15 @@ ZTEST(uart_elementary, test_uart_dual_port_transmission) { int err; struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_EVEN, - .stop_bits = UART_CFG_STOP_BITS_2, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, .data_bits = UART_CFG_DATA_BITS_8, .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; #if defined(CONFIG_SETUP_MISMATCH_TEST) struct uart_config test_uart_config_aux = { .baudrate = 9600, - .parity = UART_CFG_PARITY_EVEN, - .stop_bits = UART_CFG_STOP_BITS_2, + .parity = UART_CFG_PARITY_NONE, + .stop_bits = UART_CFG_STOP_BITS_1, .data_bits = UART_CFG_DATA_BITS_8, .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; #endif From a6d8eec0355bbcd98e81acc55d0b85072eb07980 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1947/2300] Revert "[nrf fromtree] tests: drivers: Add more test cases for the i2c driver in controller mode" This reverts commit 7af1810cb391b630f064f4cd8f277981a13e9221. Signed-off-by: Robert Lubos --- tests/drivers/i2c/i2c_bme688/CMakeLists.txt | 9 - tests/drivers/i2c/i2c_bme688/README.txt | 6 - tests/drivers/i2c/i2c_bme688/prj.conf | 2 - tests/drivers/i2c/i2c_bme688/src/main.c | 286 -------------------- tests/drivers/i2c/i2c_bme688/src/sensor.c | 105 ------- tests/drivers/i2c/i2c_bme688/src/sensor.h | 163 ----------- tests/drivers/i2c/i2c_bme688/testcase.yaml | 6 - 7 files changed, 577 deletions(-) delete mode 100644 tests/drivers/i2c/i2c_bme688/CMakeLists.txt delete mode 100644 tests/drivers/i2c/i2c_bme688/README.txt delete mode 100644 tests/drivers/i2c/i2c_bme688/prj.conf delete mode 100644 tests/drivers/i2c/i2c_bme688/src/main.c delete mode 100644 tests/drivers/i2c/i2c_bme688/src/sensor.c delete mode 100644 tests/drivers/i2c/i2c_bme688/src/sensor.h delete mode 100644 tests/drivers/i2c/i2c_bme688/testcase.yaml diff --git a/tests/drivers/i2c/i2c_bme688/CMakeLists.txt b/tests/drivers/i2c/i2c_bme688/CMakeLists.txt deleted file mode 100644 index 0e4b8e8a8b6..00000000000 --- a/tests/drivers/i2c/i2c_bme688/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(i2c_bme688) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/i2c/i2c_bme688/README.txt b/tests/drivers/i2c/i2c_bme688/README.txt deleted file mode 100644 index b0ac29c8a97..00000000000 --- a/tests/drivers/i2c/i2c_bme688/README.txt +++ /dev/null @@ -1,6 +0,0 @@ -I2C bus controller to BME688 sensor test -######################################## - -This test verifies I2C target driver API methods -with external sensors device - Bosch BME688. -I2C speed is set to standard. diff --git a/tests/drivers/i2c/i2c_bme688/prj.conf b/tests/drivers/i2c/i2c_bme688/prj.conf deleted file mode 100644 index 4b19609ecfb..00000000000 --- a/tests/drivers/i2c/i2c_bme688/prj.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_I2C=y -CONFIG_ZTEST=y diff --git a/tests/drivers/i2c/i2c_bme688/src/main.c b/tests/drivers/i2c/i2c_bme688/src/main.c deleted file mode 100644 index 7041e579c13..00000000000 --- a/tests/drivers/i2c/i2c_bme688/src/main.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include "sensor.h" - -#define SENSOR_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(bosch_bme680) -#define I2C_TEST_NODE DT_PARENT(SENSOR_NODE) -#define DEVICE_ADDRESS (uint8_t)DT_REG_ADDR(SENSOR_NODE) - -static const struct device *const i2c_device = DEVICE_DT_GET(I2C_TEST_NODE); -static struct calibration_coeffs cal_coeffs; -static int32_t t_fine; - -/* Read data from the senors register */ -static uint8_t read_sensor_register(uint8_t register_address) -{ - int err; - uint8_t response = 0; - - err = i2c_reg_read_byte(i2c_device, DEVICE_ADDRESS, register_address, &response); - zassert_equal(err, 0, "i2c_read(%x)' failed with error: %d\n", register_address, err); - TC_PRINT("I2C read reg, addr: 0x%x, val: 0x%x\n", register_address, response); - return response; -} - -/* Burst read data from the sensor registers */ -static void burst_read_sensor_registers(uint8_t starting_register_address, uint8_t number_of_bytes, - uint8_t *data_buffer) -{ - int err; - - zassert_true(number_of_bytes <= MAX_BURST_READ_SIZE, - "Too many bytes to read %d, max burst read size is set to: %d", - number_of_bytes, MAX_BURST_READ_SIZE); - err = i2c_burst_read(i2c_device, DEVICE_ADDRESS, starting_register_address, data_buffer, - number_of_bytes); - zassert_equal(err, 0, "i2c_burst_read(%x, %x)' failed with error: %d\n", - starting_register_address, number_of_bytes, err); - TC_PRINT("I2C burst read, start addr: 0x%x, number of bytes: %d\n", - starting_register_address, number_of_bytes); -} - -/* Write sensor register */ -static void write_sensor_register(uint8_t register_address, int8_t value) -{ - int err; - - err = i2c_reg_write_byte(i2c_device, DEVICE_ADDRESS, register_address, value); - zassert_equal(err, 0, "i2c_reg_write_byte(%x, %x)' failed with error: %d\n", - register_address, value, err); - TC_PRINT("I2C reg write, addr: 0x%x, val: 0x%x\n", register_address, value); -} - -/* Set IIR filter for the temperature and pressure measurements */ -static void set_sensor_iir_filter(void) -{ - uint8_t response = 0; - - TC_PRINT("Set IIR filter\n"); - response = read_sensor_register(CONF_REGISTER_ADDRESS); - response &= ~IIR_FILER_ORDER_BIT_MASK; - response |= IIR_FILER_COEFF_3 << IIR_FILER_ORDER_BIT_SHIFT; - write_sensor_register(CONF_REGISTER_ADDRESS, response); - read_sensor_register(CONF_REGISTER_ADDRESS); -} - -/* Read calibration coefficients for temperature, humifity and pressure */ -static void read_calibration_coeffs(struct calibration_coeffs *coeffs) -{ - uint8_t register_data[MAX_BURST_READ_SIZE] = { 0 }; - - /* Humidity */ - TC_PRINT("Reading humidity calibration coefficients\n"); - burst_read_sensor_registers(HUMI_PAR_REGISTERS_START_ADDRESS, HUMI_PAR_REGISTERS_COUNT, - register_data); - coeffs->par_h1 = (uint16_t)(((uint16_t)register_data[HUMI_PAR_H1_MSB_BUF_POSITION] << 4) | - (register_data[HUMI_PAR_H1_LSB_BUF_POSITION] & - HUMI_PAR_H1_LSB_BIT_MASK)); - coeffs->par_h2 = (uint16_t)(((uint16_t)register_data[HUMI_PAR_H2_MSB_BUF_POSITION] << 4) | - ((register_data[HUMI_PAR_H2_LSB_BUF_POSITION]) >> 4)); - - coeffs->par_h3 = (uint8_t)register_data[HUMI_PAR_H3_BUF_POSITION]; - coeffs->par_h4 = (uint8_t)register_data[HUMI_PAR_H4_BUF_POSITION]; - coeffs->par_h5 = (uint8_t)register_data[HUMI_PAR_H5_BUF_POSITION]; - coeffs->par_h6 = (uint8_t)register_data[HUMI_PAR_H6_BUF_POSITION]; - coeffs->par_h7 = (uint8_t)register_data[HUMI_PAR_H7_BUF_POSITION]; - - /* Temperature */ - TC_PRINT("Reading temperature calibration coefficients\n"); - burst_read_sensor_registers(TEMP_PAR_T1_REGISTER_ADDRESS_LSB, 2, register_data); - coeffs->par_t1 = (uint16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); - burst_read_sensor_registers(TEMP_PAR_T2_REGISTER_ADDRESS_LSB, 2, register_data); - coeffs->par_t2 = (uint16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); - coeffs->par_t3 = (uint8_t)read_sensor_register(TEMP_PAR_T3_REGISTER_ADDRESS); - - /* Pressure */ - TC_PRINT("Reading pressure calibration coefficients\n"); - burst_read_sensor_registers(PRES_PAR_P1_REGISTER_ADDRESS_LSB, 4, register_data); - coeffs->par_p1 = (uint16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); - coeffs->par_p2 = (int16_t)(((uint16_t)register_data[3] << 8) | (uint16_t)register_data[2]); - coeffs->par_p3 = (int8_t)read_sensor_register(PRES_PAR_P3_REGISTER_ADDRESS); - burst_read_sensor_registers(PRES_PAR_P4_REGISTER_ADDRESS_LSB, 4, register_data); - coeffs->par_p4 = (int16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); - coeffs->par_p5 = (int16_t)(((uint16_t)register_data[3] << 8) | (uint16_t)register_data[2]); - coeffs->par_p6 = (int8_t)read_sensor_register(PRES_PAR_P6_REGISTER_ADDRESS); - coeffs->par_p7 = (int8_t)read_sensor_register(PRES_PAR_P7_REGISTER_ADDRESS); - burst_read_sensor_registers(PRES_PAR_P8_REGISTER_ADDRESS_LSB, 4, register_data); - coeffs->par_p8 = (int16_t)(((uint16_t)register_data[1] << 8) | (uint16_t)register_data[0]); - coeffs->par_p9 = (int16_t)(((uint16_t)register_data[3] << 8) | (uint16_t)register_data[2]); - coeffs->par_p10 = read_sensor_register(PRES_PAR_P10_REGISTER_ADDRESS); -} - -/* Configure temperature, pressure and humidity measurements */ -static void configure_measurements(void) -{ - unsigned char response = 0; - - TC_PRINT("Configure measurements\n"); - - /* Humidity */ - response = read_sensor_register(CTRL_HUM_REGISTER_ADDRESS); - response &= ~HUMIDITY_OVERSAMPLING_BIT_MSK; - response |= HUMIDITY_OVERSAMPLING_1X << HUMIDITY_OVERSAMPLING_BIT_SHIFT; - write_sensor_register(CTRL_HUM_REGISTER_ADDRESS, response); - - /* Temperature*/ - response = read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); - response &= ~TEMP_OVERSAMPLING_BIT_MSK; - response |= TEMPERATURE_OVERSAMPLING_2X << TEMP_OVERSAMPLING_BIT_SHIFT; - - write_sensor_register(CTRL_MEAS_REGISTER_ADDRESS, response); - - /* Pressure */ - response = read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); - response &= ~PRES_OVERSAMPLING_BIT_MSK; - response |= PRESSURE_OVERSAMPLING_16X << PRES_OVERSAMPLING_BIT_SHIFT; - - write_sensor_register(CTRL_MEAS_REGISTER_ADDRESS, response); - read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); - set_sensor_iir_filter(); -} - -/* Set the sensor operation mode */ -static void set_sensor_mode(uint8_t sensor_mode) -{ - unsigned char response = 0; - - TC_PRINT("Set sensor mode to: 0x%x\n", sensor_mode); - - response = read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); - response &= ~CTRL_MEAS_MODE_BIT_MSK; - response |= sensor_mode << CTRL_MEAS_MODE_BIT_SHIFT; - write_sensor_register(CTRL_MEAS_REGISTER_ADDRESS, response); - read_sensor_register(CTRL_MEAS_REGISTER_ADDRESS); -} - -/* Read the raw ADC temperature measurement result */ -static uint32_t read_adc_temperature(void) -{ - uint32_t adc_temperature = 0; - - TC_PRINT("Reading ADC temperature\n"); - adc_temperature = (uint32_t)(((uint32_t)read_sensor_register(TEMP_ADC_DATA_MSB_0) << 12) | - ((uint32_t)read_sensor_register(TEMP_ADC_DATA_LSB_0) << 4) | - ((uint32_t)read_sensor_register(TEMP_ADC_DATA_XLSB_0) >> 4)); - - return adc_temperature; -} - -/* Read the raw ADC pressure measurement result */ -static uint32_t read_adc_pressure(void) -{ - uint32_t pres_adc = 0; - - TC_PRINT("Reading ADC pressure\n"); - pres_adc = (uint32_t)(((uint32_t)read_sensor_register(PRES_ADC_DATA_MSB_0) << 12) | - ((uint32_t)read_sensor_register(PRES_ADC_DATA_LSB_0) << 4) | - ((uint32_t)read_sensor_register(PRES_ADC_DATA_XLSB_0) >> 4)); - - return pres_adc; -} - -/* Read the raw ADC humidity measurement result */ -static uint16_t read_adc_humidity(void) -{ - uint16_t hum_adc = 0; - - TC_PRINT("Reading ADC humidity\n"); - hum_adc = (uint16_t)(((uint16_t)read_sensor_register(HUM_ADC_DATA_MSB_0) << 8) | - (uint16_t)read_sensor_register(HUM_ADC_DATA_LSB_0)); - - return hum_adc; -} - -ZTEST(i2c_controller_to_sensor, test_i2c_basic_memory_read) -{ - int err; - uint8_t entire_sensor_memory[SENSOR_MEMORY_SIZE_IN_BYTES] = { 0 }; - - TC_PRINT("Device address 0x%x\n", DEVICE_ADDRESS); - - err = i2c_read(i2c_device, entire_sensor_memory, SENSOR_MEMORY_SIZE_IN_BYTES, - DEVICE_ADDRESS); - zassert_equal(err, 0, "i2c_read' failed with error: %d\n", err); -} - -ZTEST(i2c_controller_to_sensor, test_i2c_controlled_sensor_operation) -{ - int err; - uint8_t response = 0; - int16_t temperature = 0; - uint32_t pressure = 0; - uint32_t humidity = 0; - uint32_t i2c_config = I2C_SPEED_SET(I2C_SPEED_STANDARD) | I2C_MODE_CONTROLLER; - uint8_t measurements_left = MEASUREMENT_CYCLES + 1; - - TC_PRINT("Device address 0x%x\n", DEVICE_ADDRESS); - - err = i2c_configure(i2c_device, i2c_config); - zassert_equal(err, 0, "i2c_configure' failed with error: %d\n", err); - - response = read_sensor_register(CHIP_ID_REGISTER_ADDRESS); - TC_PRINT("Chip_Id: %d\n", response); - - response = read_sensor_register(VARIANT_ID_REGISTER_ADDRESS); - TC_PRINT("Variant_Id: %d\n", response); - - write_sensor_register(RESET_REGISTER_ADDRESS, RESET_DEVICE); - k_sleep(K_MSEC(SLEEP_TIME_MS)); - - read_calibration_coeffs(&cal_coeffs); - - configure_measurements(); - set_sensor_mode(FORCED_MODE); - - while (measurements_left) { - response = read_sensor_register(MEAS_STATUS_0_REG_ADDRESS); - TC_PRINT("Meas status 0, meas in progress: %d, new data: %d\n", - response & MEASUREMENT_IN_PROGRESS_BIT_MASK, - response & MEASUREMENT_NEW_DATA_BIT_MASK); - if (response & MEASUREMENT_NEW_DATA_BIT_MASK) { - temperature = - calculate_temperature(read_adc_temperature(), &t_fine, &cal_coeffs); - pressure = calculate_pressure(read_adc_pressure(), t_fine, &cal_coeffs); - humidity = calculate_humidity(read_adc_humidity(), t_fine, &cal_coeffs); - TC_PRINT("Temperature: %d.%d C deg\n", temperature / 100, - temperature % 100); - TC_PRINT("Pressure: %d hPa\n", pressure / 100); - TC_PRINT("Humidity: %d %%\n", humidity / 1000); - set_sensor_mode(FORCED_MODE); - - /* Check if the results are within reasonable ranges - * for laboratory room usage - * This is asserted to catch values - * that may be results of an erroneous - * bus operation (corrupted read or write) - */ - zassert_true( - (temperature / 100 >= 5) && (temperature / 100 <= 55), - "Temperature is outside of the allowed range for labroatory use"); - zassert_true((pressure / 100 >= 700) && (pressure / 100 <= 1300), - "Pressure is outside of the allowed range for labroatory use"); - zassert_true((humidity / 1000 >= 10) && (humidity / 1000 <= 90), - "Humidity is outside of the allowed range for labroatory use"); - measurements_left--; - } - k_sleep(K_MSEC(SLEEP_TIME_MS)); - } -} - -/* - * Test setup - */ -void *test_setup(void) -{ - zassert_true(device_is_ready(i2c_device), "i2c device is not ready"); - return NULL; -} - -ZTEST_SUITE(i2c_controller_to_sensor, NULL, test_setup, NULL, NULL, NULL); diff --git a/tests/drivers/i2c/i2c_bme688/src/sensor.c b/tests/drivers/i2c/i2c_bme688/src/sensor.c deleted file mode 100644 index d351b31e707..00000000000 --- a/tests/drivers/i2c/i2c_bme688/src/sensor.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "sensor.h" - -/* Calculate the compensated temperature */ -int32_t calculate_temperature(uint32_t adc_temp, int32_t *t_fine, - struct calibration_coeffs *cal_coeffs) -{ - int16_t temperature_compensated = 0; - int64_t var1, var2, var3; - - var1 = ((int32_t)adc_temp >> 3) - ((int32_t)cal_coeffs->par_t1 << 1); - var2 = (var1 * (int32_t)cal_coeffs->par_t2) >> 11; - var3 = ((var1 >> 1) * (var1 >> 1)) >> 12; - var3 = ((var3) * ((int32_t)cal_coeffs->par_t3 << 4)) >> 14; - *t_fine = var2 + var3; - temperature_compensated = (int16_t)(((*t_fine * 5) + 128) >> 8); - return temperature_compensated; -} - -/* Calculate the compensated pressure - * Note: temperature must be calculated first - * to obtain the 't_fine' - */ -uint32_t calculate_pressure(uint32_t pres_adc, int32_t t_fine, - struct calibration_coeffs *cal_coeffs) -{ - int32_t var1; - int32_t var2; - int32_t var3; - int32_t pressure_comp; - const int32_t pres_ovf_check = INT32_C(0x40000000); - - var1 = (((int32_t)t_fine) >> 1) - 64000; - var2 = ((((var1 >> 2) * (var1 >> 2)) >> 11) * (int32_t)cal_coeffs->par_p6) >> 2; - var2 = var2 + ((var1 * (int32_t)cal_coeffs->par_p5) << 1); - var2 = (var2 >> 2) + ((int32_t)cal_coeffs->par_p4 << 16); - var1 = (((((var1 >> 2) * (var1 >> 2)) >> 13) * ((int32_t)cal_coeffs->par_p3 << 5)) >> 3) + - (((int32_t)cal_coeffs->par_p2 * var1) >> 1); - var1 = var1 >> 18; - var1 = ((32768 + var1) * (int32_t)cal_coeffs->par_p1) >> 15; - pressure_comp = 1048576 - pres_adc; - pressure_comp = (int32_t)((pressure_comp - (var2 >> 12)) * ((uint32_t)3125)); - if (pressure_comp >= pres_ovf_check) { - pressure_comp = ((pressure_comp / var1) << 1); - } else { - pressure_comp = ((pressure_comp << 1) / var1); - } - - var1 = ((int32_t)cal_coeffs->par_p9 * - (int32_t)(((pressure_comp >> 3) * (pressure_comp >> 3)) >> 13)) >> - 12; - var2 = ((int32_t)(pressure_comp >> 2) * (int32_t)cal_coeffs->par_p8) >> 13; - var3 = ((int32_t)(pressure_comp >> 8) * (int32_t)(pressure_comp >> 8) * - (int32_t)(pressure_comp >> 8) * (int32_t)cal_coeffs->par_p10) >> - 17; - pressure_comp = (int32_t)(pressure_comp) + - ((var1 + var2 + var3 + ((int32_t)cal_coeffs->par_p7 << 7)) >> 4); - - return (uint32_t)pressure_comp; -} - -/* Calculate the relative humidity - * Note: temperature must be calculated first - * to obtain the 't_fine' - */ -uint32_t calculate_humidity(uint16_t hum_adc, int32_t t_fine, struct calibration_coeffs *cal_coeffs) -{ - int32_t var1; - int32_t var2; - int32_t var3; - int32_t var4; - int32_t var5; - int32_t var6; - int32_t temp_scaled; - int32_t calc_hum; - - temp_scaled = (((int32_t)t_fine * 5) + 128) >> 8; - var1 = (int32_t)(hum_adc - ((int32_t)((int32_t)cal_coeffs->par_h1 * 16))) - - (((temp_scaled * (int32_t)cal_coeffs->par_h3) / ((int32_t)100)) >> 1); - var2 = ((int32_t)cal_coeffs->par_h2 * - (((temp_scaled * (int32_t)cal_coeffs->par_h4) / ((int32_t)100)) + - (((temp_scaled * ((temp_scaled * (int32_t)cal_coeffs->par_h5) / ((int32_t)100))) >> - 6) / - ((int32_t)100)) + - (int32_t)(1 << 14))) >> - 10; - var3 = var1 * var2; - var4 = (int32_t)cal_coeffs->par_h6 << 7; - var4 = ((var4) + ((temp_scaled * (int32_t)cal_coeffs->par_h7) / ((int32_t)100))) >> 4; - var5 = ((var3 >> 14) * (var3 >> 14)) >> 10; - var6 = (var4 * var5) >> 1; - calc_hum = (((var3 + var6) >> 10) * ((int32_t)1000)) >> 12; - if (calc_hum > 100000) { - calc_hum = 100000; - } else if (calc_hum < 0) { - calc_hum = 0; - } - - return (uint32_t)calc_hum; -} diff --git a/tests/drivers/i2c/i2c_bme688/src/sensor.h b/tests/drivers/i2c/i2c_bme688/src/sensor.h deleted file mode 100644 index cac5addb33e..00000000000 --- a/tests/drivers/i2c/i2c_bme688/src/sensor.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef SENSOR_H -#define SENSOR_H - -#include - -#define SLEEP_TIME_MS 250 -#define MEASUREMENT_CYCLES 3 -#define MAX_BURST_READ_SIZE 10 - -/* General */ -#define CHIP_ID_REGISTER_ADDRESS 0xD0 -#define VARIANT_ID_REGISTER_ADDRESS 0xF0 -#define CONF_REGISTER_ADDRESS 0x75 -#define CTRL_MEAS_REGISTER_ADDRESS 0x74 -#define CTRL_HUM_REGISTER_ADDRESS 0x72 -#define RESET_REGISTER_ADDRESS 0xE0 -#define SLEEP_MODE 0x0 -#define FORCED_MODE 0x1 -#define CTRL_MEAS_MODE_BIT_MSK 1 << 1 | 1 -#define CTRL_MEAS_MODE_BIT_SHIFT 0 -#define RESET_DEVICE 0xB6 -#define SENSOR_MEMORY_SIZE_IN_BYTES 255 - -/* Calibration coeffcients */ -#define TEMP_PAR_T1_REGISTER_ADDRESS_LSB 0xE9 -#define TEMP_PAR_T1_REGISTER_ADDRESS_MSB 0xEA -#define TEMP_PAR_T2_REGISTER_ADDRESS_LSB 0x8A -#define TEMP_PAR_T2_REGISTER_ADDRESS_MSB 0x8B -#define TEMP_PAR_T3_REGISTER_ADDRESS 0x8C - -#define HUMI_PAR_REGISTERS_START_ADDRESS 0xE1 -#define HUMI_PAR_REGISTERS_COUNT 8 -#define HUMI_PAR_H1_LSB_BUF_POSITION 1 -#define HUMI_PAR_H1_MSB_BUF_POSITION 2 -#define HUMI_PAR_H2_LSB_BUF_POSITION 1 -#define HUMI_PAR_H2_MSB_BUF_POSITION 0 -#define HUMI_PAR_H3_BUF_POSITION 3 -#define HUMI_PAR_H4_BUF_POSITION 4 -#define HUMI_PAR_H5_BUF_POSITION 5 -#define HUMI_PAR_H6_BUF_POSITION 6 -#define HUMI_PAR_H7_BUF_POSITION 7 - -#define HUMI_PAR_H1_REGISTER_ADDRESS_LSB 0xE2 -#define HUMI_PAR_H1_LSB_BIT_MASK 0xFF -#define HUMI_PAR_H1_REGISTER_ADDRESS_MSB 0xE3 -#define HUMI_PAR_H2_REGISTER_ADDRESS_LSB 0xE2 -#define HUMI_PAR_H2_REGISTER_ADDRESS_MSB 0xE1 -#define HUMI_PAR_H3_REGISTER_ADDRESS 0xE4 -#define HUMI_PAR_H4_REGISTER_ADDRESS 0xE5 -#define HUMI_PAR_H5_REGISTER_ADDRESS 0xE6 -#define HUMI_PAR_H6_REGISTER_ADDRESS 0xE7 -#define HUMI_PAR_H7_REGISTER_ADDRESS 0xE8 - -#define PRES_PAR_P1_REGISTER_ADDRESS_LSB 0x8E -#define PRES_PAR_P1_REGISTER_ADDRESS_MSB 0x8F -#define PRES_PAR_P2_REGISTER_ADDRESS_LSB 0x90 -#define PRES_PAR_P2_REGISTER_ADDRESS_MSB 0x91 -#define PRES_PAR_P3_REGISTER_ADDRESS 0x92 -#define PRES_PAR_P4_REGISTER_ADDRESS_LSB 0x94 -#define PRES_PAR_P4_REGISTER_ADDRESS_MSB 0x95 -#define PRES_PAR_P5_REGISTER_ADDRESS_LSB 0x96 -#define PRES_PAR_P5_REGISTER_ADDRESS_MSB 0x97 -#define PRES_PAR_P6_REGISTER_ADDRESS 0x99 -#define PRES_PAR_P7_REGISTER_ADDRESS 0x98 -#define PRES_PAR_P8_REGISTER_ADDRESS_LSB 0x9C -#define PRES_PAR_P8_REGISTER_ADDRESS_MSB 0x9D -#define PRES_PAR_P9_REGISTER_ADDRESS_LSB 0x9E -#define PRES_PAR_P9_REGISTER_ADDRESS_MSB 0x9F -#define PRES_PAR_P10_REGISTER_ADDRESS 0xA0 - -/* IIR filter */ -#define IIR_FILER_ORDER_BIT_MASK 1 << 4 | 1 << 3 | 1 << 2 -#define IIR_FILER_ORDER_BIT_SHIFT 2 -#define IIR_FILER_COEFF_3 0x2 - -/* Temperature measurement */ -#define TEMPERATURE_OVERSAMPLING_2X 0x2 -#define TEMP_OVERSAMPLING_BIT_MSK 1 << 7 | 1 << 6 | 1 << 5 -#define TEMP_OVERSAMPLING_BIT_SHIFT 5 - -#define TEMP_ADC_DATA_MSB_0 0x22 -#define TEMP_ADC_DATA_LSB_0 0x23 -#define TEMP_ADC_DATA_XLSB_0 0x24 - -/* Pressure measurement */ -#define PRESSURE_OVERSAMPLING_16X 0x5 -#define PRES_OVERSAMPLING_BIT_MSK 1 << 4 | 1 << 3 | 1 << 2 -#define PRES_OVERSAMPLING_BIT_SHIFT 2 - -#define PRES_ADC_DATA_MSB_0 0x1F -#define PRES_ADC_DATA_LSB_0 0x20 -#define PRES_ADC_DATA_XLSB_0 0x21 - -/* Humidity measurement */ -#define HUMIDITY_OVERSAMPLING_1X 0x1 -#define HUMIDITY_OVERSAMPLING_BIT_MSK 1 << 2 | 1 << 1 | 1 -#define HUMIDITY_OVERSAMPLING_BIT_SHIFT 0 - -#define HUM_ADC_DATA_MSB_0 0x25 -#define HUM_ADC_DATA_LSB_0 0x26 - -/* Measurement status */ -#define MEAS_STATUS_0_REG_ADDRESS 0x1D -#define MEAS_STATUS_1_REG_ADDRESS 0x2E -#define MEAS_STATUS_2_REG_ADDRESS 0x3F -#define MEASUREMENT_IN_PROGRESS_BIT_MASK 1 << 5 -#define MEASUREMENT_NEW_DATA_BIT_MASK 1 << 7 - -struct calibration_coeffs { - /* Temperature */ - uint16_t par_t1; - uint16_t par_t2; - uint8_t par_t3; - - /* Humidity */ - uint16_t par_h1; - uint16_t par_h2; - uint8_t par_h3; - uint8_t par_h4; - uint8_t par_h5; - uint8_t par_h6; - uint8_t par_h7; - - /* Pressure */ - uint16_t par_p1; - int16_t par_p2; - int8_t par_p3; - int16_t par_p4; - int16_t par_p5; - int8_t par_p6; - int8_t par_p7; - int16_t par_p8; - int16_t par_p9; - uint8_t par_p10; -}; - -/* Calculate the compensated temperature - * Note: 't_fine' is required for other measurements - */ -int32_t calculate_temperature(uint32_t adc_temp, int32_t *t_fine, - struct calibration_coeffs *cal_coeffs); - -/* Calculate the compensated pressure - * Note: temperature must be calculated first - * to obtain the 't_fine' - */ -uint32_t calculate_pressure(uint32_t pres_adc, int32_t t_fine, - struct calibration_coeffs *cal_coeffs); - -/* Calculate the relative humidity - * Note: temperature must be calculated first - * to obtain the 't_fine' - */ -uint32_t calculate_humidity(uint16_t hum_adc, int32_t t_fine, - struct calibration_coeffs *cal_coeffs); - -#endif diff --git a/tests/drivers/i2c/i2c_bme688/testcase.yaml b/tests/drivers/i2c/i2c_bme688/testcase.yaml deleted file mode 100644 index e36d79089f9..00000000000 --- a/tests/drivers/i2c/i2c_bme688/testcase.yaml +++ /dev/null @@ -1,6 +0,0 @@ -common: - tags: drivers i2c - depends_on: i2c -tests: - drivers.i2c.bme688: - filter: dt_compat_enabled("bosch,bme680") From ce3c3ac445bdd468128ee872bcdf6aab495568e3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1948/2300] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: Disable watchdog tests on Radio core" This reverts commit 7f128a1027b50b69f5a69cfd8f01c093302f1a50. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index 53bbff4a460..68d169331ef 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -15,3 +15,4 @@ supported: - gpio - pwm - spi + - watchdog From e68284253dad0c0a2ae5360ec22cdf7a2a3d76bc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1949/2300] Revert "[nrf fromtree] boards: nordic: nrf54h20dk: Enable SPI driver tests in Twister" This reverts commit 52850014d63b074b8f73c3bf5869a45cbd07e7d4. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml index 198f4db403b..107aa0be67f 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml @@ -14,5 +14,4 @@ flash: 512 supported: - gpio - pwm - - spi - watchdog diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index 68d169331ef..32375faf481 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -14,5 +14,4 @@ flash: 256 supported: - gpio - pwm - - spi - watchdog From 593c4a5de2bb059ab2392bdd6e0203bb808bc957 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1950/2300] Revert "[nrf fromtree] tests: drivers: watchdog: wdt_error_cases: Run test on nRF54H20" This reverts commit ed65de8f6cc645575a47f07d4833338b63c1c5e4. Signed-off-by: Robert Lubos --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 21 ------------------- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 21 ------------------- .../watchdog/wdt_error_cases/src/main.c | 2 +- .../watchdog/wdt_error_cases/testcase.yaml | 2 -- 4 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index d540137dadb..00000000000 --- a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt010 { - status = "okay"; -}; - -&wdt011 { - status = "disabled"; -}; - -&wdt131 { - status = "disabled"; -}; - -&wdt132 { - status = "disabled"; -}; diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index 7793fed2b8e..00000000000 --- a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt010 { - status = "disabled"; -}; - -&wdt011 { - status = "okay"; -}; - -&wdt131 { - status = "disabled"; -}; - -&wdt132 { - status = "disabled"; -}; diff --git a/tests/drivers/watchdog/wdt_error_cases/src/main.c b/tests/drivers/watchdog/wdt_error_cases/src/main.c index 65569ad30a4..fc453ba3b32 100644 --- a/tests/drivers/watchdog/wdt_error_cases/src/main.c +++ b/tests/drivers/watchdog/wdt_error_cases/src/main.c @@ -42,7 +42,7 @@ #define DEFAULT_WINDOW_MIN (0U) /* Align tests to the specific target: */ -#if defined(CONFIG_SOC_NRF54L15) || defined(CONFIG_SOC_NRF54H20) +#if defined(CONFIG_SOC_NRF54L15) #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/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml index 4fdbfaa1a4c..c408d2f8f1d 100644 --- a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml +++ b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml @@ -9,7 +9,5 @@ tests: drivers.watchdog.wdt_error_cases: platform_allow: - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad integration_platforms: - nrf54l15pdk/nrf54l15/cpuapp From a7157eca60c1f70fcc6ea29bbeafd67081134772 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1951/2300] Revert "[nrf fromtree] drivers: wdt: nrf: Add WDT instances that exist in nrf54h20" This reverts commit 3708cb038bc544252f2674af1b3f9824dcb57959. Signed-off-by: Robert Lubos --- .../nrf54h20dk_nrf54h20_cpuapp.yaml | 1 - .../nrf54h20dk_nrf54h20_cpurad.yaml | 1 - drivers/watchdog/Kconfig.nrfx | 4 --- drivers/watchdog/wdt_nrfx.c | 16 ----------- dts/arm/nordic/nrf54h20_cpuapp.dtsi | 2 -- dts/arm/nordic/nrf54h20_cpurad.dtsi | 2 -- dts/common/nordic/nrf54h20.dtsi | 28 ------------------- modules/hal_nordic/nrfx/Kconfig | 10 ------- modules/hal_nordic/nrfx/nrfx_config.h | 6 ---- soc/nordic/common/Kconfig.peripherals | 6 ---- soc/nordic/validate_base_addresses.c | 4 --- 11 files changed, 80 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml index 107aa0be67f..6ecde2cfdb1 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml @@ -14,4 +14,3 @@ flash: 512 supported: - gpio - pwm - - watchdog diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index 32375faf481..b199f65385f 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -14,4 +14,3 @@ flash: 256 supported: - gpio - pwm - - watchdog diff --git a/drivers/watchdog/Kconfig.nrfx b/drivers/watchdog/Kconfig.nrfx index 61f42d8ff31..2967fe86489 100644 --- a/drivers/watchdog/Kconfig.nrfx +++ b/drivers/watchdog/Kconfig.nrfx @@ -11,11 +11,7 @@ config WDT_NRFX select NRFX_WDT1 if HAS_HW_NRF_WDT1 select NRFX_WDT30 if HAS_HW_NRF_WDT30 select NRFX_WDT31 if HAS_HW_NRF_WDT31 - select NRFX_WDT010 if HAS_HW_NRF_WDT010 - select NRFX_WDT011 if HAS_HW_NRF_WDT011 select NRFX_WDT130 if HAS_HW_NRF_WDT130 - select NRFX_WDT131 if HAS_HW_NRF_WDT131 - select NRFX_WDT132 if HAS_HW_NRF_WDT132 help Enable support for nrfx WDT driver for nRF MCU series. diff --git a/drivers/watchdog/wdt_nrfx.c b/drivers/watchdog/wdt_nrfx.c index 706c2621bbb..57b4dba828c 100644 --- a/drivers/watchdog/wdt_nrfx.c +++ b/drivers/watchdog/wdt_nrfx.c @@ -220,22 +220,6 @@ WDT_NRFX_WDT_DEVICE(30); WDT_NRFX_WDT_DEVICE(31); #endif -#ifdef CONFIG_HAS_HW_NRF_WDT010 -WDT_NRFX_WDT_DEVICE(010); -#endif - -#ifdef CONFIG_HAS_HW_NRF_WDT011 -WDT_NRFX_WDT_DEVICE(011); -#endif - #ifdef CONFIG_HAS_HW_NRF_WDT130 WDT_NRFX_WDT_DEVICE(130); #endif - -#ifdef CONFIG_HAS_HW_NRF_WDT131 -WDT_NRFX_WDT_DEVICE(131); -#endif - -#ifdef CONFIG_HAS_HW_NRF_WDT132 -WDT_NRFX_WDT_DEVICE(132); -#endif diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi index 1cfa3dddb55..9d011019f4a 100644 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -11,8 +11,6 @@ systick: &cpuapp_systick {}; nvic: &cpuapp_nvic {}; cpuppr_vevif: &cpuppr_vevif_remote {}; cpusys_vevif: &cpusys_vevif_remote {}; -wdt010: &cpuapp_wdt010 {}; -wdt011: &cpuapp_wdt011 {}; /delete-node/ &cpuppr; /delete-node/ &cpurad; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index e4a7469dac5..2a62845dc89 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -11,8 +11,6 @@ systick: &cpurad_systick {}; nvic: &cpurad_nvic {}; cpuppr_vevif: &cpuppr_vevif_remote {}; cpusys_vevif: &cpusys_vevif_remote {}; -wdt010: &cpurad_wdt010 {}; -wdt011: &cpurad_wdt011 {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index c894dab8edf..4ab1a63f1ca 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -173,20 +173,6 @@ <65 NRF_DEFAULT_IRQ_PRIORITY>; }; - cpuapp_wdt010: watchdog@14000 { - compatible = "nordic,nrf-wdt"; - reg = <0x14000 0x1000>; - status = "disabled"; - interrupts = <20 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - cpuapp_wdt011: watchdog@15000 { - compatible = "nordic,nrf-wdt"; - reg = <0x15000 0x1000>; - status = "disabled"; - interrupts = <21 NRF_DEFAULT_IRQ_PRIORITY>; - }; - cpuapp_resetinfo: resetinfo@1e000 { compatible = "nordic,nrf-resetinfo"; reg = <0x1e000 0x1000>; @@ -211,20 +197,6 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; - cpurad_wdt010: watchdog@13000 { - compatible = "nordic,nrf-wdt"; - reg = <0x13000 0x1000>; - status = "disabled"; - interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - cpurad_wdt011: watchdog@14000 { - compatible = "nordic,nrf-wdt"; - reg = <0x14000 0x1000>; - status = "disabled"; - interrupts = <20 NRF_DEFAULT_IRQ_PRIORITY>; - }; - cpurad_resetinfo: resetinfo@1e000 { compatible = "nordic,nrf-resetinfo"; reg = <0x1e000 0x1000>; diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 37059183891..32386d54274 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -980,16 +980,6 @@ config NRFX_WDT31 depends on $(dt_nodelabel_has_compat,wdt31,$(DT_COMPAT_NORDIC_NRF_WDT)) select NRFX_WDT -config NRFX_WDT010 - bool "WDT010 driver instance" - depends on $(dt_nodelabel_has_compat,wdt010,$(DT_COMPAT_NORDIC_NRF_WDT)) - select NRFX_WDT - -config NRFX_WDT011 - bool "WDT011 driver instance" - depends on $(dt_nodelabel_has_compat,wdt011,$(DT_COMPAT_NORDIC_NRF_WDT)) - select NRFX_WDT - config NRFX_WDT130 bool "WDT130 driver instance" depends on $(dt_nodelabel_has_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 6072f3634f4..e7120b54ab7 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -824,12 +824,6 @@ #ifdef CONFIG_NRFX_WDT31 #define NRFX_WDT31_ENABLED 1 #endif -#ifdef CONFIG_NRFX_WDT010 -#define NRFX_WDT010_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_WDT011 -#define NRFX_WDT011_ENABLED 1 -#endif #ifdef CONFIG_NRFX_WDT130 #define NRFX_WDT130_ENABLED 1 #endif diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index f9b01417677..f0adc82d44a 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -644,12 +644,6 @@ config HAS_HW_NRF_WDT30 config HAS_HW_NRF_WDT31 def_bool $(dt_nodelabel_enabled_with_compat,wdt31,$(DT_COMPAT_NORDIC_NRF_WDT)) -config HAS_HW_NRF_WDT010 - def_bool $(dt_nodelabel_enabled_with_compat,wdt010,$(DT_COMPAT_NORDIC_NRF_WDT)) - -config HAS_HW_NRF_WDT011 - def_bool $(dt_nodelabel_enabled_with_compat,wdt011,$(DT_COMPAT_NORDIC_NRF_WDT)) - config HAS_HW_NRF_WDT130 def_bool $(dt_nodelabel_enabled_with_compat,wdt130,$(DT_COMPAT_NORDIC_NRF_WDT)) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 6874fe9c62e..5c9f31c9c1f 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -337,10 +337,6 @@ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); CHECK_DT_REG(wdt30, NRF_WDT30); CHECK_DT_REG(wdt31, NRF_WDT31); -CHECK_DT_REG(cpuapp_wdt010, NRF_APPLICATION_WDT010); -CHECK_DT_REG(cpuapp_wdt011, NRF_APPLICATION_WDT011); -CHECK_DT_REG(cpurad_wdt010, NRF_RADIOCORE_WDT010); -CHECK_DT_REG(cpurad_wdt011, NRF_RADIOCORE_WDT011); CHECK_DT_REG(wdt131, NRF_WDT131); CHECK_DT_REG(wdt132, NRF_WDT132); From 8c57344620771868fc10208de9f3785de7aa439d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1952/2300] Revert "[nrf fromtree] samples: sensor: qdec: Run sample on nrf54h20" This reverts commit 4db075fed24f7cc2b88de82a63149cea5b1253b6. Signed-off-by: Robert Lubos --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 43 ------------------- samples/sensor/qdec/sample.yaml | 2 - 2 files changed, 45 deletions(-) delete mode 100644 samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 748e06aef83..00000000000 --- a/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2024 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - aliases { - qdec0 = &qdec130; - qenca = &phase_a; - qencb = &phase_b; - }; - - encoder-emulate { - compatible = "gpio-leds"; - phase_a: phase_a { - gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; - }; - phase_b: phase_b { - gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pinctrl { - qdec_pinctrl: qdec_pinctrl { - group1 { - psels = , - ; - }; - }; -}; - -&gpio1 { - status = "okay"; -}; - -&qdec130 { - status = "okay"; - pinctrl-0 = <&qdec_pinctrl>; - pinctrl-names = "default"; - steps = <120>; - led-pre = <500>; -}; diff --git a/samples/sensor/qdec/sample.yaml b/samples/sensor/qdec/sample.yaml index 52e19e8bb18..8982dfccd33 100644 --- a/samples/sensor/qdec/sample.yaml +++ b/samples/sensor/qdec/sample.yaml @@ -22,12 +22,10 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp integration_platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp harness_config: fixture: gpio_loopback type: multi_line From f29831c6c80d50f478821ffffbe5fe26a5cc3c27 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1953/2300] Revert "[nrf fromtree] drivers: nrf: rram: Support TF-M" This reverts commit c7b46f9d1f79450bdeea5423f9577f7c262a496c. Signed-off-by: Robert Lubos --- drivers/flash/soc_flash_nrf_rram.c | 55 ++---------------------------- 1 file changed, 3 insertions(+), 52 deletions(-) diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index b8ab3afa8fe..714e4dca3b6 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -17,26 +17,6 @@ #include -/* Note that it is supported to compile this driver for both secure - * and non-secure images, but non-secure images cannot call - * nrf_rramc_config_set because NRF_RRAMC_NS does not exist. - * - * Instead, when TF-M boots, it will configure RRAMC with this static - * configuration: - * - * nrf_rramc_config_t config = { - * .mode_write = true, - * .write_buff_size = WRITE_BUFFER_SIZE - * }; - * - * nrf_rramc_ready_next_timeout_t params = { - * .value = CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE, - * .enable = true, - * }; - * - * For more details see NCSDK-26982. - */ - LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL); #define RRAM DT_INST(0, soc_nv_flash) @@ -105,43 +85,19 @@ static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start } #if WRITE_BUFFER_ENABLE -static void commit_changes(off_t addr, size_t len) +static void commit_changes(size_t len) { -#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) if (nrf_rramc_empty_buffer_check(NRF_RRAMC)) { /* The internal write-buffer has been committed to RRAM and is now empty. */ return; } -#endif if ((len % (WRITE_BUFFER_MAX_SIZE)) == 0) { /* Our last operation was buffer size-aligned, so we're done. */ return; } -#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) - ARG_UNUSED(addr); - nrf_rramc_task_trigger(NRF_RRAMC, NRF_RRAMC_TASK_COMMIT_WRITEBUF); -#else - /* - * When the commit task is unavailable we need to get creative to - * ensure this is committed. - * - * According to the PS the buffer is committed when "There is a - * read operation from a 128-bit word line in the buffer that has - * already been written to". - * - * So we read the last byte that has been written to trigger this - * commit. - * - * If this approach proves to be problematic, e.g. for writes to - * write-only memory, then one would have to rely on - * READYNEXTTIMEOUT to eventually commit the write. - */ - volatile uint8_t dummy_read = *(volatile uint8_t *)(addr + len - 1); - ARG_UNUSED(dummy_read); -#endif barrier_dmem_fence_full(); } @@ -149,11 +105,9 @@ static void commit_changes(off_t addr, size_t len) static void rram_write(off_t addr, const void *data, size_t len) { -#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) nrf_rramc_config_t config = {.mode_write = true, .write_buff_size = WRITE_BUFFER_SIZE}; nrf_rramc_config_set(NRF_RRAMC, &config); -#endif if (data) { memcpy((void *)addr, data, len); @@ -164,13 +118,11 @@ static void rram_write(off_t addr, const void *data, size_t len) barrier_dmem_fence_full(); /* Barrier following our last write. */ #if WRITE_BUFFER_ENABLE - commit_changes(addr, len); + commit_changes(len); #endif -#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) config.mode_write = false; nrf_rramc_config_set(NRF_RRAMC, &config); -#endif } #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE @@ -346,12 +298,11 @@ static int nrf_rram_init(const struct device *dev) nrf_flash_sync_init(); #endif /* !CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE */ -#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE > 0 +#if CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE > 0 nrf_rramc_ready_next_timeout_t params = { .value = CONFIG_NRF_RRAM_READYNEXT_TIMEOUT_VALUE, .enable = true, }; - nrf_rramc_ready_next_timeout_set(NRF_RRAMC, ¶ms); #endif From 3e9a5417de5ebe7565d700361fcbdf8dcbbce5fd Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1954/2300] Revert "[nrf fromtree] Bluetooth: Host: Fix auto-connect/sync establishment on Coded PHY" This reverts commit 7e216169f12643f909d19f5cc543e1f7c1c94705. Signed-off-by: Robert Lubos --- subsys/bluetooth/host/scan.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index 4ee6b46307f..e3421c387de 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -289,7 +289,7 @@ static int start_le_scan_legacy(uint8_t scan_type, uint16_t interval, uint16_t w return 0; } -static int start_host_initiated_scan(bool fast_scan) +static int start_passive_scan(bool fast_scan) { uint16_t interval, window; @@ -303,19 +303,13 @@ static int start_host_initiated_scan(bool fast_scan) if (IS_ENABLED(CONFIG_BT_EXT_ADV) && BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features)) { - struct bt_hci_ext_scan_phy scan_phy_params; + struct bt_hci_ext_scan_phy scan; - scan_phy_params.type = BT_HCI_LE_SCAN_PASSIVE; - scan_phy_params.interval = sys_cpu_to_le16(interval); - scan_phy_params.window = sys_cpu_to_le16(window); - - /* Scan on 1M + Coded if the controller supports it*/ - if (BT_FEAT_LE_PHY_CODED(bt_dev.le.features)) { - return start_le_scan_ext(&scan_phy_params, &scan_phy_params, 0); - } else { - return start_le_scan_ext(&scan_phy_params, NULL, 0); - } + scan.type = BT_HCI_LE_SCAN_PASSIVE; + scan.interval = sys_cpu_to_le16(interval); + scan.window = sys_cpu_to_le16(window); + return start_le_scan_ext(&scan, NULL, 0); } return start_le_scan_legacy(BT_HCI_LE_SCAN_PASSIVE, interval, window); @@ -358,14 +352,14 @@ int bt_le_scan_update(bool fast_scan) bt_conn_unref(conn); /* Start/Restart the scanner */ - return start_host_initiated_scan(fast_scan); + return start_passive_scan(fast_scan); } } #if defined(CONFIG_BT_PER_ADV_SYNC) if (get_pending_per_adv_sync()) { /* Start/Restart the scanner. */ - return start_host_initiated_scan(fast_scan); + return start_passive_scan(fast_scan); } #endif From f106e76aed1c3d47ad8aa09453047cd24f216c5c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1955/2300] Revert "[nrf fromtree] Bluetooth: Host: Document bt_le_scan_update()" This reverts commit 724fc55cbda6174e64cd6f8e18c67b09dfb22475. Signed-off-by: Robert Lubos --- subsys/bluetooth/host/hci_core.h | 23 ----------------------- subsys/bluetooth/host/scan.c | 5 ----- 2 files changed, 28 deletions(-) diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index dc6b52c51c8..d037d0add9d 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -440,29 +440,6 @@ uint8_t bt_get_phy(uint8_t hci_phy); * @return CTE type (@ref bt_df_cte_type). */ int bt_get_df_cte_type(uint8_t hci_cte_type); - -/** Start or restart scanner if needed - * - * Examples of cases where it may be required to start/restart a scanner: - * - When the auto-connection establishement feature is used: - * - When the host sets a connection context for auto-connection establishment. - * - When a connection was established. - * The host may now be able to retry to automatically set up a connection. - * - When a connection was disconnected/lost. - * The host may now be able to retry to automatically set up a connection. - * - When the application stops explicit scanning. - * The host may now be able to retry to automatically set up a connection. - * - The application tries to connect to another device, but fails. - * The host may now be able to retry to automatically set up a connection. - * - When the application wants to connect to a device, but we need - * to fallback to host privacy. - * - When the application wants to establish a periodic sync to a device - * and the application has not already started scanning. - * - * @param fast_scan Use fast scan parameters or slow scan parameters - * - * @return 0 in case of success, or a negative error code on failure. - */ int bt_le_scan_update(bool fast_scan); int bt_le_create_conn(const struct bt_conn *conn); diff --git a/subsys/bluetooth/host/scan.c b/subsys/bluetooth/host/scan.c index e3421c387de..ceb4fd2428e 100644 --- a/subsys/bluetooth/host/scan.c +++ b/subsys/bluetooth/host/scan.c @@ -318,9 +318,6 @@ static int start_passive_scan(bool fast_scan) int bt_le_scan_update(bool fast_scan) { if (atomic_test_bit(bt_dev.flags, BT_DEV_EXPLICIT_SCAN)) { - /* The application has already explicitly started scanning. - * We should keep the scanner running to avoid changing scan parameters. - */ return 0; } @@ -351,14 +348,12 @@ int bt_le_scan_update(bool fast_scan) bt_conn_unref(conn); - /* Start/Restart the scanner */ return start_passive_scan(fast_scan); } } #if defined(CONFIG_BT_PER_ADV_SYNC) if (get_pending_per_adv_sync()) { - /* Start/Restart the scanner. */ return start_passive_scan(fast_scan); } #endif From 3c2f396ea4f562528a7d7c459012f29c625dedae Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1956/2300] Revert "[nrf fromtree] Tests: Bluetooth: CAP: Refactor some CAP commander functions" This reverts commit 234a37b22f5a5b1439ff444adc6ec1eb7a86a973. Signed-off-by: Robert Lubos --- tests/bsim/bluetooth/audio/prj.conf | 1 - .../bluetooth/audio/src/cap_commander_test.c | 188 ++++++------------ 2 files changed, 60 insertions(+), 129 deletions(-) diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index fb182f0aa07..ec75aec4478 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -194,7 +194,6 @@ CONFIG_BT_HAS_CLIENT_LOG_LEVEL_DBG=y CONFIG_BT_CAP_ACCEPTOR_LOG_LEVEL_DBG=y CONFIG_BT_CAP_INITIATOR_LOG_LEVEL_DBG=y CONFIG_BT_CAP_COMMANDER_LOG_LEVEL_DBG=y -CONFIG_BT_CAP_COMMON_LOG_LEVEL_DBG=y CONFIG_BT_GMAP_LOG_LEVEL_DBG=y # LOGGING diff --git a/tests/bsim/bluetooth/audio/src/cap_commander_test.c b/tests/bsim/bluetooth/audio/src/cap_commander_test.c index 9271a6a12de..1a8bb6dd7f6 100644 --- a/tests/bsim/bluetooth/audio/src/cap_commander_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_commander_test.c @@ -12,22 +12,18 @@ #include #include #include -#include #include #include "common.h" #include "bap_common.h" -#define SEM_TIMEOUT K_SECONDS(5) - extern enum bst_result_t bst_result; static struct bt_conn *connected_conns[CONFIG_BT_MAX_CONN]; static volatile size_t connected_conn_cnt; -static struct k_sem sem_disconnected; -static struct k_sem sem_cas_discovered; -static struct k_sem sem_vcs_discovered; -static struct k_sem sem_mics_discovered; +CREATE_FLAG(flag_cas_discovered); +CREATE_FLAG(flag_vcs_discovered); +CREATE_FLAG(flag_mics_discovered); CREATE_FLAG(flag_mtu_exchanged); CREATE_FLAG(flag_volume_changed); CREATE_FLAG(flag_volume_mute_changed); @@ -39,7 +35,7 @@ static void cap_discovery_complete_cb(struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_csis_inst *csis_inst) { if (err != 0) { - FAIL("Discover failed on %p: %d\n", (void *)conn, err); + FAIL("Failed to discover CAS: %d\n", err); return; } @@ -51,12 +47,12 @@ static void cap_discovery_complete_cb(struct bt_conn *conn, int err, return; } - printk("Found CAS on %p with CSIS %p\n", (void *)conn, csis_inst); + printk("Found CAS with CSIS %p\n", csis_inst); } else { - printk("Found CAS on %p\n", (void *)conn); + printk("Found CAS\n"); } - k_sem_give(&sem_cas_discovered); + SET_FLAG(flag_cas_discovered); } #if defined(CONFIG_BT_VCP_VOL_CTLR) @@ -144,7 +140,7 @@ static void cap_vcp_discover_cb(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8 } printk("VCS for %p found with %u VOCS and %u AICS\n", vol_ctlr, vocs_count, aics_count); - k_sem_give(&sem_vcs_discovered); + SET_FLAG(flag_vcs_discovered); } static void cap_vcp_state_cb(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t volume, @@ -172,7 +168,7 @@ static void cap_micp_discover_cb(struct bt_micp_mic_ctlr *mic_ctlr, int err, uin } printk("MICS for %p found with %u AICS\n", mic_ctlr, aics_count); - k_sem_give(&sem_mics_discovered); + SET_FLAG(flag_mics_discovered); } static struct bt_micp_mic_ctlr_cb micp_cb = { @@ -189,16 +185,8 @@ static struct bt_gatt_cb gatt_callbacks = { .att_mtu_updated = att_mtu_updated, }; -static void cap_disconnected_cb(struct bt_conn *conn, uint8_t reason) -{ - k_sem_give(&sem_disconnected); -} - -static void init(size_t acceptor_cnt) +static void init(void) { - static struct bt_conn_cb conn_cb = { - .disconnected = cap_disconnected_cb, - }; int err; err = bt_enable(NULL); @@ -208,7 +196,6 @@ static void init(size_t acceptor_cnt) } bt_gatt_cb_register(&gatt_callbacks); - bt_conn_cb_register(&conn_cb); err = bt_cap_commander_register_cb(&cap_cb); if (err != 0) { @@ -227,11 +214,6 @@ static void init(size_t acceptor_cnt) FAIL("Failed to register MICP callbacks (err %d)\n", err); return; } - - k_sem_init(&sem_disconnected, 0, acceptor_cnt); - k_sem_init(&sem_cas_discovered, 0, acceptor_cnt); - k_sem_init(&sem_vcs_discovered, 0, acceptor_cnt); - k_sem_init(&sem_mics_discovered, 0, acceptor_cnt); } static void cap_device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, @@ -294,117 +276,62 @@ static void scan_and_connect(void) connected_conn_cnt++; } -static void disconnect_acl(size_t acceptor_cnt) +static void disconnect_acl(struct bt_conn *conn) { - k_sem_reset(&sem_disconnected); - - for (size_t i = 0U; i < acceptor_cnt; i++) { - struct bt_conn *conn = connected_conns[i]; - int err; - - printk("Disconnecting %p\n", (void *)conn); - - err = bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); - if (err != 0) { - FAIL("Failed to disconnect %p (err %d)\n", (void *)conn, err); - return; - } - } - - for (size_t i = 0U; i < acceptor_cnt; i++) { - const int err = k_sem_take(&sem_disconnected, SEM_TIMEOUT); - - if (err != 0) { - const struct bt_conn *conn = connected_conns[i]; + int err; - FAIL("Failed to take sem_disconnected for %p: %d", (void *)conn, err); - } + err = bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); + if (err != 0) { + FAIL("Failed to disconnect (err %d)\n", err); + return; } } -static void discover_cas(size_t acceptor_cnt) +static void discover_cas(struct bt_conn *conn) { - k_sem_reset(&sem_cas_discovered); - - /* Do parallel discovery */ - for (size_t i = 0U; i < acceptor_cnt; i++) { - struct bt_conn *conn = connected_conns[i]; - int err; + int err; - printk("Discovering CAS on %p\n", (void *)conn); + UNSET_FLAG(flag_cas_discovered); - err = bt_cap_commander_discover(conn); - if (err != 0) { - FAIL("Failed to discover CAS on %p: %d\n", (void *)conn, err); - return; - } + err = bt_cap_commander_discover(conn); + if (err != 0) { + printk("Failed to discover CAS: %d\n", err); + return; } - for (size_t i = 0U; i < acceptor_cnt; i++) { - const int err = k_sem_take(&sem_cas_discovered, SEM_TIMEOUT); - - if (err != 0) { - const struct bt_conn *conn = connected_conns[i]; - - FAIL("Failed to take sem_cas_discovered for %p: %d", (void *)conn, err); - } - } + WAIT_FOR_FLAG(flag_cas_discovered); } -static void discover_vcs(size_t acceptor_cnt) +static void discover_vcs(struct bt_conn *conn) { - k_sem_reset(&sem_vcs_discovered); - - /* Do parallel discovery */ - for (size_t i = 0U; i < acceptor_cnt; i++) { - struct bt_conn *conn = connected_conns[i]; - struct bt_vcp_vol_ctlr *vol_ctlr; - int err; + struct bt_vcp_vol_ctlr *vol_ctlr; + int err; - printk("Discovering VCS on %p\n", (void *)conn); + UNSET_FLAG(flag_vcs_discovered); - err = bt_vcp_vol_ctlr_discover(conn, &vol_ctlr); - if (err != 0) { - FAIL("Failed to discover VCS on %p: %d\n", err); - return; - } + err = bt_vcp_vol_ctlr_discover(conn, &vol_ctlr); + if (err != 0) { + FAIL("Failed to discover VCS: %d\n", err); + return; } - for (size_t i = 0U; i < acceptor_cnt; i++) { - const int err = k_sem_take(&sem_vcs_discovered, SEM_TIMEOUT); - - if (err != 0) { - const struct bt_conn *conn = connected_conns[i]; - - FAIL("Failed to take sem_vcs_discovered for %p: %d", (void *)conn, err); - } - } + WAIT_FOR_FLAG(flag_vcs_discovered); } -static void discover_mics(size_t acceptor_cnt) +static void discover_mics(struct bt_conn *conn) { - k_sem_reset(&sem_mics_discovered); + struct bt_micp_mic_ctlr *mic_ctlr; + int err; - for (size_t i = 0U; i < acceptor_cnt; i++) { - struct bt_micp_mic_ctlr *mic_ctlr; - int err; + UNSET_FLAG(flag_mics_discovered); - err = bt_micp_mic_ctlr_discover(connected_conns[i], &mic_ctlr); - if (err != 0) { - FAIL("Failed to discover MICS: %d\n", err); - return; - } + err = bt_micp_mic_ctlr_discover(conn, &mic_ctlr); + if (err != 0) { + FAIL("Failed to discover MICS: %d\n", err); + return; } - for (size_t i = 0U; i < acceptor_cnt; i++) { - const int err = k_sem_take(&sem_mics_discovered, SEM_TIMEOUT); - - if (err != 0) { - const struct bt_conn *conn = connected_conns[i]; - - FAIL("Failed to take sem_mics_discovered for %p: %d", (void *)conn, err); - } - } + WAIT_FOR_FLAG(flag_mics_discovered); } static void test_change_volume(void) @@ -550,25 +477,29 @@ static void test_change_microphone_gain(void) static void test_main_cap_commander_capture_and_render(void) { - const size_t acceptor_cnt = get_dev_cnt() - 1; /* Assume all other devices are acceptors - */ - init(acceptor_cnt); + init(); /* Connect to and do discovery on all CAP acceptors */ - for (size_t i = 0U; i < acceptor_cnt; i++) { + for (size_t i = 0U; i < get_dev_cnt() - 1; i++) { scan_and_connect(); WAIT_FOR_FLAG(flag_mtu_exchanged); - } - /* TODO: We should use CSIP to find set members */ - discover_cas(acceptor_cnt); - discover_cas(acceptor_cnt); /* verify that we can discover twice */ + /* TODO: We should use CSIP to find set members */ + discover_cas(connected_conns[i]); + discover_cas(connected_conns[i]); /* test that we can discover twice */ - if (IS_ENABLED(CONFIG_BT_CSIP_SET_COORDINATOR)) { if (IS_ENABLED(CONFIG_BT_VCP_VOL_CTLR)) { - discover_vcs(acceptor_cnt); + discover_vcs(connected_conns[i]); + } + if (IS_ENABLED(CONFIG_BT_MICP_MIC_CTLR)) { + discover_mics(connected_conns[i]); + } + } + + if (IS_ENABLED(CONFIG_BT_CSIP_SET_COORDINATOR)) { + if (IS_ENABLED(CONFIG_BT_VCP_VOL_CTLR)) { test_change_volume(); test_change_volume_mute(true); @@ -580,8 +511,6 @@ static void test_main_cap_commander_capture_and_render(void) } if (IS_ENABLED(CONFIG_BT_MICP_MIC_CTLR)) { - discover_mics(acceptor_cnt); - test_change_microphone_mute(true); test_change_microphone_mute(false); @@ -592,7 +521,10 @@ static void test_main_cap_commander_capture_and_render(void) } /* Disconnect all CAP acceptors */ - disconnect_acl(acceptor_cnt); + for (size_t i = 0U; i < connected_conn_cnt; i++) { + disconnect_acl(connected_conns[i]); + } + connected_conn_cnt = 0U; PASS("CAP commander capture and rendering passed\n"); } From bee547d80c8ab26f83dd1d2eb98eb25e016b13ca Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:12 +0200 Subject: [PATCH 1957/2300] Revert "[nrf fromtree] Bluetooth: CAP: Fix issue with parallel CAP discover" This reverts commit f41cf518f951a990a35b49a27b0d46dab1e9e1b6. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/cap_common.c | 20 ++++++++------------ subsys/bluetooth/audio/cap_internal.h | 7 +++---- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/subsys/bluetooth/audio/cap_common.c b/subsys/bluetooth/audio/cap_common.c index 23de8c19cb7..277b904355b 100644 --- a/subsys/bluetooth/audio/cap_common.c +++ b/subsys/bluetooth/audio/cap_common.c @@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(bt_cap_common, CONFIG_BT_CAP_COMMON_LOG_LEVEL); static struct bt_cap_common_client bt_cap_common_clients[CONFIG_BT_MAX_CONN]; static const struct bt_uuid *cas_uuid = BT_UUID_CAS; static struct bt_cap_common_proc active_proc; +static bt_cap_common_discover_func_t discover_cb_func; struct bt_cap_common_proc *bt_cap_common_get_active_proc(void) { @@ -257,13 +258,10 @@ struct bt_cap_common_client *bt_cap_common_get_client(enum bt_cap_set_type type, static void cap_common_discover_complete(struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_csis_inst *csis_inst) { - struct bt_cap_common_client *client; - - client = bt_cap_common_get_client_by_acl(conn); - if (client != NULL && client->discover_cb_func != NULL) { - const bt_cap_common_discover_func_t cb_func = client->discover_cb_func; + if (discover_cb_func != NULL) { + const bt_cap_common_discover_func_t cb_func = discover_cb_func; - client->discover_cb_func = NULL; + discover_cb_func = NULL; cb_func(conn, err, csis_inst); } } @@ -388,26 +386,24 @@ static uint8_t bt_cap_common_discover_cas_cb(struct bt_conn *conn, const struct int bt_cap_common_discover(struct bt_conn *conn, bt_cap_common_discover_func_t func) { struct bt_gatt_discover_params *param; - struct bt_cap_common_client *client; int err; - client = bt_cap_common_get_client_by_acl(conn); - if (client->discover_cb_func != NULL) { + if (discover_cb_func != NULL) { return -EBUSY; } - param = &client->param; + param = &bt_cap_common_clients[bt_conn_index(conn)].param; param->func = bt_cap_common_discover_cas_cb; param->uuid = cas_uuid; param->type = BT_GATT_DISCOVER_PRIMARY; param->start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; param->end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; - client->discover_cb_func = func; + discover_cb_func = func; err = bt_gatt_discover(conn, param); if (err != 0) { - client->discover_cb_func = NULL; + discover_cb_func = NULL; /* Report expected possible errors */ if (err == -ENOTCONN || err == -ENOMEM) { diff --git a/subsys/bluetooth/audio/cap_internal.h b/subsys/bluetooth/audio/cap_internal.h index 2210110703f..c2dc861da3d 100644 --- a/subsys/bluetooth/audio/cap_internal.h +++ b/subsys/bluetooth/audio/cap_internal.h @@ -101,9 +101,6 @@ struct bt_cap_commander_proc_param { }; }; -typedef void (*bt_cap_common_discover_func_t)( - struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_csis_inst *csis_inst); - struct bt_cap_common_proc_param { union { #if defined(CONFIG_BT_CAP_INITIATOR_UNICAST) @@ -136,7 +133,6 @@ struct bt_cap_common_proc { struct bt_cap_common_client { struct bt_conn *conn; struct bt_gatt_discover_params param; - bt_cap_common_discover_func_t discover_cb_func; uint16_t csis_start_handle; const struct bt_csip_set_coordinator_csis_inst *csis_inst; bool cas_found; @@ -162,4 +158,7 @@ struct bt_cap_common_client * bt_cap_common_get_client_by_csis(const struct bt_csip_set_coordinator_csis_inst *csis_inst); struct bt_cap_common_client *bt_cap_common_get_client(enum bt_cap_set_type type, const union bt_cap_set_member *member); + +typedef void (*bt_cap_common_discover_func_t)( + struct bt_conn *conn, int err, const struct bt_csip_set_coordinator_csis_inst *csis_inst); int bt_cap_common_discover(struct bt_conn *conn, bt_cap_common_discover_func_t func); From 0aa79ed9a82ba55ccec4fafae1788c1f8195dddb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1958/2300] Revert "[nrf fromtree] Bluetooth: CSIP: Set Coordinator move data to instances" This reverts commit 8789e400423311958399a85c9be46cc768a34e2c. Signed-off-by: Robert Lubos --- subsys/bluetooth/audio/csip_set_coordinator.c | 395 ++++++++---------- 1 file changed, 185 insertions(+), 210 deletions(-) diff --git a/subsys/bluetooth/audio/csip_set_coordinator.c b/subsys/bluetooth/audio/csip_set_coordinator.c index b59587ebdfc..d2dac6f9b6e 100644 --- a/subsys/bluetooth/audio/csip_set_coordinator.c +++ b/subsys/bluetooth/audio/csip_set_coordinator.c @@ -42,30 +42,29 @@ LOG_MODULE_REGISTER(bt_csip_set_coordinator, CONFIG_BT_CSIP_SET_COORDINATOR_LOG_LEVEL); +static uint8_t gatt_write_buf[1]; +static struct bt_gatt_write_params write_params; +static struct bt_gatt_read_params read_params; +static struct bt_gatt_discover_params discover_params; +static struct bt_csip_set_coordinator_svc_inst *cur_inst; +static bool busy; + 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; uint8_t members_count; uint8_t members_handled; uint8_t members_restored; - bool in_progress; bt_csip_set_coordinator_ordered_access_t oap_cb; } active; struct bt_csip_set_coordinator_inst { uint8_t inst_count; - bool busy; - uint8_t gatt_write_buf[1]; - - struct bt_csip_set_coordinator_svc_inst - svc_insts[CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES]; + struct bt_csip_set_coordinator_svc_inst svc_insts + [CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES]; struct bt_csip_set_coordinator_set_member set_member; struct bt_conn *conn; - struct bt_csip_set_coordinator_svc_inst *cur_inst; - struct bt_gatt_discover_params discover_params; - struct bt_gatt_read_params read_params; - struct bt_gatt_write_params write_params; }; static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0); @@ -337,8 +336,8 @@ static void discover_complete(struct bt_csip_set_coordinator_inst *client, { struct bt_csip_set_coordinator_cb *listener; - client->cur_inst = NULL; - client->busy = false; + cur_inst = NULL; + busy = false; SYS_SLIST_FOR_EACH_CONTAINER(&csip_set_coordinator_cbs, listener, _node) { if (listener->discover) { @@ -530,34 +529,30 @@ static int csip_set_coordinator_write_set_lock(struct bt_csip_set_coordinator_sv bool lock, bt_gatt_write_func_t cb) { - struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(inst->conn)]; - if (inst->set_lock_handle == 0) { LOG_DBG("Handle not set"); - client->cur_inst = NULL; + cur_inst = NULL; return -EINVAL; } /* Write to call control point */ - client->gatt_write_buf[0] = lock ? BT_CSIP_LOCK_VALUE : BT_CSIP_RELEASE_VALUE; - client->write_params.data = client->gatt_write_buf; - client->write_params.length = sizeof(lock); - client->write_params.func = cb; - client->write_params.handle = inst->set_lock_handle; + gatt_write_buf[0] = lock ? BT_CSIP_LOCK_VALUE : BT_CSIP_RELEASE_VALUE; + write_params.data = gatt_write_buf; + write_params.length = sizeof(lock); + write_params.func = cb; + write_params.handle = inst->set_lock_handle; - return bt_gatt_write(inst->conn, &client->write_params); + return bt_gatt_write(inst->conn, &write_params); } static int read_set_sirk(struct bt_csip_set_coordinator_svc_inst *svc_inst) { - struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(svc_inst->conn)]; - - if (client->cur_inst != NULL) { - if (client->cur_inst != svc_inst) { + if (cur_inst != NULL) { + if (cur_inst != svc_inst) { return -EBUSY; } } else { - client->cur_inst = svc_inst; + cur_inst = svc_inst; } if (svc_inst->set_sirk_handle == 0) { @@ -565,93 +560,86 @@ static int read_set_sirk(struct bt_csip_set_coordinator_svc_inst *svc_inst) return -EINVAL; } - client->read_params.func = csip_set_coordinator_discover_insts_read_set_sirk_cb; - client->read_params.handle_count = 1; - client->read_params.single.handle = svc_inst->set_sirk_handle; - client->read_params.single.offset = 0U; + read_params.func = csip_set_coordinator_discover_insts_read_set_sirk_cb; + read_params.handle_count = 1; + read_params.single.handle = svc_inst->set_sirk_handle; + read_params.single.offset = 0U; - return bt_gatt_read(svc_inst->conn, &client->read_params); + return bt_gatt_read(svc_inst->conn, &read_params); } static int csip_set_coordinator_read_set_size(struct bt_conn *conn, uint8_t inst_idx, bt_gatt_read_func_t cb) { - struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; - if (inst_idx >= CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES) { return -EINVAL; - } else if (client->cur_inst != NULL) { - if (client->cur_inst != - bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx)) { + } else if (cur_inst != NULL) { + if (cur_inst != bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx)) { return -EBUSY; } } else { - client->cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx); - if (client->cur_inst == NULL) { + cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx); + if (cur_inst == NULL) { LOG_DBG("Inst not found"); return -EINVAL; } } - if (client->cur_inst->set_size_handle == 0) { + if (cur_inst->set_size_handle == 0) { LOG_DBG("Handle not set"); - client->cur_inst = NULL; + cur_inst = NULL; return -EINVAL; } - client->read_params.func = cb; - client->read_params.handle_count = 1; - client->read_params.single.handle = client->cur_inst->set_size_handle; - client->read_params.single.offset = 0U; + read_params.func = cb; + read_params.handle_count = 1; + read_params.single.handle = cur_inst->set_size_handle; + read_params.single.offset = 0U; - return bt_gatt_read(conn, &client->read_params); + return bt_gatt_read(conn, &read_params); } static int csip_set_coordinator_read_rank(struct bt_conn *conn, uint8_t inst_idx, bt_gatt_read_func_t cb) { - struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; - if (inst_idx >= CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES) { return -EINVAL; - } else if (client->cur_inst != NULL) { - if (client->cur_inst != - bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx)) { + } else if (cur_inst != NULL) { + if (cur_inst != bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx)) { return -EBUSY; } } else { - client->cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx); - if (client->cur_inst == NULL) { + cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, inst_idx); + if (cur_inst == NULL) { LOG_DBG("Inst not found"); return -EINVAL; } } - if (client->cur_inst->rank_handle == 0) { + if (cur_inst->rank_handle == 0) { LOG_DBG("Handle not set"); - client->cur_inst = NULL; + cur_inst = NULL; return -EINVAL; } - client->read_params.func = cb; - client->read_params.handle_count = 1; - client->read_params.single.handle = client->cur_inst->rank_handle; - client->read_params.single.offset = 0U; + read_params.func = cb; + read_params.handle_count = 1; + read_params.single.handle = cur_inst->rank_handle; + read_params.single.offset = 0U; - return bt_gatt_read(conn, &client->read_params); + return bt_gatt_read(conn, &read_params); } -static int csip_set_coordinator_discover_sets(struct bt_csip_set_coordinator_inst *client) +static int csip_set_coordinator_discover_sets(struct bt_csip_set_coordinator_set_member *member) { - struct bt_csip_set_coordinator_set_member *member = &client->set_member; int err; /* Start reading values and call CB when done */ err = read_set_sirk((struct bt_csip_set_coordinator_svc_inst *)member->insts[0].svc_inst); if (err == 0) { - client->busy = true; + busy = true; } return err; @@ -667,22 +655,21 @@ static uint8_t discover_func(struct bt_conn *conn, void *notify_handler = NULL; if (attr == NULL) { - LOG_DBG("Setup complete for %u / %u", client->cur_inst->idx + 1, - client->inst_count); + LOG_DBG("Setup complete for %u / %u", cur_inst->idx + 1, client->inst_count); (void)memset(params, 0, sizeof(*params)); if (CONFIG_BT_CSIP_SET_COORDINATOR_MAX_CSIS_INSTANCES > 1 && - (client->cur_inst->idx + 1) < client->inst_count) { + (cur_inst->idx + 1) < client->inst_count) { int err; - client->cur_inst = &client->svc_insts[client->cur_inst->idx + 1]; - client->discover_params.uuid = NULL; - client->discover_params.start_handle = client->cur_inst->start_handle; - client->discover_params.end_handle = client->cur_inst->end_handle; - client->discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; - client->discover_params.func = discover_func; + cur_inst = &client->svc_insts[cur_inst->idx + 1]; + discover_params.uuid = NULL; + discover_params.start_handle = cur_inst->start_handle; + discover_params.end_handle = cur_inst->end_handle; + discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; + discover_params.func = discover_func; - err = bt_gatt_discover(conn, &client->discover_params); + err = bt_gatt_discover(conn, &discover_params); if (err != 0) { LOG_DBG("Discover failed (err %d)", err); discover_complete(client, err); @@ -691,9 +678,9 @@ static uint8_t discover_func(struct bt_conn *conn, } else { int err; - client->cur_inst = NULL; - client->busy = false; - err = csip_set_coordinator_discover_sets(client); + cur_inst = NULL; + busy = false; + err = csip_set_coordinator_discover_sets(&client->set_member); if (err != 0) { LOG_DBG("Discover sets failed (err %d)", err); discover_complete(client, err); @@ -709,30 +696,30 @@ static uint8_t discover_func(struct bt_conn *conn, chrc = (struct bt_gatt_chrc *)attr->user_data; if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_SET_SIRK) == 0) { LOG_DBG("Set SIRK"); - client->cur_inst->set_sirk_handle = chrc->value_handle; - sub_params = &client->cur_inst->sirk_sub_params; - sub_params->disc_params = &client->cur_inst->sirk_sub_disc_params; + cur_inst->set_sirk_handle = chrc->value_handle; + sub_params = &cur_inst->sirk_sub_params; + sub_params->disc_params = &cur_inst->sirk_sub_disc_params; notify_handler = sirk_notify_func; } else if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_SET_SIZE) == 0) { LOG_DBG("Set size"); - client->cur_inst->set_size_handle = chrc->value_handle; - sub_params = &client->cur_inst->size_sub_params; - sub_params->disc_params = &client->cur_inst->size_sub_disc_params; + cur_inst->set_size_handle = chrc->value_handle; + sub_params = &cur_inst->size_sub_params; + sub_params->disc_params = &cur_inst->size_sub_disc_params; notify_handler = size_notify_func; } else if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_SET_LOCK) == 0) { struct bt_csip_set_coordinator_set_info *set_info; LOG_DBG("Set lock"); - client->cur_inst->set_lock_handle = chrc->value_handle; - sub_params = &client->cur_inst->lock_sub_params; - sub_params->disc_params = &client->cur_inst->lock_sub_disc_params; + cur_inst->set_lock_handle = chrc->value_handle; + sub_params = &cur_inst->lock_sub_params; + sub_params->disc_params = &cur_inst->lock_sub_disc_params; notify_handler = lock_notify_func; - set_info = &client->set_member.insts[client->cur_inst->idx].info; + set_info = &client->set_member.insts[cur_inst->idx].info; set_info->lockable = true; } else if (bt_uuid_cmp(chrc->uuid, BT_UUID_CSIS_RANK) == 0) { LOG_DBG("Set rank"); - client->cur_inst->rank_handle = chrc->value_handle; + cur_inst->rank_handle = chrc->value_handle; } if (sub_params != NULL && notify_handler != NULL) { @@ -748,7 +735,7 @@ static uint8_t discover_func(struct bt_conn *conn, /* With ccc_handle == 0 it will use auto discovery */ sub_params->ccc_handle = 0; - sub_params->end_handle = client->cur_inst->end_handle; + sub_params->end_handle = cur_inst->end_handle; sub_params->value_handle = chrc->value_handle; sub_params->notify = notify_handler; atomic_set_bit(sub_params->flags, BT_GATT_SUBSCRIBE_FLAG_VOLATILE); @@ -782,14 +769,14 @@ static uint8_t primary_discover_func(struct bt_conn *conn, if (client->inst_count != 0) { int err; - client->cur_inst = &client->svc_insts[0]; - client->discover_params.uuid = NULL; - client->discover_params.start_handle = client->cur_inst->start_handle; - client->discover_params.end_handle = client->cur_inst->end_handle; - client->discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; - client->discover_params.func = discover_func; + cur_inst = &client->svc_insts[0]; + discover_params.uuid = NULL; + discover_params.start_handle = cur_inst->start_handle; + discover_params.end_handle = cur_inst->end_handle; + discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; + discover_params.func = discover_func; - err = bt_gatt_discover(conn, &client->discover_params); + err = bt_gatt_discover(conn, &discover_params); if (err != 0) { LOG_DBG("Discover failed (err %d)", err); discover_complete(client, err); @@ -805,14 +792,14 @@ static uint8_t primary_discover_func(struct bt_conn *conn, if (params->type == BT_GATT_DISCOVER_PRIMARY) { prim_service = (struct bt_gatt_service_val *)attr->user_data; - client->discover_params.start_handle = attr->handle + 1; - - client->cur_inst = &client->svc_insts[client->inst_count]; - client->cur_inst->idx = client->inst_count; - client->cur_inst->start_handle = attr->handle; - client->cur_inst->end_handle = prim_service->end_handle; - client->cur_inst->conn = bt_conn_ref(conn); - client->cur_inst->set_info = &client->set_member.insts[client->cur_inst->idx].info; + discover_params.start_handle = attr->handle + 1; + + cur_inst = &client->svc_insts[client->inst_count]; + cur_inst->idx = client->inst_count; + cur_inst->start_handle = attr->handle; + cur_inst->end_handle = prim_service->end_handle; + cur_inst->conn = bt_conn_ref(conn); + cur_inst->set_info = &client->set_member.insts[cur_inst->idx].info; client->inst_count++; } @@ -856,9 +843,9 @@ static uint8_t csip_set_coordinator_discover_insts_read_rank_cb(struct bt_conn * { struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; - __ASSERT(client->cur_inst != NULL, "client->cur_inst must not be NULL"); + __ASSERT(cur_inst != NULL, "cur_inst must not be NULL"); - client->busy = false; + busy = false; if (err != 0) { LOG_DBG("err: 0x%02X", err); @@ -869,7 +856,7 @@ static uint8_t csip_set_coordinator_discover_insts_read_rank_cb(struct bt_conn * LOG_HEXDUMP_DBG(data, length, "Data read"); - set_info = &client->set_member.insts[client->cur_inst->idx].info; + set_info = &client->set_member.insts[cur_inst->idx].info; if (length == sizeof(set_info->rank)) { (void)memcpy(&set_info->rank, data, length); @@ -890,9 +877,9 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_size_cb( { struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; - __ASSERT(client->cur_inst != NULL, "client->cur_inst must not be NULL"); + __ASSERT(cur_inst != NULL, "cur_inst must not be NULL"); - client->busy = false; + busy = false; if (err != 0) { LOG_DBG("err: 0x%02X", err); @@ -903,7 +890,7 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_size_cb( LOG_HEXDUMP_DBG(data, length, "Data read"); - set_info = &client->set_member.insts[client->cur_inst->idx].info; + set_info = &client->set_member.insts[cur_inst->idx].info; if (length == sizeof(set_info->set_size)) { (void)memcpy(&set_info->set_size, data, length); @@ -912,7 +899,7 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_size_cb( LOG_DBG("Invalid length"); } - discover_insts_resume(conn, 0, 0, client->cur_inst->rank_handle); + discover_insts_resume(conn, 0, 0, cur_inst->rank_handle); } return BT_GATT_ITER_STOP; @@ -923,7 +910,7 @@ static int parse_sirk(struct bt_csip_set_coordinator_inst *client, { uint8_t *set_sirk; - set_sirk = client->set_member.insts[client->cur_inst->idx].info.set_sirk; + set_sirk = client->set_member.insts[cur_inst->idx].info.set_sirk; if (length == sizeof(struct bt_csip_set_sirk)) { struct bt_csip_set_sirk *sirk = @@ -973,9 +960,9 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_sirk_cb( { struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; int cb_err = err; - __ASSERT(client->cur_inst != NULL, "client->cur_inst must not be NULL"); + __ASSERT(cur_inst != NULL, "cur_inst must not be NULL"); - client->busy = false; + busy = false; if (err != 0) { LOG_DBG("err: 0x%02X", err); @@ -989,8 +976,9 @@ static uint8_t csip_set_coordinator_discover_insts_read_set_sirk_cb( if (cb_err != 0) { LOG_DBG("Could not parse SIRK: %d", cb_err); } else { - discover_insts_resume(conn, 0, client->cur_inst->set_size_handle, - client->cur_inst->rank_handle); + discover_insts_resume(conn, 0, + cur_inst->set_size_handle, + cur_inst->rank_handle); } } @@ -1015,28 +1003,28 @@ static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle, if (size_handle != 0) { cb_err = csip_set_coordinator_read_set_size( - conn, client->cur_inst->idx, - csip_set_coordinator_discover_insts_read_set_size_cb); + conn, cur_inst->idx, + csip_set_coordinator_discover_insts_read_set_size_cb); if (cb_err != 0) { LOG_DBG("Could not read set size: %d", cb_err); } } else if (rank_handle != 0) { cb_err = csip_set_coordinator_read_rank( - conn, client->cur_inst->idx, - csip_set_coordinator_discover_insts_read_rank_cb); + conn, cur_inst->idx, + csip_set_coordinator_discover_insts_read_rank_cb); if (cb_err != 0) { LOG_DBG("Could not read set rank: %d", cb_err); } } else { - uint8_t next_idx = client->cur_inst->idx + 1; + uint8_t next_idx = cur_inst->idx + 1; - client->cur_inst = NULL; + cur_inst = NULL; if (next_idx < client->inst_count) { - client->cur_inst = - bt_csip_set_coordinator_lookup_instance_by_index(conn, next_idx); + cur_inst = bt_csip_set_coordinator_lookup_instance_by_index(conn, + next_idx); /* Read next */ - cb_err = read_set_sirk(client->cur_inst); + cb_err = read_set_sirk(cur_inst); } else { discover_complete(client, 0); @@ -1047,7 +1035,7 @@ static void discover_insts_resume(struct bt_conn *conn, uint16_t sirk_handle, if (cb_err != 0) { discover_complete(client, cb_err); } else { - client->busy = true; + busy = true; } } @@ -1055,9 +1043,7 @@ static void csip_set_coordinator_write_restore_cb(struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params) { - struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; - - client->busy = false; + busy = false; if (err != 0) { LOG_WRN("Could not restore (%d)", err); @@ -1075,17 +1061,18 @@ 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); - if (client->cur_inst == NULL) { + cur_inst = lookup_instance_by_set_info(member, active.info); + if (cur_inst == NULL) { release_set_complete(-ENOENT); return; } csip_err = csip_set_coordinator_write_set_lock( - client->cur_inst, false, csip_set_coordinator_write_restore_cb); + cur_inst, false, + csip_set_coordinator_write_restore_cb); if (csip_err == 0) { - client->busy = true; + busy = true; } else { LOG_DBG("Failed to release next member[%u]: %d", active.members_handled, csip_err); @@ -1101,9 +1088,7 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params) { - struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; - - client->busy = false; + busy = false; if (err != 0) { LOG_DBG("Could not lock (0x%X)", err); @@ -1114,8 +1099,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); - if (client->cur_inst == NULL) { + cur_inst = lookup_instance_by_set_info(member, + active.info); + if (cur_inst == NULL) { LOG_DBG("Failed to lookup instance by set_info %p", active.info); lock_set_complete(-ENOENT); @@ -1123,9 +1109,10 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, } csip_err = csip_set_coordinator_write_set_lock( - client->cur_inst, false, csip_set_coordinator_write_restore_cb); + cur_inst, false, + csip_set_coordinator_write_restore_cb); if (csip_err == 0) { - client->busy = true; + busy = true; } else { LOG_WRN("Could not release lock of previous locked member: %d", csip_err); @@ -1143,20 +1130,21 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, LOG_DBG("Locked %u/%u members", active.members_handled, active.members_count); if (active.members_handled < active.members_count) { - struct bt_csip_set_coordinator_svc_inst *prev_inst = client->cur_inst; + struct bt_csip_set_coordinator_svc_inst *prev_inst = cur_inst; int csip_err; - client->cur_inst = get_next_active_instance(); - if (client->cur_inst == NULL) { + cur_inst = get_next_active_instance(); + if (cur_inst == NULL) { lock_set_complete(-ENOENT); return; } - csip_err = csip_set_coordinator_write_set_lock(client->cur_inst, true, - csip_set_coordinator_write_lock_cb); + csip_err = csip_set_coordinator_write_set_lock( + cur_inst, true, + csip_set_coordinator_write_lock_cb); if (csip_err == 0) { - client->busy = true; + busy = true; } else { LOG_DBG("Failed to lock next member[%u]: %d", active.members_handled, csip_err); @@ -1167,7 +1155,7 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, prev_inst, false, csip_set_coordinator_write_restore_cb); if (csip_err == 0) { - client->busy = true; + busy = true; } else { LOG_WRN("Could not release lock of previous locked member: %d", csip_err); @@ -1183,9 +1171,7 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, static void csip_set_coordinator_write_release_cb(struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params) { - struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; - - client->busy = false; + busy = false; if (err != 0) { LOG_DBG("Could not release lock (%d)", err); @@ -1200,17 +1186,18 @@ static void csip_set_coordinator_write_release_cb(struct bt_conn *conn, uint8_t if (active.members_handled < active.members_count) { int csip_err; - client->cur_inst = get_next_active_instance(); - if (client->cur_inst == NULL) { + cur_inst = get_next_active_instance(); + if (cur_inst == NULL) { release_set_complete(-ENOENT); return; } csip_err = csip_set_coordinator_write_set_lock( - client->cur_inst, false, csip_set_coordinator_write_release_cb); + cur_inst, false, + csip_set_coordinator_write_release_cb); if (csip_err == 0) { - client->busy = true; + busy = true; } else { LOG_DBG("Failed to release next member[%u]: %d", active.members_handled, csip_err); @@ -1243,10 +1230,9 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, const void *data, uint16_t length) { - struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(conn)]; uint8_t value = 0; - client->busy = false; + busy = false; if (err != 0) { LOG_DBG("Could not read lock value (0x%X)", err); @@ -1259,7 +1245,7 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, active.members_handled++; LOG_DBG("Read lock state on %u/%u members", active.members_handled, active.members_count); - if (data == NULL || length != sizeof(client->cur_inst->set_lock)) { + if (data == NULL || length != sizeof(cur_inst->set_lock)) { LOG_DBG("Invalid data %p or length %u", data, length); csip_set_coordinator_lock_state_read_cb(err, false); @@ -1277,7 +1263,7 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, return BT_GATT_ITER_STOP; } - client->cur_inst->set_lock = value; + cur_inst->set_lock = value; if (value != BT_CSIP_RELEASE_VALUE) { LOG_DBG("Set member not unlocked"); @@ -1290,16 +1276,16 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, if (active.members_handled < active.members_count) { int csip_err; - client->cur_inst = get_next_active_instance(); - if (client->cur_inst == NULL) { + cur_inst = get_next_active_instance(); + if (cur_inst == NULL) { csip_set_coordinator_lock_state_read_cb(-ENOENT, false); return BT_GATT_ITER_STOP; } - csip_err = csip_set_coordinator_read_set_lock(client->cur_inst); + csip_err = csip_set_coordinator_read_set_lock(cur_inst); if (csip_err == 0) { - client->busy = true; + busy = true; } else { LOG_DBG("Failed to read next member[%u]: %d", active.members_handled, csip_err); @@ -1315,28 +1301,18 @@ static uint8_t csip_set_coordinator_read_lock_cb(struct bt_conn *conn, static int csip_set_coordinator_read_set_lock(struct bt_csip_set_coordinator_svc_inst *inst) { - struct bt_csip_set_coordinator_inst *client = &client_insts[bt_conn_index(inst->conn)]; - int err; - if (inst->set_lock_handle == 0) { LOG_DBG("Handle not set"); - client->cur_inst = NULL; + cur_inst = NULL; return -EINVAL; } - client->read_params.func = csip_set_coordinator_read_lock_cb; - client->read_params.handle_count = 1; - client->read_params.single.handle = inst->set_lock_handle; - client->read_params.single.offset = 0; - - client->cur_inst = inst; - - err = bt_gatt_read(inst->conn, &client->read_params); - if (err != 0) { - client->cur_inst = NULL; - } + read_params.func = csip_set_coordinator_read_lock_cb; + read_params.handle_count = 1; + read_params.single.handle = inst->set_lock_handle; + read_params.single.offset = 0; - return err; + return bt_gatt_read(inst->conn, &read_params); } static void csip_set_coordinator_reset(struct bt_csip_set_coordinator_inst *inst) @@ -1442,28 +1418,29 @@ int bt_csip_set_coordinator_discover(struct bt_conn *conn) return -EINVAL; } - client = &client_insts[bt_conn_index(conn)]; - if (client->busy) { + if (busy) { return -EBUSY; } + client = &client_insts[bt_conn_index(conn)]; + csip_set_coordinator_reset(client); /* Discover CSIS on peer, setup handles and notify */ - (void)memset(&client->discover_params, 0, sizeof(client->discover_params)); + (void)memset(&discover_params, 0, sizeof(discover_params)); (void)memcpy(&uuid, BT_UUID_CSIS, sizeof(uuid)); - client->discover_params.func = primary_discover_func; - client->discover_params.uuid = &uuid.uuid; - client->discover_params.type = BT_GATT_DISCOVER_PRIMARY; - client->discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; - client->discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; + discover_params.func = primary_discover_func; + discover_params.uuid = &uuid.uuid; + discover_params.type = BT_GATT_DISCOVER_PRIMARY; + discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; + discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; - err = bt_gatt_discover(conn, &client->discover_params); + err = bt_gatt_discover(conn, &discover_params); if (err == 0) { for (size_t i = 0; i < ARRAY_SIZE(client->set_member.insts); i++) { client->set_member.insts[i].svc_inst = (void *)&client->svc_insts[i]; } - client->busy = true; + busy = true; client->conn = bt_conn_ref(conn); } @@ -1549,8 +1526,8 @@ static int bt_csip_set_coordinator_get_lock_state( { int err; - if (active.in_progress) { - LOG_DBG("Procedure in progress"); + if (busy) { + LOG_DBG("csip_set_coordinator busy"); return -EBUSY; } @@ -1563,20 +1540,20 @@ static int bt_csip_set_coordinator_get_lock_state( active_members_store_ordered(members, count, set_info, true); 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); - if (svc_inst == NULL) { + cur_inst = lookup_instance_by_set_info(active.members[i], active.info); + if (cur_inst == NULL) { LOG_DBG("Failed to lookup instance by set_info %p", active.info); active_members_reset(); return -ENOENT; } - if (svc_inst->set_info->lockable) { - err = csip_set_coordinator_read_set_lock(svc_inst); + if (cur_inst->set_info->lockable) { + err = csip_set_coordinator_read_set_lock(cur_inst); if (err == 0) { - active.in_progress = true; + busy = true; + } else { + cur_inst = NULL; } break; @@ -1585,7 +1562,7 @@ static int bt_csip_set_coordinator_get_lock_state( active.members_handled++; } - if (!active.in_progress && err == 0) { + if (!busy && err == 0) { /* We are not reading any lock states (because they are not on the remote devices), * so we can just initiate the ordered access procedure (oap) callback directly * here. @@ -1627,11 +1604,10 @@ int bt_csip_set_coordinator_lock( uint8_t count, const struct bt_csip_set_coordinator_set_info *set_info) { - struct bt_csip_set_coordinator_svc_inst *svc_inst; int err; - CHECKIF(active.in_progress) { - LOG_DBG("Procedure in progress"); + CHECKIF(busy) { + LOG_DBG("csip_set_coordinator busy"); return -EBUSY; } @@ -1643,18 +1619,18 @@ 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); - if (svc_inst == NULL) { + cur_inst = lookup_instance_by_set_info(active.members[0], active.info); + if (cur_inst == NULL) { LOG_DBG("Failed to lookup instance by set_info %p", active.info); active_members_reset(); return -ENOENT; } - err = csip_set_coordinator_write_set_lock(svc_inst, true, + err = csip_set_coordinator_write_set_lock(cur_inst, true, csip_set_coordinator_write_lock_cb); if (err == 0) { - active.in_progress = true; + busy = true; } return err; @@ -1664,11 +1640,10 @@ int bt_csip_set_coordinator_release(const struct bt_csip_set_coordinator_set_mem uint8_t count, const struct bt_csip_set_coordinator_set_info *set_info) { - struct bt_csip_set_coordinator_svc_inst *svc_inst; int err; - CHECKIF(active.in_progress) { - LOG_DBG("Procedure in progress"); + CHECKIF(busy) { + LOG_DBG("csip_set_coordinator busy"); return -EBUSY; } @@ -1680,18 +1655,18 @@ 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); - if (svc_inst == NULL) { + cur_inst = lookup_instance_by_set_info(active.members[0], active.info); + if (cur_inst == NULL) { LOG_DBG("Failed to lookup instance by set_info %p", active.info); active_members_reset(); return -ENOENT; } - err = csip_set_coordinator_write_set_lock(svc_inst, false, + err = csip_set_coordinator_write_set_lock(cur_inst, false, csip_set_coordinator_write_release_cb); if (err == 0) { - active.in_progress = true; + busy = true; } return err; From 9ad880ab126af1317cd91db9eaa93de4ca36f651 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1959/2300] Revert "[nrf noup] boards: nrf54l15/nrf54l15/cpuapp/ns enable builtin keys" This reverts commit 987b5d17c3db527e91eb7d7677b021b47fda6980. Signed-off-by: Robert Lubos --- .../nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig index 70f01d7c9ba..6336dfb87cc 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig @@ -27,5 +27,8 @@ CONFIG_SERIAL=y # Enable GPIO CONFIG_GPIO=y +# NCSDK-22600: Built-in keys are not supported yet. +CONFIG_TFM_CRYPTO_BUILTIN_KEYS=n + # Start SYSCOUNTER on driver init CONFIG_NRF_GRTC_START_SYSCOUNTER=y From c6cc91cb17c9dd05a46a731b02711752a9c38289 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1960/2300] Revert "[nrf noup] boards: nrf54l15/nrf54l15/cpuapp/ns Enable PS Rollback protection" This reverts commit da41afb6ae575dd8903f3439d9622b4707e2029e. Signed-off-by: Robert Lubos --- .../nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig index 6336dfb87cc..ec01756bfd4 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig @@ -27,6 +27,9 @@ CONFIG_SERIAL=y # Enable GPIO CONFIG_GPIO=y +# NCSDK-26634: Rollback protection is not supported yet +CONFIG_TFM_PS_ROLLBACK_PROTECTION=n + # NCSDK-22600: Built-in keys are not supported yet. CONFIG_TFM_CRYPTO_BUILTIN_KEYS=n From e988b118c8563d7f35b315c8a49bdf0ccdc4d31a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1961/2300] Revert "[nrf noup] boards: nordic: nrf54h20dk: Add aliases for RESETINFO" This reverts commit 04cb69403fc0822aaf9a1e02d58640add1349c8f. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 4 ---- 2 files changed, 5 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 136197d2767..24d161420d6 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -34,7 +34,6 @@ led2 = &led2; led3 = &led3; pwm-led0 = &pwm_led0; - resetinfo = &cpuapp_resetinfo; sw0 = &button0; sw1 = &button1; sw2 = &button2; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 32cda09ff37..cb69b5ce3a6 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -33,10 +33,6 @@ compatible = "nordic,entropy-prng"; status = "okay"; }; - - aliases { - resetinfo = &cpurad_resetinfo; - }; }; &shared_ram3x_region { From 27cd871ef0619bf0c0ff090f518b076b08d901b0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1962/2300] Revert "[nrf fromlist] boards: nrf54h20dk: Drop shared_ram20_region's compatible" This reverts commit aedc525fb722a003f7774b7cdcf65c037d846a1a. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index f67ddfb80bf..91899e2cf86 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -70,7 +70,11 @@ }; shared_ram20_region: memory@2f88f000 { + compatible = "nordic,owned-memory"; reg = <0x2f88f000 DT_SIZE_K(4)>; + status = "disabled"; + perm-read; + perm-write; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f88f000 0x1000>; From 3382d9e42bb79a55c9df70d2d638dd4659c70247 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1963/2300] Revert "[nrf fromlist] drivers: timer: grtc: Update GRTC driver" This reverts commit f7438b58c1edb10f96e7821c418a52034a0284b2. Signed-off-by: Robert Lubos --- drivers/timer/Kconfig.nrf_grtc | 13 +-- drivers/timer/nrf_grtc_timer.c | 87 ++++++++++++++----- include/zephyr/drivers/timer/nrf_grtc_timer.h | 1 - modules/hal_nordic/nrfx/CMakeLists.txt | 15 +--- 4 files changed, 70 insertions(+), 46 deletions(-) diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc index 444d13aab31..442c524fd19 100644 --- a/drivers/timer/Kconfig.nrf_grtc +++ b/drivers/timer/Kconfig.nrf_grtc @@ -40,20 +40,9 @@ config NRF_GRTC_TIMER_CLOCK_MANAGEMENT the GRTC. Usually this is only needed by the processor that is starting the SYSCOUNTER, but can be shared by multiple processors in the system. -config NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY +config NRF_GRTC_SLEEP_MINIMUM_LATENCY int default 1000 depends on NRF_GRTC_SLEEP_ALLOWED - 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 - NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY period makes no sense. - -config NRF_GRTC_TIMER_AUTO_KEEP_ALIVE - bool - default y if NRF_GRTC_START_SYSCOUNTER - help - This feature prevents the SYSCOUNTER to sleep when any core is in - active state. endif # NRF_GRTC_TIMER diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 7a31cde7bfa..7f6ae02bceb 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -29,6 +29,12 @@ #define CHAN_COUNT NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS #define EXT_CHAN_COUNT (CHAN_COUNT - 1) +/* The reset value of waketime is 1, which doesn't seem to work. + * It's being looked into, but for the time being use 4. + * Timeout must always be higher than waketime, so setting that to 5. + */ +#define WAKETIME (4) +#define TIMEOUT (WAKETIME + 1) #ifndef GRTC_SYSCOUNTERL_VALUE_Msk #define GRTC_SYSCOUNTERL_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERL_VALUE_Msk @@ -49,6 +55,9 @@ #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) +/* The maximum SYSCOUNTERVALID settling time equals 1x32k cycles + 20x1MHz cycles. */ +#define GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US 51 + #if defined(CONFIG_TEST) const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); #endif @@ -69,6 +78,36 @@ static nrfx_grtc_channel_t system_clock_channel_data = { __ASSERT_NO_MSG((NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK & (1UL << (chan))) && \ ((chan) != system_clock_channel_data.channel)) +static inline void grtc_active_set(void) +{ +#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) + nrfy_grtc_sys_counter_active_set(NRF_GRTC, true); + while (!nrfy_grtc_sys_conter_ready_check(NRF_GRTC)) { + } +#else + nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, true); + k_busy_wait(GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US); +#endif +} + +static inline void grtc_wakeup(void) +{ + if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { + grtc_active_set(); + } +} + +static inline void grtc_sleep(void) +{ + if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { +#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) + nrfy_grtc_sys_counter_active_set(NRF_GRTC, false); +#else + nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, false); +#endif + } +} + static inline uint64_t counter_sub(uint64_t a, uint64_t b) { return (a - b); @@ -77,7 +116,10 @@ static inline uint64_t counter_sub(uint64_t a, uint64_t b) static inline uint64_t counter(void) { uint64_t now; + + grtc_wakeup(); nrfx_grtc_syscounter_get(&now); + grtc_sleep(); return now; } @@ -99,8 +141,10 @@ static inline uint64_t get_comparator(uint32_t chan) static void system_timeout_set(uint64_t value) { if (value <= NRF_GRTC_SYSCOUNTER_CCADD_MASK) { + grtc_wakeup(); nrfx_grtc_syscounter_cc_relative_set(&system_clock_channel_data, value, true, NRFX_GRTC_CC_RELATIVE_SYSCOUNTER); + grtc_sleep(); } else { nrfx_grtc_syscounter_cc_absolute_set(&system_clock_channel_data, value + counter(), true); @@ -329,7 +373,6 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ uint64_t capt_time; - nrfx_err_t result; IS_CHANNEL_ALLOWED_ASSERT(chan); @@ -340,10 +383,8 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ return -EBUSY; } - result = nrfx_grtc_syscounter_cc_value_read(chan, &capt_time); - if (result != NRFX_SUCCESS) { - return -EPERM; - } + + capt_time = nrfy_grtc_sys_counter_cc_get(NRF_GRTC, chan); __ASSERT_NO_MSG(capt_time < COUNTER_SPAN); @@ -358,22 +399,16 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) nrfx_err_t err_code; static uint8_t systemoff_channel; uint64_t now = counter(); - nrfx_grtc_sleep_config_t sleep_cfg; /* Minimum time that ensures valid execution of system-off procedure. */ - uint32_t minimum_latency_us; + uint32_t minimum_latency_us = nrfy_grtc_waketime_get(NRF_GRTC) + + nrfy_grtc_timeout_get(NRF_GRTC) + + CONFIG_NRF_GRTC_SLEEP_MINIMUM_LATENCY; uint32_t chan; int ret; - nrfx_grtc_sleep_configuration_get(&sleep_cfg); - minimum_latency_us = (sleep_cfg.waketime + sleep_cfg.timeout) * USEC_PER_SEC / 32768 + - CONFIG_NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY; - sleep_cfg.auto_mode = false; - nrfx_grtc_sleep_configure(&sleep_cfg); - if (minimum_latency_us > wake_time_us) { return -EINVAL; } - k_spinlock_key_t key = k_spin_lock(&lock); err_code = nrfx_grtc_channel_alloc(&systemoff_channel); @@ -382,9 +417,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) return -ENOMEM; } (void)nrfx_grtc_syscounter_cc_int_disable(systemoff_channel); - ret = compare_set(systemoff_channel, - now + wake_time_us * sys_clock_hw_cycles_per_sec() / USEC_PER_SEC, NULL, - NULL); + ret = compare_set(systemoff_channel, now + wake_time_us, NULL, NULL); if (ret < 0) { k_spin_unlock(&lock, key); return ret; @@ -400,7 +433,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) } /* Make sure that wake_time_us was not triggered yet. */ - if (nrfx_grtc_syscounter_compare_event_check(systemoff_channel)) { + if (nrfy_grtc_sys_counter_compare_event_check(NRF_GRTC, systemoff_channel)) { k_spin_unlock(&lock, key); return -EINVAL; } @@ -411,7 +444,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) MAX_CC_LATCH_WAIT_TIME_US; k_busy_wait(wait_time); #if NRF_GRTC_HAS_CLKSEL - nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); + nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFXO); #endif k_spin_unlock(&lock, key); return 0; @@ -452,9 +485,16 @@ static int sys_clock_driver_init(void) #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. */ - nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFCLK); + nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFCLK); #endif +#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) + /* SYSCOUNTER needs to be turned off before initialization. */ + nrfy_grtc_sys_counter_set(NRF_GRTC, false); + nrfy_grtc_timeout_set(NRF_GRTC, TIMEOUT); + nrfy_grtc_waketime_set(NRF_GRTC, WAKETIME); +#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ + IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr, nrfx_grtc_irq_handler, 0); @@ -468,6 +508,9 @@ static int sys_clock_driver_init(void) if (err_code != NRFX_SUCCESS) { return err_code == NRFX_ERROR_NO_MEM ? -ENOMEM : -EPERM; } + if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { + nrfy_grtc_sys_counter_auto_mode_set(NRF_GRTC, false); + } #else err_code = nrfx_grtc_channel_alloc(&system_clock_channel_data.channel); if (err_code != NRFX_SUCCESS) { @@ -475,6 +518,10 @@ static int sys_clock_driver_init(void) } #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ + if (!IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { + grtc_active_set(); + } + int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set(CYC_PER_TICK); diff --git a/include/zephyr/drivers/timer/nrf_grtc_timer.h b/include/zephyr/drivers/timer/nrf_grtc_timer.h index 1814202a097..76fa7b70346 100644 --- a/include/zephyr/drivers/timer/nrf_grtc_timer.h +++ b/include/zephyr/drivers/timer/nrf_grtc_timer.h @@ -169,7 +169,6 @@ int z_nrf_grtc_timer_capture_prepare(int32_t chan); * * @retval 0 if the timestamp was successfully caught and read. * @retval -EBUSY if capturing has not been triggered. - * @retval -EPERM if either channel is unavailable or SYSCOUNTER is not running. */ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time); diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 557f3df0cab..540ec4e0b30 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -127,19 +127,8 @@ if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM) zephyr_library_sources(${SRC_DIR}/nrfx_twi_twim.c) endif() -if (CONFIG_NRF_GRTC_TIMER) - if (CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) - zephyr_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) - endif() - if (CONFIG_NRF_GRTC_SLEEP_ALLOWED) - zephyr_compile_definitions(NRFX_GRTC_CONFIG_SLEEP_ALLOWED=1) - endif() - if (CONFIG_NRF_GRTC_TIMER_AUTO_KEEP_ALIVE) - zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOEN=1) - endif() - if (CONFIG_NRF_GRTC_START_SYSCOUNTER) - zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOSTART=1) - endif() +if (CONFIG_NRF_GRTC_TIMER AND CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) + zephyr_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) endif() # Inject HAL "CONFIG_NFCT_PINS_AS_GPIOS" definition if user requests to From ca09ddd65186d633fc1758ccee765ba6df2fd53f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1964/2300] Revert "[nrf fromlist] dts: nordic: Add RESETINFO" This reverts commit a72f221020e3f138aa0645476d1358a0797f1d36. Signed-off-by: Robert Lubos --- dts/bindings/arm/nordic,nrf-resetinfo.yaml | 12 ------------ dts/common/nordic/nrf54h20.dtsi | 10 ---------- 2 files changed, 22 deletions(-) delete mode 100644 dts/bindings/arm/nordic,nrf-resetinfo.yaml diff --git a/dts/bindings/arm/nordic,nrf-resetinfo.yaml b/dts/bindings/arm/nordic,nrf-resetinfo.yaml deleted file mode 100644 index c8585e5897e..00000000000 --- a/dts/bindings/arm/nordic,nrf-resetinfo.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic RESETINFO (Reset Information) - -compatible: "nordic,nrf-resetinfo" - -include: base.yaml - -properties: - reg: - required: true diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 4ab1a63f1ca..794b8bd298a 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -172,11 +172,6 @@ interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>, <65 NRF_DEFAULT_IRQ_PRIORITY>; }; - - cpuapp_resetinfo: resetinfo@1e000 { - compatible = "nordic,nrf-resetinfo"; - reg = <0x1e000 0x1000>; - }; }; cpurad_peripherals: peripheral@53000000 { @@ -197,11 +192,6 @@ nordic,ficr-names = "vsup", "coarse", "fine"; }; - cpurad_resetinfo: resetinfo@1e000 { - compatible = "nordic,nrf-resetinfo"; - reg = <0x1e000 0x1000>; - }; - dppic020: dppic@22000 { compatible = "nordic,nrf-dppic-local"; reg = <0x22000 0x1000>; From 249204e85fc457a7dc193365712a84d484cf6f1f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1965/2300] Revert "[nrf fromlist] soc: nordic: Extend address validation for nRF54H20" This reverts commit 36d7f0a24d16c55cefede716dc9a06e498eb75eb. Signed-off-by: Robert Lubos --- soc/nordic/validate_base_addresses.c | 36 +++++++--------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 5c9f31c9c1f..e83c0ea8dcb 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -37,14 +37,6 @@ #define NRF_QDEC0 NRF_QDEC #endif -#if !defined(NRF_RADIO) && defined(NRF_RADIOCORE_RADIO) -#define NRF_RADIO NRF_RADIOCORE_RADIO -#endif - -#if !defined(NRF_RTC) && defined(NRF_RADIOCORE_RTC) -#define NRF_RTC NRF_RADIOCORE_RTC -#endif - #if !defined(NRF_SWI0) && defined(NRF_SWI_BASE) #define NRF_SWI0 ((0 * 0x1000) + NRF_SWI_BASE) #endif @@ -134,13 +126,8 @@ CHECK_DT_REG(acl, NRF_ACL); CHECK_DT_REG(adc, NODE_ADDRESS(adc, nordic_nrf_adc, NRF_ADC, NRF_SAADC)); -CHECK_DT_REG(cpusec_bellboard, NRF_SECDOMBELLBOARD); -CHECK_DT_REG(cpuapp_bellboard, NRF_APPLICATION_BELLBOARD); -CHECK_DT_REG(cpurad_bellboard, NRF_RADIOCORE_BELLBOARD); CHECK_DT_REG(bprot, NRF_BPROT); CHECK_DT_REG(ccm, NRF_CCM); -CHECK_DT_REG(ccm030, NRF_RADIOCORE_CCM030); -CHECK_DT_REG(ccm031, NRF_RADIOCORE_CCM031); CHECK_DT_REG(clock, NRF_CLOCK); CHECK_DT_REG(comp, NODE_ADDRESS(comp, nordic_nrf_comp, NRF_COMP, NRF_LPCOMP)); CHECK_DT_REG(cryptocell, NRF_CRYPTOCELL); @@ -151,7 +138,7 @@ CHECK_DT_REG(dppic00, NRF_DPPIC00); CHECK_DT_REG(dppic10, NRF_DPPIC10); CHECK_DT_REG(dppic20, NRF_DPPIC20); CHECK_DT_REG(dppic30, NRF_DPPIC30); -CHECK_DT_REG(dppic020, NRF_RADIOCORE_DPPIC020); +CHECK_DT_REG(dppic020, NRF_DPPIC020); CHECK_DT_REG(dppic120, NRF_DPPIC120); CHECK_DT_REG(dppic130, NRF_DPPIC130); CHECK_DT_REG(dppic131, NRF_DPPIC131); @@ -162,8 +149,7 @@ CHECK_DT_REG(dppic135, NRF_DPPIC135); CHECK_DT_REG(dppic136, NRF_DPPIC136); CHECK_DT_REG(ecb, NRF_ECB); CHECK_DT_REG(ecb020, NRF_ECB020); -CHECK_DT_REG(ecb030, NRF_RADIOCORE_ECB030); -CHECK_DT_REG(ecb031, NRF_RADIOCORE_ECB031); +CHECK_DT_REG(ecb030, NRF_ECB030); CHECK_DT_REG(egu0, NRF_EGU0); CHECK_DT_REG(egu1, NRF_EGU1); CHECK_DT_REG(egu2, NRF_EGU2); @@ -172,7 +158,7 @@ CHECK_DT_REG(egu4, NRF_EGU4); CHECK_DT_REG(egu5, NRF_EGU5); CHECK_DT_REG(egu10, NRF_EGU10); CHECK_DT_REG(egu20, NRF_EGU20); -CHECK_DT_REG(egu020, NRF_RADIOCORE_EGU020); +CHECK_DT_REG(egu020, NRF_EGU020); CHECK_DT_REG(ficr, NRF_FICR); CHECK_DT_REG(flash_controller, NRF_NVMC); CHECK_DT_REG(gpio0, NRF_P0); @@ -188,9 +174,6 @@ CHECK_DT_REG(gpiote20, NRF_GPIOTE20); CHECK_DT_REG(gpiote30, NRF_GPIOTE30); CHECK_DT_REG(gpiote130, NRF_GPIOTE130); CHECK_DT_REG(gpiote131, NRF_GPIOTE131); -CHECK_DT_REG(grtc, NRF_GRTC); -CHECK_DT_REG(cpuapp_hsfll, NRF_APPLICATION_HSFLL); -CHECK_DT_REG(cpurad_hsfll, NRF_RADIOCORE_HSFLL); CHECK_I2C_REG(i2c0, 0); CHECK_I2C_REG(i2c1, 1); CHECK_DT_REG(i2c2, NRF_TWIM2); @@ -210,8 +193,8 @@ CHECK_DT_REG(i2c137, NRF_TWIM137); CHECK_DT_REG(i2s0, NRF_I2S0); CHECK_DT_REG(i2s20, NRF_I2S20); CHECK_DT_REG(ipc, NRF_IPC); -CHECK_DT_REG(cpuapp_ipct, NRF_APPLICATION_IPCT); -CHECK_DT_REG(cpurad_ipct, NRF_RADIOCORE_IPCT); +CHECK_DT_REG(cpuapp_ipct, NRF_IPCT); +CHECK_DT_REG(cpurad_ipct, NRF_IPCT); CHECK_DT_REG(ipct120, NRF_IPCT120); CHECK_DT_REG(ipct130, NRF_IPCT130); CHECK_DT_REG(kmu, NRF_KMU); @@ -292,9 +275,9 @@ CHECK_DT_REG(timer21, NRF_TIMER21); CHECK_DT_REG(timer22, NRF_TIMER22); CHECK_DT_REG(timer23, NRF_TIMER23); CHECK_DT_REG(timer24, NRF_TIMER24); -CHECK_DT_REG(timer020, NRF_RADIOCORE_TIMER020); -CHECK_DT_REG(timer021, NRF_RADIOCORE_TIMER021); -CHECK_DT_REG(timer022, NRF_RADIOCORE_TIMER022); +CHECK_DT_REG(timer020, NRF_TIMER020); +CHECK_DT_REG(timer021, NRF_TIMER021); +CHECK_DT_REG(timer022, NRF_TIMER022); CHECK_DT_REG(timer120, NRF_TIMER120); CHECK_DT_REG(timer121, NRF_TIMER121); CHECK_DT_REG(timer130, NRF_TIMER130); @@ -324,14 +307,11 @@ CHECK_DT_REG(uart135, NRF_UARTE135); CHECK_DT_REG(uart136, NRF_UARTE136); CHECK_DT_REG(uart137, NRF_UARTE137); CHECK_DT_REG(uicr, NRF_UICR); -CHECK_DT_REG(cpuapp_uicr, NRF_APPLICATION_UICR); -CHECK_DT_REG(cpurad_uicr, NRF_RADIOCORE_UICR); CHECK_DT_REG(usbd, NRF_USBD); CHECK_DT_REG(usbhs, NRF_USBHS); CHECK_DT_REG(usbhs_core, NRF_USBHSCORE0); CHECK_DT_REG(usbreg, NRF_USBREGULATOR); CHECK_DT_REG(vmc, NRF_VMC); -CHECK_DT_REG(cpuppr_vpr, NRF_VPR130); CHECK_DT_REG(wdt, NRF_WDT0); /* this should be the same node as wdt0 */ CHECK_DT_REG(wdt0, NRF_WDT0); CHECK_DT_REG(wdt1, NRF_WDT1); From 6f96a68faa96b56a9690f17f3a7125ee6669527c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1966/2300] Revert "[nrf fromlist] soc: nordic: nrf54h20: Use KERNEL_INIT_PRIORITY_DEFAULT" This reverts commit fc66ed99e00a18e04179034ddae99e50b510db33. Signed-off-by: Robert Lubos --- soc/nordic/nrf54h/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index ce5af2e25af..1ba620473a0 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -111,4 +111,4 @@ void arch_busy_wait(uint32_t time_us) nrfx_coredep_delay_us(time_us); } -SYS_INIT(nordicsemi_nrf54h_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(nordicsemi_nrf54h_init, PRE_KERNEL_1, 0); From 534805c0a8e6fd186678b838c008ccc33605e25e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1967/2300] Revert "[nrf fromlist] soc: nordic: nrf54h20: Make HSFLL trims optional" This reverts commit 39db5e1c6193488d9efca5f2275829b7935f187b. Signed-off-by: Robert Lubos --- dts/bindings/clock/nordic,nrf-hsfll.yaml | 6 ++++++ soc/nordic/nrf54h/soc.c | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dts/bindings/clock/nordic,nrf-hsfll.yaml b/dts/bindings/clock/nordic,nrf-hsfll.yaml index f1077dbc4f0..3614d80870f 100644 --- a/dts/bindings/clock/nordic,nrf-hsfll.yaml +++ b/dts/bindings/clock/nordic,nrf-hsfll.yaml @@ -57,3 +57,9 @@ properties: - 368000000 - 384000000 - 400000000 + + nordic,ficrs: + required: true + + nordic,ficr-names: + required: true diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 1ba620473a0..df72cdb977b 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -55,8 +55,6 @@ static void power_domain_init(void) static int trim_hsfll(void) { -#if defined(HSFLL_NODE) - NRF_HSFLL_Type *hsfll = (NRF_HSFLL_Type *)DT_REG_ADDR(HSFLL_NODE); nrf_hsfll_trim_t trim = { .vsup = sys_read32(FICR_ADDR_GET(HSFLL_NODE, vsup)), @@ -79,8 +77,6 @@ static int trim_hsfll(void) LOG_DBG("NRF_HSFLL->TRIM.COARSE = %d", hsfll->TRIM.COARSE); LOG_DBG("NRF_HSFLL->TRIM.FINE = %d", hsfll->TRIM.FINE); -#endif /* defined(HSFLL_NODE) */ - return 0; } From c19d6fd14649f7e5176e893fb47ab862521c0bde Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1968/2300] Revert "[nrf fromtree] dts: nordic: add EXMIF peripheral description to nRF54H20" This reverts commit 8f5467b5c414c88e65eb3de1ea686337c4ed08a2. Signed-off-by: Robert Lubos --- dts/bindings/spi/nordic,nrf-exmif.yaml | 12 ------------ dts/common/nordic/nrf54h20.dtsi | 13 ------------- 2 files changed, 25 deletions(-) delete mode 100644 dts/bindings/spi/nordic,nrf-exmif.yaml diff --git a/dts/bindings/spi/nordic,nrf-exmif.yaml b/dts/bindings/spi/nordic,nrf-exmif.yaml deleted file mode 100644 index d2b8815046b..00000000000 --- a/dts/bindings/spi/nordic,nrf-exmif.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic External Memory Interface (EXMIF) - -compatible: "nordic,nrf-exmif" - -include: snps,designware-spi.yaml - -properties: - reg: - required: true diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 794b8bd298a..9b19115fda5 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -312,19 +312,6 @@ status = "disabled"; }; - exmif: spi@95000 { - compatible = "nordic,nrf-exmif", "snps,designware-spi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x95000 0x500 0x95500 0xb00>; - reg-names = "wrapper", "core"; - interrupts = <149 NRF_DEFAULT_IRQ_PRIORITY>; - clock-frequency = ; - fifo-depth = <32>; - max-xfer-size = <16>; - status = "disabled"; - }; - cpusec_bellboard: mailbox@99000 { reg = <0x99000 0x1000>; status = "disabled"; From b00ae25abe84fa0d0f5fc2f5cbaaed54788f50be Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1969/2300] Revert "[nrf fromtree] dts: nordic: add USBHS node for nrf54h20" This reverts commit 66d01b5efee856ada78e99736f139fc21aaa9f39. Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54h20.dtsi | 8 -------- soc/nordic/validate_base_addresses.c | 2 -- 2 files changed, 10 deletions(-) diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 9b19115fda5..43a47a153a8 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -304,14 +304,6 @@ #size-cells = <1>; ranges = <0x0 0x5f000000 0x1000000>; - usbhs: usbhs@86000 { - compatible = "snps,dwc2"; - reg = <0x86000 0x1000>, <0x2f700000 0x40000>; - reg-names = "wrapper", "core"; - interrupts = <134 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - cpusec_bellboard: mailbox@99000 { reg = <0x99000 0x1000>; status = "disabled"; diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index e83c0ea8dcb..1fa4c87c97b 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -308,8 +308,6 @@ CHECK_DT_REG(uart136, NRF_UARTE136); CHECK_DT_REG(uart137, NRF_UARTE137); CHECK_DT_REG(uicr, NRF_UICR); CHECK_DT_REG(usbd, NRF_USBD); -CHECK_DT_REG(usbhs, NRF_USBHS); -CHECK_DT_REG(usbhs_core, NRF_USBHSCORE0); CHECK_DT_REG(usbreg, NRF_USBREGULATOR); CHECK_DT_REG(vmc, NRF_VMC); CHECK_DT_REG(wdt, NRF_WDT0); /* this should be the same node as wdt0 */ From c289f90d3cdc0db7b8c54bc532409a67da7d6016 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1970/2300] Revert "[nrf fromtree] soc: nordic: vpr: fix soc isr sw stacking." This reverts commit a0e4011234b9fb049c6d0e10d67cceb8b7e91024. Signed-off-by: Robert Lubos --- soc/nordic/common/vpr/soc_context.h | 14 ++---------- soc/nordic/common/vpr/soc_isr_stacking.h | 29 +++--------------------- soc/nordic/common/vpr/soc_offsets.h | 4 +--- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/soc/nordic/common/vpr/soc_context.h b/soc/nordic/common/vpr/soc_context.h index 9735057e792..8cd0d1e5094 100644 --- a/soc/nordic/common/vpr/soc_context.h +++ b/soc/nordic/common/vpr/soc_context.h @@ -6,17 +6,7 @@ #ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ #define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ -#define SOC_ESF_MEMBERS \ - unsigned long minttresh; \ - unsigned long sp_align; \ - unsigned long padding0; \ - unsigned long padding1; \ - unsigned long padding2 - -#define SOC_ESF_INIT \ - 0, \ - 0, \ - 0, \ - 0 +#define SOC_ESF_MEMBERS unsigned long minttresh +#define SOC_ESF_INIT 0 #endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_CONTEXT_H_ */ diff --git a/soc/nordic/common/vpr/soc_isr_stacking.h b/soc/nordic/common/vpr/soc_isr_stacking.h index ff34f9d4e09..d5b139111d0 100644 --- a/soc/nordic/common/vpr/soc_isr_stacking.h +++ b/soc/nordic/common/vpr/soc_isr_stacking.h @@ -56,8 +56,8 @@ unsigned long a2; \ unsigned long a1; \ unsigned long a0; \ - unsigned long _mcause; \ unsigned long mepc; \ + unsigned long _mcause; \ } __aligned(16); #endif /* DT_PROP(VPR_CPU, nordic_bus_width) == 64 */ @@ -79,28 +79,7 @@ * Size of the SW managed part of the ESF in case of interrupt * sizeof(__padding) + ... + sizeof(soc_context) */ -#define ESF_SW_IRQ_SIZEOF (0x20) - -/* - * VPR needs aligned(8) SP when doing HW stacking, if this condition is not fulfilled it will move - * SP by additional 4 bytes when HW stacking is done. This will be indicated by LSB bit in stacked - * MEPC. This bit needs to be saved and then restored because zephyr is managing MEPC and doesn't - * know anything about this additional offset. - */ -#define MEPC_SP_ALIGN_BIT_MASK (0x1UL) - -#define STORE_SP_ALIGN_BIT_FROM_MEPC \ - addi t1, sp, __z_arch_esf_t_soc_context_OFFSET; \ - lr t0, __z_arch_esf_t_mepc_OFFSET(sp); \ - andi t0, t0, MEPC_SP_ALIGN_BIT_MASK; \ - sr t0, __soc_esf_t_sp_align_OFFSET(t1) - -#define RESTORE_SP_ALIGN_BIT_TO_MEPC \ - addi t1, sp, __z_arch_esf_t_soc_context_OFFSET; \ - lr t0, __soc_esf_t_sp_align_OFFSET(t1); \ - lr t1, __z_arch_esf_t_mepc_OFFSET(sp); \ - or t2, t1, t0; \ - sr t2, __z_arch_esf_t_mepc_OFFSET(sp) +#define ESF_SW_IRQ_SIZEOF (0x10) #define SOC_ISR_SW_STACKING \ csrw mscratch, t0; \ @@ -118,11 +97,9 @@ stacking_is_interrupt: \ addi sp, sp, -ESF_SW_IRQ_SIZEOF; \ \ -stacking_keep_going: \ - STORE_SP_ALIGN_BIT_FROM_MEPC +stacking_keep_going: #define SOC_ISR_SW_UNSTACKING \ - RESTORE_SP_ALIGN_BIT_TO_MEPC; \ csrr t0, mcause; \ srli t0, t0, RISCV_MCAUSE_IRQ_POS; \ bnez t0, unstacking_is_interrupt; \ diff --git a/soc/nordic/common/vpr/soc_offsets.h b/soc/nordic/common/vpr/soc_offsets.h index f03f784e864..92d91044e1a 100644 --- a/soc/nordic/common/vpr/soc_offsets.h +++ b/soc/nordic/common/vpr/soc_offsets.h @@ -6,8 +6,6 @@ #ifndef SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ #define SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ -#define GEN_SOC_OFFSET_SYMS() \ - GEN_OFFSET_SYM(soc_esf_t, minttresh); \ - GEN_OFFSET_SYM(soc_esf_t, sp_align) +#define GEN_SOC_OFFSET_SYMS() GEN_OFFSET_SYM(soc_esf_t, minttresh) #endif /* SOC_RISCV_NORDIC_NRF_COMMON_VPR_SOC_OFFSETS_H_ */ From aea2e447131e8172657eaea16b8aba6bb494de7a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:13 +0200 Subject: [PATCH 1971/2300] Revert "[nrf fromtree] drivers/timer grtc: Fix for ISR prototype" This reverts commit 48041ad564d1ceccc9fd7dd12980c48dfc207ba5. Signed-off-by: Robert Lubos --- drivers/timer/nrf_grtc_timer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 7f6ae02bceb..3ed746e692a 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -495,8 +495,7 @@ static int sys_clock_driver_init(void) nrfy_grtc_waketime_set(NRF_GRTC, WAKETIME); #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr, - nrfx_grtc_irq_handler, 0); + IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_grtc_irq_handler, 0, 0); err_code = nrfx_grtc_init(0); if (err_code != NRFX_SUCCESS) { From 7b9045dd3edf1da3beaa2e0beb2ae1b31fcd9e85 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1972/2300] Revert "[nrf fromtree] boards: nordic: nrf54h20dk: Add IPC configuration for SysCtrl" This reverts commit f52294a0bf61104d603c1d75f96c49161843f273. Signed-off-by: Robert Lubos --- .../nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 14 -------------- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 11 ++--------- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts | 2 -- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 11 ++--------- 4 files changed, 4 insertions(+), 34 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index 944dd7fb6ab..539e80d149a 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -27,25 +27,11 @@ <&cpurad_bellboard 12>; }; - cpuapp_cpusys_ipc: ipc-2-12 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpuapp_bellboard 6>, - <&cpusys_vevif 12>; - }; - cpuapp_cpuppr_ipc: ipc-2-13 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; mboxes = <&cpuapp_bellboard 13>, <&cpuppr_vevif 12>; }; - - cpurad_cpusys_ipc: ipc-3-12 { - compatible = "zephyr,ipc-icmsg"; - status = "disabled"; - mboxes = <&cpurad_bellboard 6>, - <&cpusys_vevif 18>; - }; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 24d161420d6..7f2f918b0b9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -11,7 +11,6 @@ #include "nrf54h20dk_nrf54h20-ipc_conf.dtsi" #include "nrf54h20dk_nrf54h20-pinctrl.dtsi" -/delete-node/ &cpurad_cpusys_ipc; /delete-node/ &cpusec_cpurad_ipc; / { @@ -121,8 +120,8 @@ status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; - /* irq0: 0: cpuapp-cpusec, 6: cpuapp-cpusys, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ - nordic,interrupt-mapping = <0x00042041 0>; + /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ + nordic,interrupt-mapping = <0x00042001 0>; }; &cpurad_bellboard { @@ -144,12 +143,6 @@ ipc0: &cpuapp_cpurad_ipc { rx-blocks = <32>; }; -&cpuapp_cpusys_ipc { - mbox-names = "rx", "tx"; - tx-region = <&cpuapp_cpusys_ipc_shm>; - rx-region = <&cpusys_cpuapp_ipc_shm>; -}; - &cpuapp_cpuppr_ipc { mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpuppr_ipc_shm>; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts index 80b690839d7..4cfad97323e 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts @@ -12,8 +12,6 @@ #include "nrf54h20dk_nrf54h20-pinctrl.dtsi" /delete-node/ &cpuapp_cpurad_ipc; -/delete-node/ &cpuapp_cpusys_ipc; -/delete-node/ &cpurad_cpusys_ipc; /delete-node/ &cpusec_cpuapp_ipc; /delete-node/ &cpusec_cpurad_ipc; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index cb69b5ce3a6..d72aa791091 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -12,7 +12,6 @@ #include "nrf54h20dk_nrf54h20-pinctrl.dtsi" /delete-node/ &cpuapp_cpuppr_ipc; -/delete-node/ &cpuapp_cpusys_ipc; /delete-node/ &cpusec_cpuapp_ipc; / { @@ -47,8 +46,8 @@ status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; - /* irq0: 0: cpurad-cpusec, 6: cpurad-cpusys, 12: cpurad-cpuapp */ - nordic,interrupt-mapping = <0x00001041 0>; + /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ + nordic,interrupt-mapping = <0x00001001 0>; }; &cpuapp_bellboard { @@ -70,12 +69,6 @@ ipc0: &cpuapp_cpurad_ipc { rx-blocks = <32>; }; -&cpurad_cpusys_ipc { - mbox-names = "rx", "tx"; - tx-region = <&cpurad_cpusys_ipc_shm>; - rx-region = <&cpusys_cpurad_ipc_shm>; -}; - &cpurad_dma_region { status = "okay"; }; From 8376fc934574cdbb1f8a3bba45a2405caca39603 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1973/2300] Revert "[nrf fromtree] dts: nordic: nrf54h20: Add SysCtrl VEVIF node" This reverts commit eb865af70063620c73a9a364e01c51ed113bed79. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf54h20_cpuapp.dtsi | 1 - dts/arm/nordic/nrf54h20_cpurad.dtsi | 1 - dts/common/nordic/nrf54h20.dtsi | 9 --------- dts/riscv/nordic/nrf54h20_cpuppr.dtsi | 1 - 4 files changed, 12 deletions(-) diff --git a/dts/arm/nordic/nrf54h20_cpuapp.dtsi b/dts/arm/nordic/nrf54h20_cpuapp.dtsi index 9d011019f4a..d82c69262c0 100644 --- a/dts/arm/nordic/nrf54h20_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54h20_cpuapp.dtsi @@ -10,7 +10,6 @@ cpu: &cpuapp {}; systick: &cpuapp_systick {}; nvic: &cpuapp_nvic {}; cpuppr_vevif: &cpuppr_vevif_remote {}; -cpusys_vevif: &cpusys_vevif_remote {}; /delete-node/ &cpuppr; /delete-node/ &cpurad; diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index 2a62845dc89..4bdaf76e348 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -10,7 +10,6 @@ cpu: &cpurad {}; systick: &cpurad_systick {}; nvic: &cpurad_nvic {}; cpuppr_vevif: &cpuppr_vevif_remote {}; -cpusys_vevif: &cpusys_vevif_remote {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 43a47a153a8..034c8ac58df 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -322,15 +322,6 @@ #mbox-cells = <1>; }; - cpusys_vevif_remote: mailbox@8c8000 { - compatible = "nordic,nrf-vevif-remote"; - reg = <0x8c8000 0x1000>; - status = "disabled"; - #mbox-cells = <1>; - nordic,tasks = <32>; - nordic,tasks-mask = <0xfffff0ff>; - }; - ipct120: ipct@8d1000 { compatible = "nordic,nrf-ipct-global"; reg = <0x8d1000 0x1000>; diff --git a/dts/riscv/nordic/nrf54h20_cpuppr.dtsi b/dts/riscv/nordic/nrf54h20_cpuppr.dtsi index 6f90cbf3e6a..d74147bc04b 100644 --- a/dts/riscv/nordic/nrf54h20_cpuppr.dtsi +++ b/dts/riscv/nordic/nrf54h20_cpuppr.dtsi @@ -9,7 +9,6 @@ cpu: &cpuppr {}; clic: &cpuppr_clic {}; cpuppr_vevif: &cpuppr_vevif_local {}; -cpusys_vevif: &cpusys_vevif_remote {}; /delete-node/ &cpuapp; /delete-node/ &cpuapp_peripherals; From 3a79f9393524ab42f1044dce6deb92217f5676ba Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1974/2300] Revert "[nrf fromtree] modules: hal_nordic: Fix NRF_GRTC_HAS_EXTENDED" This reverts commit fc4ac4c8ca5141ce5d9ab1774473ddaeb3aa46af. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 540ec4e0b30..463c4790743 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -128,7 +128,7 @@ if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM) endif() if (CONFIG_NRF_GRTC_TIMER AND CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) - zephyr_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) + zephyr_library_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) endif() # Inject HAL "CONFIG_NFCT_PINS_AS_GPIOS" definition if user requests to From 92e0d2fc818aa5b9d0e59d99abd774ad07e27a8d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1975/2300] Revert "[nrf fromtree] kconfig: openthread: Fix PSA Key Ref config for RCP architecture" This reverts commit bec373297305358a7b55b186d52498fbe69b0abe. Signed-off-by: Robert Lubos --- subsys/net/l2/openthread/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/openthread/Kconfig b/subsys/net/l2/openthread/Kconfig index 9673aa7702a..ef71e411b4e 100644 --- a/subsys/net/l2/openthread/Kconfig +++ b/subsys/net/l2/openthread/Kconfig @@ -323,8 +323,8 @@ config OPENTHREAD_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE config OPENTHREAD_CRYPTO_PSA bool "ARM PSA crypto API" depends on MBEDTLS_PSA_CRYPTO_C || BUILD_WITH_TFM - select OPENTHREAD_PLATFORM_KEY_REF if !OPENTHREAD_COPROCESSOR_RCP - imply OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE + select OPENTHREAD_PLATFORM_KEY_REF + select OPENTHREAD_PLATFORM_KEYS_EXPORTABLE_ENABLE help Enable crypto backend library implementation based on ARM PSA crypto API instead of the default, using mbedTLS. From 2145af3dfc952fe4f950b752d3b95dbf06a72498 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1976/2300] Revert "[nrf fromtree] net: ipv6: mld: Fix improper reference drop" This reverts commit 26f4b1bee18ab7851676fd836a4e7348ed0470ca. Signed-off-by: Robert Lubos --- subsys/net/ip/ipv6_mld.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/subsys/net/ip/ipv6_mld.c b/subsys/net/ip/ipv6_mld.c index f2ae80e0f10..2bd67a08c8e 100644 --- a/subsys/net/ip/ipv6_mld.c +++ b/subsys/net/ip/ipv6_mld.c @@ -299,11 +299,9 @@ static int send_mld_report(struct net_if *iface) ret = mld_send(pkt); if (ret < 0) { - goto drop; + return ret; } - return 0; - drop: net_pkt_unref(pkt); From f2381935d0f61eb47ea4eaddf71060b43c3f3bbe Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1977/2300] Revert "[nrf fromtree] bluetooth: mesh: Adapt BLOB IO to RRAM write size" This reverts commit 8137bd7e5109e8616d8271379997abc070d563b1. Signed-off-by: Robert Lubos --- subsys/bluetooth/mesh/blob_io_flash.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/subsys/bluetooth/mesh/blob_io_flash.c b/subsys/bluetooth/mesh/blob_io_flash.c index b82a7d20f7f..8090416ab12 100644 --- a/subsys/bluetooth/mesh/blob_io_flash.c +++ b/subsys/bluetooth/mesh/blob_io_flash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Nordic Semiconductor ASA + * Copyright (c) 2020 Noioic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ @@ -12,7 +12,7 @@ #include "net.h" #include "transport.h" -#define WRITE_BLOCK_SIZE DT_PROP(DT_INST(0, soc_nv_flash), write_block_size) +#define WRITE_BLOCK_SIZE 4 #define FLASH_IO(_io) CONTAINER_OF(_io, struct bt_mesh_blob_io_flash, io) @@ -110,13 +110,6 @@ static int wr_chunk(const struct bt_mesh_blob_io *io, const struct bt_mesh_blob_chunk *chunk) { struct bt_mesh_blob_io_flash *flash = FLASH_IO(io); - - if (IS_ENABLED(CONFIG_SOC_FLASH_NRF_RRAM)) { - return flash_area_write(flash->area, - flash->offset + block->offset + chunk->offset, - chunk->data, chunk->size); - } - uint8_t buf[ROUND_UP(BLOB_CHUNK_SIZE_MAX(BT_MESH_RX_SDU_MAX), WRITE_BLOCK_SIZE)]; off_t area_offset = flash->offset + block->offset + chunk->offset; From 4ead3d7a98d0e74c55c7e5da112acab8046b0199 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1978/2300] Revert "[nrf fromtree] net: if: Extend the usage of rejoining the multicast groups" This reverts commit 934b55e21e52316a895219ce81a48bb72d0b7e77. Signed-off-by: Robert Lubos --- subsys/net/ip/net_if.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 15a66af477c..a72470a434d 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -4633,18 +4633,6 @@ bool net_if_is_offloaded(struct net_if *iface) net_if_is_socket_offloaded(iface)); } -static void rejoin_multicast_groups(struct net_if *iface) -{ -#if defined(CONFIG_NET_NATIVE_IPV6) - rejoin_ipv6_mcast_groups(iface); - if (l2_flags_get(iface) & NET_L2_MULTICAST) { - join_mcast_allnodes(iface); - } -#else - ARG_UNUSED(iface); -#endif -} - static void notify_iface_up(struct net_if *iface) { /* In many places it's assumed that link address was set with @@ -4671,10 +4659,6 @@ static void notify_iface_up(struct net_if *iface) */ if (!net_if_is_offloaded(iface) && !(l2_flags_get(iface) & NET_L2_POINT_TO_POINT)) { - /* Make sure that we update the IPv6 addresses and join the - * multicast groups. - */ - rejoin_multicast_groups(iface); iface_ipv6_start(iface); net_ipv4_autoconf_start(iface); } @@ -4796,6 +4780,13 @@ static void init_igmp(struct net_if *iface) #endif } +static void rejoin_multicast_groups(struct net_if *iface) +{ +#if defined(CONFIG_NET_NATIVE_IPV6) + rejoin_ipv6_mcast_groups(iface); +#endif +} + int net_if_up(struct net_if *iface) { int status = 0; @@ -4853,6 +4844,14 @@ int net_if_up(struct net_if *iface) net_mgmt_event_notify(NET_EVENT_IF_ADMIN_UP, iface); update_operational_state(iface); + if (!net_if_is_offloaded(iface)) { + /* Make sure that we update the IPv6 addresses and join the + * multicast groups. + */ + rejoin_multicast_groups(iface); + net_if_start_dad(iface); + } + out: net_if_unlock(iface); From 1f9b2f9118cd047faf50dca7bfc698bb980530cd Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1979/2300] Revert "[nrf fromtree] net: arp: Add support for gratuitous ARP transmission" This reverts commit 7c0c899c4e1eba58019c9424b3e8bcd5e5f2f2fc. Signed-off-by: Robert Lubos --- subsys/net/l2/ethernet/Kconfig | 13 --- subsys/net/l2/ethernet/arp.c | 157 --------------------------------- 2 files changed, 170 deletions(-) diff --git a/subsys/net/l2/ethernet/Kconfig b/subsys/net/l2/ethernet/Kconfig index e6fd07e47e2..17588b17fd1 100644 --- a/subsys/net/l2/ethernet/Kconfig +++ b/subsys/net/l2/ethernet/Kconfig @@ -73,19 +73,6 @@ config NET_ARP_GRATUITOUS ff:ff:ff:ff:ff:ff. Ordinarily, no reply packet will occur. A gratuitous ARP reply is a reply to which no request has been made. -config NET_ARP_GRATUITOUS_TRANSMISSION - bool "Transmit gratuitous ARP requests" - depends on NET_ARP_GRATUITOUS - depends on NET_MGMT_EVENT - depends on NET_MGMT_EVENT_INFO - help - Transmit gratuitous ARP requests, as defined in RFC 5227. - -config NET_ARP_GRATUITOUS_INTERVAL - int "Time interval (in seconds) between sending gratuitous ARP requests" - depends on NET_ARP_GRATUITOUS_TRANSMISSION - default 60 - if NET_ARP module = NET_ARP module-dep = NET_LOG diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index 85eafd0eedb..7c0a2ba74f2 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -16,7 +16,6 @@ LOG_MODULE_REGISTER(net_arp, CONFIG_NET_ARP_LOG_LEVEL); #include #include #include -#include #include "arp.h" #include "net_private.h" @@ -35,12 +34,6 @@ static struct k_work_delayable arp_request_timer; static struct k_mutex arp_mutex; -#if defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) -static struct net_mgmt_event_callback iface_event_cb; -static struct net_mgmt_event_callback ipv4_event_cb; -static struct k_work_delayable arp_gratuitous_work; -#endif /* defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) */ - static void arp_entry_cleanup(struct arp_entry *entry, bool pending) { NET_DBG("entry %p", entry); @@ -473,141 +466,6 @@ static void arp_gratuitous(struct net_if *iface, } } -#if defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) -static void arp_gratuitous_send(struct net_if *iface, - struct in_addr *ipaddr) -{ - struct net_arp_hdr *hdr; - struct net_pkt *pkt; - - pkt = net_pkt_alloc_with_buffer(iface, sizeof(struct net_arp_hdr), - AF_UNSPEC, 0, NET_BUF_TIMEOUT); - if (!pkt) { - return; - } - - net_buf_add(pkt->buffer, sizeof(struct net_arp_hdr)); - net_pkt_set_vlan_tag(pkt, net_eth_get_vlan_tag(iface)); - - hdr = NET_ARP_HDR(pkt); - - hdr->hwtype = htons(NET_ARP_HTYPE_ETH); - hdr->protocol = htons(NET_ETH_PTYPE_IP); - hdr->hwlen = sizeof(struct net_eth_addr); - hdr->protolen = sizeof(struct in_addr); - hdr->opcode = htons(NET_ARP_REQUEST); - - memcpy(&hdr->dst_hwaddr.addr, net_eth_broadcast_addr(), - sizeof(struct net_eth_addr)); - memcpy(&hdr->src_hwaddr.addr, net_if_get_link_addr(iface)->addr, - sizeof(struct net_eth_addr)); - - net_ipv4_addr_copy_raw(hdr->dst_ipaddr, (uint8_t *)ipaddr); - net_ipv4_addr_copy_raw(hdr->src_ipaddr, (uint8_t *)ipaddr); - - net_pkt_lladdr_src(pkt)->addr = net_if_get_link_addr(iface)->addr; - net_pkt_lladdr_src(pkt)->len = sizeof(struct net_eth_addr); - - net_pkt_lladdr_dst(pkt)->addr = (uint8_t *)net_eth_broadcast_addr(); - net_pkt_lladdr_dst(pkt)->len = sizeof(struct net_eth_addr); - - NET_DBG("Sending gratuitous ARP pkt %p", pkt); - - if (net_if_send_data(iface, pkt) == NET_DROP) { - net_pkt_unref(pkt); - } -} - -static void notify_all_ipv4_addr(struct net_if *iface) -{ - struct net_if_ipv4 *ipv4 = iface->config.ip.ipv4; - int i; - - if (!ipv4) { - return; - } - - for (i = 0; i < NET_IF_MAX_IPV4_ADDR; i++) { - if (ipv4->unicast[i].ipv4.is_used && - ipv4->unicast[i].ipv4.address.family == AF_INET && - ipv4->unicast[i].ipv4.addr_state == NET_ADDR_PREFERRED) { - arp_gratuitous_send(iface, - &ipv4->unicast[i].ipv4.address.in_addr); - } - } -} - -static void iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) -{ - ARG_UNUSED(cb); - - if (!(net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET) || - net_eth_is_vlan_interface(iface))) { - return; - } - - if (mgmt_event != NET_EVENT_IF_UP) { - return; - } - - notify_all_ipv4_addr(iface); -} - -static void ipv4_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) -{ - struct in_addr *ipaddr; - - if (!(net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET) || - net_eth_is_vlan_interface(iface))) { - return; - } - - if (!net_if_is_up(iface)) { - return; - } - - if (mgmt_event != NET_EVENT_IPV4_ADDR_ADD) { - return; - } - - if (cb->info_length != sizeof(struct in_addr)) { - return; - } - - ipaddr = (struct in_addr *)cb->info; - - arp_gratuitous_send(iface, ipaddr); -} - -static void iface_cb(struct net_if *iface, void *user_data) -{ - ARG_UNUSED(user_data); - - if (!(net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET) || - net_eth_is_vlan_interface(iface))) { - return; - } - - if (!net_if_is_up(iface)) { - return; - } - - notify_all_ipv4_addr(iface); -} - -static void arp_gratuitous_work_handler(struct k_work *work) -{ - ARG_UNUSED(work); - - net_if_foreach(iface_cb, NULL); - - k_work_reschedule(&arp_gratuitous_work, - K_SECONDS(CONFIG_NET_ARP_GRATUITOUS_INTERVAL)); -} -#endif /* defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) */ - void net_arp_update(struct net_if *iface, struct in_addr *src, struct net_eth_addr *hwaddr, @@ -979,19 +837,4 @@ void net_arp_init(void) k_mutex_init(&arp_mutex); arp_cache_initialized = true; - -#if defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) - net_mgmt_init_event_callback(&iface_event_cb, iface_event_handler, - NET_EVENT_IF_UP); - net_mgmt_init_event_callback(&ipv4_event_cb, ipv4_event_handler, - NET_EVENT_IPV4_ADDR_ADD); - - net_mgmt_add_event_callback(&iface_event_cb); - net_mgmt_add_event_callback(&ipv4_event_cb); - - k_work_init_delayable(&arp_gratuitous_work, - arp_gratuitous_work_handler); - k_work_reschedule(&arp_gratuitous_work, - K_SECONDS(CONFIG_NET_ARP_GRATUITOUS_INTERVAL)); -#endif /* defined(CONFIG_NET_ARP_GRATUITOUS_TRANSMISSION) */ } From 5a0920c508d7f386e3e2c91c8930b3d07f00d7ba Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1980/2300] Revert "[nrf fromtree] net: vlan: Add a function to check if interface is VLAN one" This reverts commit f92b43cfe1cec05636b9991caf7a3b76dea81f23. Signed-off-by: Robert Lubos --- include/zephyr/net/ethernet.h | 18 ------------------ subsys/net/l2/ethernet/vlan.c | 16 ---------------- tests/net/vlan/src/main.c | 5 ----- 3 files changed, 39 deletions(-) diff --git a/include/zephyr/net/ethernet.h b/include/zephyr/net/ethernet.h index 9ecc7340d03..e39fa7d170e 100644 --- a/include/zephyr/net/ethernet.h +++ b/include/zephyr/net/ethernet.h @@ -971,24 +971,6 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface) } #endif -/** - * @brief Check if the given interface is a VLAN interface. - * - * @param iface Network interface - * - * @return True if this network interface is VLAN one, false if not. - */ -#if defined(CONFIG_NET_VLAN) -bool net_eth_is_vlan_interface(struct net_if *iface); -#else -static inline bool net_eth_is_vlan_interface(struct net_if *iface) -{ - ARG_UNUSED(iface); - - return false; -} -#endif - #if !defined(CONFIG_ETH_DRIVER_RAW_MODE) #define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \ diff --git a/subsys/net/l2/ethernet/vlan.c b/subsys/net/l2/ethernet/vlan.c index f8e21efbbb0..9a6d660aeb6 100644 --- a/subsys/net/l2/ethernet/vlan.c +++ b/subsys/net/l2/ethernet/vlan.c @@ -336,22 +336,6 @@ uint16_t net_eth_get_vlan_tag(struct net_if *iface) return tag; } -bool net_eth_is_vlan_interface(struct net_if *iface) -{ - enum virtual_interface_caps caps; - - if (net_if_l2(iface) != &NET_L2_GET_NAME(VIRTUAL)) { - return false; - } - - caps = net_virtual_get_iface_capabilities(iface); - if (!(caps & VIRTUAL_INTERFACE_VLAN)) { - return false; - } - - return true; -} - bool net_eth_get_vlan_status(struct net_if *iface) { bool status = false; diff --git a/tests/net/vlan/src/main.c b/tests/net/vlan/src/main.c index a7851cc2fc6..a17aef644c7 100644 --- a/tests/net/vlan/src/main.c +++ b/tests/net/vlan/src/main.c @@ -581,11 +581,6 @@ static void test_vlan_enable(void) ARRAY_FOR_EACH_PTR(vlan_interfaces, vlan_iface) { uint16_t tag; - ret = net_eth_is_vlan_interface(*vlan_iface); - zassert_equal(ret, true, - "Not identified as VLAN interface %d", - net_if_get_by_iface(*vlan_iface)); - if (*vlan_iface == iface) { tag = net_eth_get_vlan_tag(*vlan_iface); From d7adf3bd8ca5b16b06042eefa1c7f95fda7bcfa7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1981/2300] Revert "[nrf fromtree] net: vlan: Fix net_eth_get_vlan_tag() to check correct interface" This reverts commit ea89f1f8f5795301fe2448ce81dd2589f3e04b00. Signed-off-by: Robert Lubos --- subsys/net/l2/ethernet/vlan.c | 17 +++++++++-------- tests/net/vlan/src/main.c | 25 ++++--------------------- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/subsys/net/l2/ethernet/vlan.c b/subsys/net/l2/ethernet/vlan.c index 9a6d660aeb6..844a6bbd2ef 100644 --- a/subsys/net/l2/ethernet/vlan.c +++ b/subsys/net/l2/ethernet/vlan.c @@ -317,17 +317,18 @@ bool net_eth_is_vlan_enabled(struct ethernet_context *ctx, uint16_t net_eth_get_vlan_tag(struct net_if *iface) { uint16_t tag = NET_VLAN_TAG_UNSPEC; + struct vlan_context *ctx; k_mutex_lock(&lock, K_FOREVER); - ARRAY_FOR_EACH(vlan_ctx, i) { - if (vlan_ctx[i] == NULL || !vlan_ctx[i]->is_used) { - continue; - } - - if (vlan_ctx[i]->iface == iface) { - tag = vlan_ctx[i]->tag; - break; + ctx = get_vlan_ctx(iface, tag, true); + if (ctx != NULL) { + /* The Ethernet interface does not have a tag so if user + * tried to use the main interface, then do not return + * the tag. + */ + if (ctx->attached_to != iface) { + tag = ctx->tag; } } diff --git a/tests/net/vlan/src/main.c b/tests/net/vlan/src/main.c index a17aef644c7..e739af7dd12 100644 --- a/tests/net/vlan/src/main.c +++ b/tests/net/vlan/src/main.c @@ -574,23 +574,6 @@ static void test_vlan_enable(void) ret = net_eth_vlan_enable(iface, VLAN_TAG_1); zassert_equal(ret, -EALREADY, "VLAN tag %d enabled for iface 1 (%d)", VLAN_TAG_1, ret); - - for (int i = VLAN_TAG_1; i <= VLAN_TAG_5; i += 100) { - iface = net_eth_get_vlan_iface(NULL, i); - - ARRAY_FOR_EACH_PTR(vlan_interfaces, vlan_iface) { - uint16_t tag; - - if (*vlan_iface == iface) { - tag = net_eth_get_vlan_tag(*vlan_iface); - - zassert_equal(tag, i, - "Could not get the VLAN interface (%d)", - net_if_get_by_iface(*vlan_iface)); - break; - } - } - } } static void test_vlan_disable(void) @@ -645,13 +628,13 @@ static void test_vlan_enable_all(void) int ret; ret = net_eth_vlan_enable(eth_interfaces[0], VLAN_TAG_1); - zassert_true(ret == 0 || ret == -EALREADY, "Cannot enable %d", VLAN_TAG_1); + zassert_equal(ret, 0, "Cannot enable %d", VLAN_TAG_1); ret = net_eth_vlan_enable(eth_interfaces[0], VLAN_TAG_2); - zassert_true(ret == 0 || ret == -EALREADY, "Cannot enable %d", VLAN_TAG_2); + zassert_equal(ret, 0, "Cannot enable %d", VLAN_TAG_2); ret = net_eth_vlan_enable(eth_interfaces[0], VLAN_TAG_3); - zassert_true(ret == 0 || ret == -EALREADY, "Cannot enable %d", VLAN_TAG_3); + zassert_equal(ret, 0, "Cannot enable %d", VLAN_TAG_3); ret = net_eth_vlan_enable(eth_interfaces[0], VLAN_TAG_4); - zassert_true(ret == 0 || ret == -EALREADY, "Cannot enable %d", VLAN_TAG_4); + zassert_equal(ret, 0, "Cannot enable %d", VLAN_TAG_4); eth_ctx = net_if_l2_data(eth_interfaces[0]); From 7bac7c483568ad76d5f4d27904137a32ceefca4d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1982/2300] Revert "[nrf fromtree] MAINTAINERS: fix more paths" This reverts commit 8e18208ae30e172d05b69bba5908095a561c0794. Signed-off-by: Robert Lubos --- MAINTAINERS.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index c70147b5195..c7fe04762ca 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -3547,6 +3547,7 @@ STM32 Platforms: - GeorgeCGV files: - boards/st/ + - drivers/*/*stm32*/ - drivers/*/*stm32*.c - drivers/*/*stm32*.h - drivers/*/*/*stm32* @@ -3673,7 +3674,8 @@ Infineon Platforms: - boards/cypress/ - boards/infineon/ - drivers/*/*ifx_cat1* - - drivers/*/*xmc* + - drivers/*/*xmc*/ + - drivers/*/*xmc*.c - drivers/sensor/infineon/ - dts/arm/infineon/ - dts/arm/cypress/ From 2d8cd9b292582fb159d92c3391f1df4eed075996 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1983/2300] Revert "[nrf fromtree] boards: nordic: nrf54h20: add PWM to supported features" This reverts commit 2f78bc89c92578db48051e54f83f6820f9101909. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml | 1 - 3 files changed, 3 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml index 6ecde2cfdb1..0ba6bfe3ba2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml @@ -13,4 +13,3 @@ ram: 256 flash: 512 supported: - gpio - - pwm diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml index 190d835f580..b986a456623 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml @@ -11,4 +11,3 @@ ram: 62 flash: 62 supported: - gpio - - pwm diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml index b199f65385f..420d854cbca 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml @@ -13,4 +13,3 @@ ram: 192 flash: 256 supported: - gpio - - pwm From 6be039ee5d94da56c29d64018e6c65a8d291df1b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1984/2300] Revert "[nrf fromtree] tests: drivers: pwm: nrf54h20dk: add memory-region prop" This reverts commit a8a0b1cac46d8886a062af4b92f09c3827842539. Signed-off-by: Robert Lubos --- .../pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 6944718f64d..c483d27f569 100644 --- a/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -17,5 +17,4 @@ pinctrl-0 = <&pwm_default>; pinctrl-1 = <&pwm_sleep>; pinctrl-names = "default", "sleep"; - memory-regions = <&cpuapp_dma_region>; }; From a29224bf8256bb9cd6430181461d51d5829e9ca3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1985/2300] Revert "[nrf fromtree] drivers: pwm_nrfx: place data buf in correct mem reg" This reverts commit 2c33fd0a3d1c4db354861b185ea17b189c72f879. Signed-off-by: Robert Lubos --- drivers/pwm/pwm_nrfx.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index f6312535c7e..9feacb2c10b 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -10,7 +10,6 @@ #include #include #include -#include #include @@ -46,6 +45,7 @@ struct pwm_nrfx_config { struct pwm_nrfx_data { uint32_t period_cycles; + uint16_t seq_values[NRF_PWM_CHANNEL_COUNT]; /* Bit mask indicating channels that need the PWM generation. */ uint8_t pwm_needed; uint8_t prescaler; @@ -56,12 +56,6 @@ struct pwm_nrfx_data { #error "Current implementation supports maximum 8 channels." #endif -static uint16_t *seq_values_ptr_get(const struct device *dev) -{ - const struct pwm_nrfx_config *config = dev->config; - - return (uint16_t *)config->seq.values.p_raw; -} static bool pwm_period_check_and_set(const struct device *dev, uint32_t channel, uint32_t period_cycles) @@ -170,7 +164,7 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, needs_pwm = true; } - seq_values_ptr_get(dev)[channel] = PWM_NRFX_CH_VALUE(compare_value, inverted); + data->seq_values[channel] = PWM_NRFX_CH_VALUE(compare_value, inverted); LOG_DBG("channel %u, pulse %u, period %u, prescaler: %u.", channel, pulse_cycles, period_cycles, data->prescaler); @@ -255,6 +249,7 @@ static const struct pwm_driver_api pwm_nrfx_drv_api_funcs = { static int pwm_nrfx_init(const struct device *dev) { const struct pwm_nrfx_config *config = dev->config; + struct pwm_nrfx_data *data = dev->data; uint8_t initially_inverted = 0; int ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); @@ -265,7 +260,7 @@ static int pwm_nrfx_init(const struct device *dev) return ret; } - for (size_t i = 0; i < NRF_PWM_CHANNEL_COUNT; i++) { + for (size_t i = 0; i < ARRAY_SIZE(data->seq_values); i++) { uint32_t psel; if (channel_psel_get(i, &psel, config)) { @@ -278,10 +273,10 @@ static int pwm_nrfx_init(const struct device *dev) } } - for (size_t i = 0; i < NRF_PWM_CHANNEL_COUNT; i++) { + for (size_t i = 0; i < ARRAY_SIZE(data->seq_values); i++) { bool inverted = initially_inverted & BIT(i); - seq_values_ptr_get(dev)[i] = PWM_NRFX_CH_VALUE(0, inverted); + data->seq_values[i] = PWM_NRFX_CH_VALUE(0, inverted); } nrfx_err_t result = nrfx_pwm_init(&config->pwm, @@ -344,19 +339,10 @@ static int pwm_nrfx_pm_action(const struct device *dev, #define PWM(dev_idx) DT_NODELABEL(pwm##dev_idx) #define PWM_PROP(dev_idx, prop) DT_PROP(PWM(dev_idx), prop) -#define PWM_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(PWM(idx), prop) - -#define PWM_MEMORY_SECTION(idx) \ - COND_CODE_1(PWM_HAS_PROP(idx, memory_regions), \ - (__attribute__((__section__(LINKER_DT_NODE_REGION_NAME( \ - DT_PHANDLE(PWM(idx), memory_regions)))))), \ - ()) #define PWM_NRFX_DEVICE(idx) \ NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(PWM(idx)); \ static struct pwm_nrfx_data pwm_nrfx_##idx##_data; \ - static uint16_t pwm_##idx##_seq_values[NRF_PWM_CHANNEL_COUNT] \ - PWM_MEMORY_SECTION(idx); \ PINCTRL_DT_DEFINE(PWM(idx)); \ static const struct pwm_nrfx_config pwm_nrfx_##idx##_config = { \ .pwm = NRFX_PWM_INSTANCE(idx), \ @@ -371,7 +357,7 @@ static int pwm_nrfx_pm_action(const struct device *dev, .load_mode = NRF_PWM_LOAD_INDIVIDUAL, \ .step_mode = NRF_PWM_STEP_TRIGGERED, \ }, \ - .seq.values.p_raw = pwm_##idx##_seq_values, \ + .seq.values.p_raw = pwm_nrfx_##idx##_data.seq_values, \ .seq.length = NRF_PWM_CHANNEL_COUNT, \ .pcfg = PINCTRL_DT_DEV_CONFIG_GET(PWM(idx)), \ }; \ From b3bd83b5719c585a7a637a134a259de1db4d82f8 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:14 +0200 Subject: [PATCH 1986/2300] Revert "[nrf fromtree] dts: bindings: pwm: nordic: add memory-region support" This reverts commit 6eb334e87a0e127c3ed9589f253d90b45818dc02. Signed-off-by: Robert Lubos --- dts/bindings/pwm/nordic,nrf-pwm.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/bindings/pwm/nordic,nrf-pwm.yaml b/dts/bindings/pwm/nordic,nrf-pwm.yaml index e634cdee6d0..9f2c21d2b35 100644 --- a/dts/bindings/pwm/nordic,nrf-pwm.yaml +++ b/dts/bindings/pwm/nordic,nrf-pwm.yaml @@ -2,7 +2,7 @@ description: nRF PWM compatible: "nordic,nrf-pwm" -include: [pwm-controller.yaml, base.yaml, pinctrl-device.yaml, memory-region.yaml] +include: [pwm-controller.yaml, base.yaml, pinctrl-device.yaml] properties: reg: From 0ba7a9afeec81718327e3e2dd2e22aa7c6e19446 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1987/2300] Revert "[nrf fromtree] drivers: cache: nrf: Use CONFIG_DCACHE_LINE_SIZE" This reverts commit 77b790ce1d5f5d9d957a37d259ec89d256bf60a1. Signed-off-by: Robert Lubos --- drivers/cache/cache_nrf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index 3cf79897874..d1a28127727 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -14,6 +14,7 @@ LOG_MODULE_REGISTER(cache_nrfx, CONFIG_CACHE_LOG_LEVEL); #define NRF_ICACHE NRF_CACHE #endif +#define CACHE_LINE_SIZE 32 #define CACHE_BUSY_RETRY_INTERVAL_US 10 @@ -144,11 +145,11 @@ static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, vo /* * Align address to line size */ - line_addr &= ~(CONFIG_DCACHE_LINE_SIZE - 1); + line_addr &= ~(CACHE_LINE_SIZE - 1); do { _cache_line(cache, op, line_addr); - line_addr += CONFIG_DCACHE_LINE_SIZE; + line_addr += CACHE_LINE_SIZE; } while (line_addr < end_addr); wait_for_cache(cache); From 2831d366f434fa7fb967581ef30dcfea5bf2b6d9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1988/2300] Revert "[nrf fromtree] drivers: cache: nrf: Optimize operation" This reverts commit 77dae54438a064b3f0ff2a471ef6c6dfa38855db. Signed-off-by: Robert Lubos --- drivers/cache/cache_nrf.c | 44 ++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index d1a28127727..b0fa8a02de8 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(cache_nrfx, CONFIG_CACHE_LOG_LEVEL); #define CACHE_LINE_SIZE 32 #define CACHE_BUSY_RETRY_INTERVAL_US 10 +static struct k_spinlock lock; enum k_nrf_cache_op { /* @@ -54,6 +55,7 @@ static inline bool is_cache_busy(NRF_CACHE_Type *cache) static inline void wait_for_cache(NRF_CACHE_Type *cache) { while (is_cache_busy(cache)) { + k_busy_wait(CACHE_BUSY_RETRY_INTERVAL_US); } } @@ -97,33 +99,33 @@ static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) static inline void _cache_line(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, uintptr_t line_addr) { - do { - wait_for_cache(cache); + wait_for_cache(cache); - nrf_cache_lineaddr_set(cache, line_addr); + nrf_cache_lineaddr_set(cache, line_addr); - switch (op) { + switch (op) { #if NRF_CACHE_HAS_TASK_CLEAN - case K_NRF_CACHE_CLEAN: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANLINE); - break; + case K_NRF_CACHE_CLEAN: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_CLEANLINE); + break; #endif - case K_NRF_CACHE_INVD: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATELINE); - break; + case K_NRF_CACHE_INVD: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_INVALIDATELINE); + break; #if NRF_CACHE_HAS_TASK_FLUSH - case K_NRF_CACHE_FLUSH: - nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHLINE); - break; + case K_NRF_CACHE_FLUSH: + nrf_cache_task_trigger(cache, NRF_CACHE_TASK_FLUSHLINE); + break; #endif - default: - break; - } - } while (nrf_cache_lineaddr_get(cache) != line_addr); + default: + break; + } + + wait_for_cache(cache); } static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, void *addr, @@ -148,11 +150,15 @@ static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, vo line_addr &= ~(CACHE_LINE_SIZE - 1); do { + k_spinlock_key_t key = k_spin_lock(&lock); + _cache_line(cache, op, line_addr); + + k_spin_unlock(&lock, key); + line_addr += CACHE_LINE_SIZE; - } while (line_addr < end_addr); - wait_for_cache(cache); + } while (line_addr < end_addr); return 0; } From 7a0ee819699b8490cda0fa723eab655d8e089d35 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1989/2300] Revert "[nrf fromtree] drivers: cache: nrf: Fix case when driver may hang" This reverts commit ead85e51192c6a95969803d75c09cd8ef03d8eca. Signed-off-by: Robert Lubos --- drivers/cache/cache_nrf.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index b0fa8a02de8..dc40c5066d9 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -68,6 +68,14 @@ static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) return -ENOTSUP; } + k_spinlock_key_t key = k_spin_lock(&lock); + + /* + * Invalidating the whole cache is dangerous. For good measure + * disable the cache. + */ + nrf_cache_disable(cache); + wait_for_cache(cache); switch (op) { @@ -94,6 +102,10 @@ static inline int _cache_all(NRF_CACHE_Type *cache, enum k_nrf_cache_op op) wait_for_cache(cache); + nrf_cache_enable(cache); + + k_spin_unlock(&lock, key); + return 0; } @@ -190,6 +202,11 @@ void cache_data_enable(void) nrf_cache_enable(NRF_DCACHE); } +void cache_data_disable(void) +{ + nrf_cache_disable(NRF_DCACHE); +} + int cache_data_flush_all(void) { #if NRF_CACHE_HAS_TASK_CLEAN @@ -199,14 +216,6 @@ int cache_data_flush_all(void) #endif } -void cache_data_disable(void) -{ - if (nrf_cache_enable_check(NRF_DCACHE)) { - (void)cache_data_flush_all(); - } - nrf_cache_disable(NRF_DCACHE); -} - int cache_data_invd_all(void) { return _cache_checks(NRF_DCACHE, K_NRF_CACHE_INVD, NULL, 0, false); From 935413b568dba3dad3948d22d89b2b960f3e7427 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1990/2300] Revert "[nrf fromtree] drivers: cache: nrf: Handle issue with LINEADDR" This reverts commit d683236e962ea4c30102f6c25196aff1b2ca288c. Signed-off-by: Robert Lubos --- drivers/cache/Kconfig.nrf | 6 ------ drivers/cache/cache_nrf.c | 12 +----------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/cache/Kconfig.nrf b/drivers/cache/Kconfig.nrf index c1cfc2c8c58..820445db432 100644 --- a/drivers/cache/Kconfig.nrf +++ b/drivers/cache/Kconfig.nrf @@ -7,9 +7,3 @@ config CACHE_NRF_CACHE depends on HAS_NRFX && CACHE_MANAGEMENT help Enable support for the nRF cache driver. - -config CACHE_NRF_PATCH_LINEADDR - bool "Patch lineaddr" - default y if SOC_NRF54H20 - help - Manually set 28th bit in the LINEADDR in Trustzone Secure build. diff --git a/drivers/cache/cache_nrf.c b/drivers/cache/cache_nrf.c index dc40c5066d9..63d76a47d6e 100644 --- a/drivers/cache/cache_nrf.c +++ b/drivers/cache/cache_nrf.c @@ -144,17 +144,7 @@ static inline int _cache_range(NRF_CACHE_Type *cache, enum k_nrf_cache_op op, vo size_t size) { uintptr_t line_addr = (uintptr_t)addr; - uintptr_t end_addr; - - /* Some SOCs has a bug that requires to set 28th bit in the address on - * Trustzone secure builds. - */ - if (IS_ENABLED(CONFIG_CACHE_NRF_PATCH_LINEADDR) && - !IS_ENABLED(CONFIG_TRUSTED_EXECUTION_NONSECURE)) { - line_addr |= BIT(28); - } - - end_addr = line_addr + size; + uintptr_t end_addr = line_addr + size; /* * Align address to line size From aaca5bca45904034b9ba7d8c30d91d73cec26403 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1991/2300] Revert "[nrf fromtree] manifest: Update hal_nordic with nrf_cache change" This reverts commit 8fb9679b60816d9f6cd5acf408578849bfcf55fd. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index a81bbc3e666..39252a3dfa4 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: bdef8b66d5f59d95c09889918a04ddaecce322c8 + revision: f8e4d73a78316ea9ef85f09f24a3a229e40c1a80 path: modules/hal/nordic groups: - hal From b0efbc08626cbe505e9e1557282b74aa441daea5 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1992/2300] Revert "[nrf fromtree] soc: nordic: nrf54h: Add DCACHE initialization" This reverts commit 57df1158a8a9a3f1bd332ab081578e8effe67ad7. Signed-off-by: Robert Lubos --- soc/nordic/nrf54h/soc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index df72cdb977b..dd04dbe1b59 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -83,7 +83,6 @@ static int trim_hsfll(void) static int nordicsemi_nrf54h_init(void) { sys_cache_instr_enable(); - sys_cache_data_enable(); power_domain_init(); From f7b7f45bb28d1a44b4441a49d2e7a9d5a1fbc1af Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1993/2300] Revert "[nrf fromtree] soc: nordic: nrf54h: Remove redundant ICACHE kconfig" This reverts commit db64b2e5da1fab1e4e8178125b6398535b16234b. Signed-off-by: Robert Lubos --- soc/nordic/nrf54h/Kconfig | 8 ++++++++ soc/nordic/nrf54h/soc.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 8925669ae0d..2b967bece7c 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -31,3 +31,11 @@ config SOC_NRF54H20_CPURAD config SOC_NRF54H20_CPUPPR depends on RISCV_CORE_NORDIC_VPR + +if SOC_NRF54H20 + +config NRF_ENABLE_ICACHE + bool "Instruction cache (I-Cache)" + default y + +endif # SOC_NRF54H20 diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index dd04dbe1b59..1d071f96b20 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -82,7 +82,9 @@ static int trim_hsfll(void) static int nordicsemi_nrf54h_init(void) { +#if defined(CONFIG_NRF_ENABLE_ICACHE) sys_cache_instr_enable(); +#endif power_domain_init(); From 9e769260d85a9eaa0ddd2bd9070770a7bc94f399 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1994/2300] Revert "[nrf fromlist] soc: nrf54h: use word accesses to SPI_DW peripheral" This reverts commit 046e281be0bdaa45f512981431fe7f20c028aa9a. Signed-off-by: Robert Lubos --- soc/nordic/nrf54h/Kconfig.defconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/soc/nordic/nrf54h/Kconfig.defconfig b/soc/nordic/nrf54h/Kconfig.defconfig index b09b24e5e70..ad06920c15c 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig +++ b/soc/nordic/nrf54h/Kconfig.defconfig @@ -36,7 +36,4 @@ endif # RISCV config SPI_DW_HSSI default y if SPI_DW -config SPI_DW_ACCESS_WORD_ONLY - default y if SPI_DW - endif # SOC_SERIES_NRF54HX From aec7711eae25e676e5a1fc621587f7ea824eab09 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1995/2300] Revert "[nrf fromtree] samples: drivers: jesd216: add nRF54H20 overlay" This reverts commit 52cf91a352fd9a2fdaacfb6934ae244654a889d7. Signed-off-by: Robert Lubos --- .../jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index b8f138ad2b2..00000000000 --- a/samples/drivers/jesd216/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&mx25uw63 { - status = "okay"; -}; From ef7523e324dea91faf26e445aef72dfe63f99f2b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1996/2300] Revert "[nrf fromtree] boards: nordic: add mx25uw6345g flash node to nRF54H20dk" This reverts commit 69aa2866913399627598e9672174e4981ad58574. Signed-off-by: Robert Lubos --- .../nrf54h20dk_nrf54h20-pinctrl.dtsi | 9 ------ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 29 ------------------- 2 files changed, 38 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi index 8bc02597c6d..0c842057d64 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -63,13 +63,4 @@ low-power-enable; }; }; - - /omit-if-no-ref/ exmif_default: exmif_default { - group1 { - psels = , - , - ; - nordic,drive-mode = ; - }; - }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 7f2f918b0b9..5406d113833 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -209,32 +209,3 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-1 = <&pwm120_sleep>; pinctrl-names = "default", "sleep"; }; - -&gpio6 { - status = "okay"; -}; - -&exmif { - cs-gpios = <&gpio6 3 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&exmif_default>; - pinctrl-names = "default"; - status = "okay"; - mx25uw63: mx25uw6345g@0 { - compatible = "jedec,spi-nor"; - status = "disabled"; - reg = <0>; - spi-max-frequency = ; - jedec-id = [c2 84 37]; - sfdp-bfp = [ - e5 20 8a ff ff ff ff 03 00 ff 00 ff 00 ff 00 ff - ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 10 d8 - 00 ff 00 ff 87 79 01 00 84 12 00 c4 cc 04 67 46 - 30 b0 30 b0 f4 bd d5 5c 00 00 00 ff 10 10 00 20 - 00 00 00 00 00 00 7c 23 48 00 00 00 00 00 88 88 - ]; - size = <67108864>; - has-dpd; - t-enter-dpd = <10000>; - t-exit-dpd = <30000>; - }; -}; From 1aedb60f3f9ef2fd12baa9edbaffa099222b67ce Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1997/2300] Revert "[nrf fromtree] soc: nrf54h: Enable SPI DW HSSI register layout" This reverts commit 6a0c9b2e9223ed2f595db16a69b82d679a971f14. Signed-off-by: Robert Lubos --- soc/nordic/nrf54h/Kconfig.defconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/soc/nordic/nrf54h/Kconfig.defconfig b/soc/nordic/nrf54h/Kconfig.defconfig index ad06920c15c..72ba234e883 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig +++ b/soc/nordic/nrf54h/Kconfig.defconfig @@ -33,7 +33,4 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC endif # RISCV -config SPI_DW_HSSI - default y if SPI_DW - endif # SOC_SERIES_NRF54HX From 6150377f66b1e55e083df325da63fc4fc866a954 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1998/2300] Revert "[nrf fromtree] include: dts: nrf: add EXMIF pinctrl definitions" This reverts commit 539253be2bb0d930d3d1dc4268de6d8f3625fa75. Signed-off-by: Robert Lubos --- .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index cbd92c73460..5f6e51d9cfc 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -125,28 +125,6 @@ #define NRF_FUN_QSPI_IO2 33U /** QSPI IO3 */ #define NRF_FUN_QSPI_IO3 34U -/** EXMIF CK */ -#define NRF_FUN_EXMIF_CK 35U -/** EXMIF DQ0 */ -#define NRF_FUN_EXMIF_DQ0 36U -/** EXMIF DQ1 */ -#define NRF_FUN_EXMIF_DQ1 37U -/** EXMIF DQ2 */ -#define NRF_FUN_EXMIF_DQ2 38U -/** EXMIF DQ3 */ -#define NRF_FUN_EXMIF_DQ3 39U -/** EXMIF DQ4 */ -#define NRF_FUN_EXMIF_DQ4 40U -/** EXMIF DQ5 */ -#define NRF_FUN_EXMIF_DQ5 41U -/** EXMIF DQ6 */ -#define NRF_FUN_EXMIF_DQ6 42U -/** EXMIF DQ7 */ -#define NRF_FUN_EXMIF_DQ7 43U -/** EXMIF CS0 */ -#define NRF_FUN_EXMIF_CS0 44U -/** EXMIF CS1 */ -#define NRF_FUN_EXMIF_CS1 45U /** @} */ From 8ec78e18c8536061a8c8bbd6f4f924148312a519 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 1999/2300] Revert "[nrf fromtree] drivers: spi_dw: add HSSI register layout" This reverts commit 888cc087fe4b5840087a95b09cdf2845344d7598. Signed-off-by: Robert Lubos --- drivers/spi/Kconfig.dw | 6 ------ drivers/spi/spi_dw.h | 15 ++++----------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/spi/Kconfig.dw b/drivers/spi/Kconfig.dw index ed45361d8ed..3ebdd54ee93 100644 --- a/drivers/spi/Kconfig.dw +++ b/drivers/spi/Kconfig.dw @@ -20,10 +20,4 @@ config SPI_DW_ACCESS_WORD_ONLY DesignWare SPI only allows word access, byte access will raise exception. -config SPI_DW_HSSI - bool "Designware SPI HSSI variant" - help - Use register layout compatible with the SPI DW HSSI variant of the - peripheral. - endif # SPI_DW diff --git a/drivers/spi/spi_dw.h b/drivers/spi/spi_dw.h index 6c073b47471..d6383bc4ed2 100644 --- a/drivers/spi/spi_dw.h +++ b/drivers/spi/spi_dw.h @@ -179,26 +179,19 @@ static int reg_test_bit(uint8_t bit, mm_reg_t addr, uint32_t off) /* Common registers settings, bits etc... */ /* CTRLR0 settings */ -#if !IS_ENABLED(CONFIG_SPI_DW_HSSI) #define DW_SPI_CTRLR0_SCPH_BIT (6) #define DW_SPI_CTRLR0_SCPOL_BIT (7) -#define DW_SPI_CTRLR0_TMOD_SHIFT (8) -#define DW_SPI_CTRLR0_SLV_OE_BIT (10) #define DW_SPI_CTRLR0_SRL_BIT (11) -#else -/* The register layout is different in the HSSI variant */ -#define DW_SPI_CTRLR0_SCPH_BIT (8) -#define DW_SPI_CTRLR0_SCPOL_BIT (9) -#define DW_SPI_CTRLR0_TMOD_SHIFT (10) -#define DW_SPI_CTRLR0_SLV_OE_BIT (12) -#define DW_SPI_CTRLR0_SRL_BIT (13) -#endif #define DW_SPI_CTRLR0_SCPH BIT(DW_SPI_CTRLR0_SCPH_BIT) #define DW_SPI_CTRLR0_SCPOL BIT(DW_SPI_CTRLR0_SCPOL_BIT) #define DW_SPI_CTRLR0_SRL BIT(DW_SPI_CTRLR0_SRL_BIT) + +#define DW_SPI_CTRLR0_SLV_OE_BIT (10) #define DW_SPI_CTRLR0_SLV_OE BIT(DW_SPI_CTRLR0_SLV_OE_BIT) +#define DW_SPI_CTRLR0_TMOD_SHIFT (8) + #define DW_SPI_CTRLR0_TMOD_TX_RX (0) #define DW_SPI_CTRLR0_TMOD_TX (1 << DW_SPI_CTRLR0_TMOD_SHIFT) #define DW_SPI_CTRLR0_TMOD_RX (2 << DW_SPI_CTRLR0_TMOD_SHIFT) From f010293ce38253f156d217789c3a4a6d5467ea8c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 2000/2300] Revert "[nrf fromlist] boards: control the network CPU directly" This reverts commit 688107b4a1a26f2f1df58444d5268a35042c1731. Signed-off-by: Robert Lubos --- .../lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c | 4 ++-- .../nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c | 4 ++-- boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c | 4 ++-- boards/nordic/thingy53/board.c | 4 ++-- boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c | 4 ++-- .../mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c | 4 ++-- .../mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c b/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c index 49c0e5a1c73..c4f39467314 100644 --- a/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c +++ b/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c @@ -10,7 +10,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(bl5340_dvk_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -50,7 +50,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c index f9082e6ca40..3d08a5dd4cd 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include LOG_MODULE_REGISTER(nrf5340_audio_dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -71,7 +71,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c b/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c index dadba8c0f54..3b85d55dfd0 100644 --- a/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c +++ b/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(nrf5340dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -49,7 +49,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/thingy53/board.c b/boards/nordic/thingy53/board.c index 67059bd4ee8..491808f236a 100644 --- a/boards/nordic/thingy53/board.c +++ b/boards/nordic/thingy53/board.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include LOG_MODULE_REGISTER(thingy53_board_init); @@ -52,7 +52,7 @@ static void enable_cpunet(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c b/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c index bf0626ce30b..cd8281cb2bf 100644 --- a/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c +++ b/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include #if defined(CONFIG_BOARD_PAN1783_EVB_NRF5340_CPUAPP) LOG_MODULE_REGISTER(pan1783_evb_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -42,7 +42,7 @@ static int remoteproc_mgr_boot(void) remoteproc_mgr_config(); /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); diff --git a/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c b/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c index 9596b3453be..64e335869fb 100644 --- a/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c +++ b/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c @@ -10,7 +10,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(raytac_mdbt53_db_40_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -50,7 +50,7 @@ static int remoteproc_mgr_boot(const struct device *dev) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c b/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c index 31b8bf5a75e..ec4567274c4 100644 --- a/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c +++ b/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c @@ -49,7 +49,7 @@ static int remoteproc_mgr_boot(const struct device *dev) */ /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); + nrf53_cpunet_enable(true); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ From 651089b3ae87dbac4bc729a7a3b6cd7832977507 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:15 +0200 Subject: [PATCH 2001/2300] Revert "[nrf fromlist] modules: hal_nordic: request nRF5340 network CPU in 802.15.4 init" This reverts commit 90742665f0f0cde0b1b2732c24f2f37fb3221eaa. Signed-off-by: Robert Lubos --- .../platform/nrf_802154_spinel_backend_ipc.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c index 6df811f6bad..b2629eef67b 100644 --- a/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c +++ b/modules/hal_nordic/nrf_802154/serialization/platform/nrf_802154_spinel_backend_ipc.c @@ -15,10 +15,6 @@ #include "../../spinel_base/spinel.h" #include "../../src/include/nrf_802154_spinel.h" -#if defined(CONFIG_SOC_NRF5340_CPUAPP) -#include -#endif - #define LOG_LEVEL LOG_LEVEL_INFO #define LOG_MODULE_NAME spinel_ipc_backend LOG_MODULE_REGISTER(LOG_MODULE_NAME); @@ -54,10 +50,6 @@ nrf_802154_ser_err_t nrf_802154_backend_init(void) DEVICE_DT_GET(DT_CHOSEN(nordic_802154_spinel_ipc)); int err; -#if defined(CONFIG_SOC_NRF5340_CPUAPP) - nrf53_cpunet_enable(true); -#endif - err = ipc_service_open_instance(ipc_instance); if (err < 0 && err != -EALREADY) { LOG_ERR("Failed to open IPC instance: %d", err); From 08d2578d1c14c4217e094d4ddf4388ad76f56a4a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2002/2300] Revert "[nrf fromtree] boards: nordic: nrf54h20dk: Update memory map" This reverts commit 7491fd071f64c291693db2cad016565074ad8b8c. Signed-off-by: Robert Lubos --- .../nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index 91899e2cf86..68c0d5cd990 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -6,16 +6,16 @@ / { reserved-memory { - cpuapp_ram0x_region: memory@2f010000 { + cpuapp_ram0x_region: memory@2f000000 { compatible = "nordic,owned-memory"; - reg = <0x2f010000 DT_SIZE_K(260)>; + reg = <0x2f000000 DT_SIZE_K(260)>; status = "disabled"; perm-read; perm-write; perm-secure; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0x2f010000 0x41000>; + ranges = <0x0 0x2f000000 0x41000>; cpusec_cpuapp_ipc_shm: memory@0 { reg = <0x0 DT_SIZE_K(2)>; @@ -30,16 +30,16 @@ }; }; - cpurad_ram0x_region: memory@2f051000 { + cpurad_ram0x_region: memory@2f041000 { compatible = "nordic,owned-memory"; - reg = <0x2f051000 DT_SIZE_K(4)>; + reg = <0x2f041000 DT_SIZE_K(4)>; status = "disabled"; perm-read; perm-write; perm-secure; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0x2f051000 0x1000>; + ranges = <0x0 0x2f041000 0x1000>; cpusec_cpurad_ipc_shm: memory@0 { reg = <0x0 DT_SIZE_K(2)>; From 2bd1faa55a96a78a8fa08e93f4480727826fb66c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2003/2300] Revert "[nrf fromlist] ipc: ipc_service: icbmsg backend: workaround endpoint binding deadlock" This reverts commit 5c19b37dd82cb25c02da195af2666e75369b7fad. Signed-off-by: Robert Lubos --- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 22 +------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index c7127888b18..c7cb5f8ea34 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -110,12 +110,6 @@ LOG_MODULE_REGISTER(ipc_icbmsg, /** Registered endpoints count mask in flags. */ #define FLAG_EPT_COUNT_MASK 0xFFFF -/** Workqueue stack size for bounding processing (this configuration is not optimized). */ -#define EP_BOUND_WORK_Q_STACK_SIZE (512U) - -/** Workqueue priority for bounding processing. */ -#define EP_BOUND_WORK_Q_PRIORITY (CONFIG_SYSTEM_WORKQUEUE_PRIORITY) - enum msg_type { MSG_DATA = 0, /* Data message. */ MSG_RELEASE_DATA, /* Release data buffer message. */ @@ -200,9 +194,6 @@ struct control_message { BUILD_ASSERT(NUM_EPT <= EPT_ADDR_INVALID, "Too many endpoints"); -/* Work queue for bounding processing. */ -static struct k_work_q ep_bound_work_q; - /** * Calculate pointer to block from its index and channel configuration (RX or TX). * No validation is performed. @@ -681,7 +672,7 @@ static int send_bound_message(struct backend_data *dev_data, struct ept_data *ep */ static void schedule_ept_bound_process(struct backend_data *dev_data) { - k_work_submit_to_queue(&ep_bound_work_q, &dev_data->ep_bound_work); + k_work_submit(&dev_data->ep_bound_work); } /** @@ -1126,17 +1117,6 @@ static int backend_init(const struct device *instance) { const struct icbmsg_config *conf = instance->config; struct backend_data *dev_data = instance->data; - static K_THREAD_STACK_DEFINE(ep_bound_work_q_stack, EP_BOUND_WORK_Q_STACK_SIZE); - static bool is_work_q_started; - - if (!is_work_q_started) { - k_work_queue_init(&ep_bound_work_q); - k_work_queue_start(&ep_bound_work_q, ep_bound_work_q_stack, - K_THREAD_STACK_SIZEOF(ep_bound_work_q_stack), - EP_BOUND_WORK_Q_PRIORITY, NULL); - - is_work_q_started = true; - } dev_data->conf = conf; dev_data->is_initiator = (conf->rx.blocks_ptr < conf->tx.blocks_ptr); From 3462d31771d86835d094ec9a80f63942bb9801cf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2004/2300] Revert "[nrf fromtree] tests: drivers: watchdog: Add negative test cases for Watchdog" This reverts commit 4e6070dbdc332a17ae439649e5e6af01a6365290. Signed-off-by: Robert Lubos --- .../watchdog/wdt_error_cases/CMakeLists.txt | 9 - .../watchdog/wdt_error_cases/README.txt | 79 -- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 9 - .../drivers/watchdog/wdt_error_cases/prj.conf | 3 - .../watchdog/wdt_error_cases/src/main.c | 960 ------------------ .../watchdog/wdt_error_cases/testcase.yaml | 13 - 6 files changed, 1073 deletions(-) delete mode 100644 tests/drivers/watchdog/wdt_error_cases/CMakeLists.txt delete mode 100644 tests/drivers/watchdog/wdt_error_cases/README.txt delete mode 100644 tests/drivers/watchdog/wdt_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/watchdog/wdt_error_cases/prj.conf delete mode 100644 tests/drivers/watchdog/wdt_error_cases/src/main.c delete mode 100644 tests/drivers/watchdog/wdt_error_cases/testcase.yaml diff --git a/tests/drivers/watchdog/wdt_error_cases/CMakeLists.txt b/tests/drivers/watchdog/wdt_error_cases/CMakeLists.txt deleted file mode 100644 index 12c8c39535d..00000000000 --- a/tests/drivers/watchdog/wdt_error_cases/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(wdt_error_cases) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/watchdog/wdt_error_cases/README.txt b/tests/drivers/watchdog/wdt_error_cases/README.txt deleted file mode 100644 index fcf9173ee93..00000000000 --- a/tests/drivers/watchdog/wdt_error_cases/README.txt +++ /dev/null @@ -1,79 +0,0 @@ -This test suite contains negative test cases for the Watchdog driver. -Test scenarios validate that invalid use of the watchdog driver -returns error code as described in the API documentation -(or Assertion Fail as explained below). - -Ideally, the driver shall be fully compliant with the documentation. -However, it may happen that invalid function call results in -Assertion Fail instead of error code. -Since, main goal is to detect (and report) invalid use of the driver, -both error code and assertion fail set test result as passed. -See for example test_02_wdt_setup_before_setting_timeouts where -ztest_set_assert_valid(true); -is used to catch assertion fail. - -These tests were written to increase test coverage for the Watchdog driver. -Since, coverage data is stored in the RAM, it is lost when watchdog fires. -Therefore, in all test cases watchdog shall NOT expire. -Use other sample to verify positive scenario for the watchdog driver. - -These tests were prepared on a target that had a bug in the wdt_disable() -implementation. As a temporary remedy, order of tests was imposed. -Since, tests are executed alphabetically, order was set by starting -each test name with f.e. 'test_08b_...'. - - -Tests are based on the watchdog API documentation available here: -https://docs.zephyrproject.org/latest/hardware/peripherals/watchdog.html - - -Follow these guidelines when enabling test execution on a new target. - -1. Although, code defines WDT_DISABLE_SUPPORTED but it was tested on a - target that supports disabling the watchdog. - Multiple tests call wdt_setup() which starts the watchdog. - Every test assumes that watchdog is disabled at startup. - As a result, executing this test suite on a target that doesn't - support wdt_disable() may require changes to the code. - When target supports wdt_disable() then extend WDT_TEST_FLAGS with: - #define WDT_TEST_FLAGS (... | WDT_DISABLE_SUPPORTED) - -2. There are three watchdog flags that can be passed to wdt_install_timeout(): - - WDT_FLAG_RESET_NONE - when watchdog expires, it's callback is serviced but - reset doesn't occur. - - WDT_FLAG_RESET_CPU_CORE - when watchdog expires, only one core is reset, while - other cores are not affected. - - WDT_FLAG_RESET_SOC - when watchdog expires, target as "a whole" is reset. - Support for these flags varies between vendors and products. - a) List all supported flags in - #define WDT_TEST_FLAGS (... | WDT_FLAG_RESET_NONE_SUPPORTED | - WDT_FLAG_RESET_CPU_CORE_SUPPORTED | - WDT_FLAG_RESET_SOC_SUPPORTED) - b) Set supported flag in - #define DEFAULT_FLAGS (WDT_FLAG_RESET_SOC) - This define will be used in wdt_install_timeout() "correct" test step. - -3. These tests assume that watchdog driver supports multiple timeouts. Set - #define MAX_INSTALLABLE_TIMEOUTS (8) - -4. When all watchdog timeouts must have exactly the same watchdog timeout value - then extend WDT_TEST_FLAGS with: - #define WDT_TEST_FLAGS (... | WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED) - -5. Set maximal allowed watchdog timeout value, f.e.: - #define WDT_WINDOW_MAX_ALLOWED (0xFFFFFFFFU) - Also, test assumes that minimal allowed watchdog timeout value must be zero. - -6. There are two watchdog options that can be passed to wdt_setup(): - - WDT_OPT_PAUSE_IN_SLEEP; - - WDT_OPT_PAUSE_HALTED_BY_DBG. - Support for these options varies between vendors and products. - a) List all supported options in - #define WDT_TEST_FLAGS (... | WDT_OPT_PAUSE_IN_SLEEP_SUPPORTED | - WDT_OPT_PAUSE_HALTED_BY_DBG_SUPPORTED) - b) Set supported option(s) in - #define DEFAULT_OPTIONS (WDT_OPT_PAUSE_IN_SLEEP | WDT_OPT_PAUSE_HALTED_BY_DBG) - This define will be used in wdt_setup() "correct" test step. - -7. When wdt_feed() can stall, extend WDT_TEST_FLAGS with: - #define WDT_TEST_FLAGS (... | WDT_FEED_CAN_STALL) diff --git a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 8d3dce3b380..00000000000 --- a/tests/drivers/watchdog/wdt_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wdt31 { - status = "okay"; -}; diff --git a/tests/drivers/watchdog/wdt_error_cases/prj.conf b/tests/drivers/watchdog/wdt_error_cases/prj.conf deleted file mode 100644 index be8069f78b4..00000000000 --- a/tests/drivers/watchdog/wdt_error_cases/prj.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_ZTEST=y -CONFIG_ZTEST_ASSERT_HOOK=y -CONFIG_WATCHDOG=y diff --git a/tests/drivers/watchdog/wdt_error_cases/src/main.c b/tests/drivers/watchdog/wdt_error_cases/src/main.c deleted file mode 100644 index fc453ba3b32..00000000000 --- a/tests/drivers/watchdog/wdt_error_cases/src/main.c +++ /dev/null @@ -1,960 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -/* - * To use this test, either the devicetree's /aliases must have a - * 'watchdog0' property, or one of the following watchdog compatibles - * must have an enabled node. - */ -#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) -#define WDT_NODE DT_ALIAS(watchdog0) -#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_wdt) -#define WDT_NODE DT_INST(0, nordic_nrf_wdt) -#elif DT_HAS_COMPAT_STATUS_OKAY(zephyr_counter_watchdog) -#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_counter_watchdog) -#endif - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) -#define NOINIT_SECTION ".dtcm_noinit.test_wdt" -#else -#define NOINIT_SECTION ".noinit.test_wdt" -#endif - -/* Bit fields used to select tests to be run on the target */ -#define WDT_DISABLE_SUPPORTED BIT(0) -#define WDT_FLAG_RESET_NONE_SUPPORTED BIT(1) -#define WDT_FLAG_RESET_CPU_CORE_SUPPORTED BIT(2) -#define WDT_FLAG_RESET_SOC_SUPPORTED BIT(3) -#define WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED BIT(4) -#define WDT_OPT_PAUSE_IN_SLEEP_SUPPORTED BIT(5) -#define WDT_OPT_PAUSE_HALTED_BY_DBG_SUPPORTED BIT(6) -#define WDT_FEED_CAN_STALL BIT(7) - -/* Common for all targets: */ -#define DEFAULT_WINDOW_MAX (500U) -#define DEFAULT_WINDOW_MIN (0U) - -/* Align tests to the specific target: */ -#if defined(CONFIG_SOC_NRF54L15) -#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 | \ - WDT_OPT_PAUSE_HALTED_BY_DBG_SUPPORTED) -#define DEFAULT_FLAGS (WDT_FLAG_RESET_SOC) -#define MAX_INSTALLABLE_TIMEOUTS (8) -#define WDT_WINDOW_MAX_ALLOWED (0x07CFFFFFU) -#define DEFAULT_OPTIONS (WDT_OPT_PAUSE_IN_SLEEP | WDT_OPT_PAUSE_HALTED_BY_DBG) -#else -/* By default run most of the error checks. - * See Readme.txt on how to align test scope for the specific target. - */ -#define WDT_TEST_FLAGS \ - (WDT_DISABLE_SUPPORTED | WDT_FLAG_RESET_SOC_SUPPORTED | \ - WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED) -#define DEFAULT_FLAGS (WDT_FLAG_RESET_SOC) -#define MAX_INSTALLABLE_TIMEOUTS (8) -#define WDT_WINDOW_MAX_ALLOWED (0xFFFFFFFFU) -#define DEFAULT_OPTIONS (WDT_OPT_PAUSE_IN_SLEEP) -#endif - -static const struct device *const wdt = DEVICE_DT_GET(WDT_NODE); -static struct wdt_timeout_cfg m_cfg_wdt0; - -/* Following variables are incremented in WDT callbacks - * to indicate whether interrupt was fired or not. - */ -volatile uint32_t m_test_06b_value __attribute__((section(NOINIT_SECTION))); -#define TEST_06B_TAG (0x12345678U) -volatile uint32_t m_test_08b_value __attribute__((section(NOINIT_SECTION))); -#define TEST_08B_TAG (0x23456789U) -volatile uint32_t m_test_08d_A_value __attribute__((section(NOINIT_SECTION))); -#define TEST_08D_A_TAG (0x3456789AU) -volatile uint32_t m_test_08d_B_value __attribute__((section(NOINIT_SECTION))); -#define TEST_08D_B_TAG (0x456789ABU) - -static void wdt_test_06b_cb(const struct device *wdt_dev, int channel_id) -{ - ARG_UNUSED(wdt_dev); - ARG_UNUSED(channel_id); - m_test_06b_value = TEST_06B_TAG; -} - -static void wdt_test_08b_cb(const struct device *wdt_dev, int channel_id) -{ - ARG_UNUSED(wdt_dev); - ARG_UNUSED(channel_id); - m_test_08b_value = TEST_08B_TAG; -} - -static void wdt_test_08d_A_cb(const struct device *wdt_dev, int channel_id) -{ - ARG_UNUSED(wdt_dev); - ARG_UNUSED(channel_id); - m_test_08d_A_value = TEST_08D_A_TAG; -} - -static void wdt_test_08d_B_cb(const struct device *wdt_dev, int channel_id) -{ - ARG_UNUSED(wdt_dev); - ARG_UNUSED(channel_id); - m_test_08d_B_value = TEST_08D_B_TAG; -} - -/** - * @brief wdt_disable() negative test - * - * Confirm that wdt_disable() returns - * -EFAULT when watchdog instance is not enabled. - * - */ -ZTEST(wdt_coverage, test_01_wdt_disable_before_wdt_setup) -{ - int ret; - - if (!(WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED)) { - /* Skip this test because wdt_disable() is NOT supported. */ - ztest_test_skip(); - } - - /* Call wdt_disable before enabling wdt */ - ret = wdt_disable(wdt); - zassert_true(ret == -EFAULT, - "Calling wdt_disable before watchdog was started should return -EFAULT (-14), " - "got unexpected value of %d", - ret); -} - -/** - * @brief wdt_setup() negative test - * - * Confirm that wdt_setup() returns error value or ASSERTION FAIL - * when it's called before wdt_install_timeouts(). - * - */ -ZTEST(wdt_coverage, test_02_wdt_setup_before_setting_timeouts) -{ - int ret; - - /* Call wdt_setup before wdt_install_timeouts() */ - ztest_set_assert_valid(true); - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret < 0, - "Calling wdt_setup before installing timeouts should fail, got unexpected " - "value of %d", - ret); -} - -/** - * @brief wdt_feed() negative test - * - * Confirm that wdt_feed() returns error value - * when it's called before wdt_setup(). - * Test scenario where none of timeout channels is configured. - * - */ -ZTEST(wdt_coverage, test_03_wdt_feed_before_wdt_setup_channel_not_configured) -{ - int ret; - - /* Call wdt_feed() before wdt_setup() (channel wasn't configured) */ - ret = wdt_feed(wdt, 0); - zassert_true(ret == -EINVAL, - "wdt_feed() shall return error value when called before wdt_setup(), got " - "unexpected value of %d", - ret); -} - -/** - * @brief wdt_install_timeout() negative test - * - * Confirm that wdt_install_timeout() returns - * -ENOTSUP when flag WDT_FLAG_RESET_NONE is not supported - * - */ -ZTEST(wdt_coverage, test_04a_wdt_install_timeout_WDT_FLAG_RESET_NONE_not_supported) -{ - int ret; - - if (WDT_TEST_FLAGS & WDT_FLAG_RESET_NONE_SUPPORTED) { - /* Skip this test because WDT_FLAG_RESET_NONE is supported. */ - ztest_test_skip(); - } - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = WDT_FLAG_RESET_NONE; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret == -ENOTSUP, - "WDT_FLAG_RESET_NONE is not supported on this target and should fail, got " - "unexpected value of %d", - ret); -} - -/** - * @brief wdt_install_timeout() negative test - * - * Confirm that wdt_install_timeout() returns - * -ENOTSUP when flag WDT_FLAG_RESET_CPU_CORE is not supported - * - */ -ZTEST(wdt_coverage, test_04b_wdt_install_timeout_WDT_FLAG_RESET_CPU_CORE_not_supported) -{ - int ret; - - if (WDT_TEST_FLAGS & WDT_FLAG_RESET_CPU_CORE_SUPPORTED) { - /* Skip this test because WDT_FLAG_RESET_CPU_CORE is supported. */ - ztest_test_skip(); - } - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = WDT_FLAG_RESET_CPU_CORE; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret == -ENOTSUP, - "WDT_FLAG_RESET_CPU_CORE is not supported on this target and should fail, got " - "unexpected value of %d", - ret); -} - -/** - * @brief wdt_install_timeout() negative test - * - * Confirm that wdt_install_timeout() returns - * -ENOTSUP when flag WDT_FLAG_RESET_SOC is not supported - * - */ -ZTEST(wdt_coverage, test_04c_wdt_install_timeout_WDT_FLAG_RESET_SOC_not_supported) -{ - int ret; - - if (WDT_TEST_FLAGS & WDT_FLAG_RESET_SOC_SUPPORTED) { - /* Skip this test because WDT_FLAG_RESET_SOC is supported. */ - ztest_test_skip(); - } - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = WDT_FLAG_RESET_SOC; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret == -ENOTSUP, - "WDT_FLAG_RESET_SOC is not supported on this target and should fail, got " - "unexpected value of %d", - ret); -} - -/** - * @brief wdt_install_timeout() negative test - * - * Confirm that wdt_install_timeout() returns - * -EINVAL when window timeout is out of possible range - * - */ -ZTEST(wdt_coverage, test_04w_wdt_install_timeout_with_invalid_window) -{ - int ret; - - /* set defaults */ - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - /* ----------------- window.min - * Check that window.min can't be different than 0 - */ - m_cfg_wdt0.window.min = 1U; - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret == -EINVAL, - "Calling wdt_install_timeout with window.min = 1 should return -EINVAL (-22), " - "got unexpected value of %d", - ret); - - /* Set default window.min */ - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - /* ----------------- window.max - * Check that window.max can't be equal to 0 - */ - m_cfg_wdt0.window.max = 0U; - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret == -EINVAL, - "Calling wdt_install_timeout with window.max = 0 should return -EINVAL (-22), " - "got unexpected value of %d", - ret); - - /* Check that window.max can't exceed maximum allowed value */ - m_cfg_wdt0.window.max = WDT_WINDOW_MAX_ALLOWED + 1; - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret == -EINVAL, - "Calling wdt_install_timeout with window.max = %d should return -EINVAL " - "(-22), got unexpected value of %d", - WDT_WINDOW_MAX_ALLOWED + 1, ret); -} - -/** - * @brief wdt_install_timeout() negative test - * - * Confirm that wdt_install_timeout() returns - * -EINVAL when watchdog supports only one timeout value - * for all timeouts and the supplied timeout window differs - * from windows for alarms installed so far. - * - */ -ZTEST(wdt_coverage, test_04wm_wdt_install_timeout_with_multiple_timeout_values) -{ - int ret; - - if (!(WDT_TEST_FLAGS & WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED)) { - /* Skip this test because timeouts with different values are supported */ - ztest_test_skip(); - } - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - - /* Call wdt_install_timeout again with different window */ - m_cfg_wdt0.window.max = WDT_WINDOW_MAX_ALLOWED >> 1; - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret == -EINVAL, - "wdt_install_timeout should return -EINVAL (-22), got unexpected value of %d", - ret); -} - -/** - * @brief wdt_install_timeout() negative test - * - * Confirm that wdt_install_timeout() returns ASSERTION FAIL or - * -EBUSY when called after the watchdog instance has been already setup. - * - */ -ZTEST(wdt_coverage, test_05_wdt_install_timeout_after_wdt_setup) -{ - int ret; - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - - /* Call wdt_install_timeout again to test invalid use */ - ztest_set_assert_valid(true); - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret == -EBUSY, - "Calling wdt_install_timeout after wdt_setup should return -EBUSY (-16), got " - "unexpected value of %d", - ret); - - /* Assumption: wdt_disable() is called after this test */ -} - -/** - * @brief wdt_setup() negative test - * - * Confirm that wdt_setup() returns - * -ENOTSUP when option WDT_OPT_PAUSE_IN_SLEEP is not supported - * - */ -ZTEST(wdt_coverage, test_06a_wdt_setup_WDT_OPT_PAUSE_IN_SLEEP_not_supported) -{ - int ret; - - if (WDT_TEST_FLAGS & WDT_OPT_PAUSE_IN_SLEEP_SUPPORTED) { - /* Skip this test because WDT_OPT_PAUSE_IN_SLEEP is supported. */ - ztest_test_skip(); - } - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - - ret = wdt_setup(wdt, WDT_OPT_PAUSE_IN_SLEEP); - zassert_true(ret == -ENOTSUP, - "WDT_OPT_PAUSE_IN_SLEEP is not supported on this target and should fail, got " - "unexpected value of %d", - ret); - - ret = wdt_setup(wdt, WDT_OPT_PAUSE_IN_SLEEP | WDT_OPT_PAUSE_HALTED_BY_DBG); - zassert_true(ret == -ENOTSUP, - "WDT_OPT_PAUSE_IN_SLEEP is not supported on this target and should fail, got " - "unexpected value of %d", - ret); -} - -/** - * @brief Test that wdt_setup(device, WDT_OPT_PAUSE_IN_SLEEP) works as expected - * - * Confirm that when WDT_OPT_PAUSE_IN_SLEEP is set, - * watchdog will not fire when thread is sleeping. - * - */ -ZTEST(wdt_coverage, test_06b_wdt_setup_WDT_OPT_PAUSE_IN_SLEEP_functional) -{ - int ret; - - if (!(WDT_TEST_FLAGS & WDT_OPT_PAUSE_IN_SLEEP_SUPPORTED)) { - /* Skip this test because WDT_OPT_PAUSE_IN_SLEEP can NOT be used. */ - ztest_test_skip(); - } - - /* When test fails, watchdog sets m_test_06b_value to TEST_06B_TAG in WDT callback - * wdt_test_06b_cb. Then, target is reset. Check value of m_test_06b_value to prevent reset - * loop on this test. - */ - if (m_test_06b_value == TEST_06B_TAG) { - m_test_06b_value = 0U; - zassert_true(false, "Watchod has fired while it shouldn't"); - } - - /* Clear flag that is set when the watchdog fires */ - m_test_06b_value = 0U; - - m_cfg_wdt0.callback = wdt_test_06b_cb; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - /* Set timeout window to ~500 ms */ - m_cfg_wdt0.window.max = 500U; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - - ret = wdt_setup(wdt, WDT_OPT_PAUSE_IN_SLEEP); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - TC_PRINT("Test has failed if there is reset after this line\n"); - - /* Sleep for longer time than watchdog timeout */ - k_sleep(K_SECONDS(1)); - - /* m_test_06b_value is set to TEST_06B_TAG in WDT callback */ - zassert_equal(m_test_06b_value, 0, "Watchod has fired while it shouldn't"); - - /* Assumption: wdt_disable() is called after each test */ -} - -/** - * @brief wdt_setup() negative test - * - * Confirm that wdt_setup() returns - * -ENOTSUP when option WDT_OPT_PAUSE_HALTED_BY_DBG is not supported - * - */ -ZTEST(wdt_coverage, test_06c_wdt_setup_WDT_OPT_PAUSE_HALTED_BY_DBG_not_supported) -{ - int ret; - - if (WDT_TEST_FLAGS & WDT_OPT_PAUSE_HALTED_BY_DBG_SUPPORTED) { - /* Skip this test because WDT_OPT_PAUSE_HALTED_BY_DBG is supported. */ - ztest_test_skip(); - } - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - - ret = wdt_setup(wdt, WDT_OPT_PAUSE_HALTED_BY_DBG); - zassert_true(ret == -ENOTSUP, - "WDT_OPT_PAUSE_HALTED_BY_DBG is not supported on this target and should fail, " - "got unexpected value of %d", - ret); - - ret = wdt_setup(wdt, WDT_OPT_PAUSE_IN_SLEEP | WDT_OPT_PAUSE_HALTED_BY_DBG); - zassert_true(ret == -ENOTSUP, - "WDT_OPT_PAUSE_HALTED_BY_DBG is not supported on this target and should fail, " - "got unexpected value of %d", - ret); -} - -/** - * @brief wdt_setup() corner case - * - * Confirm that wdt_setup() returns - * 0 - success, when no option is provided - * - */ -ZTEST(wdt_coverage, test_06d_wdt_setup_without_any_OPT) -{ - int ret; - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - - ret = wdt_setup(wdt, 0x0); - zassert_true(ret == 0, "Got unexpected value of %d, while expected is 0", ret); -} - -/** - * @brief wdt_setup() negative test - * - * Confirm that wdt_setup() returns - * -EBUSY when watchdog instance has been already setup. - * - */ -ZTEST(wdt_coverage, test_07_wdt_setup_already_done) -{ - int ret; - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - - /* Call wdt_setup again to test invalid use */ - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == -EBUSY, - "Calling wdt_setup for the second time should return -EBUSY (-16), got " - "unexpected value of %d", - ret); - - /* Assumption: wdt_disable() is called after this test */ -} - -/** - * @brief wdt_setup() negative test - * - * Confirm that wdt_disable() returns - * -EPERM when watchdog can not be disabled directly by application code. - * - */ -ZTEST(wdt_coverage, test_08a_wdt_disable_not_supported) -{ - int ret; - - if (WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED) { - /* Skip this test because wdt_disable() is supported. */ - ztest_test_skip(); - } - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - /* Assumption - test suite execution finishes before WDT timeout will fire */ - m_cfg_wdt0.window.max = WDT_WINDOW_MAX_ALLOWED; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - - /* Call wdt_disable to test not allowed use */ - ret = wdt_disable(wdt); - zassert_true(ret == -EPERM, - "Disabling WDT is not supported on this target and should return -EPERM (-1), " - "got unexpected value of %d", - ret); -} - -/** - * @brief Test that wdt_disable() stops watchdog - * - * Confirm that wdt_disable() prevents previously configured - * watchdog from resetting the core. - * - */ -ZTEST(wdt_coverage, test_08b_wdt_disable_check_not_firing) -{ - int ret; - - if (!(WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED)) { - /* Skip this test because wdt_disable() is NOT supported. */ - ztest_test_skip(); - } - - /* When test fails, watchdog sets m_test_08b_value to TEST_08B_TAG in WDT callback - * wdt_test_08b_cb. Then, target is reset. Check value of m_test_08b_value to prevent reset - * loop on this test. - */ - if (m_test_08b_value == TEST_08B_TAG) { - m_test_08b_value = 0U; - zassert_true(false, "Watchod has fired while it shouldn't"); - } - - /* Clear flag that is set when the watchdog fires */ - m_test_08b_value = 0U; - - m_cfg_wdt0.callback = wdt_test_08b_cb; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - /* Set timeout window to ~500 ms */ - m_cfg_wdt0.window.max = 500U; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret >= 0, "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - TC_PRINT("Test has failed if there is reset after this line\n"); - - /* Wait for 450 ms, then disable the watchdog - * Don't change to k_sleep() because use of WDT_OPT_PAUSE_IN_SLEEP - * will break test scenario. - */ - k_busy_wait(450000); - ret = wdt_disable(wdt); - zassert_true(ret == 0, "Watchdog disable error, got unexpected value of %d", ret); - - /* Wait a bit more to see if watchdog fires - * Don't change to k_sleep() because use of WDT_OPT_PAUSE_IN_SLEEP - * will break test scenario. - */ - k_busy_wait(300000); - - /* m_test_08b_value is set to TEST_08B_TAG in WDT callback */ - zassert_equal(m_test_08b_value, 0, "Watchod has fired while it shouldn't"); -} - -/** - * @brief Test that after wdt_disable() timeouts can be reconfigured - * - * Confirm that after wdt_disable() it is possible to configure - * timeout channel that was configured previously. - * - */ -ZTEST(wdt_coverage, test_08c_wdt_disable_check_timeouts_reusable) -{ - int ret, id1, id2; - - if (!(WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED)) { - /* Skip this test because wdt_disable() is NOT supported. */ - ztest_test_skip(); - } - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - id1 = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(id1 >= 0, "Watchdog install error, got unexpected value of %d", id1); - TC_PRINT("Configured WDT channel %d\n", id1); - - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - - ret = wdt_disable(wdt); - zassert_true(ret == 0, "Watchdog disable error, got unexpected value of %d", ret); - - id2 = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(id2 >= 0, "Watchdog install error, got unexpected value of %d", id2); - TC_PRINT("Configured WDT channel %d\n", id2); - - /* test that timeout channel id2 is NOT greater than previously returned channel id1 */ - zassert_true(id2 <= id1, - "First usable timeout channel after wdt_disable() is %d, expected number no " - "greater than %d", - id2, id1); -} - -/** - * @brief Test that after wdt_disable() uninstalled timeouts don't have to be feed - * - * Confirm that wdt_disable() uninstalls all timeouts. - * When new timeout is configured, only this one has to be feed. - * - */ -ZTEST(wdt_coverage, test_08d_wdt_disable_check_timeouts_uninstalled) -{ - int ret, id_A, id_B, i; - - if (!(WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED)) { - /* Skip this test because wdt_disable() is NOT supported. */ - ztest_test_skip(); - } - - /* m_test_08d_A_value is set to TEST_08D_A_TAG in callback wdt_test_08d_A_cb */ - if (m_test_08d_A_value == TEST_08D_A_TAG) { - m_test_08d_A_value = 0U; - zassert_true(false, "Timeout A has fired while it shouldn't"); - } - - /* m_test_08d_B_value is set to TEST_08D_B_TAG in callback wdt_test_08d_B_cb */ - if (m_test_08d_B_value == TEST_08D_B_TAG) { - m_test_08d_B_value = 0U; - zassert_true(false, "Timeout B has fired while it shouldn't"); - } - - /* Clear flags that are set when the watchdog fires */ - m_test_08d_A_value = 0U; - m_test_08d_B_value = 0U; - - /* Configure Timeout A */ - m_cfg_wdt0.callback = wdt_test_08d_A_cb; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - /* Set timeout window to ~500 ms */ - m_cfg_wdt0.window.max = 500U; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - id_A = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(id_A >= 0, "Watchdog install error, got unexpected value of %d", id_A); - TC_PRINT("Configured WDT channel %d\n", id_A); - - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - - ret = wdt_disable(wdt); - zassert_true(ret == 0, "Watchdog disable error, got unexpected value of %d", ret); - - /* Configure Timeout B */ - m_cfg_wdt0.callback = wdt_test_08d_B_cb; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - /* Set timeout window to ~500 ms */ - m_cfg_wdt0.window.max = 500U; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - id_B = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(id_B >= 0, "Watchdog install error, got unexpected value of %d", id_B); - TC_PRINT("Configured WDT channel %d\n", id_B); - - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - TC_PRINT("Test has failed if there is reset after this line\n"); - - /* Confirm that only Timeout B has to be feed */ - for (i = 0; i < 4; i++) { - k_busy_wait(450000); - wdt_feed(wdt, id_B); - } - - ret = wdt_disable(wdt); - zassert_true(ret == 0, "Watchdog disable error, got unexpected value of %d", ret); - - /* m_test_08d_A_value is set to TEST_08D_A_TAG in callback wdt_test_08d_A_cb */ - zassert_equal(m_test_08d_A_value, 0, "Timeout A has fired while it shouldn't"); - - /* m_test_08d_B_value is set to TEST_08D_B_TAG in callback wdt_test_08d_B_cb */ - zassert_equal(m_test_08d_B_value, 0, "Timeout B has fired while it shouldn't"); -} - -/** - * @brief wdt_feed() negative test - * - * Confirm that wdt_feed() returns error or ASSERTION FAIL - * when it's called before wdt_setup(). - * Test scenario where timeout channel is configured. - * - */ -ZTEST(wdt_coverage, test_09a_wdt_feed_before_wdt_setup_channel_configured) -{ - int ret, ch_id; - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ch_id = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ch_id >= 0, "Watchdog install error, got unexpected value of %d", ch_id); - TC_PRINT("Configured WDT channel %d\n", ch_id); - - /* Call wdt_feed() before wdt_setup() (channel was configured) */ - ztest_set_assert_valid(true); - ret = wdt_feed(wdt, ch_id); - zassert_true(ret < 0, - "wdt_feed() shall return error value when called before wdt_setup(), got " - "unexpected value of %d", - ret); -} - -/** - * @brief wdt_feed() negative test - * - * Confirm that wdt_feed() returns - * -EINVAL when there is no installed timeout for supplied channel. - * - */ -ZTEST(wdt_coverage, test_09b_wdt_feed_invalid_channel) -{ - int ret, ch_id, ch_invalid; - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ch_id = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ch_id >= 0, "Watchdog install error, got unexpected value of %d", ch_id); - TC_PRINT("Configured WDT channel %d\n", ch_id); - - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - TC_PRINT("Test has failed if there is reset after this line\n"); - - /* Call wdt_feed() on not configured channel */ - ch_invalid = ch_id + 2; - ret = wdt_feed(wdt, ch_invalid); - zassert_true(ret == -EINVAL, - "wdt_feed(%d) shall return -EINVAL (-22), got unexpected value of %d", - ch_invalid, ret); - - /* Call wdt_feed() on not configured channel */ - ch_invalid = ch_id + 1; - ret = wdt_feed(wdt, ch_invalid); - zassert_true(ret == -EINVAL, - "wdt_feed(%d) shall return -EINVAL (-22), got unexpected value of %d", - ch_invalid, ret); - - /* Call wdt_feed() on invalid channel (no such channel) */ - ret = wdt_feed(wdt, -1); - zassert_true(ret == -EINVAL, - "wdt_feed(-1) shall return -EINVAL (-22), got unexpected value of %d", ret); - - /* Call wdt_feed() on invalid channel (no such channel) */ - ret = wdt_feed(wdt, MAX_INSTALLABLE_TIMEOUTS); - zassert_true(ret == -EINVAL, - "wdt_feed(%d) shall return -EINVAL (-22), got unexpected value of %d", - MAX_INSTALLABLE_TIMEOUTS, ret); - - /* Assumption: wdt_disable() is called after each test */ -} - -/** - * @brief wdt_feed() negative test - * - * Confirm that wdt_feed() returns - * -EAGAIN when completing the feed operation would stall the caller, for example - * due to an in-progress watchdog operation such as a previous wdt_feed() call. - * - */ -ZTEST(wdt_coverage, test_09c_wdt_feed_stall) -{ - int ret, ch_id, i; - - if (!(WDT_TEST_FLAGS & WDT_FEED_CAN_STALL)) { - /* Skip this test because wdt_feed() can NOT stall. */ - ztest_test_skip(); - } - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - ch_id = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ch_id >= 0, "Watchdog install error, got unexpected value of %d", ch_id); - TC_PRINT("Configured WDT channel %d\n", ch_id); - - ret = wdt_setup(wdt, DEFAULT_OPTIONS); - zassert_true(ret == 0, "Watchdog setup error, got unexpected value of %d", ret); - TC_PRINT("Test has failed if there is reset after this line\n"); - - for (i = 0; i < 5; i++) { - ret = wdt_feed(wdt, ch_id); - if (i == 0) { - zassert_true(ret == 0, "wdt_feed error, got unexpected value of %d", ret); - } else { - zassert_true( - ret == -EAGAIN, - "wdt_feed shall return -EAGAIN (-11), got unexpected value of %d", - ret); - } - } -} - -/** - * @brief wdt_install_timeout() negative test - * - * Confirm that wdt_install_timeout() returns - * -ENOMEM when no more timeouts can be installed. - * - */ -ZTEST(wdt_coverage, test_10_wdt_install_timeout_max_number_of_timeouts) -{ - int i, ret; - - m_cfg_wdt0.callback = NULL; - m_cfg_wdt0.flags = DEFAULT_FLAGS; - m_cfg_wdt0.window.max = DEFAULT_WINDOW_MAX; - m_cfg_wdt0.window.min = DEFAULT_WINDOW_MIN; - - for (i = 0; i < MAX_INSTALLABLE_TIMEOUTS; i++) { - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - /* Assumption - timeouts are counted from 0 to (MAX_INSTALLABLE_TIMEOUTS - 1) */ - zassert_true(ret < MAX_INSTALLABLE_TIMEOUTS, - "Watchdog install error, got unexpected value of %d", ret); - TC_PRINT("Configured WDT channel %d\n", ret); - } - - /* Call wdt_install_timeout again to test if error value is returned */ - ret = wdt_install_timeout(wdt, &m_cfg_wdt0); - zassert_true(ret == -ENOMEM, - "wdt_install_timeout shall return -ENOMEM (-12), 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; -} - -static void before_test(void *not_used) -{ - ARG_UNUSED(not_used); - int ret_val; - - ret_val = device_is_ready(wdt); - zassert_true(ret_val, "WDT device is not ready, got unexpected value of %d", ret_val); -} - -static void cleanup_after_test(void *f) -{ - if (WDT_TEST_FLAGS & WDT_DISABLE_SUPPORTED) { - /* Disable watchdog so it doesn't break other tests */ - wdt_disable(wdt); - } -} - -ZTEST_SUITE(wdt_coverage, NULL, suite_setup, before_test, cleanup_after_test, NULL); diff --git a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml b/tests/drivers/watchdog/wdt_error_cases/testcase.yaml deleted file mode 100644 index c408d2f8f1d..00000000000 --- a/tests/drivers/watchdog/wdt_error_cases/testcase.yaml +++ /dev/null @@ -1,13 +0,0 @@ -common: - tags: - - drivers - - watchdog - depends_on: watchdog - harness: ztest - -tests: - drivers.watchdog.wdt_error_cases: - platform_allow: - - nrf54l15pdk/nrf54l15/cpuapp - integration_platforms: - - nrf54l15pdk/nrf54l15/cpuapp From 7d5e2a49bc29daf9c5050be232152c61cae84a4a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2005/2300] Revert "[nrf fromlist] boards: nordic: Add ADC to supported in nRF54L15 PDK" This reverts commit 27319a0696777a3355c211f937baefe811b896ec. Signed-off-by: Robert Lubos --- boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml index 2858ddd35c5..95fc08d422e 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.yaml @@ -12,7 +12,6 @@ toolchain: ram: 256 flash: 1536 supported: - - adc - counter - gpio - i2c From dbb71d00724de30b3a09c7d3fcf0071ea129c9f1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2006/2300] Revert "[nrf fromtree] tests: drivers: Extend test coverage for NRF GPIO driver" This reverts commit 921a872239fd188c5e8c12e0ca8dd8a4788e1911. Signed-off-by: Robert Lubos --- tests/drivers/gpio/gpio_nrf/CMakeLists.txt | 10 ---- tests/drivers/gpio/gpio_nrf/README.txt | 4 -- tests/drivers/gpio/gpio_nrf/prj.conf | 2 - tests/drivers/gpio/gpio_nrf/src/main.c | 61 ---------------------- tests/drivers/gpio/gpio_nrf/testcase.yaml | 7 --- 5 files changed, 84 deletions(-) delete mode 100644 tests/drivers/gpio/gpio_nrf/CMakeLists.txt delete mode 100644 tests/drivers/gpio/gpio_nrf/README.txt delete mode 100644 tests/drivers/gpio/gpio_nrf/prj.conf delete mode 100644 tests/drivers/gpio/gpio_nrf/src/main.c delete mode 100644 tests/drivers/gpio/gpio_nrf/testcase.yaml diff --git a/tests/drivers/gpio/gpio_nrf/CMakeLists.txt b/tests/drivers/gpio/gpio_nrf/CMakeLists.txt deleted file mode 100644 index 2af607d1164..00000000000 --- a/tests/drivers/gpio/gpio_nrf/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(gpio_nrf_specific) - -target_sources(app PRIVATE - src/main.c - ) diff --git a/tests/drivers/gpio/gpio_nrf/README.txt b/tests/drivers/gpio/gpio_nrf/README.txt deleted file mode 100644 index 6a5927b725f..00000000000 --- a/tests/drivers/gpio/gpio_nrf/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -Nordic Semiconductor specific GPIO functions -############################################ -The suite specified here tests NRF specific -GPIO pin drive strength settings. diff --git a/tests/drivers/gpio/gpio_nrf/prj.conf b/tests/drivers/gpio/gpio_nrf/prj.conf deleted file mode 100644 index 0e799280f51..00000000000 --- a/tests/drivers/gpio/gpio_nrf/prj.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_ZTEST=y -CONFIG_GPIO=y diff --git a/tests/drivers/gpio/gpio_nrf/src/main.c b/tests/drivers/gpio/gpio_nrf/src/main.c deleted file mode 100644 index 8627e9bab1d..00000000000 --- a/tests/drivers/gpio/gpio_nrf/src/main.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -#if DT_NODE_HAS_PROP(DT_ALIAS(led0), gpios) -#define TEST_NODE DT_GPIO_CTLR(DT_ALIAS(led0), gpios) -#define TEST_PIN DT_GPIO_PIN(DT_ALIAS(led0), gpios) -#else -#error Unsupported board -#endif - -/* - * Nordic Semiconductor specific pin drive configurations - */ -ZTEST(gpio_nrf, test_gpio_high_drive_strength) -{ - int err; - const struct device *port; - - port = DEVICE_DT_GET(TEST_NODE); - zassert_true(device_is_ready(port), "GPIO dev is not ready"); - - err = gpio_pin_configure(port, TEST_PIN, GPIO_PUSH_PULL | NRF_GPIO_DRIVE_S0H1); - zassert_equal( - err, 0, - "Failed to configure the pin as an P-P output with drive: NRF_GPIO_DRIVE_S0H1, err=%d", - err); - - err = gpio_pin_configure(port, TEST_PIN, GPIO_PUSH_PULL | NRF_GPIO_DRIVE_H0S1); - zassert_equal( - err, 0, - "Failed to configure the pin as an P-P output with drive: NRF_GPIO_DRIVE_H0S1, err=%d", - err); - - err = gpio_pin_configure(port, TEST_PIN, GPIO_PUSH_PULL | NRF_GPIO_DRIVE_H0H1); - zassert_equal( - err, 0, - "Failed to configure the pin as an P-P output with drive: NRF_GPIO_DRIVE_H0H1, err=%d", - err); - - err = gpio_pin_configure(port, TEST_PIN, GPIO_OPEN_DRAIN | NRF_GPIO_DRIVE_H0S1); - zassert_equal( - err, 0, - "Failed to configure the pin as an O-D output with drive: NRF_GPIO_DRIVE_H0S1, err=%d", - err); - - err = gpio_pin_configure(port, TEST_PIN, GPIO_OPEN_SOURCE | NRF_GPIO_DRIVE_S0H1); - zassert_equal( - err, 0, - "Failed to configure the pin as an O-S output with drive: NRF_GPIO_DRIVE_S0H1, err=%d", - err); -} - -ZTEST_SUITE(gpio_nrf, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/drivers/gpio/gpio_nrf/testcase.yaml b/tests/drivers/gpio/gpio_nrf/testcase.yaml deleted file mode 100644 index 9c911ac378f..00000000000 --- a/tests/drivers/gpio/gpio_nrf/testcase.yaml +++ /dev/null @@ -1,7 +0,0 @@ -common: - tags: drivers gpio - depends_on: gpio - harness: ztest -tests: - drivers.gpio.gpio_nrf: - filter: dt_compat_enabled("nordic,nrf-gpio") and dt_nodelabel_enabled("led0") From 032a71ea37e13b1f83b080c8afddf95460ff588c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2007/2300] Revert "[nrf fromtree] scripts: list_hardware: Add check for soc.yml runner validity" This reverts commit b5cf3040298410845311ff7397374540d3451528. Signed-off-by: Robert Lubos --- scripts/list_hardware.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/scripts/list_hardware.py b/scripts/list_hardware.py index d1f31a4712e..2fa7c2a3638 100755 --- a/scripts/list_hardware.py +++ b/scripts/list_hardware.py @@ -10,7 +10,6 @@ import sys from typing import List import yaml -import re SOC_SCHEMA_PATH = str(Path(__file__).parent / 'schemas' / 'soc-schema.yml') @@ -41,40 +40,6 @@ def __init__(self, folder='', soc_yaml=None): except (yaml.YAMLError, pykwalify.errors.SchemaError) as e: sys.exit(f'ERROR: Malformed yaml {soc_yaml.as_posix()}', e) - # Ensure that any runner configuration matches socs and cpuclusters declared in the same - # soc.yml file - if 'runners' in data and 'run_once' in data['runners']: - for grp in data['runners']['run_once']: - for item_data in data['runners']['run_once'][grp]: - for group in item_data['groups']: - for qualifiers in group['qualifiers']: - components = qualifiers.split('/') - soc = components.pop(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 len(components) > 0 and components[len(components)-1] == 'ns': - components.pop(len(components)-1) - - for f in data.get('family', []): - for s in f.get('series', []): - for socs in s.get('socs', []): - if re.match(fr'^{soc}$', socs.get('name')) is not None: - if 'cpuclusters' in socs and len(components) > 0: - check_string = '/'.join(components) - for cpucluster in socs.get('cpuclusters', []): - if re.match(fr'^{check_string}$', cpucluster.get('name')) is not None: - found_match = True - break - elif 'cpuclusters' not in socs and len(components) == 0: - found_match = True - break - - - if found_match is False: - sys.exit(f'ERROR: SoC qualifier match unresolved: {qualifiers}') - for f in data.get('family', []): family = Family(f['name'], folder, [], []) for s in f.get('series', []): From dc235c5ca999873b66b867bda3bc3f6599c00c40 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2008/2300] Revert "[nrf fromtree] doc: build: flashing: Add documentation" This reverts commit 58e52f09c670aeea5a4afdfbd47745c2d46c25ae. Signed-off-by: Robert Lubos --- doc/build/flashing/configuration.rst | 106 --------------------------- doc/build/flashing/index.rst | 9 --- doc/build/index.rst | 1 - 3 files changed, 116 deletions(-) delete mode 100644 doc/build/flashing/configuration.rst delete mode 100644 doc/build/flashing/index.rst diff --git a/doc/build/flashing/configuration.rst b/doc/build/flashing/configuration.rst deleted file mode 100644 index 0611420ce17..00000000000 --- a/doc/build/flashing/configuration.rst +++ /dev/null @@ -1,106 +0,0 @@ -.. _flashing-soc-board-config: - -Flashing configuration -###################### - -Zephyr supports setting up configuration for flash runners (invoked from -:ref:`west flash`) which allows for customising how commands are used when -programming boards. This configuration is used for :ref:`sysbuild` projects and allows for -configuring when commands are ran for groups of board targets. As an example: a multi-core SoC -might want to only allow the ``--erase`` argument to be used once for all of the cores in the SoC -which would prevent multiple erase tasks running in a single ``west flash`` invocation, which -could wrongly clear the memory which is used by the other images being programmed. - -Priority -******** - -Flashing configuration is singular, it will only be read from a single location, this -configuration can reside in the following files starting with the highest priority: - - * ``soc.yml`` (in soc folder) - * ``board.yml`` (in board folder) - -Configuration -************* - -Configuration is applied in the yml file by using a ``runners`` map with a single ``run_once`` -child, this then contains a map of commands as they would be provided to the flash runner e.g. -``--reset`` followed by a list which specifies the settings for each of these commands (these -are grouped by flash runner, and by qualifiers/boards). Commands have associated runners that -they apply to using a ``runners`` list value, this can contain ``all`` if it applies to all -runners, otherwise must contain each runner that it applies to using the runner-specific name. -Groups of board targets can be specified using the ``groups`` key which has a list of board -target sets. Board targets are regular expression matches, for ``soc.yml`` files each set of -board targets must be in a ``qualifiers`` key (only regular expression matches for board -qualifiers are allowed, board names must be omitted from these entries). For ``board.yml`` -files each set of board targets must be in a ``boards`` key, these are lists containing the -matches which form a singular group. A final parameter ``run`` can be set to ``first`` which -means that the command will be ran once with the first image flashing process per set of board -targets, or to ``last`` which will be ran once for the final image flash per set of board targets. - -An example flashing configuration for a ``soc.yml`` is shown below in which the ``--recover`` -command will only be used once for any board targets which used the nRF5340 SoC application or -network CPU cores, and will only reset the network or application core after all images for the -respective core have been flashed. - -.. code-block:: yaml - - runners: - run_once: - '--recover': - - run: first - runners: - - nrfjprog - groups: - - qualifiers: - - nrf5340/cpunet - - nrf5340/cpuapp - - nrf5340/cpuapp/ns - '--reset': - - run: last - runners: - - nrfjprog - - jlink - groups: - - qualifiers: - - nrf5340/cpunet - - qualifiers: - - nrf5340/cpuapp - - nrf5340/cpuapp/ns - # Made up non-real world example to show how to specify different options for different - # flash runners - - run: first - runners: - - some_other_runner - groups: - - qualifiers: - - nrf5340/cpunet - - qualifiers: - - nrf5340/cpuapp - - nrf5340/cpuapp/ns - -Usage -***** - -Commands that are supported by flash runners can be used as normal when flashing non-sysbuild -applications, the run once configuration will not be used. When flashing a sysbuild project with -multiple images, the flash runner run once configuration will be applied. - -For example, building the :zephyr:code-sample:`smp-svr` sample for the nrf5340dk which will -include MCUboot as a secondary image: - -.. code-block:: console - - cmake -GNinja -Sshare/sysbuild/ -Bbuild -DBOARD=nrf5340dk/nrf5340/cpuapp -DAPP_DIR=samples/subsys/mgmt/mcumgr/smp_svr - cmake --build build - -Once built with an nrf5340dk connected, the following command can be used to flash the board with -both applications and will only perform a single device recovery operation when programming the -first image: - -.. code-block:: console - - west flash --recover - -If the above was ran without the flashing configuration, the recovery process would be ran twice -and the device would be unbootable. diff --git a/doc/build/flashing/index.rst b/doc/build/flashing/index.rst deleted file mode 100644 index 003dba418ea..00000000000 --- a/doc/build/flashing/index.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. _flashing: - -Flashing -######## - -.. toctree:: - :maxdepth: 1 - - configuration.rst diff --git a/doc/build/index.rst b/doc/build/index.rst index 91bf4c6018c..4a3e76be307 100644 --- a/doc/build/index.rst +++ b/doc/build/index.rst @@ -15,4 +15,3 @@ Build and Configuration Systems zephyr_cmake_package.rst sysbuild/index.rst version/index.rst - flashing/index.rst From 72c1e33d316362e9c6cd35229cd23ff5f6e1b488 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2009/2300] Revert "[nrf fromtree] soc: nordic: Add run once and deferred reset configuration" This reverts commit 7de9ca038d00e48846c871ab290b4eda8e79a46e. Signed-off-by: Robert Lubos --- soc/nordic/soc.yml | 59 ---------------------------------------------- 1 file changed, 59 deletions(-) diff --git a/soc/nordic/soc.yml b/soc/nordic/soc.yml index f7fb6bfec71..79aa5be285b 100644 --- a/soc/nordic/soc.yml +++ b/soc/nordic/soc.yml @@ -37,62 +37,3 @@ family: - name: nrf9151 - name: nrf9160 - name: nrf9161 - -# Recovery/erase is only needed once per core. Prevent resetting the cores whilst flashing -# multiple images until all images for each core have been flashed, this allows security -# bits to be set during programming without them interfering with additional flashing -# operations. -runners: - run_once: - '--recover': - - runners: - - nrfjprog - run: first - groups: - - qualifiers: - - nrf51([0-9]{3})((.+)?) - - qualifiers: - - nrf52([0-9]{3})((.+)?) - - qualifiers: - - nrf5340/cpunet - - nrf5340/cpuapp - - nrf5340/cpuapp/ns - - qualifiers: - - nrf9160 - - nrf9160/ns - '--erase': - - runners: - - nrfjprog - - jlink - run: first - groups: - - qualifiers: - - nrf51([0-9]{3})((.+)?) - - qualifiers: - - nrf52([0-9]{3})((.+)?) - - qualifiers: - - nrf5340/cpunet - - qualifiers: - - nrf5340/cpuapp - - nrf5340/cpuapp/ns - - qualifiers: - - nrf9160 - - nrf9160/ns - '--reset': - - runners: - - nrfjprog - - jlink - run: last - groups: - - qualifiers: - - nrf51([0-9]{3})((.+)?) - - qualifiers: - - nrf52([0-9]{3})((.+)?) - - qualifiers: - - nrf5340/cpunet - - qualifiers: - - nrf5340/cpuapp - - nrf5340/cpuapp/ns - - qualifiers: - - nrf9160 - - nrf9160/ns From 4107ad2fa37559b2021a4e28bbe9a42a365cf93f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2010/2300] Revert "[nrf fromtree] soc: nordic: Reformat soc.yml file" This reverts commit 4bd4c1d35743f0c5d3260889a2ed6b4e56cecaf3. Signed-off-by: Robert Lubos --- soc/nordic/soc.yml | 76 +++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/soc/nordic/soc.yml b/soc/nordic/soc.yml index 79aa5be285b..87f35a46558 100644 --- a/soc/nordic/soc.yml +++ b/soc/nordic/soc.yml @@ -1,39 +1,39 @@ family: - - name: nordic_nrf - series: - - name: nrf51 - socs: - - name: nrf51822 - - name: nrf52 - socs: - - name: nrf52805 - - name: nrf52810 - - name: nrf52811 - - name: nrf52820 - - name: nrf52832 - - name: nrf52833 - - name: nrf52840 - - name: nrf53 - socs: - - name: nrf5340 - cpuclusters: - - name: cpuapp - - name: cpunet - - name: nrf54l - socs: - - name: nrf54l15 - cpuclusters: - - name: cpuapp - - name: nrf54h - socs: - - name: nrf54h20 - cpuclusters: - - name: cpuapp - - name: cpurad - - name: cpuppr - - name: nrf91 - socs: - - name: nrf9131 - - name: nrf9151 - - name: nrf9160 - - name: nrf9161 +- name: nordic_nrf + series: + - name: nrf51 + socs: + - name: nrf51822 + - name: nrf52 + socs: + - name: nrf52805 + - name: nrf52810 + - name: nrf52811 + - name: nrf52820 + - name: nrf52832 + - name: nrf52833 + - name: nrf52840 + - name: nrf53 + socs: + - name: nrf5340 + cpuclusters: + - name: cpuapp + - name: cpunet + - name: nrf54l + socs: + - name: nrf54l15 + cpuclusters: + - name: cpuapp + - name: nrf54h + socs: + - name: nrf54h20 + cpuclusters: + - name: cpuapp + - name: cpurad + - name: cpuppr + - name: nrf91 + socs: + - name: nrf9131 + - name: nrf9151 + - name: nrf9160 + - name: nrf9161 From 1aa83c4eeacd83192da0840a21f83135a5bc0a49 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2011/2300] Revert "[nrf fromtree] west: runners: Add run once commands and deferred reset" This reverts commit 8a73ec17c0d6bccdfcac09e9e46313f7402dda3d. Signed-off-by: Robert Lubos --- cmake/modules/soc_v2.cmake | 2 +- scripts/schemas/board-schema.yml | 51 ------- scripts/schemas/soc-schema.yml | 51 ------- scripts/west_commands/run_common.py | 224 ++-------------------------- 4 files changed, 10 insertions(+), 318 deletions(-) diff --git a/cmake/modules/soc_v2.cmake b/cmake/modules/soc_v2.cmake index 606ed690f77..6a03dd2cbf0 100644 --- a/cmake/modules/soc_v2.cmake +++ b/cmake/modules/soc_v2.cmake @@ -27,6 +27,6 @@ if(HWMv2) set(SOC_TOOLCHAIN_NAME ${CONFIG_SOC_TOOLCHAIN_NAME}) 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(SOC_FULL_DIR ${SOC_V2_DIR}) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${SOC_V2_DIR}/soc.yml) endif() diff --git a/scripts/schemas/board-schema.yml b/scripts/schemas/board-schema.yml index 56ee4eab034..6a9262bf8f5 100644 --- a/scripts/schemas/board-schema.yml +++ b/scripts/schemas/board-schema.yml @@ -78,54 +78,3 @@ mapping: type: seq sequence: - include: board-schema - runners: - type: map - mapping: - run_once: - type: map - desc: | - Allows for restricting west flash commands when using sysbuild to run once per given - grouping of board targets. This is to allow for future image program cycles to not - erase the flash of a device which has just been programmed by another image. - mapping: - regex;(.*): - type: seq - desc: | - A dictionary of commands which should be limited to running once per invocation - of west flash for a given set of flash runners and board targets. - sequence: - - type: map - mapping: - run: - required: true - type: str - enum: ['first', 'last'] - desc: | - If first, will run this command once when the first image is flashed, if - last, will run this command once when the final image is flashed. - runners: - required: true - type: seq - sequence: - - type: str - desc: | - A list of flash runners that this applies to, can use `all` to apply - to all runners. - groups: - required: true - type: seq - sequence: - - type: map - desc: | - A grouping of board targets which the command should apply to. Can - be used multiple times to have multiple groups. - mapping: - boards: - required: true - type: seq - sequence: - - type: str - desc: | - A board target to match against in regex. Must be one entry - per board target, a single regex entry will not match two - board targets even if they both match. diff --git a/scripts/schemas/soc-schema.yml b/scripts/schemas/soc-schema.yml index c13b4a4f7e0..dd62ee3c17d 100644 --- a/scripts/schemas/soc-schema.yml +++ b/scripts/schemas/soc-schema.yml @@ -70,54 +70,3 @@ mapping: required: false type: str desc: Free form comment with extra information regarding the SoC. - runners: - type: map - mapping: - run_once: - type: map - desc: | - Allows for restricting west flash commands when using sysbuild to run once per given - grouping of board targets. This is to allow for future image program cycles to not - erase the flash of a device which has just been programmed by another image. - mapping: - regex;(.*): - type: seq - desc: | - A dictionary of commands which should be limited to running once per invocation - of west flash for a given set of flash runners and board targets. - sequence: - - type: map - mapping: - run: - required: true - type: str - enum: ['first', 'last'] - desc: | - If first, will run this command once when the first image is flashed, if - last, will run this command once when the final image is flashed. - runners: - required: true - type: seq - sequence: - - type: str - desc: | - A list of flash runners that this applies to, can use `all` to apply - to all runners. - groups: - required: true - type: seq - sequence: - - type: map - desc: | - A grouping of board targets which the command should apply to. Can - be used multiple times to have multiple groups. - mapping: - qualifiers: - required: true - type: seq - sequence: - - type: str - desc: | - A board qualifier to match against in regex form. Must be one - entry per board target, a single regex entry will not match - two board targets even if they both match. diff --git a/scripts/west_commands/run_common.py b/scripts/west_commands/run_common.py index 8656d090767..43d736f2b68 100644 --- a/scripts/west_commands/run_common.py +++ b/scripts/west_commands/run_common.py @@ -1,15 +1,12 @@ # Copyright (c) 2018 Open Source Foundries Limited. -# Copyright (c) 2023 Nordic Semiconductor ASA # # SPDX-License-Identifier: Apache-2.0 '''Common code used by commands which execute runners. ''' -import re import argparse import logging -from collections import defaultdict from os import close, getcwd, path, fspath from pathlib import Path from subprocess import CalledProcessError @@ -18,14 +15,12 @@ import textwrap import traceback -from dataclasses import dataclass from west import log from build_helpers import find_build_dir, is_zephyr_build, load_domains, \ FIND_BUILD_DIR_DESCRIPTION from west.commands import CommandError from west.configuration import config from runners.core import FileType -from runners.core import BuildConfiguration import yaml from zephyr_ext_common import ZEPHYR_SCRIPTS @@ -83,19 +78,6 @@ def emit(self, record): else: log.dbg(fmt, level=log.VERBOSE_EXTREME) -@dataclass -class UsedFlashCommand: - command: str - boards: list - runners: list - first: bool - ran: bool = False - -@dataclass -class ImagesFlashed: - flashed: int = 0 - total: int = 0 - def command_verb(command): return "flash" if command.name == "flash" else "debug" @@ -165,19 +147,6 @@ def do_run_common(command, user_args, user_runner_args, domains=None): # This is the main routine for all the "west flash", "west debug", # etc. commands. - # Holds a list of run once commands, this is useful for sysbuild images - # whereby there are multiple images per board with flash commands that can - # interfere with other images if they run one per time an image is flashed. - used_cmds = [] - - # Holds a set of processed board names for flash running information. - processed_boards = set() - - # Holds a dictionary of board image flash counts, the first element is - # number of images flashed so far and second element is total number of - # images for a given board. - board_image_count = defaultdict(ImagesFlashed) - if user_args.context: dump_context(command, user_args, user_runner_args) return @@ -196,108 +165,20 @@ def do_run_common(command, user_args, user_runner_args, domains=None): # Get the user specified domains. domains = load_domains(build_dir).get_domains(user_args.domain) - if len(domains) > 1: - if len(user_runner_args) > 0: - log.wrn("Specifying runner options for multiple domains is experimental.\n" - "If problems are experienced, please specify a single domain " - "using '--domain '") - - # Process all domains to load board names and populate flash runner - # parameters. - board_names = set() - for d in domains: - if d.build_dir is None: - build_dir = get_build_dir(user_args) - else: - build_dir = d.build_dir - - cache = load_cmake_cache(build_dir, user_args) - build_conf = BuildConfiguration(build_dir) - board = build_conf.get('CONFIG_BOARD_TARGET') - board_names.add(board) - board_image_count[board].total += 1 - - # 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: - 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)) - - # Reduce entries to only those having matching board names (either exact or with regex) and - # remove any entries with empty board lists - for i, entry in enumerate(used_cmds): - for l, match in enumerate(entry.boards): - match_found = False - - # Check if there is a matching board for this regex - for check in board_names: - if re.match(fr'^{match}$', check) is not None: - match_found = True - break - - if not match_found: - del entry.boards[l] - - if len(entry.boards) == 0: - del used_cmds[i] + if len(domains) > 1 and len(user_runner_args) > 0: + log.wrn("Specifying runner options for multiple domains is experimental.\n" + "If problems are experienced, please specify a single domain " + "using '--domain '") for d in domains: - do_run_common_image(command, user_args, user_runner_args, - used_cmds, board_image_count, d.build_dir) - + do_run_common_image(command, user_args, user_runner_args, d.build_dir) -def do_run_common_image(command, user_args, user_runner_args, used_cmds, - board_image_count, build_dir=None,): - global re +def do_run_common_image(command, user_args, user_runner_args, build_dir=None): command_name = command.name if build_dir is None: build_dir = get_build_dir(user_args) cache = load_cmake_cache(build_dir, user_args) - build_conf = BuildConfiguration(build_dir) - board = build_conf.get('CONFIG_BOARD_TARGET') - - if board_image_count is not None and board in board_image_count: - board_image_count[board].flashed += 1 + board = cache['CACHED_BOARD'] # Load runners.yaml. yaml_path = runners_yaml_path(build_dir, board) @@ -320,93 +201,6 @@ def do_run_common_image(command, user_args, user_runner_args, used_cmds, # parsing, it will show up here, and needs to be filtered out. runner_args = [arg for arg in user_runner_args if arg != '--'] - # Check if there are any commands that should only be ran once per board - # and if so, remove them for all but the first iteration of the flash - # runner per unique board name. - if len(used_cmds) > 0 and len(runner_args) > 0: - i = len(runner_args) - 1 - while i >= 0: - for cmd in used_cmds: - if cmd.command == runner_args[i] and (runner_name in cmd.runners or 'all' in cmd.runners): - # Check if board is here - match_found = False - - for match in cmd.boards: - # Check if there is a matching board for this regex - if re.match(fr'^{match}$', board) is not None: - match_found = True - break - - if not match_found: - continue - - # Check if this is a first or last run - if not cmd.first: - # For last run instances, we need to check that this really is the last - # image of all boards being flashed - for check in cmd.boards: - can_continue = False - - for match in board_image_count: - if re.match(fr'^{check}$', match) is not None: - if board_image_count[match].flashed == board_image_count[match].total: - can_continue = True - break - - if not can_continue: - continue - - if not cmd.ran: - cmd.ran = True - else: - runner_args.pop(i) - - break - - i = i - 1 - - # If flashing multiple images, the runner supports reset after flashing and - # the board has enabled this functionality, check if the board should be - # reset or not. If this is not specified in the board/soc file, leave it up to - # the runner's default configuration to decide if a reset should occur. - if runner_cls.capabilities().reset: - if board_image_count is not None: - reset = True - - for cmd in used_cmds: - if cmd.command == '--reset' and (runner_name in cmd.runners or 'all' in cmd.runners): - # Check if board is here - match_found = False - - for match in cmd.boards: - if re.match(fr'^{match}$', board) is not None: - match_found = True - break - - if not match_found: - continue - - # Check if this is a first or last run - if cmd.first and cmd.ran: - reset = False - break - elif not cmd.first and not cmd.ran: - # For last run instances, we need to check that this really is the last - # image of all boards being flashed - for check in cmd.boards: - can_continue = False - - for match in board_image_count: - if re.match(fr'^{check}$', match) is not None: - if board_image_count[match].flashed != board_image_count[match].total: - reset = False - break - - if reset: - runner_args.append('--reset') - else: - runner_args.append('--no-reset') - # Arguments in this order to allow specific to override general: # # - runner-specific runners.yaml arguments @@ -645,8 +439,8 @@ def dump_context(command, args, unknown_args): log.wrn('no --build-dir given or found; output will be limited') runners_yaml = None else: - build_conf = BuildConfiguration(build_dir) - board = build_conf.get('CONFIG_BOARD_TARGET') + cache = load_cmake_cache(build_dir, args) + board = cache['CACHED_BOARD'] yaml_path = runners_yaml_path(build_dir, board) runners_yaml = load_runners_yaml(yaml_path) From 598e75a42e7e40fedadd921e73b26454810b10d4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2012/2300] Revert "[nrf fromtree] doc: build: Add details on SoC overlays" This reverts commit 32653d77da94a492e9a4ae1eea45ec190bcdd0d3. Signed-off-by: Robert Lubos --- doc/build/dts/howtos.rst | 7 ++++--- doc/build/kconfig/setting.rst | 8 +------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/doc/build/dts/howtos.rst b/doc/build/dts/howtos.rst index c6ee5a80d30..cb556bb782d 100644 --- a/doc/build/dts/howtos.rst +++ b/doc/build/dts/howtos.rst @@ -237,10 +237,11 @@ If you don't set :makevar:`DTC_OVERLAY_FILE`, the build system will follow these steps, looking for files in your application configuration directory to use as devicetree overlays: -#. If the file :file:`socs/_.overlay` exists, it will be used. -#. If the file :file:`boards/.overlay` exists, it will be used in addition to the above. +#. If the file :file:`boards/.overlay` exists, it will be used. #. If the current board has :ref:`multiple revisions ` - and :file:`boards/_.overlay` exists, it will be used in addition to the above. + and :file:`boards/_.overlay` exists, it will be used. + This file will be used in addition to :file:`boards/.overlay` + if both exist. #. If one or more files have been found in the previous steps, the build system stops looking and just uses those files. #. Otherwise, if :file:`.overlay` exists, it will be used, and the build diff --git a/doc/build/kconfig/setting.rst b/doc/build/kconfig/setting.rst index ba3ee33938a..cc7658a1664 100644 --- a/doc/build/kconfig/setting.rst +++ b/doc/build/kconfig/setting.rst @@ -151,8 +151,7 @@ used. form :file:`prj_.conf` and if file :file:`boards/_.conf` exists in same folder as file :file:`prj_.conf`, the result of merging :file:`prj_.conf` and - :file:`boards/_.conf` is used - note that this feature is - deprecated, :ref:`application-file-suffixes` should be used instead. + :file:`boards/_.conf` is used. #. Otherwise, :file:`prj_.conf` is used if it exists in the application configuration directory. @@ -169,11 +168,6 @@ used. #. Otherwise, :file:`prj.conf` is used from the application configuration directory. If it does not exist then a fatal error will be emitted. -Furthermore, applications can have SoC overlay configuration that is applied to -it, the file :file:`socs/_.conf` will be applied if it exists, -after the main project configuration has been applied and before any board overlay -configuration files have been applied. - All configuration files will be taken from the application's configuration directory except for files with an absolute path that are given with the ``CONF_FILE``, ``EXTRA_CONF_FILE``, ``DTC_OVERLAY_FILE``, and From b164541094c669f783fd28ff6efecd3a4ed2d894 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2013/2300] Revert "[nrf fromtree] tests: cmake: overlays: Add soc_folder_overlay test" This reverts commit b57fbe421a80ecb94e2a5504db4b859bb234ed6f. Signed-off-by: Robert Lubos --- .../soc_folder_overlay/CMakeLists.txt | 9 -- .../cmake/overlays/soc_folder_overlay/Kconfig | 31 ------ .../overlays/soc_folder_overlay/app.overlay | 5 - .../boards/native_sim_native.overlay | 5 - .../boards/native_sim_native_64.overlay | 5 - .../native_sim_native_64_somesuffix.overlay | 5 - .../native_sim_native_somesuffix.overlay | 5 - .../overlays/soc_folder_overlay/prj.conf | 1 - .../soc_folder_overlay/socs/native.overlay | 5 - .../soc_folder_overlay/socs/native_64.overlay | 5 - .../socs/native_64_somesuffix.overlay | 5 - .../socs/native_somesuffix.overlay | 5 - .../overlays/soc_folder_overlay/src/main.c | 96 ------------------- .../overlays/soc_folder_overlay/testcase.yaml | 30 ------ 14 files changed, 212 deletions(-) delete mode 100644 tests/cmake/overlays/soc_folder_overlay/CMakeLists.txt delete mode 100644 tests/cmake/overlays/soc_folder_overlay/Kconfig delete mode 100644 tests/cmake/overlays/soc_folder_overlay/app.overlay delete mode 100644 tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native.overlay delete mode 100644 tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64.overlay delete mode 100644 tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64_somesuffix.overlay delete mode 100644 tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_somesuffix.overlay delete mode 100644 tests/cmake/overlays/soc_folder_overlay/prj.conf delete mode 100644 tests/cmake/overlays/soc_folder_overlay/socs/native.overlay delete mode 100644 tests/cmake/overlays/soc_folder_overlay/socs/native_64.overlay delete mode 100644 tests/cmake/overlays/soc_folder_overlay/socs/native_64_somesuffix.overlay delete mode 100644 tests/cmake/overlays/soc_folder_overlay/socs/native_somesuffix.overlay delete mode 100644 tests/cmake/overlays/soc_folder_overlay/src/main.c delete mode 100644 tests/cmake/overlays/soc_folder_overlay/testcase.yaml diff --git a/tests/cmake/overlays/soc_folder_overlay/CMakeLists.txt b/tests/cmake/overlays/soc_folder_overlay/CMakeLists.txt deleted file mode 100644 index dbd1fab670d..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(overlays_soc_folder_overlay) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/cmake/overlays/soc_folder_overlay/Kconfig b/tests/cmake/overlays/soc_folder_overlay/Kconfig deleted file mode 100644 index a49375710f3..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/Kconfig +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FOLDER_TEST_INCLUDE_APP - bool - default "$(dt_alias_enabled,test-app)" - -config SOC_FOLDER_TEST_INCLUDE_BOARD - bool - default "$(dt_alias_enabled,test-board)" - -config SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX - bool - default "$(dt_alias_enabled,test-board-suffix)" - -config SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS - bool - default "$(dt_alias_enabled,test-board-qualifiers)" - -config SOC_FOLDER_TEST_INCLUDE_SOC - bool - default "$(dt_alias_enabled,test-soc)" - -config SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX - bool - default "$(dt_alias_enabled,test-soc-suffix)" - -config TEST_TYPE - int "Test type" - -source "Kconfig.zephyr" diff --git a/tests/cmake/overlays/soc_folder_overlay/app.overlay b/tests/cmake/overlays/soc_folder_overlay/app.overlay deleted file mode 100644 index ad861b3e462..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/app.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - aliases { - test-app = &uart0; - }; -}; diff --git a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native.overlay b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native.overlay deleted file mode 100644 index 126168af115..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - aliases { - test-board = &uart0; - }; -}; diff --git a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64.overlay b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64.overlay deleted file mode 100644 index 5db22cfdfc4..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - aliases { - test-board-qualifiers = &uart0; - }; -}; diff --git a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64_somesuffix.overlay b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64_somesuffix.overlay deleted file mode 100644 index 79d904a717e..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_64_somesuffix.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - aliases { - test-board-suffix = &uart0; - }; -}; diff --git a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_somesuffix.overlay b/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_somesuffix.overlay deleted file mode 100644 index 79d904a717e..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/boards/native_sim_native_somesuffix.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - aliases { - test-board-suffix = &uart0; - }; -}; diff --git a/tests/cmake/overlays/soc_folder_overlay/prj.conf b/tests/cmake/overlays/soc_folder_overlay/prj.conf deleted file mode 100644 index 9467c292689..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/prj.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ZTEST=y diff --git a/tests/cmake/overlays/soc_folder_overlay/socs/native.overlay b/tests/cmake/overlays/soc_folder_overlay/socs/native.overlay deleted file mode 100644 index 240f4f97800..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/socs/native.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - aliases { - test-soc = &uart0; - }; -}; diff --git a/tests/cmake/overlays/soc_folder_overlay/socs/native_64.overlay b/tests/cmake/overlays/soc_folder_overlay/socs/native_64.overlay deleted file mode 100644 index 240f4f97800..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/socs/native_64.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - aliases { - test-soc = &uart0; - }; -}; diff --git a/tests/cmake/overlays/soc_folder_overlay/socs/native_64_somesuffix.overlay b/tests/cmake/overlays/soc_folder_overlay/socs/native_64_somesuffix.overlay deleted file mode 100644 index be46f686750..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/socs/native_64_somesuffix.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - aliases { - test-soc-suffix = &uart0; - }; -}; diff --git a/tests/cmake/overlays/soc_folder_overlay/socs/native_somesuffix.overlay b/tests/cmake/overlays/soc_folder_overlay/socs/native_somesuffix.overlay deleted file mode 100644 index be46f686750..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/socs/native_somesuffix.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/ { - aliases { - test-soc-suffix = &uart0; - }; -}; diff --git a/tests/cmake/overlays/soc_folder_overlay/src/main.c b/tests/cmake/overlays/soc_folder_overlay/src/main.c deleted file mode 100644 index b4e1f22b6ae..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/src/main.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#ifndef CONFIG_TEST_TYPE -#error "Invalid test configuration" -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_APP -#define INCLUDED_APP 1 -#else -#define INCLUDED_APP 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD -#define INCLUDED_BOARD 1 -#else -#define INCLUDED_BOARD 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX -#define INCLUDED_BOARD_SUFFIX 1 -#else -#define INCLUDED_BOARD_SUFFIX 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS -#define INCLUDED_BOARD_QUALIFIERS 1 -#else -#define INCLUDED_BOARD_QUALIFIERS 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC -#define INCLUDED_SOC 1 -#else -#define INCLUDED_SOC 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX -#define INCLUDED_SOC_SUFFIX 1 -#else -#define INCLUDED_SOC_SUFFIX 0 -#endif - -#if CONFIG_TEST_TYPE == 0 -/* Default test */ -ZTEST(soc_folder_overlay, test_default) -{ - zassert_false(INCLUDED_APP, "Did not expect app overlay to be present"); - zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix overlay to be present"); - -#ifdef CONFIG_BOARD_NATIVE_SIM_NATIVE_64 - zassert_false(INCLUDED_BOARD, "Did not expect board overlay to be present"); - zassert_true(INCLUDED_BOARD_QUALIFIERS, "Expected board qualifier overlay to be present"); -#else - zassert_true(INCLUDED_BOARD, "Expected board overlay to be present"); - zassert_false(INCLUDED_BOARD_QUALIFIERS, - "Did not expect board qualifier overlay to be present"); -#endif - - zassert_true(INCLUDED_SOC, "Expect soc overlay to be present"); - zassert_false(INCLUDED_SOC_SUFFIX, "Did not expect soc suffix overlay to be present"); -} -#elif CONFIG_TEST_TYPE == 1 -/* File suffix test */ -ZTEST(soc_folder_overlay, test_suffix) -{ - zassert_false(INCLUDED_APP, "Did not expect app overlay to be present"); - zassert_true(INCLUDED_BOARD_SUFFIX, "Expected board suffix overlay to be present"); - zassert_false(INCLUDED_BOARD, "Did not expect board overlay to be present"); - zassert_false(INCLUDED_BOARD_QUALIFIERS, - "Did not expect board qualifier overlay to be present"); - zassert_false(INCLUDED_SOC, "Did not expect soc overlay to be present"); - zassert_true(INCLUDED_SOC_SUFFIX, "Expected soc suffix overlay to be present"); -} -#elif CONFIG_TEST_TYPE == 2 -/* App overlay test */ -ZTEST(soc_folder_overlay, test_app) -{ - zassert_true(INCLUDED_APP, "Expected app overlay to be present"); - zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix overlay to be present"); - zassert_false(INCLUDED_BOARD, "Did not expect board overlay to be present"); - zassert_false(INCLUDED_BOARD_QUALIFIERS, - "Did not expect board qualifier overlay to be present"); - zassert_false(INCLUDED_SOC, "Did not expect soc overlay to be present"); - zassert_false(INCLUDED_SOC_SUFFIX, "Did not epect soc suffix overlay to be present"); -} -#else -#error "Invalid test type" -#endif - -ZTEST_SUITE(soc_folder_overlay, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/cmake/overlays/soc_folder_overlay/testcase.yaml b/tests/cmake/overlays/soc_folder_overlay/testcase.yaml deleted file mode 100644 index 659560cf836..00000000000 --- a/tests/cmake/overlays/soc_folder_overlay/testcase.yaml +++ /dev/null @@ -1,30 +0,0 @@ -common: - tags: - - cmake -tests: - cmake.overlays.soc_folder_overlay.default: - platform_allow: - - native_sim - - native_sim/native/64 - integration_platforms: - - native_sim - - native_sim/native/64 - extra_args: - - CONFIG_TEST_TYPE=0 - cmake.overlays.soc_folder_overlay.suffix: - platform_allow: - - native_sim - - native_sim/native/64 - integration_platforms: - - native_sim - - native_sim/native/64 - extra_args: - - CONFIG_TEST_TYPE=1 - - FILE_SUFFIX=somesuffix - cmake.overlays.soc_folder_overlay.app: - platform_allow: - - qemu_cortex_m3 - integration_platforms: - - qemu_cortex_m3 - extra_args: - - CONFIG_TEST_TYPE=2 From 0e96e7975bb18d5287d37081b778f0806ab02fcb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:16 +0200 Subject: [PATCH 2014/2300] Revert "[nrf fromtree] tests: cmake: overlays: Add soc_folder_kconfig test" This reverts commit 6df96e93c6331878e1be41fc2f1baf575d688576. Signed-off-by: Robert Lubos --- .../soc_folder_kconfig/CMakeLists.txt | 9 -- .../cmake/overlays/soc_folder_kconfig/Kconfig | 32 ---- .../boards/native_sim_native.conf | 2 - .../boards/native_sim_native_64.conf | 2 - .../native_sim_native_64_somesuffix.conf | 2 - .../boards/native_sim_native_somesuffix.conf | 2 - .../soc_folder_kconfig/boards/other.conf | 3 - .../overlays/soc_folder_kconfig/prj.conf | 1 - .../soc_folder_kconfig/socs/native.conf | 2 - .../soc_folder_kconfig/socs/native_64.conf | 2 - .../socs/native_64_somesuffix.conf | 2 - .../socs/native_somesuffix.conf | 2 - .../soc_folder_kconfig/socs/other.conf | 2 - .../overlays/soc_folder_kconfig/src/main.c | 139 ------------------ .../overlays/soc_folder_kconfig/testcase.yaml | 26 ---- 15 files changed, 228 deletions(-) delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/CMakeLists.txt delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/Kconfig delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64_somesuffix.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_somesuffix.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/boards/other.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/prj.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/native.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/native_64.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/native_64_somesuffix.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/native_somesuffix.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/socs/other.conf delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/src/main.c delete mode 100644 tests/cmake/overlays/soc_folder_kconfig/testcase.yaml diff --git a/tests/cmake/overlays/soc_folder_kconfig/CMakeLists.txt b/tests/cmake/overlays/soc_folder_kconfig/CMakeLists.txt deleted file mode 100644 index db78c7333ef..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(overlays_soc_folder_kconfig) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/cmake/overlays/soc_folder_kconfig/Kconfig b/tests/cmake/overlays/soc_folder_kconfig/Kconfig deleted file mode 100644 index fcc64e50e5c..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/Kconfig +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config SOC_FOLDER_TEST_STRING - string "Test string" - default "one" - -config SOC_FOLDER_TEST_INCLUDE_BOARD - bool "Included board Kconfig fragment" - -config SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX - bool "Included board Kconfig fragment with suffix" - -config SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS - bool "Included board with qualifiers Kconfig fragment" - -config SOC_FOLDER_TEST_INCLUDE_BOARD_OTHER - bool "Included other board Kconfig fragment" - -config SOC_FOLDER_TEST_INCLUDE_SOC - bool "Included soc Kconfig fragment" - -config SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX - bool "Included soc overlay Kconfig fragment" - -config SOC_FOLDER_TEST_INCLUDE_SOC_OTHER - bool "Included other soc overlay Kconfig fragment" - -config TEST_TYPE - int "Test type" - -source "Kconfig.zephyr" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native.conf deleted file mode 100644 index 4e5465df698..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD=y -CONFIG_SOC_FOLDER_TEST_STRING="two" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64.conf deleted file mode 100644 index f14979567c0..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS=y -CONFIG_SOC_FOLDER_TEST_STRING="five" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64_somesuffix.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64_somesuffix.conf deleted file mode 100644 index c77f9d10a7e..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_64_somesuffix.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX=y -CONFIG_SOC_FOLDER_TEST_STRING="four" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_somesuffix.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_somesuffix.conf deleted file mode 100644 index c77f9d10a7e..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/boards/native_sim_native_somesuffix.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX=y -CONFIG_SOC_FOLDER_TEST_STRING="four" diff --git a/tests/cmake/overlays/soc_folder_kconfig/boards/other.conf b/tests/cmake/overlays/soc_folder_kconfig/boards/other.conf deleted file mode 100644 index 4a8bc05df97..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/boards/other.conf +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_OTHER=y -CONFIG_SOC_FOLDER_TEST_STRING="three" -CONFIG_ZTEST=y diff --git a/tests/cmake/overlays/soc_folder_kconfig/prj.conf b/tests/cmake/overlays/soc_folder_kconfig/prj.conf deleted file mode 100644 index 9467c292689..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/prj.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ZTEST=y diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/native.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/native.conf deleted file mode 100644 index ad2c3bb4ab6..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/socs/native.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC=y -CONFIG_SOC_FOLDER_TEST_STRING="seven" diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/native_64.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/native_64.conf deleted file mode 100644 index 5b99d60a0cc..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/socs/native_64.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC=y -CONFIG_SOC_FOLDER_TEST_STRING="six" diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/native_64_somesuffix.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/native_64_somesuffix.conf deleted file mode 100644 index 3eac9628cec..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/socs/native_64_somesuffix.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX=y -CONFIG_SOC_FOLDER_TEST_STRING="eight" diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/native_somesuffix.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/native_somesuffix.conf deleted file mode 100644 index 3eac9628cec..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/socs/native_somesuffix.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX=y -CONFIG_SOC_FOLDER_TEST_STRING="eight" diff --git a/tests/cmake/overlays/soc_folder_kconfig/socs/other.conf b/tests/cmake/overlays/soc_folder_kconfig/socs/other.conf deleted file mode 100644 index aff49c6a975..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/socs/other.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_OTHER=y -CONFIG_SOC_FOLDER_TEST_STRING="nine" diff --git a/tests/cmake/overlays/soc_folder_kconfig/src/main.c b/tests/cmake/overlays/soc_folder_kconfig/src/main.c deleted file mode 100644 index 2a3c69c02b5..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/src/main.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#ifdef CONFIG_SOC_FOLDER_TEST_STRING -#define STRING_OUTPUT CONFIG_SOC_FOLDER_TEST_STRING -#else -#error "Invalid test configuration" -#endif - -#ifndef CONFIG_TEST_TYPE -#error "Invalid test configuration" -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD -#define INCLUDED_BOARD 1 -#else -#define INCLUDED_BOARD 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_SUFFIX -#define INCLUDED_BOARD_SUFFIX 1 -#else -#define INCLUDED_BOARD_SUFFIX 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_QUALIFIERS -#define INCLUDED_BOARD_QUALIFIERS 1 -#else -#define INCLUDED_BOARD_QUALIFIERS 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_BOARD_OTHER -#define INCLUDED_BOARD_OTHER 1 -#else -#define INCLUDED_BOARD_OTHER 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC -#define INCLUDED_SOC 1 -#else -#define INCLUDED_SOC 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_SUFFIX -#define INCLUDED_SOC_SUFFIX 1 -#else -#define INCLUDED_SOC_SUFFIX 0 -#endif - -#ifdef CONFIG_SOC_FOLDER_TEST_INCLUDE_SOC_OTHER -#define INCLUDED_SOC_OTHER 1 -#else -#define INCLUDED_SOC_OTHER 0 -#endif - -#if CONFIG_TEST_TYPE == 0 -/* Default test */ -ZTEST(soc_folder_kconfig, test_default) -{ - zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix config to be present"); - -#ifdef CONFIG_BOARD_NATIVE_SIM_NATIVE_64 - zassert_false(INCLUDED_BOARD, "Did not expect board config to be present"); - zassert_true(INCLUDED_BOARD_QUALIFIERS, "Expected board qualifier config to be present"); - zassert_mem_equal(STRING_OUTPUT, "five", strlen("five"), "Expected string to match"); -#else - zassert_true(INCLUDED_BOARD, "Expected board config to be present"); - zassert_false(INCLUDED_BOARD_QUALIFIERS, - "Did not expect board qualifier config to be present"); - zassert_mem_equal(STRING_OUTPUT, "two", strlen("two"), "Expected string to match"); -#endif - - zassert_false(INCLUDED_BOARD_OTHER, "Did not expect board other config to be present"); - zassert_true(INCLUDED_SOC, "Expect soc config to be present"); - zassert_false(INCLUDED_SOC_SUFFIX, "Did not expect soc suffix config to be present"); - zassert_false(INCLUDED_SOC_OTHER, "Did not expect soc other config to be present"); -} -#elif CONFIG_TEST_TYPE == 1 -/* File suffix test */ -ZTEST(soc_folder_kconfig, test_suffix) -{ - zassert_true(INCLUDED_BOARD_SUFFIX, "Expected board suffix config to be present"); - - zassert_false(INCLUDED_BOARD, "Did not expect board config to be present"); - zassert_false(INCLUDED_BOARD_QUALIFIERS, - "Did not expect board qualifier config to be present"); - zassert_mem_equal(STRING_OUTPUT, "four", strlen("four"), "Expected string to match"); - zassert_false(INCLUDED_BOARD_OTHER, "Did not expect board other config to be present"); - zassert_false(INCLUDED_SOC, "Did not expect soc config to be present"); - zassert_true(INCLUDED_SOC_SUFFIX, "Expected soc suffix config to be present"); - zassert_false(INCLUDED_SOC_OTHER, "Did not expect soc other config to be present"); -} -#elif CONFIG_TEST_TYPE == 2 -/* Conf file test */ -ZTEST(soc_folder_kconfig, test_conf) -{ - zassert_false(INCLUDED_BOARD_SUFFIX, "Did not expect board suffix config to be present"); - -#ifdef CONFIG_BOARD_NATIVE_SIM_NATIVE_64 - zassert_false(INCLUDED_BOARD, "Did not expect board config to be present"); - zassert_true(INCLUDED_BOARD_QUALIFIERS, - "Expected board qualifier config to be present"); -#else - zassert_true(INCLUDED_BOARD, "Expected board config to be present"); - zassert_false(INCLUDED_BOARD_QUALIFIERS, - "Did not expect board qualifier config to be present"); -#endif - - zassert_mem_equal(STRING_OUTPUT, "three", strlen("three"), "Expected string to match"); - - zassert_true(INCLUDED_BOARD_OTHER, "Expected board other config to be present"); - zassert_true(INCLUDED_SOC, "Expected soc config to be present"); - zassert_false(INCLUDED_SOC_SUFFIX, "Did not expect soc suffix config to be present"); - zassert_false(INCLUDED_SOC_OTHER, "Did not expect soc other config to be present"); -} -#elif CONFIG_TEST_TYPE == 3 -/* File suffix and conf file test */ -ZTEST(soc_folder_kconfig, test_suffix_conf) -{ - zassert_true(INCLUDED_BOARD_SUFFIX, "Expected board suffix config to be present"); - zassert_false(INCLUDED_BOARD, "Did not expect board config to be present"); - zassert_false(INCLUDED_BOARD_QUALIFIERS, - "Did not expect board qualifier config to be present"); - zassert_mem_equal(STRING_OUTPUT, "three", strlen("three"), "Expected string to match"); - zassert_true(INCLUDED_BOARD_OTHER, "Expected board other config to be present"); - zassert_false(INCLUDED_SOC, "Did not expect soc config to be present"); - zassert_true(INCLUDED_SOC_SUFFIX, "Expected soc suffix config to be present"); - zassert_false(INCLUDED_SOC_OTHER, "Did not expect soc other config to be present"); -} -#else -#error "Invalid test type" -#endif - -ZTEST_SUITE(soc_folder_kconfig, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/cmake/overlays/soc_folder_kconfig/testcase.yaml b/tests/cmake/overlays/soc_folder_kconfig/testcase.yaml deleted file mode 100644 index 32b8e5487b3..00000000000 --- a/tests/cmake/overlays/soc_folder_kconfig/testcase.yaml +++ /dev/null @@ -1,26 +0,0 @@ -common: - tags: - - cmake - platform_allow: - - native_sim - - native_sim/native/64 - integration_platforms: - - native_sim - - native_sim/native/64 -tests: - cmake.overlays.soc_folder_kconfig.default: - extra_args: - - CONFIG_TEST_TYPE=0 - cmake.overlays.soc_folder_kconfig.suffix: - extra_args: - - CONFIG_TEST_TYPE=1 - - FILE_SUFFIX=somesuffix - cmake.overlays.soc_folder_kconfig.conf: - extra_args: - - CONFIG_TEST_TYPE=2 - - EXTRA_CONF_FILE=boards/other.conf - cmake.overlays.soc_folder_kconfig.suffix.conf: - extra_args: - - CONFIG_TEST_TYPE=3 - - FILE_SUFFIX=somesuffix - - EXTRA_CONF_FILE=boards/other.conf From c424099b438e787c3153d056da2731578046a0db Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2015/2300] Revert "[nrf fromtree] cmake: modules: configuration_files: Add support for soc overlays" This reverts commit b42c69e229f651f4a154d948fe04f55d5598e704. Signed-off-by: Robert Lubos --- cmake/modules/configuration_files.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/modules/configuration_files.cmake b/cmake/modules/configuration_files.cmake index 2bd843a0d8d..dda142441ed 100644 --- a/cmake/modules/configuration_files.cmake +++ b/cmake/modules/configuration_files.cmake @@ -76,10 +76,9 @@ zephyr_boilerplate_watch(CONF_FILE) zephyr_get(DTC_OVERLAY_FILE SYSBUILD LOCAL) -# If DTC_OVERLAY_FILE is not set by the user, look for SoC and board-specific overlays -# in the 'boards' and `soc` configuration subdirectories. +# If DTC_OVERLAY_FILE is not set by the user, look for board-specific overlays +# in the 'boards' configuration subdirectory. if(NOT DEFINED DTC_OVERLAY_FILE) - zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/socs DTS DTC_OVERLAY_FILE QUALIFIERS SUFFIX ${FILE_SUFFIX}) zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/boards DTS DTC_OVERLAY_FILE SUFFIX ${FILE_SUFFIX}) endif() @@ -92,6 +91,7 @@ if(NOT DEFINED DTC_OVERLAY_FILE) NAMES "app.overlay" SUFFIX ${FILE_SUFFIX} ) endif() + endif() set(DTC_OVERLAY_FILE ${DTC_OVERLAY_FILE} CACHE STRING "If desired, you can \ From 8ecc000366339fc918b5e889a1159fe80b358fe0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2016/2300] Revert "[nrf fromtree] cmake: Add support for socs folder and Kconfig fragments" This reverts commit 22ee8f7133cc83672703c3417257061afe92e360. Signed-off-by: Robert Lubos --- cmake/modules/configuration_files.cmake | 1 - cmake/modules/extensions.cmake | 48 +++++++------------------ 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/cmake/modules/configuration_files.cmake b/cmake/modules/configuration_files.cmake index dda142441ed..78e7bf2a494 100644 --- a/cmake/modules/configuration_files.cmake +++ b/cmake/modules/configuration_files.cmake @@ -45,7 +45,6 @@ endif() zephyr_get(CONF_FILE SYSBUILD LOCAL) if(NOT DEFINED CONF_FILE) zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR} KCONF CONF_FILE NAMES "prj.conf" SUFFIX ${FILE_SUFFIX} REQUIRED) - zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/socs KCONF CONF_FILE QUALIFIERS SUFFIX ${FILE_SUFFIX}) zephyr_file(CONF_FILES ${APPLICATION_CONFIG_DIR}/boards KCONF CONF_FILE SUFFIX ${FILE_SUFFIX}) else() string(CONFIGURE "${CONF_FILE}" CONF_FILE_EXPANDED) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index a4a33ffe137..bfe9bf78b45 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1538,11 +1538,6 @@ endfunction() # [BUILD ] # [MERGE [REVERSE]] # ) -# zephyr_build_string( -# BOARD_QUALIFIERS -# [BUILD ] -# [MERGE [REVERSE]] -# ) # # : Output variable where the build string will be returned. # SHORT : Output variable where the shortened build string will be returned. @@ -1576,10 +1571,6 @@ endfunction() # `alpha_soc_bar_1_0_0;alpha_soc_bar` in `build_string` parameter. # `alpha_bar_1_0_0;alpha_bar` in `short_build_string` parameter. # -# calling -# zephyr_build_string(build_string BOARD_QUALIFIERS /soc/bar/foo) -# will return the string `soc_bar_foo` in `build_string` parameter. -# function(zephyr_build_string outvar) set(options MERGE REVERSE) set(single_args BOARD BOARD_QUALIFIERS BOARD_REVISION BUILD SHORT) @@ -1599,17 +1590,10 @@ function(zephyr_build_string outvar) ) endif() - if(DEFINED BUILD_STR_BOARD_REVISION AND NOT DEFINED BUILD_STR_BOARD) + if(DEFINED BUILD_STR_BOARD_QUALIFIERS AND NOT BUILD_STR_BOARD) message(FATAL_ERROR - "zephyr_build_string(${ARGV0} BOARD_REVISION ${BUILD_STR_BOARD_REVISION} ...)" - " given without BOARD argument, these must be used together" - ) - endif() - - if(DEFINED BUILD_STR_SHORT AND NOT DEFINED BUILD_STR_BOARD) - message(FATAL_ERROR - "zephyr_build_string(${ARGV0} SHORT ${BUILD_STR_SHORT} ...)" - " given without BOARD argument, these must be used together" + "zephyr_build_string(${ARGV0} BOARD_QUALIFIERS ${BUILD_STR_BOARD_QUALIFIERS} ...)" + " given without BOARD argument, please specify BOARD" ) endif() @@ -2588,7 +2572,7 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES") if(${ARGV0} STREQUAL APPLICATION_ROOT) set(single_args APPLICATION_ROOT) elseif(${ARGV0} STREQUAL CONF_FILES) - set(options QUALIFIERS REQUIRED) + set(options REQUIRED) set(single_args BOARD BOARD_REVISION BOARD_QUALIFIERS DTS KCONF DEFCONFIG BUILD SUFFIX) set(multi_args CONF_FILES NAMES) endif() @@ -2657,22 +2641,14 @@ Relative paths are only allowed with `-D${ARGV1}=`") set(dts_filename_list ${ZFILE_NAMES}) set(kconf_filename_list ${ZFILE_NAMES}) else() - if(NOT ZFILE_QUALIFIERS) - zephyr_build_string(filename_list - SHORT shortened_filename_list - BOARD ${ZFILE_BOARD} - BOARD_REVISION ${ZFILE_BOARD_REVISION} - BOARD_QUALIFIERS ${ZFILE_BOARD_QUALIFIERS} - BUILD ${ZFILE_BUILD} - MERGE REVERSE - ) - else() - zephyr_build_string(filename_list - BOARD_QUALIFIERS ${ZFILE_BOARD_QUALIFIERS} - BUILD ${ZFILE_BUILD} - MERGE REVERSE - ) - endif() + zephyr_build_string(filename_list + SHORT shortened_filename_list + BOARD ${ZFILE_BOARD} + BOARD_REVISION ${ZFILE_BOARD_REVISION} + BOARD_QUALIFIERS ${ZFILE_BOARD_QUALIFIERS} + BUILD ${ZFILE_BUILD} + MERGE REVERSE + ) set(dts_filename_list ${filename_list}) set(dts_shortened_filename_list ${shortened_filename_list}) From 9b7fe854004a42365d111fe2b691cae81113eb16 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2017/2300] Revert "[nrf fromtree] cmake: modules: extensions: Fix documentation for zephyr_build_string" This reverts commit 50c9a918bd6ebe8289a8321f05d45250a6d70c2c. Signed-off-by: Robert Lubos --- cmake/modules/extensions.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index bfe9bf78b45..2c1866c422a 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1532,7 +1532,6 @@ endfunction() # Usage: # zephyr_build_string( # BOARD -# [SHORT ] # [BOARD_QUALIFIERS ] # [BOARD_REVISION ] # [BUILD ] @@ -1566,7 +1565,7 @@ endfunction() # `alpha_soc_bar_1_0_0;alpha_soc_bar` in `build_string` parameter. # # calling -# zephyr_build_string(build_string SHORT short_build_string BOARD alpha BOARD_REVISION 1.0.0 BOARD_QUALIFIERS /soc/bar MERGE) +# zephyr_build_string(build_string SHORTENED short_build_string BOARD alpha BOARD_REVISION 1.0.0 BOARD_QUALIFIERS /soc/bar MERGE) # will return two lists of the following strings # `alpha_soc_bar_1_0_0;alpha_soc_bar` in `build_string` parameter. # `alpha_bar_1_0_0;alpha_bar` in `short_build_string` parameter. From b686890a124a68944be50b75c52c95b3382656db Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2018/2300] Revert "[nrf fromtree] scripts: module: Fix sysbuild module listing" This reverts commit d7e52c2a82f80e0f9215790af10a0db5303ba217. Signed-off-by: Robert Lubos --- scripts/zephyr_module.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index b5b257ed712..ab27eaa5706 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -370,15 +370,14 @@ def process_sysbuildkconfig(module, meta): 'not point to a valid Kconfig file.' .format(module_yml, kconfig_setting)) - if kconfig_setting is not None: - kconfig_file = os.path.join(module, kconfig_setting) - if os.path.isfile(kconfig_file): - return kconfig_snippet(meta, module_path, Path(kconfig_file)) + if kconfig_setting is None: + return "" - name_sanitized = meta['name-sanitized'] - return (f'config ZEPHYR_{name_sanitized.upper()}_MODULE\n' - f' bool\n' - f' default y\n') + kconfig_file = os.path.join(module, kconfig_setting) + if os.path.isfile(kconfig_file): + return kconfig_snippet(meta, module_path, Path(kconfig_file)) + else: + return "" def process_twister(module, meta): From 4eac5a37907108bc22b6e8c4ca1e2bac901e03b2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2019/2300] Revert "[nrf fromtree] cmake: boards: Fix missing board name" This reverts commit 137ea1e810dcf50247e1a204b64ca7b0c080e3b2. Signed-off-by: Robert Lubos --- cmake/modules/boards.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/boards.cmake b/cmake/modules/boards.cmake index ec9b6579146..b1e2b21abce 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -319,7 +319,7 @@ elseif(HWMv2) unset(CACHED_BOARD CACHE) message(FATAL_ERROR "Board qualifiers `${BOARD_QUALIFIERS}` for board \ `${BOARD}` not found. Please specify a valid board target.\n" - "Valid board targets for ${LIST_BOARD_NAME} are:\n${board_targets}\n") + "Valid board targets for ${BOARD_NAME} are:\n${board_targets}\n") endif() endif() else() From 65cb03a63b63e65eb5c306190fece97ff2dfa421 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2020/2300] Revert "[nrf noup] boards: nordic: Add PWM support for LEDs on nRF54 DKs" This reverts commit 15cc59d1c2507d330c1eb58c359d3fc681b961a6. Signed-off-by: Robert Lubos --- .../nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi | 13 ------------- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 15 --------------- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 13 ------------- .../nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts | 15 --------------- .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay | 15 --------------- 5 files changed, 71 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi index 0c842057d64..6c6da3fa747 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -50,17 +50,4 @@ ; }; }; - - /omit-if-no-ref/ pwm120_default: pwm120_default { - group1 { - psels = ; - }; - }; - - /omit-if-no-ref/ pwm120_sleep: pwm120_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 5406d113833..f5513a288ab 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -32,7 +32,6 @@ led1 = &led1; led2 = &led2; led3 = &led3; - pwm-led0 = &pwm_led0; sw0 = &button0; sw1 = &button1; sw2 = &button2; @@ -91,13 +90,6 @@ }; }; - pwmleds { - compatible = "pwm-leds"; - pwm_led0: pwm_led_0 { - pwms = <&pwm120 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; - }; - }; - prng: prng { compatible = "nordic,entropy-prng"; status = "okay"; @@ -202,10 +194,3 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-names = "default", "sleep"; hw-flow-control; }; - -&pwm120 { - status = "okay"; - pinctrl-0 = <&pwm120_default>; - pinctrl-1 = <&pwm120_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 89ad7599870..31c2f820f3f 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -64,17 +64,4 @@ low-power-enable; }; }; - - /omit-if-no-ref/ pwm20_default: pwm20_default { - group1 { - psels = ; - }; - }; - - /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; }; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts index 395f92d638c..f64952ba886 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -43,13 +43,6 @@ }; }; - pwmleds { - compatible = "pwm-leds"; - pwm_led1: pwm_led_1 { - pwms = <&pwm20 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; - }; - }; - buttons { compatible = "gpio-keys"; button0: button_0 { @@ -79,7 +72,6 @@ led1 = &led1; led2 = &led2; led3 = &led3; - pwm-led0 = &pwm_led1; watchdog0 = &wdt30; sw0 = &button0; sw1 = &button1; @@ -213,10 +205,3 @@ &adc { status = "okay"; }; - -&pwm20 { - status = "okay"; - pinctrl-0 = <&pwm20_default>; - pinctrl-1 = <&pwm20_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay index 99ba6ff3062..d8262dde994 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.overlay @@ -36,18 +36,3 @@ &button3 { gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; }; - -&pinctrl { - /omit-if-no-ref/ pwm20_default: pwm20_default { - group1 { - psels = ; - }; - }; - - /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; -}; From 04f6af035078f8816be4f74854c42ef2a208fc20 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2021/2300] Revert "[nrf noup] boards: Enable ADC in nRF54L15 PDK configuration" This reverts commit 00bf0097c3a178b2b223fa5c9d3378ae2d96d02f. Signed-off-by: Robert Lubos --- boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts index f64952ba886..e6ef815e783 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -201,7 +201,3 @@ t-exit-dpd = <35000>; }; }; - -&adc { - status = "okay"; -}; From 2488295dee2f5e1db32f432f5c4908a85c6bcdc3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2022/2300] Revert "[nrf noup] boards/nordic/nrf54l15pdk: added mx25r64 flash DTS" This reverts commit b0b3a063009d891c80c7e0448145034c2cd43e6b. Signed-off-by: Robert Lubos --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 17 ------------ .../nrf54l15pdk_nrf54l15_cpuapp.dts | 27 ------------------- 2 files changed, 44 deletions(-) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 31c2f820f3f..96c53f948fc 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -47,21 +47,4 @@ low-power-enable; }; }; - - spi0_default: spi0_default { - group1 { - psels = , - , - ; - }; - }; - - spi0_sleep: spi0_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; }; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts index e6ef815e783..0b9e76ff083 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -77,7 +77,6 @@ sw1 = &button1; sw2 = &button2; sw3 = &button3; - spi-flash0 = &mx25r64; }; }; @@ -175,29 +174,3 @@ &clock { status = "okay"; }; - -&spi00 { - status = "okay"; - cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&spi0_default>; - pinctrl-1 = <&spi0_sleep>; - pinctrl-names = "default", "sleep"; - - mx25r64: mx25r6435f@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - status = "disabled"; - spi-max-frequency = <8000000>; - jedec-id = [c2 28 17]; - sfdp-bfp = [ - e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb - ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 - 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 48 44 - 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff - ]; - size = <67108864>; - has-dpd; - t-enter-dpd = <10000>; - t-exit-dpd = <35000>; - }; -}; From 98d36e5739c7d1595087d237fc1bca423be8ee4c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2023/2300] Revert "[nrf noup] boards: nordic: nrf54l15pdk: enable HWFC" This reverts commit 59220de44c52c2f2772ae7647738dbeafb770af1. Signed-off-by: Robert Lubos --- .../nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi | 22 ++++--------------- .../nrf54l15pdk_nrf54l15_cpuapp.dts | 1 - 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi index 96c53f948fc..02b02bc8171 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp-pinctrl.dtsi @@ -7,21 +7,14 @@ uart20_default: uart20_default { group1 { psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; + ; }; }; uart20_sleep: uart20_sleep { group1 { psels = , - , - , - ; + ; low-power-enable; }; }; @@ -29,21 +22,14 @@ uart30_default: uart30_default { group1 { psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; + ; }; }; uart30_sleep: uart30_sleep { group1 { psels = , - , - , - ; + ; low-power-enable; }; }; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts index 0b9e76ff083..c801ddc8dc5 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -96,7 +96,6 @@ pinctrl-0 = <&uart20_default>; pinctrl-1 = <&uart20_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart30 { From ec188f7fd1db83b1244aa79c66bb8064d7efb8a3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2024/2300] Revert "[nrf noup] boards: add nrf54l15/nrf54l15/cpuapp/ns as board variant" This reverts commit c8cc6634d2bd1c03e150342b7b0568c0eb191c92. Signed-off-by: Robert Lubos --- boards/nordic/nrf54l15pdk/Kconfig | 43 ------ boards/nordic/nrf54l15pdk/Kconfig.defconfig | 18 --- boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk | 2 +- boards/nordic/nrf54l15pdk/board.cmake | 8 -- boards/nordic/nrf54l15pdk/board.yml | 3 - ...rf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi | 38 ----- .../nrf54l15pdk_nrf54l15_cpuapp_ns.dts | 132 ------------------ .../nrf54l15pdk_nrf54l15_cpuapp_ns.yaml | 22 --- .../nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig | 37 ----- 9 files changed, 1 insertion(+), 302 deletions(-) delete mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi delete mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts delete mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml delete mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig diff --git a/boards/nordic/nrf54l15pdk/Kconfig b/boards/nordic/nrf54l15pdk/Kconfig index db822a14820..638ce57499d 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig +++ b/boards/nordic/nrf54l15pdk/Kconfig @@ -11,46 +11,3 @@ config BOARD_ENABLE_DCDC default y endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP - -if BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS - -# TODO: Remove the options bellow when (NCSDK-25023) is done -config NRF_SPU_FLASH_REGION_SIZE - hex - default 0x4000 - # This option does not apply to 54, but we pretend the HW has this limitation - # for now for easier porting. NCSDK-25023 - help - FLASH region size for the NRF_SPU peripheral. For nrf54 the - region size is configurable per-region so this option does - not apply. - -config NRF_SPU_FLASH_REGION_ALIGNMENT - hex - default 0x4000 - # This option does not apply to 54, but we pretend the HW has this limitation - # for now for easier porting. NCSDK-25023 - help - FLASH region size for the NRF_SPU peripheral. For nrf54 the - region size is configurable per-region so this option does - not apply. - -config NRF_SPU_RAM_REGION_SIZE - hex - default 0x2000 - # This HW limitation does not apply to 54, but we pretend - # it does for now for easier porting. NCSDK-25023 - help - RAM region size for the NRF_SPU peripheral. For nrf54 the - region size is configurable per-region so this option does - not apply. - - -config NRF_SPU_RAM_REGION_ALIGNMENT - hex - default 0x1000 - help - RAM regions must be aligned to this value due to SPU HW - limitations. - -endif #BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS diff --git a/boards/nordic/nrf54l15pdk/Kconfig.defconfig b/boards/nordic/nrf54l15pdk/Kconfig.defconfig index 87b8c1d0cc3..6db1005d4df 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15pdk/Kconfig.defconfig @@ -11,21 +11,3 @@ config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP - -if BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS - -config BT_CTLR - default BT - -# By default, if we build for a Non-Secure version of the board, -# enable building with TF-M as the Secure Execution Environment. -config BUILD_WITH_TFM - default y if BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS - -# 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 - default y - depends on BUILD_WITH_TFM - -endif #BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS diff --git a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk index 36ee21a55b6..12f6e2efd48 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk +++ b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk @@ -2,4 +2,4 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF54L15PDK - select SOC_NRF54L15_ENGA_CPUAPP if BOARD_NRF54L15PDK_NRF54L15_CPUAPP || BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS + select SOC_NRF54L15_ENGA_CPUAPP if BOARD_NRF54L15PDK_NRF54L15_CPUAPP diff --git a/boards/nordic/nrf54l15pdk/board.cmake b/boards/nordic/nrf54l15pdk/board.cmake index 5a1e4b3221d..2107fb5d71e 100644 --- a/boards/nordic/nrf54l15pdk/board.cmake +++ b/boards/nordic/nrf54l15pdk/board.cmake @@ -3,14 +3,6 @@ board_runner_args(jlink "--device=cortex-m33" "--speed=4000") -if(BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS) - set(TFM_PUBLIC_KEY_FORMAT "full") -endif() - -if(CONFIG_TFM_FLASH_MERGED_BINARY) - set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex) -endif() - include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/nordic/nrf54l15pdk/board.yml b/boards/nordic/nrf54l15pdk/board.yml index 69b51223209..3b0fc447385 100644 --- a/boards/nordic/nrf54l15pdk/board.yml +++ b/boards/nordic/nrf54l15pdk/board.yml @@ -3,9 +3,6 @@ board: vendor: nordic socs: - name: nrf54l15 - variants: - - name: ns - cpucluster: cpuapp revision: format: major.minor.patch default: "0.2.1" diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi deleted file mode 100644 index b4b924e90ef..00000000000 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -&pinctrl { - uart20_default: uart20_default { - group1 { - psels = , - ; - }; - }; - - uart20_sleep: uart20_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart30_default: uart30_default { - group1 { - psels = , - ; - }; - }; - - uart30_sleep: uart30_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - -}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts deleted file mode 100644 index 49fd1ac0ece..00000000000 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/dts-v1/; -#include -#include "nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi" - -/ { - chosen { - zephyr,console = &uart20; - /* TODO: NCSDK-24862: We don't support configuring RRAM and SRAM - * regions in the DTS file yet. The partition manager configures - * these regions now. - */ - zephyr,shell-uart = &uart20; - zephyr,flash = &rram0; - zephyr,sram = &sram0; - zephyr,ieee802154 = &ieee802154; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - led1: led_1 { - gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - led2: led_2 { - gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; - label = "Green LED 2"; - }; - led3: led_3 { - gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; - label = "Green LED 3"; - }; - }; - - buttons { - compatible = "gpio-keys"; - button0: button_0 { - gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 0"; - zephyr,code = ; - }; - button1: button_1 { - gpios = <&gpio1 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - zephyr,code = ; - }; - button2: button_2 { - gpios = <&gpio2 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - zephyr,code = ; - }; - button3: button_3 { - gpios = <&gpio2 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 3"; - zephyr,code = ; - }; - }; - - aliases { - led0 = &led0; - led1 = &led1; - led2 = &led2; - led3 = &led3; - sw0 = &button0; - sw1 = &button1; - sw2 = &button2; - sw3 = &button3; - }; -}; - -&uart20 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart20_default>; - pinctrl-1 = <&uart20_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart30 { - /* Disable so that TF-M can use this UART */ - status = "disabled"; - - current-speed = <115200>; - pinctrl-0 = <&uart30_default>; - pinctrl-1 = <&uart30_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&grtc { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; - -&temp { - status = "okay"; -}; - -&clock { - status = "okay"; -}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml deleted file mode 100644 index 460803eaa53..00000000000 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -identifier: nrf54l15pdk/nrf54l15/cpuapp/ns -name: nRF54l15-PDK-nRF54l15-Application-Non-Secure -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 256 -flash: 1524 -supported: - - adc - - gpio - - i2c - - spi - - counter - - watchdog - - adc - - i2s diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig deleted file mode 100644 index ec01756bfd4..00000000000 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# This Board implies building Non-Secure firmware -CONFIG_TRUSTED_EXECUTION_NONSECURE=y - -# Don't enable the cache in the non-secure image as it is a -# secure-only peripheral on 54l -CONFIG_CACHE_MANAGEMENT=n -CONFIG_EXTERNAL_CACHE=n - -CONFIG_UART_CONSOLE=y -CONFIG_CONSOLE=y -CONFIG_SERIAL=y - -# Enable GPIO -CONFIG_GPIO=y - -# NCSDK-26634: Rollback protection is not supported yet -CONFIG_TFM_PS_ROLLBACK_PROTECTION=n - -# NCSDK-22600: Built-in keys are not supported yet. -CONFIG_TFM_CRYPTO_BUILTIN_KEYS=n - -# Start SYSCOUNTER on driver init -CONFIG_NRF_GRTC_START_SYSCOUNTER=y From 35fead40146995e7abce94ca8d09744d9e7bdecf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2025/2300] Revert "[nrf noup] entropy: Add fake entropy nRF PRNG driver" This reverts commit e2b6a2d4d387e9d38f59befcdade925663125594. Signed-off-by: Robert Lubos --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 6 -- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 6 -- drivers/entropy/CMakeLists.txt | 7 -- drivers/entropy/Kconfig | 1 - drivers/entropy/Kconfig.nrf_prng | 19 ---- drivers/entropy/fake_entropy_nrf_prng.c | 101 ------------------ dts/bindings/rng/nordic,nrf-prng.yaml | 8 -- 7 files changed, 148 deletions(-) delete mode 100644 drivers/entropy/Kconfig.nrf_prng delete mode 100644 drivers/entropy/fake_entropy_nrf_prng.c delete mode 100644 dts/bindings/rng/nordic,nrf-prng.yaml diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index f5513a288ab..93259180e43 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -24,7 +24,6 @@ zephyr,sram = &cpuapp_data; zephyr,shell-uart = &uart136; zephyr,bt-hci-ipc = &ipc0; - zephyr,entropy = &prng; }; aliases { @@ -89,11 +88,6 @@ label = "Green LED 3"; }; }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; - }; }; &cpuapp_ram0x_region { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index d72aa791091..c0b9c0b47b7 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -25,12 +25,6 @@ zephyr,sram = &cpurad_ram0; zephyr,shell-uart = &uart135; zephyr,bt-hci-ipc = &ipc0; - zephyr,entropy = &prng; - }; - - prng: prng { - compatible = "nordic,entropy-prng"; - status = "okay"; }; }; diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 1ea31981857..c3d37e1461a 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -34,13 +34,6 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE entropy_gecko_se. zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypto.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_NPCX_DRBG entropy_npcx_drbg.c) -if (CONFIG_FAKE_ENTROPY_NRF_PRNG) - zephyr_library_sources(fake_entropy_nrf_prng.c) - - message(WARNING "\nA nRF PRNG is used, which does not produce real random bits." - "This is not secure and should therefore never be used in a product.") -endif() - if (CONFIG_BUILD_WITH_TFM) target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE $/api_ns/interface/include diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index b1479756460..34c020256bf 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -36,7 +36,6 @@ source "drivers/entropy/Kconfig.neorv32" source "drivers/entropy/Kconfig.bt_hci" source "drivers/entropy/Kconfig.psa_crypto" source "drivers/entropy/Kconfig.npcx" -source "drivers/entropy/Kconfig.nrf_prng" config ENTROPY_HAS_DRIVER bool diff --git a/drivers/entropy/Kconfig.nrf_prng b/drivers/entropy/Kconfig.nrf_prng deleted file mode 100644 index e1b1a9ab4fe..00000000000 --- a/drivers/entropy/Kconfig.nrf_prng +++ /dev/null @@ -1,19 +0,0 @@ -# nRF fake entropy prng generator driver configuration - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if ENTROPY_GENERATOR - -config FAKE_ENTROPY_NRF_PRNG - bool "A fake nRF entropy driver" - default y - depends on DT_HAS_NORDIC_ENTROPY_PRNG_ENABLED - depends on SOC_SERIES_NRF54HX - select ENTROPY_HAS_DRIVER - help - This is a super simple PRNG driver that can be used on nRF platforms that - do not have an entropy source. - This is NOT SAFE to use for cryptographic operations! - -endif diff --git a/drivers/entropy/fake_entropy_nrf_prng.c b/drivers/entropy/fake_entropy_nrf_prng.c deleted file mode 100644 index 8624c844405..00000000000 --- a/drivers/entropy/fake_entropy_nrf_prng.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include - -#define DT_DRV_COMPAT nordic_entropy_prng - -/* This file implements a pseudo-RNG - * https://vigna.di.unimi.it/xorshift/xoshiro128plus.c - */ - -static uint32_t s[4]; - -static inline uint32_t rotl(const uint32_t x, int k) -{ - return (x << k) | (x >> (32 - k)); -} - -static uint32_t rng_next(void) -{ - const uint32_t result = rotl(s[0] + s[3], 7) + s[0]; - - const uint32_t t = s[1] << 9; - - s[2] ^= s[0]; - s[3] ^= s[1]; - s[1] ^= s[2]; - s[0] ^= s[3]; - - s[2] ^= t; - - s[3] = rotl(s[3], 11); - - return result; -} - -static int entropy_prng_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length) -{ - ARG_UNUSED(dev); - - while (length) { - /* - * Note that only 1 thread (Zephyr thread or HW models), runs at - * a time, therefore there is no need to use random_r() - */ - uint32_t value = rng_next(); - - size_t to_copy = MIN(length, sizeof(long)); - - memcpy(buffer, &value, to_copy); - buffer += to_copy; - length -= to_copy; - } - - return 0; -} - -static int entropy_prng_get_entropy_isr(const struct device *dev, uint8_t *buf, uint16_t len, - uint32_t flags) -{ - ARG_UNUSED(flags); - - int err; - - /* - * entropy_prng_get_entropy() is also safe for ISRs - * and always produces data. - */ - err = entropy_prng_get_entropy(dev, buf, len); - if (err < 0) { - return err; - } else { - return len; - } -} - -static int entropy_prng_init(const struct device *dev) -{ - ARG_UNUSED(dev); - - /* Picked some arbitrary initial seed. */ - s[0] = 0xAF568BC0; - s[1] = 0xAC34307E; - s[2] = 0x9B7F6DD1; - s[3] = 0xD84319FC; - return 0; -} - -static const struct entropy_driver_api entropy_prng_api_funcs = { - .get_entropy = entropy_prng_get_entropy, .get_entropy_isr = entropy_prng_get_entropy_isr}; - -DEVICE_DT_INST_DEFINE(0, entropy_prng_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prng_api_funcs); diff --git a/dts/bindings/rng/nordic,nrf-prng.yaml b/dts/bindings/rng/nordic,nrf-prng.yaml deleted file mode 100644 index 8936393a0b6..00000000000 --- a/dts/bindings/rng/nordic,nrf-prng.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -description: This is a super simple PRNG - -compatible: "nordic,entropy-prng" - -include: base.yaml From 26ceb9fe150cb9b66a7e553f9963011373931bc7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2026/2300] Revert "[nrf noup] tree-wide: support NCS Partition Manager (PM) definitions" This reverts commit 91b6032820a140a6722f0838544f55d69b99a3e1. Signed-off-by: Robert Lubos --- arch/arm/core/mpu/arm_mpu_regions.c | 13 ------ cmake/modules/kernel.cmake | 4 -- drivers/flash/soc_flash_nrf.c | 11 ----- .../arch/arm/cortex_m/scripts/linker.ld | 46 ------------------- include/zephyr/storage/flash_map.h | 6 --- lib/heap/Kconfig | 2 +- lib/libc/common/source/stdlib/malloc.c | 18 +------- subsys/fs/littlefs_fs.c | 7 +-- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 ----------- 9 files changed, 4 insertions(+), 130 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index cfe1230c907..6af62f84078 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,9 +8,6 @@ #include #include -#if USE_PARTITION_MANAGER -#include -#endif static const struct arm_mpu_region mpu_regions[] = { /* Region 0 */ @@ -24,14 +21,6 @@ static const struct arm_mpu_region mpu_regions[] = { #endif /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", -#if USE_PARTITION_MANAGER - PM_SRAM_ADDRESS, -#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) - REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), -#else - REGION_RAM_ATTR(REGION_SRAM_SIZE)), -#endif -#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -39,8 +28,6 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif - -#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index 06e1642f362..a093d46691f 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -243,7 +243,3 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() - -if(ZEPHYR_NRF_MODULE_DIR) - include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) -endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index b5a3fefa1e5..cc840309264 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,11 +37,6 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER -#include -#include -#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ - #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -171,12 +166,6 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif -#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS - if (addr < PM_APP_ADDRESS) { - return soc_secure_mem_read(data, (void *)addr, len); - } -#endif - nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 14eb78f3e70..d061468d2ac 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -26,35 +26,6 @@ #endif #define RAMABLE_REGION RAM -#if USE_PARTITION_MANAGER - -#include - -#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) -/* We are linking against S1, create symbol containing the flash ID of S0. - * This is used when writing code operating on the "other" slot. - */ -_image_1_primary_slot_id = PM_S0_ID; - -#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ - -#ifdef PM_S1_ID -/* We are linking against S0, create symbol containing the flash ID of S1. - * This is used when writing code operating on the "other" slot. - */ -_image_1_primary_slot_id = PM_S1_ID; -#endif /* PM_S1_ID */ - -#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ - -#define ROM_ADDR PM_ADDRESS -#define ROM_SIZE PM_SIZE - -#define RAM_SIZE PM_SRAM_SIZE -#define RAM_ADDR PM_SRAM_ADDRESS - -#else /* ! USE_PARTITION_MANAGER */ - #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -87,23 +58,6 @@ _image_1_primary_slot_id = PM_S1_ID; #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS #endif -#endif /* USE_PARTITION_MANAGER */ - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) -#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) -#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) -#endif - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) -#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) -#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) -#endif - -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) -#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) -#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) -#endif - #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index c53cbef8957..37b7c7f3223 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -273,10 +273,6 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); -#if USE_PARTITION_MANAGER -#include -#else - /** * Returns non-0 value if fixed-partition of given DTS node label exists. * @@ -334,8 +330,6 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_DEVICE(label) \ DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label))) -#endif /* USE_PARTITION_MANAGER */ - #ifdef __cplusplus } #endif diff --git a/lib/heap/Kconfig b/lib/heap/Kconfig index 68476eb735c..7f01b280b3b 100644 --- a/lib/heap/Kconfig +++ b/lib/heap/Kconfig @@ -68,7 +68,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index 2f469d673e4..e3a5db6f7d5 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,20 +25,6 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); -#if USE_PARTITION_MANAGER - -#include - -#define RAM_SIZE PM_SRAM_SIZE -#define RAM_ADDR PM_SRAM_ADDRESS - -#else /* ! USE_PARTITION_MANAGER */ - -#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) -#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS - -#endif /* USE_PARTITION_MANAGER */ - #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -120,8 +106,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ - ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ + ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index 3fc84c2922d..b373ca92ba8 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1054,12 +1054,7 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *) \ - COND_CODE_1(USE_PARTITION_MANAGER, \ - (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ - (FIXED_PARTITION_ID(littlefs_storage)), \ - (FIXED_PARTITION_ID(storage)))), \ - (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ + .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index 9996e1d74d9..a74e46b8520 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,35 +13,8 @@ extern "C" { #endif -#if CONFIG_PARTITION_MANAGER_ENABLED - -#include "pm_config.h" - -#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) - -#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) -#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS -#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE -#else -/* The current image is a child image in a different domain than the image - * which defined the required values. To reach the values of the parent domain - * we use the 'PM__' variant of the define. - */ -#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS -#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE -#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ - -#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) -#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ - -#else - -#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) -#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) - -#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From 1e0f028c1ee7e9071cf415e47b4a9521ad481a98 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:17 +0200 Subject: [PATCH 2027/2300] Revert "[nrf fromtree] tests: drivers: uart: uart_elementary: Fix 'config_mismatch' test case" This reverts commit 2e73c44e405972528b8dfd4c6c37f44e047398b0. Signed-off-by: Robert Lubos --- tests/drivers/uart/uart_elementary/src/main.c | 15 +++++++-------- tests/drivers/uart/uart_elementary/testcase.yaml | 8 -------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index df8c7b54b10..1c4df3273a7 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -40,7 +40,6 @@ static volatile uint8_t uart_error_counter; static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; static volatile uint8_t aux_uart_error; -static volatile uint8_t aux_uart_error_counter; #endif /* @@ -111,9 +110,12 @@ static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, vo uart_irq_update(dev); err = uart_err_check(dev); - if (err != 0) { - aux_uart_error_counter++; - } +#if !defined(CONFIG_COVERAGE) + /* This assetion will fail with coverge enabled + * When in coverage mode it has no impact on test case execution + */ + zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); +#endif /* CONFIG_COVERAGE */ while (uart_irq_is_pending(dev)) { if (uart_irq_rx_ready(dev)) { uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); @@ -288,10 +290,7 @@ ZTEST(uart_elementary, test_uart_dual_port_transmission) uart_irq_err_disable(uart_dev_aux); #if defined(CONFIG_SETUP_MISMATCH_TEST) - TC_PRINT("Mismatched configuration test\n"); - zassert_not_equal(uart_error_counter + aux_uart_error_counter, 0, - "UART configuration mismatch error not detected"); - + zassert_not_equal(uart_error_counter, 0); #else for (int index = 0; index < TEST_BUFFER_LEN; index++) { zassert_equal(test_buffer[index], test_pattern[index], diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml index d8aa90d0536..7c06967e7ad 100644 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ b/tests/drivers/uart/uart_elementary/testcase.yaml @@ -33,11 +33,3 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" extra_configs: - CONFIG_DUAL_UART_TEST=y - drivers.uart.uart_elementary_dual_setup_mismatch_nrf54l: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54l15pdk/nrf54l15/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - - CONFIG_SETUP_MISMATCH_TEST=y From 49e06c3a0f4ee16c89fd74482304ca604631fe8f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2028/2300] Revert "[nrf fromtree] mcumgr/img_mgmt: Fix zcbor logic in os_mgmt_bootloader_info" This reverts commit 56e3a0abf4376831b1c0e0aa933eb794d154b8b6. Signed-off-by: Robert Lubos --- subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 9fc02f81661..29e222d1de9 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -469,9 +469,9 @@ os_mgmt_bootloader_info(struct smp_streamer *ctxt) ok = zcbor_tstr_put_lit(zse, "mode") && zcbor_int32_put(zse, BOOTLOADER_MODE); -#ifdef CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE - ok = ok && zcbor_tstr_put_lit(zse, "no-downgrade") && - zcbor_bool_encode(zse, &(bool){true}); +#if IS_ENABLED(CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE) + ok = zcbor_tstr_put_lit(zse, "no-downgrade") && + zcbor_bool_encode(zse, true); #endif } else { return OS_MGMT_ERR_QUERY_YIELDS_NO_ANSWER; From 3b69635517d8d58777ae98b6a76c25128ade3875 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2029/2300] Revert "[nrf fromtree] tests: drivers: spi: Add negative test cases" This reverts commit 7ad93e14a3375bab75c75f3e79655d8f83fabc84. Signed-off-by: Robert Lubos --- .../spi/spi_error_cases/CMakeLists.txt | 10 - .../boards/nrf52840dk_nrf52840.overlay | 72 ----- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 78 ------ tests/drivers/spi/spi_error_cases/prj.conf | 7 - tests/drivers/spi/spi_error_cases/src/main.c | 263 ------------------ .../drivers/spi/spi_error_cases/testcase.yaml | 12 - 6 files changed, 442 deletions(-) delete mode 100644 tests/drivers/spi/spi_error_cases/CMakeLists.txt delete mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay delete mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_error_cases/prj.conf delete mode 100644 tests/drivers/spi/spi_error_cases/src/main.c delete mode 100644 tests/drivers/spi/spi_error_cases/testcase.yaml diff --git a/tests/drivers/spi/spi_error_cases/CMakeLists.txt b/tests/drivers/spi/spi_error_cases/CMakeLists.txt deleted file mode 100644 index 2ac4bdbef4d..00000000000 --- a/tests/drivers/spi/spi_error_cases/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(spi_error_cases) - -FILE(GLOB app_sources src/*.c) - -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 183d6da9967..00000000000 --- a/tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi3_default_alt: spi3_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi3_sleep_alt: spi3_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi1_sleep_alt: spi1_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -dut_spi: &spi3 { - status = "okay"; - pinctrl-0 = <&spi3_default_alt>; - pinctrl-1 = <&spi3_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <200000>; - }; -}; - -dut_spis: &spi1 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-1 = <&spi1_sleep_alt>; - pinctrl-names = "default", "sleep"; - dut_spis_dt: test-spis-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <200000>; - }; -}; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index 2a0394c3f60..00000000000 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi22_default_alt: spi22_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi22_sleep_alt: spi22_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi21_default_alt: spi21_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi21_sleep_alt: spi21_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -&gpio2 { - status = "okay"; -}; - -dut_spi: &spi22 { - status = "okay"; - pinctrl-0 = <&spi22_default_alt>; - pinctrl-1 = <&spi22_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <200000>; - }; -}; - -dut_spis: &spi21 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi21_default_alt>; - pinctrl-1 = <&spi21_sleep_alt>; - pinctrl-names = "default", "sleep"; - dut_spis_dt: test-spis-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <200000>; - }; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; diff --git a/tests/drivers/spi/spi_error_cases/prj.conf b/tests/drivers/spi/spi_error_cases/prj.conf deleted file mode 100644 index 1161e03f477..00000000000 --- a/tests/drivers/spi/spi_error_cases/prj.conf +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG_SPI=y -CONFIG_SPI_SLAVE=y -CONFIG_GPIO=y -CONFIG_POLL=y -CONFIG_SPI_ASYNC=y -CONFIG_SPI_EXTENDED_MODES=y -CONFIG_ZTEST=y diff --git a/tests/drivers/spi/spi_error_cases/src/main.c b/tests/drivers/spi/spi_error_cases/src/main.c deleted file mode 100644 index 0b44812db84..00000000000 --- a/tests/drivers/spi/spi_error_cases/src/main.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -#define SPI_MODE (SPI_MODE_CPOL | SPI_WORD_SET(8) | SPI_LINES_SINGLE) -#define SPIM_OP (SPI_OP_MODE_MASTER | SPI_MODE) -#define SPIS_OP (SPI_OP_MODE_SLAVE | SPI_MODE) - -static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); -static struct spi_dt_spec spis = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spis_dt), SPIS_OP, 0); - -#define MEMORY_SECTION(node) \ - COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ - (__attribute__((__section__( \ - LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ - ()) - -static uint8_t spim_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spi)); -static uint8_t spis_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spis)); - -struct test_data { - int spim_alloc_idx; - int spis_alloc_idx; - struct spi_buf_set sets[4]; - struct spi_buf_set *mtx_set; - struct spi_buf_set *mrx_set; - struct spi_buf_set *stx_set; - struct spi_buf_set *srx_set; - struct spi_buf bufs[4]; -}; - -static struct test_data tdata; - -/* Allocate buffer from spim or spis space. */ -static uint8_t *buf_alloc(size_t len, bool spim) -{ - int *idx = spim ? &tdata.spim_alloc_idx : &tdata.spis_alloc_idx; - uint8_t *buf = spim ? spim_buffer : spis_buffer; - size_t total = spim ? sizeof(spim_buffer) : sizeof(spis_buffer); - uint8_t *rv; - - if (*idx + len > total) { - zassert_false(true); - - return NULL; - } - - rv = &buf[*idx]; - *idx += len; - - return rv; -} - -ZTEST(spi_error_cases, test_SPI_HALF_DUPLEX_not_supported) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_HALF_DUPLEX; - spis_invalid.config.operation |= SPI_HALF_DUPLEX; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -ENOTSUP, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_SPI_OP_MODE_invalid) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_OP_MODE_SLAVE; - spis_invalid.config.operation &= !SPI_OP_MODE_SLAVE; - - /* Check that Operation Mode Slave on spim is not supported */ - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - /* Check that Operation Mode Master on spis is not supported */ - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_SPI_MODE_LOOP_not_supported) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_MODE_LOOP; - spis_invalid.config.operation |= SPI_MODE_LOOP; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_only_SPI_LINES_SINGLE_supported) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_LINES_DUAL; - spis_invalid.config.operation |= SPI_LINES_DUAL; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); - - spim_invalid = spim; - spis_invalid = spis; - spim_invalid.config.operation |= SPI_LINES_QUAD; - spis_invalid.config.operation |= SPI_LINES_QUAD; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); - - spim_invalid = spim; - spis_invalid = spis; - spim_invalid.config.operation |= SPI_LINES_OCTAL; - spis_invalid.config.operation |= SPI_LINES_OCTAL; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_only_8BIT_supported) -{ - int rv; - int slave_rv; - struct spi_dt_spec spim_invalid = spim; - struct spi_dt_spec spis_invalid = spis; - - spim_invalid.config.operation |= SPI_WORD_SET(16); - spis_invalid.config.operation |= SPI_WORD_SET(16); - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_unsupported_frequency) -{ - int rv; - struct spi_dt_spec spim_invalid = spim; - - spim_invalid.config.frequency = 124999; - - rv = spi_transceive_dt(&spim_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(rv, -EINVAL, "Got %d instead", rv); -} - -ZTEST(spi_error_cases, test_CS_unsupported_on_slave) -{ - int slave_rv; - struct spi_dt_spec spis_invalid = spis; - struct gpio_dt_spec test_gpio = { DEVICE_DT_GET(DT_NODELABEL(gpio1)), 10, GPIO_ACTIVE_LOW }; - - spis_invalid.config.cs.gpio = test_gpio; - - slave_rv = spi_transceive_dt(&spis_invalid, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_scattered_tx_buf_not_supported) -{ - int slave_rv; - - tdata.sets[2].count = 2; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_scattered_rx_buf_not_supported) -{ - int slave_rv; - - tdata.sets[3].count = 2; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_tx_buf_too_big) -{ - int slave_rv; - - tdata.bufs[2].len = (size_t)65536; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_rx_buf_too_big) -{ - int slave_rv; - - tdata.bufs[3].len = (size_t)65536; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv); -} - -ZTEST(spi_error_cases, test_spis_tx_buf_not_in_ram) -{ - int slave_rv; - - tdata.bufs[2].buf = (void *)0x12345678; - slave_rv = spi_transceive_dt(&spis, tdata.stx_set, tdata.srx_set); - zassert_equal(slave_rv, -ENOTSUP, "Got %d instead", slave_rv); -} - -static void before(void *not_used) -{ - ARG_UNUSED(not_used); - size_t len = 16; - - memset(&tdata, 0, sizeof(tdata)); - for (size_t i = 0; i < sizeof(spim_buffer); i++) { - spim_buffer[i] = (uint8_t)i; - } - for (size_t i = 0; i < sizeof(spis_buffer); i++) { - spis_buffer[i] = (uint8_t)i; - } - - for (int i = 0; i < 4; i++) { - tdata.bufs[i].buf = buf_alloc(len, i < 2); - tdata.bufs[i].len = len; - tdata.sets[i].buffers = &tdata.bufs[i]; - tdata.sets[i].count = 1; - } - - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = &tdata.sets[1]; - tdata.stx_set = &tdata.sets[2]; - tdata.srx_set = &tdata.sets[3]; -} - -static void *suite_setup(void) -{ - return NULL; -} - -ZTEST_SUITE(spi_error_cases, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml deleted file mode 100644 index 9c7e40167e7..00000000000 --- a/tests/drivers/spi/spi_error_cases/testcase.yaml +++ /dev/null @@ -1,12 +0,0 @@ -tests: - drivers.spi.spi_error_cases: - depends_on: spi - tags: drivers spi - harness: ztest - harness_config: - fixture: gpio_spi_loopback - platform_allow: - - nrf52840dk/nrf52840 - - nrf54l15pdk/nrf54l15/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 From 44a8f694f724e8b8e2e455ae66beb249d27a7c98 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2030/2300] Revert "[nrf fromtree] soc: nordic: Fix undefined z_arm_platform_init" This reverts commit 0b1ebb5e018ef7829582eebc815d9eea35e58263. Signed-off-by: Robert Lubos --- soc/nordic/CMakeLists.txt | 4 +--- soc/nordic/common/CMakeLists.txt | 2 -- soc/nordic/common/vpr/CMakeLists.txt | 2 -- soc/nordic/{common/arm_platform_init.ld => linker.ld} | 11 +++++++++++ 4 files changed, 12 insertions(+), 7 deletions(-) rename soc/nordic/{common/arm_platform_init.ld => linker.ld} (52%) diff --git a/soc/nordic/CMakeLists.txt b/soc/nordic/CMakeLists.txt index 9797d2e717a..6dae6e97fb2 100644 --- a/soc/nordic/CMakeLists.txt +++ b/soc/nordic/CMakeLists.txt @@ -2,9 +2,7 @@ zephyr_library() -if(CONFIG_ARM) - set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "SoC Linker script") -endif() +set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "SoC Linker script") zephyr_library_sources( validate_base_addresses.c diff --git a/soc/nordic/common/CMakeLists.txt b/soc/nordic/common/CMakeLists.txt index 805113f53d6..b574cafc0c7 100644 --- a/soc/nordic/common/CMakeLists.txt +++ b/soc/nordic/common/CMakeLists.txt @@ -3,8 +3,6 @@ add_subdirectory_ifdef(CONFIG_RISCV_CORE_NORDIC_VPR vpr) -zephyr_linker_sources_ifdef(CONFIG_ARM SECTIONS arm_platform_init.ld) - zephyr_library_sources_ifdef(CONFIG_POWEROFF poweroff.c) zephyr_include_directories(.) diff --git a/soc/nordic/common/vpr/CMakeLists.txt b/soc/nordic/common/vpr/CMakeLists.txt index d418954eebc..3849a3fdc94 100644 --- a/soc/nordic/common/vpr/CMakeLists.txt +++ b/soc/nordic/common/vpr/CMakeLists.txt @@ -4,5 +4,3 @@ zephyr_include_directories(.) zephyr_library_sources(soc_idle.c soc_irq.S soc_irq.c vector.S) - -set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "") diff --git a/soc/nordic/common/arm_platform_init.ld b/soc/nordic/linker.ld similarity index 52% rename from soc/nordic/common/arm_platform_init.ld rename to soc/nordic/linker.ld index 9773ada3dcf..c8dbb426592 100644 --- a/soc/nordic/common/arm_platform_init.ld +++ b/soc/nordic/linker.ld @@ -4,5 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ +#if defined(CONFIG_ARM) +#include + /* Let SystemInit() be called in place of z_arm_platform_init() by default. */ PROVIDE(z_arm_platform_init = SystemInit); + +#elif defined(CONFIG_RISCV) +#include + +#else +#error Unsupported architecture + +#endif From fe26d604a09a9fc7c01ecc02986dfd5e38197c0b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2031/2300] Revert "[nrf fromtree] tests: boards: nrf: add i2c driver test with TWIS slave" This reverts commit 0301be3da47b8ec638e3851ef78a07208729df51. Signed-off-by: Robert Lubos --- tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt | 10 -- .../i2c_slave/boards/nrf52840dk_nrf52840.conf | 1 - .../boards/nrf52840dk_nrf52840.overlay | 60 -------- .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 - .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 58 ------- .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 63 -------- .../boards/nrf54l15pdk_nrf54l15_cpuapp.conf | 1 - .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 59 ------- tests/boards/nrf/i2c/i2c_slave/prj.conf | 2 - tests/boards/nrf/i2c/i2c_slave/src/main.c | 145 ------------------ tests/boards/nrf/i2c/i2c_slave/testcase.yaml | 12 -- 12 files changed, 413 deletions(-) delete mode 100644 tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/boards/nrf/i2c/i2c_slave/prj.conf delete mode 100644 tests/boards/nrf/i2c/i2c_slave/src/main.c delete mode 100644 tests/boards/nrf/i2c/i2c_slave/testcase.yaml diff --git a/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt b/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt deleted file mode 100644 index 43130d6a07d..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(i2c_slave) - -FILE(GLOB app_sources src/*.c) - -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index e79ad7a8126..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS1=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 8628731faf4..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,60 +0,0 @@ -/ { - aliases { - i2c-slave = &i2c1; - }; -}; - -&pinctrl { - i2c0_default_alt: i2c0_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c0_sleep_alt: i2c0_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c1_default_alt: i2c1_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c1_sleep_alt: i2c1_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c0 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c0_default_alt>; - pinctrl-1 = <&i2c0_sleep_alt>; - pinctrl-names = "default", "sleep"; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - - -&i2c1 { - compatible = "nordic,nrf-twis"; - status = "okay"; - pinctrl-0 = <&i2c1_default_alt>; - pinctrl-1 = <&i2c1_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index a7bedf1f04b..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS2=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index d473a04f85c..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,58 +0,0 @@ -/ { - aliases { - i2c-slave = &i2c2; - }; -}; - -&pinctrl { - i2c1_default_alt: i2c1_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c1_sleep_alt: i2c1_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c2_default_alt: i2c2_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c2_sleep_alt: i2c2_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c1 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c1_default_alt>; - pinctrl-1 = <&i2c1_sleep_alt>; - pinctrl-names = "default", "sleep"; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - -&i2c2 { - compatible = "nordic,nrf-twis"; - pinctrl-0 = <&i2c2_default_alt>; - pinctrl-1 = <&i2c2_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf deleted file mode 100644 index 157e0a11f72..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS131=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 73d1d85cf45..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,63 +0,0 @@ -/ { - aliases { - i2c-slave = &i2c131; - }; -}; - -&pinctrl { - i2c130_default_alt: i2c130_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c130_sleep_alt: i2c130_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c131_default_alt: i2c131_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c131_sleep_alt: i2c131_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c130 { - compatible = "nordic,nrf-twim"; - status = "okay"; - clock-frequency = ; - pinctrl-0 = <&i2c130_default_alt>; - pinctrl-1 = <&i2c130_sleep_alt>; - pinctrl-names = "default", "sleep"; - memory-regions = <&cpuapp_dma_region>; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - -&i2c131 { - compatible = "nordic,nrf-twis"; - status = "okay"; - clock-frequency = ; - pinctrl-0 = <&i2c131_default_alt>; - pinctrl-1 = <&i2c131_sleep_alt>; - pinctrl-names = "default", "sleep"; - memory-regions = <&cpuapp_dma_region>; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf deleted file mode 100644 index b01af3b36a7..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NRFX_TWIS22=y diff --git a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index d60e42659ee..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,59 +0,0 @@ -/ { - aliases { - i2c-slave = &i2c22; - }; -}; - -&pinctrl { - i2c21_default_alt: i2c21_default_alt { - group1 { - psels = , - ; - }; - }; - - i2c21_sleep_alt: i2c21_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - i2c22_default_alt: i2c22_default_alt { - group1 { -/* Temporary workaround as it is currently not possible - * to configure pins for TWIS with pinctrl. */ - psels = , - ; - bias-pull-up; - }; - }; - - i2c22_sleep_alt: i2c22_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -&i2c21 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c21_default_alt>; - pinctrl-1 = <&i2c21_sleep_alt>; - pinctrl-names = "default", "sleep"; - sensor: sensor@54 { - reg = <0x54>; - }; -}; - -&i2c22 { - compatible = "nordic,nrf-twis"; - status = "okay"; - pinctrl-0 = <&i2c22_default_alt>; - pinctrl-1 = <&i2c22_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/boards/nrf/i2c/i2c_slave/prj.conf b/tests/boards/nrf/i2c/i2c_slave/prj.conf deleted file mode 100644 index 4b19609ecfb..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/prj.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_I2C=y -CONFIG_ZTEST=y diff --git a/tests/boards/nrf/i2c/i2c_slave/src/main.c b/tests/boards/nrf/i2c/i2c_slave/src/main.c deleted file mode 100644 index 1de4b16bc2c..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/src/main.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include - -#if CONFIG_NRFX_TWIS1 -#define I2C_S_INSTANCE 1 -#elif CONFIG_NRFX_TWIS2 -#define I2C_S_INSTANCE 2 -#elif CONFIG_NRFX_TWIS22 -#define I2C_S_INSTANCE 22 -#elif CONFIG_NRFX_TWIS131 -#define I2C_S_INSTANCE 131 -#else -#error "TWIS instance not enabled or not supported" -#endif - -#define NODE_SENSOR DT_NODELABEL(sensor) -#define NODE_TWIS DT_ALIAS(i2c_slave) - -#define TWIS_MEMORY_SECTION \ - COND_CODE_1(DT_NODE_HAS_PROP(NODE_TWIS, memory_regions), \ - (__attribute__((__section__( \ - LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(NODE_TWIS, memory_regions)))))), \ - ()) - -#define TEST_DATA_SIZE 6 -static const uint8_t msg[TEST_DATA_SIZE] = "Nordic"; -static const nrfx_twis_t twis = NRFX_TWIS_INSTANCE(I2C_S_INSTANCE); - -static uint8_t i2c_slave_buffer[TEST_DATA_SIZE] TWIS_MEMORY_SECTION; -static uint8_t i2c_master_buffer[TEST_DATA_SIZE]; -struct i2c_api_twis_fixture { - const struct device *dev; - uint8_t addr; - uint8_t *const master_buffer; - uint8_t *const slave_buffer; -}; - -void i2s_slave_handler(nrfx_twis_evt_t const *p_event) -{ - switch (p_event->type) { - case NRFX_TWIS_EVT_READ_REQ: - nrfx_twis_tx_prepare(&twis, i2c_slave_buffer, TEST_DATA_SIZE); - TC_PRINT("TWIS event: read request\n"); - break; - case NRFX_TWIS_EVT_READ_DONE: - TC_PRINT("TWIS event: read done\n"); - break; - case NRFX_TWIS_EVT_WRITE_REQ: - nrfx_twis_rx_prepare(&twis, i2c_slave_buffer, TEST_DATA_SIZE); - TC_PRINT("TWIS event: write request\n"); - break; - case NRFX_TWIS_EVT_WRITE_DONE: - zassert_mem_equal(i2c_slave_buffer, msg, TEST_DATA_SIZE); - TC_PRINT("TWIS event: write done\n"); - break; - default: - TC_PRINT("TWIS event: %d\n", p_event->type); - break; - } -} - -static void *test_setup(void) -{ - static struct i2c_api_twis_fixture fixture = { - .dev = DEVICE_DT_GET(DT_BUS(NODE_SENSOR)), - .addr = DT_REG_ADDR(NODE_SENSOR), - .master_buffer = i2c_master_buffer, - .slave_buffer = i2c_slave_buffer, - }; - const nrfx_twis_config_t config = { - .addr = {fixture.addr, 0}, - .skip_gpio_cfg = true, - .skip_psel_cfg = true, - }; - int ret; - - zassert_equal(NRFX_SUCCESS, nrfx_twis_init(&twis, &config, i2s_slave_handler), - "TWIS initialization failed"); - - PINCTRL_DT_DEFINE(NODE_TWIS); - ret = pinctrl_apply_state(PINCTRL_DT_DEV_CONFIG_GET(NODE_TWIS), PINCTRL_STATE_DEFAULT); - zassert_ok(ret); - - IRQ_CONNECT(DT_IRQN(NODE_TWIS), DT_IRQ(NODE_TWIS, priority), - NRFX_TWIS_INST_HANDLER_GET(I2C_S_INSTANCE), NULL, 0); - - nrfx_twis_enable(&twis); - - return &fixture; -} - -static void cleanup_buffers(void *argc) -{ - struct i2c_api_twis_fixture *fixture = (struct i2c_api_twis_fixture *)argc; - - memset(fixture->slave_buffer, 0, TEST_DATA_SIZE); - memset(fixture->master_buffer, 0, TEST_DATA_SIZE); -} - -ZTEST_USER_F(i2c_api_twis, test_i2c_read_write) -{ - int ret = i2c_write_read(fixture->dev, fixture->addr, msg, TEST_DATA_SIZE, - fixture->master_buffer, TEST_DATA_SIZE); - - zassert_ok(ret); - zassert_mem_equal(fixture->master_buffer, msg, TEST_DATA_SIZE); -} - -ZTEST_USER_F(i2c_api_twis, test_i2c_read) -{ - /* Prepare slave data */ - strncpy(fixture->slave_buffer, msg, TEST_DATA_SIZE); - zassert_mem_equal(fixture->slave_buffer, msg, TEST_DATA_SIZE); - - int ret = i2c_read(fixture->dev, fixture->master_buffer, TEST_DATA_SIZE, fixture->addr); - - zassert_ok(ret); - zassert_mem_equal(fixture->master_buffer, msg, TEST_DATA_SIZE); -} - -ZTEST_USER_F(i2c_api_twis, test_i2c_write) -{ - int ret = i2c_write(fixture->dev, msg, TEST_DATA_SIZE, fixture->addr); - - zassert_ok(ret); - zassert_mem_equal(fixture->slave_buffer, msg, TEST_DATA_SIZE); -} - -ZTEST_SUITE(i2c_api_twis, NULL, test_setup, NULL, cleanup_buffers, NULL); diff --git a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml b/tests/boards/nrf/i2c/i2c_slave/testcase.yaml deleted file mode 100644 index 1309b60146e..00000000000 --- a/tests/boards/nrf/i2c/i2c_slave/testcase.yaml +++ /dev/null @@ -1,12 +0,0 @@ -tests: - boards.nrf.i2c.i2c_slave: - depends_on: i2c - tags: drivers i2c - harness: ztest - harness_config: - fixture: i2c_loopback - platform_allow: nrf52840dk/nrf52840 nrf5340dk/nrf5340/cpuapp nrf54l15pdk/nrf54l15/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15pdk/nrf54l15/cpuapp From e56069e107b339769a8ed887ee08d06c89e15457 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2032/2300] Revert "[nrf fromtree] soc: nordic: add nRF54 TWIS HAS_HW symbols" This reverts commit ab8d66dd12917eb4d2e757f6bdb8b44bed5e556d. Signed-off-by: Robert Lubos --- soc/nordic/common/Kconfig.peripherals | 36 --------------------------- 1 file changed, 36 deletions(-) diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index f0adc82d44a..817002f7282 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -530,42 +530,6 @@ config HAS_HW_NRF_TWIS2 config HAS_HW_NRF_TWIS3 def_bool $(dt_nodelabel_enabled_with_compat,i2c3,$(DT_COMPAT_NORDIC_NRF_TWIS)) -config HAS_HW_NRF_TWIS20 - def_bool $(dt_nodelabel_enabled_with_compat,i2c20,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS21 - def_bool $(dt_nodelabel_enabled_with_compat,i2c21,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS22 - def_bool $(dt_nodelabel_enabled_with_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS30 - def_bool $(dt_nodelabel_enabled_with_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS130 - def_bool $(dt_nodelabel_enabled_with_compat,i2c130,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS131 - def_bool $(dt_nodelabel_enabled_with_compat,i2c131,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS132 - def_bool $(dt_nodelabel_enabled_with_compat,i2c132,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS133 - def_bool $(dt_nodelabel_enabled_with_compat,i2c133,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS134 - def_bool $(dt_nodelabel_enabled_with_compat,i2c134,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS135 - def_bool $(dt_nodelabel_enabled_with_compat,i2c135,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS136 - def_bool $(dt_nodelabel_enabled_with_compat,i2c136,$(DT_COMPAT_NORDIC_NRF_TWIS)) - -config HAS_HW_NRF_TWIS137 - def_bool $(dt_nodelabel_enabled_with_compat,i2c137,$(DT_COMPAT_NORDIC_NRF_TWIS)) - config HAS_HW_NRF_UART0 def_bool $(dt_nodelabel_enabled_with_compat,uart0,$(DT_COMPAT_NORDIC_NRF_UART)) From 1903f1318554b012110d5c9a004a107dcd25e995 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2033/2300] Revert "[nrf fromtree] tests: drivers: timer: nrf_grtc_timer: add nRF54H20 target" This reverts commit 1f655d6c493df7116203c75ca1ba603633242da3. Signed-off-by: Robert Lubos --- tests/drivers/timer/nrf_grtc_timer/testcase.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 00ac1ed584b..f611a518a70 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -1,7 +1,4 @@ tests: drivers.timer.nrf_grtc_timer: tags: drivers - platform_allow: - - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad + platform_allow: nrf54l15pdk/nrf54l15/cpuapp From 09f028d988ecd1e857399a783323e1f1a8e67a2e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2034/2300] Revert "[nrf fromlist] tests: drivers: spi: spi_slave: Add nrf54h20dk" This reverts commit 4aa01ece24d527919eb1148471a07616103ced97. Signed-off-by: Robert Lubos --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 79 ------------------- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 14 ---- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 14 ---- tests/drivers/spi/spi_slave/src/main.c | 1 - tests/drivers/spi/spi_slave/testcase.yaml | 4 +- 5 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi deleted file mode 100644 index 0a9425cc2f9..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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; - }; - }; - -}; - -&gpio0 { - status = "okay"; -}; - -&gpiote130 { - status = "okay"; - owned-channels = <7>; -}; - -dut_spi: &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_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index ff337ebdec4..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "nrf54h20dk_nrf54h20_common.dtsi" - -&dut_spi { - memory-regions = <&cpuapp_dma_region>; -}; - -&dut_spis { - memory-regions = <&cpuapp_dma_region>; -}; diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index 936bd5b15d5..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "nrf54h20dk_nrf54h20_common.dtsi" - -&dut_spi { - memory-regions = <&cpurad_dma_region>; -}; - -&dut_spis { - memory-regions = <&cpurad_dma_region>; -}; diff --git a/tests/drivers/spi/spi_slave/src/main.c b/tests/drivers/spi/spi_slave/src/main.c index 5f441480c12..7a6ca1b7545 100644 --- a/tests/drivers/spi/spi_slave/src/main.c +++ b/tests/drivers/spi/spi_slave/src/main.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #define SPI_MODE (SPI_MODE_CPOL | SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE) diff --git a/tests/drivers/spi/spi_slave/testcase.yaml b/tests/drivers/spi/spi_slave/testcase.yaml index c38b3e72952..1b5a46cc9e6 100644 --- a/tests/drivers/spi/spi_slave/testcase.yaml +++ b/tests/drivers/spi/spi_slave/testcase.yaml @@ -5,8 +5,6 @@ tests: harness: ztest harness_config: fixture: gpio_spi_loopback - platform_allow: | - nrf52840dk/nrf52840 nrf54l15pdk/nrf54l15/cpuapp nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad + platform_allow: nrf52840dk/nrf52840 nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf52840dk/nrf52840 From 15a6d8889a998fcd3f3894e7ff4a8d927a13af9c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2035/2300] Revert "[nrf fromtree] tests: drivers: spi: spi_loopback_test: Add nrf54h20dk support" This reverts commit 0bdee3c8a8c20f5f7b48437885f430ec4ea9ae7e. Signed-off-by: Robert Lubos --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 5ab0e84eeaa..00000000000 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 { - 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 = ; - }; -}; From 9e1ac9267009ea30ad7fd6d7e37d1b241c4c8daa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2036/2300] Revert "[nrf fromtree] dts: common: nordic: nrf54: Add rx-delay property to SPI" This reverts commit 1c5cc9de2a2d14f0ff4cbddf595d9705c40ca3d6. Signed-off-by: Robert Lubos --- .../nordic/nrf54l15_cpuapp_peripherals.dtsi | 10 ---------- dts/common/nordic/nrf54h20.dtsi | 20 ------------------- 2 files changed, 30 deletions(-) diff --git a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi index 3e4d3641069..eb161844841 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp_peripherals.dtsi @@ -24,8 +24,6 @@ spi00: spi@4a000 { interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; @@ -126,8 +124,6 @@ spi20: spi@c6000 { interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; @@ -163,8 +159,6 @@ spi21: spi@c7000 { interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; @@ -200,8 +194,6 @@ spi22: spi@c8000 { interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; @@ -399,8 +391,6 @@ spi30: spi@104000 { interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; status = "disabled"; }; diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 034c8ac58df..b8badf1252c 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -373,8 +373,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart120: uart@8e6000 { @@ -393,8 +391,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; cpuppr_vpr: vpr@908000 { @@ -652,8 +648,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart130: uart@9a5000 { @@ -682,8 +676,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart131: uart@9a6000 { @@ -746,8 +738,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart132: uart@9b5000 { @@ -776,8 +766,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart133: uart@9b6000 { @@ -840,8 +828,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart134: uart@9c5000 { @@ -870,8 +856,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart135: uart@9c6000 { @@ -934,8 +918,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart136: uart@9d5000 { @@ -964,8 +946,6 @@ max-frequency = ; #address-cells = <1>; #size-cells = <0>; - rx-delay-supported; - rx-delay = <1>; }; uart137: uart@9d6000 { From 0fa042c475b289d0421eeb5a4a3d9065b2b54a47 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2037/2300] Revert "[nrf fromtree] tests: drivers: spi: Add test for SPI master and slave" This reverts commit 51407a9bf1e44777d124bfe1f3b9c373c0832d16. Signed-off-by: Robert Lubos --- tests/drivers/spi/spi_slave/CMakeLists.txt | 10 - .../boards/nrf52840dk_nrf52840.overlay | 67 --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 73 --- tests/drivers/spi/spi_slave/prj.conf | 6 - tests/drivers/spi/spi_slave/src/main.c | 452 ------------------ tests/drivers/spi/spi_slave/testcase.yaml | 10 - 6 files changed, 618 deletions(-) delete mode 100644 tests/drivers/spi/spi_slave/CMakeLists.txt delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay delete mode 100644 tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/spi/spi_slave/prj.conf delete mode 100644 tests/drivers/spi/spi_slave/src/main.c delete mode 100644 tests/drivers/spi/spi_slave/testcase.yaml diff --git a/tests/drivers/spi/spi_slave/CMakeLists.txt b/tests/drivers/spi/spi_slave/CMakeLists.txt deleted file mode 100644 index f9f7a6bdae4..00000000000 --- a/tests/drivers/spi/spi_slave/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(spi_slave) - -FILE(GLOB app_sources src/*.c) - -target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 477917e0ca7..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi3_default_alt: spi3_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi3_sleep_alt: spi3_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi1_default_alt: spi1_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi1_sleep_alt: spi1_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -&spi3 { - status = "okay"; - pinctrl-0 = <&spi3_default_alt>; - pinctrl-1 = <&spi3_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <4000000>; - }; -}; - -dut_spis: &spi1 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi1_default_alt>; - pinctrl-1 = <&spi1_sleep_alt>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index d431f278337..00000000000 --- a/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - spi22_default_alt: spi22_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi22_sleep_alt: spi22_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi21_default_alt: spi21_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spi21_sleep_alt: spi21_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -&gpio2 { - status = "okay"; -}; - -&spi22 { - status = "okay"; - pinctrl-0 = <&spi22_default_alt>; - pinctrl-1 = <&spi22_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <4000000>; - }; -}; - -dut_spis: &spi21 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spi21_default_alt>; - pinctrl-1 = <&spi21_sleep_alt>; - pinctrl-names = "default", "sleep"; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; diff --git a/tests/drivers/spi/spi_slave/prj.conf b/tests/drivers/spi/spi_slave/prj.conf deleted file mode 100644 index 840a8f87d9a..00000000000 --- a/tests/drivers/spi/spi_slave/prj.conf +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_SPI=y -CONFIG_SPI_SLAVE=y -CONFIG_GPIO=y -CONFIG_POLL=y -CONFIG_SPI_ASYNC=y -CONFIG_ZTEST=y diff --git a/tests/drivers/spi/spi_slave/src/main.c b/tests/drivers/spi/spi_slave/src/main.c deleted file mode 100644 index 7a6ca1b7545..00000000000 --- a/tests/drivers/spi/spi_slave/src/main.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -#define SPI_MODE (SPI_MODE_CPOL | SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE) -#define SPIM_OP (SPI_OP_MODE_MASTER | SPI_MODE) -#define SPIS_OP (SPI_OP_MODE_SLAVE | SPI_MODE) - -static struct spi_dt_spec spim = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPIM_OP, 0); -static const struct device *spis_dev = DEVICE_DT_GET(DT_NODELABEL(dut_spis)); -static const struct spi_config spis_config = { - .operation = SPIS_OP -}; - -static struct k_poll_signal async_sig = K_POLL_SIGNAL_INITIALIZER(async_sig); -static struct k_poll_event async_evt = - K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &async_sig); - -#define MEMORY_SECTION(node) \ - COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \ - (__attribute__((__section__( \ - LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \ - ()) - -static uint8_t spim_buffer[32] MEMORY_SECTION(DT_BUS(DT_NODELABEL(dut_spi_dt))); -static uint8_t spis_buffer[32] MEMORY_SECTION(DT_NODELABEL(dut_spis)); - -struct test_data { - struct k_work_delayable test_work; - struct k_sem sem; - int spim_alloc_idx; - int spis_alloc_idx; - struct spi_buf_set sets[4]; - struct spi_buf_set *mtx_set; - struct spi_buf_set *mrx_set; - struct spi_buf_set *stx_set; - struct spi_buf_set *srx_set; - struct spi_buf bufs[8]; -}; - -static struct test_data tdata; - -/* Allocate buffer from spim or spis space. */ -static uint8_t *buf_alloc(size_t len, bool spim) -{ - int *idx = spim ? &tdata.spim_alloc_idx : &tdata.spis_alloc_idx; - uint8_t *buf = spim ? spim_buffer : spis_buffer; - size_t total = spim ? sizeof(spim_buffer) : sizeof(spis_buffer); - uint8_t *rv; - - if (*idx + len > total) { - zassert_false(true); - - return NULL; - } - - rv = &buf[*idx]; - *idx += len; - - return rv; -} - -static void work_handler(struct k_work *work) -{ - struct k_work_delayable *dwork = k_work_delayable_from_work(work); - struct test_data *td = CONTAINER_OF(dwork, struct test_data, test_work); - int rv; - - rv = spi_transceive_dt(&spim, td->mtx_set, td->mrx_set); - if (rv == 0) { - k_sem_give(&td->sem); - } -} - -/** Copies data from buffers in the set to a single buffer which makes it easier - * to compare transmitted and received data. - * - * @param buf Output buffer. - * @param len Buffer length. - * @param set Set of buffers. - * - * @return Number of bytes copied. - */ -static int cpy_data(uint8_t *buf, size_t len, struct spi_buf_set *set) -{ - int idx = 0; - - for (size_t i = 0; i < set->count; i++) { - size_t l = set->buffers[i].len; - - if (len - idx >= l) { - memcpy(&buf[idx], set->buffers[i].buf, l); - idx += l; - } else { - return -1; - } - } - - return idx; -} - -/** Compare two sets. - * - * @param tx_set TX set. - * @param rx_set RX set. - * @param same_size True if it is expected to have the same amount of data in both sets. - * - * @return 0 if data is the same and other value indicate that check failed. - */ -static int check_buffers(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set, bool same_size) -{ - static uint8_t tx_data[256]; - static uint8_t rx_data[256]; - int rx_len; - int tx_len; - - if (!tx_set || !rx_set) { - return 0; - } - - rx_len = cpy_data(rx_data, sizeof(rx_data), rx_set); - tx_len = cpy_data(tx_data, sizeof(tx_data), tx_set); - if (same_size && (rx_len != tx_len)) { - return -1; - } - - return memcmp(tx_data, rx_data, rx_len); -} - -/** Calculate expected number of received bytes by the slave. - * - * It is used to check if SPI API call for slave returns correct value. - * @param tx_set TX set. - * @param rx_set RX set. - * - * @return Expected amount of received bytes. - */ -static int slave_rx_len(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set) -{ - size_t tx_len = 0; - size_t rx_len = 0; - - if (!tx_set || !rx_set) { - return 0; - } - - for (size_t i = 0; i < tx_set->count; i++) { - tx_len += tx_set->buffers[i].len; - } - - for (size_t i = 0; i < rx_set->count; i++) { - rx_len += rx_set->buffers[i].len; - } - - return MIN(rx_len, tx_len); -} - -/** Generic function which runs the test with sets prepared in the test data structure. */ -static void run_test(bool m_same_size, bool s_same_size, bool async) -{ - int rv; - int slave_rv; - int srx_len; - - rv = k_work_schedule(&tdata.test_work, K_MSEC(10)); - zassert_equal(rv, 1); - - if (!async) { - slave_rv = spi_transceive(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set); - if (slave_rv == -ENOTSUP) { - ztest_test_skip(); - } - } else { - rv = spi_transceive_signal(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set, - &async_sig); - if (rv == -ENOTSUP) { - ztest_test_skip(); - } - zassert_equal(rv, 0); - - /* Transfer not finished yet */ - rv = k_sem_take(&tdata.sem, K_NO_WAIT); - zassert_equal(rv, -EBUSY); - - rv = k_poll(&async_evt, 1, K_MSEC(200)); - zassert_false(rv, "one or more events are not ready"); - - slave_rv = async_evt.signal->result; - - /* Reinitializing for next call */ - async_evt.signal->signaled = 0U; - async_evt.state = K_POLL_STATE_NOT_READY; - } - - rv = k_sem_take(&tdata.sem, K_MSEC(100)); - zassert_equal(rv, 0); - - srx_len = slave_rx_len(tdata.mtx_set, tdata.srx_set); - - zassert_equal(slave_rv, srx_len, "Got: %d but expected:%d", slave_rv, srx_len); - - rv = check_buffers(tdata.mtx_set, tdata.srx_set, m_same_size); - zassert_equal(rv, 0); - - rv = check_buffers(tdata.stx_set, tdata.mrx_set, s_same_size); - zassert_equal(rv, 0); -} - -/** Basic test where slave and master have RX and TX sets which contains only one - * same size buffer. - */ -static void test_basic(bool async) -{ - size_t len = 16; - - for (int i = 0; i < 4; i++) { - tdata.bufs[i].buf = buf_alloc(len, i < 2); - tdata.bufs[i].len = len; - tdata.sets[i].buffers = &tdata.bufs[i]; - tdata.sets[i].count = 1; - } - - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = &tdata.sets[1]; - tdata.stx_set = &tdata.sets[2]; - tdata.srx_set = &tdata.sets[3]; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_basic) -{ - test_basic(false); -} - -ZTEST(spi_slave, test_basic_async) -{ - test_basic(true); -} - -/** Setup a transfer where RX buffer on master and slave are shorter than - * TX buffers. RX buffers shall contain beginning of TX data and last TX - * bytes that did not fit in the RX buffers shall be lost. - */ -static void test_short_rx(bool async) -{ - size_t len = 16; - - tdata.bufs[0].buf = buf_alloc(len, true); - tdata.bufs[0].len = len; - tdata.bufs[1].buf = buf_alloc(len, true); - tdata.bufs[1].len = len - 3; /* RX buffer */ - tdata.bufs[2].buf = buf_alloc(len, false); - tdata.bufs[2].len = len; - tdata.bufs[3].buf = buf_alloc(len, false); - tdata.bufs[3].len = len - 4; /* RX buffer */ - - for (int i = 0; i < 4; i++) { - tdata.sets[i].buffers = &tdata.bufs[i]; - tdata.sets[i].count = 1; - } - - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = &tdata.sets[1]; - tdata.stx_set = &tdata.sets[2]; - tdata.srx_set = &tdata.sets[3]; - - run_test(false, false, async); -} - -ZTEST(spi_slave, test_short_rx) -{ - test_short_rx(false); -} - -ZTEST(spi_slave, test_short_rx_async) -{ - test_short_rx(true); -} - -/** Test where only master transmits. */ -static void test_only_tx(bool async) -{ - size_t len = 16; - - /* MTX buffer */ - tdata.bufs[0].buf = buf_alloc(len, true); - tdata.bufs[0].len = len; - tdata.sets[0].buffers = &tdata.bufs[0]; - tdata.sets[0].count = 1; - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = NULL; - - /* STX buffer */ - tdata.bufs[1].buf = buf_alloc(len, false); - tdata.bufs[1].len = len; - tdata.sets[1].buffers = &tdata.bufs[1]; - tdata.sets[1].count = 1; - tdata.srx_set = &tdata.sets[1]; - tdata.stx_set = NULL; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_only_tx) -{ - test_only_tx(false); -} - -ZTEST(spi_slave, test_only_tx_async) -{ - test_only_tx(true); -} - -/** Test where only master transmits and slave receives in chunks. */ -static void test_only_tx_in_chunks(bool async) -{ - size_t len1 = 7; - size_t len2 = 8; - - /* MTX buffer */ - tdata.bufs[0].buf = buf_alloc(len1 + len2, true); - tdata.bufs[0].len = len1 + len2; - tdata.sets[0].buffers = &tdata.bufs[0]; - tdata.sets[0].count = 1; - tdata.mtx_set = &tdata.sets[0]; - tdata.mrx_set = NULL; - - /* STX buffer */ - tdata.bufs[1].buf = buf_alloc(len1, false); - tdata.bufs[1].len = len1; - tdata.bufs[2].buf = buf_alloc(len2, false); - tdata.bufs[2].len = len2; - tdata.sets[1].buffers = &tdata.bufs[1]; - tdata.sets[1].count = 2; - tdata.srx_set = &tdata.sets[1]; - tdata.stx_set = NULL; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_only_tx_in_chunks) -{ - test_only_tx_in_chunks(false); -} - -ZTEST(spi_slave, test_only_tx_in_chunks_async) -{ - test_only_tx_in_chunks(true); -} - -/** Test where only slave transmits. */ -static void test_only_rx(bool async) -{ - size_t len = 16; - - /* MTX buffer */ - tdata.bufs[0].buf = buf_alloc(len, true); - tdata.bufs[0].len = len; - tdata.sets[0].buffers = &tdata.bufs[0]; - tdata.sets[0].count = 1; - tdata.mrx_set = &tdata.sets[0]; - tdata.mtx_set = NULL; - - /* STX buffer */ - tdata.bufs[1].buf = buf_alloc(len, false); - tdata.bufs[1].len = len; - tdata.sets[1].buffers = &tdata.bufs[1]; - tdata.sets[1].count = 1; - tdata.stx_set = &tdata.sets[1]; - tdata.srx_set = NULL; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_only_rx) -{ - test_only_rx(false); -} - -ZTEST(spi_slave, test_only_rx_async) -{ - test_only_rx(true); -} - -/** Test where only slave transmits in chunks. */ -static void test_only_rx_in_chunks(bool async) -{ - size_t len1 = 7; - size_t len2 = 9; - - /* MTX buffer */ - tdata.bufs[0].buf = buf_alloc(len1 + len2, true); - tdata.bufs[0].len = len1 + len2; - tdata.sets[0].buffers = &tdata.bufs[0]; - tdata.sets[0].count = 1; - tdata.mrx_set = &tdata.sets[0]; - tdata.mtx_set = NULL; - - /* STX buffer */ - tdata.bufs[1].buf = buf_alloc(len1, false); - tdata.bufs[1].len = len1; - tdata.bufs[2].buf = buf_alloc(len2, false); - tdata.bufs[2].len = len2; - tdata.sets[1].buffers = &tdata.bufs[1]; - tdata.sets[1].count = 2; - tdata.stx_set = &tdata.sets[1]; - tdata.srx_set = NULL; - - run_test(true, true, async); -} - -ZTEST(spi_slave, test_only_rx_in_chunks) -{ - test_only_rx_in_chunks(false); -} - -ZTEST(spi_slave, test_only_rx_in_chunks_async) -{ - test_only_rx_in_chunks(true); -} - -static void before(void *not_used) -{ - ARG_UNUSED(not_used); - - memset(&tdata, 0, sizeof(tdata)); - for (size_t i = 0; i < sizeof(spim_buffer); i++) { - spim_buffer[i] = (uint8_t)i; - } - for (size_t i = 0; i < sizeof(spis_buffer); i++) { - spis_buffer[i] = (uint8_t)(i + 0x80); - } - - k_work_init_delayable(&tdata.test_work, work_handler); - k_sem_init(&tdata.sem, 0, 1); -} - -static void *suite_setup(void) -{ - return NULL; -} - -ZTEST_SUITE(spi_slave, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/spi/spi_slave/testcase.yaml b/tests/drivers/spi/spi_slave/testcase.yaml deleted file mode 100644 index 1b5a46cc9e6..00000000000 --- a/tests/drivers/spi/spi_slave/testcase.yaml +++ /dev/null @@ -1,10 +0,0 @@ -tests: - drivers.spi_slave.api: - depends_on: spi - tags: drivers spi - harness: ztest - harness_config: - fixture: gpio_spi_loopback - platform_allow: nrf52840dk/nrf52840 nrf54l15pdk/nrf54l15/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 From 44f2d16ec4259bdf0027f0251fed4259cbc30a86 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2038/2300] Revert "[nrf fromtree] tests: drivers: uart: uart_elementary: Fix RX handling" This reverts commit 6498044123c17077106d4ae9c2dc605e065cb85a. Signed-off-by: Robert Lubos --- tests/drivers/uart/uart_elementary/src/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c index 1c4df3273a7..d7d85ee9542 100644 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ b/tests/drivers/uart/uart_elementary/src/main.c @@ -66,12 +66,14 @@ static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive int *rx_byte_offset) { int rx_data_length = 0; + int bytes_received = 0; do { rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, TEST_BUFFER_LEN); - *rx_byte_offset += rx_data_length; + bytes_received += rx_data_length; } while (rx_data_length); + *rx_byte_offset += bytes_received; } /* From 47852ab6a7f2ad8a81efdf7d9ae549e3fc2d73a4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2039/2300] Revert "[nrf fromtree] drivers: Extend coverage for UARTE driver" This reverts commit 16458fffeed93fdd45432c636ebf193b82041606. Signed-off-by: Robert Lubos --- .../uart/uart_elementary/CMakeLists.txt | 10 - tests/drivers/uart/uart_elementary/Kconfig | 11 - tests/drivers/uart/uart_elementary/README.txt | 13 - .../boards/nrf5340dk_nrf5340_cpuapp.conf | 1 - .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 32 -- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 37 -- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 3 - ...f54h20dk_nrf54h20_cpuapp_dual_uart.overlay | 56 --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 31 -- ...54l15pdk_nrf54l15_cpuapp_dual_uart.overlay | 51 --- tests/drivers/uart/uart_elementary/prj.conf | 6 - tests/drivers/uart/uart_elementary/src/main.c | 322 ------------------ .../uart/uart_elementary/testcase.yaml | 35 -- 13 files changed, 608 deletions(-) delete mode 100644 tests/drivers/uart/uart_elementary/CMakeLists.txt delete mode 100644 tests/drivers/uart/uart_elementary/Kconfig delete mode 100644 tests/drivers/uart/uart_elementary/README.txt delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay delete mode 100644 tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay delete mode 100644 tests/drivers/uart/uart_elementary/prj.conf delete mode 100644 tests/drivers/uart/uart_elementary/src/main.c delete mode 100644 tests/drivers/uart/uart_elementary/testcase.yaml diff --git a/tests/drivers/uart/uart_elementary/CMakeLists.txt b/tests/drivers/uart/uart_elementary/CMakeLists.txt deleted file mode 100644 index 59b31ee68a9..00000000000 --- a/tests/drivers/uart/uart_elementary/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(uart_high_level_api) - -target_sources(app PRIVATE - src/main.c - ) diff --git a/tests/drivers/uart/uart_elementary/Kconfig b/tests/drivers/uart/uart_elementary/Kconfig deleted file mode 100644 index aed523c5832..00000000000 --- a/tests/drivers/uart/uart_elementary/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# UART test configuration options -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -config DUAL_UART_TEST - bool "Enable dual UART test" - -config SETUP_MISMATCH_TEST - bool "Enable mismatched configuration in dual UART test" - -source "Kconfig.zephyr" diff --git a/tests/drivers/uart/uart_elementary/README.txt b/tests/drivers/uart/uart_elementary/README.txt deleted file mode 100644 index 5af85beff46..00000000000 --- a/tests/drivers/uart/uart_elementary/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -The purpose of this test is to validate basic UART driver functions, -that are not tested elsewhere. -UART interrupt mode is used for the tests purpose. - -Hardware setup required for these tests: -For single uart conviguration - UART0 TX connected to RX and CTS to RTS -For dual uart configuratiom - UART0 and UART1 TXs and RXs cross-connected - -These test cases cover: -- UART configuration, -- UART error check, -- UART callback setup, -- Dual UART transmission with matched and mismatched configurations diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 064e78b6f74..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n diff --git a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f98f3657f13..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart1_default_alt: uart1_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - uart1_sleep_alt: uart1_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart1 { - current-speed = <115200>; - compatible = "nordic,nrf-uarte"; - status = "okay"; - pinctrl-0 = <&uart1_default_alt>; - pinctrl-1 = <&uart1_sleep_alt>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi deleted file mode 100644 index 22d8378937c..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&cpuapp_dma_region { - status="okay"; -}; - -&pinctrl { - uart135_default_alt: uart135_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - uart135_sleep_alt: uart135_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart135 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart135_default_alt>; - pinctrl-1 = <&uart135_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; - hw-flow-control; - -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index f65b4dd3b0b..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay deleted file mode 100644 index 23c36ee8974..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay +++ /dev/null @@ -1,56 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -#include "nrf54h20dk_nrf54h20_common.dtsi" - - -&pinctrl { - uart135_default_alt: uart135_default_alt { - group1 { - psels = , - ; - }; - }; - - uart135_sleep_alt: uart135_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart135 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart135_default_alt>; - pinctrl-1 = <&uart135_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; -}; - -&pinctrl { - uart137_default_alt: uart137_default_alt { - group1 { - psels = , - ; - }; - }; - - uart137_sleep_alt: uart137_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut_aux: &uart137 { - status = "okay"; - memory-regions = <&cpuapp_dma_region>; - pinctrl-0 = <&uart137_default_alt>; - pinctrl-1 = <&uart137_sleep_alt>; - pinctrl-names = "default", "sleep"; - current-speed = <115200>; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index cf481b7a161..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - , - , - ; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; - hw-flow-control; -}; diff --git a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay b/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay deleted file mode 100644 index 2031f7a2444..00000000000 --- a/tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay +++ /dev/null @@ -1,51 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - uart21_default: uart21_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart21_sleep: uart21_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart22_default: uart22_default { - group1 { - psels = , - ; - bias-pull-up; - }; - }; - - uart22_sleep: uart22_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart21 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart21_default>; - pinctrl-1 = <&uart21_sleep>; - pinctrl-names = "default", "sleep"; -}; - -dut_aux: &uart22 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart22_default>; - pinctrl-1 = <&uart22_sleep>; - pinctrl-names = "default", "sleep"; -}; diff --git a/tests/drivers/uart/uart_elementary/prj.conf b/tests/drivers/uart/uart_elementary/prj.conf deleted file mode 100644 index 26c93d320a7..00000000000 --- a/tests/drivers/uart/uart_elementary/prj.conf +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_SERIAL=y -CONFIG_ZTEST=y -CONFIG_TEST_USERSPACE=y -CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_UART_USE_RUNTIME_CONFIGURE=y -CONFIG_UART_INTERRUPT_DRIVEN=y diff --git a/tests/drivers/uart/uart_elementary/src/main.c b/tests/drivers/uart/uart_elementary/src/main.c deleted file mode 100644 index d7d85ee9542..00000000000 --- a/tests/drivers/uart/uart_elementary/src/main.c +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @addtogroup t_driver_uart - * @{ - * @defgroup t_uart_elementary test_uart_elementary - * @} - */ - -#include -#include - -#if DT_NODE_EXISTS(DT_NODELABEL(dut)) -#define UART_NODE DT_NODELABEL(dut) -#else -#define UART_NODE DT_CHOSEN(zephyr_console) -#endif - -#if DT_NODE_EXISTS(DT_NODELABEL(dut_aux)) -#define UART_NODE_AUX DT_NODELABEL(dut_aux) -#else -#define UART_NODE_AUX DT_CHOSEN(zephyr_console) -#endif - -#define SLEEP_TIME_US 1000 -#define TEST_BUFFER_LEN 10 - -static const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE); - -const uint8_t test_pattern[TEST_BUFFER_LEN] = { 0x11, 0x12, 0x13, 0x14, 0x15, - 0x16, 0x17, 0x18, 0x19, 0x20 }; -static uint8_t test_buffer[TEST_BUFFER_LEN]; -static volatile uint8_t uart_error_counter; - -#if defined(CONFIG_DUAL_UART_TEST) -static const struct device *const uart_dev_aux = DEVICE_DT_GET(UART_NODE_AUX); -static uint8_t test_buffer_aux[TEST_BUFFER_LEN]; -static volatile uint8_t aux_uart_error; -#endif - -/* - * ISR for UART TX action - */ -static void uart_tx_interrupt_service(const struct device *dev, int *tx_byte_offset) -{ - uint8_t bytes_sent = 0; - uint8_t *tx_data_pointer = (uint8_t *)(test_pattern + *tx_byte_offset); - - if (*tx_byte_offset < TEST_BUFFER_LEN) { - bytes_sent = uart_fifo_fill(dev, tx_data_pointer, 1); - *tx_byte_offset += bytes_sent; - } else { - *tx_byte_offset = 0; - uart_irq_tx_disable(dev); - } -} - -/* - * ISR for UART RX action - */ -static void uart_rx_interrupt_service(const struct device *dev, uint8_t *receive_buffer_pointer, - int *rx_byte_offset) -{ - int rx_data_length = 0; - int bytes_received = 0; - - do { - rx_data_length = uart_fifo_read(dev, receive_buffer_pointer + *rx_byte_offset, - TEST_BUFFER_LEN); - bytes_received += rx_data_length; - } while (rx_data_length); - *rx_byte_offset += bytes_received; -} - -/* - * Callback function for MAIN UART interrupt based transmission test - */ -static void interrupt_driven_uart_callback_main_uart(const struct device *dev, void *user_data) -{ - int err; - static int tx_byte_offset; - static int rx_byte_offset; - - uart_irq_update(dev); - err = uart_err_check(dev); - if (err != 0) { - uart_error_counter++; - } - while (uart_irq_is_pending(dev)) { - if (uart_irq_rx_ready(dev)) { - uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset); - } - if (uart_irq_tx_ready(dev)) { - uart_tx_interrupt_service(dev, &tx_byte_offset); - } - } -} - -#if defined(CONFIG_DUAL_UART_TEST) -/* - * Callback function for AUX UART interrupt based transmission test - */ -static void interrupt_driven_uart_callback_aux_uart(const struct device *dev, void *user_data) -{ - int err; - static int tx_byte_offset_aux; - static int rx_byte_offset_aux; - - uart_irq_update(dev); - err = uart_err_check(dev); -#if !defined(CONFIG_COVERAGE) - /* This assetion will fail with coverge enabled - * When in coverage mode it has no impact on test case execution - */ - zassert_equal(err, 0, "Unexpected UART device: %s error: %d", dev->name, err); -#endif /* CONFIG_COVERAGE */ - while (uart_irq_is_pending(dev)) { - if (uart_irq_rx_ready(dev)) { - uart_rx_interrupt_service(dev, (uint8_t *)user_data, &rx_byte_offset_aux); - } - if (uart_irq_tx_ready(dev)) { - uart_tx_interrupt_service(dev, &tx_byte_offset_aux); - } - } -} -#endif /* CONFIG_DUAL_UART_TEST */ - -/* - * Test UART proper configuration call - */ -ZTEST(uart_elementary, test_uart_proper_configuration) -{ - Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); - - int err; - struct uart_config test_expected_uart_config; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; - - err = uart_configure(uart_dev, &test_uart_config); - zassert_equal(err, 0, "'uart_configure' api call - unexpected error: %d", err); - - err = uart_config_get(uart_dev, &test_expected_uart_config); - zassert_equal(err, 0, "'uart_config_get' api call - unexpected error raised : %d", err); - - zassert_equal(test_uart_config.baudrate, test_expected_uart_config.baudrate, - "Set and actual UART config baudrate mismatch: %d != %d", - test_uart_config.baudrate, test_expected_uart_config.baudrate); - - zassert_equal(test_uart_config.parity, test_expected_uart_config.parity, - "Set and actual UART config parity mismatch: %d != %d", - test_uart_config.parity, test_expected_uart_config.parity); - - zassert_equal(test_uart_config.stop_bits, test_expected_uart_config.stop_bits, - "Set and actual UART config stop_bits mismatch: %d != %d", - test_uart_config.stop_bits, test_expected_uart_config.stop_bits); - - zassert_equal(test_uart_config.data_bits, test_expected_uart_config.data_bits, - "Set and actual UART config data_bits mismatch: %d != %d", - test_uart_config.data_bits, test_expected_uart_config.data_bits); - - zassert_equal(test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl, - "Set and actual UART config flow_ctrl mismatch: %d != %d", - test_uart_config.flow_ctrl, test_expected_uart_config.flow_ctrl); -} - -/* - * Test UART improper configuration call - */ -ZTEST(uart_elementary, test_uart_improper_configuration) -{ - Z_TEST_SKIP_IFDEF(CONFIG_DUAL_UART_TEST); - - int err; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = 7, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; - - err = uart_configure(uart_dev, &test_uart_config); - zassert_not_equal( - err, 0, - "'uart_configure' with incorrect configuration havent't raised an error, err=%d", - err); -} - -#if !defined(CONFIG_DUAL_UART_TEST) -/* - * Test UART basic interrupt based transmission (with loopback) - */ -ZTEST(uart_elementary, test_uart_basic_transmission) -{ - int err; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_ODD, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS }; - - err = uart_configure(uart_dev, &test_uart_config); - zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); - - err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); - zassert_equal(err, 0, "Unexpected error when setting callback %d", err); - err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, - (void *)test_buffer); - zassert_equal(err, 0, "Unexpected error when setting user data for callback %d", err); - uart_irq_err_enable(uart_dev); - uart_irq_rx_enable(uart_dev); - uart_irq_tx_enable(uart_dev); - - /* wait for the tramission to finish (no polling is intentional) */ - k_sleep(K_USEC(100 * SLEEP_TIME_US)); - - uart_irq_tx_disable(uart_dev); - uart_irq_rx_disable(uart_dev); - uart_irq_err_disable(uart_dev); - for (int index = 0; index < TEST_BUFFER_LEN; index++) { - zassert_equal(test_buffer[index], test_pattern[index], - "Recieived data byte %d does not match pattern 0x%x != 0x%x", index, - test_buffer[index], test_pattern[index]); - } -} -#else -/* - * Test UART interrupt based transmission between two ports - */ -ZTEST(uart_elementary, test_uart_dual_port_transmission) -{ - int err; - struct uart_config test_uart_config = { .baudrate = 115200, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; - -#if defined(CONFIG_SETUP_MISMATCH_TEST) - struct uart_config test_uart_config_aux = { .baudrate = 9600, - .parity = UART_CFG_PARITY_NONE, - .stop_bits = UART_CFG_STOP_BITS_1, - .data_bits = UART_CFG_DATA_BITS_8, - .flow_ctrl = UART_CFG_FLOW_CTRL_NONE }; -#endif - err = uart_configure(uart_dev, &test_uart_config); - zassert_equal(err, 0, "Unexpected error when configuring UART0: %d", err); - -#if defined(CONFIG_SETUP_MISMATCH_TEST) - err = uart_configure(uart_dev_aux, &test_uart_config_aux); -#else - err = uart_configure(uart_dev_aux, &test_uart_config); -#endif - - zassert_equal(err, 0, "Unexpected error when configuring UART1: %d", err); - - err = uart_irq_callback_set(uart_dev, interrupt_driven_uart_callback_main_uart); - zassert_equal(err, 0, "Unexpected error when setting callback for UART0 %d", err); - err = uart_irq_callback_user_data_set(uart_dev, interrupt_driven_uart_callback_main_uart, - (void *)test_buffer); - zassert_equal(err, 0, "Unexpected error when setting user data for UART0 callback %d", err); - - err = uart_irq_callback_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart); - zassert_equal(err, 0, "Unexpected error when setting callback for UART1 %d", err); - err = uart_irq_callback_user_data_set(uart_dev_aux, interrupt_driven_uart_callback_aux_uart, - (void *)test_buffer_aux); - zassert_equal(err, 0, "Unexpected error when setting user data for UART1 callback %d", err); - - uart_irq_err_enable(uart_dev); - uart_irq_err_enable(uart_dev_aux); - - uart_irq_tx_enable(uart_dev); - uart_irq_tx_enable(uart_dev_aux); - - uart_irq_rx_enable(uart_dev); - uart_irq_rx_enable(uart_dev_aux); - - /* wait for the tramission to finish (no polling is intentional) */ - k_sleep(K_USEC(100 * SLEEP_TIME_US)); - - uart_irq_tx_disable(uart_dev); - uart_irq_tx_disable(uart_dev_aux); - uart_irq_rx_disable(uart_dev); - uart_irq_rx_disable(uart_dev_aux); - uart_irq_err_disable(uart_dev); - uart_irq_err_disable(uart_dev_aux); - -#if defined(CONFIG_SETUP_MISMATCH_TEST) - zassert_not_equal(uart_error_counter, 0); -#else - for (int index = 0; index < TEST_BUFFER_LEN; index++) { - zassert_equal(test_buffer[index], test_pattern[index], - "UART0 recieived data byte %d does not match pattern 0x%x != 0x%x", - index, test_buffer[index], test_pattern[index]); - zassert_equal(test_buffer_aux[index], test_pattern[index], - "UART1 recieived data byte %d does not match pattern 0x%x != 0x%x", - index, test_buffer_aux[index], test_pattern[index]); - } -#endif /* CONFIG_SETUP_MISMATCH_TEST */ -} -#endif /* CONFIG_DUAL_UART_TEST */ - -/* - * Test setup - */ -void *test_setup(void) -{ - zassert_true(device_is_ready(uart_dev), "UART0 device is not ready"); -#if defined(CONFIG_DUAL_UART_TEST) - zassert_true(device_is_ready(uart_dev_aux), "UART1 device is not ready"); -#endif - - return NULL; -} - -ZTEST_SUITE(uart_elementary, NULL, test_setup, NULL, NULL, NULL); diff --git a/tests/drivers/uart/uart_elementary/testcase.yaml b/tests/drivers/uart/uart_elementary/testcase.yaml deleted file mode 100644 index 7c06967e7ad..00000000000 --- a/tests/drivers/uart/uart_elementary/testcase.yaml +++ /dev/null @@ -1,35 +0,0 @@ -common: - tags: drivers uart - depends_on: gpio - harness: ztest - harness_config: - fixture: gpio_loopback -tests: - drivers.uart.uart_elementary: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - - nrf54l15pdk/nrf54l15/cpuapp - - nrf5340dk/nrf5340/cpuapp - drivers.uart.uart_elementary_dual_nrf54h: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - drivers.uart.uart_elementary_dual_setup_mismatch_nrf54h: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y - - CONFIG_SETUP_MISMATCH_TEST=y - drivers.uart.uart_elementary_dual_nrf54l: - filter: CONFIG_SERIAL_SUPPORT_INTERRUPT - platform_allow: - - nrf54l15pdk/nrf54l15/cpuapp - extra_args: DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay" - extra_configs: - - CONFIG_DUAL_UART_TEST=y From f7a49f6d5e3b5ad41d0dfc3648611c19448dc266 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2040/2300] Revert "[nrf fromtree] tests: drivers: uart: uart_pm: Add support for nrf54h20dk" This reverts commit f77e4e98908a2bc02cdbaa956f0a52b96e42c595. Signed-off-by: Robert Lubos --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 31 ------------------- tests/drivers/uart/uart_pm/testcase.yaml | 5 --- 2 files changed, 36 deletions(-) delete mode 100644 tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index d01ebce4c8a..00000000000 --- a/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&pinctrl { - uart135_default_alt: uart135_default_alt { - group1 { - psels = , - ; - }; - }; - - uart135_sleep_alt: uart135_sleep_alt { - group1 { - psels = , - ; - low-power-enable; - }; - }; -}; - -dut: &uart135 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart135_default_alt>; - pinctrl-1 = <&uart135_sleep_alt>; - pinctrl-names = "default", "sleep"; - memory-regions = <&cpuapp_dma_region>; -}; diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index c7c7b803442..355bb3c4282 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -6,7 +6,6 @@ common: platform_allow: - nrf52840dk/nrf52840 - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim harness_config: fixture: gpio_loopback @@ -28,7 +27,6 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" platform_exclude: - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp drivers.uart.pm.enhanced_poll: extra_configs: @@ -38,7 +36,6 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp drivers.uart.pm.int_driven: extra_configs: @@ -57,7 +54,6 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp drivers.uart.pm.async: extra_configs: @@ -82,4 +78,3 @@ tests: - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y platform_exclude: - nrf54l15pdk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp From c4a68e33a3fc3d655a72ab635f2ca3bde075eb14 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:18 +0200 Subject: [PATCH 2041/2300] Revert "[nrf fromtree] tests: drivers: uart: uart_pm: Limit scope for nrf54l15" This reverts commit 0fb3fdcedb1db19f7899cf8a1a50c2d9651fbdaa. Signed-off-by: Robert Lubos --- tests/drivers/uart/uart_pm/testcase.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 355bb3c4282..f90eed73949 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -5,7 +5,6 @@ common: harness: ztest platform_allow: - nrf52840dk/nrf52840 - - nrf54l15pdk/nrf54l15/cpuapp - nrf52_bsim harness_config: fixture: gpio_loopback @@ -25,8 +24,6 @@ tests: - CONFIG_UART_0_ENHANCED_POLL_OUT=n - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" - platform_exclude: - - nrf54l15pdk/nrf54l15/cpuapp drivers.uart.pm.enhanced_poll: extra_configs: @@ -34,8 +31,6 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y - platform_exclude: - - nrf54l15pdk/nrf54l15/cpuapp drivers.uart.pm.int_driven: extra_configs: @@ -52,8 +47,6 @@ tests: - CONFIG_UART_ASYNC_API=n - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y - platform_exclude: - - nrf54l15pdk/nrf54l15/cpuapp drivers.uart.pm.async: extra_configs: @@ -76,5 +69,3 @@ tests: - CONFIG_NRFX_TIMER2=y - CONFIG_UART_0_ENHANCED_POLL_OUT=y - CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y - platform_exclude: - - nrf54l15pdk/nrf54l15/cpuapp From 988b837e882e70f619a47d62d1de524e1a2a16ff Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2042/2300] Revert "[nrf fromtree] drivers: serial: uart_async_rx: Fix uart_async_rx_reset function" This reverts commit 7b3063a1d9877af7ac2d25385793d0765452691c. Signed-off-by: Robert Lubos --- drivers/serial/uart_async_rx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/serial/uart_async_rx.c b/drivers/serial/uart_async_rx.c index 8ee3fc54af1..7c51a6cd251 100644 --- a/drivers/serial/uart_async_rx.c +++ b/drivers/serial/uart_async_rx.c @@ -126,9 +126,6 @@ void uart_async_rx_reset(struct uart_async_rx *rx_data) { rx_data->free_buf_cnt = rx_data->config->buf_cnt; rx_data->rd_idx = 0; - rx_data->rd_buf_idx = 0; - rx_data->drv_buf_idx = 0; - rx_data->pending_bytes = 0; for (uint8_t i = 0; i < rx_data->config->buf_cnt; i++) { buf_reset(get_buf(rx_data, i)); } From df569d125bc49828f7867e84597abbb7ca22b02a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2043/2300] Revert "[nrf fromtree] drivers: serial: nrfx_uarte2: Clean error state on rx_enable" This reverts commit 2ace1ea2ce5019cb8a5024c73e4456c44b8fd885. Signed-off-by: Robert Lubos --- drivers/serial/uart_nrfx_uarte2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index ebe85448cea..0b8350714eb 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -506,7 +506,6 @@ static int api_rx_enable(const struct device *dev, uint8_t *buf, size_t len, int * flags are already known to the driver (e.g. if flushed data shall be * kept or not). */ - adata->err = 0; adata->en_rx_buf = buf; adata->en_rx_len = len; From b137fa032545c264d78d38d446d42f126b8bf627 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2044/2300] Revert "[nrf fromtree] manifest: Update hal_nordic fix nrfx_uarte fixes" This reverts commit 7b8fb26cbfc35eb142438a957906d29a2f13c749. Signed-off-by: Robert Lubos --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 39252a3dfa4..9fdaa6b2be8 100644 --- a/west.yml +++ b/west.yml @@ -183,7 +183,7 @@ manifest: groups: - hal - name: hal_nordic - revision: f8e4d73a78316ea9ef85f09f24a3a229e40c1a80 + revision: fc2bab706f195c64d40016c9855b8acd7c235ded path: modules/hal/nordic groups: - hal From 67cc9ced5fdd9b9831a8aa9dd8d8ea13db57d8c3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2045/2300] Revert "[nrf fromlist] wifi: shell: Support WPA auto personal security mode" This reverts commit d39eff89a3ced3a9fdbdb5ad4d7cb513a9628ac7. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi.h | 2 -- subsys/net/l2/wifi/wifi_mgmt.c | 3 +-- subsys/net/l2/wifi/wifi_shell.c | 5 ++--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index ebfc76d2192..a0840a2319a 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -49,8 +49,6 @@ enum wifi_security_type { WIFI_SECURITY_TYPE_WEP, /** WPA-PSK security. */ WIFI_SECURITY_TYPE_WPA_PSK, - /** WPA/WPA2/WPA3 PSK security. */ - WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL, __WIFI_SECURITY_TYPE_AFTER_LAST, WIFI_SECURITY_TYPE_MAX = __WIFI_SECURITY_TYPE_AFTER_LAST - 1, diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 51e76aec5fb..72552d371d7 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -275,8 +275,7 @@ static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, (params->ssid_length == 0U) || ((params->security == WIFI_SECURITY_TYPE_PSK || params->security == WIFI_SECURITY_TYPE_WPA_PSK || - params->security == WIFI_SECURITY_TYPE_PSK_SHA256 || - params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) && + params->security == WIFI_SECURITY_TYPE_PSK_SHA256) && ((params->psk_length < 8) || (params->psk_length > 64) || (params->psk_length == 0U) || !params->psk)) || ((params->security == WIFI_SECURITY_TYPE_SAE) && diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 954b6aecc07..46a2457c6c8 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1904,9 +1904,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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" - "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP," - " 7: WPA-PSK, 8: WPA-Auto-Personal\n" + "[-k, --key-mgmt]: Key Management type\n" + "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n" "[-m, --bssid]: MAC address of the AP (BSSID).\n" From a45595d564a59b83286f3037f07accdc5f3ee9f9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2046/2300] Revert "[nrf fromlist] soc/nordic/comomn: Added HAS_HW_NRF_GPIO2" This reverts commit 12f0521d1fcaafc39f96e6804536b584644db433. Signed-off-by: Robert Lubos --- soc/nordic/common/Kconfig.peripherals | 3 --- 1 file changed, 3 deletions(-) diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index 817002f7282..bc79b63d1d8 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -74,9 +74,6 @@ config HAS_HW_NRF_GPIO0 config HAS_HW_NRF_GPIO1 def_bool $(dt_nodelabel_enabled_with_compat,gpio1,$(DT_COMPAT_NORDIC_NRF_GPIO)) -config HAS_HW_NRF_GPIO2 - def_bool $(dt_nodelabel_enabled_with_compat,gpio2,$(DT_COMPAT_NORDIC_NRF_GPIO)) - config HAS_HW_NRF_GPIOTE0 def_bool $(dt_nodelabel_enabled_with_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE)) From 80ac7e23707d2312ee4e0478048e138e5509c884 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2047/2300] Revert "[nrf fromtree] Bluetooth: Controller: Fix regression in BT_RX_STACK_SIZE use" This reverts commit 77a71701509491a6cf0a220b80537dff08ac304d. Signed-off-by: Robert Lubos --- .../hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf | 6 ++++++ .../hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf | 6 ++++++ .../hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf | 6 ++++++ .../hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf | 6 ++++++ .../nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf | 6 ++++++ .../nrf5340_cpunet_iso_central-bt_ll_sw_split.conf | 6 ++++++ .../nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf | 6 ++++++ .../nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf | 6 ++++++ samples/bluetooth/peripheral_hr/prj_minimal.conf | 1 + subsys/bluetooth/controller/Kconfig.ll_sw_split | 9 ++------- subsys/bluetooth/controller/hci/hci_driver.c | 2 +- subsys/bluetooth/host/Kconfig | 2 +- .../nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf | 6 ++++++ 13 files changed, 59 insertions(+), 9 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 6b407a208f7..f0a22f760f9 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 @@ -24,6 +24,12 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y 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 6dd49214caa..7fab285f3be 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 @@ -24,6 +24,12 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=n 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 ab87866b19a..21d4a042ad7 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 @@ -24,6 +24,12 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=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 0bb34dfa790..f80f324be53 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 @@ -25,6 +25,12 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=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 12f3b8a1147..74dc735c076 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 @@ -16,6 +16,12 @@ CONFIG_BT_HCI_RAW_RESERVE=1 # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + # Host CONFIG_BT_BROADCASTER=y CONFIG_BT_PERIPHERAL=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 e7ec0c140d6..f29917aaf93 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 @@ -21,6 +21,12 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + # Host CONFIG_BT_BROADCASTER=n CONFIG_BT_PERIPHERAL=n 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 fa3d303604e..ddd7d7e7b31 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 @@ -21,6 +21,12 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + # Host CONFIG_BT_BROADCASTER=y CONFIG_BT_PERIPHERAL=y 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 d139e83996a..d88aa87f8aa 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 @@ -16,6 +16,12 @@ CONFIG_BT_HCI_RAW_RESERVE=1 # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + # Host CONFIG_BT_BROADCASTER=n CONFIG_BT_PERIPHERAL=n diff --git a/samples/bluetooth/peripheral_hr/prj_minimal.conf b/samples/bluetooth/peripheral_hr/prj_minimal.conf index a9feeb48cb0..888c75d8a5d 100644 --- a/samples/bluetooth/peripheral_hr/prj_minimal.conf +++ b/samples/bluetooth/peripheral_hr/prj_minimal.conf @@ -69,6 +69,7 @@ CONFIG_ARM_MPU=n # idle 00 : STACK: unused 208 usage 48 / 256 (18 %); CPU: 97 % # main : STACK: unused 576 usage 448 / 1024 (43 %); CPU: 0 % CONFIG_BT_RX_STACK_SIZE=1024 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y CONFIG_BT_HCI_TX_STACK_SIZE=640 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index bce9b76186f..ba43622604a 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -99,15 +99,10 @@ config BT_CTLR_ULL_LLL_PRIO_SUPPORT bool config BT_CTLR_RX_PRIO_STACK_SIZE - # Hidden, Controller's Co-Operative high priority Rx thread stack size. - int + # Controller's Co-Operative high priority Rx thread stack size. + int "High priority Rx thread stack size" default 448 -config BT_CTLR_RX_STACK_SIZE - # Hidden, Controller's Co-Operative Rx thread stack size. - int - default 768 - config BT_CTLR_SETTINGS bool "Settings System" depends on SETTINGS diff --git a/subsys/bluetooth/controller/hci/hci_driver.c b/subsys/bluetooth/controller/hci/hci_driver.c index 9c66594bcda..cc315a99df6 100644 --- a/subsys/bluetooth/controller/hci/hci_driver.c +++ b/subsys/bluetooth/controller/hci/hci_driver.c @@ -73,7 +73,7 @@ struct k_thread prio_recv_thread_data; static K_KERNEL_STACK_DEFINE(prio_recv_thread_stack, CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE); struct k_thread recv_thread_data; -static K_KERNEL_STACK_DEFINE(recv_thread_stack, CONFIG_BT_CTLR_RX_STACK_SIZE); +static K_KERNEL_STACK_DEFINE(recv_thread_stack, CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE); #if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL) static struct k_poll_signal hbuf_signal; diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 1753c7a2d6a..0be375007ca 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -48,7 +48,7 @@ config BT_HCI_TX_STACK_SIZE default 512 if BT_H4 default 512 if BT_H5 default 416 if BT_SPI - default 1152 if BT_CTLR && BT_LL_SW_SPLIT && (NO_OPTIMIZATIONS || BT_ISO_BROADCAST) + default 940 if BT_CTLR && BT_LL_SW_SPLIT && (NO_OPTIMIZATIONS || BT_ISO_BROADCAST) default 1024 if BT_CTLR && BT_LL_SW_SPLIT && BT_CENTRAL default 768 if BT_CTLR && BT_LL_SW_SPLIT default 512 if BT_USERCHAN 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 4a53b153a5c..a3c8f43c71f 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 @@ -25,6 +25,12 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 +# Tx/Rx Thread Stack Sizes +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +CONFIG_BT_HCI_TX_STACK_SIZE=1152 +CONFIG_BT_RX_STACK_SIZE=640 +CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE=448 + # Host features CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y From a3f1e7717c42c7d2255df26e8b4487f3f7df54b2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2048/2300] Revert "[nrf fromlist] cmake: modules: extensions: Rename prefix in functions" This reverts commit 85ed6f2655de3528e58e766505a02bbd46dcbeaf. Signed-off-by: Robert Lubos --- cmake/modules/extensions.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 2c1866c422a..4c989e808ae 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -2865,9 +2865,9 @@ endfunction() # function(zephyr_file_suffix filename) set(single_args SUFFIX) - cmake_parse_arguments(SFILE "" "${single_args}" "" ${ARGN}) + cmake_parse_arguments(FILE "" "${single_args}" "" ${ARGN}) - if(NOT DEFINED SFILE_SUFFIX OR NOT DEFINED ${filename}) + if(NOT DEFINED FILE_SUFFIX OR NOT DEFINED ${filename}) # If the file suffix variable is not known then there is nothing to do, return early return() endif() @@ -2883,7 +2883,7 @@ function(zephyr_file_suffix filename) # Search for the full stop so we know where to add the file suffix before the file extension cmake_path(GET file EXTENSION file_ext) cmake_path(REMOVE_EXTENSION file OUTPUT_VARIABLE new_filename) - cmake_path(APPEND_STRING new_filename "_${SFILE_SUFFIX}${file_ext}") + cmake_path(APPEND_STRING new_filename "_${FILE_SUFFIX}${file_ext}") # Use the filename with the suffix if it exists, if not then fall back to the default if(EXISTS "${new_filename}") From ef55f970bb1b101a8a159921e7f490b6554fec69 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2049/2300] Revert "[nrf fromtree] boards: nrf54l15pdk_nrf54l15_cpuapp: add twister yaml for PDK 0.3.0" This reverts commit 2c8aad6f4ed4f550a01b86f935d145b5ad43b4e2. Signed-off-by: Robert Lubos --- .../nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml deleted file mode 100644 index a19bc8fdc8b..00000000000 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_0_3_0.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54l15pdk@0.3.0/nrf54l15/cpuapp -name: nRF54l15-PDK-nRF54l15-Application -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 256 -flash: 1536 -supported: - - counter - - gpio - - i2c - - spi - - watchdog - - i2s From 9fd1fd5ccc3f46d08cf98c86f6b8f2e1816062d9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2050/2300] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: Add configuration for BLE" This reverts commit 12bfeea211d9928d0fecfca8b45c42d3a81eafbe. Signed-off-by: Robert Lubos --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 13 +-------- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 13 +-------- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 27 +++++++++++++++++++ 3 files changed, 29 insertions(+), 24 deletions(-) create mode 100644 samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 93259180e43..f6427f477b2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -23,7 +23,6 @@ zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; zephyr,shell-uart = &uart136; - zephyr,bt-hci-ipc = &ipc0; }; aliases { @@ -94,34 +93,24 @@ status = "okay"; }; -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - &shared_ram3x_region { status = "okay"; }; &cpuapp_bellboard { - status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; /* irq0: 0: cpuapp-cpusec, 13: cpuapp-cpuppr, 18: cpuapp-cpurad */ nordic,interrupt-mapping = <0x00042001 0>; }; -&cpurad_bellboard { - status = "okay"; -}; - &cpusec_cpuapp_ipc { mbox-names = "tx", "rx"; tx-region = <&cpuapp_cpusec_ipc_shm>; rx-region = <&cpusec_cpuapp_ipc_shm>; }; -ipc0: &cpuapp_cpurad_ipc { - status = "okay"; +&cpuapp_cpurad_ipc { mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpurad_ipc_shm>; rx-region = <&cpurad_cpuapp_ipc_shm>; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index c0b9c0b47b7..2b970a1b3e2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -24,7 +24,6 @@ zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; zephyr,shell-uart = &uart135; - zephyr,bt-hci-ipc = &ipc0; }; }; @@ -32,30 +31,20 @@ status = "okay"; }; -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - &cpurad_bellboard { - status = "okay"; interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; interrupt-names = "irq0"; /* irq0: 0: cpurad-cpusec, 12: cpurad-cpuapp */ nordic,interrupt-mapping = <0x00001001 0>; }; -&cpuapp_bellboard { - status = "okay"; -}; - &cpusec_cpurad_ipc { mbox-names = "tx", "rx"; tx-region = <&cpurad_cpusec_ipc_shm>; rx-region = <&cpusec_cpurad_ipc_shm>; }; -ipc0: &cpuapp_cpurad_ipc { - status = "okay"; +&cpuapp_cpurad_ipc { mbox-names = "tx", "rx"; tx-region = <&cpurad_cpuapp_ipc_shm>; rx-region = <&cpuapp_cpurad_ipc_shm>; diff --git a/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 00000000000..02db7c39272 --- /dev/null +++ b/samples/bluetooth/hci_ipc/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,27 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,bt-hci-ipc = &ipc0; + }; +}; + +ipc0: &cpuapp_cpurad_ipc { + status = "okay"; +}; + +&cpuapp_cpurad_ram0x_region { + status = "okay"; +}; + +&cpurad_bellboard { + status = "okay"; +}; + +&cpuapp_bellboard { + status = "okay"; +}; From e2e61b28a4fe858b73a234958c5c0001f80e96dc Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2051/2300] Revert "[nrf fromlist] boards: nordic: nrf54h20dk: Change IPC default backend" This reverts commit 443cae032ef887b04063a8d25bf3a26d0acb20b7. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 3 +-- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index 539e80d149a..9c3d971b9bc 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -21,7 +21,6 @@ }; cpuapp_cpurad_ipc: ipc-2-3 { - compatible = "zephyr,ipc-icbmsg"; status = "disabled"; mboxes = <&cpuapp_bellboard 18>, <&cpurad_bellboard 12>; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index f6427f477b2..21a7b9ca7e2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -111,11 +111,10 @@ }; &cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-initiator"; mbox-names = "rx", "tx"; tx-region = <&cpuapp_cpurad_ipc_shm>; rx-region = <&cpurad_cpuapp_ipc_shm>; - tx-blocks = <32>; - rx-blocks = <32>; }; &cpuapp_cpuppr_ipc { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 2b970a1b3e2..a3d3736fde2 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -45,11 +45,10 @@ }; &cpuapp_cpurad_ipc { + compatible = "zephyr,ipc-icmsg-me-follower"; mbox-names = "tx", "rx"; tx-region = <&cpurad_cpuapp_ipc_shm>; rx-region = <&cpuapp_cpurad_ipc_shm>; - tx-blocks = <32>; - rx-blocks = <32>; }; &cpurad_dma_region { From 0fa3a6db9265dcb60f8707ea111901a6292f0ba3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2052/2300] Revert "[nrf fromtree] boards: nrf54h20dk: Enable shell input" This reverts commit b3ec34595efd1462c60b7b811d27f2e745c7ed9a. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 1 - 3 files changed, 3 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 21a7b9ca7e2..495271d576b 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -22,7 +22,6 @@ zephyr,code-partition = &cpuapp_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpuapp_data; - zephyr,shell-uart = &uart136; }; aliases { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts index 4cfad97323e..679afcdc8f9 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts @@ -26,7 +26,6 @@ zephyr,code-partition = &cpuppr_code_partition; zephyr,flash = &mram1x; zephyr,sram = &cpuppr_code_data; - zephyr,shell-uart = &uart135; }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index a3d3736fde2..b2f14ff2525 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -23,7 +23,6 @@ zephyr,code-partition = &cpurad_slot0_partition; zephyr,flash = &mram1x; zephyr,sram = &cpurad_ram0; - zephyr,shell-uart = &uart135; }; }; From d58765b22787d07633bb197dd8707336e9152907 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2053/2300] Revert "[nrf fromtree] boards: nordic: nrf54h20dk: enable HWFC" This reverts commit 4dd0af500d9911ce3953d29c0eb9cbbba8eefb08. Signed-off-by: Robert Lubos --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 1 - 3 files changed, 3 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 495271d576b..8c6512861e8 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -173,5 +173,4 @@ pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts index 679afcdc8f9..edce1a8b275 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts @@ -46,7 +46,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 b2f14ff2525..3efa07f6349 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -69,7 +69,6 @@ pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart136 { From 71173b9b093d1f967d99c9efc3bc3dbfa47b34b7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:19 +0200 Subject: [PATCH 2054/2300] Revert "[nrf fromlist] net: wifi: shell: Remove redundant break" This reverts commit da1af7e1288d011b76df72b71334749003ffa95b. Signed-off-by: Robert Lubos --- 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 46a2457c6c8..bae31b9c3ed 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -565,6 +565,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv break; case 'h': return -ENOEXEC; + break; default: PR_ERROR("Invalid option %c\n", opt); shell_help(sh); From 67d56b93cdb5db5835f6f52a2c41f7337f63635f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2055/2300] Revert "[nrf fromlist] net: wifi: shell: Correct help text for `connect` command" This reverts commit 73bef57621faa003a733c541fdcd8eeaeed75b44. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index bae31b9c3ed..99d49535fa0 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1905,7 +1905,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-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\n" + "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n" From a84a8bbc5f4a4717b84b98c63e857e6b706ba7f4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2056/2300] Revert "[nrf fromtree] net: wifi: shell: update wifi ap enable to use get opt parsing" This reverts commit 08dee4bd57722e199e249e4b87b7f9961e3c92de. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_shell.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 99d49535fa0..946a9b1939e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -496,8 +496,12 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv } break; case 'p': - params->psk = optarg; - params->psk_length = strlen(params->psk); + if (secure_connection) { + params->psk = optarg; + params->psk_length = strlen(params->psk); + } else { + PR_WARNING("Passphrase provided without security configuration\n"); + } break; case 'c': channel = strtol(optarg, &endptr, 10); @@ -564,7 +568,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv ¶ms->bssid[4], ¶ms->bssid[5]); break; case 'h': - return -ENOEXEC; + shell_help(sh); break; default: PR_ERROR("Invalid option %c\n", opt); @@ -572,9 +576,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv return -EINVAL; } } - if (params->psk && !secure_connection) { - PR_WARNING("Passphrase provided without security configuration\n"); - } + return 0; } @@ -1242,7 +1244,7 @@ static int cmd_wifi_ap_enable(const struct shell *sh, size_t argc, int ret; context.sh = sh; - if (__wifi_args_to_params(sh, argc, &argv[0], &cnx_params, WIFI_MODE_AP)) { + if (__wifi_args_to_params(sh, argc - 1, &argv[1], &cnx_params, WIFI_MODE_AP)) { shell_help(sh); return -ENOEXEC; } @@ -1845,18 +1847,15 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, 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" + "\"\"\n" + "\n" + "[PSK: valid only for secure SSIDs]\n" + "[Security type: valid only for secure SSIDs]\n" "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\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)", + "[MFP (optional: needs security type to be specified)]\n" + ": 0:Disable, 1:Optional, 2:Required.\n", cmd_wifi_ap_enable, - 2, 13), + 3, 3), SHELL_CMD_ARG(stations, NULL, "List stations connected to the AP", cmd_wifi_ap_stations, From 1b9c1836d067cf1665b7f5442b9e3e2d6b50b14f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2057/2300] Revert "[nrf fromtree] tests: drivers: clock_control: Add nRF54L15 to platform allow" This reverts commit 51c8066bf063263b457ecb3f6f179d80cd0238e8. Signed-off-by: Robert Lubos --- .../clock_control/clock_control_api/testcase.yaml | 2 -- .../clock_control/nrf_clock_calibration/testcase.yaml | 1 - .../clock_control/nrf_lf_clock_start/testcase.yaml | 9 --------- tests/drivers/clock_control/onoff/testcase.yaml | 1 - 4 files changed, 13 deletions(-) diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index 356893f400f..7a3552fd4e7 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -8,7 +8,6 @@ tests: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - nrf9160dk/nrf9160 - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 drivers.clock.clock_control_nrf5_lfclk_rc: @@ -19,7 +18,6 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_args: CONF_FILE="nrf_lfclk_rc.conf" diff --git a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml index e5f1248f5ec..2e2934b33ea 100644 --- a/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml +++ b/tests/drivers/clock_control/nrf_clock_calibration/testcase.yaml @@ -7,6 +7,5 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 diff --git a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml index c35d4529722..a5716326ab9 100644 --- a/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml +++ b/tests/drivers/clock_control/nrf_lf_clock_start/testcase.yaml @@ -13,7 +13,6 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l15pdk/nrf54l15/cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_STABILITY=y - CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y @@ -28,7 +27,6 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l15pdk/nrf54l15/cpuapp extra_configs: - CONFIG_SYSTEM_CLOCK_WAIT_FOR_AVAILABILITY=y - CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y @@ -43,7 +41,6 @@ tests: - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -57,7 +54,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -71,7 +67,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -85,7 +80,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -99,7 +93,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -113,7 +106,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: @@ -127,7 +119,6 @@ tests: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpunet - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf51dk/nrf51822 extra_configs: diff --git a/tests/drivers/clock_control/onoff/testcase.yaml b/tests/drivers/clock_control/onoff/testcase.yaml index 867ae2dce40..91239e3b538 100644 --- a/tests/drivers/clock_control/onoff/testcase.yaml +++ b/tests/drivers/clock_control/onoff/testcase.yaml @@ -7,7 +7,6 @@ tests: - nrf51dk/nrf51822 - nrf52dk/nrf52832 - nrf52840dk/nrf52840 - - nrf54l15pdk/nrf54l15/cpuapp - nrf9160dk/nrf9160 integration_platforms: - nrf51dk/nrf51822 From 6f3e5fb52be4150da2327bfe075b2b61b8a21392 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2058/2300] Revert "[nrf fromtree] boards: raytac: remove direct RESET register access" This reverts commit 2d2a2e0ae943910f1e005d9709b4df9e0d8b6206. Signed-off-by: Robert Lubos --- .../mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c | 3 +-- .../mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c b/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c index 64e335869fb..97ae3fc1bd0 100644 --- a/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c +++ b/boards/raytac/mdbt53_db_40/raytac_mdbt53_db_40_nrf5340_cpunet_reset.c @@ -10,7 +10,6 @@ #include #include -#include LOG_MODULE_REGISTER(raytac_mdbt53_db_40_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -50,7 +49,7 @@ static int remoteproc_mgr_boot(const struct device *dev) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release; LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c b/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c index ec4567274c4..fd48ae16fd6 100644 --- a/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c +++ b/boards/raytac/mdbt53v_db_40/raytac_mdbt53v_db_40_nrf5340_cpunet_reset.c @@ -49,7 +49,7 @@ static int remoteproc_mgr_boot(const struct device *dev) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release; LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ From 312f0bfc4ee9f598fc3db3d08123d0b1627a649f Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2059/2300] Revert "[nrf fromtree] boards: nrf53: switch to the network CPU management API" This reverts commit 955ca269dd22d14c7ae7ed061c0b402547e13834. Signed-off-by: Robert Lubos --- .../bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c | 4 ++-- .../nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c | 4 ++-- boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c | 4 ++-- boards/nordic/thingy53/board.c | 4 ++-- boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c | 4 ++-- drivers/bluetooth/hci/nrf53_support.c | 6 +++--- samples/subsys/ipc/ipc_service/icmsg/src/main.c | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c b/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c index c4f39467314..49c0e5a1c73 100644 --- a/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c +++ b/boards/lairdconnect/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_reset.c @@ -10,7 +10,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(bl5340_dvk_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -50,7 +50,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c index 3d08a5dd4cd..f9082e6ca40 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include LOG_MODULE_REGISTER(nrf5340_audio_dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -71,7 +71,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c b/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c index 3b85d55dfd0..dadba8c0f54 100644 --- a/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c +++ b/boards/nordic/nrf5340dk/nrf5340_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include LOG_MODULE_REGISTER(nrf5340dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -49,7 +49,7 @@ static int remoteproc_mgr_boot(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/nordic/thingy53/board.c b/boards/nordic/thingy53/board.c index 491808f236a..67059bd4ee8 100644 --- a/boards/nordic/thingy53/board.c +++ b/boards/nordic/thingy53/board.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include LOG_MODULE_REGISTER(thingy53_board_init); @@ -52,7 +52,7 @@ static void enable_cpunet(void) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); #endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ diff --git a/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c b/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c index cd8281cb2bf..bf0626ce30b 100644 --- a/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c +++ b/boards/panasonic/pan1783/pan1783_nrf5340_cpunet_reset.c @@ -9,7 +9,7 @@ #include #include -#include +#include #if defined(CONFIG_BOARD_PAN1783_EVB_NRF5340_CPUAPP) LOG_MODULE_REGISTER(pan1783_evb_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); @@ -42,7 +42,7 @@ static int remoteproc_mgr_boot(void) remoteproc_mgr_config(); /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); LOG_DBG("Network MCU released."); diff --git a/drivers/bluetooth/hci/nrf53_support.c b/drivers/bluetooth/hci/nrf53_support.c index 2d0f64ac428..995586eb325 100644 --- a/drivers/bluetooth/hci/nrf53_support.c +++ b/drivers/bluetooth/hci/nrf53_support.c @@ -6,7 +6,7 @@ #include #include -#include +#include #if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) #include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/debug.h> #else @@ -21,7 +21,7 @@ int bt_hci_transport_teardown(const struct device *dev) { ARG_UNUSED(dev); /* Put the Network MCU in Forced-OFF mode. */ - nrf53_cpunet_enable(false); + nrf_reset_network_force_off(NRF_RESET, true); LOG_DBG("Network MCU placed in Forced-OFF mode"); return 0; @@ -43,7 +43,7 @@ int bt_hci_transport_setup(const struct device *dev) #endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ /* Release the Network MCU, 'Release force off signal' */ - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); return 0; } diff --git a/samples/subsys/ipc/ipc_service/icmsg/src/main.c b/samples/subsys/ipc/ipc_service/icmsg/src/main.c index d10fa6c8bf6..3500b472e7d 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/src/main.c +++ b/samples/subsys/ipc/ipc_service/icmsg/src/main.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include "common.h" @@ -130,7 +130,7 @@ int main(void) k_msleep(500); LOG_INF("Stop network core"); - nrf53_cpunet_enable(false); + nrf_reset_network_force_off(NRF_RESET, true); LOG_INF("Reset IPC service"); @@ -158,7 +158,7 @@ int main(void) } LOG_INF("Run network core"); - nrf53_cpunet_enable(true); + nrf_reset_network_force_off(NRF_RESET, false); k_sem_take(&bound_sem, K_FOREVER); From 30a7732760184923bf7c8a9b5f72de2dde5bfa14 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2060/2300] Revert "[nrf fromtree] soc: nordic: nrf53: network CPU Force-OFF management" This reverts commit 4fa036ea4d3d2990f652f701b2c3877195e7ef7a. Signed-off-by: Robert Lubos --- soc/nordic/nrf53/CMakeLists.txt | 1 - soc/nordic/nrf53/Kconfig | 7 --- soc/nordic/nrf53/nrf53_cpunet_mgmt.c | 68 ---------------------------- soc/nordic/nrf53/nrf53_cpunet_mgmt.h | 31 ------------- 4 files changed, 107 deletions(-) delete mode 100644 soc/nordic/nrf53/nrf53_cpunet_mgmt.c delete mode 100644 soc/nordic/nrf53/nrf53_cpunet_mgmt.h diff --git a/soc/nordic/nrf53/CMakeLists.txt b/soc/nordic/nrf53/CMakeLists.txt index 145a425e55a..0e8b1e69a29 100644 --- a/soc/nordic/nrf53/CMakeLists.txt +++ b/soc/nordic/nrf53/CMakeLists.txt @@ -3,7 +3,6 @@ zephyr_library_sources(soc.c) zephyr_include_directories(.) -zephyr_library_sources_ifdef(CONFIG_SOC_NRF53_CPUNET_MGMT nrf53_cpunet_mgmt.c) zephyr_library_sources_ifdef(CONFIG_NRF53_SYNC_RTC sync_rtc.c) if (CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED AND diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index 5f0d5b12326..4c5fc5dc197 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -24,7 +24,6 @@ config SOC_NRF5340_CPUAPP select ARMV8_M_DSP select HAS_POWEROFF select SOC_COMPATIBLE_NRF5340_CPUAPP - select SOC_NRF53_CPUNET_MGMT imply SOC_NRF53_RTC_PRETICK imply SOC_NRF53_ANOMALY_168_WORKAROUND @@ -153,12 +152,6 @@ config SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 help hidden option for including the nRF GPIO pin forwarding -config SOC_NRF53_CPUNET_MGMT - bool - select ONOFF - help - hidden option for including the nRF53 network CPU management - if !TRUSTED_EXECUTION_NONSECURE || BUILD_WITH_TFM config SOC_ENABLE_LFXO diff --git a/soc/nordic/nrf53/nrf53_cpunet_mgmt.c b/soc/nordic/nrf53/nrf53_cpunet_mgmt.c deleted file mode 100644 index 57a23d29bb8..00000000000 --- a/soc/nordic/nrf53/nrf53_cpunet_mgmt.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file Nordic Semiconductor nRF53 processors family management helper for the network CPU. - */ - -#include - -#include -#include -#include -#include -#include - -#include - -static struct onoff_manager cpunet_mgr; - -static void onoff_start(struct onoff_manager *mgr, onoff_notify_fn notify) -{ - nrf_reset_network_force_off(NRF_RESET, false); - - notify(mgr, 0); -} - -static void onoff_stop(struct onoff_manager *mgr, onoff_notify_fn notify) -{ - nrf_reset_network_force_off(NRF_RESET, true); - - notify(mgr, 0); -} - -static int nrf53_cpunet_mgmt_init(void) -{ - static const struct onoff_transitions transitions = { - .start = onoff_start, - .stop = onoff_stop - }; - - return onoff_manager_init(&cpunet_mgr, &transitions); -} - -SYS_INIT(nrf53_cpunet_mgmt_init, PRE_KERNEL_1, 0); - -void nrf53_cpunet_enable(bool on) -{ - int ret; - int ignored; - struct onoff_client cli; - - if (on) { - sys_notify_init_spinwait(&cli.notify); - - ret = onoff_request(&cpunet_mgr, &cli); - __ASSERT_NO_MSG(ret >= 0); - - /* The transition is synchronous and shall take effect immediately. */ - ret = sys_notify_fetch_result(&cli.notify, &ignored); - } else { - ret = onoff_release(&cpunet_mgr); - } - - __ASSERT_NO_MSG(ret >= 0); -} diff --git a/soc/nordic/nrf53/nrf53_cpunet_mgmt.h b/soc/nordic/nrf53/nrf53_cpunet_mgmt.h deleted file mode 100644 index 0273061c20c..00000000000 --- a/soc/nordic/nrf53/nrf53_cpunet_mgmt.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file Nordic Semiconductor nRF53 processors family management helper for the network CPU. - */ - -#ifndef NRF53_CPUNET_MGMT_H__ -#define NRF53_CPUNET_MGMT_H__ - -#include - -/** - * @brief Enables or disables nRF53 network CPU. - * - * This function shall be used to control the network CPU exclusively. Internally, it keeps track of - * the requests to enable or disable nRF53 network CPU. It guarantees to enable the network CPU if - * at least one user requests it and to keep it enabled until all users release it. - * - * In conseqeuence, if @p on equals @c true then the network CPU is guaranteed to be enabled when - * this function returns. If @p on equals @c false then nothing can be inferred about the state of - * the network CPU when the function returns. - * - * @param on indicates whether the network CPU shall be powered on or off. - */ -void nrf53_cpunet_enable(bool on); - -#endif /* NRF53_CPUNET_MGMT_H__ */ From 6ef8283e713eae5e97e16c16efe184dcaffa5131 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2061/2300] Revert "[nrf fromtree] cmake: modules: boards: Add normalised variables" This reverts commit 1758a3204dd9627f78974cd0815a6df2c9519974. Signed-off-by: Robert Lubos --- cmake/modules/boards.cmake | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/cmake/modules/boards.cmake b/cmake/modules/boards.cmake index b1e2b21abce..cb07262f150 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -21,18 +21,13 @@ # Outcome: # The following variables will be defined when this CMake module completes: # -# - BOARD: Board, without revision field. -# - BOARD_REVISION: Board revision -# - BOARD_QUALIFIERS: Board qualifiers -# - NORMALIZED_BOARD_QUALIFIERS: Board qualifiers in lower-case format where slashes have been -# replaced with underscores -# - NORMALIZED_BOARD_TARGET: Board target in lower-case format where slashes have been -# replaced with underscores -# - BOARD_DIR: Board directory with the implementation for selected board -# - ARCH_DIR: Arch dir for extracted from selected board -# - BOARD_ROOT: BOARD_ROOT with ZEPHYR_BASE appended -# - BOARD_EXTENSION_DIRS: List of board extension directories (If -# BOARD_EXTENSIONS is not explicitly disabled) +# - BOARD: Board, without revision field. +# - BOARD_REVISION: Board revision +# - BOARD_DIR: Board directory with the implementation for selected board +# - ARCH_DIR: Arch dir for extracted from selected board +# - BOARD_ROOT: BOARD_ROOT with ZEPHYR_BASE appended +# - BOARD_EXTENSION_DIRS: List of board extension directories (If +# BOARD_EXTENSIONS is not explicitly disabled) # # The following targets will be defined when this CMake module completes: # - board: when invoked, a list of valid boards will be printed @@ -341,13 +336,8 @@ endif() if(DEFINED BOARD_QUALIFIERS) string(REGEX REPLACE "^/" "qualifiers: " board_message_qualifiers "${BOARD_QUALIFIERS}") set(board_message "${board_message}, ${board_message_qualifiers}") - - string(REPLACE "/" "_" NORMALIZED_BOARD_QUALIFIERS "${BOARD_QUALIFIERS}") endif() -set(NORMALIZED_BOARD_TARGET "${BOARD}${BOARD_QUALIFIERS}") -string(REPLACE "/" "_" NORMALIZED_BOARD_TARGET "${NORMALIZED_BOARD_TARGET}") - message(STATUS "${board_message}") add_custom_target(boards ${list_boards_commands} USES_TERMINAL) From 836ba54539a2061e8ff29cf2805fbda767d0fa15 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2062/2300] Revert "[nrf fromlist] boards: Fix doc build warnings" This reverts commit ffbf62c7753b85cb9e274bef5fef441c871d7f4c. Signed-off-by: Robert Lubos --- boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 | 2 +- boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb | 2 +- boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk | 4 ++-- boards/nxp/imx93_evk/Kconfig.imx93_evk | 4 ++-- boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 | 4 ++-- boards/rak/rak5010/Kconfig.rak5010 | 2 +- boards/starfive/visionfive2/Kconfig.visionfive2 | 2 +- boards/ti/sk_am62/Kconfig.sk_am62 | 6 ++++-- boards/we/proteus2ev/Kconfig.we_proteus2ev | 2 +- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 b/boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 index 1abf2e23fd8..2b69264a29c 100644 --- a/boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 +++ b/boards/bcdevices/plt_demo_v2/Kconfig.blueclover_plt_demo_v2 @@ -3,5 +3,5 @@ # Copyright (c) 2021 Blue Clover # SPDX-License-Identifier: Apache-2.0 -config BOARD_BLUECLOVER_PLT_DEMO_V2 +config BOARD_BLUECLOVER_PLT_DEMO_V2_NRF52832 select SOC_NRF52832_QFAA diff --git a/boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb b/boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb index 60fa87104fc..8a04ffd502d 100644 --- a/boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb +++ b/boards/ebyte/e73_tbb/Kconfig.ebyte_e73_tbb @@ -3,5 +3,5 @@ # Copyright (c) 2021 Michal Morsisko # SPDX-License-Identifier: Apache-2.0 -config BOARD_EBYTE_E73_TBB +config BOARD_EBYTE_E73_TBB_NRF52832 select SOC_NRF52832_QFAA diff --git a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk index 12f6e2efd48..4ec5b6ee62d 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk +++ b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk @@ -1,5 +1,5 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config BOARD_NRF54L15PDK - select SOC_NRF54L15_ENGA_CPUAPP if BOARD_NRF54L15PDK_NRF54L15_CPUAPP +config BOARD_NRF54L15PDK_NRF54L15_CPUAPP + select SOC_NRF54L15_ENGA_CPUAPP diff --git a/boards/nxp/imx93_evk/Kconfig.imx93_evk b/boards/nxp/imx93_evk/Kconfig.imx93_evk index 0115518a6d2..e3121418393 100644 --- a/boards/nxp/imx93_evk/Kconfig.imx93_evk +++ b/boards/nxp/imx93_evk/Kconfig.imx93_evk @@ -1,6 +1,6 @@ # Copyright 2022,2024 NXP # SPDX-License-Identifier: Apache-2.0 -config BOARD_IMX93_EVK - select SOC_MIMX9352_A55 if BOARD_IMX93_EVK_MIMX9352_A55 +config BOARD_IMX93_EVK_MIMX9352_A55 + select SOC_MIMX9352_A55 select SOC_PART_NUMBER_MIMX9352CVUXK diff --git a/boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 b/boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 index 081124dd1a8..cfd9ba449db 100644 --- a/boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 +++ b/boards/nxp/vmu_rt1170/Kconfig.vmu_rt1170 @@ -1,6 +1,6 @@ # Copyright 2023 NXP # SPDX-License-Identifier: Apache-2.0 -config BOARD_VMU_RT1170 - select SOC_MIMXRT1176_CM7 if BOARD_VMU_RT1170_MIMXRT1176_CM7 +config BOARD_VMU_RT1170_MIMXRT1176_CM7 + select SOC_MIMXRT1176_CM7 select SOC_PART_NUMBER_MIMXRT1176DVMAA diff --git a/boards/rak/rak5010/Kconfig.rak5010 b/boards/rak/rak5010/Kconfig.rak5010 index 4c5db16669d..ced2b62b39c 100644 --- a/boards/rak/rak5010/Kconfig.rak5010 +++ b/boards/rak/rak5010/Kconfig.rak5010 @@ -3,5 +3,5 @@ # Copyright (c) 2020 Guillaume Paquet # SPDX-License-Identifier: Apache-2.0 -config BOARD_RAK5010 +config BOARD_RAK5010_NRF52840 select SOC_NRF52840_QIAA diff --git a/boards/starfive/visionfive2/Kconfig.visionfive2 b/boards/starfive/visionfive2/Kconfig.visionfive2 index d2988440b2d..e451964f979 100644 --- a/boards/starfive/visionfive2/Kconfig.visionfive2 +++ b/boards/starfive/visionfive2/Kconfig.visionfive2 @@ -1,5 +1,5 @@ # Copyright (c) 2024 Kanak Shilledar # SPDX-License-Identifier: Apache-2.0 -config BOARD_VISIONFIVE2 +config BOARD_VISIONFIVE2_JH7110 select SOC_JH7110 diff --git a/boards/ti/sk_am62/Kconfig.sk_am62 b/boards/ti/sk_am62/Kconfig.sk_am62 index fab6d884508..d7e83cba87a 100644 --- a/boards/ti/sk_am62/Kconfig.sk_am62 +++ b/boards/ti/sk_am62/Kconfig.sk_am62 @@ -5,5 +5,7 @@ # # SPDX-License-Identifier: Apache-2.0 -config BOARD_SK_AM62 - select SOC_AM6234_M4 if BOARD_SK_AM62_AM6234_M4 +config BOARD_SK_AM62_AM6234_M4 + select SOC_AM6234_M4 + help + TI AM62x M4 Starter Kit (SK) Evaluation Module (EVM) diff --git a/boards/we/proteus2ev/Kconfig.we_proteus2ev b/boards/we/proteus2ev/Kconfig.we_proteus2ev index b18f4c4f9bb..60aa73fb142 100644 --- a/boards/we/proteus2ev/Kconfig.we_proteus2ev +++ b/boards/we/proteus2ev/Kconfig.we_proteus2ev @@ -1,5 +1,5 @@ # Copyright (c) 2022 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -config BOARD_WE_PROTEUS2EV +config BOARD_WE_PROTEUS2EV_NRF52832 select SOC_NRF52832_CIAA From f75408c7898546c50ce438906f9f7afa6a304a90 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2063/2300] Revert "[nrf fromlist] samples: net: tftp_client: do not allow native_posix" This reverts commit 1552882744a9ce10e528f2c4a60bdf5de48e2352. Signed-off-by: Robert Lubos --- samples/net/tftp_client/sample.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/net/tftp_client/sample.yaml b/samples/net/tftp_client/sample.yaml index 6e53b0f1881..3ccedecafe9 100644 --- a/samples/net/tftp_client/sample.yaml +++ b/samples/net/tftp_client/sample.yaml @@ -6,6 +6,7 @@ tests: harness: net depends_on: netif platform_allow: + - native_posix - native_sim integration_platforms: - native_sim From da5c65ba992c0deb90c34a519ee0bd5a27bd0b51 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2064/2300] Revert "[nrf fromlist] samples: net: Disable native_posix target in more samples" This reverts commit cce72196f80c7a5e37cc6c3d9059e35153f08abc. Signed-off-by: Robert Lubos --- samples/net/sockets/can/sample.yaml | 4 ---- samples/net/sockets/dumb_http_server_mt/sample.yaml | 4 ---- samples/net/sockets/http_client/sample.yaml | 4 ---- samples/net/sockets/packet/sample.yaml | 2 ++ samples/net/sockets/txtime/sample.yaml | 2 ++ samples/net/sockets/websocket_client/sample.yaml | 4 ---- 6 files changed, 4 insertions(+), 16 deletions(-) diff --git a/samples/net/sockets/can/sample.yaml b/samples/net/sockets/can/sample.yaml index a9dff7079d3..4e1d9d1c9fa 100644 --- a/samples/net/sockets/can/sample.yaml +++ b/samples/net/sockets/can/sample.yaml @@ -8,10 +8,6 @@ common: filter: dt_chosen_enabled("zephyr,canbus") and not dt_compat_enabled("kvaser,pcican") depends_on: can harness: console - # native_posix does not work with CONFIG_POSIX_API - platform_exclude: - - native_posix - - native_posix/native/64 tests: sample.net.sockets.can.one_socket: extra_configs: diff --git a/samples/net/sockets/dumb_http_server_mt/sample.yaml b/samples/net/sockets/dumb_http_server_mt/sample.yaml index dc0c8182246..fa69fea8c97 100644 --- a/samples/net/sockets/dumb_http_server_mt/sample.yaml +++ b/samples/net/sockets/dumb_http_server_mt/sample.yaml @@ -9,10 +9,6 @@ common: - net - socket - http - # native_posix does not work with CONFIG_POSIX_API - platform_exclude: - - native_posix - - native_posix/native/64 tests: sample.net.sockets.dumb_http_server_mt: extra_configs: diff --git a/samples/net/sockets/http_client/sample.yaml b/samples/net/sockets/http_client/sample.yaml index afd14a1a255..271f61b94ec 100644 --- a/samples/net/sockets/http_client/sample.yaml +++ b/samples/net/sockets/http_client/sample.yaml @@ -5,10 +5,6 @@ common: - http_client min_ram: 32 depends_on: netif - # native_posix does not work with CONFIG_POSIX_API - platform_exclude: - - native_posix - - native_posix/native/64 sample: description: HTTP client sample name: http_client diff --git a/samples/net/sockets/packet/sample.yaml b/samples/net/sockets/packet/sample.yaml index 723978b5de8..dc816ac52e8 100644 --- a/samples/net/sockets/packet/sample.yaml +++ b/samples/net/sockets/packet/sample.yaml @@ -5,6 +5,8 @@ tests: sample.net.sockets.packet: harness: net platform_allow: + - native_posix + - native_posix/native/64 - native_sim - native_sim/native/64 integration_platforms: diff --git a/samples/net/sockets/txtime/sample.yaml b/samples/net/sockets/txtime/sample.yaml index 18613f4b87a..feb099bd63b 100644 --- a/samples/net/sockets/txtime/sample.yaml +++ b/samples/net/sockets/txtime/sample.yaml @@ -3,6 +3,8 @@ common: depends_on: netif # We can only run this in platforms that support PTP clock and TXTIME platform_allow: + - native_posix + - native_posix/native/64 - native_sim - native_sim/native/64 - qemu_x86 diff --git a/samples/net/sockets/websocket_client/sample.yaml b/samples/net/sockets/websocket_client/sample.yaml index df7603cf1a1..a0472b856f9 100644 --- a/samples/net/sockets/websocket_client/sample.yaml +++ b/samples/net/sockets/websocket_client/sample.yaml @@ -7,10 +7,6 @@ common: - websocket min_ram: 35 depends_on: netif - # native_posix does not work with CONFIG_POSIX_API - platform_exclude: - - native_posix - - native_posix/native/64 sample: description: Websocket client sample name: websocket_client From c1acd25504fb3ffe84ac9d0dae2884ad3e762412 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2065/2300] Revert "[nrf fromlist] net: wifi: Unicast frames statistics" This reverts commit 634bfae60938f9b005f6a14aa15e88798458fbd3. Signed-off-by: Robert Lubos --- include/zephyr/net/net_stats.h | 1 - subsys/net/l2/wifi/wifi_shell.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/include/zephyr/net/net_stats.h b/include/zephyr/net/net_stats.h index f5a567fcdbc..ddaa8d1180f 100644 --- a/include/zephyr/net/net_stats.h +++ b/include/zephyr/net/net_stats.h @@ -494,7 +494,6 @@ struct net_stats_wifi { struct net_stats_pkts broadcast; struct net_stats_pkts multicast; struct net_stats_pkts errors; - struct net_stats_pkts unicast; }; #if defined(CONFIG_NET_STATISTICS_USER_API) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 946a9b1939e..cc7ca355a6d 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -849,8 +849,6 @@ static void print_wifi_stats(struct net_if *iface, struct net_stats_wifi *data, PR("Mcast sent : %u\n", data->multicast.tx); PR("Beacons received : %u\n", data->sta_mgmt.beacons_rx); PR("Beacons missed : %u\n", data->sta_mgmt.beacons_miss); - PR("Unicast received : %u\n", data->unicast.rx); - PR("Unicast sent : %u\n", data->unicast.tx); } #endif /* CONFIG_NET_STATISTICS_WIFI && CONFIG_NET_STATISTICS_USER_API */ From 4b26c7f4712f4f2afddbc0eb8c7f6753b98cdcd3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2066/2300] Revert "[nrf fromtree] drivers: clock_control: Update XTAL accuracy on nRF54L" This reverts commit b320a9e142f2249008f7c2c8e9a5b625a6fe56b6. Signed-off-by: Robert Lubos --- drivers/clock_control/Kconfig.nrf | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index 725a7694986..8b30772f26c 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -132,7 +132,6 @@ choice CLOCK_CONTROL_NRF_ACCURACY_PPM prompt "32KHz clock accuracy" default CLOCK_CONTROL_NRF_K32SRC_500PPM if CLOCK_CONTROL_NRF_K32SRC_RC && SOC_COMPATIBLE_NRF52X default CLOCK_CONTROL_NRF_K32SRC_250PPM if CLOCK_CONTROL_NRF_K32SRC_RC - default CLOCK_CONTROL_NRF_K32SRC_150PPM if CLOCK_CONTROL_NRF_K32SRC_XTAL && SOC_SERIES_NRF54LX default CLOCK_CONTROL_NRF_K32SRC_50PPM config CLOCK_CONTROL_NRF_K32SRC_500PPM From 5ee33809e60bfe198c8fe91188b8b14fb7344961 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:20 +0200 Subject: [PATCH 2067/2300] Revert "[nrf fromtree] net: l2: wifi: Fix for wrong return type" This reverts commit 2ef7c817ee362e88376e36e60c4a4a5dee6a3a94. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_nm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_nm.c b/subsys/net/l2/wifi/wifi_nm.c index 588992634bf..b365f32cbc6 100644 --- a/subsys/net/l2/wifi/wifi_nm.c +++ b/subsys/net/l2/wifi/wifi_nm.c @@ -27,7 +27,7 @@ struct wifi_nm_instance *wifi_nm_get_instance(const char *name) struct wifi_nm_instance *wifi_nm_get_instance_iface(struct net_if *iface) { if (!iface || !net_if_is_wifi(iface)) { - return NULL; + return false; } k_mutex_lock(&wifi_nm_lock, K_FOREVER); From 30d9f6eaa7caf2d9c2ee60206b340b03e5e859fe Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2068/2300] Revert "[nrf fromtree] net: l2: wifi: Protect processing of nm data" This reverts commit 570c8c21ab04bcda1059cbb2af3ee872d4a6d364. Signed-off-by: Robert Lubos --- subsys/net/l2/wifi/wifi_nm.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_nm.c b/subsys/net/l2/wifi/wifi_nm.c index b365f32cbc6..4f3e2d239a1 100644 --- a/subsys/net/l2/wifi/wifi_nm.c +++ b/subsys/net/l2/wifi/wifi_nm.c @@ -10,9 +10,6 @@ LOG_MODULE_REGISTER(wifi_nm, CONFIG_WIFI_NM_LOG_LEVEL); #include #include -/* Used to protect nm data */ -static K_MUTEX_DEFINE(wifi_nm_lock); - struct wifi_nm_instance *wifi_nm_get_instance(const char *name) { STRUCT_SECTION_FOREACH(wifi_nm_instance, nm) { @@ -30,16 +27,13 @@ struct wifi_nm_instance *wifi_nm_get_instance_iface(struct net_if *iface) return false; } - k_mutex_lock(&wifi_nm_lock, K_FOREVER); STRUCT_SECTION_FOREACH(wifi_nm_instance, nm) { for (int i = 0; i < CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES; i++) { if (nm->mgd_ifaces[i] == iface) { - k_mutex_unlock(&wifi_nm_lock); return nm; } } } - k_mutex_unlock(&wifi_nm_lock); return NULL; } @@ -54,15 +48,12 @@ int wifi_nm_register_mgd_iface(struct wifi_nm_instance *nm, struct net_if *iface return -ENOTSUP; } - k_mutex_lock(&wifi_nm_lock, K_FOREVER); for (int i = 0; i < CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES; i++) { if (!nm->mgd_ifaces[i]) { nm->mgd_ifaces[i] = iface; - k_mutex_unlock(&wifi_nm_lock); return 0; } } - k_mutex_unlock(&wifi_nm_lock); return -ENOMEM; } @@ -73,15 +64,12 @@ int wifi_nm_unregister_mgd_iface(struct wifi_nm_instance *nm, struct net_if *ifa return -EINVAL; } - k_mutex_lock(&wifi_nm_lock, K_FOREVER); for (int i = 0; i < CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES; i++) { if (nm->mgd_ifaces[i] == iface) { nm->mgd_ifaces[i] = NULL; - k_mutex_unlock(&wifi_nm_lock); return 0; } } - k_mutex_unlock(&wifi_nm_lock); return -ENOENT; } From e6bd3552739a3b160e3b57e82b3ba0d8ee4f5904 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2069/2300] Revert "[nrf fromtree] drivers: clock_control: Update RC accuracy nRF devices" This reverts commit f50ad41dd6ea61d36bece05171768e12f5ceb5a3. Signed-off-by: Robert Lubos --- drivers/clock_control/Kconfig.nrf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index 8b30772f26c..453aac5b5d0 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -130,8 +130,7 @@ endif # CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION choice CLOCK_CONTROL_NRF_ACCURACY_PPM prompt "32KHz clock accuracy" - default CLOCK_CONTROL_NRF_K32SRC_500PPM if CLOCK_CONTROL_NRF_K32SRC_RC && SOC_COMPATIBLE_NRF52X - default CLOCK_CONTROL_NRF_K32SRC_250PPM if CLOCK_CONTROL_NRF_K32SRC_RC + default CLOCK_CONTROL_NRF_K32SRC_500PPM if CLOCK_CONTROL_NRF_K32SRC_RC default CLOCK_CONTROL_NRF_K32SRC_50PPM config CLOCK_CONTROL_NRF_K32SRC_500PPM From a71c656fc53b389ccf18dd51cfdc59016f7ff4b0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2070/2300] Revert "[nrf fromtree] doc: release-notes: Set RTS threshold" This reverts commit 253ee08dec4dbd4a11ba0402a1c62aff8878497d. Signed-off-by: Robert Lubos --- doc/releases/release-notes-3.7.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index d362eac0598..a98211d48ac 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -178,9 +178,6 @@ Drivers and Sensors * Wi-Fi - * Added support for configuring RTS threshold. With this, users can set the RTS threshold value or - disable the RTS mechanism. - Networking ********** From 70113899325c78311bbead1719b416301f1c966d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2071/2300] Revert "[nrf fromtree] net: wifi_mgmt: Setting RTS threshold" This reverts commit 63c8c9de984dbb59e3ca42ce00484c632fa3350e. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 15 ------------- subsys/net/l2/wifi/wifi_mgmt.c | 20 ----------------- subsys/net/l2/wifi/wifi_shell.c | 40 --------------------------------- 3 files changed, 75 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 70fd5978fba..c1fa8145dbf 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -82,8 +82,6 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_AP_STA_DISCONNECT, /** Get Wi-Fi driver and Firmware versions */ NET_REQUEST_WIFI_CMD_VERSION, - /** Set RTS threshold */ - NET_REQUEST_WIFI_CMD_RTS_THRESHOLD, NET_REQUEST_WIFI_CMD_MAX }; @@ -161,10 +159,6 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION); -#define NET_REQUEST_WIFI_RTS_THRESHOLD \ - (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_RTS_THRESHOLD) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD); /** Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -858,15 +852,6 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*get_version)(const struct device *dev, struct wifi_version *params); - /** Set RTS threshold value - * - * @param dev Pointer to the device structure for the driver instance. - * @param RTS threshold value - * - * @return 0 if ok, < 0 if error - */ - int (*set_rts_threshold)(const struct device *dev, unsigned int rts_threshold); - }; /** Wi-Fi management offload API */ diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 72552d371d7..5ef047e6c72 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -719,26 +719,6 @@ static int wifi_get_version(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION, wifi_get_version); -static int wifi_set_rts_threshold(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); - unsigned int *rts_threshold = data; - - if (wifi_mgmt_api == NULL || wifi_mgmt_api->set_rts_threshold == NULL) { - return -ENOTSUP; - } - - if (!data || len != sizeof(*rts_threshold)) { - return -EINVAL; - } - - return wifi_mgmt_api->set_rts_threshold(dev, *rts_threshold); -} - -NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD, wifi_set_rts_threshold); - #ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface, struct wifi_raw_scan_result *raw_scan_result) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index cc7ca355a6d..3eb4dac5ddd 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1479,40 +1479,6 @@ static int cmd_wifi_ps_wakeup_mode(const struct shell *sh, size_t argc, char *ar return 0; } -static int cmd_wifi_set_rts_threshold(const struct shell *sh, size_t argc, char *argv[]) -{ - struct net_if *iface = net_if_get_first_wifi(); - unsigned int rts_threshold = -1; /* Default value if user supplies "off" argument */ - int err = 0; - - context.sh = sh; - - if (strcmp(argv[1], "off") != 0) { - long rts_val = shell_strtol(argv[1], 10, &err); - - if (err) { - shell_error(sh, "Unable to parse input (err %d)", err); - return err; - } - - rts_threshold = (unsigned int)rts_val; - } - - if (net_mgmt(NET_REQUEST_WIFI_RTS_THRESHOLD, iface, - &rts_threshold, sizeof(rts_threshold))) { - shell_fprintf(sh, SHELL_WARNING, - "Setting RTS threshold failed.\n"); - return -ENOEXEC; - } - - if ((int)rts_threshold >= 0) - shell_fprintf(sh, SHELL_NORMAL, "RTS threshold: %d\n", rts_threshold); - else - shell_fprintf(sh, SHELL_NORMAL, "RTS threshold is off\n"); - - return 0; -} - void parse_mode_args_to_params(const struct shell *sh, int argc, char *argv[], struct wifi_mode_info *mode, bool *do_mode_oper) @@ -2010,12 +1976,6 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, cmd_wifi_ps_wakeup_mode, 2, 0), - SHELL_CMD_ARG(rts_threshold, - NULL, - ".\n", - cmd_wifi_set_rts_threshold, - 2, - 0), SHELL_SUBCMD_SET_END ); From d1c0c9f1f2a463ca44348b2b58ec4d5162e048bf Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2072/2300] Revert "[nrf fromlist] tests: adc: Add overlay for nRF54L15 PDK for adc_api test" This reverts commit 2da6498dc8195a3d8946f78c63046c18cdb2d1f2. Signed-off-by: Robert Lubos --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 tests/drivers/adc/adc_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/adc/adc_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index e10ddc54328..00000000000 --- a/tests/drivers/adc/adc_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2024 Nordic Semiconductor ASA - */ - -/ { - zephyr,user { - io-channels = <&adc 0>, <&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@2 { - reg = <2>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; - zephyr,resolution = <10>; - }; -}; From c6af21d9e447ebfc763889239174724e7ed370b1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2073/2300] Revert "[nrf fromlist] samples: adc: Add overlay for nRF54L15 PDK" This reverts commit 51f7968750ed8fdce6b59eeebaeae2c0e40eb932. Signed-off-by: Robert Lubos --- .../nrf54l15pdk_nrf54l15_cpuapp.overlay | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 samples/drivers/adc/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/samples/drivers/adc/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/samples/drivers/adc/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay deleted file mode 100644 index f185624f9b9..00000000000 --- a/samples/drivers/adc/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright (c) 2024 Nordic Semiconductor ASA - */ - -/ { - zephyr,user { - io-channels = <&adc 0>, <&adc 1>, <&adc 7>; - }; -}; - -&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 = ; /* P1.11 */ - zephyr,resolution = <10>; - }; - - channel@1 { - reg = <1>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.06 */ - zephyr,resolution = <12>; - zephyr,oversampling = <8>; - }; - - channel@7 { - reg = <7>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,input-positive = ; /* P1.13 */ - zephyr,input-negative = ; /* P1.14 */ - zephyr,resolution = <12>; - }; -}; From 572a46afb8bf67dffd4646d42721447277015115 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2074/2300] Revert "[nrf fromlist] drivers: adc: Update adc driver to support nRF54L15 device" This reverts commit 57de7d1fc50de73d1d24791f7ec2d6dc00e8ad6f. Signed-off-by: Robert Lubos --- drivers/adc/adc_nrfx_saadc.c | 189 +++++++---------------------------- 1 file changed, 36 insertions(+), 153 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index e5e658c893a..6d1973ca0aa 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -6,7 +6,7 @@ #define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" -#include +#include #include #define LOG_LEVEL CONFIG_ADC_LOG_LEVEL @@ -16,20 +16,6 @@ LOG_MODULE_REGISTER(adc_nrfx_saadc); #define DT_DRV_COMPAT nordic_nrf_saadc -#if (NRF_SAADC_HAS_AIN_AS_PIN) - -static const uint8_t saadc_psels[NRF_SAADC_AIN7 + 1] = { - [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), - [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), - [NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), - [NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), - [NRF_SAADC_AIN4] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), - [NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), - [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(13U, 1), - [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(14U, 1), -}; - -#else BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && (NRF_SAADC_AIN1 == NRF_SAADC_INPUT_AIN1) && (NRF_SAADC_AIN2 == NRF_SAADC_INPUT_AIN2) && @@ -42,12 +28,8 @@ BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && #if defined(SAADC_CH_PSELP_PSELP_VDDHDIV5) (NRF_SAADC_VDDHDIV5 == NRF_SAADC_INPUT_VDDHDIV5) && #endif -#if defined(SAADC_CH_PSELP_PSELP_VDD) - (NRF_SAADC_VDD == NRF_SAADC_INPUT_VDD) && -#endif - 1, + (NRF_SAADC_VDD == NRF_SAADC_INPUT_VDD), "Definitions from nrf-adc.h do not match those from nrf_saadc.h"); -#endif struct driver_data { struct adc_context ctx; @@ -61,158 +43,85 @@ static struct driver_data m_data = { ADC_CONTEXT_INIT_SYNC(m_data, ctx), }; -/* Helper function to convert number of samples to the byte representation. */ -static uint32_t samples_to_bytes(const struct adc_sequence *sequence, uint16_t number_of_samples) -{ - if (NRF_SAADC_8BIT_SAMPLE_WIDTH == 8 && sequence->resolution == 8) { - return number_of_samples; - } - - return number_of_samples * 2; -} - -/* Helper function to convert acquisition time to register TACQ value. */ -static int adc_convert_acq_time(uint16_t acquisition_time, nrf_saadc_acqtime_t *p_tacq_val) -{ - int result = 0; - -#if NRF_SAADC_HAS_ACQTIME_ENUM - switch (acquisition_time) { - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 3): - *p_tacq_val = NRF_SAADC_ACQTIME_3US; - break; - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 5): - *p_tacq_val = NRF_SAADC_ACQTIME_5US; - break; - case ADC_ACQ_TIME_DEFAULT: - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10): - *p_tacq_val = NRF_SAADC_ACQTIME_10US; - break; - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 15): - *p_tacq_val = NRF_SAADC_ACQTIME_15US; - break; - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 20): - *p_tacq_val = NRF_SAADC_ACQTIME_20US; - break; - case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40): - *p_tacq_val = NRF_SAADC_ACQTIME_40US; - break; - default: - result = -EINVAL; - } -#else -#define MINIMUM_ACQ_TIME_IN_NS 125 -#define DEFAULT_ACQ_TIME_IN_NS 10000 - - nrf_saadc_acqtime_t tacq = 0; - uint16_t acq_time = - (acquisition_time == ADC_ACQ_TIME_DEFAULT - ? DEFAULT_ACQ_TIME_IN_NS - : (ADC_ACQ_TIME_VALUE(acquisition_time) * - (ADC_ACQ_TIME_UNIT(acquisition_time) == ADC_ACQ_TIME_MICROSECONDS - ? 1000 - : 1))); - - tacq = (nrf_saadc_acqtime_t)(acq_time / MINIMUM_ACQ_TIME_IN_NS) - 1; - if ((tacq > NRF_SAADC_ACQTIME_MAX) || (acq_time < MINIMUM_ACQ_TIME_IN_NS)) { - result = -EINVAL; - } else { - *p_tacq_val = tacq; - } -#endif - - return result; -} /* Implementation of the ADC driver API function: adc_channel_setup. */ static int adc_nrfx_channel_setup(const struct device *dev, const struct adc_channel_cfg *channel_cfg) { nrf_saadc_channel_config_t config = { -#if NRF_SAADC_HAS_CH_CONFIG_RES - .resistor_p = NRF_SAADC_RESISTOR_DISABLED, - .resistor_n = NRF_SAADC_RESISTOR_DISABLED, -#endif - .burst = NRF_SAADC_BURST_DISABLED, + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, + .burst = NRF_SAADC_BURST_DISABLED, }; uint8_t channel_id = channel_cfg->channel_id; - uint32_t input_negative = channel_cfg->input_negative; if (channel_id >= SAADC_CH_NUM) { return -EINVAL; } switch (channel_cfg->gain) { -#if defined(SAADC_CH_CONFIG_GAIN_Gain1_6) case ADC_GAIN_1_6: config.gain = NRF_SAADC_GAIN1_6; break; -#endif -#if defined(SAADC_CH_CONFIG_GAIN_Gain1_5) case ADC_GAIN_1_5: config.gain = NRF_SAADC_GAIN1_5; break; -#endif -#if defined(SAADC_CH_CONFIG_GAIN_Gain1_4) case ADC_GAIN_1_4: config.gain = NRF_SAADC_GAIN1_4; break; -#endif -#if defined(SAADC_CH_CONFIG_GAIN_Gain1_3) case ADC_GAIN_1_3: config.gain = NRF_SAADC_GAIN1_3; break; -#endif -#if defined(SAADC_CH_CONFIG_GAIN_Gain1_2) case ADC_GAIN_1_2: config.gain = NRF_SAADC_GAIN1_2; break; -#endif -#if defined(SAADC_CH_CONFIG_GAIN_Gain2_3) - case ADC_GAIN_2_3: - config.gain = NRF_SAADC_GAIN2_3; - break; -#endif case ADC_GAIN_1: config.gain = NRF_SAADC_GAIN1; break; case ADC_GAIN_2: config.gain = NRF_SAADC_GAIN2; break; -#if defined(SAADC_CH_CONFIG_GAIN_Gain4) case ADC_GAIN_4: config.gain = NRF_SAADC_GAIN4; break; -#endif default: LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; } switch (channel_cfg->reference) { -#if defined(SAADC_CH_CONFIG_REFSEL_Internal) case ADC_REF_INTERNAL: config.reference = NRF_SAADC_REFERENCE_INTERNAL; break; -#endif -#if defined(SAADC_CH_CONFIG_REFSEL_VDD1_4) case ADC_REF_VDD_1_4: config.reference = NRF_SAADC_REFERENCE_VDD4; break; -#endif -#if defined(SAADC_CH_CONFIG_REFSEL_External) - case ADC_REF_EXTERNAL0: - config.reference = NRF_SAADC_REFERENCE_EXTERNAL; - break; -#endif default: LOG_ERR("Selected ADC reference is not valid"); return -EINVAL; } - int ret = adc_convert_acq_time(channel_cfg->acquisition_time, &config.acq_time); - - if (ret) { + switch (channel_cfg->acquisition_time) { + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 3): + config.acq_time = NRF_SAADC_ACQTIME_3US; + break; + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 5): + config.acq_time = NRF_SAADC_ACQTIME_5US; + break; + case ADC_ACQ_TIME_DEFAULT: + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10): + config.acq_time = NRF_SAADC_ACQTIME_10US; + break; + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 15): + config.acq_time = NRF_SAADC_ACQTIME_15US; + break; + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 20): + config.acq_time = NRF_SAADC_ACQTIME_20US; + break; + case ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40): + config.acq_time = NRF_SAADC_ACQTIME_40US; + break; + default: LOG_ERR("Selected ADC acquisition time is not valid"); return -EINVAL; } @@ -225,37 +134,17 @@ static int adc_nrfx_channel_setup(const struct device *dev, * in a sampling sequence. */ -#if (NRF_SAADC_HAS_AIN_AS_PIN) - if ((channel_cfg->input_positive > NRF_SAADC_AIN7) || - (channel_cfg->input_positive < NRF_SAADC_AIN0)) { - return -EINVAL; - } - - if (config.mode == NRF_SAADC_MODE_DIFFERENTIAL) { - if (input_negative > NRF_SAADC_AIN7 || - input_negative < NRF_SAADC_AIN0) { - return -EINVAL; - } - - input_negative = saadc_psels[input_negative]; - } else { - input_negative = NRF_SAADC_INPUT_DISABLED; - } + nrf_saadc_channel_init(NRF_SAADC, channel_id, &config); + nrf_saadc_channel_input_set(NRF_SAADC, + channel_id, + NRF_SAADC_INPUT_DISABLED, + channel_cfg->input_negative); /* Store the positive input selection in a dedicated array, * to get it later when the channel is selected for a sampling * and to mark the channel as configured (ready to be selected). */ - m_data.positive_inputs[channel_id] = saadc_psels[channel_cfg->input_positive]; -#else m_data.positive_inputs[channel_id] = channel_cfg->input_positive; -#endif - - nrf_saadc_channel_init(NRF_SAADC, channel_id, &config); - nrf_saadc_channel_input_set(NRF_SAADC, - channel_id, - NRF_SAADC_INPUT_DISABLED, - input_negative); return 0; } @@ -279,11 +168,10 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx, ARG_UNUSED(ctx); if (!repeat) { - nrf_saadc_value_t *buffer = - (uint8_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + - samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); - - nrfy_saadc_buffer_pointer_set(NRF_SAADC, buffer); + nrf_saadc_buffer_pointer_set( + NRF_SAADC, + (uint16_t *)nrf_saadc_buffer_pointer_get(NRF_SAADC) + + nrf_saadc_amount_get(NRF_SAADC)); } } @@ -368,8 +256,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, { size_t needed_buffer_size; - needed_buffer_size = samples_to_bytes(sequence, active_channels); - + needed_buffer_size = active_channels * sizeof(uint16_t); if (sequence->options) { needed_buffer_size *= (1 + sequence->options->extra_samplings); } @@ -542,11 +429,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) - .ref_internal = 900, -#else .ref_internal = 600, -#endif }; /* From 99e7115c1b6bbebab35256658be8121eae9207e0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2075/2300] Revert "[nrf fromtree] drivers: pinctrl_nrf: Configure QSPI IO3 pin as output set high" This reverts commit 3733e7097909ae964e60cf66e4d51ade975ddcae. Signed-off-by: Robert Lubos --- drivers/pinctrl/pinctrl_nrf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 0bf09e5e460..950037bc8ab 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -355,8 +355,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, break; case NRF_FUN_QSPI_IO3: NRF_PSEL_QSPI(reg, IO3) = psel; - write = 1U; - dir = NRF_GPIO_PIN_DIR_OUTPUT; + dir = NRF_GPIO_PIN_DIR_INPUT; input = NRF_GPIO_PIN_INPUT_DISCONNECT; break; #endif /* defined(NRF_PSEL_QSPI) */ From 828f357398b34f15f5b71dcb67d13c5e10cf01b4 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2076/2300] Revert "[nrf fromtree] modules: hal_nordic: nrfx: add support for nRF54 TWIS" This reverts commit 28e2f57a34fbf79e4f45ea5f2d6a242b7b60c4f5. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/Kconfig | 60 --------------------------- modules/hal_nordic/nrfx/nrfx_config.h | 36 ---------------- 2 files changed, 96 deletions(-) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 32386d54274..ba36da42a12 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -771,66 +771,6 @@ config NRFX_TWIS3 depends on $(dt_nodelabel_has_compat,i2c3,$(DT_COMPAT_NORDIC_NRF_TWIS)) select NRFX_TWIS -config NRFX_TWIS20 - bool "TWIS20 driver instance" - depends on $(dt_nodelabel_has_compat,i2c20,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS21 - bool "TWIS21 driver instance" - depends on $(dt_nodelabel_has_compat,i2c21,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS22 - bool "TWIS22 driver instance" - depends on $(dt_nodelabel_has_compat,i2c22,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS30 - bool "TWIS30 driver instance" - depends on $(dt_nodelabel_has_compat,i2c30,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS130 - bool "TWIS130 driver instance" - depends on $(dt_nodelabel_has_compat,i2c130,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS131 - bool "TWIS131 driver instance" - depends on $(dt_nodelabel_has_compat,i2c131,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS132 - bool "TWIS132 driver instance" - depends on $(dt_nodelabel_has_compat,i2c132,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS133 - bool "TWIS133 driver instance" - depends on $(dt_nodelabel_has_compat,i2c133,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS134 - bool "TWIS134 driver instance" - depends on $(dt_nodelabel_has_compat,i2c134,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS135 - bool "TWIS135 driver instance" - depends on $(dt_nodelabel_has_compat,i2c135,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS136 - bool "TWIS136 driver instance" - depends on $(dt_nodelabel_has_compat,i2c136,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - -config NRFX_TWIS137 - bool "TWIS137 driver instance" - depends on $(dt_nodelabel_has_compat,i2c137,$(DT_COMPAT_NORDIC_NRF_TWIS)) - select NRFX_TWIS - config NRFX_UART bool diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index e7120b54ab7..9357bddab0a 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -679,42 +679,6 @@ #ifdef CONFIG_NRFX_TWIS3 #define NRFX_TWIS3_ENABLED 1 #endif -#ifdef CONFIG_NRFX_TWIS20 -#define NRFX_TWIS20_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS21 -#define NRFX_TWIS21_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS22 -#define NRFX_TWIS22_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS30 -#define NRFX_TWIS30_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS130 -#define NRFX_TWIS130_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS131 -#define NRFX_TWIS131_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS132 -#define NRFX_TWIS132_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS133 -#define NRFX_TWIS133_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS134 -#define NRFX_TWIS134_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS135 -#define NRFX_TWIS135_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS136 -#define NRFX_TWIS136_ENABLED 1 -#endif -#ifdef CONFIG_NRFX_TWIS137 -#define NRFX_TWIS137_ENABLED 1 -#endif #ifdef CONFIG_NRFX_UART #define NRFX_UART_ENABLED 1 From fdbce7ca4a2b320e3e55646f1ed2aff7230a3f38 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2077/2300] Revert "[nrf fromtree] modules: hal_nordic: Extend SPI configuration" This reverts commit f706d530ad301755b02fba26a8216978cba7f682. Signed-off-by: Robert Lubos --- modules/hal_nordic/nrfx/nrfx_config.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 9357bddab0a..60fcd276ea4 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -381,10 +381,8 @@ #ifdef CONFIG_NRFX_SPIM4 #define NRFX_SPIM4_ENABLED 1 #endif - -#define NRFX_SPIM_DT_HAS_RX_DELAY(node) DT_PROP(node, rx_delay_supported) + - -#if DT_FOREACH_STATUS_OKAY(nordic_nrf_spim, NRFX_SPIM_DT_HAS_RX_DELAY) 0 +#if (DT_PROP(DT_NODELABEL(spi3), rx_delay_supported) || \ + DT_PROP(DT_NODELABEL(spi4), rx_delay_supported)) #define NRFX_SPIM_EXTENDED_ENABLED 1 #endif #ifdef CONFIG_NRFX_SPIM00 From 38ae26e4212fae82a3c40f40087b4035c137497d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2078/2300] Revert "[nrf fromlist] drivers: serial: nrf: Adapt config deps to nrf54h20" This reverts commit 5660de700fced8de58b33ae9da90852633e78310. Signed-off-by: Robert Lubos --- drivers/serial/Kconfig.nrfx_uart_instance | 2 +- modules/hal_nordic/nrfx/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index b8a62084ce5..9e992ca9737 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -87,7 +87,7 @@ config UART_$(nrfx_uart_num)_TX_CACHE_SIZE config UART_$(nrfx_uart_num)_RX_CACHE_SIZE int "RX cache buffer size" depends on !UART_NRFX_UARTE_LEGACY_SHIM - default 32 if $(dt_nodelabel_has_compat,shared_ram3x_region,$(DT_COMPAT_NORDIC_OWNED_MEMORY)) + default 32 if $(dt_nodelabel_has_compat,ram3x,$(DT_COMPAT_MMIO_SRAM)) default 5 range 5 255 help diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index ba36da42a12..541d9fac5e7 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -886,7 +886,7 @@ config NRFX_UARTE_CONFIG_TX_LINK config NRFX_UARTE_CONFIG_RX_CACHE_ENABLED bool "UARTE RX caching support" - default y if $(dt_nodelabel_has_compat,shared_ram3x_region,$(DT_COMPAT_NORDIC_OWNED_MEMORY)) + default y if $(dt_nodelabel_has_compat,ram3x,$(DT_COMPAT_MMIO_SRAM)) depends on NRFX_UARTE help Feature might be enabled on platforms which has limitations regarding addresses From aa7f28a49a35c287d3f83625753ada3151cf69aa Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2079/2300] Revert "[nrf fromlist] tests: drivers: uart: uart_pm: Minor adjustments" This reverts commit a412cab08dd77e6020d443506052d82c17e21f36. Signed-off-by: Robert Lubos --- tests/drivers/uart/uart_pm/src/main.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/drivers/uart/uart_pm/src/main.c b/tests/drivers/uart/uart_pm/src/main.c index 07e75ec8dd6..6b640853b90 100644 --- a/tests/drivers/uart/uart_pm/src/main.c +++ b/tests/drivers/uart/uart_pm/src/main.c @@ -34,10 +34,7 @@ static void polling_verify(const struct device *dev, bool is_async, bool active) for (int i = 0; i < ARRAY_SIZE(outs); i++) { uart_poll_out(dev, outs[i]); - /* We need to wait until receiver gets the data. Receiver may have - * RX timeout so data is not received instantly. - */ - k_busy_wait(5000); + k_busy_wait(1000); if (active) { err = uart_poll_in(dev, &c); @@ -81,12 +78,6 @@ static bool async_verify(const struct device *dev, bool active) zassert_equal(err, 0, "Unexpected err: %d", err); - /* Wait a bit to ensure that polling transfer is already finished otherwise - * receiver might be enabled when there is an ongoing transfer and bytes - * will get corrupted. - */ - k_busy_wait(1000); - if (!DISABLED_RX) { err = uart_rx_enable(dev, rxbuf, sizeof(rxbuf), 1 * USEC_PER_MSEC); zassert_equal(err, 0, "Unexpected err: %d", err); @@ -99,7 +90,7 @@ static bool async_verify(const struct device *dev, bool active) if (!DISABLED_RX) { err = uart_rx_disable(dev); - zassert_true((err == 0) || (err == -EFAULT)); + zassert_equal(err, 0, "Unexpected err: %d", err); k_busy_wait(10000); From 38777ba368489f3260f23e85d2bb042ddb5ef78a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:21 +0200 Subject: [PATCH 2080/2300] Revert "[nrf fromlist] tests: drivers: uart: uart_pm: Change pm action call" This reverts commit 8e66a574d232953317299cf7bcfdac5b030839fb. Signed-off-by: Robert Lubos --- tests/drivers/uart/uart_pm/src/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/drivers/uart/uart_pm/src/main.c b/tests/drivers/uart/uart_pm/src/main.c index 6b640853b90..7f3782ee615 100644 --- a/tests/drivers/uart/uart_pm/src/main.c +++ b/tests/drivers/uart/uart_pm/src/main.c @@ -203,36 +203,36 @@ ZTEST(uart_pm, test_uart_pm_poll_tx) communication_verify(dev, true); } -static void work_handler(struct k_work *work) +static void timeout(struct k_timer *timer) { - const struct device *dev = DEVICE_DT_GET(UART_NODE); + const struct device *uart = k_timer_user_data_get(timer); - action_run(dev, PM_DEVICE_ACTION_SUSPEND, 0); + action_run(uart, PM_DEVICE_ACTION_SUSPEND, 0); } +static K_TIMER_DEFINE(pm_timer, timeout, NULL); + /* Test going into low power state after interrupting poll out. Use various * delays to test interruption at multiple places. */ ZTEST(uart_pm, test_uart_pm_poll_tx_interrupted) { - static struct k_work_delayable dwork; - static struct k_work_sync sync; const struct device *dev; char str[] = "test"; dev = DEVICE_DT_GET(UART_NODE); zassert_true(device_is_ready(dev), "uart device is not ready"); - k_work_init_delayable(&dwork, work_handler); + k_timer_user_data_set(&pm_timer, (void *)dev); for (int i = 1; i < 100; i++) { - k_work_schedule(&dwork, K_USEC(i * 10)); + k_timer_start(&pm_timer, K_USEC(i * 10), K_NO_WAIT); for (int j = 0; j < sizeof(str); j++) { uart_poll_out(dev, str[j]); } - k_work_flush_delayable(&dwork, &sync); + k_timer_status_sync(&pm_timer); action_run(dev, PM_DEVICE_ACTION_RESUME, 0); From fed77174de9275861babde92174be2fa96420fb1 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2081/2300] Revert "[nrf fromtree] drivers: serial: uart_async_to_irq: Move resetting" This reverts commit f5c0d3105ef9baefc05ef14f7f823df79662becf. Signed-off-by: Robert Lubos --- drivers/serial/uart_async_to_irq.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/serial/uart_async_to_irq.c b/drivers/serial/uart_async_to_irq.c index eed05e88e6d..59216cbc13d 100644 --- a/drivers/serial/uart_async_to_irq.c +++ b/drivers/serial/uart_async_to_irq.c @@ -107,10 +107,6 @@ static void on_rx_dis(const struct device *dev, struct uart_async_to_irq_data *d if (data->flags & A2I_RX_ENABLE) { int err; - if (data->rx.async_rx.pending_bytes == 0) { - uart_async_rx_reset(&data->rx.async_rx); - } - err = try_rx_enable(dev, data); if (err == 0) { data->rx.pending_buf_req = 0; @@ -335,6 +331,7 @@ int uart_async_to_irq_rx_enable(const struct device *dev) return err; } + uart_async_rx_reset(&data->rx.async_rx); err = try_rx_enable(dev, data); if (err == 0) { @@ -358,8 +355,6 @@ int uart_async_to_irq_rx_disable(const struct device *dev) k_sem_take(&data->rx.sem, K_FOREVER); } - uart_async_rx_reset(&data->rx.async_rx); - return 0; } From aa79f4bd154ebb706e3dcebb214aaf889cac2719 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2082/2300] Revert "[nrf fromlist] drivers: serial: uart_nrfx_uarte2: Prevent TX in suspend" This reverts commit 6e61c5e595bbbccd46d6828bdecb11ac073be28f. Signed-off-by: Robert Lubos --- drivers/serial/uart_nrfx_uarte2.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index 0b8350714eb..cf109c32d8e 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -385,15 +385,6 @@ static int api_tx(const struct device *dev, const uint8_t *buf, size_t len, int3 nrfx_err_t err; bool hwfc; -#if CONFIG_PM_DEVICE - enum pm_device_state state; - - (void)pm_device_state_get(dev, &state); - if (state != PM_DEVICE_STATE_ACTIVE) { - return 0; - } -#endif - #if CONFIG_UART_USE_RUNTIME_CONFIGURE hwfc = data->uart_config.flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS; #else @@ -583,15 +574,6 @@ static void api_poll_out(const struct device *dev, unsigned char out_char) const nrfx_uarte_t *nrfx_dev = get_nrfx_dev(dev); nrfx_err_t err; -#if CONFIG_PM_DEVICE - enum pm_device_state state; - - (void)pm_device_state_get(dev, &state); - if (state != PM_DEVICE_STATE_ACTIVE) { - return; - } -#endif - do { /* When runtime PM is used we cannot use early return because then * we have no information when UART is actually done with the From c9c69ada7ffd38afc966629f3e36d6bb23abec44 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2083/2300] Revert "[nrf fromlist] tests: drivers: counter: counter_basic_api: Add nrf54h20" This reverts commit 09df3e05ad7ed1e6f0b7400efef5d31fdbdc06a2. Signed-off-by: Robert Lubos --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 58 -------------- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 77 ------------------- 2 files changed, 135 deletions(-) delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay delete mode 100644 tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay deleted file mode 100644 index 8cabf100ae2..00000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ /dev/null @@ -1,58 +0,0 @@ -&timer120 { - status = "okay"; - prescaler = <7>; -}; - -&timer121 { - status = "okay"; - prescaler = <7>; -}; - -&timer130 { - status = "okay"; - prescaler = <4>; -}; - -&timer131 { - status = "okay"; - prescaler = <4>; -}; - -&timer132 { - status = "okay"; - prescaler = <4>; -}; - -&timer133 { - status = "okay"; - prescaler = <4>; -}; - -&timer134 { - status = "okay"; - prescaler = <4>; -}; - -&timer135 { - status = "okay"; - prescaler = <4>; -}; - -&timer136 { - status = "okay"; - prescaler = <4>; -}; - -&timer137 { - status = "okay"; - prescaler = <4>; -}; - -&rtc130 { - status = "okay"; - ppi-wrap; -}; - -&rtc131 { - status = "okay"; -}; diff --git a/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay deleted file mode 100644 index 7cacbc5d7ec..00000000000 --- a/tests/drivers/counter/counter_basic_api/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ /dev/null @@ -1,77 +0,0 @@ -&timer020 { - status = "okay"; - prescaler = <7>; -}; - -&timer021 { - status = "okay"; - prescaler = <7>; -}; - -&timer022 { - status = "okay"; - prescaler = <7>; -}; - -&timer120 { - status = "okay"; - prescaler = <7>; -}; - -&timer121 { - status = "okay"; - prescaler = <7>; -}; - -&timer130 { - status = "okay"; - prescaler = <4>; -}; - -&timer131 { - status = "okay"; - prescaler = <4>; -}; - -&timer132 { - status = "okay"; - prescaler = <4>; -}; - -&timer133 { - status = "okay"; - prescaler = <4>; -}; - -&timer134 { - status = "okay"; - prescaler = <4>; -}; - -&timer135 { - status = "okay"; - prescaler = <4>; -}; - -&timer136 { - status = "okay"; - prescaler = <4>; -}; - -&timer137 { - status = "okay"; - prescaler = <4>; -}; - -&rtc130 { - status = "okay"; - ppi-wrap; -}; - -&rtc131 { - status = "okay"; -}; - -&rtc { - status = "okay"; -}; From 64d1e170e15d05f600e094b350af274b724bf24e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2084/2300] Revert "[nrf fromlist] twister: pytest: hardware_adapter: adapt to nrfutil." This reverts commit ddca5117acdf51a52bfa09649ac4c9c3fb8a1e43. Signed-off-by: Robert Lubos --- .../src/twister_harness/device/hardware_adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py index 5a5a845c3a1..4a6967b6372 100644 --- a/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py +++ b/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py @@ -70,7 +70,7 @@ def _prepare_runner_args(self) -> tuple[list[str], list[str]]: if runner == 'pyocd': extra_args.append('--board-id') extra_args.append(board_id) - elif runner in ('nrfjprog', 'nrfutil'): + elif runner == 'nrfjprog': extra_args.append('--dev-id') extra_args.append(board_id) elif runner == 'openocd' and self.device_config.product in ['STM32 STLink', 'STLINK-V3']: From 60143b0aa8f9781727e265313f185f3ca1283e50 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2085/2300] Revert "[nrf fromtree] drivers: Extend coverage for i2s driver" This reverts commit c90430fac16392db6d5a724c1c6faf1248f3a093. Signed-off-by: Robert Lubos --- tests/drivers/i2s/i2s_api/src/main.c | 1 - .../drivers/i2s/i2s_api/src/test_i2s_errors.c | 153 ------------------ 2 files changed, 154 deletions(-) delete mode 100644 tests/drivers/i2s/i2s_api/src/test_i2s_errors.c diff --git a/tests/drivers/i2s/i2s_api/src/main.c b/tests/drivers/i2s/i2s_api/src/main.c index febb721932d..82a4dba5f9c 100644 --- a/tests/drivers/i2s/i2s_api/src/main.c +++ b/tests/drivers/i2s/i2s_api/src/main.c @@ -78,4 +78,3 @@ ZTEST_SUITE(i2s_loopback, NULL, setup, before, NULL, NULL); ZTEST_SUITE(i2s_states, NULL, setup, before, NULL, NULL); ZTEST_SUITE(i2s_dir_both_states, NULL, setup, before_dir_both, NULL, NULL); ZTEST_SUITE(i2s_dir_both_loopback, NULL, setup, before_dir_both, NULL, NULL); -ZTEST_SUITE(i2s_errors, NULL, setup, before, NULL, NULL); diff --git a/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c b/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c deleted file mode 100644 index 477292d84c2..00000000000 --- a/tests/drivers/i2s/i2s_api/src/test_i2s_errors.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include "i2s_api_test.h" - -#define INVALID_TRIGGER_SETTING 7 - -ZTEST_USER(i2s_errors, test_i2s_improper_configuration) -{ - int err; - struct i2s_config invalid_config = { .word_size = 16U, - .channels = 2U, - .format = I2S_FMT_DATA_FORMAT_I2S, - .frame_clk_freq = FRAME_CLK_FREQ, - .block_size = BLOCK_SIZE, - .timeout = TIMEOUT, - .options = I2S_OPT_FRAME_CLK_MASTER | - I2S_OPT_BIT_CLK_MASTER, - .mem_slab = &tx_mem_slab }; - - - invalid_config.format = - I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED | I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED; - - err = i2s_configure(dev_i2s, I2S_DIR_TX, &invalid_config); - zassert_not_equal( - err, 0, - "I2S configuration did not detect improper data format (I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED | I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED)"); - - invalid_config.format = I2S_FMT_DATA_FORMAT_I2S | I2S_FMT_DATA_ORDER_LSB; - - err = i2s_configure(dev_i2s, I2S_DIR_TX, &invalid_config); - zassert_not_equal( - err, 0, - "I2S configuration did not detect improper stream format (I2S_FMT_DATA_ORDER_LSB)"); - - invalid_config.format = I2S_FMT_DATA_FORMAT_I2S; - invalid_config.channels = 3U; - err = i2s_configure(dev_i2s, I2S_DIR_TX, &invalid_config); - zassert_not_equal(err, 0, - "I2S configuration did not detect improper channels configuration (3)"); -} - -ZTEST_USER(i2s_errors, test_i2s_config_attempt_in_wrong_state) -{ - int err; - int config_err; - char tx_data[BLOCK_SIZE] = {0}; - struct i2s_config inactive_config = { .word_size = 16U, - .channels = 2U, - .format = I2S_FMT_DATA_FORMAT_I2S, - .frame_clk_freq = FRAME_CLK_FREQ, - .block_size = BLOCK_SIZE, - .timeout = TIMEOUT, - .options = I2S_OPT_FRAME_CLK_MASTER | - I2S_OPT_BIT_CLK_MASTER, - .mem_slab = &tx_mem_slab }; - - err = i2s_configure(dev_i2s, I2S_DIR_TX, &inactive_config); - zassert_equal(err, 0, "I2S interface configuration failed, err=%d", err); - - err = i2s_buf_write(dev_i2s, tx_data, BLOCK_SIZE); - zassert_equal(err, 0, "I2S buffer write unexpected error: %d", err); - - err = i2s_trigger(dev_i2s, I2S_DIR_TX, I2S_TRIGGER_START); - zassert_equal(err, 0, "I2S_TRIGGER_START unexpected error: %d", err); - - config_err = i2s_configure(dev_i2s, I2S_DIR_TX, &inactive_config); - - err = i2s_trigger(dev_i2s, I2S_DIR_TX, I2S_TRIGGER_STOP); - zassert_equal(err, 0, "I2S_TRIGGER_STOP unexpected error: %d", err); - - zassert_not_equal( - config_err, 0, - "I2S configuration should not be possible in states other than I2S_STATE_READY"); -} - -ZTEST_USER(i2s_errors, test_i2s_incorrect_trigger) -{ - int err; - char tx_data[BLOCK_SIZE] = {0}; - struct i2s_config test_config = { .word_size = 16U, - .channels = 2U, - .format = I2S_FMT_DATA_FORMAT_I2S, - .frame_clk_freq = FRAME_CLK_FREQ, - .block_size = BLOCK_SIZE, - .timeout = TIMEOUT, - .options = - I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_MASTER, - .mem_slab = &tx_mem_slab }; - - err = i2s_configure(dev_i2s, I2S_DIR_TX, &test_config); - zassert_equal(err, 0, "CFG err=%d", err); - - err = i2s_buf_write(dev_i2s, tx_data, BLOCK_SIZE); - zassert_equal(err, 0, "I2S buffer write unexpected error: %d", err); - - err = i2s_trigger(dev_i2s, I2S_DIR_TX, INVALID_TRIGGER_SETTING); - zassert_equal(err, -EINVAL, "I2S invalid trigger setting not detected: err=%d", err); -} - -ZTEST_USER(i2s_errors, test_i2s_unconfigured_access) -{ - int err; - char tx_data[BLOCK_SIZE] = {0}; - struct i2s_config inactive_config = { .word_size = 16U, - .channels = 2U, - .format = I2S_FMT_DATA_FORMAT_I2S, - .frame_clk_freq = 0, - .block_size = BLOCK_SIZE, - .timeout = TIMEOUT, - .options = I2S_OPT_FRAME_CLK_MASTER | - I2S_OPT_BIT_CLK_MASTER, - .mem_slab = &tx_mem_slab }; - - err = i2s_configure(dev_i2s, I2S_DIR_TX, &inactive_config); - zassert_equal(err, 0, "I2S interface NOT_READY state transition failed. err=%d", err); - - err = i2s_buf_write(dev_i2s, tx_data, BLOCK_SIZE); - zassert_equal( - err, -EIO, - "I2S attempting unconfigured interface access did not raise I/O error, err=%d", - err); -} - -ZTEST_USER(i2s_errors, test_i2s_improper_block_size_write) -{ - int err; - char tx_data[BLOCK_SIZE] = {0}; - struct i2s_config test_config = { .word_size = 16U, - .channels = 2U, - .format = I2S_FMT_DATA_FORMAT_I2S, - .frame_clk_freq = FRAME_CLK_FREQ, - .block_size = BLOCK_SIZE, - .timeout = TIMEOUT, - .options = - I2S_OPT_FRAME_CLK_MASTER | I2S_OPT_BIT_CLK_MASTER, - .mem_slab = &tx_mem_slab }; - - err = i2s_configure(dev_i2s, I2S_DIR_TX, &test_config); - zassert_equal(err, 0, "Unexpected error when configuring I2S interface: %d", err); - - err = i2s_buf_write(dev_i2s, tx_data, sizeof(uint16_t) + BLOCK_SIZE); - zassert_not_equal( - err, 0, - "I2S attempting write with incorrect block size did not raise error, err=%d", err); -} From a8aa4c869999b34a66c133e8a130ba890cde6404 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2086/2300] Revert "[nrf noup] modules: mbedtls: add PSA configurations" This reverts commit 5c484901b955fb78e97b9f76cb51fd38433fd4f2. Signed-off-by: Robert Lubos --- modules/mbedtls/Kconfig.psa | 65 +++++++++++++++---------------------- 1 file changed, 26 insertions(+), 39 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa index 27e50381779..9a0be3c4063 100644 --- a/modules/mbedtls/Kconfig.psa +++ b/modules/mbedtls/Kconfig.psa @@ -34,27 +34,24 @@ menu "PSA key type support" config PSA_HAS_KEY_SUPPORT bool default y - depends on PSA_WANT_KEY_TYPE_DERIVE || \ - PSA_WANT_KEY_TYPE_HMAC || \ - PSA_WANT_KEY_TYPE_RAW_DATA || \ - PSA_WANT_KEY_TYPE_PASSWORD || \ - PSA_WANT_KEY_TYPE_PASSWORD_HASH || \ - PSA_WANT_KEY_TYPE_PEPPER || \ - PSA_WANT_KEY_TYPE_AES || \ - PSA_WANT_KEY_TYPE_ARIA || \ - PSA_WANT_KEY_TYPE_DES || \ - PSA_WANT_KEY_TYPE_CAMELLIA || \ - PSA_WANT_KEY_TYPE_SM4 || \ - PSA_WANT_KEY_TYPE_ARC4 || \ - PSA_WANT_KEY_TYPE_CHACHA20 || \ - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE || \ - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT || \ - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT || \ - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE || \ - PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY || \ - PSA_WANT_KEY_TYPE_RSA_KEY_PAIR || \ - PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || \ - PSA_WANT_KEY_TYPE_DH_KEY_PAIR || \ + depends on PSA_WANT_KEY_TYPE_DERIVE || \ + PSA_WANT_KEY_TYPE_HMAC || \ + PSA_WANT_KEY_TYPE_RAW_DATA || \ + PSA_WANT_KEY_TYPE_PASSWORD || \ + PSA_WANT_KEY_TYPE_PASSWORD_HASH || \ + PSA_WANT_KEY_TYPE_PEPPER || \ + PSA_WANT_KEY_TYPE_AES || \ + PSA_WANT_KEY_TYPE_ARIA || \ + PSA_WANT_KEY_TYPE_DES || \ + PSA_WANT_KEY_TYPE_CAMELLIA || \ + PSA_WANT_KEY_TYPE_SM4 || \ + PSA_WANT_KEY_TYPE_ARC4 || \ + PSA_WANT_KEY_TYPE_CHACHA20 || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR || \ + PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR || \ + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_DH_KEY_PAIR || \ PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY config PSA_WANT_KEY_TYPE_DERIVE @@ -125,23 +122,12 @@ config PSA_WANT_KEY_TYPE_CHACHA20 help Key for the ChaCha20 stream cipher or the ChaCha20-Poly1305 AEAD algorithm. - config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR bool "PSA ECC key pair support" select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY - select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT - select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT - select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE - select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE - select DEPRECATED help - DEPRECATED: This configuration will be removed in a future release, - please use the individual options for import, export, generate, - derive and public key instead. - Elliptic curve key pair: both the private and public key. - config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY bool "PSA ECC public key support" help @@ -150,36 +136,37 @@ config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT bool "PSA ECC import key pair support" + default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY help Elliptic curve key pair: import for both the private and public key. config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT bool "PSA ECC export key pair support" + default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY help Elliptic curve key pair: export for both the private and public key. config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE bool "PSA ECC generate key pair support" + default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY help Elliptic curve key pair: generate for both the private and public key. -config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE - bool "PSA ECC derive key pair support" - select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY - help - Elliptic curve key pair: key derivation support. - config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC bool default y depends on PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT || \ PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT || \ - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE || \ PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE + bool + default y + depends on PSA_WANT_KEY_TYPE_ECC_KEY_PAIR + config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR bool "PSA RSA key pair type support" select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY From 8eae438c02227060ee52f0b2be52d091f17b42c2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2087/2300] Revert "[nrf fromlist] ipc_service: backends: icbmsg: Fix strnlen warnings" This reverts commit 1155e53bb25ba554bc7507dcc5c9ad45a494d804. Signed-off-by: Robert Lubos --- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index c7cb5f8ea34..da2db4ccbc8 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -75,9 +75,6 @@ * data messages, it calls bound endpoint and it is ready to send data. */ -#undef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L /* For strnlen() */ - #include #include From 9c800eeba523dbd5bc6b1d7595a7ae4783e60dc7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2088/2300] Revert "[nrf fromtree] wifi: Remove unused defines" This reverts commit d152f628d772f3cbb26b4cd02d5382fc292bb575. Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index c1fa8145dbf..ea3cbf8961c 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -66,12 +66,16 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_IFACE_STATUS, /** Set power save status */ NET_REQUEST_WIFI_CMD_PS, + /** Set power save mode */ + NET_REQUEST_WIFI_CMD_PS_MODE, /** Setup or teardown TWT flow */ NET_REQUEST_WIFI_CMD_TWT, /** Get power save config */ NET_REQUEST_WIFI_CMD_PS_CONFIG, /** Set or get regulatory domain */ NET_REQUEST_WIFI_CMD_REG_DOMAIN, + /** Set power save timeout */ + NET_REQUEST_WIFI_CMD_PS_TIMEOUT, /** Set or get Mode of operation */ NET_REQUEST_WIFI_CMD_MODE, /** Set or get packet filter setting for current mode */ @@ -120,6 +124,11 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_IFACE_STATUS); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS); +#define NET_REQUEST_WIFI_PS_MODE \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_PS_MODE) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_MODE); + #define NET_REQUEST_WIFI_TWT \ (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_TWT) @@ -134,6 +143,11 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_CONFIG); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_REG_DOMAIN); +#define NET_REQUEST_WIFI_PS_TIMEOUT \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_PS_TIMEOUT) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_TIMEOUT); + #define NET_REQUEST_WIFI_MODE \ (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_MODE) From 39fb34a4e3b925ae9156f6c348c082836655c888 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2089/2300] Revert "[nrf noup] modules: mbedtls: add PSA configurations" This reverts commit 05ff843b520258dbd35e984e947104b846fe65ca. Signed-off-by: Robert Lubos --- modules/mbedtls/Kconfig.psa | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa index 9a0be3c4063..bbd60a9e8d8 100644 --- a/modules/mbedtls/Kconfig.psa +++ b/modules/mbedtls/Kconfig.psa @@ -517,7 +517,8 @@ menu "PSA Key agreement support" config PSA_HAS_KEY_AGREEMENT bool default y - depends on PSA_WANT_ALG_ECDH || PSA_WANT_ALG_FFDH + depends on PSA_WANT_ALG_ECDH + depends on PSA_WANT_ALG_FFDH help Promt-less configuration that states that key agreement is supported. From c555d14aba81689b686384c29e40e5030d425053 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2090/2300] Revert "[nrf noup] dts: choose a crypto accelerator for entropy" This reverts commit 2aba1375175390c61cdc6b9af57d2f3494891c43. Signed-off-by: Robert Lubos --- dts/arm/nordic/nrf52840.dtsi | 4 ++-- dts/arm/nordic/nrf5340_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf54l_common.dtsi | 6 ------ dts/arm/nordic/nrf91.dtsi | 3 +-- soc/nordic/common/Kconfig.peripherals | 6 ++---- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index c105da55c76..4cfb7abc511 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -5,7 +5,7 @@ / { chosen { - zephyr,entropy = &cryptocell; + zephyr,entropy = &rng; zephyr,flash-controller = &flash_controller; }; @@ -547,7 +547,7 @@ reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index d48f0ce62dc..e40f6241d91 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -33,7 +33,7 @@ }; chosen { - zephyr,entropy = &cryptocell; + zephyr,entropy = &rng_hci; zephyr,flash-controller = &flash_controller; }; @@ -102,7 +102,7 @@ reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; }; diff --git a/dts/arm/nordic/nrf54l_common.dtsi b/dts/arm/nordic/nrf54l_common.dtsi index c537554b05b..1c5345afc93 100644 --- a/dts/arm/nordic/nrf54l_common.dtsi +++ b/dts/arm/nordic/nrf54l_common.dtsi @@ -25,12 +25,6 @@ chosen { zephyr,flash-controller = &rram_controller; - zephyr,entropy = &psa_rng; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; }; sw_pwm: sw-pwm { diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 0fb4c4addf4..78502d3f086 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -27,7 +27,6 @@ }; chosen { - zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -51,7 +50,7 @@ reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; - status = "okay"; + status = "disabled"; }; ctrlap: ctrlap@50006000 { diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index bc79b63d1d8..0c8f958eb38 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -13,12 +13,10 @@ config HAS_HW_NRF_BPROT def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_BPROT)) config HAS_HW_NRF_CC310 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) || \ - ($(dt_nodelabel_enabled,psa_rng) && SOC_SERIES_NRF91X) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) config HAS_HW_NRF_CC312 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) || \ - ($(dt_nodelabel_enabled,psa_rng) && SOC_NRF5340_CPUAPP) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) config HAS_HW_NRF_CCM def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_CCM)) From ed35079067f69f19df2b0b40e6adee95f45fa383 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:22 +0200 Subject: [PATCH 2091/2300] Revert "[nrf fromlist] modules: hal_nordic: Enforce nrf-regtool minimum version" This reverts commit 22df05a1f6caa10bed711b9545e520cf8b27580b. Signed-off-by: Robert Lubos --- 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 7f46997c697..c4a7134935c 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -11,7 +11,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.1.0 REQUIRED + find_package(nrf-regtool 5.1.0 COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From faa31dc443a1ad7d6caea53cb1277f63bc274990 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:23 +0200 Subject: [PATCH 2092/2300] Revert "[nrf noup] modules: mbedtls: PSA: Add PSA_HAS_PAKE_SUPPORT" This reverts commit 920b9fc774eb4490c23a0570a943866633b01d7d. Signed-off-by: Robert Lubos --- modules/mbedtls/Kconfig.psa | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa index bbd60a9e8d8..f3353f9d011 100644 --- a/modules/mbedtls/Kconfig.psa +++ b/modules/mbedtls/Kconfig.psa @@ -844,17 +844,6 @@ config PSA_WANT_ALG_SRP_PASSWORD_HASH prompt "PSA SRP password hash support" if !PSA_PROMPTLESS select EXPERIMENTAL -config PSA_HAS_PAKE_SUPPORT - bool - default y - depends on PSA_WANT_ALG_JPAKE || \ - PSA_WANT_ALG_SPAKE2P_HMAC || \ - PSA_WANT_ALG_SPAKE2P_CMAC || \ - PSA_WANT_ALG_SPAKE2P_MATTER || \ - PSA_WANT_ALG_SRP_6 || \ - PSA_WANT_ALG_SRP_PASSWORD_HASH - help - Prompt-less configuration that states that PAKE is supported. config PSA_WANT_ALG_PURE_EDDSA bool From 77f28326c70f5affdaddadc17c8a2cc300a1eb11 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:23 +0200 Subject: [PATCH 2093/2300] Revert "[nrf noup] modules: mbedtls: Add PSA_WANT_ALG_SP800_108_COUNTER_XXX" This reverts commit ecb16c791d10fdab4a41bd3dc790610dff5e9520. Signed-off-by: Robert Lubos --- modules/mbedtls/Kconfig.psa | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa index f3353f9d011..b4d72801300 100644 --- a/modules/mbedtls/Kconfig.psa +++ b/modules/mbedtls/Kconfig.psa @@ -572,16 +572,6 @@ config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 prompt "PSA PBKDF2-AES-CMAC-PRF-128 support" if !PSA_PROMPTLESS depends on PSA_WANT_ALG_CMAC -config PSA_WANT_ALG_SP800_108_COUNTER_HMAC - bool - prompt "Add PSA SP800-108r1 CTR HMAC KBKDF support" - depends on PSA_WANT_ALG_HMAC - -config PSA_WANT_ALG_SP800_108_COUNTER_CMAC - bool - prompt "Add PSA SP800-108r1 CTR CMAC KBKDF support" - depends on PSA_WANT_ALG_CMAC - config PSA_WANT_ALG_TLS12_PRF bool prompt "PSA PRF support (TLS1.2)" if !PSA_PROMPTLESS From 1b67896ab55f12638fd9d70667adceffdd3a3b9e Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:23 +0200 Subject: [PATCH 2094/2300] Revert "[nrf noup] include: net: add NCS extensions" This reverts commit e6f8064b7e9cee8748cdc6a24d01ddbd9458afa1. Signed-off-by: Robert Lubos --- include/zephyr/net/socket.h | 1 - include/zephyr/net/socket_ncs.h | 202 -------------------------------- 2 files changed, 203 deletions(-) delete mode 100644 include/zephyr/net/socket_ncs.h diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index 79eb8f32455..1800533a250 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #ifdef __cplusplus diff --git a/include/zephyr/net/socket_ncs.h b/include/zephyr/net/socket_ncs.h deleted file mode 100644 index 0023cd9bd48..00000000000 --- a/include/zephyr/net/socket_ncs.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2021 Nordic Semiconductor - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ -#define ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ - -/** - * @file - * @brief NCS specific additions to the BSD sockets API definitions - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* When CONFIG_NET_SOCKETS_OFFLOAD is enabled, offloaded sockets take precedence - * when creating a new socket. Combine this flag with a socket type when - * creating a socket, to enforce native socket creation (e. g. SOCK_STREAM | SOCK_NATIVE). - * If it's desired to create a native TLS socket, but still offload the - * underlying TCP/UDP socket, use e. g. SOCK_STREAM | SOCK_NATIVE_TLS. - */ -#define SOCK_NATIVE 0x80000000 -#define SOCK_NATIVE_TLS 0x40000000 - -/* NCS specific TLS level socket options */ - -/** Socket option to set DTLS handshake timeout, specifically for nRF sockets. - * The option accepts an integer, indicating the total handshake timeout, - * including retransmissions, in seconds. - * Accepted values for the option are: 1, 3, 7, 15, 31, 63, 123. - */ -#define TLS_DTLS_HANDSHAKE_TIMEO 18 - -/** Socket option to save DTLS connection, specifically for nRF sockets. - */ -#define TLS_DTLS_CONN_SAVE 19 - -/** Socket option to load DTLS connection, specifically for nRF sockets. - */ -#define TLS_DTLS_CONN_LOAD 20 - -/** Socket option to get result of latest TLS/DTLS completed handshakes end status, - * specifically for nRF sockets. - * The option accepts an integer, indicating the setting. - * Accepted vaules for the option are: 0 and 1. - */ -#define TLS_DTLS_HANDSHAKE_STATUS 21 - -/* Valid values for TLS_SESSION_CACHE option */ -#define TLS_SESSION_CACHE_DISABLED 0 /**< Disable TLS session caching. */ -#define TLS_SESSION_CACHE_ENABLED 1 /**< Enable TLS session caching. */ - -/* Valid values for TLS_DTLS_HANDSHAKE_TIMEO option */ -#define TLS_DTLS_HANDSHAKE_TIMEO_NONE 0 /**< No timeout */ -#define TLS_DTLS_HANDSHAKE_TIMEO_1S 1 /**< 1 second */ -#define TLS_DTLS_HANDSHAKE_TIMEO_3S 3 /**< 1s + 2s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_7S 7 /**< 1s + 2s + 4s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_15S 15 /**< 1s + 2s + 4s + 8s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_31S 31 /**< 1s + 2s + 4s + 8s + 16s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_63S 63 /**< 1s + 2s + 4s + 8s + 16s + 32s */ -#define TLS_DTLS_HANDSHAKE_TIMEO_123S 123 /**< 1s + 2s + 4s + 8s + 16s + 32s + 60s */ - -/* Valid values for TLS_DTLS_HANDSHAKE_STATUS option */ -#define TLS_DTLS_HANDSHAKE_STATUS_FULL 0 -#define TLS_DTLS_HANDSHAKE_STATUS_CACHED 1 - -/* NCS specific socket options */ - -/** sockopt: enable sending data as part of exceptional events */ -#define SO_EXCEPTIONAL_DATA 33 -/** sockopt: Keep socket open when its PDN connection is lost - * or the device is put into flight mode. - */ -#define SO_KEEPOPEN 34 -/** sockopt: bind to PDN */ -#define SO_BINDTOPDN 40 -/** sockopt: Release Assistance Indication feature: This will indicate that the - * application will not send any more data. - * - * @note This socket option requires the socket to be connected. - * - * @deprecated use @ref SO_RAI with value @ref RAI_NO_DATA instead. - */ -#define SO_RAI_NO_DATA 50 -/** sockopt: Release Assistance Indication feature: This will indicate that the - * next call to send/sendto will be the last one for some time. - * - * @deprecated use @ref SO_RAI with value @ref RAI_LAST instead. - */ -#define SO_RAI_LAST 51 -/** sockopt: Release Assistance Indication feature: This will indicate that - * after the next call to send/sendto, the application is expecting to receive - * one more data packet before this socket will not be used again for some time. - * - * @deprecated use @ref SO_RAI with value @ref RAI_ONE_RESP instead. - */ -#define SO_RAI_ONE_RESP 52 -/** sockopt: Release Assistance Indication feature: If a client application - * expects to use the socket more it can indicate that by setting this socket - * option before the next send call which will keep the network up longer. - * - * @deprecated use @ref SO_RAI with value @ref RAI_ONGOING instead. - */ -#define SO_RAI_ONGOING 53 -/** sockopt: Release Assistance Indication feature: If a server application - * expects to use the socket more it can indicate that by setting this socket - * option before the next send call. - * - * @deprecated use @ref SO_RAI with value @ref RAI_WAIT_MORE instead. - */ -#define SO_RAI_WAIT_MORE 54 - -/** sockopt: Release assistance indication (RAI). - * The option accepts an integer, indicating the type of RAI. - * Accepted values for the option are: @ref RAI_NO_DATA, @ref RAI_LAST, @ref RAI_ONE_RESP, - * @ref RAI_ONGOING, @ref RAI_WAIT_MORE. - */ -#define SO_RAI 61 - -/** Release assistance indication (RAI). - * Indicate that the application does not intend to send more data. - * This applies immediately and lets the modem exit connected mode more - * quickly. - * - * @note This requires the socket to be connected. - */ -#define RAI_NO_DATA 1 -/** Release assistance indication (RAI). - * Indicate that the application does not intend to send more data - * after the next call to send() or sendto(). - * This lets the modem exit connected mode more quickly after sending the data. - */ -#define RAI_LAST 2 -/** Release assistance indication (RAI). - * Indicate that the application is expecting to receive just one data packet - * after the next call to send() or sendto(). - * This lets the modem exit connected mode more quickly after having received the data. - */ -#define RAI_ONE_RESP 3 -/** Release assistance indication (RAI). - * Indicate that the socket is in active use by a client application. - * This lets the modem stay in connected mode longer. - */ -#define RAI_ONGOING 4 -/** Release assistance indication (RAI). - * Indicate that the socket is in active use by a server application. - * This lets the modem stay in connected mode longer. - */ -#define RAI_WAIT_MORE 5 - -/* NCS specific IPPROTO_ALL level socket options */ - -/** IPv4 and IPv6 protocol level (pseudo-val) for nRF sockets. */ -#define IPPROTO_ALL 512 -/** sockopt: disable all replies to unexpected traffics */ -#define SO_SILENCE_ALL 30 - -/* NCS specific IPPROTO_IP level socket options */ - -/** sockopt: enable IPv4 ICMP replies */ -#define SO_IP_ECHO_REPLY 31 - -/* NCS specific IPPROTO_IPV6 level socket options */ - -/** sockopt: enable IPv6 ICMP replies */ -#define SO_IPV6_ECHO_REPLY 32 - -/* NCS specific TCP level socket options */ - -/** sockopt: Configurable TCP server session timeout in minutes. - * Range is 0 to 135. 0 is no timeout and 135 is 2 h 15 min. Default is 0 (no timeout). - */ -#define SO_TCP_SRV_SESSTIMEO 55 - -/* NCS specific gettaddrinfo() flags */ - -/** Assume `service` contains a Packet Data Network (PDN) ID. - * When specified together with the AI_NUMERICSERV flag, - * `service` shall be formatted as follows: "port:pdn_id" - * where "port" is the port number and "pdn_id" is the PDN ID. - * Example: "8080:1", port 8080 PDN ID 1. - * Example: "42:0", port 42 PDN ID 0. - */ -#define AI_PDNSERV 0x1000 - -/* NCS specific send() and sendto() flags */ - -/** Request a blocking send operation until the request is acknowledged. - * When used in send() or sendto(), the request will not return until the - * send operation is completed by lower layers, or until the timeout, given by the SO_SNDTIMEO - * socket option, is reached. Valid timeout values are 1 to 600 seconds. - */ -#define MSG_WAITACK 0x200 - -#ifdef __cplusplus -} -#endif - -#endif /* ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ */ From d01880eab06536abb335142bd8f5058a864b108a Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:23 +0200 Subject: [PATCH 2095/2300] Revert "[nrf noup] modules: mbedtls: add PSA configurations" This reverts commit 5579010af5a57aafbd83bb9dcde69e8c9233c140. Signed-off-by: Robert Lubos --- drivers/entropy/Kconfig.psa_crypto | 1 - modules/mbedtls/Kconfig | 5 +- modules/mbedtls/Kconfig.psa | 848 ----------------------------- 3 files changed, 1 insertion(+), 853 deletions(-) delete mode 100644 modules/mbedtls/Kconfig.psa diff --git a/drivers/entropy/Kconfig.psa_crypto b/drivers/entropy/Kconfig.psa_crypto index 18514a071d1..d06001225b0 100644 --- a/drivers/entropy/Kconfig.psa_crypto +++ b/drivers/entropy/Kconfig.psa_crypto @@ -7,7 +7,6 @@ config ENTROPY_PSA_CRYPTO_RNG bool "PSA Crypto Random source Entropy driver" depends on DT_HAS_ZEPHYR_PSA_CRYPTO_RNG_ENABLED select ENTROPY_HAS_DRIVER - select PSA_WANT_GENERATE_RANDOM default y help Enable the PSA Crypto source Entropy driver. diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index 99eb3bcf859..755ad83f100 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -5,7 +5,6 @@ config ZEPHYR_MBEDTLS_MODULE bool - config MBEDTLS_PROMPTLESS bool help @@ -14,6 +13,7 @@ config MBEDTLS_PROMPTLESS mbed TLS menu prompt and instead handle the selection of MBEDTLS from dependent sub-configurations and thus prevent stuck symbol behavior. + menuconfig MBEDTLS bool "mbed TLS Support" if !MBEDTLS_PROMPTLESS help @@ -246,6 +246,3 @@ config APP_LINK_WITH_MBEDTLS issues for 'app'. endif # MBEDTLS - -# Add PSA configurations -rsource "Kconfig.psa" diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa deleted file mode 100644 index b4d72801300..00000000000 --- a/modules/mbedtls/Kconfig.psa +++ /dev/null @@ -1,848 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor -# -# SPDX-License-Identifier: Apache-2.0 -# -menu "PSA RNG support" - -config PSA_WANT_GENERATE_RANDOM - bool - prompt "PSA RNG support" - help - Provide random number generator (RNG) support. - -config PSA_WANT_ALG_CTR_DRBG - bool - prompt "PSA RNG using CTR-DRBG as PRNG" - help - Provide random number generator (RNG) using CTR-DRBG as the - pseudo-random number generator (PRNG), seeded by a true random - number generator (TRNG). - -config PSA_WANT_ALG_HMAC_DRBG - bool - prompt "PSA RNG using HMAC-DRBG as PRNG" - help - Provide random number generator (RNG) using HMAC-DRBG as the - pseudo-random number generator (PRNG), seeded by a true random - number generator (TRNG). - -endmenu # RNG support - -menu "PSA key type support" - -config PSA_HAS_KEY_SUPPORT - bool - default y - depends on PSA_WANT_KEY_TYPE_DERIVE || \ - PSA_WANT_KEY_TYPE_HMAC || \ - PSA_WANT_KEY_TYPE_RAW_DATA || \ - PSA_WANT_KEY_TYPE_PASSWORD || \ - PSA_WANT_KEY_TYPE_PASSWORD_HASH || \ - PSA_WANT_KEY_TYPE_PEPPER || \ - PSA_WANT_KEY_TYPE_AES || \ - PSA_WANT_KEY_TYPE_ARIA || \ - PSA_WANT_KEY_TYPE_DES || \ - PSA_WANT_KEY_TYPE_CAMELLIA || \ - PSA_WANT_KEY_TYPE_SM4 || \ - PSA_WANT_KEY_TYPE_ARC4 || \ - PSA_WANT_KEY_TYPE_CHACHA20 || \ - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR || \ - PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY || \ - PSA_WANT_KEY_TYPE_RSA_KEY_PAIR || \ - PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || \ - PSA_WANT_KEY_TYPE_DH_KEY_PAIR || \ - PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY - -config PSA_WANT_KEY_TYPE_DERIVE - bool "PSA derive key type support" - help - This key type is for high-entropy secrets only. - For low-entropy secrets, password key type should be used instead. - -config PSA_WANT_KEY_TYPE_RAW_DATA - bool "PSA raw data key type support" - help - A "key" of this type cannot be used for any cryptographic operation. - Applications can use this type to store arbitrary data in the keystore. - -config PSA_WANT_KEY_TYPE_HMAC - bool "PSA HMAC key type support" - help - HMAC key. - -config PSA_WANT_KEY_TYPE_PASSWORD - bool "PSA password key type support" - help - A low-entropy secret for password hashing or key derivation. - -config PSA_WANT_KEY_TYPE_PASSWORD_HASH - bool "PSA password hash key type support" - help - A secret value that can be used to verify a password hash. - -config PSA_WANT_KEY_TYPE_PEPPER - bool "PSA pepper key type support" - help - A secret value that can be used when computing a password hash. - -config PSA_WANT_KEY_TYPE_AES - bool "PSA AES key type support" - help - Key for cipher, AEAD or MAC algorithm based on the AES block cipher. - -config PSA_WANT_KEY_TYPE_ARIA - bool "PSA ARIA key type support" - -config PSA_WANT_KEY_TYPE_DES - bool "PSA DES key type support (weak)" - help - Warning: Single DES and 2-key 3DES are weak and strongly deprecated - and are only recommended for decrypting legacy data. - 3-key 3DES is weak and deprecated and is only recommended for use in - legacy protocols. - -config PSA_WANT_KEY_TYPE_CAMELLIA - bool "PSA CAMELLIA key type support" - -config PSA_WANT_KEY_TYPE_SM4 - bool "PSA SM4 key type support" - -config PSA_WANT_KEY_TYPE_ARC4 - bool "PSA ARC4 key type support (weak)" - help - Warning: The ARC4 cipher is weak and deprecated and is only - recommended for use in legacy protocols. - -config PSA_WANT_KEY_TYPE_CHACHA20 - bool "PSA ChaCha20 key type support" - default y - depends on PSA_WANT_ALG_CHACHA20_POLY1305 || \ - PSA_WANT_ALG_STREAM_CIPHER - help - Key for the ChaCha20 stream cipher or the ChaCha20-Poly1305 AEAD algorithm. - -config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR - bool "PSA ECC key pair support" - select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY - help - Elliptic curve key pair: both the private and public key. - -config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY - bool "PSA ECC public key support" - help - Elliptic curve public key. - - -config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT - bool "PSA ECC import key pair support" - default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR - select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY - help - Elliptic curve key pair: import for both the private and public key. - -config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT - bool "PSA ECC export key pair support" - default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR - select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY - help - Elliptic curve key pair: export for both the private and public key. - -config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE - bool "PSA ECC generate key pair support" - default y if PSA_WANT_KEY_TYPE_ECC_KEY_PAIR - select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY - help - Elliptic curve key pair: generate for both the private and public key. - -config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC - bool - default y - depends on PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT || \ - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT || \ - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE - -config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE - bool - default y - depends on PSA_WANT_KEY_TYPE_ECC_KEY_PAIR - -config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR - bool "PSA RSA key pair type support" - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY - help - RSA key pair: both the private and public key. - -config PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY - bool "PSA RSA public key support" - help - RSA public key. - -config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT - bool "PSA RSA key pair import key" - default y if PSA_WANT_KEY_TYPE_RSA_KEY_PAIR - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY - help - RSA key pair: import key for both the private and public key. - -config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT - bool "PSA RSA key pair export key" - default y if PSA_WANT_KEY_TYPE_RSA_KEY_PAIR - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY - help - RSA key pair: export key for both the private and public key. - -config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE - bool "PSA RSA key pair generate key" - default y if PSA_WANT_KEY_TYPE_RSA_KEY_PAIR - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY - help - RSA key pair: key generation for both the private and public key. - -config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC - bool - default y - depends on PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT || \ - PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT || \ - PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE - -config PSA_WANT_KEY_TYPE_DH_KEY_PAIR - bool "PSA DH key pair type support" - select PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY - help - Finite-field Diffie-Hellman key pair: both the private key and public key. - -config PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY - bool "PSA DH public key support" - help - Finite-field Diffie-Hellman public key. - -config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_IMPORT - bool "SPAKE2P key pair import support" - default y if PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR - select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY - help - SPAKE2P key pair: import key for both the private and public key. - -config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_EXPORT - bool "SPAKE2P key pair export support" - default y if PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR - select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY - help - SPAKE2P key pair: export key for both the private and public key. - -config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_DERIVE - bool "SPAKE2P key pair derive support" - default y if PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR - select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY - help - SPAKE2P key pair: derive key for both the private and public key. - -config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_BASIC - bool - default y - depends on PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_IMPORT || \ - PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_EXPORT || \ - PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_DERIVE - -config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR - bool "SPAKE2P key pair support" - select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY - help - SPAKE2P key pair: both the private and public key. - -config PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY - bool "SPAKE2P public key support" - help - SPAKE2P public key. - -config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_IMPORT - bool "SRP key pair import support" - default y if PSA_WANT_KEY_TYPE_SRP_KEY_PAIR - select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY - help - SRP key pair: import key for both the private and public key. - -config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT - bool "SRP key pair export support" - default y if PSA_WANT_KEY_TYPE_SRP_KEY_PAIR - select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY - help - SRP key pair: export key for both the private and public key. - -config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_DERIVE - bool "SRP key pair derive support" - default y if PSA_WANT_KEY_TYPE_SRP_KEY_PAIR - select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY - help - SRP key pair: derive key for both the private and public key. - -config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_BASIC - bool - default y - depends on PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_IMPORT || \ - PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT || \ - PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_DERIVE - -config PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY - bool "SRP public key support" - help - SRP public key. - -config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR - bool "SRP public key support" - help - SRP public key. - -endmenu # PSA Key type support - -menu "PSA AEAD support" - -config PSA_HAS_AEAD_SUPPORT - bool - default y - depends on PSA_WANT_ALG_CCM || \ - PSA_WANT_ALG_GCM || \ - PSA_WANT_ALG_CHACHA20_POLY1305 - help - Prompt-less configuration that states that AEAD is supported. - -config PSA_WANT_ALG_CCM - bool - prompt "PSA CCM support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_GCM - bool - prompt "PSA GCM support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_CHACHA20_POLY1305 - bool - prompt "PSA ChaCha20-Poly1305 support" if !PSA_PROMPTLESS - -endmenu # PSA AEAD support - - -menu "PSA MAC support" - -config PSA_HAS_MAC_SUPPORT - bool - default y - depends on PSA_WANT_ALG_CBC_MAC || \ - PSA_WANT_ALG_CMAC || \ - PSA_WANT_ALG_HMAC - help - Prompt-less configuration that states that MAC is supported. - -config PSA_WANT_ALG_CBC_MAC - bool - prompt "PSA CBC-MAC support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_CMAC - bool - prompt "PSA CMAC support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_HMAC - bool - prompt "PSA HMAC support" if !PSA_PROMPTLESS - -endmenu # PSA MAC support - - -menu "PSA Hash support" - -config PSA_HAS_HASH_SUPPORT - bool - default y - depends on PSA_WANT_ALG_SHA_1 || \ - PSA_WANT_ALG_SHA_224 || \ - PSA_WANT_ALG_SHA_256 || \ - PSA_WANT_ALG_SHA_384 || \ - PSA_WANT_ALG_SHA_512 || \ - PSA_WANT_ALG_SHA_512_224 || \ - PSA_WANT_ALG_SHA_512_256 || \ - PSA_WANT_ALG_SHA3_224 || \ - PSA_WANT_ALG_SHA3_256 || \ - PSA_WANT_ALG_SHA3_384 || \ - PSA_WANT_ALG_SHA3_512 || \ - PSA_WANT_ALG_SM3 || \ - PSA_WANT_ALG_SHAKE256_512 || \ - PSA_WANT_ALG_RIPEMD160 || \ - PSA_WANT_ALG_MD2 || \ - PSA_WANT_ALG_MD4 || \ - PSA_WANT_ALG_MD5 - help - Prompt-less configuration that states that hash is supported. - -config PSA_WANT_ALG_SHA_1 - bool - prompt "PSA SHA-1 support (weak)" if !PSA_PROMPTLESS - help - Warning: The SHA-1 hash is weak and deprecated and is only recommended - for use in legacy protocols. - -config PSA_WANT_ALG_SHA_224 - bool - prompt "PSA SHA-224 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHA_256 - bool - prompt "PSA SHA-256 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHA_384 - bool - prompt "PSA SHA-384 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHA_512 - bool - prompt "PSA SHA-512 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHA_512_224 - bool - prompt "PSA SHA-512/224 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHA_512_256 - bool - prompt "PSA SHA-512/256 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHA3_224 - bool - prompt "PSA SHA3-224 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHA3_256 - bool - prompt "PSA SHA3-256 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHA3_384 - bool - prompt "PSA SHA3-384 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHA3_512 - bool - prompt "PSA SHA3-512 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SM3 - bool - prompt "PSA SM3 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SHAKE256_512 - bool - prompt "PSA SHAKE256 512 bits support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_RIPEMD160 - bool - prompt "PSA RIPEMD-160 support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_MD2 - bool - prompt "PSA MD2 support (weak)" if !PSA_PROMPTLESS - help - Warning: The MD2 hash is weak and deprecated and is only recommended - for use in legacy protocols. - -config PSA_WANT_ALG_MD4 - bool - prompt "PSA MD4 support (weak)" if !PSA_PROMPTLESS - help - Warning: The MD4 hash is weak and deprecated and is only recommended - for use in legacy protocols. - -config PSA_WANT_ALG_MD5 - bool - prompt "PSA MD5 support (weak)" if !PSA_PROMPTLESS - help - Warning: The MD5 hash is weak and deprecated and is only recommended - for use in legacy protocols. - -endmenu # PSA Hash support - -menu "PSA Cipher support" - -config PSA_HAS_CIPHER_SUPPORT - bool - default y - depends on PSA_WANT_ALG_ECB_NO_PADDING || \ - PSA_WANT_ALG_CBC_NO_PADDING || \ - PSA_WANT_ALG_CBC_PKCS7 || \ - PSA_WANT_ALG_CCM_STAR_NO_TAG || \ - PSA_WANT_ALG_CFB || \ - PSA_WANT_ALG_CTR || \ - PSA_WANT_ALG_OFB || \ - PSA_WANT_ALG_XTS || \ - PSA_WANT_ALG_STREAM_CIPHER - help - Prompt-less configuration that states that cipher is supported. - -config PSA_WANT_ALG_ECB_NO_PADDING - bool - prompt "PSA ECB block cipher mode support (with no padding)" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_CBC_NO_PADDING - bool - prompt "PSA CBC block cipher mode support (with no padding)" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_CBC_PKCS7 - bool - prompt "PSA CBC block cipher mode support (with PKCS#7 padding)" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_CFB - bool - prompt "PSA stream cipher using CFB block cipher mode support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_CTR - bool - prompt "PSA stream cipher using CTR block cipher mode support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_OFB - bool - prompt "PSA stream cipher using OFB block cipher mode support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_XTS - bool - prompt "PSA XTS block cipher mode support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_CCM_STAR_NO_TAG - bool - prompt "PSA CCM* with no tag support" if !PSA_PROMPTLESS - help - Unauthenticated version of CCM. Uses the cipher API instead of the AEAD API. - -config PSA_WANT_ALG_STREAM_CIPHER - bool - prompt "PSA stream cipher support" if !PSA_PROMPTLESS - -endmenu # PSA Cipher Support - -menu "PSA Key agreement support" - -config PSA_HAS_KEY_AGREEMENT - bool - default y - depends on PSA_WANT_ALG_ECDH - depends on PSA_WANT_ALG_FFDH - help - Promt-less configuration that states that key agreement is supported. - -config PSA_WANT_ALG_ECDH - bool - prompt "PSA ECDH support" if !PSA_PROMPTLESS - - -config PSA_WANT_ALG_FFDH - bool - prompt "PSA FFDH support" if !PSA_PROMPTLESS - -endmenu # PSA Key agreement support - -menu "PSA Key derivation support" - -config PSA_HAS_KEY_DERIVATION - bool - default y - depends on PSA_WANT_ALG_HKDF || \ - PSA_WANT_ALG_HKDF_EXPAND || \ - PSA_WANT_ALG_HKDF_EXTRACT || \ - PSA_WANT_ALG_PBKDF2_HMAC || \ - PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 || \ - PSA_WANT_ALG_TLS12_PRF || \ - PSA_WANT_ALG_TLS12_PSK_TO_MS || \ - PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS - help - Prompt-less configuration that states that key derivation is supported. - -config PSA_WANT_ALG_HKDF - bool - prompt "PSA HKDF support" if !PSA_PROMPTLESS - depends on PSA_WANT_ALG_HMAC - -config PSA_WANT_ALG_HKDF_EXTRACT - bool - prompt "PSA HKDF extract support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_HKDF_EXPAND - bool - prompt "PSA HKDF expand support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_PBKDF2_HMAC - bool - prompt "PSA PBKDF2 HMAC support" if !PSA_PROMPTLESS - depends on PSA_WANT_ALG_HMAC - -config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 - bool - prompt "PSA PBKDF2-AES-CMAC-PRF-128 support" if !PSA_PROMPTLESS - depends on PSA_WANT_ALG_CMAC - -config PSA_WANT_ALG_TLS12_PRF - bool - prompt "PSA PRF support (TLS1.2)" if !PSA_PROMPTLESS - depends on PSA_WANT_ALG_HMAC - -config PSA_WANT_ALG_TLS12_PSK_TO_MS - bool - prompt "PSA TLS 1.2 PSK to MS support" if !PSA_PROMPTLESS - depends on PSA_WANT_ALG_HMAC - -config PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS - bool - prompt "PSA TLS 1.2 EC J-PAKE to PMS support" if !PSA_PROMPTLESS - depends on PSA_WANT_ALG_SHA_256 - -endmenu # PSA Key derivation support - - -menu "PSA Asymmetric support" - -config PSA_HAS_ASYM_ENCRYPT_SUPPORT - bool - default y - depends on PSA_WANT_ALG_RSA_OAEP || \ - PSA_WANT_ALG_RSA_PKCS1V15_CRYPT - help - Prompt-less configuration that states that asymmetric encryption - is supported. - - -config PSA_HAS_ASYM_SIGN_SUPPORT - bool - default y - depends on PSA_WANT_ALG_DETERMINISTIC_ECDSA || \ - PSA_WANT_ALG_ECDSA || \ - PSA_WANT_ALG_ECDSA_ANY || \ - PSA_WANT_ALG_PURE_EDDSA || \ - PSA_WANT_ALG_ED25519PH || \ - PSA_WANT_ALG_ED448PH || \ - PSA_WANT_ALG_RSA_PKCS1V15_SIGN || \ - PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW || \ - PSA_WANT_ALG_RSA_PSS || \ - PSA_WANT_ALG_RSA_PSS_ANY_SALT - help - Prompt-less configuration that states that asymmetric signing - is supported. - -config PSA_WANT_ALG_ECDSA - bool - prompt "PSA ECDSA support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_ECDSA_ANY - bool - prompt "PSA ECDSA support, without hashing" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_DETERMINISTIC_ECDSA - bool - prompt "PSA ECDSA support (deterministic mode)" if !PSA_PROMPTLESS - -menu "Elliptic Curve type support" - -config PSA_WANT_ECC_BRAINPOOL_P_R1_160 - bool - prompt "PSA ECC BrainpoolP160r1 support (weak)" if !PSA_PROMPTLESS - help - Warning: The 160-bit curve brainpoolP160r1 is weak and deprecated and - is only recommended for use in legacy protocols. - -config PSA_WANT_ECC_BRAINPOOL_P_R1_192 - bool - prompt "PSA ECC BrainpoolP192r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_BRAINPOOL_P_R1_224 - bool - prompt "PSA ECC BrainpoolP224r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_BRAINPOOL_P_R1_256 - bool - prompt "PSA ECC BrainpoolP256r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_BRAINPOOL_P_R1_320 - bool - prompt "PSA ECC BrainpoolP320r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_BRAINPOOL_P_R1_384 - bool - prompt "PSA ECC BrainpoolP384r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_BRAINPOOL_P_R1_512 - bool - prompt "PSA ECC BrainpoolP512r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_MONTGOMERY_255 - bool - prompt "PSA ECC Curve25519 (X25519) support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_MONTGOMERY_448 - bool - prompt "PSA ECC Curve448 (X448) support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_TWISTED_EDWARDS_255 - bool - prompt "PSA ECC Edwards25519 (Ed25519) support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_TWISTED_EDWARDS_448 - bool - prompt "PSA ECC Edwards448 (Ed448) support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECP_K1_192 - bool - prompt "PSA ECC secp192k1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECP_K1_224 - bool - prompt "PSA ECC secp224k1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECP_K1_256 - bool - prompt "PSA ECC secp256k1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECP_R1_192 - bool - prompt "PSA ECC secp192r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECP_R1_224 - bool - prompt "PSA ECC secp224r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECP_R1_256 - bool - prompt "PSA ECC secp256r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECP_R1_384 - bool - prompt "PSA ECC secp384r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECP_R1_521 - bool - prompt "PSA ECC secp521r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECP_R2_160 - bool - prompt "PSA ECC secp160r2 support (weak)" if !PSA_PROMPTLESS - help - Warning: his family of curves is weak and deprecated. - -config PSA_WANT_ECC_SECT_K1_163 - bool - prompt "PSA ECC sect163k1 support (weak)" if !PSA_PROMPTLESS - help - Warning: The 163-bit curve sect163k1 is weak and deprecated and is - only recommended for use in legacy protocols. - -config PSA_WANT_ECC_SECT_K1_233 - bool - prompt "PSA ECC sect233k1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECT_K1_239 - bool - prompt "PSA ECC sect239k1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECT_K1_283 - bool - prompt "PSA ECC sect283k1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECT_K1_409 - bool - prompt "PSA ECC sect409k1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECT_K1_571 - bool - prompt "PSA ECC sect571k1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECT_R1_163 - bool - prompt "PSA ECC sect163r1 support (weak)" if !PSA_PROMPTLESS - help - Warning: The 163-bit curve sect163r1 is weak and deprecated and is - only recommended for use in legacy protocols. - -config PSA_WANT_ECC_SECT_R1_233 - bool - prompt "PSA ECC sect233r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECT_R1_283 - bool - prompt "PSA ECC sect283r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECT_R1_409 - bool - prompt "PSA ECC sect409r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECT_R1_571 - bool - prompt "PSA ECC sect571r1 support" if !PSA_PROMPTLESS - -config PSA_WANT_ECC_SECT_R2_163 - bool - prompt "PSA ECC sect163r2 support (weak)" if !PSA_PROMPTLESS - help - Warning: The 163-bit curve sect163r2 is weak and deprecated and is - only recommended for use in legacy protocols. - -config PSA_WANT_ECC_FRP_V1_256 - bool - prompt "PSA ECC FRP256v1 support" if !PSA_PROMPTLESS - -endmenu # Elliptic Curve type support - -config PSA_WANT_ALG_RSA_OAEP - bool - prompt "PSA RSA OAEP asymmetric encryption support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_RSA_PKCS1V15_CRYPT - bool - prompt "PSA RSA PKCS#1 v1.5 asymmetric encryption support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_RSA_PKCS1V15_SIGN - bool - prompt "PSA RSA PKCS#1 v1.5 message signature support, with hashing" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW - bool - prompt "PSA RSA raw PKCS#1 v1.5 message signature support, without hashing)" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_RSA_PSS - bool - prompt "PSA RSA PSS message signature support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_RSA_PSS_ANY_SALT - bool - prompt "PSA RSA PSS message signature support, any salt length" if !PSA_PROMPTLESS - -endmenu # PSA Asymmetric support - -config PSA_WANT_ALG_JPAKE - bool - prompt "PSA EC J-PAKE support" if !PSA_PROMPTLESS - select EXPERIMENTAL if !NET_L2_OPENTHREAD - -config PSA_WANT_ALG_SPAKE2P_HMAC - bool - prompt "PSA SPAKE2+ HMAC support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SPAKE2P_CMAC - bool - prompt "PSA SPAKE2+ CMAC support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SPAKE2P_MATTER - bool - prompt "PSA SPAKE2+ MATTER support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_SRP_6 - bool - prompt "PSA SRP-6 support" if !PSA_PROMPTLESS - select EXPERIMENTAL - -config PSA_WANT_ALG_SRP_PASSWORD_HASH - bool - prompt "PSA SRP password hash support" if !PSA_PROMPTLESS - select EXPERIMENTAL - - -config PSA_WANT_ALG_PURE_EDDSA - bool - prompt "PSA PURE_EDDSA support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_ED25519PH - bool - prompt "PSA ED25519PH support" if !PSA_PROMPTLESS - -config PSA_WANT_ALG_ED448PH - bool - prompt "PSA ED448PH support" if !PSA_PROMPTLESS From 36eb69444b8dd37c85c181418980f5bf828c4538 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:23 +0200 Subject: [PATCH 2096/2300] Revert "[nrf fromlist] boards: added arduino pins to nrf5340 audio DK network core" This reverts commit d93196475baa7b27cb626d9e3bdd9fc3af35daf2. Signed-off-by: Robert Lubos --- ...f5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi | 17 -------- .../nrf5340_audio_dk_nrf5340_cpunet.dts | 40 ------------------- 2 files changed, 57 deletions(-) diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi index 6804c040d12..ada32e709ac 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi @@ -26,21 +26,4 @@ }; }; - spi0_default: spi0_default { - group1 { - psels = , - , - ; - }; - }; - - spi0_sleep: spi0_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - }; diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet.dts b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet.dts index 22a05cac020..16aa4179fa9 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet.dts +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpunet.dts @@ -24,46 +24,6 @@ zephyr,code-partition = &slot0_partition; watchdog0 = &wdt0; }; - - arduino_header: connector { - compatible = "arduino-header-r3"; - #gpio-cells = <2>; - gpio-map-mask = <0xffffffff 0xffffffc0>; - gpio-map-pass-thru = <0 0x3f>; - gpio-map = <0 0 &gpio0 4 0>, /* A0 */ - <1 0 &gpio0 5 0>, /* A1 */ - <2 0 &gpio0 6 0>, /* A2 */ - <3 0 &gpio0 7 0>, /* A3 */ - <4 0 &gpio0 25 0>, /* A4 */ - <5 0 &gpio0 26 0>, /* A5 */ - <6 0 &gpio1 9 0>, /* D0 */ - <7 0 &gpio1 8 0>, /* D1 */ - <8 0 &gpio0 31 0>, /* D2 */ - <9 0 &gpio1 0 0>, /* D3 */ - <10 0 &gpio1 1 0>, /* D4 */ - <11 0 &gpio1 14 0>, /* D5 */ - <12 0 &gpio1 7 0>, /* D6 */ - <13 0 &gpio1 11 0>, /* D7 */ - <14 0 &gpio1 10 0>, /* D8 */ - <15 0 &gpio1 13 0>, /* D9 */ - <16 0 &gpio1 12 0>, /* D10 */ - <17 0 &gpio0 9 0>, /* D11 */ - <18 0 &gpio0 10 0>, /* D12 */ - <19 0 &gpio0 8 0>, /* D13 */ - <20 0 &gpio1 2 0>, /* D14 */ - <21 0 &gpio1 3 0>; /* D15 */ - }; - -}; - -arduino_spi: &spi0 { - compatible = "nordic,nrf-spim"; - /* Cannot be used together with uart0. */ - /* status = "okay"; */ - cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */ - pinctrl-0 = <&spi0_default>; - pinctrl-1 = <&spi0_sleep>; - pinctrl-names = "default", "sleep"; }; &gpiote { From f3d34a6ca4a5b4022e66acfd1d386e0c6366bd11 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Sat, 25 May 2024 10:02:23 +0200 Subject: [PATCH 2097/2300] Revert "[nrf fromlist] scripts: Allow using quarantine mechanism with test_plan.py script" This reverts commit 38b93c87dc585d2af6f218bf15752235b66e3b28. Signed-off-by: Robert Lubos --- scripts/ci/test_plan.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 625d47a7805..26787496a7c 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -95,7 +95,7 @@ def __repr__(self): class Filters: def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, - pull_request=False, platforms=[], detailed_test_id=True, quarantine_list=None): + pull_request=False, platforms=[], detailed_test_id=True): self.modified_files = modified_files self.testsuite_root = testsuite_root self.resolved_files = [] @@ -108,7 +108,6 @@ def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, self.detailed_test_id = detailed_test_id self.ignore_path = ignore_path self.tag_cfg_file = alt_tags - self.quarantine_list = quarantine_list def process(self): self.find_modules() @@ -129,9 +128,6 @@ def get_plan(self, options, integration=False, use_testsuite_root=True): cmd+=["-T", root] if integration: cmd.append("--integration") - if self.quarantine_list: - for q in self.quarantine_list: - cmd += ["--quarantine-list", q] logging.info(" ".join(cmd)) _ = subprocess.call(cmd) @@ -414,12 +410,6 @@ def parse_args(): "testcase.yaml files under here will be processed. May be " "called multiple times. Defaults to the 'samples/' and " "'tests/' directories at the base of the Zephyr tree.") - parser.add_argument( - "--quarantine-list", action="append", metavar="FILENAME", - help="Load list of test scenarios under quarantine. The entries in " - "the file need to correspond to the test scenarios names as in " - "corresponding tests .yaml files. These scenarios " - "will be skipped with quarantine as the reason.") # Include paths in names by default. parser.set_defaults(detailed_test_id=True) @@ -448,7 +438,7 @@ def parse_args(): print("=========") f = Filters(files, args.ignore_path, args.alt_tags, args.testsuite_root, - args.pull_request, args.platform, args.detailed_test_id, args.quarantine_list) + args.pull_request, args.platform, args.detailed_test_id) f.process() # remove dupes and filtered cases From a60e90d82f5e0f3f59b56e0babe4349b25c0412b Mon Sep 17 00:00:00 2001 From: Maciej Perkowski Date: Tue, 19 Dec 2023 15:28:24 +0100 Subject: [PATCH 2098/2300] [nrf fromtree] scripts: Allow using quarantine mechanism with test_plan.py script In twister, applying quarantine is a part of apply_filters() function. However, this function is not called when --load-test is used. Therefore, if one wants to use quarantines in combination with dynamic scope from the test_plan.py script, one has to pass such info through the script. Signed-off-by: Maciej Perkowski (cherry picked from commit 48665f2636208e71892f5203f39d427f74d19901) Signed-off-by: Robert Lubos --- scripts/ci/test_plan.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 1bbfd331deb..edbbbf2d923 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -95,7 +95,7 @@ def __repr__(self): class Filters: def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, - pull_request=False, platforms=[], detailed_test_id=True, tc_roots_th=20): + pull_request=False, platforms=[], detailed_test_id=True, quarantine_list=None, tc_roots_th=20): self.modified_files = modified_files self.testsuite_root = testsuite_root self.resolved_files = [] @@ -108,6 +108,7 @@ def __init__(self, modified_files, ignore_path, alt_tags, testsuite_root, self.detailed_test_id = detailed_test_id self.ignore_path = ignore_path self.tag_cfg_file = alt_tags + self.quarantine_list = quarantine_list self.tc_roots_th = tc_roots_th def process(self): @@ -129,6 +130,9 @@ def get_plan(self, options, integration=False, use_testsuite_root=True): cmd+=["-T", root] if integration: cmd.append("--integration") + if self.quarantine_list: + for q in self.quarantine_list: + cmd += ["--quarantine-list", q] logging.info(" ".join(cmd)) _ = subprocess.call(cmd) @@ -414,6 +418,12 @@ def parse_args(): "testcase.yaml files under here will be processed. May be " "called multiple times. Defaults to the 'samples/' and " "'tests/' directories at the base of the Zephyr tree.") + parser.add_argument( + "--quarantine-list", action="append", metavar="FILENAME", + help="Load list of test scenarios under quarantine. The entries in " + "the file need to correspond to the test scenarios names as in " + "corresponding tests .yaml files. These scenarios " + "will be skipped with quarantine as the reason.") # Include paths in names by default. parser.set_defaults(detailed_test_id=True) @@ -442,7 +452,7 @@ def parse_args(): print("=========") f = Filters(files, args.ignore_path, args.alt_tags, args.testsuite_root, - args.pull_request, args.platform, args.detailed_test_id, + args.pull_request, args.platform, args.detailed_test_id, args.quarantine_list, args.testcase_roots_threshold) f.process() From 6f7768140120bb8e8a6c6771076a3cee828e1eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Tue, 30 Nov 2021 09:41:05 +0100 Subject: [PATCH 2099/2300] [nrf noup] modules: mbedtls: add PSA configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add all of the PSA specification defined algorithms and key types. This makes the configurations independent of what is supported by the specific implementation. Add configurations for internal logic to see if a feature is enabled by PSA_WANTS_XXX. ref: NCSDK-11689 ref: NCSDK-17840 ref: NCSDK-17840 ref: NCSDK-26057 Add PSA symbols for Oberon extension to the PSA specification. Mbed TLS has adopted the same naming, so while this is not part of the PSA specification it is fine to add it to the generic configuration for both implementations. Add config support for PBKDF2_HMAC. Add config support for PBKDF2_AES_CMAC_PRF_128 Signed-off-by: Frank Audun Kvamtrø Signed-off-by: Vidar Lillebø Signed-off-by: Sebastian Bøe Signed-off-by: Markus Swarowsky Signed-off-by: Joakim Andersson Signed-off-by: Maciej Baczmanski Signed-off-by: Georgios Vasilakis Signed-off-by: Robert Lubos (cherry picked from commit 0a78b665e502695a7855178595c3c077ff2ce71c) (cherry picked from commit b850ab7cfc8161ba37194f9c7e1935051e3d206f) (cherry picked from commit 33121ff883e93385eb12dddbed7077e8dcbb968d) (cherry picked from commit 1fab667892451f21114f87cf48863c0dbdfb9507) (cherry picked from commit 0708dc8e65603cca2abe7799bffe765f97d00bb4) (cherry picked from commit 93ad09a7305328387936b68059b63f64efd44f60) (cherry picked from commit d284b1840048b55b3928465d501e8ed4a6d58097) (cherry picked from commit 746b326eb0caf9c2227e2a9e7aa3479dffea19ca) (cherry picked from commit 76b0463a5a4b8b44cb4c82e5906711d18ae439db) (cherry picked from commit 5579010af5a57aafbd83bb9dcde69e8c9233c140) --- drivers/entropy/Kconfig.psa_crypto | 1 + modules/mbedtls/Kconfig | 1 + modules/mbedtls/Kconfig.psa | 873 +++++++++++++++++++++++++++++ 3 files changed, 875 insertions(+) diff --git a/drivers/entropy/Kconfig.psa_crypto b/drivers/entropy/Kconfig.psa_crypto index d06001225b0..18514a071d1 100644 --- a/drivers/entropy/Kconfig.psa_crypto +++ b/drivers/entropy/Kconfig.psa_crypto @@ -7,6 +7,7 @@ config ENTROPY_PSA_CRYPTO_RNG bool "PSA Crypto Random source Entropy driver" depends on DT_HAS_ZEPHYR_PSA_CRYPTO_RNG_ENABLED select ENTROPY_HAS_DRIVER + select PSA_WANT_GENERATE_RANDOM default y help Enable the PSA Crypto source Entropy driver. diff --git a/modules/mbedtls/Kconfig b/modules/mbedtls/Kconfig index e020c993be1..1c80cd68669 100644 --- a/modules/mbedtls/Kconfig +++ b/modules/mbedtls/Kconfig @@ -5,6 +5,7 @@ config ZEPHYR_MBEDTLS_MODULE bool + config MBEDTLS_PROMPTLESS bool help diff --git a/modules/mbedtls/Kconfig.psa b/modules/mbedtls/Kconfig.psa index 35200a9d2f4..c032239040a 100644 --- a/modules/mbedtls/Kconfig.psa +++ b/modules/mbedtls/Kconfig.psa @@ -12,3 +12,876 @@ config PSA_WANT_ALG_SHA_256 bool "SHA-256 hash algorithm through PSA" endif # MBEDTLS_PSA_CRYPTO_CLIENT + +menu "PSA RNG support" + +config PSA_WANT_GENERATE_RANDOM + bool + prompt "PSA RNG support" + help + Provide random number generator (RNG) support. + +config PSA_WANT_ALG_CTR_DRBG + bool + prompt "PSA RNG using CTR-DRBG as PRNG" + help + Provide random number generator (RNG) using CTR-DRBG as the + pseudo-random number generator (PRNG), seeded by a true random + number generator (TRNG). + +config PSA_WANT_ALG_HMAC_DRBG + bool + prompt "PSA RNG using HMAC-DRBG as PRNG" + help + Provide random number generator (RNG) using HMAC-DRBG as the + pseudo-random number generator (PRNG), seeded by a true random + number generator (TRNG). + +endmenu # RNG support + +menu "PSA key type support" + +config PSA_HAS_KEY_SUPPORT + bool + default y + depends on PSA_WANT_KEY_TYPE_DERIVE || \ + PSA_WANT_KEY_TYPE_HMAC || \ + PSA_WANT_KEY_TYPE_RAW_DATA || \ + PSA_WANT_KEY_TYPE_PASSWORD || \ + PSA_WANT_KEY_TYPE_PASSWORD_HASH || \ + PSA_WANT_KEY_TYPE_PEPPER || \ + PSA_WANT_KEY_TYPE_AES || \ + PSA_WANT_KEY_TYPE_ARIA || \ + PSA_WANT_KEY_TYPE_DES || \ + PSA_WANT_KEY_TYPE_CAMELLIA || \ + PSA_WANT_KEY_TYPE_SM4 || \ + PSA_WANT_KEY_TYPE_ARC4 || \ + PSA_WANT_KEY_TYPE_CHACHA20 || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE || \ + PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR || \ + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_DH_KEY_PAIR || \ + PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY + +config PSA_WANT_KEY_TYPE_DERIVE + bool "PSA derive key type support" + help + This key type is for high-entropy secrets only. + For low-entropy secrets, password key type should be used instead. + +config PSA_WANT_KEY_TYPE_RAW_DATA + bool "PSA raw data key type support" + help + A "key" of this type cannot be used for any cryptographic operation. + Applications can use this type to store arbitrary data in the keystore. + +config PSA_WANT_KEY_TYPE_HMAC + bool "PSA HMAC key type support" + help + HMAC key. + +config PSA_WANT_KEY_TYPE_PASSWORD + bool "PSA password key type support" + help + A low-entropy secret for password hashing or key derivation. + +config PSA_WANT_KEY_TYPE_PASSWORD_HASH + bool "PSA password hash key type support" + help + A secret value that can be used to verify a password hash. + +config PSA_WANT_KEY_TYPE_PEPPER + bool "PSA pepper key type support" + help + A secret value that can be used when computing a password hash. + +config PSA_WANT_KEY_TYPE_AES + bool "PSA AES key type support" + help + Key for cipher, AEAD or MAC algorithm based on the AES block cipher. + +config PSA_WANT_KEY_TYPE_ARIA + bool "PSA ARIA key type support" + +config PSA_WANT_KEY_TYPE_DES + bool "PSA DES key type support (weak)" + help + Warning: Single DES and 2-key 3DES are weak and strongly deprecated + and are only recommended for decrypting legacy data. + 3-key 3DES is weak and deprecated and is only recommended for use in + legacy protocols. + +config PSA_WANT_KEY_TYPE_CAMELLIA + bool "PSA CAMELLIA key type support" + +config PSA_WANT_KEY_TYPE_SM4 + bool "PSA SM4 key type support" + +config PSA_WANT_KEY_TYPE_ARC4 + bool "PSA ARC4 key type support (weak)" + help + Warning: The ARC4 cipher is weak and deprecated and is only + recommended for use in legacy protocols. + +config PSA_WANT_KEY_TYPE_CHACHA20 + bool "PSA ChaCha20 key type support" + default y + depends on PSA_WANT_ALG_CHACHA20_POLY1305 || \ + PSA_WANT_ALG_STREAM_CIPHER + help + Key for the ChaCha20 stream cipher or the ChaCha20-Poly1305 AEAD algorithm. + + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR + bool "PSA ECC key pair support" + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT + select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT + select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE + select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE + select DEPRECATED + help + DEPRECATED: This configuration will be removed in a future release, + please use the individual options for import, export, generate, + derive and public key instead. + + Elliptic curve key pair: both the private and public key. + + +config PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + bool "PSA ECC public key support" + help + Elliptic curve public key. + + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT + bool "PSA ECC import key pair support" + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + help + Elliptic curve key pair: import for both the private and public key. + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT + bool "PSA ECC export key pair support" + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + help + Elliptic curve key pair: export for both the private and public key. + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE + bool "PSA ECC generate key pair support" + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + help + Elliptic curve key pair: generate for both the private and public key. + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE + bool "PSA ECC derive key pair support" + select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY + help + Elliptic curve key pair: key derivation support. + +config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR + bool "PSA RSA key pair type support" + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + help + RSA key pair: both the private and public key. + +config PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + bool "PSA RSA public key support" + help + RSA public key. + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT + bool "PSA RSA key pair import key" + default y if PSA_WANT_KEY_TYPE_RSA_KEY_PAIR + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + help + RSA key pair: import key for both the private and public key. + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT + bool "PSA RSA key pair export key" + default y if PSA_WANT_KEY_TYPE_RSA_KEY_PAIR + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + help + RSA key pair: export key for both the private and public key. + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE + bool "PSA RSA key pair generate key" + default y if PSA_WANT_KEY_TYPE_RSA_KEY_PAIR + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + help + RSA key pair: key generation for both the private and public key. + +config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE + +config PSA_WANT_KEY_TYPE_DH_KEY_PAIR + bool "PSA DH key pair type support" + select PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY + help + Finite-field Diffie-Hellman key pair: both the private key and public key. + +config PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY + bool "PSA DH public key support" + help + Finite-field Diffie-Hellman public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_IMPORT + bool "SPAKE2P key pair import support" + default y if PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + help + SPAKE2P key pair: import key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_EXPORT + bool "SPAKE2P key pair export support" + default y if PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + help + SPAKE2P key pair: export key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_DERIVE + bool "SPAKE2P key pair derive support" + default y if PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + help + SPAKE2P key pair: derive key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_DERIVE + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR + bool "SPAKE2P key pair support" + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + help + SPAKE2P key pair: both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + bool "SPAKE2P public key support" + help + SPAKE2P public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_IMPORT + bool "SRP key pair import support" + default y if PSA_WANT_KEY_TYPE_SRP_KEY_PAIR + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + help + SRP key pair: import key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT + bool "SRP key pair export support" + default y if PSA_WANT_KEY_TYPE_SRP_KEY_PAIR + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + help + SRP key pair: export key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_DERIVE + bool "SRP key pair derive support" + default y if PSA_WANT_KEY_TYPE_SRP_KEY_PAIR + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + help + SRP key pair: derive key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_DERIVE + +config PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + bool "SRP public key support" + help + SRP public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR + bool "SRP public key support" + help + SRP public key. + +endmenu # PSA Key type support + +menu "PSA AEAD support" + +config PSA_HAS_AEAD_SUPPORT + bool + default y + depends on PSA_WANT_ALG_CCM || \ + PSA_WANT_ALG_GCM || \ + PSA_WANT_ALG_CHACHA20_POLY1305 + help + Prompt-less configuration that states that AEAD is supported. + +config PSA_WANT_ALG_CCM + bool + prompt "PSA CCM support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_GCM + bool + prompt "PSA GCM support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CHACHA20_POLY1305 + bool + prompt "PSA ChaCha20-Poly1305 support" if !PSA_PROMPTLESS + +endmenu # PSA AEAD support + + +menu "PSA MAC support" + +config PSA_HAS_MAC_SUPPORT + bool + default y + depends on PSA_WANT_ALG_CBC_MAC || \ + PSA_WANT_ALG_CMAC || \ + PSA_WANT_ALG_HMAC + help + Prompt-less configuration that states that MAC is supported. + +config PSA_WANT_ALG_CBC_MAC + bool + prompt "PSA CBC-MAC support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CMAC + bool + prompt "PSA CMAC support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_HMAC + bool + prompt "PSA HMAC support" if !PSA_PROMPTLESS + +endmenu # PSA MAC support + + +menu "PSA Hash support" + +config PSA_HAS_HASH_SUPPORT + bool + default y + depends on PSA_WANT_ALG_SHA_1 || \ + PSA_WANT_ALG_SHA_224 || \ + PSA_WANT_ALG_SHA_256 || \ + PSA_WANT_ALG_SHA_384 || \ + PSA_WANT_ALG_SHA_512 || \ + PSA_WANT_ALG_SHA_512_224 || \ + PSA_WANT_ALG_SHA_512_256 || \ + PSA_WANT_ALG_SHA3_224 || \ + PSA_WANT_ALG_SHA3_256 || \ + PSA_WANT_ALG_SHA3_384 || \ + PSA_WANT_ALG_SHA3_512 || \ + PSA_WANT_ALG_SM3 || \ + PSA_WANT_ALG_SHAKE256_512 || \ + PSA_WANT_ALG_RIPEMD160 || \ + PSA_WANT_ALG_MD2 || \ + PSA_WANT_ALG_MD4 || \ + PSA_WANT_ALG_MD5 + help + Prompt-less configuration that states that hash is supported. + +config PSA_WANT_ALG_SHA_1 + bool + prompt "PSA SHA-1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The SHA-1 hash is weak and deprecated and is only recommended + for use in legacy protocols. + +config PSA_WANT_ALG_SHA_224 + bool + prompt "PSA SHA-224 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA_384 + bool + prompt "PSA SHA-384 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA_512 + bool + prompt "PSA SHA-512 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA_512_224 + bool + prompt "PSA SHA-512/224 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA_512_256 + bool + prompt "PSA SHA-512/256 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA3_224 + bool + prompt "PSA SHA3-224 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA3_256 + bool + prompt "PSA SHA3-256 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA3_384 + bool + prompt "PSA SHA3-384 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHA3_512 + bool + prompt "PSA SHA3-512 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SM3 + bool + prompt "PSA SM3 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SHAKE256_512 + bool + prompt "PSA SHAKE256 512 bits support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RIPEMD160 + bool + prompt "PSA RIPEMD-160 support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_MD2 + bool + prompt "PSA MD2 support (weak)" if !PSA_PROMPTLESS + help + Warning: The MD2 hash is weak and deprecated and is only recommended + for use in legacy protocols. + +config PSA_WANT_ALG_MD4 + bool + prompt "PSA MD4 support (weak)" if !PSA_PROMPTLESS + help + Warning: The MD4 hash is weak and deprecated and is only recommended + for use in legacy protocols. + +config PSA_WANT_ALG_MD5 + bool + prompt "PSA MD5 support (weak)" if !PSA_PROMPTLESS + help + Warning: The MD5 hash is weak and deprecated and is only recommended + for use in legacy protocols. + +endmenu # PSA Hash support + +menu "PSA Cipher support" + +config PSA_HAS_CIPHER_SUPPORT + bool + default y + depends on PSA_WANT_ALG_ECB_NO_PADDING || \ + PSA_WANT_ALG_CBC_NO_PADDING || \ + PSA_WANT_ALG_CBC_PKCS7 || \ + PSA_WANT_ALG_CCM_STAR_NO_TAG || \ + PSA_WANT_ALG_CFB || \ + PSA_WANT_ALG_CTR || \ + PSA_WANT_ALG_OFB || \ + PSA_WANT_ALG_XTS || \ + PSA_WANT_ALG_STREAM_CIPHER + help + Prompt-less configuration that states that cipher is supported. + +config PSA_WANT_ALG_ECB_NO_PADDING + bool + prompt "PSA ECB block cipher mode support (with no padding)" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CBC_NO_PADDING + bool + prompt "PSA CBC block cipher mode support (with no padding)" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CBC_PKCS7 + bool + prompt "PSA CBC block cipher mode support (with PKCS#7 padding)" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CFB + bool + prompt "PSA stream cipher using CFB block cipher mode support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CTR + bool + prompt "PSA stream cipher using CTR block cipher mode support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_OFB + bool + prompt "PSA stream cipher using OFB block cipher mode support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_XTS + bool + prompt "PSA XTS block cipher mode support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_CCM_STAR_NO_TAG + bool + prompt "PSA CCM* with no tag support" if !PSA_PROMPTLESS + help + Unauthenticated version of CCM. Uses the cipher API instead of the AEAD API. + +config PSA_WANT_ALG_STREAM_CIPHER + bool + prompt "PSA stream cipher support" if !PSA_PROMPTLESS + +endmenu # PSA Cipher Support + +menu "PSA Key agreement support" + +config PSA_HAS_KEY_AGREEMENT + bool + default y + depends on PSA_WANT_ALG_ECDH || PSA_WANT_ALG_FFDH + help + Promt-less configuration that states that key agreement is supported. + +config PSA_WANT_ALG_ECDH + bool + prompt "PSA ECDH support" if !PSA_PROMPTLESS + + +config PSA_WANT_ALG_FFDH + bool + prompt "PSA FFDH support" if !PSA_PROMPTLESS + +endmenu # PSA Key agreement support + +menu "PSA Key derivation support" + +config PSA_HAS_KEY_DERIVATION + bool + default y + depends on PSA_WANT_ALG_HKDF || \ + PSA_WANT_ALG_HKDF_EXPAND || \ + PSA_WANT_ALG_HKDF_EXTRACT || \ + PSA_WANT_ALG_PBKDF2_HMAC || \ + PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 || \ + PSA_WANT_ALG_TLS12_PRF || \ + PSA_WANT_ALG_TLS12_PSK_TO_MS || \ + PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS + help + Prompt-less configuration that states that key derivation is supported. + +config PSA_WANT_ALG_HKDF + bool + prompt "PSA HKDF support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_HKDF_EXTRACT + bool + prompt "PSA HKDF extract support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_HKDF_EXPAND + bool + prompt "PSA HKDF expand support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_PBKDF2_HMAC + bool + prompt "PSA PBKDF2 HMAC support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 + bool + prompt "PSA PBKDF2-AES-CMAC-PRF-128 support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_CMAC + +config PSA_WANT_ALG_SP800_108_COUNTER_HMAC + bool + prompt "Add PSA SP800-108r1 CTR HMAC KBKDF support" + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_SP800_108_COUNTER_CMAC + bool + prompt "Add PSA SP800-108r1 CTR CMAC KBKDF support" + depends on PSA_WANT_ALG_CMAC + +config PSA_WANT_ALG_TLS12_PRF + bool + prompt "PSA PRF support (TLS1.2)" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_TLS12_PSK_TO_MS + bool + prompt "PSA TLS 1.2 PSK to MS support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS + bool + prompt "PSA TLS 1.2 EC J-PAKE to PMS support" if !PSA_PROMPTLESS + depends on PSA_WANT_ALG_SHA_256 + +endmenu # PSA Key derivation support + + +menu "PSA Asymmetric support" + +config PSA_HAS_ASYM_ENCRYPT_SUPPORT + bool + default y + depends on PSA_WANT_ALG_RSA_OAEP || \ + PSA_WANT_ALG_RSA_PKCS1V15_CRYPT + help + Prompt-less configuration that states that asymmetric encryption + is supported. + + +config PSA_HAS_ASYM_SIGN_SUPPORT + bool + default y + depends on PSA_WANT_ALG_DETERMINISTIC_ECDSA || \ + PSA_WANT_ALG_ECDSA || \ + PSA_WANT_ALG_ECDSA_ANY || \ + PSA_WANT_ALG_PURE_EDDSA || \ + PSA_WANT_ALG_ED25519PH || \ + PSA_WANT_ALG_ED448PH || \ + PSA_WANT_ALG_RSA_PKCS1V15_SIGN || \ + PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW || \ + PSA_WANT_ALG_RSA_PSS || \ + PSA_WANT_ALG_RSA_PSS_ANY_SALT + help + Prompt-less configuration that states that asymmetric signing + is supported. + +config PSA_WANT_ALG_ECDSA + bool + prompt "PSA ECDSA support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_ECDSA_ANY + bool + prompt "PSA ECDSA support, without hashing" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_DETERMINISTIC_ECDSA + bool + prompt "PSA ECDSA support (deterministic mode)" if !PSA_PROMPTLESS + +menu "Elliptic Curve type support" + +config PSA_WANT_ECC_BRAINPOOL_P_R1_160 + bool + prompt "PSA ECC BrainpoolP160r1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 160-bit curve brainpoolP160r1 is weak and deprecated and + is only recommended for use in legacy protocols. + +config PSA_WANT_ECC_BRAINPOOL_P_R1_192 + bool + prompt "PSA ECC BrainpoolP192r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_224 + bool + prompt "PSA ECC BrainpoolP224r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_256 + bool + prompt "PSA ECC BrainpoolP256r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_320 + bool + prompt "PSA ECC BrainpoolP320r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_384 + bool + prompt "PSA ECC BrainpoolP384r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_512 + bool + prompt "PSA ECC BrainpoolP512r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_MONTGOMERY_255 + bool + prompt "PSA ECC Curve25519 (X25519) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_MONTGOMERY_448 + bool + prompt "PSA ECC Curve448 (X448) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_TWISTED_EDWARDS_255 + bool + prompt "PSA ECC Edwards25519 (Ed25519) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_TWISTED_EDWARDS_448 + bool + prompt "PSA ECC Edwards448 (Ed448) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_K1_192 + bool + prompt "PSA ECC secp192k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_K1_224 + bool + prompt "PSA ECC secp224k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_K1_256 + bool + prompt "PSA ECC secp256k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_192 + bool + prompt "PSA ECC secp192r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_224 + bool + prompt "PSA ECC secp224r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_256 + bool + prompt "PSA ECC secp256r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_384 + bool + prompt "PSA ECC secp384r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R1_521 + bool + prompt "PSA ECC secp521r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R2_160 + bool + prompt "PSA ECC secp160r2 support (weak)" if !PSA_PROMPTLESS + help + Warning: his family of curves is weak and deprecated. + +config PSA_WANT_ECC_SECT_K1_163 + bool + prompt "PSA ECC sect163k1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 163-bit curve sect163k1 is weak and deprecated and is + only recommended for use in legacy protocols. + +config PSA_WANT_ECC_SECT_K1_233 + bool + prompt "PSA ECC sect233k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_239 + bool + prompt "PSA ECC sect239k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_283 + bool + prompt "PSA ECC sect283k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_409 + bool + prompt "PSA ECC sect409k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_571 + bool + prompt "PSA ECC sect571k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_163 + bool + prompt "PSA ECC sect163r1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 163-bit curve sect163r1 is weak and deprecated and is + only recommended for use in legacy protocols. + +config PSA_WANT_ECC_SECT_R1_233 + bool + prompt "PSA ECC sect233r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_283 + bool + prompt "PSA ECC sect283r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_409 + bool + prompt "PSA ECC sect409r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_571 + bool + prompt "PSA ECC sect571r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R2_163 + bool + prompt "PSA ECC sect163r2 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 163-bit curve sect163r2 is weak and deprecated and is + only recommended for use in legacy protocols. + +config PSA_WANT_ECC_FRP_V1_256 + bool + prompt "PSA ECC FRP256v1 support" if !PSA_PROMPTLESS + +endmenu # Elliptic Curve type support + +config PSA_WANT_ALG_RSA_OAEP + bool + prompt "PSA RSA OAEP asymmetric encryption support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PKCS1V15_CRYPT + bool + prompt "PSA RSA PKCS#1 v1.5 asymmetric encryption support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PKCS1V15_SIGN + bool + prompt "PSA RSA PKCS#1 v1.5 message signature support, with hashing" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW + bool + prompt "PSA RSA raw PKCS#1 v1.5 message signature support, without hashing)" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PSS + bool + prompt "PSA RSA PSS message signature support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PSS_ANY_SALT + bool + prompt "PSA RSA PSS message signature support, any salt length" if !PSA_PROMPTLESS + +endmenu # PSA Asymmetric support + +config PSA_WANT_ALG_JPAKE + bool + prompt "PSA EC J-PAKE support" if !PSA_PROMPTLESS + select EXPERIMENTAL if !NET_L2_OPENTHREAD + +config PSA_WANT_ALG_SPAKE2P_HMAC + bool + prompt "PSA SPAKE2+ HMAC support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SPAKE2P_CMAC + bool + prompt "PSA SPAKE2+ CMAC support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SPAKE2P_MATTER + bool + prompt "PSA SPAKE2+ MATTER support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_SRP_6 + bool + prompt "PSA SRP-6 support" if !PSA_PROMPTLESS + select EXPERIMENTAL + +config PSA_WANT_ALG_SRP_PASSWORD_HASH + bool + prompt "PSA SRP password hash support" if !PSA_PROMPTLESS + select EXPERIMENTAL + +config PSA_HAS_PAKE_SUPPORT + bool + default y + depends on PSA_WANT_ALG_JPAKE || \ + PSA_WANT_ALG_SPAKE2P_HMAC || \ + PSA_WANT_ALG_SPAKE2P_CMAC || \ + PSA_WANT_ALG_SPAKE2P_MATTER || \ + PSA_WANT_ALG_SRP_6 || \ + PSA_WANT_ALG_SRP_PASSWORD_HASH + help + Prompt-less configuration that states that PAKE is supported. + +config PSA_WANT_ALG_PURE_EDDSA + bool + prompt "PSA PURE_EDDSA support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_ED25519PH + bool + prompt "PSA ED25519PH support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_ED448PH + bool + prompt "PSA ED448PH support" if !PSA_PROMPTLESS From a4e57b0ec26ce4c579bd0ea1ccea136422edca17 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 1 Oct 2018 10:27:32 +0200 Subject: [PATCH 2100/2300] [nrf noup] include: net: add NCS extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add some socket options and address family extensions to Zephyr headers, which will be useful for nRF Connect SDK. Add secure socket options: * Add CID socket options to NCS specific options. * Add TLS/DTLS tls ciphersuite chosen socket option to NCS specific options. * Add TLS/DTLS connection save/load socket options to NCS specific options. * Add TLS/DTLS handshake status socket option to NCS specific options. * Add SO_KEEPOPEN socket option. * Add SO_RAI socket option, deprecate the old ones. The "author" of this commit is a contact person; various people with s-o-b lines following here have contributed to the maintenance of this patch. Signed-off-by: Andreas Moltumyr Signed-off-by: Andrzej Głąbek Signed-off-by: Christopher Métrailler Signed-off-by: Emanuele Di Santo Signed-off-by: Glenn Ruben Bakke Signed-off-by: Håkon Alseth Signed-off-by: Ioannis Glaropoulos Signed-off-by: Jan Tore Guggedal Signed-off-by: Joakim Andersson Signed-off-by: Martí Bolívar Signed-off-by: Mirko Covizzi Signed-off-by: Petri Honkala Signed-off-by: Robert Lubos Signed-off-by: Tommi Mammela Signed-off-by: Trond Einar Snekvik Signed-off-by: Torsten Rasmussen Signed-off-by: Eivind Jølsgard Signed-off-by: Dominik Ermel (cherry picked from commit 3a641f9c4f14104c0f950b33b0b5d3731b431ec9) (cherry picked from commit 22f769089b5b1ae03ef0688deaf1637bca47e6ae) (cherry picked from commit e6f8064b7e9cee8748cdc6a24d01ddbd9458afa1) --- include/zephyr/net/socket.h | 1 + include/zephyr/net/socket_ncs.h | 202 ++++++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 include/zephyr/net/socket_ncs.h diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index 1ec1a9a12df..47fcbf18da1 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #ifdef __cplusplus diff --git a/include/zephyr/net/socket_ncs.h b/include/zephyr/net/socket_ncs.h new file mode 100644 index 00000000000..0023cd9bd48 --- /dev/null +++ b/include/zephyr/net/socket_ncs.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2021 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ +#define ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ + +/** + * @file + * @brief NCS specific additions to the BSD sockets API definitions + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* When CONFIG_NET_SOCKETS_OFFLOAD is enabled, offloaded sockets take precedence + * when creating a new socket. Combine this flag with a socket type when + * creating a socket, to enforce native socket creation (e. g. SOCK_STREAM | SOCK_NATIVE). + * If it's desired to create a native TLS socket, but still offload the + * underlying TCP/UDP socket, use e. g. SOCK_STREAM | SOCK_NATIVE_TLS. + */ +#define SOCK_NATIVE 0x80000000 +#define SOCK_NATIVE_TLS 0x40000000 + +/* NCS specific TLS level socket options */ + +/** Socket option to set DTLS handshake timeout, specifically for nRF sockets. + * The option accepts an integer, indicating the total handshake timeout, + * including retransmissions, in seconds. + * Accepted values for the option are: 1, 3, 7, 15, 31, 63, 123. + */ +#define TLS_DTLS_HANDSHAKE_TIMEO 18 + +/** Socket option to save DTLS connection, specifically for nRF sockets. + */ +#define TLS_DTLS_CONN_SAVE 19 + +/** Socket option to load DTLS connection, specifically for nRF sockets. + */ +#define TLS_DTLS_CONN_LOAD 20 + +/** Socket option to get result of latest TLS/DTLS completed handshakes end status, + * specifically for nRF sockets. + * The option accepts an integer, indicating the setting. + * Accepted vaules for the option are: 0 and 1. + */ +#define TLS_DTLS_HANDSHAKE_STATUS 21 + +/* Valid values for TLS_SESSION_CACHE option */ +#define TLS_SESSION_CACHE_DISABLED 0 /**< Disable TLS session caching. */ +#define TLS_SESSION_CACHE_ENABLED 1 /**< Enable TLS session caching. */ + +/* Valid values for TLS_DTLS_HANDSHAKE_TIMEO option */ +#define TLS_DTLS_HANDSHAKE_TIMEO_NONE 0 /**< No timeout */ +#define TLS_DTLS_HANDSHAKE_TIMEO_1S 1 /**< 1 second */ +#define TLS_DTLS_HANDSHAKE_TIMEO_3S 3 /**< 1s + 2s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_7S 7 /**< 1s + 2s + 4s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_15S 15 /**< 1s + 2s + 4s + 8s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_31S 31 /**< 1s + 2s + 4s + 8s + 16s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_63S 63 /**< 1s + 2s + 4s + 8s + 16s + 32s */ +#define TLS_DTLS_HANDSHAKE_TIMEO_123S 123 /**< 1s + 2s + 4s + 8s + 16s + 32s + 60s */ + +/* Valid values for TLS_DTLS_HANDSHAKE_STATUS option */ +#define TLS_DTLS_HANDSHAKE_STATUS_FULL 0 +#define TLS_DTLS_HANDSHAKE_STATUS_CACHED 1 + +/* NCS specific socket options */ + +/** sockopt: enable sending data as part of exceptional events */ +#define SO_EXCEPTIONAL_DATA 33 +/** sockopt: Keep socket open when its PDN connection is lost + * or the device is put into flight mode. + */ +#define SO_KEEPOPEN 34 +/** sockopt: bind to PDN */ +#define SO_BINDTOPDN 40 +/** sockopt: Release Assistance Indication feature: This will indicate that the + * application will not send any more data. + * + * @note This socket option requires the socket to be connected. + * + * @deprecated use @ref SO_RAI with value @ref RAI_NO_DATA instead. + */ +#define SO_RAI_NO_DATA 50 +/** sockopt: Release Assistance Indication feature: This will indicate that the + * next call to send/sendto will be the last one for some time. + * + * @deprecated use @ref SO_RAI with value @ref RAI_LAST instead. + */ +#define SO_RAI_LAST 51 +/** sockopt: Release Assistance Indication feature: This will indicate that + * after the next call to send/sendto, the application is expecting to receive + * one more data packet before this socket will not be used again for some time. + * + * @deprecated use @ref SO_RAI with value @ref RAI_ONE_RESP instead. + */ +#define SO_RAI_ONE_RESP 52 +/** sockopt: Release Assistance Indication feature: If a client application + * expects to use the socket more it can indicate that by setting this socket + * option before the next send call which will keep the network up longer. + * + * @deprecated use @ref SO_RAI with value @ref RAI_ONGOING instead. + */ +#define SO_RAI_ONGOING 53 +/** sockopt: Release Assistance Indication feature: If a server application + * expects to use the socket more it can indicate that by setting this socket + * option before the next send call. + * + * @deprecated use @ref SO_RAI with value @ref RAI_WAIT_MORE instead. + */ +#define SO_RAI_WAIT_MORE 54 + +/** sockopt: Release assistance indication (RAI). + * The option accepts an integer, indicating the type of RAI. + * Accepted values for the option are: @ref RAI_NO_DATA, @ref RAI_LAST, @ref RAI_ONE_RESP, + * @ref RAI_ONGOING, @ref RAI_WAIT_MORE. + */ +#define SO_RAI 61 + +/** Release assistance indication (RAI). + * Indicate that the application does not intend to send more data. + * This applies immediately and lets the modem exit connected mode more + * quickly. + * + * @note This requires the socket to be connected. + */ +#define RAI_NO_DATA 1 +/** Release assistance indication (RAI). + * Indicate that the application does not intend to send more data + * after the next call to send() or sendto(). + * This lets the modem exit connected mode more quickly after sending the data. + */ +#define RAI_LAST 2 +/** Release assistance indication (RAI). + * Indicate that the application is expecting to receive just one data packet + * after the next call to send() or sendto(). + * This lets the modem exit connected mode more quickly after having received the data. + */ +#define RAI_ONE_RESP 3 +/** Release assistance indication (RAI). + * Indicate that the socket is in active use by a client application. + * This lets the modem stay in connected mode longer. + */ +#define RAI_ONGOING 4 +/** Release assistance indication (RAI). + * Indicate that the socket is in active use by a server application. + * This lets the modem stay in connected mode longer. + */ +#define RAI_WAIT_MORE 5 + +/* NCS specific IPPROTO_ALL level socket options */ + +/** IPv4 and IPv6 protocol level (pseudo-val) for nRF sockets. */ +#define IPPROTO_ALL 512 +/** sockopt: disable all replies to unexpected traffics */ +#define SO_SILENCE_ALL 30 + +/* NCS specific IPPROTO_IP level socket options */ + +/** sockopt: enable IPv4 ICMP replies */ +#define SO_IP_ECHO_REPLY 31 + +/* NCS specific IPPROTO_IPV6 level socket options */ + +/** sockopt: enable IPv6 ICMP replies */ +#define SO_IPV6_ECHO_REPLY 32 + +/* NCS specific TCP level socket options */ + +/** sockopt: Configurable TCP server session timeout in minutes. + * Range is 0 to 135. 0 is no timeout and 135 is 2 h 15 min. Default is 0 (no timeout). + */ +#define SO_TCP_SRV_SESSTIMEO 55 + +/* NCS specific gettaddrinfo() flags */ + +/** Assume `service` contains a Packet Data Network (PDN) ID. + * When specified together with the AI_NUMERICSERV flag, + * `service` shall be formatted as follows: "port:pdn_id" + * where "port" is the port number and "pdn_id" is the PDN ID. + * Example: "8080:1", port 8080 PDN ID 1. + * Example: "42:0", port 42 PDN ID 0. + */ +#define AI_PDNSERV 0x1000 + +/* NCS specific send() and sendto() flags */ + +/** Request a blocking send operation until the request is acknowledged. + * When used in send() or sendto(), the request will not return until the + * send operation is completed by lower layers, or until the timeout, given by the SO_SNDTIMEO + * socket option, is reached. Valid timeout values are 1 to 600 seconds. + */ +#define MSG_WAITACK 0x200 + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_NET_SOCKET_NCS_H_ */ From c4c30c3610a9ac94cc91d9c785bed34065b2ddf5 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Thu, 29 Feb 2024 19:40:12 +0100 Subject: [PATCH 2101/2300] [nrf fromlist] modules: hal_nordic: Enforce nrf-regtool minimum version Require the presence of the nrf-regtool package as well as requiring a minimum version, failing the build whenever a suitable version is not found in the system. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69633 Signed-off-by: Carles Cufi Signed-off-by: Robert Lubos (cherry picked from commit 0e13f61d8ed687a2cc428c8a0458f496e639bd70) (cherry picked from commit 8d93a161567dcc525771f70692587e6a37947b71) (cherry picked from commit 3eb95e74276b956f1eda8649e54a6fbd8f8a46b1) (cherry picked from commit 22df05a1f6caa10bed711b9545e520cf8b27580b) --- 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 3ee6356cc97..3c8c4394560 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.2.0 + find_package(nrf-regtool 5.2.0 REQUIRED COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From 265445367c98b91646d974609c176115f1225ffe Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Mon, 16 Jan 2023 14:15:22 +0100 Subject: [PATCH 2102/2300] [nrf noup] dts: choose a crypto accelerator for entropy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a long-term noup patch because crypto driver support is NCS-only for both cryptocell and CRACEN. Set HAS_HW_NRF_CC3XX to be defined in NS build when cryptocell is accessed through the PSA API. We need to know which CC3XX features are available. Set PSA as the entropy source for 54L. PSA is the only NCS-supported interface to CRACEN. Signed-off-by: Georgios Vasilakis Signed-off-by: Joakim Andersson Signed-off-by: Dominik Ermel Signed-off-by: Sebastian Bøe Signed-off-by: Robert Lubos (cherry picked from commit 499041d072580ae79d4fe967f0df52e60e43966b) (cherry picked from commit baa4ee7ebd5d885119d6d196d62c1ca1e6af5841) (cherry picked from commit 4fa3cc9657abf7334c4e44257c57684db65a1b3f) (cherry picked from commit 2aba1375175390c61cdc6b9af57d2f3494891c43) --- dts/arm/nordic/nrf52840.dtsi | 4 ++-- dts/arm/nordic/nrf5340_cpuapp.dtsi | 4 ++-- dts/arm/nordic/nrf54l15_cpuapp.dtsi | 6 +++++- dts/arm/nordic/nrf91.dtsi | 3 ++- soc/nordic/common/Kconfig.peripherals | 6 ++++-- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 4cfb7abc511..c105da55c76 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -5,7 +5,7 @@ / { chosen { - zephyr,entropy = &rng; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -547,7 +547,7 @@ reg = <0x5002a000 0x1000>, <0x5002b000 0x1000>; reg-names = "wrapper", "core"; interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; }; diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index e40f6241d91..d48f0ce62dc 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -33,7 +33,7 @@ }; chosen { - zephyr,entropy = &rng_hci; + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -102,7 +102,7 @@ reg = <0x50844000 0x1000>, <0x50845000 0x1000>; reg-names = "wrapper", "core"; interrupts = <68 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf54l15_cpuapp.dtsi b/dts/arm/nordic/nrf54l15_cpuapp.dtsi index 6a4f5fcae23..1ba55fd8d00 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp.dtsi @@ -23,9 +23,13 @@ cpuflpr_vevif: &cpuflpr_vevif_remote {}; ranges; }; + chosen { + zephyr,entropy = &psa_rng; + }; + psa_rng: psa-rng { compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; + status = "okay"; }; }; diff --git a/dts/arm/nordic/nrf91.dtsi b/dts/arm/nordic/nrf91.dtsi index 78502d3f086..0fb4c4addf4 100644 --- a/dts/arm/nordic/nrf91.dtsi +++ b/dts/arm/nordic/nrf91.dtsi @@ -27,6 +27,7 @@ }; chosen { + zephyr,entropy = &cryptocell; zephyr,flash-controller = &flash_controller; }; @@ -50,7 +51,7 @@ reg = <0x50840000 0x1000>, <0x50841000 0x1000>; reg-names = "wrapper", "core"; interrupts = <64 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; + status = "okay"; }; ctrlap: ctrlap@50006000 { diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index a6d730804b8..f9b01417677 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -13,10 +13,12 @@ config HAS_HW_NRF_BPROT def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_BPROT)) config HAS_HW_NRF_CC310 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_310)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_SERIES_NRF91X) config HAS_HW_NRF_CC312 - def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) + def_bool $(dt_compat_enabled,$(DT_COMPAT_ARM_CRYPTOCELL_312)) || \ + ($(dt_nodelabel_enabled,psa_rng) && SOC_NRF5340_CPUAPP) config HAS_HW_NRF_CCM def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_CCM)) From fbfb4dfc3e7ce13f298aa830d702757d409400f9 Mon Sep 17 00:00:00 2001 From: Sigvart Hovland Date: Fri, 3 May 2019 14:21:52 +0200 Subject: [PATCH 2103/2300] [nrf noup] tree-wide: support NCS Partition Manager (PM) definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partition Manager (PM) is a component of the nRF Connect SDK (NCS) which uses yaml files to resolve flash partition placement with a holistic view of the entire device, including each firmware image present on the flash device, and various subsystems, such as settings and NFFS. When this NCS extension is used, various source files which would use partition information from devicetree in "vanilla" zephyr instead use defines generated by PM instead. This commit removes support for HEX_FILES_TO_MERGE, as it conflicts with PM. The settings subsystem pm.yml defines a partition 'settings_storage'. The nffs subsystem pm.yml defines 'nffs_storage'. Leverage label translation to avoid patching partition names. Refer to the NCS documentation page for this feature for more details. This is a long-running out of tree patch which has been worked on by several people. The following sign-offs are in alphabetical order by first name. Signed-off-by: Andrzej Głąbek Signed-off-by: Andrzej Puzdrowski Signed-off-by: Håkon Øye Amundsen Signed-off-by: Ioannis Glaropoulos Signed-off-by: Joakim Andersson Signed-off-by: Johann Fischer Signed-off-by: Martí Bolívar Signed-off-by: Ole Sæther Signed-off-by: Robert Lubos Signed-off-by: Sebastian Bøe Signed-off-by: Sigvart Hovland Signed-off-by: Thomas Stenersen Signed-off-by: Torsten Rasmussen Signed-off-by: Øyvind Rønningstad Signed-off-by: Trond Einar Snekvik Signed-off-by: Gerard Marull-Paretas Signed-off-by: Tomasz Moń Signed-off-by: Dominik Ermel (cherry picked from commit a7fb26837763ee7c21fb666fe2faa8c7503a17f1) (cherry picked from commit ea83f6ccc7786349ddcf267af19a1b63e0fe950f) (cherry picked from commit 91b6032820a140a6722f0838544f55d69b99a3e1) --- arch/arm/core/mpu/arm_mpu_regions.c | 13 ++++++ cmake/modules/kernel.cmake | 4 ++ drivers/flash/soc_flash_nrf.c | 11 +++++ .../arch/arm/cortex_m/scripts/linker.ld | 46 +++++++++++++++++++ include/zephyr/storage/flash_map.h | 6 +++ lib/heap/Kconfig | 2 +- lib/libc/common/source/stdlib/malloc.c | 18 +++++++- subsys/fs/littlefs_fs.c | 7 ++- subsys/ipc/rpmsg_service/rpmsg_backend.h | 27 +++++++++++ 9 files changed, 130 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/mpu/arm_mpu_regions.c b/arch/arm/core/mpu/arm_mpu_regions.c index 6af62f84078..cfe1230c907 100644 --- a/arch/arm/core/mpu/arm_mpu_regions.c +++ b/arch/arm/core/mpu/arm_mpu_regions.c @@ -8,6 +8,9 @@ #include #include +#if USE_PARTITION_MANAGER +#include +#endif static const struct arm_mpu_region mpu_regions[] = { /* Region 0 */ @@ -21,6 +24,14 @@ static const struct arm_mpu_region mpu_regions[] = { #endif /* Region 1 */ MPU_REGION_ENTRY("SRAM_0", +#if USE_PARTITION_MANAGER + PM_SRAM_ADDRESS, +#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) + REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)), +#else + REGION_RAM_ATTR(REGION_SRAM_SIZE)), +#endif +#else CONFIG_SRAM_BASE_ADDRESS, #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \ @@ -28,6 +39,8 @@ static const struct arm_mpu_region mpu_regions[] = { #else REGION_RAM_ATTR(REGION_SRAM_SIZE)), #endif + +#endif /* USE_PARTITION_MANAGER */ }; const struct arm_mpu_config mpu_config = { diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index fa1e6681221..b4906872a30 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -248,3 +248,7 @@ if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4") include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake) eclipse_cdt4_generator_amendment(1) endif() + +if(ZEPHYR_NRF_MODULE_DIR) + include(${ZEPHYR_NRF_MODULE_DIR}/cmake/partition_manager.cmake) +endif() diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index cc840309264..b5a3fefa1e5 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -37,6 +37,11 @@ LOG_MODULE_REGISTER(flash_nrf); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER +#include +#include +#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */ + #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE #define FLASH_SLOT_WRITE 7500 #if defined(CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE) @@ -166,6 +171,12 @@ static int flash_nrf_read(const struct device *dev, off_t addr, } #endif +#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS + if (addr < PM_APP_ADDRESS) { + return soc_secure_mem_read(data, (void *)addr, len); + } +#endif + nrf_nvmc_buffer_read(data, (uint32_t)addr, len); return 0; diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 88598cf5790..7c766ffecc5 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -34,6 +34,35 @@ #define ROMSTART_REGION ROMABLE_REGION #endif +#if USE_PARTITION_MANAGER + +#include + +#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID) +/* We are linking against S1, create symbol containing the flash ID of S0. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S0_ID; + +#else /* ! CONFIG_NCS_IS_VARIANT_IMAGE */ + +#ifdef PM_S1_ID +/* We are linking against S0, create symbol containing the flash ID of S1. + * This is used when writing code operating on the "other" slot. + */ +_image_1_primary_slot_id = PM_S1_ID; +#endif /* PM_S1_ID */ + +#endif /* CONFIG_NCS_IS_VARIANT_IMAGE */ + +#define ROM_ADDR PM_ADDRESS +#define ROM_SIZE PM_SIZE + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) #define ROM_ADDR RAM_ADDR #else @@ -66,6 +95,23 @@ #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS #endif +#endif /* USE_PARTITION_MANAGER */ + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#define CCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ccm)) +#define CCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ccm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#define ITCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_itcm)) +#define ITCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_itcm)) +#endif + +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#define DTCM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm)) +#define DTCM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)) +#endif + #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; #else diff --git a/include/zephyr/storage/flash_map.h b/include/zephyr/storage/flash_map.h index b03628afc93..c76ca18bae2 100644 --- a/include/zephyr/storage/flash_map.h +++ b/include/zephyr/storage/flash_map.h @@ -273,6 +273,10 @@ const char *flash_area_label(const struct flash_area *fa); */ uint8_t flash_area_erased_val(const struct flash_area *fa); +#if USE_PARTITION_MANAGER +#include +#else + /** * Returns non-0 value if fixed-partition of given DTS node label exists. * @@ -358,6 +362,8 @@ uint8_t flash_area_erased_val(const struct flash_area *fa); #define FIXED_PARTITION_NODE_DEVICE(node) \ DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(node)) +#endif /* USE_PARTITION_MANAGER */ + #ifdef __cplusplus } #endif diff --git a/lib/heap/Kconfig b/lib/heap/Kconfig index 7f01b280b3b..68476eb735c 100644 --- a/lib/heap/Kconfig +++ b/lib/heap/Kconfig @@ -68,7 +68,7 @@ config HEAP_LISTENER choice prompt "Supported heap sizes" depends on !64BIT - default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) + default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256) && !PARTITION_MANAGER_ENABLED default SYS_HEAP_AUTO help Heaps using reduced-size chunk headers can accommodate so called diff --git a/lib/libc/common/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c index e3a5db6f7d5..2f469d673e4 100644 --- a/lib/libc/common/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -25,6 +25,20 @@ #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); +#if USE_PARTITION_MANAGER + +#include + +#define RAM_SIZE PM_SRAM_SIZE +#define RAM_ADDR PM_SRAM_ADDRESS + +#else /* ! USE_PARTITION_MANAGER */ + +#define RAM_SIZE (KB((size_t) CONFIG_SRAM_SIZE)) +#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS + +#endif /* USE_PARTITION_MANAGER */ + #ifdef CONFIG_COMMON_LIBC_MALLOC #if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0) @@ -106,8 +120,8 @@ static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE]; extern char _heap_sentry[]; # define HEAP_SIZE ROUND_DOWN((POINTER_TO_UINT(_heap_sentry) - HEAP_BASE), HEAP_ALIGN) # else -# define HEAP_SIZE ROUND_DOWN((KB((size_t) CONFIG_SRAM_SIZE) - \ - ((size_t) HEAP_BASE - (size_t) CONFIG_SRAM_BASE_ADDRESS)), HEAP_ALIGN) +# define HEAP_SIZE ROUND_DOWN((RAM_SIZE - \ + ((size_t) HEAP_BASE - (size_t) RAM_ADDR)), HEAP_ALIGN) # endif /* else CONFIG_XTENSA */ # endif /* else CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0 */ diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index b373ca92ba8..3fc84c2922d 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1054,7 +1054,12 @@ struct fs_mount_t FS_FSTAB_ENTRY(DT_DRV_INST(inst)) = { \ .type = FS_LITTLEFS, \ .mnt_point = DT_INST_PROP(inst, mount_point), \ .fs_data = &fs_data_##inst, \ - .storage_dev = (void *)DT_FIXED_PARTITION_ID(FS_PARTITION(inst)), \ + .storage_dev = (void *) \ + COND_CODE_1(USE_PARTITION_MANAGER, \ + (COND_CODE_1(FIXED_PARTITION_EXISTS(littlefs_storage), \ + (FIXED_PARTITION_ID(littlefs_storage)), \ + (FIXED_PARTITION_ID(storage)))), \ + (DT_FIXED_PARTITION_ID(FS_PARTITION(inst)))), \ .flags = FSTAB_ENTRY_DT_MOUNT_FLAGS(DT_DRV_INST(inst)), \ }; diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h index a74e46b8520..9996e1d74d9 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,8 +13,35 @@ extern "C" { #endif +#if CONFIG_PARTITION_MANAGER_ENABLED + +#include "pm_config.h" + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) + +#if defined(PM_RPMSG_NRF53_SRAM_ADDRESS) +#define VDEV_START_ADDR PM_RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM_RPMSG_NRF53_SRAM_SIZE +#else +/* The current image is a child image in a different domain than the image + * which defined the required values. To reach the values of the parent domain + * we use the 'PM__' variant of the define. + */ +#define VDEV_START_ADDR PM__RPMSG_NRF53_SRAM_ADDRESS +#define VDEV_SIZE PM__RPMSG_NRF53_SRAM_SIZE +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) */ + +#else #define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) #define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) +#endif /* defined(PM_RPMSG_NRF53_SRAM_ADDRESS) || defined(PM__RPMSG_NRF53_SRAM_ADDRESS) */ + +#else + +#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm)) +#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm)) + +#endif /* CONFIG_PARTITION_MANAGER_ENABLED */ #define VDEV_STATUS_ADDR VDEV_START_ADDR #define VDEV_STATUS_SIZE 0x400 From eb71554f6cde91a1ea045efcf9b9c07f79b6be76 Mon Sep 17 00:00:00 2001 From: Kamil Gawor Date: Tue, 9 Apr 2024 14:24:34 +0200 Subject: [PATCH 2104/2300] [nrf noup] entropy: Add fake entropy nRF PRNG driver This adds temporary entropy driver simulation for nRF54h20 device since final entropy source is not available yet. TODO: Remove this commit when proper solution will be available. Jira: NCSDK-25947 Signed-off-by: Kamil Gawor Signed-off-by: Robert Lubos (cherry picked from commit c976657eb74bfb052d93479be37594bddeff3d86) (cherry picked from commit e2b6a2d4d387e9d38f59befcdade925663125594) --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 6 ++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 5 + drivers/entropy/CMakeLists.txt | 7 ++ drivers/entropy/Kconfig | 1 + drivers/entropy/Kconfig.nrf_prng | 19 ++++ drivers/entropy/fake_entropy_nrf_prng.c | 101 ++++++++++++++++++ dts/bindings/rng/nordic,nrf-prng.yaml | 8 ++ 7 files changed, 147 insertions(+) create mode 100644 drivers/entropy/Kconfig.nrf_prng create mode 100644 drivers/entropy/fake_entropy_nrf_prng.c create mode 100644 dts/bindings/rng/nordic,nrf-prng.yaml diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 374a6272452..c8b8ec029d3 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -27,6 +27,7 @@ zephyr,ieee802154 = &cpuapp_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &prng; }; aliases { @@ -93,6 +94,11 @@ label = "Green LED 3"; }; }; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; }; &cpuapp_ram0x_region { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index f8aff548436..e3f38846d62 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -28,6 +28,11 @@ zephyr,ieee802154 = &cpurad_ieee802154; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; + zephyr,entropy = &prng; + }; + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; }; aliases { ipc-to-cpusys = &cpurad_cpusys_ipc; diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt index 80d9c28d0e6..5fd383d4b64 100644 --- a/drivers/entropy/CMakeLists.txt +++ b/drivers/entropy/CMakeLists.txt @@ -34,4 +34,11 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE entropy_gecko_se. zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypto.c) zephyr_library_sources_ifdef(CONFIG_ENTROPY_NPCX_DRBG entropy_npcx_drbg.c) +if (CONFIG_FAKE_ENTROPY_NRF_PRNG) + zephyr_library_sources(fake_entropy_nrf_prng.c) + + message(WARNING "\nA nRF PRNG is used, which does not produce real random bits." + "This is not secure and should therefore never be used in a product.") +endif() + zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api) diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index 34c020256bf..b1479756460 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -36,6 +36,7 @@ source "drivers/entropy/Kconfig.neorv32" source "drivers/entropy/Kconfig.bt_hci" source "drivers/entropy/Kconfig.psa_crypto" source "drivers/entropy/Kconfig.npcx" +source "drivers/entropy/Kconfig.nrf_prng" config ENTROPY_HAS_DRIVER bool diff --git a/drivers/entropy/Kconfig.nrf_prng b/drivers/entropy/Kconfig.nrf_prng new file mode 100644 index 00000000000..e1b1a9ab4fe --- /dev/null +++ b/drivers/entropy/Kconfig.nrf_prng @@ -0,0 +1,19 @@ +# nRF fake entropy prng generator driver configuration + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if ENTROPY_GENERATOR + +config FAKE_ENTROPY_NRF_PRNG + bool "A fake nRF entropy driver" + default y + depends on DT_HAS_NORDIC_ENTROPY_PRNG_ENABLED + depends on SOC_SERIES_NRF54HX + select ENTROPY_HAS_DRIVER + help + This is a super simple PRNG driver that can be used on nRF platforms that + do not have an entropy source. + This is NOT SAFE to use for cryptographic operations! + +endif diff --git a/drivers/entropy/fake_entropy_nrf_prng.c b/drivers/entropy/fake_entropy_nrf_prng.c new file mode 100644 index 00000000000..8624c844405 --- /dev/null +++ b/drivers/entropy/fake_entropy_nrf_prng.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#define DT_DRV_COMPAT nordic_entropy_prng + +/* This file implements a pseudo-RNG + * https://vigna.di.unimi.it/xorshift/xoshiro128plus.c + */ + +static uint32_t s[4]; + +static inline uint32_t rotl(const uint32_t x, int k) +{ + return (x << k) | (x >> (32 - k)); +} + +static uint32_t rng_next(void) +{ + const uint32_t result = rotl(s[0] + s[3], 7) + s[0]; + + const uint32_t t = s[1] << 9; + + s[2] ^= s[0]; + s[3] ^= s[1]; + s[1] ^= s[2]; + s[0] ^= s[3]; + + s[2] ^= t; + + s[3] = rotl(s[3], 11); + + return result; +} + +static int entropy_prng_get_entropy(const struct device *dev, uint8_t *buffer, uint16_t length) +{ + ARG_UNUSED(dev); + + while (length) { + /* + * Note that only 1 thread (Zephyr thread or HW models), runs at + * a time, therefore there is no need to use random_r() + */ + uint32_t value = rng_next(); + + size_t to_copy = MIN(length, sizeof(long)); + + memcpy(buffer, &value, to_copy); + buffer += to_copy; + length -= to_copy; + } + + return 0; +} + +static int entropy_prng_get_entropy_isr(const struct device *dev, uint8_t *buf, uint16_t len, + uint32_t flags) +{ + ARG_UNUSED(flags); + + int err; + + /* + * entropy_prng_get_entropy() is also safe for ISRs + * and always produces data. + */ + err = entropy_prng_get_entropy(dev, buf, len); + if (err < 0) { + return err; + } else { + return len; + } +} + +static int entropy_prng_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + /* Picked some arbitrary initial seed. */ + s[0] = 0xAF568BC0; + s[1] = 0xAC34307E; + s[2] = 0x9B7F6DD1; + s[3] = 0xD84319FC; + return 0; +} + +static const struct entropy_driver_api entropy_prng_api_funcs = { + .get_entropy = entropy_prng_get_entropy, .get_entropy_isr = entropy_prng_get_entropy_isr}; + +DEVICE_DT_INST_DEFINE(0, entropy_prng_init, NULL, NULL, NULL, PRE_KERNEL_1, + CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prng_api_funcs); diff --git a/dts/bindings/rng/nordic,nrf-prng.yaml b/dts/bindings/rng/nordic,nrf-prng.yaml new file mode 100644 index 00000000000..8936393a0b6 --- /dev/null +++ b/dts/bindings/rng/nordic,nrf-prng.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +description: This is a super simple PRNG + +compatible: "nordic,entropy-prng" + +include: base.yaml From 8217fd314bd2aab6d1d27ce017e3ab26b79821f3 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 12 Apr 2024 14:13:12 +0200 Subject: [PATCH 2105/2300] [nrf noup] boards: add nrf54l15/nrf54l15/cpuapp/ns as board variant This commit adds the nRF54l15//nrf54l15/cpuapp/ns board variant to sdk-zephyr. It allows to build nRF54l15pdk with TF-M in nRF Connect SDK. This is done as a nrf noup patch as the out-of-tree board extension feature is not available. When zephyrproject-rtos/zephyr#69548 is completed, then this commit can be reverted and the variant be placed in sdk-nrf repository. Signed-off-by: Torsten Rasmussen Signed-off-by: Robert Lubos (cherry picked from commit c8cc6634d2bd1c03e150342b7b0568c0eb191c92) --- boards/nordic/nrf54l15pdk/Kconfig | 43 ++++++ boards/nordic/nrf54l15pdk/Kconfig.defconfig | 18 +++ boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk | 2 +- boards/nordic/nrf54l15pdk/board.cmake | 8 ++ boards/nordic/nrf54l15pdk/board.yml | 2 + ...rf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi | 38 +++++ .../nrf54l15pdk_nrf54l15_cpuapp_ns.dts | 132 ++++++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp_ns.yaml | 22 +++ .../nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig | 31 ++++ 9 files changed, 295 insertions(+), 1 deletion(-) create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig diff --git a/boards/nordic/nrf54l15pdk/Kconfig b/boards/nordic/nrf54l15pdk/Kconfig index 638ce57499d..db822a14820 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig +++ b/boards/nordic/nrf54l15pdk/Kconfig @@ -11,3 +11,46 @@ config BOARD_ENABLE_DCDC default y endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP + +if BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS + +# TODO: Remove the options bellow when (NCSDK-25023) is done +config NRF_SPU_FLASH_REGION_SIZE + hex + default 0x4000 + # This option does not apply to 54, but we pretend the HW has this limitation + # for now for easier porting. NCSDK-25023 + help + FLASH region size for the NRF_SPU peripheral. For nrf54 the + region size is configurable per-region so this option does + not apply. + +config NRF_SPU_FLASH_REGION_ALIGNMENT + hex + default 0x4000 + # This option does not apply to 54, but we pretend the HW has this limitation + # for now for easier porting. NCSDK-25023 + help + FLASH region size for the NRF_SPU peripheral. For nrf54 the + region size is configurable per-region so this option does + not apply. + +config NRF_SPU_RAM_REGION_SIZE + hex + default 0x2000 + # This HW limitation does not apply to 54, but we pretend + # it does for now for easier porting. NCSDK-25023 + help + RAM region size for the NRF_SPU peripheral. For nrf54 the + region size is configurable per-region so this option does + not apply. + + +config NRF_SPU_RAM_REGION_ALIGNMENT + hex + default 0x1000 + help + RAM regions must be aligned to this value due to SPU HW + limitations. + +endif #BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS diff --git a/boards/nordic/nrf54l15pdk/Kconfig.defconfig b/boards/nordic/nrf54l15pdk/Kconfig.defconfig index 6db1005d4df..87b8c1d0cc3 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15pdk/Kconfig.defconfig @@ -11,3 +11,21 @@ config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT endif # BOARD_NRF54L15PDK_NRF54L15_CPUAPP + +if BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS + +config BT_CTLR + default BT + +# By default, if we build for a Non-Secure version of the board, +# enable building with TF-M as the Secure Execution Environment. +config BUILD_WITH_TFM + default y if BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS + +# 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 + default y + depends on BUILD_WITH_TFM + +endif #BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS diff --git a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk index d5116bd50c6..09afebc2e09 100644 --- a/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk +++ b/boards/nordic/nrf54l15pdk/Kconfig.nrf54l15pdk @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF54L15PDK - select SOC_NRF54L15_ENGA_CPUAPP if BOARD_NRF54L15PDK_NRF54L15_CPUAPP + select SOC_NRF54L15_ENGA_CPUAPP if BOARD_NRF54L15PDK_NRF54L15_CPUAPP || BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS select SOC_NRF54L15_ENGA_CPUFLPR if BOARD_NRF54L15PDK_NRF54L15_CPUFLPR || \ BOARD_NRF54L15PDK_NRF54L15_CPUFLPR_XIP diff --git a/boards/nordic/nrf54l15pdk/board.cmake b/boards/nordic/nrf54l15pdk/board.cmake index 0eea21c3d14..1427b6e9154 100644 --- a/boards/nordic/nrf54l15pdk/board.cmake +++ b/boards/nordic/nrf54l15pdk/board.cmake @@ -7,6 +7,14 @@ elseif (CONFIG_SOC_NRF54L15_ENGA_CPUFLPR) board_runner_args(jlink "--speed=4000") endif() +if(BOARD_NRF54L15PDK_NRF54L15_CPUAPP_NS) + set(TFM_PUBLIC_KEY_FORMAT "full") +endif() + +if(CONFIG_TFM_FLASH_MERGED_BINARY) + set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex) +endif() + include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/nordic/nrf54l15pdk/board.yml b/boards/nordic/nrf54l15pdk/board.yml index e692040f7bd..5df0270abe3 100644 --- a/boards/nordic/nrf54l15pdk/board.yml +++ b/boards/nordic/nrf54l15pdk/board.yml @@ -6,6 +6,8 @@ board: variants: - name: xip cpucluster: cpuflpr + - name: ns + cpucluster: cpuapp revision: format: major.minor.patch default: "0.3.0" diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi new file mode 100644 index 00000000000..b4b924e90ef --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&pinctrl { + uart20_default: uart20_default { + group1 { + psels = , + ; + }; + }; + + uart20_sleep: uart20_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + uart30_default: uart30_default { + group1 { + psels = , + ; + }; + }; + + uart30_sleep: uart30_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + +}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts new file mode 100644 index 00000000000..49fd1ac0ece --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/dts-v1/; +#include +#include "nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi" + +/ { + chosen { + zephyr,console = &uart20; + /* TODO: NCSDK-24862: We don't support configuring RRAM and SRAM + * regions in the DTS file yet. The partition manager configures + * these regions now. + */ + zephyr,shell-uart = &uart20; + zephyr,flash = &rram0; + zephyr,sram = &sram0; + zephyr,ieee802154 = &ieee802154; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + label = "Green LED 0"; + }; + led1: led_1 { + gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; + }; + led2: led_2 { + gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + label = "Green LED 2"; + }; + led3: led_3 { + gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + label = "Green LED 3"; + }; + }; + + buttons { + compatible = "gpio-keys"; + button0: button_0 { + gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 0"; + zephyr,code = ; + }; + button1: button_1 { + gpios = <&gpio1 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 1"; + zephyr,code = ; + }; + button2: button_2 { + gpios = <&gpio2 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 2"; + zephyr,code = ; + }; + button3: button_3 { + gpios = <&gpio2 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 3"; + zephyr,code = ; + }; + }; + + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + }; +}; + +&uart20 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart20_default>; + pinctrl-1 = <&uart20_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart30 { + /* Disable so that TF-M can use this UART */ + status = "disabled"; + + current-speed = <115200>; + pinctrl-0 = <&uart30_default>; + pinctrl-1 = <&uart30_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&grtc { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&ieee802154 { + status = "okay"; +}; + +&temp { + status = "okay"; +}; + +&clock { + status = "okay"; +}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml new file mode 100644 index 00000000000..460803eaa53 --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.yaml @@ -0,0 +1,22 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +identifier: nrf54l15pdk/nrf54l15/cpuapp/ns +name: nRF54l15-PDK-nRF54l15-Application-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 256 +flash: 1524 +supported: + - adc + - gpio + - i2c + - spi + - counter + - watchdog + - adc + - i2s diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig new file mode 100644 index 00000000000..70f01d7c9ba --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns_defconfig @@ -0,0 +1,31 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# This Board implies building Non-Secure firmware +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +# Don't enable the cache in the non-secure image as it is a +# secure-only peripheral on 54l +CONFIG_CACHE_MANAGEMENT=n +CONFIG_EXTERNAL_CACHE=n + +CONFIG_UART_CONSOLE=y +CONFIG_CONSOLE=y +CONFIG_SERIAL=y + +# Enable GPIO +CONFIG_GPIO=y + +# Start SYSCOUNTER on driver init +CONFIG_NRF_GRTC_START_SYSCOUNTER=y From 1c902bc9b57ac72d398182730e8e5b3c53963c75 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 17 Apr 2024 13:51:37 +0200 Subject: [PATCH 2106/2300] [nrf fromlist] dts: nordic: Add RESETINFO Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71609 Add devicetree nodes for the Reset Information registers on nRF54H20, along with a new binding. Signed-off-by: Grzegorz Swiderski Signed-off-by: Robert Lubos (cherry picked from commit 8fe636b4d583b7f3d119d7e80094e3b5bfa52099) (cherry picked from commit a72f221020e3f138aa0645476d1358a0797f1d36) --- dts/bindings/arm/nordic,nrf-resetinfo.yaml | 12 ++++++++++++ dts/common/nordic/nrf54h20.dtsi | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 dts/bindings/arm/nordic,nrf-resetinfo.yaml diff --git a/dts/bindings/arm/nordic,nrf-resetinfo.yaml b/dts/bindings/arm/nordic,nrf-resetinfo.yaml new file mode 100644 index 00000000000..c8585e5897e --- /dev/null +++ b/dts/bindings/arm/nordic,nrf-resetinfo.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic RESETINFO (Reset Information) + +compatible: "nordic,nrf-resetinfo" + +include: base.yaml + +properties: + reg: + required: true diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 0e429ab3a9d..7c5a990563c 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -187,6 +187,11 @@ compatible = "nordic,nrf-ieee802154"; status = "disabled"; }; + + cpuapp_resetinfo: resetinfo@1e000 { + compatible = "nordic,nrf-resetinfo"; + reg = <0x1e000 0x1000>; + }; }; cpurad_peripherals: peripheral@53000000 { @@ -221,6 +226,11 @@ interrupts = <20 NRF_DEFAULT_IRQ_PRIORITY>; }; + cpurad_resetinfo: resetinfo@1e000 { + compatible = "nordic,nrf-resetinfo"; + reg = <0x1e000 0x1000>; + }; + dppic020: dppic@22000 { compatible = "nordic,nrf-dppic-local"; reg = <0x22000 0x1000>; From ab47b86c62854f2c71933f2f54d64aff48bb9691 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Tue, 19 Dec 2023 15:25:08 +0100 Subject: [PATCH 2107/2300] [nrf fromlist] drivers: timer: grtc: Update GRTC driver Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/71688 This commit aligns the GRTC driver to changes introduced in hal_nordic. Some of the features regarding GRTC sleep/wakeup functionality has been modified and moved out to the nrfx driver's code. Signed-off-by: Adam Kondraciuk (cherry picked from commit 88a50aa5ee0a01fe029676b916329dc75ca5deea) (cherry picked from commit f7438b58c1edb10f96e7821c418a52034a0284b2) Signed-off-by: Robert Lubos --- drivers/timer/Kconfig.nrf_grtc | 13 ++- drivers/timer/nrf_grtc_timer.c | 87 +++++-------------- include/zephyr/drivers/timer/nrf_grtc_timer.h | 1 + modules/hal_nordic/nrfx/CMakeLists.txt | 15 +++- 4 files changed, 46 insertions(+), 70 deletions(-) diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc index 0436c071fa2..cda39ae8b1c 100644 --- a/drivers/timer/Kconfig.nrf_grtc +++ b/drivers/timer/Kconfig.nrf_grtc @@ -41,9 +41,20 @@ config NRF_GRTC_TIMER_CLOCK_MANAGEMENT the GRTC. Usually this is only needed by the processor that is starting the SYSCOUNTER, but can be shared by multiple processors in the system. -config NRF_GRTC_SLEEP_MINIMUM_LATENCY +config NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY int default 1000 depends on NRF_GRTC_SLEEP_ALLOWED + 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 + NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY period makes no sense. + +config NRF_GRTC_TIMER_AUTO_KEEP_ALIVE + bool + default y if NRF_GRTC_START_SYSCOUNTER + help + This feature prevents the SYSCOUNTER to sleep when any core is in + active state. endif # NRF_GRTC_TIMER diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 281cdf9ea1f..a8b29b9dcc7 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -29,12 +29,6 @@ #define CHAN_COUNT NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS #define EXT_CHAN_COUNT (CHAN_COUNT - 1) -/* The reset value of waketime is 1, which doesn't seem to work. - * It's being looked into, but for the time being use 4. - * Timeout must always be higher than waketime, so setting that to 5. - */ -#define WAKETIME (4) -#define TIMEOUT (WAKETIME + 1) #ifndef GRTC_SYSCOUNTERL_VALUE_Msk #define GRTC_SYSCOUNTERL_VALUE_Msk GRTC_SYSCOUNTER_SYSCOUNTERL_VALUE_Msk @@ -55,9 +49,6 @@ #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) -/* The maximum SYSCOUNTERVALID settling time equals 1x32k cycles + 20x1MHz cycles. */ -#define GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US 51 - #if defined(CONFIG_TEST) const int32_t z_sys_timer_irq_for_test = DT_IRQN(GRTC_NODE); #endif @@ -78,36 +69,6 @@ static nrfx_grtc_channel_t system_clock_channel_data = { __ASSERT_NO_MSG((NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK & (1UL << (chan))) && \ ((chan) != system_clock_channel_data.channel)) -static inline void grtc_active_set(void) -{ -#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) - nrfy_grtc_sys_counter_active_set(NRF_GRTC, true); - while (!nrfy_grtc_sys_conter_ready_check(NRF_GRTC)) { - } -#else - nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, true); - k_busy_wait(GRTC_SYSCOUNTERVALID_SETTLE_MAX_TIME_US); -#endif -} - -static inline void grtc_wakeup(void) -{ - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - grtc_active_set(); - } -} - -static inline void grtc_sleep(void) -{ - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { -#if defined(NRF_GRTC_HAS_SYSCOUNTER_ARRAY) && (NRF_GRTC_HAS_SYSCOUNTER_ARRAY == 1) - nrfy_grtc_sys_counter_active_set(NRF_GRTC, false); -#else - nrfy_grtc_sys_counter_active_state_request_set(NRF_GRTC, false); -#endif - } -} - static inline uint64_t counter_sub(uint64_t a, uint64_t b) { return (a - b); @@ -116,10 +77,7 @@ static inline uint64_t counter_sub(uint64_t a, uint64_t b) static inline uint64_t counter(void) { uint64_t now; - - grtc_wakeup(); nrfx_grtc_syscounter_get(&now); - grtc_sleep(); return now; } @@ -143,10 +101,8 @@ static inline int get_comparator(uint32_t chan, uint64_t *cc) static void system_timeout_set_relative(uint64_t value) { if (value <= NRF_GRTC_SYSCOUNTER_CCADD_MASK) { - grtc_wakeup(); nrfx_grtc_syscounter_cc_relative_set(&system_clock_channel_data, value, true, NRFX_GRTC_CC_RELATIVE_SYSCOUNTER); - grtc_sleep(); } else { nrfx_grtc_syscounter_cc_absolute_set(&system_clock_channel_data, value + counter(), true); @@ -381,6 +337,7 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ uint64_t capt_time; + nrfx_err_t result; IS_CHANNEL_ALLOWED_ASSERT(chan); @@ -391,8 +348,10 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) */ return -EBUSY; } - - capt_time = nrfy_grtc_sys_counter_cc_get(NRF_GRTC, chan); + result = nrfx_grtc_syscounter_cc_value_read(chan, &capt_time); + if (result != NRFX_SUCCESS) { + return -EPERM; + } __ASSERT_NO_MSG(capt_time < COUNTER_SPAN); @@ -407,16 +366,22 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) nrfx_err_t err_code; static uint8_t systemoff_channel; uint64_t now = counter(); + nrfx_grtc_sleep_config_t sleep_cfg; /* Minimum time that ensures valid execution of system-off procedure. */ - uint32_t minimum_latency_us = nrfy_grtc_waketime_get(NRF_GRTC) + - nrfy_grtc_timeout_get(NRF_GRTC) + - CONFIG_NRF_GRTC_SLEEP_MINIMUM_LATENCY; + uint32_t minimum_latency_us; uint32_t chan; int ret; + nrfx_grtc_sleep_configuration_get(&sleep_cfg); + minimum_latency_us = (sleep_cfg.waketime + sleep_cfg.timeout) * USEC_PER_SEC / 32768 + + CONFIG_NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY; + sleep_cfg.auto_mode = false; + nrfx_grtc_sleep_configure(&sleep_cfg); + if (minimum_latency_us > wake_time_us) { return -EINVAL; } + k_spinlock_key_t key = k_spin_lock(&lock); err_code = nrfx_grtc_channel_alloc(&systemoff_channel); @@ -425,7 +390,9 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) return -ENOMEM; } (void)nrfx_grtc_syscounter_cc_int_disable(systemoff_channel); - ret = compare_set(systemoff_channel, now + wake_time_us, NULL, NULL); + ret = compare_set(systemoff_channel, + now + wake_time_us * sys_clock_hw_cycles_per_sec() / USEC_PER_SEC, NULL, + NULL); if (ret < 0) { k_spin_unlock(&lock, key); return ret; @@ -441,7 +408,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) } /* Make sure that wake_time_us was not triggered yet. */ - if (nrfy_grtc_sys_counter_compare_event_check(NRF_GRTC, systemoff_channel)) { + if (nrfx_grtc_syscounter_compare_event_check(systemoff_channel)) { k_spin_unlock(&lock, key); return -EINVAL; } @@ -452,7 +419,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) MAX_CC_LATCH_WAIT_TIME_US; k_busy_wait(wait_time); #if NRF_GRTC_HAS_CLKSEL - nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFXO); + nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); #endif k_spin_unlock(&lock, key); return 0; @@ -493,16 +460,9 @@ static int sys_clock_driver_init(void) #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. */ - nrfy_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFCLK); + nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFCLK); #endif -#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) - /* SYSCOUNTER needs to be turned off before initialization. */ - nrfy_grtc_sys_counter_set(NRF_GRTC, false); - nrfy_grtc_timeout_set(NRF_GRTC, TIMEOUT); - nrfy_grtc_waketime_set(NRF_GRTC, WAKETIME); -#endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr, nrfx_grtc_irq_handler, 0); @@ -516,9 +476,6 @@ static int sys_clock_driver_init(void) if (err_code != NRFX_SUCCESS) { return err_code == NRFX_ERROR_NO_MEM ? -ENOMEM : -EPERM; } - if (IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - nrfy_grtc_sys_counter_auto_mode_set(NRF_GRTC, false); - } #else err_code = nrfx_grtc_channel_alloc(&system_clock_channel_data.channel); if (err_code != NRFX_SUCCESS) { @@ -526,10 +483,6 @@ static int sys_clock_driver_init(void) } #endif /* CONFIG_NRF_GRTC_START_SYSCOUNTER */ - if (!IS_ENABLED(CONFIG_NRF_GRTC_SLEEP_ALLOWED)) { - grtc_active_set(); - } - int_mask = NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK; if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { system_timeout_set_relative(CYC_PER_TICK); diff --git a/include/zephyr/drivers/timer/nrf_grtc_timer.h b/include/zephyr/drivers/timer/nrf_grtc_timer.h index 4cd3f8d14cb..f8b69d7ddf0 100644 --- a/include/zephyr/drivers/timer/nrf_grtc_timer.h +++ b/include/zephyr/drivers/timer/nrf_grtc_timer.h @@ -171,6 +171,7 @@ int z_nrf_grtc_timer_capture_prepare(int32_t chan); * * @retval 0 if the timestamp was successfully caught and read. * @retval -EBUSY if capturing has not been triggered. + * @retval -EPERM if either channel is unavailable or SYSCOUNTER is not running. */ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time); diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index e46e458ccab..2313c3f311d 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -131,8 +131,19 @@ if(CONFIG_NRFX_TWI OR CONFIG_NRFX_TWIM) zephyr_library_sources(${SRC_DIR}/nrfx_twi_twim.c) endif() -if (CONFIG_NRF_GRTC_TIMER AND CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) - zephyr_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) +if (CONFIG_NRF_GRTC_TIMER) + if (CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) + zephyr_compile_definitions(NRF_GRTC_HAS_EXTENDED=1) + endif() + if (CONFIG_NRF_GRTC_SLEEP_ALLOWED) + zephyr_compile_definitions(NRFX_GRTC_CONFIG_SLEEP_ALLOWED=1) + endif() + if (CONFIG_NRF_GRTC_TIMER_AUTO_KEEP_ALIVE) + zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOEN=1) + endif() + if (CONFIG_NRF_GRTC_START_SYSCOUNTER) + zephyr_compile_definitions(NRFX_GRTC_CONFIG_AUTOSTART=1) + endif() endif() # Inject HAL "CONFIG_NFCT_PINS_AS_GPIOS" definition if user requests to From b613931a18fc53bfa4197e7b5ce66052f178576b Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 17 Apr 2024 13:51:37 +0200 Subject: [PATCH 2108/2300] [nrf noup] boards: nordic: nrf54h20dk: Add aliases for RESETINFO Each local RESETINFO instance can be used in samples. Applied as `noup` because of conflicts. Signed-off-by: Grzegorz Swiderski Signed-off-by: Robert Lubos (cherry picked from commit 04cb69403fc0822aaf9a1e02d58640add1349c8f) --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 + boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index c8b8ec029d3..815e66dc0e0 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -35,6 +35,7 @@ led1 = &led1; led2 = &led2; led3 = &led3; + resetinfo = &cpuapp_resetinfo; sw0 = &button0; sw1 = &button1; sw2 = &button2; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index e3f38846d62..fb05ad589f6 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -36,6 +36,7 @@ }; aliases { ipc-to-cpusys = &cpurad_cpusys_ipc; + resetinfo = &cpurad_resetinfo; }; }; From 58f7829ea0da8a3f79ba154ff0bb5ba5d814e9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Fri, 26 Apr 2024 16:32:56 +0200 Subject: [PATCH 2109/2300] [nrf fromlist] boards: nordic: Add PWM support for LEDs on nRF54 DKs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72010 Adds support for first possible LED to be connected with HW PWM. Signed-off-by: Karol Lasończyk Signed-off-by: Robert Lubos --- .../nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi | 13 +++++++++++++ .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 15 +++++++++++++++ .../nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi | 15 +++++++++++++++ .../nrf54l15pdk/nrf54l15pdk_nrf54l15-pinctrl.dtsi | 13 +++++++++++++ .../nrf54l15pdk_nrf54l15_common_0_2_1.dtsi | 15 +++++++++++++++ 5 files changed, 71 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi index 0cfe8a24c43..888d9a94748 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi @@ -59,4 +59,17 @@ nordic,drive-mode = ; }; }; + + /omit-if-no-ref/ pwm130_default: pwm130_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm130_sleep: pwm130_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 815e66dc0e0..63025205b50 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -35,6 +35,7 @@ led1 = &led1; led2 = &led2; led3 = &led3; + pwm-led0 = &pwm_led0; resetinfo = &cpuapp_resetinfo; sw0 = &button0; sw1 = &button1; @@ -100,6 +101,13 @@ compatible = "nordic,entropy-prng"; status = "okay"; }; + + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + }; + }; }; &cpuapp_ram0x_region { @@ -248,3 +256,10 @@ ipc0: &cpuapp_cpurad_ipc { zephyr_udc0: &usbhs { status = "okay"; }; + +&pwm130 { + status = "okay"; + pinctrl-0 = <&pwm130_default>; + pinctrl-1 = <&pwm130_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi index 028bcfccd54..7aeb311e399 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi @@ -27,6 +27,13 @@ }; }; + pwmleds { + compatible = "pwm-leds"; + pwm_led1: pwm_led_1 { + pwms = <&pwm20 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + }; + }; + buttons { compatible = "gpio-keys"; button0: button_0 { @@ -56,6 +63,7 @@ led1 = &led1; led2 = &led2; led3 = &led3; + pwm-led0 = &pwm_led1; sw0 = &button0; sw1 = &button1; sw2 = &button2; @@ -77,3 +85,10 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; + +&pwm20 { + status = "okay"; + pinctrl-0 = <&pwm20_default>; + pinctrl-1 = <&pwm20_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-pinctrl.dtsi index 043d35adcf4..a0790f2ac48 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-pinctrl.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-pinctrl.dtsi @@ -64,4 +64,17 @@ low-power-enable; }; }; + + /omit-if-no-ref/ pwm20_default: pwm20_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; }; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_common_0_2_1.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_common_0_2_1.dtsi index bfe673ec966..2467b810bb8 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_common_0_2_1.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_common_0_2_1.dtsi @@ -35,3 +35,18 @@ &button3 { gpios = <&gpio2 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; }; + +&pinctrl { + /omit-if-no-ref/ pwm20_default: pwm20_default { + group1 { + psels = ; + }; + }; + + /omit-if-no-ref/ pwm20_sleep: pwm20_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; From 67b7cca9a7f47dc68496f7f20874af42a0394381 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 17 May 2024 14:10:51 +0200 Subject: [PATCH 2110/2300] [nrf noup] kernel: Disable boot banner if NCS_BOOT_BANNER is enabled Zephyr's boot banner should not be used if NCS boot banner is enabled. Signed-off-by: Robert Lubos --- kernel/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/Kconfig b/kernel/Kconfig index c65ec351fcb..f8a3926d451 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -441,6 +441,7 @@ config SKIP_BSS_CLEAR config BOOT_BANNER bool "Boot banner" default y + depends on !NCS_BOOT_BANNER select PRINTK select EARLY_CONSOLE help From 9cd133653721306093dde4571423c05fb472768c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 17 May 2024 13:27:11 +0200 Subject: [PATCH 2111/2300] [nrf noup] dts: nordic: nrf54h20: Allow using spi_dw driver for EXMIF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nrf-squash! [nrf noup] drivers: spi_dw: add custom EXMIF peripheral handling This is a follow-up to commit 7ea6937f02affb74cae2327aeca955ae5e5c3106. Add the "snps,designware-spi" compatible to the EXMIF node so that the peripheral can be used with the spi_dw driver specially modified for that purpose. Signed-off-by: Andrzej Głąbek --- dts/common/nordic/nrf54h20.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 7c5a990563c..89405da6466 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -360,7 +360,7 @@ }; exmif: spi@95000 { - compatible = "nordic,nrf-exmif"; + compatible = "nordic,nrf-exmif", "snps,designware-spi"; #address-cells = <1>; #size-cells = <0>; reg = <0x95000 0x500 0x95500 0xb00>; From afdb974203a2729b7b884ba91575312b1897706d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 21 May 2024 14:20:46 +0200 Subject: [PATCH 2112/2300] [nrf fromlist] usb: device_next: Fix string descriptors response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 2f31ee63b5c5 ("usb: device_next: convert ASCII7 strings to UTF16LE on the fly") made string descriptors respond with twice as much of the actual string data. Fix the issue by taking into account that USB string descriptor length is already multiplied by two. Additionally, make it possible to return odd number of bytes if host requested so. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73079 Signed-off-by: Tomasz Moń Signed-off-by: Robert Lubos --- subsys/usb/device_next/usbd_ch9.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subsys/usb/device_next/usbd_ch9.c b/subsys/usb/device_next/usbd_ch9.c index 8e7db0b756e..459340500ac 100644 --- a/subsys/usb/device_next/usbd_ch9.c +++ b/subsys/usb/device_next/usbd_ch9.c @@ -563,6 +563,7 @@ static void string_ascii7_to_utf16le(struct usbd_desc_node *const dn, }; uint8_t *ascii7_str; size_t len; + size_t i; if (dn->str.utype == USBD_DUT_STRING_SERIAL_NUMBER && dn->str.use_hwinfo) { ssize_t hwid_len = get_sn_from_hwid(hwid_sn); @@ -588,12 +589,16 @@ static void string_ascii7_to_utf16le(struct usbd_desc_node *const dn, net_buf_add_mem(buf, &head, MIN(len, sizeof(head))); len -= MIN(len, sizeof(head)); - for (size_t i = 0; i < len; i++) { + for (i = 0; i < len / 2; i++) { __ASSERT(ascii7_str[i] > 0x1F && ascii7_str[i] < 0x7F, "Only printable ascii-7 characters are allowed in USB " "string descriptors"); net_buf_add_le16(buf, ascii7_str[i]); } + + if (len & 1) { + net_buf_add_u8(buf, ascii7_str[i]); + } } static int sreq_get_desc_dev(struct usbd_contex *const uds_ctx, From 3ac76d3747d24754804f517175fc85785e65b126 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Mon, 20 May 2024 12:26:01 +0200 Subject: [PATCH 2113/2300] [nrf fromlist] usb: device_next: fix BOS descriptor request Return protocol error if bcdUSB is less than 0x0201. Fix typo in number of capabilities. Fixes: b0d7d70834ab ("usb: device_next: add initial BOS support") Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73018 Signed-off-by: Johann Fischer Signed-off-by: Robert Lubos --- subsys/usb/device_next/usbd_ch9.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/subsys/usb/device_next/usbd_ch9.c b/subsys/usb/device_next/usbd_ch9.c index 459340500ac..2b6897e5567 100644 --- a/subsys/usb/device_next/usbd_ch9.c +++ b/subsys/usb/device_next/usbd_ch9.c @@ -708,7 +708,7 @@ static void desc_fill_bos_root(struct usbd_contex *const uds_ctx, SYS_DLIST_FOR_EACH_CONTAINER(&uds_ctx->descriptors, desc_nd, node) { if (desc_nd->bDescriptorType == USB_DESC_BOS) { root->wTotalLength += desc_nd->bLength; - root->bNumDeviceCaps += desc_nd->bLength; + root->bNumDeviceCaps++; } } } @@ -717,10 +717,28 @@ static int sreq_get_desc_bos(struct usbd_contex *const uds_ctx, struct net_buf *const buf) { struct usb_setup_packet *setup = usbd_get_setup_pkt(uds_ctx); + struct usb_device_descriptor *dev_dsc; struct usb_bos_descriptor bos; struct usbd_desc_node *desc_nd; size_t len; + switch (usbd_bus_speed(uds_ctx)) { + case USBD_SPEED_FS: + dev_dsc = uds_ctx->fs_desc; + break; + case USBD_SPEED_HS: + dev_dsc = uds_ctx->hs_desc; + break; + default: + errno = -ENOTSUP; + return 0; + } + + if (sys_le16_to_cpu(dev_dsc->bcdUSB) < 0x0201U) { + errno = -ENOTSUP; + return 0; + } + desc_fill_bos_root(uds_ctx, &bos); len = MIN(net_buf_tailroom(buf), MIN(setup->wLength, bos.wTotalLength)); From 481440f01ac1fd164f34e1338379f92e0646836b Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 16 May 2024 21:47:35 +0530 Subject: [PATCH 2114/2300] [nrf fromlist] tests: spi_loopback: Fix high RAM usage Display diff of contents for large buffers is not quite helpful and takes up huge RAM, and if a board has less RAM then this causes the test module build failures. So, disable display of diff and just log a failure, small buffer tests can be used to debug such basic issues and large buffer tests can act as a smoke test for debugging other issues. This saves about 80K of RAM. Fixes #72792. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/72895 Signed-off-by: Chaitanya Tata Signed-off-by: Robert Lubos --- tests/drivers/spi/spi_loopback/src/spi.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index ea76f8e4f7b..f091f436396 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -88,9 +88,6 @@ static uint8_t buffer_print_rx[BUF_SIZE * 5 + 1]; static uint8_t buffer_print_tx2[BUF2_SIZE * 5 + 1]; static uint8_t buffer_print_rx2[BUF2_SIZE * 5 + 1]; -static uint8_t large_buffer_print_tx[BUF3_SIZE * 5 + 1]; -static uint8_t large_buffer_print_rx[BUF3_SIZE * 5 + 1]; - static void to_display_format(const uint8_t *src, size_t size, char *dst) { size_t i; @@ -558,10 +555,6 @@ static int spi_complete_large_transfers(struct spi_dt_spec *spec) } if (memcmp(large_buffer_tx, large_buffer_rx, BUF3_SIZE)) { - to_display_format(large_buffer_tx, BUF3_SIZE, large_buffer_print_tx); - to_display_format(large_buffer_rx, BUF3_SIZE, large_buffer_print_rx); - LOG_ERR("Large Buffer contents are different: %s", large_buffer_print_tx); - LOG_ERR(" vs: %s", large_buffer_print_rx); zassert_false(1, "Large Buffer contents are different"); return -1; } @@ -691,10 +684,6 @@ static int spi_async_call(struct spi_dt_spec *spec) } if (memcmp(large_buffer_tx, large_buffer_rx, BUF3_SIZE)) { - to_display_format(large_buffer_tx, BUF3_SIZE, large_buffer_print_tx); - to_display_format(large_buffer_rx, BUF3_SIZE, large_buffer_print_rx); - LOG_ERR("Buffer 3 contents are different: %s", large_buffer_print_tx); - LOG_ERR(" vs: %s", large_buffer_print_rx); zassert_false(1, "Buffer 3 contents are different"); return -1; } From b953fbb2ab19247f94bb52e28bea2762e4145b01 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 22 May 2024 09:27:10 +0200 Subject: [PATCH 2115/2300] [nrf fromtree] samples: Bluetooth: hci_vs_scan_req: Build for BT_LL_SW_SPLIT only Build the vendor specific sample hci_vs_scan_req for BT_LL_SW_SPLIT variant of the Controller only. Signed-off-by: Vinayak Kariappa Chettimada (cherry picked from commit 68bd4da4c64ca0c19cee0334bee6496ec8cde2b9) Signed-off-by: Robert Lubos --- samples/bluetooth/hci_vs_scan_req/sample.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/bluetooth/hci_vs_scan_req/sample.yaml b/samples/bluetooth/hci_vs_scan_req/sample.yaml index 9f2aad6f363..245a83aa0d9 100644 --- a/samples/bluetooth/hci_vs_scan_req/sample.yaml +++ b/samples/bluetooth/hci_vs_scan_req/sample.yaml @@ -5,8 +5,8 @@ tests: harness: bluetooth platform_allow: - nrf52dk/nrf52832 - - qemu_cortex_m3 - - qemu_x86 - tags: bluetooth integration_platforms: - - qemu_cortex_m3 + - nrf52dk/nrf52832 + extra_configs: + - CONFIG_BT_LL_SW_SPLIT=y + tags: bluetooth From c65c95f5559b197dedf80781481d4c7a958ea336 Mon Sep 17 00:00:00 2001 From: Maciej Perkowski Date: Wed, 22 May 2024 13:38:01 +0200 Subject: [PATCH 2116/2300] [nrf fromtree] requirements: Set min version of pylint to 3 PR #72592 made pylint to use json2 output format. However, this format is introduced in pylint v3. This commit adds an appropriate setting in the requirements file. Signed-off-by: Maciej Perkowski (cherry picked from commit 3a3f25c9a683562dcf09232eb754fa544affac3b) Signed-off-by: Robert Lubos --- scripts/requirements-compliance.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index 31c395ac4f0..68469fc80ea 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -5,5 +5,5 @@ python-magic python-magic-bin; sys_platform == "win32" lxml junitparser>=2 -pylint +pylint>=3 yamllint From 8d7f0694bfb199a40fa6c37553a36450b2fb0d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 22 May 2024 15:11:33 +0200 Subject: [PATCH 2117/2300] [nrf fromtree] boards: nordic: 54l: use wdt31 instead of wdt30 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use wdt31 instead of wdt30 as wdt30 is hardware fixed to secure. Signed-off-by: Sebastian Bøe (cherry picked from commit 9ef16f55cdc8254ca3490ffac83f6b31aef5a781) Signed-off-by: Robert Lubos --- boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi | 2 +- .../drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay | 2 +- .../watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay | 2 +- .../watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay | 2 +- .../wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi index 7aeb311e399..8baba7eef4a 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15-common.dtsi @@ -68,7 +68,7 @@ sw1 = &button1; sw2 = &button2; sw3 = &button3; - watchdog0 = &wdt30; + watchdog0 = &wdt31; }; }; diff --git a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay index 66157d79fb3..5c765a8a896 100644 --- a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -3,6 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&wdt30 { +&wdt31 { status = "okay"; }; diff --git a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay index 66157d79fb3..5c765a8a896 100644 --- a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay +++ b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay @@ -3,6 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&wdt30 { +&wdt31 { status = "okay"; }; diff --git a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay index 66157d79fb3..5c765a8a896 100644 --- a/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay +++ b/samples/drivers/watchdog/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay @@ -3,6 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&wdt30 { +&wdt31 { status = "okay"; }; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay index aa2789dd45e..8d3dce3b380 100644 --- a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay @@ -4,6 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&wdt30 { +&wdt31 { status = "okay"; }; From b21fbb55e6d602e1c4d18a4a47cd663e749c49b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Fri, 24 May 2024 11:43:08 +0200 Subject: [PATCH 2118/2300] [nrf fromtree] samples: wdt_basic_api: nrf: Add missing nrf overlays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing nrf overlays to fix the sample at build time. Copied from samples/drivers/watchdog/boards. It is not clear why the build failure was not detected earlier. Signed-off-by: Sebastian Bøe (cherry picked from commit afbaaf241d87262136c367e1df54241468bb6d70) Signed-off-by: Robert Lubos --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 8 ++++++++ .../boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay | 8 ++++++++ .../boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay | 8 ++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 00000000000..94e0d719af4 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt010 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay new file mode 100644 index 00000000000..5c765a8a896 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay new file mode 100644 index 00000000000..5c765a8a896 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15pdk_nrf54l15_cpuflpr_xip.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; From 97d39cdeca22b55a584746266b3b8ee4881ce7b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 22 May 2024 15:12:17 +0200 Subject: [PATCH 2119/2300] [nrf fromtree] dts: nordic: 54l: Don't define wdt30 for the non-secure domain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't define wdt30 for the non-secure domain as it is hardware fixed to secure. Signed-off-by: Sebastian Bøe (cherry picked from commit 50aaaa30c28c49fb5b79ff7236989992ebc484b2) Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54l15.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dts/common/nordic/nrf54l15.dtsi b/dts/common/nordic/nrf54l15.dtsi index a15ead43953..b3c44f4c6b7 100644 --- a/dts/common/nordic/nrf54l15.dtsi +++ b/dts/common/nordic/nrf54l15.dtsi @@ -567,12 +567,16 @@ status = "disabled"; }; +#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"; From 258fef2984736479f94585650b447966130e8062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 22 May 2024 15:12:57 +0200 Subject: [PATCH 2120/2300] [nrf fromtree] dts: nordic: 54l: Don't define UICR for the non-secure domain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't define UICR for the non-secure domain as it is hardware fixed to secure. Signed-off-by: Sebastian Bøe (cherry picked from commit 2c19d3ea9240a3508b63424f1aad28521c5c67ab) Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54l15.dtsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dts/common/nordic/nrf54l15.dtsi b/dts/common/nordic/nrf54l15.dtsi index b3c44f4c6b7..93bfaa5db53 100644 --- a/dts/common/nordic/nrf54l15.dtsi +++ b/dts/common/nordic/nrf54l15.dtsi @@ -104,11 +104,14 @@ #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>; From 3f449c6ac29821d29001915fee27d7928ebd5b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 22 May 2024 15:13:58 +0200 Subject: [PATCH 2121/2300] [nrf fromtree] dts: nordic: 54l: Change the peripheral address map for ns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define peripherals with the 0x4000_0000 address range when building for non-secure. Signed-off-by: Sebastian Bøe (cherry picked from commit 90332b9a0b3d800c2fe28ab7672e36598e204113) Signed-off-by: Robert Lubos --- dts/common/nordic/nrf54l15.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/common/nordic/nrf54l15.dtsi b/dts/common/nordic/nrf54l15.dtsi index 93bfaa5db53..0b8eb1c549a 100644 --- a/dts/common/nordic/nrf54l15.dtsi +++ b/dts/common/nordic/nrf54l15.dtsi @@ -134,10 +134,17 @@ ranges = <0x0 0x2002f000 0x11000>; }; +#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"; From f24cfb1491be0d09d36e57e528f66507733ca774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 22 May 2024 15:14:35 +0200 Subject: [PATCH 2122/2300] [nrf fromtree] boards: nordic: 54L: Refactor the board DT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor the 54L board file to be able to better support out-of-tree non-secure boards. This aligns better with nrf53's DT. Signed-off-by: Sebastian Bøe (cherry picked from commit 80209e4fd0b217d8587704cab7ed82999f6549ef) Signed-off-by: Robert Lubos --- .../nrf54l15pdk/nrf54l15_cpuapp_common.dtsi | 150 ++++++++++++++++++ .../nrf54l15pdk_nrf54l15_cpuapp.dts | 139 +--------------- 2 files changed, 152 insertions(+), 137 deletions(-) create mode 100644 boards/nordic/nrf54l15pdk/nrf54l15_cpuapp_common.dtsi diff --git a/boards/nordic/nrf54l15pdk/nrf54l15_cpuapp_common.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15_cpuapp_common.dtsi new file mode 100644 index 00000000000..2fa2ec36428 --- /dev/null +++ b/boards/nordic/nrf54l15pdk/nrf54l15_cpuapp_common.dtsi @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is common to the secure and non-secure domain */ + +#include +#include "nrf54l15pdk_nrf54l15-common.dtsi" + +/ { + chosen { + zephyr,console = &uart20; + zephyr,shell-uart = &uart20; + zephyr,uart-mcumgr = &uart20; + zephyr,flash-controller = &rram_controller; + zephyr,flash = &cpuapp_rram; + zephyr,ieee802154 = &ieee802154; + }; + + aliases { + spi-flash0 = &mx25r64; + }; +}; + +&cpuapp_sram { + status = "okay"; +}; + +&lfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15500>; +}; + +&hfxo { + load-capacitors = "internal"; + load-capacitance-femtofarad = <15000>; +}; + +&grtc { + owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; + /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ + child-owned-channels = <3 4 7 8 9 10 11>; + 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"; + hw-flow-control; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + +&radio { + status = "okay"; +}; + +&ieee802154 { + status = "okay"; +}; + +&temp { + status = "okay"; +}; + +&clock { + status = "okay"; +}; + +&spi00 { + status = "okay"; + cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&spi00_default>; + pinctrl-1 = <&spi00_sleep>; + pinctrl-names = "default", "sleep"; + + mx25r64: mx25r6435f@0 { + compatible = "jedec,spi-nor"; + status = "disabled"; + reg = <0>; + spi-max-frequency = <8000000>; + jedec-id = [c2 28 17]; + sfdp-bfp = [ + e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb + ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 + 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 48 44 + 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff + ]; + size = <67108864>; + has-dpd; + t-enter-dpd = <10000>; + t-exit-dpd = <35000>; + }; +}; + +&adc { + status = "okay"; +}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts index 24b15763bdc..831479ea950 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts @@ -5,150 +5,15 @@ */ /dts-v1/; -#include -#include "nrf54l15pdk_nrf54l15-common.dtsi" + +#include "nrf54l15_cpuapp_common.dtsi" / { compatible = "nordic,nrf54l15pdk_nrf54l15-cpuapp"; model = "Nordic nRF54L15 PDK nRF54L15 Application MCU"; chosen { - zephyr,console = &uart20; - zephyr,shell-uart = &uart20; - zephyr,uart-mcumgr = &uart20; - zephyr,flash-controller = &rram_controller; - zephyr,flash = &cpuapp_rram; zephyr,code-partition = &slot0_partition; zephyr,sram = &cpuapp_sram; - zephyr,ieee802154 = &ieee802154; - }; - - aliases { - spi-flash0 = &mx25r64; - }; -}; - -&cpuapp_sram { - status = "okay"; -}; - -&lfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15500>; -}; - -&hfxo { - load-capacitors = "internal"; - load-capacitance-femtofarad = <15000>; -}; - -&grtc { - owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>; - /* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */ - child-owned-channels = <3 4 7 8 9 10 11>; - 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"; - hw-flow-control; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&radio { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; - -&temp { - status = "okay"; -}; - -&clock { - status = "okay"; -}; - -&spi00 { - status = "okay"; - cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&spi00_default>; - pinctrl-1 = <&spi00_sleep>; - pinctrl-names = "default", "sleep"; - - mx25r64: mx25r6435f@0 { - compatible = "jedec,spi-nor"; - status = "disabled"; - reg = <0>; - spi-max-frequency = <8000000>; - jedec-id = [c2 28 17]; - sfdp-bfp = [ - e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb - ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 - 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 48 44 - 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff - ]; - size = <67108864>; - has-dpd; - t-enter-dpd = <10000>; - t-exit-dpd = <35000>; }; }; - -&adc { - status = "okay"; -}; From 5e11b5fbb8e3114f43eafe858d95fc54479b81bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Wed, 22 May 2024 15:23:29 +0200 Subject: [PATCH 2123/2300] [nrf noup] boards: nordic: 54L: Complete rewrite of the 54l_ns DT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complete rewrite of the 54l_ns DT board definition. Now the secure board and non-secure board re-use a lot more code, giving us a more maintainable solution. Signed-off-by: Sebastian Bøe --- ...rf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi | 38 ------ .../nrf54l15pdk_nrf54l15_cpuapp_ns.dts | 119 ++---------------- 2 files changed, 9 insertions(+), 148 deletions(-) delete mode 100644 boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi deleted file mode 100644 index b4b924e90ef..00000000000 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -&pinctrl { - uart20_default: uart20_default { - group1 { - psels = , - ; - }; - }; - - uart20_sleep: uart20_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart30_default: uart30_default { - group1 { - psels = , - ; - }; - }; - - uart30_sleep: uart30_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - -}; diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts index 49fd1ac0ece..6e05c69c5f9 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp_ns.dts @@ -1,90 +1,25 @@ /* * Copyright (c) 2024 Nordic Semiconductor ASA * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + * SPDX-License-Identifier: Apache-2.0 */ /dts-v1/; -#include -#include "nrf54l15pdk_nrf54l15_cpuapp_ns-pinctrl.dtsi" -/ { - chosen { - zephyr,console = &uart20; - /* TODO: NCSDK-24862: We don't support configuring RRAM and SRAM - * regions in the DTS file yet. The partition manager configures - * these regions now. - */ - zephyr,shell-uart = &uart20; - zephyr,flash = &rram0; - zephyr,sram = &sram0; - zephyr,ieee802154 = &ieee802154; - }; +#define USE_NON_SECURE_ADDRESS_MAP 1 - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - led1: led_1 { - gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - led2: led_2 { - gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; - label = "Green LED 2"; - }; - led3: led_3 { - gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; - label = "Green LED 3"; - }; - }; +#include "nrf54l15_cpuapp_common.dtsi" - buttons { - compatible = "gpio-keys"; - button0: button_0 { - gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 0"; - zephyr,code = ; - }; - button1: button_1 { - gpios = <&gpio1 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - zephyr,code = ; - }; - button2: button_2 { - gpios = <&gpio2 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - zephyr,code = ; - }; - button3: button_3 { - gpios = <&gpio2 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 3"; - zephyr,code = ; - }; - }; +/ { + compatible = "nordic,nrf54l15pdk_nrf54l15-cpuapp"; + model = "Nordic nRF54L15 PDK nRF54L15 Application MCU"; - aliases { - led0 = &led0; - led1 = &led1; - led2 = &led2; - led3 = &led3; - sw0 = &button0; - sw1 = &button1; - sw2 = &button2; - sw3 = &button3; + chosen { + zephyr,code-partition = &slot0_partition; + zephyr,sram = &cpuapp_sram; }; }; -&uart20 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart20_default>; - pinctrl-1 = <&uart20_sleep>; - pinctrl-names = "default", "sleep"; -}; - &uart30 { /* Disable so that TF-M can use this UART */ status = "disabled"; @@ -94,39 +29,3 @@ pinctrl-1 = <&uart30_sleep>; pinctrl-names = "default", "sleep"; }; - -&grtc { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&gpio2 { - status = "okay"; -}; - -&gpiote20 { - status = "okay"; -}; - -&gpiote30 { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; - -&temp { - status = "okay"; -}; - -&clock { - status = "okay"; -}; From 33173b012bd70849b974d419a40f5e38a7b0946b Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 22 May 2024 15:56:44 +0300 Subject: [PATCH 2124/2300] [nrf fromlist] net: lwm2m: Fix null dereference when post-write cb is set When opaque resources have post-write callback set, but the write is not a Block-Wise write, there is no block_ctx and the code causes null pointer dereference when calculating the offset of the data. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73162 Signed-off-by: Seppo Takalo Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index f7e79dc40aa..41165ef4063 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -996,10 +996,10 @@ static int lwm2m_write_handler_opaque(struct lwm2m_engine_obj_inst *obj_inst, #endif /* CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE > 0 */ if (res->post_write_cb) { - ret = res->post_write_cb(obj_inst->obj_inst_id, res->res_id, - res_inst->res_inst_id, data_ptr, len, - last_pkt_block && last_block, opaque_ctx.len, - msg->in.block_ctx->ctx.current); + ret = res->post_write_cb( + obj_inst->obj_inst_id, res->res_id, res_inst->res_inst_id, data_ptr, + len, last_pkt_block && last_block, opaque_ctx.len, + (msg->in.block_ctx ? msg->in.block_ctx->ctx.current : 0)); if (ret < 0) { return ret; } From e47e2a08744790741330978ecf43eab9f7c39ce0 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Wed, 22 May 2024 15:41:00 +0300 Subject: [PATCH 2125/2300] [nrf fromtree] modules: tf-m: nordic: remove problematic include path It made the build of `samples/tfm_integration/tfm_psa_test/sample.tfm.psa_test_crypto` break since the update of Mbed TLS to 3.6.0 (#71118), apparently because `${ZEPHYR_BASE}` wasn't set, and the include doesn't seem to be needed. Signed-off-by: Tomi Fontanilles (cherry picked from commit d830446c91b1c819fa58b5ecb6fc5f31e8064f85) Signed-off-by: Robert Lubos --- modules/trusted-firmware-m/nordic/CMakeLists.txt | 1 - modules/trusted-firmware-m/nordic/ns/CMakeLists.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/modules/trusted-firmware-m/nordic/CMakeLists.txt b/modules/trusted-firmware-m/nordic/CMakeLists.txt index d75b34a8109..c351f97f906 100644 --- a/modules/trusted-firmware-m/nordic/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic/CMakeLists.txt @@ -14,7 +14,6 @@ set(partition_includes set(board_includes ${CMAKE_BINARY_DIR}/../zephyr/misc/generated/syscalls_links/include - ${ZEPHYR_BASE}/include ) target_include_directories(platform_region_defs diff --git a/modules/trusted-firmware-m/nordic/ns/CMakeLists.txt b/modules/trusted-firmware-m/nordic/ns/CMakeLists.txt index 5bb8cb5bd94..67ee755c25e 100644 --- a/modules/trusted-firmware-m/nordic/ns/CMakeLists.txt +++ b/modules/trusted-firmware-m/nordic/ns/CMakeLists.txt @@ -17,7 +17,6 @@ set(partition_includes set(board_includes ${CMAKE_BINARY_DIR}/../zephyr/misc/generated/syscalls_links/include - ${ZEPHYR_BASE}/include ) target_include_directories(platform_region_defs From 590a64a28a88f12c3b78b71f23a243a1e634af8c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 23 May 2024 17:23:09 +0200 Subject: [PATCH 2126/2300] [nrf noup] Revert "modules: mbedtls: fix pk ecc functions undefined references" This reverts commit b876bd26fd7aacbca07041451408425b338e50f2. That needs mbed TLS 3.6.0 to work, as pk_ecc.c was added in that version. To be reverted, when mbed TLS is updated to 3.6.0 in NCS. Signed-off-by: Robert Lubos --- modules/mbedtls/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index 7323072af2e..ca17eb0c44f 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -141,7 +141,6 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/pkparse.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/pkwrite.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/pk.c - ${ZEPHYR_CURRENT_MODULE_DIR}/library/pk_ecc.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/pk_wrap.c ) From b0630e599e06502da9b9e755d54dd495db9f2784 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 24 May 2024 10:43:53 +0200 Subject: [PATCH 2127/2300] [nrf fromlist] samples: net: Exclude native_posix when socket service lib is used Socket service library uses eventfd, which does not work with native_posix platform, hence need to exclude it from samples that now rely on socket services. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73256 Signed-off-by: Robert Lubos --- samples/net/dns_resolve/sample.yaml | 3 +++ samples/net/sockets/big_http_download/sample.yaml | 3 +++ samples/net/sockets/http_get/sample.yaml | 3 +++ samples/posix/gettimeofday/sample.yaml | 3 +++ 4 files changed, 12 insertions(+) diff --git a/samples/net/dns_resolve/sample.yaml b/samples/net/dns_resolve/sample.yaml index f5808607b57..cafc9beac83 100644 --- a/samples/net/dns_resolve/sample.yaml +++ b/samples/net/dns_resolve/sample.yaml @@ -4,6 +4,9 @@ common: tags: - net - dns + platform_exclude: + - native_posix + - native_posix/native/64 sample: description: DNS resolver, mDNS and LLMNR responder name: DNS resolver and responder sample application diff --git a/samples/net/sockets/big_http_download/sample.yaml b/samples/net/sockets/big_http_download/sample.yaml index b8777a4e871..683b8c5c52c 100644 --- a/samples/net/sockets/big_http_download/sample.yaml +++ b/samples/net/sockets/big_http_download/sample.yaml @@ -9,6 +9,9 @@ common: tags: - net - socket + platform_exclude: + - native_posix + - native_posix/native/64 tests: sample.net.sockets.big_http_download: extra_configs: diff --git a/samples/net/sockets/http_get/sample.yaml b/samples/net/sockets/http_get/sample.yaml index 4e454da50a7..2d584cf5e99 100644 --- a/samples/net/sockets/http_get/sample.yaml +++ b/samples/net/sockets/http_get/sample.yaml @@ -8,6 +8,9 @@ common: tags: - net - socket + platform_exclude: + - native_posix + - native_posix/native/64 tests: sample.net.sockets.http_get: filter: not CONFIG_NET_SOCKETS_OFFLOAD and not CONFIG_NATIVE_LIBC diff --git a/samples/posix/gettimeofday/sample.yaml b/samples/posix/gettimeofday/sample.yaml index a71d29f09c5..88748aab2a6 100644 --- a/samples/posix/gettimeofday/sample.yaml +++ b/samples/posix/gettimeofday/sample.yaml @@ -10,6 +10,9 @@ common: tags: - posix - net + platform_exclude: + - native_posix + - native_posix/native/64 tests: sample.posix.gettimeofday: harness: net From 61b8c9bf8ac8e44fe29b5f6a3b0e0528845fad50 Mon Sep 17 00:00:00 2001 From: Piotr Koziar Date: Mon, 6 May 2024 12:14:15 +0200 Subject: [PATCH 2128/2300] [nrf fromlist] dts: nrf54h20: add grtc channel 15 to the pool. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73156 Adds channel 15 to the pool of grtc channels available for allocation (i.e. with 'z_nrf_grtc_timer_chan_alloc') on nRF54H20. The change is motivated by lack of available channels for the nrf_802154_timestamper when building for nRF54H20. Signed-off-by: Piotr Koziar --- dts/arm/nordic/nrf54h20_cpurad.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/arm/nordic/nrf54h20_cpurad.dtsi b/dts/arm/nordic/nrf54h20_cpurad.dtsi index e4a7469dac5..b426d660f3d 100644 --- a/dts/arm/nordic/nrf54h20_cpurad.dtsi +++ b/dts/arm/nordic/nrf54h20_cpurad.dtsi @@ -50,7 +50,7 @@ wdt011: &cpurad_wdt011 {}; }; &grtc { - owned-channels = <7 8 9 10 11 12 13 14>; + owned-channels = <7 8 9 10 11 12 13 14 15>; child-owned-channels = <8 9 10 11 12>; nonsecure-channels = <8 9 10 11 12>; interrupts = <109 NRF_DEFAULT_IRQ_PRIORITY>, From 4f8c7a62a375b4b2295f04facc9d47b055be43f1 Mon Sep 17 00:00:00 2001 From: Piotr Koziar Date: Mon, 13 May 2024 22:17:47 +0200 Subject: [PATCH 2129/2300] [nrf fromlist] modules: hal_nordic: implement hfclk start/stop for cases when clock_control is not available. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73156 Clock_control is currently not supported on nRF54H20. This commit adds new way of handling the hfclk targeted for nRF54H20. This solution shall be replaced once the clock_control is supported for nRF54H20. Signed-off-by: Piotr Koziar --- .../platform/nrf_802154_clock_zephyr.c | 80 +++++++++---------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index 3a3d9501d0c..1db86f5ad14 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -4,18 +4,21 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include +#include +#if defined(CONFIG_CLOCK_CONTROL_NRF) #include #include +#elif !defined(NRF54H_SERIES) +#error No implementation to start or stop HFCLK due to missing clock_control. +#endif static bool hfclk_is_running; -static bool lfclk_is_running; -static struct onoff_client hfclk_cli; -static struct onoff_client lfclk_cli; void nrf_802154_clock_init(void) { @@ -27,6 +30,15 @@ void nrf_802154_clock_deinit(void) /* Intentionally empty. */ } +bool nrf_802154_clock_hfclk_is_running(void) +{ + return hfclk_is_running; +} + +#if defined(CONFIG_CLOCK_CONTROL_NRF) + +static struct onoff_client hfclk_cli; + static void hfclk_on_callback(struct onoff_manager *mgr, struct onoff_client *cli, uint32_t state, @@ -63,53 +75,39 @@ void nrf_802154_clock_hfclk_stop(void) hfclk_is_running = false; } -bool nrf_802154_clock_hfclk_is_running(void) -{ - return hfclk_is_running; -} +#elif defined(NRF54H_SERIES) -static void lfclk_on_callback(struct onoff_manager *mgr, - struct onoff_client *cli, - uint32_t state, - int res) -{ - lfclk_is_running = true; - nrf_802154_clock_lfclk_ready(); -} +#define NRF_LRCCONF_RADIO_PD NRF_LRCCONF010 +#define MAX_HFXO_RAMP_UP_TIME_US 1000 -void nrf_802154_clock_lfclk_start(void) +static void hfclk_started_timer_handler(struct k_timer *dummy) { - int ret; - struct onoff_manager *mgr = - z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_LF); - - __ASSERT_NO_MSG(mgr != NULL); - - sys_notify_init_callback(&lfclk_cli.notify, lfclk_on_callback); - - ret = onoff_request(mgr, &lfclk_cli); - __ASSERT_NO_MSG(ret >= 0); + hfclk_is_running = true; + nrf_802154_clock_hfclk_ready(); } -void nrf_802154_clock_lfclk_stop(void) -{ - int ret; - struct onoff_manager *mgr = - z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_LF); +K_TIMER_DEFINE(hfclk_started_timer, hfclk_started_timer_handler, NULL); - __ASSERT_NO_MSG(mgr != NULL); +void nrf_802154_clock_hfclk_start(void) +{ + /* Use register directly, there is no support for that task in nrf_lrcconf_task_trigger. + * This code might cause troubles if there are other HFXO users in this CPU. + */ + NRF_LRCCONF_RADIO_PD->EVENTS_HFXOSTARTED = 0x0; + NRF_LRCCONF_RADIO_PD->TASKS_REQHFXO = 0x1; - ret = onoff_cancel_or_release(mgr, &lfclk_cli); - __ASSERT_NO_MSG(ret >= 0); - lfclk_is_running = false; + k_timer_start(&hfclk_started_timer, K_USEC(MAX_HFXO_RAMP_UP_TIME_US), K_NO_WAIT); } -bool nrf_802154_clock_lfclk_is_running(void) +void nrf_802154_clock_hfclk_stop(void) { - return lfclk_is_running; -} + /* Use register directly, there is no support for that task in nrf_lrcconf_task_trigger. + * This code might cause troubles if there are other HFXO users in this CPU. + */ + NRF_LRCCONF_RADIO_PD->TASKS_STOPREQHFXO = 0x1; + NRF_LRCCONF_RADIO_PD->EVENTS_HFXOSTARTED = 0x0; -__WEAK void nrf_802154_clock_lfclk_ready(void) -{ - /* Intentionally empty. */ + hfclk_is_running = false; } + +#endif From 78995ff7ca0a16cace6e59d08f5eb18eee12c607 Mon Sep 17 00:00:00 2001 From: Piotr Koziar Date: Wed, 15 May 2024 16:10:59 +0200 Subject: [PATCH 2130/2300] [nrf fromlist] ipc: fix return code of icbmsg backend send operation. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73156 This commit fixes the issue where a serialization error was reported after properly sending a data with 'icbmsg' backend. The icbmsg send function's return code is set to the sent data's len as in other backends. The related docs were fixed and updated. Signed-off-by: Piotr Koziar --- include/zephyr/ipc/icmsg.h | 2 +- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/zephyr/ipc/icmsg.h b/include/zephyr/ipc/icmsg.h index 3bc03804ca8..80e3412095a 100644 --- a/include/zephyr/ipc/icmsg.h +++ b/include/zephyr/ipc/icmsg.h @@ -111,7 +111,7 @@ int icmsg_close(const struct icmsg_config_t *conf, * @param[in] len Size of data in the @p msg buffer. * * - * @retval 0 on success. + * @retval Number of sent bytes. * @retval -EBUSY when the instance has not finished handshake with the remote * instance. * @retval -ENODATA when the requested data to send is empty. diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index 37594025313..4a3fdad1adf 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -501,7 +501,7 @@ static int send_control_message(struct backend_data *dev_data, enum msg_type msg r = icmsg_send(&conf->control_config, &dev_data->control_data, &message, sizeof(message)); k_mutex_unlock(&dev_data->mutex); - if (r < 0) { + if (r < sizeof(message)) { LOG_ERR("Cannot send over ICMsg, err %d", r); } return r; @@ -541,7 +541,7 @@ static int send_release(struct backend_data *dev_data, const uint8_t *buffer, * @param[in] size Actual size of the data, can be smaller than allocated, * but it cannot change number of required blocks. * - * @return O or negative error code. + * @return number of bytes sent in the message or negative error code. */ static int send_block(struct backend_data *dev_data, enum msg_type msg_type, uint8_t ept_addr, size_t tx_block_index, size_t size) @@ -656,7 +656,7 @@ static int match_bound_msg(struct backend_data *dev_data, size_t rx_block_index, * * @param[in] ept Endpoint to use. * - * @return O or negative error code. + * @return non-negative value in case of success or negative error code. */ static int send_bound_message(struct backend_data *dev_data, struct ept_data *ept) { @@ -992,7 +992,12 @@ static int send(const struct device *instance, void *token, const void *msg, siz memcpy(buffer, msg, len); /* Send data message. */ - return send_block(dev_data, MSG_DATA, ept->addr, r, len); + r = send_block(dev_data, MSG_DATA, ept->addr, r, len); + if (r < 0) { + return r; + } + + return len; } /** From e41c78ce8e55e76619666a9cf71dc288863b9207 Mon Sep 17 00:00:00 2001 From: Piotr Koziar Date: Tue, 21 May 2024 14:03:42 +0200 Subject: [PATCH 2131/2300] [nrf fromlist] modules: hal_nordic: turn off temperature update by default for nRF54H20. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73156 Adds an appropriate condition to the Kconfig as the temperature driver is not supported for nRF54H20 devices yet. Without this change, a build with NRF 802.15.4 libraries produces Kconfig error. Signed-off-by: Piotr Koziar --- 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 a7d55e4620a..13ab8d9cd2f 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 + default y if !SOC_NRF54H20 help Enable temperature update for nRF 802.15.4 driver From b8be35e1845520a4722866c313ba30760ae9691d Mon Sep 17 00:00:00 2001 From: Piotr Koziar Date: Wed, 22 May 2024 15:14:53 +0200 Subject: [PATCH 2132/2300] [nrf fromlist] drivers: ieee802154_nrf5: Use BLE.ADDR instead of FICR to create EUI64. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73156 Use BLE.ADDR to create unique (to some extent) EUI64 on nRF54H20 in some cases inside the IEEE 802.15.4 driver. The amount of EUI64-s available in such a way is very limited (~16 million). However, currently there does not seem to be another feasible way to get device identifiers on nRF54H20 (such are kept in SICR, to which the radio core has no access). Signed-off-by: Piotr Koziar --- drivers/ieee802154/ieee802154_nrf5.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 4cbdd9eb607..77993ac9fbb 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -126,7 +126,11 @@ static void nrf5_get_eui64(uint8_t *mac) mac[index++] = (IEEE802154_NRF5_VENDOR_OUI >> 8) & 0xff; mac[index++] = IEEE802154_NRF5_VENDOR_OUI & 0xff; -#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) +#if defined(NRF54H_SERIES) + /* Can't access SICR with device id on a radio core. Use BLE.ADDR. */ + deviceid[0] = NRF_FICR->BLE.ADDR[0]; + deviceid[1] = NRF_FICR->BLE.ADDR[1]; +#elif defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && defined(NRF_FICR_S) soc_secure_read_deviceid(deviceid); #else deviceid[0] = nrf_ficr_deviceid_get(NRF_FICR, 0); From a1769aba631b078769d182eaaea13aafc09039bc Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Wed, 22 May 2024 14:45:28 +0530 Subject: [PATCH 2133/2300] [nrf fromtree] net: wifi: Add disconnection success code When disconnect request is successful, the status was taking as WIFI_REASON_DISCONN_UNSPECIFIED only. Adding WIFI_REASON_DISCONN_SUCCESS which can be help to determine status of disconnect request. If this status is failed then reason can be useful. Signed-off-by: Kapil Bhatt (cherry picked from commit cc42d16b1c6bb26dcabe754a485a7b2d0ca8ac02) Signed-off-by: Robert Lubos --- include/zephyr/net/wifi_mgmt.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 0442a91c2f2..8c2b61fa936 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -427,8 +427,10 @@ enum wifi_conn_status { * in the disconnect result event for detailed reason. */ enum wifi_disconn_reason { + /** Success, overload status as reason */ + WIFI_REASON_DISCONN_SUCCESS = 0, /** Unspecified reason */ - WIFI_REASON_DISCONN_UNSPECIFIED = WIFI_STATUS_DISCONN_FIRST_STATUS, + WIFI_REASON_DISCONN_UNSPECIFIED, /** Disconnected due to user request */ WIFI_REASON_DISCONN_USER_REQUEST, /** Disconnected due to AP leaving */ From dd4f7c3c8934f80151731cfc64dc1513adec6852 Mon Sep 17 00:00:00 2001 From: Yuxuan Cai Date: Tue, 28 May 2024 07:19:48 -0700 Subject: [PATCH 2134/2300] [nrf fromlist] samples: Bluetooth: use correct periodic advertising intervals BT_GAP_ADV_SLOW_INT_MIN and BT_GAP_ADV_SLOW_INT_MAX represent 1s and 1.2s, respectively, in the extended advertising context, where the bit interval is 0.625 ms. Using them for periodic advertising will result in a range of [2s, 2.4s], as the bit interval for periodic advertising is 1.25ms. Instead, BT_GAP_PER_ADV_SLOW_INT_MIN and BT_GAP_PER_ADV_SLOW_INT_MAX should be used in this sample, and the range will become [1s, 1.2s]. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73418 Signed-off-by: Yuxuan Cai --- .../bluetooth/direction_finding_connectionless_tx/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/bluetooth/direction_finding_connectionless_tx/src/main.c b/samples/bluetooth/direction_finding_connectionless_tx/src/main.c index ef6a89b8852..f827e39a657 100644 --- a/samples/bluetooth/direction_finding_connectionless_tx/src/main.c +++ b/samples/bluetooth/direction_finding_connectionless_tx/src/main.c @@ -42,8 +42,8 @@ static struct bt_le_ext_adv_start_param ext_adv_start_param = { }; static struct bt_le_per_adv_param per_adv_param = { - .interval_min = BT_GAP_ADV_SLOW_INT_MIN, - .interval_max = BT_GAP_ADV_SLOW_INT_MAX, + .interval_min = BT_GAP_PER_ADV_SLOW_INT_MIN, + .interval_max = BT_GAP_PER_ADV_SLOW_INT_MAX, .options = BT_LE_ADV_OPT_USE_TX_POWER, }; From 78d3dec9f93725fd453e1a3a960a1a4a6a12c483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 28 May 2024 11:43:42 +0200 Subject: [PATCH 2135/2300] [nrf fromlist] scripts: west_commands: runners: nrf_common: optional UICR cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The flasher was unconditionally cleaning the UICR area, even when the application didn't have a new configuration generated. This can happen, when CONFIG_NRF_REGTOOL_GENERATE_UICR=n. In such case, keep the old UICR configuration on the device. A real scenario where we should set CONFIG_NRF_REGTOOL_GENERATE_UICR=n is when building multiple firmware images that are meant to run one domain. The primary application build generates the UICR configuration and secondary images don't. Before this change, the flashing process of the primary application would write new UICR configuration, but the flashing process of secondary images would erase it. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/73391 Signed-off-by: Rafał Kuźnia --- scripts/west_commands/runners/nrf_common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 1ea09f8f595..1d7b9706741 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -261,13 +261,13 @@ def program_hex(self): self.exec_op('erase', core='NRFDL_DEVICE_CORE_NETWORK') if self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPUAPP'): - if not self.erase: + if not self.erase and self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR'): self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION', chip_erase_mode='ERASE_UICR', qspi_erase_mode='ERASE_NONE') core = 'NRFDL_DEVICE_CORE_APPLICATION' elif self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPURAD'): - if not self.erase: + if not self.erase and self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR'): self.exec_op('erase', core='NRFDL_DEVICE_CORE_NETWORK', chip_erase_mode='ERASE_UICR', qspi_erase_mode='ERASE_NONE') From 0cfb2afa8178313403a5c28140a8d667905b8dc3 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 28 May 2024 15:47:02 +0530 Subject: [PATCH 2136/2300] [nrf fromtree] net: shell: Add random MAC address generation Add option for setting a random MAC address to the net iface set_mac command. With random option a random MAC address can be assigned to an interface. [SHEL-2352]. Signed-off-by: Kapil Bhatt (cherry picked from commit 8a52b6487529ee5d1fb73eb773ec46abf18370b8) --- subsys/net/lib/shell/iface.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/subsys/net/lib/shell/iface.c b/subsys/net/lib/shell/iface.c index 00c681784ed..97533ecbccf 100644 --- a/subsys/net/lib/shell/iface.c +++ b/subsys/net/lib/shell/iface.c @@ -6,6 +6,8 @@ */ #include +#include +#include LOG_MODULE_DECLARE(net_shell); #if defined(CONFIG_NET_L2_ETHERNET) @@ -20,6 +22,9 @@ LOG_MODULE_DECLARE(net_shell); #include "net_shell_private.h" +#define UNICAST_MASK GENMASK(7, 1) +#define LOCAL_BIT BIT(1) + #if defined(CONFIG_NET_L2_ETHERNET) && defined(CONFIG_NET_NATIVE) struct ethernet_capabilities { enum ethernet_hw_caps capability; @@ -536,10 +541,15 @@ static int cmd_net_set_mac(const struct shell *sh, size_t argc, char *argv[]) goto err; } - if ((net_bytes_from_str(mac_addr, sizeof(params.mac_address), argv[2]) < 0) || - !net_eth_is_addr_valid(¶ms.mac_address)) { - PR_WARNING("Invalid MAC address: %s\n", argv[2]); - goto err; + if (!strncasecmp(argv[2], "random", 6)) { + sys_rand_get(mac_addr, NET_ETH_ADDR_LEN); + mac_addr[0] = (mac_addr[0] & UNICAST_MASK) | LOCAL_BIT; + } else { + if ((net_bytes_from_str(mac_addr, sizeof(params.mac_address), argv[2]) < 0) || + !net_eth_is_addr_valid(¶ms.mac_address)) { + PR_WARNING("Invalid MAC address: %s\n", argv[2]); + goto err; + } } ret = net_mgmt(NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, iface, ¶ms, sizeof(params)); From 1f925799a3f1c2a327d4192918ffe5093d1b77b1 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Tue, 28 May 2024 14:52:15 +0530 Subject: [PATCH 2137/2300] [nrf fromtree] net: wifi: shell: Support to print name Support to print name of the argument along with the value. Signed-off-by: Ajay Parida (cherry picked from commit 180c22a4fcbae1d2f640200d3a11bb36e132998a) --- subsys/net/l2/wifi/wifi_shell.c | 47 +++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index ab2637a1271..7bdd9801650 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -75,7 +75,8 @@ struct wifi_ap_sta_node { }; static struct wifi_ap_sta_node sta_list[CONFIG_WIFI_SHELL_MAX_AP_STA]; -static bool parse_number(const struct shell *sh, long *param, char *str, long min, long max) +static bool parse_number(const struct shell *sh, long *param, char *str, + char *pname, long min, long max) { char *endptr; char *str_tmp = str; @@ -94,7 +95,13 @@ static bool parse_number(const struct shell *sh, long *param, char *str, long mi } if ((num) < (min) || (num) > (max)) { - PR_WARNING("Value out of range: %s, (%ld-%ld)", str_tmp, min, max); + if (pname) { + PR_WARNING("%s value out of range: %s, (%ld-%ld)", + pname, str_tmp, min, max); + } else { + PR_WARNING("Value out of range: %s, (%ld-%ld)", + str_tmp, min, max); + } return false; } *param = num; @@ -1067,12 +1074,12 @@ static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc, params.setup.trigger = 0; params.setup.announce = 0; - if (!parse_number(sh, &value, argv[idx++], 1, WIFI_MAX_TWT_WAKE_INTERVAL_US)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 1, WIFI_MAX_TWT_WAKE_INTERVAL_US)) { return -EINVAL; } params.setup.twt_wake_interval = (uint32_t)value; - if (!parse_number(sh, &value, argv[idx++], 1, WIFI_MAX_TWT_INTERVAL_US)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 1, WIFI_MAX_TWT_INTERVAL_US)) { return -EINVAL; } params.setup.twt_interval = (uint64_t)value; @@ -1105,59 +1112,59 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc, params.operation = WIFI_TWT_SETUP; - if (!parse_number(sh, &value, argv[idx++], WIFI_TWT_INDIVIDUAL, + if (!parse_number(sh, &value, argv[idx++], NULL, WIFI_TWT_INDIVIDUAL, WIFI_TWT_WAKE_TBTT)) { return -EINVAL; } params.negotiation_type = (enum wifi_twt_negotiation_type)value; - if (!parse_number(sh, &value, argv[idx++], WIFI_TWT_SETUP_CMD_REQUEST, + if (!parse_number(sh, &value, argv[idx++], NULL, WIFI_TWT_SETUP_CMD_REQUEST, WIFI_TWT_SETUP_CMD_DEMAND)) { return -EINVAL; } params.setup_cmd = (enum wifi_twt_setup_cmd)value; - if (!parse_number(sh, &value, argv[idx++], 1, 255)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 1, 255)) { return -EINVAL; } params.dialog_token = (uint8_t)value; - if (!parse_number(sh, &value, argv[idx++], 0, (WIFI_MAX_TWT_FLOWS - 1))) { + if (!parse_number(sh, &value, argv[idx++], NULL, 0, (WIFI_MAX_TWT_FLOWS - 1))) { return -EINVAL; } params.flow_id = (uint8_t)value; - if (!parse_number(sh, &value, argv[idx++], 0, 1)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 0, 1)) { return -EINVAL; } params.setup.responder = (bool)value; - if (!parse_number(sh, &value, argv[idx++], 0, 1)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 0, 1)) { return -EINVAL; } params.setup.trigger = (bool)value; - if (!parse_number(sh, &value, argv[idx++], 0, 1)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 0, 1)) { return -EINVAL; } params.setup.implicit = (bool)value; - if (!parse_number(sh, &value, argv[idx++], 0, 1)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 0, 1)) { return -EINVAL; } params.setup.announce = (bool)value; - if (!parse_number(sh, &value, argv[idx++], 1, WIFI_MAX_TWT_WAKE_INTERVAL_US)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 1, WIFI_MAX_TWT_WAKE_INTERVAL_US)) { return -EINVAL; } params.setup.twt_wake_interval = (uint32_t)value; - if (!parse_number(sh, &value, argv[idx++], 1, WIFI_MAX_TWT_INTERVAL_US)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 1, WIFI_MAX_TWT_INTERVAL_US)) { return -EINVAL; } params.setup.twt_interval = (uint64_t)value; - if (!parse_number(sh, &value, argv[idx++], 0, WIFI_MAX_TWT_WAKE_AHEAD_DURATION_US)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 0, WIFI_MAX_TWT_WAKE_AHEAD_DURATION_US)) { return -EINVAL; } params.setup.twt_wake_ahead_duration = (uint32_t)value; @@ -1190,24 +1197,24 @@ static int cmd_wifi_twt_teardown(const struct shell *sh, size_t argc, params.operation = WIFI_TWT_TEARDOWN; - if (!parse_number(sh, &value, argv[idx++], WIFI_TWT_INDIVIDUAL, + if (!parse_number(sh, &value, argv[idx++], NULL, WIFI_TWT_INDIVIDUAL, WIFI_TWT_WAKE_TBTT)) { return -EINVAL; } params.negotiation_type = (enum wifi_twt_negotiation_type)value; - if (!parse_number(sh, &value, argv[idx++], WIFI_TWT_SETUP_CMD_REQUEST, + if (!parse_number(sh, &value, argv[idx++], NULL, WIFI_TWT_SETUP_CMD_REQUEST, WIFI_TWT_SETUP_CMD_DEMAND)) { return -EINVAL; } params.setup_cmd = (enum wifi_twt_setup_cmd)value; - if (!parse_number(sh, &value, argv[idx++], 1, 255)) { + if (!parse_number(sh, &value, argv[idx++], NULL, 1, 255)) { return -EINVAL; } params.dialog_token = (uint8_t)value; - if (!parse_number(sh, &value, argv[idx++], 0, (WIFI_MAX_TWT_FLOWS - 1))) { + if (!parse_number(sh, &value, argv[idx++], NULL, 0, (WIFI_MAX_TWT_FLOWS - 1))) { return -EINVAL; } params.flow_id = (uint8_t)value; @@ -1441,7 +1448,7 @@ static int cmd_wifi_listen_interval(const struct shell *sh, size_t argc, char *a context.sh = sh; - if (!parse_number(sh, &interval, argv[1], + if (!parse_number(sh, &interval, argv[1], NULL, WIFI_LISTEN_INTERVAL_MIN, WIFI_LISTEN_INTERVAL_MAX)) { return -EINVAL; From 975bfdeb143131f49c6a86568b0a2f824e61bbf5 Mon Sep 17 00:00:00 2001 From: Ajay Parida Date: Wed, 8 May 2024 12:50:48 +0530 Subject: [PATCH 2138/2300] [nrf fromtree] net: wifi_mgmt: Support to configure AP mode parameter Support to set BSS parameter at compile and run time. Added support to configure `max_inactivity` BSS parameter. Station inactivity timeout is the period for which AP may keep a client in associated state while there is no traffic from that particular client. If a non-zero value is set, AP may choose to disassociate the client after the timeout. Signed-off-by: Ajay Parida (cherry picked from commit c6d1a91372082028b3e153a1246fde6f113eda80) --- include/zephyr/net/wifi.h | 6 +++ include/zephyr/net/wifi_mgmt.h | 30 ++++++++++++++- subsys/net/l2/wifi/Kconfig | 9 +++++ subsys/net/l2/wifi/wifi_mgmt.c | 25 +++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 65 +++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index 5f47209b83f..ab00980a69c 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -494,6 +494,12 @@ static inline const char *wifi_ps_get_config_err_code_str(int16_t err_no) return ""; } +/** @brief Wi-Fi AP mode configuration parameter */ +enum wifi_ap_config_param { + /** Used for AP mode configuration parameter ap_max_inactivity */ + WIFI_AP_CONFIG_PARAM_MAX_INACTIVITY = BIT(0), +}; + #ifdef __cplusplus } #endif diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 8c2b61fa936..910ee030651 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -88,7 +88,8 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_VERSION, /** Set RTS threshold */ NET_REQUEST_WIFI_CMD_RTS_THRESHOLD, - + /** Configure AP parameter */ + NET_REQUEST_WIFI_CMD_AP_CONFIG_PARAM, /** @cond INTERNAL_HIDDEN */ NET_REQUEST_WIFI_CMD_MAX /** @endcond */ @@ -190,6 +191,12 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD); +/** Request a Wi-Fi AP parameters configuration */ +#define NET_REQUEST_WIFI_AP_CONFIG_PARAM \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_CONFIG_PARAM) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_CONFIG_PARAM); + /** @brief Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -746,6 +753,18 @@ struct wifi_channel_info { enum wifi_mgmt_op oper; }; +/** @cond INTERNAL_HIDDEN */ +#define WIFI_AP_STA_MAX_INACTIVITY (LONG_MAX - 1) +/** @endcond */ + +/** @brief Wi-Fi AP configuration parameter */ +struct wifi_ap_config_params { + /** Parameter used to identify the different AP parameters */ + enum wifi_ap_config_param type; + /** Parameter used for setting maximum inactivity duration for stations */ + uint32_t max_inactivity; +}; + #include /** Scan result callback @@ -919,7 +938,14 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*set_rts_threshold)(const struct device *dev, unsigned int rts_threshold); - + /** Configure AP parameter + * + * @param dev Pointer to the device structure for the driver instance. + * @param params AP mode parameter configuration parameter info + * + * @return 0 if ok, < 0 if error + */ + int (*ap_config_params)(const struct device *dev, struct wifi_ap_config_params *params); }; /** Wi-Fi management offload API */ diff --git a/subsys/net/l2/wifi/Kconfig b/subsys/net/l2/wifi/Kconfig index 2816be56d74..0ad0858fab2 100644 --- a/subsys/net/l2/wifi/Kconfig +++ b/subsys/net/l2/wifi/Kconfig @@ -93,3 +93,12 @@ module-str = Log level for Wi-Fi Network manager module module-help = Enables using the Wi-Fi Network managers to manage the Wi-Fi network interfaces. source "subsys/net/Kconfig.template.log_config.net" endif # WIFI_NM + +config WIFI_MGMT_AP_STA_INACTIVITY_TIMEOUT + int "Station inactivity timeout in seconds" + default 300 + help + Station inactivity timeout is the period for which AP may keep a client + in associated state while there is no traffic from that particular + client. If a non-zero value is set, AP may choose to disassociate the + client after the timeout. diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 51e76aec5fb..b6f4a6cd2c6 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -435,6 +435,31 @@ static int wifi_ap_sta_disconnect(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT, wifi_ap_sta_disconnect); +static int wifi_ap_config_params(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_ap_config_params *params = data; + + if (dev == NULL) { + return -ENODEV; + } + + if (wifi_mgmt_api == NULL || + wifi_mgmt_api->ap_config_params == NULL) { + return -ENOTSUP; + } + + if (!data || len != sizeof(*params)) { + return -EINVAL; + } + + return wifi_mgmt_api->ap_config_params(dev, params); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_CONFIG_PARAM, wifi_ap_config_params); + static int wifi_iface_status(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 7bdd9801650..87930f7cbaf 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1370,6 +1370,65 @@ static int cmd_wifi_ap_sta_disconnect(const struct shell *sh, size_t argc, return 0; } +static int wifi_ap_config_args_to_params(const struct shell *sh, size_t argc, char *argv[], + struct wifi_ap_config_params *params) +{ + struct getopt_state *state; + int opt; + static struct option long_options[] = {{"max_inactivity", required_argument, 0, 'i'}, + {"help", no_argument, 0, 'h'}, + {0, 0, 0, 0}}; + int opt_index = 0; + long val; + + while ((opt = getopt_long(argc, argv, "i:h", long_options, &opt_index)) != -1) { + state = getopt_state_get(); + switch (opt) { + case 'i': + if (!parse_number(sh, &val, optarg, "max_inactivity", + 0, WIFI_AP_STA_MAX_INACTIVITY)) { + return -EINVAL; + } + params->max_inactivity = (uint32_t)val; + params->type |= WIFI_AP_CONFIG_PARAM_MAX_INACTIVITY; + break; + case 'h': + shell_help(sh); + return SHELL_CMD_HELP_PRINTED; + default: + PR_ERROR("Invalid option %c\n", optopt); + shell_help(sh); + return SHELL_CMD_HELP_PRINTED; + } + } + + return 0; +} + +static int cmd_wifi_ap_config_params(const struct shell *sh, size_t argc, + char *argv[]) +{ + struct net_if *iface = net_if_get_first_wifi(); + struct wifi_ap_config_params ap_config_params = { 0 }; + int ret = -1; + + context.sh = sh; + + if (wifi_ap_config_args_to_params(sh, argc, argv, &ap_config_params)) { + return -ENOEXEC; + } + + ret = net_mgmt(NET_REQUEST_WIFI_AP_CONFIG_PARAM, iface, + &ap_config_params, sizeof(struct wifi_ap_config_params)); + if (ret) { + PR_WARNING("Setting AP parameter failed: %s\n", + strerror(-ret)); + return -ENOEXEC; + } + + return 0; +} + static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc, char *argv[]) { @@ -1893,6 +1952,12 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, "\n", cmd_wifi_ap_sta_disconnect, 2, 0), + SHELL_CMD_ARG(config, NULL, + "Configure AP parameters.\n" + "-i --max_inactivity=